summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/alpha/Dist11
-rw-r--r--sysdeps/alpha/Implies5
-rw-r--r--sysdeps/alpha/__longjmp.S11
-rw-r--r--sysdeps/alpha/bits/link.h69
-rw-r--r--sysdeps/alpha/bits/mathdef.h80
-rw-r--r--sysdeps/alpha/bits/setjmp.h27
-rw-r--r--sysdeps/alpha/div_libc.h6
-rw-r--r--sysdeps/alpha/divl.S2
-rw-r--r--sysdeps/alpha/divq.S2
-rw-r--r--sysdeps/alpha/divqu.S4
-rw-r--r--sysdeps/alpha/dl-dtprocnum.h3
-rw-r--r--sysdeps/alpha/dl-machine.h309
-rw-r--r--sysdeps/alpha/dl-sysdep.h21
-rw-r--r--sysdeps/alpha/dl-trampoline.S541
-rw-r--r--sysdeps/alpha/elf/start.S2
-rw-r--r--sysdeps/alpha/fpu/bits/mathdef.h86
-rw-r--r--sysdeps/alpha/fpu/bits/mathinline.h17
-rw-r--r--sysdeps/alpha/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/alpha/fpu/fesetround.c3
-rw-r--r--sysdeps/alpha/fpu/libm-test-ulps4
-rw-r--r--sysdeps/alpha/fpu/s_cacosf.c4
-rw-r--r--sysdeps/alpha/fpu/s_cacoshf.c4
-rw-r--r--sysdeps/alpha/fpu/s_casinf.c4
-rw-r--r--sysdeps/alpha/fpu/s_casinhf.c4
-rw-r--r--sysdeps/alpha/fpu/s_catanf.c4
-rw-r--r--sysdeps/alpha/fpu/s_catanhf.c4
-rw-r--r--sysdeps/alpha/fpu/s_ccosf.c4
-rw-r--r--sysdeps/alpha/fpu/s_ccoshf.c4
-rw-r--r--sysdeps/alpha/fpu/s_ceil.c6
-rw-r--r--sysdeps/alpha/fpu/s_cexpf.c4
-rw-r--r--sysdeps/alpha/fpu/s_clog10f.c4
-rw-r--r--sysdeps/alpha/fpu/s_clogf.c4
-rw-r--r--sysdeps/alpha/fpu/s_copysign.c10
-rw-r--r--sysdeps/alpha/fpu/s_cpowf.c4
-rw-r--r--sysdeps/alpha/fpu/s_cprojf.c4
-rw-r--r--sysdeps/alpha/fpu/s_csinf.c4
-rw-r--r--sysdeps/alpha/fpu/s_csinhf.c4
-rw-r--r--sysdeps/alpha/fpu/s_csqrtf.c4
-rw-r--r--sysdeps/alpha/fpu/s_ctanf.c4
-rw-r--r--sysdeps/alpha/fpu/s_ctanhf.c4
-rw-r--r--sysdeps/alpha/fpu/s_fabs.c6
-rw-r--r--sysdeps/alpha/fpu/s_floor.c6
-rw-r--r--sysdeps/alpha/fpu/s_rint.c6
-rw-r--r--sysdeps/alpha/htonl.S2
-rw-r--r--sysdeps/alpha/htons.S2
-rw-r--r--sysdeps/alpha/jmpbuf-offsets.h36
-rw-r--r--sysdeps/alpha/jmpbuf-unwind.h48
-rw-r--r--sysdeps/alpha/ldiv.S2
-rw-r--r--sysdeps/alpha/libc-tls.c6
-rw-r--r--sysdeps/alpha/reml.S2
-rw-r--r--sysdeps/alpha/remq.S2
-rw-r--r--sysdeps/alpha/remqu.S4
-rw-r--r--sysdeps/alpha/setjmp.S57
-rw-r--r--sysdeps/alpha/soft-fp/Dist14
-rw-r--r--sysdeps/alpha/soft-fp/Makefile4
-rw-r--r--sysdeps/alpha/soft-fp/e_sqrtl.c40
-rw-r--r--sysdeps/alpha/soft-fp/ots_add.c8
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtqux.c6
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtqx.c6
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvttx.c10
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtxq.c7
-rw-r--r--sysdeps/alpha/soft-fp/ots_cvtxt.c10
-rw-r--r--sysdeps/alpha/soft-fp/ots_nintxq.c12
-rw-r--r--sysdeps/alpha/soft-fp/ots_sub.c8
-rw-r--r--sysdeps/alpha/strncmp.S33
-rw-r--r--sysdeps/arm/Dist2
-rw-r--r--sysdeps/arm/Implies3
-rw-r--r--sysdeps/arm/__longjmp.S33
-rw-r--r--sysdeps/arm/atomicity.h87
-rw-r--r--sysdeps/arm/bits/endian.h12
-rw-r--r--sysdeps/arm/bits/huge_val.h56
-rw-r--r--sysdeps/arm/bits/link.h4
-rw-r--r--sysdeps/arm/bits/setjmp.h36
-rw-r--r--sysdeps/arm/bits/string.h31
-rw-r--r--sysdeps/arm/bsd-_setjmp.S30
-rw-r--r--sysdeps/arm/bsd-setjmp.S29
-rw-r--r--sysdeps/arm/dl-machine.h636
-rw-r--r--sysdeps/arm/elf/start.S102
-rw-r--r--sysdeps/arm/fpu/__longjmp.S36
-rw-r--r--sysdeps/arm/fpu/bits/fenv.h58
-rw-r--r--sysdeps/arm/fpu/bits/mathdef.h44
-rw-r--r--sysdeps/arm/fpu/bits/setjmp.h36
-rw-r--r--sysdeps/arm/fpu/fclrexcpt.c50
-rw-r--r--sysdeps/arm/fpu/fedisblxcpt.c40
-rw-r--r--sysdeps/arm/fpu/feenablxcpt.c40
-rw-r--r--sysdeps/arm/fpu/fegetenv.c40
-rw-r--r--sysdeps/arm/fpu/fegetexcept.c32
-rw-r--r--sysdeps/arm/fpu/fegetround.c26
-rw-r--r--sysdeps/arm/fpu/feholdexcpt.c37
-rw-r--r--sysdeps/arm/fpu/fesetenv.c45
-rw-r--r--sysdeps/arm/fpu/fesetround.c27
-rw-r--r--sysdeps/arm/fpu/fpu_control.h102
-rw-r--r--sysdeps/arm/fpu/fraiseexcpt.c44
-rw-r--r--sysdeps/arm/fpu/fsetexcptflg.c49
-rw-r--r--sysdeps/arm/fpu/ftestexcept.c32
-rw-r--r--sysdeps/arm/fpu/setjmp.S35
-rw-r--r--sysdeps/arm/frame.h28
-rw-r--r--sysdeps/arm/gccframe.h22
-rw-r--r--sysdeps/arm/gmp-mparam.h30
-rw-r--r--sysdeps/arm/ieee754.h115
-rw-r--r--sysdeps/arm/init-first.c73
-rw-r--r--sysdeps/arm/libm-test-ulps1079
-rw-r--r--sysdeps/arm/machine-gmon.h67
-rw-r--r--sysdeps/arm/memset.S67
-rw-r--r--sysdeps/arm/memusage.h21
-rw-r--r--sysdeps/arm/setjmp.S31
-rw-r--r--sysdeps/arm/stackinfo.h28
-rw-r--r--sysdeps/arm/strlen.S73
-rw-r--r--sysdeps/arm/sys/ucontext.h95
-rw-r--r--sysdeps/arm/sysdep.h108
-rw-r--r--sysdeps/generic/Dist26
-rw-r--r--sysdeps/generic/Makefile18
-rw-r--r--sysdeps/generic/__longjmp.c36
-rw-r--r--sysdeps/generic/_exit.c36
-rw-r--r--sysdeps/generic/_strerror.c67
-rw-r--r--sysdeps/generic/abort.c140
-rw-r--r--sysdeps/generic/accept.c40
-rw-r--r--sysdeps/generic/access.c41
-rw-r--r--sysdeps/generic/acct.c34
-rw-r--r--sysdeps/generic/add_n.c62
-rw-r--r--sysdeps/generic/addmul_1.c65
-rw-r--r--sysdeps/generic/adjtime.c37
-rw-r--r--sysdeps/generic/aio_cancel.c44
-rw-r--r--sysdeps/generic/aio_fsync.c51
-rw-r--r--sysdeps/generic/aio_misc.c29
-rw-r--r--sysdeps/generic/aio_notify.c24
-rw-r--r--sysdeps/generic/aio_read.c36
-rw-r--r--sysdeps/generic/aio_read64.c2
-rw-r--r--sysdeps/generic/aio_sigqueue.c36
-rw-r--r--sysdeps/generic/aio_suspend.c46
-rw-r--r--sysdeps/generic/aio_write.c36
-rw-r--r--sysdeps/generic/aio_write64.c2
-rw-r--r--sysdeps/generic/alarm.c39
-rw-r--r--sysdeps/generic/allocrtsig.c96
-rw-r--r--sysdeps/generic/alphasort64.c27
-rw-r--r--sysdeps/generic/backtrace.c93
-rw-r--r--sysdeps/generic/backtracesyms.c58
-rw-r--r--sysdeps/generic/backtracesymsfd.c63
-rw-r--r--sysdeps/generic/bb_init_func.c54
-rw-r--r--sysdeps/generic/bcopy.c29
-rw-r--r--sysdeps/generic/bind.c36
-rw-r--r--sysdeps/generic/bits/atomic.h43
-rw-r--r--sysdeps/generic/bits/byteswap.h84
-rw-r--r--sysdeps/generic/bits/confname.h601
-rw-r--r--sysdeps/generic/bits/dirent.h37
-rw-r--r--sysdeps/generic/bits/dlfcn.h65
-rw-r--r--sysdeps/generic/bits/elfclass.h14
-rw-r--r--sysdeps/generic/bits/endian.h13
-rw-r--r--sysdeps/generic/bits/environments.h78
-rw-r--r--sysdeps/generic/bits/errno.h35
-rw-r--r--sysdeps/generic/bits/fcntl.h95
-rw-r--r--sysdeps/generic/bits/fenv.h56
-rw-r--r--sysdeps/generic/bits/fenvinline.h8
-rw-r--r--sysdeps/generic/bits/huge_val.h29
-rw-r--r--sysdeps/generic/bits/huge_valf.h29
-rw-r--r--sysdeps/generic/bits/huge_vall.h29
-rw-r--r--sysdeps/generic/bits/in.h82
-rw-r--r--sysdeps/generic/bits/inf.h33
-rw-r--r--sysdeps/generic/bits/ioctl-types.h114
-rw-r--r--sysdeps/generic/bits/ioctls.h5
-rw-r--r--sysdeps/generic/bits/ipc.h47
-rw-r--r--sysdeps/generic/bits/ipctypes.h37
-rw-r--r--sysdeps/generic/bits/libc-lock.h138
-rw-r--r--sysdeps/generic/bits/libc-tsd.h69
-rw-r--r--sysdeps/generic/bits/link.h4
-rw-r--r--sysdeps/generic/bits/local_lim.h3
-rw-r--r--sysdeps/generic/bits/mathdef.h43
-rw-r--r--sysdeps/generic/bits/mathinline.h12
-rw-r--r--sysdeps/generic/bits/mman.h91
-rw-r--r--sysdeps/generic/bits/mqueue.h31
-rw-r--r--sysdeps/generic/bits/msq.h45
-rw-r--r--sysdeps/generic/bits/nan.h5
-rw-r--r--sysdeps/generic/bits/netdb.h33
-rw-r--r--sysdeps/generic/bits/poll.h43
-rw-r--r--sysdeps/generic/bits/posix_opt.h2
-rw-r--r--sysdeps/generic/bits/pthreadtypes.h1
-rw-r--r--sysdeps/generic/bits/resource.h182
-rw-r--r--sysdeps/generic/bits/sched.h71
-rw-r--r--sysdeps/generic/bits/select.h35
-rw-r--r--sysdeps/generic/bits/sem.h62
-rw-r--r--sysdeps/generic/bits/setjmp.h7
-rw-r--r--sysdeps/generic/bits/shm.h58
-rw-r--r--sysdeps/generic/bits/sigaction.h78
-rw-r--r--sysdeps/generic/bits/sigcontext.h33
-rw-r--r--sysdeps/generic/bits/siginfo.h211
-rw-r--r--sysdeps/generic/bits/signum.h64
-rw-r--r--sysdeps/generic/bits/sigset.h83
-rw-r--r--sysdeps/generic/bits/sigstack.h55
-rw-r--r--sysdeps/generic/bits/sigthread.h35
-rw-r--r--sysdeps/generic/bits/sockaddr.h40
-rw-r--r--sysdeps/generic/bits/socket.h251
-rw-r--r--sysdeps/generic/bits/stat.h99
-rw-r--r--sysdeps/generic/bits/statfs.h70
-rw-r--r--sysdeps/generic/bits/statvfs.h84
-rw-r--r--sysdeps/generic/bits/stdio-lock.h58
-rw-r--r--sysdeps/generic/bits/string.h12
-rw-r--r--sysdeps/generic/bits/stropts.h231
-rw-r--r--sysdeps/generic/bits/sys_errlist.h24
-rw-r--r--sysdeps/generic/bits/termios.h256
-rw-r--r--sysdeps/generic/bits/time.h75
-rw-r--r--sysdeps/generic/bits/types.h199
-rw-r--r--sysdeps/generic/bits/typesizes.h66
-rw-r--r--sysdeps/generic/bits/uio.h32
-rw-r--r--sysdeps/generic/bits/ustat.h31
-rw-r--r--sysdeps/generic/bits/utmp.h50
-rw-r--r--sysdeps/generic/bits/utsname.h25
-rw-r--r--sysdeps/generic/bits/waitflags.h27
-rw-r--r--sysdeps/generic/bits/waitstatus.h106
-rw-r--r--sysdeps/generic/bits/wchar.h26
-rw-r--r--sysdeps/generic/bits/wordsize.h1
-rw-r--r--sysdeps/generic/bits/xtitypes.h34
-rw-r--r--sysdeps/generic/brdinit.c32
-rw-r--r--sysdeps/generic/brk.c37
-rw-r--r--sysdeps/generic/bsd-_setjmp.c35
-rw-r--r--sysdeps/generic/bsd-setjmp.c34
-rw-r--r--sysdeps/generic/bzero.c83
-rw-r--r--sysdeps/generic/cabsf.c29
-rw-r--r--sysdeps/generic/cargf.c29
-rw-r--r--sysdeps/generic/chdir.c40
-rw-r--r--sysdeps/generic/check_fds.c90
-rw-r--r--sysdeps/generic/check_pf.c50
-rw-r--r--sysdeps/generic/chflags.c43
-rw-r--r--sysdeps/generic/chmod.c42
-rw-r--r--sysdeps/generic/chown.c45
-rw-r--r--sysdeps/generic/chroot.c34
-rw-r--r--sysdeps/generic/cimagf.c28
-rw-r--r--sysdeps/generic/clock.c32
-rw-r--r--sysdeps/generic/clock_getcpuclockid.c39
-rw-r--r--sysdeps/generic/clock_getres.c30
-rw-r--r--sysdeps/generic/clock_gettime.c30
-rw-r--r--sysdeps/generic/clock_nanosleep.c39
-rw-r--r--sysdeps/generic/clock_settime.c30
-rw-r--r--sysdeps/generic/close.c40
-rw-r--r--sysdeps/generic/closedir.c35
-rw-r--r--sysdeps/generic/cmp.c56
-rwxr-xr-xsysdeps/generic/configure108
-rw-r--r--sysdeps/generic/configure.in6
-rw-r--r--sysdeps/generic/conjf.c28
-rw-r--r--sysdeps/generic/connect.c38
-rw-r--r--sysdeps/generic/console.c42
-rw-r--r--sysdeps/generic/crealf.c28
-rw-r--r--sysdeps/generic/creat.c36
-rw-r--r--sysdeps/generic/creat64.c31
-rw-r--r--sysdeps/generic/ctermid.c36
-rw-r--r--sysdeps/generic/cuserid.c35
-rw-r--r--sysdeps/generic/dbl2mpn.c32
-rw-r--r--sysdeps/generic/det_endian.c35
-rw-r--r--sysdeps/generic/dirfd.c33
-rw-r--r--sysdeps/generic/div.c86
-rw-r--r--sysdeps/generic/divmod_1.c208
-rw-r--r--sysdeps/generic/divrem.c245
-rw-r--r--sysdeps/generic/dl-brk.c5
-rw-r--r--sysdeps/generic/dl-cache.c311
-rw-r--r--sysdeps/generic/dl-cache.h8
-rw-r--r--sysdeps/generic/dl-environ.c86
-rw-r--r--sysdeps/generic/dl-execstack.c32
-rw-r--r--sysdeps/generic/dl-fptr.c323
-rw-r--r--sysdeps/generic/dl-fptr.h2
-rw-r--r--sysdeps/generic/dl-hash.h5
-rw-r--r--sysdeps/generic/dl-lookupcfg.h25
-rw-r--r--sysdeps/generic/dl-machine.h9
-rw-r--r--sysdeps/generic/dl-origin.c51
-rw-r--r--sysdeps/generic/dl-osinfo.h13
-rw-r--r--sysdeps/generic/dl-sbrk.c5
-rw-r--r--sysdeps/generic/dl-symaddr.c33
-rw-r--r--sysdeps/generic/dl-sysdep.c519
-rw-r--r--sysdeps/generic/dl-sysdep.h8
-rw-r--r--sysdeps/generic/dl-tls.c713
-rw-r--r--sysdeps/generic/dup.c34
-rw-r--r--sysdeps/generic/dup2.c48
-rw-r--r--sysdeps/generic/dwarf2.h32
-rw-r--r--sysdeps/generic/e_acoshl.c14
-rw-r--r--sysdeps/generic/e_acosl.c14
-rw-r--r--sysdeps/generic/e_asinl.c14
-rw-r--r--sysdeps/generic/e_atan2l.c14
-rw-r--r--sysdeps/generic/e_atanhl.c14
-rw-r--r--sysdeps/generic/e_coshl.c14
-rw-r--r--sysdeps/generic/e_exp10.c30
-rw-r--r--sysdeps/generic/e_exp10f.c30
-rw-r--r--sysdeps/generic/e_exp10l.c30
-rw-r--r--sysdeps/generic/e_exp2l.c14
-rw-r--r--sysdeps/generic/e_expl.c14
-rw-r--r--sysdeps/generic/e_fmodl.c14
-rw-r--r--sysdeps/generic/e_gammal_r.c15
-rw-r--r--sysdeps/generic/e_hypotl.c14
-rw-r--r--sysdeps/generic/e_j0l.c25
-rw-r--r--sysdeps/generic/e_j1l.c25
-rw-r--r--sysdeps/generic/e_jnl.c25
-rw-r--r--sysdeps/generic/e_lgammal_r.c17
-rw-r--r--sysdeps/generic/e_log10l.c14
-rw-r--r--sysdeps/generic/e_log2l.c14
-rw-r--r--sysdeps/generic/e_logl.c14
-rw-r--r--sysdeps/generic/e_powl.c14
-rw-r--r--sysdeps/generic/e_rem_pio2l.c15
-rw-r--r--sysdeps/generic/e_scalb.c71
-rw-r--r--sysdeps/generic/e_scalbf.c68
-rw-r--r--sysdeps/generic/e_scalbl.c75
-rw-r--r--sysdeps/generic/e_sinhl.c14
-rw-r--r--sysdeps/generic/e_sqrtl.c14
-rw-r--r--sysdeps/generic/elf/backtracesymsfd.c3
-rw-r--r--sysdeps/generic/enbl-secure.c37
-rw-r--r--sysdeps/generic/endutxent.c27
-rw-r--r--sysdeps/generic/environ.c12
-rw-r--r--sysdeps/generic/errlist.c41
-rw-r--r--sysdeps/generic/errno-loc.c37
-rw-r--r--sysdeps/generic/errno.c53
-rw-r--r--sysdeps/generic/euidaccess.c40
-rw-r--r--sysdeps/generic/exc2signal.c71
-rw-r--r--sysdeps/generic/execve.c44
-rw-r--r--sysdeps/generic/fattach.c33
-rw-r--r--sysdeps/generic/fchdir.c33
-rw-r--r--sysdeps/generic/fchflags.c43
-rw-r--r--sysdeps/generic/fchmod.c42
-rw-r--r--sysdeps/generic/fchown.c43
-rw-r--r--sysdeps/generic/fclrexcpt.c37
-rw-r--r--sysdeps/generic/fcntl.c41
-rw-r--r--sysdeps/generic/fdatasync.c28
-rw-r--r--sysdeps/generic/fdetach.c32
-rw-r--r--sysdeps/generic/fedisblxcpt.c30
-rw-r--r--sysdeps/generic/feenablxcpt.c30
-rw-r--r--sysdeps/generic/fegetenv.c38
-rw-r--r--sysdeps/generic/fegetexcept.c30
-rw-r--r--sysdeps/generic/fegetround.c29
-rw-r--r--sysdeps/generic/feholdexcpt.c29
-rw-r--r--sysdeps/generic/fesetenv.c38
-rw-r--r--sysdeps/generic/fesetround.c29
-rw-r--r--sysdeps/generic/feupdateenv.c37
-rw-r--r--sysdeps/generic/fexecve.c43
-rw-r--r--sysdeps/generic/ffs.c55
-rw-r--r--sysdeps/generic/ffsll.c42
-rw-r--r--sysdeps/generic/fgetexcptflg.c37
-rw-r--r--sysdeps/generic/fgetxattr.c31
-rw-r--r--sysdeps/generic/flistxattr.c30
-rw-r--r--sysdeps/generic/flock.c36
-rw-r--r--sysdeps/generic/flockfile.c30
-rw-r--r--sysdeps/generic/fork.c36
-rw-r--r--sysdeps/generic/fpathconf.c62
-rw-r--r--sysdeps/generic/fpu_control.c25
-rw-r--r--sysdeps/generic/fraiseexcpt.c38
-rw-r--r--sysdeps/generic/fremovexattr.c30
-rw-r--r--sysdeps/generic/fsetexcptflg.c37
-rw-r--r--sysdeps/generic/fsetxattr.c31
-rw-r--r--sysdeps/generic/fstatfs.c34
-rw-r--r--sysdeps/generic/fstatfs64.c32
-rw-r--r--sysdeps/generic/fstatvfs.c33
-rw-r--r--sysdeps/generic/fstatvfs64.c32
-rw-r--r--sysdeps/generic/fsync.c33
-rw-r--r--sysdeps/generic/ftestexcept.c29
-rw-r--r--sysdeps/generic/ftime.c43
-rw-r--r--sysdeps/generic/ftruncate.c36
-rw-r--r--sysdeps/generic/ftruncate64.c36
-rw-r--r--sysdeps/generic/ftrylockfile.c31
-rw-r--r--sysdeps/generic/funlockfile.c30
-rw-r--r--sysdeps/generic/futimes.c34
-rw-r--r--sysdeps/generic/fxstat.c50
-rw-r--r--sysdeps/generic/fxstat64.c49
-rw-r--r--sysdeps/generic/gai_sigqueue.c36
-rw-r--r--sysdeps/generic/gai_strerror.c29
-rw-r--r--sysdeps/generic/get_clockfreq.c28
-rw-r--r--sysdeps/generic/getaddrinfo.c41
-rw-r--r--sysdeps/generic/getclktck.c30
-rw-r--r--sysdeps/generic/getcontext.c32
-rw-r--r--sysdeps/generic/getcwd.c40
-rw-r--r--sysdeps/generic/getdents.c37
-rw-r--r--sysdeps/generic/getdents64.c36
-rw-r--r--sysdeps/generic/getdomain.c64
-rw-r--r--sysdeps/generic/getdtsz.c33
-rw-r--r--sysdeps/generic/getegid.c32
-rw-r--r--sysdeps/generic/getenv.c101
-rw-r--r--sysdeps/generic/geteuid.c33
-rw-r--r--sysdeps/generic/getgid.c33
-rw-r--r--sysdeps/generic/getgroups.c48
-rw-r--r--sysdeps/generic/gethostid.c32
-rw-r--r--sysdeps/generic/gethostname.c36
-rw-r--r--sysdeps/generic/getipv4sourcefilter.c32
-rw-r--r--sysdeps/generic/getitimer.c42
-rw-r--r--sysdeps/generic/getloadavg.c37
-rw-r--r--sysdeps/generic/getlogin.c33
-rw-r--r--sysdeps/generic/getlogin_r.c37
-rw-r--r--sysdeps/generic/getmsg.c35
-rw-r--r--sysdeps/generic/getpagesize.c33
-rw-r--r--sysdeps/generic/getpeername.c36
-rw-r--r--sysdeps/generic/getpgid.c33
-rw-r--r--sysdeps/generic/getpgrp.c27
-rw-r--r--sysdeps/generic/getpid.c34
-rw-r--r--sysdeps/generic/getpmsg.c36
-rw-r--r--sysdeps/generic/getppid.c33
-rw-r--r--sysdeps/generic/getpriority.c37
-rw-r--r--sysdeps/generic/getpt.c45
-rw-r--r--sysdeps/generic/getresgid.c34
-rw-r--r--sysdeps/generic/getresuid.c34
-rw-r--r--sysdeps/generic/getrlimit.c34
-rw-r--r--sysdeps/generic/getrlimit64.c43
-rw-r--r--sysdeps/generic/getrusage.c35
-rw-r--r--sysdeps/generic/getsid.c32
-rw-r--r--sysdeps/generic/getsockname.c36
-rw-r--r--sysdeps/generic/getsockopt.c38
-rw-r--r--sysdeps/generic/getsourcefilter.c33
-rw-r--r--sysdeps/generic/getsysstats.c69
-rw-r--r--sysdeps/generic/getuid.c33
-rw-r--r--sysdeps/generic/getutmp.c46
-rw-r--r--sysdeps/generic/getutmpx.c48
-rw-r--r--sysdeps/generic/getutxent.c27
-rw-r--r--sysdeps/generic/getutxid.c27
-rw-r--r--sysdeps/generic/getutxline.c27
-rw-r--r--sysdeps/generic/getxattr.c31
-rw-r--r--sysdeps/generic/glob.c1558
-rw-r--r--sysdeps/generic/glob64.c54
-rw-r--r--sysdeps/generic/grantpt.c35
-rw-r--r--sysdeps/generic/group_member.c50
-rw-r--r--sysdeps/generic/gtty.c40
-rw-r--r--sysdeps/generic/herrno-loc.c34
-rw-r--r--sysdeps/generic/htonl.c36
-rw-r--r--sysdeps/generic/htons.c36
-rw-r--r--sysdeps/generic/if_index.c65
-rw-r--r--sysdeps/generic/ifaddrs.c46
-rw-r--r--sysdeps/generic/ifreq.c80
-rw-r--r--sysdeps/generic/init-first.c59
-rw-r--r--sysdeps/generic/init-posix.c27
-rw-r--r--sysdeps/generic/inlines.c3
-rw-r--r--sysdeps/generic/ioctl.c35
-rw-r--r--sysdeps/generic/isastream.c35
-rw-r--r--sysdeps/generic/isatty.c34
-rw-r--r--sysdeps/generic/isfdtype.c31
-rw-r--r--sysdeps/generic/jmp-unwind.c29
-rw-r--r--sysdeps/generic/k_cosl.c15
-rw-r--r--sysdeps/generic/k_rem_pio2l.c16
-rw-r--r--sysdeps/generic/k_sincosl.c1
-rw-r--r--sysdeps/generic/k_sinl.c15
-rw-r--r--sysdeps/generic/k_tanl.c15
-rw-r--r--sysdeps/generic/kill.c37
-rw-r--r--sysdeps/generic/killpg.c36
-rw-r--r--sysdeps/generic/labs.c29
-rw-r--r--sysdeps/generic/lchmod.c33
-rw-r--r--sysdeps/generic/lchown.c43
-rw-r--r--sysdeps/generic/ldbl2mpn.c1
-rw-r--r--sysdeps/generic/ldiv.c54
-rw-r--r--sysdeps/generic/ldsodefs.h295
-rw-r--r--sysdeps/generic/lgetxattr.c31
-rw-r--r--sysdeps/generic/libc-start.c241
-rw-r--r--sysdeps/generic/libc-tls.c273
-rw-r--r--sysdeps/generic/libc_fatal.c31
-rw-r--r--sysdeps/generic/link.c42
-rw-r--r--sysdeps/generic/lio_listio.c42
-rw-r--r--sysdeps/generic/lio_listio64.c2
-rw-r--r--sysdeps/generic/listen.c37
-rw-r--r--sysdeps/generic/listxattr.c30
-rw-r--r--sysdeps/generic/llabs.c31
-rw-r--r--sysdeps/generic/lldiv.c57
-rw-r--r--sysdeps/generic/llistxattr.c30
-rw-r--r--sysdeps/generic/local-setxid.h4
-rw-r--r--sysdeps/generic/lockf.c74
-rw-r--r--sysdeps/generic/lockf64.c79
-rw-r--r--sysdeps/generic/longjmp-ts.c32
-rw-r--r--sysdeps/generic/longjmp.c46
-rw-r--r--sysdeps/generic/lremovexattr.c30
-rw-r--r--sysdeps/generic/lseek.c53
-rw-r--r--sysdeps/generic/lseek64.c49
-rw-r--r--sysdeps/generic/lsetxattr.c31
-rw-r--r--sysdeps/generic/lshift.c87
-rw-r--r--sysdeps/generic/lutimes.c35
-rw-r--r--sysdeps/generic/lxstat.c27
-rw-r--r--sysdeps/generic/lxstat64.c39
-rw-r--r--sysdeps/generic/madvise.c33
-rw-r--r--sysdeps/generic/makecontext.c30
-rw-r--r--sysdeps/generic/math_ldbl_opt.h14
-rw-r--r--sysdeps/generic/memccpy.c46
-rw-r--r--sysdeps/generic/memchr.c215
-rw-r--r--sysdeps/generic/memcmp.c381
-rw-r--r--sysdeps/generic/memcpy.c65
-rw-r--r--sysdeps/generic/memcpy_chk.c66
-rw-r--r--sysdeps/generic/memmem.c58
-rw-r--r--sysdeps/generic/memmove.c112
-rw-r--r--sysdeps/generic/memmove_chk.c98
-rw-r--r--sysdeps/generic/mempcpy.c69
-rw-r--r--sysdeps/generic/mempcpy_chk.c67
-rw-r--r--sysdeps/generic/memrchr.c210
-rw-r--r--sysdeps/generic/memset.c91
-rw-r--r--sysdeps/generic/memset_chk.c92
-rw-r--r--sysdeps/generic/memusage.h18
-rw-r--r--sysdeps/generic/mig-reply.c53
-rw-r--r--sysdeps/generic/mincore.c30
-rw-r--r--sysdeps/generic/mkdir.c43
-rw-r--r--sysdeps/generic/mkfifo.c43
-rw-r--r--sysdeps/generic/mknod.c62
-rw-r--r--sysdeps/generic/mlock.c35
-rw-r--r--sysdeps/generic/mlockall.c36
-rw-r--r--sysdeps/generic/mmap.c41
-rw-r--r--sysdeps/generic/mmap64.c48
-rw-r--r--sysdeps/generic/mod_1.c197
-rw-r--r--sysdeps/generic/morecore.c54
-rw-r--r--sysdeps/generic/mp_clz_tab.c37
-rw-r--r--sysdeps/generic/mpn2dbl.c30
-rw-r--r--sysdeps/generic/mpn2flt.c30
-rw-r--r--sysdeps/generic/mpn2ldbl.c1
-rw-r--r--sysdeps/generic/mprotect.c36
-rw-r--r--sysdeps/generic/mq_close.c31
-rw-r--r--sysdeps/generic/mq_getattr.c30
-rw-r--r--sysdeps/generic/mq_notify.c31
-rw-r--r--sysdeps/generic/mq_open.c36
-rw-r--r--sysdeps/generic/mq_receive.c32
-rw-r--r--sysdeps/generic/mq_send.c31
-rw-r--r--sysdeps/generic/mq_setattr.c33
-rw-r--r--sysdeps/generic/mq_timedreceive.c34
-rw-r--r--sysdeps/generic/mq_timedsend.c33
-rw-r--r--sysdeps/generic/mq_unlink.c30
-rw-r--r--sysdeps/generic/msgctl.c37
-rw-r--r--sysdeps/generic/msgget.c36
-rw-r--r--sysdeps/generic/msgrcv.c42
-rw-r--r--sysdeps/generic/msgsnd.c41
-rw-r--r--sysdeps/generic/msync.c35
-rw-r--r--sysdeps/generic/mul.c152
-rw-r--r--sysdeps/generic/mul_1.c59
-rw-r--r--sysdeps/generic/mul_n.c401
-rw-r--r--sysdeps/generic/munlock.c34
-rw-r--r--sysdeps/generic/munlockall.c34
-rw-r--r--sysdeps/generic/munmap.c35
-rw-r--r--sysdeps/generic/nanosleep.c36
-rw-r--r--sysdeps/generic/nfs/nfs.h (renamed from sysdeps/mach/hurd/nfs/nfs.h)0
-rw-r--r--sysdeps/generic/nice.c33
-rw-r--r--sysdeps/generic/not-cancel.h10
-rw-r--r--sysdeps/generic/nscd_setup_thread.c28
-rw-r--r--sysdeps/generic/open.c54
-rw-r--r--sysdeps/generic/open64.c57
-rw-r--r--sysdeps/generic/opendir.c34
-rw-r--r--sysdeps/generic/opensock.c71
-rw-r--r--sysdeps/generic/pathconf.c41
-rw-r--r--sysdeps/generic/pause.c34
-rw-r--r--sysdeps/generic/pipe.c44
-rw-r--r--sysdeps/generic/poll.c39
-rw-r--r--sysdeps/generic/posix_fadvise.c31
-rw-r--r--sysdeps/generic/posix_fadvise64.c31
-rw-r--r--sysdeps/generic/posix_fallocate.c31
-rw-r--r--sysdeps/generic/posix_fallocate64.c31
-rw-r--r--sysdeps/generic/posix_madvise.c32
-rw-r--r--sysdeps/generic/pread.c46
-rw-r--r--sysdeps/generic/pread64.c46
-rw-r--r--sysdeps/generic/printf_fphex.c490
-rw-r--r--sysdeps/generic/prof-freq.c55
-rw-r--r--sysdeps/generic/profil.c42
-rw-r--r--sysdeps/generic/pselect.c88
-rw-r--r--sysdeps/generic/ptrace.c103
-rw-r--r--sysdeps/generic/ptsname.c47
-rw-r--r--sysdeps/generic/putenv.c72
-rw-r--r--sysdeps/generic/putmsg.c35
-rw-r--r--sysdeps/generic/putpmsg.c36
-rw-r--r--sysdeps/generic/pututxline.c27
-rw-r--r--sysdeps/generic/pwrite.c46
-rw-r--r--sysdeps/generic/pwrite64.c47
-rw-r--r--sysdeps/generic/raise.c34
-rw-r--r--sysdeps/generic/rawmemchr.c189
-rw-r--r--sysdeps/generic/read.c49
-rw-r--r--sysdeps/generic/readdir.c33
-rw-r--r--sysdeps/generic/readdir64.c32
-rw-r--r--sysdeps/generic/readdir64_r.c33
-rw-r--r--sysdeps/generic/readdir_r.c35
-rw-r--r--sysdeps/generic/readelflib.c220
-rw-r--r--sysdeps/generic/readlink.c37
-rw-r--r--sysdeps/generic/readonly-area.c34
-rw-r--r--sysdeps/generic/readv.c41
-rw-r--r--sysdeps/generic/reboot.c34
-rw-r--r--sysdeps/generic/recv.c37
-rw-r--r--sysdeps/generic/recvfrom.c41
-rw-r--r--sysdeps/generic/recvmsg.c37
-rw-r--r--sysdeps/generic/remap_file_pages.c35
-rw-r--r--sysdeps/generic/remove.c33
-rw-r--r--sysdeps/generic/removexattr.c30
-rw-r--r--sysdeps/generic/rename.c41
-rw-r--r--sysdeps/generic/res-state.c45
-rw-r--r--sysdeps/generic/revoke.c31
-rw-r--r--sysdeps/generic/rewinddir.c35
-rw-r--r--sysdeps/generic/rmdir.c41
-rw-r--r--sysdeps/generic/rshift.c88
-rw-r--r--sysdeps/generic/rtld-lowlevel.h1
-rw-r--r--sysdeps/generic/s_asinhl.c15
-rw-r--r--sysdeps/generic/s_atanl.c15
-rw-r--r--sysdeps/generic/s_cacos.c41
-rw-r--r--sysdeps/generic/s_cacosf.c39
-rw-r--r--sysdeps/generic/s_cacosh.c88
-rw-r--r--sysdeps/generic/s_cacoshf.c101
-rw-r--r--sysdeps/generic/s_cacoshl.c84
-rw-r--r--sysdeps/generic/s_cacosl.c37
-rw-r--r--sysdeps/generic/s_casin.c66
-rw-r--r--sysdeps/generic/s_casinf.c64
-rw-r--r--sysdeps/generic/s_casinh.c84
-rw-r--r--sysdeps/generic/s_casinhf.c82
-rw-r--r--sysdeps/generic/s_casinhl.c80
-rw-r--r--sysdeps/generic/s_casinl.c62
-rw-r--r--sysdeps/generic/s_catan.c89
-rw-r--r--sysdeps/generic/s_catanf.c87
-rw-r--r--sysdeps/generic/s_catanh.c84
-rw-r--r--sysdeps/generic/s_catanhf.c82
-rw-r--r--sysdeps/generic/s_catanhl.c80
-rw-r--r--sysdeps/generic/s_catanl.c85
-rw-r--r--sysdeps/generic/s_cbrtl.c15
-rw-r--r--sysdeps/generic/s_ccos.c80
-rw-r--r--sysdeps/generic/s_ccosf.c78
-rw-r--r--sysdeps/generic/s_ccosh.c105
-rw-r--r--sysdeps/generic/s_ccoshf.c103
-rw-r--r--sysdeps/generic/s_ccoshl.c101
-rw-r--r--sysdeps/generic/s_ccosl.c76
-rw-r--r--sysdeps/generic/s_cexp.c127
-rw-r--r--sysdeps/generic/s_cexpf.c125
-rw-r--r--sysdeps/generic/s_cexpl.c123
-rw-r--r--sysdeps/generic/s_clog.c65
-rw-r--r--sysdeps/generic/s_clog10.c65
-rw-r--r--sysdeps/generic/s_clog10f.c63
-rw-r--r--sysdeps/generic/s_clog10l.c61
-rw-r--r--sysdeps/generic/s_clogf.c63
-rw-r--r--sysdeps/generic/s_clogl.c61
-rw-r--r--sysdeps/generic/s_cpow.c34
-rw-r--r--sysdeps/generic/s_cpowf.c32
-rw-r--r--sysdeps/generic/s_cpowl.c30
-rw-r--r--sysdeps/generic/s_cproj.c51
-rw-r--r--sysdeps/generic/s_cprojf.c49
-rw-r--r--sysdeps/generic/s_cprojl.c48
-rw-r--r--sysdeps/generic/s_csin.c131
-rw-r--r--sysdeps/generic/s_csinf.c129
-rw-r--r--sysdeps/generic/s_csinh.c126
-rw-r--r--sysdeps/generic/s_csinhf.c124
-rw-r--r--sysdeps/generic/s_csinhl.c122
-rw-r--r--sysdeps/generic/s_csinl.c127
-rw-r--r--sysdeps/generic/s_csqrt.c114
-rw-r--r--sysdeps/generic/s_csqrtf.c112
-rw-r--r--sysdeps/generic/s_csqrtl.c110
-rw-r--r--sysdeps/generic/s_ctan.c74
-rw-r--r--sysdeps/generic/s_ctanf.c72
-rw-r--r--sysdeps/generic/s_ctanh.c74
-rw-r--r--sysdeps/generic/s_ctanhf.c72
-rw-r--r--sysdeps/generic/s_ctanhl.c70
-rw-r--r--sysdeps/generic/s_ctanl.c70
-rw-r--r--sysdeps/generic/s_erfl.c26
-rw-r--r--sysdeps/generic/s_expm1l.c16
-rw-r--r--sysdeps/generic/s_fdim.c40
-rw-r--r--sysdeps/generic/s_fdimf.c36
-rw-r--r--sysdeps/generic/s_fdiml.c36
-rw-r--r--sysdeps/generic/s_fma.c33
-rw-r--r--sysdeps/generic/s_fmaf.c28
-rw-r--r--sysdeps/generic/s_fmal.c28
-rw-r--r--sysdeps/generic/s_fmax.c33
-rw-r--r--sysdeps/generic/s_fmaxf.c29
-rw-r--r--sysdeps/generic/s_fmaxl.c29
-rw-r--r--sysdeps/generic/s_fmin.c33
-rw-r--r--sysdeps/generic/s_fminf.c29
-rw-r--r--sysdeps/generic/s_fminl.c29
-rw-r--r--sysdeps/generic/s_ldexp.c37
-rw-r--r--sysdeps/generic/s_ldexpf.c37
-rw-r--r--sysdeps/generic/s_ldexpl.c37
-rw-r--r--sysdeps/generic/s_log1pl.c15
-rw-r--r--sysdeps/generic/s_nan.c44
-rw-r--r--sysdeps/generic/s_nanf.c40
-rw-r--r--sysdeps/generic/s_nanl.c40
-rw-r--r--sysdeps/generic/s_nextafter.c100
-rw-r--r--sysdeps/generic/s_nexttowardf.c86
-rw-r--r--sysdeps/generic/s_nexttowardl.c1
-rw-r--r--sysdeps/generic/s_significand.c39
-rw-r--r--sysdeps/generic/s_significandf.c32
-rw-r--r--sysdeps/generic/s_significandl.c39
-rw-r--r--sysdeps/generic/s_tanhl.c15
-rw-r--r--sysdeps/generic/sbrk.c56
-rw-r--r--sysdeps/generic/scandir64.c30
-rw-r--r--sysdeps/generic/sched_getaffinity.c35
-rw-r--r--sysdeps/generic/sched_getp.c34
-rw-r--r--sysdeps/generic/sched_gets.c34
-rw-r--r--sysdeps/generic/sched_primax.c33
-rw-r--r--sysdeps/generic/sched_primin.c33
-rw-r--r--sysdeps/generic/sched_rr_gi.c34
-rw-r--r--sysdeps/generic/sched_setaffinity.c35
-rw-r--r--sysdeps/generic/sched_setp.c34
-rw-r--r--sysdeps/generic/sched_sets.c35
-rw-r--r--sysdeps/generic/sched_yield.c33
-rw-r--r--sysdeps/generic/seekdir.c41
-rw-r--r--sysdeps/generic/segfault.c214
-rw-r--r--sysdeps/generic/select.c43
-rw-r--r--sysdeps/generic/semctl.c34
-rw-r--r--sysdeps/generic/semget.c37
-rw-r--r--sysdeps/generic/semop.c36
-rw-r--r--sysdeps/generic/semtimedop.c37
-rw-r--r--sysdeps/generic/send.c37
-rw-r--r--sysdeps/generic/sendfile.c33
-rw-r--r--sysdeps/generic/sendfile64.c33
-rw-r--r--sysdeps/generic/sendmsg.c37
-rw-r--r--sysdeps/generic/sendto.c40
-rw-r--r--sysdeps/generic/setcontext.c32
-rw-r--r--sysdeps/generic/setdomain.c34
-rw-r--r--sysdeps/generic/setegid.c32
-rw-r--r--sysdeps/generic/setenv.c353
-rw-r--r--sysdeps/generic/seteuid.c32
-rw-r--r--sysdeps/generic/setfpucw.c37
-rw-r--r--sysdeps/generic/setgid.c37
-rw-r--r--sysdeps/generic/setgroups.c35
-rw-r--r--sysdeps/generic/sethostid.c34
-rw-r--r--sysdeps/generic/sethostname.c35
-rw-r--r--sysdeps/generic/setipv4sourcefilter.c33
-rw-r--r--sysdeps/generic/setitimer.c44
-rw-r--r--sysdeps/generic/setjmp.c37
-rw-r--r--sysdeps/generic/setlogin.c32
-rw-r--r--sysdeps/generic/setpgid.c37
-rw-r--r--sysdeps/generic/setpgrp.c25
-rw-r--r--sysdeps/generic/setpriority.c36
-rw-r--r--sysdeps/generic/setregid.c36
-rw-r--r--sysdeps/generic/setresgid.c35
-rw-r--r--sysdeps/generic/setresuid.c35
-rw-r--r--sysdeps/generic/setreuid.c36
-rw-r--r--sysdeps/generic/setrlimit.c37
-rw-r--r--sysdeps/generic/setrlimit64.c43
-rw-r--r--sysdeps/generic/setsid.c35
-rw-r--r--sysdeps/generic/setsockopt.c40
-rw-r--r--sysdeps/generic/setsourcefilter.c33
-rw-r--r--sysdeps/generic/settimeofday.c35
-rw-r--r--sysdeps/generic/setuid.c37
-rw-r--r--sysdeps/generic/setutxent.c27
-rw-r--r--sysdeps/generic/setxattr.c31
-rw-r--r--sysdeps/generic/shm_open.c31
-rw-r--r--sysdeps/generic/shm_unlink.c31
-rw-r--r--sysdeps/generic/shmat.c38
-rw-r--r--sysdeps/generic/shmctl.c36
-rw-r--r--sysdeps/generic/shmdt.c35
-rw-r--r--sysdeps/generic/shmget.c37
-rw-r--r--sysdeps/generic/shutdown.c39
-rw-r--r--sysdeps/generic/sigaction.c44
-rw-r--r--sysdeps/generic/sigaltstack.c34
-rw-r--r--sysdeps/generic/sigblock.c33
-rw-r--r--sysdeps/generic/sigfillset.c47
-rw-r--r--sysdeps/generic/sigignore.c33
-rw-r--r--sysdeps/generic/sigintr.c35
-rw-r--r--sysdeps/generic/sigjmp.c35
-rw-r--r--sysdeps/generic/siglist.c38
-rw-r--r--sysdeps/generic/signal.c38
-rw-r--r--sysdeps/generic/signame.c312
-rw-r--r--sysdeps/generic/signame.h67
-rw-r--r--sysdeps/generic/sigpause.c53
-rw-r--r--sysdeps/generic/sigpending.c40
-rw-r--r--sysdeps/generic/sigprocmask.c51
-rw-r--r--sysdeps/generic/sigqueue.c33
-rw-r--r--sysdeps/generic/sigreturn.c32
-rw-r--r--sysdeps/generic/sigset.c34
-rw-r--r--sysdeps/generic/sigsetmask.c32
-rw-r--r--sysdeps/generic/sigstack.c34
-rw-r--r--sysdeps/generic/sigsuspend.c37
-rw-r--r--sysdeps/generic/sigtimedwait.c34
-rw-r--r--sysdeps/generic/sigvec.c39
-rw-r--r--sysdeps/generic/sigwait.c32
-rw-r--r--sysdeps/generic/sigwaitinfo.c33
-rw-r--r--sysdeps/generic/sleep.c41
-rw-r--r--sysdeps/generic/sockatmark.c33
-rw-r--r--sysdeps/generic/socket.c38
-rw-r--r--sysdeps/generic/socketpair.c39
-rw-r--r--sysdeps/generic/spawni.c46
-rw-r--r--sysdeps/generic/speed.c72
-rw-r--r--sysdeps/generic/sprofil.c36
-rw-r--r--sysdeps/generic/sstk.c35
-rw-r--r--sysdeps/generic/start.c13
-rw-r--r--sysdeps/generic/statfs.c35
-rw-r--r--sysdeps/generic/statfs64.c32
-rw-r--r--sysdeps/generic/statvfs.c34
-rw-r--r--sysdeps/generic/statvfs64.c32
-rw-r--r--sysdeps/generic/stdint.h6
-rw-r--r--sysdeps/generic/stime.c40
-rw-r--r--sysdeps/generic/stpcpy.c55
-rw-r--r--sysdeps/generic/stpcpy_chk.c45
-rw-r--r--sysdeps/generic/stpncpy.c100
-rw-r--r--sysdeps/generic/strcasecmp.c74
-rw-r--r--sysdeps/generic/strcasecmp_l.c23
-rw-r--r--sysdeps/generic/strcasestr.c142
-rw-r--r--sysdeps/generic/strcat.c52
-rw-r--r--sysdeps/generic/strcat_chk.c58
-rw-r--r--sysdeps/generic/strchr.c190
-rw-r--r--sysdeps/generic/strchrnul.c170
-rw-r--r--sysdeps/generic/strcmp.c47
-rw-r--r--sysdeps/generic/strcpy.c50
-rw-r--r--sysdeps/generic/strcpy_chk.c68
-rw-r--r--sysdeps/generic/strcspn.c51
-rw-r--r--sysdeps/generic/string-inlines.c35
-rw-r--r--sysdeps/generic/strlen.c153
-rw-r--r--sysdeps/generic/strncase.c76
-rw-r--r--sysdeps/generic/strncase_l.c25
-rw-r--r--sysdeps/generic/strncat.c85
-rw-r--r--sysdeps/generic/strncat_chk.c100
-rw-r--r--sysdeps/generic/strncmp.c73
-rw-r--r--sysdeps/generic/strncpy.c87
-rw-r--r--sysdeps/generic/strncpy_chk.c89
-rw-r--r--sysdeps/generic/strnlen.c160
-rw-r--r--sysdeps/generic/strpbrk.c46
-rw-r--r--sysdeps/generic/strrchr.c50
-rw-r--r--sysdeps/generic/strsep.c70
-rw-r--r--sysdeps/generic/strspn.c47
-rw-r--r--sysdeps/generic/strstr.c123
-rw-r--r--sysdeps/generic/strtoimax.c1
-rw-r--r--sysdeps/generic/strtok.c66
-rw-r--r--sysdeps/generic/strtok_r.c79
-rw-r--r--sysdeps/generic/strtol.c111
-rw-r--r--sysdeps/generic/strtol_l.c557
-rw-r--r--sysdeps/generic/strtold_l.c58
-rw-r--r--sysdeps/generic/strtoll.c34
-rw-r--r--sysdeps/generic/strtoll_l.c28
-rw-r--r--sysdeps/generic/strtoul.c21
-rw-r--r--sysdeps/generic/strtoul_l.c28
-rw-r--r--sysdeps/generic/strtoull.c34
-rw-r--r--sysdeps/generic/strtoull_l.c29
-rw-r--r--sysdeps/generic/strtoumax.c1
-rw-r--r--sysdeps/generic/strtsupp.c28
-rw-r--r--sysdeps/generic/stty.c40
-rw-r--r--sysdeps/generic/sub_n.c62
-rw-r--r--sysdeps/generic/submul_1.c65
-rw-r--r--sysdeps/generic/swapcontext.c33
-rw-r--r--sysdeps/generic/swapoff.c31
-rw-r--r--sysdeps/generic/swapon.c34
-rw-r--r--sysdeps/generic/symlink.c42
-rw-r--r--sysdeps/generic/sync.c31
-rw-r--r--sysdeps/generic/syscall.c35
-rw-r--r--sysdeps/generic/sysconf.c273
-rw-r--r--sysdeps/generic/sysdep-cancel.h1
-rw-r--r--sysdeps/generic/sysdep.c2
-rw-r--r--sysdeps/generic/sysdep.h2
-rw-r--r--sysdeps/generic/system.c38
-rw-r--r--sysdeps/generic/sysv_signal.c43
-rw-r--r--sysdeps/generic/t_sincosl.c1
-rw-r--r--sysdeps/generic/tcdrain.c39
-rw-r--r--sysdeps/generic/tcflow.c53
-rw-r--r--sysdeps/generic/tcflush.c46
-rw-r--r--sysdeps/generic/tcgetattr.c46
-rw-r--r--sysdeps/generic/tcgetpgrp.c39
-rw-r--r--sysdeps/generic/tcsendbrk.c40
-rw-r--r--sysdeps/generic/tcsetattr.c108
-rw-r--r--sysdeps/generic/tcsetpgrp.c41
-rw-r--r--sysdeps/generic/telldir.c41
-rw-r--r--sysdeps/generic/tempname.c59
-rw-r--r--sysdeps/generic/time.c36
-rw-r--r--sysdeps/generic/timer_create.c30
-rw-r--r--sysdeps/generic/timer_delete.c30
-rw-r--r--sysdeps/generic/timer_getoverr.c30
-rw-r--r--sysdeps/generic/timer_gettime.c30
-rw-r--r--sysdeps/generic/timer_settime.c31
-rw-r--r--sysdeps/generic/times.c43
-rw-r--r--sysdeps/generic/tls-macros.h12
-rw-r--r--sysdeps/generic/tmpfile.c66
-rw-r--r--sysdeps/generic/tmpfile64.c3
-rw-r--r--sysdeps/generic/trampoline.c37
-rw-r--r--sysdeps/generic/truncate.c34
-rw-r--r--sysdeps/generic/truncate64.c35
-rw-r--r--sysdeps/generic/tst-audit.h11
-rw-r--r--sysdeps/generic/tst-timer.c33
-rw-r--r--sysdeps/generic/ttyname.c38
-rw-r--r--sysdeps/generic/ttyname_r.c37
-rw-r--r--sysdeps/generic/ualarm.c37
-rw-r--r--sysdeps/generic/udiv_qrnnd.c10
-rw-r--r--sysdeps/generic/ulimit.c39
-rw-r--r--sysdeps/generic/umask.c34
-rw-r--r--sysdeps/generic/uname.c66
-rw-r--r--sysdeps/generic/unlink.c41
-rw-r--r--sysdeps/generic/unlockpt.c35
-rw-r--r--sysdeps/generic/unsecvars.h18
-rw-r--r--sysdeps/generic/unwind-dw2-fde.c4
-rw-r--r--sysdeps/generic/unwind-dw2.c26
-rw-r--r--sysdeps/generic/updwtmp.c35
-rw-r--r--sysdeps/generic/updwtmpx.c27
-rw-r--r--sysdeps/generic/usleep.c32
-rw-r--r--sysdeps/generic/ustat.c33
-rw-r--r--sysdeps/generic/utime.c43
-rw-r--r--sysdeps/generic/utimes.c43
-rw-r--r--sysdeps/generic/utmp_file.c499
-rw-r--r--sysdeps/generic/utmpxname.c27
-rw-r--r--sysdeps/generic/versionsort64.c27
-rw-r--r--sysdeps/generic/vfork.c31
-rw-r--r--sysdeps/generic/vhangup.c33
-rw-r--r--sysdeps/generic/vlimit.c51
-rw-r--r--sysdeps/generic/vtimes.c65
-rw-r--r--sysdeps/generic/w_acos.c48
-rw-r--r--sysdeps/generic/w_acosf.c48
-rw-r--r--sysdeps/generic/w_acosh.c47
-rw-r--r--sysdeps/generic/w_acoshf.c48
-rw-r--r--sysdeps/generic/w_acoshl.c47
-rw-r--r--sysdeps/generic/w_acosl.c48
-rw-r--r--sysdeps/generic/w_asin.c49
-rw-r--r--sysdeps/generic/w_asinf.c49
-rw-r--r--sysdeps/generic/w_asinl.c49
-rw-r--r--sysdeps/generic/w_atan2.c47
-rw-r--r--sysdeps/generic/w_atan2f.c46
-rw-r--r--sysdeps/generic/w_atan2l.c47
-rw-r--r--sysdeps/generic/w_atanh.c52
-rw-r--r--sysdeps/generic/w_atanhf.c53
-rw-r--r--sysdeps/generic/w_atanhl.c52
-rw-r--r--sysdeps/generic/w_cosh.c47
-rw-r--r--sysdeps/generic/w_coshf.c47
-rw-r--r--sysdeps/generic/w_coshl.c47
-rw-r--r--sysdeps/generic/w_drem.c20
-rw-r--r--sysdeps/generic/w_dremf.c17
-rw-r--r--sysdeps/generic/w_dreml.c18
-rw-r--r--sysdeps/generic/w_exp10.c51
-rw-r--r--sysdeps/generic/w_exp10f.c46
-rw-r--r--sysdeps/generic/w_exp10l.c46
-rw-r--r--sysdeps/generic/w_exp2.c36
-rw-r--r--sysdeps/generic/w_exp2f.c32
-rw-r--r--sysdeps/generic/w_exp2l.c31
-rw-r--r--sysdeps/generic/w_expl.c13
-rw-r--r--sysdeps/generic/w_fmod.c48
-rw-r--r--sysdeps/generic/w_fmodf.c48
-rw-r--r--sysdeps/generic/w_fmodl.c48
-rw-r--r--sysdeps/generic/w_hypot.c48
-rw-r--r--sysdeps/generic/w_hypotf.c48
-rw-r--r--sysdeps/generic/w_hypotl.c48
-rw-r--r--sysdeps/generic/w_j0.c76
-rw-r--r--sysdeps/generic/w_j0f.c74
-rw-r--r--sysdeps/generic/w_j0l.c73
-rw-r--r--sysdeps/generic/w_j1.c77
-rw-r--r--sysdeps/generic/w_j1f.c75
-rw-r--r--sysdeps/generic/w_j1l.c74
-rw-r--r--sysdeps/generic/w_jn.c99
-rw-r--r--sysdeps/generic/w_jnf.c71
-rw-r--r--sysdeps/generic/w_jnl.c96
-rw-r--r--sysdeps/generic/w_lgamma.c60
-rw-r--r--sysdeps/generic/w_lgamma_r.c51
-rw-r--r--sysdeps/generic/w_lgammaf.c53
-rw-r--r--sysdeps/generic/w_lgammaf_r.c52
-rw-r--r--sysdeps/generic/w_lgammal.c58
-rw-r--r--sysdeps/generic/w_lgammal_r.c52
-rw-r--r--sysdeps/generic/w_log.c48
-rw-r--r--sysdeps/generic/w_log10.c51
-rw-r--r--sysdeps/generic/w_log10f.c52
-rw-r--r--sysdeps/generic/w_log10l.c51
-rw-r--r--sysdeps/generic/w_log2.c32
-rw-r--r--sysdeps/generic/w_log2f.c30
-rw-r--r--sysdeps/generic/w_log2l.c28
-rw-r--r--sysdeps/generic/w_logf.c49
-rw-r--r--sysdeps/generic/w_logl.c48
-rw-r--r--sysdeps/generic/w_pow.c70
-rw-r--r--sysdeps/generic/w_powf.c77
-rw-r--r--sysdeps/generic/w_powl.c68
-rw-r--r--sysdeps/generic/w_remainder.c47
-rw-r--r--sysdeps/generic/w_remainderf.c47
-rw-r--r--sysdeps/generic/w_remainderl.c48
-rw-r--r--sysdeps/generic/w_scalb.c65
-rw-r--r--sysdeps/generic/w_scalbf.c66
-rw-r--r--sysdeps/generic/w_scalbl.c65
-rw-r--r--sysdeps/generic/w_sinh.c47
-rw-r--r--sysdeps/generic/w_sinhf.c47
-rw-r--r--sysdeps/generic/w_sinhl.c47
-rw-r--r--sysdeps/generic/w_sqrt.c47
-rw-r--r--sysdeps/generic/w_sqrtf.c47
-rw-r--r--sysdeps/generic/w_sqrtl.c47
-rw-r--r--sysdeps/generic/w_tgamma.c56
-rw-r--r--sysdeps/generic/w_tgammaf.c53
-rw-r--r--sysdeps/generic/w_tgammal.c55
-rw-r--r--sysdeps/generic/wait.c33
-rw-r--r--sysdeps/generic/wait3.c43
-rw-r--r--sysdeps/generic/wait4.c33
-rw-r--r--sysdeps/generic/waitid.c35
-rw-r--r--sysdeps/generic/waitpid.c53
-rw-r--r--sysdeps/generic/wcstoimax.c1
-rw-r--r--sysdeps/generic/wcstol.c23
-rw-r--r--sysdeps/generic/wcstol_l.c30
-rw-r--r--sysdeps/generic/wcstoll.c25
-rw-r--r--sysdeps/generic/wcstoll_l.c30
-rw-r--r--sysdeps/generic/wcstoul.c23
-rw-r--r--sysdeps/generic/wcstoul_l.c30
-rw-r--r--sysdeps/generic/wcstoull.c25
-rw-r--r--sysdeps/generic/wcstoull_l.c31
-rw-r--r--sysdeps/generic/wcstoumax.c1
-rw-r--r--sysdeps/generic/wordcopy.c413
-rw-r--r--sysdeps/generic/wordexp.c2460
-rw-r--r--sysdeps/generic/write.c50
-rw-r--r--sysdeps/generic/writev.c41
-rw-r--r--sysdeps/generic/xmknod.c42
-rw-r--r--sysdeps/generic/xpg-strerror.c57
-rw-r--r--sysdeps/generic/xstat.c39
-rw-r--r--sysdeps/generic/xstat64.c38
-rw-r--r--sysdeps/gnu/Dist8
-rw-r--r--sysdeps/gnu/Makefile15
-rw-r--r--sysdeps/gnu/errlist-compat.awk9
-rw-r--r--sysdeps/gnu/errlist.awk7
-rw-r--r--sysdeps/gnu/errlist.c53
-rw-r--r--sysdeps/gnu/glob64.c2
-rw-r--r--sysdeps/gnu/net/if.h4
-rw-r--r--sysdeps/gnu/updwtmp.c4
-rw-r--r--sysdeps/gnu/utmp_file.c4
-rw-r--r--sysdeps/hppa/Dist5
-rw-r--r--sysdeps/hppa/Makefile41
-rw-r--r--sysdeps/hppa/Versions12
-rw-r--r--sysdeps/hppa/__longjmp.S72
-rw-r--r--sysdeps/hppa/abort-instr.h6
-rw-r--r--sysdeps/hppa/add_n.s58
-rw-r--r--sysdeps/hppa/bits/endian.h7
-rw-r--r--sysdeps/hppa/bits/link.h6
-rw-r--r--sysdeps/hppa/bits/setjmp.h41
-rw-r--r--sysdeps/hppa/bsd-_setjmp.S39
-rw-r--r--sysdeps/hppa/bsd-setjmp.S36
-rwxr-xr-xsysdeps/hppa/configure34
-rw-r--r--sysdeps/hppa/configure.in22
-rw-r--r--sysdeps/hppa/dl-fptr.h35
-rw-r--r--sysdeps/hppa/dl-lookupcfg.h69
-rw-r--r--sysdeps/hppa/dl-machine.h762
-rw-r--r--sysdeps/hppa/dl-symaddr.c36
-rw-r--r--sysdeps/hppa/elf/entry.h10
-rw-r--r--sysdeps/hppa/elf/initfini.c139
-rw-r--r--sysdeps/hppa/elf/start.S97
-rw-r--r--sysdeps/hppa/fpu/bits/fenv.h78
-rw-r--r--sysdeps/hppa/fpu/fclrexcpt.c37
-rw-r--r--sysdeps/hppa/fpu/fedisblxcpt.c37
-rw-r--r--sysdeps/hppa/fpu/feenablxcpt.c37
-rw-r--r--sysdeps/hppa/fpu/fegetenv.c33
-rw-r--r--sysdeps/hppa/fpu/fegetexcept.c32
-rw-r--r--sysdeps/hppa/fpu/fegetround.c32
-rw-r--r--sysdeps/hppa/fpu/feholdexcpt.c56
-rw-r--r--sysdeps/hppa/fpu/fesetenv.c66
-rw-r--r--sysdeps/hppa/fpu/fesetround.c39
-rw-r--r--sysdeps/hppa/fpu/feupdateenv.c37
-rw-r--r--sysdeps/hppa/fpu/fgetexcptflg.c36
-rw-r--r--sysdeps/hppa/fpu/fraiseexcpt.c102
-rw-r--r--sysdeps/hppa/fpu/fsetexcptflg.c40
-rw-r--r--sysdeps/hppa/fpu/ftestexcept.c32
-rw-r--r--sysdeps/hppa/fpu/libm-test-ulps890
-rw-r--r--sysdeps/hppa/frame.h28
-rw-r--r--sysdeps/hppa/gccframe.h23
-rw-r--r--sysdeps/hppa/hppa1.1/Implies4
-rw-r--r--sysdeps/hppa/hppa1.1/addmul_1.s104
-rw-r--r--sysdeps/hppa/hppa1.1/mul_1.s100
-rw-r--r--sysdeps/hppa/hppa1.1/submul_1.s113
-rw-r--r--sysdeps/hppa/hppa1.1/udiv_qrnnd.s78
-rw-r--r--sysdeps/hppa/libgcc-compat.c43
-rw-r--r--sysdeps/hppa/lshift.s66
-rw-r--r--sysdeps/hppa/machine-gmon.h25
-rw-r--r--sysdeps/hppa/memusage.h22
-rw-r--r--sysdeps/hppa/mp_clz_tab.c1
-rw-r--r--sysdeps/hppa/rshift.s63
-rw-r--r--sysdeps/hppa/setjmp.S69
-rw-r--r--sysdeps/hppa/stackinfo.h28
-rw-r--r--sysdeps/hppa/sub_n.s59
-rw-r--r--sysdeps/hppa/sysdep.h82
-rw-r--r--sysdeps/hppa/udiv_qrnnd.s286
-rw-r--r--sysdeps/i386/Dist4
-rw-r--r--sysdeps/i386/Makefile14
-rw-r--r--sysdeps/i386/Versions7
-rw-r--r--sysdeps/i386/__longjmp.S37
-rw-r--r--sysdeps/i386/add_n.S12
-rw-r--r--sysdeps/i386/addmul_1.S30
-rw-r--r--sysdeps/i386/backtrace.c3
-rw-r--r--sysdeps/i386/bits/byteswap.h7
-rw-r--r--sysdeps/i386/bits/link.h65
-rw-r--r--sysdeps/i386/bits/linkmap.h5
-rw-r--r--sysdeps/i386/bits/mathdef.h (renamed from sysdeps/i386/fpu/bits/mathdef.h)0
-rw-r--r--sysdeps/i386/bits/setjmp.h18
-rw-r--r--sysdeps/i386/bits/string.h922
-rw-r--r--sysdeps/i386/bsd-_setjmp.S12
-rw-r--r--sysdeps/i386/bsd-setjmp.S20
-rw-r--r--sysdeps/i386/bzero.c4
-rwxr-xr-xsysdeps/i386/configure54
-rw-r--r--sysdeps/i386/configure.in35
-rw-r--r--sysdeps/i386/dl-machine.h155
-rw-r--r--sysdeps/i386/dl-trampoline.S184
-rw-r--r--sysdeps/i386/elf/bsd-setjmp.S78
-rw-r--r--sysdeps/i386/elf/setjmp.S70
-rw-r--r--sysdeps/i386/ffs.c4
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h44
-rw-r--r--sysdeps/i386/fpu/e_acosh.S6
-rw-r--r--sysdeps/i386/fpu/e_acoshf.S6
-rw-r--r--sysdeps/i386/fpu/e_acoshl.S6
-rw-r--r--sysdeps/i386/fpu/e_atanh.S4
-rw-r--r--sysdeps/i386/fpu/e_atanhf.S6
-rw-r--r--sysdeps/i386/fpu/e_atanhl.S4
-rw-r--r--sysdeps/i386/fpu/e_expl.c4
-rw-r--r--sysdeps/i386/fpu/e_log.S15
-rw-r--r--sysdeps/i386/fpu/e_log10.S4
-rw-r--r--sysdeps/i386/fpu/e_log10f.S4
-rw-r--r--sysdeps/i386/fpu/e_log10l.S4
-rw-r--r--sysdeps/i386/fpu/e_log2.S4
-rw-r--r--sysdeps/i386/fpu/e_log2f.S4
-rw-r--r--sysdeps/i386/fpu/e_log2l.S4
-rw-r--r--sysdeps/i386/fpu/e_logf.S15
-rw-r--r--sysdeps/i386/fpu/e_logl.S15
-rw-r--r--sysdeps/i386/fpu/e_pow.S44
-rw-r--r--sysdeps/i386/fpu/e_powf.S41
-rw-r--r--sysdeps/i386/fpu/e_powl.S46
-rw-r--r--sysdeps/i386/fpu/e_scalb.S8
-rw-r--r--sysdeps/i386/fpu/e_scalbf.S8
-rw-r--r--sysdeps/i386/fpu/e_scalbl.S8
-rw-r--r--sysdeps/i386/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/i386/fpu/fesetround.c3
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps192
-rw-r--r--sysdeps/i386/fpu/math_private.h18
-rw-r--r--sysdeps/i386/fpu/s_asinh.S10
-rw-r--r--sysdeps/i386/fpu/s_asinhf.S10
-rw-r--r--sysdeps/i386/fpu/s_asinhl.S10
-rw-r--r--sysdeps/i386/fpu/s_cbrt.S12
-rw-r--r--sysdeps/i386/fpu/s_cbrtf.S12
-rw-r--r--sysdeps/i386/fpu/s_cbrtl.S12
-rw-r--r--sysdeps/i386/fpu/s_cexp.S6
-rw-r--r--sysdeps/i386/fpu/s_cexpf.S14
-rw-r--r--sysdeps/i386/fpu/s_cexpl.S6
-rw-r--r--sysdeps/i386/fpu/s_expm1.S6
-rw-r--r--sysdeps/i386/fpu/s_expm1f.S6
-rw-r--r--sysdeps/i386/fpu/s_expm1l.S6
-rw-r--r--sysdeps/i386/fpu/s_frexp.S6
-rw-r--r--sysdeps/i386/fpu/s_frexpf.S6
-rw-r--r--sysdeps/i386/fpu/s_frexpl.S6
-rw-r--r--sysdeps/i386/fpu/s_ilogb.S2
-rw-r--r--sysdeps/i386/fpu/s_ilogbf.S2
-rw-r--r--sysdeps/i386/fpu/s_ilogbl.S2
-rw-r--r--sysdeps/i386/fpu/s_llrint.S5
-rw-r--r--sysdeps/i386/fpu/s_llrintf.S5
-rw-r--r--sysdeps/i386/fpu/s_llrintl.S5
-rw-r--r--sysdeps/i386/fpu/s_log1p.S4
-rw-r--r--sysdeps/i386/fpu/s_log1pf.S4
-rw-r--r--sysdeps/i386/fpu/s_log1pl.S4
-rw-r--r--sysdeps/i386/fpu/s_lrint.S4
-rw-r--r--sysdeps/i386/fpu/s_lrintf.S4
-rw-r--r--sysdeps/i386/fpu/s_lrintl.S4
-rw-r--r--sysdeps/i386/fpu/s_nearbyint.S4
-rw-r--r--sysdeps/i386/fpu/s_nearbyintf.S4
-rw-r--r--sysdeps/i386/fpu/s_nearbyintl.S4
-rw-r--r--sysdeps/i386/fpu/s_nextafterl.c18
-rw-r--r--sysdeps/i386/fpu/s_nexttoward.c25
-rw-r--r--sysdeps/i386/fpu/s_nexttowardf.c25
-rw-r--r--sysdeps/i386/i386-mcount.S2
-rw-r--r--sysdeps/i386/i486/strcat.S6
-rw-r--r--sysdeps/i386/i586/add_n.S20
-rw-r--r--sysdeps/i386/i586/addmul_1.S30
-rw-r--r--sysdeps/i386/i586/lshift.S37
-rw-r--r--sysdeps/i386/i586/memcpy.S10
-rw-r--r--sysdeps/i386/i586/memset.S6
-rw-r--r--sysdeps/i386/i586/memusage.h1
-rw-r--r--sysdeps/i386/i586/mul_1.S30
-rw-r--r--sysdeps/i386/i586/rshift.S37
-rw-r--r--sysdeps/i386/i586/strchr.S35
-rw-r--r--sysdeps/i386/i586/strcpy.S16
-rw-r--r--sysdeps/i386/i586/sub_n.S20
-rw-r--r--sysdeps/i386/i586/submul_1.S30
-rw-r--r--sysdeps/i386/i686/Dist1
-rw-r--r--sysdeps/i386/i686/add_n.S10
-rw-r--r--sysdeps/i386/i686/dl-hash.h6
-rw-r--r--sysdeps/i386/i686/ffs.c4
-rw-r--r--sysdeps/i386/i686/hp-timing.h24
-rw-r--r--sysdeps/i386/i686/memcmp.S37
-rw-r--r--sysdeps/i386/i686/memcpy_chk.S2
-rw-r--r--sysdeps/i386/i686/memmove.S15
-rw-r--r--sysdeps/i386/i686/mempcpy.S6
-rw-r--r--sysdeps/i386/i686/memset.S24
-rw-r--r--sysdeps/i386/i686/memset_chk.S4
-rw-r--r--sysdeps/i386/i686/memusage.h22
-rw-r--r--sysdeps/i386/i686/strtok.S16
-rw-r--r--sysdeps/i386/jmpbuf-offsets.h26
-rw-r--r--sysdeps/i386/jmpbuf-unwind.h48
-rw-r--r--sysdeps/i386/ldbl2mpn.c13
-rw-r--r--sysdeps/i386/lshift.S22
-rw-r--r--sysdeps/i386/memchr.S15
-rw-r--r--sysdeps/i386/memcmp.S8
-rw-r--r--sysdeps/i386/memset.c4
-rw-r--r--sysdeps/i386/memusage.h1
-rw-r--r--sysdeps/i386/mul_1.S30
-rw-r--r--sysdeps/i386/rawmemchr.S6
-rw-r--r--sysdeps/i386/rshift.S26
-rw-r--r--sysdeps/i386/setjmp.S21
-rw-r--r--sysdeps/i386/soft-fp/Dist1
-rw-r--r--sysdeps/i386/stpncpy.S6
-rw-r--r--sysdeps/i386/strchr.S11
-rw-r--r--sysdeps/i386/strchrnul.S6
-rw-r--r--sysdeps/i386/strcspn.S67
-rw-r--r--sysdeps/i386/strpbrk.S67
-rw-r--r--sysdeps/i386/strrchr.S16
-rw-r--r--sysdeps/i386/strspn.S67
-rw-r--r--sysdeps/i386/strtok.S77
-rw-r--r--sysdeps/i386/sub_n.S13
-rw-r--r--sysdeps/i386/submul_1.S18
-rw-r--r--sysdeps/i386/sysdep.h37
-rw-r--r--sysdeps/ia64/Dist9
-rw-r--r--sysdeps/ia64/Makefile4
-rw-r--r--sysdeps/ia64/Versions7
-rw-r--r--sysdeps/ia64/_mcount.S7
-rw-r--r--sysdeps/ia64/backtrace.c3
-rw-r--r--sysdeps/ia64/bits/atomic.h23
-rw-r--r--sysdeps/ia64/bits/link.h68
-rw-r--r--sysdeps/ia64/bits/linkmap.h5
-rw-r--r--sysdeps/ia64/bits/mathdef.h (renamed from sysdeps/ia64/fpu/bits/mathdef.h)0
-rw-r--r--sysdeps/ia64/dl-lookupcfg.h19
-rw-r--r--sysdeps/ia64/dl-machine.h159
-rw-r--r--sysdeps/ia64/dl-sysdep.h21
-rw-r--r--sysdeps/ia64/dl-trampoline.S539
-rw-r--r--sysdeps/ia64/elf/initfini.c28
-rw-r--r--sysdeps/ia64/fpu/Dist11
-rw-r--r--sysdeps/ia64/fpu/Makefile36
-rw-r--r--sysdeps/ia64/fpu/README50
-rw-r--r--sysdeps/ia64/fpu/e_acos.S1499
-rw-r--r--sysdeps/ia64/fpu/e_acosf.S78
-rw-r--r--sysdeps/ia64/fpu/e_acosh.S1202
-rw-r--r--sysdeps/ia64/fpu/e_acoshf.S1030
-rw-r--r--sysdeps/ia64/fpu/e_acoshl.S1716
-rw-r--r--sysdeps/ia64/fpu/e_acosl.S2917
-rw-r--r--sysdeps/ia64/fpu/e_asin.S1465
-rw-r--r--sysdeps/ia64/fpu/e_asinf.S72
-rw-r--r--sysdeps/ia64/fpu/e_asinl.S2834
-rw-r--r--sysdeps/ia64/fpu/e_atan2.S738
-rw-r--r--sysdeps/ia64/fpu/e_atan2f.S86
-rw-r--r--sysdeps/ia64/fpu/e_atanh.S1071
-rw-r--r--sysdeps/ia64/fpu/e_atanhf.S845
-rw-r--r--sysdeps/ia64/fpu/e_atanhl.S1156
-rw-r--r--sysdeps/ia64/fpu/e_cosh.S1477
-rw-r--r--sysdeps/ia64/fpu/e_coshf.S1447
-rw-r--r--sysdeps/ia64/fpu/e_coshl.S1662
-rw-r--r--sysdeps/ia64/fpu/e_exp.S895
-rw-r--r--sysdeps/ia64/fpu/e_exp10.S605
-rw-r--r--sysdeps/ia64/fpu/e_exp10f.S557
-rw-r--r--sysdeps/ia64/fpu/e_exp10l.S811
-rw-r--r--sysdeps/ia64/fpu/e_exp2.S564
-rw-r--r--sysdeps/ia64/fpu/e_exp2f.S539
-rw-r--r--sysdeps/ia64/fpu/e_exp2l.S807
-rw-r--r--sysdeps/ia64/fpu/e_expf.S957
-rw-r--r--sysdeps/ia64/fpu/e_fmod.S218
-rw-r--r--sysdeps/ia64/fpu/e_fmodf.S225
-rw-r--r--sysdeps/ia64/fpu/e_fmodl.S972
-rw-r--r--sysdeps/ia64/fpu/e_gamma_r.c (renamed from sysdeps/ia64/fpu/e_logl.c)0
-rw-r--r--sysdeps/ia64/fpu/e_gammaf_r.c1
-rw-r--r--sysdeps/ia64/fpu/e_gammal_r.c1
-rw-r--r--sysdeps/ia64/fpu/e_hypot.S75
-rw-r--r--sysdeps/ia64/fpu/e_hypotf.S76
-rw-r--r--sysdeps/ia64/fpu/e_hypotl.S73
-rw-r--r--sysdeps/ia64/fpu/e_lgamma_r.c71
-rw-r--r--sysdeps/ia64/fpu/e_lgammaf_r.c71
-rw-r--r--sysdeps/ia64/fpu/e_lgammal_r.c70
-rw-r--r--sysdeps/ia64/fpu/e_log.S2453
-rw-r--r--sysdeps/ia64/fpu/e_log2.S711
-rw-r--r--sysdeps/ia64/fpu/e_log2f.S551
-rw-r--r--sysdeps/ia64/fpu/e_log2l.S817
-rw-r--r--sysdeps/ia64/fpu/e_logf.S1786
-rw-r--r--sysdeps/ia64/fpu/e_logl.S1200
-rw-r--r--sysdeps/ia64/fpu/e_pow.S1633
-rw-r--r--sysdeps/ia64/fpu/e_powf.S2232
-rw-r--r--sysdeps/ia64/fpu/e_powl.S4080
-rw-r--r--sysdeps/ia64/fpu/e_remainder.S113
-rw-r--r--sysdeps/ia64/fpu/e_remainderf.S113
-rw-r--r--sysdeps/ia64/fpu/e_remainderl.S115
-rw-r--r--sysdeps/ia64/fpu/e_scalb.S669
-rw-r--r--sysdeps/ia64/fpu/e_scalbf.S669
-rw-r--r--sysdeps/ia64/fpu/e_scalbl.S669
-rw-r--r--sysdeps/ia64/fpu/e_sinh.S1652
-rw-r--r--sysdeps/ia64/fpu/e_sinhf.S1614
-rw-r--r--sysdeps/ia64/fpu/e_sinhl.S1779
-rw-r--r--sysdeps/ia64/fpu/e_sqrt.S68
-rw-r--r--sysdeps/ia64/fpu/e_sqrtf.S69
-rw-r--r--sysdeps/ia64/fpu/e_sqrtl.S67
-rw-r--r--sysdeps/ia64/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/ia64/fpu/fesetround.c7
-rw-r--r--sysdeps/ia64/fpu/gen_import_file_list90
-rw-r--r--sysdeps/ia64/fpu/import_check81
-rw-r--r--sysdeps/ia64/fpu/import_diffs7
-rw-r--r--sysdeps/ia64/fpu/import_file.awk151
-rw-r--r--sysdeps/ia64/fpu/import_intel_libm106
-rw-r--r--sysdeps/ia64/fpu/libm-symbols.h64
-rw-r--r--sysdeps/ia64/fpu/libm-test-ulps90
-rw-r--r--sysdeps/ia64/fpu/libm_atan2_reg.S1234
-rw-r--r--sysdeps/ia64/fpu/libm_cpu_defs.h156
-rw-r--r--sysdeps/ia64/fpu/libm_error.c1114
-rw-r--r--sysdeps/ia64/fpu/libm_error_codes.h211
-rw-r--r--sysdeps/ia64/fpu/libm_frexp.S209
-rw-r--r--sysdeps/ia64/fpu/libm_frexpf.S209
-rw-r--r--sysdeps/ia64/fpu/libm_frexpl.S209
-rw-r--r--sysdeps/ia64/fpu/libm_lgamma.S3623
-rw-r--r--sysdeps/ia64/fpu/libm_lgammaf.S2199
-rw-r--r--sysdeps/ia64/fpu/libm_lgammal.S7678
-rw-r--r--sysdeps/ia64/fpu/libm_reduce.S1492
-rw-r--r--sysdeps/ia64/fpu/libm_scalblnf.S450
-rw-r--r--sysdeps/ia64/fpu/libm_sincos.S783
-rw-r--r--sysdeps/ia64/fpu/libm_sincos_large.S2757
-rw-r--r--sysdeps/ia64/fpu/libm_sincosf.S745
-rw-r--r--sysdeps/ia64/fpu/libm_sincosl.S2528
-rw-r--r--sysdeps/ia64/fpu/libm_support.h1180
-rw-r--r--sysdeps/ia64/fpu/printf_fphex.c4
-rw-r--r--sysdeps/ia64/fpu/s_asinh.S1138
-rw-r--r--sysdeps/ia64/fpu/s_asinhf.S937
-rw-r--r--sysdeps/ia64/fpu/s_asinhl.S1347
-rw-r--r--sysdeps/ia64/fpu/s_atan.S1193
-rw-r--r--sysdeps/ia64/fpu/s_atanf.S76
-rw-r--r--sysdeps/ia64/fpu/s_atanl.S2158
-rw-r--r--sysdeps/ia64/fpu/s_cbrt.S1224
-rw-r--r--sysdeps/ia64/fpu/s_cbrtf.S1227
-rw-r--r--sysdeps/ia64/fpu/s_cbrtl.S1720
-rw-r--r--sysdeps/ia64/fpu/s_ceil.S274
-rw-r--r--sysdeps/ia64/fpu/s_ceilf.S274
-rw-r--r--sysdeps/ia64/fpu/s_ceill.S276
-rw-r--r--sysdeps/ia64/fpu/s_copysign.S6
-rw-r--r--sysdeps/ia64/fpu/s_cos.S3497
-rw-r--r--sysdeps/ia64/fpu/s_cosf.S1182
-rw-r--r--sysdeps/ia64/fpu/s_cosl.S2760
-rw-r--r--sysdeps/ia64/fpu/s_erf.S926
-rw-r--r--sysdeps/ia64/fpu/s_erfc.S1199
-rw-r--r--sysdeps/ia64/fpu/s_erfcf.S983
-rw-r--r--sysdeps/ia64/fpu/s_erfcl.S2066
-rw-r--r--sysdeps/ia64/fpu/s_erff.S558
-rw-r--r--sysdeps/ia64/fpu/s_erfl.S1240
-rw-r--r--sysdeps/ia64/fpu/s_expm1.S2150
-rw-r--r--sysdeps/ia64/fpu/s_expm1f.S2062
-rw-r--r--sysdeps/ia64/fpu/s_expm1l.S1947
-rw-r--r--sysdeps/ia64/fpu/s_fabs.S116
-rw-r--r--sysdeps/ia64/fpu/s_fabsf.S83
-rw-r--r--sysdeps/ia64/fpu/s_fabsl.S83
-rw-r--r--sysdeps/ia64/fpu/s_fdim.S228
-rw-r--r--sysdeps/ia64/fpu/s_fdimf.S228
-rw-r--r--sysdeps/ia64/fpu/s_fdiml.S228
-rw-r--r--sysdeps/ia64/fpu/s_floor.S252
-rw-r--r--sysdeps/ia64/fpu/s_floorf.S250
-rw-r--r--sysdeps/ia64/fpu/s_floorl.S250
-rw-r--r--sysdeps/ia64/fpu/s_fma.S71
-rw-r--r--sysdeps/ia64/fpu/s_fmaf.S71
-rw-r--r--sysdeps/ia64/fpu/s_fmal.S71
-rw-r--r--sysdeps/ia64/fpu/s_fmax.S114
-rw-r--r--sysdeps/ia64/fpu/s_fmaxf.S114
-rw-r--r--sysdeps/ia64/fpu/s_fmaxl.S114
-rw-r--r--sysdeps/ia64/fpu/s_frexp.c34
-rw-r--r--sysdeps/ia64/fpu/s_frexpf.c34
-rw-r--r--sysdeps/ia64/fpu/s_frexpl.c34
-rw-r--r--sysdeps/ia64/fpu/s_ilogb.S305
-rw-r--r--sysdeps/ia64/fpu/s_ilogbf.S305
-rw-r--r--sysdeps/ia64/fpu/s_ilogbl.S305
-rw-r--r--sysdeps/ia64/fpu/s_ldexp.S380
-rw-r--r--sysdeps/ia64/fpu/s_ldexp.c61
-rw-r--r--sysdeps/ia64/fpu/s_ldexpf.S379
-rw-r--r--sysdeps/ia64/fpu/s_ldexpf.c61
-rw-r--r--sysdeps/ia64/fpu/s_ldexpl.S379
-rw-r--r--sysdeps/ia64/fpu/s_ldexpl.c61
-rw-r--r--sysdeps/ia64/fpu/s_libm_ldexp.S452
-rw-r--r--sysdeps/ia64/fpu/s_libm_ldexpf.S452
-rw-r--r--sysdeps/ia64/fpu/s_libm_ldexpl.S452
-rw-r--r--sysdeps/ia64/fpu/s_libm_scalbn.S452
-rw-r--r--sysdeps/ia64/fpu/s_libm_scalbnf.S452
-rw-r--r--sysdeps/ia64/fpu/s_libm_scalbnl.S452
-rw-r--r--sysdeps/ia64/fpu/s_log1p.S2314
-rw-r--r--sysdeps/ia64/fpu/s_log1pf.S2030
-rw-r--r--sysdeps/ia64/fpu/s_log1pl.S2068
-rw-r--r--sysdeps/ia64/fpu/s_logb.S314
-rw-r--r--sysdeps/ia64/fpu/s_logbf.S333
-rw-r--r--sysdeps/ia64/fpu/s_logbl.S310
-rw-r--r--sysdeps/ia64/fpu/s_modf.S47
-rw-r--r--sysdeps/ia64/fpu/s_modff.S47
-rw-r--r--sysdeps/ia64/fpu/s_modfl.S49
-rw-r--r--sysdeps/ia64/fpu/s_nearbyint.S263
-rw-r--r--sysdeps/ia64/fpu/s_nearbyintf.S261
-rw-r--r--sysdeps/ia64/fpu/s_nearbyintl.S260
-rw-r--r--sysdeps/ia64/fpu/s_nextafter.S498
-rw-r--r--sysdeps/ia64/fpu/s_nextafterf.S504
-rw-r--r--sysdeps/ia64/fpu/s_nextafterl.S503
-rw-r--r--sysdeps/ia64/fpu/s_nextafterl.c1
-rw-r--r--sysdeps/ia64/fpu/s_nexttoward.S490
-rw-r--r--sysdeps/ia64/fpu/s_nexttoward.c1
-rw-r--r--sysdeps/ia64/fpu/s_nexttowardf.S496
-rw-r--r--sysdeps/ia64/fpu/s_nexttowardf.c1
-rw-r--r--sysdeps/ia64/fpu/s_nexttowardl.S494
-rw-r--r--sysdeps/ia64/fpu/s_rint.S287
-rw-r--r--sysdeps/ia64/fpu/s_rintf.S289
-rw-r--r--sysdeps/ia64/fpu/s_rintl.S289
-rw-r--r--sysdeps/ia64/fpu/s_round.S322
-rw-r--r--sysdeps/ia64/fpu/s_roundf.S322
-rw-r--r--sysdeps/ia64/fpu/s_roundl.S322
-rw-r--r--sysdeps/ia64/fpu/s_scalblnf.c61
-rw-r--r--sysdeps/ia64/fpu/s_scalbn.S379
-rw-r--r--sysdeps/ia64/fpu/s_scalbn.c61
-rw-r--r--sysdeps/ia64/fpu/s_scalbnf.S379
-rw-r--r--sysdeps/ia64/fpu/s_scalbnf.c61
-rw-r--r--sysdeps/ia64/fpu/s_scalbnl.S379
-rw-r--r--sysdeps/ia64/fpu/s_scalbnl.c61
-rw-r--r--sysdeps/ia64/fpu/s_significand.S61
-rw-r--r--sysdeps/ia64/fpu/s_significandf.S61
-rw-r--r--sysdeps/ia64/fpu/s_significandl.S61
-rw-r--r--sysdeps/ia64/fpu/s_sincos.c10
-rw-r--r--sysdeps/ia64/fpu/s_sincosf.c10
-rw-r--r--sysdeps/ia64/fpu/s_sincosl.c10
-rw-r--r--sysdeps/ia64/fpu/s_tan.S554
-rw-r--r--sysdeps/ia64/fpu/s_tanf.S1004
-rw-r--r--sysdeps/ia64/fpu/s_tanh.S986
-rw-r--r--sysdeps/ia64/fpu/s_tanhf.S581
-rw-r--r--sysdeps/ia64/fpu/s_tanhl.S1348
-rw-r--r--sysdeps/ia64/fpu/s_tanl.S3032
-rw-r--r--sysdeps/ia64/fpu/s_trunc.S207
-rw-r--r--sysdeps/ia64/fpu/s_truncf.S207
-rw-r--r--sysdeps/ia64/fpu/s_truncl.S209
-rw-r--r--sysdeps/ia64/fpu/t_exp.c1
-rw-r--r--sysdeps/ia64/fpu/w_acosh.c1
-rw-r--r--sysdeps/ia64/fpu/w_acoshf.c1
-rw-r--r--sysdeps/ia64/fpu/w_acoshl.c1
-rw-r--r--sysdeps/ia64/fpu/w_atanh.c1
-rw-r--r--sysdeps/ia64/fpu/w_atanhf.c1
-rw-r--r--sysdeps/ia64/fpu/w_atanhl.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp10.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp10f.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp10l.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp2.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp2f.c1
-rw-r--r--sysdeps/ia64/fpu/w_exp2l.c1
-rw-r--r--sysdeps/ia64/fpu/w_expl.c1
-rw-r--r--sysdeps/ia64/fpu/w_lgamma.c80
-rw-r--r--sysdeps/ia64/fpu/w_lgamma_r.c1
-rw-r--r--sysdeps/ia64/fpu/w_lgammaf.c80
-rw-r--r--sysdeps/ia64/fpu/w_lgammaf_r.c1
-rw-r--r--sysdeps/ia64/fpu/w_lgammal.c79
-rw-r--r--sysdeps/ia64/fpu/w_lgammal_r.c1
-rw-r--r--sysdeps/ia64/fpu/w_log2.c1
-rw-r--r--sysdeps/ia64/fpu/w_log2f.c1
-rw-r--r--sysdeps/ia64/fpu/w_log2l.c1
-rw-r--r--sysdeps/ia64/fpu/w_sinh.c1
-rw-r--r--sysdeps/ia64/fpu/w_sinhf.c1
-rw-r--r--sysdeps/ia64/fpu/w_sinhl.c1
-rw-r--r--sysdeps/ia64/fpu/w_tgamma.S1836
-rw-r--r--sysdeps/ia64/fpu/w_tgammaf.S1331
-rw-r--r--sysdeps/ia64/fpu/w_tgammal.S4487
-rw-r--r--sysdeps/ia64/ia64libgcc.S350
-rw-r--r--sysdeps/ia64/jmpbuf-unwind.h44
-rw-r--r--sysdeps/ia64/ldbl2mpn.c1
-rw-r--r--sysdeps/ia64/libc-tls.c7
-rw-r--r--sysdeps/ia64/libgcc-compat.c84
-rw-r--r--sysdeps/ia64/memccpy.S55
-rw-r--r--sysdeps/ia64/strchr.S2
-rw-r--r--sysdeps/ia64/strlen.S6
-rw-r--r--sysdeps/ieee754/Dist2
-rw-r--r--sysdeps/ieee754/bits/nan.h10
-rw-r--r--sysdeps/ieee754/dbl-64/Dist33
-rw-r--r--sysdeps/ieee754/dbl-64/e_exp2.c7
-rw-r--r--sysdeps/ieee754/dbl-64/e_pow.c22
-rw-r--r--sysdeps/ieee754/dbl-64/halfulp.c4
-rw-r--r--sysdeps/ieee754/dbl-64/s_llrint.c23
-rw-r--r--sysdeps/ieee754/dbl-64/s_lrint.c21
-rw-r--r--sysdeps/ieee754/dbl-64/s_sincos.c6
-rw-r--r--sysdeps/ieee754/flt-32/Dist1
-rw-r--r--sysdeps/ieee754/flt-32/e_atan2f.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_exp2f.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_expf.c2
-rw-r--r--sysdeps/ieee754/flt-32/e_hypotf.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_expm1f.c11
-rw-r--r--sysdeps/ieee754/flt-32/s_llrintf.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_lrintf.c10
-rw-r--r--sysdeps/ieee754/flt-32/s_nextafterf.c20
-rw-r--r--sysdeps/ieee754/ldbl-128/Dist2
-rw-r--r--sysdeps/ieee754/ldbl-128/e_powl.c2
-rw-r--r--sysdeps/ieee754/ldbl-128/printf_fphex.c4
-rw-r--r--sysdeps/ieee754/ldbl-128/s_llrintl.c10
-rw-r--r--sysdeps/ieee754/ldbl-128/s_lrintl.c23
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nextafterl.c18
-rw-r--r--sysdeps/ieee754/ldbl-128/s_nexttoward.c23
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/Makefile5
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acoshl.c69
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_acosl.c328
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_asinl.c265
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atan2l.c124
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_atanhl.c79
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_coshl.c90
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_expl.c257
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_fmodl.c145
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c58
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_hypotl.c131
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_j0l.c3
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_j1l.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_jnl.c402
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c3
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log10l.c258
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_log2l.c250
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_logl.c281
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_powl.c441
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c278
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_remainderl.c78
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sinhl.c84
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c109
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/ieee754.h210
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_cosl.c146
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_sincosl.c182
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_sinl.c150
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/k_tanl.c164
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c175
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/math_ldbl.h181
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c152
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/printf_fphex.c141
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_asinhl.c67
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_atanl.c234
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c6
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ceill.c91
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_copysignl.c45
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cosl.c88
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_cprojl.c54
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c87
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ctanl.c88
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_erfl.c958
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_expm1l.c160
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_fabsl.c43
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_finitel.c45
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_floorl.c85
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c95
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_frexpl.c92
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c63
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_isinfl.c35
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_isnanl.c43
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llrintl.c147
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_llroundl.c127
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_log1pl.c257
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_logbl.c47
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lrintl.c162
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_lroundl.c142
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_modfl.c94
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c125
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c119
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c105
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c89
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_remquol.c111
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_rintl.c119
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_roundl.c98
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c105
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c109
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_signbitl.c37
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_sincosl.c72
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_sinl.c84
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_tanhl.c90
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_tanl.c78
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_truncl.c102
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/strtold_l.c63
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/t_sincosl.c694
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/w_expl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_asinhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_atanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_cbrtl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_ceill.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_copysignl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_cosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_erfl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_expm1l.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_fabsl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_finitel.c17
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_floorl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c10
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_frexpl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_ilogbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_isinfl.c16
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_isnanl.c16
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_llrintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_llroundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_log1pl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_logbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_lrintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_lroundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_modfl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nextafterl.c6
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nexttoward.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_remquol.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_rintl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_roundl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_scalblnl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_scalbnl.c9
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_signbitl.c11
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_sincosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_sinl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_tanhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_tanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/s_truncl.c5
-rw-r--r--sysdeps/ieee754/ldbl-64-128/strtold_l.c63
-rw-r--r--sysdeps/ieee754/ldbl-64-128/w_expl.c5
-rw-r--r--sysdeps/ieee754/ldbl-96/printf_fphex.c4
-rw-r--r--sysdeps/ieee754/ldbl-96/s_erfl.c8
-rw-r--r--sysdeps/ieee754/ldbl-96/s_llrintl.c10
-rw-r--r--sysdeps/ieee754/ldbl-96/s_lrintl.c17
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nextafterl.c20
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nexttoward.c27
-rw-r--r--sysdeps/ieee754/ldbl-96/s_nexttowardf.c28
-rw-r--r--sysdeps/ieee754/ldbl-96/strtold_l.c4
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile43
-rw-r--r--sysdeps/ieee754/ldbl-opt/Versions87
-rw-r--r--sysdeps/ieee754/ldbl-opt/cabs.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cabsl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/carg.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cargl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cimag.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/cimagl.c6
-rwxr-xr-xsysdeps/ieee754/ldbl-opt/configure69
-rw-r--r--sysdeps/ieee754/ldbl-opt/configure.in19
-rw-r--r--sysdeps/ieee754/ldbl-opt/conj.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/conjl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/creal.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/creall.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c3
-rw-r--r--sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h52
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-acos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-acosh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asinh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atan2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-atanh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cabs.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cacos.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-carg.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-casin.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-casinh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-catan.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-catanh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ccos.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ceil.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cimag.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-clog.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-clog10.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-compat.c852
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-compat.h87
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-conj.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-copysign.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cosh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cpow.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-cproj.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-creal.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csin.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csinh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ctan.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-drem.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-erf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-erfc.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-exp2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-expm1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fabs.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fdim.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-finite.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-floor.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmax.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmod.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-frexp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-gamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-hypot.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-isinf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-isnan.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-j0.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-j1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-jn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-llrint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-llround.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log1p.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-log2.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-logb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lrint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-lround.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-modf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c13
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-pow.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-pow10.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-remainder.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-remquo.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-rint.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-round.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalb.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-scanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-signbit.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-significand.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sin.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sincos.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sinh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c17
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtold.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c20
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c16
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-syslog.c11
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tanh.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-trunc.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c14
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c15
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-y0.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-y1.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-yn.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_asinh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_atan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacos.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacosh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacoshl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cacosl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catan.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_catanl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cbrt.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccos.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccosh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccoshl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ccosl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ceil.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexp.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cexpl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10.c7
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clog10l.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_clogl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_copysign.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpow.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cpowl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cproj.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_cprojl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrt.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csqrtl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctan.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ctanl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_erf.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_expm1.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fabs.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fdim.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fdiml.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_finite.c18
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_floor.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fma.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmal.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmax.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmaxl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmin.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fminl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_frexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ilogb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_isinf.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_isnan.c8
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ldexp.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_ldexpl.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_llrint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_llround.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_log1p.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_logb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_lrint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_lround.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_modf.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nanl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nearbyint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nextafter.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c85
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_remquo.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_rint.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_round.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_scalbln.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_scalbn.c9
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_significand.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_significandl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_sin.c10
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_sincos.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_tan.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_tanh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_trunc.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acos.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acosh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acoshl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_acosl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_asin.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_asinl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atan2.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atan2l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atanh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_atanhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_cosh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_coshl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_drem.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_dreml.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp10.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_exp10l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_fmod.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_fmodl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_hypot.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_hypotl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j0.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j0l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j1.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_j1l.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_jn.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_jnl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgamma.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgamma_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgammal.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_lgammal_r.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log10.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log10l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log2.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_log2l.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_logl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_pow.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_powl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_remainder.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_remainderl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_scalb.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_scalbl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sinh.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sinhl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sqrt.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_sqrtl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_tgamma.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/w_tgammal.c5
-rw-r--r--sysdeps/m68k/Implies5
-rw-r--r--sysdeps/m68k/Makefile38
-rw-r--r--sysdeps/m68k/Versions6
-rw-r--r--sysdeps/m68k/__longjmp.c55
-rw-r--r--sysdeps/m68k/abort-instr.h2
-rw-r--r--sysdeps/m68k/add_n.S76
-rw-r--r--sysdeps/m68k/asm-syntax.h109
-rw-r--r--sysdeps/m68k/bits/byteswap.h67
-rw-r--r--sysdeps/m68k/bits/endian.h7
-rw-r--r--sysdeps/m68k/bits/huge_vall.h43
-rw-r--r--sysdeps/m68k/bits/setjmp.h46
-rw-r--r--sysdeps/m68k/bsd-_setjmp.c22
-rw-r--r--sysdeps/m68k/bsd-setjmp.c21
-rw-r--r--sysdeps/m68k/dl-machine.h316
-rw-r--r--sysdeps/m68k/elf/start.S100
-rw-r--r--sysdeps/m68k/ffs.c48
-rw-r--r--sysdeps/m68k/fpu/Dist1
-rw-r--r--sysdeps/m68k/fpu/Makefile11
-rw-r--r--sysdeps/m68k/fpu/bits/fenv.h79
-rw-r--r--sysdeps/m68k/fpu/bits/mathdef.h38
-rw-r--r--sysdeps/m68k/fpu/bits/mathinline.h445
-rw-r--r--sysdeps/m68k/fpu/branred.c1
-rw-r--r--sysdeps/m68k/fpu/doasin.c1
-rw-r--r--sysdeps/m68k/fpu/dosincos.c1
-rw-r--r--sysdeps/m68k/fpu/e_acos.c35
-rw-r--r--sysdeps/m68k/fpu/e_acosf.c5
-rw-r--r--sysdeps/m68k/fpu/e_acosl.c5
-rw-r--r--sysdeps/m68k/fpu/e_asin.c2
-rw-r--r--sysdeps/m68k/fpu/e_asinf.c2
-rw-r--r--sysdeps/m68k/fpu/e_asinl.c2
-rw-r--r--sysdeps/m68k/fpu/e_atan2.c104
-rw-r--r--sysdeps/m68k/fpu/e_atan2f.c3
-rw-r--r--sysdeps/m68k/fpu/e_atan2l.c3
-rw-r--r--sysdeps/m68k/fpu/e_atanh.c2
-rw-r--r--sysdeps/m68k/fpu/e_atanhf.c2
-rw-r--r--sysdeps/m68k/fpu/e_atanhl.c2
-rw-r--r--sysdeps/m68k/fpu/e_cosh.c2
-rw-r--r--sysdeps/m68k/fpu/e_coshf.c2
-rw-r--r--sysdeps/m68k/fpu/e_coshl.c2
-rw-r--r--sysdeps/m68k/fpu/e_exp.c2
-rw-r--r--sysdeps/m68k/fpu/e_exp10.c2
-rw-r--r--sysdeps/m68k/fpu/e_exp10f.c2
-rw-r--r--sysdeps/m68k/fpu/e_exp10l.c2
-rw-r--r--sysdeps/m68k/fpu/e_exp2.c2
-rw-r--r--sysdeps/m68k/fpu/e_exp2f.c2
-rw-r--r--sysdeps/m68k/fpu/e_exp2l.c2
-rw-r--r--sysdeps/m68k/fpu/e_expf.c2
-rw-r--r--sysdeps/m68k/fpu/e_expl.c2
-rw-r--r--sysdeps/m68k/fpu/e_fmod.c36
-rw-r--r--sysdeps/m68k/fpu/e_fmodf.c5
-rw-r--r--sysdeps/m68k/fpu/e_fmodl.c5
-rw-r--r--sysdeps/m68k/fpu/e_log.c2
-rw-r--r--sysdeps/m68k/fpu/e_log10.c2
-rw-r--r--sysdeps/m68k/fpu/e_log10f.c2
-rw-r--r--sysdeps/m68k/fpu/e_log10l.c2
-rw-r--r--sysdeps/m68k/fpu/e_log2.c2
-rw-r--r--sysdeps/m68k/fpu/e_log2f.c2
-rw-r--r--sysdeps/m68k/fpu/e_log2l.c2
-rw-r--r--sysdeps/m68k/fpu/e_logf.c2
-rw-r--r--sysdeps/m68k/fpu/e_logl.c2
-rw-r--r--sysdeps/m68k/fpu/e_pow.c126
-rw-r--r--sysdeps/m68k/fpu/e_powf.c3
-rw-r--r--sysdeps/m68k/fpu/e_powl.c3
-rw-r--r--sysdeps/m68k/fpu/e_rem_pio2.c3
-rw-r--r--sysdeps/m68k/fpu/e_rem_pio2f.c3
-rw-r--r--sysdeps/m68k/fpu/e_rem_pio2l.c3
-rw-r--r--sysdeps/m68k/fpu/e_remainder.c2
-rw-r--r--sysdeps/m68k/fpu/e_remainderf.c2
-rw-r--r--sysdeps/m68k/fpu/e_remainderl.c2
-rw-r--r--sysdeps/m68k/fpu/e_scalb.c60
-rw-r--r--sysdeps/m68k/fpu/e_scalbf.c3
-rw-r--r--sysdeps/m68k/fpu/e_scalbl.c3
-rw-r--r--sysdeps/m68k/fpu/e_sinh.c2
-rw-r--r--sysdeps/m68k/fpu/e_sinhf.c2
-rw-r--r--sysdeps/m68k/fpu/e_sinhl.c2
-rw-r--r--sysdeps/m68k/fpu/e_sqrt.c2
-rw-r--r--sysdeps/m68k/fpu/e_sqrtf.c2
-rw-r--r--sysdeps/m68k/fpu/e_sqrtl.c2
-rw-r--r--sysdeps/m68k/fpu/fclrexcpt.c50
-rw-r--r--sysdeps/m68k/fpu/fedisblxcpt.c39
-rw-r--r--sysdeps/m68k/fpu/feenablxcpt.c39
-rw-r--r--sysdeps/m68k/fpu/fegetenv.c38
-rw-r--r--sysdeps/m68k/fpu/fegetexcept.c32
-rw-r--r--sysdeps/m68k/fpu/fegetround.c31
-rw-r--r--sysdeps/m68k/fpu/feholdexcpt.c39
-rw-r--r--sysdeps/m68k/fpu/fesetenv.c60
-rw-r--r--sysdeps/m68k/fpu/fesetround.c38
-rw-r--r--sysdeps/m68k/fpu/feupdateenv.c50
-rw-r--r--sysdeps/m68k/fpu/fgetexcptflg.c43
-rw-r--r--sysdeps/m68k/fpu/fraiseexcpt.c83
-rw-r--r--sysdeps/m68k/fpu/fsetexcptflg.c49
-rw-r--r--sysdeps/m68k/fpu/ftestexcept.c32
-rw-r--r--sysdeps/m68k/fpu/halfulp.c1
-rw-r--r--sysdeps/m68k/fpu/k_cos.c42
-rw-r--r--sysdeps/m68k/fpu/k_cosf.c3
-rw-r--r--sysdeps/m68k/fpu/k_cosl.c3
-rw-r--r--sysdeps/m68k/fpu/k_rem_pio2.c3
-rw-r--r--sysdeps/m68k/fpu/k_rem_pio2f.c3
-rw-r--r--sysdeps/m68k/fpu/k_rem_pio2l.c3
-rw-r--r--sysdeps/m68k/fpu/k_sin.c45
-rw-r--r--sysdeps/m68k/fpu/k_sinf.c3
-rw-r--r--sysdeps/m68k/fpu/k_sinl.c3
-rw-r--r--sysdeps/m68k/fpu/k_tan.c44
-rw-r--r--sysdeps/m68k/fpu/k_tanf.c3
-rw-r--r--sysdeps/m68k/fpu/k_tanl.c3
-rw-r--r--sysdeps/m68k/fpu/libm-test-ulps1165
-rw-r--r--sysdeps/m68k/fpu/mathimpl.h94
-rw-r--r--sysdeps/m68k/fpu/mpa.c1
-rw-r--r--sysdeps/m68k/fpu/mpatan.c1
-rw-r--r--sysdeps/m68k/fpu/mpatan2.c1
-rw-r--r--sysdeps/m68k/fpu/mpexp.c1
-rw-r--r--sysdeps/m68k/fpu/mplog.c1
-rw-r--r--sysdeps/m68k/fpu/mpsqrt.c1
-rw-r--r--sysdeps/m68k/fpu/mptan.c1
-rw-r--r--sysdeps/m68k/fpu/s_atan.c38
-rw-r--r--sysdeps/m68k/fpu/s_atanf.c5
-rw-r--r--sysdeps/m68k/fpu/s_atanl.c5
-rw-r--r--sysdeps/m68k/fpu/s_ccos.c73
-rw-r--r--sysdeps/m68k/fpu/s_ccosf.c3
-rw-r--r--sysdeps/m68k/fpu/s_ccosh.c78
-rw-r--r--sysdeps/m68k/fpu/s_ccoshf.c3
-rw-r--r--sysdeps/m68k/fpu/s_ccoshl.c3
-rw-r--r--sysdeps/m68k/fpu/s_ccosl.c3
-rw-r--r--sysdeps/m68k/fpu/s_ceil.c2
-rw-r--r--sysdeps/m68k/fpu/s_ceilf.c2
-rw-r--r--sysdeps/m68k/fpu/s_ceill.c2
-rw-r--r--sysdeps/m68k/fpu/s_cexp.c117
-rw-r--r--sysdeps/m68k/fpu/s_cexpf.c3
-rw-r--r--sysdeps/m68k/fpu/s_cexpl.c3
-rw-r--r--sysdeps/m68k/fpu/s_cos.c2
-rw-r--r--sysdeps/m68k/fpu/s_cosf.c2
-rw-r--r--sysdeps/m68k/fpu/s_cosl.c2
-rw-r--r--sysdeps/m68k/fpu/s_csin.c69
-rw-r--r--sysdeps/m68k/fpu/s_csinf.c3
-rw-r--r--sysdeps/m68k/fpu/s_csinh.c71
-rw-r--r--sysdeps/m68k/fpu/s_csinhf.c3
-rw-r--r--sysdeps/m68k/fpu/s_csinhl.c3
-rw-r--r--sysdeps/m68k/fpu/s_csinl.c3
-rw-r--r--sysdeps/m68k/fpu/s_expm1.c2
-rw-r--r--sysdeps/m68k/fpu/s_expm1f.c2
-rw-r--r--sysdeps/m68k/fpu/s_expm1l.c3
-rw-r--r--sysdeps/m68k/fpu/s_fabs.c2
-rw-r--r--sysdeps/m68k/fpu/s_fabsf.c2
-rw-r--r--sysdeps/m68k/fpu/s_fabsl.c2
-rw-r--r--sysdeps/m68k/fpu/s_finite.c2
-rw-r--r--sysdeps/m68k/fpu/s_finitef.c2
-rw-r--r--sysdeps/m68k/fpu/s_finitel.c2
-rw-r--r--sysdeps/m68k/fpu/s_floor.c2
-rw-r--r--sysdeps/m68k/fpu/s_floorf.c2
-rw-r--r--sysdeps/m68k/fpu/s_floorl.c2
-rw-r--r--sysdeps/m68k/fpu/s_fpclassifyl.c44
-rw-r--r--sysdeps/m68k/fpu/s_frexp.c56
-rw-r--r--sysdeps/m68k/fpu/s_frexpf.c3
-rw-r--r--sysdeps/m68k/fpu/s_frexpl.c59
-rw-r--r--sysdeps/m68k/fpu/s_ilogb.c51
-rw-r--r--sysdeps/m68k/fpu/s_ilogbf.c3
-rw-r--r--sysdeps/m68k/fpu/s_ilogbl.c3
-rw-r--r--sysdeps/m68k/fpu/s_isinf.c40
-rw-r--r--sysdeps/m68k/fpu/s_isinff.c5
-rw-r--r--sysdeps/m68k/fpu/s_isinfl.c5
-rw-r--r--sysdeps/m68k/fpu/s_isnan.c2
-rw-r--r--sysdeps/m68k/fpu/s_isnanf.c2
-rw-r--r--sysdeps/m68k/fpu/s_isnanl.c2
-rw-r--r--sysdeps/m68k/fpu/s_llrint.c76
-rw-r--r--sysdeps/m68k/fpu/s_llrintf.c66
-rw-r--r--sysdeps/m68k/fpu/s_llrintl.c65
-rw-r--r--sysdeps/m68k/fpu/s_log1p.c2
-rw-r--r--sysdeps/m68k/fpu/s_log1pf.c2
-rw-r--r--sysdeps/m68k/fpu/s_log1pl.c2
-rw-r--r--sysdeps/m68k/fpu/s_lrint.c40
-rw-r--r--sysdeps/m68k/fpu/s_lrintf.c3
-rw-r--r--sysdeps/m68k/fpu/s_lrintl.c3
-rw-r--r--sysdeps/m68k/fpu/s_modf.c56
-rw-r--r--sysdeps/m68k/fpu/s_modff.c3
-rw-r--r--sysdeps/m68k/fpu/s_modfl.c3
-rw-r--r--sysdeps/m68k/fpu/s_nearbyint.c2
-rw-r--r--sysdeps/m68k/fpu/s_nearbyintf.c2
-rw-r--r--sysdeps/m68k/fpu/s_nearbyintl.c2
-rw-r--r--sysdeps/m68k/fpu/s_nextafterl.c109
-rw-r--r--sysdeps/m68k/fpu/s_remquo.c48
-rw-r--r--sysdeps/m68k/fpu/s_remquof.c3
-rw-r--r--sysdeps/m68k/fpu/s_remquol.c3
-rw-r--r--sysdeps/m68k/fpu/s_rint.c2
-rw-r--r--sysdeps/m68k/fpu/s_rintf.c2
-rw-r--r--sysdeps/m68k/fpu/s_rintl.c2
-rw-r--r--sysdeps/m68k/fpu/s_scalbln.c2
-rw-r--r--sysdeps/m68k/fpu/s_scalblnf.c2
-rw-r--r--sysdeps/m68k/fpu/s_scalblnl.c2
-rw-r--r--sysdeps/m68k/fpu/s_scalbn.c54
-rw-r--r--sysdeps/m68k/fpu/s_scalbnf.c3
-rw-r--r--sysdeps/m68k/fpu/s_scalbnl.c3
-rw-r--r--sysdeps/m68k/fpu/s_significand.c2
-rw-r--r--sysdeps/m68k/fpu/s_significandf.c2
-rw-r--r--sysdeps/m68k/fpu/s_significandl.c2
-rw-r--r--sysdeps/m68k/fpu/s_sin.c2
-rw-r--r--sysdeps/m68k/fpu/s_sincos.c38
-rw-r--r--sysdeps/m68k/fpu/s_sincosf.c3
-rw-r--r--sysdeps/m68k/fpu/s_sincosl.c3
-rw-r--r--sysdeps/m68k/fpu/s_sinf.c2
-rw-r--r--sysdeps/m68k/fpu/s_sinl.c2
-rw-r--r--sysdeps/m68k/fpu/s_tan.c2
-rw-r--r--sysdeps/m68k/fpu/s_tanf.c2
-rw-r--r--sysdeps/m68k/fpu/s_tanh.c2
-rw-r--r--sysdeps/m68k/fpu/s_tanhf.c2
-rw-r--r--sysdeps/m68k/fpu/s_tanhl.c2
-rw-r--r--sysdeps/m68k/fpu/s_tanl.c2
-rw-r--r--sysdeps/m68k/fpu/s_trunc.c2
-rw-r--r--sysdeps/m68k/fpu/s_truncf.c2
-rw-r--r--sysdeps/m68k/fpu/s_truncl.c2
-rw-r--r--sysdeps/m68k/fpu/sincos32.c1
-rw-r--r--sysdeps/m68k/fpu/slowexp.c1
-rw-r--r--sysdeps/m68k/fpu/slowpow.c1
-rw-r--r--sysdeps/m68k/fpu/switch/68881-sw.h64
-rw-r--r--sysdeps/m68k/fpu/switch/Dist2
-rw-r--r--sysdeps/m68k/fpu/switch/Makefile51
-rw-r--r--sysdeps/m68k/fpu/switch/bits/mathinline.h1
-rw-r--r--sysdeps/m68k/fpu/switch/switch.c87
-rw-r--r--sysdeps/m68k/fpu/t_exp.c1
-rw-r--r--sysdeps/m68k/fpu_control.h101
-rw-r--r--sysdeps/m68k/gccframe.h22
-rw-r--r--sysdeps/m68k/lshift.S147
-rw-r--r--sysdeps/m68k/m68020/Makefile3
-rw-r--r--sysdeps/m68k/m68020/addmul_1.S80
-rw-r--r--sysdeps/m68k/m68020/bits/atomic.h254
-rw-r--r--sysdeps/m68k/m68020/bits/string.h26
-rw-r--r--sysdeps/m68k/m68020/mul_1.S87
-rw-r--r--sysdeps/m68k/m68020/submul_1.S80
-rw-r--r--sysdeps/m68k/m68020/wordcopy.S1
-rw-r--r--sysdeps/m68k/memchr.S232
-rw-r--r--sysdeps/m68k/memcopy.h100
-rw-r--r--sysdeps/m68k/memusage.h22
-rw-r--r--sysdeps/m68k/printf_fphex.c2
-rw-r--r--sysdeps/m68k/rawmemchr.S180
-rw-r--r--sysdeps/m68k/rshift.S146
-rw-r--r--sysdeps/m68k/s_isinfl.c42
-rw-r--r--sysdeps/m68k/s_isnanl.c38
-rw-r--r--sysdeps/m68k/setjmp.c63
-rw-r--r--sysdeps/m68k/stackinfo.h28
-rw-r--r--sysdeps/m68k/strchr.S258
-rw-r--r--sysdeps/m68k/strchrnul.S250
-rw-r--r--sysdeps/m68k/strtold_l.c2
-rw-r--r--sysdeps/m68k/sub_n.S76
-rw-r--r--sysdeps/m68k/sys/ucontext.h108
-rw-r--r--sysdeps/m68k/sysdep.h100
-rw-r--r--sysdeps/mach/Subdirs10
-rw-r--r--sysdeps/mach/hppa/machine-lock.h63
-rw-r--r--sysdeps/mach/hurd/Dist17
-rw-r--r--sysdeps/mach/hurd/Subdirs10
-rw-r--r--sysdeps/mach/hurd/alpha/Dist1
-rw-r--r--sysdeps/mach/hurd/alpha/longjmp-ts.c3
-rw-r--r--sysdeps/mach/hurd/bits/ioctls.h1
-rw-r--r--sysdeps/mach/hurd/bits/posix_opt.h108
-rw-r--r--sysdeps/mach/hurd/bits/stat.h7
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.h8
-rw-r--r--sysdeps/mach/hurd/errno.c1
-rw-r--r--sysdeps/mach/hurd/euidaccess.c3
-rw-r--r--sysdeps/mach/hurd/faccessat.c70
-rw-r--r--sysdeps/mach/hurd/fchmodat.c44
-rw-r--r--sysdeps/mach/hurd/fchownat.c46
-rw-r--r--sysdeps/mach/hurd/fdopendir.c58
-rw-r--r--sysdeps/mach/hurd/fgetxattr.c34
-rw-r--r--sysdeps/mach/hurd/flistxattr.c34
-rw-r--r--sysdeps/mach/hurd/fork.c5
-rw-r--r--sysdeps/mach/hurd/fremovexattr.c34
-rw-r--r--sysdeps/mach/hurd/fsetxattr.c34
-rw-r--r--sysdeps/mach/hurd/fxstatat.c33
-rw-r--r--sysdeps/mach/hurd/fxstatat64.c46
-rw-r--r--sysdeps/mach/hurd/getdents.c2
-rw-r--r--sysdeps/mach/hurd/getpeername.c14
-rw-r--r--sysdeps/mach/hurd/getresgid.c14
-rw-r--r--sysdeps/mach/hurd/getresuid.c14
-rw-r--r--sysdeps/mach/hurd/getsid.c3
-rw-r--r--sysdeps/mach/hurd/getxattr.c35
-rw-r--r--sysdeps/mach/hurd/hppa/bits/sigcontext.h94
-rw-r--r--sysdeps/mach/hurd/hppa/trampoline.c230
-rw-r--r--sysdeps/mach/hurd/i386/Dist3
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c25
-rw-r--r--sysdeps/mach/hurd/i386/longjmp-ts.c3
-rw-r--r--sysdeps/mach/hurd/i386/tls.h4
-rw-r--r--sysdeps/mach/hurd/i386/trampoline.c7
-rw-r--r--sysdeps/mach/hurd/ifreq.c65
-rw-r--r--sysdeps/mach/hurd/ifreq.h80
-rw-r--r--sysdeps/mach/hurd/init-posix.c2
-rw-r--r--sysdeps/mach/hurd/ioctl.c22
-rw-r--r--sysdeps/mach/hurd/jmp-unwind.c20
-rw-r--r--sysdeps/mach/hurd/lgetxattr.c36
-rw-r--r--sysdeps/mach/hurd/linkat.c66
-rw-r--r--sysdeps/mach/hurd/listxattr.c35
-rw-r--r--sysdeps/mach/hurd/lsetxattr.c37
-rw-r--r--sysdeps/mach/hurd/mig-reply.c4
-rw-r--r--sysdeps/mach/hurd/mips/Dist3
-rw-r--r--sysdeps/mach/hurd/mips/bits/sigcontext.h80
-rw-r--r--sysdeps/mach/hurd/mips/dl-machine.c132
-rw-r--r--sysdeps/mach/hurd/mips/exc2signal.c97
-rw-r--r--sysdeps/mach/hurd/mips/init-fault.c41
-rw-r--r--sysdeps/mach/hurd/mips/init-first.c414
-rw-r--r--sysdeps/mach/hurd/mips/intr-msg.h127
-rw-r--r--sysdeps/mach/hurd/mips/longjmp-ctx.c41
-rw-r--r--sysdeps/mach/hurd/mips/longjmp-ts.c45
-rw-r--r--sysdeps/mach/hurd/mips/sigreturn.c223
-rw-r--r--sysdeps/mach/hurd/mips/trampoline.c292
-rw-r--r--sysdeps/mach/hurd/mkdirat.c42
-rw-r--r--sysdeps/mach/hurd/open.c8
-rw-r--r--sysdeps/mach/hurd/open64.c1
-rw-r--r--sysdeps/mach/hurd/openat.c62
-rw-r--r--sysdeps/mach/hurd/openat64.c1
-rw-r--r--sysdeps/mach/hurd/opendir.c75
-rw-r--r--sysdeps/mach/hurd/powerpc/Dist1
-rw-r--r--sysdeps/mach/hurd/powerpc/longjmp-ts.c3
-rw-r--r--sysdeps/mach/hurd/powerpc/register-dump.h4
-rw-r--r--sysdeps/mach/hurd/powerpc/trampoline.c7
-rw-r--r--sysdeps/mach/hurd/ppoll.c30
-rw-r--r--sysdeps/mach/hurd/profil.c4
-rw-r--r--sysdeps/mach/hurd/readdir64_r.c2
-rw-r--r--sysdeps/mach/hurd/recv.c6
-rw-r--r--sysdeps/mach/hurd/removexattr.c35
-rw-r--r--sysdeps/mach/hurd/setitimer.c12
-rw-r--r--sysdeps/mach/hurd/setresgid.c11
-rw-r--r--sysdeps/mach/hurd/setresuid.c11
-rw-r--r--sysdeps/mach/hurd/setxattr.c36
-rw-r--r--sysdeps/mach/hurd/sigaltstack.c2
-rw-r--r--sysdeps/mach/hurd/symlinkat.c74
-rw-r--r--sysdeps/mach/hurd/tls.h9
-rw-r--r--sysdeps/mach/hurd/unlinkat.c55
-rw-r--r--sysdeps/mach/hurd/xmknod.c86
-rw-r--r--sysdeps/mach/hurd/xmknodat.c118
-rw-r--r--sysdeps/mach/i386/syscall.S3
-rw-r--r--sysdeps/mach/mips/Dist1
-rw-r--r--sysdeps/mach/mips/Makefile3
-rw-r--r--sysdeps/mach/mips/cacheflush.c44
-rw-r--r--sysdeps/mach/mips/machine-lock.h92
-rw-r--r--sysdeps/mach/mips/machine-sp.h38
-rw-r--r--sysdeps/mach/mips/syscall.S48
-rw-r--r--sysdeps/mach/mips/sysdep.h83
-rw-r--r--sysdeps/mach/mips/thread_state.h42
-rw-r--r--sysdeps/mach/msync.c4
-rw-r--r--sysdeps/mach/sched_yield.c3
-rw-r--r--sysdeps/mach/sys/reboot.h136
-rw-r--r--sysdeps/mips/.cvsignore4
-rw-r--r--sysdeps/mips/Dist8
-rw-r--r--sysdeps/mips/Implies3
-rw-r--r--sysdeps/mips/Makefile12
-rw-r--r--sysdeps/mips/__longjmp.c84
-rw-r--r--sysdeps/mips/abort-instr.h2
-rw-r--r--sysdeps/mips/add_n.S122
-rw-r--r--sysdeps/mips/addmul_1.S99
-rw-r--r--sysdeps/mips/atomicity.h113
-rw-r--r--sysdeps/mips/bits/dlfcn.h66
-rw-r--r--sysdeps/mips/bits/endian.h13
-rw-r--r--sysdeps/mips/bits/fenv.h77
-rw-r--r--sysdeps/mips/bits/ipctypes.h32
-rw-r--r--sysdeps/mips/bits/nan.h56
-rw-r--r--sysdeps/mips/bits/setjmp.h81
-rw-r--r--sysdeps/mips/bits/wordsize.h19
-rw-r--r--sysdeps/mips/bsd-_setjmp.S43
-rw-r--r--sysdeps/mips/bsd-setjmp.S42
-rw-r--r--sysdeps/mips/dl-dtprocnum.h22
-rw-r--r--sysdeps/mips/dl-machine.h777
-rw-r--r--sysdeps/mips/elf/ldsodefs.h109
-rw-r--r--sysdeps/mips/elf/start.S119
-rw-r--r--sysdeps/mips/fpregdef.h24
-rw-r--r--sysdeps/mips/fpu/bits/mathdef.h46
-rw-r--r--sysdeps/mips/fpu/e_sqrt.c38
-rw-r--r--sysdeps/mips/fpu/e_sqrtf.c39
-rw-r--r--sysdeps/mips/fpu/fclrexcpt.c47
-rw-r--r--sysdeps/mips/fpu/fedisblxcpt.c42
-rw-r--r--sysdeps/mips/fpu/feenablxcpt.c42
-rw-r--r--sysdeps/mips/fpu/fegetenv.c31
-rw-r--r--sysdeps/mips/fpu/fegetexcept.c34
-rw-r--r--sysdeps/mips/fpu/fegetround.c33
-rw-r--r--sysdeps/mips/fpu/feholdexcpt.c38
-rw-r--r--sysdeps/mips/fpu/fenv_libc.h32
-rw-r--r--sysdeps/mips/fpu/fesetenv.c43
-rw-r--r--sysdeps/mips/fpu/fesetround.c43
-rw-r--r--sysdeps/mips/fpu/feupdateenv.c43
-rw-r--r--sysdeps/mips/fpu/fgetexcptflg.c40
-rw-r--r--sysdeps/mips/fpu/fraiseexcpt.c47
-rw-r--r--sysdeps/mips/fpu/fsetexcptflg.c43
-rw-r--r--sysdeps/mips/fpu/ftestexcept.c33
-rw-r--r--sysdeps/mips/fpu/libm-test-ulps890
-rw-r--r--sysdeps/mips/fpu_control.h98
-rw-r--r--sysdeps/mips/gccframe.h22
-rw-r--r--sysdeps/mips/ieee754.h325
-rw-r--r--sysdeps/mips/init-first.c64
-rw-r--r--sysdeps/mips/lshift.S98
-rw-r--r--sysdeps/mips/machine-gmon.h141
-rw-r--r--sysdeps/mips/memcpy.S136
-rw-r--r--sysdeps/mips/memset.S86
-rw-r--r--sysdeps/mips/memusage.h21
-rw-r--r--sysdeps/mips/mips32/Implies2
-rw-r--r--sysdeps/mips/mips32/Makefile3
-rw-r--r--sysdeps/mips/mips64/Dist1
-rw-r--r--sysdeps/mips/mips64/Implies3
-rw-r--r--sysdeps/mips/mips64/__longjmp.c98
-rw-r--r--sysdeps/mips/mips64/add_n.S130
-rw-r--r--sysdeps/mips/mips64/addmul_1.S107
-rw-r--r--sysdeps/mips/mips64/bsd-_setjmp.S49
-rw-r--r--sysdeps/mips/mips64/bsd-setjmp.S47
-rw-r--r--sysdeps/mips/mips64/gmp-mparam.h31
-rw-r--r--sysdeps/mips/mips64/lshift.S105
-rw-r--r--sysdeps/mips/mips64/memcpy.S140
-rw-r--r--sysdeps/mips/mips64/memset.S92
-rw-r--r--sysdeps/mips/mips64/mul_1.S96
-rw-r--r--sysdeps/mips/mips64/n32/Implies4
-rw-r--r--sysdeps/mips/mips64/n32/Makefile6
-rw-r--r--sysdeps/mips/mips64/n64/Implies4
-rw-r--r--sysdeps/mips/mips64/n64/Makefile6
-rw-r--r--sysdeps/mips/mips64/rshift.S102
-rw-r--r--sysdeps/mips/mips64/setjmp.S46
-rw-r--r--sysdeps/mips/mips64/setjmp_aux.c78
-rw-r--r--sysdeps/mips/mips64/soft-fp/Dist1
-rw-r--r--sysdeps/mips/mips64/soft-fp/sfp-machine.h47
-rw-r--r--sysdeps/mips/mips64/sub_n.S130
-rw-r--r--sysdeps/mips/mips64/submul_1.S108
-rw-r--r--sysdeps/mips/mul_1.S87
-rw-r--r--sysdeps/mips/regdef.h27
-rw-r--r--sysdeps/mips/rshift.S95
-rw-r--r--sysdeps/mips/setjmp.S45
-rw-r--r--sysdeps/mips/setjmp_aux.c65
-rw-r--r--sysdeps/mips/sgidefs.h73
-rw-r--r--sysdeps/mips/soft-fp/Dist1
-rw-r--r--sysdeps/mips/soft-fp/sfp-machine.h47
-rw-r--r--sysdeps/mips/stackinfo.h28
-rw-r--r--sysdeps/mips/sub_n.S122
-rw-r--r--sysdeps/mips/submul_1.S99
-rw-r--r--sysdeps/mips/sys/asm.h473
-rw-r--r--sysdeps/mips/sys/fpregdef.h61
-rw-r--r--sysdeps/mips/sys/regdef.h82
-rw-r--r--sysdeps/mips/sys/ucontext.h159
-rw-r--r--sysdeps/posix/Makefile5
-rw-r--r--sysdeps/posix/clock_getres.c111
-rw-r--r--sysdeps/posix/euidaccess.c96
-rw-r--r--sysdeps/posix/gai_strerror-strs.h17
-rw-r--r--sysdeps/posix/gai_strerror.c70
-rw-r--r--sysdeps/posix/getaddrinfo.c806
-rw-r--r--sysdeps/posix/gettimeofday.c8
-rw-r--r--sysdeps/posix/libc_fatal.c7
-rw-r--r--sysdeps/posix/pause.c18
-rw-r--r--sysdeps/posix/posix_fallocate.c43
-rw-r--r--sysdeps/posix/posix_fallocate64.c47
-rw-r--r--sysdeps/posix/profil.c8
-rw-r--r--sysdeps/posix/shm_open.c4
-rw-r--r--sysdeps/posix/shm_unlink.c4
-rw-r--r--sysdeps/posix/sigignore.c4
-rw-r--r--sysdeps/posix/signal.c4
-rw-r--r--sysdeps/posix/sigset.c24
-rw-r--r--sysdeps/posix/spawni.c25
-rw-r--r--sysdeps/posix/sprofil.c8
-rw-r--r--sysdeps/posix/sysconf.c158
-rw-r--r--sysdeps/posix/system.c6
-rw-r--r--sysdeps/posix/sysv_signal.c4
-rw-r--r--sysdeps/posix/tempname.c10
-rw-r--r--sysdeps/powerpc/Dist2
-rw-r--r--sysdeps/powerpc/Implies4
-rw-r--r--sysdeps/powerpc/bits/link.h111
-rw-r--r--sysdeps/powerpc/bits/mathdef.h64
-rw-r--r--sysdeps/powerpc/bits/setjmp.h32
-rw-r--r--sysdeps/powerpc/dl-procinfo.c90
-rw-r--r--sysdeps/powerpc/dl-procinfo.h144
-rw-r--r--sysdeps/powerpc/elf/libc-start.c100
-rw-r--r--sysdeps/powerpc/ffs.c4
-rw-r--r--sysdeps/powerpc/fpu/Dist4
-rw-r--r--sysdeps/powerpc/fpu/bits/fenvinline.h8
-rw-r--r--sysdeps/powerpc/fpu/bits/mathdef.h69
-rw-r--r--sysdeps/powerpc/fpu/bits/mathinline.h20
-rw-r--r--sysdeps/powerpc/fpu/e_sqrt.c5
-rw-r--r--sysdeps/powerpc/fpu/e_sqrtf.c5
-rw-r--r--sysdeps/powerpc/fpu/fegetround.c4
-rw-r--r--sysdeps/powerpc/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/powerpc/fpu/fenv_libc.h37
-rw-r--r--sysdeps/powerpc/fpu/fesetround.c19
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps549
-rw-r--r--sysdeps/powerpc/fpu/math_ldbl.h189
-rw-r--r--sysdeps/powerpc/fpu/s_fabs.S8
-rw-r--r--sysdeps/powerpc/fpu/s_fmax.S8
-rw-r--r--sysdeps/powerpc/fpu/s_fmin.S8
-rw-r--r--sysdeps/powerpc/fpu/s_isnan.c3
-rw-r--r--sysdeps/powerpc/fpu/w_sqrtf.c1
-rw-r--r--sysdeps/powerpc/jmpbuf-offsets.h39
-rw-r--r--sysdeps/powerpc/jmpbuf-unwind.h48
-rw-r--r--sysdeps/powerpc/nofpu/Dist3
-rw-r--r--sysdeps/powerpc/nofpu/Makefile9
-rw-r--r--sysdeps/powerpc/nofpu/Versions13
-rw-r--r--sysdeps/powerpc/nofpu/fclrexcpt.c37
-rw-r--r--sysdeps/powerpc/nofpu/fedisblxcpt.c33
-rw-r--r--sysdeps/powerpc/nofpu/feenablxcpt.c33
-rw-r--r--sysdeps/powerpc/nofpu/fegetenv.c49
-rw-r--r--sysdeps/powerpc/nofpu/fegetexcept.c28
-rw-r--r--sysdeps/powerpc/nofpu/fegetround.c29
-rw-r--r--sysdeps/powerpc/nofpu/feholdexcpt.c43
-rw-r--r--sysdeps/powerpc/nofpu/fenv_const.c35
-rw-r--r--sysdeps/powerpc/nofpu/fesetenv.c48
-rw-r--r--sysdeps/powerpc/nofpu/fesetround.c33
-rw-r--r--sysdeps/powerpc/nofpu/feupdateenv.c50
-rw-r--r--sysdeps/powerpc/nofpu/fgetexcptflg.c38
-rw-r--r--sysdeps/powerpc/nofpu/fraiseexcpt.c46
-rw-r--r--sysdeps/powerpc/nofpu/fsetexcptflg.c40
-rw-r--r--sysdeps/powerpc/nofpu/ftestexcept.c28
-rw-r--r--sysdeps/powerpc/nofpu/libm-test-ulps890
-rw-r--r--sysdeps/powerpc/nofpu/sim-full.c45
-rw-r--r--sysdeps/powerpc/nofpu/soft-supp.h37
-rw-r--r--sysdeps/powerpc/powerpc32/Dist9
-rw-r--r--sysdeps/powerpc/powerpc32/Implies1
-rw-r--r--sysdeps/powerpc/powerpc32/Makefile2
-rw-r--r--sysdeps/powerpc/powerpc32/__longjmp-common.S14
-rw-r--r--sysdeps/powerpc/powerpc32/backtrace.c3
-rw-r--r--sysdeps/powerpc/powerpc32/bits/atomic.h15
-rw-r--r--sysdeps/powerpc/powerpc32/bsd-_setjmp.S8
-rw-r--r--sysdeps/powerpc/powerpc32/bsd-setjmp.S4
-rw-r--r--sysdeps/powerpc/powerpc32/configure62
-rw-r--r--sysdeps/powerpc/powerpc32/configure.in32
-rw-r--r--sysdeps/powerpc/powerpc32/dl-dtprocnum.h3
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.c5
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.h305
-rw-r--r--sysdeps/powerpc/powerpc32/dl-start.S16
-rw-r--r--sysdeps/powerpc/powerpc32/dl-trampoline.S186
-rw-r--r--sysdeps/powerpc/powerpc32/elf/start.S12
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/Dist2
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S29
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/fprrest.S7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/fprsave.S25
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_ceil.S65
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_ceilf.S61
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_copysign.S22
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_copysignl.S50
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fabs.S5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fabsl.S36
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fdim.c5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_floor.S45
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_floorf.S41
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fmax.S5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_fmin.S5
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_isnan.c7
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_llrint.c8
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_lrint.S14
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_lround.S59
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_rint.S49
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_rintf.S46
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_round.S73
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_roundf.S69
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_trunc.S64
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_truncf.S60
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/setjmp-common.S50
-rw-r--r--sysdeps/powerpc/powerpc32/gprrest0.S7
-rw-r--r--sysdeps/powerpc/powerpc32/gprrest1.S7
-rw-r--r--sysdeps/powerpc/powerpc32/gprsave0.S26
-rw-r--r--sysdeps/powerpc/powerpc32/gprsave1.S7
-rw-r--r--sysdeps/powerpc/powerpc32/hp-timing.h82
-rw-r--r--sysdeps/powerpc/powerpc32/lshift.S10
-rw-r--r--sysdeps/powerpc/powerpc32/memset.S97
-rw-r--r--sysdeps/powerpc/powerpc32/ppc-mcount.S28
-rw-r--r--sysdeps/powerpc/powerpc32/register-dump.h4
-rw-r--r--sysdeps/powerpc/powerpc32/setjmp-common.S23
-rw-r--r--sysdeps/powerpc/powerpc32/strncmp.S17
-rw-r--r--sysdeps/powerpc/powerpc32/sysdep.h40
-rw-r--r--sysdeps/powerpc/powerpc64/Dist4
-rw-r--r--sysdeps/powerpc/powerpc64/Makefile22
-rw-r--r--sysdeps/powerpc/powerpc64/__longjmp-common.S14
-rw-r--r--sysdeps/powerpc/powerpc64/backtrace.c3
-rw-r--r--sysdeps/powerpc/powerpc64/dl-lookupcfg.h22
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h121
-rw-r--r--sysdeps/powerpc/powerpc64/dl-trampoline.S442
-rw-r--r--sysdeps/powerpc/powerpc64/elf/Makefile14
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/e_sqrt.c29
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c29
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_ceil.S19
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_ceilf.S17
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_ceill.S133
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_copysign.S20
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_copysignl.S51
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fabs.S5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fabsl.S36
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fdim.c5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_floor.S15
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_floorf.S13
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_floorl.S134
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fmax.S5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_fmin.S5
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_isnan.c7
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llrint.S7
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llround.S7
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_llroundf.S6
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S114
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_rint.S19
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_rintf.S17
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_round.S21
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_roundf.S23
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_roundl.S133
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_trunc.S21
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_truncf.S21
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_truncl.S121
-rw-r--r--sysdeps/powerpc/powerpc64/hp-timing.c25
-rw-r--r--sysdeps/powerpc/powerpc64/hp-timing.h136
-rw-r--r--sysdeps/powerpc/powerpc64/memcpy.S3
-rw-r--r--sysdeps/powerpc/powerpc64/memset.S7
-rw-r--r--sysdeps/powerpc/powerpc64/ppc-mcount.S8
-rw-r--r--sysdeps/powerpc/powerpc64/register-dump.h8
-rw-r--r--sysdeps/powerpc/powerpc64/setjmp-common.S29
-rw-r--r--sysdeps/powerpc/powerpc64/strncmp.S17
-rw-r--r--sysdeps/powerpc/powerpc64/sysdep.h14
-rw-r--r--sysdeps/powerpc/soft-fp/Dist28
-rw-r--r--sysdeps/powerpc/soft-fp/q_add.c8
-rw-r--r--sysdeps/powerpc/soft-fp/q_dtoq.c10
-rw-r--r--sysdeps/powerpc/soft-fp/q_itoq.c6
-rw-r--r--sysdeps/powerpc/soft-fp/q_lltoq.c6
-rw-r--r--sysdeps/powerpc/soft-fp/q_qtod.c10
-rw-r--r--sysdeps/powerpc/soft-fp/q_qtoi.c6
-rw-r--r--sysdeps/powerpc/soft-fp/q_qtoll.c6
-rw-r--r--sysdeps/powerpc/soft-fp/q_qtos.c10
-rw-r--r--sysdeps/powerpc/soft-fp/q_qtou.c4
-rw-r--r--sysdeps/powerpc/soft-fp/q_qtoull.c4
-rw-r--r--sysdeps/powerpc/soft-fp/q_stoq.c10
-rw-r--r--sysdeps/powerpc/soft-fp/q_sub.c8
-rw-r--r--sysdeps/powerpc/soft-fp/q_ulltoq.c6
-rw-r--r--sysdeps/powerpc/soft-fp/q_utoq.c6
-rw-r--r--sysdeps/powerpc/sysdep.h18
-rw-r--r--sysdeps/powerpc/tst-stack-align.h47
-rw-r--r--sysdeps/pthread/Versions5
-rw-r--r--sysdeps/pthread/aio_cancel.c4
-rw-r--r--sysdeps/pthread/aio_fsync.c4
-rw-r--r--sysdeps/pthread/aio_misc.c5
-rw-r--r--sysdeps/pthread/aio_misc.h7
-rw-r--r--sysdeps/pthread/aio_notify.c22
-rw-r--r--sysdeps/pthread/aio_read.c4
-rw-r--r--sysdeps/pthread/aio_read64.c4
-rw-r--r--sysdeps/pthread/aio_suspend.c41
-rw-r--r--sysdeps/pthread/aio_write.c4
-rw-r--r--sysdeps/pthread/aio_write64.c4
-rw-r--r--sysdeps/pthread/configure2
-rw-r--r--sysdeps/pthread/lio_listio.c107
-rw-r--r--sysdeps/pthread/lio_listio64.c6
-rw-r--r--sysdeps/rs6000/add_n.s81
-rw-r--r--sysdeps/rs6000/addmul_1.s123
-rw-r--r--sysdeps/rs6000/ffs.c42
-rw-r--r--sysdeps/rs6000/lshift.s59
-rw-r--r--sysdeps/rs6000/memcopy.h86
-rw-r--r--sysdeps/rs6000/mul_1.s110
-rw-r--r--sysdeps/rs6000/rshift.s57
-rw-r--r--sysdeps/rs6000/sub_n.s82
-rw-r--r--sysdeps/rs6000/submul_1.s128
-rw-r--r--sysdeps/s390/Dist3
-rw-r--r--sysdeps/s390/Implies1
-rw-r--r--sysdeps/s390/bits/link.h120
-rw-r--r--sysdeps/s390/bits/linkmap.h13
-rw-r--r--sysdeps/s390/bits/mathdef.h38
-rw-r--r--sysdeps/s390/bits/setjmp.h45
-rw-r--r--sysdeps/s390/bits/string.h14
-rw-r--r--sysdeps/s390/fpu/bits/mathinline.h26
-rw-r--r--sysdeps/s390/fpu/e_sqrtl.c30
-rw-r--r--sysdeps/s390/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/s390/fpu/fesetround.c3
-rw-r--r--sysdeps/s390/fpu/libm-test-ulps474
-rw-r--r--sysdeps/s390/jmpbuf-offsets.h29
-rw-r--r--sysdeps/s390/jmpbuf-unwind.h55
-rw-r--r--sysdeps/s390/ldbl2mpn.c101
-rw-r--r--sysdeps/s390/libc-tls.c4
-rw-r--r--sysdeps/s390/s390-32/Dist1
-rw-r--r--sysdeps/s390/s390-32/__longjmp.c36
-rw-r--r--sysdeps/s390/s390-32/backtrace.c5
-rw-r--r--sysdeps/s390/s390-32/bits/wordsize.h11
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h151
-rw-r--r--sysdeps/s390/s390-32/dl-trampoline.S134
-rw-r--r--sysdeps/s390/s390-32/elf/setjmp.S17
-rw-r--r--sysdeps/s390/s390-32/elf/start.S9
-rw-r--r--sysdeps/s390/s390-32/s390-mcount.S2
-rw-r--r--sysdeps/s390/s390-32/setjmp.S17
-rw-r--r--sysdeps/s390/s390-64/Dist1
-rw-r--r--sysdeps/s390/s390-64/__longjmp.c41
-rw-r--r--sysdeps/s390/s390-64/backtrace.c5
-rw-r--r--sysdeps/s390/s390-64/bcopy.S14
-rw-r--r--sysdeps/s390/s390-64/bits/wordsize.h11
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h137
-rw-r--r--sysdeps/s390/s390-64/dl-trampoline.S128
-rw-r--r--sysdeps/s390/s390-64/elf/setjmp.S17
-rw-r--r--sysdeps/s390/s390-64/elf/start.S6
-rw-r--r--sysdeps/s390/s390-64/s390x-mcount.S2
-rw-r--r--sysdeps/s390/s390-64/setjmp.S19
-rw-r--r--sysdeps/sh/Dist2
-rw-r--r--sysdeps/sh/_mcount.S14
-rw-r--r--sysdeps/sh/bits/link.h75
-rw-r--r--sysdeps/sh/bits/linkmap.h5
-rw-r--r--sysdeps/sh/bits/setjmp.h11
-rw-r--r--sysdeps/sh/dl-machine.h299
-rw-r--r--sysdeps/sh/dl-trampoline.S431
-rw-r--r--sysdeps/sh/elf/configure2
-rw-r--r--sysdeps/sh/jmpbuf-offsets.h20
-rw-r--r--sysdeps/sh/jmpbuf-unwind.h47
-rw-r--r--sysdeps/sh/memset.S1
-rw-r--r--sysdeps/sh/sh3/__longjmp.S23
-rw-r--r--sysdeps/sh/sh3/setjmp.S29
-rw-r--r--sysdeps/sh/sh4/Versions5
-rw-r--r--sysdeps/sh/sh4/__longjmp.S23
-rw-r--r--sysdeps/sh/sh4/bits/mathdef.h (renamed from sysdeps/sh/sh4/fpu/bits/mathdef.h)0
-rw-r--r--sysdeps/sh/sh4/dl-machine.h2
-rw-r--r--sysdeps/sh/sh4/dl-trampoline.S2
-rw-r--r--sysdeps/sh/sh4/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/sh/sh4/fpu/fesetround.c3
-rw-r--r--sysdeps/sh/sh4/fpu/libm-test-ulps4
-rw-r--r--sysdeps/sh/sh4/setjmp.S29
-rw-r--r--sysdeps/sh/sysdep.h11
-rw-r--r--sysdeps/sparc/Dist1
-rw-r--r--sysdeps/sparc/Makefile3
-rw-r--r--sysdeps/sparc/bits/link.h100
-rw-r--r--sysdeps/sparc/bits/mathdef.h58
-rw-r--r--sysdeps/sparc/dl-procinfo.c62
-rw-r--r--sysdeps/sparc/dl-procinfo.h79
-rw-r--r--sysdeps/sparc/dl-sysdep.h21
-rw-r--r--sysdeps/sparc/fpu/bits/mathdef.h68
-rw-r--r--sysdeps/sparc/fpu/bits/mathinline.h81
-rw-r--r--sysdeps/sparc/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/sparc/fpu/fesetround.c3
-rw-r--r--sysdeps/sparc/fpu/fraiseexcpt.c34
-rw-r--r--sysdeps/sparc/sparc32/Dist9
-rw-r--r--sysdeps/sparc/sparc32/Implies3
-rw-r--r--sysdeps/sparc/sparc32/__longjmp.S24
-rw-r--r--sysdeps/sparc/sparc32/bits/atomic.h260
-rw-r--r--sysdeps/sparc/sparc32/bits/setjmp.h13
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h343
-rw-r--r--sysdeps/sparc/sparc32/dl-trampoline.S184
-rw-r--r--sysdeps/sparc/sparc32/elf/start.S10
-rw-r--r--sysdeps/sparc/sparc32/fpu/e_sqrtl.c1
-rw-r--r--sysdeps/sparc/sparc32/fpu/libm-test-ulps433
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabs.c11
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabsf.S29
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabsl.c8
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-offsets.h22
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-unwind.h48
-rw-r--r--sysdeps/sparc/sparc32/memchr.S21
-rw-r--r--sysdeps/sparc/sparc32/memcpy.S40
-rw-r--r--sysdeps/sparc/sparc32/memset.S2
-rw-r--r--sysdeps/sparc/sparc32/setjmp.S16
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Dist28
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Makefile20
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Versions8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_add.c8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_div.c4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_dtoq.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_itoq.c6
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_lltoq.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtod.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoi.c6
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoll.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtos.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtou.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoui.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoull.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoux.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtox.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_sqrt.c3
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_stoq.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_sub.c8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_uitoq.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_utoq.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_xtoq.c38
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/sfp-machine.h14
-rw-r--r--sysdeps/sparc/sparc32/sparcv8/Dist6
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/Dist7
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/bits/atomic.h12
-rw-r--r--sysdeps/sparc/sparc32/sparcv9b/Implies1
-rw-r--r--sysdeps/sparc/sparc32/sparcv9v/memcpy.S2
-rw-r--r--sysdeps/sparc/sparc32/sparcv9v/memset.S2
-rw-r--r--sysdeps/sparc/sparc32/stpcpy.S16
-rw-r--r--sysdeps/sparc/sparc32/strcat.S78
-rw-r--r--sysdeps/sparc/sparc32/strchr.S37
-rw-r--r--sysdeps/sparc/sparc32/strcmp.S14
-rw-r--r--sysdeps/sparc/sparc32/strcpy.S16
-rw-r--r--sysdeps/sparc/sparc32/strlen.S28
-rw-r--r--sysdeps/sparc/sparc64/Dist1
-rw-r--r--sysdeps/sparc/sparc64/Makefile3
-rw-r--r--sysdeps/sparc/sparc64/Versions7
-rw-r--r--sysdeps/sparc/sparc64/bits/atomic.h14
-rw-r--r--sysdeps/sparc/sparc64/dl-machine.h683
-rw-r--r--sysdeps/sparc/sparc64/dl-trampoline.S327
-rw-r--r--sysdeps/sparc/sparc64/elf/start.S10
-rw-r--r--sysdeps/sparc/sparc64/fpu/libm-test-ulps13
-rw-r--r--sysdeps/sparc/sparc64/jmpbuf-unwind.h37
-rw-r--r--sysdeps/sparc/sparc64/memcmp.S2
-rw-r--r--sysdeps/sparc/sparc64/memcpy.S8
-rw-r--r--sysdeps/sparc/sparc64/memset.S2
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/Dist32
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_add.c8
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c10
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_itoq.c6
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_qtod.c10
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c6
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_qtos.c10
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c4
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c4
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_qtox.c6
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_stoq.c10
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_sub.c8
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c6
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c6
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c6
-rw-r--r--sysdeps/sparc/sparc64/soft-fp/sfp-machine.h3
-rw-r--r--sysdeps/sparc/sparc64/sparcv9b/memcpy.S10
-rw-r--r--sysdeps/sparc/sparc64/sparcv9v/memcpy.S593
-rw-r--r--sysdeps/sparc/sparc64/sparcv9v/memset.S127
-rw-r--r--sysdeps/unix/Dist14
-rw-r--r--sysdeps/unix/Makefile35
-rw-r--r--sysdeps/unix/alarm.c7
-rw-r--r--sysdeps/unix/alpha/sysdep.h103
-rw-r--r--sysdeps/unix/arm/Dist1
-rw-r--r--sysdeps/unix/arm/brk.S56
-rw-r--r--sysdeps/unix/arm/dl-brk.S1
-rw-r--r--sysdeps/unix/arm/fork.S34
-rw-r--r--sysdeps/unix/arm/start.c97
-rw-r--r--sysdeps/unix/arm/sysdep.S71
-rw-r--r--sysdeps/unix/arm/sysdep.h30
-rw-r--r--sysdeps/unix/bsd/Dist5
-rw-r--r--sysdeps/unix/bsd/bsd4.4/Dist1
-rw-r--r--sysdeps/unix/bsd/init-posix.c4
-rw-r--r--sysdeps/unix/bsd/m68k/pipe.S33
-rw-r--r--sysdeps/unix/bsd/m68k/start.c3
-rw-r--r--sysdeps/unix/bsd/m68k/syscall.S26
-rw-r--r--sysdeps/unix/bsd/m68k/sysdep.S44
-rw-r--r--sysdeps/unix/bsd/m68k/wait.S35
-rw-r--r--sysdeps/unix/bsd/sun/Dist1
-rw-r--r--sysdeps/unix/bsd/sun/bits/signum.h69
-rw-r--r--sysdeps/unix/bsd/sun/m68k/Dist1
-rw-r--r--sysdeps/unix/bsd/sun/m68k/Makefile3
-rw-r--r--sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h30
-rw-r--r--sysdeps/unix/bsd/sun/m68k/brk.S49
-rw-r--r--sysdeps/unix/bsd/sun/m68k/dl-brk.S1
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sethostid.S44
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sigtramp.c145
-rw-r--r--sysdeps/unix/bsd/sun/m68k/syscall.S28
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sysdep.h62
-rw-r--r--sysdeps/unix/bsd/sun/m68k/vfork.S56
-rw-r--r--sysdeps/unix/bsd/sun/sethostid.c1
-rw-r--r--sysdeps/unix/bsd/sun/sigreturn.S28
-rw-r--r--sysdeps/unix/bsd/sun/sparc/Dist1
-rw-r--r--sysdeps/unix/bsd/sun/sparc/Makefile7
-rw-r--r--sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h34
-rw-r--r--sysdeps/unix/bsd/sun/sparc/sethostid.S46
-rw-r--r--sysdeps/unix/bsd/sun/sparc/sigtramp.c247
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/.cvsignore4
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/Implies2
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/Makefile7
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h142
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/mman.h68
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/resource.h174
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/termios.h212
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/bits/utsname.h24
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/mmap.c42
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/speed.c118
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h100
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/syscalls.list6
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/system.c2
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcflow.c30
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcflush.c30
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcgetattr.c33
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c32
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/tcsetattr.c50
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/wait.c1
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/wait3.c1
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/wait4.c50
-rw-r--r--sysdeps/unix/bsd/sun/sunos4/waitpid.c1
-rw-r--r--sysdeps/unix/bsd/sun/syscalls.list3
-rw-r--r--sysdeps/unix/bsd/ulimit.c5
-rw-r--r--sysdeps/unix/clock_gettime.c123
-rw-r--r--sysdeps/unix/clock_settime.c92
-rw-r--r--sysdeps/unix/common/Dist1
-rw-r--r--sysdeps/unix/common/Makefile35
-rwxr-xr-xsysdeps/unix/common/configure195
-rw-r--r--sysdeps/unix/common/configure.in21
-rw-r--r--sysdeps/unix/common/glue-ctype.c91
-rwxr-xr-xsysdeps/unix/configure109
-rw-r--r--sysdeps/unix/configure.in7
-rw-r--r--sysdeps/unix/fdopendir.c52
-rw-r--r--sysdeps/unix/get_child_max.c37
-rw-r--r--sysdeps/unix/i386/brk.S6
-rw-r--r--sysdeps/unix/i386/sysdep.S12
-rw-r--r--sysdeps/unix/make_errlist.c82
-rw-r--r--sysdeps/unix/mips/brk.S48
-rw-r--r--sysdeps/unix/mips/dl-brk.S1
-rw-r--r--sysdeps/unix/mips/fork.S32
-rw-r--r--sysdeps/unix/mips/mips32/sysdep.h52
-rw-r--r--sysdeps/unix/mips/mips64/n32/sysdep.h57
-rw-r--r--sysdeps/unix/mips/mips64/n64/sysdep.h57
-rw-r--r--sysdeps/unix/mips/pipe.S33
-rw-r--r--sysdeps/unix/mips/rt-sysdep.S1
-rw-r--r--sysdeps/unix/mips/sigreturn.S31
-rw-r--r--sysdeps/unix/mips/sysdep.S100
-rw-r--r--sysdeps/unix/mips/sysdep.h79
-rw-r--r--sysdeps/unix/mips/wait.S47
-rw-r--r--sysdeps/unix/mkfifoat.c32
-rw-r--r--sysdeps/unix/nice.c22
-rw-r--r--sysdeps/unix/opendir.c40
-rw-r--r--sysdeps/unix/rewinddir.c3
-rw-r--r--sysdeps/unix/sh/sysdep.S14
-rw-r--r--sysdeps/unix/sockatmark.c6
-rw-r--r--sysdeps/unix/sparc/brk.S6
-rw-r--r--sysdeps/unix/sysv/Dist2
-rw-r--r--sysdeps/unix/sysv/i386/signal.S31
-rw-r--r--sysdeps/unix/sysv/i386/sigreturn.S27
-rw-r--r--sysdeps/unix/sysv/linux/Dist85
-rw-r--r--sysdeps/unix/sysv/linux/Makefile16
-rw-r--r--sysdeps/unix/sysv/linux/Versions11
-rw-r--r--sysdeps/unix/sysv/linux/aio_sigqueue.c7
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Dist19
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Makefile10
-rw-r--r--sysdeps/unix/sysv/linux/alpha/Versions4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/adjtime.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/errno.h8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/fcntl.h55
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/termios.h85
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/wordsize.h30
-rw-r--r--sysdeps/unix/sysv/linux/alpha/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/dl-sysdep.c9
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fxstatat.c99
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getcontext.S6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getitimer.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/getrusage.S6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/gettimeofday.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/glob.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/msgctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/alpha/oldglob.c3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/select.S6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/semctl.c5
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/setitimer.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/settimeofday.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/shmctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sigaction.c2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sigsuspend.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscall.S2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/alpha/utimes.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/wait4.S4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/wordexp.c4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/xstatconv.h4
-rw-r--r--sysdeps/unix/sysv/linux/arm/Dist14
-rw-r--r--sysdeps/unix/sysv/linux/arm/Makefile12
-rw-r--r--sysdeps/unix/sysv/linux/arm/Versions37
-rw-r--r--sysdeps/unix/sysv/linux/arm/alphasort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/bits/armsigctx.h73
-rw-r--r--sysdeps/unix/sysv/linux/arm/bits/fcntl.h189
-rw-r--r--sysdeps/unix/sysv/linux/arm/bits/mman.h99
-rw-r--r--sysdeps/unix/sysv/linux/arm/brk.c49
-rw-r--r--sysdeps/unix/sysv/linux/arm/chown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/clone.S60
-rw-r--r--sysdeps/unix/sysv/linux/arm/dl-procinfo.c64
-rw-r--r--sysdeps/unix/sysv/linux/arm/dl-procinfo.h86
-rw-r--r--sysdeps/unix/sysv/linux/arm/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/arm/getresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/ioperm.c274
-rw-r--r--sysdeps/unix/sysv/linux/arm/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap.S92
-rw-r--r--sysdeps/unix/sysv/linux/arm/mmap64.S80
-rw-r--r--sysdeps/unix/sysv/linux/arm/msgctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/profil-counter.h37
-rw-r--r--sysdeps/unix/sysv/linux/arm/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/register-dump.h166
-rw-r--r--sysdeps/unix/sysv/linux/arm/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/semctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/arm/setregid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setreuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/shmctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/sigaction.c165
-rw-r--r--sysdeps/unix/sysv/linux/arm/sigcontextinfo.h51
-rw-r--r--sysdeps/unix/sysv/linux/arm/sigrestorer.S33
-rw-r--r--sysdeps/unix/sysv/linux/arm/socket.S123
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/elf.h26
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/io.h48
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/procfs.h123
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/ucontext.h94
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/user.h72
-rw-r--r--sysdeps/unix/sysv/linux/arm/syscalls.list5
-rw-r--r--sysdeps/unix/sysv/linux/arm/sysdep.S34
-rw-r--r--sysdeps/unix/sysv/linux/arm/sysdep.h236
-rw-r--r--sysdeps/unix/sysv/linux/arm/versionsort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/arm/vfork.S59
-rw-r--r--sysdeps/unix/sysv/linux/arm/xstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/bits/errno.h11
-rw-r--r--sysdeps/unix/sysv/linux/bits/in.h27
-rw-r--r--sysdeps/unix/sysv/linux/bits/poll.h6
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/bits/sched.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/termios.h3
-rw-r--r--sysdeps/unix/sysv/linux/bits/uio.h10
-rw-r--r--sysdeps/unix/sysv/linux/bits/waitflags.h4
-rw-r--r--sysdeps/unix/sysv/linux/check_pf.c143
-rw-r--r--sysdeps/unix/sysv/linux/clock_getcpuclockid.c103
-rw-r--r--sysdeps/unix/sysv/linux/clock_getres.c185
-rw-r--r--sysdeps/unix/sysv/linux/clock_gettime.c185
-rw-r--r--sysdeps/unix/sysv/linux/clock_nanosleep.c23
-rw-r--r--sysdeps/unix/sysv/linux/clock_settime.c77
-rw-r--r--sysdeps/unix/sysv/linux/configure48
-rw-r--r--sysdeps/unix/sysv/linux/configure.in48
-rw-r--r--sysdeps/unix/sysv/linux/device-nrs.h6
-rw-r--r--sysdeps/unix/sysv/linux/dl-execstack.c28
-rw-r--r--sysdeps/unix/sysv/linux/dl-osinfo.h226
-rw-r--r--sysdeps/unix/sysv/linux/dl-sbrk.c2
-rw-r--r--sysdeps/unix/sysv/linux/dl-sysdep.c6
-rw-r--r--sysdeps/unix/sysv/linux/dl-sysdep.h27
-rw-r--r--sysdeps/unix/sysv/linux/faccessat.c143
-rw-r--r--sysdeps/unix/sysv/linux/fchmodat.c106
-rw-r--r--sysdeps/unix/sysv/linux/fchownat.c99
-rw-r--r--sysdeps/unix/sysv/linux/fstatvfs64.c5
-rw-r--r--sysdeps/unix/sysv/linux/ftruncate64.c7
-rw-r--r--sysdeps/unix/sysv/linux/futimes.c69
-rw-r--r--sysdeps/unix/sysv/linux/futimesat.c119
-rw-r--r--sysdeps/unix/sysv/linux/fxstat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat.c141
-rw-r--r--sysdeps/unix/sysv/linux/fxstatat64.c167
-rw-r--r--sysdeps/unix/sysv/linux/gai_sigqueue.c4
-rw-r--r--sysdeps/unix/sysv/linux/getcwd.c7
-rw-r--r--sysdeps/unix/sysv/linux/getdents.c8
-rw-r--r--sysdeps/unix/sysv/linux/gethostid.c6
-rw-r--r--sysdeps/unix/sysv/linux/getloadavg.c4
-rw-r--r--sysdeps/unix/sysv/linux/getsourcefilter.c28
-rw-r--r--sysdeps/unix/sysv/linux/getsysstats.c184
-rw-r--r--sysdeps/unix/sysv/linux/hppa/Dist5
-rw-r--r--sysdeps/unix/sysv/linux/hppa/Makefile2
-rw-r--r--sysdeps/unix/sysv/linux/hppa/Versions25
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/errno.h51
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/fcntl.h181
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/ioctls.h37
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/ipc.h63
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/mman.h83
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/msq.h84
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/sem.h92
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/shm.h106
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/sigaction.h75
-rw-r--r--sysdeps/unix/sysv/linux/hppa/bits/signum.h82
-rw-r--r--sysdeps/unix/sysv/linux/hppa/brk.c42
-rw-r--r--sysdeps/unix/sysv/linux/hppa/clone.S99
-rw-r--r--sysdeps/unix/sysv/linux/hppa/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h18
-rw-r--r--sysdeps/unix/sysv/linux/hppa/kernel_stat.h31
-rw-r--r--sysdeps/unix/sysv/linux/hppa/mmap.c50
-rw-r--r--sysdeps/unix/sysv/linux/hppa/profil-counter.h25
-rw-r--r--sysdeps/unix/sysv/linux/hppa/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sys/procfs.h113
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sys/ucontext.h67
-rw-r--r--sysdeps/unix/sysv/linux/hppa/syscall.S19
-rw-r--r--sysdeps/unix/sysv/linux/hppa/syscalls.list37
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sysdep.c64
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sysdep.h419
-rw-r--r--sysdeps/unix/sysv/linux/hppa/umount.c31
-rw-r--r--sysdeps/unix/sysv/linux/i386/Dist17
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile6
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/i386/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/i386/call_pselect6.S65
-rw-r--r--sysdeps/unix/sysv/linux/i386/chown.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/clone.S16
-rw-r--r--sysdeps/unix/sysv/linux/i386/dl-cache.h59
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchown.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/fchownat.c110
-rw-r--r--sysdeps/unix/sysv/linux/i386/fcntl.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstat.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/fxstatat.c176
-rw-r--r--sysdeps/unix/sysv/linux/i386/getcontext.S8
-rw-r--r--sysdeps/unix/sysv/linux/i386/getegid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/geteuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getgid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getmsg.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getresgid.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/getresuid.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/getrlimit.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getrlimit64.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/getuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/glob64.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/lchown.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/lockf64.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/lxstat.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/makecontext.S8
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap.S25
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap64.S38
-rw-r--r--sysdeps/unix/sysv/linux/i386/msgctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/posix_fadvise64.S33
-rw-r--r--sysdeps/unix/sysv/linux/i386/pselect.c18
-rw-r--r--sysdeps/unix/sysv/linux/i386/putmsg.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/semctl.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/semtimedop.S14
-rw-r--r--sysdeps/unix/sysv/linux/i386/setcontext.S19
-rw-r--r--sysdeps/unix/sysv/linux/i386/setegid.c5
-rw-r--r--sysdeps/unix/sysv/linux/i386/seteuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsgid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setfsuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setgroups.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setregid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresgid.c7
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresuid.c7
-rw-r--r--sysdeps/unix/sysv/linux/i386/setreuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setrlimit.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/shmctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/i386/socket.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/i386/sync_file_range.S72
-rw-r--r--sysdeps/unix/sysv/linux/i386/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysconf.c61
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h112
-rw-r--r--sysdeps/unix/sysv/linux/i386/ucontext_i.h41
-rw-r--r--sysdeps/unix/sysv/linux/i386/ucontext_i.sym30
-rw-r--r--sysdeps/unix/sysv/linux/i386/vfork.S4
-rw-r--r--sysdeps/unix/sysv/linux/i386/xstat.c5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/Dist13
-rw-r--r--sysdeps/unix/sysv/linux/ia64/__longjmp.S5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/setjmp.h7
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/shm.h7
-rw-r--r--sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c23
-rw-r--r--sysdeps/unix/sysv/linux/ia64/clone2.S6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-cache.h27
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-procinfo.c5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/dl-procinfo.h5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/has_cpuclock.c12
-rw-r--r--sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/setjmp.S20
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sigsuspend.c49
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sys/ptrace.h28
-rw-r--r--sysdeps/unix/sysv/linux/ia64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sysdep.h25
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c12
-rw-r--r--sysdeps/unix/sysv/linux/ifaddrs.c138
-rw-r--r--sysdeps/unix/sysv/linux/ifreq.c3
-rw-r--r--sysdeps/unix/sysv/linux/ifreq.h41
-rw-r--r--sysdeps/unix/sysv/linux/init-first.c39
-rw-r--r--sysdeps/unix/sysv/linux/internal_statvfs.c29
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h163
-rw-r--r--sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h18
-rw-r--r--sysdeps/unix/sysv/linux/lddlibc4.c4
-rw-r--r--sysdeps/unix/sysv/linux/ldsodefs.h4
-rw-r--r--sysdeps/unix/sysv/linux/libc_fatal.c32
-rw-r--r--sysdeps/unix/sysv/linux/linkat.c115
-rw-r--r--sysdeps/unix/sysv/linux/linux_fsinfo.h5
-rw-r--r--sysdeps/unix/sysv/linux/local-setxid.h23
-rw-r--r--sysdeps/unix/sysv/linux/lxstat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Dist9
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Makefile17
-rw-r--r--sysdeps/unix/sysv/linux/m68k/Versions32
-rw-r--r--sysdeps/unix/sysv/linux/m68k/alphasort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/a.out.h3
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/fcntl.h188
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/mman.h99
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/poll.h43
-rw-r--r--sysdeps/unix/sysv/linux/m68k/bits/stat.h164
-rw-r--r--sysdeps/unix/sysv/linux/m68k/brk.c48
-rw-r--r--sysdeps/unix/sysv/linux/m68k/chown.c69
-rw-r--r--sysdeps/unix/sysv/linux/m68k/clone.S66
-rw-r--r--sysdeps/unix/sysv/linux/m68k/dl-librecon.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/geteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getpagesize.c50
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getsysstats.c37
-rw-r--r--sysdeps/unix/sysv/linux/m68k/getuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lchown.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/ldconfig.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/mmap.S43
-rw-r--r--sysdeps/unix/sysv/linux/m68k/mremap.S29
-rw-r--r--sysdeps/unix/sysv/linux/m68k/msgctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/putmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/register-dump.h214
-rw-r--r--sysdeps/unix/sysv/linux/m68k/scandir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/semctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/semtimedop.S60
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setegid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/seteuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setfsgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setfsuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setgroups.c2
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setregid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setresgid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setresuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setreuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setrlimit.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/shmctl.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h26
-rw-r--r--sysdeps/unix/sysv/linux/m68k/socket.S111
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/procfs.h126
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/reg.h89
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/ucontext.h109
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscall.S33
-rw-r--r--sysdeps/unix/sysv/linux/m68k/syscalls.list5
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sysdep.S49
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sysdep.h295
-rw-r--r--sysdeps/unix/sysv/linux/m68k/versionsort64.c1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/vfork.S76
-rw-r--r--sysdeps/unix/sysv/linux/m68k/xstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/Dist13
-rw-r--r--sysdeps/unix/sysv/linux/mips/Makefile56
-rw-r--r--sysdeps/unix/sysv/linux/mips/Versions31
-rw-r--r--sysdeps/unix/sysv/linux/mips/_test_and_set.c30
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/endian.h16
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/errno.h48
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/fcntl.h194
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h76
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/ipc.h55
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/mman.h92
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/msq.h74
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/poll.h48
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/resource.h214
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sem.h85
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/shm.h94
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigaction.h89
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigcontext.h105
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/siginfo.h309
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/signum.h79
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/sigstack.h55
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/socket.h316
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/stat.h209
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/statfs.h72
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/termios.h218
-rw-r--r--sysdeps/unix/sysv/linux/mips/brk.c56
-rw-r--r--sysdeps/unix/sysv/linux/mips/clone.S114
-rwxr-xr-xsysdeps/unix/sysv/linux/mips/configure76
-rw-r--r--sysdeps/unix/sysv/linux/mips/configure.in76
-rw-r--r--sysdeps/unix/sysv/linux/mips/dl-cache.h43
-rw-r--r--sysdeps/unix/sysv/linux/mips/entry.h5
-rw-r--r--sysdeps/unix/sysv/linux/mips/fcntl.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/ftruncate64.c76
-rw-r--r--sysdeps/unix/sysv/linux/mips/getmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/getsysstats.c36
-rw-r--r--sysdeps/unix/sysv/linux/mips/ipc_priv.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_sigaction.h40
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_stat.h57
-rw-r--r--sysdeps/unix/sysv/linux/mips/kernel_termios.h35
-rw-r--r--sysdeps/unix/sysv/linux/mips/lockf64.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h36
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/sysdep.h283
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/Dist1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h26
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/llseek.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c28
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h242
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c30
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S42
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h242
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/recv.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/send.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/syscall.S53
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/syscalls.list21
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/umount.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/pipe.S1
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread.c109
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread64.c107
-rw-r--r--sysdeps/unix/sysv/linux/mips/profil-counter.h2
-rw-r--r--sysdeps/unix/sysv/linux/mips/ptrace.c111
-rw-r--r--sysdeps/unix/sysv/linux/mips/putmsg.c1
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite.c109
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite64.c108
-rw-r--r--sysdeps/unix/sysv/linux/mips/readelflib.c71
-rw-r--r--sysdeps/unix/sysv/linux/mips/register-dump.h108
-rw-r--r--sysdeps/unix/sysv/linux/mips/sigaction.c188
-rw-r--r--sysdeps/unix/sysv/linux/mips/sigcontextinfo.h43
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/cachectl.h42
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/procfs.h128
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/ptrace.h136
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/syscall.h42
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/sysmips.h43
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/tas.h67
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/ucontext.h109
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/user.h219
-rw-r--r--sysdeps/unix/sysv/linux/mips/syscalls.list31
-rw-r--r--sysdeps/unix/sysv/linux/mips/truncate64.c76
-rw-r--r--sysdeps/unix/sysv/linux/mips/ustat.c37
-rw-r--r--sysdeps/unix/sysv/linux/mips/xmknod.c51
-rw-r--r--sysdeps/unix/sysv/linux/mips/xstatconv.c133
-rw-r--r--sysdeps/unix/sysv/linux/mkdirat.c86
-rw-r--r--sysdeps/unix/sysv/linux/mmap64.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_close.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_getattr.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_notify.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_open.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_receive.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_send.c4
-rw-r--r--sysdeps/unix/sysv/linux/mq_unlink.c4
-rw-r--r--sysdeps/unix/sysv/linux/msgctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c8
-rw-r--r--sysdeps/unix/sysv/linux/net/if_arp.h10
-rw-r--r--sysdeps/unix/sysv/linux/netinet/if_tr.h78
-rw-r--r--sysdeps/unix/sysv/linux/netlinkaccess.h7
-rw-r--r--sysdeps/unix/sysv/linux/not-cancel.h47
-rw-r--r--sysdeps/unix/sysv/linux/nscd_setup_thread.c22
-rw-r--r--sysdeps/unix/sysv/linux/openat.c175
-rw-r--r--sysdeps/unix/sysv/linux/openat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/opendir.c4
-rw-r--r--sysdeps/unix/sysv/linux/paths.h2
-rw-r--r--sysdeps/unix/sysv/linux/poll.c5
-rw-r--r--sysdeps/unix/sysv/linux/posix_madvise.c38
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Dist8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Implies4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Makefile8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Versions7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/aix/Dist7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h36
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/shm.h5
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/termios.h84
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h19
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/chown.c140
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure135
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/configure.in37
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-vdso.c59
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/dl-vdso.h27
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/fchownat.c110
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c117
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (renamed from sysdeps/generic/gettimeofday.c)17
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/libc-start.c130
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S24
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S17
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c12
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S286
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S369
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S293
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S396
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S517
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S695
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h138
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c15
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h43
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S7
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S17
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S16
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h77
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S14
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S25
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h150
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h60
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym50
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/procfs.h21
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h4
-rw-r--r--sysdeps/unix/sysv/linux/ppoll.c76
-rw-r--r--sysdeps/unix/sysv/linux/pread.c4
-rw-r--r--sysdeps/unix/sysv/linux/pread64.c5
-rw-r--r--sysdeps/unix/sysv/linux/prof-freq.c4
-rw-r--r--sysdeps/unix/sysv/linux/pselect.c100
-rw-r--r--sysdeps/unix/sysv/linux/ptrace.c16
-rw-r--r--sysdeps/unix/sysv/linux/pwrite.c4
-rw-r--r--sysdeps/unix/sysv/linux/pwrite64.c5
-rw-r--r--sysdeps/unix/sysv/linux/readdir64.c2
-rw-r--r--sysdeps/unix/sysv/linux/readdir64_r.c2
-rw-r--r--sysdeps/unix/sysv/linux/readlinkat.c90
-rw-r--r--sysdeps/unix/sysv/linux/readonly-area.c17
-rw-r--r--sysdeps/unix/sysv/linux/renameat.c184
-rw-r--r--sysdeps/unix/sysv/linux/s390/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/s390/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/s390/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/fcntl.h53
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/s390/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/s390/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/s390/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/Dist7
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/chown.c4
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/lchown.c4
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c20
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/syscall.S9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h47
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h35
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/Dist2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c19
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c47
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/socket.S1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscall.S9
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h44
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h36
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/ptrace.h20
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/user.h63
-rw-r--r--sysdeps/unix/sysv/linux/s390/ucontext_i.sym23
-rw-r--r--sysdeps/unix/sysv/linux/sched_getaffinity.c9
-rw-r--r--sysdeps/unix/sysv/linux/sched_setaffinity.c4
-rw-r--r--sysdeps/unix/sysv/linux/segfault.c2
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/setegid.c4
-rw-r--r--sysdeps/unix/sysv/linux/seteuid.c4
-rw-r--r--sysdeps/unix/sysv/linux/setsourcefilter.c9
-rw-r--r--sysdeps/unix/sysv/linux/sh/Dist8
-rw-r--r--sysdeps/unix/sysv/linux/sh/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/fcntl.h106
-rw-r--r--sysdeps/unix/sysv/linux/sh/bits/mman.h8
-rw-r--r--sysdeps/unix/sysv/linux/sh/chown.c70
-rw-r--r--sysdeps/unix/sysv/linux/sh/fchownat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sh/makecontext.S145
-rw-r--r--sysdeps/unix/sysv/linux/sh/pread.c96
-rw-r--r--sysdeps/unix/sysv/linux/sh/pread64.c97
-rw-r--r--sysdeps/unix/sysv/linux/sh/pwrite.c96
-rw-r--r--sysdeps/unix/sysv/linux/sh/pwrite64.c99
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/getcontext.S88
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/setcontext.S99
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S132
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/sys/ucontext.h102
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym38
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/getcontext.S131
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/setcontext.S139
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S214
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/sys/ucontext.h115
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym73
-rw-r--r--sysdeps/unix/sysv/linux/sh/socket.S10
-rw-r--r--sysdeps/unix/sysv/linux/sh/sys/ucontext.h109
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.S4
-rw-r--r--sysdeps/unix/sysv/linux/sh/sysdep.h35
-rw-r--r--sysdeps/unix/sysv/linux/shm_open.c9
-rw-r--r--sysdeps/unix/sysv/linux/shmctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/sigaction.c8
-rw-r--r--sysdeps/unix/sysv/linux/sigpending.c5
-rw-r--r--sysdeps/unix/sysv/linux/sigprocmask.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigqueue.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigreturn.c2
-rw-r--r--sysdeps/unix/sysv/linux/sigstack.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigsuspend.c35
-rw-r--r--sysdeps/unix/sysv/linux/sigtimedwait.c4
-rw-r--r--sysdeps/unix/sysv/linux/sigwait.c15
-rw-r--r--sysdeps/unix/sysv/linux/sigwaitinfo.c4
-rw-r--r--sysdeps/unix/sysv/linux/sleep.c3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Versions7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/errno.h8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/fcntl.h52
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/mman.h11
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/poll.h9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/resource.h15
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/setjmp.h19
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/stat.h41
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/termios.h88
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/wordsize.h20
-rw-r--r--sysdeps/unix/sysv/linux/sparc/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/rt-sysdep.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Implies3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/Makefile12
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/chown.c2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/clone.S46
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c64
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h75
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S26
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/socket.S39
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h177
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/Dist7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/brk.S8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/clone.S75
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c64
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h76
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h46
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/pause.c8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/socket.S39
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S17
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h157
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c9
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/xstatconv.c127
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/ptrace.h24
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.S1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.c1
-rw-r--r--sysdeps/unix/sysv/linux/statvfs64.c4
-rw-r--r--sysdeps/unix/sysv/linux/symlinkat.c87
-rw-r--r--sysdeps/unix/sysv/linux/sync_file_range.c47
-rw-r--r--sysdeps/unix/sysv/linux/sys/epoll.h9
-rw-r--r--sysdeps/unix/sysv/linux/sys/inotify.h92
-rw-r--r--sysdeps/unix/sysv/linux/sys/kd.h10
-rw-r--r--sysdeps/unix/sysv/linux/sys/ptrace.h20
-rw-r--r--sysdeps/unix/sysv/linux/sys/quota.h91
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list17
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c24
-rw-r--r--sysdeps/unix/sysv/linux/sysctl.c3
-rw-r--r--sysdeps/unix/sysv/linux/syslog.c10
-rw-r--r--sysdeps/unix/sysv/linux/system.c3
-rw-r--r--sysdeps/unix/sysv/linux/tcflow.c32
-rw-r--r--sysdeps/unix/sysv/linux/tcflush.c32
-rw-r--r--sysdeps/unix/sysv/linux/tcgetattr.c47
-rw-r--r--sysdeps/unix/sysv/linux/tcsetattr.c32
-rw-r--r--sysdeps/unix/sysv/linux/testrtsig.h4
-rw-r--r--sysdeps/unix/sysv/linux/time.c43
-rw-r--r--sysdeps/unix/sysv/linux/truncate64.c7
-rw-r--r--sysdeps/unix/sysv/linux/tst-clone.c56
-rw-r--r--sysdeps/unix/sysv/linux/ttyname.c29
-rw-r--r--sysdeps/unix/sysv/linux/ttyname_r.c32
-rw-r--r--sysdeps/unix/sysv/linux/unlinkat.c97
-rw-r--r--sysdeps/unix/sysv/linux/updwtmp.c4
-rw-r--r--sysdeps/unix/sysv/linux/utimes.c4
-rw-r--r--sysdeps/unix/sysv/linux/utmp_file.c4
-rw-r--r--sysdeps/unix/sysv/linux/vfork.c2
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c109
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c1
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/getdents.c2
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Dist11
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h54
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/mman.h6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/shm.h1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/brk.c43
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/clone.S8
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/getcontext.S18
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/makecontext.c22
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/readelflib.c6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/setcontext.S14
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigaction.c6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigsuspend.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/swapcontext.S12
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sys/epoll.h9
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysconf.c54
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h39
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ucontext_i.h47
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym34
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/umount.c32
-rw-r--r--sysdeps/unix/sysv/linux/xmknodat.c95
-rw-r--r--sysdeps/unix/sysv/linux/xstat64.c4
-rw-r--r--sysdeps/unix/sysv/linux/xstatconv.h5
-rw-r--r--sysdeps/unix/sysv/tcflow.c4
-rw-r--r--sysdeps/unix/x86_64/sysdep.S4
-rw-r--r--sysdeps/wordsize-32/Dist1
-rw-r--r--sysdeps/wordsize-32/Makefile1
-rw-r--r--sysdeps/wordsize-32/divdi3.c6
-rw-r--r--sysdeps/wordsize-32/llabs.c4
-rw-r--r--sysdeps/wordsize-32/lldiv.c4
-rw-r--r--sysdeps/wordsize-32/symbol-hacks.h2
-rw-r--r--sysdeps/wordsize-64/glob.c2
-rw-r--r--sysdeps/wordsize-64/labs.c4
-rw-r--r--sysdeps/wordsize-64/ldiv.c4
-rw-r--r--sysdeps/wordsize-64/strtol.c2
-rw-r--r--sysdeps/wordsize-64/strtol_l.c2
-rw-r--r--sysdeps/wordsize-64/strtoul.c2
-rw-r--r--sysdeps/wordsize-64/strtoul_l.c2
-rw-r--r--sysdeps/wordsize-64/wcstol.c2
-rw-r--r--sysdeps/wordsize-64/wcstol_l.c2
-rw-r--r--sysdeps/wordsize-64/wcstoul.c2
-rw-r--r--sysdeps/wordsize-64/wcstoul_l.c2
-rw-r--r--sysdeps/x86_64/Dist4
-rw-r--r--sysdeps/x86_64/Versions7
-rw-r--r--sysdeps/x86_64/__longjmp.S27
-rw-r--r--sysdeps/x86_64/_mcount.S2
-rw-r--r--sysdeps/x86_64/bits/byteswap.h7
-rw-r--r--sysdeps/x86_64/bits/link.h125
-rw-r--r--sysdeps/x86_64/bits/linkmap.h14
-rw-r--r--sysdeps/x86_64/bits/mathdef.h (renamed from sysdeps/x86_64/fpu/bits/mathdef.h)0
-rw-r--r--sysdeps/x86_64/bits/setjmp.h41
-rw-r--r--sysdeps/x86_64/bsd-_setjmp.S5
-rw-r--r--sysdeps/x86_64/bsd-setjmp.S6
-rw-r--r--sysdeps/x86_64/dl-machine.h176
-rw-r--r--sysdeps/x86_64/dl-trampoline.S189
-rw-r--r--sysdeps/x86_64/elf/start.S4
-rw-r--r--sysdeps/x86_64/fpu/e_log10l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_log2l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_logl.S12
-rw-r--r--sysdeps/x86_64/fpu/e_powl.S19
-rw-r--r--sysdeps/x86_64/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/x86_64/fpu/fesetround.c3
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps19
-rw-r--r--sysdeps/x86_64/fpu/math_private.h21
-rw-r--r--sysdeps/x86_64/fpu/printf_fphex.c4
-rw-r--r--sysdeps/x86_64/fpu/s_log1pl.S5
-rw-r--r--sysdeps/x86_64/fpu/s_sincos.S61
-rw-r--r--sysdeps/x86_64/fpu/s_sincosl.S7
-rw-r--r--sysdeps/x86_64/hp-timing.h10
-rw-r--r--sysdeps/x86_64/jmpbuf-offsets.h30
-rw-r--r--sysdeps/x86_64/jmpbuf-unwind.h48
-rw-r--r--sysdeps/x86_64/ldbl2mpn.c1
-rw-r--r--sysdeps/x86_64/memset.S10
-rw-r--r--sysdeps/x86_64/memset_chk.S2
-rw-r--r--sysdeps/x86_64/setjmp.S28
-rw-r--r--sysdeps/x86_64/soft-fp/Dist1
-rw-r--r--sysdeps/x86_64/strchr.S4
-rw-r--r--sysdeps/x86_64/strcmp.S4
-rw-r--r--sysdeps/x86_64/strcspn.S9
-rw-r--r--sysdeps/x86_64/strspn.S7
-rw-r--r--sysdeps/x86_64/strtok.S10
3565 files changed, 148179 insertions, 152637 deletions
diff --git a/sysdeps/alpha/Dist b/sysdeps/alpha/Dist
deleted file mode 100644
index 7cf49111e4..0000000000
--- a/sysdeps/alpha/Dist
+++ /dev/null
@@ -1,11 +0,0 @@
-divrem.h
-divl.S
-divq.S
-reml.S
-remq.S
-_mcount.S
-stxcpy.S
-stxncpy.S
-fpu/fenv_libc.h
-alphaev6/stxncpy.S
-alphaev6/stxcpy.S
diff --git a/sysdeps/alpha/Implies b/sysdeps/alpha/Implies
index 4b354f3e47..18c35908c4 100644
--- a/sysdeps/alpha/Implies
+++ b/sysdeps/alpha/Implies
@@ -1,5 +1,6 @@
 wordsize-64
-# Alpha uses IEEE 754 single and double precision floating point.
-ieee754/flt-32
+# Alpha uses IEEE 754 single, double and quad precision floating point.
+ieee754/ldbl-128
 ieee754/dbl-64
+ieee754/flt-32
 alpha/soft-fp
diff --git a/sysdeps/alpha/__longjmp.S b/sysdeps/alpha/__longjmp.S
index 40d50312a3..bed26658de 100644
--- a/sysdeps/alpha/__longjmp.S
+++ b/sysdeps/alpha/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1994, 1997, 2006 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
@@ -19,9 +19,7 @@
 #define __ASSEMBLY__
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
 
 ENTRY(__longjmp)
@@ -54,6 +52,11 @@ ENTRY(__longjmp)
 	ldt     $f7, JB_F7*8(a0)
 	ldt     $f8, JB_F8*8(a0)
 	ldt     $f9, JB_F9*8(a0)
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE(ra, t1)
+	PTR_DEMANGLE2(t0, t1)
+	PTR_DEMANGLE2(fp, t1)
+#endif
 	cmoveq  v0, 1, v0
 	mov     t0, sp
 	ret
diff --git a/sysdeps/alpha/bits/link.h b/sysdeps/alpha/bits/link.h
new file mode 100644
index 0000000000..429faff432
--- /dev/null
+++ b/sysdeps/alpha/bits/link.h
@@ -0,0 +1,69 @@
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+
+/* Registers for entry into PLT on Alpha.  */
+typedef struct La_alpha_regs
+{
+  uint64_t lr_r26;
+  uint64_t lr_sp;
+  uint64_t lr_r16;
+  uint64_t lr_r17;
+  uint64_t lr_r18;
+  uint64_t lr_r19;
+  uint64_t lr_r20;
+  uint64_t lr_r21;
+  double lr_f16;
+  double lr_f17;
+  double lr_f18;
+  double lr_f19;
+  double lr_f20;
+  double lr_f21;
+} La_alpha_regs;
+
+/* Return values for calls from PLT on Alpha.  */
+typedef struct La_alpha_retval
+{
+  uint64_t lrv_r0;
+  uint64_t lrv_r1;
+  double lrv_f0;
+  double lrv_f1;
+} La_alpha_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_alpha_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
+				         uintptr_t *__refcook,
+				         uintptr_t *__defcook,
+				         La_alpha_regs *__regs,
+				         unsigned int *__flags,
+				         const char *__symname,
+				         long int *__framesizep);
+extern unsigned int la_alpha_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx,
+					  uintptr_t *__refcook,
+					  uintptr_t *__defcook,
+					  const La_alpha_regs *__inregs,
+					  La_alpha_retval *__outregs,
+					  const char *symname);
+
+__END_DECLS
diff --git a/sysdeps/alpha/bits/mathdef.h b/sysdeps/alpha/bits/mathdef.h
new file mode 100644
index 0000000000..cbfaf68e22
--- /dev/null
+++ b/sysdeps/alpha/bits/mathdef.h
@@ -0,0 +1,80 @@
+/* Copyright (C) 1997,1998,1999,2000,2003,2004,2006
+	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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+/* FIXME! This file describes properties of the compiler, not the machine;
+   it should not be part of libc!  */
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF	1
+
+# ifdef __GNUC__
+#  if __STDC__ == 1
+
+/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
+typedef float float_t;
+typedef double double_t;
+
+#  else
+
+/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
+typedef double float_t;
+typedef double double_t;
+
+#  endif
+# else
+
+/* Wild guess at types for float_t and double_t. */
+typedef double float_t;
+typedef double double_t;
+
+# endif
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+# define FP_ILOGB0     (-2147483647)
+# define FP_ILOGBNAN   (2147483647)
+
+#endif	/* ISO C99 && MATH_H */
+
+#if defined _COMPLEX_H && !defined _COMPLEX_H_MATHDEF
+# define _COMPLEX_H_MATHDEF 1
+# if defined(__GNUC__) && !__GNUC_PREREQ(3,4)
+
+/* Due to an ABI change, we need to remap the complex float symbols.  */
+#  define _Mdouble_		float
+#  define __MATHCALL(function, args) \
+    __MATHDECL (_Complex float, function, args)
+#  define __MATHDECL(type, function, args) \
+    __MATHDECL_1(type, function##f, args, __c1_##function##f); \
+    __MATHDECL_1(type, __##function##f, args, __c1_##function##f)
+#  define __MATHDECL_1(type, function, args, alias) \
+    extern type function args __asm__(#alias) __THROW
+
+#  include <bits/cmathcalls.h>
+
+#  undef _Mdouble_
+#  undef __MATHCALL
+#  undef __MATHDECL
+#  undef __MATHDECL_1
+
+# endif /* GNUC before 3.4 */
+#endif /* COMPLEX_H */
diff --git a/sysdeps/alpha/bits/setjmp.h b/sysdeps/alpha/bits/setjmp.h
index c603a35554..eb0b478fb8 100644
--- a/sysdeps/alpha/bits/setjmp.h
+++ b/sysdeps/alpha/bits/setjmp.h
@@ -1,5 +1,5 @@
 /* Define the machine-dependent type `jmp_buf'.  Alpha version.
-   Copyright (C) 1992, 1997, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1992,1997,2003,2005,2006 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
@@ -55,33 +55,8 @@
  * registers.
  */
 
-#if defined __USE_MISC || defined __ASSEMBLY__
-# define JB_S0  0
-# define JB_S1  1
-# define JB_S2  2
-# define JB_S3  3
-# define JB_S4  4
-# define JB_S5  5
-# define JB_PC  6
-# define JB_FP  7
-# define JB_SP  8
-# define JB_F2  9
-# define JB_F3  10
-# define JB_F4  11
-# define JB_F5  12
-# define JB_F6  13
-# define JB_F7  14
-# define JB_F8  15
-# define JB_F9  16
-#endif
-
 #ifndef __ASSEMBLY__
 typedef long int __jmp_buf[17];
-
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
-   variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address)				\
-     ((void *)(_address) < (void *)((_jmpbuf)[JB_SP]))
 #endif
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/alpha/div_libc.h b/sysdeps/alpha/div_libc.h
index 62b4470355..b731b02e25 100644
--- a/sysdeps/alpha/div_libc.h
+++ b/sysdeps/alpha/div_libc.h
@@ -34,6 +34,12 @@
 #define RV	t12
 #define RA	t9
 
+/* The secureplt format does not allow the division routines to be called
+   via plt; there aren't enough registers free to be clobbered.  Avoid 
+   setting the symbol type to STT_FUNC, so that the linker won't be tempted
+   to create a plt entry.  */
+#define funcnoplt notype
+
 /* None of these functions should use implicit anything.  */
 	.set	nomacro
 	.set	noat
diff --git a/sysdeps/alpha/divl.S b/sysdeps/alpha/divl.S
index 408d66db00..9bac0450d0 100644
--- a/sysdeps/alpha/divl.S
+++ b/sysdeps/alpha/divl.S
@@ -36,7 +36,7 @@
 	.text
 	.align	4
 	.globl	__divl
-	.type	__divl, @function
+	.type	__divl, @funcnoplt
 	.usepv	__divl, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/divq.S b/sysdeps/alpha/divq.S
index 7f245ac056..d2ed2c5af6 100644
--- a/sysdeps/alpha/divq.S
+++ b/sysdeps/alpha/divq.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__divq
-	.type	__divq, @function
+	.type	__divq, @funcnoplt
 	.usepv	__divq, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/divqu.S b/sysdeps/alpha/divqu.S
index fc00fa133c..ef3cdb1b2b 100644
--- a/sysdeps/alpha/divqu.S
+++ b/sysdeps/alpha/divqu.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__divqu
-	.type	__divqu, @function
+	.type	__divqu, @funcnoplt
 	.usepv	__divqu, no
 
 	cfi_startproc
@@ -240,7 +240,7 @@ $y_is_neg:
 	/* If we get here, Y is so big that bit 63 is set.  The results
 	   from the divide will be completely wrong.  Fortunately, the
 	   quotient must be either 0 or 1, so just compute it directly.  */
-	cmpult	Y, X, RV
+	cmpule	Y, X, RV
 	excb
 	mt_fpcr	$f3
 	ldt	$f0, 0(sp)
diff --git a/sysdeps/alpha/dl-dtprocnum.h b/sysdeps/alpha/dl-dtprocnum.h
new file mode 100644
index 0000000000..67845cdd62
--- /dev/null
+++ b/sysdeps/alpha/dl-dtprocnum.h
@@ -0,0 +1,3 @@
+/* Number of extra dynamic section entries for this architecture.  By
+   default there are none.  */
+#define DT_THISPROCNUM	DT_ALPHA_NUM
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h
index 780a3a57fd..88c357ea07 100644
--- a/sysdeps/alpha/dl-machine.h
+++ b/sysdeps/alpha/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  Alpha version.
-   Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <rth@tamu.edu>.
 
@@ -33,6 +33,9 @@
    where the dynamic linker should not map anything.  */
 #define ELF_MACHINE_USER_ADDRESS_MASK	0x120000000UL
 
+/* Translate a processor specific dynamic tag to the index in l_info array.  */
+#define DT_ALPHA(x) (DT_ALPHA_##x - DT_LOPROC + DT_NUM)
+
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
 elf_machine_matches_host (const Elf64_Ehdr *ehdr)
@@ -55,244 +58,77 @@ elf_machine_dynamic (void)
 }
 
 /* Return the run-time load address of the shared object.  */
+
 static inline Elf64_Addr
 elf_machine_load_address (void)
 {
-  /* NOTE: While it is generally unfriendly to put data in the text
-     segment, it is only slightly less so when the "data" is an
-     instruction.  While we don't have to worry about GLD just yet, an
-     optimizing linker might decide that our "data" is an unreachable
-     instruction and throw it away -- with the right switches, DEC's
-     linker will do this.  What ought to happen is we should add
-     something to GAS to allow us access to the new GPREL_HI32/LO32
-     relocation types stolen from OSF/1 3.0.  */
-  /* This code relies on the fact that BRADDR relocations do not
-     appear in dynamic relocation tables.  Not that that would be very
-     useful anyway -- br/bsr has a 4MB range and the shared libraries
-     are usually many many terabytes away.  */
-
-  Elf64_Addr dot;
-  long int zero_disp;
-
-  asm("br %0, 1f\n"
-      "0:\n\t"
-      "br $0, 2f\n"
-      "1:\n\t"
-      ".section\t.data\n"
-      "2:\n\t"
-      ".quad 0b\n\t"
-      ".previous"
-      : "=r"(dot));
-
-  zero_disp = *(int *) dot;
-  zero_disp = (zero_disp << 43) >> 41;
-
-  return dot - *(Elf64_Addr *) (dot + 4 + zero_disp);
+  /* This relies on the compiler using gp-relative addresses for static symbols.  */
+  static void *dot = &dot;
+  return (void *)&dot - dot;
 }
 
 /* Set up the loaded object described by L so its unrelocated PLT
    entries will jump to the on-demand fixup code in dl-runtime.c.  */
 
 static inline int
-elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
 {
-  Elf64_Addr plt;
-  extern void _dl_runtime_resolve (void);
-  extern void _dl_runtime_profile (void);
+  extern char _dl_runtime_resolve_new[] attribute_hidden;
+  extern char _dl_runtime_profile_new[] attribute_hidden;
+  extern char _dl_runtime_resolve_old[] attribute_hidden;
+  extern char _dl_runtime_profile_old[] attribute_hidden;
+
+  struct pltgot {
+    char *resolve;
+    struct link_map *link;
+  };
+
+  struct pltgot *pg;
+  long secureplt;
+  char *resolve;
+
+  if (map->l_info[DT_JMPREL] == 0 || !lazy)
+    return lazy;
+
+  /* Check to see if we're using the read-only plt form.  */
+  secureplt = map->l_info[DT_ALPHA(PLTRO)] != 0;
+
+  /* If the binary uses the read-only secure plt format, PG points to
+     the .got.plt section, which is the right place for ld.so to place
+     its hooks.  Otherwise, PG is currently pointing at the start of
+     the plt; the hooks go at offset 16.  */
+  pg = (struct pltgot *) D_PTR (map, l_info[DT_PLTGOT]);
+  pg += !secureplt;
+
+  /* This function will be called to perform the relocation.  They're
+     not declared as functions to convince the compiler to use gp
+     relative relocations for them.  */
+  if (secureplt)
+    resolve = _dl_runtime_resolve_new;
+  else
+    resolve = _dl_runtime_resolve_old;
 
-  if (l->l_info[DT_JMPREL] && lazy)
+  if (__builtin_expect (profile, 0))
     {
-      /* The GOT entries for the functions in the PLT have not been
-	 filled in yet.  Their initial contents are directed to the
-	 PLT which arranges for the dynamic linker to be called.  */
-      plt = D_PTR (l, l_info[DT_PLTGOT]);
-
-      /* This function will be called to perform the relocation.  */
-      if (!profile)
-        *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_resolve;
+      if (secureplt)
+	resolve = _dl_runtime_profile_new;
       else
-	{
-	  *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_profile;
-
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
-	    {
-	      /* This is the object we are looking for.  Say that we really
-		 want profiling and the timers are started.  */
-	      GL(dl_profile_map) = l;
-	    }
-	}
-
-      /* Identify this shared object */
-      *(Elf64_Addr *)(plt + 24) = (Elf64_Addr) l;
+	resolve = _dl_runtime_profile_old;
 
-      /* If the first instruction of the plt entry is not
-	 "br $28, plt0", we have to reinitialize .plt for lazy relocation.  */
-      if (*(unsigned int *)(plt + 32) != 0xc39ffff7)
+      if (GLRO(dl_profile) && _dl_name_match_p (GLRO(dl_profile), map))
 	{
-	  unsigned int val = 0xc39ffff7;
-	  unsigned int *slot, *end;
-	  const Elf64_Rela *rela = (const Elf64_Rela *)
-				   D_PTR (l, l_info[DT_JMPREL]);
-	  Elf64_Addr l_addr = l->l_addr;
-
-	  /* br t12,.+4; ldq t12,12(t12); nop; jmp t12,(t12),.+4 */
-	  *(unsigned long *)plt = 0xa77b000cc3600000;
-	  *(unsigned long *)(plt + 8) = 0x6b7b000047ff041f;
-	  slot = (unsigned int *)(plt + 32);
-	  end = (unsigned int *)(plt + 32
-				 + l->l_info[DT_PLTRELSZ]->d_un.d_val / 2);
-	  while (slot < end)
-	    {
-	      /* br at,.plt+0 */
-	      *slot = val;
-	      *(Elf64_Addr *) rela->r_offset = (Elf64_Addr) slot - l_addr;
-	      val -= 3;
-	      slot += 3;
-	      ++rela;
-	    }
+	  /* This is the object we are looking for.  Say that we really
+	     want profiling and the timers are started.  */
+	  GL(dl_profile_map) = map;
 	}
     }
 
+  pg->resolve = resolve;
+  pg->link = map;
+
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name, IMB)	\
-  extern void tramp_name (void);				\
-  asm ( "\
-	.globl " #tramp_name "					\n\
-	.ent " #tramp_name "					\n\
-" #tramp_name ":						\n\
-	lda	$sp, -44*8($sp)					\n\
-	.frame	$sp, 44*8, $26					\n\
-	/* Preserve all integer registers that C normally	\n\
-	   doesn't.  */						\n\
-	stq	$26, 0*8($sp)					\n\
-	stq	$0, 1*8($sp)					\n\
-	stq	$1, 2*8($sp)					\n\
-	stq	$2, 3*8($sp)					\n\
-	stq	$3, 4*8($sp)					\n\
-	stq	$4, 5*8($sp)					\n\
-	stq	$5, 6*8($sp)					\n\
-	stq	$6, 7*8($sp)					\n\
-	stq	$7, 8*8($sp)					\n\
-	stq	$8, 9*8($sp)					\n\
-	stq	$16, 10*8($sp)					\n\
-	stq	$17, 11*8($sp)					\n\
-	stq	$18, 12*8($sp)					\n\
-	stq	$19, 13*8($sp)					\n\
-	stq	$20, 14*8($sp)					\n\
-	stq	$21, 15*8($sp)					\n\
-	stq	$22, 16*8($sp)					\n\
-	stq	$23, 17*8($sp)					\n\
-	stq	$24, 18*8($sp)					\n\
-	stq	$25, 19*8($sp)					\n\
-	stq	$29, 20*8($sp)					\n\
-	stt	$f0, 21*8($sp)					\n\
-	stt	$f1, 22*8($sp)					\n\
-	stt	$f10, 23*8($sp)					\n\
-	stt	$f11, 24*8($sp)					\n\
-	stt	$f12, 25*8($sp)					\n\
-	stt	$f13, 26*8($sp)					\n\
-	stt	$f14, 27*8($sp)					\n\
-	stt	$f15, 28*8($sp)					\n\
-	stt	$f16, 29*8($sp)					\n\
-	stt	$f17, 30*8($sp)					\n\
-	stt	$f18, 31*8($sp)					\n\
-	stt	$f19, 32*8($sp)					\n\
-	stt	$f20, 33*8($sp)					\n\
-	stt	$f21, 34*8($sp)					\n\
-	stt	$f22, 35*8($sp)					\n\
-	stt	$f23, 36*8($sp)					\n\
-	stt	$f24, 37*8($sp)					\n\
-	stt	$f25, 38*8($sp)					\n\
-	stt	$f26, 39*8($sp)					\n\
-	stt	$f27, 40*8($sp)					\n\
-	stt	$f28, 41*8($sp)					\n\
-	stt	$f29, 42*8($sp)					\n\
-	stt	$f30, 43*8($sp)					\n\
-	.mask	0x27ff01ff, -44*8				\n\
-	.fmask	0xfffffc03, -(44-21)*8				\n\
-	/* Set up our $gp */					\n\
-	br	$gp, .+4					\n\
-	ldgp	$gp, 0($gp)					\n\
-	.prologue 0						\n\
-	/* Set up the arguments for fixup: */			\n\
-	/* $16 = link_map out of plt0 */			\n\
-	/* $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24 */\n\
-	/* $18 = return address */				\n\
-	subq	$28, $27, $17					\n\
-	ldq	$16, 8($27)					\n\
-	subq	$17, 20, $17					\n\
-	mov	$26, $18					\n\
-	addq	$17, $17, $17					\n\
-	/* Do the fixup */					\n\
-	bsr	$26, " #fixup_name "	!samegp			\n\
-	/* Move the destination address into position.  */	\n\
-	mov	$0, $27						\n\
-	/* Restore program registers.  */			\n\
-	ldq	$26, 0*8($sp)					\n\
-	ldq	$0, 1*8($sp)					\n\
-	ldq	$1, 2*8($sp)					\n\
-	ldq	$2, 3*8($sp)					\n\
-	ldq	$3, 4*8($sp)					\n\
-	ldq	$4, 5*8($sp)					\n\
-	ldq	$5, 6*8($sp)					\n\
-	ldq	$6, 7*8($sp)					\n\
-	ldq	$7, 8*8($sp)					\n\
-	ldq	$8, 9*8($sp)					\n\
-	ldq	$16, 10*8($sp)					\n\
-	ldq	$17, 11*8($sp)					\n\
-	ldq	$18, 12*8($sp)					\n\
-	ldq	$19, 13*8($sp)					\n\
-	ldq	$20, 14*8($sp)					\n\
-	ldq	$21, 15*8($sp)					\n\
-	ldq	$22, 16*8($sp)					\n\
-	ldq	$23, 17*8($sp)					\n\
-	ldq	$24, 18*8($sp)					\n\
-	ldq	$25, 19*8($sp)					\n\
-	ldq	$29, 20*8($sp)					\n\
-	ldt	$f0, 21*8($sp)					\n\
-	ldt	$f1, 22*8($sp)					\n\
-	ldt	$f10, 23*8($sp)					\n\
-	ldt	$f11, 24*8($sp)					\n\
-	ldt	$f12, 25*8($sp)					\n\
-	ldt	$f13, 26*8($sp)					\n\
-	ldt	$f14, 27*8($sp)					\n\
-	ldt	$f15, 28*8($sp)					\n\
-	ldt	$f16, 29*8($sp)					\n\
-	ldt	$f17, 30*8($sp)					\n\
-	ldt	$f18, 31*8($sp)					\n\
-	ldt	$f19, 32*8($sp)					\n\
-	ldt	$f20, 33*8($sp)					\n\
-	ldt	$f21, 34*8($sp)					\n\
-	ldt	$f22, 35*8($sp)					\n\
-	ldt	$f23, 36*8($sp)					\n\
-	ldt	$f24, 37*8($sp)					\n\
-	ldt	$f25, 38*8($sp)					\n\
-	ldt	$f26, 39*8($sp)					\n\
-	ldt	$f27, 40*8($sp)					\n\
-	ldt	$f28, 41*8($sp)					\n\
-	ldt	$f29, 42*8($sp)					\n\
-	ldt	$f30, 43*8($sp)					\n\
-	/* Flush the Icache after having modified the .plt code.  */\n\
-	" #IMB "						\n\
-	/* Clean up and turn control to the destination */	\n\
-	lda	$sp, 44*8($sp)					\n\
-	jmp	$31, ($27)					\n\
-	.end " #tramp_name)
-
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE				\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup, imb);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup, /* nop */);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE				\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup, imb);	\
-  strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
-#endif
-
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
@@ -416,7 +252,7 @@ $fixup_stack:							\n\
 /* Fix up the instructions of a PLT entry to invoke the function
    rather than the dynamic linker.  */
 static inline Elf64_Addr
-elf_machine_fixup_plt (struct link_map *l, lookup_t t,
+elf_machine_fixup_plt (struct link_map *map, lookup_t t,
 		       const Elf64_Rela *reloc,
 		       Elf64_Addr *got_addr, Elf64_Addr value)
 {
@@ -427,10 +263,16 @@ elf_machine_fixup_plt (struct link_map *l, lookup_t t,
   /* Store the value we are going to load.  */
   *got_addr = value;
 
+  /* If this binary uses the read-only secure plt format, we're done.  */
+  if (map->l_info[DT_ALPHA(PLTRO)])
+    return value;
+
+  /* Otherwise we have to modify the plt entry in place to do the branch.  */
+
   /* Recover the PLT entry address by calculating reloc's index into the
      .rela.plt, and finding that entry in the .plt.  */
-  rela_plt = (void *) D_PTR (l, l_info[DT_JMPREL]);
-  plte = (void *) (D_PTR (l, l_info[DT_PLTGOT]) + 32);
+  rela_plt = (const Elf64_Rela *) D_PTR (map, l_info[DT_JMPREL]);
+  plte = (Elf64_Word *) (D_PTR (map, l_info[DT_PLTGOT]) + 32);
   plte += 3 * (reloc - rela_plt);
 
   /* Find the displacement from the plt entry to the function.  */
@@ -501,13 +343,18 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
   return value + reloc->r_addend;
 }
 
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER	alpha_gnu_pltenter
+#define ARCH_LA_PLTEXIT		alpha_gnu_pltexit
+
 #endif /* !dl_machine_h */
 
-#ifdef RESOLVE
+#ifdef RESOLVE_MAP
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela (struct link_map *map,
 		  const Elf64_Rela *reloc,
 		  const Elf64_Sym *sym,
@@ -555,26 +402,16 @@ elf_machine_rela (struct link_map *map,
       return;
   else
     {
+      struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
       Elf64_Addr sym_value;
       Elf64_Addr sym_raw_value;
 
-#if defined USE_TLS && !defined RTLD_BOOTSTRAP
-      struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
       sym_raw_value = sym_value = reloc->r_addend;
-      if (sym)
+      if (sym_map)
 	{
 	  sym_raw_value += sym->st_value;
 	  sym_value = sym_raw_value + sym_map->l_addr;
 	}
-#else
-      Elf64_Addr loadbase = RESOLVE (&sym, version, r_type);
-      sym_raw_value = sym_value = reloc->r_addend;
-      if (sym)
-	{
-	  sym_raw_value += sym->st_value;
-	  sym_value = sym_raw_value + loadbase;
-	}
-#endif
 
       if (r_type == R_ALPHA_GLOB_DAT)
 	*reloc_addr = sym_value;
@@ -646,6 +483,7 @@ elf_machine_rela (struct link_map *map,
 #define ELF_MACHINE_REL_RELATIVE 1
 
 auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
 			   void *const reloc_addr_arg)
 {
@@ -662,6 +500,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
 }
 
 auto inline void
+__attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf64_Addr l_addr, const Elf64_Rela *reloc)
 {
@@ -680,4 +519,4 @@ elf_machine_lazy_rel (struct link_map *map,
     _dl_reloc_bad_type (map, r_type, 1);
 }
 
-#endif /* RESOLVE */
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/alpha/dl-sysdep.h b/sysdeps/alpha/dl-sysdep.h
index 0b4c8050de..cd678f4e43 100644
--- a/sysdeps/alpha/dl-sysdep.h
+++ b/sysdeps/alpha/dl-sysdep.h
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  Alpha version.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005 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
@@ -17,25 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifndef _DL_SYSDEP_H
-#define _DL_SYSDEP_H   1
-
-/* This macro must be defined to either 0 or 1.
-
-   If 1, then an errno global variable hidden in ld.so will work right with
-   all the errno-using libc code compiled for ld.so, and there is never a
-   need to share the errno location with libc.  This is appropriate only if
-   all the libc functions that ld.so uses are called without PLT and always
-   get the versions linked into ld.so rather than the libc ones.  */
-
-#ifdef IS_IN_rtld
-# define RTLD_PRIVATE_ERRNO 1
-#else
-# define RTLD_PRIVATE_ERRNO 0
-#endif
+#include_next <dl-sysdep.h>
 
 /* _dl_argv cannot be attribute_relro, because _dl_start_user
    might write into it after _dl_start returns.  */
 #define DL_ARGV_NOT_RELRO 1
-
-#endif /* dl-sysdep.h */
diff --git a/sysdeps/alpha/dl-trampoline.S b/sysdeps/alpha/dl-trampoline.S
new file mode 100644
index 0000000000..c52efbb3bc
--- /dev/null
+++ b/sysdeps/alpha/dl-trampoline.S
@@ -0,0 +1,541 @@
+/* PLT trampolines.  Alpha version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.set noat
+
+.macro savei regno, offset
+	stq	$\regno, \offset($30)
+	cfi_rel_offset(\regno, \offset)
+.endm
+
+.macro savef regno, offset
+	stt	$f\regno, \offset($30)
+	cfi_rel_offset(\regno+32, \offset)
+.endm
+
+	.align	4
+	.globl	_dl_runtime_resolve_new
+	.ent	_dl_runtime_resolve_new
+
+#undef FRAMESIZE
+#define FRAMESIZE	14*8
+
+_dl_runtime_resolve_new:
+	.frame	$30, FRAMESIZE, $26, 0
+	.mask	0x4000000, 0
+
+	ldah	$29, 0($27)		!gpdisp!1
+	lda	$30, -FRAMESIZE($30)
+	stq	$26, 0*8($30)
+	stq	$16, 2*8($30)
+
+	stq	$17, 3*8($30)
+	lda	$29, 0($29)		!gpdisp!1
+	stq	$18, 4*8($30)
+	mov	$28, $16		/* link_map from .got.plt */
+
+	stq	$19, 5*8($30)
+	mov	$25, $17		/* offset of reloc entry */
+	stq	$20, 6*8($30)
+	mov	$26, $18		/* return address */
+
+	stq	$21, 7*8($30)
+	stt	$f16, 8*8($30)
+	stt	$f17, 9*8($30)
+	stt	$f18, 10*8($30)
+
+	stt	$f19, 11*8($30)
+	stt	$f20, 12*8($30)
+	stt	$f21, 13*8($30)
+	.prologue 2
+
+	bsr	$26, _dl_fixup		!samegp
+	mov	$0, $27
+
+	ldq	$26, 0*8($30)
+	ldq	$16, 2*8($30)
+	ldq	$17, 3*8($30)
+	ldq	$18, 4*8($30)
+	ldq	$19, 5*8($30)
+	ldq	$20, 6*8($30)
+	ldq	$21, 7*8($30)
+	ldt	$f16, 8*8($30)
+	ldt	$f17, 9*8($30)
+	ldt	$f18, 10*8($30)
+	ldt	$f19, 11*8($30)
+	ldt	$f20, 12*8($30)
+	ldt	$f21, 13*8($30)
+	lda	$30, FRAMESIZE($30)
+	jmp	$31, ($27), 0
+	.end	_dl_runtime_resolve_new
+
+	.globl	_dl_runtime_profile_new
+	.type	_dl_runtime_profile_new, @function
+
+#undef FRAMESIZE
+#define FRAMESIZE	20*8
+
+	/* We save the registers in a different order than desired by
+	   .mask/.fmask, so we have to use explicit cfi directives.  */
+	cfi_startproc
+
+_dl_runtime_profile_new:
+	ldah	$29, 0($27)		!gpdisp!2
+	lda	$30, -FRAMESIZE($30)
+	savei	26, 0*8
+	stq	$16, 2*8($30)
+
+	stq	$17, 3*8($30)
+	lda	$29, 0($29)		!gpdisp!2
+	stq	$18, 4*8($30)
+	lda	$1, FRAMESIZE($30)	/* incoming sp value */
+
+	stq	$1, 1*8($30)
+	stq	$19, 5*8($30)
+	stq	$20, 6*8($30)
+	mov	$28, $16		/* link_map from .got.plt */
+
+	stq	$21, 7*8($30)
+	mov	$25, $17		/* offset of reloc entry */
+	stt	$f16, 8*8($30)
+	mov	$26, $18		/* return address */
+
+	stt	$f17, 9*8($30)
+	mov	$30, $19		/* La_alpha_regs address */
+	stt	$f18, 10*8($30)
+	lda	$20, 14*8($30)		/* framesize address */
+
+	stt	$f19, 11*8($30)
+	stt	$f20, 12*8($30)
+	stt	$f21, 13*8($30)
+	stq	$28, 16*8($30)
+	stq	$25, 17*8($30)
+
+	bsr	$26, _dl_profile_fixup	!samegp
+	mov	$0, $27
+
+	/* Discover if we're wrapping this call.  */
+	ldq	$18, 14*8($30)
+	bge	$18, 1f
+
+	ldq	$26, 0*8($30)
+	ldq	$16, 2*8($30)
+	ldq	$17, 3*8($30)
+	ldq	$18, 4*8($30)
+	ldq	$19, 5*8($30)
+	ldq	$20, 6*8($30)
+	ldq	$21, 7*8($30)
+	ldt	$f16, 8*8($30)
+	ldt	$f17, 9*8($30)
+	ldt	$f18, 10*8($30)
+	ldt	$f19, 11*8($30)
+	ldt	$f20, 12*8($30)
+	ldt	$f21, 13*8($30)
+	lda	$30, FRAMESIZE($30)
+	jmp	$31, ($27), 0
+
+1:
+	/* Create a frame pointer and allocate a new argument frame.  */
+	savei	15, 15*8
+	mov	$30, $15
+	cfi_def_cfa_register (15)
+	addq	$18, 15, $18
+	bic	$18, 15, $18
+	subq	$30, $18, $30
+
+	/* Save the call destination around memcpy.  */
+	stq	$0, 14*8($30)
+
+	/* Copy the stack arguments into place.  */
+	lda	$16, 0($30)
+	lda	$17, FRAMESIZE($15)
+	jsr	$26, memcpy
+	ldgp	$29, 0($26)
+
+	/* Reload the argument registers.  */
+	ldq	$27, 14*8($30)
+	ldq	$16, 2*8($15)
+	ldq	$17, 3*8($15)
+	ldq	$18, 4*8($15)
+	ldq	$19, 5*8($15)
+	ldq	$20, 6*8($15)
+	ldq	$21, 7*8($15)
+	ldt	$f16, 8*8($15)
+	ldt	$f17, 9*8($15)
+	ldt	$f18, 10*8($15)
+	ldt	$f19, 11*8($15)
+	ldt	$f20, 12*8($15)
+	ldt	$f21, 13*8($15)
+
+	jsr	$26, ($27), 0
+	ldgp	$29, 0($26)
+
+	/* Set up for call to _dl_call_pltexit.  */
+	ldq	$16, 16*8($15)
+	ldq	$17, 17*8($15)
+	stq	$0, 16*8($15)
+	lda	$18, 0($15)
+	stq	$1, 17*8($15)
+	lda	$19, 16*8($15)
+	stt	$f0, 18*8($15)
+	stt	$f1, 19*8($15)
+	bsr	$26, _dl_call_pltexit	!samegp
+
+	mov	$15, $30
+	cfi_def_cfa_register (30)
+	ldq	$26, 0($30)
+	ldq	$15, 15*8($30)
+	lda	$30, FRAMESIZE($30)
+	ret
+
+	cfi_endproc
+	.size	_dl_runtime_profile_new, .-_dl_runtime_profile_new
+
+	.align	4
+	.globl	_dl_runtime_resolve_old
+	.ent	_dl_runtime_resolve_old
+
+#undef FRAMESIZE
+#define FRAMESIZE	44*8
+
+_dl_runtime_resolve_old:
+	lda	$30, -FRAMESIZE($30)
+	.frame	$30, FRAMESIZE, $26
+	/* Preserve all registers that C normally doesn't.  */
+	stq	$26, 0*8($30)
+	stq	$0, 1*8($30)
+	stq	$1, 2*8($30)
+	stq	$2, 3*8($30)
+	stq	$3, 4*8($30)
+	stq	$4, 5*8($30)
+	stq	$5, 6*8($30)
+	stq	$6, 7*8($30)
+	stq	$7, 8*8($30)
+	stq	$8, 9*8($30)
+	stq	$16, 10*8($30)
+	stq	$17, 11*8($30)
+	stq	$18, 12*8($30)
+	stq	$19, 13*8($30)
+	stq	$20, 14*8($30)
+	stq	$21, 15*8($30)
+	stq	$22, 16*8($30)
+	stq	$23, 17*8($30)
+	stq	$24, 18*8($30)
+	stq	$25, 19*8($30)
+	stq	$29, 20*8($30)
+	stt	$f0, 21*8($30)
+	stt	$f1, 22*8($30)
+	stt	$f10, 23*8($30)
+	stt	$f11, 24*8($30)
+	stt	$f12, 25*8($30)
+	stt	$f13, 26*8($30)
+	stt	$f14, 27*8($30)
+	stt	$f15, 28*8($30)
+	stt	$f16, 29*8($30)
+	stt	$f17, 30*8($30)
+	stt	$f18, 31*8($30)
+	stt	$f19, 32*8($30)
+	stt	$f20, 33*8($30)
+	stt	$f21, 34*8($30)
+	stt	$f22, 35*8($30)
+	stt	$f23, 36*8($30)
+	stt	$f24, 37*8($30)
+	stt	$f25, 38*8($30)
+	stt	$f26, 39*8($30)
+	stt	$f27, 40*8($30)
+	stt	$f28, 41*8($30)
+	stt	$f29, 42*8($30)
+	stt	$f30, 43*8($30)
+	.mask	0x27ff01ff, -FRAMESIZE
+	.fmask	0xfffffc03, -FRAMESIZE+21*8
+	/* Set up our GP.  */
+	br	$29, .+4
+	ldgp	$29, 0($29)
+	.prologue 0
+	/* Set up the arguments for _dl_fixup:
+	   $16 = link_map out of plt0
+	   $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
+	   $18 = return address
+	*/
+	subq	$28, $27, $17
+	ldq	$16, 8($27)
+	subq	$17, 20, $17
+	mov	$26, $18
+	addq	$17, $17, $17
+	bsr	$26, _dl_fixup	!samegp
+
+	/* Move the destination address into position.  */
+	mov	$0, $27
+	/* Restore program registers.  */
+	ldq	$26, 0*8($30)
+	ldq	$0, 1*8($30)
+	ldq	$1, 2*8($30)
+	ldq	$2, 3*8($30)
+	ldq	$3, 4*8($30)
+	ldq	$4, 5*8($30)
+	ldq	$5, 6*8($30)
+	ldq	$6, 7*8($30)
+	ldq	$7, 8*8($30)
+	ldq	$8, 9*8($30)
+	ldq	$16, 10*8($30)
+	ldq	$17, 11*8($30)
+	ldq	$18, 12*8($30)
+	ldq	$19, 13*8($30)
+	ldq	$20, 14*8($30)
+	ldq	$21, 15*8($30)
+	ldq	$22, 16*8($30)
+	ldq	$23, 17*8($30)
+	ldq	$24, 18*8($30)
+	ldq	$25, 19*8($30)
+	ldq	$29, 20*8($30)
+	ldt	$f0, 21*8($30)
+	ldt	$f1, 22*8($30)
+	ldt	$f10, 23*8($30)
+	ldt	$f11, 24*8($30)
+	ldt	$f12, 25*8($30)
+	ldt	$f13, 26*8($30)
+	ldt	$f14, 27*8($30)
+	ldt	$f15, 28*8($30)
+	ldt	$f16, 29*8($30)
+	ldt	$f17, 30*8($30)
+	ldt	$f18, 31*8($30)
+	ldt	$f19, 32*8($30)
+	ldt	$f20, 33*8($30)
+	ldt	$f21, 34*8($30)
+	ldt	$f22, 35*8($30)
+	ldt	$f23, 36*8($30)
+	ldt	$f24, 37*8($30)
+	ldt	$f25, 38*8($30)
+	ldt	$f26, 39*8($30)
+	ldt	$f27, 40*8($30)
+	ldt	$f28, 41*8($30)
+	ldt	$f29, 42*8($30)
+	ldt	$f30, 43*8($30)
+	/* Flush the Icache after having modified the .plt code.  */
+	imb
+	/* Clean up and turn control to the destination */
+	lda	$30, FRAMESIZE($30)
+	jmp	$31, ($27)
+
+	.end	_dl_runtime_resolve_old
+
+	.globl	_dl_runtime_profile_old
+	.usepv	_dl_runtime_profile_old, no
+	.type	_dl_runtime_profile_old, @function
+
+	/* We save the registers in a different order than desired by
+	   .mask/.fmask, so we have to use explicit cfi directives.  */
+	cfi_startproc
+
+#undef FRAMESIZE
+#define FRAMESIZE	50*8
+
+	.align	4
+_dl_runtime_profile_old:
+	lda	$30, -FRAMESIZE($30)
+	cfi_adjust_cfa_offset (FRAMESIZE)
+
+	/* Preserve all argument registers.  This also constructs the
+	   La_alpha_regs structure.  */
+	savei	26, 0*8
+	savei	16, 2*8
+	savei	17, 3*8
+	savei	18, 4*8
+	savei	19, 5*8
+	savei	20, 6*8
+	savei	21, 7*8
+	lda	$16, FRAMESIZE($30)
+	savef	16, 8*8
+	savef	17, 9*8
+	savef	18, 10*8
+	savef	19, 11*8
+	savef	20, 12*8
+	savef	21, 13*8
+	stq	$16, 1*8($30)
+
+	/* Preserve all registers that C normally doesn't.  */
+	savei	0, 14*8
+	savei	1, 15*8
+	savei	2, 16*8
+	savei	3, 17*8
+	savei	4, 18*8
+	savei	5, 19*8
+	savei	6, 20*8
+	savei	7, 21*8
+	savei	8, 22*8
+	savei	22, 23*8
+	savei	23, 24*8
+	savei	24, 25*8
+	savei	25, 26*8
+	savei	29, 27*8
+	savef	0, 28*8
+	savef	1, 29*8
+	savef	10, 30*8
+	savef	11, 31*8
+	savef	12, 32*8
+	savef	13, 33*8
+	savef	14, 34*8
+	savef	15, 35*8
+	savef	22, 36*8
+	savef	23, 37*8
+	savef	24, 38*8
+	savef	25, 39*8
+	savef	26, 40*8
+	savef	27, 41*8
+	savef	28, 42*8
+	savef	29, 43*8
+	savef	30, 44*8
+
+	/* Set up our GP.  */
+	br	$29, .+4
+	ldgp	$29, 0($29)
+
+	/* Set up the arguments for _dl_profile_fixup:
+	   $16 = link_map out of plt0
+	   $17 = offset of reloc entry = ($28 - $27 - 20) /12 * 24
+	   $18 = return address
+	   $19 = La_alpha_regs address
+	   $20 = framesize address
+	*/
+	subq	$28, $27, $17
+	ldq	$16, 8($27)
+	subq	$17, 20, $17
+	mov	$26, $18
+	addq	$17, $17, $17
+	lda	$19, 0($30)
+	lda	$20, 45*8($30)
+	stq	$16, 48*8($30)
+	stq	$17, 49*8($30)
+
+	bsr	$26, _dl_profile_fixup	!samegp
+
+	/* Discover if we're wrapping this call.  */
+	ldq	$18, 45*8($30)
+	bge	$18, 1f
+
+	/* Move the destination address into position.  */
+	mov	$0, $27
+	/* Restore program registers.  */
+	ldq	$26, 0*8($30)
+	ldq	$16, 2*8($30)
+	ldq	$17, 3*8($30)
+	ldq	$18, 4*8($30)
+	ldq	$19, 5*8($30)
+	ldq	$20, 6*8($30)
+	ldq	$21, 7*8($30)
+	ldt	$f16, 8*8($30)
+	ldt	$f17, 9*8($30)
+	ldt	$f18, 10*8($30)
+	ldt	$f19, 11*8($30)
+	ldt	$f20, 12*8($30)
+	ldt	$f21, 13*8($30)
+	ldq	$0, 14*8($30)
+	ldq	$1, 15*8($30)
+	ldq	$2, 16*8($30)
+	ldq	$3, 17*8($30)
+	ldq	$4, 18*8($30)
+	ldq	$5, 19*8($30)
+	ldq	$6, 20*8($30)
+	ldq	$7, 21*8($30)
+	ldq	$8, 22*8($30)
+	ldq	$22, 23*8($30)
+	ldq	$23, 24*8($30)
+	ldq	$24, 25*8($30)
+	ldq	$25, 26*8($30)
+	ldq	$29, 27*8($30)
+	ldt	$f0, 28*8($30)
+	ldt	$f1, 29*8($30)
+	ldt	$f10, 30*8($30)
+	ldt	$f11, 31*8($30)
+	ldt	$f12, 32*8($30)
+	ldt	$f13, 33*8($30)
+	ldt	$f14, 34*8($30)
+	ldt	$f15, 35*8($30)
+	ldt	$f22, 36*8($30)
+	ldt	$f23, 37*8($30)
+	ldt	$f24, 38*8($30)
+	ldt	$f25, 39*8($30)
+	ldt	$f26, 40*8($30)
+	ldt	$f27, 41*8($30)
+	ldt	$f28, 42*8($30)
+	ldt	$f29, 43*8($30)
+	ldt	$f30, 44*8($30)
+
+	/* Clean up and turn control to the destination.  */
+	lda	$30, FRAMESIZE($30)
+	jmp	$31, ($27)
+
+1:
+	/* Create a frame pointer and allocate a new argument frame.  */
+	savei	15, 45*8
+	mov	$30, $15
+	cfi_def_cfa_register (15)
+	addq	$18, 15, $18
+	bic	$18, 15, $18
+	subq	$30, $18, $30
+
+	/* Save the call destination around memcpy.  */
+	stq	$0, 46*8($30)
+
+	/* Copy the stack arguments into place.  */
+	lda	$16, 0($30)
+	lda	$17, FRAMESIZE($15)
+	jsr	$26, memcpy
+	ldgp	$29, 0($26)
+
+	/* Reload the argument registers.  */
+	ldq	$27, 46*8($30)
+	ldq	$16, 2*8($15)
+	ldq	$17, 3*8($15)
+	ldq	$18, 4*8($15)
+	ldq	$19, 5*8($15)
+	ldq	$20, 6*8($15)
+	ldq	$21, 7*8($15)
+	ldt	$f16, 8*8($15)
+	ldt	$f17, 9*8($15)
+	ldt	$f18, 10*8($15)
+	ldt	$f19, 11*8($15)
+	ldt	$f20, 12*8($15)
+	ldt	$f21, 13*8($15)
+
+	jsr	$26, ($27), 0
+	ldgp	$29, 0($26)
+
+	/* Set up for call to _dl_call_pltexit.  */
+	ldq	$16, 48*8($15)
+	ldq	$17, 49*8($15)
+	stq	$0, 46*8($15)
+	lda	$18, 0($15)
+	stq	$1, 47*8($15)
+	lda	$19, 46*8($15)
+	stt	$f0, 48*8($15)
+	stt	$f1, 49*8($15)
+	bsr	$26, _dl_call_pltexit	!samegp
+
+	mov	$15, $30
+	cfi_def_cfa_register (30)
+	ldq	$26, 0($30)
+	ldq	$15, 45*8($30)
+	lda	$30, FRAMESIZE($30)
+	ret
+
+	cfi_endproc
+	.size	_dl_runtime_profile_old, .-_dl_runtime_profile_old
diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S
index 3c2bc59adc..ebe14b4c8e 100644
--- a/sysdeps/alpha/elf/start.S
+++ b/sysdeps/alpha/elf/start.S
@@ -77,7 +77,7 @@ _start:
 	.end _start
 
 /* For ECOFF backwards compatibility. */
-weak_alias(_start, __start)
+weak_alias (_start, __start)
 
 /* Define a symbol for the first piece of initialized data.  */
 	.data
diff --git a/sysdeps/alpha/fpu/bits/mathdef.h b/sysdeps/alpha/fpu/bits/mathdef.h
deleted file mode 100644
index d5f2d5a843..0000000000
--- a/sysdeps/alpha/fpu/bits/mathdef.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-/* FIXME! This file describes properties of the compiler, not the machine;
-   it should not be part of libc!  */
-
-#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF	1
-
-# ifdef __GNUC__
-#  if __STDC__ == 1
-
-/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
-typedef float float_t;
-typedef double double_t;
-
-#  else
-
-/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
-typedef double float_t;
-typedef double double_t;
-
-#  endif
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
-typedef double double_t;
-
-# endif
-
-/* The values returned by `ilogb' for 0 and NaN respectively.  */
-# define FP_ILOGB0     (-2147483647)
-# define FP_ILOGBNAN   (2147483647)
-
-#endif	/* ISO C99 && MATH_H */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  The disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
-
-#if defined _COMPLEX_H && !defined _COMPLEX_H_MATHDEF
-# define _COMPLEX_H_MATHDEF 1
-# if defined(__GNUC__) && !__GNUC_PREREQ(3,4)
-
-/* Due to an ABI change, we need to remap the complex float symbols.  */
-#  define _Mdouble_		float
-#  define __MATHCALL(function, args) \
-    __MATHDECL (_Complex float, function, args)
-#  define __MATHDECL(type, function, args) \
-    __MATHDECL_1(type, function##f, args, __c1_##function##f); \
-    __MATHDECL_1(type, __##function##f, args, __c1_##function##f)
-#  define __MATHDECL_1(type, function, args, alias) \
-    extern type function args __asm__(#alias) __THROW
-
-#  include <bits/cmathcalls.h>
-
-#  undef _Mdouble_
-#  undef __MATHCALL
-#  undef __MATHDECL
-#  undef __MATHDECL_1
-
-# endif /* GNUC before 3.4 */
-#endif /* COMPLEX_H */
diff --git a/sysdeps/alpha/fpu/bits/mathinline.h b/sysdeps/alpha/fpu/bits/mathinline.h
index 187bd42f33..87d40058c3 100644
--- a/sysdeps/alpha/fpu/bits/mathinline.h
+++ b/sysdeps/alpha/fpu/bits/mathinline.h
@@ -46,7 +46,8 @@
 #if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
     && defined __OPTIMIZE__
 
-#define __inline_copysign(NAME, TYPE)					\
+#if !__GNUC_PREREQ (4, 0)
+# define __inline_copysign(NAME, TYPE)					\
 __MATH_INLINE TYPE							\
 __NTH (NAME (TYPE __x, TYPE __y))					\
 {									\
@@ -60,19 +61,11 @@ __inline_copysign (copysignf, float)
 __inline_copysign (__copysign, double)
 __inline_copysign (copysign, double)
 
-#undef __MATH_INLINE_copysign
+# undef __inline_copysign
+#endif
 
 
-#if __GNUC_PREREQ (2, 8)
-__MATH_INLINE float
-__NTH (__fabsf (float __x)) { return __builtin_fabsf (__x); }
-__MATH_INLINE float
-__NTH (fabsf (float __x)) { return __builtin_fabsf (__x); }
-__MATH_INLINE double
-__NTH (__fabs (double __x)) { return __builtin_fabs (__x); }
-__MATH_INLINE double
-__NTH (fabs (double __x)) { return __builtin_fabs (__x); }
-#else
+#if !__GNUC_PREREQ (2, 8)
 # define __inline_fabs(NAME, TYPE)			\
 __MATH_INLINE TYPE					\
 __NTH (NAME (TYPE __x))					\
diff --git a/sysdeps/alpha/fpu/feholdexcpt.c b/sysdeps/alpha/fpu/feholdexcpt.c
index 77d4cc1180..79aa970ac0 100644
--- a/sysdeps/alpha/fpu/feholdexcpt.c
+++ b/sysdeps/alpha/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <rth@tamu.edu>, 1997
 
@@ -31,3 +31,4 @@ feholdexcept (fenv_t *envp)
 
   return 0;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/alpha/fpu/fesetround.c b/sysdeps/alpha/fpu/fesetround.c
index c4dc196016..54b2bcf673 100644
--- a/sysdeps/alpha/fpu/fesetround.c
+++ b/sysdeps/alpha/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <rth@tamu.edu>, 1997
 
@@ -40,3 +40,4 @@ fesetround (int round)
 
   return 0;
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/alpha/fpu/libm-test-ulps b/sysdeps/alpha/fpu/libm-test-ulps
index 7e8140cddc..6b882e388a 100644
--- a/sysdeps/alpha/fpu/libm-test-ulps
+++ b/sysdeps/alpha/fpu/libm-test-ulps
@@ -20,12 +20,12 @@ float: 1
 ifloat: 1
 
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
diff --git a/sysdeps/alpha/fpu/s_cacosf.c b/sysdeps/alpha/fpu/s_cacosf.c
index 20e67f4ac9..46dca5aeb8 100644
--- a/sysdeps/alpha/fpu/s_cacosf.c
+++ b/sysdeps/alpha/fpu/s_cacosf.c
@@ -1,5 +1,5 @@
 /* Return arc cosine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_cacosf (_Complex float x);
 
-#include <sysdeps/generic/s_cacosf.c>
+#include <math/s_cacosf.c>
 #include "cfloat-compat.h"
 
 #undef __cacosf
diff --git a/sysdeps/alpha/fpu/s_cacoshf.c b/sysdeps/alpha/fpu/s_cacoshf.c
index 86cb4fbcaa..6b61d1ddaa 100644
--- a/sysdeps/alpha/fpu/s_cacoshf.c
+++ b/sysdeps/alpha/fpu/s_cacoshf.c
@@ -1,5 +1,5 @@
 /* Return arc hyperbole cosine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_cacoshf (_Complex float x);
 
-#include <sysdeps/generic/s_cacoshf.c>
+#include <math/s_cacoshf.c>
 #include "cfloat-compat.h"
 
 #undef __cacoshf
diff --git a/sysdeps/alpha/fpu/s_casinf.c b/sysdeps/alpha/fpu/s_casinf.c
index 3d0d4eadf2..fd41042ec9 100644
--- a/sysdeps/alpha/fpu/s_casinf.c
+++ b/sysdeps/alpha/fpu/s_casinf.c
@@ -1,5 +1,5 @@
 /* Return arc sine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_casinf (_Complex float x);
 
-#include <sysdeps/generic/s_casinf.c>
+#include <math/s_casinf.c>
 #include "cfloat-compat.h"
 
 #undef __casinf
diff --git a/sysdeps/alpha/fpu/s_casinhf.c b/sysdeps/alpha/fpu/s_casinhf.c
index 698ce10c04..0b72a24d5a 100644
--- a/sysdeps/alpha/fpu/s_casinhf.c
+++ b/sysdeps/alpha/fpu/s_casinhf.c
@@ -1,5 +1,5 @@
 /* Return arc hyperbole sine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_casinhf (_Complex float x);
 
-#include <sysdeps/generic/s_casinhf.c>
+#include <math/s_casinhf.c>
 #include "cfloat-compat.h"
 
 #undef __casinhf
diff --git a/sysdeps/alpha/fpu/s_catanf.c b/sysdeps/alpha/fpu/s_catanf.c
index 221a461c1b..8f40616617 100644
--- a/sysdeps/alpha/fpu/s_catanf.c
+++ b/sysdeps/alpha/fpu/s_catanf.c
@@ -1,5 +1,5 @@
 /* Return arc tangent of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_catanf (_Complex float x);
 
-#include <sysdeps/generic/s_catanf.c>
+#include <math/s_catanf.c>
 #include "cfloat-compat.h"
 
 #undef __catanf
diff --git a/sysdeps/alpha/fpu/s_catanhf.c b/sysdeps/alpha/fpu/s_catanhf.c
index 7465a43cac..ac11945727 100644
--- a/sysdeps/alpha/fpu/s_catanhf.c
+++ b/sysdeps/alpha/fpu/s_catanhf.c
@@ -1,5 +1,5 @@
 /* Return arc hyperbole tangent of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_catanhf (_Complex float x);
 
-#include <sysdeps/generic/s_catanhf.c>
+#include <math/s_catanhf.c>
 #include "cfloat-compat.h"
 
 #undef __catanhf
diff --git a/sysdeps/alpha/fpu/s_ccosf.c b/sysdeps/alpha/fpu/s_ccosf.c
index fd775903f0..04036f4613 100644
--- a/sysdeps/alpha/fpu/s_ccosf.c
+++ b/sysdeps/alpha/fpu/s_ccosf.c
@@ -1,5 +1,5 @@
 /* Return cosine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_ccosf (_Complex float x);
 
-#include <sysdeps/generic/s_ccosf.c>
+#include <math/s_ccosf.c>
 #include "cfloat-compat.h"
 
 #undef __ccosf
diff --git a/sysdeps/alpha/fpu/s_ccoshf.c b/sysdeps/alpha/fpu/s_ccoshf.c
index 0e8eab288f..e9fb34ce47 100644
--- a/sysdeps/alpha/fpu/s_ccoshf.c
+++ b/sysdeps/alpha/fpu/s_ccoshf.c
@@ -1,5 +1,5 @@
 /* Return hyperbole cosine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_ccoshf (_Complex float x);
 
-#include <sysdeps/generic/s_ccoshf.c>
+#include <math/s_ccoshf.c>
 #include "cfloat-compat.h"
 
 #undef __ccoshf
diff --git a/sysdeps/alpha/fpu/s_ceil.c b/sysdeps/alpha/fpu/s_ceil.c
index a7a46bb2b4..ec58fd9486 100644
--- a/sysdeps/alpha/fpu/s_ceil.c
+++ b/sysdeps/alpha/fpu/s_ceil.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <math.h>
+#include <math_ldbl_opt.h>
 
 /* Use the -inf rounding mode conversion instructions to implement
    ceil, via something akin to -floor(-x).  This is much faster than
@@ -52,3 +53,6 @@ weak_alias (__ceil, ceil)
 strong_alias (__ceil, __ceill)
 weak_alias (__ceil, ceill)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_cexpf.c b/sysdeps/alpha/fpu/s_cexpf.c
index 2cf6db4b55..4a28dcd9bf 100644
--- a/sysdeps/alpha/fpu/s_cexpf.c
+++ b/sysdeps/alpha/fpu/s_cexpf.c
@@ -1,5 +1,5 @@
 /* Return exponent of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_cexpf (_Complex float x);
 
-#include <sysdeps/generic/s_cexpf.c>
+#include <math/s_cexpf.c>
 #include "cfloat-compat.h"
 
 #undef __cexpf
diff --git a/sysdeps/alpha/fpu/s_clog10f.c b/sysdeps/alpha/fpu/s_clog10f.c
index 12ecdea957..e7dc7bb23f 100644
--- a/sysdeps/alpha/fpu/s_clog10f.c
+++ b/sysdeps/alpha/fpu/s_clog10f.c
@@ -1,5 +1,5 @@
 /* Return base 10 logarithm of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_clog10f (_Complex float x);
 
-#include <sysdeps/generic/s_clog10f.c>
+#include <math/s_clog10f.c>
 #include "cfloat-compat.h"
 
 #undef __clog10f
diff --git a/sysdeps/alpha/fpu/s_clogf.c b/sysdeps/alpha/fpu/s_clogf.c
index 9eefe9fa30..364dcec883 100644
--- a/sysdeps/alpha/fpu/s_clogf.c
+++ b/sysdeps/alpha/fpu/s_clogf.c
@@ -1,5 +1,5 @@
 /* Return natural logarithm of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_clogf (_Complex float x);
 
-#include <sysdeps/generic/s_clogf.c>
+#include <math/s_clogf.c>
 #include "cfloat-compat.h"
 
 #undef __clogf
diff --git a/sysdeps/alpha/fpu/s_copysign.c b/sysdeps/alpha/fpu/s_copysign.c
index e86778e840..52c632ec4c 100644
--- a/sysdeps/alpha/fpu/s_copysign.c
+++ b/sysdeps/alpha/fpu/s_copysign.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <math.h>
+#include <math_ldbl_opt.h>
 
 double
 __copysign (double x, double y)
@@ -31,3 +32,10 @@ weak_alias (__copysign, copysign)
 strong_alias (__copysign, __copysignl)
 weak_alias (__copysign, copysignl)
 #endif
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_cpowf.c b/sysdeps/alpha/fpu/s_cpowf.c
index f4cb3547f6..cc61b1895e 100644
--- a/sysdeps/alpha/fpu/s_cpowf.c
+++ b/sysdeps/alpha/fpu/s_cpowf.c
@@ -1,5 +1,5 @@
 /* Return power of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_cpowf (_Complex float x, _Complex float c);
 
-#include <sysdeps/generic/s_cpowf.c>
+#include <math/s_cpowf.c>
 #include "cfloat-compat.h"
 
 #undef __cpowf
diff --git a/sysdeps/alpha/fpu/s_cprojf.c b/sysdeps/alpha/fpu/s_cprojf.c
index eac8687707..5cfb526679 100644
--- a/sysdeps/alpha/fpu/s_cprojf.c
+++ b/sysdeps/alpha/fpu/s_cprojf.c
@@ -1,5 +1,5 @@
 /* Return projection of complex float value to Riemann sphere.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_cprojf (_Complex float x);
 
-#include <sysdeps/generic/s_cprojf.c>
+#include <math/s_cprojf.c>
 #include "cfloat-compat.h"
 
 #undef __cprojf
diff --git a/sysdeps/alpha/fpu/s_csinf.c b/sysdeps/alpha/fpu/s_csinf.c
index eba70e9930..8eb9a1019d 100644
--- a/sysdeps/alpha/fpu/s_csinf.c
+++ b/sysdeps/alpha/fpu/s_csinf.c
@@ -1,5 +1,5 @@
 /* Return sine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_csinf (_Complex float x);
 
-#include <sysdeps/generic/s_csinf.c>
+#include <math/s_csinf.c>
 #include "cfloat-compat.h"
 
 #undef __csinf
diff --git a/sysdeps/alpha/fpu/s_csinhf.c b/sysdeps/alpha/fpu/s_csinhf.c
index 9db81a81e4..0e2c186740 100644
--- a/sysdeps/alpha/fpu/s_csinhf.c
+++ b/sysdeps/alpha/fpu/s_csinhf.c
@@ -1,5 +1,5 @@
 /* Return hyperbole sine of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_csinhf (_Complex float x);
 
-#include <sysdeps/generic/s_csinhf.c>
+#include <math/s_csinhf.c>
 #include "cfloat-compat.h"
 
 #undef __csinhf
diff --git a/sysdeps/alpha/fpu/s_csqrtf.c b/sysdeps/alpha/fpu/s_csqrtf.c
index cc4a8e0245..ebf23a828e 100644
--- a/sysdeps/alpha/fpu/s_csqrtf.c
+++ b/sysdeps/alpha/fpu/s_csqrtf.c
@@ -1,5 +1,5 @@
 /* Return square root of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_csqrtf (_Complex float x);
 
-#include <sysdeps/generic/s_csqrtf.c>
+#include <math/s_csqrtf.c>
 #include "cfloat-compat.h"
 
 #undef __csqrtf
diff --git a/sysdeps/alpha/fpu/s_ctanf.c b/sysdeps/alpha/fpu/s_ctanf.c
index 843ee53717..e26db963e4 100644
--- a/sysdeps/alpha/fpu/s_ctanf.c
+++ b/sysdeps/alpha/fpu/s_ctanf.c
@@ -1,5 +1,5 @@
 /* Return tangent of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_ctanf (_Complex float x);
 
-#include <sysdeps/generic/s_ctanf.c>
+#include <math/s_ctanf.c>
 #include "cfloat-compat.h"
 
 #undef __ctanf
diff --git a/sysdeps/alpha/fpu/s_ctanhf.c b/sysdeps/alpha/fpu/s_ctanhf.c
index f1f74ab12d..5d047bd460 100644
--- a/sysdeps/alpha/fpu/s_ctanhf.c
+++ b/sysdeps/alpha/fpu/s_ctanhf.c
@@ -1,5 +1,5 @@
 /* Return hyperbole tangent of complex float value.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -29,7 +29,7 @@
 
 static _Complex float internal_ctanhf (_Complex float x);
 
-#include <sysdeps/generic/s_ctanhf.c>
+#include <math/s_ctanhf.c>
 #include "cfloat-compat.h"
 
 #undef __ctanhf
diff --git a/sysdeps/alpha/fpu/s_fabs.c b/sysdeps/alpha/fpu/s_fabs.c
index f7a2f9353b..9bc42f68d0 100644
--- a/sysdeps/alpha/fpu/s_fabs.c
+++ b/sysdeps/alpha/fpu/s_fabs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <math.h>
+#include <math_ldbl_opt.h>
 
 double
 __fabs (double x)
@@ -35,3 +36,6 @@ weak_alias (__fabs, fabs)
 strong_alias (__fabs, __fabsl)
 weak_alias (__fabs, fabsl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_floor.c b/sysdeps/alpha/fpu/s_floor.c
index c6872f5fcf..b22c52303d 100644
--- a/sysdeps/alpha/fpu/s_floor.c
+++ b/sysdeps/alpha/fpu/s_floor.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <math.h>
+#include <math_ldbl_opt.h>
 
 
 /* Use the -inf rounding mode conversion instructions to implement
@@ -53,3 +54,6 @@ weak_alias (__floor, floor)
 strong_alias (__floor, __floorl)
 weak_alias (__floor, floorl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/fpu/s_rint.c b/sysdeps/alpha/fpu/s_rint.c
index 61cba04c27..be09651b35 100644
--- a/sysdeps/alpha/fpu/s_rint.c
+++ b/sysdeps/alpha/fpu/s_rint.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <math.h>
+#include <math_ldbl_opt.h>
 
 
 double
@@ -48,3 +49,6 @@ weak_alias (__rint, rint)
 strong_alias (__rint, __rintl)
 weak_alias (__rint, rintl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/alpha/htonl.S b/sysdeps/alpha/htonl.S
index eb4fbd2ab4..ef2a575995 100644
--- a/sysdeps/alpha/htonl.S
+++ b/sysdeps/alpha/htonl.S
@@ -41,4 +41,4 @@ ENTRY(htonl)
 
 	END(htonl)
 
-weak_alias(htonl, ntohl)
+weak_alias (htonl, ntohl)
diff --git a/sysdeps/alpha/htons.S b/sysdeps/alpha/htons.S
index f1ef754814..7c6270226d 100644
--- a/sysdeps/alpha/htons.S
+++ b/sysdeps/alpha/htons.S
@@ -37,4 +37,4 @@ ENTRY(htons)
 
 	END(htons)
 
-weak_alias(htons, ntohs)
+weak_alias (htons, ntohs)
diff --git a/sysdeps/alpha/jmpbuf-offsets.h b/sysdeps/alpha/jmpbuf-offsets.h
new file mode 100644
index 0000000000..c2503d442a
--- /dev/null
+++ b/sysdeps/alpha/jmpbuf-offsets.h
@@ -0,0 +1,36 @@
+/* Private macros for accessing __jmp_buf contents.  Alpha version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define JB_S0  0
+#define JB_S1  1
+#define JB_S2  2
+#define JB_S3  3
+#define JB_S4  4
+#define JB_S5  5
+#define JB_PC  6
+#define JB_FP  7
+#define JB_SP  8
+#define JB_F2  9
+#define JB_F3  10
+#define JB_F4  11
+#define JB_F5  12
+#define JB_F6  13
+#define JB_F7  14
+#define JB_F8  15
+#define JB_F9  16
diff --git a/sysdeps/alpha/jmpbuf-unwind.h b/sysdeps/alpha/jmpbuf-unwind.h
new file mode 100644
index 0000000000..ca5f693d5d
--- /dev/null
+++ b/sysdeps/alpha/jmpbuf-unwind.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+   variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
+  ((void *)(_address) < (void *) _demangle ((_jmpbuf)[JB_SP]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_SP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/alpha/ldiv.S b/sysdeps/alpha/ldiv.S
index 3909672782..0a971a7ed0 100644
--- a/sysdeps/alpha/ldiv.S
+++ b/sysdeps/alpha/ldiv.S
@@ -214,3 +214,5 @@ $divbyzero:
 	ret
 
 	.end	ldiv
+
+weak_alias (ldiv, lldiv)
diff --git a/sysdeps/alpha/libc-tls.c b/sysdeps/alpha/libc-tls.c
index 434d5d9313..24629e9aca 100644
--- a/sysdeps/alpha/libc-tls.c
+++ b/sysdeps/alpha/libc-tls.c
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  Alpha version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 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
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdeps/generic/libc-tls.c>
+#include <csu/libc-tls.c>
 #include <dl-tls.h>
 
 #if USE_TLS
@@ -31,7 +31,7 @@ void *
 __tls_get_addr (tls_index *ti)
 {
   dtv_t *dtv = THREAD_DTV ();
-  return (char *) dtv[1].pointer + ti->ti_offset;
+  return (char *) dtv[1].pointer.val + ti->ti_offset;
 }
 
 #endif
diff --git a/sysdeps/alpha/reml.S b/sysdeps/alpha/reml.S
index bfc3be5c3f..ae291b0505 100644
--- a/sysdeps/alpha/reml.S
+++ b/sysdeps/alpha/reml.S
@@ -38,7 +38,7 @@
 	.text
 	.align	4
 	.globl	__reml
-	.type	__reml, @function
+	.type	__reml, @funcnoplt
 	.usepv	__reml, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/remq.S b/sysdeps/alpha/remq.S
index 645a834453..64e958bb95 100644
--- a/sysdeps/alpha/remq.S
+++ b/sysdeps/alpha/remq.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__remq
-	.type	__remq, @function
+	.type	__remq, @funcnoplt
 	.usepv	__remq, no
 
 	cfi_startproc
diff --git a/sysdeps/alpha/remqu.S b/sysdeps/alpha/remqu.S
index bfa78dff57..398a345a18 100644
--- a/sysdeps/alpha/remqu.S
+++ b/sysdeps/alpha/remqu.S
@@ -43,7 +43,7 @@
 	.text
 	.align	4
 	.globl	__remqu
-	.type	__remqu, @function
+	.type	__remqu, @funcnoplt
 	.usepv	__remqu, no
 
 	cfi_startproc
@@ -246,7 +246,7 @@ $y_is_neg:
 	   from the divide will be completely wrong.  Fortunately, the
 	   quotient must be either 0 or 1, so the remainder must be X
 	   or X-Y, so just compute it directly.  */
-	cmpult	Y, X, AT
+	cmpule	Y, X, AT
 	subq	X, Y, RV
 	ldt	$f0, 0(sp)
 	cmoveq	AT, X, RV
diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S
index 14a0320cd3..bc5da0f5bc 100644
--- a/sysdeps/alpha/setjmp.S
+++ b/sysdeps/alpha/setjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1994,1996,1997,2002,2006 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
@@ -19,20 +19,24 @@
 #define __ASSEMBLY__
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
-       .ent __sigsetjmp
-       .global __sigsetjmp
+	.ent __sigsetjmp
+	.global __sigsetjmp
 __sigsetjmp:
-       ldgp    gp, 0(pv)
+	ldgp    gp, 0(pv)
 
 $sigsetjmp_local:
-       subq    sp, 16, sp
-       .frame  sp, 16, ra, 0
-       stq     ra, 0(sp)
-       .mask   0x04000000, -16
+#ifndef PIC
+#define FRAME	16
+	subq    sp, FRAME, sp
+	.frame  sp, FRAME, ra, 0
+	stq     ra, 0(sp)
+	.mask   0x04000000, -FRAME
+#else
+#define FRAME	0
+	.frame	sp, FRAME, ra, 0
+#endif
 #ifdef PROF
 	.set noat
 	lda	AT, _mcount
@@ -47,10 +51,27 @@ $sigsetjmp_local:
 	stq	s3, JB_S3*8(a0)
 	stq	s4, JB_S4*8(a0)
 	stq	s5, JB_S5*8(a0)
+#ifdef PTR_MANGLE
+	PTR_MANGLE(t1, ra, t0)
+	stq	t1, JB_PC*8(a0)
+#else
 	stq	ra, JB_PC*8(a0)
-	addq	sp, 16, t0
+#endif
+#if defined(PTR_MANGLE) && FRAME == 0
+	PTR_MANGLE2(t1, sp, t0)
+#else
+	addq	sp, FRAME, t1
+# ifdef PTR_MANGLE
+	PTR_MANGLE2(t1, t1, t0)
+# endif
+#endif
+	stq	t1, JB_SP*8(a0)
+#ifdef PTR_MANGLE
+	PTR_MANGLE2(t1, fp, t0)
+	stq	t1, JB_FP*8(a0)
+#else
 	stq	fp, JB_FP*8(a0)
-	stq	t0, JB_SP*8(a0)
+#endif
 	stt	$f2, JB_F2*8(a0)
 	stt	$f3, JB_F3*8(a0)
 	stt	$f4, JB_F4*8(a0)
@@ -60,12 +81,20 @@ $sigsetjmp_local:
 	stt	$f8, JB_F8*8(a0)
 	stt	$f9, JB_F9*8(a0)
 
+#ifndef PIC
 	/* Call to C to (potentially) save our signal mask.  */
 	jsr	ra, __sigjmp_save
-
 	ldq	ra, 0(sp)
 	addq	sp, 16, sp
 	ret
+#elif defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	mov	0, v0
+	ret
+#else
+	/* Tailcall to save the signal mask.  */
+	br	$31, __sigjmp_save	!samegp
+#endif
 
 END(__sigsetjmp)
 
diff --git a/sysdeps/alpha/soft-fp/Dist b/sysdeps/alpha/soft-fp/Dist
deleted file mode 100644
index 3d75ee78b5..0000000000
--- a/sysdeps/alpha/soft-fp/Dist
+++ /dev/null
@@ -1,14 +0,0 @@
-local-soft-fp.h
-ots_add.c
-ots_cmp.c
-ots_cmpe.c
-ots_cvtqux.c
-ots_cvtqx.c
-ots_cvttx.c
-ots_cvtxq.c
-ots_cvtxt.c
-ots_div.c
-ots_mul.c
-ots_nintxq.c
-ots_sub.c
-sfp-machine.h
diff --git a/sysdeps/alpha/soft-fp/Makefile b/sysdeps/alpha/soft-fp/Makefile
index d7e7e2684a..5410a78984 100644
--- a/sysdeps/alpha/soft-fp/Makefile
+++ b/sysdeps/alpha/soft-fp/Makefile
@@ -4,3 +4,7 @@ ifeq ($(subdir),soft-fp)
 sysdep_routines += ots_add ots_sub ots_mul ots_div ots_cmp ots_cmpe	\
 	ots_cvtxq ots_cvtqx ots_cvtqux ots_cvttx ots_cvtxt ots_nintxq
 endif
+
+ifeq ($(subdir),math)
+CPPFLAGS += -I../soft-fp
+endif
diff --git a/sysdeps/alpha/soft-fp/e_sqrtl.c b/sysdeps/alpha/soft-fp/e_sqrtl.c
new file mode 100644
index 0000000000..717d170127
--- /dev/null
+++ b/sysdeps/alpha/soft-fp/e_sqrtl.c
@@ -0,0 +1,40 @@
+/* long double square root in software floating-point emulation.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson (rth@cygnus.com) and
+		  Jakub Jelinek (jj@ultra.linux.cz).
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdlib.h>
+#include <soft-fp.h>
+#include <quad.h>
+
+long double
+__ieee754_sqrtl (const long double a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A); FP_DECL_Q(C);
+  long double c;
+  long _round = 4;	/* dynamic rounding */
+
+  FP_INIT_ROUNDMODE;
+  FP_UNPACK_Q(A, a);
+  FP_SQRT_Q(C, A);
+  FP_PACK_Q(c, C);
+  FP_HANDLE_EXCEPTIONS;
+  return c;
+}
diff --git a/sysdeps/alpha/soft-fp/ots_add.c b/sysdeps/alpha/soft-fp/ots_add.c
index b4f6c28f3d..acf66f316b 100644
--- a/sysdeps/alpha/soft-fp/ots_add.c
+++ b/sysdeps/alpha/soft-fp/ots_add.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: addition.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,10 +29,10 @@ _OtsAddX(long al, long ah, long bl, long bh, long _round)
   FP_DECL_RETURN(c);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_ADD_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
 
   FP_RETURN(c);
diff --git a/sysdeps/alpha/soft-fp/ots_cvtqux.c b/sysdeps/alpha/soft-fp/ots_cvtqux.c
index d7ab5bae43..82c50806c4 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtqux.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtqux.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: unsigned integer to float conversion.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -33,8 +33,8 @@ _OtsCvtQUX (unsigned long a)
   FP_DECL_Q(C);
   FP_DECL_RETURN(c);
 
-  FP_FROM_INT_Q(C, a, 64, long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, a, 64, unsigned long);
+  FP_PACK_RAW_Q(c, C);
 
   FP_RETURN(c);
 }
diff --git a/sysdeps/alpha/soft-fp/ots_cvtqx.c b/sysdeps/alpha/soft-fp/ots_cvtqx.c
index 0e1c6bdc41..dc80291506 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtqx.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtqx.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: signed integer to float conversion.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -33,7 +33,7 @@ _OtsCvtQX (long a)
   FP_DECL_Q(C);
   FP_DECL_RETURN(c);
 
-  FP_FROM_INT_Q(C, a, 64, long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, a, 64, unsigned long);
+  FP_PACK_RAW_Q(c, C);
   FP_RETURN(c);
 }
diff --git a/sysdeps/alpha/soft-fp/ots_cvttx.c b/sysdeps/alpha/soft-fp/ots_cvttx.c
index ee5ac324cd..2d0bc9bca9 100644
--- a/sysdeps/alpha/soft-fp/ots_cvttx.c
+++ b/sysdeps/alpha/soft-fp/ots_cvttx.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: floating point extension.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -35,13 +35,13 @@ _OtsConvertFloatTX(double a)
   FP_DECL_Q(C);
   FP_DECL_RETURN(c);
 
-  FP_UNPACK_D(A, a);
+  FP_UNPACK_RAW_D(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,D,4,2,C,A);
+  FP_EXTEND(Q,D,4,2,C,A);
 #else
-  FP_CONV(Q,D,2,1,C,A);
+  FP_EXTEND(Q,D,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
 
   FP_RETURN(c);
diff --git a/sysdeps/alpha/soft-fp/ots_cvtxq.c b/sysdeps/alpha/soft-fp/ots_cvtxq.c
index 1fd47da4f7..2c9df529d5 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtxq.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtxq.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: float to integer conversion.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -26,14 +26,15 @@ _OtsCvtXQ (long al, long ah, long _round)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  long r, s;
+  unsigned long r;
+  long s;
 
   /* If bit 3 is set, then integer overflow detection is requested.  */
   s = _round & 8 ? 1 : -1;
   _round = _round & 3;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 64, s);
 
   if (s > 0 && (_fex &= FP_EX_INVALID))
diff --git a/sysdeps/alpha/soft-fp/ots_cvtxt.c b/sysdeps/alpha/soft-fp/ots_cvtxt.c
index 2629dd9e40..6221a2365c 100644
--- a/sysdeps/alpha/soft-fp/ots_cvtxt.c
+++ b/sysdeps/alpha/soft-fp/ots_cvtxt.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: floating point truncation.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,13 +31,13 @@ _OtsConvertFloatXT (long al, long ah, long _round)
   double r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(D,Q,2,4,R,A);
+  FP_TRUNC(D,Q,2,4,R,A);
 #else
-  FP_CONV(D,Q,1,2,R,A);
+  FP_TRUNC(D,Q,1,2,R,A);
 #endif
-  FP_PACK_D(r, R);
+  FP_PACK_SEMIRAW_D(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/alpha/soft-fp/ots_nintxq.c b/sysdeps/alpha/soft-fp/ots_nintxq.c
index 2cb1ca4c2a..a718372af7 100644
--- a/sysdeps/alpha/soft-fp/ots_nintxq.c
+++ b/sysdeps/alpha/soft-fp/ots_nintxq.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: convert to fortran nearest.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -26,22 +26,24 @@ _OtsNintXQ (long al, long ah, long _round)
 {
   FP_DECL_EX;
   FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C);
-  long r, s;
+  unsigned long r;
+  long s;
 
   /* If bit 3 is set, then integer overflow detection is requested.  */
   s = _round & 8 ? 1 : -1;
   _round = _round & 3;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 
   /* Build 0.5 * sign(A) */
   B_e = _FP_EXPBIAS_Q;
-  __FP_FRAC_SET_2 (B, _FP_IMPLBIT_Q, 0);
+  __FP_FRAC_SET_2 (B, 0, 0);
   B_s = A_s;
-  _FP_UNPACK_CANONICAL(Q,2,B);
 
   FP_ADD_Q(C, A, B);
+  _FP_FRAC_SRL_2(C, _FP_WORKBITS);
+  _FP_FRAC_HIGH_RAW_Q(C) &= ~(_FP_W_TYPE)_FP_IMPLBIT_Q;
   FP_TO_INT_Q(r, C, 64, s);
   if (s > 0 && (_fex &= FP_EX_INVALID))
     FP_HANDLE_EXCEPTIONS;
diff --git a/sysdeps/alpha/soft-fp/ots_sub.c b/sysdeps/alpha/soft-fp/ots_sub.c
index c10043f071..5147266a04 100644
--- a/sysdeps/alpha/soft-fp/ots_sub.c
+++ b/sysdeps/alpha/soft-fp/ots_sub.c
@@ -1,5 +1,5 @@
 /* Software floating-point emulation: subtraction.
-   Copyright (C) 1997,1999,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,10 +29,10 @@ _OtsSubX(long al, long ah, long bl, long bh, long _round)
   FP_DECL_RETURN(c);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_SUB_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
 
   FP_RETURN(c);
diff --git a/sysdeps/alpha/strncmp.S b/sysdeps/alpha/strncmp.S
index e2b4ebf857..ff199eb743 100644
--- a/sysdeps/alpha/strncmp.S
+++ b/sysdeps/alpha/strncmp.S
@@ -61,8 +61,10 @@ $aligned:
 	ornot	t0, t3, t0	# .. e1 :
 	cmpbge	zero, t1, t7	# e0    : bits set iff null found
 	beq	a2, $eoc	# .. e1 : check end of count
-	subq	a2, 1, a2	# e0    :
+	unop			# e0    :
 	bne	t7, $eos	# .. e1 :
+	unop			# e0    :
+	beq	t10, $ant_loop	# .. e1 :
 
 	/* Aligned compare main loop.
 	   On entry to this basic block:
@@ -74,13 +76,30 @@ $a_loop:
 	bne	t2, $wordcmp	# .. e1 (zdb)
 	ldq_u	t1, 8(a1)	# e0    :
 	ldq_u	t0, 8(a0)	# .. e1 :
+	subq	a2, 1, a2	# e0    :
+	addq	a1, 8, a1	# .. e1 :
+	addq	a0, 8, a0	# e0    :
+	beq	a2, $eoc	# .. e1 :
+	cmpbge	zero, t1, t7	# e0    :
+	beq	t7, $a_loop	# .. e1 :
+	unop			# e0    :
+	br	$eos		# .. e1 :
+
+	/* Alternate aligned compare loop, for when there's no trailing
+	   bytes on the count.  We have to avoid reading too much data.  */
+$ant_loop:
+	xor	t0, t1, t2	# e0	:
+	bne	t2, $wordcmp	# .. e1 (zdb)
+	subq	a2, 1, a2	# e0    :
+	beq	a2, $zerolength	# .. e1 :
+	ldq_u	t1, 8(a1)	# e0    :
+	ldq_u	t0, 8(a0)	# .. e1 :
 	addq	a1, 8, a1	# e0    :
 	addq	a0, 8, a0	# .. e1 :
 	cmpbge	zero, t1, t7	# e0    :
-	beq	a2, $eoc	# .. e1 :
-	subq	a2, 1, a2	# e0    :
-	beq	t7, $a_loop	# .. e1 :
-	br	$eos		# e1    :
+	beq	t7, $ant_loop	# .. e1 :
+	unop			# e0	:
+	br	$eos		# .. e1 :
 
 	/* The two strings are not co-aligned.  Align s1 and cope.  */
 $unaligned:
@@ -184,6 +203,8 @@ $u_final:
 $eoc:
 	mskql	t0, t10, t0
 	mskql	t1, t10, t1
+	unop
+	cmpbge	zero, t1, t7
 
 	/* We've found a zero somewhere in a word we just read.
 	   On entry to this basic block:
@@ -203,6 +224,7 @@ $eos:
 
 	/* Here we have two differing co-aligned words in t0 & t1.
 	   Bytewise compare them and return (t0 > t1 ? 1 : -1).  */
+	.align 3
 $wordcmp:
 	cmpbge	t0, t1, t2	# e0    : comparison yields bit mask of ge
 	cmpbge	t1, t0, t3	# .. e1 :
@@ -216,6 +238,7 @@ $wordcmp:
 $done:
 	ret			# e1    :
 
+	.align 3
 $zerolength:
 	clr	v0
 	ret
diff --git a/sysdeps/arm/Dist b/sysdeps/arm/Dist
deleted file mode 100644
index 441c9ba492..0000000000
--- a/sysdeps/arm/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-ieee754.h
-bits/link.h
diff --git a/sysdeps/arm/Implies b/sysdeps/arm/Implies
deleted file mode 100644
index 780c4e2467..0000000000
--- a/sysdeps/arm/Implies
+++ /dev/null
@@ -1,3 +0,0 @@
-wordsize-32
-ieee754/flt-32
-ieee754/dbl-64
diff --git a/sysdeps/arm/__longjmp.S b/sysdeps/arm/__longjmp.S
deleted file mode 100644
index 7b30160047..0000000000
--- a/sysdeps/arm/__longjmp.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* longjmp for ARM.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
-
-/* __longjmp(jmpbuf, val) */
-
-ENTRY (__longjmp)
-	mov	ip, r0
-	movs	r0, r1		/* get the return value in place */
-	moveq	r0, #1		/* can't let setjmp() return zero! */
-
-	LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
-END (__longjmp)
diff --git a/sysdeps/arm/atomicity.h b/sysdeps/arm/atomicity.h
deleted file mode 100644
index 1a437a6d35..0000000000
--- a/sysdeps/arm/atomicity.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Low-level functions for atomic operations.  ARM version.
-   Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _ATOMICITY_H
-#define _ATOMICITY_H    1
-
-#include <inttypes.h>
-
-
-static inline int
-__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
-{
-  int tmp1;
-  int tmp2;
-  int result;
-  __asm__ ("\n"
-	   "0:\tldr\t%0,[%3]\n\t"
-	   "add\t%1,%0,%4\n\t"
-	   "swp\t%2,%1,[%3]\n\t"
-	   "cmp\t%0,%2\n\t"
-	   "swpne\t%1,%2,[%3]\n\t"
-	   "bne\t0b"
-	   : "=&r" (result), "=&r" (tmp1), "=&r" (tmp2)
-	   : "r" (mem), "r"(val)
-	   : "cc", "memory");
-  return result;
-}
-
-static inline void
-__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
-{
-  int tmp1;
-  int tmp2;
-  int tmp3;
-  __asm__ ("\n"
-	   "0:\tldr\t%0,[%3]\n\t"
-	   "add\t%1,%0,%4\n\t"
-	   "swp\t%2,%1,[%3]\n\t"
-	   "cmp\t%0,%2\n\t"
-	   "swpne\t%1,%2,[%3]\n\t"
-	   "bne\t0b"
-	   : "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3)
-	   : "r" (mem), "r"(val)
-	   : "cc", "memory");
-}
-
-static inline int
-__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
-{
-  int result, tmp;
-  __asm__ ("\n"
-	   "0:\tldr\t%1,[%2]\n\t"
-	   "mov\t%0,#0\n\t"
-	   "cmp\t%1,%4\n\t"
-	   "bne\t1f\n\t"
-	   "swp\t%0,%3,[%2]\n\t"
-	   "cmp\t%1,%0\n\t"
-	   "swpne\t%1,%0,[%2]\n\t"
-	   "bne\t0b\n\t"
-	   "mov\t%0,#1\n"
-	   "1:"
-	   : "=&r" (result), "=&r" (tmp)
-	   : "r" (p), "r" (newval), "r" (oldval)
-	   : "cc", "memory");
-  return result;
-}
-
-#endif /* atomicity.h */
diff --git a/sysdeps/arm/bits/endian.h b/sysdeps/arm/bits/endian.h
deleted file mode 100644
index 5e54cc7534..0000000000
--- a/sysdeps/arm/bits/endian.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ARM is (usually) little-endian but with a big-endian FPU.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#ifdef __ARMEB__
-#define __BYTE_ORDER __BIG_ENDIAN
-#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
-#define __FLOAT_WORD_ORDER __BIG_ENDIAN
diff --git a/sysdeps/arm/bits/huge_val.h b/sysdeps/arm/bits/huge_val.h
deleted file mode 100644
index 3339a0d01c..0000000000
--- a/sysdeps/arm/bits/huge_val.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   ARM version.
-   Copyright (C) 1992, 95, 96, 97, 98, 99, 2000, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VAL  (__builtin_huge_val())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VAL (__extension__ 0x1.0p2047)
-#elif defined __GNUC__
-
-# define HUGE_VAL \
-  (__extension__							      \
-   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
-    { __l: 0x000000007ff00000ULL }).__d)
-
-#else /* not GCC */
-
-# include <endian.h>
-
-typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __HUGE_VAL_bytes	{ 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
-# endif
-
-static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
-# define HUGE_VAL	(__huge_val.__d)
-
-#endif	/* GCC.  */
diff --git a/sysdeps/arm/bits/link.h b/sysdeps/arm/bits/link.h
deleted file mode 100644
index 648976d7d2..0000000000
--- a/sysdeps/arm/bits/link.h
+++ /dev/null
@@ -1,4 +0,0 @@
-struct link_map_machine
-  {
-    Elf32_Addr plt; /* Address of .plt */
-  };
diff --git a/sysdeps/arm/bits/setjmp.h b/sysdeps/arm/bits/setjmp.h
deleted file mode 100644
index e0a4657b47..0000000000
--- a/sysdeps/arm/bits/setjmp.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Define the machine-dependent type `jmp_buf'.  ARM version. */
-
-#ifndef _SETJMP_H
-# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-#endif
-
-#ifndef _ASM
-/* Jump buffer contains v1-v6, sl, fp, sp and pc.  Other registers are not
-   saved.  */
-typedef int __jmp_buf[10];
-#endif
-
-#define __JMP_BUF_SP		8
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf[__JMP_BUF_SP]))
diff --git a/sysdeps/arm/bits/string.h b/sysdeps/arm/bits/string.h
deleted file mode 100644
index 206f956dfd..0000000000
--- a/sysdeps/arm/bits/string.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Optimized, inlined string functions.  ARM version.
-   Copyright (C) 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _STRING_H
-# error "Never use <bits/string.h> directly; include <string.h> instead."
-#endif
-
-/* We must defeat the generic optimized versions of these functions in
-   <bits/string2.h> since they don't work on the ARM.  This is because
-   the games they play with the __STRING2_COPY_ARR# structures fail
-   when structs are always 32-bit aligned.
-   XXX Should provide suitably optimal replacements.  */
-#define _HAVE_STRING_ARCH_strcpy 1
-#define _HAVE_STRING_ARCH_stpcpy 1
-#define _HAVE_STRING_ARCH_mempcpy 1
diff --git a/sysdeps/arm/bsd-_setjmp.S b/sysdeps/arm/bsd-_setjmp.S
deleted file mode 100644
index c4a094e505..0000000000
--- a/sysdeps/arm/bsd-_setjmp.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  ARM version.
-   Copyright (C) 1997, 1998, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-#include <sysdep.h>
-
-ENTRY (_setjmp)
-	mov	r1, #0
-	b	PLTJMP(C_SYMBOL_NAME(__sigsetjmp))
-END (_setjmp)
-libc_hidden_def (_setjmp)
diff --git a/sysdeps/arm/bsd-setjmp.S b/sysdeps/arm/bsd-setjmp.S
deleted file mode 100644
index d227ba68a6..0000000000
--- a/sysdeps/arm/bsd-setjmp.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  ARM version.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-#include <sysdep.h>
-
-ENTRY (setjmp)
-	mov	r1, #1
-	b	PLTJMP(C_SYMBOL_NAME(__sigsetjmp))
-END (setjmp)
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
deleted file mode 100644
index 761f8daeaa..0000000000
--- a/sysdeps/arm/dl-machine.h
+++ /dev/null
@@ -1,636 +0,0 @@
-/* Machine-dependent ELF dynamic relocation inline functions.  ARM version.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef dl_machine_h
-#define dl_machine_h
-
-#define ELF_MACHINE_NAME "ARM"
-
-#include <sys/param.h>
-
-#define VALID_ELF_ABIVERSION(ver)	(ver == 0)
-#define VALID_ELF_OSABI(osabi) \
-  (osabi == ELFOSABI_SYSV || osabi == ELFOSABI_ARM)
-#define VALID_ELF_HEADER(hdr,exp,size) \
-  memcmp (hdr,exp,size-2) == 0 \
-  && VALID_ELF_OSABI (hdr[EI_OSABI]) \
-  && VALID_ELF_ABIVERSION (hdr[EI_ABIVERSION])
-
-#define CLEAR_CACHE(BEG,END)						\
-{									\
-  register unsigned long _beg __asm ("a1") = (unsigned long)(BEG);	\
-  register unsigned long _end __asm ("a2") = (unsigned long)(END);	\
-  register unsigned long _flg __asm ("a3") = 0;				\
-  __asm __volatile ("swi 0x9f0002		@ sys_cacheflush"	\
-		    : /* no outputs */					\
-		    : /* no inputs */					\
-		    : "a1");						\
-}
-
-/* Return nonzero iff ELF header is compatible with the running host.  */
-static inline int __attribute__ ((unused))
-elf_machine_matches_host (const Elf32_Ehdr *ehdr)
-{
-  return ehdr->e_machine == EM_ARM;
-}
-
-
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-   first element of the GOT.  This must be inlined in a function which
-   uses global data.  */
-static inline Elf32_Addr __attribute__ ((unused))
-elf_machine_dynamic (void)
-{
-  register Elf32_Addr *got asm ("r10");
-  return *got;
-}
-
-
-/* Return the run-time load address of the shared object.  */
-static inline Elf32_Addr __attribute__ ((unused))
-elf_machine_load_address (void)
-{
-  extern void __dl_start asm ("_dl_start");
-  Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
-  Elf32_Addr pcrel_addr;
-  asm ("adr %0, _dl_start" : "=r" (pcrel_addr));
-  return pcrel_addr - got_addr;
-}
-
-
-/* Set up the loaded object described by L so its unrelocated PLT
-   entries will jump to the on-demand fixup code in dl-runtime.c.  */
-
-static inline int __attribute__ ((unused))
-elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
-{
-  Elf32_Addr *got;
-  extern void _dl_runtime_resolve (Elf32_Word);
-  extern void _dl_runtime_profile (Elf32_Word);
-
-  if (l->l_info[DT_JMPREL] && lazy)
-    {
-      /* patb: this is different than i386 */
-      /* The GOT entries for functions in the PLT have not yet been filled
-	 in.  Their initial contents will arrange when called to push an
-	 index into the .got section, load ip with &_GLOBAL_OFFSET_TABLE_[3],
-	 and then jump to _GLOBAL_OFFSET_TABLE[2].  */
-      got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
-      /* If a library is prelinked but we have to relocate anyway,
-	 we have to be able to undo the prelinking of .got.plt.
-	 The prelinker saved us here address of .plt.  */
-      if (got[1])
-	l->l_mach.plt = got[1] + l->l_addr;
-      got[1] = (Elf32_Addr) l;	/* Identify this shared object.  */
-
-      /* The got[2] entry contains the address of a function which gets
-	 called to get the address of a so far unresolved function and
-	 jump to it.  The profiling extension of the dynamic linker allows
-	 to intercept the calls to collect information.  In this case we
-	 don't store the address in the GOT so that all future calls also
-	 end in this function.  */
-      if (profile)
-	{
-	  got[2] = (Elf32_Addr) &_dl_runtime_profile;
-
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
-	    /* Say that we really want profiling and the timers are
-	       started.  */
-	    GL(dl_profile_map) = l;
-	}
-      else
-	/* This function will get called to fix up the GOT entry indicated by
-	   the offset on the stack, and then jump to the resolved address.  */
-	got[2] = (Elf32_Addr) &_dl_runtime_resolve;
-    }
-  return lazy;
-}
-
-#if defined(__USE_BX__)
-#define BX(x) "bx\t" #x
-#else
-#define BX(x) "mov\tpc, " #x
-#endif
-
-#ifndef PROF
-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.type _dl_runtime_resolve, #function\n\
-	.align 2\n\
-_dl_runtime_resolve:\n\
-	@ we get called with\n\
-	@ 	stack[0] contains the return address from this call\n\
-	@	ip contains &GOT[n+3] (pointer to function)\n\
-	@	lr points to &GOT[2]\n\
-\n\
-	@ stack arguments\n\
-	stmdb	sp!,{r0-r3}\n\
-\n\
-	@ get pointer to linker struct\n\
-	ldr	r0, [lr, #-4]\n\
-\n\
-	@ prepare to call fixup()\n\
-	@ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
-	sub	r1, ip, lr\n\
-	sub	r1, r1, #4\n\
-	add	r1, r1, r1\n\
-\n\
-	@ call fixup routine\n\
-	bl	fixup\n\
-\n\
-	@ save the return\n\
-	mov	ip, r0\n\
-\n\
-	@ get arguments and return address back\n\
-	ldmia	sp!, {r0-r3,lr}\n\
-\n\
-	@ jump to the newly found address\n\
-	" BX(ip) "\n\
-\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_profile, #function\n\
-	.align 2\n\
-_dl_runtime_profile:\n\
-	@ stack arguments\n\
-	stmdb	sp!, {r0-r3}\n\
-\n\
-	@ get pointer to linker struct\n\
-	ldr	r0, [lr, #-4]\n\
-\n\
-	@ prepare to call fixup()\n\
-	@ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
-	sub	r1, ip, lr\n\
-	sub	r1, r1, #4\n\
-	add	r1, r1, r1\n\
-\n\
-	@ call profiling fixup routine\n\
-	bl	profile_fixup\n\
-\n\
-	@ save the return\n\
-	mov	ip, r0\n\
-\n\
-	@ get arguments and return address back\n\
-	ldmia	sp!, {r0-r3,lr}\n\
-\n\
-	@ jump to the newly found address\n\
-	" BX(ip) "\n\
-\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-	.previous\n\
-");
-#else // PROF
-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_resolve, #function\n\
-	.type _dl_runtime_profile, #function\n\
-	.align 2\n\
-_dl_runtime_resolve:\n\
-_dl_runtime_profile:\n\
-	@ we get called with\n\
-	@ 	stack[0] contains the return address from this call\n\
-	@	ip contains &GOT[n+3] (pointer to function)\n\
-	@	lr points to &GOT[2]\n\
-\n\
-	@ stack arguments\n\
-	stmdb	sp!, {r0-r3}\n\
-\n\
-	@ get pointer to linker struct\n\
-	ldr	r0, [lr, #-4]\n\
-\n\
-	@ prepare to call fixup()\n\
-	@ change &GOT[n+3] into 8*n        NOTE: reloc are 8 bytes each\n\
-	sub	r1, ip, lr\n\
-	sub	r1, r1, #4\n\
-	add	r1, r1, r1\n\
-\n\
-	@ call profiling fixup routine\n\
-	bl	fixup\n\
-\n\
-	@ save the return\n\
-	mov	ip, r0\n\
-\n\
-	@ get arguments and return address back\n\
-	ldmia	sp!, {r0-r3,lr}\n\
-\n\
-	@ jump to the newly found address\n\
-	" BX(ip) "\n\
-\n\
-	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
-	.previous\n\
-");
-#endif //PROF
-
-/* Mask identifying addresses reserved for the user program,
-   where the dynamic linker should not map anything.  */
-#define ELF_MACHINE_USER_ADDRESS_MASK	0xf8000000UL
-
-/* Initial entry point code for the dynamic linker.
-   The C function `_dl_start' is the real entry point;
-   its return value is the user program's entry point.  */
-
-#define RTLD_START asm ("\
-.text\n\
-.globl _start\n\
-.globl _dl_start_user\n\
-_start:\n\
-	@ we are PIC code, so get global offset table\n\
-	ldr	sl, .L_GET_GOT\n\
-	@ See if we were run as a command with the executable file\n\
-	@ name as an extra leading argument.\n\
-	ldr	r4, .L_SKIP_ARGS\n\
-	@ at start time, all the args are on the stack\n\
-	mov	r0, sp\n\
-	bl	_dl_start\n\
-	@ returns user entry point in r0\n\
-_dl_start_user:\n\
-	add	sl, pc, sl\n\
-.L_GOT_GOT:\n\
-	ldr	r4, [sl, r4]\n\
-	@ get the original arg count\n\
-	ldr	r1, [sp]\n\
-	@ save the entry point in another register\n\
-	mov	r6, r0\n\
-	@ adjust the stack pointer to skip the extra args\n\
-	add	sp, sp, r4, lsl #2\n\
-	@ subtract _dl_skip_args from original arg count\n\
-	sub	r1, r1, r4\n\
-	@ get the argv address\n\
-	add	r2, sp, #4\n\
-	@ store the new argc in the new stack location\n\
-	str	r1, [sp]\n\
-	@ compute envp\n\
-	add	r3, r2, r1, lsl #2\n\
-	add	r3, r3, #4\n\
-\n\
-	@ now we call _dl_init\n\
-	ldr	r0, .L_LOADED\n\
-	ldr	r0, [sl, r0]\n\
-	@ call _dl_init\n\
-	bl	_dl_init_internal(PLT)\n\
-	@ load the finalizer function\n\
-	ldr	r0, .L_FINI_PROC\n\
-	add	r0, sl, r0\n\
-	@ jump to the user_s entry point\n\
-	" BX(r6) "\n\
-.L_GET_GOT:\n\
-	.word	_GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n\
-.L_SKIP_ARGS:\n\
-	.word	_dl_skip_args(GOTOFF)\n\
-.L_FINI_PROC:\n\
-	.word	_dl_fini(GOTOFF)\n\
-.L_LOADED:\n\
-	.word	_rtld_local(GOTOFF)\n\
-.previous\n\
-");
-
-/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.
-   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
-   of the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_type_class(type) \
-  ((((type) == R_ARM_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
-#define ELF_MACHINE_JMP_SLOT	R_ARM_JUMP_SLOT
-
-/* ARM never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
-#define ELF_MACHINE_PLT_REL 1
-
-/* We define an initialization functions.  This is called very early in
-   _dl_sysdep_start.  */
-#define DL_PLATFORM_INIT dl_platform_init ()
-
-static inline void __attribute__ ((unused))
-dl_platform_init (void)
-{
-  if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
-    /* Avoid an empty string which would disturb us.  */
-    GLRO(dl_platform) = NULL;
-}
-
-static inline Elf32_Addr
-elf_machine_fixup_plt (struct link_map *map, lookup_t t,
-		       const Elf32_Rel *reloc,
-		       Elf32_Addr *reloc_addr, Elf32_Addr value)
-{
-  return *reloc_addr = value;
-}
-
-/* Return the final value of a plt relocation.  */
-static inline Elf32_Addr
-elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
-		       Elf32_Addr value)
-{
-  return value;
-}
-
-#endif /* !dl_machine_h */
-
-#ifdef RESOLVE
-
-/* ARM never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
-# ifdef RTLD_BOOTSTRAP
-#  define ELF_MACHINE_NO_RELA 1
-# endif
-
-/* Deal with an out-of-range PC24 reloc.  */
-static Elf32_Addr
-fix_bad_pc24 (Elf32_Addr *const reloc_addr, Elf32_Addr value)
-{
-  static void *fix_page;
-  static unsigned int fix_offset;
-  static size_t pagesize;
-  Elf32_Word *fix_address;
-
-  if (! fix_page)
-    {
-      if (! pagesize)
-	pagesize = getpagesize ();
-      fix_page = mmap (NULL, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC,
-		       MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-      if (! fix_page)
-	assert (! "could not map page for fixup");
-      fix_offset = 0;
-    }
-
-  fix_address = (Elf32_Word *)(fix_page + fix_offset);
-  fix_address[0] = 0xe51ff004;	/* ldr pc, [pc, #-4] */
-  fix_address[1] = value;
-
-  fix_offset += 8;
-  if (fix_offset >= pagesize)
-    fix_page = NULL;
-
-  return (Elf32_Addr)fix_address;
-}
-
-/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
-   MAP is the object containing the reloc.  */
-
-static inline void
-elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
-		 const Elf32_Sym *sym, const struct r_found_version *version,
-		 void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
-  if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
-    {
-# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
-      /* This is defined in rtld.c, but nowhere in the static libc.a;
-	 make the reference weak so static programs can still link.
-	 This declaration cannot be done when compiling rtld.c
-	 (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
-	 common defn for _dl_rtld_map, which is incompatible with a
-	 weak decl in the same file.  */
-#  ifndef SHARED
-      weak_extern (_dl_rtld_map);
-#  endif
-      if (map != &GL(dl_rtld_map)) /* Already done in rtld itself.  */
-# endif
-	*reloc_addr += map->l_addr;
-    }
-# ifndef RTLD_BOOTSTRAP
-  else if (__builtin_expect (r_type == R_ARM_NONE, 0))
-    return;
-# endif
-  else
-#endif
-    {
-      const Elf32_Sym *const refsym = sym;
-      Elf32_Addr value = RESOLVE (&sym, version, r_type);
-      if (sym)
-	value += sym->st_value;
-
-      switch (r_type)
-	{
-	case R_ARM_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (sym->st_size > refsym->st_size
-	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
-	    {
-	      const char *strtab;
-
-	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
-%s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				rtld_progname ?: "<program name unknown>",
-				strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
-	case R_ARM_GLOB_DAT:
-	case R_ARM_JUMP_SLOT:
-# ifdef RTLD_BOOTSTRAP
-	  /* Fix weak undefined references.  */
-	  if (sym != NULL && sym->st_value == 0)
-	    *reloc_addr = 0;
-	  else
-# endif
-	    *reloc_addr = value;
-	  break;
-	case R_ARM_ABS32:
-	  {
-# ifndef RTLD_BOOTSTRAP
-	   /* This is defined in rtld.c, but nowhere in the static
-	      libc.a; make the reference weak so static programs can
-	      still link.  This declaration cannot be done when
-	      compiling rtld.c (i.e.  #ifdef RTLD_BOOTSTRAP) because
-	      rtld.c contains the common defn for _dl_rtld_map, which
-	      is incompatible with a weak decl in the same file.  */
-#  ifndef SHARED
-	    weak_extern (_dl_rtld_map);
-#  endif
-	    if (map == &GL(dl_rtld_map))
-	      /* Undo the relocation done here during bootstrapping.
-		 Now we will relocate it anew, possibly using a
-		 binding found in the user program or a loaded library
-		 rather than the dynamic linker's built-in definitions
-		 used while loading those libraries.  */
-	      value -= map->l_addr + refsym->st_value;
-# endif
-	    *reloc_addr += value;
-	    break;
-	  }
-	case R_ARM_PC24:
-	  {
-	     Elf32_Sword addend;
-	     Elf32_Addr newvalue, topbits;
-
-	     addend = *reloc_addr & 0x00ffffff;
-	     if (addend & 0x00800000) addend |= 0xff000000;
-
-	     newvalue = value - (Elf32_Addr)reloc_addr + (addend << 2);
-	     topbits = newvalue & 0xfe000000;
-	     if (topbits != 0xfe000000 && topbits != 0x00000000)
-	       {
-		 newvalue = fix_bad_pc24(reloc_addr, value)
-		   - (Elf32_Addr)reloc_addr + (addend << 2);
-		 topbits = newvalue & 0xfe000000;
-		 if (topbits != 0xfe000000 && topbits != 0x00000000)
-		   {
-		     _dl_signal_error (0, map->l_name, NULL,
-				       "R_ARM_PC24 relocation out of range");
-		   }
-	       }
-	     newvalue >>= 2;
-	     value = (*reloc_addr & 0xff000000) | (newvalue & 0x00ffffff);
-	     *reloc_addr = value;
-	  }
-	break;
-	default:
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
-	}
-    }
-}
-
-# ifndef RTLD_BOOTSTRAP
-static inline void
-elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
-		  const Elf32_Sym *sym, const struct r_found_version *version,
-		  void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-
-  if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
-    *reloc_addr = map->l_addr + reloc->r_addend;
-  else if (__builtin_expect (r_type == R_ARM_NONE, 0))
-    return;
-  else
-    {
-# ifndef RESOLVE_CONFLICT_FIND_MAP
-      const Elf32_Sym *const refsym = sym;
-# endif
-      Elf32_Addr value = RESOLVE (&sym, version, r_type);
-      if (sym)
-	value += sym->st_value;
-
-      switch (r_type)
-	{
-#  ifndef RESOLVE_CONFLICT_FIND_MAP
-	  /* Not needed for dl-conflict.c.  */
-	case R_ARM_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (sym->st_size > refsym->st_size
-	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
-	    {
-	      const char *strtab;
-
-	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
-%s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				rtld_progname ?: "<program name unknown>",
-				strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
-#  endif /* !RESOLVE_CONFLICT_FIND_MAP */
-	case R_ARM_GLOB_DAT:
-	case R_ARM_JUMP_SLOT:
-	case R_ARM_ABS32:
-	  *reloc_addr = value + reloc->r_addend;
-	  break;
-	case R_ARM_PC24:
-	  {
-	     Elf32_Addr newvalue, topbits;
-
-	     newvalue = value + reloc->r_addend - (Elf32_Addr)reloc_addr;
-	     topbits = newvalue & 0xfe000000;
-	     if (topbits != 0xfe000000 && topbits != 0x00000000)
-	       {
-		 newvalue = fix_bad_pc24(reloc_addr, value)
-		   - (Elf32_Addr)reloc_addr + (reloc->r_addend << 2);
-		 topbits = newvalue & 0xfe000000;
-		 if (topbits != 0xfe000000 && topbits != 0x00000000)
-		   {
-		     _dl_signal_error (0, map->l_name, NULL,
-				       "R_ARM_PC24 relocation out of range");
-		   }
-	       }
-	     newvalue >>= 2;
-	     value = (*reloc_addr & 0xff000000) | (newvalue & 0x00ffffff);
-	     *reloc_addr = value;
-	  }
-	  break;
-	default:
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
-	}
-    }
-}
-# endif
-
-static inline void
-elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
-			  void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  *reloc_addr += l_addr;
-}
-
-# ifndef RTLD_BOOTSTRAP
-static inline void
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
-			   void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  *reloc_addr = l_addr + reloc->r_addend;
-}
-# endif
-
-static inline void
-elf_machine_lazy_rel (struct link_map *map,
-		      Elf32_Addr l_addr, const Elf32_Rel *reloc)
-{
-  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-  /* Check for unexpected PLT reloc type.  */
-  if (__builtin_expect (r_type == R_ARM_JUMP_SLOT, 1))
-    {
-      if (__builtin_expect (map->l_mach.plt, 0) == 0)
-	*reloc_addr += l_addr;
-      else
-	*reloc_addr = map->l_mach.plt;
-    }
-  else
-    _dl_reloc_bad_type (map, r_type, 1);
-}
-
-#endif /* RESOLVE */
diff --git a/sysdeps/arm/elf/start.S b/sysdeps/arm/elf/start.S
deleted file mode 100644
index cc076aba5c..0000000000
--- a/sysdeps/arm/elf/start.S
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Startup code for ARM & ELF
-   Copyright (C) 1995, 1996, 1997, 1998, 2001, 2002 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.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This is the canonical entry point, usually the first thing in the text
-   segment.
-
-	Note that the code in the .init section has already been run.
-	This includes _init and _libc_init
-
-
-	At this entry point, most registers' values are unspecified, except:
-
-   a1		Contains a function pointer to be registered with `atexit'.
-		This is how the dynamic linker arranges to have DT_FINI
-		functions called for shared libraries that have been loaded
-		before this code runs.
-
-   sp		The stack contains the arguments and environment:
-		0(sp)			argc
-		4(sp)			argv[0]
-		...
-		(4*argc)(sp)		NULL
-		(4*(argc+1))(sp)	envp[0]
-		...
-					NULL
-*/
-
-	.text
-	.globl _start
-	.type _start,#function
-_start:
-	/* Fetch address of fini */
-	ldr ip, =__libc_csu_fini
-
-	/* Clear the frame pointer since this is the outermost frame.  */
-	mov fp, #0
-
-	/* Pop argc off the stack and save a pointer to argv */
-	ldr a2, [sp], #4
-	mov a3, sp
-
-	/* Push stack limit */
-	str a3, [sp, #-4]!
-
-	/* Push rtld_fini */
-	str a1, [sp, #-4]!
-
-	/* Set up the other arguments in registers */
-	ldr a1, =main
-	ldr a4, =__libc_csu_init
-
-	/* Push fini */
-	str ip, [sp, #-4]!
-
-	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
-
-	/* Let the libc call main and exit with its return code.  */
-	bl __libc_start_main
-
-	/* should never get here....*/
-	bl abort
-
-/* Define a symbol for the first piece of initialized data.  */
-	.data
-	.globl __data_start
-__data_start:
-	.long 0
-	.weak data_start
-	data_start = __data_start
diff --git a/sysdeps/arm/fpu/__longjmp.S b/sysdeps/arm/fpu/__longjmp.S
deleted file mode 100644
index 90efeec1eb..0000000000
--- a/sysdeps/arm/fpu/__longjmp.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* longjmp for ARM.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
-
-/* __longjmp(jmpbuf, val) */
-
-ENTRY (__longjmp)
-	mov	ip, r0		/* save jmp_buf pointer */
-	
-	movs	r0, r1		/* get the return value in place */
-	moveq	r0, #1		/* can't let setjmp() return zero! */
-
-	lfmfd	f4, 4, [ip] !	/* load the floating point regs */
-
-	LOADREGS(ia, ip, {v1-v6, sl, fp, sp, pc})
-END (__longjmp)
diff --git a/sysdeps/arm/fpu/bits/fenv.h b/sysdeps/arm/fpu/bits/fenv.h
deleted file mode 100644
index 7bd242385f..0000000000
--- a/sysdeps/arm/fpu/bits/fenv.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-/* Define bits representing exceptions in the FPU status word.  */
-enum
-  {
-    FE_INVALID = 1,
-#define FE_INVALID FE_INVALID
-    FE_DIVBYZERO = 2,
-#define FE_DIVBYZERO FE_DIVBYZERO
-    FE_OVERFLOW = 4,
-#define FE_OVERFLOW FE_OVERFLOW
-    FE_UNDERFLOW = 8,
-#define FE_UNDERFLOW FE_UNDERFLOW
-  };
-
-/* Amount to shift by to convert an exception to a mask bit.  */
-#define FE_EXCEPT_SHIFT	16
-
-/* All supported exceptions.  */
-#define FE_ALL_EXCEPT	\
-	(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
-
-/* The ARM FPU basically only supports round-to-nearest.  Other rounding
-   modes exist, but you have to encode them in the actual instruction.  */
-#define FE_TONEAREST	0
-
-/* Type representing exception flags. */
-typedef unsigned long int fexcept_t;
-
-/* Type representing floating-point environment.  */
-typedef struct
-  {
-    unsigned long int __cw;
-  }
-fenv_t;
-
-/* If the default argument is used we use this value.  */
-#define FE_DFL_ENV	((fenv_t *) -1l)
diff --git a/sysdeps/arm/fpu/bits/mathdef.h b/sysdeps/arm/fpu/bits/mathdef.h
deleted file mode 100644
index e013e74b7e..0000000000
--- a/sysdeps/arm/fpu/bits/mathdef.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1999, 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#if defined  __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF	1
-
-/* GCC does not promote `float' values to `double'.  */
-typedef float float_t;		/* `float' expressions are evaluated as
-				   `float'.  */
-typedef double double_t;	/* `double' expressions are evaluated as
-				   `double'.  */
-
-/* The values returned by `ilogb' for 0 and NaN respectively.  */
-# define FP_ILOGB0	(-2147483647)
-# define FP_ILOGBNAN	(2147483647)
-
-#endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  This disables the
-   declaration of all the `long double' function variants.  */
-/* XXX The FPA does support this but the patterns in GCC are currently
-   turned off.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/arm/fpu/bits/setjmp.h b/sysdeps/arm/fpu/bits/setjmp.h
deleted file mode 100644
index dd85243032..0000000000
--- a/sysdeps/arm/fpu/bits/setjmp.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Define the machine-dependent type `jmp_buf'.  ARM version. */
-
-#ifndef _SETJMP_H
-# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-#endif
-
-#ifndef _ASM
-/* Jump buffer contains v1-v6, sl, fp, sp and pc.  Other registers are not
-   saved.  */
-typedef int __jmp_buf[22];
-#endif
-
-#define __JMP_BUF_SP		20
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf[__JMP_BUF_SP]))
diff --git a/sysdeps/arm/fpu/fclrexcpt.c b/sysdeps/arm/fpu/fclrexcpt.c
deleted file mode 100644
index c6a53df45a..0000000000
--- a/sysdeps/arm/fpu/fclrexcpt.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Clear given exceptions in current floating-point environment.
-   Copyright (C) 1997,98,99,2000,01 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-__feclearexcept (int excepts)
-{
-  unsigned long int temp;
-
-  /* Mask out unsupported bits/exceptions.  */
-  excepts &= FE_ALL_EXCEPT;
-
-  /* Get the current floating point status. */
-  _FPU_GETCW (temp);
-
-  /* Clear the relevant bits.  */
-  temp &= excepts ^ FE_ALL_EXCEPT;
-
-  /* Put the new data in effect.  */
-  _FPU_SETCW (temp);
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feclearexcept, __old_feclearexcept)
-compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/sysdeps/arm/fpu/fedisblxcpt.c b/sysdeps/arm/fpu/fedisblxcpt.c
deleted file mode 100644
index 91f60a9c90..0000000000
--- a/sysdeps/arm/fpu/fedisblxcpt.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Disable floating-point exceptions.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 2001.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fedisableexcept (int excepts)
-{
-  unsigned long int new_exc, old_exc;
-
-  _FPU_GETCW(new_exc);
-
-  old_exc = (new_exc >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
-
-  excepts &= FE_ALL_EXCEPT;
-
-  new_exc &= ~(excepts << FE_EXCEPT_SHIFT);
-
-  _FPU_SETCW(new_exc);
-
-  return old_exc;
-}
diff --git a/sysdeps/arm/fpu/feenablxcpt.c b/sysdeps/arm/fpu/feenablxcpt.c
deleted file mode 100644
index e77e45a523..0000000000
--- a/sysdeps/arm/fpu/feenablxcpt.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Enable floating-point exceptions.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 2001.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-feenableexcept (int excepts)
-{
-  unsigned long int new_exc, old_exc;
-
-  _FPU_GETCW(new_exc);
-
-  old_exc = (new_exc >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
-
-  excepts &= FE_ALL_EXCEPT;
-
-  new_exc |= (excepts << FE_EXCEPT_SHIFT);
-
-  _FPU_SETCW(new_exc);
-
-  return old_exc;
-}
diff --git a/sysdeps/arm/fpu/fegetenv.c b/sysdeps/arm/fpu/fegetenv.c
deleted file mode 100644
index 0b40f183e2..0000000000
--- a/sysdeps/arm/fpu/fegetenv.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Store current floating-point environment.
-   Copyright (C) 1997,98,99,2000,01 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-__fegetenv (fenv_t *envp)
-{
-  unsigned long int temp;
-  _FPU_GETCW (temp);
-  envp->__cw = temp;
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fegetenv, __old_fegetenv)
-compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/arm/fpu/fegetexcept.c b/sysdeps/arm/fpu/fegetexcept.c
deleted file mode 100644
index 653c8d5a0d..0000000000
--- a/sysdeps/arm/fpu/fegetexcept.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Get floating-point exceptions.
-   Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 2001
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fegetexcept (void)
-{
-  unsigned long temp;
-
-  _FPU_GETCW (temp);
-
-  return (temp >> FE_EXCEPT_SHIFT) & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/arm/fpu/fegetround.c b/sysdeps/arm/fpu/fegetround.c
deleted file mode 100644
index 6bf65f5b5e..0000000000
--- a/sysdeps/arm/fpu/fegetround.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Return current rounding direction.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetround (void)
-{
-  return FE_TONEAREST;		/* Easy. :-) */
-}
diff --git a/sysdeps/arm/fpu/feholdexcpt.c b/sysdeps/arm/fpu/feholdexcpt.c
deleted file mode 100644
index 203b068aae..0000000000
--- a/sysdeps/arm/fpu/feholdexcpt.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1998, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-feholdexcept (fenv_t *envp)
-{
-  unsigned long int temp;
-
-  /* Store the environment.  */
-  _FPU_GETCW(temp);
-  envp->__cw = temp;
-
-  /* Now set all exceptions to non-stop.  */
-  temp &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
-  _FPU_SETCW(temp);
-
-  return 0;
-}
diff --git a/sysdeps/arm/fpu/fesetenv.c b/sysdeps/arm/fpu/fesetenv.c
deleted file mode 100644
index bb8812acaf..0000000000
--- a/sysdeps/arm/fpu/fesetenv.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Install given floating-point environment.
-   Copyright (C) 1997,98,99,2000,01,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-__fesetenv (const fenv_t *envp)
-{
-  if (envp == FE_DFL_ENV)
-    _FPU_SETCW (_FPU_DEFAULT);
-  else
-    {
-      unsigned long int temp = envp->__cw;
-      _FPU_SETCW (temp);
-    }
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetenv, __old_fesetenv)
-compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1);
-#endif
-
-libm_hidden_ver (__fesetenv, fesetenv)
-versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
diff --git a/sysdeps/arm/fpu/fesetround.c b/sysdeps/arm/fpu/fesetround.c
deleted file mode 100644
index bdb849ff60..0000000000
--- a/sysdeps/arm/fpu/fesetround.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Set current rounding direction.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fesetround (int round)
-{
-  /* We only support FE_TONEAREST, so there is no need for any work.  */
-  return (round == FE_TONEAREST)?0:1;
-}
diff --git a/sysdeps/arm/fpu/fpu_control.h b/sysdeps/arm/fpu/fpu_control.h
deleted file mode 100644
index 65912e4962..0000000000
--- a/sysdeps/arm/fpu/fpu_control.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* FPU control word definitions.  ARM version.
-   Copyright (C) 1996, 1997, 1998, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FPU_CONTROL_H
-#define _FPU_CONTROL_H
-
-/* We have a slight terminology confusion here.  On the ARM, the register
- * we're interested in is actually the FPU status word - the FPU control
- * word is something different (which is implementation-defined and only
- * accessible from supervisor mode.)
- *
- * The FPSR looks like this:
- *
- *     31-24        23-16          15-8              7-0
- * | system ID | trap enable | system control | exception flags |
- *
- * We ignore the system ID bits; for interest's sake they are:
- *
- *  0000	"old" FPE
- *  1000	FPPC hardware
- *  0001	FPE 400
- *  1001	FPA hardware
- *
- * The trap enable and exception flags are both structured like this:
- *
- *     7 - 5     4     3     2     1     0
- * | reserved | INX | UFL | OFL | DVZ | IVO |
- *
- * where a `1' bit in the enable byte means that the trap can occur, and
- * a `1' bit in the flags byte means the exception has occurred.
- *
- * The exceptions are:
- *
- *  IVO - invalid operation
- *  DVZ - divide by zero
- *  OFL - overflow
- *  UFL - underflow
- *  INX - inexact (do not use; implementations differ)
- *
- * The system control byte looks like this:
- *
- *     7-5      4    3    2    1    0
- * | reserved | AC | EP | SO | NE | ND |
- *
- * where the bits mean
- *
- *  ND - no denormalised numbers (force them all to zero)
- *  NE - enable NaN exceptions
- *  SO - synchronous operation
- *  EP - use expanded packed-decimal format
- *  AC - use alternate definition for C flag on compare operations
- */
-
-/* masking of interrupts */
-#define _FPU_MASK_IM	0x00010000	/* invalid operation */
-#define _FPU_MASK_ZM	0x00020000	/* divide by zero */
-#define _FPU_MASK_OM	0x00040000	/* overflow */
-#define _FPU_MASK_UM	0x00080000	/* underflow */
-#define _FPU_MASK_PM	0x00100000	/* inexact */
-#define _FPU_MASK_DM	0x00000000	/* denormalized operation */
-
-/* The system id bytes cannot be changed.
-   Only the bottom 5 bits in the trap enable byte can be changed.
-   Only the bottom 5 bits in the system control byte can be changed.
-   Only the bottom 5 bits in the exception flags are used.
-   The exception flags are set by the fpu, but can be zeroed by the user. */
-#define _FPU_RESERVED	0xffe0e0e0	/* These bits are reserved.  */
-
-/* The fdlibm code requires strict IEEE double precision arithmetic,
-   no interrupts for exceptions, rounding to nearest.  Changing the
-   rounding mode will break long double I/O.  Turn on the AC bit,
-   the compiler generates code that assumes it is on.  */
-#define _FPU_DEFAULT	0x00001000	/* Default value.  */
-#define _FPU_IEEE	0x001f1000	/* Default + exceptions enabled. */
-
-/* Type of the control word.  */
-typedef unsigned int fpu_control_t;
-
-/* Macros for accessing the hardware control word.  */
-#define _FPU_GETCW(cw) __asm__ ("rfs %0" : "=r" (cw))
-#define _FPU_SETCW(cw) __asm__ ("wfs %0" : : "r" (cw))
-
-/* Default control word set at startup.  */
-extern fpu_control_t __fpu_control;
-
-#endif /* _FPU_CONTROL_H */
diff --git a/sysdeps/arm/fpu/fraiseexcpt.c b/sysdeps/arm/fpu/fraiseexcpt.c
deleted file mode 100644
index f7dede2fe2..0000000000
--- a/sysdeps/arm/fpu/fraiseexcpt.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Raise given exceptions.
-   Copyright (C) 1997,98,99,2000,01,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-#include <math.h>
-
-int
-__feraiseexcept (int excepts)
-{
-  /* Raise exceptions represented by EXPECTS.  */
-  fexcept_t temp;
-  _FPU_GETCW (temp);
-  temp |= (excepts & FE_ALL_EXCEPT);
-  _FPU_SETCW (temp);
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feraiseexcept, __old_feraiseexcept)
-compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
-#endif
-
-libm_hidden_ver (__feraiseexcept, feraiseexcept)
-versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
diff --git a/sysdeps/arm/fpu/fsetexcptflg.c b/sysdeps/arm/fpu/fsetexcptflg.c
deleted file mode 100644
index 4e1d2cba4a..0000000000
--- a/sysdeps/arm/fpu/fsetexcptflg.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Set floating-point environment exception handling.
-   Copyright (C) 1997,98,99,2000,01 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <math.h>
-#include <fpu_control.h>
-
-int
-__fesetexceptflag (const fexcept_t *flagp, int excepts)
-{
-  fexcept_t temp;
-
-  /* Get the current environment.  */
-  _FPU_GETCW (temp);
-
-  /* Set the desired exception mask.  */
-  temp &= ~((excepts & FE_ALL_EXCEPT) << FE_EXCEPT_SHIFT);
-  temp |= (*flagp & excepts & FE_ALL_EXCEPT) << FE_EXCEPT_SHIFT;
-
-  /* Save state back to the FPU.  */
-  _FPU_SETCW (temp);
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetexceptflag, __old_fesetexceptflag)
-compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);
diff --git a/sysdeps/arm/fpu/ftestexcept.c b/sysdeps/arm/fpu/ftestexcept.c
deleted file mode 100644
index 328bcb05fd..0000000000
--- a/sysdeps/arm/fpu/ftestexcept.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Test exception in current environment.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fetestexcept (int excepts)
-{
-  fexcept_t temp;
-
-  /* Get current exceptions.  */
-  _FPU_GETCW(temp);
-
-  return temp & excepts & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/arm/fpu/setjmp.S b/sysdeps/arm/fpu/setjmp.S
deleted file mode 100644
index 84328369ac..0000000000
--- a/sysdeps/arm/fpu/setjmp.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* setjmp for ARM.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
-
-ENTRY (__sigsetjmp)
-	/* Save registers */
-	sfmea	f4, 4, [r0]!
-	stmia	r0, {v1-v6, sl, fp, sp, lr}
-
-	/* Restore pointer to jmp_buf */
-	sub	r0, r0, #48
-
-	/* Make a tail call to __sigjmp_save; it takes the same args.  */
-	B	PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
-END (__sigsetjmp)
diff --git a/sysdeps/arm/frame.h b/sysdeps/arm/frame.h
deleted file mode 100644
index deb46c0135..0000000000
--- a/sysdeps/arm/frame.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Definition of stack frame structure.  ARM/APCS version.
-   Copyright (C) 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This is the APCS stack backtrace structure.  */
-struct layout
-{
-  struct layout *__unbounded next;
-  void *__unbounded sp;
-  void *__unbounded return_address;
-};
-
-#define FIRST_FRAME_POINTER ADVANCE_STACK_FRAME (__builtin_frame_address (0))
diff --git a/sysdeps/arm/gccframe.h b/sysdeps/arm/gccframe.h
deleted file mode 100644
index ef8df2630e..0000000000
--- a/sysdeps/arm/gccframe.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Definition of object in frame unwind info.  arm version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define FIRST_PSEUDO_REGISTER 27
-
-#include <sysdeps/generic/gccframe.h>
diff --git a/sysdeps/arm/gmp-mparam.h b/sysdeps/arm/gmp-mparam.h
deleted file mode 100644
index c880be33a4..0000000000
--- a/sysdeps/arm/gmp-mparam.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* gmp-mparam.h -- Compiler/machine parameter header file.
-
-Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#define BITS_PER_MP_LIMB 32
-#define BYTES_PER_MP_LIMB 4
-#define BITS_PER_LONGINT 32
-#define BITS_PER_INT 32
-#define BITS_PER_SHORTINT 16
-#define BITS_PER_CHAR 8
-
-#define IEEE_DOUBLE_BIG_ENDIAN 0
-#define IEEE_DOUBLE_MIXED_ENDIAN 1
diff --git a/sysdeps/arm/ieee754.h b/sysdeps/arm/ieee754.h
deleted file mode 100644
index 629b97fb1b..0000000000
--- a/sysdeps/arm/ieee754.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _IEEE754_H
-
-#define _IEEE754_H 1
-#include <features.h>
-
-#include <endian.h>
-
-__BEGIN_DECLS
-
-union ieee754_float
-  {
-    float f;
-
-    /* This is the IEEE 754 single-precision format.  */
-    struct
-      {
-	unsigned int mantissa:23;
-	unsigned int exponent:8;
-	unsigned int negative:1;
-      } ieee;
-
-    /* This format makes it easier to see if a NaN is a signalling NaN.  */
-    struct
-      {
-	unsigned int mantissa:22;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:8;
-	unsigned int negative:1;
-      } ieee_nan;
-  };
-
-#define IEEE754_FLOAT_BIAS	0x7f /* Added to exponent.  */
-
-
-union ieee754_double
-  {
-    double d;
-
-    /* This is the IEEE 754 double-precision format.  */
-    struct
-      {
-	unsigned int mantissa0:20;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-      } ieee;
-
-    /* This format makes it easier to see if a NaN is a signalling NaN.  */
-    struct
-      {
-	unsigned int mantissa0:19;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-      } ieee_nan;
-  };
-
-#define IEEE754_DOUBLE_BIAS	0x3ff /* Added to exponent.  */
-
-
-/* The following two structures are correct for `new' floating point systems but
-   wrong for the old FPPC.  The only solution seems to be to avoid their use on
-   old hardware.  */
-
-union ieee854_long_double
-  {
-    long double d;
-
-    /* This is the IEEE 854 double-extended-precision format.  */
-    struct
-      {
-	unsigned int exponent:15;
-	unsigned int empty:16;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:32;
-      } ieee;
-
-    /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
-    struct
-      {
-	unsigned int exponent:15;
-	unsigned int empty:16;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:30;
-	unsigned int quiet_nan:1;
-	unsigned int one:1;
-      } ieee_nan;
-  };
-
-#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
-
-__END_DECLS
-
-#endif /* ieee754.h */
diff --git a/sysdeps/arm/init-first.c b/sysdeps/arm/init-first.c
deleted file mode 100644
index 652cf95d14..0000000000
--- a/sysdeps/arm/init-first.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Initialization code run first thing by the ELF startup code.  For ARM.
-   Copyright (C) 1995,1996,1997,1998,2001,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-
-extern void __libc_init (int, char **, char **);
-#ifdef USE_NONOPTION_FLAGS
-extern void __getopt_clean_environment (char **);
-#endif
-extern void __libc_global_ctors (void);
-
-int __libc_multiple_libcs attribute_hidden = 1;
-
-static void
-init (int *data)
-{
-  int argc = *data;
-  char **argv = (void *) (data + 1);
-  char **envp = &argv[argc + 1];
-
-  __environ = envp;
-  __libc_init (argc, argv, envp);
-
-#ifdef USE_NONOPTION_FLAGS
-  /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment (envp);
-#endif
-}
-
-#ifdef SHARED
-/* This function is called to initialize the shared C library.
-   It is called just before the user _start code from i386/elf/start.S,
-   with the stack set up as that code gets it.  */
-
-/* NOTE!  The linker notices the magical name `_init' and sets the DT_INIT
-   pointer in the dynamic section based solely on that.  It is convention
-   for this function to be in the `.init' section, but the symbol name is
-   the only thing that really matters!!  */
-/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
-
-void
-_init (int argc, ...)
-{
-  init (&argc);
-
-  __libc_global_ctors ();
-}
-#endif
-
-
-void
-__libc_init_first (int argc __attribute__ ((unused)), ...)
-{
-#ifndef SHARED
-  init (&argc);
-#endif
-}
diff --git a/sysdeps/arm/libm-test-ulps b/sysdeps/arm/libm-test-ulps
deleted file mode 100644
index 6a4bcc6147..0000000000
--- a/sysdeps/arm/libm-test-ulps
+++ /dev/null
@@ -1,1079 +0,0 @@
-# Begin of automatic generation
-
-# asin
-Test "asin (-0.5) == -pi/6":
-float: 2
-ifloat: 2
-Test "asin (0.5) == pi/6":
-float: 2
-ifloat: 2
-Test "asin (0.7) == 0.77539749661075306374035335271498708":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# atanh
-Test "atanh (0.7) == 0.8673005276940531944":
-double: 1
-idouble: 1
-
-# cabs
-Test "cabs (-0.7 + 12.4 i) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "cabs (-0.7 - 12.4 i) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "cabs (-12.4 + 0.7 i) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "cabs (-12.4 - 0.7 i) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "cabs (0.7 + 1.2 i) == 1.3892443989449804508432547041028554":
-double: 1
-idouble: 1
-Test "cabs (0.7 + 12.4 i) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-
-# cacos
-Test "Real part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i":
-float: 1
-ifloat: 1
-
-# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-Test "Real part of: cacosh (0.7 + 1.2 i) == 1.0927647857577371459105272080819308 + 1.1351827477151551088992008271819053 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# casin
-Test "Real part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-Test "Imaginary part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i":
-float: 1
-ifloat: 1
-
-# casinh
-Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-Test "Real part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i":
-float: 1
-ifloat: 1
-
-# catan
-Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-float: 3
-ifloat: 3
-Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Real part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i":
-float: 4
-ifloat: 4
-Test "Imaginary part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i":
-double: 1
-idouble: 1
-
-# catanh
-Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-double: 4
-idouble: 4
-Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-float: 4
-ifloat: 4
-Test "Real part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i":
-double: 1
-float: 6
-idouble: 1
-ifloat: 6
-
-# cbrt
-Test "cbrt (-27.0) == -3.0":
-double: 1
-idouble: 1
-Test "cbrt (0.970299) == 0.99":
-double: 1
-idouble: 1
-
-# ccos
-Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i":
-double: 1
-idouble: 1
-
-# ccosh
-Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i":
-double: 1
-idouble: 1
-
-# cexp
-Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
-float: 1
-ifloat: 1
-Test "Real part of: cexp (0.7 + 1.2 i) == 0.72969890915032360123451688642930727 + 1.8768962328348102821139467908203072 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: cexp (0.7 + 1.2 i) == 0.72969890915032360123451688642930727 + 1.8768962328348102821139467908203072 i":
-float: 1
-ifloat: 1
-
-# clog
-Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-# clog10
-Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Real part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
-float: 1
-ifloat: 1
-
-# cos
-Test "cos (0.7) == 0.76484218728448842625585999019186495":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "cos (M_PI_6l * 2.0) == 0.5":
-double: 1
-float: 0.5
-idouble: 1
-ifloat: 0.5
-Test "cos (M_PI_6l * 4.0) == -0.5":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "cos (pi/2) == 0":
-double: 0.2758
-float: 0.3667
-idouble: 0.2758
-ifloat: 0.3667
-
-# cpow
-Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-float: 2
-ifloat: 2
-Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
-double: 1.1031
-float: 1.5
-idouble: 1.1031
-ifloat: 1.5
-
-# csin
-Test "Imaginary part of: csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i":
-float: 1
-ifloat: 1
-
-# csinh
-Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
-double: 1
-idouble: 1
-Test "Real part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i":
-float: 1
-ifloat: 1
-
-# csqrt
-Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-Test "Real part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i":
-float: 1
-ifloat: 1
-
-# ctan
-Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-double: 1
-idouble: 1
-Test "Real part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# ctanh
-Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
-float: 1
-ifloat: 1
-Test "Real part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "Imaginary part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-# erfc
-Test "erfc (0.7) == 0.32219880616258152702":
-double: 1
-idouble: 1
-Test "erfc (1.2) == 0.089686021770364619762":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-Test "erfc (2.0) == 0.0046777349810472658379":
-double: 1
-idouble: 1
-Test "erfc (4.1) == 0.67000276540848983727e-8":
-double: 24
-float: 12
-idouble: 24
-ifloat: 12
-
-# exp10
-Test "exp10 (-1) == 0.1":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "exp10 (0.7) == 5.0118723362727228500155418688494574":
-float: 1
-ifloat: 1
-Test "exp10 (3) == 1000":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-# expm1
-Test "expm1 (1) == M_El - 1.0":
-float: 1
-ifloat: 1
-
-# fmod
-Test "fmod (-6.5, -2.3) == -1.9":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "fmod (-6.5, 2.3) == -1.9":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "fmod (6.5, -2.3) == 1.9":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "fmod (6.5, 2.3) == 1.9":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-# hypot
-Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, 1.2) == 1.3892443989449804508432547041028554":
-double: 1
-idouble: 1
-Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-
-# j0
-Test "j0 (10.0) == -0.24593576445134833520":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "j0 (2.0) == 0.22389077914123566805":
-float: 2
-ifloat: 2
-Test "j0 (8.0) == 0.17165080713755390609":
-float: 1
-ifloat: 1
-
-# j1
-Test "j1 (10.0) == 0.043472746168861436670":
-float: 2
-ifloat: 2
-Test "j1 (2.0) == 0.57672480775687338720":
-double: 1
-idouble: 1
-Test "j1 (8.0) == 0.23463634685391462438":
-double: 1
-idouble: 1
-
-# jn
-Test "jn (0, 10.0) == -0.24593576445134833520":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "jn (0, 2.0) == 0.22389077914123566805":
-float: 2
-ifloat: 2
-Test "jn (0, 8.0) == 0.17165080713755390609":
-float: 1
-ifloat: 1
-Test "jn (1, 10.0) == 0.043472746168861436670":
-float: 2
-ifloat: 2
-Test "jn (1, 2.0) == 0.57672480775687338720":
-double: 1
-idouble: 1
-Test "jn (1, 8.0) == 0.23463634685391462438":
-double: 1
-idouble: 1
-Test "jn (10, 0.1) == 0.26905328954342155795e-19":
-double: 6
-float: 4
-idouble: 6
-ifloat: 4
-Test "jn (10, 0.7) == 0.75175911502153953928e-11":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "jn (10, 10.0) == 0.20748610663335885770":
-double: 4
-float: 3
-idouble: 4
-ifloat: 3
-Test "jn (10, 2.0) == 0.25153862827167367096e-6":
-float: 4
-ifloat: 4
-Test "jn (3, 0.1) == 0.000020820315754756261429":
-double: 1
-idouble: 1
-Test "jn (3, 0.7) == 0.0069296548267508408077":
-float: 1
-ifloat: 1
-Test "jn (3, 10.0) == 0.058379379305186812343":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "jn (3, 2.0) == 0.12894324947440205110":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# lgamma
-Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# log
-Test "log (0.7) == -0.35667494393873237891263871124118447":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# log10
-Test "log10 (0.7) == -0.15490195998574316929":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "log10 (e) == log10(e)":
-float: 1
-ifloat: 1
-
-# log1p
-Test "log1p (-0.3) == -0.35667494393873237891263871124118447":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# log2
-Test "log2 (0.7) == -0.51457317282975824043":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# sincos
-Test "sincos (0.7, &sin_res, &cos_res) puts 0.76484218728448842625585999019186495 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
-double: 1
-float: 0.5
-idouble: 1
-ifloat: 0.5
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
-double: 0.2758
-float: 0.3667
-idouble: 0.2758
-ifloat: 0.3667
-Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646764 in cos_res":
-float: 1
-ifloat: 1
-
-# sinh
-Test "sinh (0.7) == 0.75858370183953350346":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# tan
-Test "tan (pi/4) == 1":
-double: 0.5
-idouble: 0.5
-
-# tanh
-Test "tanh (0.7) == 0.60436777711716349631":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# tgamma
-Test "tgamma (-0.5) == -2 sqrt (pi)":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "tgamma (0.5) == sqrt (pi)":
-float: 1
-ifloat: 1
-Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y0
-Test "y0 (0.7) == -0.19066492933739506743":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (1.0) == 0.088256964215676957983":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (1.5) == 0.38244892379775884396":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (10.0) == 0.055671167283599391424":
-float: 1
-ifloat: 1
-Test "y0 (8.0) == 0.22352148938756622053":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y1
-Test "y1 (0.1) == -6.4589510947020269877":
-double: 1
-idouble: 1
-Test "y1 (0.7) == -1.1032498719076333697":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "y1 (1.5) == -0.41230862697391129595":
-float: 1
-ifloat: 1
-Test "y1 (10.0) == 0.24901542420695388392":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "y1 (2.0) == -0.10703243154093754689":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "y1 (8.0) == -0.15806046173124749426":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# yn
-Test "yn (0, 0.7) == -0.19066492933739506743":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 1.0) == 0.088256964215676957983":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 1.5) == 0.38244892379775884396":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 10.0) == 0.055671167283599391424":
-float: 1
-ifloat: 1
-Test "yn (0, 8.0) == 0.22352148938756622053":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 0.1) == -6.4589510947020269877":
-double: 1
-idouble: 1
-Test "yn (1, 0.7) == -1.1032498719076333697":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 1.5) == -0.41230862697391129595":
-float: 1
-ifloat: 1
-Test "yn (1, 10.0) == 0.24901542420695388392":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "yn (1, 2.0) == -0.10703243154093754689":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 8.0) == -0.15806046173124749426":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "yn (10, 0.1) == -0.11831335132045197885e19":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-Test "yn (10, 0.7) == -0.42447194260703866924e10":
-double: 3
-idouble: 3
-Test "yn (10, 1.0) == -0.12161801427868918929e9":
-double: 1
-idouble: 1
-Test "yn (10, 10.0) == -0.35981415218340272205":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 2.0) == -129184.54220803928264":
-double: 2
-idouble: 2
-Test "yn (3, 0.1) == -5099.3323786129048894":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 0.7) == -15.819479052819633505":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "yn (3, 10.0) == -0.25136265718383732978":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 2.0) == -1.1277837768404277861":
-double: 1
-idouble: 1
-
-# Maximal error of functions:
-Function: "asin":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "atanh":
-double: 1
-idouble: 1
-
-Function: "cabs":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "cacos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "cacos":
-float: 1
-ifloat: 1
-
-Function: Real part of "cacosh":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-
-Function: Imaginary part of "cacosh":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-Function: Real part of "casin":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-Function: Imaginary part of "casin":
-float: 1
-ifloat: 1
-
-Function: Real part of "casinh":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-
-Function: Imaginary part of "casinh":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-
-Function: Real part of "catan":
-float: 4
-ifloat: 4
-
-Function: Imaginary part of "catan":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "catanh":
-double: 4
-float: 1
-idouble: 4
-ifloat: 1
-
-Function: Imaginary part of "catanh":
-double: 1
-float: 6
-idouble: 1
-ifloat: 6
-
-Function: "cbrt":
-double: 1
-idouble: 1
-
-Function: Real part of "ccos":
-double: 1
-idouble: 1
-
-Function: Imaginary part of "ccos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "ccosh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ccosh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "cexp":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "cexp":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "clog":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-Function: Real part of "clog10":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "clog10":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-
-Function: "cos":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: Real part of "cpow":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-
-Function: Imaginary part of "cpow":
-double: 1.1031
-float: 2
-idouble: 1.1031
-ifloat: 2
-
-Function: Imaginary part of "csin":
-float: 1
-ifloat: 1
-
-Function: Real part of "csinh":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "csinh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "csqrt":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "csqrt":
-float: 1
-ifloat: 1
-
-Function: Real part of "ctan":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ctan":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "ctanh":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: Imaginary part of "ctanh":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: "erfc":
-double: 24
-float: 12
-idouble: 24
-ifloat: 12
-
-Function: "exp10":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-Function: "expm1":
-float: 1
-ifloat: 1
-
-Function: "fmod":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: "hypot":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "j0":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: "j1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "jn":
-double: 6
-float: 4
-idouble: 6
-ifloat: 4
-
-Function: "lgamma":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "log":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "log10":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "log1p":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "log2":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "sincos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "sinh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "tan":
-double: 0.5
-idouble: 0.5
-
-Function: "tanh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "tgamma":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "y0":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: "y1":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-Function: "yn":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-# end of automatic generation
diff --git a/sysdeps/arm/machine-gmon.h b/sysdeps/arm/machine-gmon.h
deleted file mode 100644
index fa3f65237d..0000000000
--- a/sysdeps/arm/machine-gmon.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Machine-dependent definitions for profiling support.  ARM version.
-   Copyright (C) 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* GCC for the ARM cannot compile __builtin_return_address(N) for N != 0, 
-   so we must use an assembly stub.  */
-
-#include <sysdep.h>
-#ifndef NO_UNDERSCORES
-/* The asm symbols for C functions are `_function'.
-   The canonical name for the counter function is `mcount', no _.  */
-void _mcount (void) asm ("mcount");
-#else
-/* The canonical name for the function is `_mcount' in both C and asm,
-   but some old asm code might assume it's `mcount'.  */
-void _mcount (void);
-weak_alias (_mcount, mcount)
-#endif
-
-static void mcount_internal (u_long frompc, u_long selfpc) __attribute_used__;
-
-#define _MCOUNT_DECL(frompc, selfpc) \
-static void mcount_internal (u_long frompc, u_long selfpc)
-
-/* This macro/func MUST save r0, r1 because the compiler inserts
-	blind calls to _mount(), ignoring the fact that _mcount may
-	clobber registers; therefore, _mcount may NOT clobber registers */
-/* if (this_fp!=0) {
-	r0 = this_fp
-	r1 = this_lr
-  	r1 = [r1-4] which is caller's lr 
-	if (r1!=0) 
-		r1 = caller's lr
-	call mcount_internal(this_lr, caller's_lr)
-   }
-*/
-
-#define MCOUNT								\
-void _mcount (void)							\
-{									\
-  __asm__("stmdb	sp!, {r0, r1, r2, r3};"				\
-	  "movs		fp, fp;"				      	\
-          "moveq	r1, #0;"					\
-	  "ldrne	r1, [fp, $-4];"					\
-	  "ldrne	r0, [fp, $-12];"				\
-	  "movnes	r0, r0;"					\
-	  "ldrne	r0, [r0, $-4];"					\
-	  "movs		r0, r0;"					\
-	  "blne		mcount_internal;"				\
-	  "ldmia	sp!, {r0, r1, r2, r3}");			\
-}
-
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
deleted file mode 100644
index 1e2699d077..0000000000
--- a/sysdeps/arm/memset.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* void *memset (dstpp, c, len) */
-
-ENTRY(memset)
-	mov	r3, r0
-	cmp	r2, #8
-	bcc	2f		@ less than 8 bytes to move
-
-1:
-	tst	r3, #3		@ aligned yet?
-	strneb	r1, [r3], #1
-	subne	r2, r2, #1
-	bne	1b
-
-	orr	r1, r1, r1, lsl $8
-	orr	r1, r1, r1, lsl $16
-
-1:
-	subs	r2, r2, #8
-	strcs	r1, [r3], #4	@ store up to 32 bytes per loop iteration
-	strcs	r1, [r3], #4
-	subcss	r2, r2, #8
-	strcs	r1, [r3], #4
-	strcs	r1, [r3], #4
-	subcss	r2, r2, #8
-	strcs	r1, [r3], #4
-	strcs	r1, [r3], #4
-	subcss	r2, r2, #8
-	strcs	r1, [r3], #4
-	strcs	r1, [r3], #4
-	bcs	1b
-
-	and	r2, r2, #7
-2:
-	subs	r2, r2, #1	@ store up to 4 bytes per loop iteration
-	strcsb	r1, [r3], #1
-	subcss	r2, r2, #1
-	strcsb	r1, [r3], #1
-	subcss	r2, r2, #1
-	strcsb	r1, [r3], #1
-	subcss	r2, r2, #1
-	strcsb	r1, [r3], #1
-	bcs	2b
-	
-	DO_RET(lr)
-END(memset)
-libc_hidden_builtin_def (memset)
diff --git a/sysdeps/arm/memusage.h b/sysdeps/arm/memusage.h
deleted file mode 100644
index c558a06b5d..0000000000
--- a/sysdeps/arm/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/arm/setjmp.S b/sysdeps/arm/setjmp.S
deleted file mode 100644
index 2e8c6940f4..0000000000
--- a/sysdeps/arm/setjmp.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* setjmp for ARM.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
-
-ENTRY (__sigsetjmp)
-	/* Save registers */
-	stmia	r0, {v1-v6, sl, fp, sp, lr}
-
-	/* Make a tail call to __sigjmp_save; it takes the same args.  */
-	B	PLTJMP(C_SYMBOL_NAME(__sigjmp_save))
-END (__sigsetjmp)
diff --git a/sysdeps/arm/stackinfo.h b/sysdeps/arm/stackinfo.h
deleted file mode 100644
index 2410ba9bd9..0000000000
--- a/sysdeps/arm/stackinfo.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-/* On Arm the stack grows down.  */
-#define _STACK_GROWS_DOWN	1
-
-#endif	/* stackinfo.h */
diff --git a/sysdeps/arm/strlen.S b/sysdeps/arm/strlen.S
deleted file mode 100644
index 86e16652e4..0000000000
--- a/sysdeps/arm/strlen.S
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Code contributed by Matthew Wilcox <willy@odie.barnet.ac.uk>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* size_t strlen(const char *S)
- * entry: r0 -> string
- * exit: r0 = len
- */
-
-ENTRY(strlen)
-	bic     r1, r0, $3              @ addr of word containing first byte
-	ldr     r2, [r1], $4            @ get the first word
-	ands    r3, r0, $3              @ how many bytes are duff?
-	rsb     r0, r3, $0              @ get - that number into counter.
-	beq     Laligned                @ skip into main check routine if no
-					@ more
-#ifdef __ARMEB__
-	orr     r2, r2, $0xff000000     @ set this byte to non-zero
-	subs    r3, r3, $1              @ any more to do?
-	orrgt   r2, r2, $0x00ff0000     @ if so, set this byte
-	subs    r3, r3, $1              @ more?
-	orrgt   r2, r2, $0x0000ff00     @ then set.
-#else
-	orr     r2, r2, $0x000000ff     @ set this byte to non-zero
-	subs    r3, r3, $1              @ any more to do?
-	orrgt   r2, r2, $0x0000ff00     @ if so, set this byte
-	subs    r3, r3, $1              @ more?
-	orrgt   r2, r2, $0x00ff0000     @ then set.
-#endif
-Laligned:				@ here, we have a word in r2.  Does it
-	tst     r2, $0x000000ff         @ contain any zeroes?
-	tstne   r2, $0x0000ff00         @
-	tstne   r2, $0x00ff0000         @
-	tstne   r2, $0xff000000         @
-	addne   r0, r0, $4              @ if not, the string is 4 bytes longer
-	ldrne   r2, [r1], $4            @ and we continue to the next word
-	bne     Laligned                @
-Llastword:				@ drop through to here once we find a
-#ifdef __ARMEB__
-	tst     r2, $0xff000000         @ word that has a zero byte in it
-	addne   r0, r0, $1              @
-	tstne   r2, $0x00ff0000         @ and add up to 3 bytes on to it
-	addne   r0, r0, $1              @
-	tstne   r2, $0x0000ff00         @ (if first three all non-zero, 4th
-	addne   r0, r0, $1              @  must be zero)
-#else
-	tst     r2, $0x000000ff         @ word that has a zero byte in it
-	addne   r0, r0, $1              @
-	tstne   r2, $0x0000ff00         @ and add up to 3 bytes on to it
-	addne   r0, r0, $1              @
-	tstne   r2, $0x00ff0000         @ (if first three all non-zero, 4th
-	addne   r0, r0, $1              @  must be zero)
-#endif
-	DO_RET(lr)
-END(strlen)
-libc_hidden_builtin_def (strlen)
diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/sys/ucontext.h
deleted file mode 100644
index 9c800bfa9f..0000000000
--- a/sysdeps/arm/sys/ucontext.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Copyright (C) 1998, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* System V/ARM ABI compliant context switching support.  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-
-typedef int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	16
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NGREG];
-
-/* Number of each register is the `gregset_t' array.  */
-enum
-{
-  R0 = 0,
-#define R0	R0
-  R1 = 1,
-#define R1	R1
-  R2 = 2,
-#define R2	R2
-  R3 = 3,
-#define R3	R3
-  R4 = 4,
-#define R4	R4
-  R5 = 5,
-#define R5	R5
-  R6 = 6,
-#define R6	R6
-  R7 = 7,
-#define R7	R7
-  R8 = 8,
-#define R8	R8
-  R9 = 9,
-#define R9	R9
-  R10 = 10,
-#define R10	R10
-  R11 = 11,
-#define R11	R11
-  R12 = 12,
-#define R12	R12
-  R13 = 13,
-#define R13	R13
-  R14 = 14,
-#define R14	R14
-  R15 = 15,
-#define R15	R15
-};
-
-/* Structure to describe FPU registers.  */
-typedef struct fpregset
-  {
-  } fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct
-  {
-    gregset_t gregs;
-    fpregset_t fpregs;
-  } mcontext_t;
-
-/* Userlevel context.  */
-typedef struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    __sigset_t uc_sigmask;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    long int uc_filler[5];
-  } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/arm/sysdep.h b/sysdeps/arm/sysdep.h
deleted file mode 100644
index 8ca77a60cb..0000000000
--- a/sysdeps/arm/sysdep.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Assembler macros for ARM.
-   Copyright (C) 1997, 1998, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/generic/sysdep.h>
-
-#if (!defined (__ARM_ARCH_2__) && !defined (__ARM_ARCH_3__) \
-     && !defined (__ARM_ARCH_3M__) && !defined (__ARM_ARCH_4__))
-# define __USE_BX__
-#endif
-
-#ifdef	__ASSEMBLER__
-
-/* Syntactic details of assembler.  */
-
-#ifdef HAVE_ELF
-
-#define ALIGNARG(log2) log2
-/* For ELF we need the `.type' directive to make shared libs work right.  */
-#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,%##typearg;
-#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
-
-/* In ELF C symbols are asm symbols.  */
-#undef	NO_UNDERSCORES
-#define NO_UNDERSCORES
-
-#define PLTJMP(_x)	_x##(PLT)
-
-#else
-
-#define ALIGNARG(log2) log2
-#define ASM_TYPE_DIRECTIVE(name,type)	/* Nothing is specified.  */
-#define ASM_SIZE_DIRECTIVE(name)	/* Nothing is specified.  */
-
-#define PLTJMP(_x)	_x
-
-#endif
-
-/* APCS-32 doesn't preserve the condition codes across function call. */
-#ifdef __APCS_32__
-#define LOADREGS(cond, base, reglist...)\
-	ldm##cond	base,reglist
-#ifdef __USE_BX__
-#define RETINSTR(cond, reg)	\
-	bx##cond	reg
-#define DO_RET(_reg)		\
-	bx _reg
-#else
-#define RETINSTR(cond, reg)	\
-	mov##cond	pc, reg
-#define DO_RET(_reg)		\
-	mov pc, _reg
-#endif
-#else  /* APCS-26 */
-#define LOADREGS(cond, base, reglist...)\
-	ldm##cond	base,reglist^
-#define RETINSTR(cond, reg)	\
-	mov##cond##s	pc, reg
-#define DO_RET(_reg)		\
-	movs pc, _reg
-#endif
-
-/* Define an entry point visible from C.  */
-#define	ENTRY(name)							      \
-  ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name);				      \
-  ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function)			      \
-  .align ALIGNARG(4);							      \
-  C_LABEL(name)								      \
-  CALL_MCOUNT
-
-#undef	END
-#define END(name)							      \
-  ASM_SIZE_DIRECTIVE(name)
-
-/* If compiled for profiling, call `mcount' at the start of each function.  */
-#ifdef	PROF
-#define CALL_MCOUNT			\
-	str	lr,[sp, #-4]!	;	\
-	bl	PLTJMP(mcount)	;	\
-	ldr	lr, [sp], #4	;
-#else
-#define CALL_MCOUNT		/* Do nothing.  */
-#endif
-
-#ifdef	NO_UNDERSCORES
-/* Since C identifiers are not normally prefixed with an underscore
-   on this system, the asm identifier `syscall_error' intrudes on the
-   C name space.  Make sure we use an innocuous name.  */
-#define	syscall_error	__syscall_error
-#define mcount		_mcount
-#endif
-
-#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/generic/Dist b/sysdeps/generic/Dist
deleted file mode 100644
index 549b616fb5..0000000000
--- a/sysdeps/generic/Dist
+++ /dev/null
@@ -1,26 +0,0 @@
-signame.c
-signame.h
-det_endian.c
-dl-brk.c
-dl-sbrk.c
-entry.h
-errno-loc.c
-getresgid.c
-getresuid.c
-endutxent.c
-getutxent.c
-getutxid.c
-getutxline.c
-pututxline.c
-setutxent.c
-updwtmpx.c
-utmpxname.c
-bits/libc-tsd.h
-siglist.h
-bp-semctl.h
-bp-checks.h
-bp-thunks.h
-bp-sym.h
-bp-start.h
-bits/link.h
-sysdep-cancel.h
diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index d741864b9c..972d469737 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -1,4 +1,5 @@
-# Copyright (C) 1992,93,94,95,96,97,99,2002 Free Software Foundation, Inc.
+# Copyright (C) 1992,93,94,95,96,97,99,2002,2005
+#	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
@@ -16,21 +17,6 @@
 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # 02111-1307 USA.
 
-ifeq (,$(filter-out $(sysdep_dir)/generic/bits $(common-objpfx)/bits,\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/endian.h))))))
-
-$(common-objpfx)bytesex.h: $(common-objpfx)det_endian
-	$(dir $<)$(notdir $<) > $@-tmp
-	mv $@-tmp $@
-
-$(common-objpfx)det_endian: $(sysdep_dir)/generic/det_endian.c
-	$(common-objdir-compile)
-
-before-compile := $(before-compile) $(common-objpfx)bits/endian.h
-common-generated := $(common-generated) bits/endian.h det_endian
-
-endif
-
 ifeq ($(subdir),string)
 CFLAGS-wordcopy.c += -Wno-uninitialized
 endif
diff --git a/sysdeps/generic/__longjmp.c b/sysdeps/generic/__longjmp.c
deleted file mode 100644
index 8a61ff6770..0000000000
--- a/sysdeps/generic/__longjmp.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <setjmp.h>
-
-
-/* Jump to the position specified by ENV, causing the
-   setjmp call there to return VAL, or 1 if VAL is 0.  */
-void
-__longjmp (__jmp_buf env, int val)
-{
-  if (val == 0)
-    val = 1;
-
-  __set_errno (ENOSYS);
-  /* No way to signal failure.	*/
-}
-
-stub_warning (longjmp)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/_exit.c b/sysdeps/generic/_exit.c
deleted file mode 100644
index 673667df30..0000000000
--- a/sysdeps/generic/_exit.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991,94,95,96,97,99,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-#include <stdlib.h>
-
-/* The function `_exit' should take a status argument and simply
-   terminate program execution, using the low-order 8 bits of the
-   given integer as status.  */
-void
-_exit (status)
-     int status;
-{
-  status &= 0xff;
-  abort ();
-}
-libc_hidden_def (_exit)
-weak_alias (_exit, _Exit)
-
-stub_warning (_exit)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c
deleted file mode 100644
index f6f16ff2af..0000000000
--- a/sysdeps/generic/_strerror.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 1991,93,95,96,97,98,2000,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <libintl.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/param.h>
-#include <stdio-common/_itoa.h>
-
-/* It is critical here that we always use the `dcgettext' function for
-   the message translation.  Since <libintl.h> only defines the macro
-   `dgettext' to use `dcgettext' for optimizing programs this is not
-   always guaranteed.  */
-#ifndef dgettext
-# include <locale.h>		/* We need LC_MESSAGES.  */
-# define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
-#endif
-
-/* Return a string describing the errno code in ERRNUM.  */
-char *
-__strerror_r (int errnum, char *buf, size_t buflen)
-{
-  if (errnum < 0 || errnum >= _sys_nerr_internal
-      || _sys_errlist_internal[errnum] == NULL)
-    {
-      /* Buffer we use to print the number in.  For a maximum size for
-	 `int' of 8 bytes we never need more than 20 digits.  */
-      char numbuf[21];
-      const char *unk = _("Unknown error ");
-      const size_t unklen = strlen (unk);
-      char *p, *q;
-
-      numbuf[20] = '\0';
-      p = _itoa_word (errnum, &numbuf[20], 10, 0);
-
-      /* Now construct the result while taking care for the destination
-	 buffer size.  */
-      q = __mempcpy (buf, unk, MIN (unklen, buflen));
-      if (unklen < buflen)
-	memcpy (q, p, MIN ((size_t) (&numbuf[21] - p), buflen - unklen));
-
-      /* Terminate the string in any case.  */
-      if (buflen > 0)
-	buf[buflen - 1] = '\0';
-
-      return buf;
-    }
-
-  return (char *) _(_sys_errlist_internal[errnum]);
-}
-weak_alias (__strerror_r, strerror_r)
-libc_hidden_def (__strerror_r)
diff --git a/sysdeps/generic/abort.c b/sysdeps/generic/abort.c
deleted file mode 100644
index 00788f22c7..0000000000
--- a/sysdeps/generic/abort.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright (C) 1991,93,95,96,97,98,2001,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <bits/libc-lock.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-/* Try to get a machine dependent instruction which will make the
-   program crash.  This is used in case everything else fails.  */
-#include <abort-instr.h>
-#ifndef ABORT_INSTRUCTION
-/* No such instruction is available.  */
-# define ABORT_INSTRUCTION
-#endif
-
-#ifdef USE_IN_LIBIO
-# include <libio/libioP.h>
-# define fflush(s) _IO_flush_all_lockp (0)
-#endif
-
-/* We must avoid to run in circles.  Therefore we remember how far we
-   already got.  */
-static int stage;
-
-/* We should be prepared for multiple threads trying to run abort.  */
-__libc_lock_define_initialized_recursive (static, lock);
-
-
-/* Cause an abnormal program termination with core-dump.  */
-void
-abort (void)
-{
-  struct sigaction act;
-  sigset_t sigs;
-
-  /* First acquire the lock.  */
-  __libc_lock_lock_recursive (lock);
-
-  /* Now it's for sure we are alone.  But recursive calls are possible.  */
-
-  /* Unlock SIGABRT.  */
-  if (stage == 0)
-    {
-      ++stage;
-      if (__sigemptyset (&sigs) == 0 &&
-	  __sigaddset (&sigs, SIGABRT) == 0)
-	__sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
-    }
-
-  /* Flush all streams.  We cannot close them now because the user
-     might have registered a handler for SIGABRT.  */
-  if (stage == 1)
-    {
-      ++stage;
-      fflush (NULL);
-    }
-
-  /* Send signal which possibly calls a user handler.  */
-  if (stage == 2)
-    {
-      /* This stage is special: we must allow repeated calls of
-	 `abort' when a user defined handler for SIGABRT is installed.
-	 This is risky since the `raise' implementation might also
-	 fail but I don't see another possibility.  */
-      int save_stage = stage;
-
-      stage = 0;
-      __libc_lock_unlock_recursive (lock);
-
-      raise (SIGABRT);
-
-      __libc_lock_lock_recursive (lock);
-      stage = save_stage + 1;
-    }
-
-  /* There was a handler installed.  Now remove it.  */
-  if (stage == 3)
-    {
-      ++stage;
-      memset (&act, '\0', sizeof (struct sigaction));
-      act.sa_handler = SIG_DFL;
-      __sigfillset (&act.sa_mask);
-      act.sa_flags = 0;
-      __sigaction (SIGABRT, &act, NULL);
-    }
-
-  /* Now close the streams which also flushes the output the user
-     defined handler might has produced.  */
-  if (stage == 4)
-    {
-      ++stage;
-      __fcloseall ();
-    }
-
-  /* Try again.  */
-  if (stage == 5)
-    {
-      ++stage;
-      raise (SIGABRT);
-    }
-
-  /* Now try to abort using the system specific command.  */
-  if (stage == 6)
-    {
-      ++stage;
-      ABORT_INSTRUCTION;
-    }
-
-  /* If we can't signal ourselves and the abort instruction failed, exit.  */
-  if (stage == 7)
-    {
-      ++stage;
-      _exit (127);
-    }
-
-  /* If even this fails try to use the provided instruction to crash
-     or otherwise make sure we never return.  */
-  while (1)
-    /* Try for ever and ever.  */
-    ABORT_INSTRUCTION;
-}
-libc_hidden_def (abort)
diff --git a/sysdeps/generic/accept.c b/sysdeps/generic/accept.c
deleted file mode 100644
index dad34ceddd..0000000000
--- a/sysdeps/generic/accept.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Await a connection on socket FD.
-   When a connection arrives, open a new socket to communicate with it,
-   set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
-   peer and *ADDR_LEN to the address's actual length, and return the
-   new socket's descriptor, or -1 for errors.  */
-int
-accept (fd, addr, addr_len)
-     int fd;
-     __SOCKADDR_ARG addr;
-     socklen_t *addr_len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (accept)
-
-
-stub_warning (accept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/access.c b/sysdeps/generic/access.c
deleted file mode 100644
index c266e945a9..0000000000
--- a/sysdeps/generic/access.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-/* Test for access to FILE.  */
-int
-__access (file, type)
-     const char *file;
-     int type;
-{
-  if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (access)
-
-weak_alias (__access, access)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/acct.c b/sysdeps/generic/acct.c
deleted file mode 100644
index b626b5d938..0000000000
--- a/sysdeps/generic/acct.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Turn accounting on if NAME is an existing file.  The system will then write
-   a record for each process as it terminates, to this file.  If NAME is NULL,
-   turn accounting off.  This call is restricted to the super-user.  */
-int
-acct (name)
-     const char *name;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (acct)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/add_n.c b/sysdeps/generic/add_n.c
deleted file mode 100644
index 5fcb7e4835..0000000000
--- a/sysdeps/generic/add_n.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* mpn_add_n -- Add two limb vectors of equal, non-zero length.
-
-Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-mp_limb_t
-#if __STDC__
-mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size)
-#else
-mpn_add_n (res_ptr, s1_ptr, s2_ptr, size)
-     register mp_ptr res_ptr;
-     register mp_srcptr s1_ptr;
-     register mp_srcptr s2_ptr;
-     mp_size_t size;
-#endif
-{
-  register mp_limb_t x, y, cy;
-  register mp_size_t j;
-
-  /* The loop counter and index J goes from -SIZE to -1.  This way
-     the loop becomes faster.  */
-  j = -size;
-
-  /* Offset the base pointers to compensate for the negative indices.  */
-  s1_ptr -= j;
-  s2_ptr -= j;
-  res_ptr -= j;
-
-  cy = 0;
-  do
-    {
-      y = s2_ptr[j];
-      x = s1_ptr[j];
-      y += cy;			/* add previous carry to one addend */
-      cy = (y < cy);		/* get out carry from that addition */
-      y = x + y;		/* add other addend */
-      cy = (y < x) + cy;	/* get out carry from that add, combine */
-      res_ptr[j] = y;
-    }
-  while (++j != 0);
-
-  return cy;
-}
diff --git a/sysdeps/generic/addmul_1.c b/sysdeps/generic/addmul_1.c
deleted file mode 100644
index 746ae31307..0000000000
--- a/sysdeps/generic/addmul_1.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* mpn_addmul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR
-   by S2_LIMB, add the S1_SIZE least significant limbs of the product to the
-   limb vector pointed to by RES_PTR.  Return the most significant limb of
-   the product, adjusted for carry-out from the addition.
-
-Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-mp_limb_t
-mpn_addmul_1 (res_ptr, s1_ptr, s1_size, s2_limb)
-     register mp_ptr res_ptr;
-     register mp_srcptr s1_ptr;
-     mp_size_t s1_size;
-     register mp_limb_t s2_limb;
-{
-  register mp_limb_t cy_limb;
-  register mp_size_t j;
-  register mp_limb_t prod_high, prod_low;
-  register mp_limb_t x;
-
-  /* The loop counter and index J goes from -SIZE to -1.  This way
-     the loop becomes faster.  */
-  j = -s1_size;
-
-  /* Offset the base pointers to compensate for the negative indices.  */
-  res_ptr -= j;
-  s1_ptr -= j;
-
-  cy_limb = 0;
-  do
-    {
-      umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb);
-
-      prod_low += cy_limb;
-      cy_limb = (prod_low < cy_limb) + prod_high;
-
-      x = res_ptr[j];
-      prod_low = x + prod_low;
-      cy_limb += (prod_low < x);
-      res_ptr[j] = prod_low;
-    }
-  while (++j != 0);
-
-  return cy_limb;
-}
diff --git a/sysdeps/generic/adjtime.c b/sysdeps/generic/adjtime.c
deleted file mode 100644
index 8645652188..0000000000
--- a/sysdeps/generic/adjtime.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/time.h>
-
-/* Adjust the current time of day by the amount in DELTA.
-   If OLDDELTA is not NULL, it is filled in with the amount
-   of time adjustment remaining to be done from the last `__adjtime' call.
-   This call is restricted to the super-user.  */
-int
-__adjtime (delta, olddelta)
-     const struct timeval *delta;
-     struct timeval *olddelta;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (adjtime)
-
-weak_alias (__adjtime, adjtime)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_cancel.c b/sysdeps/generic/aio_cancel.c
deleted file mode 100644
index c24a2f7529..0000000000
--- a/sysdeps/generic/aio_cancel.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Cancel requests associated with given file descriptor.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-/* We use an UGLY hack to prevent gcc from finding us cheating.  The
-   implementation of aio_cancel and aio_cancel64 are identical and so
-   we want to avoid code duplication by using aliases.  But gcc sees
-   the different parameter lists and prints a warning.  We define here
-   a function so that aio_cancel64 has no prototype.  */
-#define aio_cancel64 XXX
-#include <aio.h>
-/* And undo the hack.  */
-#undef aio_cancel64
-
-#include <errno.h>
-
-int
-aio_cancel (int fildes, struct aiocb *aiocbp)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (aio_cancel, aio_cancel64)
-
-stub_warning (aio_cancel)
-stub_warning (aio_cancel64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_fsync.c b/sysdeps/generic/aio_fsync.c
deleted file mode 100644
index bc23d75f69..0000000000
--- a/sysdeps/generic/aio_fsync.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Synchronize I/O in given file descriptor.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-/* We use an UGLY hack to prevent gcc from finding us cheating.  The
-   implementation of aio_fsync and aio_fsync64 are identical and so
-   we want to avoid code duplication by using aliases.  But gcc sees
-   the different parameter lists and prints a warning.  We define here
-   a function so that aio_fsync64 has no prototype.  */
-#define aio_fsync64 XXX
-#include <aio.h>
-/* And undo the hack.  */
-#undef aio_fsync64
-
-#include <errno.h>
-#include <fcntl.h>
-
-int
-aio_fsync (int op, struct aiocb *aiocbp)
-{
-  if (op != O_SYNC && op != O_DSYNC)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (aio_fsync, aio_fsync64)
-
-stub_warning (aio_fsync)
-stub_warning (aio_fsync64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_misc.c b/sysdeps/generic/aio_misc.c
deleted file mode 100644
index c29b8d0eae..0000000000
--- a/sysdeps/generic/aio_misc.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Handle general operations.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <aio.h>
-#include <aio_misc.h>
-
-/* This file is for internal code needed by the aio_* implementation.  */
-
-void
-__aio_init (const struct aioinit *init)
-{
-}
-weak_alias (__aio_init, aio_init)
diff --git a/sysdeps/generic/aio_notify.c b/sysdeps/generic/aio_notify.c
deleted file mode 100644
index 2c79ee6c2f..0000000000
--- a/sysdeps/generic/aio_notify.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Notify initiator of AIO request.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <aio.h>
-#include <aio_misc.h>
-
-/* This file contains only internal functions used by
-   the particular aio_* implementation code.  */
diff --git a/sysdeps/generic/aio_read.c b/sysdeps/generic/aio_read.c
deleted file mode 100644
index db1d19f3d7..0000000000
--- a/sysdeps/generic/aio_read.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Asynchronous read.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <aio.h>
-#include <errno.h>
-
-#ifdef BE_AIO64
-#define aiocb		aiocb64
-#define aio_read	aio_read64
-#endif
-
-int
-aio_read (struct aiocb *aiocbp)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (aio_read)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_read64.c b/sysdeps/generic/aio_read64.c
deleted file mode 100644
index c1292352af..0000000000
--- a/sysdeps/generic/aio_read64.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define BE_AIO64
-#include "aio_read.c"
diff --git a/sysdeps/generic/aio_sigqueue.c b/sysdeps/generic/aio_sigqueue.c
deleted file mode 100644
index e824c6b3de..0000000000
--- a/sysdeps/generic/aio_sigqueue.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <aio.h>
-#include <errno.h>
-#include <signal.h>
-
-#include "aio_misc.h"
-
-int
-__aio_sigqueue (sig, val, caller_pid)
-     int sig;
-     const union sigval val;
-     pid_t caller_pid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (__aio_sigqueue)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_suspend.c b/sysdeps/generic/aio_suspend.c
deleted file mode 100644
index 0530f0019c..0000000000
--- a/sysdeps/generic/aio_suspend.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Suspend until termination of a requests.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-/* We use an UGLY hack to prevent gcc from finding us cheating.  The
-   implementations of aio_suspend and aio_suspend64 are identical and so
-   we want to avoid code duplication by using aliases.  But gcc sees
-   the different parameter lists and prints a warning.  We define here
-   a function so that aio_suspend64 has no prototype.  */
-#define aio_suspend64 XXX
-#include <aio.h>
-/* And undo the hack.  */
-#undef aio_suspend64
-
-#include <errno.h>
-#include <sys/time.h>
-
-
-int
-aio_suspend (const struct aiocb *const list[], int nent,
-	     const struct timespec *timeout)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (aio_suspend, aio_suspend64)
-
-stub_warning (aio_suspend)
-stub_warning (aio_suspend64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_write.c b/sysdeps/generic/aio_write.c
deleted file mode 100644
index bc62fcb469..0000000000
--- a/sysdeps/generic/aio_write.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Asynchronous write.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <aio.h>
-#include <errno.h>
-
-#ifdef BE_AIO64
-#define aiocb		aiocb64
-#define aio_write	aio_write64
-#endif
-
-int
-aio_write (struct aiocb *aiocbp)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (aio_write)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/aio_write64.c b/sysdeps/generic/aio_write64.c
deleted file mode 100644
index bb1693eeee..0000000000
--- a/sysdeps/generic/aio_write64.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define BE_AIO64
-#include "aio_write.c"
diff --git a/sysdeps/generic/alarm.c b/sysdeps/generic/alarm.c
deleted file mode 100644
index 1f0cceb58e..0000000000
--- a/sysdeps/generic/alarm.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Schedule an alarm.  In SECONDS seconds, the process will get a SIGALRM.
-   If SECONDS is zero, any currently scheduled alarm will be cancelled.
-   The function returns the number of seconds remaining until the last
-   alarm scheduled would have signaled, or zero if there wasn't one.
-   There is no return value to indicate an error, but you can set `errno'
-   to 0 and check its value after calling `alarm', and this might tell you.
-   The signal may come late due to processor scheduling.  */
-unsigned int
-alarm (seconds)
-     unsigned int seconds;
-{
-  __set_errno (ENOSYS);
-  return 0;
-}
-libc_hidden_def (alarm)
-
-stub_warning (alarm)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/allocrtsig.c b/sysdeps/generic/allocrtsig.c
deleted file mode 100644
index ac8d2b6bfe..0000000000
--- a/sysdeps/generic/allocrtsig.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Handle real-time signal allocation.
-   Copyright (C) 1997,98,99,2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-
-/* In these variables we keep track of the used variables.  If the
-   platform does not support any real-time signals we will define the
-   values to some unreasonable value which will signal failing of all
-   the functions below.  */
-#ifndef __SIGRTMIN
-static int current_rtmin = -1;
-static int current_rtmax = -1;
-#else
-static int current_rtmin;
-static int current_rtmax;
-
-static int initialized;
-
-#include <testrtsig.h>
-
-static void
-init (void)
-{
-  if (!kernel_has_rtsig ())
-    {
-      current_rtmin = -1;
-      current_rtmax = -1;
-    }
-  else
-    {
-      current_rtmin = __SIGRTMIN;
-      current_rtmax = __SIGRTMAX;
-    }
-  initialized = 1;
-}
-#endif
-
-/* Return number of available real-time signal with highest priority.  */
-int
-__libc_current_sigrtmin (void)
-{
-#ifdef __SIGRTMIN
-  if (!initialized)
-    init ();
-#endif
-  return current_rtmin;
-}
-libc_hidden_def (__libc_current_sigrtmin)
-
-/* Return number of available real-time signal with lowest priority.  */
-int
-__libc_current_sigrtmax (void)
-{
-#ifdef __SIGRTMIN
-  if (!initialized)
-    init ();
-#endif
-  return current_rtmax;
-}
-libc_hidden_def (__libc_current_sigrtmax)
-
-/* Allocate real-time signal with highest/lowest available
-   priority.  Please note that we don't use a lock since we assume
-   this function to be called at program start.  */
-int
-__libc_allocate_rtsig (int high)
-{
-#ifndef __SIGRTMIN
-  return -1;
-#else
-  if (!initialized)
-    init ();
-  if (current_rtmin == -1 || current_rtmin > current_rtmax)
-    /* We don't have anymore signal available.  */
-    return -1;
-
-  return high ? current_rtmin++ : current_rtmax--;
-#endif
-}
diff --git a/sysdeps/generic/alphasort64.c b/sysdeps/generic/alphasort64.c
deleted file mode 100644
index fe84aec2f1..0000000000
--- a/sysdeps/generic/alphasort64.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1992, 1997, 1998, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <dirent.h>
-#include <string.h>
-
-int
-alphasort64 (const void *a, const void *b)
-{
-  return strcoll ((*(const struct dirent64 **) a)->d_name,
-		  (*(const struct dirent64 **) b)->d_name);
-}
diff --git a/sysdeps/generic/backtrace.c b/sysdeps/generic/backtrace.c
deleted file mode 100644
index 6a3336c6d2..0000000000
--- a/sysdeps/generic/backtrace.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Return backtrace of current program state.  Generic version.
-   Copyright (C) 1998, 2000, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <execinfo.h>
-#include <signal.h>
-#include <frame.h>
-#include <sigcontextinfo.h>
-#include <bp-checks.h>
-#include <ldsodefs.h>
-
-/* This implementation assumes a stack layout that matches the defaults
-   used by gcc's `__builtin_frame_address' and `__builtin_return_address'
-   (FP is the frame pointer register):
-
-	  +-----------------+     +-----------------+
-    FP -> | previous FP --------> | previous FP ------>...
-	  |                 |     |                 |
-	  | return address  |     | return address  |
-	  +-----------------+     +-----------------+
-
-  */
-
-/* Get some notion of the current stack.  Need not be exactly the top
-   of the stack, just something somewhere in the current frame.  */
-#ifndef CURRENT_STACK_FRAME
-# define CURRENT_STACK_FRAME  ({ char __csf; &__csf; })
-#endif
-
-/* By default we assume that the stack grows downward.  */
-#ifndef INNER_THAN
-# define INNER_THAN <
-#endif
-
-/* By default assume the `next' pointer in struct layout points to the
-   next struct layout.  */
-#ifndef ADVANCE_STACK_FRAME
-# define ADVANCE_STACK_FRAME(next) BOUNDED_1 ((struct layout *) (next))
-#endif
-
-/* By default, the frame pointer is just what we get from gcc.  */
-#ifndef FIRST_FRAME_POINTER
-# define FIRST_FRAME_POINTER  __builtin_frame_address (0)
-#endif
-
-int
-__backtrace (array, size)
-     void **array;
-     int size;
-{
-  struct layout *current;
-  void *__unbounded top_frame;
-  void *__unbounded top_stack;
-  int cnt = 0;
-
-  top_frame = FIRST_FRAME_POINTER;
-  top_stack = CURRENT_STACK_FRAME;
-
-  /* We skip the call to this function, it makes no sense to record it.  */
-  current = BOUNDED_1 ((struct layout *) top_frame);
-  while (cnt < size)
-    {
-      if ((void *) current INNER_THAN top_stack
-	  || !((void *) current INNER_THAN __libc_stack_end))
-       /* This means the address is out of range.  Note that for the
-	  toplevel we see a frame pointer with value NULL which clearly is
-	  out of range.  */
-	break;
-
-      array[cnt++] = current->return_address;
-
-      current = ADVANCE_STACK_FRAME (current->next);
-    }
-
-  return cnt;
-}
-weak_alias (__backtrace, backtrace)
diff --git a/sysdeps/generic/backtracesyms.c b/sysdeps/generic/backtracesyms.c
deleted file mode 100644
index db7ba36d0f..0000000000
--- a/sysdeps/generic/backtracesyms.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Return list with names for address in backtrace.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <execinfo.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* Assume the worst for the width of an address.  */
-#define WORD_WIDTH 16
-
-
-char **
-__backtrace_symbols (array, size)
-     void *const *array;
-     int size;
-{
-  int cnt;
-  size_t total = 0;
-  char **result;
-
-  /* We can compute the text size needed for the symbols since we print
-     them all as "[+0x<addr>]".  */
-  total = size * (WORD_WIDTH + 6);
-
-  /* Allocate memory for the result.  */
-  result = malloc (size * sizeof (char *) + total);
-  if (result != NULL)
-    {
-      char *last = (char *) (result + size);
-
-      for (cnt = 0; cnt < size; ++cnt)
-	{
-	  result[cnt] = last;
-	  last += 1 + sprintf (last, "[+%p]", array[cnt]);
-	}
-    }
-
-  return result;
-}
-weak_alias (__backtrace_symbols, backtrace_symbols)
diff --git a/sysdeps/generic/backtracesymsfd.c b/sysdeps/generic/backtracesymsfd.c
deleted file mode 100644
index c704362ec7..0000000000
--- a/sysdeps/generic/backtracesymsfd.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Write formatted list with names for addresses in backtrace to a file.
-   Copyright (C) 1998, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <execinfo.h>
-#include <string.h>
-#include <sys/uio.h>
-
-#include <stdio-common/_itoa.h>
-#include <not-cancel.h>
-
-#if __ELF_NATIVE_CLASS == 32
-# define WORD_WIDTH 8
-#else
-/* We assume 64bits.  */
-# define WORD_WIDTH 16
-#endif
-
-
-void
-__backtrace_symbols_fd (array, size, fd)
-     void *const *array;
-     int size;
-     int fd;
-{
-  struct iovec iov[3];
-  int cnt;
-
-  for (cnt = 0; cnt < size; ++cnt)
-    {
-      char buf[WORD_WIDTH];
-
-      iov[0].iov_base = (void *) "[0x";
-      iov[0].iov_len = 3;
-
-      iov[1].iov_base = _itoa_word ((unsigned long int) array[cnt],
-				    &buf[WORD_WIDTH], 16, 0);
-      iov[1].iov_len = &buf[WORD_WIDTH] - (char *) iov[1].iov_base;
-
-      iov[2].iov_base = (void *) "]\n";
-      iov[2].iov_len = 2;
-
-      /* We prefer to use the non-cancelable interface if it is available.  */
-      writev_not_cancel_no_status (fd, iov, 3);
-    }
-}
-weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd)
diff --git a/sysdeps/generic/bb_init_func.c b/sysdeps/generic/bb_init_func.c
deleted file mode 100644
index 19901d8d09..0000000000
--- a/sysdeps/generic/bb_init_func.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger (davidm@cs.arizona.edu).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* __bb_init_func is invoked at the beginning of each function, before
-   any registers have been saved.  This generic routine should work
-   provided that calling this function doesn't mangle the arguments
-   passed to the function being called.  If that's not the case, a
-   system specific routine must be provided.  */
-
-#include <sys/types.h>
-#include <sys/gmon.h>
-
-#include <stdlib.h>
-
-void
-__bb_init_func (struct __bb *bb)
-{
-  struct gmonparam *p = &_gmonparam;
-
-  if (bb->zero_word != 0)
-    {
-      return;	/* handle common case quickly */
-    }
-
-  /* insert this basic-block into basic-block list: */
-  bb->zero_word = 1;
-  bb->next = __bb_head;
-  __bb_head = bb;
-
-  if (bb->next == 0 && p->state != GMON_PROF_ON)
-    {
-      /* we didn't register _mcleanup yet and pc profiling doesn't seem
-	 to be active, so let's register it now: */
-      extern void *__dso_handle __attribute__ ((__weak__));
-      __cxa_atexit ((void (*) (void *)) _mcleanup, NULL,
-		    &__dso_handle ? __dso_handle : NULL);
-    }
-}
diff --git a/sysdeps/generic/bcopy.c b/sysdeps/generic/bcopy.c
deleted file mode 100644
index 3f16b884ac..0000000000
--- a/sysdeps/generic/bcopy.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#define	memmove		bcopy
-#define	rettype		void
-#define	RETURN(s)	return
-#define	a1		src
-#define	a1const		const
-#define	a2		dest
-#define	a2const
-
-#include <memmove.c>
diff --git a/sysdeps/generic/bind.c b/sysdeps/generic/bind.c
deleted file mode 100644
index 382e29db16..0000000000
--- a/sysdeps/generic/bind.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Give the socket FD the local address ADDR (which is LEN bytes long).  */
-int
-__bind (fd, addr, len)
-     int fd;
-     __CONST_SOCKADDR_ARG addr;
-     socklen_t len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__bind, bind)
-
-stub_warning (bind)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/bits/atomic.h b/sysdeps/generic/bits/atomic.h
deleted file mode 100644
index 6245130a91..0000000000
--- a/sysdeps/generic/bits/atomic.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _BITS_ATOMIC_H
-#define _BITS_ATOMIC_H	1
-
-/* We have by default no support for atomic operations.  So define
-   them non-atomic.  If this is a problem somebody will have to come
-   up with real definitions.  */
-
-/* The only basic operation needed is compare and exchange.  */
-#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
-  ({ __typeof (mem) __gmemp = (mem);				      \
-     __typeof (*mem) __gret = *__gmemp;				      \
-     __typeof (*mem) __gnewval = (newval);			      \
-								      \
-     if (__gret == (oldval))					      \
-       *__gmemp = __gnewval;					      \
-     __gret; })
-
-#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
-  ({ __typeof (mem) __gmemp = (mem);				      \
-     __typeof (*mem) __gnewval = (newval);			      \
-								      \
-     *__gmemp == (oldval) ? (*__gmemp = __gnewval, 0) : 1; })
-
-#endif	/* bits/atomic.h */
diff --git a/sysdeps/generic/bits/byteswap.h b/sysdeps/generic/bits/byteswap.h
deleted file mode 100644
index 38d8540130..0000000000
--- a/sysdeps/generic/bits/byteswap.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997, 1998, 2000, 2001, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
-# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
-#endif
-
-#ifndef _BITS_BYTESWAP_H
-#define _BITS_BYTESWAP_H 1
-
-/* Swap bytes in 16 bit value.  */
-#ifdef __GNUC__
-# define __bswap_16(x) \
-    (__extension__							      \
-     ({ unsigned short int __bsx = (x);					      \
-        ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }))
-#else
-static __inline unsigned short int
-__bswap_16 (unsigned short int __bsx)
-{
-  return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
-}
-#endif
-
-/* Swap bytes in 32 bit value.  */
-#ifdef __GNUC__
-# define __bswap_32(x) \
-    (__extension__							      \
-     ({ unsigned int __bsx = (x);					      \
-        ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |    \
-	 (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24)); }))
-#else
-static __inline unsigned int
-__bswap_32 (unsigned int __bsx)
-{
-  return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |
-	  (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24));
-}
-#endif
-
-#if defined __GNUC__ && __GNUC__ >= 2
-/* Swap bytes in 64 bit value.  */
-# define __bswap_constant_64(x) \
-     ((((x) & 0xff00000000000000ull) >> 56)				      \
-      | (((x) & 0x00ff000000000000ull) >> 40)				      \
-      | (((x) & 0x0000ff0000000000ull) >> 24)				      \
-      | (((x) & 0x000000ff00000000ull) >> 8)				      \
-      | (((x) & 0x00000000ff000000ull) << 8)				      \
-      | (((x) & 0x0000000000ff0000ull) << 24)				      \
-      | (((x) & 0x000000000000ff00ull) << 40)				      \
-      | (((x) & 0x00000000000000ffull) << 56))
-
-# define __bswap_64(x) \
-     (__extension__							      \
-      ({ union { __extension__ unsigned long long int __ll;		      \
-		 unsigned int __l[2]; } __w, __r;			      \
-         if (__builtin_constant_p (x))					      \
-	   __r.__ll = __bswap_constant_64 (x);				      \
-	 else								      \
-	   {								      \
-	     __w.__ll = (x);						      \
-	     __r.__l[0] = __bswap_32 (__w.__l[1]);			      \
-	     __r.__l[1] = __bswap_32 (__w.__l[0]);			      \
-	   }								      \
-	 __r.__ll; }))
-#endif
-
-#endif /* _BITS_BYTESWAP_H */
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h
deleted file mode 100644
index 8947d48ed7..0000000000
--- a/sysdeps/generic/bits/confname.h
+++ /dev/null
@@ -1,601 +0,0 @@
-/* `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
-   Copyright (C) 1993,1995-1998,2000,2001,2003,2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _UNISTD_H
-# error "Never use <bits/confname.h> directly; include <unistd.h> instead."
-#endif
-
-/* Values for the NAME argument to `pathconf' and `fpathconf'.  */
-enum
-  {
-    _PC_LINK_MAX,
-#define	_PC_LINK_MAX			_PC_LINK_MAX
-    _PC_MAX_CANON,
-#define	_PC_MAX_CANON			_PC_MAX_CANON
-    _PC_MAX_INPUT,
-#define	_PC_MAX_INPUT			_PC_MAX_INPUT
-    _PC_NAME_MAX,
-#define	_PC_NAME_MAX			_PC_NAME_MAX
-    _PC_PATH_MAX,
-#define	_PC_PATH_MAX			_PC_PATH_MAX
-    _PC_PIPE_BUF,
-#define	_PC_PIPE_BUF			_PC_PIPE_BUF
-    _PC_CHOWN_RESTRICTED,
-#define	_PC_CHOWN_RESTRICTED		_PC_CHOWN_RESTRICTED
-    _PC_NO_TRUNC,
-#define	_PC_NO_TRUNC			_PC_NO_TRUNC
-    _PC_VDISABLE,
-#define _PC_VDISABLE			_PC_VDISABLE
-    _PC_SYNC_IO,
-#define	_PC_SYNC_IO			_PC_SYNC_IO
-    _PC_ASYNC_IO,
-#define	_PC_ASYNC_IO			_PC_ASYNC_IO
-    _PC_PRIO_IO,
-#define	_PC_PRIO_IO			_PC_PRIO_IO
-    _PC_SOCK_MAXBUF,
-#define	_PC_SOCK_MAXBUF			_PC_SOCK_MAXBUF
-    _PC_FILESIZEBITS,
-#define _PC_FILESIZEBITS		_PC_FILESIZEBITS
-    _PC_REC_INCR_XFER_SIZE,
-#define _PC_REC_INCR_XFER_SIZE		_PC_REC_INCR_XFER_SIZE
-    _PC_REC_MAX_XFER_SIZE,
-#define _PC_REC_MAX_XFER_SIZE		_PC_REC_MAX_XFER_SIZE
-    _PC_REC_MIN_XFER_SIZE,
-#define _PC_REC_MIN_XFER_SIZE		_PC_REC_MIN_XFER_SIZE
-    _PC_REC_XFER_ALIGN,
-#define _PC_REC_XFER_ALIGN		_PC_REC_XFER_ALIGN
-    _PC_ALLOC_SIZE_MIN,
-#define _PC_ALLOC_SIZE_MIN		_PC_ALLOC_SIZE_MIN
-    _PC_SYMLINK_MAX,
-#define _PC_SYMLINK_MAX			_PC_SYMLINK_MAX
-    _PC_2_SYMLINKS
-#define _PC_2_SYMLINKS			_PC_2_SYMLINKS
-  };
-
-/* Values for the argument to `sysconf'.  */
-enum
-  {
-    _SC_ARG_MAX,
-#define	_SC_ARG_MAX			_SC_ARG_MAX
-    _SC_CHILD_MAX,
-#define	_SC_CHILD_MAX			_SC_CHILD_MAX
-    _SC_CLK_TCK,
-#define	_SC_CLK_TCK			_SC_CLK_TCK
-    _SC_NGROUPS_MAX,
-#define	_SC_NGROUPS_MAX			_SC_NGROUPS_MAX
-    _SC_OPEN_MAX,
-#define	_SC_OPEN_MAX			_SC_OPEN_MAX
-    _SC_STREAM_MAX,
-#define	_SC_STREAM_MAX			_SC_STREAM_MAX
-    _SC_TZNAME_MAX,
-#define	_SC_TZNAME_MAX			_SC_TZNAME_MAX
-    _SC_JOB_CONTROL,
-#define	_SC_JOB_CONTROL			_SC_JOB_CONTROL
-    _SC_SAVED_IDS,
-#define	_SC_SAVED_IDS			_SC_SAVED_IDS
-    _SC_REALTIME_SIGNALS,
-#define	_SC_REALTIME_SIGNALS		_SC_REALTIME_SIGNALS
-    _SC_PRIORITY_SCHEDULING,
-#define	_SC_PRIORITY_SCHEDULING		_SC_PRIORITY_SCHEDULING
-    _SC_TIMERS,
-#define	_SC_TIMERS			_SC_TIMERS
-    _SC_ASYNCHRONOUS_IO,
-#define	_SC_ASYNCHRONOUS_IO		_SC_ASYNCHRONOUS_IO
-    _SC_PRIORITIZED_IO,
-#define	_SC_PRIORITIZED_IO		_SC_PRIORITIZED_IO
-    _SC_SYNCHRONIZED_IO,
-#define	_SC_SYNCHRONIZED_IO		_SC_SYNCHRONIZED_IO
-    _SC_FSYNC,
-#define	_SC_FSYNC			_SC_FSYNC
-    _SC_MAPPED_FILES,
-#define	_SC_MAPPED_FILES		_SC_MAPPED_FILES
-    _SC_MEMLOCK,
-#define	_SC_MEMLOCK			_SC_MEMLOCK
-    _SC_MEMLOCK_RANGE,
-#define	_SC_MEMLOCK_RANGE		_SC_MEMLOCK_RANGE
-    _SC_MEMORY_PROTECTION,
-#define	_SC_MEMORY_PROTECTION		_SC_MEMORY_PROTECTION
-    _SC_MESSAGE_PASSING,
-#define	_SC_MESSAGE_PASSING		_SC_MESSAGE_PASSING
-    _SC_SEMAPHORES,
-#define	_SC_SEMAPHORES			_SC_SEMAPHORES
-    _SC_SHARED_MEMORY_OBJECTS,
-#define	_SC_SHARED_MEMORY_OBJECTS	_SC_SHARED_MEMORY_OBJECTS
-    _SC_AIO_LISTIO_MAX,
-#define	_SC_AIO_LISTIO_MAX		_SC_AIO_LISTIO_MAX
-    _SC_AIO_MAX,
-#define	_SC_AIO_MAX			_SC_AIO_MAX
-    _SC_AIO_PRIO_DELTA_MAX,
-#define	_SC_AIO_PRIO_DELTA_MAX		_SC_AIO_PRIO_DELTA_MAX
-    _SC_DELAYTIMER_MAX,
-#define	_SC_DELAYTIMER_MAX		_SC_DELAYTIMER_MAX
-    _SC_MQ_OPEN_MAX,
-#define	_SC_MQ_OPEN_MAX			_SC_MQ_OPEN_MAX
-    _SC_MQ_PRIO_MAX,
-#define	_SC_MQ_PRIO_MAX			_SC_MQ_PRIO_MAX
-    _SC_VERSION,
-#define	_SC_VERSION			_SC_VERSION
-    _SC_PAGESIZE,
-#define	_SC_PAGESIZE			_SC_PAGESIZE
-#define	_SC_PAGE_SIZE			_SC_PAGESIZE
-    _SC_RTSIG_MAX,
-#define	_SC_RTSIG_MAX			_SC_RTSIG_MAX
-    _SC_SEM_NSEMS_MAX,
-#define	_SC_SEM_NSEMS_MAX		_SC_SEM_NSEMS_MAX
-    _SC_SEM_VALUE_MAX,
-#define	_SC_SEM_VALUE_MAX		_SC_SEM_VALUE_MAX
-    _SC_SIGQUEUE_MAX,
-#define	_SC_SIGQUEUE_MAX		_SC_SIGQUEUE_MAX
-    _SC_TIMER_MAX,
-#define	_SC_TIMER_MAX			_SC_TIMER_MAX
-
-    /* Values for the argument to `sysconf'
-       corresponding to _POSIX2_* symbols.  */
-    _SC_BC_BASE_MAX,
-#define	_SC_BC_BASE_MAX			_SC_BC_BASE_MAX
-    _SC_BC_DIM_MAX,
-#define	_SC_BC_DIM_MAX			_SC_BC_DIM_MAX
-    _SC_BC_SCALE_MAX,
-#define	_SC_BC_SCALE_MAX		_SC_BC_SCALE_MAX
-    _SC_BC_STRING_MAX,
-#define	_SC_BC_STRING_MAX		_SC_BC_STRING_MAX
-    _SC_COLL_WEIGHTS_MAX,
-#define	_SC_COLL_WEIGHTS_MAX		_SC_COLL_WEIGHTS_MAX
-    _SC_EQUIV_CLASS_MAX,
-#define	_SC_EQUIV_CLASS_MAX		_SC_EQUIV_CLASS_MAX
-    _SC_EXPR_NEST_MAX,
-#define	_SC_EXPR_NEST_MAX		_SC_EXPR_NEST_MAX
-    _SC_LINE_MAX,
-#define	_SC_LINE_MAX			_SC_LINE_MAX
-    _SC_RE_DUP_MAX,
-#define	_SC_RE_DUP_MAX			_SC_RE_DUP_MAX
-    _SC_CHARCLASS_NAME_MAX,
-#define	_SC_CHARCLASS_NAME_MAX		_SC_CHARCLASS_NAME_MAX
-
-    _SC_2_VERSION,
-#define	_SC_2_VERSION			_SC_2_VERSION
-    _SC_2_C_BIND,
-#define	_SC_2_C_BIND			_SC_2_C_BIND
-    _SC_2_C_DEV,
-#define	_SC_2_C_DEV			_SC_2_C_DEV
-    _SC_2_FORT_DEV,
-#define	_SC_2_FORT_DEV			_SC_2_FORT_DEV
-    _SC_2_FORT_RUN,
-#define	_SC_2_FORT_RUN			_SC_2_FORT_RUN
-    _SC_2_SW_DEV,
-#define	_SC_2_SW_DEV			_SC_2_SW_DEV
-    _SC_2_LOCALEDEF,
-#define	_SC_2_LOCALEDEF			_SC_2_LOCALEDEF
-
-    _SC_PII,
-#define	_SC_PII				_SC_PII
-    _SC_PII_XTI,
-#define	_SC_PII_XTI			_SC_PII_XTI
-    _SC_PII_SOCKET,
-#define	_SC_PII_SOCKET			_SC_PII_SOCKET
-    _SC_PII_INTERNET,
-#define	_SC_PII_INTERNET		_SC_PII_INTERNET
-    _SC_PII_OSI,
-#define	_SC_PII_OSI			_SC_PII_OSI
-    _SC_POLL,
-#define	_SC_POLL			_SC_POLL
-    _SC_SELECT,
-#define	_SC_SELECT			_SC_SELECT
-    _SC_UIO_MAXIOV,
-#define	_SC_UIO_MAXIOV			_SC_UIO_MAXIOV
-    _SC_IOV_MAX = _SC_UIO_MAXIOV,
-#define _SC_IOV_MAX			_SC_IOV_MAX
-    _SC_PII_INTERNET_STREAM,
-#define	_SC_PII_INTERNET_STREAM		_SC_PII_INTERNET_STREAM
-    _SC_PII_INTERNET_DGRAM,
-#define	_SC_PII_INTERNET_DGRAM		_SC_PII_INTERNET_DGRAM
-    _SC_PII_OSI_COTS,
-#define	_SC_PII_OSI_COTS		_SC_PII_OSI_COTS
-    _SC_PII_OSI_CLTS,
-#define	_SC_PII_OSI_CLTS		_SC_PII_OSI_CLTS
-    _SC_PII_OSI_M,
-#define	_SC_PII_OSI_M			_SC_PII_OSI_M
-    _SC_T_IOV_MAX,
-#define	_SC_T_IOV_MAX			_SC_T_IOV_MAX
-
-    /* Values according to POSIX 1003.1c (POSIX threads).  */
-    _SC_THREADS,
-#define	_SC_THREADS			_SC_THREADS
-    _SC_THREAD_SAFE_FUNCTIONS,
-#define _SC_THREAD_SAFE_FUNCTIONS	_SC_THREAD_SAFE_FUNCTIONS
-    _SC_GETGR_R_SIZE_MAX,
-#define	_SC_GETGR_R_SIZE_MAX		_SC_GETGR_R_SIZE_MAX
-    _SC_GETPW_R_SIZE_MAX,
-#define	_SC_GETPW_R_SIZE_MAX		_SC_GETPW_R_SIZE_MAX
-    _SC_LOGIN_NAME_MAX,
-#define	_SC_LOGIN_NAME_MAX		_SC_LOGIN_NAME_MAX
-    _SC_TTY_NAME_MAX,
-#define	_SC_TTY_NAME_MAX		_SC_TTY_NAME_MAX
-    _SC_THREAD_DESTRUCTOR_ITERATIONS,
-#define	_SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS
-    _SC_THREAD_KEYS_MAX,
-#define	_SC_THREAD_KEYS_MAX		_SC_THREAD_KEYS_MAX
-    _SC_THREAD_STACK_MIN,
-#define	_SC_THREAD_STACK_MIN		_SC_THREAD_STACK_MIN
-    _SC_THREAD_THREADS_MAX,
-#define	_SC_THREAD_THREADS_MAX		_SC_THREAD_THREADS_MAX
-    _SC_THREAD_ATTR_STACKADDR,
-#define	_SC_THREAD_ATTR_STACKADDR	_SC_THREAD_ATTR_STACKADDR
-    _SC_THREAD_ATTR_STACKSIZE,
-#define	_SC_THREAD_ATTR_STACKSIZE	_SC_THREAD_ATTR_STACKSIZE
-    _SC_THREAD_PRIORITY_SCHEDULING,
-#define	_SC_THREAD_PRIORITY_SCHEDULING	_SC_THREAD_PRIORITY_SCHEDULING
-    _SC_THREAD_PRIO_INHERIT,
-#define	_SC_THREAD_PRIO_INHERIT		_SC_THREAD_PRIO_INHERIT
-    _SC_THREAD_PRIO_PROTECT,
-#define	_SC_THREAD_PRIO_PROTECT		_SC_THREAD_PRIO_PROTECT
-    _SC_THREAD_PROCESS_SHARED,
-#define	_SC_THREAD_PROCESS_SHARED	_SC_THREAD_PROCESS_SHARED
-
-    _SC_NPROCESSORS_CONF,
-#define _SC_NPROCESSORS_CONF		_SC_NPROCESSORS_CONF
-    _SC_NPROCESSORS_ONLN,
-#define _SC_NPROCESSORS_ONLN		_SC_NPROCESSORS_ONLN
-    _SC_PHYS_PAGES,
-#define _SC_PHYS_PAGES			_SC_PHYS_PAGES
-    _SC_AVPHYS_PAGES,
-#define _SC_AVPHYS_PAGES		_SC_AVPHYS_PAGES
-    _SC_ATEXIT_MAX,
-#define _SC_ATEXIT_MAX			_SC_ATEXIT_MAX
-    _SC_PASS_MAX,
-#define _SC_PASS_MAX			_SC_PASS_MAX
-
-    _SC_XOPEN_VERSION,
-#define _SC_XOPEN_VERSION		_SC_XOPEN_VERSION
-    _SC_XOPEN_XCU_VERSION,
-#define _SC_XOPEN_XCU_VERSION		_SC_XOPEN_XCU_VERSION
-    _SC_XOPEN_UNIX,
-#define _SC_XOPEN_UNIX			_SC_XOPEN_UNIX
-    _SC_XOPEN_CRYPT,
-#define _SC_XOPEN_CRYPT			_SC_XOPEN_CRYPT
-    _SC_XOPEN_ENH_I18N,
-#define _SC_XOPEN_ENH_I18N		_SC_XOPEN_ENH_I18N
-    _SC_XOPEN_SHM,
-#define _SC_XOPEN_SHM			_SC_XOPEN_SHM
-
-    _SC_2_CHAR_TERM,
-#define _SC_2_CHAR_TERM			_SC_2_CHAR_TERM
-    _SC_2_C_VERSION,
-#define _SC_2_C_VERSION			_SC_2_C_VERSION
-    _SC_2_UPE,
-#define _SC_2_UPE			_SC_2_UPE
-
-    _SC_XOPEN_XPG2,
-#define _SC_XOPEN_XPG2			_SC_XOPEN_XPG2
-    _SC_XOPEN_XPG3,
-#define _SC_XOPEN_XPG3			_SC_XOPEN_XPG3
-    _SC_XOPEN_XPG4,
-#define _SC_XOPEN_XPG4			_SC_XOPEN_XPG4
-
-    _SC_CHAR_BIT,
-#define	_SC_CHAR_BIT			_SC_CHAR_BIT
-    _SC_CHAR_MAX,
-#define	_SC_CHAR_MAX			_SC_CHAR_MAX
-    _SC_CHAR_MIN,
-#define	_SC_CHAR_MIN			_SC_CHAR_MIN
-    _SC_INT_MAX,
-#define	_SC_INT_MAX			_SC_INT_MAX
-    _SC_INT_MIN,
-#define	_SC_INT_MIN			_SC_INT_MIN
-    _SC_LONG_BIT,
-#define	_SC_LONG_BIT			_SC_LONG_BIT
-    _SC_WORD_BIT,
-#define	_SC_WORD_BIT			_SC_WORD_BIT
-    _SC_MB_LEN_MAX,
-#define	_SC_MB_LEN_MAX			_SC_MB_LEN_MAX
-    _SC_NZERO,
-#define	_SC_NZERO			_SC_NZERO
-    _SC_SSIZE_MAX,
-#define	_SC_SSIZE_MAX			_SC_SSIZE_MAX
-    _SC_SCHAR_MAX,
-#define	_SC_SCHAR_MAX			_SC_SCHAR_MAX
-    _SC_SCHAR_MIN,
-#define	_SC_SCHAR_MIN			_SC_SCHAR_MIN
-    _SC_SHRT_MAX,
-#define	_SC_SHRT_MAX			_SC_SHRT_MAX
-    _SC_SHRT_MIN,
-#define	_SC_SHRT_MIN			_SC_SHRT_MIN
-    _SC_UCHAR_MAX,
-#define	_SC_UCHAR_MAX			_SC_UCHAR_MAX
-    _SC_UINT_MAX,
-#define	_SC_UINT_MAX			_SC_UINT_MAX
-    _SC_ULONG_MAX,
-#define	_SC_ULONG_MAX			_SC_ULONG_MAX
-    _SC_USHRT_MAX,
-#define	_SC_USHRT_MAX			_SC_USHRT_MAX
-
-    _SC_NL_ARGMAX,
-#define	_SC_NL_ARGMAX			_SC_NL_ARGMAX
-    _SC_NL_LANGMAX,
-#define	_SC_NL_LANGMAX			_SC_NL_LANGMAX
-    _SC_NL_MSGMAX,
-#define	_SC_NL_MSGMAX			_SC_NL_MSGMAX
-    _SC_NL_NMAX,
-#define	_SC_NL_NMAX			_SC_NL_NMAX
-    _SC_NL_SETMAX,
-#define	_SC_NL_SETMAX			_SC_NL_SETMAX
-    _SC_NL_TEXTMAX,
-#define	_SC_NL_TEXTMAX			_SC_NL_TEXTMAX
-
-    _SC_XBS5_ILP32_OFF32,
-#define _SC_XBS5_ILP32_OFF32		_SC_XBS5_ILP32_OFF32
-    _SC_XBS5_ILP32_OFFBIG,
-#define _SC_XBS5_ILP32_OFFBIG		_SC_XBS5_ILP32_OFFBIG
-    _SC_XBS5_LP64_OFF64,
-#define _SC_XBS5_LP64_OFF64		_SC_XBS5_LP64_OFF64
-    _SC_XBS5_LPBIG_OFFBIG,
-#define _SC_XBS5_LPBIG_OFFBIG		_SC_XBS5_LPBIG_OFFBIG
-
-    _SC_XOPEN_LEGACY,
-#define _SC_XOPEN_LEGACY		_SC_XOPEN_LEGACY
-    _SC_XOPEN_REALTIME,
-#define _SC_XOPEN_REALTIME		_SC_XOPEN_REALTIME
-    _SC_XOPEN_REALTIME_THREADS,
-#define _SC_XOPEN_REALTIME_THREADS	_SC_XOPEN_REALTIME_THREADS
-
-    _SC_ADVISORY_INFO,
-#define _SC_ADVISORY_INFO		_SC_ADVISORY_INFO
-    _SC_BARRIERS,
-#define _SC_BARRIERS			_SC_BARRIERS
-    _SC_BASE,
-#define _SC_BASE			_SC_BASE
-    _SC_C_LANG_SUPPORT,
-#define _SC_C_LANG_SUPPORT		_SC_C_LANG_SUPPORT
-    _SC_C_LANG_SUPPORT_R,
-#define _SC_C_LANG_SUPPORT_R		_SC_C_LANG_SUPPORT_R
-    _SC_CLOCK_SELECTION,
-#define _SC_CLOCK_SELECTION		_SC_CLOCK_SELECTION
-    _SC_CPUTIME,
-#define _SC_CPUTIME			_SC_CPUTIME
-    _SC_THREAD_CPUTIME,
-#define _SC_THREAD_CPUTIME		_SC_THREAD_CPUTIME
-    _SC_DEVICE_IO,
-#define _SC_DEVICE_IO			_SC_DEVICE_IO
-    _SC_DEVICE_SPECIFIC,
-#define _SC_DEVICE_SPECIFIC		_SC_DEVICE_SPECIFIC
-    _SC_DEVICE_SPECIFIC_R,
-#define _SC_DEVICE_SPECIFIC_R		_SC_DEVICE_SPECIFIC_R
-    _SC_FD_MGMT,
-#define _SC_FD_MGMT			_SC_FD_MGMT
-    _SC_FIFO,
-#define _SC_FIFO			_SC_FIFO
-    _SC_PIPE,
-#define _SC_PIPE			_SC_PIPE
-    _SC_FILE_ATTRIBUTES,
-#define _SC_FILE_ATTRIBUTES		_SC_FILE_ATTRIBUTES
-    _SC_FILE_LOCKING,
-#define _SC_FILE_LOCKING		_SC_FILE_LOCKING
-    _SC_FILE_SYSTEM,
-#define _SC_FILE_SYSTEM			_SC_FILE_SYSTEM
-    _SC_MONOTONIC_CLOCK,
-#define _SC_MONOTONIC_CLOCK		_SC_MONOTONIC_CLOCK
-    _SC_MULTI_PROCESS,
-#define _SC_MULTI_PROCESS		_SC_MULTI_PROCESS
-    _SC_SINGLE_PROCESS,
-#define _SC_SINGLE_PROCESS		_SC_SINGLE_PROCESS
-    _SC_NETWORKING,
-#define _SC_NETWORKING			_SC_NETWORKING
-    _SC_READER_WRITER_LOCKS,
-#define _SC_READER_WRITER_LOCKS		_SC_READER_WRITER_LOCKS
-    _SC_SPIN_LOCKS,
-#define _SC_SPIN_LOCKS			_SC_SPIN_LOCKS
-    _SC_REGEXP,
-#define _SC_REGEXP			_SC_REGEXP
-    _SC_REGEX_VERSION,
-#define _SC_REGEX_VERSION		_SC_REGEX_VERSION
-    _SC_SHELL,
-#define _SC_SHELL			_SC_SHELL
-    _SC_SIGNALS,
-#define _SC_SIGNALS			_SC_SIGNALS
-    _SC_SPAWN,
-#define _SC_SPAWN			_SC_SPAWN
-    _SC_SPORADIC_SERVER,
-#define _SC_SPORADIC_SERVER		_SC_SPORADIC_SERVER
-    _SC_THREAD_SPORADIC_SERVER,
-#define _SC_THREAD_SPORADIC_SERVER	_SC_THREAD_SPORADIC_SERVER
-    _SC_SYSTEM_DATABASE,
-#define _SC_SYSTEM_DATABASE		_SC_SYSTEM_DATABASE
-    _SC_SYSTEM_DATABASE_R,
-#define _SC_SYSTEM_DATABASE_R		_SC_SYSTEM_DATABASE_R
-    _SC_TIMEOUTS,
-#define _SC_TIMEOUTS			_SC_TIMEOUTS
-    _SC_TYPED_MEMORY_OBJECTS,
-#define _SC_TYPED_MEMORY_OBJECTS	_SC_TYPED_MEMORY_OBJECTS
-    _SC_USER_GROUPS,
-#define _SC_USER_GROUPS			_SC_USER_GROUPS
-    _SC_USER_GROUPS_R,
-#define _SC_USER_GROUPS_R		_SC_USER_GROUPS_R
-    _SC_2_PBS,
-#define _SC_2_PBS			_SC_2_PBS
-    _SC_2_PBS_ACCOUNTING,
-#define _SC_2_PBS_ACCOUNTING		_SC_2_PBS_ACCOUNTING
-    _SC_2_PBS_LOCATE,
-#define _SC_2_PBS_LOCATE		_SC_2_PBS_LOCATE
-    _SC_2_PBS_MESSAGE,
-#define _SC_2_PBS_MESSAGE		_SC_2_PBS_MESSAGE
-    _SC_2_PBS_TRACK,
-#define _SC_2_PBS_TRACK			_SC_2_PBS_TRACK
-    _SC_SYMLOOP_MAX,
-#define _SC_SYMLOOP_MAX			_SC_SYMLOOP_MAX
-    _SC_STREAMS,
-#define _SC_STREAMS			_SC_STREAMS
-    _SC_2_PBS_CHECKPOINT,
-#define _SC_2_PBS_CHECKPOINT		_SC_2_PBS_CHECKPOINT
-
-    _SC_V6_ILP32_OFF32,
-#define _SC_V6_ILP32_OFF32		_SC_V6_ILP32_OFF32
-    _SC_V6_ILP32_OFFBIG,
-#define _SC_V6_ILP32_OFFBIG		_SC_V6_ILP32_OFFBIG
-    _SC_V6_LP64_OFF64,
-#define _SC_V6_LP64_OFF64		_SC_V6_LP64_OFF64
-    _SC_V6_LPBIG_OFFBIG,
-#define _SC_V6_LPBIG_OFFBIG		_SC_V6_LPBIG_OFFBIG
-
-    _SC_HOST_NAME_MAX,
-#define _SC_HOST_NAME_MAX		_SC_HOST_NAME_MAX
-    _SC_TRACE,
-#define _SC_TRACE			_SC_TRACE
-    _SC_TRACE_EVENT_FILTER,
-#define _SC_TRACE_EVENT_FILTER		_SC_TRACE_EVENT_FILTER
-    _SC_TRACE_INHERIT,
-#define _SC_TRACE_INHERIT		_SC_TRACE_INHERIT
-    _SC_TRACE_LOG,
-#define _SC_TRACE_LOG			_SC_TRACE_LOG
-
-    _SC_LEVEL1_ICACHE_SIZE,
-#define _SC_LEVEL1_ICACHE_SIZE		_SC_LEVEL1_ICACHE_SIZE
-    _SC_LEVEL1_ICACHE_ASSOC,
-#define _SC_LEVEL1_ICACHE_ASSOC		_SC_LEVEL1_ICACHE_ASSOC
-    _SC_LEVEL1_ICACHE_LINESIZE,
-#define _SC_LEVEL1_ICACHE_LINESIZE	_SC_LEVEL1_ICACHE_LINESIZE
-    _SC_LEVEL1_DCACHE_SIZE,
-#define _SC_LEVEL1_DCACHE_SIZE		_SC_LEVEL1_DCACHE_SIZE
-    _SC_LEVEL1_DCACHE_ASSOC,
-#define _SC_LEVEL1_DCACHE_ASSOC		_SC_LEVEL1_DCACHE_ASSOC
-    _SC_LEVEL1_DCACHE_LINESIZE,
-#define _SC_LEVEL1_DCACHE_LINESIZE	_SC_LEVEL1_DCACHE_LINESIZE
-    _SC_LEVEL2_CACHE_SIZE,
-#define _SC_LEVEL2_CACHE_SIZE		_SC_LEVEL2_CACHE_SIZE
-    _SC_LEVEL2_CACHE_ASSOC,
-#define _SC_LEVEL2_CACHE_ASSOC		_SC_LEVEL2_CACHE_ASSOC
-    _SC_LEVEL2_CACHE_LINESIZE,
-#define _SC_LEVEL2_CACHE_LINESIZE	_SC_LEVEL2_CACHE_LINESIZE
-    _SC_LEVEL3_CACHE_SIZE,
-#define _SC_LEVEL3_CACHE_SIZE		_SC_LEVEL3_CACHE_SIZE
-    _SC_LEVEL3_CACHE_ASSOC,
-#define _SC_LEVEL3_CACHE_ASSOC		_SC_LEVEL3_CACHE_ASSOC
-    _SC_LEVEL3_CACHE_LINESIZE,
-#define _SC_LEVEL3_CACHE_LINESIZE	_SC_LEVEL3_CACHE_LINESIZE
-    _SC_LEVEL4_CACHE_SIZE,
-#define _SC_LEVEL4_CACHE_SIZE		_SC_LEVEL4_CACHE_SIZE
-    _SC_LEVEL4_CACHE_ASSOC,
-#define _SC_LEVEL4_CACHE_ASSOC		_SC_LEVEL4_CACHE_ASSOC
-    _SC_LEVEL4_CACHE_LINESIZE,
-#define _SC_LEVEL4_CACHE_LINESIZE	_SC_LEVEL4_CACHE_LINESIZE
-    /* Leave room here, maybe we need a few more cache levels some day.  */
-
-    _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
-#define _SC_IPV6			_SC_IPV6
-    _SC_RAW_SOCKETS
-#define _SC_RAW_SOCKETS			_SC_RAW_SOCKETS
-  };
-
-/* Values for the NAME argument to `confstr'.  */
-enum
-  {
-    _CS_PATH,			/* The default search path.  */
-#define _CS_PATH		_CS_PATH
-
-    _CS_V6_WIDTH_RESTRICTED_ENVS,
-# define _CS_V6_WIDTH_RESTRICTED_ENVS	_CS_V6_WIDTH_RESTRICTED_ENVS
-
-    _CS_GNU_LIBC_VERSION,
-#define _CS_GNU_LIBC_VERSION	_CS_GNU_LIBC_VERSION
-    _CS_GNU_LIBPTHREAD_VERSION,
-#define _CS_GNU_LIBPTHREAD_VERSION	_CS_GNU_LIBPTHREAD_VERSION
-
-    _CS_LFS_CFLAGS = 1000,
-#define _CS_LFS_CFLAGS	_CS_LFS_CFLAGS
-    _CS_LFS_LDFLAGS,
-#define _CS_LFS_LDFLAGS	_CS_LFS_LDFLAGS
-    _CS_LFS_LIBS,
-#define _CS_LFS_LIBS		_CS_LFS_LIBS
-    _CS_LFS_LINTFLAGS,
-#define _CS_LFS_LINTFLAGS	_CS_LFS_LINTFLAGS
-    _CS_LFS64_CFLAGS,
-#define _CS_LFS64_CFLAGS	_CS_LFS64_CFLAGS
-    _CS_LFS64_LDFLAGS,
-#define _CS_LFS64_LDFLAGS	_CS_LFS64_LDFLAGS
-    _CS_LFS64_LIBS,
-#define _CS_LFS64_LIBS	_CS_LFS64_LIBS
-    _CS_LFS64_LINTFLAGS,
-#define _CS_LFS64_LINTFLAGS	_CS_LFS64_LINTFLAGS
-
-    _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
-#define _CS_XBS5_ILP32_OFF32_CFLAGS _CS_XBS5_ILP32_OFF32_CFLAGS
-    _CS_XBS5_ILP32_OFF32_LDFLAGS,
-#define _CS_XBS5_ILP32_OFF32_LDFLAGS _CS_XBS5_ILP32_OFF32_LDFLAGS
-    _CS_XBS5_ILP32_OFF32_LIBS,
-#define _CS_XBS5_ILP32_OFF32_LIBS _CS_XBS5_ILP32_OFF32_LIBS
-    _CS_XBS5_ILP32_OFF32_LINTFLAGS,
-#define _CS_XBS5_ILP32_OFF32_LINTFLAGS _CS_XBS5_ILP32_OFF32_LINTFLAGS
-    _CS_XBS5_ILP32_OFFBIG_CFLAGS,
-#define _CS_XBS5_ILP32_OFFBIG_CFLAGS _CS_XBS5_ILP32_OFFBIG_CFLAGS
-    _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
-#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS _CS_XBS5_ILP32_OFFBIG_LDFLAGS
-    _CS_XBS5_ILP32_OFFBIG_LIBS,
-#define _CS_XBS5_ILP32_OFFBIG_LIBS _CS_XBS5_ILP32_OFFBIG_LIBS
-    _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
-#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
-    _CS_XBS5_LP64_OFF64_CFLAGS,
-#define _CS_XBS5_LP64_OFF64_CFLAGS _CS_XBS5_LP64_OFF64_CFLAGS
-    _CS_XBS5_LP64_OFF64_LDFLAGS,
-#define _CS_XBS5_LP64_OFF64_LDFLAGS _CS_XBS5_LP64_OFF64_LDFLAGS
-    _CS_XBS5_LP64_OFF64_LIBS,
-#define _CS_XBS5_LP64_OFF64_LIBS _CS_XBS5_LP64_OFF64_LIBS
-    _CS_XBS5_LP64_OFF64_LINTFLAGS,
-#define _CS_XBS5_LP64_OFF64_LINTFLAGS _CS_XBS5_LP64_OFF64_LINTFLAGS
-    _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
-#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS _CS_XBS5_LPBIG_OFFBIG_CFLAGS
-    _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
-#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
-    _CS_XBS5_LPBIG_OFFBIG_LIBS,
-#define _CS_XBS5_LPBIG_OFFBIG_LIBS _CS_XBS5_LPBIG_OFFBIG_LIBS
-    _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
-#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
-
-    _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
-#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS
-    _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
-#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
-    _CS_POSIX_V6_ILP32_OFF32_LIBS,
-#define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS
-    _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
-#define _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
-    _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
-#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
-    _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
-#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
-    _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
-#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS
-    _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
-#define _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
-    _CS_POSIX_V6_LP64_OFF64_CFLAGS,
-#define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS
-    _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
-#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS
-    _CS_POSIX_V6_LP64_OFF64_LIBS,
-#define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS
-    _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
-#define _CS_POSIX_V6_LP64_OFF64_LINTFLAGS _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
-    _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
-#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
-    _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
-#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
-    _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
-#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
-    _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
-#define _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
-  };
diff --git a/sysdeps/generic/bits/dirent.h b/sysdeps/generic/bits/dirent.h
deleted file mode 100644
index 3407ebd802..0000000000
--- a/sysdeps/generic/bits/dirent.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Directory entry structure `struct dirent'.  Stub version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _DIRENT_H
-# error "Never use <bits/dirent.h> directly; include <dirent.h> instead."
-#endif
-
-struct dirent
-  {
-    char d_name[1];		/* Variable length.  */
-    int d_fileno;
-  };
-
-#ifdef __USE_LARGEFILE64
-struct dirent64
-  {
-    char d_name[1];		/* Variable length.  */
-    int d_fileno;
-  };
-#endif
-
diff --git a/sysdeps/generic/bits/dlfcn.h b/sysdeps/generic/bits/dlfcn.h
deleted file mode 100644
index 67fd96a22a..0000000000
--- a/sysdeps/generic/bits/dlfcn.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* System dependent definitions for run-time dynamic loading.
-   Copyright (C) 1996-2001, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _DLFCN_H
-# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
-#endif
-
-/* The MODE argument to `dlopen' contains one of the following: */
-#define RTLD_LAZY	0x00001	/* Lazy function call binding.  */
-#define RTLD_NOW	0x00002	/* Immediate function call binding.  */
-#define	RTLD_BINDING_MASK   0x3	/* Mask of binding time value.  */
-#define RTLD_NOLOAD	0x00004	/* Do not load the object.  */
-#define RTLD_DEEPBIND	0x00008	/* Use deep binding.  */
-
-/* If the following bit is set in the MODE argument to `dlopen',
-   the symbols of the loaded object and its dependencies are made
-   visible as if the object were linked directly into the program.  */
-#define RTLD_GLOBAL	0x00100
-
-/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
-   The implementation does this by default and so we can define the
-   value to zero.  */
-#define RTLD_LOCAL	0
-
-/* Do not delete object when closed.  */
-#define RTLD_NODELETE	0x01000
-
-#ifdef __USE_GNU
-/* To support profiling of shared objects it is a good idea to call
-   the function found using `dlsym' using the following macro since
-   these calls do not use the PLT.  But this would mean the dynamic
-   loader has no chance to find out when the function is called.  The
-   macro applies the necessary magic so that profiling is possible.
-   Rewrite
-	foo = (*fctp) (arg1, arg2);
-   into
-        foo = DL_CALL_FCT (fctp, (arg1, arg2));
-*/
-# define DL_CALL_FCT(fctp, args) \
-  (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args)
-
-__BEGIN_DECLS
-
-/* This function calls the profiling functions.  */
-extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW;
-
-__END_DECLS
-
-#endif
diff --git a/sysdeps/generic/bits/elfclass.h b/sysdeps/generic/bits/elfclass.h
deleted file mode 100644
index 180227d9e7..0000000000
--- a/sysdeps/generic/bits/elfclass.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* This file specifies the native word size of the machine, which indicates
-   the ELF file class used for executables and shared objects on this
-   machine.  */
-
-#ifndef _LINK_H
-# error "Never use <bits/elfclass.h> directly; include <link.h> instead."
-#endif
-
-#include <bits/wordsize.h>
-
-#define __ELF_NATIVE_CLASS __WORDSIZE
-
-/* The entries in the .hash table always have a size of 32 bits.  */
-typedef uint32_t Elf_Symndx;
diff --git a/sysdeps/generic/bits/endian.h b/sysdeps/generic/bits/endian.h
deleted file mode 100644
index 45afd4ae47..0000000000
--- a/sysdeps/generic/bits/endian.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* This file should define __BYTE_ORDER as appropriate for the machine
-   in question.  See string/endian.h for how to define it.
-
-   If only the stub bits/endian.h applies to a particular configuration,
-   bytesex.h is generated by running a program on the host machine.
-   So if cross-compiling to a machine with a different byte order,
-   the bits/endian.h file for that machine must exist.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#error Machine byte order unknown.
diff --git a/sysdeps/generic/bits/environments.h b/sysdeps/generic/bits/environments.h
deleted file mode 100644
index 4617dc45f2..0000000000
--- a/sysdeps/generic/bits/environments.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 1999, 2001, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _UNISTD_H
-# error "Never include this file directly.  Use <unistd.h> instead"
-#endif
-
-#include <bits/wordsize.h>
-
-/* This header should define the following symbols under the described
-   situations.  A value `1' means that the model is always supported,
-   `-1' means it is never supported.  Undefined means it cannot be
-   statically decided.
-
-   _POSIX_V6_ILP32_OFF32   32bit int, long, pointers, and off_t type
-   _POSIX_V6_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
-
-   _POSIX_V6_LP64_OFF32	   64bit long and pointers and 32bit off_t type
-   _POSIX_V6_LPBIG_OFFBIG  64bit long and pointers and large off_t type
-
-   The macros _XBS5_ILP32_OFF32, _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and
-   _XBS5_LPBIG_OFFBIG were used in previous versions of the Unix standard
-   and are available only for compatibility.
-*/
-
-#if __WORDSIZE == 64
-
-/* We can never provide environments with 32-bit wide pointers.  */
-# define _POSIX_V6_ILP32_OFF32	-1
-# define _POSIX_V6_ILP32_OFFBIG	-1
-# define _XBS5_ILP32_OFF32	-1
-# define _XBS5_ILP32_OFFBIG	-1
-/* We also have no use (for now) for an environment with bigger pointers
-   and offsets.  */
-# define _POSIX_V6_LPBIG_OFFBIG	-1
-# define _XBS5_LPBIG_OFFBIG	-1
-
-/* By default we have 64-bit wide `long int', pointers and `off_t'.  */
-# define _POSIX_V6_LP64_OFF64	1
-# define _XBS5_LP64_OFF64	1
-
-#else /* __WORDSIZE == 32 */
-
-/* By default we have 32-bit wide `int', `long int', pointers and `off_t'
-   and all platforms support LFS.  */
-# define _POSIX_V6_ILP32_OFF32	1
-# define _POSIX_V6_ILP32_OFFBIG	1
-# define _XBS5_ILP32_OFF32	1
-# define _XBS5_ILP32_OFFBIG	1
-
-/* We optionally provide an environment with the above size but an 64-bit
-   side `off_t'.  Therefore we don't define _XBS5_ILP32_OFFBIG.  */
-
-/* We can never provide environments with 64-bit wide pointers.  */
-# define _POSIX_V6_LP64_OFF64	-1
-# define _POSIX_V6_LPBIG_OFFBIG	-1
-# define _XBS5_LP64_OFF64	-1
-# define _XBS5_LPBIG_OFFBIG	-1
-
-/* CFLAGS.  */
-#define __ILP32_OFFBIG_CFLAGS   "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
-
-#endif /* __WORDSIZE == 32 */
diff --git a/sysdeps/generic/bits/errno.h b/sysdeps/generic/bits/errno.h
deleted file mode 100644
index 89a5cfddeb..0000000000
--- a/sysdeps/generic/bits/errno.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1994, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file defines the `errno' constants.  */
-
-#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
-#undef	__need_Emath
-#define	__Emath_defined	1
-
-# define EDOM	XXX	<--- fill in what is actually needed
-# define EILSEQ	XXX	<--- fill in what is actually needed
-# define ERANGE	XXX	<--- fill in what is actually needed
-#endif
-
-#ifdef	_ERRNO_H
-# error "Define here all the missing error messages for the port.  These"
-# error "must match the numbers of the kernel."
-# define Exxxx	XXX
-...
-#endif
diff --git a/sysdeps/generic/bits/fcntl.h b/sysdeps/generic/bits/fcntl.h
deleted file mode 100644
index b397f812f1..0000000000
--- a/sysdeps/generic/bits/fcntl.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* O_*, F_*, FD_* bit values for stub configuration.
-   Copyright (C) 1991, 1992, 1997, 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* These values should be changed as appropriate for your system.  */
-
-#ifndef	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-/* File access modes for `open' and `fcntl'.  */
-#define	O_RDONLY	0	/* Open read-only.  */
-#define	O_WRONLY	1	/* Open write-only.  */
-#define	O_RDWR		2	/* Open read/write.  */
-
-
-/* Bits OR'd into the second argument to open.  */
-#define	O_CREAT		0x0200	/* Create file if it doesn't exist.  */
-#define	O_EXCL		0x0800	/* Fail if file already exists.  */
-#define	O_TRUNC		0x0400	/* Truncate file to zero length.  */
-#define	O_NOCTTY	0x0100	/* Don't assign a controlling terminal.  */
-
-/* File status flags for `open' and `fcntl'.  */
-#define	O_APPEND	0x0008	/* Writes append to the file.  */
-#define	O_NONBLOCK	0x0004	/* Non-blocking I/O.  */
-
-#ifdef __USE_BSD
-# define O_NDELAY	O_NONBLOCK
-#endif
-
-/* Mask for file access modes.  This is system-dependent in case
-   some system ever wants to define some other flavor of access.  */
-#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
-
-/* Values for the second argument to `fcntl'.  */
-#define	F_DUPFD	  	0	/* Duplicate file descriptor.  */
-#define	F_GETFD		1	/* Get file descriptor flags.  */
-#define	F_SETFD		2	/* Set file descriptor flags.  */
-#define	F_GETFL		3	/* Get file status flags.  */
-#define	F_SETFL		4	/* Set file status flags.  */
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-# define F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
-#endif
-#define	F_GETLK		7	/* Get record locking info.  */
-#define	F_SETLK		8	/* Set record locking info.  */
-#define	F_SETLKW	9	/* Set record locking info, wait.  */
-
-/* File descriptor flags used with F_GETFD and F_SETFD.  */
-#define	FD_CLOEXEC	1	/* Close on exec.  */
-
-
-#include <bits/types.h>
-
-/* The structure describing an advisory lock.  This is the type of the third
-   argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-/* Values for the `l_type' field of a `struct flock'.  */
-#define	F_RDLCK	1	/* Read lock.  */
-#define	F_WRLCK	2	/* Write lock.  */
-#define	F_UNLCK	3	/* Remove lock.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
diff --git a/sysdeps/generic/bits/fenv.h b/sysdeps/generic/bits/fenv.h
deleted file mode 100644
index a9cb53b40e..0000000000
--- a/sysdeps/generic/bits/fenv.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-
-/* Here should be the exception be defined:
-    FE_INVALID
-    FE_DIVBYZERO
-    FE_OVERFLOW
-    FE_UNDERFLOW
-    FE_INEXACT
-   We define no macro which signals no exception is supported.  */
-
-#define FE_ALL_EXCEPT 0
-
-
-/* Here should the rounding modes be defined:
-    FE_TONEAREST
-    FE_DOWNWARD
-    FE_UPWARD
-    FE_TOWARDZERO
-   We define no macro which signals no rounding mode is selectable.  */
-
-
-/* Type representing exception flags.  */
-typedef unsigned int fexcept_t;
-
-
-/* Type representing floating-point environment.  */
-typedef struct
-  {
-    fexcept_t __excepts;
-    /* XXX I don't know what else we should save.  */
-  }
-fenv_t;
-
-/* If the default argument is used we use this value.  */
-#define FE_DFL_ENV	((__const fenv_t *) -1l)
diff --git a/sysdeps/generic/bits/fenvinline.h b/sysdeps/generic/bits/fenvinline.h
deleted file mode 100644
index 42f77b5618..0000000000
--- a/sysdeps/generic/bits/fenvinline.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* This file provides inline versions of floating-pint environment
-   handling functions.  If there were any.  */
-
-#ifndef __NO_MATH_INLINES
-
-/* Here is where the code would go.  */
-
-#endif
diff --git a/sysdeps/generic/bits/huge_val.h b/sysdeps/generic/bits/huge_val.h
deleted file mode 100644
index e102ac3220..0000000000
--- a/sysdeps/generic/bits/huge_val.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Stub `HUGE_VAL' constant.
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VAL	(__builtin_huge_val())
-#else
-# define HUGE_VAL	1e37
-#endif
diff --git a/sysdeps/generic/bits/huge_valf.h b/sysdeps/generic/bits/huge_valf.h
deleted file mode 100644
index 4cb5ebdfcb..0000000000
--- a/sysdeps/generic/bits/huge_valf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Stub `HUGE_VALF' constant.
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_valf.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALF	(__builtin_huge_valf())
-#else
-# define HUGE_VALF	1e37f
-#endif
diff --git a/sysdeps/generic/bits/huge_vall.h b/sysdeps/generic/bits/huge_vall.h
deleted file mode 100644
index d5e8e2237b..0000000000
--- a/sysdeps/generic/bits/huge_vall.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Default `HUGE_VALL' constant.
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_vall.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALL	(__builtin_huge_vall())
-#else
-# define HUGE_VALL	((long double) HUGE_VAL)
-#endif
diff --git a/sysdeps/generic/bits/in.h b/sysdeps/generic/bits/in.h
deleted file mode 100644
index 31eb0f9fcf..0000000000
--- a/sysdeps/generic/bits/in.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (C) 1997, 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Generic version.  */
-
-#ifndef _NETINET_IN_H
-# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
-#endif
-
-/* Options for use with `getsockopt' and `setsockopt' at the IP level.
-   The first word in the comment at the right is the data type used;
-   "bool" means a boolean value stored in an `int'.  */
-#define	IP_OPTIONS	1	/* ip_opts; IP per-packet options.  */
-#define	IP_HDRINCL	2	/* int; Header is included with data.  */
-#define	IP_TOS		3	/* int; IP type of service and precedence.  */
-#define	IP_TTL		4	/* int; IP time to live.  */
-#define	IP_RECVOPTS	5	/* bool; Receive all IP options w/datagram.  */
-#define	IP_RECVRETOPTS	6	/* bool; Receive IP options for response.  */
-#define	IP_RECVDSTADDR	7	/* bool; Receive IP dst addr w/datagram.  */
-#define	IP_RETOPTS	8	/* ip_opts; Set/get IP per-packet options.  */
-#define IP_MULTICAST_IF 9	/* in_addr; set/get IP multicast i/f */
-#define IP_MULTICAST_TTL 10	/* u_char; set/get IP multicast ttl */
-#define IP_MULTICAST_LOOP 11	/* i_char; set/get IP multicast loopback */
-#define IP_ADD_MEMBERSHIP 12	/* ip_mreq; add an IP group membership */
-#define IP_DROP_MEMBERSHIP 13	/* ip_mreq; drop an IP group membership */
-
-/* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
-   The `ip_dst' field is used for the first-hop gateway when using a
-   source route (this gets put into the header proper).  */
-struct ip_opts
-  {
-    struct in_addr ip_dst;	/* First hop; zero without source route.  */
-    char ip_opts[40];		/* Actually variable in size.  */
-  };
-
-/* IPV6 socket options.  */
-#define IPV6_ADDRFORM		1
-#define IPV6_RXINFO		2
-#define IPV6_HOPOPTS		3
-#define IPV6_DSTOPTS		4
-#define IPV6_RTHDR		5
-#define IPV6_PKTOPTIONS		6
-#define IPV6_CHECKSUM		7
-#define IPV6_HOPLIMIT		8
-
-#define IPV6_TXINFO		IPV6_RXINFO
-#define SCM_SRCINFO		IPV6_TXINFO
-#define SCM_SRCRT		IPV6_RXSRCRT
-
-#define IPV6_UNICAST_HOPS	16
-#define IPV6_MULTICAST_IF	17
-#define IPV6_MULTICAST_HOPS	18
-#define IPV6_MULTICAST_LOOP	19
-#define IPV6_JOIN_GROUP		20
-#define IPV6_LEAVE_GROUP	21
-
-/* Obsolete synonyms for the above.  */
-#define IPV6_ADD_MEMBERSHIP	IPV6_JOIN_GROUP
-#define IPV6_DROP_MEMBERSHIP	IPV6_LEAVE_GROUP
-#define IPV6_RXHOPOPTS		IPV6_HOPOPTS
-#define IPV6_RXDSTOPTS		IPV6_DSTOPTS
-
-/* Routing header options for IPv6.  */
-#define IPV6_RTHDR_LOOSE	0	/* Hop doesn't need to be neighbour. */
-#define IPV6_RTHDR_STRICT	1	/* Hop must be a neighbour.  */
-
-#define IPV6_RTHDR_TYPE_0	0	/* IPv6 Routing header type 0.  */
diff --git a/sysdeps/generic/bits/inf.h b/sysdeps/generic/bits/inf.h
deleted file mode 100644
index 2d526adb23..0000000000
--- a/sysdeps/generic/bits/inf.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Default `INFINITY' constant.
-   Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/inf.h> directly; include <math.h> instead."
-#endif
-
-/* If we don't have real infinity, then we're supposed to produce a float
-   value that overflows at translation time, which is required to produce
-   a diagnostic.  GCC's __builtin_inff produces a quite nice diagnostic
-   that tells the user that the target doesn't support infinities.  */
-
-#if __GNUC_PREREQ(3,3)
-# define INFINITY	(__builtin_inff())
-#else
-# define INFINITY	(1e9999f)
-#endif
diff --git a/sysdeps/generic/bits/ioctl-types.h b/sysdeps/generic/bits/ioctl-types.h
deleted file mode 100644
index 58b78a6af3..0000000000
--- a/sysdeps/generic/bits/ioctl-types.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Structure types for pre-termios terminal ioctls.  Generic Unix version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_IOCTL_H
-# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
-#endif
-
-#if defined TIOCGETC || defined TIOCSETC
-/* Type of ARG for TIOCGETC and TIOCSETC requests.  */
-struct tchars
-{
-  char t_intrc;			/* Interrupt character.  */
-  char t_quitc;			/* Quit character.  */
-  char t_startc;		/* Start-output character.  */
-  char t_stopc;			/* Stop-output character.  */
-  char t_eofc;			/* End-of-file character.  */
-  char t_brkc;			/* Input delimiter character.  */
-};
-
-#define	_IOT_tchars	/* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (char), 6, 0, 0, 0, 0)
-#endif
-
-#if defined TIOCGLTC || defined TIOCSLTC
-/* Type of ARG for TIOCGLTC and TIOCSLTC requests.  */
-struct ltchars
-{
-  char t_suspc;			/* Suspend character.  */
-  char t_dsuspc;		/* Delayed suspend character.  */
-  char t_rprntc;		/* Reprint-line character.  */
-  char t_flushc;		/* Flush-output character.  */
-  char t_werasc;		/* Word-erase character.  */
-  char t_lnextc;		/* Literal-next character.  */
-};
-
-#define	_IOT_ltchars	/* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (char), 6, 0, 0, 0, 0)
-#endif
-
-/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty).  */
-struct sgttyb
-{
-  char sg_ispeed;		/* Input speed.  */
-  char sg_ospeed;		/* Output speed.  */
-  char sg_erase;		/* Erase character.  */
-  char sg_kill;			/* Kill character.  */
-  short int sg_flags;		/* Mode flags.  */
-};
-
-#define	_IOT_sgttyb	/* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0)
-
-#if defined TIOCGWINSZ || defined TIOCSWINSZ
-/* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests.  */
-struct winsize
-{
-  unsigned short int ws_row;	/* Rows, in characters.  */
-  unsigned short int ws_col;	/* Columns, in characters.  */
-
-  /* These are not actually used.  */
-  unsigned short int ws_xpixel;	/* Horizontal pixels.  */
-  unsigned short int ws_ypixel;	/* Vertical pixels.  */
-};
-
-#define	_IOT_winsize	/* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
-#endif
-
-#if defined TIOCGSIZE || defined TIOCSSIZE
-/* The BSD-style ioctl constructor macros use `sizeof', which can't be used
-   in a preprocessor conditional.  Since the commands are always unique
-   regardless of the size bits, we can safely define away `sizeof' for the
-   purpose of the conditional.  */
-#  define sizeof(type) 0
-#  if defined TIOCGWINSZ && TIOCGSIZE == TIOCGWINSZ
-/* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
-   compatibility with Sun; they define `struct ttysize' to have identical
-   layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
-   (likewise TIOCSSIZE and TIOCSWINSZ).  */
-struct ttysize
-{
-  unsigned short int ts_lines;
-  unsigned short int ts_cols;
-  unsigned short int ts_xxx;
-  unsigned short int ts_yyy;
-};
-#define	_IOT_ttysize	_IOT_winsize
-#  else
-/* Suns use a different layout for `struct ttysize', and TIOCGSIZE and
-   TIOCGWINSZ are separate commands that do the same thing with different
-   structures (likewise TIOCSSIZE and TIOCSWINSZ).  */
-struct ttysize
-{
-  int ts_lines, ts_cols;	/* Lines and columns, in characters.  */
-};
-#  endif
-#  undef sizeof			/* See above.  */
-#endif
diff --git a/sysdeps/generic/bits/ioctls.h b/sysdeps/generic/bits/ioctls.h
deleted file mode 100644
index d3ecad9515..0000000000
--- a/sysdeps/generic/bits/ioctls.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef _SYS_IOCTL_H
-# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
-#endif
-
-/* This space intentionally left blank.  */
diff --git a/sysdeps/generic/bits/ipc.h b/sysdeps/generic/bits/ipc.h
deleted file mode 100644
index 5ba227d36b..0000000000
--- a/sysdeps/generic/bits/ipc.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_IPC_H
-# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Mode bits for `msgget', `semget', and `shmget'.  */
-#define IPC_CREAT	01000		/* create key if key does not exist */
-#define IPC_EXCL	02000		/* fail if key exists */
-#define IPC_NOWAIT	04000		/* return error on wait */
-
-/* Control commands for `msgctl', `semctl', and `shmctl'.  */
-#define IPC_RMID	0		/* remove identifier */
-#define IPC_SET		1		/* set `ipc_perm' options */
-#define IPC_STAT	2		/* get `ipc_perm' options */
-
-/* Special key values.  */
-#define IPC_PRIVATE	((key_t) 0)	/* private key */
-
-
-/* Data structure used to pass permission information to IPC operations.  */
-struct ipc_perm
-  {
-    __uid_t uid;			/* owner's user ID */
-    __gid_t gid;			/* owner's group ID */
-    __uid_t cuid;			/* creator's user ID */
-    __gid_t cgid;			/* creator's group ID */
-    __mode_t mode;			/* read/write permission */
-  };
diff --git a/sysdeps/generic/bits/ipctypes.h b/sysdeps/generic/bits/ipctypes.h
deleted file mode 100644
index b88ca1d87b..0000000000
--- a/sysdeps/generic/bits/ipctypes.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM.  Generic.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * Never include <bits/ipctypes.h> directly.
- */
-
-#ifndef _BITS_IPCTYPES_H
-#define _BITS_IPCTYPES_H	1
-
-#include <bits/types.h>
-
-/* Used in `struct shmid_ds'.  */
-# if __WORDSIZE == 32
-typedef unsigned short int __ipc_pid_t;
-# else
-typedef int __ipc_pid_t;
-# endif
-
-
-#endif /* bits/ipctypes.h */
diff --git a/sysdeps/generic/bits/libc-lock.h b/sysdeps/generic/bits/libc-lock.h
deleted file mode 100644
index 3f9c211e0a..0000000000
--- a/sysdeps/generic/bits/libc-lock.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* libc-internal interface for mutex locks.  Stub version.
-   Copyright (C) 1996,97,99,2000-2002,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _BITS_LIBC_LOCK_H
-#define _BITS_LIBC_LOCK_H 1
-
-
-/* Define a lock variable NAME with storage class CLASS.  The lock must be
-   initialized with __libc_lock_init before it can be used (or define it
-   with __libc_lock_define_initialized, below).  Use `extern' for CLASS to
-   declare a lock defined in another module.  In public structure
-   definitions you must use a pointer to the lock structure (i.e., NAME
-   begins with a `*'), because its storage size will not be known outside
-   of libc.  */
-#define __libc_lock_define(CLASS,NAME)
-#define __libc_lock_define_recursive(CLASS,NAME)
-#define __rtld_lock_define_recursive(CLASS,NAME)
-#define __libc_rwlock_define(CLASS,NAME)
-
-/* Define an initialized lock variable NAME with storage class CLASS.  */
-#define __libc_lock_define_initialized(CLASS,NAME)
-#define __libc_rwlock_define_initialized(CLASS,NAME)
-
-/* Define an initialized recursive lock variable NAME with storage
-   class CLASS.  */
-#define __libc_lock_define_initialized_recursive(CLASS,NAME)
-#define __rtld_lock_define_initialized_recursive(CLASS,NAME)
-
-/* Initialize the named lock variable, leaving it in a consistent, unlocked
-   state.  */
-#define __libc_lock_init(NAME)
-#define __libc_rwlock_init(NAME)
-
-/* Same as last but this time we initialize a recursive mutex.  */
-#define __libc_lock_init_recursive(NAME)
-#define __rtld_lock_init_recursive(NAME)
-
-/* Finalize the named lock variable, which must be locked.  It cannot be
-   used again until __libc_lock_init is called again on it.  This must be
-   called on a lock variable before the containing storage is reused.  */
-#define __libc_lock_fini(NAME)
-#define __libc_rwlock_fini(NAME)
-
-/* Finalize recursive named lock.  */
-#define __libc_lock_fini_recursive(NAME)
-
-/* Lock the named lock variable.  */
-#define __libc_lock_lock(NAME)
-#define __libc_rwlock_rdlock(NAME)
-#define __libc_rwlock_wrlock(NAME)
-
-/* Lock the recursive named lock variable.  */
-#define __libc_lock_lock_recursive(NAME)
-#define __rtld_lock_lock_recursive(NAME)
-
-/* Try to lock the named lock variable.  */
-#define __libc_lock_trylock(NAME) 0
-#define __libc_rwlock_tryrdlock(NAME) 0
-#define __libc_rwlock_trywrlock(NAME) 0
-
-/* Try to lock the recursive named lock variable.  */
-#define __libc_lock_trylock_recursive(NAME) 0
-
-/* Unlock the named lock variable.  */
-#define __libc_lock_unlock(NAME)
-#define __libc_rwlock_unlock(NAME)
-
-/* Unlock the recursive named lock variable.  */
-#define __libc_lock_unlock_recursive(NAME)
-#define __rtld_lock_unlock_recursive(NAME)
-
-
-/* Define once control variable.  */
-#define __libc_once_define(CLASS, NAME) CLASS int NAME = 0
-
-/* Call handler iff the first call.  */
-#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
-  do {									      \
-    if ((ONCE_CONTROL) == 0) {						      \
-      INIT_FUNCTION ();							      \
-      (ONCE_CONTROL) = 1;						      \
-    }									      \
-  } while (0)
-
-
-/* Start a critical region with a cleanup function */
-#define __libc_cleanup_region_start(DOIT, FCT, ARG)			    \
-{									    \
-  typeof (***(FCT)) *__save_FCT = (DOIT) ? (FCT) : 0;			    \
-  typeof (ARG) __save_ARG = ARG;					    \
-  /* close brace is in __libc_cleanup_region_end below. */
-
-/* End a critical region started with __libc_cleanup_region_start. */
-#define __libc_cleanup_region_end(DOIT)					    \
-  if ((DOIT) && __save_FCT != 0)					    \
-    (*__save_FCT)(__save_ARG);						    \
-}
-
-/* Sometimes we have to exit the block in the middle.  */
-#define __libc_cleanup_end(DOIT)					    \
-  if ((DOIT) && __save_FCT != 0)					    \
-    (*__save_FCT)(__save_ARG);						    \
-
-#define __libc_cleanup_push(fct, arg) __libc_cleanup_region_start (1, fct, arg)
-#define __libc_cleanup_pop(execute) __libc_cleanup_region_end (execute)
-
-/* We need portable names for some of the functions.  */
-#define __libc_mutex_unlock
-
-/* Type for key of thread specific data.  */
-typedef int __libc_key_t;
-
-/* Create key for thread specific data.  */
-#define __libc_key_create(KEY,DEST) -1
-
-/* Set thread-specific data associated with KEY to VAL.  */
-#define __libc_setspecific(KEY,VAL) ((void)0)
-
-/* Get thread-specific data associated with KEY.  */
-#define __libc_getspecific(KEY) 0
-
-#endif	/* bits/libc-lock.h */
diff --git a/sysdeps/generic/bits/libc-tsd.h b/sysdeps/generic/bits/libc-tsd.h
deleted file mode 100644
index d39382952a..0000000000
--- a/sysdeps/generic/bits/libc-tsd.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* libc-internal interface for thread-specific data.  Stub or TLS version.
-   Copyright (C) 1998,2001,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _GENERIC_BITS_LIBC_TSD_H
-#define _GENERIC_BITS_LIBC_TSD_H 1
-
-/* This file defines the following macros for accessing a small fixed
-   set of thread-specific `void *' data used only internally by libc.
-
-   __libc_tsd_define(CLASS, KEY)	-- Define or declare a `void *' datum
-   					   for KEY.  CLASS can be `static' for
-					   keys used in only one source file,
-					   empty for global definitions, or
-					   `extern' for global declarations.
-   __libc_tsd_address(KEY)		-- Return the `void **' pointing to
-   					   the current thread's datum for KEY.
-   __libc_tsd_get(KEY)			-- Return the `void *' datum for KEY.
-   __libc_tsd_set(KEY, VALUE)		-- Set the datum for KEY to VALUE.
-
-   The set of available KEY's will usually be provided as an enum,
-   and contains (at least):
-		_LIBC_TSD_KEY_MALLOC
-		_LIBC_TSD_KEY_DL_ERROR
-		_LIBC_TSD_KEY_RPC_VARS
-   All uses must be the literal _LIBC_TSD_* name in the __libc_tsd_* macros.
-   Some implementations may not provide any enum at all and instead
-   using string pasting in the macros.  */
-
-#include <tls.h>
-
-/* When full support for __thread variables is available, this interface is
-   just a trivial wrapper for it.  Without TLS, this is the generic/stub
-   implementation for wholly single-threaded systems.
-
-   We don't define an enum for the possible key values, because the KEYs
-   translate directly into variables by macro magic.  */
-
-#if USE___THREAD
-# define __libc_tsd_define(CLASS, KEY)	\
-  CLASS __thread void *__libc_tsd_##KEY attribute_tls_model_ie;
-
-# define __libc_tsd_address(KEY)	(&__libc_tsd_##KEY)
-# define __libc_tsd_get(KEY)		(__libc_tsd_##KEY)
-# define __libc_tsd_set(KEY, VALUE)	(__libc_tsd_##KEY = (VALUE))
-#else
-# define __libc_tsd_define(CLASS, KEY)	CLASS void *__libc_tsd_##KEY##_data;
-
-# define __libc_tsd_address(KEY)	(&__libc_tsd_##KEY##_data)
-# define __libc_tsd_get(KEY)		(__libc_tsd_##KEY##_data)
-# define __libc_tsd_set(KEY, VALUE)	(__libc_tsd_##KEY##_data = (VALUE))
-#endif
-
-#endif	/* bits/libc-tsd.h */
diff --git a/sysdeps/generic/bits/link.h b/sysdeps/generic/bits/link.h
deleted file mode 100644
index 470b4d3e5f..0000000000
--- a/sysdeps/generic/bits/link.h
+++ /dev/null
@@ -1,4 +0,0 @@
-struct link_map_machine
-  {
-    /* empty by default */
-  };
diff --git a/sysdeps/generic/bits/local_lim.h b/sysdeps/generic/bits/local_lim.h
deleted file mode 100644
index 42cc7ebbc9..0000000000
--- a/sysdeps/generic/bits/local_lim.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* This file should define the implementation-specific limits described
-   in posix[12]_lim.h.  If there are no useful values to give a limit,
-   don't define it.  */
diff --git a/sysdeps/generic/bits/mathdef.h b/sysdeps/generic/bits/mathdef.h
deleted file mode 100644
index 00c67241a0..0000000000
--- a/sysdeps/generic/bits/mathdef.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#if defined  __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF	1
-
-/* Normally, there is no long double type and the `float' and `double'
-   expressions are evaluated as `double'.  */
-typedef double float_t;		/* `float' expressions are evaluated as
-				   `double'.  */
-typedef double double_t;	/* `double' expressions are evaluated as
-				   `double'.  */
-
-/* The values returned by `ilogb' for 0 and NaN respectively.  */
-# define FP_ILOGB0	(-2147483647)
-# define FP_ILOGBNAN	2147483647
-
-#endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  The disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/generic/bits/mathinline.h b/sysdeps/generic/bits/mathinline.h
deleted file mode 100644
index 5498af6b63..0000000000
--- a/sysdeps/generic/bits/mathinline.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This file should provide inline versions of math functions.
-
-   Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
-
-   This file should define __MATH_INLINES if functions are actually defined as
-   inlines.  */
-
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-
-/* Here goes the real code.  */
-
-#endif
diff --git a/sysdeps/generic/bits/mman.h b/sysdeps/generic/bits/mman.h
deleted file mode 100644
index a2ee064cae..0000000000
--- a/sysdeps/generic/bits/mman.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Definitions for BSD-style memory management.
-   Copyright (C) 1994-1998,2000,01,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* These are the bits used by 4.4 BSD and its derivatives.  On systems
-   (such as GNU) where these facilities are not system services but can be
-   emulated in the C library, these are the definitions we emulate.  */
-
-#ifndef _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define	PROT_NONE	 0x00	/* No access.  */
-#define	PROT_READ	 0x04	/* Pages can be read.  */
-#define	PROT_WRITE	 0x02	/* Pages can be written.  */
-#define	PROT_EXEC	 0x01	/* Pages can be executed.  */
-
-/* Flags contain mapping type, sharing type and options.  */
-
-/* Mapping type (must choose one and only one of these).  */
-#ifdef __USE_BSD
-# define MAP_FILE	 0x0001	/* Mapped from a file or device.  */
-# define MAP_ANON	 0x0002	/* Allocated from anonymous virtual memory.  */
-# define MAP_TYPE	 0x000f	/* Mask for type field.  */
-# ifdef __USE_MISC
-#  define MAP_ANONYMOUS  MAP_ANON /* Linux name. */
-# endif
-#endif
-
-/* Sharing types (must choose one and only one of these).  */
-#ifdef __USE_BSD
-# define MAP_COPY	 0x0020	/* Virtual copy of region at mapping time.  */
-#endif
-#define	MAP_SHARED	 0x0010	/* Share changes.  */
-#define	MAP_PRIVATE	 0x0000	/* Changes private; copy pages on write.  */
-
-/* Other flags.  */
-#define	MAP_FIXED	 0x0100	/* Map address must be exactly as requested. */
-#ifdef __USE_BSD
-# define MAP_NOEXTEND	 0x0200	/* For MAP_FILE, don't change file size.  */
-# define MAP_HASSEMPHORE 0x0400	/* Region may contain semaphores.  */
-# define MAP_INHERIT	 0x0800	/* Region is retained after exec.  */
-#endif
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-# define MADV_NORMAL	 0	/* No further special treatment.  */
-# define MADV_RANDOM	 1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	 3	/* Will need these pages.  */
-# define MADV_DONTNEED	 4	/* Don't need these pages.  */
-#endif
-
-/* The POSIX people had to invent similar names for the same things.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	1		/* Sync memory asynchronously.  */
-#define MS_SYNC		0		/* Synchronous memory sync.  */
-#define MS_INVALIDATE	2		/* Invalidate the caches.  */
-
-/* Flags for `mlockall' (can be OR'd together).  */
-#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	2		/* Lock all additions to address
-					   space.  */
diff --git a/sysdeps/generic/bits/mqueue.h b/sysdeps/generic/bits/mqueue.h
deleted file mode 100644
index 27bb4824b8..0000000000
--- a/sysdeps/generic/bits/mqueue.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MQUEUE_H
-# error "Never use <bits/mqueue.h> directly; include <mqueue.h> instead."
-#endif
-
-typedef int mqd_t;
-
-struct mq_attr
-{
-  long int mq_flags;	/* Message queue flags.  */
-  long int mq_maxmsg;	/* Maximum number of messages.  */
-  long int mq_msgsize;	/* Maximum message size.  */
-  long int mq_curmsgs;	/* Number of messages currently queued.  */
-};
diff --git a/sysdeps/generic/bits/msq.h b/sysdeps/generic/bits/msq.h
deleted file mode 100644
index 0125c43dc3..0000000000
--- a/sysdeps/generic/bits/msq.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1995, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MSG_H
-#error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Define options for message queue functions.  */
-#define MSG_NOERROR	010000	/* no error if message is too big */
-
-/* Types used in the structure definition.  */
-typedef unsigned short int msgqnum_t;
-typedef unsigned short int msglen_t;
-
-
-/* Structure of record for one message inside the kernel.
-   The type `struct __msg' is opaque.  */
-struct msqid_ds
-{
-  struct ipc_perm msg_perm;	/* structure describing operation permission */
-  __time_t msg_stime;		/* time of last msgsnd command */
-  __time_t msg_rtime;		/* time of last msgrcv command */
-  __time_t msg_ctime;		/* time of last change */
-  msgqnum_t msg_qnum;		/* number of messages currently on queue */
-  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
-  __pid_t msg_lspid;		/* pid of last msgsnd() */
-  __pid_t msg_lrpid;		/* pid of last msgrcv() */
-};
diff --git a/sysdeps/generic/bits/nan.h b/sysdeps/generic/bits/nan.h
deleted file mode 100644
index ab38168ea4..0000000000
--- a/sysdeps/generic/bits/nan.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef _MATH_H
-#error "Never use <bits/nan.h> directly; include <math.h> instead."
-#endif
-
-/* This file should define `NAN' on machines that have such things.  */
diff --git a/sysdeps/generic/bits/netdb.h b/sysdeps/generic/bits/netdb.h
deleted file mode 100644
index 41dc731931..0000000000
--- a/sysdeps/generic/bits/netdb.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _NETDB_H
-# error "Never include <bits/netdb.h> directly; use <netdb.h> instead."
-#endif
-
-
-/* Description of data base entry for a single network.  NOTE: here a
-   poor assumption is made.  The network number is expected to fit
-   into an unsigned long int variable.  */
-struct netent
-{
-  char *n_name;			/* Official name of network.  */
-  char **n_aliases;		/* Alias list.  */
-  int n_addrtype;		/* Net address type.  */
-  uint32_t n_net;		/* Network number.  */
-};
diff --git a/sysdeps/generic/bits/poll.h b/sysdeps/generic/bits/poll.h
deleted file mode 100644
index 022a06cc1b..0000000000
--- a/sysdeps/generic/bits/poll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1997, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_POLL_H
-# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
-#endif
-
-/* Event types that can be polled for.  These bits may be set in `events'
-   to indicate the interesting event types; they will appear in `revents'
-   to indicate the status of the file descriptor.  */
-#define POLLIN		01              /* There is data to read.  */
-#define POLLPRI		02              /* There is urgent data to read.  */
-#define POLLOUT		04              /* Writing now will not block.  */
-
-#ifdef __USE_XOPEN
-/* These values are defined in XPG4.2.  */
-# define POLLRDNORM	POLLIN		/* Normal data may be read.  */
-# define POLLRDBAND	POLLPRI		/* Priority data may be read.  */
-# define POLLWRNORM	POLLOUT		/* Writing now will not block.  */
-# define POLLWRBAND	POLLOUT		/* Priority data may be written.  */
-#endif
-
-/* Event types always implicitly polled for.  These bits need not be set in
-   `events', but they will appear in `revents' to indicate the status of
-   the file descriptor.  */
-#define POLLERR         010             /* Error condition.  */
-#define POLLHUP         020             /* Hung up.  */
-#define POLLNVAL        040             /* Invalid polling request.  */
diff --git a/sysdeps/generic/bits/posix_opt.h b/sysdeps/generic/bits/posix_opt.h
deleted file mode 100644
index 54f5a79aa2..0000000000
--- a/sysdeps/generic/bits/posix_opt.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This file should define the POSIX options described in <unistd.h>,
-   or leave them undefined, as appropriate.  */
diff --git a/sysdeps/generic/bits/pthreadtypes.h b/sysdeps/generic/bits/pthreadtypes.h
deleted file mode 100644
index 0e26952c96..0000000000
--- a/sysdeps/generic/bits/pthreadtypes.h
+++ /dev/null
@@ -1 +0,0 @@
-/* No thread support.  */
diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h
deleted file mode 100644
index 05b28dfccd..0000000000
--- a/sysdeps/generic/bits/resource.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Bit values & structures for resource limits.  4.4 BSD/generic GNU version.
-   Copyright (C) 1994, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* These are the values for 4.4 BSD and GNU.  Earlier BSD systems have a
-   subset of these kinds of resource limit.  In systems where `getrlimit'
-   and `setrlimit' are not system calls, these are the values used by the C
-   library to emulate them.  */
-
-/* Kinds of resource limit.  */
-enum __rlimit_resource
-  {
-    /* Per-process CPU limit, in seconds.  */
-    RLIMIT_CPU,
-#define	RLIMIT_CPU	RLIMIT_CPU
-    /* Largest file that can be created, in bytes.  */
-    RLIMIT_FSIZE,
-#define	RLIMIT_FSIZE	RLIMIT_FSIZE
-    /* Maximum size of data segment, in bytes.  */
-    RLIMIT_DATA,
-#define	RLIMIT_DATA	RLIMIT_DATA
-    /* Maximum size of stack segment, in bytes.  */
-    RLIMIT_STACK,
-#define	RLIMIT_STACK	RLIMIT_STACK
-    /* Largest core file that can be created, in bytes.  */
-    RLIMIT_CORE,
-#define	RLIMIT_CORE	RLIMIT_CORE
-    /* Largest resident set size, in bytes.
-       This affects swapping; processes that are exceeding their
-       resident set size will be more likely to have physical memory
-       taken from them.  */
-    RLIMIT_RSS,
-#define	RLIMIT_RSS	RLIMIT_RSS
-    /* Locked-in-memory address space.  */
-    RLIMIT_MEMLOCK,
-#define	RLIMIT_MEMLOCK	RLIMIT_MEMLOCK
-    /* Number of processes.  */
-    RLIMIT_NPROC,
-#define	RLIMIT_NPROC	RLIMIT_NPROC
-    /* Number of open files.  */
-    RLIMIT_OFILE,
-    RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
-#define	RLIMIT_OFILE	RLIMIT_OFILE
-#define	RLIMIT_NOFILE	RLIMIT_NOFILE
-
-    RLIMIT_NLIMITS,		/* Number of limit flavors.  */
-    RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
-  };
-
-/* Value to indicate that there is no limit.  */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY 0x7fffffff
-#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
-#endif
-
-
-/* Type for resource quantity measurement.  */
-#ifndef __USE_FILE_OFFSET64
-typedef __rlim_t rlim_t;
-#else
-typedef __rlim64_t rlim_t;
-#endif
-#ifdef __USE_LARGEFILE64
-typedef __rlim64_t rlim64_t;
-#endif
-
-struct rlimit
-  {
-    /* The current (soft) limit.  */
-    rlim_t rlim_cur;
-    /* The hard limit.  */
-    rlim_t rlim_max;
-  };
-
-#ifdef __USE_LARGEFILE64
-struct rlimit64
-  {
-    /* The current (soft) limit.  */
-    rlim64_t rlim_cur;
-    /* The hard limit.  */
-    rlim64_t rlim_max;
- };
-#endif
-
-/* Whose usage statistics do you want?  */
-enum __rusage_who
-/* The macro definitions are necessary because some programs want
-   to test for operating system features with #ifdef RUSAGE_SELF.
-   In ISO C the reflexive definition is a no-op.  */
-  {
-    /* The calling process.  */
-    RUSAGE_SELF = 0,
-#define RUSAGE_SELF     RUSAGE_SELF
-    /* All of its terminated child processes.  */
-    RUSAGE_CHILDREN = -1
-#define RUSAGE_CHILDREN RUSAGE_CHILDREN
-  };
-
-#define __need_timeval
-#include <bits/time.h>           /* For `struct timeval'.  */
-
-/* Structure which says how much of each resource has been used.  */
-struct rusage
-  {
-    /* Total amount of user time used.  */
-    struct timeval ru_utime;
-    /* Total amount of system time used.  */
-    struct timeval ru_stime;
-    /* Maximum resident set size (in kilobytes).  */
-    long int ru_maxrss;
-    /* Amount of sharing of text segment memory
-       with other processes (kilobyte-seconds).  */
-    long int ru_ixrss;
-    /* Amount of data segment memory used (kilobyte-seconds).  */
-    long int ru_idrss;
-    /* Amount of stack memory used (kilobyte-seconds).  */
-    long int ru_isrss;
-    /* Number of soft page faults (i.e. those serviced by reclaiming
-       a page from the list of pages awaiting reallocation.  */
-    long int ru_minflt;
-    /* Number of hard page faults (i.e. those that required I/O).  */
-    long int ru_majflt;
-    /* Number of times a process was swapped out of physical memory.  */
-    long int ru_nswap;
-    /* Number of input operations via the file system.  Note: This
-       and `ru_oublock' do not include operations with the cache.  */
-    long int ru_inblock;
-    /* Number of output operations via the file system.  */
-    long int ru_oublock;
-    /* Number of IPC messages sent.  */
-    long int ru_msgsnd;
-    /* Number of IPC messages received.  */
-    long int ru_msgrcv;
-    /* Number of signals delivered.  */
-    long int ru_nsignals;
-    /* Number of voluntary context switches, i.e. because the process
-       gave up the process before it had to (usually to wait for some
-       resource to be available).  */
-    long int ru_nvcsw;
-    /* Number of involuntary context switches, i.e. a higher priority process
-       became runnable or the current process used up its time slice.  */
-    long int ru_nivcsw;
-  };
-
-/* Priority limits.  */
-#define PRIO_MIN        -20     /* Minimum priority a process can have.  */
-#define PRIO_MAX        20      /* Maximum priority a process can have.  */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
-   indicating what flavor of entity the WHO argument specifies.  */
-enum __priority_which
-  {
-    PRIO_PROCESS = 0,           /* WHO is a process ID.  */
-    PRIO_PGRP = 1,              /* WHO is a process group ID.  */
-    PRIO_USER = 2               /* WHO is a user ID.  */
-  };
diff --git a/sysdeps/generic/bits/sched.h b/sysdeps/generic/bits/sched.h
deleted file mode 100644
index 91b6dca0ca..0000000000
--- a/sysdeps/generic/bits/sched.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Definitions of constants and data structure for POSIX 1003.1b-1993
-   scheduling interface.
-   Copyright (C) 1996, 1997, 2001, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SCHED_H
-# error "Never include <bits/sched.h> directly; use <sched.h> instead."
-#endif
-
-
-/* Scheduling algorithms.  */
-#define SCHED_OTHER	0
-#define SCHED_FIFO	1
-#define SCHED_RR	2
-
-/* Data structure to describe a process' schedulability.  */
-struct sched_param
-{
-  int __sched_priority;
-};
-
-
-#if defined _SCHED_H && !defined __cpu_set_t_defined
-# define __cpu_set_t_defined
-/* Size definition for CPU sets.  */
-# define __CPU_SETSIZE	1024
-# define __NCPUBITS	(8 * sizeof (__cpu_mask))
-
-/* Type for array elements in 'cpu_set'.  */
-typedef unsigned long int __cpu_mask;
-
-/* Basic access functions.  */
-# define __CPUELT(cpu)	((cpu) / __NCPUBITS)
-# define __CPUMASK(cpu)	((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
-
-/* Data structure to describe CPU mask.  */
-typedef struct
-{
-  __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
-} cpu_set_t;
-
-/* Access functions for CPU masks.  */
-# define __CPU_ZERO(cpusetp) \
-  do {									      \
-    unsigned int __i;							      \
-    cpu_set *__arr = (cpusetp);						      \
-    for (__i = 0; __i < sizeof (cpu_set) / sizeof (__cpu_mask); ++__i)	      \
-      __arr->__bits[__i] = 0;						      \
-  } while (0)
-# define __CPU_SET(cpu, cpusetp) \
-  ((cpusetp)->__bits[__CPUELT (cpu)] |= __CPUMASK (cpu))
-# define __CPU_CLR(cpu, cpusetp) \
-  ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu))
-# define __CPU_ISSET(cpu, cpusetp) \
-  (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0)
-#endif
diff --git a/sysdeps/generic/bits/select.h b/sysdeps/generic/bits/select.h
deleted file mode 100644
index 47e7dedc30..0000000000
--- a/sysdeps/generic/bits/select.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1997, 1998, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SELECT_H
-# error "Never use <bits/select.h> directly; include <sys/select.h> instead."
-#endif
-
-
-/* We don't use `memset' because this would require a prototype and
-   the array isn't too big.  */
-#define __FD_ZERO(s) \
-  do {									      \
-    unsigned int __i;							      \
-    fd_set *__arr = (s);						      \
-    for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i)	      \
-      __FDS_BITS (__arr)[__i] = 0;					      \
-  } while (0)
-#define __FD_SET(d, s)     (__FDS_BITS (s)[__FDELT(d)] |= __FDMASK(d))
-#define __FD_CLR(d, s)     (__FDS_BITS (s)[__FDELT(d)] &= ~__FDMASK(d))
-#define __FD_ISSET(d, s)   ((__FDS_BITS (s)[__FDELT(d)] & __FDMASK(d)) != 0)
diff --git a/sysdeps/generic/bits/sem.h b/sysdeps/generic/bits/sem.h
deleted file mode 100644
index dcb1c3edf7..0000000000
--- a/sysdeps/generic/bits/sem.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SEM_H
-# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
-#endif
-
-#include <sys/types.h>
-
-/* Flags for `semop'.  */
-#define SEM_UNDO	0x1000		/* undo the operation on exit */
-
-/* Commands for `semctl'.  */
-#define GETPID		11		/* get sempid */
-#define GETVAL		12		/* get semval */
-#define GETALL		13		/* get all semval's */
-#define GETNCNT		14		/* get semncnt */
-#define GETZCNT		15		/* get semzcnt */
-#define SETVAL		16		/* set semval */
-#define SETALL		17		/* set all semval's */
-
-
-/* Data structure describing a set of semaphores.  */
-struct semid_ds
-{
-  struct ipc_perm sem_perm;		/* operation permission struct */
-  __time_t sem_otime;			/* last semop() time */
-  __time_t sem_ctime;			/* last time changed by semctl() */
-  unsigned short int sem_nsems;		/* number of semaphores in set */
-};
-
-/* The user should define a union like the following to use it for arguments
-   for `semctl'.
-
-   union semun
-   {
-     int val;				<= value for SETVAL
-     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
-     unsigned short int *array;		<= array for GETALL & SETALL
-     struct seminfo *__buf;		<= buffer for IPC_INFO
-   };
-
-   Previous versions of this file used to define this union but this is
-   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
-   one must define the union or not.  */
-#define _SEM_SEMUN_UNDEFINED	1
diff --git a/sysdeps/generic/bits/setjmp.h b/sysdeps/generic/bits/setjmp.h
deleted file mode 100644
index 9150d8d764..0000000000
--- a/sysdeps/generic/bits/setjmp.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Define the machine-dependent type `jmp_buf'.  Stub version.  */
-
-#ifndef _SETJMP_H
-# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-#endif
-
-typedef int __jmp_buf[1];
diff --git a/sysdeps/generic/bits/shm.h b/sysdeps/generic/bits/shm.h
deleted file mode 100644
index 746a863486..0000000000
--- a/sysdeps/generic/bits/shm.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SHM_H
-# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Flags for `shmat'.  */
-#define SHM_RDONLY	010000		/* attach read-only else read-write */
-#define SHM_RND		020000		/* round attach address to SHMLBA */
-#define SHM_REMAP	040000		/* take-over region on attach */
-
-/* Commands for `shmctl'.  */
-#define SHM_LOCK	11		/* lock segment (root only) */
-#define SHM_UNLOCK	12		/* unlock segment (root only) */
-
-__BEGIN_DECLS
-
-/* Segment low boundary address multiple.  */
-#define SHMLBA		(__getpagesize ())
-extern int __getpagesize (void) __THROW __attribute__ ((__const__));
-
-
-/* Type to count number of attaches.  */
-typedef unsigned short int shmatt_t;
-
-/* Data structure describing a set of semaphores.  */
-struct shmid_ds
-  {
-    struct ipc_perm shm_perm;		/* operation permission struct */
-    int shm_segsz;			/* size of segment in bytes */
-    __time_t shm_atime;			/* time of last shmat() */
-    __time_t shm_dtime;			/* time of last shmdt() */
-    __time_t shm_ctime;			/* time of last change by shmctl() */
-    __pid_t shm_cpid;			/* pid of creator */
-    __pid_t shm_lpid;			/* pid of last shmop */
-    shmatt_t shm_nattch;		/* number of current attaches */
-  };
-
-__END_DECLS
diff --git a/sysdeps/generic/bits/sigaction.h b/sysdeps/generic/bits/sigaction.h
deleted file mode 100644
index adcc276cc8..0000000000
--- a/sysdeps/generic/bits/sigaction.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 1991,92,96,97,98,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
-#endif
-
-/* These definitions match those used by the 4.4 BSD kernel.
-   If the operating system has a `sigaction' system call that correctly
-   implements the POSIX.1 behavior, there should be a system-dependent
-   version of this file that defines `struct sigaction' and the `SA_*'
-   constants appropriately.  */
-
-/* Structure describing the action to be taken when a signal arrives.  */
-struct sigaction
-  {
-    /* Signal handler.  */
-#ifdef __USE_POSIX199309
-    union
-      {
-	/* Used if SA_SIGINFO is not set.  */
-	__sighandler_t sa_handler;
-	/* Used if SA_SIGINFO is set.  */
-	void (*sa_sigaction) (int, siginfo_t *, void *);
-      }
-    __sigaction_handler;
-# define sa_handler	__sigaction_handler.sa_handler
-# define sa_sigaction	__sigaction_handler.sa_sigaction
-#else
-    __sighandler_t sa_handler;
-#endif
-
-    /* Additional set of signals to be blocked.  */
-    __sigset_t sa_mask;
-
-    /* Special flags.  */
-    int sa_flags;
-  };
-
-/* Bits in `sa_flags'.  */
-#if defined __USE_UNIX98 || defined __USE_MISC
-# define SA_ONSTACK	0x0001	/* Take signal on signal stack.  */
-# define SA_RESTART	0x0002	/* Restart syscall on signal return.  */
-# define SA_NODEFER	0x0010	/* Don't automatically block the signal when
-				    its handler is being executed.  */
-# define SA_RESETHAND	0x0004	/* Reset to SIG_DFL on entry to handler.  */
-#endif
-#define	SA_NOCLDSTOP	0x0008	/* Don't send SIGCHLD when children stop.  */
-
-#ifdef __USE_MISC
-# define SA_INTERRUPT	0	/* Historical no-op ("not SA_RESTART").  */
-
-/* Some aliases for the SA_ constants.  */
-# define SA_NOMASK    SA_NODEFER
-# define SA_ONESHOT   SA_RESETHAND
-# define SA_STACK     SA_ONSTACK
-#endif
-
-
-/* Values for the HOW argument to `sigprocmask'.  */
-#define	SIG_BLOCK	1	/* Block signals.  */
-#define	SIG_UNBLOCK	2	/* Unblock signals.  */
-#define	SIG_SETMASK	3	/* Set the set of blocked signals.  */
diff --git a/sysdeps/generic/bits/sigcontext.h b/sysdeps/generic/bits/sigcontext.h
deleted file mode 100644
index 7e90e78c4a..0000000000
--- a/sysdeps/generic/bits/sigcontext.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Structure describing state saved while handling a signal.  Stub version.
-   Copyright (C) 1991, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-/* State of this thread when the signal was taken.  */
-struct sigcontext
-  {
-    int sc_onstack;
-    __sigset_t sc_mask;
-
-    /* Registers and such.  */
-  };
-
-/* Signal subcodes should be defined here.  */
diff --git a/sysdeps/generic/bits/siginfo.h b/sysdeps/generic/bits/siginfo.h
deleted file mode 100644
index fe7b3b5f9c..0000000000
--- a/sysdeps/generic/bits/siginfo.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/* siginfo_t, sigevent and constants.  Stub version.
-   Copyright (C) 1997, 1998, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SIGNAL_H && !defined __need_siginfo_t \
-    && !defined __need_sigevent_t
-# error "Never include this file directly.  Use <signal.h> instead"
-#endif
-
-#if (!defined __have_sigval_t \
-     && (defined _SIGNAL_H || defined __need_siginfo_t \
-	 || defined __need_sigevent_t))
-# define __have_sigval_t 1
-
-/* Type for data associated with a signal.  */
-typedef union sigval
-  {
-    int sival_int;
-    void *sival_ptr;
-  } sigval_t;
-#endif
-
-#if (!defined __have_siginfo_t \
-     && (defined _SIGNAL_H || defined __need_siginfo_t))
-# define __have_siginfo_t	1
-
-typedef struct siginfo
-  {
-    int si_signo;		/* Signal number.  */
-    int si_errno;		/* If non-zero, an errno value associated with
-				   this signal, as defined in <errno.h>.  */
-    int si_code;		/* Signal code.  */
-    __pid_t si_pid;		/* Sending process ID.  */
-    __uid_t si_uid;		/* Real user ID of sending process.  */
-    void *si_addr;		/* Address of faulting instruction.  */
-    int si_status;		/* Exit value or signal.  */
-    long int si_band;		/* Band event for SIGPOLL.  */
-    union sigval si_value;	/* Signal value.  */
-  } siginfo_t;
-
-
-/* Values for `si_code'.  Positive values are reserved for kernel-generated
-   signals.  */
-enum
-{
-  SI_ASYNCIO = -4,		/* Sent by AIO completion.  */
-# define SI_ASYNCIO	SI_ASYNCIO
-  SI_MESGQ,			/* Sent by real time mesq state change.  */
-# define SI_MESGQ	SI_MESGQ
-  SI_TIMER,			/* Sent by timer expiration.  */
-# define SI_TIMER	SI_TIMER
-  SI_QUEUE,			/* Sent by sigqueue.  */
-# define SI_QUEUE	SI_QUEUE
-  SI_USER			/* Sent by kill, sigsend, raise.  */
-# define SI_USER	SI_USER
-};
-
-
-/* `si_code' values for SIGILL signal.  */
-enum
-{
-  ILL_ILLOPC = 1,		/* Illegal opcode.  */
-# define ILL_ILLOPC	ILL_ILLOPC
-  ILL_ILL_OPN,			/* Illegal operand.  */
-# define ILL_ILLOPN	ILL_ILLOPN
-  ILL_ILLADR,			/* Illegal addressing mode.  */
-# define ILL_ILLADR	ILL_ILLADR
-  ILL_ILLTRP,			/* Illegal trap. */
-# define ILL_ILLTRP	ILL_ILLTRP
-  ILL_PRVOPC,			/* Privileged opcode.  */
-# define ILL_PRVOPC	ILL_PRVOPC
-  ILL_PRVREG,			/* Privileged register.  */
-# define ILL_PRVREG	ILL_PRVREG
-  ILL_COPROC,			/* Coprocessor error.  */
-# define ILL_COPROC	ILL_COPROC
-  ILL_BADSTK			/* Internal stack error.  */
-# define ILL_BADSTK	ILL_BADSTK
-};
-
-/* `si_code' values for SIGFPE signal.  */
-enum
-{
-  FPE_INTDIV = 1,		/* Integer divide by zero.  */
-# define FPE_INTDIV	FPE_INTDIV
-  FPE_INTOVF,			/* Integer overflow.  */
-# define FPE_INTOVF	FPE_INTOVF
-  FPE_FLTDIV,			/* Floating point divide by zero.  */
-# define FPE_FLTDIV	FPE_FLTDIV
-  FPE_FLTOVF,			/* Floating point overflow.  */
-# define FPE_FLTOVF	FPE_FLTOVF
-  FPE_FLTUND,			/* Floating point underflow.  */
-# define FPE_FLTUND	FPE_FLTUND
-  FPE_FLTRES,			/* Floating point inexact result.  */
-# define FPE_FLTRES	FPE_FLTRES
-  FPE_FLTINV,			/* Floating point invalid operation.  */
-# define FPE_FLTINV	FPE_FLTINV
-  FPE_FLTSUB			/* Subscript out of range.  */
-# define FPE_FLTSUB	FPE_FLTSUB
-};
-
-/* `si_code' values for SIGSEGV signal.  */
-enum
-{
-  SEGV_MAPERR = 1,		/* Address not mapped to object.  */
-# define SEGV_MAPERR	SEGV_MAPERR
-  SEGV_ACCERR			/* Invalid permissions for mapped object.  */
-# define SEGV_ACCERR	SEGV_ACCERR
-};
-
-/* `si_code' values for SIGBUS signal.  */
-enum
-{
-  BUS_ADRALN = 1,		/* Invalid address alignment.  */
-# define BUS_ADRALN	BUS_ADRALN
-  BUS_ADRERR,			/* Non-existant physical address.  */
-# define BUS_ADRERR	BUS_ADRERR
-  BUS_OBJERR			/* Object specific hardware error.  */
-# define BUS_OBJERR	BUS_OBJERR
-};
-
-/* `si_code' values for SIGTRAP signal.  */
-enum
-{
-  TRAP_BRKPT = 1,		/* Process breakpoint.  */
-# define TRAP_BRKPT	TRAP_BRKPT
-  TRAP_TRACE			/* Process trace trap.  */
-# define TRAP_TRACE	TRAP_TRACE
-};
-
-/* `si_code' values for SIGCHLD signal.  */
-enum
-{
-  CLD_EXITED = 1,		/* Child has exited.  */
-# define CLD_EXITED	CLD_EXITED
-  CLD_KILLED,			/* Child was killed.  */
-# define CLD_KILLED	CLD_KILLED
-  CLD_DUMPED,			/* Child terminated abnormally.  */
-# define CLD_DUMPED	CLD_DUMPED
-  CLD_TRAPPED,			/* Traced child has trapped.  */
-# define CLD_TRAPPED	CLD_TRAPPED
-  CLD_STOPPED,			/* Child has stopped.  */
-# define CLD_STOPPED	CLD_STOPPED
-  CLD_CONTINUED			/* Stopped child has continued.  */
-# define CLD_CONTINUED	CLD_CONTINUED
-};
-
-/* `si_code' values for SIGPOLL signal.  */
-enum
-{
-  POLL_IN = 1,			/* Data input available.  */
-# define POLL_IN	POLL_IN
-  POLL_OUT,			/* Output buffers available.  */
-# define POLL_OUT	POLL_OUT
-  POLL_MSG,			/* Input message available.   */
-# define POLL_MSG	POLL_MSG
-  POLL_ERR,			/* I/O error.  */
-# define POLL_ERR	POLL_ERR
-  POLL_PRI,			/* High priority input available.  */
-# define POLL_PRI	POLL_PRI
-  POLL_HUP			/* Device disconnected.  */
-# define POLL_HUP	POLL_HUP
-};
-
-# undef __need_siginfo_t
-#endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
-
-
-#if (defined _SIGNAL_H || defined __need_sigevent_t) \
-    && !defined __have_sigevent_t
-# define __have_sigevent_t	1
-
-/* Structure to transport application-defined values with signals.  */
-# define SIGEV_MAX_SIZE	64
-# define SIGEV_PAD_SIZE	((SIGEV_MAX_SIZE / sizeof (int)) - 3)
-
-typedef struct sigevent
-  {
-    sigval_t sigev_value;
-    int sigev_signo;
-    int sigev_notify;
-    void (*sigev_notify_function) (sigval_t);	    /* Function to start.  */
-    void *sigev_notify_attributes;		    /* Really pthread_attr_t.*/
-  } sigevent_t;
-
-/* `sigev_notify' values.  */
-enum
-{
-  SIGEV_SIGNAL = 0,		/* Notify via signal.  */
-# define SIGEV_SIGNAL	SIGEV_SIGNAL
-  SIGEV_NONE,			/* Other notification: meaningless.  */
-# define SIGEV_NONE	SIGEV_NONE
-  SIGEV_THREAD			/* Deliver via thread creation.  */
-# define SIGEV_THREAD	SIGEV_THREAD
-};
-
-#endif	/* have _SIGNAL_H.  */
diff --git a/sysdeps/generic/bits/signum.h b/sysdeps/generic/bits/signum.h
deleted file mode 100644
index 25331f943c..0000000000
--- a/sysdeps/generic/bits/signum.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 1991, 1993, 1996, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef	_SIGNAL_H
-
-/* Fake signal functions.  */
-
-#define	SIG_ERR	 ((__sighandler_t) -1)	/* Error return.  */
-#define	SIG_DFL	 ((__sighandler_t)  0)	/* Default action.  */
-#define	SIG_IGN	 ((__sighandler_t)  1)	/* Ignore signal.  */
-
-#ifdef __USE_UNIX98
-# define SIG_HOLD ((__sighandler_t)  2)	/* Add signal to hold mask.  */
-#endif
-
-/* Signals in the 1-15 range are defined with their historical numbers.
-   Signals in the 20-25 range are relatively new and have no ingrained
-   numbers. */
-
-/* ANSI signals.  */
-#define	SIGINT	2	/* Interactive attention signal.  */
-#define	SIGILL	4	/* Illegal instruction.  */
-#define	SIGABRT	6	/* Abnormal termination.  */
-#define	SIGFPE	8	/* Erroneous arithmetic operation.  */
-#define	SIGSEGV	11	/* Invalid access to storage.  */
-#define	SIGTERM	15	/* Termination request.  */
-
-/* Historical signals specified by POSIX. */
-#define	SIGHUP	1	/* Hangup.  */
-#define	SIGQUIT	3	/* Quit.  */
-#define	SIGKILL	9	/* Kill (cannot be blocked, caught, or ignored).  */
-#define	SIGPIPE	13	/* Broken pipe.  */
-#define	SIGALRM	14	/* Alarm clock.  */
-
-/* New(er) POSIX signals. */
-#define	SIGSTOP	20	/* Stop (cannot be blocked, caught, or ignored).  */
-#define	SIGCONT	21	/* Continue.  */
-#define	SIGTSTP	22	/* Keyboard stop.  */
-#define	SIGTTIN	23	/* Background read from control terminal.  */
-#define	SIGTTOU	24	/* Background write to control terminal.  */
-#define	SIGCHLD	25	/* Child terminated or stopped.  */
-
-#define	_NSIG	26
-
-/* Archaic names for compatibility. */
-#define	SIGIOT  SIGABRT	/* IOT instruction, abort() on a PDP11 */
-#define	SIGCLD  SIGCHLD	/* Old System V name */
-
-#endif	/* <signal.h> included.  */
diff --git a/sysdeps/generic/bits/sigset.h b/sysdeps/generic/bits/sigset.h
deleted file mode 100644
index 5fc8692df0..0000000000
--- a/sysdeps/generic/bits/sigset.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* __sig_atomic_t, __sigset_t, and related definitions.  Generic/BSD version.
-   Copyright (C) 1991, 1992, 1994, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_SIGSET_H_types
-#define	_SIGSET_H_types	1
-
-typedef int __sig_atomic_t;
-
-/* A `sigset_t' has a bit for each signal.  */
-typedef unsigned long int __sigset_t;
-
-#endif
-
-
-/* We only want to define these functions if <signal.h> was actually
-   included; otherwise we were included just to define the types.  Since we
-   are namespace-clean, it wouldn't hurt to define extra macros.  But
-   trouble can be caused by functions being defined (e.g., any global
-   register vars declared later will cause compilation errors).  */
-
-#if !defined _SIGSET_H_fns && defined _SIGNAL_H
-#define _SIGSET_H_fns 1
-
-#ifndef _EXTERN_INLINE
-# define _EXTERN_INLINE extern __inline
-#endif
-
-/* Return a mask that includes SIG only.  The cast to `sigset_t' avoids
-   overflow if `sigset_t' is wider than `int'.  */
-#define	__sigmask(sig)	(((__sigset_t) 1) << ((sig) - 1))
-
-#define	__sigemptyset(set)	((*(set) = (__sigset_t) 0), 0)
-#define	__sigfillset(set)	((*(set) = ~(__sigset_t) 0), 0)
-
-#ifdef _GNU_SOURCE
-# define __sigisemptyset(set)	(*(set) == (__sigset_t) 0)
-# define __sigandset(dest, left, right) \
-				((*(dest) = (*(left) & *(right))), 0)
-# define __sigorset(dest, left, right) \
-				((*(dest) = (*(left) | *(right))), 0)
-#endif
-
-/* These functions needn't check for a bogus signal number -- error
-   checking is done in the non __ versions.  */
-
-extern int __sigismember (__const __sigset_t *, int);
-extern int __sigaddset (__sigset_t *, int);
-extern int __sigdelset (__sigset_t *, int);
-
-#ifdef __USE_EXTERN_INLINES
-# define __SIGSETFN(NAME, BODY, CONST)					      \
-  _EXTERN_INLINE int							      \
-  NAME (CONST __sigset_t *__set, int __sig)				      \
-  {									      \
-    __sigset_t __mask = __sigmask (__sig);				      \
-    return BODY;							      \
-  }
-
-__SIGSETFN (__sigismember, (*__set & __mask) ? 1 : 0, __const)
-__SIGSETFN (__sigaddset, ((*__set |= __mask), 0), )
-__SIGSETFN (__sigdelset, ((*__set &= ~__mask), 0), )
-
-# undef __SIGSETFN
-#endif
-
-
-#endif /* ! _SIGSET_H_fns.  */
diff --git a/sysdeps/generic/bits/sigstack.h b/sysdeps/generic/bits/sigstack.h
deleted file mode 100644
index de79c90afa..0000000000
--- a/sysdeps/generic/bits/sigstack.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* sigstack, sigaltstack definitions.
-   Copyright (C) 1998, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never include this file directly.  Use <signal.h> instead"
-#endif
-
-
-/* Structure describing a signal stack (obsolete).  */
-struct sigstack
-  {
-    __ptr_t ss_sp;		/* Signal stack pointer.  */
-    int ss_onstack;		/* Nonzero if executing on this stack.  */
-  };
-
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    __ptr_t ss_sp;
-    size_t ss_size;
-    int ss_flags;
-  } stack_t;
-
-
-/* Possible values for `ss_flags.'.  */
-enum
-{
-  SS_ONSTACK = 0x0001,
-#define SS_ONSTACK	SS_ONSTACK
-  SS_DISABLE = 0x0004
-#define SS_DISABLE	SS_DISABLE
-};
-
-/* Minumum stack size for a signal handler.  */
-#define MINSIGSTKSZ	8192
-
-/* System default stack size.  */
-#define SIGSTKSZ	(MINSIGSTKSZ + 32768)
diff --git a/sysdeps/generic/bits/sigthread.h b/sysdeps/generic/bits/sigthread.h
deleted file mode 100644
index 2edb58cd51..0000000000
--- a/sysdeps/generic/bits/sigthread.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Signal handling function for threaded programs.  Generic version.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _BITS_SIGTHREAD_H
-#define _BITS_SIGTHREAD_H	1
-
-#if !defined _SIGNAL_H && !defined _PTHREAD_H
-# error "Never include this file directly.  Use <pthread.h> instead"
-#endif
-
-/* Modify the signal mask for the calling thread.  The arguments have the
-   same meaning as for sigprocmask; in fact, this and sigprocmask might be
-   the same function.  We declare this the same on all platforms, since it
-   doesn't use any thread-related types.  */
-extern int pthread_sigmask (int __how, __const __sigset_t *__newmask,
-			    __sigset_t *__oldmask) __THROW;
-
-
-#endif	/* bits/sigthread.h */
diff --git a/sysdeps/generic/bits/sockaddr.h b/sysdeps/generic/bits/sockaddr.h
deleted file mode 100644
index 3e1d1312d8..0000000000
--- a/sysdeps/generic/bits/sockaddr.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Definition of `struct sockaddr_*' common members.  Generic/4.2 BSD version.
-   Copyright (C) 1995,1996,1997,1998,2000,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * Never include this file directly; use <sys/socket.h> instead.
- */
-
-#ifndef _BITS_SOCKADDR_H
-#define _BITS_SOCKADDR_H	1
-
-
-/* POSIX.1g specifies this type name for the `sa_family' member.  */
-typedef unsigned short int sa_family_t;
-
-/* This macro is used to declare the initial common members
-   of the data types used for socket addresses, `struct sockaddr',
-   `struct sockaddr_in', `struct sockaddr_un', etc.  */
-
-#define	__SOCKADDR_COMMON(sa_prefix) \
-  sa_family_t sa_prefix##family
-
-#define __SOCKADDR_COMMON_SIZE	(sizeof (unsigned short int))
-
-#endif	/* bits/sockaddr.h */
diff --git a/sysdeps/generic/bits/socket.h b/sysdeps/generic/bits/socket.h
deleted file mode 100644
index 20e6f0337f..0000000000
--- a/sysdeps/generic/bits/socket.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/* System-specific socket constants and types.  Generic/4.3 BSD version.
-   Copyright (C) 1991,92,1994-1999,2000,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef __BITS_SOCKET_H
-#define __BITS_SOCKET_H	1
-
-#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
-# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
-#endif
-
-#include <limits.h>
-#include <bits/types.h>
-
-#define	__need_size_t
-#include <stddef.h>
-
-/* Type for length arguments in socket calls.  */
-#ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-# define __socklen_t_defined
-#endif
-
-
-/* Types of sockets.  */
-enum __socket_type
-{
-  SOCK_STREAM = 1,		/* Sequenced, reliable, connection-based
-				   byte streams.  */
-#define SOCK_STREAM SOCK_STREAM
-  SOCK_DGRAM = 2,		/* Connectionless, unreliable datagrams
-				   of fixed maximum length.  */
-#define SOCK_DGRAM SOCK_DGRAM
-  SOCK_RAW = 3,			/* Raw protocol interface.  */
-#define SOCK_RAW SOCK_RAW
-  SOCK_RDM = 4,			/* Reliably-delivered messages.  */
-#define SOCK_RDM SOCK_RDM
-  SOCK_SEQPACKET = 5		/* Sequenced, reliable, connection-based,
-				   datagrams of fixed maximum length.  */
-#define SOCK_SEQPACKET SOCK_SEQPACKET
-};
-
-/* Protocol families.  */
-#define	PF_UNSPEC	0	/* Unspecified.  */
-#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
-#define	PF_UNIX		PF_LOCAL /* Old BSD name for PF_LOCAL.  */
-#define	PF_FILE		PF_LOCAL /* POSIX name for PF_LOCAL.  */
-#define	PF_INET		2	/* IP protocol family.  */
-#define	PF_IMPLINK	3	/* ARPAnet IMP protocol.  */
-#define	PF_PUP		4	/* PUP protocols.  */
-#define	PF_CHAOS	5	/* MIT Chaos protocols.  */
-#define	PF_NS		6	/* Xerox NS protocols.  */
-#define	PF_ISO		7	/* ISO protocols.  */
-#define	PF_OSI		PF_ISO
-#define	PF_ECMA		8	/* ECMA protocols.  */
-#define	PF_DATAKIT	9	/* AT&T Datakit protocols.  */
-#define	PF_CCITT	10	/* CCITT protocols (X.25 et al).  */
-#define	PF_SNA		11	/* IBM SNA protocol.  */
-#define	PF_DECnet	12	/* DECnet protocols.  */
-#define	PF_DLI		13	/* Direct data link interface.  */
-#define	PF_LAT		14	/* DEC Local Area Transport protocol.  */
-#define	PF_HYLINK	15	/* NSC Hyperchannel protocol.  */
-#define	PF_APPLETALK	16	/* Don't use this.  */
-#define	PF_ROUTE	17	/* Internal Routing Protocol.  */
-#define	PF_LINK		18	/* Link layer interface.  */
-#define	PF_XTP		19	/* eXpress Transfer Protocol (no AF).  */
-#define	PF_COIP		20	/* Connection-oriented IP, aka ST II.  */
-#define	PF_CNT		21	/* Computer Network Technology.  */
-#define PF_RTIP		22	/* Help Identify RTIP packets.  **/
-#define	PF_IPX		23	/* Novell Internet Protocol.  */
-#define	PF_SIP		24	/* Simple Internet Protocol.  */
-#define PF_PIP		25	/* Help Identify PIP packets.  */
-#define PF_INET6	26	/* IP version 6.  */
-#define	PF_MAX		27
-
-/* Address families.  */
-#define	AF_UNSPEC	PF_UNSPEC
-#define	AF_LOCAL	PF_LOCAL
-#define	AF_UNIX		PF_UNIX
-#define	AF_FILE		PF_FILE
-#define	AF_INET		PF_INET
-#define	AF_IMPLINK	PF_IMPLINK
-#define	AF_PUP		PF_PUP
-#define	AF_CHAOS	PF_CHAOS
-#define	AF_NS		PF_NS
-#define	AF_ISO		PF_ISO
-#define	AF_OSI		PF_OSI
-#define	AF_ECMA		PF_ECMA
-#define	AF_DATAKIT	PF_DATAKIT
-#define	AF_CCITT	PF_CCITT
-#define	AF_SNA		PF_SNA
-#define	AF_DECnet	PF_DECnet
-#define	AF_DLI		PF_DLI
-#define	AF_LAT		PF_LAT
-#define	AF_HYLINK	PF_HYLINK
-#define	AF_APPLETALK	PF_APPLETALK
-#define	AF_ROUTE	PF_ROUTE
-#define	AF_LINK		PF_LINK
-#define	pseudo_AF_XTP	PF_XTP
-#define	AF_COIP		PF_COIP
-#define	AF_CNT		PF_CNT
-#define pseudo_AF_RTIP	PF_RTIP
-#define	AF_IPX		PF_IPX
-#define	AF_SIP		PF_SIP
-#define pseudo_AF_PIP	PF_PIP
-#define AF_INET6	PF_INET6
-#define	AF_MAX		PF_MAX
-
-
-/* Get the definition of the macro to define the common sockaddr members.  */
-#include <bits/sockaddr.h>
-
-/* Structure describing a generic socket address.  */
-struct sockaddr
-  {
-    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
-    char sa_data[14];		/* Address data.  */
-  };
-
-
-/* Structure large enough to hold any socket address (with the historical
-   exception of AF_UNIX).  We reserve 128 bytes.  */
-#if ULONG_MAX > 0xffffffff
-# define __ss_aligntype	__uint64_t
-#else
-# define __ss_aligntype	__uint32_t
-#endif
-#define _SS_SIZE	128
-#define _SS_PADSIZE	(_SS_SIZE - (2 * sizeof (__ss_aligntype)))
-
-struct sockaddr_storage
-  {
-    __SOCKADDR_COMMON (ss_);	/* Address family, etc.  */
-    __ss_aligntype __ss_align;	/* Force desired alignment.  */
-    char __ss_padding[_SS_PADSIZE];
-  };
-
-
-/* Bits in the FLAGS argument to `send', `recv', et al.  */
-enum
-  {
-    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
-#define MSG_OOB MSG_OOB
-    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
-#define MSG_PEEK MSG_PEEK
-    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
-#define MSG_DONTROUTE MSG_DONTROUTE
-    MSG_EOR		= 0x08,	/* Data completes record.  */
-#define MSG_EOR MSG_EOR
-    MSG_TRUNC		= 0x10,	/* Data discarded before delivery.  */
-#define MSG_TRUNC MSG_TRUNC
-    MSG_CTRUNC		= 0x20,	/* Control data lost before delivery.  */
-#define MSG_CTRUNC MSG_CTRUNC
-    MSG_WAITALL		= 0x40,	/* Wait for full request or error.  */
-#define MSG_WAITALL MSG_WAITALL
-    MSG_DONTWAIT	= 0x80	/* This message should be nonblocking.  */
-#define MSG_DONTWAIT MSG_DONTWAIT
-  };
-
-
-/* Structure describing messages sent by
-   `sendmsg' and received by `recvmsg'.  */
-struct msghdr
-  {
-    __ptr_t msg_name;		/* Address to send to/receive from.  */
-    socklen_t msg_namelen;	/* Length of address data.  */
-
-    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
-    int msg_iovlen;		/* Number of elements in the vector.  */
-
-    __ptr_t msg_accrights;	/* Access rights information.  */
-    socklen_t msg_accrightslen;	/* Length of access rights information.  */
-
-    int msg_flags;		/* Flags in received message.  */
-  };
-
-
-/* Protocol number used to manipulate socket-level options
-   with `getsockopt' and `setsockopt'.  */
-#define	SOL_SOCKET	0xffff
-
-/* Socket-level options for `getsockopt' and `setsockopt'.  */
-enum
-  {
-    SO_DEBUG = 0x0001,		/* Record debugging information.  */
-#define SO_DEBUG SO_DEBUG
-    SO_ACCEPTCONN = 0x0002,	/* Accept connections on socket.  */
-#define SO_ACCEPTCONN SO_ACCEPTCONN
-    SO_REUSEADDR = 0x0004,	/* Allow reuse of local addresses.  */
-#define SO_REUSEADDR SO_REUSEADDR
-    SO_KEEPALIVE = 0x0008,	/* Keep connections alive and send
-				   SIGPIPE when they die.  */
-#define SO_KEEPALIVE SO_KEEPALIVE
-    SO_DONTROUTE = 0x0010,	/* Don't do local routing.  */
-#define SO_DONTROUTE SO_DONTROUTE
-    SO_BROADCAST = 0x0020,	/* Allow transmission of
-				   broadcast messages.  */
-#define SO_BROADCAST SO_BROADCAST
-    SO_USELOOPBACK = 0x0040,	/* Use the software loopback to avoid
-				   hardware use when possible.  */
-#define SO_USELOOPBACK SO_USELOOPBACK
-    SO_LINGER = 0x0080,		/* Block on close of a reliable
-				   socket to transmit pending data.  */
-#define SO_LINGER SO_LINGER
-    SO_OOBINLINE = 0x0100,	/* Receive out-of-band data in-band.  */
-#define SO_OOBINLINE SO_OOBINLINE
-    SO_REUSEPORT = 0x0200,	/* Allow local address and port reuse.  */
-#define SO_REUSEPORT SO_REUSEPORT
-    SO_SNDBUF = 0x1001,		/* Send buffer size.  */
-#define SO_SNDBUF SO_SNDBUF
-    SO_RCVBUF = 0x1002,		/* Receive buffer.  */
-#define SO_RCVBUF SO_RCVBUF
-    SO_SNDLOWAT = 0x1003,	/* Send low-water mark.  */
-#define SO_SNDLOWAT SO_SNDLOWAT
-    SO_RCVLOWAT = 0x1004,	/* Receive low-water mark.  */
-#define SO_RCVLOWAT SO_RCVLOWAT
-    SO_SNDTIMEO = 0x1005,	/* Send timeout.  */
-#define SO_SNDTIMEO SO_SNDTIMEO
-    SO_RCVTIMEO = 0x1006,	/* Receive timeout.  */
-#define SO_RCVTIMEO SO_RCVTIMEO
-    SO_ERROR = 0x1007,		/* Get and clear error status.  */
-#define SO_ERROR SO_ERROR
-    SO_STYLE = 0x1008,		/* Get socket connection style.  */
-#define SO_STYLE SO_STYLE
-    SO_TYPE = SO_STYLE		/* Compatible name for SO_STYLE.  */
-#define SO_TYPE SO_TYPE
-  };
-
-/* Structure used to manipulate the SO_LINGER option.  */
-struct linger
-  {
-    int l_onoff;		/* Nonzero to linger on close.  */
-    int l_linger;		/* Time to linger.  */
-  };
-
-#endif	/* bits/socket.h */
diff --git a/sysdeps/generic/bits/stat.h b/sysdeps/generic/bits/stat.h
deleted file mode 100644
index c8391fc87f..0000000000
--- a/sysdeps/generic/bits/stat.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright (C) 1992, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STAT_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-/* This structure needs to be defined in accordance with the
-   implementation of __stat, __fstat, and __lstat.  */
-
-#include <bits/types.h>
-
-/* Structure describing file characteristics.  */
-struct stat
-  {
-    /* These are the members that POSIX.1 requires.  */
-
-    __mode_t st_mode;		/* File mode.  */
-#ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;		/* File serial number.  */
-#else
-    __ino64_t st_ino;		/* File serial number.	*/
-#endif
-    __dev_t st_dev;		/* Device containing the file.  */
-    __nlink_t st_nlink;		/* Link count.  */
-
-    __uid_t st_uid;		/* User ID of the file's owner.  */
-    __gid_t st_gid;		/* Group ID of the file's group.  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t st_size;		/* Size of file, in bytes.  */
-#else
-    __off64_t st_size;		/* Size of file, in bytes.  */
-#endif
-
-    __time_t st_atime;		/* Time of last access.  */
-    __time_t st_mtime;		/* Time of last modification.  */
-    __time_t st_ctime;		/* Time of last status change.  */
-
-    /* This should be defined if there is a `st_blksize' member.  */
-#undef	_STATBUF_ST_BLKSIZE
-  };
-
-/* Encoding of the file mode.  These are the standard Unix values,
-   but POSIX.1 does not specify what values should be used.  */
-
-#define	__S_IFMT	0170000	/* These bits determine file type.  */
-
-/* File types.  */
-#define	__S_IFDIR	0040000	/* Directory.  */
-#define	__S_IFCHR	0020000	/* Character device.  */
-#define	__S_IFBLK	0060000	/* Block device.  */
-#define	__S_IFREG	0100000	/* Regular file.  */
-#define	__S_IFIFO	0010000	/* FIFO.  */
-
-/* POSIX.1b objects.  */
-#define __S_TYPEISMQ(buf) 0
-#define __S_TYPEISSEM(buf) 0
-#define __S_TYPEISSHM(buf) 0
-
-/* Protection bits.  */
-
-#define	__S_ISUID	04000	/* Set user ID on execution.  */
-#define	__S_ISGID	02000	/* Set group ID on execution.  */
-#define	__S_IREAD	0400	/* Read by owner.  */
-#define	__S_IWRITE	0200	/* Write by owner.  */
-#define	__S_IEXEC	0100	/* Execute by owner.  */
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-  {
-    __mode_t st_mode;		/* File mode.  */
-    __ino64_t st_ino;		/* File serial number.	*/
-    __dev_t st_dev;		/* Device.  */
-    __nlink_t st_nlink;		/* Link count.  */
-
-    __uid_t st_uid;		/* User ID of the file's owner.	*/
-    __gid_t st_gid;		/* Group ID of the file's group.*/
-    __off64_t st_size;		/* Size of file, in bytes.  */
-
-    __time_t st_atime;		/* Time of last access.  */
-    __time_t st_mtime;		/* Time of last modification.  */
-    __time_t st_ctime;		/* Time of last status change.  */
-  };
-#endif
diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h
deleted file mode 100644
index 851e464fcc..0000000000
--- a/sysdeps/generic/bits/statfs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Definition of `struct statfs', information about a filesystem.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STATFS_H
-# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* GNU Hurd NOTE: The size of this structure (16 ints) is known in
-   <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC.  MiG
-   does not cope at all well with the passed C structure not being of the
-   expected size.  There are some filler words at the end to allow for
-   future expansion.  To increase the size of the structure used in the RPC
-   and retain binary compatibility, we would need to assign a new message
-   number.  */
-
-struct statfs
-  {
-    unsigned int f_type;
-    unsigned int f_bsize;
-#ifndef __USE_FILE_OFFSET64
-    __fsblkcnt_t f_blocks;
-    __fsblkcnt_t f_bfree;
-    __fsblkcnt_t f_bavail;
-    __fsblkcnt_t f_files;
-    __fsblkcnt_t f_ffree;
-#else
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_bavail;
-    __fsblkcnt64_t f_files;
-    __fsblkcnt64_t f_ffree;
-#endif
-    __fsid_t f_fsid;
-    unsigned int f_namelen;
-    unsigned int f_spare[6];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct statfs64
-  {
-    unsigned int f_type;
-    unsigned int f_bsize;
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_bavail;
-    __fsblkcnt64_t f_files;
-    __fsblkcnt64_t f_ffree;
-    __fsid_t f_fsid;
-    unsigned int f_namelen;
-    unsigned int f_spare[6];
-  };
-#endif
diff --git a/sysdeps/generic/bits/statvfs.h b/sysdeps/generic/bits/statvfs.h
deleted file mode 100644
index 66841bf09a..0000000000
--- a/sysdeps/generic/bits/statvfs.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Definition of `struct statvfs', information about a filesystem.
-   Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STATVFS_H
-# error "Never include <bits/statvfs.h> directly; use <sys/statvfs.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* GNU Hurd NOTE: The size of this structure (16 ints) is known in
-   <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC.  MiG
-   does not cope at all well with the passed C structure not being of the
-   expected size.  There are some filler words at the end to allow for
-   future expansion.  To increase the size of the structure used in the RPC
-   and retain binary compatibility, we would need to assign a new message
-   number.  */
-
-struct statvfs
-  {
-    unsigned long int f_bsize;
-    unsigned long int f_frsize;
-#ifndef __USE_FILE_OFFSET64
-    __fsblkcnt_t f_blocks;
-    __fsblkcnt_t f_bfree;
-    __fsblkcnt_t f_bavail;
-    __fsfilcnt_t f_files;
-    __fsfilcnt_t f_ffree;
-    __fsfilcnt_t f_favail;
-#else
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_bavail;
-    __fsfilcnt64_t f_files;
-    __fsfilcnt64_t f_ffree;
-    __fsfilcnt64_t f_favail;
-#endif
-    __fsid_t f_fsid;
-    unsigned long int f_flag;
-    unsigned long int f_namemax;
-    unsigned int f_spare[6];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct statvfs64
-  {
-    unsigned long int f_bsize;
-    unsigned long int f_frsize;
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_bavail;
-    __fsfilcnt64_t f_files;
-    __fsfilcnt64_t f_ffree;
-    __fsfilcnt64_t f_favail;
-    __fsid_t f_fsid;
-    unsigned long int f_flag;
-    unsigned long int f_namemax;
-    unsigned int f_spare[6];
-  };
-#endif
-
-/* Definitions for the flag in `f_flag'.  */
-enum
-{
-  ST_RDONLY = 1,
-#define ST_RDONLY	ST_RDONLY
-  ST_NOSUID = 2
-#define ST_NOSUID	ST_NOSUID
-};
diff --git a/sysdeps/generic/bits/stdio-lock.h b/sysdeps/generic/bits/stdio-lock.h
deleted file mode 100644
index d7c1db0132..0000000000
--- a/sysdeps/generic/bits/stdio-lock.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Thread package specific definitions of stream lock type.  Generic version.
-   Copyright (C) 2000, 2001, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _BITS_STDIO_LOCK_H
-#define _BITS_STDIO_LOCK_H 1
-
-#include <bits/libc-lock.h>
-
-__libc_lock_define_recursive (typedef, _IO_lock_t)
-
-/* We need recursive (counting) mutexes.  */
-#ifdef _LIBC_LOCK_RECURSIVE_INITIALIZER
-# define _IO_lock_initializer _LIBC_LOCK_RECURSIVE_INITIALIZER
-#elif _IO_MTSAFE_IO
- #error libio needs recursive mutexes for _IO_MTSAFE_IO
-#endif
-
-#define _IO_lock_init(_name)	__libc_lock_init_recursive (_name)
-#define _IO_lock_fini(_name)	__libc_lock_fini_recursive (_name)
-#define _IO_lock_lock(_name)	__libc_lock_lock_recursive (_name)
-#define _IO_lock_trylock(_name)	__libc_lock_trylock_recursive (_name)
-#define _IO_lock_unlock(_name)	__libc_lock_unlock_recursive (_name)
-
-
-#define _IO_cleanup_region_start(_fct, _fp) \
-  __libc_cleanup_region_start (((_fp)->_flags & _IO_USER_LOCK) == 0, _fct, _fp)
-#define _IO_cleanup_region_start_noarg(_fct) \
-  __libc_cleanup_region_start (1, _fct, NULL)
-#define _IO_cleanup_region_end(_doit) \
-  __libc_cleanup_region_end (_doit)
-
-#if defined _LIBC && !defined NOT_IN_libc
-# define _IO_acquire_lock(_fp) \
-  _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp));      \
-  _IO_flockfile (_fp)
-
-# define _IO_release_lock(_fp) \
-  _IO_funlockfile (_fp);						      \
-  _IO_cleanup_region_end (0)
-#endif
-
-#endif /* bits/stdio-lock.h */
diff --git a/sysdeps/generic/bits/string.h b/sysdeps/generic/bits/string.h
deleted file mode 100644
index ad68b038b6..0000000000
--- a/sysdeps/generic/bits/string.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This file should provide inline versions of string functions.
-
-   Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
-
-   This file should define __STRING_INLINES if functions are actually defined
-   as inlines.  */
-
-#ifndef _BITS_STRING_H
-#define _BITS_STRING_H	1
-
-
-#endif /* bits/string.h */
diff --git a/sysdeps/generic/bits/stropts.h b/sysdeps/generic/bits/stropts.h
deleted file mode 100644
index c8e2c2c034..0000000000
--- a/sysdeps/generic/bits/stropts.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Copyright (C) 1998, 1999, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _STROPTS_H
-# error "Never include <bits/stropts.h> directly; use <stropts.h> instead."
-#endif
-
-#ifndef _BITS_STROPTS_H
-#define _BITS_STROPTS_H	1
-
-#include <bits/types.h>
-
-/* Macros used as `request' argument to `ioctl'.  */
-#define __SID		('S' << 8)
-
-#define I_NREAD	    (__SID | 1)	/* Counts the number of data bytes in the data
-				   block in the first message.  */
-#define I_PUSH	    (__SID | 2)	/* Push STREAMS module onto top of the current
-				   STREAM, just below the STREAM head.  */
-#define I_POP	    (__SID | 3)	/* Remove STREAMS module from just below the
-				   STREAM head.  */
-#define I_LOOK	    (__SID | 4)	/* Retrieve the name of the module just below
-				   the STREAM head and place it in a character
-				   string.  */
-#define I_FLUSH	    (__SID | 5)	/* Flush all input and/or output.  */
-#define I_SRDOPT    (__SID | 6)	/* Sets the read mode.  */
-#define I_GRDOPT    (__SID | 7)	/* Returns the current read mode setting.  */
-#define I_STR	    (__SID | 8)	/* Construct an internal STREAMS `ioctl'
-				   message and send that message downstream. */
-#define I_SETSIG    (__SID | 9)	/* Inform the STREAM head that the process
-				   wants the SIGPOLL signal issued.  */
-#define I_GETSIG    (__SID |10) /* Return the events for which the calling
-				   process is currently registered to be sent
-				   a SIGPOLL signal.  */
-#define I_FIND	    (__SID |11) /* Compares the names of all modules currently
-				   present in the STREAM to the name pointed to
-				   by `arg'.  */
-#define I_LINK	    (__SID |12) /* Connect two STREAMs.  */
-#define I_UNLINK    (__SID |13) /* Disconnects the two STREAMs.  */
-#define I_PEEK	    (__SID |15) /* Allows a process to retrieve the information
-				   in the first message on the STREAM head read
-				   queue without taking the message off the
-				   queue.  */
-#define I_FDINSERT  (__SID |16) /* Create a message from the specified
-				   buffer(s), adds information about another
-				   STREAM, and send the message downstream.  */
-#define I_SENDFD    (__SID |17) /* Requests the STREAM associated with `fildes'
-				   to send a message, containing a file
-				   pointer, to the STREAM head at the other end
-				   of a STREAMS pipe.  */
-#define I_RECVFD    (__SID |14) /* Non-EFT definition.  */
-#define I_SWROPT    (__SID |19) /* Set the write mode.  */
-#define I_GWROPT    (__SID |20) /* Return the current write mode setting.  */
-#define I_LIST	    (__SID |21) /* List all the module names on the STREAM, up
-				   to and including the topmost driver name. */
-#define I_PLINK	    (__SID |22) /* Connect two STREAMs with a persistent
-				   link.  */
-#define I_PUNLINK   (__SID |23) /* Disconnect the two STREAMs that were
-				   connected with a persistent link.  */
-#define I_FLUSHBAND (__SID |28) /* Flush only band specified.  */
-#define I_CKBAND    (__SID |29) /* Check if the message of a given priority
-				   band exists on the STREAM head read
-				   queue.  */
-#define I_GETBAND   (__SID |30) /* Return the priority band of the first
-				   message on the STREAM head read queue.  */
-#define I_ATMARK    (__SID |31) /* See if the current message on the STREAM
-				   head read queue is "marked" by some module
-				   downstream.  */
-#define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when
-				   a STREAM is closing and there is data on
-				   the write queues.  */
-#define I_GETCLTIME (__SID |33) /* Get current value for closing timeout.  */
-#define I_CANPUT    (__SID |34) /* Check if a certain band is writable.  */
-
-
-/* Used in `I_LOOK' request.  */
-#define FMNAMESZ	8	/* compatibility w/UnixWare/Solaris.  */
-
-/* Flush options.  */
-#define FLUSHR		0x01	/* Flush read queues.  */
-#define FLUSHW		0x02	/* Flush write queues.  */
-#define FLUSHRW		0x03	/* Flush read and write queues.  */
-#ifdef __USE_GNU
-# define FLUSHBAND	0x04	/* Flush only specified band.  */
-#endif
-
-/* Possible arguments for `I_SETSIG'.  */
-#define S_INPUT		0x0001	/* A message, other than a high-priority
-				   message, has arrived.  */
-#define S_HIPRI		0x0002	/* A high-priority message is present.  */
-#define S_OUTPUT	0x0004	/* The write queue for normal data is no longer
-				   full.  */
-#define S_MSG		0x0008	/* A STREAMS signal message that contains the
-				   SIGPOLL signal reaches the front of the
-				   STREAM head read queue.  */
-#define S_ERROR		0x0010	/* Notification of an error condition.  */
-#define S_HANGUP	0x0020	/* Notification of a hangup.  */
-#define S_RDNORM	0x0040	/* A normal message has arrived.  */
-#define S_WRNORM	S_OUTPUT
-#define S_RDBAND	0x0080	/* A message with a non-zero priority has
-				   arrived.  */
-#define S_WRBAND	0x0100	/* The write queue for a non-zero priority
-				   band is no longer full.  */
-#define S_BANDURG	0x0200	/* When used in conjunction with S_RDBAND,
-				   SIGURG is generated instead of SIGPOLL when
-				   a priority message reaches the front of the
-				   STREAM head read queue.  */
-
-/* Option for `I_PEEK'.  */
-#define RS_HIPRI	0x01	/* Only look for high-priority messages.  */
-
-/* Options for `I_SRDOPT'.  */
-#define RNORM		0x0000	/* Byte-STREAM mode, the default.  */
-#define RMSGD		0x0001	/* Message-discard mode.   */
-#define RMSGN		0x0002	/* Message-nondiscard mode.   */
-#define RPROTDAT	0x0004	/* Deliver the control part of a message as
-				   data.  */
-#define RPROTDIS	0x0008	/* Discard the control part of a message,
-				   delivering any data part.  */
-#define RPROTNORM	0x0010	/* Fail `read' with EBADMSG if a message
-				   containing a control part is at the front
-				   of the STREAM head read queue.  */
-#ifdef __USE_GNU
-# define RPROTMASK	0x001C	/* The RPROT bits */
-#endif
-
-/* Possible mode for `I_SWROPT'.  */
-#define SNDZERO		0x001	/* Send a zero-length message downstream when a
-				   `write' of 0 bytes occurs.  */
-#ifdef __USE_GNU
-# define SNDPIPE	0x002	/* Send SIGPIPE on write and putmsg if
-				   sd_werror is set.  */
-#endif
-
-/* Arguments for `I_ATMARK'.  */
-#define ANYMARK		0x01	/* Check if the message is marked.  */
-#define LASTMARK	0x02	/* Check if the message is the last one marked
-				   on the queue.  */
-
-/* Argument for `I_UNLINK'.  */
-#ifdef __USE_GNU
-# define MUXID_ALL	(-1)	/* Unlink all STREAMs linked to the STREAM
-				   associated with `fildes'.  */
-#endif
-
-
-/* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'.  */
-#define MSG_HIPRI	0x01	/* Send/receive high priority message.  */
-#define MSG_ANY		0x02	/* Receive any message.  */
-#define MSG_BAND	0x04	/* Receive message from specified band.  */
-
-/* Values returned by getmsg and getpmsg */
-#define MORECTL		1	/* More control information is left in
-				   message.  */
-#define MOREDATA	2	/* More data is left in message.  */
-
-
-/* Structure used for the I_FLUSHBAND ioctl on streams.  */
-struct bandinfo
-  {
-    unsigned char bi_pri;
-    int bi_flag;
-  };
-
-struct strbuf
-  {
-    int maxlen;		/* Maximum buffer length.  */
-    int len;		/* Length of data.  */
-    char *buf;		/* Pointer to buffer.  */
-  };
-
-struct strpeek
-  {
-    struct strbuf ctlbuf;
-    struct strbuf databuf;
-    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
-  };
-
-struct strfdinsert
-  {
-    struct strbuf ctlbuf;
-    struct strbuf databuf;
-    t_uscalar_t flags;			/* UnixWare/Solaris compatibility.  */
-    int fildes;
-    int offset;
-  };
-
-struct strioctl
-  {
-    int ic_cmd;
-    int ic_timout;
-    int ic_len;
-    char *ic_dp;
-  };
-
-struct strrecvfd
-  {
-    int fd;
-    uid_t uid;
-    gid_t gid;
-    char __fill[8];			/* UnixWare/Solaris compatibility */
-  };
-
-
-struct str_mlist
-  {
-    char l_name[FMNAMESZ + 1];
-  };
-
-struct str_list
-  {
-    int sl_nmods;
-    struct str_mlist *sl_modlist;
-  };
-
-#endif /* bits/stropts.h */
diff --git a/sysdeps/generic/bits/sys_errlist.h b/sysdeps/generic/bits/sys_errlist.h
deleted file mode 100644
index ab839b7073..0000000000
--- a/sysdeps/generic/bits/sys_errlist.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Declare sys_errlist and sys_nerr, or don't.  Don't version.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _STDIO_H
-# error "Never include <bits/sys_errlist.h> directly; use <stdio.h> instead."
-#endif
-
-/* sys_errlist and sys_nerr are deprecated.  Use strerror instead.  */
diff --git a/sysdeps/generic/bits/termios.h b/sysdeps/generic/bits/termios.h
deleted file mode 100644
index 43bb1ce52d..0000000000
--- a/sysdeps/generic/bits/termios.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/* termios type and macro definitions.  4.4 BSD/generic GNU version.
-   Copyright (C) 1993,94,96,97,99,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-/* These macros are also defined in some <bits/ioctls.h> files (with
-   numerically identical values), but this serves to shut up cpp's
-   complaining. */
-#ifdef __USE_BSD
-
-# ifdef MDMBUF
-#  undef MDMBUF
-# endif
-# ifdef FLUSHO
-#  undef FLUSHO
-# endif
-# ifdef PENDIN
-#  undef PENDIN
-# endif
-
-#endif /* __USE_BSD */
-
-#ifdef ECHO
-# undef ECHO
-#endif
-#ifdef TOSTOP
-# undef TOSTOP
-#endif
-#ifdef NOFLSH
-# undef NOFLSH
-#endif
-
-
-/* These definitions match those used by the 4.4 BSD kernel.
-   If the operating system has termios system calls or ioctls that
-   correctly implement the POSIX.1 behavior, there should be a
-   system-dependent version of this file that defines `struct termios',
-   `tcflag_t', `cc_t', `speed_t' and the `TC*' constants appropriately.  */
-
-/* Type of terminal control flag masks.  */
-typedef unsigned long int tcflag_t;
-
-/* Type of control characters.  */
-typedef unsigned char cc_t;
-
-/* Type of baud rate specifiers.  */
-typedef long int speed_t;
-
-/* Terminal control structure.  */
-struct termios
-{
-  /* Input modes.  */
-  tcflag_t c_iflag;
-#define	IGNBRK	(1 << 0)	/* Ignore break condition.  */
-#define	BRKINT	(1 << 1)	/* Signal interrupt on break.  */
-#define	IGNPAR	(1 << 2)	/* Ignore characters with parity errors.  */
-#define	PARMRK	(1 << 3)	/* Mark parity and framing errors.  */
-#define	INPCK	(1 << 4)	/* Enable input parity check.  */
-#define	ISTRIP	(1 << 5)	/* Strip 8th bit off characters.  */
-#define	INLCR	(1 << 6)	/* Map NL to CR on input.  */
-#define	IGNCR	(1 << 7)	/* Ignore CR.  */
-#define	ICRNL	(1 << 8)	/* Map CR to NL on input.  */
-#define	IXON	(1 << 9)	/* Enable start/stop output control.  */
-#define	IXOFF	(1 << 10)	/* Enable start/stop input control.  */
-#ifdef	__USE_BSD
-# define IXANY	(1 << 11)	/* Any character will restart after stop.  */
-# define IMAXBEL (1 << 13)	/* Ring bell when input queue is full.  */
-#endif
-#ifdef __USE_GNU
-# define IUCLC	(1 << 14)	/* Translate upper case input to lower case. */
-#endif
-
-  /* Output modes.  */
-  tcflag_t c_oflag;
-#define	OPOST	(1 << 0)	/* Perform output processing.  */
-#ifdef	__USE_BSD
-# define ONLCR	(1 << 1)	/* Map NL to CR-NL on output.  */
-# define OXTABS	(1 << 2)	/* Expand tabs to spaces.  */
-# define ONOEOT	(1 << 3)	/* Discard EOT (^D) on output.  */
-#endif
-#ifdef __USE_GNU
-# define OLCUC	(1 << 9)	/* Translate lower case output to upper case */
-#endif
-
-  /* Control modes.  */
-  tcflag_t c_cflag;
-#ifdef	__USE_BSD
-# define CIGNORE	(1 << 0)	/* Ignore these control flags.  */
-#endif
-#define	CSIZE	(CS5|CS6|CS7|CS8)	/* Number of bits per byte (mask).  */
-#define	CS5	0		/* 5 bits per byte.  */
-#define	CS6	(1 << 8)	/* 6 bits per byte.  */
-#define	CS7	(1 << 9)	/* 7 bits per byte.  */
-#define	CS8	(CS6|CS7)	/* 8 bits per byte.  */
-#define	CSTOPB	(1 << 10)	/* Two stop bits instead of one.  */
-#define	CREAD	(1 << 11)	/* Enable receiver.  */
-#define	PARENB	(1 << 12)	/* Parity enable.  */
-#define	PARODD	(1 << 13)	/* Odd parity instead of even.  */
-#define	HUPCL	(1 << 14)	/* Hang up on last close.  */
-#define	CLOCAL	(1 << 15)	/* Ignore modem status lines.  */
-#ifdef	__USE_BSD
-# define CCTS_OFLOW	(1 << 16)	/* CTS flow control of output.  */
-# define CRTS_IFLOW	(1 << 17)	/* RTS flow control of input.  */
-# define CRTSCTS	(CCTS_OFLOW|CRTS_IFLOW)	/* CTS/RTS flow control.  */
-# define MDMBUF		(1 << 20)	/* Carrier flow control of output.  */
-#endif
-
-  /* Local modes.  */
-  tcflag_t c_lflag;
-#ifdef	__USE_BSD
-# define ECHOKE	(1 << 0)	/* Visual erase for KILL.  */
-#endif
-#define	_ECHOE	(1 << 1)	/* Visual erase for ERASE.  */
-#define	ECHOE	_ECHOE
-#define	_ECHOK	(1 << 2)	/* Echo NL after KILL.  */
-#define	ECHOK	_ECHOK
-#define	_ECHO	(1 << 3)	/* Enable echo.  */
-#define	ECHO	_ECHO
-#define	_ECHONL	(1 << 4)	/* Echo NL even if ECHO is off.  */
-#define	ECHONL	_ECHONL
-#ifdef	__USE_BSD
-# define ECHOPRT	(1 << 5)	/* Hardcopy visual erase.  */
-# define ECHOCTL	(1 << 6)	/* Echo control characters as ^X.  */
-#endif
-#define	_ISIG	(1 << 7)	/* Enable signals.  */
-#define	ISIG	_ISIG
-#define	_ICANON	(1 << 8)	/* Do erase and kill processing.  */
-#define	ICANON	_ICANON
-#ifdef	__USE_BSD
-# define ALTWERASE (1 << 9)	/* Alternate WERASE algorithm.  */
-#endif
-#define	_IEXTEN	(1 << 10)	/* Enable DISCARD and LNEXT.  */
-#define	IEXTEN	_IEXTEN
-#define	EXTPROC	(1 << 11)	/* External processing.  */
-#define	_TOSTOP	(1 << 22)	/* Send SIGTTOU for background output.  */
-#define	TOSTOP	_TOSTOP
-#ifdef	__USE_BSD
-# define FLUSHO	(1 << 23)	/* Output being flushed (state).  */
-# define NOKERNINFO (1 << 25)	/* Disable VSTATUS.  */
-# define PENDIN	(1 << 29)	/* Retype pending input (state).  */
-#endif
-#define	_NOFLSH	(1 << 31)	/* Disable flush after interrupt.  */
-#define	NOFLSH	_NOFLSH
-
-  /* Control characters.  */
-#define	VEOF	0		/* End-of-file character [ICANON].  */
-#define	VEOL	1		/* End-of-line character [ICANON].  */
-#ifdef	__USE_BSD
-# define VEOL2	2		/* Second EOL character [ICANON].  */
-#endif
-#define	VERASE	3		/* Erase character [ICANON].  */
-#ifdef	__USE_BSD
-# define VWERASE	4		/* Word-erase character [ICANON].  */
-#endif
-#define	VKILL	5		/* Kill-line character [ICANON].  */
-#ifdef	__USE_BSD
-# define VREPRINT 6		/* Reprint-line character [ICANON].  */
-#endif
-#define	VINTR	8		/* Interrupt character [ISIG].  */
-#define	VQUIT	9		/* Quit character [ISIG].  */
-#define	VSUSP	10		/* Suspend character [ISIG].  */
-#ifdef	__USE_BSD
-# define VDSUSP	11		/* Delayed suspend character [ISIG].  */
-#endif
-#define	VSTART	12		/* Start (X-ON) character [IXON, IXOFF].  */
-#define	VSTOP	13		/* Stop (X-OFF) character [IXON, IXOFF].  */
-#ifdef	__USE_BSD
-# define VLNEXT	14		/* Literal-next character [IEXTEN].  */
-# define VDISCARD 15		/* Discard character [IEXTEN].  */
-#endif
-#define	VMIN	16		/* Minimum number of bytes read at once [!ICANON].  */
-#define	VTIME	17		/* Time-out value (tenths of a second) [!ICANON].  */
-#ifdef	__USE_BSD
-# define VSTATUS	18		/* Status character [ICANON].  */
-#endif
-#define	NCCS	20		/* Value duplicated in <hurd/tioctl.defs>.  */
-  cc_t c_cc[NCCS];
-
-  /* Input and output baud rates.  */
-  speed_t __ispeed, __ospeed;
-#define	B0	0		/* Hang up.  */
-#define	B50	50		/* 50 baud.  */
-#define	B75	75		/* 75 baud.  */
-#define	B110	110		/* 110 baud.  */
-#define	B134	134		/* 134.5 baud.  */
-#define	B150	150		/* 150 baud.  */
-#define	B200	200		/* 200 baud.  */
-#define	B300	300		/* 300 baud.  */
-#define	B600	600		/* 600 baud.  */
-#define	B1200	1200		/* 1200 baud.  */
-#define	B1800	1800		/* 1800 baud.  */
-#define	B2400	2400		/* 2400 baud.  */
-#define	B4800	4800		/* 4800 baud.  */
-#define	B9600	9600		/* 9600 baud.  */
-#define	B19200	19200		/* 19200 baud.  */
-#define	B38400	38400		/* 38400 baud.  */
-#ifdef	__USE_MISC
-# define EXTA	19200
-# define EXTB	38400
-#endif
-#define	B57600	57600
-#define	B115200	115200
-#define	B230400	230400
-#define	B460800	460800
-#define	B500000	500000
-#define	B576000	576000
-#define	B921600	921600
-#define	B1000000 1000000
-#define	B1152000 1152000
-#define	B1500000 1500000
-#define	B2000000 2000000
-#define	B2500000 2500000
-#define	B3000000 3000000
-#define	B3500000 3500000
-#define	B4000000 4000000
-};
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (tcflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
-
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
-#define	TCSANOW		0	/* Change immediately.  */
-#define	TCSADRAIN	1	/* Change when pending output is written.  */
-#define	TCSAFLUSH	2	/* Flush pending input before changing.  */
-#ifdef	__USE_BSD
-# define TCSASOFT	0x10	/* Flag: Don't alter hardware state.  */
-#endif
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
-#define	TCIFLUSH	1	/* Discard data received but not yet read.  */
-#define	TCOFLUSH	2	/* Discard data written but not yet sent.  */
-#define	TCIOFLUSH	3	/* Discard all pending data.  */
-
-/* Values for the ACTION argument to `tcflow'.  */
-#define	TCOOFF	1		/* Suspend output.  */
-#define	TCOON	2		/* Restart suspended output.  */
-#define	TCIOFF	3		/* Send a STOP character.  */
-#define	TCION	4		/* Send a START character.  */
diff --git a/sysdeps/generic/bits/time.h b/sysdeps/generic/bits/time.h
deleted file mode 100644
index b3184d1de9..0000000000
--- a/sysdeps/generic/bits/time.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* System-dependent timing definitions.  Generic version.
-   Copyright (C) 1996,1997,1999-2002,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * Never include this file directly; use <time.h> instead.
- */
-
-#ifndef __need_timeval
-# ifndef _BITS_TIME_H
-#  define _BITS_TIME_H	1
-
-/* ISO/IEC 9899:1990 7.12.1: <time.h>
-   The macro `CLOCKS_PER_SEC' is the number per second of the value
-   returned by the `clock' function. */
-/* CAE XSH, Issue 4, Version 2: <time.h>
-   The value of CLOCKS_PER_SEC is required to be 1 million on all
-   XSI-conformant systems. */
-#  define CLOCKS_PER_SEC  1000000l
-
-#  if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
-/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
-   presents the real value for clock ticks per second for the system.  */
-#   include <bits/types.h>
-extern long int __sysconf (int);
-#   define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
-#  endif
-
-#  ifdef __USE_POSIX199309
-/* Identifier for system-wide realtime clock.  */
-#   define CLOCK_REALTIME		0
-/* Monotonic system-wide clock.  */
-#   define CLOCK_MONOTONIC		1
-/* High-resolution timer from the CPU.  */
-#   define CLOCK_PROCESS_CPUTIME_ID	2
-/* Thread-specific CPU-time clock.  */
-#   define CLOCK_THREAD_CPUTIME_ID	3
-
-/* Flag to indicate time is absolute.  */
-#   define TIMER_ABSTIME		1
-#  endif
-
-# endif	/* bits/time.h */
-#endif
-
-#ifdef __need_timeval
-# undef __need_timeval
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-#  include <bits/types.h>
-
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    __time_t tv_sec;		/* Seconds.  */
-    __suseconds_t tv_usec;	/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif	/* need timeval */
diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h
deleted file mode 100644
index ce48964f14..0000000000
--- a/sysdeps/generic/bits/types.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/* bits/types.h -- definitions of __*_t types underlying *_t types.
-   Copyright (C) 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * Never include this file directly; use <sys/types.h> instead.
- */
-
-#ifndef	_BITS_TYPES_H
-#define	_BITS_TYPES_H	1
-
-#include <features.h>
-#include <bits/wordsize.h>
-
-#define __need_size_t
-#include <stddef.h>
-
-/* Convenience types.  */
-typedef unsigned char __u_char;
-typedef unsigned short int __u_short;
-typedef unsigned int __u_int;
-typedef unsigned long int __u_long;
-
-/* Fixed-size types, underlying types depend on word size and compiler.  */
-typedef signed char __int8_t;
-typedef unsigned char __uint8_t;
-typedef signed short int __int16_t;
-typedef unsigned short int __uint16_t;
-typedef signed int __int32_t;
-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
-__extension__ typedef signed long long int __int64_t;
-__extension__ typedef unsigned long long int __uint64_t;
-#endif
-
-/* quad_t is also 64 bits.  */
-#if __WORDSIZE == 64
-typedef long int __quad_t;
-typedef unsigned long int __u_quad_t;
-#elif defined __GLIBC_HAVE_LONG_LONG
-__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
-
-
-/* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
-   macros for each of the OS types we define below.  The definitions
-   of those macros must use the following macros for underlying types.
-   We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
-   variants of each of the following integer types on this machine.
-
-	16		-- "natural" 16-bit type (always short)
-	32		-- "natural" 32-bit type (always int)
-	64		-- "natural" 64-bit type (long or long long)
-	LONG32		-- 32-bit type, traditionally long
-	QUAD		-- 64-bit type, always long long
-	WORD		-- natural type of __WORDSIZE bits (int or long)
-	LONGWORD	-- type of __WORDSIZE bits, traditionally long
-
-   We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
-   conventional uses of `long' or `long long' type modifiers match the
-   types we define, even when a less-adorned type would be the same size.
-   This matters for (somewhat) portably writing printf/scanf formats for
-   these types, where using the appropriate l or ll format modifiers can
-   make the typedefs and the formats match up across all GNU platforms.  If
-   we used `long' when it's 64 bits where `long long' is expected, then the
-   compiler would warn about the formats not matching the argument types,
-   and the programmer changing them to shut up the compiler would break the
-   program's portability.
-
-   Here we assume what is presently the case in all the GCC configurations
-   we support: long long is always 64 bits, long is always word/address size,
-   and int is always 32 bits.  */
-
-#define	__S16_TYPE		short int
-#define __U16_TYPE		unsigned short int
-#define	__S32_TYPE		int
-#define __U32_TYPE		unsigned int
-#define __SLONGWORD_TYPE	long int
-#define __ULONGWORD_TYPE	unsigned long int
-#if __WORDSIZE == 32
-# define __SQUAD_TYPE		__quad_t
-# define __UQUAD_TYPE		__u_quad_t
-# define __SWORD_TYPE		int
-# define __UWORD_TYPE		unsigned int
-# define __SLONG32_TYPE		long int
-# define __ULONG32_TYPE		unsigned long int
-# define __S64_TYPE		__quad_t
-# define __U64_TYPE		__u_quad_t
-#elif __WORDSIZE == 64
-# define __SQUAD_TYPE		long int
-# define __UQUAD_TYPE		unsigned long int
-# define __SWORD_TYPE		long int
-# define __UWORD_TYPE		unsigned long int
-# define __SLONG32_TYPE		int
-# define __ULONG32_TYPE		unsigned int
-# define __S64_TYPE		long int
-# define __U64_TYPE		unsigned long int
-#else
-# error
-#endif
-#include <bits/typesizes.h>	/* Defines __*_T_TYPE macros.  */
-
-/* We want __extension__ before typedef's that use nonstandard base types
-   such as `long long' in C89 mode.  */
-#define __STD_TYPE __extension__ typedef
-
-
-__STD_TYPE __DEV_T_TYPE __dev_t;	/* Type of device numbers.  */
-__STD_TYPE __UID_T_TYPE __uid_t;	/* Type of user identifications.  */
-__STD_TYPE __GID_T_TYPE __gid_t;	/* Type of group identifications.  */
-__STD_TYPE __INO_T_TYPE __ino_t;	/* Type of file serial numbers.  */
-__STD_TYPE __INO64_T_TYPE __ino64_t;	/* Type of file serial numbers (LFS).*/
-__STD_TYPE __MODE_T_TYPE __mode_t;	/* Type of file attribute bitmasks.  */
-__STD_TYPE __NLINK_T_TYPE __nlink_t;	/* Type of file link counts.  */
-__STD_TYPE __OFF_T_TYPE __off_t;	/* Type of file sizes and offsets.  */
-__STD_TYPE __OFF64_T_TYPE __off64_t;	/* Type of file sizes and offsets (LFS).  */
-__STD_TYPE __PID_T_TYPE __pid_t;	/* Type of process identifications.  */
-__STD_TYPE __FSID_T_TYPE __fsid_t;	/* Type of file system IDs.  */
-__STD_TYPE __CLOCK_T_TYPE __clock_t;	/* Type of CPU usage counts.  */
-__STD_TYPE __RLIM_T_TYPE __rlim_t;	/* Type for resource measurement.  */
-__STD_TYPE __RLIM64_T_TYPE __rlim64_t;	/* Type for resource measurement (LFS).  */
-__STD_TYPE __ID_T_TYPE __id_t;		/* General type for IDs.  */
-__STD_TYPE __TIME_T_TYPE __time_t;	/* Seconds since the Epoch.  */
-__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds.  */
-__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds.  */
-
-__STD_TYPE __DADDR_T_TYPE __daddr_t;	/* The type of a disk address.  */
-__STD_TYPE __SWBLK_T_TYPE __swblk_t;	/* Type of a swap block maybe?  */
-__STD_TYPE __KEY_T_TYPE __key_t;	/* Type of an IPC key.  */
-
-/* Clock ID used in clock and timer functions.  */
-__STD_TYPE __CLOCKID_T_TYPE __clockid_t;
-
-/* Timer ID returned by `timer_create'.  */
-__STD_TYPE __TIMER_T_TYPE __timer_t;
-
-/* Type to represent block size.  */
-__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;
-
-/* Types from the Large File Support interface.  */
-
-/* Type to count number of disk blocks.  */
-__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t;
-__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t;
-
-/* Type to count file system blocks.  */
-__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t;
-__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
-
-/* Type to count file system nodes.  */
-__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t;
-__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
-
-__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error.  */
-
-/* These few don't really vary by system, they always correspond
-   to one of the other defined types.  */
-typedef __off64_t __loff_t;	/* Type of file sizes and offsets (LFS).  */
-typedef __quad_t *__qaddr_t;
-typedef char *__caddr_t;
-
-/* Duplicates info from stdint.h but this is used in unistd.h.  */
-__STD_TYPE __SWORD_TYPE __intptr_t;
-
-/* Duplicate info from sys/socket.h.  */
-__STD_TYPE __U32_TYPE __socklen_t;
-
-
-#undef __STD_TYPE
-
-#endif /* bits/types.h */
diff --git a/sysdeps/generic/bits/typesizes.h b/sysdeps/generic/bits/typesizes.h
deleted file mode 100644
index e9226c4174..0000000000
--- a/sysdeps/generic/bits/typesizes.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* bits/typesizes.h -- underlying types for *_t.  Generic version.
-   Copyright (C) 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _BITS_TYPES_H
-# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
-#endif
-
-#ifndef	_BITS_TYPESIZES_H
-#define	_BITS_TYPESIZES_H	1
-
-/* See <bits/types.h> for the meaning of these macros.  This file exists so
-   that <bits/types.h> need not vary across different GNU platforms.  */
-
-#define __DEV_T_TYPE		__UQUAD_TYPE
-#define __UID_T_TYPE		__U32_TYPE
-#define __GID_T_TYPE		__U32_TYPE
-#define __INO_T_TYPE		__ULONGWORD_TYPE
-#define __INO64_T_TYPE		__UQUAD_TYPE
-#define __MODE_T_TYPE		__U32_TYPE
-#define __NLINK_T_TYPE		__UWORD_TYPE
-#define __OFF_T_TYPE		__SLONGWORD_TYPE
-#define __OFF64_T_TYPE		__SQUAD_TYPE
-#define __PID_T_TYPE		__S32_TYPE
-#define __RLIM_T_TYPE		__ULONGWORD_TYPE
-#define __RLIM64_T_TYPE		__UQUAD_TYPE
-#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
-#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
-#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
-#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
-#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
-#define	__ID_T_TYPE		__U32_TYPE
-#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
-#define __TIME_T_TYPE		__SLONGWORD_TYPE
-#define __USECONDS_T_TYPE	__U32_TYPE
-#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
-#define __DADDR_T_TYPE		__S32_TYPE
-#define __SWBLK_T_TYPE		__SLONGWORD_TYPE
-#define __KEY_T_TYPE		__S32_TYPE
-#define __CLOCKID_T_TYPE	__S32_TYPE
-#define __TIMER_T_TYPE		void *
-#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
-#define __FSID_T_TYPE		struct { int __val[2]; }
-#define __SSIZE_T_TYPE		__SWORD_TYPE
-
-/* Number of descriptors that can fit in an `fd_set'.  */
-#define	__FD_SETSIZE		1024
-
-
-#endif /* bits/typesizes.h */
diff --git a/sysdeps/generic/bits/uio.h b/sysdeps/generic/bits/uio.h
deleted file mode 100644
index 410ce2a98a..0000000000
--- a/sysdeps/generic/bits/uio.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_UIO_H
-# error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
-#endif
-
-
-/* `struct iovec' -- Structure describing a section of memory.  */
-
-struct iovec
-{
-  /* Starting address.  */
-  __ptr_t iov_base;
-  /* Length in bytes.  */
-  size_t iov_len;
-};
diff --git a/sysdeps/generic/bits/ustat.h b/sysdeps/generic/bits/ustat.h
deleted file mode 100644
index 69c6b72270..0000000000
--- a/sysdeps/generic/bits/ustat.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_USTAT_H
-# error "Never include <bits/ustat.h> directly; use <sys/ustat.h> instead."
-#endif
-
-#include <sys/types.h>
-
-struct ustat
-  {
-    __daddr_t f_tfree;		/* Number of free blocks.  */
-    __ino_t f_tinode;		/* Number of free inodes.  */
-    char f_fname[6];
-    char f_fpack[6];
-  };
diff --git a/sysdeps/generic/bits/utmp.h b/sysdeps/generic/bits/utmp.h
deleted file mode 100644
index 03a2b1f40b..0000000000
--- a/sysdeps/generic/bits/utmp.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* The `struct utmp' type, describing entries in the utmp file.  Generic/BSDish
-   Copyright (C) 1993, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _UTMP_H
-# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
-#endif
-
-#include <paths.h>
-#include <time.h>
-
-
-#define	UT_NAMESIZE	8
-#define	UT_LINESIZE	8
-#define	UT_HOSTSIZE	16
-
-
-struct lastlog
-  {
-    time_t ll_time;
-    char ll_line[UT_LINESIZE];
-    char ll_host[UT_HOSTSIZE];
-  };
-
-struct utmp
-  {
-    char ut_line[UT_LINESIZE];
-    char ut_user[UT_NAMESIZE];
-#define ut_name ut_user
-    char ut_host[UT_HOSTSIZE];
-    long int ut_time;
-  };
-
-
-#define _HAVE_UT_HOST 1		/* We have the ut_host field.  */
diff --git a/sysdeps/generic/bits/utsname.h b/sysdeps/generic/bits/utsname.h
deleted file mode 100644
index 48e8a8e9b6..0000000000
--- a/sysdeps/generic/bits/utsname.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_UTSNAME_H
-# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
-#endif
-
-/* The size of the character arrays used to hold the information
-   in a `struct utsname'.  Enlarge this as necessary.  */
-#define	_UTSNAME_LENGTH	1024
diff --git a/sysdeps/generic/bits/waitflags.h b/sysdeps/generic/bits/waitflags.h
deleted file mode 100644
index 157dd1211a..0000000000
--- a/sysdeps/generic/bits/waitflags.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1992, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SYS_WAIT_H && !defined _STDLIB_H
-# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
-#endif
-
-
-/* Bits in the third argument to `waitpid'.  */
-#define	WNOHANG		1	/* Don't block waiting.  */
-#define	WUNTRACED	2	/* Report status of stopped children.  */
diff --git a/sysdeps/generic/bits/waitstatus.h b/sysdeps/generic/bits/waitstatus.h
deleted file mode 100644
index 699c224989..0000000000
--- a/sysdeps/generic/bits/waitstatus.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Definitions of status bits for `wait' et al.
-   Copyright (C) 1992,1994,1996,1997,2000,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SYS_WAIT_H && !defined _STDLIB_H
-# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
-#endif
-
-
-/* Everything extant so far uses these same bits.  */
-
-
-/* If WIFEXITED(STATUS), the low-order 8 bits of the status.  */
-#define	__WEXITSTATUS(status)	(((status) & 0xff00) >> 8)
-
-/* If WIFSIGNALED(STATUS), the terminating signal.  */
-#define	__WTERMSIG(status)	((status) & 0x7f)
-
-/* If WIFSTOPPED(STATUS), the signal that stopped the child.  */
-#define	__WSTOPSIG(status)	__WEXITSTATUS(status)
-
-/* Nonzero if STATUS indicates normal termination.  */
-#define	__WIFEXITED(status)	(__WTERMSIG(status) == 0)
-
-/* Nonzero if STATUS indicates termination by a signal.  */
-#define __WIFSIGNALED(status) \
-  (((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
-
-/* Nonzero if STATUS indicates the child is stopped.  */
-#define	__WIFSTOPPED(status)	(((status) & 0xff) == 0x7f)
-
-/* Nonzero if STATUS indicates the child continued after a stop.  We only
-   define this if <bits/waitflags.h> provides the WCONTINUED flag bit.  */
-#ifdef WCONTINUED
-# define __WIFCONTINUED(status)	((status) == __W_CONTINUED)
-#endif
-
-/* Nonzero if STATUS indicates the child dumped core.  */
-#define	__WCOREDUMP(status)	((status) & __WCOREFLAG)
-
-/* Macros for constructing status values.  */
-#define	__W_EXITCODE(ret, sig)	((ret) << 8 | (sig))
-#define	__W_STOPCODE(sig)	((sig) << 8 | 0x7f)
-#define __W_CONTINUED		0xffff
-#define	__WCOREFLAG		0x80
-
-
-#ifdef	__USE_BSD
-
-# include <endian.h>
-
-union wait
-  {
-    int w_status;
-    struct
-      {
-# if	__BYTE_ORDER == __LITTLE_ENDIAN
-	unsigned int __w_termsig:7; /* Terminating signal.  */
-	unsigned int __w_coredump:1; /* Set if dumped core.  */
-	unsigned int __w_retcode:8; /* Return code if exited normally.  */
-	unsigned int:16;
-# endif				/* Little endian.  */
-# if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int:16;
-	unsigned int __w_retcode:8;
-	unsigned int __w_coredump:1;
-	unsigned int __w_termsig:7;
-# endif				/* Big endian.  */
-      } __wait_terminated;
-    struct
-      {
-# if	__BYTE_ORDER == __LITTLE_ENDIAN
-	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
-	unsigned int __w_stopsig:8; /* Stopping signal.  */
-	unsigned int:16;
-# endif				/* Little endian.  */
-# if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int:16;
-	unsigned int __w_stopsig:8; /* Stopping signal.  */
-	unsigned int __w_stopval:8; /* W_STOPPED if stopped.  */
-# endif				/* Big endian.  */
-      } __wait_stopped;
-  };
-
-# define w_termsig	__wait_terminated.__w_termsig
-# define w_coredump	__wait_terminated.__w_coredump
-# define w_retcode	__wait_terminated.__w_retcode
-# define w_stopsig	__wait_stopped.__w_stopsig
-# define w_stopval	__wait_stopped.__w_stopval
-
-#endif	/* Use BSD.  */
diff --git a/sysdeps/generic/bits/wchar.h b/sysdeps/generic/bits/wchar.h
deleted file mode 100644
index ef1f56363a..0000000000
--- a/sysdeps/generic/bits/wchar.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* wchar_t type related definitions.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _BITS_WCHAR_H
-#define _BITS_WCHAR_H	1
-
-#define __WCHAR_MIN	(-2147483647 - 1)
-#define __WCHAR_MAX	(2147483647)
-
-#endif	/* bits/wchar.h */
diff --git a/sysdeps/generic/bits/wordsize.h b/sysdeps/generic/bits/wordsize.h
deleted file mode 100644
index 9ef0e8526a..0000000000
--- a/sysdeps/generic/bits/wordsize.h
+++ /dev/null
@@ -1 +0,0 @@
-#error "This file must be written based on the data type sizes of the target"
diff --git a/sysdeps/generic/bits/xtitypes.h b/sysdeps/generic/bits/xtitypes.h
deleted file mode 100644
index c21bfb036c..0000000000
--- a/sysdeps/generic/bits/xtitypes.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* bits/xtitypes.h -- Define some types used by <bits/stropts.h>.  Generic.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _STROPTS_H
-# error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead."
-#endif
-
-#ifndef _BITS_XTITYPES_H
-#define _BITS_XTITYPES_H	1
-
-#include <bits/types.h>
-
-/* This type is used by some structs in <bits/stropts.h>.  */
-typedef __SLONGWORD_TYPE __t_scalar_t;
-typedef __ULONGWORD_TYPE __t_uscalar_t;
-
-
-#endif /* bits/xtitypes.h */
diff --git a/sysdeps/generic/brdinit.c b/sysdeps/generic/brdinit.c
deleted file mode 100644
index af96bcd12a..0000000000
--- a/sysdeps/generic/brdinit.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
-     On-Line Applications Research Corporation.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <standalone.h>
-
-/* This file is only required when a "bare" board is configured. */
-
-/*  _Board_Initialize
-
-This routine normally performs board specific initialization.  */
-
-void
-_Board_Initialize ()
-{
-}
diff --git a/sysdeps/generic/brk.c b/sysdeps/generic/brk.c
deleted file mode 100644
index b951819f21..0000000000
--- a/sysdeps/generic/brk.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* sbrk.c expects this.  */
-void *__curbrk;
-
-/* Set the end of the process's data space to ADDR.
-   Return 0 if successful, -1 if not.  */
-int
-__brk (addr)
-     void *addr;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (brk)
-
-weak_alias (__brk, brk)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/bsd-_setjmp.c b/sysdeps/generic/bsd-_setjmp.c
deleted file mode 100644
index 884a4da9b6..0000000000
--- a/sysdeps/generic/bsd-_setjmp.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  Stub version.
-   Copyright (C) 1994, 1997, 1999, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <setjmp.h>
-
-#undef _setjmp
-
-/* This implementation in C will not usually work, because the call
-   really needs to be a tail-call so __sigsetjmp saves the state of
-   the caller, not the state of this `setjmp' frame which then
-   immediate unwinds.  */
-
-int
-_setjmp (jmp_buf env)
-{
-  return __sigsetjmp (env, 0);
-}
-libc_hidden_def (_setjmp)
diff --git a/sysdeps/generic/bsd-setjmp.c b/sysdeps/generic/bsd-setjmp.c
deleted file mode 100644
index 15f3f153cc..0000000000
--- a/sysdeps/generic/bsd-setjmp.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  Stub version.
-   Copyright (C) 1994, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <setjmp.h>
-
-#undef setjmp
-
-/* This implementation in C will not usually work, because the call
-   really needs to be a tail-call so __sigsetjmp saves the state of
-   the caller, not the state of this `setjmp' frame which then
-   immediate unwinds.  */
-
-int
-setjmp (jmp_buf env)
-{
-  return __sigsetjmp (env, 1);
-}
diff --git a/sysdeps/generic/bzero.c b/sysdeps/generic/bzero.c
deleted file mode 100644
index c6ede14139..0000000000
--- a/sysdeps/generic/bzero.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (C) 1991, 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-#undef __bzero
-
-/* Set N bytes of S to 0.  */
-void
-__bzero (s, len)
-     void *s;
-     size_t len;
-{
-  long int dstp = (long int) s;
-  const op_t zero = 0;
-
-  if (len >= 8)
-    {
-      size_t xlen;
-
-      /* There are at least some bytes to zero.  No need to test
-	 for LEN == 0 in this alignment loop.  */
-      while (dstp % OPSIZ != 0)
-	{
-	  ((byte *) dstp)[0] = 0;
-	  dstp += 1;
-	  len -= 1;
-	}
-
-      /* Write 8 op_t per iteration until less than 8 op_t remain.  */
-      xlen = len / (OPSIZ * 8);
-      while (xlen != 0)
-	{
-	  ((op_t *) dstp)[0] = zero;
-	  ((op_t *) dstp)[1] = zero;
-	  ((op_t *) dstp)[2] = zero;
-	  ((op_t *) dstp)[3] = zero;
-	  ((op_t *) dstp)[4] = zero;
-	  ((op_t *) dstp)[5] = zero;
-	  ((op_t *) dstp)[6] = zero;
-	  ((op_t *) dstp)[7] = zero;
-	  dstp += 8 * OPSIZ;
-	  xlen -= 1;
-	}
-      len %= OPSIZ * 8;
-
-      /* Write 1 op_t per iteration until less than op_t remain.  */
-      xlen = len / OPSIZ;
-      while (xlen != 0)
-	{
-	  ((op_t *) dstp)[0] = zero;
-	  dstp += OPSIZ;
-	  xlen -= 1;
-	}
-      len %= OPSIZ;
-    }
-
-  /* Write the last few bytes.  */
-  while (len != 0)
-    {
-      ((byte *) dstp)[0] = 0;
-      dstp += 1;
-      len -= 1;
-    }
-}
-weak_alias (__bzero, bzero)
diff --git a/sysdeps/generic/cabsf.c b/sysdeps/generic/cabsf.c
deleted file mode 100644
index 956db76ba1..0000000000
--- a/sysdeps/generic/cabsf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Return the complex absolute value of float complex value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-float
-__cabsf (float _Complex z)
-{
-  return __hypotf (__real__ z, __imag__ z);
-}
-weak_alias (__cabsf, cabsf)
diff --git a/sysdeps/generic/cargf.c b/sysdeps/generic/cargf.c
deleted file mode 100644
index df1f20bc48..0000000000
--- a/sysdeps/generic/cargf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Compute argument of complex float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-float
-__cargf (__complex__ float x)
-{
-  return __atan2f (__imag__ x, __real__ x);
-}
-weak_alias (__cargf, cargf)
diff --git a/sysdeps/generic/chdir.c b/sysdeps/generic/chdir.c
deleted file mode 100644
index afaeef8787..0000000000
--- a/sysdeps/generic/chdir.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-/* Change the current directory to PATH.  */
-int
-__chdir (path)
-     const char *path;
-{
-  if (path == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (chdir)
-
-weak_alias (__chdir, chdir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/check_fds.c b/sysdeps/generic/check_fds.c
deleted file mode 100644
index 5ae3feee3e..0000000000
--- a/sysdeps/generic/check_fds.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-
-/* Try to get a machine dependent instruction which will make the
-   program crash.  This is used in case everything else fails.  */
-#include <abort-instr.h>
-#ifndef ABORT_INSTRUCTION
-/* No such instruction is available.  */
-# define ABORT_INSTRUCTION
-#endif
-
-#include <device-nrs.h>
-#include <not-cancel.h>
-
-
-/* Should other OSes (e.g., Hurd) have different versions which can
-   be written in a better way?  */
-static void
-check_one_fd (int fd, int mode)
-{
-  /* Note that fcntl() with this parameter is not a cancellation point.  */
-  if (__builtin_expect (__libc_fcntl (fd, F_GETFD), 0) == -1
-      && errno == EBADF)
-    {
-      struct stat64 st;
-
-      /* Something is wrong with this descriptor, it's probably not
-	 opened.  Open /dev/null so that the SUID program we are
-	 about to start does not accidently use this descriptor.  */
-      int nullfd = open_not_cancel (_PATH_DEVNULL, mode, 0);
-      /* We are very paranoid here.  With all means we try to ensure
-	 that we are actually opening the /dev/null device and nothing
-	 else.
-
-	 Note that the following code assumes that STDIN_FILENO,
-	 STDOUT_FILENO, STDERR_FILENO are the three lowest file
-	 decsriptor numbers, in this order.  */
-      if (__builtin_expect (nullfd != fd, 0)
-	  || __builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) != 0
-	  || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
-#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
-	  || st.st_rdev != makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)
-#endif
-	  )
-	/* We cannot even give an error message here since it would
-	   run into the same problems.  */
-	while (1)
-	  /* Try for ever and ever.  */
-	  ABORT_INSTRUCTION;
-    }
-}
-
-
-void
-__libc_check_standard_fds (void)
-{
-  /* This is really paranoid but some people actually are.  If /dev/null
-     should happen to be a symlink to somewhere else and not the device
-     commonly known as "/dev/null" we bail out.  We can detect this with
-     the O_NOFOLLOW flag for open() but only on some system.  */
-#ifndef O_NOFOLLOW
-# define O_NOFOLLOW	0
-#endif
-  /* Check all three standard file descriptors.  */
-  check_one_fd (STDIN_FILENO, O_RDONLY | O_NOFOLLOW);
-  check_one_fd (STDOUT_FILENO, O_RDWR | O_NOFOLLOW);
-  check_one_fd (STDERR_FILENO, O_RDWR | O_NOFOLLOW);
-}
diff --git a/sysdeps/generic/check_pf.c b/sysdeps/generic/check_pf.c
deleted file mode 100644
index 5d98c98aff..0000000000
--- a/sysdeps/generic/check_pf.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Determine protocol families for which interfaces exist.  Generic version.
-   Copyright (C) 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <ifaddrs.h>
-#include <netdb.h>
-
-
-void
-attribute_hidden
-__check_pf (bool *seen_ipv4, bool *seen_ipv6)
-{
-  /* Get the interface list via getifaddrs.  */
-  struct ifaddrs *ifa = NULL;
-  if (getifaddrs (&ifa) != 0)
-    {
-      /* We cannot determine what interfaces are available.  Be
-	 pessimistic.  */
-      *seen_ipv4 = true;
-      *seen_ipv6 = true;
-      return;
-    }
-
-  *seen_ipv4 = false;
-  *seen_ipv6 = false;
-
-  struct ifaddrs *runp;
-  for (runp = ifa; runp != NULL; runp = runp->ifa_next)
-    if (runp->ifa_addr->sa_family == PF_INET)
-      *seen_ipv4 = true;
-    else if (runp->ifa_addr->sa_family == PF_INET6)
-      *seen_ipv6 = true;
-
-  (void) freeifaddrs (ifa);
-}
diff --git a/sysdeps/generic/chflags.c b/sysdeps/generic/chflags.c
deleted file mode 100644
index b678121265..0000000000
--- a/sysdeps/generic/chflags.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-
-/* Change the flags of FILE to FLAGS.  */
-
-int chflags (const char *file, int flags) __THROW;
-
-int
-chflags (file, flags)
-     const char *file;
-     int flags;
-{
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (chflags)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/chmod.c b/sysdeps/generic/chmod.c
deleted file mode 100644
index 38b05127c9..0000000000
--- a/sysdeps/generic/chmod.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-/* Change the protections of FILE to MODE.  */
-int
-__chmod (file, mode)
-     const char *file;
-     mode_t mode;
-{
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (chmod)
-
-weak_alias (__chmod, chmod)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/chown.c b/sysdeps/generic/chown.c
deleted file mode 100644
index 0e368f2ac4..0000000000
--- a/sysdeps/generic/chown.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 2002
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Change the owner and group of FILE.  */
-int
-__chown (file, owner, group)
-     const char *file;
-     uid_t owner;
-     gid_t group;
-{
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__chown)
-stub_warning (chown)
-
-weak_alias (__chown, chown)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/chroot.c b/sysdeps/generic/chroot.c
deleted file mode 100644
index f20ccf4c2b..0000000000
--- a/sysdeps/generic/chroot.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Make PATH be the root directory (the starting point for absolute paths).
-   This call is restricted to the super-user.  */
-int
-chroot (path)
-     const char *path;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (chroot)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/cimagf.c b/sysdeps/generic/cimagf.c
deleted file mode 100644
index d4e441e69f..0000000000
--- a/sysdeps/generic/cimagf.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Return imaginary part of complex float value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-
-float
-__cimagf (float _Complex z)
-{
-  return __imag__ z;
-}
-weak_alias (__cimagf, cimagf)
diff --git a/sysdeps/generic/clock.c b/sysdeps/generic/clock.c
deleted file mode 100644
index 99dc5f47e0..0000000000
--- a/sysdeps/generic/clock.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/times.h>
-#include <time.h>
-#include <errno.h>
-
-/* Return the time used by the program so far (user time + system time).  */
-clock_t
-clock ()
-{
-  __set_errno (ENOSYS);
-  return (clock_t) -1;
-}
-
-stub_warning (clock)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_getcpuclockid.c b/sysdeps/generic/clock_getcpuclockid.c
deleted file mode 100644
index 39c7e55f66..0000000000
--- a/sysdeps/generic/clock_getcpuclockid.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-#include <unistd.h>
-
-int
-clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
-{
-  /* We don't allow any process ID but our own.  */
-  if (pid != 0 && pid != getpid ())
-    return EPERM;
-
-#ifdef CLOCK_PROCESS_CPUTIME_ID
-  /* Store the number.  */
-  *clock_id = CLOCK_PROCESS_CPUTIME_ID;
-
-  return 0;
-#else
-  /* We don't have a timer for that.  */
-  return ENOENT;
-#endif
-}
diff --git a/sysdeps/generic/clock_getres.c b/sysdeps/generic/clock_getres.c
deleted file mode 100644
index f5978da380..0000000000
--- a/sysdeps/generic/clock_getres.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Get resolution of clock.  */
-int
-clock_getres (clockid_t clock_id, struct timespec *res)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (clock_getres)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_gettime.c b/sysdeps/generic/clock_gettime.c
deleted file mode 100644
index 85bb79c548..0000000000
--- a/sysdeps/generic/clock_gettime.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Get current value of CLOCK and store it in TP.  */
-int
-clock_gettime (clockid_t clock_id, struct timespec *tp)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (clock_gettime)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_nanosleep.c b/sysdeps/generic/clock_nanosleep.c
deleted file mode 100644
index cff1c2570a..0000000000
--- a/sysdeps/generic/clock_nanosleep.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* High-resolution sleep with the specified clock.  Stub version.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/time.h>
-
-
-int
-clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
-		 struct timespec *rem)
-{
-  if (__builtin_expect (req->tv_nsec, 0) < 0
-      || __builtin_expect (req->tv_nsec, 0) >= 1000000000)
-    return EINVAL;
-
-  if (flags != TIMER_ABSTIME && flags != 0)
-    return EINVAL;
-
-  /* Not implemented.  */
-  return ENOSYS;
-}
-stub_warning (clock_nanosleep)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/clock_settime.c b/sysdeps/generic/clock_settime.c
deleted file mode 100644
index 9d6a92e058..0000000000
--- a/sysdeps/generic/clock_settime.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Set CLOCK to value TP.  */
-int
-clock_settime (clockid_t clock_id, const struct timespec *tp)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (clock_settime)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/close.c b/sysdeps/generic/close.c
deleted file mode 100644
index 0856ba851b..0000000000
--- a/sysdeps/generic/close.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Close the file descriptor FD.  */
-int
-__close (fd)
-     int fd;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__close)
-stub_warning (close)
-
-weak_alias (__close, close)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/closedir.c b/sysdeps/generic/closedir.c
deleted file mode 100644
index 4410f02fb3..0000000000
--- a/sysdeps/generic/closedir.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-
-/* Close the directory stream DIRP.
-   Return 0 if successful, -1 if not.  */
-int
-__closedir (DIR *dirp)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__closedir, closedir)
-
-stub_warning (closedir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/cmp.c b/sysdeps/generic/cmp.c
deleted file mode 100644
index 8e9792f54e..0000000000
--- a/sysdeps/generic/cmp.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* mpn_cmp -- Compare two low-level natural-number integers.
-
-Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-/* Compare OP1_PTR/OP1_SIZE with OP2_PTR/OP2_SIZE.
-   There are no restrictions on the relative sizes of
-   the two arguments.
-   Return 1 if OP1 > OP2, 0 if they are equal, and -1 if OP1 < OP2.  */
-
-int
-#if __STDC__
-mpn_cmp (mp_srcptr op1_ptr, mp_srcptr op2_ptr, mp_size_t size)
-#else
-mpn_cmp (op1_ptr, op2_ptr, size)
-     mp_srcptr op1_ptr;
-     mp_srcptr op2_ptr;
-     mp_size_t size;
-#endif
-{
-  mp_size_t i;
-  mp_limb_t op1_word, op2_word;
-
-  for (i = size - 1; i >= 0; i--)
-    {
-      op1_word = op1_ptr[i];
-      op2_word = op2_ptr[i];
-      if (op1_word != op2_word)
-	goto diff;
-    }
-  return 0;
- diff:
-  /* This can *not* be simplified to
-	op2_word - op2_word
-     since that expression might give signed overflow.  */
-  return (op1_word > op2_word) ? 1 : -1;
-}
diff --git a/sysdeps/generic/configure b/sysdeps/generic/configure
deleted file mode 100755
index 47f9ec0d5e..0000000000
--- a/sysdeps/generic/configure
+++ /dev/null
@@ -1,108 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
-
-if test -z "$inhibit_glue"; then
-# For signame.c, used in make_siglist.
-
-
-for ac_func in psignal
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-fi
diff --git a/sysdeps/generic/configure.in b/sysdeps/generic/configure.in
deleted file mode 100644
index 393bc307e8..0000000000
--- a/sysdeps/generic/configure.in
+++ /dev/null
@@ -1,6 +0,0 @@
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-
-if test -z "$inhibit_glue"; then
-# For signame.c, used in make_siglist.
-AC_CHECK_FUNCS(psignal)
-fi
diff --git a/sysdeps/generic/conjf.c b/sysdeps/generic/conjf.c
deleted file mode 100644
index 7893891933..0000000000
--- a/sysdeps/generic/conjf.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Return complex conjugate of complex float value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-
-float _Complex
-__conjf (float _Complex z)
-{
-  return ~z;
-}
-weak_alias (__conjf, conjf)
diff --git a/sysdeps/generic/connect.c b/sysdeps/generic/connect.c
deleted file mode 100644
index 55093313c9..0000000000
--- a/sysdeps/generic/connect.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
-   For connectionless socket types, just set the default address to send to
-   and the only address from which to accept transmissions.
-   Return 0 on success, -1 for errors.  */
-int
-__connect (fd, addr, len)
-     int fd;
-     __CONST_SOCKADDR_ARG addr;
-     socklen_t len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__connect, connect)
-
-stub_warning (connect)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/console.c b/sysdeps/generic/console.c
deleted file mode 100644
index 326ebed4a1..0000000000
--- a/sysdeps/generic/console.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
-     On-Line Applications Research Corporation.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <standalone.h>
-
-/* This file is only required when a "bare" board is configured. */
-
-/* These routines provide console IO routines for your embedded target.  */
-
-int
-_Console_Putc (ch)
-     char ch;
-{
-  /* eat the character */
-
-  return 0;
-}
-
-int
-_Console_Getc (poll)
-     int poll;
-{
-  /* boring user, never types anything */
-  return -1;
-}
diff --git a/sysdeps/generic/crealf.c b/sysdeps/generic/crealf.c
deleted file mode 100644
index e3235a874f..0000000000
--- a/sysdeps/generic/crealf.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Return real part of complex float value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-
-float
-__crealf (float _Complex z)
-{
-  return __real__ z;
-}
-weak_alias (__crealf, crealf)
diff --git a/sysdeps/generic/creat.c b/sysdeps/generic/creat.c
deleted file mode 100644
index 462882415c..0000000000
--- a/sysdeps/generic/creat.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sysdep-cancel.h>
-
-#undef	creat
-
-/* Create FILE with protections MODE.  */
-int
-__libc_creat (file, mode)
-     const char *file;
-     mode_t mode;
-{
-  return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
-}
-weak_alias (__libc_creat, creat)
-
-/* __open handles cancellation.  */
-LIBC_CANCEL_HANDLED ();
diff --git a/sysdeps/generic/creat64.c b/sysdeps/generic/creat64.c
deleted file mode 100644
index 39f4580571..0000000000
--- a/sysdeps/generic/creat64.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fcntl.h>
-#include <sys/types.h>
-
-#undef	creat
-
-/* Create FILE with protections MODE.  */
-int
-creat64 (file, mode)
-     const char *file;
-     mode_t mode;
-{
-  return __open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
-}
diff --git a/sysdeps/generic/ctermid.c b/sysdeps/generic/ctermid.c
deleted file mode 100644
index e4d94eada2..0000000000
--- a/sysdeps/generic/ctermid.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stdio.h>
-
-
-/* Return the name of the controlling terminal.
-   If S is not NULL, the name is copied into it (it should be at
-   least L_ctermid bytes long), otherwise a static buffer is used.  */
-char *
-ctermid (s)
-     char *s;
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-
-
-stub_warning (ctermid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/cuserid.c b/sysdeps/generic/cuserid.c
deleted file mode 100644
index 826972f4de..0000000000
--- a/sysdeps/generic/cuserid.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-#include <errno.h>
-
-/* Return the username of the caller.
-   If S is not NULL, it points to a buffer of at least L_cuserid bytes
-   into which the name is copied; otherwise, a static buffer is used.  */
-char *
-cuserid (s)
-     char *s;
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-
-
-stub_warning (cuserid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/dbl2mpn.c b/sysdeps/generic/dbl2mpn.c
deleted file mode 100644
index 773ca4fd6a..0000000000
--- a/sysdeps/generic/dbl2mpn.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1993, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-/* Convert a `double' to a multi-precision integer representing the
-   significand scaled up by the highest possible number of significant bits
-   of fraction (DBL_MANT_DIG), and an integral power of two (MPN frexp). */
-
-mp_size_t
-__mpn_extract_double (mp_ptr res_ptr, mp_size_t size,
-		      int *expt, int *is_neg,
-		      double value)
-{
-#error "__mpn_extract_double is not implemented for this floating point format"
-}
diff --git a/sysdeps/generic/det_endian.c b/sysdeps/generic/det_endian.c
deleted file mode 100644
index 4c86be3a85..0000000000
--- a/sysdeps/generic/det_endian.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Determine the "endianness" of the CPU.
-   Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-
-main ()
-{
-  unsigned long int i;
-
-  if (sizeof (i) != 4)
-    puts ("#error \"Not a 32-bit machine!\"");
-
-  i = (((((('4' << 8) + '3') << 8) + '2') << 8) + '1');
-
-  printf ("#define __BYTE_ORDER %.4s\n", (char *) &i);
-
-  exit (0);
-}
diff --git a/sysdeps/generic/dirfd.c b/sysdeps/generic/dirfd.c
deleted file mode 100644
index 06c0cde435..0000000000
--- a/sysdeps/generic/dirfd.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Return the file descriptor used by a DIR stream.  Stub version.
-   Copyright (C) 1995, 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <dirent.h>
-#include <dirstream.h>
-#include <errno.h>
-
-int
-dirfd (dirp)
-     DIR *dirp;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (dirfd)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/div.c b/sysdeps/generic/div.c
deleted file mode 100644
index 5268f4c494..0000000000
--- a/sysdeps/generic/div.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 1992, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * Copyright (c) 1990 Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-
-/* Return the `div_t' representation of NUMER over DENOM.  */
-div_t
-div (numer, denom)
-     int numer, denom;
-{
-  div_t result;
-
-  result.quot = numer / denom;
-  result.rem = numer % denom;
-
-  /* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
-     NUMER / DENOM is to be computed in infinite precision.  In
-     other words, we should always truncate the quotient towards
-     zero, never -infinity.  Machine division and remainer may
-     work either way when one or both of NUMER or DENOM is
-     negative.  If only one is negative and QUOT has been
-     truncated towards -infinity, REM will have the same sign as
-     DENOM and the opposite sign of NUMER; if both are negative
-     and QUOT has been truncated towards -infinity, REM will be
-     positive (will have the opposite sign of NUMER).  These are
-     considered `wrong'.  If both are NUM and DENOM are positive,
-     RESULT will always be positive.  This all boils down to: if
-     NUMER >= 0, but REM < 0, we got the wrong answer.  In that
-     case, to get the right answer, add 1 to QUOT and subtract
-     DENOM from REM.  */
-
-  if (numer >= 0 && result.rem < 0)
-    {
-      ++result.quot;
-      result.rem -= denom;
-    }
-
-  return result;
-}
diff --git a/sysdeps/generic/divmod_1.c b/sysdeps/generic/divmod_1.c
deleted file mode 100644
index 50b97db72f..0000000000
--- a/sysdeps/generic/divmod_1.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* mpn_divmod_1(quot_ptr, dividend_ptr, dividend_size, divisor_limb) --
-   Divide (DIVIDEND_PTR,,DIVIDEND_SIZE) by DIVISOR_LIMB.
-   Write DIVIDEND_SIZE limbs of quotient at QUOT_PTR.
-   Return the single-limb remainder.
-   There are no constraints on the value of the divisor.
-
-   QUOT_PTR and DIVIDEND_PTR might point to the same limb.
-
-Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-#ifndef UMUL_TIME
-#define UMUL_TIME 1
-#endif
-
-#ifndef UDIV_TIME
-#define UDIV_TIME UMUL_TIME
-#endif
-
-/* FIXME: We should be using invert_limb (or invert_normalized_limb)
-   here (not udiv_qrnnd).  */
-
-mp_limb_t
-#if __STDC__
-mpn_divmod_1 (mp_ptr quot_ptr,
-	      mp_srcptr dividend_ptr, mp_size_t dividend_size,
-	      mp_limb_t divisor_limb)
-#else
-mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
-     mp_ptr quot_ptr;
-     mp_srcptr dividend_ptr;
-     mp_size_t dividend_size;
-     mp_limb_t divisor_limb;
-#endif
-{
-  mp_size_t i;
-  mp_limb_t n1, n0, r;
-  int dummy;
-
-  /* ??? Should this be handled at all?  Rely on callers?  */
-  if (dividend_size == 0)
-    return 0;
-
-  /* If multiplication is much faster than division, and the
-     dividend is large, pre-invert the divisor, and use
-     only multiplications in the inner loop.  */
-
-  /* This test should be read:
-       Does it ever help to use udiv_qrnnd_preinv?
-	 && Does what we save compensate for the inversion overhead?  */
-  if (UDIV_TIME > (2 * UMUL_TIME + 6)
-      && (UDIV_TIME - (2 * UMUL_TIME + 6)) * dividend_size > UDIV_TIME)
-    {
-      int normalization_steps;
-
-      count_leading_zeros (normalization_steps, divisor_limb);
-      if (normalization_steps != 0)
-	{
-	  mp_limb_t divisor_limb_inverted;
-
-	  divisor_limb <<= normalization_steps;
-
-	  /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB.  The
-	     result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
-	     most significant bit (with weight 2**N) implicit.  */
-
-	  /* Special case for DIVISOR_LIMB == 100...000.  */
-	  if (divisor_limb << 1 == 0)
-	    divisor_limb_inverted = ~(mp_limb_t) 0;
-	  else
-	    udiv_qrnnd (divisor_limb_inverted, dummy,
-			-divisor_limb, 0, divisor_limb);
-
-	  n1 = dividend_ptr[dividend_size - 1];
-	  r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
-
-	  /* Possible optimization:
-	     if (r == 0
-	     && divisor_limb > ((n1 << normalization_steps)
-			     | (dividend_ptr[dividend_size - 2] >> ...)))
-	     ...one division less... */
-
-	  for (i = dividend_size - 2; i >= 0; i--)
-	    {
-	      n0 = dividend_ptr[i];
-	      udiv_qrnnd_preinv (quot_ptr[i + 1], r, r,
-				 ((n1 << normalization_steps)
-				  | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
-				 divisor_limb, divisor_limb_inverted);
-	      n1 = n0;
-	    }
-	  udiv_qrnnd_preinv (quot_ptr[0], r, r,
-			     n1 << normalization_steps,
-			     divisor_limb, divisor_limb_inverted);
-	  return r >> normalization_steps;
-	}
-      else
-	{
-	  mp_limb_t divisor_limb_inverted;
-
-	  /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB.  The
-	     result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
-	     most significant bit (with weight 2**N) implicit.  */
-
-	  /* Special case for DIVISOR_LIMB == 100...000.  */
-	  if (divisor_limb << 1 == 0)
-	    divisor_limb_inverted = ~(mp_limb_t) 0;
-	  else
-	    udiv_qrnnd (divisor_limb_inverted, dummy,
-			-divisor_limb, 0, divisor_limb);
-
-	  i = dividend_size - 1;
-	  r = dividend_ptr[i];
-
-	  if (r >= divisor_limb)
-	    r = 0;
-	  else
-	    {
-	      quot_ptr[i] = 0;
-	      i--;
-	    }
-
-	  for (; i >= 0; i--)
-	    {
-	      n0 = dividend_ptr[i];
-	      udiv_qrnnd_preinv (quot_ptr[i], r, r,
-				 n0, divisor_limb, divisor_limb_inverted);
-	    }
-	  return r;
-	}
-    }
-  else
-    {
-      if (UDIV_NEEDS_NORMALIZATION)
-	{
-	  int normalization_steps;
-
-	  count_leading_zeros (normalization_steps, divisor_limb);
-	  if (normalization_steps != 0)
-	    {
-	      divisor_limb <<= normalization_steps;
-
-	      n1 = dividend_ptr[dividend_size - 1];
-	      r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
-
-	      /* Possible optimization:
-		 if (r == 0
-		 && divisor_limb > ((n1 << normalization_steps)
-				 | (dividend_ptr[dividend_size - 2] >> ...)))
-		 ...one division less... */
-
-	      for (i = dividend_size - 2; i >= 0; i--)
-		{
-		  n0 = dividend_ptr[i];
-		  udiv_qrnnd (quot_ptr[i + 1], r, r,
-			      ((n1 << normalization_steps)
-			       | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
-			      divisor_limb);
-		  n1 = n0;
-		}
-	      udiv_qrnnd (quot_ptr[0], r, r,
-			  n1 << normalization_steps,
-			  divisor_limb);
-	      return r >> normalization_steps;
-	    }
-	}
-      /* No normalization needed, either because udiv_qrnnd doesn't require
-	 it, or because DIVISOR_LIMB is already normalized.  */
-
-      i = dividend_size - 1;
-      r = dividend_ptr[i];
-
-      if (r >= divisor_limb)
-	r = 0;
-      else
-	{
-	  quot_ptr[i] = 0;
-	  i--;
-	}
-
-      for (; i >= 0; i--)
-	{
-	  n0 = dividend_ptr[i];
-	  udiv_qrnnd (quot_ptr[i], r, r, n0, divisor_limb);
-	}
-      return r;
-    }
-}
diff --git a/sysdeps/generic/divrem.c b/sysdeps/generic/divrem.c
deleted file mode 100644
index 609f3d789c..0000000000
--- a/sysdeps/generic/divrem.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* mpn_divrem -- Divide natural numbers, producing both remainder and
-   quotient.
-
-Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-/* Divide num (NP/NSIZE) by den (DP/DSIZE) and write
-   the NSIZE-DSIZE least significant quotient limbs at QP
-   and the DSIZE long remainder at NP.  If QEXTRA_LIMBS is
-   non-zero, generate that many fraction bits and append them after the
-   other quotient limbs.
-   Return the most significant limb of the quotient, this is always 0 or 1.
-
-   Preconditions:
-   0. NSIZE >= DSIZE.
-   1. The most significant bit of the divisor must be set.
-   2. QP must either not overlap with the input operands at all, or
-      QP + DSIZE >= NP must hold true.  (This means that it's
-      possible to put the quotient in the high part of NUM, right after the
-      remainder in NUM.
-   3. NSIZE >= DSIZE, even if QEXTRA_LIMBS is non-zero.  */
-
-mp_limb_t
-#if __STDC__
-mpn_divrem (mp_ptr qp, mp_size_t qextra_limbs,
-	    mp_ptr np, mp_size_t nsize,
-	    mp_srcptr dp, mp_size_t dsize)
-#else
-mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
-     mp_ptr qp;
-     mp_size_t qextra_limbs;
-     mp_ptr np;
-     mp_size_t nsize;
-     mp_srcptr dp;
-     mp_size_t dsize;
-#endif
-{
-  mp_limb_t most_significant_q_limb = 0;
-
-  switch (dsize)
-    {
-    case 0:
-      /* We are asked to divide by zero, so go ahead and do it!  (To make
-	 the compiler not remove this statement, return the value.)  */
-      return 1 / dsize;
-
-    case 1:
-      {
-	mp_size_t i;
-	mp_limb_t n1;
-	mp_limb_t d;
-
-	d = dp[0];
-	n1 = np[nsize - 1];
-
-	if (n1 >= d)
-	  {
-	    n1 -= d;
-	    most_significant_q_limb = 1;
-	  }
-
-	qp += qextra_limbs;
-	for (i = nsize - 2; i >= 0; i--)
-	  udiv_qrnnd (qp[i], n1, n1, np[i], d);
-	qp -= qextra_limbs;
-
-	for (i = qextra_limbs - 1; i >= 0; i--)
-	  udiv_qrnnd (qp[i], n1, n1, 0, d);
-
-	np[0] = n1;
-      }
-      break;
-
-    case 2:
-      {
-	mp_size_t i;
-	mp_limb_t n1, n0, n2;
-	mp_limb_t d1, d0;
-
-	np += nsize - 2;
-	d1 = dp[1];
-	d0 = dp[0];
-	n1 = np[1];
-	n0 = np[0];
-
-	if (n1 >= d1 && (n1 > d1 || n0 >= d0))
-	  {
-	    sub_ddmmss (n1, n0, n1, n0, d1, d0);
-	    most_significant_q_limb = 1;
-	  }
-
-	for (i = qextra_limbs + nsize - 2 - 1; i >= 0; i--)
-	  {
-	    mp_limb_t q;
-	    mp_limb_t r;
-
-	    if (i >= qextra_limbs)
-	      np--;
-	    else
-	      np[0] = 0;
-
-	    if (n1 == d1)
-	      {
-		/* Q should be either 111..111 or 111..110.  Need special
-		   treatment of this rare case as normal division would
-		   give overflow.  */
-		q = ~(mp_limb_t) 0;
-
-		r = n0 + d1;
-		if (r < d1)	/* Carry in the addition? */
-		  {
-		    add_ssaaaa (n1, n0, r - d0, np[0], 0, d0);
-		    qp[i] = q;
-		    continue;
-		  }
-		n1 = d0 - (d0 != 0);
-		n0 = -d0;
-	      }
-	    else
-	      {
-		udiv_qrnnd (q, r, n1, n0, d1);
-		umul_ppmm (n1, n0, d0, q);
-	      }
-
-	    n2 = np[0];
-	  q_test:
-	    if (n1 > r || (n1 == r && n0 > n2))
-	      {
-		/* The estimated Q was too large.  */
-		q--;
-
-		sub_ddmmss (n1, n0, n1, n0, 0, d0);
-		r += d1;
-		if (r >= d1)	/* If not carry, test Q again.  */
-		  goto q_test;
-	      }
-
-	    qp[i] = q;
-	    sub_ddmmss (n1, n0, r, n2, n1, n0);
-	  }
-	np[1] = n1;
-	np[0] = n0;
-      }
-      break;
-
-    default:
-      {
-	mp_size_t i;
-	mp_limb_t dX, d1, n0;
-
-	np += nsize - dsize;
-	dX = dp[dsize - 1];
-	d1 = dp[dsize - 2];
-	n0 = np[dsize - 1];
-
-	if (n0 >= dX)
-	  {
-	    if (n0 > dX || mpn_cmp (np, dp, dsize - 1) >= 0)
-	      {
-		mpn_sub_n (np, np, dp, dsize);
-		n0 = np[dsize - 1];
-		most_significant_q_limb = 1;
-	      }
-	  }
-
-	for (i = qextra_limbs + nsize - dsize - 1; i >= 0; i--)
-	  {
-	    mp_limb_t q;
-	    mp_limb_t n1, n2;
-	    mp_limb_t cy_limb;
-
-	    if (i >= qextra_limbs)
-	      {
-		np--;
-		n2 = np[dsize];
-	      }
-	    else
-	      {
-		n2 = np[dsize - 1];
-		MPN_COPY_DECR (np + 1, np, dsize);
-		np[0] = 0;
-	      }
-
-	    if (n0 == dX)
-	      /* This might over-estimate q, but it's probably not worth
-		 the extra code here to find out.  */
-	      q = ~(mp_limb_t) 0;
-	    else
-	      {
-		mp_limb_t r;
-
-		udiv_qrnnd (q, r, n0, np[dsize - 1], dX);
-		umul_ppmm (n1, n0, d1, q);
-
-		while (n1 > r || (n1 == r && n0 > np[dsize - 2]))
-		  {
-		    q--;
-		    r += dX;
-		    if (r < dX)	/* I.e. "carry in previous addition?"  */
-		      break;
-		    n1 -= n0 < d1;
-		    n0 -= d1;
-		  }
-	      }
-
-	    /* Possible optimization: We already have (q * n0) and (1 * n1)
-	       after the calculation of q.  Taking advantage of that, we
-	       could make this loop make two iterations less.  */
-
-	    cy_limb = mpn_submul_1 (np, dp, dsize, q);
-
-	    if (n2 != cy_limb)
-	      {
-		mpn_add_n (np, np, dp, dsize);
-		q--;
-	      }
-
-	    qp[i] = q;
-	    n0 = np[dsize - 1];
-	  }
-      }
-    }
-
-  return most_significant_q_limb;
-}
diff --git a/sysdeps/generic/dl-brk.c b/sysdeps/generic/dl-brk.c
deleted file mode 100644
index c37cdfec33..0000000000
--- a/sysdeps/generic/dl-brk.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* We can use the normal code but we also know the __curbrk is not exported
-   from ld.so.  */
-extern void *__curbrk attribute_hidden;
-
-#include <brk.c>
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c
deleted file mode 100644
index 29886e194a..0000000000
--- a/sysdeps/generic/dl-cache.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
-   Copyright (C) 1996-2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <assert.h>
-#include <unistd.h>
-#include <ldsodefs.h>
-#include <sys/mman.h>
-#include <dl-cache.h>
-#include <dl-procinfo.h>
-
-#include <stdio-common/_itoa.h>
-
-#ifndef _DL_PLATFORMS_COUNT
-# define _DL_PLATFORMS_COUNT 0
-#endif
-
-/* This is the starting address and the size of the mmap()ed file.  */
-static struct cache_file *cache;
-static struct cache_file_new *cache_new;
-static size_t cachesize;
-
-/* 1 if cache_data + PTR points into the cache.  */
-#define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size)
-
-#define SEARCH_CACHE(cache) \
-/* We use binary search since the table is sorted in the cache file.	      \
-   The first matching entry in the table is returned.			      \
-   It is important to use the same algorithm as used while generating	      \
-   the cache file.  */							      \
-do									      \
-  {									      \
-    left = 0;								      \
-    right = cache->nlibs - 1;						      \
-									      \
-    while (left <= right)						      \
-      {									      \
-	__typeof__ (cache->libs[0].key) key;				      \
-									      \
-	middle = (left + right) / 2;					      \
-									      \
-	key = cache->libs[middle].key;					      \
-									      \
-	/* Make sure string table indices are not bogus before using	      \
-	   them.  */							      \
-	if (! _dl_cache_verify_ptr (key))				      \
-	  {								      \
-	    cmpres = 1;							      \
-	    break;							      \
-	  }								      \
-									      \
-	/* Actually compare the entry with the key.  */			      \
-	cmpres = _dl_cache_libcmp (name, cache_data + key);		      \
-	if (__builtin_expect (cmpres == 0, 0))				      \
-	  {								      \
-	    /* Found it.  LEFT now marks the last entry for which we	      \
-	       know the name is correct.  */				      \
-	    left = middle;						      \
-									      \
-	    /* There might be entries with this name before the one we	      \
-	       found.  So we have to find the beginning.  */		      \
-	    while (middle > 0)						      \
-	      {								      \
-		__typeof__ (cache->libs[0].key) key;			      \
-									      \
-		key = cache->libs[middle - 1].key;			      \
-		/* Make sure string table indices are not bogus before	      \
-		   using them.  */					      \
-		if (! _dl_cache_verify_ptr (key)			      \
-		    /* Actually compare the entry.  */			      \
-		    || _dl_cache_libcmp (name, cache_data + key) != 0)	      \
-		  break;						      \
-		--middle;						      \
-	      }								      \
-									      \
-	    do								      \
-	      {								      \
-		int flags;						      \
-		__typeof__ (cache->libs[0]) *lib = &cache->libs[middle];      \
-									      \
-		/* Only perform the name test if necessary.  */		      \
-		if (middle > left					      \
-		    /* We haven't seen this string so far.  Test whether the  \
-		       index is ok and whether the name matches.  Otherwise   \
-		       we are done.  */					      \
-		    && (! _dl_cache_verify_ptr (lib->key)		      \
-			|| (_dl_cache_libcmp (name, cache_data + lib->key)    \
-			    != 0)))					      \
-		  break;						      \
-									      \
-		flags = lib->flags;					      \
-		if (_dl_cache_check_flags (flags)			      \
-		    && _dl_cache_verify_ptr (lib->value))		      \
-		  {							      \
-		    if (best == NULL || flags == GLRO(dl_correct_cache_id))   \
-		      {							      \
-			HWCAP_CHECK;					      \
-			best = cache_data + lib->value;			      \
-									      \
-			if (flags == GLRO(dl_correct_cache_id))		      \
-			  /* We've found an exact match for the shared	      \
-			     object and no general `ELF' release.  Stop	      \
-			     searching.  */				      \
-			  break;					      \
-		      }							      \
-		  }							      \
-	      }								      \
-	    while (++middle <= right);					      \
-	    break;							      \
-	}								      \
-									      \
-	if (cmpres < 0)							      \
-	  left = middle + 1;						      \
-	else								      \
-	  right = middle - 1;						      \
-      }									      \
-  }									      \
-while (0)
-
-
-int
-internal_function
-_dl_cache_libcmp (const char *p1, const char *p2)
-{
-  while (*p1 != '\0')
-    {
-      if (*p1 >= '0' && *p1 <= '9')
-        {
-          if (*p2 >= '0' && *p2 <= '9')
-            {
-	      /* Must compare this numerically.  */
-	      int val1;
-	      int val2;
-
-	      val1 = *p1++ - '0';
-	      val2 = *p2++ - '0';
-	      while (*p1 >= '0' && *p1 <= '9')
-	        val1 = val1 * 10 + *p1++ - '0';
-	      while (*p2 >= '0' && *p2 <= '9')
-	        val2 = val2 * 10 + *p2++ - '0';
-	      if (val1 != val2)
-		return val1 - val2;
-	    }
-	  else
-            return 1;
-        }
-      else if (*p2 >= '0' && *p2 <= '9')
-        return -1;
-      else if (*p1 != *p2)
-        return *p1 - *p2;
-      else
-	{
-	  ++p1;
-	  ++p2;
-	}
-    }
-  return *p1 - *p2;
-}
-
-
-/* Look up NAME in ld.so.cache and return the file name stored there,
-   or null if none is found.  */
-
-const char *
-internal_function
-_dl_load_cache_lookup (const char *name)
-{
-  int left, right, middle;
-  int cmpres;
-  const char *cache_data;
-  uint32_t cache_data_size;
-  const char *best;
-
-  /* Print a message if the loading of libs is traced.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
-    _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
-
-  if (cache == NULL)
-    {
-      /* Read the contents of the file.  */
-      void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize,
-					       PROT_READ);
-
-      /* We can handle three different cache file formats here:
-	 - the old libc5/glibc2.0/2.1 format
-	 - the old format with the new format in it
-	 - only the new format
-	 The following checks if the cache contains any of these formats.  */
-      if (file != MAP_FAILED && cachesize > sizeof *cache
-	  && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0)
-	{
-	  size_t offset;
-	  /* Looks ok.  */
-	  cache = file;
-
-	  /* Check for new version.  */
-	  offset = ALIGN_CACHE (sizeof (struct cache_file)
-				+ cache->nlibs * sizeof (struct file_entry));
-
-	  cache_new = (struct cache_file_new *) ((void *) cache + offset);
-	  if (cachesize < (offset + sizeof (struct cache_file_new))
-	      || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW,
-			 sizeof CACHEMAGIC_VERSION_NEW - 1) != 0)
-	    cache_new = (void *) -1;
-	}
-      else if (file != MAP_FAILED && cachesize > sizeof *cache_new
-	       && memcmp (file, CACHEMAGIC_VERSION_NEW,
-			  sizeof CACHEMAGIC_VERSION_NEW - 1) == 0)
-	{
-	  cache_new = file;
-	  cache = file;
-	}
-      else
-	{
-	  if (file != MAP_FAILED)
-	    __munmap (file, cachesize);
-	  cache = (void *) -1;
-	}
-
-      assert (cache != NULL);
-    }
-
-  if (cache == (void *) -1)
-    /* Previously looked for the cache file and didn't find it.  */
-    return NULL;
-
-  best = NULL;
-
-  if (cache_new != (void *) -1)
-    {
-      uint64_t platform;
-
-      /* This is where the strings start.  */
-      cache_data = (const char *) cache_new;
-
-      /* Now we can compute how large the string table is.  */
-      cache_data_size = (const char *) cache + cachesize - cache_data;
-
-      platform = _dl_string_platform (GLRO(dl_platform));
-      if (platform != (uint64_t) -1)
-	platform = 1ULL << platform;
-
-      /* Only accept hwcap if it's for the right platform.  */
-#ifdef USE_TLS
-# define _DL_HWCAP_TLS_MASK (1LL << 63)
-#else
-# define _DL_HWCAP_TLS_MASK 0
-#endif
-#define HWCAP_CHECK \
-      if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion))	      \
-	continue;							      \
-      if (_DL_PLATFORMS_COUNT && platform != -1				      \
-	  && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0			      \
-	  && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform)		      \
-	continue;							      \
-      if (lib->hwcap							      \
-	  & ~(GLRO(dl_hwcap) | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK))      \
-	continue
-      SEARCH_CACHE (cache_new);
-    }
-  else
-    {
-      /* This is where the strings start.  */
-      cache_data = (const char *) &cache->libs[cache->nlibs];
-
-      /* Now we can compute how large the string table is.  */
-      cache_data_size = (const char *) cache + cachesize - cache_data;
-
-#undef HWCAP_CHECK
-#define HWCAP_CHECK do {} while (0)
-      SEARCH_CACHE (cache);
-    }
-
-  /* Print our result if wanted.  */
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
-      && best != NULL)
-    _dl_debug_printf ("  trying file=%s\n", best);
-
-  return best;
-}
-
-#ifndef MAP_COPY
-/* If the system does not support MAP_COPY we cannot leave the file open
-   all the time since this would create problems when the file is replaced.
-   Therefore we provide this function to close the file and open it again
-   once needed.  */
-void
-_dl_unload_cache (void)
-{
-  if (cache != NULL && cache != (struct cache_file *) -1)
-    {
-      __munmap (cache, cachesize);
-      cache = NULL;
-    }
-}
-#endif
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index c2b72874cf..7cc02d993b 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -36,6 +36,14 @@
 # define add_system_dir(dir) add_dir (dir)
 #endif
 
+#ifndef arch_startup
+# define arch_startup(argc, argv) do { } while (0)
+#endif
+
+#ifndef add_arch_dirs
+# define add_arch_dirs(config_file) do { } while (0)
+#endif
+
 #define CACHEMAGIC "ld.so-1.7.0"
 
 /* libc5 and glibc 2.0/2.1 use the same format.  For glibc 2.2 another
diff --git a/sysdeps/generic/dl-environ.c b/sysdeps/generic/dl-environ.c
deleted file mode 100644
index 089e89e6e7..0000000000
--- a/sysdeps/generic/dl-environ.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Environment handling for dynamic loader.
-   Copyright (C) 1995-1998, 2000, 2001, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <ldsodefs.h>
-
-/* Walk through the environment of the process and return all entries
-   starting with `LD_'.  */
-char *
-internal_function
-_dl_next_ld_env_entry (char ***position)
-{
-  char **current = *position;
-  char *result = NULL;
-
-  while (*current != NULL)
-    {
-      if (__builtin_expect ((*current)[0] == 'L', 0)
-	  && (*current)[1] == 'D' && (*current)[2] == '_')
-	{
-	  result = &(*current)[3];
-
-	  /* Save current position for next visit.  */
-	  *position = ++current;
-
-	  break;
-	}
-
-      ++current;
-    }
-
-  return result;
-}
-
-
-/* In ld.so __environ is not exported.  */
-extern char **__environ attribute_hidden;
-
-int
-unsetenv (const char *name)
-{
-  char **ep;
-
-  ep = __environ;
-  while (*ep != NULL)
-    {
-      size_t cnt = 0;
-
-      while ((*ep)[cnt] == name[cnt] && name[cnt] != '\0')
-	++cnt;
-
-      if (name[cnt] == '\0' && (*ep)[cnt] == '=')
-	{
-	  /* Found it.  Remove this pointer by moving later ones to
-	     the front.  */
-	  char **dp = ep;
-
-	  do
-	    dp[0] = dp[1];
-	  while (*dp++);
-	  /* Continue the loop in case NAME appears again.  */
-	}
-      else
-	++ep;
-    }
-
-  return 0;
-}
diff --git a/sysdeps/generic/dl-execstack.c b/sysdeps/generic/dl-execstack.c
deleted file mode 100644
index 6dce21e7a1..0000000000
--- a/sysdeps/generic/dl-execstack.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Stack executability handling for GNU dynamic linker.  Stub version.
-   Copyright (C) 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <ldsodefs.h>
-#include <errno.h>
-
-/* There is no portable way to know the bounds of the initial thread's stack
-   so as to mprotect it.  */
-
-int
-internal_function
-_dl_make_stack_executable (void **stack_endp)
-{
-  return ENOSYS;
-}
-rtld_hidden_def (_dl_make_stack_executable)
diff --git a/sysdeps/generic/dl-fptr.c b/sysdeps/generic/dl-fptr.c
deleted file mode 100644
index 78beecfdcb..0000000000
--- a/sysdeps/generic/dl-fptr.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* Manage function descriptors.  Generic version.
-   Copyright (C) 1999,2000,2001,2002,2003,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <libintl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/mman.h>
-#include <link.h>
-#include <ldsodefs.h>
-#include <elf/dynamic-link.h>
-#include <dl-fptr.h>
-#include <atomic.h>
-
-#ifndef ELF_MACHINE_BOOT_FPTR_TABLE_LEN
-/* ELF_MACHINE_BOOT_FPTR_TABLE_LEN should be greater than the number of
-   dynamic symbols in ld.so.  */
-# define ELF_MACHINE_BOOT_FPTR_TABLE_LEN 256
-#endif
-
-#ifndef ELF_MACHINE_LOAD_ADDRESS
-# error "ELF_MACHINE_LOAD_ADDRESS is not defined."
-#endif
-
-#ifndef COMPARE_AND_SWAP
-# define COMPARE_AND_SWAP(ptr, old, new) \
-  (atomic_compare_and_exchange_bool_acq (ptr, new, old) == 0)
-#endif
-
-ElfW(Addr) _dl_boot_fptr_table [ELF_MACHINE_BOOT_FPTR_TABLE_LEN];
-
-static struct local
-  {
-    struct fdesc_table *root;
-    struct fdesc *free_list;
-    unsigned int npages;		/* # of pages to allocate */
-    /* the next to members MUST be consecutive! */
-    struct fdesc_table boot_table;
-    struct fdesc boot_fdescs[1024];
-  }
-local =
-  {
-    .root = &local.boot_table,
-    .npages = 2,
-    .boot_table =
-      {
-	.len = sizeof (local.boot_fdescs) / sizeof (local.boot_fdescs[0]),
-	.first_unused = 0
-      }
-  };
-
-/* Create a new fdesc table and return a pointer to the first fdesc
-   entry.  The fdesc lock must have been acquired already.  */
-
-static struct fdesc_table *
-new_fdesc_table (struct local *l, size_t *size)
-{
-  size_t old_npages = l->npages;
-  size_t new_npages = old_npages + old_npages;
-  struct fdesc_table *new_table;
-
-  /* If someone has just created a new table, we return NULL to tell
-     the caller to use the new table.  */
-  if (! COMPARE_AND_SWAP (&l->npages, old_npages, new_npages))
-    return (struct fdesc_table *) NULL;
-
-  *size = old_npages * GLRO(dl_pagesize);
-  new_table = __mmap (NULL, *size,
-		      PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
-  if (new_table == MAP_FAILED)
-    _dl_signal_error (errno, NULL, NULL,
-		      N_("cannot map pages for fdesc table"));
-
-  new_table->len
-    = (*size - sizeof (*new_table)) / sizeof (struct fdesc);
-  new_table->first_unused = 1;
-  return new_table;
-}
-
-
-static ElfW(Addr)
-make_fdesc (ElfW(Addr) ip, ElfW(Addr) gp)
-{
-  struct fdesc *fdesc = NULL;
-  struct fdesc_table *root;
-  unsigned int old;
-  struct local *l;
-
-  ELF_MACHINE_LOAD_ADDRESS (l, local);
-
- retry:
-  root = l->root;
-  while (1)
-    {
-      old = root->first_unused;
-      if (old >= root->len)
-	break;
-      else if (COMPARE_AND_SWAP (&root->first_unused, old, old + 1))
-	{
-	  fdesc = &root->fdesc[old];
-	  goto install;
-	}
-    }
-
-  if (l->free_list)
-    {
-      /* Get it from free-list.  */
-      do
-	{
-	  fdesc = l->free_list;
-	  if (fdesc == NULL)
-	    goto retry;
-	}
-      while (! COMPARE_AND_SWAP ((ElfW(Addr) *) &l->free_list,
-				 (ElfW(Addr)) fdesc, fdesc->ip));
-    }
-  else
-    {
-      /* Create a new fdesc table.  */
-      size_t size;
-      struct fdesc_table *new_table = new_fdesc_table (l, &size);
-
-      if (new_table == NULL)
-	goto retry;
-
-      new_table->next = root;
-      if (! COMPARE_AND_SWAP ((ElfW(Addr) *) &l->root,
-			      (ElfW(Addr)) root,
-			      (ElfW(Addr)) new_table))
-	{
-	  /* Someone has just installed a new table. Return NULL to
-	     tell the caller to use the new table.  */
-	  __munmap (new_table, size);
-	  goto retry;
-	}
-
-      /* Note that the first entry was reserved while allocating the
-	 memory for the new page.  */
-      fdesc = &new_table->fdesc[0];
-    }
-
- install:
-  fdesc->ip = ip;
-  fdesc->gp = gp;
-
-  return (ElfW(Addr)) fdesc;
-}
-
-
-static inline ElfW(Addr) * __attribute__ ((always_inline))
-make_fptr_table (struct link_map *map)
-{
-  const ElfW(Sym) *symtab
-    = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
-  const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-  ElfW(Addr) *fptr_table;
-  size_t size;
-  size_t len;
-
-  /* XXX Apparently the only way to find out the size of the dynamic
-     symbol section is to assume that the string table follows right
-     afterwards...  */
-  len = ((strtab - (char *) symtab)
-	 / map->l_info[DT_SYMENT]->d_un.d_val);
-  size = ((len * sizeof (fptr_table[0]) + GLRO(dl_pagesize) - 1)
-	  & -GLRO(dl_pagesize));
-  /* XXX We don't support here in the moment systems without MAP_ANON.
-     There probably are none for IA-64.  In case this is proven wrong
-     we will have to open /dev/null here and use the file descriptor
-     instead of the hard-coded -1.  */
-  fptr_table = __mmap (NULL, size,
-		       PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE,
-		       -1, 0);
-  if (fptr_table == MAP_FAILED)
-    _dl_signal_error (errno, NULL, NULL,
-		      N_("cannot map pages for fptr table"));
-
-  if (COMPARE_AND_SWAP ((ElfW(Addr) *) &map->l_mach.fptr_table,
-			(ElfW(Addr)) NULL, (ElfW(Addr)) fptr_table))
-    map->l_mach.fptr_table_len = len;
-  else
-    __munmap (fptr_table, len * sizeof (fptr_table[0]));
-
-  return map->l_mach.fptr_table;
-}
-
-
-ElfW(Addr)
-_dl_make_fptr (struct link_map *map, const ElfW(Sym) *sym,
-	       ElfW(Addr) ip)
-{
-  ElfW(Addr) *ftab = map->l_mach.fptr_table;
-  const ElfW(Sym) *symtab;
-  Elf_Symndx symidx;
-  struct local *l;
-
-  if (__builtin_expect (ftab == NULL, 0))
-    ftab = make_fptr_table (map);
-
-  symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
-  symidx = sym - symtab;
-
-  if (symidx >= map->l_mach.fptr_table_len)
-    _dl_signal_error (0, NULL, NULL,
-		      N_("internal error: symidx out of range of fptr table"));
-
-  while (ftab[symidx] == 0)
-    {
-      /* GOT has already been relocated in elf_get_dynamic_info -
-	 don't try to relocate it again.  */
-      ElfW(Addr) fdesc
-	= make_fdesc (ip, map->l_info[DT_PLTGOT]->d_un.d_ptr);
-
-      if (__builtin_expect (COMPARE_AND_SWAP (&ftab[symidx], (ElfW(Addr)) NULL,
-					      fdesc), 1))
-	{
-	  /* Noone has updated the entry and the new function
-	     descriptor has been installed.  */
-#if 0
-	  const char *strtab
-	    = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-
-	  ELF_MACHINE_LOAD_ADDRESS (l, local);
-	  if (l->root != &l->boot_table
-	      || l->boot_table.first_unused > 20)
-	    _dl_debug_printf ("created fdesc symbol `%s' at %lx\n",
-			      strtab + sym->st_name, ftab[symidx]);
-#endif
-	  break;
-	}
-      else
-	{
-	  /* We created a duplicated function descriptor. We put it on
-	     free-list.  */
-	  struct fdesc *f = (struct fdesc *) fdesc;
-
-	  ELF_MACHINE_LOAD_ADDRESS (l, local);
-
-	  do
-	    f->ip = (ElfW(Addr)) l->free_list;
-	  while (! COMPARE_AND_SWAP ((ElfW(Addr) *) &l->free_list,
-				     f->ip, fdesc));
-	}
-    }
-
-  return ftab[symidx];
-}
-
-
-void
-_dl_unmap (struct link_map *map)
-{
-  ElfW(Addr) *ftab = map->l_mach.fptr_table;
-  struct fdesc *head = NULL, *tail = NULL;
-  size_t i;
-
-  __munmap ((void *) map->l_map_start,
-	    map->l_map_end - map->l_map_start);
-
-  if (ftab == NULL)
-    return;
-
-  /* String together the fdesc structures that are being freed.  */
-  for (i = 0; i < map->l_mach.fptr_table_len; ++i)
-    {
-      if (ftab[i])
-	{
-	  *(struct fdesc **) ftab[i] = head;
-	  head = (struct fdesc *) ftab[i];
-	  if (tail == NULL)
-	    tail = head;
-	}
-    }
-
-  /* Prepend the new list to the free_list: */
-  if (tail)
-    do
-      tail->ip = (ElfW(Addr)) local.free_list;
-    while (! COMPARE_AND_SWAP ((ElfW(Addr) *) &local.free_list,
-			       tail->ip, (ElfW(Addr)) head));
-
-  __munmap (ftab, (map->l_mach.fptr_table_len
-		   * sizeof (map->l_mach.fptr_table[0])));
-
-  map->l_mach.fptr_table = NULL;
-}
-
-
-ElfW(Addr)
-_dl_lookup_address (const void *address)
-{
-  ElfW(Addr) addr = (ElfW(Addr)) address;
-  struct fdesc_table *t;
-  unsigned long int i;
-
-  for (t = local.root; t != NULL; t = t->next)
-    {
-      i = (struct fdesc *) addr - &t->fdesc[0];
-      if (i < t->first_unused && addr == (ElfW(Addr)) &t->fdesc[i])
-	{
-	  addr = t->fdesc[i].ip;
-	  break;
-	}
-    }
-
-  return addr;
-}
diff --git a/sysdeps/generic/dl-fptr.h b/sysdeps/generic/dl-fptr.h
index 8156981e6e..d47fb7b635 100644
--- a/sysdeps/generic/dl-fptr.h
+++ b/sysdeps/generic/dl-fptr.h
@@ -36,6 +36,8 @@ struct fdesc_table
     struct fdesc fdesc[0];
   };
 
+struct link_map;
+
 extern ElfW(Addr) _dl_boot_fptr_table [];
 
 extern ElfW(Addr) _dl_make_fptr (struct link_map *, const ElfW(Sym) *,
diff --git a/sysdeps/generic/dl-hash.h b/sysdeps/generic/dl-hash.h
index a84bf2416d..243ae14b51 100644
--- a/sysdeps/generic/dl-hash.h
+++ b/sysdeps/generic/dl-hash.h
@@ -1,5 +1,5 @@
 /* Compute hash value for given string according to ELF standard.
-   Copyright (C) 1995, 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995,1996,1997,1998,2003,2005 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
@@ -25,8 +25,9 @@
    first five operations no overflow is possible so we optimized it a
    bit.  */
 static unsigned int
-_dl_elf_hash (const unsigned char *name)
+_dl_elf_hash (const char *name_arg)
 {
+  const unsigned char *name = (const unsigned char *) name_arg;
   unsigned long int hash = 0;
   if (*name != '\0')
     {
diff --git a/sysdeps/generic/dl-lookupcfg.h b/sysdeps/generic/dl-lookupcfg.h
index f48cb0a844..2b29989600 100644
--- a/sysdeps/generic/dl-lookupcfg.h
+++ b/sysdeps/generic/dl-lookupcfg.h
@@ -1,5 +1,5 @@
 /* Configuration of lookup functions.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004 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
@@ -17,16 +17,13 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* Some platforms need more information from the symbol lookup function
-   than just the address.  But this is not generally the case.
-
-   However, because of how _dl_sym and _dl_tls_symaddr are written, every
-   platform needs it when we support TLS.  */
-
-#include <tls.h>		/* Defines USE_TLS (or doesn't).  */
-
-#ifdef USE_TLS
-# define DL_LOOKUP_RETURNS_MAP
-#else
-# undef DL_LOOKUP_RETURNS_MAP
-#endif
+/* The type of the return value of fixup/profile_fixup.  */
+#define DL_FIXUP_VALUE_TYPE ElfW(Addr)
+/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address
+   and a link map.  */
+#define DL_FIXUP_MAKE_VALUE(map, addr) (addr)
+/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.
+ */
+#define DL_FIXUP_VALUE_CODE_ADDR(value) (value)
+#define DL_FIXUP_VALUE_ADDR(value) (value)
+#define DL_FIXUP_ADDR_VALUE(addr) (addr)
diff --git a/sysdeps/generic/dl-machine.h b/sysdeps/generic/dl-machine.h
index 8b4425cea4..c3459f5e32 100644
--- a/sysdeps/generic/dl-machine.h
+++ b/sysdeps/generic/dl-machine.h
@@ -1,5 +1,6 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  Stub version.
-   Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2005
+   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
@@ -64,7 +65,8 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t,
    LOADADDR is the load address of the object; INFO is an array indexed
    by DT_* of the .dynamic section info.  */
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
 		 const Elf32_Rel *reloc, const Elf32_Sym *sym,
 		 Elf32_Addr (*resolve) (const Elf32_Sym **ref,
@@ -87,7 +89,8 @@ elf_machine_rel (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
 }
 
 
-static inline Elf32_Addr
+auto inline Elf32_Addr
+__attribute__ ((always_inline))
 elf_machine_rela (Elf32_Addr loadaddr, Elf32_Dyn *info[DT_NUM],
 		  const Elf32_Rel *reloc, const Elf32_Sym *sym,
 		  Elf32_Addr (*resolve) (const Elf32_Sym **ref,
diff --git a/sysdeps/generic/dl-origin.c b/sysdeps/generic/dl-origin.c
deleted file mode 100644
index 87619379bc..0000000000
--- a/sysdeps/generic/dl-origin.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Find path of executable.
-   Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <ldsodefs.h>
-
-#include <dl-dst.h>
-
-
-const char *
-_dl_get_origin (void)
-{
-  char *result = (char *) -1;
-  /* We use the environment variable LD_ORIGIN_PATH.  If it is set make
-     a copy and strip out trailing slashes.  */
-  if (GLRO(dl_origin_path) != NULL)
-    {
-      size_t len = strlen (GLRO(dl_origin_path));
-      result = (char *) malloc (len + 1);
-      if (result == NULL)
-	result = (char *) -1;
-      else
-	{
-	  char *cp = __mempcpy (result, GLRO(dl_origin_path), len);
-	  while (cp > result + 1 && cp[-1] == '/')
-	    --cp;
-	  *cp = '\0';
-	}
-    }
-
-  return result;
-}
diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h
index b8e40d5a76..60b84a900d 100644
--- a/sysdeps/generic/dl-osinfo.h
+++ b/sysdeps/generic/dl-osinfo.h
@@ -1 +1,12 @@
-/* Nothing needed in general.  */
+#include <stdint.h>
+
+static inline uintptr_t __attribute__ ((always_inline))
+_dl_setup_stack_chk_guard (void)
+{
+  uintptr_t ret = 0;
+  unsigned char *p = (unsigned char *) &ret;
+  p[sizeof (ret) - 1] = 255;
+  p[sizeof (ret) - 2] = '\n';
+  p[0] = 0;
+  return ret;
+}
diff --git a/sysdeps/generic/dl-sbrk.c b/sysdeps/generic/dl-sbrk.c
deleted file mode 100644
index 4713a92694..0000000000
--- a/sysdeps/generic/dl-sbrk.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/* We can use the normal code but we also know the __curbrk is not exported
-   from ld.so.  */
-extern void *__curbrk attribute_hidden;
-
-#include <sbrk.c>
diff --git a/sysdeps/generic/dl-symaddr.c b/sysdeps/generic/dl-symaddr.c
deleted file mode 100644
index 3c850ca835..0000000000
--- a/sysdeps/generic/dl-symaddr.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Get the symbol address.  Generic version.
-   Copyright (C) 1999, 2000, 2001, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <ldsodefs.h>
-#include <dl-fptr.h>
-
-void *
-_dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
-{
-  ElfW(Addr) value = (map ? map->l_addr : 0) + ref->st_value;
-
-  /* Return the pointer to function descriptor. */
-  if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC)
-    return (void *) _dl_make_fptr (map, ref, value);
-  else
-    return (void *) value;
-}
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
deleted file mode 100644
index 34498a880c..0000000000
--- a/sysdeps/generic/dl-sysdep.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/* Operating system support for run-time dynamic linker.  Generic Unix version.
-   Copyright (C) 1995-1998, 2000-2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <assert.h>
-#include <elf.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <libintl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <ldsodefs.h>
-#include <stdio-common/_itoa.h>
-#include <fpu_control.h>
-
-#include <entry.h>
-#include <dl-machine.h>
-#include <dl-procinfo.h>
-#include <dl-osinfo.h>
-#include <hp-timing.h>
-#include <tls.h>
-
-extern char **_environ attribute_hidden;
-extern void _end attribute_hidden;
-
-/* Protect SUID program against misuse of file descriptors.  */
-extern void __libc_check_standard_fds (void);
-
-#ifdef NEED_DL_BASE_ADDR
-ElfW(Addr) _dl_base_addr;
-#endif
-int __libc_enable_secure attribute_relro = 0;
-INTVARDEF(__libc_enable_secure)
-int __libc_multiple_libcs = 0;	/* Defining this here avoids the inclusion
-				   of init-first.  */
-/* This variable contains the lowest stack address ever used.  */
-void *__libc_stack_end attribute_relro = NULL;
-rtld_hidden_data_def(__libc_stack_end)
-static ElfW(auxv_t) *_dl_auxv attribute_relro;
-
-#ifndef DL_FIND_ARG_COMPONENTS
-# define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp)	\
-  do {									      \
-    void **_tmp;							      \
-    (argc) = *(long int *) cookie;					      \
-    (argv) = (char **) ((long int *) cookie + 1);			      \
-    (envp) = (argv) + (argc) + 1;					      \
-    for (_tmp = (void **) (envp); *_tmp; ++_tmp)			      \
-      continue;								      \
-    (auxp) = (void *) ++_tmp;						      \
-  } while (0)
-#endif
-
-#ifndef DL_STACK_END
-# define DL_STACK_END(cookie) ((void *) (cookie))
-#endif
-
-ElfW(Addr)
-_dl_sysdep_start (void **start_argptr,
-		  void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
-				   ElfW(Addr) *user_entry))
-{
-  const ElfW(Phdr) *phdr = NULL;
-  ElfW(Word) phnum = 0;
-  ElfW(Addr) user_entry;
-  ElfW(auxv_t) *av;
-#ifdef HAVE_AUX_SECURE
-# define set_seen(tag) (tag)	/* Evaluate for the side effects.  */
-# define set_seen_secure() ((void) 0)
-#else
-  uid_t uid = 0;
-  gid_t gid = 0;
-  unsigned int seen = 0;
-# define set_seen_secure() (seen = -1)
-# ifdef HAVE_AUX_XID
-#  define set_seen(tag) (tag)	/* Evaluate for the side effects.  */
-# else
-#  define M(type) (1 << (type))
-#  define set_seen(tag) seen |= M ((tag)->a_type)
-# endif
-#endif
-#ifdef NEED_DL_SYSINFO
-  uintptr_t new_sysinfo = 0;
-#endif
-
-  __libc_stack_end = DL_STACK_END (start_argptr);
-  DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, INTUSE(_dl_argv), _environ,
-			  _dl_auxv);
-
-  user_entry = (ElfW(Addr)) ENTRY_POINT;
-  GLRO(dl_platform) = NULL; /* Default to nothing known about the platform.  */
-
-  for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++))
-    switch (av->a_type)
-      {
-      case AT_PHDR:
-	phdr = av->a_un.a_ptr;
-	break;
-      case AT_PHNUM:
-	phnum = av->a_un.a_val;
-	break;
-      case AT_PAGESZ:
-	GLRO(dl_pagesize) = av->a_un.a_val;
-	break;
-      case AT_ENTRY:
-	user_entry = av->a_un.a_val;
-	break;
-#ifdef NEED_DL_BASE_ADDR
-      case AT_BASE:
-	_dl_base_addr = av->a_un.a_val;
-	break;
-#endif
-#ifndef HAVE_AUX_SECURE
-      case AT_UID:
-      case AT_EUID:
-	uid ^= av->a_un.a_val;
-	break;
-      case AT_GID:
-      case AT_EGID:
-	gid ^= av->a_un.a_val;
-	break;
-#endif
-      case AT_SECURE:
-#ifndef HAVE_AUX_SECURE
-	seen = -1;
-#endif
-	INTUSE(__libc_enable_secure) = av->a_un.a_val;
-	break;
-      case AT_PLATFORM:
-	GLRO(dl_platform) = av->a_un.a_ptr;
-	break;
-      case AT_HWCAP:
-	GLRO(dl_hwcap) = av->a_un.a_val;
-	break;
-      case AT_CLKTCK:
-	GLRO(dl_clktck) = av->a_un.a_val;
-	break;
-      case AT_FPUCW:
-	GLRO(dl_fpu_control) = av->a_un.a_val;
-	break;
-#ifdef NEED_DL_SYSINFO
-      case AT_SYSINFO:
-	new_sysinfo = av->a_un.a_val;
-	break;
-#endif
-#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
-      case AT_SYSINFO_EHDR:
-	GLRO(dl_sysinfo_dso) = av->a_un.a_ptr;
-	break;
-#endif
-#ifdef DL_PLATFORM_AUXV
-      DL_PLATFORM_AUXV
-#endif
-      }
-
-#ifdef DL_SYSDEP_OSCHECK
-  DL_SYSDEP_OSCHECK (dl_fatal);
-#endif
-
-#ifndef HAVE_AUX_SECURE
-  if (seen != -1)
-    {
-      /* Fill in the values we have not gotten from the kernel through the
-	 auxiliary vector.  */
-# ifndef HAVE_AUX_XID
-#  define SEE(UID, var, uid) \
-   if ((seen & M (AT_##UID)) == 0) var ^= __get##uid ()
-      SEE (UID, uid, uid);
-      SEE (EUID, uid, euid);
-      SEE (GID, gid, gid);
-      SEE (EGID, gid, egid);
-# endif
-
-      /* If one of the two pairs of IDs does not match this is a setuid
-	 or setgid run.  */
-      INTUSE(__libc_enable_secure) = uid | gid;
-    }
-#endif
-
-#ifndef HAVE_AUX_PAGESIZE
-  if (GLRO(dl_pagesize) == 0)
-    GLRO(dl_pagesize) = __getpagesize ();
-#endif
-
-#if defined NEED_DL_SYSINFO
-  /* Only set the sysinfo value if we also have the vsyscall DSO.  */
-  if (GLRO(dl_sysinfo_dso) != 0 && new_sysinfo)
-    GLRO(dl_sysinfo) = new_sysinfo;
-#endif
-
-#ifdef DL_SYSDEP_INIT
-  DL_SYSDEP_INIT;
-#endif
-
-#ifdef DL_PLATFORM_INIT
-  DL_PLATFORM_INIT;
-#endif
-
-  /* Determine the length of the platform name.  */
-  if (GLRO(dl_platform) != NULL)
-    GLRO(dl_platformlen) = strlen (GLRO(dl_platform));
-
-  if (__sbrk (0) == &_end)
-    /* The dynamic linker was run as a program, and so the initial break
-       starts just after our bss, at &_end.  The malloc in dl-minimal.c
-       will consume the rest of this page, so tell the kernel to move the
-       break up that far.  When the user program examines its break, it
-       will see this new value and not clobber our data.  */
-    __sbrk (GLRO(dl_pagesize)
-	    - ((&_end - (void *) 0) & (GLRO(dl_pagesize) - 1)));
-
-  /* If this is a SUID program we make sure that FDs 0, 1, and 2 are
-     allocated.  If necessary we are doing it ourself.  If it is not
-     possible we stop the program.  */
-  if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
-    __libc_check_standard_fds ();
-
-  (*dl_main) (phdr, phnum, &user_entry);
-  return user_entry;
-}
-
-void
-internal_function
-_dl_sysdep_start_cleanup (void)
-{
-}
-
-void
-internal_function
-_dl_show_auxv (void)
-{
-  char buf[64];
-  ElfW(auxv_t) *av;
-
-  /* Terminate string.  */
-  buf[63] = '\0';
-
-  /* The following code assumes that the AT_* values are encoded
-     starting from 0 with AT_NULL, 1 for AT_IGNORE, and all other values
-     close by (otherwise the array will be too large).  In case we have
-     to support a platform where these requirements are not fulfilled
-     some alternative implementation has to be used.  */
-  for (av = _dl_auxv; av->a_type != AT_NULL; ++av)
-    {
-      static const struct
-      {
-	const char label[20];
-	enum { unknown = 0, dec, hex, str, ignore } form;
-      } auxvars[] =
-	{
-	  [AT_EXECFD - 2] =		{ "AT_EXECFD:       ", dec },
-	  [AT_PHDR - 2] =		{ "AT_PHDR:         0x", hex },
-	  [AT_PHENT - 2] =		{ "AT_PHENT:        ", dec },
-	  [AT_PHNUM - 2] =		{ "AT_PHNUM:        ", dec },
-	  [AT_PAGESZ - 2] =		{ "AT_PAGESZ:       ", dec },
-	  [AT_BASE - 2] =		{ "AT_BASE:         0x", hex },
-	  [AT_FLAGS - 2] =		{ "AT_FLAGS:        0x", hex },
-	  [AT_ENTRY - 2] =		{ "AT_ENTRY:        0x", hex },
-	  [AT_NOTELF - 2] =		{ "AT_NOTELF:       ", hex },
-	  [AT_UID - 2] =		{ "AT_UID:          ", dec },
-	  [AT_EUID - 2] =		{ "AT_EUID:         ", dec },
-	  [AT_GID - 2] =		{ "AT_GID:          ", dec },
-	  [AT_EGID - 2] =		{ "AT_EGID:         ", dec },
-	  [AT_PLATFORM - 2] =		{ "AT_PLATFORM:     ", str },
-	  [AT_HWCAP - 2] =		{ "AT_HWCAP:        ", hex },
-	  [AT_CLKTCK - 2] =		{ "AT_CLKTCK:       ", dec },
-	  [AT_FPUCW - 2] =		{ "AT_FPUCW:        ", hex },
-	  [AT_DCACHEBSIZE - 2] =	{ "AT_DCACHEBSIZE:  0x", hex },
-	  [AT_ICACHEBSIZE - 2] =	{ "AT_ICACHEBSIZE:  0x", hex },
-	  [AT_UCACHEBSIZE - 2] =	{ "AT_UCACHEBSIZE:  0x", hex },
-	  [AT_IGNOREPPC - 2] =		{ "AT_IGNOREPPC", ignore },
-	  [AT_SECURE - 2] =		{ "AT_SECURE:       ", dec },
-	  [AT_SYSINFO - 2] =		{ "AT_SYSINFO:      0x", hex },
-	  [AT_SYSINFO_EHDR - 2] =	{ "AT_SYSINFO_EHDR: 0x", hex },
-	};
-      unsigned int idx = (unsigned int) (av->a_type - 2);
-
-      if ((unsigned int) av->a_type < 2u || auxvars[idx].form == ignore)
-	continue;
-
-      assert (AT_NULL == 0);
-      assert (AT_IGNORE == 1);
-
-      if (av->a_type == AT_HWCAP)
-	{
-	  /* This is handled special.  */
-	  if (_dl_procinfo (av->a_un.a_val) == 0)
-	    continue;
-	}
-
-      if (idx < sizeof (auxvars) / sizeof (auxvars[0])
-	  && auxvars[idx].form != unknown)
-	{
-	  const char *val = av->a_un.a_ptr;
-
-	  if (__builtin_expect (auxvars[idx].form, dec) == dec)
-	    val = _itoa ((unsigned long int) av->a_un.a_val,
-			 buf + sizeof buf - 1, 10, 0);
-	  else if (__builtin_expect (auxvars[idx].form, hex) == hex)
-	    val = _itoa ((unsigned long int) av->a_un.a_val,
-			 buf + sizeof buf - 1, 16, 0);
-
-	  _dl_printf ("%s%s\n", auxvars[idx].label, val);
-
-	  continue;
-	}
-
-      /* Unknown value: print a generic line.  */
-      char buf2[17];
-      buf[sizeof (buf2) - 1] = '\0';
-      const char *val2 = _itoa ((unsigned long int) av->a_un.a_val,
-				buf2 + sizeof buf2 - 1, 16, 0);
-      const char *val =  _itoa ((unsigned long int) av->a_type,
-				buf + sizeof buf - 1, 16, 0);
-      _dl_printf ("AT_??? (0x%s): 0x%s\n", val, val2);
-    }
-}
-
-
-/* Return an array of useful/necessary hardware capability names.  */
-const struct r_strlenpair *
-internal_function
-_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
-		      size_t *max_capstrlen)
-{
-  /* Determine how many important bits are set.  */
-  unsigned long int masked = GLRO(dl_hwcap) & GLRO(dl_hwcap_mask);
-  size_t cnt = platform != NULL;
-  size_t n, m;
-  size_t total;
-  struct r_strlenpair *temp;
-  struct r_strlenpair *result;
-  struct r_strlenpair *rp;
-  char *cp;
-
-  /* Count the number of bits set in the masked value.  */
-  for (n = 0; (~((1UL << n) - 1) & masked) != 0; ++n)
-    if ((masked & (1UL << n)) != 0)
-      ++cnt;
-
-#ifdef USE_TLS
-  /* For TLS enabled builds always add 'tls'.  */
-  ++cnt;
-#else
-  if (cnt == 0)
-    {
-      /* If we have platform name and no important capability we only have
-	 the base directory to search.  */
-      result = (struct r_strlenpair *) malloc (sizeof (*result));
-      if (result == NULL)
-	goto no_memory;
-
-      result[0].str = (char *) result;	/* Does not really matter.  */
-      result[0].len = 0;
-
-      *sz = 1;
-      return result;
-    }
-#endif
-
-  /* Create temporary data structure to generate result table.  */
-  temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
-  m = 0;
-  for (n = 0; masked != 0; ++n)
-    if ((masked & (1UL << n)) != 0)
-      {
-	temp[m].str = _dl_hwcap_string (n);
-	temp[m].len = strlen (temp[m].str);
-	masked ^= 1UL << n;
-	++m;
-      }
-  if (platform != NULL)
-    {
-      temp[m].str = platform;
-      temp[m].len = platform_len;
-      ++m;
-    }
-#ifdef USE_TLS
-  temp[m].str = "tls";
-  temp[m].len = 3;
-  ++m;
-#endif
-  assert (m == cnt);
-
-  /* Determine the total size of all strings together.  */
-  if (cnt == 1)
-    total = temp[0].len + 1;
-  else
-    {
-      total = (1UL << (cnt - 2)) * (temp[0].len + temp[cnt - 1].len + 2);
-      for (n = 1; n + 1 < cnt; ++n)
-	total += (1UL << (cnt - 3)) * (temp[n].len + 1);
-    }
-
-  /* The result structure: we use a very compressed way to store the
-     various combinations of capability names.  */
-  *sz = 1 << cnt;
-  result = (struct r_strlenpair *) malloc (*sz * sizeof (*result) + total);
-  if (result == NULL)
-    {
-#ifndef USE_TLS
-    no_memory:
-#endif
-      _dl_signal_error (ENOMEM, NULL, NULL,
-			N_("cannot create capability list"));
-    }
-
-  if (cnt == 1)
-    {
-      result[0].str = (char *) (result + *sz);
-      result[0].len = temp[0].len + 1;
-      result[1].str = (char *) (result + *sz);
-      result[1].len = 0;
-      cp = __mempcpy ((char *) (result + *sz), temp[0].str, temp[0].len);
-      *cp = '/';
-      *sz = 2;
-      *max_capstrlen = result[0].len;
-
-      return result;
-    }
-
-  /* Fill in the information.  This follows the following scheme
-     (indeces from TEMP for four strings):
-	entry #0: 0, 1, 2, 3	binary: 1111
-	      #1: 0, 1, 3	        1101
-	      #2: 0, 2, 3	        1011
-	      #3: 0, 3		        1001
-     This allows the representation of all possible combinations of
-     capability names in the string.  First generate the strings.  */
-  result[1].str = result[0].str = cp = (char *) (result + *sz);
-#define add(idx) \
-      cp = __mempcpy (__mempcpy (cp, temp[idx].str, temp[idx].len), "/", 1);
-  if (cnt == 2)
-    {
-      add (1);
-      add (0);
-    }
-  else
-    {
-      n = 1 << (cnt - 1);
-      do
-	{
-	  n -= 2;
-
-	  /* We always add the last string.  */
-	  add (cnt - 1);
-
-	  /* Add the strings which have the bit set in N.  */
-	  for (m = cnt - 2; m > 0; --m)
-	    if ((n & (1 << m)) != 0)
-	      add (m);
-
-	  /* Always add the first string.  */
-	  add (0);
-	}
-      while (n != 0);
-    }
-#undef add
-
-  /* Now we are ready to install the string pointers and length.  */
-  for (n = 0; n < (1UL << cnt); ++n)
-    result[n].len = 0;
-  n = cnt;
-  do
-    {
-      size_t mask = 1 << --n;
-
-      rp = result;
-      for (m = 1 << cnt; m > 0; ++rp)
-	if ((--m & mask) != 0)
-	  rp->len += temp[n].len + 1;
-    }
-  while (n != 0);
-
-  /* The first half of the strings all include the first string.  */
-  n = (1 << cnt) - 2;
-  rp = &result[2];
-  while (n != (1UL << (cnt - 1)))
-    {
-      if ((--n & 1) != 0)
-	rp[0].str = rp[-2].str + rp[-2].len;
-      else
-	rp[0].str = rp[-1].str;
-      ++rp;
-    }
-
-  /* The second have starts right after the first part of the string of
-     corresponding entry in the first half.  */
-  do
-    {
-      rp[0].str = rp[-(1 << (cnt - 1))].str + temp[cnt - 1].len + 1;
-      ++rp;
-    }
-  while (--n != 0);
-
-  /* The maximum string length.  */
-  *max_capstrlen = result[0].len;
-
-  return result;
-}
diff --git a/sysdeps/generic/dl-sysdep.h b/sysdeps/generic/dl-sysdep.h
index 565287027c..c99fd3ea36 100644
--- a/sysdeps/generic/dl-sysdep.h
+++ b/sysdeps/generic/dl-sysdep.h
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  Generic version.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2005 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
@@ -17,8 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifndef _DL_SYSDEP_H
-#define _DL_SYSDEP_H   1
+/* No multiple inclusion protection need here because it's just macros.
+   We don't want to use _DL_SYSDEP_H in case we are #include_next'd.  */
 
 /* This macro must be defined to either 0 or 1.
 
@@ -33,5 +33,3 @@
 #else
 # define RTLD_PRIVATE_ERRNO 0
 #endif
-
-#endif /* dl-sysdep.h */
diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c
deleted file mode 100644
index 3382e3493c..0000000000
--- a/sysdeps/generic/dl-tls.c
+++ /dev/null
@@ -1,713 +0,0 @@
-/* Thread-local storage handling in the ELF dynamic linker.  Generic version.
-   Copyright (C) 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <assert.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/param.h>
-
-#include <tls.h>
-
-/* We don't need any of this if TLS is not supported.  */
-#ifdef USE_TLS
-
-# include <dl-tls.h>
-# include <ldsodefs.h>
-
-/* Amount of excess space to allocate in the static TLS area
-   to allow dynamic loading of modules defining IE-model TLS data.  */
-# define TLS_STATIC_SURPLUS	64 + DL_NNS * 100
-
-/* Value used for dtv entries for which the allocation is delayed.  */
-# define TLS_DTV_UNALLOCATED	((void *) -1l)
-
-
-/* Out-of-memory handler.  */
-# ifdef SHARED
-static void
-__attribute__ ((__noreturn__))
-oom (void)
-{
-  _dl_fatal_printf ("cannot allocate memory for thread-local data: ABORT\n");
-}
-# endif
-
-
-
-size_t
-internal_function
-_dl_next_tls_modid (void)
-{
-  size_t result;
-
-  if (__builtin_expect (GL(dl_tls_dtv_gaps), false))
-    {
-      size_t disp = 0;
-      struct dtv_slotinfo_list *runp = GL(dl_tls_dtv_slotinfo_list);
-
-      /* Note that this branch will never be executed during program
-	 start since there are no gaps at that time.  Therefore it
-	 does not matter that the dl_tls_dtv_slotinfo is not allocated
-	 yet when the function is called for the first times.  */
-      result = GL(dl_tls_static_nelem) + 1;
-      /* If the following would not be true we mustn't have assumed
-	 there is a gap.  */
-      assert (result <= GL(dl_tls_max_dtv_idx));
-      do
-	{
-	  while (result - disp < runp->len)
-	    {
-	      if (runp->slotinfo[result - disp].map == NULL)
-		break;
-
-	      ++result;
-	      assert (result <= GL(dl_tls_max_dtv_idx) + 1);
-	    }
-
-	  if (result - disp < runp->len)
-	    break;
-
-	  disp += runp->len;
-	}
-      while ((runp = runp->next) != NULL);
-
-      if (result >= GL(dl_tls_max_dtv_idx))
-	{
-	  /* The new index must indeed be exactly one higher than the
-	     previous high.  */
-	  assert (result == GL(dl_tls_max_dtv_idx));
-
-	  /* There is no gap anymore.  */
-	  GL(dl_tls_dtv_gaps) = false;
-
-	  goto nogaps;
-	}
-    }
-  else
-    {
-      /* No gaps, allocate a new entry.  */
-    nogaps:
-      result = ++GL(dl_tls_max_dtv_idx);
-    }
-
-  return result;
-}
-
-# ifdef SHARED
-
-void
-internal_function
-_dl_determine_tlsoffset (void)
-{
-  struct dtv_slotinfo *slotinfo;
-  size_t max_align = TLS_TCB_ALIGN;
-  size_t offset, freetop = 0, freebottom = 0;
-  size_t cnt;
-
-  /* The first element of the dtv slot info list is allocated.  */
-  assert (GL(dl_tls_dtv_slotinfo_list) != NULL);
-  /* There is at this point only one element in the
-     dl_tls_dtv_slotinfo_list list.  */
-  assert (GL(dl_tls_dtv_slotinfo_list)->next == NULL);
-
-  slotinfo = GL(dl_tls_dtv_slotinfo_list)->slotinfo;
-
-  /* Determining the offset of the various parts of the static TLS
-     block has several dependencies.  In addition we have to work
-     around bugs in some toolchains.
-
-     Each TLS block from the objects available at link time has a size
-     and an alignment requirement.  The GNU ld computes the alignment
-     requirements for the data at the positions *in the file*, though.
-     I.e, it is not simply possible to allocate a block with the size
-     of the TLS program header entry.  The data is layed out assuming
-     that the first byte of the TLS block fulfills
-
-       p_vaddr mod p_align == &TLS_BLOCK mod p_align
-
-     This means we have to add artificial padding at the beginning of
-     the TLS block.  These bytes are never used for the TLS data in
-     this module but the first byte allocated must be aligned
-     according to mod p_align == 0 so that the first byte of the TLS
-     block is aligned according to p_vaddr mod p_align.  This is ugly
-     and the linker can help by computing the offsets in the TLS block
-     assuming the first byte of the TLS block is aligned according to
-     p_align.
-
-     The extra space which might be allocated before the first byte of
-     the TLS block need not go unused.  The code below tries to use
-     that memory for the next TLS block.  This can work if the total
-     memory requirement for the next TLS block is smaller than the
-     gap.  */
-
-# if TLS_TCB_AT_TP
-  /* We simply start with zero.  */
-  offset = 0;
-
-  for (cnt = 1; slotinfo[cnt].map != NULL; ++cnt)
-    {
-      assert (cnt < GL(dl_tls_dtv_slotinfo_list)->len);
-
-      size_t firstbyte = (-slotinfo[cnt].map->l_tls_firstbyte_offset
-			  & (slotinfo[cnt].map->l_tls_align - 1));
-      size_t off;
-      max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
-
-      if (freebottom - freetop >= slotinfo[cnt].map->l_tls_blocksize)
-	{
-	  off = roundup (freetop + slotinfo[cnt].map->l_tls_blocksize
-			 - firstbyte, slotinfo[cnt].map->l_tls_align)
-		+ firstbyte;
-	  if (off <= freebottom)
-	    {
-	      freetop = off;
-
-	      /* XXX For some architectures we perhaps should store the
-		 negative offset.  */
-	      slotinfo[cnt].map->l_tls_offset = off;
-	      continue;
-	    }
-	}
-
-      off = roundup (offset + slotinfo[cnt].map->l_tls_blocksize - firstbyte,
-		     slotinfo[cnt].map->l_tls_align) + firstbyte;
-      if (off > offset + slotinfo[cnt].map->l_tls_blocksize
-		+ (freebottom - freetop))
-	{
-	  freetop = offset;
-	  freebottom = off - slotinfo[cnt].map->l_tls_blocksize;
-	}
-      offset = off;
-
-      /* XXX For some architectures we perhaps should store the
-	 negative offset.  */
-      slotinfo[cnt].map->l_tls_offset = off;
-    }
-
-  GL(dl_tls_static_used) = offset;
-  GL(dl_tls_static_size) = (roundup (offset + TLS_STATIC_SURPLUS, max_align)
-			    + TLS_TCB_SIZE);
-# elif TLS_DTV_AT_TP
-  /* The TLS blocks start right after the TCB.  */
-  offset = TLS_TCB_SIZE;
-
-  for (cnt = 1; slotinfo[cnt].map != NULL; ++cnt)
-    {
-      assert (cnt < GL(dl_tls_dtv_slotinfo_list)->len);
-
-      size_t firstbyte = (-slotinfo[cnt].map->l_tls_firstbyte_offset
-			  & (slotinfo[cnt].map->l_tls_align - 1));
-      size_t off;
-      max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
-
-      if (slotinfo[cnt].map->l_tls_blocksize <= freetop - freebottom)
-	{
-	  off = roundup (freebottom, slotinfo[cnt].map->l_tls_align);
-	  if (off - freebottom < firstbyte)
-	    off += slotinfo[cnt].map->l_tls_align;
-	  if (off + slotinfo[cnt].map->l_tls_blocksize - firstbyte <= freetop)
-	    {
-	      slotinfo[cnt].map->l_tls_offset = off - firstbyte;
-	      freebottom = off + slotinfo[cnt].map->l_tls_blocksize
-			   - firstbyte;
-	      continue;
-	    }
-	}
-
-      off = roundup (offset, slotinfo[cnt].map->l_tls_align);
-      if (off - offset < firstbyte)
-	off += slotinfo[cnt].map->l_tls_align;
-
-      slotinfo[cnt].map->l_tls_offset = off - firstbyte;
-      if (off - firstbyte - offset > freetop - freebottom)
-	{
-	  freebottom = offset;
-	  freetop = off - firstbyte;
-	}
-
-      offset = off + slotinfo[cnt].map->l_tls_blocksize - firstbyte;
-    }
-
-  GL(dl_tls_static_used) = offset;
-  GL(dl_tls_static_size) = roundup (offset + TLS_STATIC_SURPLUS,
-				    TLS_TCB_ALIGN);
-# else
-#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
-
-  /* The alignment requirement for the static TLS block.  */
-  GL(dl_tls_static_align) = max_align;
-}
-
-
-/* This is called only when the data structure setup was skipped at startup,
-   when there was no need for it then.  Now we have dynamically loaded
-   something needing TLS, or libpthread needs it.  */
-int
-internal_function
-_dl_tls_setup (void)
-{
-  assert (GL(dl_tls_dtv_slotinfo_list) == NULL);
-  assert (GL(dl_tls_max_dtv_idx) == 0);
-
-  const size_t nelem = 2 + TLS_SLOTINFO_SURPLUS;
-
-  GL(dl_tls_dtv_slotinfo_list)
-    = calloc (1, (sizeof (struct dtv_slotinfo_list)
-		  + nelem * sizeof (struct dtv_slotinfo)));
-  if (GL(dl_tls_dtv_slotinfo_list) == NULL)
-    return -1;
-
-  GL(dl_tls_dtv_slotinfo_list)->len = nelem;
-
-  /* Number of elements in the static TLS block.  It can't be zero
-     because of various assumptions.  The one element is null.  */
-  GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx) = 1;
-
-  /* This initializes more variables for us.  */
-  _dl_determine_tlsoffset ();
-
-  return 0;
-}
-rtld_hidden_def (_dl_tls_setup)
-# endif
-
-static void *
-internal_function
-allocate_dtv (void *result)
-{
-  dtv_t *dtv;
-  size_t dtv_length;
-
-  /* We allocate a few more elements in the dtv than are needed for the
-     initial set of modules.  This should avoid in most cases expansions
-     of the dtv.  */
-  dtv_length = GL(dl_tls_max_dtv_idx) + DTV_SURPLUS;
-  dtv = calloc (dtv_length + 2, sizeof (dtv_t));
-  if (dtv != NULL)
-    {
-      /* This is the initial length of the dtv.  */
-      dtv[0].counter = dtv_length;
-
-      /* The rest of the dtv (including the generation counter) is
-	 Initialize with zero to indicate nothing there.  */
-
-      /* Add the dtv to the thread data structures.  */
-      INSTALL_DTV (result, dtv);
-    }
-  else
-    result = NULL;
-
-  return result;
-}
-
-
-/* Get size and alignment requirements of the static TLS block.  */
-void
-internal_function
-_dl_get_tls_static_info (size_t *sizep, size_t *alignp)
-{
-  *sizep = GL(dl_tls_static_size);
-  *alignp = GL(dl_tls_static_align);
-}
-
-
-void *
-internal_function
-_dl_allocate_tls_storage (void)
-{
-  void *result;
-  size_t size = GL(dl_tls_static_size);
-
-# if TLS_DTV_AT_TP
-  /* Memory layout is:
-     [ TLS_PRE_TCB_SIZE ] [ TLS_TCB_SIZE ] [ TLS blocks ]
-			  ^ This should be returned.  */
-  size += (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
-	  & ~(GL(dl_tls_static_align) - 1);
-# endif
-
-  /* Allocate a correctly aligned chunk of memory.  */
-  result = __libc_memalign (GL(dl_tls_static_align), size);
-  if (__builtin_expect (result != NULL, 1))
-    {
-      /* Allocate the DTV.  */
-      void *allocated = result;
-
-# if TLS_TCB_AT_TP
-      /* The TCB follows the TLS blocks.  */
-      result = (char *) result + size - TLS_TCB_SIZE;
-
-      /* Clear the TCB data structure.  We can't ask the caller (i.e.
-	 libpthread) to do it, because we will initialize the DTV et al.  */
-      memset (result, 0, TLS_TCB_SIZE);
-# elif TLS_DTV_AT_TP
-      result = (char *) result + size - GL(dl_tls_static_size);
-
-      /* Clear the TCB data structure and TLS_PRE_TCB_SIZE bytes before it.
-	 We can't ask the caller (i.e. libpthread) to do it, because we will
-	 initialize the DTV et al.  */
-      memset ((char *) result - TLS_PRE_TCB_SIZE, 0,
-	      TLS_PRE_TCB_SIZE + TLS_TCB_SIZE);
-# endif
-
-      result = allocate_dtv (result);
-      if (result == NULL)
-	free (allocated);
-    }
-
-  return result;
-}
-
-
-void *
-internal_function
-_dl_allocate_tls_init (void *result)
-{
-  if (result == NULL)
-    /* The memory allocation failed.  */
-    return NULL;
-
-  dtv_t *dtv = GET_DTV (result);
-  struct dtv_slotinfo_list *listp;
-  size_t total = 0;
-
-  /* We have to look prepare the dtv for all currently loaded
-     modules using TLS.  For those which are dynamically loaded we
-     add the values indicating deferred allocation.  */
-  listp = GL(dl_tls_dtv_slotinfo_list);
-  while (1)
-    {
-      size_t cnt;
-
-      for (cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt)
-	{
-	  struct link_map *map;
-	  void *dest;
-
-	  /* Check for the total number of used slots.  */
-	  if (total + cnt > GL(dl_tls_max_dtv_idx))
-	    break;
-
-	  map = listp->slotinfo[cnt].map;
-	  if (map == NULL)
-	    /* Unused entry.  */
-	    continue;
-
-	  if (map->l_tls_offset == NO_TLS_OFFSET)
-	    {
-	      /* For dynamically loaded modules we simply store
-		 the value indicating deferred allocation.  */
-	      dtv[map->l_tls_modid].pointer = TLS_DTV_UNALLOCATED;
-	      continue;
-	    }
-
-	  assert (map->l_tls_modid == cnt);
-	  assert (map->l_tls_blocksize >= map->l_tls_initimage_size);
-# if TLS_TCB_AT_TP
-	  assert ((size_t) map->l_tls_offset >= map->l_tls_blocksize);
-	  dest = (char *) result - map->l_tls_offset;
-# elif TLS_DTV_AT_TP
-	  dest = (char *) result + map->l_tls_offset;
-# else
-#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
-
-	  /* Copy the initialization image and clear the BSS part.  */
-	  dtv[map->l_tls_modid].pointer = dest;
-	  memset (__mempcpy (dest, map->l_tls_initimage,
-			     map->l_tls_initimage_size), '\0',
-		  map->l_tls_blocksize - map->l_tls_initimage_size);
-	}
-
-      total += cnt;
-      if (total >= GL(dl_tls_max_dtv_idx))
-	break;
-
-      listp = listp->next;
-      assert (listp != NULL);
-    }
-
-  return result;
-}
-rtld_hidden_def (_dl_allocate_tls_init)
-
-void *
-internal_function
-_dl_allocate_tls (void *mem)
-{
-  return _dl_allocate_tls_init (mem == NULL
-				? _dl_allocate_tls_storage ()
-				: allocate_dtv (mem));
-}
-rtld_hidden_def (_dl_allocate_tls)
-
-
-void
-internal_function
-_dl_deallocate_tls (void *tcb, bool dealloc_tcb)
-{
-  dtv_t *dtv = GET_DTV (tcb);
-
-  /* The array starts with dtv[-1].  */
-#ifdef SHARED
-  if (dtv != GL(dl_initial_dtv))
-#endif
-    free (dtv - 1);
-
-  if (dealloc_tcb)
-    {
-# if TLS_TCB_AT_TP
-      /* The TCB follows the TLS blocks.  Back up to free the whole block.  */
-      tcb -= GL(dl_tls_static_size) - TLS_TCB_SIZE;
-# elif TLS_DTV_AT_TP
-      /* Back up the TLS_PRE_TCB_SIZE bytes.  */
-      tcb -= (TLS_PRE_TCB_SIZE + GL(dl_tls_static_align) - 1)
-	     & ~(GL(dl_tls_static_align) - 1);
-# endif
-      free (tcb);
-    }
-}
-rtld_hidden_def (_dl_deallocate_tls)
-
-
-# ifdef SHARED
-/* The __tls_get_addr function has two basic forms which differ in the
-   arguments.  The IA-64 form takes two parameters, the module ID and
-   offset.  The form used, among others, on IA-32 takes a reference to
-   a special structure which contain the same information.  The second
-   form seems to be more often used (in the moment) so we default to
-   it.  Users of the IA-64 form have to provide adequate definitions
-   of the following macros.  */
-#  ifndef GET_ADDR_ARGS
-#   define GET_ADDR_ARGS tls_index *ti
-#  endif
-#  ifndef GET_ADDR_MODULE
-#   define GET_ADDR_MODULE ti->ti_module
-#  endif
-#  ifndef GET_ADDR_OFFSET
-#   define GET_ADDR_OFFSET ti->ti_offset
-#  endif
-
-
-static void *
-allocate_and_init (struct link_map *map)
-{
-  void *newp;
-
-  newp = __libc_memalign (map->l_tls_align, map->l_tls_blocksize);
-  if (newp == NULL)
-    oom ();
-
-  /* Initialize the memory.  */
-  memset (__mempcpy (newp, map->l_tls_initimage, map->l_tls_initimage_size),
-	  '\0', map->l_tls_blocksize - map->l_tls_initimage_size);
-
-  return newp;
-}
-
-
-/* The generic dynamic and local dynamic model cannot be used in
-   statically linked applications.  */
-void *
-__tls_get_addr (GET_ADDR_ARGS)
-{
-  dtv_t *dtv = THREAD_DTV ();
-  struct link_map *the_map = NULL;
-  void *p;
-
-  if (__builtin_expect (dtv[0].counter != GL(dl_tls_generation), 0))
-    {
-      struct dtv_slotinfo_list *listp;
-      size_t idx;
-
-      /* The global dl_tls_dtv_slotinfo array contains for each module
-	 index the generation counter current when the entry was
-	 created.  This array never shrinks so that all module indices
-	 which were valid at some time can be used to access it.
-	 Before the first use of a new module index in this function
-	 the array was extended appropriately.  Access also does not
-	 have to be guarded against modifications of the array.  It is
-	 assumed that pointer-size values can be read atomically even
-	 in SMP environments.  It is possible that other threads at
-	 the same time dynamically load code and therefore add to the
-	 slotinfo list.  This is a problem since we must not pick up
-	 any information about incomplete work.  The solution to this
-	 is to ignore all dtv slots which were created after the one
-	 we are currently interested.  We know that dynamic loading
-	 for this module is completed and this is the last load
-	 operation we know finished.  */
-      idx = GET_ADDR_MODULE;
-      listp = GL(dl_tls_dtv_slotinfo_list);
-      while (idx >= listp->len)
-	{
-	  idx -= listp->len;
-	  listp = listp->next;
-	}
-
-      if (dtv[0].counter < listp->slotinfo[idx].gen)
-	{
-	  /* The generation counter for the slot is higher than what
-	     the current dtv implements.  We have to update the whole
-	     dtv but only those entries with a generation counter <=
-	     the one for the entry we need.  */
-	  size_t new_gen = listp->slotinfo[idx].gen;
-	  size_t total = 0;
-
-	  /* We have to look through the entire dtv slotinfo list.  */
-	  listp =  GL(dl_tls_dtv_slotinfo_list);
-	  do
-	    {
-	      size_t cnt;
-
-	      for (cnt = total = 0 ? 1 : 0; cnt < listp->len; ++cnt)
-		{
-		  size_t gen = listp->slotinfo[cnt].gen;
-		  struct link_map *map;
-		  size_t modid;
-
-		  if (gen > new_gen)
-		    /* This is a slot for a generation younger than
-		       the one we are handling now.  It might be
-		       incompletely set up so ignore it.  */
-		    continue;
-
-		  /* If the entry is older than the current dtv layout
-		     we know we don't have to handle it.  */
-		  if (gen <= dtv[0].counter)
-		    continue;
-
-		  /* If there is no map this means the entry is empty.  */
-		  map = listp->slotinfo[cnt].map;
-		  if (map == NULL)
-		    {
-		      /* If this modid was used at some point the memory
-			 might still be allocated.  */
-		      if (dtv[total + cnt].pointer != TLS_DTV_UNALLOCATED)
-			{
-			  free (dtv[total + cnt].pointer);
-			  dtv[total + cnt].pointer = TLS_DTV_UNALLOCATED;
-			}
-
-		      continue;
-		    }
-
-		  /* Check whether the current dtv array is large enough.  */
-		  modid = map->l_tls_modid;
-		  assert (total + cnt == modid);
-		  if (dtv[-1].counter < modid)
-		    {
-		      /* Reallocate the dtv.  */
-		      dtv_t *newp;
-		      size_t newsize = GL(dl_tls_max_dtv_idx) + DTV_SURPLUS;
-		      size_t oldsize = dtv[-1].counter;
-
-		      assert (map->l_tls_modid <= newsize);
-
-		      if (dtv == GL(dl_initial_dtv))
-			{
-			  /* This is the initial dtv that was allocated
-			     during rtld startup using the dl-minimal.c
-			     malloc instead of the real malloc.  We can't
-			     free it, we have to abandon the old storage.  */
-
-			  newp = malloc ((2 + newsize) * sizeof (dtv_t));
-			  if (newp == NULL)
-			    oom ();
-			  memcpy (newp, &dtv[-1], oldsize * sizeof (dtv_t));
-			}
-		      else
-			{
-			  newp = realloc (&dtv[-1],
-					  (2 + newsize) * sizeof (dtv_t));
-			  if (newp == NULL)
-			    oom ();
-			}
-
-		      newp[0].counter = newsize;
-
-		      /* Clear the newly allocated part.  */
-		      memset (newp + 2 + oldsize, '\0',
-			      (newsize - oldsize) * sizeof (dtv_t));
-
-		      /* Point dtv to the generation counter.  */
-		      dtv = &newp[1];
-
-		      /* Install this new dtv in the thread data
-			 structures.  */
-		      INSTALL_NEW_DTV (dtv);
-		    }
-
-		  /* If there is currently memory allocate for this
-		     dtv entry free it.  */
-		  /* XXX Ideally we will at some point create a memory
-		     pool.  */
-		  if (dtv[modid].pointer != TLS_DTV_UNALLOCATED)
-		    /* Note that free is called for NULL is well.  We
-		       deallocate even if it is this dtv entry we are
-		       supposed to load.  The reason is that we call
-		       memalign and not malloc.  */
-		    free (dtv[modid].pointer);
-
-		  /* This module is loaded dynamically- We defer
-		     memory allocation.  */
-		  dtv[modid].pointer = TLS_DTV_UNALLOCATED;
-
-		  if (modid == GET_ADDR_MODULE)
-		    the_map = map;
-		}
-
-	      total += listp->len;
-	    }
-	  while ((listp = listp->next) != NULL);
-
-	  /* This will be the new maximum generation counter.  */
-	  dtv[0].counter = new_gen;
-	}
-    }
-
-  p = dtv[GET_ADDR_MODULE].pointer;
-
-  if (__builtin_expect (p == TLS_DTV_UNALLOCATED, 0))
-    {
-      /* The allocation was deferred.  Do it now.  */
-      if (the_map == NULL)
-	{
-	  /* Find the link map for this module.  */
-	  size_t idx = GET_ADDR_MODULE;
-	  struct dtv_slotinfo_list *listp = GL(dl_tls_dtv_slotinfo_list);
-
-	  while (idx >= listp->len)
-	    {
-	      idx -= listp->len;
-	      listp = listp->next;
-	    }
-
-	  the_map = listp->slotinfo[idx].map;
-	}
-
-      p = dtv[GET_ADDR_MODULE].pointer = allocate_and_init (the_map);
-    }
-
-  return (char *) p + GET_ADDR_OFFSET;
-}
-# endif
-
-#endif	/* use TLS */
diff --git a/sysdeps/generic/dup.c b/sysdeps/generic/dup.c
deleted file mode 100644
index 5d5e1b4cd5..0000000000
--- a/sysdeps/generic/dup.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-/* Duplicate FD, returning a new file descriptor open on the same file.  */
-int
-__dup (fd)
-     int fd;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (dup)
-
-weak_alias (__dup, dup)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/dup2.c b/sysdeps/generic/dup2.c
deleted file mode 100644
index 2b897896f6..0000000000
--- a/sysdeps/generic/dup2.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-
-/* Duplicate FD to FD2, closing the old FD2 and making FD2 be
-   open the same file as FD is.  Return FD2 or -1.  */
-int
-__dup2 (fd, fd2)
-     int fd;
-     int fd2;
-{
-  if (fd < 0 || fd2 < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  if (fd == fd2)
-    /* No way to check that they are valid.  */
-    return fd2;
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__dup2)
-stub_warning (dup2)
-
-weak_alias (__dup2, dup2)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/dwarf2.h b/sysdeps/generic/dwarf2.h
index 800bda2dc0..9fca4c00e0 100644
--- a/sysdeps/generic/dwarf2.h
+++ b/sysdeps/generic/dwarf2.h
@@ -1,26 +1,26 @@
 /* Declarations and definitions of codes relating to the DWARF2 symbolic
    debugging information format.
-   Copyright (C) 1992, 1993, 1995, 1996, 1997, 2000 
-   Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1995, 1996, 1997, 2000
+   	Free Software Foundation, Inc.
    Contributed by Gary Funck (gary@intrepid.com).  Derived from the
    DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
 
-This file is part of GNU CC.
+   This file is part of the GNU C Library.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+   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.
 
-GNU CC 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 General Public License for more details.
+   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 General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+   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.  */
 
 /* This file is derived from the DWARF specification (a public document)
    Revision 2.0.0 (July 27, 1993) developed by the UNIX International
@@ -508,7 +508,7 @@ enum dwarf_call_frame_info
 
     /* SGI/MIPS specific */
     DW_CFA_MIPS_advance_loc8 = 0x1d,
-    
+
     /* GNU extensions */
     DW_CFA_GNU_window_save = 0x2d,
     DW_CFA_GNU_args_size = 0x2e,
diff --git a/sysdeps/generic/e_acoshl.c b/sysdeps/generic/e_acoshl.c
deleted file mode 100644
index 2c2fbe8eb4..0000000000
--- a/sysdeps/generic/e_acoshl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_acoshl (long double x)
-{
-  fputs ("__ieee754_acoshl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (acoshl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_acosl.c b/sysdeps/generic/e_acosl.c
deleted file mode 100644
index d844d885b8..0000000000
--- a/sysdeps/generic/e_acosl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_acosl (long double x)
-{
-  fputs ("__ieee754_acosl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (acosl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_asinl.c b/sysdeps/generic/e_asinl.c
deleted file mode 100644
index 3b26f030ef..0000000000
--- a/sysdeps/generic/e_asinl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_asinl (long double x)
-{
-  fputs ("__ieee754_asinl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (asinl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_atan2l.c b/sysdeps/generic/e_atan2l.c
deleted file mode 100644
index 0caed8a32f..0000000000
--- a/sysdeps/generic/e_atan2l.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_atan2l (long double x, long double y)
-{
-  fputs ("__ieee754_atan2l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (atan2l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_atanhl.c b/sysdeps/generic/e_atanhl.c
deleted file mode 100644
index 625d42db31..0000000000
--- a/sysdeps/generic/e_atanhl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_atanhl (long double x)
-{
-  fputs ("__ieee754_atanhl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__ieee754_atanhl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_coshl.c b/sysdeps/generic/e_coshl.c
deleted file mode 100644
index 0da319b785..0000000000
--- a/sysdeps/generic/e_coshl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_coshl (long double x)
-{
-  fputs ("__ieee754_coshl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__ieee754_coshl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_exp10.c b/sysdeps/generic/e_exp10.c
deleted file mode 100644
index a3eccbb9e6..0000000000
--- a/sysdeps/generic/e_exp10.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-
-
-double
-__ieee754_exp10 (double arg)
-{
-  /* This is a very stupid and inprecise implementation.  It'll get
-     replaced sometime (soon?).  */
-  return __ieee754_exp (M_LN10 * arg);
-}
diff --git a/sysdeps/generic/e_exp10f.c b/sysdeps/generic/e_exp10f.c
deleted file mode 100644
index 7d06d074b8..0000000000
--- a/sysdeps/generic/e_exp10f.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-
-
-float
-__ieee754_exp10f (float arg)
-{
-  /* This is a very stupid and inprecise implementation.  It'll get
-     replaced sometime (soon?).  */
-  return __ieee754_expf (M_LN10 * arg);
-}
diff --git a/sysdeps/generic/e_exp10l.c b/sysdeps/generic/e_exp10l.c
deleted file mode 100644
index 56f0cfec2f..0000000000
--- a/sysdeps/generic/e_exp10l.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-
-
-long double
-__ieee754_exp10l (long double arg)
-{
-  /* This is a very stupid and inprecise implementation.  It'll get
-     replaced sometime (soon?).  */
-  return __ieee754_expl (M_LN10l * arg);
-}
diff --git a/sysdeps/generic/e_exp2l.c b/sysdeps/generic/e_exp2l.c
deleted file mode 100644
index 64ef6d3d50..0000000000
--- a/sysdeps/generic/e_exp2l.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_exp2l (long double x)
-{
-  fputs ("__ieee754_exp2l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (exp2l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_expl.c b/sysdeps/generic/e_expl.c
deleted file mode 100644
index f9467c38ab..0000000000
--- a/sysdeps/generic/e_expl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_expl (long double x)
-{
-  fputs ("__ieee754_expl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (expl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_fmodl.c b/sysdeps/generic/e_fmodl.c
deleted file mode 100644
index 380da24e41..0000000000
--- a/sysdeps/generic/e_fmodl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_fmodl (long double x, long double y)
-{
-  fputs ("__ieee754_fmodl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (fmodl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_gammal_r.c b/sysdeps/generic/e_gammal_r.c
deleted file mode 100644
index 1c45c8421b..0000000000
--- a/sysdeps/generic/e_gammal_r.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_gammal_r (long double x, int *signgamp)
-{
-  *signgamp = 0;
-  fputs ("__ieee754_gammal_r not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__ieee754_gammal_r)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_hypotl.c b/sysdeps/generic/e_hypotl.c
deleted file mode 100644
index 07df22eb36..0000000000
--- a/sysdeps/generic/e_hypotl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_hypotl (long double x, long double y)
-{
-  fputs ("__ieee754_hypotl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__ieee754_hypotl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_j0l.c b/sysdeps/generic/e_j0l.c
deleted file mode 100644
index 1bf0a1de73..0000000000
--- a/sysdeps/generic/e_j0l.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-long double
-__ieee754_j0l (long double x)
-{
-  fputs ("__ieee754_j0l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (j0l)
-
-long double
-__ieee754_y0l (long double x)
-{
-  fputs ("__ieee754_y0l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (y0l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_j1l.c b/sysdeps/generic/e_j1l.c
deleted file mode 100644
index 656abeba57..0000000000
--- a/sysdeps/generic/e_j1l.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-long double
-__ieee754_j1l (long double x)
-{
-  fputs ("__ieee754_j1l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (j1l)
-
-long double
-__ieee754_y1l (long double x)
-{
-  fputs ("__ieee754_y1l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (y1l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_jnl.c b/sysdeps/generic/e_jnl.c
deleted file mode 100644
index 1bfc0695a5..0000000000
--- a/sysdeps/generic/e_jnl.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-long double
-__ieee754_jnl (int n, long double x)
-{
-  fputs ("__ieee754_jnl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (jnl)
-
-long double
-__ieee754_ynl (int n, long double x)
-{
-  fputs ("__ieee754_ynl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (ynl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_lgammal_r.c b/sysdeps/generic/e_lgammal_r.c
deleted file mode 100644
index 1784b2663f..0000000000
--- a/sysdeps/generic/e_lgammal_r.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-long double
-__ieee754_lgammal_r (long double x, int *signgamp)
-{
-  *signgamp = 0;
-  fputs ("__ieee754_lgammal_r not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (lgammal)
-stub_warning (lgammal_r)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_log10l.c b/sysdeps/generic/e_log10l.c
deleted file mode 100644
index 5bc264b32c..0000000000
--- a/sysdeps/generic/e_log10l.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_log10l (long double x)
-{
-  fputs ("__ieee754_log10l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (log10l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_log2l.c b/sysdeps/generic/e_log2l.c
deleted file mode 100644
index 681904bfbb..0000000000
--- a/sysdeps/generic/e_log2l.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_log2l (long double x)
-{
-  fputs ("__ieee754_log2l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (log2l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_logl.c b/sysdeps/generic/e_logl.c
deleted file mode 100644
index 9ba9cfc799..0000000000
--- a/sysdeps/generic/e_logl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_logl (long double x)
-{
-  fputs ("__ieee754_logl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (logl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_powl.c b/sysdeps/generic/e_powl.c
deleted file mode 100644
index afc2248b6b..0000000000
--- a/sysdeps/generic/e_powl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_powl (long double x, long double y)
-{
-  fputs ("__ieee754_powl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (powl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_rem_pio2l.c b/sysdeps/generic/e_rem_pio2l.c
deleted file mode 100644
index 617215516b..0000000000
--- a/sysdeps/generic/e_rem_pio2l.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-int
-__ieee754_rem_pio2l (long double x, long double *y)
-{
-  fputs ("__ieee754_rem_pio2l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0;
-}
-
-stub_warning (__ieee754_rem_pio2l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_scalb.c b/sysdeps/generic/e_scalb.c
deleted file mode 100644
index a7664db546..0000000000
--- a/sysdeps/generic/e_scalb.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* @(#)e_scalb.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_scalb.c,v 1.6 1995/05/10 20:46:09 jtc Exp $";
-#endif
-
-/*
- * __ieee754_scalb(x, fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
-
-#include <fenv.h>
-#include "math.h"
-#include "math_private.h"
-
-#ifdef _SCALB_INT
-#ifdef __STDC__
-	double __ieee754_scalb(double x, int fn)
-#else
-	double __ieee754_scalb(x,fn)
-	double x; int fn;
-#endif
-#else
-#ifdef __STDC__
-	double __ieee754_scalb(double x, double fn)
-#else
-	double __ieee754_scalb(x,fn)
-	double x, fn;
-#endif
-#endif
-{
-#ifdef _SCALB_INT
-	return __scalbn(x,fn);
-#else
-	if (__isnan(x)||__isnan(fn)) return x*fn;
-	if (!__finite(fn)) {
-	    if(fn>0.0) return x*fn;
-	    else if (x == 0)
-	      return x;
-	    else if (!__finite (x))
-	      {
-# ifdef FE_INVALID
-		feraiseexcept (FE_INVALID);
-# endif
-		return __nan ("");
-	      }
-	    else       return x/(-fn);
-	}
-	if (__rint(fn)!=fn)
-	  {
-# ifdef FE_INVALID
-	    feraiseexcept (FE_INVALID);
-# endif
-	    return __nan ("");
-	  }
-	if ( fn > 65000.0) return __scalbn(x, 65000);
-	if (-fn > 65000.0) return __scalbn(x,-65000);
-	return __scalbn(x,(int)fn);
-#endif
-}
diff --git a/sysdeps/generic/e_scalbf.c b/sysdeps/generic/e_scalbf.c
deleted file mode 100644
index 5c6326bc16..0000000000
--- a/sysdeps/generic/e_scalbf.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* e_scalbf.c -- float version of e_scalb.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: e_scalbf.c,v 1.3 1995/05/10 20:46:12 jtc Exp $";
-#endif
-
-#include <fenv.h>
-#include "math.h"
-#include "math_private.h"
-
-#ifdef _SCALB_INT
-#ifdef __STDC__
-	float __ieee754_scalbf(float x, int fn)
-#else
-	float __ieee754_scalbf(x,fn)
-	float x; int fn;
-#endif
-#else
-#ifdef __STDC__
-	float __ieee754_scalbf(float x, float fn)
-#else
-	float __ieee754_scalbf(x,fn)
-	float x, fn;
-#endif
-#endif
-{
-#ifdef _SCALB_INT
-	return __scalbnf(x,fn);
-#else
-	if (__isnanf(x)||__isnanf(fn)) return x*fn;
-	if (!__finitef(fn)) {
-	    if(fn>(float)0.0) return x*fn;
-	    else if (x == 0)
-	      return x;
-	    else if (!__finitef (x))
-	      {
-# ifdef FE_INVALID
-		feraiseexcept (FE_INVALID);
-# endif
-		return __nanf ("");
-	      }
-	    else       return x/(-fn);
-	}
-	if (__rintf(fn)!=fn)
-	  {
-# ifdef FE_INVALID
-	    feraiseexcept (FE_INVALID);
-# endif
-	    return __nanf ("");
-	  }
-	if ( fn > (float)65000.0) return __scalbnf(x, 65000);
-	if (-fn > (float)65000.0) return __scalbnf(x,-65000);
-	return __scalbnf(x,(int)fn);
-#endif
-}
diff --git a/sysdeps/generic/e_scalbl.c b/sysdeps/generic/e_scalbl.c
deleted file mode 100644
index a34369c0b5..0000000000
--- a/sysdeps/generic/e_scalbl.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* e_scalbl.c -- long double version of s_scalb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * __ieee754_scalbl(x, fn) is provide for
- * passing various standard test suite. One
- * should use scalbnl() instead.
- */
-
-#include <fenv.h>
-#include "math.h"
-#include "math_private.h"
-
-#ifdef _SCALB_INT
-#ifdef __STDC__
-	long double __ieee754_scalbl(long double x, int fn)
-#else
-	long double __ieee754_scalbl(x,fn)
-	long double x; int fn;
-#endif
-#else
-#ifdef __STDC__
-	long double __ieee754_scalbl(long double x, long double fn)
-#else
-	long double __ieee754_scalbl(x,fn)
-	long double x, fn;
-#endif
-#endif
-{
-#ifdef _SCALB_INT
-	return __scalbnl(x,fn);
-#else
-	if (__isnanl(x)||__isnanl(fn)) return x*fn;
-	if (!__finitel(fn)) {
-	    if(fn>0.0) return x*fn;
-	    else if (x == 0)
-	      return x;
-	    else if (!__finitel (x))
-	      {
-# ifdef FE_INVALID
-		feraiseexcept (FE_INVALID);
-# endif
-		return __nanl ("");
-	      }
-	    else       return x/(-fn);
-	}
-	if (__rintl(fn)!=fn)
-	  {
-# ifdef FE_INVALID
-	    feraiseexcept (FE_INVALID);
-# endif
-	    return __nanl ("");
-	  }
-	if ( fn > 65000.0) return __scalbnl(x, 65000);
-	if (-fn > 65000.0) return __scalbnl(x,-65000);
-	return __scalbnl(x,(int)fn);
-#endif
-}
diff --git a/sysdeps/generic/e_sinhl.c b/sysdeps/generic/e_sinhl.c
deleted file mode 100644
index 4cec79cb2d..0000000000
--- a/sysdeps/generic/e_sinhl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_sinhl (long double x)
-{
-  fputs ("__ieee754_sinhl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__ieee754_sinhl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/e_sqrtl.c b/sysdeps/generic/e_sqrtl.c
deleted file mode 100644
index 7680bdb145..0000000000
--- a/sysdeps/generic/e_sqrtl.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__ieee754_sqrtl (long double x)
-{
-  fputs ("__ieee754_sqrtl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (sqrtl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/elf/backtracesymsfd.c b/sysdeps/generic/elf/backtracesymsfd.c
index 16df53883c..6754d145b0 100644
--- a/sysdeps/generic/elf/backtracesymsfd.c
+++ b/sysdeps/generic/elf/backtracesymsfd.c
@@ -1,5 +1,5 @@
 /* Write formatted list with names for addresses in backtrace to a file.
-   Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -107,3 +107,4 @@ __backtrace_symbols_fd (array, size, fd)
     }
 }
 weak_alias (__backtrace_symbols_fd, backtrace_symbols_fd)
+libc_hidden_def (__backtrace_symbols_fd)
diff --git a/sysdeps/generic/enbl-secure.c b/sysdeps/generic/enbl-secure.c
deleted file mode 100644
index fac3b9c527..0000000000
--- a/sysdeps/generic/enbl-secure.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Define and initialize the `__libc_enable_secure' flag.  Generic version.
-   Copyright (C) 1996, 1997, 1998, 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file is used in the static libc.  For the shared library,
-   dl-sysdep.c defines and initializes __libc_enable_secure.  */
-
-#include <unistd.h>
-#include <libc-internal.h>
-
-/* If nonzero __libc_enable_secure is already set.  */
-int __libc_enable_secure_decided;
-/* Safest assumption, if somehow the initializer isn't run.  */
-int __libc_enable_secure = 1;
-
-void
-__libc_init_secure (void)
-{
-  if (__libc_enable_secure_decided == 0)
-    __libc_enable_secure = (__geteuid () != __getuid ()
-			    || __getegid () != __getgid ());
-}
diff --git a/sysdeps/generic/endutxent.c b/sysdeps/generic/endutxent.c
deleted file mode 100644
index 2a93081c83..0000000000
--- a/sysdeps/generic/endutxent.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-void
-endutxent (void)
-{
-  __endutent ();
-}
diff --git a/sysdeps/generic/environ.c b/sysdeps/generic/environ.c
deleted file mode 100644
index a0ed0d80ea..0000000000
--- a/sysdeps/generic/environ.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This file just defines the `__environ' variable (and alias `environ').  */
-
-#include <unistd.h>
-#include <stddef.h>
-
-/* This must be initialized; we cannot have a weak alias into bss.  */
-char **__environ = NULL;
-weak_alias (__environ, environ)
-
-/* The SVR4 ABI says `_environ' will be the name to use
-   in case the user overrides the weak alias `environ'.  */
-weak_alias (__environ, _environ)
diff --git a/sysdeps/generic/errlist.c b/sysdeps/generic/errlist.c
deleted file mode 100644
index 6b459ee40a..0000000000
--- a/sysdeps/generic/errlist.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-
-#ifndef HAVE_GNU_LD
-#define	_sys_errlist	sys_errlist
-#define	_sys_nerr	sys_nerr
-#endif
-
-const char *const _sys_errlist[] =
-  {
-    "Error 0",			/* 0 */
-    "Argument out of function's domain", /* 1 = EDOM */
-    "Result out of range",	/* 2 = ERANGE */
-    "Operation not implemented", /* 3 = ENOSYS */
-    "Invalid argument",		/* 4 = EINVAL */
-    "Illegal seek",		/* 5 = ESPIPE */
-    "Bad file descriptor",	/* 6 = EBADF */
-    "Cannot allocate memory",	/* 7 = ENOMEM */
-    "Permission denied",	/* 8 = EACCES */
-    "Too many open files in system", /* 9 = ENFILE */
-    "Too many open files",	/* 10 = EMFILE */
-  };
-
-const int _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
diff --git a/sysdeps/generic/errno-loc.c b/sysdeps/generic/errno-loc.c
deleted file mode 100644
index 633590f4f9..0000000000
--- a/sysdeps/generic/errno-loc.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* MT support function to get address of `errno' variable, non-threaded
-   version.
-   Copyright (C) 1996, 1998, 2002, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <tls.h>
-
-#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
-#undef errno
-extern int errno;
-#endif
-
-int *
-#if ! USE___THREAD
-weak_const_function
-#endif
-__errno_location (void)
-{
-  return &errno;
-}
-libc_hidden_def (__errno_location)
diff --git a/sysdeps/generic/errno.c b/sysdeps/generic/errno.c
deleted file mode 100644
index 03d661b717..0000000000
--- a/sysdeps/generic/errno.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Definition of `errno' variable.  Canonical version.
-   Copyright (C) 2002, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <tls.h>
-#include <dl-sysdep.h>
-#undef errno
-
-#if RTLD_PRIVATE_ERRNO
-
-/* Code compiled for rtld refers only to this name.  */
-int rtld_errno attribute_hidden;
-
-#elif USE___THREAD
-
-__thread int errno;
-extern __thread int __libc_errno __attribute__ ((alias ("errno")))
-  attribute_hidden;
-
-#else
-
-/* This differs from plain `int errno;' in that it doesn't create
-   a common definition, but a plain symbol that resides in .bss,
-   which can have an alias.  */
-int errno __attribute__ ((nocommon));
-strong_alias (errno, _errno)
-
-/* We declare these with compat_symbol so that they are not visible at
-   link time.  Programs must use the accessor functions.  RTLD is special,
-   since it's not exported from there at any time.  */
-# if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
-#  include <shlib-compat.h>
-compat_symbol (libc, errno, errno, GLIBC_2_0);
-compat_symbol (libc, _errno, _errno, GLIBC_2_0);
-# endif
-
-#endif
diff --git a/sysdeps/generic/euidaccess.c b/sysdeps/generic/euidaccess.c
deleted file mode 100644
index 028fe9085c..0000000000
--- a/sysdeps/generic/euidaccess.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Test for access to FILE using effective UID and GID.  Stub version.
-   Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-int
-__euidaccess (file, type)
-     const char *file;
-     int type;
-{
-  if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__euidaccess, euidaccess)
-stub_warning (euidaccess)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/exc2signal.c b/sysdeps/generic/exc2signal.c
deleted file mode 100644
index de044bbcf4..0000000000
--- a/sysdeps/generic/exc2signal.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Translate Mach exception codes into signal numbers.  Stub version.
-   Copyright (C) 1991, 1992, 1994, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd.h>
-
-/* This file must be modified with machine-dependent details.  */
-#error "need to write sysdeps/mach/hurd/MACHINE/exc2signal.c"
-
-/* Translate the Mach exception codes, as received in an `exception_raise' RPC,
-   into a signal number and signal subcode.  */
-
-void
-_hurd_exception2signal (int exception, int code, int subcode,
-			int *signo, int *sigcode, int *error)
-{
-  *error = 0;
-
-  switch (exception)
-    {
-    default:
-      *signo = SIGIOT;
-      *sigcode = exception;
-      break;
-
-    case EXC_BAD_ACCESS:
-      if (code == KERN_PROTECTION_FAILURE)
-	*signo = SIGSEGV;
-      else
-	*signo = SIGBUS;
-      *sigcode = subcode;
-      *error = code;
-      break;
-
-    case EXC_BAD_INSTRUCTION:
-      *signo = SIGILL;
-      *sigcode = 0;
-      break;
-
-    case EXC_ARITHMETIC:
-      *signo = SIGFPE;
-      *sigcode = 0;
-      break;
-
-    case EXC_EMULATION:
-    case EXC_SOFTWARE:
-      *signo = SIGEMT;
-      *sigcode = 0;
-      break;
-
-    case EXC_BREAKPOINT:
-      *signo = SIGTRAP;
-      *sigcode = 0;
-      break;
-    }
-}
diff --git a/sysdeps/generic/execve.c b/sysdeps/generic/execve.c
deleted file mode 100644
index 2d756293ed..0000000000
--- a/sysdeps/generic/execve.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Replace the current process, executing PATH with arguments ARGV and
-   environment ENVP.  ARGV and ENVP are terminated by NULL pointers.  */
-int
-__execve (path, argv, envp)
-     const char *path;
-     char *const argv[];
-     char *const envp[];
-{
-  if (path == NULL || argv == NULL || envp == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (execve)
-
-weak_alias (__execve, execve)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fattach.c b/sysdeps/generic/fattach.c
deleted file mode 100644
index 555e0b65e6..0000000000
--- a/sysdeps/generic/fattach.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stropts.h>
-
-int
-fattach (fildes, path)
-     int fildes;
-     const char *path;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (fattach)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fchdir.c b/sysdeps/generic/fchdir.c
deleted file mode 100644
index db1e4f8f35..0000000000
--- a/sysdeps/generic/fchdir.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-/* Change the current directory to FD.  */
-int
-fchdir (fd)
-     int fd;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (fchdir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fchflags.c b/sysdeps/generic/fchflags.c
deleted file mode 100644
index f191194c12..0000000000
--- a/sysdeps/generic/fchflags.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-
-/* Change the flags of the file FD refers to to FLAGS.  */
-
-int fchflags (int fd, int flags) __THROW;
-
-int
-fchflags (fd, flags)
-     int fd;
-     int flags;
-{
-  if (fd < 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (fchflags)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fchmod.c b/sysdeps/generic/fchmod.c
deleted file mode 100644
index 4b5eacb3eb..0000000000
--- a/sysdeps/generic/fchmod.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-/* Change the protections of the file FD refers to to MODE.  */
-int
-__fchmod (fd, mode)
-     int fd;
-     mode_t mode;
-{
-  if (fd < 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (fchmod)
-
-weak_alias (__fchmod, fchmod)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fchown.c b/sysdeps/generic/fchown.c
deleted file mode 100644
index e0d42dd293..0000000000
--- a/sysdeps/generic/fchown.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Change the owner and group of the file referred to by FD.  */
-int
-__fchown (fd, owner, group)
-     int fd;
-     uid_t owner;
-     gid_t group;
-{
-  if (fd < 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (fchown)
-
-weak_alias (__fchown, fchown)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fclrexcpt.c b/sysdeps/generic/fclrexcpt.c
deleted file mode 100644
index 560e326ee3..0000000000
--- a/sysdeps/generic/fclrexcpt.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Clear given exceptions in current floating-point environment.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <shlib-compat.h>
-
-int
-__feclearexcept (int excepts)
-{
-  /* This always fails.  */
-  return 1;
-}
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feclearexcept, __old_feclearexcept)
-compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
-#endif
-versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
-
-stub_warning (feclearexcept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fcntl.c b/sysdeps/generic/fcntl.c
deleted file mode 100644
index db6fbc399c..0000000000
--- a/sysdeps/generic/fcntl.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-
-/* Perform file control operations on FD.  */
-int
-__fcntl (fd, cmd)
-     int fd;
-     int cmd;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__fcntl)
-stub_warning (fcntl)
-
-weak_alias (__fcntl, fcntl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fdatasync.c b/sysdeps/generic/fdatasync.c
deleted file mode 100644
index 3edeef0c9e..0000000000
--- a/sysdeps/generic/fdatasync.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-
-
-/* Synchronize at least the data part of a file with the underlying
-   media.  */
-int
-fdatasync (int fildes)
-{
-  return fsync (fildes);
-}
diff --git a/sysdeps/generic/fdetach.c b/sysdeps/generic/fdetach.c
deleted file mode 100644
index 431c92bbea..0000000000
--- a/sysdeps/generic/fdetach.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stropts.h>
-
-int
-fdetach (path)
-     const char *path;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (fdetach)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fedisblxcpt.c b/sysdeps/generic/fedisblxcpt.c
deleted file mode 100644
index e1e9065aac..0000000000
--- a/sysdeps/generic/fedisblxcpt.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Disable floating-point exceptions.
-   Copyright (C) 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fedisableexcept (int excepts)
-{
-  /* Signal failure.  */
-  return -1;
-}
-stub_warning (fedisableexcept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/feenablxcpt.c b/sysdeps/generic/feenablxcpt.c
deleted file mode 100644
index 678271f360..0000000000
--- a/sysdeps/generic/feenablxcpt.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Enable floating-point exceptions.
-   Copyright (C) 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-feenableexcept (int excepts)
-{
-  /* Signal failure.  */
-  return -1;
-}
-stub_warning (feenableexcept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fegetenv.c b/sysdeps/generic/fegetenv.c
deleted file mode 100644
index 4a878cc41b..0000000000
--- a/sysdeps/generic/fegetenv.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Store current floating-point environment.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <shlib-compat.h>
-#include <bp-sym.h>
-
-int
-__fegetenv (fenv_t *envp)
-{
-  /* This always fails.  */
-  return 1;
-}
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fegetenv, __old_fegetenv)
-compat_symbol (libm, BP_SYM (__old_fegetenv), BP_SYM (fegetenv), GLIBC_2_1);
-#endif
-versioned_symbol (libm, BP_SYM (__fegetenv), BP_SYM (fegetenv), GLIBC_2_2);
-
-stub_warning (fegetenv)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fegetexcept.c b/sysdeps/generic/fegetexcept.c
deleted file mode 100644
index 1870689e8d..0000000000
--- a/sysdeps/generic/fegetexcept.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Get floating-point exceptions.
-   Copyright (C) 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetexcept (void)
-{
-  /* Signal failure.  */
-  return -1;
-}
-stub_warning (fegetexcept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fegetround.c b/sysdeps/generic/fegetround.c
deleted file mode 100644
index cf7a774929..0000000000
--- a/sysdeps/generic/fegetround.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Return current rounding direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetround (void)
-{
-  return 0;
-}
-stub_warning (fegetround)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/feholdexcpt.c b/sysdeps/generic/feholdexcpt.c
deleted file mode 100644
index 927a6dc95c..0000000000
--- a/sysdeps/generic/feholdexcpt.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-feholdexcept (fenv_t *envp)
-{
-  return 1;		/* Signal failure.  */
-}
-stub_warning (feholdexcept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fesetenv.c b/sysdeps/generic/fesetenv.c
deleted file mode 100644
index 936d6c121b..0000000000
--- a/sysdeps/generic/fesetenv.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Install given floating-point environment.
-   Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <shlib-compat.h>
-
-int
-__fesetenv (const fenv_t *envp)
-{
-  /* This always fails.  */
-  return 1;
-}
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetenv, __old_fesetenv)
-compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1);
-#endif
-libm_hidden_ver (__fesetenv, fesetenv)
-versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
-
-stub_warning (fesetenv)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fesetround.c b/sysdeps/generic/fesetround.c
deleted file mode 100644
index e5a27d2aa0..0000000000
--- a/sysdeps/generic/fesetround.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Set current rounding direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fesetround (int round)
-{
-  return 1;	/* Signal we are unable to set the direction.  */
-}
-stub_warning (fesetround)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/feupdateenv.c b/sysdeps/generic/feupdateenv.c
deleted file mode 100644
index 3e6aed4fdf..0000000000
--- a/sysdeps/generic/feupdateenv.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <shlib-compat.h>
-
-int
-__feupdateenv (const fenv_t *envp)
-{
-  /* This always fails.  */
-  return 1;
-}
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feupdateenv, __old_feupdateenv)
-compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
-#endif
-versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
-
-stub_warning (feupdateenv)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fexecve.c b/sysdeps/generic/fexecve.c
deleted file mode 100644
index fceae9251a..0000000000
--- a/sysdeps/generic/fexecve.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Execute the file FD refers to, overlaying the running program image.
-   ARGV and ENVP are passed to the new program, as for `execve'.  */
-int
-fexecve (fd, argv, envp)
-     int fd;
-     char *const argv[];
-     char *const envp[];
-{
-  if (fd < 0 || argv == NULL || envp == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (fexecve)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ffs.c b/sysdeps/generic/ffs.c
deleted file mode 100644
index 06a1542bd9..0000000000
--- a/sysdeps/generic/ffs.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997, 1998, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <limits.h>
-#define ffsl __something_else
-#include <string.h>
-
-#undef	ffs
-
-/* Find the first bit set in I.  */
-int
-__ffs (i)
-     int i;
-{
-  static const unsigned char table[] =
-    {
-      0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-      6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-      7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-      7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-      8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
-    };
-  unsigned int a;
-  unsigned int x = i & -i;
-
-  a = x <= 0xffff ? (x <= 0xff ? 0 : 8) : (x <= 0xffffff ?  16 : 24);
-
-  return table[x >> a] + a;
-}
-weak_alias (__ffs, ffs)
-libc_hidden_builtin_def (ffs)
-
-#if ULONG_MAX == UINT_MAX
-#undef ffsl
-weak_alias (__ffs, ffsl)
-#endif
diff --git a/sysdeps/generic/ffsll.c b/sysdeps/generic/ffsll.c
deleted file mode 100644
index 9dd269afb7..0000000000
--- a/sysdeps/generic/ffsll.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <limits.h>
-#define ffsl __something_else
-#include <string.h>
-
-#undef	ffsll
-
-/* Find the first bit set in I.  */
-int
-ffsll (i)
-     long long int i;
-{
-  unsigned long long int x = i & -i;
-
-  if (x <= 0xffffffff)
-    return ffs (i);
-  else
-    return 32 + ffs (i >> 32);
-}
-
-#if ULONG_MAX != UINT_MAX
-#undef ffsl
-weak_alias (ffsll, ffsl)
-#endif
diff --git a/sysdeps/generic/fgetexcptflg.c b/sysdeps/generic/fgetexcptflg.c
deleted file mode 100644
index aea2e0ffaf..0000000000
--- a/sysdeps/generic/fgetexcptflg.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Store current representation for exceptions.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <shlib-compat.h>
-
-int
-__fegetexceptflag (fexcept_t *flagp, int excepts)
-{
-  /* This always fails.  */
-  return 1;
-}
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fegetexceptflag, __old_fegetexceptflag)
-compat_symbol (libm, __old_fegetexceptflag, fegetexceptflag, GLIBC_2_1);
-#endif
-versioned_symbol (libm, __fegetexceptflag, fegetexceptflag, GLIBC_2_2);
-
-stub_warning (fegetexceptflag)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fgetxattr.c b/sysdeps/generic/fgetxattr.c
deleted file mode 100644
index 610ed32d1f..0000000000
--- a/sysdeps/generic/fgetxattr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-ssize_t
-fgetxattr (int __fd, const char *__name,
-	   void *__value, size_t __size)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (fgetxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/flistxattr.c b/sysdeps/generic/flistxattr.c
deleted file mode 100644
index fc2863d31c..0000000000
--- a/sysdeps/generic/flistxattr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-ssize_t
-flistxattr (int __fd, char *__list, size_t __size)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (flistxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/flock.c b/sysdeps/generic/flock.c
deleted file mode 100644
index db3bfcfcbe..0000000000
--- a/sysdeps/generic/flock.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/file.h>
-
-/* Apply or remove an advisory lock, according to OPERATION,
-   on the file FD refers to.  */
-int
-__flock (fd, operation)
-     int fd;
-     int operation;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__flock, flock)
-
-stub_warning (flock)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/flockfile.c b/sysdeps/generic/flockfile.c
deleted file mode 100644
index 571930ee54..0000000000
--- a/sysdeps/generic/flockfile.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Lock I/O stream.  Singlethreaded version.
-   Copyright (C) 1996, 1997, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-
-#undef _IO_flockfile
-
-void
-__flockfile (FILE *stream)
-{
-  /* Do nothing.  Using this version does not do any locking.  */
-}
-weak_alias (__flockfile, flockfile);
-weak_alias (__flockfile, _IO_flockfile)
diff --git a/sysdeps/generic/fork.c b/sysdeps/generic/fork.c
deleted file mode 100644
index c19fa656b3..0000000000
--- a/sysdeps/generic/fork.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-
-/* Clone the calling process, creating an exact copy.
-   Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-int
-__fork ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__fork)
-stub_warning (fork)
-
-weak_alias (__fork, fork)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fpathconf.c b/sysdeps/generic/fpathconf.c
deleted file mode 100644
index 840460b04b..0000000000
--- a/sysdeps/generic/fpathconf.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Get file-specific information about descriptor FD.  */
-long int
-__fpathconf (fd, name)
-     int fd;
-     int name;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  switch (name)
-    {
-    default:
-      __set_errno (EINVAL);
-      return -1;
-
-    case _PC_LINK_MAX:
-    case _PC_MAX_CANON:
-    case _PC_MAX_INPUT:
-    case _PC_NAME_MAX:
-    case _PC_PATH_MAX:
-    case _PC_PIPE_BUF:
-    case _PC_SOCK_MAXBUF:
-    case _PC_CHOWN_RESTRICTED:
-    case _PC_NO_TRUNC:
-    case _PC_VDISABLE:
-      break;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__fpathconf, fpathconf)
-
-stub_warning (fpathconf)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fpu_control.c b/sysdeps/generic/fpu_control.c
deleted file mode 100644
index cd8eeff99d..0000000000
--- a/sysdeps/generic/fpu_control.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Default FPU control word initialization.
-   Copyright (C) 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include <fpu_control.h>
-
-/* This module defines `__fpu_control' with the default value.  */
-
-fpu_control_t __fpu_control = _FPU_DEFAULT;
diff --git a/sysdeps/generic/fraiseexcpt.c b/sysdeps/generic/fraiseexcpt.c
deleted file mode 100644
index 764634a3b1..0000000000
--- a/sysdeps/generic/fraiseexcpt.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Raise given exceptions.
-   Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <shlib-compat.h>
-
-int
-__feraiseexcept (int excepts)
-{
-  /* This always fails.  */
-  return 1;
-}
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feraiseexcept, __old_feraiseexcept)
-compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
-#endif
-libm_hidden_ver (__feraiseexcept, feraiseexcept)
-versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
-
-stub_warning (feraiseexcept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fremovexattr.c b/sysdeps/generic/fremovexattr.c
deleted file mode 100644
index 9719d42d40..0000000000
--- a/sysdeps/generic/fremovexattr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-int
-fremovexattr (int __fd, const char *__name)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (fremovexattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fsetexcptflg.c b/sysdeps/generic/fsetexcptflg.c
deleted file mode 100644
index 8d0f0ff64b..0000000000
--- a/sysdeps/generic/fsetexcptflg.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Set floating-point environment exception handling.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <shlib-compat.h>
-
-int
-__fesetexceptflag (const fexcept_t *flagp, int excepts)
-{
-  /* This always fails.  */
-  return 1;
-}
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetexceptflag, __old_fesetexceptflag)
-compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1);
-#endif
-versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);
-
-stub_warning (fesetexceptflag)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fsetxattr.c b/sysdeps/generic/fsetxattr.c
deleted file mode 100644
index 8a52e72529..0000000000
--- a/sysdeps/generic/fsetxattr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-int
-fsetxattr (int __fd, const char *__name, const void *__value,
-	   size_t __size, int __flags)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (fsetxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatfs.c b/sysdeps/generic/fstatfs.c
deleted file mode 100644
index 4a1a996cbc..0000000000
--- a/sysdeps/generic/fstatfs.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Return information about the filesystem on which FD resides.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statfs.h>
-#include <stddef.h>
-
-/* Return information about the filesystem on which FD resides.  */
-int
-__fstatfs (int fd, struct statfs *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (fstatfs)
-
-weak_alias (__fstatfs, fstatfs)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatfs64.c b/sysdeps/generic/fstatfs64.c
deleted file mode 100644
index 249b97ea44..0000000000
--- a/sysdeps/generic/fstatfs64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1998, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statfs.h>
-
-/* Return information about the filesystem on which FD resides.  */
-int
-__fstatfs64 (int fd, struct statfs64 *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__fstatfs64, fstatfs64)
-
-stub_warning (fstatfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatvfs.c b/sysdeps/generic/fstatvfs.c
deleted file mode 100644
index c5f75a7c97..0000000000
--- a/sysdeps/generic/fstatvfs.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Return information about the filesystem on which FD resides.
-   Copyright (C) 1996, 1997, 1998, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statvfs.h>
-
-/* Return information about the filesystem on which FD resides.  */
-int
-__fstatvfs (int fd, struct statvfs *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (fstatvfs)
-weak_alias (__fstatvfs, fstatvfs)
-libc_hidden_weak (fstatvfs)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fstatvfs64.c b/sysdeps/generic/fstatvfs64.c
deleted file mode 100644
index 47d4e266e2..0000000000
--- a/sysdeps/generic/fstatvfs64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1998, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statvfs.h>
-
-/* Return information about the filesystem on which FD resides.  */
-int
-__fstatvfs64 (int fd, struct statvfs64 *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__fstatvfs64, fstatvfs64)
-
-stub_warning (fstatvfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fsync.c b/sysdeps/generic/fsync.c
deleted file mode 100644
index e2a4d700d5..0000000000
--- a/sysdeps/generic/fsync.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Make all changes done to FD actually appear on disk.  */
-int
-fsync (fd)
-     int fd;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (fsync)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ftestexcept.c b/sysdeps/generic/ftestexcept.c
deleted file mode 100644
index 4be3fb770f..0000000000
--- a/sysdeps/generic/ftestexcept.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Test exception in current environment.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fetestexcept (int excepts)
-{
-  return 0;
-}
-stub_warning (fetestexcept)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ftime.c b/sysdeps/generic/ftime.c
deleted file mode 100644
index 94dfbcc98b..0000000000
--- a/sysdeps/generic/ftime.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1994, 1996, 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-#include <sys/timeb.h>
-
-int
-ftime (timebuf)
-     struct timeb *timebuf;
-{
-  int save = errno;
-  struct tm tp;
-
-  __set_errno (0);
-  if (time (&timebuf->time) == (time_t) -1 && errno != 0)
-    return -1;
-  timebuf->millitm = 0;
-
-  if (__localtime_r (&timebuf->time, &tp) == NULL)
-    return -1;
-
-  timebuf->timezone = tp.tm_gmtoff / 60;
-  timebuf->dstflag = tp.tm_isdst;
-
-  __set_errno (save);
-  return 0;
-}
diff --git a/sysdeps/generic/ftruncate.c b/sysdeps/generic/ftruncate.c
deleted file mode 100644
index d4cca2e267..0000000000
--- a/sysdeps/generic/ftruncate.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-/* Truncate the file FD refers to to LENGTH bytes.  */
-int
-__ftruncate (fd, length)
-     int fd;
-     off_t length;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__ftruncate, ftruncate)
-     
-stub_warning (ftruncate)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ftruncate64.c b/sysdeps/generic/ftruncate64.c
deleted file mode 100644
index df84b7c3c1..0000000000
--- a/sysdeps/generic/ftruncate64.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1997, 1998, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-
-/* Truncate the file FD refers to to LENGTH bytes.  */
-int
-__ftruncate64 (fd, length)
-     int fd;
-     off64_t length;
-{
-  if ((off_t) length != length)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  return __ftruncate (fd, (off_t) length);
-}
-weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/generic/ftrylockfile.c b/sysdeps/generic/ftrylockfile.c
deleted file mode 100644
index 7bd3e9b53b..0000000000
--- a/sysdeps/generic/ftrylockfile.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Try locking I/O stream.  Singlethreaded version.
-   Copyright (C) 1996, 1997, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-
-#undef _IO_ftrylockfile
-
-int
-__ftrylockfile (FILE *stream)
-{
-  /* Do nothing.  Using this version does not do any locking.  */
-  return 1;
-}
-weak_alias (__ftrylockfile, ftrylockfile);
-weak_alias (__ftrylockfile, _IO_ftrylockfile)
diff --git a/sysdeps/generic/funlockfile.c b/sysdeps/generic/funlockfile.c
deleted file mode 100644
index 902d29478d..0000000000
--- a/sysdeps/generic/funlockfile.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Unlock I/O stream.  Singlethreaded version.
-   Copyright (C) 1996, 1997, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-
-#undef _IO_funlockfile
-
-void
-__funlockfile (FILE *stream)
-{
-  /* Do nothing.  Using this version does not do any locking.  */
-}
-weak_alias (__funlockfile, _IO_funlockfile)
-weak_alias (__funlockfile, funlockfile);
diff --git a/sysdeps/generic/futimes.c b/sysdeps/generic/futimes.c
deleted file mode 100644
index 3378dbf416..0000000000
--- a/sysdeps/generic/futimes.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* futimes -- change access and modification times of open file.  Stub version.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/time.h>
-#include <errno.h>
-
-/* Change the access time of FILE to TVP[0] and
-   the modification time of FILE to TVP[1], but do not follow symlinks.  */
-int
-__futimes (int fd, const struct timeval tvp[2])
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__futimes, futimes)
-
-stub_warning (futimes)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fxstat.c b/sysdeps/generic/fxstat.c
deleted file mode 100644
index b750daca63..0000000000
--- a/sysdeps/generic/fxstat.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-
-/* Get information about the file descriptor FD in BUF.  */
-int
-__fxstat (int vers, int fd, struct stat *buf)
-{
-  if (vers != _STAT_VER)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  else if (buf == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (fstat)
-hidden_def (__fxstat)
-weak_alias (__fxstat, _fxstat)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/fxstat64.c b/sysdeps/generic/fxstat64.c
deleted file mode 100644
index 865ba49484..0000000000
--- a/sysdeps/generic/fxstat64.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-
-/* Get information about the file descriptor FD in BUF.  */
-int
-__fxstat64 (int vers, int fd, struct stat64 *buf)
-{
-  if (vers != _STAT_VER)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  else if (buf == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-hidden_def (__fxstat64)
-stub_warning (fstat64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/gai_sigqueue.c b/sysdeps/generic/gai_sigqueue.c
deleted file mode 100644
index 2c91df6ddc..0000000000
--- a/sysdeps/generic/gai_sigqueue.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <aio.h>
-#include <errno.h>
-#include <signal.h>
-
-#include "gai_misc.h"
-
-int
-__gai_sigqueue (sig, val, caller_pid)
-     int sig;
-     const union sigval val;
-     pid_t caller_pid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (__gai_sigqueue)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/gai_strerror.c b/sysdeps/generic/gai_strerror.c
deleted file mode 100644
index 932c5910df..0000000000
--- a/sysdeps/generic/gai_strerror.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996,97,2001,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <netdb.h>
-
-const char *
-gai_strerror (int code)
-{
-  static char buffer[128];
-  snprintf (buffer, sizeof buffer, "Unknown error (%d)", code);
-  return buffer;
-}
-libc_hidden_def (gai_strerror)
diff --git a/sysdeps/generic/get_clockfreq.c b/sysdeps/generic/get_clockfreq.c
deleted file mode 100644
index 14375ec186..0000000000
--- a/sysdeps/generic/get_clockfreq.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Get frequency of the system processor.
-   Copyright (C) 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <libc-internal.h>
-
-hp_timing_t
-__get_clockfreq (void)
-{
-  /* There is no generic way to find this out since we have in general
-     no counter register either.  */
-  return 0;
-}
diff --git a/sysdeps/generic/getaddrinfo.c b/sysdeps/generic/getaddrinfo.c
deleted file mode 100644
index 548c0b863e..0000000000
--- a/sysdeps/generic/getaddrinfo.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Stub version of getaddrinfo function.
-   Copyright (C) 1996, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <netdb.h>
-
-int
-getaddrinfo (const char *name, const char *service, const struct addrinfo *req,
-	     struct addrinfo **pai)
-{
-  __set_errno (ENOSYS);
-  return EAI_SYSTEM;
-}
-stub_warning (getaddrinfo)
-libc_hidden_def (getaddrinfo)
-
-void
-freeaddrinfo (struct addrinfo *ai)
-{
-  /* Nothing.  */
-}
-stub_warning (freeaddrinfo)
-libc_hidden_def (freeaddrinfo)
-
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getclktck.c b/sysdeps/generic/getclktck.c
deleted file mode 100644
index 897c6a25ba..0000000000
--- a/sysdeps/generic/getclktck.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <time.h>
-
-/* Return frequency of times().  */
-int
-__getclktck ()
-{
-#ifdef	CLK_TCK
-  return CLK_TCK;
-#else
-  return 60;
-#endif
-}
diff --git a/sysdeps/generic/getcontext.c b/sysdeps/generic/getcontext.c
deleted file mode 100644
index e417575a58..0000000000
--- a/sysdeps/generic/getcontext.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <ucontext.h>
-
-int
-getcontext (ucp)
-     ucontext_t *ucp;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (getcontext)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getcwd.c b/sysdeps/generic/getcwd.c
deleted file mode 100644
index c472d1d7a6..0000000000
--- a/sysdeps/generic/getcwd.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <stddef.h>
-
-/* Get the pathname of the current working directory,
-   and put it in SIZE bytes of BUF.  Returns NULL if the
-   directory couldn't be determined or SIZE was too small.
-   If successful, returns BUF.  In GNU, if BUF is NULL,
-   an array is allocated with `malloc'; the array is SIZE
-   bytes long, unless SIZE <= 0, in which case it is as
-   big as necessary.  */
-char *
-__getcwd (char *buf, size_t size)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-weak_alias (__getcwd, getcwd)
-
-stub_warning (__getcwd)
-stub_warning (getcwd)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getdents.c b/sysdeps/generic/getdents.c
deleted file mode 100644
index 1b1b7c7e8f..0000000000
--- a/sysdeps/generic/getdents.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <dirent.h>
-
-ssize_t
-__getdirentries (fd, buf, nbytes, basep)
-     int fd;
-     char *buf;
-     size_t nbytes;
-     off_t *basep;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__getdirentries, getdirentries)
-
-stub_warning (getdirentries)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getdents64.c b/sysdeps/generic/getdents64.c
deleted file mode 100644
index cb30e76545..0000000000
--- a/sysdeps/generic/getdents64.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991,95,96,97,99,2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <dirent.h>
-
-ssize_t
-getdirentries64 (fd, buf, nbytes, basep)
-     int fd;
-     char *buf;
-     size_t nbytes;
-     off64_t *basep;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (getdirentries64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getdomain.c b/sysdeps/generic/getdomain.c
deleted file mode 100644
index 6074ccfb79..0000000000
--- a/sysdeps/generic/getdomain.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 1994,95,97,2000,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Put the name of the current YP domain in no more than LEN bytes of NAME.
-   The result is null-terminated if LEN is large enough for the full
-   name and the terminator.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/utsname.h>
-#include <string.h>
-
-#if _UTSNAME_DOMAIN_LENGTH
-/* The `uname' information includes the domain name.  */
-
-int
-getdomainname (name, len)
-    char *name;
-    size_t len;
-{
-  struct utsname u;
-  size_t u_len;
-
-  if (uname (&u) < 0)
-    return -1;
-
-  u_len = strlen (u.domainname);
-  memcpy (name, u.domainname, MIN (u_len + 1, len));
-  return 0;
-}
-
-#else
-
-int
-getdomainname (name, len)
-     char *name;
-     size_t len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (getdomainname)
-#include <stub-tag.h>
-
-#endif
-
-libc_hidden_def (getdomainname)
diff --git a/sysdeps/generic/getdtsz.c b/sysdeps/generic/getdtsz.c
deleted file mode 100644
index 38b7577914..0000000000
--- a/sysdeps/generic/getdtsz.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Return the maximum number of file descriptors
-   the current process could possibly have.  */
-int
-__getdtablesize ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getdtablesize)
-
-weak_alias (__getdtablesize, getdtablesize)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getegid.c b/sysdeps/generic/getegid.c
deleted file mode 100644
index d939d6ad64..0000000000
--- a/sysdeps/generic/getegid.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Get the effective group ID of the calling process.  */
-__gid_t
-__getegid ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getegid)
-
-weak_alias (__getegid, getegid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getenv.c b/sysdeps/generic/getenv.c
deleted file mode 100644
index d659f66022..0000000000
--- a/sysdeps/generic/getenv.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (C) 1991,92,94,96,98,99,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <endian.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifndef	HAVE_GNU_LD
-#define	__environ	environ
-#endif
-
-/* Return the value of the environment variable NAME.  This implementation
-   is tuned a bit in that it assumes no environment variable has an empty
-   name which of course should always be true.  We have a special case for
-   one character names so that for the general case we can assume at least
-   two characters which we can access.  By doing this we can avoid using the
-   `strncmp' most of the time.  */
-char *
-getenv (name)
-     const char *name;
-{
-  size_t len = strlen (name);
-  char **ep;
-  uint16_t name_start;
-
-  if (__environ == NULL || name[0] == '\0')
-    return NULL;
-
-  if (name[1] == '\0')
-    {
-      /* The name of the variable consists of only one character.  Therefore
-	 the first two characters of the environment entry are this character
-	 and a '=' character.  */
-#if __BYTE_ORDER == __LITTLE_ENDIAN || !_STRING_ARCH_unaligned
-      name_start = ('=' << 8) | *(const unsigned char *) name;
-#else
-# if __BYTE_ORDER == __BIG_ENDIAN
-      name_start = '=' | ((*(const unsigned char *) name) << 8);
-# else
- #error "Funny byte order."
-# endif
-#endif
-      for (ep = __environ; *ep != NULL; ++ep)
-	{
-#if _STRING_ARCH_unaligned
-	  uint16_t ep_start = *(uint16_t *) *ep;
-#else
-	  uint16_t ep_start = (((unsigned char *) *ep)[0]
-			       | (((unsigned char *) *ep)[1] << 8));
-#endif
-	  if (name_start == ep_start)
-	    return &(*ep)[2];
-	}
-    }
-  else
-    {
-#if _STRING_ARCH_unaligned
-      name_start = *(const uint16_t *) name;
-#else
-      name_start = (((const unsigned char *) name)[0]
-		    | (((const unsigned char *) name)[1] << 8));
-#endif
-      len -= 2;
-      name += 2;
-
-      for (ep = __environ; *ep != NULL; ++ep)
-	{
-#if _STRING_ARCH_unaligned
-	  uint16_t ep_start = *(uint16_t *) *ep;
-#else
-	  uint16_t ep_start = (((unsigned char *) *ep)[0]
-			       | (((unsigned char *) *ep)[1] << 8));
-#endif
-
-	  if (name_start == ep_start && !strncmp (*ep + 2, name, len)
-	      && (*ep)[len + 2] == '=')
-	    return &(*ep)[len + 3];
-	}
-    }
-
-  return NULL;
-}
-libc_hidden_def (getenv)
diff --git a/sysdeps/generic/geteuid.c b/sysdeps/generic/geteuid.c
deleted file mode 100644
index c67dbfd708..0000000000
--- a/sysdeps/generic/geteuid.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-
-/* Get the effective user ID of the calling process.  */
-__uid_t
-__geteuid ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (geteuid)
-
-weak_alias (__geteuid, geteuid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getgid.c b/sysdeps/generic/getgid.c
deleted file mode 100644
index 742c099fa2..0000000000
--- a/sysdeps/generic/getgid.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Get the real group ID of the calling process.  */
-gid_t
-__getgid ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getgid)
-
-weak_alias (__getgid, getgid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getgroups.c b/sysdeps/generic/getgroups.c
deleted file mode 100644
index d9970f0e6d..0000000000
--- a/sysdeps/generic/getgroups.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <limits.h>
-
-
-/* If SIZE is zero, return the number of supplementary groups
-   the calling process is in.  Otherwise, fill in the group IDs
-   of its supplementary groups in LIST and return the number written.  */
-int
-__getgroups (size, list)
-     int size;
-     gid_t *list;
-{
-#if defined (NGROUPS_MAX) && NGROUPS_MAX == 0
-  /* The system has no supplementary groups.  */
-  return 0;
-#endif
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-#if defined (HAVE_GNU_LD) && !(defined (NGROUPS_MAX) && NGROUPS_MAX == 0)
-stub_warning (getgroups);
-#endif
-
-weak_alias (__getgroups, getgroups)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/gethostid.c b/sysdeps/generic/gethostid.c
deleted file mode 100644
index 01baf12230..0000000000
--- a/sysdeps/generic/gethostid.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Return the current machine's Internet number.  */
-long int
-gethostid ()
-{
-  __set_errno (ENOSYS);
-  return -1L;
-}
-
-
-stub_warning (gethostid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/gethostname.c b/sysdeps/generic/gethostname.c
deleted file mode 100644
index bc59ab57c6..0000000000
--- a/sysdeps/generic/gethostname.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2000,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Put the name of the current host in no more than LEN bytes of NAME.
-   The result is null-terminated if LEN is large enough for the full
-   name and the terminator.  */
-int
-__gethostname (name, len)
-     char *name;
-     size_t len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (gethostname)
-
-weak_alias (__gethostname, gethostname)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getipv4sourcefilter.c b/sysdeps/generic/getipv4sourcefilter.c
deleted file mode 100644
index e95697778a..0000000000
--- a/sysdeps/generic/getipv4sourcefilter.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Get source filter.  Stub version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <netinet/in.h>
-
-
-int
-getipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
-		     uint32_t *fmode, uint32_t *numsrc, struct in_addr *slist)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getipv4sourcefilter)
diff --git a/sysdeps/generic/getitimer.c b/sysdeps/generic/getitimer.c
deleted file mode 100644
index d9f3063e1e..0000000000
--- a/sysdeps/generic/getitimer.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <errno.h>
-#include <sys/time.h>
-
-/* Set *VALUE to the current setting of timer WHICH.
-   Return 0 on success, -1 on errors.  */
-int
-__getitimer (which, value)
-     enum __itimer_which which;
-     struct itimerval *value;
-{
-  if (value == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getitimer)
-
-weak_alias (__getitimer, getitimer)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getloadavg.c b/sysdeps/generic/getloadavg.c
deleted file mode 100644
index 070c879fd5..0000000000
--- a/sysdeps/generic/getloadavg.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Get system load averages.  Stub version.
-   Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-
-/* Put the 1 minute, 5 minute and 15 minute load averages
-   into the first NELEM elements of LOADAVG.
-   Return the number written (never more than 3, but may be less than NELEM),
-   or -1 if an error occurred.  */
-
-int
-getloadavg (double loadavg[], int nelem)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getloadavg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getlogin.c b/sysdeps/generic/getlogin.c
deleted file mode 100644
index 12b4283396..0000000000
--- a/sysdeps/generic/getlogin.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <errno.h>
-#include <unistd.h>
-
-/* Return the login name of the user, or NULL if it can't be determined.
-   The returned pointer, if not NULL, is good only until the next call.  */
-char *
-getlogin (void)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-
-stub_warning (getlogin)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getlogin_r.c b/sysdeps/generic/getlogin_r.c
deleted file mode 100644
index f2470ee032..0000000000
--- a/sysdeps/generic/getlogin_r.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Reentrant function to return the current login name.  Stub version.
-   Copyright (C) 1996, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Return at most NAME_LEN characters of the login name of the user in NAME.
-   If it cannot be determined or some other error occurred, return the error
-   code.  Otherwise return 0.  */
-int
-getlogin_r (name, name_len)
-     char *name;
-     size_t name_len;
-{
-  __set_errno (ENOSYS);
-  return errno;
-}
-libc_hidden_def (getlogin_r)
-
-stub_warning (getlogin_r)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getmsg.c b/sysdeps/generic/getmsg.c
deleted file mode 100644
index 861a40f677..0000000000
--- a/sysdeps/generic/getmsg.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stropts.h>
-
-int
-getmsg (fildes, ctlptr, dataptr, flagsp)
-     int fildes;
-     struct strbuf *ctlptr;
-     struct strbuf *dataptr;
-     int *flagsp;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (getmsg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getpagesize.c b/sysdeps/generic/getpagesize.c
deleted file mode 100644
index 40ed1ee2b1..0000000000
--- a/sysdeps/generic/getpagesize.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Return the system page size.  */
-int
-__getpagesize ()
-{
-  __set_errno (ENOSYS);
-  return 0;
-}
-libc_hidden_def (__getpagesize)
-stub_warning (getpagesize)
-
-weak_alias (__getpagesize, getpagesize)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getpeername.c b/sysdeps/generic/getpeername.c
deleted file mode 100644
index 6507387bd1..0000000000
--- a/sysdeps/generic/getpeername.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Put the address of the peer connected to socket FD into *ADDR
-   (which is *LEN bytes long), and its actual length into *LEN.  */
-int
-getpeername (fd, addr, len)
-     int fd;
-     __SOCKADDR_ARG addr;
-     socklen_t *len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (getpeername)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getpgid.c b/sysdeps/generic/getpgid.c
deleted file mode 100644
index ad46771d2f..0000000000
--- a/sysdeps/generic/getpgid.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Get the process group ID of process PID.  */
-pid_t
-__getpgid (pid)
-     pid_t pid;
-{
-  return pid;
-}
-libc_hidden_def (__getpgid)
-weak_alias (__getpgid, getpgid)
-
-stub_warning (getpgid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getpgrp.c b/sysdeps/generic/getpgrp.c
deleted file mode 100644
index 85efc2f215..0000000000
--- a/sysdeps/generic/getpgrp.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1991, 1995, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Get the process group ID of the calling process.  */
-pid_t
-getpgrp (void)
-{
-  return __getpgid (0);
-}
diff --git a/sysdeps/generic/getpid.c b/sysdeps/generic/getpid.c
deleted file mode 100644
index c1c91fede7..0000000000
--- a/sysdeps/generic/getpid.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Get the process ID of the calling process.  */
-int
-__getpid ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__getpid)
-stub_warning (getpid)
-
-weak_alias (__getpid, getpid)
-libc_hidden_weak (getpid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getpmsg.c b/sysdeps/generic/getpmsg.c
deleted file mode 100644
index e6e9898e46..0000000000
--- a/sysdeps/generic/getpmsg.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stropts.h>
-
-int
-getpmsg (fildes, ctlptr, dataptr, bandp, flagsp)
-     int fildes;
-     struct strbuf *ctlptr;
-     struct strbuf *dataptr;
-     int *bandp;
-     int *flagsp;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (getpmsg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getppid.c b/sysdeps/generic/getppid.c
deleted file mode 100644
index e00c237496..0000000000
--- a/sysdeps/generic/getppid.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-
-/* Get the parent process ID of the calling process.  */
-int
-__getppid ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getppid)
-
-weak_alias (__getppid, getppid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getpriority.c b/sysdeps/generic/getpriority.c
deleted file mode 100644
index 501c92a08a..0000000000
--- a/sysdeps/generic/getpriority.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2000,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/resource.h>
-
-/* Return the highest priority of any process specified by WHICH and WHO
-   (see <sys/resource.h>); if WHO is zero, the current process, process group,
-   or user (as specified by WHO) is used.  A lower priority number means higher
-   priority.  Priorities range from PRIO_MIN to PRIO_MAX.  */
-int
-getpriority (which, who)
-     enum __priority_which which;
-     id_t who;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (getpriority)
-
-stub_warning (getpriority)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getpt.c b/sysdeps/generic/getpt.c
deleted file mode 100644
index cd7107e5d6..0000000000
--- a/sysdeps/generic/getpt.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1998, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <errno.h>
-
-/* Open the master side of a pseudoterminal and return its file
-   descriptor, or -1 on error. */
-int
-__getpt ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__getpt, getpt)
-
-/* We cannot define posix_openpt in general for BSD systems.  */
-int
-__posix_openpt (oflag)
-     int oflag;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__posix_openpt, posix_openpt)
-
-stub_warning (getpt)
-stub_warning (posix_openpt)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getresgid.c b/sysdeps/generic/getresgid.c
deleted file mode 100644
index d6a9b52957..0000000000
--- a/sysdeps/generic/getresgid.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Fetch the effective group ID, real group ID, and saved-set group ID,
-   of the calling process.  */
-int
-__getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__getresgid)
-stub_warning (getresgid)
-
-weak_alias (__getresgid, getresgid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getresuid.c b/sysdeps/generic/getresuid.c
deleted file mode 100644
index 227d6b7ded..0000000000
--- a/sysdeps/generic/getresuid.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Fetch the effective user ID, real user ID, and saved-set user ID,
-   of the calling process.  */
-int
-__getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__getresuid)
-stub_warning (getresuid)
-
-weak_alias (__getresuid, getresuid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getrlimit.c b/sysdeps/generic/getrlimit.c
deleted file mode 100644
index d4bcadd762..0000000000
--- a/sysdeps/generic/getrlimit.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/resource.h>
-#include <sys/types.h>
-
-/* Put the soft and hard limits for RESOURCE in *RLIMITS.
-   Returns 0 if successful, -1 if not (and sets errno).  */
-int
-__getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__getrlimit, getrlimit)
-
-stub_warning (getrlimit)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getrlimit64.c b/sysdeps/generic/getrlimit64.c
deleted file mode 100644
index dcd67cf56f..0000000000
--- a/sysdeps/generic/getrlimit64.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/resource.h>
-#include <sys/types.h>
-
-/* Put the soft and hard limits for RESOURCE in *RLIMITS.
-   Returns 0 if successful, -1 if not (and sets errno).  */
-int
-getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
-{
-  struct rlimit rlimits32;
-
-  if (__getrlimit (resource, &rlimits32) < 0)
-    return -1;
-
-  if (rlimits32.rlim_cur == RLIM_INFINITY)
-    rlimits->rlim_cur = RLIM64_INFINITY;
-  else
-    rlimits->rlim_cur = rlimits32.rlim_cur;
-  if (rlimits32.rlim_max == RLIM_INFINITY)
-    rlimits->rlim_max = RLIM64_INFINITY;
-  else
-    rlimits->rlim_max = rlimits32.rlim_max;
-
-  return 0;
-}
diff --git a/sysdeps/generic/getrusage.c b/sysdeps/generic/getrusage.c
deleted file mode 100644
index c679855ace..0000000000
--- a/sysdeps/generic/getrusage.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/resource.h>
-#include <errno.h>
-
-/* Return resource usage information on process indicated by WHO
-   and put it in *USAGE.  Returns 0 for success, -1 for failure.  */
-int
-__getrusage (who, usage)
-     enum __rusage_who who;
-     struct rusage *usage;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getrusage)
-
-weak_alias (__getrusage, getrusage)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getsid.c b/sysdeps/generic/getsid.c
deleted file mode 100644
index eb7e60fa42..0000000000
--- a/sysdeps/generic/getsid.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* getsid -- Return session ID of a process.  Stub version.
-   Copyright (C) 1995,96,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-
-pid_t
-getsid (pid_t pid)
-{
-  __set_errno (ENOSYS);
-  return (pid_t) -1;
-}
-libc_hidden_def (getsid)
-stub_warning (getsid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getsockname.c b/sysdeps/generic/getsockname.c
deleted file mode 100644
index b698bdbb7a..0000000000
--- a/sysdeps/generic/getsockname.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Put the local address of FD into *ADDR and its length in *LEN.  */
-int
-__getsockname (fd, addr, len)
-     int fd;
-     __SOCKADDR_ARG addr;
-     socklen_t *len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__getsockname, getsockname)
-
-stub_warning (getsockname)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getsockopt.c b/sysdeps/generic/getsockopt.c
deleted file mode 100644
index 8f4fa89578..0000000000
--- a/sysdeps/generic/getsockopt.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
-   into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
-   actual length.  Returns 0 on success, -1 for errors.  */
-int
-getsockopt (fd, level, optname, optval, optlen)
-     int fd;
-     int level;
-     int optname;
-     void *optval;
-     socklen_t *optlen;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (getsockopt)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getsourcefilter.c b/sysdeps/generic/getsourcefilter.c
deleted file mode 100644
index 373550beb3..0000000000
--- a/sysdeps/generic/getsourcefilter.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Get source filter.  Stub version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <netinet/in.h>
-
-
-int
-getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
-		 socklen_t grouplen, uint32_t *fmode, uint32_t *numsrc,
-		 struct sockaddr_storage *slist)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getsourcefilter)
diff --git a/sysdeps/generic/getsysstats.c b/sysdeps/generic/getsysstats.c
deleted file mode 100644
index bc67e23e79..0000000000
--- a/sysdeps/generic/getsysstats.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* getsysstats - Determine various system internal values, stub version.
-   Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/sysinfo.h>
-
-int
-__get_nprocs_conf ()
-{
-  /* We don't know how to determine the number.  Simply return always 1.  */
-  return 1;
-}
-weak_alias (__get_nprocs_conf, get_nprocs_conf)
-
-link_warning (get_nprocs_conf, "warning: get_nprocs_conf will always return 1")
-
-
-
-int
-__get_nprocs ()
-{
-  /* We don't know how to determine the number.  Simply return always 1.  */
-  return 1;
-}
-weak_alias (__get_nprocs, get_nprocs)
-
-link_warning (get_nprocs, "warning: get_nprocs will always return 1")
-
-
-long int
-__get_phys_pages ()
-{
-  /* We have no general way to determine this value.  */
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__get_phys_pages, get_phys_pages)
-
-stub_warning (get_phys_pages)
-
-
-long int
-__get_avphys_pages ()
-{
-  /* We have no general way to determine this value.  */
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__get_avphys_pages, get_avphys_pages)
-
-stub_warning (get_avphys_pages)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getuid.c b/sysdeps/generic/getuid.c
deleted file mode 100644
index c4ea7e8c98..0000000000
--- a/sysdeps/generic/getuid.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Get the real user ID of the calling process.  */
-uid_t
-__getuid ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (getuid)
-
-weak_alias (__getuid, getuid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/getutmp.c b/sysdeps/generic/getutmp.c
deleted file mode 100644
index 275c1a8738..0000000000
--- a/sysdeps/generic/getutmp.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <utmp.h>
-#include <utmpx.h>
-
-/* Copy the information in UTMPX to UTMP. */
-void
-getutmp (const struct utmpx *utmpx, struct utmp *utmp)
-{
-#if _HAVE_UT_TYPE - 0
-  utmp->ut_type = utmpx->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
-  utmp->ut_pid = utmpx->ut_pid;
-#endif
-  memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
-  memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
-  memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
-  memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
-  utmp->ut_tv = utmpx->ut_tv;
-#else
-  utmp->ut_time = utmpx->ut_time;
-#endif
-}
diff --git a/sysdeps/generic/getutmpx.c b/sysdeps/generic/getutmpx.c
deleted file mode 100644
index 5f53f22e6c..0000000000
--- a/sysdeps/generic/getutmpx.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <utmp.h>
-#include <utmpx.h>
-
-/* Copy the information in UTMP to UTMPX. */
-void
-getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
-{
-  memset (utmpx, 0, sizeof (struct utmpx));
-
-#if _HAVE_UT_TYPE - 0
-  utmpx->ut_type = utmp->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
-  utmpx->ut_pid = utmp->ut_pid;
-#endif
-  memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
-  memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
-  memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
-  memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
-  utmpx->ut_tv = utmp->ut_tv;
-#else
-  utmpx->ut_time = utmp->ut_time;
-#endif
-}
diff --git a/sysdeps/generic/getutxent.c b/sysdeps/generic/getutxent.c
deleted file mode 100644
index 4961dee051..0000000000
--- a/sysdeps/generic/getutxent.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-struct utmpx *
-getutxent (void)
-{
-  return (struct utmpx *) __getutent ();
-}
diff --git a/sysdeps/generic/getutxid.c b/sysdeps/generic/getutxid.c
deleted file mode 100644
index ba9d5b79d8..0000000000
--- a/sysdeps/generic/getutxid.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-struct utmpx *
-getutxid (const struct utmpx *id)
-{
-  return (struct utmpx *) __getutid ((const struct utmp *) id);
-}
diff --git a/sysdeps/generic/getutxline.c b/sysdeps/generic/getutxline.c
deleted file mode 100644
index 74149534c4..0000000000
--- a/sysdeps/generic/getutxline.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-struct utmpx *
-getutxline (const struct utmpx *line)
-{
-  return (struct utmpx *) __getutline ((const struct utmp *) line);
-}
diff --git a/sysdeps/generic/getxattr.c b/sysdeps/generic/getxattr.c
deleted file mode 100644
index ebf7bf2b4d..0000000000
--- a/sysdeps/generic/getxattr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-ssize_t
-getxattr (const char *__path, const char *__name,
-	  void *__value, size_t __size)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (getxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c
deleted file mode 100644
index c0e76b377e..0000000000
--- a/sysdeps/generic/glob.c
+++ /dev/null
@@ -1,1558 +0,0 @@
-/* Copyright (C) 1991-2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* AIX requires this to be the first thing in the file.  */
-#if defined _AIX && !defined __GNUC__
- #pragma alloca
-#endif
-
-#ifdef	HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-/* Enable GNU extensions in glob.h.  */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE	1
-#endif
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* Outcomment the following line for production quality code.  */
-/* #define NDEBUG 1 */
-#include <assert.h>
-
-#include <stdio.h>		/* Needed on stupid SunOS for assert.  */
-
-
-/* Comment out all this code if we are using the GNU C Library, and are not
-   actually compiling the library itself.  This code is part of the GNU C
-   Library, but also included in many other GNU distributions.  Compiling
-   and linking in this code is a waste when using the GNU C library
-   (especially if it is a shared library).  Rather than having every GNU
-   program understand `configure --with-gnu-libc' and omit the object files,
-   it is simpler to just do this in the source for each such file.  */
-
-#define GLOB_INTERFACE_VERSION 1
-#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
-# include <gnu-versions.h>
-# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
-#  define ELIDE_CODE
-# endif
-#endif
-
-#ifndef ELIDE_CODE
-#if !defined _LIBC || !defined GLOB_ONLY_P
-
-#if defined STDC_HEADERS || defined __GNU_LIBRARY__
-# include <stddef.h>
-#endif
-
-#if defined HAVE_UNISTD_H || defined _LIBC
-# include <unistd.h>
-# ifndef POSIX
-#  ifdef _POSIX_VERSION
-#   define POSIX
-#  endif
-# endif
-#endif
-
-#if !defined _AMIGA && !defined VMS && !defined WINDOWS32
-# include <pwd.h>
-#endif
-
-#if !defined __GNU_LIBRARY__ && !defined STDC_HEADERS
-extern int errno;
-#endif
-#ifndef __set_errno
-# define __set_errno(val) errno = (val)
-#endif
-
-#ifndef	NULL
-# define NULL	0
-#endif
-
-
-#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
-# ifdef HAVE_SYS_NDIR_H
-#  include <sys/ndir.h>
-# endif
-# ifdef HAVE_SYS_DIR_H
-#  include <sys/dir.h>
-# endif
-# ifdef HAVE_NDIR_H
-#  include <ndir.h>
-# endif
-# ifdef HAVE_VMSDIR_H
-#  include "vmsdir.h"
-# endif /* HAVE_VMSDIR_H */
-#endif
-
-
-/* In GNU systems, <dirent.h> defines this macro for us.  */
-#ifdef _D_NAMLEN
-# undef NAMLEN
-# define NAMLEN(d) _D_NAMLEN(d)
-#endif
-
-/* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
-   if the `d_type' member for `struct dirent' is available.  */
-#ifdef _DIRENT_HAVE_D_TYPE
-# define HAVE_D_TYPE	1
-#endif
-
-#if _LIBC
-# define HAVE_DIRENT64	1
-#endif
-
-/* If the system has the `struct dirent64' type we use it internally.  */
-#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64
-# if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
-#  define CONVERT_D_NAMLEN(d64, d32)
-# else
-#  define CONVERT_D_NAMLEN(d64, d32) \
-  (d64)->d_namlen = (d32)->d_namlen;
-# endif
-
-# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
-#  define CONVERT_D_INO(d64, d32)
-# else
-#  define CONVERT_D_INO(d64, d32) \
-  (d64)->d_ino = (d32)->d_ino;
-# endif
-
-# ifdef HAVE_D_TYPE
-#  define CONVERT_D_TYPE(d64, d32) \
-  (d64)->d_type = (d32)->d_type;
-# else
-#  define CONVERT_D_TYPE(d64, d32)
-# endif
-
-# define CONVERT_DIRENT_DIRENT64(d64, d32) \
-  memcpy ((d64)->d_name, (d32)->d_name, NAMLEN (d32) + 1);		      \
-  CONVERT_D_NAMLEN (d64, d32)						      \
-  CONVERT_D_INO (d64, d32)						      \
-  CONVERT_D_TYPE (d64, d32)
-#endif
-
-
-#if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
-/* Posix does not require that the d_ino field be present, and some
-   systems do not provide it. */
-# define REAL_DIR_ENTRY(dp) 1
-#else
-# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
-#endif /* POSIX */
-
-#if defined STDC_HEADERS || defined __GNU_LIBRARY__
-# include <stdlib.h>
-# include <string.h>
-# define	ANSI_STRING
-#else	/* No standard headers.  */
-
-extern char *getenv ();
-
-# ifdef HAVE_STRING_H
-#  include <string.h>
-#  define ANSI_STRING
-# else
-#  include <strings.h>
-# endif
-# ifdef	HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-
-extern char *malloc (), *realloc ();
-extern void free ();
-
-extern void qsort ();
-extern void abort (), exit ();
-
-#endif	/* Standard headers.  */
-
-/* NAME_MAX is usually defined in <dirent.h> or <limits.h>.  */
-#if defined HAVE_LIMITS_H || defined __GNU_LIBRARY__
-# include <limits.h>
-#endif
-#ifndef NAME_MAX
-# define NAME_MAX (sizeof (((struct dirent *) 0)->d_name))
-#endif
-
-#ifndef	ANSI_STRING
-
-# ifndef bzero
-extern void bzero ();
-# endif
-# ifndef bcopy
-extern void bcopy ();
-# endif
-
-# define memcpy(d, s, n)	bcopy ((s), (d), (n))
-# define strrchr	rindex
-/* memset is only used for zero here, but let's be paranoid.  */
-# define memset(s, better_be_zero, n) \
-  ((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
-#endif	/* Not ANSI_STRING.  */
-
-#if !defined HAVE_STRCOLL && !defined _LIBC
-# define strcoll	strcmp
-#endif
-
-#if !defined HAVE_MEMPCPY && __GLIBC__ - 0 == 2 && __GLIBC_MINOR__ >= 1
-# define HAVE_MEMPCPY	1
-# undef  mempcpy
-# define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
-#endif
-
-#ifndef	__GNU_LIBRARY__
-# ifdef	__GNUC__
-__inline
-# endif
-# ifndef __SASC
-#  ifdef WINDOWS32
-static void *
-#  else
-static char *
-# endif
-my_realloc (p, n)
-     char *p;
-     unsigned int n;
-{
-  /* These casts are the for sake of the broken Ultrix compiler,
-     which warns of illegal pointer combinations otherwise.  */
-  if (p == NULL)
-    return (char *) malloc (n);
-  return (char *) realloc (p, n);
-}
-# define	realloc	my_realloc
-# endif /* __SASC */
-#endif /* __GNU_LIBRARY__ */
-
-
-#if !defined __alloca && !defined __GNU_LIBRARY__
-
-# ifdef	__GNUC__
-#  undef alloca
-#  define alloca(n)	__builtin_alloca (n)
-# else	/* Not GCC.  */
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else	/* Not HAVE_ALLOCA_H.  */
-#   ifndef _AIX
-#    ifdef WINDOWS32
-#     include <malloc.h>
-#    else
-extern char *alloca ();
-#    endif /* WINDOWS32 */
-#   endif /* Not _AIX.  */
-#  endif /* sparc or HAVE_ALLOCA_H.  */
-# endif	/* GCC.  */
-
-# define __alloca	alloca
-
-#endif
-
-#ifndef __GNU_LIBRARY__
-# define __stat stat
-# ifdef STAT_MACROS_BROKEN
-#  undef S_ISDIR
-# endif
-# ifndef S_ISDIR
-#  define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
-# endif
-#endif
-
-#ifdef _LIBC
-# include <alloca.h>
-# undef strdup
-# define strdup(str) __strdup (str)
-# define sysconf(id) __sysconf (id)
-# define closedir(dir) __closedir (dir)
-# define opendir(name) __opendir (name)
-# define readdir(str) __readdir64 (str)
-# define getpwnam_r(name, bufp, buf, len, res) \
-   __getpwnam_r (name, bufp, buf, len, res)
-# ifndef __stat64
-#  define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
-# endif
-# define HAVE_STAT64	1
-#endif
-
-#ifndef HAVE_STAT64
-# define __stat64(fname, buf) __stat (fname, buf)
-/* This is the variable name we are using.  */
-# define st64 st
-#endif
-
-#if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
-# undef	size_t
-# define size_t	unsigned int
-#endif
-
-/* Some system header files erroneously define these.
-   We want our own definitions from <fnmatch.h> to take precedence.  */
-#ifndef __GNU_LIBRARY__
-# undef	FNM_PATHNAME
-# undef	FNM_NOESCAPE
-# undef	FNM_PERIOD
-#endif
-#include <fnmatch.h>
-
-/* Some system header files erroneously define these.
-   We want our own definitions from <glob.h> to take precedence.  */
-#ifndef __GNU_LIBRARY__
-# undef	GLOB_ERR
-# undef	GLOB_MARK
-# undef	GLOB_NOSORT
-# undef	GLOB_DOOFFS
-# undef	GLOB_NOCHECK
-# undef	GLOB_APPEND
-# undef	GLOB_NOESCAPE
-# undef	GLOB_PERIOD
-#endif
-#include <glob.h>
-
-#ifdef HAVE_GETLOGIN_R
-extern int getlogin_r (char *, size_t);
-#else
-extern char *getlogin (void);
-#endif
-
-static const char *next_brace_sub (const char *begin, int flags) __THROW;
-
-#endif /* GLOB_ONLY_P */
-
-static int glob_in_dir (const char *pattern, const char *directory,
-			int flags, int (*errfunc) (const char *, int),
-			glob_t *pglob);
-
-#if !defined _LIBC || !defined GLOB_ONLY_P
-static int prefix_array (const char *prefix, char **array, size_t n) __THROW;
-static int collated_compare (const __ptr_t, const __ptr_t) __THROW;
-
-
-/* Find the end of the sub-pattern in a brace expression.  */
-static const char *
-next_brace_sub (cp, flags)
-     const char *cp;
-     int flags;
-{
-  unsigned int depth = 0;
-  while (*cp != '\0')
-    if ((flags & GLOB_NOESCAPE) == 0 && *cp == '\\')
-      {
-	if (*++cp == '\0')
-	  break;
-	++cp;
-      }
-    else
-      {
-	if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0))
-	  break;
-
-	if (*cp++ == '{')
-	  depth++;
-      }
-
-  return *cp != '\0' ? cp : NULL;
-}
-
-#endif /* !GLOB_ONLY_P */
-
-/* Do glob searching for PATTERN, placing results in PGLOB.
-   The bits defined above may be set in FLAGS.
-   If a directory cannot be opened or read and ERRFUNC is not nil,
-   it is called with the pathname that caused the error, and the
-   `errno' value from the failing call; if it returns non-zero
-   `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
-   If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
-   Otherwise, `glob' returns zero.  */
-int
-#ifdef GLOB_ATTRIBUTE
-GLOB_ATTRIBUTE
-#endif
-glob (pattern, flags, errfunc, pglob)
-     const char *pattern;
-     int flags;
-     int (*errfunc) (const char *, int);
-     glob_t *pglob;
-{
-  const char *filename;
-  const char *dirname;
-  size_t dirlen;
-  int status;
-  size_t oldcount;
-
-  if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (!(flags & GLOB_DOOFFS))
-    /* Have to do this so `globfree' knows where to start freeing.  It
-       also makes all the code that uses gl_offs simpler. */
-    pglob->gl_offs = 0;
-
-  if (flags & GLOB_BRACE)
-    {
-      const char *begin;
-
-      if (flags & GLOB_NOESCAPE)
-	begin = strchr (pattern, '{');
-      else
-	{
-	  begin = pattern;
-	  while (1)
-	    {
-	      if (*begin == '\0')
-		{
-		  begin = NULL;
-		  break;
-		}
-
-	      if (*begin == '\\' && begin[1] != '\0')
-		++begin;
-	      else if (*begin == '{')
-		break;
-
-	      ++begin;
-	    }
-	}
-
-      if (begin != NULL)
-	{
-	  /* Allocate working buffer large enough for our work.  Note that
-	    we have at least an opening and closing brace.  */
-	  size_t firstc;
-	  char *alt_start;
-	  const char *p;
-	  const char *next;
-	  const char *rest;
-	  size_t rest_len;
-#ifdef __GNUC__
-	  char onealt[strlen (pattern) - 1];
-#else
-	  char *onealt = (char *) malloc (strlen (pattern) - 1);
-	  if (onealt == NULL)
-	    {
-	      if (!(flags & GLOB_APPEND))
-		{
-		  pglob->gl_pathc = 0;
-		  pglob->gl_pathv = NULL;
-		}
-	      return GLOB_NOSPACE;
-	    }
-#endif
-
-	  /* We know the prefix for all sub-patterns.  */
-#ifdef HAVE_MEMPCPY
-	  alt_start = mempcpy (onealt, pattern, begin - pattern);
-#else
-	  memcpy (onealt, pattern, begin - pattern);
-	  alt_start = &onealt[begin - pattern];
-#endif
-
-	  /* Find the first sub-pattern and at the same time find the
-	     rest after the closing brace.  */
-	  next = next_brace_sub (begin + 1, flags);
-	  if (next == NULL)
-	    {
-	      /* It is an illegal expression.  */
-#ifndef __GNUC__
-	      free (onealt);
-#endif
-	      return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
-	    }
-
-	  /* Now find the end of the whole brace expression.  */
-	  rest = next;
-	  while (*rest != '}')
-	    {
-	      rest = next_brace_sub (rest + 1, flags);
-	      if (rest == NULL)
-		{
-		  /* It is an illegal expression.  */
-#ifndef __GNUC__
-		  free (onealt);
-#endif
-		  return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
-		}
-	    }
-	  /* Please note that we now can be sure the brace expression
-	     is well-formed.  */
-	  rest_len = strlen (++rest) + 1;
-
-	  /* We have a brace expression.  BEGIN points to the opening {,
-	     NEXT points past the terminator of the first element, and END
-	     points past the final }.  We will accumulate result names from
-	     recursive runs for each brace alternative in the buffer using
-	     GLOB_APPEND.  */
-
-	  if (!(flags & GLOB_APPEND))
-	    {
-	      /* This call is to set a new vector, so clear out the
-		 vector so we can append to it.  */
-	      pglob->gl_pathc = 0;
-	      pglob->gl_pathv = NULL;
-	    }
-	  firstc = pglob->gl_pathc;
-
-	  p = begin + 1;
-	  while (1)
-	    {
-	      int result;
-
-	      /* Construct the new glob expression.  */
-#ifdef HAVE_MEMPCPY
-	      mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len);
-#else
-	      memcpy (alt_start, p, next - p);
-	      memcpy (&alt_start[next - p], rest, rest_len);
-#endif
-
-	      result = glob (onealt,
-			     ((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC))
-			      | GLOB_APPEND), errfunc, pglob);
-
-	      /* If we got an error, return it.  */
-	      if (result && result != GLOB_NOMATCH)
-		{
-#ifndef __GNUC__
-		  free (onealt);
-#endif
-		  if (!(flags & GLOB_APPEND))
-		    {
-		      globfree (pglob);
-		      pglob->gl_pathc = 0;
-		    }
-		  return result;
-		}
-
-	      if (*next == '}')
-		/* We saw the last entry.  */
-		break;
-
-	      p = next + 1;
-	      next = next_brace_sub (p, flags);
-	      assert (next != NULL);
-	    }
-
-#ifndef __GNUC__
-	  free (onealt);
-#endif
-
-	  if (pglob->gl_pathc != firstc)
-	    /* We found some entries.  */
-	    return 0;
-	  else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
-	    return GLOB_NOMATCH;
-	}
-    }
-
-  /* Find the filename.  */
-  filename = strrchr (pattern, '/');
-#if defined __MSDOS__ || defined WINDOWS32
-  /* The case of "d:pattern".  Since `:' is not allowed in
-     file names, we can safely assume that wherever it
-     happens in pattern, it signals the filename part.  This
-     is so we could some day support patterns like "[a-z]:foo".  */
-  if (filename == NULL)
-    filename = strchr (pattern, ':');
-#endif /* __MSDOS__ || WINDOWS32 */
-  if (filename == NULL)
-    {
-      /* This can mean two things: a simple name or "~name".  The latter
-	 case is nothing but a notation for a directory.  */
-      if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~')
-	{
-	  dirname = pattern;
-	  dirlen = strlen (pattern);
-
-	  /* Set FILENAME to NULL as a special flag.  This is ugly but
-	     other solutions would require much more code.  We test for
-	     this special case below.  */
-	  filename = NULL;
-	}
-      else
-	{
-	  filename = pattern;
-#ifdef _AMIGA
-	  dirname = "";
-#else
-	  dirname = ".";
-#endif
-	  dirlen = 0;
-	}
-    }
-  else if (filename == pattern)
-    {
-      /* "/pattern".  */
-      dirname = "/";
-      dirlen = 1;
-      ++filename;
-    }
-  else
-    {
-      char *newp;
-      dirlen = filename - pattern;
-#if defined __MSDOS__ || defined WINDOWS32
-      if (*filename == ':'
-	  || (filename > pattern + 1 && filename[-1] == ':'))
-	{
-	  char *drive_spec;
-
-	  ++dirlen;
-	  drive_spec = (char *) __alloca (dirlen + 1);
-#ifdef HAVE_MEMPCPY
-	  *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0';
-#else
-	  memcpy (drive_spec, pattern, dirlen);
-	  drive_spec[dirlen] = '\0';
-#endif
-	  /* For now, disallow wildcards in the drive spec, to
-	     prevent infinite recursion in glob.  */
-	  if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE)))
-	    return GLOB_NOMATCH;
-	  /* If this is "d:pattern", we need to copy `:' to DIRNAME
-	     as well.  If it's "d:/pattern", don't remove the slash
-	     from "d:/", since "d:" and "d:/" are not the same.*/
-	}
-#endif
-      newp = (char *) __alloca (dirlen + 1);
-#ifdef HAVE_MEMPCPY
-      *((char *) mempcpy (newp, pattern, dirlen)) = '\0';
-#else
-      memcpy (newp, pattern, dirlen);
-      newp[dirlen] = '\0';
-#endif
-      dirname = newp;
-      ++filename;
-
-      if (filename[0] == '\0'
-#if defined __MSDOS__ || defined WINDOWS32
-          && dirname[dirlen - 1] != ':'
-	  && (dirlen < 3 || dirname[dirlen - 2] != ':'
-	      || dirname[dirlen - 1] != '/')
-#endif
-	  && dirlen > 1)
-	/* "pattern/".  Expand "pattern", appending slashes.  */
-	{
-	  int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
-	  if (val == 0)
-	    pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
-			       | (flags & GLOB_MARK));
-	  return val;
-	}
-    }
-
-  if (!(flags & GLOB_APPEND))
-    {
-      pglob->gl_pathc = 0;
-      if (!(flags & GLOB_DOOFFS))
-        pglob->gl_pathv = NULL;
-      else
-	{
-	  size_t i;
-	  pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1)
-					      * sizeof (char *));
-	  if (pglob->gl_pathv == NULL)
-	    return GLOB_NOSPACE;
-
-	  for (i = 0; i <= pglob->gl_offs; ++i)
-	    pglob->gl_pathv[i] = NULL;
-	}
-    }
-
-  oldcount = pglob->gl_pathc + pglob->gl_offs;
-
-#ifndef VMS
-  if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~')
-    {
-      if (dirname[1] == '\0' || dirname[1] == '/')
-	{
-	  /* Look up home directory.  */
-	  const char *home_dir = getenv ("HOME");
-# ifdef _AMIGA
-	  if (home_dir == NULL || home_dir[0] == '\0')
-	    home_dir = "SYS:";
-# else
-#  ifdef WINDOWS32
-	  if (home_dir == NULL || home_dir[0] == '\0')
-            home_dir = "c:/users/default"; /* poor default */
-#  else
-	  if (home_dir == NULL || home_dir[0] == '\0')
-	    {
-	      int success;
-	      char *name;
-#   if defined HAVE_GETLOGIN_R || defined _LIBC
-	      size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
-
-	      if (buflen == 0)
-		/* `sysconf' does not support _SC_LOGIN_NAME_MAX.  Try
-		   a moderate value.  */
-		buflen = 20;
-	      name = (char *) __alloca (buflen);
-
-	      success = getlogin_r (name, buflen) >= 0;
-#   else
-	      success = (name = getlogin ()) != NULL;
-#   endif
-	      if (success)
-		{
-		  struct passwd *p;
-#   if defined HAVE_GETPWNAM_R || defined _LIBC
-		  long int pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
-		  char *pwtmpbuf;
-		  struct passwd pwbuf;
-		  int save = errno;
-
-#    ifndef _LIBC
-		  if (pwbuflen == -1)
-		    /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
-		       Try a moderate value.  */
-		    pwbuflen = 1024;
-#    endif
-		  pwtmpbuf = (char *) __alloca (pwbuflen);
-
-		  while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
-			 != 0)
-		    {
-		      if (errno != ERANGE)
-			{
-			  p = NULL;
-			  break;
-			}
-#    ifdef _LIBC
-		      pwtmpbuf = extend_alloca (pwtmpbuf, pwbuflen,
-						2 * pwbuflen);
-#    else
-		      pwbuflen *= 2;
-		      pwtmpbuf = (char *) __alloca (pwbuflen);
-#    endif
-		      __set_errno (save);
-		    }
-#   else
-		  p = getpwnam (name);
-#   endif
-		  if (p != NULL)
-		    home_dir = p->pw_dir;
-		}
-	    }
-	  if (home_dir == NULL || home_dir[0] == '\0')
-	    {
-	      if (flags & GLOB_TILDE_CHECK)
-		return GLOB_NOMATCH;
-	      else
-		home_dir = "~"; /* No luck.  */
-	    }
-#  endif /* WINDOWS32 */
-# endif
-	  /* Now construct the full directory.  */
-	  if (dirname[1] == '\0')
-	    dirname = home_dir;
-	  else
-	    {
-	      char *newp;
-	      size_t home_len = strlen (home_dir);
-	      newp = (char *) __alloca (home_len + dirlen);
-# ifdef HAVE_MEMPCPY
-	      mempcpy (mempcpy (newp, home_dir, home_len),
-		       &dirname[1], dirlen);
-# else
-	      memcpy (newp, home_dir, home_len);
-	      memcpy (&newp[home_len], &dirname[1], dirlen);
-# endif
-	      dirname = newp;
-	    }
-	}
-# if !defined _AMIGA && !defined WINDOWS32
-      else
-	{
-	  char *end_name = strchr (dirname, '/');
-	  const char *user_name;
-	  const char *home_dir;
-
-	  if (end_name == NULL)
-	    user_name = dirname + 1;
-	  else
-	    {
-	      char *newp;
-	      newp = (char *) __alloca (end_name - dirname);
-# ifdef HAVE_MEMPCPY
-	      *((char *) mempcpy (newp, dirname + 1, end_name - dirname))
-		= '\0';
-# else
-	      memcpy (newp, dirname + 1, end_name - dirname);
-	      newp[end_name - dirname - 1] = '\0';
-# endif
-	      user_name = newp;
-	    }
-
-	  /* Look up specific user's home directory.  */
-	  {
-	    struct passwd *p;
-#  if defined HAVE_GETPWNAM_R || defined _LIBC
-	    long int buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
-	    char *pwtmpbuf;
-	    struct passwd pwbuf;
-	    int save = errno;
-
-#   ifndef _LIBC
-	    if (buflen == -1)
-	      /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.  Try a
-		 moderate value.  */
-	      buflen = 1024;
-#   endif
-	    pwtmpbuf = (char *) __alloca (buflen);
-
-	    while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0)
-	      {
-		if (errno != ERANGE)
-		  {
-		    p = NULL;
-		    break;
-		  }
-#   ifdef _LIBC
-		pwtmpbuf = extend_alloca (pwtmpbuf, buflen, 2 * buflen);
-#   else
-		buflen *= 2;
-		pwtmpbuf = __alloca (buflen);
-#   endif
-		__set_errno (save);
-	      }
-#  else
-	    p = getpwnam (user_name);
-#  endif
-	    if (p != NULL)
-	      home_dir = p->pw_dir;
-	    else
-	      home_dir = NULL;
-	  }
-	  /* If we found a home directory use this.  */
-	  if (home_dir != NULL)
-	    {
-	      char *newp;
-	      size_t home_len = strlen (home_dir);
-	      size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
-	      newp = (char *) __alloca (home_len + rest_len + 1);
-#  ifdef HAVE_MEMPCPY
-	      *((char *) mempcpy (mempcpy (newp, home_dir, home_len),
-				  end_name, rest_len)) = '\0';
-#  else
-	      memcpy (newp, home_dir, home_len);
-	      memcpy (&newp[home_len], end_name, rest_len);
-	      newp[home_len + rest_len] = '\0';
-#  endif
-	      dirname = newp;
-	    }
-	  else
-	    if (flags & GLOB_TILDE_CHECK)
-	      /* We have to regard it as an error if we cannot find the
-		 home directory.  */
-	      return GLOB_NOMATCH;
-	}
-# endif	/* Not Amiga && not WINDOWS32.  */
-    }
-#endif	/* Not VMS.  */
-
-  /* Now test whether we looked for "~" or "~NAME".  In this case we
-     can give the answer now.  */
-  if (filename == NULL)
-    {
-      struct stat st;
-#ifdef HAVE_STAT64
-      struct stat64 st64;
-#endif
-
-      /* Return the directory if we don't check for error or if it exists.  */
-      if ((flags & GLOB_NOCHECK)
-	  || (((flags & GLOB_ALTDIRFUNC)
-	       ? ((*pglob->gl_stat) (dirname, &st) == 0
-		  && S_ISDIR (st.st_mode))
-	       : (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode)))))
-	{
-	  int newcount = pglob->gl_pathc + pglob->gl_offs;
-	  char **new_gl_pathv;
-
-	  new_gl_pathv
-	    = (char **) realloc (pglob->gl_pathv,
-				 (newcount + 1 + 1) * sizeof (char *));
-	  if (new_gl_pathv == NULL)
-	    {
-	    nospace:
-	      free (pglob->gl_pathv);
-	      pglob->gl_pathv = NULL;
-	      pglob->gl_pathc = 0;
-	      return GLOB_NOSPACE;
-	    }
-	  pglob->gl_pathv = new_gl_pathv;
-
-#if defined HAVE_STRDUP || defined _LIBC
-	   pglob->gl_pathv[newcount] = strdup (dirname);
-#else
-	  {
-	    size_t len = strlen (dirname) + 1;
-	    char *dircopy = (char *) malloc (len);
-	    if (dircopy != NULL)
-	      pglob->gl_pathv[newcount] = memcpy (dircopy, dirname, len);
-	  }
-#endif
-	  if (pglob->gl_pathv[newcount] == NULL)
-	    goto nospace;
-	  pglob->gl_pathv[++newcount] = NULL;
-	  ++pglob->gl_pathc;
-	  pglob->gl_flags = flags;
-
-	  return 0;
-	}
-
-      /* Not found.  */
-      return GLOB_NOMATCH;
-    }
-
-  if (__glob_pattern_p (dirname, !(flags & GLOB_NOESCAPE)))
-    {
-      /* The directory name contains metacharacters, so we
-	 have to glob for the directory, and then glob for
-	 the pattern in each directory found.  */
-      glob_t dirs;
-      size_t i;
-
-      if ((flags & GLOB_ALTDIRFUNC) != 0)
-	{
-	  /* Use the alternative access functions also in the recursive
-	     call.  */
-	  dirs.gl_opendir = pglob->gl_opendir;
-	  dirs.gl_readdir = pglob->gl_readdir;
-	  dirs.gl_closedir = pglob->gl_closedir;
-	  dirs.gl_stat = pglob->gl_stat;
-	  dirs.gl_lstat = pglob->gl_lstat;
-	}
-
-      status = glob (dirname,
-		     ((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE
-				| GLOB_ALTDIRFUNC))
-		      | GLOB_NOSORT | GLOB_ONLYDIR),
-		     errfunc, &dirs);
-      if (status != 0)
-	return status;
-
-      /* We have successfully globbed the preceding directory name.
-	 For each name we found, call glob_in_dir on it and FILENAME,
-	 appending the results to PGLOB.  */
-      for (i = 0; i < dirs.gl_pathc; ++i)
-	{
-	  int old_pathc;
-
-#ifdef	SHELL
-	  {
-	    /* Make globbing interruptible in the bash shell. */
-	    extern int interrupt_state;
-
-	    if (interrupt_state)
-	      {
-		globfree (&dirs);
-		return GLOB_ABORTED;
-	      }
-	  }
-#endif /* SHELL.  */
-
-	  old_pathc = pglob->gl_pathc;
-	  status = glob_in_dir (filename, dirs.gl_pathv[i],
-				((flags | GLOB_APPEND)
-				 & ~(GLOB_NOCHECK | GLOB_NOMAGIC)),
-				errfunc, pglob);
-	  if (status == GLOB_NOMATCH)
-	    /* No matches in this directory.  Try the next.  */
-	    continue;
-
-	  if (status != 0)
-	    {
-	      globfree (&dirs);
-	      globfree (pglob);
-	      pglob->gl_pathc = 0;
-	      return status;
-	    }
-
-	  /* Stick the directory on the front of each name.  */
-	  if (prefix_array (dirs.gl_pathv[i],
-			    &pglob->gl_pathv[old_pathc + pglob->gl_offs],
-			    pglob->gl_pathc - old_pathc))
-	    {
-	      globfree (&dirs);
-	      globfree (pglob);
-	      pglob->gl_pathc = 0;
-	      return GLOB_NOSPACE;
-	    }
-	}
-
-      flags |= GLOB_MAGCHAR;
-
-      /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls.
-	 But if we have not found any matching entry and the GLOB_NOCHECK
-	 flag was set we must return the input pattern itself.  */
-      if (pglob->gl_pathc + pglob->gl_offs == oldcount)
-	{
-	  /* No matches.  */
-	  if (flags & GLOB_NOCHECK)
-	    {
-	      int newcount = pglob->gl_pathc + pglob->gl_offs;
-	      char **new_gl_pathv;
-
-	      new_gl_pathv = (char **) realloc (pglob->gl_pathv,
-						(newcount + 2)
-						* sizeof (char *));
-	      if (new_gl_pathv == NULL)
-		{
-		  globfree (&dirs);
-		  return GLOB_NOSPACE;
-		}
-	      pglob->gl_pathv = new_gl_pathv;
-
-	      pglob->gl_pathv[newcount] = __strdup (pattern);
-	      if (pglob->gl_pathv[newcount] == NULL)
-		{
-		  globfree (&dirs);
-		  globfree (pglob);
-		  pglob->gl_pathc = 0;
-		  return GLOB_NOSPACE;
-		}
-
-	      ++pglob->gl_pathc;
-	      ++newcount;
-
-	      pglob->gl_pathv[newcount] = NULL;
-	      pglob->gl_flags = flags;
-	    }
-	  else
-	    {
-	      globfree (&dirs);
-	      return GLOB_NOMATCH;
-	    }
-	}
-
-      globfree (&dirs);
-    }
-  else
-    {
-      int old_pathc = pglob->gl_pathc;
-
-      status = glob_in_dir (filename, dirname, flags, errfunc, pglob);
-      if (status != 0)
-	return status;
-
-      if (dirlen > 0)
-	{
-	  /* Stick the directory on the front of each name.  */
-	  if (prefix_array (dirname,
-			    &pglob->gl_pathv[old_pathc + pglob->gl_offs],
-			    pglob->gl_pathc - old_pathc))
-	    {
-	      globfree (pglob);
-	      pglob->gl_pathc = 0;
-	      return GLOB_NOSPACE;
-	    }
-	}
-    }
-
-  if (flags & GLOB_MARK)
-    {
-      /* Append slashes to directory names.  */
-      size_t i;
-      struct stat st;
-#ifdef HAVE_STAT64
-      struct stat64 st64;
-#endif
-
-      for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; ++i)
-	if (((flags & GLOB_ALTDIRFUNC)
-	     ? ((*pglob->gl_stat) (pglob->gl_pathv[i], &st) == 0
-		&& S_ISDIR (st.st_mode))
-	     : (__stat64 (pglob->gl_pathv[i], &st64) == 0
-		&& S_ISDIR (st64.st_mode))))
-	  {
- 	    size_t len = strlen (pglob->gl_pathv[i]) + 2;
-	    char *new = realloc (pglob->gl_pathv[i], len);
- 	    if (new == NULL)
-	      {
-		globfree (pglob);
-		pglob->gl_pathc = 0;
-		return GLOB_NOSPACE;
-	      }
-	    strcpy (&new[len - 2], "/");
-	    pglob->gl_pathv[i] = new;
-	  }
-    }
-
-  if (!(flags & GLOB_NOSORT))
-    {
-      /* Sort the vector.  */
-      qsort ((__ptr_t) &pglob->gl_pathv[oldcount],
-	     pglob->gl_pathc + pglob->gl_offs - oldcount,
-	     sizeof (char *), collated_compare);
-    }
-
-  return 0;
-}
-#if defined _LIBC && !defined glob
-libc_hidden_def (glob)
-#endif
-
-
-#if !defined _LIBC || !defined GLOB_ONLY_P
-
-/* Free storage allocated in PGLOB by a previous `glob' call.  */
-void
-globfree (pglob)
-     register glob_t *pglob;
-{
-  if (pglob->gl_pathv != NULL)
-    {
-      size_t i;
-      for (i = 0; i < pglob->gl_pathc; ++i)
-	if (pglob->gl_pathv[pglob->gl_offs + i] != NULL)
-	  free ((__ptr_t) pglob->gl_pathv[pglob->gl_offs + i]);
-      free ((__ptr_t) pglob->gl_pathv);
-      pglob->gl_pathv = NULL;
-    }
-}
-#if defined _LIBC && !defined globfree
-libc_hidden_def (globfree)
-#endif
-
-
-/* Do a collated comparison of A and B.  */
-static int
-collated_compare (a, b)
-     const __ptr_t a;
-     const __ptr_t b;
-{
-  const char *const s1 = *(const char *const * const) a;
-  const char *const s2 = *(const char *const * const) b;
-
-  if (s1 == s2)
-    return 0;
-  if (s1 == NULL)
-    return 1;
-  if (s2 == NULL)
-    return -1;
-  return strcoll (s1, s2);
-}
-
-
-/* Prepend DIRNAME to each of N members of ARRAY, replacing ARRAY's
-   elements in place.  Return nonzero if out of memory, zero if successful.
-   A slash is inserted between DIRNAME and each elt of ARRAY,
-   unless DIRNAME is just "/".  Each old element of ARRAY is freed.  */
-static int
-prefix_array (dirname, array, n)
-     const char *dirname;
-     char **array;
-     size_t n;
-{
-  register size_t i;
-  size_t dirlen = strlen (dirname);
-#if defined __MSDOS__ || defined WINDOWS32
-  int sep_char = '/';
-# define DIRSEP_CHAR sep_char
-#else
-# define DIRSEP_CHAR '/'
-#endif
-
-  if (dirlen == 1 && dirname[0] == '/')
-    /* DIRNAME is just "/", so normal prepending would get us "//foo".
-       We want "/foo" instead, so don't prepend any chars from DIRNAME.  */
-    dirlen = 0;
-#if defined __MSDOS__ || defined WINDOWS32
-  else if (dirlen > 1)
-    {
-      if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
-	/* DIRNAME is "d:/".  Don't prepend the slash from DIRNAME.  */
-	--dirlen;
-      else if (dirname[dirlen - 1] == ':')
-	{
-	  /* DIRNAME is "d:".  Use `:' instead of `/'.  */
-	  --dirlen;
-	  sep_char = ':';
-	}
-    }
-#endif
-
-  for (i = 0; i < n; ++i)
-    {
-      size_t eltlen = strlen (array[i]) + 1;
-      char *new = (char *) malloc (dirlen + 1 + eltlen);
-      if (new == NULL)
-	{
-	  while (i > 0)
-	    free ((__ptr_t) array[--i]);
-	  return 1;
-	}
-
-#ifdef HAVE_MEMPCPY
-      {
-	char *endp = (char *) mempcpy (new, dirname, dirlen);
-	*endp++ = DIRSEP_CHAR;
-	mempcpy (endp, array[i], eltlen);
-      }
-#else
-      memcpy (new, dirname, dirlen);
-      new[dirlen] = DIRSEP_CHAR;
-      memcpy (&new[dirlen + 1], array[i], eltlen);
-#endif
-      free ((__ptr_t) array[i]);
-      array[i] = new;
-    }
-
-  return 0;
-}
-
-
-/* We must not compile this function twice.  */
-#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
-/* Return nonzero if PATTERN contains any metacharacters.
-   Metacharacters can be quoted with backslashes if QUOTE is nonzero.  */
-int
-__glob_pattern_p (pattern, quote)
-     const char *pattern;
-     int quote;
-{
-  register const char *p;
-  int open = 0;
-
-  for (p = pattern; *p != '\0'; ++p)
-    switch (*p)
-      {
-      case '?':
-      case '*':
-	return 1;
-
-      case '\\':
-	if (quote && p[1] != '\0')
-	  ++p;
-	break;
-
-      case '[':
-	open = 1;
-	break;
-
-      case ']':
-	if (open)
-	  return 1;
-	break;
-      }
-
-  return 0;
-}
-# ifdef _LIBC
-weak_alias (__glob_pattern_p, glob_pattern_p)
-# endif
-#endif
-
-#endif /* !GLOB_ONLY_P */
-
-
-/* We put this in a separate function mainly to allow the memory
-   allocated with alloca to be recycled.  */
-#if !defined _LIBC || !defined GLOB_ONLY_P
-static int
-link_exists_p (const char *dir, size_t dirlen, const char *fname,
-	       glob_t *pglob, int flags)
-{
-  size_t fnamelen = strlen (fname);
-  char *fullname = (char *) __alloca (dirlen + 1 + fnamelen + 1);
-  struct stat st;
-  struct stat64 st64;
-
-# ifdef HAVE_MEMPCPY
-  mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1),
-	   fname, fnamelen + 1);
-# else
-  memcpy (fullname, dir, dirlen);
-  fullname[dirlen] = '/';
-  memcpy (&fullname[dirlen + 1], fname, fnamelen + 1);
-# endif
-
-  return (((flags & GLOB_ALTDIRFUNC)
-	   ? (*pglob->gl_stat) (fullname, &st)
-	   : __stat64 (fullname, &st64)) == 0);
-}
-#endif
-
-
-/* Like `glob', but PATTERN is a final pathname component,
-   and matches are searched for in DIRECTORY.
-   The GLOB_NOSORT bit in FLAGS is ignored.  No sorting is ever done.
-   The GLOB_APPEND flag is assumed to be set (always appends).  */
-static int
-glob_in_dir (pattern, directory, flags, errfunc, pglob)
-     const char *pattern;
-     const char *directory;
-     int flags;
-     int (*errfunc) (const char *, int);
-     glob_t *pglob;
-{
-  size_t dirlen = strlen (directory);
-  __ptr_t stream = NULL;
-  struct globlink
-    {
-      struct globlink *next;
-      char *name;
-    };
-  struct globlink *names = NULL;
-  size_t nfound;
-  int meta;
-  int save;
-
-  meta = __glob_pattern_p (pattern, !(flags & GLOB_NOESCAPE));
-  if (meta == 0 && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
-    {
-      /* We need not do any tests.  The PATTERN contains no meta
-	 characters and we must not return an error therefore the
-	 result will always contain exactly one name.  */
-      flags |= GLOB_NOCHECK;
-      nfound = 0;
-    }
-  else if (meta == 0 &&
-	   ((flags & GLOB_NOESCAPE) || strchr (pattern, '\\') == NULL))
-    {
-      /* Since we use the normal file functions we can also use stat()
-	 to verify the file is there.  */
-      struct stat st;
-# ifdef HAVE_STAT64
-      struct stat64 st64;
-# endif
-      size_t patlen = strlen (pattern);
-      char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1);
-
-# ifdef HAVE_MEMPCPY
-      mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
-			"/", 1),
-	       pattern, patlen + 1);
-# else
-      memcpy (fullname, directory, dirlen);
-      fullname[dirlen] = '/';
-      memcpy (&fullname[dirlen + 1], pattern, patlen + 1);
-# endif
-      if (((flags & GLOB_ALTDIRFUNC)
-	   ? (*pglob->gl_stat) (fullname, &st)
-	   : __stat64 (fullname, &st64)) == 0)
-	/* We found this file to be existing.  Now tell the rest
-	   of the function to copy this name into the result.  */
-	flags |= GLOB_NOCHECK;
-
-      nfound = 0;
-    }
-  else
-    {
-      if (pattern[0] == '\0')
-	{
-	  /* This is a special case for matching directories like in
-	     "*a/".  */
-	  names = (struct globlink *) __alloca (sizeof (struct globlink));
-	  names->name = (char *) malloc (1);
-	  if (names->name == NULL)
-	    goto memory_error;
-	  names->name[0] = '\0';
-	  names->next = NULL;
-	  nfound = 1;
-	  meta = 0;
-	}
-      else
-	{
-	  stream = ((flags & GLOB_ALTDIRFUNC)
-		    ? (*pglob->gl_opendir) (directory)
-		    : (__ptr_t) opendir (directory));
-	  if (stream == NULL)
-	    {
-	      if (errno != ENOTDIR
-		  && ((errfunc != NULL && (*errfunc) (directory, errno))
-		      || (flags & GLOB_ERR)))
-		return GLOB_ABORTED;
-	      nfound = 0;
-	      meta = 0;
-	    }
-	  else
-	    {
-	      int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
-			       | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
-#if defined _AMIGA || defined VMS
-			       | FNM_CASEFOLD
-#endif
-			       );
-	      nfound = 0;
-	      flags |= GLOB_MAGCHAR;
-
-	      while (1)
-		{
-		  const char *name;
-		  size_t len;
-#if defined HAVE_DIRENT64 && !defined COMPILE_GLOB64
-		  struct dirent64 *d;
-		  union
-		    {
-		      struct dirent64 d64;
-		      char room [offsetof (struct dirent64, d_name[0])
-				 + NAME_MAX + 1];
-		    }
-		  d64buf;
-
-		  if (flags & GLOB_ALTDIRFUNC)
-		    {
-		      struct dirent *d32 = (*pglob->gl_readdir) (stream);
-		      if (d32 != NULL)
-			{
-			  CONVERT_DIRENT_DIRENT64 (&d64buf.d64, d32);
-			  d = &d64buf.d64;
-			}
-		      else
-			d = NULL;
-		    }
-		  else
-		    d = __readdir64 ((DIR *) stream);
-#else
-		  struct dirent *d = ((flags & GLOB_ALTDIRFUNC)
-				      ? ((struct dirent *)
-					 (*pglob->gl_readdir) (stream))
-				      : __readdir ((DIR *) stream));
-#endif
-		  if (d == NULL)
-		    break;
-		  if (! REAL_DIR_ENTRY (d))
-		    continue;
-
-#ifdef HAVE_D_TYPE
-		  /* If we shall match only directories use the information
-		     provided by the dirent call if possible.  */
-		  if ((flags & GLOB_ONLYDIR)
-		      && d->d_type != DT_UNKNOWN
-		      && d->d_type != DT_DIR
-		      && d->d_type != DT_LNK)
-		    continue;
-#endif
-
-		  name = d->d_name;
-
-		  if (fnmatch (pattern, name, fnm_flags) == 0)
-		    {
-		      /* If the file we found is a symlink we have to
-			 make sure the target file exists.  */
-		      if (
-#ifdef HAVE_D_TYPE
-			  (d->d_type != DT_UNKNOWN && d->d_type != DT_LNK) ||
-#endif
-			  link_exists_p (directory, dirlen, name, pglob,
-					 flags))
-			{
-			  struct globlink *new = (struct globlink *)
-			    __alloca (sizeof (struct globlink));
-			  len = NAMLEN (d);
-			  new->name = (char *) malloc (len + 1);
-			  if (new->name == NULL)
-			    goto memory_error;
-#ifdef HAVE_MEMPCPY
-			  *((char *) mempcpy ((__ptr_t) new->name, name, len))
-			    = '\0';
-#else
-			  memcpy ((__ptr_t) new->name, name, len);
-			  new->name[len] = '\0';
-#endif
-			  new->next = names;
-			  names = new;
-			  ++nfound;
-			}
-		    }
-		}
-	    }
-	}
-    }
-
-  if (nfound == 0 && (flags & GLOB_NOCHECK))
-    {
-      size_t len = strlen (pattern);
-      nfound = 1;
-      names = (struct globlink *) __alloca (sizeof (struct globlink));
-      names->next = NULL;
-      names->name = (char *) malloc (len + 1);
-      if (names->name == NULL)
-	goto memory_error;
-#ifdef HAVE_MEMPCPY
-      *((char *) mempcpy (names->name, pattern, len)) = '\0';
-#else
-      memcpy (names->name, pattern, len);
-      names->name[len] = '\0';
-#endif
-    }
-
-  if (nfound != 0)
-    {
-      char **new_gl_pathv;
-
-      new_gl_pathv
-	= (char **) realloc (pglob->gl_pathv,
-			     (pglob->gl_pathc + pglob->gl_offs + nfound + 1)
-			     * sizeof (char *));
-      if (new_gl_pathv == NULL)
-	goto memory_error;
-      pglob->gl_pathv = new_gl_pathv;
-
-      for (; names != NULL; names = names->next)
-	pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc++] = names->name;
-      pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
-
-      pglob->gl_flags = flags;
-    }
-
-  save = errno;
-  if (stream != NULL)
-    {
-      if (flags & GLOB_ALTDIRFUNC)
-	(*pglob->gl_closedir) (stream);
-      else
-	closedir ((DIR *) stream);
-    }
-  __set_errno (save);
-
-  return nfound == 0 ? GLOB_NOMATCH : 0;
-
- memory_error:
-  {
-    int save = errno;
-    if (flags & GLOB_ALTDIRFUNC)
-      (*pglob->gl_closedir) (stream);
-    else
-      closedir ((DIR *) stream);
-    __set_errno (save);
-  }
-  while (names != NULL)
-    {
-      if (names->name != NULL)
-	free ((__ptr_t) names->name);
-      names = names->next;
-    }
-  return GLOB_NOSPACE;
-}
-
-#endif	/* Not ELIDE_CODE.  */
diff --git a/sysdeps/generic/glob64.c b/sysdeps/generic/glob64.c
deleted file mode 100644
index 2bfab74074..0000000000
--- a/sysdeps/generic/glob64.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1998,99,2002,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <sys/types.h>
-#include <glob.h>
-#include <errno.h>
-
-/* Do glob searching for PATTERN, placing results in PGLOB.
-   The bits defined above may be set in FLAGS.
-   If a directory cannot be opened or read and ERRFUNC is not nil,
-   it is called with the pathname that caused the error, and the
-   `errno' value from the failing call; if it returns non-zero
-   `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
-   If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
-   Otherwise, `glob' returns zero.  */
-int
-glob64 (const char *pattern, int flags,
-	int (*errfunc) (const char *, int), glob64_t *pglob)
-{
-  if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return GLOB_NOSYS;
-}
-libc_hidden_def (glob64)
-
-void
-globfree64 (glob64_t *pglob)
-{
-}
-libc_hidden_def (globfree64)
-
-stub_warning (glob64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/grantpt.c b/sysdeps/generic/grantpt.c
deleted file mode 100644
index 65da95b308..0000000000
--- a/sysdeps/generic/grantpt.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <errno.h>
-
-/* Given a fd on a master pseudoterminal, chown the file associated
-   with the slave to the calling process, and set its group and
-   mode appropriately.  Note that this is an unprivileged operation. */
-int
-grantpt (fd)
-     int fd __attribute__ ((unused));
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (grantpt)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/group_member.c b/sysdeps/generic/group_member.c
deleted file mode 100644
index 7bd9c46ba2..0000000000
--- a/sysdeps/generic/group_member.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* `group_member' -- test if process is in a given group.
-   Copyright (C) 1995, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#ifndef NGROUPS_MAX
-#define NGROUPS_MAX	16	/* First guess.  */
-#endif
-
-int
-__group_member (gid)
-     gid_t gid;
-{
-  int n, size;
-  gid_t *groups;
-
-  size = NGROUPS_MAX;
-  do
-    {
-      groups = __alloca (size * sizeof *groups);
-      n = __getgroups (size, groups);
-      size *= 2;
-    } while (n == size / 2);
-
-  while (n >= 0)
-    if (groups[n--] == gid)
-      return 1;
-
-  return 0;
-}
-weak_alias (__group_member, group_member)
diff --git a/sysdeps/generic/gtty.c b/sysdeps/generic/gtty.c
deleted file mode 100644
index 84e7fed55e..0000000000
--- a/sysdeps/generic/gtty.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sgtty.h>
-#include <stddef.h>
-
-/* Fill in *PARAMS with terminal parameters associated with FD.  */
-int
-gtty (fd, params)
-     int fd;
-     struct sgttyb *params;
-{
-  if (params == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (gtty)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/herrno-loc.c b/sysdeps/generic/herrno-loc.c
deleted file mode 100644
index fd6deeb330..0000000000
--- a/sysdeps/generic/herrno-loc.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1996, 97, 98, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <netdb.h>
-#include <tls.h>
-
-#if ! USE___THREAD
-# undef h_errno
-extern int h_errno;
-#endif
-
-/* When threaded, h_errno may be a per-thread variable.  */
-int *
-weak_const_function
-__h_errno_location (void)
-{
-  return &h_errno;
-}
-libc_hidden_def (__h_errno_location)
diff --git a/sysdeps/generic/htonl.c b/sysdeps/generic/htonl.c
deleted file mode 100644
index dfee1b0545..0000000000
--- a/sysdeps/generic/htonl.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1993,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <netinet/in.h>
-
-#undef	htonl
-#undef	ntohl
-
-uint32_t
-htonl (x)
-     uint32_t x;
-{
-#if BYTE_ORDER == BIG_ENDIAN
-  return x;
-#elif BYTE_ORDER == LITTLE_ENDIAN
-  return __bswap_32 (x);
-#else
-# error "What kind of system is this?"
-#endif
-}
-weak_alias (htonl, ntohl)
diff --git a/sysdeps/generic/htons.c b/sysdeps/generic/htons.c
deleted file mode 100644
index 95c94de8a3..0000000000
--- a/sysdeps/generic/htons.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1993,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <netinet/in.h>
-
-#undef	htons
-#undef	ntohs
-
-uint16_t
-htons (x)
-     uint16_t x;
-{
-#if BYTE_ORDER == BIG_ENDIAN
-  return x;
-#elif BYTE_ORDER == LITTLE_ENDIAN
-  return __bswap_16 (x);
-#else
-# error "What kind of system is this?"
-#endif
-}
-weak_alias (htons, ntohs)
diff --git a/sysdeps/generic/if_index.c b/sysdeps/generic/if_index.c
deleted file mode 100644
index f217f37642..0000000000
--- a/sysdeps/generic/if_index.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (C) 1997,98,99,2000,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <net/if.h>
-#include <errno.h>
-#include <stddef.h>
-
-unsigned int
-if_nametoindex (const char *ifname)
-{
-  __set_errno (ENOSYS);
-  return 0;
-}
-libc_hidden_def (if_nametoindex)
-stub_warning (if_nametoindex)
-
-char *
-if_indextoname (unsigned int ifindex, char *ifname)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-libc_hidden_def (if_indextoname)
-stub_warning (if_indextoname)
-
-void
-if_freenameindex (struct if_nameindex *ifn)
-{
-}
-stub_warning (if_freenameindex)
-
-struct if_nameindex *
-if_nameindex (void)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-stub_warning (if_nameindex)
-#include <stub-tag.h>
-
-#if 0
-void
-internal_function
-__protocol_available (int *have_inet, int *have_inet6)
-{
-  /* By default we assume that IPv4 is available, IPv6 not.  */
-  *have_inet = 1;
-  *have_inet6 = 0;
-}
-#endif
diff --git a/sysdeps/generic/ifaddrs.c b/sysdeps/generic/ifaddrs.c
deleted file mode 100644
index 330aae3b39..0000000000
--- a/sysdeps/generic/ifaddrs.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* getifaddrs -- get names and addresses of all network interfaces
-   Copyright (C) 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <ifaddrs.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* Create a linked list of `struct ifaddrs' structures, one for each
-   network interface on the host machine.  If successful, store the
-   list in *IFAP and return 0.  On errors, return -1 and set `errno'.  */
-int
-getifaddrs (struct ifaddrs **ifap)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (getifaddrs)
-stub_warning (getifaddrs)
-
-void
-freeifaddrs (struct ifaddrs *ifa)
-{
-  if (ifa == NULL)
-    return;			/* a la free, why not? */
-
-  /* Can't be called properly if getifaddrs never succeeded.  */
-  abort ();
-}
-libc_hidden_def (freeifaddrs)
-stub_warning (freeifaddrs)
diff --git a/sysdeps/generic/ifreq.c b/sysdeps/generic/ifreq.c
deleted file mode 100644
index 55e833bdb3..0000000000
--- a/sysdeps/generic/ifreq.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "ifreq.h"
-
-
-void
-__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
-{
-  int fd = sockfd;
-  struct ifconf ifc;
-  int rq_len;
-  int nifs;
-# define RQ_IFS	4
-
-  if (fd < 0)
-    fd = __opensock ();
-  if (fd < 0)
-    {
-      *num_ifs = 0;
-      *ifreqs = NULL;
-      return;
-    }
-
-  ifc.ifc_buf = NULL;
-  rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop.  */
-  do
-    {
-      ifc.ifc_len = rq_len *= 2;
-      void *newp = realloc (ifc.ifc_buf, ifc.ifc_len);
-      if (newp == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
-	{
-	  free (ifc.ifc_buf);
-
-	  if (fd != sockfd)
-	    __close (fd);
-	  *num_ifs = 0;
-	  *ifreqs = NULL;
-	  return;
-	}
-      ifc.ifc_buf = newp;
-    }
-  while (rq_len < sizeof (struct ifreq) + ifc.ifc_len);
-
-  if (fd != sockfd)
-    __close (fd);
-
-#ifdef _HAVE_SA_LEN
-  struct ifreq *ifr = *ifreqs;
-  nifs = 0;
-  while ((char *) ifr < ifc.ifc_buf + ifc.ifc_len)
-    {
-      ++nifs;
-      ifr = __if_nextreq (ifr);
-      if (ifr == NULL)
-	break;
-    }
-#else
-  nifs = ifc.ifc_len / sizeof (struct ifreq);
-#endif
-
-  *num_ifs = nifs;
-  *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq));
-}
diff --git a/sysdeps/generic/init-first.c b/sysdeps/generic/init-first.c
deleted file mode 100644
index fa21274c73..0000000000
--- a/sysdeps/generic/init-first.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Initialization code run first thing by the ELF startup code.  Stub version.
-   Copyright (C) 1995, 1997, 1998, 2001, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Set nonzero if we have to be prepared for more then one libc being
-   used in the process.  Safe assumption if initializer never runs.  */
-int __libc_multiple_libcs attribute_hidden = 1;
-
-extern void __libc_init (int, char **, char **);
-#ifdef USE_NONOPTION_FLAGS
-extern void __getopt_clean_environment (char **);
-#endif
-
-#ifdef SHARED
-void
-__libc_init_first (void)
-{
-}
-#endif
-
-#ifdef SHARED
-/* NOTE!  The linker notices the magical name `_init' and sets the DT_INIT
-   pointer in the dynamic section based solely on that.  It is convention
-   for this function to be in the `.init' section, but the symbol name is
-   the only thing that really matters!!  */
-void _init
-#else
-void __libc_init_first
-#endif
-(int argc, char *arg0, ...)
-{
-  char **argv = &arg0, **envp = &argv[argc + 1];
-
-  __environ = envp;
-  __libc_init (argc, argv, envp);
-
-#ifdef USE_NONOPTION_FLAGS
-  /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment (envp);
-#endif
-}
diff --git a/sysdeps/generic/init-posix.c b/sysdeps/generic/init-posix.c
deleted file mode 100644
index ae9e1075d1..0000000000
--- a/sysdeps/generic/init-posix.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1991, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	HAVE_GNU_LD
-
-void
-__init_posix (void)
-{
-  return;
-}
-
-#endif
diff --git a/sysdeps/generic/inlines.c b/sysdeps/generic/inlines.c
deleted file mode 100644
index dca305e6e4..0000000000
--- a/sysdeps/generic/inlines.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define _FORCE_INLINES
-#define _EXTERN_INLINE /* empty */
-#include "gmp.h"
diff --git a/sysdeps/generic/ioctl.c b/sysdeps/generic/ioctl.c
deleted file mode 100644
index 3f71452cc1..0000000000
--- a/sysdeps/generic/ioctl.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 93, 94, 95, 96, 97 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/ioctl.h>
-
-/* Perform the I/O control operation specified by REQUEST on FD.
-   The actual type and use of ARG and the return value depend on REQUEST.  */
-int
-__ioctl (fd, request)
-     int fd;
-     unsigned long int request;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (ioctl)
-
-weak_alias (__ioctl, ioctl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/isastream.c b/sysdeps/generic/isastream.c
deleted file mode 100644
index 88dae299fc..0000000000
--- a/sysdeps/generic/isastream.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stropts.h>
-
-int
-isastream (fildes)
-     int fildes;
-{
-  /* In general we do not have a STREAMS implementation and therefore
-     return 0.  But for invalid file descriptors we have to return an
-     error.  */
-  if (__fcntl (fildes, F_GETFD) < 0)
-    return -1;
-
-  /* No STREAM.  */
-  return 0;
-}
diff --git a/sysdeps/generic/isatty.c b/sysdeps/generic/isatty.c
deleted file mode 100644
index 9b0410c614..0000000000
--- a/sysdeps/generic/isatty.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Return 1 if FD is a terminal, 0 if not.  */
-int
-__isatty (fd)
-     int fd;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__isatty, isatty)
-
-stub_warning (isatty)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/isfdtype.c b/sysdeps/generic/isfdtype.c
deleted file mode 100644
index ba10912c9f..0000000000
--- a/sysdeps/generic/isfdtype.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* isfdtype - Determine whether descriptor has given property.  Stub version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/stat.h>
-
-
-int
-isfdtype (int fildes, int fdtype)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (isfdtype)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/jmp-unwind.c b/sysdeps/generic/jmp-unwind.c
deleted file mode 100644
index d2f76c62e7..0000000000
--- a/sysdeps/generic/jmp-unwind.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* _longjmp_unwind -- Clean up stack frames unwound by longjmp.  Stub version.
-   Copyright (C) 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-
-void
-_longjmp_unwind (jmp_buf env, int val)
-{
-
-  /* This function can perform any cleanups necessary to safely unwind the
-     stack frames around the current context which ENV unwinds past.  */
-
-}
diff --git a/sysdeps/generic/k_cosl.c b/sysdeps/generic/k_cosl.c
deleted file mode 100644
index 29b83d6273..0000000000
--- a/sysdeps/generic/k_cosl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-long double
-__kernel_cosl (long double x, long double y)
-{
-  fputs ("__kernel_cosl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__kernel_cosl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/k_rem_pio2l.c b/sysdeps/generic/k_rem_pio2l.c
deleted file mode 100644
index 236eb30dd9..0000000000
--- a/sysdeps/generic/k_rem_pio2l.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <math.h>
-#include <math_private.h>
-#include <stdio.h>
-#include <errno.h>
-
-int
-__kernel_rem_pio2l (long double *x, long double *y, int e0, int nx, int prec,
-		    const int *ipio2)
-{
-  fputs ("__kernel_rem_pio2l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__kernel_rem_pio2l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/k_sincosl.c b/sysdeps/generic/k_sincosl.c
deleted file mode 100644
index aa038c26c4..0000000000
--- a/sysdeps/generic/k_sincosl.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty.  Not needed.  */
diff --git a/sysdeps/generic/k_sinl.c b/sysdeps/generic/k_sinl.c
deleted file mode 100644
index ea1d71f61b..0000000000
--- a/sysdeps/generic/k_sinl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-long double
-__kernel_sinl (long double x, long double y, int iy)
-{
-  fputs ("__kernel_sinl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__kernel_sinl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/k_tanl.c b/sysdeps/generic/k_tanl.c
deleted file mode 100644
index 9993c6b998..0000000000
--- a/sysdeps/generic/k_tanl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include "math_private.h"
-
-long double
-__kernel_tanl (long double x, long double y, int iy)
-{
-  fputs ("__kernel_tanl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-stub_warning (__kernel_tanl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/kill.c b/sysdeps/generic/kill.c
deleted file mode 100644
index 1d81e45dde..0000000000
--- a/sysdeps/generic/kill.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* Send signal SIG to process number PID.  If PID is zero,
-   send SIG to all processes in the current process's process group.
-   If PID is < -1, send SIG to all processes in process group - PID.  */
-int
-__kill (pid, sig)
-     int pid;
-     int sig;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (kill)
-
-weak_alias (__kill, kill)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/killpg.c b/sysdeps/generic/killpg.c
deleted file mode 100644
index ad9258dffc..0000000000
--- a/sysdeps/generic/killpg.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* Send SIG to all processes in process group PGRP.
-   If PGRP is zero, send SIG to all processes in
-   the current process's process group.  */
-int
-killpg (pgrp, sig)
-     __pid_t pgrp;
-     int sig;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (killpg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/labs.c b/sysdeps/generic/labs.c
deleted file mode 100644
index c568e44454..0000000000
--- a/sysdeps/generic/labs.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1991, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-
-#undef	labs
-
-
-/* Return the absolute value of I.  */
-long int
-labs (long int i)
-{
-  return i < 0 ? -i : i;
-}
diff --git a/sysdeps/generic/lchmod.c b/sysdeps/generic/lchmod.c
deleted file mode 100644
index 524b24c1ed..0000000000
--- a/sysdeps/generic/lchmod.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* lchmod -- Change the protections of a file or symbolic link.  Stub version.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-/* Change the protections of FILE to MODE.  */
-int
-lchmod (const char *file, mode_t mode)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (lchmod)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lchown.c b/sysdeps/generic/lchown.c
deleted file mode 100644
index 4e0330e526..0000000000
--- a/sysdeps/generic/lchown.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Change the owner and group of FILE.  */
-int
-__lchown (file, owner, group)
-     const char *file;
-     uid_t owner;
-     gid_t group;
-{
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (lchown)
-
-weak_alias (__lchown, lchown)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ldbl2mpn.c b/sysdeps/generic/ldbl2mpn.c
deleted file mode 100644
index 450f9381cc..0000000000
--- a/sysdeps/generic/ldbl2mpn.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty.  Not needed unless ldbl support is in. */
diff --git a/sysdeps/generic/ldiv.c b/sysdeps/generic/ldiv.c
deleted file mode 100644
index a7796d8e95..0000000000
--- a/sysdeps/generic/ldiv.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1992, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-
-
-/* Return the `ldiv_t' representation of NUMER over DENOM.  */
-ldiv_t
-ldiv (long int numer, long int denom)
-{
-  ldiv_t result;
-
-  result.quot = numer / denom;
-  result.rem = numer % denom;
-
-  /* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
-     NUMER / DENOM is to be computed in infinite precision.  In
-     other words, we should always truncate the quotient towards
-     zero, never -infinity.  Machine division and remainer may
-     work either way when one or both of NUMER or DENOM is
-     negative.  If only one is negative and QUOT has been
-     truncated towards -infinity, REM will have the same sign as
-     DENOM and the opposite sign of NUMER; if both are negative
-     and QUOT has been truncated towards -infinity, REM will be
-     positive (will have the opposite sign of NUMER).  These are
-     considered `wrong'.  If both are NUM and DENOM are positive,
-     RESULT will always be positive.  This all boils down to: if
-     NUMER >= 0, but REM < 0, we got the wrong answer.  In that
-     case, to get the right answer, add 1 to QUOT and subtract
-     DENOM from REM.  */
-
-  if (numer >= 0 && result.rem < 0)
-    {
-      ++result.quot;
-      result.rem -= denom;
-    }
-
-  return result;
-}
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index ec68e1a565..eee6141c6a 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1,5 +1,5 @@
 /* Run-time dynamic linker data structures for loaded ELF shared objects.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007 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
@@ -52,25 +52,17 @@ __BEGIN_DECLS
   most architectures the entry is already relocated - but for some not
   and we need to relocate at access time.  */
 #ifdef DL_RO_DYN_SECTION
-# define D_PTR(map,i) (map->i->d_un.d_ptr + map->l_addr)
+# define D_PTR(map, i) ((map)->i->d_un.d_ptr + (map)->l_addr)
 #else
-# define D_PTR(map,i) map->i->d_un.d_ptr
+# define D_PTR(map, i) (map)->i->d_un.d_ptr
 #endif
 
-/* On some platforms more information than just the address of the symbol
-   is needed from the lookup functions.  In this case we return the whole
-   link map.  */
-#ifdef DL_LOOKUP_RETURNS_MAP
+/* Result of the lookup functions and how to retrieve the base address.  */
 typedef struct link_map *lookup_t;
-# define LOOKUP_VALUE(map) map
-# define LOOKUP_VALUE_ADDRESS(map) (map ? map->l_addr : 0)
-#else
-typedef ElfW(Addr) lookup_t;
-# define LOOKUP_VALUE(map) map->l_addr
-# define LOOKUP_VALUE_ADDRESS(address) address
-#endif
+#define LOOKUP_VALUE(map) map
+#define LOOKUP_VALUE_ADDRESS(map) ((map) ? (map)->l_addr : 0)
 
-/* on some architectures a pointer to a function is not just a pointer
+/* On some architectures a pointer to a function is not just a pointer
    to the actual code of the function but rather an architecture
    specific descriptor. */
 #ifndef ELF_FUNCTION_PTR_IS_SPECIAL
@@ -81,6 +73,14 @@ typedef ElfW(Addr) lookup_t;
 # define DL_DT_FINI_ADDRESS(map, start) (start)
 #endif
 
+/* On some architectures dladdr can't use st_size of all symbols this way.  */
+#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
+  ((ADDR) >= (L)->l_addr + (SYM)->st_value				\
+   && ((((SYM)->st_shndx == SHN_UNDEF || (SYM)->st_size == 0)		\
+	&& (ADDR) == (L)->l_addr + (SYM)->st_value)			\
+       || (ADDR) < (L)->l_addr + (SYM)->st_value + (SYM)->st_size)	\
+   && ((MATCHSYM) == NULL || (MATCHSYM)->st_value < (SYM)->st_value))
+
 /* Unmap a loaded object, called by _dl_close (). */
 #ifndef DL_UNMAP_IS_SPECIAL
 # define DL_UNMAP(map) \
@@ -182,8 +182,156 @@ enum allowmask
   };
 
 
+/* Type for list of auditing interfaces.  */
+struct La_i86_regs;
+struct La_i86_retval;
+struct La_x86_64_regs;
+struct La_x86_64_retval;
+struct La_ppc32_regs;
+struct La_ppc32_retval;
+struct La_ppc64_regs;
+struct La_ppc64_retval;
+struct La_sh_regs;
+struct La_sh_retval;
+struct La_alpha_regs;
+struct La_alpha_retval;
+struct La_s390_32_regs;
+struct La_s390_32_retval;
+struct La_s390_64_regs;
+struct La_s390_64_retval;
+struct La_ia64_regs;
+struct La_ia64_retval;
+struct La_sparc32_regs;
+struct La_sparc32_retval;
+struct La_sparc64_regs;
+struct La_sparc64_retval;
+
+struct audit_ifaces
+{
+  void (*activity) (uintptr_t *, unsigned int);
+  char *(*objsearch) (const char *, uintptr_t *, unsigned int);
+  unsigned int (*objopen) (struct link_map *, Lmid_t, uintptr_t *);
+  void (*preinit) (uintptr_t *);
+  union
+  {
+    uintptr_t (*symbind32) (Elf32_Sym *, unsigned int, uintptr_t *,
+			    uintptr_t *, unsigned int *, const char *);
+    uintptr_t (*symbind64) (Elf64_Sym *, unsigned int, uintptr_t *,
+			    uintptr_t *, unsigned int *, const char *);
+  };
+  union
+  {
+    Elf32_Addr (*i86_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
+				    uintptr_t *, struct La_i86_regs *,
+				    unsigned int *, const char *name,
+				    long int *framesizep);
+    Elf64_Addr (*x86_64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
+				       uintptr_t *, struct La_x86_64_regs *,
+				       unsigned int *, const char *name,
+				       long int *framesizep);
+    Elf32_Addr (*ppc32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
+				      uintptr_t *, struct La_ppc32_regs *,
+				      unsigned int *, const char *name,
+				      long int *framesizep);
+    Elf64_Addr (*ppc64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
+				      uintptr_t *, struct La_ppc64_regs *,
+				      unsigned int *, const char *name,
+				      long int *framesizep);
+    uintptr_t (*sh_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
+				  uintptr_t *, const struct La_sh_regs *,
+				  unsigned int *, const char *name,
+				  long int *framesizep);
+    Elf64_Addr (*alpha_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
+				      uintptr_t *, struct La_alpha_regs *,
+				      unsigned int *, const char *name,
+				      long int *framesizep);
+    Elf32_Addr (*s390_32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *,
+					uintptr_t *, struct La_s390_32_regs *,
+					unsigned int *, const char *name,
+					long int *framesizep);
+    Elf64_Addr (*s390_64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
+					uintptr_t *, struct La_s390_64_regs *,
+					unsigned int *, const char *name,
+					long int *framesizep);
+    Elf64_Addr (*ia64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *,
+				     uintptr_t *, struct La_ia64_regs *,
+				     unsigned int *, const char *name,
+				     long int *framesizep);
+    Elf32_Addr (*sparc32_gnu_pltenter) (Elf32_Sym *, unsigned int,
+					uintptr_t *, uintptr_t *,
+					const struct La_sparc32_regs *,
+					unsigned int *, const char *name,
+					long int *framesizep);
+    Elf64_Addr (*sparc64_gnu_pltenter) (Elf64_Sym *, unsigned int,
+					uintptr_t *, uintptr_t *,
+					const struct La_sparc64_regs *,
+					unsigned int *, const char *name,
+					long int *framesizep);
+#ifdef ARCH_PLTENTER_MEMBERS
+    ARCH_PLTENTER_MEMBERS;
+#endif
+  };
+  union
+  {
+    unsigned int (*i86_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
+				     uintptr_t *, const struct La_i86_regs *,
+				     struct La_i86_retval *, const char *);
+    unsigned int (*x86_64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
+					uintptr_t *,
+					const struct La_x86_64_regs *,
+					struct La_x86_64_retval *,
+					const char *);
+    unsigned int (*ppc32_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
+				       uintptr_t *,
+				       const struct La_ppc32_regs *,
+				       struct La_ppc32_retval *, const char *);
+    unsigned int (*ppc64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
+				       uintptr_t *,
+				       const struct La_ppc64_regs *,
+				       struct La_ppc64_retval *, const char *);
+    unsigned int (*sh_gnu_pltexit) (Elf32_Sym *, unsigned int, uintptr_t *,
+				    uintptr_t *, const struct La_sh_regs *,
+				    struct La_sh_retval *, const char *);
+    unsigned int (*alpha_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
+				       uintptr_t *,
+				       const struct La_alpha_regs *,
+				       struct La_alpha_retval *, const char *);
+    unsigned int (*s390_32_gnu_pltexit) (Elf32_Sym *, unsigned int,
+					 uintptr_t *, uintptr_t *,
+					 const struct La_s390_32_regs *,
+					 struct La_s390_32_retval *,
+					 const char *);
+    unsigned int (*s390_64_gnu_pltexit) (Elf64_Sym *, unsigned int,
+					 uintptr_t *, uintptr_t *,
+					 const struct La_s390_64_regs *,
+					 struct La_s390_64_retval *,
+					 const char *);
+    unsigned int (*ia64_gnu_pltexit) (Elf64_Sym *, unsigned int, uintptr_t *,
+				      uintptr_t *,
+				      const struct La_ia64_regs *,
+				      struct La_ia64_retval *, const char *);
+    unsigned int (*sparc32_gnu_pltexit) (Elf32_Sym *, unsigned int,
+					 uintptr_t *, uintptr_t *,
+					 const struct La_sparc32_regs *,
+					 struct La_sparc32_retval *,
+					 const char *);
+    unsigned int (*sparc64_gnu_pltexit) (Elf64_Sym *, unsigned int,
+					 uintptr_t *, uintptr_t *,
+					 const struct La_sparc32_regs *,
+					 struct La_sparc32_retval *,
+					 const char *);
+#ifdef ARCH_PLTEXIT_MEMBERS
+    ARCH_PLTEXIT_MEMBERS;
+#endif
+  };
+  unsigned int (*objclose) (uintptr_t *);
+
+  struct audit_ifaces *next;
+};
+
+
 /* Test whether given NAME matches any of the names of the given object.  */
-extern int _dl_name_match_p (const char *__name, struct link_map *__map)
+extern int _dl_name_match_p (const char *__name, const struct link_map *__map)
      internal_function;
 
 /* Function used as argument for `_dl_receive_error' function.  The
@@ -224,18 +372,18 @@ struct rtld_global
 #endif
   EXTERN struct link_namespaces
   {
-    /* And a pointer to the map for the main map.  */
+    /* A pointer to the map for the main map.  */
     struct link_map *_ns_loaded;
     /* Number of object in the _dl_loaded list.  */
     unsigned int _ns_nloaded;
-    /* Array representing global scope.  */
-    struct r_scope_elem *_ns_global_scope[2];
     /* Direct pointer to the searchlist of the main object.  */
     struct r_scope_elem *_ns_main_searchlist;
     /* This is zero at program start to signal that the global scope map is
        allocated by rtld.  Later it keeps the size of the map.  It might be
        reset if in _dl_close if the last global object is removed.  */
     size_t _ns_global_scope_alloc;
+    /* Keep track of changes to each namespace' list.  */
+    struct r_debug _ns_debug;
   } _dl_ns[DL_NNS];
 
   /* During the program run we must not modify the global data of
@@ -277,8 +425,12 @@ struct rtld_global
   EXTERN void **(*_dl_error_catch_tsd) (void) __attribute__ ((const));
 #endif
 
-  /* Structure describing the dynamic linker itself.  */
+  /* Structure describing the dynamic linker itself.  We need to
+     reserve memory for the data the audit libraries need.  */
   EXTERN struct link_map _dl_rtld_map;
+#ifdef SHARED
+  struct auditstate audit_data[DL_NNS];
+#endif
 
 #if defined SHARED && defined _LIBC_REENTRANT \
     && defined __rtld_lock_default_lock_recursive
@@ -286,23 +438,23 @@ struct rtld_global
   EXTERN void (*_dl_rtld_unlock_recursive) (void *);
 #endif
 
-  /* Prevailing state of the stack, PF_X indicating it's executable.  */
-  EXTERN ElfW(Word) _dl_stack_flags;
-
   /* If loading a shared object requires that we make the stack executable
      when it was not, we do it by calling this function.
      It returns an errno code or zero on success.  */
   EXTERN int (*_dl_make_stack_executable_hook) (void **) internal_function;
 
+  /* Prevailing state of the stack, PF_X indicating it's executable.  */
+  EXTERN ElfW(Word) _dl_stack_flags;
+
   /* Keep the conditional TLS members at the end so the layout of the
      structure used by !USE_TLS code matches the prefix of the layout in
      the USE_TLS rtld.  Note that `struct link_map' is conditionally
      defined as well, so _dl_rtld_map needs to be last before this.  */
 #ifdef USE_TLS
-  /* Highest dtv index currently needed.  */
-  EXTERN size_t _dl_tls_max_dtv_idx;
   /* Flag signalling whether there are gaps in the module ID allocation.  */
   EXTERN bool _dl_tls_dtv_gaps;
+  /* Highest dtv index currently needed.  */
+  EXTERN size_t _dl_tls_max_dtv_idx;
   /* Information about the dtv slots.  */
   EXTERN struct dtv_slotinfo_list
   {
@@ -339,6 +491,14 @@ struct rtld_global
   EXTERN void (*_dl_init_static_tls) (struct link_map *);
 #endif
 
+  EXTERN void (*_dl_wait_lookup_done) (void);
+
+  /* Scopes to free after next THREAD_GSCOPE_WAIT ().  */
+  EXTERN struct dl_scope_free_list
+  {
+    size_t count;
+    struct r_scope_elem **list[50];
+  } *_dl_scope_free_list;
 #ifdef SHARED
 };
 # define __rtld_global_attribute__
@@ -389,15 +549,15 @@ struct rtld_global_ro
 #define DL_DEBUG_HELP       (1 << 9)
 #define DL_DEBUG_PRELINK    (1 << 10)
 
-  /* Cached value of `getpagesize ()'.  */
-  EXTERN size_t _dl_pagesize;
-
   /* OS version.  */
   EXTERN unsigned int _dl_osversion;
   /* Platform name.  */
   EXTERN const char *_dl_platform;
   EXTERN size_t _dl_platformlen;
 
+  /* Cached value of `getpagesize ()'.  */
+  EXTERN size_t _dl_pagesize;
+
   /* Copy of the content of `_dl_main_searchlist' at startup time.  */
   EXTERN struct r_scope_elem _dl_initial_searchlist;
 
@@ -427,10 +587,10 @@ struct rtld_global_ro
   EXTERN int _dl_correct_cache_id;
 
   /* Mask for hardware capabilities that are available.  */
-  EXTERN unsigned long int _dl_hwcap;
+  EXTERN uint64_t _dl_hwcap;
 
   /* Mask for important hardware capabilities we honour. */
-  EXTERN unsigned long int _dl_hwcap_mask;
+  EXTERN uint64_t _dl_hwcap_mask;
 
   /* Get architecture specific definitions.  */
 #define PROCINFO_DECL
@@ -476,6 +636,10 @@ struct rtld_global_ro
   /* The vsyscall page is a virtual DSO pre-mapped by the kernel.
      This points to its ELF header.  */
   EXTERN const ElfW(Ehdr) *_dl_sysinfo_dso;
+
+  /* At startup time we set up the normal DSO data structure for it,
+     and this points to it.  */
+  EXTERN struct link_map *_dl_sysinfo_map;
 #endif
 
 #ifdef SHARED
@@ -483,32 +647,12 @@ struct rtld_global_ro
      call the function instead of going through the PLT.  The result
      is that we can avoid exporting the functions and we do not jump
      PLT relocations in libc.so.  */
-  const char *(*_dl_get_origin) (void);
-  size_t (*_dl_dst_count) (const char *, int);
-  char *(*_dl_dst_substitute) (struct link_map *, const char *, char *, int);
-  struct link_map *(internal_function *_dl_map_object) (struct link_map *,
-							const char *, int,
-							int, int, int, Lmid_t);
-  void (internal_function *_dl_map_object_deps) (struct link_map *,
-						 struct link_map **,
-						 unsigned int, int, int);
-  void (*_dl_relocate_object) (struct link_map *, struct r_scope_elem *[],
-			       int, int);
-  int (internal_function *_dl_check_map_versions) (struct link_map *, int,
-						   int);
-  void (internal_function *_dl_init) (struct link_map *, int, char **,
-					char **);
-  void (*_dl_debug_state) (void);
-#ifndef MAP_COPY
-  void (*_dl_unload_cache) (void);
-#endif
   void (*_dl_debug_printf) (const char *, ...)
        __attribute__ ((__format__ (__printf__, 1, 2)));
   int (internal_function *_dl_catch_error) (const char **, const char **,
-					    void (*) (void *), void *);
+					    bool *, void (*) (void *), void *);
   void (internal_function *_dl_signal_error) (int, const char *, const char *,
 					      const char *);
-  void (internal_function *_dl_start_profile) (void);
   void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc);
   lookup_t (internal_function *_dl_lookup_symbol_x) (const char *,
 						     struct link_map *,
@@ -518,7 +662,16 @@ struct rtld_global_ro
 						     int, int,
 						     struct link_map *);
   int (*_dl_check_caller) (const void *, enum allowmask);
+  void *(*_dl_open) (const char *file, int mode, const void *caller_dlopen,
+		     Lmid_t nsid, int argc, char *argv[], char *env[]);
+  void (*_dl_close) (void *map);
+
+  /* List of auditing interfaces.  */
+  struct audit_ifaces *_dl_audit;
+  unsigned int _dl_naudit;
 
+  /* 0 if internal pointer values should not be guarded, 1 if they should.  */
+  EXTERN int _dl_pointer_guard;
 };
 # define __rtld_global_attribute__
 # ifdef IS_IN_rtld
@@ -580,13 +733,6 @@ extern char **_dl_argv_internal attribute_hidden
 # define rtld_progname _dl_argv[0]
 #endif
 
-/* The array with message we print as a last resort.  */
-extern const char _dl_out_of_memory[];
-#ifdef IS_IN_rtld
-/* XXX #ifdef should go away.  */
-extern const char _dl_out_of_memory_internal[] attribute_hidden;
-#endif
-
 /* Flag set at startup and cleared when the last initializer has run.  */
 extern int _dl_starting_up;
 weak_extern (_dl_starting_up)
@@ -783,6 +929,11 @@ extern void _dl_init (struct link_map *main_map, int argc, char **argv,
    initializer functions have completed.  */
 extern void _dl_fini (void) internal_function;
 
+/* Sort array MAPS according to dependencies of the contained objects.  */
+extern void _dl_sort_fini (struct link_map *l, struct link_map **maps,
+			   size_t nmaps, char *used, Lmid_t ns)
+     internal_function;
+
 /* The dynamic linker calls this function before and having changing
    any shared object mappings.  The `r_state' member of `struct r_debug'
    says what change is taking place.  This function's address is
@@ -793,7 +944,7 @@ rtld_hidden_proto (_dl_debug_state)
 /* Initialize `struct r_debug' if it has not already been done.  The
    argument is the run-time load address of the dynamic linker, to be put
    in the `r_ldbase' member.  Returns the address of the structure.  */
-extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase)
+extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
      internal_function;
 
 /* Initialize the basic data structure for the search paths.  */
@@ -911,6 +1062,32 @@ extern char *_dl_dst_substitute (struct link_map *l, const char *name,
 extern int _dl_check_caller (const void *caller, enum allowmask mask)
      attribute_hidden;
 
+/* Open the shared object NAME, relocate it, and run its initializer if it
+   hasn't already been run.  MODE is as for `dlopen' (see <dlfcn.h>).  If
+   the object is already opened, returns its existing map.  */
+extern void *_dl_open (const char *name, int mode, const void *caller,
+		       Lmid_t nsid, int argc, char *argv[], char *env[])
+     attribute_hidden;
+
+/* Free or queue for freeing scope OLD.  If other threads might be
+   in the middle of _dl_fixup, _dl_profile_fixup or dl*sym using the
+   old scope, OLD can't be freed until no thread is using it.  */
+extern int _dl_scope_free (struct r_scope_elem **old) attribute_hidden;
+
+/* Add module to slot information data.  */
+extern void _dl_add_to_slotinfo (struct link_map  *l) attribute_hidden;
+
+/* Update slot information data for at least the generation of the
+   module with the given index.  */
+extern struct link_map *_dl_update_slotinfo (unsigned long int req_modid);
+
+/* Look up the module's TLS block as for __tls_get_addr,
+   but never touch anything.  Return null if it's not allocated yet.  */
+extern void *_dl_tls_get_addr_soft (struct link_map *l) internal_function;
+
+extern int _dl_addr_inside_object (struct link_map *l, const ElfW(Addr) addr)
+     internal_function attribute_hidden;
+
 __END_DECLS
 
 #endif /* ldsodefs.h */
diff --git a/sysdeps/generic/lgetxattr.c b/sysdeps/generic/lgetxattr.c
deleted file mode 100644
index 6adf1fdf04..0000000000
--- a/sysdeps/generic/lgetxattr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-ssize_t
-lgetxattr (const char *__path, const char *__name,
-	   void *__value, size_t __size)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (lgetxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
deleted file mode 100644
index fc9df40996..0000000000
--- a/sysdeps/generic/libc-start.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* Copyright (C) 1998-2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <ldsodefs.h>
-#include <bp-start.h>
-#include <bp-sym.h>
-
-extern void __libc_init_first (int argc, char **argv, char **envp);
-
-extern int __libc_multiple_libcs;
-
-#include <tls.h>
-#ifndef SHARED
-# include <dl-osinfo.h>
-extern void __pthread_initialize_minimal (void)
-# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
-     __attribute__ ((weak))
-# endif
-     ;
-#endif
-
-#ifdef HAVE_PTR_NTHREADS
-/* We need atomic operations.  */
-# include <atomic.h>
-#endif
-
-
-#ifdef LIBC_START_MAIN
-# ifdef LIBC_START_DISABLE_INLINE
-#  define STATIC static
-# else
-#  define STATIC static inline __attribute__ ((always_inline))
-# endif
-#else
-# define STATIC
-# define LIBC_START_MAIN BP_SYM (__libc_start_main)
-#endif
-
-#ifdef MAIN_AUXVEC_ARG
-/* main gets passed a pointer to the auxiliary.  */
-# define MAIN_AUXVEC_DECL	, void *
-# define MAIN_AUXVEC_PARAM	, auxvec
-#else
-# define MAIN_AUXVEC_DECL
-# define MAIN_AUXVEC_PARAM
-#endif
-
-STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
-					 MAIN_AUXVEC_DECL),
-			    int argc,
-			    char *__unbounded *__unbounded ubp_av,
-#ifdef LIBC_START_MAIN_AUXVEC_ARG
-			    ElfW(auxv_t) *__unbounded auxvec,
-#endif
-#ifdef INIT_MAIN_ARGS
-			    __typeof (main) init,
-#else
-			    void (*init) (void),
-#endif
-			    void (*fini) (void),
-			    void (*rtld_fini) (void),
-			    void *__unbounded stack_end)
-     __attribute__ ((noreturn));
-
-STATIC int
-LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
-		 int argc, char *__unbounded *__unbounded ubp_av,
-#ifdef LIBC_START_MAIN_AUXVEC_ARG
-		 ElfW(auxv_t) *__unbounded auxvec,
-#endif
-#ifdef INIT_MAIN_ARGS
-		 __typeof (main) init,
-#else
-		 void (*init) (void),
-#endif
-		 void (*fini) (void),
-		 void (*rtld_fini) (void), void *__unbounded stack_end)
-{
-  char *__unbounded *__unbounded ubp_ev = &ubp_av[argc + 1];
-#if __BOUNDED_POINTERS__
-  char **argv;
-#else
-# define argv ubp_av
-#endif
-
-  /* Result of the 'main' function.  */
-  int result;
-
-  __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up;
-
-  INIT_ARGV_and_ENVIRON;
-
-#ifndef SHARED
-  /* Store the lowest stack address.  This is done in ld.so if this is
-     the code for the DSO.  */
-  __libc_stack_end = stack_end;
-
-# ifdef HAVE_AUX_VECTOR
-  /* First process the auxiliary vector since we need to find the
-     program header to locate an eventually present PT_TLS entry.  */
-#  ifndef LIBC_START_MAIN_AUXVEC_ARG
-  ElfW(auxv_t) *__unbounded auxvec;
-  {
-    char *__unbounded *__unbounded evp = ubp_ev;
-    while (*evp++ != NULL)
-      ;
-    auxvec = (ElfW(auxv_t) *__unbounded) evp;
-  }
-#  endif
-  _dl_aux_init (auxvec);
-# endif
-# ifdef DL_SYSDEP_OSCHECK
-  if (!__libc_multiple_libcs)
-    {
-      /* This needs to run to initiliaze _dl_osversion before TLS
-	 setup might check it.  */
-      DL_SYSDEP_OSCHECK (__libc_fatal);
-    }
-# endif
-
-  /* Initialize the thread library at least a bit since the libgcc
-     functions are using thread functions if these are available and
-     we need to setup errno.  If there is no thread library and we
-     handle TLS the function is defined in the libc to initialized the
-     TLS handling.  */
-# if !(USE_TLS - 0) && !defined NONTLS_INIT_TP
-  if (__pthread_initialize_minimal)
-# endif
-    __pthread_initialize_minimal ();
-#endif
-
-  /* Register the destructor of the dynamic linker if there is any.  */
-  if (__builtin_expect (rtld_fini != NULL, 1))
-    __cxa_atexit ((void (*) (void *)) rtld_fini, NULL, NULL);
-
-  /* Call the initializer of the libc.  This is only needed here if we
-     are compiling for the static library in which case we haven't
-     run the constructors in `_dl_start_user'.  */
-#ifndef SHARED
-  __libc_init_first (argc, argv, __environ);
-#endif
-
-  /* Register the destructor of the program, if any.  */
-  if (fini)
-    __cxa_atexit ((void (*) (void *)) fini, NULL, NULL);
-
-#ifndef SHARED
-  /* Some security at this point.  Prevent starting a SUID binary where
-     the standard file descriptors are not opened.  We have to do this
-     only for statically linked applications since otherwise the dynamic
-     loader did the work already.  */
-  if (__builtin_expect (__libc_enable_secure, 0))
-    __libc_check_standard_fds ();
-#endif
-
-  /* Call the initializer of the program, if any.  */
-#ifdef SHARED
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-    GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
-#endif
-  if (init)
-    (*init) (
-#ifdef INIT_MAIN_ARGS
-	     argc, argv, __environ MAIN_AUXVEC_PARAM
-#endif
-	     );
-
-#ifdef SHARED
-  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-    GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
-#endif
-
-#ifdef HAVE_CLEANUP_JMP_BUF
-  /* Memory for the cancellation buffer.  */
-  struct pthread_unwind_buf unwind_buf;
-
-  int not_first_call;
-  not_first_call = setjmp ((struct __jmp_buf_tag *) unwind_buf.cancel_jmp_buf);
-  if (__builtin_expect (! not_first_call, 1))
-    {
-      struct pthread *self = THREAD_SELF;
-
-      /* Store old info.  */
-      unwind_buf.priv.data.prev = THREAD_GETMEM (self, cleanup_jmp_buf);
-      unwind_buf.priv.data.cleanup = THREAD_GETMEM (self, cleanup);
-
-      /* Store the new cleanup handler info.  */
-      THREAD_SETMEM (self, cleanup_jmp_buf, &unwind_buf);
-
-      /* Run the program.  */
-      result = main (argc, argv, __environ MAIN_AUXVEC_PARAM);
-    }
-  else
-    {
-      /* Remove the thread-local data.  */
-# ifdef SHARED
-      __libc_pthread_functions.ptr__nptl_deallocate_tsd ();
-# else
-      extern void __nptl_deallocate_tsd (void) __attribute ((weak));
-      __nptl_deallocate_tsd ();
-# endif
-
-      /* One less thread.  Decrement the counter.  If it is zero we
-	 terminate the entire process.  */
-      result = 0;
-# ifdef SHARED
-      int *const ptr = __libc_pthread_functions.ptr_nthreads;
-# else
-      extern int __nptl_nthreads __attribute ((weak));
-      int *const ptr = &__nptl_nthreads;
-# endif
-
-      if (! atomic_decrement_and_test (ptr))
-	/* Not much left to do but to exit the thread, not the process.  */
-	__exit_thread (0);
-    }
-#else
-  /* Nothing fancy, just call the function.  */
-  result = main (argc, argv, __environ MAIN_AUXVEC_PARAM);
-#endif
-
-  exit (result);
-}
diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c
deleted file mode 100644
index b5ecc36436..0000000000
--- a/sysdeps/generic/libc-tls.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* Initialization code for TLS in statically linked application.
-   Copyright (C) 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <ldsodefs.h>
-#include <tls.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/param.h>
-
-
-#ifdef SHARED
- #error makefile bug, this file is for static only
-#endif
-
-#ifdef USE_TLS
-extern ElfW(Phdr) *_dl_phdr;
-extern size_t _dl_phnum;
-
-
-/* DTV with just one element plus overhead.  */
-static dtv_t static_dtv[3];
-
-
-static struct
-{
-  struct dtv_slotinfo_list si;
-  /* The dtv_slotinfo_list data structure does not include the actual
-     information since it is defined as an array of size zero.  We define
-     here the necessary entries.  Note that it is not important whether
-     there is padding or not since we will always access the information
-     through the 'si' element.  */
-  struct dtv_slotinfo info[2 + TLS_SLOTINFO_SURPLUS];
-} static_slotinfo;
-
-/* Fake link map for the application.  */
-static struct link_map static_map;
-
-
-/* Highest dtv index currently needed.  */
-size_t _dl_tls_max_dtv_idx;
-/* Flag signalling whether there are gaps in the module ID allocation.  */
-bool _dl_tls_dtv_gaps;
-/* Information about the dtv slots.  */
-struct dtv_slotinfo_list *_dl_tls_dtv_slotinfo_list;
-/* Number of modules in the static TLS block.  */
-size_t _dl_tls_static_nelem;
-/* Size of the static TLS block.  */
-size_t _dl_tls_static_size;
-/* Size actually allocated in the static TLS block.  */
-size_t _dl_tls_static_used;
-/* Alignment requirement of the static TLS block.  */
-size_t _dl_tls_static_align;
-
-/* Generation counter for the dtv.  */
-size_t _dl_tls_generation;
-
-
-/* Additional definitions needed by TLS initialization.  */
-#ifdef TLS_INIT_HELPER
-TLS_INIT_HELPER
-#endif
-
-static inline void
-init_slotinfo (void)
-{
-  /* Create the slotinfo list.  */
-  static_slotinfo.si.len = (((char *) (&static_slotinfo + 1)
-			     - (char *) &static_slotinfo.si.slotinfo[0])
-			    / sizeof static_slotinfo.si.slotinfo[0]);
-  // static_slotinfo.si.next = NULL;	already zero
-
-  /* The slotinfo list.  Will be extended by the code doing dynamic
-     linking.  */
-  GL(dl_tls_max_dtv_idx) = 1;
-  GL(dl_tls_dtv_slotinfo_list) = &static_slotinfo.si;
-}
-
-static inline void
-init_static_tls (size_t memsz, size_t align)
-{
-  /* That is the size of the TLS memory for this object.  The initialized
-     value of _dl_tls_static_size is provided by dl-open.c to request some
-     surplus that permits dynamic loading of modules with IE-model TLS.  */
-  GL(dl_tls_static_size) = roundup (memsz + GL(dl_tls_static_size),
-				    TLS_TCB_ALIGN);
-  GL(dl_tls_static_used) = memsz;
-  /* The alignment requirement for the static TLS block.  */
-  GL(dl_tls_static_align) = align;
-  /* Number of elements in the static TLS block.  */
-  GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx);
-}
-
-void
-__libc_setup_tls (size_t tcbsize, size_t tcbalign)
-{
-  void *tlsblock;
-  size_t memsz = 0;
-  size_t filesz = 0;
-  void *initimage = NULL;
-  size_t align = 0;
-  size_t max_align = tcbalign;
-  size_t tcb_offset;
-  ElfW(Phdr) *phdr;
-
-  /* Look through the TLS segment if there is any.  */
-  if (_dl_phdr != NULL)
-    for (phdr = _dl_phdr; phdr < &_dl_phdr[_dl_phnum]; ++phdr)
-      if (phdr->p_type == PT_TLS)
-	{
-	  /* Remember the values we need.  */
-	  memsz = phdr->p_memsz;
-	  filesz = phdr->p_filesz;
-	  initimage = (void *) phdr->p_vaddr;
-	  align = phdr->p_align;
-	  if (phdr->p_align > max_align)
-	    max_align = phdr->p_align;
-	  break;
-	}
-
-#ifdef TLS_INIT_TP_EXPENSIVE
-  if (memsz == 0 && tcbsize <= TLS_INIT_TCB_SIZE)
-    {
-      /* We do not need a TLS block and no thread descriptor.  */
-# ifdef NONTLS_INIT_TP
-      NONTLS_INIT_TP;
-# endif
-      return;
-    }
-#endif
-
-  /* We have to set up the TCB block which also (possibly) contains
-     'errno'.  Therefore we avoid 'malloc' which might touch 'errno'.
-     Instead we use 'sbrk' which would only uses 'errno' if it fails.
-     In this case we are right away out of memory and the user gets
-     what she/he deserves.
-
-     The initialized value of _dl_tls_static_size is provided by dl-open.c
-     to request some surplus that permits dynamic loading of modules with
-     IE-model TLS.  */
-# if TLS_TCB_AT_TP
-  tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
-  tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
-# elif TLS_DTV_AT_TP
-  tcb_offset = roundup (tcbsize, align ?: 1);
-  tlsblock = __sbrk (tcb_offset + memsz + max_align
-		     + TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
-  tlsblock += TLS_PRE_TCB_SIZE;
-# else
-  /* In case a model with a different layout for the TCB and DTV
-     is defined add another #elif here and in the following #ifs.  */
-#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
-
-  /* Align the TLS block.  */
-  tlsblock = (void *) (((uintptr_t) tlsblock + max_align - 1)
-		       & ~(max_align - 1));
-
-  /* Initialize the dtv.  [0] is the length, [1] the generation counter.  */
-  static_dtv[0].counter = 1;
-  // static_dtv[1].counter = 0;		would be needed if not already done
-
-  /* Initialize the TLS block.  */
-# if TLS_TCB_AT_TP
-  static_dtv[2].pointer = ((char *) tlsblock + tcb_offset
-			   - roundup (memsz, align ?: 1));
-  static_map.l_tls_offset = roundup (memsz, align ?: 1);
-# elif TLS_DTV_AT_TP
-  static_dtv[2].pointer = (char *) tlsblock + tcb_offset;
-  static_map.l_tls_offset = tcb_offset;
-# else
-#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
-  /* sbrk gives us zero'd memory, so we don't need to clear the remainder.  */
-  memcpy (static_dtv[2].pointer, initimage, filesz);
-
-  /* Install the pointer to the dtv.  */
-
-  /* Initialize the thread pointer.  */
-# if TLS_TCB_AT_TP
-  INSTALL_DTV ((char *) tlsblock + tcb_offset, static_dtv);
-
-  const char *lossage = TLS_INIT_TP ((char *) tlsblock + tcb_offset, 0);
-# elif TLS_DTV_AT_TP
-  INSTALL_DTV (tlsblock, static_dtv);
-  const char *lossage = TLS_INIT_TP (tlsblock, 0);
-# else
-#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
-# endif
-  if (__builtin_expect (lossage != NULL, 0))
-    __libc_fatal (lossage);
-
-  /* We have to create a fake link map which normally would be created
-     by the dynamic linker.  It just has to have enough information to
-     make the TLS routines happy.  */
-  static_map.l_tls_align = align;
-  static_map.l_tls_blocksize = memsz;
-  static_map.l_tls_initimage = initimage;
-  static_map.l_tls_initimage_size = filesz;
-  static_map.l_type = lt_executable;
-  static_map.l_tls_modid = 1;
-
-  init_slotinfo ();
-  // static_slotinfo.si.slotinfo[1].gen = 0; already zero
-  static_slotinfo.si.slotinfo[1].map = &static_map;
-
-  memsz = roundup (memsz, align ?: 1);
-
-# if TLS_TCB_AT_TP
-  memsz += tcbsize;
-# elif TLS_DTV_AT_TP
-  memsz += tcb_offset;
-# endif
-
-  init_static_tls (memsz, MAX (TLS_TCB_ALIGN, max_align));
-}
-
-/* This is called only when the data structure setup was skipped at startup,
-   when there was no need for it then.  Now we have dynamically loaded
-   something needing TLS, or libpthread needs it.  */
-int
-internal_function
-_dl_tls_setup (void)
-{
-  init_slotinfo ();
-  init_static_tls (
-# if TLS_TCB_AT_TP
-		   TLS_TCB_SIZE,
-# else
-		   0,
-# endif
-		   TLS_TCB_ALIGN);
-  return 0;
-}
-
-
-/* This is the minimal initialization function used when libpthread is
-   not used.  */
-void
-__attribute__ ((weak))
-__pthread_initialize_minimal (void)
-{
-  __libc_setup_tls (TLS_INIT_TCB_SIZE, TLS_INIT_TCB_ALIGN);
-}
-
-#elif defined NONTLS_INIT_TP
-
-/* This is the minimal initialization function used when libpthread is
-   not used.  */
-void
-__attribute__ ((weak))
-__pthread_initialize_minimal (void)
-{
-  NONTLS_INIT_TP;
-}
-
-#endif
diff --git a/sysdeps/generic/libc_fatal.c b/sysdeps/generic/libc_fatal.c
deleted file mode 100644
index be23849829..0000000000
--- a/sysdeps/generic/libc_fatal.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1993, 1995, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-
-/* Abort with an error message.  */
-void
-__libc_fatal (message)
-     const char *message;
-{
-  /* This function should write MESSAGE out in the most reliable way.
-     It is called in situations like internal stdio lossage.  */
-
-  abort ();
-}
-libc_hidden_def (__libc_fatal)
diff --git a/sysdeps/generic/link.c b/sysdeps/generic/link.c
deleted file mode 100644
index 70c9949704..0000000000
--- a/sysdeps/generic/link.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Make a link to FROM called TO.  */
-int
-__link (from, to)
-     const char *from;
-     const char *to;
-{
-  if (from == NULL || to == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (link)
-
-weak_alias (__link, link)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lio_listio.c b/sysdeps/generic/lio_listio.c
deleted file mode 100644
index d535594492..0000000000
--- a/sysdeps/generic/lio_listio.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Enqueue a list of read or write requests.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <aio.h>
-#include <errno.h>
-
-#ifdef BE_AIO64
-#define lio_listio	lio_listio64
-#define aiocb		aiocb64
-#define aio_read	aio_read64
-#define aio_write	aio_write64
-#define aio_suspend	aio_suspend64
-#endif
-
-
-int
-lio_listio (int mode,
-	    struct aiocb *const list[], int nent,
-	    struct sigevent *sig)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (lio_listio)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lio_listio64.c b/sysdeps/generic/lio_listio64.c
deleted file mode 100644
index 2e72c46b0b..0000000000
--- a/sysdeps/generic/lio_listio64.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define BE_AIO64
-#include "lio_listio.c"
diff --git a/sysdeps/generic/listen.c b/sysdeps/generic/listen.c
deleted file mode 100644
index cbdd8b9d18..0000000000
--- a/sysdeps/generic/listen.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2001,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Prepare to accept connections on socket FD.
-   N connection requests will be queued before further requests are refused.
-   Returns 0 on success, -1 for errors.  */
-int
-__listen (fd, n)
-     int fd;
-     int n;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__listen, listen)
-
-stub_warning (listen)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/listxattr.c b/sysdeps/generic/listxattr.c
deleted file mode 100644
index 490a092b75..0000000000
--- a/sysdeps/generic/listxattr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-ssize_t
-listxattr (const char *__path, char *__list, size_t __size)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (listxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/llabs.c b/sysdeps/generic/llabs.c
deleted file mode 100644
index b15c347d32..0000000000
--- a/sysdeps/generic/llabs.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* `long long int' absolute value.
-   Copyright (C) 1991, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-
-#undef	llabs
-
-
-/* Return the absolute value of I.  */
-long long int
-llabs (i)
-     long long int i;
-{
-  return i < 0 ? -i : i;
-}
diff --git a/sysdeps/generic/lldiv.c b/sysdeps/generic/lldiv.c
deleted file mode 100644
index 28a016b744..0000000000
--- a/sysdeps/generic/lldiv.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* `long long int' divison with remainder.
-   Copyright (C) 1992, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-
-
-/* Return the `lldiv_t' representation of NUMER over DENOM.  */
-lldiv_t
-lldiv (numer, denom)
-     long long int numer;
-     long long int denom;
-{
-  lldiv_t result;
-
-  result.quot = numer / denom;
-  result.rem = numer % denom;
-
-  /* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
-     NUMER / DENOM is to be computed in infinite precision.  In
-     other words, we should always truncate the quotient towards
-     zero, never -infinity.  Machine division and remainer may
-     work either way when one or both of NUMER or DENOM is
-     negative.  If only one is negative and QUOT has been
-     truncated towards -infinity, REM will have the same sign as
-     DENOM and the opposite sign of NUMER; if both are negative
-     and QUOT has been truncated towards -infinity, REM will be
-     positive (will have the opposite sign of NUMER).  These are
-     considered `wrong'.  If both are NUM and DENOM are positive,
-     RESULT will always be positive.  This all boils down to: if
-     NUMER >= 0, but REM < 0, we got the wrong answer.  In that
-     case, to get the right answer, add 1 to QUOT and subtract
-     DENOM from REM.  */
-
-  if (numer >= 0 && result.rem < 0)
-    {
-      ++result.quot;
-      result.rem -= denom;
-    }
-
-  return result;
-}
diff --git a/sysdeps/generic/llistxattr.c b/sysdeps/generic/llistxattr.c
deleted file mode 100644
index 1a7e1e4cfd..0000000000
--- a/sysdeps/generic/llistxattr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-ssize_t
-llistxattr (const char *__path, char *__list, size_t __size)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (llistxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/local-setxid.h b/sysdeps/generic/local-setxid.h
new file mode 100644
index 0000000000..b70d9ffb32
--- /dev/null
+++ b/sysdeps/generic/local-setxid.h
@@ -0,0 +1,4 @@
+/* No special support.  Fall back to the regular functions.  */
+
+#define local_seteuid(id) seteuid (id)
+#define local_setegid(id) setegid (id)
diff --git a/sysdeps/generic/lockf.c b/sysdeps/generic/lockf.c
deleted file mode 100644
index 7b23f66bc9..0000000000
--- a/sysdeps/generic/lockf.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 1994,1996,1997,1998,2000,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-/* lockf is a simplified interface to fcntl's locking facilities.  */
-
-int
-lockf (int fd, int cmd, off_t len)
-{
-  struct flock fl;
-
-  memset ((char *) &fl, '\0', sizeof (fl));
-
-  /* lockf is always relative to the current file position.  */
-  fl.l_whence = SEEK_CUR;
-  fl.l_start = 0;
-  fl.l_len = len;
-
-  switch (cmd)
-    {
-    case F_TEST:
-      /* Test the lock: return 0 if FD is unlocked or locked by this process;
-	 return -1, set errno to EACCES, if another process holds the lock.  */
-      fl.l_type = F_RDLCK;
-      if (__fcntl (fd, F_GETLK, &fl) < 0)
-	return -1;
-      if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ())
-	return 0;
-      __set_errno (EACCES);
-      return -1;
-
-    case F_ULOCK:
-      fl.l_type = F_UNLCK;
-      cmd = F_SETLK;
-      break;
-    case F_LOCK:
-      fl.l_type = F_WRLCK;
-      cmd = F_SETLKW;
-      break;
-    case F_TLOCK:
-      fl.l_type = F_WRLCK;
-      cmd = F_SETLK;
-      break;
-
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* lockf() is a cancellation point but so is fcntl() if F_SETLKW is
-     used.  Therefore we don't have to care about cancellation here,
-     the fcntl() function will take care of it.  */
-  return __fcntl (fd, cmd, &fl);
-}
diff --git a/sysdeps/generic/lockf64.c b/sysdeps/generic/lockf64.c
deleted file mode 100644
index e3b110cd3f..0000000000
--- a/sysdeps/generic/lockf64.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 1994,96,97,98,99,2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-/* lockf is a simplified interface to fcntl's locking facilities.  */
-
-int
-lockf64 (int fd, int cmd, off64_t len64)
-{
-  struct flock fl;
-  off_t len = (off_t) len64;
-
-  if (len64 != (off64_t) len)
-    {
-      /* We can't represent the length.  */
-      __set_errno (EOVERFLOW);
-      return -1;
-    }
-
-  memset ((char *) &fl, '\0', sizeof (fl));
-
-  /* lockf is always relative to the current file position.  */
-  fl.l_whence = SEEK_CUR;
-  fl.l_start = 0;
-  fl.l_len = len;
-
-  switch (cmd)
-    {
-    case F_TEST:
-      /* Test the lock: return 0 if FD is unlocked or locked by this process;
-	 return -1, set errno to EACCES, if another process holds the lock.  */
-      fl.l_type = F_RDLCK;
-      if (__fcntl (fd, F_GETLK, &fl) < 0)
-	return -1;
-      if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ())
-	return 0;
-      __set_errno (EACCES);
-      return -1;
-
-    case F_ULOCK:
-      fl.l_type = F_UNLCK;
-      cmd = F_SETLK;
-      break;
-    case F_LOCK:
-      fl.l_type = F_WRLCK;
-      cmd = F_SETLKW;
-      break;
-    case F_TLOCK:
-      fl.l_type = F_WRLCK;
-      cmd = F_SETLK;
-      break;
-
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return __fcntl (fd, cmd, &fl);
-}
diff --git a/sysdeps/generic/longjmp-ts.c b/sysdeps/generic/longjmp-ts.c
deleted file mode 100644
index e9c297a20b..0000000000
--- a/sysdeps/generic/longjmp-ts.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Perform a `longjmp' on a Mach thread_state.  Stub version.
-   Copyright (C) 1991, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-#include <mach/thread_status.h>
-
-/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'.  */
-
-void
-_hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
-{
-  /* Set all the registers in *STATE to the values described by ENV and
-     RETVAL.  After this, setting that thread's state to STATE should be
-     just like calling `longjmp (ENV, RETVAL)'.  */
-  #error "Need to write sysdeps/mach/hurd/MACHINE/longjmp-ctx.c"
-}
diff --git a/sysdeps/generic/longjmp.c b/sysdeps/generic/longjmp.c
deleted file mode 100644
index 9b1bda1caa..0000000000
--- a/sysdeps/generic/longjmp.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991,92,94,95,97,98,2000,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <setjmp.h>
-#include <signal.h>
-
-
-/* Set the signal mask to the one specified in ENV, and jump
-   to the position specified in ENV, causing the setjmp
-   call there to return VAL, or 1 if VAL is 0.  */
-void
-__libc_siglongjmp (sigjmp_buf env, int val)
-{
-  /* Perform any cleanups needed by the frames being unwound.  */
-  _longjmp_unwind (env, val);
-
-  if (env[0].__mask_was_saved)
-    /* Restore the saved signal mask.  */
-    (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
-			  (sigset_t *) NULL);
-
-  /* Call the machine-dependent function to restore machine state.  */
-  __longjmp (env[0].__jmpbuf, val ?: 1);
-}
-
-strong_alias (__libc_siglongjmp, __libc_longjmp)
-libc_hidden_def (__libc_longjmp)
-weak_alias (__libc_siglongjmp, _longjmp)
-weak_alias (__libc_siglongjmp, longjmp)
-weak_alias (__libc_siglongjmp, siglongjmp)
diff --git a/sysdeps/generic/lremovexattr.c b/sysdeps/generic/lremovexattr.c
deleted file mode 100644
index fad64e5150..0000000000
--- a/sysdeps/generic/lremovexattr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-int
-lremovexattr (const char *__path, const char *__name)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (lremovexattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lseek.c b/sysdeps/generic/lseek.c
deleted file mode 100644
index 6daf6ef154..0000000000
--- a/sysdeps/generic/lseek.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Seek to OFFSET on FD, starting from WHENCE.  */
-off_t
-__lseek (fd, offset, whence)
-     int fd;
-     off_t offset;
-     int whence;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  switch (whence)
-    {
-    case SEEK_SET:
-    case SEEK_CUR:
-    case SEEK_END:
-      break;
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (lseek)
-libc_hidden_def (__lseek)
-
-weak_alias (__lseek, lseek)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lseek64.c b/sysdeps/generic/lseek64.c
deleted file mode 100644
index d0a8cff03e..0000000000
--- a/sysdeps/generic/lseek64.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1991,95,96,97,98,2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Seek to OFFSET on FD, starting from WHENCE.  */
-off64_t
-__libc_lseek64 (int fd, off64_t offset, int whence)
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  switch (whence)
-    {
-    case SEEK_SET:
-    case SEEK_CUR:
-    case SEEK_END:
-      break;
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__libc_lseek64, __lseek64)
-weak_alias (__libc_lseek64, lseek64)
-stub_warning (lseek64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lsetxattr.c b/sysdeps/generic/lsetxattr.c
deleted file mode 100644
index 6f8cdde1da..0000000000
--- a/sysdeps/generic/lsetxattr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-int
-lsetxattr (const char *__path, const char *__name,
-	   const void *__value, size_t __size, int __flags)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (lsetxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lshift.c b/sysdeps/generic/lshift.c
deleted file mode 100644
index 0b58389658..0000000000
--- a/sysdeps/generic/lshift.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* mpn_lshift -- Shift left low level.
-
-Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-/* Shift U (pointed to by UP and USIZE digits long) CNT bits to the left
-   and store the USIZE least significant digits of the result at WP.
-   Return the bits shifted out from the most significant digit.
-
-   Argument constraints:
-   1. 0 < CNT < BITS_PER_MP_LIMB
-   2. If the result is to be written over the input, WP must be >= UP.
-*/
-
-mp_limb_t
-#if __STDC__
-mpn_lshift (register mp_ptr wp,
-	    register mp_srcptr up, mp_size_t usize,
-	    register unsigned int cnt)
-#else
-mpn_lshift (wp, up, usize, cnt)
-     register mp_ptr wp;
-     register mp_srcptr up;
-     mp_size_t usize;
-     register unsigned int cnt;
-#endif
-{
-  register mp_limb_t high_limb, low_limb;
-  register unsigned sh_1, sh_2;
-  register mp_size_t i;
-  mp_limb_t retval;
-
-#ifdef DEBUG
-  if (usize == 0 || cnt == 0)
-    abort ();
-#endif
-
-  sh_1 = cnt;
-#if 0
-  if (sh_1 == 0)
-    {
-      if (wp != up)
-	{
-	  /* Copy from high end to low end, to allow specified input/output
-	     overlapping.  */
-	  for (i = usize - 1; i >= 0; i--)
-	    wp[i] = up[i];
-	}
-      return 0;
-    }
-#endif
-
-  wp += 1;
-  sh_2 = BITS_PER_MP_LIMB - sh_1;
-  i = usize - 1;
-  low_limb = up[i];
-  retval = low_limb >> sh_2;
-  high_limb = low_limb;
-  while (--i >= 0)
-    {
-      low_limb = up[i];
-      wp[i] = (high_limb << sh_1) | (low_limb >> sh_2);
-      high_limb = low_limb;
-    }
-  wp[i] = high_limb << sh_1;
-
-  return retval;
-}
diff --git a/sysdeps/generic/lutimes.c b/sysdeps/generic/lutimes.c
deleted file mode 100644
index 34fc1838f0..0000000000
--- a/sysdeps/generic/lutimes.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* lutimes -- change access and modification times of a symlink.  Stub version.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/time.h>
-#include <errno.h>
-#include <stddef.h>
-
-/* Change the access time of FILE to TVP[0] and
-   the modification time of FILE to TVP[1], but do not follow symlinks.  */
-int
-__lutimes (const char *file, const struct timeval tvp[2])
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__lutimes, lutimes)
-
-stub_warning (lutimes)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/lxstat.c b/sysdeps/generic/lxstat.c
deleted file mode 100644
index 23d4442b5c..0000000000
--- a/sysdeps/generic/lxstat.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1991,1992,1995,1996,1997,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/stat.h>
-
-int
-__lxstat (int version, const char *file, struct stat *buf)
-{
-  return __xstat (version, file, buf);
-}
-hidden_def (__lxstat)
-weak_alias (__lxstat, _lxstat)
diff --git a/sysdeps/generic/lxstat64.c b/sysdeps/generic/lxstat64.c
deleted file mode 100644
index 596ecd2277..0000000000
--- a/sysdeps/generic/lxstat64.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-
-/* Get file information about FILE in BUF.
-   If FILE is a symbolic link, do not follow it.  */
-int
-__lxstat64 (int vers, const char *file, struct stat64 *buf)
-{
-  if (vers != _STAT_VER || file == NULL || buf == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-hidden_def (__lxstat64)
-stub_warning (__lxstat64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/madvise.c b/sysdeps/generic/madvise.c
deleted file mode 100644
index dbef959dd8..0000000000
--- a/sysdeps/generic/madvise.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Advise the system about particular usage patterns the program follows
-   for the region starting at ADDR and extending LEN bytes.  */
-
-int
-madvise (__ptr_t addr, size_t len, int advice)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (madvise)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/makecontext.c b/sysdeps/generic/makecontext.c
deleted file mode 100644
index a65868827f..0000000000
--- a/sysdeps/generic/makecontext.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <ucontext.h>
-
-void
-makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
-{
-  __set_errno (ENOSYS);
-}
-
-
-stub_warning (makecontext)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/math_ldbl_opt.h b/sysdeps/generic/math_ldbl_opt.h
new file mode 100644
index 0000000000..8a5d8ba107
--- /dev/null
+++ b/sysdeps/generic/math_ldbl_opt.h
@@ -0,0 +1,14 @@
+/* -mlong-double-64 compatibility mode macros.  Stub version.
+
+   These macros are used by some math/ and sysdeps/ieee754/ code.
+   These are the generic definitions for when no funny business is going on.
+   sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h defines them differently
+   for platforms where compatibility symbols are required for a previous
+   ABI that defined long double functions as aliases for the double code.  */
+
+#define LONG_DOUBLE_COMPAT(lib, introduced) 0
+#define long_double_symbol(lib, local, symbol)
+#define ldbl_hidden_def(local, name) libc_hidden_def (name)
+#define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+#define ldbl_weak_alias(name, aliasname) weak_alias (name, aliasname)
+#define __ldbl_is_dbl 0
diff --git a/sysdeps/generic/memccpy.c b/sysdeps/generic/memccpy.c
deleted file mode 100644
index 9ffdc335d4..0000000000
--- a/sysdeps/generic/memccpy.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1995, 1997, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#undef __memccpy
-#undef memccpy
-
-/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
-   Return the position in DEST one byte past where C was copied, or
-   NULL if C was not found in the first N bytes of SRC.  */
-void *
-__memccpy (dest, src, c, n)
-      void *dest;
-      const void *src;
-      int c;
-      size_t n;
-{
-  register const char *s = src;
-  register char *d = dest;
-  register const char x = c;
-  register size_t i = n;
-
-  while (i-- > 0)
-    if ((*d++ = *s++) == x)
-      return d;
-
-  return NULL;
-}
-
-weak_alias (__memccpy, memccpy)
diff --git a/sysdeps/generic/memchr.c b/sysdeps/generic/memchr.c
deleted file mode 100644
index f3098c775a..0000000000
--- a/sysdeps/generic/memchr.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* Copyright (C) 1991,93,96,97,99,2000,2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se) and
-   commentary by Jim Blandy (jimb@ai.mit.edu);
-   adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
-   and implemented by Roland McGrath (roland@ai.mit.edu).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#undef __ptr_t
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
-# define __ptr_t void *
-#else /* Not C++ or ANSI C.  */
-# define __ptr_t char *
-#endif /* C++ or ANSI C.  */
-
-#if defined _LIBC
-# include <string.h>
-# include <memcopy.h>
-#else
-# define reg_char char
-#endif
-
-#if HAVE_STDLIB_H || defined _LIBC
-# include <stdlib.h>
-#endif
-
-#if HAVE_LIMITS_H || defined _LIBC
-# include <limits.h>
-#endif
-
-#define LONG_MAX_32_BITS 2147483647
-
-#ifndef LONG_MAX
-#define LONG_MAX LONG_MAX_32_BITS
-#endif
-
-#include <sys/types.h>
-#if HAVE_BP_SYM_H || defined _LIBC
-#include <bp-sym.h>
-#else
-# define BP_SYM(sym) sym
-#endif
-
-#undef memchr
-#undef __memchr
-
-/* Search no more than N bytes of S for C.  */
-__ptr_t
-__memchr (s, c_in, n)
-     const __ptr_t s;
-     int c_in;
-     size_t n;
-{
-  const unsigned char *char_ptr;
-  const unsigned long int *longword_ptr;
-  unsigned long int longword, magic_bits, charmask;
-  unsigned reg_char c;
-
-  c = (unsigned char) c_in;
-
-  /* Handle the first few characters by reading one character at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = (const unsigned char *) s;
-       n > 0 && ((unsigned long int) char_ptr
-		 & (sizeof (longword) - 1)) != 0;
-       --n, ++char_ptr)
-    if (*char_ptr == c)
-      return (__ptr_t) char_ptr;
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
-
-  longword_ptr = (unsigned long int *) char_ptr;
-
-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
-     the "holes."  Note that there is a hole just to the left of
-     each byte, with an extra at the end:
-
-     bits:  01111110 11111110 11111110 11111111
-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-
-     The 1-bits make sure that carries propagate to the next 0-bit.
-     The 0-bits provide holes for carries to fall into.  */
-
-  if (sizeof (longword) != 4 && sizeof (longword) != 8)
-    abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
-  magic_bits = 0x7efefeff;
-#else
-  magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
-
-  /* Set up a longword, each of whose bytes is C.  */
-  charmask = c | (c << 8);
-  charmask |= charmask << 16;
-#if LONG_MAX > LONG_MAX_32_BITS
-  charmask |= charmask << 32;
-#endif
-
-  /* Instead of the traditional loop which tests each character,
-     we will test a longword at a time.  The tricky part is testing
-     if *any of the four* bytes in the longword in question are zero.  */
-  while (n >= sizeof (longword))
-    {
-      /* We tentatively exit the loop if adding MAGIC_BITS to
-	 LONGWORD fails to change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.  If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-30 is set, there will be a carry
-	 into bit 31, so all of the hole bits will be changed.
-
-	 The one misfire occurs when bits 24-30 are clear and bit
-	 31 is set; in this case, the hole at bit 31 is not
-	 changed.  If we had access to the processor carry flag,
-	 we could close this loophole by putting the fourth hole
-	 at bit 32!
-
-	 So it ignores everything except 128's, when they're aligned
-	 properly.
-
-	 3) But wait!  Aren't we looking for C, not zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-      longword = *longword_ptr++ ^ charmask;
-
-      /* Add MAGIC_BITS to LONGWORD.  */
-      if ((((longword + magic_bits)
-
-	    /* Set those bits that were unchanged by the addition.  */
-	    ^ ~longword)
-
-	   /* Look at only the hole bits.  If any of the hole bits
-	      are unchanged, most likely one of the bytes was a
-	      zero.  */
-	   & ~magic_bits) != 0)
-	{
-	  /* Which of the bytes was C?  If none of them were, it was
-	     a misfire; continue the search.  */
-
-	  const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
-
-	  if (cp[0] == c)
-	    return (__ptr_t) cp;
-	  if (cp[1] == c)
-	    return (__ptr_t) &cp[1];
-	  if (cp[2] == c)
-	    return (__ptr_t) &cp[2];
-	  if (cp[3] == c)
-	    return (__ptr_t) &cp[3];
-#if LONG_MAX > 2147483647
-	  if (cp[4] == c)
-	    return (__ptr_t) &cp[4];
-	  if (cp[5] == c)
-	    return (__ptr_t) &cp[5];
-	  if (cp[6] == c)
-	    return (__ptr_t) &cp[6];
-	  if (cp[7] == c)
-	    return (__ptr_t) &cp[7];
-#endif
-	}
-
-      n -= sizeof (longword);
-    }
-
-  char_ptr = (const unsigned char *) longword_ptr;
-
-  while (n-- > 0)
-    {
-      if (*char_ptr == c)
-	return (__ptr_t) char_ptr;
-      else
-	++char_ptr;
-    }
-
-  return 0;
-}
-#ifdef weak_alias
-weak_alias (__memchr, BP_SYM (memchr))
-#endif
-libc_hidden_builtin_def (memchr)
diff --git a/sysdeps/generic/memcmp.c b/sysdeps/generic/memcmp.c
deleted file mode 100644
index 2f8cf344af..0000000000
--- a/sysdeps/generic/memcmp.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/* Copyright (C) 1991,1993,1995,1997,1998,2003,2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#undef	__ptr_t
-#if defined __cplusplus || (defined __STDC__ && __STDC__)
-# define __ptr_t	void *
-#else /* Not C++ or ANSI C.  */
-# undef	const
-# define const
-# define __ptr_t	char *
-#endif /* C++ or ANSI C.  */
-
-#if defined HAVE_STRING_H || defined _LIBC
-# include <string.h>
-#endif
-
-#undef memcmp
-
-#ifdef _LIBC
-
-# include <memcopy.h>
-# include <endian.h>
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define WORDS_BIGENDIAN
-# endif
-
-#else	/* Not in the GNU C library.  */
-
-# include <sys/types.h>
-
-/* Type to use for aligned memory operations.
-   This should normally be the biggest type supported by a single load
-   and store.  Must be an unsigned type.  */
-# define op_t	unsigned long int
-# define OPSIZ	(sizeof(op_t))
-
-/* Threshold value for when to enter the unrolled loops.  */
-# define OP_T_THRES	16
-
-/* Type to use for unaligned operations.  */
-typedef unsigned char byte;
-
-# ifndef WORDS_BIGENDIAN
-#  define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
-# else
-#  define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
-# endif
-
-#endif	/* In the GNU C library.  */
-
-#ifdef WORDS_BIGENDIAN
-# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
-#else
-# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
-#endif
-
-/* BE VERY CAREFUL IF YOU CHANGE THIS CODE!  */
-
-/* The strategy of this memcmp is:
-
-   1. Compare bytes until one of the block pointers is aligned.
-
-   2. Compare using memcmp_common_alignment or
-      memcmp_not_common_alignment, regarding the alignment of the other
-      block after the initial byte operations.  The maximum number of
-      full words (of type op_t) are compared in this way.
-
-   3. Compare the few remaining bytes.  */
-
-#ifndef WORDS_BIGENDIAN
-/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
-   A and B are known to be different.
-   This is needed only on little-endian machines.  */
-
-static int memcmp_bytes (op_t, op_t) __THROW;
-
-# ifdef  __GNUC__
-__inline
-# endif
-static int
-memcmp_bytes (a, b)
-     op_t a, b;
-{
-  long int srcp1 = (long int) &a;
-  long int srcp2 = (long int) &b;
-  op_t a0, b0;
-
-  do
-    {
-      a0 = ((byte *) srcp1)[0];
-      b0 = ((byte *) srcp2)[0];
-      srcp1 += 1;
-      srcp2 += 1;
-    }
-  while (a0 == b0);
-  return a0 - b0;
-}
-#endif
-
-static int memcmp_common_alignment (long, long, size_t) __THROW;
-
-/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
-   objects (not LEN bytes!).  Both SRCP1 and SRCP2 should be aligned for
-   memory operations on `op_t's.  */
-static int
-memcmp_common_alignment (srcp1, srcp2, len)
-     long int srcp1;
-     long int srcp2;
-     size_t len;
-{
-  op_t a0, a1;
-  op_t b0, b1;
-
-  switch (len % 4)
-    {
-    default: /* Avoid warning about uninitialized local variables.  */
-    case 2:
-      a0 = ((op_t *) srcp1)[0];
-      b0 = ((op_t *) srcp2)[0];
-      srcp1 -= 2 * OPSIZ;
-      srcp2 -= 2 * OPSIZ;
-      len += 2;
-      goto do1;
-    case 3:
-      a1 = ((op_t *) srcp1)[0];
-      b1 = ((op_t *) srcp2)[0];
-      srcp1 -= OPSIZ;
-      srcp2 -= OPSIZ;
-      len += 1;
-      goto do2;
-    case 0:
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	return 0;
-      a0 = ((op_t *) srcp1)[0];
-      b0 = ((op_t *) srcp2)[0];
-      goto do3;
-    case 1:
-      a1 = ((op_t *) srcp1)[0];
-      b1 = ((op_t *) srcp2)[0];
-      srcp1 += OPSIZ;
-      srcp2 += OPSIZ;
-      len -= 1;
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	goto do0;
-      /* Fall through.  */
-    }
-
-  do
-    {
-      a0 = ((op_t *) srcp1)[0];
-      b0 = ((op_t *) srcp2)[0];
-      if (a1 != b1)
-	return CMP_LT_OR_GT (a1, b1);
-
-    do3:
-      a1 = ((op_t *) srcp1)[1];
-      b1 = ((op_t *) srcp2)[1];
-      if (a0 != b0)
-	return CMP_LT_OR_GT (a0, b0);
-
-    do2:
-      a0 = ((op_t *) srcp1)[2];
-      b0 = ((op_t *) srcp2)[2];
-      if (a1 != b1)
-	return CMP_LT_OR_GT (a1, b1);
-
-    do1:
-      a1 = ((op_t *) srcp1)[3];
-      b1 = ((op_t *) srcp2)[3];
-      if (a0 != b0)
-	return CMP_LT_OR_GT (a0, b0);
-
-      srcp1 += 4 * OPSIZ;
-      srcp2 += 4 * OPSIZ;
-      len -= 4;
-    }
-  while (len != 0);
-
-  /* This is the right position for do0.  Please don't move
-     it into the loop.  */
- do0:
-  if (a1 != b1)
-    return CMP_LT_OR_GT (a1, b1);
-  return 0;
-}
-
-static int memcmp_not_common_alignment (long, long, size_t) __THROW;
-
-/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
-   `op_t' objects (not LEN bytes!).  SRCP2 should be aligned for memory
-   operations on `op_t', but SRCP1 *should be unaligned*.  */
-static int
-memcmp_not_common_alignment (srcp1, srcp2, len)
-     long int srcp1;
-     long int srcp2;
-     size_t len;
-{
-  op_t a0, a1, a2, a3;
-  op_t b0, b1, b2, b3;
-  op_t x;
-  int shl, shr;
-
-  /* Calculate how to shift a word read at the memory operation
-     aligned srcp1 to make it aligned for comparison.  */
-
-  shl = 8 * (srcp1 % OPSIZ);
-  shr = 8 * OPSIZ - shl;
-
-  /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t'
-     it points in the middle of.  */
-  srcp1 &= -OPSIZ;
-
-  switch (len % 4)
-    {
-    default: /* Avoid warning about uninitialized local variables.  */
-    case 2:
-      a1 = ((op_t *) srcp1)[0];
-      a2 = ((op_t *) srcp1)[1];
-      b2 = ((op_t *) srcp2)[0];
-      srcp1 -= 1 * OPSIZ;
-      srcp2 -= 2 * OPSIZ;
-      len += 2;
-      goto do1;
-    case 3:
-      a0 = ((op_t *) srcp1)[0];
-      a1 = ((op_t *) srcp1)[1];
-      b1 = ((op_t *) srcp2)[0];
-      srcp2 -= 1 * OPSIZ;
-      len += 1;
-      goto do2;
-    case 0:
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	return 0;
-      a3 = ((op_t *) srcp1)[0];
-      a0 = ((op_t *) srcp1)[1];
-      b0 = ((op_t *) srcp2)[0];
-      srcp1 += 1 * OPSIZ;
-      goto do3;
-    case 1:
-      a2 = ((op_t *) srcp1)[0];
-      a3 = ((op_t *) srcp1)[1];
-      b3 = ((op_t *) srcp2)[0];
-      srcp1 += 2 * OPSIZ;
-      srcp2 += 1 * OPSIZ;
-      len -= 1;
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	goto do0;
-      /* Fall through.  */
-    }
-
-  do
-    {
-      a0 = ((op_t *) srcp1)[0];
-      b0 = ((op_t *) srcp2)[0];
-      x = MERGE(a2, shl, a3, shr);
-      if (x != b3)
-	return CMP_LT_OR_GT (x, b3);
-
-    do3:
-      a1 = ((op_t *) srcp1)[1];
-      b1 = ((op_t *) srcp2)[1];
-      x = MERGE(a3, shl, a0, shr);
-      if (x != b0)
-	return CMP_LT_OR_GT (x, b0);
-
-    do2:
-      a2 = ((op_t *) srcp1)[2];
-      b2 = ((op_t *) srcp2)[2];
-      x = MERGE(a0, shl, a1, shr);
-      if (x != b1)
-	return CMP_LT_OR_GT (x, b1);
-
-    do1:
-      a3 = ((op_t *) srcp1)[3];
-      b3 = ((op_t *) srcp2)[3];
-      x = MERGE(a1, shl, a2, shr);
-      if (x != b2)
-	return CMP_LT_OR_GT (x, b2);
-
-      srcp1 += 4 * OPSIZ;
-      srcp2 += 4 * OPSIZ;
-      len -= 4;
-    }
-  while (len != 0);
-
-  /* This is the right position for do0.  Please don't move
-     it into the loop.  */
- do0:
-  x = MERGE(a2, shl, a3, shr);
-  if (x != b3)
-    return CMP_LT_OR_GT (x, b3);
-  return 0;
-}
-
-int
-memcmp (s1, s2, len)
-     const __ptr_t s1;
-     const __ptr_t s2;
-     size_t len;
-{
-  op_t a0;
-  op_t b0;
-  long int srcp1 = (long int) s1;
-  long int srcp2 = (long int) s2;
-  op_t res;
-
-  if (len >= OP_T_THRES)
-    {
-      /* There are at least some bytes to compare.  No need to test
-	 for LEN == 0 in this alignment loop.  */
-      while (srcp2 % OPSIZ != 0)
-	{
-	  a0 = ((byte *) srcp1)[0];
-	  b0 = ((byte *) srcp2)[0];
-	  srcp1 += 1;
-	  srcp2 += 1;
-	  res = a0 - b0;
-	  if (res != 0)
-	    return res;
-	  len -= 1;
-	}
-
-      /* SRCP2 is now aligned for memory operations on `op_t'.
-	 SRCP1 alignment determines if we can do a simple,
-	 aligned compare or need to shuffle bits.  */
-
-      if (srcp1 % OPSIZ == 0)
-	res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ);
-      else
-	res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ);
-      if (res != 0)
-	return res;
-
-      /* Number of bytes remaining in the interval [0..OPSIZ-1].  */
-      srcp1 += len & -OPSIZ;
-      srcp2 += len & -OPSIZ;
-      len %= OPSIZ;
-    }
-
-  /* There are just a few bytes to compare.  Use byte memory operations.  */
-  while (len != 0)
-    {
-      a0 = ((byte *) srcp1)[0];
-      b0 = ((byte *) srcp2)[0];
-      srcp1 += 1;
-      srcp2 += 1;
-      res = a0 - b0;
-      if (res != 0)
-	return res;
-      len -= 1;
-    }
-
-  return 0;
-}
-libc_hidden_builtin_def(memcmp)
-#ifdef weak_alias
-# undef bcmp
-weak_alias (memcmp, bcmp)
-#endif
diff --git a/sysdeps/generic/memcpy.c b/sysdeps/generic/memcpy.c
deleted file mode 100644
index e167e85d7b..0000000000
--- a/sysdeps/generic/memcpy.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copy memory to memory until the specified number of bytes
-   has been copied.  Overlap is NOT handled correctly.
-   Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <pagecopy.h>
-
-#undef memcpy
-
-void *
-memcpy (dstpp, srcpp, len)
-     void *dstpp;
-     const void *srcpp;
-     size_t len;
-{
-  unsigned long int dstp = (long int) dstpp;
-  unsigned long int srcp = (long int) srcpp;
-
-  /* Copy from the beginning to the end.  */
-
-  /* If there not too few bytes to copy, use word copy.  */
-  if (len >= OP_T_THRES)
-    {
-      /* Copy just a few bytes to make DSTP aligned.  */
-      len -= (-dstp) % OPSIZ;
-      BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
-
-      /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
-	 as much as possible.  */
-
-      PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
-
-      /* Copy from SRCP to DSTP taking advantage of the known alignment of
-	 DSTP.  Number of bytes remaining is put in the third argument,
-	 i.e. in LEN.  This number may vary from machine to machine.  */
-
-      WORD_COPY_FWD (dstp, srcp, len, len);
-
-      /* Fall out and copy the tail.  */
-    }
-
-  /* There are just a few bytes to copy.  Use byte memory operations.  */
-  BYTE_COPY_FWD (dstp, srcp, len);
-
-  return dstpp;
-}
-libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/generic/memcpy_chk.c b/sysdeps/generic/memcpy_chk.c
deleted file mode 100644
index 638cd0e4fb..0000000000
--- a/sysdeps/generic/memcpy_chk.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copy memory to memory until the specified number of bytes
-   has been copied with error checking.  Overlap is NOT handled correctly.
-   Copyright (C) 1991, 1997, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <pagecopy.h>
-
-void *
-__memcpy_chk (dstpp, srcpp, len, dstlen)
-     void *dstpp;
-     const void *srcpp;
-     size_t len;
-     size_t dstlen;
-{
-  if (__builtin_expect (dstlen < len, 0))
-    __chk_fail ();
-
-  unsigned long int dstp = (long int) dstpp;
-  unsigned long int srcp = (long int) srcpp;
-
-  /* Copy from the beginning to the end.  */
-
-  /* If there not too few bytes to copy, use word copy.  */
-  if (len >= OP_T_THRES)
-    {
-      /* Copy just a few bytes to make DSTP aligned.  */
-      len -= (-dstp) % OPSIZ;
-      BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
-
-      /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
-	 as much as possible.  */
-
-      PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
-
-      /* Copy from SRCP to DSTP taking advantage of the known alignment of
-	 DSTP.  Number of bytes remaining is put in the third argument,
-	 i.e. in LEN.  This number may vary from machine to machine.  */
-
-      WORD_COPY_FWD (dstp, srcp, len, len);
-
-      /* Fall out and copy the tail.  */
-    }
-
-  /* There are just a few bytes to copy.  Use byte memory operations.  */
-  BYTE_COPY_FWD (dstp, srcp, len);
-
-  return dstpp;
-}
diff --git a/sysdeps/generic/memmem.c b/sysdeps/generic/memmem.c
deleted file mode 100644
index c40462104a..0000000000
--- a/sysdeps/generic/memmem.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <string.h>
-
-#ifndef _LIBC
-# define __builtin_expect(expr, val)   (expr)
-#endif
-
-#undef memmem
-
-/* Return the first occurrence of NEEDLE in HAYSTACK.  */
-void *
-memmem (haystack, haystack_len, needle, needle_len)
-     const void *haystack;
-     size_t haystack_len;
-     const void *needle;
-     size_t needle_len;
-{
-  const char *begin;
-  const char *const last_possible
-    = (const char *) haystack + haystack_len - needle_len;
-
-  if (needle_len == 0)
-    /* The first occurrence of the empty string is deemed to occur at
-       the beginning of the string.  */
-    return (void *) haystack;
-
-  /* Sanity check, otherwise the loop might search through the whole
-     memory.  */
-  if (__builtin_expect (haystack_len < needle_len, 0))
-    return NULL;
-
-  for (begin = (const char *) haystack; begin <= last_possible; ++begin)
-    if (begin[0] == ((const char *) needle)[0] &&
-	!memcmp ((const void *) &begin[1],
-		 (const void *) ((const char *) needle + 1),
-		 needle_len - 1))
-      return (void *) begin;
-
-  return NULL;
-}
diff --git a/sysdeps/generic/memmove.c b/sysdeps/generic/memmove.c
deleted file mode 100644
index 16671f7bb5..0000000000
--- a/sysdeps/generic/memmove.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copy memory to memory until the specified number of bytes
-   has been copied.  Overlap is handled correctly.
-   Copyright (C) 1991, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <pagecopy.h>
-
-/* All this is so that bcopy.c can #include
-   this file after defining some things.  */
-#ifndef	a1
-#define	a1	dest	/* First arg is DEST.  */
-#define	a1const
-#define	a2	src	/* Second arg is SRC.  */
-#define	a2const	const
-#undef memmove
-#endif
-#if	!defined(RETURN) || !defined(rettype)
-#define	RETURN(s)	return (s)	/* Return DEST.  */
-#define	rettype		void *
-#endif
-
-
-rettype
-memmove (a1, a2, len)
-     a1const void *a1;
-     a2const void *a2;
-     size_t len;
-{
-  unsigned long int dstp = (long int) dest;
-  unsigned long int srcp = (long int) src;
-
-  /* This test makes the forward copying code be used whenever possible.
-     Reduces the working set.  */
-  if (dstp - srcp >= len)	/* *Unsigned* compare!  */
-    {
-      /* Copy from the beginning to the end.  */
-
-      /* If there not too few bytes to copy, use word copy.  */
-      if (len >= OP_T_THRES)
-	{
-	  /* Copy just a few bytes to make DSTP aligned.  */
-	  len -= (-dstp) % OPSIZ;
-	  BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
-
-	  /* Copy whole pages from SRCP to DSTP by virtual address
-	     manipulation, as much as possible.  */
-
-	  PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
-
-	  /* Copy from SRCP to DSTP taking advantage of the known
-	     alignment of DSTP.  Number of bytes remaining is put
-	     in the third argument, i.e. in LEN.  This number may
-	     vary from machine to machine.  */
-
-	  WORD_COPY_FWD (dstp, srcp, len, len);
-
-	  /* Fall out and copy the tail.  */
-	}
-
-      /* There are just a few bytes to copy.  Use byte memory operations.  */
-      BYTE_COPY_FWD (dstp, srcp, len);
-    }
-  else
-    {
-      /* Copy from the end to the beginning.  */
-      srcp += len;
-      dstp += len;
-
-      /* If there not too few bytes to copy, use word copy.  */
-      if (len >= OP_T_THRES)
-	{
-	  /* Copy just a few bytes to make DSTP aligned.  */
-	  len -= dstp % OPSIZ;
-	  BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);
-
-	  /* Copy from SRCP to DSTP taking advantage of the known
-	     alignment of DSTP.  Number of bytes remaining is put
-	     in the third argument, i.e. in LEN.  This number may
-	     vary from machine to machine.  */
-
-	  WORD_COPY_BWD (dstp, srcp, len, len);
-
-	  /* Fall out and copy the tail.  */
-	}
-
-      /* There are just a few bytes to copy.  Use byte memory operations.  */
-      BYTE_COPY_BWD (dstp, srcp, len);
-    }
-
-  RETURN (dest);
-}
-#ifndef memmove
-libc_hidden_builtin_def (memmove)
-#endif
diff --git a/sysdeps/generic/memmove_chk.c b/sysdeps/generic/memmove_chk.c
deleted file mode 100644
index f3b74d23d9..0000000000
--- a/sysdeps/generic/memmove_chk.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copy memory to memory until the specified number of bytes
-   has been copied with error checking.  Overlap is handled correctly.
-   Copyright (C) 1991,1995,1996,1997,2003,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <pagecopy.h>
-
-void *
-__memmove_chk (dest, src, len, destlen)
-     void *dest;
-     const void *src;
-     size_t len;
-     size_t destlen;
-{
-  if (__builtin_expect (destlen < len, 0))
-    __chk_fail ();
-
-  unsigned long int dstp = (long int) dest;
-  unsigned long int srcp = (long int) src;
-
-  /* This test makes the forward copying code be used whenever possible.
-     Reduces the working set.  */
-  if (dstp - srcp >= len)	/* *Unsigned* compare!  */
-    {
-      /* Copy from the beginning to the end.  */
-
-      /* If there not too few bytes to copy, use word copy.  */
-      if (len >= OP_T_THRES)
-	{
-	  /* Copy just a few bytes to make DSTP aligned.  */
-	  len -= (-dstp) % OPSIZ;
-	  BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
-
-	  /* Copy whole pages from SRCP to DSTP by virtual address
-	     manipulation, as much as possible.  */
-
-	  PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
-
-	  /* Copy from SRCP to DSTP taking advantage of the known
-	     alignment of DSTP.  Number of bytes remaining is put
-	     in the third argument, i.e. in LEN.  This number may
-	     vary from machine to machine.  */
-
-	  WORD_COPY_FWD (dstp, srcp, len, len);
-
-	  /* Fall out and copy the tail.  */
-	}
-
-      /* There are just a few bytes to copy.  Use byte memory operations.  */
-      BYTE_COPY_FWD (dstp, srcp, len);
-    }
-  else
-    {
-      /* Copy from the end to the beginning.  */
-      srcp += len;
-      dstp += len;
-
-      /* If there not too few bytes to copy, use word copy.  */
-      if (len >= OP_T_THRES)
-	{
-	  /* Copy just a few bytes to make DSTP aligned.  */
-	  len -= dstp % OPSIZ;
-	  BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);
-
-	  /* Copy from SRCP to DSTP taking advantage of the known
-	     alignment of DSTP.  Number of bytes remaining is put
-	     in the third argument, i.e. in LEN.  This number may
-	     vary from machine to machine.  */
-
-	  WORD_COPY_BWD (dstp, srcp, len, len);
-
-	  /* Fall out and copy the tail.  */
-	}
-
-      /* There are just a few bytes to copy.  Use byte memory operations.  */
-      BYTE_COPY_BWD (dstp, srcp, len);
-    }
-
-  return dest;
-}
diff --git a/sysdeps/generic/mempcpy.c b/sysdeps/generic/mempcpy.c
deleted file mode 100644
index a72617e86f..0000000000
--- a/sysdeps/generic/mempcpy.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copy memory to memory until the specified number of bytes
-   has been copied, return pointer to following byte.
-   Overlap is NOT handled correctly.
-   Copyright (C) 1991, 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <pagecopy.h>
-
-#undef mempcpy
-#undef __mempcpy
-
-void *
-__mempcpy (dstpp, srcpp, len)
-     void *dstpp;
-     const void *srcpp;
-     size_t len;
-{
-  unsigned long int dstp = (long int) dstpp;
-  unsigned long int srcp = (long int) srcpp;
-
-  /* Copy from the beginning to the end.  */
-
-  /* If there not too few bytes to copy, use word copy.  */
-  if (len >= OP_T_THRES)
-    {
-      /* Copy just a few bytes to make DSTP aligned.  */
-      len -= (-dstp) % OPSIZ;
-      BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
-
-      /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
-	 as much as possible.  */
-
-      PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
-
-      /* Copy from SRCP to DSTP taking advantage of the known alignment of
-	 DSTP.  Number of bytes remaining is put in the third argument,
-	 i.e. in LEN.  This number may vary from machine to machine.  */
-
-      WORD_COPY_FWD (dstp, srcp, len, len);
-
-      /* Fall out and copy the tail.  */
-    }
-
-  /* There are just a few bytes to copy.  Use byte memory operations.  */
-  BYTE_COPY_FWD (dstp, srcp, len);
-
-  return (void *) dstp;
-}
-libc_hidden_def (__mempcpy)
-weak_alias (__mempcpy, mempcpy)
-libc_hidden_builtin_def (mempcpy)
diff --git a/sysdeps/generic/mempcpy_chk.c b/sysdeps/generic/mempcpy_chk.c
deleted file mode 100644
index 5297bbab92..0000000000
--- a/sysdeps/generic/mempcpy_chk.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copy memory to memory until the specified number of bytes
-   has been copied, return pointer to following byte, with error checking.
-   Overlap is NOT handled correctly.
-   Copyright (C) 1991, 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <pagecopy.h>
-
-void *
-__mempcpy_chk (dstpp, srcpp, len, dstlen)
-     void *dstpp;
-     const void *srcpp;
-     size_t len;
-     size_t dstlen;
-{
-  if (__builtin_expect (dstlen < len, 0))
-    __chk_fail ();
-
-  unsigned long int dstp = (long int) dstpp;
-  unsigned long int srcp = (long int) srcpp;
-
-  /* Copy from the beginning to the end.  */
-
-  /* If there not too few bytes to copy, use word copy.  */
-  if (len >= OP_T_THRES)
-    {
-      /* Copy just a few bytes to make DSTP aligned.  */
-      len -= (-dstp) % OPSIZ;
-      BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
-
-      /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
-	 as much as possible.  */
-
-      PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
-
-      /* Copy from SRCP to DSTP taking advantage of the known alignment of
-	 DSTP.  Number of bytes remaining is put in the third argument,
-	 i.e. in LEN.  This number may vary from machine to machine.  */
-
-      WORD_COPY_FWD (dstp, srcp, len, len);
-
-      /* Fall out and copy the tail.  */
-    }
-
-  /* There are just a few bytes to copy.  Use byte memory operations.  */
-  BYTE_COPY_FWD (dstp, srcp, len);
-
-  return (void *) dstp;
-}
diff --git a/sysdeps/generic/memrchr.c b/sysdeps/generic/memrchr.c
deleted file mode 100644
index 21662b1bd7..0000000000
--- a/sysdeps/generic/memrchr.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* memrchr -- find the last occurrence of a byte in a memory block
-   Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se) and
-   commentary by Jim Blandy (jimb@ai.mit.edu);
-   adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
-   and implemented by Roland McGrath (roland@ai.mit.edu).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#undef __ptr_t
-#if defined __cplusplus || (defined __STDC__ && __STDC__)
-# define __ptr_t void *
-#else /* Not C++ or ANSI C.  */
-# define __ptr_t char *
-#endif /* C++ or ANSI C.  */
-
-#if defined _LIBC
-# include <string.h>
-# include <memcopy.h>
-#else
-# define reg_char char
-#endif
-
-#if defined HAVE_LIMITS_H || defined _LIBC
-# include <limits.h>
-#endif
-
-#define LONG_MAX_32_BITS 2147483647
-
-#ifndef LONG_MAX
-# define LONG_MAX LONG_MAX_32_BITS
-#endif
-
-#include <sys/types.h>
-
-#undef __memrchr
-#undef memrchr
-
-#ifndef weak_alias
-# define __memrchr memrchr
-#endif
-
-/* Search no more than N bytes of S for C.  */
-__ptr_t
-__memrchr (s, c_in, n)
-     const __ptr_t s;
-     int c_in;
-     size_t n;
-{
-  const unsigned char *char_ptr;
-  const unsigned long int *longword_ptr;
-  unsigned long int longword, magic_bits, charmask;
-  unsigned reg_char c;
-
-  c = (unsigned char) c_in;
-
-  /* Handle the last few characters by reading one character at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = (const unsigned char *) s + n;
-       n > 0 && ((unsigned long int) char_ptr
-		 & (sizeof (longword) - 1)) != 0;
-       --n)
-    if (*--char_ptr == c)
-      return (__ptr_t) char_ptr;
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
-
-  longword_ptr = (const unsigned long int *) char_ptr;
-
-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
-     the "holes."  Note that there is a hole just to the left of
-     each byte, with an extra at the end:
-
-     bits:  01111110 11111110 11111110 11111111
-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-
-     The 1-bits make sure that carries propagate to the next 0-bit.
-     The 0-bits provide holes for carries to fall into.  */
-
-  if (sizeof (longword) != 4 && sizeof (longword) != 8)
-    abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
-  magic_bits = 0x7efefeff;
-#else
-  magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
-
-  /* Set up a longword, each of whose bytes is C.  */
-  charmask = c | (c << 8);
-  charmask |= charmask << 16;
-#if LONG_MAX > LONG_MAX_32_BITS
-  charmask |= charmask << 32;
-#endif
-
-  /* Instead of the traditional loop which tests each character,
-     we will test a longword at a time.  The tricky part is testing
-     if *any of the four* bytes in the longword in question are zero.  */
-  while (n >= sizeof (longword))
-    {
-      /* We tentatively exit the loop if adding MAGIC_BITS to
-	 LONGWORD fails to change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.  If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-30 is set, there will be a carry
-	 into bit 31, so all of the hole bits will be changed.
-
-	 The one misfire occurs when bits 24-30 are clear and bit
-	 31 is set; in this case, the hole at bit 31 is not
-	 changed.  If we had access to the processor carry flag,
-	 we could close this loophole by putting the fourth hole
-	 at bit 32!
-
-	 So it ignores everything except 128's, when they're aligned
-	 properly.
-
-	 3) But wait!  Aren't we looking for C, not zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-      longword = *--longword_ptr ^ charmask;
-
-      /* Add MAGIC_BITS to LONGWORD.  */
-      if ((((longword + magic_bits)
-
-	    /* Set those bits that were unchanged by the addition.  */
-	    ^ ~longword)
-
-	   /* Look at only the hole bits.  If any of the hole bits
-	      are unchanged, most likely one of the bytes was a
-	      zero.  */
-	   & ~magic_bits) != 0)
-	{
-	  /* Which of the bytes was C?  If none of them were, it was
-	     a misfire; continue the search.  */
-
-	  const unsigned char *cp = (const unsigned char *) longword_ptr;
-
-#if LONG_MAX > 2147483647
-	  if (cp[7] == c)
-	    return (__ptr_t) &cp[7];
-	  if (cp[6] == c)
-	    return (__ptr_t) &cp[6];
-	  if (cp[5] == c)
-	    return (__ptr_t) &cp[5];
-	  if (cp[4] == c)
-	    return (__ptr_t) &cp[4];
-#endif
-	  if (cp[3] == c)
-	    return (__ptr_t) &cp[3];
-	  if (cp[2] == c)
-	    return (__ptr_t) &cp[2];
-	  if (cp[1] == c)
-	    return (__ptr_t) &cp[1];
-	  if (cp[0] == c)
-	    return (__ptr_t) cp;
-	}
-
-      n -= sizeof (longword);
-    }
-
-  char_ptr = (const unsigned char *) longword_ptr;
-
-  while (n-- > 0)
-    {
-      if (*--char_ptr == c)
-	return (__ptr_t) char_ptr;
-    }
-
-  return 0;
-}
-#ifdef weak_alias
-weak_alias (__memrchr, memrchr)
-#endif
diff --git a/sysdeps/generic/memset.c b/sysdeps/generic/memset.c
deleted file mode 100644
index 592b11e435..0000000000
--- a/sysdeps/generic/memset.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (C) 1991, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-#undef memset
-
-void *
-memset (dstpp, c, len)
-     void *dstpp;
-     int c;
-     size_t len;
-{
-  long int dstp = (long int) dstpp;
-
-  if (len >= 8)
-    {
-      size_t xlen;
-      op_t cccc;
-
-      cccc = (unsigned char) c;
-      cccc |= cccc << 8;
-      cccc |= cccc << 16;
-      if (OPSIZ > 4)
-	/* Do the shift in two steps to avoid warning if long has 32 bits.  */
-	cccc |= (cccc << 16) << 16;
-
-      /* There are at least some bytes to set.
-	 No need to test for LEN == 0 in this alignment loop.  */
-      while (dstp % OPSIZ != 0)
-	{
-	  ((byte *) dstp)[0] = c;
-	  dstp += 1;
-	  len -= 1;
-	}
-
-      /* Write 8 `op_t' per iteration until less than 8 `op_t' remain.  */
-      xlen = len / (OPSIZ * 8);
-      while (xlen > 0)
-	{
-	  ((op_t *) dstp)[0] = cccc;
-	  ((op_t *) dstp)[1] = cccc;
-	  ((op_t *) dstp)[2] = cccc;
-	  ((op_t *) dstp)[3] = cccc;
-	  ((op_t *) dstp)[4] = cccc;
-	  ((op_t *) dstp)[5] = cccc;
-	  ((op_t *) dstp)[6] = cccc;
-	  ((op_t *) dstp)[7] = cccc;
-	  dstp += 8 * OPSIZ;
-	  xlen -= 1;
-	}
-      len %= OPSIZ * 8;
-
-      /* Write 1 `op_t' per iteration until less than OPSIZ bytes remain.  */
-      xlen = len / OPSIZ;
-      while (xlen > 0)
-	{
-	  ((op_t *) dstp)[0] = cccc;
-	  dstp += OPSIZ;
-	  xlen -= 1;
-	}
-      len %= OPSIZ;
-    }
-
-  /* Write the last few bytes.  */
-  while (len > 0)
-    {
-      ((byte *) dstp)[0] = c;
-      dstp += 1;
-      len -= 1;
-    }
-
-  return dstpp;
-}
-libc_hidden_builtin_def (memset)
diff --git a/sysdeps/generic/memset_chk.c b/sysdeps/generic/memset_chk.c
deleted file mode 100644
index c311914395..0000000000
--- a/sysdeps/generic/memset_chk.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 1991, 1997, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-void *
-__memset_chk (dstpp, c, len, dstlen)
-     void *dstpp;
-     int c;
-     size_t len;
-     size_t dstlen;
-{
-  if (__builtin_expect (dstlen < len, 0))
-    __chk_fail ();
-
-  long int dstp = (long int) dstpp;
-
-  if (len >= 8)
-    {
-      size_t xlen;
-      op_t cccc;
-
-      cccc = (unsigned char) c;
-      cccc |= cccc << 8;
-      cccc |= cccc << 16;
-      if (OPSIZ > 4)
-	/* Do the shift in two steps to avoid warning if long has 32 bits.  */
-	cccc |= (cccc << 16) << 16;
-
-      /* There are at least some bytes to set.
-	 No need to test for LEN == 0 in this alignment loop.  */
-      while (dstp % OPSIZ != 0)
-	{
-	  ((byte *) dstp)[0] = c;
-	  dstp += 1;
-	  len -= 1;
-	}
-
-      /* Write 8 `op_t' per iteration until less than 8 `op_t' remain.  */
-      xlen = len / (OPSIZ * 8);
-      while (xlen > 0)
-	{
-	  ((op_t *) dstp)[0] = cccc;
-	  ((op_t *) dstp)[1] = cccc;
-	  ((op_t *) dstp)[2] = cccc;
-	  ((op_t *) dstp)[3] = cccc;
-	  ((op_t *) dstp)[4] = cccc;
-	  ((op_t *) dstp)[5] = cccc;
-	  ((op_t *) dstp)[6] = cccc;
-	  ((op_t *) dstp)[7] = cccc;
-	  dstp += 8 * OPSIZ;
-	  xlen -= 1;
-	}
-      len %= OPSIZ * 8;
-
-      /* Write 1 `op_t' per iteration until less than OPSIZ bytes remain.  */
-      xlen = len / OPSIZ;
-      while (xlen > 0)
-	{
-	  ((op_t *) dstp)[0] = cccc;
-	  dstp += OPSIZ;
-	  xlen -= 1;
-	}
-      len %= OPSIZ;
-    }
-
-  /* Write the last few bytes.  */
-  while (len > 0)
-    {
-      ((byte *) dstp)[0] = c;
-      dstp += 1;
-      len -= 1;
-    }
-
-  return dstpp;
-}
diff --git a/sysdeps/generic/memusage.h b/sysdeps/generic/memusage.h
index 3057beb6e7..a1205cec52 100644
--- a/sysdeps/generic/memusage.h
+++ b/sysdeps/generic/memusage.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2005 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
@@ -17,6 +17,9 @@
    02111-1307 USA.  */
 
 
+#include <limits.h>
+#include <atomic.h>
+
 #ifndef GETSP
 # warning "GETSP is not defined for this architecture."
 # define GETSP 0
@@ -33,3 +36,16 @@
     high = usecs >> 32;							      \
   }
 #endif
+
+#if LONG_BIT == 32
+# define memusage_cntr_t uatomic32_t
+#else
+# define memusage_cntr_t uatomic64_t
+#endif
+#ifndef memusage_size_t
+# if LONG_BIT == 32
+#  define memusage_size_t uatomic32_t
+# else
+#  define memusage_size_t uatomic64_t
+# endif
+#endif
diff --git a/sysdeps/generic/mig-reply.c b/sysdeps/generic/mig-reply.c
deleted file mode 100644
index 3b02028858..0000000000
--- a/sysdeps/generic/mig-reply.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1992, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <mach.h>
-
-/* These functions are called by MiG-generated code.  */
-
-static mach_port_t reply_port;
-
-/* Called by MiG to get a reply port.  */
-mach_port_t
-__mig_get_reply_port (void)
-{
-  if (reply_port == MACH_PORT_NULL)
-    reply_port = __mach_reply_port ();
-
-  return reply_port;
-}
-
-/* Called by MiG to deallocate the reply port.  */
-void
-__mig_dealloc_reply_port (void)
-{
-  mach_port_t port = reply_port;
-  reply_port = MACH_PORT_NULL;	/* So the mod_refs RPC won't use it.  */
-  __mach_port_mod_refs (__mach_task_self (), port,
-			MACH_PORT_RIGHT_RECEIVE, -1);
-}
-
-
-/* Called at startup with CPROC == NULL.  cthreads has a different version
-   of this function that is sometimes called with a `cproc_t' pointer.  */
-void
-__mig_init (void *cproc)
-{
-  if (cproc == 0)
-    reply_port = MACH_PORT_NULL;
-}
diff --git a/sysdeps/generic/mincore.c b/sysdeps/generic/mincore.c
deleted file mode 100644
index 804447e8f3..0000000000
--- a/sysdeps/generic/mincore.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/mman.h>
-#include <errno.h>
-
-int
-mincore (void *__start, size_t __len, unsigned char *__vec)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (mincore)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mkdir.c b/sysdeps/generic/mkdir.c
deleted file mode 100644
index 8037dfb3ee..0000000000
--- a/sysdeps/generic/mkdir.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-
-/* Create a directory named PATH with protections MODE.  */
-int
-__mkdir (path, mode)
-     const char *path;
-     mode_t mode;
-{
-  if (path == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (mkdir)
-
-weak_alias (__mkdir, mkdir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mkfifo.c b/sysdeps/generic/mkfifo.c
deleted file mode 100644
index 614ebe97c3..0000000000
--- a/sysdeps/generic/mkfifo.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-
-/* Create a named pipe (FIFO) named PATH with protections MODE.  */
-int
-mkfifo (path, mode)
-     const char *path;
-     mode_t mode;
-{
-  if (path == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (mkfifo)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mknod.c b/sysdeps/generic/mknod.c
deleted file mode 100644
index 7d43593a25..0000000000
--- a/sysdeps/generic/mknod.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 1995, 1996, 2001 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.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* This definition is only used if inlining fails for this function; see
-   the last page of <sys/stat.h>.  The real work is done by the `x'
-   function which is passed a version number argument.  We arrange in the
-   makefile that when not inlined this function is always statically
-   linked; that way a dynamically-linked executable always encodes the
-   version number corresponding to the data structures it uses, so the `x'
-   functions in the shared library can adapt without needing to recompile
-   all callers.  */
-
-int
-__mknod (const char *path, mode_t mode, dev_t dev)
-{
-  return __xmknod (_MKNOD_VER, path, mode, &dev);
-}
-
-weak_alias (__mknod, mknod)
-
-/* Hide the symbol so that no definition but the one locally in the
-   executable or DSO is used.  */
-#ifdef HAVE_DOT_HIDDEN
-asm (".hidden\tmknod");
-asm (".hidden\t__mknod");
-#endif
diff --git a/sysdeps/generic/mlock.c b/sysdeps/generic/mlock.c
deleted file mode 100644
index fd8dc8bc9d..0000000000
--- a/sysdeps/generic/mlock.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* mlock -- guarantee pages are resident in memory.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
-   be memory resident.  */
-
-int
-mlock (const void *addr, size_t len)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (mlock)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mlockall.c b/sysdeps/generic/mlockall.c
deleted file mode 100644
index 3d3ed6736d..0000000000
--- a/sysdeps/generic/mlockall.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* mlockall -- lock in core all the pages in this process.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Cause all currently mapped pages of the process to be memory resident
-   until unlocked by a call to the `munlockall', until the process exits,
-   or until the process calls `execve'.  */
-
-int
-mlockall (int flags)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (mlockall)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mmap.c b/sysdeps/generic/mmap.c
deleted file mode 100644
index 43b25a06d2..0000000000
--- a/sysdeps/generic/mmap.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Map addresses starting near ADDR and extending for LEN bytes.  From
-   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
-   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
-   set in FLAGS, the mapping will be at ADDR exactly (which must be
-   page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or MAP_FAILED
-   for errors (in which case `errno' is set).  A successful `mmap' call
-   deallocates any previous mapping for the affected region.  */
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-  __set_errno (ENOSYS);
-  return MAP_FAILED;
-}
-
-stub_warning (mmap)
-#include <stub-tag.h>
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/generic/mmap64.c b/sysdeps/generic/mmap64.c
deleted file mode 100644
index 2c8aac808b..0000000000
--- a/sysdeps/generic/mmap64.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-
-/* Map addresses starting near ADDR and extending for LEN bytes.  From
-   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
-   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
-   set in FLAGS, the mapping will be at ADDR exactly (which must be
-   page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or MAP_FAILED
-   for errors (in which case `errno' is set).  A successful `mmap' call
-   deallocates any previous mapping for the affected region.  */
-
-__ptr_t
-__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd,
-	  __off64_t offset)
-{
-  off_t small_offset = (off_t) offset;
-
-  if (small_offset != offset)
-    {
-      /* We cannot do this since the offset is too large.  */
-      __set_errno (EOVERFLOW);
-      return MAP_FAILED;
-    }
-
-  return __mmap (addr, len, prot, flags, fd, small_offset);
-}
-
-weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/generic/mod_1.c b/sysdeps/generic/mod_1.c
deleted file mode 100644
index 90385d1e6a..0000000000
--- a/sysdeps/generic/mod_1.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* mpn_mod_1(dividend_ptr, dividend_size, divisor_limb) --
-   Divide (DIVIDEND_PTR,,DIVIDEND_SIZE) by DIVISOR_LIMB.
-   Return the single-limb remainder.
-   There are no constraints on the value of the divisor.
-
-Copyright (C) 1991, 1993, 1994, Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-#ifndef UMUL_TIME
-#define UMUL_TIME 1
-#endif
-
-#ifndef UDIV_TIME
-#define UDIV_TIME UMUL_TIME
-#endif
-
-/* FIXME: We should be using invert_limb (or invert_normalized_limb)
-   here (not udiv_qrnnd).  */
-
-mp_limb_t
-#if __STDC__
-mpn_mod_1 (mp_srcptr dividend_ptr, mp_size_t dividend_size,
-	   mp_limb_t divisor_limb)
-#else
-mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
-     mp_srcptr dividend_ptr;
-     mp_size_t dividend_size;
-     mp_limb_t divisor_limb;
-#endif
-{
-  mp_size_t i;
-  mp_limb_t n1, n0, r;
-  int dummy;
-
-  /* Botch: Should this be handled at all?  Rely on callers?  */
-  if (dividend_size == 0)
-    return 0;
-
-  /* If multiplication is much faster than division, and the
-     dividend is large, pre-invert the divisor, and use
-     only multiplications in the inner loop.  */
-
-  /* This test should be read:
-       Does it ever help to use udiv_qrnnd_preinv?
-	 && Does what we save compensate for the inversion overhead?  */
-  if (UDIV_TIME > (2 * UMUL_TIME + 6)
-      && (UDIV_TIME - (2 * UMUL_TIME + 6)) * dividend_size > UDIV_TIME)
-    {
-      int normalization_steps;
-
-      count_leading_zeros (normalization_steps, divisor_limb);
-      if (normalization_steps != 0)
-	{
-	  mp_limb_t divisor_limb_inverted;
-
-	  divisor_limb <<= normalization_steps;
-
-	  /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB.  The
-	     result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
-	     most significant bit (with weight 2**N) implicit.  */
-
-	  /* Special case for DIVISOR_LIMB == 100...000.  */
-	  if (divisor_limb << 1 == 0)
-	    divisor_limb_inverted = ~(mp_limb_t) 0;
-	  else
-	    udiv_qrnnd (divisor_limb_inverted, dummy,
-			-divisor_limb, 0, divisor_limb);
-
-	  n1 = dividend_ptr[dividend_size - 1];
-	  r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
-
-	  /* Possible optimization:
-	     if (r == 0
-	     && divisor_limb > ((n1 << normalization_steps)
-			     | (dividend_ptr[dividend_size - 2] >> ...)))
-	     ...one division less... */
-
-	  for (i = dividend_size - 2; i >= 0; i--)
-	    {
-	      n0 = dividend_ptr[i];
-	      udiv_qrnnd_preinv (dummy, r, r,
-				 ((n1 << normalization_steps)
-				  | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
-				 divisor_limb, divisor_limb_inverted);
-	      n1 = n0;
-	    }
-	  udiv_qrnnd_preinv (dummy, r, r,
-			     n1 << normalization_steps,
-			     divisor_limb, divisor_limb_inverted);
-	  return r >> normalization_steps;
-	}
-      else
-	{
-	  mp_limb_t divisor_limb_inverted;
-
-	  /* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB.  The
-	     result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
-	     most significant bit (with weight 2**N) implicit.  */
-
-	  /* Special case for DIVISOR_LIMB == 100...000.  */
-	  if (divisor_limb << 1 == 0)
-	    divisor_limb_inverted = ~(mp_limb_t) 0;
-	  else
-	    udiv_qrnnd (divisor_limb_inverted, dummy,
-			-divisor_limb, 0, divisor_limb);
-
-	  i = dividend_size - 1;
-	  r = dividend_ptr[i];
-
-	  if (r >= divisor_limb)
-	    r = 0;
-	  else
-	    i--;
-
-	  for (; i >= 0; i--)
-	    {
-	      n0 = dividend_ptr[i];
-	      udiv_qrnnd_preinv (dummy, r, r,
-				 n0, divisor_limb, divisor_limb_inverted);
-	    }
-	  return r;
-	}
-    }
-  else
-    {
-      if (UDIV_NEEDS_NORMALIZATION)
-	{
-	  int normalization_steps;
-
-	  count_leading_zeros (normalization_steps, divisor_limb);
-	  if (normalization_steps != 0)
-	    {
-	      divisor_limb <<= normalization_steps;
-
-	      n1 = dividend_ptr[dividend_size - 1];
-	      r = n1 >> (BITS_PER_MP_LIMB - normalization_steps);
-
-	      /* Possible optimization:
-		 if (r == 0
-		 && divisor_limb > ((n1 << normalization_steps)
-				 | (dividend_ptr[dividend_size - 2] >> ...)))
-		 ...one division less... */
-
-	      for (i = dividend_size - 2; i >= 0; i--)
-		{
-		  n0 = dividend_ptr[i];
-		  udiv_qrnnd (dummy, r, r,
-			      ((n1 << normalization_steps)
-			       | (n0 >> (BITS_PER_MP_LIMB - normalization_steps))),
-			      divisor_limb);
-		  n1 = n0;
-		}
-	      udiv_qrnnd (dummy, r, r,
-			  n1 << normalization_steps,
-			  divisor_limb);
-	      return r >> normalization_steps;
-	    }
-	}
-      /* No normalization needed, either because udiv_qrnnd doesn't require
-	 it, or because DIVISOR_LIMB is already normalized.  */
-
-      i = dividend_size - 1;
-      r = dividend_ptr[i];
-
-      if (r >= divisor_limb)
-	r = 0;
-      else
-	i--;
-
-      for (; i >= 0; i--)
-	{
-	  n0 = dividend_ptr[i];
-	  udiv_qrnnd (dummy, r, r, n0, divisor_limb);
-	}
-      return r;
-    }
-}
diff --git a/sysdeps/generic/morecore.c b/sysdeps/generic/morecore.c
deleted file mode 100644
index 0a66ef5a85..0000000000
--- a/sysdeps/generic/morecore.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1991,92,93,94,95,97,2002,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_MALLOC_INTERNAL
-#define	_MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-#ifndef	__GNU_LIBRARY__
-#define	__sbrk	sbrk
-#endif
-
-#ifdef __GNU_LIBRARY__
-/* It is best not to declare this and cast its result on foreign operating
-   systems with potentially hostile include files.  */
-
-#include <stddef.h>
-#include <stdlib.h>
-extern __malloc_ptr_t __sbrk (ptrdiff_t increment) __THROW;
-libc_hidden_proto (__sbrk)
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Allocate INCREMENT more bytes of data space,
-   and return the start of data space, or NULL on errors.
-   If INCREMENT is negative, shrink data space.  */
-__malloc_ptr_t
-__default_morecore (increment)
-     __malloc_ptrdiff_t increment;
-{
-  __malloc_ptr_t result = (__malloc_ptr_t) __sbrk (increment);
-  if (result == (__malloc_ptr_t) -1)
-    return NULL;
-  return result;
-}
-libc_hidden_def (__default_morecore)
diff --git a/sysdeps/generic/mp_clz_tab.c b/sysdeps/generic/mp_clz_tab.c
deleted file mode 100644
index 520ea31930..0000000000
--- a/sysdeps/generic/mp_clz_tab.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* __clz_tab -- support for longlong.h
-   Copyright (C) 1991, 1993, 1994, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.  Its master source is NOT part of
-   the C library, however.  The master source lives in the GNU MP 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if 0
-#include "gmp.h"
-#include "gmp-impl.h"
-#endif
-
-const
-unsigned char __clz_tab[] =
-{
-  0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-};
diff --git a/sysdeps/generic/mpn2dbl.c b/sysdeps/generic/mpn2dbl.c
deleted file mode 100644
index ea1b7dc27f..0000000000
--- a/sysdeps/generic/mpn2dbl.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include <float.h>
-
-/* Convert a multi-precision integer of the needed number of bits and an
-   integral power of two to a `double'.  */
-
-double
-__mpn_construct_double (mp_srcptr frac_ptr, int expt, int negative)
-{
-#error "__mpn_construct_double not implemented for this floating point format"
-}
diff --git a/sysdeps/generic/mpn2flt.c b/sysdeps/generic/mpn2flt.c
deleted file mode 100644
index 16ec73c174..0000000000
--- a/sysdeps/generic/mpn2flt.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include <float.h>
-
-/* Convert a multi-precision integer of the needed number of bits and an
-   integral power of two to a `float'.  */
-
-float
-__mpn_construct_float (mp_srcptr frac_ptr, int expt, int negative)
-{
-#error "__mpn_construct_float not implemented for this floating point format"
-}
diff --git a/sysdeps/generic/mpn2ldbl.c b/sysdeps/generic/mpn2ldbl.c
deleted file mode 100644
index 450f9381cc..0000000000
--- a/sysdeps/generic/mpn2ldbl.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty.  Not needed unless ldbl support is in. */
diff --git a/sysdeps/generic/mprotect.c b/sysdeps/generic/mprotect.c
deleted file mode 100644
index 9fefdfce71..0000000000
--- a/sysdeps/generic/mprotect.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Change the memory protection of the region starting at ADDR and
-   extending LEN bytes to PROT.  Returns 0 if successful, -1 for errors
-   (and sets errno).  */
-
-int
-__mprotect (__ptr_t addr, size_t len, int prot)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__mprotect, mprotect)
-
-stub_warning (mprotect)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_close.c b/sysdeps/generic/mq_close.c
deleted file mode 100644
index 8237a6438e..0000000000
--- a/sysdeps/generic/mq_close.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Removes the association between message queue descriptor MQDES and its
-   message queue.  */
-int
-mq_close (mqd_t mqdes)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (mq_close)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_getattr.c b/sysdeps/generic/mq_getattr.c
deleted file mode 100644
index 2d24b85d47..0000000000
--- a/sysdeps/generic/mq_getattr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Query status and attributes of message queue MQDES.  */
-int
-mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (mq_getattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_notify.c b/sysdeps/generic/mq_notify.c
deleted file mode 100644
index 29de75a471..0000000000
--- a/sysdeps/generic/mq_notify.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Register notification upon message arrival to an empty message queue
-   MQDES.  */
-int
-mq_notify (mqd_t mqdes, const struct sigevent *notification)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (mq_notify)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_open.c b/sysdeps/generic/mq_open.c
deleted file mode 100644
index dea5741d5a..0000000000
--- a/sysdeps/generic/mq_open.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Establish connection between a process and a message queue NAME and
-   return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines
-   the type of access used.  If O_CREAT is on OFLAG, the third argument is
-   taken as a `mode_t', the mode of the created message queue, and the fourth
-   argument is taken as `struct mq_attr *', pointer to message queue
-   attributes.  If the fourth argument is NULL, default attributes are
-   used.  */
-mqd_t
-mq_open (const char *name, int oflag, ...)
-{
-  __set_errno (ENOSYS);
-  return (mqd_t) -1;
-}
-stub_warning (mq_open)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_receive.c b/sysdeps/generic/mq_receive.c
deleted file mode 100644
index 527fd75963..0000000000
--- a/sysdeps/generic/mq_receive.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Receive the oldest from highest priority messages in message queue
-   MQDES.  */
-ssize_t
-mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
-	    unsigned int *msg_prio)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (mq_receive)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_send.c b/sysdeps/generic/mq_send.c
deleted file mode 100644
index 8b7cd87f7f..0000000000
--- a/sysdeps/generic/mq_send.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Add message pointed by MSG_PTR to message queue MQDES.  */
-int
-mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
-	 unsigned int msg_prio)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (mq_send)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_setattr.c b/sysdeps/generic/mq_setattr.c
deleted file mode 100644
index 57ee0759ab..0000000000
--- a/sysdeps/generic/mq_setattr.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Set attributes associated with message queue MQDES and if OMQSTAT is
-   not NULL also query its old attributes.  */
-int
-mq_setattr (mqd_t mqdes, const struct mq_attr *__restrict mqstat,
-	    struct mq_attr *__restrict omqstat)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-hidden_def (mq_setattr)
-stub_warning (mq_setattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_timedreceive.c b/sysdeps/generic/mq_timedreceive.c
deleted file mode 100644
index e4723f812a..0000000000
--- a/sysdeps/generic/mq_timedreceive.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Receive the oldest from highest priority messages in message queue
-   MQDES, stop waiting if ABS_TIMEOUT expires.  */
-ssize_t
-mq_timedreceive (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len,
-		 unsigned int *__restrict msg_prio,
-		 const struct timespec *__restrict abs_timeout)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-hidden_def (mq_timedreceive)
-stub_warning (mq_timedreceive)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_timedsend.c b/sysdeps/generic/mq_timedsend.c
deleted file mode 100644
index 5ccfe23b0a..0000000000
--- a/sysdeps/generic/mq_timedsend.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking
-   on full message queue if ABS_TIMEOUT expires.  */
-int
-mq_timedsend (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
-	      unsigned int msg_prio, const struct timespec *abs_timeout)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-hidden_def (mq_timedsend)
-stub_warning (mq_timedsend)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mq_unlink.c b/sysdeps/generic/mq_unlink.c
deleted file mode 100644
index e947b84f3b..0000000000
--- a/sysdeps/generic/mq_unlink.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <mqueue.h>
-
-/* Remove message queue named NAME.  */
-int
-mq_unlink (const char *name)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (mq_unlink)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/msgctl.c b/sysdeps/generic/msgctl.c
deleted file mode 100644
index e4451ed368..0000000000
--- a/sysdeps/generic/msgctl.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/msg.h>
-#include <errno.h>
-
-/* Allows to control internal state and destruction of message queue
-   objects.  */
-
-int
-msgctl (msqid, cmd, buf)
-     int msqid;
-     int cmd;
-     struct msqid_ds *buf;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (msgctl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/msgget.c b/sysdeps/generic/msgget.c
deleted file mode 100644
index 75f8f1bc7f..0000000000
--- a/sysdeps/generic/msgget.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/msg.h>
-#include <errno.h>
-
-/* Return descriptor for message queue associated with KEY.  The MSGFLG
-   parameter describes how to proceed with clashing of key values.  */
-
-int
-msgget (key, msgflg)
-     key_t key;
-     int msgflg;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (msgget)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/msgrcv.c b/sysdeps/generic/msgrcv.c
deleted file mode 100644
index f366fa8170..0000000000
--- a/sysdeps/generic/msgrcv.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/msg.h>
-#include <errno.h>
-
-/* Read a message from the queue associated with the message queue
-   descriptor MSQID.  At most MSGSZ bytes of the message are placed
-   in the buffer specified by the MSGP parameter.  The MSGTYP parameter
-   describes which message is returned in MSGFLG describes the behaviour
-   in buffer overflow or queue underflow.  */
-
-int
-msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
-     int msqid;
-     void *msgp;
-     size_t msgsz;
-     long msgtyp;
-     int msgflg;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (msgrcv)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/msgsnd.c b/sysdeps/generic/msgsnd.c
deleted file mode 100644
index fb4ca1aa56..0000000000
--- a/sysdeps/generic/msgsnd.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/msg.h>
-#include <errno.h>
-
-/* Send a message to the queue associated with the message queue
-   descriptor MSQID.  The parameter MSGP points to a structure
-   describing messages where the parameter MSGSZ gives the length
-   of the text.  The MSGFLG parameter describes the action taken
-   when the limit of the message queue length is reached.  */
-
-int
-msgsnd (msqid, msgp, msgsz, msgflg)
-     int msqid;
-     const void *msgp;
-     size_t msgsz;
-     int msgflg;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (msgsnd)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/msync.c b/sysdeps/generic/msync.c
deleted file mode 100644
index 0ffd5c04f6..0000000000
--- a/sysdeps/generic/msync.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Synchronize the region starting at ADDR and extending LEN bytes with the
-   file it maps.  Filesystem operations on a file being mapped are
-   unpredictable before this is done.  */
-
-int
-msync (__ptr_t addr, size_t len, int flags)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (msync)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/mul.c b/sysdeps/generic/mul.c
deleted file mode 100644
index 7678e72a0a..0000000000
--- a/sysdeps/generic/mul.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* mpn_mul -- Multiply two natural numbers.
-
-Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-/* Multiply the natural numbers u (pointed to by UP, with USIZE limbs)
-   and v (pointed to by VP, with VSIZE limbs), and store the result at
-   PRODP.  USIZE + VSIZE limbs are always stored, but if the input
-   operands are normalized.  Return the most significant limb of the
-   result.
-
-   NOTE: The space pointed to by PRODP is overwritten before finished
-   with U and V, so overlap is an error.
-
-   Argument constraints:
-   1. USIZE >= VSIZE.
-   2. PRODP != UP and PRODP != VP, i.e. the destination
-      must be distinct from the multiplier and the multiplicand.  */
-
-/* If KARATSUBA_THRESHOLD is not already defined, define it to a
-   value which is good on most machines.  */
-#ifndef KARATSUBA_THRESHOLD
-#define KARATSUBA_THRESHOLD 32
-#endif
-
-mp_limb_t
-#if __STDC__
-mpn_mul (mp_ptr prodp,
-	 mp_srcptr up, mp_size_t usize,
-	 mp_srcptr vp, mp_size_t vsize)
-#else
-mpn_mul (prodp, up, usize, vp, vsize)
-     mp_ptr prodp;
-     mp_srcptr up;
-     mp_size_t usize;
-     mp_srcptr vp;
-     mp_size_t vsize;
-#endif
-{
-  mp_ptr prod_endp = prodp + usize + vsize - 1;
-  mp_limb_t cy;
-  mp_ptr tspace;
-  TMP_DECL (marker);
-
-  if (vsize < KARATSUBA_THRESHOLD)
-    {
-      /* Handle simple cases with traditional multiplication.
-
-	 This is the most critical code of the entire function.  All
-	 multiplies rely on this, both small and huge.  Small ones arrive
-	 here immediately.  Huge ones arrive here as this is the base case
-	 for Karatsuba's recursive algorithm below.  */
-      mp_size_t i;
-      mp_limb_t cy_limb;
-      mp_limb_t v_limb;
-
-      if (vsize == 0)
-	return 0;
-
-      /* Multiply by the first limb in V separately, as the result can be
-	 stored (not added) to PROD.  We also avoid a loop for zeroing.  */
-      v_limb = vp[0];
-      if (v_limb <= 1)
-	{
-	  if (v_limb == 1)
-	    MPN_COPY (prodp, up, usize);
-	  else
-	    MPN_ZERO (prodp, usize);
-	  cy_limb = 0;
-	}
-      else
-	cy_limb = mpn_mul_1 (prodp, up, usize, v_limb);
-
-      prodp[usize] = cy_limb;
-      prodp++;
-
-      /* For each iteration in the outer loop, multiply one limb from
-	 U with one limb from V, and add it to PROD.  */
-      for (i = 1; i < vsize; i++)
-	{
-	  v_limb = vp[i];
-	  if (v_limb <= 1)
-	    {
-	      cy_limb = 0;
-	      if (v_limb == 1)
-		cy_limb = mpn_add_n (prodp, prodp, up, usize);
-	    }
-	  else
-	    cy_limb = mpn_addmul_1 (prodp, up, usize, v_limb);
-
-	  prodp[usize] = cy_limb;
-	  prodp++;
-	}
-      return cy_limb;
-    }
-
-  TMP_MARK (marker);
-
-  tspace = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB);
-  MPN_MUL_N_RECURSE (prodp, up, vp, vsize, tspace);
-
-  prodp += vsize;
-  up += vsize;
-  usize -= vsize;
-  if (usize >= vsize)
-    {
-      mp_ptr tp = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB);
-      do
-	{
-	  MPN_MUL_N_RECURSE (tp, up, vp, vsize, tspace);
-	  cy = mpn_add_n (prodp, prodp, tp, vsize);
-	  mpn_add_1 (prodp + vsize, tp + vsize, vsize, cy);
-	  prodp += vsize;
-	  up += vsize;
-	  usize -= vsize;
-	}
-      while (usize >= vsize);
-    }
-
-  /* True: usize < vsize.  */
-
-  /* Make life simple: Recurse.  */
-
-  if (usize != 0)
-    {
-      mpn_mul (tspace, vp, vsize, up, usize);
-      cy = mpn_add_n (prodp, prodp, tspace, vsize);
-      mpn_add_1 (prodp + vsize, tspace + vsize, usize, cy);
-    }
-
-  TMP_FREE (marker);
-  return *prod_endp;
-}
diff --git a/sysdeps/generic/mul_1.c b/sysdeps/generic/mul_1.c
deleted file mode 100644
index 1c36b5fb1f..0000000000
--- a/sysdeps/generic/mul_1.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* mpn_mul_1 -- Multiply a limb vector with a single limb and
-   store the product in a second limb vector.
-
-Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-mp_limb_t
-mpn_mul_1 (res_ptr, s1_ptr, s1_size, s2_limb)
-     register mp_ptr res_ptr;
-     register mp_srcptr s1_ptr;
-     mp_size_t s1_size;
-     register mp_limb_t s2_limb;
-{
-  register mp_limb_t cy_limb;
-  register mp_size_t j;
-  register mp_limb_t prod_high, prod_low;
-
-  /* The loop counter and index J goes from -S1_SIZE to -1.  This way
-     the loop becomes faster.  */
-  j = -s1_size;
-
-  /* Offset the base pointers to compensate for the negative indices.  */
-  s1_ptr -= j;
-  res_ptr -= j;
-
-  cy_limb = 0;
-  do
-    {
-      umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb);
-
-      prod_low += cy_limb;
-      cy_limb = (prod_low < cy_limb) + prod_high;
-
-      res_ptr[j] = prod_low;
-    }
-  while (++j != 0);
-
-  return cy_limb;
-}
diff --git a/sysdeps/generic/mul_n.c b/sysdeps/generic/mul_n.c
deleted file mode 100644
index 2120cd4f59..0000000000
--- a/sysdeps/generic/mul_n.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/* mpn_mul_n -- Multiply two natural numbers of length n.
-
-Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-/* Multiply the natural numbers u (pointed to by UP) and v (pointed to by VP),
-   both with SIZE limbs, and store the result at PRODP.  2 * SIZE limbs are
-   always stored.  Return the most significant limb.
-
-   Argument constraints:
-   1. PRODP != UP and PRODP != VP, i.e. the destination
-      must be distinct from the multiplier and the multiplicand.  */
-
-/* If KARATSUBA_THRESHOLD is not already defined, define it to a
-   value which is good on most machines.  */
-#ifndef KARATSUBA_THRESHOLD
-#define KARATSUBA_THRESHOLD 32
-#endif
-
-/* The code can't handle KARATSUBA_THRESHOLD smaller than 2.  */
-#if KARATSUBA_THRESHOLD < 2
-#undef KARATSUBA_THRESHOLD
-#define KARATSUBA_THRESHOLD 2
-#endif
-
-/* Handle simple cases with traditional multiplication.
-
-   This is the most critical code of multiplication.  All multiplies rely
-   on this, both small and huge.  Small ones arrive here immediately.  Huge
-   ones arrive here as this is the base case for Karatsuba's recursive
-   algorithm below.  */
-
-void
-#if __STDC__
-impn_mul_n_basecase (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
-#else
-impn_mul_n_basecase (prodp, up, vp, size)
-     mp_ptr prodp;
-     mp_srcptr up;
-     mp_srcptr vp;
-     mp_size_t size;
-#endif
-{
-  mp_size_t i;
-  mp_limb_t cy_limb;
-  mp_limb_t v_limb;
-
-  /* Multiply by the first limb in V separately, as the result can be
-     stored (not added) to PROD.  We also avoid a loop for zeroing.  */
-  v_limb = vp[0];
-  if (v_limb <= 1)
-    {
-      if (v_limb == 1)
-	MPN_COPY (prodp, up, size);
-      else
-	MPN_ZERO (prodp, size);
-      cy_limb = 0;
-    }
-  else
-    cy_limb = mpn_mul_1 (prodp, up, size, v_limb);
-
-  prodp[size] = cy_limb;
-  prodp++;
-
-  /* For each iteration in the outer loop, multiply one limb from
-     U with one limb from V, and add it to PROD.  */
-  for (i = 1; i < size; i++)
-    {
-      v_limb = vp[i];
-      if (v_limb <= 1)
-	{
-	  cy_limb = 0;
-	  if (v_limb == 1)
-	    cy_limb = mpn_add_n (prodp, prodp, up, size);
-	}
-      else
-	cy_limb = mpn_addmul_1 (prodp, up, size, v_limb);
-
-      prodp[size] = cy_limb;
-      prodp++;
-    }
-}
-
-void
-#if __STDC__
-impn_mul_n (mp_ptr prodp,
-	     mp_srcptr up, mp_srcptr vp, mp_size_t size, mp_ptr tspace)
-#else
-impn_mul_n (prodp, up, vp, size, tspace)
-     mp_ptr prodp;
-     mp_srcptr up;
-     mp_srcptr vp;
-     mp_size_t size;
-     mp_ptr tspace;
-#endif
-{
-  if ((size & 1) != 0)
-    {
-      /* The size is odd, the code code below doesn't handle that.
-	 Multiply the least significant (size - 1) limbs with a recursive
-	 call, and handle the most significant limb of S1 and S2
-	 separately.  */
-      /* A slightly faster way to do this would be to make the Karatsuba
-	 code below behave as if the size were even, and let it check for
-	 odd size in the end.  I.e., in essence move this code to the end.
-	 Doing so would save us a recursive call, and potentially make the
-	 stack grow a lot less.  */
-
-      mp_size_t esize = size - 1;	/* even size */
-      mp_limb_t cy_limb;
-
-      MPN_MUL_N_RECURSE (prodp, up, vp, esize, tspace);
-      cy_limb = mpn_addmul_1 (prodp + esize, up, esize, vp[esize]);
-      prodp[esize + esize] = cy_limb;
-      cy_limb = mpn_addmul_1 (prodp + esize, vp, size, up[esize]);
-
-      prodp[esize + size] = cy_limb;
-    }
-  else
-    {
-      /* Anatolij Alekseevich Karatsuba's divide-and-conquer algorithm.
-
-	 Split U in two pieces, U1 and U0, such that
-	 U = U0 + U1*(B**n),
-	 and V in V1 and V0, such that
-	 V = V0 + V1*(B**n).
-
-	 UV is then computed recursively using the identity
-
-		2n   n          n                     n
-	 UV = (B  + B )U V  +  B (U -U )(V -V )  +  (B + 1)U V
-			1 1        1  0   0  1              0 0
-
-	 Where B = 2**BITS_PER_MP_LIMB.  */
-
-      mp_size_t hsize = size >> 1;
-      mp_limb_t cy;
-      int negflg;
-
-      /*** Product H.	 ________________  ________________
-			|_____U1 x V1____||____U0 x V0_____|  */
-      /* Put result in upper part of PROD and pass low part of TSPACE
-	 as new TSPACE.  */
-      MPN_MUL_N_RECURSE (prodp + size, up + hsize, vp + hsize, hsize, tspace);
-
-      /*** Product M.	 ________________
-			|_(U1-U0)(V0-V1)_|  */
-      if (mpn_cmp (up + hsize, up, hsize) >= 0)
-	{
-	  mpn_sub_n (prodp, up + hsize, up, hsize);
-	  negflg = 0;
-	}
-      else
-	{
-	  mpn_sub_n (prodp, up, up + hsize, hsize);
-	  negflg = 1;
-	}
-      if (mpn_cmp (vp + hsize, vp, hsize) >= 0)
-	{
-	  mpn_sub_n (prodp + hsize, vp + hsize, vp, hsize);
-	  negflg ^= 1;
-	}
-      else
-	{
-	  mpn_sub_n (prodp + hsize, vp, vp + hsize, hsize);
-	  /* No change of NEGFLG.  */
-	}
-      /* Read temporary operands from low part of PROD.
-	 Put result in low part of TSPACE using upper part of TSPACE
-	 as new TSPACE.  */
-      MPN_MUL_N_RECURSE (tspace, prodp, prodp + hsize, hsize, tspace + size);
-
-      /*** Add/copy product H.  */
-      MPN_COPY (prodp + hsize, prodp + size, hsize);
-      cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize);
-
-      /*** Add product M (if NEGFLG M is a negative number).  */
-      if (negflg)
-	cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size);
-      else
-	cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size);
-
-      /*** Product L.	 ________________  ________________
-			|________________||____U0 x V0_____|  */
-      /* Read temporary operands from low part of PROD.
-	 Put result in low part of TSPACE using upper part of TSPACE
-	 as new TSPACE.  */
-      MPN_MUL_N_RECURSE (tspace, up, vp, hsize, tspace + size);
-
-      /*** Add/copy Product L (twice).  */
-
-      cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size);
-      if (cy)
-	mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy);
-
-      MPN_COPY (prodp, tspace, hsize);
-      cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize);
-      if (cy)
-	mpn_add_1 (prodp + size, prodp + size, size, 1);
-    }
-}
-
-void
-#if __STDC__
-impn_sqr_n_basecase (mp_ptr prodp, mp_srcptr up, mp_size_t size)
-#else
-impn_sqr_n_basecase (prodp, up, size)
-     mp_ptr prodp;
-     mp_srcptr up;
-     mp_size_t size;
-#endif
-{
-  mp_size_t i;
-  mp_limb_t cy_limb;
-  mp_limb_t v_limb;
-
-  /* Multiply by the first limb in V separately, as the result can be
-     stored (not added) to PROD.  We also avoid a loop for zeroing.  */
-  v_limb = up[0];
-  if (v_limb <= 1)
-    {
-      if (v_limb == 1)
-	MPN_COPY (prodp, up, size);
-      else
-	MPN_ZERO (prodp, size);
-      cy_limb = 0;
-    }
-  else
-    cy_limb = mpn_mul_1 (prodp, up, size, v_limb);
-
-  prodp[size] = cy_limb;
-  prodp++;
-
-  /* For each iteration in the outer loop, multiply one limb from
-     U with one limb from V, and add it to PROD.  */
-  for (i = 1; i < size; i++)
-    {
-      v_limb = up[i];
-      if (v_limb <= 1)
-	{
-	  cy_limb = 0;
-	  if (v_limb == 1)
-	    cy_limb = mpn_add_n (prodp, prodp, up, size);
-	}
-      else
-	cy_limb = mpn_addmul_1 (prodp, up, size, v_limb);
-
-      prodp[size] = cy_limb;
-      prodp++;
-    }
-}
-
-void
-#if __STDC__
-impn_sqr_n (mp_ptr prodp,
-	     mp_srcptr up, mp_size_t size, mp_ptr tspace)
-#else
-impn_sqr_n (prodp, up, size, tspace)
-     mp_ptr prodp;
-     mp_srcptr up;
-     mp_size_t size;
-     mp_ptr tspace;
-#endif
-{
-  if ((size & 1) != 0)
-    {
-      /* The size is odd, the code code below doesn't handle that.
-	 Multiply the least significant (size - 1) limbs with a recursive
-	 call, and handle the most significant limb of S1 and S2
-	 separately.  */
-      /* A slightly faster way to do this would be to make the Karatsuba
-	 code below behave as if the size were even, and let it check for
-	 odd size in the end.  I.e., in essence move this code to the end.
-	 Doing so would save us a recursive call, and potentially make the
-	 stack grow a lot less.  */
-
-      mp_size_t esize = size - 1;	/* even size */
-      mp_limb_t cy_limb;
-
-      MPN_SQR_N_RECURSE (prodp, up, esize, tspace);
-      cy_limb = mpn_addmul_1 (prodp + esize, up, esize, up[esize]);
-      prodp[esize + esize] = cy_limb;
-      cy_limb = mpn_addmul_1 (prodp + esize, up, size, up[esize]);
-
-      prodp[esize + size] = cy_limb;
-    }
-  else
-    {
-      mp_size_t hsize = size >> 1;
-      mp_limb_t cy;
-
-      /*** Product H.	 ________________  ________________
-			|_____U1 x U1____||____U0 x U0_____|  */
-      /* Put result in upper part of PROD and pass low part of TSPACE
-	 as new TSPACE.  */
-      MPN_SQR_N_RECURSE (prodp + size, up + hsize, hsize, tspace);
-
-      /*** Product M.	 ________________
-			|_(U1-U0)(U0-U1)_|  */
-      if (mpn_cmp (up + hsize, up, hsize) >= 0)
-	{
-	  mpn_sub_n (prodp, up + hsize, up, hsize);
-	}
-      else
-	{
-	  mpn_sub_n (prodp, up, up + hsize, hsize);
-	}
-
-      /* Read temporary operands from low part of PROD.
-	 Put result in low part of TSPACE using upper part of TSPACE
-	 as new TSPACE.  */
-      MPN_SQR_N_RECURSE (tspace, prodp, hsize, tspace + size);
-
-      /*** Add/copy product H.  */
-      MPN_COPY (prodp + hsize, prodp + size, hsize);
-      cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize);
-
-      /*** Add product M (if NEGFLG M is a negative number).  */
-      cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size);
-
-      /*** Product L.	 ________________  ________________
-			|________________||____U0 x U0_____|  */
-      /* Read temporary operands from low part of PROD.
-	 Put result in low part of TSPACE using upper part of TSPACE
-	 as new TSPACE.  */
-      MPN_SQR_N_RECURSE (tspace, up, hsize, tspace + size);
-
-      /*** Add/copy Product L (twice).  */
-
-      cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size);
-      if (cy)
-	mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy);
-
-      MPN_COPY (prodp, tspace, hsize);
-      cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize);
-      if (cy)
-	mpn_add_1 (prodp + size, prodp + size, size, 1);
-    }
-}
-
-/* This should be made into an inline function in gmp.h.  */
-void
-#if __STDC__
-mpn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
-#else
-mpn_mul_n (prodp, up, vp, size)
-     mp_ptr prodp;
-     mp_srcptr up;
-     mp_srcptr vp;
-     mp_size_t size;
-#endif
-{
-  TMP_DECL (marker);
-  TMP_MARK (marker);
-  if (up == vp)
-    {
-      if (size < KARATSUBA_THRESHOLD)
-	{
-	  impn_sqr_n_basecase (prodp, up, size);
-	}
-      else
-	{
-	  mp_ptr tspace;
-	  tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB);
-	  impn_sqr_n (prodp, up, size, tspace);
-	}
-    }
-  else
-    {
-      if (size < KARATSUBA_THRESHOLD)
-	{
-	  impn_mul_n_basecase (prodp, up, vp, size);
-	}
-      else
-	{
-	  mp_ptr tspace;
-	  tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB);
-	  impn_mul_n (prodp, up, vp, size, tspace);
-	}
-    }
-  TMP_FREE (marker);
-}
diff --git a/sysdeps/generic/munlock.c b/sysdeps/generic/munlock.c
deleted file mode 100644
index 3c728c01d5..0000000000
--- a/sysdeps/generic/munlock.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* munlock -- undo the effects of prior mlock calls.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Undo the effects on these whole pages of any prior mlock calls.  */
-
-int
-munlock (const void *addr, size_t len)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (munlock)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/munlockall.c b/sysdeps/generic/munlockall.c
deleted file mode 100644
index ca7198265f..0000000000
--- a/sysdeps/generic/munlockall.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* munlockall -- undo the effects of all prior mlock calls.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Undo the effects of all prior mlock calls in this process.  */
-
-int
-munlockall (void)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (munlockall)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/munmap.c b/sysdeps/generic/munmap.c
deleted file mode 100644
index 4a78c324ad..0000000000
--- a/sysdeps/generic/munmap.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Deallocate any mapping for the region starting at ADDR and extending LEN
-   bytes.  Returns 0 if successful, -1 for errors (and sets errno).  */
-
-int
-__munmap (__ptr_t addr, size_t len)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (munmap)
-#include <stub-tag.h>
-weak_alias (__munmap, munmap)
diff --git a/sysdeps/generic/nanosleep.c b/sysdeps/generic/nanosleep.c
deleted file mode 100644
index 7a2138b6f1..0000000000
--- a/sysdeps/generic/nanosleep.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-
-/* Pause execution for a number of nanoseconds.  */
-int
-__libc_nanosleep (const struct timespec *requested_time,
-		  struct timespec *remaining)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (nanosleep)
-
-weak_alias (__libc_nanosleep, __nanosleep)
-libc_hidden_def (__nanosleep)
-weak_alias (__libc_nanosleep, nanosleep)
-#include <stub-tag.h>
diff --git a/sysdeps/mach/hurd/nfs/nfs.h b/sysdeps/generic/nfs/nfs.h
index e83a874fe6..e83a874fe6 100644
--- a/sysdeps/mach/hurd/nfs/nfs.h
+++ b/sysdeps/generic/nfs/nfs.h
diff --git a/sysdeps/generic/nice.c b/sysdeps/generic/nice.c
deleted file mode 100644
index 8561931af7..0000000000
--- a/sysdeps/generic/nice.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Increment the scheduling priority of the calling process by INCR.
-   The superuser may use a negative INCR to decrement the priority.  */
-int
-nice (incr)
-     int incr;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (nice)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
index 396e0421f9..427be6475f 100644
--- a/sysdeps/generic/not-cancel.h
+++ b/sysdeps/generic/not-cancel.h
@@ -1,5 +1,5 @@
 /* Uncancelable versions of cancelable interfaces.  Generic version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -23,6 +23,14 @@
   __libc_open (name, flags, mode)
 #define open_not_cancel_2(name, flags) \
   __libc_open (name, flags)
+#define openat_not_cancel(fd, name, flags, mode) \
+  __openat (fd, name, flags, mode)
+#define openat_not_cancel_3(fd, name, flags) \
+  __openat (fd, name, flags, 0)
+#define openat64_not_cancel(fd, name, flags, mode) \
+  __openat64 (fd, name, flags, mode)
+#define openat64_not_cancel_3(fd, name, flags) \
+  __openat64 (fd, name, flags, 0)
 #define close_not_cancel(fd) \
   __close (fd)
 #define close_not_cancel_no_status(fd) \
diff --git a/sysdeps/generic/nscd_setup_thread.c b/sysdeps/generic/nscd_setup_thread.c
deleted file mode 100644
index 8ebc050b4a..0000000000
--- a/sysdeps/generic/nscd_setup_thread.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Setup of nscd worker threads.  Stub verison.
-   Copyright (C) 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <nscd.h>
-
-
-void
-setup_thread (struct database_dyn *db)
-{
-  /* Nothing.  */
-}
diff --git a/sysdeps/generic/open.c b/sysdeps/generic/open.c
deleted file mode 100644
index 188110b3f3..0000000000
--- a/sysdeps/generic/open.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stddef.h>
-
-/* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
-   a third argument is the file protection.  */
-int
-__open (file, oflag)
-     const char *file;
-     int oflag;
-{
-  int mode;
-
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (oflag & O_CREAT)
-    {
-      va_list arg;
-      va_start(arg, oflag);
-      mode = va_arg(arg, int);
-      va_end(arg);
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__open)
-stub_warning (open)
-
-weak_alias (__open, open)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/open64.c b/sysdeps/generic/open64.c
deleted file mode 100644
index d9a38112ac..0000000000
--- a/sysdeps/generic/open64.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999, 2000, 2002
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <bp-sym.h>
-
-/* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
-   a third argument is the file protection.  */
-int
-__libc_open64 (file, oflag)
-     const char *file;
-     int oflag;
-{
-  int mode;
-
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (oflag & O_CREAT)
-    {
-      va_list arg;
-      va_start (arg, oflag);
-      mode = va_arg (arg, int);
-      va_end (arg);
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-strong_alias (__libc_open64, __open64)
-libc_hidden_def (__open64)
-weak_alias (__libc_open64, BP_SYM (open64))
-
-stub_warning (open64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/opendir.c b/sysdeps/generic/opendir.c
deleted file mode 100644
index 771013f6eb..0000000000
--- a/sysdeps/generic/opendir.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-
-/* Open a directory stream on NAME.  */
-DIR *
-__opendir (const char *name)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-weak_alias (__opendir, opendir)
-
-stub_warning (opendir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/opensock.c b/sysdeps/generic/opensock.c
deleted file mode 100644
index 4a4d5dd385..0000000000
--- a/sysdeps/generic/opensock.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-#include <sys/socket.h>
-#include <bits/libc-lock.h>
-
-/* Return a socket of any type.  The socket can be used in subsequent
-   ioctl calls to talk to the kernel.  */
-int internal_function
-__opensock (void)
-{
-  /* Cache the last AF that worked, to avoid many redundant calls to
-     socket().  */
-  static int sock_af = -1;
-  int fd = -1;
-  __libc_lock_define_initialized (static, lock);
-
-  if (sock_af != -1)
-    {
-      fd = __socket (sock_af, SOCK_DGRAM, 0);
-      if (fd != -1)
-        return fd;
-    }
-
-  __libc_lock_lock (lock);
-
-  if (sock_af != -1)
-    fd = __socket (sock_af, SOCK_DGRAM, 0);
-
-  if (fd == -1)
-    {
-#ifdef AF_INET
-      fd = __socket (sock_af = AF_INET, SOCK_DGRAM, 0);
-#endif
-#ifdef AF_INET6
-      if (fd < 0)
-	fd = __socket (sock_af = AF_INET6, SOCK_DGRAM, 0);
-#endif
-#ifdef AF_IPX
-      if (fd < 0)
-	fd = __socket (sock_af = AF_IPX, SOCK_DGRAM, 0);
-#endif
-#ifdef AF_AX25
-      if (fd < 0)
-	fd = __socket (sock_af = AF_AX25, SOCK_DGRAM, 0);
-#endif
-#ifdef AF_APPLETALK
-      if (fd < 0)
-	fd = __socket (sock_af = AF_APPLETALK, SOCK_DGRAM, 0);
-#endif
-    }
-
-  __libc_lock_unlock (lock);
-  return fd;
-}
diff --git a/sysdeps/generic/pathconf.c b/sysdeps/generic/pathconf.c
deleted file mode 100644
index 6ac5d31902..0000000000
--- a/sysdeps/generic/pathconf.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Get file-specific information about PATH.  */
-long int
-__pathconf (path, name)
-     const char *path;
-     int name;
-{
-  if (path == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  return __fpathconf (0, name);
-}
-
-weak_alias (__pathconf, pathconf)
-
-stub_warning (pathconf)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pause.c b/sysdeps/generic/pause.c
deleted file mode 100644
index 2e34b436f1..0000000000
--- a/sysdeps/generic/pause.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-
-/* Suspend the process until a signal arrives.
-   This is supposed to always return -1 and set errno to EINTR,
-   but rules were meant to be broken.  */
-int
-pause ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (pause)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pipe.c b/sysdeps/generic/pipe.c
deleted file mode 100644
index babaf9c24b..0000000000
--- a/sysdeps/generic/pipe.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <stddef.h>
-
-/* Create a one-way communication channel (__pipe).
-   If successful, two file descriptors are stored in PIPEDES;
-   bytes written on PIPEDES[1] can be read from PIPEDES[0].
-   Returns 0 if successful, -1 if not.  */
-int
-__pipe (__pipedes)
-     int __pipedes[2];
-{
-  if (__pipedes == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__pipe)
-stub_warning (pipe)
-
-weak_alias (__pipe, pipe)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/poll.c b/sysdeps/generic/poll.c
deleted file mode 100644
index 9f2f191764..0000000000
--- a/sysdeps/generic/poll.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/poll.h>
-#include <errno.h>
-
-/* Poll the file descriptors described by the NFDS structures starting at
-   FDS.  If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
-   an event to occur; if TIMEOUT is -1, block until an event occurs.
-   Returns the number of file descriptors with events, zero if timed out,
-   or -1 for errors.  */
-
-int
-poll (fds, nfds, timeout)
-     struct pollfd *fds;
-     nfds_t nfds;
-     int timeout;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (poll)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fadvise.c b/sysdeps/generic/posix_fadvise.c
deleted file mode 100644
index 92f8bb8974..0000000000
--- a/sysdeps/generic/posix_fadvise.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-
-/* Advice the system about the expected behaviour of the application with
-   respect to the file associated with FD.  */
-
-int
-posix_fadvise (int fd, __off_t offset, __off_t len, int advise)
-{
-  return ENOSYS;
-}
-stub_warning (posix_fadvise)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fadvise64.c b/sysdeps/generic/posix_fadvise64.c
deleted file mode 100644
index e7eae5e6e3..0000000000
--- a/sysdeps/generic/posix_fadvise64.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-
-/* Advice the system about the expected behaviour of the application with
-   respect to the file associated with FD.  */
-
-int
-posix_fadvise64 (int fd, __off64_t offset, __off64_t len, int advise)
-{
-  return ENOSYS;
-}
-stub_warning (posix_fadvise64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fallocate.c b/sysdeps/generic/posix_fallocate.c
deleted file mode 100644
index 218b4adbe3..0000000000
--- a/sysdeps/generic/posix_fallocate.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-
-/* Reserve storage for the data of the file associated with FD.  */
-
-int
-posix_fallocate (int fd, __off_t offset, __off_t len)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (posix_fallocate)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_fallocate64.c b/sysdeps/generic/posix_fallocate64.c
deleted file mode 100644
index 80c1cd385d..0000000000
--- a/sysdeps/generic/posix_fallocate64.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <fcntl.h>
-
-/* Reserve storage for the data of the file associated with FD.  */
-
-int
-posix_fallocate64 (int fd, __off64_t offset, __off64_t len)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (posix_fallocate64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/posix_madvise.c b/sysdeps/generic/posix_madvise.c
deleted file mode 100644
index 6f8d60f55f..0000000000
--- a/sysdeps/generic/posix_madvise.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Advise the system about particular usage patterns the program follows
-   for the region starting at ADDR and extending LEN bytes.  */
-
-int
-posix_madvise (__ptr_t addr, size_t len, int advice)
-{
-  return ENOSYS;
-}
-stub_warning (posix_madvise)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pread.c b/sysdeps/generic/pread.c
deleted file mode 100644
index 5c79dd526d..0000000000
--- a/sysdeps/generic/pread.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Read NBYTES into BUF from FD at the given position OFFSET without
-   changing the file pointer.  Return the number read or -1.  */
-ssize_t
-__libc_pread (int fd, void *buf, size_t nbytes, off_t offset)
-{
-  if (nbytes == 0)
-    return 0;
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (buf == NULL || offset < 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
-stub_warning (pread)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pread64.c b/sysdeps/generic/pread64.c
deleted file mode 100644
index 68316579c6..0000000000
--- a/sysdeps/generic/pread64.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Read NBYTES into BUF from FD at the given position OFFSET without
-   changing the file pointer.  Return the number read or -1.  */
-ssize_t
-__libc_pread64 (int fd, void *buf, size_t nbytes, off64_t offset)
-{
-  if (nbytes == 0)
-    return 0;
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (buf == NULL || offset < 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-strong_alias (__libc_pread64, __pread64)
-weak_alias (__libc_pread64, pread64)
-stub_warning (pread64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/printf_fphex.c b/sysdeps/generic/printf_fphex.c
deleted file mode 100644
index fd790d5bf3..0000000000
--- a/sysdeps/generic/printf_fphex.c
+++ /dev/null
@@ -1,490 +0,0 @@
-/* Print floating point number in hexadecimal notation according to ISO C99.
-   Copyright (C) 1997-2002,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <ctype.h>
-#include <ieee754.h>
-#include <math.h>
-#include <printf.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <wchar.h>
-#include "_itoa.h"
-#include "_itowa.h"
-#include <locale/localeinfo.h>
-
-/* #define NDEBUG 1*/		/* Undefine this for debugging assertions.  */
-#include <assert.h>
-
-/* This defines make it possible to use the same code for GNU C library and
-   the GNU I/O library.	 */
-#ifdef USE_IN_LIBIO
-# include <libioP.h>
-# define PUT(f, s, n) _IO_sputn (f, s, n)
-# define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : INTUSE(_IO_padn) (f, c, n))
-/* We use this file GNU C library and GNU I/O library.	So make
-   names equal.	 */
-# undef putc
-# define putc(c, f) (wide \
-		     ? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
-# define size_t     _IO_size_t
-# define FILE	     _IO_FILE
-#else	/* ! USE_IN_LIBIO */
-# define PUT(f, s, n) fwrite (s, 1, n, f)
-# define PAD(f, c, n) __printf_pad (f, c, n)
-ssize_t __printf_pad (FILE *, char pad, int n) __THROW; /* In vfprintf.c.  */
-#endif	/* USE_IN_LIBIO */
-
-/* Macros for doing the actual output.  */
-
-#define outchar(ch)							      \
-  do									      \
-    {									      \
-      register const int outc = (ch);					      \
-      if (putc (outc, fp) == EOF)					      \
-	return -1;							      \
-      ++done;								      \
-    } while (0)
-
-#define PRINT(ptr, wptr, len)						      \
-  do									      \
-    {									      \
-      register size_t outlen = (len);					      \
-      if (wide)								      \
-	while (outlen-- > 0)						      \
-	  outchar (*wptr++);						      \
-      else								      \
-	while (outlen-- > 0)						      \
-	  outchar (*ptr++);						      \
-    } while (0)
-
-#define PADN(ch, len)							      \
-  do									      \
-    {									      \
-      if (PAD (fp, ch, len) != len)					      \
-	return -1;							      \
-      done += len;							      \
-    }									      \
-  while (0)
-
-#ifndef MIN
-# define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-
-int
-__printf_fphex (FILE *fp,
-		const struct printf_info *info,
-		const void *const *args)
-{
-  /* The floating-point value to output.  */
-  union
-    {
-      union ieee754_double dbl;
-      union ieee854_long_double ldbl;
-    }
-  fpnum;
-
-  /* Locale-dependent representation of decimal point.	*/
-  const char *decimal;
-  wchar_t decimalwc;
-
-  /* "NaN" or "Inf" for the special cases.  */
-  const char *special = NULL;
-  const wchar_t *wspecial = NULL;
-
-  /* Buffer for the generated number string for the mantissa.  The
-     maximal size for the mantissa is 128 bits.  */
-  char numbuf[32];
-  char *numstr;
-  char *numend;
-  wchar_t wnumbuf[32];
-  wchar_t *wnumstr;
-  wchar_t *wnumend;
-  int negative;
-
-  /* The maximal exponent of two in decimal notation has 5 digits.  */
-  char expbuf[5];
-  char *expstr;
-  wchar_t wexpbuf[5];
-  wchar_t *wexpstr;
-  int expnegative;
-  int exponent;
-
-  /* Non-zero is mantissa is zero.  */
-  int zero_mantissa;
-
-  /* The leading digit before the decimal point.  */
-  char leading;
-
-  /* Precision.  */
-  int precision = info->prec;
-
-  /* Width.  */
-  int width = info->width;
-
-  /* Number of characters written.  */
-  int done = 0;
-
-  /* Nonzero if this is output on a wide character stream.  */
-  int wide = info->wide;
-
-
-  /* Figure out the decimal point character.  */
-  if (info->extra == 0)
-    {
-      decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
-      decimalwc = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC);
-    }
-  else
-    {
-      decimal = _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
-      decimalwc = _NL_CURRENT_WORD (LC_MONETARY,
-				    _NL_MONETARY_DECIMAL_POINT_WC);
-    }
-  /* The decimal point character must never be zero.  */
-  assert (*decimal != '\0' && decimalwc != L'\0');
-
-
-  /* Fetch the argument value.	*/
-#ifndef __NO_LONG_DOUBLE_MATH
-  if (info->is_long_double && sizeof (long double) > sizeof (double))
-    {
-      fpnum.ldbl.d = *(const long double *) args[0];
-
-      /* Check for special values: not a number or infinity.  */
-      if (__isnanl (fpnum.ldbl.d))
-	{
-	  if (isupper (info->spec))
-	    {
-	      special = "NAN";
-	      wspecial = L"NAN";
-	    }
-	  else
-	    {
-	      special = "nan";
-	      wspecial = L"nan";
-	    }
-	  negative = 0;
-	}
-      else
-	{
-	  if (__isinfl (fpnum.ldbl.d))
-	    {
-	      if (isupper (info->spec))
-		{
-		  special = "INF";
-		  wspecial = L"INF";
-		}
-	      else
-		{
-		  special = "inf";
-		  wspecial = L"inf";
-		}
-	    }
-
-	  negative = signbit (fpnum.ldbl.d);
-	}
-    }
-  else
-#endif	/* no long double */
-    {
-      fpnum.dbl.d = *(const double *) args[0];
-
-      /* Check for special values: not a number or infinity.  */
-      if (__isnan (fpnum.dbl.d))
-	{
-	  if (isupper (info->spec))
-	    {
-	      special = "NAN";
-	      wspecial = L"NAN";
-	    }
-	  else
-	    {
-	      special = "nan";
-	      wspecial = L"nan";
-	    }
-	  negative = 0;
-	}
-      else
-	{
-	  if (__isinf (fpnum.dbl.d))
-	    {
-	      if (isupper (info->spec))
-		{
-		  special = "INF";
-		  wspecial = L"INF";
-		}
-	      else
-		{
-		  special = "inf";
-		  wspecial = L"inf";
-		}
-	    }
-
-	  negative = signbit (fpnum.dbl.d);
-	}
-    }
-
-  if (special)
-    {
-      int width = info->width;
-
-      if (negative || info->showsign || info->space)
-	--width;
-      width -= 3;
-
-      if (!info->left && width > 0)
-	PADN (' ', width);
-
-      if (negative)
-	outchar ('-');
-      else if (info->showsign)
-	outchar ('+');
-      else if (info->space)
-	outchar (' ');
-
-      PRINT (special, wspecial, 3);
-
-      if (info->left && width > 0)
-	PADN (' ', width);
-
-      return done;
-    }
-
-  if (info->is_long_double == 0 || sizeof (double) == sizeof (long double))
-    {
-      /* We have 52 bits of mantissa plus one implicit digit.  Since
-	 52 bits are representable without rest using hexadecimal
-	 digits we use only the implicit digits for the number before
-	 the decimal point.  */
-      unsigned long long int num;
-
-      num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
-	     | fpnum.dbl.ieee.mantissa1);
-
-      zero_mantissa = num == 0;
-
-      if (sizeof (unsigned long int) > 6)
-	{
-	  wnumstr = _itowa_word (num, wnumbuf + (sizeof wnumbuf) / sizeof (wchar_t), 16,
-				 info->spec == 'A');
-	  numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
-			       info->spec == 'A');
-	}
-      else
-	{
-	  wnumstr = _itowa (num, wnumbuf + sizeof wnumbuf / sizeof (wchar_t), 16,
-			    info->spec == 'A');
-	  numstr = _itoa (num, numbuf + sizeof numbuf, 16,
-			  info->spec == 'A');
-	}
-
-      /* Fill with zeroes.  */
-      while (wnumstr > wnumbuf + (sizeof wnumbuf - 52) / sizeof (wchar_t))
-	{
-	  *--wnumstr = L'0';
-	  *--numstr = '0';
-	}
-
-      leading = fpnum.dbl.ieee.exponent == 0 ? '0' : '1';
-
-      exponent = fpnum.dbl.ieee.exponent;
-
-      if (exponent == 0)
-	{
-	  if (zero_mantissa)
-	    expnegative = 0;
-	  else
-	    {
-	      /* This is a denormalized number.  */
-	      expnegative = 1;
-	      exponent = IEEE754_DOUBLE_BIAS - 1;
-	    }
-	}
-      else if (exponent >= IEEE754_DOUBLE_BIAS)
-	{
-	  expnegative = 0;
-	  exponent -= IEEE754_DOUBLE_BIAS;
-	}
-      else
-	{
-	  expnegative = 1;
-	  exponent = -(exponent - IEEE754_DOUBLE_BIAS);
-	}
-    }
-#ifdef PRINT_FPHEX_LONG_DOUBLE
-  else
-    PRINT_FPHEX_LONG_DOUBLE;
-#endif
-
-  /* Look for trailing zeroes.  */
-  if (! zero_mantissa)
-    {
-      wnumend = &wnumbuf[sizeof wnumbuf / sizeof wnumbuf[0]];
-      numend = &numbuf[sizeof numbuf / sizeof numbuf[0]];
-      while (wnumend[-1] == L'0')
-	{
-	  --wnumend;
-	  --numend;
-	}
-
-      if (precision == -1)
-	precision = numend - numstr;
-      else if (precision < numend - numstr
-	       && (numstr[precision] > '8'
-		   || (('A' < '0' || 'a' < '0')
-		       && numstr[precision] < '0')
-		   || (numstr[precision] == '8'
-		       && (precision + 1 < numend - numstr
-			   /* Round to even.  */
-			   || (precision > 0
-			       && ((numstr[precision - 1] & 1)
-				   ^ (isdigit (numstr[precision - 1]) == 0)))
-			   || (precision == 0
-			       && ((leading & 1)
-				   ^ (isdigit (leading) == 0)))))))
-	{
-	  /* Round up.  */
-	  int cnt = precision;
-	  while (--cnt >= 0)
-	    {
-	      char ch = numstr[cnt];
-	      /* We assume that the digits and the letters are ordered
-		 like in ASCII.  This is true for the rest of GNU, too.  */
-	      if (ch == '9')
-		{
-		  wnumstr[cnt] = (wchar_t) info->spec;
-		  numstr[cnt] = info->spec;	/* This is tricky,
-		  				   think about it!  */
-		  break;
-		}
-	      else if (tolower (ch) < 'f')
-		{
-		  ++numstr[cnt];
-		  ++wnumstr[cnt];
-		  break;
-		}
-	      else
-		{
-		  numstr[cnt] = '0';
-		  wnumstr[cnt] = L'0';
-		}
-	    }
-	  if (cnt < 0)
-	    {
-	      /* The mantissa so far was fff...f  Now increment the
-		 leading digit.  Here it is again possible that we
-		 get an overflow.  */
-	      if (leading == '9')
-		leading = info->spec;
-	      else if (tolower (leading) < 'f')
-		++leading;
-	      else
-		{
-		  leading = 1;
-		  if (expnegative)
-		    {
-		      exponent += 4;
-		      if (exponent >= 0)
-			expnegative = 0;
-		    }
-		  else
-		    exponent += 4;
-		}
-	    }
-	}
-    }
-  else
-    {
-      if (precision == -1)
-	precision = 0;
-      numend = numstr;
-      wnumend = wnumstr;
-    }
-
-  /* Now we can compute the exponent string.  */
-  expstr = _itoa_word (exponent, expbuf + sizeof expbuf, 10, 0);
-  wexpstr = _itowa_word (exponent,
-			 wexpbuf + sizeof wexpbuf / sizeof (wchar_t), 10, 0);
-
-  /* Now we have all information to compute the size.  */
-  width -= ((negative || info->showsign || info->space)
-	    /* Sign.  */
-	    + 2    + 1 + 0 + precision + 1 + 1
-	    /* 0x    h   .   hhh         P   ExpoSign.  */
-	    + ((expbuf + sizeof expbuf) - expstr));
-	    /* Exponent.  */
-
-  /* Count the decimal point.
-     A special case when the mantissa or the precision is zero and the `#'
-     is not given.  In this case we must not print the decimal point.  */
-  if (precision > 0 || info->alt)
-    width -= wide ? 1 : strlen (decimal);
-
-  if (!info->left && info->pad != '0' && width > 0)
-    PADN (' ', width);
-
-  if (negative)
-    outchar ('-');
-  else if (info->showsign)
-    outchar ('+');
-  else if (info->space)
-    outchar (' ');
-
-  outchar ('0');
-  if ('X' - 'A' == 'x' - 'a')
-    outchar (info->spec + ('x' - 'a'));
-  else
-    outchar (info->spec == 'A' ? 'X' : 'x');
-
-  if (!info->left && info->pad == '0' && width > 0)
-    PADN ('0', width);
-
-  outchar (leading);
-
-  if (precision > 0 || info->alt)
-    {
-      const wchar_t *wtmp = &decimalwc;
-      PRINT (decimal, wtmp, wide ? 1 : strlen (decimal));
-    }
-
-  if (precision > 0)
-    {
-      ssize_t tofill = precision - (numend - numstr);
-      PRINT (numstr, wnumstr, MIN (numend - numstr, precision));
-      if (tofill > 0)
-	PADN ('0', tofill);
-    }
-
-  if ('P' - 'A' == 'p' - 'a')
-    outchar (info->spec + ('p' - 'a'));
-  else
-    outchar (info->spec == 'A' ? 'P' : 'p');
-
-  outchar (expnegative ? '-' : '+');
-
-  PRINT (expstr, wexpstr, (expbuf + sizeof expbuf) - expstr);
-
-  if (info->left && info->pad != '0' && width > 0)
-    PADN (info->pad, width);
-
-  return done;
-}
diff --git a/sysdeps/generic/prof-freq.c b/sysdeps/generic/prof-freq.c
deleted file mode 100644
index ffcc67931b..0000000000
--- a/sysdeps/generic/prof-freq.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Return frequency of ticks reported by profil.  Generic version. */
-/*-
- * Copyright (c) 1983, 1992, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <libc-internal.h>
-
-int
-__profile_frequency (void)
-{
-  /*
-   * Discover the tick frequency of the machine if something goes wrong,
-   * we return 0, an impossible hertz.
-   */
-  struct itimerval tim;
-
-  tim.it_interval.tv_sec = 0;
-  tim.it_interval.tv_usec = 1;
-  tim.it_value.tv_sec = 0;
-  tim.it_value.tv_usec = 0;
-  __setitimer(ITIMER_REAL, &tim, 0);
-  __setitimer(ITIMER_REAL, 0, &tim);
-  if (tim.it_interval.tv_usec < 2)
-    return 0;
-  return (1000000 / tim.it_interval.tv_usec);
-}
-libc_hidden_def (__profile_frequency)
diff --git a/sysdeps/generic/profil.c b/sysdeps/generic/profil.c
deleted file mode 100644
index 8736375858..0000000000
--- a/sysdeps/generic/profil.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Low-level statistical profiling support function.  Stub version.
-   Copyright (C) 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-
-/* Enable statistical profiling, writing samples of the PC into at most
-   SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
-   is enabled, the system examines the user PC and increments
-   SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536].  If SCALE is zero,
-   disable profiling.  Returns zero on success, -1 on error.  */
-
-int
-__profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
-{
-  if (scale == 0)
-    /* Disable profiling.  */
-    return 0;
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__profil, profil)
-stub_warning (profil)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pselect.c b/sysdeps/generic/pselect.c
deleted file mode 100644
index 43b371cce7..0000000000
--- a/sysdeps/generic/pselect.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (C) 1996,1997,1998,2001,2002,2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <stddef.h>	/* For NULL.  */
-#include <sys/time.h>
-#include <sys/select.h>
-#include <sysdep-cancel.h>
-
-/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
-   readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
-   (if not NULL) for exceptional conditions.  If TIMEOUT is not NULL, time out
-   after waiting the interval specified therein.  Additionally set the sigmask
-   SIGMASK for this call.  Returns the number of ready descriptors, or -1 for
-   errors.  */
-static int
-do_pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
-	    const struct timespec *timeout, const sigset_t *sigmask)
-{
-  struct timeval tval;
-  int retval;
-  sigset_t savemask;
-
-  /* Change nanosecond number to microseconds.  This might mean losing
-     precision and therefore the `pselect` should be available.  But
-     for now it is hardly found.  */
-  if (timeout != NULL)
-    TIMESPEC_TO_TIMEVAL (&tval, timeout);
-
-  /* The setting and restoring of the signal mask and the select call
-     should be an atomic operation.  This can't be done without kernel
-     help.  */
-  if (sigmask != NULL)
-    __sigprocmask (SIG_SETMASK, sigmask, &savemask);
-
-  /* Note the pselect() is a cancellation point.  But since we call
-     select() which itself is a cancellation point we do not have
-     to do anything here.  */
-  retval = __select (nfds, readfds, writefds, exceptfds,
-		     timeout != NULL ? &tval : NULL);
-
-  if (sigmask != NULL)
-    __sigprocmask (SIG_SETMASK, &savemask, NULL);
-
-  return retval;
-}
-
-
-int
-__pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask)
-     int nfds;
-     fd_set *readfds;
-     fd_set *writefds;
-     fd_set *exceptfds;
-     const struct timespec *timeout;
-     const sigset_t *sigmask;
-{
-  if (SINGLE_THREAD_P)
-    return do_pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = do_pselect (nfds, readfds, writefds, exceptfds, timeout,
-			   sigmask);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-weak_alias (__pselect, pselect)
-strong_alias (__pselect, __libc_pselect)
diff --git a/sysdeps/generic/ptrace.c b/sysdeps/generic/ptrace.c
deleted file mode 100644
index 1825d57143..0000000000
--- a/sysdeps/generic/ptrace.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/ptrace.h>
-#include <sys/types.h>
-#include <stdarg.h>
-
-/* Perform process tracing functions.  REQUEST is one of the values
-   in <sys/ptrace.h>, and determines the action to be taken.
-   For all requests except PTRACE_TRACEME, PID specifies the process to be
-   traced.
-
-   PID and the other arguments described above for the various requests should
-   appear (those that are used for the particular request) as:
-     pid_t PID, void *ADDR, int DATA, void *ADDR2
-   after PID.  */
-int
-ptrace (request)
-     enum __ptrace_request request;
-{
-  pid_t pid;
-  void *addr;
-  void *addr2;
-  int data;
-  va_list ap;
-
-  switch (request)
-    {
-    case PTRACE_TRACEME:
-    case PTRACE_CONT:
-    case PTRACE_KILL:
-    case PTRACE_SINGLESTEP:
-    case PTRACE_ATTACH:
-    case PTRACE_DETACH:
-      break;
-
-    case PTRACE_PEEKTEXT:
-    case PTRACE_PEEKDATA:
-    case PTRACE_PEEKUSER:
-    case PTRACE_GETREGS:
-    case PTRACE_SETREGS:
-#ifdef PTRACE_GETFPREGS
-    case PTRACE_GETFPGEGS:
-#endif
-    case PTRACE_SETFPREGS:
-    case PTRACE_GETFPAREGS:
-    case PTRACE_SETFPAREGS:
-      va_start(ap, request);
-      pid = va_arg(ap, pid_t);
-      addr = va_arg(ap, void *);
-      va_end(ap);
-      break;
-
-    case PTRACE_POKETEXT:
-    case PTRACE_POKEDATA:
-    case PTRACE_POKEUSER:
-      va_start(ap, request);
-      pid = va_arg(ap, pid_t);
-      addr = va_arg(ap, void *);
-      data = va_arg(ap, int);
-      va_end(ap);
-      break;
-
-    case PTRACE_READDATA:
-    case PTRACE_WRITEDATA:
-    case PTRACE_READTEXT:
-    case PTRACE_WRITETEXT:
-      va_start(ap, request);
-      pid = va_arg(ap, pid_t);
-      addr = va_arg(ap, void *);
-      data = va_arg(ap, int);
-      addr2 = va_arg(ap, void *);
-      va_end(ap);
-      break;
-
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (ptrace)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ptsname.c b/sysdeps/generic/ptsname.c
deleted file mode 100644
index c16e056a97..0000000000
--- a/sysdeps/generic/ptsname.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1998,2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-/* Given the file descriptor of a master pty, return the pathname
-   of the associated slave. */
-
-char *
-ptsname (fd)
-     int fd __attribute__ ((unused));
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-
-int
-__ptsname_r (fd, buf, len)
-     int fd __attribute__ ((unused));
-     char *buf __attribute__ ((unused));
-     size_t len __attribute__ ((unused));
-{
-  __set_errno (ENOSYS);
-  return ENOSYS;
-}
-weak_alias (__ptsname_r, ptsname_r)
-
-stub_warning(ptsname)
-stub_warning(ptsname_r)
diff --git a/sysdeps/generic/putenv.c b/sysdeps/generic/putenv.c
deleted file mode 100644
index 4e8693403a..0000000000
--- a/sysdeps/generic/putenv.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 1991, 94, 95, 96, 97, 98, 99 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if defined _AIX && !defined __GNUC__
- #pragma alloca
-#endif
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if _LIBC || HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#if _LIBC || HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if !__GNU_LIBRARY__ && !HAVE_STRCHR
-# define strchr index
-#endif
-
-#ifndef _LIBC
-# ifdef HAVE_ALLOCA_H
-#  include <alloca.h>
-# else
-#  ifdef __GNUC__
-#   define alloca __builtin_alloca
-#  else
-extern char *alloca ();
-#  endif /* __GNUC__ */
-# endif /* HAVE_ALLOCA_H */
-#endif /* _LIBC */
-
-
-/* Put STRING, which is of the form "NAME=VALUE", in the environment.  */
-int
-putenv (string)
-     char *string;
-{
-  const char *const name_end = strchr (string, '=');
-
-  if (name_end != NULL)
-    {
-#ifdef _LIBC
-      char *name = strndupa (string, name_end - string);
-#else
-      char *name = alloca (name_end - string + 1);
-      memcpy (name, string, name_end - string);
-      name[name_end - string] = '\0';
-#endif
-      return __add_to_environ (name, NULL, string, 1);
-    }
-
-  __unsetenv (string);
-  return 0;
-}
diff --git a/sysdeps/generic/putmsg.c b/sysdeps/generic/putmsg.c
deleted file mode 100644
index b84dd843ba..0000000000
--- a/sysdeps/generic/putmsg.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stropts.h>
-
-int
-putmsg (fildes, ctlptr, dataptr, flags)
-     int fildes;
-     const struct strbuf *ctlptr;
-     const struct strbuf *dataptr;
-     int flags;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (putmsg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/putpmsg.c b/sysdeps/generic/putpmsg.c
deleted file mode 100644
index 6e37036aac..0000000000
--- a/sysdeps/generic/putpmsg.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stropts.h>
-
-int
-putpmsg (fildes, ctlptr, dataptr, band, flags)
-     int fildes;
-     const struct strbuf *ctlptr;
-     const struct strbuf *dataptr;
-     int band;
-     int flags;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (putpmsg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pututxline.c b/sysdeps/generic/pututxline.c
deleted file mode 100644
index 1ed5178862..0000000000
--- a/sysdeps/generic/pututxline.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-struct utmpx *
-pututxline (const struct utmpx *utmpx)
-{
-  return (struct utmpx *) __pututline ((const struct utmp *) utmpx);
-}
diff --git a/sysdeps/generic/pwrite.c b/sysdeps/generic/pwrite.c
deleted file mode 100644
index ec35ecea9c..0000000000
--- a/sysdeps/generic/pwrite.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Write NBYTES of BUF to FD at given position OFFSET without changing
-   the file position.  Return the number written, or -1.  */
-ssize_t
-__libc_pwrite (int fd, const void *buf, size_t nbytes, off_t offset)
-{
-  if (nbytes == 0)
-    return 0;
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (buf == NULL || offset < 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
-stub_warning (pwrite)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/pwrite64.c b/sysdeps/generic/pwrite64.c
deleted file mode 100644
index dd14aa0bd7..0000000000
--- a/sysdeps/generic/pwrite64.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1999,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Write NBYTES of BUF to FD at given position OFFSET without changing
-   the file position.  Return the number written, or -1.  */
-ssize_t
-__libc_pwrite64 (int fd, const void *buf, size_t nbytes, off64_t offset)
-{
-  if (nbytes == 0)
-    return 0;
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (buf == NULL || offset < 0)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-strong_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_def (__pwrite64)
-weak_alias (__libc_pwrite64, pwrite64)
-stub_warning (pwrite64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/raise.c b/sysdeps/generic/raise.c
deleted file mode 100644
index c5a449f7bc..0000000000
--- a/sysdeps/generic/raise.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991,95,96,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include <errno.h>
-
-/* Raise the signal SIG.  */
-int
-raise (sig)
-     int sig;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (raise, gsignal)
-
-stub_warning (raise)
-stub_warning (gsignal)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/rawmemchr.c b/sysdeps/generic/rawmemchr.c
deleted file mode 100644
index cb00ad7e90..0000000000
--- a/sysdeps/generic/rawmemchr.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* Copyright (C) 1991,93,96,97,99,2000,2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se) and
-   commentary by Jim Blandy (jimb@ai.mit.edu);
-   adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
-   and implemented by Roland McGrath (roland@ai.mit.edu).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#undef __ptr_t
-#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
-# define __ptr_t void *
-#else /* Not C++ or ANSI C.  */
-# define __ptr_t char *
-#endif /* C++ or ANSI C.  */
-
-#if defined (_LIBC)
-# include <string.h>
-# include <memcopy.h>
-# include <stdlib.h>
-#else
-# define reg_char char
-#endif
-
-#if defined (HAVE_LIMITS_H) || defined (_LIBC)
-# include <limits.h>
-#endif
-
-#define LONG_MAX_32_BITS 2147483647
-
-#ifndef LONG_MAX
-#define LONG_MAX LONG_MAX_32_BITS
-#endif
-
-#include <sys/types.h>
-
-#undef memchr
-
-
-/* Find the first occurrence of C in S.  */
-__ptr_t
-__rawmemchr (s, c_in)
-     const __ptr_t s;
-     int c_in;
-{
-  const unsigned char *char_ptr;
-  const unsigned long int *longword_ptr;
-  unsigned long int longword, magic_bits, charmask;
-  unsigned reg_char c;
-
-  c = (unsigned char) c_in;
-
-  /* Handle the first few characters by reading one character at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = (const unsigned char *) s;
-       ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
-       ++char_ptr)
-    if (*char_ptr == c)
-      return (__ptr_t) char_ptr;
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
-
-  longword_ptr = (unsigned long int *) char_ptr;
-
-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
-     the "holes."  Note that there is a hole just to the left of
-     each byte, with an extra at the end:
-
-     bits:  01111110 11111110 11111110 11111111
-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-
-     The 1-bits make sure that carries propagate to the next 0-bit.
-     The 0-bits provide holes for carries to fall into.  */
-
-  if (sizeof (longword) != 4 && sizeof (longword) != 8)
-    abort ();
-
-#if LONG_MAX <= LONG_MAX_32_BITS
-  magic_bits = 0x7efefeff;
-#else
-  magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
-#endif
-
-  /* Set up a longword, each of whose bytes is C.  */
-  charmask = c | (c << 8);
-  charmask |= charmask << 16;
-#if LONG_MAX > LONG_MAX_32_BITS
-  charmask |= charmask << 32;
-#endif
-
-  /* Instead of the traditional loop which tests each character,
-     we will test a longword at a time.  The tricky part is testing
-     if *any of the four* bytes in the longword in question are zero.  */
-  while (1)
-    {
-      /* We tentatively exit the loop if adding MAGIC_BITS to
-	 LONGWORD fails to change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.  If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-30 is set, there will be a carry
-	 into bit 31, so all of the hole bits will be changed.
-
-	 The one misfire occurs when bits 24-30 are clear and bit
-	 31 is set; in this case, the hole at bit 31 is not
-	 changed.  If we had access to the processor carry flag,
-	 we could close this loophole by putting the fourth hole
-	 at bit 32!
-
-	 So it ignores everything except 128's, when they're aligned
-	 properly.
-
-	 3) But wait!  Aren't we looking for C, not zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-      longword = *longword_ptr++ ^ charmask;
-
-      /* Add MAGIC_BITS to LONGWORD.  */
-      if ((((longword + magic_bits)
-
-	    /* Set those bits that were unchanged by the addition.  */
-	    ^ ~longword)
-
-	   /* Look at only the hole bits.  If any of the hole bits
-	      are unchanged, most likely one of the bytes was a
-	      zero.  */
-	   & ~magic_bits) != 0)
-	{
-	  /* Which of the bytes was C?  If none of them were, it was
-	     a misfire; continue the search.  */
-
-	  const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
-
-	  if (cp[0] == c)
-	    return (__ptr_t) cp;
-	  if (cp[1] == c)
-	    return (__ptr_t) &cp[1];
-	  if (cp[2] == c)
-	    return (__ptr_t) &cp[2];
-	  if (cp[3] == c)
-	    return (__ptr_t) &cp[3];
-#if LONG_MAX > 2147483647
-	  if (cp[4] == c)
-	    return (__ptr_t) &cp[4];
-	  if (cp[5] == c)
-	    return (__ptr_t) &cp[5];
-	  if (cp[6] == c)
-	    return (__ptr_t) &cp[6];
-	  if (cp[7] == c)
-	    return (__ptr_t) &cp[7];
-#endif
-	}
-    }
-}
-libc_hidden_def (__rawmemchr)
-weak_alias (__rawmemchr, rawmemchr)
diff --git a/sysdeps/generic/read.c b/sysdeps/generic/read.c
deleted file mode 100644
index 3943edd689..0000000000
--- a/sysdeps/generic/read.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <stddef.h>
-
-/* Read NBYTES into BUF from FD.  Return the number read or -1.  */
-ssize_t
-__libc_read (int fd, void *buf, size_t nbytes)
-{
-  if (nbytes == 0)
-    return 0;
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (buf == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__libc_read)
-stub_warning (read)
-
-weak_alias (__libc_read, __read)
-libc_hidden_weak (__read)
-weak_alias (__libc_read, read)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir.c b/sysdeps/generic/readdir.c
deleted file mode 100644
index 893b246d41..0000000000
--- a/sysdeps/generic/readdir.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-/* Read a directory entry from DIRP.  */
-struct dirent *
-__readdir (DIR *dirp)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-weak_alias (__readdir, readdir)
-
-stub_warning (readdir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir64.c b/sysdeps/generic/readdir64.c
deleted file mode 100644
index 0c18bd9440..0000000000
--- a/sysdeps/generic/readdir64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-/* Read a directory entry from DIRP.  */
-struct dirent64 *
-__readdir64 (DIR *dirp)
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-weak_alias (__readdir64, readdir64)
-stub_warning (readdir64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir64_r.c b/sysdeps/generic/readdir64_r.c
deleted file mode 100644
index cf9e952e1a..0000000000
--- a/sysdeps/generic/readdir64_r.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-/* Read a directory entry from DIRP, store result in ENTRY and return
-   pointer to result in *RESULT.  */
-int
-readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
-{
-  __set_errno (ENOSYS);
-  *result = NULL;
-  return -1;
-}
-stub_warning (readdir64_r)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/readdir_r.c b/sysdeps/generic/readdir_r.c
deleted file mode 100644
index ad45dfa504..0000000000
--- a/sysdeps/generic/readdir_r.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-/* Read a directory entry from DIRP, store result in ENTRY and return
-   pointer to result in *RESULT.  */
-int
-__readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result)
-{
-  __set_errno (ENOSYS);
-  *result = NULL;
-  return ENOSYS;
-}
-weak_alias (__readdir_r, readdir_r)
-
-stub_warning (readdir_r)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/readelflib.c b/sysdeps/generic/readelflib.c
deleted file mode 100644
index 26444ad6b2..0000000000
--- a/sysdeps/generic/readelflib.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
-		  Jakub Jelinek <jakub@redhat.com>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This code is a heavily simplified version of the readelf program
-   that's part of the current binutils development version.  For architectures
-   which need to handle both 32bit and 64bit ELF libraries,  this file is
-   included twice for each arch size.  */
-
-/* check_ptr checks that a pointer is in the mmaped file and doesn't
-   point outside it.  */
-#undef check_ptr
-#define check_ptr(ptr)						\
-do								\
-  {								\
-    if ((void *)(ptr) < file_contents				\
-	|| (void *)(ptr) > (file_contents+file_length))		\
-      {								\
-	error (0, 0, _("file %s is truncated\n"), file_name);	\
-	return 1;						\
-      }								\
-  }								\
- while (0);
-
-/* Returns 0 if everything is ok, != 0 in case of error.  */
-int
-process_elf_file (const char *file_name, const char *lib, int *flag,
-		  unsigned int *osversion, char **soname, void *file_contents,
-		  size_t file_length)
-{
-  int i;
-  unsigned int j;
-  ElfW(Addr) loadaddr;
-  unsigned int dynamic_addr;
-  size_t dynamic_size;
-  char *program_interpreter;
-
-  ElfW(Ehdr) *elf_header;
-  ElfW(Phdr) *elf_pheader, *segment;
-  ElfW(Dyn) *dynamic_segment, *dyn_entry;
-  char *dynamic_strings;
-
-  elf_header = (ElfW(Ehdr) *) file_contents;
-  *osversion = 0;
-
-  if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
-    {
-      if (opt_verbose)
-	{
-	  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
-	    error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name);
-	  else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)
-	    error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name);
-	  else
-	    error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name);
-	}
-      return 1;
-    }
-
-  if (elf_header->e_type != ET_DYN)
-    {
-      error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
-	     elf_header->e_type);
-      return 1;
-    }
-
-  /* Get information from elf program header.  */
-  elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
-  check_ptr (elf_pheader);
-
-  /* The library is an elf library, now search for soname and
-     libc5/libc6.  */
-  *flag = FLAG_ELF;
-
-  loadaddr = -1;
-  dynamic_addr = 0;
-  dynamic_size = 0;
-  program_interpreter = NULL;
-  for (i = 0, segment = elf_pheader;
-       i < elf_header->e_phnum; i++, segment++)
-    {
-      check_ptr (segment);
-
-      switch (segment->p_type)
-	{
-	case PT_LOAD:
-	  if (loadaddr == (ElfW(Addr)) -1)
-	    loadaddr = segment->p_vaddr - segment->p_offset;
-	  break;
-
-	case PT_DYNAMIC:
-	  if (dynamic_addr)
-	    error (0, 0, _("more than one dynamic segment\n"));
-
-	  dynamic_addr = segment->p_offset;
-	  dynamic_size = segment->p_filesz;
-	  break;
-
-	case PT_INTERP:
-	  program_interpreter = (char *) (file_contents + segment->p_offset);
-	  check_ptr (program_interpreter);
-
-	  /* Check if this is enough to classify the binary.  */
-	  for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
-	       ++j)
-	    if (strcmp (program_interpreter, interpreters[j].soname) == 0)
-	      {
-		*flag = interpreters[j].flag;
-		break;
-	      }
-	  break;
-
-	case PT_NOTE:
-	  if (!*osversion && segment->p_filesz == 32 && segment->p_align >= 4)
-	    {
-	      ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents
-						     + segment->p_offset);
-	      if (abi_note [0] == 4 && abi_note [1] == 16 && abi_note [2] == 1
-		  && memcmp (abi_note + 3, "GNU", 4) == 0)
-		*osversion = (abi_note [4] << 24) |
-			     ((abi_note [5] & 0xff) << 16) |
-			     ((abi_note [6] & 0xff) << 8) |
-			     (abi_note [7] & 0xff);
-	    }
-	  break;
-
-	default:
-	  break;
-	}
-
-    }
-  if (loadaddr == (ElfW(Addr)) -1)
-    {
-      /* Very strange. */
-      loadaddr = 0;
-    }
-
-  /* Now we can read the dynamic sections.  */
-  if (dynamic_size == 0)
-    return 1;
-
-  dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr);
-  check_ptr (dynamic_segment);
-
-  /* Find the string table.  */
-  dynamic_strings = NULL;
-  for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
-       ++dyn_entry)
-    {
-      check_ptr (dyn_entry);
-      if (dyn_entry->d_tag == DT_STRTAB)
-	{
-	  dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
-	  check_ptr (dynamic_strings);
-	  break;
-	}
-    }
-
-  if (dynamic_strings == NULL)
-    return 1;
-
-  /* Now read the DT_NEEDED and DT_SONAME entries.  */
-  for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
-       ++dyn_entry)
-    {
-      if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
-	{
-	  char *name = dynamic_strings + dyn_entry->d_un.d_val;
-	  check_ptr (name);
-
-	  if (dyn_entry->d_tag == DT_NEEDED)
-	    {
-
-	      if (*flag == FLAG_ELF)
-		{
-		  /* Check if this is enough to classify the binary.  */
-		  for (j = 0;
-		       j < sizeof (known_libs) / sizeof (known_libs [0]);
-		       ++j)
-		    if (strcmp (name, known_libs [j].soname) == 0)
-		      {
-			*flag = known_libs [j].flag;
-			break;
-		      }
-		}
-	    }
-
-	  else if (dyn_entry->d_tag == DT_SONAME)
-	    *soname = xstrdup (name);
-
-	  /* Do we have everything we need?  */
-	  if (*soname && *flag != FLAG_ELF)
-	    return 0;
-	}
-    }
-
-  /* We reach this point only if the file doesn't contain a DT_SONAME
-     or if we can't classify the library.  If it doesn't have a
-     soname, return the name of the library.  */
-  if (*soname == NULL)
-    *soname = xstrdup (lib);
-
-  return 0;
-}
diff --git a/sysdeps/generic/readlink.c b/sysdeps/generic/readlink.c
deleted file mode 100644
index 779b809eaa..0000000000
--- a/sysdeps/generic/readlink.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Read the contents of the symbolic link PATH into no more than
-   LEN bytes of BUF.  The contents are not null-terminated.
-   Returns the number of characters read, or -1 for errors.  */
-int
-__readlink (path, buf, len)
-     const char *path;
-     char *buf;
-     size_t len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (readlink)
-
-weak_alias (__readlink, readlink)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/readonly-area.c b/sysdeps/generic/readonly-area.c
deleted file mode 100644
index 4b8172f193..0000000000
--- a/sysdeps/generic/readonly-area.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-
-/* Return 1 if the whole area PTR .. PTR+SIZE is not writable.
-   Return -1 if it is writable.  */
-
-int
-__readonly_area (const void *ptr, size_t size)
-{
-  /* We cannot determine in general whether memory is writable or not.
-     This must be handled in a system-dependent manner.  to not
-     unconditionally break code we need to return here a positive
-     answer.  This disables this security measure but that is the
-     price people have to pay for using systems without a real
-     implementation of this interface.  */
-  return 1;
-}
diff --git a/sysdeps/generic/readv.c b/sysdeps/generic/readv.c
deleted file mode 100644
index b33444c036..0000000000
--- a/sysdeps/generic/readv.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/uio.h>
-
-/* Read data from file descriptor FD, and put the result in the
-   buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
-   The buffers are filled in the order specified.
-   Operates just like `read' (see <unistd.h>) except that data are
-   put in VECTOR instead of a contiguous buffer.  */
-ssize_t
-__libc_readv (fd, vector, count)
-     int fd;
-     const struct iovec *vector;
-     int count;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-strong_alias (__libc_readv, __readv)
-weak_alias (__libc_readv, readv)
-
-stub_warning (readv)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/reboot.c b/sysdeps/generic/reboot.c
deleted file mode 100644
index 6036726c1f..0000000000
--- a/sysdeps/generic/reboot.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/reboot.h>
-
-/* Reboot the system.  */
-int
-reboot (howto)
-     int howto;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (reboot)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/recv.c b/sysdeps/generic/recv.c
deleted file mode 100644
index 9c28b4b306..0000000000
--- a/sysdeps/generic/recv.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Read N bytes into BUF from socket FD.
-   Returns the number read or -1 for errors.  */
-ssize_t
-recv (fd, buf, n, flags)
-     int fd;
-     void *buf;
-     size_t n;
-     int flags;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (recv)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/recvfrom.c b/sysdeps/generic/recvfrom.c
deleted file mode 100644
index 4f6a045077..0000000000
--- a/sysdeps/generic/recvfrom.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2001,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Read N bytes into BUF through socket FD from peer
-   at address ADDR (which is ADDR_LEN bytes long).
-   Returns the number read or -1 for errors.  */
-ssize_t
-__recvfrom (fd, buf, n, flags, addr, addr_len)
-     int fd;
-     void *buf;
-     size_t n;
-     int flags;
-     __SOCKADDR_ARG addr;
-     socklen_t *addr_len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__recvfrom, recvfrom)
-
-stub_warning (recvfrom)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/recvmsg.c b/sysdeps/generic/recvmsg.c
deleted file mode 100644
index 419415cd75..0000000000
--- a/sysdeps/generic/recvmsg.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2001,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Receive a message as described by MESSAGE from socket FD.
-   Returns the number of bytes read or -1 for errors.  */
-ssize_t
-__recvmsg (fd, message, flags)
-     int fd;
-     struct msghdr *message;
-     int flags;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__recvmsg, recvmsg)
-
-stub_warning (recvmsg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/remap_file_pages.c b/sysdeps/generic/remap_file_pages.c
deleted file mode 100644
index 0f15ea44c2..0000000000
--- a/sysdeps/generic/remap_file_pages.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Remap arbitrary pages of a shared backing store within an existing
-   VMA.  */
-
-int
-__remap_file_pages (void *start, size_t size, int prot, size_t pgoff,
-		    int flags)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (remap_file_pages)
-#include <stub-tag.h>
-weak_alias (__remap_file_pages, remap_file_pages)
diff --git a/sysdeps/generic/remove.c b/sysdeps/generic/remove.c
deleted file mode 100644
index 5dc0e9edf0..0000000000
--- a/sysdeps/generic/remove.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* ANSI C `remove' function to delete a file or directory.  Stub version.
-   Copyright (C) 1995,96,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stdio.h>
-
-int
-remove (file)
-     const char *file;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (remove)
-
-stub_warning (remove)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/removexattr.c b/sysdeps/generic/removexattr.c
deleted file mode 100644
index 8379ed10c8..0000000000
--- a/sysdeps/generic/removexattr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-int
-removexattr (const char *__path, const char *__name)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (removexattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/rename.c b/sysdeps/generic/rename.c
deleted file mode 100644
index b7d8392179..0000000000
--- a/sysdeps/generic/rename.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-#include <errno.h>
-
-
-/* Rename the file OLD to NEW.  */
-int
-rename (old, new)
-     const char *old;
-     const char *new;
-{
-  if (old == NULL || new == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (rename)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/res-state.c b/sysdeps/generic/res-state.c
deleted file mode 100644
index e327e34f59..0000000000
--- a/sysdeps/generic/res-state.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1996, 97, 98, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <resolv.h>
-#include <tls.h>
-
-#if ! USE___THREAD
-
-# undef _res
-extern struct __res_state _res;
-
-/* When threaded, _res may be a per-thread variable.  */
-struct __res_state *
-weak_const_function
-__res_state (void)
-{
-  return &_res;
-}
-
-#else
-
-struct __res_state *
-__res_state (void)
-{
-  return __resp;
-}
-
-#endif
-
-libc_hidden_def (__res_state)
diff --git a/sysdeps/generic/revoke.c b/sysdeps/generic/revoke.c
deleted file mode 100644
index fc757d80b4..0000000000
--- a/sysdeps/generic/revoke.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Revoke the access of all descriptors currently open on a file.
-   Copyright (C) 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-#include <errno.h>
-
-int
-revoke (file)
-     const char *file;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (revoke)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/rewinddir.c b/sysdeps/generic/rewinddir.c
deleted file mode 100644
index e78d316880..0000000000
--- a/sysdeps/generic/rewinddir.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-
-/* Rewind DIRP to the beginning of the directory.  */
-void
-rewinddir (dirp)
-     DIR *dirp;
-{
-  __set_errno (ENOSYS);
-  /* No way to indicate failure.	*/
-}
-
-
-stub_warning (rewinddir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/rmdir.c b/sysdeps/generic/rmdir.c
deleted file mode 100644
index 5a16fd4284..0000000000
--- a/sysdeps/generic/rmdir.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Remove the directory PATH.  */
-int
-__rmdir (path)
-     const char *path;
-{
-  if (path == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (rmdir)
-
-weak_alias (__rmdir, rmdir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/rshift.c b/sysdeps/generic/rshift.c
deleted file mode 100644
index 59caf73529..0000000000
--- a/sysdeps/generic/rshift.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* mpn_rshift -- Shift right a low-level natural-number integer.
-
-Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-/* Shift U (pointed to by UP and USIZE limbs long) CNT bits to the right
-   and store the USIZE least significant limbs of the result at WP.
-   The bits shifted out to the right are returned.
-
-   Argument constraints:
-   1. 0 < CNT < BITS_PER_MP_LIMB
-   2. If the result is to be written over the input, WP must be <= UP.
-*/
-
-mp_limb_t
-#if __STDC__
-mpn_rshift (register mp_ptr wp,
-	    register mp_srcptr up, mp_size_t usize,
-	    register unsigned int cnt)
-#else
-mpn_rshift (wp, up, usize, cnt)
-     register mp_ptr wp;
-     register mp_srcptr up;
-     mp_size_t usize;
-     register unsigned int cnt;
-#endif
-{
-  register mp_limb_t high_limb, low_limb;
-  register unsigned sh_1, sh_2;
-  register mp_size_t i;
-  mp_limb_t retval;
-
-#ifdef DEBUG
-  if (usize == 0 || cnt == 0)
-    abort ();
-#endif
-
-  sh_1 = cnt;
-
-#if 0
-  if (sh_1 == 0)
-    {
-      if (wp != up)
-	{
-	  /* Copy from low end to high end, to allow specified input/output
-	     overlapping.  */
-	  for (i = 0; i < usize; i++)
-	    wp[i] = up[i];
-	}
-      return usize;
-    }
-#endif
-
-  wp -= 1;
-  sh_2 = BITS_PER_MP_LIMB - sh_1;
-  high_limb = up[0];
-  retval = high_limb << sh_2;
-  low_limb = high_limb;
-
-  for (i = 1; i < usize; i++)
-    {
-      high_limb = up[i];
-      wp[i] = (low_limb >> sh_1) | (high_limb << sh_2);
-      low_limb = high_limb;
-    }
-  wp[i] = low_limb >> sh_1;
-
-  return retval;
-}
diff --git a/sysdeps/generic/rtld-lowlevel.h b/sysdeps/generic/rtld-lowlevel.h
new file mode 100644
index 0000000000..353fad28d4
--- /dev/null
+++ b/sysdeps/generic/rtld-lowlevel.h
@@ -0,0 +1 @@
+#error "Lowlevel primitives for ld.so not implemented"
diff --git a/sysdeps/generic/s_asinhl.c b/sysdeps/generic/s_asinhl.c
deleted file mode 100644
index 1d5cf47a4f..0000000000
--- a/sysdeps/generic/s_asinhl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__asinhl(long double x)
-{
-  fputs ("__asinhl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-weak_alias (__asinhl, asinhl)
-stub_warning (asinhl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/s_atanl.c b/sysdeps/generic/s_atanl.c
deleted file mode 100644
index d9a7eb6f8f..0000000000
--- a/sysdeps/generic/s_atanl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__atanl (long double x)
-{
-  fputs ("__atanl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-weak_alias (__atanl, atanl)
-
-stub_warning (atanl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/s_cacos.c b/sysdeps/generic/s_cacos.c
deleted file mode 100644
index 07b6bdcb9c..0000000000
--- a/sysdeps/generic/s_cacos.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Return cosine of complex double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-__complex__ double
-__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;
-
-  return res;
-}
-weak_alias (__cacos, cacos)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cacos, __cacosl)
-weak_alias (__cacos, cacosl)
-#endif
diff --git a/sysdeps/generic/s_cacosf.c b/sysdeps/generic/s_cacosf.c
deleted file mode 100644
index 265184e38d..0000000000
--- a/sysdeps/generic/s_cacosf.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Return cosine of complex float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-__complex__ float
-__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;
-
-  return res;
-}
-#ifndef __cacosf
-weak_alias (__cacosf, cacosf)
-#endif
diff --git a/sysdeps/generic/s_cacosh.c b/sysdeps/generic/s_cacosh.c
deleted file mode 100644
index 1ae8708d49..0000000000
--- a/sysdeps/generic/s_cacosh.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Return arc hyperbole cosine for double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ double
-__cacosh (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VAL;
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nan ("");
-	  else
-	    __imag__ res = __copysign ((rcls == FP_INFINITE
-					? (__real__ x < 0.0
-					   ? M_PI - M_PI_4 : M_PI_4)
-					: M_PI_2), __imag__ x);
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VAL;
-
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysign (signbit (__real__ x) ? M_PI : 0.0,
-				       __imag__ x);
-	  else
-	    __imag__ res = __nan ("");
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      __real__ res = 0.0;
-      __imag__ res = __copysign (M_PI_2, __imag__ x);
-    }
-  else
-    {
-      __complex__ double y;
-
-      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
-      __imag__ y = 2.0 * __real__ x * __imag__ x;
-
-      y = __csqrt (y);
-
-      __real__ y += __real__ x;
-      __imag__ y += __imag__ x;
-
-      res = __clog (y);
-    }
-
-  return res;
-}
-weak_alias (__cacosh, cacosh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cacosh, __cacoshl)
-weak_alias (__cacosh, cacoshl)
-#endif
diff --git a/sysdeps/generic/s_cacoshf.c b/sysdeps/generic/s_cacoshf.c
deleted file mode 100644
index 52c35505e0..0000000000
--- a/sysdeps/generic/s_cacoshf.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Return arc hyperbole cosine for float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-__complex__ float
-__cacoshf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALF;
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nanf ("");
-	  else
-	    __imag__ res = __copysignf ((rcls == FP_INFINITE
-					 ? (__real__ x < 0.0
-					    ? M_PI - M_PI_4 : M_PI_4)
-					 : M_PI_2), __imag__ x);
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALF;
-
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysignf (signbit (__real__ x) ? M_PI : 0.0,
-					__imag__ x);
-	  else
-	    __imag__ res = __nanf ("");
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      __real__ res = 0.0;
-      __imag__ res = __copysignf (M_PI_2, __imag__ x);
-    }
-  else
-    {
-#if 1
-      __complex__ float y;
-
-      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
-      __imag__ y = 2.0 * __real__ x * __imag__ x;
-
-      y = __csqrtf (y);
-
-      __real__ y += __real__ x;
-      __imag__ y += __imag__ x;
-
-      res = __clogf (y);
-#else
-      float re2 = __real__ x * __real__ x;
-      float im2 = __imag__ x * __imag__ x;
-      float sq = re2 - im2 - 1.0;
-      float ro = __ieee754_sqrtf (sq * sq + 4 * re2 * im2);
-      float a = __ieee754_sqrtf ((sq + ro) / 2.0);
-      float b = __ieee754_sqrtf ((-sq + ro) / 2.0);
-
-      __real__ res = 0.5 * __ieee754_logf (re2 + __real__ x * 2 * a
-					   + im2 + __imag__ x * 2 * b
-					   + ro);
-      __imag__ res = __ieee754_atan2f (__imag__ x + b, __real__ x + a);
-#endif
-    }
-
-  return res;
-}
-#ifndef __cacoshf
-weak_alias (__cacoshf, cacoshf)
-#endif
diff --git a/sysdeps/generic/s_cacoshl.c b/sysdeps/generic/s_cacoshl.c
deleted file mode 100644
index 4e5e2b3e3e..0000000000
--- a/sysdeps/generic/s_cacoshl.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Return arc hyperbole cosine for long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ long double
-__cacoshl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALL;
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nanl ("");
-	  else
-	    __imag__ res = __copysignl ((rcls == FP_INFINITE
-					 ? (__real__ x < 0.0
-					    ? M_PIl - M_PI_4l : M_PI_4l)
-					 : M_PI_2l), __imag__ x);
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALL;
-
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysignl (signbit (__real__ x) ? M_PIl : 0.0,
-					__imag__ x);
-	  else
-	    __imag__ res = __nanl ("");
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      __real__ res = 0.0;
-      __imag__ res = __copysignl (M_PI_2l, __imag__ x);
-    }
-  else
-    {
-      __complex__ long double y;
-
-      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) - 1.0;
-      __imag__ y = 2.0 * __real__ x * __imag__ x;
-
-      y = __csqrtl (y);
-
-      __real__ y += __real__ x;
-      __imag__ y += __imag__ x;
-
-      res = __clogl (y);
-    }
-
-  return res;
-}
-weak_alias (__cacoshl, cacoshl)
diff --git a/sysdeps/generic/s_cacosl.c b/sysdeps/generic/s_cacosl.c
deleted file mode 100644
index a7ceff891b..0000000000
--- a/sysdeps/generic/s_cacosl.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Return cosine of complex long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-__complex__ long double
-__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;
-
-  return res;
-}
-weak_alias (__cacosl, cacosl)
diff --git a/sysdeps/generic/s_casin.c b/sysdeps/generic/s_casin.c
deleted file mode 100644
index 2d5b06cf78..0000000000
--- a/sysdeps/generic/s_casin.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Return arc sine of complex double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ double
-__casin (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (isnan (__real__ x) || isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else if (__isinf (__real__ x) || __isinf (__imag__ x))
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __copysign (HUGE_VAL, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else
-    {
-      __complex__ double y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      y = __casinh (y);
-
-      __real__ res = __imag__ y;
-      __imag__ res = -__real__ y;
-    }
-
-  return res;
-}
-weak_alias (__casin, casin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casin, __casinl)
-weak_alias (__casin, casinl)
-#endif
diff --git a/sysdeps/generic/s_casinf.c b/sysdeps/generic/s_casinf.c
deleted file mode 100644
index 5278dbbf78..0000000000
--- a/sysdeps/generic/s_casinf.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Return arc sine of complex float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ float
-__casinf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (isnan (__real__ x) || isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else if (__isinff (__real__ x) || __isinff (__imag__ x))
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else
-    {
-      __complex__ float y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      y = __casinhf (y);
-
-      __real__ res = __imag__ y;
-      __imag__ res = -__real__ y;
-    }
-
-  return res;
-}
-#ifndef __casinf
-weak_alias (__casinf, casinf)
-#endif
diff --git a/sysdeps/generic/s_casinh.c b/sysdeps/generic/s_casinh.c
deleted file mode 100644
index a574add70e..0000000000
--- a/sysdeps/generic/s_casinh.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Return arc hyperbole sine for double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ double
-__casinh (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysign (HUGE_VAL, __real__ x);
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nan ("");
-	  else
-	    __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
-				       __imag__ x);
-	}
-      else if (rcls <= FP_INFINITE)
-	{
-	  __real__ res = __real__ x;
-	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
-	      || (rcls == FP_NAN && icls == FP_ZERO))
-	    __imag__ res = __copysign (0.0, __imag__ x);
-	  else
-	    __imag__ res = __nan ("");
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      __complex__ double y;
-
-      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
-      __imag__ y = 2.0 * __real__ x * __imag__ x;
-
-      y = __csqrt (y);
-
-      __real__ y += __real__ x;
-      __imag__ y += __imag__ x;
-
-      res = __clog (y);
-    }
-
-  return res;
-}
-weak_alias (__casinh, casinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casinh, __casinhl)
-weak_alias (__casinh, casinhl)
-#endif
diff --git a/sysdeps/generic/s_casinhf.c b/sysdeps/generic/s_casinhf.c
deleted file mode 100644
index 7037ab937c..0000000000
--- a/sysdeps/generic/s_casinhf.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Return arc hyperbole sine for float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ float
-__casinhf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignf (HUGE_VALF, __real__ x);
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nanf ("");
-	  else
-	    __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
-					__imag__ x);
-	}
-      else if (rcls <= FP_INFINITE)
-	{
-	  __real__ res = __real__ x;
-	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
-	      || (rcls == FP_NAN && icls == FP_ZERO))
-	    __imag__ res = __copysignf (0.0, __imag__ x);
-	  else
-	    __imag__ res = __nanf ("");
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      __complex__ float y;
-
-      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
-      __imag__ y = 2.0 * __real__ x * __imag__ x;
-
-      y = __csqrtf (y);
-
-      __real__ y += __real__ x;
-      __imag__ y += __imag__ x;
-
-      res = __clogf (y);
-    }
-
-  return res;
-}
-#ifndef __casinhf
-weak_alias (__casinhf, casinhf)
-#endif
diff --git a/sysdeps/generic/s_casinhl.c b/sysdeps/generic/s_casinhl.c
deleted file mode 100644
index 376b2347a0..0000000000
--- a/sysdeps/generic/s_casinhl.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Return arc hyperbole sine for long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ long double
-__casinhl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignl (HUGE_VALL, __real__ x);
-
-	  if (rcls == FP_NAN)
-	    __imag__ res = __nanl ("");
-	  else
-	    __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l,
-					__imag__ x);
-	}
-      else if (rcls <= FP_INFINITE)
-	{
-	  __real__ res = __real__ x;
-	  if ((rcls == FP_INFINITE && icls >= FP_ZERO)
-	      || (rcls == FP_NAN && icls == FP_ZERO))
-	    __imag__ res = __copysignl (0.0, __imag__ x);
-	  else
-	    __imag__ res = __nanl ("");
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      __complex__ long double y;
-
-      __real__ y = (__real__ x - __imag__ x) * (__real__ x + __imag__ x) + 1.0;
-      __imag__ y = 2.0 * __real__ x * __imag__ x;
-
-      y = __csqrtl (y);
-
-      __real__ y += __real__ x;
-      __imag__ y += __imag__ x;
-
-      res = __clogl (y);
-    }
-
-  return res;
-}
-weak_alias (__casinhl, casinhl)
diff --git a/sysdeps/generic/s_casinl.c b/sysdeps/generic/s_casinl.c
deleted file mode 100644
index f303c05ae6..0000000000
--- a/sysdeps/generic/s_casinl.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Return arc sine of complex long double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ long double
-__casinl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (isnan (__real__ x) || isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else if (__isinfl (__real__ x) || __isinfl (__imag__ x))
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else
-    {
-      __complex__ long double y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      y = __casinhl (y);
-
-      __real__ res = __imag__ y;
-      __imag__ res = -__real__ y;
-    }
-
-  return res;
-}
-weak_alias (__casinl, casinl)
diff --git a/sysdeps/generic/s_catan.c b/sysdeps/generic/s_catan.c
deleted file mode 100644
index 1d0673ad6a..0000000000
--- a/sysdeps/generic/s_catan.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Return arc tangent of complex double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__catan (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (rcls == FP_INFINITE)
-	{
-	  __real__ res = __copysign (M_PI_2, __real__ x);
-	  __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else if (icls == FP_INFINITE)
-	{
-	  if (rcls >= FP_ZERO)
-	    __real__ res = __copysign (M_PI_2, __real__ x);
-	  else
-	    __real__ res = __nan ("");
-	  __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else if (icls == FP_ZERO || icls == FP_INFINITE)
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      double r2, num, den;
-
-      r2 = __real__ x * __real__ x;
-
-      den = 1 - r2 - __imag__ x * __imag__ x;
-
-      __real__ res = 0.5 * __ieee754_atan2 (2.0 * __real__ x, den);
-
-      num = __imag__ x + 1.0;
-      num = r2 + num * num;
-
-      den = __imag__ x - 1.0;
-      den = r2 + den * den;
-
-      __imag__ res = 0.25 * __ieee754_log (num / den);
-    }
-
-  return res;
-}
-weak_alias (__catan, catan)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__catan, __catanl)
-weak_alias (__catan, catanl)
-#endif
diff --git a/sysdeps/generic/s_catanf.c b/sysdeps/generic/s_catanf.c
deleted file mode 100644
index 25eec2b1b5..0000000000
--- a/sysdeps/generic/s_catanf.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Return arc tangent of complex float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__catanf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (rcls == FP_INFINITE)
-	{
-	  __real__ res = __copysignf (M_PI_2, __real__ x);
-	  __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else if (icls == FP_INFINITE)
-	{
-	  if (rcls >= FP_ZERO)
-	    __real__ res = __copysignf (M_PI_2, __real__ x);
-	  else
-	    __real__ res = __nanf ("");
-	  __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else if (icls == FP_ZERO || icls == FP_INFINITE)
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      float r2, num, den;
-
-      r2 = __real__ x * __real__ x;
-
-      den = 1 - r2 - __imag__ x * __imag__ x;
-
-      __real__ res = 0.5 * __ieee754_atan2f (2.0 * __real__ x, den);
-
-      num = __imag__ x + 1.0;
-      num = r2 + num * num;
-
-      den = __imag__ x - 1.0;
-      den = r2 + den * den;
-
-      __imag__ res = 0.25 * __ieee754_logf (num / den);
-    }
-
-  return res;
-}
-#ifndef __catanf
-weak_alias (__catanf, catanf)
-#endif
diff --git a/sysdeps/generic/s_catanh.c b/sysdeps/generic/s_catanh.c
deleted file mode 100644
index e15c073f96..0000000000
--- a/sysdeps/generic/s_catanh.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Return arc hyperbole tangent for double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__catanh (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysign (0.0, __real__ x);
-	  __imag__ res = __copysign (M_PI_2, __imag__ x);
-	}
-      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
-	{
-	  __real__ res = __copysign (0.0, __real__ x);
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysign (M_PI_2, __imag__ x);
-	  else
-	    __imag__ res = __nan ("");
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      double i2, num, den;
-
-      i2 = __imag__ x * __imag__ x;
-
-      num = 1.0 + __real__ x;
-      num = i2 + num * num;
-
-      den = 1.0 - __real__ x;
-      den = i2 + den * den;
-
-      __real__ res = 0.25 * (__ieee754_log (num) - __ieee754_log (den));
-
-      den = 1 - __real__ x * __real__ x - i2;
-
-      __imag__ res = 0.5 * __ieee754_atan2 (2.0 * __imag__ x, den);
-    }
-
-  return res;
-}
-weak_alias (__catanh, catanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__catanh, __catanhl)
-weak_alias (__catanh, catanhl)
-#endif
diff --git a/sysdeps/generic/s_catanhf.c b/sysdeps/generic/s_catanhf.c
deleted file mode 100644
index d2422e6111..0000000000
--- a/sysdeps/generic/s_catanhf.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Return arc hyperbole tangent for float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__catanhf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignf (0.0, __real__ x);
-	  __imag__ res = __copysignf (M_PI_2, __imag__ x);
-	}
-      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
-	{
-	  __real__ res = __copysignf (0.0, __real__ x);
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysignf (M_PI_2, __imag__ x);
-	  else
-	    __imag__ res = __nanf ("");
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      float i2, num, den;
-
-      i2 = __imag__ x * __imag__ x;
-
-      num = 1.0 + __real__ x;
-      num = i2 + num * num;
-
-      den = 1.0 - __real__ x;
-      den = i2 + den * den;
-
-      __real__ res = 0.25 * (__ieee754_logf (num) - __ieee754_logf (den));
-
-      den = 1 - __real__ x * __real__ x - i2;
-
-      __imag__ res = 0.5 * __ieee754_atan2f (2.0 * __imag__ x, den);
-    }
-
-  return res;
-}
-#ifndef __catanhf
-weak_alias (__catanhf, catanhf)
-#endif
diff --git a/sysdeps/generic/s_catanhl.c b/sysdeps/generic/s_catanhl.c
deleted file mode 100644
index c3fb0ce5ff..0000000000
--- a/sysdeps/generic/s_catanhl.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Return arc hyperbole tangent for long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__catanhl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = __copysignl (0.0, __real__ x);
-	  __imag__ res = __copysignl (M_PI_2l, __imag__ x);
-	}
-      else if (rcls == FP_INFINITE || rcls == FP_ZERO)
-	{
-	  __real__ res = __copysignl (0.0, __real__ x);
-	  if (icls >= FP_ZERO)
-	    __imag__ res = __copysignl (M_PI_2l, __imag__ x);
-	  else
-	    __imag__ res = __nanl ("");
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      long double i2, num, den;
-
-      i2 = __imag__ x * __imag__ x;
-
-      num = 1.0 + __real__ x;
-      num = i2 + num * num;
-
-      den = 1.0 - __real__ x;
-      den = i2 + den * den;
-
-      __real__ res = 0.25 * (__ieee754_logl (num) - __ieee754_logl (den));
-
-      den = 1 - __real__ x * __real__ x - i2;
-
-      __imag__ res = 0.5 * __ieee754_atan2l (2.0 * __imag__ x, den);
-    }
-
-  return res;
-}
-weak_alias (__catanhl, catanhl)
diff --git a/sysdeps/generic/s_catanl.c b/sysdeps/generic/s_catanl.c
deleted file mode 100644
index 6cb45e5bee..0000000000
--- a/sysdeps/generic/s_catanl.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Return arc tangent of complex long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__catanl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (rcls == FP_INFINITE)
-	{
-	  __real__ res = __copysignl (M_PI_2l, __real__ x);
-	  __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else if (icls == FP_INFINITE)
-	{
-	  if (rcls >= FP_ZERO)
-	    __real__ res = __copysignl (M_PI_2l, __real__ x);
-	  else
-	    __real__ res = __nanl ("");
-	  __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else if (icls == FP_ZERO || icls == FP_INFINITE)
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      res = x;
-    }
-  else
-    {
-      long double r2, num, den;
-
-      r2 = __real__ x * __real__ x;
-
-      den = 1 - r2 - __imag__ x * __imag__ x;
-
-      __real__ res = 0.5 * __ieee754_atan2l (2.0 * __real__ x, den);
-
-      num = __imag__ x + 1.0;
-      num = r2 + num * num;
-
-      den = __imag__ x - 1.0;
-      den = r2 + den * den;
-
-      __imag__ res = 0.25 * __ieee754_logl (num / den);
-    }
-
-  return res;
-}
-weak_alias (__catanl, catanl)
diff --git a/sysdeps/generic/s_cbrtl.c b/sysdeps/generic/s_cbrtl.c
deleted file mode 100644
index d668e377af..0000000000
--- a/sysdeps/generic/s_cbrtl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__cbrtl(long double x)
-{
-  fputs ("__cbrtl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-weak_alias (__cbrtl, cbrtl)
-stub_warning (cbrtl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/s_ccos.c b/sysdeps/generic/s_ccos.c
deleted file mode 100644
index 1b244d7079..0000000000
--- a/sysdeps/generic/s_ccos.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Return cosine of complex double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-
-__complex__ double
-__ccos (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (!isfinite (__real__ x) || __isnan (__imag__ x))
-    {
-      if (__real__ x == 0.0 || __imag__ x == 0.0)
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = 0.0;
-
-#ifdef FE_INVALID
-	  if (__isinf (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else if (__isinf (__imag__ x))
-	{
-	  __real__ res = HUGE_VAL;
-	  __imag__ res = __nan ("");
-
-#ifdef FE_INVALID
-	  if (__isinf (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-
-#ifdef FE_INVALID
-	  if (isfinite (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __complex__ double y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      res = __ccosh (y);
-    }
-
-  return res;
-}
-weak_alias (__ccos, ccos)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ccos, __ccosl)
-weak_alias (__ccos, ccosl)
-#endif
diff --git a/sysdeps/generic/s_ccosf.c b/sysdeps/generic/s_ccosf.c
deleted file mode 100644
index 4b154deac5..0000000000
--- a/sysdeps/generic/s_ccosf.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Return cosine of complex float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-
-__complex__ float
-__ccosf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (!isfinite (__real__ x) || __isnanf (__imag__ x))
-    {
-      if (__real__ x == 0.0 || __imag__ x == 0.0)
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = 0.0;
-
-#ifdef FE_INVALID
-	  if (__isinff (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else if (__isinff (__imag__ x))
-	{
-	  __real__ res = HUGE_VALF;
-	  __imag__ res = __nanf ("");
-
-#ifdef FE_INVALID
-	  if (__isinff (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-
-#ifdef FE_INVALID
-	  if (isfinite (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __complex__ float y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      res = __ccoshf (y);
-    }
-
-  return res;
-}
-#ifndef __ccosf
-weak_alias (__ccosf, ccosf)
-#endif
diff --git a/sysdeps/generic/s_ccosh.c b/sysdeps/generic/s_ccosh.c
deleted file mode 100644
index f5b29db24b..0000000000
--- a/sysdeps/generic/s_ccosh.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Complex cosine hyperbole function for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__ccosh (__complex__ double x)
-{
-  __complex__ double retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  double sinh_val = __ieee754_sinh (__real__ x);
-	  double cosh_val = __ieee754_cosh (__real__ x);
-	  double sinix, cosix;
-
-	  __sincos (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = cosh_val * cosix;
-	  __imag__ retval = sinh_val * sinix;
-	}
-      else
-	{
-	  __imag__ retval = __real__ x == 0.0 ? 0.0 : __nan ("");
-	  __real__ retval = __nan ("") + __nan ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __imag__ x * __copysign (1.0, __real__ x);
-	}
-      else if (icls > FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  double sinix, cosix;
-
-	  __sincos (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysign (HUGE_VAL, cosix);
-	  __imag__ retval = (__copysign (HUGE_VAL, sinix)
-			     * __copysign (1.0, __real__ x));
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __nan ("") + __nan ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __real__ retval = __nan ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
-    }
-
-  return retval;
-}
-weak_alias (__ccosh, ccosh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ccosh, __ccoshl)
-weak_alias (__ccosh, ccoshl)
-#endif
diff --git a/sysdeps/generic/s_ccoshf.c b/sysdeps/generic/s_ccoshf.c
deleted file mode 100644
index f400d34f0b..0000000000
--- a/sysdeps/generic/s_ccoshf.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Complex cosine hyperbole function for float.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__ccoshf (__complex__ float x)
-{
-  __complex__ float retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  float sinh_val = __ieee754_sinhf (__real__ x);
-	  float cosh_val = __ieee754_coshf (__real__ x);
-	  float sinix, cosix;
-
-	  __sincosf (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = cosh_val * cosix;
-	  __imag__ retval = sinh_val * sinix;
-	}
-      else
-	{
-	  __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanf ("");
-	  __real__ retval = __nanf ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
-	}
-      else if (icls > FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  float sinix, cosix;
-
-	  __sincosf (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysignf (HUGE_VALF, cosix);
-	  __imag__ retval = (__copysignf (HUGE_VALF, sinix)
-			     * __copysignf (1.0, __real__ x));
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __nanf ("") + __nanf ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __real__ retval = __nanf ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
-    }
-
-  return retval;
-}
-#ifndef __ccoshf
-weak_alias (__ccoshf, ccoshf)
-#endif
diff --git a/sysdeps/generic/s_ccoshl.c b/sysdeps/generic/s_ccoshl.c
deleted file mode 100644
index 61ffb49ca0..0000000000
--- a/sysdeps/generic/s_ccoshl.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Complex cosine hyperbole function for long double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__ccoshl (__complex__ long double x)
-{
-  __complex__ long double retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  long double sinh_val = __ieee754_sinhl (__real__ x);
-	  long double cosh_val = __ieee754_coshl (__real__ x);
-	  long double sinix, cosix;
-
-	  __sincosl (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = cosh_val * cosix;
-	  __imag__ retval = sinh_val * sinix;
-	}
-      else
-	{
-	  __imag__ retval = __real__ x == 0.0 ? 0.0 : __nanl ("");
-	  __real__ retval = __nanl ("") + __nanl ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x);
-	}
-      else if (icls > FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  long double sinix, cosix;
-
-	  __sincosl (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysignl (HUGE_VALL, cosix);
-	  __imag__ retval = (__copysignl (HUGE_VALL, sinix)
-			     * __copysignl (1.0, __real__ x));
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __nanl ("") + __nanl ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __real__ retval = __nanl ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
-    }
-
-  return retval;
-}
-weak_alias (__ccoshl, ccoshl)
diff --git a/sysdeps/generic/s_ccosl.c b/sysdeps/generic/s_ccosl.c
deleted file mode 100644
index 4ebe2c347d..0000000000
--- a/sysdeps/generic/s_ccosl.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Return cosine of complex long double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-
-__complex__ long double
-__ccosl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (!isfinite (__real__ x) || __isnanl (__imag__ x))
-    {
-      if (__real__ x == 0.0 || __imag__ x == 0.0)
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = 0.0;
-
-#ifdef FE_INVALID
-	  if (__isinfl (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else if (__isinfl (__imag__ x))
-	{
-	  __real__ res = HUGE_VALL;
-	  __imag__ res = __nanl ("");
-
-#ifdef FE_INVALID
-	  if (__isinfl (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-
-#ifdef FE_INVALID
-	  if (isfinite (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __complex__ long double y;
-
-      __real__ y = -__imag__ x;
-      __imag__ y = __real__ x;
-
-      res = __ccoshl (y);
-    }
-
-  return res;
-}
-weak_alias (__ccosl, ccosl)
diff --git a/sysdeps/generic/s_cexp.c b/sysdeps/generic/s_cexp.c
deleted file mode 100644
index 5a299b7687..0000000000
--- a/sysdeps/generic/s_cexp.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Return value of complex exponential function for double complex value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__cexp (__complex__ double x)
-{
-  __complex__ double retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  double exp_val = __ieee754_exp (__real__ x);
-	  double sinix, cosix;
-
-	  __sincos (__imag__ x, &sinix, &cosix);
-
-	  if (isfinite (exp_val))
-	    {
-	      __real__ retval = exp_val * cosix;
-	      __imag__ retval = exp_val * sinix;
-	    }
-	  else
-	    {
-	      __real__ retval = __copysign (exp_val, cosix);
-	      __imag__ retval = __copysign (exp_val, sinix);
-	    }
-	}
-      else
-	{
-	  /* If the imaginary part is +-inf or NaN and the real part
-	     is not +-inf the result is NaN + iNaN.  */
-	  __real__ retval = __nan ("");
-	  __imag__ retval = __nan ("");
-
-#ifdef FE_INVALID
-	  feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
-
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = value;
-	      __imag__ retval = __imag__ x;
-	    }
-	  else
-	    {
-	      double sinix, cosix;
-
-	      __sincos (__imag__ x, &sinix, &cosix);
-
-	      __real__ retval = __copysign (value, cosix);
-	      __imag__ retval = __copysign (value, sinix);
-	    }
-	}
-      else if (signbit (__real__ x) == 0)
-	{
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __nan ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else
-	{
-	  __real__ retval = 0.0;
-	  __imag__ retval = __copysign (0.0, __imag__ x);
-	}
-    }
-  else
-    {
-      /* If the real part is NaN the result is NaN + iNaN.  */
-      __real__ retval = __nan ("");
-      __imag__ retval = __nan ("");
-
-#ifdef FE_INVALID
-      if (rcls != FP_NAN || icls != FP_NAN)
-	feraiseexcept (FE_INVALID);
-#endif
-    }
-
-  return retval;
-}
-weak_alias (__cexp, cexp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cexp, __cexpl)
-weak_alias (__cexp, cexpl)
-#endif
diff --git a/sysdeps/generic/s_cexpf.c b/sysdeps/generic/s_cexpf.c
deleted file mode 100644
index 7b68fc365c..0000000000
--- a/sysdeps/generic/s_cexpf.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Return value of complex exponential function for float complex value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__cexpf (__complex__ float x)
-{
-  __complex__ float retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  float exp_val = __ieee754_expf (__real__ x);
-	  float sinix, cosix;
-
-	  __sincosf (__imag__ x, &sinix, &cosix);
-
-	  if (isfinite (exp_val))
-	    {
-	      __real__ retval = exp_val * cosix;
-	      __imag__ retval = exp_val * sinix;
-	    }
-	  else
-	    {
-	      __real__ retval = __copysignf (exp_val, cosix);
-	      __imag__ retval = __copysignf (exp_val, sinix);
-	    }
-	}
-      else
-	{
-	  /* If the imaginary part is +-inf or NaN and the real part
-	     is not +-inf the result is NaN + iNaN.  */
-	  __real__ retval = __nanf ("");
-	  __imag__ retval = __nanf ("");
-
-#ifdef FE_INVALID
-	  feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
-
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = value;
-	      __imag__ retval = __imag__ x;
-	    }
-	  else
-	    {
-	      float sinix, cosix;
-
-	      __sincosf (__imag__ x, &sinix, &cosix);
-
-	      __real__ retval = __copysignf (value, cosix);
-	      __imag__ retval = __copysignf (value, sinix);
-	    }
-	}
-      else if (signbit (__real__ x) == 0)
-	{
-	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __nanf ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else
-	{
-	  __real__ retval = 0.0;
-	  __imag__ retval = __copysignf (0.0, __imag__ x);
-	}
-    }
-  else
-    {
-      /* If the real part is NaN the result is NaN + iNaN.  */
-      __real__ retval = __nanf ("");
-      __imag__ retval = __nanf ("");
-
-#ifdef FE_INVALID
-      if (rcls != FP_NAN || icls != FP_NAN)
-	feraiseexcept (FE_INVALID);
-#endif
-    }
-
-  return retval;
-}
-#ifndef __cexpf
-weak_alias (__cexpf, cexpf)
-#endif
diff --git a/sysdeps/generic/s_cexpl.c b/sysdeps/generic/s_cexpl.c
deleted file mode 100644
index cf6bc974a9..0000000000
--- a/sysdeps/generic/s_cexpl.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Return value of complex exponential function for long double complex value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__cexpl (__complex__ long double x)
-{
-  __complex__ long double retval;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  long double exp_val = __ieee754_expl (__real__ x);
-	  long double sinix, cosix;
-
-	  __sincosl (__imag__ x, &sinix, &cosix);
-
-	  if (isfinite (exp_val))
-	    {
-	      __real__ retval = exp_val * cosix;
-	      __imag__ retval = exp_val * sinix;
-	    }
-	  else
-	    {
-	      __real__ retval = __copysignl (exp_val, cosix);
-	      __imag__ retval = __copysignl (exp_val, sinix);
-	    }
-	}
-      else
-	{
-	  /* If the imaginary part is +-inf or NaN and the real part
-	     is not +-inf the result is NaN + iNaN.  */
-	  __real__ retval = __nanl ("");
-	  __imag__ retval = __nanl ("");
-
-#ifdef FE_INVALID
-	  feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
-
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = value;
-	      __imag__ retval = __imag__ x;
-	    }
-	  else
-	    {
-	      long double sinix, cosix;
-
-	      __sincosl (__imag__ x, &sinix, &cosix);
-
-	      __real__ retval = __copysignl (value, cosix);
-	      __imag__ retval = __copysignl (value, sinix);
-	    }
-	}
-      else if (signbit (__real__ x) == 0)
-	{
-	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __nanl ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-      else
-	{
-	  __real__ retval = 0.0;
-	  __imag__ retval = __copysignl (0.0, __imag__ x);
-	}
-    }
-  else
-    {
-      /* If the real part is NaN the result is NaN + iNaN.  */
-      __real__ retval = __nanl ("");
-      __imag__ retval = __nanl ("");
-
-#ifdef FE_INVALID
-      if (rcls != FP_NAN || icls != FP_NAN)
-	feraiseexcept (FE_INVALID);
-#endif
-    }
-
-  return retval;
-}
-weak_alias (__cexpl, cexpl)
diff --git a/sysdeps/generic/s_clog.c b/sysdeps/generic/s_clog.c
deleted file mode 100644
index f796024b47..0000000000
--- a/sysdeps/generic/s_clog.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Compute complex natural logarithm.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__clog (__complex__ double x)
-{
-  __complex__ double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
-      __imag__ result = __copysign (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabs (__real__ x);
-    }
-  else if (rcls != FP_NAN && icls != FP_NAN)
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log (__ieee754_hypot (__real__ x,
-							__imag__ x));
-      __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nan ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VAL;
-      else
-	__real__ result = __nan ("");
-    }
-
-  return result;
-}
-weak_alias (__clog, clog)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog, __clogl)
-weak_alias (__clog, clogl)
-#endif
diff --git a/sysdeps/generic/s_clog10.c b/sysdeps/generic/s_clog10.c
deleted file mode 100644
index 62c2ca724a..0000000000
--- a/sysdeps/generic/s_clog10.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Compute complex base 10 logarithm.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__clog10 (__complex__ double x)
-{
-  __complex__ double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
-      __imag__ result = __copysign (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabs (__real__ x);
-    }
-  else if (rcls != FP_NAN && icls != FP_NAN)
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log10 (__ieee754_hypot (__real__ x,
-							  __imag__ x));
-      __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nan ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VAL;
-      else
-	__real__ result = __nan ("");
-    }
-
-  return result;
-}
-weak_alias (__clog10, clog10)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog10, __clog10l)
-weak_alias (__clog10, clog10l)
-#endif
diff --git a/sysdeps/generic/s_clog10f.c b/sysdeps/generic/s_clog10f.c
deleted file mode 100644
index eed81f368c..0000000000
--- a/sysdeps/generic/s_clog10f.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Compute complex base 10 logarithm.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__clog10f (__complex__ float x)
-{
-  __complex__ float result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
-      __imag__ result = __copysignf (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsf (__real__ x);
-    }
-  else if (rcls != FP_NAN && icls != FP_NAN)
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log10f (__ieee754_hypotf (__real__ x,
-							    __imag__ x));
-      __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanf ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALF;
-      else
-	__real__ result = __nanf ("");
-    }
-
-  return result;
-}
-#ifndef __clog10f
-weak_alias (__clog10f, clog10f)
-#endif
diff --git a/sysdeps/generic/s_clog10l.c b/sysdeps/generic/s_clog10l.c
deleted file mode 100644
index f901543d05..0000000000
--- a/sysdeps/generic/s_clog10l.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Compute complex base 10 logarithm.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__clog10l (__complex__ long double x)
-{
-  __complex__ long double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
-      __imag__ result = __copysignl (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsl (__real__ x);
-    }
-  else if (rcls != FP_NAN && icls != FP_NAN)
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_log10l (__ieee754_hypotl (__real__ x,
-							    __imag__ x));
-      __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanl ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALL;
-      else
-	__real__ result = __nanl ("");
-    }
-
-  return result;
-}
-weak_alias (__clog10l, clog10l)
diff --git a/sysdeps/generic/s_clogf.c b/sysdeps/generic/s_clogf.c
deleted file mode 100644
index 21e3b57b7f..0000000000
--- a/sysdeps/generic/s_clogf.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Compute complex natural logarithm.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__clogf (__complex__ float x)
-{
-  __complex__ float result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
-      __imag__ result = __copysignf (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsf (__real__ x);
-    }
-  else if (rcls != FP_NAN && icls != FP_NAN)
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_logf (__ieee754_hypotf (__real__ x,
-							  __imag__ x));
-      __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanf ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALF;
-      else
-	__real__ result = __nanf ("");
-    }
-
-  return result;
-}
-#ifndef __clogf
-weak_alias (__clogf, clogf)
-#endif
diff --git a/sysdeps/generic/s_clogl.c b/sysdeps/generic/s_clogl.c
deleted file mode 100644
index 43118f768c..0000000000
--- a/sysdeps/generic/s_clogl.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Compute complex natural logarithm.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__clogl (__complex__ long double x)
-{
-  __complex__ long double result;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls == FP_ZERO && icls == FP_ZERO)
-    {
-      /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
-      __imag__ result = __copysignl (__imag__ result, __imag__ x);
-      /* Yes, the following line raises an exception.  */
-      __real__ result = -1.0 / fabsl (__real__ x);
-    }
-  else if (rcls != FP_NAN && icls != FP_NAN)
-    {
-      /* Neither real nor imaginary part is NaN.  */
-      __real__ result = __ieee754_logl (__ieee754_hypotl (__real__ x,
-							  __imag__ x));
-      __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
-    }
-  else
-    {
-      __imag__ result = __nanl ("");
-      if (rcls == FP_INFINITE || icls == FP_INFINITE)
-	/* Real or imaginary part is infinite.  */
-	__real__ result = HUGE_VALL;
-      else
-	__real__ result = __nanl ("");
-    }
-
-  return result;
-}
-weak_alias (__clogl, clogl)
diff --git a/sysdeps/generic/s_cpow.c b/sysdeps/generic/s_cpow.c
deleted file mode 100644
index 86536cc95b..0000000000
--- a/sysdeps/generic/s_cpow.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Complex power of double values.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ double
-__cpow (__complex__ double x, __complex__ double c)
-{
-  return __cexp (c * __clog (x));
-}
-weak_alias (__cpow, cpow)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cpow, __cpowl)
-weak_alias (__cpow, cpowl)
-#endif
diff --git a/sysdeps/generic/s_cpowf.c b/sysdeps/generic/s_cpowf.c
deleted file mode 100644
index 58eaa1aa06..0000000000
--- a/sysdeps/generic/s_cpowf.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Complex power of float values.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ float
-__cpowf (__complex__ float x, __complex__ float c)
-{
-  return __cexpf (c * __clogf (x));
-}
-#ifndef __cpowf
-weak_alias (__cpowf, cpowf)
-#endif
diff --git a/sysdeps/generic/s_cpowl.c b/sysdeps/generic/s_cpowl.c
deleted file mode 100644
index 4c358b3ebe..0000000000
--- a/sysdeps/generic/s_cpowl.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Complex power of long double values.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ long double
-__cpowl (__complex__ long double x, __complex__ long double c)
-{
-  return __cexpl (c * __clogl (x));
-}
-weak_alias (__cpowl, cpowl)
diff --git a/sysdeps/generic/s_cproj.c b/sysdeps/generic/s_cproj.c
deleted file mode 100644
index 8e7ca41df8..0000000000
--- a/sysdeps/generic/s_cproj.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Compute projection of complex double value to Riemann sphere.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ double
-__cproj (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (isnan (__real__ x) && isnan (__imag__ x))
-    return x;
-  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      __real__ res = INFINITY;
-      __imag__ res = __copysign (0.0, __imag__ x);
-    }
-  else
-    {
-      double den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
-
-      __real__ res = (2.0 * __real__ x) / den;
-      __imag__ res = (2.0 * __imag__ x) / den;
-    }
-
-  return res;
-}
-weak_alias (__cproj, cproj)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cproj, __cprojl)
-weak_alias (__cproj, cprojl)
-#endif
diff --git a/sysdeps/generic/s_cprojf.c b/sysdeps/generic/s_cprojf.c
deleted file mode 100644
index 83df13cfa9..0000000000
--- a/sysdeps/generic/s_cprojf.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Compute projection of complex float value to Riemann sphere.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ float
-__cprojf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (isnan (__real__ x) && isnan (__imag__ x))
-    return x;
-  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      __real__ res = INFINITY;
-      __imag__ res = __copysignf (0.0, __imag__ x);
-    }
-  else
-    {
-      float den = __real__ x * __real__ x + __imag__ x * __imag__ x + 1.0;
-
-      __real__ res = (2.0 * __real__ x) / den;
-      __imag__ res = (2.0 * __imag__ x) / den;
-    }
-
-  return res;
-}
-#ifndef __cprojf
-weak_alias (__cprojf, cprojf)
-#endif
diff --git a/sysdeps/generic/s_cprojl.c b/sysdeps/generic/s_cprojl.c
deleted file mode 100644
index c70cdc47db..0000000000
--- a/sysdeps/generic/s_cprojl.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Compute projection of complex long double value to Riemann sphere.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-
-__complex__ long double
-__cprojl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (isnan (__real__ x) && isnan (__imag__ x))
-    return x;
-  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      __real__ res = INFINITY;
-      __imag__ res = __copysignl (0.0, __imag__ x);
-    }
-  else
-    {
-      long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x
-			 + 1.0);
-
-      __real__ res = (2.0 * __real__ x) / den;
-      __imag__ res = (2.0 * __imag__ x) / den;
-    }
-
-  return res;
-}
-weak_alias (__cprojl, cprojl)
diff --git a/sysdeps/generic/s_csin.c b/sysdeps/generic/s_csin.c
deleted file mode 100644
index eb380e2c3f..0000000000
--- a/sysdeps/generic/s_csin.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Complex sine function for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__csin (__complex__ double x)
-{
-  __complex__ double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabs (__real__ x);
-
-  if (icls >= FP_ZERO)
-    {
-      /* Imaginary part is finite.  */
-      if (rcls >= FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  double sinh_val = __ieee754_sinh (__imag__ x);
-	  double cosh_val = __ieee754_cosh (__imag__ x);
-	  double sinix, cosix;
-
-	  __sincos (__real__ x, &sinix, &cosix);
-
-	  __real__ retval = cosh_val * sinix;
-	  __imag__ retval = sinh_val * cosix;
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __imag__ x;
-
-#ifdef FE_INVALID
-	      if (rcls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-#endif
-	    }
-	  else
-	    {
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __nan ("");
-
-#ifdef FE_INVALID
-	      feraiseexcept (FE_INVALID);
-#endif
-	    }
-	}
-    }
-  else if (icls == FP_INFINITE)
-    {
-      /* Imaginary part is infinite.  */
-      if (rcls == FP_ZERO)
-	{
-	  /* Real part is 0.0.  */
-	  __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
-	  __imag__ retval = __imag__ x;
-	}
-      else if (rcls > FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  double sinix, cosix;
-
-	  __sincos (__real__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysign (HUGE_VAL, sinix);
-	  __imag__ retval = __copysign (HUGE_VAL, cosix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	  if (signbit (__imag__ x))
-	    __imag__ retval = -__imag__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = __nan ("");
-	  __imag__ retval = HUGE_VAL;
-
-#ifdef FE_INVALID
-	  if (rcls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      if (rcls == FP_ZERO)
-	__real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
-      else
-	__real__ retval = __nan ("");
-      __imag__ retval = __nan ("");
-    }
-
-  return retval;
-}
-weak_alias (__csin, csin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csin, __csinl)
-weak_alias (__csin, csinl)
-#endif
diff --git a/sysdeps/generic/s_csinf.c b/sysdeps/generic/s_csinf.c
deleted file mode 100644
index 8004743bd3..0000000000
--- a/sysdeps/generic/s_csinf.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Complex sine function for float.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__csinf (__complex__ float x)
-{
-  __complex__ float retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsf (__real__ x);
-
-  if (icls >= FP_ZERO)
-    {
-      /* Imaginary part is finite.  */
-      if (rcls >= FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  float sinh_val = __ieee754_sinhf (__imag__ x);
-	  float cosh_val = __ieee754_coshf (__imag__ x);
-	  float sinix, cosix;
-
-	  __sincosf (__real__ x, &sinix, &cosix);
-
-	  __real__ retval = cosh_val * sinix;
-	  __imag__ retval = sinh_val * cosix;
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = __nanf ("");
-	      __imag__ retval = __imag__ x;
-
-#ifdef FE_INVALID
-	      if (rcls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-#endif
-	    }
-	  else
-	    {
-	      __real__ retval = __nanf ("");
-	      __imag__ retval = __nanf ("");
-
-#ifdef FE_INVALID
-	      feraiseexcept (FE_INVALID);
-#endif
-	    }
-	}
-    }
-  else if (icls == FP_INFINITE)
-    {
-      /* Imaginary part is infinite.  */
-      if (rcls == FP_ZERO)
-	{
-	  /* Real part is 0.0.  */
-	  __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
-	  __imag__ retval = __imag__ x;
-	}
-      else if (rcls > FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  float sinix, cosix;
-
-	  __sincosf (__real__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysignf (HUGE_VALF, sinix);
-	  __imag__ retval = __copysignf (HUGE_VALF, cosix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	  if (signbit (__imag__ x))
-	    __imag__ retval = -__imag__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = __nanf ("");
-	  __imag__ retval = HUGE_VALF;
-
-#ifdef FE_INVALID
-	  if (rcls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      if (rcls == FP_ZERO)
-	__real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
-      else
-	__real__ retval = __nanf ("");
-      __imag__ retval = __nanf ("");
-    }
-
-  return retval;
-}
-#ifndef __csinf
-weak_alias (__csinf, csinf)
-#endif
diff --git a/sysdeps/generic/s_csinh.c b/sysdeps/generic/s_csinh.c
deleted file mode 100644
index f0e0cc61f1..0000000000
--- a/sysdeps/generic/s_csinh.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Complex sine hyperbole function for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__csinh (__complex__ double x)
-{
-  __complex__ double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabs (__real__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  double sinh_val = __ieee754_sinh (__real__ x);
-	  double cosh_val = __ieee754_cosh (__real__ x);
-	  double sinix, cosix;
-
-	  __sincos (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = sinh_val * cosix;
-	  __imag__ retval = cosh_val * sinix;
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  if (rcls == FP_ZERO)
-	    {
-	      /* Real part is 0.0.  */
-	      __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
-	      __imag__ retval = __nan ("") + __nan ("");
-
-#ifdef FE_INVALID
-	      if (icls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-#endif
-	    }
-	  else
-	    {
-	      __real__ retval = __nan ("");
-	      __imag__ retval = __nan ("");
-
-#ifdef FE_INVALID
-	      feraiseexcept (FE_INVALID);
-#endif
-	    }
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
-	  __imag__ retval = __imag__ x;
-	}
-      else if (icls > FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  double sinix, cosix;
-
-	  __sincos (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysign (HUGE_VAL, cosix);
-	  __imag__ retval = __copysign (HUGE_VAL, sinix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __nan ("") + __nan ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __real__ retval = __nan ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
-    }
-
-  return retval;
-}
-weak_alias (__csinh, csinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csinh, __csinhl)
-weak_alias (__csinh, csinhl)
-#endif
diff --git a/sysdeps/generic/s_csinhf.c b/sysdeps/generic/s_csinhf.c
deleted file mode 100644
index e4bb704268..0000000000
--- a/sysdeps/generic/s_csinhf.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* Complex sine hyperbole function for float.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__csinhf (__complex__ float x)
-{
-  __complex__ float retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsf (__real__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  float sinh_val = __ieee754_sinhf (__real__ x);
-	  float cosh_val = __ieee754_coshf (__real__ x);
-	  float sinix, cosix;
-
-	  __sincosf (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = sinh_val * cosix;
-	  __imag__ retval = cosh_val * sinix;
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  if (rcls == FP_ZERO)
-	    {
-	      /* Real part is 0.0.  */
-	      __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
-	      __imag__ retval = __nanf ("") + __nanf ("");
-
-#ifdef FE_INVALID
-	      if (icls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-#endif
-	    }
-	  else
-	    {
-	      __real__ retval = __nanf ("");
-	      __imag__ retval = __nanf ("");
-
-#ifdef FE_INVALID
-	      feraiseexcept (FE_INVALID);
-#endif
-	    }
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
-	  __imag__ retval = __imag__ x;
-	}
-      else if (icls > FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  float sinix, cosix;
-
-	  __sincosf (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysignf (HUGE_VALF, cosix);
-	  __imag__ retval = __copysignf (HUGE_VALF, sinix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __nanf ("") + __nanf ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __real__ retval = __nanf ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
-    }
-
-  return retval;
-}
-#ifndef __csinhf
-weak_alias (__csinhf, csinhf)
-#endif
diff --git a/sysdeps/generic/s_csinhl.c b/sysdeps/generic/s_csinhl.c
deleted file mode 100644
index 226075634d..0000000000
--- a/sysdeps/generic/s_csinhl.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Complex sine hyperbole function for long double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__csinhl (__complex__ long double x)
-{
-  __complex__ long double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsl (__real__ x);
-
-  if (rcls >= FP_ZERO)
-    {
-      /* Real part is finite.  */
-      if (icls >= FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  long double sinh_val = __ieee754_sinhl (__real__ x);
-	  long double cosh_val = __ieee754_coshl (__real__ x);
-	  long double sinix, cosix;
-
-	  __sincosl (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = sinh_val * cosix;
-	  __imag__ retval = cosh_val * sinix;
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  if (rcls == FP_ZERO)
-	    {
-	      /* Real part is 0.0.  */
-	      __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
-	      __imag__ retval = __nanl ("") + __nanl ("");
-
-#ifdef FE_INVALID
-	      if (icls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-#endif
-	    }
-	  else
-	    {
-	      __real__ retval = __nanl ("");
-	      __imag__ retval = __nanl ("");
-
-#ifdef FE_INVALID
-	      feraiseexcept (FE_INVALID);
-#endif
-	    }
-	}
-    }
-  else if (rcls == FP_INFINITE)
-    {
-      /* Real part is infinite.  */
-      if (icls == FP_ZERO)
-	{
-	  /* Imaginary part is 0.0.  */
-	  __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
-	  __imag__ retval = __imag__ x;
-	}
-      else if (icls > FP_ZERO)
-	{
-	  /* Imaginary part is finite.  */
-	  long double sinix, cosix;
-
-	  __sincosl (__imag__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysignl (HUGE_VALL, cosix);
-	  __imag__ retval = __copysignl (HUGE_VALL, sinix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __nanl ("") + __nanl ("");
-
-#ifdef FE_INVALID
-	  if (icls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      __real__ retval = __nanl ("");
-      __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
-    }
-
-  return retval;
-}
-weak_alias (__csinhl, csinhl)
diff --git a/sysdeps/generic/s_csinl.c b/sysdeps/generic/s_csinl.c
deleted file mode 100644
index f7a1c43600..0000000000
--- a/sysdeps/generic/s_csinl.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Complex sine function for long double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__csinl (__complex__ long double x)
-{
-  __complex__ long double retval;
-  int negate = signbit (__real__ x);
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  __real__ x = fabsl (__real__ x);
-
-  if (icls >= FP_ZERO)
-    {
-      /* Imaginary part is finite.  */
-      if (rcls >= FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  long double sinh_val = __ieee754_sinhl (__imag__ x);
-	  long double cosh_val = __ieee754_coshl (__imag__ x);
-	  long double sinix, cosix;
-
-	  __sincosl (__real__ x, &sinix, &cosix);
-
-	  __real__ retval = cosh_val * sinix;
-	  __imag__ retval = sinh_val * cosix;
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	}
-      else
-	{
-	  if (icls == FP_ZERO)
-	    {
-	      /* Imaginary part is 0.0.  */
-	      __real__ retval = __nanl ("");
-	      __imag__ retval = __imag__ x;
-
-#ifdef FE_INVALID
-	      if (rcls == FP_INFINITE)
-		feraiseexcept (FE_INVALID);
-#endif
-	    }
-	  else
-	    {
-	      __real__ retval = __nanl ("");
-	      __imag__ retval = __nanl ("");
-
-#ifdef FE_INVALID
-	      feraiseexcept (FE_INVALID);
-#endif
-	    }
-	}
-    }
-  else if (icls == FP_INFINITE)
-    {
-      /* Imaginary part is infinite.  */
-      if (rcls == FP_ZERO)
-	{
-	  /* Real part is 0.0.  */
-	  __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
-	  __imag__ retval = __imag__ x;
-	}
-      else if (rcls > FP_ZERO)
-	{
-	  /* Real part is finite.  */
-	  long double sinix, cosix;
-
-	  __sincosl (__real__ x, &sinix, &cosix);
-
-	  __real__ retval = __copysignl (HUGE_VALL, sinix);
-	  __imag__ retval = __copysignl (HUGE_VALL, cosix);
-
-	  if (negate)
-	    __real__ retval = -__real__ retval;
-	  if (signbit (__imag__ x))
-	    __imag__ retval = -__imag__ retval;
-	}
-      else
-	{
-	  /* The addition raises the invalid exception.  */
-	  __real__ retval = __nanl ("");
-	  __imag__ retval = HUGE_VALL;
-
-#ifdef FE_INVALID
-	  if (rcls == FP_INFINITE)
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      if (rcls == FP_ZERO)
-	__real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
-      else
-	__real__ retval = __nanl ("");
-      __imag__ retval = __nanl ("");
-    }
-
-  return retval;
-}
-weak_alias (__csinl, csinl)
diff --git a/sysdeps/generic/s_csqrt.c b/sysdeps/generic/s_csqrt.c
deleted file mode 100644
index 0bb6690b17..0000000000
--- a/sysdeps/generic/s_csqrt.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Complex square root of double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__csqrt (__complex__ double x)
-{
-  __complex__ double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VAL;
-	  __imag__ res = __imag__ x;
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = icls == FP_NAN ? __nan ("") : 0;
-	      __imag__ res = __copysign (HUGE_VAL, __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = __real__ x;
-	      __imag__ res = (icls == FP_NAN
-			      ? __nan ("") : __copysign (0.0, __imag__ x));
-	    }
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-	}
-    }
-  else
-    {
-      if (icls == FP_ZERO)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = 0.0;
-	      __imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
-					 __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = fabs (__ieee754_sqrt (__real__ x));
-	      __imag__ res = __copysign (0.0, __imag__ x);
-	    }
-	}
-      else if (rcls == FP_ZERO)
-	{
-	  double r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
-
-	  __real__ res = __copysign (r, __imag__ x);
-	  __imag__ res = r;
-	}
-      else
-	{
-	  double d, r, s;
-
-	  d = __ieee754_hypot (__real__ x, __imag__ x);
-	  /* Use the identity   2  Re res  Im res = Im x
-	     to avoid cancellation error in  d +/- Re x.  */
-	  if (__real__ x > 0)
-	    {
-	      r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x);
-	      s = (0.5 * __imag__ x) / r;
-	    }
-	  else
-	    {
-	      s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x);
-	      r = fabs ((0.5 * __imag__ x) / s);
-	    }
-
-	  __real__ res = r;
-	  __imag__ res = __copysign (s, __imag__ x);
-	}
-    }
-
-  return res;
-}
-weak_alias (__csqrt, csqrt)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csqrt, __csqrtl)
-weak_alias (__csqrt, csqrtl)
-#endif
diff --git a/sysdeps/generic/s_csqrtf.c b/sysdeps/generic/s_csqrtf.c
deleted file mode 100644
index b02c605a37..0000000000
--- a/sysdeps/generic/s_csqrtf.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Complex square root of float value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__csqrtf (__complex__ float x)
-{
-  __complex__ float res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALF;
-	  __imag__ res = __imag__ x;
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = icls == FP_NAN ? __nanf ("") : 0;
-	      __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = __real__ x;
-	      __imag__ res = (icls == FP_NAN
-			      ? __nanf ("") : __copysignf (0.0, __imag__ x));
-	    }
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-	}
-    }
-  else
-    {
-      if (icls == FP_ZERO)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = 0.0;
-	      __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x),
-					  __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = fabsf (__ieee754_sqrtf (__real__ x));
-	      __imag__ res = __copysignf (0.0, __imag__ x);
-	    }
-	}
-      else if (rcls == FP_ZERO)
-	{
-	  float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x));
-
-	  __real__ res = __copysignf (r, __imag__ x);
-	  __imag__ res = r;
-	}
-      else
-	{
-	  float d, r, s;
-
-	  d = __ieee754_hypotf (__real__ x, __imag__ x);
-	  /* Use the identity   2  Re res  Im res = Im x
-	     to avoid cancellation error in  d +/- Re x.  */
-	  if (__real__ x > 0)
-	    {
-	      r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x);
-	      s = (0.5f * __imag__ x) / r;
-	    }
-	  else
-	    {
-	      s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x);
-	      r = fabsf ((0.5f * __imag__ x) / s);
-	    }
-
-	  __real__ res = r;
-	  __imag__ res = __copysignf (s, __imag__ x);
-	}
-    }
-
-  return res;
-}
-#ifndef __csqrtf
-weak_alias (__csqrtf, csqrtf)
-#endif
diff --git a/sysdeps/generic/s_csqrtl.c b/sysdeps/generic/s_csqrtl.c
deleted file mode 100644
index 8e27750a04..0000000000
--- a/sysdeps/generic/s_csqrtl.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Complex square root of long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__csqrtl (__complex__ long double x)
-{
-  __complex__ long double res;
-  int rcls = fpclassify (__real__ x);
-  int icls = fpclassify (__imag__ x);
-
-  if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
-    {
-      if (icls == FP_INFINITE)
-	{
-	  __real__ res = HUGE_VALL;
-	  __imag__ res = __imag__ x;
-	}
-      else if (rcls == FP_INFINITE)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = icls == FP_NAN ? __nanl ("") : 0;
-	      __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = __real__ x;
-	      __imag__ res = (icls == FP_NAN
-			      ? __nanl ("") : __copysignl (0.0, __imag__ x));
-	    }
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-	}
-    }
-  else
-    {
-      if (icls == FP_ZERO)
-	{
-	  if (__real__ x < 0.0)
-	    {
-	      __real__ res = 0.0;
-	      __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x),
-					  __imag__ x);
-	    }
-	  else
-	    {
-	      __real__ res = fabsl (__ieee754_sqrtl (__real__ x));
-	      __imag__ res = __copysignl (0.0, __imag__ x);
-	    }
-	}
-      else if (rcls == FP_ZERO)
-	{
-	  long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
-
-	  __real__ res = __copysignl (r, __imag__ x);
-	  __imag__ res = r;
-	}
-      else
-	{
-	  long double d, r, s;
-
-	  d = __ieee754_hypotl (__real__ x, __imag__ x);
-	  /* Use the identity   2  Re res  Im res = Im x
-	     to avoid cancellation error in  d +/- Re x.  */
-	  if (__real__ x > 0)
-	    {
-	      r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x);
-	      s = (0.5L * __imag__ x) / r;
-	    }
-	  else
-	    {
-	      s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x);
-	      r = fabsl ((0.5L * __imag__ x) / s);
-	    }
-
-	  __real__ res = r;
-	  __imag__ res = __copysignl (s, __imag__ x);
-	}
-    }
-
-  return res;
-}
-weak_alias (__csqrtl, csqrtl)
diff --git a/sysdeps/generic/s_ctan.c b/sysdeps/generic/s_ctan.c
deleted file mode 100644
index 6a09fe465b..0000000000
--- a/sysdeps/generic/s_ctan.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Complex tangent function for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__ctan (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      if (__isinf (__imag__ x))
-	{
-	  __real__ res = __copysign (0.0, __real__ x);
-	  __imag__ res = __copysign (1.0, __imag__ x);
-	}
-      else if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-
-#ifdef FE_INVALID
-	  if (__isinf (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      double sin2rx, cos2rx;
-      double den;
-
-      __sincos (2.0 * __real__ x, &sin2rx, &cos2rx);
-
-      den = cos2rx + __ieee754_cosh (2.0 * __imag__ x);
-
-      __real__ res = sin2rx / den;
-      __imag__ res = __ieee754_sinh (2.0 * __imag__ x) / den;
-    }
-
-  return res;
-}
-weak_alias (__ctan, ctan)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ctan, __ctanl)
-weak_alias (__ctan, ctanl)
-#endif
diff --git a/sysdeps/generic/s_ctanf.c b/sysdeps/generic/s_ctanf.c
deleted file mode 100644
index e02971dd44..0000000000
--- a/sysdeps/generic/s_ctanf.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Complex tangent function for float.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__ctanf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      if (__isinff (__imag__ x))
-	{
-	  __real__ res = __copysignf (0.0, __real__ x);
-	  __imag__ res = __copysignf (1.0, __imag__ x);
-	}
-      else if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-
-#ifdef FE_INVALID
-	  if (__isinff (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      float sin2rx, cos2rx;
-      float den;
-
-      __sincosf (2.0 * __real__ x, &sin2rx, &cos2rx);
-
-      den = cos2rx + __ieee754_coshf (2.0 * __imag__ x);
-
-      __real__ res = sin2rx / den;
-      __imag__ res = __ieee754_sinhf (2.0 * __imag__ x) / den;
-    }
-
-  return res;
-}
-#ifndef __ctanf
-weak_alias (__ctanf, ctanf)
-#endif
diff --git a/sysdeps/generic/s_ctanh.c b/sysdeps/generic/s_ctanh.c
deleted file mode 100644
index 971cd9040c..0000000000
--- a/sysdeps/generic/s_ctanh.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Complex hyperbole tangent for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ double
-__ctanh (__complex__ double x)
-{
-  __complex__ double res;
-
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      if (__isinf (__real__ x))
-	{
-	  __real__ res = __copysign (1.0, __real__ x);
-	  __imag__ res = __copysign (0.0, __imag__ x);
-	}
-      else if (__imag__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nan ("");
-	  __imag__ res = __nan ("");
-
-#ifdef FE_INVALID
-	  if (__isinf (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      double sin2ix, cos2ix;
-      double den;
-
-      __sincos (2.0 * __imag__ x, &sin2ix, &cos2ix);
-
-      den = (__ieee754_cosh (2.0 * __real__ x) + cos2ix);
-
-      __real__ res = __ieee754_sinh (2.0 * __real__ x) / den;
-      __imag__ res = sin2ix / den;
-    }
-
-  return res;
-}
-weak_alias (__ctanh, ctanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ctanh, __ctanhl)
-weak_alias (__ctanh, ctanhl)
-#endif
diff --git a/sysdeps/generic/s_ctanhf.c b/sysdeps/generic/s_ctanhf.c
deleted file mode 100644
index cfcabab36a..0000000000
--- a/sysdeps/generic/s_ctanhf.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Complex hyperbole tangent for float.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ float
-__ctanhf (__complex__ float x)
-{
-  __complex__ float res;
-
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      if (__isinff (__real__ x))
-	{
-	  __real__ res = __copysignf (1.0, __real__ x);
-	  __imag__ res = __copysignf (0.0, __imag__ x);
-	}
-      else if (__imag__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanf ("");
-	  __imag__ res = __nanf ("");
-
-#ifdef FE_INVALID
-	  if (__isinff (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      float sin2ix, cos2ix;
-      float den;
-
-      __sincosf (2.0 * __imag__ x, &sin2ix, &cos2ix);
-
-      den = (__ieee754_coshf (2.0 * __real__ x) + cos2ix);
-
-      __real__ res = __ieee754_sinhf (2.0 * __real__ x) / den;
-      __imag__ res = sin2ix / den;
-    }
-
-  return res;
-}
-#ifndef __ctanhf
-weak_alias (__ctanhf, ctanhf)
-#endif
diff --git a/sysdeps/generic/s_ctanhl.c b/sysdeps/generic/s_ctanhl.c
deleted file mode 100644
index 7bf6b39199..0000000000
--- a/sysdeps/generic/s_ctanhl.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Complex hyperbole tangent for long double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__ctanhl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      if (__isinfl (__real__ x))
-	{
-	  __real__ res = __copysignl (1.0, __real__ x);
-	  __imag__ res = __copysignl (0.0, __imag__ x);
-	}
-      else if (__imag__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-
-#ifdef FE_INVALID
-	  if (__isinfl (__imag__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      long double sin2ix, cos2ix;
-      long double den;
-
-      __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix);
-
-      den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix);
-
-      __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
-      __imag__ res = sin2ix / den;
-    }
-
-  return res;
-}
-weak_alias (__ctanhl, ctanhl)
diff --git a/sysdeps/generic/s_ctanl.c b/sysdeps/generic/s_ctanl.c
deleted file mode 100644
index fa153e9b35..0000000000
--- a/sysdeps/generic/s_ctanl.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Complex tangent function for long double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "math_private.h"
-
-
-__complex__ long double
-__ctanl (__complex__ long double x)
-{
-  __complex__ long double res;
-
-  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
-    {
-      if (__isinfl (__imag__ x))
-	{
-	  __real__ res = __copysignl (0.0, __real__ x);
-	  __imag__ res = __copysignl (1.0, __imag__ x);
-	}
-      else if (__real__ x == 0.0)
-	{
-	  res = x;
-	}
-      else
-	{
-	  __real__ res = __nanl ("");
-	  __imag__ res = __nanl ("");
-
-#ifdef FE_INVALID
-	  if (__isinfl (__real__ x))
-	    feraiseexcept (FE_INVALID);
-#endif
-	}
-    }
-  else
-    {
-      long double sin2rx, cos2rx;
-      long double den;
-
-      __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx);
-
-      den = cos2rx + __ieee754_coshl (2.0 * __imag__ x);
-
-      __real__ res = sin2rx / den;
-      __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
-    }
-
-  return res;
-}
-weak_alias (__ctanl, ctanl)
diff --git a/sysdeps/generic/s_erfl.c b/sysdeps/generic/s_erfl.c
deleted file mode 100644
index f329d58809..0000000000
--- a/sysdeps/generic/s_erfl.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__erfl (long double x)
-{
-  fputs ("__erfl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-weak_alias (__erfl, erfl)
-
-stub_warning (erfl)
-
-long double
-__erfcl (long double x)
-{
-  fputs ("__erfcl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-weak_alias (__erfcl, erfcl)
-
-stub_warning (erfcl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/s_expm1l.c b/sysdeps/generic/s_expm1l.c
deleted file mode 100644
index b69d6aeb97..0000000000
--- a/sysdeps/generic/s_expm1l.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__expm1l (long double x)
-{
-  fputs ("__expm1l not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-libm_hidden_def (__expm1l)
-weak_alias (__expm1l, expm1l)
-
-stub_warning (expm1l)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/s_fdim.c b/sysdeps/generic/s_fdim.c
deleted file mode 100644
index 5804e631c3..0000000000
--- a/sysdeps/generic/s_fdim.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Return positive difference between arguments.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-double
-__fdim (double x, double y)
-{
-  int clsx = fpclassify (x);
-  int clsy = fpclassify (y);
-
-  if (clsx == FP_NAN || clsy == FP_NAN
-      || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
-    /* Raise invalid flag.  */
-    return x - y;
-
-  return x <= y ? 0 : x - y;
-}
-weak_alias (__fdim, fdim)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fdim, __fdiml)
-weak_alias (__fdim, fdiml)
-#endif
diff --git a/sysdeps/generic/s_fdimf.c b/sysdeps/generic/s_fdimf.c
deleted file mode 100644
index 2f3ce303ae..0000000000
--- a/sysdeps/generic/s_fdimf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Return positive difference between arguments.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-float
-__fdimf (float x, float y)
-{
-  int clsx = fpclassify (x);
-  int clsy = fpclassify (y);
-
-  if (clsx == FP_NAN || clsy == FP_NAN
-      || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
-    /* Raise invalid flag.  */
-    return x - y;
-
-  return x <= y ? 0 : x - y;
-}
-weak_alias (__fdimf, fdimf)
diff --git a/sysdeps/generic/s_fdiml.c b/sysdeps/generic/s_fdiml.c
deleted file mode 100644
index 70246bafbd..0000000000
--- a/sysdeps/generic/s_fdiml.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Return positive difference between arguments.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-long double
-__fdiml (long double x, long double y)
-{
-  int clsx = fpclassify (x);
-  int clsy = fpclassify (y);
-
-  if (clsx == FP_NAN || clsy == FP_NAN
-      || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
-    /* Raise invalid flag.  */
-    return x - y;
-
-  return x <= y ? 0 : x - y;
-}
-weak_alias (__fdiml, fdiml)
diff --git a/sysdeps/generic/s_fma.c b/sysdeps/generic/s_fma.c
deleted file mode 100644
index e5ff5a7228..0000000000
--- a/sysdeps/generic/s_fma.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Compute x * y + z as ternary operation.
-   Copyright (C) 1997, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-double
-__fma (double x, double y, double z)
-{
-  return (x * y) + z;
-}
-weak_alias (__fma, fma)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fma, __fmal)
-weak_alias (__fmal, fmal)
-#endif
diff --git a/sysdeps/generic/s_fmaf.c b/sysdeps/generic/s_fmaf.c
deleted file mode 100644
index caa7f3afe8..0000000000
--- a/sysdeps/generic/s_fmaf.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Compute x * y + z as ternary operation.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-float
-__fmaf (float x, float y, float z)
-{
-  return (x * y) + z;
-}
-weak_alias (__fmaf, fmaf)
diff --git a/sysdeps/generic/s_fmal.c b/sysdeps/generic/s_fmal.c
deleted file mode 100644
index b89e88b9a3..0000000000
--- a/sysdeps/generic/s_fmal.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Compute x * y + z as ternary operation.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-long double
-__fmal (long double x, long double y, long double z)
-{
-  return (x * y) + z;
-}
-weak_alias (__fmal, fmal)
diff --git a/sysdeps/generic/s_fmax.c b/sysdeps/generic/s_fmax.c
deleted file mode 100644
index f93e14f28c..0000000000
--- a/sysdeps/generic/s_fmax.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Return maximum numeric value of X and Y.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-
-double
-__fmax (double x, double y)
-{
-  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fmax, fmax)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fmax, __fmaxl)
-weak_alias (__fmax, fmaxl)
-#endif
diff --git a/sysdeps/generic/s_fmaxf.c b/sysdeps/generic/s_fmaxf.c
deleted file mode 100644
index 6f368e18b0..0000000000
--- a/sysdeps/generic/s_fmaxf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Return maximum numeric value of X and Y.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-
-float
-__fmaxf (float x, float y)
-{
-  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fmaxf, fmaxf)
diff --git a/sysdeps/generic/s_fmaxl.c b/sysdeps/generic/s_fmaxl.c
deleted file mode 100644
index 68c7060f42..0000000000
--- a/sysdeps/generic/s_fmaxl.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Return maximum numeric value of X and Y.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-
-long double
-__fmaxl (long double x, long double y)
-{
-  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fmaxl, fmaxl)
diff --git a/sysdeps/generic/s_fmin.c b/sysdeps/generic/s_fmin.c
deleted file mode 100644
index 78f02da74a..0000000000
--- a/sysdeps/generic/s_fmin.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Return minimum numeric value of X and Y.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-
-double
-__fmin (double x, double y)
-{
-  return (islessequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fmin, fmin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fmin, __fminl)
-weak_alias (__fmin, fminl)
-#endif
diff --git a/sysdeps/generic/s_fminf.c b/sysdeps/generic/s_fminf.c
deleted file mode 100644
index d6aa9ccf62..0000000000
--- a/sysdeps/generic/s_fminf.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Return minimum numeric value of X and Y.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-
-float
-__fminf (float x, float y)
-{
-  return (islessequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fminf, fminf)
diff --git a/sysdeps/generic/s_fminl.c b/sysdeps/generic/s_fminl.c
deleted file mode 100644
index 5c1610aa85..0000000000
--- a/sysdeps/generic/s_fminl.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Return minimum numeric value of X and Y.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-
-long double
-__fminl (long double x, long double y)
-{
-  return (islessequal (x, y) || isnan (y)) ? x : y;
-}
-weak_alias (__fminl, fminl)
diff --git a/sysdeps/generic/s_ldexp.c b/sysdeps/generic/s_ldexp.c
deleted file mode 100644
index 12c336fad4..0000000000
--- a/sysdeps/generic/s_ldexp.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* @(#)s_ldexp.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-#include <errno.h>
-
-#ifdef __STDC__
-	double __ldexp(double value, int exp)
-#else
-	double __ldexp(value, exp)
-	double value; int exp;
-#endif
-{
-	if(!__finite(value)||value==0.0) return value;
-	value = __scalbn(value,exp);
-	if(!__finite(value)||value==0.0) __set_errno (ERANGE);
-	return value;
-}
-weak_alias (__ldexp, ldexp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ldexp, __ldexpl)
-weak_alias (__ldexp, ldexpl)
-#endif
diff --git a/sysdeps/generic/s_ldexpf.c b/sysdeps/generic/s_ldexpf.c
deleted file mode 100644
index 631db422a3..0000000000
--- a/sysdeps/generic/s_ldexpf.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* s_ldexpf.c -- float version of s_ldexp.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-#include <errno.h>
-
-#ifdef __STDC__
-	float __ldexpf(float value, int exp)
-#else
-	float __ldexpf(value, exp)
-	float value; int exp;
-#endif
-{
-	if(!__finitef(value)||value==(float)0.0) return value;
-	value = __scalbnf(value,exp);
-	if(!__finitef(value)||value==(float)0.0) __set_errno (ERANGE);
-	return value;
-}
-INTDEF(__ldexpf)
-weak_alias (__ldexpf, ldexpf)
diff --git a/sysdeps/generic/s_ldexpl.c b/sysdeps/generic/s_ldexpl.c
deleted file mode 100644
index 123a6b3b58..0000000000
--- a/sysdeps/generic/s_ldexpl.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* s_ldexpl.c -- long double version of s_ldexp.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-#include <errno.h>
-
-#ifdef __STDC__
-	long double __ldexpl(long double value, int exp)
-#else
-	long double __ldexpl(value, exp)
-	long double value; int exp;
-#endif
-{
-	if(!__finitel(value)||value==0.0) return value;
-	value = __scalbnl(value,exp);
-	if(!__finitel(value)||value==0.0) __set_errno (ERANGE);
-	return value;
-}
-weak_alias (__ldexpl, ldexpl)
diff --git a/sysdeps/generic/s_log1pl.c b/sysdeps/generic/s_log1pl.c
deleted file mode 100644
index e5db9078bf..0000000000
--- a/sysdeps/generic/s_log1pl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__log1pl (long double x)
-{
-  fputs ("__log1pl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-weak_alias (__log1pl, log1pl)
-
-stub_warning (log1pl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/s_nan.c b/sysdeps/generic/s_nan.c
deleted file mode 100644
index 9b2c50558b..0000000000
--- a/sysdeps/generic/s_nan.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Return quiet nan.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ieee754.h>
-
-
-double
-__nan (const char *tagp)
-{
-  if (tagp[0] != '\0')
-    {
-      char buf[6 + strlen (tagp)];
-      sprintf (buf, "NAN(%s)", tagp);
-      return strtod (buf, NULL);
-    }
-
-  return NAN;
-}
-weak_alias (__nan, nan)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__nan, __nanl)
-weak_alias (__nan, nanl)
-#endif
diff --git a/sysdeps/generic/s_nanf.c b/sysdeps/generic/s_nanf.c
deleted file mode 100644
index 2e1b1eb911..0000000000
--- a/sysdeps/generic/s_nanf.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Return quiet nan.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ieee754.h>
-
-
-float
-__nanf (const char *tagp)
-{
-  if (tagp[0] != '\0')
-    {
-      char buf[6 + strlen (tagp)];
-      sprintf (buf, "NAN(%s)", tagp);
-      return strtof (buf, NULL);
-    }
-
-  return NAN;
-}
-weak_alias (__nanf, nanf)
diff --git a/sysdeps/generic/s_nanl.c b/sysdeps/generic/s_nanl.c
deleted file mode 100644
index 9709b92383..0000000000
--- a/sysdeps/generic/s_nanl.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Return quiet nan.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ieee754.h>
-
-
-long double
-__nanl (const char *tagp)
-{
-  if (tagp[0] != '\0')
-    {
-      char buf[6 + strlen (tagp)];
-      sprintf (buf, "NAN(%s)", tagp);
-      return strtold (buf, NULL);
-    }
-
-  return NAN;
-}
-weak_alias (__nanl, nanl)
diff --git a/sysdeps/generic/s_nextafter.c b/sysdeps/generic/s_nextafter.c
deleted file mode 100644
index c2d799d5df..0000000000
--- a/sysdeps/generic/s_nextafter.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* @(#)s_nextafter.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp $";
-#endif
-
-/* IEEE functions
- *	nextafter(x,y)
- *	return the next machine floating-point number of x in the
- *	direction toward y.
- *   Special cases:
- */
-
-/* Ugly hack so that the aliasing works.  */
-#define __nexttoward __internal___nexttoward
-#define nexttoward __internal_nexttoward
-
-#include "math.h"
-#include "math_private.h"
-#include <float.h>
-
-#ifdef __STDC__
-	double __nextafter(double x, double y)
-#else
-	double __nextafter(x,y)
-	double x,y;
-#endif
-{
-	int32_t hx,hy,ix,iy;
-	u_int32_t lx,ly;
-
-	EXTRACT_WORDS(hx,lx,x);
-	EXTRACT_WORDS(hy,ly,y);
-	ix = hx&0x7fffffff;		/* |x| */
-	iy = hy&0x7fffffff;		/* |y| */
-
-	if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
-	   ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0))     /* y is nan */
-	   return x+y;
-	if(x==y) return y;		/* x=y, return y */
-	if((ix|lx)==0) {			/* x == 0 */
-	    INSERT_WORDS(x,hy&0x80000000,1);	/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
-	}
-	if(hx>=0) {				/* x > 0 */
-	    if(hx>hy||((hx==hy)&&(lx>ly))) {	/* x > y, x -= ulp */
-		if(lx==0) hx -= 1;
-		lx -= 1;
-	    } else {				/* x < y, x += ulp */
-		lx += 1;
-		if(lx==0) hx += 1;
-	    }
-	} else {				/* x < 0 */
-	    if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */
-		if(lx==0) hx -= 1;
-		lx -= 1;
-	    } else {				/* x > y, x += ulp */
-		lx += 1;
-		if(lx==0) hx += 1;
-	    }
-	}
-	hy = hx&0x7ff00000;
-	if(hy>=0x7ff00000) {
-	  x = x+x;	/* overflow  */
-	  if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
-	    asm ("" : "=m"(x) : "m"(x));
-	  return x;	/* overflow  */
-	}
-	if(hy<0x00100000) {		/* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        INSERT_WORDS(y,hx,lx);
-		return y;
-	    }
-	}
-	INSERT_WORDS(x,hx,lx);
-	return x;
-}
-weak_alias (__nextafter, nextafter)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__nextafter, __nextafterl)
-weak_alias (__nextafter, nextafterl)
-strong_alias (__nextafter, __nexttowardl)
-weak_alias (__nexttowardl, nexttowardl)
-#undef __nexttoward
-strong_alias (__nextafter, __nexttoward)
-#undef nexttoward
-weak_alias (__nextafter, nexttoward)
-#endif
diff --git a/sysdeps/generic/s_nexttowardf.c b/sysdeps/generic/s_nexttowardf.c
deleted file mode 100644
index 4f502c210e..0000000000
--- a/sysdeps/generic/s_nexttowardf.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Single precision version of nexttoward.c.
-   Conversion to IEEE single float by Jakub Jelinek, jj@ultra.linux.cz. */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/* IEEE functions
- *	nexttowardf(x,y)
- *	return the next machine floating-point number of x in the
- *	direction toward y.
- * This is for machines which use the same binary type for double and
- * long double.
- *   Special cases:
- */
-
-#include "math.h"
-#include "math_private.h"
-#include <float.h>
-
-#ifdef __STDC__
-	float __nexttowardf(float x, long double y)
-#else
-	float __nexttowardf(x,y)
-	float x;
-	long double y;
-#endif
-{
-	int32_t hx,hy,ix,iy;
-	u_int32_t ly;
-
-	GET_FLOAT_WORD(hx,x);
-	EXTRACT_WORDS(hy,ly,y);
-	ix = hx&0x7fffffff;		/* |x| */
-	iy = hy&0x7fffffff;		/* |y| */
-
-	if((ix>0x7f800000) ||				   /* x is nan */
-	   ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0))    /* y is nan */
-	   return x+y;
-	if((long double) x==y) return y;	/* x=y, return y */
-	if(ix==0) {				/* x == 0 */
-	    float x2;
-	    SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/
-	    x2 = x*x;
-	    if(x2==x) return x2; else return x; /* raise underflow flag */
-	}
-	if(hx>=0) {				/* x > 0 */
-	    if(hy<0||(ix>>23)>(iy>>20)-0x380
-	       || ((ix>>23)==(iy>>20)-0x380
-		   && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff)))	/* x > y, x -= ulp */
-		hx -= 1;
-	    else				/* x < y, x += ulp */
-		hx += 1;
-	} else {				/* x < 0 */
-	    if(hy>=0||(ix>>23)>(iy>>20)-0x380
-	       || ((ix>>23)==(iy>>20)-0x380
-		   && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff)))	/* x < y, x -= ulp */
-		hx -= 1;
-	    else				/* x > y, x += ulp */
-		hx += 1;
-	}
-	hy = hx&0x7f800000;
-	if(hy>=0x7f800000) {
-	  x = x+x;	/* overflow  */
-	  if (FLT_EVAL_METHOD != 0)
-	    /* Force conversion to float.  */
-	    asm ("" : "=m"(x) : "m"(x));
-	  return x;
-	}
-	if(hy<0x00800000) {		/* underflow */
-	    float x2 = x*x;
-	    if(x2!=x) {		/* raise underflow flag */
-		SET_FLOAT_WORD(x2,hx);
-		return x2;
-	    }
-	}
-	SET_FLOAT_WORD(x,hx);
-	return x;
-}
-weak_alias (__nexttowardf, nexttowardf)
diff --git a/sysdeps/generic/s_nexttowardl.c b/sysdeps/generic/s_nexttowardl.c
deleted file mode 100644
index 73c3610fc1..0000000000
--- a/sysdeps/generic/s_nexttowardl.c
+++ /dev/null
@@ -1 +0,0 @@
-/* This function is the same as nextafterl so we use an alias there.  */
diff --git a/sysdeps/generic/s_significand.c b/sysdeps/generic/s_significand.c
deleted file mode 100644
index 4ab078c473..0000000000
--- a/sysdeps/generic/s_significand.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* @(#)s_signif.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_significand.c,v 1.6 1995/05/10 20:48:11 jtc Exp $";
-#endif
-
-/*
- * significand(x) computes just
- * 	scalb(x, (double) -ilogb(x)),
- * for exercising the fraction-part(F) IEEE 754-1985 test vector.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __significand(double x)
-#else
-	double __significand(x)
-	double x;
-#endif
-{
-	return __ieee754_scalb(x,(double) -ilogb(x));
-}
-weak_alias (__significand, significand)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__significand, __significandl)
-weak_alias (__significand, significandl)
-#endif
diff --git a/sysdeps/generic/s_significandf.c b/sysdeps/generic/s_significandf.c
deleted file mode 100644
index 2893a4e1b7..0000000000
--- a/sysdeps/generic/s_significandf.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* s_significandf.c -- float version of s_significand.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_significandf.c,v 1.3 1995/05/10 20:48:13 jtc Exp $";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __significandf(float x)
-#else
-	float __significandf(x)
-	float x;
-#endif
-{
-	return __ieee754_scalbf(x,(float) -ilogbf(x));
-}
-weak_alias (__significandf, significandf)
diff --git a/sysdeps/generic/s_significandl.c b/sysdeps/generic/s_significandl.c
deleted file mode 100644
index d84e806fdc..0000000000
--- a/sysdeps/generic/s_significandl.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* s_significandl.c -- long double version of s_significand.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * significandl(x) computes just
- * 	scalbl(x, (long double) -ilogbl(x)),
- * for exercising the fraction-part(F) IEEE 754-1985 test vector.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __significandl(long double x)
-#else
-	long double __significandl(x)
-	long double x;
-#endif
-{
-	return __ieee754_scalbl(x,(long double) -ilogbl(x));
-}
-weak_alias (__significandl, significandl)
diff --git a/sysdeps/generic/s_tanhl.c b/sysdeps/generic/s_tanhl.c
deleted file mode 100644
index bc9a2d7f48..0000000000
--- a/sysdeps/generic/s_tanhl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__tanhl(long double x)
-{
-  fputs ("__tanhl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-weak_alias (__tanhl, tanhl)
-stub_warning (tanhl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sbrk.c b/sysdeps/generic/sbrk.c
deleted file mode 100644
index 0df60076cc..0000000000
--- a/sysdeps/generic/sbrk.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2000,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-#include <errno.h>
-
-/* Defined in brk.c.  */
-extern void *__curbrk;
-extern int __brk (void *addr);
-
-/* Defined in init-first.c.  */
-extern int __libc_multiple_libcs attribute_hidden;
-
-/* Extend the process's data space by INCREMENT.
-   If INCREMENT is negative, shrink data space by - INCREMENT.
-   Return start of new space allocated, or -1 for errors.  */
-void *
-__sbrk (intptr_t increment)
-{
-  void *oldbrk;
-
-  /* If this is not part of the dynamic library or the library is used
-     via dynamic loading in a statically linked program update
-     __curbrk from the kernel's brk value.  That way two separate
-     instances of __brk and __sbrk can share the heap, returning
-     interleaved pieces of it.  */
-  if (__curbrk == NULL || __libc_multiple_libcs)
-    if (__brk (0) < 0)		/* Initialize the break.  */
-      return (void *) -1;
-
-  if (increment == 0)
-    return __curbrk;
-
-  oldbrk = __curbrk;
-  if (__brk (oldbrk + increment) < 0)
-    return (void *) -1;
-
-  return oldbrk;
-}
-libc_hidden_def (__sbrk)
-weak_alias (__sbrk, sbrk)
diff --git a/sysdeps/generic/scandir64.c b/sysdeps/generic/scandir64.c
deleted file mode 100644
index 68608de9a0..0000000000
--- a/sysdeps/generic/scandir64.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <dirent.h>
-
-#define SCANDIR scandir64
-#define READDIR __readdir64
-#define DIRENT_TYPE struct dirent64
-
-int scandir64 (__const char *__restrict __dir,
-	       struct dirent64 ***__restrict __namelist,
-	       int (*__selector) (__const struct dirent64 *),
-	       int (*__cmp) (__const void *, __const void *));
-
-#include <dirent/scandir.c>
diff --git a/sysdeps/generic/sched_getaffinity.c b/sysdeps/generic/sched_getaffinity.c
deleted file mode 100644
index b2e452f879..0000000000
--- a/sysdeps/generic/sched_getaffinity.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sched.h>
-#include <sys/types.h>
-
-
-/* Retrieve the CPU affinity mask for a particular process.  */
-int
-sched_getaffinity (pid, cpusetsize, cpuset)
-     pid_t pid;
-     size_t cpusetsize;
-     cpu_set_t *cpuset;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_getaffinity)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_getp.c b/sysdeps/generic/sched_getp.c
deleted file mode 100644
index 1ca77893f4..0000000000
--- a/sysdeps/generic/sched_getp.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sched.h>
-
-
-/* Retrieve scheduling parameters for a particular process.  */
-int
-__sched_getparam (pid_t pid, struct sched_param *param)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_getparam)
-
-weak_alias (__sched_getparam, sched_getparam)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_gets.c b/sysdeps/generic/sched_gets.c
deleted file mode 100644
index 479b913f32..0000000000
--- a/sysdeps/generic/sched_gets.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sched.h>
-#include <sys/types.h>
-
-
-/* Retrieve scheduling algorithm for a particular purpose.  */
-int
-__sched_getscheduler (pid_t pid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_getscheduler)
-
-weak_alias (__sched_getscheduler, sched_getscheduler)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_primax.c b/sysdeps/generic/sched_primax.c
deleted file mode 100644
index 4b3c1cbe67..0000000000
--- a/sysdeps/generic/sched_primax.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sched.h>
-
-
-/* Get maximum priority value for a scheduler.  */
-int
-__sched_get_priority_max (int algorithm)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_get_priority_max)
-
-weak_alias (__sched_get_priority_max, sched_get_priority_max)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_primin.c b/sysdeps/generic/sched_primin.c
deleted file mode 100644
index 813b8f63ca..0000000000
--- a/sysdeps/generic/sched_primin.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sched.h>
-
-
-/* Get minimum priority value for a scheduler.  */
-int
-__sched_get_priority_min (int algorithm)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_get_priority_min)
-
-weak_alias (__sched_get_priority_min, sched_get_priority_min)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_rr_gi.c b/sysdeps/generic/sched_rr_gi.c
deleted file mode 100644
index f8fec63617..0000000000
--- a/sysdeps/generic/sched_rr_gi.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sched.h>
-#include <sys/types.h>
-
-
-/* Get the SCHED_RR interval for the named process.  */
-int
-__sched_rr_get_interval (pid_t pid, struct timespec *t)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_rr_get_interval)
-
-weak_alias (__sched_rr_get_interval, sched_rr_get_interval)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_setaffinity.c b/sysdeps/generic/sched_setaffinity.c
deleted file mode 100644
index 652163db85..0000000000
--- a/sysdeps/generic/sched_setaffinity.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sched.h>
-
-
-/* Retrieve the CPU affinity mask for a particular process.  */
-int
-sched_setaffinity (pid, cpusetsize, cpuset)
-     pid_t pid;
-     size_t cpusetsize;
-     const cpu_set_t *cpuset;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_setaffinity)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_setp.c b/sysdeps/generic/sched_setp.c
deleted file mode 100644
index cc451fc131..0000000000
--- a/sysdeps/generic/sched_setp.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sched.h>
-
-
-/* Set scheduling parameters for a process.  */
-int
-__sched_setparam (pid_t pid, const struct sched_param *param)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_setparam)
-
-weak_alias (__sched_setparam, sched_setparam)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_sets.c b/sysdeps/generic/sched_sets.c
deleted file mode 100644
index 631cac228b..0000000000
--- a/sysdeps/generic/sched_sets.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sched.h>
-#include <sys/types.h>
-
-
-/* Set scheduling algorithm and/or parameters for a process.  */
-int
-__sched_setscheduler (pid_t pid, int policy, const struct sched_param *param)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__sched_setscheduler)
-stub_warning (sched_setscheduler)
-
-weak_alias (__sched_setscheduler, sched_setscheduler)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sched_yield.c b/sysdeps/generic/sched_yield.c
deleted file mode 100644
index ce41ce9b6f..0000000000
--- a/sysdeps/generic/sched_yield.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sched.h>
-
-
-/* Yield the processor.  */
-int
-__sched_yield (void)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sched_yield)
-
-weak_alias (__sched_yield, sched_yield)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/seekdir.c b/sysdeps/generic/seekdir.c
deleted file mode 100644
index c3828cde0f..0000000000
--- a/sysdeps/generic/seekdir.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <stddef.h>
-#include <dirent.h>
-
-/* Seek to position POS in DIRP.  */
-void
-seekdir (dirp, pos)
-     DIR *dirp;
-     long int pos;
-{
-  if (dirp == NULL)
-    {
-      __set_errno (EINVAL);
-      return;
-    }
-
-  __set_errno (ENOSYS);
-}
-
-
-stub_warning (seekdir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c
deleted file mode 100644
index f141fff661..0000000000
--- a/sysdeps/generic/segfault.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Catch segmentation faults and print backtrace.
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <alloca.h>
-#include <ctype.h>
-#include <errno.h>
-#include <execinfo.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdio-common/_itoa.h>
-#include <ldsodefs.h>
-
-#include <bp-checks.h>
-
-/* This file defines macros to access the content of the sigcontext element
-   passed up by the signal handler.  */
-#include <sigcontextinfo.h>
-
-/* Get code to possibly dump the content of all registers.  */
-#include <register-dump.h>
-
-/* We'll use tis a lot.  */
-#define WRITE_STRING(s) write (fd, s, strlen (s))
-
-/* Name of the output file.  */
-static const char *fname;
-
-
-/* We better should not use `strerror' since it can call far too many
-   other functions which might fail.  Do it here ourselves.  */
-static void
-write_strsignal (int fd, int signal)
-{
-  if (signal < 0 || signal >= _NSIG || _sys_siglist[signal] == NULL)
-    {
-      char buf[30];
-      char *ptr = _itoa_word (signal, &buf[sizeof (buf)], 10, 0);
-      WRITE_STRING ("signal ");
-      write (fd, buf, &buf[sizeof (buf)] - ptr);
-    }
-  else
-    WRITE_STRING (_sys_siglist[signal]);
-}
-
-
-/* This function is called when a segmentation fault is caught.  The system
-   is in an instable state now.  This means especially that malloc() might
-   not work anymore.  */
-static void
-catch_segfault (int signal, SIGCONTEXT ctx)
-{
-  int fd, cnt, i;
-  void **arr;
-  struct sigaction sa;
-  uintptr_t pc;
-
-  /* This is the name of the file we are writing to.  If none is given
-     or we cannot write to this file write to stderr.  */
-  fd = 2;
-  if (fname != NULL)
-    {
-      fd = open (fname, O_TRUNC | O_WRONLY | O_CREAT, 0666);
-      if (fd == -1)
-	fd = 2;
-    }
-
-  WRITE_STRING ("*** ");
-  write_strsignal (fd, signal);
-  WRITE_STRING ("\n");
-
-#ifdef REGISTER_DUMP
-  REGISTER_DUMP;
-#endif
-
-  WRITE_STRING ("\nBacktrace:\n");
-
-  /* Get the backtrace.  */
-  arr = alloca (256 * sizeof (void *));
-  cnt = backtrace (arr, 256);
-
-  /* Now try to locate the PC from signal context in the backtrace.
-     Normally it will be found at arr[2], but it might appear later
-     if there were some signal handler wrappers.  Allow a few bytes
-     difference to cope with as many arches as possible.  */
-  pc = (uintptr_t) GET_PC (ctx);
-  for (i = 0; i < cnt; ++i)
-    if ((uintptr_t) arr[i] >= pc - 16 && (uintptr_t) arr[i] <= pc + 16)
-      break;
-
-  /* If we haven't found it, better dump full backtrace even including
-     the signal handler frames instead of not dumping anything.  */
-  if (i == cnt)
-    i = 0;
-
-  /* Now generate nicely formatted output.  */
-  __backtrace_symbols_fd (arr + i, cnt - i, fd);
-
-#ifdef HAVE_PROC_SELF
-  /* Now the link map.  */
-  int mapfd = open ("/proc/self/maps", O_RDONLY);
-  if (mapfd != -1)
-    {
-      write (fd, "\nMemory map:\n\n", 14);
-
-      char buf[256];
-      ssize_t n;
-
-      while ((n = TEMP_FAILURE_RETRY (read (mapfd, buf, sizeof (buf)))) > 0)
-	TEMP_FAILURE_RETRY (write (fd, buf, n));
-
-      close (mapfd);
-    }
-#endif
-
-  /* Pass on the signal (so that a core file is produced).  */
-  sa.sa_handler = SIG_DFL;
-  sigemptyset (&sa.sa_mask);
-  sa.sa_flags = 0;
-  sigaction (signal, &sa, NULL);
-  raise (signal);
-}
-
-
-static void
-__attribute__ ((constructor))
-install_handler (void)
-{
-  struct sigaction sa;
-  const char *sigs = getenv ("SEGFAULT_SIGNALS");
-  const char *name;
-
-  sa.sa_handler = (void *) catch_segfault;
-  sigemptyset (&sa.sa_mask);
-  sa.sa_flags = SA_RESTART;
-
-  /* Maybe we are expected to use an alternative stack.  */
-  if (getenv ("SEGFAULT_USE_ALTSTACK") != 0)
-    {
-      void *stack_mem = malloc (2 * SIGSTKSZ);
-      struct sigaltstack ss;
-
-      if (stack_mem != NULL)
-	{
-	  ss.ss_sp = stack_mem;
-	  ss.ss_flags = 0;
-	  ss.ss_size = 2 * SIGSTKSZ;
-
-	  if (sigaltstack (&ss, NULL) == 0)
-	    sa.sa_flags |= SA_ONSTACK;
-	}
-    }
-
-  if (sigs == NULL)
-    sigaction (SIGSEGV, &sa, NULL);
-  else if (sigs[0] == '\0')
-    /* Do not do anything.  */
-    return;
-  else
-    {
-      const char *where;
-      int all = __strcasecmp (sigs, "all") == 0;
-
-#define INSTALL_FOR_SIG(sig, name) \
-      where = __strcasestr (sigs, name);				      \
-      if (all || (where != NULL						      \
-		  && (where == sigs || !isalnum (where[-1]))		      \
-		  && !isalnum (where[sizeof (name) - 1])))		      \
-	sigaction (sig, &sa, NULL);
-
-      INSTALL_FOR_SIG (SIGSEGV, "segv");
-      INSTALL_FOR_SIG (SIGILL, "ill");
-#ifdef SIGBUS
-      INSTALL_FOR_SIG (SIGBUS, "bus");
-#endif
-#ifdef SIGSTKFLT
-      INSTALL_FOR_SIG (SIGSTKFLT, "stkflt");
-#endif
-      INSTALL_FOR_SIG (SIGABRT, "abrt");
-      INSTALL_FOR_SIG (SIGFPE, "fpe");
-    }
-
-  /* Preserve the output file name if there is any given.  */
-  name = getenv ("SEGFAULT_OUTPUT_NAME");
-  if (name != NULL && name[0] != '\0')
-    {
-      int ret = access (name, R_OK | W_OK);
-
-      if (ret == 0 || (ret == -1 && errno == ENOENT))
-	fname = __strdup (name);
-    }
-}
diff --git a/sysdeps/generic/select.c b/sysdeps/generic/select.c
deleted file mode 100644
index 124f26aff7..0000000000
--- a/sysdeps/generic/select.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <errno.h>
-
-/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
-   readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
-   (if not NULL) for exceptional conditions.  If TIMEOUT is not NULL, time out
-   after waiting the interval specified therein.  Returns the number of ready
-   descriptors, or -1 for errors.  */
-int
-__select (nfds, readfds, writefds, exceptfds, timeout)
-     int nfds;
-     fd_set *readfds;
-     fd_set *writefds;
-     fd_set *exceptfds;
-     struct timeval *timeout;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__select)
-stub_warning (select)
-
-weak_alias (__select, select)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/semctl.c b/sysdeps/generic/semctl.c
deleted file mode 100644
index 28a8f37387..0000000000
--- a/sysdeps/generic/semctl.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/sem.h>
-#include <errno.h>
-
-/* Return identifier for array of NSEMS semaphores associated with
-   KEY.  */
-
-int
-semctl (int semid, int semnum, int cmd, ...)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (semctl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/semget.c b/sysdeps/generic/semget.c
deleted file mode 100644
index a9db299000..0000000000
--- a/sysdeps/generic/semget.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/sem.h>
-#include <errno.h>
-
-/* Return identifier for array of NSEMS semaphores associated with
-   KEY.  */
-
-int
-semget (key, nsems, semflg)
-     key_t key;
-     int nsems;
-     int semflg;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (semget)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/semop.c b/sysdeps/generic/semop.c
deleted file mode 100644
index 6ebcb98ba9..0000000000
--- a/sysdeps/generic/semop.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/sem.h>
-#include <errno.h>
-
-/* Perform user-defined atomical operation of array of semaphores.  */
-
-int
-semop (semid, sops, nsops)
-     int semid;
-     struct sembuf *sops;
-     size_t nsops;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (semop)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/semtimedop.c b/sysdeps/generic/semtimedop.c
deleted file mode 100644
index 82c5682655..0000000000
--- a/sysdeps/generic/semtimedop.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/sem.h>
-#include <errno.h>
-
-/* Perform user-defined atomical operation of array of semaphores.  */
-
-int
-semtimedop (semid, sops, nsops, timeout)
-     int semid;
-     struct sembuf *sops;
-     size_t nsops;
-     const struct timespec *timeout;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (semtimedop)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/send.c b/sysdeps/generic/send.c
deleted file mode 100644
index 7f94fbb093..0000000000
--- a/sysdeps/generic/send.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2001,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Send N bytes of BUF to socket FD.  Returns the number sent or -1.  */
-ssize_t
-__send (fd, buf, n, flags)
-     int fd;
-     __const __ptr_t buf;
-     size_t n;
-     int flags;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__send)
-weak_alias (__send, send)
-
-stub_warning (send)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sendfile.c b/sysdeps/generic/sendfile.c
deleted file mode 100644
index 98dc9a814d..0000000000
--- a/sysdeps/generic/sendfile.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* sendfile -- copy data directly from one file descriptor to another
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/sendfile.h>
-#include <errno.h>
-
-/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
-   descriptor OUT_FD.  */
-ssize_t
-sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sendfile)
-
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sendfile64.c b/sysdeps/generic/sendfile64.c
deleted file mode 100644
index 76b961e22a..0000000000
--- a/sysdeps/generic/sendfile64.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* sendfile -- copy data directly from one file descriptor to another
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/sendfile.h>
-#include <errno.h>
-
-/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
-   descriptor OUT_FD.  */
-ssize_t
-sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sendfile64)
-
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sendmsg.c b/sysdeps/generic/sendmsg.c
deleted file mode 100644
index a4a3cea950..0000000000
--- a/sysdeps/generic/sendmsg.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2001,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Send a message described MESSAGE on socket FD.
-   Returns the number of bytes sent, or -1 for errors.  */
-ssize_t
-__sendmsg (fd, message, flags)
-     int fd;
-     const struct msghdr *message;
-     int flags;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__sendmsg, sendmsg)
-
-stub_warning (sendmsg)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sendto.c b/sysdeps/generic/sendto.c
deleted file mode 100644
index 823c9dd1c7..0000000000
--- a/sysdeps/generic/sendto.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,2001,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
-   ADDR_LEN bytes long).  Returns the number sent, or -1 for errors.  */
-ssize_t
-__sendto (fd, buf, n, flags, addr, addr_len)
-     int fd;
-     __const __ptr_t buf;
-     size_t n;
-     int flags;
-     __CONST_SOCKADDR_ARG addr;
-     socklen_t addr_len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__sendto, sendto)
-
-stub_warning (sendto)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setcontext.c b/sysdeps/generic/setcontext.c
deleted file mode 100644
index 5841e20317..0000000000
--- a/sysdeps/generic/setcontext.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <ucontext.h>
-
-int
-setcontext (ucp)
-     const ucontext_t *ucp;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (setcontext)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setdomain.c b/sysdeps/generic/setdomain.c
deleted file mode 100644
index 4d9cbb7cac..0000000000
--- a/sysdeps/generic/setdomain.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the name of the current YP domain to NAME, which is LEN bytes long.
-   This call is restricted to the super-user.  */
-int
-setdomainname (name, len)
-     const char *name;
-     size_t len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (setdomainname)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setegid.c b/sysdeps/generic/setegid.c
deleted file mode 100644
index 5b5e2cf4bb..0000000000
--- a/sysdeps/generic/setegid.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1992,1994,1995,1996,1997,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the effective group ID of the calling process to GID.  */
-int
-setegid (gid)
-     __gid_t gid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (setegid)
-stub_warning (setegid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
deleted file mode 100644
index 48aaecffe0..0000000000
--- a/sysdeps/generic/setenv.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/* Copyright (C) 1992,1995-2001,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <errno.h>
-#if !_LIBC
-# if !defined errno && !defined HAVE_ERRNO_DECL
-extern int errno;
-# endif
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#if _LIBC || HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#if _LIBC || HAVE_STRING_H
-# include <string.h>
-#endif
-#if _LIBC || HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if !_LIBC
-# define __environ	environ
-# ifndef HAVE_ENVIRON_DECL
-extern char **environ;
-# endif
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of `environ'.  */
-# include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK	__libc_lock_lock (envlock)
-# define UNLOCK	__libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean.  */
-#ifdef _LIBC
-# define setenv __setenv
-# define unsetenv __unsetenv
-# define clearenv __clearenv
-# define tfind __tfind
-# define tsearch __tsearch
-#endif
-
-/* In the GNU C library implementation we try to be more clever and
-   allow arbitrarily many changes of the environment given that the used
-   values are from a small set.  Outside glibc this will eat up all
-   memory after a while.  */
-#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
-		      && defined __GNUC__)
-# define USE_TSEARCH	1
-# include <search.h>
-
-/* This is a pointer to the root of the search tree with the known
-   values.  */
-static void *known_values;
-
-# define KNOWN_VALUE(Str) \
-  ({									      \
-    void *value = tfind (Str, &known_values, (__compar_fn_t) strcmp);	      \
-    value != NULL ? *(char **) value : NULL;				      \
-  })
-# define STORE_VALUE(Str) \
-  tsearch (Str, &known_values, (__compar_fn_t) strcmp)
-
-#else
-# undef USE_TSEARCH
-
-# define KNOWN_VALUE(Str) NULL
-# define STORE_VALUE(Str) do { } while (0)
-
-#endif
-
-
-/* If this variable is not a null pointer we allocated the current
-   environment.  */
-static char **last_environ;
-
-
-/* This function is used by `setenv' and `putenv'.  The difference between
-   the two functions is that for the former must create a new string which
-   is then placed in the environment, while the argument of `putenv'
-   must be used directly.  This is all complicated by the fact that we try
-   to reuse values once generated for a `setenv' call since we can never
-   free the strings.  */
-int
-__add_to_environ (name, value, combined, replace)
-     const char *name;
-     const char *value;
-     const char *combined;
-     int replace;
-{
-  register char **ep;
-  register size_t size;
-  const size_t namelen = strlen (name);
-  const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
-
-  LOCK;
-
-  /* We have to get the pointer now that we have the lock and not earlier
-     since another thread might have created a new environment.  */
-  ep = __environ;
-
-  size = 0;
-  if (ep != NULL)
-    {
-      for (; *ep != NULL; ++ep)
-	if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
-	  break;
-	else
-	  ++size;
-    }
-
-  if (ep == NULL || __builtin_expect (*ep == NULL, 1))
-    {
-      char **new_environ;
-
-      /* We allocated this space; we can extend it.  */
-      new_environ = (char **) realloc (last_environ,
-				       (size + 2) * sizeof (char *));
-      if (new_environ == NULL)
-	{
-	  UNLOCK;
-	  return -1;
-	}
-
-      /* If the whole entry is given add it.  */
-      if (combined != NULL)
-	/* We must not add the string to the search tree since it belongs
-	   to the user.  */
-	new_environ[size] = (char *) combined;
-      else
-	{
-	  /* See whether the value is already known.  */
-#ifdef USE_TSEARCH
-# ifdef __GNUC__
-	  char new_value[namelen + 1 + vallen];
-# else
-	  char *new_value = (char *) alloca (namelen + 1 + vallen);
-# endif
-# ifdef _LIBC
-	  __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-		     value, vallen);
-# else
-	  memcpy (new_value, name, namelen);
-	  new_value[namelen] = '=';
-	  memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
-	  new_environ[size] = KNOWN_VALUE (new_value);
-	  if (__builtin_expect (new_environ[size] == NULL, 1))
-#endif
-	    {
-	      new_environ[size] = (char *) malloc (namelen + 1 + vallen);
-	      if (__builtin_expect (new_environ[size] == NULL, 0))
-		{
-		  __set_errno (ENOMEM);
-		  UNLOCK;
-		  return -1;
-		}
-
-#ifdef USE_TSEARCH
-	      memcpy (new_environ[size], new_value, namelen + 1 + vallen);
-#else
-	      memcpy (new_environ[size], name, namelen);
-	      new_environ[size][namelen] = '=';
-	      memcpy (&new_environ[size][namelen + 1], value, vallen);
-#endif
-	      /* And save the value now.  We cannot do this when we remove
-		 the string since then we cannot decide whether it is a
-		 user string or not.  */
-	      STORE_VALUE (new_environ[size]);
-	    }
-	}
-
-      if (__environ != last_environ)
-	memcpy ((char *) new_environ, (char *) __environ,
-		size * sizeof (char *));
-
-      new_environ[size + 1] = NULL;
-
-      last_environ = __environ = new_environ;
-    }
-  else if (replace)
-    {
-      char *np;
-
-      /* Use the user string if given.  */
-      if (combined != NULL)
-	np = (char *) combined;
-      else
-	{
-#ifdef USE_TSEARCH
-# ifdef __GNUC__
-	  char new_value[namelen + 1 + vallen];
-# else
-	  char *new_value = (char *) alloca (namelen + 1 + vallen);
-# endif
-# ifdef _LIBC
-	  __mempcpy (__mempcpy (__mempcpy (new_value, name, namelen), "=", 1),
-		     value, vallen);
-# else
-	  memcpy (new_value, name, namelen);
-	  new_value[namelen] = '=';
-	  memcpy (&new_value[namelen + 1], value, vallen);
-# endif
-
-	  np = KNOWN_VALUE (new_value);
-	  if (__builtin_expect (np == NULL, 1))
-#endif
-	    {
-	      np = malloc (namelen + 1 + vallen);
-	      if (__builtin_expect (np == NULL, 0))
-		{
-		  UNLOCK;
-		  return -1;
-		}
-
-#ifdef USE_TSEARCH
-	      memcpy (np, new_value, namelen + 1 + vallen);
-#else
-	      memcpy (np, name, namelen);
-	      np[namelen] = '=';
-	      memcpy (&np[namelen + 1], value, vallen);
-#endif
-	      /* And remember the value.  */
-	      STORE_VALUE (np);
-	    }
-	}
-
-      *ep = np;
-    }
-
-  UNLOCK;
-
-  return 0;
-}
-
-int
-setenv (name, value, replace)
-     const char *name;
-     const char *value;
-     int replace;
-{
-  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return __add_to_environ (name, value, NULL, replace);
-}
-
-int
-unsetenv (name)
-     const char *name;
-{
-  size_t len;
-  char **ep;
-
-  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  len = strlen (name);
-
-  LOCK;
-
-  ep = __environ;
-  while (*ep != NULL)
-    if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
-      {
-	/* Found it.  Remove this pointer by moving later ones back.  */
-	char **dp = ep;
-
-	do
-	  dp[0] = dp[1];
-	while (*dp++);
-	/* Continue the loop in case NAME appears again.  */
-      }
-    else
-      ++ep;
-
-  UNLOCK;
-
-  return 0;
-}
-
-/* The `clearenv' was planned to be added to POSIX.1 but probably
-   never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
-   for Fortran 77) requires this function.  */
-int
-clearenv ()
-{
-  LOCK;
-
-  if (__environ == last_environ && __environ != NULL)
-    {
-      /* We allocated this environment so we can free it.  */
-      free (__environ);
-      last_environ = NULL;
-    }
-
-  /* Clear the environment pointer removes the whole environment.  */
-  __environ = NULL;
-
-  UNLOCK;
-
-  return 0;
-}
-#ifdef _LIBC
-libc_freeres_fn (free_mem)
-{
-  /* Remove all traces.  */
-  clearenv ();
-
-  /* Now remove the search tree.  */
-  __tdestroy (known_values, free);
-  known_values = NULL;
-}
-
-# undef setenv
-# undef unsetenv
-# undef clearenv
-weak_alias (__setenv, setenv)
-weak_alias (__unsetenv, unsetenv)
-weak_alias (__clearenv, clearenv)
-#endif
diff --git a/sysdeps/generic/seteuid.c b/sysdeps/generic/seteuid.c
deleted file mode 100644
index 689000f993..0000000000
--- a/sysdeps/generic/seteuid.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the effective user ID of the calling process to UID.  */
-int
-seteuid (uid)
-     __uid_t uid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (seteuid)
-stub_warning (seteuid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setfpucw.c b/sysdeps/generic/setfpucw.c
deleted file mode 100644
index cb50f9f3f1..0000000000
--- a/sysdeps/generic/setfpucw.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Set the FPU control word.
-   Copyright (C) 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include <fpu_control.h>
-
-void
-__setfpucw (fpu_control_t set)
-{
-  fpu_control_t cw;
-
-  /* Fetch the current control word.  */
-  _FPU_GETCW (cw);
-
-  /* Preserve the reserved bits, and set the rest as the user
-     specified (or the default, if the user gave zero).  */
-  cw &= _FPU_RESERVED;
-  cw |= set & ~_FPU_RESERVED;
-
-  _FPU_SETCW (cw);
-}
diff --git a/sysdeps/generic/setgid.c b/sysdeps/generic/setgid.c
deleted file mode 100644
index 05c2cc6621..0000000000
--- a/sysdeps/generic/setgid.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Set the group ID of the calling process to GID.
-   If the calling process is the super-user, the real
-   and effective group IDs, and the saved set-group-ID to GID;
-   if not, the effective group ID is set to GID.  */
-int
-__setgid (gid)
-     gid_t gid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setgid)
-
-weak_alias (__setgid, setgid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setgroups.c b/sysdeps/generic/setgroups.c
deleted file mode 100644
index 74bae72974..0000000000
--- a/sysdeps/generic/setgroups.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <grp.h>
-
-/* Set the group set for the current user to GROUPS (N of them).  */
-int
-setgroups (n, groups)
-     size_t n;
-     const gid_t *groups;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (setgroups)
-
-stub_warning (setgroups)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sethostid.c b/sysdeps/generic/sethostid.c
deleted file mode 100644
index 6f393de06a..0000000000
--- a/sysdeps/generic/sethostid.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the current machine's Internet number to ID.
-   This call is restricted to the super-user.  */
-int
-sethostid (id)
-     long int id;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (sethostid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sethostname.c b/sysdeps/generic/sethostname.c
deleted file mode 100644
index 1f65b1e759..0000000000
--- a/sysdeps/generic/sethostname.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the name of the current host to NAME, which is LEN bytes long.
-   This call is restricted to the super-user.  */
-int
-sethostname (name, len)
-     const char *name;
-     size_t len;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (sethostname)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setipv4sourcefilter.c b/sysdeps/generic/setipv4sourcefilter.c
deleted file mode 100644
index db2b8433bb..0000000000
--- a/sysdeps/generic/setipv4sourcefilter.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Set source filter.  Stub version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <netinet/in.h>
-
-
-int
-setipv4sourcefilter (int s, struct in_addr interface, struct in_addr group,
-		     uint32_t fmode, uint32_t numsrc,
-		     const struct in_addr *slist)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setipv4sourcefilter)
diff --git a/sysdeps/generic/setitimer.c b/sysdeps/generic/setitimer.c
deleted file mode 100644
index 755fa06a7b..0000000000
--- a/sysdeps/generic/setitimer.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <errno.h>
-#include <sys/time.h>
-
-/* Set the timer WHICH to *NEW.  If OLD is not NULL,
-   set *OLD to the old value of timer WHICH.
-   Returns 0 on success, -1 on errors.  */
-int
-__setitimer (which, new, old)
-     enum __itimer_which which;
-     const struct itimerval *new;
-     struct itimerval *old;
-{
-  if (new == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setitimer)
-
-weak_alias (__setitimer, setitimer)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setjmp.c b/sysdeps/generic/setjmp.c
deleted file mode 100644
index 0676ff1396..0000000000
--- a/sysdeps/generic/setjmp.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 94, 95, 96, 97, 98 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <setjmp.h>
-
-
-/* Save the current program position in ENV and return 0.  */
-int
-__libc_sigsetjmp (jmp_buf env, int savemask)
-{
-  /* Save the signal mask if requested.  */
-  __sigjmp_save (env, savemask);
-
-  __set_errno (ENOSYS);
-  /* No way to signal failure.	*/
-  return 0;
-}
-
-weak_alias (__libc_sigsetjmp, __sigsetjmp)
-stub_warning (__sigsetjmp)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setlogin.c b/sysdeps/generic/setlogin.c
deleted file mode 100644
index c16e29dd9e..0000000000
--- a/sysdeps/generic/setlogin.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the login name returned by `getlogin'.  */
-int
-setlogin (name)
-     const char *name;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (setlogin)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setpgid.c b/sysdeps/generic/setpgid.c
deleted file mode 100644
index cb2abf1159..0000000000
--- a/sysdeps/generic/setpgid.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the process group ID of the process matching PID to PGID.
-   If PID is zero, the current process's process group ID is set.
-   If PGID is zero, the process ID of the process is used.  */
-int
-__setpgid (pid, pgid)
-     int pid;
-     int pgid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__setpgid)
-stub_warning (setpgid)
-
-weak_alias (__setpgid, setpgid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setpgrp.c b/sysdeps/generic/setpgrp.c
deleted file mode 100644
index 8ceb159341..0000000000
--- a/sysdeps/generic/setpgrp.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-
-int
-setpgrp ()
-{
-  return __setpgid (0, 0);
-}
diff --git a/sysdeps/generic/setpriority.c b/sysdeps/generic/setpriority.c
deleted file mode 100644
index b2e6f8a059..0000000000
--- a/sysdeps/generic/setpriority.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2000,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/resource.h>
-
-/* Set the priority of all processes specified by WHICH and WHO
-   to PRIO.  Returns 0 on success, -1 on errors.  */
-int
-setpriority (which, who, prio)
-     enum __priority_which which;
-     id_t who;
-     int prio;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (setpriority)
-
-stub_warning (setpriority)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setregid.c b/sysdeps/generic/setregid.c
deleted file mode 100644
index f8f33d1da7..0000000000
--- a/sysdeps/generic/setregid.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Set the real group ID of the calling process to RGID,
-   and the effective group ID of the calling process to EGID.  */
-int
-__setregid (effective_gid, real_gid)
-     gid_t effective_gid;
-     gid_t real_gid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setregid)
-
-weak_alias (__setregid, setregid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setresgid.c b/sysdeps/generic/setresgid.c
deleted file mode 100644
index 78e308c5d0..0000000000
--- a/sysdeps/generic/setresgid.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* setresgid -- set effective group ID, real group ID, and saved-set group ID
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the effective group ID, real group ID, and saved-set group ID,
-   of the calling process to EGID, RGID, and SGID, respectively.  */
-int
-__setresgid (gid_t egid, gid_t rgid, gid_t sgid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__setresgid)
-stub_warning (setresgid)
-
-weak_alias (__setresgid, setresgid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setresuid.c b/sysdeps/generic/setresuid.c
deleted file mode 100644
index 430b63b2fd..0000000000
--- a/sysdeps/generic/setresuid.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* setresuid -- set effective user ID, real user ID, and saved-set user ID
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set the effective user ID, real user ID, and saved-set user ID,
-   of the calling process to EUID, RUID, and SUID, respectively.  */
-int
-__setresuid (uid_t euid, uid_t ruid, uid_t suid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__setresuid)
-stub_warning (setresuid)
-
-weak_alias (__setresuid, setresuid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setreuid.c b/sysdeps/generic/setreuid.c
deleted file mode 100644
index cce2d9d52b..0000000000
--- a/sysdeps/generic/setreuid.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Set the real user ID of the calling process to RUID,
-   and the effective user ID of the calling process to EUID.  */
-int
-__setreuid (effective_uid, real_uid)
-     uid_t effective_uid;
-     uid_t real_uid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setreuid)
-
-weak_alias (__setreuid, setreuid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setrlimit.c b/sysdeps/generic/setrlimit.c
deleted file mode 100644
index c8f6e03ad3..0000000000
--- a/sysdeps/generic/setrlimit.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/resource.h>
-#include <sys/types.h>
-
-/* Set the soft and hard limits for RESOURCE to *RLIMITS.
-   Only the super-user can increase hard limits.
-   Return 0 if successful, -1 if not (and sets errno).  */
-int
-setrlimit (resource, rlimits)
-     enum __rlimit_resource resource;
-     const struct rlimit *rlimits;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (setrlimit)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setrlimit64.c b/sysdeps/generic/setrlimit64.c
deleted file mode 100644
index d4b4bfce0a..0000000000
--- a/sysdeps/generic/setrlimit64.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/resource.h>
-#include <sys/types.h>
-
-/* Set the soft and hard limits for RESOURCE to *RLIMITS.
-   Only the super-user can increase hard limits.
-   Return 0 if successful, -1 if not (and sets errno).  */
-int
-setrlimit64 (resource, rlimits)
-     enum __rlimit_resource resource;
-     const struct rlimit64 *rlimits;
-{
-  struct rlimit rlimits32;
-
-  if (rlimits->rlim_cur >= RLIM_INFINITY)
-    rlimits32.rlim_cur = RLIM_INFINITY;
-  else
-    rlimits32.rlim_cur = rlimits->rlim_cur;
-  if (rlimits->rlim_max >= RLIM_INFINITY)
-    rlimits32.rlim_max = RLIM_INFINITY;
-  else
-    rlimits32.rlim_max = rlimits->rlim_max;
-
-  return __setrlimit (resource, &rlimits32);
-}
diff --git a/sysdeps/generic/setsid.c b/sysdeps/generic/setsid.c
deleted file mode 100644
index 6a6712b9bd..0000000000
--- a/sysdeps/generic/setsid.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-
-/* Create a new session with the calling process as its leader.
-   The process group IDs of the session and the calling process
-   are set to the process ID of the calling process, which is returned.  */
-int
-__setsid ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setsid)
-
-weak_alias (__setsid, setsid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setsockopt.c b/sysdeps/generic/setsockopt.c
deleted file mode 100644
index aca73623fe..0000000000
--- a/sysdeps/generic/setsockopt.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Set socket FD's option OPTNAME at protocol level LEVEL
-   to *OPTVAL (which is OPTLEN bytes long).
-   Returns 0 on success, -1 for errors.  */
-int
-__setsockopt (fd, level, optname, optval, optlen)
-     int fd;
-     int level;
-     int optname;
-     const __ptr_t optval;
-     socklen_t optlen;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__setsockopt, setsockopt)
-
-stub_warning (setsockopt)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setsourcefilter.c b/sysdeps/generic/setsourcefilter.c
deleted file mode 100644
index 870f5e2c38..0000000000
--- a/sysdeps/generic/setsourcefilter.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Set source filter.  Stub version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <netinet/in.h>
-
-
-int
-setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
-		 socklen_t grouplen, uint32_t fmode, uint32_t numsrc,
-		 const struct sockaddr_storage *slist)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setsourcefilter)
diff --git a/sysdeps/generic/settimeofday.c b/sysdeps/generic/settimeofday.c
deleted file mode 100644
index abff6f92a1..0000000000
--- a/sysdeps/generic/settimeofday.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/time.h>
-
-/* Set the current time of day and timezone information.
-   This call is restricted to the super-user.  */
-int
-__settimeofday (tv, tz)
-     const struct timeval *tv;
-     const struct timezone *tz;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (settimeofday)
-
-weak_alias (__settimeofday, settimeofday)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setuid.c b/sysdeps/generic/setuid.c
deleted file mode 100644
index 96c3e01cb9..0000000000
--- a/sysdeps/generic/setuid.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Set the user ID of the calling process to UID.
-   If the calling process is the super-user, the real
-   and effective user IDs, and the saved set-user-ID to UID;
-   if not, the effective user ID is set to UID.  */
-int
-__setuid (uid)
-     uid_t uid;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (setuid)
-
-weak_alias (__setuid, setuid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/setutxent.c b/sysdeps/generic/setutxent.c
deleted file mode 100644
index b6cd282644..0000000000
--- a/sysdeps/generic/setutxent.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-void
-setutxent (void)
-{
-  return __setutent ();
-}
diff --git a/sysdeps/generic/setxattr.c b/sysdeps/generic/setxattr.c
deleted file mode 100644
index 5b8743a7ce..0000000000
--- a/sysdeps/generic/setxattr.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/xattr.h>
-
-int
-setxattr (const char *__path, const char *__name,
-	  const void *__value, size_t __size, int __flags)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (setxattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/shm_open.c b/sysdeps/generic/shm_open.c
deleted file mode 100644
index 6a53903a75..0000000000
--- a/sysdeps/generic/shm_open.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/mman.h>
-
-/* Open shared memory object.  */
-int
-shm_open (const char *name, int oflag, mode_t mode)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (shm_open)
-
-#include <stub-tag.h>
diff --git a/sysdeps/generic/shm_unlink.c b/sysdeps/generic/shm_unlink.c
deleted file mode 100644
index 28478b895b..0000000000
--- a/sysdeps/generic/shm_unlink.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/mman.h>
-
-/* Remove shared memory object.  */
-int
-shm_unlink (const char *name)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (shm_unlink)
-
-#include <stub-tag.h>
diff --git a/sysdeps/generic/shmat.c b/sysdeps/generic/shmat.c
deleted file mode 100644
index f418f3e774..0000000000
--- a/sysdeps/generic/shmat.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/shm.h>
-#include <errno.h>
-
-/* Attach the shared memory segment associated with SHMID to the data
-   segment of the calling process.  SHMADDR and SHMFLG determine how
-   and where the segment is attached.  */
-
-void *
-shmat (shmid, shmaddr, shmflg)
-     int shmid;
-     const void *shmaddr;
-     int shmflg;
-{
-  __set_errno (ENOSYS);
-  return (void *) -1;
-}
-
-stub_warning (shmat)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/shmctl.c b/sysdeps/generic/shmctl.c
deleted file mode 100644
index 83374e4b92..0000000000
--- a/sysdeps/generic/shmctl.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/shm.h>
-#include <errno.h>
-
-/* Provide operations to control over shared memory segments.  */
-
-int
-shmctl (shmid, cmd, buf)
-     int shmid;
-     int cmd;
-     struct shmid_ds *buf;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (shmctl)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/shmdt.c b/sysdeps/generic/shmdt.c
deleted file mode 100644
index e77f39daac..0000000000
--- a/sysdeps/generic/shmdt.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/shm.h>
-#include <errno.h>
-
-/* Detach shared memory segment starting at address specified by SHMADDR
-   from the caller's data segment.  */
-
-int
-shmdt (shmaddr)
-     const void *shmaddr;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (shmdt)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/shmget.c b/sysdeps/generic/shmget.c
deleted file mode 100644
index 7426de656d..0000000000
--- a/sysdeps/generic/shmget.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/shm.h>
-#include <errno.h>
-
-/* Return an identifier for an shared memory segment of at least size SIZE
-   which is associated with KEY.  */
-
-int
-shmget (key, size, shmflg)
-     key_t key;
-     size_t size;
-     int shmflg;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (shmget)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/shutdown.c b/sysdeps/generic/shutdown.c
deleted file mode 100644
index 6fb25a4bc1..0000000000
--- a/sysdeps/generic/shutdown.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Shut down all or part of the connection open on socket FD.
-   HOW determines what to shut down:
-     0 = No more receptions;
-     1 = No more transmissions;
-     2 = No more receptions or transmissions.
-   Returns 0 on success, -1 for errors.  */
-int
-shutdown (fd, how)
-     int fd;
-     int how;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (shutdown)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigaction.c b/sysdeps/generic/sigaction.c
deleted file mode 100644
index bf0a15bacb..0000000000
--- a/sysdeps/generic/sigaction.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* If ACT is not NULL, change the action for SIG to *ACT.
-   If OACT is not NULL, put the old action for SIG in *OACT.  */
-int
-__sigaction (sig, act, oact)
-     int sig;
-     const struct sigaction *act;
-     struct sigaction *oact;
-{
-  if (sig <= 0 || sig >= NSIG)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__sigaction)
-stub_warning (sigaction)
-
-weak_alias (__sigaction, sigaction)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigaltstack.c b/sysdeps/generic/sigaltstack.c
deleted file mode 100644
index 17c7e06b35..0000000000
--- a/sysdeps/generic/sigaltstack.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-/* Run signals handlers on the stack specified by SS (if not NULL).
-   If OSS is not NULL, it is filled in with the old signal stack status.  */
-int
-sigaltstack (ss, oss)
-     const struct sigaltstack *ss;
-     struct sigaltstack *oss;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (sigaltstack)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigblock.c b/sysdeps/generic/sigblock.c
deleted file mode 100644
index 81a4ff1447..0000000000
--- a/sysdeps/generic/sigblock.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-/* Block signals in MASK, returning the old mask.  */
-int
-__sigblock (mask)
-     int mask;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sigblock)
-
-weak_alias (__sigblock, sigblock)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigfillset.c b/sysdeps/generic/sigfillset.c
deleted file mode 100644
index 95d52cf0c0..0000000000
--- a/sysdeps/generic/sigfillset.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1991,96,97,2002,2003,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-
-/* Set all signals in SET.  */
-int
-sigfillset (set)
-     sigset_t *set;
-{
-  if (set == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  memset (set, 0xff, sizeof (sigset_t));
-
-  /* If the implementation uses a cancellation signal don't set the bit.  */
-#ifdef SIGCANCEL
-  __sigdelset (set, SIGCANCEL);
-#endif
-  /* Likewise for the signal to implement setxid.  */
-#ifdef SIGSETXID
-  __sigdelset (set, SIGSETXID);
-#endif
-
-  return 0;
-}
-libc_hidden_def (sigfillset)
diff --git a/sysdeps/generic/sigignore.c b/sysdeps/generic/sigignore.c
deleted file mode 100644
index 734422dd81..0000000000
--- a/sysdeps/generic/sigignore.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* Set the disposition for SIG to SIG_IGN.  */
-int
-sigignore (sig)
-     int sig;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (sigignore)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigintr.c b/sysdeps/generic/sigintr.c
deleted file mode 100644
index 9d4c2c8f58..0000000000
--- a/sysdeps/generic/sigintr.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
-   (causing them to fail with EINTR); if INTERRUPT is zero, make system
-   calls be restarted after signal SIG.  */
-int
-siginterrupt (sig, interrupt)
-     int sig;
-     int interrupt;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (siginterrupt)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigjmp.c b/sysdeps/generic/sigjmp.c
deleted file mode 100644
index b23c547f5e..0000000000
--- a/sysdeps/generic/sigjmp.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1992, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <setjmp.h>
-#include <signal.h>
-
-/* This function is called by the `sigsetjmp' macro
-   before doing a `__setjmp' on ENV[0].__jmpbuf.
-   Always return zero.  */
-
-int
-__sigjmp_save (sigjmp_buf env, int savemask)
-{
-  env[0].__mask_was_saved = (savemask &&
-			     __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
-					    &env[0].__saved_mask) == 0);
-
-  return 0;
-}
diff --git a/sysdeps/generic/siglist.c b/sysdeps/generic/siglist.c
deleted file mode 100644
index 80847cd491..0000000000
--- a/sysdeps/generic/siglist.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Define list of all signal numbers and their names.
-   Copyright (C) 1997, 1998, 1999, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <signal.h>
-#include <libintl.h>
-
-const char *const _sys_siglist[NSIG] =
-{
-#define init_sig(sig, abbrev, desc)   [sig] = desc,
-#include <siglist.h>
-#undef init_sig
-};
-strong_alias (_sys_siglist, _sys_siglist_internal)
-
-
-const char *const _sys_sigabbrev[NSIG] =
-{
-#define init_sig(sig, abbrev, desc)   [sig] = abbrev,
-#include <siglist.h>
-#undef init_sig
-};
diff --git a/sysdeps/generic/signal.c b/sysdeps/generic/signal.c
deleted file mode 100644
index 6c1808bb15..0000000000
--- a/sysdeps/generic/signal.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* Set the handler for the signal SIG to HANDLER,
-   returning the old handler, or SIG_ERR on error.  */
-__sighandler_t
-signal (sig, handler)
-     int sig;
-     __sighandler_t handler;
-{
-  __set_errno (ENOSYS);
-  return SIG_ERR;
-}
-
-weak_alias (signal, ssignal)
-
-stub_warning (signal)
-stub_warning (ssignal)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/signame.c b/sysdeps/generic/signame.c
deleted file mode 100644
index 6085532e28..0000000000
--- a/sysdeps/generic/signame.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Convert between signal names and numbers.
-   Copyright (C) 1990, 92, 93, 95, 96, 97 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>		/* Some systems need this for <signal.h>.  */
-#include <signal.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-/* Some systems declare `sys_siglist in <unistd.h>; if
-   configure defined SYS_SIGLIST_DECLARED, it may expect
-   to find the declaration there.  */
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-
-/* Some systems do not define NSIG in <signal.h>.  */
-#ifndef	NSIG
-#ifdef	_NSIG
-#define	NSIG	_NSIG
-#else
-#define	NSIG	32
-#endif
-#endif
-
-#if !__STDC__
-#define const
-#endif
-
-#include "signame.h"
-
-#ifndef HAVE_SYS_SIGLIST
-/* There is too much variation in Sys V signal numbers and names, so
-   we must initialize them at runtime.  */
-
-static const char undoc[] = "unknown signal";
-
-const char *sys_siglist[NSIG];
-
-#else	/* HAVE_SYS_SIGLIST.  */
-
-#ifndef SYS_SIGLIST_DECLARED
-extern char *sys_siglist[];
-#endif	/* Not SYS_SIGLIST_DECLARED.  */
-
-#endif	/* Not HAVE_SYS_SIGLIST.  */
-
-/* Table of abbreviations for signals.  Note:  A given number can
-   appear more than once with different abbreviations.  */
-typedef struct
-  {
-    int number;
-    const char *abbrev;
-  } num_abbrev;
-static num_abbrev sig_table[NSIG*2];
-/* Number of elements of sig_table used.  */
-static int sig_table_nelts = 0;
-
-/* Enter signal number NUMBER into the tables with ABBREV and NAME.  */
-
-static void
-init_sig (number, abbrev, name)
-     int number;
-     const char *abbrev;
-     const char *name;
-{
-#ifndef HAVE_SYS_SIGLIST
-  sys_siglist[number] = name;
-#endif
-  sig_table[sig_table_nelts].number = number;
-  sig_table[sig_table_nelts++].abbrev = abbrev;
-}
-
-void
-signame_init ()
-{
-#ifndef HAVE_SYS_SIGLIST
-  int i;
-  /* Initialize signal names.  */
-  for (i = 0; i < NSIG; i++)
-    sys_siglist[i] = undoc;
-#endif /* !HAVE_SYS_SIGLIST */
-
-  /* Initialize signal names.  */
-#if defined (SIGHUP)
-  init_sig (SIGHUP, "HUP", "Hangup");
-#endif
-#if defined (SIGINT)
-  init_sig (SIGINT, "INT", "Interrupt");
-#endif
-#if defined (SIGQUIT)
-  init_sig (SIGQUIT, "QUIT", "Quit");
-#endif
-#if defined (SIGILL)
-  init_sig (SIGILL, "ILL", "Illegal Instruction");
-#endif
-#if defined (SIGTRAP)
-  init_sig (SIGTRAP, "TRAP", "Trace/breakpoint trap");
-#endif
-  /* If SIGIOT == SIGABRT, we want to print it as SIGABRT because
-     SIGABRT is in ANSI and POSIX.1 and SIGIOT isn't.  */
-#if defined (SIGABRT)
-  init_sig (SIGABRT, "ABRT", "Aborted");
-#endif
-#if defined (SIGIOT)
-  init_sig (SIGIOT, "IOT", "IOT trap");
-#endif
-#if defined (SIGEMT)
-  init_sig (SIGEMT, "EMT", "EMT trap");
-#endif
-#if defined (SIGFPE)
-  init_sig (SIGFPE, "FPE", "Floating point exception");
-#endif
-#if defined (SIGKILL)
-  init_sig (SIGKILL, "KILL", "Killed");
-#endif
-#if defined (SIGBUS)
-  init_sig (SIGBUS, "BUS", "Bus error");
-#endif
-#if defined (SIGSEGV)
-  init_sig (SIGSEGV, "SEGV", "Segmentation fault");
-#endif
-#if defined (SIGSYS)
-  init_sig (SIGSYS, "SYS", "Bad system call");
-#endif
-#if defined (SIGPIPE)
-  init_sig (SIGPIPE, "PIPE", "Broken pipe");
-#endif
-#if defined (SIGALRM)
-  init_sig (SIGALRM, "ALRM", "Alarm clock");
-#endif
-#if defined (SIGTERM)
-  init_sig (SIGTERM, "TERM", "Terminated");
-#endif
-#if defined (SIGUSR1)
-  init_sig (SIGUSR1, "USR1", "User defined signal 1");
-#endif
-#if defined (SIGUSR2)
-  init_sig (SIGUSR2, "USR2", "User defined signal 2");
-#endif
-  /* If SIGCLD == SIGCHLD, we want to print it as SIGCHLD because that
-     is what is in POSIX.1.  */
-#if defined (SIGCHLD)
-  init_sig (SIGCHLD, "CHLD", "Child exited");
-#endif
-#if defined (SIGCLD)
-  init_sig (SIGCLD, "CLD", "Child exited");
-#endif
-#if defined (SIGPWR)
-  init_sig (SIGPWR, "PWR", "Power failure");
-#endif
-#if defined (SIGTSTP)
-  init_sig (SIGTSTP, "TSTP", "Stopped");
-#endif
-#if defined (SIGTTIN)
-  init_sig (SIGTTIN, "TTIN", "Stopped (tty input)");
-#endif
-#if defined (SIGTTOU)
-  init_sig (SIGTTOU, "TTOU", "Stopped (tty output)");
-#endif
-#if defined (SIGSTOP)
-  init_sig (SIGSTOP, "STOP", "Stopped (signal)");
-#endif
-#if defined (SIGXCPU)
-  init_sig (SIGXCPU, "XCPU", "CPU time limit exceeded");
-#endif
-#if defined (SIGXFSZ)
-  init_sig (SIGXFSZ, "XFSZ", "File size limit exceeded");
-#endif
-#if defined (SIGVTALRM)
-  init_sig (SIGVTALRM, "VTALRM", "Virtual timer expired");
-#endif
-#if defined (SIGPROF)
-  init_sig (SIGPROF, "PROF", "Profiling timer expired");
-#endif
-#if defined (SIGWINCH)
-  /* "Window size changed" might be more accurate, but even if that
-     is all that it means now, perhaps in the future it will be
-     extended to cover other kinds of window changes.  */
-  init_sig (SIGWINCH, "WINCH", "Window changed");
-#endif
-#if defined (SIGCONT)
-  init_sig (SIGCONT, "CONT", "Continued");
-#endif
-#if defined (SIGURG)
-  init_sig (SIGURG, "URG", "Urgent I/O condition");
-#endif
-#if defined (SIGIO)
-  /* "I/O pending" has also been suggested.  A disadvantage is
-     that signal only happens when the process has
-     asked for it, not everytime I/O is pending.  Another disadvantage
-     is the confusion from giving it a different name than under Unix.  */
-  init_sig (SIGIO, "IO", "I/O possible");
-#endif
-#if defined (SIGWIND)
-  init_sig (SIGWIND, "WIND", "SIGWIND");
-#endif
-#if defined (SIGPHONE)
-  init_sig (SIGPHONE, "PHONE", "SIGPHONE");
-#endif
-#if defined (SIGPOLL)
-  init_sig (SIGPOLL, "POLL", "I/O possible");
-#endif
-#if defined (SIGLOST)
-  init_sig (SIGLOST, "LOST", "Resource lost");
-#endif
-#if defined (SIGDANGER)
-  init_sig (SIGDANGER, "DANGER", "Danger signal");
-#endif
-#if defined (SIGINFO)
-  init_sig (SIGINFO, "INFO", "Information request");
-#endif
-#if defined (SIGNOFP)
-  init_sig (SIGNOFP, "NOFP", "Floating point co-processor not available");
-#endif
-}
-
-/* Return the abbreviation for signal NUMBER.  */
-
-char *
-sig_abbrev (number)
-     int number;
-{
-  int i;
-
-  if (sig_table_nelts == 0)
-    signame_init ();
-
-  for (i = 0; i < sig_table_nelts; i++)
-    if (sig_table[i].number == number)
-      return (char *)sig_table[i].abbrev;
-  return NULL;
-}
-
-/* Return the signal number for an ABBREV, or -1 if there is no
-   signal by that name.  */
-
-int
-sig_number (abbrev)
-     const char *abbrev;
-{
-  int i;
-
-  if (sig_table_nelts == 0)
-    signame_init ();
-
-  /* Skip over "SIG" if present.  */
-  if (abbrev[0] == 'S' && abbrev[1] == 'I' && abbrev[2] == 'G')
-    abbrev += 3;
-
-  for (i = 0; i < sig_table_nelts; i++)
-    if (abbrev[0] == sig_table[i].abbrev[0]
-	&& strcmp (abbrev, sig_table[i].abbrev) == 0)
-      return sig_table[i].number;
-  return -1;
-}
-
-#ifndef HAVE_PSIGNAL
-/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
-   a colon, and followed by a newline.  */
-
-void
-psignal (signal, message)
-     int signal;
-     const char *message;
-{
-  if (signal <= 0 || signal >= NSIG)
-    fprintf (stderr, "%s: unknown signal", message);
-  else
-    fprintf (stderr, "%s: %s\n", message, sys_siglist[signal]);
-}
-#endif
-
-#ifndef HAVE_STRSIGNAL
-/* Return the string associated with the signal number.  */
-
-char *
-strsignal (signal)
-     int signal;
-{
-  static char buf[] = "Signal 12345678901234567890";
-
-  if (signal > 0 || signal < NSIG)
-    return (char *) sys_siglist[signal];
-
-  sprintf (buf, "Signal %d", signal);
-  return buf;
-}
-#endif
diff --git a/sysdeps/generic/signame.h b/sysdeps/generic/signame.h
deleted file mode 100644
index d829e860b4..0000000000
--- a/sysdeps/generic/signame.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Convert between signal names and numbers.
-   Copyright (C) 1990, 1992, 1993, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if defined (__STDC__) && __STDC__
-
-/* Initialize `sys_siglist'.  */
-void signame_init (void);
-
-/* Return the abbreviation (e.g. ABRT, FPE, etc.) for signal NUMBER.
-   Do not return this as a const char *.  The caller might want to
-   assign it to a char *.  */
-char *sig_abbrev (int number);
-
-/* Return the signal number for an ABBREV, or -1 if there is no
-   signal by that name.  */
-int sig_number (const char *abbrev);
-
-/* Avoid conflicts with a system header file that might define these three.  */
-
-#ifndef HAVE_PSIGNAL
-/* Print to standard error the name of SIGNAL, preceded by MESSAGE and
-   a colon, and followed by a newline.  */
-void psignal (int signal, const char *message);
-#endif
-
-#ifndef HAVE_STRSIGNAL
-/* Return the name of SIGNAL.  */
-char *strsignal (int signal);
-#endif
-
-#if !defined (HAVE_SYS_SIGLIST)
-/* Names for signals from 0 to NSIG-1.  */
-extern const char *sys_siglist[];
-#endif
-
-#else
-
-void signame_init ();
-char *sig_abbrev ();
-int sig_number ();
-#if !defined (HAVE_SYS_SIGLIST) && !defined (HAVE_PSIGNAL)
-void psignal ();
-#endif
-#ifndef HAVE_STRSIGNAL
-char *strsignal ();
-#endif
-#if !defined (HAVE_SYS_SIGLIST)
-extern char *sys_siglist[];
-#endif
-
-#endif
diff --git a/sysdeps/generic/sigpause.c b/sysdeps/generic/sigpause.c
deleted file mode 100644
index bc598d070c..0000000000
--- a/sysdeps/generic/sigpause.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1991,95,96,2000,02,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define sigpause __rename_sigpause
-#include <errno.h>
-#include <signal.h>
-#undef sigpause
-
-int
-__sigpause (sig_or_mask, is_sig)
-     int sig_or_mask;
-     int is_sig;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (__sigpause)
-libc_hidden_def (__sigpause)
-
-int
-__attribute__ ((weak))
-__default_sigpause (int mask)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__default_sigpause, sigpause)
-stub_warning (sigpause)
-#include <stub-tag.h>
-
-
-int
-__attribute ((weak))
-__xpg___sigpause (int sig)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
diff --git a/sysdeps/generic/sigpending.c b/sysdeps/generic/sigpending.c
deleted file mode 100644
index 80e16e588c..0000000000
--- a/sysdeps/generic/sigpending.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <signal.h>
-
-
-/* Store in SET all signals that are blocked and pending.  */
-int
-sigpending (set)
-     sigset_t *set;
-{
-  if (set == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (sigpending)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigprocmask.c b/sysdeps/generic/sigprocmask.c
deleted file mode 100644
index 472b3a4fa5..0000000000
--- a/sysdeps/generic/sigprocmask.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* If SET is not NULL, modify the current set of blocked signals
-   according to HOW, which may be SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK.
-   If OSET is not NULL, store the old set of blocked signals in *OSET.  */
-int
-__sigprocmask (how, set, oset)
-     int how;
-     const sigset_t *set;
-     sigset_t *oset;
-{
-  switch (how)
-    {
-    case SIG_BLOCK:
-    case SIG_UNBLOCK:
-    case SIG_SETMASK:
-      break;
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-/* No stub warning because abort calls __sigprocmask,
-   and we don't want warnings for every use of abort on
-   a system without safe signals.  */
-
-weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/generic/sigqueue.c b/sysdeps/generic/sigqueue.c
deleted file mode 100644
index c6e77c0a27..0000000000
--- a/sysdeps/generic/sigqueue.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Implementation of sigqueue function from POSIX.1b.
-   Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <sys/types.h>
-
-int
-__sigqueue (pid_t pid, int sig, const union sigval val)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__sigqueue, sigqueue)
-
-stub_warning (sigqueue)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigreturn.c b/sysdeps/generic/sigreturn.c
deleted file mode 100644
index 0239b0a98c..0000000000
--- a/sysdeps/generic/sigreturn.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1992, 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include <errno.h>
-
-int
-__sigreturn (context)
-     struct sigcontext *context;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sigreturn)
-
-weak_alias (__sigreturn, sigreturn)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigset.c b/sysdeps/generic/sigset.c
deleted file mode 100644
index 191a909158..0000000000
--- a/sysdeps/generic/sigset.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* Set the disposition for SIG.  */
-__sighandler_t
-sigset (sig, disp)
-     int sig;
-     __sighandler_t disp;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (sigset)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigsetmask.c b/sysdeps/generic/sigsetmask.c
deleted file mode 100644
index 602c0add40..0000000000
--- a/sysdeps/generic/sigsetmask.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-int
-__sigsetmask (mask)
-     int mask;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sigsetmask)
-
-weak_alias (__sigsetmask, sigsetmask)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigstack.c b/sysdeps/generic/sigstack.c
deleted file mode 100644
index ca9c8018a4..0000000000
--- a/sysdeps/generic/sigstack.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-/* Run signals handlers on the stack specified by SS (if not NULL).
-   If OSS is not NULL, it is filled in with the old signal stack status.  */
-int
-sigstack (ss, oss)
-     struct sigstack *ss;
-     struct sigstack *oss;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (sigstack)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigsuspend.c b/sysdeps/generic/sigsuspend.c
deleted file mode 100644
index 58452e334c..0000000000
--- a/sysdeps/generic/sigsuspend.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-
-/* Change the set of blocked signals to SET,
-   wait until a signal arrives, and restore the set of blocked signals.  */
-int
-__sigsuspend (set)
-     const sigset_t *set;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-
-stub_warning (sigsuspend)
-stub_warning (__sigsuspend)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigtimedwait.c b/sysdeps/generic/sigtimedwait.c
deleted file mode 100644
index 7b114a3133..0000000000
--- a/sysdeps/generic/sigtimedwait.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Implementation of sigtimedwait function from POSIX.1b.
-   Copyright (C) 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-int
-__sigtimedwait (const sigset_t *set, siginfo_t *info,
-		const struct timespec *timeout)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__sigtimedwait)
-weak_alias (__sigtimedwait, sigtimedwait)
-
-stub_warning (sigtimedwait)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigvec.c b/sysdeps/generic/sigvec.c
deleted file mode 100644
index 148e9a0d85..0000000000
--- a/sysdeps/generic/sigvec.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include <errno.h>
-
-/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
-   of VEC.  The signals in `sv_mask' will be blocked while the handler runs.
-   If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
-   reset to SIG_DFL before `sv_handler' is entered.  If OVEC is non-NULL,
-   it is filled in with the old information for SIG.  */
-int
-__sigvec (sig, vec, ovec)
-     int sig;
-     const struct sigvec *vec;
-     struct sigvec *ovec;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (sigvec)
-
-weak_alias (__sigvec, sigvec)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigwait.c b/sysdeps/generic/sigwait.c
deleted file mode 100644
index 016768553d..0000000000
--- a/sysdeps/generic/sigwait.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* sigwait - implementation of sigwait function from POSIX.1c.
-   Copyright (C) 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-int
-__sigwait (const sigset_t *set, int *sig)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__sigwait, sigwait)
-
-stub_warning (sigwait)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sigwaitinfo.c b/sysdeps/generic/sigwaitinfo.c
deleted file mode 100644
index e0659b0243..0000000000
--- a/sysdeps/generic/sigwaitinfo.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Implementation of sigwaitinfo function from POSIX.1b.
-   Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-int
-__sigwaitinfo (const sigset_t *set, siginfo_t *info)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__sigwaitinfo)
-weak_alias (__sigwaitinfo, sigwaitinfo)
-
-stub_warning (sigwaitinfo)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sleep.c b/sysdeps/generic/sleep.c
deleted file mode 100644
index f9d2a6593f..0000000000
--- a/sysdeps/generic/sleep.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include <time.h>
-#include <unistd.h>
-#include <errno.h>
-
-/* Make the process sleep for SECONDS seconds, or until a signal arrives
-   and is not ignored.  The function returns the number of seconds less
-   than SECONDS which it actually slept (zero if it slept the full time).
-   If a signal handler does a `longjmp' or modifies the handling of the
-   SIGALRM signal while inside `sleep' call, the handling of the SIGALRM
-   signal afterwards is undefined.  There is no return value to indicate
-   error, but if `sleep' returns SECONDS, it probably didn't work.  */
-unsigned int
-__sleep (seconds)
-     unsigned int seconds;
-{
-  __set_errno (ENOSYS);
-  return seconds;
-}
-weak_alias (__sleep, sleep)
-
-stub_warning (sleep)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sockatmark.c b/sysdeps/generic/sockatmark.c
deleted file mode 100644
index 402ef9b4d0..0000000000
--- a/sysdeps/generic/sockatmark.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Determine wheter socket is at a out-of-band mark.  */
-int
-sockatmark (fd)
-     int fd;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (sockatmark)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/socket.c b/sysdeps/generic/socket.c
deleted file mode 100644
index 94e70bc4ea..0000000000
--- a/sysdeps/generic/socket.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Create a new socket of type TYPE in domain DOMAIN, using
-   protocol PROTOCOL.  If PROTOCOL is zero, one is chosen automatically.
-   Returns a file descriptor for the new socket, or -1 for errors.  */
-int
-__socket (domain, type, protocol)
-     int domain;
-     int type;
-     int protocol;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-weak_alias (__socket, socket)
-stub_warning (socket)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/socketpair.c b/sysdeps/generic/socketpair.c
deleted file mode 100644
index ad277c00e5..0000000000
--- a/sysdeps/generic/socketpair.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/socket.h>
-
-/* Create two new sockets, of type TYPE in domain DOMAIN and using
-   protocol PROTOCOL, which are connected to each other, and put file
-   descriptors for them in FDS[0] and FDS[1].  If PROTOCOL is zero,
-   one will be chosen automatically.  Returns 0 on success, -1 for errors.  */
-int
-socketpair (domain, type, protocol, fds)
-     int domain;
-     int type;
-     int protocol;
-     int fds[2];
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (socketpair)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/spawni.c b/sysdeps/generic/spawni.c
deleted file mode 100644
index c7d5f59ffc..0000000000
--- a/sysdeps/generic/spawni.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Guts of POSIX spawn interface.  Stub version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <spawn.h>
-#include "spawn_int.h"
-
-
-/* The Unix standard contains a long explanation of the way to signal
-   an error after the fork() was successful.  Since no new wait status
-   was wanted there is no way to signal an error using one of the
-   available methods.  The committee chose to signal an error by a
-   normal program exit with the exit code 127.  */
-#define SPAWN_ERROR	127
-
-
-/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
-   Before running the process perform the actions described in FILE-ACTIONS. */
-int
-__spawni (pid_t *pid, const char *file,
-	  const posix_spawn_file_actions_t *file_actions,
-	  const posix_spawnattr_t *attrp, char *const argv[],
-	  char *const envp[], int use_path)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (__spawni)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/speed.c b/sysdeps/generic/speed.c
deleted file mode 100644
index b4acd62230..0000000000
--- a/sysdeps/generic/speed.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* `struct termios' speed frobnication functions.  4.4 BSD/generic GNU version.
-   Copyright (C) 1991,1992,1993,1996,1997,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <errno.h>
-#include <termios.h>
-
-/* Return the output baud rate stored in *TERMIOS_P.  */
-speed_t
-cfgetospeed (termios_p)
-     const struct termios *termios_p;
-{
-  return termios_p->__ospeed;
-}
-
-/* Return the input baud rate stored in *TERMIOS_P.  */
-speed_t
-cfgetispeed (termios_p)
-     const struct termios *termios_p;
-{
-  return termios_p->__ispeed;
-}
-
-/* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
-int
-cfsetospeed (termios_p, speed)
-     struct termios *termios_p;
-     speed_t speed;
-{
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  termios_p->__ospeed = speed;
-  return 0;
-}
-libc_hidden_def (cfsetospeed)
-
-/* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
-int
-cfsetispeed (termios_p, speed)
-     struct termios *termios_p;
-     speed_t speed;
-{
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  termios_p->__ispeed = speed;
-  return 0;
-}
-libc_hidden_def (cfsetispeed)
diff --git a/sysdeps/generic/sprofil.c b/sysdeps/generic/sprofil.c
deleted file mode 100644
index 037ed4672e..0000000000
--- a/sysdeps/generic/sprofil.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-
-#include <sys/profil.h>
-#include <sys/time.h>
-
-int
-__sprofil (struct prof *profp, int profcnt, struct timeval *tvp,
-	   unsigned int flags)
-{
-  if (profcnt == 0)
-    return 0;
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__sprofil, sprofil)
diff --git a/sysdeps/generic/sstk.c b/sysdeps/generic/sstk.c
deleted file mode 100644
index 6cba9b7fba..0000000000
--- a/sysdeps/generic/sstk.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-
-/* Increase the size of the stack by INCREMENT,
-   and return the address of the bottom of the stack.  */
-
-void *sstk (int increment) __THROW;
-
-void *
-sstk (increment)
-     int increment;
-{
-  __set_errno (ENOSYS);
-  return (void *) -1;
-}
-
-stub_warning (sstk)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/start.c b/sysdeps/generic/start.c
deleted file mode 100644
index 08f985c482..0000000000
--- a/sysdeps/generic/start.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* This file should define the low-level program entry point,
-   which should set up `__environ', and then do:
-     __libc_init(argc, argv, __environ);
-     exit(main(argc, argv, __environ));
-
-   This file should be prepared to be the first thing in the text section (on
-   Unix systems), or otherwise appropriately special.  */
-
-/* The first piece of initialized data.  */
-int __data_start = 0;
-#ifdef HAVE_WEAK_SYMBOLS
-weak_alias (__data_start, data_start)
-#endif
diff --git a/sysdeps/generic/statfs.c b/sysdeps/generic/statfs.c
deleted file mode 100644
index af4a9ea4e5..0000000000
--- a/sysdeps/generic/statfs.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* statfs -- Return information about the filesystem on which FILE resides.
-   Copyright (C) 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statfs.h>
-#include <stddef.h>
-
-/* Return information about the filesystem on which FILE resides.  */
-int
-__statfs (const char *file, struct statfs *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__statfs)
-weak_alias (__statfs, statfs)
-
-stub_warning (statfs)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/statfs64.c b/sysdeps/generic/statfs64.c
deleted file mode 100644
index cf1a7d82a4..0000000000
--- a/sysdeps/generic/statfs64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1998, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statfs.h>
-
-/* Return information about the filesystem on which FILE resides.  */
-int
-__statfs64 (const char *file, struct statfs64 *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__statfs64, statfs64)
-
-stub_warning (statfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/statvfs.c b/sysdeps/generic/statvfs.c
deleted file mode 100644
index 22e24cfeeb..0000000000
--- a/sysdeps/generic/statvfs.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Return information about the filesystem on which FILE resides.
-   Copyright (C) 1998, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statvfs.h>
-#include <stddef.h>
-
-/* Return information about the filesystem on which FILE resides.  */
-int
-__statvfs (const char *file, struct statvfs *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__statvfs, statvfs)
-libc_hidden_weak (statvfs)
-stub_warning (statvfs)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/statvfs64.c b/sysdeps/generic/statvfs64.c
deleted file mode 100644
index 4424abdbea..0000000000
--- a/sysdeps/generic/statvfs64.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1998, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/statvfs.h>
-
-/* Return information about the filesystem on which FILE resides.  */
-int
-__statvfs64 (const char *file, struct statvfs64 *buf)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__statvfs64, statvfs64)
-
-stub_warning (statvfs64)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index c860030409..2c729ad2f1 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2001,2006 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
@@ -297,8 +297,8 @@ typedef unsigned long long int	uintmax_t;
 # endif
 
 /* Unsigned.  */
-# define UINT8_C(c)	c ## U
-# define UINT16_C(c)	c ## U
+# define UINT8_C(c)	c
+# define UINT16_C(c)	c
 # define UINT32_C(c)	c ## U
 # if __WORDSIZE == 64
 #  define UINT64_C(c)	c ## UL
diff --git a/sysdeps/generic/stime.c b/sysdeps/generic/stime.c
deleted file mode 100644
index 5ed1b040e2..0000000000
--- a/sysdeps/generic/stime.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-#include <stddef.h>
-
-/* Set the system clock to *WHEN.  */
-
-int
-stime (when)
-     const time_t *when;
-{
-  if (when == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (stime)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/stpcpy.c b/sysdeps/generic/stpcpy.c
deleted file mode 100644
index 6e42911fde..0000000000
--- a/sysdeps/generic/stpcpy.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2002, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#undef __stpcpy
-#undef stpcpy
-
-#ifndef weak_alias
-# define __stpcpy stpcpy
-#endif
-
-/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
-char *
-__stpcpy (dest, src)
-     char *dest;
-     const char *src;
-{
-  register char *d = dest;
-  register const char *s = src;
-
-  do
-    *d++ = *s;
-  while (*s++ != '\0');
-
-  return d - 1;
-}
-#ifdef libc_hidden_def
-libc_hidden_def (__stpcpy)
-#endif
-#ifdef weak_alias
-weak_alias (__stpcpy, stpcpy)
-#endif
-#ifdef libc_hidden_builtin_def
-libc_hidden_builtin_def (stpcpy)
-#endif
diff --git a/sysdeps/generic/stpcpy_chk.c b/sysdeps/generic/stpcpy_chk.c
deleted file mode 100644
index dacda0115a..0000000000
--- a/sysdeps/generic/stpcpy_chk.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2002, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-
-/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST.  */
-char *
-__stpcpy_chk (dest, src, destlen)
-     char *dest;
-     const char *src;
-     size_t destlen;
-{
-  register char *d = dest;
-  register const char *s = src;
-
-  do
-    {
-      if (__builtin_expect (destlen-- == 0, 0))
-	__chk_fail ();
-      *d++ = *s;
-    }
-  while (*s++ != '\0');
-
-  return d - 1;
-}
diff --git a/sysdeps/generic/stpncpy.c b/sysdeps/generic/stpncpy.c
deleted file mode 100644
index 164d0f1747..0000000000
--- a/sysdeps/generic/stpncpy.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This is almost copied from strncpy.c, written by Torbjorn Granlund.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef _LIBC
-# include <string.h>
-#else
-# include <sys/types.h>
-#endif
-
-#ifndef weak_alias
-# define __stpncpy stpncpy
-#endif
-
-/* Copy no more than N characters of SRC to DEST, returning the address of
-   the terminating '\0' in DEST, if any, or else DEST + N.  */
-char *
-__stpncpy (dest, src, n)
-     char *dest;
-     const char *src;
-     size_t n;
-{
-  char c;
-  char *s = dest;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-
-      for (;;)
-	{
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == '\0')
-	    break;
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == '\0')
-	    break;
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == '\0')
-	    break;
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == '\0')
-	    break;
-	  if (--n4 == 0)
-	    goto last_chars;
-	}
-      n -= dest - s;
-      goto zero_fill;
-    }
-
- last_chars:
-  n &= 3;
-  if (n == 0)
-    return dest;
-
-  for (;;)
-    {
-      c = *src++;
-      --n;
-      *dest++ = c;
-      if (c == '\0')
-	break;
-      if (n == 0)
-	return dest;
-    }
-
- zero_fill:
-  while (n-- > 0)
-    dest[n] = '\0';
-
-  return dest - 1;
-}
-#ifdef weak_alias
-libc_hidden_def (__stpncpy)
-weak_alias (__stpncpy, stpncpy)
-#endif
diff --git a/sysdeps/generic/strcasecmp.c b/sysdeps/generic/strcasecmp.c
deleted file mode 100644
index 3ae3d67d04..0000000000
--- a/sysdeps/generic/strcasecmp.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 1991,1992,1995,1996,1997,2001,2002, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <ctype.h>
-#include <string.h>
-
-#ifndef _LIBC
-# define __strcasecmp strcasecmp
-# define TOLOWER(Ch) tolower (Ch)
-#else
-# include <locale/localeinfo.h>
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
-#  define __strcasecmp __strcasecmp_l
-# endif
-# define TOLOWER(Ch) __tolower_l ((Ch), loc)
-#endif
-
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define LOCALE_PARAM , loc
-# define LOCALE_PARAM_DECL __locale_t loc;
-#else
-# define LOCALE_PARAM
-# define LOCALE_PARAM_DECL
-#endif
-
-/* Compare S1 and S2, ignoring case, returning less than, equal to or
-   greater than zero if S1 is lexicographically less than,
-   equal to or greater than S2.  */
-int
-__strcasecmp (s1, s2 LOCALE_PARAM)
-     const char *s1;
-     const char *s2;
-     LOCALE_PARAM_DECL
-{
-#if defined _LIBC && !defined USE_IN_EXTENDED_LOCALE_MODEL
-  __locale_t loc = _NL_CURRENT_LOCALE;
-#endif
-  const unsigned char *p1 = (const unsigned char *) s1;
-  const unsigned char *p2 = (const unsigned char *) s2;
-  int result;
-
-  if (p1 == p2)
-    return 0;
-
-  while ((result = TOLOWER (*p1) - TOLOWER (*p2++)) == 0)
-    if (*p1++ == '\0')
-      break;
-
-  return result;
-}
-#ifndef __strcasecmp
-libc_hidden_def (__strcasecmp)
-weak_alias (__strcasecmp, strcasecmp)
-#endif
diff --git a/sysdeps/generic/strcasecmp_l.c b/sysdeps/generic/strcasecmp_l.c
deleted file mode 100644
index 1cd3fe14c5..0000000000
--- a/sysdeps/generic/strcasecmp_l.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define USE_IN_EXTENDED_LOCALE_MODEL	1
-#include <sysdeps/generic/strcasecmp.c>
-
-libc_hidden_def (__strcasecmp_l)
-weak_alias (__strcasecmp_l, strcasecmp_l)
diff --git a/sysdeps/generic/strcasestr.c b/sysdeps/generic/strcasestr.c
deleted file mode 100644
index 1dde43c606..0000000000
--- a/sysdeps/generic/strcasestr.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Return the offset of one string within another.
-   Copyright (C) 1994, 1996-2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * My personal strstr() implementation that beats most other algorithms.
- * Until someone tells me otherwise, I assume that this is the
- * fastest implementation of strstr() in C.
- * I deliberately chose not to comment it.  You should have at least
- * as much fun trying to understand it, as I had to write it :-).
- *
- * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de	*/
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <ctype.h>
-
-#if defined _LIBC || defined HAVE_STRING_H
-# include <string.h>
-#endif
-
-#ifdef _LIBC
-# include <locale/localeinfo.h>
-# define TOLOWER(c) __tolower_l ((unsigned char) c, loc)
-#else
-# define TOLOWER(c) _tolower (c)
-#endif
-
-typedef unsigned chartype;
-
-#undef strcasestr
-#undef __strcasestr
-
-char *
-__strcasestr (phaystack, pneedle)
-     const char *phaystack;
-     const char *pneedle;
-{
-  register const unsigned char *haystack, *needle;
-  register chartype b, c;
-#ifdef _LIBC
-  __locale_t loc = _NL_CURRENT_LOCALE;
-#endif
-
-  haystack = (const unsigned char *) phaystack;
-  needle = (const unsigned char *) pneedle;
-
-  b = TOLOWER (*needle);
-  if (b != '\0')
-    {
-      haystack--;				/* possible ANSI violation */
-      do
-	{
-	  c = *++haystack;
-	  if (c == '\0')
-	    goto ret0;
-	}
-      while (TOLOWER (c) != (int) b);
-
-      c = TOLOWER (*++needle);
-      if (c == '\0')
-	goto foundneedle;
-      ++needle;
-      goto jin;
-
-      for (;;)
-        {
-          register chartype a;
-	  register const unsigned char *rhaystack, *rneedle;
-
-	  do
-	    {
-	      a = *++haystack;
-	      if (a == '\0')
-		goto ret0;
-	      if (TOLOWER (a) == (int) b)
-		break;
-	      a = *++haystack;
-	      if (a == '\0')
-		goto ret0;
-shloop:
-	      ;
-	    }
-          while (TOLOWER (a) != (int) b);
-
-jin:	  a = *++haystack;
-	  if (a == '\0')
-	    goto ret0;
-
-	  if (TOLOWER (a) != (int) c)
-	    goto shloop;
-
-	  rhaystack = haystack-- + 1;
-	  rneedle = needle;
-	  a = TOLOWER (*rneedle);
-
-	  if (TOLOWER (*rhaystack) == (int) a)
-	    do
-	      {
-		if (a == '\0')
-		  goto foundneedle;
-		++rhaystack;
-		a = TOLOWER (*++needle);
-		if (TOLOWER (*rhaystack) != (int) a)
-		  break;
-		if (a == '\0')
-		  goto foundneedle;
-		++rhaystack;
-		a = TOLOWER (*++needle);
-	      }
-	    while (TOLOWER (*rhaystack) == (int) a);
-
-	  needle = rneedle;		/* took the register-poor approach */
-
-	  if (a == '\0')
-	    break;
-        }
-    }
-foundneedle:
-  return (char*) haystack;
-ret0:
-  return 0;
-}
-
-weak_alias (__strcasestr, strcasestr)
diff --git a/sysdeps/generic/strcat.c b/sysdeps/generic/strcat.c
deleted file mode 100644
index eef22add36..0000000000
--- a/sysdeps/generic/strcat.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 1991, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-#undef strcat
-
-/* Append SRC on the end of DEST.  */
-char *
-strcat (dest, src)
-     char *dest;
-     const char *src;
-{
-  char *s1 = dest;
-  const char *s2 = src;
-  reg_char c;
-
-  /* Find the end of the string.  */
-  do
-    c = *s1++;
-  while (c != '\0');
-
-  /* Make S1 point before the next character, so we can increment
-     it while memory is read (wins on pipelined cpus).  */
-  s1 -= 2;
-
-  do
-    {
-      c = *s2++;
-      *++s1 = c;
-    }
-  while (c != '\0');
-
-  return dest;
-}
-libc_hidden_builtin_def (strcat)
diff --git a/sysdeps/generic/strcat_chk.c b/sysdeps/generic/strcat_chk.c
deleted file mode 100644
index b3fb3470b7..0000000000
--- a/sysdeps/generic/strcat_chk.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 1991, 1997, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-
-/* Append SRC on the end of DEST.  */
-char *
-__strcat_chk (dest, src, destlen)
-     char *dest;
-     const char *src;
-     size_t destlen;
-{
-  char *s1 = dest;
-  const char *s2 = src;
-  reg_char c;
-
-  /* Find the end of the string.  */
-  do
-    {
-      if (__builtin_expect (destlen-- == 0, 0))
-	__chk_fail ();
-      c = *s1++;
-    }
-  while (c != '\0');
-
-  /* Make S1 point before the next character, so we can increment
-     it while memory is read (wins on pipelined cpus).  */
-  ++destlen;
-  s1 -= 2;
-
-  do
-    {
-      if (__builtin_expect (destlen-- == 0, 0))
-	__chk_fail ();
-      c = *s2++;
-      *++s1 = c;
-    }
-  while (c != '\0');
-
-  return dest;
-}
diff --git a/sysdeps/generic/strchr.c b/sysdeps/generic/strchr.c
deleted file mode 100644
index c8b7969e85..0000000000
--- a/sysdeps/generic/strchr.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* Copyright (C) 1991,93,94,95,96,97,99,2000,03 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se) and
-   bug fix and commentary by Jim Blandy (jimb@ai.mit.edu);
-   adaptation to strchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
-   and implemented by Roland McGrath (roland@ai.mit.edu).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <stdlib.h>
-
-#undef strchr
-
-/* Find the first occurrence of C in S.  */
-char *
-strchr (s, c_in)
-     const char *s;
-     int c_in;
-{
-  const unsigned char *char_ptr;
-  const unsigned long int *longword_ptr;
-  unsigned long int longword, magic_bits, charmask;
-  unsigned reg_char c;
-
-  c = (unsigned char) c_in;
-
-  /* Handle the first few characters by reading one character at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = s; ((unsigned long int) char_ptr
-		      & (sizeof (longword) - 1)) != 0;
-       ++char_ptr)
-    if (*char_ptr == c)
-      return (void *) char_ptr;
-    else if (*char_ptr == '\0')
-      return NULL;
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
-
-  longword_ptr = (unsigned long int *) char_ptr;
-
-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
-     the "holes."  Note that there is a hole just to the left of
-     each byte, with an extra at the end:
-
-     bits:  01111110 11111110 11111110 11111111
-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-
-     The 1-bits make sure that carries propagate to the next 0-bit.
-     The 0-bits provide holes for carries to fall into.  */
-  switch (sizeof (longword))
-    {
-    case 4: magic_bits = 0x7efefeffL; break;
-    case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
-    default:
-      abort ();
-    }
-
-  /* Set up a longword, each of whose bytes is C.  */
-  charmask = c | (c << 8);
-  charmask |= charmask << 16;
-  if (sizeof (longword) > 4)
-    /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
-    charmask |= (charmask << 16) << 16;
-  if (sizeof (longword) > 8)
-    abort ();
-
-  /* Instead of the traditional loop which tests each character,
-     we will test a longword at a time.  The tricky part is testing
-     if *any of the four* bytes in the longword in question are zero.  */
-  for (;;)
-    {
-      /* We tentatively exit the loop if adding MAGIC_BITS to
-	 LONGWORD fails to change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.  If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-30 is set, there will be a carry
-	 into bit 31, so all of the hole bits will be changed.
-
-	 The one misfire occurs when bits 24-30 are clear and bit
-	 31 is set; in this case, the hole at bit 31 is not
-	 changed.  If we had access to the processor carry flag,
-	 we could close this loophole by putting the fourth hole
-	 at bit 32!
-
-	 So it ignores everything except 128's, when they're aligned
-	 properly.
-
-	 3) But wait!  Aren't we looking for C as well as zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-      longword = *longword_ptr++;
-
-      /* Add MAGIC_BITS to LONGWORD.  */
-      if ((((longword + magic_bits)
-
-	    /* Set those bits that were unchanged by the addition.  */
-	    ^ ~longword)
-
-	   /* Look at only the hole bits.  If any of the hole bits
-	      are unchanged, most likely one of the bytes was a
-	      zero.  */
-	   & ~magic_bits) != 0 ||
-
-	  /* That caught zeroes.  Now test for C.  */
-	  ((((longword ^ charmask) + magic_bits) ^ ~(longword ^ charmask))
-	   & ~magic_bits) != 0)
-	{
-	  /* Which of the bytes was C or zero?
-	     If none of them were, it was a misfire; continue the search.  */
-
-	  const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
-
-	  if (*cp == c)
-	    return (char *) cp;
-	  else if (*cp == '\0')
-	    return NULL;
-	  if (*++cp == c)
-	    return (char *) cp;
-	  else if (*cp == '\0')
-	    return NULL;
-	  if (*++cp == c)
-	    return (char *) cp;
-	  else if (*cp == '\0')
-	    return NULL;
-	  if (*++cp == c)
-	    return (char *) cp;
-	  else if (*cp == '\0')
-	    return NULL;
-	  if (sizeof (longword) > 4)
-	    {
-	      if (*++cp == c)
-		return (char *) cp;
-	      else if (*cp == '\0')
-		return NULL;
-	      if (*++cp == c)
-		return (char *) cp;
-	      else if (*cp == '\0')
-		return NULL;
-	      if (*++cp == c)
-		return (char *) cp;
-	      else if (*cp == '\0')
-		return NULL;
-	      if (*++cp == c)
-		return (char *) cp;
-	      else if (*cp == '\0')
-		return NULL;
-	    }
-	}
-    }
-
-  return NULL;
-}
-
-#ifdef weak_alias
-#undef index
-weak_alias (strchr, index)
-#endif
-libc_hidden_builtin_def (strchr)
diff --git a/sysdeps/generic/strchrnul.c b/sysdeps/generic/strchrnul.c
deleted file mode 100644
index f04b303b82..0000000000
--- a/sysdeps/generic/strchrnul.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Copyright (C) 1991,93,94,95,96,97,99,2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se) and
-   bug fix and commentary by Jim Blandy (jimb@ai.mit.edu);
-   adaptation to strchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
-   and implemented by Roland McGrath (roland@ai.mit.edu).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-#include <stdlib.h>
-
-#undef __strchrnul
-#undef strchrnul
-
-/* Find the first occurrence of C in S or the final NUL byte.  */
-char *
-__strchrnul (s, c_in)
-     const char *s;
-     int c_in;
-{
-  const unsigned char *char_ptr;
-  const unsigned long int *longword_ptr;
-  unsigned long int longword, magic_bits, charmask;
-  unsigned reg_char c;
-
-  c = (unsigned char) c_in;
-
-  /* Handle the first few characters by reading one character at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = s; ((unsigned long int) char_ptr
-		      & (sizeof (longword) - 1)) != 0;
-       ++char_ptr)
-    if (*char_ptr == c || *char_ptr == '\0')
-      return (void *) char_ptr;
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
-
-  longword_ptr = (unsigned long int *) char_ptr;
-
-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
-     the "holes."  Note that there is a hole just to the left of
-     each byte, with an extra at the end:
-
-     bits:  01111110 11111110 11111110 11111111
-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-
-     The 1-bits make sure that carries propagate to the next 0-bit.
-     The 0-bits provide holes for carries to fall into.  */
-  switch (sizeof (longword))
-    {
-    case 4: magic_bits = 0x7efefeffL; break;
-    case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
-    default:
-      abort ();
-    }
-
-  /* Set up a longword, each of whose bytes is C.  */
-  charmask = c | (c << 8);
-  charmask |= charmask << 16;
-  if (sizeof (longword) > 4)
-    /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
-    charmask |= (charmask << 16) << 16;
-  if (sizeof (longword) > 8)
-    abort ();
-
-  /* Instead of the traditional loop which tests each character,
-     we will test a longword at a time.  The tricky part is testing
-     if *any of the four* bytes in the longword in question are zero.  */
-  for (;;)
-    {
-      /* We tentatively exit the loop if adding MAGIC_BITS to
-	 LONGWORD fails to change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.  If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-30 is set, there will be a carry
-	 into bit 31, so all of the hole bits will be changed.
-
-	 The one misfire occurs when bits 24-30 are clear and bit
-	 31 is set; in this case, the hole at bit 31 is not
-	 changed.  If we had access to the processor carry flag,
-	 we could close this loophole by putting the fourth hole
-	 at bit 32!
-
-	 So it ignores everything except 128's, when they're aligned
-	 properly.
-
-	 3) But wait!  Aren't we looking for C as well as zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-      longword = *longword_ptr++;
-
-      /* Add MAGIC_BITS to LONGWORD.  */
-      if ((((longword + magic_bits)
-
-	    /* Set those bits that were unchanged by the addition.  */
-	    ^ ~longword)
-
-	   /* Look at only the hole bits.  If any of the hole bits
-	      are unchanged, most likely one of the bytes was a
-	      zero.  */
-	   & ~magic_bits) != 0 ||
-
-	  /* That caught zeroes.  Now test for C.  */
-	  ((((longword ^ charmask) + magic_bits) ^ ~(longword ^ charmask))
-	   & ~magic_bits) != 0)
-	{
-	  /* Which of the bytes was C or zero?
-	     If none of them were, it was a misfire; continue the search.  */
-
-	  const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
-
-	  if (*cp == c || *cp == '\0')
-	    return (char *) cp;
-	  if (*++cp == c || *cp == '\0')
-	    return (char *) cp;
-	  if (*++cp == c || *cp == '\0')
-	    return (char *) cp;
-	  if (*++cp == c || *cp == '\0')
-	    return (char *) cp;
-	  if (sizeof (longword) > 4)
-	    {
-	      if (*++cp == c || *cp == '\0')
-		return (char *) cp;
-	      if (*++cp == c || *cp == '\0')
-		return (char *) cp;
-	      if (*++cp == c || *cp == '\0')
-		return (char *) cp;
-	      if (*++cp == c || *cp == '\0')
-		return (char *) cp;
-	    }
-	}
-    }
-
-  /* This should never happen.  */
-  return NULL;
-}
-
-weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/generic/strcmp.c b/sysdeps/generic/strcmp.c
deleted file mode 100644
index bd53c05c6e..0000000000
--- a/sysdeps/generic/strcmp.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-#undef strcmp
-
-/* Compare S1 and S2, returning less than, equal to or
-   greater than zero if S1 is lexicographically less than,
-   equal to or greater than S2.  */
-int
-strcmp (p1, p2)
-     const char *p1;
-     const char *p2;
-{
-  register const unsigned char *s1 = (const unsigned char *) p1;
-  register const unsigned char *s2 = (const unsigned char *) p2;
-  unsigned reg_char c1, c2;
-
-  do
-    {
-      c1 = (unsigned char) *s1++;
-      c2 = (unsigned char) *s2++;
-      if (c1 == '\0')
-	return c1 - c2;
-    }
-  while (c1 == c2);
-
-  return c1 - c2;
-}
-libc_hidden_builtin_def (strcmp)
diff --git a/sysdeps/generic/strcpy.c b/sysdeps/generic/strcpy.c
deleted file mode 100644
index c736a60762..0000000000
--- a/sysdeps/generic/strcpy.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1991, 1997, 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <string.h>
-#include <memcopy.h>
-#include <bp-checks.h>
-
-#undef strcpy
-
-/* Copy SRC to DEST.  */
-char *
-strcpy (dest, src)
-     char *dest;
-     const char *src;
-{
-  reg_char c;
-  char *__unbounded s = (char *__unbounded) CHECK_BOUNDS_LOW (src);
-  const ptrdiff_t off = CHECK_BOUNDS_LOW (dest) - s - 1;
-  size_t n;
-
-  do
-    {
-      c = *s++;
-      s[off] = c;
-    }
-  while (c != '\0');
-
-  n = s - src;
-  (void) CHECK_BOUNDS_HIGH (src + n);
-  (void) CHECK_BOUNDS_HIGH (dest + n);
-
-  return dest;
-}
-libc_hidden_builtin_def (strcpy)
diff --git a/sysdeps/generic/strcpy_chk.c b/sysdeps/generic/strcpy_chk.c
deleted file mode 100644
index a4d909feda..0000000000
--- a/sysdeps/generic/strcpy_chk.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 1991, 1997, 2000, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <string.h>
-#include <memcopy.h>
-
-#undef strcpy
-
-/* Copy SRC to DEST with checking of destination buffer overflow.  */
-char *
-__strcpy_chk (dest, src, destlen)
-     char *dest;
-     const char *src;
-     size_t destlen;
-{
-  reg_char c;
-  char *s = (char *) src;
-  const ptrdiff_t off = dest - s;
-
-  while (__builtin_expect (destlen >= 4, 0))
-    {
-      c = s[0];
-      s[off] = c;
-      if (c == '\0')
-        return dest;
-      c = s[1];
-      s[off + 1] = c;
-      if (c == '\0')
-        return dest;
-      c = s[2];
-      s[off + 2] = c;
-      if (c == '\0')
-        return dest;
-      c = s[3];
-      s[off + 3] = c;
-      if (c == '\0')
-        return dest;
-      destlen -= 4;
-      s += 4;
-    }
-
-  do
-    {
-      if (__builtin_expect (destlen-- == 0, 0))
-        __chk_fail ();
-      c = *s;
-      *(s++ + off) = c;
-    }
-  while (c != '\0');
-
-  return dest;
-}
diff --git a/sysdeps/generic/strcspn.c b/sysdeps/generic/strcspn.c
deleted file mode 100644
index f359d578f7..0000000000
--- a/sysdeps/generic/strcspn.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1991, 1994, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if defined _LIBC || HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-# ifndef strchr
-#  define strchr index
-# endif
-#endif
-
-#undef strcspn
-
-/* Return the length of the maximum initial segment of S
-   which contains no characters from REJECT.  */
-size_t
-strcspn (s, reject)
-     const char *s;
-     const char *reject;
-{
-  size_t count = 0;
-
-  while (*s != '\0')
-    if (strchr (reject, *s++) == NULL)
-      ++count;
-    else
-      return count;
-
-  return count;
-}
-libc_hidden_builtin_def (strcspn)
diff --git a/sysdeps/generic/string-inlines.c b/sysdeps/generic/string-inlines.c
deleted file mode 100644
index 89a5baab5d..0000000000
--- a/sysdeps/generic/string-inlines.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*  <bits/string.h> and <bits/string2.h> declare some extern inline
-    functions.  These functions are declared additionally here if
-    inlining is not possible.  */
-
-#undef __USE_STRING_INLINES
-#define __USE_STRING_INLINES
-#define _FORCE_INLINES
-#define __STRING_INLINE /* empty */
-#define __NO_INLINE__
-
-#include <string.h>
-#undef index
-#undef rindex
-
-#undef __NO_INLINE__
-#include <bits/string.h>
-#include <bits/string2.h>
diff --git a/sysdeps/generic/strlen.c b/sysdeps/generic/strlen.c
deleted file mode 100644
index 9bc9db68f7..0000000000
--- a/sysdeps/generic/strlen.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Copyright (C) 1991, 1993, 1997, 2000, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Written by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se);
-   commentary by Jim Blandy (jimb@ai.mit.edu).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <stdlib.h>
-
-#undef strlen
-
-/* Return the length of the null-terminated string STR.  Scan for
-   the null terminator quickly by testing four bytes at a time.  */
-size_t
-strlen (str)
-     const char *str;
-{
-  const char *char_ptr;
-  const unsigned long int *longword_ptr;
-  unsigned long int longword, magic_bits, himagic, lomagic;
-
-  /* Handle the first few characters by reading one character at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = str; ((unsigned long int) char_ptr
-			& (sizeof (longword) - 1)) != 0;
-       ++char_ptr)
-    if (*char_ptr == '\0')
-      return char_ptr - str;
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
-
-  longword_ptr = (unsigned long int *) char_ptr;
-
-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
-     the "holes."  Note that there is a hole just to the left of
-     each byte, with an extra at the end:
-
-     bits:  01111110 11111110 11111110 11111111
-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-
-     The 1-bits make sure that carries propagate to the next 0-bit.
-     The 0-bits provide holes for carries to fall into.  */
-  magic_bits = 0x7efefeffL;
-  himagic = 0x80808080L;
-  lomagic = 0x01010101L;
-  if (sizeof (longword) > 4)
-    {
-      /* 64-bit version of the magic.  */
-      /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
-      magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
-      himagic = ((himagic << 16) << 16) | himagic;
-      lomagic = ((lomagic << 16) << 16) | lomagic;
-    }
-  if (sizeof (longword) > 8)
-    abort ();
-
-  /* Instead of the traditional loop which tests each character,
-     we will test a longword at a time.  The tricky part is testing
-     if *any of the four* bytes in the longword in question are zero.  */
-  for (;;)
-    {
-      /* We tentatively exit the loop if adding MAGIC_BITS to
-	 LONGWORD fails to change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.  If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-30 is set, there will be a carry
-	 into bit 31, so all of the hole bits will be changed.
-
-	 The one misfire occurs when bits 24-30 are clear and bit
-	 31 is set; in this case, the hole at bit 31 is not
-	 changed.  If we had access to the processor carry flag,
-	 we could close this loophole by putting the fourth hole
-	 at bit 32!
-
-	 So it ignores everything except 128's, when they're aligned
-	 properly.  */
-
-      longword = *longword_ptr++;
-
-      if (
-#if 0
-	  /* Add MAGIC_BITS to LONGWORD.  */
-	  (((longword + magic_bits)
-
-	    /* Set those bits that were unchanged by the addition.  */
-	    ^ ~longword)
-
-	   /* Look at only the hole bits.  If any of the hole bits
-	      are unchanged, most likely one of the bytes was a
-	      zero.  */
-	   & ~magic_bits)
-#else
-	  ((longword - lomagic) & himagic)
-#endif
-	  != 0)
-	{
-	  /* Which of the bytes was the zero?  If none of them were, it was
-	     a misfire; continue the search.  */
-
-	  const char *cp = (const char *) (longword_ptr - 1);
-
-	  if (cp[0] == 0)
-	    return cp - str;
-	  if (cp[1] == 0)
-	    return cp - str + 1;
-	  if (cp[2] == 0)
-	    return cp - str + 2;
-	  if (cp[3] == 0)
-	    return cp - str + 3;
-	  if (sizeof (longword) > 4)
-	    {
-	      if (cp[4] == 0)
-		return cp - str + 4;
-	      if (cp[5] == 0)
-		return cp - str + 5;
-	      if (cp[6] == 0)
-		return cp - str + 6;
-	      if (cp[7] == 0)
-		return cp - str + 7;
-	    }
-	}
-    }
-}
-libc_hidden_builtin_def (strlen)
diff --git a/sysdeps/generic/strncase.c b/sysdeps/generic/strncase.c
deleted file mode 100644
index a55aaf6a3a..0000000000
--- a/sysdeps/generic/strncase.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Compare at most N characters of two strings without taking care for
-   the case.
-   Copyright (C) 1992, 1996, 1997, 2001, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <ctype.h>
-
-#ifndef weak_alias
-# define __strncasecmp strncasecmp
-# define TOLOWER(Ch) tolower (Ch)
-#else
-# include <locale/localeinfo.h>
-# ifdef USE_IN_EXTENDED_LOCALE_MODEL
-#  define __strncasecmp __strncasecmp_l
-# endif
-# define TOLOWER(Ch) __tolower_l ((Ch), loc)
-#endif
-
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define LOCALE_PARAM , loc
-# define LOCALE_PARAM_DECL __locale_t loc;
-#else
-# define LOCALE_PARAM
-# define LOCALE_PARAM_DECL
-#endif
-
-/* Compare no more than N characters of S1 and S2,
-   ignoring case, returning less than, equal to or
-   greater than zero if S1 is lexicographically less
-   than, equal to or greater than S2.  */
-int
-__strncasecmp (s1, s2, n LOCALE_PARAM)
-     const char *s1;
-     const char *s2;
-     size_t n;
-     LOCALE_PARAM_DECL
-{
-#if defined _LIBC && !defined USE_IN_EXTENDED_LOCALE_MODEL
-  __locale_t loc = _NL_CURRENT_LOCALE;
-#endif
-  const unsigned char *p1 = (const unsigned char *) s1;
-  const unsigned char *p2 = (const unsigned char *) s2;
-  int result;
-
-  if (p1 == p2 || n == 0)
-    return 0;
-
-  while ((result = TOLOWER (*p1) - TOLOWER (*p2++)) == 0)
-    if (*p1++ == '\0' || --n == 0)
-      break;
-
-  return result;
-}
-#ifndef __strncasecmp
-weak_alias (__strncasecmp, strncasecmp)
-#endif
diff --git a/sysdeps/generic/strncase_l.c b/sysdeps/generic/strncase_l.c
deleted file mode 100644
index 0e61ebec7d..0000000000
--- a/sysdeps/generic/strncase_l.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Compare at most N characters of two strings without taking care for
-   the case using given locale.
-   Copyright (C) 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define USE_IN_EXTENDED_LOCALE_MODEL	1
-#include <sysdeps/generic/strncase.c>
-
-libc_hidden_def (__strncasecmp_l)
-weak_alias (__strncasecmp_l, strncasecmp_l)
diff --git a/sysdeps/generic/strncat.c b/sysdeps/generic/strncat.c
deleted file mode 100644
index 2e2de11508..0000000000
--- a/sysdeps/generic/strncat.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (C) 1991, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#ifdef _LIBC
-# include <memcopy.h>
-#else
-typedef char reg_char;
-#endif
-
-#undef strncat
-
-char *
-strncat (s1, s2, n)
-     char *s1;
-     const char *s2;
-     size_t n;
-{
-  reg_char c;
-  char *s = s1;
-
-  /* Find the end of S1.  */
-  do
-    c = *s1++;
-  while (c != '\0');
-
-  /* Make S1 point before next character, so we can increment
-     it while memory is read (wins on pipelined cpus).  */
-  s1 -= 2;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-      do
-	{
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	} while (--n4 > 0);
-      n &= 3;
-    }
-
-  while (n > 0)
-    {
-      c = *s2++;
-      *++s1 = c;
-      if (c == '\0')
-	return s;
-      n--;
-    }
-
-  if (c != '\0')
-    *++s1 = '\0';
-
-  return s;
-}
diff --git a/sysdeps/generic/strncat_chk.c b/sysdeps/generic/strncat_chk.c
deleted file mode 100644
index 953b435a4b..0000000000
--- a/sysdeps/generic/strncat_chk.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (C) 1991, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#include <memcopy.h>
-
-
-char *
-__strncat_chk (s1, s2, n, s1len)
-     char *s1;
-     const char *s2;
-     size_t n;
-     size_t s1len;
-{
-  reg_char c;
-  char *s = s1;
-
-  /* Find the end of S1.  */
-  do
-    {
-      if (__builtin_expect (s1len-- == 0, 0))
-	__chk_fail ();
-      c = *s1++;
-    }
-  while (c != '\0');
-
-  /* Make S1 point before next character, so we can increment
-     it while memory is read (wins on pipelined cpus).  */
-  ++s1len;
-  s1 -= 2;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-      do
-	{
-	  if (__builtin_expect (s1len-- == 0, 0))
-	    __chk_fail ();
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	  if (__builtin_expect (s1len-- == 0, 0))
-	    __chk_fail ();
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	  if (__builtin_expect (s1len-- == 0, 0))
-	    __chk_fail ();
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	  if (__builtin_expect (s1len-- == 0, 0))
-	    __chk_fail ();
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    return s;
-	} while (--n4 > 0);
-      n &= 3;
-    }
-
-  while (n > 0)
-    {
-      if (__builtin_expect (s1len-- == 0, 0))
-	__chk_fail ();
-      c = *s2++;
-      *++s1 = c;
-      if (c == '\0')
-	return s;
-      n--;
-    }
-
-  if (c != '\0')
-    {
-      if (__builtin_expect (s1len-- == 0, 0))
-	__chk_fail ();
-      *++s1 = '\0';
-    }
-
-  return s;
-}
diff --git a/sysdeps/generic/strncmp.c b/sysdeps/generic/strncmp.c
deleted file mode 100644
index 1adb2c0ebd..0000000000
--- a/sysdeps/generic/strncmp.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-#undef strncmp
-
-/* Compare no more than N characters of S1 and S2,
-   returning less than, equal to or greater than zero
-   if S1 is lexicographically less than, equal to or
-   greater than S2.  */
-int
-strncmp (s1, s2, n)
-     const char *s1;
-     const char *s2;
-     size_t n;
-{
-  unsigned reg_char c1 = '\0';
-  unsigned reg_char c2 = '\0';
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-      do
-	{
-	  c1 = (unsigned char) *s1++;
-	  c2 = (unsigned char) *s2++;
-	  if (c1 == '\0' || c1 != c2)
-	    return c1 - c2;
-	  c1 = (unsigned char) *s1++;
-	  c2 = (unsigned char) *s2++;
-	  if (c1 == '\0' || c1 != c2)
-	    return c1 - c2;
-	  c1 = (unsigned char) *s1++;
-	  c2 = (unsigned char) *s2++;
-	  if (c1 == '\0' || c1 != c2)
-	    return c1 - c2;
-	  c1 = (unsigned char) *s1++;
-	  c2 = (unsigned char) *s2++;
-	  if (c1 == '\0' || c1 != c2)
-	    return c1 - c2;
-	} while (--n4 > 0);
-      n &= 3;
-    }
-
-  while (n > 0)
-    {
-      c1 = (unsigned char) *s1++;
-      c2 = (unsigned char) *s2++;
-      if (c1 == '\0' || c1 != c2)
-	return c1 - c2;
-      n--;
-    }
-
-  return c1 - c2;
-}
-libc_hidden_builtin_def (strncmp)
diff --git a/sysdeps/generic/strncpy.c b/sysdeps/generic/strncpy.c
deleted file mode 100644
index f32612e1cf..0000000000
--- a/sysdeps/generic/strncpy.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (C) 1991, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-#undef strncpy
-
-char *
-strncpy (s1, s2, n)
-     char *s1;
-     const char *s2;
-     size_t n;
-{
-  reg_char c;
-  char *s = s1;
-
-  --s1;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-
-      for (;;)
-	{
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  if (--n4 == 0)
-	    goto last_chars;
-	}
-      n = n - (s1 - s) - 1;
-      if (n == 0)
-	return s;
-      goto zero_fill;
-    }
-
- last_chars:
-  n &= 3;
-  if (n == 0)
-    return s;
-
-  do
-    {
-      c = *s2++;
-      *++s1 = c;
-      if (--n == 0)
-	return s;
-    }
-  while (c != '\0');
-
- zero_fill:
-  do
-    *++s1 = '\0';
-  while (--n > 0);
-
-  return s;
-}
-libc_hidden_builtin_def (strncpy)
diff --git a/sysdeps/generic/strncpy_chk.c b/sysdeps/generic/strncpy_chk.c
deleted file mode 100644
index bdede7738b..0000000000
--- a/sysdeps/generic/strncpy_chk.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 1991, 1997, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-#include <memcopy.h>
-
-
-char *
-__strncpy_chk (s1, s2, n, s1len)
-     char *s1;
-     const char *s2;
-     size_t n;
-     size_t s1len;
-{
-  reg_char c;
-  char *s = s1;
-
-  if (__builtin_expect (s1len < n, 0))
-    __chk_fail ();
-
-  --s1;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-
-      for (;;)
-	{
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  if (--n4 == 0)
-	    goto last_chars;
-	}
-      n = n - (s1 - s) - 1;
-      if (n == 0)
-	return s;
-      goto zero_fill;
-    }
-
- last_chars:
-  n &= 3;
-  if (n == 0)
-    return s;
-
-  do
-    {
-      c = *s2++;
-      *++s1 = c;
-      if (--n == 0)
-	return s;
-    }
-  while (c != '\0');
-
- zero_fill:
-  do
-    *++s1 = '\0';
-  while (--n > 0);
-
-  return s;
-}
diff --git a/sysdeps/generic/strnlen.c b/sysdeps/generic/strnlen.c
deleted file mode 100644
index c83520e349..0000000000
--- a/sysdeps/generic/strnlen.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Find the length of STRING, but scan at most MAXLEN characters.
-   Copyright (C) 1991, 1993, 1997, 2000, 2001 Free Software Foundation, Inc.
-   Contributed by Jakub Jelinek <jakub@redhat.com>.
-
-   Based on strlen written by Torbjorn Granlund (tege@sics.se),
-   with help from Dan Sahlin (dan@sics.se);
-   commentary by Jim Blandy (jimb@ai.mit.edu).
-
-   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; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include <string.h>
-#include <stdlib.h>
-
-/* Find the length of S, but scan at most MAXLEN characters.  If no
-   '\0' terminator is found in that many characters, return MAXLEN.  */
-size_t
-__strnlen (const char *str, size_t maxlen)
-{
-  const char *char_ptr, *end_ptr = str + maxlen;
-  const unsigned long int *longword_ptr;
-  unsigned long int longword, magic_bits, himagic, lomagic;
-
-  if (maxlen == 0)
-    return 0;
-
-  if (__builtin_expect (end_ptr < str, 0))
-    end_ptr = (const char *) ~0UL;
-
-  /* Handle the first few characters by reading one character at a time.
-     Do this until CHAR_PTR is aligned on a longword boundary.  */
-  for (char_ptr = str; ((unsigned long int) char_ptr
-			& (sizeof (longword) - 1)) != 0;
-       ++char_ptr)
-    if (*char_ptr == '\0')
-      {
-	if (char_ptr > end_ptr)
-	  char_ptr = end_ptr;
-	return char_ptr - str;
-      }
-
-  /* All these elucidatory comments refer to 4-byte longwords,
-     but the theory applies equally well to 8-byte longwords.  */
-
-  longword_ptr = (unsigned long int *) char_ptr;
-
-  /* Bits 31, 24, 16, and 8 of this number are zero.  Call these bits
-     the "holes."  Note that there is a hole just to the left of
-     each byte, with an extra at the end:
-
-     bits:  01111110 11111110 11111110 11111111
-     bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
-
-     The 1-bits make sure that carries propagate to the next 0-bit.
-     The 0-bits provide holes for carries to fall into.  */
-  magic_bits = 0x7efefeffL;
-  himagic = 0x80808080L;
-  lomagic = 0x01010101L;
-  if (sizeof (longword) > 4)
-    {
-      /* 64-bit version of the magic.  */
-      /* Do the shift in two steps to avoid a warning if long has 32 bits.  */
-      magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
-      himagic = ((himagic << 16) << 16) | himagic;
-      lomagic = ((lomagic << 16) << 16) | lomagic;
-    }
-  if (sizeof (longword) > 8)
-    abort ();
-
-  /* Instead of the traditional loop which tests each character,
-     we will test a longword at a time.  The tricky part is testing
-     if *any of the four* bytes in the longword in question are zero.  */
-  while (longword_ptr < (unsigned long int *) end_ptr)
-    {
-      /* We tentatively exit the loop if adding MAGIC_BITS to
-	 LONGWORD fails to change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.  If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-30 is set, there will be a carry
-	 into bit 31, so all of the hole bits will be changed.
-
-	 The one misfire occurs when bits 24-30 are clear and bit
-	 31 is set; in this case, the hole at bit 31 is not
-	 changed.  If we had access to the processor carry flag,
-	 we could close this loophole by putting the fourth hole
-	 at bit 32!
-
-	 So it ignores everything except 128's, when they're aligned
-	 properly.  */
-
-      longword = *longword_ptr++;
-
-      if ((longword - lomagic) & himagic)
-	{
-	  /* Which of the bytes was the zero?  If none of them were, it was
-	     a misfire; continue the search.  */
-
-	  const char *cp = (const char *) (longword_ptr - 1);
-
-	  char_ptr = cp;
-	  if (cp[0] == 0)
-	    break;
-	  char_ptr = cp + 1;
-	  if (cp[1] == 0)
-	    break;
-	  char_ptr = cp + 2;
-	  if (cp[2] == 0)
-	    break;
-	  char_ptr = cp + 3;
-	  if (cp[3] == 0)
-	    break;
-	  if (sizeof (longword) > 4)
-	    {
-	      char_ptr = cp + 4;
-	      if (cp[4] == 0)
-		break;
-	      char_ptr = cp + 5;
-	      if (cp[5] == 0)
-		break;
-	      char_ptr = cp + 6;
-	      if (cp[6] == 0)
-		break;
-	      char_ptr = cp + 7;
-	      if (cp[7] == 0)
-		break;
-	    }
-	}
-      char_ptr = end_ptr;
-    }
-
-  if (char_ptr > end_ptr)
-    char_ptr = end_ptr;
-  return char_ptr - str;
-}
-weak_alias (__strnlen, strnlen)
diff --git a/sysdeps/generic/strpbrk.c b/sysdeps/generic/strpbrk.c
deleted file mode 100644
index 620cfab7f9..0000000000
--- a/sysdeps/generic/strpbrk.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1994, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if defined _LIBC || defined HAVE_CONFIG_H
-# include <string.h>
-#endif
-
-#undef strpbrk
-
-/* Find the first occurrence in S of any character in ACCEPT.  */
-char *
-strpbrk (s, accept)
-     const char *s;
-     const char *accept;
-{
-  while (*s != '\0')
-    {
-      const char *a = accept;
-      while (*a != '\0')
-	if (*a++ == *s)
-	  return (char *) s;
-      ++s;
-    }
-
-  return NULL;
-}
-libc_hidden_builtin_def (strpbrk)
diff --git a/sysdeps/generic/strrchr.c b/sysdeps/generic/strrchr.c
deleted file mode 100644
index 64118b87ef..0000000000
--- a/sysdeps/generic/strrchr.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#undef strrchr
-
-/* Find the last occurrence of C in S.  */
-char *
-strrchr (const char *s, int c)
-{
-  register const char *found, *p;
-
-  c = (unsigned char) c;
-
-  /* Since strchr is fast, we use it rather than the obvious loop.  */
-
-  if (c == '\0')
-    return strchr (s, '\0');
-
-  found = NULL;
-  while ((p = strchr (s, c)) != NULL)
-    {
-      found = p;
-      s = p + 1;
-    }
-
-  return (char *) found;
-}
-
-#ifdef weak_alias
-#undef rindex
-weak_alias (strrchr, rindex)
-#endif
-libc_hidden_builtin_def (strrchr)
diff --git a/sysdeps/generic/strsep.c b/sysdeps/generic/strsep.c
deleted file mode 100644
index e5342f7a22..0000000000
--- a/sysdeps/generic/strsep.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 1992, 93, 96, 97, 98, 99, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#undef __strsep
-#undef strsep
-
-char *
-__strsep (char **stringp, const char *delim)
-{
-  char *begin, *end;
-
-  begin = *stringp;
-  if (begin == NULL)
-    return NULL;
-
-  /* A frequent case is when the delimiter string contains only one
-     character.  Here we don't need to call the expensive `strpbrk'
-     function and instead work using `strchr'.  */
-  if (delim[0] == '\0' || delim[1] == '\0')
-    {
-      char ch = delim[0];
-
-      if (ch == '\0')
-	end = NULL;
-      else
-	{
-	  if (*begin == ch)
-	    end = begin;
-	  else if (*begin == '\0')
-	    end = NULL;
-	  else
-	    end = strchr (begin + 1, ch);
-	}
-    }
-  else
-    /* Find the end of the token.  */
-    end = strpbrk (begin, delim);
-
-  if (end)
-    {
-      /* Terminate the token and set *STRINGP past NUL character.  */
-      *end++ = '\0';
-      *stringp = end;
-    }
-  else
-    /* No more delimiters; this is the last token.  */
-    *stringp = NULL;
-
-  return begin;
-}
-weak_alias (__strsep, strsep)
-strong_alias (__strsep, __strsep_g)
-libc_hidden_def (__strsep_g)
diff --git a/sysdeps/generic/strspn.c b/sysdeps/generic/strspn.c
deleted file mode 100644
index dc17ea8cbc..0000000000
--- a/sysdeps/generic/strspn.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1991, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#undef strspn
-
-/* Return the length of the maximum initial segment
-   of S which contains only characters in ACCEPT.  */
-size_t
-strspn (s, accept)
-     const char *s;
-     const char *accept;
-{
-  const char *p;
-  const char *a;
-  size_t count = 0;
-
-  for (p = s; *p != '\0'; ++p)
-    {
-      for (a = accept; *a != '\0'; ++a)
-	if (*p == *a)
-	  break;
-      if (*a == '\0')
-	return count;
-      else
-	++count;
-    }
-
-  return count;
-}
-libc_hidden_builtin_def (strspn)
diff --git a/sysdeps/generic/strstr.c b/sysdeps/generic/strstr.c
deleted file mode 100644
index fce1f2a756..0000000000
--- a/sysdeps/generic/strstr.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Return the offset of one string within another.
-   Copyright (C) 1994,1996,1997,2000,2001,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * My personal strstr() implementation that beats most other algorithms.
- * Until someone tells me otherwise, I assume that this is the
- * fastest implementation of strstr() in C.
- * I deliberately chose not to comment it.  You should have at least
- * as much fun trying to understand it, as I had to write it :-).
- *
- * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de	*/
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if defined _LIBC || defined HAVE_STRING_H
-# include <string.h>
-#endif
-
-typedef unsigned chartype;
-
-#undef strstr
-
-char *
-strstr (phaystack, pneedle)
-     const char *phaystack;
-     const char *pneedle;
-{
-  const unsigned char *haystack, *needle;
-  chartype b;
-  const unsigned char *rneedle;
-
-  haystack = (const unsigned char *) phaystack;
-
-  if ((b = *(needle = (const unsigned char *) pneedle)))
-    {
-      chartype c;
-      haystack--;		/* possible ANSI violation */
-
-      {
-	chartype a;
-	do
-	  if (!(a = *++haystack))
-	    goto ret0;
-	while (a != b);
-      }
-
-      if (!(c = *++needle))
-	goto foundneedle;
-      ++needle;
-      goto jin;
-
-      for (;;)
-	{
-	  {
-	    chartype a;
-	    if (0)
-	    jin:{
-		if ((a = *++haystack) == c)
-		  goto crest;
-	      }
-	    else
-	      a = *++haystack;
-	    do
-	      {
-		for (; a != b; a = *++haystack)
-		  {
-		    if (!a)
-		      goto ret0;
-		    if ((a = *++haystack) == b)
-		      break;
-		    if (!a)
-		      goto ret0;
-		  }
-	      }
-	    while ((a = *++haystack) != c);
-	  }
-	crest:
-	  {
-	    chartype a;
-	    {
-	      const unsigned char *rhaystack;
-	      if (*(rhaystack = haystack-- + 1) == (a = *(rneedle = needle)))
-		do
-		  {
-		    if (!a)
-		      goto foundneedle;
-		    if (*++rhaystack != (a = *++needle))
-		      break;
-		    if (!a)
-		      goto foundneedle;
-		  }
-		while (*++rhaystack == (a = *++needle));
-	      needle = rneedle;	/* took the register-poor aproach */
-	    }
-	    if (!a)
-	      break;
-	  }
-	}
-    }
-foundneedle:
-  return (char *) haystack;
-ret0:
-  return 0;
-}
-libc_hidden_builtin_def (strstr)
diff --git a/sysdeps/generic/strtoimax.c b/sysdeps/generic/strtoimax.c
deleted file mode 100644
index f1de70f320..0000000000
--- a/sysdeps/generic/strtoimax.c
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `intmax_t' type"
diff --git a/sysdeps/generic/strtok.c b/sysdeps/generic/strtok.c
deleted file mode 100644
index f45b760f74..0000000000
--- a/sysdeps/generic/strtok.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 1991,1996,1997,1999,2000,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-
-static char *olds;
-
-#undef strtok
-
-/* Parse S into tokens separated by characters in DELIM.
-   If S is NULL, the last string strtok() was called with is
-   used.  For example:
-	char s[] = "-abc-=-def";
-	x = strtok(s, "-");		// x = "abc"
-	x = strtok(NULL, "-=");		// x = "def"
-	x = strtok(NULL, "=");		// x = NULL
-		// s = "abc\0-def\0"
-*/
-char *
-strtok (s, delim)
-     char *s;
-     const char *delim;
-{
-  char *token;
-
-  if (s == NULL)
-    s = olds;
-
-  /* Scan leading delimiters.  */
-  s += strspn (s, delim);
-  if (*s == '\0')
-    {
-      olds = s;
-      return NULL;
-    }
-
-  /* Find the end of the token.  */
-  token = s;
-  s = strpbrk (token, delim);
-  if (s == NULL)
-    /* This token finishes the string.  */
-    olds = __rawmemchr (token, '\0');
-  else
-    {
-      /* Terminate the token and make OLDS point past it.  */
-      *s = '\0';
-      olds = s + 1;
-    }
-  return token;
-}
diff --git a/sysdeps/generic/strtok_r.c b/sysdeps/generic/strtok_r.c
deleted file mode 100644
index b11cb520f6..0000000000
--- a/sysdeps/generic/strtok_r.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Reentrant string tokenizer.  Generic version.
-   Copyright (C) 1991,1996-1999,2001,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-
-#undef strtok_r
-#undef __strtok_r
-
-#ifndef _LIBC
-/* Get specification.  */
-# include "strtok_r.h"
-# define __strtok_r strtok_r
-# define __rawmemchr strchr
-#endif
-
-/* Parse S into tokens separated by characters in DELIM.
-   If S is NULL, the saved pointer in SAVE_PTR is used as
-   the next starting point.  For example:
-	char s[] = "-abc-=-def";
-	char *sp;
-	x = strtok_r(s, "-", &sp);	// x = "abc", sp = "=-def"
-	x = strtok_r(NULL, "-=", &sp);	// x = "def", sp = NULL
-	x = strtok_r(NULL, "=", &sp);	// x = NULL
-		// s = "abc\0-def\0"
-*/
-char *
-__strtok_r (char *s, const char *delim, char **save_ptr)
-{
-  char *token;
-
-  if (s == NULL)
-    s = *save_ptr;
-
-  /* Scan leading delimiters.  */
-  s += strspn (s, delim);
-  if (*s == '\0')
-    {
-      *save_ptr = s;
-      return NULL;
-    }
-
-  /* Find the end of the token.  */
-  token = s;
-  s = strpbrk (token, delim);
-  if (s == NULL)
-    /* This token finishes the string.  */
-    *save_ptr = __rawmemchr (token, '\0');
-  else
-    {
-      /* Terminate the token and make *SAVE_PTR point past it.  */
-      *s = '\0';
-      *save_ptr = s + 1;
-    }
-  return token;
-}
-#ifdef weak_alias
-libc_hidden_def (__strtok_r)
-weak_alias (__strtok_r, strtok_r)
-#endif
diff --git a/sysdeps/generic/strtol.c b/sysdeps/generic/strtol.c
deleted file mode 100644
index 02ec19aabe..0000000000
--- a/sysdeps/generic/strtol.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Convert string representation of a number into an integer value.
-   Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001,2002,2003,2004
-   	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <wchar.h>
-#include <locale/localeinfo.h>
-
-#ifndef UNSIGNED
-# define UNSIGNED 0
-# define INT LONG int
-#else
-# define INT unsigned LONG int
-#endif
-
-#if UNSIGNED
-# ifdef USE_WIDE_CHAR
-#  ifdef QUAD
-#   define strtol wcstoull
-#   define __strtol_l __wcstoull_l
-#  else
-#   define strtol wcstoul
-#   define __strtol_l __wcstoul_l
-#  endif
-# else
-#  ifdef QUAD
-#   define strtol strtoull
-#   define __strtol_l __strtoull_l
-#  else
-#   define strtol strtoul
-#   define __strtol_l __strtoul_l
-#  endif
-# endif
-#else
-# ifdef USE_WIDE_CHAR
-#  ifdef QUAD
-#   define strtol wcstoll
-#   define __strtol_l __wcstoll_l
-#  else
-#   define strtol wcstol
-#   define __strtol_l __wcstol_l
-#  endif
-# else
-#  ifdef QUAD
-#   define strtol strtoll
-#   define __strtol_l __strtoll_l
-#  endif
-# endif
-#endif
-
-
-/* If QUAD is defined, we are defining `strtoll' or `strtoull',
-   operating on `long long int's.  */
-#ifdef QUAD
-# define LONG long long
-#else
-# define LONG long
-#endif
-
-
-#ifdef USE_WIDE_CHAR
-# define STRING_TYPE wchar_t
-#else
-# define STRING_TYPE char
-#endif
-
-
-#define INTERNAL(X) INTERNAL1(X)
-#define INTERNAL1(X) __##X##_internal
-
-
-extern INT INTERNAL (__strtol_l) (const STRING_TYPE *, STRING_TYPE **, int,
-				  int, __locale_t);
-
-
-INT
-INTERNAL (strtol) (nptr, endptr, base, group)
-     const STRING_TYPE *nptr;
-     STRING_TYPE **endptr;
-     int base;
-     int group;
-{
-  return INTERNAL (__strtol_l) (nptr, endptr, base, group, _NL_CURRENT_LOCALE);
-}
-libc_hidden_def (INTERNAL (strtol))
-
-
-INT
-strtol (nptr, endptr, base)
-     const STRING_TYPE *nptr;
-     STRING_TYPE **endptr;
-     int base;
-{
-  return INTERNAL (__strtol_l) (nptr, endptr, base, 0, _NL_CURRENT_LOCALE);
-}
diff --git a/sysdeps/generic/strtol_l.c b/sysdeps/generic/strtol_l.c
deleted file mode 100644
index 156083c748..0000000000
--- a/sysdeps/generic/strtol_l.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef _LIBC
-# define USE_NUMBER_GROUPING
-# define STDC_HEADERS
-# define HAVE_LIMITS_H
-#endif
-
-#include <ctype.h>
-#include <errno.h>
-#ifndef __set_errno
-# define __set_errno(Val) errno = (Val)
-#endif
-
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <xlocale.h>
-#include <bits/wordsize.h>
-
-#ifdef USE_NUMBER_GROUPING
-# include "../locale/localeinfo.h"
-#endif
-
-/* Nonzero if we are defining `strtoul' or `strtoull', operating on
-   unsigned integers.  */
-#ifndef UNSIGNED
-# define UNSIGNED 0
-# define INT LONG int
-#else
-# define INT unsigned LONG int
-#endif
-
-/* Determine the name.  */
-#if UNSIGNED
-# ifdef USE_WIDE_CHAR
-#  ifdef QUAD
-#   define strtol_l wcstoull_l
-#  else
-#   define strtol_l wcstoul_l
-#  endif
-# else
-#  ifdef QUAD
-#   define strtol_l strtoull_l
-#  else
-#   define strtol_l strtoul_l
-#  endif
-# endif
-#else
-# ifdef USE_WIDE_CHAR
-#  ifdef QUAD
-#   define strtol_l wcstoll_l
-#  else
-#   define strtol_l wcstol_l
-#  endif
-# else
-#  ifdef QUAD
-#   define strtol_l strtoll_l
-#  else
-#   define strtol_l strtol_l
-#  endif
-# endif
-#endif
-
-#define __strtol_l __strtol_l2(strtol_l)
-#define __strtol_l2(name) __strtol_l3(name)
-#define __strtol_l3(name) __##name
-
-
-/* If QUAD is defined, we are defining `strtoll' or `strtoull',
-   operating on `long long int's.  */
-#ifdef QUAD
-# define LONG long long
-# define STRTOL_LONG_MIN LONG_LONG_MIN
-# define STRTOL_LONG_MAX LONG_LONG_MAX
-# define STRTOL_ULONG_MAX ULONG_LONG_MAX
-#else
-# define LONG long
-
-# ifndef ULONG_MAX
-#  define ULONG_MAX ((unsigned long int) ~(unsigned long int) 0)
-# endif
-# ifndef LONG_MAX
-#  define LONG_MAX ((long int) (ULONG_MAX >> 1))
-# endif
-# define STRTOL_LONG_MIN LONG_MIN
-# define STRTOL_LONG_MAX LONG_MAX
-# define STRTOL_ULONG_MAX ULONG_MAX
-#endif
-
-
-/* We use this code for the extended locale handling where the
-   function gets as an additional argument the locale which has to be
-   used.  To access the values we have to redefine the _NL_CURRENT and
-   _NL_CURRENT_WORD macros.  */
-#undef _NL_CURRENT
-#define _NL_CURRENT(category, item) \
-  (current->values[_NL_ITEM_INDEX (item)].string)
-#undef _NL_CURRENT_WORD
-#define _NL_CURRENT_WORD(category, item) \
-  ((uint32_t) current->values[_NL_ITEM_INDEX (item)].word)
-
-#if defined _LIBC || defined HAVE_WCHAR_H
-# include <wchar.h>
-#endif
-
-#ifdef USE_WIDE_CHAR
-# include <wctype.h>
-# define L_(Ch) L##Ch
-# define UCHAR_TYPE wint_t
-# define STRING_TYPE wchar_t
-# define ISSPACE(Ch) __iswspace_l ((Ch), loc)
-# define ISALPHA(Ch) __iswalpha_l ((Ch), loc)
-# define TOUPPER(Ch) __towupper_l ((Ch), loc)
-#else
-# if defined _LIBC \
-   || defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
-#  define IN_CTYPE_DOMAIN(c) 1
-# else
-#  define IN_CTYPE_DOMAIN(c) isascii(c)
-# endif
-# define L_(Ch) Ch
-# define UCHAR_TYPE unsigned char
-# define STRING_TYPE char
-# define ISSPACE(Ch) __isspace_l ((Ch), loc)
-# define ISALPHA(Ch) __isalpha_l ((Ch), loc)
-# define TOUPPER(Ch) __toupper_l ((Ch), loc)
-#endif
-
-#define INTERNAL(X) INTERNAL1(X)
-#define INTERNAL1(X) __##X##_internal
-#define WEAKNAME(X) WEAKNAME1(X)
-
-#ifdef USE_NUMBER_GROUPING
-/* This file defines a function to check for correct grouping.  */
-# include "grouping.h"
-#endif
-
-
-/* Define tables of maximum values and remainders in order to detect
-   overflow.  Do this at compile-time in order to avoid the runtime
-   overhead of the division.  */
-
-#define DEF(TYPE, NAME)							   \
-  const TYPE NAME[] attribute_hidden					   \
-	__attribute__((section(".gnu.linkonce.r." #NAME))) =		   \
-  {									   \
-    F(2), F(3), F(4), F(5), F(6), F(7), F(8), F(9), F(10), 		   \
-    F(11), F(12), F(13), F(14), F(15), F(16), F(17), F(18), F(19), F(20),  \
-    F(21), F(22), F(23), F(24), F(25), F(26), F(27), F(28), F(29), F(30),  \
-    F(31), F(32), F(33), F(34), F(35), F(36)				   \
-  }
-
-#define F(X)	ULONG_MAX / X
-  DEF (unsigned long, __strtol_ul_max_tab);
-#undef F
-#if defined(QUAD) && __WORDSIZE == 32
-# define F(X)	ULONG_LONG_MAX / X
-  DEF (unsigned long long, __strtol_ull_max_tab);
-# undef F
-# define F(X)	ULONG_LONG_MAX % X
-  DEF (unsigned char, __strtol_ull_rem_tab);
-# undef F
-#else
-# define F(X)	ULONG_MAX % X
-  DEF (unsigned char, __strtol_ul_rem_tab);
-# undef F
-#endif
-#undef DEF
-
-/* Define some more readable aliases for these arrays which correspond
-   to how they'll be used in the function below.  */
-#define jmax_tab	__strtol_ul_max_tab
-#if defined(QUAD) && __WORDSIZE == 32
-# define cutoff_tab	__strtol_ull_max_tab
-# define cutlim_tab	__strtol_ull_rem_tab
-#else
-# define cutoff_tab	__strtol_ul_max_tab
-# define cutlim_tab	__strtol_ul_rem_tab
-#endif
-
-
-/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
-   If BASE is 0 the base is determined by the presence of a leading
-   zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
-   If BASE is < 2 or > 36, it is reset to 10.
-   If ENDPTR is not NULL, a pointer to the character after the last
-   one converted is stored in *ENDPTR.  */
-
-INT
-INTERNAL (__strtol_l) (nptr, endptr, base, group, loc)
-     const STRING_TYPE *nptr;
-     STRING_TYPE **endptr;
-     int base;
-     int group;
-     __locale_t loc;
-{
-  int negative;
-  register unsigned LONG int cutoff;
-  register unsigned int cutlim;
-  register unsigned LONG int i;
-  register const STRING_TYPE *s;
-  register UCHAR_TYPE c;
-  const STRING_TYPE *save, *end;
-  int overflow;
-#ifndef USE_WIDE_CHAR
-  size_t cnt;
-#endif
-
-#ifdef USE_NUMBER_GROUPING
-  struct locale_data *current = loc->__locales[LC_NUMERIC];
-  /* The thousands character of the current locale.  */
-# ifdef USE_WIDE_CHAR
-  wchar_t thousands = L'\0';
-# else
-  const char *thousands = NULL;
-  size_t thousands_len = 0;
-# endif
-  /* The numeric grouping specification of the current locale,
-     in the format described in <locale.h>.  */
-  const char *grouping;
-
-  if (__builtin_expect (group, 0))
-    {
-      grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
-      if (*grouping <= 0 || *grouping == CHAR_MAX)
-	grouping = NULL;
-      else
-	{
-	  /* Figure out the thousands separator character.  */
-# ifdef USE_WIDE_CHAR
-#  ifdef _LIBC
-	  thousands = _NL_CURRENT_WORD (LC_NUMERIC,
-					_NL_NUMERIC_THOUSANDS_SEP_WC);
-#  endif
-	  if (thousands == L'\0')
-	    grouping = NULL;
-# else
-#  ifdef _LIBC
-	  thousands = _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
-#  endif
-	  if (*thousands == '\0')
-	    {
-	      thousands = NULL;
-	      grouping = NULL;
-	    }
-# endif
-	}
-    }
-  else
-    grouping = NULL;
-#endif
-
-  if (base < 0 || base == 1 || base > 36)
-    {
-      __set_errno (EINVAL);
-      return 0;
-    }
-
-  save = s = nptr;
-
-  /* Skip white space.  */
-  while (ISSPACE (*s))
-    ++s;
-  if (__builtin_expect (*s == L_('\0'), 0))
-    goto noconv;
-
-  /* Check for a sign.  */
-  negative = 0;
-  if (*s == L_('-'))
-    {
-      negative = 1;
-      ++s;
-    }
-  else if (*s == L_('+'))
-    ++s;
-
-  /* Recognize number prefix and if BASE is zero, figure it out ourselves.  */
-  if (*s == L_('0'))
-    {
-      if ((base == 0 || base == 16) && TOUPPER (s[1]) == L_('X'))
-	{
-	  s += 2;
-	  base = 16;
-	}
-      else if (base == 0)
-	base = 8;
-    }
-  else if (base == 0)
-    base = 10;
-
-  /* Save the pointer so we can check later if anything happened.  */
-  save = s;
-
-#ifdef USE_NUMBER_GROUPING
-  if (base != 10)
-    grouping = NULL;
-
-  if (__builtin_expect (grouping != NULL, 0))
-    {
-# ifndef USE_WIDE_CHAR
-      thousands_len = strlen (thousands);
-# endif
-
-      /* Find the end of the digit string and check its grouping.  */
-      end = s;
-      if (
-# ifdef USE_WIDE_CHAR
-	  *s != thousands
-# else
-	  ({ for (cnt = 0; cnt < thousands_len; ++cnt)
-	       if (thousands[cnt] != end[cnt])
-		 break;
-	     cnt < thousands_len; })
-# endif
-	  )
-	{
-	  for (c = *end; c != L_('\0'); c = *++end)
-	    if (((STRING_TYPE) c < L_('0') || (STRING_TYPE) c > L_('9'))
-# ifdef USE_WIDE_CHAR
-		&& (wchar_t) c != thousands
-# else
-		&& ({ for (cnt = 0; cnt < thousands_len; ++cnt)
-		      if (thousands[cnt] != end[cnt])
-			break;
-		      cnt < thousands_len; })
-# endif
-		&& (!ISALPHA (c)
-		    || (int) (TOUPPER (c) - L_('A') + 10) >= base))
-	      break;
-
-# ifdef USE_WIDE_CHAR
-	  end = __correctly_grouped_prefixwc (s, end, thousands, grouping);
-# else
-	  end = __correctly_grouped_prefixmb (s, end, thousands, grouping);
-# endif
-	}
-    }
-  else
-#endif
-    end = NULL;
-
-  /* Avoid runtime division; lookup cutoff and limit.  */
-  cutoff = cutoff_tab[base - 2];
-  cutlim = cutlim_tab[base - 2];
-
-  overflow = 0;
-  i = 0;
-  c = *s;
-  if (sizeof (long int) != sizeof (LONG int))
-    {
-      unsigned long int j = 0;
-      unsigned long int jmax = jmax_tab[base - 2];
-
-      for (;c != L_('\0'); c = *++s)
-	{
-	  if (s == end)
-	    break;
-	  if (c >= L_('0') && c <= L_('9'))
-	    c -= L_('0');
-#ifdef USE_NUMBER_GROUPING
-# ifdef USE_WIDE_CHAR
-	  else if (grouping && (wchar_t) c == thousands)
-	    continue;
-# else
-	  else if (thousands_len)
-	    {
-	      for (cnt = 0; cnt < thousands_len; ++cnt)
-		if (thousands[cnt] != s[cnt])
-		  break;
-	      if (cnt == thousands_len)
-		{
-		  s += thousands_len - 1;
-		  continue;
-		}
-	      if (ISALPHA (c))
-		c = TOUPPER (c) - L_('A') + 10;
-	      else
-		break;
-	    }
-# endif
-#endif
-	  else if (ISALPHA (c))
-	    c = TOUPPER (c) - L_('A') + 10;
-	  else
-	    break;
-	  if ((int) c >= base)
-	    break;
-	  /* Note that we never can have an overflow.  */
-	  else if (j >= jmax)
-	    {
-	      /* We have an overflow.  Now use the long representation.  */
-	      i = (unsigned LONG int) j;
-	      goto use_long;
-	    }
-	  else
-	    j = j * (unsigned long int) base + c;
-	}
-
-      i = (unsigned LONG int) j;
-    }
-  else
-    for (;c != L_('\0'); c = *++s)
-      {
-	if (s == end)
-	  break;
-	if (c >= L_('0') && c <= L_('9'))
-	  c -= L_('0');
-#ifdef USE_NUMBER_GROUPING
-# ifdef USE_WIDE_CHAR
-	else if (grouping && (wchar_t) c == thousands)
-	  continue;
-# else
-	else if (thousands_len)
-	  {
-	    for (cnt = 0; cnt < thousands_len; ++cnt)
-	      if (thousands[cnt] != s[cnt])
-		break;
-	    if (cnt == thousands_len)
-	      {
-		s += thousands_len - 1;
-		continue;
-	      }
-	    if (ISALPHA (c))
-	      c = TOUPPER (c) - L_('A') + 10;
-	    else
-	      break;
-	  }
-# endif
-#endif
-	else if (ISALPHA (c))
-	  c = TOUPPER (c) - L_('A') + 10;
-	else
-	  break;
-	if ((int) c >= base)
-	  break;
-	/* Check for overflow.  */
-	if (i > cutoff || (i == cutoff && c > cutlim))
-	  overflow = 1;
-	else
-	  {
-	  use_long:
-	    i *= (unsigned LONG int) base;
-	    i += c;
-	  }
-      }
-
-  /* Check if anything actually happened.  */
-  if (s == save)
-    goto noconv;
-
-  /* Store in ENDPTR the address of one character
-     past the last character we converted.  */
-  if (endptr != NULL)
-    *endptr = (STRING_TYPE *) s;
-
-#if !UNSIGNED
-  /* Check for a value that is within the range of
-     `unsigned LONG int', but outside the range of `LONG int'.  */
-  if (overflow == 0
-      && i > (negative
-	      ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
-	      : (unsigned LONG int) STRTOL_LONG_MAX))
-    overflow = 1;
-#endif
-
-  if (__builtin_expect (overflow, 0))
-    {
-      __set_errno (ERANGE);
-#if UNSIGNED
-      return STRTOL_ULONG_MAX;
-#else
-      return negative ? STRTOL_LONG_MIN : STRTOL_LONG_MAX;
-#endif
-    }
-
-  /* Return the result of the appropriate sign.  */
-  return negative ? -i : i;
-
-noconv:
-  /* We must handle a special case here: the base is 0 or 16 and the
-     first two characters are '0' and 'x', but the rest are no
-     hexadecimal digits.  This is no error case.  We return 0 and
-     ENDPTR points to the `x`.  */
-  if (endptr != NULL)
-    {
-      if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
-	  && save[-2] == L_('0'))
-	*endptr = (STRING_TYPE *) &save[-1];
-      else
-	/*  There was no number to convert.  */
-	*endptr = (STRING_TYPE *) nptr;
-    }
-
-  return 0L;
-}
-#if defined _LIBC && !defined USE_WIDE_CHAR
-libc_hidden_def (INTERNAL (__strtol_l))
-#endif
-
-/* External user entry point.  */
-
-#if _LIBC - 0 == 0
-# undef PARAMS
-# if defined (__STDC__) && __STDC__
-#  define PARAMS(Args) Args
-# else
-#  define PARAMS(Args) ()
-# endif
-
-/* Prototype.  */
-extern INT __strtol_l PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr,
-			       int base));
-#endif
-
-
-INT
-#ifdef weak_function
-weak_function
-#endif
-__strtol_l (nptr, endptr, base, loc)
-     const STRING_TYPE *nptr;
-     STRING_TYPE **endptr;
-     int base;
-     __locale_t loc;
-{
-  return INTERNAL (__strtol_l) (nptr, endptr, base, 0, loc);
-}
-weak_alias (__strtol_l, strtol_l)
diff --git a/sysdeps/generic/strtold_l.c b/sysdeps/generic/strtold_l.c
deleted file mode 100644
index 690a8a92eb..0000000000
--- a/sysdeps/generic/strtold_l.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 1999, 2002, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include <stdlib.h>
-#include <xlocale.h>
-
-#ifdef USE_WIDE_CHAR
-# define STRING_TYPE	wchar_t
-# define STRTOLD	wcstold_l
-# define __STRTOLD	__wcstold_l
-# define __STRTOD	__wcstod_l
-#else
-# define STRING_TYPE	char
-# define STRTOLD	strtold_l
-# define __STRTOLD	__strtold_l
-# define __STRTOD	__strtod_l
-#endif
-
-#define INTERNAL(x) INTERNAL1(x)
-#define INTERNAL1(x) __##x##_internal
-
-extern double INTERNAL (__STRTOD) (const STRING_TYPE *, STRING_TYPE **,
-				   int, __locale_t);
-
-/* There is no `long double' type, use the `double' implementations.  */
-long double
-INTERNAL (__STRTOLD) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
-		      int group, __locale_t loc)
-{
-  return INTERNAL (__STRTOD) (nptr, endptr, group, loc);
-}
-#ifndef USE_WIDE_CHAR
-libc_hidden_def (INTERNAL (__STRTOLD))
-#endif
-
-long double
-weak_function
-__STRTOLD (const STRING_TYPE *nptr, STRING_TYPE **endptr, __locale_t loc)
-{
-  return INTERNAL (__STRTOD) (nptr, endptr, 0, loc);
-}
-weak_alias (__STRTOLD, STRTOLD)
diff --git a/sysdeps/generic/strtoll.c b/sysdeps/generic/strtoll.c
deleted file mode 100644
index 60128df781..0000000000
--- a/sysdeps/generic/strtoll.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Function to parse a `long long int' from text.
-   Copyright (C) 1995, 1996, 1997, 1999, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define	QUAD	1
-
-#include <strtol.c>
-
-#ifdef _LIBC
-# ifdef SHARED
-#  include <shlib-compat.h>
-
-#  if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
-#  endif
-
-# endif
-weak_alias (strtoll, strtoq)
-#endif
diff --git a/sysdeps/generic/strtoll_l.c b/sysdeps/generic/strtoll_l.c
deleted file mode 100644
index 7725035bd1..0000000000
--- a/sysdeps/generic/strtoll_l.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define QUAD	1
-
-#include <xlocale.h>
-
-extern long long int ____strtoll_l_internal (const char *, char **, int, int,
-					     __locale_t);
-
-#include <strtol_l.c>
diff --git a/sysdeps/generic/strtoul.c b/sysdeps/generic/strtoul.c
deleted file mode 100644
index 0862950231..0000000000
--- a/sysdeps/generic/strtoul.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 1991, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define	UNSIGNED	1
-
-#include "strtol.c"
diff --git a/sysdeps/generic/strtoul_l.c b/sysdeps/generic/strtoul_l.c
deleted file mode 100644
index a8b980f48d..0000000000
--- a/sysdeps/generic/strtoul_l.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define UNSIGNED	1
-
-#include <xlocale.h>
-
-extern unsigned long int ____strtoul_l_internal (const char *, char **, int,
-						 int, __locale_t);
-
-#include "strtol_l.c"
diff --git a/sysdeps/generic/strtoull.c b/sysdeps/generic/strtoull.c
deleted file mode 100644
index accf5874a0..0000000000
--- a/sysdeps/generic/strtoull.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Function to parse an `unsigned long long int' from text.
-   Copyright (C) 1995, 1996, 1997, 1999, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define	QUAD	1
-
-#include <strtoul.c>
-
-#ifdef _LIBC
-# ifdef SHARED
-#  include <shlib-compat.h>
-
-#  if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-compat_symbol (libc, __strtoull_internal, __strtouq_internal, GLIBC_2_0);
-#  endif
-
-# endif
-weak_alias (strtoull, strtouq)
-#endif
diff --git a/sysdeps/generic/strtoull_l.c b/sysdeps/generic/strtoull_l.c
deleted file mode 100644
index 68ad0d826e..0000000000
--- a/sysdeps/generic/strtoull_l.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define QUAD		1
-#define UNSIGNED	1
-
-#include <xlocale.h>
-
-extern unsigned long long int ____strtoull_l_internal (const char *, char **,
-						       int, int, __locale_t);
-
-#include <strtol_l.c>
diff --git a/sysdeps/generic/strtoumax.c b/sysdeps/generic/strtoumax.c
deleted file mode 100644
index 508cb19f8c..0000000000
--- a/sysdeps/generic/strtoumax.c
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `uintmax_t' type"
diff --git a/sysdeps/generic/strtsupp.c b/sysdeps/generic/strtsupp.c
deleted file mode 100644
index c66495bb3d..0000000000
--- a/sysdeps/generic/strtsupp.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
-     On-Line Applications Research Corporation.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <standalone.h>
-
-/* This file is only required when a "bare" board is configured. */
-
-/* Start Support Routines
-
-The start code for some CPUs (e.g. i386) require target dependent
-support.  For more info, consult the start file for your CPU. */
diff --git a/sysdeps/generic/stty.c b/sysdeps/generic/stty.c
deleted file mode 100644
index 49c569a77b..0000000000
--- a/sysdeps/generic/stty.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sgtty.h>
-#include <stddef.h>
-
-/* Set the terminal parameters associated with FD to *PARAMS.  */
-int
-stty (fd, params)
-     int fd;
-     const struct sgttyb *params;
-{
-  if (params == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (stty)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sub_n.c b/sysdeps/generic/sub_n.c
deleted file mode 100644
index 4f2f06099c..0000000000
--- a/sysdeps/generic/sub_n.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* mpn_sub_n -- Subtract two limb vectors of equal, non-zero length.
-
-Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-mp_limb_t
-#if __STDC__
-mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size)
-#else
-mpn_sub_n (res_ptr, s1_ptr, s2_ptr, size)
-     register mp_ptr res_ptr;
-     register mp_srcptr s1_ptr;
-     register mp_srcptr s2_ptr;
-     mp_size_t size;
-#endif
-{
-  register mp_limb_t x, y, cy;
-  register mp_size_t j;
-
-  /* The loop counter and index J goes from -SIZE to -1.  This way
-     the loop becomes faster.  */
-  j = -size;
-
-  /* Offset the base pointers to compensate for the negative indices.  */
-  s1_ptr -= j;
-  s2_ptr -= j;
-  res_ptr -= j;
-
-  cy = 0;
-  do
-    {
-      y = s2_ptr[j];
-      x = s1_ptr[j];
-      y += cy;			/* add previous carry to subtrahend */
-      cy = (y < cy);		/* get out carry from that addition */
-      y = x - y;		/* main subtract */
-      cy = (y > x) + cy;	/* get out carry from the subtract, combine */
-      res_ptr[j] = y;
-    }
-  while (++j != 0);
-
-  return cy;
-}
diff --git a/sysdeps/generic/submul_1.c b/sysdeps/generic/submul_1.c
deleted file mode 100644
index c7c08ee4af..0000000000
--- a/sysdeps/generic/submul_1.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* mpn_submul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR
-   by S2_LIMB, subtract the S1_SIZE least significant limbs of the product
-   from the limb vector pointed to by RES_PTR.  Return the most significant
-   limb of the product, adjusted for carry-out from the subtraction.
-
-Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-mp_limb_t
-mpn_submul_1 (res_ptr, s1_ptr, s1_size, s2_limb)
-     register mp_ptr res_ptr;
-     register mp_srcptr s1_ptr;
-     mp_size_t s1_size;
-     register mp_limb_t s2_limb;
-{
-  register mp_limb_t cy_limb;
-  register mp_size_t j;
-  register mp_limb_t prod_high, prod_low;
-  register mp_limb_t x;
-
-  /* The loop counter and index J goes from -SIZE to -1.  This way
-     the loop becomes faster.  */
-  j = -s1_size;
-
-  /* Offset the base pointers to compensate for the negative indices.  */
-  res_ptr -= j;
-  s1_ptr -= j;
-
-  cy_limb = 0;
-  do
-    {
-      umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb);
-
-      prod_low += cy_limb;
-      cy_limb = (prod_low < cy_limb) + prod_high;
-
-      x = res_ptr[j];
-      prod_low = x - prod_low;
-      cy_limb += (prod_low > x);
-      res_ptr[j] = prod_low;
-    }
-  while (++j != 0);
-
-  return cy_limb;
-}
diff --git a/sysdeps/generic/swapcontext.c b/sysdeps/generic/swapcontext.c
deleted file mode 100644
index 56b73f0d6c..0000000000
--- a/sysdeps/generic/swapcontext.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <ucontext.h>
-
-int
-swapcontext (oucp, ucp)
-     ucontext_t *oucp;
-     const ucontext_t *ucp;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (swapcontext)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/swapoff.c b/sysdeps/generic/swapoff.c
deleted file mode 100644
index 033d841d95..0000000000
--- a/sysdeps/generic/swapoff.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Stop using block special device PATH for swapping.  */
-int
-swapoff (const char *path)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (swapoff)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/swapon.c b/sysdeps/generic/swapon.c
deleted file mode 100644
index 910781fa93..0000000000
--- a/sysdeps/generic/swapon.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/swap.h>
-
-/* Make the block special device PATH available to the system for swapping.
-   This call is restricted to the super-user.  */
-int
-swapon (path)
-     const char *path;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (swapon)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/symlink.c b/sysdeps/generic/symlink.c
deleted file mode 100644
index e6c6709f1a..0000000000
--- a/sysdeps/generic/symlink.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Make a link to FROM called TO.  */
-int
-__symlink (from, to)
-     const char *from;
-     const char *to;
-{
-  if (from == NULL || to == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (symlink)
-
-weak_alias (__symlink, symlink)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sync.c b/sysdeps/generic/sync.c
deleted file mode 100644
index 5ccdb5d5bf..0000000000
--- a/sysdeps/generic/sync.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Make all changes done to all files actually appear on disk.  */
-void
-sync ()
-{
-  __set_errno (ENOSYS);
-}
-
-
-stub_warning (sync)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/syscall.c b/sysdeps/generic/syscall.c
deleted file mode 100644
index ad78a06b73..0000000000
--- a/sysdeps/generic/syscall.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1993, 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <errno.h>
-#include <unistd.h>
-
-/* Do system call CALLNO, passing it the remaining arguments.
-   This only makes sense in certain operating systems.  */
-
-long int
-syscall (callno)
-     long int callno;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (syscall)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sysconf.c b/sysdeps/generic/sysconf.c
deleted file mode 100644
index f22685cb29..0000000000
--- a/sysdeps/generic/sysconf.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* Copyright (C) 1991,1993,1995-1997,2001,2002,2003
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <grp.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <time.h>
-#include <limits.h>
-#include <sys/param.h>
-#include <sys/sysinfo.h>
-
-
-/* Get the value of the system variable NAME.  */
-long int
-__sysconf (name)
-     int name;
-{
-  switch (name)
-    {
-    default:
-      __set_errno (EINVAL);
-      return -1;
-
-    case _SC_TZNAME_MAX:
-      return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
-
-    case _SC_CHARCLASS_NAME_MAX:
-#ifdef	CHARCLASS_NAME_MAX
-      return CHARCLASS_NAME_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_COLL_WEIGHTS_MAX:
-#ifdef	COLL_WEIGHTS_MAX
-      return COLL_WEIGHTS_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_EQUIV_CLASS_MAX:
-#ifdef	EQUIV_CLASS_MAX
-      return EQUIV_CLASS_MAX;
-#else
-      return -1;
-#endif
-
-    case _SC_2_LOCALEDEF:
-#ifdef	_POSIX2_LOCALEDEF
-      return _POSIX2_LOCALEDEF;
-#else
-      return -1;
-#endif
-
-    case _SC_NPROCESSORS_CONF:
-      return __get_nprocs_conf ();
-
-    case _SC_NPROCESSORS_ONLN:
-      return __get_nprocs ();
-
-    case _SC_PHYS_PAGES:
-      return __get_phys_pages ();
-
-    case _SC_AVPHYS_PAGES:
-      return __get_avphys_pages ();
-
-    case _SC_ATEXIT_MAX:
-      /* We have no limit since we use lists.  */
-      return INT_MAX;
-
-    case _SC_PASS_MAX:
-      /* We have no limit but since the return value might be used to
-	 allocate a buffer we restrict the value.  */
-      return BUFSIZ;
-
-    case _SC_CHAR_BIT:
-      return CHAR_BIT;
-
-    case _SC_CHAR_MAX:
-      return CHAR_MAX;
-
-    case _SC_CHAR_MIN:
-      return CHAR_MIN;
-
-    case _SC_INT_MAX:
-      return INT_MAX;
-
-    case _SC_INT_MIN:
-      return INT_MIN;
-
-    case _SC_LONG_BIT:
-      return sizeof (long int) * CHAR_BIT;
-
-    case _SC_WORD_BIT:
-      return sizeof (int) * CHAR_BIT;
-
-    case _SC_MB_LEN_MAX:
-      return MB_LEN_MAX;
-
-    case _SC_NZERO:
-      return NZERO;
-
-    case _SC_SSIZE_MAX:
-      return _POSIX_SSIZE_MAX;
-
-    case _SC_SCHAR_MAX:
-      return SCHAR_MAX;
-
-    case _SC_SCHAR_MIN:
-      return SCHAR_MIN;
-
-    case _SC_SHRT_MAX:
-      return SHRT_MAX;
-
-    case _SC_SHRT_MIN:
-      return SHRT_MIN;
-
-    case _SC_UCHAR_MAX:
-      return UCHAR_MAX;
-
-    case _SC_UINT_MAX:
-      return UINT_MAX;
-
-    case _SC_ULONG_MAX:
-      return ULONG_MAX;
-
-    case _SC_USHRT_MAX:
-      return USHRT_MAX;
-
-    case _SC_GETGR_R_SIZE_MAX:
-      return NSS_BUFLEN_GROUP;
-
-    case _SC_GETPW_R_SIZE_MAX:
-      return NSS_BUFLEN_PASSWD;
-
-    case _SC_ARG_MAX:
-    case _SC_CHILD_MAX:
-    case _SC_CLK_TCK:
-    case _SC_NGROUPS_MAX:
-    case _SC_OPEN_MAX:
-    case _SC_STREAM_MAX:
-    case _SC_JOB_CONTROL:
-    case _SC_SAVED_IDS:
-    case _SC_REALTIME_SIGNALS:
-    case _SC_PRIORITY_SCHEDULING:
-    case _SC_TIMERS:
-    case _SC_ASYNCHRONOUS_IO:
-    case _SC_PRIORITIZED_IO:
-    case _SC_SYNCHRONIZED_IO:
-    case _SC_FSYNC:
-    case _SC_MAPPED_FILES:
-    case _SC_MEMLOCK:
-    case _SC_MEMLOCK_RANGE:
-    case _SC_MEMORY_PROTECTION:
-    case _SC_MESSAGE_PASSING:
-    case _SC_SEMAPHORES:
-    case _SC_SHARED_MEMORY_OBJECTS:
-
-    case _SC_AIO_LISTIO_MAX:
-    case _SC_AIO_MAX:
-    case _SC_AIO_PRIO_DELTA_MAX:
-    case _SC_DELAYTIMER_MAX:
-    case _SC_MQ_OPEN_MAX:
-    case _SC_MQ_PRIO_MAX:
-    case _SC_VERSION:
-    case _SC_PAGESIZE:
-    case _SC_RTSIG_MAX:
-    case _SC_SEM_NSEMS_MAX:
-    case _SC_SEM_VALUE_MAX:
-    case _SC_SIGQUEUE_MAX:
-    case _SC_TIMER_MAX:
-
-    case _SC_PII:
-    case _SC_PII_XTI:
-    case _SC_PII_SOCKET:
-    case _SC_PII_OSI:
-    case _SC_POLL:
-    case _SC_SELECT:
-    case _SC_UIO_MAXIOV:
-    case _SC_PII_INTERNET_STREAM:
-    case _SC_PII_INTERNET_DGRAM:
-    case _SC_PII_OSI_COTS:
-    case _SC_PII_OSI_CLTS:
-    case _SC_PII_OSI_M:
-    case _SC_T_IOV_MAX:
-
-    case _SC_BC_BASE_MAX:
-    case _SC_BC_DIM_MAX:
-    case _SC_BC_SCALE_MAX:
-    case _SC_BC_STRING_MAX:
-    case _SC_EXPR_NEST_MAX:
-    case _SC_LINE_MAX:
-    case _SC_RE_DUP_MAX:
-    case _SC_2_VERSION:
-    case _SC_2_C_BIND:
-    case _SC_2_C_DEV:
-    case _SC_2_FORT_DEV:
-    case _SC_2_SW_DEV:
-    case _SC_2_CHAR_TERM:
-    case _SC_2_C_VERSION:
-    case _SC_2_UPE:
-
-    case _SC_THREADS:
-    case _SC_THREAD_SAFE_FUNCTIONS:
-    case _SC_LOGIN_NAME_MAX:
-    case _SC_TTY_NAME_MAX:
-    case _SC_THREAD_DESTRUCTOR_ITERATIONS:
-    case _SC_THREAD_KEYS_MAX:
-    case _SC_THREAD_STACK_MIN:
-    case _SC_THREAD_THREADS_MAX:
-    case _SC_THREAD_ATTR_STACKADDR:
-    case _SC_THREAD_ATTR_STACKSIZE:
-    case _SC_THREAD_PRIORITY_SCHEDULING:
-    case _SC_THREAD_PRIO_INHERIT:
-    case _SC_THREAD_PRIO_PROTECT:
-    case _SC_THREAD_PROCESS_SHARED:
-
-    case _SC_XOPEN_VERSION:
-    case _SC_XOPEN_XCU_VERSION:
-    case _SC_XOPEN_UNIX:
-    case _SC_XOPEN_CRYPT:
-    case _SC_XOPEN_ENH_I18N:
-    case _SC_XOPEN_SHM:
-    case _SC_XOPEN_XPG2:
-    case _SC_XOPEN_XPG3:
-    case _SC_XOPEN_XPG4:
-
-    case _SC_NL_ARGMAX:
-    case _SC_NL_LANGMAX:
-    case _SC_NL_MSGMAX:
-    case _SC_NL_NMAX:
-    case _SC_NL_SETMAX:
-    case _SC_NL_TEXTMAX:
-
-    case _SC_XBS5_ILP32_OFF32:
-    case _SC_XBS5_ILP32_OFFBIG:
-    case _SC_XBS5_LP64_OFF64:
-    case _SC_XBS5_LPBIG_OFFBIG:
-
-    case _SC_XOPEN_LEGACY:
-    case _SC_XOPEN_REALTIME:
-    case _SC_XOPEN_REALTIME_THREADS:
-
-      break;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__sysconf, sysconf)
-libc_hidden_def (__sysconf)
-
-stub_warning (sysconf)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sysdep-cancel.h b/sysdeps/generic/sysdep-cancel.h
index f07b784f2e..ba6a1e04ba 100644
--- a/sysdeps/generic/sysdep-cancel.h
+++ b/sysdeps/generic/sysdep-cancel.h
@@ -2,6 +2,7 @@
 
 /* No multi-thread handling enabled.  */
 #define SINGLE_THREAD_P (1)
+#define RTLD_SINGLE_THREAD_P (1)
 #define LIBC_CANCEL_ASYNC()	0 /* Just a dummy value.  */
 #define LIBC_CANCEL_RESET(val)	((void)(val)) /* Nothing, but evaluate it.  */
 #define LIBC_CANCEL_HANDLED()	/* Nothing.  */
diff --git a/sysdeps/generic/sysdep.c b/sysdeps/generic/sysdep.c
deleted file mode 100644
index 5442eee00d..0000000000
--- a/sysdeps/generic/sysdep.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* This file should contain any system-dependent functions
-   that will be used by many parts of the library.  */
diff --git a/sysdeps/generic/sysdep.h b/sysdeps/generic/sysdep.h
index 58c79281ed..15d951c777 100644
--- a/sysdeps/generic/sysdep.h
+++ b/sysdeps/generic/sysdep.h
@@ -60,6 +60,7 @@
 #  define cfi_register(r1, r2)		.cfi_register r1, r2
 #  define cfi_return_column(reg)	.cfi_return_column reg
 #  define cfi_restore(reg)		.cfi_restore reg
+#  define cfi_same_value(reg)		.cfi_same_value reg
 #  define cfi_undefined(reg)		.cfi_undefined reg
 #  define cfi_remember_state		.cfi_remember_state
 #  define cfi_restore_state		.cfi_restore_state
@@ -76,6 +77,7 @@
 #  define cfi_register(r1, r2)
 #  define cfi_return_column(reg)
 #  define cfi_restore(reg)
+#  define cfi_same_value(reg)
 #  define cfi_undefined(reg)
 #  define cfi_remember_state
 #  define cfi_restore_state
diff --git a/sysdeps/generic/system.c b/sysdeps/generic/system.c
deleted file mode 100644
index cd12128cd8..0000000000
--- a/sysdeps/generic/system.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stdlib.h>
-
-
-/* Execute LINE as a shell command.  */
-int
-__libc_system (line)
-     const char *line;
-{
-  if (line == NULL)
-    return 0;			/* This indicates no command processor.  */
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__libc_system, system)
-
-
-stub_warning (system)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/sysv_signal.c b/sysdeps/generic/sysv_signal.c
deleted file mode 100644
index 86dbb1d093..0000000000
--- a/sysdeps/generic/sysv_signal.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-
-/* Set the handler for the signal SIG to HANDLER,
-   returning the old handler, or SIG_ERR on error.  */
-__sighandler_t
-__sysv_signal (sig, handler)
-     int sig;
-     __sighandler_t handler;
-{
-  /* Check signal extents to protect __sigismember.  */
-  if (handler == SIG_ERR || sig < 1 || sig >= NSIG)
-    {
-      __set_errno (EINVAL);
-      return SIG_ERR;
-    }
-
-  __set_errno (ENOSYS);
-
-  return SIG_ERR;
-}
-weak_alias (__sysv_signal, sysv_signal)
-
-stub_warning (sysv_signal)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/t_sincosl.c b/sysdeps/generic/t_sincosl.c
deleted file mode 100644
index 6b271e6ff1..0000000000
--- a/sysdeps/generic/t_sincosl.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty.  Not needed unless ldbl __kernel_* functions use it. */
diff --git a/sysdeps/generic/tcdrain.c b/sysdeps/generic/tcdrain.c
deleted file mode 100644
index d28ddbf006..0000000000
--- a/sysdeps/generic/tcdrain.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-
-/* Wait for pending output to be written on FD.  */
-int
-__libc_tcdrain (int fd)
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__libc_tcdrain, tcdrain)
-
-
-stub_warning (tcdrain)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tcflow.c b/sysdeps/generic/tcflow.c
deleted file mode 100644
index f4db981f28..0000000000
--- a/sysdeps/generic/tcflow.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-
-/* Suspend or restart transmission on FD.  */
-int
-tcflow (fd, action)
-     int fd;
-     int action;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  switch (action)
-    {
-    case TCOOFF:
-    case TCOON:
-    case TCIOFF:
-    case TCION:
-      break;
-
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (tcflow)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tcflush.c b/sysdeps/generic/tcflush.c
deleted file mode 100644
index c95f78e4ae..0000000000
--- a/sysdeps/generic/tcflush.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-
-/* Flush pending data on FD.  */
-int
-tcflush (fd, queue_selector)
-     int fd;
-     int queue_selector;
-{
-  switch (queue_selector)
-    {
-    case TCIFLUSH:
-    case TCOFLUSH:
-    case TCIOFLUSH:
-      break;
-
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning(tcflush);
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tcgetattr.c b/sysdeps/generic/tcgetattr.c
deleted file mode 100644
index 6751e88b83..0000000000
--- a/sysdeps/generic/tcgetattr.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <termios.h>
-
-/* Put the state of FD into *TERMIOS_P.  */
-int
-__tcgetattr (fd, termios_p)
-     int fd;
-     struct termios *termios_p;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (tcgetattr)
-
-weak_alias (__tcgetattr, tcgetattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tcgetpgrp.c b/sysdeps/generic/tcgetpgrp.c
deleted file mode 100644
index 2a1d846e75..0000000000
--- a/sysdeps/generic/tcgetpgrp.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Return the foreground process group ID of FD.  */
-pid_t
-tcgetpgrp (fd)
-     int fd;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return (pid_t) -1;
-    }
-
-  __set_errno (ENOSYS);
-  return (pid_t) -1;
-}
-libc_hidden_def (tcgetpgrp)
-stub_warning (tcgetpgrp)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tcsendbrk.c b/sysdeps/generic/tcsendbrk.c
deleted file mode 100644
index 4f40cfb153..0000000000
--- a/sysdeps/generic/tcsendbrk.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-
-/* Send zero bits on FD.  */
-int
-tcsendbreak (fd, duration)
-     int fd;
-     int duration;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (tcsendbreak)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tcsetattr.c b/sysdeps/generic/tcsetattr.c
deleted file mode 100644
index 205838c87b..0000000000
--- a/sysdeps/generic/tcsetattr.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright (C) 1991,95,96,2000,01,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <termios.h>
-
-static int bad_speed (speed_t speed);
-
-/* Set the state of FD to *TERMIOS_P.  */
-int
-tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  switch (optional_actions)
-    {
-    case TCSANOW:
-    case TCSADRAIN:
-    case TCSAFLUSH:
-      break;
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (bad_speed(termios_p->__ospeed) ||
-      bad_speed(termios_p->__ispeed == 0 ?
-		termios_p->__ospeed : termios_p->__ispeed))
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (tcsetattr)
-
-/* Strychnine checking.  */
-static int
-bad_speed (speed_t speed)
-{
-  switch (speed)
-    {
-    case B0:
-    case B50:
-    case B75:
-    case B110:
-    case B134:
-    case B150:
-    case B200:
-    case B300:
-    case B600:
-    case B1200:
-    case B1800:
-    case B2400:
-    case B4800:
-    case B9600:
-    case B19200:
-    case B38400:
-    case B57600:
-    case B115200:
-    case B230400:
-    case B460800:
-    case B500000:
-    case B576000:
-    case B921600:
-    case B1000000:
-    case B1152000:
-    case B1500000:
-    case B2000000:
-    case B2500000:
-    case B3000000:
-    case B3500000:
-    case B4000000:
-      return 0;
-    default:
-      return 1;
-    }
-}
-
-
-stub_warning (tcsetattr)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tcsetpgrp.c b/sysdeps/generic/tcsetpgrp.c
deleted file mode 100644
index 59f58e59aa..0000000000
--- a/sysdeps/generic/tcsetpgrp.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-/* Set the foreground process group ID of FD set PGRP_ID.  */
-int
-tcsetpgrp (fd, pgrp_id)
-     int fd;
-     pid_t pgrp_id;
-{
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-
-stub_warning (tcsetpgrp)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/telldir.c b/sysdeps/generic/telldir.c
deleted file mode 100644
index 7b14452327..0000000000
--- a/sysdeps/generic/telldir.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <stddef.h>
-#include <dirent.h>
-
-/* Return the current position of DIRP.  */
-long int
-telldir (dirp)
-     DIR *dirp;
-{
-  if (dirp == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1l;
-    }
-
-  __set_errno (ENOSYS);
-  return -1l;
-}
-
-
-stub_warning (telldir)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tempname.c b/sysdeps/generic/tempname.c
deleted file mode 100644
index 60c94d6409..0000000000
--- a/sysdeps/generic/tempname.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 95-98, 99 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define __need_size_t
-#include <stddef.h>
-#include <stdio.h>
-#include <errno.h>
-
-/* Perform the "SVID path search malarkey" on DIR and PFX.  Write a
-   template suitable for use in __gen_tempname into TMPL, bounded
-   by TMPL_LEN. */
-int
-__path_search (tmpl, tmpl_len, dir, pfx, try_tmpdir)
-     char *tmpl;
-     size_t tmpl_len;
-     const char *dir;
-     const char *pfx;
-     int try_tmpdir;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (__path_search)
-
-/* Generate a (hopefully) unique temporary filename
-   in DIR (if applicable), using template TMPL.
-   KIND determines what to do with that name.  It may be one of:
-     __GT_FILE:		create a file and return a read-write fd.
-     __GT_BIGFILE:	same, but use open64() (or equivalent).
-     __GT_DIR:		create a directory.
-     __GT_NOCREATE:	just find a name not currently in use.
- */
-
-int
-__gen_tempname (tmpl, kind)
-     char *tmpl;
-     int kind;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (__gen_tempname)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/time.c b/sysdeps/generic/time.c
deleted file mode 100644
index ec66f119df..0000000000
--- a/sysdeps/generic/time.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1991,96,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Return the time now, and store it in *TIMER if not NULL.  */
-time_t
-time (timer)
-     time_t *timer;
-{
-  __set_errno (ENOSYS);
-
-  if (timer != NULL)
-    *timer = (time_t) -1;
-  return (time_t) -1;
-}
-libc_hidden_def (time)
-
-stub_warning (time)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_create.c b/sysdeps/generic/timer_create.c
deleted file mode 100644
index 0e3a6b0acc..0000000000
--- a/sysdeps/generic/timer_create.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Create new per-process timer using CLOCK.  */
-int
-timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (timer_create)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_delete.c b/sysdeps/generic/timer_delete.c
deleted file mode 100644
index 4be55aa322..0000000000
--- a/sysdeps/generic/timer_delete.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Delete timer TIMERID.  */
-int
-timer_delete (timer_t timerid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (timer_delete)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_getoverr.c b/sysdeps/generic/timer_getoverr.c
deleted file mode 100644
index 6ca7ff8e9e..0000000000
--- a/sysdeps/generic/timer_getoverr.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Get expiration overrun for timer TIMERID.  */
-int
-timer_getoverrun (timer_t timerid)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (timer_getoverrun)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_gettime.c b/sysdeps/generic/timer_gettime.c
deleted file mode 100644
index 728028ed3e..0000000000
--- a/sysdeps/generic/timer_gettime.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Get current value of timer TIMERID and store it in VLAUE.  */
-int
-timer_gettime (timer_t timerid, struct itimerspec *value)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (timer_gettime)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/timer_settime.c b/sysdeps/generic/timer_settime.c
deleted file mode 100644
index f494a0edd1..0000000000
--- a/sysdeps/generic/timer_settime.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <time.h>
-
-/* Set timer TIMERID to VALUE, returning old value in OVLAUE.  */
-int
-timer_settime (timer_t timerid, int flags, const struct itimerspec *value,
-	       struct itimerspec *ovalue)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (timer_settime)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/times.c b/sysdeps/generic/times.c
deleted file mode 100644
index b4e08156ae..0000000000
--- a/sysdeps/generic/times.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/times.h>
-#include <stddef.h>
-
-/* Store the CPU time used by this process and all its
-   dead children (and their dead children) in BUFFER.
-   Return the elapsed real time, or (clock_t) -1 for errors.
-   All times are in CLK_TCKths of a second.  */
-clock_t
-__times (buffer)
-     struct tms *buffer;
-{
-  if (buffer == NULL)
-    {
-      __set_errno (EINVAL);
-      return (clock_t) -1;
-    }
-
-  __set_errno (ENOSYS);
-  return (clock_t) -1;
-}
-stub_warning (times)
-
-weak_alias (__times, times)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/tls-macros.h b/sysdeps/generic/tls-macros.h
new file mode 100644
index 0000000000..0a08f7c145
--- /dev/null
+++ b/sysdeps/generic/tls-macros.h
@@ -0,0 +1,12 @@
+/* Macros to support TLS testing in times of missing compiler support.
+   Stub version.
+
+   These macros should yield int * expressions for the TLS symbol X
+   accessed using the various TLS access models.  Macros for some machines
+   are defined in elf/tls-macros.h, but ports can instead provide this file.
+
+#define TLS_LE(x)
+#define TLS_IE(x)
+#define TLS_LD(x)
+#define TLS_GD(x)
+*/
diff --git a/sysdeps/generic/tmpfile.c b/sysdeps/generic/tmpfile.c
deleted file mode 100644
index 41f12bc8ba..0000000000
--- a/sysdeps/generic/tmpfile.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Open a stdio stream on an anonymous temporary file.  Generic/POSIX version.
-   Copyright (C) 1991,93,1996-2000,2002,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-#include <unistd.h>
-
-#ifdef USE_IN_LIBIO
-# include <iolibio.h>
-# define __fdopen INTUSE(_IO_fdopen)
-# ifndef tmpfile
-#  define tmpfile __new_tmpfile
-# endif
-#endif
-
-#ifndef GEN_THIS
-# define GEN_THIS __GT_FILE
-#endif
-
-/* This returns a new stream opened on a temporary file (generated
-   by tmpnam).  The file is opened with mode "w+b" (binary read/write).
-   If we couldn't generate a unique filename or the file couldn't
-   be opened, NULL is returned.  */
-FILE *
-tmpfile (void)
-{
-  char buf[FILENAME_MAX];
-  int fd;
-  FILE *f;
-
-  if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
-    return NULL;
-  fd = __gen_tempname (buf, GEN_THIS);
-  if (fd < 0)
-    return NULL;
-
-  /* Note that this relies on the Unix semantics that
-     a file is not really removed until it is closed.  */
-  (void) __unlink (buf);
-
-  if ((f = __fdopen (fd, "w+b")) == NULL)
-    __close (fd);
-
-  return f;
-}
-
-#if defined USE_IN_LIBIO && GEN_THIS == __GT_FILE /* Not for tmpfile64.  */
-# undef tmpfile
-# include <shlib-compat.h>
-versioned_symbol (libc, __new_tmpfile, tmpfile, GLIBC_2_1);
-#endif
diff --git a/sysdeps/generic/tmpfile64.c b/sysdeps/generic/tmpfile64.c
deleted file mode 100644
index adce634556..0000000000
--- a/sysdeps/generic/tmpfile64.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define GEN_THIS	__GT_BIGFILE
-#define tmpfile		tmpfile64
-#include "tmpfile.c"
diff --git a/sysdeps/generic/trampoline.c b/sysdeps/generic/trampoline.c
deleted file mode 100644
index 7045a0d0ab..0000000000
--- a/sysdeps/generic/trampoline.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Set thread_state for sighandler, and sigcontext to recover.  Stub version.
-   Copyright (C) 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd.h>
-#include <mach/thread_status.h>
-
-/* Set up STATE to run a signal handler in the thread it describes.
-   This should save the original state in a `struct sigcontext' on the
-   thread's stack (or possibly a signal stack described by SIGALTSTACK,
-   if the SA_ONSTACK bit is set in FLAGS), and return the address of
-   that structure.  */
-
-struct sigcontext *
-_hurd_setup_sighandler (int flags,
-			__sighandler_t handler,
-			struct sigaltstack *sigaltstack,
-			int signo, int sigcode,
-			void *state)
-{
-#error "Need to write sysdeps/mach/hurd/MACHINE/trampoline.c"
-}
diff --git a/sysdeps/generic/truncate.c b/sysdeps/generic/truncate.c
deleted file mode 100644
index 6d0f0c3bcb..0000000000
--- a/sysdeps/generic/truncate.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <errno.h>
-
-/* Truncate PATH to LENGTH bytes.  */
-int
-__truncate (path, length)
-     const char *path;
-     off_t length;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__truncate, truncate)
-
-stub_warning (truncate)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/truncate64.c b/sysdeps/generic/truncate64.c
deleted file mode 100644
index d7e80dc3ae..0000000000
--- a/sysdeps/generic/truncate64.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <unistd.h>
-
-/* Truncate PATH to LENGTH bytes.  */
-int
-truncate64 (path, length)
-     const char *path;
-     off64_t length;
-{
-  if ((off_t) length != length)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  return truncate (path, (off_t) length);
-}
diff --git a/sysdeps/generic/tst-audit.h b/sysdeps/generic/tst-audit.h
new file mode 100644
index 0000000000..402e7c0665
--- /dev/null
+++ b/sysdeps/generic/tst-audit.h
@@ -0,0 +1,11 @@
+/* Some machines have these macros defined in elf/tst-auditmod1.c directly.
+   New machines can supply a tst-audit.h to define these macros used there.
+
+
+# define pltenter la_CPU_gnu_pltenter
+# define pltexit la_CPU_gnu_pltexit
+# define La_regs La_CPU_regs
+# define La_retval La_CPU_retval
+# define int_retval lrv_RETVALREG
+
+*/
diff --git a/sysdeps/generic/tst-timer.c b/sysdeps/generic/tst-timer.c
deleted file mode 100644
index d9b69a2467..0000000000
--- a/sysdeps/generic/tst-timer.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Tests for POSIX timer implementation.  Dummy version.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-
-/* This file is only used if there is no other implementation and it should
-   means that there is no implementation of POSIX timers.  */
-int
-main (void)
-{
-#ifdef _POSIX_TIMERS
-  /* There should be a test.  */
-  return 1;
-#else
-  return 0;
-#endif
-}
diff --git a/sysdeps/generic/ttyname.c b/sysdeps/generic/ttyname.c
deleted file mode 100644
index 088ba918a8..0000000000
--- a/sysdeps/generic/ttyname.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-char *__ttyname = NULL;
-
-/* Return the pathname of the terminal FD is open on, or NULL on errors.
-   The returned storage is good only until the next call to this function.  */
-char *
-ttyname (fd)
-     int fd;
-{
-  __set_errno (ENOSYS);
-  return NULL;
-}
-
-
-stub_warning (ttyname)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ttyname_r.c b/sysdeps/generic/ttyname_r.c
deleted file mode 100644
index 14c1209096..0000000000
--- a/sysdeps/generic/ttyname_r.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-
-/* Store at most BUFLEN characters the pathname of the terminal FD is
-   open on in BUF.  Return 0 on success,  otherwise an error number.  */
-int
-__ttyname_r (fd, buf, buflen)
-     int fd;
-     char *buf;
-     size_t buflen;
-{
-  __set_errno (ENOSYS);
-  return ENOSYS;
-}
-weak_alias (__ttyname_r, ttyname_r)
-
-stub_warning (ttyname_r)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ualarm.c b/sysdeps/generic/ualarm.c
deleted file mode 100644
index 4ca0847576..0000000000
--- a/sysdeps/generic/ualarm.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Set an alarm to go off (generating a SIGALRM signal) in VALUE microseconds.
-   If INTERVAL is nonzero, when the alarm goes off, the timer is reset to go
-   off every INTERVAL microseconds thereafter.
-
-   Returns the number of microseconds remaining before the alarm.  */
-useconds_t
-ualarm (value, interval)
-     useconds_t value;
-     useconds_t interval;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (ualarm)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/udiv_qrnnd.c b/sysdeps/generic/udiv_qrnnd.c
deleted file mode 100644
index d32796c04d..0000000000
--- a/sysdeps/generic/udiv_qrnnd.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* For some machines GNU MP needs to define an auxiliary function:
-
-   udiv_qrnnd (quotient, remainder, high_numerator, low_numerator, denominator)
-
-   Divides a two-word unsigned integer, composed by the integers
-   HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient
-   in QUOTIENT and the remainder in REMAINDER.  HIGH_NUMERATOR must be less
-   than DENOMINATOR for correct operation.  If, in addition, the most
-   significant bit of DENOMINATOR must be 1, then the pre-processor symbol
-   UDIV_NEEDS_NORMALIZATION is defined to 1.  */
diff --git a/sysdeps/generic/ulimit.c b/sysdeps/generic/ulimit.c
deleted file mode 100644
index cc74054456..0000000000
--- a/sysdeps/generic/ulimit.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/resource.h>
-
-/* Function depends on CMD:
-   1 = Return the limit on the size of a file, in units of 512 bytes.
-   2 = Set the limit on the size of a file to NEWLIMIT.  Only the
-       super-user can increase the limit.
-   3 = Return the maximum possible address of the data segment.
-   4 = Return the maximum number of files that the calling process
-       can open.
-   Returns -1 on errors.  */
-long int
-__ulimit (int cmd, ...)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__ulimit, ulimit)
-
-stub_warning (ulimit)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/umask.c b/sysdeps/generic/umask.c
deleted file mode 100644
index 588d57e1ce..0000000000
--- a/sysdeps/generic/umask.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/stat.h>
-#include <errno.h>
-#include <sys/types.h>
-
-/* Set the file creation mask to MASK, returning the old mask.  */
-mode_t
-__umask (mask)
-     mode_t mask;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (umask)
-
-weak_alias (__umask, umask)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/uname.c b/sysdeps/generic/uname.c
deleted file mode 100644
index e7c41648ed..0000000000
--- a/sysdeps/generic/uname.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 1991,92,96,97,2000,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-
-/* This file is created by the configuration process, and defines UNAME_*.  */
-#include <config-name.h>
-
-/* Put information about the system in NAME.  */
-int
-__uname (name)
-     struct utsname *name;
-{
-  int save;
-
-  if (name == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  save = errno;
-  if (__gethostname (name->nodename, sizeof (name->nodename)) < 0)
-    {
-      if (errno == ENOSYS)
-	{
-	  /* Hostname is meaningless for this machine.  */
-	  name->nodename[0] = '\0';
-	  __set_errno (save);
-	}
-#ifdef	ENAMETOOLONG
-      else if (errno == ENAMETOOLONG)
-	/* The name was truncated.  */
-	__set_errno (save);
-#endif
-      else
-	return -1;
-    }
-  strncpy (name->sysname, UNAME_SYSNAME, sizeof (name->sysname));
-  strncpy (name->release, UNAME_RELEASE, sizeof (name->release));
-  strncpy (name->version, UNAME_VERSION, sizeof (name->version));
-  strncpy (name->machine, UNAME_MACHINE, sizeof (name->machine));
-
-  return 0;
-}
-weak_alias (__uname, uname)
-libc_hidden_def (__uname)
-libc_hidden_def (uname)
diff --git a/sysdeps/generic/unlink.c b/sysdeps/generic/unlink.c
deleted file mode 100644
index 1ec6d87ae1..0000000000
--- a/sysdeps/generic/unlink.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <unistd.h>
-
-
-/* Remove the link named NAME.  */
-int
-__unlink (name)
-     const char *name;
-{
-  if (name == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (unlink)
-
-weak_alias (__unlink, unlink)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/unlockpt.c b/sysdeps/generic/unlockpt.c
deleted file mode 100644
index c5c4890f59..0000000000
--- a/sysdeps/generic/unlockpt.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <errno.h>
-
-/* Given a fd on a master pseudoterminal, clear a kernel lock so that
-   the slave can be opened.  This is to avoid a race between opening the
-   master and calling grantpt() to take possession of the slave. */
-int
-unlockpt (fd)
-     int fd __attribute__ ((unused));
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (unlockpt)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
index eb77b260d8..d5b8119c9c 100644
--- a/sysdeps/generic/unsecvars.h
+++ b/sysdeps/generic/unsecvars.h
@@ -2,21 +2,23 @@
    all stuffed in a single string which means they have to be terminated
    with a '\0' explicitly.  */
 #define UNSECURE_ENVVARS \
-  "LD_PRELOAD\0"							      \
-  "LD_LIBRARY_PATH\0"							      \
-  "LD_ORIGIN_PATH\0"							      \
+  "GCONV_PATH\0"							      \
+  "GETCONF_DIR\0"							      \
+  "HOSTALIASES\0"							      \
+  "LD_AUDIT\0"								      \
   "LD_DEBUG\0"								      \
   "LD_DEBUG_OUTPUT\0"							      \
-  "LD_PROFILE\0"							      \
-  "LD_USE_LOAD_BIAS\0"							      \
   "LD_DYNAMIC_WEAK\0"							      \
+  "LD_LIBRARY_PATH\0"							      \
+  "LD_ORIGIN_PATH\0"							      \
+  "LD_PRELOAD\0"							      \
+  "LD_PROFILE\0"							      \
   "LD_SHOW_AUXV\0"							      \
-  "GCONV_PATH\0"							      \
-  "GETCONF_DIR\0"							      \
-  "HOSTALIASES\0"							      \
+  "LD_USE_LOAD_BIAS\0"							      \
   "LOCALDOMAIN\0"							      \
   "LOCPATH\0"								      \
   "MALLOC_TRACE\0"							      \
+  "NIS_PATH\0"								      \
   "NLSPATH\0"								      \
   "RESOLV_HOST_CONF\0"							      \
   "RES_OPTIONS\0"							      \
diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c
index 1f03d17279..13945b9719 100644
--- a/sysdeps/generic/unwind-dw2-fde.c
+++ b/sysdeps/generic/unwind-dw2-fde.c
@@ -1,5 +1,5 @@
 /* Subroutines needed for unwinding stack frames for exception handling.  */
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006
    Free Software Foundation, Inc.
    Contributed by Jason Merrill <jason@cygnus.com>.
 
@@ -595,7 +595,7 @@ end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count)
 {
   fde_compare_t fde_compare;
 
-  if (accu->linear && accu->linear->count != count)
+  if (accu->linear->count != count)
     abort ();
 
   if (ob->s.b.mixed_encoding)
diff --git a/sysdeps/generic/unwind-dw2.c b/sysdeps/generic/unwind-dw2.c
index 619250e614..d818e5dfd8 100644
--- a/sysdeps/generic/unwind-dw2.c
+++ b/sysdeps/generic/unwind-dw2.c
@@ -1,6 +1,6 @@
 /* DWARF2 exception handling and frame unwind runtime interface routines.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2005,2006
+   	Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
@@ -25,6 +25,7 @@
 #include <error.h>
 #include <libintl.h>
 #include <dwarf2.h>
+#include <stdio.h>
 #include <unwind.h>
 #include <unwind-pe.h>
 #include <unwind-dw2-fde.h>
@@ -256,7 +257,7 @@ extract_cie_info (struct dwarf_cie *cie, struct _Unwind_Context *context,
 		  _Unwind_FrameState *fs)
 {
   const unsigned char *aug = cie->augmentation;
-  const unsigned char *p = aug + strlen (aug) + 1;
+  const unsigned char *p = aug + strlen ((const char *) aug) + 1;
   const unsigned char *ret = NULL;
   _Unwind_Word utmp;
 
@@ -837,9 +838,16 @@ execute_cfa_program (const unsigned char *insn_ptr,
 	case DW_CFA_restore_state:
 	  {
 	    struct frame_state_reg_info *old_rs = fs->regs.prev;
-	    fs->regs = *old_rs;
-	    old_rs->prev = unused_rs;
-	    unused_rs = old_rs;
+#ifdef _LIBC
+	    if (old_rs == NULL)
+	      __libc_fatal ("invalid DWARF unwind data");
+	    else
+#endif
+	      {
+		fs->regs = *old_rs;
+		old_rs->prev = unused_rs;
+		unused_rs = old_rs;
+	      }
 	  }
 	  break;
 
@@ -897,12 +905,16 @@ execute_cfa_program (const unsigned char *insn_ptr,
 	  break;
 
 	case DW_CFA_GNU_window_save:
-	  /* ??? Hardcoded for SPARC register window configuration.  */
+	  /* ??? Hardcoded for SPARC register window configuration.
+	     At least do not do anything for archs which explicitly
+	     define a lower register number.  */
+#if DWARF_FRAME_REGISTERS >= 32
 	  for (reg = 16; reg < 32; ++reg)
 	    {
 	      fs->regs.reg[reg].how = REG_SAVED_OFFSET;
 	      fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *);
 	    }
+#endif
 	  break;
 
 	case DW_CFA_GNU_args_size:
diff --git a/sysdeps/generic/updwtmp.c b/sysdeps/generic/updwtmp.c
deleted file mode 100644
index 415e1dbd42..0000000000
--- a/sysdeps/generic/updwtmp.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-
-#include "utmp-private.h"
-
-#ifndef TRANSFORM_UTMP_FILE_NAME
-# define TRANSFORM_UTMP_FILE_NAME(file_name) (file_name)
-#endif
-
-void
-__updwtmp (const char *wtmp_file, const struct utmp *utmp)
-{
-  const char *file_name = TRANSFORM_UTMP_FILE_NAME (wtmp_file);
-
-  (*__libc_utmp_file_functions.updwtmp) (file_name, utmp);
-}
-weak_alias (__updwtmp, updwtmp)
diff --git a/sysdeps/generic/updwtmpx.c b/sysdeps/generic/updwtmpx.c
deleted file mode 100644
index 13a7045286..0000000000
--- a/sysdeps/generic/updwtmpx.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-void
-updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
-  __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
diff --git a/sysdeps/generic/usleep.c b/sysdeps/generic/usleep.c
deleted file mode 100644
index 8f419f901a..0000000000
--- a/sysdeps/generic/usleep.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1999,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Sleep USECONDS microseconds, or until a previously set timer goes off.  */
-int
-usleep (useconds)
-     useconds_t useconds;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (usleep)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/ustat.c b/sysdeps/generic/ustat.c
deleted file mode 100644
index 0aeee620c5..0000000000
--- a/sysdeps/generic/ustat.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Return info on filesystem.
-   Copyright (C) 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/ustat.h>
-
-int
-ustat (dev, ust)
-     dev_t dev;
-     struct ustat * ust;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (ustat)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/utime.c b/sysdeps/generic/utime.c
deleted file mode 100644
index 3a3bcc38cc..0000000000
--- a/sysdeps/generic/utime.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <utime.h>
-
-
-/* Set the access and modification times of FILE to those given in TIMES.
-   If TIMES is NULL, set them to the current time.  */
-int
-utime (file, times)
-     const char *file;
-     const struct utimbuf *times;
-{
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (utime)
-
-stub_warning (utime)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/utimes.c b/sysdeps/generic/utimes.c
deleted file mode 100644
index e4a6f0427f..0000000000
--- a/sysdeps/generic/utimes.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2000,02 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/time.h>
-#include <errno.h>
-#include <stddef.h>
-
-/* Change the access time of FILE to TVP[0] and
-   the modification time of FILE to TVP[1].  */
-int
-__utimes (file, tvp)
-     const char *file;
-     const struct timeval tvp[2];
-{
-  if (file == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-weak_alias (__utimes, utimes)
-
-stub_warning (utimes)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/utmp_file.c b/sysdeps/generic/utmp_file.c
deleted file mode 100644
index e7743bfac8..0000000000
--- a/sysdeps/generic/utmp_file.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>
-   and Paul Janzen <pcj@primenet.com>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <utmp.h>
-#include <not-cancel.h>
-
-#include "utmp-private.h"
-#include "utmp-equal.h"
-
-
-/* Descriptor for the file and position.  */
-static int file_fd = -1;
-static off64_t file_offset;
-
-/* Cache for the last read entry.  */
-static struct utmp last_entry;
-
-
-/* Locking timeout.  */
-#ifndef TIMEOUT
-# define TIMEOUT 1
-#endif
-
-/* Do-nothing handler for locking timeout.  */
-static void timeout_handler (int signum) {};
-
-/* LOCK_FILE(fd, type) failure_statement
-     attempts to get a lock on the utmp file referenced by FD.  If it fails,
-     the failure_statement is executed, otherwise it is skipped.
-   LOCKING_FAILED()
-     jumps into the UNLOCK_FILE macro and ensures cleanup of LOCK_FILE.
-   UNLOCK_FILE(fd)
-     unlocks the utmp file referenced by FD and performs the cleanup of
-     LOCK_FILE.
- */
-#define LOCK_FILE(fd, type) \
-{									      \
-  struct flock fl;							      \
-  struct sigaction action, old_action;					      \
-  unsigned int old_timeout;						      \
-									      \
-  /* Cancel any existing alarm.  */					      \
-  old_timeout = alarm (0);						      \
-									      \
-  /* Establish signal handler.  */					      \
-  action.sa_handler = timeout_handler;					      \
-  __sigemptyset (&action.sa_mask);					      \
-  action.sa_flags = 0;							      \
-  __sigaction (SIGALRM, &action, &old_action);				      \
-									      \
-  alarm (TIMEOUT);							      \
-									      \
-  /* Try to get the lock.  */						      \
-  memset (&fl, '\0', sizeof (struct flock));				      \
-  fl.l_type = (type);							      \
-  fl.l_whence = SEEK_SET;						      \
-  if (fcntl_not_cancel ((fd), F_SETLKW, &fl) < 0)
-
-#define LOCKING_FAILED() \
-  goto unalarm_return
-
-#define UNLOCK_FILE(fd) \
-  /* Unlock the file.  */						      \
-  fl.l_type = F_UNLCK;							      \
-  fcntl_not_cancel ((fd), F_SETLKW, &fl);				      \
-									      \
- unalarm_return:							      \
-  /* Reset the signal handler and alarm.  We must reset the alarm	      \
-     before resetting the handler so our alarm does not generate a	      \
-     spurious SIGALRM seen by the user.  However, we cannot just set	      \
-     the user's old alarm before restoring the handler, because then	      \
-     it's possible our handler could catch the user alarm's SIGARLM	      \
-     and then the user would never see the signal he expected.  */	      \
-  alarm (0);								      \
-  __sigaction (SIGALRM, &old_action, NULL);				      \
-  if (old_timeout != 0)							      \
-    alarm (old_timeout);						      \
-} while (0)
-
-
-/* Functions defined here.  */
-static int setutent_file (void);
-static int getutent_r_file (struct utmp *buffer, struct utmp **result);
-static int getutid_r_file (const struct utmp *key, struct utmp *buffer,
-			   struct utmp **result);
-static int getutline_r_file (const struct utmp *key, struct utmp *buffer,
-			     struct utmp **result);
-static struct utmp *pututline_file (const struct utmp *data);
-static void endutent_file (void);
-static int updwtmp_file (const char *file, const struct utmp *utmp);
-
-/* Jump table for file functions.  */
-const struct utfuncs __libc_utmp_file_functions =
-{
-  setutent_file,
-  getutent_r_file,
-  getutid_r_file,
-  getutline_r_file,
-  pututline_file,
-  endutent_file,
-  updwtmp_file
-};
-
-
-#ifndef TRANSFORM_UTMP_FILE_NAME
-# define TRANSFORM_UTMP_FILE_NAME(file_name) (file_name)
-#endif
-
-static int
-setutent_file (void)
-{
-  if (file_fd < 0)
-    {
-      const char *file_name;
-      int result;
-
-      file_name = TRANSFORM_UTMP_FILE_NAME (__libc_utmp_file_name);
-
-      file_fd = open_not_cancel_2 (file_name, O_RDWR);
-      if (file_fd == -1)
-	{
-	  /* Hhm, read-write access did not work.  Try read-only.  */
-	  file_fd = open_not_cancel_2 (file_name, O_RDONLY);
-	  if (file_fd == -1)
-	    return 0;
-	}
-
-      /* We have to make sure the file is `closed on exec'.  */
-      result = fcntl_not_cancel (file_fd, F_GETFD, 0);
-      if (result >= 0)
-	result = fcntl_not_cancel (file_fd, F_SETFD, result | FD_CLOEXEC);
-      if (result == -1)
-	{
-	  close_not_cancel_no_status (file_fd);
-	  return 0;
-	}
-    }
-
-  __lseek64 (file_fd, 0, SEEK_SET);
-  file_offset = 0;
-
-  /* Make sure the entry won't match.  */
-#if _HAVE_UT_TYPE - 0
-  last_entry.ut_type = -1;
-#else
-  last_entry.ut_line[0] = '\177';
-# if _HAVE_UT_ID - 0
-  last_entry.ut_id[0] = '\0';
-# endif
-#endif
-
-  return 1;
-}
-
-
-static int
-getutent_r_file (struct utmp *buffer, struct utmp **result)
-{
-  ssize_t nbytes;
-
-  assert (file_fd >= 0);
-
-  if (file_offset == -1l)
-    {
-      /* Not available.  */
-      *result = NULL;
-      return -1;
-    }
-
-  LOCK_FILE (file_fd, F_RDLCK)
-    {
-      nbytes = 0;
-      LOCKING_FAILED ();
-    }
-
-  /* Read the next entry.  */
-  nbytes = read_not_cancel (file_fd, &last_entry, sizeof (struct utmp));
-
-  UNLOCK_FILE (file_fd);
-
-  if (nbytes != sizeof (struct utmp))
-    {
-      if (nbytes != 0)
-	file_offset = -1l;
-      *result = NULL;
-      return -1;
-    }
-
-  /* Update position pointer.  */
-  file_offset += sizeof (struct utmp);
-
-  memcpy (buffer, &last_entry, sizeof (struct utmp));
-  *result = buffer;
-
-  return 0;
-}
-
-
-static int
-internal_getut_r (const struct utmp *id, struct utmp *buffer)
-{
-  int result = -1;
-
-  LOCK_FILE (file_fd, F_RDLCK)
-    LOCKING_FAILED ();
-
-#if _HAVE_UT_TYPE - 0
-  if (id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME
-      || id->ut_type == OLD_TIME || id->ut_type == NEW_TIME)
-    {
-      /* Search for next entry with type RUN_LVL, BOOT_TIME,
-	 OLD_TIME, or NEW_TIME.  */
-
-      while (1)
-	{
-	  /* Read the next entry.  */
-	  if (read_not_cancel (file_fd, buffer, sizeof (struct utmp))
-	      != sizeof (struct utmp))
-	    {
-	      __set_errno (ESRCH);
-	      file_offset = -1l;
-	      goto unlock_return;
-	    }
-	  file_offset += sizeof (struct utmp);
-
-	  if (id->ut_type == buffer->ut_type)
-	    break;
-	}
-    }
-  else
-#endif /* _HAVE_UT_TYPE */
-    {
-      /* Search for the next entry with the specified ID and with type
-	 INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS.  */
-
-      while (1)
-	{
-	  /* Read the next entry.  */
-	  if (read_not_cancel (file_fd, buffer, sizeof (struct utmp))
-	      != sizeof (struct utmp))
-	    {
-	      __set_errno (ESRCH);
-	      file_offset = -1l;
-	      goto unlock_return;
-	    }
-	  file_offset += sizeof (struct utmp);
-
-	  if (__utmp_equal (buffer, id))
-	    break;
-	}
-    }
-
-  result = 0;
-
-unlock_return:
-  UNLOCK_FILE (file_fd);
-
-  return result;
-}
-
-
-/* For implementing this function we don't use the getutent_r function
-   because we can avoid the reposition on every new entry this way.  */
-static int
-getutid_r_file (const struct utmp *id, struct utmp *buffer,
-		struct utmp **result)
-{
-  assert (file_fd >= 0);
-
-  if (file_offset == -1l)
-    {
-      *result = NULL;
-      return -1;
-    }
-
-  if (internal_getut_r (id, &last_entry) < 0)
-    {
-      *result = NULL;
-      return -1;
-    }
-
-  memcpy (buffer, &last_entry, sizeof (struct utmp));
-  *result = buffer;
-
-  return 0;
-}
-
-
-/* For implementing this function we don't use the getutent_r function
-   because we can avoid the reposition on every new entry this way.  */
-static int
-getutline_r_file (const struct utmp *line, struct utmp *buffer,
-		  struct utmp **result)
-{
-  assert (file_fd >= 0);
-
-  if (file_offset == -1l)
-    {
-      *result = NULL;
-      return -1;
-    }
-
-  LOCK_FILE (file_fd, F_RDLCK)
-    {
-      *result = NULL;
-      LOCKING_FAILED ();
-    }
-
-  while (1)
-    {
-      /* Read the next entry.  */
-      if (read_not_cancel (file_fd, &last_entry, sizeof (struct utmp))
-	  != sizeof (struct utmp))
-	{
-	  __set_errno (ESRCH);
-	  file_offset = -1l;
-	  *result = NULL;
-	  goto unlock_return;
-	}
-      file_offset += sizeof (struct utmp);
-
-      /* Stop if we found a user or login entry.  */
-      if (
-#if _HAVE_UT_TYPE - 0
-	  (last_entry.ut_type == USER_PROCESS
-	   || last_entry.ut_type == LOGIN_PROCESS)
-	  &&
-#endif
-	  !strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line))
-	break;
-    }
-
-  memcpy (buffer, &last_entry, sizeof (struct utmp));
-  *result = buffer;
-
-unlock_return:
-  UNLOCK_FILE (file_fd);
-
-  return ((*result == NULL) ? -1 : 0);
-}
-
-
-static struct utmp *
-pututline_file (const struct utmp *data)
-{
-  struct utmp buffer;
-  struct utmp *pbuf;
-  int found;
-
-  assert (file_fd >= 0);
-
-  /* Find the correct place to insert the data.  */
-  if (file_offset > 0
-      && (
-#if _HAVE_UT_TYPE - 0
-	  (last_entry.ut_type == data->ut_type
-	   && (last_entry.ut_type == RUN_LVL
-	       || last_entry.ut_type == BOOT_TIME
-	       || last_entry.ut_type == OLD_TIME
-	       || last_entry.ut_type == NEW_TIME))
-	  ||
-#endif
-	  __utmp_equal (&last_entry, data)))
-    found = 1;
-  else
-    found = internal_getut_r (data, &buffer);
-
-  LOCK_FILE (file_fd, F_WRLCK)
-    {
-      pbuf = NULL;
-      LOCKING_FAILED ();
-    }
-
-  if (found < 0)
-    {
-      /* We append the next entry.  */
-      file_offset = __lseek64 (file_fd, 0, SEEK_END);
-      if (file_offset % sizeof (struct utmp) != 0)
-	{
-	  file_offset -= file_offset % sizeof (struct utmp);
-	  __ftruncate64 (file_fd, file_offset);
-
-	  if (__lseek64 (file_fd, 0, SEEK_END) < 0)
-	    {
-	      pbuf = NULL;
-	      goto unlock_return;
-	    }
-	}
-    }
-  else
-    {
-      /* We replace the just read entry.  */
-      file_offset -= sizeof (struct utmp);
-      __lseek64 (file_fd, file_offset, SEEK_SET);
-    }
-
-  /* Write the new data.  */
-  if (write_not_cancel (file_fd, data, sizeof (struct utmp))
-      != sizeof (struct utmp))
-    {
-      /* If we appended a new record this is only partially written.
-	 Remove it.  */
-      if (found < 0)
-	(void) __ftruncate64 (file_fd, file_offset);
-      pbuf = NULL;
-    }
-  else
-    {
-      file_offset += sizeof (struct utmp);
-      pbuf = (struct utmp *) data;
-    }
-
- unlock_return:
-  UNLOCK_FILE (file_fd);
-
-  return pbuf;
-}
-
-
-static void
-endutent_file (void)
-{
-  assert (file_fd >= 0);
-
-  close_not_cancel_no_status (file_fd);
-  file_fd = -1;
-}
-
-
-static int
-updwtmp_file (const char *file, const struct utmp *utmp)
-{
-  int result = -1;
-  off64_t offset;
-  int fd;
-
-  /* Open WTMP file.  */
-  fd = open_not_cancel_2 (file, O_WRONLY);
-  if (fd < 0)
-    return -1;
-
-  LOCK_FILE (fd, F_WRLCK)
-    LOCKING_FAILED ();
-
-  /* Remember original size of log file.  */
-  offset = __lseek64 (fd, 0, SEEK_END);
-  if (offset % sizeof (struct utmp) != 0)
-    {
-      offset -= offset % sizeof (struct utmp);
-      __ftruncate64 (fd, offset);
-
-      if (__lseek64 (fd, 0, SEEK_END) < 0)
-	goto unlock_return;
-    }
-
-  /* Write the entry.  If we can't write all the bytes, reset the file
-     size back to the original size.  That way, no partial entries
-     will remain.  */
-  if (write_not_cancel (fd, utmp, sizeof (struct utmp))
-      != sizeof (struct utmp))
-    {
-      __ftruncate64 (fd, offset);
-      goto unlock_return;
-    }
-
-  result = 0;
-
-unlock_return:
-  UNLOCK_FILE (fd);
-
-  /* Close WTMP file.  */
-  close_not_cancel_no_status (fd);
-
-  return result;
-}
diff --git a/sysdeps/generic/utmpxname.c b/sysdeps/generic/utmpxname.c
deleted file mode 100644
index 06ff80b982..0000000000
--- a/sysdeps/generic/utmpxname.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <utmp.h>
-#include <utmpx.h>
-
-int
-utmpxname (const char *file)
-{
-  return __utmpname (file);
-}
diff --git a/sysdeps/generic/versionsort64.c b/sysdeps/generic/versionsort64.c
deleted file mode 100644
index e471827023..0000000000
--- a/sysdeps/generic/versionsort64.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1992, 1997, 1998, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <dirent.h>
-#include <string.h>
-
-int
-versionsort64 (const void *a, const void *b)
-{
-  return __strverscmp ((*(const struct dirent64 **) a)->d_name,
-		       (*(const struct dirent64 **) b)->d_name);
-}
diff --git a/sysdeps/generic/vfork.c b/sysdeps/generic/vfork.c
deleted file mode 100644
index d15841d712..0000000000
--- a/sysdeps/generic/vfork.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* If we don't have vfork, fork is close enough.  */
-
-__pid_t
-__vfork (void)
-{
-  return __fork ();
-}
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/sysdeps/generic/vhangup.c b/sysdeps/generic/vhangup.c
deleted file mode 100644
index 329fddbf24..0000000000
--- a/sysdeps/generic/vhangup.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-/* Revoke access permissions to all processes currently communicating
-   with the control terminal, and then send a SIGHUP signal to the process
-   group of the control terminal.  */
-int
-vhangup ()
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-
-stub_warning (vhangup)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/vlimit.c b/sysdeps/generic/vlimit.c
deleted file mode 100644
index 03d89f4ad5..0000000000
--- a/sysdeps/generic/vlimit.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1991, 1996, 1997, 1998, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This is generic in the sense that it will work with the BSD, SYSV,
-   or stub versions of getrlimit.  Separate versions could be written
-   for efficiency, but it's probably not worth it.  */
-
-#include <sys/vlimit.h>
-#include <sys/resource.h>
-#include <errno.h>
-
-/* Set the soft limit for RESOURCE to be VALUE.
-   Returns 0 for success, -1 for failure.  */
-int
-vlimit (resource, value)
-     enum __vlimit_resource resource;
-     int value;
-{
-  if (resource >= LIM_CPU && resource <= LIM_MAXRSS)
-    {
-      /* The rlimit codes happen to each be one less
-	 than the corresponding vlimit codes.  */
-      enum __rlimit_resource rlimit_res =
-	(enum __rlimit_resource) ((int) resource - 1);
-      struct rlimit lims;
-
-      if (__getrlimit (rlimit_res, &lims) < 0)
-	return -1;
-
-      lims.rlim_cur = value;
-      return __setrlimit (rlimit_res, &lims);
-    }
-
-  __set_errno (EINVAL);
-  return -1;
-}
diff --git a/sysdeps/generic/vtimes.c b/sysdeps/generic/vtimes.c
deleted file mode 100644
index 37dc01b2fb..0000000000
--- a/sysdeps/generic/vtimes.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (C) 1991, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <sys/vtimes.h>
-#include <sys/resource.h>
-
-/* Return the number of 1/VTIMES_UNITS_PER_SECOND-second
-   units in the `struct timeval' TV.  */
-#define TIMEVAL_TO_VTIMES(tv) \
-  ((tv.tv_sec * VTIMES_UNITS_PER_SECOND) + \
-   (tv.tv_usec * VTIMES_UNITS_PER_SECOND / 1000000))
-
-/* If VT is not NULL, write statistics for WHO into *VT.
-   Return 0 for success, -1 for failure.  */
-static int
-vtimes_one (struct vtimes *vt, enum __rusage_who who)
-{
-  if (vt != NULL)
-    {
-      struct rusage usage;
-
-      if (__getrusage (who, &usage) < 0)
-	return -1;
-
-      vt->vm_utime = TIMEVAL_TO_VTIMES (usage.ru_utime);
-      vt->vm_stime = TIMEVAL_TO_VTIMES (usage.ru_stime);
-      vt->vm_idsrss = usage.ru_idrss + usage.ru_isrss;
-      vt->vm_majflt = usage.ru_majflt;
-      vt->vm_minflt = usage.ru_minflt;
-      vt->vm_nswap = usage.ru_nswap;
-      vt->vm_inblk = usage.ru_inblock;
-      vt->vm_oublk = usage.ru_oublock;
-    }
-  return 0;
-}
-
-/* If CURRENT is not NULL, write statistics for the current process into
-   *CURRENT.  If CHILD is not NULL, write statistics for all terminated child
-   processes into *CHILD.  Returns 0 for success, -1 for failure.  */
-int
-vtimes (current, child)
-     struct vtimes *current;
-     struct vtimes *child;
-{
-  if (vtimes_one (current, RUSAGE_SELF) < 0
-      || vtimes_one (child, RUSAGE_CHILDREN) < 0)
-    return -1;
-  return 0;
-}
diff --git a/sysdeps/generic/w_acos.c b/sysdeps/generic/w_acos.c
deleted file mode 100644
index 5a1158ea7a..0000000000
--- a/sysdeps/generic/w_acos.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* @(#)w_acos.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acos.c,v 1.6 1995/05/10 20:48:26 jtc Exp $";
-#endif
-
-/*
- * wrap_acos(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __acos(double x)		/* wrapper acos */
-#else
-	double __acos(x)			/* wrapper acos */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_acos(x);
-#else
-	double z;
-	z = __ieee754_acos(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(fabs(x)>1.0) {
-	        return __kernel_standard(x,x,1); /* acos(|x|>1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__acos, acos)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__acos, __acosl)
-weak_alias (__acos, acosl)
-#endif
diff --git a/sysdeps/generic/w_acosf.c b/sysdeps/generic/w_acosf.c
deleted file mode 100644
index 28260ddd3e..0000000000
--- a/sysdeps/generic/w_acosf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_acosf.c -- float version of w_acos.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acosf.c,v 1.3 1995/05/10 20:48:29 jtc Exp $";
-#endif
-
-/*
- * wrap_acosf(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __acosf(float x)		/* wrapper acosf */
-#else
-	float __acosf(x)			/* wrapper acosf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_acosf(x);
-#else
-	float z;
-	z = __ieee754_acosf(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	if(fabsf(x)>(float)1.0) {
-	        /* acosf(|x|>1) */
-	        return (float)__kernel_standard((double)x,(double)x,101);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__acosf, acosf)
diff --git a/sysdeps/generic/w_acosh.c b/sysdeps/generic/w_acosh.c
deleted file mode 100644
index 2b5d60f7ea..0000000000
--- a/sysdeps/generic/w_acosh.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @(#)w_acosh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acosh.c,v 1.6 1995/05/10 20:48:31 jtc Exp $";
-#endif
-
-/*
- * wrapper acosh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __acosh(double x)		/* wrapper acosh */
-#else
-	double __acosh(x)			/* wrapper acosh */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_acosh(x);
-#else
-	double z;
-	z = __ieee754_acosh(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(x<1.0) {
-	        return __kernel_standard(x,x,29); /* acosh(x<1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__acosh, acosh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__acosh, __acoshl)
-weak_alias (__acosh, acoshl)
-#endif
diff --git a/sysdeps/generic/w_acoshf.c b/sysdeps/generic/w_acoshf.c
deleted file mode 100644
index f701983dc2..0000000000
--- a/sysdeps/generic/w_acoshf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_acoshf.c -- float version of w_acosh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- *
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_acoshf.c,v 1.3 1995/05/10 20:48:33 jtc Exp $";
-#endif
-
-/* 
- * wrapper acoshf(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __acoshf(float x)		/* wrapper acoshf */
-#else
-	float __acoshf(x)			/* wrapper acoshf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_acoshf(x);
-#else
-	float z;
-	z = __ieee754_acoshf(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	if(x<(float)1.0) {
-		/* acosh(x<1) */
-	        return (float)__kernel_standard((double)x,(double)x,129);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__acoshf, acoshf)
diff --git a/sysdeps/generic/w_acoshl.c b/sysdeps/generic/w_acoshl.c
deleted file mode 100644
index a37d4c15d9..0000000000
--- a/sysdeps/generic/w_acoshl.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_acoshl.c -- long double version of w_acosh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper acoshl(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __acoshl(long double x)	/* wrapper acosh */
-#else
-	long double __acoshl(x)			/* wrapper acosh */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_acoshl(x);
-#else
-	long double z;
-	z = __ieee754_acoshl(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	if(x<1.0) {
-	        return __kernel_standard(x,x,229); /* acoshl(x<1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__acoshl, acoshl)
diff --git a/sysdeps/generic/w_acosl.c b/sysdeps/generic/w_acosl.c
deleted file mode 100644
index cd9cecf2f9..0000000000
--- a/sysdeps/generic/w_acosl.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_acosl.c -- long double version of w_acos.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrap_acosl(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __acosl(long double x)	/* wrapper acos */
-#else
-	long double __acosl(x)			/* wrapper acos */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_acosl(x);
-#else
-	long double z;
-	z = __ieee754_acosl(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	if(fabsl(x)>1.0) {
-	        return __kernel_standard(x,x,201); /* acosl(|x|>1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__acosl, acosl)
diff --git a/sysdeps/generic/w_asin.c b/sysdeps/generic/w_asin.c
deleted file mode 100644
index a7ca4ef9fd..0000000000
--- a/sysdeps/generic/w_asin.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* @(#)w_asin.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_asin.c,v 1.6 1995/05/10 20:48:35 jtc Exp $";
-#endif
-
-/*
- * wrapper asin(x)
- */
-
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __asin(double x)		/* wrapper asin */
-#else
-	double __asin(x)			/* wrapper asin */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_asin(x);
-#else
-	double z;
-	z = __ieee754_asin(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(fabs(x)>1.0) {
-	        return __kernel_standard(x,x,2); /* asin(|x|>1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__asin, asin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__asin, __asinl)
-weak_alias (__asin, asinl)
-#endif
diff --git a/sysdeps/generic/w_asinf.c b/sysdeps/generic/w_asinf.c
deleted file mode 100644
index d7f7a253b0..0000000000
--- a/sysdeps/generic/w_asinf.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* w_asinf.c -- float version of w_asin.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_asinf.c,v 1.3 1995/05/10 20:48:37 jtc Exp $";
-#endif
-
-/* 
- * wrapper asinf(x)
- */
-
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __asinf(float x)		/* wrapper asinf */
-#else
-	float __asinf(x)			/* wrapper asinf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_asinf(x);
-#else
-	float z;
-	z = __ieee754_asinf(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	if(fabsf(x)>(float)1.0) {
-	    /* asinf(|x|>1) */
-	    return (float)__kernel_standard((double)x,(double)x,102);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__asinf, asinf)
diff --git a/sysdeps/generic/w_asinl.c b/sysdeps/generic/w_asinl.c
deleted file mode 100644
index 0ac3038e95..0000000000
--- a/sysdeps/generic/w_asinl.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* w_asinl.c -- long double version of w_asin.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper asinl(x)
- */
-
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __asinl(long double x)	/* wrapper asinl */
-#else
-	long double __asinl(x)			/* wrapper asinl */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_asinl(x);
-#else
-	long double z;
-	z = __ieee754_asinl(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	if(fabsl(x)>1.0) {
-	        return __kernel_standard(x,x,202); /* asinl(|x|>1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__asinl, asinl)
diff --git a/sysdeps/generic/w_atan2.c b/sysdeps/generic/w_atan2.c
deleted file mode 100644
index 801baa2347..0000000000
--- a/sysdeps/generic/w_atan2.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @(#)w_atan2.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atan2.c,v 1.6 1995/05/10 20:48:39 jtc Exp $";
-#endif
-
-/*
- * wrapper atan2(y,x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __atan2(double y, double x)	/* wrapper atan2 */
-#else
-	double __atan2(y,x)			/* wrapper atan2 */
-	double y,x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_atan2(y,x);
-#else
-	double z;
-	z = __ieee754_atan2(y,x);
-	if(_LIB_VERSION != _SVID_||__isnan(x)||__isnan(y)) return z;
-	if(x==0.0&&y==0.0)
-	  return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */
-	return z;
-#endif
-}
-weak_alias (__atan2, atan2)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__atan2, __atan2l)
-weak_alias (__atan2, atan2l)
-#endif
diff --git a/sysdeps/generic/w_atan2f.c b/sysdeps/generic/w_atan2f.c
deleted file mode 100644
index 09caa06f00..0000000000
--- a/sysdeps/generic/w_atan2f.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* w_atan2f.c -- float version of w_atan2.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atan2f.c,v 1.3 1995/05/10 20:48:42 jtc Exp $";
-#endif
-
-/*
- * wrapper atan2f(y,x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __atan2f(float y, float x)		/* wrapper atan2f */
-#else
-	float __atan2f(y,x)			/* wrapper atan2 */
-	float y,x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_atan2f(y,x);
-#else
-	float z;
-	z = __ieee754_atan2f(y,x);
-	if(_LIB_VERSION != _SVID_||__isnanf(x)||__isnanf(y)) return z;
-	if(x==0.0&&y==0.0)
-	  return __kernel_standard(y,x,103); /* atan2(+-0,+-0) */
-	return z;
-#endif
-}
-weak_alias (__atan2f, atan2f)
diff --git a/sysdeps/generic/w_atan2l.c b/sysdeps/generic/w_atan2l.c
deleted file mode 100644
index 2897c8c5f9..0000000000
--- a/sysdeps/generic/w_atan2l.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_atan2l.c -- long double version of w_atan2.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper atan2l(y,x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __atan2l(long double y, long double x) /* wrapper atan2l */
-#else
-	long double __atan2l(y,x)			/* wrapper atan2l */
-	long double y,x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_atan2l(y,x);
-#else
-	long double z;
-	z = __ieee754_atan2l(y,x);
-	if(_LIB_VERSION != _SVID_||__isnanl(x)||__isnanl(y)) return z;
-	if(x==0.0&&y==0.0)
-	  return __kernel_standard(y,x,203); /* atan2(+-0,+-0) */
-	return z;
-#endif
-}
-weak_alias (__atan2l, atan2l)
diff --git a/sysdeps/generic/w_atanh.c b/sysdeps/generic/w_atanh.c
deleted file mode 100644
index e7995b1830..0000000000
--- a/sysdeps/generic/w_atanh.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* @(#)w_atanh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atanh.c,v 1.6 1995/05/10 20:48:43 jtc Exp $";
-#endif
-
-/*
- * wrapper atanh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __atanh(double x)		/* wrapper atanh */
-#else
-	double __atanh(x)			/* wrapper atanh */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_atanh(x);
-#else
-	double z,y;
-	z = __ieee754_atanh(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	y = fabs(x);
-	if(y>=1.0) {
-	    if(y>1.0)
-	        return __kernel_standard(x,x,30); /* atanh(|x|>1) */
-	    else
-	        return __kernel_standard(x,x,31); /* atanh(|x|==1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__atanh, atanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__atanh, __atanhl)
-weak_alias (__atanh, atanhl)
-#endif
diff --git a/sysdeps/generic/w_atanhf.c b/sysdeps/generic/w_atanhf.c
deleted file mode 100644
index 0b24f2c71a..0000000000
--- a/sysdeps/generic/w_atanhf.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* w_atanhf.c -- float version of w_atanh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_atanhf.c,v 1.3 1995/05/10 20:48:45 jtc Exp $";
-#endif
-
-/* 
- * wrapper atanhf(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __atanhf(float x)		/* wrapper atanhf */
-#else
-	float __atanhf(x)			/* wrapper atanhf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_atanhf(x);
-#else
-	float z,y;
-	z = __ieee754_atanhf(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	y = fabsf(x);
-	if(y>=(float)1.0) {
-	    if(y>(float)1.0)
-	        /* atanhf(|x|>1) */
-	        return (float)__kernel_standard((double)x,(double)x,130);
-	    else 
-	        /* atanhf(|x|==1) */
-	        return (float)__kernel_standard((double)x,(double)x,131);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__atanhf, atanhf)
diff --git a/sysdeps/generic/w_atanhl.c b/sysdeps/generic/w_atanhl.c
deleted file mode 100644
index d675fc6fe7..0000000000
--- a/sysdeps/generic/w_atanhl.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* w_atanhl.c -- long double version of w_atanh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper atanhl(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __atanhl(long double x)	/* wrapper atanhl */
-#else
-	long double __atanhl(x)			/* wrapper atanhl */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_atanhl(x);
-#else
-	long double z,y;
-	z = __ieee754_atanhl(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	y = fabsl(x);
-	if(y>=1.0) {
-	    if(y>1.0)
-	        return __kernel_standard(x,x,230); /* atanhl(|x|>1) */
-	    else
-	        return __kernel_standard(x,x,231); /* atanhl(|x|==1) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__atanhl, atanhl)
diff --git a/sysdeps/generic/w_cosh.c b/sysdeps/generic/w_cosh.c
deleted file mode 100644
index 709f485c6d..0000000000
--- a/sysdeps/generic/w_cosh.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @(#)w_cosh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_cosh.c,v 1.6 1995/05/10 20:48:47 jtc Exp $";
-#endif
-
-/*
- * wrapper cosh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __cosh(double x)		/* wrapper cosh */
-#else
-	double __cosh(x)			/* wrapper cosh */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_cosh(x);
-#else
-	double z;
-	z = __ieee754_cosh(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(!__finite(z) && __finite(x)) {
-	        return __kernel_standard(x,x,5); /* cosh overflow */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__cosh, cosh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cosh, __coshl)
-weak_alias (__cosh, coshl)
-#endif
diff --git a/sysdeps/generic/w_coshf.c b/sysdeps/generic/w_coshf.c
deleted file mode 100644
index c38fd1d93f..0000000000
--- a/sysdeps/generic/w_coshf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_coshf.c -- float version of w_cosh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_coshf.c,v 1.3 1995/05/10 20:48:49 jtc Exp $";
-#endif
-
-/* 
- * wrapper coshf(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __coshf(float x)		/* wrapper coshf */
-#else
-	float __coshf(x)			/* wrapper coshf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_coshf(x);
-#else
-	float z;
-	z = __ieee754_coshf(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	if(!__finite(z) && __finite(x)) {	
-		/* cosh overflow */
-	        return (float)__kernel_standard((double)x,(double)x,105);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__coshf, coshf)
diff --git a/sysdeps/generic/w_coshl.c b/sysdeps/generic/w_coshl.c
deleted file mode 100644
index cc1929a9ec..0000000000
--- a/sysdeps/generic/w_coshl.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_acoshl.c -- long double version of w_acosh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper coshl(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __coshl(long double x)	/* wrapper coshl */
-#else
-	long double __coshl(x)			/* wrapper coshl */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_coshl(x);
-#else
-	long double z;
-	z = __ieee754_coshl(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	if(!__finite(z) && __finite(x)) {
-	        return __kernel_standard(x,x,205); /* cosh overflow */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__coshl, coshl)
diff --git a/sysdeps/generic/w_drem.c b/sysdeps/generic/w_drem.c
deleted file mode 100644
index 9e2b1e7472..0000000000
--- a/sysdeps/generic/w_drem.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * drem() wrapper for remainder().
- *
- * Written by J.T. Conklin, <jtc@wimsey.com>
- * Placed into the Public Domain, 1994.
- */
-
-#include <math.h>
-
-double
-__drem(x, y)
-	double x, y;
-{
-	return __remainder(x, y);
-}
-weak_alias (__drem, drem)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__drem, __dreml)
-weak_alias (__drem, dreml)
-#endif
diff --git a/sysdeps/generic/w_dremf.c b/sysdeps/generic/w_dremf.c
deleted file mode 100644
index b740ea304c..0000000000
--- a/sysdeps/generic/w_dremf.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * dremf() wrapper for remainderf().
- * 
- * Written by J.T. Conklin, <jtc@wimsey.com>
- * Placed into the Public Domain, 1994.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-float
-__dremf(x, y)
-	float x, y;
-{
-	return __remainderf(x, y);
-}
-weak_alias (__dremf, dremf)
diff --git a/sysdeps/generic/w_dreml.c b/sysdeps/generic/w_dreml.c
deleted file mode 100644
index aa73eedc49..0000000000
--- a/sysdeps/generic/w_dreml.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * dreml() wrapper for remainderl().
- *
- * Written by J.T. Conklin, <jtc@wimsey.com>
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- * Placed into the Public Domain, 1994.
- */
-
-#include <math.h>
-
-long double
-__dreml(x, y)
-	long double x, y;
-{
-	return __remainderl(x, y);
-}
-weak_alias (__dreml, dreml)
diff --git a/sysdeps/generic/w_exp10.c b/sysdeps/generic/w_exp10.c
deleted file mode 100644
index 597506f22f..0000000000
--- a/sysdeps/generic/w_exp10.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* @(#)w_exp10.c
- * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper exp10(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __exp10(double x)		/* wrapper exp10 */
-#else
-	double __exp10(x)			/* wrapper exp10 */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_exp10(x);
-#else
-	double z;
-	z = __ieee754_exp10(x);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if(!__finite(z) && __finite(x)) {
-	    /* exp10 overflow (46) if x > 0, underflow (47) if x < 0.  */
-	    return __kernel_standard(x,x,46+!!__signbit(x));
-	}
-	return z;
-#endif
-}
-weak_alias (__exp10, exp10)
-strong_alias (__exp10, __pow10)
-weak_alias (__pow10, pow10)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__exp10, __exp10l)
-weak_alias (__exp10, exp10l)
-strong_alias (__exp10l, __pow10l)
-weak_alias (__pow10l, pow10l)
-#endif
diff --git a/sysdeps/generic/w_exp10f.c b/sysdeps/generic/w_exp10f.c
deleted file mode 100644
index 1c510a3bfa..0000000000
--- a/sysdeps/generic/w_exp10f.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* w_exp10f.c -- float version of w_exp10.c.
- * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper expf10(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __exp10f(float x)		/* wrapper exp10f */
-#else
-	float __exp10f(x)			/* wrapper exp10f */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_exp10f(x);
-#else
-	float z;
-	z = __ieee754_exp10f(x);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if(!__finitef(z) && __finitef(x)) {
-	    /* exp10f overflow (146) if x > 0, underflow (147) if x < 0.  */
-	    return (float)__kernel_standard((double) x, (double) x,
-					    146+!!__signbitf(x));
-	}
-	return z;
-#endif
-}
-weak_alias (__exp10f, exp10f)
-strong_alias (__exp10f, __pow10f)
-weak_alias (__pow10f, pow10f)
diff --git a/sysdeps/generic/w_exp10l.c b/sysdeps/generic/w_exp10l.c
deleted file mode 100644
index aebddcb201..0000000000
--- a/sysdeps/generic/w_exp10l.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* w_exp10l.c -- long double version of w_exp10.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper exp10l(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __exp10l(long double x)	/* wrapper exp10 */
-#else
-	long double __exp10l(x)			/* wrapper exp10 */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_exp10l(x);
-#else
-	long double z;
-	z = __ieee754_exp10l(x);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if(!__finitel(z) && __finitel(x)) {
-	    /* exp10 overflow (246) if x > 0, underflow (247) if x < 0.  */
-	    return __kernel_standard(x,x,246+__signbitl(x));
-	}
-	return z;
-#endif
-}
-weak_alias (__exp10l, exp10l)
-strong_alias (__exp10l, __pow10l)
-weak_alias (__pow10l, pow10l)
diff --git a/sysdeps/generic/w_exp2.c b/sysdeps/generic/w_exp2.c
deleted file mode 100644
index 4e667d770e..0000000000
--- a/sysdeps/generic/w_exp2.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * wrapper exp2(x)
- */
-
-#include <float.h>
-#include "math.h"
-#include "math_private.h"
-
-static const double o_threshold= (double) DBL_MAX_EXP;
-static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
-
-double
-__exp2 (double x)		/* wrapper exp2 */
-{
-#ifdef _IEEE_LIBM
-  return __ieee754_exp2 (x);
-#else
-  double z;
-  z = __ieee754_exp2 (x);
-  if (_LIB_VERSION != _IEEE_ && __finite (x))
-    {
-      if (x > o_threshold)
-	/* exp2 overflow */
-	return __kernel_standard (x, x, 44);
-      else if (x <= u_threshold)
-	/* exp2 underflow */
-	return __kernel_standard (x, x, 45);
-    }
-  return z;
-#endif
-}
-weak_alias (__exp2, exp2)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__exp2, __expl2)
-weak_alias (__exp2, expl2)
-#endif
diff --git a/sysdeps/generic/w_exp2f.c b/sysdeps/generic/w_exp2f.c
deleted file mode 100644
index 13cfc9a19f..0000000000
--- a/sysdeps/generic/w_exp2f.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * wrapper exp2f(x)
- */
-
-#include <float.h>
-#include "math.h"
-#include "math_private.h"
-
-static const float o_threshold= (float) FLT_MAX_EXP;
-static const float u_threshold= (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
-
-float
-__exp2f (float x)		/* wrapper exp2f */
-{
-#ifdef _IEEE_LIBM
-  return __ieee754_exp2f (x);
-#else
-  float z;
-  z = __ieee754_exp2f (x);
-  if (_LIB_VERSION != _IEEE_ && __finitef (x))
-    {
-      if (x > o_threshold)
-	/* exp2 overflow */
-	return (float) __kernel_standard ((double) x, (double) x, 144);
-      else if (x <= u_threshold)
-	/* exp2 underflow */
-	return (float) __kernel_standard ((double) x, (double) x, 145);
-    }
-  return z;
-#endif
-}
-weak_alias (__exp2f, exp2f)
diff --git a/sysdeps/generic/w_exp2l.c b/sysdeps/generic/w_exp2l.c
deleted file mode 100644
index f492301223..0000000000
--- a/sysdeps/generic/w_exp2l.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * wrapper exp2l(x)
- */
-
-#include <float.h>
-#include "math.h"
-#include "math_private.h"
-
-static const long double o_threshold = (long double) LDBL_MAX_EXP;
-static const long double u_threshold
-  = (long double) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1);
-
-long double
-__exp2l (long double x)			/* wrapper exp2l */
-{
-#ifdef _IEEE_LIBM
-  return __ieee754_exp2l (x);
-#else
-  long double z;
-  z = __ieee754_exp2l (x);
-  if (_LIB_VERSION != _IEEE_ && __finitel (x))
-    {
-      if (x > o_threshold)
-	return __kernel_standard (x, x, 244); /* exp2l overflow */
-      else if (x <= u_threshold)
-	return __kernel_standard (x, x, 245); /* exp2l underflow */
-    }
-  return z;
-#endif
-}
-weak_alias (__exp2l, exp2l)
diff --git a/sysdeps/generic/w_expl.c b/sysdeps/generic/w_expl.c
deleted file mode 100644
index 70096a820c..0000000000
--- a/sysdeps/generic/w_expl.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-
-long double
-__expl(long double x)
-{
-  fputs ("__expl not implemented\n", stderr);
-  __set_errno (ENOSYS);
-  return 0.0;
-}
-
-weak_alias (__expl, expl)
diff --git a/sysdeps/generic/w_fmod.c b/sysdeps/generic/w_fmod.c
deleted file mode 100644
index 0ceeb98c55..0000000000
--- a/sysdeps/generic/w_fmod.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* @(#)w_fmod.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
-#endif
-
-/*
- * wrapper fmod(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __fmod(double x, double y)	/* wrapper fmod */
-#else
-	double __fmod(x,y)		/* wrapper fmod */
-	double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_fmod(x,y);
-#else
-	double z;
-	z = __ieee754_fmod(x,y);
-	if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
-	if(y==0.0) {
-	        return __kernel_standard(x,y,27); /* fmod(x,0) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__fmod, fmod)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__fmod, __fmodl)
-weak_alias (__fmod, fmodl)
-#endif
diff --git a/sysdeps/generic/w_fmodf.c b/sysdeps/generic/w_fmodf.c
deleted file mode 100644
index 9afe5ddfdd..0000000000
--- a/sysdeps/generic/w_fmodf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_fmodf.c -- float version of w_fmod.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_fmodf.c,v 1.3 1995/05/10 20:48:57 jtc Exp $";
-#endif
-
-/* 
- * wrapper fmodf(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __fmodf(float x, float y)	/* wrapper fmodf */
-#else
-	float __fmodf(x,y)		/* wrapper fmodf */
-	float x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_fmodf(x,y);
-#else
-	float z;
-	z = __ieee754_fmodf(x,y);
-	if(_LIB_VERSION == _IEEE_ ||__isnanf(y)||__isnanf(x)) return z;
-	if(y==(float)0.0) {
-		/* fmodf(x,0) */
-	        return (float)__kernel_standard((double)x,(double)y,127);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__fmodf, fmodf)
diff --git a/sysdeps/generic/w_fmodl.c b/sysdeps/generic/w_fmodl.c
deleted file mode 100644
index 71ed4a94a4..0000000000
--- a/sysdeps/generic/w_fmodl.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_fmodl.c -- long double version of w_fmod.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper fmodl(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __fmodl(long double x, long double y)/* wrapper fmodl */
-#else
-	long double __fmodl(x,y)		/* wrapper fmodl */
-	long double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_fmodl(x,y);
-#else
-	long double z;
-	z = __ieee754_fmodl(x,y);
-	if(_LIB_VERSION == _IEEE_ ||__isnanl(y)||__isnanl(x)) return z;
-	if(y==0.0) {
-	        return __kernel_standard(x,y,227); /* fmod(x,0) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__fmodl, fmodl)
diff --git a/sysdeps/generic/w_hypot.c b/sysdeps/generic/w_hypot.c
deleted file mode 100644
index e91db17083..0000000000
--- a/sysdeps/generic/w_hypot.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* @(#)w_hypot.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_hypot.c,v 1.6 1995/05/10 20:49:07 jtc Exp $";
-#endif
-
-/*
- * wrapper hypot(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __hypot(double x, double y)/* wrapper hypot */
-#else
-	double __hypot(x,y)		/* wrapper hypot */
-	double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_hypot(x,y);
-#else
-	double z;
-	z = __ieee754_hypot(x,y);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if((!__finite(z))&&__finite(x)&&__finite(y))
-	    return __kernel_standard(x,y,4); /* hypot overflow */
-	else
-	    return z;
-#endif
-}
-weak_alias (__hypot, hypot)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__hypot, __hypotl)
-weak_alias (__hypot, hypotl)
-#endif
diff --git a/sysdeps/generic/w_hypotf.c b/sysdeps/generic/w_hypotf.c
deleted file mode 100644
index a7e5c1fdb6..0000000000
--- a/sysdeps/generic/w_hypotf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_hypotf.c -- float version of w_hypot.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_hypotf.c,v 1.3 1995/05/10 20:49:09 jtc Exp $";
-#endif
-
-/*
- * wrapper hypotf(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __hypotf(float x, float y)	/* wrapper hypotf */
-#else
-	float __hypotf(x,y)		/* wrapper hypotf */
-	float x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_hypotf(x,y);
-#else
-	float z;
-	z = __ieee754_hypotf(x,y);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if((!__finitef(z))&&__finitef(x)&&__finitef(y))
-	    /* hypot overflow */
-	    return (float)__kernel_standard((double)x,(double)y,104);
-	else
-	    return z;
-#endif
-}
-weak_alias (__hypotf, hypotf)
diff --git a/sysdeps/generic/w_hypotl.c b/sysdeps/generic/w_hypotl.c
deleted file mode 100644
index 2ec215fd13..0000000000
--- a/sysdeps/generic/w_hypotl.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_hypotl.c -- long double version of w_hypot.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper hypotl(x,y)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __hypotl(long double x, long double y)/* wrapper hypotl */
-#else
-	long double __hypotl(x,y)			 /* wrapper hypotl */
-	long double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_hypotl(x,y);
-#else
-	long double z;
-	z = __ieee754_hypotl(x,y);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if((!__finitel(z))&&__finitel(x)&&__finitel(y))
-	    return __kernel_standard(x,y,204); /* hypot overflow */
-	else
-	    return z;
-#endif
-}
-weak_alias (__hypotl, hypotl)
diff --git a/sysdeps/generic/w_j0.c b/sysdeps/generic/w_j0.c
deleted file mode 100644
index 5a018760bb..0000000000
--- a/sysdeps/generic/w_j0.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* @(#)w_j0.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j0.c,v 1.6 1995/05/10 20:49:11 jtc Exp $";
-#endif
-
-/*
- * wrapper j0(double x), y0(double x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double j0(double x)		/* wrapper j0 */
-#else
-	double j0(x)			/* wrapper j0 */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_j0(x);
-#else
-	double z = __ieee754_j0(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(fabs(x)>X_TLOSS) {
-	        return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
-#ifdef NO_LONG_DOUBLE
-strong_alias (j0, j0l)
-#endif
-
-
-#ifdef __STDC__
-	double y0(double x)		/* wrapper y0 */
-#else
-	double y0(x)			/* wrapper y0 */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_y0(x);
-#else
-	double z;
-	z = __ieee754_y0(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard(x,x,8);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard(x,x,9);
-        }
-	if(x>X_TLOSS) {
-	        return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
-#ifdef NO_LONG_DOUBLE
-strong_alias (y0, y0l)
-#endif
diff --git a/sysdeps/generic/w_j0f.c b/sysdeps/generic/w_j0f.c
deleted file mode 100644
index 32e2eebb56..0000000000
--- a/sysdeps/generic/w_j0f.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* w_j0f.c -- float version of w_j0.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j0f.c,v 1.3 1995/05/10 20:49:13 jtc Exp $";
-#endif
-
-/*
- * wrapper j0f(float x), y0f(float x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float j0f(float x)		/* wrapper j0f */
-#else
-	float j0f(x)			/* wrapper j0f */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_j0f(x);
-#else
-	float z = __ieee754_j0f(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	if(fabsf(x)>(float)X_TLOSS) {
-		/* j0f(|x|>X_TLOSS) */
-	        return (float)__kernel_standard((double)x,(double)x,134);
-	} else
-	    return z;
-#endif
-}
-
-#ifdef __STDC__
-	float y0f(float x)		/* wrapper y0f */
-#else
-	float y0f(x)			/* wrapper y0f */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_y0f(x);
-#else
-	float z;
-	z = __ieee754_y0f(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
-        if(x <= (float)0.0){
-                if(x==(float)0.0)
-                    /* d= -one/(x-x); */
-                    return (float)__kernel_standard((double)x,(double)x,108);
-                else
-                    /* d = zero/(x-x); */
-                    return (float)__kernel_standard((double)x,(double)x,109);
-        }
-	if(x>(float)X_TLOSS) {
-		/* y0(x>X_TLOSS) */
-	        return (float)__kernel_standard((double)x,(double)x,135);
-	} else
-	    return z;
-#endif
-}
diff --git a/sysdeps/generic/w_j0l.c b/sysdeps/generic/w_j0l.c
deleted file mode 100644
index b74d9ddcff..0000000000
--- a/sysdeps/generic/w_j0l.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* w_j0l.c -- long double version of w_j0.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper j0l(long double x), y0l(long double x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double j0l(long double x)		/* wrapper j0l */
-#else
-	long double j0l(x)				/* wrapper j0 */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_j0l(x);
-#else
-	long double z = __ieee754_j0l(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	if(fabsl(x)>X_TLOSS) {
-	        return __kernel_standard(x,x,234); /* j0(|x|>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
-
-#ifdef __STDC__
-	long double y0l(long double x)		/* wrapper y0l */
-#else
-	long double y0l(x)				/* wrapper y0 */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_y0l(x);
-#else
-	long double z;
-	z = __ieee754_y0l(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard(x,x,208);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard(x,x,209);
-        }
-	if(x>X_TLOSS) {
-	        return __kernel_standard(x,x,235); /* y0(x>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
diff --git a/sysdeps/generic/w_j1.c b/sysdeps/generic/w_j1.c
deleted file mode 100644
index 39fe8543b1..0000000000
--- a/sysdeps/generic/w_j1.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* @(#)w_j1.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j1.c,v 1.6 1995/05/10 20:49:15 jtc Exp $";
-#endif
-
-/*
- * wrapper of j1,y1
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double j1(double x)		/* wrapper j1 */
-#else
-	double j1(x)			/* wrapper j1 */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_j1(x);
-#else
-	double z;
-	z = __ieee754_j1(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
-	if(fabs(x)>X_TLOSS) {
-	        return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
-#ifdef NO_LONG_DOUBLE
-strong_alias (j1, j1l)
-#endif
-
-
-#ifdef __STDC__
-	double y1(double x)		/* wrapper y1 */
-#else
-	double y1(x)			/* wrapper y1 */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_y1(x);
-#else
-	double z;
-	z = __ieee754_y1(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard(x,x,10);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard(x,x,11);
-        }
-	if(x>X_TLOSS) {
-	        return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
-#ifdef NO_LONG_DOUBLE
-strong_alias (y1, y1l)
-#endif
diff --git a/sysdeps/generic/w_j1f.c b/sysdeps/generic/w_j1f.c
deleted file mode 100644
index 2a7c8db819..0000000000
--- a/sysdeps/generic/w_j1f.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* w_j1f.c -- float version of w_j1.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_j1f.c,v 1.3 1995/05/10 20:49:17 jtc Exp $";
-#endif
-
-/*
- * wrapper of j1f,y1f
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float j1f(float x)		/* wrapper j1f */
-#else
-	float j1f(x)			/* wrapper j1f */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_j1f(x);
-#else
-	float z;
-	z = __ieee754_j1f(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
-	if(fabsf(x)>(float)X_TLOSS) {
-		/* j1(|x|>X_TLOSS) */
-	        return (float)__kernel_standard((double)x,(double)x,136);
-	} else
-	    return z;
-#endif
-}
-
-#ifdef __STDC__
-	float y1f(float x)		/* wrapper y1f */
-#else
-	float y1f(x)			/* wrapper y1f */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_y1f(x);
-#else
-	float z;
-	z = __ieee754_y1f(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
-        if(x <= (float)0.0){
-                if(x==(float)0.0)
-                    /* d= -one/(x-x); */
-                    return (float)__kernel_standard((double)x,(double)x,110);
-                else
-                    /* d = zero/(x-x); */
-                    return (float)__kernel_standard((double)x,(double)x,111);
-        }
-	if(x>(float)X_TLOSS) {
-		/* y1(x>X_TLOSS) */
-	        return (float)__kernel_standard((double)x,(double)x,137);
-	} else
-	    return z;
-#endif
-}
diff --git a/sysdeps/generic/w_j1l.c b/sysdeps/generic/w_j1l.c
deleted file mode 100644
index 49a486cf8e..0000000000
--- a/sysdeps/generic/w_j1l.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* w_j1l.c -- long double version of w_j1.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper of j1l,y1l
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double j1l(long double x)	/* wrapper j1l */
-#else
-	long double j1l(x)			/* wrapper j1l */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_j1l(x);
-#else
-	long double z;
-	z = __ieee754_j1l(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
-	if(fabsl(x)>X_TLOSS) {
-	        return __kernel_standard(x,x,236); /* j1(|x|>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
-
-#ifdef __STDC__
-	long double y1l(long double x)	/* wrapper y1l */
-#else
-	long double y1l(x)			/* wrapper y1l */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_y1l(x);
-#else
-	long double z;
-	z = __ieee754_y1l(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard(x,x,210);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard(x,x,211);
-        }
-	if(x>X_TLOSS) {
-	        return __kernel_standard(x,x,237); /* y1(x>X_TLOSS) */
-	} else
-	    return z;
-#endif
-}
diff --git a/sysdeps/generic/w_jn.c b/sysdeps/generic/w_jn.c
deleted file mode 100644
index 85fc383fb7..0000000000
--- a/sysdeps/generic/w_jn.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* @(#)w_jn.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $";
-#endif
-
-/*
- * wrapper jn(int n, double x), yn(int n, double x)
- * floating point Bessel's function of the 1st and 2nd kind
- * of order n
- *
- * Special cases:
- *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
- *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
- * Note 2. About jn(n,x), yn(n,x)
- *	For n=0, j0(x) is called,
- *	for n=1, j1(x) is called,
- *	for n<x, forward recursion us used starting
- *	from values of j0(x) and j1(x).
- *	for n>x, a continued fraction approximation to
- *	j(n,x)/j(n-1,x) is evaluated and then backward
- *	recursion is used starting from a supposed value
- *	for j(n,x). The resulting value of j(0,x) is
- *	compared with the actual value to correct the
- *	supposed value of j(n,x).
- *
- *	yn(n,x) is similar in all respects, except
- *	that forward recursion is used for all
- *	values of n>1.
- *
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double jn(int n, double x)	/* wrapper jn */
-#else
-	double jn(n,x)			/* wrapper jn */
-	double x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_jn(n,x);
-#else
-	double z;
-	z = __ieee754_jn(n,x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
-	if(fabs(x)>X_TLOSS) {
-	    return __kernel_standard((double)n,x,38); /* jn(|x|>X_TLOSS,n) */
-	} else
-	    return z;
-#endif
-}
-#ifdef NO_LONG_DOUBLE
-strong_alias (jn, jnl)
-#endif
-
-
-#ifdef __STDC__
-	double yn(int n, double x)	/* wrapper yn */
-#else
-	double yn(n,x)			/* wrapper yn */
-	double x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_yn(n,x);
-#else
-	double z;
-	z = __ieee754_yn(n,x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard((double)n,x,12);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard((double)n,x,13);
-        }
-	if(x>X_TLOSS) {
-	    return __kernel_standard((double)n,x,39); /* yn(x>X_TLOSS,n) */
-	} else
-	    return z;
-#endif
-}
-#ifdef NO_LONG_DOUBLE
-strong_alias (yn, ynl)
-#endif
diff --git a/sysdeps/generic/w_jnf.c b/sysdeps/generic/w_jnf.c
deleted file mode 100644
index 63ad335573..0000000000
--- a/sysdeps/generic/w_jnf.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* w_jnf.c -- float version of w_jn.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_jnf.c,v 1.3 1995/05/10 20:49:21 jtc Exp $";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float jnf(int n, float x)	/* wrapper jnf */
-#else
-	float jnf(n,x)			/* wrapper jnf */
-	float x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_jnf(n,x);
-#else
-	float z;
-	z = __ieee754_jnf(n,x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
-	if(fabsf(x)>(float)X_TLOSS) {
-	    /* jn(|x|>X_TLOSS,n) */
-	    return (float)__kernel_standard((double)n,(double)x,138);
-	} else
-	    return z;
-#endif
-}
-
-#ifdef __STDC__
-	float ynf(int n, float x)	/* wrapper ynf */
-#else
-	float ynf(n,x)			/* wrapper ynf */
-	float x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_ynf(n,x);
-#else
-	float z;
-	z = __ieee754_ynf(n,x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x) ) return z;
-        if(x <= (float)0.0){
-                if(x==(float)0.0)
-                    /* d= -one/(x-x); */
-                    return (float)__kernel_standard((double)n,(double)x,112);
-                else
-                    /* d = zero/(x-x); */
-                    return (float)__kernel_standard((double)n,(double)x,113);
-        }
-	if(x>(float)X_TLOSS) {
-	    /* yn(x>X_TLOSS,n) */
-	    return (float)__kernel_standard((double)n,(double)x,139);
-	} else
-	    return z;
-#endif
-}
diff --git a/sysdeps/generic/w_jnl.c b/sysdeps/generic/w_jnl.c
deleted file mode 100644
index 866e3cdb00..0000000000
--- a/sysdeps/generic/w_jnl.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* w_jnl.c -- long double version of w_jn.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper jn(int n, double x), yn(int n, double x)
- * floating point Bessel's function of the 1st and 2nd kind
- * of order n
- *
- * Special cases:
- *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
- *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
- * Note 2. About jn(n,x), yn(n,x)
- *	For n=0, j0(x) is called,
- *	for n=1, j1(x) is called,
- *	for n<x, forward recursion us used starting
- *	from values of j0(x) and j1(x).
- *	for n>x, a continued fraction approximation to
- *	j(n,x)/j(n-1,x) is evaluated and then backward
- *	recursion is used starting from a supposed value
- *	for j(n,x). The resulting value of j(0,x) is
- *	compared with the actual value to correct the
- *	supposed value of j(n,x).
- *
- *	yn(n,x) is similar in all respects, except
- *	that forward recursion is used for all
- *	values of n>1.
- *
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double jnl(int n, long double x)	/* wrapper jnl */
-#else
-	long double jnl(n,x)			/* wrapper jnl */
-	long double x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_jnl(n,x);
-#else
-	long double z;
-	z = __ieee754_jnl(n,x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
-	if(fabsl(x)>X_TLOSS) {
-	    return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */
-	} else
-	    return z;
-#endif
-}
-
-#ifdef __STDC__
-	long double ynl(int n, long double x)	/* wrapper ynl */
-#else
-	long double ynl(n,x)			/* wrapper ynl */
-	long double x; int n;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_ynl(n,x);
-#else
-	long double z;
-	z = __ieee754_ynl(n,x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z;
-        if(x <= 0.0){
-                if(x==0.0)
-                    /* d= -one/(x-x); */
-                    return __kernel_standard((double)n,x,212);
-                else
-                    /* d = zero/(x-x); */
-                    return __kernel_standard((double)n,x,213);
-        }
-	if(x>X_TLOSS) {
-	    return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */
-	} else
-	    return z;
-#endif
-}
diff --git a/sysdeps/generic/w_lgamma.c b/sysdeps/generic/w_lgamma.c
deleted file mode 100644
index 7c7f34ff39..0000000000
--- a/sysdeps/generic/w_lgamma.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* @(#)w_lgamma.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $";
-#endif
-
-/* double lgamma(double x)
- * Return the logarithm of the Gamma function of x.
- *
- * Method: call __ieee754_lgamma_r
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __lgamma(double x)
-#else
-	double __lgamma(x)
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_lgamma_r(x,&signgam);
-#else
-        double y;
-	int local_signgam = 0;
-        y = __ieee754_lgamma_r(x,&local_signgam);
-	if (_LIB_VERSION != _ISOC_)
-	  /* ISO C99 does not define the global variable.  */
-	  signgam = local_signgam;
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!__finite(y)&&__finite(x)) {
-            if(__floor(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,15); /* lgamma pole */
-            else
-                return __kernel_standard(x,x,14); /* lgamma overflow */
-        } else
-            return y;
-#endif
-}
-weak_alias (__lgamma, lgamma)
-strong_alias (__lgamma, __gamma)
-weak_alias (__gamma, gamma)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__lgamma, __lgammal)
-weak_alias (__lgamma, lgammal)
-strong_alias (__gamma, __gammal)
-weak_alias (__gamma, gammal)
-#endif
diff --git a/sysdeps/generic/w_lgamma_r.c b/sysdeps/generic/w_lgamma_r.c
deleted file mode 100644
index f3e7d821e2..0000000000
--- a/sysdeps/generic/w_lgamma_r.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* @(#)wr_lgamma.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgamma_r.c,v 1.6 1995/05/10 20:49:27 jtc Exp $";
-#endif
-
-/*
- * wrapper double lgamma_r(double x, int *signgamp)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
-#else
-	double __lgamma_r(x,signgamp)              /* wrapper lgamma_r */
-        double x; int *signgamp;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_lgamma_r(x,signgamp);
-#else
-        double y;
-        y = __ieee754_lgamma_r(x,signgamp);
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!__finite(y)&&__finite(x)) {
-            if(__floor(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,15); /* lgamma pole */
-            else
-                return __kernel_standard(x,x,14); /* lgamma overflow */
-        } else
-            return y;
-#endif
-}
-weak_alias (__lgamma_r, lgamma_r)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__lgamma_r, __lgammal_r)
-weak_alias (__lgamma_r, lgammal_r)
-#endif
diff --git a/sysdeps/generic/w_lgammaf.c b/sysdeps/generic/w_lgammaf.c
deleted file mode 100644
index d0f6d0d17c..0000000000
--- a/sysdeps/generic/w_lgammaf.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* w_lgammaf.c -- float version of w_lgamma.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgammaf.c,v 1.3 1995/05/10 20:49:30 jtc Exp $";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __lgammaf(float x)
-#else
-	float __lgammaf(x)
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_lgammaf_r(x,&signgam);
-#else
-        float y;
-	int local_signgam = 0;
-        y = __ieee754_lgammaf_r(x,&local_signgam);
-	if (_LIB_VERSION != _ISOC_)
-	  /* ISO C99 does not define the global variable.  */
-	  signgam = local_signgam;
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!__finitef(y)&&__finitef(x)) {
-            if(__floorf(x)==x&&x<=(float)0.0)
-	        /* lgamma pole */
-                return (float)__kernel_standard((double)x,(double)x,115);
-            else
-	        /* lgamma overflow */
-                return (float)__kernel_standard((double)x,(double)x,114);
-        } else
-            return y;
-#endif
-}
-weak_alias (__lgammaf, lgammaf)
-strong_alias (__lgammaf, __gammaf)
-weak_alias (__gammaf, gammaf)
diff --git a/sysdeps/generic/w_lgammaf_r.c b/sysdeps/generic/w_lgammaf_r.c
deleted file mode 100644
index 66962acc7e..0000000000
--- a/sysdeps/generic/w_lgammaf_r.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* w_lgammaf_r.c -- float version of w_lgamma_r.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_lgammaf_r.c,v 1.3 1995/05/10 20:49:32 jtc Exp $";
-#endif
-
-/* 
- * wrapper float lgammaf_r(float x, int *signgamp)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
-#else
-	float __lgammaf_r(x,signgamp)              /* wrapper lgammaf_r */
-        float x; int *signgamp;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_lgammaf_r(x,signgamp);
-#else
-        float y;
-        y = __ieee754_lgammaf_r(x,signgamp);
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!__finitef(y)&&__finitef(x)) {
-            if(__floorf(x)==x&&x<=(float)0.0)
-	        /* lgamma pole */
-                return (float)__kernel_standard((double)x,(double)x,115);
-            else
-	        /* lgamma overflow */
-	        return (float)__kernel_standard((double)x,(double)x,114);
-        } else
-            return y;
-#endif
-}             
-weak_alias (__lgammaf_r, lgammaf_r)
diff --git a/sysdeps/generic/w_lgammal.c b/sysdeps/generic/w_lgammal.c
deleted file mode 100644
index 1ee51a6f49..0000000000
--- a/sysdeps/generic/w_lgammal.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* w_lgammal.c -- long double version of w_lgamma.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/* long double lgammal(long double x)
- * Return the logarithm of the Gamma function of x.
- *
- * Method: call __ieee754_lgammal_r
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __lgammal(long double x)
-#else
-	long double __lgammal(x)
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_lgammal_r(x,&signgam);
-#else
-        long double y;
-	int local_signgam = 0;
-        y = __ieee754_lgammal_r(x,&local_signgam);
-	if (_LIB_VERSION != _ISOC_)
-	  /* ISO C99 does not define the global variable.  */
-	  signgam = local_signgam;
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!__finitel(y)&&__finitel(x)) {
-            if(__floorl(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,215); /* lgamma pole */
-            else
-                return __kernel_standard(x,x,214); /* lgamma overflow */
-        } else
-            return y;
-#endif
-}
-weak_alias (__lgammal, lgammal)
-strong_alias (__lgammal, __gammal)
-weak_alias (__gammal, gammal)
diff --git a/sysdeps/generic/w_lgammal_r.c b/sysdeps/generic/w_lgammal_r.c
deleted file mode 100644
index 71f5c005d0..0000000000
--- a/sysdeps/generic/w_lgammal_r.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* w_lgammal_r.c -- long double version of w_lgamma_r.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper long double lgammal_r(long double x, int *signgamp)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __lgammal_r(long double x, int *signgamp)
-		/* wrapper lgamma_r */
-#else
-	long double __lgammal_r(x,signgamp)             /* wrapper lgamma_r */
-        long double x; int *signgamp;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_lgammal_r(x,signgamp);
-#else
-        long double y;
-        y = __ieee754_lgammal_r(x,signgamp);
-        if(_LIB_VERSION == _IEEE_) return y;
-        if(!__finitel(y)&&__finitel(x)) {
-            if(__floorl(x)==x&&x<=0.0)
-                return __kernel_standard(x,x,215); /* lgamma pole */
-            else
-                return __kernel_standard(x,x,214); /* lgamma overflow */
-        } else
-            return y;
-#endif
-}
-weak_alias (__lgammal_r, lgammal_r)
diff --git a/sysdeps/generic/w_log.c b/sysdeps/generic/w_log.c
deleted file mode 100644
index 5f0af79731..0000000000
--- a/sysdeps/generic/w_log.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* @(#)w_log.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log.c,v 1.6 1995/05/10 20:49:33 jtc Exp $";
-#endif
-
-/*
- * wrapper log(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __log(double x)		/* wrapper log */
-#else
-	double __log(x)			/* wrapper log */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_log(x);
-#else
-	double z;
-	z = __ieee754_log(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x) || x > 0.0) return z;
-	if(x==0.0)
-	    return __kernel_standard(x,x,16); /* log(0) */
-	else
-	    return __kernel_standard(x,x,17); /* log(x<0) */
-#endif
-}
-weak_alias (__log, log)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__log, __logl)
-weak_alias (__log, logl)
-#endif
diff --git a/sysdeps/generic/w_log10.c b/sysdeps/generic/w_log10.c
deleted file mode 100644
index 8a0a70bdf7..0000000000
--- a/sysdeps/generic/w_log10.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* @(#)w_log10.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log10.c,v 1.6 1995/05/10 20:49:35 jtc Exp $";
-#endif
-
-/*
- * wrapper log10(X)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __log10(double x)		/* wrapper log10 */
-#else
-	double __log10(x)			/* wrapper log10 */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_log10(x);
-#else
-	double z;
-	z = __ieee754_log10(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(x<=0.0) {
-	    if(x==0.0)
-	        return __kernel_standard(x,x,18); /* log10(0) */
-	    else
-	        return __kernel_standard(x,x,19); /* log10(x<0) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__log10, log10)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__log10, __log10l)
-weak_alias (__log10, log10l)
-#endif
diff --git a/sysdeps/generic/w_log10f.c b/sysdeps/generic/w_log10f.c
deleted file mode 100644
index f90cb0cabc..0000000000
--- a/sysdeps/generic/w_log10f.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* w_log10f.c -- float version of w_log10.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_log10f.c,v 1.3 1995/05/10 20:49:37 jtc Exp $";
-#endif
-
-/* 
- * wrapper log10f(X)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __log10f(float x)		/* wrapper log10f */
-#else
-	float __log10f(x)			/* wrapper log10f */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_log10f(x);
-#else
-	float z;
-	z = __ieee754_log10f(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	if(x<=(float)0.0) {
-	    if(x==(float)0.0)
-	        /* log10(0) */
-	        return (float)__kernel_standard((double)x,(double)x,118);
-	    else 
-	        /* log10(x<0) */
-	        return (float)__kernel_standard((double)x,(double)x,119);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__log10f, log10f)
diff --git a/sysdeps/generic/w_log10l.c b/sysdeps/generic/w_log10l.c
deleted file mode 100644
index 0d0861689d..0000000000
--- a/sysdeps/generic/w_log10l.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* w_log10l.c -- long double version of w_log10.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper log10l(X)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __log10l(long double x)	/* wrapper log10l */
-#else
-	long double __log10l(x)			/* wrapper log10l */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_log10l(x);
-#else
-	long double z;
-	z = __ieee754_log10l(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	if(x<=0.0) {
-	    if(x==0.0)
-	        return __kernel_standard(x,x,218); /* log10(0) */
-	    else
-	        return __kernel_standard(x,x,219); /* log10(x<0) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__log10l, log10l)
diff --git a/sysdeps/generic/w_log2.c b/sysdeps/generic/w_log2.c
deleted file mode 100644
index 7966ff359f..0000000000
--- a/sysdeps/generic/w_log2.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * wrapper log2(X)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double
-__log2 (double x)	/* wrapper log2 */
-{
-#ifdef _IEEE_LIBM
-  return __ieee754_log2 (x);
-#else
-  double z;
-  z = __ieee754_log2 (x);
-  if (_LIB_VERSION == _IEEE_ || __isnan (x)) return z;
-  if (x <= 0.0)
-    {
-      if (x == 0.0)
-	return __kernel_standard (x, x, 48); /* log2 (0) */
-      else
-	return __kernel_standard (x, x, 49); /* log2 (x < 0) */
-    }
-  else
-    return z;
-#endif
-}
-weak_alias (__log2, log2)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__log2, __log2l)
-weak_alias (__log2, log2l)
-#endif
diff --git a/sysdeps/generic/w_log2f.c b/sysdeps/generic/w_log2f.c
deleted file mode 100644
index 1e2eb85d7b..0000000000
--- a/sysdeps/generic/w_log2f.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * wrapper log2(X)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-float
-__log2f (float x)	/* wrapper log2f */
-{
-#ifdef _IEEE_LIBM
-  return __ieee754_log2f (x);
-#else
-  float z;
-  z = __ieee754_log2f (x);
-  if (_LIB_VERSION == _IEEE_ || __isnanf (x)) return z;
-  if (x <= 0.0f)
-    {
-      if (x == 0.0f)
-	/* log2f (0) */
-	return __kernel_standard ((double) x, (double) x, 148);
-      else
-	/* log2f (x < 0) */
-	return __kernel_standard ((double) x, (double) x, 149);
-    }
-  else
-    return z;
-#endif
-}
-weak_alias (__log2f, log2f)
diff --git a/sysdeps/generic/w_log2l.c b/sysdeps/generic/w_log2l.c
deleted file mode 100644
index f41757c5e4..0000000000
--- a/sysdeps/generic/w_log2l.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * wrapper log2l(X)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-long double
-__log2l (long double x)	/* wrapper log2l */
-{
-#ifdef _IEEE_LIBM
-  return __ieee754_log2l (x);
-#else
-  long double z;
-  z = __ieee754_log2l (x);
-  if (_LIB_VERSION == _IEEE_ || __isnanl (x)) return z;
-  if (x <= 0.0)
-    {
-      if (x == 0.0)
-	return __kernel_standard (x, x, 248); /* log2l (0) */
-      else
-	return __kernel_standard (x, x, 249); /* log2l (x < 0) */
-    }
-  else
-    return z;
-#endif
-}
-weak_alias (__log2l, log2l)
diff --git a/sysdeps/generic/w_logf.c b/sysdeps/generic/w_logf.c
deleted file mode 100644
index 9eabe4b34c..0000000000
--- a/sysdeps/generic/w_logf.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* w_logf.c -- float version of w_log.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_logf.c,v 1.3 1995/05/10 20:49:40 jtc Exp $";
-#endif
-
-/*
- * wrapper logf(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __logf(float x)		/* wrapper logf */
-#else
-	float __logf(x)			/* wrapper logf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_logf(x);
-#else
-	float z;
-	z = __ieee754_logf(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x) || x > (float)0.0) return z;
-	if(x==(float)0.0)
-	    /* logf(0) */
-	    return (float)__kernel_standard((double)x,(double)x,116);
-	else 
-	    /* logf(x<0) */
-	    return (float)__kernel_standard((double)x,(double)x,117);
-#endif
-}
-weak_alias (__logf, logf)
diff --git a/sysdeps/generic/w_logl.c b/sysdeps/generic/w_logl.c
deleted file mode 100644
index bb979c26c3..0000000000
--- a/sysdeps/generic/w_logl.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_logl.c -- long double version of w_log.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper logl(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __logl(long double x)	/* wrapper logl */
-#else
-	long double __logl(x)			/* wrapper logl */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_logl(x);
-#else
-	long double z;
-	z = __ieee754_logl(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x) || x > 0.0) return z;
-	if(x==0.0)
-	    return __kernel_standard(x,x,216); /* log(0) */
-	else
-	    return __kernel_standard(x,x,217); /* log(x<0) */
-#endif
-}
-weak_alias (__logl, logl)
diff --git a/sysdeps/generic/w_pow.c b/sysdeps/generic/w_pow.c
deleted file mode 100644
index 5850651a1a..0000000000
--- a/sysdeps/generic/w_pow.c
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-/* @(#)w_pow.c 5.2 93/10/01 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper pow(x,y) return x**y
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	double __pow(double x, double y)	/* wrapper pow */
-#else
-	double __pow(x,y)			/* wrapper pow */
-	double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return  __ieee754_pow(x,y);
-#else
-	double z;
-	z=__ieee754_pow(x,y);
-	if(_LIB_VERSION == _IEEE_|| __isnan(y)) return z;
-	if(__isnan(x)) {
-	    if(y==0.0)
-	        return __kernel_standard(x,y,42); /* pow(NaN,0.0) */
-	    else
-		return z;
-	}
-	if(x==0.0) {
-	    if(y==0.0)
-	        return __kernel_standard(x,y,20); /* pow(0.0,0.0) */
-	    if(__finite(y)&&y<0.0) {
-	      if (signbit (x) && signbit (z))
-	        return __kernel_standard(x,y,23); /* pow(-0.0,negative) */
-	      else
-	        return __kernel_standard(x,y,43); /* pow(+0.0,negative) */
-	    }
-	    return z;
-	}
-	if(!__finite(z)) {
-	    if(__finite(x)&&__finite(y)) {
-	        if(__isnan(z))
-	            return __kernel_standard(x,y,24); /* pow neg**non-int */
-	        else
-	            return __kernel_standard(x,y,21); /* pow overflow */
-	    }
-	}
-	if(z==0.0&&__finite(x)&&__finite(y))
-	    return __kernel_standard(x,y,22); /* pow underflow */
-	return z;
-#endif
-}
-weak_alias (__pow, pow)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__pow, __powl)
-weak_alias (__pow, powl)
-#endif
diff --git a/sysdeps/generic/w_powf.c b/sysdeps/generic/w_powf.c
deleted file mode 100644
index 32196fd89f..0000000000
--- a/sysdeps/generic/w_powf.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* w_powf.c -- float version of w_pow.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_powf.c,v 1.3 1995/05/10 20:49:41 jtc Exp $";
-#endif
-
-/*
- * wrapper powf(x,y) return x**y
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	float __powf(float x, float y)	/* wrapper powf */
-#else
-	float __powf(x,y)			/* wrapper powf */
-	float x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return  __ieee754_powf(x,y);
-#else
-	float z;
-	z=__ieee754_powf(x,y);
-	if(_LIB_VERSION == _IEEE_|| __isnanf(y)) return z;
-	if(__isnanf(x)) {
-	    if(y==(float)0.0)
-	        /* powf(NaN,0.0) */
-	        return (float)__kernel_standard((double)x,(double)y,142);
-	    else
-		return z;
-	}
-	if(x==(float)0.0) {
-	    if(y==(float)0.0)
-	        /* powf(0.0,0.0) */
-	        return (float)__kernel_standard((double)x,(double)y,120);
-	    if(__finitef(y)&&y<(float)0.0) {
-	      if (signbit (x) && signbit (z))
-	        /* powf(0.0,negative) */
-	        return (float)__kernel_standard((double)x,(double)y,123);
-	      else
-	        return (float)__kernel_standard((double)x,(double)y,143);
-	    }
-	    return z;
-	}
-	if(!__finitef(z)) {
-	    if(__finitef(x)&&__finitef(y)) {
-	        if(__isnanf(z))
-		    /* powf neg**non-int */
-	            return (float)__kernel_standard((double)x,(double)y,124);
-	        else
-		    /* powf overflow */
-	            return (float)__kernel_standard((double)x,(double)y,121);
-	    }
-	}
-	if(z==(float)0.0&&__finitef(x)&&__finitef(y))
-	    /* powf underflow */
-	    return (float)__kernel_standard((double)x,(double)y,122);
-	return z;
-#endif
-}
-weak_alias (__powf, powf)
diff --git a/sysdeps/generic/w_powl.c b/sysdeps/generic/w_powl.c
deleted file mode 100644
index 17feb9fc61..0000000000
--- a/sysdeps/generic/w_powl.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* w_powl.c -- long double version of w_pow.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * wrapper powl(x,y) return x**y
- */
-
-#include "math.h"
-#include "math_private.h"
-
-
-#ifdef __STDC__
-	long double __powl(long double x, long double y)/* wrapper powl */
-#else
-	long double __powl(x,y)			/* wrapper powl */
-	long double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return  __ieee754_powl(x,y);
-#else
-	long double z;
-	z=__ieee754_powl(x,y);
-	if(_LIB_VERSION == _IEEE_|| __isnanl(y)) return z;
-	if(__isnanl(x)) {
-	    if(y==0.0)
-	        return __kernel_standard(x,y,242); /* pow(NaN,0.0) */
-	    else
-		return z;
-	}
-	if(x==0.0) {
-	    if(y==0.0)
-	        return __kernel_standard(x,y,220); /* pow(0.0,0.0) */
-	    if(__finitel(y)&&y<0.0) {
-	      if (signbit (x) && signbit (z))
-	        return __kernel_standard(x,y,223); /* pow(-0.0,negative) */
-	      else
-	        return __kernel_standard(x,y,243); /* pow(+0.0,negative) */
-	    }
-	    return z;
-	}
-	if(!__finitel(z)) {
-	    if(__finitel(x)&&__finitel(y)) {
-	        if(__isnanl(z))
-	            return __kernel_standard(x,y,224); /* pow neg**non-int */
-	        else
-	            return __kernel_standard(x,y,221); /* pow overflow */
-	    }
-	}
-	if(z==0.0&&__finitel(x)&&__finitel(y))
-	    return __kernel_standard(x,y,222); /* pow underflow */
-	return z;
-#endif
-}
-weak_alias (__powl, powl)
diff --git a/sysdeps/generic/w_remainder.c b/sysdeps/generic/w_remainder.c
deleted file mode 100644
index d85a3febce..0000000000
--- a/sysdeps/generic/w_remainder.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @(#)w_remainder.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_remainder.c,v 1.6 1995/05/10 20:49:44 jtc Exp $";
-#endif
-
-/*
- * wrapper remainder(x,p)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __remainder(double x, double y)	/* wrapper remainder */
-#else
-	double __remainder(x,y)			/* wrapper remainder */
-	double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_remainder(x,y);
-#else
-	double z;
-	z = __ieee754_remainder(x,y);
-	if(_LIB_VERSION == _IEEE_ || __isnan(y)) return z;
-	if(y==0.0)
-	    return __kernel_standard(x,y,28); /* remainder(x,0) */
-	else
-	    return z;
-#endif
-}
-weak_alias (__remainder, remainder)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__remainder, __remainderl)
-weak_alias (__remainder, remainderl)
-#endif
diff --git a/sysdeps/generic/w_remainderf.c b/sysdeps/generic/w_remainderf.c
deleted file mode 100644
index 58255f5be5..0000000000
--- a/sysdeps/generic/w_remainderf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_remainderf.c -- float version of w_remainder.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_remainderf.c,v 1.3 1995/05/10 20:49:46 jtc Exp $";
-#endif
-
-/* 
- * wrapper remainderf(x,p)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __remainderf(float x, float y)	/* wrapper remainder */
-#else
-	float __remainderf(x,y)			/* wrapper remainder */
-	float x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_remainderf(x,y);
-#else
-	float z;
-	z = __ieee754_remainderf(x,y);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(y)) return z;
-	if(y==(float)0.0) 
-	    /* remainder(x,0) */
-	    return (float)__kernel_standard((double)x,(double)y,128);
-	else
-	    return z;
-#endif
-}
-weak_alias (__remainderf, remainderf)
diff --git a/sysdeps/generic/w_remainderl.c b/sysdeps/generic/w_remainderl.c
deleted file mode 100644
index 284140174d..0000000000
--- a/sysdeps/generic/w_remainderl.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* w_remainderl.c -- long double version of w_remainder.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper remainderl(x,p)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __remainderl(long double x, long double y)
-		/* wrapper remainderl */
-#else
-	long double __remainderl(x,y)			/* wrapper remainder */
-	long double x,y;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_remainderl(x,y);
-#else
-	long double z;
-	z = __ieee754_remainderl(x,y);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(y)) return z;
-	if(y==0.0)
-	    return __kernel_standard(x,y,228); /* remainder(x,0) */
-	else
-	    return z;
-#endif
-}
-weak_alias (__remainderl, remainderl)
diff --git a/sysdeps/generic/w_scalb.c b/sysdeps/generic/w_scalb.c
deleted file mode 100644
index c981b858a9..0000000000
--- a/sysdeps/generic/w_scalb.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* @(#)w_scalb.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $";
-#endif
-
-/*
- * wrapper scalb(double x, double fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#include <errno.h>
-
-#ifdef __STDC__
-#ifdef _SCALB_INT
-	double __scalb(double x, int fn)		/* wrapper scalb */
-#else
-	double __scalb(double x, double fn)	/* wrapper scalb */
-#endif
-#else
-	double __scalb(x,fn)			/* wrapper scalb */
-#ifdef _SCALB_INT
-	double x; int fn;
-#else
-	double x,fn;
-#endif
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_scalb(x,fn);
-#else
-	double z;
-	z = __ieee754_scalb(x,fn);
-	if(_LIB_VERSION != _SVID_) return z;
-	if(!(__finite(z)||__isnan(z))&&__finite(x)) {
-	    return __kernel_standard(x,(double)fn,32); /* scalb overflow */
-	}
-	if(z==0.0&&z!=x) {
-	    return __kernel_standard(x,(double)fn,33); /* scalb underflow */
-	}
-#ifndef _SCALB_INT
-	if(!__finite(fn)) __set_errno (ERANGE);
-#endif
-	return z;
-#endif
-}
-weak_alias (__scalb, scalb)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__scalb, __scalbl)
-weak_alias (__scalb, scalbl)
-#endif
diff --git a/sysdeps/generic/w_scalbf.c b/sysdeps/generic/w_scalbf.c
deleted file mode 100644
index 51056083e8..0000000000
--- a/sysdeps/generic/w_scalbf.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* w_scalbf.c -- float version of w_scalb.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_scalbf.c,v 1.3 1995/05/10 20:49:50 jtc Exp $";
-#endif
-
-/*
- * wrapper scalbf(float x, float fn) is provide for
- * passing various standard test suite. One
- * should use scalbn() instead.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#include <errno.h>
-
-#ifdef __STDC__
-#ifdef _SCALB_INT
-	float __scalbf(float x, int fn)		/* wrapper scalbf */
-#else
-	float __scalbf(float x, float fn)		/* wrapper scalbf */
-#endif
-#else
-	float __scalbf(x,fn)			/* wrapper scalbf */
-#ifdef _SCALB_INT
-	float x; int fn;
-#else
-	float x,fn;
-#endif
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_scalbf(x,fn);
-#else
-	float z;
-	z = __ieee754_scalbf(x,fn);
-	if(_LIB_VERSION != _SVID_) return z;
-	if(!(__finitef(z)||__isnanf(z))&&__finitef(x)) {
-	    /* scalbf overflow */
-	    return (float)__kernel_standard((double)x,(double)fn,132);
-	}
-	if(z==(float)0.0&&z!=x) {
-	    /* scalbf underflow */
-	    return (float)__kernel_standard((double)x,(double)fn,133);
-	}
-#ifndef _SCALB_INT
-	if(!__finitef(fn)) __set_errno (ERANGE);
-#endif
-	return z;
-#endif
-}
-weak_alias (__scalbf, scalbf)
diff --git a/sysdeps/generic/w_scalbl.c b/sysdeps/generic/w_scalbl.c
deleted file mode 100644
index 6a7d307104..0000000000
--- a/sysdeps/generic/w_scalbl.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* w_scalbl.c -- long double version of w_scalb.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper scalbl(long double x, long double fn) is provide for
- * passing various standard test suite. One
- * should use scalbnl() instead.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#include <errno.h>
-
-#ifdef __STDC__
-#ifdef _SCALB_INT
-	long double __scalbl(long double x, int fn)	/* wrapper scalbl */
-#else
-	long double __scalbl(long double x, long double fn)/* wrapper scalbl */
-#endif
-#else
-	long double __scalbl(x,fn)			/* wrapper scalbl */
-#ifdef _SCALB_INT
-	long double x; int fn;
-#else
-	long double x,fn;
-#endif
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_scalbl(x,fn);
-#else
-	long double z;
-	z = __ieee754_scalbl(x,fn);
-	if(_LIB_VERSION != _SVID_) return z;
-	if(!(__finitel(z)||__isnanl(z))&&__finitel(x)) {
-	    return __kernel_standard(x,(double)fn,232); /* scalb overflow */
-	}
-	if(z==0.0&&z!=x) {
-	    return __kernel_standard(x,(double)fn,233); /* scalb underflow */
-	}
-#ifndef _SCALB_INT
-	if(!__finitel(fn)) __set_errno (ERANGE);
-#endif
-	return z;
-#endif
-}
-weak_alias (__scalbl, scalbl)
diff --git a/sysdeps/generic/w_sinh.c b/sysdeps/generic/w_sinh.c
deleted file mode 100644
index 9b34cd1873..0000000000
--- a/sysdeps/generic/w_sinh.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @(#)w_sinh.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sinh.c,v 1.6 1995/05/10 20:49:51 jtc Exp $";
-#endif
-
-/*
- * wrapper sinh(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __sinh(double x)		/* wrapper sinh */
-#else
-	double __sinh(x)			/* wrapper sinh */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_sinh(x);
-#else
-	double z;
-	z = __ieee754_sinh(x);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if(!__finite(z)&&__finite(x)) {
-	    return __kernel_standard(x,x,25); /* sinh overflow */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__sinh, sinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__sinh, __sinhl)
-weak_alias (__sinh, sinhl)
-#endif
diff --git a/sysdeps/generic/w_sinhf.c b/sysdeps/generic/w_sinhf.c
deleted file mode 100644
index a69cf3072d..0000000000
--- a/sysdeps/generic/w_sinhf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_sinhf.c -- float version of w_sinh.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sinhf.c,v 1.3 1995/05/10 20:49:54 jtc Exp $";
-#endif
-
-/* 
- * wrapper sinhf(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __sinhf(float x)		/* wrapper sinhf */
-#else
-	float __sinhf(x)			/* wrapper sinhf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_sinhf(x);
-#else
-	float z; 
-	z = __ieee754_sinhf(x);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if(!__finitef(z)&&__finitef(x)) {
-	    /* sinhf overflow */
-	    return (float)__kernel_standard((double)x,(double)x,125);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__sinhf, sinhf)
diff --git a/sysdeps/generic/w_sinhl.c b/sysdeps/generic/w_sinhl.c
deleted file mode 100644
index 3e93cc598d..0000000000
--- a/sysdeps/generic/w_sinhl.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_sinhl.c -- long double version of w_sinh.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper sinhl(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __sinhl(long double x)	/* wrapper sinhl */
-#else
-	long double __sinhl(x)			/* wrapper sinhl */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_sinhl(x);
-#else
-	long double z;
-	z = __ieee754_sinhl(x);
-	if(_LIB_VERSION == _IEEE_) return z;
-	if(!__finitel(z)&&__finitel(x)) {
-	    return __kernel_standard(x,x,225); /* sinh overflow */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__sinhl, sinhl)
diff --git a/sysdeps/generic/w_sqrt.c b/sysdeps/generic/w_sqrt.c
deleted file mode 100644
index be15d959ea..0000000000
--- a/sysdeps/generic/w_sqrt.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* @(#)w_sqrt.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sqrt.c,v 1.6 1995/05/10 20:49:55 jtc Exp $";
-#endif
-
-/*
- * wrapper sqrt(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __sqrt(double x)		/* wrapper sqrt */
-#else
-	double __sqrt(x)			/* wrapper sqrt */
-	double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_sqrt(x);
-#else
-	double z;
-	z = __ieee754_sqrt(x);
-	if(_LIB_VERSION == _IEEE_ || __isnan(x)) return z;
-	if(x<0.0) {
-	    return __kernel_standard(x,x,26); /* sqrt(negative) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__sqrt, sqrt)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__sqrt, __sqrtl)
-weak_alias (__sqrt, sqrtl)
-#endif
diff --git a/sysdeps/generic/w_sqrtf.c b/sysdeps/generic/w_sqrtf.c
deleted file mode 100644
index f5ccc73868..0000000000
--- a/sysdeps/generic/w_sqrtf.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_sqrtf.c -- float version of w_sqrt.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_sqrtf.c,v 1.3 1995/05/10 20:49:59 jtc Exp $";
-#endif
-
-/* 
- * wrapper sqrtf(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __sqrtf(float x)		/* wrapper sqrtf */
-#else
-	float sqrt(x)			/* wrapper sqrtf */
-	float x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_sqrtf(x);
-#else
-	float z;
-	z = __ieee754_sqrtf(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanf(x)) return z;
-	if(x<(float)0.0) {
-	    /* sqrtf(negative) */
-	    return (float)__kernel_standard((double)x,(double)x,126);
-	} else
-	    return z;
-#endif
-}
-weak_alias (__sqrtf, sqrtf)
diff --git a/sysdeps/generic/w_sqrtl.c b/sysdeps/generic/w_sqrtl.c
deleted file mode 100644
index 5873ce93ab..0000000000
--- a/sysdeps/generic/w_sqrtl.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* w_sqrtl.c -- long double version of w_sqrt.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/*
- * wrapper sqrtl(x)
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __sqrtl(long double x)	/* wrapper sqrtl */
-#else
-	long double __sqrtl(x)			/* wrapper sqrtl */
-	long double x;
-#endif
-{
-#ifdef _IEEE_LIBM
-	return __ieee754_sqrtl(x);
-#else
-	long double z;
-	z = __ieee754_sqrtl(x);
-	if(_LIB_VERSION == _IEEE_ || __isnanl(x)) return z;
-	if(x<0.0) {
-	    return __kernel_standard(x,x,226); /* sqrt(negative) */
-	} else
-	    return z;
-#endif
-}
-weak_alias (__sqrtl, sqrtl)
diff --git a/sysdeps/generic/w_tgamma.c b/sysdeps/generic/w_tgamma.c
deleted file mode 100644
index 6e34b62be4..0000000000
--- a/sysdeps/generic/w_tgamma.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* @(#)w_gamma.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
-#endif
-
-/* double gamma(double x)
- * Return  the logarithm of the Gamma function of x or the Gamma function of x,
- * depending on the library mode.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	double __tgamma(double x)
-#else
-	double __tgamma(x)
-	double x;
-#endif
-{
-        double y;
-	int local_signgam;
-	y = __ieee754_gamma_r(x,&local_signgam);
-	if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
-	return y;
-#else
-	if(_LIB_VERSION == _IEEE_) return y;
-
-	if(!__finite(y)&&__finite(x)) {
-	  if (x == 0.0)
-	    return __kernel_standard(x,x,50); /* tgamma pole */
-	  else if(__floor(x)==x&&x<0.0)
-	    return __kernel_standard(x,x,41); /* tgamma domain */
-	  else
-	    return __kernel_standard(x,x,40); /* tgamma overflow */
-	}
-	return y;
-#endif
-}
-weak_alias (__tgamma, tgamma)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__tgamma, __tgammal)
-weak_alias (__tgamma, tgammal)
-#endif
diff --git a/sysdeps/generic/w_tgammaf.c b/sysdeps/generic/w_tgammaf.c
deleted file mode 100644
index e7b0d87ab5..0000000000
--- a/sysdeps/generic/w_tgammaf.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* w_gammaf.c -- float version of w_gamma.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: w_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
-#endif
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	float __tgammaf(float x)
-#else
-	float __tgammaf(x)
-	float x;
-#endif
-{
-        float y;
-	int local_signgam;
-	y = __ieee754_gammaf_r(x,&local_signgam);
-	if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
-	return y;
-#else
-	if(_LIB_VERSION == _IEEE_) return y;
-
-	if(!__finitef(y)&&__finitef(x)) {
-	  if (x == (float)0.0)
-	    /* tgammaf pole */
-	    return (float)__kernel_standard((double)x,(double)x,150);
-	  else if(__floorf(x)==x&&x<(float)0.0)
-	    /* tgammaf domain */
-	    return (float)__kernel_standard((double)x,(double)x,141);
-	  else
-	    /* tgammaf overflow */
-	    return (float)__kernel_standard((double)x,(double)x,140);
-	}
-	return y;
-#endif
-}
-weak_alias (__tgammaf, tgammaf)
diff --git a/sysdeps/generic/w_tgammal.c b/sysdeps/generic/w_tgammal.c
deleted file mode 100644
index 793fa17ac1..0000000000
--- a/sysdeps/generic/w_tgammal.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* w_gammal.c -- long double version of w_gamma.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/* long double gammal(double x)
- * Return the Gamma function of x.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __tgammal(long double x)
-#else
-	long double __tgammal(x)
-	long double x;
-#endif
-{
-        long double y;
-	int local_signgam;
-	y = __ieee754_gammal_r(x,&local_signgam);
-	if (local_signgam < 0) y = -y;
-#ifdef _IEEE_LIBM
-	return y;
-#else
-	if(_LIB_VERSION == _IEEE_) return y;
-
-	if(!__finitel(y)&&__finitel(x)) {
-	  if(x==0.0)
-	    return __kernel_standard(x,x,250); /* tgamma pole */
-	  else if(__floorl(x)==x&&x<0.0)
-	    return __kernel_standard(x,x,241); /* tgamma domain */
-	  else
-	    return __kernel_standard(x,x,240); /* tgamma overflow */
-	}
-	return y;
-#endif
-}
-weak_alias (__tgammal, tgammal)
diff --git a/sysdeps/generic/wait.c b/sysdeps/generic/wait.c
deleted file mode 100644
index b1c512ed39..0000000000
--- a/sysdeps/generic/wait.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/wait.h>
-#include <errno.h>
-
-/* Wait for a child to die.  When one does, put its status in *STAT_LOC
-   and return its process ID.  For errors, return (pid_t) -1.  */
-__pid_t
-__wait (__WAIT_STATUS_DEFN stat_loc)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (wait)
-
-weak_alias (__wait, wait)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/wait3.c b/sysdeps/generic/wait3.c
deleted file mode 100644
index 479d99e3da..0000000000
--- a/sysdeps/generic/wait3.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-
-/* Wait for a child to exit.  When one does, put its status in *STAT_LOC and
-   return its process ID.  For errors return (pid_t) -1.  If USAGE is not nil,
-   store information about the child's resource usage (as a `struct rusage')
-   there.  If the WUNTRACED bit is set in OPTIONS, return status for stopped
-   children; otherwise don't.  */
-pid_t
-__wait3 (__WAIT_STATUS_DEFN stat_loc, int options, struct rusage *usage)
-{
-  if ((options & ~(WNOHANG|WUNTRACED)) != 0)
-    {
-      __set_errno (EINVAL);
-      return (pid_t) -1;
-    }
-
-  __set_errno (ENOSYS);
-  return (pid_t) -1;
-}
-stub_warning (wait3)
-
-weak_alias (__wait3, wait3)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/wait4.c b/sysdeps/generic/wait4.c
deleted file mode 100644
index b59bf87ffc..0000000000
--- a/sysdeps/generic/wait4.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <errno.h>
-
-pid_t
-__wait4 (__pid_t pid, __WAIT_STATUS stat_loc, int options, 
-	 struct rusage *usage)
-{
-  __set_errno (ENOSYS);
-  return (pid_t) -1;
-}
-stub_warning (wait4)
-
-weak_alias (__wait4, wait4)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/waitid.c b/sysdeps/generic/waitid.c
deleted file mode 100644
index a9de1a19a5..0000000000
--- a/sysdeps/generic/waitid.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Stub version of waitid.
-   Copyright (C) 1997, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-int
-__waitid (idtype, id, infop, options)
-     idtype_t idtype;
-     id_t id;
-     siginfo_t *infop;
-     int options;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-weak_alias (__waitid, waitid)
diff --git a/sysdeps/generic/waitpid.c b/sysdeps/generic/waitpid.c
deleted file mode 100644
index 9c7736e669..0000000000
--- a/sysdeps/generic/waitpid.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1991,95,96,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-
-
-/* Wait for a child matching PID to die.
-   If PID is greater than 0, match any process whose process ID is PID.
-   If PID is (pid_t) -1, match any process.
-   If PID is (pid_t) 0, match any process with the
-   same process group as the current process.
-   If PID is less than -1, match any process whose
-   process group is the absolute value of PID.
-   If the WNOHANG bit is set in OPTIONS, and that child
-   is not already dead, return (pid_t) 0.  If successful,
-   return PID and store the dead child's status in STAT_LOC.
-   Return (pid_t) -1 for errors.  If the WUNTRACED bit is set in OPTIONS,
-   return status for stopped children; otherwise don't.  */
-pid_t
-__libc_waitpid (pid_t pid, int *stat_loc, int options)
-{
-  if ((options & ~(WNOHANG|WUNTRACED)) != 0)
-    {
-      __set_errno (EINVAL);
-      return (pid_t) -1;
-    }
-
-  __set_errno (ENOSYS);
-  return (pid_t) -1;
-}
-weak_alias (__libc_waitpid, __waitpid)
-libc_hidden_weak (__waitpid)
-weak_alias (__libc_waitpid, waitpid)
-
-stub_warning (waitpid)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/wcstoimax.c b/sysdeps/generic/wcstoimax.c
deleted file mode 100644
index f1de70f320..0000000000
--- a/sysdeps/generic/wcstoimax.c
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `intmax_t' type"
diff --git a/sysdeps/generic/wcstol.c b/sysdeps/generic/wcstol.c
deleted file mode 100644
index b121d13876..0000000000
--- a/sysdeps/generic/wcstol.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Function to parse a `long int' from text.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define	USE_WIDE_CHAR	1
-
-#include <sysdeps/generic/strtol.c>
diff --git a/sysdeps/generic/wcstol_l.c b/sysdeps/generic/wcstol_l.c
deleted file mode 100644
index f1b4171f18..0000000000
--- a/sysdeps/generic/wcstol_l.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define __need_wchar_t
-#include <stddef.h>
-#include <locale.h>
-
-#define	USE_WIDE_CHAR	1
-
-extern long int ____wcstol_l_internal (const wchar_t *, wchar_t **, int, int,
-				       __locale_t);
-
-#include "strtol_l.c"
diff --git a/sysdeps/generic/wcstoll.c b/sysdeps/generic/wcstoll.c
deleted file mode 100644
index b666762da4..0000000000
--- a/sysdeps/generic/wcstoll.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Function to parse a `long long int' from text.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define	QUAD	1
-
-#include "wcstol.c"
-
-weak_alias (wcstoll, wcstoq)
diff --git a/sysdeps/generic/wcstoll_l.c b/sysdeps/generic/wcstoll_l.c
deleted file mode 100644
index f1a4ca1623..0000000000
--- a/sysdeps/generic/wcstoll_l.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define __need_wchar_t
-#include <stddef.h>
-#include <locale.h>
-
-#define QUAD	1
-
-extern long long int ____wcstoll_l_internal (const wchar_t *, wchar_t **,
-					     int, int, __locale_t);
-
-#include <wcstol_l.c>
diff --git a/sysdeps/generic/wcstoul.c b/sysdeps/generic/wcstoul.c
deleted file mode 100644
index f25f7a9bff..0000000000
--- a/sysdeps/generic/wcstoul.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Function to parse an `unsigned long int' from text.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define	UNSIGNED	1
-
-#include "wcstol.c"
diff --git a/sysdeps/generic/wcstoul_l.c b/sysdeps/generic/wcstoul_l.c
deleted file mode 100644
index eeee1f0baa..0000000000
--- a/sysdeps/generic/wcstoul_l.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define __need_wchar_t
-#include <stddef.h>
-#include <locale.h>
-
-#define UNSIGNED	1
-
-extern unsigned long int ____wcstoul_l_internal (const wchar_t *, wchar_t **,
-						 int, int, __locale_t);
-
-#include <wcstol_l.c>
diff --git a/sysdeps/generic/wcstoull.c b/sysdeps/generic/wcstoull.c
deleted file mode 100644
index a69a103515..0000000000
--- a/sysdeps/generic/wcstoull.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Function to parse an `unsigned long long int' from text.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define	QUAD	1
-
-#include "wcstoul.c"
-
-weak_alias (wcstoull, wcstouq)
diff --git a/sysdeps/generic/wcstoull_l.c b/sysdeps/generic/wcstoull_l.c
deleted file mode 100644
index 32bc3c4bb9..0000000000
--- a/sysdeps/generic/wcstoull_l.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Convert string representing a number to integer value, using given locale.
-   Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define __need_wchar_t
-#include <stddef.h>
-#include <locale.h>
-
-#define UNSIGNED	1
-
-extern unsigned long long int ____wcstoull_l_internal (const wchar_t *,
-						       wchar_t **, int, int,
-						       __locale_t);
-
-#include <wcstoll_l.c>
diff --git a/sysdeps/generic/wcstoumax.c b/sysdeps/generic/wcstoumax.c
deleted file mode 100644
index 508cb19f8c..0000000000
--- a/sysdeps/generic/wcstoumax.c
+++ /dev/null
@@ -1 +0,0 @@
-#error "The correct implementation must be chosen based on the `uintmax_t' type"
diff --git a/sysdeps/generic/wordcopy.c b/sysdeps/generic/wordcopy.c
deleted file mode 100644
index 0c9a4be4f6..0000000000
--- a/sysdeps/generic/wordcopy.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/* _memcopy.c -- subroutines for memory copy functions.
-   Copyright (C) 1991, 1996 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* BE VERY CAREFUL IF YOU CHANGE THIS CODE...!  */
-
-#include <stddef.h>
-#include <memcopy.h>
-
-/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
-   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
-   Both SRCP and DSTP should be aligned for memory operations on `op_t's.  */
-
-void
-_wordcopy_fwd_aligned (dstp, srcp, len)
-     long int dstp;
-     long int srcp;
-     size_t len;
-{
-  op_t a0, a1;
-
-  switch (len % 8)
-    {
-    case 2:
-      a0 = ((op_t *) srcp)[0];
-      srcp -= 6 * OPSIZ;
-      dstp -= 7 * OPSIZ;
-      len += 6;
-      goto do1;
-    case 3:
-      a1 = ((op_t *) srcp)[0];
-      srcp -= 5 * OPSIZ;
-      dstp -= 6 * OPSIZ;
-      len += 5;
-      goto do2;
-    case 4:
-      a0 = ((op_t *) srcp)[0];
-      srcp -= 4 * OPSIZ;
-      dstp -= 5 * OPSIZ;
-      len += 4;
-      goto do3;
-    case 5:
-      a1 = ((op_t *) srcp)[0];
-      srcp -= 3 * OPSIZ;
-      dstp -= 4 * OPSIZ;
-      len += 3;
-      goto do4;
-    case 6:
-      a0 = ((op_t *) srcp)[0];
-      srcp -= 2 * OPSIZ;
-      dstp -= 3 * OPSIZ;
-      len += 2;
-      goto do5;
-    case 7:
-      a1 = ((op_t *) srcp)[0];
-      srcp -= 1 * OPSIZ;
-      dstp -= 2 * OPSIZ;
-      len += 1;
-      goto do6;
-
-    case 0:
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	return;
-      a0 = ((op_t *) srcp)[0];
-      srcp -= 0 * OPSIZ;
-      dstp -= 1 * OPSIZ;
-      goto do7;
-    case 1:
-      a1 = ((op_t *) srcp)[0];
-      srcp -=-1 * OPSIZ;
-      dstp -= 0 * OPSIZ;
-      len -= 1;
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	goto do0;
-      goto do8;			/* No-op.  */
-    }
-
-  do
-    {
-    do8:
-      a0 = ((op_t *) srcp)[0];
-      ((op_t *) dstp)[0] = a1;
-    do7:
-      a1 = ((op_t *) srcp)[1];
-      ((op_t *) dstp)[1] = a0;
-    do6:
-      a0 = ((op_t *) srcp)[2];
-      ((op_t *) dstp)[2] = a1;
-    do5:
-      a1 = ((op_t *) srcp)[3];
-      ((op_t *) dstp)[3] = a0;
-    do4:
-      a0 = ((op_t *) srcp)[4];
-      ((op_t *) dstp)[4] = a1;
-    do3:
-      a1 = ((op_t *) srcp)[5];
-      ((op_t *) dstp)[5] = a0;
-    do2:
-      a0 = ((op_t *) srcp)[6];
-      ((op_t *) dstp)[6] = a1;
-    do1:
-      a1 = ((op_t *) srcp)[7];
-      ((op_t *) dstp)[7] = a0;
-
-      srcp += 8 * OPSIZ;
-      dstp += 8 * OPSIZ;
-      len -= 8;
-    }
-  while (len != 0);
-
-  /* This is the right position for do0.  Please don't move
-     it into the loop.  */
- do0:
-  ((op_t *) dstp)[0] = a1;
-}
-
-/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
-   block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
-   DSTP should be aligned for memory operations on `op_t's, but SRCP must
-   *not* be aligned.  */
-
-void
-_wordcopy_fwd_dest_aligned (dstp, srcp, len)
-     long int dstp;
-     long int srcp;
-     size_t len;
-{
-  op_t a0, a1, a2, a3;
-  int sh_1, sh_2;
-
-  /* Calculate how to shift a word read at the memory operation
-     aligned srcp to make it aligned for copy.  */
-
-  sh_1 = 8 * (srcp % OPSIZ);
-  sh_2 = 8 * OPSIZ - sh_1;
-
-  /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
-     it points in the middle of.  */
-  srcp &= -OPSIZ;
-
-  switch (len % 4)
-    {
-    case 2:
-      a1 = ((op_t *) srcp)[0];
-      a2 = ((op_t *) srcp)[1];
-      srcp -= 1 * OPSIZ;
-      dstp -= 3 * OPSIZ;
-      len += 2;
-      goto do1;
-    case 3:
-      a0 = ((op_t *) srcp)[0];
-      a1 = ((op_t *) srcp)[1];
-      srcp -= 0 * OPSIZ;
-      dstp -= 2 * OPSIZ;
-      len += 1;
-      goto do2;
-    case 0:
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	return;
-      a3 = ((op_t *) srcp)[0];
-      a0 = ((op_t *) srcp)[1];
-      srcp -=-1 * OPSIZ;
-      dstp -= 1 * OPSIZ;
-      len += 0;
-      goto do3;
-    case 1:
-      a2 = ((op_t *) srcp)[0];
-      a3 = ((op_t *) srcp)[1];
-      srcp -=-2 * OPSIZ;
-      dstp -= 0 * OPSIZ;
-      len -= 1;
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	goto do0;
-      goto do4;			/* No-op.  */
-    }
-
-  do
-    {
-    do4:
-      a0 = ((op_t *) srcp)[0];
-      ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2);
-    do3:
-      a1 = ((op_t *) srcp)[1];
-      ((op_t *) dstp)[1] = MERGE (a3, sh_1, a0, sh_2);
-    do2:
-      a2 = ((op_t *) srcp)[2];
-      ((op_t *) dstp)[2] = MERGE (a0, sh_1, a1, sh_2);
-    do1:
-      a3 = ((op_t *) srcp)[3];
-      ((op_t *) dstp)[3] = MERGE (a1, sh_1, a2, sh_2);
-
-      srcp += 4 * OPSIZ;
-      dstp += 4 * OPSIZ;
-      len -= 4;
-    }
-  while (len != 0);
-
-  /* This is the right position for do0.  Please don't move
-     it into the loop.  */
- do0:
-  ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2);
-}
-
-/* _wordcopy_bwd_aligned -- Copy block finishing right before
-   SRCP to block finishing right before DSTP with LEN `op_t' words
-   (not LEN bytes!).  Both SRCP and DSTP should be aligned for memory
-   operations on `op_t's.  */
-
-void
-_wordcopy_bwd_aligned (dstp, srcp, len)
-     long int dstp;
-     long int srcp;
-     size_t len;
-{
-  op_t a0, a1;
-
-  switch (len % 8)
-    {
-    case 2:
-      srcp -= 2 * OPSIZ;
-      dstp -= 1 * OPSIZ;
-      a0 = ((op_t *) srcp)[1];
-      len += 6;
-      goto do1;
-    case 3:
-      srcp -= 3 * OPSIZ;
-      dstp -= 2 * OPSIZ;
-      a1 = ((op_t *) srcp)[2];
-      len += 5;
-      goto do2;
-    case 4:
-      srcp -= 4 * OPSIZ;
-      dstp -= 3 * OPSIZ;
-      a0 = ((op_t *) srcp)[3];
-      len += 4;
-      goto do3;
-    case 5:
-      srcp -= 5 * OPSIZ;
-      dstp -= 4 * OPSIZ;
-      a1 = ((op_t *) srcp)[4];
-      len += 3;
-      goto do4;
-    case 6:
-      srcp -= 6 * OPSIZ;
-      dstp -= 5 * OPSIZ;
-      a0 = ((op_t *) srcp)[5];
-      len += 2;
-      goto do5;
-    case 7:
-      srcp -= 7 * OPSIZ;
-      dstp -= 6 * OPSIZ;
-      a1 = ((op_t *) srcp)[6];
-      len += 1;
-      goto do6;
-
-    case 0:
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	return;
-      srcp -= 8 * OPSIZ;
-      dstp -= 7 * OPSIZ;
-      a0 = ((op_t *) srcp)[7];
-      goto do7;
-    case 1:
-      srcp -= 9 * OPSIZ;
-      dstp -= 8 * OPSIZ;
-      a1 = ((op_t *) srcp)[8];
-      len -= 1;
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	goto do0;
-      goto do8;			/* No-op.  */
-    }
-
-  do
-    {
-    do8:
-      a0 = ((op_t *) srcp)[7];
-      ((op_t *) dstp)[7] = a1;
-    do7:
-      a1 = ((op_t *) srcp)[6];
-      ((op_t *) dstp)[6] = a0;
-    do6:
-      a0 = ((op_t *) srcp)[5];
-      ((op_t *) dstp)[5] = a1;
-    do5:
-      a1 = ((op_t *) srcp)[4];
-      ((op_t *) dstp)[4] = a0;
-    do4:
-      a0 = ((op_t *) srcp)[3];
-      ((op_t *) dstp)[3] = a1;
-    do3:
-      a1 = ((op_t *) srcp)[2];
-      ((op_t *) dstp)[2] = a0;
-    do2:
-      a0 = ((op_t *) srcp)[1];
-      ((op_t *) dstp)[1] = a1;
-    do1:
-      a1 = ((op_t *) srcp)[0];
-      ((op_t *) dstp)[0] = a0;
-
-      srcp -= 8 * OPSIZ;
-      dstp -= 8 * OPSIZ;
-      len -= 8;
-    }
-  while (len != 0);
-
-  /* This is the right position for do0.  Please don't move
-     it into the loop.  */
- do0:
-  ((op_t *) dstp)[7] = a1;
-}
-
-/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
-   before SRCP to block finishing right before DSTP with LEN `op_t'
-   words (not LEN bytes!).  DSTP should be aligned for memory
-   operations on `op_t', but SRCP must *not* be aligned.  */
-
-void
-_wordcopy_bwd_dest_aligned (dstp, srcp, len)
-     long int dstp;
-     long int srcp;
-     size_t len;
-{
-  op_t a0, a1, a2, a3;
-  int sh_1, sh_2;
-
-  /* Calculate how to shift a word read at the memory operation
-     aligned srcp to make it aligned for copy.  */
-
-  sh_1 = 8 * (srcp % OPSIZ);
-  sh_2 = 8 * OPSIZ - sh_1;
-
-  /* Make srcp aligned by rounding it down to the beginning of the op_t
-     it points in the middle of.  */
-  srcp &= -OPSIZ;
-  srcp += OPSIZ;
-
-  switch (len % 4)
-    {
-    case 2:
-      srcp -= 3 * OPSIZ;
-      dstp -= 1 * OPSIZ;
-      a2 = ((op_t *) srcp)[2];
-      a1 = ((op_t *) srcp)[1];
-      len += 2;
-      goto do1;
-    case 3:
-      srcp -= 4 * OPSIZ;
-      dstp -= 2 * OPSIZ;
-      a3 = ((op_t *) srcp)[3];
-      a2 = ((op_t *) srcp)[2];
-      len += 1;
-      goto do2;
-    case 0:
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	return;
-      srcp -= 5 * OPSIZ;
-      dstp -= 3 * OPSIZ;
-      a0 = ((op_t *) srcp)[4];
-      a3 = ((op_t *) srcp)[3];
-      goto do3;
-    case 1:
-      srcp -= 6 * OPSIZ;
-      dstp -= 4 * OPSIZ;
-      a1 = ((op_t *) srcp)[5];
-      a0 = ((op_t *) srcp)[4];
-      len -= 1;
-      if (OP_T_THRES <= 3 * OPSIZ && len == 0)
-	goto do0;
-      goto do4;			/* No-op.  */
-    }
-
-  do
-    {
-    do4:
-      a3 = ((op_t *) srcp)[3];
-      ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2);
-    do3:
-      a2 = ((op_t *) srcp)[2];
-      ((op_t *) dstp)[2] = MERGE (a3, sh_1, a0, sh_2);
-    do2:
-      a1 = ((op_t *) srcp)[1];
-      ((op_t *) dstp)[1] = MERGE (a2, sh_1, a3, sh_2);
-    do1:
-      a0 = ((op_t *) srcp)[0];
-      ((op_t *) dstp)[0] = MERGE (a1, sh_1, a2, sh_2);
-
-      srcp -= 4 * OPSIZ;
-      dstp -= 4 * OPSIZ;
-      len -= 4;
-    }
-  while (len != 0);
-
-  /* This is the right position for do0.  Please don't move
-     it into the loop.  */
- do0:
-  ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2);
-}
diff --git a/sysdeps/generic/wordexp.c b/sysdeps/generic/wordexp.c
deleted file mode 100644
index 3e37d6449c..0000000000
--- a/sysdeps/generic/wordexp.c
+++ /dev/null
@@ -1,2460 +0,0 @@
-/* POSIX.2 wordexp implementation.
-   Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <alloca.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <fnmatch.h>
-#include <glob.h>
-#include <libintl.h>
-#include <paths.h>
-#include <pwd.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#ifdef USE_IN_LIBIO
-# include <wchar.h>
-#endif
-#include <wordexp.h>
-
-#include <bits/libc-lock.h>
-#include <stdio-common/_itoa.h>
-
-/* Undefine the following line for the production version.  */
-/* #define NDEBUG 1 */
-#include <assert.h>
-
-/* Get some device information.  */
-#include <device-nrs.h>
-
-/*
- * This is a recursive-descent-style word expansion routine.
- */
-
-/* These variables are defined and initialized in the startup code.  */
-extern int __libc_argc attribute_hidden;
-extern char **__libc_argv attribute_hidden;
-
-/* Some forward declarations */
-static int parse_dollars (char **word, size_t *word_length, size_t *max_length,
-			  const char *words, size_t *offset, int flags,
-			  wordexp_t *pwordexp, const char *ifs,
-			  const char *ifs_white, int quoted)
-     internal_function;
-static int parse_backtick (char **word, size_t *word_length,
-			   size_t *max_length, const char *words,
-			   size_t *offset, int flags, wordexp_t *pwordexp,
-			   const char *ifs, const char *ifs_white)
-     internal_function;
-static int parse_dquote (char **word, size_t *word_length, size_t *max_length,
-			 const char *words, size_t *offset, int flags,
-			 wordexp_t *pwordexp, const char *ifs,
-			 const char *ifs_white)
-     internal_function;
-static int eval_expr (char *expr, long int *result) internal_function;
-
-/* The w_*() functions manipulate word lists. */
-
-#define W_CHUNK	(100)
-
-/* Result of w_newword will be ignored if it's the last word. */
-static inline char *
-w_newword (size_t *actlen, size_t *maxlen)
-{
-  *actlen = *maxlen = 0;
-  return NULL;
-}
-
-static char *
-w_addchar (char *buffer, size_t *actlen, size_t *maxlen, char ch)
-     /* (lengths exclude trailing zero) */
-{
-  /* Add a character to the buffer, allocating room for it if needed.  */
-
-  if (*actlen == *maxlen)
-    {
-      char *old_buffer = buffer;
-      assert (buffer == NULL || *maxlen != 0);
-      *maxlen += W_CHUNK;
-      buffer = (char *) realloc (buffer, 1 + *maxlen);
-
-      if (buffer == NULL)
-	free (old_buffer);
-    }
-
-  if (buffer != NULL)
-    {
-      buffer[*actlen] = ch;
-      buffer[++(*actlen)] = '\0';
-    }
-
-  return buffer;
-}
-
-static char *
-internal_function
-w_addmem (char *buffer, size_t *actlen, size_t *maxlen, const char *str,
-	  size_t len)
-{
-  /* Add a string to the buffer, allocating room for it if needed.
-   */
-  if (*actlen + len > *maxlen)
-    {
-      char *old_buffer = buffer;
-      assert (buffer == NULL || *maxlen != 0);
-      *maxlen += MAX (2 * len, W_CHUNK);
-      buffer = realloc (old_buffer, 1 + *maxlen);
-
-      if (buffer == NULL)
-	free (old_buffer);
-    }
-
-  if (buffer != NULL)
-    {
-      *((char *) __mempcpy (&buffer[*actlen], str, len)) = '\0';
-      *actlen += len;
-    }
-
-  return buffer;
-}
-
-static char *
-internal_function
-w_addstr (char *buffer, size_t *actlen, size_t *maxlen, const char *str)
-     /* (lengths exclude trailing zero) */
-{
-  /* Add a string to the buffer, allocating room for it if needed.
-   */
-  size_t len;
-
-  assert (str != NULL); /* w_addstr only called from this file */
-  len = strlen (str);
-
-  return w_addmem (buffer, actlen, maxlen, str, len);
-}
-
-static int
-internal_function
-w_addword (wordexp_t *pwordexp, char *word)
-{
-  /* Add a word to the wordlist */
-  size_t num_p;
-  char **new_wordv;
-
-  /* Internally, NULL acts like "".  Convert NULLs to "" before
-   * the caller sees them.
-   */
-  if (word == NULL)
-    {
-      word = __strdup ("");
-      if (word == NULL)
-	goto no_space;
-    }
-
-  num_p = 2 + pwordexp->we_wordc + pwordexp->we_offs;
-  new_wordv = realloc (pwordexp->we_wordv, sizeof (char *) * num_p);
-  if (new_wordv != NULL)
-    {
-      pwordexp->we_wordv = new_wordv;
-      pwordexp->we_wordv[pwordexp->we_offs + pwordexp->we_wordc++] = word;
-      pwordexp->we_wordv[pwordexp->we_offs + pwordexp->we_wordc] = NULL;
-      return 0;
-    }
-
-no_space:
-  return WRDE_NOSPACE;
-}
-
-/* The parse_*() functions should leave *offset being the offset in 'words'
- * to the last character processed.
- */
-
-static int
-internal_function
-parse_backslash (char **word, size_t *word_length, size_t *max_length,
-		 const char *words, size_t *offset)
-{
-  /* We are poised _at_ a backslash, not in quotes */
-
-  switch (words[1 + *offset])
-    {
-    case 0:
-      /* Backslash is last character of input words */
-      return WRDE_SYNTAX;
-
-    case '\n':
-      ++(*offset);
-      break;
-
-    default:
-      *word = w_addchar (*word, word_length, max_length, words[1 + *offset]);
-      if (*word == NULL)
-	return WRDE_NOSPACE;
-
-      ++(*offset);
-      break;
-    }
-
-  return 0;
-}
-
-static int
-internal_function
-parse_qtd_backslash (char **word, size_t *word_length, size_t *max_length,
-		     const char *words, size_t *offset)
-{
-  /* We are poised _at_ a backslash, inside quotes */
-
-  switch (words[1 + *offset])
-    {
-    case 0:
-      /* Backslash is last character of input words */
-      return WRDE_SYNTAX;
-
-    case '\n':
-      ++(*offset);
-      break;
-
-    case '$':
-    case '`':
-    case '"':
-    case '\\':
-      *word = w_addchar (*word, word_length, max_length, words[1 + *offset]);
-      if (*word == NULL)
-	return WRDE_NOSPACE;
-
-      ++(*offset);
-      break;
-
-    default:
-      *word = w_addchar (*word, word_length, max_length, words[*offset]);
-      if (*word != NULL)
-	*word = w_addchar (*word, word_length, max_length, words[1 + *offset]);
-
-      if (*word == NULL)
-	return WRDE_NOSPACE;
-
-      ++(*offset);
-      break;
-    }
-
-  return 0;
-}
-
-static int
-internal_function
-parse_tilde (char **word, size_t *word_length, size_t *max_length,
-	     const char *words, size_t *offset, size_t wordc)
-{
-  /* We are poised _at_ a tilde */
-  size_t i;
-
-  if (*word_length != 0)
-    {
-      if (!((*word)[*word_length - 1] == '=' && wordc == 0))
-	{
-	  if (!((*word)[*word_length - 1] == ':'
-		&& strchr (*word, '=') && wordc == 0))
-	    {
-	      *word = w_addchar (*word, word_length, max_length, '~');
-	      return *word ? 0 : WRDE_NOSPACE;
-	    }
-	}
-    }
-
-  for (i = 1 + *offset; words[i]; i++)
-    {
-      if (words[i] == ':' || words[i] == '/' || words[i] == ' ' ||
-	  words[i] == '\t' || words[i] == 0 )
-	break;
-
-      if (words[i] == '\\')
-	{
-	  *word = w_addchar (*word, word_length, max_length, '~');
-	  return *word ? 0 : WRDE_NOSPACE;
-	}
-    }
-
-  if (i == 1 + *offset)
-    {
-      /* Tilde appears on its own */
-      uid_t uid;
-      struct passwd pwd, *tpwd;
-      int buflen = 1000;
-      char* home;
-      char* buffer;
-      int result;
-
-      /* POSIX.2 says ~ expands to $HOME and if HOME is unset the
-	 results are unspecified.  We do a lookup on the uid if
-	 HOME is unset. */
-
-      home = getenv ("HOME");
-      if (home != NULL)
-	{
-	  *word = w_addstr (*word, word_length, max_length, home);
-	  if (*word == NULL)
-	    return WRDE_NOSPACE;
-	}
-      else
-	{
-	  uid = __getuid ();
-	  buffer = __alloca (buflen);
-
-	  while ((result = __getpwuid_r (uid, &pwd, buffer, buflen, &tpwd)) != 0
-		 && errno == ERANGE)
-	    buffer = extend_alloca (buffer, buflen, buflen + 1000);
-
-	  if (result == 0 && tpwd != NULL && pwd.pw_dir != NULL)
-	    {
-	      *word = w_addstr (*word, word_length, max_length, pwd.pw_dir);
-	      if (*word == NULL)
-		return WRDE_NOSPACE;
-	    }
-	  else
-	    {
-	      *word = w_addchar (*word, word_length, max_length, '~');
-	      if (*word == NULL)
-		return WRDE_NOSPACE;
-	    }
-	}
-    }
-  else
-    {
-      /* Look up user name in database to get home directory */
-      char *user = strndupa (&words[1 + *offset], i - (1 + *offset));
-      struct passwd pwd, *tpwd;
-      int buflen = 1000;
-      char* buffer = __alloca (buflen);
-      int result;
-
-      while ((result = __getpwnam_r (user, &pwd, buffer, buflen, &tpwd)) != 0
-	     && errno == ERANGE)
-	buffer = extend_alloca (buffer, buflen, buflen + 1000);
-
-      if (result == 0 && tpwd != NULL && pwd.pw_dir)
-	*word = w_addstr (*word, word_length, max_length, pwd.pw_dir);
-      else
-	{
-	  /* (invalid login name) */
-	  *word = w_addchar (*word, word_length, max_length, '~');
-	  if (*word != NULL)
-	    *word = w_addstr (*word, word_length, max_length, user);
-	}
-
-      *offset = i - 1;
-    }
-  return *word ? 0 : WRDE_NOSPACE;
-}
-
-
-static int
-internal_function
-do_parse_glob (const char *glob_word, char **word, size_t *word_length,
-	       size_t *max_length, wordexp_t *pwordexp, const char *ifs,
-	       const char *ifs_white)
-{
-  int error;
-  unsigned int match;
-  glob_t globbuf;
-
-  error = glob (glob_word, GLOB_NOCHECK, NULL, &globbuf);
-
-  if (error != 0)
-    {
-      /* We can only run into memory problems.  */
-      assert (error == GLOB_NOSPACE);
-      return WRDE_NOSPACE;
-    }
-
-  if (ifs && !*ifs)
-    {
-      /* No field splitting allowed. */
-      assert (globbuf.gl_pathv[0] != NULL);
-      *word = w_addstr (*word, word_length, max_length, globbuf.gl_pathv[0]);
-      for (match = 1; match < globbuf.gl_pathc && *word != NULL; ++match)
-	{
-	  *word = w_addchar (*word, word_length, max_length, ' ');
-	  if (*word != NULL)
-	    *word = w_addstr (*word, word_length, max_length,
-			      globbuf.gl_pathv[match]);
-	}
-
-      globfree (&globbuf);
-      return *word ? 0 : WRDE_NOSPACE;
-    }
-
-  assert (ifs == NULL || *ifs != '\0');
-  if (*word != NULL)
-    {
-      free (*word);
-      *word = w_newword (word_length, max_length);
-    }
-
-  for (match = 0; match < globbuf.gl_pathc; ++match)
-    {
-      char *matching_word = __strdup (globbuf.gl_pathv[match]);
-      if (matching_word == NULL || w_addword (pwordexp, matching_word))
-	{
-	  globfree (&globbuf);
-	  return WRDE_NOSPACE;
-	}
-    }
-
-  globfree (&globbuf);
-  return 0;
-}
-
-static int
-internal_function
-parse_glob (char **word, size_t *word_length, size_t *max_length,
-	    const char *words, size_t *offset, int flags,
-	    wordexp_t *pwordexp, const char *ifs, const char *ifs_white)
-{
-  /* We are poised just after a '*', a '[' or a '?'. */
-  int error = WRDE_NOSPACE;
-  int quoted = 0; /* 1 if singly-quoted, 2 if doubly */
-  size_t i;
-  wordexp_t glob_list; /* List of words to glob */
-
-  glob_list.we_wordc = 0;
-  glob_list.we_wordv = NULL;
-  glob_list.we_offs = 0;
-  for (; words[*offset] != '\0'; ++*offset)
-    {
-      if ((ifs && strchr (ifs, words[*offset])) ||
-	  (!ifs && strchr (" \t\n", words[*offset])))
-	/* Reached IFS */
-	break;
-
-      /* Sort out quoting */
-      if (words[*offset] == '\'')
-	{
-	  if (quoted == 0)
-	    {
-	      quoted = 1;
-	      continue;
-	    }
-	  else if (quoted == 1)
-	    {
-	      quoted = 0;
-	      continue;
-	    }
-	}
-      else if (words[*offset] == '"')
-	{
-	  if (quoted == 0)
-	    {
-	      quoted = 2;
-	      continue;
-	    }
-	  else if (quoted == 2)
-	    {
-	      quoted = 0;
-	      continue;
-	    }
-	}
-
-      /* Sort out other special characters */
-      if (quoted != 1 && words[*offset] == '$')
-	{
-	  error = parse_dollars (word, word_length, max_length, words,
-				 offset, flags, &glob_list, ifs, ifs_white,
-				 quoted == 2);
-	  if (error)
-	    goto tidy_up;
-
-	  continue;
-	}
-      else if (words[*offset] == '\\')
-	{
-	  if (quoted)
-	    error = parse_qtd_backslash (word, word_length, max_length,
-					 words, offset);
-	  else
-	    error = parse_backslash (word, word_length, max_length,
-				     words, offset);
-
-	  if (error)
-	    goto tidy_up;
-
-	  continue;
-	}
-
-      *word = w_addchar (*word, word_length, max_length, words[*offset]);
-      if (*word == NULL)
-	goto tidy_up;
-    }
-
-  /* Don't forget to re-parse the character we stopped at. */
-  --*offset;
-
-  /* Glob the words */
-  error = w_addword (&glob_list, *word);
-  *word = w_newword (word_length, max_length);
-  for (i = 0; error == 0 && i < glob_list.we_wordc; i++)
-    error = do_parse_glob (glob_list.we_wordv[i], word, word_length,
-			   max_length, pwordexp, ifs, ifs_white);
-
-  /* Now tidy up */
-tidy_up:
-  wordfree (&glob_list);
-  return error;
-}
-
-static int
-internal_function
-parse_squote (char **word, size_t *word_length, size_t *max_length,
-	      const char *words, size_t *offset)
-{
-  /* We are poised just after a single quote */
-  for (; words[*offset]; ++(*offset))
-    {
-      if (words[*offset] != '\'')
-	{
-	  *word = w_addchar (*word, word_length, max_length, words[*offset]);
-	  if (*word == NULL)
-	    return WRDE_NOSPACE;
-	}
-      else return 0;
-    }
-
-  /* Unterminated string */
-  return WRDE_SYNTAX;
-}
-
-/* Functions to evaluate an arithmetic expression */
-static int
-internal_function
-eval_expr_val (char **expr, long int *result)
-{
-  char *digit;
-
-  /* Skip white space */
-  for (digit = *expr; digit && *digit && isspace (*digit); ++digit);
-
-  if (*digit == '(')
-    {
-      /* Scan for closing paren */
-      for (++digit; **expr && **expr != ')'; ++(*expr));
-
-      /* Is there one? */
-      if (!**expr)
-	return WRDE_SYNTAX;
-
-      *(*expr)++ = 0;
-
-      if (eval_expr (digit, result))
-	return WRDE_SYNTAX;
-
-      return 0;
-    }
-
-  /* POSIX requires that decimal, octal, and hexadecimal constants are
-     recognized.  Therefore we pass 0 as the third parameter to strtol.  */
-  *result = strtol (digit, expr, 0);
-  if (digit == *expr)
-    return WRDE_SYNTAX;
-
-  return 0;
-}
-
-static int
-internal_function
-eval_expr_multdiv (char **expr, long int *result)
-{
-  long int arg;
-
-  /* Read a Value */
-  if (eval_expr_val (expr, result) != 0)
-    return WRDE_SYNTAX;
-
-  while (**expr)
-    {
-      /* Skip white space */
-      for (; *expr && **expr && isspace (**expr); ++(*expr));
-
-      if (**expr == '*')
-	{
-	  ++(*expr);
-	  if (eval_expr_val (expr, &arg) != 0)
-	    return WRDE_SYNTAX;
-
-	  *result *= arg;
-	}
-      else if (**expr == '/')
-	{
-	  ++(*expr);
-	  if (eval_expr_val (expr, &arg) != 0)
-	    return WRDE_SYNTAX;
-
-	  *result /= arg;
-	}
-      else break;
-    }
-
-  return 0;
-}
-
-static int
-internal_function
-eval_expr (char *expr, long int *result)
-{
-  long int arg;
-
-  /* Read a Multdiv */
-  if (eval_expr_multdiv (&expr, result) != 0)
-    return WRDE_SYNTAX;
-
-  while (*expr)
-    {
-      /* Skip white space */
-      for (; expr && *expr && isspace (*expr); ++expr);
-
-      if (*expr == '+')
-	{
-	  ++expr;
-	  if (eval_expr_multdiv (&expr, &arg) != 0)
-	    return WRDE_SYNTAX;
-
-	  *result += arg;
-	}
-      else if (*expr == '-')
-	{
-	  ++expr;
-	  if (eval_expr_multdiv (&expr, &arg) != 0)
-	    return WRDE_SYNTAX;
-
-	  *result -= arg;
-	}
-      else break;
-    }
-
-  return 0;
-}
-
-static int
-internal_function
-parse_arith (char **word, size_t *word_length, size_t *max_length,
-	     const char *words, size_t *offset, int flags, int bracket)
-{
-  /* We are poised just after "$((" or "$[" */
-  int error;
-  int paren_depth = 1;
-  size_t expr_length;
-  size_t expr_maxlen;
-  char *expr;
-
-  expr = w_newword (&expr_length, &expr_maxlen);
-  for (; words[*offset]; ++(*offset))
-    {
-      switch (words[*offset])
-	{
-	case '$':
-	  error = parse_dollars (&expr, &expr_length, &expr_maxlen,
-				 words, offset, flags, NULL, NULL, NULL, 1);
-	  /* The ``1'' here is to tell parse_dollars not to
-	   * split the fields.
-	   */
-	  if (error)
-	    {
-	      free (expr);
-	      return error;
-	    }
-	  break;
-
-	case '`':
-	  (*offset)++;
-	  error = parse_backtick (&expr, &expr_length, &expr_maxlen,
-				  words, offset, flags, NULL, NULL, NULL);
-	  /* The first NULL here is to tell parse_backtick not to
-	   * split the fields.
-	   */
-	  if (error)
-	    {
-	      free (expr);
-	      return error;
-	    }
-	  break;
-
-	case '\\':
-	  error = parse_qtd_backslash (&expr, &expr_length, &expr_maxlen,
-				       words, offset);
-	  if (error)
-	    {
-	      free (expr);
-	      return error;
-	    }
-	  /* I think that a backslash within an
-	   * arithmetic expansion is bound to
-	   * cause an error sooner or later anyway though.
-	   */
-	  break;
-
-	case ')':
-	  if (--paren_depth == 0)
-	    {
-	      char result[21];	/* 21 = ceil(log10(2^64)) + 1 */
-	      long int numresult = 0;
-	      long long int convertme;
-
-	      if (bracket || words[1 + *offset] != ')')
-		{
-		  free (expr);
-		  return WRDE_SYNTAX;
-		}
-
-	      ++(*offset);
-
-	      /* Go - evaluate. */
-	      if (*expr && eval_expr (expr, &numresult) != 0)
-		{
-		  free (expr);
-		  return WRDE_SYNTAX;
-		}
-
-	      if (numresult < 0)
-		{
-		  convertme = -numresult;
-		  *word = w_addchar (*word, word_length, max_length, '-');
-		  if (!*word)
-		    {
-		      free (expr);
-		      return WRDE_NOSPACE;
-		    }
-		}
-	      else
-		convertme = numresult;
-
-	      result[20] = '\0';
-	      *word = w_addstr (*word, word_length, max_length,
-				_itoa (convertme, &result[20], 10, 0));
-	      free (expr);
-	      return *word ? 0 : WRDE_NOSPACE;
-	    }
-	  expr = w_addchar (expr, &expr_length, &expr_maxlen, words[*offset]);
-	  if (expr == NULL)
-	    return WRDE_NOSPACE;
-
-	  break;
-
-	case ']':
-	  if (bracket && paren_depth == 1)
-	    {
-	      char result[21];	/* 21 = ceil(log10(2^64)) + 1 */
-	      long int numresult = 0;
-
-	      /* Go - evaluate. */
-	      if (*expr && eval_expr (expr, &numresult) != 0)
-		{
-		  free (expr);
-		  return WRDE_SYNTAX;
-		}
-
-	      result[20] = '\0';
-	      *word = w_addstr (*word, word_length, max_length,
-				_itoa_word (numresult, &result[20], 10, 0));
-	      free (expr);
-	      return *word ? 0 : WRDE_NOSPACE;
-	    }
-
-	  free (expr);
-	  return WRDE_SYNTAX;
-
-	case '\n':
-	case ';':
-	case '{':
-	case '}':
-	  free (expr);
-	  return WRDE_BADCHAR;
-
-	case '(':
-	  ++paren_depth;
-	default:
-	  expr = w_addchar (expr, &expr_length, &expr_maxlen, words[*offset]);
-	  if (expr == NULL)
-	    return WRDE_NOSPACE;
-	}
-    }
-
-  /* Premature end */
-  free (expr);
-  return WRDE_SYNTAX;
-}
-
-/* Function called by child process in exec_comm() */
-static void
-internal_function
-exec_comm_child (char *comm, int *fildes, int showerr, int noexec)
-{
-  const char *args[4] = { _PATH_BSHELL, "-c", comm, NULL };
-
-  /* Execute the command, or just check syntax? */
-  if (noexec)
-    args[1] = "-nc";
-
-  /* Redirect output.  */
-  __dup2 (fildes[1], STDOUT_FILENO);
-  __close (fildes[1]);
-
-  /* Redirect stderr to /dev/null if we have to.  */
-  if (showerr == 0)
-    {
-      struct stat64 st;
-      int fd;
-      __close (2);
-      fd = __open (_PATH_DEVNULL, O_WRONLY);
-      if (fd >= 0 && fd != 2)
-	{
-	  __dup2 (fd, STDERR_FILENO);
-	  __close (fd);
-	}
-      /* Be paranoid.  Check that we actually opened the /dev/null
-         device.  */
-      if (__builtin_expect (__fxstat64 (_STAT_VER, STDERR_FILENO, &st), 0) != 0
-	  || __builtin_expect (S_ISCHR (st.st_mode), 1) == 0
-#if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR
-	  || st.st_rdev != makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)
-#endif
-	  )
-	/* It's not the /dev/null device.  Stop right here.  The
-           problem is: how do we stop?  We use _exit() with an
-           hopefully unusual exit code.  */
-	_exit (90);
-    }
-
-  /* Make sure the subshell doesn't field-split on our behalf. */
-  __unsetenv ("IFS");
-
-  __close (fildes[0]);
-  __execve (_PATH_BSHELL, (char *const *) args, __environ);
-
-  /* Bad.  What now?  */
-  abort ();
-}
-
-/* Function to execute a command and retrieve the results */
-/* pwordexp contains NULL if field-splitting is forbidden */
-static int
-internal_function
-exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
-	   int flags, wordexp_t *pwordexp, const char *ifs,
-	   const char *ifs_white)
-{
-  int fildes[2];
-  int bufsize = 128;
-  int buflen;
-  int i;
-  int status = 0;
-  size_t maxnewlines = 0;
-  char *buffer;
-  pid_t pid;
-
-  /* Don't fork() unless necessary */
-  if (!comm || !*comm)
-    return 0;
-
-  if (__pipe (fildes))
-    /* Bad */
-    return WRDE_NOSPACE;
-
-  if ((pid = __fork ()) < 0)
-    {
-      /* Bad */
-      __close (fildes[0]);
-      __close (fildes[1]);
-      return WRDE_NOSPACE;
-    }
-
-  if (pid == 0)
-    exec_comm_child (comm, fildes, flags & WRDE_SHOWERR, 0);
-
-  /* Parent */
-
-  __close (fildes[1]);
-  buffer = __alloca (bufsize);
-
-  if (!pwordexp)
-    /* Quoted - no field splitting */
-    {
-      while (1)
-	{
-	  if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
-	    {
-	      if (__waitpid (pid, &status, WNOHANG) == 0)
-		continue;
-	      if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
-		break;
-	    }
-
-	  maxnewlines += buflen;
-
-	  *word = w_addmem (*word, word_length, max_length, buffer, buflen);
-	  if (*word == NULL)
-	    goto no_space;
-	}
-    }
-  else
-    /* Not quoted - split fields */
-    {
-      int copying = 0;
-      /* 'copying' is:
-       *  0 when searching for first character in a field not IFS white space
-       *  1 when copying the text of a field
-       *  2 when searching for possible non-whitespace IFS
-       *  3 when searching for non-newline after copying field
-       */
-
-      while (1)
-	{
-	  if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
-	    {
-	      if (__waitpid (pid, &status, WNOHANG) == 0)
-		continue;
-	      if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
-		break;
-	    }
-
-	  for (i = 0; i < buflen; ++i)
-	    {
-	      if (strchr (ifs, buffer[i]) != NULL)
-		{
-		  /* Current character is IFS */
-		  if (strchr (ifs_white, buffer[i]) == NULL)
-		    {
-		      /* Current character is IFS but not whitespace */
-		      if (copying == 2)
-			{
-			  /*            current character
-			   *                   |
-			   *                   V
-			   * eg: text<space><comma><space>moretext
-			   *
-			   * So, strip whitespace IFS (like at the start)
-			   */
-			  copying = 0;
-			  continue;
-			}
-
-		      copying = 0;
-		      /* fall through and delimit field.. */
-		    }
-		  else
-		    {
-		      if (buffer[i] == '\n')
-			{
-			  /* Current character is (IFS) newline */
-
-			  /* If copying a field, this is the end of it,
-			     but maybe all that's left is trailing newlines.
-			     So start searching for a non-newline. */
-			  if (copying == 1)
-			    copying = 3;
-
-			  continue;
-			}
-		      else
-			{
-			  /* Current character is IFS white space, but
-			     not a newline */
-
-			  /* If not either copying a field or searching
-			     for non-newline after a field, ignore it */
-			  if (copying != 1 && copying != 3)
-			    continue;
-
-			  /* End of field (search for non-ws IFS afterwards) */
-			  copying = 2;
-			}
-		    }
-
-		  /* First IFS white space (non-newline), or IFS non-whitespace.
-		   * Delimit the field.  Nulls are converted by w_addword. */
-		  if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
-		    goto no_space;
-
-		  *word = w_newword (word_length, max_length);
-
-		  maxnewlines = 0;
-		  /* fall back round the loop.. */
-		}
-	      else
-		{
-		  /* Not IFS character */
-
-		  if (copying == 3)
-		    {
-		      /* Nothing but (IFS) newlines since the last field,
-		         so delimit it here before starting new word */
-		      if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
-			goto no_space;
-
-		      *word = w_newword (word_length, max_length);
-		    }
-
-		  copying = 1;
-
-		  if (buffer[i] == '\n') /* happens if newline not in IFS */
-		    maxnewlines++;
-		  else
-		    maxnewlines = 0;
-
-		  *word = w_addchar (*word, word_length, max_length,
-				     buffer[i]);
-		  if (*word == NULL)
-		    goto no_space;
-		}
-	    }
-	}
-    }
-
-  /* Chop off trailing newlines (required by POSIX.2)  */
-  /* Ensure we don't go back further than the beginning of the
-     substitution (i.e. remove maxnewlines bytes at most) */
-  while (maxnewlines-- != 0 &&
-         *word_length > 0 && (*word)[*word_length - 1] == '\n')
-    {
-      (*word)[--*word_length] = '\0';
-
-      /* If the last word was entirely newlines, turn it into a new word
-       * which can be ignored if there's nothing following it. */
-      if (*word_length == 0)
-	{
-	  free (*word);
-	  *word = w_newword (word_length, max_length);
-	  break;
-	}
-    }
-
-  __close (fildes[0]);
-
-  /* Check for syntax error (re-execute but with "-n" flag) */
-  if (buflen < 1 && status != 0)
-    {
-      if ((pid = __fork ()) < 0)
-	{
-	  /* Bad */
-	  return WRDE_NOSPACE;
-	}
-
-      if (pid == 0)
-	{
-          fildes[0] = fildes[1] = -1;
-	  exec_comm_child (comm, fildes, 0, 1);
-	}
-
-      if (__waitpid (pid, &status, 0) == pid && status != 0)
-	return WRDE_SYNTAX;
-    }
-
-  return 0;
-
-no_space:
-  __kill (pid, SIGKILL);
-  __waitpid (pid, NULL, 0);
-  __close (fildes[0]);
-  return WRDE_NOSPACE;
-}
-
-static int
-internal_function
-parse_comm (char **word, size_t *word_length, size_t *max_length,
-	    const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
-	    const char *ifs, const char *ifs_white)
-{
-  /* We are poised just after "$(" */
-  int paren_depth = 1;
-  int error = 0;
-  int quoted = 0; /* 1 for singly-quoted, 2 for doubly-quoted */
-  size_t comm_length;
-  size_t comm_maxlen;
-  char *comm = w_newword (&comm_length, &comm_maxlen);
-
-  for (; words[*offset]; ++(*offset))
-    {
-      switch (words[*offset])
-	{
-	case '\'':
-	  if (quoted == 0)
-	    quoted = 1;
-	  else if (quoted == 1)
-	    quoted = 0;
-
-	  break;
-
-	case '"':
-	  if (quoted == 0)
-	    quoted = 2;
-	  else if (quoted == 2)
-	    quoted = 0;
-
-	  break;
-
-	case ')':
-	  if (!quoted && --paren_depth == 0)
-	    {
-	      /* Go -- give script to the shell */
-	      if (comm)
-		{
-#ifdef __libc_ptf_call
-		  /* We do not want the exec_comm call to be cut short
-		     by a thread cancellation since cleanup is very
-		     ugly.  Therefore disable cancellation for
-		     now.  */
-		  // XXX Ideally we do want the thread being cancelable.
-		  // XXX If demand is there we'll change it.
-		  int state = PTHREAD_CANCEL_ENABLE;
-		  __libc_ptf_call (pthread_setcancelstate,
-				   (PTHREAD_CANCEL_DISABLE, &state), 0);
-#endif
-
-		  error = exec_comm (comm, word, word_length, max_length,
-				     flags, pwordexp, ifs, ifs_white);
-
-#ifdef __libc_ptf_call
-		  __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
-#endif
-
-		  free (comm);
-		}
-
-	      return error;
-	    }
-
-	  /* This is just part of the script */
-	  break;
-
-	case '(':
-	  if (!quoted)
-	    ++paren_depth;
-	}
-
-      comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
-      if (comm == NULL)
-	return WRDE_NOSPACE;
-    }
-
-  /* Premature end */
-  if (comm)
-    free (comm);
-
-  return WRDE_SYNTAX;
-}
-
-static int
-internal_function
-parse_param (char **word, size_t *word_length, size_t *max_length,
-	     const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
-	     const char *ifs, const char *ifs_white, int quoted)
-{
-  /* We are poised just after "$" */
-  enum action
-  {
-    ACT_NONE,
-    ACT_RP_SHORT_LEFT = '#',
-    ACT_RP_LONG_LEFT = 'L',
-    ACT_RP_SHORT_RIGHT = '%',
-    ACT_RP_LONG_RIGHT = 'R',
-    ACT_NULL_ERROR = '?',
-    ACT_NULL_SUBST = '-',
-    ACT_NONNULL_SUBST = '+',
-    ACT_NULL_ASSIGN = '='
-  };
-  size_t env_length;
-  size_t env_maxlen;
-  size_t pat_length;
-  size_t pat_maxlen;
-  size_t start = *offset;
-  char *env;
-  char *pattern;
-  char *value = NULL;
-  enum action action = ACT_NONE;
-  int depth = 0;
-  int colon_seen = 0;
-  int seen_hash = 0;
-  int free_value = 0;
-  int pattern_is_quoted = 0; /* 1 for singly-quoted, 2 for doubly-quoted */
-  int error;
-  int special = 0;
-  char buffer[21];
-  int brace = words[*offset] == '{';
-
-  env = w_newword (&env_length, &env_maxlen);
-  pattern = w_newword (&pat_length, &pat_maxlen);
-
-  if (brace)
-    ++*offset;
-
-  /* First collect the parameter name. */
-
-  if (words[*offset] == '#')
-    {
-      seen_hash = 1;
-      if (!brace)
-	goto envsubst;
-      ++*offset;
-    }
-
-  if (isalpha (words[*offset]) || words[*offset] == '_')
-    {
-      /* Normal parameter name. */
-      do
-	{
-	  env = w_addchar (env, &env_length, &env_maxlen,
-			   words[*offset]);
-	  if (env == NULL)
-	    goto no_space;
-	}
-      while (isalnum (words[++*offset]) || words[*offset] == '_');
-    }
-  else if (isdigit (words[*offset]))
-    {
-      /* Numeric parameter name. */
-      special = 1;
-      do
-	{
-	  env = w_addchar (env, &env_length, &env_maxlen,
-			   words[*offset]);
-	  if (env == NULL)
-	    goto no_space;
-	  if (!brace)
-	    goto envsubst;
-	}
-      while (isdigit(words[++*offset]));
-    }
-  else if (strchr ("*@$", words[*offset]) != NULL)
-    {
-      /* Special parameter. */
-      special = 1;
-      env = w_addchar (env, &env_length, &env_maxlen,
-		       words[*offset]);
-      if (env == NULL)
-	goto no_space;
-      ++*offset;
-    }
-  else
-    {
-      if (brace)
-	goto syntax;
-    }
-
-  if (brace)
-    {
-      /* Check for special action to be applied to the value. */
-      switch (words[*offset])
-	{
-	case '}':
-	  /* Evaluate. */
-	  goto envsubst;
-
-	case '#':
-	  action = ACT_RP_SHORT_LEFT;
-	  if (words[1 + *offset] == '#')
-	    {
-	      ++*offset;
-	      action = ACT_RP_LONG_LEFT;
-	    }
-	  break;
-
-	case '%':
-	  action = ACT_RP_SHORT_RIGHT;
-	  if (words[1 + *offset] == '%')
-	    {
-	      ++*offset;
-	      action = ACT_RP_LONG_RIGHT;
-	    }
-	  break;
-
-	case ':':
-	  if (strchr ("-=?+", words[1 + *offset]) == NULL)
-	    goto syntax;
-
-	  colon_seen = 1;
-	  action = words[++*offset];
-	  break;
-
-	case '-':
-	case '=':
-	case '?':
-	case '+':
-	  action = words[*offset];
-	  break;
-
-	default:
-	  goto syntax;
-	}
-
-      /* Now collect the pattern, but don't expand it yet. */
-      ++*offset;
-      for (; words[*offset]; ++(*offset))
-	{
-	  switch (words[*offset])
-	    {
-	    case '{':
-	      if (!pattern_is_quoted)
-		++depth;
-	      break;
-
-	    case '}':
-	      if (!pattern_is_quoted)
-		{
-		  if (depth == 0)
-		    goto envsubst;
-		  --depth;
-		}
-	      break;
-
-	    case '\\':
-	      if (pattern_is_quoted)
-		/* Quoted; treat as normal character. */
-		break;
-
-	      /* Otherwise, it's an escape: next character is literal. */
-	      if (words[++*offset] == '\0')
-		goto syntax;
-
-	      pattern = w_addchar (pattern, &pat_length, &pat_maxlen, '\\');
-	      if (pattern == NULL)
-		goto no_space;
-
-	      break;
-
-	    case '\'':
-	      if (pattern_is_quoted == 0)
-		pattern_is_quoted = 1;
-	      else if (pattern_is_quoted == 1)
-		pattern_is_quoted = 0;
-
-	      break;
-
-	    case '"':
-	      if (pattern_is_quoted == 0)
-		pattern_is_quoted = 2;
-	      else if (pattern_is_quoted == 2)
-		pattern_is_quoted = 0;
-
-	      break;
-	    }
-
-	  pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
-			       words[*offset]);
-	  if (pattern == NULL)
-	    goto no_space;
-	}
-    }
-
-  /* End of input string -- remember to reparse the character that we
-   * stopped at.  */
-  --(*offset);
-
-envsubst:
-  if (words[start] == '{' && words[*offset] != '}')
-    goto syntax;
-
-  if (env == NULL)
-    {
-      if (seen_hash)
-	{
-	  /* $# expands to the number of positional parameters */
-	  buffer[20] = '\0';
-	  value = _itoa_word (__libc_argc - 1, &buffer[20], 10, 0);
-	  seen_hash = 0;
-	}
-      else
-	{
-	  /* Just $ on its own */
-	  *offset = start - 1;
-	  *word = w_addchar (*word, word_length, max_length, '$');
-	  return *word ? 0 : WRDE_NOSPACE;
-	}
-    }
-  /* Is it a numeric parameter? */
-  else if (isdigit (env[0]))
-    {
-      int n = atoi (env);
-
-      if (n >= __libc_argc)
-	/* Substitute NULL. */
-	value = NULL;
-      else
-	/* Replace with appropriate positional parameter. */
-	value = __libc_argv[n];
-    }
-  /* Is it a special parameter? */
-  else if (special)
-    {
-      /* Is it `$$'? */
-      if (*env == '$')
-	{
-	  buffer[20] = '\0';
-	  value = _itoa_word (__getpid (), &buffer[20], 10, 0);
-	}
-      /* Is it `${#*}' or `${#@}'? */
-      else if ((*env == '*' || *env == '@') && seen_hash)
-	{
-	  buffer[20] = '\0';
-	  value = _itoa_word (__libc_argc > 0 ? __libc_argc - 1 : 0,
-			      &buffer[20], 10, 0);
-	  *word = w_addstr (*word, word_length, max_length, value);
-	  free (env);
-	  if (pattern)
-	    free (pattern);
-	  return *word ? 0 : WRDE_NOSPACE;
-	}
-      /* Is it `$*' or `$@' (unquoted) ? */
-      else if (*env == '*' || (*env == '@' && !quoted))
-	{
-	  size_t plist_len = 0;
-	  int p;
-	  char *end;
-
-	  /* Build up value parameter by parameter (copy them) */
-	  for (p = 1; __libc_argv[p]; ++p)
-	    plist_len += strlen (__libc_argv[p]) + 1; /* for space */
-	  value = malloc (plist_len);
-	  if (value == NULL)
-	    goto no_space;
-	  end = value;
-	  *end = 0;
-	  for (p = 1; __libc_argv[p]; ++p)
-	    {
-	      if (p > 1)
-		*end++ = ' ';
-	      end = __stpcpy (end, __libc_argv[p]);
-	    }
-
-	  free_value = 1;
-	}
-      else
-	{
-	  /* Must be a quoted `$@' */
-	  assert (*env == '@' && quoted);
-
-	  /* Each parameter is a separate word ("$@") */
-	  if (__libc_argc == 2)
-	    value = __libc_argv[1];
-	  else if (__libc_argc > 2)
-	    {
-	      int p;
-
-	      /* Append first parameter to current word. */
-	      value = w_addstr (*word, word_length, max_length,
-				__libc_argv[1]);
-	      if (value == NULL || w_addword (pwordexp, value))
-		goto no_space;
-
-	      for (p = 2; __libc_argv[p + 1]; p++)
-		{
-		  char *newword = __strdup (__libc_argv[p]);
-		  if (newword == NULL || w_addword (pwordexp, newword))
-		    goto no_space;
-		}
-
-	      /* Start a new word with the last parameter. */
-	      *word = w_newword (word_length, max_length);
-	      value = __libc_argv[p];
-	    }
-	  else
-	    {
-	      free (env);
-	      free (pattern);
-	      return 0;
-	    }
-	}
-    }
-  else
-    value = getenv (env);
-
-  if (value == NULL && (flags & WRDE_UNDEF))
-    {
-      /* Variable not defined. */
-      error = WRDE_BADVAL;
-      goto do_error;
-    }
-
-  if (action != ACT_NONE)
-    {
-      int expand_pattern = 0;
-
-      /* First, find out if we need to expand pattern (i.e. if we will
-       * use it). */
-      switch (action)
-	{
-	case ACT_RP_SHORT_LEFT:
-	case ACT_RP_LONG_LEFT:
-	case ACT_RP_SHORT_RIGHT:
-	case ACT_RP_LONG_RIGHT:
-	  /* Always expand for these. */
-	  expand_pattern = 1;
-	  break;
-
-	case ACT_NULL_ERROR:
-	case ACT_NULL_SUBST:
-	case ACT_NULL_ASSIGN:
-	  if (!value || (!*value && colon_seen))
-	    /* If param is unset, or set but null and a colon has been seen,
-	       the expansion of the pattern will be needed. */
-	    expand_pattern = 1;
-
-	  break;
-
-	case ACT_NONNULL_SUBST:
-	  /* Expansion of word will be needed if parameter is set and not null,
-	     or set null but no colon has been seen. */
-	  if (value && (*value || !colon_seen))
-	    expand_pattern = 1;
-
-	  break;
-
-	default:
-	  assert (! "Unrecognised action!");
-	}
-
-      if (expand_pattern)
-	{
-	  /* We need to perform tilde expansion, parameter expansion,
-             command substitution, and arithmetic expansion.  We also
-	     have to be a bit careful with wildcard characters, as
-	     pattern might be given to fnmatch soon.  To do this, we
-	     convert quotes to escapes. */
-
-	  char *expanded;
-	  size_t exp_len;
-	  size_t exp_maxl;
-	  char *p;
-	  int quoted = 0; /* 1: single quotes; 2: double */
-
-	  expanded = w_newword (&exp_len, &exp_maxl);
-	  for (p = pattern; p && *p; p++)
-	    {
-	      size_t offset;
-
-	      switch (*p)
-		{
-		case '"':
-		  if (quoted == 2)
-		    quoted = 0;
-		  else if (quoted == 0)
-		    quoted = 2;
-		  else break;
-
-		  continue;
-
-		case '\'':
-		  if (quoted == 1)
-		    quoted = 0;
-		  else if (quoted == 0)
-		    quoted = 1;
-		  else break;
-
-		  continue;
-
-		case '*':
-		case '?':
-		  if (quoted)
-		    {
-		      /* Convert quoted wildchar to escaped wildchar. */
-		      expanded = w_addchar (expanded, &exp_len,
-					    &exp_maxl, '\\');
-
-		      if (expanded == NULL)
-			goto no_space;
-		    }
-		  break;
-
-		case '$':
-		  offset = 0;
-		  error = parse_dollars (&expanded, &exp_len, &exp_maxl, p,
-					 &offset, flags, NULL, NULL, NULL, 1);
-		  if (error)
-		    {
-		      if (free_value)
-			free (value);
-
-		      if (expanded)
-			free (expanded);
-
-		      goto do_error;
-		    }
-
-		  p += offset;
-		  continue;
-
-		case '~':
-		  if (quoted || exp_len)
-		    break;
-
-		  offset = 0;
-		  error = parse_tilde (&expanded, &exp_len, &exp_maxl, p,
-				       &offset, 0);
-		  if (error)
-		    {
-		      if (free_value)
-			free (value);
-
-		      if (expanded)
-			free (expanded);
-
-		      goto do_error;
-		    }
-
-		  p += offset;
-		  continue;
-
-		case '\\':
-		  expanded = w_addchar (expanded, &exp_len, &exp_maxl, '\\');
-		  ++p;
-		  assert (*p); /* checked when extracted initially */
-		  if (expanded == NULL)
-		    goto no_space;
-		}
-
-	      expanded = w_addchar (expanded, &exp_len, &exp_maxl, *p);
-
-	      if (expanded == NULL)
-		goto no_space;
-	    }
-
-	  if (pattern)
-		  free (pattern);
-
-	  pattern = expanded;
-	}
-
-      switch (action)
-	{
-	case ACT_RP_SHORT_LEFT:
-	case ACT_RP_LONG_LEFT:
-	case ACT_RP_SHORT_RIGHT:
-	case ACT_RP_LONG_RIGHT:
-	  {
-	    char *p;
-	    char c;
-	    char *end;
-
-	    if (value == NULL || pattern == NULL || *pattern == '\0')
-	      break;
-
-	    end = value + strlen (value);
-
-	    switch (action)
-	      {
-	      case ACT_RP_SHORT_LEFT:
-		for (p = value; p <= end; ++p)
-		  {
-		    c = *p;
-		    *p = '\0';
-		    if (fnmatch (pattern, value, 0) != FNM_NOMATCH)
-		      {
-			*p = c;
-			if (free_value)
-			  {
-			    char *newval = __strdup (p);
-			    if (newval == NULL)
-			      {
-				free (value);
-				goto no_space;
-			      }
-			    free (value);
-			    value = newval;
-			  }
-			else
-			  value = p;
-			break;
-		      }
-		    *p = c;
-		  }
-
-		break;
-
-	      case ACT_RP_LONG_LEFT:
-		for (p = end; p >= value; --p)
-		  {
-		    c = *p;
-		    *p = '\0';
-		    if (fnmatch (pattern, value, 0) != FNM_NOMATCH)
-		      {
-			*p = c;
-			if (free_value)
-			  {
-			    char *newval = __strdup (p);
-			    if (newval == NULL)
-			      {
-				free (value);
-				goto no_space;
-			      }
-			    free (value);
-			    value = newval;
-			  }
-			else
-			  value = p;
-			break;
-		      }
-		    *p = c;
-		  }
-
-		break;
-
-	      case ACT_RP_SHORT_RIGHT:
-		for (p = end; p >= value; --p)
-		  {
-		    if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
-		      {
-			char *newval;
-			newval = malloc (p - value + 1);
-
-			if (newval == NULL)
-			  {
-			    if (free_value)
-			      free (value);
-			    goto no_space;
-			  }
-
-			*(char *) __mempcpy (newval, value, p - value) = '\0';
-			if (free_value)
-			  free (value);
-			value = newval;
-			free_value = 1;
-			break;
-		      }
-		  }
-
-		break;
-
-	      case ACT_RP_LONG_RIGHT:
-		for (p = value; p <= end; ++p)
-		  {
-		    if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
-		      {
-			char *newval;
-			newval = malloc (p - value + 1);
-
-			if (newval == NULL)
-			  {
-			    if (free_value)
-			      free (value);
-			    goto no_space;
-			  }
-
-			*(char *) __mempcpy (newval, value, p - value) = '\0';
-			if (free_value)
-			  free (value);
-			value = newval;
-			free_value = 1;
-			break;
-		      }
-		  }
-
-		break;
-
-	      default:
-		break;
-	      }
-
-	    break;
-	  }
-
-	case ACT_NULL_ERROR:
-	  if (value && *value)
-	    /* Substitute parameter */
-	    break;
-
-	  error = 0;
-	  if (!colon_seen && value)
-	    /* Substitute NULL */
-	    ;
-	  else
-	    {
-	      const char *str = pattern;
-
-	      if (str[0] == '\0')
-		str = _("parameter null or not set");
-
-#ifdef USE_IN_LIBIO
-	      if (_IO_fwide (stderr, 0) > 0)
-		__fwprintf (stderr, L"%s: %s\n", env, str);
-	      else
-#endif
-		fprintf (stderr, "%s: %s\n", env, str);
-	    }
-
-	  if (free_value)
-	    free (value);
-	  goto do_error;
-
-	case ACT_NULL_SUBST:
-	  if (value && *value)
-	    /* Substitute parameter */
-	    break;
-
-	  if (free_value && value)
-	    free (value);
-
-	  if (!colon_seen && value)
-	    /* Substitute NULL */
-	    goto success;
-
-	  value = pattern ? __strdup (pattern) : pattern;
-	  free_value = 1;
-
-	  if (pattern && !value)
-	    goto no_space;
-
-	  break;
-
-	case ACT_NONNULL_SUBST:
-	  if (value && (*value || !colon_seen))
-	    {
-	      if (free_value && value)
-		free (value);
-
-	      value = pattern ? __strdup (pattern) : pattern;
-	      free_value = 1;
-
-	      if (pattern && !value)
-		goto no_space;
-
-	      break;
-	    }
-
-	  /* Substitute NULL */
-	  if (free_value)
-	    free (value);
-	  goto success;
-
-	case ACT_NULL_ASSIGN:
-	  if (value && *value)
-	    /* Substitute parameter */
-	    break;
-
-	  if (!colon_seen && value)
-	    {
-	      /* Substitute NULL */
-	      if (free_value)
-		free (value);
-	      goto success;
-	    }
-
-	  if (free_value && value)
-	    free (value);
-
-	  value = pattern ? __strdup (pattern) : pattern;
-	  free_value = 1;
-
-	  if (pattern && !value)
-	    goto no_space;
-
-	  __setenv (env, value, 1);
-	  break;
-
-	default:
-	  assert (! "Unrecognised action!");
-	}
-    }
-
-  free (env); env = NULL;
-  free (pattern); pattern = NULL;
-
-  if (seen_hash)
-    {
-      char param_length[21];
-      param_length[20] = '\0';
-      *word = w_addstr (*word, word_length, max_length,
-			_itoa_word (value ? strlen (value) : 0,
-				    &param_length[20], 10, 0));
-      if (free_value)
-	{
-	  assert (value != NULL);
-	  free (value);
-	}
-
-      return *word ? 0 : WRDE_NOSPACE;
-    }
-
-  if (value == NULL)
-    return 0;
-
-  if (quoted || !pwordexp)
-    {
-      /* Quoted - no field split */
-      *word = w_addstr (*word, word_length, max_length, value);
-      if (free_value)
-	free (value);
-
-      return *word ? 0 : WRDE_NOSPACE;
-    }
-  else
-    {
-      /* Need to field-split */
-      char *value_copy = __strdup (value); /* Don't modify value */
-      char *field_begin = value_copy;
-      int seen_nonws_ifs = 0;
-
-      if (free_value)
-	free (value);
-
-      if (value_copy == NULL)
-	goto no_space;
-
-      do
-	{
-	  char *field_end = field_begin;
-	  char *next_field;
-
-	  /* If this isn't the first field, start a new word */
-	  if (field_begin != value_copy)
-	    {
-	      if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
-		{
-		  free (value_copy);
-		  goto no_space;
-		}
-
-	      *word = w_newword (word_length, max_length);
-	    }
-
-	  /* Skip IFS whitespace before the field */
-	  field_begin += strspn (field_begin, ifs_white);
-
-	  if (!seen_nonws_ifs && *field_begin == 0)
-	    /* Nothing but whitespace */
-	    break;
-
-	  /* Search for the end of the field */
-	  field_end = field_begin + strcspn (field_begin, ifs);
-
-	  /* Set up pointer to the character after end of field and
-             skip whitespace IFS after it. */
-	  next_field = field_end + strspn (field_end, ifs_white);
-
-	  /* Skip at most one non-whitespace IFS character after the field */
-	  seen_nonws_ifs = 0;
-	  if (*next_field && strchr (ifs, *next_field))
-	    {
-	      seen_nonws_ifs = 1;
-	      next_field++;
-	    }
-
-	  /* Null-terminate it */
-	  *field_end = 0;
-
-	  /* Tag a copy onto the current word */
-	  *word = w_addstr (*word, word_length, max_length, field_begin);
-
-	  if (*word == NULL && *field_begin != '\0')
-	    {
-	      free (value_copy);
-	      goto no_space;
-	    }
-
-	  field_begin = next_field;
-	}
-      while (seen_nonws_ifs || *field_begin);
-
-      free (value_copy);
-    }
-
-  return 0;
-
-success:
-  error = 0;
-  goto do_error;
-
-no_space:
-  error = WRDE_NOSPACE;
-  goto do_error;
-
-syntax:
-  error = WRDE_SYNTAX;
-
-do_error:
-  if (env)
-    free (env);
-
-  if (pattern)
-    free (pattern);
-
-  return error;
-}
-
-static int
-internal_function
-parse_dollars (char **word, size_t *word_length, size_t *max_length,
-	       const char *words, size_t *offset, int flags,
-	       wordexp_t *pwordexp, const char *ifs, const char *ifs_white,
-	       int quoted)
-{
-  /* We are poised _at_ "$" */
-  switch (words[1 + *offset])
-    {
-    case '"':
-    case '\'':
-    case 0:
-      *word = w_addchar (*word, word_length, max_length, '$');
-      return *word ? 0 : WRDE_NOSPACE;
-
-    case '(':
-      if (words[2 + *offset] == '(')
-	{
-	  /* Differentiate between $((1+3)) and $((echo);(ls)) */
-	  int i = 3 + *offset;
-	  int depth = 0;
-	  while (words[i] && !(depth == 0 && words[i] == ')'))
-	    {
-	      if (words[i] == '(')
-		++depth;
-	      else if (words[i] == ')')
-		--depth;
-
-	      ++i;
-	    }
-
-	  if (words[i] == ')' && words[i + 1] == ')')
-	    {
-	      (*offset) += 3;
-	      /* Call parse_arith -- 0 is for "no brackets" */
-	      return parse_arith (word, word_length, max_length, words, offset,
-				  flags, 0);
-	    }
-	}
-
-      if (flags & WRDE_NOCMD)
-	return WRDE_CMDSUB;
-
-      (*offset) += 2;
-      return parse_comm (word, word_length, max_length, words, offset, flags,
-			 quoted? NULL : pwordexp, ifs, ifs_white);
-
-    case '[':
-      (*offset) += 2;
-      /* Call parse_arith -- 1 is for "brackets" */
-      return parse_arith (word, word_length, max_length, words, offset, flags,
-			  1);
-
-    case '{':
-    default:
-      ++(*offset);	/* parse_param needs to know if "{" is there */
-      return parse_param (word, word_length, max_length, words, offset, flags,
-			   pwordexp, ifs, ifs_white, quoted);
-    }
-}
-
-static int
-internal_function
-parse_backtick (char **word, size_t *word_length, size_t *max_length,
-		const char *words, size_t *offset, int flags,
-		wordexp_t *pwordexp, const char *ifs, const char *ifs_white)
-{
-  /* We are poised just after "`" */
-  int error;
-  int squoting = 0;
-  size_t comm_length;
-  size_t comm_maxlen;
-  char *comm = w_newword (&comm_length, &comm_maxlen);
-
-  for (; words[*offset]; ++(*offset))
-    {
-      switch (words[*offset])
-	{
-	case '`':
-	  /* Go -- give the script to the shell */
-	  error = exec_comm (comm, word, word_length, max_length, flags,
-			     pwordexp, ifs, ifs_white);
-	  free (comm);
-	  return error;
-
-	case '\\':
-	  if (squoting)
-	    {
-	      error = parse_qtd_backslash (&comm, &comm_length, &comm_maxlen,
-					   words, offset);
-
-	      if (error)
-		{
-		  free (comm);
-		  return error;
-		}
-
-	      break;
-	    }
-
-	  ++(*offset);
-	  error = parse_backslash (&comm, &comm_length, &comm_maxlen, words,
-				   offset);
-
-	  if (error)
-	    {
-	      free (comm);
-	      return error;
-	    }
-
-	  break;
-
-	case '\'':
-	  squoting = 1 - squoting;
-	default:
-	  comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
-	  if (comm == NULL)
-	    return WRDE_NOSPACE;
-	}
-    }
-
-  /* Premature end */
-  free (comm);
-  return WRDE_SYNTAX;
-}
-
-static int
-internal_function
-parse_dquote (char **word, size_t *word_length, size_t *max_length,
-	      const char *words, size_t *offset, int flags,
-	      wordexp_t *pwordexp, const char * ifs, const char * ifs_white)
-{
-  /* We are poised just after a double-quote */
-  int error;
-
-  for (; words[*offset]; ++(*offset))
-    {
-      switch (words[*offset])
-	{
-	case '"':
-	  return 0;
-
-	case '$':
-	  error = parse_dollars (word, word_length, max_length, words, offset,
-				 flags, pwordexp, ifs, ifs_white, 1);
-	  /* The ``1'' here is to tell parse_dollars not to
-	   * split the fields.  It may need to, however ("$@").
-	   */
-	  if (error)
-	    return error;
-
-	  break;
-
-	case '`':
-	  if (flags & WRDE_NOCMD)
-	    return WRDE_CMDSUB;
-
-	  ++(*offset);
-	  error = parse_backtick (word, word_length, max_length, words,
-				  offset, flags, NULL, NULL, NULL);
-	  /* The first NULL here is to tell parse_backtick not to
-	   * split the fields.
-	   */
-	  if (error)
-	    return error;
-
-	  break;
-
-	case '\\':
-	  error = parse_qtd_backslash (word, word_length, max_length, words,
-				       offset);
-
-	  if (error)
-	    return error;
-
-	  break;
-
-	default:
-	  *word = w_addchar (*word, word_length, max_length, words[*offset]);
-	  if (*word == NULL)
-	    return WRDE_NOSPACE;
-	}
-    }
-
-  /* Unterminated string */
-  return WRDE_SYNTAX;
-}
-
-/*
- * wordfree() is to be called after pwordexp is finished with.
- */
-
-void
-wordfree (wordexp_t *pwordexp)
-{
-
-  /* wordexp can set pwordexp to NULL */
-  if (pwordexp && pwordexp->we_wordv)
-    {
-      char **wordv = pwordexp->we_wordv;
-
-      for (wordv += pwordexp->we_offs; *wordv; ++wordv)
-	free (*wordv);
-
-      free (pwordexp->we_wordv);
-      pwordexp->we_wordv = NULL;
-    }
-}
-libc_hidden_def (wordfree)
-
-/*
- * wordexp()
- */
-
-int
-wordexp (const char *words, wordexp_t *pwordexp, int flags)
-{
-  size_t words_offset;
-  size_t word_length;
-  size_t max_length;
-  char *word = w_newword (&word_length, &max_length);
-  int error;
-  char *ifs;
-  char ifs_white[4];
-  wordexp_t old_word = *pwordexp;
-
-  if (flags & WRDE_REUSE)
-    {
-      /* Minimal implementation of WRDE_REUSE for now */
-      wordfree (pwordexp);
-      old_word.we_wordv = NULL;
-    }
-
-  if ((flags & WRDE_APPEND) == 0)
-    {
-      pwordexp->we_wordc = 0;
-
-      if (flags & WRDE_DOOFFS)
-	{
-	  pwordexp->we_wordv = calloc (1 + pwordexp->we_offs, sizeof (char *));
-	  if (pwordexp->we_wordv == NULL)
-	    {
-	      error = WRDE_NOSPACE;
-	      goto do_error;
-	    }
-	}
-      else
-	{
-	  pwordexp->we_wordv = calloc (1, sizeof (char *));
-	  if (pwordexp->we_wordv == NULL)
-	    {
-	      error = WRDE_NOSPACE;
-	      goto do_error;
-	    }
-
-	  pwordexp->we_offs = 0;
-	}
-    }
-
-  /* Find out what the field separators are.
-   * There are two types: whitespace and non-whitespace.
-   */
-  ifs = getenv ("IFS");
-
-  if (!ifs)
-    /* IFS unset - use <space><tab><newline>. */
-    ifs = strcpy (ifs_white, " \t\n");
-  else
-    {
-      char *ifsch = ifs;
-      char *whch = ifs_white;
-
-      /* Start off with no whitespace IFS characters */
-      ifs_white[0] = '\0';
-
-      while (*ifsch != '\0')
-	{
-	  if ((*ifsch == ' ') || (*ifsch == '\t') || (*ifsch == '\n'))
-	    {
-	      /* Whitespace IFS.  See first whether it is already in our
-		 collection.  */
-	      char *runp = ifs_white;
-
-	      while (runp < whch && *runp != '\0' && *runp != *ifsch)
-		++runp;
-
-	      if (runp == whch)
-		*whch++ = *ifsch;
-	    }
-
-	  ++ifsch;
-	}
-      *whch = '\0';
-    }
-
-  for (words_offset = 0 ; words[words_offset] ; ++words_offset)
-    switch (words[words_offset])
-      {
-      case '\\':
-	error = parse_backslash (&word, &word_length, &max_length, words,
-				 &words_offset);
-
-	if (error)
-	  goto do_error;
-
-	break;
-
-      case '$':
-	error = parse_dollars (&word, &word_length, &max_length, words,
-			       &words_offset, flags, pwordexp, ifs, ifs_white,
-			       0);
-
-	if (error)
-	  goto do_error;
-
-	break;
-
-      case '`':
-	if (flags & WRDE_NOCMD)
-	  {
-	    error = WRDE_CMDSUB;
-	    goto do_error;
-	  }
-
-	++words_offset;
-	error = parse_backtick (&word, &word_length, &max_length, words,
-				&words_offset, flags, pwordexp, ifs,
-				ifs_white);
-
-	if (error)
-	  goto do_error;
-
-	break;
-
-      case '"':
-	++words_offset;
-	error = parse_dquote (&word, &word_length, &max_length, words,
-			      &words_offset, flags, pwordexp, ifs, ifs_white);
-
-	if (error)
-	  goto do_error;
-
-	if (!word_length)
-	  {
-	    error = w_addword (pwordexp, NULL);
-
-	    if (error)
-	      return error;
-	  }
-
-	break;
-
-      case '\'':
-	++words_offset;
-	error = parse_squote (&word, &word_length, &max_length, words,
-			      &words_offset);
-
-	if (error)
-	  goto do_error;
-
-	if (!word_length)
-	  {
-	    error = w_addword (pwordexp, NULL);
-
-	    if (error)
-	      return error;
-	  }
-
-	break;
-
-      case '~':
-	error = parse_tilde (&word, &word_length, &max_length, words,
-			     &words_offset, pwordexp->we_wordc);
-
-	if (error)
-	  goto do_error;
-
-	break;
-
-      case '*':
-      case '[':
-      case '?':
-	error = parse_glob (&word, &word_length, &max_length, words,
-			    &words_offset, flags, pwordexp, ifs, ifs_white);
-
-	if (error)
-	  goto do_error;
-
-	break;
-
-      default:
-	/* Is it a word separator? */
-	if (strchr (" \t", words[words_offset]) == NULL)
-	  {
-	    char ch = words[words_offset];
-
-	    /* Not a word separator -- but is it a valid word char? */
-	    if (strchr ("\n|&;<>(){}", ch))
-	      {
-		/* Fail */
-		error = WRDE_BADCHAR;
-		goto do_error;
-	      }
-
-	    /* "Ordinary" character -- add it to word */
-	    word = w_addchar (word, &word_length, &max_length,
-			      ch);
-	    if (word == NULL)
-	      {
-		error = WRDE_NOSPACE;
-		goto do_error;
-	      }
-
-	    break;
-	  }
-
-	/* If a word has been delimited, add it to the list. */
-	if (word != NULL)
-	  {
-	    error = w_addword (pwordexp, word);
-	    if (error)
-	      goto do_error;
-	  }
-
-	word = w_newword (&word_length, &max_length);
-      }
-
-  /* End of string */
-
-  /* There was a word separator at the end */
-  if (word == NULL) /* i.e. w_newword */
-    return 0;
-
-  /* There was no field separator at the end */
-  return w_addword (pwordexp, word);
-
-do_error:
-  /* Error:
-   *	free memory used (unless error is WRDE_NOSPACE), and
-   *	set pwordexp members back to what they were.
-   */
-
-  if (word != NULL)
-    free (word);
-
-  if (error == WRDE_NOSPACE)
-    return WRDE_NOSPACE;
-
-  if ((flags & WRDE_APPEND) == 0)
-    wordfree (pwordexp);
-
-  *pwordexp = old_word;
-  return error;
-}
diff --git a/sysdeps/generic/write.c b/sysdeps/generic/write.c
deleted file mode 100644
index 928d43ced2..0000000000
--- a/sysdeps/generic/write.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stddef.h>
-
-/* Write NBYTES of BUF to FD.  Return the number written, or -1.  */
-ssize_t
-__libc_write (int fd, const void *buf, size_t nbytes)
-{
-  if (nbytes == 0)
-    return 0;
-  if (fd < 0)
-    {
-      __set_errno (EBADF);
-      return -1;
-    }
-  if (buf == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-libc_hidden_def (__libc_write)
-stub_warning (write)
-
-weak_alias (__libc_write, __write)
-libc_hidden_weak (__write)
-weak_alias (__libc_write, write)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/writev.c b/sysdeps/generic/writev.c
deleted file mode 100644
index d424c72143..0000000000
--- a/sysdeps/generic/writev.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1991,1995,1996,1997,1998,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/uio.h>
-
-/* Write data pointed by the buffers described by VECTOR, which
-   is a vector of COUNT `struct iovec's, to file descriptor FD.
-   The data is written in the order specified.
-   Operates just like `write' (see <unistd.h>) except that the data
-   are taken from VECTOR instead of a contiguous buffer.  */
-ssize_t
-__libc_writev (fd, vector, count)
-     int fd;
-     const struct iovec *vector;
-     int count;
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-strong_alias (__libc_writev, __writev)
-weak_alias (__libc_writev, writev)
-
-stub_warning (writev)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/xmknod.c b/sysdeps/generic/xmknod.c
deleted file mode 100644
index 57ed46060d..0000000000
--- a/sysdeps/generic/xmknod.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991,1993,1995,1996,1997,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* Create a device file named PATH, with permission and special bits MODE
-   and device number DEV (which can be constructed from major and minor
-   device numbers with the `makedev' macro above).  */
-int
-__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
-{
-  if (vers != _MKNOD_VER)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (__xmknod)
-
-weak_alias (__xmknod, _xmknod)
-libc_hidden_def (__xmknod)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/xpg-strerror.c b/sysdeps/generic/xpg-strerror.c
deleted file mode 100644
index 5cb56cdfb8..0000000000
--- a/sysdeps/generic/xpg-strerror.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <libintl.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/param.h>
-#include <stdio-common/_itoa.h>
-
-/* It is critical here that we always use the `dcgettext' function for
-   the message translation.  Since <libintl.h> only defines the macro
-   `dgettext' to use `dcgettext' for optimizing programs this is not
-   always guaranteed.  */
-#ifndef dgettext
-# include <locale.h>		/* We need LC_MESSAGES.  */
-# define dgettext(domainname, msgid) dcgettext (domainname, msgid, LC_MESSAGES)
-#endif
-
-/* Fill buf with a string describing the errno code in ERRNUM.  */
-int
-__xpg_strerror_r (int errnum, char *buf, size_t buflen)
-{
-  if (errnum < 0 || errnum >= _sys_nerr_internal
-      || _sys_errlist_internal[errnum] == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  const char *estr = (const char *) _(_sys_errlist_internal[errnum]);
-  size_t estrlen = strlen (estr) + 1;
-
-  if (buflen < estrlen)
-    {
-      __set_errno (ERANGE);
-      return -1;
-    }
-
-  memcpy (buf, estr, estrlen);
-  return 0;
-}
diff --git a/sysdeps/generic/xstat.c b/sysdeps/generic/xstat.c
deleted file mode 100644
index e7328cc10e..0000000000
--- a/sysdeps/generic/xstat.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <stddef.h>
-
-/* Get file information about FILE in BUF.  */
-int
-__xstat (int vers, const char *file, struct stat *buf)
-{
-  if (vers != _STAT_VER || file == NULL || buf == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-hidden_def (__xstat)
-stub_warning (stat)
-weak_alias (__xstat, _xstat)
-#include <stub-tag.h>
diff --git a/sysdeps/generic/xstat64.c b/sysdeps/generic/xstat64.c
deleted file mode 100644
index 2fb94cf331..0000000000
--- a/sysdeps/generic/xstat64.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <stddef.h>
-
-/* Get file information about FILE in BUF.  */
-int
-__xstat64 (int vers, const char *file, struct stat64 *buf)
-{
-  if (vers != _STAT_VER || file == NULL || buf == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  __set_errno (ENOSYS);
-  return -1;
-}
-hidden_def (__xstat64)
-stub_warning (stat64)
-#include <stub-tag.h>
diff --git a/sysdeps/gnu/Dist b/sysdeps/gnu/Dist
deleted file mode 100644
index 526c79b838..0000000000
--- a/sysdeps/gnu/Dist
+++ /dev/null
@@ -1,8 +0,0 @@
-errlist.awk
-errlist-compat.awk
-utmpx.h
-bits/utmpx.h
-netinet/tcp.h
-netinet/udp.h
-netinet/ip_icmp.h
-sys/mtio.h
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index a0b3e6e420..5b9a0a56ed 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996,1997,1998,1999,2001,2002,2003,2004
+# Copyright (C) 1996,1997,1998,1999,2001,2002,2003,2004,2005,2006
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -32,12 +32,13 @@ endif
 
 ifeq ($(subdir),stdio-common)
 
-vpath errlist.c $(full_config_sysdirs)
+errlist-c = $(firstword $(wildcard $(addsuffix /errlist.c,$(sysdirs) .)))
+
 ifeq ($(versioning),yes)
-$(objpfx)errlist-compat.c: errlist.c $(..)sysdeps/gnu/errlist-compat.awk \
+$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
 			   $(common-objpfx)Versions.v.i $(before-compile)
 else
-$(objpfx)errlist-compat.c: errlist.c $(..)sysdeps/gnu/errlist-compat.awk \
+$(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
 			   $(before-compile)
 endif
 	$(make-target-directory)
@@ -45,8 +46,7 @@ endif
 	  $(CC) -S $(CPPFLAGS) $(CFLAGS) -DNOT_IN_libc -DEMIT_ERR_MAX $< -o - \
 	  | sed -n 's/^.*@@@[^0-9]*\([0-9]*\)[^0-9]*@@@.*$$/\1/p'` \
 	       -f $(..)sysdeps/gnu/errlist-compat.awk \
-	       $(wildcard $(patsubst %,$(..)%/Versions,\
-		 $(config-sysdirs) $(add-ons))) > $@T
+	       $(wildcard $(sysdirs:=/Versions)) > $@T
 # Make it unwritable so noone will edit it by mistake.
 	-chmod a-w $@T
 	mv -f $@T $@
@@ -57,7 +57,8 @@ $(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c
 generated += errlist-compat.c errlist-compat.h
 
 # This will force the generation above to happy if need be.
-$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.h
+$(foreach o,$(object-suffixes) $(object-suffixes:=.d),\
+	  $(objpfx)errlist$o): $(objpfx)errlist-compat.h
 endif
 
 ifeq ($(subdir),login)
diff --git a/sysdeps/gnu/errlist-compat.awk b/sysdeps/gnu/errlist-compat.awk
index db827f3f70..ab67a18f64 100644
--- a/sysdeps/gnu/errlist-compat.awk
+++ b/sysdeps/gnu/errlist-compat.awk
@@ -35,7 +35,7 @@ $1 == "#errlist-compat" {
   # Don't process any further Versions files
   ARGC = ARGIND + 1;
   cnt = $2 + 0;
-  if (cnt < 100) {
+  if (cnt < 80) {
     print "*** this line seems bogus:", $0 > "/dev/stderr";
     exit 1;
   }
@@ -90,7 +90,7 @@ END {
     n = vcount[old];
     printf "#if SHLIB_COMPAT (libc, %s, %s)\n", old, new;
     printf "# include <bits/wordsize.h>\n";
-    printf "extern const char *const __sys_errlist_%s[];\n", old;
+    printf "extern const char *const __sys_errlist_%s[NERR];\n", old;
     printf "const int __sys_nerr_%s = %d;\n", old, n;
     printf "strong_alias (_sys_errlist_internal, __sys_errlist_%s)\n", old;
     printf "declare_symbol (__sys_errlist_%s, object, __WORDSIZE/8*%d)\n", \
@@ -99,7 +99,7 @@ END {
       old, old;
     printf "compat_symbol (libc, __sys_nerr_%s, sys_nerr, %s);\n", old, old;
 
-    printf "extern const char *const ___sys_errlist_%s[];\n", old;
+    printf "extern const char *const ___sys_errlist_%s[NERR];\n", old;
     printf "extern const int __sys_nerr_%s;\n", old;
     printf "strong_alias (__sys_errlist_%s, ___sys_errlist_%s)\n", old, old;
     printf "strong_alias (__sys_nerr_%s, ___sys_nerr_%s)\n", old, old;
@@ -110,10 +110,11 @@ END {
   }
 
   printf "\
-extern const char *const __sys_errlist_internal[];\n\
+extern const char *const __sys_errlist_internal[NERR];\n\
 extern const int __sys_nerr_internal;\n\
 strong_alias (_sys_errlist_internal, __sys_errlist_internal)\n\
 strong_alias (_sys_nerr_internal, __sys_nerr_internal)\n\
+extern const char *const sys_errlist[NERR];\n\
 versioned_symbol (libc, _sys_errlist_internal, sys_errlist, %s);\n\
 versioned_symbol (libc, __sys_errlist_internal, _sys_errlist, %s);\n\
 versioned_symbol (libc, _sys_nerr_internal, sys_nerr, %s);\n\
diff --git a/sysdeps/gnu/errlist.awk b/sysdeps/gnu/errlist.awk
index 3f074ed482..365ac817c7 100644
--- a/sysdeps/gnu/errlist.awk
+++ b/sysdeps/gnu/errlist.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999,2002,2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999,2002,2004,2005 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
@@ -106,8 +106,9 @@ errnoh == 4 \
 END {
   print "  };";
   print "";
-  print "const int _sys_nerr_internal";
-  print "  = sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0];";
+  print "#define NERR \\";
+  print "  (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])";
+  print "const int _sys_nerr_internal = NERR;"
   print "";
   print "#if !defined NOT_IN_libc && !ERRLIST_NO_COMPAT";
   print "# include <errlist-compat.c>";
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
index 9ae6ec3c1d..56da01756d 100644
--- a/sysdeps/gnu/errlist.c
+++ b/sysdeps/gnu/errlist.c
@@ -1408,10 +1408,59 @@ TRANS error; @pxref{Cancel AIO Operations}. */
 # define ERR_MAX EMEDIUMTYPE
 # endif
 #endif
+#ifdef ENOKEY
+/* */
+    [ERR_REMAP (ENOKEY)] = N_("Required key not available"),
+# if ENOKEY > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX ENOKEY
+# endif
+#endif
+#ifdef EKEYEXPIRED
+/* */
+    [ERR_REMAP (EKEYEXPIRED)] = N_("Key has expired"),
+# if EKEYEXPIRED > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX EKEYEXPIRED
+# endif
+#endif
+#ifdef EKEYREVOKED
+/* */
+    [ERR_REMAP (EKEYREVOKED)] = N_("Key has been revoked"),
+# if EKEYREVOKED > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX EKEYREVOKED
+# endif
+#endif
+#ifdef EKEYREJECTED
+/* */
+    [ERR_REMAP (EKEYREJECTED)] = N_("Key was rejected by service"),
+# if EKEYREJECTED > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX EKEYREJECTED
+# endif
+#endif
+#ifdef EOWNERDEAD
+/* */
+    [ERR_REMAP (EOWNERDEAD)] = N_("Owner died"),
+# if EOWNERDEAD > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX EOWNERDEAD
+# endif
+#endif
+#ifdef ENOTRECOVERABLE
+/* */
+    [ERR_REMAP (ENOTRECOVERABLE)] = N_("State not recoverable"),
+# if ENOTRECOVERABLE > ERR_MAX
+# undef ERR_MAX
+# define ERR_MAX ENOTRECOVERABLE
+# endif
+#endif
   };
 
-const int _sys_nerr_internal
-  = sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0];
+#define NERR \
+  (sizeof _sys_errlist_internal / sizeof _sys_errlist_internal [0])
+const int _sys_nerr_internal = NERR;
 
 #if !defined NOT_IN_libc && !ERRLIST_NO_COMPAT
 # include <errlist-compat.c>
diff --git a/sysdeps/gnu/glob64.c b/sysdeps/gnu/glob64.c
index 210c9c2553..d1e4e6f0d5 100644
--- a/sysdeps/gnu/glob64.c
+++ b/sysdeps/gnu/glob64.c
@@ -19,7 +19,7 @@
 
 #define COMPILE_GLOB64	1
 
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 
 libc_hidden_def (glob64)
 libc_hidden_def (globfree64)
diff --git a/sysdeps/gnu/net/if.h b/sysdeps/gnu/net/if.h
index b10245f455..ebb3e9f306 100644
--- a/sysdeps/gnu/net/if.h
+++ b/sysdeps/gnu/net/if.h
@@ -75,8 +75,10 @@ enum
 
     IFF_PORTSEL = 0x2000,	/* Can set media type.  */
 # define IFF_PORTSEL	IFF_PORTSEL
-    IFF_AUTOMEDIA = 0x4000	/* Auto media select active.  */
+    IFF_AUTOMEDIA = 0x4000,	/* Auto media select active.  */
 # define IFF_AUTOMEDIA	IFF_AUTOMEDIA
+    IFF_DYNAMIC = 0x8000	/* Dialup device with changing addresses.  */
+# define IFF_DYNAMIC	IFF_DYNAMIC
   };
 
 /* The ifaddr structure contains information about one address of an
diff --git a/sysdeps/gnu/updwtmp.c b/sysdeps/gnu/updwtmp.c
index 71a3003c96..e4f63088a9 100644
--- a/sysdeps/gnu/updwtmp.c
+++ b/sysdeps/gnu/updwtmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
 
@@ -27,4 +27,4 @@
        && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
       file_name))
 
-#include <sysdeps/generic/updwtmp.c>
+#include <login/updwtmp.c>
diff --git a/sysdeps/gnu/utmp_file.c b/sysdeps/gnu/utmp_file.c
index 2fc925017c..5ef6f306cd 100644
--- a/sysdeps/gnu/utmp_file.c
+++ b/sysdeps/gnu/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
 
@@ -27,4 +27,4 @@
        && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
       file_name))
 
-#include <sysdeps/generic/utmp_file.c>
+#include <login/utmp_file.c>
diff --git a/sysdeps/hppa/Dist b/sysdeps/hppa/Dist
deleted file mode 100644
index 5a0df47c68..0000000000
--- a/sysdeps/hppa/Dist
+++ /dev/null
@@ -1,5 +0,0 @@
-libgcc-compat.c
-dl-symaddr.c
-dl-fptr.c
-bits/link.h
-elf/entry.h
diff --git a/sysdeps/hppa/Makefile b/sysdeps/hppa/Makefile
deleted file mode 100644
index 73947031dc..0000000000
--- a/sysdeps/hppa/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2000, 2001 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-# Contributed by David Huggins-Daines (dhd@debian.org)
-
-# 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, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-# We used to need this since the build process uses ld -r.  Now we use
-# ld -r --unique=.text* which does more or less the same thing, but better.
-# CFLAGS-.os += -ffunction-sections
-LDFLAGS-c_pic.os += -Wl,--unique=.text*
-
-ifeq ($(subdir),elf)
-CFLAGS-rtld.c += -mdisable-fpregs
-sysdep-dl-routines += dl-symaddr dl-fptr
-sysdep_routines += $(sysdep-dl-routines)
-sysdep-rtld-routines += $(sysdep-dl-routines)
-endif
-
-ifeq ($(subdir),csu)
-ifeq (yes,$(build-shared))
-# Compatibility
-ifeq (yes,$(have-protected))
-CPPFLAGS-libgcc-compat.c = -DHAVE_DOT_HIDDEN
-endif
-sysdep_routines += libgcc-compat
-shared-only-routines += libgcc-compat
-endif
-endif
diff --git a/sysdeps/hppa/Versions b/sysdeps/hppa/Versions
deleted file mode 100644
index 2ae3cbdf17..0000000000
--- a/sysdeps/hppa/Versions
+++ /dev/null
@@ -1,12 +0,0 @@
-ld {
-  GLIBC_PRIVATE {
-    # hppa specific functions in the dynamic linker, but used by libc.so.
-    _dl_symbol_address; _dl_unmap; _dl_lookup_address;
-    _dl_function_address;
-  }
-}
-libc {
-  GLIBC_2.2 {
-    __clz_tab;
-  }
-}
diff --git a/sysdeps/hppa/__longjmp.S b/sysdeps/hppa/__longjmp.S
deleted file mode 100644
index dee4d9f7b5..0000000000
--- a/sysdeps/hppa/__longjmp.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/* longjmp for PA-RISC.
-   Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
-
-/* __longjmp(jmpbuf, val) */
-
-	.text
-	.align 4
-	.globl __longjmp
-	.export __longjmp, code
-	.proc
-	.callinfo
-__longjmp:	
-	/* set return value */
-	copy	%r25, %r28
-	
-	ldw	0(%r26), %r3
-	ldw	8(%r26), %r4
-	ldw	12(%r26), %r5
-	ldw	16(%r26), %r6
-	ldw	20(%r26), %r7
-	ldw	24(%r26), %r8
-	ldw	28(%r26), %r9
-	ldw	32(%r26), %r10
-	ldw	36(%r26), %r11
-	ldw	40(%r26), %r12
-	ldw	44(%r26), %r13
-	ldw	48(%r26), %r14
-	ldw	52(%r26), %r15
-	ldw	56(%r26), %r16
-	ldw	60(%r26), %r17
-	ldw	64(%r26), %r18
-	ldw	68(%r26), %r19
-	ldw	72(%r26), %r27
-	ldw	76(%r26), %r30
-	
-	ldw	80(%r26), %rp
-
-	ldo	88(%r26),%r20
-	fldds,ma 8(%r20), %fr12
-	fldds,ma 8(%r20), %fr13
-	fldds,ma 8(%r20), %fr14
-	fldds,ma 8(%r20), %fr15
-	fldds,ma 8(%r20), %fr16
-	fldds,ma 8(%r20), %fr17
-	fldds,ma 8(%r20), %fr18
-	fldds,ma 8(%r20), %fr19
-	fldds,ma 8(%r20), %fr20
-	fldds	 0(%r20), %fr21
-
-	bv,n	%r0(%r2)
-	.procend
diff --git a/sysdeps/hppa/abort-instr.h b/sysdeps/hppa/abort-instr.h
deleted file mode 100644
index f1afea46de..0000000000
--- a/sysdeps/hppa/abort-instr.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* An instruction privileged instruction to crash a userspace program.
-
-   We go with iitlbp because it has a history of being used to crash
-   programs.  */
-
-#define ABORT_INSTRUCTION asm ("iitlbp %r0,(%r0)")
diff --git a/sysdeps/hppa/add_n.s b/sysdeps/hppa/add_n.s
deleted file mode 100644
index aaabd72e20..0000000000
--- a/sysdeps/hppa/add_n.s
+++ /dev/null
@@ -1,58 +0,0 @@
-;! HP-PA  __mpn_add_n -- Add two limb vectors of the same length > 0 and store
-;! sum in a third limb vector.
-
-;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! res_ptr	gr26
-;! s1_ptr	gr25
-;! s2_ptr	gr24
-;! size		gr23
-
-;! One might want to unroll this as for other processors, but it turns
-;! out that the data cache contention after a store makes such
-;! unrolling useless.  We can't come under 5 cycles/limb anyway.
-
-	.text
-	.export		__mpn_add_n
-__mpn_add_n:
-	.proc
-	.callinfo	frame=0,no_calls
-	.entry
-
-	ldws,ma		4(0,%r25),%r21
-	ldws,ma		4(0,%r24),%r20
-
-	addib,=		-1,%r23,L$end	;! check for (SIZE == 1)
-	 add		%r21,%r20,%r28	;! add first limbs ignoring cy
-
-L$loop:	ldws,ma		4(0,%r25),%r21
-	ldws,ma		4(0,%r24),%r20
-	stws,ma		%r28,4(0,%r26)
-	addib,<>	-1,%r23,L$loop
-	 addc		%r21,%r20,%r28
-
-L$end:	stws		%r28,0(0,%r26)
-	bv		0(%r2)
-	 addc		%r0,%r0,%r28
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/bits/endian.h b/sysdeps/hppa/bits/endian.h
deleted file mode 100644
index 585db0c0fa..0000000000
--- a/sysdeps/hppa/bits/endian.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* hppa1.1 big-endian.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/sysdeps/hppa/bits/link.h b/sysdeps/hppa/bits/link.h
deleted file mode 100644
index 54842b2299..0000000000
--- a/sysdeps/hppa/bits/link.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Used to store the function descriptor table */
-struct link_map_machine
-  {
-    size_t fptr_table_len;
-    ElfW(Addr) *fptr_table;
-  };
diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h
deleted file mode 100644
index 7fb2af77d0..0000000000
--- a/sysdeps/hppa/bits/setjmp.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Define the machine-dependent type `jmp_buf'.  HPPA version.  */
-
-#ifndef _SETJMP_H
-# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-#endif
-
-/* The previous bits/setjmp.h had __jmp_buf defined as a structure.
-   We use an array of 'double' instead, to make writing the assembler
-   easier, and to ensure proper alignment. Naturally, user code should
-   not depend on either representation. */
-
-#if defined __USE_MISC || defined _ASM
-#define JB_SP (76/4)
-#endif
-
-#ifndef	_ASM
-typedef double __jmp_buf[21];
-#endif
-
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
-   variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address)				\
-     ((void *)(_address) > (void *)(((unsigned long *) _jmpbuf)[JB_SP]))
diff --git a/sysdeps/hppa/bsd-_setjmp.S b/sysdeps/hppa/bsd-_setjmp.S
deleted file mode 100644
index e5ec94c122..0000000000
--- a/sysdeps/hppa/bsd-_setjmp.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  HPPA version.
-   Copyright (C) 2001, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-	.text
-	.align 4
-	.globl _setjmp
-	.export _setjmp, code
-	.level 2.0
-	.proc
-	.callinfo
-	.import __sigsetjmp
-_setjmp:
-	b	__sigsetjmp
-	ldi	0, %r25
-
-	.procend
-libc_hidden_def (_setjmp)
diff --git a/sysdeps/hppa/bsd-setjmp.S b/sysdeps/hppa/bsd-setjmp.S
deleted file mode 100644
index 04ddba4652..0000000000
--- a/sysdeps/hppa/bsd-setjmp.S
+++ /dev/null
@@ -1,36 +0,0 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  HPPA version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-	.text
-	.align 4
-	.globl setjmp
-	.export setjmp, code
-	.level 2.0
-	.proc
-	.callinfo
-	.import __sigsetjmp
-setjmp:
-	b	__sigsetjmp
-	ldi	1, %r25
-
-	.procend
diff --git a/sysdeps/hppa/configure b/sysdeps/hppa/configure
deleted file mode 100755
index 07bde0e0ee..0000000000
--- a/sysdeps/hppa/configure
+++ /dev/null
@@ -1,34 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
-
-hppa*linux*)
-echo "$as_me:$LINENO: checking for assembler line separator" >&5
-echo $ECHO_N "checking for assembler line separator... $ECHO_C" >&6
-if test "${libc_cv_asm_line_sep+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat > conftest.s <<EOF
-nop ; is_old_puffin
-EOF
-if { ac_try='${CC-cc} -c $ASFLAGS conftest.s 1>&5'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  libc_cv_asm_line_sep='!'
-else
-  if test -z "$enable_hacker_mode"; then
-    echo "*** You need a newer assembler to compile glibc"
-    rm -f conftest*
-    exit 1
-  fi
-  libc_cv_asm_line_sep=';'
-fi
-rm -f conftest*
-fi
-echo "$as_me:$LINENO: result: $libc_cv_asm_line_sep" >&5
-echo "${ECHO_T}$libc_cv_asm_line_sep" >&6
-cat >>confdefs.h <<_ACEOF
-#define ASM_LINE_SEP $libc_cv_asm_line_sep
-_ACEOF
-
diff --git a/sysdeps/hppa/configure.in b/sysdeps/hppa/configure.in
deleted file mode 100644
index 1ec6780835..0000000000
--- a/sysdeps/hppa/configure.in
+++ /dev/null
@@ -1,22 +0,0 @@
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-
-dnl The standard hppa assembler uses `;' to start comments and `!'
-dnl as a line separator.
-hppa*linux*)
-AC_CACHE_CHECK(for assembler line separator,
-	       libc_cv_asm_line_sep, [dnl
-cat > conftest.s <<EOF
-nop ; is_old_puffin
-EOF
-if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
-  libc_cv_asm_line_sep='!'
-else
-  if test -z "$enable_hacker_mode"; then
-    echo "*** You need a newer assembler to compile glibc"
-    rm -f conftest*
-    exit 1
-  fi
-  libc_cv_asm_line_sep=';'
-fi
-rm -f conftest*])
-AC_DEFINE_UNQUOTED(ASM_LINE_SEP, $libc_cv_asm_line_sep)
diff --git a/sysdeps/hppa/dl-fptr.h b/sysdeps/hppa/dl-fptr.h
deleted file mode 100644
index 2ac9740e30..0000000000
--- a/sysdeps/hppa/dl-fptr.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Function descriptors.  HPPA version.
-   Copyright (C) 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef dl_hppa_fptr_h
-#define dl_hppa_fptr_h 1
-
-#include <sysdeps/generic/dl-fptr.h>
-
-/* There are currently 20 dynamic symbols in ld.so.
-   ELF_MACHINE_BOOT_FPTR_TABLE_LEN needs to be at least that big.  */
-#define ELF_MACHINE_BOOT_FPTR_TABLE_LEN	200
-
-#define ELF_MACHINE_LOAD_ADDRESS(var, symbol)		\
-  asm ("	addil LT%%" #symbol ", %%r19\n"		\
-       "	ldw RT%%" #symbol "(%%sr0,%%r1), %0\n"	\
-      : "=&r" (var));
-
-
-#endif /* !dl_hppa_fptr_h */
diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h
deleted file mode 100644
index d393b3e427..0000000000
--- a/sysdeps/hppa/dl-lookupcfg.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Configuration of lookup functions.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Like IA-64, PA-RISC needs more information from the symbol lookup
-   function than just the address. */
-#define DL_LOOKUP_RETURNS_MAP
-#define ELF_FUNCTION_PTR_IS_SPECIAL
-#define DL_UNMAP_IS_SPECIAL
-
-/* Forward declaration.  */
-struct link_map;
-
-void *_dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref);
-
-#define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
-
-Elf32_Addr _dl_lookup_address (const void *address);
-
-/* Clear the bottom two bits so generic code can find the fdesc entry */
-#define DL_LOOKUP_ADDRESS(addr) \
-  (_dl_lookup_address ((void *)((unsigned long)addr & ~3)))
-
-void _dl_unmap (struct link_map *map);
-
-#define DL_UNMAP(map) _dl_unmap (map)
-
-#define DL_AUTO_FUNCTION_ADDRESS(map, addr)				\
-({									\
-  unsigned int fptr[2];							\
-  fptr[0] = (unsigned int) (addr);					\
-  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;			\
-  /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */	\
-  (ElfW(Addr))((unsigned int)fptr | 2);					\
-})
-
-#define DL_STATIC_FUNCTION_ADDRESS(map, addr)				\
-({									\
-  static unsigned int fptr[2];						\
-  fptr[0] = (unsigned int) (addr);					\
-  fptr[1] = (map)->l_info[DT_PLTGOT]->d_un.d_ptr;			\
-  /* Set bit 30 to indicate to $$dyncall that this is a PLABEL. */	\
-  (ElfW(Addr))((unsigned int)fptr | 2);					\
-})
-
-
-/* The test for "addr & 2" below is to accomodate old binaries which
-   violated the ELF ABI by pointing DT_INIT and DT_FINI at a function
-   descriptor.  */
-#define DL_DT_INIT_ADDRESS(map, addr) \
-  ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
-#define DL_DT_FINI_ADDRESS(map, addr) \
-  ((Elf32_Addr)(addr) & 2 ? (addr) : DL_AUTO_FUNCTION_ADDRESS (map, addr))
-
diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h
deleted file mode 100644
index d29501d306..0000000000
--- a/sysdeps/hppa/dl-machine.h
+++ /dev/null
@@ -1,762 +0,0 @@
-/* Machine-dependent ELF dynamic relocation inline functions.  PA-RISC version.
-   Copyright (C) 1995-1997,1999-2003
-	Free Software Foundation, Inc.
-   Contributed by David Huggins-Daines <dhd@debian.org>
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef dl_machine_h
-#define dl_machine_h 1
-
-#define ELF_MACHINE_NAME "hppa"
-
-#include <sys/param.h>
-#include <assert.h>
-#include <string.h>
-#include <link.h>
-#include <errno.h>
-#include <dl-fptr.h>
-#include <abort-instr.h>
-
-# define VALID_ELF_OSABI(osabi)		((osabi == ELFOSABI_SYSV) || (osabi == ELFOSABI_LINUX))
-# define VALID_ELF_ABIVERSION(ver)	(ver == 0)
-# define VALID_ELF_HEADER(hdr,exp,size) \
-  memcmp (hdr,exp,size-2) == 0 \
-  && VALID_ELF_OSABI (hdr[EI_OSABI]) \
-  && VALID_ELF_ABIVERSION (hdr[EI_ABIVERSION])
-
-/* These two definitions must match the definition of the stub in 
-   bfd/elf32-hppa.c (see plt_stub[]).
-   
-   a. Define the size of the *entire* stub we place at the end of the PLT
-   table (right up against the GOT).
-   
-   b. Define the number of bytes back from the GOT to the entry point of
-   the PLT stub. You see the PLT stub must be entered in the middle
-   so it can depwi to find it's own address (long jump stub) 
-   
-   c. Define the size of a single PLT entry so we can jump over the
-   last entry to get the stub address */
-	
-#define SIZEOF_PLT_STUB (7*4)
-#define GOT_FROM_PLT_STUB (4*4)
-#define PLT_ENTRY_SIZE (2*4)
-
-/* Initialize the function descriptor table before relocations */
-static inline void
-__hppa_init_bootstrap_fdesc_table (struct link_map *map)
-{
-  ElfW(Addr) *boot_table;
-
-  /* Careful: this will be called before got has been relocated... */
-  ELF_MACHINE_LOAD_ADDRESS(boot_table,_dl_boot_fptr_table);
-
-  map->l_mach.fptr_table_len = ELF_MACHINE_BOOT_FPTR_TABLE_LEN;
-  map->l_mach.fptr_table = boot_table;
-}
-
-#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info)		\
-	__hppa_init_bootstrap_fdesc_table (&bootstrap_map);
-
-/* Return nonzero iff ELF header is compatible with the running host.  */
-static inline int
-elf_machine_matches_host (const Elf32_Ehdr *ehdr)
-{
-  return ehdr->e_machine == EM_PARISC;
-}
-
-/* Return the link-time address of _DYNAMIC.  */
-static inline Elf32_Addr
-elf_machine_dynamic (void) __attribute__ ((const));
-
-static inline Elf32_Addr
-elf_machine_dynamic (void)
-{
-  Elf32_Addr dynamic;
-
-  asm ("b,l	1f,%0\n"
-"	depi	0,31,2,%0\n"
-"1:	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 8),%0\n"
-"	ldw	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 12)(%%r1),%0\n"
-       : "=r" (dynamic) : : "r1");
-
-  return dynamic;
-}
-
-/* Return the run-time load address of the shared object.  */
-static inline Elf32_Addr
-elf_machine_load_address (void) __attribute__ ((const));
-
-static inline Elf32_Addr
-elf_machine_load_address (void)
-{
-  Elf32_Addr dynamic;
-
-  asm (
-"	b,l	1f,%0\n"
-"	depi	0,31,2,%0\n"
-"1:	addil	L'_DYNAMIC - ($PIC_pcrel$0 - 8),%0\n"
-"	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%%r1),%0\n"
-   : "=r" (dynamic) : : "r1");
-
-  return dynamic - elf_machine_dynamic ();
-}
-
-/* Fixup a PLT entry to bounce directly to the function at VALUE.  
-   Optimized non-profile version. */
-static inline Elf32_Addr
-elf_machine_fixup_plt (struct link_map *map, lookup_t t,
-		       const Elf32_Rela *reloc,
-		       Elf32_Addr *reloc_addr, Elf32_Addr value)
-{
-  /* map is the link_map for the caller, t is the link_map for the object
-     being called */
-  reloc_addr[1] = D_PTR (t, l_info[DT_PLTGOT]);
-  reloc_addr[0] = value;
-  /* Return the PLT slot rather than the function value so that the
-     trampoline can load the new LTP. */
-  return (Elf32_Addr) reloc_addr;
-}
-
-/* Fixup a PLT entry to bounce directly to the function at VALUE.  */
-#define ELF_MACHINE_PROFILE_FIXUP_PLT elf_machine_profile_fixup_plt
-static inline Elf32_Addr
-elf_machine_profile_fixup_plt (struct link_map *map, lookup_t t,
-		       const Elf32_Rela *reloc,
-		       Elf32_Addr *reloc_addr, Elf32_Addr value)
-{
-  if(__builtin_expect (t == NULL, 1)) 
-    return (Elf32_Addr) reloc_addr;
-  /* Return the PLT slot rather than the function value so that the
-     trampoline can load the new LTP. */
-  return (Elf32_Addr) elf_machine_fixup_plt(map, t, reloc, reloc_addr, value);
-}
-
-/* Return the final value of a plt relocation.  */
-static inline Elf32_Addr
-elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
-		       Elf32_Addr value)
-{
-  /* We are rela only */
-  return value + reloc->r_addend;
-}
-
-/* Set up the loaded object described by L so its unrelocated PLT
-   entries will jump to the on-demand fixup code in dl-runtime.c.  */
-
-static inline int
-elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
-{
-  Elf32_Addr *got = NULL;
-  Elf32_Addr l_addr, iplt, jmprel, end_jmprel, r_type, r_sym;
-  const Elf32_Rela *reloc;
-  struct fdesc *fptr;
-  static union {
-    unsigned char c[8];
-    Elf32_Addr i[2];
-  } sig = {{0x00,0xc0,0xff,0xee, 0xde,0xad,0xbe,0xef}};
-		
-  /* If we don't have a PLT we can just skip all this... */
-  if (__builtin_expect (l->l_info[DT_JMPREL] == NULL,0))
-    return lazy;
-  
-  /* All paths use these values */ 
-  l_addr = l->l_addr;
-  jmprel = D_PTR(l, l_info[DT_JMPREL]);
-  end_jmprel = jmprel + l->l_info[DT_PLTRELSZ]->d_un.d_val;
-  
-  extern void _dl_runtime_resolve (void);
-  extern void _dl_runtime_profile (void);
-  
-  /* Linking lazily */
-  if (lazy)
-    {
-      /* FIXME: Search for the got, but backwards through the relocs, technically we should
-         find it on the first try. However, assuming the relocs got out of order the 
-         routine is made a bit more robust by searching them all in case of failure. */
-      for (iplt = (end_jmprel - sizeof(Elf32_Rela)); iplt >= jmprel; iplt -= sizeof (Elf32_Rela))
-        {
-	      
-	  reloc = (const Elf32_Rela *) iplt;
-          r_type = ELF32_R_TYPE (reloc->r_info);
-          r_sym = ELF32_R_SYM (reloc->r_info);
-
-          got = (Elf32_Addr *) (reloc->r_offset + l_addr + PLT_ENTRY_SIZE + SIZEOF_PLT_STUB);
-
-          /* If we aren't an IPLT, and we aren't NONE then it's a bad reloc */
-          if (__builtin_expect (r_type != R_PARISC_IPLT, 0))
-	    {
-	      if (__builtin_expect (r_type != R_PARISC_NONE, 0))
-	        _dl_reloc_bad_type (l, r_type, 1);
-	      continue;
-	    }
-	
-          /* Check for the plt_stub that binutils placed here for us 
-             to use with _dl_runtime_resolve  */
-          if (got[-2] != sig.i[0] || got[-1] != sig.i[1])
-            {
-              got = NULL; /* Not the stub... keep looking */
-            } 
-          else 
-	    {
-              /* Found the GOT! */       	
-              register Elf32_Addr ltp __asm__ ("%r19");
-              /* Identify this shared object. */
-              got[1] = (Elf32_Addr) l;
-
-              /* This function will be called to perform the relocation. */
-              if (__builtin_expect (!profile, 1))
-                {
-                  /* If a static application called us, then _dl_runtime_resolve is not
-		     a function descriptor, but the *real* address of the function... */
-		  if((unsigned long) &_dl_runtime_resolve & 3)
-		    {
-                      got[-2] = (Elf32_Addr) ((struct fdesc *) 
-                                  ((unsigned long) &_dl_runtime_resolve & ~3))->ip;
-		    }
-		  else
-		    {
-		      /* Static executable! */
-                      got[-2] = (Elf32_Addr) &_dl_runtime_resolve;
-		    }
-                }
-              else
-	        {
-	          if (_dl_name_match_p (GLRO(dl_profile), l))
-	            {
-		      /* This is the object we are looking for.  Say that
-		         we really want profiling and the timers are
-		         started.  */
-                      GL(dl_profile_map) = l;
-                    }
-
-		  if((unsigned long) &_dl_runtime_resolve & 3)
-		    {
-                      got[-2] = (Elf32_Addr) ((struct fdesc *)
-                                  ((unsigned long) &_dl_runtime_profile & ~3))->ip;
-		    }
-		  else
-		    {
-		      /* Static executable */
-                      got[-2] = (Elf32_Addr) &_dl_runtime_profile;
-		    }
-                }
-              /* Plunk in the gp of this function descriptor so we 
-	         can make the call to _dl_runtime_xxxxxx */
-              got[-1] = ltp;
-              break;
-              /* Done looking for the GOT, and stub is setup */
-            } /* else we found the GOT */
-        } /* for, walk the relocs backwards */
-
-      if(!got) 
-        return 0; /* No lazy linking for you! */
-  
-      /* Process all the relocs, now that we know the GOT... */    
-      for (iplt = jmprel; iplt < end_jmprel; iplt += sizeof (Elf32_Rela))
-	{
-	  reloc = (const Elf32_Rela *) iplt;
-	  r_type = ELF32_R_TYPE (reloc->r_info);
-	  r_sym = ELF32_R_SYM (reloc->r_info);
-
-	  if (__builtin_expect (r_type == R_PARISC_IPLT, 1))
-	    {
-	      fptr = (struct fdesc *) (reloc->r_offset + l_addr);
-	      if (r_sym != 0)
-		{
-		  /* Relocate the pointer to the stub.  */
-		  fptr->ip = (Elf32_Addr) got - GOT_FROM_PLT_STUB;
-
-		  /* Instead of the LTP value, we put the reloc offset
-		     here.  The trampoline code will load the proper
-		     LTP and pass the reloc offset to the fixup
-		     function.  */
-		  fptr->gp = iplt - jmprel;
-		} /* r_sym != 0 */
-	      else
-		{
-		  /* Relocate this *ABS* entry.  */
-		  fptr->ip = reloc->r_addend + l_addr;
-		  fptr->gp = D_PTR (l, l_info[DT_PLTGOT]);
-		}
-	    } /* r_type == R_PARISC_IPLT */
-	} /* for all the relocations */ 
-    } /* if lazy */
-  else
-    {
-      for (iplt = jmprel; iplt < end_jmprel; iplt += sizeof (Elf32_Rela))
-        {
-          reloc = (const Elf32_Rela *) iplt;
-          r_type = ELF32_R_TYPE (reloc->r_info);
-          r_sym = ELF32_R_SYM (reloc->r_info);
-
-          if (__builtin_expect ((r_type == R_PARISC_IPLT) && (r_sym == 0), 1))
-            {
-              fptr = (struct fdesc *) (reloc->r_offset + l_addr);
-              /* Relocate this *ABS* entry, set only the gp, the rest is set later
-                 when elf_machine_rela_relative is called (WITHOUT the linkmap)  */
-              fptr->gp = D_PTR (l, l_info[DT_PLTGOT]);
-            } /* r_type == R_PARISC_IPLT */
-        } /* for all the relocations */ 
-    }	  
-  return lazy;
-}
-
-/* Initial entry point code for the dynamic linker.
-   The C function `_dl_start' is the real entry point;
-   its return value is the user program's entry point.  */
-
-#define RTLD_START \
-/* Set up dp for any non-PIC lib constructors that may be called.  */	\
-static struct link_map * __attribute__((used))				\
-set_dp (struct link_map *map)						\
-{									\
-  register Elf32_Addr dp asm ("%r27");					\
-  dp = D_PTR (map, l_info[DT_PLTGOT]);					\
-  asm volatile ("" : : "r" (dp));					\
-  return map;								\
-}									\
-									\
-asm (									\
-"	.text\n"							\
-"	.globl _start\n"						\
-"	.type _start,@function\n"					\
-"_start:\n"								\
-	/* The kernel does not give us an initial stack frame. */	\
-"	ldo	64(%sp),%sp\n"						\
-	/* Save the relevant arguments (yes, those are the correct	\
-	   registers, the kernel is weird) in their stack slots. */	\
-"	stw	%r25,-40(%sp)\n" /* argc */				\
-"	stw	%r24,-44(%sp)\n" /* argv */				\
-									\
-	/* We need the LTP, and we need it now.				\
-	   $PIC_pcrel$0 points 8 bytes past the current instruction,	\
-	   just like a branch reloc.  This sequence gets us the		\
-	   runtime address of _DYNAMIC. */				\
-"	bl	0f,%r19\n"						\
-"	depi	0,31,2,%r19\n"	/* clear priviledge bits */		\
-"0:	addil	L'_DYNAMIC - ($PIC_pcrel$0 - 8),%r19\n"			\
-"	ldo	R'_DYNAMIC - ($PIC_pcrel$0 - 12)(%r1),%r26\n"		\
-									\
-	/* The link time address is stored in the first entry of the	\
-	   GOT.  */							\
-"	addil	L'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 16),%r19\n"	\
-"	ldw	R'_GLOBAL_OFFSET_TABLE_ - ($PIC_pcrel$0 - 20)(%r1),%r20\n" \
-									\
-"	sub	%r26,%r20,%r20\n"	/* Calculate load offset */	\
-									\
-	/* Rummage through the dynamic entries, looking for		\
-	   DT_PLTGOT.  */						\
-"	ldw,ma	8(%r26),%r19\n"						\
-"1:	cmpib,=,n 3,%r19,2f\n"	/* tag == DT_PLTGOT? */			\
-"	cmpib,<>,n 0,%r19,1b\n"						\
-"	ldw,ma	8(%r26),%r19\n"						\
-									\
-	/* Uh oh!  We didn't find one.  Abort. */			\
-"	iitlbp	%r0,(%r0)\n"						\
-									\
-"2:	ldw	-4(%r26),%r19\n"	/* Found it, load value. */	\
-"	add	%r19,%r20,%r19\n"	/* And add the load offset. */	\
-									\
-	/* Our initial stack layout is rather different from everyone	\
-	   else's due to the unique PA-RISC ABI.  As far as I know it	\
-	   looks like this:						\
-									\
-	   -----------------------------------  (this frame created above) \
-	   |         32 bytes of magic       |				\
-	   |---------------------------------|				\
-	   | 32 bytes argument/sp save area  |				\
-	   |---------------------------------|  ((current->mm->env_end)	\
-	   |         N bytes of slack        |	 + 63 & ~63)		\
-	   |---------------------------------|				\
-	   |      envvar and arg strings     |				\
-	   |---------------------------------|				\
-	   |	    ELF auxiliary info	     |				\
-	   |         (up to 28 words)        |				\
-	   |---------------------------------|				\
-	   |  Environment variable pointers  |				\
-	   |         upwards to NULL	     |				\
-	   |---------------------------------|				\
-	   |        Argument pointers        |				\
-	   |         upwards to NULL	     |				\
-	   |---------------------------------|				\
-	   |          argc (1 word)          |				\
-	   -----------------------------------				\
-									\
-	  So, obviously, we can't just pass %sp to _dl_start.  That's	\
-	  okay, argv-4 will do just fine.				\
-									\
-	  The pleasant part of this is that if we need to skip		\
-	  arguments we can just decrement argc and move argv, because	\
-	  the stack pointer is utterly unrelated to the location of	\
-	  the environment and argument vectors. */			\
-									\
-	/* This is always within range so we'll be okay. */		\
-"	bl	_dl_start,%rp\n"					\
-"	ldo	-4(%r24),%r26\n"					\
-									\
-"	.globl _dl_start_user\n"					\
-"	.type _dl_start_user,@function\n"				\
-"_dl_start_user:\n"							\
-	/* Save the entry point in %r3. */				\
-"	copy	%ret0,%r3\n"						\
-									\
-	/* Remember the lowest stack address. */			\
-"	addil	LT'__libc_stack_end,%r19\n"				\
-"	ldw	RT'__libc_stack_end(%r1),%r20\n"			\
-"	stw	%sp,0(%r20)\n"						\
-									\
-	/* See if we were called as a command with the executable file	\
-	   name as an extra leading argument. */			\
-"	addil	LT'_dl_skip_args,%r19\n"				\
-"	ldw	RT'_dl_skip_args(%r1),%r20\n"				\
-"	ldw	0(%r20),%r20\n"						\
-									\
-"	ldw	-40(%sp),%r25\n"	/* argc */			\
-"	comib,=	0,%r20,.Lnofix\n"	/* FIXME: Mispredicted branch */\
-"	ldw	-44(%sp),%r24\n"	/* argv (delay slot) */		\
-									\
-"	sub	%r25,%r20,%r25\n"					\
-"	stw	%r25,-40(%sp)\n"					\
-"	sh2add	%r20,%r24,%r24\n"					\
-"	stw	%r24,-44(%sp)\n"					\
-									\
-".Lnofix:\n"								\
-"	addil	LT'_rtld_local,%r19\n"					\
-"	ldw	RT'_rtld_local(%r1),%r26\n"				\
-"	bl	set_dp, %r2\n"						\
-"	ldw	0(%r26),%r26\n"						\
-									\
-	/* Call _dl_init(_dl_loaded, argc, argv, envp). */		\
-"	copy	%r28,%r26\n"						\
-									\
-	/* envp = argv + argc + 1 */					\
-"	sh2add	%r25,%r24,%r23\n"					\
-"	bl	_dl_init_internal,%r2\n"				\
-"	ldo	4(%r23),%r23\n"	/* delay slot */			\
-									\
-	/* Reload argc, argv to the registers start.S expects.  */	\
-"	ldw	-40(%sp),%r25\n"					\
-"	ldw	-44(%sp),%r24\n"					\
-									\
-	/* _dl_fini does have a PLT slot now.  I don't know how to get	\
-	   to it though, so this hack will remain. */			\
-"	.section .data\n"						\
-"__dl_fini_plabel:\n"							\
-"	.word	_dl_fini\n"						\
-"	.word	0xdeadbeef\n"						\
-"	.previous\n"							\
-									\
-	/* %r3 contains a function pointer, we need to mask out the	\
-	   lower bits and load the gp and jump address. */		\
-"	depi	0,31,2,%r3\n"						\
-"	ldw	0(%r3),%r2\n"						\
-"	addil	LT'__dl_fini_plabel,%r19\n"				\
-"	ldw	RT'__dl_fini_plabel(%r1),%r23\n"			\
-"	stw	%r19,4(%r23)\n"						\
-"	ldw	4(%r3),%r19\n"	/* load the object's gp */		\
-"	bv	%r0(%r2)\n"						\
-"	depi	2,31,2,%r23\n"	/* delay slot */			\
-	);
-
-
-/* This code gets called via the .plt stub, and is used in
-   dl-runtime.c to call the `fixup' function and then redirect to the
-   address it returns.
-   
-   WARNING: This template is also used by gcc's __cffc, and expects
-   that the "bl" for fixup() exist at a particular offset.
-   Do not change this template without changing gcc, while the prefix
-   "bl" should fix everything so gcc finds the right spot, it will
-   slow down __cffc when it attempts to call fixup to resolve function
-   descriptor references. Please refer to gcc/gcc/config/pa/fptr.c
-   
-   Enter with r19 = reloc offset, r20 = got-8, r21 = fixup ltp.  */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) 			\
-  extern void tramp_name (void);		    			\
-  asm (									\
- "	.text\n"							\
- 	/* FAKE bl to provide gcc's __cffc with fixup's address */	\
- "	bl	" #fixup_name ",%r2\n" /* Runtime address of fixup */	\
- "	.globl " #tramp_name "\n"					\
- "	.type " #tramp_name ",@function\n"				\
-  #tramp_name ":\n"							\
- "	.proc\n"							\
- "	.callinfo frame=64,calls,save_rp\n"				\
- "	.entry\n"							\
- 	/* Save return pointer */					\
- "	stw	%r2,-20(%sp)\n"						\
- 	/* Save argument registers in the call stack frame. */		\
- "	stw	%r26,-36(%sp)\n"					\
- "	stw	%r25,-40(%sp)\n"					\
- "	stw	%r24,-44(%sp)\n"					\
- "	stw	%r23,-48(%sp)\n"					\
- 	/* Build a call frame, and save structure pointer. */		\
- "	stwm	%r28,64(%sp)\n"						\
- 									\
- 	/* Set up args to fixup func.  */				\
- "	ldw	8+4(%r20),%r26\n" /* (1) got[1] == struct link_map */	\
- "	copy	%r19,%r25\n"	  /* (2) reloc offset  */		\
- "	copy    %r2,%r24\n"	  /* (3) profile_fixup needs rp */	\
- 									\
- 	/* Call the real address resolver. */				\
- "	bl	" #fixup_name ",%r2\n"					\
- "	copy	%r21,%r19\n"	  /* set fixup func ltp (DELAY SLOT)*/	\
- 									\
- "	ldw	0(%r28),%r22\n"	  /* load up the returned func ptr */	\
- "	ldw	4(%r28),%r19\n"						\
- "	ldwm	-64(%sp),%r28\n"					\
- 	/* Arguments. */						\
- "	ldw	-36(%sp),%r26\n"					\
- "	ldw	-40(%sp),%r25\n"					\
- "	ldw	-44(%sp),%r24\n"					\
- "	ldw	-48(%sp),%r23\n"					\
- 	/* Call the real function. */					\
- "	bv	%r0(%r22)\n"						\
- 	/* Return pointer. */						\
- "	ldw	-20(%sp),%r2\n"						\
- "	.exit\n"							\
- "	.procend\n");
-  
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
-#endif
-
-/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.
-   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
-   of the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_type_class(type) \
-  ((((type) == R_PARISC_IPLT || (type) == R_PARISC_EPLT)	\
-    * ELF_RTYPE_CLASS_PLT)					\
-   | (((type) == R_PARISC_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* Used by the runtime in fixup to figure out if reloc is *really* PLT */
-#define ELF_MACHINE_JMP_SLOT R_PARISC_IPLT
-#define ELF_MACHINE_SIZEOF_JMP_SLOT PLT_ENTRY_SIZE
-
-/* We only use RELA. */
-#define ELF_MACHINE_NO_REL 1
-
-/* Return the address of the entry point. */
-#define ELF_MACHINE_START_ADDRESS(map, start) \
-  DL_STATIC_FUNCTION_ADDRESS (map, start)
-
-/* We define an initialization functions.  This is called very early in
- *    _dl_sysdep_start.  */
-#define DL_PLATFORM_INIT dl_platform_init ()
-
-static inline void __attribute__ ((unused))
-dl_platform_init (void)
-{
-	if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
-	/* Avoid an empty string which would disturb us.  */
-		GLRO(dl_platform) = NULL;
-}
-	
-#endif /* !dl_machine_h */
-
-/* These are only actually used where RESOLVE_MAP is defined, anyway. */
-#ifdef RESOLVE_MAP
-
-auto void __attribute__((always_inline))
-elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
-		  const Elf32_Sym *sym, const struct r_found_version *version,
-		  void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  const Elf32_Sym *const refsym = sym;
-  unsigned long const r_type = ELF32_R_TYPE (reloc->r_info);
-  struct link_map *sym_map;
-  Elf32_Addr value;
-
-# if !defined RTLD_BOOTSTRAP && !defined SHARED
-  /* This is defined in rtld.c, but nowhere in the static libc.a; make the
-     reference weak so static programs can still link.  This declaration
-     cannot be done when compiling rtld.c (i.e.  #ifdef RTLD_BOOTSTRAP)
-     because rtld.c contains the common defn for _dl_rtld_map, which is
-     incompatible with a weak decl in the same file.  */
-  weak_extern (GL(dl_rtld_map));
-# endif
-
-  /* RESOLVE_MAP will return a null value for undefined syms, and
-     non-null for all other syms.  In particular, relocs with no
-     symbol (symbol index of zero), also called *ABS* relocs, will be
-     resolved to MAP.  (The first entry in a symbol table is all
-     zeros, and an all zero Elf32_Sym has a binding of STB_LOCAL.)
-     See RESOLVE_MAP definition in elf/dl-reloc.c  */
-# ifdef RTLD_BOOTSTRAP
-  /* RESOLVE_MAP in rtld.c doesn't have the local sym test.  */
-  sym_map = (ELF32_ST_BIND (sym->st_info) != STB_LOCAL
-	     ? RESOLVE_MAP (&sym, version, r_type) : map);
-# else
-  sym_map = RESOLVE_MAP (&sym, version, r_type);
-# endif
-  if (sym_map)
-    {
-      value = sym ? sym_map->l_addr + sym->st_value : 0;
-      value += reloc->r_addend;
-    }
-  else
-    value = 0;
-
-  switch (r_type)
-    {
-    case R_PARISC_DIR32:
-      /* .eh_frame can have unaligned relocs.  */
-      if ((unsigned long) reloc_addr_arg & 3)
-	{
-	  char *rel_addr = (char *) reloc_addr_arg;
-	  rel_addr[0] = value >> 24;
-	  rel_addr[1] = value >> 16;
-	  rel_addr[2] = value >> 8;
-	  rel_addr[3] = value;
-	  return;
-	}
-      break;
-
-    case R_PARISC_PLABEL32:
-      /* Easy rule: If there is a symbol and it is global, then we
-         need to make a dynamic function descriptor.  Otherwise we
-         have the address of a PLT slot for a local symbol which we
-         know to be unique. */
-      if (sym == NULL
-	  || sym_map == NULL
-	  || ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
-        {
-	  break;
-        }
-      /* Set bit 30 to indicate to $$dyncall that this is a PLABEL.
-         We have to do this outside of the generic function descriptor
-	 code, since it doesn't know about our requirement for setting
-	 protection bits */
-      value = (Elf32_Addr)((unsigned int)_dl_make_fptr (sym_map, sym, value) | 2);
-      break;
-
-    case R_PARISC_IPLT:
-      if (__builtin_expect (sym_map != NULL, 1))
-        {
-	  elf_machine_fixup_plt (NULL, sym_map, reloc, reloc_addr, value);
-        } 
-      else 
-        {
-	  /* If we get here, it's a (weak) undefined sym.  */
-	  elf_machine_fixup_plt (NULL, map, reloc, reloc_addr, value);
-        }
-      return;
-
-    case R_PARISC_COPY:
-      if (__builtin_expect (sym == NULL, 0))
-	/* This can happen in trace mode if an object could not be
-	   found.  */
-	break;
-      if (__builtin_expect (sym->st_size > refsym->st_size, 0)
-	  || (__builtin_expect (sym->st_size < refsym->st_size, 0)
-	      && __builtin_expect (GLRO(dl_verbose), 0)))
-	{
-	  const char *strtab;
-
-	  strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
-	  _dl_error_printf ("%s: Symbol `%s' has different size in shared object, "
-			    "consider re-linking\n",
-			    rtld_progname ?: "<program name unknown>",
-			    strtab + refsym->st_name);
-	}
-      memcpy (reloc_addr_arg, (void *) value,
-	      MIN (sym->st_size, refsym->st_size));
-      return;
-      
-    case R_PARISC_NONE:	/* Alright, Wilbur. */
-      return;
-
-    default:
-      _dl_reloc_bad_type (map, r_type, 0);
-    }
-
-  *reloc_addr = value;
-}
-
-/* hppa doesn't have an R_PARISC_RELATIVE reloc, but uses relocs with
-   ELF32_R_SYM (info) == 0 for a similar purpose.  */
-auto void __attribute__((always_inline))
-elf_machine_rela_relative (Elf32_Addr l_addr,
-			   const Elf32_Rela *reloc,
-			   void *const reloc_addr_arg)
-{
-  unsigned long const r_type = ELF32_R_TYPE (reloc->r_info);
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  static char msgbuf[] = { "Unknown" }; 
-  struct link_map map;
-  Elf32_Addr value;
-
-  value = l_addr + reloc->r_addend;
-
-  if (ELF32_R_SYM (reloc->r_info) != 0){ 
-    _dl_error_printf ("%s: In elf_machine_rela_relative "
-		      "ELF32_R_SYM (reloc->r_info) != 0. Aborting.",
-		      rtld_progname ?: "<program name unknown>");
-    ABORT_INSTRUCTION;  /* Crash. */
-  }
-
-  switch (r_type)
-    {
-    case R_PARISC_DIR32:
-      /* .eh_frame can have unaligned relocs.  */
-      if ((unsigned long) reloc_addr_arg & 3)
-	{
-	  char *rel_addr = (char *) reloc_addr_arg;
-	  rel_addr[0] = value >> 24;
-	  rel_addr[1] = value >> 16;
-	  rel_addr[2] = value >> 8;
-	  rel_addr[3] = value;
-	  return;
-	}
-      break;
-
-    case R_PARISC_PLABEL32:
-      break;
-
-    case R_PARISC_IPLT: /* elf_machine_runtime_setup already set gp */
-      break;
-
-    case R_PARISC_NONE:
-      return;
-
-    default: /* Bad reloc, map unknown (really it's the current map) */
-      map.l_name = msgbuf;
-      _dl_reloc_bad_type (&map, r_type, 0);
-      return;
-    }
-
-  *reloc_addr = value;
-}
-
-auto void __attribute__((always_inline))
-elf_machine_lazy_rel (struct link_map *map,
-		      Elf32_Addr l_addr, const Elf32_Rela *reloc)
-{
-  /* We don't have anything to do here.  elf_machine_runtime_setup has
-     done all the relocs already.  */
-}
-
-#endif /* RESOLVE_MAP */
diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
deleted file mode 100644
index e5ce6a9c03..0000000000
--- a/sysdeps/hppa/dl-symaddr.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Get the symbol address.  HPPA version.
-   Copyright (C) 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <ldsodefs.h>
-#include <dl-machine.h>
-
-void *
-_dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
-{
-  /* Find the "ip" from the "map" and symbol "ref" */
-  Elf32_Addr value = (map ? map->l_addr : 0) + ref->st_value;
-
-  /* On hppa, we have to return the pointer to function descriptor.
-     This involves an "| 2" to inform $$dyncall that this is a plabel32  */
-  if (ELFW(ST_TYPE) (ref->st_info) == STT_FUNC){
-    return (void *)((unsigned long)_dl_make_fptr (map, ref, value) | 2);
-  }
-  else
-    return (void *) value;
-}
diff --git a/sysdeps/hppa/elf/entry.h b/sysdeps/hppa/elf/entry.h
deleted file mode 100644
index b024db2be7..0000000000
--- a/sysdeps/hppa/elf/entry.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __ASSEMBLY__
-extern void _start (void);
-#endif
-
-/* The function's entry point is stored in the first word of the
-   function descriptor (plabel) of _start().  */
-#define ENTRY_POINT __canonicalize_funcptr_for_compare(_start)
-
-/* We have to provide a special declaration.  */
-#define ENTRY_POINT_DECL(class) class void _start (void);
diff --git a/sysdeps/hppa/elf/initfini.c b/sysdeps/hppa/elf/initfini.c
deleted file mode 100644
index 35f5dd52fe..0000000000
--- a/sysdeps/hppa/elf/initfini.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Special .init and .fini section support for HPPA
-   Copyright (C) 2000, 2002 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.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file is compiled into assembly code which is then munged by a sed
-   script into two files: crti.s and crtn.s.
-
-   * crti.s puts a function prologue at the beginning of the
-   .init and .fini sections and defines global symbols for
-   those addresses, so they can be called as functions.
-
-   * crtn.s puts the corresponding function epilogues
-   in the .init and .fini sections. */
-
-/* If we use the standard C version, the linkage table pointer won't
-   be properly preserved due to the splitting up of function prologues
-   and epilogues.  Therefore we write these in assembly to make sure
-   they do the right thing.
-
-   Note that we cannot have a weak undefined __gmon_start__, because
-   that would require this to be PIC, and the linker is currently not
-   able to generate a proper procedure descriptor for _init.  Sad but
-   true.  Anyway, HPPA is one of those horrible architectures where
-   making the comparison and indirect call is quite expensive (see the
-   comment in sysdeps/generic/initfini.c). */
-
-__asm__ ("\
-\n\
-#include \"defs.h\"\n\
-\n\
-/*@HEADER_ENDS*/\n\
-\n\
-/*@_init_PROLOG_BEGINS*/\n\
-	.section .init\n\
-	.align 4\n\
-	.globl _init\n\
-	.type _init,@function\n\
-_init:\n\
-	stw	%rp,-20(%sp)\n\
-	stwm	%r4,64(%sp)\n\
-	stw	%r19,-32(%sp)\n\
-	bl	__gmon_start__,%rp\n\
-	copy	%r19,%r4	/* delay slot */\n\
-	copy	%r4,%r19\n\
-/*@_init_PROLOG_ENDS*/\n\
-\n\
-/*@_init_EPILOG_BEGINS*/\n\
-        .text\n\
-        .align 4\n\
-        .weak   __gmon_start__\n\
-        .type    __gmon_start__,@function\n\
-__gmon_start__:\n\
-	.proc\n\
-	.callinfo\n\
-	.entry\n\
-        bv,n %r0(%r2)\n\
-	.exit\n\
-	.procend\n\
-\n\
-/* Here is the tail end of _init.  We put __gmon_start before this so\n\
-   that the assembler creates the .PARISC.unwind section for us, ie.\n\
-   with the right attributes.  */\n\
-	.section .init\n\
-	ldw	-84(%sp),%rp\n\
-	copy	%r4,%r19\n\
-	bv	%r0(%rp)\n\
-_end_init:\n\
-	ldwm	-64(%sp),%r4\n\
-\n\
-/* Our very own unwind info, because the assembler can't handle\n\
-   functions split into two or more pieces.  */\n\
-	.section .PARISC.unwind\n\
-	.extern _init\n\
-	.word	_init, _end_init\n\
-	.byte	0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n\
-\n\
-/*@_init_EPILOG_ENDS*/\n\
-\n\
-/*@_fini_PROLOG_BEGINS*/\n\
-	.section .fini\n\
-	.align 4\n\
-	.globl _fini\n\
-	.type _fini,@function\n\
-_fini:\n\
-	stw	%rp,-20(%sp)\n\
-	stwm	%r4,64(%sp)\n\
-	stw	%r19,-32(%sp)\n\
-	copy	%r19,%r4\n\
-/*@_fini_PROLOG_ENDS*/\n\
-\n\
-/*@_fini_EPILOG_BEGINS*/\n\
-	.section .fini\n\
-	ldw	-84(%sp),%rp\n\
-	copy	%r4,%r19\n\
-	bv	%r0(%rp)\n\
-_end_fini:\n\
-	ldwm	-64(%sp),%r4\n\
-\n\
-	.section .PARISC.unwind\n\
-	.extern _fini\n\
-	.word	_fini, _end_fini\n\
-	.byte	0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08\n\
-\n\
-/*@_fini_EPILOG_ENDS*/\n\
-\n\
-/*@TRAILER_BEGINS*/\
-");
diff --git a/sysdeps/hppa/elf/start.S b/sysdeps/hppa/elf/start.S
deleted file mode 100644
index 4cf832a2f6..0000000000
--- a/sysdeps/hppa/elf/start.S
+++ /dev/null
@@ -1,97 +0,0 @@
-/* ELF startup code for HPPA.
-   Copyright (C) 2002 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.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-	.text
-
-	.align 4
-
-	.import main, code
-	.import $global$, data
-	.import __libc_start_main, code
-	.import __libc_csu_fini, code
-	.import __libc_csu_init, code
-
-	.globl _start
-	.export _start, ENTRY
-	.type _start,@function
-_start:
-
-	.proc
-	.callinfo
-
-	/* load main */
-	ldil	LP%main, %r26
-	ldo	RP%main(%r26), %r26
-
-	/* argc and argv should be in 25 and 24 */
-
-	/* Expand the stack to store the 5th through 7th args */
-	ldo	64(%sp), %sp
-
-	/* void (*rtld_fini) (void) (actually the 6th arg) */
-	stw	%r23, -56(%sp)
-
-	/* void (*init) (void) */
-	ldil	LP%__libc_csu_init, %r23
-	ldo	RP%__libc_csu_init(%r23), %r23
-
-	/* void (*fini) (void) */
-	ldil	LP%__libc_csu_fini, %r22
-	ldo	RP%__libc_csu_fini(%r22), %r22
-	stw	%r22, -52(%sp)
-
-	/* void *stack_end */
-	stw	%sp, -60(%sp)
-
-	/* load global */
-	ldil	L%$global$, %dp
-	ldo	R%$global$(%dp), %dp
-
-	bl	__libc_start_main,%r2
-	nop
-	/* die horribly if it returned (it shouldn't) */
-	iitlbp %r0,(%r0)
-	nop
-
-	.procend
-
-/* Define a symbol for the first piece of initialized data.  */
-	.data
-	.globl __data_start
-__data_start:
-	.long 0
-	.weak data_start
-	data_start = __data_start
diff --git a/sysdeps/hppa/fpu/bits/fenv.h b/sysdeps/hppa/fpu/bits/fenv.h
deleted file mode 100644
index c5f8c43459..0000000000
--- a/sysdeps/hppa/fpu/bits/fenv.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-/* Define bits representing the exception.  We use the values of the
-   appropriate enable bits in the FPU status word (which,
-   coincidentally, are the same as the flag bits, but shifted right by
-   27 bits).  */
-enum
-{
-  FE_INVALID   = 1<<4, /* V */
-#define FE_INVALID	FE_INVALID
-  FE_DIVBYZERO = 1<<3, /* Z */
-#define FE_DIVBYZERO	FE_DIVBYZERO
-  FE_OVERFLOW  = 1<<2, /* O */
-#define FE_OVERFLOW	FE_OVERFLOW
-  FE_UNDERFLOW = 1<<1, /* U */
-#define FE_UNDERFLOW	FE_UNDERFLOW
-  FE_INEXACT   = 1<<0, /* I */
-#define FE_INEXACT	FE_INEXACT
-};
-
-#define FE_ALL_EXCEPT \
-	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* The PA-RISC FPU supports all of the four defined rounding modes.
-   We use the values of the RM field in the floating point status
-   register for the appropriate macros.  */
-enum
-  {
-    FE_TONEAREST  = 0 << 9,
-#define FE_TONEAREST	FE_TONEAREST
-    FE_TOWARDZERO = 1 << 9,
-#define FE_TOWARDZERO	FE_TOWARDZERO
-    FE_UPWARD     = 2 << 9,
-#define FE_UPWARD	FE_UPWARD
-    FE_DOWNWARD   = 3 << 9,
-#define FE_DOWNWARD	FE_DOWNWARD
-  };
-
-/* Type representing exception flags. */
-typedef unsigned int fexcept_t;
-
-/* Type representing floating-point environment.  This structure
-   corresponds to the layout of the status and exception words in the
-   register file. */
-typedef struct
-{
-  unsigned int __status_word;
-  unsigned int __exception[7];
-} fenv_t;
-
-/* If the default argument is used we use this value.  */
-#define FE_DFL_ENV ((fenv_t *) -1)
-
-#ifdef __USE_GNU
-/* Floating-point environment where none of the exceptions are masked.  */
-# define FE_NOMASK_ENV	((fenv_t *) -2)
-#endif
diff --git a/sysdeps/hppa/fpu/fclrexcpt.c b/sysdeps/hppa/fpu/fclrexcpt.c
deleted file mode 100644
index a7c698206e..0000000000
--- a/sysdeps/hppa/fpu/fclrexcpt.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Clear given exceptions in current floating-point environment.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-feclearexcept (int excepts)
-{
-  unsigned int sw[2];
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  /* Clear all the relevant bits. */
-  sw[0] &= ~((excepts & FE_ALL_EXCEPT) << 27);
-  __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/hppa/fpu/fedisblxcpt.c b/sysdeps/hppa/fpu/fedisblxcpt.c
deleted file mode 100644
index aac6bbfa2a..0000000000
--- a/sysdeps/hppa/fpu/fedisblxcpt.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Disable floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fedisableexcept (int excepts)
-{
-  unsigned int sw[2], old_exc;
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  old_exc = sw[0] & FE_ALL_EXCEPT;
-
-  sw[0] &= ~(excepts & FE_ALL_EXCEPT);
-  __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
-
-  return old_exc;
-}
diff --git a/sysdeps/hppa/fpu/feenablxcpt.c b/sysdeps/hppa/fpu/feenablxcpt.c
deleted file mode 100644
index 9ce3ca82cc..0000000000
--- a/sysdeps/hppa/fpu/feenablxcpt.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Enable floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-feenableexcept (int excepts)
-{
-  unsigned int sw[2], old_exc;
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  old_exc = sw[0] & FE_ALL_EXCEPT;
-
-  sw[0] |= (excepts & FE_ALL_EXCEPT);
-  __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
-
-  return old_exc;
-}
diff --git a/sysdeps/hppa/fpu/fegetenv.c b/sysdeps/hppa/fpu/fegetenv.c
deleted file mode 100644
index b87317b789..0000000000
--- a/sysdeps/hppa/fpu/fegetenv.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Store current floating-point environment.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetenv (fenv_t *envp)
-{
-  __asm__ (
-	   "fstd,ma %%fr0,8(%1)\n"
-	   "fstd,ma %%fr1,8(%1)\n"
-	   "fstd,ma %%fr2,8(%1)\n"
-	   "fstd %%fr3,0(%1)\n"
-	   : "=m" (*envp), "+r" (envp));
-  return 0;
-}
diff --git a/sysdeps/hppa/fpu/fegetexcept.c b/sysdeps/hppa/fpu/fegetexcept.c
deleted file mode 100644
index efd1d7df05..0000000000
--- a/sysdeps/hppa/fpu/fegetexcept.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Get enabled floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetexcept (void)
-{
-  unsigned int sw[2];
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  return sw[0] & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/hppa/fpu/fegetround.c b/sysdeps/hppa/fpu/fegetround.c
deleted file mode 100644
index aefedbc071..0000000000
--- a/sysdeps/hppa/fpu/fegetround.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Return current rounding direction.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetround (void)
-{
-  unsigned int sw[2];
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  return sw[0] & FE_DOWNWARD;
-}
diff --git a/sysdeps/hppa/fpu/feholdexcpt.c b/sysdeps/hppa/fpu/feholdexcpt.c
deleted file mode 100644
index 5aec0151f8..0000000000
--- a/sysdeps/hppa/fpu/feholdexcpt.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Store current floating-point environment and clear exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <string.h>
-
-int
-feholdexcept (fenv_t *envp)
-{
-  fenv_t clear;
-  fenv_t * _regs = envp;
-
-  /* Store the environment.  */
-  __asm__ (
-	   "fstd,ma %%fr0,8(%1)\n"
-	   "fstd,ma %%fr1,8(%1)\n"
-	   "fstd,ma %%fr2,8(%1)\n"
-	   "fstd %%fr3,0(%1)\n"
-	   : "=m" (*_regs), "+r" (_regs));
-  memcpy (&clear, envp, sizeof (clear));
-
-  /* Now clear all exceptions.  */
-  clear.__status_word &= ~(FE_ALL_EXCEPT << 27);
-  memset (clear.__exception, 0, sizeof (clear.__exception));
-
-  /* And set all exceptions to non-stop.  */
-  clear.__status_word &= ~FE_ALL_EXCEPT;
-
-  /* Load the new environment. */
-  _regs = &clear;
-  __asm__ (
-	   "fldd,ma 8(%0),%%fr0\n"
-	   "fldd,ma 8(%0),%%fr1\n"
-	   "fldd,ma 8(%0),%%fr2\n"
-	   "fldd 0(%0),%%fr3\n"
-	   : : "r" (_regs));
-
-  return 0;
-}
diff --git a/sysdeps/hppa/fpu/fesetenv.c b/sysdeps/hppa/fpu/fesetenv.c
deleted file mode 100644
index 526773214b..0000000000
--- a/sysdeps/hppa/fpu/fesetenv.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Install given floating-point environment.
-   Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-   Based on the m68k version by
-   Andreas Schwab <schwab@suse.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fesetenv (const fenv_t *envp)
-{
-  fenv_t temp;
-  fenv_t * _regs = &temp;
-
-  /* Install the environment specified by ENVP.  But there are a few
-     values which we do not want to come from the saved environment.
-     Therefore, we get the current environment and replace the values
-     we want to use from the environment specified by the parameter.  */
-  __asm__ (
-	   "fstd,ma %%fr0,8(%1)\n"
-	   "fstd,ma %%fr1,8(%1)\n"
-	   "fstd,ma %%fr2,8(%1)\n"
-	   "fstd %%fr3,0(%1)\n"
-	   : "=m" (*_regs), "+r" (_regs));
-
-  temp.__status_word &= ~(FE_ALL_EXCEPT
-			  | (FE_ALL_EXCEPT << 27)
-			  | FE_DOWNWARD);
-  if (envp == FE_DFL_ENV)
-    ;
-  else if (envp == FE_NOMASK_ENV)
-    temp.__status_word |= FE_ALL_EXCEPT;
-  else
-    temp.__status_word |= (envp->__status_word
-			   & (FE_ALL_EXCEPT
-			      | FE_DOWNWARD
-			      | (FE_ALL_EXCEPT << 27)));
-
-  /* Load the new environment. */
-  __asm__ (
-	   "fldd,ma -8(%1),%%fr3\n"
-	   "fldd,ma -8(%1),%%fr2\n"
-	   "fldd,ma -8(%1),%%fr1\n"
-	   "fldd 0(%1),%%fr0\n"
-	   : "=m" (*_regs), "+r" (_regs));
-
-  /* Success.  */
-  return 0;
-}
-libm_hidden_def (fesetenv)
diff --git a/sysdeps/hppa/fpu/fesetround.c b/sysdeps/hppa/fpu/fesetround.c
deleted file mode 100644
index 3687624c2b..0000000000
--- a/sysdeps/hppa/fpu/fesetround.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Set current rounding direction.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fesetround (int round)
-{
-  unsigned int sw[2];
-
-  if (round & ~FE_DOWNWARD)
-    /* ROUND is not a valid rounding mode.  */
-    return 1;
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-  sw[0] &= ~FE_DOWNWARD;
-  sw[0] |= round;
-  __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
-
-  return 0;
-}
diff --git a/sysdeps/hppa/fpu/feupdateenv.c b/sysdeps/hppa/fpu/feupdateenv.c
deleted file mode 100644
index 7d50282e05..0000000000
--- a/sysdeps/hppa/fpu/feupdateenv.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Install given floating-point environment and raise exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-feupdateenv (const fenv_t *envp)
-{
-  unsigned int sw[2];
-
-  /* Get the current exception status. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-  /* Install new environment.  */
-  fesetenv (envp);
-  /* Raise the saved exceptions */
-  feraiseexcept(sw[0] & FE_ALL_EXCEPT);
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/hppa/fpu/fgetexcptflg.c b/sysdeps/hppa/fpu/fgetexcptflg.c
deleted file mode 100644
index 27766ecf58..0000000000
--- a/sysdeps/hppa/fpu/fgetexcptflg.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Store current representation for exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetexceptflag (fexcept_t *flagp, int excepts)
-{
-  unsigned int sw[2];
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  *flagp = (sw[0] >> 27) & excepts & FE_ALL_EXCEPT;
-
-  /* Success.  */
-  return 0;
-}
-
diff --git a/sysdeps/hppa/fpu/fraiseexcpt.c b/sysdeps/hppa/fpu/fraiseexcpt.c
deleted file mode 100644
index b064dc1527..0000000000
--- a/sysdeps/hppa/fpu/fraiseexcpt.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Raise given exceptions.
-   Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <float.h>
-#include <math.h>
-
-/* Please see section 10, 
-   page 10-5 "Delayed Trapping" in the PA-RISC 2.0 Architecture manual */
-
-int
-feraiseexcept (int excepts)
-{
-  /* Raise exceptions represented by EXCEPTS.  But we must raise only one
-     signal at a time.  It is important that if the overflow/underflow
-     exception and the divide by zero exception are given at the same
-     time, the overflow/underflow exception follows the divide by zero
-     exception.  */
-
-  /* We do these bits in assembly to be certain GCC doesn't optimize
-     away something important, and so we can force delayed traps to
-     occur. */
-
-  /* We use "fldd 0(%%sr0,%%sp),%0" to flush the delayed exception */
-	
-  /* First: Invalid exception.  */
-  if (excepts & FE_INVALID)
-    {
-      /* One example of a invalid operation is 0 * Infinity.  */
-      double d = HUGE_VAL;
-      __asm__ __volatile__ (
-		"	fcpy,dbl %%fr0,%%fr22\n"
-		"	fmpy,dbl %0,%%fr22,%0\n"
-		"	fldd 0(%%sr0,%%sp),%0"
-		: "+f" (d) : : "%fr22" );
-    }
-
-  /* Second: Division by zero.  */
-  if (excepts & FE_DIVBYZERO)
-    {
-      double d = 1.0;
-      __asm__ __volatile__ (
-		"	fcpy,dbl %%fr0,%%fr22\n"
-		"	fdiv,dbl %0,%%fr22,%0\n"
-		"	fldd 0(%%sr0,%%sp),%0"
-		: "+f" (d) : : "%fr22" );
-    }
-
-  /* Third: Overflow.  */
-  if (excepts & FE_OVERFLOW)
-    {
-      double d = DBL_MAX;
-      __asm__ __volatile__ (
-		"	fadd,dbl %0,%0,%0\n"
-		"	fldd 0(%%sr0,%%sp),%0"
-		: "+f" (d) );
-    }
-
-  /* Fourth: Underflow.  */
-  if (excepts & FE_UNDERFLOW)
-    {
-      double d = DBL_MIN;
-      double e = 3.0;
-      __asm__ __volatile__ (
-		"	fdiv,dbl %0,%1,%0\n"
-		"	fldd 0(%%sr0,%%sp),%0"
-		: "+f" (d) : "f" (e) );
-    }
-
-  /* Fifth: Inexact */
-  if (excepts & FE_INEXACT)
-    {
-      double d = M_PI;
-      double e = 69.69;
-      __asm__ __volatile__ (
-		"	fdiv,dbl %0,%1,%%fr22\n"
-		"	fcnvfxt,dbl,sgl %%fr22,%%fr22L\n"
-		"	fldd 0(%%sr0,%%sp),%%fr22"
-		: : "f" (d), "f" (e) : "%fr22" );
-    }
-
-  /* Success.  */
-  return 0;
-}
-libm_hidden_def (feraiseexcept)
diff --git a/sysdeps/hppa/fpu/fsetexcptflg.c b/sysdeps/hppa/fpu/fsetexcptflg.c
deleted file mode 100644
index af35f5ae35..0000000000
--- a/sysdeps/hppa/fpu/fsetexcptflg.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Set floating-point environment exception handling.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <math.h>
-
-int
-fesetexceptflag (const fexcept_t *flagp, int excepts)
-{
-  unsigned int sw[2];
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  /* Install new enable trap bits  */
-  sw[0] |= (*flagp & excepts & FE_ALL_EXCEPT) << 27;
-
-  /* Store the new status word.  */
-  __asm__ ("fldd 0(%0),%%fr0" : : "r" (sw));
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/hppa/fpu/ftestexcept.c b/sysdeps/hppa/fpu/ftestexcept.c
deleted file mode 100644
index d08d4d6eb9..0000000000
--- a/sysdeps/hppa/fpu/ftestexcept.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Test exception in current environment.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fetestexcept (int excepts)
-{
-  unsigned int sw[2];
-
-  /* Get the current status word. */
-  __asm__ ("fstd %%fr0,0(%1)" : "=m" (*sw) : "r" (sw));
-
-  return (sw[0] >> 27) & excepts & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/hppa/fpu/libm-test-ulps b/sysdeps/hppa/fpu/libm-test-ulps
deleted file mode 100644
index 73172b49a0..0000000000
--- a/sysdeps/hppa/fpu/libm-test-ulps
+++ /dev/null
@@ -1,890 +0,0 @@
-# Begin of automatic generation
-
-# atan2
-Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
-Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
-Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
-float: 1
-ifloat: 1
-
-# atanh
-Test "atanh (0.75) == 0.972955074527656652552676371721589865":
-float: 1
-ifloat: 1
-
-# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-# casin
-Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# casinh
-Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# catan
-Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-float: 3
-ifloat: 3
-Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
-float: 4
-ifloat: 4
-
-# catanh
-Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-double: 4
-idouble: 4
-Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-float: 4
-ifloat: 4
-Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-float: 6
-ifloat: 6
-
-# cbrt
-Test "cbrt (-27.0) == -3.0":
-double: 1
-idouble: 1
-Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
-double: 1
-idouble: 1
-Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
-double: 1
-idouble: 1
-
-# ccos
-Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-float: 1
-ifloat: 1
-
-# ccosh
-Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-float: 1
-ifloat: 1
-
-# cexp
-Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
-float: 1
-ifloat: 1
-Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
-float: 1
-ifloat: 1
-
-# clog
-Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
-float: 3
-ifloat: 3
-Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
-float: 1
-ifloat: 1
-
-# clog10
-Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
-float: 1
-ifloat: 1
-
-# cos
-Test "cos (M_PI_6l * 2.0) == 0.5":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "cos (M_PI_6l * 4.0) == -0.5":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "cos (pi/2) == 0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# cpow
-Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
-double: 2
-float: 3
-idouble: 2
-ifloat: 3
-Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-float: 2
-ifloat: 2
-Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-# csinh
-Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
-double: 1
-idouble: 1
-Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-
-# csqrt
-Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-
-# ctan
-Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
-double: 1
-idouble: 1
-
-# ctanh
-Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
-float: 1
-ifloat: 1
-Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
-double: 1
-idouble: 1
-
-# erf
-Test "erf (1.25) == 0.922900128256458230136523481197281140":
-double: 1
-idouble: 1
-
-# erfc
-Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
-double: 1
-idouble: 1
-Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
-double: 1
-idouble: 1
-
-# exp10
-Test "exp10 (-1) == 0.1":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "exp10 (3) == 1000":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-# expm1
-Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
-double: 1
-idouble: 1
-Test "expm1 (1) == M_El - 1.0":
-float: 1
-ifloat: 1
-
-# hypot
-Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-
-# j0
-Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "j0 (0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "j0 (2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
-Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "j0 (8.0) == 0.171650807137553906090869407851972001":
-float: 1
-ifloat: 1
-
-# j1
-Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-Test "j1 (2.0) == 0.576724807756873387202448242269137087":
-double: 1
-idouble: 1
-Test "j1 (8.0) == 0.234636346853914624381276651590454612":
-double: 1
-idouble: 1
-
-# jn
-Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
-Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
-float: 1
-ifloat: 1
-Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
-double: 1
-idouble: 1
-Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
-double: 1
-idouble: 1
-Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
-double: 4
-float: 3
-idouble: 4
-ifloat: 3
-Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 4
-ifloat: 4
-Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# lgamma
-Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# log10
-Test "log10 (0.75) == -0.124938736608299953132449886193870744":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "log10 (e) == log10(e)":
-float: 1
-ifloat: 1
-
-# log1p
-Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
-float: 1
-ifloat: 1
-
-# sincos
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
-float: 1
-ifloat: 1
-
-# tan
-Test "tan (pi/4) == 1":
-double: 1
-idouble: 1
-
-# tgamma
-Test "tgamma (-0.5) == -2 sqrt (pi)":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "tgamma (0.5) == sqrt (pi)":
-float: 1
-ifloat: 1
-Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y0
-Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (1.5) == 0.382448923797758843955068554978089862":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
-float: 1
-ifloat: 1
-Test "y0 (8.0) == 0.223521489387566220527323400498620359":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y1
-Test "y1 (0.125) == -5.19993611253477499595928744876579921":
-double: 1
-idouble: 1
-Test "y1 (1.5) == -0.412308626973911295952829820633445323":
-float: 1
-ifloat: 1
-Test "y1 (10.0) == 0.249015424206953883923283474663222803":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "y1 (2.0) == -0.107032431540937546888370772277476637":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "y1 (8.0) == -0.158060461731247494255555266187483550":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# yn
-Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
-float: 1
-ifloat: 1
-Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
-double: 1
-idouble: 1
-Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
-float: 1
-ifloat: 1
-Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
-double: 1
-idouble: 1
-Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
-double: 1
-idouble: 1
-Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
-double: 2
-idouble: 2
-Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
-double: 1
-idouble: 1
-Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
-double: 1
-idouble: 1
-
-# Maximal error of functions:
-Function: "atan2":
-float: 3
-ifloat: 3
-
-Function: "atanh":
-float: 1
-ifloat: 1
-
-Function: Real part of "cacosh":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-
-Function: Imaginary part of "cacosh":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-Function: Real part of "casin":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "casinh":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-
-Function: Imaginary part of "casinh":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-
-Function: Real part of "catan":
-float: 4
-ifloat: 4
-
-Function: Imaginary part of "catan":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "catanh":
-double: 4
-idouble: 4
-
-Function: Imaginary part of "catanh":
-float: 6
-ifloat: 6
-
-Function: "cbrt":
-double: 1
-idouble: 1
-
-Function: Real part of "ccos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ccos":
-float: 1
-ifloat: 1
-
-Function: Real part of "ccosh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ccosh":
-float: 1
-ifloat: 1
-
-Function: Real part of "cexp":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "cexp":
-float: 1
-ifloat: 1
-
-Function: Real part of "clog":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "clog":
-float: 3
-ifloat: 3
-
-Function: Real part of "clog10":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "clog10":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-
-Function: "cos":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: Real part of "cpow":
-double: 2
-float: 4
-idouble: 2
-ifloat: 4
-
-Function: Imaginary part of "cpow":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: Real part of "csinh":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "csinh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "csqrt":
-float: 1
-ifloat: 1
-
-Function: Real part of "ctan":
-double: 1
-idouble: 1
-
-Function: Imaginary part of "ctan":
-double: 1
-idouble: 1
-
-Function: Real part of "ctanh":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: Imaginary part of "ctanh":
-float: 1
-ifloat: 1
-
-Function: "erf":
-double: 1
-idouble: 1
-
-Function: "erfc":
-double: 1
-idouble: 1
-
-Function: "exp10":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-Function: "expm1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "hypot":
-float: 1
-ifloat: 1
-
-Function: "j0":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: "j1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "jn":
-double: 4
-float: 4
-idouble: 4
-ifloat: 4
-
-Function: "lgamma":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "log10":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "log1p":
-float: 1
-ifloat: 1
-
-Function: "sincos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "tan":
-double: 1
-idouble: 1
-
-Function: "tgamma":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "y0":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: "y1":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-Function: "yn":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-# end of automatic generation
diff --git a/sysdeps/hppa/frame.h b/sysdeps/hppa/frame.h
deleted file mode 100644
index 0a234f1aa7..0000000000
--- a/sysdeps/hppa/frame.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Definition of stack frame structure.  HPPA version.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* PA stacks grow upwards. */
-#define INNER_THAN >
-
-/* FIXME: will verify this later */
-struct layout
-{
-  void *next;
-  void *return_address;
-};
diff --git a/sysdeps/hppa/gccframe.h b/sysdeps/hppa/gccframe.h
deleted file mode 100644
index 65e44dfd73..0000000000
--- a/sysdeps/hppa/gccframe.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Definition of object in frame unwind info.  hppa version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Note: For hppa64 this is 61 */
-#define DWARF_FRAME_REGISTERS 89
-
-#include <sysdeps/generic/gccframe.h>
diff --git a/sysdeps/hppa/hppa1.1/Implies b/sysdeps/hppa/hppa1.1/Implies
deleted file mode 100644
index 5f935a299c..0000000000
--- a/sysdeps/hppa/hppa1.1/Implies
+++ /dev/null
@@ -1,4 +0,0 @@
-wordsize-32
-ieee754/flt-32
-ieee754/dbl-64
-ieee754/ldbl-128
diff --git a/sysdeps/hppa/hppa1.1/addmul_1.s b/sysdeps/hppa/hppa1.1/addmul_1.s
deleted file mode 100644
index a1fb083a83..0000000000
--- a/sysdeps/hppa/hppa1.1/addmul_1.s
+++ /dev/null
@@ -1,104 +0,0 @@
-;! HP-PA-1.1 __mpn_addmul_1 -- Multiply a limb vector with a limb and
-;! add the result to a second limb vector.
-
-;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! res_ptr	r26
-;! s1_ptr	r25
-;! size		r24
-;! s2_limb	r23
-
-;! This runs at 11 cycles/limb on a PA7000.  With the used instructions, it
-;! can not become faster due to data cache contention after a store.  On the
-;! PA7100 it runs at 10 cycles/limb, and that can not be improved either,
-;! since only the xmpyu does not need the integer pipeline, so the only
-;! dual-issue we will get are addc+xmpyu.  Unrolling could gain a cycle/limb
-;! on the PA7100.
-
-;! There are some ideas described in mul_1.s that applies to this code too.
-
-	.text
-	.export		__mpn_addmul_1
-__mpn_addmul_1:	
-	.proc
-	.callinfo	frame=64,no_calls
-	.entry
-
-	ldo		64(%r30),%r30
-	fldws,ma	4(%r25),%fr5
-	stw		%r23,-16(%r30)		;! move s2_limb ...
-	addib,=		-1,%r24,L$just_one_limb
-	 fldws		-16(%r30),%fr4		;! ... into fr4
-	add		%r0,%r0,%r0		;! clear carry
-	xmpyu		%fr4,%fr5,%fr6
-	fldws,ma	4(%r25),%fr7
-	fstds		%fr6,-16(%r30)
-	xmpyu		%fr4,%fr7,%fr8
-	ldw		-12(%r30),%r20		;! least significant limb in product
-	ldw		-16(%r30),%r28
-
-	fstds		%fr8,-16(%r30)
-	addib,=		-1,%r24,L$end
-	 ldw		-12(%r30),%r1
-
-;! Main loop
-L$loop:	
-	ldws		0(%r26),%r29
-	fldws,ma	4(%r25),%fr5
-	add		%r29,%r20,%r20
-	stws,ma		%r20,4(%r26)
-	addc		%r28,%r1,%r20
-	xmpyu		%fr4,%fr5,%fr6
-	ldw		-16(%r30),%r28
-	fstds		%fr6,-16(%r30)
-	addc		%r0,%r28,%r28
-	addib,<>	-1,%r24,L$loop
-	 ldw		-12(%r30),%r1
-
-L$end:		
-	ldw		0(%r26),%r29
-	add		%r29,%r20,%r20
-	stws,ma		%r20,4(%r26)
-	addc		%r28,%r1,%r20
-	ldw		-16(%r30),%r28
-	ldws		0(%r26),%r29
-	addc		%r0,%r28,%r28
-	add		%r29,%r20,%r20
-	stws,ma		%r20,4(%r26)
-	addc		%r0,%r28,%r28
-	bv		0(%r2)
-	ldo		-64(%r30),%r30
-
-L$just_one_limb:	
-	xmpyu		%fr4,%fr5,%fr6
-	ldw		0(%r26),%r29
-	fstds		%fr6,-16(%r30)
-	ldw		-12(%r30),%r1
-	ldw		-16(%r30),%r28
-	add		%r29,%r1,%r20
-	stw		%r20,0(%r26)
-	addc		%r0,%r28,%r28
-	bv		0(%r2)
-	 ldo		-64(%r30),%r30
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/hppa1.1/mul_1.s b/sysdeps/hppa/hppa1.1/mul_1.s
deleted file mode 100644
index 00c770f272..0000000000
--- a/sysdeps/hppa/hppa1.1/mul_1.s
+++ /dev/null
@@ -1,100 +0,0 @@
-;! HP-PA-1.1 __mpn_mul_1 -- Multiply a limb vector with a limb and store
-;! the result in a second limb vector.
-
-;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! res_ptr	r26
-;! s1_ptr	r25
-;! size		r24
-;! s2_limb	r23
-
-;! This runs at 9 cycles/limb on a PA7000.  With the used instructions, it can
-;! not become faster due to data cache contention after a store.  On the
-;! PA7100 it runs at 7 cycles/limb, and that can not be improved either, since
-;! only the xmpyu does not need the integer pipeline, so the only dual-issue
-;! we will get are addc+xmpyu.  Unrolling would not help either CPU.
-
-;! We could use fldds to read two limbs at a time from the S1 array, and that
-;! could bring down the times to 8.5 and 6.5 cycles/limb for the PA7000 and
-;! PA7100, respectively.  We don't do that since it does not seem worth the
-;! (alignment) troubles...
-
-;! At least the PA7100 is rumored to be able to deal with cache-misses
-;! without stalling instruction issue.  If this is true, and the cache is
-;! actually also lockup-free, we should use a deeper software pipeline, and
-;! load from S1 very early;  (The loads and stores to -12(sp) will surely be
-;! in the cache.)
-
-	.text
-	.export		__mpn_mul_1
-__mpn_mul_1:	
-	.proc
-	.callinfo	frame=64,no_calls
-	.entry
-
-	ldo		64(%r30),%r30
-	fldws,ma	4(%r25),%fr5
-	stw		%r23,-16(%r30)		;! move s2_limb ...
-	addib,=		-1,%r24,L$just_one_limb
-	 fldws		-16(%r30),%fr4		;! ... into fr4
-	add		%r0,%r0,%r0		;! clear carry
-	xmpyu		%fr4,%fr5,%fr6
-	fldws,ma	4(%r25),%fr7
-	fstds	 	%fr6,-16(%r30)
-	xmpyu		%fr4,%fr7,%fr8
-	ldw		-12(%r30),%r20		;! least significant limb in product
-	ldw		-16(%r30),%r28
-
-	fstds		%fr8,-16(%r30)
-	addib,=		-1,%r24,L$end
-	 ldw		-12(%r30),%r1
-
-;! Main loop
-L$loop:	
-	fldws,ma	4(%r25),%fr5
-	stws,ma		%r20,4(%r26)
-	addc		%r28,%r1,%r20
-	xmpyu		%fr4,%fr5,%fr6
-	ldw		-16(%r30),%r28
-	fstds		%fr6,-16(%r30)
-	addib,<>	-1,%r24,L$loop
-	 ldw		-12(%r30),%r1
-
-L$end:	
-	stws,ma		%r20,4(%r26)
-	addc		%r28,%r1,%r20
-	ldw		-16(%r30),%r28
-	stws,ma		%r20,4(%r26)
-	addc		%r0,%r28,%r28
-	bv		0(%r2)
-	 ldo		-64(%r30),%r30
-
-L$just_one_limb:	
-	xmpyu		%fr4,%fr5,%fr6
-	fstds		%fr6,-16(%r30)
-	ldw		-16(%r30),%r28
-	ldo		-64(%r30),%r30
-	bv		0(%r2)
-	 fstws		%fr6R,0(%r26)
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/hppa1.1/submul_1.s b/sysdeps/hppa/hppa1.1/submul_1.s
deleted file mode 100644
index 997bd6d521..0000000000
--- a/sysdeps/hppa/hppa1.1/submul_1.s
+++ /dev/null
@@ -1,113 +0,0 @@
-;! HP-PA-1.1 __mpn_submul_1 -- Multiply a limb vector with a limb and
-;! subtract the result from a second limb vector.
-
-;! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! res_ptr	r26
-;! s1_ptr	r25
-;! size		r24
-;! s2_limb	r23
-
-;! This runs at 12 cycles/limb on a PA7000.  With the used instructions, it
-;! can not become faster due to data cache contention after a store.  On the
-;! PA7100 it runs at 11 cycles/limb, and that can not be improved either,
-;! since only the xmpyu does not need the integer pipeline, so the only
-;! dual-issue we will get are addc+xmpyu.  Unrolling could gain a cycle/limb
-;! on the PA7100.
-
-;! There are some ideas described in mul_1.s that applies to this code too.
-
-;! It seems possible to make this run as fast as __mpn_addmul_1, if we use
-;! 	sub,>>=	%r29,%r20,%r22
-;!	addi	1,%r28,%r28
-;! but that requires reworking the hairy software pipeline...
-
-	.text
-	.export		__mpn_submul_1
-__mpn_submul_1:	
-	.proc
-	.callinfo	frame=64,no_calls
-	.entry
-
-	ldo		64(%r30),%r30
-	fldws,ma	4(%r25),%fr5
-	stw		%r23,-16(%r30)		;! move s2_limb ...
-	addib,=		-1,%r24,L$just_one_limb
-	 fldws		-16(%r30),%fr4		;! ... into fr4
-	add		%r0,%r0,%r0		;! clear carry
-	xmpyu		%fr4,%fr5,%fr6
-	fldws,ma	4(%r25),%fr7
-	fstds		%fr6,-16(%r30)
-	xmpyu		%fr4,%fr7,%fr8
-	ldw		-12(%r30),%r20		;! least significant limb in product
-	ldw		-16(%r30),%r28
-
-	fstds		%fr8,-16(%r30)
-	addib,=		-1,%r24,L$end
-	 ldw		-12(%r30),%r1
-
-;! Main loop
-L$loop:	
-	ldws		0(%r26),%r29
-	fldws,ma	4(%r25),%fr5
-	sub		%r29,%r20,%r22
-	add		%r22,%r20,%r0
-	stws,ma		%r22,4(%r26)
-	addc		%r28,%r1,%r20
-	xmpyu		%fr4,%fr5,%fr6
-	ldw		-16(%r30),%r28
-	fstds		%fr6,-16(%r30)
-	addc		%r0,%r28,%r28
-	addib,<>	-1,%r24,L$loop
-	 ldw		-12(%r30),%r1
-
-L$end:	
-	ldw		0(%r26),%r29
-	sub		%r29,%r20,%r22
-	add		%r22,%r20,%r0
-	stws,ma		%r22,4(%r26)
-	addc		%r28,%r1,%r20
-	ldw		-16(%r30),%r28
-	ldws		0(%r26),%r29
-	addc		%r0,%r28,%r28
-	sub		%r29,%r20,%r22
-	add		%r22,%r20,%r0
-	stws,ma		%r22,4(%r26)
-	addc		%r0,%r28,%r28
-	bv		0(%r2)
-	 ldo		-64(%r30),%r30
-
-L$just_one_limb:	
-	xmpyu		%fr4,%fr5,%fr6
-	ldw		0(%r26),%r29
-	fstds		%fr6,-16(%r30)
-	ldw		-12(%r30),%r1
-	ldw		-16(%r30),%r28
-	sub		%r29,%r1,%r22
-	add		%r22,%r1,%r0
-	stw		%r22,0(%r26)
-	addc		%r0,%r28,%r28
-	bv		0(%r2)
-	 ldo		-64(%r30),%r30
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/hppa1.1/udiv_qrnnd.s b/sysdeps/hppa/hppa1.1/udiv_qrnnd.s
deleted file mode 100644
index fdc63e59e5..0000000000
--- a/sysdeps/hppa/hppa1.1/udiv_qrnnd.s
+++ /dev/null
@@ -1,78 +0,0 @@
-;! HP-PA  __udiv_qrnnd division support, used from longlong.h.
-;! This version runs fast on PA 7000 and later.
-
-;! Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! rem_ptr	gr26
-;! n1		gr25
-;! n0		gr24
-;! d		gr23
-
-	.text
-L$0000:	
-	.word		0x43f00000
-	.word		0x0
-	.export		__udiv_qrnnd
-__udiv_qrnnd:	
-	.proc
-	.callinfo	frame=64,no_calls
-	.entry
-	ldo		64(%r30),%r30
-
-	stws		%r25,-16(0,%r30)	;! n_hi
-	stws		%r24,-12(0,%r30)	;! n_lo
-	b,l		L$0,%r1
-	ldo		L$0000-L$0(%r1),%r1
-L$0:
-	fldds		-16(0,%r30),%fr5
-	stws		%r23,-12(0,%r30)
-	comib,<=	0,%r25,L$1
-	fcnvxf,dbl,dbl	%fr5,%fr5
-	fldds		0(0,%r1),%fr4
-	fadd,dbl	%fr4,%fr5,%fr5
-L$1:	
-	fcpy,sgl	%fr0,%fr6L
-	fldws		-12(0,%r30),%fr6R
-	fcnvxf,dbl,dbl	%fr6,%fr4
-
-	fdiv,dbl	%fr5,%fr4,%fr5
-
-	fcnvfx,dbl,dbl	%fr5,%fr4
-	fstws		%fr4R,-16(%r30)
-	xmpyu		%fr4R,%fr6R,%fr6
-	ldws		-16(%r30),%r28
-	fstds		%fr6,-16(0,%r30)
-	ldws		-12(0,%r30),%r21
-	ldws		-16(0,%r30),%r20
-	sub		%r24,%r21,%r22
-	subb		%r25,%r20,%r1
-	comib,=		0,%r1,L$2
-	ldo		-64(%r30),%r30
-
-	add		%r22,%r23,%r22
-	ldo		-1(%r28),%r28
-L$2:	
-	bv		0(%r2)
-	stws		%r22,0(0,%r26)
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/libgcc-compat.c b/sysdeps/hppa/libgcc-compat.c
deleted file mode 100644
index 2957eba89f..0000000000
--- a/sysdeps/hppa/libgcc-compat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* pre-.hidden libgcc compatibility
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Randolph Chung
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#include <stdint.h>
-#include <shlib-compat.h>
-
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_6)
-
-symbol_version (__clz_tab_internal, __clz_tab, GLIBC_2.2);
-
-typedef unsigned int UQItype  __attribute__ ((mode (QI)));
-
-const UQItype __clz_tab_internal[] =
-{
-  0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-};
-
-#endif
diff --git a/sysdeps/hppa/lshift.s b/sysdeps/hppa/lshift.s
deleted file mode 100644
index 400fbcf6dd..0000000000
--- a/sysdeps/hppa/lshift.s
+++ /dev/null
@@ -1,66 +0,0 @@
-;! HP-PA  __mpn_lshift --
-
-;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! res_ptr	gr26
-;! s_ptr	gr25
-;! size		gr24
-;! cnt		gr23
-
-	.text
-	.export		__mpn_lshift
-__mpn_lshift:
-	.proc
-	.callinfo	frame=64,no_calls
-	.entry
-
-	sh2add		%r24,%r25,%r25
-	sh2add		%r24,%r26,%r26
-	ldws,mb		-4(0,%r25),%r22
-	subi		32,%r23,%r1
-	mtsar		%r1
-	addib,=		-1,%r24,L$0004
-	vshd		%r0,%r22,%r28		;! compute carry out limb
-	ldws,mb		-4(0,%r25),%r29
-	addib,=		-1,%r24,L$0002
-	vshd		%r22,%r29,%r20
-
-L$loop:	ldws,mb		-4(0,%r25),%r22
-	stws,mb		%r20,-4(0,%r26)
-	addib,=		-1,%r24,L$0003
-	vshd		%r29,%r22,%r20
-	ldws,mb		-4(0,%r25),%r29
-	stws,mb		%r20,-4(0,%r26)
-	addib,<>	-1,%r24,L$loop
-	vshd		%r22,%r29,%r20
-
-L$0002:	stws,mb		%r20,-4(0,%r26)
-	vshd		%r29,%r0,%r20
-	bv		0(%r2)
-	stw		%r20,-4(0,%r26)
-L$0003:	stws,mb		%r20,-4(0,%r26)
-L$0004:	vshd		%r22,%r0,%r20
-	bv		0(%r2)
-	stw		%r20,-4(0,%r26)
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/machine-gmon.h b/sysdeps/hppa/machine-gmon.h
deleted file mode 100644
index 3eeef67377..0000000000
--- a/sysdeps/hppa/machine-gmon.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Machine-specific calling sequence for `mcount' profiling function.  PA-RISC
-   Copyright (C) 1995, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* We can call _mcount directly since gcc supplies the correct
- * arguments */
-#define _MCOUNT_DECL(from, self) \
- void _mcount (u_long from, u_long self)
-
-#define MCOUNT
diff --git a/sysdeps/hppa/memusage.h b/sysdeps/hppa/memusage.h
deleted file mode 100644
index d3dd10e10b..0000000000
--- a/sysdeps/hppa/memusage.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%r30"); stack_ptr; })
-#define STACK_GROWS_UPWARD 1
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/hppa/mp_clz_tab.c b/sysdeps/hppa/mp_clz_tab.c
deleted file mode 100644
index 52d06383c1..0000000000
--- a/sysdeps/hppa/mp_clz_tab.c
+++ /dev/null
@@ -1 +0,0 @@
-/* __clz_tab not needed on hppa.  */
diff --git a/sysdeps/hppa/rshift.s b/sysdeps/hppa/rshift.s
deleted file mode 100644
index acb772f523..0000000000
--- a/sysdeps/hppa/rshift.s
+++ /dev/null
@@ -1,63 +0,0 @@
-;! HP-PA  __mpn_rshift -- 
-
-;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! res_ptr	gr26
-;! s_ptr	gr25
-;! size		gr24
-;! cnt		gr23
-
-	.text
-	.export		__mpn_rshift
-__mpn_rshift:
-	.proc
-	.callinfo	frame=64,no_calls
-	.entry
-
-	ldws,ma		4(0,%r25),%r22
-	mtsar		%r23
-	addib,=		-1,%r24,L$0004
-	vshd		%r22,%r0,%r28		;! compute carry out limb
-	ldws,ma		4(0,%r25),%r29
-	addib,=		-1,%r24,L$0002
-	vshd		%r29,%r22,%r20
-
-L$loop:	ldws,ma		4(0,%r25),%r22
-	stws,ma		%r20,4(0,%r26)
-	addib,=		-1,%r24,L$0003
-	vshd		%r22,%r29,%r20
-	ldws,ma		4(0,%r25),%r29
-	stws,ma		%r20,4(0,%r26)
-	addib,<>	-1,%r24,L$loop
-	vshd		%r29,%r22,%r20
-
-L$0002:	stws,ma		%r20,4(0,%r26)
-	vshd		%r0,%r29,%r20
-	bv		0(%r2)
-	stw		%r20,0(0,%r26)
-L$0003:	stws,ma		%r20,4(0,%r26)
-L$0004:	vshd		%r0,%r22,%r20
-	bv		0(%r2)
-	stw		%r20,0(0,%r26)
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/setjmp.S b/sysdeps/hppa/setjmp.S
deleted file mode 100644
index f10a7a304d..0000000000
--- a/sysdeps/hppa/setjmp.S
+++ /dev/null
@@ -1,69 +0,0 @@
-/* setjmp for HPPA.
-   Copyright (C) 1995, 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-
-
-	.text
-	.align 4
-	.import __sigjmp_save, code
-	.globl __sigsetjmp
-	.export __sigsetjmp, code
-	.proc
-	.callinfo
-__sigsetjmp:
-	stw	%r3, 0(%r26)
-	stw	%r4, 8(%r26)
-	stw	%r5, 12(%r26)
-	stw	%r6, 16(%r26)
-	stw	%r7, 20(%r26)
-	stw	%r8, 24(%r26)
-	stw	%r9, 28(%r26)
-	stw	%r10, 32(%r26)
-	stw	%r11, 36(%r26)
-	stw	%r12, 40(%r26)
-	stw	%r13, 44(%r26)
-	stw	%r14, 48(%r26)
-	stw	%r15, 52(%r26)
-	stw	%r16, 56(%r26)
-	stw	%r17, 60(%r26)
-	stw	%r18, 64(%r26)
-	stw	%r19, 68(%r26)
-	stw	%r27, 72(%r26)
-	stw	%r30, 76(%r26)
-
-	stw	%rp, 80(%r26)
-
-	ldo	88(%r26),%r19
-	fstds,ma %fr12, 8(%r19) /* 88 */
-	fstds,ma %fr13, 8(%r19) /* 96 */
-	fstds,ma %fr14, 8(%r19) /* 104 */
-	fstds,ma %fr15, 8(%r19) /* 112 */
-	fstds,ma %fr16, 8(%r19) /* 120 */
-	fstds,ma %fr17, 8(%r19) /* 128 */
-	fstds,ma %fr18, 8(%r19) /* 136 */
-	fstds,ma %fr19, 8(%r19) /* 144 */
-	fstds,ma %fr20, 8(%r19) /* 152 */
-	fstds	 %fr21, 0(%r19) /* 160 */
-	b __sigjmp_save
-	nop
-	.procend
diff --git a/sysdeps/hppa/stackinfo.h b/sysdeps/hppa/stackinfo.h
deleted file mode 100644
index 318de7143b..0000000000
--- a/sysdeps/hppa/stackinfo.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-/* On PA the stack grows up.  */
-#define _STACK_GROWS_UP	1
-
-#endif	/* stackinfo.h */
diff --git a/sysdeps/hppa/sub_n.s b/sysdeps/hppa/sub_n.s
deleted file mode 100644
index 34f196826d..0000000000
--- a/sysdeps/hppa/sub_n.s
+++ /dev/null
@@ -1,59 +0,0 @@
-;! HP-PA  __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-;! store difference in a third limb vector.
-
-;! Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! res_ptr	gr26
-;! s1_ptr	gr25
-;! s2_ptr	gr24
-;! size		gr23
-
-;! One might want to unroll this as for other processors, but it turns
-;! out that the data cache contention after a store makes such
-;! unrolling useless.  We can't come under 5 cycles/limb anyway.
-
-	.text
-	.export		__mpn_sub_n
-__mpn_sub_n:
-	.proc
-	.callinfo	frame=0,no_calls
-	.entry
-
-	ldws,ma		4(0,%r25),%r21
-	ldws,ma		4(0,%r24),%r20
-
-	addib,=		-1,%r23,L$end	;! check for (SIZE == 1)
-	 sub		%r21,%r20,%r28	;! subtract first limbs ignoring cy
-
-L$loop:	ldws,ma		4(0,%r25),%r21
-	ldws,ma		4(0,%r24),%r20
-	stws,ma		%r28,4(0,%r26)
-	addib,<>	-1,%r23,L$loop
-	 subb		%r21,%r20,%r28
-
-L$end:	stws		%r28,0(0,%r26)
-	addc		%r0,%r0,%r28
-	bv		0(%r2)
-	 subi		1,%r28,%r28
-
-	.exit
-	.procend
diff --git a/sysdeps/hppa/sysdep.h b/sysdeps/hppa/sysdep.h
deleted file mode 100644
index be36567434..0000000000
--- a/sysdeps/hppa/sysdep.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Assembler macros for HP/PA.
-   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/generic/sysdep.h>
-#include <sys/syscall.h>
-#include "config.h"
-
-#ifndef ASM_LINE_SEP
-#define ASM_LINE_SEP ;
-#endif
-
-#ifdef	__ASSEMBLER__
-
-/* Syntactic details of assembler.  */
-
-#define ALIGNARG(log2) log2
-
-
-/* Define an entry point visible from C.
-
-   There is currently a bug in gdb which prevents us from specifying
-   incomplete stabs information.  Fake some entries here which specify
-   the current source file.  */
-#define	ENTRY(name)							      \
-  .SPACE $TEXT$							ASM_LINE_SEP  \
-  .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY		ASM_LINE_SEP  \
-  .align ALIGNARG(4)						ASM_LINE_SEP  \
-  .NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY		ASM_LINE_SEP  \
-  .EXPORT C_SYMBOL_NAME(name),ENTRY,PRIV_LEV=3,ARGW0=GR,RTNVAL=GR ASM_LINE_SEP\
-  C_LABEL(name)								      \
-  CALL_MCOUNT
-
-#undef	END
-#define END(name)							      \
-  .PROCEND
-
-
-/* If compiled for profiling, call `mcount' at the start of each function.  */
-#ifdef	PROF
-/* The mcount code relies on a normal frame pointer being on the stack
-   to locate our caller, so push one just for its benefit.  */
-#define CALL_MCOUNT \
-  XXX	ASM_LINE_SEP
-#else
-#define CALL_MCOUNT		/* Do nothing.  */
-#endif
-
-#define	PSEUDO(name, syscall_name, args)				      \
-  ENTRY (name)								      \
-  DO_CALL (syscall_name, args)
-
-#undef	PSEUDO_END
-#define	PSEUDO_END(name)						      \
-  END (name)
-
-#undef JUMPTARGET
-#define JUMPTARGET(name)	name
-#define SYSCALL_PIC_SETUP	/* Nothing.  */
-
-/* Local label name for asm code. */
-#ifndef L
-#define L(name)		name
-#endif
-
-#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/hppa/udiv_qrnnd.s b/sysdeps/hppa/udiv_qrnnd.s
deleted file mode 100644
index cd2b58ddec..0000000000
--- a/sysdeps/hppa/udiv_qrnnd.s
+++ /dev/null
@@ -1,286 +0,0 @@
-;! HP-PA  __udiv_qrnnd division support, used from longlong.h.
-;! This version runs fast on pre-PA7000 CPUs.
-
-;! Copyright (C) 1993, 1994 Free Software Foundation, Inc.
-
-;! This file is part of the GNU MP Library.
-
-;! The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-;! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-;! MA 02111-1307, USA.
-
-
-;! INPUT PARAMETERS
-;! rem_ptr	gr26
-;! n1		gr25
-;! n0		gr24
-;! d		gr23
-
-;! The code size is a bit excessive.  We could merge the last two ds;addc
-;! sequences by simply moving the "bb,< Odd" instruction down.  The only
-;! trouble is the FFFFFFFF code that would need some hacking.
-
-	.text
-	.export		__udiv_qrnnd
-__udiv_qrnnd:
-	.proc
-	.callinfo	frame=0,no_calls
-	.entry
-
-	comb,<		%r23,0,L$largedivisor
-	 sub		%r0,%r23,%r1		;! clear cy as side-effect
-	ds		%r0,%r1,%r0
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r23,%r25
-	addc		%r24,%r24,%r28
-	ds		%r25,%r23,%r25
-	comclr,>=	%r25,%r0,%r0
-	addl		%r25,%r23,%r25
-	stws		%r25,0(0,%r26)
-	bv		0(%r2)
-	 addc		%r28,%r28,%r28
-
-L$largedivisor:
-	extru		%r24,31,1,%r20		;! r20 = n0 & 1
-	bb,<		%r23,31,L$odd
-	 extru		%r23,30,31,%r22		;! r22 = d >> 1
-	shd		%r25,%r24,1,%r24	;! r24 = new n0
-	extru		%r25,30,31,%r25		;! r25 = new n1
-	sub		%r0,%r22,%r21
-	ds		%r0,%r21,%r0
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	comclr,>=	%r25,%r0,%r0
-	addl		%r25,%r22,%r25
-	sh1addl		%r25,%r20,%r25
-	stws		%r25,0(0,%r26)
-	bv		0(%r2)
-	 addc		%r24,%r24,%r28
-
-L$odd:	addib,sv,n	1,%r22,L$FF..		;! r22 = (d / 2 + 1)
-	shd		%r25,%r24,1,%r24	;! r24 = new n0
-	extru		%r25,30,31,%r25		;! r25 = new n1
-	sub		%r0,%r22,%r21
-	ds		%r0,%r21,%r0
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r24
-	ds		%r25,%r22,%r25
-	addc		%r24,%r24,%r28
-	comclr,>=	%r25,%r0,%r0
-	addl		%r25,%r22,%r25
-	sh1addl		%r25,%r20,%r25
-;! We have computed (n1,,n0) / (d + 1), q' = r28, r' = r25
-	add,nuv		%r28,%r25,%r25
-	addl		%r25,%r1,%r25
-	addc		%r0,%r28,%r28
-	sub,<<		%r25,%r23,%r0
-	addl		%r25,%r1,%r25
-	stws		%r25,0(0,%r26)
-	bv		0(%r2)
-	 addc		%r0,%r28,%r28
-
-;! This is just a special case of the code above.
-;! We come here when d == 0xFFFFFFFF
-L$FF..:	add,uv		%r25,%r24,%r24
-	sub,<<		%r24,%r23,%r0
-	ldo		1(%r24),%r24
-	stws		%r24,0(0,%r26)
-	bv		0(%r2)
-	 addc		%r0,%r25,%r28
-
-	.exit
-	.procend
diff --git a/sysdeps/i386/Dist b/sysdeps/i386/Dist
deleted file mode 100644
index 34cc8b0fdc..0000000000
--- a/sysdeps/i386/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-i386-mcount.S
-machine-gmon.h
-bp-asm.h
-bits/link.h
diff --git a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
index 52faaa3109..e192b91dbd 100644
--- a/sysdeps/i386/Makefile
+++ b/sysdeps/i386/Makefile
@@ -8,7 +8,7 @@ long-double-fcts = yes
 ifeq ($(subdir),csu)
 # On i686 we must avoid generating the trampoline functions generated
 # to get the GOT pointer.
-CFLAGS-initfini.s += -march=i386 -mcpu=i386
+CFLAGS-initfini.s += -march=i386 -mtune=i386
 endif
 
 ifeq ($(subdir),gmon)
@@ -61,3 +61,15 @@ CFLAGS-dlopenold.c += -mpreferred-stack-boundary=4
 CFLAGS-dlclose.c += -mpreferred-stack-boundary=4
 CFLAGS-dlerror.c += -mpreferred-stack-boundary=4
 endif
+
+ifneq (,$(filter -mno-tls-direct-seg-refs,$(CFLAGS)))
+defines += -DNO_TLS_DIRECT_SEG_REFS
+else
+# .a libraries are not performance critical and so we
+# build them without direct TLS segment references
+# always.
+CPPFLAGS-.o += -DNO_TLS_DIRECT_SEG_REFS
+CFLAGS-.o += -mno-tls-direct-seg-refs
+CPPFLAGS-.oS += -DNO_TLS_DIRECT_SEG_REFS
+CFLAGS-.oS += -mno-tls-direct-seg-refs
+endif
diff --git a/sysdeps/i386/Versions b/sysdeps/i386/Versions
index b20d7cc027..b0230d31cf 100644
--- a/sysdeps/i386/Versions
+++ b/sysdeps/i386/Versions
@@ -20,3 +20,10 @@ libc {
     __strspn_cg; __strspn_g; __strstr_cg; __strstr_g;
   }
 }
+libm {
+  GLIBC_2.1 {
+    # A generic bug got this omitted from other configurations' version
+    # sets, but we always had it.
+    exp2l;
+  }
+}
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index 6b590f7f04..559d56b250 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -1,5 +1,5 @@
 /* longjmp for i386.
-   Copyright (C) 1995,1996,1997,1998,2000,2002 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998,2000,2002,2005, 2006 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
@@ -18,9 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
 #include <bp-sym.h>
 #include <bp-asm.h>
@@ -32,6 +30,36 @@
 ENTRY (BP_SYM (__longjmp))
 	ENTER
 
+#ifdef PTR_DEMANGLE
+	movl JBUF(%esp), %eax	/* User's jmp_buf in %eax.  */
+	CHECK_BOUNDS_BOTH_WIDE (%eax, JBUF(%esp), $JB_SIZE)
+
+	/* Save the return address now.  */
+	movl (JB_PC*4)(%eax), %edx
+	/* Get the stack pointer.  */
+	movl (JB_SP*4)(%eax), %ecx
+	PTR_DEMANGLE (%edx)
+	PTR_DEMANGLE (%ecx)
+	cfi_def_cfa(%eax, 0)
+	cfi_register(%eip, %edx)
+	cfi_register(%esp, %ecx)
+	cfi_offset(%ebx, JB_BX*4)
+	cfi_offset(%esi, JB_SI*4)
+	cfi_offset(%edi, JB_DI*4)
+	cfi_offset(%ebp, JB_BP*4)
+     	/* Restore registers.  */
+	movl (JB_BX*4)(%eax), %ebx
+	movl (JB_SI*4)(%eax), %esi
+	movl (JB_DI*4)(%eax), %edi
+	movl (JB_BP*4)(%eax), %ebp
+	cfi_restore(%ebx)
+	cfi_restore(%esi)
+	cfi_restore(%edi)
+	cfi_restore(%ebp)
+
+	movl VAL(%esp), %eax	/* Second argument is return value.  */
+	movl %ecx, %esp
+#else
 	movl JBUF(%esp), %ecx	/* User's jmp_buf in %ecx.  */
 	CHECK_BOUNDS_BOTH_WIDE (%ecx, JBUF(%esp), $JB_SIZE)
 
@@ -44,6 +72,7 @@ ENTRY (BP_SYM (__longjmp))
 	movl (JB_DI*4)(%ecx), %edi
 	movl (JB_BP*4)(%ecx), %ebp
 	movl (JB_SP*4)(%ecx), %esp
+#endif
 	/* Jump to saved PC.  */
      	jmp *%edx
 END (BP_SYM (__longjmp))
diff --git a/sysdeps/i386/add_n.S b/sysdeps/i386/add_n.S
index f43a4757b2..c7a5ce721b 100644
--- a/sysdeps/i386/add_n.S
+++ b/sysdeps/i386/add_n.S
@@ -1,6 +1,6 @@
 /* Add two limb vectors of the same length > 0 and store sum in a third
    limb vector.
-   Copyright (C) 1992, 94, 95, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,94,95,97,98,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -34,10 +34,14 @@ ENTRY (BP_SYM (__mpn_add_n))
 	ENTER
 
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 
 	movl RES(%esp),%edi
+	cfi_rel_offset (edi, 4)
 	movl S1(%esp),%esi
+	cfi_rel_offset (esi, 0)
 	movl S2(%esp),%edx
 	movl SIZE(%esp),%ecx
 #if __BOUNDED_POINTERS__
@@ -62,10 +66,12 @@ ENTRY (BP_SYM (__mpn_add_n))
 /* Calculate start address in loop for PIC.  Due to limitations in some
    assemblers, Loop-L0-3 cannot be put into the leal */
 	call	L(0)
+	cfi_adjust_cfa_offset (4)
 L(0):	leal	(%eax,%eax,8),%eax
 	addl	(%esp),%eax
 	addl	$(L(oop)-L(0)-3),%eax
 	addl	$4,%esp
+	cfi_adjust_cfa_offset (-4)
 #else
 /* Calculate start address in loop for non-PIC.  */
  	leal	(L(oop) - 3)(%eax,%eax,8),%eax
@@ -106,7 +112,11 @@ L(oop):	movl	(%esi),%eax
 	negl	%eax
 
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/addmul_1.S b/sysdeps/i386/addmul_1.S
index fb1042efb8..df501726c5 100644
--- a/sysdeps/i386/addmul_1.S
+++ b/sysdeps/i386/addmul_1.S
@@ -1,6 +1,6 @@
 /* i80386 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
    the result to a second limb vector.
-   Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,1994,1997,1998,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -38,15 +38,22 @@
 ENTRY (BP_SYM (__mpn_addmul_1))
 	ENTER
 
-	pushl	%edi
-	pushl	%esi
+	pushl	%res_ptr
+	cfi_adjust_cfa_offset (4)
+	pushl	%s1_ptr
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
-	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%s2_limb
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp), %res_ptr
+	cfi_rel_offset (res_ptr, 12)
 	movl	S1(%esp), %s1_ptr
+	cfi_rel_offset (s1_ptr, 8)
 	movl	SIZE(%esp), %sizeP
 	movl	S2LIMB(%esp), %s2_limb
+	cfi_rel_offset (s2_limb, 0)
 #if __BOUNDED_POINTERS__
 	shll	$2, %sizeP	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
@@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_addmul_1))
 	leal	(%s1_ptr,%sizeP,4), %s1_ptr
 	negl	%sizeP
 	xorl	%ebp, %ebp
+	cfi_rel_offset (ebp, 4)
 	ALIGN (3)
 L(oop):
 	movl	(%s1_ptr,%sizeP,4), %eax
@@ -71,10 +79,18 @@ L(oop):
 	jnz	L(oop)
 	movl	%ebp, %eax
 
-	popl	%ebx
+	popl	%s2_limb
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s2_limb)
 	popl	%ebp
-	popl	%esi
-	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%s1_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s1_ptr)
+	popl	%res_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (res_ptr)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/backtrace.c b/sysdeps/i386/backtrace.c
index cb7530396b..8b61913dde 100644
--- a/sysdeps/i386/backtrace.c
+++ b/sysdeps/i386/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -141,3 +141,4 @@ __backtrace (array, size)
   return arg.cnt != -1 ? arg.cnt : 0;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/i386/bits/byteswap.h b/sysdeps/i386/bits/byteswap.h
index 33af208888..7f2ddc2dc5 100644
--- a/sysdeps/i386/bits/byteswap.h
+++ b/sysdeps/i386/bits/byteswap.h
@@ -1,5 +1,6 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2006, 2007
+   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
@@ -65,7 +66,9 @@ __bswap_16 (unsigned short int __bsx)
 /* To swap the bytes in a word the i486 processors and up provide the
    `bswap' opcode.  On i386 we have to use three instructions.  */
 #  if !defined __i486__ && !defined __pentium__ && !defined __pentiumpro__ \
-      && !defined __pentium4__
+      && !defined __pentium4__ && !defined __k8__ && !defined __athlon__ \
+      && !defined __k6__ && !defined __nocona__ && !defined __core2__ \
+      && !defined __geode__ && !defined __amdfam10__
 #   define __bswap_32(x)						      \
      (__extension__							      \
       ({ register unsigned int __v, __x = (x);				      \
diff --git a/sysdeps/i386/bits/link.h b/sysdeps/i386/bits/link.h
index 3be9b7eae8..985d040413 100644
--- a/sysdeps/i386/bits/link.h
+++ b/sysdeps/i386/bits/link.h
@@ -1,5 +1,60 @@
-struct link_map_machine
-  {
-    Elf32_Addr plt; /* Address of .plt + 0x16 */
-    Elf32_Addr gotplt; /* Address of .got + 0x0c */
-  };
+/* Copyright (C) 2004, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+
+/* Registers for entry into PLT on IA-32.  */
+typedef struct La_i86_regs
+{
+  uint32_t lr_edx;
+  uint32_t lr_ecx;
+  uint32_t lr_eax;
+  uint32_t lr_ebp;
+  uint32_t lr_esp;
+} La_i86_regs;
+
+/* Return values for calls from PLT on IA-32.  */
+typedef struct La_i86_retval
+{
+  uint32_t lrv_eax;
+  uint32_t lrv_edx;
+  long double lrv_st0;
+  long double lrv_st1;
+} La_i86_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
+				       uintptr_t *__refcook,
+				       uintptr_t *__defcook,
+				       La_i86_regs *__regs,
+				       unsigned int *__flags,
+				       const char *__symname,
+				       long int *__framesizep);
+extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
+					uintptr_t *__refcook,
+					uintptr_t *__defcook,
+					const La_i86_regs *__inregs,
+					La_i86_retval *__outregs,
+					const char *symname);
+
+__END_DECLS
diff --git a/sysdeps/i386/bits/linkmap.h b/sysdeps/i386/bits/linkmap.h
new file mode 100644
index 0000000000..3be9b7eae8
--- /dev/null
+++ b/sysdeps/i386/bits/linkmap.h
@@ -0,0 +1,5 @@
+struct link_map_machine
+  {
+    Elf32_Addr plt; /* Address of .plt + 0x16 */
+    Elf32_Addr gotplt; /* Address of .got + 0x0c */
+  };
diff --git a/sysdeps/i386/fpu/bits/mathdef.h b/sysdeps/i386/bits/mathdef.h
index ec42ed5df9..ec42ed5df9 100644
--- a/sysdeps/i386/fpu/bits/mathdef.h
+++ b/sysdeps/i386/bits/mathdef.h
diff --git a/sysdeps/i386/bits/setjmp.h b/sysdeps/i386/bits/setjmp.h
index 107fe58b35..0133c40e70 100644
--- a/sysdeps/i386/bits/setjmp.h
+++ b/sysdeps/i386/bits/setjmp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2001,2003,2005,2006
+	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
@@ -24,23 +25,8 @@
 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
 #endif
 
-#if defined __USE_MISC || defined _ASM
-# define JB_BX	0
-# define JB_SI	1
-# define JB_DI	2
-# define JB_BP	3
-# define JB_SP	4
-# define JB_PC	5
-# define JB_SIZE 24
-#endif
-
 #ifndef	_ASM
 typedef int __jmp_buf[6];
 #endif
 
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_SP])
-
 #endif	/* bits/setjmp.h */
diff --git a/sysdeps/i386/bits/string.h b/sysdeps/i386/bits/string.h
deleted file mode 100644
index d181afd48b..0000000000
--- a/sysdeps/i386/bits/string.h
+++ /dev/null
@@ -1,922 +0,0 @@
-/* Optimized, inlined string functions.  i386 version.
-   Copyright (C) 1997,1998,1999,2000,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _STRING_H
-# error "Never use <bits/string.h> directly; include <string.h> instead."
-#endif
-
-/* The ix86 processors can access unaligned multi-byte variables.  */
-#define _STRING_ARCH_unaligned	1
-
-
-/* We only provide optimizations if the user selects them and if
-   GNU CC is used.  */
-#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \
-    && defined __GNUC__ && __GNUC__ >= 2 && !__BOUNDED_POINTERS__
-
-#ifndef __STRING_INLINE
-# ifdef __cplusplus
-#  define __STRING_INLINE inline
-# else
-#  define __STRING_INLINE extern __inline
-# endif
-#endif
-
-
-/* Copy N bytes of SRC to DEST.  */
-#define _HAVE_STRING_ARCH_memcpy 1
-#define memcpy(dest, src, n) \
-  (__extension__ (__builtin_constant_p (n)				      \
-		  ? __memcpy_c ((dest), (src), (n))			      \
-		  : memcpy ((dest), (src), (n))))
-/* This looks horribly ugly, but the compiler can optimize it totally,
-   as the count is constant.  */
-__STRING_INLINE void *__memcpy_c (void *__dest, __const void *__src,
-				  size_t __n);
-
-__STRING_INLINE void *
-__memcpy_c (void *__dest, __const void *__src, size_t __n)
-{
-  register unsigned long int __d0, __d1, __d2;
-  union {
-    unsigned int __ui;
-    unsigned short int __usi;
-    unsigned char __uc;
-  } *__u = __dest;
-  switch (__n)
-    {
-    case 0:
-      return __dest;
-    case 1:
-      __u->__uc = *(const unsigned char *) __src;
-      return __dest;
-    case 2:
-      __u->__usi = *(const unsigned short int *) __src;
-      return __dest;
-    case 3:
-      __u->__usi = *(const unsigned short int *) __src;
-      __u = (void *) __u + 2;
-      __u->__uc = *(2 + (const unsigned char *) __src);
-      return __dest;
-    case 4:
-      __u->__ui = *(const unsigned int *) __src;
-      return __dest;
-    case 6:
-      __u->__ui = *(const unsigned int *) __src;
-      __u = (void *) __u + 4;
-      __u->__usi = *(2 + (const unsigned short int *) __src);
-      return __dest;
-    case 8:
-      __u->__ui = *(const unsigned int *) __src;
-      __u = (void *) __u + 4;
-      __u->__ui = *(1 + (const unsigned int *) __src);
-      return __dest;
-    case 12:
-      __u->__ui = *(const unsigned int *) __src;
-      __u = (void *) __u + 4;
-      __u->__ui = *(1 + (const unsigned int *) __src);
-      __u = (void *) __u + 4;
-      __u->__ui = *(2 + (const unsigned int *) __src);
-      return __dest;
-    case 16:
-      __u->__ui = *(const unsigned int *) __src;
-      __u = (void *) __u + 4;
-      __u->__ui = *(1 + (const unsigned int *) __src);
-      __u = (void *) __u + 4;
-      __u->__ui = *(2 + (const unsigned int *) __src);
-      __u = (void *) __u + 4;
-      __u->__ui = *(3 + (const unsigned int *) __src);
-      return __dest;
-    case 20:
-      __u->__ui = *(const unsigned int *) __src;
-      __u = (void *) __u + 4;
-      __u->__ui = *(1 + (const unsigned int *) __src);
-      __u = (void *) __u + 4;
-      __u->__ui = *(2 + (const unsigned int *) __src);
-      __u = (void *) __u + 4;
-      __u->__ui = *(3 + (const unsigned int *) __src);
-      __u = (void *) __u + 4;
-      __u->__ui = *(4 + (const unsigned int *) __src);
-      return __dest;
-    }
-#define __COMMON_CODE(x) \
-  __asm__ __volatile__							      \
-    ("cld\n\t"								      \
-     "rep; movsl"							      \
-     x									      \
-     : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2)				      \
-     : "0" (__n / 4), "1" (&__u->__uc), "2" (__src)			      \
-     : "memory");
-
-  switch (__n % 4)
-    {
-    case 0:
-      __COMMON_CODE ("");
-      break;
-    case 1:
-      __COMMON_CODE ("\n\tmovsb");
-      break;
-    case 2:
-      __COMMON_CODE ("\n\tmovsw");
-      break;
-    case 3:
-      __COMMON_CODE ("\n\tmovsw\n\tmovsb");
-      break;
-  }
-  return __dest;
-#undef __COMMON_CODE
-}
-
-
-/* Copy N bytes of SRC to DEST, guaranteeing
-   correct behavior for overlapping strings.  */
-#define _HAVE_STRING_ARCH_memmove 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE void *
-memmove (void *__dest, __const void *__src, size_t __n)
-{
-  register unsigned long int __d0, __d1, __d2;
-  if (__dest < __src)
-    __asm__ __volatile__
-      ("cld\n\t"
-       "rep\n\t"
-       "movsb"
-       : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
-       : "0" (__n), "1" (__src), "2" (__dest)
-       : "memory");
-  else
-    __asm__ __volatile__
-      ("std\n\t"
-       "rep\n\t"
-       "movsb\n\t"
-       "cld"
-       : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
-       : "0" (__n), "1" (__n - 1 + (const char *) __src),
-	 "2" (__n - 1 + (char *) __dest)
-       : "memory");
-  return __dest;
-}
-#endif
-
-/* Set N bytes of S to C.  */
-#define _HAVE_STRING_ARCH_memset 1
-#define _USE_STRING_ARCH_memset 1
-#define memset(s, c, n) \
-  (__extension__ (__builtin_constant_p (c)				      \
-		  ? (__builtin_constant_p (n)				      \
-		     ? __memset_cc (s, 0x01010101UL * (unsigned char) (c), n) \
-		     : __memset_cg (s, 0x01010101UL * (unsigned char) (c), n))\
-		  : __memset_gg (s, c, n)))
-
-__STRING_INLINE void *__memset_cc (void *__s, unsigned long int __pattern,
-				   size_t __n);
-
-__STRING_INLINE void *
-__memset_cc (void *__s, unsigned long int __pattern, size_t __n)
-{
-  register unsigned long int __d0, __d1;
-  union {
-    unsigned int __ui;
-    unsigned short int __usi;
-    unsigned char __uc;
-  } *__u = __s;
-  switch (__n)
-    {
-    case 0:
-      return __s;
-    case 1:
-      __u->__uc = __pattern;
-      return __s;
-    case 2:
-      __u->__usi = __pattern;
-      return __s;
-    case 3:
-      __u->__usi = __pattern;
-      __u = __extension__ ((void *) __u + 2);
-      __u->__uc = __pattern;
-      return __s;
-    case 4:
-      __u->__ui = __pattern;
-      return __s;
-	}
-#define __COMMON_CODE(x) \
-  __asm__ __volatile__							      \
-    ("cld\n\t"								      \
-     "rep; stosl"							      \
-     x									      \
-     : "=&c" (__d0), "=&D" (__d1)					      \
-     : "a" (__pattern), "0" (__n / 4), "1" (&__u->__uc)			      \
-     : "memory")
-
-  switch (__n % 4)
-    {
-    case 0:
-      __COMMON_CODE ("");
-      break;
-    case 1:
-      __COMMON_CODE ("\n\tstosb");
-      break;
-    case 2:
-      __COMMON_CODE ("\n\tstosw");
-      break;
-    case 3:
-      __COMMON_CODE ("\n\tstosw\n\tstosb");
-      break;
-    }
-  return __s;
-#undef __COMMON_CODE
-}
-
-__STRING_INLINE void *__memset_cg (void *__s, unsigned long __c, size_t __n);
-
-__STRING_INLINE void *
-__memset_cg (void *__s, unsigned long __c, size_t __n)
-{
-  register unsigned long int __d0, __d1;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "rep; stosl\n\t"
-     "testb	$2,%b3\n\t"
-     "je	1f\n\t"
-     "stosw\n"
-     "1:\n\t"
-     "testb	$1,%b3\n\t"
-     "je	2f\n\t"
-     "stosb\n"
-     "2:"
-     : "=&c" (__d0), "=&D" (__d1)
-     : "a" (__c), "q" (__n), "0" (__n / 4), "1" (__s)
-     : "memory");
-  return __s;
-}
-
-__STRING_INLINE void *__memset_gg (void *__s, char __c, size_t __n);
-
-__STRING_INLINE void *
-__memset_gg (void *__s, char __c, size_t __n)
-{
-  register unsigned long int __d0, __d1;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "rep; stosb"
-     : "=&D" (__d0), "=&c" (__d1)
-     : "a" (__c), "0" (__s), "1" (__n)
-     : "memory");
-  return __s;
-}
-
-
-
-
-/* Search N bytes of S for C.  */
-#define _HAVE_STRING_ARCH_memchr 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE void *
-memchr (__const void *__s, int __c, size_t __n)
-{
-  register unsigned long int __d0;
-  register void *__res;
-  if (__n == 0)
-    return NULL;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "repne; scasb\n\t"
-     "je 1f\n\t"
-     "movl $1,%0\n"
-     "1:"
-     : "=D" (__res), "=&c" (__d0)
-     : "a" (__c), "0" (__s), "1" (__n),
-       "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
-     : "cc");
-  return __res - 1;
-}
-#endif
-
-#define _HAVE_STRING_ARCH_memrchr 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE void *
-__memrchr (__const void *__s, int __c, size_t __n)
-{
-  register unsigned long int __d0;
-  register void *__res;
-  if (__n == 0)
-    return NULL;
-  __asm__ __volatile__
-    ("std\n\t"
-     "repne; scasb\n\t"
-     "je 1f\n\t"
-     "orl $-1,%0\n"
-     "1:\tcld\n\t"
-     "incl %0"
-     : "=D" (__res), "=&c" (__d0)
-     : "a" (__c), "0" (__s + __n - 1), "1" (__n),
-       "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
-     : "cc");
-  return __res;
-}
-# ifdef __USE_GNU
-#  define memrchr(s, c, n) __memrchr (s, c, n)
-# endif
-#endif
-
-/* Return the length of S.  */
-#define _HAVE_STRING_ARCH_strlen 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE size_t
-strlen (__const char *__str)
-{
-  register unsigned long int __d0;
-  register size_t __res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "repne; scasb\n\t"
-     "notl %0"
-     : "=c" (__res), "=&D" (__d0)
-     : "1" (__str), "a" (0), "0" (0xffffffff),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__str)
-     : "cc");
-  return __res - 1;
-}
-#endif
-
-/* Copy SRC to DEST.  */
-#define _HAVE_STRING_ARCH_strcpy 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE char *
-strcpy (char *__dest, __const char *__src)
-{
-  register unsigned long int __d0, __d1;
-  __asm__ __volatile__
-    ("cld\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "stosb\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b"
-     : "=&S" (__d0), "=&D" (__d1)
-     : "0" (__src), "1" (__dest)
-     : "ax", "memory", "cc");
-  return __dest;
-}
-#endif
-
-/* Copy no more than N characters of SRC to DEST.  */
-#define _HAVE_STRING_ARCH_strncpy 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE char *
-strncpy (char *__dest, __const char *__src, size_t __n)
-{
-  register unsigned long int __d0, __d1, __d2;
-  __asm__ __volatile__
-    ("cld\n"
-     "1:\n\t"
-     "decl	%2\n\t"
-     "js	2f\n\t"
-     "lodsb\n\t"
-     "stosb\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n\t"
-     "rep; stosb\n"
-     "2:"
-     : "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
-     : "0" (__src), "1" (__dest), "2" (__n)
-     : "ax", "memory", "cc");
-  return __dest;
-}
-#endif
-
-/* Append SRC onto DEST.  */
-#define _HAVE_STRING_ARCH_strcat 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE char *
-strcat (char *__dest, __const char *__src)
-{
-  register unsigned long int __d0, __d1, __d2, __d3;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "repne; scasb\n\t"
-     "decl	%1\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "stosb\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b"
-     : "=&S" (__d0), "=&D" (__d1), "=&c" (__d2), "=&a" (__d3)
-     : "0" (__src), "1" (__dest), "2" (0xffffffff), "3" (0)
-     : "memory", "cc");
-  return __dest;
-}
-#endif
-
-/* Append no more than N characters from SRC onto DEST.  */
-#define _HAVE_STRING_ARCH_strncat 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE char *
-strncat (char *__dest, __const char *__src, size_t __n)
-{
-  register unsigned long int __d0, __d1, __d2, __d3;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "repne; scasb\n\t"
-     "decl	%1\n\t"
-     "movl	%4,%2\n"
-     "1:\n\t"
-     "decl	%2\n\t"
-     "js	2f\n\t"
-     "lodsb\n\t"
-     "stosb\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n\t"
-     "jmp	3f\n"
-     "2:\n\t"
-     "xorl	%3,%3\n\t"
-     "stosb\n"
-     "3:"
-     : "=&S" (__d0), "=&D" (__d1), "=&c" (__d2), "=&a" (__d3)
-     : "g" (__n), "0" (__src), "1" (__dest), "2" (0xffffffff), "3" (0)
-     : "memory", "cc");
-  return __dest;
-}
-#endif
-
-/* Compare S1 and S2.  */
-#define _HAVE_STRING_ARCH_strcmp 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE int
-strcmp (__const char *__s1, __const char *__s2)
-{
-  register unsigned long int __d0, __d1;
-  register int __res;
-  __asm__ __volatile__
-    ("cld\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "scasb\n\t"
-     "jne	2f\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n\t"
-     "xorl	%%eax,%%eax\n\t"
-     "jmp	3f\n"
-     "2:\n\t"
-     "sbbl	%%eax,%%eax\n\t"
-     "orb	$1,%%al\n"
-     "3:"
-     : "=a" (__res), "=&S" (__d0), "=&D" (__d1)
-     : "1" (__s1), "2" (__s2),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s1),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s2)
-     : "cc");
-  return __res;
-}
-#endif
-
-/* Compare N characters of S1 and S2.  */
-#define _HAVE_STRING_ARCH_strncmp 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE int
-strncmp (__const char *__s1, __const char *__s2, size_t __n)
-{
-  register unsigned long int __d0, __d1, __d2;
-  register int __res;
-  __asm__ __volatile__
-    ("cld\n"
-     "1:\n\t"
-     "decl	%3\n\t"
-     "js	2f\n\t"
-     "lodsb\n\t"
-     "scasb\n\t"
-     "jne	3f\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n"
-     "2:\n\t"
-     "xorl	%%eax,%%eax\n\t"
-     "jmp	4f\n"
-     "3:\n\t"
-     "sbbl	%%eax,%%eax\n\t"
-     "orb	$1,%%al\n"
-     "4:"
-     : "=a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
-     : "1" (__s1), "2" (__s2), "3" (__n),
-       "m" ( *(struct { __extension__ char __x[__n]; } *)__s1),
-       "m" ( *(struct { __extension__ char __x[__n]; } *)__s2)
-     : "cc");
-  return __res;
-}
-#endif
-
-/* Find the first occurrence of C in S.  */
-#define _HAVE_STRING_ARCH_strchr 1
-#define _USE_STRING_ARCH_strchr 1
-#define strchr(s, c) \
-  (__extension__ (__builtin_constant_p (c)				      \
-		  ? __strchr_c (s, ((c) & 0xff) << 8)			      \
-		  : __strchr_g (s, c)))
-
-__STRING_INLINE char *__strchr_g (__const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchr_g (__const char *__s, int __c)
-{
-  register unsigned long int __d0;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "movb	%%al,%%ah\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "cmpb	%%ah,%%al\n\t"
-     "je	2f\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n\t"
-     "movl	$1,%1\n"
-     "2:\n\t"
-     "movl	%1,%0"
-     : "=a" (__res), "=&S" (__d0)
-     : "0" (__c), "1" (__s),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return __res - 1;
-}
-
-__STRING_INLINE char *__strchr_c (__const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchr_c (__const char *__s, int __c)
-{
-  register unsigned long int __d0;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "1:\n\t"
-     "lodsb\n\t"
-     "cmpb	%%ah,%%al\n\t"
-     "je	2f\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n\t"
-     "movl	$1,%1\n"
-     "2:\n\t"
-     "movl	%1,%0"
-     : "=a" (__res), "=&S" (__d0)
-     : "0" (__c), "1" (__s),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return __res - 1;
-}
-
-
-/* Find the first occurrence of C in S or the final NUL byte.  */
-#define _HAVE_STRING_ARCH_strchrnul 1
-#define __strchrnul(s, c) \
-  (__extension__ (__builtin_constant_p (c)				      \
-		  ? ((c) == '\0'					      \
-		     ? (char *) __rawmemchr (s, c)			      \
-		     : __strchrnul_c (s, ((c) & 0xff) << 8))		      \
-		  : __strchrnul_g (s, c)))
-
-__STRING_INLINE char *__strchrnul_g (__const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchrnul_g (__const char *__s, int __c)
-{
-  register unsigned long int __d0;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "movb	%%al,%%ah\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "cmpb	%%ah,%%al\n\t"
-     "je	2f\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n\t"
-     "2:\n\t"
-     "movl	%1,%0"
-     : "=a" (__res), "=&S" (__d0)
-     : "0" (__c), "1" (__s),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return __res - 1;
-}
-
-__STRING_INLINE char *__strchrnul_c (__const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchrnul_c (__const char *__s, int __c)
-{
-  register unsigned long int __d0;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "1:\n\t"
-     "lodsb\n\t"
-     "cmpb	%%ah,%%al\n\t"
-     "je	2f\n\t"
-     "testb	%%al,%%al\n\t"
-     "jne	1b\n\t"
-     "2:\n\t"
-     "movl	%1,%0"
-     : "=a" (__res), "=&S" (__d0)
-     : "0" (__c), "1" (__s),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return __res - 1;
-}
-#ifdef __USE_GNU
-# define strchrnul(s, c) __strchrnul (s, c)
-#endif
-
-
-/* Return the length of the initial segment of S which
-   consists entirely of characters not in REJECT.  */
-#define _HAVE_STRING_ARCH_strcspn 1
-#ifndef _FORCE_INLINES
-# ifdef __PIC__
-__STRING_INLINE size_t
-strcspn (__const char *__s, __const char *__reject)
-{
-  register unsigned long int __d0, __d1, __d2;
-  register char *__res;
-  __asm__ __volatile__
-    ("pushl	%%ebx\n\t"
-     "cld\n\t"
-     "movl	%4,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%ebx\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "testb	%%al,%%al\n\t"
-     "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
-     "movl	%%ebx,%%ecx\n\t"
-     "repne; scasb\n\t"
-     "jne	1b\n"
-     "2:\n\t"
-     "popl	%%ebx"
-     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
-     : "d" (__reject), "0" (__s), "1" (0), "2" (0xffffffff),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return (__res - 1) - __s;
-}
-# else
-__STRING_INLINE size_t
-strcspn (__const char *__s, __const char *__reject)
-{
-  register unsigned long int __d0, __d1, __d2, __d3;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "movl	%5,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%edx\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "testb	%%al,%%al\n\t"
-     "je	2f\n\t"
-     "movl	%5,%%edi\n\t"
-     "movl	%%edx,%%ecx\n\t"
-     "repne; scasb\n\t"
-     "jne	1b\n"
-     "2:"
-     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)
-     : "g" (__reject), "0" (__s), "1" (0), "2" (0xffffffff),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return (__res - 1) - __s;
-}
-# endif
-#endif
-
-
-/* Return the length of the initial segment of S which
-   consists entirely of characters in ACCEPT.  */
-#define _HAVE_STRING_ARCH_strspn 1
-#ifndef _FORCE_INLINES
-# ifdef __PIC__
-__STRING_INLINE size_t
-strspn (__const char *__s, __const char *__accept)
-{
-  register unsigned long int __d0, __d1, __d2;
-  register char *__res;
-  __asm__ __volatile__
-    ("pushl	%%ebx\n\t"
-     "cld\n\t"
-     "movl	%4,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%ebx\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "testb	%%al,%%al\n\t"
-     "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
-     "movl	%%ebx,%%ecx\n\t"
-     "repne; scasb\n\t"
-     "je	1b\n"
-     "2:\n\t"
-     "popl	%%ebx"
-     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
-     : "r" (__accept), "0" (__s), "1" (0), "2" (0xffffffff),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return (__res - 1) - __s;
-}
-# else
-__STRING_INLINE size_t
-strspn (__const char *__s, __const char *__accept)
-{
-  register unsigned long int __d0, __d1, __d2, __d3;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "movl	%5,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%edx\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "testb	%%al,%%al\n\t"
-     "je	2f\n\t"
-     "movl	%5,%%edi\n\t"
-     "movl	%%edx,%%ecx\n\t"
-     "repne; scasb\n\t"
-     "je	1b\n"
-     "2:"
-     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)
-     : "g" (__accept), "0" (__s), "1" (0), "2" (0xffffffff),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return (__res - 1) - __s;
-}
-# endif
-#endif
-
-
-/* Find the first occurrence in S of any character in ACCEPT.  */
-#define _HAVE_STRING_ARCH_strpbrk 1
-#ifndef _FORCE_INLINES
-# ifdef __PIC__
-__STRING_INLINE char *
-strpbrk (__const char *__s, __const char *__accept)
-{
-  unsigned long int __d0, __d1, __d2;
-  register char *__res;
-  __asm__ __volatile__
-    ("pushl	%%ebx\n\t"
-     "cld\n\t"
-     "movl	%4,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%ebx\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "testb	%%al,%%al\n\t"
-     "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
-     "movl	%%ebx,%%ecx\n\t"
-     "repne; scasb\n\t"
-     "jne	1b\n\t"
-     "decl	%0\n\t"
-     "jmp	3f\n"
-     "2:\n\t"
-     "xorl	%0,%0\n"
-     "3:\n\t"
-     "popl	%%ebx"
-     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
-     : "r" (__accept), "0" (__s), "1" (0), "2" (0xffffffff),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return __res;
-}
-# else
-__STRING_INLINE char *
-strpbrk (__const char *__s, __const char *__accept)
-{
-  register unsigned long int __d0, __d1, __d2, __d3;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t"
-     "movl	%5,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"
-     "movl	%%ecx,%%edx\n"
-     "1:\n\t"
-     "lodsb\n\t"
-     "testb	%%al,%%al\n\t"
-     "je	2f\n\t"
-     "movl	%5,%%edi\n\t"
-     "movl	%%edx,%%ecx\n\t"
-     "repne; scasb\n\t"
-     "jne	1b\n\t"
-     "decl	%0\n\t"
-     "jmp	3f\n"
-     "2:\n\t"
-     "xorl	%0,%0\n"
-     "3:"
-     : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)
-     : "g" (__accept), "0" (__s), "1" (0), "2" (0xffffffff),
-       "m" ( *(struct { char __x[0xfffffff]; } *)__s)
-     : "cc");
-  return __res;
-}
-# endif
-#endif
-
-
-/* Find the first occurrence of NEEDLE in HAYSTACK.  */
-#define _HAVE_STRING_ARCH_strstr 1
-#ifndef _FORCE_INLINES
-# ifdef __PIC__
-__STRING_INLINE char *
-strstr (__const char *__haystack, __const char *__needle)
-{
-  register unsigned long int __d0, __d1, __d2;
-  register char *__res;
-  __asm__ __volatile__
-    ("pushl	%%ebx\n\t"
-     "cld\n\t" \
-     "movl	%4,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */
-     "movl	%%ecx,%%ebx\n"
-     "1:\n\t"
-     "movl	%4,%%edi\n\t"
-     "movl	%%esi,%%eax\n\t"
-     "movl	%%ebx,%%ecx\n\t"
-     "repe; cmpsb\n\t"
-     "je	2f\n\t"		/* also works for empty string, see above */
-     "xchgl	%%eax,%%esi\n\t"
-     "incl	%%esi\n\t"
-     "cmpb	$0,-1(%%eax)\n\t"
-     "jne	1b\n\t"
-     "xorl	%%eax,%%eax\n\t"
-     "2:\n\t"
-     "popl	%%ebx"
-     : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
-     : "r" (__needle), "0" (0), "1" (0xffffffff), "2" (__haystack)
-     : "memory", "cc");
-  return __res;
-}
-# else
-__STRING_INLINE char *
-strstr (__const char *__haystack, __const char *__needle)
-{
-  register unsigned long int __d0, __d1, __d2, __d3;
-  register char *__res;
-  __asm__ __volatile__
-    ("cld\n\t" \
-     "movl	%5,%%edi\n\t"
-     "repne; scasb\n\t"
-     "notl	%%ecx\n\t"
-     "decl	%%ecx\n\t"	/* NOTE! This also sets Z if searchstring='' */
-     "movl	%%ecx,%%edx\n"
-     "1:\n\t"
-     "movl	%5,%%edi\n\t"
-     "movl	%%esi,%%eax\n\t"
-     "movl	%%edx,%%ecx\n\t"
-     "repe; cmpsb\n\t"
-     "je	2f\n\t"		/* also works for empty string, see above */
-     "xchgl	%%eax,%%esi\n\t"
-     "incl	%%esi\n\t"
-     "cmpb	$0,-1(%%eax)\n\t"
-     "jne	1b\n\t"
-     "xorl	%%eax,%%eax\n\t"
-     "2:"
-     : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&d" (__d2), "=&D" (__d3)
-     : "g" (__needle), "0" (0), "1" (0xffffffff), "2" (__haystack)
-     : "memory", "cc");
-  return __res;
-}
-# endif
-#endif
-
-#ifndef _FORCE_INLINES
-# undef __STRING_INLINE
-#endif
-
-#endif	/* use string inlines && GNU CC */
diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
index aa8df167d0..ee329ee86c 100644
--- a/sysdeps/i386/bsd-_setjmp.S
+++ b/sysdeps/i386/bsd-_setjmp.S
@@ -1,5 +1,5 @@
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  i386 version.
-   Copyright (C) 1994-1997,2000,2001,2002 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997,2000-2002,2005, 2006 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
@@ -22,9 +22,7 @@
    in setjmp doesn't clobber the state restored by longjmp.  */
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #include "bp-sym.h"
 #include "bp-asm.h"
 
@@ -44,8 +42,14 @@ ENTRY (BP_SYM (_setjmp))
 	movl %esi, (JB_SI*4)(%edx)
 	movl %edi, (JB_DI*4)(%edx)
 	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_SP*4)(%edx)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_PC*4)(%edx)
 	LEAVE
 	movl %ebp, (JB_BP*4)(%edx) /* Save caller's frame pointer.  */
diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
index ea242d1f96..c9af0e1477 100644
--- a/sysdeps/i386/bsd-setjmp.S
+++ b/sysdeps/i386/bsd-setjmp.S
@@ -1,5 +1,5 @@
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  i386 version.
-   Copyright (C) 1994,1995,1996,1997,2000,2001 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997,2000,2001,2005, 2006 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
@@ -22,12 +22,14 @@
    in setjmp doesn't clobber the state restored by longjmp.  */
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #include "bp-sym.h"
 #include "bp-asm.h"
 
+#define PARMS  LINKAGE		/* no space for saved regs */
+#define JMPBUF PARMS
+#define SIGMSK JMPBUF+PTR_SIZE
+
 ENTRY (BP_SYM (setjmp))
 	/* Note that we have to use a non-exported symbol in the next
 	   jump since otherwise gas will emit it as a jump through the
@@ -42,17 +44,27 @@ ENTRY (BP_SYM (setjmp))
 	movl %esi, (JB_SI*4)(%eax)
 	movl %edi, (JB_DI*4)(%eax)
 	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_SP*4)(%eax)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_PC*4)(%eax)
 	LEAVE /* pop frame pointer to prepare for tail-call.  */
 	movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer.  */
 
 	/* Call __sigjmp_save.  */
 	pushl $1
+	cfi_adjust_cfa_offset (4)
 	pushl 8(%esp)
+	cfi_adjust_cfa_offset (4)
 	call BP_SYM (__sigjmp_save)
 	popl %ecx
+	cfi_adjust_cfa_offset (-4)
 	popl %edx
+	cfi_adjust_cfa_offset (-4)
 	ret
 END (BP_SYM (setjmp))
diff --git a/sysdeps/i386/bzero.c b/sysdeps/i386/bzero.c
index c2b135cb88..a1cfe36ba1 100644
--- a/sysdeps/i386/bzero.c
+++ b/sysdeps/i386/bzero.c
@@ -1,6 +1,6 @@
 /* bzero -- set a block of memory to zero.  For Intel 80x86, x>=3.
    This file is part of the GNU C Library.
-   Copyright (C) 1991,92,93,97,98,99 Free Software Foundation, Inc.
+   Copyright (C) 1991,92,93,97,98,99, 05 Free Software Foundation, Inc.
    Contributed by Torbjorn Granlund (tege@sics.se).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -79,5 +79,5 @@ __bzero (dstpp, len)
 weak_alias (__bzero, bzero)
 
 #else
-#include <sysdeps/generic/bzero.c>
+#include <string/bzero.c>
 #endif
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
new file mode 100755
index 0000000000..d1d4dc15a7
--- /dev/null
+++ b/sysdeps/i386/configure
@@ -0,0 +1,54 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/i386.
+
+echo "$as_me:$LINENO: checking if -g produces usable source locations for assembler-with-cpp" >&5
+echo $ECHO_N "checking if -g produces usable source locations for assembler-with-cpp... $ECHO_C" >&6
+if test "${libc_cv_cpp_asm_debuginfo+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat > conftest.S <<EOF
+#include "confdefs.h"
+
+/* comment on
+   two lines */
+	${libc_cv_dot_text}
+	${libc_cv_asm_global_directive} foo
+foo:
+	/* Unfortunately this test only works for a real instruction,
+	   not for any of the machine-independent pseudo-ops.
+	   So we just have to assume everybody has a "nop".  */
+	nop
+	/* comment */
+	nop
+	/* comment */
+	nop
+EOF
+if { ac_try='${CC-cc} $CPPFLAGS $ASFLAGS -g -c conftest.S 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } && {
+   ac_pattern='conftest\.S'
+   { ac_try='readelf --debug-dump=line conftest.o |
+		   grep $ac_pattern 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+  }; then
+  libc_cv_cpp_asm_debuginfo=yes
+else
+  libc_cv_cpp_asm_debuginfo=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_cpp_asm_debuginfo" >&5
+echo "${ECHO_T}$libc_cv_cpp_asm_debuginfo" >&6
+if test $libc_cv_cpp_asm_debuginfo = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_CPP_ASM_DEBUGINFO 1
+_ACEOF
+
+fi
diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in
new file mode 100644
index 0000000000..028e1ae8e1
--- /dev/null
+++ b/sysdeps/i386/configure.in
@@ -0,0 +1,35 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/i386.
+
+AC_CACHE_CHECK(if -g produces usable source locations for assembler-with-cpp,
+	       libc_cv_cpp_asm_debuginfo, [dnl
+cat > conftest.S <<EOF
+#include "confdefs.h"
+
+/* comment on
+   two lines */
+	${libc_cv_dot_text}
+	${libc_cv_asm_global_directive} foo
+foo:
+	/* Unfortunately this test only works for a real instruction,
+	   not for any of the machine-independent pseudo-ops.
+	   So we just have to assume everybody has a "nop".  */
+	nop
+	/* comment */
+	nop
+	/* comment */
+	nop
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CPPFLAGS $ASFLAGS -g -c conftest.S 1>&AS_MESSAGE_LOG_FD]) && {
+   ac_pattern='conftest\.S'
+   AC_TRY_COMMAND([readelf --debug-dump=line conftest.o |
+		   grep $ac_pattern 1>&AS_MESSAGE_LOG_FD])
+  }; then
+  libc_cv_cpp_asm_debuginfo=yes
+else
+  libc_cv_cpp_asm_debuginfo=no
+fi
+rm -f conftest*])AC_SUBST(libc_cv_cpp_asm_debuginfo)
+if test $libc_cv_cpp_asm_debuginfo = yes; then
+  AC_DEFINE(HAVE_CPP_ASM_DEBUGINFO)
+fi
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index c48d9d325e..df3edf5460 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  i386 version.
-   Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2004, 2005 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
@@ -129,7 +129,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	{
 	  got[2] = (Elf32_Addr) &_dl_runtime_profile;
 
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    /* This is the object we are looking for.  Say that we really
 	       want profiling and the timers are started.  */
 	    GL(dl_profile_map) = l;
@@ -154,112 +155,18 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
    destroys the passed register information.  */
 /* GKM FIXME: Fix trampoline to pass bounds so we can do
    without the `__unbounded' qualifier.  */
-#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), unused))
+#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), stdcall, unused))
 
-static ElfW(Addr) fixup (struct link_map *__unbounded l,
-			 ElfW(Word) reloc_offset)
+extern ElfW(Addr) _dl_fixup (struct link_map *__unbounded l,
+			     ElfW(Word) reloc_offset)
      ARCH_FIXUP_ATTRIBUTE;
-static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset,
-				 ElfW(Addr) retaddr)
+extern ElfW(Addr) _dl_profile_fixup (struct link_map *l,
+				     ElfW(Word) reloc_offset,
+				     ElfW(Addr) retaddr, void *regs,
+				     long int *framesizep)
      ARCH_FIXUP_ATTRIBUTE;
 # endif
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-# if !defined PROF && !__BOUNDED_POINTERS__
-#  define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.type _dl_runtime_resolve, @function\n\
-	" CFI_STARTPROC "\n\
-	.align 16\n\
-_dl_runtime_resolve:\n\
-	" CFI_ADJUST_CFA_OFFSET (8) "\n\
-	pushl %eax		# Preserve registers otherwise clobbered.\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	pushl %ecx\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	pushl %edx\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note\n\
-	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.\n\
-	call fixup		# Call resolver.\n\
-	popl %edx		# Get register content back.\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	popl %ecx\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
-	ret $8			# Jump to function address.\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_profile, @function\n\
-	" CFI_STARTPROC "\n\
-	.align 16\n\
-_dl_runtime_profile:\n\
-	" CFI_ADJUST_CFA_OFFSET (8) "\n\
-	pushl %eax		# Preserve registers otherwise clobbered.\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	pushl %ecx\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	pushl %edx\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	movl 20(%esp), %ecx	# Load return address\n\
-	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note\n\
-	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.\n\
-	call profile_fixup	# Call resolver.\n\
-	popl %edx		# Get register content back.\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	popl %ecx\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
-	ret $8			# Jump to function address.\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
-	.previous\n\
-");
-# else
-#  define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_resolve, @function\n\
-	.type _dl_runtime_profile, @function\n\
-	" CFI_STARTPROC "\n\
-	.align 16\n\
-_dl_runtime_resolve:\n\
-_dl_runtime_profile:\n\
-	" CFI_ADJUST_CFA_OFFSET (8) "\n\
-	pushl %eax		# Preserve registers otherwise clobbered.\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	pushl %ecx\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	pushl %edx\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	movl 16(%esp), %edx	# Push the arguments for `fixup'\n\
-	movl 12(%esp), %eax\n\
-	pushl %edx\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	pushl %eax\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	call fixup		# Call resolver.\n\
-	popl %edx		# Pop the parameters\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	popl %ecx\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	popl %edx		# Get register content back.\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	popl %ecx\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	xchgl %eax, (%esp)	# Get %eax contents end store function address.\n\
-	ret $8			# Jump to function address.\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
-	.previous\n\
-");
-# endif
 #endif
 
 /* Mask identifying addresses reserved for the user program,
@@ -308,11 +215,21 @@ _dl_start_user:\n\
 	movl _rtld_local@GOTOFF(%ebx), %eax\n\
 	leal 8(%esp,%edx,4), %esi\n\
 	leal 4(%esp), %ecx\n\
+	movl %esp, %ebp\n\
+	# Make sure _dl_init is run with 16 byte aligned stack.\n\
+	andl $-16, %esp\n\
+	pushl %eax\n\
+	pushl %eax\n\
+	pushl %ebp\n\
 	pushl %esi\n\
+	# Clear %ebp, so that even constructors have terminated backchain.\n\
+	xorl %ebp, %ebp\n\
 	# Call the function to run the initializers.\n\
 	call _dl_init_internal@PLT\n\
 	# Pass our finalizer function to the user in %edx, as per ELF ABI.\n\
 	leal _dl_fini@GOTOFF(%ebx), %edx\n\
+	# Restore %esp _start expects.\n\
+	movl (%esp), %esp\n\
 	# Jump to the user's entry point.\n\
 	jmp *%edi\n\
 	.previous\n\
@@ -375,15 +292,18 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
   return value;
 }
 
-#endif /* !dl_machine_h */
 
-#ifdef RESOLVE
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER i86_gnu_pltenter
+#define ARCH_LA_PLTEXIT i86_gnu_pltexit
+
+#endif /* !dl_machine_h */
 
 /* The i386 never uses Elf32_Rela relocations for the dynamic linker.
    Prelinked libraries may use Elf32_Rela though.  */
-#ifdef RTLD_BOOTSTRAP
-# define ELF_MACHINE_NO_RELA 1
-#endif
+#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+
+#ifdef RESOLVE_MAP
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
@@ -422,17 +342,8 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 #endif	/* !RTLD_BOOTSTRAP and have no -z combreloc */
     {
       const Elf32_Sym *const refsym = sym;
-#if defined USE_TLS && !defined RTLD_BOOTSTRAP
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
-      Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-#else
-      Elf32_Addr value = RESOLVE (&sym, version, r_type);
-
-# ifndef RTLD_BOOTSTRAP
-      if (sym != NULL)
-# endif
-	value += sym->st_value;
-#endif	/* use TLS and !RTLD_BOOTSTRAP */
+      Elf32_Addr value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
 
       switch (r_type)
 	{
@@ -549,14 +460,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 # ifndef RESOLVE_CONFLICT_FIND_MAP
       const Elf32_Sym *const refsym = sym;
 # endif
-# ifdef USE_TLS
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
       Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-# else
-      Elf32_Addr value = RESOLVE (&sym, version, r_type);
-      if (sym != NULL)
-	value += sym->st_value;
-# endif
 
       switch (ELF32_R_TYPE (reloc->r_info))
 	{
@@ -692,4 +597,4 @@ elf_machine_lazy_rela (struct link_map *map,
 
 #endif	/* !RTLD_BOOTSTRAP */
 
-#endif /* RESOLVE */
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/i386/dl-trampoline.S b/sysdeps/i386/dl-trampoline.S
new file mode 100644
index 0000000000..fd87eb711d
--- /dev/null
+++ b/sysdeps/i386/dl-trampoline.S
@@ -0,0 +1,184 @@
+/* PLT trampolines.  i386 version.
+   Copyright (C) 2004, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+	.globl _dl_runtime_resolve
+	.type _dl_runtime_resolve, @function
+	cfi_startproc
+	.align 16
+_dl_runtime_resolve:
+	cfi_adjust_cfa_offset (8)
+	pushl %eax		# Preserve registers otherwise clobbered.
+	cfi_adjust_cfa_offset (4)
+	pushl %ecx
+	cfi_adjust_cfa_offset (4)
+	pushl %edx
+	cfi_adjust_cfa_offset (4)
+	movl 16(%esp), %edx	# Copy args pushed by PLT in register.  Note
+	movl 12(%esp), %eax	# that `fixup' takes its parameters in regs.
+	call _dl_fixup		# Call resolver.
+	popl %edx		# Get register content back.
+	cfi_adjust_cfa_offset (-4)
+	popl %ecx
+	cfi_adjust_cfa_offset (-4)
+	xchgl %eax, (%esp)	# Get %eax contents end store function address.
+	ret $8			# Jump to function address.
+	cfi_endproc
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve
+
+
+#ifndef PROF
+	.globl _dl_runtime_profile
+	.type _dl_runtime_profile, @function
+	cfi_startproc
+	.align 16
+_dl_runtime_profile:
+	cfi_adjust_cfa_offset (8)
+	pushl %esp
+	cfi_adjust_cfa_offset (4)
+	addl $8, (%esp)		# Account for the pushed PLT data
+	pushl %ebp
+	cfi_adjust_cfa_offset (4)
+	pushl %eax		# Preserve registers otherwise clobbered.
+	cfi_adjust_cfa_offset (4)
+	pushl %ecx
+	cfi_adjust_cfa_offset (4)
+	pushl %edx
+	cfi_adjust_cfa_offset (4)
+	movl %esp, %ecx
+	subl $8, %esp
+	cfi_adjust_cfa_offset (8)
+	movl $-1, 4(%esp)
+	leal 4(%esp), %edx
+	movl %edx, (%esp)
+	pushl %ecx		# Address of the register structure
+	cfi_adjust_cfa_offset (4)
+	movl 40(%esp), %ecx	# Load return address
+	movl 36(%esp), %edx	# Copy args pushed by PLT in register.  Note
+	movl 32(%esp), %eax	# that `fixup' takes its parameters in regs.
+	call _dl_profile_fixup	# Call resolver.
+	cfi_adjust_cfa_offset (-8)
+	movl (%esp), %edx
+	testl %edx, %edx
+	jns 1f
+	popl %edx
+	cfi_adjust_cfa_offset (-4)
+	popl %edx		# Get register content back.
+	cfi_adjust_cfa_offset (-4)
+	popl %ecx
+	cfi_adjust_cfa_offset (-4)
+	xchgl %eax, (%esp)	# Get %eax contents end store function address.
+	ret $16			# Jump to function address.
+
+	/*
+	    +32     return address
+	    +28     PLT1
+	    +24     PLT2
+	    +20     %esp
+	    +16     %ebp
+	    +12     %eax
+	    +8      %ecx
+	    +4      %edx
+	   %esp     free
+	*/
+	cfi_adjust_cfa_offset (12)
+1:	movl %ebx, (%esp)
+	cfi_rel_offset (3, 0)
+	movl %edx, %ebx		# This is the frame buffer size
+	pushl %edi
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (7, 0)
+	pushl %esi
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (6, 0)
+	leal 44(%esp), %esi
+	movl %ebx, %ecx
+	movl %esp, %edi
+	subl %ebx, %edi
+	andl $0xfffffff0, %edi	# Align stack
+	movl %esp, %ebx
+	cfi_def_cfa_register (3)
+	movl %edi, %esp
+	shrl $2, %ecx
+	rep
+	movsl
+	movl (%edi), %esi
+	cfi_restore (6)
+	movl 4(%edi), %edi
+	cfi_restore (7)
+	/*
+	   %ebx+40  return address
+	   %ebx+36  PLT1
+	   %ebx+32  PLT2
+	   %ebx+28  %esp
+	   %ebx+24  %ebp
+	   %ebx+20  %eax
+	   %ebx+16  %ecx
+	   %ebx+12  %edx
+	   %ebx+8   %ebx
+	   %ebx+4   free
+	   %ebx     free
+	   %esp     copied stack frame
+	*/
+	movl %eax, (%ebx)
+	movl 12(%ebx), %edx
+	movl 16(%ebx), %ecx
+	movl 20(%ebx), %eax
+	call *(%ebx)
+	movl %ebx, %esp
+	cfi_def_cfa_register (4)
+	movl 8(%esp), %ebx
+	cfi_restore (3)
+	/*
+	    +40     return address
+	    +36     PLT1
+	    +32     PLT2
+	    +28     %esp
+	    +24     %ebp
+	    +20     %eax
+	    +16     %ecx
+	    +12     %edx
+	    +8      free
+	    +4      free
+	   %esp     free
+	*/
+	subl $20, %esp
+	cfi_adjust_cfa_offset (20)
+	movl %eax, (%esp)
+	movl %edx, 4(%esp)
+	fstpt 8(%esp)
+	fstpt 20(%esp)
+	pushl %esp
+	cfi_adjust_cfa_offset (4)
+	leal 36(%esp), %ecx
+	movl 56(%esp), %eax
+	movl 60(%esp), %edx
+	call _dl_call_pltexit
+	movl (%esp), %eax
+	movl 4(%esp), %edx
+	fldt 20(%esp)
+	fldt 8(%esp)
+	addl $60, %esp
+	cfi_adjust_cfa_offset (-60)
+	ret
+	cfi_endproc
+	.size _dl_runtime_profile, .-_dl_runtime_profile
+#endif
diff --git a/sysdeps/i386/elf/bsd-setjmp.S b/sysdeps/i386/elf/bsd-setjmp.S
deleted file mode 100644
index 72a85b18e1..0000000000
--- a/sysdeps/i386/elf/bsd-setjmp.S
+++ /dev/null
@@ -1,78 +0,0 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  i386 version.
-   Copyright (C) 1995-1997,2000,2001,2002,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include "bp-sym.h"
-#include "bp-asm.h"
-
-#define PARMS	LINKAGE		/* no space for saved regs */
-#define JMPBUF	PARMS
-#define SIGMSK	JMPBUF+PTR_SIZE
-
-ENTRY (BP_SYM (setjmp))
-	/* Note that we have to use a non-exported symbol in the next
-	   jump since otherwise gas will emit it as a jump through the
-	   PLT which is what we cannot use here.  */
-	ENTER
-
-	movl JMPBUF(%esp), %eax
-	CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE)
-
-     	/* Save registers.  */
-	movl %ebx, (JB_BX*4)(%eax)
-	movl %esi, (JB_SI*4)(%eax)
-	movl %edi, (JB_DI*4)(%eax)
-	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
-     	movl %ecx, (JB_SP*4)(%eax)
-	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
-     	movl %ecx, (JB_PC*4)(%eax)
-	LEAVE /* pop frame pointer to prepare for tail-call.  */
-	movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer.  */
-
-	/* Call __sigjmp_save.  */
-	pushl $1
-	pushl 8(%esp)
-#ifdef	PIC
-	/* We cannot use the PLT, because it requires that %ebx be set, but
-           we can't save and restore our caller's value.  Instead, we do an
-           indirect jump through the GOT, using for the temporary register
-           %ecx, which is call-clobbered.  */
-	call __i686.get_pc_thunk.cx
-	addl $_GLOBAL_OFFSET_TABLE_, %ecx
-	leal C_SYMBOL_NAME (BP_SYM (__sigjmp_save)@GOTOFF)(%ecx), %ecx
-	call *%ecx
-#else
-	call BP_SYM (__sigjmp_save)
-#endif
-	popl %ecx
-	popl %edx
-	ret
-END (BP_SYM (setjmp))
-
-	.section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits
-	.globl __i686.get_pc_thunk.cx
-	.hidden __i686.get_pc_thunk.cx
-	.type __i686.get_pc_thunk.cx,@function
-__i686.get_pc_thunk.cx:
-	movl (%esp), %ecx
-	ret
-	.size __i686.get_pc_thunk.cx, . - __i686.get_pc_thunk.cx
diff --git a/sysdeps/i386/elf/setjmp.S b/sysdeps/i386/elf/setjmp.S
deleted file mode 100644
index d6ae98b8b4..0000000000
--- a/sysdeps/i386/elf/setjmp.S
+++ /dev/null
@@ -1,70 +0,0 @@
-/* setjmp for i386, ELF version.
-   Copyright (C) 1995-1997,2000,2001,2002,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#include "bp-sym.h"
-#include "bp-asm.h"
-
-#define PARMS	LINKAGE		/* no space for saved regs */
-#define JMPBUF	PARMS
-#define SIGMSK	JMPBUF+PTR_SIZE
-
-ENTRY (BP_SYM (__sigsetjmp))
-	ENTER
-
-	movl JMPBUF(%esp), %eax
-	CHECK_BOUNDS_BOTH_WIDE (%eax, JMPBUF(%esp), $JB_SIZE)
-
-     	/* Save registers.  */
-	movl %ebx, (JB_BX*4)(%eax)
-	movl %esi, (JB_SI*4)(%eax)
-	movl %edi, (JB_DI*4)(%eax)
-	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
-     	movl %ecx, (JB_SP*4)(%eax)
-	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
-     	movl %ecx, (JB_PC*4)(%eax)
-	LEAVE /* pop frame pointer to prepare for tail-call.  */
-	movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer.  */
-
-	/* Make a tail call to __sigjmp_save; it takes the same args.  */
-#ifdef	PIC
-	/* We cannot use the PLT, because it requires that %ebx be set, but
-           we can't save and restore our caller's value.  Instead, we do an
-           indirect jump through the GOT, using for the temporary register
-           %ecx, which is call-clobbered.  */
-	call __i686.get_pc_thunk.cx
-	addl $_GLOBAL_OFFSET_TABLE_, %ecx
-	leal C_SYMBOL_NAME (BP_SYM (__sigjmp_save)@GOTOFF)(%ecx), %ecx
-	jmp *%ecx
-#else
-	jmp BP_SYM (__sigjmp_save)
-#endif
-END (BP_SYM (__sigsetjmp))
-
-	.section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits
-	.globl __i686.get_pc_thunk.cx
-	.hidden __i686.get_pc_thunk.cx
-	.type __i686.get_pc_thunk.cx,@function
-__i686.get_pc_thunk.cx:
-	movl (%esp), %ecx
-	ret
-	.size __i686.get_pc_thunk.cx, . - __i686.get_pc_thunk.cx
diff --git a/sysdeps/i386/ffs.c b/sysdeps/i386/ffs.c
index 695d48be56..b6aac64dd8 100644
--- a/sysdeps/i386/ffs.c
+++ b/sysdeps/i386/ffs.c
@@ -1,7 +1,7 @@
 /* ffs -- find first set bit in a word, counted from least significant end.
    For Intel 80x86, x>=3.
    This file is part of the GNU C Library.
-   Copyright (C) 1991, 92, 93, 94, 97, 98, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 94, 97, 98, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Torbjorn Granlund (tege@sics.se).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -47,5 +47,5 @@ libc_hidden_builtin_def (ffs)
 weak_alias (__ffs, ffsl)
 
 #else
-#include <sysdeps/generic/ffs.c>
+#include <string/ffs.c>
 #endif
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index e04ce95099..28547d44b8 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for i387.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
@@ -529,24 +529,38 @@ __inline_mathcodeNP (tanh, __x, \
 
 __inline_mathcodeNP (floor, __x, \
   register long double __value;						      \
-  __volatile unsigned short int __cw;					      \
-  __volatile unsigned short int __cwtmp;				      \
-  __asm __volatile ("fnstcw %0" : "=m" (__cw));				      \
-  __cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */		      \
-  __asm __volatile ("fldcw %0" : : "m" (__cwtmp));			      \
-  __asm __volatile ("frndint" : "=t" (__value) : "0" (__x));		      \
-  __asm __volatile ("fldcw %0" : : "m" (__cw));				      \
+  register int __ignore;						      \
+  unsigned short int __cw;						      \
+  unsigned short int __cwtmp;						      \
+  __asm __volatile ("fnstcw %3\n\t"					      \
+		    "movzwl %3, %1\n\t"					      \
+		    "andl $0xf3ff, %1\n\t"				      \
+		    "orl $0x0400, %1\n\t"	/* rounding down */	      \
+		    "movw %w1, %2\n\t"					      \
+		    "fldcw %2\n\t"					      \
+		    "frndint\n\t"					      \
+		    "fldcw %3"						      \
+		    : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp),	      \
+		      "=m" (__cw)					      \
+		    : "0" (__x));					      \
   return __value)
 
 __inline_mathcodeNP (ceil, __x, \
   register long double __value;						      \
-  __volatile unsigned short int __cw;					      \
-  __volatile unsigned short int __cwtmp;				      \
-  __asm __volatile ("fnstcw %0" : "=m" (__cw));				      \
-  __cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */			      \
-  __asm __volatile ("fldcw %0" : : "m" (__cwtmp));			      \
-  __asm __volatile ("frndint" : "=t" (__value) : "0" (__x));		      \
-  __asm __volatile ("fldcw %0" : : "m" (__cw));				      \
+  register int __ignore;						      \
+  unsigned short int __cw;						      \
+  unsigned short int __cwtmp;						      \
+  __asm __volatile ("fnstcw %3\n\t"					      \
+		    "movzwl %3, %1\n\t"					      \
+		    "andl $0xf3ff, %1\n\t"				      \
+		    "orl $0x0800, %1\n\t"	/* rounding up */	      \
+		    "movw %w1, %2\n\t"					      \
+		    "fldcw %2\n\t"					      \
+		    "frndint\n\t"					      \
+		    "fldcw %3"						      \
+		    : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp),	      \
+		      "=m" (__cw)					      \
+		    : "0" (__x));					      \
   return __value)
 
 #ifdef __FAST_MATH__
diff --git a/sysdeps/i386/fpu/e_acosh.S b/sysdeps/i386/fpu/e_acosh.S
index 981425ec7a..62a232471f 100644
--- a/sysdeps/i386/fpu/e_acosh.S
+++ b/sysdeps/i386/fpu/e_acosh.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -50,9 +50,7 @@ ENTRY(__ieee754_acosh)
 	cmpl	$0x41b00000, %ecx
 	ja	3f			// x > 2^28
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpl	$0x40000000, %ecx
 	ja	4f			// x > 2
diff --git a/sysdeps/i386/fpu/e_acoshf.S b/sysdeps/i386/fpu/e_acoshf.S
index 17be69d575..1906c60578 100644
--- a/sysdeps/i386/fpu/e_acoshf.S
+++ b/sysdeps/i386/fpu/e_acoshf.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -50,9 +50,7 @@ ENTRY(__ieee754_acoshf)
 	cmpl	$0x47000000, %ecx
 	ja	3f			// x > 2^14
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpl	$0x40000000, %ecx
 	ja	4f			// x > 2
diff --git a/sysdeps/i386/fpu/e_acoshl.S b/sysdeps/i386/fpu/e_acoshl.S
index 7b6885da18..c7b548d25a 100644
--- a/sysdeps/i386/fpu/e_acoshl.S
+++ b/sysdeps/i386/fpu/e_acoshl.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -57,9 +57,7 @@ ENTRY(__ieee754_acoshl)
 	cmpl	$0x4020, %ecx
 	ja	3f			// x > 2^34
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpl	$0x4000, %ecx
 	ja	4f			// x > 2
diff --git a/sysdeps/i386/fpu/e_atanh.S b/sysdeps/i386/fpu/e_atanh.S
index 6fb53a4acc..3566ec6eff 100644
--- a/sysdeps/i386/fpu/e_atanh.S
+++ b/sysdeps/i386/fpu/e_atanh.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arctanh function.
-   Copyright (C) 1996, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -58,7 +58,9 @@ ENTRY(__ieee754_atanh)
 
 #ifdef PIC
 	call	1f
+	cfi_adjust_cfa_offset (4)
 1:	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
 #endif
 
diff --git a/sysdeps/i386/fpu/e_atanhf.S b/sysdeps/i386/fpu/e_atanhf.S
index a517929f2a..10ce6aed9e 100644
--- a/sysdeps/i386/fpu/e_atanhf.S
+++ b/sysdeps/i386/fpu/e_atanhf.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arctanh function.
-   Copyright (C) 1996, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -57,9 +57,7 @@ ENTRY(__ieee754_atanhf)
 	ja	5f
 
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 
 	andl	$0x80000000, %ecx // ECX == 0 iff X >= 0
diff --git a/sysdeps/i386/fpu/e_atanhl.S b/sysdeps/i386/fpu/e_atanhl.S
index 6fda9bef89..8618c3fb35 100644
--- a/sysdeps/i386/fpu/e_atanhl.S
+++ b/sysdeps/i386/fpu/e_atanhl.S
@@ -64,9 +64,7 @@ ENTRY(__ieee754_atanhl)
 7:
 
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 
 	andl	$0x8000, %ecx	// ECX == 0 iff X >= 0
diff --git a/sysdeps/i386/fpu/e_expl.c b/sysdeps/i386/fpu/e_expl.c
index a090d0dabc..2240ceac47 100644
--- a/sysdeps/i386/fpu/e_expl.c
+++ b/sysdeps/i386/fpu/e_expl.c
@@ -24,8 +24,8 @@
 
 #include <math_private.h>
 
-static long double c0 = 1.44268798828125L;
-static long double c1 = 7.05260771340735992468e-6L;
+static const long double c0 = 1.44268798828125L;
+static const long double c1 = 7.05260771340735992468e-6L;
 
 long double
 __ieee754_expl (long double x)
diff --git a/sysdeps/i386/fpu/e_log.S b/sysdeps/i386/fpu/e_log.S
index c7cacdfb0a..ce55b72292 100644
--- a/sysdeps/i386/fpu/e_log.S
+++ b/sysdeps/i386/fpu/e_log.S
@@ -36,13 +36,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_log)
 	fldln2			// log(2)
 	fldl	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -56,4 +58,9 @@ ENTRY(__ieee754_log)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_log)
diff --git a/sysdeps/i386/fpu/e_log10.S b/sysdeps/i386/fpu/e_log10.S
index e93184c219..525f08c96d 100644
--- a/sysdeps/i386/fpu/e_log10.S
+++ b/sysdeps/i386/fpu/e_log10.S
@@ -37,9 +37,7 @@ ENTRY(__ieee754_log10)
 	fldlg2			// log10(2)
 	fldl	4(%esp)		// x : log10(2)
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fxam
 	fnstsw
diff --git a/sysdeps/i386/fpu/e_log10f.S b/sysdeps/i386/fpu/e_log10f.S
index 0a89f54784..da5069d583 100644
--- a/sysdeps/i386/fpu/e_log10f.S
+++ b/sysdeps/i386/fpu/e_log10f.S
@@ -38,9 +38,7 @@ ENTRY(__ieee754_log10f)
 	fldlg2			// log10(2)
 	flds	4(%esp)		// x : log10(2)
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fxam
 	fnstsw
diff --git a/sysdeps/i386/fpu/e_log10l.S b/sysdeps/i386/fpu/e_log10l.S
index 25d3501663..3811516be5 100644
--- a/sysdeps/i386/fpu/e_log10l.S
+++ b/sysdeps/i386/fpu/e_log10l.S
@@ -39,9 +39,7 @@ ENTRY(__ieee754_log10l)
 	fldlg2			// log10(2)
 	fldt	4(%esp)		// x : log10(2)
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fxam
 	fnstsw
diff --git a/sysdeps/i386/fpu/e_log2.S b/sysdeps/i386/fpu/e_log2.S
index 4f7f0d57d9..d80bf80239 100644
--- a/sysdeps/i386/fpu/e_log2.S
+++ b/sysdeps/i386/fpu/e_log2.S
@@ -34,9 +34,7 @@ limit:	.double 0.29
 	.text
 ENTRY(__ieee754_log2)
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fldl	MO(one)
 	fldl	4(%esp)		// x : 1
diff --git a/sysdeps/i386/fpu/e_log2f.S b/sysdeps/i386/fpu/e_log2f.S
index 88f28b423c..9eb7b2a826 100644
--- a/sysdeps/i386/fpu/e_log2f.S
+++ b/sysdeps/i386/fpu/e_log2f.S
@@ -34,9 +34,7 @@ limit:	.double 0.29
 	.text
 ENTRY(__ieee754_log2f)
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fldl	MO(one)
 	flds	4(%esp)		// x : 1
diff --git a/sysdeps/i386/fpu/e_log2l.S b/sysdeps/i386/fpu/e_log2l.S
index f5c661a2d1..9de08f5de1 100644
--- a/sysdeps/i386/fpu/e_log2l.S
+++ b/sysdeps/i386/fpu/e_log2l.S
@@ -34,9 +34,7 @@ limit:	.double 0.29
 	.text
 ENTRY(__ieee754_log2l)
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fldl	MO(one)
 	fldt	4(%esp)		// x : 1
diff --git a/sysdeps/i386/fpu/e_logf.S b/sysdeps/i386/fpu/e_logf.S
index bdba1d3225..cd4538b594 100644
--- a/sysdeps/i386/fpu/e_logf.S
+++ b/sysdeps/i386/fpu/e_logf.S
@@ -37,13 +37,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_logf)
 	fldln2			// log(2)
 	flds	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -57,4 +59,9 @@ ENTRY(__ieee754_logf)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logf)
diff --git a/sysdeps/i386/fpu/e_logl.S b/sysdeps/i386/fpu/e_logl.S
index bda3ea508e..551dcf1e46 100644
--- a/sysdeps/i386/fpu/e_logl.S
+++ b/sysdeps/i386/fpu/e_logl.S
@@ -37,13 +37,15 @@ limit:	.double 0.29
 ENTRY(__ieee754_logl)
 	fldln2			// log(2)
 	fldt	4(%esp)		// x : log(2)
+	fxam
+	fnstsw
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	sahf
+	jc	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -57,4 +59,9 @@ ENTRY(__ieee754_logl)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	jp	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logl)
diff --git a/sysdeps/i386/fpu/e_pow.S b/sysdeps/i386/fpu/e_pow.S
index d100c0ac57..792f926902 100644
--- a/sysdeps/i386/fpu/e_pow.S
+++ b/sysdeps/i386/fpu/e_pow.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -67,9 +67,7 @@ ENTRY(__ieee754_pow)
 	fxam
 
 #ifdef	PIC
-	call	1f
-1:	popl	%ecx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 
 	fnstsw
@@ -87,6 +85,7 @@ ENTRY(__ieee754_pow)
 	fldl	4(%esp)		// x : y
 
 	subl	$8,%esp
+	cfi_adjust_cfa_offset (8)
 
 	fxam
 	fnstsw
@@ -120,7 +119,9 @@ ENTRY(__ieee754_pow)
 
 	/* OK, we have an integer value for y.  */
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	orl	$0, %edx
 	fstp	%st(0)		// x
 	jns	4f		// y >= 0, jump
@@ -155,14 +156,16 @@ ENTRY(__ieee754_pow)
 31:	fstp	%st(1)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	sahf
@@ -181,6 +184,7 @@ ENTRY(__ieee754_pow)
 	faddl	MO(one)		// 2^fract(y*log2(x)) : int(y*log2(x))
 	fscale			// 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
 	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 	fstp	%st(1)		// 2^fract(y*log2(x))*2^int(y*log2(x))
 	ret
 
@@ -194,9 +198,10 @@ ENTRY(__ieee754_pow)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	fldl	4(%esp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	fldl	4(%esp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
@@ -219,6 +224,7 @@ ENTRY(__ieee754_pow)
 13:	fldl	4(%esp)		// load x == NaN
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 	// x is ħinf
 15:	fstp	%st(0)		// y
@@ -237,7 +243,9 @@ ENTRY(__ieee754_pow)
 	// OK, the value is an integer, but is the number of bits small
 	// enough so that all are coming from the mantissa?
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	andb	$1, %al
 	jz	18f		// jump if not odd
 	movl	%edx, %eax
@@ -251,22 +259,27 @@ ENTRY(__ieee754_pow)
 	fldl	MOX(minf_mzero, %edx, 8)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 16:	fcompl	MO(zero)
 	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 	fnstsw
 	shrl	$5, %eax
 	andl	$8, %eax
 	fldl	MOX(inf_zero, %eax, 1)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 17:	shll	$30, %edx	// sign bit for y in right position
 	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 18:	shrl	$31, %edx
 	fldl	MOX(inf_zero, %edx, 8)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 	// x is ħ0
 20:	fstp	%st(0)		// y
@@ -288,7 +301,9 @@ ENTRY(__ieee754_pow)
 	// OK, the value is an integer, but is the number of bits small
 	// enough so that all are coming from the mantissa?
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	andb	$1, %al
 	jz	27f		// jump if not odd
 	cmpl	$0xffe00000, %edx
@@ -300,13 +315,16 @@ ENTRY(__ieee754_pow)
 	fchs
 	ret
 
+	cfi_adjust_cfa_offset (8)
 25:	fstp	%st(0)
 26:	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 27:	// Raise divide-by-zero exception and get infinity value.
 	fldl	MO(one)
 	fdivl	MO(zero)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 	// x is ħ0 and y is > 0.  We must find out whether y is an odd integer.
 21:	testb	$2, %dh
@@ -323,7 +341,9 @@ ENTRY(__ieee754_pow)
 	// OK, the value is an integer, but is the number of bits small
 	// enough so that all are coming from the mantissa?
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	andb	$1, %al
 	jz	24f		// jump if not odd
 	cmpl	$0xffe00000, %edx
@@ -332,8 +352,10 @@ ENTRY(__ieee754_pow)
 	fldl	MO(mzero)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 22:	fstp	%st(0)
 23:	addl	$8, %esp	// Don't use 2 x pop
+	cfi_adjust_cfa_offset (-8)
 24:	fldl	MO(zero)
 	ret
 
diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S
index b3fa624f4d..c91545418d 100644
--- a/sysdeps/i386/fpu/e_powf.S
+++ b/sysdeps/i386/fpu/e_powf.S
@@ -1,5 +1,6 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1999, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2001, 2004, 2005, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -66,9 +67,7 @@ ENTRY(__ieee754_powf)
 	fxam
 
 #ifdef	PIC
-	call	1f
-1:	popl	%ecx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 
 	fnstsw
@@ -86,6 +85,7 @@ ENTRY(__ieee754_powf)
 	flds	4(%esp)		// x : y
 
 	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
 
 	fxam
 	fnstsw
@@ -119,6 +119,7 @@ ENTRY(__ieee754_powf)
 
 	/* OK, we have an integer value for y.  */
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	orl	$0, %edx
 	fstp	%st(0)		// x
 	jns	4f		// y >= 0, jump
@@ -149,14 +150,16 @@ ENTRY(__ieee754_powf)
 31:	fstp	%st(1)
 	ret
 
+	cfi_adjust_cfa_offset (4)
 	.align ALIGNARG(4)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	sahf
@@ -175,6 +178,7 @@ ENTRY(__ieee754_powf)
 	faddl	MO(one)		// 2^fract(y*log2(x)) : int(y*log2(x))
 	fscale			// 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
 	addl	$4, %esp
+	cfi_adjust_cfa_offset (-4)
 	fstp	%st(1)		// 2^fract(y*log2(x))*2^int(y*log2(x))
 	ret
 
@@ -188,9 +192,10 @@ ENTRY(__ieee754_powf)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	flds	4(%esp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	flds	4(%esp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
@@ -213,6 +218,7 @@ ENTRY(__ieee754_powf)
 13:	flds	4(%esp)		// load x == NaN
 	ret
 
+	cfi_adjust_cfa_offset (4)
 	.align ALIGNARG(4)
 	// x is ħinf
 15:	fstp	%st(0)		// y
@@ -231,6 +237,7 @@ ENTRY(__ieee754_powf)
 	// OK, the value is an integer, but is the number of bits small
 	// enough so that all are coming from the mantissa?
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	testb	$1, %dl
 	jz	18f		// jump if not odd
 	movl	%edx, %eax
@@ -244,22 +251,27 @@ ENTRY(__ieee754_powf)
 	fldl	MOX(minf_mzero, %edx, 8)
 	ret
 
+	cfi_adjust_cfa_offset (4)
 	.align ALIGNARG(4)
 16:	fcompl	MO(zero)
 	addl	$4, %esp
+	cfi_adjust_cfa_offset (-4)
 	fnstsw
 	shrl	$5, %eax
 	andl	$8, %eax
 	fldl	MOX(inf_zero, %eax, 1)
 	ret
 
+	cfi_adjust_cfa_offset (4)
 	.align ALIGNARG(4)
 17:	shll	$30, %edx	// sign bit for y in right position
 	addl	$4, %esp
+	cfi_adjust_cfa_offset (-4)
 18:	shrl	$31, %edx
 	fldl	MOX(inf_zero, %edx, 8)
 	ret
 
+	cfi_adjust_cfa_offset (4)
 	.align ALIGNARG(4)
 	// x is ħ0
 20:	fstp	%st(0)		// y
@@ -281,6 +293,7 @@ ENTRY(__ieee754_powf)
 	// OK, the value is an integer, but is the number of bits small
 	// enough so that all are coming from the mantissa?
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	testb	$1, %dl
 	jz	27f		// jump if not odd
 	cmpl	$0xff000000, %edx
@@ -292,13 +305,16 @@ ENTRY(__ieee754_powf)
 	fchs
 	ret
 
+	cfi_adjust_cfa_offset (4)
 25:	fstp	%st(0)
 26:	addl	$4, %esp
+	cfi_adjust_cfa_offset (-4)
 27:	// Raise divide-by-zero exception and get infinity value.
 	fldl	MO(one)
 	fdivl	MO(zero)
 	ret
 
+	cfi_adjust_cfa_offset (4)
 	.align ALIGNARG(4)
 	// x is ħ0 and y is > 0.  We must find out whether y is an odd integer.
 21:	testb	$2, %dh
@@ -315,6 +331,7 @@ ENTRY(__ieee754_powf)
 	// OK, the value is an integer, but is the number of bits small
 	// enough so that all are coming from the mantissa?
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	testb	$1, %dl
 	jz	24f		// jump if not odd
 	cmpl	$0xff000000, %edx
@@ -323,8 +340,10 @@ ENTRY(__ieee754_powf)
 	fldl	MO(mzero)
 	ret
 
+	cfi_adjust_cfa_offset (4)
 22:	fstp	%st(0)
 23:	addl	$4, %esp	// Don't use pop.
+	cfi_adjust_cfa_offset (-4)
 24:	fldl	MO(zero)
 	ret
 
diff --git a/sysdeps/i386/fpu/e_powl.S b/sysdeps/i386/fpu/e_powl.S
index 080764b84a..6215496207 100644
--- a/sysdeps/i386/fpu/e_powl.S
+++ b/sysdeps/i386/fpu/e_powl.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2005, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -67,9 +67,7 @@ ENTRY(__ieee754_powl)
 	fxam
 
 #ifdef	PIC
-	call	1f
-1:	popl	%ecx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 
 	fnstsw
@@ -87,6 +85,7 @@ ENTRY(__ieee754_powl)
 	fldt	4(%esp)		// x : y
 
 	subl	$8,%esp
+	cfi_adjust_cfa_offset (8)
 
 	fxam
 	fnstsw
@@ -120,7 +119,9 @@ ENTRY(__ieee754_powl)
 
 	/* OK, we have an integer value for y.  */
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	orl	$0, %edx
 	fstp	%st(0)		// x
 	jns	4f		// y >= 0, jump
@@ -155,14 +156,16 @@ ENTRY(__ieee754_powl)
 31:	fstp	%st(1)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	sahf
@@ -186,13 +189,16 @@ ENTRY(__ieee754_powl)
 	faddl	MO(one)		// 2^fract(y*log2(x)) : int(y*log2(x))
 	fscale			// 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
 	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 	fstp	%st(1)		// 2^fract(y*log2(x))*2^int(y*log2(x))
 	ret
 
+	cfi_adjust_cfa_offset (8)
 28:	fstp	%st(1)		// y*log2(x)
 	fldl	MO(one)		// 1 : y*log2(x)
 	fscale			// 2^(y*log2(x)) : y*log2(x)
 	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 	fstp	%st(1)		// 2^(y*log2(x))
 	ret
 
@@ -205,9 +211,10 @@ ENTRY(__ieee754_powl)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	fldt	4(%esp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	fldt	4(%esp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
@@ -230,6 +237,7 @@ ENTRY(__ieee754_powl)
 13:	fldt	4(%esp)		// load x == NaN
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 	// x is ħinf
 15:	fstp	%st(0)		// y
@@ -247,7 +255,9 @@ ENTRY(__ieee754_powl)
 
 	// OK, the value is an integer, but is it odd?
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	andb	$1, %al
 	jz	18f		// jump if not odd
 	// It's an odd integer.
@@ -255,22 +265,27 @@ ENTRY(__ieee754_powl)
 	fldl	MOX(minf_mzero, %edx, 8)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 16:	fcompl	MO(zero)
 	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 	fnstsw
 	shrl	$5, %eax
 	andl	$8, %eax
 	fldl	MOX(inf_zero, %eax, 1)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 17:	shll	$30, %edx	// sign bit for y in right position
 	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 18:	shrl	$31, %edx
 	fldl	MOX(inf_zero, %edx, 8)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 	// x is ħ0
 20:	fstp	%st(0)		// y
@@ -291,7 +306,9 @@ ENTRY(__ieee754_powl)
 
 	// OK, the value is an integer, but is it odd?
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	andb	$1, %al
 	jz	27f		// jump if not odd
 	// It's an odd integer.
@@ -301,13 +318,16 @@ ENTRY(__ieee754_powl)
 	fchs
 	ret
 
+	cfi_adjust_cfa_offset (8)
 25:	fstp	%st(0)
 26:	addl	$8, %esp
+	cfi_adjust_cfa_offset (-8)
 27:	// Raise divide-by-zero exception and get infinity value.
 	fldl	MO(one)
 	fdivl	MO(zero)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 	.align ALIGNARG(4)
 	// x is ħ0 and y is > 0.  We must find out whether y is an odd integer.
 21:	testb	$2, %dh
@@ -323,15 +343,19 @@ ENTRY(__ieee754_powl)
 
 	// OK, the value is an integer, but is it odd?
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	andb	$1, %al
 	jz	24f		// jump if not odd
 	// It's an odd integer.
 	fldl	MO(mzero)
 	ret
 
+	cfi_adjust_cfa_offset (8)
 22:	fstp	%st(0)
 23:	addl	$8, %esp	// Don't use 2 x pop
+	cfi_adjust_cfa_offset (-8)
 24:	fldl	MO(zero)
 	ret
 
diff --git a/sysdeps/i386/fpu/e_scalb.S b/sysdeps/i386/fpu/e_scalb.S
index 1596f6a700..7e334a3611 100644
--- a/sysdeps/i386/fpu/e_scalb.S
+++ b/sysdeps/i386/fpu/e_scalb.S
@@ -64,9 +64,7 @@ ENTRY(__ieee754_scalb)
 	/* y is -inf */
 1:	fxam
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	fnstsw
 	movl	8(%esp), %edx
@@ -86,9 +84,7 @@ ENTRY(__ieee754_scalb)
 2:	fstp	%st
 	fstp	%st
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	fldl	MO(nan)
 	ret
diff --git a/sysdeps/i386/fpu/e_scalbf.S b/sysdeps/i386/fpu/e_scalbf.S
index d41c29327d..e99ee92cb0 100644
--- a/sysdeps/i386/fpu/e_scalbf.S
+++ b/sysdeps/i386/fpu/e_scalbf.S
@@ -66,9 +66,7 @@ ENTRY(__ieee754_scalbf)
 	/* y is -inf */
 1:	fxam
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	fnstsw
 	movl	4(%esp), %edx
@@ -88,9 +86,7 @@ ENTRY(__ieee754_scalbf)
 2:	fstp	%st
 	fstp	%st
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	fldl	MO(nan)
 	ret
diff --git a/sysdeps/i386/fpu/e_scalbl.S b/sysdeps/i386/fpu/e_scalbl.S
index 65644f8f0e..3f67d0befb 100644
--- a/sysdeps/i386/fpu/e_scalbl.S
+++ b/sysdeps/i386/fpu/e_scalbl.S
@@ -66,9 +66,7 @@ ENTRY(__ieee754_scalbl)
 	/* y is -inf */
 1:	fxam
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	fnstsw
 	movl	12(%esp), %edx
@@ -88,9 +86,7 @@ ENTRY(__ieee754_scalbl)
 2:	fstp	%st
 	fstp	%st
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	fldl	MO(nan)
 	ret
diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c
index 55096869a1..feaa24b8d9 100644
--- a/sysdeps/i386/fpu/feholdexcpt.c
+++ b/sysdeps/i386/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1999, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -51,3 +51,4 @@ feholdexcept (fenv_t *envp)
 
   return 0;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c
index 2746f3ebf3..a868f275f0 100644
--- a/sysdeps/i386/fpu/fesetround.c
+++ b/sysdeps/i386/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -50,3 +50,4 @@ fesetround (int round)
 
   return 0;
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 71c1ab5d8e..4efc714b29 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -7,20 +7,20 @@ ldouble: 1
 
 # asin
 Test "asin (-0.5) == -pi/6":
-ldouble: 1
 ildouble: 1
-Test "asin (-1.0) == -pi/2":
 ldouble: 1
+Test "asin (-1.0) == -pi/2":
 ildouble: 1
-Test "asin (0.5) == pi/6":
 ldouble: 1
+Test "asin (0.5) == pi/6":
 ildouble: 1
-Test "asin (0.75) == 0.848062078981481008052944338998418080":
 ldouble: 1
+Test "asin (0.75) == 0.848062078981481008052944338998418080":
 ildouble: 1
-Test "asin (1.0) == pi/2":
 ldouble: 1
+Test "asin (1.0) == pi/2":
 ildouble: 1
+ldouble: 1
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
@@ -35,20 +35,20 @@ ildouble: 2
 ldouble: 2
 
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 9
 idouble: 1
 ifloat: 9
 ildouble: 6
 ldouble: 6
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
+float: 4
 idouble: 1
+ifloat: 4
 ildouble: 1
 ldouble: 1
-ifloat: 4
-float: 4
 Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i":
 ildouble: 1
 ldouble: 1
@@ -149,7 +149,9 @@ float: 1
 idouble: 1
 ifloat: 1
 Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 
 # cexp
@@ -354,7 +356,9 @@ ifloat: 1
 ildouble: 2
 ldouble: 2
 Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
@@ -377,7 +381,9 @@ Test "Real part of: ctan (0.75 + 1.25 i) == 0.1608077859162064267251660581734386
 ildouble: 1
 ldouble: 1
 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 3
 ldouble: 3
@@ -395,7 +401,9 @@ Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
 float: 1
 ifloat: 1
 Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
 double: 1
@@ -473,24 +481,26 @@ float: 1
 # j0
 Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 1
+double: 3
 float: 1
-idouble: 1
+idouble: 3
 ifloat: 1
 Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "j0 (8.0) == 0.171650807137553906090869407851972001":
@@ -498,22 +508,23 @@ float: 1
 ifloat: 1
 
 # j1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+double: 1
+idouble: 1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
-Test "j1 (0.75) == 0.349243602174862192523281016426251335":
-double: 1
-idouble: 1
 Test "j1 (2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
-Test "j1 (0.75) == 0.349243602174862192523281016426251335":
-double: 1
-idouble: 1
 Test "j1 (8.0) == 0.234636346853914624381276651590454612":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
@@ -521,24 +532,26 @@ ldouble: 1
 # jn
 Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 1
+double: 3
 float: 1
-idouble: 1
+idouble: 3
 ifloat: 1
 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
@@ -548,7 +561,9 @@ Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
 double: 1
 idouble: 1
 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
@@ -556,22 +571,24 @@ Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
 Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 ildouble: 1
 ldouble: 1
-ifloat: 1
-float: 1
 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
-float: 1
-ifloat: 1
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
 float: 1
 ifloat: 1
@@ -579,46 +596,46 @@ ildouble: 2
 ldouble: 2
 Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 ildouble: 1
 ldouble: 1
-ifloat: 1
-float: 1
 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
-double: 2
+double: 5
 float: 2
-idouble: 2
+idouble: 5
 ifloat: 2
 ildouble: 2
 ldouble: 2
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
+double: 2
+idouble: 2
 ildouble: 1
 ldouble: 1
-idouble: 2
-double: 2
 Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
 ildouble: 1
 ldouble: 1
 Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
-float: 1
-ifloat: 1
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
 ildouble: 1
 ldouble: 1
 Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
-double: 1
+double: 5
 float: 2
-idouble: 1
+idouble: 5
 ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
-ildouble: 1
-ldouble: 1
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 # lgamma
 Test "lgamma (-0.5) == log(2*sqrt(pi))":
@@ -627,10 +644,10 @@ idouble: 1
 ildouble: 1
 ldouble: 1
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
-float: 1
-ifloat: 1
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
 double: 1
 float: 2
@@ -677,6 +694,7 @@ ldouble: 1
 
 # sinh
 Test "sinh (0.75) == 0.822316731935829980703661634446913849":
+double: 1
 ildouble: 1
 
 # tan
@@ -714,32 +732,39 @@ float: 1
 idouble: 1
 ifloat: 1
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
 ildouble: 1
 ldouble: 1
-ifloat: 1
+Test "y0 (1.5) == 0.382448923797758843955068554978089862":
+double: 1
 float: 1
-double: 2
-idouble: 2
+idouble: 1
+ifloat: 1
 Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
 Test "y0 (8.0) == 0.223521489387566220527323400498620359":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
-Test "y0 (1.5) == 0.382448923797758843955068554978089862":
-float: 1
-ifloat: 1
-double: 1
-idouble: 1
 
 # y1
 Test "y1 (0.125) == -5.19993611253477499595928744876579921":
 ildouble: 1
 ldouble: 1
+Test "y1 (1.0) == -0.781212821300288716547150000047964821":
+double: 1
+idouble: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
 double: 2
 float: 2
@@ -753,13 +778,12 @@ ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "y1 (8.0) == -0.158060461731247494255555266187483550":
+double: 1
 float: 2
+idouble: 1
 ifloat: 2
 ildouble: 1
 ldouble: 1
-Test "y1 (1.0) == -0.781212821300288716547150000047964821":
-double: 1
-idouble: 1
 
 # yn
 Test "yn (0, 0.125) == -1.38968062514384052915582277745018693":
@@ -771,24 +795,28 @@ float: 1
 idouble: 1
 ifloat: 1
 Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
-ildouble: 1
-ldouble: 1
-ifloat: 1
-float: 1
 double: 2
+float: 1
 idouble: 2
-Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
 ifloat: 1
-float: 1
+ildouble: 1
+ldouble: 1
+Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
 Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
@@ -796,8 +824,8 @@ Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
 ildouble: 1
 ldouble: 1
 Test "yn (1, 1.0) == -0.781212821300288716547150000047964821":
-idouble: 1
 double: 1
+idouble: 1
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
 double: 2
 float: 2
@@ -811,13 +839,12 @@ ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
+double: 1
 float: 2
+idouble: 1
 ifloat: 2
 ildouble: 1
 ldouble: 1
-Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
-ifloat: 1
-float: 1
 Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
 double: 1
 float: 1
@@ -841,10 +868,10 @@ float: 3
 idouble: 1
 ifloat: 3
 Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
-float: 3
-ifloat: 3
 double: 2
+float: 3
 idouble: 2
+ifloat: 3
 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
 ildouble: 1
 ldouble: 1
@@ -855,12 +882,12 @@ idouble: 1
 ifloat: 1
 ildouble: 2
 ldouble: 2
-Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
-float: 1
-ifloat: 1
+Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
 double: 1
+float: 1
 idouble: 1
-Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
+ifloat: 1
+Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
 double: 1
 float: 1
 idouble: 1
@@ -872,8 +899,8 @@ ildouble: 622
 ldouble: 622
 
 Function: "asin":
-ldouble: 1
 ildouble: 1
+ldouble: 1
 
 Function: "atanh":
 ildouble: 2
@@ -895,11 +922,11 @@ ldouble: 6
 
 Function: Imaginary part of "cacosh":
 double: 1
+float: 4
 idouble: 1
+ifloat: 4
 ildouble: 1
 ldouble: 1
-ifloat: 4
-float: 4
 
 Function: Real part of "casin":
 double: 1
@@ -1073,7 +1100,9 @@ ildouble: 3
 ldouble: 3
 
 Function: Real part of "ctanh":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 ildouble: 5
 ldouble: 5
@@ -1115,10 +1144,10 @@ Function: "hypot":
 float: 1
 
 Function: "j0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
 ildouble: 1
 ldouble: 1
 
@@ -1131,9 +1160,9 @@ ildouble: 1
 ldouble: 1
 
 Function: "jn":
-double: 2
+double: 5
 float: 2
-idouble: 2
+idouble: 5
 ifloat: 2
 ildouble: 2
 ldouble: 2
@@ -1165,6 +1194,7 @@ ildouble: 1
 ldouble: 1
 
 Function: "sinh":
+double: 1
 ildouble: 1
 
 Function: "tan":
diff --git a/sysdeps/i386/fpu/math_private.h b/sysdeps/i386/fpu/math_private.h
new file mode 100644
index 0000000000..a426788ef1
--- /dev/null
+++ b/sysdeps/i386/fpu/math_private.h
@@ -0,0 +1,18 @@
+#ifndef _MATH_PRIVATE_H
+
+#define math_opt_barrier(x) \
+({ __typeof(x) __x;					\
+   __asm ("" : "=t" (__x) : "0" (x));			\
+   __x; })
+#define math_force_eval(x) \
+do							\
+  {							\
+    if (sizeof (x) <= sizeof (double))			\
+      __asm __volatile ("" : : "m" (x));		\
+    else						\
+      __asm __volatile ("" : : "f" (x));		\
+  }							\
+while (0)
+
+#include <math/math_private.h>
+#endif
diff --git a/sysdeps/i386/fpu/s_asinh.S b/sysdeps/i386/fpu/s_asinh.S
index 6c99d3b6f6..ca042b414b 100644
--- a/sysdeps/i386/fpu/s_asinh.S
+++ b/sysdeps/i386/fpu/s_asinh.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -62,9 +62,7 @@ ENTRY(__asinh)
 	fxch				// |x| : log(2)
 	ja	3f			// |x| > 2^28
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpl	$0x40000000, %eax
 	ja	5f			// |x| > 2
@@ -100,9 +98,7 @@ ENTRY(__asinh)
 	.align ALIGNARG(4)
 2:
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	jecxz	4f
 	fchs				// x
diff --git a/sysdeps/i386/fpu/s_asinhf.S b/sysdeps/i386/fpu/s_asinhf.S
index 32e6fd6071..d0ce6afc22 100644
--- a/sysdeps/i386/fpu/s_asinhf.S
+++ b/sysdeps/i386/fpu/s_asinhf.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -62,9 +62,7 @@ ENTRY(__asinhf)
 	fxch				// |x| : log(2)
 	ja	3f			// |x| > 2^14
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpl	$0x40000000, %eax
 	ja	5f			// |x| > 2
@@ -100,9 +98,7 @@ ENTRY(__asinhf)
 	.align ALIGNARG(4)
 2:
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	jecxz	4f
 	fchs				// x
diff --git a/sysdeps/i386/fpu/s_asinhl.S b/sysdeps/i386/fpu/s_asinhl.S
index 5933460f64..1040eead1c 100644
--- a/sysdeps/i386/fpu/s_asinhl.S
+++ b/sysdeps/i386/fpu/s_asinhl.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -69,9 +69,7 @@ ENTRY(__asinhl)
 	fxch				// |x| : log(2)
 	ja	3f			// |x| > 2^34
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpl	$0x4000, %eax
 	ja	5f			// |x| > 2
@@ -107,9 +105,7 @@ ENTRY(__asinhl)
 	.align ALIGNARG(4)
 2:
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	jecxz	4f
 	fchs				// x
diff --git a/sysdeps/i386/fpu/s_cbrt.S b/sysdeps/i386/fpu/s_cbrt.S
index c69958bb57..e180b15466 100644
--- a/sysdeps/i386/fpu/s_cbrt.S
+++ b/sysdeps/i386/fpu/s_cbrt.S
@@ -1,5 +1,5 @@
 /* Compute cubic root of double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Dirk Alboth <dirka@uni-paderborn.de> and
    Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -89,9 +89,9 @@ ENTRY(__cbrt)
 
 #ifdef PIC
 	pushl	%ebx
-	call	3f
-3:	popl	%ebx
-	addl    $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
 #endif
 
 	cmpl	$0x00100000, %eax
@@ -178,13 +178,17 @@ ENTRY(__cbrt)
 	fdivp	%st, %st(1)		/* u*(t2+2*xm)/(2*t2+xm) */
 	fmull	MOX(16+factor,%ecx)	/* u*(t2+2*xm)/(2*t2+xm)*FACT */
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	fildl	(%esp)			/* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */
 	fxch				/* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */
 	fscale				/* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 #ifdef PIC
 	movl	12(%esp), %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 #else
 	movl	8(%esp), %eax
 #endif
diff --git a/sysdeps/i386/fpu/s_cbrtf.S b/sysdeps/i386/fpu/s_cbrtf.S
index 03d5770efa..2ff4f6e088 100644
--- a/sysdeps/i386/fpu/s_cbrtf.S
+++ b/sysdeps/i386/fpu/s_cbrtf.S
@@ -1,5 +1,5 @@
 /* Compute cubic root of float value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Dirk Alboth <dirka@uni-paderborn.de> and
    Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -76,9 +76,9 @@ ENTRY(__cbrtf)
 
 #ifdef PIC
 	pushl	%ebx
-	call	3f
-3:	popl	%ebx
-	addl    $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
 #endif
 
 	cmpl	$0x00800000, %eax
@@ -155,13 +155,17 @@ ENTRY(__cbrtf)
 	fdivp	%st, %st(1)		/* u*(t2+2*xm)/(2*t2+xm) */
 	fmull	MOX(16+factor,%ecx)	/* u*(t2+2*xm)/(2*t2+xm)*FACT */
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	fildl	(%esp)			/* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */
 	fxch				/* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */
 	fscale				/* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 #ifdef PIC
 	movl	8(%esp), %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 #else
 	movl	4(%esp), %eax
 #endif
diff --git a/sysdeps/i386/fpu/s_cbrtl.S b/sysdeps/i386/fpu/s_cbrtl.S
index f9dac170e0..637ad729c1 100644
--- a/sysdeps/i386/fpu/s_cbrtl.S
+++ b/sysdeps/i386/fpu/s_cbrtl.S
@@ -1,5 +1,5 @@
 /* Compute cubic root of long double value.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Dirk Alboth <dirka@uni-paderborn.de> and
    Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -108,9 +108,9 @@ ENTRY(__cbrtl)
 
 #ifdef PIC
 	pushl	%ebx
-	call	3f
-3:	popl	%ebx
-	addl    $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
+	LOAD_PIC_REG (bx)
 #endif
 
 	cmpl	$0, %eax
@@ -206,13 +206,17 @@ ENTRY(__cbrtl)
 	fldt	MOX(32+factor,%ecx)
 	fmulp				/* u*(t2+2*xm)/(2*t2+xm)*FACT */
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	fildl	(%esp)			/* xe/3 : u*(t2+2*xm)/(2*t2+xm)*FACT */
 	fxch				/* u*(t2+2*xm)/(2*t2+xm)*FACT : xe/3 */
 	fscale				/* u*(t2+2*xm)/(2*t2+xm)*FACT*2^xe/3 */
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 #ifdef PIC
 	movl	16(%esp), %eax
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 #else
 	movl	12(%esp), %eax
 #endif
diff --git a/sysdeps/i386/fpu/s_cexp.S b/sysdeps/i386/fpu/s_cexp.S
index 50d17aea11..47e3eb66a6 100644
--- a/sysdeps/i386/fpu/s_cexp.S
+++ b/sysdeps/i386/fpu/s_cexp.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of complex exponential function for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -71,9 +71,7 @@ ENTRY(__cexp)
 	fnstsw
 	fldl	16(%esp)		/* y : x */
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	movb	%ah, %dh
 	andb	$0x45, %ah
diff --git a/sysdeps/i386/fpu/s_cexpf.S b/sysdeps/i386/fpu/s_cexpf.S
index 396e056135..f116854096 100644
--- a/sysdeps/i386/fpu/s_cexpf.S
+++ b/sysdeps/i386/fpu/s_cexpf.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of complex exponential function for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -71,9 +71,7 @@ ENTRY(__cexpf)
 	fnstsw
 	flds	8(%esp)			/* y : x */
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	movb	%ah, %dh
 	andb	$0x45, %ah
@@ -114,10 +112,13 @@ ENTRY(__cexpf)
 	fmulp	%st, %st(3)	/* sin(y) : e^x : e^x * cos(y) */
 	fmulp	%st, %st(1)	/* e^x * sin(y) : e^x * cos(y) */
 	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
 	fstps	4(%esp)
 	fstps	(%esp)
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	ret
 
 	/* We have to reduce the argument to fsincos.  */
@@ -133,10 +134,13 @@ ENTRY(__cexpf)
 	fmulp	%st, %st(3)
 	fmulp	%st, %st(1)
 	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
 	fstps	4(%esp)
 	fstps	(%esp)
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	ret
 
 	/* The real part is +-inf.  We must make further differences.  */
@@ -210,12 +214,14 @@ ENTRY(__cexpf)
 	   +-Inf+-0i.  */
 	.align ALIGNARG(4)
 4:	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
 	fstps	(%esp)
 	shrl	$6, %edx
 	fstp	%st(0)
 	andl	$8, %edx
 	movl	MOX(huge_nan_null_null,%edx,1), %eax
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	ret
 
 	/* The real part is +-Inf, the imaginary is also is not finite.  */
diff --git a/sysdeps/i386/fpu/s_cexpl.S b/sysdeps/i386/fpu/s_cexpl.S
index cbc7c99f0e..8bb0680bce 100644
--- a/sysdeps/i386/fpu/s_cexpl.S
+++ b/sysdeps/i386/fpu/s_cexpl.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of complex exponential function for double.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -71,9 +71,7 @@ ENTRY(__cexpl)
 	fnstsw
 	fldt	20(%esp)		/* y : x */
 #ifdef  PIC
-        call    1f
-1:      popl    %ecx
-        addl    $_GLOBAL_OFFSET_TABLE_+[.-1b], %ecx
+	LOAD_PIC_REG (cx)
 #endif
 	movb	%ah, %dh
 	andb	$0x45, %ah
diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S
index 35e1ff6693..e761183639 100644
--- a/sysdeps/i386/fpu/s_expm1.S
+++ b/sysdeps/i386/fpu/s_expm1.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
@@ -56,9 +56,7 @@ ENTRY(__expm1)
 	cmpb	$0x40, %ch
 	je	3f		// If +-0, jump.
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpb	$0x05, %ch
 	je	2f		// If +-Inf, jump.
diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S
index c2c64f0748..88adb75b86 100644
--- a/sysdeps/i386/fpu/s_expm1f.S
+++ b/sysdeps/i386/fpu/s_expm1f.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
@@ -56,9 +56,7 @@ ENTRY(__expm1f)
 	cmpb	$0x40, %ch
 	je	3f		// If +-0, jump.
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpb	$0x05, %ch
 	je	2f		// If +-Inf, jump.
diff --git a/sysdeps/i386/fpu/s_expm1l.S b/sysdeps/i386/fpu/s_expm1l.S
index 4d491c02f8..2dc379b790 100644
--- a/sysdeps/i386/fpu/s_expm1l.S
+++ b/sysdeps/i386/fpu/s_expm1l.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of exp(x)-1.
-   Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
@@ -56,9 +56,7 @@ ENTRY(__expm1l)
 	cmpb	$0x40, %ch
 	je	3f		// If +-0, jump.
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	cmpb	$0x05, %ch
 	je	2f		// If +-Inf, jump.
diff --git a/sysdeps/i386/fpu/s_frexp.S b/sysdeps/i386/fpu/s_frexp.S
index 563105a917..cfc822106e 100644
--- a/sysdeps/i386/fpu/s_frexp.S
+++ b/sysdeps/i386/fpu/s_frexp.S
@@ -1,5 +1,5 @@
 /* ix87 specific frexp implementation for double.
-   Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -63,9 +63,7 @@ ENTRY (BP_SYM (__frexp))
 
 	fldl	VAL0(%esp)
 #ifdef	PIC
-	call	3f
-3:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-3b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fmull	MO(two54)
 	movl	$-54, %ecx
diff --git a/sysdeps/i386/fpu/s_frexpf.S b/sysdeps/i386/fpu/s_frexpf.S
index 00c4ab5b8e..8640bbc223 100644
--- a/sysdeps/i386/fpu/s_frexpf.S
+++ b/sysdeps/i386/fpu/s_frexpf.S
@@ -1,5 +1,5 @@
 /* ix87 specific frexp implementation for float.
-   Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -60,9 +60,7 @@ ENTRY (BP_SYM (__frexpf))
 
 	flds	VAL(%esp)
 #ifdef	PIC
-	call	3f
-3:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-3b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 	fmuls	MO(two25)
 	movl	$-25, %ecx
diff --git a/sysdeps/i386/fpu/s_frexpl.S b/sysdeps/i386/fpu/s_frexpl.S
index 1417507ded..60ae57ee3e 100644
--- a/sysdeps/i386/fpu/s_frexpl.S
+++ b/sysdeps/i386/fpu/s_frexpl.S
@@ -1,5 +1,5 @@
 /* ix87 specific frexp implementation for long double.
-   Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -65,9 +65,7 @@ ENTRY (BP_SYM (__frexpl))
 
 	fldt	VAL0(%esp)
 #ifdef	PIC
-	call	3f
-3:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-3b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 
 	fmull	MO(two64)	/* It's not necessary to use a 80bit factor */
diff --git a/sysdeps/i386/fpu/s_ilogb.S b/sysdeps/i386/fpu/s_ilogb.S
index 68d9c1a680..0cf1ad7419 100644
--- a/sysdeps/i386/fpu/s_ilogb.S
+++ b/sysdeps/i386/fpu/s_ilogb.S
@@ -21,11 +21,13 @@ ENTRY(__ilogb)
 
 	fxtract
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	fstp	%st
 
 	fistpl	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 
 	ret
 
diff --git a/sysdeps/i386/fpu/s_ilogbf.S b/sysdeps/i386/fpu/s_ilogbf.S
index 521afe2b60..99e53edd75 100644
--- a/sysdeps/i386/fpu/s_ilogbf.S
+++ b/sysdeps/i386/fpu/s_ilogbf.S
@@ -21,11 +21,13 @@ ENTRY(__ilogbf)
 
 	fxtract
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	fstp	%st
 
 	fistpl	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 
 	ret
 
diff --git a/sysdeps/i386/fpu/s_ilogbl.S b/sysdeps/i386/fpu/s_ilogbl.S
index ed547bdc8b..1f559b311e 100644
--- a/sysdeps/i386/fpu/s_ilogbl.S
+++ b/sysdeps/i386/fpu/s_ilogbl.S
@@ -22,11 +22,13 @@ ENTRY(__ilogbl)
 
 	fxtract
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	fstp	%st
 
 	fistpl	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 
 	ret
 
diff --git a/sysdeps/i386/fpu/s_llrint.S b/sysdeps/i386/fpu/s_llrint.S
index e8e5ecee09..23bbec6024 100644
--- a/sysdeps/i386/fpu/s_llrint.S
+++ b/sysdeps/i386/fpu/s_llrint.S
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,10 +25,13 @@
 ENTRY(__llrint)
 	fldl	4(%esp)
 	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
 	fistpll	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	ret
 END(__llrint)
 weak_alias (__llrint, llrint)
diff --git a/sysdeps/i386/fpu/s_llrintf.S b/sysdeps/i386/fpu/s_llrintf.S
index 1deabc4f54..3de73f6661 100644
--- a/sysdeps/i386/fpu/s_llrintf.S
+++ b/sysdeps/i386/fpu/s_llrintf.S
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,10 +25,13 @@
 ENTRY(__llrintf)
 	flds	4(%esp)
 	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
 	fistpll	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	ret
 END(__llrintf)
 weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/i386/fpu/s_llrintl.S b/sysdeps/i386/fpu/s_llrintl.S
index b34d79a5d8..f6545e9fcd 100644
--- a/sysdeps/i386/fpu/s_llrintl.S
+++ b/sysdeps/i386/fpu/s_llrintl.S
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,10 +25,13 @@
 ENTRY(__llrintl)
 	fldt	4(%esp)
 	subl	$8, %esp
+	cfi_adjust_cfa_offset (8)
 	fistpll	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	ret
 END(__llrintl)
 weak_alias (__llrintl, llrintl)
diff --git a/sysdeps/i386/fpu/s_log1p.S b/sysdeps/i386/fpu/s_log1p.S
index d3bc3d7251..ec777fdf93 100644
--- a/sysdeps/i386/fpu/s_log1p.S
+++ b/sysdeps/i386/fpu/s_log1p.S
@@ -31,9 +31,7 @@ ENTRY(__log1p)
 	fldl	4(%esp)
 
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 
 	fxam
diff --git a/sysdeps/i386/fpu/s_log1pf.S b/sysdeps/i386/fpu/s_log1pf.S
index d5283fcfee..6919ac902e 100644
--- a/sysdeps/i386/fpu/s_log1pf.S
+++ b/sysdeps/i386/fpu/s_log1pf.S
@@ -31,9 +31,7 @@ ENTRY(__log1pf)
 	flds	4(%esp)
 
 #ifdef	PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 
 	fxam
diff --git a/sysdeps/i386/fpu/s_log1pl.S b/sysdeps/i386/fpu/s_log1pl.S
index 26c407b606..4bca67d6b0 100644
--- a/sysdeps/i386/fpu/s_log1pl.S
+++ b/sysdeps/i386/fpu/s_log1pl.S
@@ -36,9 +36,7 @@ ENTRY(__log1pl)
 	fldt	4(%esp)
 
 #ifdef PIC
-	call	1f
-1:	popl	%edx
-	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
+	LOAD_PIC_REG (dx)
 #endif
 
 	fxam
diff --git a/sysdeps/i386/fpu/s_lrint.S b/sysdeps/i386/fpu/s_lrint.S
index a15f54f1da..799875b335 100644
--- a/sysdeps/i386/fpu/s_lrint.S
+++ b/sysdeps/i386/fpu/s_lrint.S
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,9 +25,11 @@
 ENTRY(__lrint)
 	fldl	4(%esp)
 	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
 	fistpl	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	ret
 END(__lrint)
 weak_alias (__lrint, lrint)
diff --git a/sysdeps/i386/fpu/s_lrintf.S b/sysdeps/i386/fpu/s_lrintf.S
index 0f15e64de2..2aa1a4e83d 100644
--- a/sysdeps/i386/fpu/s_lrintf.S
+++ b/sysdeps/i386/fpu/s_lrintf.S
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,9 +25,11 @@
 ENTRY(__lrintf)
 	flds	4(%esp)
 	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
 	fistpl	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	ret
 END(__lrintf)
 weak_alias (__lrintf, lrintf)
diff --git a/sysdeps/i386/fpu/s_lrintl.S b/sysdeps/i386/fpu/s_lrintl.S
index 90313d612c..c0211c11da 100644
--- a/sysdeps/i386/fpu/s_lrintl.S
+++ b/sysdeps/i386/fpu/s_lrintl.S
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,9 +25,11 @@
 ENTRY(__lrintl)
 	fldt	4(%esp)
 	subl	$4, %esp
+	cfi_adjust_cfa_offset (4)
 	fistpl	(%esp)
 	fwait
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	ret
 END(__lrintl)
 weak_alias (__lrintl, lrintl)
diff --git a/sysdeps/i386/fpu/s_nearbyint.S b/sysdeps/i386/fpu/s_nearbyint.S
index d8bb382d9e..52909139a9 100644
--- a/sysdeps/i386/fpu/s_nearbyint.S
+++ b/sysdeps/i386/fpu/s_nearbyint.S
@@ -9,7 +9,9 @@
 ENTRY(__nearbyint)
 	fldl	4(%esp)
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	pushl	%ecx
+	cfi_adjust_cfa_offset (4)
 	fnstcw	(%esp)
 	movl	(%esp), %eax
 	orl	$0x20, %eax
@@ -19,7 +21,9 @@ ENTRY(__nearbyint)
 	fclex
 	fldcw	(%esp)
 	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	ret
 END (__nearbyint)
 weak_alias (__nearbyint, nearbyint)
diff --git a/sysdeps/i386/fpu/s_nearbyintf.S b/sysdeps/i386/fpu/s_nearbyintf.S
index 21858650e2..6a6b1d6c2b 100644
--- a/sysdeps/i386/fpu/s_nearbyintf.S
+++ b/sysdeps/i386/fpu/s_nearbyintf.S
@@ -9,7 +9,9 @@
 ENTRY(__nearbyintf)
 	flds	4(%esp)
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	pushl	%ecx
+	cfi_adjust_cfa_offset (4)
 	fnstcw	(%esp)
 	movl	(%esp), %eax
 	orl	$0x20, %eax
@@ -19,7 +21,9 @@ ENTRY(__nearbyintf)
 	fclex
 	fldcw	(%esp)
 	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	ret
 END (__nearbyintf)
 weak_alias (__nearbyintf, nearbyintf)
diff --git a/sysdeps/i386/fpu/s_nearbyintl.S b/sysdeps/i386/fpu/s_nearbyintl.S
index d74dacb990..819af63a8d 100644
--- a/sysdeps/i386/fpu/s_nearbyintl.S
+++ b/sysdeps/i386/fpu/s_nearbyintl.S
@@ -9,7 +9,9 @@
 ENTRY(__nearbyintl)
 	fldt	4(%esp)
 	pushl	%eax
+	cfi_adjust_cfa_offset (4)
 	pushl	%ecx
+	cfi_adjust_cfa_offset (4)
 	fnstcw	(%esp)
 	movl	(%esp), %eax
 	orl	$0x20, %eax
@@ -19,7 +21,9 @@ ENTRY(__nearbyintl)
 	fclex
 	fldcw	(%esp)
 	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
 	popl	%eax
+	cfi_adjust_cfa_offset (-4)
 	ret
 END (__nearbyintl)
 weak_alias (__nearbyintl, nearbyintl)
diff --git a/sysdeps/i386/fpu/s_nextafterl.c b/sysdeps/i386/fpu/s_nextafterl.c
index 5b617cb4e7..aef0a144e5 100644
--- a/sysdeps/i386/fpu/s_nextafterl.c
+++ b/sysdeps/i386/fpu/s_nextafterl.c
@@ -27,7 +27,7 @@ static char rcsid[] = "$NetBSD: $";
  */
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
 
 #ifdef __STDC__
 	long double __nextafterl(long double x, long double y)
@@ -52,9 +52,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if(x==y) return y;		/* x=y, return y */
 	if((ix|hx|lx)==0) {			/* x == 0 */
+	    long double u;
 	    SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(esx>=0) {			/* x > 0 */
 	    if(esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
@@ -109,12 +112,9 @@ static char rcsid[] = "$NetBSD: $";
 	}
 	esy = esx&0x7fff;
 	if(esy==0x7fff) return x+x;	/* overflow  */
-	if(esy==0) {			/* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        SET_LDOUBLE_WORDS(y,esx,hx,lx);
-		return y;
-	    }
+	if(esy==0) {
+	    long double u = x*x;		/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	SET_LDOUBLE_WORDS(x,esx,hx,lx);
 	return x;
diff --git a/sysdeps/i386/fpu/s_nexttoward.c b/sysdeps/i386/fpu/s_nexttoward.c
index 2bd768e448..9bd86a3724 100644
--- a/sysdeps/i386/fpu/s_nexttoward.c
+++ b/sysdeps/i386/fpu/s_nexttoward.c
@@ -27,7 +27,8 @@ static char rcsid[] = "$NetBSD: $";
  */
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
+#include <float.h>
 
 #ifdef __STDC__
 	double __nexttoward(double x, long double y)
@@ -52,10 +53,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if((long double) x==y) return y;	/* x=y, return y */
 	if((ix|lx)==0) {			/* x == 0 */
-	    double x2;
+	    double u;
 	    INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */
-	    x2 = x*x;
-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
 	    if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00
@@ -85,16 +88,14 @@ static char rcsid[] = "$NetBSD: $";
 	hy = hx&0x7ff00000;
 	if(hy>=0x7ff00000) {
 	  x = x+x;	/* overflow  */
-	  /* Force conversion to double.  */
-	  asm ("" : "=m"(x) : "m"(x));
+	  if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
+	    /* Force conversion to double.  */
+	    asm ("" : "+m"(x));
 	  return x;
 	}
-	if(hy<0x00100000) {		/* underflow */
-	    double x2 = x*x;
-	    if(x2!=x) {		/* raise underflow flag */
-	        INSERT_WORDS(x2,hx,lx);
-		return x2;
-	    }
+	if(hy<0x00100000) {
+	    double u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	INSERT_WORDS(x,hx,lx);
 	return x;
diff --git a/sysdeps/i386/fpu/s_nexttowardf.c b/sysdeps/i386/fpu/s_nexttowardf.c
index 3fbe53c338..25f70e4f4d 100644
--- a/sysdeps/i386/fpu/s_nexttowardf.c
+++ b/sysdeps/i386/fpu/s_nexttowardf.c
@@ -19,7 +19,8 @@ static char rcsid[] = "$NetBSD: $";
 #endif
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
+#include <float.h>
 
 #ifdef __STDC__
 	float __nexttowardf(float x, long double y)
@@ -44,10 +45,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if((long double) x==y) return y;	/* x=y, return y */
 	if(ix==0) {				/* x == 0 */
-	    float x2;
+	    float u;
 	    SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/
-	    x2 = x*x;
-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
 	    if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80
@@ -69,16 +72,14 @@ static char rcsid[] = "$NetBSD: $";
 	hy = hx&0x7f800000;
 	if(hy>=0x7f800000) {
 	  x = x+x;	/* overflow  */
-	  /* Force conversion to float.  */
-	  asm ("" : "=m"(x) : "m"(x));
+	  if (FLT_EVAL_METHOD != 0)
+	    /* Force conversion to float.  */
+	    asm ("" : "+m"(x));
 	  return x;
 	}
-	if(hy<0x00800000) {		/* underflow */
-	    float x2 = x*x;
-	    if(x2!=x) {		/* raise underflow flag */
-	        SET_FLOAT_WORD(x2,hx);
-		return x2;
-	    }
+	if(hy<0x00800000) {
+	    float u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	SET_FLOAT_WORD(x,hx);
 	return x;
diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S
index 727d7a0ab8..8b11adb2e3 100644
--- a/sysdeps/i386/i386-mcount.S
+++ b/sysdeps/i386/i386-mcount.S
@@ -52,4 +52,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/i386/i486/strcat.S b/sysdeps/i386/i486/strcat.S
index 7d8279fe14..ec7d4c80b6 100644
--- a/sysdeps/i386/i486/strcat.S
+++ b/sysdeps/i386/i486/strcat.S
@@ -1,6 +1,6 @@
 /* strcat(dest, src) -- Append SRC on the end of DEST.
    For Intel 80x86, x>=4.
-   Copyright (C) 1994,1995,1996,1997,2000,2003 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997,2000,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>.
    Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -35,6 +35,7 @@ ENTRY (BP_SYM (strcat))
 	ENTER
 
 	pushl %edi		/* Save callee-safe register.  */
+	cfi_adjust_cfa_offset (4)
 
 	movl DEST(%esp), %edx
 	movl SRC(%esp), %ecx
@@ -66,6 +67,7 @@ ENTRY (BP_SYM (strcat))
 	/* Now we are aligned.  Begin scan loop.  */
 	jmp L(1)
 
+	cfi_rel_offset (edi, 0)
 	ALIGN(4)
 
 L(4):	addl $16,%edx		/* increment destination pointer for round */
@@ -263,6 +265,8 @@ L(8):	/* GKM FIXME: check high bounds */
 	movl DEST(%esp), %eax	/* start address of destination is result */
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 	popl %edi		/* restore saved register */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/i586/add_n.S b/sysdeps/i386/i586/add_n.S
index c2afc37ee3..57706b23b4 100644
--- a/sysdeps/i386/i586/add_n.S
+++ b/sysdeps/i386/i586/add_n.S
@@ -1,6 +1,6 @@
 /* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store
    sum in a third limb vector.
-   Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,94,95,96,97,98,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -34,13 +34,20 @@ ENTRY (BP_SYM (__mpn_add_n))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 12)
 	movl	S1(%esp),%esi
+	cfi_rel_offset (esi, 8)
 	movl	S2(%esp),%ebx
+	cfi_rel_offset (ebx, 0)
 	movl	SIZE(%esp),%ecx
 #if __BOUNDED_POINTERS__
 	shll	$2, %ecx		/* convert limbs to bytes */
@@ -50,6 +57,7 @@ ENTRY (BP_SYM (__mpn_add_n))
 	shrl	$2, %ecx
 #endif
 	movl	(%ebx),%ebp
+	cfi_rel_offset (ebp, 4)
 
 	decl	%ecx
 	movl	%ecx,%edx
@@ -58,6 +66,7 @@ ENTRY (BP_SYM (__mpn_add_n))
 	testl	%ecx,%ecx		/* zero carry flag */
 	jz	L(end)
 	pushl	%edx
+	cfi_adjust_cfa_offset (4)
 
 	ALIGN (3)
 L(oop):	movl	28(%edi),%eax		/* fetch destination cache line */
@@ -105,6 +114,7 @@ L(4):	movl	24(%esi),%eax
 	jnz	L(oop)
 
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 L(end):
 	decl	%edx			/* test %edx w/o clobbering carry */
 	js	L(end2)
@@ -128,9 +138,17 @@ L(end2):
 	negl	%eax
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i586/addmul_1.S b/sysdeps/i386/i586/addmul_1.S
index 9329637fe2..1890c5dfa1 100644
--- a/sysdeps/i386/i586/addmul_1.S
+++ b/sysdeps/i386/i586/addmul_1.S
@@ -1,6 +1,6 @@
 /* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add
    the result to a second limb vector.
-   Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc.
+   Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -38,15 +38,22 @@
 ENTRY (BP_SYM (__mpn_addmul_1))
 	ENTER
 
-	pushl	%edi
-	pushl	%esi
+	pushl	%res_ptr
+	cfi_adjust_cfa_offset (4)
+	pushl	%s1_ptr
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
-	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%s2_limb
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp), %res_ptr
+	cfi_rel_offset (res_ptr, 12)
 	movl	S1(%esp), %s1_ptr
+	cfi_rel_offset (s1_ptr, 8)
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
+	cfi_rel_offset (s2_limb, 0)
 #if __BOUNDED_POINTERS__
 	shll	$2, %size	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
@@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_addmul_1))
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
 	xorl	%ebp, %ebp
+	cfi_rel_offset (ebp, 4)
 	ALIGN (3)
 
 L(oop):	adcl	$0, %ebp
@@ -78,10 +86,18 @@ L(oop):	adcl	$0, %ebp
 
 	adcl	$0, %ebp
 	movl	%ebp, %eax
-	popl	%ebx
+	popl	%s2_limb
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s2_limb)
 	popl	%ebp
-	popl	%esi
-	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%s1_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s1_ptr)
+	popl	%res_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (res_ptr)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i586/lshift.S b/sysdeps/i386/i586/lshift.S
index 59d587934e..bc73ee6f3c 100644
--- a/sysdeps/i386/i586/lshift.S
+++ b/sysdeps/i386/i586/lshift.S
@@ -1,5 +1,5 @@
 /* Pentium optimized __mpn_lshift --
-   Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,94,95,96,97,98,2000,2005 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
@@ -33,13 +33,21 @@ ENTRY (BP_SYM (__mpn_lshift))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebp, 0)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 12)
 	movl	S(%esp),%esi
+	cfi_rel_offset (esi, 8)
 	movl	SIZE(%esp),%ebx
+	cfi_rel_offset (ebx, 0)
 	movl	CNT(%esp),%ecx
 #if __BOUNDED_POINTERS__
 	shll	$2, %ebx		/* convert limbs to bytes */
@@ -67,9 +75,11 @@ L(normal):
 	xorl	%eax,%eax
 	shldl	%cl,%edx,%eax		/* compute carry limb */
 	pushl	%eax			/* push carry limb onto stack */
+	cfi_adjust_cfa_offset (4)
 
 	decl	%ebx
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	shrl	$3,%ebx
 	jz	L(end)
 
@@ -113,6 +123,7 @@ L(oop):	movl	-28(%edi),%eax		/* fetch destination cache line */
 	jnz	L(oop)
 
 L(end):	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
 	andl	$7,%ebx
 	jz	L(end2)
 L(oop2):
@@ -130,11 +141,20 @@ L(end2):
 	movl	%edx,(%edi)		/* store it */
 
 	popl	%eax			/* pop carry limb */
+	cfi_adjust_cfa_offset (-4)
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
@@ -144,12 +164,18 @@ L(end2):
    function is documented to work for overlapping source and destination.
 */
 
+	cfi_adjust_cfa_offset (16)
+	cfi_rel_offset (edi, 12)
+	cfi_rel_offset (esi, 8)
+	cfi_rel_offset (ebp, 4)
+	cfi_rel_offset (ebx, 0)
 L(special):
 	movl	(%esi),%edx
 	addl	$4,%esi
 
 	decl	%ebx
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	shrl	$3,%ebx
 
 	addl	%edx,%edx
@@ -199,6 +225,7 @@ L(Loop):
 
 L(Lend):
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
 	sbbl	%eax,%eax		/* save carry in %eax */
 	andl	$7,%ebx
 	jz	L(Lend2)
@@ -223,9 +250,17 @@ L(L1):	movl	%edx,(%edi)		/* store last limb */
 	negl	%eax
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S
index d8181ffa1b..6ab457fc55 100644
--- a/sysdeps/i386/i586/memcpy.S
+++ b/sysdeps/i386/i586/memcpy.S
@@ -1,5 +1,5 @@
 /* Highly optimized version for i586.
-   Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -39,10 +39,14 @@ ENTRY (BP_SYM (memcpy))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 
 	movl	DEST(%esp), %edi
+	cfi_rel_offset (edi, 4)
 	movl	SRC(%esp), %esi
+	cfi_rel_offset (esi, 0)
 	movl	LEN(%esp), %ecx
 	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx)
 	CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx)
@@ -111,7 +115,11 @@ L(1):	rep; movsb
 #endif
 
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/i586/memset.S b/sysdeps/i386/i586/memset.S
index 0b59849f9e..c21e9f7a71 100644
--- a/sysdeps/i386/i586/memset.S
+++ b/sysdeps/i386/i586/memset.S
@@ -1,6 +1,6 @@
 /* memset/bzero -- set memory area to CH/0
    Highly optimized version for ix86, x>=5.
-   Copyright (C) 1996, 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Torbjorn Granlund, <tege@matematik.su.se>
 
@@ -42,8 +42,10 @@ ENTRY (BP_SYM (memset))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	movl	DEST(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl	LEN(%esp), %edx
 	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %edx)
 #if BZERO_P
@@ -106,6 +108,8 @@ L(2):	shrl	$2, %ecx	/* convert byte count to longword count */
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 #endif
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 #if BZERO_P
diff --git a/sysdeps/i386/i586/memusage.h b/sysdeps/i386/i586/memusage.h
new file mode 100644
index 0000000000..c8170874d0
--- /dev/null
+++ b/sysdeps/i386/i586/memusage.h
@@ -0,0 +1 @@
+#include "../i686/memusage.h"
diff --git a/sysdeps/i386/i586/mul_1.S b/sysdeps/i386/i586/mul_1.S
index f7865697e6..15765d758f 100644
--- a/sysdeps/i386/i586/mul_1.S
+++ b/sysdeps/i386/i586/mul_1.S
@@ -1,6 +1,6 @@
 /* Pentium __mpn_mul_1 -- Multiply a limb vector with a limb and store
    the result in a second limb vector.
-   Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc.
+   Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -38,15 +38,22 @@
 ENTRY (BP_SYM (__mpn_mul_1))
 	ENTER
 
-	pushl	%edi
-	pushl	%esi
+	pushl	%res_ptr
+	cfi_adjust_cfa_offset (4)
+	pushl	%s1_ptr
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
-	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%s2_limb
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp), %res_ptr
+	cfi_rel_offset (res_ptr, 12)
 	movl	S1(%esp), %s1_ptr
+	cfi_rel_offset (s1_ptr, 8)
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
+	cfi_rel_offset (s2_limb, 0)
 #if __BOUNDED_POINTERS__
 	shll	$2, %size	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
@@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_mul_1))
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
 	xorl	%ebp, %ebp
+	cfi_rel_offset (ebp, 4)
 	ALIGN (3)
 
 L(oop):	adcl	$0, %ebp
@@ -74,10 +82,18 @@ L(oop):	adcl	$0, %ebp
 
 	adcl	$0, %ebp
 	movl	%ebp, %eax
-	popl	%ebx
+	popl	%s2_limb
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s2_limb)
 	popl	%ebp
-	popl	%esi
-	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%s1_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s1_ptr)
+	popl	%res_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (res_ptr)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i586/rshift.S b/sysdeps/i386/i586/rshift.S
index db9326a442..7b88289d3e 100644
--- a/sysdeps/i386/i586/rshift.S
+++ b/sysdeps/i386/i586/rshift.S
@@ -1,5 +1,5 @@
 /* Pentium optimized __mpn_rshift --
-   Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,94,95,96,97,98,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -33,13 +33,21 @@ ENTRY (BP_SYM (__mpn_rshift))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebp, 0)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 12)
 	movl	S(%esp),%esi
+	cfi_rel_offset (esi, 8)
 	movl	SIZE(%esp),%ebx
+	cfi_rel_offset (ebx, 0)
 	movl	CNT(%esp),%ecx
 #if __BOUNDED_POINTERS__
 	shll	$2, %ebx		/* convert limbs to bytes */
@@ -64,9 +72,11 @@ L(normal):
 	xorl	%eax,%eax
 	shrdl	%cl,%edx,%eax		/* compute carry limb */
 	pushl	%eax			/* push carry limb onto stack */
+	cfi_adjust_cfa_offset (4)
 
 	decl	%ebx
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	shrl	$3,%ebx
 	jz	L(end)
 
@@ -110,6 +120,7 @@ L(oop):	movl	28(%edi),%eax		/* fetch destination cache line */
 	jnz	L(oop)
 
 L(end):	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
 	andl	$7,%ebx
 	jz	L(end2)
 L(oop2):
@@ -127,11 +138,20 @@ L(end2):
 	movl	%edx,(%edi)		/* store it */
 
 	popl	%eax			/* pop carry limb */
+	cfi_adjust_cfa_offset (-4)
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
@@ -141,6 +161,11 @@ L(end2):
    function is documented to work for overlapping source and destination.
 */
 
+	cfi_adjust_cfa_offset (16)
+	cfi_rel_offset (edi, 12)
+	cfi_rel_offset (esi, 8)
+	cfi_rel_offset (ebp, 4)
+	cfi_rel_offset (ebx, 0)
 L(special):
 	leal	-4(%edi,%ebx,4),%edi
 	leal	-4(%esi,%ebx,4),%esi
@@ -150,6 +175,7 @@ L(special):
 
 	decl	%ebx
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	shrl	$3,%ebx
 
 	shrl	$1,%edx
@@ -199,6 +225,7 @@ L(Loop):
 
 L(Lend):
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
 	sbbl	%eax,%eax		/* save carry in %eax */
 	andl	$7,%ebx
 	jz	L(Lend2)
@@ -223,9 +250,17 @@ L(L1):	movl	%edx,(%edi)		/* store last limb */
 	rcrl	$1,%eax
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i586/strchr.S b/sysdeps/i386/i586/strchr.S
index 9df504d335..136b19a3f3 100644
--- a/sysdeps/i386/i586/strchr.S
+++ b/sysdeps/i386/i586/strchr.S
@@ -1,6 +1,6 @@
 /* Find character CH in a NUL terminated string.
    Highly optimized version for ix85, x>=5.
-   Copyright (C) 1995, 1996, 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995,1996,1997,2000,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
 
@@ -47,16 +47,21 @@ ENTRY (BP_SYM (strchr))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers.  */
+	cfi_adjust_cfa_offset (-4)
 	pushl %esi
+	cfi_adjust_cfa_offset (-4)
 
 	pushl %ebx
+	cfi_adjust_cfa_offset (-4)
 	pushl %ebp
+	cfi_adjust_cfa_offset (-4)
 
 	movl STR(%esp), %eax
 	movl CHR(%esp), %edx
 	CHECK_BOUNDS_LOW (%eax, STR(%esp))
 
 	movl %eax, %edi		/* duplicate string pointer for later */
+	cfi_rel_offset (edi, 12)
 	xorl %ecx, %ecx		/* clear %ecx */
 
 	/* At the moment %edx contains C.  What we need for the
@@ -107,6 +112,10 @@ L(0):	movb (%eax), %cl	/* load single byte */
 
 	incl %eax		/* increment pointer */
 
+	cfi_rel_offset (esi, 8)
+	cfi_rel_offset (ebx, 4)
+	cfi_rel_offset (ebp, 0)
+
 	/* The following code is the preparation for the loop.  The
 	   four instruction up to `L1' will not be executed in the loop
 	   because the same code is found at the end of the loop, but
@@ -283,15 +292,28 @@ L(5):	subl $4, %eax		/* adjust pointer */
 
 L(2):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	RETURN_BOUNDED_POINTER (STR(%esp))
-	popl %ebp		/* restore saved registers */
+L(out):	popl %ebp		/* restore saved registers */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
 
+	cfi_adjust_cfa_offset (16)
+	cfi_rel_offset (edi, 12)
+	cfi_rel_offset (esi, 8)
+	cfi_rel_offset (ebx, 4)
+	cfi_rel_offset (ebp, 0)
 	/* We know there is a NUL byte in the word.  But we have to test
 	   whether there is an C byte before it in the word.  */
 L(4):	subl $4, %eax		/* adjust pointer */
@@ -327,14 +349,7 @@ L(4):	subl $4, %eax		/* adjust pointer */
 
 L(3):	xorl %eax, %eax
 	RETURN_NULL_BOUNDED_POINTER
-	popl %ebp		/* restore saved registers */
-	popl %ebx
-
-	popl %esi
-	popl %edi
-
-	LEAVE
-	RET_PTR
+	jmp L(out)
 END (BP_SYM (strchr))
 
 #undef index
diff --git a/sysdeps/i386/i586/strcpy.S b/sysdeps/i386/i586/strcpy.S
index f7c1986b4b..5426e59749 100644
--- a/sysdeps/i386/i586/strcpy.S
+++ b/sysdeps/i386/i586/strcpy.S
@@ -1,5 +1,5 @@
 /* strcpy/stpcpy implementation for i586.
-   Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -39,11 +39,16 @@ ENTRY (BP_SYM (STRCPY))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 
 	movl	DEST(%esp), %edi
+	cfi_rel_offset (edi, 8)
 	movl	SRC(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	CHECK_BOUNDS_LOW (%edi, DEST(%esp))
 	CHECK_BOUNDS_LOW (%esi, SRC(%esp))
 
@@ -51,11 +56,14 @@ ENTRY (BP_SYM (STRCPY))
 	leal	-1(%esi), %ecx
 
 	movl	$magic, %ebx
+	cfi_rel_offset (ebx, 0)
 	andl	$3, %ecx
 
 #ifdef PIC
 	call	2f
+	cfi_adjust_cfa_offset (4)
 2:	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 	/* 0xb is the distance between 2: and 1: but we avoid writing
 	   1f-2b because the assembler generates worse code.  */
 	leal	0xb(%edx,%ecx,8), %ecx
@@ -153,8 +161,14 @@ L(end2):
 #endif
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/i586/sub_n.S b/sysdeps/i386/i586/sub_n.S
index fcc9cba4ad..7c32c1adb6 100644
--- a/sysdeps/i386/i586/sub_n.S
+++ b/sysdeps/i386/i586/sub_n.S
@@ -1,6 +1,6 @@
 /* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0
    and store difference in a third limb vector.
-   Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,94,95,96,97,98,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -34,13 +34,20 @@ ENTRY (BP_SYM (__mpn_sub_n))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 12)
 	movl	S1(%esp),%esi
+	cfi_rel_offset (esi, 8)
 	movl	S2(%esp),%ebx
+	cfi_rel_offset (ebx, 0)
 	movl	SIZE(%esp),%ecx
 #if __BOUNDED_POINTERS__
 	shll	$2, %ecx	/* convert limbs to bytes */
@@ -50,6 +57,7 @@ ENTRY (BP_SYM (__mpn_sub_n))
 	shrl	$2, %ecx
 #endif
 	movl	(%ebx),%ebp
+	cfi_rel_offset (ebp, 4)
 
 	decl	%ecx
 	movl	%ecx,%edx
@@ -58,6 +66,7 @@ ENTRY (BP_SYM (__mpn_sub_n))
 	testl	%ecx,%ecx		/* zero carry flag */
 	jz	L(end)
 	pushl	%edx
+	cfi_adjust_cfa_offset (4)
 
 	ALIGN (3)
 L(oop):	movl	28(%edi),%eax		/* fetch destination cache line */
@@ -105,6 +114,7 @@ L(4):	movl	24(%esi),%eax
 	jnz	L(oop)
 
 	popl	%edx
+	cfi_adjust_cfa_offset (-4)
 L(end):
 	decl	%edx			/* test %edx w/o clobbering carry */
 	js	L(end2)
@@ -128,9 +138,17 @@ L(end2):
 	negl	%eax
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i586/submul_1.S b/sysdeps/i386/i586/submul_1.S
index 542200110f..e8bc6478c1 100644
--- a/sysdeps/i386/i586/submul_1.S
+++ b/sysdeps/i386/i586/submul_1.S
@@ -1,6 +1,6 @@
 /* Pentium __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
    the result from a second limb vector.
-   Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc.
+   Copyright (C) 1992, 94, 96, 97, 98, 00, 2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -38,15 +38,22 @@
 ENTRY (BP_SYM (__mpn_submul_1))
 	ENTER
 
-	pushl	%edi
-	pushl	%esi
+	pushl	%res_ptr
+	cfi_adjust_cfa_offset (4)
+	pushl	%s1_ptr
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
-	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%s2_limb
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp), %res_ptr
+	cfi_rel_offset (res_ptr, 12)
 	movl	S1(%esp), %s1_ptr
+	cfi_rel_offset (s1_ptr, 8)
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
+	cfi_rel_offset (s2_limb, 0)
 #if __BOUNDED_POINTERS__
 	shll	$2, %sizeP	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
@@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_submul_1))
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
 	xorl	%ebp, %ebp
+	cfi_rel_offset (ebp, 4)
 	ALIGN (3)
 
 L(oop):	adcl	$0, %ebp
@@ -78,10 +86,18 @@ L(oop):	adcl	$0, %ebp
 
 	adcl	$0, %ebp
 	movl	%ebp, %eax
-	popl	%ebx
+	popl	%s2_limb
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s2_limb)
 	popl	%ebp
-	popl	%esi
-	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%s1_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s1_ptr)
+	popl	%res_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (res_ptr)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i686/Dist b/sysdeps/i386/i686/Dist
deleted file mode 100644
index dbf11d5009..0000000000
--- a/sysdeps/i386/i686/Dist
+++ /dev/null
@@ -1 +0,0 @@
-hp-timing.c
diff --git a/sysdeps/i386/i686/add_n.S b/sysdeps/i386/i686/add_n.S
index e36b0d0a5d..3cce33acfe 100644
--- a/sysdeps/i386/i686/add_n.S
+++ b/sysdeps/i386/i686/add_n.S
@@ -1,6 +1,6 @@
 /* Add two limb vectors of the same length > 0 and store sum in a third
    limb vector.
-   Copyright (C) 1992, 94, 95, 97, 98, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,94,95,97,98,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -38,10 +38,14 @@ ENTRY (BP_SYM (__mpn_add_n))
 	ENTER
 
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 4)
 	movl	S1(%esp),%esi
+	cfi_rel_offset (esi, 0)
 	movl	S2(%esp),%edx
 	movl	SIZE(%esp),%ecx
 #if __BOUNDED_POINTERS__
@@ -107,7 +111,11 @@ L(oop):	movl	(%esi),%eax
 	negl	%eax
 
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/i686/dl-hash.h b/sysdeps/i386/i686/dl-hash.h
index 61183d80da..4bdd998aa8 100644
--- a/sysdeps/i386/i686/dl-hash.h
+++ b/sysdeps/i386/i686/dl-hash.h
@@ -1,5 +1,5 @@
 /* Compute hash alue for given string according to ELF standard.
-   Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -27,7 +27,7 @@
    would be much slower than the generic C implementation.  So don't
    use it.  */
 static unsigned int
-_dl_elf_hash (const unsigned char *name)
+_dl_elf_hash (const char *name)
 {
   unsigned int result;
   unsigned int temp0;
@@ -71,7 +71,7 @@ _dl_elf_hash (const unsigned char *name)
      "jnz 2b\n"
      "1:\t"
      : "=&r" (result), "=r" (name), "=&c" (temp0), "=&r" (temp1)
-     : "0" (0), "1" (name));
+     : "0" (0), "1" ((const unsigned char *) name));
 
   return result;
 }
diff --git a/sysdeps/i386/i686/ffs.c b/sysdeps/i386/i686/ffs.c
index fd7ef1a3d6..684ae21827 100644
--- a/sysdeps/i386/i686/ffs.c
+++ b/sysdeps/i386/i686/ffs.c
@@ -1,7 +1,7 @@
 /* ffs -- find first set bit in a word, counted from least significant end.
    For Intel 80x86, x>=6.
    This file is part of the GNU C Library.
-   Copyright (C) 1991, 92, 93, 94, 97, 98, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 94, 97, 98, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,5 +45,5 @@ libc_hidden_builtin_def (ffs)
 weak_alias (__ffs, ffsl)
 
 #else
-#include <sysdeps/generic/ffs.c>
+#include <string/ffs.c>
 #endif
diff --git a/sysdeps/i386/i686/hp-timing.h b/sysdeps/i386/i686/hp-timing.h
index a5906835f7..b924869649 100644
--- a/sysdeps/i386/i686/hp-timing.h
+++ b/sysdeps/i386/i686/hp-timing.h
@@ -1,5 +1,5 @@
 /* High precision, low overhead timing functions.  i686 version.
-   Copyright (C) 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -119,26 +119,24 @@ typedef unsigned long long int hp_timing_t;
 /* We have to jump through hoops to get this correctly implemented.  */
 #define HP_TIMING_ACCUM(Sum, Diff) \
   do {									      \
-    char __not_done;							      \
+    int __not_done;							      \
     hp_timing_t __oldval = (Sum);					      \
     hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead);		      \
     do									      \
       {									      \
 	hp_timing_t __newval = __oldval + __diff;			      \
 	int __temp0, __temp1;						      \
-	__asm__ __volatile__ ("xchgl %4, %%ebx\n\t"			      \
+	__asm__ __volatile__ ("xchgl %0, %%ebx\n\t"			      \
 			      "lock; cmpxchg8b %1\n\t"			      \
-			      "sete %0\n\t"				      \
-			      "movl %4, %%ebx"				      \
-			      : "=q" (__not_done), "=m" (Sum),		      \
-				"=A" (__oldval), "=c" (__temp0),	      \
-				"=SD" (__temp1)				      \
-			      : "1" (Sum), "2" (__oldval),		      \
-				"3" (__newval >> 32),			      \
-				"4" (__newval & 0xffffffff)		      \
-			      : "memory");				      \
+			      "sete %%bl\n\t"				      \
+			      "xchgl %0, %%ebx"				      \
+			      : "=SD" (__not_done), "=m" (Sum),		      \
+				"=A" (__oldval), "=c" (__temp0)		      \
+			      : "m" (Sum), "2" (__oldval),		      \
+				"3" ((unsigned int) (__newval >> 32)),	      \
+				"0" ((unsigned int) __newval));		      \
       }									      \
-    while (__not_done);							      \
+    while ((unsigned char) __not_done);					      \
   } while (0)
 
 /* No threads, no extra work.  */
diff --git a/sysdeps/i386/i686/memcmp.S b/sysdeps/i386/i686/memcmp.S
index ef57acdee8..4bd5394bec 100644
--- a/sysdeps/i386/i686/memcmp.S
+++ b/sysdeps/i386/i686/memcmp.S
@@ -1,5 +1,5 @@
 /* Compare two memory blocks for differences in the first COUNT bytes.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
@@ -26,8 +26,11 @@
 #define BLK1		PARMS
 #define BLK2		BLK1+PTR_SIZE
 #define LEN		BLK2+PTR_SIZE
-#define ENTRANCE	pushl %ebx; ENTER
-#define RETURN		popl %ebx; LEAVE; ret
+#define ENTRANCE	pushl %ebx; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (ebx, 0); ENTER
+#define RETURN		popl %ebx; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (ebx); LEAVE; ret; \
+			cfi_adjust_cfa_offset (4); cfi_rel_offset (ebx, 0);
 
 /* Load an entry in a jump table into EBX.  TABLE is a jump table
    with relative offsets.  INDEX is a register contains the index
@@ -77,11 +80,15 @@ L(neq):
 	sbbl	$-1, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
 L(not_1):
 	jl	L(bye)			/* LEN == 0  */
 
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	movl	%eax, %esi
+	cfi_rel_offset (esi, 0)
 	cmpl	$32, %ecx;
 	jge	L(32bytesormore)	/* LEN => 32  */
 
@@ -128,9 +135,14 @@ L(4bytes):
 	jne	L(find_diff)
 L(0bytes):
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 L(29bytes):
 	movl	-29(%esi), %eax
 	movl	-29(%edx), %ecx
@@ -171,9 +183,14 @@ L(1bytes):
 	cmpb	-1(%edx), %al
 	jne	L(set)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 L(30bytes):
 	movl	-30(%esi), %eax
 	movl	-30(%edx), %ecx
@@ -217,9 +234,14 @@ L(2bytes):
 	cmpl	%ecx, %eax
 	jne	L(set)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 L(31bytes):
 	movl	-31(%esi), %eax
 	movl	-31(%edx), %ecx
@@ -266,9 +288,14 @@ L(3bytes):
 	cmpb	-1(%edx), %al
 	jne	L(set)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	xorl	%eax, %eax
 	RETURN
 
+	cfi_adjust_cfa_offset (8)
+	cfi_rel_offset (esi, 0)
+	cfi_rel_offset (ebx, 4)
 	ALIGN (4)
 /* ECX >= 32.  */
 L(32bytesormore):
@@ -349,7 +376,10 @@ L(set):
 	sbbl	%eax, %eax
 	sbbl	$-1, %eax
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	RETURN
+END (BP_SYM (memcmp))
 
 	.section	.rodata
 	ALIGN (2)
@@ -387,7 +417,6 @@ L(table_32bytes) :
 	.long	L(30bytes) - . + 0x78
 	.long	L(31bytes) - . + 0x7c
 
-END (BP_SYM (memcmp))
 
 #undef bcmp
 weak_alias (BP_SYM (memcmp), BP_SYM (bcmp))
diff --git a/sysdeps/i386/i686/memcpy_chk.S b/sysdeps/i386/i686/memcpy_chk.S
index 561263f9bf..2893911cd2 100644
--- a/sysdeps/i386/i686/memcpy_chk.S
+++ b/sysdeps/i386/i686/memcpy_chk.S
@@ -1,4 +1,4 @@
-/* Checking memcpy for x86-64.
+/* Checking memcpy for i686.
    Copyright (C) 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
index 951e139ad4..b93b5c729f 100644
--- a/sysdeps/i386/i686/memmove.S
+++ b/sysdeps/i386/i686/memmove.S
@@ -1,7 +1,7 @@
 /* Copy memory block and return pointer to beginning of destination block
    For Intel 80x86, x>=6.
    This file is part of the GNU C Library.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 2003.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -42,11 +42,14 @@ ENTRY (BP_SYM (memmove))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	movl	LEN(%esp), %ecx
 	movl	DEST(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl	%esi, %edx
 	movl	SRC(%esp), %esi
+	cfi_register (esi, edx)
 	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx)
 	CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx)
 
@@ -65,14 +68,21 @@ ENTRY (BP_SYM (memmove))
 2:	rep
 	movsl
 	movl	%edx, %esi
+	cfi_restore (esi)
 	movl	DEST(%esp), %eax
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
 
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
+	cfi_register (esi, edx)
+
 	/* Backward copying.  */
 3:	std
 	leal	-1(%edi, %ecx), %edi
@@ -90,11 +100,14 @@ ENTRY (BP_SYM (memmove))
 	rep
 	movsl
 	movl	%edx, %esi
+	cfi_restore (esi)
 	movl	DEST(%esp), %eax
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 
 	cld
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/i686/mempcpy.S b/sysdeps/i386/i686/mempcpy.S
index 843a35823a..6437e4a5d4 100644
--- a/sysdeps/i386/i686/mempcpy.S
+++ b/sysdeps/i386/i686/mempcpy.S
@@ -1,7 +1,7 @@
 /* Copy memory block and return pointer to following byte.
    For Intel 80x86, x>=6.
    This file is part of the GNU C Library.
-   Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998,1999,2000,2002,2004,2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,9 +43,11 @@ ENTRY (BP_SYM (__mempcpy))
 
 	movl	LEN(%esp), %ecx
 	movl	%edi, %eax
+	cfi_register (edi, eax)
 	movl	DEST(%esp), %edi
 	CHECK_BOUNDS_BOTH_WIDE (%edi, DEST(%esp), %ecx)
 	movl	%esi, %edx
+	cfi_register (esi, edx)
 	movl	SRC(%esp), %esi
 	CHECK_BOUNDS_BOTH_WIDE (%esi, SRC(%esp), %ecx)
 	cld
@@ -58,7 +60,9 @@ ENTRY (BP_SYM (__mempcpy))
 2:	rep
 	movsl
 	xchgl	%edi, %eax
+	cfi_restore (edi)
 	movl	%edx, %esi
+	cfi_restore (esi)
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 
 	LEAVE
diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S
index 561188ffec..dfa1aa7019 100644
--- a/sysdeps/i386/i686/memset.S
+++ b/sysdeps/i386/i686/memset.S
@@ -1,6 +1,6 @@
 /* memset/bzero -- set memory area to CH/0
    Highly optimized version for ix86, x>=6.
-   Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999,2000,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -51,6 +51,7 @@ ENTRY (BP_SYM (memset))
 
 	cld
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	movl	DEST(%esp), %edx
 	movl	LEN(%esp), %ecx
 	CHECK_BOUNDS_BOTH_WIDE (%edx, DEST(%esp), %ecx)
@@ -61,18 +62,19 @@ ENTRY (BP_SYM (memset))
 #endif
 	jecxz	1f
 	movl	%edx, %edi
+	cfi_rel_offset (edi, 0)
 	andl	$3, %edx
-	jz	2f
-	jnp	3f
-	stosb
+	jz	2f	/* aligned */
+	jp	3f	/* misaligned at 3, store just one byte below */
+	stosb		/* misaligned at 1 or 2, store two bytes */
 	decl	%ecx
 	jz	1f
 3:	stosb
 	decl	%ecx
 	jz	1f
-	xorl	$3, %edx
-	jz	2f
-	stosb
+	xorl	$1, %edx
+	jnz	2f	/* was misaligned at 2 or 3, now aligned */
+	stosb		/* was misaligned at 1, store third byte */
 	decl	%ecx
 2:	movl	%ecx, %edx
 	shrl	$2, %ecx
@@ -92,6 +94,8 @@ ENTRY (BP_SYM (memset))
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 #endif
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 #if BZERO_P
@@ -101,3 +105,9 @@ ENTRY (BP_SYM (memset))
 #endif
 END (BP_SYM (memset))
 libc_hidden_builtin_def (memset)
+
+#if defined PIC && !defined NOT_IN_libc && !BZERO_P
+strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
+	.section .gnu.warning.__memset_zero_constant_len_parameter
+	.string "memset used with constant zero length parameter; this could be due to transposed parameters"
+#endif
diff --git a/sysdeps/i386/i686/memset_chk.S b/sysdeps/i386/i686/memset_chk.S
index d178654994..cd93d5ee10 100644
--- a/sysdeps/i386/i686/memset_chk.S
+++ b/sysdeps/i386/i686/memset_chk.S
@@ -1,5 +1,5 @@
-/* Checking memset for x86-64.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+/* Checking memset for i686.
+   Copyright (C) 2004, 2005 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
diff --git a/sysdeps/i386/i686/memusage.h b/sysdeps/i386/i686/memusage.h
new file mode 100644
index 0000000000..235c3fc725
--- /dev/null
+++ b/sysdeps/i386/i686/memusage.h
@@ -0,0 +1,22 @@
+/* Copyright (C) 2000, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; })
+#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high))
+
+#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/i386/i686/strtok.S b/sysdeps/i386/i686/strtok.S
index 3d81fb6d42..fe225e5485 100644
--- a/sysdeps/i386/i686/strtok.S
+++ b/sysdeps/i386/i686/strtok.S
@@ -1,6 +1,6 @@
 /* strtok (str, delim) -- Return next DELIM separated token from STR.
    For Intel 80686.
-   Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -86,6 +86,8 @@ ENTRY (BP_SYM (FUNCTION))
 
 #if !defined USE_AS_STRTOK_R && defined PIC
 	pushl %ebx			/* Save PIC register.  */
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
 	call 0b
 	addl $_GLOBAL_OFFSET_TABLE_, %ebx
 #endif
@@ -97,6 +99,7 @@ ENTRY (BP_SYM (FUNCTION))
 	   table.  */
 	movl %edi, %edx
 	subl $256, %esp
+	cfi_adjust_cfa_offset (256)
 	movl $64, %ecx
 	movl %esp, %edi
 	xorl %eax, %eax
@@ -247,9 +250,9 @@ L(8):	cmpl %eax, %edx
 	cmovne %ecx, %edx
 
 	/* Store the pointer to the next character.  */
-# ifdef USE_AS_STRTOK_R
+#ifdef USE_AS_STRTOK_R
 	movl SAVE(%esp), %ecx
-# endif
+#endif
 	movl %edx, SAVE_PTR
 	CHECK_BOUNDS_HIGH (%edx, SAVE_PTR, jb)
 	RETURN_BOUNDED_POINTER (SAVE_PTR)
@@ -257,14 +260,21 @@ L(8):	cmpl %eax, %edx
 L(epilogue):
 	/* Remove the stopset table.  */
 	addl $256, %esp
+	cfi_adjust_cfa_offset (-256)
 #if !defined USE_AS_STRTOK_R && defined PIC
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 #endif
 	LEAVE
 	RET_PTR
 
 L(returnNULL):
 	xorl %eax, %eax
+#ifdef USE_AS_STRTOK_R
+	movl SAVE(%esp), %ecx
+#endif
+	movl %edx, SAVE_PTR
 	RETURN_NULL_BOUNDED_POINTER
 	jmp L(epilogue)
 
diff --git a/sysdeps/i386/jmpbuf-offsets.h b/sysdeps/i386/jmpbuf-offsets.h
new file mode 100644
index 0000000000..c53d539edd
--- /dev/null
+++ b/sysdeps/i386/jmpbuf-offsets.h
@@ -0,0 +1,26 @@
+/* Private macros for accessing __jmp_buf contents.  i386 version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define JB_BX	0
+#define JB_SI	1
+#define JB_DI	2
+#define JB_BP	3
+#define JB_SP	4
+#define JB_PC	5
+#define JB_SIZE 24
diff --git a/sysdeps/i386/jmpbuf-unwind.h b/sysdeps/i386/jmpbuf-unwind.h
new file mode 100644
index 0000000000..360493fb35
--- /dev/null
+++ b/sysdeps/i386/jmpbuf-unwind.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_SP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/i386/ldbl2mpn.c b/sysdeps/i386/ldbl2mpn.c
index bf4e4ff43f..01be777270 100644
--- a/sysdeps/i386/ldbl2mpn.c
+++ b/sysdeps/i386/ldbl2mpn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2000, 2007 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
@@ -19,7 +19,7 @@
 #include "gmp.h"
 #include "gmp-impl.h"
 #include "longlong.h"
-#include "ieee754.h"
+#include <ieee754.h>
 #include <float.h>
 #include <stdlib.h>
 
@@ -46,7 +46,7 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
 #elif BITS_PER_MP_LIMB == 64
   /* Hopefully the compiler will combine the two bitfield extracts
      and this composition into just the original quadword extract.  */
-  res_ptr[0] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
+  res_ptr[0] = ((mp_limb_t) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
   #define N 1
 #else
   #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
@@ -109,6 +109,13 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
 	    }
 	}
     }
+  else if (u.ieee.exponent < 0x7fff
+#if N == 2
+	   && res_ptr[0] == 0
+#endif
+	   && res_ptr[N - 1] == 0)
+    /* Pseudo zero.  */
+    *expt = 0;
 
   return N;
 }
diff --git a/sysdeps/i386/lshift.S b/sysdeps/i386/lshift.S
index ab1c89d23b..536d9878eb 100644
--- a/sysdeps/i386/lshift.S
+++ b/sysdeps/i386/lshift.S
@@ -1,5 +1,5 @@
 /* i80386 __mpn_lshift --
-   Copyright (C) 1992, 1994, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1994, 1997-2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -33,11 +33,16 @@ ENTRY (BP_SYM (__mpn_lshift))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 8)
 	movl	S(%esp),%esi
+	cfi_rel_offset (esi, 4)
 	movl	SIZE(%esp),%edx
 	movl	CNT(%esp),%ecx
 #if __BOUNDED_POINTERS__
@@ -49,11 +54,13 @@ ENTRY (BP_SYM (__mpn_lshift))
 	subl	$4,%esi			/* adjust s_ptr */
 
 	movl	(%esi,%edx,4),%ebx	/* read most significant limb */
+	cfi_rel_offset (ebx, 0)
 	xorl	%eax,%eax
 	shldl	%cl,%ebx,%eax		/* compute carry limb */
 	decl	%edx
 	jz	L(end)
 	pushl	%eax			/* push carry limb onto stack */
+	cfi_adjust_cfa_offset (4)
 	testb	$1,%dl
 	jnz	L(1)			/* enter loop in the middle */
 	movl	%ebx,%eax
@@ -73,10 +80,17 @@ L(1):	movl	(%esi,%edx,4),%eax
 	movl	%eax,(%edi)		/* store it */
 
 	popl	%eax			/* pop carry limb */
+	cfi_adjust_cfa_offset (-4)
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
@@ -85,8 +99,14 @@ L(end):	shll	%cl,%ebx		/* compute least significant limb */
 	movl	%ebx,(%edi)		/* store it */
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/memchr.S b/sysdeps/i386/memchr.S
index 3cfb3d666f..08989397bd 100644
--- a/sysdeps/i386/memchr.S
+++ b/sysdeps/i386/memchr.S
@@ -1,7 +1,6 @@
-/* memchr (str, chr, len) -- Return pointer to first occurrence of CHR in STR less
-   than LEN.
-   For Intel 80x86, x>=3.
-   Copyright (C) 1994-1998, 2000, 2003 Free Software Foundation, Inc.
+/* memchr (str, chr, len) -- Return pointer to first occurrence of CHR in STR
+	 less than LEN.  For Intel 80x86, x>=3.
+   Copyright (C) 1994-1998, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -45,12 +44,16 @@ ENTRY (BP_SYM (__memchr))
 
 	/* Save callee-safe registers used in this function.  */
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
 
 	/* Load parameters into registers.  */
 	movl STR(%esp), %eax	/* str: pointer to memory block.  */
 	movl CHR(%esp), %edx	/* c: byte we are looking for.  */
 	movl LEN(%esp), %esi	/* len: length of memory block.  */
+	cfi_rel_offset (esi, 4)
 	CHECK_BOUNDS_LOW (%eax, STR(%esp))
 
 	/* If my must not test more than three characters test
@@ -320,7 +323,11 @@ L(9):
 	RETURN_BOUNDED_POINTER (STR(%esp))
 #endif
 L(pop):	popl %edi		/* pop saved registers */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/memcmp.S b/sysdeps/i386/memcmp.S
index a795911094..60b75126bd 100644
--- a/sysdeps/i386/memcmp.S
+++ b/sysdeps/i386/memcmp.S
@@ -1,5 +1,5 @@
 /* Compare two memory blocks for differences in the first COUNT bytes.
-   Copyright (C) 1995, 1996, 1997, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995,1996,1997,2000,2004,2005 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
@@ -32,10 +32,13 @@ ENTRY (BP_SYM (memcmp))
 	ENTER
 
 	pushl %esi		/* Save callee-safe registers.  */
+	cfi_adjust_cfa_offset (4)
 	movl %edi, %edx		/* Note that %edx is not used and can
 				   so be used to save %edi.  It's faster.  */
+	cfi_register (edi, edx)
 
 	movl BLK1(%esp), %esi
+	cfi_rel_offset (esi, 0)
 	movl BLK2(%esp), %edi
 	movl LEN(%esp), %ecx
 	CHECK_BOUNDS_LOW (%esi, BLK1(%esp))
@@ -65,7 +68,10 @@ ENTRY (BP_SYM (memcmp))
 L(1):	CHECK_BOUNDS_HIGH (%esi, BLK1(%esp), jbe)
 	CHECK_BOUNDS_HIGH (%edi, BLK2(%esp), jbe)
 	popl %esi		/* Restore registers.  */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	movl %edx, %edi
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/memset.c b/sysdeps/i386/memset.c
index 6a7fff8747..120df94d63 100644
--- a/sysdeps/i386/memset.c
+++ b/sysdeps/i386/memset.c
@@ -1,6 +1,6 @@
 /* Set a block of memory to some byte value.
    For Intel 80x86, x>=3.
-   Copyright (C) 1991,1992,1993,1997,1998,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,1992,1993,1997,1998,2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Torbjorn Granlund (tege@sics.se).
 
@@ -82,5 +82,5 @@ memset (void *dstpp, int c, size_t len)
 libc_hidden_builtin_def (memset)
 
 #else
-#include <sysdeps/generic/memset.c>
+#include <string/memset.c>
 #endif
diff --git a/sysdeps/i386/memusage.h b/sysdeps/i386/memusage.h
index 73ce98c630..8d5749f655 100644
--- a/sysdeps/i386/memusage.h
+++ b/sysdeps/i386/memusage.h
@@ -17,6 +17,5 @@
    02111-1307 USA.  */
 
 #define GETSP() ({ register uintptr_t stack_ptr asm ("esp"); stack_ptr; })
-#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high))
 
 #include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/i386/mul_1.S b/sysdeps/i386/mul_1.S
index e9be6fb618..0d0c07e7cf 100644
--- a/sysdeps/i386/mul_1.S
+++ b/sysdeps/i386/mul_1.S
@@ -1,6 +1,6 @@
 /* i80386 __mpn_mul_1 -- Multiply a limb vector with a limb and store
    the result in a second limb vector.
-   Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,1994,1997,1998,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -38,15 +38,22 @@
 ENTRY (BP_SYM (__mpn_mul_1))
 	ENTER
 
-	pushl	%edi
-	pushl	%esi
+	pushl	%res_ptr
+	cfi_adjust_cfa_offset (4)
+	pushl	%s1_ptr
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
-	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%s2_limb
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp), %res_ptr
+	cfi_rel_offset (res_ptr, 12)
 	movl	S1(%esp), %s1_ptr
+	cfi_rel_offset (s1_ptr, 8)
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
+	cfi_rel_offset (s2_limb, 0)
 #if __BOUNDED_POINTERS__
 	shll	$2, %size	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
@@ -57,6 +64,7 @@ ENTRY (BP_SYM (__mpn_mul_1))
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
 	xorl	%ebp, %ebp
+	cfi_rel_offset (ebp, 4)
 	ALIGN (3)
 L(oop):
 	movl	(%s1_ptr,%size,4), %eax
@@ -70,10 +78,18 @@ L(oop):
 	jnz	L(oop)
 	movl	%ebp, %eax
 
-	popl	%ebx
+	popl	%s2_limb
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s2_limb)
 	popl	%ebp
-	popl	%esi
-	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%s1_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (s1_ptr)
+	popl	%res_ptr
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (res_ptr)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/rawmemchr.S b/sysdeps/i386/rawmemchr.S
index 75c08ead39..ddb9d52162 100644
--- a/sysdeps/i386/rawmemchr.S
+++ b/sysdeps/i386/rawmemchr.S
@@ -1,6 +1,6 @@
 /* rawmemchr (str, ch) -- Return pointer to first occurrence of CH in STR.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994,95,96,97,98,99,2000,2002 Free Software Foundation, Inc.
+   Copyright (C) 1994-2000,2002,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -43,6 +43,8 @@ ENTRY (BP_SYM (__rawmemchr))
 
 	/* Save callee-safe register used in this function.  */
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
 
 	/* Load parameters into registers.  */
 	movl STR(%esp), %eax
@@ -217,6 +219,8 @@ L(9):
 	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	RETURN_BOUNDED_POINTER (STR(%esp))
 	popl %edi		/* pop saved register */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/rshift.S b/sysdeps/i386/rshift.S
index 51973fe998..3fd0afe822 100644
--- a/sysdeps/i386/rshift.S
+++ b/sysdeps/i386/rshift.S
@@ -1,5 +1,5 @@
 /* i80386 __mpn_rshift --
-   Copyright (C) 1992, 1994, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,1994,1997-2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -33,11 +33,16 @@ ENTRY (BP_SYM (__mpn_rshift))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 8)
 	movl	S(%esp),%esi
+	cfi_rel_offset (esi, 4)
 	movl	SIZE(%esp),%edx
 	movl	CNT(%esp),%ecx
 #if __BOUNDED_POINTERS__
@@ -51,11 +56,13 @@ ENTRY (BP_SYM (__mpn_rshift))
 	negl	%edx
 
 	movl	(%esi,%edx,4),%ebx	/* read least significant limb */
+	cfi_rel_offset (ebx, 0)
 	xorl	%eax,%eax
 	shrdl	%cl,%ebx,%eax		/* compute carry limb */
 	incl	%edx
 	jz	L(end)
 	pushl	%eax			/* push carry limb onto stack */
+	cfi_adjust_cfa_offset (4)
 	testb	$1,%dl
 	jnz	L(1)			/* enter loop in the middle */
 	movl	%ebx,%eax
@@ -75,20 +82,37 @@ L(1):	movl	(%esi,%edx,4),%eax
 	movl	%eax,(%edi)		/* store it */
 
 	popl	%eax			/* pop carry limb */
+	cfi_adjust_cfa_offset (-4)
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
 
+	cfi_adjust_cfa_offset (12)
+	cfi_rel_offset (edi, 8)
+	cfi_rel_offset (esi, 4)
+	cfi_rel_offset (ebx, 0)
 L(end):	shrl	%cl,%ebx		/* compute most significant limb */
 	movl	%ebx,(%edi)		/* store it */
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index e01d32b66c..56c3994f66 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -1,5 +1,6 @@
 /* setjmp for i386.
-   Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1995,1996,1997,2000,2001,2005,2006
+	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
@@ -18,9 +19,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
 #include "bp-sym.h"
 #include "bp-asm.h"
@@ -40,12 +39,24 @@ ENTRY (BP_SYM (__sigsetjmp))
 	movl %esi, (JB_SI*4)(%eax)
 	movl %edi, (JB_DI*4)(%eax)
 	leal JMPBUF(%esp), %ecx	/* Save SP as it will be after we return.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_SP*4)(%eax)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%ecx)
+#endif
      	movl %ecx, (JB_PC*4)(%eax)
 	LEAVE /* pop frame pointer to prepare for tail-call.  */
 	movl %ebp, (JB_BP*4)(%eax) /* Save caller's frame pointer.  */
 
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	xorl %eax, %eax
+	ret
+#else
 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
-	jmp BP_SYM (__sigjmp_save)
+	jmp __sigjmp_save
+#endif
 END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/i386/soft-fp/Dist b/sysdeps/i386/soft-fp/Dist
deleted file mode 100644
index 7e9914fe58..0000000000
--- a/sysdeps/i386/soft-fp/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sfp-machine.h
diff --git a/sysdeps/i386/stpncpy.S b/sysdeps/i386/stpncpy.S
index acde5e3d66..c163a33591 100644
--- a/sysdeps/i386/stpncpy.S
+++ b/sysdeps/i386/stpncpy.S
@@ -1,7 +1,7 @@
 /* copy no more then N bytes from SRC to DEST, returning the address of
    the terminating '\0' in DEST.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994,1995,1996,1997,2000,2002 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997,2000,2002,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Some bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -40,9 +40,11 @@ ENTRY (BP_SYM (__stpncpy))
 	ENTER
 
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 
 	movl DEST(%esp), %eax
 	movl SRC(%esp), %esi
+	cfi_rel_offset (esi, 0)
 	movl LEN(%esp), %ecx
 	CHECK_BOUNDS_LOW (%eax, DEST(%esp))
 	CHECK_BOUNDS_LOW (%esi, SRC(%esp))
@@ -148,6 +150,8 @@ L(9):
 	RETURN_BOUNDED_POINTER (DEST(%esp))
 #endif
 	popl %esi		/* restore saved register content */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/strchr.S b/sysdeps/i386/strchr.S
index f5cee2f872..93b4cce8da 100644
--- a/sysdeps/i386/strchr.S
+++ b/sysdeps/i386/strchr.S
@@ -1,6 +1,7 @@
 /* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994-1997,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997,1999,2000,2002,2003,2005
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -35,6 +36,8 @@ ENTRY (BP_SYM (strchr))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers used here.  */
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
 	movl STR(%esp), %eax
 	movl CHR(%esp), %edx
 	CHECK_BOUNDS_LOW (%eax, STR(%esp))
@@ -244,10 +247,14 @@ L(2):	/* Return NULL.  */
 	xorl %eax, %eax
 	RETURN_NULL_BOUNDED_POINTER
 	popl %edi		/* restore saved register content */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
 
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
 L(73):	addl $4, %eax		/* adjust pointer */
 L(72):	addl $4, %eax
 L(71):	addl $4, %eax
@@ -283,6 +290,8 @@ L(6):
 	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	RETURN_BOUNDED_POINTER (STR(%esp))
 	popl %edi		/* restore saved register content */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/strchrnul.S b/sysdeps/i386/strchrnul.S
index 9a521eb65a..8d1f7b2a5e 100644
--- a/sysdeps/i386/strchrnul.S
+++ b/sysdeps/i386/strchrnul.S
@@ -1,7 +1,7 @@
 /* strchrnul (str, chr) -- Return pointer to first occurrence of CHR in STR
    or the final NUL byte.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997, 1999, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>
    Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -36,6 +36,8 @@ ENTRY (BP_SYM (__strchrnul))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers used here.  */
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
 
 	movl STR(%esp), %eax
 	movl CHR(%esp), %edx
@@ -274,6 +276,8 @@ L(7):	testb %cl, %cl		/* is first byte CHR? */
 L(6):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	RETURN_BOUNDED_POINTER (STR(%esp))
 	popl %edi		/* restore saved register content */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/strcspn.S b/sysdeps/i386/strcspn.S
index dc3a176bf1..df6a136606 100644
--- a/sysdeps/i386/strcspn.S
+++ b/sysdeps/i386/strcspn.S
@@ -1,7 +1,7 @@
 /* strcspn (str, ss) -- Return the length of the initial segment of STR
 			which contains no characters from SS.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994,1995,1996,1997,2000,2003 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997,2000,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -46,69 +46,133 @@ ENTRY (BP_SYM (strcspn))
 	xorl %ecx, %ecx		/* %ecx = 0 !!! */
 
 	pushl %ecx		/* make a 256 bytes long block filled with 0 */
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* These immediate values make the label 2 */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* to be aligned on a 16 byte boundary to */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* get a better performance of the loop.  */
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 
 /* For understanding the following code remember that %ecx == 0 now.
    Although all the following instruction only modify %cl we always
@@ -172,6 +236,7 @@ L(6):	incl %eax
 L(5):	incl %eax
 
 L(4):	addl $256, %esp		/* remove stopset */
+	cfi_adjust_cfa_offset (-256)
 	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	subl %edx, %eax		/* we have to return the number of valid
 				   characters, so compute distance to first
diff --git a/sysdeps/i386/strpbrk.S b/sysdeps/i386/strpbrk.S
index 66136c209e..1f78e20646 100644
--- a/sysdeps/i386/strpbrk.S
+++ b/sysdeps/i386/strpbrk.S
@@ -1,7 +1,7 @@
 /* strcspn (str, ss) -- Return the length of the initial segement of STR
 			which contains no characters from SS.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994-1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997, 2000, 2003, 2005 Free Software Foundation, Inc.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
    This file is part of the GNU C Library.
@@ -47,69 +47,133 @@ ENTRY (BP_SYM (strpbrk))
 	xorl %ecx, %ecx		/* %ecx = 0 !!! */
 
 	pushl %ecx		/* make a 256 bytes long block filled with 0 */
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* These immediate values make the label 2 */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* to be aligned on a 16 byte boundary to */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* get a better performance of the loop.  */
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 
 /* For understanding the following code remember that %ecx == 0 now.
    Although all the following instruction only modify %cl we always
@@ -173,6 +237,7 @@ L(6):	incl %eax
 L(5):	incl %eax
 
 L(4):	addl $256, %esp		/* remove stopset */
+	cfi_adjust_cfa_offset (-256)
 
 	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	orb %cl, %cl		/* was last character NUL? */
diff --git a/sysdeps/i386/strrchr.S b/sysdeps/i386/strrchr.S
index 0fd95b54f5..98c0c08bd0 100644
--- a/sysdeps/i386/strrchr.S
+++ b/sysdeps/i386/strrchr.S
@@ -1,6 +1,6 @@
 /* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994-1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -35,10 +35,14 @@ ENTRY (BP_SYM (strrchr))
 	ENTER
 
 	pushl %edi		/* Save callee-safe registers used here.  */
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 0)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 
 	xorl %eax, %eax
 	movl STR(%esp), %esi
+	cfi_rel_offset (esi, 0)
 	movl CHR(%esp), %ecx
 	CHECK_BOUNDS_LOW (%esi, STR(%esp))
 
@@ -299,20 +303,20 @@ L(21):	addl $4, %esi
 	   returned.  */
 
 L(20):	cmpb %cl, %dl		/* is first byte == C? */
-	jne L(24)			/* no => skip */
+	jne L(24)		/* no => skip */
 	movl %esi, %eax		/* store address as result */
 L(24):	testb %dl, %dl		/* is first byte == NUL? */
 	jz L(2)			/* yes => return */
 
 	cmpb %cl, %dh		/* is second byte == C? */
-	jne L(25)			/* no => skip */
+	jne L(25)		/* no => skip */
 	leal 1(%esi), %eax	/* store address as result */
 L(25):	testb %dh, %dh		/* is second byte == NUL? */
 	jz L(2)			/* yes => return */
 
 	shrl $16,%edx		/* make upper bytes accessible */
 	cmpb %cl, %dl		/* is third byte == C */
-	jne L(26)			/* no => skip */
+	jne L(26)		/* no => skip */
 	leal 2(%esi), %eax	/* store address as result */
 L(26):	testb %dl, %dl		/* is third byte == NUL */
 	jz L(2)			/* yes => return */
@@ -324,7 +328,11 @@ L(26):	testb %dl, %dl		/* is third byte == NUL */
 L(2):	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	RETURN_BOUNDED_POINTER (STR(%esp))
 	popl %esi		/* restore saved register content */
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	RET_PTR
diff --git a/sysdeps/i386/strspn.S b/sysdeps/i386/strspn.S
index e1c109e590..c061438a0f 100644
--- a/sysdeps/i386/strspn.S
+++ b/sysdeps/i386/strspn.S
@@ -1,7 +1,7 @@
 /* strcspn (str, ss) -- Return the length of the initial segment of STR
 			which contains only characters from SS.
    For Intel 80x86, x>=3.
-   Copyright (C) 1994-1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997, 2000, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
    Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -46,69 +46,133 @@ ENTRY (BP_SYM (strspn))
 	xorl %ecx, %ecx		/* %ecx = 0 !!! */
 
 	pushl %ecx		/* make a 256 bytes long block filled with 0 */
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* These immediate values make the label 2 */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* to be aligned on a 16 byte boundary to */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* get a better performance of the loop.  */
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 
 /* For understanding the following code remember that %ecx == 0 now.
    Although all the following instruction only modify %cl we always
@@ -172,6 +236,7 @@ L(6):	incl %eax
 L(5):	incl %eax
 
 L(4):	addl $256, %esp		/* remove stopset */
+	cfi_adjust_cfa_offset (-256)
 	CHECK_BOUNDS_HIGH (%eax, STR(%esp), jb)
 	subl %edx, %eax		/* we have to return the number of valid
 				   characters, so compute distance to first
diff --git a/sysdeps/i386/strtok.S b/sysdeps/i386/strtok.S
index d2786e2ca4..c5f40a83b1 100644
--- a/sysdeps/i386/strtok.S
+++ b/sysdeps/i386/strtok.S
@@ -1,6 +1,6 @@
 /* strtok (str, delim) -- Return next DELIM separated token from STR.
    For Intel 80x86, x>=3.
-   Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1996-1998,2000,2001,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -78,9 +78,13 @@ ENTRY (BP_SYM (FUNCTION))
 
 #if !defined USE_AS_STRTOK_R && defined PIC
 	pushl %ebx			/* Save PIC register.  */
+	cfi_adjust_cfa_offset (4)
 	call L(here)
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
 L(here):
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
 	addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx
 #endif
 
@@ -125,69 +129,133 @@ L(1):
 	xorl %ecx, %ecx		/* %ecx = 0 !!! */
 
 	pushl %ecx		/* make a 256 bytes long block filled with 0 */
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl %ecx
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* These immediate values make the label 2 */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* to be aligned on a 16 byte boundary to */
+	cfi_adjust_cfa_offset (4)
 	pushl $0		/* get a better performance of the loop.  */
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 	pushl $0
+	cfi_adjust_cfa_offset (4)
 
 /* For understanding the following code remember that %ecx == 0 now.
    Although all the following instruction only modify %cl we always
@@ -284,6 +352,7 @@ L(9):	incl %edx
 
 L(8):	/* Remove the stopset table.  */
 	addl $256, %esp
+	cfi_adjust_cfa_offset (-256)
 
 	cmpl %eax, %edx
 	je L(returnNULL)	/* There was no token anymore.  */
@@ -308,12 +377,18 @@ L(11):
 L(epilogue):
 #if !defined USE_AS_STRTOK_R && defined PIC
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 #endif
 	LEAVE
 	RET_PTR
 
 L(returnNULL):
 	xorl %eax, %eax
+#ifdef USE_AS_STRTOK_R
+	movl SAVE(%esp), %ecx
+#endif
+	movl %edx, SAVE_PTR
 	RETURN_NULL_BOUNDED_POINTER
 	jmp L(epilogue)
 
diff --git a/sysdeps/i386/sub_n.S b/sysdeps/i386/sub_n.S
index b545985374..e1e62b89d3 100644
--- a/sysdeps/i386/sub_n.S
+++ b/sysdeps/i386/sub_n.S
@@ -1,6 +1,7 @@
 /* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store
    sum in a third limb vector.
-   Copyright (C) 1992, 1994, 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,1994,1995,1997,1998,2000,2005
+   Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -34,10 +35,14 @@ ENTRY (BP_SYM (__mpn_sub_n))
 	ENTER
 
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 
 	movl	RES(%esp),%edi
+	cfi_rel_offset (edi, 4)
 	movl	S1(%esp),%esi
+	cfi_rel_offset (esi, 0)
 	movl	S2(%esp),%edx
 	movl	SIZE(%esp),%ecx
 #if __BOUNDED_POINTERS__
@@ -62,10 +67,12 @@ ENTRY (BP_SYM (__mpn_sub_n))
 /* Calculate start address in loop for PIC.  Due to limitations in some
    assemblers, Loop-L0-3 cannot be put into the leal */
 	call	L(0)
+	cfi_adjust_cfa_offset (4)
 L(0):	leal	(%eax,%eax,8),%eax
 	addl	(%esp),%eax
 	addl	$(L(oop)-L(0)-3),%eax
 	addl	$4,%esp
+	cfi_adjust_cfa_offset (-4)
 #else
 /* Calculate start address in loop for non-PIC.  */
  	leal	(L(oop) - 3)(%eax,%eax,8),%eax
@@ -106,7 +113,11 @@ L(oop):	movl	(%esi),%eax
 	negl	%eax
 
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/submul_1.S b/sysdeps/i386/submul_1.S
index 8bfcde1557..7f8523d96d 100644
--- a/sysdeps/i386/submul_1.S
+++ b/sysdeps/i386/submul_1.S
@@ -1,6 +1,6 @@
 /* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
    the result from a second limb vector.
-   Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1992,1994,1997,1998,2000,2005 Free Software Foundation, Inc.
    This file is part of the GNU MP Library.
 
    The GNU MP Library is free software; you can redistribute it and/or modify
@@ -39,9 +39,17 @@ ENTRY (BP_SYM (__mpn_submul_1))
 	ENTER
 
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (edi, 12)
+	cfi_rel_offset (esi, 8)
+	cfi_rel_offset (ebp, 4)
+	cfi_rel_offset (ebx, 0)
 
 	movl	RES(%esp), %res_ptr
 	movl	S1(%esp), %s1_ptr
@@ -72,9 +80,17 @@ L(oop):
 	movl	%ebp, %eax
 
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 
 	LEAVE
 	ret
diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
index e955b43f95..2739cb00b3 100644
--- a/sysdeps/i386/sysdep.h
+++ b/sysdeps/i386/sysdep.h
@@ -1,5 +1,5 @@
 /* Assembler macros for i386.
-   Copyright (C) 1991,92,93,95,96,98,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991-93,95,96,98,2002,2003,2005 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
@@ -57,10 +57,12 @@
   .align ALIGNARG(4);							      \
   STABS_FUN(name)							      \
   C_LABEL(name)								      \
+  cfi_startproc;							      \
   CALL_MCOUNT
 
 #undef	END
 #define END(name)							      \
+  cfi_endproc;								      \
   ASM_SIZE_DIRECTIVE(name)						      \
   STABS_FUN_END(name)
 
@@ -92,7 +94,9 @@
 /* The mcount code relies on a normal frame pointer being on the stack
    to locate our caller, so push one just for its benefit.  */
 #define CALL_MCOUNT \
-  pushl %ebp; movl %esp, %ebp; call JUMPTARGET(mcount); popl %ebp;
+  pushl %ebp; cfi_adjust_cfa_offset (4); movl %esp, %ebp; \
+  cfi_def_cfa_register (ebp); call JUMPTARGET(mcount); \
+  popl %ebp; cfi_def_cfa (esp, 4);
 #else
 #define CALL_MCOUNT		/* Do nothing.  */
 #endif
@@ -122,9 +126,38 @@ lose: SYSCALL_PIC_SETUP							      \
 #define JUMPTARGET(name)	name##@PLT
 #define SYSCALL_PIC_SETUP \
     pushl %ebx;								      \
+    cfi_adjust_cfa_offset (4);						      \
     call 0f;								      \
 0:  popl %ebx;								      \
+    cfi_adjust_cfa_offset (-4);						      \
     addl $_GLOBAL_OFFSET_TABLE+[.-0b], %ebx;
+
+# ifndef HAVE_HIDDEN
+#  define SETUP_PIC_REG(reg) \
+  call 1f;								      \
+  .subsection 1;							      \
+1:movl (%esp), %e##reg;							      \
+  ret;									      \
+  .previous
+# else
+#  define SETUP_PIC_REG(reg) \
+  .ifndef __i686.get_pc_thunk.reg;					      \
+  .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits;	      \
+  .globl __i686.get_pc_thunk.reg;					      \
+  .hidden __i686.get_pc_thunk.reg;					      \
+  .type __i686.get_pc_thunk.reg,@function;				      \
+__i686.get_pc_thunk.reg:						      \
+  movl (%esp), %e##reg;							      \
+  ret;									      \
+  .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg;		      \
+  .previous;								      \
+  .endif;								      \
+  call __i686.get_pc_thunk.reg
+# endif
+
+# define LOAD_PIC_REG(reg) \
+  SETUP_PIC_REG(reg); addl $_GLOBAL_OFFSET_TABLE_, %e##reg
+
 #else
 #define JUMPTARGET(name)	name
 #define SYSCALL_PIC_SETUP	/* Nothing.  */
diff --git a/sysdeps/ia64/Dist b/sysdeps/ia64/Dist
deleted file mode 100644
index 09ee86c206..0000000000
--- a/sysdeps/ia64/Dist
+++ /dev/null
@@ -1,9 +0,0 @@
-_mcount.S
-dl-symaddr.c
-dl-fptr.c
-elf/entry.h
-hp-timing.c
-ia64libgcc.S
-ieee754.h
-softpipe.h
-bits/link.h
diff --git a/sysdeps/ia64/Makefile b/sysdeps/ia64/Makefile
index 2ea937ac9e..bf43c96144 100644
--- a/sysdeps/ia64/Makefile
+++ b/sysdeps/ia64/Makefile
@@ -12,8 +12,8 @@ elide-routines.os += hp-timing
 
 ifeq (yes,$(build-shared))
 # Compatibility
-sysdep_routines += ia64libgcc
-shared-only-routines += ia64libgcc
+sysdep_routines += libgcc-compat
+shared-only-routines += libgcc-compat
 endif
 endif
 
diff --git a/sysdeps/ia64/Versions b/sysdeps/ia64/Versions
index 6910566ac9..56b417d614 100644
--- a/sysdeps/ia64/Versions
+++ b/sysdeps/ia64/Versions
@@ -12,3 +12,10 @@ libc {
     __multi3;
   }
 }
+libm {
+  GLIBC_2.1 {
+    # A generic bug got this omitted from other configurations' version
+    # sets, but we always had it.
+    exp2l;
+  }
+}
diff --git a/sysdeps/ia64/_mcount.S b/sysdeps/ia64/_mcount.S
index aa91cb5d42..8720a9c104 100644
--- a/sysdeps/ia64/_mcount.S
+++ b/sysdeps/ia64/_mcount.S
@@ -72,6 +72,7 @@ LEAF(_mcount)
 	mov b7 = loc0
 	mov rp = in2
 	;;
+	mov r3 = in0
 	mov r8 = loc2
 	mov r15 = loc3
 	mov b6 = r2
@@ -81,10 +82,10 @@ END(_mcount)
 LOCAL_LEAF(_mcount_ret_helper)
 	.prologue
 	.altrp b7
-	.save ar.pfs, r40
+	.save ar.pfs, r3
 	.body
-	alloc r2 = ar.pfs, 0, 0, 9, 0
-	mov ar.pfs = r40
+	alloc r2 = ar.pfs, 0, 0, 8, 0
+	mov ar.pfs = r3
 	br b7
 END(_mcount_ret_helper)
 
diff --git a/sysdeps/ia64/backtrace.c b/sysdeps/ia64/backtrace.c
index efacccce15..3f2b75ec03 100644
--- a/sysdeps/ia64/backtrace.c
+++ b/sysdeps/ia64/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -90,3 +90,4 @@ __backtrace (array, size)
   return arg.cnt != -1 ? arg.cnt : 0;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/ia64/bits/atomic.h b/sysdeps/ia64/bits/atomic.h
index e7d312c539..1020c2f229 100644
--- a/sysdeps/ia64/bits/atomic.h
+++ b/sysdeps/ia64/bits/atomic.h
@@ -52,12 +52,12 @@ typedef uintmax_t uatomic_max_t;
   (abort (), 0)
 
 #define __arch_compare_and_exchange_bool_32_acq(mem, newval, oldval) \
-  (!__sync_bool_compare_and_swap_si ((void *) (mem), (int) (long) (oldval), \
-				     (int) (long) (newval)))
+  (!__sync_bool_compare_and_swap ((mem), (int) (long) (oldval), \
+				  (int) (long) (newval)))
 
 #define __arch_compare_and_exchange_bool_64_acq(mem, newval, oldval) \
-  (!__sync_bool_compare_and_swap_di ((void *) (mem), (long) (oldval), \
-				     (long) (newval)))
+  (!__sync_bool_compare_and_swap ((mem), (long) (oldval), \
+				  (long) (newval)))
 
 #define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
   (abort (), (__typeof (*mem)) 0)
@@ -66,12 +66,11 @@ typedef uintmax_t uatomic_max_t;
   (abort (), (__typeof (*mem)) 0)
 
 #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
-  __sync_val_compare_and_swap_si ((void *) (mem), (int) (long) (oldval), \
-				  (int) (long) (newval))
+  __sync_val_compare_and_swap ((mem), (int) (long) (oldval), \
+			       (int) (long) (newval))
 
 #define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-  __sync_val_compare_and_swap_di ((void *) (mem), (long) (oldval), \
-				  (long) (newval))
+  __sync_val_compare_and_swap ((mem), (long) (oldval), (long) (newval))
 
 /* Atomically store newval and return the old value.  */
 #define atomic_exchange_acq(mem, value) \
@@ -80,15 +79,9 @@ typedef uintmax_t uatomic_max_t;
 #define atomic_exchange_rel(mem, value) \
   (__sync_synchronize (), __sync_lock_test_and_set (mem, value))
 
-
 #define atomic_exchange_and_add(mem, value) \
   ({ __typeof (*mem) __result;						      \
-     if (sizeof (*mem) == 4)						      \
-       __result = __sync_fetch_and_add_si ((void *) (mem), (int) (value));    \
-     else if (sizeof (*mem) == 8)					      \
-       __result = __sync_fetch_and_add_di ((void *) (mem), (long) (value));   \
-     else								      \
-       abort ();							      \
+     __result = __sync_fetch_and_add ((mem), (int) (value));		      \
      __result; })
 
 #define atomic_decrement_if_positive(mem) \
diff --git a/sysdeps/ia64/bits/link.h b/sysdeps/ia64/bits/link.h
index 7f8b0550d9..f751c23fd1 100644
--- a/sysdeps/ia64/bits/link.h
+++ b/sysdeps/ia64/bits/link.h
@@ -1,5 +1,63 @@
-struct link_map_machine
-  {
-    size_t fptr_table_len;
-    Elf64_Addr *fptr_table;
-  };
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+/* Registers for entry into PLT on ia64.  */
+typedef struct La_ia64_regs
+{
+  uint64_t lr_r8;
+  uint64_t lr_r9;
+  uint64_t lr_r10;
+  uint64_t lr_r11;
+  uint64_t lr_gr [8];
+  long double lr_fr [8];
+  uint64_t lr_unat;
+  uint64_t lr_sp;
+} La_ia64_regs;
+
+/* Return values for calls from PLT on ia64.  */
+typedef struct La_ia64_retval
+{
+  uint64_t lrv_r8;
+  uint64_t lrv_r9;
+  uint64_t lrv_r10;
+  uint64_t lrv_r11;
+  long double lr_fr [8];
+} La_ia64_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_ia64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
+				       uintptr_t *__refcook,
+				       uintptr_t *__defcook,
+				       La_ia64_regs *__regs,
+				       unsigned int *__flags,
+				       const char *__symname,
+				       long int *__framesizep);
+extern unsigned int la_ia64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx,
+					uintptr_t *__refcook,
+					uintptr_t *__defcook,
+					const La_ia64_regs *__inregs,
+					La_ia64_retval *__outregs,
+					const char *symname);
+
+__END_DECLS
diff --git a/sysdeps/ia64/bits/linkmap.h b/sysdeps/ia64/bits/linkmap.h
new file mode 100644
index 0000000000..7f8b0550d9
--- /dev/null
+++ b/sysdeps/ia64/bits/linkmap.h
@@ -0,0 +1,5 @@
+struct link_map_machine
+  {
+    size_t fptr_table_len;
+    Elf64_Addr *fptr_table;
+  };
diff --git a/sysdeps/ia64/fpu/bits/mathdef.h b/sysdeps/ia64/bits/mathdef.h
index 3dc2860223..3dc2860223 100644
--- a/sysdeps/ia64/fpu/bits/mathdef.h
+++ b/sysdeps/ia64/bits/mathdef.h
diff --git a/sysdeps/ia64/dl-lookupcfg.h b/sysdeps/ia64/dl-lookupcfg.h
index 0ae3dd68ba..b50030ebd2 100644
--- a/sysdeps/ia64/dl-lookupcfg.h
+++ b/sysdeps/ia64/dl-lookupcfg.h
@@ -1,5 +1,5 @@
 /* Configuration of lookup functions.
-   Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003, 2004 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
@@ -17,12 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* The ia64 need more information from the symbol lookup function
-   than just the address. */
-#define DL_LOOKUP_RETURNS_MAP
 #define ELF_FUNCTION_PTR_IS_SPECIAL
 #define DL_UNMAP_IS_SPECIAL
 
+#include <dl-fptr.h>
+
 /* We do not support copy relocations for IA-64.  */
 #define DL_NO_COPY_RELOCS
 
@@ -59,3 +58,15 @@ extern void _dl_unmap (struct link_map *map);
 
 #define DL_DT_INIT_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
 #define DL_DT_FINI_ADDRESS(map, addr) DL_AUTO_FUNCTION_ADDRESS (map, addr)
+/* The type of the return value of fixup/profile_fixup.  */
+#define DL_FIXUP_VALUE_TYPE struct fdesc
+/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address
+   and a link map.  */
+#define DL_FIXUP_MAKE_VALUE(map, addr) \
+  ((struct fdesc) { (addr), (map)->l_info[DT_PLTGOT]->d_un.d_ptr })
+/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE.
+ */
+#define DL_FIXUP_VALUE_CODE_ADDR(value) (value).ip
+
+#define DL_FIXUP_VALUE_ADDR(value) ((uintptr_t) &(value))
+#define DL_FIXUP_ADDR_VALUE(addr) (*(struct fdesc *) (addr))
diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index 3108047869..55349690e3 100644
--- a/sysdeps/ia64/dl-machine.h
+++ b/sysdeps/ia64/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  IA-64 version.
-   Copyright (C) 1995-1997, 2000-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 2000-2004, 2005 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
@@ -123,7 +123,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	doit = (Elf64_Addr) ((struct fdesc *) &_dl_runtime_resolve)->ip;
       else
 	{
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    {
 	      /* This is the object we are looking for.  Say that we really
 		 want profiling and the timers are started.  */
@@ -139,133 +140,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-
-/*
-   This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns. `fixup()' takes two
-   arguments, however profile_fixup() takes three.
-
-   The ABI specifies that we will never see more than 8 input
-   registers to a function call, thus it is safe to simply allocate
-   those, and simpler than playing stack games.
-					                     - 12/09/99 Jes
- */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)			     \
-  extern void tramp_name (void);					     \
-  asm (									     \
-"	.global " #tramp_name "#\n"					     \
-"	.proc " #tramp_name "#\n"					     \
-#tramp_name ":\n"							     \
-"	{ .mmi\n"							     \
-"	  .prologue\n"							     \
-"	  .save ar.pfs, r40\n"						     \
-"	  alloc loc0 = ar.pfs, 8, 6, 3, 0\n"				     \
-"	  adds r2 = -144, r12\n"					     \
-"	  adds r3 = -128, r12\n"					     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  .fframe 160\n"						     \
-"	  adds r12 = -160, r12\n"					     \
-"	  .save rp, r41\n"						     \
-"	  mov loc1 = b0\n"						     \
-"	  .body\n"							     \
-"	  mov out2 = b0		/* needed by fixup_profile */\n"	     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mfb\n"							     \
-"	  mov loc2 = r8		/* preserve struct value register */\n"	     \
-"	  nop.f 0\n"							     \
-"	  nop.b 0\n"							     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  mov loc3 = r9		/* preserve language specific register */\n" \
-"	  mov loc4 = r10	/* preserve language specific register */\n" \
-"	  mov loc5 = r11	/* preserve language specific register */\n" \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  stf.spill [r2] = f8, 32\n"					     \
-"	  stf.spill [r3] = f9, 32\n"					     \
-"	  mov out0 = r16\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  stf.spill [r2] = f10, 32\n"					     \
-"	  stf.spill [r3] = f11, 32\n"					     \
-"	  shl out1 = r15, 4\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  stf.spill [r2] = f12, 32\n"					     \
-"	  stf.spill [r3] = f13, 32\n"					     \
-"	  shladd out1 = r15, 3, out1\n"					     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmb\n"							     \
-"	  stf.spill [r2] = f14\n"					     \
-"	  stf.spill [r3] = f15\n"					     \
-"	  br.call.sptk.many b0 = " #fixup_name "#\n"			     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  ld8 r9 = [ret0], 8\n"						     \
-"	  adds r2 = 16, r12\n"						     \
-"	  adds r3 = 32, r12\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f8 = [r2], 32\n"					     \
-"	  ldf.fill f9 = [r3], 32\n"					     \
-"	  mov b0 = loc1\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f10 = [r2], 32\n"					     \
-"	  ldf.fill f11 = [r3], 32\n"					     \
-"	  mov b6 = r9\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f12 = [r2], 32\n"					     \
-"	  ldf.fill f13 = [r3], 32\n"					     \
-"	  mov ar.pfs = loc0\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mmi\n"							     \
-"	  ldf.fill f14 = [r2], 32\n"					     \
-"	  ldf.fill f15 = [r3], 32\n"					     \
-"	  .restore sp		/* pop the unwind frame state */\n"	     \
-"	  adds r12 = 160, r12\n"					     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  mov r9 = loc3		/* restore language specific register */\n"  \
-"	  mov r10 = loc4	/* restore language specific register */\n"  \
-"	  mov r11 = loc5	/* restore language specific register */\n"  \
-"	}\n"								     \
-"	{ .mii\n"							     \
-"	  ld8 gp = [ret0]\n"						     \
-"	  mov r8 = loc2		/* restore struct value register */\n"	     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	/* An alloc is needed for the break system call to work.\n"	     \
-"	   We don't care about the old value of the pfs register.  */\n"     \
-"	{ .mmb\n"							     \
-"	  .prologue\n"							     \
-"	  .body\n"							     \
-"	  alloc r2 = ar.pfs, 0, 0, 8, 0\n"				     \
-"	  br.sptk.many b6\n"						     \
-"	  ;;\n"								     \
-"	}\n"								     \
-"	.endp " #tramp_name "#\n");
-
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE 				\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);		\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE				\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);		\
-  strong_alias (_dl_runtime_resolve, _dl_runtime_profile);
-#endif
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER ia64_gnu_pltenter
+#define ARCH_LA_PLTEXIT ia64_gnu_pltexit
 
 /* Undo the adds out0 = 16, sp below to get at the value we want in
    __libc_stack_end.  */
@@ -454,34 +331,29 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 #define ELF_MACHINE_START_ADDRESS(map, start)	\
   DL_STATIC_FUNCTION_ADDRESS (map, start)
 
-#define elf_machine_profile_fixup_plt(l, reloc, rel_addr, value) \
-  elf_machine_fixup_plt (l, reloc, rel_addr, value)
-
-#define elf_machine_profile_plt(reloc_addr) ((Elf64_Addr) (reloc_addr))
-
 /* Fixup a PLT entry to bounce directly to the function at VALUE.  */
-static inline Elf64_Addr __attribute__ ((always_inline))
+static inline struct fdesc __attribute__ ((always_inline))
 elf_machine_fixup_plt (struct link_map *l, lookup_t t,
 		       const Elf64_Rela *reloc,
-		       Elf64_Addr *reloc_addr, Elf64_Addr value)
+		       Elf64_Addr *reloc_addr, struct fdesc value)
 {
   /* l is the link_map for the caller, t is the link_map for the object
    * being called */
   /* got has already been relocated in elf_get_dynamic_info() */
-  reloc_addr[1] = t->l_info[DT_PLTGOT]->d_un.d_ptr;
+  reloc_addr[1] = value.gp;
   /* we need a "release" here to ensure that the gp is visible before
      the code entry point is updated: */
-  ((volatile Elf64_Addr *) reloc_addr)[0] = value;
-  return (Elf64_Addr) reloc_addr;
+  ((volatile Elf64_Addr *) reloc_addr)[0] = value.ip;
+  return value;
 }
 
 /* Return the final value of a plt relocation.  */
-static inline Elf64_Addr
+static inline struct fdesc
 elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
-		       Elf64_Addr value)
+		       struct fdesc value)
 {
   /* No need to handle rel vs rela since IA64 is rela only */
-  return value + reloc->r_addend;
+  return (struct fdesc) { value.ip + reloc->r_addend, value.gp };
 }
 
 #endif /* !dl_machine_h */
@@ -552,7 +424,8 @@ elf_machine_rela (struct link_map *map,
 	    ;/* No adjustment.  */
 	  else if (r_type == R_IA64_IPLTLSB)
 	    {
-	      elf_machine_fixup_plt (NULL, sym_map, reloc, reloc_addr, value);
+	      elf_machine_fixup_plt (NULL, NULL, reloc, reloc_addr,
+				     DL_FIXUP_MAKE_VALUE (sym_map, value));
 	      return;
 	    }
 	  else if (R_IA64_TYPE (r_type) == R_IA64_TYPE (R_IA64_FPTR64LSB))
diff --git a/sysdeps/ia64/dl-sysdep.h b/sysdeps/ia64/dl-sysdep.h
index 352bb3bed5..e4040efc4c 100644
--- a/sysdeps/ia64/dl-sysdep.h
+++ b/sysdeps/ia64/dl-sysdep.h
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  IA-64 version.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005 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
@@ -17,25 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifndef _DL_SYSDEP_H
-#define _DL_SYSDEP_H   1
-
-/* This macro must be defined to either 0 or 1.
-
-   If 1, then an errno global variable hidden in ld.so will work right with
-   all the errno-using libc code compiled for ld.so, and there is never a
-   need to share the errno location with libc.  This is appropriate only if
-   all the libc functions that ld.so uses are called without PLT and always
-   get the versions linked into ld.so rather than the libc ones.  */
-
-#ifdef IS_IN_rtld
-# define RTLD_PRIVATE_ERRNO 1
-#else
-# define RTLD_PRIVATE_ERRNO 0
-#endif
+#include_next <dl-sysdep.h>
 
 /* _dl_argv cannot be attribute_relro, because _dl_start_user
    might write into it after _dl_start returns.  */
 #define DL_ARGV_NOT_RELRO 1
-
-#endif /* dl-sysdep.h */
diff --git a/sysdeps/ia64/dl-trampoline.S b/sysdeps/ia64/dl-trampoline.S
new file mode 100644
index 0000000000..1b31dc7c9c
--- /dev/null
+++ b/sysdeps/ia64/dl-trampoline.S
@@ -0,0 +1,539 @@
+/* PLT trampolines.  ia64 version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#undef ret
+
+/*
+   This code is used in dl-runtime.c to call the `_dl_fixup' function
+   and then redirect to the address it returns. `_dl_fixup()' takes two
+   arguments, however _dl_profile_fixup() takes five.
+
+   The ABI specifies that we will never see more than 8 input
+   registers to a function call, thus it is safe to simply allocate
+   those, and simpler than playing stack games.  */
+
+/* Used to save and restore 8 incoming fp registers */
+#define RESOLVE_FRAME_SIZE (16*8)
+
+ENTRY(_dl_runtime_resolve)
+	{ .mmi
+	  .prologue
+	  .save ar.pfs, r40
+	  alloc loc0 = ar.pfs, 8, 6, 2, 0
+	  /* Use the 16 byte scratch area. r2 will start at f8 and
+	     r3 will start at f9.  */
+	  adds r2 = -(RESOLVE_FRAME_SIZE - 16), r12
+	  adds r3 = -(RESOLVE_FRAME_SIZE - 32), r12
+	}
+	{ .mii
+	  .fframe RESOLVE_FRAME_SIZE
+	  adds r12 = -RESOLVE_FRAME_SIZE, r12
+	  .save rp, loc1
+	  mov loc1 = b0
+	  .body
+	  mov loc2 = r8		/* preserve struct value register */
+	  ;;
+	}
+	{ .mii
+	  mov loc3 = r9		/* preserve language specific register */
+	  mov loc4 = r10	/* preserve language specific register */
+	  mov loc5 = r11	/* preserve language specific register */
+	}
+	{ .mmi
+	  stf.spill [r2] = f8, 32
+	  stf.spill [r3] = f9, 32
+	  mov out0 = r16
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f10, 32
+	  stf.spill [r3] = f11, 32
+	  shl out1 = r15, 4
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f12, 32
+	  stf.spill [r3] = f13, 32
+	  /* Relocation record is 24 byte. */
+	  shladd out1 = r15, 3, out1
+	  ;;
+	}
+	{ .mmb
+	  stf.spill [r2] = f14
+	  stf.spill [r3] = f15
+	  br.call.sptk.many b0 = _dl_fixup
+	}
+	{ .mii
+	  /* Skip the 16byte scratch area.  */
+	  adds r2 = 16, r12
+	  adds r3 = 32, r12
+	  mov b6 = ret0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f8 = [r2], 32
+	  ldf.fill f9 = [r3], 32
+	  mov b0 = loc1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f10 = [r2], 32
+	  ldf.fill f11 = [r3], 32
+	  mov gp = ret1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f12 = [r2], 32
+	  ldf.fill f13 = [r3], 32
+	  mov ar.pfs = loc0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f14 = [r2], 32
+	  ldf.fill f15 = [r3], 32
+	  .restore sp		/* pop the unwind frame state */
+	  adds r12 = RESOLVE_FRAME_SIZE, r12
+	  ;;
+	}
+	{ .mii
+	  mov r9 = loc3		/* restore language specific register */
+	  mov r10 = loc4	/* restore language specific register */
+	  mov r11 = loc5	/* restore language specific register */
+	}
+	{ .mii
+	  mov r8 = loc2		/* restore struct value register */
+	  ;;
+	}
+	/* An alloc is needed for the break system call to work.
+	   We don't care about the old value of the pfs register.  */
+	{ .mmb
+	  .prologue
+	  .body
+	  alloc r2 = ar.pfs, 0, 0, 8, 0
+	  br.sptk.many b6
+	  ;;
+	}
+END(_dl_runtime_resolve)
+
+
+/* The fourth argument to _dl_profile_fixup and the third one to
+   _dl_call_pltexit are a pointer to La_ia64_regs:
+
+   8byte r8
+   8byte r9
+   8byte r10
+   8byte r11
+   8byte in0
+   8byte in1
+   8byte in2
+   8byte in3
+   8byte in4
+   8byte in5
+   8byte in6
+   8byte in7
+   16byte f8
+   16byte f9
+   16byte f10
+   16byte f11
+   16byte f12
+   16byte f13
+   16byte f14
+   16byte f15
+   8byte ar.unat
+   8byte sp
+
+   The fifth argument to _dl_profile_fixup is a pointer to long int.
+   The fourth argument to _dl_call_pltexit is a pointer to
+   La_ia64_retval:
+
+   8byte r8
+   8byte r9
+   8byte r10
+   8byte r11
+   16byte f8
+   16byte f9
+   16byte f10
+   16byte f11
+   16byte f12
+   16byte f13
+   16byte f14
+   16byte f15
+
+  Since stack has to be 16 byte aligned, the stack allocation is in
+  16byte increment. Before calling _dl_profile_fixup, the stack will
+  look like
+
+  psp	new frame_size
+  +16	La_ia64_regs
+  sp	scratch
+
+ */
+
+#define PLTENTER_FRAME_SIZE (4*8 + 8*8 + 8*16 + 2*8 + 16)
+#define PLTEXIT_FRAME_SIZE (PLTENTER_FRAME_SIZE + 4*8 + 8*16)
+
+#ifndef PROF
+ENTRY(_dl_runtime_profile)
+	{ .mii
+	  .prologue
+	  .save ar.pfs, r40
+	  alloc loc0 = ar.pfs, 8, 12, 8, 0
+	  .vframe loc10
+	  mov loc10 = r12
+	  .save rp, loc1
+	  mov loc1 = b0
+	}
+	{ .mii
+	  .save ar.unat, r17
+	  mov r17 = ar.unat
+	  .save ar.lc, loc6
+	  mov loc6 = ar.lc
+	  mov loc11 = gp
+	}
+	{ .mii
+	  .body
+	  /* There is a 16 byte scratch area. r2 will start at r8 and
+	     r3 will start at r9 for La_ia64_regs.  */
+	  adds r2 = -(PLTENTER_FRAME_SIZE - 16), r12
+	  adds r3 = -(PLTENTER_FRAME_SIZE - 24), r12
+	  adds r12 = -PLTENTER_FRAME_SIZE, r12
+	  ;;
+	}
+	{ .mmi
+	  st8 [r2] = r8, 16;
+	  st8 [r3] = r9, 16;
+	  mov out2 = b0		/* needed by _dl_fixup_profile */
+	  ;;
+	}
+	{ .mmi
+	  st8 [r2] = r10, 16;
+	  st8 [r3] = r11, 16;
+	  adds out3 = 16, r12	/* pointer to La_ia64_regs */
+	  ;;
+	}
+	{ .mmi
+	  .mem.offset 0, 0
+	  st8.spill [r2] = in0, 16
+	  .mem.offset 8, 0
+	  st8.spill [r3] = in1, 16
+	  mov out4 = loc10	/* pointer to new frame size  */
+	  ;;
+	}
+	{ .mmi
+	  .mem.offset 0, 0
+	  st8.spill [r2] = in2, 16
+	  .mem.offset 8, 0
+	  st8.spill [r3] = in3, 16
+	  mov loc2 = r8		/* preserve struct value register */
+	  ;;
+	}
+	{ .mmi
+	  .mem.offset 0, 0
+	  st8.spill [r2] = in4, 16
+	  .mem.offset 8, 0
+	  st8.spill [r3] = in5, 16
+	  mov loc3 = r9		/* preserve language specific register */
+	  ;;
+	}
+	{ .mmi
+	  .mem.offset 0, 0
+	  st8 [r2] = in6, 16
+	  .mem.offset 8, 0
+	  st8 [r3] = in7, 24	/* adjust for f9 */
+	  mov loc4 = r10	/* preserve language specific register */
+	  ;;
+	}
+	{ .mii
+	  mov r18 = ar.unat	/* save it in La_ia64_regs */
+	  mov loc7 = out3	/* save it for _dl_call_pltexit */
+	  mov loc5 = r11	/* preserve language specific register */
+	}
+	{ .mmi
+	  stf.spill [r2] = f8, 32
+	  stf.spill [r3] = f9, 32
+	  mov out0 = r16	/* needed by _dl_fixup_profile */
+	  ;;
+	}
+	{ .mii
+	  mov ar.unat = r17	/* restore it for function call */
+	  mov loc8 = r16	/* save it for _dl_call_pltexit */
+	  nop.i 0x0
+	}
+	{ .mmi
+	  stf.spill [r2] = f10, 32
+	  stf.spill [r3] = f11, 32
+	  shl out1 = r15, 4
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f12, 32
+	  stf.spill [r3] = f13, 32
+	  /* Relocation record is 24 byte. */
+	  shladd out1 = r15, 3, out1
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f14, 32
+	  stf.spill [r3] = f15, 24
+	  mov loc9 = out1	/* save it for _dl_call_pltexit */
+	  ;;
+	}
+	{ .mmb
+	  st8 [r2] = r18	/* store ar.unat */
+	  st8 [r3] = loc10	/* store sp */
+	  br.call.sptk.many b0 = _dl_profile_fixup
+	}
+	{ .mii
+	  /* Skip the 16byte scratch area, 4 language specific GRs and
+	     8 incoming GRs to restore incoming fp registers.  */
+	  adds r2 = (4*8 + 8*8 + 16), r12
+	  adds r3 = (4*8 + 8*8 + 32), r12
+	  mov b6 = ret0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f8 = [r2], 32
+	  ldf.fill f9 = [r3], 32
+	  mov gp = ret1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f10 = [r2], 32
+	  ldf.fill f11 = [r3], 32
+	  mov r8 = loc2		/* restore struct value register */
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f12 = [r2], 32
+	  ldf.fill f13 = [r3], 32
+	  mov r9 = loc3		/* restore language specific register */
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f14 = [r2], 32
+	  ldf.fill f15 = [r3], 32
+	  mov r10 = loc4	/* restore language specific register */
+	  ;;
+	}
+	{ .mii
+	  ld8 r15 = [loc10]	/* load the new frame size */
+	  mov r11 = loc5	/* restore language specific register */
+	  ;;
+	  cmp.eq p6, p7 = -1, r15
+	  ;;
+	}
+	{ .mii
+(p7)	  cmp.eq p8, p9 = 0, r15
+(p6)	  mov b0 = loc1
+(p6)	  mov ar.lc = loc6
+	}
+	{ .mib
+	  nop.m 0x0
+(p6)	  mov ar.pfs = loc0
+(p6)	  br.cond.dptk.many .Lresolved
+	  ;;
+	}
+
+	/* At this point, the stack looks like
+
+	  +psp	free
+	  +16	La_ia64_regs
+	  sp	scratch
+
+	  We need to keep the current stack and call the resolved
+	  function by copying the r15 byte from sp + PLTENTER_FRAME_SIZE
+	  + 16 (scratch area) to sp + 16 (scratch area). Since stack
+	  has to be 16byte aligned, we around r15 up to 16byte.  */
+
+	{ .mbb
+(p9)	  adds r15 = 15, r15
+(p8)	  br.cond.dptk.many .Lno_new_frame
+	  nop.b 0x0
+	  ;;
+	}
+	{ .mmi
+	  and r15 = -16, r15
+	  ;;
+	  /* We don't copy the 16byte scatch area. Prepare r16/r17 as
+	     destination.  */
+	  sub r16 = r12, r15
+	  sub r17 = r12, r15
+	  ;;
+	}
+	{ .mii
+	  adds r16 = 16, r16
+	  adds r17 = 24, r17
+	  sub r12 = r12, r15		/* Adjust stack  */
+	  ;;
+	}
+	{ .mii
+	  nop.m 0x0
+	  shr r15 = r15, 4
+	  ;;
+	  adds r15 = -1, r15
+	  ;;
+	}
+	{ .mii
+	  /* Skip the 16byte scatch area. Prepare r2/r3 as source.  */
+	  adds r2 = 16, loc10
+	  adds r3 = 24, loc10
+	  mov ar.lc = r15
+	  ;;
+	}
+.Lcopy:
+	{ .mmi
+	  ld8 r18 = [r2], 16
+	  ld8 r19 = [r3], 16
+	  nop.i 0x0
+	  ;;
+	}
+	{ .mmb
+	  st8 [r16] = r18, 16
+	  st8 [r17] = r19, 16
+	  br.cloop.sptk.few .Lcopy
+	}
+.Lno_new_frame:
+	{ .mii
+	  mov out0 = in0
+	  mov out1 = in1
+	  mov out2 = in2
+	}
+	{ .mii
+	  mov out3 = in3
+	  mov out4 = in4
+	  mov out5 = in5
+	}
+	{ .mib
+	  mov out6 = in6
+	  mov out7 = in7
+	  /* Call the resolved function  */
+	  br.call.sptk.many b0 = b6
+	}
+	{ .mii
+	  /* Prepare stack for _dl_call_pltexit. Loc10 has the original
+	     stack pointer.  */
+	  adds r12 = -PLTEXIT_FRAME_SIZE, loc10
+	  adds r2 = -(PLTEXIT_FRAME_SIZE - 16), loc10
+	  adds r3 = -(PLTEXIT_FRAME_SIZE - 24), loc10
+	  ;;
+	}
+	{ .mmi
+	  /* Load all possible return values into buffer.  */
+	  st8 [r2] = r8, 16
+	  st8 [r3] = r9, 16
+	  mov out0 = loc8
+	  ;;
+	}
+	{ .mmi
+	  st8 [r2] = r10, 16
+	  st8 [r3] = r11, 24
+	  mov out1 = loc9
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f8, 32
+	  stf.spill [r3] = f9, 32
+	  mov out2 = loc7		/* Pointer to La_ia64_regs */
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f10, 32
+	  stf.spill [r3] = f11, 32
+	  adds out3 = 16, r12		/* Pointer to La_ia64_retval */
+	  ;;
+	}
+	{ .mmi
+	  stf.spill [r2] = f12, 32
+	  stf.spill [r3] = f13, 32
+	  /* We need to restore gp for _dl_call_pltexit. */
+	  mov gp = loc11
+	  ;;
+	}
+	{ .mmb
+	  stf.spill [r2] = f14
+	  stf.spill [r3] = f15
+	  br.call.sptk.many b0 = _dl_call_pltexit
+	}
+	{ .mmi
+	  /* Load all the non-floating and floating return values. Skip
+	     the 16byte scratch area.  */
+	  adds r2 = 16, r12
+	  adds r3 = 24, r12
+	  nop.i 0x0
+	  ;;
+	}
+	{ .mmi
+	  ld8 r8 = [r2], 16
+	  ld8 r9 = [r3], 16
+	  nop.i 0x0
+	  ;;
+	}
+	{ .mmi
+	  ld8 r10 = [r2], 16
+	  ld8 r11 = [r3], 24
+	  nop.i 0x0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f8 = [r2], 32
+	  ldf.fill f9 = [r3], 32
+	  mov ar.lc = loc6
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f10 = [r2], 32
+	  ldf.fill f11 = [r3], 32
+	  mov ar.pfs = loc0
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f12 = [r2], 32
+	  ldf.fill f13 = [r3], 32
+	  mov b0 = loc1
+	  ;;
+	}
+	{ .mmi
+	  ldf.fill f14 = [r2]
+	  ldf.fill f15 = [r3]
+	  /* We know that the previous stack pointer, loc10, isn't 0.
+	     We use it to reload p7.  */
+	  cmp.ne p7, p0 = 0, loc10
+	  ;;
+	}
+.Lresolved:
+	{ .mmb
+	  .restore sp
+	  mov r12 = loc10
+(p7)	  br.ret.sptk.many b0
+	  ;;
+	}
+	/* An alloc is needed for the break system call to work. We
+	   don't care about the old value of the pfs register. After
+	   this alloc, we can't use any rotating registers. Otherwise
+	   assembler won't be happy. This has to be at the end.  */
+	{ .mmb
+	  .prologue
+	  .body
+	  alloc r2 = ar.pfs, 0, 0, 8, 0
+	  br.sptk.many b6
+	  ;;
+	}
+END(_dl_runtime_profile)
+#endif
diff --git a/sysdeps/ia64/elf/initfini.c b/sysdeps/ia64/elf/initfini.c
index 59674fe6f2..d0a65ece80 100644
--- a/sysdeps/ia64/elf/initfini.c
+++ b/sysdeps/ia64/elf/initfini.c
@@ -1,5 +1,5 @@
 /* Special .init and .fini section support for ia64.
-   Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2003, 2005 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
@@ -51,7 +51,6 @@ __asm__ ("\n\n"
 "\n"
 "/*@_init_PROLOG_BEGINS*/\n");
 
-#ifdef HAVE_INITFINI_ARRAY
 
 /* If we have working .init_array support, we want to keep the .init
    section empty (apart from the mandatory prologue/epilogue.  This
@@ -75,7 +74,6 @@ gmon_initializer (void)
 __asm__ (".section .init_array, \"aw\"\n"
 	 "\tdata8 @fptr(gmon_initializer)\n");
 
-#endif
 
 __asm__ (".section .init\n"
 "	.global _init#\n"
@@ -90,39 +88,20 @@ __asm__ (".section .init\n"
 "	mov r33 = b0\n"
 "	.body\n"
 "	adds r12 = -16, r12\n"
-#ifdef HAVE_INITFINI_ARRAY
 "	;;\n"		/* see gmon_initializer() above */
-#else
-"	.weak	__gmon_start__#\n"
-"	addl r14 = @ltoff(@fptr(__gmon_start__#)), gp\n"
-"	;;\n"
-"	ld8 r15 = [r14]\n"
-"	;;\n"
-"	cmp.eq p6, p7 = 0, r15\n"
-"	(p6) br.cond.dptk .L5\n"
-"\n"
-"/* we could use r35 to save gp, but we use the stack since that's what\n"
-" * all the other init routines will do --davidm 00/04/05 */\n"
-"	st8 [r12] = gp, -16\n"
-"	br.call.sptk.many b0 = __gmon_start__# ;;\n"
-"	adds r12 = 16, r12\n"
-"	;;\n"
-"	ld8 gp = [r12]\n"
-"	;;\n"
-".L5:\n"
-#endif
 "	.endp _init#\n"
 "\n"
 "/*@_init_PROLOG_ENDS*/\n"
 "\n"
 "/*@_init_EPILOG_BEGINS*/\n"
+"	.section .init\n"
 "	.proc _init#\n"
+"_init:\n"
 "	.prologue\n"
 "	.save ar.pfs, r34\n"
 "	.vframe r32\n"
 "	.save rp, r33\n"
 "	.body\n"
-"	.section .init\n"
 "	.regstk 0,2,0,0\n"
 "	mov r12 = r32\n"
 "	mov ar.pfs = r34\n"
@@ -155,6 +134,7 @@ __asm__ (".section .init\n"
 "/*@_fini_EPILOG_BEGINS*/\n"
 "	.section .fini\n"
 "	.proc _fini#\n"
+"_fini:\n"
 "	.prologue\n"
 "	.save ar.pfs, r34\n"
 "	.vframe r32\n"
diff --git a/sysdeps/ia64/fpu/Dist b/sysdeps/ia64/fpu/Dist
deleted file mode 100644
index afd3153506..0000000000
--- a/sysdeps/ia64/fpu/Dist
+++ /dev/null
@@ -1,11 +0,0 @@
-libc_libm_error.c
-libm_atan2_reg.S
-libm_error.c
-libm_frexp4.S
-libm_frexp4f.S
-libm_frexp4l.S
-libm_reduce.S
-libm_support.h
-libm_tan.S
-s_matherrf.c
-s_matherrl.c
diff --git a/sysdeps/ia64/fpu/Makefile b/sysdeps/ia64/fpu/Makefile
index 6d1b0c1717..384fc836af 100644
--- a/sysdeps/ia64/fpu/Makefile
+++ b/sysdeps/ia64/fpu/Makefile
@@ -1,8 +1,34 @@
 ifeq ($(subdir),math)
-libm-sysdep_routines += libm_atan2_reg s_matherrf s_matherrl libm_reduce \
-			libm_tan libm_error \
-			libm_frexp4 libm_frexp4f libm_frexp4l
+#
+# Some files which need to go both into libc and libm have external
+# dependencies which need to be resolved differently for libc
+# vs. libm.  For example, inside libc, __libm_error_support needs to
+# resolve to HIDDEN_JUMPTARGET(__libm_error_support) whereas within
+# libm it always resolves to __libm_error_support.  Such files need to
+# be compiled twice.  Fortunately, math/Makefile already has logic to
+# support this: if a file starts with "s_", make will automatically
+# generate a matching file whose name starts with "m_" which simply
+# includes the corresponding "s_" file.
+#
+duplicated-routines = s_libm_ldexp s_libm_ldexpf s_libm_ldexpl \
+		      s_libm_scalbn s_libm_scalbnf s_libm_scalbnl
 
-sysdep_routines += libm_frexp4 libm_frexp4f libm_frexp4l libc_libm_error
-sysdep-CPPFLAGS += -DSIZE_INT_32
+libm-sysdep_routines += s_erfc s_erfcf s_erfcl \
+			s_matherrf s_matherrl libm_reduce \
+			libm_error \
+			libm_frexp libm_frexpf libm_frexpl \
+			libm_sincos libm_sincosf libm_sincosl \
+			libm_sincos_large \
+			libm_lgamma libm_lgammaf libm_lgammal \
+			libm_scalblnf \
+			$(duplicated-routines:s_%=m_%)
+
+sysdep_routines += libc_libm_error libm_frexp libm_frexpf libm_frexpl \
+		   $(duplicated-routines)
+
+sysdep-CPPFLAGS += -include libm-symbols.h \
+	-D__POSIX__ -Dopensource \
+	-D_LIB_VERSIONIMF=_LIB_VERSION \
+	-DSIZE_INT_32 -DSIZE_LONG_INT_64 -DSIZE_LONG_LONG_INT_64 \
+	-DSIZE_LONG_64 -DIA64
 endif
diff --git a/sysdeps/ia64/fpu/README b/sysdeps/ia64/fpu/README
new file mode 100644
index 0000000000..6f4af0678a
--- /dev/null
+++ b/sysdeps/ia64/fpu/README
@@ -0,0 +1,50 @@
+  ----------------------------------------------------------
+  Notes on how to update libm based on Intel's libm releases
+  ----------------------------------------------------------
+
+This source code in this directory is currently based on Intel libm
+v2.1 as available from:
+
+  http://www.intel.com/software/products/opensource/libraries/num.htm
+
+To ease importing, fix some bugs, and simplify integration into libc,
+it is also necessary to apply the patch at:
+
+  ftp://ftp.hpl.hp.com/pub/linux-ia64/intel-libm-041228.diff.gz
+
+The expectation is that Intel will integrate most if not all of these
+changes into future releases of libm, so this patching step can
+hopefully be omitted in the future.
+
+Once the patched libm sources are extracted in a directory $LIBM, they
+can be imported into the libc source tree at $LIBC with the following
+step:
+
+	$ cd $LIBC/src/sysdep/ia64/fpu
+	$ ./import_intel_libm $LIBM
+
+This should produce a number of "Importing..." messages, without
+showing any errors.
+
+At this point, you should be able to build glibc in the usual fashion.
+We assume you do this in directory $OBJ.  Once the build has
+completed, run "make check" to verify that all (math) checks succeed.
+If these checks succeed, you should also run the following commands to
+verify that the new libm doesn't pollute the name-space and has proper
+size-info for the data objects:
+
+	$ cd $LIBC/src/sysdep/ia64/fpu
+	$ import_check $OBJ/math/
+
+There should be no (unexpected) errors reported by this script.
+
+As an optional step, you may also want to confirm that the new libm
+exports the exact same global symbols as the old one.
+
+If you want to see the changes introduced by the "import_intel_libm"
+script, you can run the commands:
+
+	$ cd $LIBC/src/sysdep/ia64/fpu
+	$ import_diffs
+
+That's it.
diff --git a/sysdeps/ia64/fpu/e_acos.S b/sysdeps/ia64/fpu/e_acos.S
index 7e83811727..c2b31ab85e 100644
--- a/sysdeps/ia64/fpu/e_acos.S
+++ b/sysdeps/ia64/fpu/e_acos.S
@@ -1,10 +1,10 @@
 .file "acos.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003 Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,9 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// WARRANTY DISCLAIMER
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,838 +35,801 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 
 // History
 //==============================================================
-// 2/02/00  Initial version 
-// 8/17/00  New and much faster algorithm.
-// 8/30/00  Avoided bank conflicts on loads, shortened |x|=1 and x=0 paths,
+// 02/02/00 Initial version
+// 08/17/00 New and much faster algorithm.
+// 08/30/00 Avoided bank conflicts on loads, shortened |x|=1 and x=0 paths,
 //          fixed mfb split issue stalls.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 08/02/02 New and much faster algorithm II
+// 02/06/03 Reordered header: .section, .global, .proc, .align
 
 // Description
 //=========================================
-// The acos function computes the principle value of the arc sine of x.
+// The acos function computes the principal value of the arc cosine of x.
+// acos(0) returns Pi/2, acos(1) returns 0, acos(-1) returns Pi.
 // A doman error occurs for arguments not in the range [-1,+1].
+//
+// The acos function returns the arc cosine in the range [0, Pi] radians.
+//
+// There are 8 paths:
+// 1. x = +/-0.0
+//    Return acos(x) = Pi/2 + x
+//
+// 2. 0.0 < |x| < 0.625
+//    Return acos(x) = Pi/2 - x - x^3 *PolA(x^2)
+//    where PolA(x^2) = A3 + A5*x^2 + A7*x^4 +...+ A35*x^32
+//
+// 3. 0.625 <=|x| < 1.0
+//    Return acos(x) = Pi/2 - asin(x) =
+//                   = Pi/2 - sign(x) * ( Pi/2 - sqrt(R) * PolB(R))
+//    Where R = 1 - |x|,
+//          PolB(R) = B0 + B1*R + B2*R^2 +...+B12*R^12
+//
+//    sqrt(R) is approximated using the following sequence:
+//        y0 = (1 + eps)/sqrt(R) - initial approximation by frsqrta,
+//             |eps| < 2^(-8)
+//        Then 3 iterations are used to refine the result:
+//        H0 = 0.5*y0
+//        S0 = R*y0
+//
+//        d0 = 0.5 - H0*S0
+//        H1 = H0 + d0*H0
+//        S1 = S0 + d0*S0
+//
+//        d1 = 0.5 - H1*S1
+//        H2 = H1 + d0*H1
+//        S2 = S1 + d0*S1
+//
+//        d2 = 0.5 - H2*S2
+//        S3 = S3 + d2*S3
+//
+//        S3 approximates sqrt(R) with enough accuracy for this algorithm
+//
+//    So, the result should be reconstracted as follows:
+//    acos(x) = Pi/2 - sign(x) * (Pi/2 - S3*PolB(R))
+//
+//    But for optimization purposes the reconstruction step is slightly
+//    changed:
+//    acos(x) = Cpi + sign(x)*PolB(R)*S2 - sign(x)*d2*S2*PolB(R)
+//        where Cpi = 0 if x > 0 and Cpi = Pi if x < 0
+//
+// 4. |x| = 1.0
+//    Return acos(1.0) = 0.0, acos(-1.0) = Pi
+//
+// 5. 1.0 < |x| <= +INF
+//    A doman error occurs for arguments not in the range [-1,+1]
+//
+// 6. x = [S,Q]NaN
+//    Return acos(x) = QNaN
+//
+// 7. x is denormal
+//    Return acos(x) = Pi/2 - x,
+//
+// 8. x is unnormal
+//    Normalize input in f8 and return to the very beginning of the function
+//
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input, output
+// f6, f7, f9 -> f15, f32 -> f64
 
-// The acos function returns the arc cosine in the range [0, +pi] radians.
-// acos(1) returns +0, acos(-1) returns pi, acos(0) returns pi/2.
-// acos(x) returns a Nan and raises the invalid exception for |x| >1
+// General registers used:
+// r3, r21 -> r31, r32 -> r38
 
-// The acos function is just like asin except that pi/2 is added at the end.
+// Predicate registers used:
+// p0, p6 -> p14
 
 //
 // Assembly macros
 //=========================================
-
-#include "libm_support.h"
-
-// predicate registers
-//acos_pred_LEsqrt2by2            = p7
-//acos_pred_GTsqrt2by2            = p8
-
-// integer registers
-ASIN_Addr1                      = r33
-ASIN_Addr2                      = r34
-ASIN_FFFE                       = r35
-
-GR_SAVE_B0                      = r36
-GR_SAVE_PFS                     = r37
-GR_SAVE_GP                      = r38
-
-GR_Parameter_X                  = r39
-GR_Parameter_Y                  = r40
-GR_Parameter_RESULT             = r41
-GR_Parameter_Tag                = r42
-
-// floating point registers
-acos_coeff_P1                   = f32
-acos_coeff_P2                   = f33
-acos_coeff_P3                   = f34
-acos_coeff_P4                   = f35
-
-acos_coeff_P5                   = f36
-acos_coeff_P6                   = f37
-acos_coeff_P7                   = f38
-acos_coeff_P8                   = f39
-acos_coeff_P9                   = f40
-
-acos_coeff_P10                  = f41
-acos_coeff_P11                  = f42
-acos_coeff_P12                  = f43
-acos_coeff_P13                  = f44
-acos_coeff_P14                  = f45
-
-acos_coeff_P15                  = f46
-acos_coeff_P16                  = f47
-acos_coeff_P17                  = f48
-acos_coeff_P18                  = f49
-acos_coeff_P19                  = f50
-
-acos_coeff_P20                  = f51
-acos_coeff_P21                  = f52
-acos_const_sqrt2by2             = f53
-acos_const_piby2                = f54
-acos_abs_x                      = f55
-
-acos_tx                         = f56
-acos_tx2                        = f57
-acos_tx3                        = f58
-acos_tx4                        = f59
-acos_tx8                        = f60
-
-acos_tx11                       = f61
-acos_1poly_p8                   = f62
-acos_1poly_p19                  = f63
-acos_1poly_p4                   = f64
-acos_1poly_p15                  = f65
-
-acos_1poly_p6                   = f66
-acos_1poly_p17                  = f67
-acos_1poly_p0                   = f68
-acos_1poly_p11                  = f69
-acos_1poly_p2                   = f70
-
-acos_1poly_p13                  = f71
-acos_series_tx                  = f72
-acos_t                          = f73
-acos_t2                         = f74
-acos_t3                         = f75
-
-acos_t4                         = f76
-acos_t8                         = f77
-acos_t11                        = f78
-acos_poly_p8                    = f79
-acos_poly_p19                   = f80
-
-acos_poly_p4                    = f81
-acos_poly_p15                   = f82
-acos_poly_p6                    = f83
-acos_poly_p17                   = f84
-acos_poly_p0                    = f85
-
-acos_poly_p11                   = f86
-acos_poly_p2                    = f87
-acos_poly_p13                   = f88
-acos_series_t                   = f89
-acos_1by2                       = f90
-
-acos_3by2                       = f91
-acos_5by2                       = f92
-acos_11by4                      = f93
-acos_35by8                      = f94
-acos_63by8                      = f95
-
-acos_231by16                    = f96 
-acos_y0                         = f97 
-acos_H0                         = f98 
-acos_S0                         = f99 
-acos_d                          = f100
-
-acos_l1                         = f101
-acos_d2                         = f102
-acos_T0                         = f103
-acos_d1                         = f104
-acos_e0                         = f105
-
-acos_l2                         = f106
-acos_d3                         = f107
-acos_T3                         = f108
-acos_S1                         = f109
-acos_e1                         = f110
-
-acos_z                          = f111
-answer2                         = f112
-acos_sgn_x                      = f113
-acos_429by16                    = f114
-acos_18by4                      = f115
-
-acos_3by4                       = f116
-acos_l3                         = f117
-acos_T6                         = f118
-acos_const_add                  = f119
+// integer registers used
+// scratch
+rTblAddr                      = r3
+
+rPiBy2Ptr                     = r21
+rTmpPtr3                      = r22
+rDenoBound                    = r23
+rOne                          = r24
+rAbsXBits                     = r25
+rHalf                         = r26
+r0625                         = r27
+rSign                         = r28
+rXBits                        = r29
+rTmpPtr2                      = r30
+rTmpPtr1                      = r31
+
+// stacked
+GR_SAVE_PFS                   = r32
+GR_SAVE_B0                    = r33
+GR_SAVE_GP                    = r34
+GR_Parameter_X                = r35
+GR_Parameter_Y                = r36
+GR_Parameter_RESULT           = r37
+GR_Parameter_TAG              = r38
+
+// floating point registers used
+FR_X                          = f10
+FR_Y                          = f1
+FR_RESULT                     = f8
+
+
+// scratch
+fXSqr                         = f6
+fXCube                        = f7
+fXQuadr                       = f9
+f1pX                          = f10
+f1mX                          = f11
+f1pXRcp                       = f12
+f1mXRcp                       = f13
+fH                            = f14
+fS                            = f15
+// stacked
+fA3                           = f32
+fB1                           = f32
+fA5                           = f33
+fB2                           = f33
+fA7                           = f34
+fPiBy2                        = f34
+fA9                           = f35
+fA11                          = f36
+fB10                          = f35
+fB11                          = f36
+fA13                          = f37
+fA15                          = f38
+fB4                           = f37
+fB5                           = f38
+fA17                          = f39
+fA19                          = f40
+fB6                           = f39
+fB7                           = f40
+fA21                          = f41
+fA23                          = f42
+fB3                           = f41
+fB8                           = f42
+fA25                          = f43
+fA27                          = f44
+fB9                           = f43
+fB12                          = f44
+fA29                          = f45
+fA31                          = f46
+fA33                          = f47
+fA35                          = f48
+fBaseP                        = f49
+fB0                           = f50
+fSignedS                      = f51
+fD                            = f52
+fHalf                         = f53
+fR                            = f54
+fCloseTo1Pol                  = f55
+fSignX                        = f56
+fDenoBound                    = f57
+fNormX                        = f58
+fX8                           = f59
+fRSqr                         = f60
+fRQuadr                       = f61
+fR8                           = f62
+fX16                          = f63
+fCpi                          = f64
 
 // Data tables
 //==============================================================
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+RODATA
 .align 16
-
-acos_coeff_1_table:
-ASM_TYPE_DIRECTIVE(acos_coeff_1_table,@object)
-data8 0xE4E7E0A423A21249  , 0x00003FF8 //P7
-data8 0xC2F7EE0200FCE2A5  , 0x0000C003 //P18
-data8 0xB745D7F6C65C20E0  , 0x00003FF9 //P5
-data8 0xF75E381A323D4D94  , 0x0000C002 //P16
-data8 0x8959C2629C1024C0  , 0x0000C002 //P20
-data8 0xAFF68E7D241292C5  , 0x00003FF8 //P9
-data8 0xB6DB6DB7260AC30D  , 0x00003FFA //P3
-data8 0xD0417CE2B41CB7BF  , 0x0000C000 //P14
-data8 0x81D570FEA724E3E4  , 0x0000BFFD //P12
-data8 0xAAAAAAAAAAAAC277  , 0x00003FFC //P1
-data8 0xF534912FF3E7B76F  , 0x00003FFF //P21
-data8 0xc90fdaa22168c235  , 0x00003fff // pi/2
-data8 0x0000000000000000  , 0x00000000 // pad to avoid bank conflicts
-ASM_SIZE_DIRECTIVE(acos_coeff_1_table)
-
-
-acos_coeff_2_table:
-ASM_TYPE_DIRECTIVE(acos_coeff_2_table,@object)
-data8 0x8E26AF5F29B39A2A  , 0x00003FF9 //P6
-data8 0xB4F118A4B1015470  , 0x00004003 //P17
-data8 0xF8E38E10C25990E0  , 0x00003FF9 //P4
-data8 0x80F50489AEF1CAC6  , 0x00004002 //P15
-data8 0x92728015172CFE1C  , 0x00004003 //P19
-data8 0xBBC3D831D4595971  , 0x00003FF8 //P8
-data8 0x999999999952A5C3  , 0x00003FFB //P2
-data8 0x855576BE6F0975EC  , 0x00003FFF //P13
-data8 0xF12420E778077D89  , 0x00003FFA //P11
-data8 0xB6590FF4D23DE003  , 0x00003FF3 //P10
-data8 0xb504f333f9de6484  , 0x00003ffe // sqrt(2)/2
-ASM_SIZE_DIRECTIVE(acos_coeff_2_table)
-
-
-.align 32
-.global acos
-ASM_TYPE_DIRECTIVE(acos,@function)
+LOCAL_OBJECT_START(acos_base_range_table)
+// Ai: Polynomial coefficients for the acos(x), |x| < .625000
+// Bi: Polynomial coefficients for the acos(x), |x| > .625000
+data8 0xBFDAAB56C01AE468 //A29
+data8 0x3FE1C470B76A5B2B //A31
+data8 0xBFDC5FF82A0C4205 //A33
+data8 0x3FC71FD88BFE93F0 //A35
+data8 0xB504F333F9DE6487, 0x00003FFF //B0
+data8 0xAAAAAAAAAAAAFC18, 0x00003FFC //A3
+data8 0x3F9F1C71BC4A7823 //A9
+data8 0x3F96E8BBAAB216B2 //A11
+data8 0x3F91C4CA1F9F8A98 //A13
+data8 0x3F8C9DDCEDEBE7A6 //A15
+data8 0x3F877784442B1516 //A17
+data8 0x3F859C0491802BA2 //A19
+data8 0x9999999998C88B8F, 0x00003FFB //A5
+data8 0x3F6BD7A9A660BF5E //A21
+data8 0x3F9FC1659340419D //A23
+data8 0xB6DB6DB798149BDF, 0x00003FFA //A7
+data8 0xBFB3EF18964D3ED3 //A25
+data8 0x3FCD285315542CF2 //A27
+data8 0xF15BEEEFF7D2966A, 0x00003FFB //B1
+data8 0x3EF0DDA376D10FB3 //B10
+data8 0xBEB83CAFE05EBAC9 //B11
+data8 0x3F65FFB67B513644 //B4
+data8 0x3F5032FBB86A4501 //B5
+data8 0x3F392162276C7CBA //B6
+data8 0x3F2435949FD98BDF //B7
+data8 0xD93923D7FA08341C, 0x00003FF9 //B2
+data8 0x3F802995B6D90BDB //B3
+data8 0x3F10DF86B341A63F //B8
+data8 0xC90FDAA22168C235, 0x00003FFF // Pi/2
+data8 0x3EFA3EBD6B0ECB9D //B9
+data8 0x3EDE18BA080E9098 //B12
+LOCAL_OBJECT_END(acos_base_range_table)
 
 .section .text
-.proc  acos
-.align 32
-
-
-acos:
- 
-{     .mfi 
-     alloc      r32               = ar.pfs,1,6,4,0
-     fma.s1    acos_tx        =    f8,f8,f0
-     addl      ASIN_Addr2     =    @ltoff(acos_coeff_2_table),gp
-} 
-{     .mfi 
-     mov       ASIN_FFFE      =    0xFFFE
-     fnma.s1   acos_t         =    f8,f8,f1
-     addl      ASIN_Addr1     =    @ltoff(acos_coeff_1_table),gp
+GLOBAL_LIBM_ENTRY(acos)
+acos_unnormal_back:
+{ .mfi
+      getf.d             rXBits = f8 // grab bits of input value
+      // set p12 = 1 if x is a NaN, denormal, or zero
+      fclass.m           p12, p0 = f8, 0xcf
+      adds               rSign = 1, r0
+}
+{ .mfi
+      addl               rTblAddr = @ltoff(acos_base_range_table),gp
+      // 1 - x = 1 - |x| for positive x
+      fms.s1             f1mX = f1, f1, f8
+      addl               rHalf = 0xFFFE, r0 // exponent of 1/2
 }
 ;;
-
- 
-{     .mfi 
-     setf.exp       acos_1by2      =    ASIN_FFFE
-     fmerge.s       acos_abs_x     =    f1,f8
-     nop.i          999              ;;
-} 
- 
-
-{     .mmf 
-     ld8       ASIN_Addr1     =    [ASIN_Addr1]
-     ld8       ASIN_Addr2     =    [ASIN_Addr2]
-     fmerge.s  acos_sgn_x     =    f8,f1
-} 
-;;
-
-
-{     .mfi 
-     nop.m                      999
-     fcmp.lt.s1  p11,p12  = f8, f0
-     nop.i          999              ;;
-} 
- 
- 
-{     .mfi 
-     ldfe      acos_coeff_P7  =    [ASIN_Addr1],16
-     fma.s1    acos_tx2       =    acos_tx,acos_tx,f0
-     nop.i                      999
-} 
-{     .mfi 
-     ldfe      acos_coeff_P6  =    [ASIN_Addr2],16
-     fma.s1    acos_t2        =    acos_t,acos_t,f0
-     nop.i                      999;;
+{ .mfi
+      addl               r0625 = 0x3FE4, r0 // high 16 bits of 0.625
+      // set p8 = 1 if x < 0
+      fcmp.lt.s1         p8, p9 = f8, f0
+      shl                rSign = rSign, 63 // sign bit
+}
+{ .mfi
+      // point to the beginning of the table
+      ld8                rTblAddr = [rTblAddr]
+      // 1 + x = 1 - |x| for negative x
+      fma.s1             f1pX = f1, f1, f8
+      adds               rOne = 0x3FF, r0
 }
-
- 
-{     .mmf 
-     ldfe      acos_coeff_P18 =    [ASIN_Addr1],16
-     ldfe      acos_coeff_P17 =    [ASIN_Addr2],16
-     fclass.m.unc p8,p0  = f8, 0xc3	//@qnan |@snan
-} 
 ;;
-
- 
-{     .mmf 
-     ldfe      acos_coeff_P5  =    [ASIN_Addr1],16
-     ldfe      acos_coeff_P4  =    [ASIN_Addr2],16
-     frsqrta.s1     acos_y0,p0     =    acos_t
-} 
+{ .mfi
+      andcm              rAbsXBits = rXBits, rSign // bits of |x|
+      fmerge.s           fSignX = f8, f1 // signum(x)
+      shl                r0625 = r0625, 48 // bits of DP representation of 0.625
+}
+{ .mfb
+      setf.exp           fHalf = rHalf // load A2 to FP reg
+      fma.s1             fXSqr = f8, f8, f0 // x^2
+      // branch on special path if x is a NaN, denormal, or zero
+(p12) br.cond.spnt       acos_special
+}
 ;;
-
- 
-{     .mfi 
-     ldfe      acos_coeff_P16 =    [ASIN_Addr1],16
-     fcmp.gt.s1 p9,p0 = acos_abs_x,f1
-     nop.i                      999
-} 
-{     .mfb 
-     ldfe      acos_coeff_P15 =    [ASIN_Addr2],16
-(p8) fma.d     f8 = f8,f1,f0
-(p8) br.ret.spnt b0
+{ .mfi
+      adds               rPiBy2Ptr = 272, rTblAddr
+      nop.f              0
+      shl                rOne = rOne, 52 // bits of 1.0
+}
+{ .mfi
+      adds               rTmpPtr1 = 16, rTblAddr
+      nop.f              0
+      // set p6 = 1 if |x| < 0.625
+      cmp.lt             p6, p7 = rAbsXBits, r0625
 }
 ;;
-
- 
-{     .mmf 
-     ldfe      acos_coeff_P20 =    [ASIN_Addr1],16
-     ldfe      acos_coeff_P19 =    [ASIN_Addr2],16
-     fclass.m.unc p10,p0 = f8, 0x07	//@zero
-} 
+{ .mfi
+      ldfpd              fA29, fA31 = [rTblAddr] // A29, fA31
+      // 1 - x = 1 - |x| for positive x
+(p9)  fms.s1             fR = f1, f1, f8
+      // point to coefficient of "near 1" polynomial
+(p7)  adds               rTmpPtr2 = 176, rTblAddr
+}
+{ .mfi
+      ldfpd              fA33, fA35 = [rTmpPtr1], 16 // A33, fA35
+      // 1 + x = 1 - |x| for negative x
+(p8)  fma.s1             fR = f1, f1, f8
+(p6)  adds               rTmpPtr2 = 48, rTblAddr
+}
 ;;
-
- 
-{     .mfi 
-     ldfe      acos_coeff_P9  =    [ASIN_Addr1],16
-     fma.s1    acos_t4        =    acos_t2,acos_t2,f0
-(p9) mov GR_Parameter_Tag = 58 
-} 
-{     .mfi 
-     ldfe      acos_coeff_P8  =    [ASIN_Addr2],16
-     fma.s1    acos_3by2      =    acos_1by2,f1,f1
-     nop.i                      999;;
+{ .mfi
+      ldfe               fB0 = [rTmpPtr1], 16 // B0
+      nop.f              0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     ldfe      acos_coeff_P2  =    [ASIN_Addr2],16
-     fma.s1    acos_tx4       =    acos_tx2,acos_tx2,f0
-     nop.i 999
-} 
-{     .mfb 
-     ldfe      acos_coeff_P3  =    [ASIN_Addr1],16
-     fma.s1    acos_t3        =    acos_t,acos_t2,f0
-(p9) br.cond.spnt  __libm_error_region
+{ .mib
+      adds               rTmpPtr3 = 16, rTmpPtr2
+      // set p10 = 1 if |x| = 1.0
+      cmp.eq             p10, p0 = rAbsXBits, rOne
+      // branch on special path for |x| = 1.0
+(p10) br.cond.spnt       acos_abs_1
 }
 ;;
-
- 
-{     .mfi 
-     ldfe      acos_coeff_P13 =    [ASIN_Addr2],16
-     fma.s1    acos_H0        =    acos_y0,acos_1by2,f0
-     nop.i                      999
-} 
-{     .mfi 
-     ldfe      acos_coeff_P14 =    [ASIN_Addr1],16
-     fma.s1    acos_S0        =    acos_y0,acos_t,f0
-     nop.i                      999;;
+{ .mfi
+      ldfe               fA3 = [rTmpPtr2], 48 // A3 or B1
+      nop.f              0
+      adds               rTmpPtr1 = 64, rTmpPtr3
 }
-
- 
-{     .mfi 
-     ldfe      acos_coeff_P11 =    [ASIN_Addr2],16
-     fcmp.eq.s1  p6,p0  = acos_abs_x, f1
-     nop.i                      999
-} 
-{     .mfi 
-     ldfe      acos_coeff_P12 =    [ASIN_Addr1],16
-     fma.s1    acos_tx3       =    acos_tx,acos_tx2,f0
-     nop.i 999
+{ .mib
+      ldfpd              fA9, fA11 = [rTmpPtr3], 16 // A9, A11 or B10, B11
+      // set p11 = 1 if |x| > 1.0
+      cmp.gt             p11, p0 = rAbsXBits, rOne
+      // branch on special path for |x| > 1.0
+(p11) br.cond.spnt       acos_abs_gt_1
 }
 ;;
-
- 
-{     .mfi 
-     ldfe      acos_coeff_P10 =    [ASIN_Addr2],16
-     fma.s1    acos_1poly_p6  =    acos_tx,acos_coeff_P7,acos_coeff_P6
-     nop.i                      999
-} 
-{     .mfi 
-     ldfe      acos_coeff_P1  =    [ASIN_Addr1],16
-     fma.s1    acos_poly_p6   =    acos_t,acos_coeff_P7,acos_coeff_P6
-     nop.i                      999;;
+{ .mfi
+      ldfpd              fA17, fA19 = [rTmpPtr2], 16 // A17, A19 or B6, B7
+      // initial approximation of 1 / sqrt(1 - x)
+      frsqrta.s1         f1mXRcp, p0 = f1mX
+      nop.i              0
 }
-
- 
-{     .mfi 
-     ldfe      acos_const_sqrt2by2 =    [ASIN_Addr2],16
-     fma.s1    acos_5by2           =    acos_3by2,f1,f1
-     nop.i                           999
-} 
-{     .mfi 
-     ldfe      acos_coeff_P21 =    [ASIN_Addr1],16
-     fma.s1    acos_11by4     =    acos_3by2,acos_3by2,acos_1by2
-     nop.i                      999;;
+{ .mfi
+      ldfpd              fA13, fA15 = [rTmpPtr3] // A13, A15 or B4, B5
+      fma.s1             fXCube = fXSqr, f8, f0 // x^3
+      nop.i              0
 }
-
- 
-{     .mfi 
-     ldfe      acos_const_piby2    =    [ASIN_Addr1],16
-     fma.s1    acos_poly_p17       =    acos_t,acos_coeff_P18,acos_coeff_P17
-     nop.i                      999
-} 
-{     .mfb 
-     nop.m                 999
-     fma.s1    acos_3by4 =    acos_3by2,acos_1by2,f0
-(p10) br.cond.spnt  L(ACOS_ZERO)    // Branch to short path if x=0
+;;
+{ .mfi
+      ldfe               fA5 = [rTmpPtr2], 48 // A5 or B2
+      // initial approximation of 1 / sqrt(1 + x)
+      frsqrta.s1         f1pXRcp, p0 = f1pX
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA21, fA23 = [rTmpPtr1], 16 // A21, A23 or B3, B8
+      fma.s1             fXQuadr = fXSqr, fXSqr, f0 // x^4
+      nop.i              0
 }
 ;;
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p15  =    acos_t,acos_coeff_P16,acos_coeff_P15
-     nop.i                      999
-} 
-{     .mfb 
-     nop.m                 999
-     fnma.s1   acos_d    =    acos_S0,acos_H0,acos_1by2
-(p6) br.cond.spnt  L(ACOS_ABS_ONE)    // Branch to short path if |x|=1
+{ .mfi
+      ldfe               fA7 = [rTmpPtr1] // A7 or Pi/2
+      fma.s1             fRSqr = fR, fR, f0 // R^2
+      nop.i              0
+}
+{ .mfb
+      ldfpd              fA25, fA27 = [rTmpPtr2] // A25, A27 or B9, B12
+      nop.f              0
+(p6)  br.cond.spnt       acos_base_range;
 }
 ;;
 
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p19  =    acos_t,acos_coeff_P20,acos_coeff_P19
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p4   =    acos_t,acos_coeff_P5,acos_coeff_P4
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+(p9)  fma.s1             fH = fHalf, f1mXRcp, f0 // H0 for x > 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p17 =    acos_tx,acos_coeff_P18,acos_coeff_P17
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p8   =    acos_t,acos_coeff_P9,acos_coeff_P8
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+(p9)  fma.s1             fS = f1mX, f1mXRcp, f0  // S0 for x > 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fms.s1    acos_35by8     =    acos_5by2,acos_11by4,acos_5by2
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_63by8     =    acos_5by2,acos_11by4,f1
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+(p8)  fma.s1             fH = fHalf, f1pXRcp, f0 // H0 for x < 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p13  =    acos_t,acos_coeff_P14,acos_coeff_P13
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_18by4     =    acos_3by2,acos_5by2,acos_3by4
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+(p8)  fma.s1             fS = f1pX, f1pXRcp, f0  // S0 for x > 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_l1   =    acos_5by2,acos_d,acos_3by2
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_d2   =    acos_d,acos_d,f0
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRQuadr = fRSqr, fRSqr, f0 // R^4
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p15  =    acos_t2,acos_poly_p17,acos_poly_p15
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_T0   =    acos_d,acos_S0,f0
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB11 = fB11, fR, fB10
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p19  =    acos_t2,acos_coeff_P21,acos_poly_p19
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p4   =    acos_t2,acos_poly_p6,acos_poly_p4
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB1 = fB1, fR, fB0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_d1   =    acos_35by8,acos_d,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_231by16   =    acos_3by2,acos_35by8,acos_63by8
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB5 = fB5, fR, fB4
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p2   =    acos_t,acos_coeff_P3,acos_coeff_P2
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p8   =    acos_t2,acos_coeff_P10,acos_poly_p8
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB7 = fB7, fR, fB6
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p11  =    acos_t,acos_coeff_P12,acos_coeff_P11
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_e0   =    acos_d2,acos_l1,acos_d
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB3 = fB3, fR, fB2
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p15 =    acos_tx,acos_coeff_P16,acos_coeff_P15
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p0   =    acos_t,acos_coeff_P1,f1
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fnma.s1            fD = fH, fS, fHalf // d0 = 1/2 - H0*S0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p19 =    acos_tx,acos_coeff_P20,acos_coeff_P19
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p4  =    acos_tx,acos_coeff_P5,acos_coeff_P4
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fR8 = fRQuadr, fRQuadr, f0 // R^4
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p8  =    acos_tx,acos_coeff_P9,acos_coeff_P8
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_l2   =    acos_231by16,acos_d,acos_63by8
-     nop.i                 999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB9 = fB9, fR, fB8
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_d3   =    acos_d2,acos_d,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_T3   =    acos_d2,acos_T0,f0
-     nop.i                 999;;
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fB12 = fB12, fRSqr, fB11
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_429by16   =    acos_18by4,acos_11by4,acos_231by16
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_S1   =    acos_e0,acos_S0,acos_S0
-     nop.i                 999;;
+{.mfi
+      nop.m              0
+      fma.s1             fB7 = fB7, fRSqr, fB5
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p4   =    acos_t4,acos_poly_p8,acos_poly_p4
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p15  =    acos_t4,acos_poly_p19,acos_poly_p15
-     nop.i                      999;;
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fB3 = fB3, fRSqr, fB1
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p0   =    acos_t2,acos_poly_p2,acos_poly_p0
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p11  =    acos_t2,acos_poly_p13,acos_poly_p11
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fH = fH, fD, fH // H1 = H0 + H0*d0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_t8   =    acos_t4,acos_t4,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_e1   =    acos_d2,acos_l2,acos_d1
-     nop.i                 999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fS = fS, fD, fS // S1 = S0 + S0*d0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p4  =    acos_tx2,acos_1poly_p6,acos_1poly_p4
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p15 =    acos_tx2,acos_1poly_p17,acos_1poly_p15
-     nop.i                      999;;
+;;
+{.mfi
+      nop.m              0
+(p9)  fma.s1             fCpi = f1, f0, f0 // Cpi = 0 if x > 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p8  =    acos_tx2,acos_coeff_P10,acos_1poly_p8
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p19 =    acos_tx2,acos_coeff_P21,acos_1poly_p19
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+(p8)  fma.s1             fCpi = fPiBy2, f1, fPiBy2 // Cpi = Pi if x < 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p2  =    acos_tx,acos_coeff_P3,acos_coeff_P2
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p13 =    acos_tx,acos_coeff_P14,acos_coeff_P13
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB12 = fB12, fRSqr, fB9
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p0  =    acos_tx,acos_coeff_P1,f1
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p11 =    acos_tx,acos_coeff_P12,acos_coeff_P11
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB7 = fB7, fRQuadr, fB3
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_l3   =    acos_429by16,acos_d,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_z    =    acos_e1,acos_T3,acos_S1
-     nop.i                 999;;
+;;
+{.mfi
+      nop.m              0
+      fnma.s1            fD = fH, fS, fHalf // d1 = 1/2 - H1*S1
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p11  =    acos_t4,acos_poly_p15,acos_poly_p11
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_T6   =    acos_T3,acos_d3,f0
-     nop.i                 999;;
+{ .mfi
+      nop.m              0
+      fnma.s1            fSignedS = fSignX, fS, f0 // -signum(x)*S1
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_t11  =    acos_t8,acos_t3,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_poly_p0   =    acos_t4,acos_poly_p4,acos_poly_p0
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fCloseTo1Pol = fB12, fR8, fB7
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p4  =    acos_tx4,acos_1poly_p8,acos_1poly_p4
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p15 =    acos_tx4,acos_1poly_p19,acos_1poly_p15
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fH = fH, fD, fH // H2 = H1 + H1*d1
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p0  =    acos_tx2,acos_1poly_p2,acos_1poly_p0
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p11 =    acos_tx2,acos_1poly_p13,acos_1poly_p11
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fS = fS, fD, fS // S2 = S1 + S1*d1
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                                                         999
-//     fcmp.le.s1     acos_pred_LEsqrt2by2,acos_pred_GTsqrt2by2    =    acos_abs_x,acos_const_sqrt2by2
-     fcmp.le.s1     p7,p8    =    acos_abs_x,acos_const_sqrt2by2
-     nop.i                                                         999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_tx8  =    acos_tx4,acos_tx4,f0
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      // -signum(x)* S2 = -signum(x)*(S1 + S1*d1)
+      fma.s1             fSignedS = fSignedS, fD, fSignedS
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_z    =    acos_l3,acos_T6,acos_z
-     nop.i                 999;;
-} 
- 
-{     .mfi
-     nop.m                      999
-     fma.s1    acos_series_t  =    acos_t11,acos_poly_p11,acos_poly_p0
-     nop.i                      999
-}
-{    .mfi
-     nop.m 999
-(p11) fma.s1 acos_const_add = acos_const_piby2, f1, acos_const_piby2
-     nop.i 999
+;;
+{.mfi
+      nop.m              0
+      fnma.s1            fD = fH, fS, fHalf // d2 = 1/2 - H2*S2
+      nop.i              0
 }
 ;;
-
 { .mfi
-      nop.m 999
-(p12) fma.s1 acos_const_add = f1,f0,f0
-      nop.i 999
+      nop.m              0
+      // Cpi + signum(x)*PolB*S2
+      fnma.s1            fCpi = fSignedS, fCloseTo1Pol, fCpi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // signum(x)*PolB * S2
+      fnma.s1            fCloseTo1Pol = fSignedS, fCloseTo1Pol, f0
+      nop.i              0
 }
 ;;
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p0  =    acos_tx4,acos_1poly_p4,acos_1poly_p0
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_1poly_p11 =    acos_tx4,acos_1poly_p15,acos_1poly_p11
-     nop.i                      999;;
+{ .mfb
+      nop.m              0
+      // final result for 0.625 <= |x| < 1
+      fma.d.s0           f8 = fCloseTo1Pol, fD, fCpi
+      // exit here for  0.625 <= |x| < 1
+      br.ret.sptk        b0
 }
+;;
 
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    acos_tx11 =    acos_tx8,acos_tx3,f0
-     nop.i                 999;;
-} 
- 
-{     .mfi 
-                         nop.m                 999
-//(acos_pred_GTsqrt2by2)   fnma.s1      answer2   =    acos_z,acos_series_t,acos_const_piby2
-(p8)   fnma.s1      answer2   =    acos_z,acos_series_t,f0
-                         nop.i                 999;;
-} 
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    acos_series_tx =    acos_tx11,acos_1poly_p11,acos_1poly_p0
-     nop.i                      999;;
-} 
- 
-{     .mfi 
-                         nop.m                 999
-//(acos_pred_GTsqrt2by2)   fnma.d     f8   =    acos_sgn_x,answer2,acos_const_piby2
-(p8)   fnma.d     f8   =    acos_sgn_x,answer2,acos_const_add
-                         nop.i                 999;;
-} 
- 
-{     .mfb 
-                         nop.m                 999
-//(acos_pred_LEsqrt2by2)   fnma.d     f8   =    f8,acos_series_tx,acos_const_piby2
-(p7)   fnma.d     f8   =    f8,acos_series_tx,acos_const_piby2
-     br.ret.sptk b0 ;;
-} 
 
+// here if |x| < 0.625
+.align 32
+acos_base_range:
+{ .mfi
+      ldfe               fCpi = [rPiBy2Ptr] // Pi/2
+      fma.s1             fA33 = fA33, fXSqr, fA31
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, fXSqr, fA13
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA29 = fA29, fXSqr, fA27
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fXSqr, fA23
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA21 = fA21, fXSqr, fA19
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, fXSqr, fA7
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA5 = fA5, fXSqr, fA3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA35 = fA35, fXQuadr, fA33
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, fXQuadr, fA15
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fX8 = fXQuadr, fXQuadr, f0 // x^8
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fXQuadr, fA21
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, fXQuadr, fA5
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fCpi = fCpi, f1, f8 // Pi/2 - x
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA35 = fA35, fXQuadr, fA29
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, fXSqr, fA11
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fX16 = fX8, fX8, f0 // x^16
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA35 = fA35, fX8, fA25
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, fX8, fA9
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fBaseP = fA35, fX16, fA17
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for |x| < 0.625
+      fnma.d.s0           f8 = fBaseP, fXCube, fCpi
+      // exit here for |x| < 0.625 path
+      br.ret.sptk        b0
+}
+;;
 
-L(ACOS_ZERO):
-// Here if x=0
-{     .mfb 
-      nop.m                 999
-      fma.d    f8 =    acos_const_piby2,f1,f0
-      br.ret.sptk b0 ;;
-} 
+// here if |x| = 1
+// acos(1) = 0
+// acos(-1) = Pi
+.align 32
+acos_abs_1:
+{ .mfi
+      ldfe               fPiBy2 = [rPiBy2Ptr] // Pi/2
+      nop.f              0
+      nop.i              0
+}
+;;
+.pred.rel "mutex", p8, p9
+{ .mfi
+      nop.m              0
+      // result for x = 1.0
+(p9)  fma.d.s0           f8 = f1, f0, f0 // 0.0
+      nop.i              0
+}
+{.mfb
+      nop.m              0
+      // result for x = -1.0
+(p8)  fma.d.s0           f8 = fPiBy2, f1, fPiBy2 // Pi
+      // exit here for |x| = 1.0
+      br.ret.sptk        b0
+}
+;;
 
+// here if x is a NaN, denormal, or zero
+.align 32
+acos_special:
+{ .mfi
+      // point to Pi/2
+      adds               rPiBy2Ptr = 272, rTblAddr
+      // set p12 = 1 if x is a NaN
+      fclass.m           p12, p0 = f8, 0xc3
+      nop.i              0
+}
+{ .mlx
+      nop.m              0
+      // smallest positive DP normalized number
+      movl               rDenoBound = 0x0010000000000000
+}
+;;
+{ .mfi
+      ldfe               fPiBy2 = [rPiBy2Ptr] // Pi/2
+      // set p13 = 1 if x = 0.0
+      fclass.m           p13, p0 = f8, 0x07
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnorm.s1           fNormX = f8
+      nop.i              0
+}
+;;
+{ .mfb
+      // load smallest normal to FP reg
+      setf.d             fDenoBound = rDenoBound
+      // answer if x is a NaN
+(p12) fma.d.s0           f8 = f8,f1,f0
+      // exit here if x is a NaN
+(p12) br.ret.spnt        b0
+}
+;;
+{ .mfi
+      nop.m              0
+      // absolute value of normalized x
+      fmerge.s           fNormX = f1, fNormX
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for x = 0
+(p13) fma.d.s0           f8 = fPiBy2, f1, f8
+      // exit here if x = 0.0
+(p13) br.ret.spnt        b0
+}
+;;
+// if we still here then x is denormal or unnormal
+{ .mfi
+      nop.m              0
+      // set p14 = 1 if normalized x is greater than or
+      // equal to the smallest denormalized value
+      // So, if p14 is set to 1 it means that we deal with
+      // unnormal rather than with "true" denormal
+      fcmp.ge.s1         p14, p0 = fNormX, fDenoBound
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+(p14) fcmp.eq.s0         p6, p0 = f8, f0      // Set D flag if x unnormal
+      nop.i              0
+}
+{ .mfb
+      nop.m              0
+      // normalize unnormal input
+(p14) fnorm.s1           f8 = f8
+      // return to the main path
+(p14) br.cond.sptk       acos_unnormal_back
+}
+;;
+// if we still here it means that input is "true" denormal
+{ .mfb
+      nop.m              0
+      // final result if x is denormal
+      fms.d.s0           f8 = fPiBy2, f1, f8 // Pi/2 - x
+      // exit here if x is denormal
+      br.ret.sptk        b0
+}
+;;
 
-L(ACOS_ABS_ONE):
-.pred.rel "mutex",p11,p12
-// Here if |x|=1
-{     .mfi 
-      nop.m                 999
-(p11) fma.d    f8 =    acos_const_piby2,f1,acos_const_piby2 // acos(-1)=pi
-      nop.i                 999
-} 
-{     .mfb 
-      nop.m                 999
-(p12) fma.d    f8 =    f1,f0,f0 // acos(1)=0
-      br.ret.sptk b0 ;;
-} 
+// here if |x| > 1.0
+// error handler should be called
+.align 32
+acos_abs_gt_1:
+{ .mfi
+      alloc              r32 = ar.pfs, 0, 3, 4, 0 // get some registers
+      fmerge.s           FR_X = f8,f8
+      nop.i              0
+}
+{ .mfb
+      mov                GR_Parameter_TAG = 58 // error code
+      frcpa.s0           FR_RESULT, p0 = f0,f0
+      // call error handler routine
+      br.cond.sptk       __libm_error_region
+}
+;;
+GLOBAL_LIBM_END(acos)
 
 
-.endp acos
-ASM_SIZE_DIRECTIVE(acos)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-                nop.f 999
+        nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
         mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
@@ -879,28 +840,29 @@ __libm_error_region:
         mov GR_SAVE_GP=gp                       // Save gp
 };;
 { .mmi
-        stfs [GR_Parameter_Y] = f1,16         // Store Parameter 2 on stack
+        stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
         add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
         mov GR_SAVE_B0=b0                       // Save b0
 };;
-
 .body
-        frcpa.s0 f9,p0 = f0,f0
-;;
-
 { .mib
-        stfd [GR_Parameter_X] = f8            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfd [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = f9,-16           // Store Parameter 3 on stack
-        adds r32 = 48,sp
-        br.call.sptk b0=__libm_error_support#   // Call error handling function
+        stfd [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#         // Call error handling function
 };;
 { .mmi
-        ldfd  f8 = [r32]       // Get return result off stack
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
+};;
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
@@ -909,11 +871,8 @@ __libm_error_region:
         mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
-
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.type   __libm_error_support,@function
-.global __libm_error_support
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_acosf.S b/sysdeps/ia64/fpu/e_acosf.S
index a3425414cf..68b0b2ee8d 100644
--- a/sysdeps/ia64/fpu/e_acosf.S
+++ b/sysdeps/ia64/fpu/e_acosf.S
@@ -1,10 +1,10 @@
 .file "acosf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,19 +35,23 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 
 // History
 //==============================================================
-// 2/02/00  Initial revision
-// 6/28/00  Improved speed
-// 6/31/00  Changed register allocation because of some duplicate macros
+// 02/02/00 Initial version
+// 06/28/00 Improved speed
+// 06/31/00 Changed register allocation because of some duplicate macros
 //          moved nan exit bundle up to gain a cycle.
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 8/17/00  Changed predicate register macro-usage to direct predicate
+// 08/17/00 Changed predicate register macro-usage to direct predicate
 //          names due to an assembler bug.
 // 10/17/00 Improved speed of x=0 and x=1 paths, set D flag if x denormal.
+// 03/13/01 Corrected sign of imm1 value in dep instruction.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 04/17/03 Moved mutex after label
 
 
 // Description
@@ -115,7 +119,6 @@
 //  answer2 = sign(x) z P(t)       if x>0
 //          = sign(x) z P(t) + pi  if x<0
 
-#include "libm_support.h"
 
 //
 // Assembly macros
@@ -222,42 +225,30 @@ acosf_poly_p1a                   = f90
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-acosf_coeff_1_table:
-ASM_TYPE_DIRECTIVE(acosf_coeff_1_table,@object)
+LOCAL_OBJECT_START(acosf_coeff_1_table)
 data8 0x3FC5555607DCF816 // P1
 data8 0x3F9CF81AD9BAB2C6 // P4
 data8 0x3FC59E0975074DF3 // P7
 data8 0xBFA6F4CC2780AA1D // P6
 data8 0x3FC2DD45292E93CB // P9
 data8 0x3fe6a09e667f3bcd // sqrt(2)/2
-ASM_SIZE_DIRECTIVE(acosf_coeff_1_table)
+LOCAL_OBJECT_END(acosf_coeff_1_table)
 
-acosf_coeff_2_table:
-ASM_TYPE_DIRECTIVE(acosf_coeff_2_table,@object)
+LOCAL_OBJECT_START(acosf_coeff_2_table)
 data8 0x3FA6F108E31EFBA6 // P3
 data8 0xBFCA31BF175D82A0 // P8
 data8 0x3FA30C0337F6418B // P5
 data8 0x3FB332C9266CB1F9 // P2
 data8 0x3ff921fb54442d18 // pi_by_2
-ASM_SIZE_DIRECTIVE(acosf_coeff_2_table)
+LOCAL_OBJECT_END(acosf_coeff_2_table)
 
-.align 32
-.global acosf
-ASM_TYPE_DIRECTIVE(acosf,@function)
 
 .section .text
-.proc  acosf
-.align 32
-
-acosf:
+GLOBAL_LIBM_ENTRY(acosf)
  
 // Load the addresses of the two tables.
 // Then, load the coefficients and other constants.
@@ -342,7 +333,7 @@ acosf:
 } 
 {     .mfb 
      nop.m                                               999
-(p8) fma.s f8                = f8,f1,f0
+(p8) fma.s.s0 f8                = f8,f1,f0
 (p8) br.ret.spnt   b0 ;;  // Exit if x=nan
 }
 
@@ -350,7 +341,7 @@ acosf:
 {     .mfb 
      nop.m                 999
      fcmp.eq.s1 p6,p0 = acosf_abs_x,f1
-(p10) br.cond.spnt  L(ACOSF_ZERO) ;;     // Branch if x=0
+(p10) br.cond.spnt  ACOSF_ZERO ;;     // Branch if x=0
 } 
  
 {     .mfi 
@@ -367,7 +358,7 @@ acosf:
 {     .mfb 
      nop.m                      999
      fma.s1    acosf_t4  =    acosf_t2,acosf_t2,f0
-(p6) br.cond.spnt  L(ACOSF_ABS_ONE) ;;     // Branch if |x|=1
+(p6) br.cond.spnt  ACOSF_ABS_ONE ;;     // Branch if |x|=1
 } 
 
 {     .mfi 
@@ -575,41 +566,40 @@ acosf:
 .pred.rel "mutex",p8,p7    //acosf_pred_GTsqrt2by2,acosf_pred_LEsqrt2by2
 {     .mfi 
       nop.m            999
-(p8)  fma.s     f8   =    acosf_z,acosf_Pt,acosf_sgn_x_piby2
+(p8)  fma.s.s0     f8   =    acosf_z,acosf_Pt,acosf_sgn_x_piby2
       nop.i            999
 } 
  
 {     .mfb 
       nop.m            999
-(p7)  fms.s     f8   =    acosf_const_piby2,f1,acosf_sinf1
+(p7)  fms.s.s0     f8   =    acosf_const_piby2,f1,acosf_sinf1
       br.ret.sptk b0 ;;
 } 
 
-L(ACOSF_ZERO):
+ACOSF_ZERO:
 // Here if x=0
 {     .mfb 
       nop.m                 999
-      fma.s    f8 =    acosf_const_piby2,f1,f0  // acosf(0)=pi/2
+      fma.s.s0    f8 =    acosf_const_piby2,f1,f0  // acosf(0)=pi/2
       br.ret.sptk b0 ;;
 } 
 
 
-L(ACOSF_ABS_ONE):
+ACOSF_ABS_ONE:
 .pred.rel "mutex",p11,p12
 // Here if |x|=1
 {     .mfi 
       nop.m                 999
-(p11) fma.s    f8 =    acosf_const_piby2,f1,acosf_const_piby2 // acosf(-1)=pi
+(p11) fma.s.s0    f8 =    acosf_const_piby2,f1,acosf_const_piby2 // acosf(-1)=pi
       nop.i                 999
 } 
 {     .mfb 
       nop.m                 999
-(p12) fma.s    f8 =    f1,f0,f0 // acosf(1)=0
+(p12) fma.s.s0    f8 =    f1,f0,f0 // acosf(1)=0
       br.ret.sptk b0 ;;
 } 
 
-.endp acosf
-ASM_SIZE_DIRECTIVE(acosf)
+GLOBAL_LIBM_END(acosf)
 
 
 // Stack operations when calling error support.
@@ -642,8 +632,7 @@ ASM_SIZE_DIRECTIVE(acosf)
 //                              restore ar.pfs
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -699,8 +688,7 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_acosh.S b/sysdeps/ia64/fpu/e_acosh.S
new file mode 100644
index 0000000000..fb25fa0053
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_acosh.S
@@ -0,0 +1,1202 @@
+.file "acosh.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// ==============================================================
+// History
+// ==============================================================
+// 03/23/01 Initial version
+// 04/19/01 Improved speed of the paths #1,2,3,4,5
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 05/14/03 Improved performance, set denormal flag for unorms >= 1.0
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+// ==============================================================
+// double acosh(double)
+//
+// Overview of operation
+// ==============================================================
+//
+// There are 7 paths:
+// 1. x = 1.0
+//    Return acosh(x) = 0.0
+// 2. 1.0 < x < 1.000499725341796875(0x3FF0020C00000000)
+//    Return acosh(x) = sqrt(x-1) * Pol4(x), where Pol4(x) =
+//      (((x*C4 + C3)*(x-1) + C2)*(x-1) + C1)*(x-1) + C0
+
+// 3. 1.000499725341796875(0x3FF0020C00000000) <= x < 2^63
+//    Return acosh(x) = log(x + sqrt(x^2 -1.0))
+//    To compute x + sqrt(x^2 -1.0) modified Newton Raphson method is used
+//      (3 iterations)
+//    Algorithm description for log function see below.
+//
+// 4. 2^63 <= x < +INF
+//    Return acosh(x) = log(2*x)
+//    Algorithm description for log function see below.
+//
+// 5. x = +INF
+//    Return acosh(x) = +INF
+//
+// 6. x = [S,Q]NaN
+//    Return acosh(x) = QNaN
+//
+// 7. x < 1.0
+//    It's domain error. Error handler with tag = 136 is called
+//
+//==============================================================
+// Algorithm Description for log(x) function
+// Below we are using the fact that inequality x - 1.0 > 2^(-6) is always
+//   true for this acosh implementation
+//
+// Consider  x = 2^N 1.f1 f2 f3 f4...f63
+// Log(x) = log(frcpa(x) x/frcpa(x))
+//        = log(1/frcpa(x)) + log(frcpa(x) x)
+//        = -log(frcpa(x)) + log(frcpa(x) x)
+//
+// frcpa(x)       = 2^-N frcpa((1.f1 f2 ... f63)
+//
+// -log(frcpa(x)) = -log(C)
+//                = -log(2^-N) - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 + log(frcpa(1.f1 f2 ... f63))
+//
+// Log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + log(1./frcpa(1.f1 f2 ... f63)) + log(frcpa(x) x)
+// Log(x) =  +Nlog2 - log(/frcpa(1.f1 f2 ... f63))   + log(frcpa(x) x)
+// Log(x) =  +Nlog2 + T                              + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + T                     + log(C x)
+//
+// Cx = 1 + r
+//
+// Log(x) =  +Nlog2 + T  + log(1+r)
+// Log(x) =  +Nlog2 + T  + Series( r - r^2/2 + r^3/3 - r^4/4 ....)
+//
+// 1.f1 f2 ... f8 has 256 entries.
+// They are 1 + k/2^8, k = 0 ... 255
+// These 256 values are the table entries.
+//
+// Implementation
+//==============================================================
+// C = frcpa(x)
+// r = C * x - 1
+//
+// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4 + P4*r^5 + P5*r^6
+//
+// x = f * 2*n where f is 1.f_1f_2f_3....f_63
+// Nfloat = float(n)  where n is the true unbiased exponent
+// pre-index = f_1f_2....f_8
+// index = pre_index * 16
+// get the dxt table entry at index + offset = T
+//
+// result = (T + Nfloat * log(2)) + rseries
+//
+// The T table is calculated as follows
+// Form x_k = 1 + k/2^8 where k goes from 0... 255
+//      y_k = frcpa(x_k)
+//      log(1/y_k)  in quad and round to double-extended
+//
+
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f9 -> f15,  f32 -> f65
+
+// General registers used:
+// r14 -> r27, r32 -> r39
+
+// Predicate registers used:
+// p6 -> p15
+
+// p6 to filter out case when x = [Q,S]NaN
+// p7,p8 to filter out case when x < 1.0
+// p10 to select path #1
+// p11 to filter out case when x = +INF
+// p12 used in the frcpa
+// p13 to select path #4
+// p14,p15 to select path #2
+
+// Assembly macros
+//==============================================================
+log_GR_exp_17_ones    = r14
+log_GR_signexp_f8     = r15
+log_table_address2    = r16
+log_GR_exp_16_ones    = r17
+log_GR_exp_f8         = r18
+log_GR_true_exp_f8    = r19
+log_GR_significand_f8 = r20
+log_GR_index          = r21
+log_GR_comp2          = r22
+acosh_GR_f8           = r23
+log_GR_comp           = r24
+acosh_GR_f8_sig       = r25
+log_table_address3    = r26
+NR_table_address      = r27
+
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_SAVE_PFS           = r35
+
+GR_Parameter_X        = r36
+GR_Parameter_Y        = r37
+GR_Parameter_RESULT   = r38
+acosh_GR_tag          = r39
+
+//==============================================================
+log_y            = f9
+NR1              = f10
+NR2              = f11
+log_y_rs         = f12
+log_y_rs_iter    = f13
+log_y_rs_iter1   = f14
+log_NORM_f8      = f15
+acosh_comp       = f32
+log_w            = f34
+log_P5           = f35
+log_P4           = f36
+log_P3           = f37
+log_P2           = f38
+log_P1           = f39
+log_C0           = f40
+log_C1           = f41
+log_C2           = f42
+log2             = f43
+acosh_w_rs       = f44
+log_C            = f45
+log_arg          = f46
+acosh_w_iter1    = f47
+acosh_w_iter2    = f48
+log_int_Nfloat   = f49
+log_r            = f50
+log_rsq          = f51
+log_rp_p4        = f52
+log_rp_p32       = f53
+log_rcube        = f54
+log_rp_p10       = f55
+log_rp_p2        = f56
+log_Nfloat       = f57
+log_T            = f58
+log_r2P_r        = f59
+log_T_plus_Nlog2 = f60
+acosh_w_sqrt     = f61
+acosh_w_1        = f62
+log_C3           = f63
+log_C4           = f64
+log_arg_early    = f65
+
+
+// Data tables
+//==============================================================
+
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(log_table_1)
+data8 0x3FF0020C49BA5E35 // 1.0005
+data8 0xBFC5555DA7212371 // P5
+data8 0x3FC999A19EEF5826 // P4
+data8 0xBFCFFFFFFFFEF009 // P3
+data8 0x3FD555555554ECB2 // P2
+data8 0xBFE0000000000000 // P1 = -0.5
+//
+data8 0xb17217f7d1cf79ac, 0x00003ffe  // log2
+LOCAL_OBJECT_END(log_table_1)
+
+LOCAL_OBJECT_START(log_table_2)
+data8 0x3FE0000000000000 // 0.5
+data8 0x4008000000000000 // 3.0
+//
+data8 0xAFE8F9203939CCF8, 0x00003FF6 // C4 3FF6AFE8F9203939CCF8
+data8 0xAD46EB6AE752D809, 0x0000BFF8 // C3 BFF8AD46EB6AE752D809
+data8 0xD93923D7F53F3627, 0x00003FF9 // C2 3FF9D93923D7F53F3627
+data8 0xF15BEEEFF7D32D36, 0x0000BFFB // C1 BFFBF15BEEEFF7D32D36
+data8 0xB504F333F9DE6484, 0x00003FFF // C0 3FFFB504F333F9DE6484
+LOCAL_OBJECT_END(log_table_2)
+
+
+LOCAL_OBJECT_START(log_table_3)
+data8 0x80200aaeac44ef38 , 0x00003ff6 //   log(1/frcpa(1+  0/2^-8))
+//
+data8 0xc09090a2c35aa070 , 0x00003ff7 //   log(1/frcpa(1+  1/2^-8))
+data8 0xa0c94fcb41977c75 , 0x00003ff8 //   log(1/frcpa(1+  2/2^-8))
+data8 0xe18b9c263af83301 , 0x00003ff8 //   log(1/frcpa(1+  3/2^-8))
+data8 0x8d35c8d6399c30ea , 0x00003ff9 //   log(1/frcpa(1+  4/2^-8))
+data8 0xadd4d2ecd601cbb8 , 0x00003ff9 //   log(1/frcpa(1+  5/2^-8))
+//
+data8 0xce95403a192f9f01 , 0x00003ff9 //   log(1/frcpa(1+  6/2^-8))
+data8 0xeb59392cbcc01096 , 0x00003ff9 //   log(1/frcpa(1+  7/2^-8))
+data8 0x862c7d0cefd54c5d , 0x00003ffa //   log(1/frcpa(1+  8/2^-8))
+data8 0x94aa63c65e70d499 , 0x00003ffa //   log(1/frcpa(1+  9/2^-8))
+data8 0xa54a696d4b62b382 , 0x00003ffa //   log(1/frcpa(1+ 10/2^-8))
+//
+data8 0xb3e4a796a5dac208 , 0x00003ffa //   log(1/frcpa(1+ 11/2^-8))
+data8 0xc28c45b1878340a9 , 0x00003ffa //   log(1/frcpa(1+ 12/2^-8))
+data8 0xd35c55f39d7a6235 , 0x00003ffa //   log(1/frcpa(1+ 13/2^-8))
+data8 0xe220f037b954f1f5 , 0x00003ffa //   log(1/frcpa(1+ 14/2^-8))
+data8 0xf0f3389b036834f3 , 0x00003ffa //   log(1/frcpa(1+ 15/2^-8))
+//
+data8 0xffd3488d5c980465 , 0x00003ffa //   log(1/frcpa(1+ 16/2^-8))
+data8 0x87609ce2ed300490 , 0x00003ffb //   log(1/frcpa(1+ 17/2^-8))
+data8 0x8ede9321e8c85927 , 0x00003ffb //   log(1/frcpa(1+ 18/2^-8))
+data8 0x96639427f2f8e2f4 , 0x00003ffb //   log(1/frcpa(1+ 19/2^-8))
+data8 0x9defad3e8f73217b , 0x00003ffb //   log(1/frcpa(1+ 20/2^-8))
+//
+data8 0xa582ebd50097029c , 0x00003ffb //   log(1/frcpa(1+ 21/2^-8))
+data8 0xac06dbe75ab80fee , 0x00003ffb //   log(1/frcpa(1+ 22/2^-8))
+data8 0xb3a78449b2d3ccca , 0x00003ffb //   log(1/frcpa(1+ 23/2^-8))
+data8 0xbb4f79635ab46bb2 , 0x00003ffb //   log(1/frcpa(1+ 24/2^-8))
+data8 0xc2fec93a83523f3f , 0x00003ffb //   log(1/frcpa(1+ 25/2^-8))
+//
+data8 0xc99af2eaca4c4571 , 0x00003ffb //   log(1/frcpa(1+ 26/2^-8))
+data8 0xd1581106472fa653 , 0x00003ffb //   log(1/frcpa(1+ 27/2^-8))
+data8 0xd8002560d4355f2e , 0x00003ffb //   log(1/frcpa(1+ 28/2^-8))
+data8 0xdfcb43b4fe508632 , 0x00003ffb //   log(1/frcpa(1+ 29/2^-8))
+data8 0xe67f6dff709d4119 , 0x00003ffb //   log(1/frcpa(1+ 30/2^-8))
+//
+data8 0xed393b1c22351280 , 0x00003ffb //   log(1/frcpa(1+ 31/2^-8))
+data8 0xf5192bff087bcc35 , 0x00003ffb //   log(1/frcpa(1+ 32/2^-8))
+data8 0xfbdf4ff6dfef2fa3 , 0x00003ffb //   log(1/frcpa(1+ 33/2^-8))
+data8 0x81559a97f92f9cc7 , 0x00003ffc //   log(1/frcpa(1+ 34/2^-8))
+data8 0x84be72bce90266e8 , 0x00003ffc //   log(1/frcpa(1+ 35/2^-8))
+//
+data8 0x88bc74113f23def2 , 0x00003ffc //   log(1/frcpa(1+ 36/2^-8))
+data8 0x8c2ba3edf6799d11 , 0x00003ffc //   log(1/frcpa(1+ 37/2^-8))
+data8 0x8f9dc92f92ea08b1 , 0x00003ffc //   log(1/frcpa(1+ 38/2^-8))
+data8 0x9312e8f36efab5a7 , 0x00003ffc //   log(1/frcpa(1+ 39/2^-8))
+data8 0x968b08643409ceb6 , 0x00003ffc //   log(1/frcpa(1+ 40/2^-8))
+//
+data8 0x9a062cba08a1708c , 0x00003ffc //   log(1/frcpa(1+ 41/2^-8))
+data8 0x9d845b3abf95485c , 0x00003ffc //   log(1/frcpa(1+ 42/2^-8))
+data8 0xa06fd841bc001bb4 , 0x00003ffc //   log(1/frcpa(1+ 43/2^-8))
+data8 0xa3f3a74652fbe0db , 0x00003ffc //   log(1/frcpa(1+ 44/2^-8))
+data8 0xa77a8fb2336f20f5 , 0x00003ffc //   log(1/frcpa(1+ 45/2^-8))
+//
+data8 0xab0497015d28b0a0 , 0x00003ffc //   log(1/frcpa(1+ 46/2^-8))
+data8 0xae91c2be6ba6a615 , 0x00003ffc //   log(1/frcpa(1+ 47/2^-8))
+data8 0xb189d1b99aebb20b , 0x00003ffc //   log(1/frcpa(1+ 48/2^-8))
+data8 0xb51cced5de9c1b2c , 0x00003ffc //   log(1/frcpa(1+ 49/2^-8))
+data8 0xb819bee9e720d42f , 0x00003ffc //   log(1/frcpa(1+ 50/2^-8))
+//
+data8 0xbbb2a0947b093a5d , 0x00003ffc //   log(1/frcpa(1+ 51/2^-8))
+data8 0xbf4ec1505811684a , 0x00003ffc //   log(1/frcpa(1+ 52/2^-8))
+data8 0xc2535bacfa8975ff , 0x00003ffc //   log(1/frcpa(1+ 53/2^-8))
+data8 0xc55a3eafad187eb8 , 0x00003ffc //   log(1/frcpa(1+ 54/2^-8))
+data8 0xc8ff2484b2c0da74 , 0x00003ffc //   log(1/frcpa(1+ 55/2^-8))
+//
+data8 0xcc0b1a008d53ab76 , 0x00003ffc //   log(1/frcpa(1+ 56/2^-8))
+data8 0xcfb6203844b3209b , 0x00003ffc //   log(1/frcpa(1+ 57/2^-8))
+data8 0xd2c73949a47a19f5 , 0x00003ffc //   log(1/frcpa(1+ 58/2^-8))
+data8 0xd5daae18b49d6695 , 0x00003ffc //   log(1/frcpa(1+ 59/2^-8))
+data8 0xd8f08248cf7e8019 , 0x00003ffc //   log(1/frcpa(1+ 60/2^-8))
+//
+data8 0xdca7749f1b3e540e , 0x00003ffc //   log(1/frcpa(1+ 61/2^-8))
+data8 0xdfc28e033aaaf7c7 , 0x00003ffc //   log(1/frcpa(1+ 62/2^-8))
+data8 0xe2e012a5f91d2f55 , 0x00003ffc //   log(1/frcpa(1+ 63/2^-8))
+data8 0xe600064ed9e292a8 , 0x00003ffc //   log(1/frcpa(1+ 64/2^-8))
+data8 0xe9226cce42b39f60 , 0x00003ffc //   log(1/frcpa(1+ 65/2^-8))
+//
+data8 0xec4749fd97a28360 , 0x00003ffc //   log(1/frcpa(1+ 66/2^-8))
+data8 0xef6ea1bf57780495 , 0x00003ffc //   log(1/frcpa(1+ 67/2^-8))
+data8 0xf29877ff38809091 , 0x00003ffc //   log(1/frcpa(1+ 68/2^-8))
+data8 0xf5c4d0b245cb89be , 0x00003ffc //   log(1/frcpa(1+ 69/2^-8))
+data8 0xf8f3afd6fcdef3aa , 0x00003ffc //   log(1/frcpa(1+ 70/2^-8))
+//
+data8 0xfc2519756be1abc7 , 0x00003ffc //   log(1/frcpa(1+ 71/2^-8))
+data8 0xff59119f503e6832 , 0x00003ffc //   log(1/frcpa(1+ 72/2^-8))
+data8 0x8147ce381ae0e146 , 0x00003ffd //   log(1/frcpa(1+ 73/2^-8))
+data8 0x82e45f06cb1ad0f2 , 0x00003ffd //   log(1/frcpa(1+ 74/2^-8))
+data8 0x842f5c7c573cbaa2 , 0x00003ffd //   log(1/frcpa(1+ 75/2^-8))
+//
+data8 0x85ce471968c8893a , 0x00003ffd //   log(1/frcpa(1+ 76/2^-8))
+data8 0x876e8305bc04066d , 0x00003ffd //   log(1/frcpa(1+ 77/2^-8))
+data8 0x891012678031fbb3 , 0x00003ffd //   log(1/frcpa(1+ 78/2^-8))
+data8 0x8a5f1493d766a05f , 0x00003ffd //   log(1/frcpa(1+ 79/2^-8))
+data8 0x8c030c778c56fa00 , 0x00003ffd //   log(1/frcpa(1+ 80/2^-8))
+//
+data8 0x8da85df17e31d9ae , 0x00003ffd //   log(1/frcpa(1+ 81/2^-8))
+data8 0x8efa663e7921687e , 0x00003ffd //   log(1/frcpa(1+ 82/2^-8))
+data8 0x90a22b6875c6a1f8 , 0x00003ffd //   log(1/frcpa(1+ 83/2^-8))
+data8 0x91f62cc8f5d24837 , 0x00003ffd //   log(1/frcpa(1+ 84/2^-8))
+data8 0x93a06cfc3857d980 , 0x00003ffd //   log(1/frcpa(1+ 85/2^-8))
+//
+data8 0x94f66d5e6fd01ced , 0x00003ffd //   log(1/frcpa(1+ 86/2^-8))
+data8 0x96a330156e6772f2 , 0x00003ffd //   log(1/frcpa(1+ 87/2^-8))
+data8 0x97fb3582754ea25b , 0x00003ffd //   log(1/frcpa(1+ 88/2^-8))
+data8 0x99aa8259aad1bbf2 , 0x00003ffd //   log(1/frcpa(1+ 89/2^-8))
+data8 0x9b0492f6227ae4a8 , 0x00003ffd //   log(1/frcpa(1+ 90/2^-8))
+//
+data8 0x9c5f8e199bf3a7a5 , 0x00003ffd //   log(1/frcpa(1+ 91/2^-8))
+data8 0x9e1293b9998c1daa , 0x00003ffd //   log(1/frcpa(1+ 92/2^-8))
+data8 0x9f6fa31e0b41f308 , 0x00003ffd //   log(1/frcpa(1+ 93/2^-8))
+data8 0xa0cda11eaf46390e , 0x00003ffd //   log(1/frcpa(1+ 94/2^-8))
+data8 0xa22c8f029cfa45aa , 0x00003ffd //   log(1/frcpa(1+ 95/2^-8))
+//
+data8 0xa3e48badb7856b34 , 0x00003ffd //   log(1/frcpa(1+ 96/2^-8))
+data8 0xa5459a0aa95849f9 , 0x00003ffd //   log(1/frcpa(1+ 97/2^-8))
+data8 0xa6a79c84480cfebd , 0x00003ffd //   log(1/frcpa(1+ 98/2^-8))
+data8 0xa80a946d0fcb3eb2 , 0x00003ffd //   log(1/frcpa(1+ 99/2^-8))
+data8 0xa96e831a3ea7b314 , 0x00003ffd //   log(1/frcpa(1+100/2^-8))
+//
+data8 0xaad369e3dc544e3b , 0x00003ffd //   log(1/frcpa(1+101/2^-8))
+data8 0xac92e9588952c815 , 0x00003ffd //   log(1/frcpa(1+102/2^-8))
+data8 0xadfa035aa1ed8fdc , 0x00003ffd //   log(1/frcpa(1+103/2^-8))
+data8 0xaf6219eae1ad6e34 , 0x00003ffd //   log(1/frcpa(1+104/2^-8))
+data8 0xb0cb2e6d8160f753 , 0x00003ffd //   log(1/frcpa(1+105/2^-8))
+//
+data8 0xb2354249ad950f72 , 0x00003ffd //   log(1/frcpa(1+106/2^-8))
+data8 0xb3a056e98ef4a3b4 , 0x00003ffd //   log(1/frcpa(1+107/2^-8))
+data8 0xb50c6dba52c6292a , 0x00003ffd //   log(1/frcpa(1+108/2^-8))
+data8 0xb679882c33876165 , 0x00003ffd //   log(1/frcpa(1+109/2^-8))
+data8 0xb78c07429785cedc , 0x00003ffd //   log(1/frcpa(1+110/2^-8))
+//
+data8 0xb8faeb8dc4a77d24 , 0x00003ffd //   log(1/frcpa(1+111/2^-8))
+data8 0xba6ad77eb36ae0d6 , 0x00003ffd //   log(1/frcpa(1+112/2^-8))
+data8 0xbbdbcc915e9bee50 , 0x00003ffd //   log(1/frcpa(1+113/2^-8))
+data8 0xbd4dcc44f8cf12ef , 0x00003ffd //   log(1/frcpa(1+114/2^-8))
+data8 0xbec0d81bf5b531fa , 0x00003ffd //   log(1/frcpa(1+115/2^-8))
+//
+data8 0xc034f19c139186f4 , 0x00003ffd //   log(1/frcpa(1+116/2^-8))
+data8 0xc14cb69f7c5e55ab , 0x00003ffd //   log(1/frcpa(1+117/2^-8))
+data8 0xc2c2abbb6e5fd56f , 0x00003ffd //   log(1/frcpa(1+118/2^-8))
+data8 0xc439b2c193e6771e , 0x00003ffd //   log(1/frcpa(1+119/2^-8))
+data8 0xc553acb9d5c67733 , 0x00003ffd //   log(1/frcpa(1+120/2^-8))
+//
+data8 0xc6cc96e441272441 , 0x00003ffd //   log(1/frcpa(1+121/2^-8))
+data8 0xc8469753eca88c30 , 0x00003ffd //   log(1/frcpa(1+122/2^-8))
+data8 0xc962cf3ce072b05c , 0x00003ffd //   log(1/frcpa(1+123/2^-8))
+data8 0xcadeba8771f694aa , 0x00003ffd //   log(1/frcpa(1+124/2^-8))
+data8 0xcc5bc08d1f72da94 , 0x00003ffd //   log(1/frcpa(1+125/2^-8))
+//
+data8 0xcd7a3f99ea035c29 , 0x00003ffd //   log(1/frcpa(1+126/2^-8))
+data8 0xcef93860c8a53c35 , 0x00003ffd //   log(1/frcpa(1+127/2^-8))
+data8 0xd0192f68a7ed23df , 0x00003ffd //   log(1/frcpa(1+128/2^-8))
+data8 0xd19a201127d3c645 , 0x00003ffd //   log(1/frcpa(1+129/2^-8))
+data8 0xd2bb92f4061c172c , 0x00003ffd //   log(1/frcpa(1+130/2^-8))
+//
+data8 0xd43e80b2ee8cc8fc , 0x00003ffd //   log(1/frcpa(1+131/2^-8))
+data8 0xd56173601fc4ade4 , 0x00003ffd //   log(1/frcpa(1+132/2^-8))
+data8 0xd6e6637efb54086f , 0x00003ffd //   log(1/frcpa(1+133/2^-8))
+data8 0xd80ad9f58f3c8193 , 0x00003ffd //   log(1/frcpa(1+134/2^-8))
+data8 0xd991d1d31aca41f8 , 0x00003ffd //   log(1/frcpa(1+135/2^-8))
+//
+data8 0xdab7d02231484a93 , 0x00003ffd //   log(1/frcpa(1+136/2^-8))
+data8 0xdc40d532cde49a54 , 0x00003ffd //   log(1/frcpa(1+137/2^-8))
+data8 0xdd685f79ed8b265e , 0x00003ffd //   log(1/frcpa(1+138/2^-8))
+data8 0xde9094bbc0e17b1d , 0x00003ffd //   log(1/frcpa(1+139/2^-8))
+data8 0xe01c91b78440c425 , 0x00003ffd //   log(1/frcpa(1+140/2^-8))
+//
+data8 0xe14658f26997e729 , 0x00003ffd //   log(1/frcpa(1+141/2^-8))
+data8 0xe270cdc2391e0d23 , 0x00003ffd //   log(1/frcpa(1+142/2^-8))
+data8 0xe3ffce3a2aa64922 , 0x00003ffd //   log(1/frcpa(1+143/2^-8))
+data8 0xe52bdb274ed82887 , 0x00003ffd //   log(1/frcpa(1+144/2^-8))
+data8 0xe6589852e75d7df6 , 0x00003ffd //   log(1/frcpa(1+145/2^-8))
+//
+data8 0xe786068c79937a7d , 0x00003ffd //   log(1/frcpa(1+146/2^-8))
+data8 0xe91903adad100911 , 0x00003ffd //   log(1/frcpa(1+147/2^-8))
+data8 0xea481236f7d35bb0 , 0x00003ffd //   log(1/frcpa(1+148/2^-8))
+data8 0xeb77d48c692e6b14 , 0x00003ffd //   log(1/frcpa(1+149/2^-8))
+data8 0xeca84b83d7297b87 , 0x00003ffd //   log(1/frcpa(1+150/2^-8))
+//
+data8 0xedd977f4962aa158 , 0x00003ffd //   log(1/frcpa(1+151/2^-8))
+data8 0xef7179a22f257754 , 0x00003ffd //   log(1/frcpa(1+152/2^-8))
+data8 0xf0a450d139366ca7 , 0x00003ffd //   log(1/frcpa(1+153/2^-8))
+data8 0xf1d7e0524ff9ffdb , 0x00003ffd //   log(1/frcpa(1+154/2^-8))
+data8 0xf30c29036a8b6cae , 0x00003ffd //   log(1/frcpa(1+155/2^-8))
+//
+data8 0xf4412bc411ea8d92 , 0x00003ffd //   log(1/frcpa(1+156/2^-8))
+data8 0xf576e97564c8619d , 0x00003ffd //   log(1/frcpa(1+157/2^-8))
+data8 0xf6ad62fa1b5f172f , 0x00003ffd //   log(1/frcpa(1+158/2^-8))
+data8 0xf7e499368b55c542 , 0x00003ffd //   log(1/frcpa(1+159/2^-8))
+data8 0xf91c8d10abaffe22 , 0x00003ffd //   log(1/frcpa(1+160/2^-8))
+//
+data8 0xfa553f7018c966f3 , 0x00003ffd //   log(1/frcpa(1+161/2^-8))
+data8 0xfb8eb13e185d802c , 0x00003ffd //   log(1/frcpa(1+162/2^-8))
+data8 0xfcc8e3659d9bcbed , 0x00003ffd //   log(1/frcpa(1+163/2^-8))
+data8 0xfe03d6d34d487fd2 , 0x00003ffd //   log(1/frcpa(1+164/2^-8))
+data8 0xff3f8c7581e9f0ae , 0x00003ffd //   log(1/frcpa(1+165/2^-8))
+//
+data8 0x803e029e280173ae , 0x00003ffe //   log(1/frcpa(1+166/2^-8))
+data8 0x80dca10cc52d0757 , 0x00003ffe //   log(1/frcpa(1+167/2^-8))
+data8 0x817ba200632755a1 , 0x00003ffe //   log(1/frcpa(1+168/2^-8))
+data8 0x821b05f3b01d6774 , 0x00003ffe //   log(1/frcpa(1+169/2^-8))
+data8 0x82bacd623ff19d06 , 0x00003ffe //   log(1/frcpa(1+170/2^-8))
+//
+data8 0x835af8c88e7a8f47 , 0x00003ffe //   log(1/frcpa(1+171/2^-8))
+data8 0x83c5f8299e2b4091 , 0x00003ffe //   log(1/frcpa(1+172/2^-8))
+data8 0x8466cb43f3d87300 , 0x00003ffe //   log(1/frcpa(1+173/2^-8))
+data8 0x850803a67c80ca4b , 0x00003ffe //   log(1/frcpa(1+174/2^-8))
+data8 0x85a9a1d11a23b461 , 0x00003ffe //   log(1/frcpa(1+175/2^-8))
+//
+data8 0x864ba644a18e6e05 , 0x00003ffe //   log(1/frcpa(1+176/2^-8))
+data8 0x86ee1182dcc432f7 , 0x00003ffe //   log(1/frcpa(1+177/2^-8))
+data8 0x875a925d7e48c316 , 0x00003ffe //   log(1/frcpa(1+178/2^-8))
+data8 0x87fdaa109d23aef7 , 0x00003ffe //   log(1/frcpa(1+179/2^-8))
+data8 0x88a129ed4becfaf2 , 0x00003ffe //   log(1/frcpa(1+180/2^-8))
+//
+data8 0x89451278ecd7f9cf , 0x00003ffe //   log(1/frcpa(1+181/2^-8))
+data8 0x89b29295f8432617 , 0x00003ffe //   log(1/frcpa(1+182/2^-8))
+data8 0x8a572ac5a5496882 , 0x00003ffe //   log(1/frcpa(1+183/2^-8))
+data8 0x8afc2d0ce3b2dadf , 0x00003ffe //   log(1/frcpa(1+184/2^-8))
+data8 0x8b6a69c608cfd3af , 0x00003ffe //   log(1/frcpa(1+185/2^-8))
+//
+data8 0x8c101e106e899a83 , 0x00003ffe //   log(1/frcpa(1+186/2^-8))
+data8 0x8cb63de258f9d626 , 0x00003ffe //   log(1/frcpa(1+187/2^-8))
+data8 0x8d2539c5bd19e2b1 , 0x00003ffe //   log(1/frcpa(1+188/2^-8))
+data8 0x8dcc0e064b29e6f1 , 0x00003ffe //   log(1/frcpa(1+189/2^-8))
+data8 0x8e734f45d88357ae , 0x00003ffe //   log(1/frcpa(1+190/2^-8))
+//
+data8 0x8ee30cef034a20db , 0x00003ffe //   log(1/frcpa(1+191/2^-8))
+data8 0x8f8b0515686d1d06 , 0x00003ffe //   log(1/frcpa(1+192/2^-8))
+data8 0x90336bba039bf32f , 0x00003ffe //   log(1/frcpa(1+193/2^-8))
+data8 0x90a3edd23d1c9d58 , 0x00003ffe //   log(1/frcpa(1+194/2^-8))
+data8 0x914d0de2f5d61b32 , 0x00003ffe //   log(1/frcpa(1+195/2^-8))
+//
+data8 0x91be0c20d28173b5 , 0x00003ffe //   log(1/frcpa(1+196/2^-8))
+data8 0x9267e737c06cd34a , 0x00003ffe //   log(1/frcpa(1+197/2^-8))
+data8 0x92d962ae6abb1237 , 0x00003ffe //   log(1/frcpa(1+198/2^-8))
+data8 0x9383fa6afbe2074c , 0x00003ffe //   log(1/frcpa(1+199/2^-8))
+data8 0x942f0421651c1c4e , 0x00003ffe //   log(1/frcpa(1+200/2^-8))
+//
+data8 0x94a14a3845bb985e , 0x00003ffe //   log(1/frcpa(1+201/2^-8))
+data8 0x954d133857f861e7 , 0x00003ffe //   log(1/frcpa(1+202/2^-8))
+data8 0x95bfd96468e604c4 , 0x00003ffe //   log(1/frcpa(1+203/2^-8))
+data8 0x9632d31cafafa858 , 0x00003ffe //   log(1/frcpa(1+204/2^-8))
+data8 0x96dfaabd86fa1647 , 0x00003ffe //   log(1/frcpa(1+205/2^-8))
+//
+data8 0x9753261fcbb2a594 , 0x00003ffe //   log(1/frcpa(1+206/2^-8))
+data8 0x9800c11b426b996d , 0x00003ffe //   log(1/frcpa(1+207/2^-8))
+data8 0x9874bf4d45ae663c , 0x00003ffe //   log(1/frcpa(1+208/2^-8))
+data8 0x99231f5ee9a74f79 , 0x00003ffe //   log(1/frcpa(1+209/2^-8))
+data8 0x9997a18a56bcad28 , 0x00003ffe //   log(1/frcpa(1+210/2^-8))
+//
+data8 0x9a46c873a3267e79 , 0x00003ffe //   log(1/frcpa(1+211/2^-8))
+data8 0x9abbcfc621eb6cb6 , 0x00003ffe //   log(1/frcpa(1+212/2^-8))
+data8 0x9b310cb0d354c990 , 0x00003ffe //   log(1/frcpa(1+213/2^-8))
+data8 0x9be14cf9e1b3515c , 0x00003ffe //   log(1/frcpa(1+214/2^-8))
+data8 0x9c5710b8cbb73a43 , 0x00003ffe //   log(1/frcpa(1+215/2^-8))
+//
+data8 0x9ccd0abd301f399c , 0x00003ffe //   log(1/frcpa(1+216/2^-8))
+data8 0x9d7e67f3bdce8888 , 0x00003ffe //   log(1/frcpa(1+217/2^-8))
+data8 0x9df4ea81a99daa01 , 0x00003ffe //   log(1/frcpa(1+218/2^-8))
+data8 0x9e6ba405a54514ba , 0x00003ffe //   log(1/frcpa(1+219/2^-8))
+data8 0x9f1e21c8c7bb62b3 , 0x00003ffe //   log(1/frcpa(1+220/2^-8))
+//
+data8 0x9f956593f6b6355c , 0x00003ffe //   log(1/frcpa(1+221/2^-8))
+data8 0xa00ce1092e5498c3 , 0x00003ffe //   log(1/frcpa(1+222/2^-8))
+data8 0xa0c08309c4b912c1 , 0x00003ffe //   log(1/frcpa(1+223/2^-8))
+data8 0xa1388a8c6faa2afa , 0x00003ffe //   log(1/frcpa(1+224/2^-8))
+data8 0xa1b0ca7095b5f985 , 0x00003ffe //   log(1/frcpa(1+225/2^-8))
+//
+data8 0xa22942eb47534a00 , 0x00003ffe //   log(1/frcpa(1+226/2^-8))
+data8 0xa2de62326449d0a3 , 0x00003ffe //   log(1/frcpa(1+227/2^-8))
+data8 0xa357690f88bfe345 , 0x00003ffe //   log(1/frcpa(1+228/2^-8))
+data8 0xa3d0a93f45169a4b , 0x00003ffe //   log(1/frcpa(1+229/2^-8))
+data8 0xa44a22f7ffe65f30 , 0x00003ffe //   log(1/frcpa(1+230/2^-8))
+//
+data8 0xa500c5e5b4c1aa36 , 0x00003ffe //   log(1/frcpa(1+231/2^-8))
+data8 0xa57ad064eb2ebbc2 , 0x00003ffe //   log(1/frcpa(1+232/2^-8))
+data8 0xa5f5152dedf4384e , 0x00003ffe //   log(1/frcpa(1+233/2^-8))
+data8 0xa66f9478856233ec , 0x00003ffe //   log(1/frcpa(1+234/2^-8))
+data8 0xa6ea4e7cca02c32e , 0x00003ffe //   log(1/frcpa(1+235/2^-8))
+//
+data8 0xa765437325341ccf , 0x00003ffe //   log(1/frcpa(1+236/2^-8))
+data8 0xa81e21e6c75b4020 , 0x00003ffe //   log(1/frcpa(1+237/2^-8))
+data8 0xa899ab333fe2b9ca , 0x00003ffe //   log(1/frcpa(1+238/2^-8))
+data8 0xa9157039c51ebe71 , 0x00003ffe //   log(1/frcpa(1+239/2^-8))
+data8 0xa991713433c2b999 , 0x00003ffe //   log(1/frcpa(1+240/2^-8))
+//
+data8 0xaa0dae5cbcc048b3 , 0x00003ffe //   log(1/frcpa(1+241/2^-8))
+data8 0xaa8a27ede5eb13ad , 0x00003ffe //   log(1/frcpa(1+242/2^-8))
+data8 0xab06de228a9e3499 , 0x00003ffe //   log(1/frcpa(1+243/2^-8))
+data8 0xab83d135dc633301 , 0x00003ffe //   log(1/frcpa(1+244/2^-8))
+data8 0xac3fb076adc7fe7a , 0x00003ffe //   log(1/frcpa(1+245/2^-8))
+//
+data8 0xacbd3cbbe47988f1 , 0x00003ffe //   log(1/frcpa(1+246/2^-8))
+data8 0xad3b06b1a5dc57c3 , 0x00003ffe //   log(1/frcpa(1+247/2^-8))
+data8 0xadb90e94af887717 , 0x00003ffe //   log(1/frcpa(1+248/2^-8))
+data8 0xae3754a218f7c816 , 0x00003ffe //   log(1/frcpa(1+249/2^-8))
+data8 0xaeb5d9175437afa2 , 0x00003ffe //   log(1/frcpa(1+250/2^-8))
+//
+data8 0xaf349c322e9c7cee , 0x00003ffe //   log(1/frcpa(1+251/2^-8))
+data8 0xafb39e30d1768d1c , 0x00003ffe //   log(1/frcpa(1+252/2^-8))
+data8 0xb032df51c2c93116 , 0x00003ffe //   log(1/frcpa(1+253/2^-8))
+data8 0xb0b25fd3e6035ad9 , 0x00003ffe //   log(1/frcpa(1+254/2^-8))
+data8 0xb1321ff67cba178c , 0x00003ffe //   log(1/frcpa(1+255/2^-8))
+LOCAL_OBJECT_END(log_table_3)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(acosh)
+
+{ .mfi
+      getf.exp   acosh_GR_f8 = f8
+      fclass.m   p6,p0 = f8, 0xc3                    // Test for x = NaN
+      mov        log_GR_comp2 = 0x1003e
+}
+{ .mfi
+      addl       NR_table_address = @ltoff(log_table_1), gp
+      fms.s1     log_y = f8, f8, f1                  // y = x^2-1
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.sig   acosh_GR_f8_sig = f8
+      fclass.m   p11,p0 = f8, 0x21                   // Test for x=+inf
+      mov        log_GR_exp_17_ones = 0x1ffff
+}
+{ .mfi
+      ld8        NR_table_address = [NR_table_address]
+      fms.s1     log_w = f8,f1,f1                    // w = x - 1
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fcmp.lt.s1 p7,p8 = f8, f1            // Test for x<1.0
+      addl       log_GR_comp = 0x10020C,r0 // Upper 21 bits of signif of 1.0005
+}
+{ .mfb
+      mov        log_GR_exp_16_ones = 0xffff         //BIAS
+(p6)  fma.d.s0   f8 = f8,f1,f0      // quietize nan result if x=nan
+(p6)  br.ret.spnt b0                // Exit for x=nan
+}
+;;
+
+{ .mfb
+      //get second table address
+      adds       log_table_address2 = 0x40, NR_table_address
+      fcmp.eq.s1 p10,p0 = f8, f1      // Test for x=+1.0
+(p11) br.ret.spnt b0                  // Exit for x=+inf
+}
+;;
+
+{ .mfi
+      ldfpd      NR1,NR2 = [log_table_address2],16
+      frsqrta.s1 log_y_rs,p0 = log_y  // z=1/sqrt(y)
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+      fma.s1     log_arg = f8,f1,f8
+(p7)  br.cond.spnt ACOSH_LESS_ONE     // Branch if path 7, x < 1.0
+}
+;;
+
+{ .mfi
+      ldfe       log_C4 = [log_table_address2],16
+(p8)  fcmp.eq.s0 p6,p0 = f8, f0       // Dummy op sets denorm flag if unorm>=1.0
+      nop.i      0
+}
+{ .mfb
+(p8)  cmp.le.unc p13,p0 = log_GR_comp2,acosh_GR_f8
+      nop.f      0
+(p13) br.cond.spnt LOG_COMMON1        // Branch if path 4, x >= 2^63
+}
+;;
+
+{ .mfi
+      ldfe       log_C3 = [log_table_address2],16
+(p10) fmerge.s   f8 = f0, f0          // Return 0 if x=1.0
+      shr.u      acosh_GR_f8_sig = acosh_GR_f8_sig,43
+}
+{ .mib
+      cmp.eq     p14,p0 = log_GR_exp_16_ones,acosh_GR_f8
+      nop.i      0
+(p10) br.ret.spnt b0                  // Exit for x=1.0
+}
+;;
+
+{ .mfi
+      ldfe       log_C2 = [log_table_address2],16
+      frsqrta.s1 acosh_w_rs,p0 = log_w // t=1/sqrt(w)
+      nop.i      0
+}
+{ .mfb
+(p14) cmp.lt.unc p15,p0 = acosh_GR_f8_sig,log_GR_comp
+      nop.f      0
+(p15) br.cond.spnt ACOSH_NEAR_ONE     // Branch if path 2, 1.0 < x < 1.0005
+}
+;;
+
+// Here is main path, 1.0005 <= x < 2^63
+/////////////// The first iteration //////////////////////////////////
+{ .mfi
+      ldfpd      acosh_comp,log_P5 = [NR_table_address],16
+      fma.s1     log_y_rs_iter = log_y_rs,log_y,f0              // y*z
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfpd      log_P4,log_P3 = [NR_table_address],16
+      fnma.s1    log_y_rs_iter = log_y_rs_iter,log_y_rs,NR2     // 3-(y*z)*z
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs,NR1,f0               // 0.5*z
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfpd      log_P2,log_P1 = [NR_table_address],16
+      //(0.5*z)*(3-(y*z)*z)
+      fma.s1     log_y_rs_iter = log_y_rs_iter1,log_y_rs_iter,f0
+      nop.i      0
+}
+;;
+
+/////////////////////////// The second iteration /////////////////////////////
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs = log_y_rs_iter,log_y,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    log_y_rs = log_y_rs,log_y_rs_iter,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //(0.5*z)*(3-(y*z)*z)
+      fma.s1     log_y_rs_iter = log_y_rs_iter1,log_y_rs,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //(0.5*z)*(3-(y*z)*z)
+      fma.s1     log_arg_early = log_y_rs_iter1,log_y_rs,f0
+      nop.i      0
+}
+;;
+
+//////////////////////////////////////// The third iteration /////////////////
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs = log_y_rs_iter,log_y,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_arg_early = log_arg_early,log_y,f8
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    log_y_rs = log_y_rs,log_y_rs_iter,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter1,log_y,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      frcpa.s1   log_C,p0 = f1,log_arg_early
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.exp   log_GR_signexp_f8 = log_arg_early
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.sig   log_GR_significand_f8 = log_arg_early
+      fma.s1     log_arg = log_y_rs_iter1,log_y_rs,f8 // (0.5*z)*(3-(y*z)*z)
+      adds       log_table_address3 = 0x70, NR_table_address
+}
+;;
+
+///////////////////////////////// The end NR iterations /////////////////////
+{ .mfi
+      ldfe       log2 = [NR_table_address],16
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mmi
+      //significant bit destruction
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+;;
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+      nop.i      0
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      fms.s1     log_r = log_C,log_arg,f1  // C = frcpa(x); r = C * x - 1
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*16 + index
+      shladd     log_table_address3 = log_GR_index,4,log_table_address3
+;;
+      ldfe       log_T = [log_table_address3]
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0         //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p4 = log_P5, log_r, log_P4  //P5*r + P4
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2 //P3*r + P2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format log_Nfloat
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rcube = log_rsq, log_r, f0      //r^3
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_rsq, log_P1, log_r //P1*r^2 + r
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //(P5*r + P4)*r^2 + P3*r + P2
+      fma.s1     log_rp_p2 = log_rp_p4, log_rsq, log_rp_p32
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T    //N*log2 + T
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r
+      fma.s1     log_r2P_r = log_rp_p2, log_rcube, log_rp_p10
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      // N*log2 + T + ((P5*r + P4)*r^2 + P3*r + P2)*w^3 + P1*r^2 + r
+      fadd.d.s0  f8 = log_T_plus_Nlog2, log_r2P_r
+      br.ret.sptk b0           // Exit main path, path 3: 1.0005 <= x < 2^63
+}
+;;
+
+// Here if path 2, 1.0 < x < 1.0005
+ACOSH_NEAR_ONE:
+// The first NR iteration
+{ .mfi
+      ldfe       log_C1 = [log_table_address2],16
+      fma.s1     acosh_w_iter1 = acosh_w_rs,log_w,f0  //t*w
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_1 = f8,log_C4,log_C3         //x*C4 + C3
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfe       log_C0 = [log_table_address2],16
+      fma.s1     acosh_w_iter2 = acosh_w_rs,NR1,f0    //t*0.5
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fnma.s1    acosh_w_iter1 = acosh_w_iter1,acosh_w_rs,NR2 //3-t*t*w
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //(3-t*t*w)*t*0.5
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,acosh_w_iter1,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_1 = acosh_w_1,log_w,log_C2 //(x*C4 + C3)*(x-1) + C2
+      nop.i      0
+}
+;;
+
+// The second NR iteration
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_rs = acosh_w_iter2,log_w,f0  //t*w
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //((x*C4 + C3)*(x-1) + C2)*(x-1) + C1
+      fma.s1     acosh_w_1 = acosh_w_1,log_w,log_C1
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    acosh_w_iter1 = acosh_w_iter2,acosh_w_rs,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,acosh_w_iter1,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //(((x*C4 + C3)*(x-1) + C2)*(x-1) + C1)*(x-1) + C0
+      fma.s1     acosh_w_1 = acosh_w_1,log_w,log_C0
+      nop.i      0
+}
+;;
+
+//The third NR iteration
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_rs = acosh_w_iter2,log_w,f0  //t*w
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    acosh_w_iter1 = acosh_w_iter2,acosh_w_rs,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,acosh_w_iter1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_sqrt = acosh_w_iter2,log_w,f0
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fma.d.s0   f8 = acosh_w_1,acosh_w_sqrt,f0
+      br.ret.sptk b0               // Exit path 2, 1.0 < x < 1.0005
+}
+;;
+
+// Here if path 4, x >= 2^63
+LOG_COMMON1:
+{ .mfi
+      ldfpd      acosh_comp,log_P5 = [NR_table_address],16
+      frcpa.s1   log_C,p0 = f1,log_arg
+      nop.i      0
+}
+;;
+
+{ .mmi
+      getf.exp   log_GR_signexp_f8 = log_arg
+      ldfpd      log_P4,log_P3 = [NR_table_address],16
+      nop.i      0
+}
+;;
+
+{ .mmi
+      getf.sig   log_GR_significand_f8 = log_arg
+      ldfpd      log_P2,log_P1 = [NR_table_address],16
+      nop.i      0
+}
+;;
+
+{ .mfi
+      adds       log_table_address3 = 0x70, NR_table_address
+      nop.f      0
+      //significant bit destruction
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+}
+;;
+
+{ .mmf
+      ldfe       log2 = [NR_table_address],16
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+      fms.s1     log_r = log_C,log_arg,f1  // C = frcpa(x); r = C * x - 1
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      nop.f      0
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*16 + index
+      shladd     log_table_address3 = log_GR_index,4,log_table_address3
+;;
+      ldfe       log_T = [log_table_address3]
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0         //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p4 = log_P5, log_r, log_P4  //P5*r + P4
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2 //P3*r + P2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rcube = log_rsq, log_r, f0     //r^3
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_rsq, log_P1, log_r //P1*r^2 + r
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format log_Nfloat
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //(P5*r + P4)*r^2 + P3*r + P2
+      fma.s1     log_rp_p2 = log_rp_p4, log_rsq, log_rp_p32
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T    //N*log2 + T
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //((P5*r + P4)*r^2 + P3*r + P2)*w^3 + P1*r^2 + r
+      fma.s1     log_r2P_r = log_rp_p2, log_rcube, log_rp_p10
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      //  N*log2 + T + ((P5*r + P4)*r^2 + P3*r + P2)*w^3 + P1*r^2 + r
+      fadd.d.s0  f8 = log_T_plus_Nlog2, log_r2P_r
+      br.ret.sptk b0              // Exit path 4, x >= 2^63
+}
+;;
+
+// Here if path 7, x < 1.0
+ACOSH_LESS_ONE:
+{ .mfi
+      alloc      r32 = ar.pfs,1,3,4,0
+      fmerge.s   f10 = f8,f8
+      nop.i      0
+}
+;;
+
+{ .mfb
+      mov        acosh_GR_tag = 136
+      frcpa.s0   f8,p0 = f0,f0
+      br.cond.sptk __libm_error_region
+}
+;;
+
+GLOBAL_LIBM_END(acosh)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+{ .mmi
+        stfd [GR_Parameter_Y] = f1,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+{ .mib
+        stfd [GR_Parameter_X] = f10           // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+        nop.b 0
+}
+{ .mib
+        stfd [GR_Parameter_Y] = f8            // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support# // Call error handling function
+};;
+
+{ .mmi
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
+};;
+
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_acoshf.S b/sysdeps/ia64/fpu/e_acoshf.S
new file mode 100644
index 0000000000..58ef5f2adb
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_acoshf.S
@@ -0,0 +1,1030 @@
+.file "acoshf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// ==============================================================
+// History
+// ==============================================================
+// 03/28/01 Initial version
+// 04/19/01 Improved speed of the paths #1,2,3,4,5
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 05/14/03 Improved performance, set denormal flag for unorms >= 1.0
+//
+// API
+// ==============================================================
+// float acoshf(float)
+//
+// Overview of operation
+// ==============================================================
+//
+// There are 7 paths:
+// 1. x = 1.0
+//    Return acoshf(x) = 0.0
+// 2. 1.0 < x < 1.000499725341796875(0x3FF0020C00000000)
+//    Return acoshf(x) = sqrt(x-1) * Pol4(x),
+//    where Pol4(x) = (x*C2 + C1)*(x-1) + C0
+//
+// 3. 1.000499725341796875(0x3FF0020C00000000) <= x < 2^51
+//    Return acoshf(x) = log(x + sqrt(x^2 -1.0))
+//    To compute x + sqrt(x^2 -1.0) modified Newton Raphson method is used
+//      (2 iterations)
+//    Algorithm description for log function see below.
+//
+// 4. 2^51 <= x < +INF
+//    Return acoshf(x) = log(2*x)
+//    Algorithm description for log function see below.
+//
+// 5. x = +INF
+//    Return acoshf(x) = +INF
+//
+// 6. x = [S,Q]NaN
+//    Return acoshf(x) = QNaN
+//
+// 7. x < 1.0
+//    It's domain error. Error handler with tag = 137 is called
+//
+//==============================================================
+// Algorithm Description for log(x) function
+// Below we are using the fact that inequality x - 1.0 > 2^(-6) is always
+//   true for this acosh implementation
+//
+// Consider  x = 2^N 1.f1 f2 f3 f4...f63
+// Log(x) = log(frcpa(x) x/frcpa(x))
+//        = log(1/frcpa(x)) + log(frcpa(x) x)
+//        = -log(frcpa(x)) + log(frcpa(x) x)
+//
+// frcpa(x)       = 2^-N frcpa((1.f1 f2 ... f63)
+//
+// -log(frcpa(x)) = -log(C)
+//                = -log(2^-N) - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 + log(frcpa(1.f1 f2 ... f63))
+//
+// Log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + log(1./frcpa(1.f1 f2 ... f63)) + log(frcpa(x) x)
+// Log(x) =  +Nlog2 - log(/frcpa(1.f1 f2 ... f63))   + log(frcpa(x) x)
+// Log(x) =  +Nlog2 + T                              + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + T                     + log(C x)
+//
+// Cx = 1 + r
+//
+// Log(x) =  +Nlog2 + T  + log(1+r)
+// Log(x) =  +Nlog2 + T  + Series( r - r^2/2 + r^3/3 - r^4/4 ....)
+//
+// 1.f1 f2 ... f8 has 256 entries.
+// They are 1 + k/2^8, k = 0 ... 255
+// These 256 values are the table entries.
+//
+// Implementation
+//==============================================================
+// C = frcpa(x)
+// r = C * x - 1
+//
+// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4
+//
+// x = f * 2*n where f is 1.f_1f_2f_3....f_63
+// Nfloat = float(n)  where n is the true unbiased exponent
+// pre-index = f_1f_2....f_8
+// index = pre_index * 8
+// get the dxt table entry at index + offset = T
+//
+// result = (T + Nfloat * log(2)) + rseries
+//
+// The T table is calculated as follows
+// Form x_k = 1 + k/2^8 where k goes from 0... 255
+//      y_k = frcpa(x_k)
+//      log(1/y_k)  in quad and round to double
+//
+
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f9 -> f15,  f32 -> f62
+//
+// General registers used:
+// r14 -> r27, r32 -> r39
+//
+// Predicate registers used:
+// p6 -> p15
+//
+// p6 to filter out case when x = [Q,S]NaN
+// p7,p8 to filter out case when x < 1.0
+//
+// p10 to select path #1
+// p11 to filter out case when x = +INF
+// p12 used in the frcpa
+// p13 to select path #4
+// p14,p15 to select path #2
+
+// Assembly macros
+//==============================================================
+log_GR_exp_17_ones    = r14
+log_GR_signexp_f8     = r15
+log_table_address2    = r16
+log_GR_exp_16_ones    = r17
+log_GR_exp_f8         = r18
+log_GR_true_exp_f8    = r19
+log_GR_significand_f8 = r20
+log_GR_index          = r21
+log_GR_comp2          = r22
+acosh_GR_f8           = r23
+log_GR_comp           = r24
+acosh_GR_f8_sig       = r25
+log_table_address3    = r26
+NR_table_address      = r27
+
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_SAVE_PFS           = r35
+
+GR_Parameter_X        = r36
+GR_Parameter_Y        = r37
+GR_Parameter_RESULT   = r38
+acosh_GR_tag          = r39
+
+//==============================================================
+log_y            = f9
+NR1              = f10
+NR2              = f11
+log_y_rs         = f12
+log_y_rs_iter    = f13
+log_y_rs_iter1   = f14
+log_NORM_f8      = f15
+log_w            = f32
+acosh_comp       = f34
+acosh_comp2      = f33
+log_P3           = f35
+log_P2           = f36
+log_P1           = f37
+log2             = f38
+log_C0           = f39
+log_C1           = f40
+log_C2           = f41
+acosh_w_rs       = f42
+log_C            = f43
+log_arg          = f44
+acosh_w_iter1    = f45
+acosh_w_iter2    = f46
+log_int_Nfloat   = f47
+log_r            = f48
+log_rsq          = f49
+log_rp_p4        = f50
+log_rp_p32       = f51
+log_rcube        = f52
+log_rp_p10       = f53
+log_rp_p2        = f54
+log_Nfloat       = f55
+log_T            = f56
+log_r2P_r        = f57
+log_T_plus_Nlog2 = f58
+acosh_w_sqrt     = f59
+acosh_w_1        = f60
+log_arg_early    = f61
+log_y_rs_iter2   = f62
+
+
+// Data tables
+//==============================================================
+
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(log_table_1)
+data8 0xbfd0001008f39d59 // p3
+data8 0x3fd5556073e0c45a // p2
+data8 0xbfdffffffffaea15 // p1
+data8 0x3FE62E42FEFA39EF // log2
+LOCAL_OBJECT_END(log_table_1)
+
+LOCAL_OBJECT_START(log_table_2)
+
+data8 0x3FE0000000000000 // 0.5
+data8 0x4008000000000000 // 3.0
+data8 0xD92CBAD213719F11, 0x00003FF9 // C2 3FF9D92CBAD213719F11
+data8 0x93D38EBF2EC9B073, 0x0000BFFC // C1 BFFC93D38EBF2EC9B073
+data8 0xB504F333F9DA0E32, 0x00003FFF // C0 3FFFB504F333F9DA0E32
+LOCAL_OBJECT_END(log_table_2)
+
+LOCAL_OBJECT_START(log_table_3)
+data8 0x3F60040155D5889E    //log(1/frcpa(1+   0/256)
+data8 0x3F78121214586B54    //log(1/frcpa(1+   1/256)
+data8 0x3F841929F96832F0    //log(1/frcpa(1+   2/256)
+data8 0x3F8C317384C75F06    //log(1/frcpa(1+   3/256)
+data8 0x3F91A6B91AC73386    //log(1/frcpa(1+   4/256)
+data8 0x3F95BA9A5D9AC039    //log(1/frcpa(1+   5/256)
+data8 0x3F99D2A8074325F4    //log(1/frcpa(1+   6/256)
+data8 0x3F9D6B2725979802    //log(1/frcpa(1+   7/256)
+data8 0x3FA0C58FA19DFAAA    //log(1/frcpa(1+   8/256)
+data8 0x3FA2954C78CBCE1B    //log(1/frcpa(1+   9/256)
+data8 0x3FA4A94D2DA96C56    //log(1/frcpa(1+  10/256)
+data8 0x3FA67C94F2D4BB58    //log(1/frcpa(1+  11/256)
+data8 0x3FA85188B630F068    //log(1/frcpa(1+  12/256)
+data8 0x3FAA6B8ABE73AF4C    //log(1/frcpa(1+  13/256)
+data8 0x3FAC441E06F72A9E    //log(1/frcpa(1+  14/256)
+data8 0x3FAE1E6713606D07    //log(1/frcpa(1+  15/256)
+data8 0x3FAFFA6911AB9301    //log(1/frcpa(1+  16/256)
+data8 0x3FB0EC139C5DA601    //log(1/frcpa(1+  17/256)
+data8 0x3FB1DBD2643D190B    //log(1/frcpa(1+  18/256)
+data8 0x3FB2CC7284FE5F1C    //log(1/frcpa(1+  19/256)
+data8 0x3FB3BDF5A7D1EE64    //log(1/frcpa(1+  20/256)
+data8 0x3FB4B05D7AA012E0    //log(1/frcpa(1+  21/256)
+data8 0x3FB580DB7CEB5702    //log(1/frcpa(1+  22/256)
+data8 0x3FB674F089365A7A    //log(1/frcpa(1+  23/256)
+data8 0x3FB769EF2C6B568D    //log(1/frcpa(1+  24/256)
+data8 0x3FB85FD927506A48    //log(1/frcpa(1+  25/256)
+data8 0x3FB9335E5D594989    //log(1/frcpa(1+  26/256)
+data8 0x3FBA2B0220C8E5F5    //log(1/frcpa(1+  27/256)
+data8 0x3FBB0004AC1A86AC    //log(1/frcpa(1+  28/256)
+data8 0x3FBBF968769FCA11    //log(1/frcpa(1+  29/256)
+data8 0x3FBCCFEDBFEE13A8    //log(1/frcpa(1+  30/256)
+data8 0x3FBDA727638446A2    //log(1/frcpa(1+  31/256)
+data8 0x3FBEA3257FE10F7A    //log(1/frcpa(1+  32/256)
+data8 0x3FBF7BE9FEDBFDE6    //log(1/frcpa(1+  33/256)
+data8 0x3FC02AB352FF25F4    //log(1/frcpa(1+  34/256)
+data8 0x3FC097CE579D204D    //log(1/frcpa(1+  35/256)
+data8 0x3FC1178E8227E47C    //log(1/frcpa(1+  36/256)
+data8 0x3FC185747DBECF34    //log(1/frcpa(1+  37/256)
+data8 0x3FC1F3B925F25D41    //log(1/frcpa(1+  38/256)
+data8 0x3FC2625D1E6DDF57    //log(1/frcpa(1+  39/256)
+data8 0x3FC2D1610C86813A    //log(1/frcpa(1+  40/256)
+data8 0x3FC340C59741142E    //log(1/frcpa(1+  41/256)
+data8 0x3FC3B08B6757F2A9    //log(1/frcpa(1+  42/256)
+data8 0x3FC40DFB08378003    //log(1/frcpa(1+  43/256)
+data8 0x3FC47E74E8CA5F7C    //log(1/frcpa(1+  44/256)
+data8 0x3FC4EF51F6466DE4    //log(1/frcpa(1+  45/256)
+data8 0x3FC56092E02BA516    //log(1/frcpa(1+  46/256)
+data8 0x3FC5D23857CD74D5    //log(1/frcpa(1+  47/256)
+data8 0x3FC6313A37335D76    //log(1/frcpa(1+  48/256)
+data8 0x3FC6A399DABBD383    //log(1/frcpa(1+  49/256)
+data8 0x3FC70337DD3CE41B    //log(1/frcpa(1+  50/256)
+data8 0x3FC77654128F6127    //log(1/frcpa(1+  51/256)
+data8 0x3FC7E9D82A0B022D    //log(1/frcpa(1+  52/256)
+data8 0x3FC84A6B759F512F    //log(1/frcpa(1+  53/256)
+data8 0x3FC8AB47D5F5A310    //log(1/frcpa(1+  54/256)
+data8 0x3FC91FE49096581B    //log(1/frcpa(1+  55/256)
+data8 0x3FC981634011AA75    //log(1/frcpa(1+  56/256)
+data8 0x3FC9F6C407089664    //log(1/frcpa(1+  57/256)
+data8 0x3FCA58E729348F43    //log(1/frcpa(1+  58/256)
+data8 0x3FCABB55C31693AD    //log(1/frcpa(1+  59/256)
+data8 0x3FCB1E104919EFD0    //log(1/frcpa(1+  60/256)
+data8 0x3FCB94EE93E367CB    //log(1/frcpa(1+  61/256)
+data8 0x3FCBF851C067555F    //log(1/frcpa(1+  62/256)
+data8 0x3FCC5C0254BF23A6    //log(1/frcpa(1+  63/256)
+data8 0x3FCCC000C9DB3C52    //log(1/frcpa(1+  64/256)
+data8 0x3FCD244D99C85674    //log(1/frcpa(1+  65/256)
+data8 0x3FCD88E93FB2F450    //log(1/frcpa(1+  66/256)
+data8 0x3FCDEDD437EAEF01    //log(1/frcpa(1+  67/256)
+data8 0x3FCE530EFFE71012    //log(1/frcpa(1+  68/256)
+data8 0x3FCEB89A1648B971    //log(1/frcpa(1+  69/256)
+data8 0x3FCF1E75FADF9BDE    //log(1/frcpa(1+  70/256)
+data8 0x3FCF84A32EAD7C35    //log(1/frcpa(1+  71/256)
+data8 0x3FCFEB2233EA07CD    //log(1/frcpa(1+  72/256)
+data8 0x3FD028F9C7035C1C    //log(1/frcpa(1+  73/256)
+data8 0x3FD05C8BE0D9635A    //log(1/frcpa(1+  74/256)
+data8 0x3FD085EB8F8AE797    //log(1/frcpa(1+  75/256)
+data8 0x3FD0B9C8E32D1911    //log(1/frcpa(1+  76/256)
+data8 0x3FD0EDD060B78081    //log(1/frcpa(1+  77/256)
+data8 0x3FD122024CF0063F    //log(1/frcpa(1+  78/256)
+data8 0x3FD14BE2927AECD4    //log(1/frcpa(1+  79/256)
+data8 0x3FD180618EF18ADF    //log(1/frcpa(1+  80/256)
+data8 0x3FD1B50BBE2FC63B    //log(1/frcpa(1+  81/256)
+data8 0x3FD1DF4CC7CF242D    //log(1/frcpa(1+  82/256)
+data8 0x3FD214456D0EB8D4    //log(1/frcpa(1+  83/256)
+data8 0x3FD23EC5991EBA49    //log(1/frcpa(1+  84/256)
+data8 0x3FD2740D9F870AFB    //log(1/frcpa(1+  85/256)
+data8 0x3FD29ECDABCDFA04    //log(1/frcpa(1+  86/256)
+data8 0x3FD2D46602ADCCEE    //log(1/frcpa(1+  87/256)
+data8 0x3FD2FF66B04EA9D4    //log(1/frcpa(1+  88/256)
+data8 0x3FD335504B355A37    //log(1/frcpa(1+  89/256)
+data8 0x3FD360925EC44F5D    //log(1/frcpa(1+  90/256)
+data8 0x3FD38BF1C3337E75    //log(1/frcpa(1+  91/256)
+data8 0x3FD3C25277333184    //log(1/frcpa(1+  92/256)
+data8 0x3FD3EDF463C1683E    //log(1/frcpa(1+  93/256)
+data8 0x3FD419B423D5E8C7    //log(1/frcpa(1+  94/256)
+data8 0x3FD44591E0539F49    //log(1/frcpa(1+  95/256)
+data8 0x3FD47C9175B6F0AD    //log(1/frcpa(1+  96/256)
+data8 0x3FD4A8B341552B09    //log(1/frcpa(1+  97/256)
+data8 0x3FD4D4F3908901A0    //log(1/frcpa(1+  98/256)
+data8 0x3FD501528DA1F968    //log(1/frcpa(1+  99/256)
+data8 0x3FD52DD06347D4F6    //log(1/frcpa(1+ 100/256)
+data8 0x3FD55A6D3C7B8A8A    //log(1/frcpa(1+ 101/256)
+data8 0x3FD5925D2B112A59    //log(1/frcpa(1+ 102/256)
+data8 0x3FD5BF406B543DB2    //log(1/frcpa(1+ 103/256)
+data8 0x3FD5EC433D5C35AE    //log(1/frcpa(1+ 104/256)
+data8 0x3FD61965CDB02C1F    //log(1/frcpa(1+ 105/256)
+data8 0x3FD646A84935B2A2    //log(1/frcpa(1+ 106/256)
+data8 0x3FD6740ADD31DE94    //log(1/frcpa(1+ 107/256)
+data8 0x3FD6A18DB74A58C5    //log(1/frcpa(1+ 108/256)
+data8 0x3FD6CF31058670EC    //log(1/frcpa(1+ 109/256)
+data8 0x3FD6F180E852F0BA    //log(1/frcpa(1+ 110/256)
+data8 0x3FD71F5D71B894F0    //log(1/frcpa(1+ 111/256)
+data8 0x3FD74D5AEFD66D5C    //log(1/frcpa(1+ 112/256)
+data8 0x3FD77B79922BD37E    //log(1/frcpa(1+ 113/256)
+data8 0x3FD7A9B9889F19E2    //log(1/frcpa(1+ 114/256)
+data8 0x3FD7D81B037EB6A6    //log(1/frcpa(1+ 115/256)
+data8 0x3FD8069E33827231    //log(1/frcpa(1+ 116/256)
+data8 0x3FD82996D3EF8BCB    //log(1/frcpa(1+ 117/256)
+data8 0x3FD85855776DCBFB    //log(1/frcpa(1+ 118/256)
+data8 0x3FD8873658327CCF    //log(1/frcpa(1+ 119/256)
+data8 0x3FD8AA75973AB8CF    //log(1/frcpa(1+ 120/256)
+data8 0x3FD8D992DC8824E5    //log(1/frcpa(1+ 121/256)
+data8 0x3FD908D2EA7D9512    //log(1/frcpa(1+ 122/256)
+data8 0x3FD92C59E79C0E56    //log(1/frcpa(1+ 123/256)
+data8 0x3FD95BD750EE3ED3    //log(1/frcpa(1+ 124/256)
+data8 0x3FD98B7811A3EE5B    //log(1/frcpa(1+ 125/256)
+data8 0x3FD9AF47F33D406C    //log(1/frcpa(1+ 126/256)
+data8 0x3FD9DF270C1914A8    //log(1/frcpa(1+ 127/256)
+data8 0x3FDA0325ED14FDA4    //log(1/frcpa(1+ 128/256)
+data8 0x3FDA33440224FA79    //log(1/frcpa(1+ 129/256)
+data8 0x3FDA57725E80C383    //log(1/frcpa(1+ 130/256)
+data8 0x3FDA87D0165DD199    //log(1/frcpa(1+ 131/256)
+data8 0x3FDAAC2E6C03F896    //log(1/frcpa(1+ 132/256)
+data8 0x3FDADCCC6FDF6A81    //log(1/frcpa(1+ 133/256)
+data8 0x3FDB015B3EB1E790    //log(1/frcpa(1+ 134/256)
+data8 0x3FDB323A3A635948    //log(1/frcpa(1+ 135/256)
+data8 0x3FDB56FA04462909    //log(1/frcpa(1+ 136/256)
+data8 0x3FDB881AA659BC93    //log(1/frcpa(1+ 137/256)
+data8 0x3FDBAD0BEF3DB165    //log(1/frcpa(1+ 138/256)
+data8 0x3FDBD21297781C2F    //log(1/frcpa(1+ 139/256)
+data8 0x3FDC039236F08819    //log(1/frcpa(1+ 140/256)
+data8 0x3FDC28CB1E4D32FD    //log(1/frcpa(1+ 141/256)
+data8 0x3FDC4E19B84723C2    //log(1/frcpa(1+ 142/256)
+data8 0x3FDC7FF9C74554C9    //log(1/frcpa(1+ 143/256)
+data8 0x3FDCA57B64E9DB05    //log(1/frcpa(1+ 144/256)
+data8 0x3FDCCB130A5CEBB0    //log(1/frcpa(1+ 145/256)
+data8 0x3FDCF0C0D18F326F    //log(1/frcpa(1+ 146/256)
+data8 0x3FDD232075B5A201    //log(1/frcpa(1+ 147/256)
+data8 0x3FDD490246DEFA6B    //log(1/frcpa(1+ 148/256)
+data8 0x3FDD6EFA918D25CD    //log(1/frcpa(1+ 149/256)
+data8 0x3FDD9509707AE52F    //log(1/frcpa(1+ 150/256)
+data8 0x3FDDBB2EFE92C554    //log(1/frcpa(1+ 151/256)
+data8 0x3FDDEE2F3445E4AF    //log(1/frcpa(1+ 152/256)
+data8 0x3FDE148A1A2726CE    //log(1/frcpa(1+ 153/256)
+data8 0x3FDE3AFC0A49FF40    //log(1/frcpa(1+ 154/256)
+data8 0x3FDE6185206D516E    //log(1/frcpa(1+ 155/256)
+data8 0x3FDE882578823D52    //log(1/frcpa(1+ 156/256)
+data8 0x3FDEAEDD2EAC990C    //log(1/frcpa(1+ 157/256)
+data8 0x3FDED5AC5F436BE3    //log(1/frcpa(1+ 158/256)
+data8 0x3FDEFC9326D16AB9    //log(1/frcpa(1+ 159/256)
+data8 0x3FDF2391A2157600    //log(1/frcpa(1+ 160/256)
+data8 0x3FDF4AA7EE03192D    //log(1/frcpa(1+ 161/256)
+data8 0x3FDF71D627C30BB0    //log(1/frcpa(1+ 162/256)
+data8 0x3FDF991C6CB3B379    //log(1/frcpa(1+ 163/256)
+data8 0x3FDFC07ADA69A910    //log(1/frcpa(1+ 164/256)
+data8 0x3FDFE7F18EB03D3E    //log(1/frcpa(1+ 165/256)
+data8 0x3FE007C053C5002E    //log(1/frcpa(1+ 166/256)
+data8 0x3FE01B942198A5A1    //log(1/frcpa(1+ 167/256)
+data8 0x3FE02F74400C64EB    //log(1/frcpa(1+ 168/256)
+data8 0x3FE04360BE7603AD    //log(1/frcpa(1+ 169/256)
+data8 0x3FE05759AC47FE34    //log(1/frcpa(1+ 170/256)
+data8 0x3FE06B5F1911CF52    //log(1/frcpa(1+ 171/256)
+data8 0x3FE078BF0533C568    //log(1/frcpa(1+ 172/256)
+data8 0x3FE08CD9687E7B0E    //log(1/frcpa(1+ 173/256)
+data8 0x3FE0A10074CF9019    //log(1/frcpa(1+ 174/256)
+data8 0x3FE0B5343A234477    //log(1/frcpa(1+ 175/256)
+data8 0x3FE0C974C89431CE    //log(1/frcpa(1+ 176/256)
+data8 0x3FE0DDC2305B9886    //log(1/frcpa(1+ 177/256)
+data8 0x3FE0EB524BAFC918    //log(1/frcpa(1+ 178/256)
+data8 0x3FE0FFB54213A476    //log(1/frcpa(1+ 179/256)
+data8 0x3FE114253DA97D9F    //log(1/frcpa(1+ 180/256)
+data8 0x3FE128A24F1D9AFF    //log(1/frcpa(1+ 181/256)
+data8 0x3FE1365252BF0865    //log(1/frcpa(1+ 182/256)
+data8 0x3FE14AE558B4A92D    //log(1/frcpa(1+ 183/256)
+data8 0x3FE15F85A19C765B    //log(1/frcpa(1+ 184/256)
+data8 0x3FE16D4D38C119FA    //log(1/frcpa(1+ 185/256)
+data8 0x3FE18203C20DD133    //log(1/frcpa(1+ 186/256)
+data8 0x3FE196C7BC4B1F3B    //log(1/frcpa(1+ 187/256)
+data8 0x3FE1A4A738B7A33C    //log(1/frcpa(1+ 188/256)
+data8 0x3FE1B981C0C9653D    //log(1/frcpa(1+ 189/256)
+data8 0x3FE1CE69E8BB106B    //log(1/frcpa(1+ 190/256)
+data8 0x3FE1DC619DE06944    //log(1/frcpa(1+ 191/256)
+data8 0x3FE1F160A2AD0DA4    //log(1/frcpa(1+ 192/256)
+data8 0x3FE2066D7740737E    //log(1/frcpa(1+ 193/256)
+data8 0x3FE2147DBA47A394    //log(1/frcpa(1+ 194/256)
+data8 0x3FE229A1BC5EBAC3    //log(1/frcpa(1+ 195/256)
+data8 0x3FE237C1841A502E    //log(1/frcpa(1+ 196/256)
+data8 0x3FE24CFCE6F80D9A    //log(1/frcpa(1+ 197/256)
+data8 0x3FE25B2C55CD5762    //log(1/frcpa(1+ 198/256)
+data8 0x3FE2707F4D5F7C41    //log(1/frcpa(1+ 199/256)
+data8 0x3FE285E0842CA384    //log(1/frcpa(1+ 200/256)
+data8 0x3FE294294708B773    //log(1/frcpa(1+ 201/256)
+data8 0x3FE2A9A2670AFF0C    //log(1/frcpa(1+ 202/256)
+data8 0x3FE2B7FB2C8D1CC1    //log(1/frcpa(1+ 203/256)
+data8 0x3FE2C65A6395F5F5    //log(1/frcpa(1+ 204/256)
+data8 0x3FE2DBF557B0DF43    //log(1/frcpa(1+ 205/256)
+data8 0x3FE2EA64C3F97655    //log(1/frcpa(1+ 206/256)
+data8 0x3FE3001823684D73    //log(1/frcpa(1+ 207/256)
+data8 0x3FE30E97E9A8B5CD    //log(1/frcpa(1+ 208/256)
+data8 0x3FE32463EBDD34EA    //log(1/frcpa(1+ 209/256)
+data8 0x3FE332F4314AD796    //log(1/frcpa(1+ 210/256)
+data8 0x3FE348D90E7464D0    //log(1/frcpa(1+ 211/256)
+data8 0x3FE35779F8C43D6E    //log(1/frcpa(1+ 212/256)
+data8 0x3FE36621961A6A99    //log(1/frcpa(1+ 213/256)
+data8 0x3FE37C299F3C366A    //log(1/frcpa(1+ 214/256)
+data8 0x3FE38AE2171976E7    //log(1/frcpa(1+ 215/256)
+data8 0x3FE399A157A603E7    //log(1/frcpa(1+ 216/256)
+data8 0x3FE3AFCCFE77B9D1    //log(1/frcpa(1+ 217/256)
+data8 0x3FE3BE9D503533B5    //log(1/frcpa(1+ 218/256)
+data8 0x3FE3CD7480B4A8A3    //log(1/frcpa(1+ 219/256)
+data8 0x3FE3E3C43918F76C    //log(1/frcpa(1+ 220/256)
+data8 0x3FE3F2ACB27ED6C7    //log(1/frcpa(1+ 221/256)
+data8 0x3FE4019C2125CA93    //log(1/frcpa(1+ 222/256)
+data8 0x3FE4181061389722    //log(1/frcpa(1+ 223/256)
+data8 0x3FE42711518DF545    //log(1/frcpa(1+ 224/256)
+data8 0x3FE436194E12B6BF    //log(1/frcpa(1+ 225/256)
+data8 0x3FE445285D68EA69    //log(1/frcpa(1+ 226/256)
+data8 0x3FE45BCC464C893A    //log(1/frcpa(1+ 227/256)
+data8 0x3FE46AED21F117FC    //log(1/frcpa(1+ 228/256)
+data8 0x3FE47A1527E8A2D3    //log(1/frcpa(1+ 229/256)
+data8 0x3FE489445EFFFCCC    //log(1/frcpa(1+ 230/256)
+data8 0x3FE4A018BCB69835    //log(1/frcpa(1+ 231/256)
+data8 0x3FE4AF5A0C9D65D7    //log(1/frcpa(1+ 232/256)
+data8 0x3FE4BEA2A5BDBE87    //log(1/frcpa(1+ 233/256)
+data8 0x3FE4CDF28F10AC46    //log(1/frcpa(1+ 234/256)
+data8 0x3FE4DD49CF994058    //log(1/frcpa(1+ 235/256)
+data8 0x3FE4ECA86E64A684    //log(1/frcpa(1+ 236/256)
+data8 0x3FE503C43CD8EB68    //log(1/frcpa(1+ 237/256)
+data8 0x3FE513356667FC57    //log(1/frcpa(1+ 238/256)
+data8 0x3FE522AE0738A3D8    //log(1/frcpa(1+ 239/256)
+data8 0x3FE5322E26867857    //log(1/frcpa(1+ 240/256)
+data8 0x3FE541B5CB979809    //log(1/frcpa(1+ 241/256)
+data8 0x3FE55144FDBCBD62    //log(1/frcpa(1+ 242/256)
+data8 0x3FE560DBC45153C7    //log(1/frcpa(1+ 243/256)
+data8 0x3FE5707A26BB8C66    //log(1/frcpa(1+ 244/256)
+data8 0x3FE587F60ED5B900    //log(1/frcpa(1+ 245/256)
+data8 0x3FE597A7977C8F31    //log(1/frcpa(1+ 246/256)
+data8 0x3FE5A760D634BB8B    //log(1/frcpa(1+ 247/256)
+data8 0x3FE5B721D295F10F    //log(1/frcpa(1+ 248/256)
+data8 0x3FE5C6EA94431EF9    //log(1/frcpa(1+ 249/256)
+data8 0x3FE5D6BB22EA86F6    //log(1/frcpa(1+ 250/256)
+data8 0x3FE5E6938645D390    //log(1/frcpa(1+ 251/256)
+data8 0x3FE5F673C61A2ED2    //log(1/frcpa(1+ 252/256)
+data8 0x3FE6065BEA385926    //log(1/frcpa(1+ 253/256)
+data8 0x3FE6164BFA7CC06B    //log(1/frcpa(1+ 254/256)
+data8 0x3FE62643FECF9743    //log(1/frcpa(1+ 255/256)
+LOCAL_OBJECT_END(log_table_3)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(acoshf)
+
+{ .mfi
+      getf.exp   acosh_GR_f8 = f8
+      fclass.m   p6,p0 = f8, 0xc3                    // Test for x = NaN
+      mov        log_GR_comp2 = 0x10032
+}
+{ .mfi
+      addl       NR_table_address = @ltoff(log_table_1), gp
+      fms.s1     log_y = f8, f8, f1                  // y = x^2-1
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.sig   acosh_GR_f8_sig = f8
+      fclass.m   p11,p0 = f8, 0x21                   // Test for x=+inf
+      mov        log_GR_exp_17_ones = 0x1ffff
+}
+{ .mfi
+      ld8        NR_table_address = [NR_table_address]
+      fms.s1     log_w = f8,f1,f1                    // w = x - 1
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fcmp.lt.s1 p7,p8 = f8, f1            // Test for x<1.0
+      addl       log_GR_comp = 0x10020C,r0 // Upper 21 bits of signif of 1.0005
+}
+{ .mfb
+      mov        log_GR_exp_16_ones = 0xffff         //BIAS
+(p6)  fma.s.s0   f8 = f8,f1,f0      // quietize nan result if x=nan
+(p6)  br.ret.spnt b0                // Exit for x=nan
+}
+;;
+
+{ .mfb
+      //get second table address
+      adds       log_table_address2 = 0x20, NR_table_address
+      fcmp.eq.s1 p10,p0 = f8, f1      // Test for x=+1.0
+(p11) br.ret.spnt b0                  // Exit for x=+inf
+}
+;;
+
+{ .mfi
+      ldfpd      NR1,NR2 = [log_table_address2],16
+      frsqrta.s1 log_y_rs,p0 = log_y  // z=1/sqrt(y)
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+      fma.s1     log_arg = f8,f1,f8
+(p7)  br.cond.spnt ACOSH_LESS_ONE     // Branch if path 7, x < 1.0
+}
+;;
+
+{ .mfi
+      ldfe       log_C2 = [log_table_address2],16
+(p8)  fcmp.eq.s0 p6,p0 = f8, f0       // Dummy op sets denorm flag if unorm>=1.0
+      nop.i      0
+}
+{ .mfb
+(p8)  cmp.le.unc p13,p0 = log_GR_comp2,acosh_GR_f8
+      nop.f      0
+(p13) br.cond.spnt LOG_COMMON1        // Branch if path 4, x >= 2^51
+}
+;;
+
+{ .mfi
+      ldfe       log_C1 = [log_table_address2],16
+(p10) fmerge.s   f8 = f0, f0          // Return 0 if x=1.0
+      shr.u      acosh_GR_f8_sig = acosh_GR_f8_sig,43
+}
+{ .mib
+      cmp.eq     p14,p0 = log_GR_exp_16_ones,acosh_GR_f8
+      nop.i      0
+(p10) br.ret.spnt b0                  // Exit for x=1.0
+}
+;;
+
+{ .mfi
+      ldfe       log_C0 = [log_table_address2],16
+      frsqrta.s1 acosh_w_rs,p0 = log_w // t=1/sqrt(w)
+      nop.i      0
+}
+{ .mfb
+(p14) cmp.lt.unc p15,p0 = acosh_GR_f8_sig,log_GR_comp
+      nop.f      0
+(p15) br.cond.spnt ACOSH_NEAR_ONE     // Branch if path 2, 1.0 < x < 1.0005
+}
+;;
+
+// Here is main path, 1.0005 <= x < 2^51
+/////////////// The first iteration //////////////////////////////////
+{ .mfi
+      ldfpd      log_P3,log_P2 = [NR_table_address],16
+      fma.s1     log_y_rs_iter = log_y_rs,log_y,f0              // y*z
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfpd      log_P1,log2 = [NR_table_address],16
+      fnma.s1    log_y_rs_iter2 = log_y_rs_iter,log_y_rs,NR2    // 3-(y*z)*z
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs,NR1,f0               // 0.5*z
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      // (0.5*z)*(3-(y*z)*z)
+      fma.s1     log_y_rs_iter = log_y_rs_iter1,log_y_rs_iter2,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      // (0.5*z)*(3-(y*z)*z)
+      fma.s1     log_arg_early = log_y_rs_iter1,log_y_rs_iter2,f0
+      nop.i      0
+}
+;;
+
+/////////////////////////// The second iteration /////////////////////////////
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs = log_y_rs_iter,log_y,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_arg_early = log_arg_early,log_y,f8
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    log_y_rs = log_y_rs,log_y_rs_iter,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter1,log_y,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      frcpa.s1   log_C,p0 = f1,log_arg_early
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.exp   log_GR_signexp_f8 = log_arg_early
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.sig   log_GR_significand_f8 = log_arg_early
+      fma.s1     log_arg = log_y_rs_iter1,log_y_rs,f8 // (0.5*z)*(3-(y*z)*z)
+      adds       log_table_address3 = 0x40, NR_table_address
+}
+;;
+
+///////////////////////////////// The end NR iterations /////////////////////
+
+{ .mmi
+      //significant bit destruction
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+;;
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+      nop.i      0
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      fms.s1     log_r = log_C,log_arg,f1  // C = frcpa(x); r = C * x - 1
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*8 + index
+      shladd     log_table_address3 = log_GR_index,3,log_table_address3
+;;
+      ldfd       log_T = [log_table_address3]
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0         //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2 //P3*r + P2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_P1, log_r, f1     //P1*r + 1.0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format log_Nfloat
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //(P3*r + P2)*r^2 + P1*r + 1.0
+      fma.s1     log_rp_p2 = log_rp_p32, log_rsq, log_rp_p10
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T    //N*log2 + T
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fma.s.s0   f8 = log_rp_p2,log_r,log_T_plus_Nlog2
+      br.ret.sptk b0          // Exit main path, path 3: 1.0005 <= x < 2^51
+}
+;;
+
+// Here if path 2, 1.0 < x < 1.0005
+ACOSH_NEAR_ONE:
+// The first NR iteration
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter1 = acosh_w_rs,log_w,f0  //t*w
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_1 = f8,log_C2,log_C1         //x*C2 + C1
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter2 = acosh_w_rs,NR1,f0    //t*0.5
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fnma.s1    acosh_w_iter1 = acosh_w_iter1,acosh_w_rs,NR2 //3-t*t*w
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //(3-t*t*w)*t*0.5
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,acosh_w_iter1,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_1 = acosh_w_1,log_w,log_C0 //(x*C2 + C1)*(x-1) + C0
+      nop.i      0
+}
+;;
+
+// The second NR iteration
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_rs = acosh_w_iter2,log_w,f0  //t*w
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    acosh_w_iter1 = acosh_w_iter2,acosh_w_rs,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_iter2 = acosh_w_iter2,acosh_w_iter1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     acosh_w_sqrt = acosh_w_iter2,log_w,f0
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fma.s.s0   f8 = acosh_w_1,acosh_w_sqrt,f0
+      br.ret.sptk b0          // Exit path 2, 1.0 < x < 1.0005
+}
+;;
+
+// Here if path 4, x >= 2^51
+LOG_COMMON1:
+{ .mfi
+      ldfpd      log_P3,log_P2 = [NR_table_address],16
+      frcpa.s1   log_C,p0 = f1,log_arg
+      nop.i      0
+}
+;;
+
+{ .mmi
+      getf.exp   log_GR_signexp_f8 = log_arg
+      ldfpd      log_P1,log2 = [NR_table_address],16
+      nop.i      0
+}
+;;
+
+{ .mmi
+      getf.sig   log_GR_significand_f8 = log_arg
+      nop.m      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      adds       log_table_address3 = 0x40, NR_table_address
+      nop.f      0
+      //significant bit destruction
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+}
+;;
+
+{ .mmf
+      nop.m      0
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+      fms.s1     log_r = log_C,log_arg,f1  // C = frcpa(x); r = C * x - 1
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      nop.f      0
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*8 + index
+      shladd     log_table_address3 = log_GR_index,3,log_table_address3
+;;
+      ldfd       log_T = [log_table_address3]
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0         //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2 //P3*r + P2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_P1, log_r, f1     //P1*r + 1.0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format log_Nfloat
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p2 = log_rp_p32, log_rsq, log_rp_p10
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T    //N*log2 + T
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fma.s.s0   f8 = log_rp_p2,log_r,log_T_plus_Nlog2
+      br.ret.sptk b0        // Exit path 4, x >= 2^51
+}
+;;
+
+// Here if path 7, x < 1.0
+ACOSH_LESS_ONE:
+{ .mfi
+      alloc      r32 = ar.pfs,1,3,4,0
+      fmerge.s   f10 = f8,f8
+      nop.i      0
+}
+;;
+
+{ .mfb
+      mov        acosh_GR_tag = 137
+      frcpa.s0   f8,p0 = f0,f0
+      br.cond.sptk __libm_error_region
+}
+;;
+
+GLOBAL_LIBM_END(acoshf)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+{ .mmi
+        stfs [GR_Parameter_Y] = f1,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+{ .mib
+        stfs [GR_Parameter_X] = f10           // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+        nop.b 0
+}
+{ .mib
+        stfs [GR_Parameter_Y] = f8            // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support# // Call error handling function
+};;
+
+{ .mmi
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
+};;
+
+{ .mmi
+        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_acoshl.S b/sysdeps/ia64/fpu/e_acoshl.S
new file mode 100644
index 0000000000..42e1f394ef
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_acoshl.S
@@ -0,0 +1,1716 @@
+.file "acoshl.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History: 
+// 10/01/01 Initial version
+// 10/10/01 Performance inproved
+// 12/11/01 Changed huges_logp to not be global
+// 01/02/02 Corrected .restore syntax
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 08/14/02 Changed mli templates to mlx
+// 02/06/03 Reorganized data tables
+// 03/31/05 Reformatted delimiters between data tables
+//
+//*********************************************************************
+//
+// API
+//==============================================================
+// long double acoshl(long double);
+//
+// Overview of operation
+//==============================================================
+// 
+// There are 6 paths:
+// 1. x = 1
+//    Return acoshl(x) = 0;
+//
+// 2. x < 1
+//    Return acoshl(x) = Nan (Domain error, error handler call with tag 135);
+//
+// 3. x = [S,Q]Nan or +INF
+//    Return acoshl(x) = x + x;
+// 
+// 4. 'Near 1': 1 < x < 1+1/8
+//    Return acoshl(x) = sqrtl(2*y)*(1-P(y)/Q(y)), 
+//                   where y = 1, P(y)/Q(y) - rational approximation
+//
+// 5. 'Huges': x > 0.5*2^64
+//    Return acoshl(x) = (logl(2*x-1));
+//                    
+// 6. 'Main path': 1+1/8 < x < 0.5*2^64
+//    b_hi + b_lo = x + sqrt(x^2 - 1);
+//    acoshl(x) = logl_special(b_hi, b_lo);
+//  
+// Algorithm description                                                      
+//==============================================================
+//
+// I. Near 1 path algorithm
+// **************************************************************
+// The formula is acoshl(x) = sqrtl(2*y)*(1-P(y)/Q(y)), 
+//                 where y = 1, P(y)/Q(y) - rational approximation
+//
+// 1) y = x - 1, y2 = 2 * y
+//
+// 2) Compute in parallel sqrtl(2*y) and P(y)/Q(y)
+//    a) sqrtl computation method described below (main path algorithm, item 2))
+//       As result we obtain (gg+gl) - multiprecision result 
+//       as pair of double extended values
+//    b) P(y) and Q(y) calculated without any extra precision manipulations
+//    c) P/Q division:
+//       y = frcpa(Q)         initial approximation of 1/Q
+//       z = P*y              initial approximation of P/Q
+//     
+//       e = 1 - b*y
+//       e2 = e + e^2
+//       e1 = e^2
+//       y1 = y + y*e2 = y + y*(e+e^2)
+//
+//       e3 = e + e1^2
+//       y2 = y + y1*e3 = y + y*(e+e^2+..+e^6)
+//
+//       r = P - Q*z
+//       e = 1 - Q*y2
+//       xx = z + r*y2         high part of a/b
+//
+//       y3 = y2 + y2*e4
+//       r1 = P  - Q*xx
+//       xl = r1*y3            low part of a/b
+//
+// 3) res = sqrt(2*y) - sqrt(2*y)*(P(y)/Q(y)) =
+//        = (gg+gl) - (gg + gl)*(xx+xl);
+//
+//    a) hh = gg*xx; hl = gg*xl; lh = gl*xx; ll = gl*xl;
+//    b) res = ((((gl + ll) + lh) + hl) + hh) + gg;
+//       (exactly in this order)
+//
+// II. Main path algorithm 
+// ( thanks to Peter Markstein for the idea of sqrt(x^2+1) computation! )
+// **********************************************************************
+//
+// There are 3 parts of x+sqrt(x^2-1) computation:
+//
+//  1) m2 = (m2_hi+m2_lo) = x^2-1 obtaining
+//     ------------------------------------
+//     m2_hi = x2_hi - 1, where x2_hi = x * x;
+//     m2_lo = x2_lo + p1_lo, where 
+//                            x2_lo = FMS(x*x-x2_hi), 
+//                            p1_lo = (1 + m2_hi) - x2_hi;
+//
+//  2) g = (g_hi+g_lo) = sqrt(m2) = sqrt(m2_hi+m2_lo)
+//     ----------------------------------------------
+//     r = invsqrt(m2_hi) (8-bit reciprocal square root approximation);
+//     g = m2_hi * r (first 8 bit-approximation of sqrt);
+//     
+//     h = 0.5 * r;
+//     e = 0.5 - g * h;
+//     g = g * e + g (second 16 bit-approximation of sqrt);
+//     
+//     h = h * e + h;
+//     e = 0.5 - g * h;
+//     g = g * e + g (third 32 bit-approximation of sqrt);
+//
+//     h = h * e + h;
+//     e = 0.5 - g * h;
+//     g_hi = g * e + g (fourth 64 bit-approximation of sqrt);
+//  
+//     Remainder computation:
+//     h = h * e + h;
+//     d = (m2_hi - g_hi * g_hi) + m2_lo;
+//     g_lo = d * h;
+//
+//  3) b = (b_hi + b_lo) = x + g, where g = (g_hi + g_lo) = sqrt(x^2-1)
+//     -------------------------------------------------------------------
+//     b_hi = (g_hi + x) + gl;
+//     b_lo = (x - b_hi) + g_hi + gl;
+//     
+//  Now we pass b presented as sum b_hi + b_lo to special version
+//  of logl function which accept a pair of arguments as
+//  mutiprecision value.   
+//  
+//  Special log algorithm overview
+//  ================================
+//   Here we use a table lookup method. The basic idea is that in
+//   order to compute logl(Arg) for an argument Arg in [1,2), 
+//   we construct a value G such that G*Arg is close to 1 and that
+//   logl(1/G) is obtainable easily from a table of values calculated
+//   beforehand. Thus
+//
+//      logl(Arg) = logl(1/G) + logl((G*Arg - 1))
+//
+//   Because |G*Arg - 1| is small, the second term on the right hand
+//   side can be approximated by a short polynomial. We elaborate
+//   this method in four steps.
+//
+//   Step 0: Initialization
+//
+//   We need to calculate logl( X+1 ). Obtain N, S_hi such that
+//
+//      X = 2^N * ( S_hi + S_lo )   exactly
+//
+//   where S_hi in [1,2) and S_lo is a correction to S_hi in the sense
+//   that |S_lo| <= ulp(S_hi).
+//
+//   For the special version of logl: S_lo = b_lo
+//   !-----------------------------------------------!
+//
+//   Step 1: Argument Reduction
+//
+//   Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
+//
+//      G := G_1 * G_2 * G_3
+//      r := (G * S_hi - 1) + G * S_lo
+//
+//   These G_j's have the property that the product is exactly 
+//   representable and that |r| < 2^(-12) as a result.
+//
+//   Step 2: Approximation
+//
+//   logl(1 + r) is approximated by a short polynomial poly(r).
+//
+//   Step 3: Reconstruction
+//
+//   Finally, logl( X ) = logl( X+1 ) is given by
+//
+//   logl( X )   =   logl( 2^N * (S_hi + S_lo) )
+//                 ~=~  N*logl(2) + logl(1/G) + logl(1 + r)
+//                 ~=~  N*logl(2) + logl(1/G) + poly(r).
+//
+//   For detailed description see logl or log1pl function, regular path.
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input
+// f32 -> f95 (64 registers)
+
+// General registers used:  
+// r32 -> r67 (36 registers)
+
+// Predicate registers used:
+// p7 -> p11
+// p7  for 'NaNs, Inf' path
+// p8  for 'near 1' path
+// p9  for 'huges' path
+// p10 for x = 1 
+// p11 for x < 1
+//
+//*********************************************************************
+// IEEE Special Conditions:
+//
+//    acoshl(+inf)  = +inf
+//    acoshl(-inf) = QNaN 
+//    acoshl(1)    = 0 
+//    acoshl(x<1)  = QNaN
+//    acoshl(SNaN) = QNaN
+//    acoshl(QNaN) = QNaN
+//
+
+// Data tables
+//==============================================================
+     
+RODATA
+.align 64
+
+// Near 1 path rational aproximation coefficients
+LOCAL_OBJECT_START(Poly_P)
+data8 0xB0978143F695D40F, 0x3FF1  // .84205539791447100108478906277453574946e-4  
+data8 0xB9800D841A8CAD29, 0x3FF6  // .28305085180397409672905983082168721069e-2  
+data8 0xC889F455758C1725, 0x3FF9  // .24479844297887530847660233111267222945e-1  
+data8 0x9BE1DFF006F45F12, 0x3FFB  // .76114415657565879842941751209926938306e-1  
+data8 0x9E34AF4D372861E0, 0x3FFB  // .77248925727776366270605984806795850504e-1  
+data8 0xF3DC502AEE14C4AE, 0x3FA6  // .3077953476682583606615438814166025592e-26  
+LOCAL_OBJECT_END(Poly_P)
+
+//
+LOCAL_OBJECT_START(Poly_Q)
+data8 0xF76E3FD3C7680357, 0x3FF1  // .11798413344703621030038719253730708525e-3  
+data8 0xD107D2E7273263AE, 0x3FF7  // .63791065024872525660782716786703188820e-2  
+data8 0xB609BE5CDE206AEF, 0x3FFB  // .88885771950814004376363335821980079985e-1  
+data8 0xF7DEACAC28067C8A, 0x3FFD  // .48412074662702495416825113623936037072302  
+data8 0x8F9BE5890CEC7E38, 0x3FFF  // 1.1219450873557867470217771071068369729526  
+data8 0xED4F06F3D2BC92D1, 0x3FFE  // .92698710873331639524734537734804056798748  
+LOCAL_OBJECT_END(Poly_Q)
+
+// Q coeffs 
+LOCAL_OBJECT_START(Constants_Q)
+data4  0x00000000,0xB1721800,0x00003FFE,0x00000000 
+data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
+data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000
+data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000
+data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000
+data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000 
+LOCAL_OBJECT_END(Constants_Q)
+
+// Z1 - 16 bit fixed
+LOCAL_OBJECT_START(Constants_Z_1)
+data4  0x00008000
+data4  0x00007879
+data4  0x000071C8
+data4  0x00006BCB
+data4  0x00006667
+data4  0x00006187
+data4  0x00005D18
+data4  0x0000590C
+data4  0x00005556
+data4  0x000051EC
+data4  0x00004EC5
+data4  0x00004BDB
+data4  0x00004925
+data4  0x0000469F
+data4  0x00004445
+data4  0x00004211
+LOCAL_OBJECT_END(Constants_Z_1)
+
+// G1 and H1 - IEEE single and h1 - IEEE double
+LOCAL_OBJECT_START(Constants_G_H_h1)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F70F0F0,0x3D785196
+data8  0x3DA163A6617D741C
+data4  0x3F638E38,0x3DF13843
+data8  0x3E2C55E6CBD3D5BB
+data4  0x3F579430,0x3E2FF9A0
+data8  0xBE3EB0BFD86EA5E7
+data4  0x3F4CCCC8,0x3E647FD6
+data8  0x3E2E6A8C86B12760
+data4  0x3F430C30,0x3E8B3AE7
+data8  0x3E47574C5C0739BA
+data4  0x3F3A2E88,0x3EA30C68
+data8  0x3E20E30F13E8AF2F
+data4  0x3F321640,0x3EB9CEC8
+data8  0xBE42885BF2C630BD
+data4  0x3F2AAAA8,0x3ECF9927
+data8  0x3E497F3497E577C6
+data4  0x3F23D708,0x3EE47FC5
+data8  0x3E3E6A6EA6B0A5AB
+data4  0x3F1D89D8,0x3EF8947D
+data8  0xBDF43E3CD328D9BE
+data4  0x3F17B420,0x3F05F3A1
+data8  0x3E4094C30ADB090A
+data4  0x3F124920,0x3F0F4303
+data8  0xBE28FBB2FC1FE510
+data4  0x3F0D3DC8,0x3F183EBF
+data8  0x3E3A789510FDE3FA
+data4  0x3F088888,0x3F20EC80
+data8  0x3E508CE57CC8C98F
+data4  0x3F042108,0x3F29516A
+data8  0xBE534874A223106C
+LOCAL_OBJECT_END(Constants_G_H_h1)
+
+// Z2 - 16 bit fixed
+LOCAL_OBJECT_START(Constants_Z_2)
+data4  0x00008000
+data4  0x00007F81
+data4  0x00007F02
+data4  0x00007E85
+data4  0x00007E08
+data4  0x00007D8D
+data4  0x00007D12
+data4  0x00007C98
+data4  0x00007C20
+data4  0x00007BA8
+data4  0x00007B31
+data4  0x00007ABB
+data4  0x00007A45
+data4  0x000079D1
+data4  0x0000795D
+data4  0x000078EB
+LOCAL_OBJECT_END(Constants_Z_2)
+
+// G2 and H2 - IEEE single and h2 - IEEE double
+LOCAL_OBJECT_START(Constants_G_H_h2)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F7F00F8,0x3B7F875D
+data8  0x3DB5A11622C42273
+data4  0x3F7E03F8,0x3BFF015B
+data8  0x3DE620CF21F86ED3
+data4  0x3F7D08E0,0x3C3EE393
+data8  0xBDAFA07E484F34ED
+data4  0x3F7C0FC0,0x3C7E0586
+data8  0xBDFE07F03860BCF6
+data4  0x3F7B1880,0x3C9E75D2
+data8  0x3DEA370FA78093D6
+data4  0x3F7A2328,0x3CBDC97A
+data8  0x3DFF579172A753D0
+data4  0x3F792FB0,0x3CDCFE47
+data8  0x3DFEBE6CA7EF896B
+data4  0x3F783E08,0x3CFC15D0
+data8  0x3E0CF156409ECB43
+data4  0x3F774E38,0x3D0D874D
+data8  0xBE0B6F97FFEF71DF
+data4  0x3F766038,0x3D1CF49B
+data8  0xBE0804835D59EEE8
+data4  0x3F757400,0x3D2C531D
+data8  0x3E1F91E9A9192A74
+data4  0x3F748988,0x3D3BA322
+data8  0xBE139A06BF72A8CD
+data4  0x3F73A0D0,0x3D4AE46F
+data8  0x3E1D9202F8FBA6CF
+data4  0x3F72B9D0,0x3D5A1756
+data8  0xBE1DCCC4BA796223
+data4  0x3F71D488,0x3D693B9D
+data8  0xBE049391B6B7C239
+LOCAL_OBJECT_END(Constants_G_H_h2)
+
+// G3 and H3 - IEEE single and h3 - IEEE double 
+LOCAL_OBJECT_START(Constants_G_H_h3)
+data4  0x3F7FFC00,0x38800100
+data8  0x3D355595562224CD
+data4  0x3F7FF400,0x39400480
+data8  0x3D8200A206136FF6
+data4  0x3F7FEC00,0x39A00640
+data8  0x3DA4D68DE8DE9AF0
+data4  0x3F7FE400,0x39E00C41
+data8  0xBD8B4291B10238DC
+data4  0x3F7FDC00,0x3A100A21
+data8  0xBD89CCB83B1952CA
+data4  0x3F7FD400,0x3A300F22
+data8  0xBDB107071DC46826
+data4  0x3F7FCC08,0x3A4FF51C
+data8  0x3DB6FCB9F43307DB
+data4  0x3F7FC408,0x3A6FFC1D
+data8  0xBD9B7C4762DC7872
+data4  0x3F7FBC10,0x3A87F20B
+data8  0xBDC3725E3F89154A
+data4  0x3F7FB410,0x3A97F68B
+data8  0xBD93519D62B9D392
+data4  0x3F7FAC18,0x3AA7EB86
+data8  0x3DC184410F21BD9D
+data4  0x3F7FA420,0x3AB7E101
+data8  0xBDA64B952245E0A6
+data4  0x3F7F9C20,0x3AC7E701
+data8  0x3DB4B0ECAABB34B8
+data4  0x3F7F9428,0x3AD7DD7B
+data8  0x3D9923376DC40A7E
+data4  0x3F7F8C30,0x3AE7D474
+data8  0x3DC6E17B4F2083D3
+data4  0x3F7F8438,0x3AF7CBED
+data8  0x3DAE314B811D4394
+data4  0x3F7F7C40,0x3B03E1F3
+data8  0xBDD46F21B08F2DB1
+data4  0x3F7F7448,0x3B0BDE2F
+data8  0xBDDC30A46D34522B
+data4  0x3F7F6C50,0x3B13DAAA
+data8  0x3DCB0070B1F473DB
+data4  0x3F7F6458,0x3B1BD766
+data8  0xBDD65DDC6AD282FD
+data4  0x3F7F5C68,0x3B23CC5C
+data8  0xBDCDAB83F153761A
+data4  0x3F7F5470,0x3B2BC997
+data8  0xBDDADA40341D0F8F
+data4  0x3F7F4C78,0x3B33C711
+data8  0x3DCD1BD7EBC394E8
+data4  0x3F7F4488,0x3B3BBCC6
+data8  0xBDC3532B52E3E695
+data4  0x3F7F3C90,0x3B43BAC0
+data8  0xBDA3961EE846B3DE
+data4  0x3F7F34A0,0x3B4BB0F4
+data8  0xBDDADF06785778D4
+data4  0x3F7F2CA8,0x3B53AF6D
+data8  0x3DCC3ED1E55CE212
+data4  0x3F7F24B8,0x3B5BA620
+data8  0xBDBA31039E382C15
+data4  0x3F7F1CC8,0x3B639D12
+data8  0x3D635A0B5C5AF197
+data4  0x3F7F14D8,0x3B6B9444
+data8  0xBDDCCB1971D34EFC
+data4  0x3F7F0CE0,0x3B7393BC
+data8  0x3DC7450252CD7ADA
+data4  0x3F7F04F0,0x3B7B8B6D
+data8  0xBDB68F177D7F2A42
+LOCAL_OBJECT_END(Constants_G_H_h3)
+
+// Assembly macros
+//==============================================================
+
+// Floating Point Registers
+
+FR_Arg          = f8
+FR_Res          = f8
+
+
+FR_PP0          = f32
+FR_PP1          = f33
+FR_PP2          = f34
+FR_PP3          = f35
+FR_PP4          = f36
+FR_PP5          = f37
+FR_QQ0          = f38
+FR_QQ1          = f39
+FR_QQ2          = f40
+FR_QQ3          = f41
+FR_QQ4          = f42
+FR_QQ5          = f43
+
+FR_Q1           = f44 
+FR_Q2           = f45 
+FR_Q3           = f46  
+FR_Q4           = f47 
+
+FR_Half         = f48
+FR_Two          = f49
+
+FR_log2_hi      = f50  
+FR_log2_lo      = f51  
+
+
+FR_X2           = f52
+FR_M2           = f53
+FR_M2L          = f54
+FR_Rcp          = f55
+FR_GG           = f56
+FR_HH           = f57
+FR_EE           = f58
+FR_DD           = f59
+FR_GL           = f60
+FR_Tmp          = f61
+
+
+FR_XM1          = f62
+FR_2XM1         = f63
+FR_XM12         = f64
+
+
+
+    // Special logl registers
+FR_XLog_Hi      = f65 
+FR_XLog_Lo      = f66 
+
+FR_Y_hi         = f67  
+FR_Y_lo         = f68
+
+FR_S_hi         = f69  
+FR_S_lo         = f70 
+
+FR_poly_lo      = f71
+FR_poly_hi      = f72
+
+FR_G            = f73
+FR_H            = f74
+FR_h            = f75
+
+FR_G2           = f76
+FR_H2           = f77
+FR_h2           = f78 
+
+FR_r            = f79  
+FR_rsq          = f80  
+FR_rcub         = f81 
+
+FR_float_N      = f82 
+
+FR_G3           = f83  
+FR_H3           = f84  
+FR_h3           = f85  
+
+FR_2_to_minus_N = f86 
+
+
+   // Near 1  registers
+FR_PP           = f65
+FR_QQ           = f66
+
+
+FR_PV6          = f69
+FR_PV4          = f70
+FR_PV3          = f71
+FR_PV2          = f72
+
+FR_QV6          = f73
+FR_QV4          = f74
+FR_QV3          = f75
+FR_QV2          = f76
+
+FR_Y0           = f77
+FR_Q0           = f78  
+FR_E0           = f79
+FR_E2           = f80
+FR_E1           = f81
+FR_Y1           = f82
+FR_E3           = f83
+FR_Y2           = f84
+FR_R0           = f85
+FR_E4           = f86
+FR_Y3           = f87
+FR_R1           = f88
+FR_X_Hi         = f89
+FR_X_lo         = f90
+
+FR_HH           = f91
+FR_LL           = f92
+FR_HL           = f93
+FR_LH           = f94
+
+
+
+	// Error handler registers
+FR_Arg_X        = f95
+FR_Arg_Y        = f0
+
+
+// General Purpose Registers
+
+    // General prolog registers
+GR_PFS          = r32
+GR_OneP125      = r33
+GR_TwoP63       = r34
+GR_Arg          = r35
+GR_Half         = r36
+
+    // Near 1 path registers
+GR_Poly_P       = r37
+GR_Poly_Q       = r38
+
+    // Special logl registers
+GR_Index1       = r39 
+GR_Index2       = r40 
+GR_signif       = r41 
+GR_X_0          = r42 
+GR_X_1          = r43 
+GR_X_2          = r44 
+GR_minus_N      = r45
+GR_Z_1          = r46 
+GR_Z_2          = r47 
+GR_N            = r48 
+GR_Bias         = r49 
+GR_M            = r50 
+GR_Index3       = r51 
+GR_exp_2tom80   = r52 
+GR_exp_mask     = r53 
+GR_exp_2tom7    = r54 
+GR_ad_ln10      = r55 
+GR_ad_tbl_1     = r56
+GR_ad_tbl_2     = r57
+GR_ad_tbl_3     = r58
+GR_ad_q         = r59
+GR_ad_z_1       = r60
+GR_ad_z_2       = r61
+GR_ad_z_3       = r62
+
+//
+// Added for unwind support
+//
+GR_SAVE_PFS         = r32
+GR_SAVE_B0          = r33
+GR_SAVE_GP          = r34
+
+GR_Parameter_X      = r64
+GR_Parameter_Y      = r65
+GR_Parameter_RESULT = r66
+GR_Parameter_TAG    = r67
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(acoshl)
+
+{ .mfi
+      alloc      GR_PFS       = ar.pfs,0,32,4,0     // Local frame allocation
+      fcmp.lt.s1 p11, p0      = FR_Arg, f1          // if arg is less than 1
+      mov	     GR_Half      = 0xfffe              // 0.5's exp
+}
+{ .mfi
+      addl       GR_Poly_Q    = @ltoff(Poly_Q), gp  // Address of Q-coeff table
+      fma.s1     FR_X2        = FR_Arg, FR_Arg, f0  // Obtain x^2
+      addl       GR_Poly_P    = @ltoff(Poly_P), gp  // Address of P-coeff table
+};; 
+
+{ .mfi 
+      getf.d     GR_Arg       = FR_Arg        // get arument as double (int64)
+      fma.s0        FR_Two       = f1, f1, f1    // construct 2.0
+      addl       GR_ad_z_1    = @ltoff(Constants_Z_1#),gp // logl tables
+}
+{ .mlx 
+      nop.m 0  
+      movl       GR_TwoP63    = 0x43E8000000000000 // 0.5*2^63 (huge arguments)
+};; 
+
+{ .mfi 
+      ld8        GR_Poly_P    = [GR_Poly_P]  // get actual P-coeff table address
+      fcmp.eq.s1 p10, p0      = FR_Arg, f1   // if arg == 1 (return 0)
+      nop.i 0
+}
+{ .mlx   
+      ld8        GR_Poly_Q    = [GR_Poly_Q]  // get actual Q-coeff table address
+      movl       GR_OneP125   = 0x3FF2000000000000  // 1.125 (near 1 path bound)
+};;
+
+{ .mfi   
+      ld8        GR_ad_z_1    = [GR_ad_z_1]      // Get pointer to Constants_Z_1
+      fclass.m   p7,p0        = FR_Arg, 0xe3       // if arg NaN inf
+      cmp.le     p9, p0       = GR_TwoP63, GR_Arg // if arg > 0.5*2^63 ('huges')
+}
+{ .mfb
+      cmp.ge     p8, p0       = GR_OneP125, GR_Arg // if arg<1.125 -near 1 path
+	  fms.s1     FR_XM1       = FR_Arg, f1, f1     // X0 = X-1 (for near 1 path)
+(p11) br.cond.spnt acoshl_lt_pone                  // error branch (less than 1)
+};; 
+
+{ .mmi   
+      setf.exp	FR_Half       = GR_Half     // construct 0.5
+(p9)  setf.s    FR_XLog_Lo    = r0          // Low of logl arg=0 (Huges path)
+      mov        GR_exp_mask  = 0x1FFFF         // Create exponent mask
+};; 
+
+{ .mmf   
+(p8)  ldfe       FR_PP5       = [GR_Poly_P],16     // Load P5
+(p8)  ldfe       FR_QQ5       = [GR_Poly_Q],16     // Load Q5
+      fms.s1     FR_M2        = FR_X2, f1, f1      // m2 = x^2 - 1
+};;
+
+{ .mfi 
+(p8)  ldfe       FR_QQ4       = [GR_Poly_Q],16         // Load Q4
+      fms.s1     FR_M2L       = FR_Arg, FR_Arg, FR_X2  // low part of 
+	                                                   //    m2 = fma(X*X - m2)
+      add        GR_ad_tbl_1  = 0x040, GR_ad_z_1    // Point to Constants_G_H_h1
+}
+{ .mfb
+(p8)  ldfe       FR_PP4       = [GR_Poly_P],16     // Load P4 
+(p7)  fma.s0     FR_Res       = FR_Arg,f1,FR_Arg   // r = a + a (Nan, Inf)
+(p7)  br.ret.spnt b0                               // return    (Nan, Inf)
+};; 
+
+{ .mfi
+(p8)  ldfe       FR_PP3       = [GR_Poly_P],16      // Load P3
+      nop.f 0
+      add        GR_ad_q      = -0x60, GR_ad_z_1    // Point to Constants_P
+}
+{ .mfb
+(p8)  ldfe       FR_QQ3       = [GR_Poly_Q],16      // Load Q3
+(p9)  fms.s1 FR_XLog_Hi       = FR_Two, FR_Arg, f1  // Hi  of log arg = 2*X-1
+(p9)  br.cond.spnt huges_logl                       // special version of log
+}
+;; 
+
+{ .mfi   
+(p8)  ldfe       FR_PP2       = [GR_Poly_P],16       // Load P2
+(p8)  fma.s1     FR_2XM1      = FR_Two, FR_XM1, f0   // 2X0 = 2 * X0
+      add        GR_ad_z_2    = 0x140, GR_ad_z_1    // Point to Constants_Z_2
+}
+{ .mfb
+(p8)  ldfe       FR_QQ2       = [GR_Poly_Q],16       // Load Q2
+(p10) fma.s0   FR_Res         = f0,f1,f0             // r = 0  (arg = 1)
+(p10) br.ret.spnt b0                                 // return (arg = 1)       
+};; 
+
+{ .mmi 
+(p8)  ldfe       FR_PP1       = [GR_Poly_P],16       // Load P1
+(p8)  ldfe       FR_QQ1       = [GR_Poly_Q],16       // Load Q1
+      add        GR_ad_tbl_2  = 0x180, GR_ad_z_1    // Point to Constants_G_H_h2
+}
+;;
+
+{ .mfi   
+(p8)  ldfe       FR_PP0       = [GR_Poly_P]          // Load P0 
+      fma.s1     FR_Tmp       = f1, f1, FR_M2        // Tmp = 1 + m2
+      add        GR_ad_tbl_3  = 0x280, GR_ad_z_1    // Point to Constants_G_H_h3
+}
+{ .mfb
+(p8)  ldfe       FR_QQ0       = [GR_Poly_Q]
+      nop.f 0
+(p8)  br.cond.spnt near_1                            // near 1 path
+};; 
+{ .mfi   
+      ldfe       FR_log2_hi   = [GR_ad_q],16      // Load log2_hi
+      nop.f 0
+      mov        GR_Bias      = 0x0FFFF                  // Create exponent bias
+};;
+{ .mfi 
+      nop.m 0
+      frsqrta.s1 FR_Rcp, p0   = FR_M2           // Rcp = 1/m2 reciprocal appr.
+      nop.i 0
+};; 
+
+{ .mfi
+      ldfe       FR_log2_lo   = [GR_ad_q],16     // Load log2_lo
+      fms.s1     FR_Tmp       = FR_X2, f1, FR_Tmp  // Tmp =  x^2 - Tmp
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe       FR_Q4        = [GR_ad_q],16          // Load Q4
+      fma.s1     FR_GG        = FR_Rcp, FR_M2, f0   // g = Rcp * m2
+                                               // 8 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_HH 		  = FR_Half, FR_Rcp, f0      // h = 0.5 * Rcp
+      nop.i 0
+};;
+{ .mfi
+      ldfe       FR_Q3        = [GR_ad_q],16   // Load Q3
+      fnma.s1    FR_EE        = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h
+      nop.i 0
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_M2L       = FR_Tmp, f1, FR_M2L  // low part of m2 = Tmp+m2l
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe       FR_Q2        = [GR_ad_q],16      // Load Q2
+      fma.s1     FR_GG        = FR_GG, FR_EE, FR_GG     // g = g * e + g 
+                                              // 16 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1     FR_HH        = FR_HH, FR_EE, FR_HH     // h = h * e + h
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe       FR_Q1        = [GR_ad_q]                // Load Q1
+      fnma.s1    FR_EE        = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h
+      nop.i 0
+};;
+{ .mfi
+      nop.m 0
+      fma.s1    FR_GG         = FR_GG, FR_EE, FR_GG     // g = g * e + g 
+                                              // 32 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_HH         = FR_HH, FR_EE, FR_HH     // h = h * e + h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fnma.s1   FR_EE         = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_GG         = FR_GG, FR_EE, FR_GG     // g = g * e + g 
+                                              // 64 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_HH         = FR_HH, FR_EE, FR_HH     // h = h * e + h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fnma.s1   FR_DD         = FR_GG, FR_GG, FR_M2  // Remainder d = g * g - p2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_XLog_Hi     = FR_Arg, f1, FR_GG // bh = z + gh
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_DD         = FR_DD, f1, FR_M2L       // add p2l: d = d + p2l
+      nop.i 0
+};;
+
+{ .mfi
+      getf.sig  GR_signif     = FR_XLog_Hi     // Get significand of x+1
+      nop.f 0
+      mov       GR_exp_2tom7  = 0x0fff8        // Exponent of 2^-7
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_GL         = FR_DD, FR_HH, f0        // gl = d * h
+      extr.u    GR_Index1     = GR_signif, 59, 4    // Get high 4 bits of signif
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_XLog_Hi     = FR_DD,  FR_HH, FR_XLog_Hi // bh = bh + gl
+      nop.i 0
+};;
+
+
+
+{ .mmi
+      shladd    GR_ad_z_1     = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      shladd    GR_ad_tbl_1   = GR_Index1, 4, GR_ad_tbl_1  // Point to G_1
+      extr.u    GR_X_0        = GR_signif, 49, 15 // Get high 15 bits of signif.
+};;
+
+{ .mmi
+      ld4       GR_Z_1        = [GR_ad_z_1]    // Load Z_1
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmi
+      ldfps     FR_G, FR_H    = [GR_ad_tbl_1],8     // Load G_1, H_1
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1    FR_XLog_Lo     = FR_Arg,  f1,   FR_XLog_Hi // bl = x - bh
+      pmpyshr2.u GR_X_1       = GR_X_0,GR_Z_1,15  // Get bits 30-15 of X_0 * Z_1
+};;
+
+// WE CANNOT USE GR_X_1 IN NEXT 3 CYCLES BECAUSE OF POSSIBLE 10 CLOCKS STALL!
+// "DEAD" ZONE!
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fmerge.se FR_S_hi       =  f1,FR_XLog_Hi            // Form |x+1|
+      nop.i 0
+};;
+
+
+{ .mmi
+      getf.exp  GR_N          =  FR_XLog_Hi    // Get N = exponent of x+1
+      ldfd      FR_h          = [GR_ad_tbl_1]        // Load h_1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      extr.u    GR_Index2     = GR_X_1, 6, 4      // Extract bits 6-9 of X_1 
+};;
+
+{ .mfi
+      shladd    GR_ad_tbl_2   = GR_Index2, 4, GR_ad_tbl_2  // Point to G_2
+      fma.s1    FR_XLog_Lo    = FR_XLog_Lo, f1, FR_GG // bl = bl + gg
+      mov       GR_exp_2tom80 = 0x0ffaf           // Exponent of 2^-80
+}
+{ .mfi
+      shladd    GR_ad_z_2     = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+      nop.f 0
+      sub       GR_N          = GR_N, GR_Bias // sub bias from exp
+};;
+
+{ .mmi
+      ldfps     FR_G2, FR_H2  = [GR_ad_tbl_2],8       // Load G_2, H_2
+      ld4       GR_Z_2        = [GR_ad_z_2]                // Load Z_2
+      sub       GR_minus_N    = GR_Bias, GR_N         // Form exponent of 2^(-N)
+};;
+
+{ .mmi
+      ldfd      FR_h2         = [GR_ad_tbl_2]             // Load h_2
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmi
+      setf.sig  FR_float_N    = GR_N        // Put integer N into rightmost sign
+      setf.exp  FR_2_to_minus_N = GR_minus_N   // Form 2^(-N)
+      pmpyshr2.u GR_X_2       = GR_X_1,GR_Z_2,15 // Get bits 30-15 of X_1 * Z_2
+};;
+
+// WE CANNOT USE GR_X_2 IN NEXT 3 CYCLES ("DEAD" ZONE!) 
+// BECAUSE OF POSSIBLE 10 CLOCKS STALL!
+// (Just nops added - nothing to do here)
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_XLog_Lo     = FR_XLog_Lo, f1, FR_GL // bl = bl + gl
+      nop.i 0
+};;
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      extr.u    GR_Index3     = GR_X_2, 1, 5         // Extract bits 1-5 of X_2
+};;
+
+{ .mfi
+      shladd    GR_ad_tbl_3   = GR_Index3, 4, GR_ad_tbl_3  // Point to G_3
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfps     FR_G3, FR_H3  = [GR_ad_tbl_3],8   // Load G_3, H_3
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfd      FR_h3         = [GR_ad_tbl_3]            // Load h_3
+	  fcvt.xf   FR_float_N    = FR_float_N
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_G          = FR_G, FR_G2              // G = G_1 * G_2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_H          = FR_H, FR_H2              // H = H_1 + H_2
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_h          = FR_h, FR_h2              // h = h_1 + h_2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_S_lo     = FR_XLog_Lo, FR_2_to_minus_N, f0 //S_lo=S_lo*2^(-N)
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_G          = FR_G, FR_G3             // G = (G_1 * G_2) * G_3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_H          = FR_H, FR_H3             // H = (H_1 + H_2) + H_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_h          = FR_h, FR_h3             // h = (h_1 + h_2) + h_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1    FR_r          = FR_G, FR_S_hi, f1           // r = G * S_hi - 1
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_Y_hi       = FR_float_N, FR_log2_hi, FR_H // Y_hi=N*log2_hi+H
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_h          = FR_float_N, FR_log2_lo, FR_h  // h=N*log2_lo+h
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_r          = FR_G, FR_S_lo, FR_r  // r=G*S_lo+(G*S_hi-1)
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_lo    = FR_r, FR_Q4, FR_Q3      // poly_lo = r * Q4 + Q3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_rsq        = FR_r, FR_r              // rsq = r * r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_lo    = FR_poly_lo, FR_r, FR_Q2 // poly_lo=poly_lo*r+Q2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_rcub       = FR_rsq, FR_r, f0        // rcub = r^3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_hi    = FR_Q1, FR_rsq, FR_r // poly_hi = Q1*rsq + r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_lo    = FR_poly_lo, FR_rcub, FR_h//poly_lo=poly_lo*r^3+h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s0   FR_Y_lo       = FR_poly_hi, FR_poly_lo  
+	                                                     // Y_lo=poly_hi+poly_lo
+      nop.i 0
+};;
+
+{ .mfb
+      nop.m 0
+      fadd.s0   FR_Res        = FR_Y_lo,FR_Y_hi    // Result=Y_lo+Y_hi
+      br.ret.sptk   b0                         // Common exit for 2^-7 < x < inf
+};;
+
+
+huges_logl:
+{ .mmi
+      getf.sig   GR_signif    = FR_XLog_Hi               // Get significand of x+1
+      mov        GR_exp_2tom7 = 0x0fff8            // Exponent of 2^-7
+      nop.i 0
+};;
+
+{ .mfi
+      add        GR_ad_tbl_1  = 0x040, GR_ad_z_1    // Point to Constants_G_H_h1
+      nop.f 0
+      add        GR_ad_q      = -0x60, GR_ad_z_1    // Point to Constants_P
+}
+{ .mfi
+      add        GR_ad_z_2    = 0x140, GR_ad_z_1    // Point to Constants_Z_2
+      nop.f 0
+      add        GR_ad_tbl_2  = 0x180, GR_ad_z_1    // Point to Constants_G_H_h2
+};;
+
+{ .mfi
+      add        GR_ad_tbl_3  = 0x280, GR_ad_z_1    // Point to Constants_G_H_h3
+      nop.f 0
+      extr.u     GR_Index1    = GR_signif, 59, 4    // Get high 4 bits of signif
+};;
+
+{ .mfi
+      shladd     GR_ad_z_1    = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      nop.f 0
+      extr.u     GR_X_0       = GR_signif, 49, 15 // Get high 15 bits of signif.
+};;
+
+{ .mfi
+      ld4        GR_Z_1       = [GR_ad_z_1]     // Load Z_1
+      nop.f 0
+      mov        GR_exp_mask  = 0x1FFFF         // Create exponent mask
+}
+{ .mfi
+      shladd     GR_ad_tbl_1  = GR_Index1, 4, GR_ad_tbl_1 // Point to G_1
+      nop.f 0
+      mov        GR_Bias      = 0x0FFFF                  // Create exponent bias
+};;
+
+{ .mfi
+      ldfps      FR_G, FR_H   = [GR_ad_tbl_1],8     // Load G_1, H_1
+      fmerge.se  FR_S_hi      =  f1,FR_XLog_Hi            // Form |x|
+      nop.i 0
+};;
+
+{ .mmi
+      getf.exp   GR_N         =  FR_XLog_Hi         // Get N = exponent of x+1
+      ldfd       FR_h         = [GR_ad_tbl_1] // Load h_1
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe       FR_log2_hi   = [GR_ad_q],16      // Load log2_hi
+      nop.f 0
+      pmpyshr2.u GR_X_1       = GR_X_0,GR_Z_1,15  // Get bits 30-15 of X_0 * Z_1
+};;
+
+{ .mmi
+      ldfe       FR_log2_lo   = [GR_ad_q],16     // Load log2_lo
+      sub        GR_N         = GR_N, GR_Bias 
+      mov        GR_exp_2tom80 = 0x0ffaf         // Exponent of 2^-80
+};;
+
+{ .mfi
+      ldfe       FR_Q4        = [GR_ad_q],16          // Load Q4
+      nop.f 0
+      sub        GR_minus_N   = GR_Bias, GR_N         // Form exponent of 2^(-N)
+};;
+
+{ .mmf
+      ldfe       FR_Q3        = [GR_ad_q],16   // Load Q3
+      setf.sig   FR_float_N   = GR_N        // Put integer N into rightmost sign
+      nop.f 0
+};;
+
+{ .mmi
+      ldfe       FR_Q2        = [GR_ad_q],16      // Load Q2
+	  nop.m 0
+      extr.u     GR_Index2    = GR_X_1, 6, 4      // Extract bits 6-9 of X_1 
+};;
+
+{ .mmi
+      ldfe       FR_Q1        = [GR_ad_q]                // Load Q1
+      shladd     GR_ad_z_2    = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+      nop.i 0
+};;
+
+{ .mmi
+      ld4        GR_Z_2       = [GR_ad_z_2]                // Load Z_2
+      shladd     GR_ad_tbl_2  = GR_Index2, 4, GR_ad_tbl_2  // Point to G_2
+	  nop.i 0
+};;
+
+{ .mmi
+      ldfps      FR_G2, FR_H2 = [GR_ad_tbl_2],8       // Load G_2, H_2
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmf
+      ldfd       FR_h2        = [GR_ad_tbl_2]         // Load h_2
+      setf.exp FR_2_to_minus_N = GR_minus_N   // Form 2^(-N)
+      nop.f 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      pmpyshr2.u GR_X_2       = GR_X_1,GR_Z_2,15   // Get bits 30-15 of X_1*Z_2
+};;
+
+// WE CANNOT USE GR_X_2 IN NEXT 3 CYCLES ("DEAD" ZONE!) 
+// BECAUSE OF POSSIBLE 10 CLOCKS STALL!
+// (Just nops added - nothing to do here)
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      extr.u     GR_Index3    = GR_X_2, 1, 5          // Extract bits 1-5 of X_2
+};;
+
+{ .mfi
+      shladd     GR_ad_tbl_3  = GR_Index3, 4, GR_ad_tbl_3  // Point to G_3
+	  fcvt.xf    FR_float_N   = FR_float_N
+      nop.i 0
+};;
+
+{ .mfi
+      ldfps      FR_G3, FR_H3 = [GR_ad_tbl_3],8   // Load G_3, H_3
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfd       FR_h3        = [GR_ad_tbl_3]            // Load h_3
+      fmpy.s1    FR_G         = FR_G, FR_G2              // G = G_1 * G_2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1    FR_H         = FR_H, FR_H2              // H = H_1 + H_2
+      nop.i 0
+};;
+
+{ .mmf
+      nop.m 0
+      nop.m 0
+      fadd.s1    FR_h         = FR_h, FR_h2              // h = h_1 + h_2
+};;
+
+{ .mfi
+      nop.m 0
+      fmpy.s1    FR_G         = FR_G, FR_G3              // G = (G_1 * G_2)*G_3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1    FR_H         = FR_H, FR_H3              // H = (H_1 + H_2)+H_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s1    FR_h         = FR_h, FR_h3            // h = (h_1 + h_2) + h_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1     FR_r         = FR_G, FR_S_hi, f1           // r = G * S_hi - 1
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1     FR_Y_hi      = FR_float_N, FR_log2_hi, FR_H // Y_hi=N*log2_hi+H
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1     FR_h         = FR_float_N, FR_log2_lo, FR_h  // h = N*log2_lo+h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1     FR_poly_lo   = FR_r, FR_Q4, FR_Q3      // poly_lo = r * Q4 + Q3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fmpy.s1    FR_rsq       = FR_r, FR_r              // rsq = r * r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1     FR_poly_lo   = FR_poly_lo, FR_r, FR_Q2 // poly_lo=poly_lo*r+Q2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1     FR_rcub      = FR_rsq, FR_r, f0        // rcub = r^3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1     FR_poly_hi   = FR_Q1, FR_rsq, FR_r     // poly_hi = Q1*rsq + r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1     FR_poly_lo   = FR_poly_lo, FR_rcub, FR_h//poly_lo=poly_lo*r^3+h
+      nop.i 0
+};;
+{ .mfi
+      nop.m 0
+      fadd.s0    FR_Y_lo      = FR_poly_hi, FR_poly_lo  // Y_lo=poly_hi+poly_lo 
+      nop.i 0
+};;
+{ .mfb
+      nop.m 0
+      fadd.s0    FR_Res       = FR_Y_lo,FR_Y_hi    // Result=Y_lo+Y_hi
+      br.ret.sptk   b0                        // Common exit
+};;
+
+
+// NEAR ONE INTERVAL
+near_1:
+{ .mfi 
+      nop.m 0  
+      frsqrta.s1 FR_Rcp, p0   = FR_2XM1 // Rcp = 1/x reciprocal appr. &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi 
+      nop.m 0  
+      fma.s1     FR_PV6       = FR_PP5, FR_XM1, FR_PP4 // pv6 = P5*xm1+P4 $POLY$
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+	  fma.s1     FR_QV6       = FR_QQ5, FR_XM1, FR_QQ4 // qv6 = Q5*xm1+Q4 $POLY$
+      nop.i 0  
+};;
+
+{ .mfi 
+      nop.m 0  
+	  fma.s1     FR_PV4       = FR_PP3, FR_XM1, FR_PP2 // pv4 = P3*xm1+P2 $POLY$
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+	  fma.s1     FR_QV4       = FR_QQ3, FR_XM1, FR_QQ2 // qv4 = Q3*xm1+Q2 $POLY$
+      nop.i 0  
+};;
+
+{ .mfi 
+      nop.m 0  
+	  fma.s1     FR_XM12      = FR_XM1, FR_XM1, f0 // xm1^2 = xm1 * xm1 $POLY$
+      nop.i 0  
+};;
+
+{ .mfi 
+      nop.m 0  
+	  fma.s1     FR_PV2       = FR_PP1, FR_XM1, FR_PP0 // pv2 = P1*xm1+P0 $POLY$
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+	  fma.s1     FR_QV2       = FR_QQ1, FR_XM1, FR_QQ0 // qv2 = Q1*xm1+Q0 $POLY$
+      nop.i 0  
+};;
+
+{ .mfi 
+      nop.m 0  
+      fma.s1     FR_GG        = FR_Rcp, FR_2XM1, f0 // g = Rcp * x &SQRT&                
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_HH        = FR_Half, FR_Rcp, f0 // h = 0.5 * Rcp &SQRT&
+      nop.i 0  
+};;
+
+
+{ .mfi 
+      nop.m 0  
+	  fma.s1    FR_PV3       = FR_XM12, FR_PV6, FR_PV4//pv3=pv6*xm1^2+pv4 $POLY$
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+	  fma.s1    FR_QV3       = FR_XM12, FR_QV6, FR_QV4//qv3=qv6*xm1^2+qv4 $POLY$
+      nop.i 0  
+};;
+
+
+{ .mfi 
+      nop.m 0  
+      fnma.s1   FR_EE        = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi 
+      nop.m 0  
+	  fma.s1    FR_PP        = FR_XM12, FR_PV3, FR_PV2 //pp=pv3*xm1^2+pv2 $POLY$
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+	  fma.s1    FR_QQ        = FR_XM12, FR_QV3, FR_QV2 //qq=qv3*xm1^2+qv2 $POLY$
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_GG        = FR_GG, FR_EE, FR_GG  // g = g * e + g &SQRT&
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_HH        = FR_HH, FR_EE, FR_HH  // h = h * e + h &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      frcpa.s1   FR_Y0,p0     = f1,FR_QQ // y = frcpa(b)  #DIV#
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fnma.s1    FR_EE        = FR_GG, FR_HH, FR_Half // e = 0.5 - g*h &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_Q0        = FR_PP,FR_Y0,f0 // q = a*y  #DIV#
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fnma.s1    FR_E0        = FR_Y0,FR_QQ,f1 // e = 1 - b*y  #DIV#
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_GG        = FR_GG, FR_EE, FR_GG // g = g * e + g &SQRT&             
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_HH        = FR_HH, FR_EE, FR_HH // h = h * e + h &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_E2        = FR_E0,FR_E0,FR_E0 // e2 = e+e^2 #DIV#
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_E1        = FR_E0,FR_E0,f0 // e1 = e^2 #DIV#
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fnma.s1   FR_EE        = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h &SQRT&
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+	  fnma.s1   FR_DD        = FR_GG, FR_GG, FR_2XM1   // d = x - g * g &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_Y1        = FR_Y0,FR_E2,FR_Y0 // y1 = y+y*e2 #DIV#
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_E3        = FR_E1,FR_E1,FR_E0 // e3 = e+e1^2 #DIV#
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_GG        = FR_DD, FR_HH, FR_GG // g = d * h + g &SQRT&
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_HH        = FR_HH, FR_EE, FR_HH // h = h * e + h &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_Y2        = FR_Y1,FR_E3,FR_Y0 // y2 = y+y1*e3 #DIV#
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fnma.s1    FR_R0        = FR_QQ,FR_Q0,FR_PP // r = a-b*q #DIV#
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fnma.s1    FR_DD        = FR_GG, FR_GG, FR_2XM1 // d = x - g * g &SQRT&             
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fnma.s1    FR_E4        = FR_QQ,FR_Y2,f1    // e4 = 1-b*y2 #DIV#
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_X_Hi      = FR_R0,FR_Y2,FR_Q0 // x = q+r*y2 #DIV#
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_GL        = FR_DD, FR_HH, f0   // gl = d * h &SQRT&
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_Y3        = FR_Y2,FR_E4,FR_Y2 // y3 = y2+y2*e4 #DIV#
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fnma.s1    FR_R1        = FR_QQ,FR_X_Hi,FR_PP // r1 = a-b*x #DIV#
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_HH        = FR_GG, FR_X_Hi, f0 // hh = gg * x_hi
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_LH        = FR_GL, FR_X_Hi, f0 // lh = gl * x_hi
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_X_lo      = FR_R1,FR_Y3,f0 // x_lo = r1*y3 #DIV#
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_LL        = FR_GL, FR_X_lo, f0 // ll = gl*x_lo
+      nop.i 0  
+}
+{ .mfi
+      nop.m 0  
+      fma.s1     FR_HL        = FR_GG, FR_X_lo, f0 // hl = gg * x_lo
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+	  fms.s1     FR_Res       = FR_GL,  f1, FR_LL // res = gl + ll
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+	  fms.s1     FR_Res       = FR_Res, f1, FR_LH // res = res + lh
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+	  fms.s1     FR_Res       = FR_Res, f1, FR_HL // res = res + hl
+      nop.i 0  
+};;
+
+{ .mfi
+      nop.m 0  
+	  fms.s1     FR_Res       = FR_Res, f1, FR_HH // res = res + hh
+      nop.i 0  
+};;
+
+{ .mfb
+      nop.m 0  
+	  fma.s0     FR_Res       = FR_Res, f1, FR_GG  // result = res + gg
+      br.ret.sptk   b0                     // Exit for near 1 path
+};;
+// NEAR ONE INTERVAL END
+
+
+
+
+acoshl_lt_pone:
+{ .mfi
+      nop.m 0  
+      fmerge.s   FR_Arg_X            = FR_Arg, FR_Arg
+      nop.i 0  
+};;
+{ .mfb
+      mov        GR_Parameter_TAG    = 135
+      frcpa.s0   FR_Res,p0           = f0,f0 // get QNaN,and raise invalid
+      br.cond.sptk  __libm_error_region      // exit if x < 1.0
+};;
+
+GLOBAL_LIBM_END(acoshl)
+
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add      GR_Parameter_Y      = -32,sp        // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov      GR_SAVE_PFS         = ar.pfs        // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add      sp                  = -64,sp        // Create new stack
+        nop.f 0
+        mov      GR_SAVE_GP          = gp            // Save gp
+};;
+
+{ .mmi
+        stfe     [GR_Parameter_Y]    = FR_Arg_Y,16   // Parameter 2 to stack
+        add      GR_Parameter_X      = 16,sp         // Parameter 1 address
+.save   b0,GR_SAVE_B0
+        mov      GR_SAVE_B0          = b0            // Save b0
+};;
+
+.body
+{ .mib
+        stfe     [GR_Parameter_X]    = FR_Arg_X         // Parameter 1 to stack
+        add      GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+        nop.b 0                                 
+}
+{ .mib
+        stfe     [GR_Parameter_Y]    = FR_Res        // Parameter 3 to stack
+        add      GR_Parameter_Y      = -16,GR_Parameter_Y
+        br.call.sptk b0 = __libm_error_support#      // Error handling function
+};;
+
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add      GR_Parameter_RESULT = 48,sp
+};;
+
+{ .mmi
+        ldfe     f8                  = [GR_Parameter_RESULT]  // Get return res
+.restore sp
+        add      sp                  = 64,sp       // Restore stack pointer
+        mov      b0                  = GR_SAVE_B0  // Restore return address
+};;
+
+{ .mib
+        mov      gp                  = GR_SAVE_GP  // Restore gp
+        mov      ar.pfs              = GR_SAVE_PFS // Restore ar.pfs
+        br.ret.sptk b0                             // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region#)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
+
+
diff --git a/sysdeps/ia64/fpu/e_acosl.S b/sysdeps/ia64/fpu/e_acosl.S
index ab1bbf41a7..4fd345bedd 100644
--- a/sysdeps/ia64/fpu/e_acosl.S
+++ b/sysdeps/ia64/fpu/e_acosl.S
@@ -1,10 +1,10 @@
 .file "acosl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2001 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1027 +20,2470 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version 
-// 2/07/00  Modified calculation of acos_corr to correct acosl
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
-//          set [the previously overwritten] GR_Parameter_RESULT.
-// 12/20/00 Set denormal flag properly.
+// 08/28/01 New version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
-// double-extended = acosl (double-extended)
-// input  floating point f8
-// output floating point f8
+// long double acosl(long double)
 //
-// Registers used
+// Overview of operation
 //==============================================================
+// Background
 //
-// predicate registers used:
-// p6 -> p12
+// Implementation
 //
-// floating-point registers used:
-// f8 has input, then output
-// f8 -> f15, f32 ->f99
+// For |s| in [2^{-4}, sqrt(2)/2]:
+// Let t= 2^k*1.b1 b2..b6 1, where s= 2^k*1.b1 b2.. b52
+// acos(s)= pi/2-asin(t)-asin(r), where r= s*sqrt(1-t^2)-t*sqrt(1-s^2), i.e.
+// r= (s-t)*sqrt(1-t^2)-t*sqrt(1-t^2)*(sqrt((1-s^2)/(1-t^2))-1)
+// asin(r)-r evaluated as 9-degree polynomial (c3*r^3+c5*r^5+c7*r^7+c9*r^9)
+// The 64-bit significands of sqrt(1-t^2), 1/(1-t^2) are read from the table,
+// along with the high and low parts of asin(t) (stored as two double precision
+// values)
 //
-// general registers used:
-// r32 -> r48
+// |s| in (sqrt(2)/2, sqrt(255/256)):
+// Let t= 2^k*1.b1 b2..b6 1, where (1-s^2)*frsqrta(1-s^2)= 2^k*1.b1 b2..b6..
+// acos(|s|)= asin(t)-asin(r)
+// acos(-|s|)=pi-asin(t)+asin(r),   r= s*t-sqrt(1-s^2)*sqrt(1-t^2)
+// To minimize accumulated errors, r is computed as
+// r= (t*s)_s-t^2*y*z+z*y*(t^2-1+s^2)_s+z*y*(1-s^2)_s*x+z'*y*(1-s^2)*PS29+
+// +(t*s-(t*s)_s)+z*y*((t^2-1-(t^2-1+s^2)_s)+s^2)+z*y*(1-s^2-(1-s^2)_s)+
+// +ez*z'*y*(1-s^2)*(1-x),
+// where y= frsqrta(1-s^2), z= (sqrt(1-t^2))_s (rounded to 24 significant bits)
+// z'= sqrt(1-t^2), x= ((1-s^2)*y^2-1)/2
+//
+// |s|<2^{-4}: evaluate asin(s) as 17-degree polynomial, return pi/2-asin(s)
+// (or simply return pi/2-s, if|s|<2^{-64})
+//
+// |s| in [sqrt(255/256), 1): acos(|s|)= asin(sqrt(1-s^2))
+// acos(-|s|)= pi-asin(sqrt(1-s^2))
+// use 17-degree polynomial for asin(sqrt(1-s^2)),
+// 9-degree polynomial to evaluate sqrt(1-s^2)
+// High order term is (pi)_high-(y*(1-s^2))_high, for s<0,
+// or y*(1-s^2)_s, for s>0
 //
-// Overview of operation
-//==============================================================
-// There are three paths
-// 1. |x| < 2^-25                 ACOS_TINY
-// 2. 2^-25 <= |x| < 1/4          ACOS_POLY
-// 3. 1/4 <= |x| < 1              ACOS_ATAN
 
-#include "libm_support.h"
 
-// Assembly macros
+
+// Registers used
 //==============================================================
+// f6-f15, f32-f36
+// r2-r3, r23-r23
+// p6, p7, p8, p12
+//
 
-// f8 is input, but acos_V must be put in f8
-//    when __libm_atan2_reg is called, f8 must get V
-// f9 gets U when __libm_atan2_reg is called
 
+       GR_SAVE_B0= r33
+       GR_SAVE_PFS= r34
+       GR_SAVE_GP= r35 // This reg. can safely be used
+       GR_SAVE_SP= r36
 
-// __libm_atan2_reg returns 
-// f8  = Z_hi
-// f10 = Z_lo
-// f11 = s_lo
+       GR_Parameter_X= r37
+       GR_Parameter_Y= r38
+       GR_Parameter_RESULT= r39
+       GR_Parameter_TAG= r40
 
-acos_Z_hi = f8
-acos_Z_lo = f10
-acos_S_lo = f11
+       FR_X= f10
+       FR_Y= f1
+       FR_RESULT= f8
 
-// When we call __libm_atan2_reg, we must save 
-// the following:
 
-acos_corr  = f12
-acos_X     = f13
-acos_pi_hi = f14
-acos_pi_lo = f15
 
-// The rest of the assembly macros
-
-acos_P79                   = f32
-acos_P59                   = f33
-acos_P39                   = f34
-acos_P19                   = f35
+RODATA
 
-acos_P810                  = f36
-acos_P610                  = f37
-acos_P410                  = f38
-acos_P210                  = f39
+.align 16
 
-acos_A1                    = f41
-acos_A2                    = f42
-acos_A3                    = f43
-acos_A4                    = f44
-acos_A5                    = f45
-acos_A6                    = f46
-acos_A7                    = f47
-acos_A8                    = f48
-acos_A9                    = f49
-acos_A10                   = f50
+LOCAL_OBJECT_START(T_table)
+
+// stores 64-bit significand of 1/(1-t^2), 64-bit significand of sqrt(1-t^2),
+// asin(t)_high (double precision), asin(t)_low (double precision)
+
+data8 0x80828692b71c4391, 0xff7ddcec2d87e879
+data8 0x3fb022bc0ae531a0, 0x3c9f599c7bb42af6
+data8 0x80869f0163d0b082, 0xff79cad2247914d3
+data8 0x3fb062dd26afc320, 0x3ca4eff21bd49c5c
+data8 0x808ac7d5a8690705, 0xff75a89ed6b626b9
+data8 0x3fb0a2ff4a1821e0, 0x3cb7e33b58f164cc
+data8 0x808f0112ad8ad2e0, 0xff7176517c2cc0cb
+data8 0x3fb0e32279319d80, 0x3caee31546582c43
+data8 0x80934abba8a1da0a, 0xff6d33e949b1ed31
+data8 0x3fb12346b8101da0, 0x3cb8bfe463d087cd
+data8 0x8097a4d3dbe63d8f, 0xff68e16571015c63
+data8 0x3fb1636c0ac824e0, 0x3c8870a7c5a3556f
+data8 0x809c0f5e9662b3dd, 0xff647ec520bca0f0
+data8 0x3fb1a392756ed280, 0x3c964f1a927461ae
+data8 0x80a08a5f33fadc66, 0xff600c07846a6830
+data8 0x3fb1e3b9fc19e580, 0x3c69eb3576d56332
+data8 0x80a515d91d71acd4, 0xff5b892bc475affa
+data8 0x3fb223e2a2dfbe80, 0x3c6a4e19fd972fb6
+data8 0x80a9b1cfc86ff7cd, 0xff56f631062cf93d
+data8 0x3fb2640c6dd76260, 0x3c62041160e0849e
+data8 0x80ae5e46b78b0d68, 0xff5253166bc17794
+data8 0x3fb2a43761187c80, 0x3cac61651af678c0
+data8 0x80b31b417a4b756b, 0xff4d9fdb14463dc8
+data8 0x3fb2e46380bb6160, 0x3cb06ef23eeba7a1
+data8 0x80b7e8c3ad33c369, 0xff48dc7e1baf6738
+data8 0x3fb32490d0d910c0, 0x3caa05f480b300d5
+data8 0x80bcc6d0f9c784d6, 0xff4408fe9ad13e37
+data8 0x3fb364bf558b3820, 0x3cb01e7e403aaab9
+data8 0x80c1b56d1692492d, 0xff3f255ba75f5f4e
+data8 0x3fb3a4ef12ec3540, 0x3cb4fe8fcdf5f5f1
+data8 0x80c6b49bc72ec446, 0xff3a319453ebd961
+data8 0x3fb3e5200d171880, 0x3caf2dc089b2b7e2
+data8 0x80cbc460dc4e0ae8, 0xff352da7afe64ac6
+data8 0x3fb425524827a720, 0x3cb75a855e7c6053
+data8 0x80d0e4c033bee9c4, 0xff301994c79afb32
+data8 0x3fb46585c83a5e00, 0x3cb3264981c019ab
+data8 0x80d615bdb87556db, 0xff2af55aa431f291
+data8 0x3fb4a5ba916c73c0, 0x3c994251d94427b5
+data8 0x80db575d6291fd8a, 0xff25c0f84bae0cb9
+data8 0x3fb4e5f0a7dbdb20, 0x3cbee2fcc4c786cb
+data8 0x80e0a9a33769e535, 0xff207c6cc0ec09fd
+data8 0x3fb526280fa74620, 0x3c940656e5549b91
+data8 0x80e60c93498e32cd, 0xff1b27b703a19c98
+data8 0x3fb56660ccee2740, 0x3ca7082374d7b2cd
+data8 0x80eb8031b8d4052d, 0xff15c2d6105c72f8
+data8 0x3fb5a69ae3d0b520, 0x3c7c4d46e09ac68a
+data8 0x80f10482b25c6c8a, 0xff104dc8e0813ed4
+data8 0x3fb5e6d6586fec20, 0x3c9aa84ffd9b4958
+data8 0x80f6998a709c7cfb, 0xff0ac88e6a4ab926
+data8 0x3fb627132eed9140, 0x3cbced2cbbbe7d16
+data8 0x80fc3f4d3b657c44, 0xff053325a0c8a2ec
+data8 0x3fb667516b6c34c0, 0x3c6489c5fc68595a
+data8 0x8101f5cf67ed2af8, 0xfeff8d8d73dec2bb
+data8 0x3fb6a791120f33a0, 0x3cbe12acf159dfad
+data8 0x8107bd1558d6291f, 0xfef9d7c4d043df29
+data8 0x3fb6e7d226fabba0, 0x3ca386d099cd0dc7
+data8 0x810d95237e38766a, 0xfef411ca9f80b5f7
+data8 0x3fb72814ae53cc20, 0x3cb9f35731e71dd6
+data8 0x81137dfe55aa0e29, 0xfeee3b9dc7eef009
+data8 0x3fb76858ac403a00, 0x3c74df3dd959141a
+data8 0x811977aa6a479f0f, 0xfee8553d2cb8122c
+data8 0x3fb7a89e24e6b0e0, 0x3ca6034406ee42bc
+data8 0x811f822c54bd5ef8, 0xfee25ea7add46a91
+data8 0x3fb7e8e51c6eb6a0, 0x3cb82f8f78e68ed7
+data8 0x81259d88bb4ffac1, 0xfedc57dc2809fb1d
+data8 0x3fb8292d9700ad60, 0x3cbebb73c0e653f9
+data8 0x812bc9c451e5a257, 0xfed640d974eb6068
+data8 0x3fb8697798c5d620, 0x3ca2feee76a9701b
+data8 0x813206e3da0f3124, 0xfed0199e6ad6b585
+data8 0x3fb8a9c325e852e0, 0x3cb9e88f2f4d0efe
+data8 0x813854ec231172f9, 0xfec9e229dcf4747d
+data8 0x3fb8ea1042932a00, 0x3ca5ff40d81f66fd
+data8 0x813eb3e209ee858f, 0xfec39a7a9b36538b
+data8 0x3fb92a5ef2f247c0, 0x3cb5e3bece4d6b07
+data8 0x814523ca796f56ce, 0xfebd428f72561efe
+data8 0x3fb96aaf3b3281a0, 0x3cb7b9e499436d7c
+data8 0x814ba4aa6a2d3ff9, 0xfeb6da672bd48fe4
+data8 0x3fb9ab011f819860, 0x3cb9168143cc1a7f
+data8 0x81523686e29bbdd7, 0xfeb062008df81f50
+data8 0x3fb9eb54a40e3ac0, 0x3cb6e544197eb1e1
+data8 0x8158d964f7124614, 0xfea9d95a5bcbd65a
+data8 0x3fba2ba9cd080800, 0x3ca9a717be8f7446
+data8 0x815f8d49c9d639e4, 0xfea34073551e1ac8
+data8 0x3fba6c009e9f9260, 0x3c741e989a60938a
+data8 0x8166523a8b24f626, 0xfe9c974a367f785c
+data8 0x3fbaac591d0661a0, 0x3cb2c1290107e57d
+data8 0x816d283c793e0114, 0xfe95ddddb94166cb
+data8 0x3fbaecb34c6ef600, 0x3c9c7d5fbaec405d
+data8 0x81740f54e06d55bd, 0xfe8f142c93750c50
+data8 0x3fbb2d0f310cca00, 0x3cbc09479a9cbcfb
+data8 0x817b07891b15cd5e, 0xfe883a3577e9fceb
+data8 0x3fbb6d6ccf1455e0, 0x3cb9450bff4ee307
+data8 0x818210de91bba6c8, 0xfe814ff7162cf62f
+data8 0x3fbbadcc2abb1180, 0x3c9227fda12a8d24
+data8 0x81892b5abb0f2bf9, 0xfe7a55701a8697b1
+data8 0x3fbbee2d48377700, 0x3cb6fad72acfe356
+data8 0x819057031bf7760e, 0xfe734a9f2dfa1810
+data8 0x3fbc2e902bc10600, 0x3cb4465b588d16ad
+data8 0x819793dd479d4fbe, 0xfe6c2f82f643f68b
+data8 0x3fbc6ef4d9904580, 0x3c8b9ac54823960d
+data8 0x819ee1eedf76367a, 0xfe65041a15d8a92c
+data8 0x3fbcaf5b55dec6a0, 0x3ca2b8d28a954db2
+data8 0x81a6413d934f7a66, 0xfe5dc8632be3477f
+data8 0x3fbcefc3a4e727a0, 0x3c9380da83713ab4
+data8 0x81adb1cf21597d4b, 0xfe567c5cd44431d5
+data8 0x3fbd302dcae51600, 0x3ca995b83421756a
+data8 0x81b533a9563310b8, 0xfe4f2005a78fb50f
+data8 0x3fbd7099cc155180, 0x3caefa2f7a817d5f
+data8 0x81bcc6d20cf4f373, 0xfe47b35c3b0caaeb
+data8 0x3fbdb107acb5ae80, 0x3cb455fc372dd026
+data8 0x81c46b4f2f3d6e68, 0xfe40365f20b316d6
+data8 0x3fbdf177710518c0, 0x3cbee3dcc5b01434
+data8 0x81cc2126b53c1144, 0xfe38a90ce72abf36
+data8 0x3fbe31e91d439620, 0x3cb3e131c950aebd
+data8 0x81d3e85ea5bd8ee2, 0xfe310b6419c9c33a
+data8 0x3fbe725cb5b24900, 0x3c01d3fac6029027
+data8 0x81dbc0fd1637b9c1, 0xfe295d6340932d15
+data8 0x3fbeb2d23e937300, 0x3c6304cc44aeedd1
+data8 0x81e3ab082ad5a0a4, 0xfe219f08e03580b3
+data8 0x3fbef349bc2a77e0, 0x3cac1d2d6abe9c72
+data8 0x81eba6861683cb97, 0xfe19d0537a0946e2
+data8 0x3fbf33c332bbe020, 0x3ca0909dba4e96ca
+data8 0x81f3b37d1afc9979, 0xfe11f1418c0f94e2
+data8 0x3fbf743ea68d5b60, 0x3c937fc12a2a779a
+data8 0x81fbd1f388d4be45, 0xfe0a01d190f09063
+data8 0x3fbfb4bc1be5c340, 0x3cbf51a504b55813
+data8 0x820401efbf87e248, 0xfe020201fff9efea
+data8 0x3fbff53b970d1e80, 0x3ca625444b260078
+data8 0x82106ad2ffdca049, 0xfdf5e3940a49135e
+data8 0x3fc02aff52065460, 0x3c9125d113e22a57
+data8 0x8221343d6ea1d3e2, 0xfde581a45429b0a0
+data8 0x3fc06b84f8e03220, 0x3caccf362295894b
+data8 0x82324434adbf99c2, 0xfdd4de1a001fb775
+data8 0x3fc0ac0ed1fe7240, 0x3cc22f676096b0af
+data8 0x82439aee8d0c7747, 0xfdc3f8e8269d1f03
+data8 0x3fc0ec9cee9e4820, 0x3cca147e2886a628
+data8 0x825538a1d0fcb2f0, 0xfdb2d201a9b1ba66
+data8 0x3fc12d2f6006f0a0, 0x3cc72b36633bc2d4
+data8 0x82671d86345c5cee, 0xfda1695934d723e7
+data8 0x3fc16dc63789de60, 0x3cb11f9c47c7b83f
+data8 0x827949d46a121770, 0xfd8fbee13cbbb823
+data8 0x3fc1ae618682e620, 0x3cce1b59020cef8e
+data8 0x828bbdc61eeab9ba, 0xfd7dd28bff0c9f34
+data8 0x3fc1ef015e586c40, 0x3cafec043e0225ee
+data8 0x829e7995fb6de9e1, 0xfd6ba44b823ee1ca
+data8 0x3fc22fa5d07b90c0, 0x3cba905409caf8e3
+data8 0x82b17d7fa5bbc982, 0xfd5934119557883a
+data8 0x3fc2704eee685da0, 0x3cb5ef21838a823e
+data8 0x82c4c9bfc373d276, 0xfd4681cfcfb2c161
+data8 0x3fc2b0fcc9a5f3e0, 0x3ccc7952c5e0e312
+data8 0x82d85e93fba50136, 0xfd338d7790ca0f41
+data8 0x3fc2f1af73c6ba00, 0x3cbecf5f977d1ca9
+data8 0x82ec3c3af8c76b32, 0xfd2056f9fff97727
+data8 0x3fc33266fe6889a0, 0x3c9d329c022ebdb5
+data8 0x830062f46abf6022, 0xfd0cde480c43b327
+data8 0x3fc373237b34de60, 0x3cc95806d4928adb
+data8 0x8314d30108ea35f0, 0xfcf923526c1562b2
+data8 0x3fc3b3e4fbe10520, 0x3cbc299fe7223d54
+data8 0x83298ca29434df97, 0xfce526099d0737ed
+data8 0x3fc3f4ab922e4a60, 0x3cb59d8bb8fdbccc
+data8 0x833e901bd93c7009, 0xfcd0e65de39f1f7c
+data8 0x3fc435774fea2a60, 0x3c9ec18b43340914
+data8 0x8353ddb0b278aad8, 0xfcbc643f4b106055
+data8 0x3fc4764846ee80a0, 0x3cb90402efd87ed6
+data8 0x836975a60a70c52e, 0xfca79f9da4fab13a
+data8 0x3fc4b71e8921b860, 0xbc58f23449ed6365
+data8 0x837f5841ddfa7a46, 0xfc92986889284148
+data8 0x3fc4f7fa2876fca0, 0xbc6294812bf43acd
+data8 0x839585cb3e839773, 0xfc7d4e8f554ab12f
+data8 0x3fc538db36ee6960, 0x3cb910b773d4c578
+data8 0x83abfe8a5466246f, 0xfc67c2012cb6fa68
+data8 0x3fc579c1c6953cc0, 0x3cc5ede909fc47fc
+data8 0x83c2c2c861474d91, 0xfc51f2acf82041d5
+data8 0x3fc5baade9860880, 0x3cac63cdfc3588e5
+data8 0x83d9d2cfc2813637, 0xfc3be08165519325
+data8 0x3fc5fb9fb1e8e3a0, 0x3cbf7c8466578c29
+data8 0x83f12eebf397daac, 0xfc258b6ce6e6822f
+data8 0x3fc63c9731f39d40, 0x3cb6d2a7ffca3e9e
+data8 0x8408d76990b9296e, 0xfc0ef35db402af94
+data8 0x3fc67d947be9eec0, 0x3cb1980da09e6566
+data8 0x8420cc9659487cd7, 0xfbf81841c8082dc4
+data8 0x3fc6be97a21daf00, 0x3cc2ac8330e59aa5
+data8 0x84390ec132759ecb, 0xfbe0fa06e24cc390
+data8 0x3fc6ffa0b6ef05e0, 0x3ccc1a030fee56c4
+data8 0x84519e3a29df811a, 0xfbc9989a85ce0954
+data8 0x3fc740afcccca000, 0x3cc19692a5301ca6
+data8 0x846a7b527842d61b, 0xfbb1f3e9f8e45dc4
+data8 0x3fc781c4f633e2c0, 0x3cc0e98f3868a508
+data8 0x8483a65c8434b5f0, 0xfb9a0be244f4af45
+data8 0x3fc7c2e045b12140, 0x3cb2a8d309754420
+data8 0x849d1fabe4e97dd7, 0xfb81e070362116d1
+data8 0x3fc80401cddfd120, 0x3ca7a44544aa4ce6
+data8 0x84b6e795650817ea, 0xfb6971805af8411e
+data8 0x3fc84529a16ac020, 0x3c9e3b709c7d6f94
+data8 0x84d0fe6f0589da92, 0xfb50beff0423a2f5
+data8 0x3fc88657d30c49e0, 0x3cc60d65a7f0a278
+data8 0x84eb649000a73014, 0xfb37c8d84414755c
+data8 0x3fc8c78c758e8e80, 0x3cc94b2ee984c2b7
+data8 0x85061a50ccd13781, 0xfb1e8ef7eeaf764b
+data8 0x3fc908c79bcba900, 0x3cc8540ae794a2fe
+data8 0x8521200b1fb8916e, 0xfb05114998f76a83
+data8 0x3fc94a0958ade6c0, 0x3ca127f49839fa9c
+data8 0x853c7619f1618bf6, 0xfaeb4fb898b65d19
+data8 0x3fc98b51bf2ffee0, 0x3c8c9ba7a803909a
+data8 0x85581cd97f45e274, 0xfad14a3004259931
+data8 0x3fc9cca0e25d4ac0, 0x3cba458e91d3bf54
+data8 0x857414a74f8446b4, 0xfab7009ab1945a54
+data8 0x3fca0df6d551fe80, 0x3cc78ea1d329d2b2
+data8 0x85905de2341dea46, 0xfa9c72e3370d2fbc
+data8 0x3fca4f53ab3b6200, 0x3ccf60dca86d57ef
+data8 0x85acf8ea4e423ff8, 0xfa81a0f3e9fa0ee9
+data8 0x3fca90b777580aa0, 0x3ca4c4e2ec8a867e
+data8 0x85c9e62111a92e7d, 0xfa668ab6dec711b1
+data8 0x3fcad2224cf814e0, 0x3c303de5980d071c
+data8 0x85e725e947fbee97, 0xfa4b3015e883dbfe
+data8 0x3fcb13943f7d5f80, 0x3cc29d4eefa5cb1e
+data8 0x8604b8a7144cd054, 0xfa2f90fa9883a543
+data8 0x3fcb550d625bc6a0, 0x3c9e01a746152daf
+data8 0x86229ebff69e2415, 0xfa13ad4e3dfbe1c1
+data8 0x3fcb968dc9195ea0, 0x3ccc091bd73ae518
+data8 0x8640d89acf78858c, 0xf9f784f9e5a1877b
+data8 0x3fcbd815874eb160, 0x3cb5f4b89875e187
+data8 0x865f669fe390c7f5, 0xf9db17e65944eacf
+data8 0x3fcc19a4b0a6f9c0, 0x3cc5c0bc2b0bbf14
+data8 0x867e4938df7dc45f, 0xf9be65fc1f6c2e6e
+data8 0x3fcc5b3b58e061e0, 0x3cc1ca70df8f57e7
+data8 0x869d80d0db7e4c0c, 0xf9a16f237aec427a
+data8 0x3fcc9cd993cc4040, 0x3cbae93acc85eccf
+data8 0x86bd0dd45f4f8265, 0xf98433446a806e70
+data8 0x3fccde7f754f5660, 0x3cb22f70e64568d0
+data8 0x86dcf0b16613e37a, 0xf966b246a8606170
+data8 0x3fcd202d11620fa0, 0x3c962030e5d4c849
+data8 0x86fd29d7624b3d5d, 0xf948ec11a9d4c45b
+data8 0x3fcd61e27c10c0a0, 0x3cc7083c91d59217
+data8 0x871db9b741dbe44a, 0xf92ae08c9eca4941
+data8 0x3fcda39fc97be7c0, 0x3cc9258579e57211
+data8 0x873ea0c3722d6af2, 0xf90c8f9e71633363
+data8 0x3fcde5650dd86d60, 0x3ca4755a9ea582a9
+data8 0x875fdf6fe45529e8, 0xf8edf92dc5875319
+data8 0x3fce27325d6fe520, 0x3cbc1e2b6c1954f9
+data8 0x878176321154e2bc, 0xf8cf1d20f87270b8
+data8 0x3fce6907cca0d060, 0x3cb6ca4804750830
+data8 0x87a36580fe6bccf5, 0xf8affb5e20412199
+data8 0x3fceaae56fdee040, 0x3cad6b310d6fd46c
+data8 0x87c5add5417a5cb9, 0xf89093cb0b7c0233
+data8 0x3fceeccb5bb33900, 0x3cc16e99cedadb20
+data8 0x87e84fa9057914ca, 0xf870e64d40a15036
+data8 0x3fcf2eb9a4bcb600, 0x3cc75ee47c8b09e9
+data8 0x880b4b780f02b709, 0xf850f2c9fdacdf78
+data8 0x3fcf70b05fb02e20, 0x3cad6350d379f41a
+data8 0x882ea1bfc0f228ac, 0xf830b926379e6465
+data8 0x3fcfb2afa158b8a0, 0x3cce0ccd9f829985
+data8 0x885252ff21146108, 0xf810394699fe0e8e
+data8 0x3fcff4b77e97f3e0, 0x3c9b30faa7a4c703
+data8 0x88765fb6dceebbb3, 0xf7ef730f865f6df0
+data8 0x3fd01b6406332540, 0x3cdc5772c9e0b9bd
+data8 0x88ad1f69be2cc730, 0xf7bdc59bc9cfbd97
+data8 0x3fd04cf8ad203480, 0x3caeef44fe21a74a
+data8 0x88f763f70ae2245e, 0xf77a91c868a9c54e
+data8 0x3fd08f23ce0162a0, 0x3cd6290ab3fe5889
+data8 0x89431fc7bc0c2910, 0xf73642973c91298e
+data8 0x3fd0d1610f0c1ec0, 0x3cc67401a01f08cf
+data8 0x8990573407c7738e, 0xf6f0d71d1d7a2dd6
+data8 0x3fd113b0c65d88c0, 0x3cc7aa4020fe546f
+data8 0x89df0eb108594653, 0xf6aa4e6a05cfdef2
+data8 0x3fd156134ada6fe0, 0x3cc87369da09600c
+data8 0x8a2f4ad16e0ed78a, 0xf662a78900c35249
+data8 0x3fd19888f43427a0, 0x3cc62b220f38e49c
+data8 0x8a811046373e0819, 0xf619e180181d97cc
+data8 0x3fd1db121aed7720, 0x3ca3ede7490b52f4
+data8 0x8ad463df6ea0fa2c, 0xf5cffb504190f9a2
+data8 0x3fd21daf185fa360, 0x3caafad98c1d6c1b
+data8 0x8b294a8cf0488daf, 0xf584f3f54b8604e6
+data8 0x3fd2606046bf95a0, 0x3cdb2d704eeb08fa
+data8 0x8b7fc95f35647757, 0xf538ca65c960b582
+data8 0x3fd2a32601231ec0, 0x3cc661619fa2f126
+data8 0x8bd7e588272276f8, 0xf4eb7d92ff39fccb
+data8 0x3fd2e600a3865760, 0x3c8a2a36a99aca4a
+data8 0x8c31a45bf8e9255e, 0xf49d0c68cd09b689
+data8 0x3fd328f08ad12000, 0x3cb9efaf1d7ab552
+data8 0x8c8d0b520a35eb18, 0xf44d75cd993cfad2
+data8 0x3fd36bf614dcc040, 0x3ccacbb590bef70d
+data8 0x8cea2005d068f23d, 0xf3fcb8a23ab4942b
+data8 0x3fd3af11a079a6c0, 0x3cd9775872cf037d
+data8 0x8d48e837c8cd5027, 0xf3aad3c1e2273908
+data8 0x3fd3f2438d754b40, 0x3ca03304f667109a
+data8 0x8da969ce732f3ac7, 0xf357c60202e2fd7e
+data8 0x3fd4358c3ca032e0, 0x3caecf2504ff1a9d
+data8 0x8e0baad75555e361, 0xf3038e323ae9463a
+data8 0x3fd478ec0fd419c0, 0x3cc64bdc3d703971
+data8 0x8e6fb18807ba877e, 0xf2ae2b1c3a6057f7
+data8 0x3fd4bc6369fa40e0, 0x3cbb7122ec245cf2
+data8 0x8ed5843f4bda74d5, 0xf2579b83aa556f0c
+data8 0x3fd4fff2af11e2c0, 0x3c9cfa2dc792d394
+data8 0x8f3d29862c861fef, 0xf1ffde2612ca1909
+data8 0x3fd5439a4436d000, 0x3cc38d46d310526b
+data8 0x8fa6a81128940b2d, 0xf1a6f1bac0075669
+data8 0x3fd5875a8fa83520, 0x3cd8bf59b8153f8a
+data8 0x901206c1686317a6, 0xf14cd4f2a730d480
+data8 0x3fd5cb33f8cf8ac0, 0x3c9502b5c4d0e431
+data8 0x907f4ca5fe9cf739, 0xf0f186784a125726
+data8 0x3fd60f26e847b120, 0x3cc8a1a5e0acaa33
+data8 0x90ee80fd34aeda5e, 0xf09504ef9a212f18
+data8 0x3fd65333c7e43aa0, 0x3cae5b029cb1f26e
+data8 0x915fab35e37421c6, 0xf0374ef5daab5c45
+data8 0x3fd6975b02b8e360, 0x3cd5aa1c280c45e6
+data8 0x91d2d2f0d894d73c, 0xefd86321822dbb51
+data8 0x3fd6db9d05213b20, 0x3cbecf2c093ccd8b
+data8 0x9248000249200009, 0xef7840021aca5a72
+data8 0x3fd71ffa3cc87fc0, 0x3cb8d273f08d00d9
+data8 0x92bf3a7351f081d2, 0xef16e42021d7cbd5
+data8 0x3fd7647318b1ad20, 0x3cbce099d79cdc46
+data8 0x93388a8386725713, 0xeeb44dfce6820283
+data8 0x3fd7a908093fc1e0, 0x3ccb033ec17a30d9
+data8 0x93b3f8aa8e653812, 0xee507c126774fa45
+data8 0x3fd7edb9803e3c20, 0x3cc10aedb48671eb
+data8 0x94318d99d341ade4, 0xedeb6cd32f891afb
+data8 0x3fd83287f0e9cf80, 0x3c994c0c1505cd2a
+data8 0x94b1523e3dedc630, 0xed851eaa3168f43c
+data8 0x3fd87773cff956e0, 0x3cda3b7bce6a6b16
+data8 0x95334fc20577563f, 0xed1d8ffaa2279669
+data8 0x3fd8bc7d93a70440, 0x3cd4922edc792ce2
+data8 0x95b78f8e8f92f274, 0xecb4bf1fd2be72da
+data8 0x3fd901a5b3b9cf40, 0x3cd3fea1b00f9d0d
+data8 0x963e1b4e63a87c3f, 0xec4aaa6d08694cc1
+data8 0x3fd946eca98f2700, 0x3cdba4032d968ff1
+data8 0x96c6fcef314074fc, 0xebdf502d53d65fea
+data8 0x3fd98c52f024e800, 0x3cbe7be1ab8c95c9
+data8 0x97523ea3eab028b2, 0xeb72aea36720793e
+data8 0x3fd9d1d904239860, 0x3cd72d08a6a22b70
+data8 0x97dfeae6f4ee4a9a, 0xeb04c4096a884e94
+data8 0x3fda177f63e8ef00, 0x3cd818c3c1ebfac7
+data8 0x98700c7c6d85d119, 0xea958e90cfe1efd7
+data8 0x3fda5d468f92a540, 0x3cdf45fbfaa080fe
+data8 0x9902ae7487a9caa1, 0xea250c6224aab21a
+data8 0x3fdaa32f090998e0, 0x3cd715a9353cede4
+data8 0x9997dc2e017a9550, 0xe9b33b9ce2bb7638
+data8 0x3fdae939540d3f00, 0x3cc545c014943439
+data8 0x9a2fa158b29b649b, 0xe9401a573f8aa706
+data8 0x3fdb2f65f63f6c60, 0x3cd4a63c2f2ca8e2
+data8 0x9aca09f835466186, 0xe8cba69df9f0bf35
+data8 0x3fdb75b5773075e0, 0x3cda310ce1b217ec
+data8 0x9b672266ab1e0136, 0xe855de74266193d4
+data8 0x3fdbbc28606babc0, 0x3cdc84b75cca6c44
+data8 0x9c06f7579f0b7bd5, 0xe7debfd2f98c060b
+data8 0x3fdc02bf3d843420, 0x3cd225d967ffb922
+data8 0x9ca995db058cabdc, 0xe76648a991511c6e
+data8 0x3fdc497a9c224780, 0x3cde08101c5b825b
+data8 0x9d4f0b605ce71e88, 0xe6ec76dcbc02d9a7
+data8 0x3fdc905b0c10d420, 0x3cb1abbaa3edf120
+data8 0x9df765b9eecad5e6, 0xe6714846bdda7318
+data8 0x3fdcd7611f4b8a00, 0x3cbf6217ae80aadf
+data8 0x9ea2b320350540fe, 0xe5f4bab71494cd6b
+data8 0x3fdd1e8d6a0d56c0, 0x3cb726e048cc235c
+data8 0x9f51023562fc5676, 0xe576cbf239235ecb
+data8 0x3fdd65e082df5260, 0x3cd9e66872bd5250
+data8 0xa002620915c2a2f6, 0xe4f779b15f5ec5a7
+data8 0x3fddad5b02a82420, 0x3c89743b0b57534b
+data8 0xa0b6e21c2caf9992, 0xe476c1a233a7873e
+data8 0x3fddf4fd84bbe160, 0x3cbf7adea9ee3338
+data8 0xa16e9264cc83a6b2, 0xe3f4a16696608191
+data8 0x3fde3cc8a6ec6ee0, 0x3cce46f5a51f49c6
+data8 0xa22983528f3d8d49, 0xe3711694552da8a8
+data8 0x3fde84bd099a6600, 0x3cdc78f6490a2d31
+data8 0xa2e7c5d2e2e69460, 0xe2ec1eb4e1e0a5fb
+data8 0x3fdeccdb4fc685c0, 0x3cdd3aedb56a4825
+data8 0xa3a96b5599bd2532, 0xe265b74506fbe1c9
+data8 0x3fdf15241f23b3e0, 0x3cd440f3c6d65f65
+data8 0xa46e85d1ae49d7de, 0xe1ddddb499b3606f
+data8 0x3fdf5d98202994a0, 0x3cd6c44bd3fb745a
+data8 0xa53727ca3e11b99e, 0xe1548f662951b00d
+data8 0x3fdfa637fe27bf60, 0x3ca8ad1cd33054dd
+data8 0xa6036453bdc20186, 0xe0c9c9aeabe5e481
+data8 0x3fdfef0467599580, 0x3cc0f1ac0685d78a
+data8 0xa6d34f1969dda338, 0xe03d89d5281e4f81
+data8 0x3fe01bff067d6220, 0x3cc0731e8a9ef057
+data8 0xa7a6fc62f7246ff3, 0xdfafcd125c323f54
+data8 0x3fe04092d1ae3b40, 0x3ccabda24b59906d
+data8 0xa87e811a861df9b9, 0xdf20909061bb9760
+data8 0x3fe0653df0fd9fc0, 0x3ce94c8dcc722278
+data8 0xa959f2d2dd687200, 0xde8fd16a4e5f88bd
+data8 0x3fe08a00c1cae320, 0x3ce6b888bb60a274
+data8 0xaa3967cdeea58bda, 0xddfd8cabd1240d22
+data8 0x3fe0aedba3221c00, 0x3ced5941cd486e46
+data8 0xab904fd587263c84, 0xdd1f4472e1cf64ed
+data8 0x3fe0e651e85229c0, 0x3cdb6701042299b1
+data8 0xad686d44dd5a74bb, 0xdbf173e1f6b46e92
+data8 0x3fe1309cbf4cdb20, 0x3cbf1be7bb3f0ec5
+data8 0xaf524e15640ebee4, 0xdabd54896f1029f6
+data8 0x3fe17b4ee1641300, 0x3ce81dd055b792f1
+data8 0xb14eca24ef7db3fa, 0xd982cb9ae2f47e41
+data8 0x3fe1c66b9ffd6660, 0x3cd98ea31eb5ddc7
+data8 0xb35ec807669920ce, 0xd841bd1b8291d0b6
+data8 0x3fe211f66db3a5a0, 0x3ca480c35a27b4a2
+data8 0xb5833e4755e04dd1, 0xd6fa0bd3150b6930
+data8 0x3fe25df2e05b6c40, 0x3ca4bc324287a351
+data8 0xb7bd34c8000b7bd3, 0xd5ab9939a7d23aa1
+data8 0x3fe2aa64b32f7780, 0x3cba67314933077c
+data8 0xba0dc64d126cc135, 0xd4564563ce924481
+data8 0x3fe2f74fc9289ac0, 0x3cec1a1dc0efc5ec
+data8 0xbc76222cbbfa74a6, 0xd2f9eeed501125a8
+data8 0x3fe344b82f859ac0, 0x3ceeef218de413ac
+data8 0xbef78e31985291a9, 0xd19672e2182f78be
+data8 0x3fe392a22087b7e0, 0x3cd2619ba201204c
+data8 0xc19368b2b0629572, 0xd02baca5427e436a
+data8 0x3fe3e11206694520, 0x3cb5d0b3143fe689
+data8 0xc44b2ae8c6733e51, 0xceb975d60b6eae5d
+data8 0x3fe4300c7e945020, 0x3cbd367143da6582
+data8 0xc7206b894212dfef, 0xcd3fa6326ff0ac9a
+data8 0x3fe47f965d201d60, 0x3ce797c7a4ec1d63
+data8 0xca14e1b0622de526, 0xcbbe13773c3c5338
+data8 0x3fe4cfb4b09d1a20, 0x3cedfadb5347143c
+data8 0xcd2a6825eae65f82, 0xca34913d425a5ae9
+data8 0x3fe5206cc637e000, 0x3ce2798b38e54193
+data8 0xd06301095e1351ee, 0xc8a2f0d3679c08c0
+data8 0x3fe571c42e3d0be0, 0x3ccd7cb9c6c2ca68
+data8 0xd3c0d9f50057adda, 0xc70901152d59d16b
+data8 0x3fe5c3c0c108f940, 0x3ceb6c13563180ab
+data8 0xd74650a98cc14789, 0xc5668e3d4cbf8828
+data8 0x3fe61668a46ffa80, 0x3caa9092e9e3c0e5
+data8 0xdaf5f8579dcc8f8f, 0xc3bb61b3eed42d02
+data8 0x3fe669c251ad69e0, 0x3cccf896ef3b4fee
+data8 0xded29f9f9a6171b4, 0xc20741d7f8e8e8af
+data8 0x3fe6bdd49bea05c0, 0x3cdc6b29937c575d
+data8 0xe2df5765854ccdb0, 0xc049f1c2d1b8014b
+data8 0x3fe712a6b76c6e80, 0x3ce1ddc6f2922321
+data8 0xe71f7a9b94fcb4c3, 0xbe833105ec291e91
+data8 0x3fe76840418978a0, 0x3ccda46e85432c3d
+data8 0xeb96b72d3374b91e, 0xbcb2bb61493b28b3
+data8 0x3fe7bea9496d5a40, 0x3ce37b42ec6e17d3
+data8 0xf049183c3f53c39b, 0xbad848720223d3a8
+data8 0x3fe815ea59dab0a0, 0x3cb03ad41bfc415b
+data8 0xf53b11ec7f415f15, 0xb8f38b57c53c9c48
+data8 0x3fe86e0c84010760, 0x3cc03bfcfb17fe1f
+data8 0xfa718f05adbf2c33, 0xb70432500286b185
+data8 0x3fe8c7196b9225c0, 0x3ced99fcc6866ba9
+data8 0xfff200c3f5489608, 0xb509e6454dca33cc
+data8 0x3fe9211b54441080, 0x3cb789cb53515688
+// The following table entries are not used
+//data8 0x82e138a0fac48700, 0xb3044a513a8e6132
+//data8 0x3fe97c1d30f5b7c0, 0x3ce1eb765612d1d0
+//data8 0x85f4cc7fc670d021, 0xb0f2fb2ea6cbbc88
+//data8 0x3fe9d82ab4b5fde0, 0x3ced3fe6f27e8039
+//data8 0x89377c1387d5b908, 0xaed58e9a09014d5c
+//data8 0x3fea355065f87fa0, 0x3cbef481d25f5b58
+//data8 0x8cad7a2c98dec333, 0xacab929ce114d451
+//data8 0x3fea939bb451e2a0, 0x3c8e92b4fbf4560f
+//data8 0x905b7dfc99583025, 0xaa748cc0dbbbc0ec
+//data8 0x3feaf31b11270220, 0x3cdced8c61bd7bd5
+//data8 0x9446d8191f80dd42, 0xa82ff92687235baf
+//data8 0x3feb53de0bcffc20, 0x3cbe1722fb47509e
+//data8 0x98758ba086e4000a, 0xa5dd497a9c184f58
+//data8 0x3febb5f571cb0560, 0x3ce0c7774329a613
+//data8 0x9cee6c7bf18e4e24, 0xa37be3c3cd1de51b
+//data8 0x3fec197373bc7be0, 0x3ce08ebdb55c3177
+//data8 0xa1b944000a1b9440, 0xa10b2101b4f27e03
+//data8 0x3fec7e6bd023da60, 0x3ce5fc5fd4995959
+//data8 0xa6defd8ba04d3e38, 0x9e8a4b93cad088ec
+//data8 0x3fece4f404e29b20, 0x3cea3413401132b5
+//data8 0xac69dd408a10c62d, 0x9bf89d5d17ddae8c
+//data8 0x3fed4d2388f63600, 0x3cd5a7fb0d1d4276
+//data8 0xb265c39cbd80f97a, 0x99553d969fec7beb
+//data8 0x3fedb714101e0a00, 0x3cdbda21f01193f2
+//data8 0xb8e081a16ae4ae73, 0x969f3e3ed2a0516c
+//data8 0x3fee22e1da97bb00, 0x3ce7231177f85f71
+//data8 0xbfea427678945732, 0x93d5990f9ee787af
+//data8 0x3fee90ac13b18220, 0x3ce3c8a5453363a5
+//data8 0xc79611399b8c90c5, 0x90f72bde80febc31
+//data8 0x3fef009542b712e0, 0x3ce218fd79e8cb56
+//data8 0xcffa8425040624d7, 0x8e02b4418574ebed
+//data8 0x3fef72c3d2c57520, 0x3cd32a717f82203f
+//data8 0xd93299cddcf9cf23, 0x8af6ca48e9c44024
+//data8 0x3fefe762b77744c0, 0x3ce53478a6bbcf94
+//data8 0xe35eda760af69ad9, 0x87d1da0d7f45678b
+//data8 0x3ff02f511b223c00, 0x3ced6e11782c28fc
+//data8 0xeea6d733421da0a6, 0x84921bbe64ae029a
+//data8 0x3ff06c5c6f8ce9c0, 0x3ce71fc71c1ffc02
+//data8 0xfb3b2c73fc6195cc, 0x813589ba3a5651b6
+//data8 0x3ff0aaf2613700a0, 0x3cf2a72d2fd94ef3
+//data8 0x84ac1fcec4203245, 0xfb73a828893df19e
+//data8 0x3ff0eb367c3fd600, 0x3cf8054c158610de
+//data8 0x8ca50621110c60e6, 0xf438a14c158d867c
+//data8 0x3ff12d51caa6b580, 0x3ce6bce9748739b6
+//data8 0x95b8c2062d6f8161, 0xecb3ccdd37b369da
+//data8 0x3ff1717418520340, 0x3ca5c2732533177c
+//data8 0xa0262917caab4ad1, 0xe4dde4ddc81fd119
+//data8 0x3ff1b7d59dd40ba0, 0x3cc4c7c98e870ff5
+//data8 0xac402c688b72f3f4, 0xdcae469be46d4c8d
+//data8 0x3ff200b93cc5a540, 0x3c8dd6dc1bfe865a
+//data8 0xba76968b9eabd9ab, 0xd41a8f3df1115f7f
+//data8 0x3ff24c6f8f6affa0, 0x3cf1acb6d2a7eff7
+//data8 0xcb63c87c23a71dc5, 0xcb161074c17f54ec
+//data8 0x3ff29b5b338b7c80, 0x3ce9b5845f6ec746
+//data8 0xdfe323b8653af367, 0xc19107d99ab27e42
+//data8 0x3ff2edf6fac7f5a0, 0x3cf77f961925fa02
+//data8 0xf93746caaba3e1f1, 0xb777744a9df03bff
+//data8 0x3ff344df237486c0, 0x3cf6ddf5f6ddda43
+//data8 0x8ca77052f6c340f0, 0xacaf476f13806648
+//data8 0x3ff3a0dfa4bb4ae0, 0x3cfee01bbd761bff
+//data8 0xa1a48604a81d5c62, 0xa11575d30c0aae50
+//data8 0x3ff4030b73c55360, 0x3cf1cf0e0324d37c
+//data8 0xbe45074b05579024, 0x9478e362a07dd287
+//data8 0x3ff46ce4c738c4e0, 0x3ce3179555367d12
+//data8 0xe7a08b5693d214ec, 0x8690e3575b8a7c3b
+//data8 0x3ff4e0a887c40a80, 0x3cfbd5d46bfefe69
+//data8 0x94503d69396d91c7, 0xedd2ce885ff04028
+//data8 0x3ff561ebd9c18cc0, 0x3cf331bd176b233b
+//data8 0xced1d96c5bb209e6, 0xc965278083808702
+//data8 0x3ff5f71d7ff42c80, 0x3ce3301cc0b5a48c
+//data8 0xabac2cee0fc24e20, 0x9c4eb1136094cbbd
+//data8 0x3ff6ae4c63222720, 0x3cf5ff46874ee51e
+//data8 0x8040201008040201, 0xb4d7ac4d9acb1bf4
+//data8 0x3ff7b7d33b928c40, 0x3cfacdee584023bb
+LOCAL_OBJECT_END(T_table)
 
-acos_X2                    = f51
-acos_X4                    = f52
 
-acos_B                     = f53
-acos_Bb                    = f54
-acos_A                     = f55
-acos_Aa                    = f56
 
-acos_1mA                   = f57
+.align 16
 
-acos_W                     = f58
-acos_Ww                    = f59
+LOCAL_OBJECT_START(poly_coeffs)
+       // C_3
+data8 0xaaaaaaaaaaaaaaab, 0x0000000000003ffc
+       // C_5
+data8 0x999999999999999a, 0x0000000000003ffb
+       // C_7, C_9
+data8 0x3fa6db6db6db6db7, 0x3f9f1c71c71c71c8
+       // pi/2 (low, high)
+data8 0x3C91A62633145C07, 0x3FF921FB54442D18
+       // C_11, C_13
+data8 0x3f96e8ba2e8ba2e9, 0x3f91c4ec4ec4ec4e
+       // C_15, C_17
+data8 0x3f8c99999999999a, 0x3f87a87878787223
+       // pi (low, high)
+data8 0x3CA1A62633145C07, 0x400921FB54442D18
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+R_DBL_S = r21
+R_EXP0 = r22
+R_EXP = r15
+R_SGNMASK = r23
+R_TMP = r24
+R_TMP2 = r25
+R_INDEX = r26
+R_TMP3 = r27
+R_TMP03 = r27
+R_TMP4 = r28
+R_TMP5 = r23
+R_TMP6 = r22
+R_TMP7 = r21
+R_T = r29
+R_BIAS = r20
+
+F_T = f6
+F_1S2 = f7
+F_1S2_S = f9
+F_INV_1T2 = f10
+F_SQRT_1T2 = f11
+F_S2T2 = f12
+F_X = f13
+F_D = f14
+F_2M64 = f15
+
+F_CS2 = f32
+F_CS3 = f33
+F_CS4 = f34
+F_CS5 = f35
+F_CS6 = f36
+F_CS7 = f37
+F_CS8 = f38
+F_CS9 = f39
+F_S23 = f40 
+F_S45 = f41 
+F_S67 = f42 
+F_S89 = f43 
+F_S25 = f44 
+F_S69 = f45 
+F_S29 = f46 
+F_X2 = f47 
+F_X4 = f48 
+F_TSQRT = f49 
+F_DTX = f50 
+F_R = f51 
+F_R2 = f52 
+F_R3 = f53 
+F_R4 = f54 
+
+F_C3 = f55 
+F_C5 = f56 
+F_C7 = f57 
+F_C9 = f58 
+F_P79 = f59 
+F_P35 = f60 
+F_P39 = f61 
+
+F_ATHI = f62 
+F_ATLO = f63 
+
+F_T1 = f64 
+F_Y = f65 
+F_Y2 = f66 
+F_ANDMASK = f67 
+F_ORMASK = f68 
+F_S = f69 
+F_05 = f70 
+F_SQRT_1S2 = f71 
+F_DS = f72 
+F_Z = f73 
+F_1T2 = f74 
+F_DZ = f75 
+F_ZE = f76 
+F_YZ = f77 
+F_Y1S2 = f78 
+F_Y1S2X = f79 
+F_1X = f80 
+F_ST = f81 
+F_1T2_ST = f82 
+F_TSS = f83 
+F_Y1S2X2 = f84 
+F_DZ_TERM = f85 
+F_DTS = f86 
+F_DS2X = f87 
+F_T2 = f88 
+F_ZY1S2S = f89 
+F_Y1S2_1X = f90 
+F_TS = f91
+F_PI2_LO = f92 
+F_PI2_HI = f93 
+F_S19 = f94 
+F_INV1T2_2 = f95 
+F_CORR = f96 
+F_DZ0 = f97 
+
+F_C11 = f98 
+F_C13 = f99 
+F_C15 = f100
+F_C17 = f101
+F_P1113 = f102
+F_P1517 = f103
+F_P1117 = f104
+F_P317 = f105
+F_R8 = f106
+F_HI = f107
+F_1S2_HI = f108
+F_DS2 = f109
+F_Y2_2 = f110
+//F_S2 = f111
+//F_S_DS2 = f112
+F_S_1S2S = f113
+F_XL = f114
+F_2M128 = f115
+F_1AS = f116
+F_AS = f117
 
-acos_y0                    = f60
-acos_y1                    = f61
-acos_y2                    = f62
 
-acos_H                     = f63
-acos_Hh                    = f64
 
-acos_t1                    = f65
-acos_t2                    = f66
-acos_t3                    = f67
-acos_t4                    = f68
-acos_t5                    = f69
+.section .text
+GLOBAL_LIBM_ENTRY(acosl)
 
-acos_Pseries               = f70
-acos_NORM_f8               = f71
-acos_ABS_NORM_f8           = f72
+{.mfi
+       // get exponent, mantissa (rounded to double precision) of s
+       getf.d R_DBL_S = f8
+       // 1-s^2
+       fnma.s1 F_1S2 = f8, f8, f1
+       // r2 = pointer to T_table
+       addl r2 = @ltoff(T_table), gp
+}
 
-acos_2                     = f73
-acos_P1P2                  = f74
-acos_HALF                  = f75
-acos_U                     = f76
+{.mfi
+       // sign mask
+       mov R_SGNMASK = 0x20000
+       nop.f 0
+       // bias-63-1
+       mov R_TMP03 = 0xffff-64;;
+}
 
-acos_1mB                   = f77
-acos_V                     = f78 
-acos_S                     = f79
 
-acos_BmUU                  = f80 
-acos_BmUUpb                = f81 
-acos_2U                    = f82
-acos_1d2U                  = f83
+{.mfi
+       // get exponent of s
+       getf.exp R_EXP = f8
+       nop.f 0
+       // R_TMP4 = 2^45
+       shl R_TMP4 = R_SGNMASK, 45-17
+}
 
-acos_Dd                    = f84
+{.mlx
+       // load bias-4
+       mov R_TMP = 0xffff-4
+       // load RU(sqrt(2)/2) to integer register (in double format, shifted left by 1)
+       movl R_TMP2 = 0x7fcd413cccfe779a;;
+}
 
-acos_pi_by_2_hi            = f85
-acos_pi_by_2_lo            = f86
-acos_xmpi_by_2_lo          = f87
-acos_xPmw                  = f88
 
-acos_Uu                    = f89
-acos_AmVV                  = f90 
-acos_AmVVpa                = f91 
+{.mfi
+       // load 2^{-64} in FP register
+       setf.exp F_2M64 = R_TMP03
+       nop.f 0
+       // index = (0x7-exponent)|b1 b2.. b6
+       extr.u R_INDEX = R_DBL_S, 46, 9
+}
 
-acos_2V                    = f92 
-acos_1d2V                  = f93
-acos_Vv                    = f94
+{.mfi
+       // get t = sign|exponent|b1 b2.. b6 1 x.. x
+       or R_T = R_DBL_S, R_TMP4
+       nop.f 0
+       // R_TMP4 = 2^45-1
+       sub R_TMP4 = R_TMP4, r0, 1;;
+}
 
-acos_Vu                    = f95 
-acos_Uv                    = f96 
-
-acos_2_Z_hi                = f97
-acos_s_lo_Z_lo             = f98
-acos_result_lo             = f99
-
-acos_Z_hi                  = f8
-acos_Z_lo                  = f10
-acos_s_lo                  = f11
-
-acos_GR_17_ones            = r33
-acos_GR_16_ones            = r34
-acos_GR_signexp_f8         = r35
-acos_GR_exp                = r36
-acos_GR_true_exp           = r37
-acos_GR_fffe               = r38
-
-GR_SAVE_PFS                = r43
-GR_SAVE_B0                 = r39
-GR_SAVE_GP                 = r41
-
-// r40 is address of table of coefficients
-// r42 
-
-GR_Parameter_X             = r44 
-GR_Parameter_Y             = r45 
-GR_Parameter_RESULT        = r46 
-GR_Parameter_TAG                = r47 
-
-
-// 2^-40:
-// A true exponent of -40 is
-//                    : -40 + register_bias
-//                    : -28 + ffff = ffd7
 
-// A true exponent of 1 is 
-//                    : 1 + register_bias
-//                    : 1 + ffff = 10000
+{.mfi
+       // get t = sign|exponent|b1 b2.. b6 1 0.. 0
+       andcm R_T = R_T, R_TMP4
+       nop.f 0
+       // eliminate sign from R_DBL_S (shift left by 1)
+       shl R_TMP3 = R_DBL_S, 1
+}
 
-// Data tables
-//==============================================================
+{.mfi
+       // R_BIAS = 3*2^6
+       mov R_BIAS = 0xc0
+       nop.f 0
+       // eliminate sign from R_EXP
+       andcm R_EXP0 = R_EXP, R_SGNMASK;;
+}
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
 
-.align 16
 
-acos_coefficients:
-ASM_TYPE_DIRECTIVE(acos_coefficients,@object)
-data8  0xc90fdaa22168c234, 0x00003FFF            // pi_by_2_hi
-data8  0xc4c6628b80dc1cd1, 0x00003FBF            // pi_by_2_lo
-data8  0xc90fdaa22168c234, 0x00004000            // pi_hi
-data8  0xc4c6628b80dc1cd1, 0x00003FC0            // pi_lo
-
-data8  0xBB08911F2013961E, 0x00003FF8            // A10
-data8  0x981F1095A23A87D3, 0x00003FF8            // A9 
-data8  0xBDF09C6C4177BCC6, 0x00003FF8            // A8 
-data8  0xE4C3A60B049ACCEA, 0x00003FF8            // A7 
-data8  0x8E2789F4E8A8F1AD, 0x00003FF9            // A6 
-data8  0xB745D09B2B0E850B, 0x00003FF9            // A5 
-data8  0xF8E38E3BC4C50920, 0x00003FF9            // A4 
-data8  0xB6DB6DB6D89FCD81, 0x00003FFA            // A3 
-data8  0x99999999999AF376, 0x00003FFB            // A2 
-data8  0xAAAAAAAAAAAAAA71, 0x00003FFC            // A1
-ASM_SIZE_DIRECTIVE(acos_coefficients)
-
-
-.align 32
-.global acosl#
-ASM_TYPE_DIRECTIVE(acosl#,@function)
+{.mfi
+       // load start address for T_table
+       ld8 r2 = [r2]
+       nop.f 0
+       // p8 = 1 if |s|> = sqrt(2)/2
+       cmp.geu p8, p0 = R_TMP3, R_TMP2
+}
 
-.section .text
-.proc  acosl#
-.align 32
+{.mlx
+       // p7 = 1 if |s|<2^{-4} (exponent of s<bias-4)
+       cmp.lt p7, p0 = R_EXP0, R_TMP
+       // sqrt coefficient cs8 = -33*13/128
+       movl R_TMP2 = 0xc0568000;;
+}
 
 
-acosl: 
 
-// After normalizing f8, get its true exponent
-{ .mfi
-      alloc r32 = ar.pfs,1,11,4,0                                             
-(p0)  fnorm.s1    acos_NORM_f8 = f8                                            
-(p0)  mov         acos_GR_17_ones = 0x1ffff                                    
+{.mbb
+       // load t in FP register
+       setf.d F_T = R_T
+       // if |s|<2^{-4}, take alternate path
+ (p7) br.cond.spnt SMALL_S
+       // if |s|> = sqrt(2)/2, take alternate path
+ (p8) br.cond.sptk LARGE_S
 }
 
-{ .mmi
-(p0)  mov        acos_GR_16_ones = 0xffff                                     
-(p0)  addl                 r40   = @ltoff(acos_coefficients), gp
-      nop.i 999
+{.mlx
+       // index = (4-exponent)|b1 b2.. b6
+       sub R_INDEX = R_INDEX, R_BIAS
+       // sqrt coefficient cs9 = 55*13/128
+       movl R_TMP = 0x40b2c000;;
 }
-;;
 
-// Set denormal flag on denormal input with fcmp
-{ .mfi
-      ld8 r40 = [r40]
-      fcmp.eq  p6,p0 = f8,f0
-      nop.i 999
+
+{.mfi
+       // sqrt coefficient cs8 = -33*13/128
+       setf.s F_CS8 = R_TMP2
+       nop.f 0
+       // shift R_INDEX by 5
+       shl R_INDEX = R_INDEX, 5
 }
-;;
 
+{.mfi
+       // sqrt coefficient cs3 = 0.5 (set exponent = bias-1)
+       mov R_TMP4 = 0xffff - 1
+       nop.f 0
+       // sqrt coefficient cs6 = -21/16
+       mov R_TMP6 = 0xbfa8;;
+}
 
-// Load the constants pi_by_2 and pi.
-// Each is stored as hi and lo values
-// Also load the coefficients for ACOS_POLY
 
-{ .mmi
-(p0) ldfe       acos_pi_by_2_hi = [r40],16 ;;      
-(p0) ldfe       acos_pi_by_2_lo = [r40],16      
-     nop.i 999 ;;
+{.mlx
+       // table index
+       add r2 = r2, R_INDEX
+       // sqrt coefficient cs7 = 33/16
+       movl R_TMP2 = 0x40040000;;
 }
 
-{ .mmi
-(p0) ldfe       acos_pi_hi      = [r40],16 ;;      
-(p0) ldfe       acos_pi_lo      = [r40],16      
-     nop.i 999 ;;
+
+{.mmi
+       // load cs9 = 55*13/128
+       setf.s F_CS9 = R_TMP
+       // sqrt coefficient cs5 = 7/8
+       mov R_TMP3 = 0x3f60
+       // sqrt coefficient cs6 = 21/16
+       shl R_TMP6 = R_TMP6, 16;;
 }
 
-{ .mmi
-(p0) ldfe       acos_A10        = [r40],16 ;;      
-(p0) ldfe       acos_A9         = [r40],16      
-     nop.i 999 ;;
+
+{.mmi
+       // load significand of 1/(1-t^2)
+       ldf8 F_INV_1T2 = [r2], 8
+       // sqrt coefficient cs7 = 33/16
+       setf.s F_CS7 = R_TMP2
+       // sqrt coefficient cs4 = -5/8
+       mov R_TMP5 = 0xbf20;;
 }
 
-// Take the absolute value of f8
-{ .mmf
-      nop.m 999
-(p0)  getf.exp   acos_GR_signexp_f8  = acos_NORM_f8                           
-(p0)  fmerge.s  acos_ABS_NORM_f8 = f0, acos_NORM_f8 
+
+{.mmi
+       // load significand of sqrt(1-t^2)
+       ldf8 F_SQRT_1T2 = [r2], 8
+       // sqrt coefficient cs6 = 21/16
+       setf.s F_CS6 = R_TMP6
+       // sqrt coefficient cs5 = 7/8
+       shl R_TMP3 = R_TMP3, 16;;
 }
 
-{ .mii
-(p0) ldfe       acos_A8         = [r40],16      
-     nop.i 999 ;;
-(p0) and        acos_GR_exp         = acos_GR_signexp_f8, acos_GR_17_ones ;;    
+
+{.mmi
+       // sqrt coefficient cs3 = 0.5 (set exponent = bias-1)
+       setf.exp F_CS3 = R_TMP4
+       // r3 = pointer to polynomial coefficients
+       addl r3 = @ltoff(poly_coeffs), gp
+       // sqrt coefficient cs4 = -5/8
+       shl R_TMP5 = R_TMP5, 16;;
 }
 
-// case 1: |x| < 2^-25         ==> p6   ACOS_TINY
-// case 2: 2^-25 <= |x| < 2^-2 ==> p8   ACOS_POLY
-// case 3: 2^-2  <= |x| < 1    ==> p9   ACOS_ATAN
-// case 4: 1     <= |x|        ==> p11  ACOS_ERROR_RETURN
-//  Admittedly |x| = 1 is not an error but this is where that case is
-//  handled.
 
-{ .mii
-(p0) ldfe       acos_A7         = [r40],16      
-(p0) sub        acos_GR_true_exp    = acos_GR_exp, acos_GR_16_ones ;;           
-(p0) cmp.ge.unc p6, p7    = -26, acos_GR_true_exp ;;                            
+{.mfi
+       // sqrt coefficient cs5 = 7/8
+       setf.s F_CS5 = R_TMP3
+       // d = s-t
+       fms.s1 F_D = f8, f1, F_T
+       // set p6 = 1 if s<0, p11 = 1 if s> = 0
+       cmp.ge p6, p11 = R_EXP, R_DBL_S
 }
 
-{ .mii
-(p0) ldfe       acos_A6         = [r40],16      
-(p7) cmp.ge.unc p8, p9    = -3,  acos_GR_true_exp ;;                            
-(p9) cmp.ge.unc p10, p11  =  -1, acos_GR_true_exp                            
+{.mfi
+       // r3 = load start address to polynomial coefficients
+       ld8 r3 = [r3]
+       // s+t
+       fma.s1 F_S2T2 = f8, f1, F_T
+       nop.i 0;;
 }
 
-{ .mmi
-(p0) ldfe       acos_A5         = [r40],16 ;;      
-(p0) ldfe       acos_A4         = [r40],16      
-      nop.i 999 ;;
+
+{.mfi
+       // sqrt coefficient cs4 = -5/8
+       setf.s F_CS4 = R_TMP5
+       // s^2-t^2
+       fma.s1 F_S2T2 = F_S2T2, F_D, f0
+       nop.i 0;;
 }
 
-{ .mmi
-(p0) ldfe       acos_A3         = [r40],16 ;;      
-(p0) ldfe       acos_A2         = [r40],16      
-      nop.i 999 ;;
+
+{.mfi
+       // load C3
+       ldfe F_C3 = [r3], 16
+       // 0.5/(1-t^2) = 2^{-64}*(2^63/(1-t^2))
+       fma.s1 F_INV_1T2 = F_INV_1T2, F_2M64, f0
+       nop.i 0;;
 }
 
-// ACOS_ERROR_RETURN ==> p11 is true
-// case 4: |x| >= 1
-{ .mib
-(p0)  ldfe       acos_A1         = [r40],16      
-      nop.i 999
-(p11) br.spnt         L(ACOS_ERROR_RETURN) ;; 
+{.mfi
+       // load C_5
+       ldfe F_C5 = [r3], 16
+       // set correct exponent for sqrt(1-t^2)
+       fma.s1 F_SQRT_1T2 = F_SQRT_1T2, F_2M64, f0
+       nop.i 0;;
 }
 
-// ACOS_TINY ==> p6 is true
-// case 1: |x| < 2^-25
-{ .mfi
-      nop.m 999
-(p6)  fms.s1        acos_xmpi_by_2_lo = acos_NORM_f8,f1, acos_pi_by_2_lo 
-      nop.i 999 ;;
+
+{.mfi
+       // load C_7, C_9
+       ldfpd F_C7, F_C9 = [r3], 16
+       // x = -(s^2-t^2)/(1-t^2)/2
+       fnma.s1 F_X = F_INV_1T2, F_S2T2, f0
+       nop.i 0;;
 }
 
-{ .mfb
-           nop.m 999
-(p6)  fms.s0         f8 = acos_pi_by_2_hi,f1, acos_xmpi_by_2_lo                
-(p6)  br.ret.spnt   b0 ;;                                                   
+
+{.mmf
+       // load asin(t)_high, asin(t)_low
+       ldfpd F_ATHI, F_ATLO = [r2]
+	   // load pi/2
+	   ldfpd F_PI2_LO, F_PI2_HI = [r3]
+       // t*sqrt(1-t^2)
+       fma.s1 F_TSQRT = F_T, F_SQRT_1T2, f0;;
 }
 
 
+{.mfi
+       nop.m 0
+       // cs9*x+cs8
+       fma.s1 F_S89 = F_CS9, F_X, F_CS8
+       nop.i 0
+}
 
-// ACOS_POLY ==> p8 is true
-// case 2: 2^-25 <= |x| < 2^-2                   
-{ .mfi
-      nop.m 999
-(p8)  fms.s1        acos_W       = acos_pi_by_2_hi, f1, acos_NORM_f8     
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // cs7*x+cs6
+       fma.s1 F_S67 = F_CS7, F_X, F_CS6
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_X2   = f8,f8, f0                                
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // cs5*x+cs4
+       fma.s1 F_S45 = F_CS5, F_X, F_CS4
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fms.s1        acos_Ww      = acos_pi_by_2_hi, f1, acos_W           
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // x*x
+       fma.s1 F_X2 = F_X, F_X, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_X4   = acos_X2,acos_X2, f0                      
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // (s-t)-t*x
+       fnma.s1 F_DTX = F_T, F_X, F_D
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fms.s1        acos_Ww      = acos_Ww, f1, acos_NORM_f8             
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // cs3*x+cs2 (cs2 = -0.5 = -cs3)
+       fms.s1 F_S23 = F_CS3, F_X, F_CS3
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P810 = acos_X4, acos_A10, acos_A8               
-      nop.i 999
+{.mfi
+  nop.m 0
+  // if sign is negative, negate table values: asin(t)_low
+  (p6) fnma.s1 F_ATLO = F_ATLO, f1, f0
+  nop.i 0
 }
 
-// acos_P79  = X4*A9   + A7
-// acos_P810 = X4*A10  + A8
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P79  = acos_X4, acos_A9, acos_A7                
-      nop.i 999 ;;
+{.mfi
+  nop.m 0
+  // if sign is negative, negate table values: asin(t)_high
+  (p6) fnma.s1 F_ATHI = F_ATHI, f1, f0
+  nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_Ww      = acos_Ww, f1, acos_pi_by_2_lo          
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // cs9*x^3+cs8*x^2+cs7*x+cs6
+       fma.s1 F_S69 = F_S89, F_X2, F_S67
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P610 = acos_X4, acos_P810, acos_A6              
-      nop.i 999
+{.mfi
+       nop.m 0
+       // x^4
+       fma.s1 F_X4 = F_X2, F_X2, f0
+       nop.i 0;;
 }
 
 
-// acos_P59   = X4*(X4*A9   + A7)  + A5
-// acos_P610  = X4*(X4*A10  + A8)  + A6
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P59  = acos_X4, acos_P79, acos_A5               
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // t*sqrt(1-t^2)*x^2
+       fma.s1 F_TSQRT = F_TSQRT, F_X2, f0
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P410 = acos_X4, acos_P610, acos_A4              
-      nop.i 999
+{.mfi
+       nop.m 0
+       // cs5*x^3+cs4*x^2+cs3*x+cs2
+       fma.s1 F_S25 = F_S45, F_X2, F_S23
+       nop.i 0;;
 }
 
-// acos_P39   = X4*(X4*(X4*A9   + A7)  + A5) + A3
-// acos_P410  = X4*(X4*(X4*A10  + A8)  + A6) + A4
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P39  = acos_X4, acos_P59, acos_A3               
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // ((s-t)-t*x)*sqrt(1-t^2)
+       fma.s1 F_DTX = F_DTX, F_SQRT_1T2, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P210 = acos_X4, acos_P410, acos_A2              
-      nop.i 999
+{.mfi
+       nop.m 0
+       // (pi/2)_high - asin(t)_high
+       fnma.s1 F_ATHI = F_ATHI, f1, F_PI2_HI
+       nop.i 0
 }
 
-// acos_P19   = X4*(X4*(X4*(X4*A9   + A7)  + A5) + A3) + A1 = P1
-// acos_P210  = X4*(X4*(X4*(X4*A10  + A8)  + A6) + A4) + A2 = P2
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P19  = acos_X4, acos_P39, acos_A1               
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // asin(t)_low - (pi/2)_low
+       fnma.s1 F_ATLO = F_PI2_LO, f1, F_ATLO
+	   nop.i 0;;
 }
 
-// acos_P1P2 = Xsq*P2 + P1
-// acos_P1P2 = Xsq*(Xsq*P2 + P1)
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P1P2    = acos_X2, acos_P210, acos_P19          
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // PS29 = cs9*x^7+..+cs5*x^3+cs4*x^2+cs3*x+cs2
+       fma.s1 F_S29 = F_S69, F_X4, F_S25
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        acos_P1P2    = acos_X2, acos_P1P2, f0                
-      nop.i 999 ;;
+
+
+{.mfi
+       nop.m 0
+       // R = ((s-t)-t*x)*sqrt(1-t^2)-t*sqrt(1-t^2)*x^2*PS29
+       fnma.s1 F_R = F_S29, F_TSQRT, F_DTX
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fms.s1        acos_xPmw    = acos_NORM_f8, acos_P1P2, acos_Ww       
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // R^2
+       fma.s1 F_R2 = F_R, F_R, f0
+       nop.i 0;;
 }
 
-{ .mfb
-      nop.m 999
-(p8)  fms.s0         f8           = acos_W, f1, acos_xPmw                 
-(p8)  br.ret.spnt   b0 ;;                                                   
+
+{.mfi
+       nop.m 0
+       // c7+c9*R^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
 }
 
+{.mfi
+       nop.m 0
+       // c3+c5*R^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0;;
+}
 
-// ACOS_ATAN
-// case 3: 2^-2  <= |x| < 1                      
-// case 3: 2^-2  <= |x| < 1    ==> p9   ACOS_ATAN
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0;;
+}
 
-// Step 1.1:     Get A,B and a,b
-// A + a = 1- |X|
-// B + b = 1+ |X|
-// Note also that we will use  acos_corr (f13)
-// and                         acos_W
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R3 = F_R2, F_R, f0
+       nop.i 0;;
+}
 
-// Step 2
-// Call __libm_atan2_reg
 
 
-{ .mfi
-(p0)  mov    acos_GR_fffe = 0xfffe                      
-(p0)  fma.s1 acos_B          = f1,f1,  acos_ABS_NORM_f8                            
-(p0)  mov   GR_SAVE_B0 = b0 ;;                                
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0;;
 }
 
-{ .mmf
-(p0)  mov   GR_SAVE_GP = gp                                
-      nop.m 999
-(p0)  fms.s1 acos_A   = f1,f1,  acos_ABS_NORM_f8                            
+
+{.mfi
+       nop.m 0
+       // asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_P39 = F_P39, F_R3, F_ATLO
+       nop.i 0;;
 }
 
-{ .mfi
-(p0)  setf.exp       acos_HALF = acos_GR_fffe                   
-      nop.f 999
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // R+asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_P39 = F_P39, f1, F_R
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fms.s1 acos_1mB = f1,f1, acos_B                                       
-      nop.i 999 ;;
+
+{.mfb
+       nop.m 0
+       // result = (pi/2)-asin(t)_high+R+asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fnma.s0 f8 = F_P39, f1, F_ATHI
+       // return
+       br.ret.sptk b0;;
 }
 
-// We want atan2(V,U)
-//   so put V in f8 and U in f9
-//   but save X in acos_X
 
-{ .mfi
-      nop.m 999
-(p0)  fmerge.se acos_X = f8, f8                               
-      nop.i 999 ;;
+
+
+LARGE_S:
+
+{.mfi
+       // bias-1
+       mov R_TMP3 = 0xffff - 1
+       // y ~ 1/sqrt(1-s^2)
+       frsqrta.s1 F_Y, p7 = F_1S2
+       // c9 = 55*13*17/128
+       mov R_TMP4 = 0x10af7b
 }
 
-// Step 1.2:
-/////////////////////////
-// Get U = sqrt(B)
-/////////////////////////
+{.mlx
+       // c8 = -33*13*15/128
+       mov R_TMP5 = 0x184923
+       movl R_TMP2 = 0xff00000000000000;;
+}
 
-{ .mfi
-      nop.m 999
-(p0)  frsqrta.s1     acos_y0,p8  = acos_B                                
-      nop.i 999
+{.mfi
+       // set p6 = 1 if s<0, p11 = 1 if s>0
+       cmp.ge p6, p11 = R_EXP, R_DBL_S
+       // 1-s^2
+       fnma.s1 F_1S2 = f8, f8, f1
+       // set p9 = 1
+       cmp.eq p9, p0 = r0, r0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fms.s1 acos_1mA = f1,f1, acos_A                                       
-      nop.i 999 ;;
+
+{.mfi
+       // load 0.5
+       setf.exp F_05 = R_TMP3
+       // (1-s^2) rounded to single precision
+       fnma.s.s1 F_1S2_S = f8, f8, f1
+       // c9 = 55*13*17/128
+       shl R_TMP4 = R_TMP4, 10
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1 acos_Bb  = acos_1mB,f1, acos_ABS_NORM_f8                       
-      nop.i 999 ;;
+{.mlx
+       // AND mask for getting t ~ sqrt(1-s^2)
+       setf.sig F_ANDMASK = R_TMP2
+       // OR mask
+       movl R_TMP2 = 0x0100000000000000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_Hh     = acos_HALF, acos_B, f0                 
-      nop.i 999 ;;
+.pred.rel "mutex", p6, p11
+{.mfi
+       nop.m 0
+	   // 1-|s|
+ (p6)  fma.s1 F_1AS = f8, f1, f1
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_t1     = acos_y0, acos_y0, f0                  
-      nop.i 999
+{.mfi
+       nop.m 0
+       // 1-|s|
+ (p11) fnma.s1 F_1AS = f8, f1, f1
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fms.s1 acos_Aa  = acos_1mA,f1, acos_ABS_NORM_f8                       
-      nop.i 999 ;;
+
+{.mfi
+       // c9 = 55*13*17/128
+       setf.s F_CS9 = R_TMP4
+	   // |s|
+ (p6)  fnma.s1 F_AS = f8, f1, f0
+       // c8 = -33*13*15/128
+       shl R_TMP5 = R_TMP5, 11
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_t2     = acos_t1, acos_Hh, acos_HALF           
-      nop.i 999 ;;
+{.mfi
+       // c7 = 33*13/16
+       mov R_TMP4 = 0x41d68
+	   // |s|
+ (p11) fma.s1 F_AS = f8, f1, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_y1     = acos_t2, acos_y0, acos_y0             
-      nop.i 999
+
+{.mfi
+       setf.sig F_ORMASK = R_TMP2
+       // y^2
+       fma.s1 F_Y2 = F_Y, F_Y, f0
+       // c7 = 33*13/16
+       shl R_TMP4 = R_TMP4, 12
 }
 
+{.mfi
+       // c6 = -33*7/16
+       mov R_TMP6 = 0xc1670
+       // y' ~ sqrt(1-s^2)
+       fma.s1 F_T1 = F_Y, F_1S2, f0
+       // c5 = 63/8
+       mov R_TMP7 = 0x40fc;;
+}
 
-// Step 1.2:
-/////////////////////////
-// Get V = sqrt(A)
-/////////////////////////
-{ .mfi
-      nop.m 999
-(p0)  frsqrta.s1     acos_y0,p8  = acos_A                                
-      nop.i 999 ;;
+
+{.mlx
+       // load c8 = -33*13*15/128
+       setf.s F_CS8 = R_TMP5
+       // c4 = -35/8
+       movl R_TMP5 = 0xc08c0000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_t3     = acos_y1, acos_Hh, f0                  
-      nop.i 999 ;;
+{.mfi
+       // r3 = pointer to polynomial coefficients
+       addl r3 = @ltoff(poly_coeffs), gp
+       // 1-s-(1-s^2)_s
+       fnma.s1 F_DS = F_1S2_S, f1, F_1AS
+       // p9 = 0 if p7 = 1 (p9 = 1 for special cases only)
+ (p7) cmp.ne p9, p0 = r0, r0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_t1     = acos_y0, acos_y0, f0                  
-      nop.i 999 ;;
+{.mlx
+       // load c7 = 33*13/16
+       setf.s F_CS7 = R_TMP4
+       // c3 = 5/2
+       movl R_TMP4 = 0x40200000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_t4     = acos_t3, acos_y1, acos_HALF           
-      nop.i 999 ;;
+
+{.mlx
+       // load c4 = -35/8
+       setf.s F_CS4 = R_TMP5
+       // c2 = -3/2
+       movl R_TMP5 = 0xbfc00000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_y2     = acos_t4, acos_y1, acos_y1             
-      nop.i 999 ;;
+
+{.mfi
+       // load c3 = 5/2
+       setf.s F_CS3 = R_TMP4
+       // x = (1-s^2)_s*y^2-1
+       fms.s1 F_X = F_1S2_S, F_Y2, f1
+       // c6 = -33*7/16
+       shl R_TMP6 = R_TMP6, 12
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_S      = acos_B, acos_y2, f0                   
-      nop.i 999
+{.mfi
+       nop.m 0
+       // y^2/2
+       fma.s1 F_Y2_2 = F_Y2, F_05, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_H      = acos_y2, acos_HALF, f0                
-      nop.i 999 ;;
+
+{.mfi
+       // load c6 = -33*7/16
+       setf.s F_CS6 = R_TMP6
+       // eliminate lower bits from y'
+       fand F_T = F_T1, F_ANDMASK
+       // c5 = 63/8
+       shl R_TMP7 = R_TMP7, 16
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_t5     = acos_Hh, acos_y2, f0                  
-      nop.i 999
+
+{.mfb
+       // r3 = load start address to polynomial coefficients
+       ld8 r3 = [r3]
+       // 1-(1-s^2)_s-s^2
+       fma.s1 F_DS = F_AS, F_1AS, F_DS
+       // p9 = 1 if s is a special input (NaN, or |s|> = 1)
+ (p9) br.cond.spnt acosl_SPECIAL_CASES;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_Hh     = acos_HALF, acos_A, f0                 
-      nop.i 999 ;;
+{.mmf
+       // get exponent, significand of y' (in single prec.)
+       getf.s R_TMP = F_T1
+       // load c3 = -3/2
+       setf.s F_CS2 = R_TMP5
+       // y*(1-s^2)
+       fma.s1 F_Y1S2 = F_Y, F_1S2, f0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_Dd     = acos_S, acos_S, acos_B                
-      nop.i 999 ;;
+
+
+{.mfi
+       nop.m 0
+       // if s<0, set s = -s
+ (p6) fnma.s1 f8 = f8, f1, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_t2     = acos_t1, acos_Hh, acos_HALF           
-      nop.i 999 ;;
+
+{.mfi
+       // load c5 = 63/8
+       setf.s F_CS5 = R_TMP7
+       // x = (1-s^2)_s*y^2-1+(1-(1-s^2)_s-s^2)*y^2
+       fma.s1 F_X = F_DS, F_Y2, F_X
+       // for t = 2^k*1.b1 b2.., get 7-k|b1.. b6
+       extr.u R_INDEX = R_TMP, 17, 9;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_U      = acos_Dd, acos_H, acos_S               
-      nop.i 999 ;;
+
+{.mmi
+       // index = (4-exponent)|b1 b2.. b6
+       sub R_INDEX = R_INDEX, R_BIAS
+       nop.m 0
+       // get exponent of y
+       shr.u R_TMP2 = R_TMP, 23;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_y1     = acos_t2, acos_y0, acos_y0             
-      nop.i 999 ;;
+{.mmi
+       // load C3
+       ldfe F_C3 = [r3], 16
+       // set p8 = 1 if y'<2^{-4}
+       cmp.gt p8, p0 = 0x7b, R_TMP2
+       // shift R_INDEX by 5
+       shl R_INDEX = R_INDEX, 5;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_2U       = acos_U, f1, acos_U                  
-      nop.i 999 ;;
+
+{.mfb
+       // get table index for sqrt(1-t^2)
+       add r2 = r2, R_INDEX
+       // get t = 2^k*1.b1 b2.. b7 1
+       for F_T = F_T, F_ORMASK
+ (p8) br.cond.spnt VERY_LARGE_INPUT;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_t3     = acos_y1, acos_Hh, f0                  
-      nop.i 999
+
+
+{.mmf
+       // load C5
+       ldfe F_C5 = [r3], 16
+       // load 1/(1-t^2)
+       ldfp8 F_INV_1T2, F_SQRT_1T2 = [r2], 16
+       // x = ((1-s^2)*y^2-1)/2
+       fma.s1 F_X = F_X, F_05, f0;;
 }
 
 
-// Step 1.3: 
-// sqrt(A + a) = V + v
-// sqrt(B + b) = U + u
 
-/////////////////////////
-// Get u
-/////////////////////////
+{.mmf
+       nop.m 0
+       // C7, C9
+       ldfpd F_C7, F_C9 = [r3], 16
+       // set correct exponent for t
+       fmerge.se F_T = F_T1, F_T;;
+}
 
-// acos_BmUU   = B - UU
-// acos_BmUUpb = (B - UU) + b
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_BmUU     = acos_U, acos_U, acos_B              
-      nop.i 999 ;;
+
+{.mfi
+       // get address for loading pi
+	   add r3 = 48, r3
+       // c9*x+c8
+       fma.s1 F_S89 = F_X, F_CS9, F_CS8
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)   fmerge.se f9 = acos_U, acos_U                           
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // x^2
+       fma.s1 F_X2 = F_X, F_X, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_t4     = acos_t3, acos_y1, acos_HALF           
-      nop.i 999 ;;
+
+{.mfi
+       // pi (low, high)
+       ldfpd F_PI2_LO, F_PI2_HI = [r3]
+       // y*(1-s^2)*x
+       fma.s1 F_Y1S2X = F_Y1S2, F_X, f0
+       nop.i 0
 }
 
-// acos_1d2U = frcpa(2U)
-{ .mfi
-      nop.m 999
-(p0)  frcpa.s1       acos_1d2U,p9  = f1, acos_2U                         
-      nop.i 999
+{.mfi
+       nop.m 0
+       // c7*x+c6
+       fma.s1 F_S67 = F_X, F_CS7, F_CS6
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_BmUUpb   = acos_BmUU, f1, acos_Bb              
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // 1-x
+       fnma.s1 F_1X = F_X, f1, f1
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_y2     = acos_t4, acos_y1, acos_y1             
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // c3*x+c2
+       fma.s1 F_S23 = F_X, F_CS3, F_CS2
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-// acos_Uu = ((B - UU) + b) * frcpa(2U)
-(p0)  fma.s1         acos_Uu       = acos_BmUUpb, acos_1d2U, f0          
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // 1-t^2
+       fnma.s1 F_1T2 = F_T, F_T, f1
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_S      = acos_A, acos_y2, f0                   
-      nop.i 999
+{.mfi
+       // load asin(t)_high, asin(t)_low
+       ldfpd F_ATHI, F_ATLO = [r2]
+       // c5*x+c4
+       fma.s1 F_S45 = F_X, F_CS5, F_CS4
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_H      = acos_y2, acos_HALF, f0                
-      nop.i 999 ;;
+
+
+{.mfi
+       nop.m 0
+       // t*s
+       fma.s1 F_TS = F_T, f8, f0
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_t5     = acos_Hh, acos_y2, f0                  
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // 0.5/(1-t^2)
+       fma.s1 F_INV_1T2 = F_INV_1T2, F_2M64, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_Dd     = acos_S, acos_S, acos_A                
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // z~sqrt(1-t^2), rounded to 24 significant bits
+       fma.s.s1 F_Z = F_SQRT_1T2, F_2M64, f0
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_V      = acos_Dd, acos_H, acos_S               
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // sqrt(1-t^2)
+       fma.s1 F_SQRT_1T2 = F_SQRT_1T2, F_2M64, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_2V       = acos_V, f1, acos_V                  
-      nop.i 999
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)*x^2
+       fma.s1 F_Y1S2X2 = F_Y1S2, F_X2, f0
+       nop.i 0
 }
 
-// Step 3
-/////////////////////////
-// Calculate the correction, acos_corr
-/////////////////////////
-// acos_corr = U*v - (V*u)
+{.mfi
+       nop.m 0
+       // x^4
+       fma.s1 F_X4 = F_X2, F_X2, f0
+       nop.i 0;;
+}
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1  acos_Vu   = acos_V,acos_Uu, f0                  
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // s*t rounded to 24 significant bits
+       fma.s.s1 F_TSS = F_T, f8, f0
+       nop.i 0
 }
 
-/////////////////////////
-// Get v
-/////////////////////////
-// acos_AmVV   = A - VV
-// acos_AmVVpa = (A - VV) + a
+{.mfi
+       nop.m 0
+       // c9*x^3+..+c6
+       fma.s1 F_S69 = F_X2, F_S89, F_S67
+       nop.i 0;;
+}
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        acos_AmVV     = acos_V, acos_V, acos_A              
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // ST = (t^2-1+s^2) rounded to 24 significant bits
+       fms.s.s1 F_ST = f8, f8, F_1T2
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)   fmerge.se f8 = acos_V, acos_V                           
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // c5*x^3+..+c2
+       fma.s1 F_S25 = F_X2, F_S45, F_S23
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_AmVVpa   = acos_AmVV, f1, acos_Aa              
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // 0.25/(1-t^2)
+       fma.s1 F_INV1T2_2 = F_05, F_INV_1T2, f0
+       nop.i 0
 }
 
-// acos_1d2V = frcpa(2V)
-{ .mfi
-      nop.m 999
-(p0)  frcpa.s1       acos_1d2V,p9  = f1, acos_2V                         
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // t*s-sqrt(1-t^2)*(1-s^2)*y
+       fnma.s1 F_TS = F_Y1S2, F_SQRT_1T2, F_TS
+       nop.i 0;;
 }
 
-// acos_Vv = ((A - VV) + a) * frcpa(2V)
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         acos_Vv       = acos_AmVVpa, acos_1d2V, f0          
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // z*0.5/(1-t^2)
+       fma.s1 F_ZE = F_INV_1T2, F_SQRT_1T2, f0
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)   fma.s1  acos_Uv   = acos_U,acos_Vv, f0                  
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // z^2+t^2-1
+       fms.s1 F_DZ0 = F_Z, F_Z, F_1T2
+       nop.i 0;;
 }
 
 
-.endp acosl#
-ASM_SIZE_DIRECTIVE(acosl#)
+{.mfi
+       nop.m 0
+       // (1-s^2-(1-s^2)_s)*x
+       fma.s1 F_DS2X = F_X, F_DS, f0
+       nop.i 0;;
+}
 
 
-.proc __libm_callout
-__libm_callout:
-.prologue
-{ .mfi
-        nop.m 0
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs
+{.mfi
+       nop.m 0
+       // t*s-(t*s)_s
+       fms.s1 F_DTS = F_T, f8, F_TSS
+       nop.i 0
 }
-;;
 
-{ .mfi
-        mov GR_SAVE_GP=gp
-        nop.f 0
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0
+{.mfi
+       nop.m 0
+       // c9*x^7+..+c2
+       fma.s1 F_S29 = F_X4, F_S69, F_S25
+       nop.i 0;;
 }
 
-.body
-{ .mfb
-      nop.m 999
-(p0)   fms.s1  acos_corr = acos_Uv,f1, acos_Vu                 
-(p0)   br.call.sptk.many  b0=__libm_atan2_reg# ;;                        
+
+{.mfi
+       nop.m 0
+       // y*z
+       fma.s1 F_YZ = F_Z, F_Y, f0
+       nop.i 0
 }
 
+{.mfi
+       nop.m 0
+       // t^2
+       fma.s1 F_T2 = F_T, F_T, f0
+       nop.i 0;;
+}
 
-// p6 ==> X is negative
-// p7 ==> x is positive
-// We know that |X| >= 1/4
 
-{ .mfi
-(p0)   mov gp              = GR_SAVE_GP                           
-(p0)   fcmp.lt.unc   p6,p7 = acos_X , f0                       
-(p0)   mov b0              = GR_SAVE_B0 ;;                           
+{.mfi
+       nop.m 0
+       // 1-t^2+ST
+       fma.s1 F_1T2_ST = F_ST, f1, F_1T2
+       nop.i 0;;
 }
 
-// acos_2_Z_hi    = 2 * acos_Z_hi
-// acos_s_lo_Z_lo = s_lo * Z_lo
 
-{ .mfi
-       nop.m 999
-(p0)   fma.s1  acos_2_Z_hi      = acos_Z_hi, f1, acos_Z_hi               
-(p0)   mov ar.pfs               = GR_SAVE_PFS                                     
+{.mfi
+       nop.m 0
+       // y*(1-s^2)(1-x)
+       fma.s1 F_Y1S2_1X = F_Y1S2, F_1X, f0
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)   fma.s1  acos_s_lo_Z_lo   = acos_s_lo, acos_Z_lo, f0               
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // dz ~ sqrt(1-t^2)-z
+       fma.s1 F_DZ = F_DZ0, F_ZE, f0
+       nop.i 0;;
 }
 
-// 2 is a constant needed later
-{ .mfi
-      nop.m 999
-(p0)  fma.s1     acos_2 = f1,f1,f1                             
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // -1+correction for sqrt(1-t^2)-z
+       fnma.s1 F_CORR = F_INV1T2_2, F_DZ0, f0
+       nop.i 0;;
 }
 
-// X >= 1/4
-// acos_result_lo = 2(s_lo * Z_lo) - corr
-// f8             = (2*Z_hi) + (2(s_lo * Z_lo) - corr)
 
-{ .mfi
-      nop.m 999
-(p7)   fma.s1  acos_result_lo     = acos_s_lo_Z_lo, acos_2, acos_corr      
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // (PS29*x^2+x)*y*(1-s^2)
+       fma.s1 F_S19 = F_Y1S2X2, F_S29, F_Y1S2X
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fma.s0   f8                 = acos_2_Z_hi, f1, acos_result_lo        
-      nop.i 999
+{.mfi
+       nop.m 0
+       // z*y*(1-s^2)_s
+       fma.s1 F_ZY1S2S = F_YZ, F_1S2_S, f0
+       nop.i 0
 }
 
-// acos_result_lo = (pi_lo - corr)
-// acos_result_lo = (pi_lo - corr) + acos_Ww 
-{ .mfi
-      nop.m 999
-(p6)  fms.s1  acos_result_lo     = acos_pi_lo, f1, acos_corr              
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // s^2-(1-t^2+ST)
+       fms.s1 F_1T2_ST = f8, f8, F_1T2_ST
+       nop.i 0;;
 }
 
-// X <= -1/4
-// acos_W = pi_hi - 2 * Z_hi
-{ .mfi
-      nop.m 999
-(p6)  fnma.s1 acos_W             = acos_2, acos_Z_hi, acos_pi_hi          
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // (t*s-(t*s)_s)+z*y*(1-s^2-(1-s^2)_s)*x
+       fma.s1 F_DTS = F_YZ, F_DS2X, F_DTS
+       nop.i 0
 }
 
-// acos_Ww = pi_hi - W
-// acos_Ww = (pi_hi - W) + (2 * Z_hi)
-{ .mfi
-      nop.m 999
-(p6)  fms.s1  acos_Ww            = acos_pi_hi, f1, acos_W                 
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // dz*y*(1-s^2)*(1-x)
+       fma.s1 F_DZ_TERM = F_DZ, F_Y1S2_1X, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)   fms.s1  acos_Ww            = acos_Ww, f1, acos_2_Z_hi               
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // R = t*s-sqrt(1-t^2)*(1-s^2)*y+sqrt(1-t^2)*(1-s^2)*y*PS19
+       // (used for polynomial evaluation)
+       fma.s1 F_R = F_S19, F_SQRT_1T2, F_TS
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)   fma.s1  acos_result_lo     = acos_result_lo, f1, acos_Ww            
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // (PS29*x^2)*y*(1-s^2)
+       fma.s1 F_S29 = F_Y1S2X2, F_S29, f0
+       nop.i 0
 }
 
-// acos_Z_lo = ((pi_lo - corr) + acos_Ww) - 2 * (s_lo * Z_lo)
-{ .mfi
-      nop.m 999
-(p6)  fnma.s1  acos_Z_lo          = acos_s_lo_Z_lo, acos_2, acos_result_lo 
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // apply correction to dz*y*(1-s^2)*(1-x)
+       fma.s1 F_DZ_TERM = F_DZ_TERM, F_CORR, F_DZ_TERM
+       nop.i 0;;
 }
 
-{ .mfb
-      nop.m 999
-(p6)  fma.s0   f8                  = acos_W, f1, acos_Z_lo                
-(p0)  br.ret.sptk   b0 ;;                          
+
+{.mfi
+       nop.m 0
+       // R^2
+       fma.s1 F_R2 = F_R, F_R, f0
+       nop.i 0;;
 }
-.endp __libm_callout
-ASM_SIZE_DIRECTIVE(__libm_callout)
 
-.proc SPECIAL
-SPECIAL:
-L(ACOS_NAN): 
-{ .mfb
-      nop.m 999
-(p0)  fma.s0 f8 = f8,f1,f0                       
-(p0)  br.ret.sptk   b0 ;;                          
+
+{.mfi
+       nop.m 0
+       // (t*s-(t*s)_s)+z*y*(1-s^2-(1-s^2)_s)*x+dz*y*(1-s^2)*(1-x)
+       fma.s1 F_DZ_TERM = F_DZ_TERM, f1, F_DTS
+       nop.i 0;;
 }
 
-L(ACOS_ERROR_RETURN): 
-// Save ar.pfs, b0, and gp; restore on exit
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    0   0        0     0 11 = 0xc3
+{.mfi
+       nop.m 0
+       // c7+c9*R^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
+}
 
-// Coming in as X = +- 1
-// What should we return?
+{.mfi
+       nop.m 0
+       // c3+c5*R^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0;;
+}
 
-// If X is 1, return (sign of X)pi/2
+{.mfi
+       nop.m 0
+       // asin(t)_low-(pi)_low (if s<0)
+ (p6)  fms.s1 F_ATLO = F_ATLO, f1, F_PI2_LO
+       nop.i 0
+}
 
+{.mfi
+       nop.m 0
+       // R^4
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0;;
+}
 
-{ .mfi
-      nop.m 999
-(p0)  fcmp.eq.unc p6,p7 = acos_ABS_NORM_f8,f1              
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R3 = F_R2, F_R, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)  fcmp.lt.unc p8,p9 = f8,f0                            
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // (t*s)_s-t^2*y*z
+       fnma.s1 F_TSS = F_T2, F_YZ, F_TSS
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s0 f8          = acos_pi_hi, f1, acos_pi_lo       
-      nop.i 999
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST)
+       fma.s1 F_DZ_TERM = F_YZ, F_1T2_ST, F_DZ_TERM
+       nop.i 0;;
 }
 
-{ .mfb
-      nop.m 999
-(p9)  fmerge.s    f8 = f8,f0                               
-(p6)  br.ret.spnt   b0 ;;                                     
+
+{.mfi
+       nop.m 0
+       // (pi)_hi-asin(t)_hi (if s<0)
+ (p6)  fms.s1 F_ATHI = F_PI2_HI, f1, F_ATHI
+       nop.i 0
 }
 
-// If X is a NAN, leave
-{ .mfi
-      nop.m 999
-(p0)  fclass.m.unc p12,p0 = f8, 0xc3            
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0;;
 }
 
-{ .mfb
-      nop.m 999
-(p12) fma.s0 f8 = f8,f1,f0                       
-(p12) br.ret.spnt   b0 ;;                          
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST)+
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29
+       fma.s1 F_DZ_TERM = F_SQRT_1T2, F_S29, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (t*s)_s-t^2*y*z+z*y*ST
+       fma.s1 F_TSS = F_YZ, F_ST, F_TSS
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // -asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fms.s1 F_P39 = F_P39, F_R3, F_ATLO
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) +
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 +
+       // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_DZ_TERM = F_P39, f1, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) +
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 + z*y*(1-s^2)_s*x +
+       // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_DZ_TERM = F_ZY1S2S, F_X, F_DZ_TERM
+       nop.i 0;;
 }
 
-{ .mfi
-(p0)   mov   GR_Parameter_TAG = 57 
-(p0)   frcpa f10, p6 = f0, f0
-nop.i 999
-};;
 
-.endp SPECIAL
-ASM_SIZE_DIRECTIVE(SPECIAL)
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) +
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 + z*y*(1-s^2)_s*x +
+       // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) +
+       // + (t*s)_s-t^2*y*z+z*y*ST
+       fma.s1 F_DZ_TERM = F_TSS, f1, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+.pred.rel "mutex", p6, p11
+{.mfi
+       nop.m 0
+       // result: add high part of table value
+       // s>0 in this case
+ (p11) fnma.s0 f8 = F_DZ_TERM, f1, F_ATHI
+       nop.i 0
+}
+
+{.mfb
+       nop.m 0
+       // result: add high part of pi-table value
+       // if s<0
+ (p6)  fma.s0 f8 = F_DZ_TERM, f1, F_ATHI
+       br.ret.sptk b0;;
+}
+
+
+
+
+
+
+SMALL_S:
+
+       // use 15-term polynomial approximation
+
+{.mmi
+       // r3 = pointer to polynomial coefficients
+       addl r3 = @ltoff(poly_coeffs), gp;;
+       // load start address for coefficients
+       ld8 r3 = [r3]
+       mov R_TMP = 0x3fbf;;
+}
+
+
+{.mmi
+       add r2 = 64, r3
+       ldfe F_C3 = [r3], 16
+       // p7 = 1 if |s|<2^{-64} (exponent of s<bias-64)
+       cmp.lt p7, p0 = R_EXP0, R_TMP;;
+}
+
+{.mmf
+       ldfe F_C5 = [r3], 16
+       ldfpd F_C11, F_C13 = [r2], 16
+	   nop.f 0;;
+}
+
+{.mmf
+       ldfpd F_C7, F_C9 = [r3], 16
+       ldfpd F_C15, F_C17 = [r2]
+       nop.f 0;;
+}
+
+
+
+{.mfb
+       // load pi/2
+       ldfpd F_PI2_LO, F_PI2_HI = [r3]
+       // s^2
+       fma.s1 F_R2 = f8, f8, f0
+	   // |s|<2^{-64}
+  (p7) br.cond.spnt  RETURN_PI2;;
+}
+
+
+{.mfi
+       nop.m 0
+       // s^3
+       fma.s1 F_R3 = f8, F_R2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // s^4
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c3+c5*s^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c11+c13*s^2
+       fma.s1 F_P1113 = F_C13, F_R2, F_C11
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c7+c9*s^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c15+c17*s^2
+       fma.s1 F_P1517 = F_C17, F_R2, F_C15
+       nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+	   // (pi/2)_high-s_high
+	   fnma.s1 F_T = f8, f1, F_PI2_HI
+	   nop.i 0
+}
+{.mfi
+       nop.m 0
+       // s^8
+       fma.s1 F_R8 = F_R4, F_R4, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c3+c5*s^2+c7*s^4+c9*s^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c11+c13*s^2+c15*s^4+c17*s^6
+       fma.s1 F_P1117 = F_P1517, F_R4, F_P1113
+       nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+	   // -s_high
+	   fms.s1 F_S = F_T, f1, F_PI2_HI
+	   nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+       // c3+..+c17*s^14
+       fma.s1 F_P317 = F_R8, F_P1117, F_P39
+       nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+	   // s_low
+	   fma.s1 F_DS = f8, f1, F_S
+	   nop.i 0;;
+}
 
-.proc __libm_error_region
-__libm_error_region:
+{.mfi
+       nop.m 0
+       // (pi/2)_low-s^3*(c3+..+c17*s^14)
+       fnma.s0 F_P317 = F_P317, F_R3, F_PI2_LO
+	   nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+	   // (pi/2)_low-s_low-s^3*(c3+..+c17*s^14)
+	   fms.s1 F_P317 = F_P317, f1, F_DS
+	   nop.i 0;;
+}
+
+{.mfb
+       nop.m 0
+	   // result: pi/2-s-c3*s^3-..-c17*s^17
+	   fma.s0 f8 = F_T, f1, F_P317
+       br.ret.sptk b0;;
+}
+
+
+
+
+
+RETURN_PI2:
+
+{.mfi
+       nop.m 0
+       // (pi/2)_low-s
+	   fms.s0 F_PI2_LO = F_PI2_LO, f1, f8
+	   nop.i 0;;
+}
+
+{.mfb
+       nop.m 0
+	   // (pi/2)-s
+	   fma.s0 f8 = F_PI2_HI, f1, F_PI2_LO
+	   br.ret.sptk b0;;
+}
+
+
+
+
+
+VERY_LARGE_INPUT:
+
+
+{.mmf
+       // pointer to pi_low, pi_high
+	   add r2 = 80, r3
+       // load C5
+       ldfe F_C5 = [r3], 16
+       // x = ((1-(s^2)_s)*y^2-1)/2-(s^2-(s^2)_s)*y^2/2
+       fma.s1 F_X = F_X, F_05, f0;;
+}
+
+.pred.rel "mutex", p6, p11
+{.mmf
+       // load pi (low, high), if s<0
+ (p6)  ldfpd F_PI2_LO, F_PI2_HI = [r2]
+       // C7, C9
+       ldfpd F_C7, F_C9 = [r3], 16
+	   // if s>0, set F_PI2_LO=0
+ (p11) fma.s1 F_PI2_HI = f0, f0, f0;;
+}
+
+{.mfi
+       nop.m 0
+ (p11) fma.s1 F_PI2_LO = f0, f0, f0
+       nop.i 0;;
+}
+
+{.mfi
+       // adjust address for C_11
+	   add r3 = 16, r3
+       // c9*x+c8
+       fma.s1 F_S89 = F_X, F_CS9, F_CS8
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // x^2
+       fma.s1 F_X2 = F_X, F_X, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)*x
+       fma.s1 F_Y1S2X = F_Y1S2, F_X, f0
+       nop.i 0
+}
+
+{.mfi
+       // C11, C13
+       ldfpd F_C11, F_C13 = [r3], 16
+       // c7*x+c6
+       fma.s1 F_S67 = F_X, F_CS7, F_CS6
+       nop.i 0;;
+}
+
+
+{.mfi
+       // C15, C17
+       ldfpd F_C15, F_C17 = [r3], 16
+       // c3*x+c2
+       fma.s1 F_S23 = F_X, F_CS3, F_CS2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c5*x+c4
+       fma.s1 F_S45 = F_X, F_CS5, F_CS4
+       nop.i 0;;
+}
+
+
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)*x^2
+       fma.s1 F_Y1S2X2 = F_Y1S2, F_X2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // x^4
+       fma.s1 F_X4 = F_X2, F_X2, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c9*x^3+..+c6
+       fma.s1 F_S69 = F_X2, F_S89, F_S67
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c5*x^3+..+c2
+       fma.s1 F_S25 = F_X2, F_S45, F_S23
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // (pi)_high-y*(1-s^2)_s
+       fnma.s1 F_HI = F_Y, F_1S2_S, F_PI2_HI
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c9*x^7+..+c2
+       fma.s1 F_S29 = F_X4, F_S69, F_S25
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // -(y*(1-s^2)_s)_high
+       fms.s1 F_1S2_HI = F_HI, f1, F_PI2_HI
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (PS29*x^2+x)*y*(1-s^2)
+       fma.s1 F_S19 = F_Y1S2X2, F_S29, F_Y1S2X
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)_s-(y*(1-s^2))_high
+       fma.s1 F_DS2 = F_Y, F_1S2_S, F_1S2_HI
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // R ~ sqrt(1-s^2)
+       // (used for polynomial evaluation)
+       fnma.s1 F_R = F_S19, f1, F_Y1S2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)-(y*(1-s^2))_high
+       fma.s1 F_DS2 = F_Y, F_DS, F_DS2
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // (pi)_low+(PS29*x^2)*y*(1-s^2)
+       fma.s1 F_S29 = F_Y1S2X2, F_S29, F_PI2_LO
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // R^2
+       fma.s1 F_R2 = F_R, F_R, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+	   // if s<0
+       // (pi)_low+(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-(y*(1-s^2))_high)
+       fms.s1 F_S29 = F_S29, f1, F_DS2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c7+c9*R^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // R^4
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R3 = F_R2, F_R, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c11+c13*R^2
+       fma.s1 F_P1113 = F_C13, F_R2, F_C11
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c15+c17*R^2
+       fma.s1 F_P1517 = F_C17, F_R2, F_C15
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (pi)_low+(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-(y*(1-s^2))_high)+y*(1-s^2)*x
+       fma.s1 F_S29 = F_Y1S2, F_X, F_S29
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c11+c13*R^2+c15*R^4+c17*R^6
+       fma.s1 F_P1117 = F_P1517, F_R4, F_P1113
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // R^8
+       fma.s1 F_R8 = F_R4, F_R4, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6+..+c17*R^14
+       fma.s1 F_P317 = F_P1117, F_R8, F_P39
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (pi)_low-(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-
+       // -(y*(1-s^2))_high)+y*(1-s^2)*x - P3, 17
+       fnma.s1 F_S29 = F_P317, F_R3, F_S29
+       nop.i 0;;
+}
+
+.pred.rel "mutex", p6, p11
+{.mfi
+       nop.m 0
+       // Result (if s<0):
+       // (pi)_low-(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-
+       // -(y*(1-s^2))_high)+y*(1-s^2)*x - P3, 17
+       // +(pi)_high-(y*(1-s^2))_high
+ (p6)  fma.s0 f8 = F_S29, f1, F_HI
+       nop.i 0
+}
+
+{.mfb
+       nop.m 0
+	   // Result (if s>0):
+       // (PS29*x^2)*y*(1-s^2)-
+       // -y*(1-s^2)*x + P3, 17
+       // +(y*(1-s^2))
+ (p11) fms.s0 f8 = F_Y, F_1S2_S, F_S29
+       br.ret.sptk b0;;
+}
+
+
+
+
+
+
+acosl_SPECIAL_CASES:
+
+{.mfi
+       alloc r32 = ar.pfs, 1, 4, 4, 0
+       // check if the input is a NaN, or unsupported format
+       // (i.e. not infinity or normal/denormal)
+       fclass.nm p7, p8 = f8, 0x3f
+       // pointer to pi/2
+       add r3 = 96, r3;;
+}
+
+
+{.mfi
+       // load pi/2
+       ldfpd F_PI2_HI, F_PI2_LO = [r3]
+       // get |s|
+       fmerge.s F_S = f0, f8
+       nop.i 0
+}
+
+{.mfb
+       nop.m 0
+       // if NaN, quietize it, and return
+ (p7) fma.s0 f8 = f8, f1, f0
+ (p7) br.ret.spnt b0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // |s| = 1 ?
+       fcmp.eq.s0 p9, p10 = F_S, f1
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // load FR_X
+       fma.s1 FR_X = f8, f1, f0
+       // load error tag
+       mov GR_Parameter_TAG = 57;;
+}
+
+
+{.mfi
+       nop.m 0
+       // if s = 1, result is 0
+ (p9)  fma.s0 f8 = f0, f0, f0
+       // set p6=0 for |s|>1
+ (p10) cmp.ne p6, p0 = r0, r0;;
+}
+
+
+{.mfb
+       nop.m 0
+       //  if s = -1, result is pi
+ (p6) fma.s0 f8 = F_PI2_HI, f1, F_PI2_LO
+       // return if |s| = 1
+ (p9) br.ret.sptk b0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // get Infinity
+       frcpa.s1 FR_RESULT, p0 = f1, f0
+       nop.i 0;;
+}
+
+
+{.mfb
+       nop.m 0
+       // return QNaN indefinite (0*Infinity)
+       fma.s0 FR_RESULT = f0, FR_RESULT, f0
+       nop.b 0;;
+}
+
+
+GLOBAL_LIBM_END(acosl)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 // (1)
 { .mfi
@@ -1068,12 +2511,12 @@ __libm_error_region:
 .body
 // (3)
 { .mib
-        stfe [GR_Parameter_X] = f8              // Store Parameter 1 on stack
+        stfe [GR_Parameter_X] = FR_X              // Store Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y
         nop.b 0                                 // Parameter 3 address
 }
 { .mib
-        stfe [GR_Parameter_Y] = f10             // Store Parameter 3 on stack
+        stfe [GR_Parameter_Y] = FR_RESULT             // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
         br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
@@ -1097,11 +2540,13 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
 
-.type   __libm_atan2_reg#,@function
-.global __libm_atan2_reg#
+
+
+
+
+
diff --git a/sysdeps/ia64/fpu/e_asin.S b/sysdeps/ia64/fpu/e_asin.S
index bb4c242fb2..f995c597f4 100644
--- a/sysdeps/ia64/fpu/e_asin.S
+++ b/sysdeps/ia64/fpu/e_asin.S
@@ -1,10 +1,10 @@
 .file "asin.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003 Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,818 +35,777 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 
 // History
 //==============================================================
-// 2/02/00  Initial version 
-// 8/17/00  New and much faster algorithm.
-// 8/31/00  Avoided bank conflicts on loads, shortened |x|=1 path, 
+// 02/02/00 Initial version
+// 08/17/00 New and much faster algorithm.
+// 08/31/00 Avoided bank conflicts on loads, shortened |x|=1 path,
 //          fixed mfb split issue stalls.
 // 12/19/00 Fixed small arg cases to force inexact, or inexact and underflow.
+// 08/02/02 New and much faster algorithm II
+// 02/06/03 Reordered header: .section, .global, .proc, .align
 
 // Description
 //=========================================
-// The asin function computes the principle value of the arc sine of x.
+// The asin function computes the principal value of the arc sine of x.
 // asin(0) returns 0, asin(1) returns pi/2, asin(-1) returns -pi/2.
 // A doman error occurs for arguments not in the range [-1,+1].
-
+//
 // The asin function returns the arc sine in the range [-pi/2, +pi/2] radians.
+//
+// There are 8 paths:
+// 1. x = +/-0.0
+//    Return asin(x) = +/-0.0
+//
+// 2. 0.0 < |x| < 0.625
+//    Return asin(x) = x + x^3 *PolA(x^2)
+//    where PolA(x^2) = A3 + A5*x^2 + A7*x^4 +...+ A35*x^32
+//
+// 3. 0.625 <=|x| < 1.0
+//    Return asin(x) = sign(x) * ( Pi/2 - sqrt(R) * PolB(R))
+//    Where R = 1 - |x|,
+//          PolB(R) = B0 + B1*R + B2*R^2 +...+B12*R^12
+//
+//    sqrt(R) is approximated using the following sequence:
+//        y0 = (1 + eps)/sqrt(R) - initial approximation by frsqrta,
+//             |eps| < 2^(-8)
+//        Then 3 iterations are used to refine the result:
+//        H0 = 0.5*y0
+//        S0 = R*y0
+//
+//        d0 = 0.5 - H0*S0
+//        H1 = H0 + d0*H0
+//        S1 = S0 + d0*S0
+//
+//        d1 = 0.5 - H1*S1
+//        H2 = H1 + d0*H1
+//        S2 = S1 + d0*S1
+//
+//        d2 = 0.5 - H2*S2
+//        S3 = S3 + d2*S3
+//
+//        S3 approximates sqrt(R) with enough accuracy for this algorithm
+//
+//    So, the result should be reconstracted as follows:
+//    asin(x) = sign(x) * (Pi/2 - S3*PolB(R))
+//
+//    But for optimization perposes the reconstruction step is slightly
+//    changed:
+//    asin(x) = sign(x)*(Pi/2 - PolB(R)*S2) + sign(x)*d2*S2*PolB(R)
+//
+// 4. |x| = 1.0
+//    Return asin(x) = sign(x)*Pi/2
+//
+// 5. 1.0 < |x| <= +INF
+//    A doman error occurs for arguments not in the range [-1,+1]
+//
+// 6. x = [S,Q]NaN
+//    Return asin(x) = QNaN
+//
+// 7. x is denormal
+//    Return asin(x) = x + x^3,
+//
+// 8. x is unnormal
+//    Normalize input in f8 and return to the very beginning of the function
+//
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input, output
+// f6, f7, f9 -> f15, f32 -> f63
 
-#include "libm_support.h"
+// General registers used:
+// r3, r21 -> r31, r32 -> r38
+
+// Predicate registers used:
+// p0, p6 -> p14
 
 //
 // Assembly macros
 //=========================================
-
-
-// predicate registers
-//asin_pred_LEsqrt2by2            = p7
-//asin_pred_GTsqrt2by2            = p8
-
-// integer registers
-ASIN_Addr1                      = r33
-ASIN_Addr2                      = r34
-ASIN_FFFE                       = r35
-ASIN_lnorm_sig                  = r36
-ASIN_snorm_exp                  = r37
-
-GR_SAVE_B0                      = r36
-GR_SAVE_PFS                     = r37
-GR_SAVE_GP                      = r38
-
-GR_Parameter_X                  = r39
-GR_Parameter_Y                  = r40
-GR_Parameter_RESULT             = r41
-GR_Parameter_Tag                = r42
-
-// floating point registers
-asin_coeff_P1                   = f32
-asin_coeff_P2                   = f33
-asin_coeff_P3                   = f34
-asin_coeff_P4                   = f35
-
-asin_coeff_P5                   = f36
-asin_coeff_P6                   = f37
-asin_coeff_P7                   = f38
-asin_coeff_P8                   = f39
-asin_coeff_P9                   = f40
-
-asin_coeff_P10                  = f41
-asin_coeff_P11                  = f42
-asin_coeff_P12                  = f43
-asin_coeff_P13                  = f44
-asin_coeff_P14                  = f45
-
-asin_coeff_P15                  = f46
-asin_coeff_P16                  = f47
-asin_coeff_P17                  = f48
-asin_coeff_P18                  = f49
-asin_coeff_P19                  = f50
-
-asin_coeff_P20                  = f51
-asin_coeff_P21                  = f52
-asin_const_sqrt2by2             = f53
-asin_const_piby2                = f54
-asin_abs_x                      = f55
-
-asin_tx                         = f56
-asin_tx2                        = f57
-asin_tx3                        = f58
-asin_tx4                        = f59
-asin_tx8                        = f60
-
-asin_tx11                       = f61
-asin_1poly_p8                   = f62
-asin_1poly_p19                  = f63
-asin_1poly_p4                   = f64
-asin_1poly_p15                  = f65
-
-asin_1poly_p6                   = f66
-asin_1poly_p17                  = f67
-asin_1poly_p0                   = f68
-asin_1poly_p11                  = f69
-asin_1poly_p2                   = f70
-
-asin_1poly_p13                  = f71
-asin_series_tx                  = f72
-asin_t                          = f73
-asin_t2                         = f74
-asin_t3                         = f75
-
-asin_t4                         = f76
-asin_t8                         = f77
-asin_t11                        = f78
-asin_poly_p8                    = f79
-asin_poly_p19                   = f80
-
-asin_poly_p4                    = f81
-asin_poly_p15                   = f82
-asin_poly_p6                    = f83
-asin_poly_p17                   = f84
-asin_poly_p0                    = f85
-
-asin_poly_p11                   = f86
-asin_poly_p2                    = f87
-asin_poly_p13                   = f88
-asin_series_t                   = f89
-asin_1by2                       = f90
-
-asin_3by2                       = f91
-asin_5by2                       = f92
-asin_11by4                      = f93
-asin_35by8                      = f94
-asin_63by8                      = f95
-
-asin_231by16                    = f96 
-asin_y0                         = f97 
-asin_H0                         = f98 
-asin_S0                         = f99 
-asin_d                          = f100
-
-asin_l1                         = f101
-asin_d2                         = f102
-asin_T0                         = f103
-asin_d1                         = f104
-asin_e0                         = f105
-
-asin_l2                         = f106
-asin_d3                         = f107
-asin_T3                         = f108
-asin_S1                         = f109
-asin_e1                         = f110
-
-asin_z                          = f111
-answer2                         = f112
-asin_sgn_x                      = f113
-asin_429by16                    = f114
-asin_18by4                      = f115
-
-asin_3by4                       = f116
-asin_l3                         = f117
-asin_T6                         = f118
-asin_eps_exp                    = f119
-asin_eps_sig                    = f120
-asin_eps                        = f120
-
+// integer registers used
+// scratch
+rTblAddr                      = r3
+
+rPiBy2Ptr                     = r21
+rTmpPtr3                      = r22
+rDenoBound                    = r23
+rOne                          = r24
+rAbsXBits                     = r25
+rHalf                         = r26
+r0625                         = r27
+rSign                         = r28
+rXBits                        = r29
+rTmpPtr2                      = r30
+rTmpPtr1                      = r31
+
+// stacked
+GR_SAVE_PFS                   = r32
+GR_SAVE_B0                    = r33
+GR_SAVE_GP                    = r34
+GR_Parameter_X                = r35
+GR_Parameter_Y                = r36
+GR_Parameter_RESULT           = r37
+GR_Parameter_TAG              = r38
+
+// floating point registers used
+FR_X                          = f10
+FR_Y                          = f1
+FR_RESULT                     = f8
+
+
+// scratch
+fXSqr                         = f6
+fXCube                        = f7
+fXQuadr                       = f9
+f1pX                          = f10
+f1mX                          = f11
+f1pXRcp                       = f12
+f1mXRcp                       = f13
+fH                            = f14
+fS                            = f15
+// stacked
+fA3                           = f32
+fB1                           = f32
+fA5                           = f33
+fB2                           = f33
+fA7                           = f34
+fPiBy2                        = f34
+fA9                           = f35
+fA11                          = f36
+fB10                          = f35
+fB11                          = f36
+fA13                          = f37
+fA15                          = f38
+fB4                           = f37
+fB5                           = f38
+fA17                          = f39
+fA19                          = f40
+fB6                           = f39
+fB7                           = f40
+fA21                          = f41
+fA23                          = f42
+fB3                           = f41
+fB8                           = f42
+fA25                          = f43
+fA27                          = f44
+fB9                           = f43
+fB12                          = f44
+fA29                          = f45
+fA31                          = f46
+fA33                          = f47
+fA35                          = f48
+fBaseP                        = f49
+fB0                           = f50
+fSignedS                      = f51
+fD                            = f52
+fHalf                         = f53
+fR                            = f54
+fCloseTo1Pol                  = f55
+fSignX                        = f56
+fDenoBound                    = f57
+fNormX                        = f58
+fX8                           = f59
+fRSqr                         = f60
+fRQuadr                       = f61
+fR8                           = f62
+fX16                          = f63
 // Data tables
 //==============================================================
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+RODATA
 .align 16
-
-asin_coeff_1_table:
-ASM_TYPE_DIRECTIVE(asin_coeff_1_table,@object)
-data8 0xE4E7E0A423A21249  , 0x00003FF8 //P7
-data8 0xC2F7EE0200FCE2A5  , 0x0000C003 //P18
-data8 0xB745D7F6C65C20E0  , 0x00003FF9 //P5
-data8 0xF75E381A323D4D94  , 0x0000C002 //P16
-data8 0x8959C2629C1024C0  , 0x0000C002 //P20
-data8 0xAFF68E7D241292C5  , 0x00003FF8 //P9
-data8 0xB6DB6DB7260AC30D  , 0x00003FFA //P3
-data8 0xD0417CE2B41CB7BF  , 0x0000C000 //P14
-data8 0x81D570FEA724E3E4  , 0x0000BFFD //P12
-data8 0xAAAAAAAAAAAAC277  , 0x00003FFC //P1
-data8 0xF534912FF3E7B76F  , 0x00003FFF //P21
-data8 0xc90fdaa22168c235  , 0x00003fff // pi/2
-data8 0x0000000000000000  , 0x00000000 // pad to avoid data bank conflict
-ASM_SIZE_DIRECTIVE(asin_coeff_1_table)
-	
-
-asin_coeff_2_table:
-ASM_TYPE_DIRECTIVE(asin_coeff_2_table,@object)
-data8 0x8E26AF5F29B39A2A  , 0x00003FF9 //P6
-data8 0xB4F118A4B1015470  , 0x00004003 //P17
-data8 0xF8E38E10C25990E0  , 0x00003FF9 //P4
-data8 0x80F50489AEF1CAC6  , 0x00004002 //P15
-data8 0x92728015172CFE1C  , 0x00004003 //P19
-data8 0xBBC3D831D4595971  , 0x00003FF8 //P8
-data8 0x999999999952A5C3  , 0x00003FFB //P2
-data8 0x855576BE6F0975EC  , 0x00003FFF //P13
-data8 0xF12420E778077D89  , 0x00003FFA //P11
-data8 0xB6590FF4D23DE003  , 0x00003FF3 //P10
-data8 0xb504f333f9de6484  , 0x00003ffe // sqrt(2)/2
-ASM_SIZE_DIRECTIVE(asin_coeff_2_table)
+LOCAL_OBJECT_START(asin_base_range_table)
+// Ai: Polynomial coefficients for the asin(x), |x| < .625000
+// Bi: Polynomial coefficients for the asin(x), |x| > .625000
+data8 0xBFDAAB56C01AE468 //A29
+data8 0x3FE1C470B76A5B2B //A31
+data8 0xBFDC5FF82A0C4205 //A33
+data8 0x3FC71FD88BFE93F0 //A35
+data8 0xB504F333F9DE6487, 0x00003FFF //B0
+data8 0xAAAAAAAAAAAAFC18, 0x00003FFC //A3
+data8 0x3F9F1C71BC4A7823 //A9
+data8 0x3F96E8BBAAB216B2 //A11
+data8 0x3F91C4CA1F9F8A98 //A13
+data8 0x3F8C9DDCEDEBE7A6 //A15
+data8 0x3F877784442B1516 //A17
+data8 0x3F859C0491802BA2 //A19
+data8 0x9999999998C88B8F, 0x00003FFB //A5
+data8 0x3F6BD7A9A660BF5E //A21
+data8 0x3F9FC1659340419D //A23
+data8 0xB6DB6DB798149BDF, 0x00003FFA //A7
+data8 0xBFB3EF18964D3ED3 //A25
+data8 0x3FCD285315542CF2 //A27
+data8 0xF15BEEEFF7D2966A, 0x00003FFB //B1
+data8 0x3EF0DDA376D10FB3 //B10
+data8 0xBEB83CAFE05EBAC9 //B11
+data8 0x3F65FFB67B513644 //B4
+data8 0x3F5032FBB86A4501 //B5
+data8 0x3F392162276C7CBA //B6
+data8 0x3F2435949FD98BDF //B7
+data8 0xD93923D7FA08341C, 0x00003FF9 //B2
+data8 0x3F802995B6D90BDB //B3
+data8 0x3F10DF86B341A63F //B8
+data8 0xC90FDAA22168C235, 0x00003FFF // Pi/2
+data8 0x3EFA3EBD6B0ECB9D //B9
+data8 0x3EDE18BA080E9098 //B12
+LOCAL_OBJECT_END(asin_base_range_table)
 
 
-
-.align 32
-.global asin
-
 .section .text
-.proc  asin
-.align 32
-
-
-asin:
- 
-{     .mfi 
-     alloc      r32               = ar.pfs,1,6,4,0
-     fma.s1    asin_tx        =    f8,f8,f0
-     addl      ASIN_Addr2     =    @ltoff(asin_coeff_2_table),gp
-} 
-{     .mfi 
-     mov       ASIN_FFFE      =    0xFFFE
-     fnma.s1   asin_t         =    f8,f8,f1
-     addl      ASIN_Addr1     =    @ltoff(asin_coeff_1_table),gp
+GLOBAL_LIBM_ENTRY(asin)
+asin_unnormal_back:
+{ .mfi
+      getf.d             rXBits = f8 // grab bits of input value
+      // set p12 = 1 if x is a NaN, denormal, or zero
+      fclass.m           p12, p0 = f8, 0xcf
+      adds               rSign = 1, r0
+}
+{ .mfi
+      addl               rTblAddr = @ltoff(asin_base_range_table),gp
+      // 1 - x = 1 - |x| for positive x
+      fms.s1             f1mX = f1, f1, f8
+      addl               rHalf = 0xFFFE, r0 // exponent of 1/2
 }
 ;;
-
- 
-{     .mfi 
-     setf.exp       asin_1by2      =    ASIN_FFFE
-     fmerge.s       asin_abs_x     =    f1,f8
-     nop.i          999              ;;
-} 
- 
-{     .mmf 
-     ld8       ASIN_Addr1     =    [ASIN_Addr1]
-     ld8       ASIN_Addr2     =    [ASIN_Addr2]
-     fmerge.s  asin_sgn_x     =    f8,f1 ;;
-} 
-
- 
-{     .mfi 
-     ldfe      asin_coeff_P7  =    [ASIN_Addr1],16
-     fma.s1    asin_tx2       =    asin_tx,asin_tx,f0
-     nop.i                      999
-} 
-{     .mfi 
-     ldfe      asin_coeff_P6  =    [ASIN_Addr2],16
-     fma.s1    asin_t2        =    asin_t,asin_t,f0
-     nop.i                      999;;
+{ .mfi
+      addl               r0625 = 0x3FE4, r0 // high 16 bits of 0.625
+      // set p8 = 1 if x < 0
+      fcmp.lt.s1         p8, p9 = f8, f0
+      shl                rSign = rSign, 63 // sign bit
 }
-
- 
-{     .mmf 
-     ldfe      asin_coeff_P18 =    [ASIN_Addr1],16
-     ldfe      asin_coeff_P17 =    [ASIN_Addr2],16
-     fclass.m.unc p8,p0  = f8, 0xc3	//@qnan |@snan
-} 
-;;
- 
-{     .mmf 
-     ldfe           asin_coeff_P5  =    [ASIN_Addr1],16
-     ldfe      asin_coeff_P4  =    [ASIN_Addr2],16
-     frsqrta.s1     asin_y0,p0     =    asin_t
-} 
-;;
- 
-{     .mfi 
-     ldfe      asin_coeff_P16 =    [ASIN_Addr1],16
-     fcmp.gt.s1 p9,p0 = asin_abs_x,f1
-     nop.i                      999
-} 
-{     .mfb 
-     ldfe      asin_coeff_P15 =    [ASIN_Addr2],16
-(p8) fma.d     f8 = f8,f1,f0
-(p8) br.ret.spnt b0
+{ .mfi
+      // point to the beginning of the table
+      ld8                rTblAddr = [rTblAddr]
+      // 1 + x = 1 - |x| for negative x
+      fma.s1             f1pX = f1, f1, f8
+      adds               rOne = 0x3FF, r0
 }
 ;;
-
- 
-{     .mmf 
-     ldfe      asin_coeff_P20 =    [ASIN_Addr1],16
-     ldfe      asin_coeff_P19 =    [ASIN_Addr2],16
-     fclass.m.unc p8,p0 = f8, 0x07	//@zero
-} 
-;;
- 
-
-{     .mfi 
-     ldfe      asin_coeff_P9  =    [ASIN_Addr1],16
-     fma.s1    asin_t4        =    asin_t2,asin_t2,f0
-(p9) mov GR_Parameter_Tag = 61 
-} 
-{     .mfi 
-     ldfe      asin_coeff_P8  =    [ASIN_Addr2],16
-     fma.s1    asin_3by2      =    asin_1by2,f1,f1
-     nop.i                      999;;
+{ .mfi
+      andcm              rAbsXBits = rXBits, rSign // bits of |x|
+      fmerge.s           fSignX = f8, f1 // signum(x)
+      shl                r0625 = r0625, 48 // bits of DP representation of 0.625
 }
-
- 
-{     .mfi 
-     ldfe      asin_coeff_P2  =    [ASIN_Addr2],16
-     fma.s1    asin_tx4       =    asin_tx2,asin_tx2,f0
-     nop.i                      999
-} 
-{     .mfb 
-     ldfe      asin_coeff_P3  =    [ASIN_Addr1],16
-     fma.s1    asin_t3        =    asin_t,asin_t2,f0
-(p8) br.ret.spnt b0
+{ .mfb
+      setf.exp           fHalf = rHalf // load A2 to FP reg
+      fma.s1             fXSqr = f8, f8, f0 // x^2
+      // branch on special path if x is a NaN, denormal, or zero
+(p12) br.cond.spnt       asin_special
 }
 ;;
-
- 
-{     .mfi 
-     ldfe      asin_coeff_P13 =    [ASIN_Addr2],16
-     fma.s1    asin_H0        =    asin_y0,asin_1by2,f0
-     nop.i                      999
-} 
-{     .mfb 
-     ldfe      asin_coeff_P14 =    [ASIN_Addr1],16
-     fma.s1    asin_S0        =    asin_y0,asin_t,f0
-(p9) br.cond.spnt  __libm_error_region
+{ .mfi
+      adds               rPiBy2Ptr = 272, rTblAddr
+      nop.f              0
+      shl                rOne = rOne, 52 // bits of 1.0
+}
+{ .mfi
+      adds               rTmpPtr1 = 16, rTblAddr
+      nop.f              0
+      // set p6 = 1 if |x| < 0.625
+      cmp.lt             p6, p7 = rAbsXBits, r0625
 }
 ;;
-
- 
-{     .mfi 
-     ldfe      asin_coeff_P11 =    [ASIN_Addr2],16
-     fcmp.eq.s1 p6,p0 = asin_abs_x,f1
-     nop.i                      999
-} 
-{     .mfi 
-     ldfe      asin_coeff_P12 =    [ASIN_Addr1],16
-     fma.s1    asin_tx3       =    asin_tx,asin_tx2,f0
-     nop.i                      999;;
+{ .mfi
+      ldfpd              fA29, fA31 = [rTblAddr] // A29, fA31
+      // 1 - x = 1 - |x| for positive x
+(p9)  fms.s1             fR = f1, f1, f8
+      // point to coefficient of "near 1" polynomial
+(p7)  adds               rTmpPtr2 = 176, rTblAddr
 }
-
- 
-{     .mfi 
-     ldfe      asin_coeff_P10 =    [ASIN_Addr2],16
-     fma.s1    asin_1poly_p6  =    asin_tx,asin_coeff_P7,asin_coeff_P6
-     nop.i                      999
-} 
-{     .mfi 
-     ldfe      asin_coeff_P1  =    [ASIN_Addr1],16
-     fma.s1    asin_poly_p6   =    asin_t,asin_coeff_P7,asin_coeff_P6
-     nop.i                      999;;
+{ .mfi
+      ldfpd              fA33, fA35 = [rTmpPtr1], 16 // A33, fA35
+      // 1 + x = 1 - |x| for negative x
+(p8)  fma.s1             fR = f1, f1, f8
+(p6)  adds               rTmpPtr2 = 48, rTblAddr
 }
-
- 
-{     .mfi 
-     ldfe      asin_const_sqrt2by2 =    [ASIN_Addr2],16
-     fma.s1    asin_5by2           =    asin_3by2,f1,f1
-     nop.i                           999
-} 
-{     .mfi 
-     ldfe      asin_coeff_P21 =    [ASIN_Addr1],16
-     fma.s1    asin_11by4     =    asin_3by2,asin_3by2,asin_1by2
-     nop.i                      999;;
+;;
+{ .mfi
+      ldfe               fB0 = [rTmpPtr1], 16 // B0
+      nop.f              0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     ldfe      asin_const_piby2    =    [ASIN_Addr1],16
-     fma.s1    asin_poly_p17       =    asin_t,asin_coeff_P18,asin_coeff_P17
-     nop.i                           999
-} 
-{     .mfb 
-     nop.m                 999
-     fma.s1    asin_3by4 =    asin_3by2,asin_1by2,f0
-(p6) br.cond.spnt  L(ASIN_ABS_1)      // Branch to short exit if |x|=1
+{ .mib
+      adds               rTmpPtr3 = 16, rTmpPtr2
+      // set p10 = 1 if |x| = 1.0
+      cmp.eq             p10, p0 = rAbsXBits, rOne
+      // branch on special path for |x| = 1.0
+(p10) br.cond.spnt       asin_abs_1
 }
 ;;
-
- 
-{     .mfi 
-     addl ASIN_lnorm_sig = -0x1,r0  // Form significand 0xffffffffffffffff
-     fma.s1    asin_poly_p15  =    asin_t,asin_coeff_P16,asin_coeff_P15
-     nop.i                      999
-} 
-{     .mfi 
-     addl ASIN_snorm_exp = 0x0c001,r0  // Form small exponent
-     fnma.s1   asin_d    =    asin_S0,asin_H0,asin_1by2
-     nop.i                 999;;
+{ .mfi
+      ldfe               fA3 = [rTmpPtr2], 48 // A3 or B1
+      nop.f              0
+      adds               rTmpPtr1 = 64, rTmpPtr3
 }
-
- 
-// Form the exponent and significand of a small number
-{     .mfi 
-     setf.sig asin_eps_sig = ASIN_lnorm_sig
-     fma.s1    asin_poly_p19  =    asin_t,asin_coeff_P20,asin_coeff_P19
-     nop.i                      999
-} 
-{     .mfi 
-     setf.exp asin_eps_exp = ASIN_snorm_exp
-     fma.s1    asin_poly_p4   =    asin_t,asin_coeff_P5,asin_coeff_P4
-     nop.i                      999;;
+{ .mib
+      ldfpd              fA9, fA11 = [rTmpPtr3], 16 // A9, A11 or B10, B11
+      // set p11 = 1 if |x| > 1.0
+      cmp.gt             p11, p0 = rAbsXBits, rOne
+      // branch on special path for |x| > 1.0
+(p11) br.cond.spnt       asin_abs_gt_1
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p17 =    asin_tx,asin_coeff_P18,asin_coeff_P17
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p8   =    asin_t,asin_coeff_P9,asin_coeff_P8
-     nop.i                      999;;
+;;
+{ .mfi
+      ldfpd              fA17, fA19 = [rTmpPtr2], 16 // A17, A19 or B6, B7
+      // initial approximation of 1 / sqrt(1 - x)
+      frsqrta.s1         f1mXRcp, p0 = f1mX
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fms.s1    asin_35by8     =    asin_5by2,asin_11by4,asin_5by2
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_63by8     =    asin_5by2,asin_11by4,f1
-     nop.i                      999;;
+{ .mfi
+      ldfpd              fA13, fA15 = [rTmpPtr3] // A13, A15 or B4, B5
+      fma.s1             fXCube = fXSqr, f8, f0 // x^3
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p13  =    asin_t,asin_coeff_P14,asin_coeff_P13
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_18by4     =    asin_3by2,asin_5by2,asin_3by4
-     nop.i                      999;;
+;;
+{ .mfi
+      ldfe               fA5 = [rTmpPtr2], 48 // A5 or B2
+      // initial approximation of 1 / sqrt(1 + x)
+      frsqrta.s1         f1pXRcp, p0 = f1pX
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_l1   =    asin_5by2,asin_d,asin_3by2
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_d2   =    asin_d,asin_d,f0
-     nop.i                 999;;
+{ .mfi
+      ldfpd              fA21, fA23 = [rTmpPtr1], 16 // A21, A23 or B3, B8
+      fma.s1             fXQuadr = fXSqr, fXSqr, f0 // x^4
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p15  =    asin_t2,asin_poly_p17,asin_poly_p15
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_T0   =    asin_d,asin_S0,f0
-     nop.i                 999;;
+;;
+{ .mfi
+      ldfe               fA7 = [rTmpPtr1] // A7 or Pi/2
+      fma.s1             fRSqr = fR, fR, f0 // R^2
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p19  =    asin_t2,asin_coeff_P21,asin_poly_p19
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p4   =    asin_t2,asin_poly_p6,asin_poly_p4
-     nop.i                      999;;
+{ .mfb
+      ldfpd              fA25, fA27 = [rTmpPtr2] // A25, A27 or B9, B12
+      nop.f              0
+(p6)  br.cond.spnt       asin_base_range;
 }
+;;
 
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_d1   =    asin_35by8,asin_d,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_231by16   =    asin_3by2,asin_35by8,asin_63by8
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+(p9)  fma.s1             fH = fHalf, f1mXRcp, f0 // H0 for x > 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p2   =    asin_t,asin_coeff_P3,asin_coeff_P2
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p8   =    asin_t2,asin_coeff_P10,asin_poly_p8
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+(p9)  fma.s1             fS = f1mX, f1mXRcp, f0  // S0 for x > 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p11  =    asin_t,asin_coeff_P12,asin_coeff_P11
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_e0   =    asin_d2,asin_l1,asin_d
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+(p8)  fma.s1             fH = fHalf, f1pXRcp, f0 // H0 for x < 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p15 =    asin_tx,asin_coeff_P16,asin_coeff_P15
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p0   =    asin_t,asin_coeff_P1,f1
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+(p8)  fma.s1             fS = f1pX, f1pXRcp, f0  // S0 for x > 0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p19 =    asin_tx,asin_coeff_P20,asin_coeff_P19
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p4  =    asin_tx,asin_coeff_P5,asin_coeff_P4
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRQuadr = fRSqr, fRSqr, f0 // R^4
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p8  =    asin_tx,asin_coeff_P9,asin_coeff_P8
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_l2   =    asin_231by16,asin_d,asin_63by8
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB11 = fB11, fR, fB10
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_d3   =    asin_d2,asin_d,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_T3   =    asin_d2,asin_T0,f0
-     nop.i                 999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB1 = fB1, fR, fB0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_429by16   =    asin_18by4,asin_11by4,asin_231by16
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_S1   =    asin_e0,asin_S0,asin_S0
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB5 = fB5, fR, fB4
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p4   =    asin_t4,asin_poly_p8,asin_poly_p4
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p15  =    asin_t4,asin_poly_p19,asin_poly_p15
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB7 = fB7, fR, fB6
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p0   =    asin_t2,asin_poly_p2,asin_poly_p0
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p11  =    asin_t2,asin_poly_p13,asin_poly_p11
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB3 = fB3, fR, fB2
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_t8   =    asin_t4,asin_t4,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_e1   =    asin_d2,asin_l2,asin_d1
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      fnma.s1            fD = fH, fS, fHalf // d0 = 1/2 - H0*S0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p4  =    asin_tx2,asin_1poly_p6,asin_1poly_p4
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p15 =    asin_tx2,asin_1poly_p17,asin_1poly_p15
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fR8 = fRQuadr, fRQuadr, f0 // R^4
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p8  =    asin_tx2,asin_coeff_P10,asin_1poly_p8
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p19 =    asin_tx2,asin_coeff_P21,asin_1poly_p19
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB9 = fB9, fR, fB8
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p2  =    asin_tx,asin_coeff_P3,asin_coeff_P2
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p13 =    asin_tx,asin_coeff_P14,asin_coeff_P13
-     nop.i                      999;;
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fB12 = fB12, fRSqr, fB11
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p0  =    asin_tx,asin_coeff_P1,f1
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p11 =    asin_tx,asin_coeff_P12,asin_coeff_P11
-     nop.i                      999;;
+{.mfi
+      nop.m              0
+      fma.s1             fB7 = fB7, fRSqr, fB5
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_l3   =    asin_429by16,asin_d,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_z    =    asin_e1,asin_T3,asin_S1
-     nop.i                 999;;
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fB3 = fB3, fRSqr, fB1
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p11  =    asin_t4,asin_poly_p15,asin_poly_p11
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_T6   =    asin_T3,asin_d3,f0
-     nop.i                 999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fH = fH, fD, fH // H1 = H0 + H0*d0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_t11  =    asin_t8,asin_t3,f0
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_poly_p0   =    asin_t4,asin_poly_p4,asin_poly_p0
-     nop.i                      999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fS = fS, fD, fS // S1 = S0 + S0*d0
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p4  =    asin_tx4,asin_1poly_p8,asin_1poly_p4
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p15 =    asin_tx4,asin_1poly_p19,asin_1poly_p15
-     nop.i                      999;;
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fPiBy2 = fPiBy2, fSignX, f0 // signum(x)*Pi/2
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p0  =    asin_tx2,asin_1poly_p2,asin_1poly_p0
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p11 =    asin_tx2,asin_1poly_p13,asin_1poly_p11
-     nop.i                      999;;
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB12 = fB12, fRSqr, fB9
+      nop.i              0
 }
-
- 
-{     .mfi 
-     nop.m                                                         999
-//     fcmp.le.s1     asin_pred_LEsqrt2by2,asin_pred_GTsqrt2by2    =    asin_abs_x,asin_const_sqrt2by2
-     fcmp.le.s1     p7,p8    =    asin_abs_x,asin_const_sqrt2by2
-     nop.i                                                         999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_tx8  =    asin_tx4,asin_tx4,f0
-     nop.i                 999;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB7 = fB7, fRQuadr, fB3
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fnma.s1            fD = fH, fS, fHalf // d1 = 1/2 - H1*S1
+      nop.i              0
 }
+{ .mfi
+      nop.m              0
+      fnma.s1            fSignedS = fSignX, fS, f0 // -signum(x)*S1
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fCloseTo1Pol = fB12, fR8, fB7
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fH = fH, fD, fH // H2 = H1 + H1*d1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fS = fS, fD, fS // S2 = S1 + S1*d1
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // -signum(x)* S2 = -signum(x)*(S1 + S1*d1)
+      fma.s1             fSignedS = fSignedS, fD, fSignedS
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fnma.s1            fD = fH, fS, fHalf // d2 = 1/2 - H2*S2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // signum(x)*(Pi/2 - PolB*S2)
+      fma.s1             fPiBy2 = fSignedS, fCloseTo1Pol, fPiBy2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // -signum(x)*PolB * S2
+      fma.s1             fCloseTo1Pol = fSignedS, fCloseTo1Pol, f0
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for 0.625 <= |x| < 1
+      fma.d.s0           f8 = fCloseTo1Pol, fD, fPiBy2
+      // exit here for  0.625 <= |x| < 1
+      br.ret.sptk        b0
+}
+;;
+
 
- 
-// Form a small number to force inexact flag for small args 
-{     .mfi 
-     nop.m                 999
-     fmerge.se asin_eps = asin_eps_exp,asin_eps_sig
-     nop.i                 999
-} 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_z    =    asin_l3,asin_T6,asin_z
-     nop.i                 999;;
-} 
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_series_t  =    asin_t11,asin_poly_p11,asin_poly_p0
-     nop.i                      999;;
-} 
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p0  =    asin_tx4,asin_1poly_p4,asin_1poly_p0
-     nop.i                      999
-} 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_1poly_p11 =    asin_tx4,asin_1poly_p15,asin_1poly_p11
-     nop.i                      999;;
+// here if |x| < 0.625
+.align 32
+asin_base_range:
+{ .mfi
+      nop.m              0
+      fma.s1             fA33 = fA33, fXSqr, fA31
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, fXSqr, fA13
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA29 = fA29, fXSqr, fA27
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fXSqr, fA23
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA21 = fA21, fXSqr, fA19
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, fXSqr, fA7
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA5 = fA5, fXSqr, fA3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA35 = fA35, fXQuadr, fA33
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, fXQuadr, fA15
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fX8 = fXQuadr, fXQuadr, f0 // x^8
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fXQuadr, fA21
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, fXQuadr, fA5
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA35 = fA35, fXQuadr, fA29
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, fXSqr, fA11
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fX16 = fX8, fX8, f0 // x^16
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA35 = fA35, fX8, fA25
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, fX8, fA9
+      nop.i              0
 }
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fBaseP = fA35, fX16, fA17
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for |x| < 0.625
+      fma.d.s0           f8 = fBaseP, fXCube, f8
+      // exit here for |x| < 0.625 path
+      br.ret.sptk        b0
+}
+;;
 
- 
-{     .mfi 
-     nop.m                 999
-     fma.s1    asin_tx11 =    asin_tx8,asin_tx3,f0
-     nop.i                 999;;
-} 
- 
-{     .mfi 
-                         nop.m                 999
-//(asin_pred_GTsqrt2by2)   fnma.s1      answer2   =    asin_z,asin_series_t,asin_const_piby2
-(p8)   fnma.s1      answer2   =    asin_z,asin_series_t,asin_const_piby2
-                         nop.i                 999;;
-} 
- 
-{     .mfi 
-     nop.m                      999
-     fma.s1    asin_series_tx =    asin_tx11,asin_1poly_p11,asin_1poly_p0
-     nop.i                      999;;
-} 
- 
-{     .mfi 
-                         nop.m                 999
-//(asin_pred_GTsqrt2by2)   fma.d     f8   =    asin_sgn_x,answer2,f0
-(p8)   fma.d     f8   =    asin_sgn_x,answer2,f0
-                         nop.i                 999;;
-} 
- 
-// asin_eps is added only to force inexact and possibly underflow flag 
-// in case asin_series_tx is zero
-//
-{     .mfi 
-                         nop.m                 999
-(p7)   fma.d     asin_eps   =    f8,asin_series_tx,asin_eps
-                         nop.i                 999
-} 
-{     .mfb 
-                         nop.m                 999
-//(asin_pred_LEsqrt2by2)   fma.d     f8   =    f8,asin_series_tx,f0
-(p7)   fma.d     f8   =    f8,asin_series_tx,f0
-       br.ret.sptk b0
-} 
+// here if |x| = 1
+// asin(x) = sign(x) * Pi/2
+.align 32
+asin_abs_1:
+{ .mfi
+      ldfe               fPiBy2 = [rPiBy2Ptr] // Pi/2
+      nop.f              0
+      nop.i              0
+}
+;;
+{.mfb
+      nop.m              0
+      // result for |x| = 1.0
+      fma.d.s0           f8 = fPiBy2, fSignX, f0
+      // exit here for |x| = 1.0
+      br.ret.sptk        b0
+}
 ;;
 
+// here if x is a NaN, denormal, or zero
+.align 32
+asin_special:
+{ .mfi
+      nop.m              0
+      // set p12 = 1 if x is a NaN
+      fclass.m           p12, p0 = f8, 0xc3
+      nop.i              0
+}
+{ .mlx
+      nop.m              0
+      // smallest positive DP normalized number
+      movl               rDenoBound = 0x0010000000000000
+}
+;;
+{ .mfi
+      nop.m              0
+      // set p13 = 1 if x = 0.0
+      fclass.m           p13, p0 = f8, 0x07
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnorm.s1           fNormX = f8
+      nop.i              0
+}
+;;
+{ .mfb
+      // load smallest normal to FP reg
+      setf.d             fDenoBound = rDenoBound
+      // answer if x is a NaN
+(p12) fma.d.s0           f8 = f8,f1,f0
+      // exit here if x is a NaN
+(p12) br.ret.spnt        b0
+}
+;;
+{ .mfb
+      nop.m              0
+      nop.f              0
+      // exit here if x = 0.0
+(p13) br.ret.spnt        b0
+}
+;;
+// if we still here then x is denormal or unnormal
+{ .mfi
+      nop.m              0
+      // absolute value of normalized x
+      fmerge.s           fNormX = f1, fNormX
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // set p14 = 1 if normalized x is greater than or
+      // equal to the smallest denormalized value
+      // So, if p14 is set to 1 it means that we deal with
+      // unnormal rather than with "true" denormal
+      fcmp.ge.s1         p14, p0 = fNormX, fDenoBound
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+(p14) fcmp.eq.s0         p6, p0 = f8, f0      // Set D flag if x unnormal
+      nop.i              0
+}
+{ .mfb
+      nop.m              0
+      // normalize unnormal input
+(p14) fnorm.s1           f8 = f8
+      // return to the main path
+(p14) br.cond.sptk       asin_unnormal_back
+}
+;;
+// if we still here it means that input is "true" denormal
+{ .mfb
+      nop.m              0
+      // final result if x is denormal
+      fma.d.s0           f8 = f8, fXSqr, f8
+      // exit here if x is denormal
+      br.ret.sptk        b0
+}
+;;
 
-L(ASIN_ABS_1):
-// Here for short exit if |x|=1
-{     .mfb 
-     nop.m                      999
-     fma.d    f8 =    asin_sgn_x,asin_const_piby2,f0
-     br.ret.sptk b0
-} 
+// here if |x| > 1.0
+// error handler should be called
+.align 32
+asin_abs_gt_1:
+{ .mfi
+      alloc              r32 = ar.pfs, 0, 3, 4, 0 // get some registers
+      fmerge.s           FR_X = f8,f8
+      nop.i              0
+}
+{ .mfb
+      mov                GR_Parameter_TAG = 61 // error code
+      frcpa.s0           FR_RESULT, p0 = f0,f0
+      // call error handler routine
+      br.cond.sptk       __libm_error_region
+}
 ;;
+GLOBAL_LIBM_END(asin)
 
 
-.endp asin
-ASM_SIZE_DIRECTIVE(asin)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-                nop.f 999
+        nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
         mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
@@ -857,28 +816,29 @@ __libm_error_region:
         mov GR_SAVE_GP=gp                       // Save gp
 };;
 { .mmi
-        stfs [GR_Parameter_Y] = f1,16         // Store Parameter 2 on stack
+        stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
         add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
         mov GR_SAVE_B0=b0                       // Save b0
 };;
-
 .body
-        frcpa.s0 f9,p0 = f0,f0
-;;
-
 { .mib
-        stfd [GR_Parameter_X] = f8            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfd [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = f9,-16           // Store Parameter 3 on stack
-        adds r32 = 48,sp
-        br.call.sptk b0=__libm_error_support#   // Call error handling function
+        stfd [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#         // Call error handling function
 };;
 { .mmi
-        ldfd  f8 = [r32]       // Get return result off stack
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
+};;
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
@@ -887,11 +847,8 @@ __libm_error_region:
         mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
-
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.type   __libm_error_support,@function
-.global __libm_error_support
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_asinf.S b/sysdeps/ia64/fpu/e_asinf.S
index ddae85880b..af24165d8e 100644
--- a/sysdeps/ia64/fpu/e_asinf.S
+++ b/sysdeps/ia64/fpu/e_asinf.S
@@ -1,10 +1,10 @@
 .file "asinf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/02/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,21 +35,25 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 
 // History
 //==============================================================
-// 2/02/00  Initial revision
-// 6/28/00  Improved speed 
-// 6/31/00  Changed register allocation because of some duplicate macros
+// 02/02/00 Initial version
+// 06/28/00 Improved speed 
+// 06/31/00 Changed register allocation because of some duplicate macros
 //          moved nan exit bundle up to gain a cycle. 
-// 8/08/00  Improved speed by avoiding SIR flush.
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 08/08/00 Improved speed by avoiding SIR flush.
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 8/17/00  Changed predicate register macro-usage to direct predicate
+// 08/17/00 Changed predicate register macro-usage to direct predicate
 //          names due to an assembler bug.
 // 10/17/00 Improved speed of x=0 and x=1 paths, set D flag if x denormal.
+// 03/13/01 Corrected sign of imm1 value in dep instruction.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
 
+	
 // Description
 //=========================================
 // The asinf function computes the arc sine of x in the range [-pi,+pi].
@@ -119,7 +123,6 @@
 //  answer2 = - sign(x) z P(t) + (sign(x) pi/2)
 //
 
-#include "libm_support.h"
 
 // Assembly macros
 //=========================================
@@ -225,42 +228,30 @@ asinf_poly_p1a                   = f90
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-asinf_coeff_1_table:
-ASM_TYPE_DIRECTIVE(asinf_coeff_1_table,@object)
+LOCAL_OBJECT_START(asinf_coeff_1_table)
 data8 0x3FC5555607DCF816 // P1
 data8 0x3F9CF81AD9BAB2C6 // P4
 data8 0x3FC59E0975074DF3 // P7
 data8 0xBFA6F4CC2780AA1D // P6
 data8 0x3FC2DD45292E93CB // P9
 data8 0x3fe6a09e667f3bcd // sqrt(2)/2
-ASM_SIZE_DIRECTIVE(asinf_coeff_1_table)
+LOCAL_OBJECT_END(asinf_coeff_1_table)
 
-asinf_coeff_2_table:
-ASM_TYPE_DIRECTIVE(asinf_coeff_2_table,@object)
+LOCAL_OBJECT_START(asinf_coeff_2_table)
 data8 0x3FA6F108E31EFBA6 // P3
 data8 0xBFCA31BF175D82A0 // P8
 data8 0x3FA30C0337F6418B // P5
 data8 0x3FB332C9266CB1F9 // P2
 data8 0x3ff921fb54442d18 // pi_by_2
-ASM_SIZE_DIRECTIVE(asinf_coeff_2_table)
+LOCAL_OBJECT_END(asinf_coeff_2_table)
 
 
-.align 32
-.global asinf
-
 .section .text
-.proc  asinf
-.align 32
-
-asinf:
+GLOBAL_LIBM_ENTRY(asinf)
  
 // Load the addresses of the two tables.
 // Then, load the coefficients and other constants.
@@ -345,7 +336,7 @@ asinf:
 } 
 {     .mfb 
      nop.m                                               999
-(p8) fma.s f8                = f8,f1,f0
+(p8) fma.s.s0 f8                = f8,f1,f0
 (p8) br.ret.spnt   b0 ;;  // Exit if x=nan
 }
 
@@ -370,7 +361,7 @@ asinf:
 {     .mfb 
      nop.m                      999
      fma.s1    asinf_t4  =    asinf_t2,asinf_t2,f0
-(p6) br.cond.spnt  L(ASINF_ABS_ONE) ;;     // Branch if |x|=1
+(p6) br.cond.spnt  ASINF_ABS_ONE ;;     // Branch if |x|=1
 } 
 
 {     .mfi 
@@ -572,27 +563,26 @@ asinf:
 .pred.rel "mutex",p8,p7    //asinf_pred_GTsqrt2by2,asinf_pred_LEsqrt2by2
 {     .mfi 
                          nop.m            999
-(p8)  fnma.s     f8   =    asinf_z,asinf_Pt,asinf_sgn_x_piby2
+(p8)  fnma.s.s0     f8   =    asinf_z,asinf_Pt,asinf_sgn_x_piby2
                          nop.i            999
 } 
  
 {     .mfb 
                          nop.m            999
-(p7)  fma.s    f8    =    asinf_x11,asinf_poly_Bx,asinf_poly_Ax
+(p7)  fma.s.s0    f8    =    asinf_x11,asinf_poly_Bx,asinf_poly_Ax
                          br.ret.sptk b0 ;;
 } 
 
-L(ASINF_ABS_ONE):
+ASINF_ABS_ONE:
 // Here for short exit if |x|=1
 {     .mfb 
      nop.m                      999
-     fma.s    f8 =    asinf_sgn_x,asinf_const_piby2,f0
+     fma.s.s0    f8 =    asinf_sgn_x,asinf_const_piby2,f0
      br.ret.sptk b0
 } 
 ;;
 
-.endp asinf
-ASM_SIZE_DIRECTIVE(asinf)
+GLOBAL_LIBM_END(asinf)
 
 // Stack operations when calling error support.
 //       (1)               (2)                  
@@ -623,8 +613,7 @@ ASM_SIZE_DIRECTIVE(asinf)
 //                              restore gp
 //                              restore ar.pfs
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -680,8 +669,7 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_asinl.S b/sysdeps/ia64/fpu/e_asinl.S
index 9153832090..ad65a731fc 100644
--- a/sysdeps/ia64/fpu/e_asinl.S
+++ b/sysdeps/ia64/fpu/e_asinl.S
@@ -1,10 +1,10 @@
 .file "asinl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2001 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,720 +20,2449 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version 
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
-//          set [the previously overwritten] GR_Parameter_RESULT.
+// 08/28/01 New version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
-// long double = asinl(long double)
-// input  floating point f8
-// output floating point f8
+// long double asinl(long double)
 //
-// Registers used
+// Overview of operation
 //==============================================================
+// Background
 //
-// predicate registers used:
-// p6 -> p12
+// Implementation
 //
-// floating-point registers used:
-// f8 has input, then output
-// f32 -> f87, f8 -> f13, f32 -> f87
+// For |s| in [2^{-4}, sqrt(2)/2]:
+// Let t= 2^k*1.b1 b2..b6 1, where s= 2^k*1.b1 b2.. b52
+// asin(s)= asin(t)+asin(r), where r= s*sqrt(1-t^2)-t*sqrt(1-s^2), i.e.
+// r= (s-t)*sqrt(1-t^2)-t*sqrt(1-t^2)*(sqrt((1-s^2)/(1-t^2))-1)
+// asin(r)-r evaluated as 9-degree polynomial (c3*r^3+c5*r^5+c7*r^7+c9*r^9)
+// The 64-bit significands of sqrt(1-t^2), 1/(1-t^2) are read from the table,
+// along with the high and low parts of asin(t) (stored as two double precision
+// values)
 //
-// general registers used:
-// r32 -> r47
+// |s| in (sqrt(2)/2, sqrt(255/256)):
+// Let t= 2^k*1.b1 b2..b6 1, where (1-s^2)*frsqrta(1-s^2)= 2^k*1.b1 b2..b6..
+// asin(|s|)= pi/2-asin(t)+asin(r), r= s*t-sqrt(1-s^2)*sqrt(1-t^2)
+// To minimize accumulated errors, r is computed as
+// r= (t*s)_s-t^2*y*z+z*y*(t^2-1+s^2)_s+z*y*(1-s^2)_s*x+z'*y*(1-s^2)*PS29+
+// +(t*s-(t*s)_s)+z*y*((t^2-1-(t^2-1+s^2)_s)+s^2)+z*y*(1-s^2-(1-s^2)_s)+
+// +ez*z'*y*(1-s^2)*(1-x),
+// where y= frsqrta(1-s^2), z= (sqrt(1-t^2))_s (rounded to 24 significant bits)
+// z'= sqrt(1-t^2), x= ((1-s^2)*y^2-1)/2
+//
+// |s|<2^{-4}: evaluate as 17-degree polynomial
+// (or simply return s, if|s|<2^{-64})
+//
+// |s| in [sqrt(255/256), 1): asin(|s|)= pi/2-asin(sqrt(1-s^2))
+// use 17-degree polynomial for asin(sqrt(1-s^2)),
+// 9-degree polynomial to evaluate sqrt(1-s^2)
+// High order term is (pi/2)_high-(y*(1-s^2))_high
 //
-// Overview of operation
-//==============================================================
-// There are three paths
-// 1. |x| < 2^-40                 ASIN_TINY
-// 2. 2^-40 <= |x| < 1/4          ASIN_POLY
-// 3. 1/4 <= |x| < 1              ASIN_ATAN
 
-#include "libm_support.h"
 
-// Assembly macros
-//==============================================================
-FR_RESULT = f10
-FR_X = f8
-FR_Y = f1
-asin_P79                   = f32
-asin_P59                   = f33
-asin_P39                   = f34
-asin_P19                   = f35
-
-asin_P810                  = f36
-asin_P610                  = f37
-asin_P410                  = f38
-asin_P210                  = f39
-
-asin_A1                    = f41
-asin_A2                    = f42
-asin_A3                    = f43
-asin_A4                    = f44
-asin_A5                    = f45
-asin_A6                    = f46
-asin_A7                    = f47
-asin_A8                    = f48
-asin_A9                    = f49
-asin_A10                   = f50
-
-asin_X2                    = f51
-asin_X4                    = f52
-
-asin_B                     = f53
-asin_Bb                    = f54
-asin_C                     = f55
-asin_Cc                    = f56
-asin_D                     = f57
-
-asin_W                     = f58
-asin_Ww                    = f59
-
-asin_y0                    = f60
-asin_y1                    = f61
-asin_y2                    = f62
-
-asin_H                     = f63
-asin_Hh                    = f64
-
-asin_t1                    = f65
-asin_t2                    = f66
-asin_t3                    = f67
-asin_t4                    = f68
-asin_t5                    = f69
-
-asin_Pseries               = f70
-asin_NORM_f8               = f71
-asin_ABS_NORM_f8           = f72
-
-asin_2m100                 = f73
-asin_P1P2                  = f74
-asin_HALF                  = f75
-asin_1mD                   = f76
-
-asin_1mB                   = f77
-asin_1mBmC                 = f78 
-asin_S                     = f79
-
-asin_BmWW                  = f80 
-asin_BmWWpb                = f81 
-asin_2W                    = f82 
-asin_1d2W                  = f83 
-asin_Dd                    = f84
-
-asin_XWw                   = f85 
-asin_low                   = f86
-
-asin_pi_by_2               = f87
-asin_pi_by_2_lo            = f88
-
-asin_GR_17_ones            = r33
-asin_GR_16_ones            = r34
-asin_GR_signexp_f8         = r35
-asin_GR_exp                = r36
-asin_GR_true_exp           = r37
-asin_GR_ff9b               = r38 
-
-GR_SAVE_B0              = r39
-GR_SAVE_SP              = r40
-GR_SAVE_PFS             = r33 
-// r33 can be used safely.
-// r40 is address of table of coefficients
-// Later it is used to save sp across calls 
-GR_SAVE_GP              = r41
-asin_GR_fffe               = r42 
-asin_GR_retval             = r43 
-
-GR_Parameter_X                 = r44 
-GR_Parameter_Y                 = r45 
-GR_Parameter_RESULT            = r46 
-GR_Parameter_TAG               = r47 
-
-
-// 2^-40:
-// A true exponent of -40 is
-//                    : -40 + register_bias
-//                    : -28 + ffff = ffd7
-
-// A true exponent of -100 is 
-//                    : -100 + register_bias
-//                    : -64 + ffff = ff9b
-
-// Data tables
+
+// Registers used
 //==============================================================
+// f6-f15, f32-f36
+// r2-r3, r23-r23
+// p6, p7, p8, p12
+//
+
+
+       GR_SAVE_B0= r33
+       GR_SAVE_PFS= r34
+       GR_SAVE_GP= r35 // This reg. can safely be used
+       GR_SAVE_SP= r36
+
+       GR_Parameter_X= r37
+       GR_Parameter_Y= r38
+       GR_Parameter_RESULT= r39
+       GR_Parameter_TAG= r40
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+       FR_X= f10
+       FR_Y= f1
+       FR_RESULT= f8
+
+
+
+RODATA
 
 .align 16
 
-asin_coefficients:
-ASM_TYPE_DIRECTIVE(asin_coefficients,@object)
-data8  0xBB08911F2013961E, 0x00003FF8            // A10
-data8  0x981F1095A23A87D3, 0x00003FF8            // A9 
-data8  0xBDF09C6C4177BCC6, 0x00003FF8            // A8 
-data8  0xE4C3A60B049ACCEA, 0x00003FF8            // A7 
-data8  0x8E2789F4E8A8F1AD, 0x00003FF9            // A6 
-data8  0xB745D09B2B0E850B, 0x00003FF9            // A5 
-data8  0xF8E38E3BC4C50920, 0x00003FF9            // A4 
-data8  0xB6DB6DB6D89FCD81, 0x00003FFA            // A3 
-data8  0x99999999999AF376, 0x00003FFB            // A2 
-data8  0xAAAAAAAAAAAAAA71, 0x00003FFC            // A1
-
-data8  0xc90fdaa22168c234, 0x00003FFF            // pi_by_2_hi
-data8  0xc4c6628b80dc1cd1, 0x00003FBF            // pi_by_2_lo
-ASM_SIZE_DIRECTIVE(asin_coefficients)
-
-.align 32
-.global asinl#
+
+
+LOCAL_OBJECT_START(T_table)
+
+// stores 64-bit significand of 1/(1-t^2), 64-bit significand of sqrt(1-t^2),
+// asin(t)_high (double precision), asin(t)_low (double precision)
+
+data8 0x80828692b71c4391, 0xff7ddcec2d87e879
+data8 0x3fb022bc0ae531a0, 0x3c9f599c7bb42af6
+data8 0x80869f0163d0b082, 0xff79cad2247914d3
+data8 0x3fb062dd26afc320, 0x3ca4eff21bd49c5c
+data8 0x808ac7d5a8690705, 0xff75a89ed6b626b9
+data8 0x3fb0a2ff4a1821e0, 0x3cb7e33b58f164cc
+data8 0x808f0112ad8ad2e0, 0xff7176517c2cc0cb
+data8 0x3fb0e32279319d80, 0x3caee31546582c43
+data8 0x80934abba8a1da0a, 0xff6d33e949b1ed31
+data8 0x3fb12346b8101da0, 0x3cb8bfe463d087cd
+data8 0x8097a4d3dbe63d8f, 0xff68e16571015c63
+data8 0x3fb1636c0ac824e0, 0x3c8870a7c5a3556f
+data8 0x809c0f5e9662b3dd, 0xff647ec520bca0f0
+data8 0x3fb1a392756ed280, 0x3c964f1a927461ae
+data8 0x80a08a5f33fadc66, 0xff600c07846a6830
+data8 0x3fb1e3b9fc19e580, 0x3c69eb3576d56332
+data8 0x80a515d91d71acd4, 0xff5b892bc475affa
+data8 0x3fb223e2a2dfbe80, 0x3c6a4e19fd972fb6
+data8 0x80a9b1cfc86ff7cd, 0xff56f631062cf93d
+data8 0x3fb2640c6dd76260, 0x3c62041160e0849e
+data8 0x80ae5e46b78b0d68, 0xff5253166bc17794
+data8 0x3fb2a43761187c80, 0x3cac61651af678c0
+data8 0x80b31b417a4b756b, 0xff4d9fdb14463dc8
+data8 0x3fb2e46380bb6160, 0x3cb06ef23eeba7a1
+data8 0x80b7e8c3ad33c369, 0xff48dc7e1baf6738
+data8 0x3fb32490d0d910c0, 0x3caa05f480b300d5
+data8 0x80bcc6d0f9c784d6, 0xff4408fe9ad13e37
+data8 0x3fb364bf558b3820, 0x3cb01e7e403aaab9
+data8 0x80c1b56d1692492d, 0xff3f255ba75f5f4e
+data8 0x3fb3a4ef12ec3540, 0x3cb4fe8fcdf5f5f1
+data8 0x80c6b49bc72ec446, 0xff3a319453ebd961
+data8 0x3fb3e5200d171880, 0x3caf2dc089b2b7e2
+data8 0x80cbc460dc4e0ae8, 0xff352da7afe64ac6
+data8 0x3fb425524827a720, 0x3cb75a855e7c6053
+data8 0x80d0e4c033bee9c4, 0xff301994c79afb32
+data8 0x3fb46585c83a5e00, 0x3cb3264981c019ab
+data8 0x80d615bdb87556db, 0xff2af55aa431f291
+data8 0x3fb4a5ba916c73c0, 0x3c994251d94427b5
+data8 0x80db575d6291fd8a, 0xff25c0f84bae0cb9
+data8 0x3fb4e5f0a7dbdb20, 0x3cbee2fcc4c786cb
+data8 0x80e0a9a33769e535, 0xff207c6cc0ec09fd
+data8 0x3fb526280fa74620, 0x3c940656e5549b91
+data8 0x80e60c93498e32cd, 0xff1b27b703a19c98
+data8 0x3fb56660ccee2740, 0x3ca7082374d7b2cd
+data8 0x80eb8031b8d4052d, 0xff15c2d6105c72f8
+data8 0x3fb5a69ae3d0b520, 0x3c7c4d46e09ac68a
+data8 0x80f10482b25c6c8a, 0xff104dc8e0813ed4
+data8 0x3fb5e6d6586fec20, 0x3c9aa84ffd9b4958
+data8 0x80f6998a709c7cfb, 0xff0ac88e6a4ab926
+data8 0x3fb627132eed9140, 0x3cbced2cbbbe7d16
+data8 0x80fc3f4d3b657c44, 0xff053325a0c8a2ec
+data8 0x3fb667516b6c34c0, 0x3c6489c5fc68595a
+data8 0x8101f5cf67ed2af8, 0xfeff8d8d73dec2bb
+data8 0x3fb6a791120f33a0, 0x3cbe12acf159dfad
+data8 0x8107bd1558d6291f, 0xfef9d7c4d043df29
+data8 0x3fb6e7d226fabba0, 0x3ca386d099cd0dc7
+data8 0x810d95237e38766a, 0xfef411ca9f80b5f7
+data8 0x3fb72814ae53cc20, 0x3cb9f35731e71dd6
+data8 0x81137dfe55aa0e29, 0xfeee3b9dc7eef009
+data8 0x3fb76858ac403a00, 0x3c74df3dd959141a
+data8 0x811977aa6a479f0f, 0xfee8553d2cb8122c
+data8 0x3fb7a89e24e6b0e0, 0x3ca6034406ee42bc
+data8 0x811f822c54bd5ef8, 0xfee25ea7add46a91
+data8 0x3fb7e8e51c6eb6a0, 0x3cb82f8f78e68ed7
+data8 0x81259d88bb4ffac1, 0xfedc57dc2809fb1d
+data8 0x3fb8292d9700ad60, 0x3cbebb73c0e653f9
+data8 0x812bc9c451e5a257, 0xfed640d974eb6068
+data8 0x3fb8697798c5d620, 0x3ca2feee76a9701b
+data8 0x813206e3da0f3124, 0xfed0199e6ad6b585
+data8 0x3fb8a9c325e852e0, 0x3cb9e88f2f4d0efe
+data8 0x813854ec231172f9, 0xfec9e229dcf4747d
+data8 0x3fb8ea1042932a00, 0x3ca5ff40d81f66fd
+data8 0x813eb3e209ee858f, 0xfec39a7a9b36538b
+data8 0x3fb92a5ef2f247c0, 0x3cb5e3bece4d6b07
+data8 0x814523ca796f56ce, 0xfebd428f72561efe
+data8 0x3fb96aaf3b3281a0, 0x3cb7b9e499436d7c
+data8 0x814ba4aa6a2d3ff9, 0xfeb6da672bd48fe4
+data8 0x3fb9ab011f819860, 0x3cb9168143cc1a7f
+data8 0x81523686e29bbdd7, 0xfeb062008df81f50
+data8 0x3fb9eb54a40e3ac0, 0x3cb6e544197eb1e1
+data8 0x8158d964f7124614, 0xfea9d95a5bcbd65a
+data8 0x3fba2ba9cd080800, 0x3ca9a717be8f7446
+data8 0x815f8d49c9d639e4, 0xfea34073551e1ac8
+data8 0x3fba6c009e9f9260, 0x3c741e989a60938a
+data8 0x8166523a8b24f626, 0xfe9c974a367f785c
+data8 0x3fbaac591d0661a0, 0x3cb2c1290107e57d
+data8 0x816d283c793e0114, 0xfe95ddddb94166cb
+data8 0x3fbaecb34c6ef600, 0x3c9c7d5fbaec405d
+data8 0x81740f54e06d55bd, 0xfe8f142c93750c50
+data8 0x3fbb2d0f310cca00, 0x3cbc09479a9cbcfb
+data8 0x817b07891b15cd5e, 0xfe883a3577e9fceb
+data8 0x3fbb6d6ccf1455e0, 0x3cb9450bff4ee307
+data8 0x818210de91bba6c8, 0xfe814ff7162cf62f
+data8 0x3fbbadcc2abb1180, 0x3c9227fda12a8d24
+data8 0x81892b5abb0f2bf9, 0xfe7a55701a8697b1
+data8 0x3fbbee2d48377700, 0x3cb6fad72acfe356
+data8 0x819057031bf7760e, 0xfe734a9f2dfa1810
+data8 0x3fbc2e902bc10600, 0x3cb4465b588d16ad
+data8 0x819793dd479d4fbe, 0xfe6c2f82f643f68b
+data8 0x3fbc6ef4d9904580, 0x3c8b9ac54823960d
+data8 0x819ee1eedf76367a, 0xfe65041a15d8a92c
+data8 0x3fbcaf5b55dec6a0, 0x3ca2b8d28a954db2
+data8 0x81a6413d934f7a66, 0xfe5dc8632be3477f
+data8 0x3fbcefc3a4e727a0, 0x3c9380da83713ab4
+data8 0x81adb1cf21597d4b, 0xfe567c5cd44431d5
+data8 0x3fbd302dcae51600, 0x3ca995b83421756a
+data8 0x81b533a9563310b8, 0xfe4f2005a78fb50f
+data8 0x3fbd7099cc155180, 0x3caefa2f7a817d5f
+data8 0x81bcc6d20cf4f373, 0xfe47b35c3b0caaeb
+data8 0x3fbdb107acb5ae80, 0x3cb455fc372dd026
+data8 0x81c46b4f2f3d6e68, 0xfe40365f20b316d6
+data8 0x3fbdf177710518c0, 0x3cbee3dcc5b01434
+data8 0x81cc2126b53c1144, 0xfe38a90ce72abf36
+data8 0x3fbe31e91d439620, 0x3cb3e131c950aebd
+data8 0x81d3e85ea5bd8ee2, 0xfe310b6419c9c33a
+data8 0x3fbe725cb5b24900, 0x3c01d3fac6029027
+data8 0x81dbc0fd1637b9c1, 0xfe295d6340932d15
+data8 0x3fbeb2d23e937300, 0x3c6304cc44aeedd1
+data8 0x81e3ab082ad5a0a4, 0xfe219f08e03580b3
+data8 0x3fbef349bc2a77e0, 0x3cac1d2d6abe9c72
+data8 0x81eba6861683cb97, 0xfe19d0537a0946e2
+data8 0x3fbf33c332bbe020, 0x3ca0909dba4e96ca
+data8 0x81f3b37d1afc9979, 0xfe11f1418c0f94e2
+data8 0x3fbf743ea68d5b60, 0x3c937fc12a2a779a
+data8 0x81fbd1f388d4be45, 0xfe0a01d190f09063
+data8 0x3fbfb4bc1be5c340, 0x3cbf51a504b55813
+data8 0x820401efbf87e248, 0xfe020201fff9efea
+data8 0x3fbff53b970d1e80, 0x3ca625444b260078
+data8 0x82106ad2ffdca049, 0xfdf5e3940a49135e
+data8 0x3fc02aff52065460, 0x3c9125d113e22a57
+data8 0x8221343d6ea1d3e2, 0xfde581a45429b0a0
+data8 0x3fc06b84f8e03220, 0x3caccf362295894b
+data8 0x82324434adbf99c2, 0xfdd4de1a001fb775
+data8 0x3fc0ac0ed1fe7240, 0x3cc22f676096b0af
+data8 0x82439aee8d0c7747, 0xfdc3f8e8269d1f03
+data8 0x3fc0ec9cee9e4820, 0x3cca147e2886a628
+data8 0x825538a1d0fcb2f0, 0xfdb2d201a9b1ba66
+data8 0x3fc12d2f6006f0a0, 0x3cc72b36633bc2d4
+data8 0x82671d86345c5cee, 0xfda1695934d723e7
+data8 0x3fc16dc63789de60, 0x3cb11f9c47c7b83f
+data8 0x827949d46a121770, 0xfd8fbee13cbbb823
+data8 0x3fc1ae618682e620, 0x3cce1b59020cef8e
+data8 0x828bbdc61eeab9ba, 0xfd7dd28bff0c9f34
+data8 0x3fc1ef015e586c40, 0x3cafec043e0225ee
+data8 0x829e7995fb6de9e1, 0xfd6ba44b823ee1ca
+data8 0x3fc22fa5d07b90c0, 0x3cba905409caf8e3
+data8 0x82b17d7fa5bbc982, 0xfd5934119557883a
+data8 0x3fc2704eee685da0, 0x3cb5ef21838a823e
+data8 0x82c4c9bfc373d276, 0xfd4681cfcfb2c161
+data8 0x3fc2b0fcc9a5f3e0, 0x3ccc7952c5e0e312
+data8 0x82d85e93fba50136, 0xfd338d7790ca0f41
+data8 0x3fc2f1af73c6ba00, 0x3cbecf5f977d1ca9
+data8 0x82ec3c3af8c76b32, 0xfd2056f9fff97727
+data8 0x3fc33266fe6889a0, 0x3c9d329c022ebdb5
+data8 0x830062f46abf6022, 0xfd0cde480c43b327
+data8 0x3fc373237b34de60, 0x3cc95806d4928adb
+data8 0x8314d30108ea35f0, 0xfcf923526c1562b2
+data8 0x3fc3b3e4fbe10520, 0x3cbc299fe7223d54
+data8 0x83298ca29434df97, 0xfce526099d0737ed
+data8 0x3fc3f4ab922e4a60, 0x3cb59d8bb8fdbccc
+data8 0x833e901bd93c7009, 0xfcd0e65de39f1f7c
+data8 0x3fc435774fea2a60, 0x3c9ec18b43340914
+data8 0x8353ddb0b278aad8, 0xfcbc643f4b106055
+data8 0x3fc4764846ee80a0, 0x3cb90402efd87ed6
+data8 0x836975a60a70c52e, 0xfca79f9da4fab13a
+data8 0x3fc4b71e8921b860, 0xbc58f23449ed6365
+data8 0x837f5841ddfa7a46, 0xfc92986889284148
+data8 0x3fc4f7fa2876fca0, 0xbc6294812bf43acd
+data8 0x839585cb3e839773, 0xfc7d4e8f554ab12f
+data8 0x3fc538db36ee6960, 0x3cb910b773d4c578
+data8 0x83abfe8a5466246f, 0xfc67c2012cb6fa68
+data8 0x3fc579c1c6953cc0, 0x3cc5ede909fc47fc
+data8 0x83c2c2c861474d91, 0xfc51f2acf82041d5
+data8 0x3fc5baade9860880, 0x3cac63cdfc3588e5
+data8 0x83d9d2cfc2813637, 0xfc3be08165519325
+data8 0x3fc5fb9fb1e8e3a0, 0x3cbf7c8466578c29
+data8 0x83f12eebf397daac, 0xfc258b6ce6e6822f
+data8 0x3fc63c9731f39d40, 0x3cb6d2a7ffca3e9e
+data8 0x8408d76990b9296e, 0xfc0ef35db402af94
+data8 0x3fc67d947be9eec0, 0x3cb1980da09e6566
+data8 0x8420cc9659487cd7, 0xfbf81841c8082dc4
+data8 0x3fc6be97a21daf00, 0x3cc2ac8330e59aa5
+data8 0x84390ec132759ecb, 0xfbe0fa06e24cc390
+data8 0x3fc6ffa0b6ef05e0, 0x3ccc1a030fee56c4
+data8 0x84519e3a29df811a, 0xfbc9989a85ce0954
+data8 0x3fc740afcccca000, 0x3cc19692a5301ca6
+data8 0x846a7b527842d61b, 0xfbb1f3e9f8e45dc4
+data8 0x3fc781c4f633e2c0, 0x3cc0e98f3868a508
+data8 0x8483a65c8434b5f0, 0xfb9a0be244f4af45
+data8 0x3fc7c2e045b12140, 0x3cb2a8d309754420
+data8 0x849d1fabe4e97dd7, 0xfb81e070362116d1
+data8 0x3fc80401cddfd120, 0x3ca7a44544aa4ce6
+data8 0x84b6e795650817ea, 0xfb6971805af8411e
+data8 0x3fc84529a16ac020, 0x3c9e3b709c7d6f94
+data8 0x84d0fe6f0589da92, 0xfb50beff0423a2f5
+data8 0x3fc88657d30c49e0, 0x3cc60d65a7f0a278
+data8 0x84eb649000a73014, 0xfb37c8d84414755c
+data8 0x3fc8c78c758e8e80, 0x3cc94b2ee984c2b7
+data8 0x85061a50ccd13781, 0xfb1e8ef7eeaf764b
+data8 0x3fc908c79bcba900, 0x3cc8540ae794a2fe
+data8 0x8521200b1fb8916e, 0xfb05114998f76a83
+data8 0x3fc94a0958ade6c0, 0x3ca127f49839fa9c
+data8 0x853c7619f1618bf6, 0xfaeb4fb898b65d19
+data8 0x3fc98b51bf2ffee0, 0x3c8c9ba7a803909a
+data8 0x85581cd97f45e274, 0xfad14a3004259931
+data8 0x3fc9cca0e25d4ac0, 0x3cba458e91d3bf54
+data8 0x857414a74f8446b4, 0xfab7009ab1945a54
+data8 0x3fca0df6d551fe80, 0x3cc78ea1d329d2b2
+data8 0x85905de2341dea46, 0xfa9c72e3370d2fbc
+data8 0x3fca4f53ab3b6200, 0x3ccf60dca86d57ef
+data8 0x85acf8ea4e423ff8, 0xfa81a0f3e9fa0ee9
+data8 0x3fca90b777580aa0, 0x3ca4c4e2ec8a867e
+data8 0x85c9e62111a92e7d, 0xfa668ab6dec711b1
+data8 0x3fcad2224cf814e0, 0x3c303de5980d071c
+data8 0x85e725e947fbee97, 0xfa4b3015e883dbfe
+data8 0x3fcb13943f7d5f80, 0x3cc29d4eefa5cb1e
+data8 0x8604b8a7144cd054, 0xfa2f90fa9883a543
+data8 0x3fcb550d625bc6a0, 0x3c9e01a746152daf
+data8 0x86229ebff69e2415, 0xfa13ad4e3dfbe1c1
+data8 0x3fcb968dc9195ea0, 0x3ccc091bd73ae518
+data8 0x8640d89acf78858c, 0xf9f784f9e5a1877b
+data8 0x3fcbd815874eb160, 0x3cb5f4b89875e187
+data8 0x865f669fe390c7f5, 0xf9db17e65944eacf
+data8 0x3fcc19a4b0a6f9c0, 0x3cc5c0bc2b0bbf14
+data8 0x867e4938df7dc45f, 0xf9be65fc1f6c2e6e
+data8 0x3fcc5b3b58e061e0, 0x3cc1ca70df8f57e7
+data8 0x869d80d0db7e4c0c, 0xf9a16f237aec427a
+data8 0x3fcc9cd993cc4040, 0x3cbae93acc85eccf
+data8 0x86bd0dd45f4f8265, 0xf98433446a806e70
+data8 0x3fccde7f754f5660, 0x3cb22f70e64568d0
+data8 0x86dcf0b16613e37a, 0xf966b246a8606170
+data8 0x3fcd202d11620fa0, 0x3c962030e5d4c849
+data8 0x86fd29d7624b3d5d, 0xf948ec11a9d4c45b
+data8 0x3fcd61e27c10c0a0, 0x3cc7083c91d59217
+data8 0x871db9b741dbe44a, 0xf92ae08c9eca4941
+data8 0x3fcda39fc97be7c0, 0x3cc9258579e57211
+data8 0x873ea0c3722d6af2, 0xf90c8f9e71633363
+data8 0x3fcde5650dd86d60, 0x3ca4755a9ea582a9
+data8 0x875fdf6fe45529e8, 0xf8edf92dc5875319
+data8 0x3fce27325d6fe520, 0x3cbc1e2b6c1954f9
+data8 0x878176321154e2bc, 0xf8cf1d20f87270b8
+data8 0x3fce6907cca0d060, 0x3cb6ca4804750830
+data8 0x87a36580fe6bccf5, 0xf8affb5e20412199
+data8 0x3fceaae56fdee040, 0x3cad6b310d6fd46c
+data8 0x87c5add5417a5cb9, 0xf89093cb0b7c0233
+data8 0x3fceeccb5bb33900, 0x3cc16e99cedadb20
+data8 0x87e84fa9057914ca, 0xf870e64d40a15036
+data8 0x3fcf2eb9a4bcb600, 0x3cc75ee47c8b09e9
+data8 0x880b4b780f02b709, 0xf850f2c9fdacdf78
+data8 0x3fcf70b05fb02e20, 0x3cad6350d379f41a
+data8 0x882ea1bfc0f228ac, 0xf830b926379e6465
+data8 0x3fcfb2afa158b8a0, 0x3cce0ccd9f829985
+data8 0x885252ff21146108, 0xf810394699fe0e8e
+data8 0x3fcff4b77e97f3e0, 0x3c9b30faa7a4c703
+data8 0x88765fb6dceebbb3, 0xf7ef730f865f6df0
+data8 0x3fd01b6406332540, 0x3cdc5772c9e0b9bd
+data8 0x88ad1f69be2cc730, 0xf7bdc59bc9cfbd97
+data8 0x3fd04cf8ad203480, 0x3caeef44fe21a74a
+data8 0x88f763f70ae2245e, 0xf77a91c868a9c54e
+data8 0x3fd08f23ce0162a0, 0x3cd6290ab3fe5889
+data8 0x89431fc7bc0c2910, 0xf73642973c91298e
+data8 0x3fd0d1610f0c1ec0, 0x3cc67401a01f08cf
+data8 0x8990573407c7738e, 0xf6f0d71d1d7a2dd6
+data8 0x3fd113b0c65d88c0, 0x3cc7aa4020fe546f
+data8 0x89df0eb108594653, 0xf6aa4e6a05cfdef2
+data8 0x3fd156134ada6fe0, 0x3cc87369da09600c
+data8 0x8a2f4ad16e0ed78a, 0xf662a78900c35249
+data8 0x3fd19888f43427a0, 0x3cc62b220f38e49c
+data8 0x8a811046373e0819, 0xf619e180181d97cc
+data8 0x3fd1db121aed7720, 0x3ca3ede7490b52f4
+data8 0x8ad463df6ea0fa2c, 0xf5cffb504190f9a2
+data8 0x3fd21daf185fa360, 0x3caafad98c1d6c1b
+data8 0x8b294a8cf0488daf, 0xf584f3f54b8604e6
+data8 0x3fd2606046bf95a0, 0x3cdb2d704eeb08fa
+data8 0x8b7fc95f35647757, 0xf538ca65c960b582
+data8 0x3fd2a32601231ec0, 0x3cc661619fa2f126
+data8 0x8bd7e588272276f8, 0xf4eb7d92ff39fccb
+data8 0x3fd2e600a3865760, 0x3c8a2a36a99aca4a
+data8 0x8c31a45bf8e9255e, 0xf49d0c68cd09b689
+data8 0x3fd328f08ad12000, 0x3cb9efaf1d7ab552
+data8 0x8c8d0b520a35eb18, 0xf44d75cd993cfad2
+data8 0x3fd36bf614dcc040, 0x3ccacbb590bef70d
+data8 0x8cea2005d068f23d, 0xf3fcb8a23ab4942b
+data8 0x3fd3af11a079a6c0, 0x3cd9775872cf037d
+data8 0x8d48e837c8cd5027, 0xf3aad3c1e2273908
+data8 0x3fd3f2438d754b40, 0x3ca03304f667109a
+data8 0x8da969ce732f3ac7, 0xf357c60202e2fd7e
+data8 0x3fd4358c3ca032e0, 0x3caecf2504ff1a9d
+data8 0x8e0baad75555e361, 0xf3038e323ae9463a
+data8 0x3fd478ec0fd419c0, 0x3cc64bdc3d703971
+data8 0x8e6fb18807ba877e, 0xf2ae2b1c3a6057f7
+data8 0x3fd4bc6369fa40e0, 0x3cbb7122ec245cf2
+data8 0x8ed5843f4bda74d5, 0xf2579b83aa556f0c
+data8 0x3fd4fff2af11e2c0, 0x3c9cfa2dc792d394
+data8 0x8f3d29862c861fef, 0xf1ffde2612ca1909
+data8 0x3fd5439a4436d000, 0x3cc38d46d310526b
+data8 0x8fa6a81128940b2d, 0xf1a6f1bac0075669
+data8 0x3fd5875a8fa83520, 0x3cd8bf59b8153f8a
+data8 0x901206c1686317a6, 0xf14cd4f2a730d480
+data8 0x3fd5cb33f8cf8ac0, 0x3c9502b5c4d0e431
+data8 0x907f4ca5fe9cf739, 0xf0f186784a125726
+data8 0x3fd60f26e847b120, 0x3cc8a1a5e0acaa33
+data8 0x90ee80fd34aeda5e, 0xf09504ef9a212f18
+data8 0x3fd65333c7e43aa0, 0x3cae5b029cb1f26e
+data8 0x915fab35e37421c6, 0xf0374ef5daab5c45
+data8 0x3fd6975b02b8e360, 0x3cd5aa1c280c45e6
+data8 0x91d2d2f0d894d73c, 0xefd86321822dbb51
+data8 0x3fd6db9d05213b20, 0x3cbecf2c093ccd8b
+data8 0x9248000249200009, 0xef7840021aca5a72
+data8 0x3fd71ffa3cc87fc0, 0x3cb8d273f08d00d9
+data8 0x92bf3a7351f081d2, 0xef16e42021d7cbd5
+data8 0x3fd7647318b1ad20, 0x3cbce099d79cdc46
+data8 0x93388a8386725713, 0xeeb44dfce6820283
+data8 0x3fd7a908093fc1e0, 0x3ccb033ec17a30d9
+data8 0x93b3f8aa8e653812, 0xee507c126774fa45
+data8 0x3fd7edb9803e3c20, 0x3cc10aedb48671eb
+data8 0x94318d99d341ade4, 0xedeb6cd32f891afb
+data8 0x3fd83287f0e9cf80, 0x3c994c0c1505cd2a
+data8 0x94b1523e3dedc630, 0xed851eaa3168f43c
+data8 0x3fd87773cff956e0, 0x3cda3b7bce6a6b16
+data8 0x95334fc20577563f, 0xed1d8ffaa2279669
+data8 0x3fd8bc7d93a70440, 0x3cd4922edc792ce2
+data8 0x95b78f8e8f92f274, 0xecb4bf1fd2be72da
+data8 0x3fd901a5b3b9cf40, 0x3cd3fea1b00f9d0d
+data8 0x963e1b4e63a87c3f, 0xec4aaa6d08694cc1
+data8 0x3fd946eca98f2700, 0x3cdba4032d968ff1
+data8 0x96c6fcef314074fc, 0xebdf502d53d65fea
+data8 0x3fd98c52f024e800, 0x3cbe7be1ab8c95c9
+data8 0x97523ea3eab028b2, 0xeb72aea36720793e
+data8 0x3fd9d1d904239860, 0x3cd72d08a6a22b70
+data8 0x97dfeae6f4ee4a9a, 0xeb04c4096a884e94
+data8 0x3fda177f63e8ef00, 0x3cd818c3c1ebfac7
+data8 0x98700c7c6d85d119, 0xea958e90cfe1efd7
+data8 0x3fda5d468f92a540, 0x3cdf45fbfaa080fe
+data8 0x9902ae7487a9caa1, 0xea250c6224aab21a
+data8 0x3fdaa32f090998e0, 0x3cd715a9353cede4
+data8 0x9997dc2e017a9550, 0xe9b33b9ce2bb7638
+data8 0x3fdae939540d3f00, 0x3cc545c014943439
+data8 0x9a2fa158b29b649b, 0xe9401a573f8aa706
+data8 0x3fdb2f65f63f6c60, 0x3cd4a63c2f2ca8e2
+data8 0x9aca09f835466186, 0xe8cba69df9f0bf35
+data8 0x3fdb75b5773075e0, 0x3cda310ce1b217ec
+data8 0x9b672266ab1e0136, 0xe855de74266193d4
+data8 0x3fdbbc28606babc0, 0x3cdc84b75cca6c44
+data8 0x9c06f7579f0b7bd5, 0xe7debfd2f98c060b
+data8 0x3fdc02bf3d843420, 0x3cd225d967ffb922
+data8 0x9ca995db058cabdc, 0xe76648a991511c6e
+data8 0x3fdc497a9c224780, 0x3cde08101c5b825b
+data8 0x9d4f0b605ce71e88, 0xe6ec76dcbc02d9a7
+data8 0x3fdc905b0c10d420, 0x3cb1abbaa3edf120
+data8 0x9df765b9eecad5e6, 0xe6714846bdda7318
+data8 0x3fdcd7611f4b8a00, 0x3cbf6217ae80aadf
+data8 0x9ea2b320350540fe, 0xe5f4bab71494cd6b
+data8 0x3fdd1e8d6a0d56c0, 0x3cb726e048cc235c
+data8 0x9f51023562fc5676, 0xe576cbf239235ecb
+data8 0x3fdd65e082df5260, 0x3cd9e66872bd5250
+data8 0xa002620915c2a2f6, 0xe4f779b15f5ec5a7
+data8 0x3fddad5b02a82420, 0x3c89743b0b57534b
+data8 0xa0b6e21c2caf9992, 0xe476c1a233a7873e
+data8 0x3fddf4fd84bbe160, 0x3cbf7adea9ee3338
+data8 0xa16e9264cc83a6b2, 0xe3f4a16696608191
+data8 0x3fde3cc8a6ec6ee0, 0x3cce46f5a51f49c6
+data8 0xa22983528f3d8d49, 0xe3711694552da8a8
+data8 0x3fde84bd099a6600, 0x3cdc78f6490a2d31
+data8 0xa2e7c5d2e2e69460, 0xe2ec1eb4e1e0a5fb
+data8 0x3fdeccdb4fc685c0, 0x3cdd3aedb56a4825
+data8 0xa3a96b5599bd2532, 0xe265b74506fbe1c9
+data8 0x3fdf15241f23b3e0, 0x3cd440f3c6d65f65
+data8 0xa46e85d1ae49d7de, 0xe1ddddb499b3606f
+data8 0x3fdf5d98202994a0, 0x3cd6c44bd3fb745a
+data8 0xa53727ca3e11b99e, 0xe1548f662951b00d
+data8 0x3fdfa637fe27bf60, 0x3ca8ad1cd33054dd
+data8 0xa6036453bdc20186, 0xe0c9c9aeabe5e481
+data8 0x3fdfef0467599580, 0x3cc0f1ac0685d78a
+data8 0xa6d34f1969dda338, 0xe03d89d5281e4f81
+data8 0x3fe01bff067d6220, 0x3cc0731e8a9ef057
+data8 0xa7a6fc62f7246ff3, 0xdfafcd125c323f54
+data8 0x3fe04092d1ae3b40, 0x3ccabda24b59906d
+data8 0xa87e811a861df9b9, 0xdf20909061bb9760
+data8 0x3fe0653df0fd9fc0, 0x3ce94c8dcc722278
+data8 0xa959f2d2dd687200, 0xde8fd16a4e5f88bd
+data8 0x3fe08a00c1cae320, 0x3ce6b888bb60a274
+data8 0xaa3967cdeea58bda, 0xddfd8cabd1240d22
+data8 0x3fe0aedba3221c00, 0x3ced5941cd486e46
+data8 0xab904fd587263c84, 0xdd1f4472e1cf64ed
+data8 0x3fe0e651e85229c0, 0x3cdb6701042299b1
+data8 0xad686d44dd5a74bb, 0xdbf173e1f6b46e92
+data8 0x3fe1309cbf4cdb20, 0x3cbf1be7bb3f0ec5
+data8 0xaf524e15640ebee4, 0xdabd54896f1029f6
+data8 0x3fe17b4ee1641300, 0x3ce81dd055b792f1
+data8 0xb14eca24ef7db3fa, 0xd982cb9ae2f47e41
+data8 0x3fe1c66b9ffd6660, 0x3cd98ea31eb5ddc7
+data8 0xb35ec807669920ce, 0xd841bd1b8291d0b6
+data8 0x3fe211f66db3a5a0, 0x3ca480c35a27b4a2
+data8 0xb5833e4755e04dd1, 0xd6fa0bd3150b6930
+data8 0x3fe25df2e05b6c40, 0x3ca4bc324287a351
+data8 0xb7bd34c8000b7bd3, 0xd5ab9939a7d23aa1
+data8 0x3fe2aa64b32f7780, 0x3cba67314933077c
+data8 0xba0dc64d126cc135, 0xd4564563ce924481
+data8 0x3fe2f74fc9289ac0, 0x3cec1a1dc0efc5ec
+data8 0xbc76222cbbfa74a6, 0xd2f9eeed501125a8
+data8 0x3fe344b82f859ac0, 0x3ceeef218de413ac
+data8 0xbef78e31985291a9, 0xd19672e2182f78be
+data8 0x3fe392a22087b7e0, 0x3cd2619ba201204c
+data8 0xc19368b2b0629572, 0xd02baca5427e436a
+data8 0x3fe3e11206694520, 0x3cb5d0b3143fe689
+data8 0xc44b2ae8c6733e51, 0xceb975d60b6eae5d
+data8 0x3fe4300c7e945020, 0x3cbd367143da6582
+data8 0xc7206b894212dfef, 0xcd3fa6326ff0ac9a
+data8 0x3fe47f965d201d60, 0x3ce797c7a4ec1d63
+data8 0xca14e1b0622de526, 0xcbbe13773c3c5338
+data8 0x3fe4cfb4b09d1a20, 0x3cedfadb5347143c
+data8 0xcd2a6825eae65f82, 0xca34913d425a5ae9
+data8 0x3fe5206cc637e000, 0x3ce2798b38e54193
+data8 0xd06301095e1351ee, 0xc8a2f0d3679c08c0
+data8 0x3fe571c42e3d0be0, 0x3ccd7cb9c6c2ca68
+data8 0xd3c0d9f50057adda, 0xc70901152d59d16b
+data8 0x3fe5c3c0c108f940, 0x3ceb6c13563180ab
+data8 0xd74650a98cc14789, 0xc5668e3d4cbf8828
+data8 0x3fe61668a46ffa80, 0x3caa9092e9e3c0e5
+data8 0xdaf5f8579dcc8f8f, 0xc3bb61b3eed42d02
+data8 0x3fe669c251ad69e0, 0x3cccf896ef3b4fee
+data8 0xded29f9f9a6171b4, 0xc20741d7f8e8e8af
+data8 0x3fe6bdd49bea05c0, 0x3cdc6b29937c575d
+data8 0xe2df5765854ccdb0, 0xc049f1c2d1b8014b
+data8 0x3fe712a6b76c6e80, 0x3ce1ddc6f2922321
+data8 0xe71f7a9b94fcb4c3, 0xbe833105ec291e91
+data8 0x3fe76840418978a0, 0x3ccda46e85432c3d
+data8 0xeb96b72d3374b91e, 0xbcb2bb61493b28b3
+data8 0x3fe7bea9496d5a40, 0x3ce37b42ec6e17d3
+data8 0xf049183c3f53c39b, 0xbad848720223d3a8
+data8 0x3fe815ea59dab0a0, 0x3cb03ad41bfc415b
+data8 0xf53b11ec7f415f15, 0xb8f38b57c53c9c48
+data8 0x3fe86e0c84010760, 0x3cc03bfcfb17fe1f
+data8 0xfa718f05adbf2c33, 0xb70432500286b185
+data8 0x3fe8c7196b9225c0, 0x3ced99fcc6866ba9
+data8 0xfff200c3f5489608, 0xb509e6454dca33cc
+data8 0x3fe9211b54441080, 0x3cb789cb53515688
+// The following table entries are not used
+//data8 0x82e138a0fac48700, 0xb3044a513a8e6132
+//data8 0x3fe97c1d30f5b7c0, 0x3ce1eb765612d1d0
+//data8 0x85f4cc7fc670d021, 0xb0f2fb2ea6cbbc88
+//data8 0x3fe9d82ab4b5fde0, 0x3ced3fe6f27e8039
+//data8 0x89377c1387d5b908, 0xaed58e9a09014d5c
+//data8 0x3fea355065f87fa0, 0x3cbef481d25f5b58
+//data8 0x8cad7a2c98dec333, 0xacab929ce114d451
+//data8 0x3fea939bb451e2a0, 0x3c8e92b4fbf4560f
+//data8 0x905b7dfc99583025, 0xaa748cc0dbbbc0ec
+//data8 0x3feaf31b11270220, 0x3cdced8c61bd7bd5
+//data8 0x9446d8191f80dd42, 0xa82ff92687235baf
+//data8 0x3feb53de0bcffc20, 0x3cbe1722fb47509e
+//data8 0x98758ba086e4000a, 0xa5dd497a9c184f58
+//data8 0x3febb5f571cb0560, 0x3ce0c7774329a613
+//data8 0x9cee6c7bf18e4e24, 0xa37be3c3cd1de51b
+//data8 0x3fec197373bc7be0, 0x3ce08ebdb55c3177
+//data8 0xa1b944000a1b9440, 0xa10b2101b4f27e03
+//data8 0x3fec7e6bd023da60, 0x3ce5fc5fd4995959
+//data8 0xa6defd8ba04d3e38, 0x9e8a4b93cad088ec
+//data8 0x3fece4f404e29b20, 0x3cea3413401132b5
+//data8 0xac69dd408a10c62d, 0x9bf89d5d17ddae8c
+//data8 0x3fed4d2388f63600, 0x3cd5a7fb0d1d4276
+//data8 0xb265c39cbd80f97a, 0x99553d969fec7beb
+//data8 0x3fedb714101e0a00, 0x3cdbda21f01193f2
+//data8 0xb8e081a16ae4ae73, 0x969f3e3ed2a0516c
+//data8 0x3fee22e1da97bb00, 0x3ce7231177f85f71
+//data8 0xbfea427678945732, 0x93d5990f9ee787af
+//data8 0x3fee90ac13b18220, 0x3ce3c8a5453363a5
+//data8 0xc79611399b8c90c5, 0x90f72bde80febc31
+//data8 0x3fef009542b712e0, 0x3ce218fd79e8cb56
+//data8 0xcffa8425040624d7, 0x8e02b4418574ebed
+//data8 0x3fef72c3d2c57520, 0x3cd32a717f82203f
+//data8 0xd93299cddcf9cf23, 0x8af6ca48e9c44024
+//data8 0x3fefe762b77744c0, 0x3ce53478a6bbcf94
+//data8 0xe35eda760af69ad9, 0x87d1da0d7f45678b
+//data8 0x3ff02f511b223c00, 0x3ced6e11782c28fc
+//data8 0xeea6d733421da0a6, 0x84921bbe64ae029a
+//data8 0x3ff06c5c6f8ce9c0, 0x3ce71fc71c1ffc02
+//data8 0xfb3b2c73fc6195cc, 0x813589ba3a5651b6
+//data8 0x3ff0aaf2613700a0, 0x3cf2a72d2fd94ef3
+//data8 0x84ac1fcec4203245, 0xfb73a828893df19e
+//data8 0x3ff0eb367c3fd600, 0x3cf8054c158610de
+//data8 0x8ca50621110c60e6, 0xf438a14c158d867c
+//data8 0x3ff12d51caa6b580, 0x3ce6bce9748739b6
+//data8 0x95b8c2062d6f8161, 0xecb3ccdd37b369da
+//data8 0x3ff1717418520340, 0x3ca5c2732533177c
+//data8 0xa0262917caab4ad1, 0xe4dde4ddc81fd119
+//data8 0x3ff1b7d59dd40ba0, 0x3cc4c7c98e870ff5
+//data8 0xac402c688b72f3f4, 0xdcae469be46d4c8d
+//data8 0x3ff200b93cc5a540, 0x3c8dd6dc1bfe865a
+//data8 0xba76968b9eabd9ab, 0xd41a8f3df1115f7f
+//data8 0x3ff24c6f8f6affa0, 0x3cf1acb6d2a7eff7
+//data8 0xcb63c87c23a71dc5, 0xcb161074c17f54ec
+//data8 0x3ff29b5b338b7c80, 0x3ce9b5845f6ec746
+//data8 0xdfe323b8653af367, 0xc19107d99ab27e42
+//data8 0x3ff2edf6fac7f5a0, 0x3cf77f961925fa02
+//data8 0xf93746caaba3e1f1, 0xb777744a9df03bff
+//data8 0x3ff344df237486c0, 0x3cf6ddf5f6ddda43
+//data8 0x8ca77052f6c340f0, 0xacaf476f13806648
+//data8 0x3ff3a0dfa4bb4ae0, 0x3cfee01bbd761bff
+//data8 0xa1a48604a81d5c62, 0xa11575d30c0aae50
+//data8 0x3ff4030b73c55360, 0x3cf1cf0e0324d37c
+//data8 0xbe45074b05579024, 0x9478e362a07dd287
+//data8 0x3ff46ce4c738c4e0, 0x3ce3179555367d12
+//data8 0xe7a08b5693d214ec, 0x8690e3575b8a7c3b
+//data8 0x3ff4e0a887c40a80, 0x3cfbd5d46bfefe69
+//data8 0x94503d69396d91c7, 0xedd2ce885ff04028
+//data8 0x3ff561ebd9c18cc0, 0x3cf331bd176b233b
+//data8 0xced1d96c5bb209e6, 0xc965278083808702
+//data8 0x3ff5f71d7ff42c80, 0x3ce3301cc0b5a48c
+//data8 0xabac2cee0fc24e20, 0x9c4eb1136094cbbd
+//data8 0x3ff6ae4c63222720, 0x3cf5ff46874ee51e
+//data8 0x8040201008040201, 0xb4d7ac4d9acb1bf4
+//data8 0x3ff7b7d33b928c40, 0x3cfacdee584023bb
+LOCAL_OBJECT_END(T_table)
+
+
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+       // C_3
+data8 0xaaaaaaaaaaaaaaab, 0x0000000000003ffc
+       // C_5
+data8 0x999999999999999a, 0x0000000000003ffb
+       // C_7, C_9
+data8 0x3fa6db6db6db6db7, 0x3f9f1c71c71c71c8
+       // pi/2 (low, high)
+data8 0x3C91A62633145C07, 0x3FF921FB54442D18
+       // C_11, C_13
+data8 0x3f96e8ba2e8ba2e9, 0x3f91c4ec4ec4ec4e
+       // C_15, C_17
+data8 0x3f8c99999999999a, 0x3f87a87878787223
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+R_DBL_S = r21
+R_EXP0 = r22
+R_EXP = r15
+R_SGNMASK = r23
+R_TMP = r24
+R_TMP2 = r25
+R_INDEX = r26
+R_TMP3 = r27
+R_TMP03 = r27
+R_TMP4 = r28
+R_TMP5 = r23
+R_TMP6 = r22
+R_TMP7 = r21
+R_T = r29
+R_BIAS = r20
+
+F_T = f6
+F_1S2 = f7
+F_1S2_S = f9
+F_INV_1T2 = f10
+F_SQRT_1T2 = f11
+F_S2T2 = f12
+F_X = f13
+F_D = f14
+F_2M64 = f15
+
+F_CS2 = f32
+F_CS3 = f33
+F_CS4 = f34
+F_CS5 = f35
+F_CS6 = f36
+F_CS7 = f37
+F_CS8 = f38
+F_CS9 = f39
+F_S23 = f40 
+F_S45 = f41 
+F_S67 = f42 
+F_S89 = f43 
+F_S25 = f44 
+F_S69 = f45 
+F_S29 = f46 
+F_X2 = f47 
+F_X4 = f48 
+F_TSQRT = f49 
+F_DTX = f50 
+F_R = f51 
+F_R2 = f52 
+F_R3 = f53 
+F_R4 = f54 
+
+F_C3 = f55 
+F_C5 = f56 
+F_C7 = f57 
+F_C9 = f58 
+F_P79 = f59 
+F_P35 = f60 
+F_P39 = f61 
+
+F_ATHI = f62 
+F_ATLO = f63 
+
+F_T1 = f64 
+F_Y = f65 
+F_Y2 = f66 
+F_ANDMASK = f67 
+F_ORMASK = f68 
+F_S = f69 
+F_05 = f70 
+F_SQRT_1S2 = f71 
+F_DS = f72 
+F_Z = f73 
+F_1T2 = f74 
+F_DZ = f75 
+F_ZE = f76 
+F_YZ = f77 
+F_Y1S2 = f78 
+F_Y1S2X = f79 
+F_1X = f80 
+F_ST = f81 
+F_1T2_ST = f82 
+F_TSS = f83 
+F_Y1S2X2 = f84 
+F_DZ_TERM = f85 
+F_DTS = f86 
+F_DS2X = f87 
+F_T2 = f88 
+F_ZY1S2S = f89 
+F_Y1S2_1X = f90 
+F_TS = f91
+F_PI2_LO = f92 
+F_PI2_HI = f93 
+F_S19 = f94 
+F_INV1T2_2 = f95 
+F_CORR = f96 
+F_DZ0 = f97 
+
+F_C11 = f98 
+F_C13 = f99 
+F_C15 = f100
+F_C17 = f101
+F_P1113 = f102
+F_P1517 = f103
+F_P1117 = f104
+F_P317 = f105
+F_R8 = f106
+F_HI = f107
+F_1S2_HI = f108
+F_DS2 = f109
+F_Y2_2 = f110
+F_S2 = f111
+F_S_DS2 = f112
+F_S_1S2S = f113
+F_XL = f114
+F_2M128 = f115
+
 
 .section .text
-.proc  asinl#
-.align 32
+GLOBAL_LIBM_ENTRY(asinl)
+
+{.mfi
+       // get exponent, mantissa (rounded to double precision) of s
+       getf.d R_DBL_S = f8
+       // 1-s^2
+       fnma.s1 F_1S2 = f8, f8, f1
+       // r2 = pointer to T_table
+       addl r2 = @ltoff(T_table), gp
+}
 
+{.mfi
+       // sign mask
+       mov R_SGNMASK = 0x20000
+       nop.f 0
+       // bias-63-1
+       mov R_TMP03 = 0xffff-64;;
+}
 
-asinl: 
 
-{ .mfi
-      alloc r32 = ar.pfs,1,11,4,0                        
-(p0)  fnorm      asin_NORM_f8 = f8                       
-(p0)  mov        asin_GR_17_ones = 0x1ffff               
+{.mfi
+       // get exponent of s
+       getf.exp R_EXP = f8
+       nop.f 0
+       // R_TMP4 = 2^45
+       shl R_TMP4 = R_SGNMASK, 45-17
 }
 
-{ .mii
-(p0)  mov        asin_GR_16_ones = 0xffff                
-(p0)  mov        asin_GR_ff9b = 0xff9b ;;                   
-      nop.i 999
+{.mlx
+       // load bias-4
+       mov R_TMP = 0xffff-4
+       // load RU(sqrt(2)/2) to integer register (in double format, shifted left by 1)
+       movl R_TMP2 = 0x7fcd413cccfe779a;;
 }
 
 
-{ .mmi
-(p0)  setf.exp  asin_2m100 = asin_GR_ff9b                                      
-(p0)  addl           r40   = @ltoff(asin_coefficients), gp
-      nop.i 999
+{.mfi
+       // load 2^{-64} in FP register
+       setf.exp F_2M64 = R_TMP03
+       nop.f 0
+       // index = (0x7-exponent)|b1 b2.. b6
+       extr.u R_INDEX = R_DBL_S, 46, 9
 }
-;;
 
-{ .mmi
-      ld8 r40 = [r40]
-      nop.m 999
-      nop.i 999
+{.mfi
+       // get t = sign|exponent|b1 b2.. b6 1 x.. x
+       or R_T = R_DBL_S, R_TMP4
+       nop.f 0
+       // R_TMP4 = 2^45-1
+       sub R_TMP4 = R_TMP4, r0, 1;;
 }
-;;
 
 
+{.mfi
+       // get t = sign|exponent|b1 b2.. b6 1 0.. 0
+       andcm R_T = R_T, R_TMP4
+       nop.f 0
+       // eliminate sign from R_DBL_S (shift left by 1)
+       shl R_TMP3 = R_DBL_S, 1
+}
 
-// Load the constants
+{.mfi
+       // R_BIAS = 3*2^6
+       mov R_BIAS = 0xc0
+       nop.f 0
+       // eliminate sign from R_EXP
+       andcm R_EXP0 = R_EXP, R_SGNMASK;;
+}
 
-{ .mmi
-(p0) ldfe       asin_A10 = [r40],16 ;;      
-(p0) ldfe       asin_A9  = [r40],16      
-      nop.i 999 ;;
+
+
+{.mfi
+       // load start address for T_table
+       ld8 r2 = [r2]
+       nop.f 0
+       // p8 = 1 if |s|> = sqrt(2)/2
+       cmp.geu p8, p0 = R_TMP3, R_TMP2
 }
 
-{ .mmi
-(p0) ldfe       asin_A8  = [r40],16 ;;      
-(p0) ldfe       asin_A7  = [r40],16      
-      nop.i 999 ;;
+{.mlx
+       // p7 = 1 if |s|<2^{-4} (exponent of s<bias-4)
+       cmp.lt p7, p0 = R_EXP0, R_TMP
+       // sqrt coefficient cs8 = -33*13/128
+       movl R_TMP2 = 0xc0568000;;
 }
 
-{ .mmi
-(p0) ldfe       asin_A6  = [r40],16 ;;      
-(p0)  getf.exp   asin_GR_signexp_f8  = asin_NORM_f8                            
-      nop.i 999
+
+
+{.mbb
+       // load t in FP register
+       setf.d F_T = R_T
+       // if |s|<2^{-4}, take alternate path
+ (p7) br.cond.spnt SMALL_S
+       // if |s|> = sqrt(2)/2, take alternate path
+ (p8) br.cond.sptk LARGE_S
 }
 
-{ .mmi
-(p0) ldfe       asin_A5  = [r40],16 ;;      
-(p0) ldfe       asin_A4  = [r40],16      
-      nop.i 999 ;;
+{.mlx
+       // index = (4-exponent)|b1 b2.. b6
+       sub R_INDEX = R_INDEX, R_BIAS
+       // sqrt coefficient cs9 = 55*13/128
+       movl R_TMP = 0x40b2c000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0) fmerge.s   asin_ABS_NORM_f8 = f0, asin_NORM_f8            
-(p0)  and        asin_GR_exp         = asin_GR_signexp_f8, asin_GR_17_ones ;;     
+
+{.mfi
+       // sqrt coefficient cs8 = -33*13/128
+       setf.s F_CS8 = R_TMP2
+       nop.f 0
+       // shift R_INDEX by 5
+       shl R_INDEX = R_INDEX, 5
+}
+
+{.mfi
+       // sqrt coefficient cs3 = 0.5 (set exponent = bias-1)
+       mov R_TMP4 = 0xffff - 1
+       nop.f 0
+       // sqrt coefficient cs6 = -21/16
+       mov R_TMP6 = 0xbfa8;;
 }
 
-// case 1: |x| < 2^-40         ==> p6 (includes x = +-0)
-// case 2: 2^-40 <= |x| < 2^-2 ==> p8
-// case 3: 2^-2  <= |x| < 1    ==> p9
-// case 4: 1  <= |x|           ==> p11
-//   In case 4, we pick up the special case x = +-1 and return +-pi/2
 
-{ .mii
-(p0) ldfe       asin_A3  = [r40],16      
-(p0)  sub        asin_GR_true_exp    = asin_GR_exp, asin_GR_16_ones ;;            
-(p0)  cmp.ge.unc p6, p7    = -41, asin_GR_true_exp ;;             
+{.mlx
+       // table index
+       add r2 = r2, R_INDEX
+       // sqrt coefficient cs7 = 33/16
+       movl R_TMP2 = 0x40040000;;
 }
 
-{ .mii
-(p0) ldfe       asin_A2  = [r40],16      
-(p7)  cmp.ge.unc p8, p9    = -3,  asin_GR_true_exp ;;             
-(p9)  cmp.ge.unc p10, p11  = -1,  asin_GR_true_exp              
+
+{.mmi
+       // load cs9 = 55*13/128
+       setf.s F_CS9 = R_TMP
+       // sqrt coefficient cs5 = 7/8
+       mov R_TMP3 = 0x3f60
+       // sqrt coefficient cs6 = 21/16
+       shl R_TMP6 = R_TMP6, 16;;
 }
 
-{ .mmi
-(p0) ldfe       asin_A1  = [r40],16 ;;      
-(p0) ldfe       asin_pi_by_2  = [r40],16 
-      nop.i 999
+
+{.mmi
+       // load significand of 1/(1-t^2)
+       ldf8 F_INV_1T2 = [r2], 8
+       // sqrt coefficient cs7 = 33/16
+       setf.s F_CS7 = R_TMP2
+       // sqrt coefficient cs4 = -5/8
+       mov R_TMP5 = 0xbf20;;
 }
 
-// case 4: |x| >= 1
-{ .mib
-      nop.m 999
-      nop.i 999
-(p11) br.spnt         L(ASIN_ERROR_RETURN) ;;                         
+
+{.mmi
+       // load significand of sqrt(1-t^2)
+       ldf8 F_SQRT_1T2 = [r2], 8
+       // sqrt coefficient cs6 = 21/16
+       setf.s F_CS6 = R_TMP6
+       // sqrt coefficient cs5 = 7/8
+       shl R_TMP3 = R_TMP3, 16;;
 }
 
-// case 1: |x| < 2^-40
-{ .mfb
-      nop.m 999
-(p6)  fma.s0         f8 = asin_2m100,f8,f8                       
-(p6)  br.ret.spnt   b0 ;;                                          
+
+{.mmi
+       // sqrt coefficient cs3 = 0.5 (set exponent = bias-1)
+       setf.exp F_CS3 = R_TMP4
+       // r3 = pointer to polynomial coefficients
+       addl r3 = @ltoff(poly_coeffs), gp
+       // sqrt coefficient cs4 = -5/8
+       shl R_TMP5 = R_TMP5, 16;;
 }
 
 
-// case 2: 2^-40 <= |x| < 2^-2 ==> p8
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_X2   = f8,f8, f0                       
-      nop.i 999 ;;
+{.mfi
+       // sqrt coefficient cs5 = 7/8
+       setf.s F_CS5 = R_TMP3
+       // d = s-t
+       fms.s1 F_D = f8, f1, F_T
+       // set p6 = 1 if s<0, p11 = 1 if s> = 0
+       cmp.ge p6, p11 = R_EXP, R_DBL_S
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_X4   = asin_X2,asin_X2, f0             
-      nop.i 999 ;;
+{.mfi
+       // r3 = load start address to polynomial coefficients
+       ld8 r3 = [r3]
+       // s+t
+       fma.s1 F_S2T2 = f8, f1, F_T
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P810 = asin_X4, asin_A10, asin_A8      
-      nop.i 999
+
+{.mfi
+       // sqrt coefficient cs4 = -5/8
+       setf.s F_CS4 = R_TMP5
+       // s^2-t^2
+       fma.s1 F_S2T2 = F_S2T2, F_D, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P79  = asin_X4, asin_A9, asin_A7       
-      nop.i 999 ;;
+
+{.mfi
+       // load C3
+       ldfe F_C3 = [r3], 16
+       // 0.5/(1-t^2) = 2^{-64}*(2^63/(1-t^2))
+       fma.s1 F_INV_1T2 = F_INV_1T2, F_2M64, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P610 = asin_X4, asin_P810, asin_A6     
-      nop.i 999
+{.mfi
+       // load C_5
+       ldfe F_C5 = [r3], 16
+       // set correct exponent for sqrt(1-t^2)
+       fma.s1 F_SQRT_1T2 = F_SQRT_1T2, F_2M64, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P59  = asin_X4, asin_P79, asin_A5      
-      nop.i 999 ;;
+
+{.mfi
+       // load C_7, C_9
+       ldfpd F_C7, F_C9 = [r3]
+       // x = -(s^2-t^2)/(1-t^2)/2
+       fnma.s1 F_X = F_INV_1T2, F_S2T2, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P410 = asin_X4, asin_P610, asin_A4     
-      nop.i 999
+
+{.mfi
+       // load asin(t)_high, asin(t)_low
+       ldfpd F_ATHI, F_ATLO = [r2]
+       // t*sqrt(1-t^2)
+       fma.s1 F_TSQRT = F_T, F_SQRT_1T2, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P39  = asin_X4, asin_P59, asin_A3      
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // cs9*x+cs8
+       fma.s1 F_S89 = F_CS9, F_X, F_CS8
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P210 = asin_X4, asin_P410, asin_A2     
-      nop.i 999
+{.mfi
+       nop.m 0
+       // cs7*x+cs6
+       fma.s1 F_S67 = F_CS7, F_X, F_CS6
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P19  = asin_X4, asin_P39, asin_A1      
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // cs5*x+cs4
+       fma.s1 F_S45 = F_CS5, F_X, F_CS4
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P1P2    = asin_X2, asin_P210, asin_P19 
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // x*x
+       fma.s1 F_X2 = F_X, F_X, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p8)  fma.s1        asin_P1P2    = asin_X2, asin_P1P2, f0       
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // (s-t)-t*x
+       fnma.s1 F_DTX = F_T, F_X, F_D
+       nop.i 0
 }
 
-{ .mfb
-      nop.m 999
-(p8)  fma.s0        f8 = asin_NORM_f8, asin_P1P2, asin_NORM_f8  
-(p8)  br.ret.spnt   b0 ;;                                          
+{.mfi
+       nop.m 0
+       // cs3*x+cs2 (cs2 = -0.5 = -cs3)
+       fms.s1 F_S23 = F_CS3, F_X, F_CS3
+       nop.i 0;;
 }
 
-// case 3: 2^-2  <= |x| < 1    
-// 1- X*X is computed as B + b
-// Step 1.1:     Get B and b
 
-// atan2 will return
-//   f8  = Z_hi
-//   f10 = Z_lo
-//   f11 = s_lo
+{.mfi
+       nop.m 0
+       // cs9*x^3+cs8*x^2+cs7*x+cs6
+       fma.s1 F_S69 = F_S89, F_X2, F_S67
+       nop.i 0
+}
 
+{.mfi
+       nop.m 0
+       // x^4
+       fma.s1 F_X4 = F_X2, F_X2, f0
+       nop.i 0;;
+}
 
-{ .mfi
-(p0)  mov            asin_GR_fffe = 0xfffe                      
-(p0)   fmerge.se f8 = asin_ABS_NORM_f8, asin_ABS_NORM_f8                                   
-nop.i 0
-};;
 
-{ .mmf
-nop.m 0
-(p0)   setf.exp       asin_HALF = asin_GR_fffe                   
-(p0)   fmerge.se f12 = asin_NORM_f8, asin_NORM_f8 ;;                         
+{.mfi
+       nop.m 0
+       // t*sqrt(1-t^2)*x^2
+       fma.s1 F_TSQRT = F_TSQRT, F_X2, f0
+       nop.i 0
 }
 
+{.mfi
+       nop.m 0
+       // cs5*x^3+cs4*x^2+cs3*x+cs2
+       fma.s1 F_S25 = F_S45, F_X2, F_S23
+       nop.i 0;;
+}
 
-{ .mfi
-      nop.m 999
-(p0)  fcmp.lt.unc.s1 p6,p7 = asin_ABS_NORM_f8, asin_HALF        
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // ((s-t)-t*x)*sqrt(1-t^2)
+       fma.s1 F_DTX = F_DTX, F_SQRT_1T2, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fma.s1         asin_D   = f1,f1,asin_ABS_NORM_f8          
-      nop.i 999
+
+{.mfi
+       nop.m 0
+       // if sign is negative, negate table values: asin(t)_low
+ (p6) fnma.s1 F_ATLO = F_ATLO, f1, f0
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fms.s1         asin_C   = f1,f1,asin_ABS_NORM_f8          
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // PS29 = cs9*x^7+..+cs5*x^3+cs4*x^2+cs3*x+cs2
+       fma.s1 F_S29 = F_S69, F_X4, F_S25
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fma.s1         asin_B   = asin_C, asin_D, f0              
-      nop.i 999
+
+{.mfi
+       nop.m 0
+       // if sign is negative, negate table values: asin(t)_high
+ (p6) fnma.s1 F_ATHI = F_ATHI, f1, f0
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fms.s1         asin_1mD = f1,f1,asin_D                    
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // R = ((s-t)-t*x)*sqrt(1-t^2)-t*sqrt(1-t^2)*x^2*PS29
+       fnma.s1 F_R = F_S29, F_TSQRT, F_DTX
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fma.s1         asin_Dd  = asin_1mD,f1, asin_ABS_NORM_f8   
-      nop.i 999
+
+{.mfi
+       nop.m 0
+       // R^2
+       fma.s1 F_R2 = F_R, F_R, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fms.s1         asin_Bb  = asin_C, asin_D, asin_B          
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // c7+c9*R^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p7)  fma.s1         asin_Bb  = asin_C, asin_Dd, asin_Bb        
-      nop.i 999
+{.mfi
+       nop.m 0
+       // c3+c5*R^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)  fma.s1         asin_C   = asin_ABS_NORM_f8, asin_ABS_NORM_f8, f0     
-      nop.i 999 ;;
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)  fms.s1         asin_B   = f1, f1, asin_C                             
-      nop.i 999
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R3 = F_R2, F_R, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)  fms.s1         asin_Cc  = asin_ABS_NORM_f8, asin_ABS_NORM_f8, asin_C 
-      nop.i 999 ;;
+
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_Hh     = asin_HALF, asin_B, f0                   
-      nop.i 999
+
+{.mfi
+       nop.m 0
+       // asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_P39 = F_P39, F_R3, F_ATLO
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)  fms.s1         asin_1mB = f1, f1, asin_B                             
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // R+asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_P39 = F_P39, f1, F_R
+       nop.i 0;;
 }
 
-// Step 1.2: 
-// sqrt(B + b) is computed as W + w
-// Get W
 
-{ .mfi
-      nop.m 999
-(p0)  frsqrta.s1     asin_y0,p8  = asin_B                                  
-      nop.i 999 ;;
+{.mfb
+       nop.m 0
+       // result = asin(t)_high+R+asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s0 f8 = F_ATHI, f1, F_P39
+       // return
+       br.ret.sptk b0;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)  fms.s1         asin_1mBmC = asin_1mB, f1, asin_C                     
-      nop.i 999 ;;
+
+
+
+LARGE_S:
+
+{.mfi
+       // bias-1
+       mov R_TMP3 = 0xffff - 1
+       // y ~ 1/sqrt(1-s^2)
+       frsqrta.s1 F_Y, p7 = F_1S2
+       // c9 = 55*13*17/128
+       mov R_TMP4 = 0x10af7b
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_t1     = asin_y0, asin_y0, f0                    
-      nop.i 999 ;;
+{.mlx
+       // c8 = -33*13*15/128
+       mov R_TMP5 = 0x184923
+       movl R_TMP2 = 0xff00000000000000;;
 }
 
-{ .mfi
-      nop.m 999
-(p6)  fms.s1         asin_Bb  = asin_1mBmC, f1, asin_Cc                    
-      nop.i 999 ;;
+{.mfi
+       // set p6 = 1 if s<0, p11 = 1 if s>0
+       cmp.ge p6, p11 = R_EXP, R_DBL_S
+       // 1-s^2
+       fnma.s1 F_1S2 = f8, f8, f1
+       // set p9 = 1
+       cmp.eq p9, p0 = r0, r0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        asin_t2     = asin_t1, asin_Hh, asin_HALF             
-      nop.i 999 ;;
+
+{.mfi
+       // load 0.5
+       setf.exp F_05 = R_TMP3
+       // (1-s^2) rounded to single precision
+       fnma.s.s1 F_1S2_S = f8, f8, f1
+       // c9 = 55*13*17/128
+       shl R_TMP4 = R_TMP4, 10
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_y1     = asin_t2, asin_y0, asin_y0               
-      nop.i 999 ;;
+{.mlx
+       // AND mask for getting t ~ sqrt(1-s^2)
+       setf.sig F_ANDMASK = R_TMP2
+       // OR mask
+       movl R_TMP2 = 0x0100000000000000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_t3     = asin_y1, asin_Hh, f0                    
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // (s^2)_s
+       fma.s.s1 F_S2 = f8, f8, f0
+       nop.i 0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        asin_t4     = asin_t3, asin_y1, asin_HALF             
-      nop.i 999 ;;
+
+{.mmi
+       // c9 = 55*13*17/128
+       setf.s F_CS9 = R_TMP4
+       // c7 = 33*13/16
+       mov R_TMP4 = 0x41d68
+       // c8 = -33*13*15/128
+       shl R_TMP5 = R_TMP5, 11;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_y2     = asin_t4, asin_y1, asin_y1               
-      nop.i 999 ;;
+
+{.mfi
+       setf.sig F_ORMASK = R_TMP2
+       // y^2
+       fma.s1 F_Y2 = F_Y, F_Y, f0
+       // c7 = 33*13/16
+       shl R_TMP4 = R_TMP4, 12
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_S      = asin_B, asin_y2, f0                     
-      nop.i 999
+{.mfi
+       // c6 = -33*7/16
+       mov R_TMP6 = 0xc1670
+       // y' ~ sqrt(1-s^2)
+       fma.s1 F_T1 = F_Y, F_1S2, f0
+       // c5 = 63/8
+       mov R_TMP7 = 0x40fc;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_H      = asin_y2, asin_HALF, f0                  
-      nop.i 999 ;;
+
+{.mlx
+       // load c8 = -33*13*15/128
+       setf.s F_CS8 = R_TMP5
+       // c4 = -35/8
+       movl R_TMP5 = 0xc08c0000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_t5     = asin_Hh, asin_y2, f0                    
-      nop.i 999 ;;
+{.mfi
+       // r3 = pointer to polynomial coefficients
+       addl r3 = @ltoff(poly_coeffs), gp
+       // 1-(1-s^2)_s
+       fnma.s1 F_DS = F_1S2_S, f1, f1
+       // p9 = 0 if p7 = 1 (p9 = 1 for special cases only)
+ (p7) cmp.ne p9, p0 = r0, r0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        asin_Dd     = asin_S, asin_S, asin_B                  
-      nop.i 999 ;;
+{.mlx
+       // load c7 = 33*13/16
+       setf.s F_CS7 = R_TMP4
+       // c3 = 5/2
+       movl R_TMP4 = 0x40200000;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_W      = asin_Dd, asin_H, asin_S                 
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // 1-(s^2)_s
+       fnma.s1 F_S_1S2S = F_S2, f1, f1
+       nop.i 0
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_2W       = asin_W, f1, asin_W                    
-      nop.i 999
+{.mlx
+       // load c4 = -35/8
+       setf.s F_CS4 = R_TMP5
+       // c2 = -3/2
+       movl R_TMP5 = 0xbfc00000;;
 }
 
-// Step 1.3
-// Get w
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        asin_BmWW     = asin_W, asin_W, asin_B                
-      nop.i 999 ;;
+
+{.mfi
+       // load c3 = 5/2
+       setf.s F_CS3 = R_TMP4
+       // x = (1-s^2)_s*y^2-1
+       fms.s1 F_X = F_1S2_S, F_Y2, f1
+       // c6 = -33*7/16
+       shl R_TMP6 = R_TMP6, 12
 }
 
-// Step 2
-// asin(x) = atan2(X,sqrt(1-X*X))
-//         = atan2(X, W) -Xw
-// corr = Xw
-// asin(x) = Z_hi + (s_lo*Z_lo - corr)
-// Call atan2(X, W)
-// Save W in f9 
-// Save X in f12 
-// Save w in f13
+{.mfi
+       nop.m 0
+       // y^2/2
+       fma.s1 F_Y2_2 = F_Y2, F_05, f0
+       nop.i 0;;
+}
 
-{ .mfi
-      nop.m 999
-(p0)   fmerge.se f9 = asin_W, asin_W                                      
-      nop.i 999 ;;
+
+{.mfi
+       // load c6 = -33*7/16
+       setf.s F_CS6 = R_TMP6
+       // eliminate lower bits from y'
+       fand F_T = F_T1, F_ANDMASK
+       // c5 = 63/8
+       shl R_TMP7 = R_TMP7, 16
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_BmWWpb   = asin_BmWW, f1, asin_Bb                
-      nop.i 999 ;;
+{.mfb
+       // r3 = load start address to polynomial coefficients
+       ld8 r3 = [r3]
+       // 1-(1-s^2)_s-s^2
+       fnma.s1 F_DS = f8, f8, F_DS
+       // p9 = 1 if s is a special input (NaN, or |s|> = 1)
+ (p9) br.cond.spnt ASINL_SPECIAL_CASES;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  frcpa.s1       asin_1d2W,p9  = f1, asin_2W                           
-      nop.i 999 ;;
+{.mmf
+       // get exponent, significand of y' (in single prec.)
+       getf.s R_TMP = F_T1
+       // load c3 = -3/2
+       setf.s F_CS2 = R_TMP5
+       // y*(1-s^2)
+       fma.s1 F_Y1S2 = F_Y, F_1S2, f0;;
 }
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         asin_Ww       = asin_BmWWpb, asin_1d2W, f0            
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // x' = (y^2/2)*(1-(s^2)_s)-0.5
+       fms.s1 F_XL = F_Y2_2, F_S_1S2S, F_05
+       nop.i 0
 }
-.endp asinl
-ASM_SIZE_DIRECTIVE(asinl)
 
-.proc __libm_callout
-__libm_callout:
-.prologue
-{ .mfi
-        nop.m 0
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
-};;
-{ .mfi
-        mov GR_SAVE_GP=gp                       // Save gp
-        nop.f 0
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+{.mfi
+       nop.m 0
+       // s^2-(s^2)_s
+       fms.s1 F_S_DS2 = f8, f8, F_S2
+       nop.i 0;;
 }
-.body
+
+
+{.mfi
+       nop.m 0
+       // if s<0, set s = -s
+ (p6) fnma.s1 f8 = f8, f1, f0
+       nop.i 0;;
+}
+
+{.mfi
+       // load c5 = 63/8
+       setf.s F_CS5 = R_TMP7
+       // x = (1-s^2)_s*y^2-1+(1-(1-s^2)_s-s^2)*y^2
+       fma.s1 F_X = F_DS, F_Y2, F_X
+       // for t = 2^k*1.b1 b2.., get 7-k|b1.. b6
+       extr.u R_INDEX = R_TMP, 17, 9;;
+}
+
+
+{.mmi
+       // index = (4-exponent)|b1 b2.. b6
+       sub R_INDEX = R_INDEX, R_BIAS
+       nop.m 0
+       // get exponent of y
+       shr.u R_TMP2 = R_TMP, 23;;
+}
+
+{.mmi
+       // load C3
+       ldfe F_C3 = [r3], 16
+       // set p8 = 1 if y'<2^{-4}
+       cmp.gt p8, p0 = 0x7b, R_TMP2
+       // shift R_INDEX by 5
+       shl R_INDEX = R_INDEX, 5;;
+}
+
+
 {.mfb
-        nop.m 0
-(p0)    fmerge.se f13 = asin_Ww, asin_Ww                                   
-(p0)    br.call.sptk.many  b0=__libm_atan2_reg#                  
-};;
-{ .mfi
-        mov   gp = GR_SAVE_GP                  // Restore gp
-(p0)    fma.s1  asin_XWw  = asin_ABS_NORM_f8,f13,f0             
-        mov   b0 = GR_SAVE_B0                  // Restore return address
-};;
-// asin_XWw = Xw = corr
-// asin_low = (s_lo * Z_lo - corr)
-// f8       = Z_hi + (s_lo * Z_lo - corr)
+       // get table index for sqrt(1-t^2)
+       add r2 = r2, R_INDEX
+       // get t = 2^k*1.b1 b2.. b7 1
+       for F_T = F_T, F_ORMASK
+ (p8) br.cond.spnt VERY_LARGE_INPUT;;
+}
 
-{ .mfi
-        nop.m 999
-(p0)    fms.s1  asin_low  = f11, f10, asin_XWw                                
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-};;
 
-{ .mfi
-      nop.m 999
-(p0)   fma.s0  f8        = f8, f1, asin_low                                
-      nop.i 999 ;;
+
+{.mmf
+       // load C5
+       ldfe F_C5 = [r3], 16
+       // load 1/(1-t^2)
+       ldfp8 F_INV_1T2, F_SQRT_1T2 = [r2], 16
+       // x = ((1-s^2)*y^2-1)/2
+       fma.s1 F_X = F_X, F_05, f0;;
 }
 
-{ .mfb
-      nop.m 999
-(p0)   fmerge.s f8 = f12,f8 
-(p0)  br.ret.sptk   b0 ;;                                                    
+
+
+{.mmf
+       nop.m 0
+       // C7, C9
+       ldfpd F_C7, F_C9 = [r3], 16
+       // set correct exponent for t
+       fmerge.se F_T = F_T1, F_T;;
 }
-.endp __libm_callout
-ASM_SIZE_DIRECTIVE(__libm_callout)
 
-.proc SPECIAL
-SPECIAL:
-L(ASIN_ERROR_RETURN): 
 
-// If X is 1, return (sign of X)pi/2
 
-{ .mfi
-      nop.m 999
-(p0)  fcmp.eq.unc p6,p7 = asin_ABS_NORM_f8,f1   
-      nop.i 999 ;;
+{.mfi
+       // pi/2 (low, high)
+       ldfpd F_PI2_LO, F_PI2_HI = [r3]
+       // c9*x+c8
+       fma.s1 F_S89 = F_X, F_CS9, F_CS8
+       nop.i 0
 }
 
-{ .mfb
-(p6) ldfe          asin_pi_by_2_lo  = [r40] 
-(p6) fmerge.s      asin_pi_by_2 = f8,asin_pi_by_2          
-     nop.b 0;;
+{.mfi
+       nop.m 0
+       // x^2
+       fma.s1 F_X2 = F_X, F_X, f0
+       nop.i 0;;
 }
 
-// If X is a NAN, leave
-// qnan snan inf norm     unorm 0 -+
-// 1    1    0   0        0     0 11
-{ .mfb
-      nop.m 999
-(p6)  fma.s0     f8 = f8,asin_pi_by_2_lo,asin_pi_by_2              
-(p6)  br.ret.spnt   b0                           
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)*x
+       fma.s1 F_Y1S2X = F_Y1S2, F_X, f0
+       nop.i 0
 }
-{ .mfi
-      nop.m 999
-(p0)  fclass.m.unc p12,p0 = f8, 0xc3            
-      nop.i 999 ;;
+
+{.mfi
+       nop.m 0
+       // c7*x+c6
+       fma.s1 F_S67 = F_X, F_CS7, F_CS6
+       nop.i 0;;
 }
 
-{ .mfb
-      nop.m 999
-(p12) fma.s0 f8 = f8,f1,f0                       
-(p12) br.ret.spnt   b0 ;;                          
+
+{.mfi
+       nop.m 0
+       // 1-x
+       fnma.s1 F_1X = F_X, f1, f1
+       nop.i 0
 }
-{ .mfi
-(p0)   mov   GR_Parameter_TAG = 60                   
-(p0)   frcpa f10, p6 = f0, f0                   
-nop.i 0
-};;
-.endp SPECIAL
-ASM_SIZE_DIRECTIVE(SPECIAL)
 
-.proc __libm_error_region
-__libm_error_region:
+{.mfi
+       nop.m 0
+       // c3*x+c2
+       fma.s1 F_S23 = F_X, F_CS3, F_CS2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // 1-t^2
+       fnma.s1 F_1T2 = F_T, F_T, f1
+       nop.i 0
+}
+
+{.mfi
+       // load asin(t)_high, asin(t)_low
+       ldfpd F_ATHI, F_ATLO = [r2]
+       // c5*x+c4
+       fma.s1 F_S45 = F_X, F_CS5, F_CS4
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // t*s
+       fma.s1 F_TS = F_T, f8, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // 0.5/(1-t^2)
+       fma.s1 F_INV_1T2 = F_INV_1T2, F_2M64, f0
+       nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+       // z~sqrt(1-t^2), rounded to 24 significant bits
+       fma.s.s1 F_Z = F_SQRT_1T2, F_2M64, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // sqrt(1-t^2)
+       fma.s1 F_SQRT_1T2 = F_SQRT_1T2, F_2M64, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)*x^2
+       fma.s1 F_Y1S2X2 = F_Y1S2, F_X2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // x^4
+       fma.s1 F_X4 = F_X2, F_X2, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // s*t rounded to 24 significant bits
+       fma.s.s1 F_TSS = F_T, f8, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c9*x^3+..+c6
+       fma.s1 F_S69 = F_X2, F_S89, F_S67
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // ST = (t^2-1+s^2) rounded to 24 significant bits
+       fms.s.s1 F_ST = f8, f8, F_1T2
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c5*x^3+..+c2
+       fma.s1 F_S25 = F_X2, F_S45, F_S23
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // 0.25/(1-t^2)
+       fma.s1 F_INV1T2_2 = F_05, F_INV_1T2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // t*s-sqrt(1-t^2)*(1-s^2)*y
+       fnma.s1 F_TS = F_Y1S2, F_SQRT_1T2, F_TS
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // z*0.5/(1-t^2)
+       fma.s1 F_ZE = F_INV_1T2, F_SQRT_1T2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // z^2+t^2-1
+       fms.s1 F_DZ0 = F_Z, F_Z, F_1T2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (1-s^2-(1-s^2)_s)*x
+       fma.s1 F_DS2X = F_X, F_DS, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // t*s-(t*s)_s
+       fms.s1 F_DTS = F_T, f8, F_TSS
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c9*x^7+..+c2
+       fma.s1 F_S29 = F_X4, F_S69, F_S25
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*z
+       fma.s1 F_YZ = F_Z, F_Y, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // t^2
+       fma.s1 F_T2 = F_T, F_T, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // 1-t^2+ST
+       fma.s1 F_1T2_ST = F_ST, f1, F_1T2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)(1-x)
+       fma.s1 F_Y1S2_1X = F_Y1S2, F_1X, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // dz ~ sqrt(1-t^2)-z
+       fma.s1 F_DZ = F_DZ0, F_ZE, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // -1+correction for sqrt(1-t^2)-z
+       fnma.s1 F_CORR = F_INV1T2_2, F_DZ0, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (PS29*x^2+x)*y*(1-s^2)
+       fma.s1 F_S19 = F_Y1S2X2, F_S29, F_Y1S2X
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // z*y*(1-s^2)_s
+       fma.s1 F_ZY1S2S = F_YZ, F_1S2_S, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // s^2-(1-t^2+ST)
+       fms.s1 F_1T2_ST = f8, f8, F_1T2_ST
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (t*s-(t*s)_s)+z*y*(1-s^2-(1-s^2)_s)*x
+       fma.s1 F_DTS = F_YZ, F_DS2X, F_DTS
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // dz*y*(1-s^2)*(1-x)
+       fma.s1 F_DZ_TERM = F_DZ, F_Y1S2_1X, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // R = t*s-sqrt(1-t^2)*(1-s^2)*y+sqrt(1-t^2)*(1-s^2)*y*PS19
+       // (used for polynomial evaluation)
+       fma.s1 F_R = F_S19, F_SQRT_1T2, F_TS
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (PS29*x^2)*y*(1-s^2)
+       fma.s1 F_S29 = F_Y1S2X2, F_S29, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // apply correction to dz*y*(1-s^2)*(1-x)
+       fma.s1 F_DZ_TERM = F_DZ_TERM, F_CORR, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // R^2
+       fma.s1 F_R2 = F_R, F_R, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (t*s-(t*s)_s)+z*y*(1-s^2-(1-s^2)_s)*x+dz*y*(1-s^2)*(1-x)
+       fma.s1 F_DZ_TERM = F_DZ_TERM, f1, F_DTS
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c7+c9*R^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+       // asin(t)_low-(pi/2)_low
+       fms.s1 F_ATLO = F_ATLO, f1, F_PI2_LO
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // R^4
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R3 = F_R2, F_R, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (t*s)_s-t^2*y*z
+       fnma.s1 F_TSS = F_T2, F_YZ, F_TSS
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST)
+       fma.s1 F_DZ_TERM = F_YZ, F_1T2_ST, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (pi/2)_hi-asin(t)_hi
+       fms.s1 F_ATHI = F_PI2_HI, f1, F_ATHI
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST)+
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29
+       fma.s1 F_DZ_TERM = F_SQRT_1T2, F_S29, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (t*s)_s-t^2*y*z+z*y*ST
+       fma.s1 F_TSS = F_YZ, F_ST, F_TSS
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // -asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fms.s1 F_P39 = F_P39, F_R3, F_ATLO
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // if s<0, change sign of F_ATHI
+ (p6) fnma.s1 F_ATHI = F_ATHI, f1, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) +
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 +
+       // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_DZ_TERM = F_P39, f1, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) +
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 + z*y*(1-s^2)_s*x +
+       // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6)
+       fma.s1 F_DZ_TERM = F_ZY1S2S, F_X, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // d(ts)+z*y*d(1-s^2)*x+dz*y*(1-s^2)*(1-x)+z*y*(s^2-1+t^2-ST) +
+       // + sqrt(1-t^2)*y*(1-s^2)*x^2*PS29 + z*y*(1-s^2)_s*x +
+       // - asin(t)_low+R^3*(c3+c5*R^2+c7*R^4+c9*R^6) +
+       // + (t*s)_s-t^2*y*z+z*y*ST
+       fma.s1 F_DZ_TERM = F_TSS, f1, F_DZ_TERM
+       nop.i 0;;
+}
+
+
+.pred.rel "mutex", p6, p11
+{.mfi
+       nop.m 0
+       // result: add high part of pi/2-table value
+       // s>0 in this case
+ (p11) fma.s0 f8 = F_DZ_TERM, f1, F_ATHI
+       nop.i 0
+}
+
+{.mfb
+       nop.m 0
+       // result: add high part of pi/2-table value
+       // if s<0
+ (p6) fnma.s0 f8 = F_DZ_TERM, f1, F_ATHI
+       br.ret.sptk b0;;
+}
+
+
+
+
+
+
+SMALL_S:
+
+       // use 15-term polynomial approximation
+
+{.mmi
+       // r3 = pointer to polynomial coefficients
+       addl r3 = @ltoff(poly_coeffs), gp;;
+       // load start address for coefficients
+       ld8 r3 = [r3]
+       mov R_TMP = 0x3fbf;;
+}
+
+
+{.mmi
+       add r2 = 64, r3
+       ldfe F_C3 = [r3], 16
+       // p7 = 1 if |s|<2^{-64} (exponent of s<bias-64)
+       cmp.lt p7, p0 = R_EXP0, R_TMP;;
+}
+
+{.mmf
+       ldfe F_C5 = [r3], 16
+       ldfpd F_C11, F_C13 = [r2], 16
+	   // 2^{-128}
+       fma.s1 F_2M128 = F_2M64, F_2M64, f0;;
+}
+
+{.mmf
+       ldfpd F_C7, F_C9 = [r3]
+       ldfpd F_C15, F_C17 = [r2]
+       // if |s|<2^{-64}, return s+2^{-128}*s
+ (p7) fma.s0 f8 = f8, F_2M128, f8;;
+}
+
+
+
+{.mfb
+       nop.m 0
+       // s^2
+       fma.s1 F_R2 = f8, f8, f0
+       // if |s|<2^{-64}, return s
+ (p7) br.ret.spnt b0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // s^3
+       fma.s1 F_R3 = f8, F_R2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // s^4
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c3+c5*s^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c11+c13*s^2
+       fma.s1 F_P1113 = F_C13, F_R2, F_C11
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c7+c9*s^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c15+c17*s^2
+       fma.s1 F_P1517 = F_C17, F_R2, F_C15
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // s^8
+       fma.s1 F_R8 = F_R4, F_R4, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c3+c5*s^2+c7*s^4+c9*s^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c11+c13*s^2+c15*s^4+c17*s^6
+       fma.s1 F_P1117 = F_P1517, F_R4, F_P1113
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c3+..+c17*s^14
+       fma.s1 F_P317 = F_R8, F_P1117, F_P39
+       nop.i 0;;
+}
+
+
+{.mfb
+       nop.m 0
+       // result
+       fma.s0 f8 = F_P317, F_R3, f8
+       br.ret.sptk b0;;
+}
+
+
+{.mfb
+       nop.m 0
+       fma.s0 f8 = F_P317, F_R3, f0//F_P317, F_R3, F_S29
+       // nop.f 0//fma.s0 f8 = f13, f6, f0
+       br.ret.sptk b0;;
+}
+
+
+
+
+
+       VERY_LARGE_INPUT:
+
+{.mfi
+       nop.m 0
+       // s rounded to 24 significant bits
+       fma.s.s1 F_S = f8, f1, f0
+       nop.i 0
+}
+
+{.mfi
+       // load C5
+       ldfe F_C5 = [r3], 16
+       // x = ((1-(s^2)_s)*y^2-1)/2-(s^2-(s^2)_s)*y^2/2
+       fnma.s1 F_X = F_S_DS2, F_Y2_2, F_XL
+       nop.i 0;;
+}
+
+
+
+{.mmf
+       nop.m 0
+       // C7, C9
+       ldfpd F_C7, F_C9 = [r3], 16
+       nop.f 0;;
+}
+
+
+
+{.mfi
+       // pi/2 (low, high)
+       ldfpd F_PI2_LO, F_PI2_HI = [r3], 16
+       // c9*x+c8
+       fma.s1 F_S89 = F_X, F_CS9, F_CS8
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // x^2
+       fma.s1 F_X2 = F_X, F_X, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)*x
+       fma.s1 F_Y1S2X = F_Y1S2, F_X, f0
+       nop.i 0
+}
+
+{.mfi
+       // C11, C13
+       ldfpd F_C11, F_C13 = [r3], 16
+       // c7*x+c6
+       fma.s1 F_S67 = F_X, F_CS7, F_CS6
+       nop.i 0;;
+}
+
+
+{.mfi
+       // C15, C17
+       ldfpd F_C15, F_C17 = [r3], 16
+       // c3*x+c2
+       fma.s1 F_S23 = F_X, F_CS3, F_CS2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c5*x+c4
+       fma.s1 F_S45 = F_X, F_CS5, F_CS4
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (s_s)^2
+       fma.s1 F_DS = F_S, F_S, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // 1-(s_s)^2
+       fnma.s1 F_1S2_S = F_S, F_S, f1
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)*x^2
+       fma.s1 F_Y1S2X2 = F_Y1S2, F_X2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // x^4
+       fma.s1 F_X4 = F_X2, F_X2, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c9*x^3+..+c6
+       fma.s1 F_S69 = F_X2, F_S89, F_S67
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c5*x^3+..+c2
+       fma.s1 F_S25 = F_X2, F_S45, F_S23
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // ((s_s)^2-s^2)
+       fnma.s1 F_DS = f8, f8, F_DS
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // (pi/2)_high-y*(1-(s_s)^2)
+       fnma.s1 F_HI = F_Y, F_1S2_S, F_PI2_HI
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c9*x^7+..+c2
+       fma.s1 F_S29 = F_X4, F_S69, F_S25
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // -(y*(1-(s_s)^2))_high
+       fms.s1 F_1S2_HI = F_HI, f1, F_PI2_HI
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (PS29*x^2+x)*y*(1-s^2)
+       fma.s1 F_S19 = F_Y1S2X2, F_S29, F_Y1S2X
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-(s_s)^2)-(y*(1-s^2))_high
+       fma.s1 F_DS2 = F_Y, F_1S2_S, F_1S2_HI
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // R ~ sqrt(1-s^2)
+       // (used for polynomial evaluation)
+       fnma.s1 F_R = F_S19, f1, F_Y1S2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // y*(1-s^2)-(y*(1-s^2))_high
+       fma.s1 F_DS2 = F_Y, F_DS, F_DS2
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // (pi/2)_low+(PS29*x^2)*y*(1-s^2)
+       fma.s1 F_S29 = F_Y1S2X2, F_S29, F_PI2_LO
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // R^2
+       fma.s1 F_R2 = F_R, F_R, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (pi/2)_low+(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-(y*(1-s^2))_high)
+       fms.s1 F_S29 = F_S29, f1, F_DS2
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c7+c9*R^2
+       fma.s1 F_P79 = F_C9, F_R2, F_C7
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2
+       fma.s1 F_P35 = F_C5, F_R2, F_C3
+       nop.i 0;;
+}
+
+
+
+{.mfi
+       nop.m 0
+       // R^4
+       fma.s1 F_R4 = F_R2, F_R2, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // R^3
+       fma.s1 F_R3 = F_R2, F_R, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c11+c13*R^2
+       fma.s1 F_P1113 = F_C13, F_R2, F_C11
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c15+c17*R^2
+       fma.s1 F_P1517 = F_C17, F_R2, F_C15
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (pi/2)_low+(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-(y*(1-s^2))_high)+y*(1-s^2)*x
+       fma.s1 F_S29 = F_Y1S2, F_X, F_S29
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c11+c13*R^2+c15*R^4+c17*R^6
+       fma.s1 F_P1117 = F_P1517, F_R4, F_P1113
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6
+       fma.s1 F_P39 = F_P79, F_R4, F_P35
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // R^8
+       fma.s1 F_R8 = F_R4, F_R4, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // c3+c5*R^2+c7*R^4+c9*R^6+..+c17*R^14
+       fma.s1 F_P317 = F_P1117, F_R8, F_P39
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // (pi/2)_low-(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-
+       // -(y*(1-s^2))_high)+y*(1-s^2)*x - P3, 17
+       fnma.s1 F_S29 = F_P317, F_R3, F_S29
+       nop.i 0;;
+}
+
+{.mfi
+       nop.m 0
+       // set sign
+  (p6) fnma.s1 F_S29 = F_S29, f1, f0
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+  (p6) fnma.s1 F_HI = F_HI, f1, f0
+       nop.i 0;;
+}
+
+
+{.mfb
+       nop.m 0
+       // Result:
+       // (pi/2)_low-(PS29*x^2)*y*(1-s^2)-(y*(1-s^2)-
+       // -(y*(1-s^2))_high)+y*(1-s^2)*x - P3, 17
+       // +(pi/2)_high-(y*(1-s^2))_high
+       fma.s0 f8 = F_S29, f1, F_HI
+       br.ret.sptk b0;;
+}
+
+
+
+
+
+
+
+
+
+       ASINL_SPECIAL_CASES:
+
+{.mfi
+       alloc r32 = ar.pfs, 1, 4, 4, 0
+       // check if the input is a NaN, or unsupported format
+       // (i.e. not infinity or normal/denormal)
+       fclass.nm p7, p8 = f8, 0x3f
+       // pointer to pi/2
+       add r3 = 48, r3;;
+}
+
+
+{.mfi
+       // load pi/2
+       ldfpd F_PI2_HI, F_PI2_LO = [r3]
+       // get |s|
+       fmerge.s F_S = f0, f8
+       nop.i 0
+}
+
+{.mfb
+       nop.m 0
+       // if NaN, quietize it, and return
+ (p7) fma.s0 f8 = f8, f1, f0
+ (p7) br.ret.spnt b0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // |s| = 1 ?
+       fcmp.eq.s0 p9, p0 = F_S, f1
+       nop.i 0
+}
+
+{.mfi
+       nop.m 0
+       // load FR_X
+       fma.s1 FR_X = f8, f1, f0
+       // load error tag
+       mov GR_Parameter_TAG = 60;;
+}
+
+
+{.mfb
+       nop.m 0
+       // change sign if s = -1
+ (p6)  fnma.s1 F_PI2_HI = F_PI2_HI, f1, f0
+       nop.b 0
+}
+
+{.mfb
+       nop.m 0
+       // change sign if s = -1
+ (p6)  fnma.s1 F_PI2_LO = F_PI2_LO, f1, f0
+       nop.b 0;;
+}
+
+{.mfb
+       nop.m 0
+       // if s = 1, result is pi/2
+ (p9) fma.s0 f8 = F_PI2_HI, f1, F_PI2_LO
+       // return if |s| = 1
+ (p9) br.ret.sptk b0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // get Infinity
+       frcpa.s1 FR_RESULT, p0 = f1, f0
+       nop.i 0;;
+}
+
+
+{.mfi
+       nop.m 0
+       // return QNaN indefinite (0*Infinity)
+       fma.s0 FR_RESULT = f0, FR_RESULT, f0
+       nop.i 0;;
+}
+
+
+GLOBAL_LIBM_END(asinl)
+
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
+// (1)
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
         nop.f 0
@@ -742,24 +2471,29 @@ __libm_error_region:
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
+        add sp=-64,sp                          // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+        mov GR_SAVE_GP=gp                      // Save gp
 };;
+
+
+// (2)
 { .mmi
-        stfe [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+        stfe [GR_Parameter_Y] = f1,16         // Store Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+        mov GR_SAVE_B0=b0                     // Save b0
 };;
+
 .body
+// (3)
 { .mib
-        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+        stfe [GR_Parameter_X] = FR_X              // Store Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y
         nop.b 0                                 // Parameter 3 address
 }
 { .mib
-        stfe [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
+        stfe [GR_Parameter_Y] = FR_RESULT             // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
         br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
@@ -768,23 +2502,27 @@ __libm_error_region:
         nop.m 0
         add   GR_Parameter_RESULT = 48,sp
 };;
+
+// (4)
 { .mmi
         ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
+
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
-};; 
+};;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
 
-.type   __libm_atan2_reg#,@function
-.global __libm_atan2_reg#
+
+
+
+
diff --git a/sysdeps/ia64/fpu/e_atan2.S b/sysdeps/ia64/fpu/e_atan2.S
index 38dd2f749a..7a17fbfed4 100644
--- a/sysdeps/ia64/fpu/e_atan2.S
+++ b/sysdeps/ia64/fpu/e_atan2.S
@@ -1,10 +1,10 @@
 .file "atan2.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,33 +20,39 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
-//          set [the previously overwritten] GR_Parameter_RESULT.
-// 8/17/00  Changed predicate register macro-usage to direct predicate
-//          names due to an assembler bug.
-// 9/28/00  Updated to set invalid on SNaN inputs
-// 1/19/01  Fixed flags for small results
+// 02/02/00  Initial version
+// 04/04/00  Unwind support added
+// 08/15/00  Bundle added after call to __libm_error_support to properly
+//           set [the previously overwritten] GR_Parameter_RESULT.
+// 08/17/00  Changed predicate register macro-usage to direct predicate
+//           names due to an assembler bug.
+// 09/28/00  Updated to set invalid on SNaN inputs
+// 01/19/01  Fixed flags for small results
+// 04/13/01  Rescheduled to make all paths faster
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 08/20/02  Corrected inexact flag and directed rounding symmetry bugs
+// 02/06/03  Reordered header: .section, .global, .proc, .align
+// 04/17/03  Added missing mutex directive
+// 12/23/03  atan2(NaN1,NaN2) now QNaN1, for consistency with atan2f, atan2l
 //
 // API
 //==============================================================
@@ -55,10 +61,12 @@
 // Overview of operation
 //==============================================================
 //
+// The atan2 function returns values in the interval [-pi,+pi].
+//
 // There are two basic paths: swap true and swap false.
 // atan2(Y,X) ==> atan2(V/U) where U >= V. If Y > X, we must swap.
 //
-// p6  swap True    |Y| > |X| 
+// p6  swap True    |Y| > |X|
 // p7  swap False   |Y| <= |X|
 // p8  X+   (If swap=True p8=p9=0)
 // p9  X-
@@ -66,21 +74,21 @@
 // all the other predicates p10 thru p15 are false for the main path
 //
 // Simple trigonometric identities show
-//   Region 1 (-45 to +45 degrees):  
+//   Region 1 (-45 to +45 degrees):
 //         X>0, |Y|<=X, V=Y, U=X     atan2(Y,X) = sgnY * (0 + atan(V/U))
 //
-//   Region 2 (-90 to -45 degrees, and +45 to +90 degrees):  
+//   Region 2 (-90 to -45 degrees, and +45 to +90 degrees):
 //         X>0, |Y|>X, V=X, U=Y      atan2(Y,X) = sgnY * (pi/2 - atan(V/U))
 //
-//   Region 3 (-135 to -90 degrees, and +90 to +135 degrees):  
+//   Region 3 (-135 to -90 degrees, and +90 to +135 degrees):
 //         X<0, |Y|>X, V=X, U=Y      atan2(Y,X) = sgnY * (pi/2 + atan(V/U))
 //
-//   Region 4 (-180 to -135 degrees, and +135 to +180 degrees):  
+//   Region 4 (-180 to -135 degrees, and +135 to +180 degrees):
 //         X<0, |Y|<=X, V=Y, U=X      atan2(Y,X) = sgnY * (pi - atan(V/U))
 //
 // So the result is always of the form atan2(Y,X) = P + sgnXY * atan(V/U)
 //
-// We compute atan(V/U) from the identity 
+// We compute atan(V/U) from the identity
 //      atan(z) + atan([(V/U)-z] / [1+(V/U)z])
 //      where z is a limited precision approximation (16 bits) to V/U
 //
@@ -124,30 +132,40 @@
 //             +number           -0          +pi/2
 //             -number           -0          -pi/2
 //
-//             +0                +number     +0 
-//             -0                +number     -0 
+//             +0                +number     +0
+//             -0                +number     -0
 //             +0                -number     +pi
 //             -0                -number     -pi
 //
-//             +0                +0          +0 
-//             -0                +0          -0 
+//             +0                +0          +0
+//             -0                +0          -0
 //             +0                -0          +pi
 //             -0                -0          -pi
 //
 //            Nan             anything      quiet Y
-//            anything        NaN           quiet X
+//            Not NaN         NaN           quiet X
 
 // atan2(+-0/+-0) sets double error tag to 37
-// atan2(+-0/+-0) sets single error tag to 38
 
-#include "libm_support.h"
+// Registers used
+//==============================================================
+
+// predicate registers used:
+// p6 -> p15
+
+// floating-point registers used:
+// f8, f9 input
+// f32 -> f119
+
+// general registers used
+// r32 -> r41
 
 // Assembly macros
 //==============================================================
 
 EXP_AD_P1                    = r33
 EXP_AD_P2                    = r34
-atan2_GR_sml_exp             = r35
+rsig_near_one                = r35
 
 
 GR_SAVE_B0                   = r35
@@ -159,22 +177,23 @@ GR_Parameter_Y               = r39
 GR_Parameter_RESULT          = r40
 atan2_GR_tag                 = r41
 
-
-atan2_X                      = f9
 atan2_Y                      = f8
+atan2_X                      = f9
 
 atan2_u1_X                   = f32
 atan2_u1_Y                   = f33
-atan2_Umax                   = f34
-atan2_Vmin                   = f35
+atan2_z2_X                   = f34
+atan2_z2_Y                   = f35
+
 atan2_two                    = f36
-atan2_absX                   = f37
+atan2_B1sq_Y                 = f37
 atan2_z1_X                   = f38
 atan2_z1_Y                   = f39
 atan2_B1X                    = f40
+
 atan2_B1Y                    = f41
-atan2_wp                     = f42
-atan2_B1sq                   = f43
+atan2_wp_X                   = f42
+atan2_B1sq_X                 = f43
 atan2_z                      = f44
 atan2_w                      = f45
 
@@ -183,178 +202,149 @@ atan2_P1                     = f47
 atan2_P2                     = f48
 atan2_P3                     = f49
 atan2_P4                     = f50
+
 atan2_P5                     = f51
 atan2_P6                     = f52
 atan2_P7                     = f53
 atan2_P8                     = f54
 atan2_P9                     = f55
+
 atan2_P10                    = f56
 atan2_P11                    = f57
 atan2_P12                    = f58
 atan2_P13                    = f59
 atan2_P14                    = f60
+
 atan2_P15                    = f61
 atan2_P16                    = f62
 atan2_P17                    = f63
 atan2_P18                    = f64
 atan2_P19                    = f65
+
 atan2_P20                    = f66
 atan2_P21                    = f67
 atan2_P22                    = f68
-atan2_Pi_by_2                = f69
-
+atan2_tmp                    = f68
+atan2_pi_by_2                = f69
+atan2_sgn_pi_by_2            = f69
 atan2_V13                    = f70
+
 atan2_W11                    = f71
 atan2_E                      = f72
-atan2_gamma                  = f73
+atan2_wp_Y                   = f73
 atan2_V11                    = f74
 atan2_V12                    = f75
+
 atan2_V7                     = f76
 atan2_V8                     = f77
 atan2_W7                     = f78
 atan2_W8                     = f79
 atan2_W3                     = f80
+
 atan2_W4                     = f81
 atan2_V3                     = f82
 atan2_V4                     = f83
 atan2_F                      = f84
 atan2_gV                     = f85
+
 atan2_V10                    = f86
 atan2_zcub                   = f87
 atan2_V6                     = f88
 atan2_V9                     = f89
 atan2_W10                    = f90
+
 atan2_W6                     = f91
 atan2_W2                     = f92
 atan2_V2                     = f93
-
 atan2_alpha                  = f94
 atan2_alpha_1                = f95
+
 atan2_gVF                    = f96
 atan2_V5                     = f97
 atan2_W12                    = f98
 atan2_W5                     = f99
 atan2_alpha_sq               = f100
+
 atan2_Cp                     = f101
 atan2_V1                     = f102
-
-atan2_sml_norm               = f103
-atan2_FR_tmp                 = f103
-
+atan2_ysq                    = f103
 atan2_W1                     = f104
 atan2_alpha_cub              = f105
+
 atan2_C                      = f106
-atan2_P                      = f107
+atan2_xsq                    = f107
 atan2_d                      = f108
 atan2_A_hi                   = f109
 atan2_dsq                    = f110
+
 atan2_pd                     = f111
 atan2_A_lo                   = f112
 atan2_A                      = f113
-
 atan2_Pp                     = f114
+atan2_sgnY                   = f115
 
-atan2_sgnY                   = f116
+atan2_sig_near_one           = f116
+atan2_near_one               = f116
 atan2_pi                     = f117
-atan2_sgnX                   = f118
-atan2_sgnXY                  = f119
-
-atan2_3pi_by_4               = f120
-atan2_pi_by_4                = f121
-
-//atan2_sF                     = p7
-//atan2_sT                     = p6
+atan2_sgn_pi                 = f117
+atan2_3pi_by_4               = f118
+atan2_pi_by_4                = f119
 
-// These coefficients are for atan2. 
-// You can also use this set to substitute those used in the |X| <= 1 case for atan; 
-// BUT NOT vice versa.
 
 /////////////////////////////////////////////////////////////
 
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-atan2_tb1:
-ASM_TYPE_DIRECTIVE(atan2_tb1,@object)
-data8 0xB199DD6D2675C40F ,  0x0000BFFA // P10
+LOCAL_OBJECT_START(atan2_tb1)
 data8 0xA21922DC45605EA1 ,  0x00003FFA // P11
-data8 0xD78F28FC2A592781 ,  0x0000BFFA // P8
+data8 0xB199DD6D2675C40F ,  0x0000BFFA // P10
 data8 0xC2F01E5DDD100DBE ,  0x00003FFA // P9
-data8 0x9D89D7D55C3287A5 ,  0x00003FFB // P5
+data8 0xD78F28FC2A592781 ,  0x0000BFFA // P8
 data8 0xF0F03ADB3FC930D3 ,  0x00003FFA // P7
-data8 0xF396268151CFB11C ,  0x00003FF7 // P17 
-data8 0x9D3436AABE218776 ,  0x00003FF5 // P19
-data8 0x80D601879218B53A ,  0x00003FFA // P13
-data8 0xA2270D30A90AA220 ,  0x00003FF9 // P15
-data8 0xCCCCCCCCCCC906CD ,  0x00003FFC // P1
+data8 0x88887EBB209E3543 ,  0x0000BFFB // P6
+data8 0x9D89D7D55C3287A5 ,  0x00003FFB // P5
+data8 0xBA2E8B9793955C77 ,  0x0000BFFB // P4
 data8 0xE38E38E320A8A098 ,  0x00003FFB // P3
-data8 0xFE7E52D2A89995B3 ,  0x0000BFEC // P22
-data8 0xC90FDAA22168C235 ,  0x00003FFE // pi/4
-ASM_SIZE_DIRECTIVE(atan2_tb1)
+data8 0x9249249247E37913 ,  0x0000BFFC // P2
+data8 0xCCCCCCCCCCC906CD ,  0x00003FFC // P1
+data8 0xAAAAAAAAAAAAA8A9 ,  0x0000BFFD // P0
+data8 0xC90FDAA22168C235 ,  0x00004000 // pi
+LOCAL_OBJECT_END(atan2_tb1)
 
-atan2_tb2:
-ASM_TYPE_DIRECTIVE(atan2_tb2,@object)
-data8 0x9F90FB984D8E39D0 ,  0x0000BFF3 // P20
+LOCAL_OBJECT_START(atan2_tb2)
 data8 0xCE585A259BD8374C ,  0x00003FF0 // P21
-data8 0xBA2E8B9793955C77 ,  0x0000BFFB // P4
-data8 0x88887EBB209E3543 ,  0x0000BFFB // P6
-data8 0xD818B4BB43D84BF2 ,  0x0000BFF8 // P16
+data8 0x9F90FB984D8E39D0 ,  0x0000BFF3 // P20
+data8 0x9D3436AABE218776 ,  0x00003FF5 // P19
 data8 0xDEC343E068A6D2A8 ,  0x0000BFF6 // P18
-data8 0x9297B23CCFFB291F ,  0x0000BFFA // P12
+data8 0xF396268151CFB11C ,  0x00003FF7 // P17
+data8 0xD818B4BB43D84BF2 ,  0x0000BFF8 // P16
+data8 0xA2270D30A90AA220 ,  0x00003FF9 // P15
 data8 0xD5F4F2182E7A8725 ,  0x0000BFF9 // P14
-data8 0xAAAAAAAAAAAAA8A9 ,  0x0000BFFD // P0
-data8 0x9249249247E37913 ,  0x0000BFFC // P2
+data8 0x80D601879218B53A ,  0x00003FFA // P13
+data8 0x9297B23CCFFB291F ,  0x0000BFFA // P12
+data8 0xFE7E52D2A89995B3 ,  0x0000BFEC // P22
 data8 0xC90FDAA22168C235 ,  0x00003FFF // pi/2
-data8 0xC90FDAA22168C235 ,  0x00004000 // pi
+data8 0xC90FDAA22168C235 ,  0x00003FFE // pi/4
 data8 0x96cbe3f9990e91a8 ,  0x00004000 // 3pi/4
-ASM_SIZE_DIRECTIVE(atan2_tb2)
-
-
+LOCAL_OBJECT_END(atan2_tb2)
 
 
-.align 32
-.global atan2#
-#ifdef _LIBC
-.global __atan2#
-.global __ieee754_atan2#
-#endif
 
-////////////////////////////////////////////////////////
 
 .section .text
-.align 32
-
-.proc  atan2#
-atan2:
-#ifdef _LIBC
-.proc  __atan2#
-__atan2:
-.proc  __ieee754_atan2#
-__ieee754_atan2:
-#endif
-// qnan snan inf norm     unorm 0 -+
-// 0    0    1   0        0     0 11
-
-
-//         Y NAN?     p10 p11
-// p10 ==> quiet Y and return
-// p11     X NAN?     p12, p13 
-// p12 ==> quiet X and return
+GLOBAL_IEEE754_ENTRY(atan2)
 
 { .mfi
            alloc        r32           = ar.pfs,1,5,4,0
            frcpa.s1     atan2_u1_X,p6 = f1,atan2_X
-           addl         EXP_AD_P2   = @ltoff(atan2_tb2), gp
+           nop.i 999
 }
 { .mfi
            addl         EXP_AD_P1   = @ltoff(atan2_tb1), gp
-           fclass.m.unc p10,p11 = f8, 0xc3
+           fma.s1       atan2_two  = f1,f1,f1
            nop.i 999
 ;;
 }
@@ -366,256 +356,233 @@ __ieee754_atan2:
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_two  = f1,f1,f1 
+           fma.s1       atan2_xsq  = atan2_X,atan2_X,f0
            nop.i 999
 ;;
 }
 
-
 { .mfi
-           ld8 EXP_AD_P2 = [ EXP_AD_P2]
-           famax.s1     atan2_Umax =  f8,f9
+           nop.m 999
+           fclass.m p10,p0 = atan2_Y, 0xc3     // Test for y=nan
            nop.i 999
 }
-;;
-
 { .mfi
            nop.m 999
-           fmerge.s     atan2_absX = f0,atan2_X
+           fma.s1       atan2_ysq  = atan2_Y,atan2_Y,f0
            nop.i 999
 }
 ;;
 
-// p10 Y NAN, quiet and return
 { .mfi
-           ldfe         atan2_P10  = [EXP_AD_P1],16
-           fmerge.s     atan2_sgnY = atan2_Y,f1
+           add  EXP_AD_P2 = 0xd0,EXP_AD_P1
+           fclass.m p12,p0 = atan2_X, 0xc3     // Test for x nan
            nop.i 999
 }
-{ .mfb
-           nop.m 999
-(p10)      fma.d f8 = f8,f9,f0 
-(p10)      br.ret.spnt b0
 ;;
-}
 
 
-{ .mmf
+// p10 Y NAN, quiet and return
+{ .mfi
            ldfe         atan2_P11  = [EXP_AD_P1],16
-           ldfe         atan2_P20  = [EXP_AD_P2],16
-           fmerge.s     atan2_sgnX = atan2_X,f1
+           fmerge.s     atan2_sgnY = atan2_Y,f1
+           nop.i 999
+}
+{ .mfb
+           ldfe         atan2_P21  = [EXP_AD_P2],16
+(p10)      fma.d.s0 f8 = atan2_X,atan2_Y,f0   // If y=nan, result quietized y
+(p10)      br.ret.spnt b0        // Exit if y=nan
 ;;
 }
 
 
-{ .mfi 
-           ldfe         atan2_P8   = [EXP_AD_P1],16
+{ .mfi
+           ldfe         atan2_P10  = [EXP_AD_P1],16
            fma.s1       atan2_z1_X = atan2_u1_X, atan2_Y, f0
            nop.i 999
 }
-{ .mfi 
-
-           ldfe         atan2_P21  = [EXP_AD_P2],16
-           fma.s1       atan2_z1_Y = atan2_u1_Y, atan2_X, f0
+{ .mfi
+           ldfe         atan2_P20  = [EXP_AD_P2],16
+           fnma.s1      atan2_B1X  = atan2_u1_X, atan2_X, atan2_two
            nop.i 999
 ;;
 }
 
-{ .mfi 
+{ .mfi
            ldfe         atan2_P9   = [EXP_AD_P1],16
-           fnma.s1      atan2_B1X  = atan2_u1_X, atan2_X, atan2_two
+           fma.s1       atan2_z1_Y = atan2_u1_Y, atan2_X, f0
            nop.i 999
 }
-{ .mfi 
-
-           ldfe         atan2_P4   = [EXP_AD_P2],16
+{ .mfi
+           ldfe         atan2_P19  = [EXP_AD_P2],16
            fnma.s1      atan2_B1Y  = atan2_u1_Y, atan2_Y, atan2_two
            nop.i 999
-;;
 }
-
-// p6 (atan2_sT) true if swap
-// p7 (atan2_sF) true if no swap
-// p11 ==> Y !NAN;  X NAN?
+;;
 
 { .mfi
-           ldfe         atan2_P5   = [EXP_AD_P1],16
-//           fcmp.eq.unc.s1 atan2_sF,atan2_sT    = atan2_Umax, atan2_X
-           fcmp.eq.unc.s1 p7,p6    = atan2_Umax, atan2_X
+           ldfe         atan2_P8   = [EXP_AD_P1],16
+           fma.s1       atan2_z2_X = atan2_u1_X, atan2_ysq, f0
            nop.i 999
 }
 { .mfi
-           ldfe         atan2_P6   = [EXP_AD_P2],16
-(p11)      fclass.m.unc p12,p13    = f9, 0xc3
+           ldfe         atan2_P18  = [EXP_AD_P2],16
+           fma.s1       atan2_z2_Y = atan2_u1_Y, atan2_xsq, f0
            nop.i 999
-;;
 }
-
-{ .mmf
-           ldfe         atan2_P7   = [EXP_AD_P1],16
-           ldfe         atan2_P16  = [EXP_AD_P2],16
-           famin.s1     atan2_Vmin =  f8,f9
 ;;
-}
 
-// p8 true if X positive
-// p9 true if X negative
-// both are false is swap is true
+// p10 ==> x  inf     y ?
+// p11 ==> x !inf     y ?
 { .mfi
-           ldfe         atan2_P17  = [EXP_AD_P1],16
-//(atan2_sF) fcmp.eq.unc.s1 p8,p9    = atan2_sgnX,f1
-(p7) fcmp.eq.unc.s1 p8,p9    = atan2_sgnX,f1
+           ldfe         atan2_P7   = [EXP_AD_P1],16
+           fclass.m p10,p11 = atan2_X, 0x23    // test for x inf
            nop.i 999
 }
-{ .mfi
-           ldfe         atan2_P18  = [EXP_AD_P2],16
-           fma.s1       atan2_sgnXY     = atan2_sgnX, atan2_sgnY, f0 
-           nop.i 999
+{ .mfb
+           ldfe         atan2_P17  = [EXP_AD_P2],16
+(p12)      fma.d.s0        f8 = atan2_X,atan2_Y,f0     // If x nan, result quiet x
+(p12)      br.ret.spnt b0                 // Exit for x nan
 ;;
 }
 
+// p6 true if swap,    means |y| >  |x|    or ysq > xsq
+// p7 true if no swap, means |x| >= |y|    or xsq >= ysq
+{ .mmf
+           ldfe         atan2_P6   = [EXP_AD_P1],16
+           ldfe         atan2_P16  = [EXP_AD_P2],16
+           fcmp.ge.s1 p7,p6    = atan2_xsq, atan2_ysq
+;;
+}
 
 { .mfi
-           ldfe         atan2_P19  = [EXP_AD_P1],16
-//(atan2_sF) fma.s1       atan2_wp   = atan2_z1_X, atan2_z1_X, f0
-(p7) fma.s1       atan2_wp   = atan2_z1_X, atan2_z1_X, f0
+           ldfe         atan2_P5   = [EXP_AD_P1],16
+           fma.s1       atan2_wp_X   = atan2_z1_X, atan2_z1_X, f0
            nop.i 999
 }
 { .mfi
-           ldfe         atan2_P12  = [EXP_AD_P2],16
-//(atan2_sT) fma.s1       atan2_wp   = atan2_z1_Y, atan2_z1_Y, f0
-(p6) fma.s1       atan2_wp   = atan2_z1_Y, atan2_z1_Y, f0
+           ldfe         atan2_P15       = [EXP_AD_P2],16
+           fma.s1       atan2_B1sq_X = atan2_B1X, atan2_B1X, f0
            nop.i 999
 ;;
 }
 
-
 { .mfi
-           ldfe         atan2_P13  = [EXP_AD_P1],16
-//(atan2_sF) fma.s1       atan2_z         = atan2_z1_X, atan2_B1X, f0
-(p7) fma.s1       atan2_z         = atan2_z1_X, atan2_B1X, f0
+           ldfe         atan2_P4   = [EXP_AD_P1],16
+(p6)       fma.s1       atan2_wp_Y   = atan2_z1_Y, atan2_z1_Y, f0
            nop.i 999
 }
 { .mfi
            ldfe         atan2_P14  = [EXP_AD_P2],16
-//(atan2_sT) fma.s1       atan2_z         = atan2_z1_Y, atan2_B1Y, f0
-(p6) fma.s1       atan2_z         = atan2_z1_Y, atan2_B1Y, f0
+(p6)       fma.s1       atan2_B1sq_Y = atan2_B1Y, atan2_B1Y, f0
            nop.i 999
 ;;
 }
 
-
 { .mfi
-           ldfe         atan2_P15       = [EXP_AD_P1],16
-//(atan2_sF) fma.s1       atan2_B1sq = atan2_B1X, atan2_B1X, f0
-(p7) fma.s1       atan2_B1sq = atan2_B1X, atan2_B1X, f0
+           ldfe         atan2_P3        = [EXP_AD_P1],16
+(p6)       fma.s1       atan2_E         = atan2_z2_Y, atan2_B1Y, atan2_Y
            nop.i 999
 }
 { .mfi
-           ldfe         atan2_P0        = [EXP_AD_P2],16
-//(atan2_sT) fma.s1       atan2_B1sq = atan2_B1Y, atan2_B1Y, f0
-(p6) fma.s1       atan2_B1sq = atan2_B1Y, atan2_B1Y, f0
+           ldfe         atan2_P13  = [EXP_AD_P2],16
+(p7)       fma.s1       atan2_E         = atan2_z2_X, atan2_B1X, atan2_X
            nop.i 999
 ;;
 }
 
 
-// p12 ==> X NAN, quiet and return
 { .mfi
-           ldfe         atan2_P1        = [EXP_AD_P1],16
-           fmerge.s     atan2_Umax      = f0,atan2_Umax
+           ldfe         atan2_P2        = [EXP_AD_P1],16
+(p6)       fma.s1       atan2_z         = atan2_z1_Y, atan2_B1Y, f0
            nop.i 999
 }
-{ .mfb
-           ldfe         atan2_P2        = [EXP_AD_P2],16
-(p12)      fma.d        f8 = f9,f8,f0
-(p12)      br.ret.spnt b0
+{ .mfi
+           ldfe         atan2_P12  = [EXP_AD_P2],16
+(p7)       fma.s1       atan2_z         = atan2_z1_X, atan2_B1X, f0
+           nop.i 999
 ;;
 }
 
 
-// p10 ==> x  inf     y ?
-// p11 ==> x !inf     y ?
 { .mfi
-           ldfe         atan2_P3        = [EXP_AD_P1],16
-           fmerge.s     atan2_Vmin      = f0,atan2_Vmin
+           ldfe         atan2_P1        = [EXP_AD_P1],16
+           fcmp.eq.s0  p14,p15=atan2_X,atan2_Y  // Dummy for denorm and invalid
            nop.i 999
 }
-{ .mfi
-           ldfe         atan2_Pi_by_2   = [EXP_AD_P2],16
-           fclass.m.unc p10,p11 = f9, 0x23
-           nop.i 999
+{ .mlx
+           ldfe         atan2_P22       = [EXP_AD_P2],16
+           movl         rsig_near_one = 0x8000000000000001 // signif near 1.0
 ;;
 }
 
 
+// p12 ==> x  inf     y inf
+// p13 ==> x  inf     y !inf
 { .mmf
-           ldfe         atan2_P22       = [EXP_AD_P1],16
-           ldfe         atan2_pi        = [EXP_AD_P2],16
-           nop.f 999
+           ldfe         atan2_P0        = [EXP_AD_P1],16
+           ldfe         atan2_pi_by_2   = [EXP_AD_P2],16
+(p10)      fclass.m.unc p12,p13 = atan2_Y, 0x23  // x inf, test if y inf
 ;;
 }
 
 { .mfi
-           nop.m 999 
-           fcmp.eq.s0  p12,p13=f9,f8   // Dummy to catch denormal and invalid
+           ldfe         atan2_pi        = [EXP_AD_P1],16
+(p6)       fma.s1       atan2_w         = atan2_wp_Y, atan2_B1sq_Y,f0
            nop.i 999
-;;
 }
-
-
 { .mfi
-           ldfe         atan2_pi_by_4       = [EXP_AD_P1],16
-//(atan2_sT) fmerge.ns    atan2_sgnXY     = atan2_sgnXY, atan2_sgnXY
-(p6) fmerge.ns    atan2_sgnXY     = atan2_sgnXY, atan2_sgnXY
+           ldfe         atan2_pi_by_4       = [EXP_AD_P2],16
+(p7)       fma.s1       atan2_w         = atan2_wp_X, atan2_B1sq_X,f0
            nop.i 999
+;;
 }
+
 { .mfi
            ldfe         atan2_3pi_by_4       = [EXP_AD_P2],16
-           fma.s1       atan2_w         = atan2_wp, atan2_B1sq,f0
+(p11)      fclass.m.unc p9,p0 = atan2_Y, 0x23  // x not inf, test if y inf
            nop.i 999
 ;;
 }
 
-// p12 ==> x  inf     y inf
-// p13 ==> x  inf     y !inf
+{ .mfi
+           setf.sig      atan2_sig_near_one = rsig_near_one
+(p12)      fcmp.gt.unc.s1 p10,p11 = atan2_X,f0 // x inf, y inf, test if x +inf
+           nop.i 999
+}
 { .mfi
            nop.m 999
-           fmerge.s     atan2_z         = f0, atan2_z
+(p6)       fnma.s1       atan2_gV        = atan2_Y, atan2_z, atan2_X
            nop.i 999
 ;;
 }
 
 { .mfi
-           nop.m 99
-(p10)      fclass.m.unc p12,p13 = f8, 0x23
+           nop.m 999
+           frcpa.s1     atan2_F,p0     = f1, atan2_E
            nop.i 999
 }
 { .mfi
-           nop.m 99
-(p11)      fclass.m.unc p14,p15 = f8, 0x23
+           nop.m 999
+(p7)       fnma.s1       atan2_gV        = atan2_X, atan2_z, atan2_Y
            nop.i 999
 ;;
 }
 
+// p13 ==> x  inf     y !inf
 { .mfi
            nop.m 999
-(p12)      fcmp.eq.unc.s1 p10,p11       = atan2_sgnX,f1
-           nop.i 99
-;;
+(p13)      fcmp.gt.unc.s1 p14,p15 = atan2_X,f0 // x inf, y !inf, test if x +inf
+           nop.i 999
 }
-
-
 { .mfb
-           mov atan2_GR_sml_exp = 0x1  // Small exponent for making small norm
-(p14)      fma.d       f8 = atan2_sgnY, atan2_Pi_by_2, f0
-(p14)      br.ret.spnt b0
+           nop.m 999
+(p9)       fma.d.s0  f8 = atan2_sgnY, atan2_pi_by_2, f0  // +-pi/2 if x !inf, y inf
+(p9)       br.ret.spnt b0      // exit if x not inf, y inf, result is +-pi/2
 ;;
 }
 
-// Make a very small normal in case need to force inexact and underflow
 { .mfi
-           setf.exp atan2_sml_norm = atan2_GR_sml_exp
+           nop.m 999
            fma.s1       atan2_V13       = atan2_w, atan2_P11, atan2_P10
            nop.i 999
 }
@@ -626,58 +593,58 @@ __ieee754_atan2:
 ;;
 }
 
-
 { .mfi
            nop.m 999
-           fma.s1       atan2_E         = atan2_Vmin, atan2_z, atan2_Umax
+           fma.s1       atan2_V11       = atan2_w, atan2_P9, atan2_P8
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fnma.s1      atan2_gamma     = atan2_Umax, atan2_z, f1
+           fma.s1       atan2_V12       = atan2_w, atan2_w, f0
            nop.i 999
 ;;
 }
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_V11       = atan2_w, atan2_P9, atan2_P8
+           fma.s1       atan2_V8        = atan2_w, atan2_P7 , atan2_P6
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_V12       = atan2_w, atan2_w, f0
+           fma.s1       atan2_W8        = atan2_w, atan2_P19, atan2_P18
            nop.i 999
 ;;
 }
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_V7        = atan2_w, atan2_P5 , atan2_P4 
+           fnma.s1      atan2_alpha     = atan2_E, atan2_F, f1
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_V8        = atan2_w, atan2_P7 , atan2_P6 
+           fnma.s1      atan2_alpha_1   = atan2_E, atan2_F, atan2_two
            nop.i 999
 ;;
 }
 
+
 { .mfi
            nop.m 999
-           fma.s1       atan2_W7        = atan2_w, atan2_P17, atan2_P16 
+           fma.s1       atan2_V7        = atan2_w, atan2_P5 , atan2_P4
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_W8        = atan2_w, atan2_P19, atan2_P18
+           fma.s1       atan2_W7        = atan2_w, atan2_P17, atan2_P16
            nop.i 999
 ;;
 }
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_W3        = atan2_w, atan2_P13, atan2_P12 
+           fma.s1       atan2_V4        = atan2_w, atan2_P3 , atan2_P2
            nop.i 999
 }
 { .mfi
@@ -689,55 +656,55 @@ __ieee754_atan2:
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_V3        = atan2_w, atan2_P1 , atan2_P0 
+           fma.s1       atan2_V3        = atan2_w, atan2_P1 , atan2_P0
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_V4        = atan2_w, atan2_P3 , atan2_P2
+           fma.s1       atan2_W3        = atan2_w, atan2_P13, atan2_P12
            nop.i 999
 ;;
 }
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_zcub      = atan2_z, atan2_w, f0
+           fma.s1       atan2_V10       = atan2_V12, atan2_V13, atan2_V11
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fnma.s1       atan2_gV        = atan2_Umax, atan2_z, atan2_Vmin 
+           fma.s1       atan2_gVF       = atan2_gV, atan2_F, f0
            nop.i 999
 ;;
 }
 
 { .mfi
            nop.m 999
-           frcpa.s1     atan2_F,p15     = f1, atan2_E
+           fma.s1       atan2_alpha_sq  = atan2_alpha, atan2_alpha, f0
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_V10       = atan2_V12, atan2_V13, atan2_V11
+           fma.s1       atan2_Cp        = atan2_alpha, atan2_alpha_1, f1
            nop.i 999
 ;;
 }
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_V6        = atan2_V12, atan2_V8 , atan2_V7 
+           fma.s1       atan2_V9        = atan2_V12, atan2_V12, f0
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_V9        = atan2_V12, atan2_V12, f0
+           fma.s1       atan2_W10       = atan2_V12, atan2_P22 , atan2_W11
            nop.i 999
 ;;
 }
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_W10       = atan2_V12, atan2_P22 , atan2_W11
+           fma.s1       atan2_V6        = atan2_V12, atan2_V8 , atan2_V7
            nop.i 999
 }
 { .mfi
@@ -749,65 +716,47 @@ __ieee754_atan2:
 
 { .mfi
            nop.m 999
-           fma.s1       atan2_W2        = atan2_V12, atan2_W4  , atan2_W3
+           fma.s1       atan2_V2        = atan2_V12, atan2_V4 , atan2_V3
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_V2        = atan2_V12, atan2_V4 , atan2_V3
+           fma.s1       atan2_W2        = atan2_V12, atan2_W4  , atan2_W3
            nop.i 999
 ;;
 }
 
-
-// Both X and Y are INF
-// p10 ==> X +
-// p11 ==> X -
-.pred.rel "mutex",p10,p11
-{ .mfb
-           nop.m 999
-(p10)      fma.d       f8              = atan2_sgnY, atan2_pi_by_4, f0
-(p10)      br.ret.spnt b0
-}
-{ .mfb
-           nop.m 999
-(p11)      fma.d       f8              = atan2_sgnY, atan2_3pi_by_4, f0
-(p11)      br.ret.spnt b0
-;;
-}
-
-
-.pred.rel "mutex",p8,p9,p6
+// p8 ==> y   0     x?
+// p9 ==> y  !0     x?
 { .mfi
            nop.m 999
-           fnma.s1      atan2_alpha     = atan2_E, atan2_F, f1
+           fclass.m p8,p9 = atan2_Y, 0x07  // Test for y=0
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fnma.s1      atan2_alpha_1   = atan2_E, atan2_F, atan2_two
+           fma.s1       atan2_zcub      = atan2_z, atan2_w, f0
            nop.i 999
 ;;
 }
 
-
 { .mfi
            nop.m 999
-//(atan2_sT) fmerge.s     atan2_P         = atan2_Y, atan2_Pi_by_2
-(p6) fmerge.s     atan2_P         = atan2_Y, atan2_Pi_by_2
+           fma.s1       atan2_alpha_cub = atan2_alpha, atan2_alpha_sq, f0
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_gVF       = atan2_gV, atan2_F, f0
+           fma.s1       atan2_C         = atan2_gVF, atan2_Cp, f0
            nop.i 999
 ;;
 }
 
-
+// p12 ==>  y0     x0
+// p13 ==>  y0     x!0
 { .mfi
            nop.m 999
-           fma.s1       atan2_V5        = atan2_V9, atan2_V10, atan2_V6
+(p8)       fclass.m.unc p12,p13 = atan2_X, 0x07  // y=0, test if x is 0
            nop.i 999
 }
 { .mfi
@@ -817,11 +766,9 @@ __ieee754_atan2:
 ;;
 }
 
-
-
 { .mfi
            nop.m 999
-(p8)       fmerge.s     atan2_P         = atan2_sgnY, f0
+           fma.s1       atan2_V5        = atan2_V9, atan2_V10, atan2_V6
            nop.i 999
 }
 { .mfi
@@ -832,249 +779,215 @@ __ieee754_atan2:
 }
 
 
-
-
+// p9 ==>  y!0    x0
 { .mfi
            nop.m 999
-(p9)       fmerge.s     atan2_P         = atan2_sgnY, atan2_pi
+(p9)       fclass.m.unc p9,p0 = atan2_X, 0x07  // y not 0, test if x is 0
            nop.i 999
+}
+// p10 ==> X +INF, Y +-INF
+{ .mfb
+           nop.m 999
+(p10)      fma.d.s0       f8 = atan2_sgnY, atan2_pi_by_4, f0 // x=+inf, y=inf
+(p10)      br.ret.spnt b0          // Exit for x=+inf, y=inf, result is +-pi/4
 ;;
 }
 
-
+.pred.rel "mutex",p11,p14
 { .mfi
            nop.m 999
-           fma.s1       atan2_alpha_sq  = atan2_alpha, atan2_alpha, f0  
+(p14)      fmerge.s    f8 = atan2_sgnY, f0 // x=+inf, y !inf, result +-0
            nop.i 999
 }
-{ .mfi
+// p11 ==> X -INF, Y +-INF
+{ .mfb
            nop.m 999
-           fma.s1       atan2_Cp        = atan2_alpha, atan2_alpha_1, f1  
-           nop.i 999
+(p11)      fma.d.s0       f8 = atan2_sgnY, atan2_3pi_by_4, f0 // x=-inf, y=inf
+(p11)      br.ret.spnt b0          // Exit for x=-inf, y=inf, result is +-3pi/4
 ;;
 }
 
-
 { .mfi
            nop.m 999
-           fma.s1       atan2_V1        = atan2_V9, atan2_V5, atan2_V2
+(p13)      fcmp.gt.unc.s1 p10,p11 = atan2_X,f0 // x not 0, y=0, test if x>0
            nop.i 999
 }
-{ .mfi
+{ .mfb
            nop.m 999
-           fma.s1       atan2_W12       = atan2_V9, atan2_W12, f0
-           nop.i 999
+           fma.s1       atan2_d         = atan2_alpha_cub, atan2_C, atan2_C
+(p14)      br.ret.spnt b0         // Exit if x=+inf, y !inf, result +-0
 ;;
 }
 
-
-// p13 ==> x  inf     y !inf
 { .mfi
            nop.m 999
-           fma.s1       atan2_W1        = atan2_V9, atan2_W5, atan2_W2
+           fma.s1       atan2_W12       = atan2_V9, atan2_W12, f0
            nop.i 999
 }
-{ .mfi
+{ .mfb
            nop.m 999
-(p13)      fcmp.eq.unc.s1 p10,p11       = atan2_sgnX,f1
-           nop.i 999
+(p9)       fma.d.s0       f8 = atan2_sgnY, atan2_pi_by_2, f0 // x=0, y not 0
+(p9)       br.ret.spnt b0      // Exit if x=0 and y not 0, result is +-pi/2
 ;;
 }
 
-
 { .mfi
            nop.m 999
-           fma.s1       atan2_alpha_cub = atan2_alpha, atan2_alpha_sq, f0
+           fma.s1       atan2_V1        = atan2_V9, atan2_V5, atan2_V2
            nop.i 999
 }
-{ .mfi
+{ .mfb
            nop.m 999
-           fma.s1       atan2_C         = atan2_gVF, atan2_Cp, f0
-           nop.i 999
+           fma.s1       atan2_W1        = atan2_V9, atan2_W5, atan2_W2
+(p12)      br.spnt ATAN2_ERROR            // Branch if x=0 and y=0
 ;;
 }
 
-.pred.rel "mutex",p10,p11 
-// x inf y !inf
-{ .mfb
+{ .mfi
            nop.m 999
-(p10)      fmerge.s     f8              = atan2_sgnY, f0
-(p10)      br.ret.spnt b0
+(p10)      fmerge.s     f8              = atan2_sgnY, f0  // +-0 if x>0, y=0
+           nop.i 999
 }
 { .mfb
            nop.m 999
-(p11)      fma.d        f8              = atan2_sgnY, atan2_pi, f0
-(p11)      br.ret.spnt b0
+(p11)      fma.d.s0        f8 = atan2_sgnY, atan2_pi, f0 // +-pi if x<0, y=0
+(p13)      br.ret.spnt b0      // Exit if x!0 and y=0
 ;;
 }
 
 
-
-// p10 ==> y   0     x?
-// p11 ==> y  !0     x?
 { .mfi
            nop.m 999
-           fclass.m.unc p10,p11 = f8, 0x07
+           fma.s1       atan2_pd        = atan2_P0, atan2_d, f0
            nop.i 999
-;;
 }
-
 { .mfi
            nop.m 999
-(p8)       fmerge.s     atan2_sml_norm  = atan2_sgnY, atan2_sml_norm
+           fma.s1       atan2_dsq       = atan2_d, atan2_d, f0
            nop.i 999
 ;;
 }
 
+
 { .mfi
            nop.m 999
-           fma.s1       atan2_Pp        = atan2_W12, atan2_W1, atan2_V1
+           fmerge.se    atan2_near_one = f1, atan2_sig_near_one // Const ~1.0
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_d         = atan2_alpha_cub, atan2_C, atan2_C
+           fma.s1       atan2_Pp        = atan2_W12, atan2_W1, atan2_V1
            nop.i 999
 ;;
 }
 
-// p12 ==>  y0     x0
-// p13 ==>  y0     x!0
-// p14 ==>  y!0    x0
-// p15 ==>  y!0    x!0
-{ .mfi
-           nop.m 999
-(p10)      fclass.m.unc p12,p13 = f9, 0x07 
-           nop.i 999
-}
+// p8 true if no swap and X positive
+// p9 true if no swap and X negative
+// both are false is swap is true
 { .mfi
            nop.m 999
-(p11)      fclass.m.unc p14,p15 = f9, 0x07 
+(p7)       fcmp.ge.unc.s1 p8,p9    = atan2_X,f0
            nop.i 999
-;;
 }
-
-
-
-
 { .mfb
            nop.m 999
-(p13)      fcmp.eq.unc.s1 p10,p11       = atan2_sgnX,f1
-(p12)      br.spnt ATAN2_ERROR
+(p15)      fma.d.s0        f8              = atan2_sgnY, atan2_pi, f0
+(p15)      br.ret.spnt b0         // Exit if x=-inf, y !inf, result +-pi
 ;;
 }
 
-
-
 { .mfi
            nop.m 999
-           fma.s1       atan2_pd        = atan2_P0, atan2_d, f0
+           fma.s1       atan2_sgn_pi_by_2 = atan2_pi_by_2, atan2_sgnY, f0
            nop.i 999
 }
 { .mfi
            nop.m 999
-           fma.s1       atan2_dsq       = atan2_d, atan2_d, f0
+           fma.s1       atan2_A_lo      = atan2_pd, atan2_dsq, atan2_d
            nop.i 999
 ;;
 }
 
+
 { .mfi
            nop.m 999
-           fma.s1       atan2_A_hi      = atan2_zcub, atan2_Pp, atan2_z
+           fma.s1       atan2_sgn_pi = atan2_pi, atan2_sgnY, f0
            nop.i 999
 }
-{ .mfb
+{ .mfi
            nop.m 999
-(p14)      fma.d       f8 = atan2_sgnY, atan2_Pi_by_2, f0
-(p14)      br.ret.spnt b0                
+           fma.s1       atan2_A_hi      = atan2_zcub, atan2_Pp, atan2_z
+           nop.i 999
 ;;
 }
 
 
-
-{ .mfb
-           nop.m 999
-(p10)      fmerge.s     f8              = atan2_sgnY, f0
-(p10)      br.ret.spnt b0
-}
-{ .mfb
+// For |Y| <= |X| and X > 0, force inexact in case A_lo is zero
+{ .mfi
            nop.m 999
-(p11)      fma.d        f8              = atan2_sgnY, atan2_pi, f0
-(p11)      br.ret.spnt b0
+(p8)       fmpy.s0      atan2_tmp       = atan2_P22, atan2_P22
+           nop.i 999
 ;;
 }
 
-
-
 { .mfi
            nop.m 999
-           fma.s1       atan2_A_lo      = atan2_pd, atan2_dsq, atan2_d
+           fma.s1       atan2_A         = atan2_A_hi, f1, atan2_A_lo
            nop.i 999
-;;
 }
-
-
+// For |Y| <= |X| and X > 0, result is A_hi + A_lo
 { .mfi
            nop.m 999
-           fma.s1       atan2_A         = atan2_A_hi, f1, atan2_A_lo
+(p8)       fma.d.s0       f8         = atan2_A_hi, f1, atan2_A_lo
            nop.i 999
 ;;
 }
 
-// Force inexact and possibly underflow if very small results
+.pred.rel "mutex",p6,p9
+// We perturb A by multiplying by 1.0+1ulp as we produce the result
+// in order to get symmetrically rounded results in directed rounding modes.
+// If we don't do this, there are a few cases where the trailing 11 bits of
+// the significand of the result, before converting to double, are zero.  These
+// cases do not round symmetrically in round to +infinity or round to -infinity.
+// The perturbation also insures that the inexact flag is set.
+// For |Y| > |X|, result is  +- pi/2 - (A_hi + A_lo)
 { .mfi
            nop.m 999
-(p8)       fma.d        atan2_FR_tmp    = atan2_sgnXY, atan2_A, atan2_sml_norm
+(p6)       fnma.d.s0      f8        = atan2_A, atan2_near_one, atan2_sgn_pi_by_2
            nop.i 999
 }
+// For |Y| <= |X|, and X < 0, result is  +- pi + (A_hi + A_lo)
 { .mfb
            nop.m 999
-           fma.d        f8              = atan2_sgnXY, atan2_A, atan2_P
-           br.ret.sptk  b0     
+(p9)       fma.d.s0        f8        = atan2_A, atan2_near_one, atan2_sgn_pi
+           br.ret.sptk  b0
 ;;
 }
 
 ATAN2_ERROR:
-
+// Here if x=0 and y=0
 { .mfi
           nop.m 999
-          fcmp.eq.unc.s1 p10,p11       = atan2_sgnX,f1
+          fclass.m p10,p11       = atan2_X,0x05  // Test if x=+0
           nop.i 999
 }
 ;;
 
 { .mfi
-          mov        atan2_GR_tag     = 37 
-(p10)     fmerge.s     f10             = atan2_sgnY, f0
-          nop.i 999 
+          mov        atan2_GR_tag     = 37
+(p10)     fmerge.s     f10             = atan2_sgnY, f0 // x=+0, y=0
+          nop.i 999
 }
 { .mfi
           nop.m 999
-(p11)     fma.d        f10            = atan2_sgnY, atan2_pi, f0
+(p11)     fma.d.s0        f10            = atan2_sgnY, atan2_pi, f0 // x=-0, y=0
           nop.i 999
 ;;
 }
-.endp atan2#
-ASM_SIZE_DIRECTIVE(atan2#)
-
+GLOBAL_IEEE754_END(atan2)
 
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
 
-
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 // (1)
 { .mfi
@@ -1102,19 +1015,19 @@ __libm_error_region:
 .body
 // (3)
 { .mib
-        stfd [GR_Parameter_X] = f9                   // STORE Parameter 1 on stack
+        stfd [GR_Parameter_X] = f9            // STORE Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
-        nop.b 0                                 
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = f10                  // STORE Parameter 3 on stack
+        stfd [GR_Parameter_Y] = f10           // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#        // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 
 // (4)
@@ -1130,8 +1043,7 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_atan2f.S b/sysdeps/ia64/fpu/e_atan2f.S
index 03a4fed82f..67618f0437 100644
--- a/sysdeps/ia64/fpu/e_atan2f.S
+++ b/sysdeps/ia64/fpu/e_atan2f.S
@@ -1,10 +1,10 @@
 .file "atan2f.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 6/1/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,18 +35,21 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 
 // History
 //==============================================================
-// 6/01/00  Initial version
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 06/01/00 Initial version
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 8/17/00  Changed predicate register macro-usage to direct predicate
+// 08/17/00 Changed predicate register macro-usage to direct predicate
 //          names due to an assembler bug.
-// 1/05/01  Fixed flag settings for denormal input.
-// 1/19/01  Added documentation
-// 1/30/01  Improved speed
+// 01/05/01 Fixed flag settings for denormal input.
+// 01/19/01 Added documentation
+// 01/30/01 Improved speed
+// 02/06/02 Corrected .section statement
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
 
 // Description
 //=========================================
@@ -226,7 +229,6 @@
 // atan2f(+-0/+-0) sets single error tag to 38
 // These are domain errors.
 
-#include "libm_support.h"
 
 //
 // Assembly macros
@@ -324,22 +326,20 @@ atan2f_poly_atan_U     = f88
 //atan2f_Pred_Xneg     = p9 //  x  <   0
 
 
-.data
+RODATA
 
 .align 16
 
-atan2f_coef_table1:
-ASM_TYPE_DIRECTIVE(atan2f_coef_table1,@object)
+LOCAL_OBJECT_START(atan2f_coef_table1)
 data8 0xBFD5555512191621 // p1
 data8 0x3F522E5D33BC9BAA // p10
 data8 0xBFA6E10BA401393F // p7
 data8 0x3FB142A73D7C54E3 // p6
 data8 0xBFC2473C5145EE38 // p3
 data8 0x3FC9997E7AFBFF4E // p2
-ASM_SIZE_DIRECTIVE(atan2f_coef_table1)
+LOCAL_OBJECT_END(atan2f_coef_table1)
 
-atan2f_coef_table2:
-ASM_TYPE_DIRECTIVE(atan2f_coef_table2,@object)
+LOCAL_OBJECT_START(atan2f_coef_table2)
 data8 0xBF7DEAADAA336451 // p9
 data8 0x3F97105B4160F86B // p8
 data8 0xBFB68EED6A8CFA32 // p5
@@ -348,29 +348,12 @@ data8 0x3ff921fb54442d18 // pi/2
 data8 0x400921fb54442d18 // pi
 data8 0x3fe921fb54442d18 // pi/4
 data8 0x4002d97c7f3321d2 // 3pi/4
-ASM_SIZE_DIRECTIVE(atan2f_coef_table2)
-
+LOCAL_OBJECT_END(atan2f_coef_table2)
 
 
-.global atan2f
-#ifdef _LIBC
-.global __atan2f
-.global __ieee754_atan2f
-#endif
 
-.text
-.align 32
-
-atan2f:
-.proc  atan2f
-#ifdef _LIBC
-.proc  __atan2f
-__atan2f:
-.proc  __ieee754_atan2f
-__ieee754_atan2f:
-#endif
-
- 
+.section .text
+GLOBAL_IEEE754_ENTRY(atan2f)
  
 {     .mfi 
      alloc      r32           = ar.pfs,1,5,4,0
@@ -724,7 +707,7 @@ ATAN2F_XY_INF_NAN_ZERO:
 }
 { .mfb
       nop.m 999
-(p10) fma.s f8  = f9,f8,f0          // Result quietized y if y is nan
+(p10) fma.s.s0 f8  = f9,f8,f0          // Result quietized y if y is nan
 (p10) br.ret.spnt b0                // Exit if y is nan
 }
 ;;
@@ -737,7 +720,7 @@ ATAN2F_XY_INF_NAN_ZERO:
 }
 { .mfb
       nop.m 999
-(p12) fnorm.s f8 = f9               // Result quietized x if x is nan, y not nan
+(p12) fnorm.s.s0 f8 = f9               // Result quietized x if x is nan, y not nan
 (p12) br.ret.spnt b0                // Exit if x is nan, y not nan
 }
 ;;
@@ -757,7 +740,7 @@ ATAN2F_XY_INF_NAN_ZERO:
 }
 { .mfb
       nop.m 999
-(p7)  fma.s f8 = atan2f_sgn_Y, atan2f_const_piby4,f0 // Result +-pi/4
+(p7)  fma.s.s0 f8 = atan2f_sgn_Y, atan2f_const_piby4,f0 // Result +-pi/4
 (p7)  br.ret.spnt b0            // Exit if x +inf and y inf
 }
 ;;
@@ -790,19 +773,19 @@ ATAN2F_XY_INF_NAN_ZERO:
 }
 { .mfb
       nop.m 999
-(p13) fma.s   f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // Result +-pi/2
+(p13) fma.s.s0   f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // Result +-pi/2
 (p13) br.ret.spnt b0           // Exit if x not -inf and y inf
 }
 ;;
 
 { .mfi
       nop.m 999
-(p14) fma.s   f8 = atan2f_sgn_Y, atan2f_const_3piby4,f0 // Result +-3pi/4
+(p14) fma.s.s0   f8 = atan2f_sgn_Y, atan2f_const_3piby4,f0 // Result +-3pi/4
       nop.i 999
 }
 { .mfb
       nop.m 999
-(p15) fma.s   f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // Result +-pi
+(p15) fma.s.s0   f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // Result +-pi
 (p11) br.ret.spnt b0           // Exit if x -inf
 }
 ;;
@@ -829,31 +812,29 @@ ATAN2F_XY_INF_NAN_ZERO:
 }
 { .mfb
       nop.m 999
-(p9)  fma.s  f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // x < 0, y 0, result +-pi
+(p9)  fma.s.s0  f8 = atan2f_sgn_Y, atan2f_const_pi,f0 // x < 0, y 0, result +-pi
 (p10) br.cond.spnt   __libm_error_region // Branch if x zero and y zero
 }
 ;;
 
 { .mfb
       nop.m 999
-(p11) fma.s  f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // x zero, y not zero
+(p11) fma.s.s0  f8 = atan2f_sgn_Y, atan2f_const_piby2,f0 // x zero, y not zero
       br.ret.sptk b0         // Final special case exit
 }
 ;;
 
 
-.endp atan2f
-ASM_SIZE_DIRECTIVE(atan2f)
+GLOBAL_IEEE754_END(atan2f)
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
          mov            GR_Parameter_TAG      = 38
          fclass.m       p10,p11               = f9,0x5	// @zero | @pos
 ;;
 (p10)    fmerge.s       f10                   = f8, f0
-(p11)    fma.s          f10                   = atan2f_sgn_Y, atan2f_const_pi,f0
+(p11)    fma.s.s0          f10                   = atan2f_sgn_Y, atan2f_const_pi,f0
 ;;
 
 { .mfi
@@ -913,8 +894,7 @@ __libm_error_region:
 }
 ;;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_atanh.S b/sysdeps/ia64/fpu/e_atanh.S
new file mode 100644
index 0000000000..4ae5ee6926
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_atanh.S
@@ -0,0 +1,1071 @@
+.file "atanh.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// ==============================================================
+// History
+// ==============================================================
+// 05/03/01  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/06/03  Reordered header: .section, .global, .proc, .align
+// 05/26/03  Improved performance, fixed to handle unorms
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+// ==============================================================
+// double atanh(double)
+//
+// Overview of operation
+// ==============================================================
+//
+// There are 7 paths:
+// 1. x = +/-0.0
+//    Return atanh(x) = +/-0.0
+//
+// 2. 0.0 < |x| < 1/4
+//    Return atanh(x) = Po2l(x),
+//    where Po2l(x) = (((((((((C9*x^2 + C8)*x^2 + C7)*x^2 + C6)*x^2 +
+//          C5)*x^2 + C4)*x^2 + C3)*x^2 + C2)*x^2 + C1)* x^2 + C0)*x^3 + x
+// 3. 1/4 <= |x| < 1
+//    Return atanh(x) = sign(x) * log((1 + |x|)/(1 - |x|))
+//    To compute (1 + |x|)/(1 - |x|) modified Newton Raphson method is used
+//    (3 iterations)
+//    Algorithm description for log function see below.
+//
+// 4. |x| = 1
+//    Return atanh(x) = sign(x) * +INF
+//
+// 5. 1 < |x| <= +INF
+//    Return atanh(x) = QNaN
+//
+// 6. x = [S,Q]NaN
+//    Return atanh(x) = QNaN
+//
+// 7. x = denormal
+//    Return atanh(x) = x
+//
+//==============================================================
+// Algorithm Description for log(x) function
+// Below we are using the fact that inequality x - 1.0 > 2^(-6) is always true
+// for this atanh implementation
+//
+// Consider  x = 2^N 1.f1 f2 f3 f4...f63
+// Log(x) = log(x * frcpa(x) / frcpa(x))
+//        = log(x * frcpa(x)) + log(1/frcpa(x))
+//        = log(x * frcpa(x)) - log(frcpa(x))
+//
+// frcpa(x)       = 2^-N * frcpa(1.f1 f2 ... f63)
+//
+// -log(frcpa(x)) = -log(C)
+//                = -log(2^-N) - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = N*log2 - log(frcpa(1.f1 f2 ... f63))
+//
+//
+// Log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
+//
+// Log(x) = N*log2 + log(1./frcpa(1.f1 f2 ... f63)) + log(x * frcpa(x))
+// Log(x) = N*log2 + T                              + log(frcpa(x) x)
+//
+// Log(x) = N*log2 + T                              + log(C * x)
+//
+// C * x = 1 + r
+//
+// Log(x) = N*log2 + T + log(1 + r)
+// Log(x) = N*log2 + T + Series(r - r^2/2 + r^3/3 - r^4/4 + ...)
+//
+// 1.f1 f2 ... f8 has 256 entries.
+// They are 1 + k/2^8, k = 0 ... 255
+// These 256 values are the table entries.
+//
+// Implementation
+//==============================================================
+// C = frcpa(x)
+// r = C * x - 1
+//
+// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4 + P4*r^5 + P5*r^6
+//
+// x = f * 2*N where f is 1.f_1f_2f_3...f_63
+// Nfloat = float(n)  where n is the true unbiased exponent
+// pre-index = f_1f_2....f_8
+// index = pre_index * 16
+// get the dxt table entry at index + offset = T
+//
+// result = (T + Nfloat * log(2)) + rseries
+//
+// The T table is calculated as follows
+// Form x_k = 1 + k/2^8 where k goes from 0... 255
+//      y_k = frcpa(x_k)
+//      log(1/y_k)  in quad and round to double-extended
+//
+//
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f32 -> f77
+
+// General registers used:
+// r14 -> r27, r33 -> r39
+
+// Predicate registers used:
+// p6 -> p14
+
+// p10, p11      to indicate is argument positive or negative
+// p12           to filter out case when x = [Q,S]NaN or +/-0
+// p13           to filter out case when x = denormal
+// p6, p7        to filter out case when |x| >= 1
+// p8            to filter out case when |x| < 1/4
+
+// Assembly macros
+//==============================================================
+Data2Ptr              = r14
+Data3Ptr              = r15
+RcpTablePtr           = r16
+rExpbMask             = r17
+rBias                 = r18
+rNearZeroBound        = r19
+rArgSExpb             = r20
+rArgExpb              = r21
+rSExpb                = r22
+rExpb                 = r23
+rSig                  = r24
+rN                    = r25
+rInd                  = r26
+DataPtr               = r27
+
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_SAVE_PFS           = r35
+
+GR_Parameter_X        = r36
+GR_Parameter_Y        = r37
+GR_Parameter_RESULT   = r38
+atanh_GR_tag          = r39
+
+//==============================================================
+fAbsX                 = f32
+fOneMx                = f33
+fOnePx                = f34
+fY                    = f35
+fR                    = f36
+fR2                   = f37
+fR3                   = f38
+fRcp                  = f39
+fY4Rcp                = f40
+fRcp0                 = f41
+fRcp0n                = f42
+fRcp1                 = f43
+fRcp2                 = f44
+fRcp3                 = f45
+fN4Cvt                = f46
+fN                    = f47
+fY2                   = f48
+fLog2                 = f49
+fLogT                 = f50
+fLogT_N               = f51
+fX2                   = f52
+fX3                   = f53
+fX4                   = f54
+fX8                   = f55
+fP0                   = f56
+fP5                   = f57
+fP4                   = f58
+fP3                   = f59
+fP2                   = f60
+fP1                   = f61
+fNormX                = f62
+fC9                   = f63
+fC8                   = f64
+fC7                   = f65
+fC6                   = f66
+fC5                   = f67
+fC4                   = f68
+fC3                   = f69
+fC2                   = f70
+fC1                   = f71
+fC0                   = f72
+fP98                  = f73
+fP76                  = f74
+fP54                  = f75
+fP32                  = f76
+fP10                  = f77
+
+// Data tables
+//==============================================================
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(atanh_data)
+data8 0xBFC5555DA7212371              //   P5
+data8 0x3FC999A19EEF5826              //   P4
+data8 0xBFCFFFFFFFFEF009              //   P3
+data8 0x3FD555555554ECB2              //   P2
+data8 0xBFE0000000000000              //   P1 = -0.5
+data8 0x0000000000000000              //   pad
+data8 0xb17217f7d1cf79ac , 0x00003ffd //   0.5*log(2)
+data8 0x0000000000000000 , 0x00000000 //   pad to eliminate bank conflicts
+LOCAL_OBJECT_END(atanh_data)
+
+LOCAL_OBJECT_START(atanh_data_2)
+data8 0x8649FB89D3AD51FB , 0x00003FFB //   C9
+data8 0xCC10AABEF160077A , 0x00003FFA //   C8
+data8 0xF1EDB99AC0819CE2 , 0x00003FFA //   C7
+data8 0x8881E53A809AD24D , 0x00003FFB //   C6
+data8 0x9D8A116EF212F271 , 0x00003FFB //   C5
+data8 0xBA2E8A6D1D756453 , 0x00003FFB //   C4
+data8 0xE38E38E7A0945692 , 0x00003FFB //   C3
+data8 0x924924924536891A , 0x00003FFC //   C2
+data8 0xCCCCCCCCCCD08D51 , 0x00003FFC //   C1
+data8 0xAAAAAAAAAAAAAA0C , 0x00003FFD //   C0
+LOCAL_OBJECT_END(atanh_data_2)
+
+
+LOCAL_OBJECT_START(atanh_data_3)
+data8 0x80200aaeac44ef38 , 0x00003ff5 //   log(1/frcpa(1+0/2^-8))/2
+//
+data8 0xc09090a2c35aa070 , 0x00003ff6 //   log(1/frcpa(1+1/2^-8))/2
+data8 0xa0c94fcb41977c75 , 0x00003ff7 //   log(1/frcpa(1+2/2^-8))/2
+data8 0xe18b9c263af83301 , 0x00003ff7 //   log(1/frcpa(1+3/2^-8))/2
+data8 0x8d35c8d6399c30ea , 0x00003ff8 //   log(1/frcpa(1+4/2^-8))/2
+data8 0xadd4d2ecd601cbb8 , 0x00003ff8 //   log(1/frcpa(1+5/2^-8))/2
+//
+data8 0xce95403a192f9f01 , 0x00003ff8 //   log(1/frcpa(1+6/2^-8))/2
+data8 0xeb59392cbcc01096 , 0x00003ff8 //   log(1/frcpa(1+7/2^-8))/2
+data8 0x862c7d0cefd54c5d , 0x00003ff9 //   log(1/frcpa(1+8/2^-8))/2
+data8 0x94aa63c65e70d499 , 0x00003ff9 //   log(1/frcpa(1+9/2^-8))/2
+data8 0xa54a696d4b62b382 , 0x00003ff9 //   log(1/frcpa(1+10/2^-8))/2
+//
+data8 0xb3e4a796a5dac208 , 0x00003ff9 //   log(1/frcpa(1+11/2^-8))/2
+data8 0xc28c45b1878340a9 , 0x00003ff9 //   log(1/frcpa(1+12/2^-8))/2
+data8 0xd35c55f39d7a6235 , 0x00003ff9 //   log(1/frcpa(1+13/2^-8))/2
+data8 0xe220f037b954f1f5 , 0x00003ff9 //   log(1/frcpa(1+14/2^-8))/2
+data8 0xf0f3389b036834f3 , 0x00003ff9 //   log(1/frcpa(1+15/2^-8))/2
+//
+data8 0xffd3488d5c980465 , 0x00003ff9 //   log(1/frcpa(1+16/2^-8))/2
+data8 0x87609ce2ed300490 , 0x00003ffa //   log(1/frcpa(1+17/2^-8))/2
+data8 0x8ede9321e8c85927 , 0x00003ffa //   log(1/frcpa(1+18/2^-8))/2
+data8 0x96639427f2f8e2f4 , 0x00003ffa //   log(1/frcpa(1+19/2^-8))/2
+data8 0x9defad3e8f73217b , 0x00003ffa //   log(1/frcpa(1+20/2^-8))/2
+//
+data8 0xa582ebd50097029c , 0x00003ffa //   log(1/frcpa(1+21/2^-8))/2
+data8 0xac06dbe75ab80fee , 0x00003ffa //   log(1/frcpa(1+22/2^-8))/2
+data8 0xb3a78449b2d3ccca , 0x00003ffa //   log(1/frcpa(1+23/2^-8))/2
+data8 0xbb4f79635ab46bb2 , 0x00003ffa //   log(1/frcpa(1+24/2^-8))/2
+data8 0xc2fec93a83523f3f , 0x00003ffa //   log(1/frcpa(1+25/2^-8))/2
+//
+data8 0xc99af2eaca4c4571 , 0x00003ffa //   log(1/frcpa(1+26/2^-8))/2
+data8 0xd1581106472fa653 , 0x00003ffa //   log(1/frcpa(1+27/2^-8))/2
+data8 0xd8002560d4355f2e , 0x00003ffa //   log(1/frcpa(1+28/2^-8))/2
+data8 0xdfcb43b4fe508632 , 0x00003ffa //   log(1/frcpa(1+29/2^-8))/2
+data8 0xe67f6dff709d4119 , 0x00003ffa //   log(1/frcpa(1+30/2^-8))/2
+//
+data8 0xed393b1c22351280 , 0x00003ffa //   log(1/frcpa(1+31/2^-8))/2
+data8 0xf5192bff087bcc35 , 0x00003ffa //   log(1/frcpa(1+32/2^-8))/2
+data8 0xfbdf4ff6dfef2fa3 , 0x00003ffa //   log(1/frcpa(1+33/2^-8))/2
+data8 0x81559a97f92f9cc7 , 0x00003ffb //   log(1/frcpa(1+34/2^-8))/2
+data8 0x84be72bce90266e8 , 0x00003ffb //   log(1/frcpa(1+35/2^-8))/2
+//
+data8 0x88bc74113f23def2 , 0x00003ffb //   log(1/frcpa(1+36/2^-8))/2
+data8 0x8c2ba3edf6799d11 , 0x00003ffb //   log(1/frcpa(1+37/2^-8))/2
+data8 0x8f9dc92f92ea08b1 , 0x00003ffb //   log(1/frcpa(1+38/2^-8))/2
+data8 0x9312e8f36efab5a7 , 0x00003ffb //   log(1/frcpa(1+39/2^-8))/2
+data8 0x968b08643409ceb6 , 0x00003ffb //   log(1/frcpa(1+40/2^-8))/2
+//
+data8 0x9a062cba08a1708c , 0x00003ffb //   log(1/frcpa(1+41/2^-8))/2
+data8 0x9d845b3abf95485c , 0x00003ffb //   log(1/frcpa(1+42/2^-8))/2
+data8 0xa06fd841bc001bb4 , 0x00003ffb //   log(1/frcpa(1+43/2^-8))/2
+data8 0xa3f3a74652fbe0db , 0x00003ffb //   log(1/frcpa(1+44/2^-8))/2
+data8 0xa77a8fb2336f20f5 , 0x00003ffb //   log(1/frcpa(1+45/2^-8))/2
+//
+data8 0xab0497015d28b0a0 , 0x00003ffb //   log(1/frcpa(1+46/2^-8))/2
+data8 0xae91c2be6ba6a615 , 0x00003ffb //   log(1/frcpa(1+47/2^-8))/2
+data8 0xb189d1b99aebb20b , 0x00003ffb //   log(1/frcpa(1+48/2^-8))/2
+data8 0xb51cced5de9c1b2c , 0x00003ffb //   log(1/frcpa(1+49/2^-8))/2
+data8 0xb819bee9e720d42f , 0x00003ffb //   log(1/frcpa(1+50/2^-8))/2
+//
+data8 0xbbb2a0947b093a5d , 0x00003ffb //   log(1/frcpa(1+51/2^-8))/2
+data8 0xbf4ec1505811684a , 0x00003ffb //   log(1/frcpa(1+52/2^-8))/2
+data8 0xc2535bacfa8975ff , 0x00003ffb //   log(1/frcpa(1+53/2^-8))/2
+data8 0xc55a3eafad187eb8 , 0x00003ffb //   log(1/frcpa(1+54/2^-8))/2
+data8 0xc8ff2484b2c0da74 , 0x00003ffb //   log(1/frcpa(1+55/2^-8))/2
+//
+data8 0xcc0b1a008d53ab76 , 0x00003ffb //   log(1/frcpa(1+56/2^-8))/2
+data8 0xcfb6203844b3209b , 0x00003ffb //   log(1/frcpa(1+57/2^-8))/2
+data8 0xd2c73949a47a19f5 , 0x00003ffb //   log(1/frcpa(1+58/2^-8))/2
+data8 0xd5daae18b49d6695 , 0x00003ffb //   log(1/frcpa(1+59/2^-8))/2
+data8 0xd8f08248cf7e8019 , 0x00003ffb //   log(1/frcpa(1+60/2^-8))/2
+//
+data8 0xdca7749f1b3e540e , 0x00003ffb //   log(1/frcpa(1+61/2^-8))/2
+data8 0xdfc28e033aaaf7c7 , 0x00003ffb //   log(1/frcpa(1+62/2^-8))/2
+data8 0xe2e012a5f91d2f55 , 0x00003ffb //   log(1/frcpa(1+63/2^-8))/2
+data8 0xe600064ed9e292a8 , 0x00003ffb //   log(1/frcpa(1+64/2^-8))/2
+data8 0xe9226cce42b39f60 , 0x00003ffb //   log(1/frcpa(1+65/2^-8))/2
+//
+data8 0xec4749fd97a28360 , 0x00003ffb //   log(1/frcpa(1+66/2^-8))/2
+data8 0xef6ea1bf57780495 , 0x00003ffb //   log(1/frcpa(1+67/2^-8))/2
+data8 0xf29877ff38809091 , 0x00003ffb //   log(1/frcpa(1+68/2^-8))/2
+data8 0xf5c4d0b245cb89be , 0x00003ffb //   log(1/frcpa(1+69/2^-8))/2
+data8 0xf8f3afd6fcdef3aa , 0x00003ffb //   log(1/frcpa(1+70/2^-8))/2
+//
+data8 0xfc2519756be1abc7 , 0x00003ffb //   log(1/frcpa(1+71/2^-8))/2
+data8 0xff59119f503e6832 , 0x00003ffb //   log(1/frcpa(1+72/2^-8))/2
+data8 0x8147ce381ae0e146 , 0x00003ffc //   log(1/frcpa(1+73/2^-8))/2
+data8 0x82e45f06cb1ad0f2 , 0x00003ffc //   log(1/frcpa(1+74/2^-8))/2
+data8 0x842f5c7c573cbaa2 , 0x00003ffc //   log(1/frcpa(1+75/2^-8))/2
+//
+data8 0x85ce471968c8893a , 0x00003ffc //   log(1/frcpa(1+76/2^-8))/2
+data8 0x876e8305bc04066d , 0x00003ffc //   log(1/frcpa(1+77/2^-8))/2
+data8 0x891012678031fbb3 , 0x00003ffc //   log(1/frcpa(1+78/2^-8))/2
+data8 0x8a5f1493d766a05f , 0x00003ffc //   log(1/frcpa(1+79/2^-8))/2
+data8 0x8c030c778c56fa00 , 0x00003ffc //   log(1/frcpa(1+80/2^-8))/2
+//
+data8 0x8da85df17e31d9ae , 0x00003ffc //   log(1/frcpa(1+81/2^-8))/2
+data8 0x8efa663e7921687e , 0x00003ffc //   log(1/frcpa(1+82/2^-8))/2
+data8 0x90a22b6875c6a1f8 , 0x00003ffc //   log(1/frcpa(1+83/2^-8))/2
+data8 0x91f62cc8f5d24837 , 0x00003ffc //   log(1/frcpa(1+84/2^-8))/2
+data8 0x93a06cfc3857d980 , 0x00003ffc //   log(1/frcpa(1+85/2^-8))/2
+//
+data8 0x94f66d5e6fd01ced , 0x00003ffc //   log(1/frcpa(1+86/2^-8))/2
+data8 0x96a330156e6772f2 , 0x00003ffc //   log(1/frcpa(1+87/2^-8))/2
+data8 0x97fb3582754ea25b , 0x00003ffc //   log(1/frcpa(1+88/2^-8))/2
+data8 0x99aa8259aad1bbf2 , 0x00003ffc //   log(1/frcpa(1+89/2^-8))/2
+data8 0x9b0492f6227ae4a8 , 0x00003ffc //   log(1/frcpa(1+90/2^-8))/2
+//
+data8 0x9c5f8e199bf3a7a5 , 0x00003ffc //   log(1/frcpa(1+91/2^-8))/2
+data8 0x9e1293b9998c1daa , 0x00003ffc //   log(1/frcpa(1+92/2^-8))/2
+data8 0x9f6fa31e0b41f308 , 0x00003ffc //   log(1/frcpa(1+93/2^-8))/2
+data8 0xa0cda11eaf46390e , 0x00003ffc //   log(1/frcpa(1+94/2^-8))/2
+data8 0xa22c8f029cfa45aa , 0x00003ffc //   log(1/frcpa(1+95/2^-8))/2
+//
+data8 0xa3e48badb7856b34 , 0x00003ffc //   log(1/frcpa(1+96/2^-8))/2
+data8 0xa5459a0aa95849f9 , 0x00003ffc //   log(1/frcpa(1+97/2^-8))/2
+data8 0xa6a79c84480cfebd , 0x00003ffc //   log(1/frcpa(1+98/2^-8))/2
+data8 0xa80a946d0fcb3eb2 , 0x00003ffc //   log(1/frcpa(1+99/2^-8))/2
+data8 0xa96e831a3ea7b314 , 0x00003ffc //   log(1/frcpa(1+100/2^-8))/2
+//
+data8 0xaad369e3dc544e3b , 0x00003ffc //   log(1/frcpa(1+101/2^-8))/2
+data8 0xac92e9588952c815 , 0x00003ffc //   log(1/frcpa(1+102/2^-8))/2
+data8 0xadfa035aa1ed8fdc , 0x00003ffc //   log(1/frcpa(1+103/2^-8))/2
+data8 0xaf6219eae1ad6e34 , 0x00003ffc //   log(1/frcpa(1+104/2^-8))/2
+data8 0xb0cb2e6d8160f753 , 0x00003ffc //   log(1/frcpa(1+105/2^-8))/2
+//
+data8 0xb2354249ad950f72 , 0x00003ffc //   log(1/frcpa(1+106/2^-8))/2
+data8 0xb3a056e98ef4a3b4 , 0x00003ffc //   log(1/frcpa(1+107/2^-8))/2
+data8 0xb50c6dba52c6292a , 0x00003ffc //   log(1/frcpa(1+108/2^-8))/2
+data8 0xb679882c33876165 , 0x00003ffc //   log(1/frcpa(1+109/2^-8))/2
+data8 0xb78c07429785cedc , 0x00003ffc //   log(1/frcpa(1+110/2^-8))/2
+//
+data8 0xb8faeb8dc4a77d24 , 0x00003ffc //   log(1/frcpa(1+111/2^-8))/2
+data8 0xba6ad77eb36ae0d6 , 0x00003ffc //   log(1/frcpa(1+112/2^-8))/2
+data8 0xbbdbcc915e9bee50 , 0x00003ffc //   log(1/frcpa(1+113/2^-8))/2
+data8 0xbd4dcc44f8cf12ef , 0x00003ffc //   log(1/frcpa(1+114/2^-8))/2
+data8 0xbec0d81bf5b531fa , 0x00003ffc //   log(1/frcpa(1+115/2^-8))/2
+//
+data8 0xc034f19c139186f4 , 0x00003ffc //   log(1/frcpa(1+116/2^-8))/2
+data8 0xc14cb69f7c5e55ab , 0x00003ffc //   log(1/frcpa(1+117/2^-8))/2
+data8 0xc2c2abbb6e5fd56f , 0x00003ffc //   log(1/frcpa(1+118/2^-8))/2
+data8 0xc439b2c193e6771e , 0x00003ffc //   log(1/frcpa(1+119/2^-8))/2
+data8 0xc553acb9d5c67733 , 0x00003ffc //   log(1/frcpa(1+120/2^-8))/2
+//
+data8 0xc6cc96e441272441 , 0x00003ffc //   log(1/frcpa(1+121/2^-8))/2
+data8 0xc8469753eca88c30 , 0x00003ffc //   log(1/frcpa(1+122/2^-8))/2
+data8 0xc962cf3ce072b05c , 0x00003ffc //   log(1/frcpa(1+123/2^-8))/2
+data8 0xcadeba8771f694aa , 0x00003ffc //   log(1/frcpa(1+124/2^-8))/2
+data8 0xcc5bc08d1f72da94 , 0x00003ffc //   log(1/frcpa(1+125/2^-8))/2
+//
+data8 0xcd7a3f99ea035c29 , 0x00003ffc //   log(1/frcpa(1+126/2^-8))/2
+data8 0xcef93860c8a53c35 , 0x00003ffc //   log(1/frcpa(1+127/2^-8))/2
+data8 0xd0192f68a7ed23df , 0x00003ffc //   log(1/frcpa(1+128/2^-8))/2
+data8 0xd19a201127d3c645 , 0x00003ffc //   log(1/frcpa(1+129/2^-8))/2
+data8 0xd2bb92f4061c172c , 0x00003ffc //   log(1/frcpa(1+130/2^-8))/2
+//
+data8 0xd43e80b2ee8cc8fc , 0x00003ffc //   log(1/frcpa(1+131/2^-8))/2
+data8 0xd56173601fc4ade4 , 0x00003ffc //   log(1/frcpa(1+132/2^-8))/2
+data8 0xd6e6637efb54086f , 0x00003ffc //   log(1/frcpa(1+133/2^-8))/2
+data8 0xd80ad9f58f3c8193 , 0x00003ffc //   log(1/frcpa(1+134/2^-8))/2
+data8 0xd991d1d31aca41f8 , 0x00003ffc //   log(1/frcpa(1+135/2^-8))/2
+//
+data8 0xdab7d02231484a93 , 0x00003ffc //   log(1/frcpa(1+136/2^-8))/2
+data8 0xdc40d532cde49a54 , 0x00003ffc //   log(1/frcpa(1+137/2^-8))/2
+data8 0xdd685f79ed8b265e , 0x00003ffc //   log(1/frcpa(1+138/2^-8))/2
+data8 0xde9094bbc0e17b1d , 0x00003ffc //   log(1/frcpa(1+139/2^-8))/2
+data8 0xe01c91b78440c425 , 0x00003ffc //   log(1/frcpa(1+140/2^-8))/2
+//
+data8 0xe14658f26997e729 , 0x00003ffc //   log(1/frcpa(1+141/2^-8))/2
+data8 0xe270cdc2391e0d23 , 0x00003ffc //   log(1/frcpa(1+142/2^-8))/2
+data8 0xe3ffce3a2aa64922 , 0x00003ffc //   log(1/frcpa(1+143/2^-8))/2
+data8 0xe52bdb274ed82887 , 0x00003ffc //   log(1/frcpa(1+144/2^-8))/2
+data8 0xe6589852e75d7df6 , 0x00003ffc //   log(1/frcpa(1+145/2^-8))/2
+//
+data8 0xe786068c79937a7d , 0x00003ffc //   log(1/frcpa(1+146/2^-8))/2
+data8 0xe91903adad100911 , 0x00003ffc //   log(1/frcpa(1+147/2^-8))/2
+data8 0xea481236f7d35bb0 , 0x00003ffc //   log(1/frcpa(1+148/2^-8))/2
+data8 0xeb77d48c692e6b14 , 0x00003ffc //   log(1/frcpa(1+149/2^-8))/2
+data8 0xeca84b83d7297b87 , 0x00003ffc //   log(1/frcpa(1+150/2^-8))/2
+//
+data8 0xedd977f4962aa158 , 0x00003ffc //   log(1/frcpa(1+151/2^-8))/2
+data8 0xef7179a22f257754 , 0x00003ffc //   log(1/frcpa(1+152/2^-8))/2
+data8 0xf0a450d139366ca7 , 0x00003ffc //   log(1/frcpa(1+153/2^-8))/2
+data8 0xf1d7e0524ff9ffdb , 0x00003ffc //   log(1/frcpa(1+154/2^-8))/2
+data8 0xf30c29036a8b6cae , 0x00003ffc //   log(1/frcpa(1+155/2^-8))/2
+//
+data8 0xf4412bc411ea8d92 , 0x00003ffc //   log(1/frcpa(1+156/2^-8))/2
+data8 0xf576e97564c8619d , 0x00003ffc //   log(1/frcpa(1+157/2^-8))/2
+data8 0xf6ad62fa1b5f172f , 0x00003ffc //   log(1/frcpa(1+158/2^-8))/2
+data8 0xf7e499368b55c542 , 0x00003ffc //   log(1/frcpa(1+159/2^-8))/2
+data8 0xf91c8d10abaffe22 , 0x00003ffc //   log(1/frcpa(1+160/2^-8))/2
+//
+data8 0xfa553f7018c966f3 , 0x00003ffc //   log(1/frcpa(1+161/2^-8))/2
+data8 0xfb8eb13e185d802c , 0x00003ffc //   log(1/frcpa(1+162/2^-8))/2
+data8 0xfcc8e3659d9bcbed , 0x00003ffc //   log(1/frcpa(1+163/2^-8))/2
+data8 0xfe03d6d34d487fd2 , 0x00003ffc //   log(1/frcpa(1+164/2^-8))/2
+data8 0xff3f8c7581e9f0ae , 0x00003ffc //   log(1/frcpa(1+165/2^-8))/2
+//
+data8 0x803e029e280173ae , 0x00003ffd //   log(1/frcpa(1+166/2^-8))/2
+data8 0x80dca10cc52d0757 , 0x00003ffd //   log(1/frcpa(1+167/2^-8))/2
+data8 0x817ba200632755a1 , 0x00003ffd //   log(1/frcpa(1+168/2^-8))/2
+data8 0x821b05f3b01d6774 , 0x00003ffd //   log(1/frcpa(1+169/2^-8))/2
+data8 0x82bacd623ff19d06 , 0x00003ffd //   log(1/frcpa(1+170/2^-8))/2
+//
+data8 0x835af8c88e7a8f47 , 0x00003ffd //   log(1/frcpa(1+171/2^-8))/2
+data8 0x83c5f8299e2b4091 , 0x00003ffd //   log(1/frcpa(1+172/2^-8))/2
+data8 0x8466cb43f3d87300 , 0x00003ffd //   log(1/frcpa(1+173/2^-8))/2
+data8 0x850803a67c80ca4b , 0x00003ffd //   log(1/frcpa(1+174/2^-8))/2
+data8 0x85a9a1d11a23b461 , 0x00003ffd //   log(1/frcpa(1+175/2^-8))/2
+//
+data8 0x864ba644a18e6e05 , 0x00003ffd //   log(1/frcpa(1+176/2^-8))/2
+data8 0x86ee1182dcc432f7 , 0x00003ffd //   log(1/frcpa(1+177/2^-8))/2
+data8 0x875a925d7e48c316 , 0x00003ffd //   log(1/frcpa(1+178/2^-8))/2
+data8 0x87fdaa109d23aef7 , 0x00003ffd //   log(1/frcpa(1+179/2^-8))/2
+data8 0x88a129ed4becfaf2 , 0x00003ffd //   log(1/frcpa(1+180/2^-8))/2
+//
+data8 0x89451278ecd7f9cf , 0x00003ffd //   log(1/frcpa(1+181/2^-8))/2
+data8 0x89b29295f8432617 , 0x00003ffd //   log(1/frcpa(1+182/2^-8))/2
+data8 0x8a572ac5a5496882 , 0x00003ffd //   log(1/frcpa(1+183/2^-8))/2
+data8 0x8afc2d0ce3b2dadf , 0x00003ffd //   log(1/frcpa(1+184/2^-8))/2
+data8 0x8b6a69c608cfd3af , 0x00003ffd //   log(1/frcpa(1+185/2^-8))/2
+//
+data8 0x8c101e106e899a83 , 0x00003ffd //   log(1/frcpa(1+186/2^-8))/2
+data8 0x8cb63de258f9d626 , 0x00003ffd //   log(1/frcpa(1+187/2^-8))/2
+data8 0x8d2539c5bd19e2b1 , 0x00003ffd //   log(1/frcpa(1+188/2^-8))/2
+data8 0x8dcc0e064b29e6f1 , 0x00003ffd //   log(1/frcpa(1+189/2^-8))/2
+data8 0x8e734f45d88357ae , 0x00003ffd //   log(1/frcpa(1+190/2^-8))/2
+//
+data8 0x8ee30cef034a20db , 0x00003ffd //   log(1/frcpa(1+191/2^-8))/2
+data8 0x8f8b0515686d1d06 , 0x00003ffd //   log(1/frcpa(1+192/2^-8))/2
+data8 0x90336bba039bf32f , 0x00003ffd //   log(1/frcpa(1+193/2^-8))/2
+data8 0x90a3edd23d1c9d58 , 0x00003ffd //   log(1/frcpa(1+194/2^-8))/2
+data8 0x914d0de2f5d61b32 , 0x00003ffd //   log(1/frcpa(1+195/2^-8))/2
+//
+data8 0x91be0c20d28173b5 , 0x00003ffd //   log(1/frcpa(1+196/2^-8))/2
+data8 0x9267e737c06cd34a , 0x00003ffd //   log(1/frcpa(1+197/2^-8))/2
+data8 0x92d962ae6abb1237 , 0x00003ffd //   log(1/frcpa(1+198/2^-8))/2
+data8 0x9383fa6afbe2074c , 0x00003ffd //   log(1/frcpa(1+199/2^-8))/2
+data8 0x942f0421651c1c4e , 0x00003ffd //   log(1/frcpa(1+200/2^-8))/2
+//
+data8 0x94a14a3845bb985e , 0x00003ffd //   log(1/frcpa(1+201/2^-8))/2
+data8 0x954d133857f861e7 , 0x00003ffd //   log(1/frcpa(1+202/2^-8))/2
+data8 0x95bfd96468e604c4 , 0x00003ffd //   log(1/frcpa(1+203/2^-8))/2
+data8 0x9632d31cafafa858 , 0x00003ffd //   log(1/frcpa(1+204/2^-8))/2
+data8 0x96dfaabd86fa1647 , 0x00003ffd //   log(1/frcpa(1+205/2^-8))/2
+//
+data8 0x9753261fcbb2a594 , 0x00003ffd //   log(1/frcpa(1+206/2^-8))/2
+data8 0x9800c11b426b996d , 0x00003ffd //   log(1/frcpa(1+207/2^-8))/2
+data8 0x9874bf4d45ae663c , 0x00003ffd //   log(1/frcpa(1+208/2^-8))/2
+data8 0x99231f5ee9a74f79 , 0x00003ffd //   log(1/frcpa(1+209/2^-8))/2
+data8 0x9997a18a56bcad28 , 0x00003ffd //   log(1/frcpa(1+210/2^-8))/2
+//
+data8 0x9a46c873a3267e79 , 0x00003ffd //   log(1/frcpa(1+211/2^-8))/2
+data8 0x9abbcfc621eb6cb6 , 0x00003ffd //   log(1/frcpa(1+212/2^-8))/2
+data8 0x9b310cb0d354c990 , 0x00003ffd //   log(1/frcpa(1+213/2^-8))/2
+data8 0x9be14cf9e1b3515c , 0x00003ffd //   log(1/frcpa(1+214/2^-8))/2
+data8 0x9c5710b8cbb73a43 , 0x00003ffd //   log(1/frcpa(1+215/2^-8))/2
+//
+data8 0x9ccd0abd301f399c , 0x00003ffd //   log(1/frcpa(1+216/2^-8))/2
+data8 0x9d7e67f3bdce8888 , 0x00003ffd //   log(1/frcpa(1+217/2^-8))/2
+data8 0x9df4ea81a99daa01 , 0x00003ffd //   log(1/frcpa(1+218/2^-8))/2
+data8 0x9e6ba405a54514ba , 0x00003ffd //   log(1/frcpa(1+219/2^-8))/2
+data8 0x9f1e21c8c7bb62b3 , 0x00003ffd //   log(1/frcpa(1+220/2^-8))/2
+//
+data8 0x9f956593f6b6355c , 0x00003ffd //   log(1/frcpa(1+221/2^-8))/2
+data8 0xa00ce1092e5498c3 , 0x00003ffd //   log(1/frcpa(1+222/2^-8))/2
+data8 0xa0c08309c4b912c1 , 0x00003ffd //   log(1/frcpa(1+223/2^-8))/2
+data8 0xa1388a8c6faa2afa , 0x00003ffd //   log(1/frcpa(1+224/2^-8))/2
+data8 0xa1b0ca7095b5f985 , 0x00003ffd //   log(1/frcpa(1+225/2^-8))/2
+//
+data8 0xa22942eb47534a00 , 0x00003ffd //   log(1/frcpa(1+226/2^-8))/2
+data8 0xa2de62326449d0a3 , 0x00003ffd //   log(1/frcpa(1+227/2^-8))/2
+data8 0xa357690f88bfe345 , 0x00003ffd //   log(1/frcpa(1+228/2^-8))/2
+data8 0xa3d0a93f45169a4b , 0x00003ffd //   log(1/frcpa(1+229/2^-8))/2
+data8 0xa44a22f7ffe65f30 , 0x00003ffd //   log(1/frcpa(1+230/2^-8))/2
+//
+data8 0xa500c5e5b4c1aa36 , 0x00003ffd //   log(1/frcpa(1+231/2^-8))/2
+data8 0xa57ad064eb2ebbc2 , 0x00003ffd //   log(1/frcpa(1+232/2^-8))/2
+data8 0xa5f5152dedf4384e , 0x00003ffd //   log(1/frcpa(1+233/2^-8))/2
+data8 0xa66f9478856233ec , 0x00003ffd //   log(1/frcpa(1+234/2^-8))/2
+data8 0xa6ea4e7cca02c32e , 0x00003ffd //   log(1/frcpa(1+235/2^-8))/2
+//
+data8 0xa765437325341ccf , 0x00003ffd //   log(1/frcpa(1+236/2^-8))/2
+data8 0xa81e21e6c75b4020 , 0x00003ffd //   log(1/frcpa(1+237/2^-8))/2
+data8 0xa899ab333fe2b9ca , 0x00003ffd //   log(1/frcpa(1+238/2^-8))/2
+data8 0xa9157039c51ebe71 , 0x00003ffd //   log(1/frcpa(1+239/2^-8))/2
+data8 0xa991713433c2b999 , 0x00003ffd //   log(1/frcpa(1+240/2^-8))/2
+//
+data8 0xaa0dae5cbcc048b3 , 0x00003ffd //   log(1/frcpa(1+241/2^-8))/2
+data8 0xaa8a27ede5eb13ad , 0x00003ffd //   log(1/frcpa(1+242/2^-8))/2
+data8 0xab06de228a9e3499 , 0x00003ffd //   log(1/frcpa(1+243/2^-8))/2
+data8 0xab83d135dc633301 , 0x00003ffd //   log(1/frcpa(1+244/2^-8))/2
+data8 0xac3fb076adc7fe7a , 0x00003ffd //   log(1/frcpa(1+245/2^-8))/2
+//
+data8 0xacbd3cbbe47988f1 , 0x00003ffd //   log(1/frcpa(1+246/2^-8))/2
+data8 0xad3b06b1a5dc57c3 , 0x00003ffd //   log(1/frcpa(1+247/2^-8))/2
+data8 0xadb90e94af887717 , 0x00003ffd //   log(1/frcpa(1+248/2^-8))/2
+data8 0xae3754a218f7c816 , 0x00003ffd //   log(1/frcpa(1+249/2^-8))/2
+data8 0xaeb5d9175437afa2 , 0x00003ffd //   log(1/frcpa(1+250/2^-8))/2
+//
+data8 0xaf349c322e9c7cee , 0x00003ffd //   log(1/frcpa(1+251/2^-8))/2
+data8 0xafb39e30d1768d1c , 0x00003ffd //   log(1/frcpa(1+252/2^-8))/2
+data8 0xb032df51c2c93116 , 0x00003ffd //   log(1/frcpa(1+253/2^-8))/2
+data8 0xb0b25fd3e6035ad9 , 0x00003ffd //   log(1/frcpa(1+254/2^-8))/2
+data8 0xb1321ff67cba178c , 0x00003ffd //   log(1/frcpa(1+255/2^-8))/2
+LOCAL_OBJECT_END(atanh_data_3)
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(atanh)
+
+{ .mfi
+      getf.exp      rArgSExpb = f8                  // Must recompute if x unorm
+      fclass.m      p13,p0 = f8, 0x0b               // is arg denormal ?
+      mov           rExpbMask = 0x1ffff
+}
+{ .mfi
+      addl          DataPtr = @ltoff(atanh_data), gp
+      fnma.s1       fOneMx = f8, f1, f1             // fOneMx = 1 - x
+      mov           rBias = 0xffff
+}
+;;
+
+{ .mfi
+      mov           rNearZeroBound = 0xfffd         // biased exp of 1/4
+      fclass.m      p12,p0 = f8, 0xc7               // is arg NaN or +/-0 ?
+      nop.i         0
+}
+{ .mfi
+      ld8           DataPtr = [DataPtr]
+      fma.s1        fOnePx = f8, f1, f1             // fOnePx = 1 + x
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fcmp.lt.s1    p10,p11 = f8,f0                 // is x < 0 ?
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+      fnorm.s1      fNormX = f8                     // Normalize x
+(p13) br.cond.spnt  ATANH_UNORM                     // Branch if x=unorm
+}
+;;
+
+ATANH_COMMON:
+// Return here if x=unorm and not denorm
+{ .mfi
+      adds          Data2Ptr = 0x50, DataPtr
+      fma.s1        fX2 = f8, f8, f0                // x^2
+      nop.i         0
+}
+{ .mfb
+      adds          Data3Ptr = 0xC0, DataPtr
+(p12) fma.d.s0      f8 = f8,f1,f8                   // NaN or +/-0
+(p12) br.ret.spnt   b0                              // Exit for x Nan or zero
+}
+;;
+
+{ .mfi
+      ldfe          fC9 = [Data2Ptr], 16
+(p11) frcpa.s1      fRcp0, p0 = f1, fOneMx
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfe          fC8 = [Data2Ptr], 16
+(p10) frcpa.s1      fRcp0n, p0 = f1, fOnePx
+      and           rArgExpb = rArgSExpb, rExpbMask // biased exponent
+}
+{ .mfi
+      nop.m         0
+(p10) fma.s1        fOneMx = fOnePx, f1, f0         // fOnePx = 1 - |x|
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfe          fC7 = [Data2Ptr], 16
+(p10) fnma.s1       fOnePx = fNormX, f1, f1         // fOnePx = 1 + |x|
+      cmp.ge        p6,p0 = rArgExpb, rBias         // is Expb(Arg) >= Expb(1) ?
+}
+{ .mfb
+      nop.m         0
+      nop.f         0
+(p6)  br.cond.spnt  atanh_ge_one                    // Branch if |x| >=1.0
+}
+;;
+
+{ .mfi
+      ldfe          fC6 = [Data2Ptr], 16
+      nop.f         0
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfe          fC5 = [Data2Ptr], 16
+      fma.s1        fX4 = fX2, fX2, f0              // x^4
+      cmp.gt        p8,p0 = rNearZeroBound, rArgExpb
+}
+{ .mfb
+      ldfe          fC2 = [Data3Ptr], 16
+      fma.s1        fX3 = fX2, fNormX, f0           // x^3
+(p8)  br.cond.spnt  atanh_near_zero                 // Exit if 0 < |x| < 0.25
+}
+;;
+
+// Main path: 0.25 <= |x| < 1.0
+// NR method: iteration #1
+.pred.rel "mutex",p11,p10
+{ .mfi
+      ldfpd         fP5, fP4 = [DataPtr], 16
+(p11) fnma.s1       fRcp1 = fRcp0, fOneMx, f1       // t = 1 - r0*x
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fnma.s1       fRcp1 = fRcp0n, fOneMx, f1      // t = 1 - r0*x
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfpd         fP3, fP2 = [DataPtr], 16
+      // r1 = r0 + r0*t = r0 + r0*(1 - r0*x)
+(p11) fma.s1        fRcp1 = fRcp0, fRcp1, fRcp0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // r1 = r0 + r0*t = r0 + r0*(1 - r0*x)
+(p10) fma.s1        fRcp1 = fRcp0n, fRcp1, fRcp0n
+      nop.i         0
+}
+;;
+
+// NR method: iteration #2
+{ .mfi
+      ldfd          fP1 = [DataPtr], 16
+      fnma.s1       fRcp2 = fRcp1, fOneMx, f1       // t = 1 - r1*x
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfe          fLog2 = [DataPtr], 16
+      // r2 = r1 + r1*t = r1 + r1*(1 - r1*x)
+      fma.s1        fRcp2 = fRcp1, fRcp2, fRcp1
+      nop.i         0
+}
+;;
+
+// NR method: iteration #3
+{ .mfi
+      adds          RcpTablePtr = 0xB0, DataPtr
+      fnma.s1       fRcp3 = fRcp2, fOneMx, f1       // t = 1 - r2*x
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        fY4Rcp = fRcp2, fOnePx, f0      // fY4Rcp = r2*(1 + x)
+      nop.i         0
+}
+;;
+
+// polynomial approximation & final reconstruction
+{ .mfi
+      nop.m         0
+      frcpa.s1      fRcp, p0 = f1, fY4Rcp
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // y = r2 * (1 + x) + r2 * (1 + x) * t = (1 + x) * (r2 + r2*(1 - r2*x))
+      fma.s1        fY = fY4Rcp, fRcp3, fY4Rcp
+      nop.i         0
+}
+;;
+
+{ .mmi
+      getf.exp      rSExpb = fY4Rcp                 // biased exponent and sign
+;;
+      getf.sig      rSig = fY4Rcp                   // significand
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fms.s1        fR = fY, fRcp, f1               // fR = fY * fRcp - 1
+      nop.i         0
+}
+;;
+
+{ .mmi
+      and           rExpb = rSExpb, rExpbMask
+;;
+      sub           rN = rExpb, rBias               // exponent
+      extr.u        rInd = rSig,55,8                // Extract 8 bits
+}
+;;
+
+{ .mmi
+      setf.sig      fN4Cvt = rN
+      shladd        RcpTablePtr = rInd, 4, RcpTablePtr
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfe          fLogT = [RcpTablePtr]
+      fma.s1        fR2 = fR, fR, f0                // r^2
+      nop.i         0
+}
+{
+      nop.m         0
+      fma.s1        fP54 = fP5, fR, fP4             // P5*r + P4
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fP32 = fP3, fR, fP2             // P3*r + P2
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fR3 = fR2, fR, f0               // r^3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        fP10 = fP1, fR2, fR             // P1*r^2 + r
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fcvt.xf       fN = fN4Cvt
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        fP54 = fP54, fR2, fP32      // (P5*r + P4)*r^2 + P3*r + P2
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fLogT_N = fN, fLog2, fLogT      // N*Log2 + LogT
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // ((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r
+      fma.s1        fP54 = fP54, fR3, fP10
+      nop.i         0
+}
+;;
+
+.pred.rel "mutex",p11,p10
+{ .mfi
+      nop.m         0
+      // 0.5*(((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r) + 0.5*(N*Log2 + T)
+(p11) fnma.d.s0     f8 = fP54, fP1, fLogT_N
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+     // -0.5*(((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r) - 0.5*(N*Log2 + T)
+(p10) fms.d.s0      f8 = fP54, fP1, fLogT_N
+      br.ret.sptk   b0                          // Exit for 0.25 <= |x| < 1.0
+}
+;;
+
+// Here if 0 < |x| < 0.25
+atanh_near_zero:
+{ .mfi
+      ldfe          fC4 = [Data2Ptr], 16
+      fma.s1        fP98 = fC9, fX2, fC8           // C9*x^2 + C8
+      nop.i         0
+}
+{ .mfi
+      ldfe          fC1 = [Data3Ptr], 16
+      fma.s1        fP76 = fC7, fX2, fC6           // C7*x^2 + C6
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfe          fC3 = [Data2Ptr], 16
+      fma.s1        fX8 = fX4, fX4, f0             // x^8
+      nop.i         0
+}
+{ .mfi
+      ldfe          fC0 = [Data3Ptr], 16
+      nop.f         0
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fP98 = fP98, fX4, fP76     // C9*x^6 + C8*x^4 + C7*x^2 + C6
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fP54 = fC5, fX2, fC4           // C5*x^2 + C4
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fP32 = fC3, fX2, fC2           // C3*x^2 + C2
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fP10 = fC1, fX2, fC0           // C1*x^2 + C0
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fP54 = fP54, fX4, fP32      // C5*x^6 + C4*x^4 + C3*x^2 + C2
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      // C9*x^14 + C8*x^12 + C7*x^10 + C6*x^8 + C5*x^6 + C4*x^4 + C3*x^2 + C2
+      fma.s1        fP98 = fP98, fX8, fP54
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      // C9*x^18 + C8*x^16 + C7*x^14 + C6*x^12 + C5*x^10 + C4*x^8 + C3*x^6 +
+      // C2*x^4 + C1*x^2 + C0
+      fma.s1        fP98 = fP98, fX4, fP10
+      nop.i         0
+}
+;;
+
+{ .mfb
+      nop.m         0
+      // C9*x^21 + C8*x^19 + C7*x^17 + C6*x^15 + C5*x^13 + C4*x^11 + C3*x^9 +
+      // C2*x^7 + C1*x^5 + C0*x^3 + x
+      fma.d.s0      f8 = fP98, fX3, fNormX
+      br.ret.sptk   b0                           // Exit for 0 < |x| < 0.25
+}
+;;
+
+ATANH_UNORM:
+// Here if x=unorm
+{ .mfi
+      getf.exp      rArgSExpb = fNormX           // Recompute if x unorm
+      fclass.m      p0,p13 = fNormX, 0x0b        // Test x denorm
+      nop.i         0
+}
+;;
+
+{ .mfb
+      nop.m         0
+      fcmp.eq.s0    p7,p0 = f8, f0        // Dummy to set denormal flag
+(p13) br.cond.sptk  ATANH_COMMON          // Continue if x unorm and not denorm
+}
+;;
+
+.pred.rel "mutex",p10,p11
+{ .mfi
+      nop.m         0
+(p10) fnma.d.s0     f8 = f8,f8,f8                // Result x-x^2 if x=-denorm
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p11) fma.d.s0      f8 = f8,f8,f8                // Result x+x^2 if x=+denorm
+      br.ret.spnt   b0                           // Exit if denorm
+}
+;;
+
+// Here if |x| >= 1.0
+atanh_ge_one:
+{ .mfi
+      alloc         r32 = ar.pfs,1,3,4,0
+      fmerge.s      fAbsX = f0, f8          // Form |x|
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fmerge.s      f10 = f8, f8            // Save input for error call
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fcmp.eq.s1    p6,p7 = fAbsX, f1       // Test for |x| = 1.0
+      nop.i         0
+}
+;;
+
+// Set error tag and result, and raise invalid flag if |x| > 1.0
+{ .mfi
+(p7)  mov           atanh_GR_tag = 131
+(p7)  frcpa.s0      f8, p0 = f0, f0         // Get QNaN, and raise invalid
+      nop.i         0
+}
+;;
+
+// Set error tag and result, and raise Z flag if |x| = 1.0
+{ .mfi
+      nop.m         0
+(p6)  frcpa.s0      fRcp, p0 = f1, f0       // Get inf, and raise Z flag
+      nop.i         0
+}
+;;
+
+{ .mfb
+(p6)  mov           atanh_GR_tag = 132
+(p6)  fmerge.s      f8 = f8, fRcp           // result is +-inf
+      br.cond.sptk  __libm_error_region     // Exit if |x| >= 1.0
+}
+;;
+
+GLOBAL_LIBM_END(atanh)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+{ .mfi
+      add           GR_Parameter_Y=-32,sp        // Parameter 2 value
+      nop.f         0
+.save   ar.pfs,GR_SAVE_PFS
+      mov           GR_SAVE_PFS=ar.pfs           // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+      add sp=-64,sp                              // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                          // Save gp
+};;
+
+{ .mmi
+      stfd [GR_Parameter_Y] = f1,16              // STORE Parameter 2 on stack
+      add GR_Parameter_X = 16,sp                 // Parameter 1 address
+.save   b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0                          // Save b0
+};;
+
+.body
+{ .mib
+      stfd [GR_Parameter_X] = f10                // STORE Parameter 1 on stack
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+      nop.b 0
+}
+{ .mib
+      stfd [GR_Parameter_Y] = f8                 // STORE Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#      // Call error handling function
+};;
+
+{ .mmi
+      add   GR_Parameter_RESULT = 48,sp
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmi
+      ldfd  f8 = [GR_Parameter_RESULT]           // Get return result off stack
+.restore sp
+      add   sp = 64,sp                           // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                      // Restore return address
+};;
+
+{ .mib
+      mov   gp = GR_SAVE_GP                      // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS                 // Restore ar.pfs
+      br.ret.sptk     b0                         // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_atanhf.S b/sysdeps/ia64/fpu/e_atanhf.S
new file mode 100644
index 0000000000..1ec1408e35
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_atanhf.S
@@ -0,0 +1,845 @@
+.file "atanhf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 05/22/01 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 08/06/02 Improved Itanium 2 performance
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 05/26/03 Improved performance, fixed to handle unorms
+//
+// API
+//==============================================================
+// float atanhf(float)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+//
+// There are 7 paths:
+// 1. x = +/-0.0
+//    Return atanhf(x) = +/-0.0
+//
+// 2. 0.0 < |x| <= MAX_DENORMAL_ABS
+//    Return atanhf(x) = x + sign(x)*x^2
+//
+// 3. MAX_DENORMAL_ABS < |x| < 2^(-20)
+//    Return atanhf(x) = Pol3(x), where Pol3(x) = x + x^3
+//
+// 4. 2^(-20) <= |x| < 1
+//    Return atanhf(x) = 0.5 * (log(1 + x) - log(1 - x))
+//    Algorithm description for log function see below.
+//
+// 5. |x| = 1
+//    Return atanhf(x) = sign(x) * +INF
+//
+// 6. 1 < |x| <= +INF
+//    Return atanhf(x) = QNaN
+//
+// 7. x = [S,Q]NaN
+//    Return atanhf(x) = QNaN
+//
+//==============================================================
+// Algorithm Description for log(x) function
+//
+// Consider  x = 2^N * 1.f1 f2 f3 f4...f63
+// log(x) = log(x * frcpa(x) / frcpa(x))
+//        = log(x * frcpa(x)) + log(1/frcpa(x))
+//        = log(x * frcpa(x)) - log(frcpa(x))
+//
+// frcpa(x) = 2^(-N) * frcpa(1.f1 f2 ... f63)
+//
+// -log(frcpa(x)) = -log(C)
+//                = -log(2^(-N)) - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = N*log2 - log(frcpa(1.f1 f2 ... f63))
+//
+//
+// log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
+//
+// log(x) = N*log2 + log(1./frcpa(1.f1 f2 ... f63)) + log(x * frcpa(x))
+// log(x) = N*log2 + T                              + log(frcpa(x) x)
+//
+// Log(x) = N*log2 + T                              + log(C * x)
+//
+// C * x = 1 + r
+//
+// log(x) = N*log2 + T + log(1 + r)
+// log(x) = N*log2 + T + Series(r)
+//
+// 1.f1 f2 ... f8 has 256 entries.
+// They are 1 + k/2^8, k = 0 ... 255
+// These 256 values are the table entries.
+//
+// Implementation
+//==============================================================
+// C = frcpa(x)
+// r = C * x - 1
+//
+// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4
+//
+// x = f * 2*N where f is 1.f_1f_2f_3...f_63
+// Nfloat = float(n)  where n is the true unbiased exponent
+// pre-index = f_1f_2....f_8
+// index = pre_index * 16
+// get the dxt table entry at index + offset = T
+//
+// result = (T + Nfloat * log(2)) + rseries
+//
+// The T table is calculated as follows
+// Form x_k = 1 + k/2^8 where k goes from 0... 255
+//      y_k = frcpa(x_k)
+//      log(1/y_k)  in quad and round to double-extended
+
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f32 -> f59
+
+// General registers used:
+// r14 -> r29, r32 -> r39
+
+// Predicate registers used:
+// p6 -> p9
+
+// p6           to filter out case when |x| >= 1
+// p7           to filter out case when x = [Q,S]NaN or +/-0
+// p8           to filter out case when |x| < 2^(-20)
+// p9           to filter out case when x = denormal
+
+
+// Assembly macros
+//==============================================================
+DataPtr               = r14
+RcpTablePtrM          = r15
+RcpTablePtrP          = r16
+rExpbMask             = r17
+rBias                 = r18
+rNearZeroBound        = r19
+rArgSExpb             = r20
+rArgExpb              = r21
+rExpbm                = r22
+rExpbp                = r23
+rSigm                 = r24
+rSigp                 = r25
+rNm                   = r26
+rNp                   = r27
+rIndm                 = r28
+rIndp                 = r29
+
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_SAVE_PFS           = r35
+
+GR_Parameter_X        = r36
+GR_Parameter_Y        = r37
+GR_Parameter_RESULT   = r38
+atanh_GR_tag          = r39
+
+//==============================================================
+fOneMx                = f33
+fOnePx                = f34
+fRm2                  = f35
+fRm3                  = f36
+fRp2                  = f37
+fRp3                  = f38
+fRcpM                 = f39
+fRcpP                 = f40
+fRp                   = f41
+fRm                   = f42
+fN4CvtM               = f43
+fN4CvtP               = f44
+fNm                   = f45
+fNp                   = f46
+fLogTm                = f47
+fLogTp                = f48
+fLog2                 = f49
+fArgAbs               = f50
+fNormX                = f50
+fP32m                 = f51
+fP32p                 = f52
+fP10m                 = f53
+fP10p                 = f54
+fX2                   = f55
+fP3                   = f56
+fP2                   = f57
+fP1                   = f58
+fHalf                 = f59
+
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(atanhf_data)
+data8 0xbfc0001008f39d59    // P3*0.5
+data8 0x3fc5556073e0c45a    // P2*0.5
+data8 0xbfcffffffffaea15    // P1*0.5
+data8 0x3fe0000000000000    // 0.5
+data8 0x3fd62e42fefa39ef    // 0.5*ln(2)
+data8 0x0000000000000000    // pad
+LOCAL_OBJECT_END(atanhf_data)
+
+LOCAL_OBJECT_START(atanhf_data2)
+data8 0x3f50040155d5889e    //log(1/frcpa(1+0/256))/2
+data8 0x3f68121214586b54    //log(1/frcpa(1+1/256))/2
+data8 0x3f741929f96832f0    //log(1/frcpa(1+2/256))/2
+data8 0x3f7c317384c75f06    //log(1/frcpa(1+3/256))/2
+data8 0x3f81a6b91ac73386    //log(1/frcpa(1+4/256))/2
+data8 0x3f85ba9a5d9ac039    //log(1/frcpa(1+5/256))/2
+data8 0x3f89d2a8074325f4    //log(1/frcpa(1+6/256))/2
+data8 0x3f8d6b2725979802    //log(1/frcpa(1+7/256))/2
+data8 0x3f90c58fa19dfaaa    //log(1/frcpa(1+8/256))/2
+data8 0x3f92954c78cbce1b    //log(1/frcpa(1+9/256))/2
+data8 0x3f94a94d2da96c56    //log(1/frcpa(1+10/256))/2
+data8 0x3f967c94f2d4bb58    //log(1/frcpa(1+11/256))/2
+data8 0x3f985188b630f068    //log(1/frcpa(1+12/256))/2
+data8 0x3f9a6b8abe73af4c    //log(1/frcpa(1+13/256))/2
+data8 0x3f9c441e06f72a9e    //log(1/frcpa(1+14/256))/2
+data8 0x3f9e1e6713606d07    //log(1/frcpa(1+15/256))/2
+data8 0x3f9ffa6911ab9301    //log(1/frcpa(1+16/256))/2
+data8 0x3fa0ec139c5da601    //log(1/frcpa(1+17/256))/2
+data8 0x3fa1dbd2643d190b    //log(1/frcpa(1+18/256))/2
+data8 0x3fa2cc7284fe5f1c    //log(1/frcpa(1+19/256))/2
+data8 0x3fa3bdf5a7d1ee64    //log(1/frcpa(1+20/256))/2
+data8 0x3fa4b05d7aa012e0    //log(1/frcpa(1+21/256))/2
+data8 0x3fa580db7ceb5702    //log(1/frcpa(1+22/256))/2
+data8 0x3fa674f089365a7a    //log(1/frcpa(1+23/256))/2
+data8 0x3fa769ef2c6b568d    //log(1/frcpa(1+24/256))/2
+data8 0x3fa85fd927506a48    //log(1/frcpa(1+25/256))/2
+data8 0x3fa9335e5d594989    //log(1/frcpa(1+26/256))/2
+data8 0x3faa2b0220c8e5f5    //log(1/frcpa(1+27/256))/2
+data8 0x3fab0004ac1a86ac    //log(1/frcpa(1+28/256))/2
+data8 0x3fabf968769fca11    //log(1/frcpa(1+29/256))/2
+data8 0x3faccfedbfee13a8    //log(1/frcpa(1+30/256))/2
+data8 0x3fada727638446a2    //log(1/frcpa(1+31/256))/2
+data8 0x3faea3257fe10f7a    //log(1/frcpa(1+32/256))/2
+data8 0x3faf7be9fedbfde6    //log(1/frcpa(1+33/256))/2
+data8 0x3fb02ab352ff25f4    //log(1/frcpa(1+34/256))/2
+data8 0x3fb097ce579d204d    //log(1/frcpa(1+35/256))/2
+data8 0x3fb1178e8227e47c    //log(1/frcpa(1+36/256))/2
+data8 0x3fb185747dbecf34    //log(1/frcpa(1+37/256))/2
+data8 0x3fb1f3b925f25d41    //log(1/frcpa(1+38/256))/2
+data8 0x3fb2625d1e6ddf57    //log(1/frcpa(1+39/256))/2
+data8 0x3fb2d1610c86813a    //log(1/frcpa(1+40/256))/2
+data8 0x3fb340c59741142e    //log(1/frcpa(1+41/256))/2
+data8 0x3fb3b08b6757f2a9    //log(1/frcpa(1+42/256))/2
+data8 0x3fb40dfb08378003    //log(1/frcpa(1+43/256))/2
+data8 0x3fb47e74e8ca5f7c    //log(1/frcpa(1+44/256))/2
+data8 0x3fb4ef51f6466de4    //log(1/frcpa(1+45/256))/2
+data8 0x3fb56092e02ba516    //log(1/frcpa(1+46/256))/2
+data8 0x3fb5d23857cd74d5    //log(1/frcpa(1+47/256))/2
+data8 0x3fb6313a37335d76    //log(1/frcpa(1+48/256))/2
+data8 0x3fb6a399dabbd383    //log(1/frcpa(1+49/256))/2
+data8 0x3fb70337dd3ce41b    //log(1/frcpa(1+50/256))/2
+data8 0x3fb77654128f6127    //log(1/frcpa(1+51/256))/2
+data8 0x3fb7e9d82a0b022d    //log(1/frcpa(1+52/256))/2
+data8 0x3fb84a6b759f512f    //log(1/frcpa(1+53/256))/2
+data8 0x3fb8ab47d5f5a310    //log(1/frcpa(1+54/256))/2
+data8 0x3fb91fe49096581b    //log(1/frcpa(1+55/256))/2
+data8 0x3fb981634011aa75    //log(1/frcpa(1+56/256))/2
+data8 0x3fb9f6c407089664    //log(1/frcpa(1+57/256))/2
+data8 0x3fba58e729348f43    //log(1/frcpa(1+58/256))/2
+data8 0x3fbabb55c31693ad    //log(1/frcpa(1+59/256))/2
+data8 0x3fbb1e104919efd0    //log(1/frcpa(1+60/256))/2
+data8 0x3fbb94ee93e367cb    //log(1/frcpa(1+61/256))/2
+data8 0x3fbbf851c067555f    //log(1/frcpa(1+62/256))/2
+data8 0x3fbc5c0254bf23a6    //log(1/frcpa(1+63/256))/2
+data8 0x3fbcc000c9db3c52    //log(1/frcpa(1+64/256))/2
+data8 0x3fbd244d99c85674    //log(1/frcpa(1+65/256))/2
+data8 0x3fbd88e93fb2f450    //log(1/frcpa(1+66/256))/2
+data8 0x3fbdedd437eaef01    //log(1/frcpa(1+67/256))/2
+data8 0x3fbe530effe71012    //log(1/frcpa(1+68/256))/2
+data8 0x3fbeb89a1648b971    //log(1/frcpa(1+69/256))/2
+data8 0x3fbf1e75fadf9bde    //log(1/frcpa(1+70/256))/2
+data8 0x3fbf84a32ead7c35    //log(1/frcpa(1+71/256))/2
+data8 0x3fbfeb2233ea07cd    //log(1/frcpa(1+72/256))/2
+data8 0x3fc028f9c7035c1c    //log(1/frcpa(1+73/256))/2
+data8 0x3fc05c8be0d9635a    //log(1/frcpa(1+74/256))/2
+data8 0x3fc085eb8f8ae797    //log(1/frcpa(1+75/256))/2
+data8 0x3fc0b9c8e32d1911    //log(1/frcpa(1+76/256))/2
+data8 0x3fc0edd060b78081    //log(1/frcpa(1+77/256))/2
+data8 0x3fc122024cf0063f    //log(1/frcpa(1+78/256))/2
+data8 0x3fc14be2927aecd4    //log(1/frcpa(1+79/256))/2
+data8 0x3fc180618ef18adf    //log(1/frcpa(1+80/256))/2
+data8 0x3fc1b50bbe2fc63b    //log(1/frcpa(1+81/256))/2
+data8 0x3fc1df4cc7cf242d    //log(1/frcpa(1+82/256))/2
+data8 0x3fc214456d0eb8d4    //log(1/frcpa(1+83/256))/2
+data8 0x3fc23ec5991eba49    //log(1/frcpa(1+84/256))/2
+data8 0x3fc2740d9f870afb    //log(1/frcpa(1+85/256))/2
+data8 0x3fc29ecdabcdfa04    //log(1/frcpa(1+86/256))/2
+data8 0x3fc2d46602adccee    //log(1/frcpa(1+87/256))/2
+data8 0x3fc2ff66b04ea9d4    //log(1/frcpa(1+88/256))/2
+data8 0x3fc335504b355a37    //log(1/frcpa(1+89/256))/2
+data8 0x3fc360925ec44f5d    //log(1/frcpa(1+90/256))/2
+data8 0x3fc38bf1c3337e75    //log(1/frcpa(1+91/256))/2
+data8 0x3fc3c25277333184    //log(1/frcpa(1+92/256))/2
+data8 0x3fc3edf463c1683e    //log(1/frcpa(1+93/256))/2
+data8 0x3fc419b423d5e8c7    //log(1/frcpa(1+94/256))/2
+data8 0x3fc44591e0539f49    //log(1/frcpa(1+95/256))/2
+data8 0x3fc47c9175b6f0ad    //log(1/frcpa(1+96/256))/2
+data8 0x3fc4a8b341552b09    //log(1/frcpa(1+97/256))/2
+data8 0x3fc4d4f3908901a0    //log(1/frcpa(1+98/256))/2
+data8 0x3fc501528da1f968    //log(1/frcpa(1+99/256))/2
+data8 0x3fc52dd06347d4f6    //log(1/frcpa(1+100/256))/2
+data8 0x3fc55a6d3c7b8a8a    //log(1/frcpa(1+101/256))/2
+data8 0x3fc5925d2b112a59    //log(1/frcpa(1+102/256))/2
+data8 0x3fc5bf406b543db2    //log(1/frcpa(1+103/256))/2
+data8 0x3fc5ec433d5c35ae    //log(1/frcpa(1+104/256))/2
+data8 0x3fc61965cdb02c1f    //log(1/frcpa(1+105/256))/2
+data8 0x3fc646a84935b2a2    //log(1/frcpa(1+106/256))/2
+data8 0x3fc6740add31de94    //log(1/frcpa(1+107/256))/2
+data8 0x3fc6a18db74a58c5    //log(1/frcpa(1+108/256))/2
+data8 0x3fc6cf31058670ec    //log(1/frcpa(1+109/256))/2
+data8 0x3fc6f180e852f0ba    //log(1/frcpa(1+110/256))/2
+data8 0x3fc71f5d71b894f0    //log(1/frcpa(1+111/256))/2
+data8 0x3fc74d5aefd66d5c    //log(1/frcpa(1+112/256))/2
+data8 0x3fc77b79922bd37e    //log(1/frcpa(1+113/256))/2
+data8 0x3fc7a9b9889f19e2    //log(1/frcpa(1+114/256))/2
+data8 0x3fc7d81b037eb6a6    //log(1/frcpa(1+115/256))/2
+data8 0x3fc8069e33827231    //log(1/frcpa(1+116/256))/2
+data8 0x3fc82996d3ef8bcb    //log(1/frcpa(1+117/256))/2
+data8 0x3fc85855776dcbfb    //log(1/frcpa(1+118/256))/2
+data8 0x3fc8873658327ccf    //log(1/frcpa(1+119/256))/2
+data8 0x3fc8aa75973ab8cf    //log(1/frcpa(1+120/256))/2
+data8 0x3fc8d992dc8824e5    //log(1/frcpa(1+121/256))/2
+data8 0x3fc908d2ea7d9512    //log(1/frcpa(1+122/256))/2
+data8 0x3fc92c59e79c0e56    //log(1/frcpa(1+123/256))/2
+data8 0x3fc95bd750ee3ed3    //log(1/frcpa(1+124/256))/2
+data8 0x3fc98b7811a3ee5b    //log(1/frcpa(1+125/256))/2
+data8 0x3fc9af47f33d406c    //log(1/frcpa(1+126/256))/2
+data8 0x3fc9df270c1914a8    //log(1/frcpa(1+127/256))/2
+data8 0x3fca0325ed14fda4    //log(1/frcpa(1+128/256))/2
+data8 0x3fca33440224fa79    //log(1/frcpa(1+129/256))/2
+data8 0x3fca57725e80c383    //log(1/frcpa(1+130/256))/2
+data8 0x3fca87d0165dd199    //log(1/frcpa(1+131/256))/2
+data8 0x3fcaac2e6c03f896    //log(1/frcpa(1+132/256))/2
+data8 0x3fcadccc6fdf6a81    //log(1/frcpa(1+133/256))/2
+data8 0x3fcb015b3eb1e790    //log(1/frcpa(1+134/256))/2
+data8 0x3fcb323a3a635948    //log(1/frcpa(1+135/256))/2
+data8 0x3fcb56fa04462909    //log(1/frcpa(1+136/256))/2
+data8 0x3fcb881aa659bc93    //log(1/frcpa(1+137/256))/2
+data8 0x3fcbad0bef3db165    //log(1/frcpa(1+138/256))/2
+data8 0x3fcbd21297781c2f    //log(1/frcpa(1+139/256))/2
+data8 0x3fcc039236f08819    //log(1/frcpa(1+140/256))/2
+data8 0x3fcc28cb1e4d32fd    //log(1/frcpa(1+141/256))/2
+data8 0x3fcc4e19b84723c2    //log(1/frcpa(1+142/256))/2
+data8 0x3fcc7ff9c74554c9    //log(1/frcpa(1+143/256))/2
+data8 0x3fcca57b64e9db05    //log(1/frcpa(1+144/256))/2
+data8 0x3fcccb130a5cebb0    //log(1/frcpa(1+145/256))/2
+data8 0x3fccf0c0d18f326f    //log(1/frcpa(1+146/256))/2
+data8 0x3fcd232075b5a201    //log(1/frcpa(1+147/256))/2
+data8 0x3fcd490246defa6b    //log(1/frcpa(1+148/256))/2
+data8 0x3fcd6efa918d25cd    //log(1/frcpa(1+149/256))/2
+data8 0x3fcd9509707ae52f    //log(1/frcpa(1+150/256))/2
+data8 0x3fcdbb2efe92c554    //log(1/frcpa(1+151/256))/2
+data8 0x3fcdee2f3445e4af    //log(1/frcpa(1+152/256))/2
+data8 0x3fce148a1a2726ce    //log(1/frcpa(1+153/256))/2
+data8 0x3fce3afc0a49ff40    //log(1/frcpa(1+154/256))/2
+data8 0x3fce6185206d516e    //log(1/frcpa(1+155/256))/2
+data8 0x3fce882578823d52    //log(1/frcpa(1+156/256))/2
+data8 0x3fceaedd2eac990c    //log(1/frcpa(1+157/256))/2
+data8 0x3fced5ac5f436be3    //log(1/frcpa(1+158/256))/2
+data8 0x3fcefc9326d16ab9    //log(1/frcpa(1+159/256))/2
+data8 0x3fcf2391a2157600    //log(1/frcpa(1+160/256))/2
+data8 0x3fcf4aa7ee03192d    //log(1/frcpa(1+161/256))/2
+data8 0x3fcf71d627c30bb0    //log(1/frcpa(1+162/256))/2
+data8 0x3fcf991c6cb3b379    //log(1/frcpa(1+163/256))/2
+data8 0x3fcfc07ada69a910    //log(1/frcpa(1+164/256))/2
+data8 0x3fcfe7f18eb03d3e    //log(1/frcpa(1+165/256))/2
+data8 0x3fd007c053c5002e    //log(1/frcpa(1+166/256))/2
+data8 0x3fd01b942198a5a1    //log(1/frcpa(1+167/256))/2
+data8 0x3fd02f74400c64eb    //log(1/frcpa(1+168/256))/2
+data8 0x3fd04360be7603ad    //log(1/frcpa(1+169/256))/2
+data8 0x3fd05759ac47fe34    //log(1/frcpa(1+170/256))/2
+data8 0x3fd06b5f1911cf52    //log(1/frcpa(1+171/256))/2
+data8 0x3fd078bf0533c568    //log(1/frcpa(1+172/256))/2
+data8 0x3fd08cd9687e7b0e    //log(1/frcpa(1+173/256))/2
+data8 0x3fd0a10074cf9019    //log(1/frcpa(1+174/256))/2
+data8 0x3fd0b5343a234477    //log(1/frcpa(1+175/256))/2
+data8 0x3fd0c974c89431ce    //log(1/frcpa(1+176/256))/2
+data8 0x3fd0ddc2305b9886    //log(1/frcpa(1+177/256))/2
+data8 0x3fd0eb524bafc918    //log(1/frcpa(1+178/256))/2
+data8 0x3fd0ffb54213a476    //log(1/frcpa(1+179/256))/2
+data8 0x3fd114253da97d9f    //log(1/frcpa(1+180/256))/2
+data8 0x3fd128a24f1d9aff    //log(1/frcpa(1+181/256))/2
+data8 0x3fd1365252bf0865    //log(1/frcpa(1+182/256))/2
+data8 0x3fd14ae558b4a92d    //log(1/frcpa(1+183/256))/2
+data8 0x3fd15f85a19c765b    //log(1/frcpa(1+184/256))/2
+data8 0x3fd16d4d38c119fa    //log(1/frcpa(1+185/256))/2
+data8 0x3fd18203c20dd133    //log(1/frcpa(1+186/256))/2
+data8 0x3fd196c7bc4b1f3b    //log(1/frcpa(1+187/256))/2
+data8 0x3fd1a4a738b7a33c    //log(1/frcpa(1+188/256))/2
+data8 0x3fd1b981c0c9653d    //log(1/frcpa(1+189/256))/2
+data8 0x3fd1ce69e8bb106b    //log(1/frcpa(1+190/256))/2
+data8 0x3fd1dc619de06944    //log(1/frcpa(1+191/256))/2
+data8 0x3fd1f160a2ad0da4    //log(1/frcpa(1+192/256))/2
+data8 0x3fd2066d7740737e    //log(1/frcpa(1+193/256))/2
+data8 0x3fd2147dba47a394    //log(1/frcpa(1+194/256))/2
+data8 0x3fd229a1bc5ebac3    //log(1/frcpa(1+195/256))/2
+data8 0x3fd237c1841a502e    //log(1/frcpa(1+196/256))/2
+data8 0x3fd24cfce6f80d9a    //log(1/frcpa(1+197/256))/2
+data8 0x3fd25b2c55cd5762    //log(1/frcpa(1+198/256))/2
+data8 0x3fd2707f4d5f7c41    //log(1/frcpa(1+199/256))/2
+data8 0x3fd285e0842ca384    //log(1/frcpa(1+200/256))/2
+data8 0x3fd294294708b773    //log(1/frcpa(1+201/256))/2
+data8 0x3fd2a9a2670aff0c    //log(1/frcpa(1+202/256))/2
+data8 0x3fd2b7fb2c8d1cc1    //log(1/frcpa(1+203/256))/2
+data8 0x3fd2c65a6395f5f5    //log(1/frcpa(1+204/256))/2
+data8 0x3fd2dbf557b0df43    //log(1/frcpa(1+205/256))/2
+data8 0x3fd2ea64c3f97655    //log(1/frcpa(1+206/256))/2
+data8 0x3fd3001823684d73    //log(1/frcpa(1+207/256))/2
+data8 0x3fd30e97e9a8b5cd    //log(1/frcpa(1+208/256))/2
+data8 0x3fd32463ebdd34ea    //log(1/frcpa(1+209/256))/2
+data8 0x3fd332f4314ad796    //log(1/frcpa(1+210/256))/2
+data8 0x3fd348d90e7464d0    //log(1/frcpa(1+211/256))/2
+data8 0x3fd35779f8c43d6e    //log(1/frcpa(1+212/256))/2
+data8 0x3fd36621961a6a99    //log(1/frcpa(1+213/256))/2
+data8 0x3fd37c299f3c366a    //log(1/frcpa(1+214/256))/2
+data8 0x3fd38ae2171976e7    //log(1/frcpa(1+215/256))/2
+data8 0x3fd399a157a603e7    //log(1/frcpa(1+216/256))/2
+data8 0x3fd3afccfe77b9d1    //log(1/frcpa(1+217/256))/2
+data8 0x3fd3be9d503533b5    //log(1/frcpa(1+218/256))/2
+data8 0x3fd3cd7480b4a8a3    //log(1/frcpa(1+219/256))/2
+data8 0x3fd3e3c43918f76c    //log(1/frcpa(1+220/256))/2
+data8 0x3fd3f2acb27ed6c7    //log(1/frcpa(1+221/256))/2
+data8 0x3fd4019c2125ca93    //log(1/frcpa(1+222/256))/2
+data8 0x3fd4181061389722    //log(1/frcpa(1+223/256))/2
+data8 0x3fd42711518df545    //log(1/frcpa(1+224/256))/2
+data8 0x3fd436194e12b6bf    //log(1/frcpa(1+225/256))/2
+data8 0x3fd445285d68ea69    //log(1/frcpa(1+226/256))/2
+data8 0x3fd45bcc464c893a    //log(1/frcpa(1+227/256))/2
+data8 0x3fd46aed21f117fc    //log(1/frcpa(1+228/256))/2
+data8 0x3fd47a1527e8a2d3    //log(1/frcpa(1+229/256))/2
+data8 0x3fd489445efffccc    //log(1/frcpa(1+230/256))/2
+data8 0x3fd4a018bcb69835    //log(1/frcpa(1+231/256))/2
+data8 0x3fd4af5a0c9d65d7    //log(1/frcpa(1+232/256))/2
+data8 0x3fd4bea2a5bdbe87    //log(1/frcpa(1+233/256))/2
+data8 0x3fd4cdf28f10ac46    //log(1/frcpa(1+234/256))/2
+data8 0x3fd4dd49cf994058    //log(1/frcpa(1+235/256))/2
+data8 0x3fd4eca86e64a684    //log(1/frcpa(1+236/256))/2
+data8 0x3fd503c43cd8eb68    //log(1/frcpa(1+237/256))/2
+data8 0x3fd513356667fc57    //log(1/frcpa(1+238/256))/2
+data8 0x3fd522ae0738a3d8    //log(1/frcpa(1+239/256))/2
+data8 0x3fd5322e26867857    //log(1/frcpa(1+240/256))/2
+data8 0x3fd541b5cb979809    //log(1/frcpa(1+241/256))/2
+data8 0x3fd55144fdbcbd62    //log(1/frcpa(1+242/256))/2
+data8 0x3fd560dbc45153c7    //log(1/frcpa(1+243/256))/2
+data8 0x3fd5707a26bb8c66    //log(1/frcpa(1+244/256))/2
+data8 0x3fd587f60ed5b900    //log(1/frcpa(1+245/256))/2
+data8 0x3fd597a7977c8f31    //log(1/frcpa(1+246/256))/2
+data8 0x3fd5a760d634bb8b    //log(1/frcpa(1+247/256))/2
+data8 0x3fd5b721d295f10f    //log(1/frcpa(1+248/256))/2
+data8 0x3fd5c6ea94431ef9    //log(1/frcpa(1+249/256))/2
+data8 0x3fd5d6bb22ea86f6    //log(1/frcpa(1+250/256))/2
+data8 0x3fd5e6938645d390    //log(1/frcpa(1+251/256))/2
+data8 0x3fd5f673c61a2ed2    //log(1/frcpa(1+252/256))/2
+data8 0x3fd6065bea385926    //log(1/frcpa(1+253/256))/2
+data8 0x3fd6164bfa7cc06b    //log(1/frcpa(1+254/256))/2
+data8 0x3fd62643fecf9743    //log(1/frcpa(1+255/256))/2
+LOCAL_OBJECT_END(atanhf_data2)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(atanhf)
+
+{ .mfi
+      getf.exp      rArgSExpb = f8
+      fclass.m      p9,p0 = f8, 0x0b        // is arg denormal ?
+      mov           rExpbMask = 0x1ffff
+}
+{ .mfi
+      addl          DataPtr = @ltoff(atanhf_data), gp
+      fnma.s1       fOneMx = f8, f1, f1     // 1 - x
+      mov           rBias = 0xffff
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fclass.m      p7,p0 = f8, 0xc7        // is arg NaN or +/-0 ?
+      mov           rNearZeroBound = 0xffeb // 2^(-20)
+}
+{ .mfi
+      ld8           DataPtr = [DataPtr]
+      fma.s1        fOnePx = f8, f1, f1     // 1 + x
+      nop.i         0
+}
+;;
+
+{ .mfb
+      nop.m         0
+      fnorm.s1      fNormX = f8                     // Normalize x
+(p9)  br.cond.spnt  ATANH_UNORM                     // Branch if x=unorm
+}
+;;
+
+ATANH_COMMON:
+// Return here if x=unorm and not denorm
+{ .mfi
+      ldfpd         fP3, fP2 = [DataPtr], 16
+      fma.s1        fX2 = f8, f8, f0        // x^2
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p7)  fma.s.s0      f8 =  f8,f1,f8          // NaN or +/-0
+(p7)  br.ret.spnt   b0
+}
+;;
+
+{ .mfi
+      ldfpd         fP1, fHalf = [DataPtr], 16
+      frcpa.s1      fRcpM, p9 = f1, fOneMx  // rcpm = frcpa(1 - x)
+      nop.i         0
+}
+;;
+
+{ .mfi
+      getf.exp      rExpbm = fOneMx
+      frcpa.s1      fRcpP, p0 = f1, fOnePx  // rcpp = frcpa(1 + x)
+      // biased exponent
+      and           rArgExpb = rArgSExpb, rExpbMask
+}
+;;
+
+{ .mmi
+      getf.exp      rExpbp = fOnePx
+      // is |x| < 2^(-20) ?
+      cmp.gt        p8,p0 = rNearZeroBound, rArgExpb
+      cmp.ge        p6,p0 = rArgExpb, rBias // is |x| >= 1 ?
+}
+;;
+
+{ .mmb
+      getf.sig      rSigm = fOneMx
+      nop.m         0
+(p6)  br.cond.spnt  atanhf_ge_one
+}
+;;
+
+{ .mfb
+      getf.sig      rSigp = fOnePx
+(p8)  fma.s.s0      f8 =  fX2, f8, f8  // x + x^3
+(p8)  br.ret.spnt   b0                 // Exit for MAX_DENORM_ABS < |x| < 2^-20
+}
+;;
+
+{ .mfi
+      ldfd          fLog2 = [DataPtr], 16
+      fms.s1        fRm = fRcpM, fOneMx, f1 // rm = rcpm * (1 - x) - 1
+      nop.i         0
+}
+;;
+
+{ .mmf
+      // (1 - x) is always positive here and we need not mask sign bit
+      sub           rNm = rExpbm, rBias
+      // (1 + x) is always positive here and we need not mask sign bit
+      sub           rNp = rExpbp, rBias
+      fms.s1        fRp = fRcpP, fOnePx, f1 // rp = rcpp * (1 + x) - 1
+}
+;;
+
+{ .mmi
+      setf.sig      fN4CvtM = rNm
+      setf.sig      fN4CvtP = rNp
+      extr.u        rIndm = rSigm,55,8                // Extract 8 bits
+}
+;;
+
+{ .mmi
+      shladd        RcpTablePtrM = rIndm, 3, DataPtr
+      nop.m         0
+      extr.u        rIndp = rSigp,55,8                // Extract 8 bits
+}
+;;
+
+{ .mmi
+      ldfd          fLogTm = [RcpTablePtrM]
+      shladd        RcpTablePtrP = rIndp, 3, DataPtr
+      nop.i         0
+}
+;;
+
+{ .mfi
+      ldfd          fLogTp = [RcpTablePtrP]
+      fma.s1        fRm2 = fRm, fRm, f0     // rm^2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        fP32m = fP3, fRm, fP2   // P3*rm + P2
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fRp2 = fRp, fRp, f0     // rp^2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        fP10m = fP1, fRm, fHalf   // P1*rm + 1
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s1        fP32p = fP3, fRp, fP2   // P3*rp + P2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        fP10p = fP1, fRp, fHalf   // P1*rp + 1
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fcvt.xf       fNm = fN4CvtM
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fcvt.xf       fNp = fN4CvtP
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      // (P3*rm + P2)*rm^2 + (P1*rm + 1)
+      fma.s1        fP32m = fP32m, fRm2, fP10m
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // (P3*rp + P2)*rp^2 + (P1*rp + 1)
+      fma.s1        fP32p = fP32p, fRp2, fP10p
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      // Nm*ln(2)/2 + Tm/2
+      fma.s1        fLogTm = fNm, fLog2, fLogTm
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // Np*ln(2)/2 + Tp/2
+      fma.s1        fLogTp = fNp, fLog2, fLogTp
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      // ((P3*rm + P2)*rm^2 + (P3*rm + 1))*0.5*rm + (Nm*ln(2)/2 + Tm/2)
+      fma.d.s1      fP32m = fP32m, fRm, fLogTm
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // ((P3*rp + P2)*rp^2 + (P3*rp + 1))*0.5*rp + (Np*ln(2)/2 + Tp/2)
+      fma.d.s1      fP32p = fP32p, fRp, fLogTp
+      nop.i         0
+}
+;;
+
+{ .mfb
+      nop.m         0
+      // atanhf(x) = 0.5 * (log(1 + x) - log(1 - x))
+      fnma.s.s0     f8 = fP32m, f1, fP32p
+      br.ret.sptk   b0                      // Exit for 2^(-20) <= |x| < 1.0
+}
+;;
+
+
+ATANH_UNORM:
+// Here if x=unorm
+{ .mfi
+      getf.exp      rArgSExpb = fNormX           // Recompute if x unorm
+      fclass.m      p0,p9 = fNormX, 0x0b         // Test x denorm
+      nop.i         0
+}
+;;
+
+{ .mfb
+      nop.m         0
+      fcmp.lt.s0    p10,p11 = f8, f0      // Set denormal flag
+(p9)  br.cond.sptk  ATANH_COMMON          // Continue if x unorm and not denorm
+}
+;;
+
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fnma.s.s0     f8 = f8,f8,f8                // Result x-x^2 if x=-denorm
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p7)  fma.s.s0      f8 = f8,f8,f8                // Result x+x^2 if x=+denorm
+      br.ret.spnt   b0                           // Exit if denorm
+}
+;;
+
+// Here if |x| >= 1.0
+atanhf_ge_one:
+{ .mfi
+      alloc         r32 = ar.pfs,1,3,4,0
+      fmerge.s      fArgAbs = f0, f8        // Form |x|
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fmerge.s      f10 = f8, f8            // Save input for error call
+      nop.i         0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fcmp.eq.s1    p6,p7 = fArgAbs, f1     // Test for |x| = 1.0
+      nop.i         0
+}
+;;
+
+// Set error tag and result, and raise invalid flag if |x| > 1.0
+{ .mfi
+(p7)  mov           atanh_GR_tag = 133
+(p7)  frcpa.s0      f8, p0 = f0, f0         // Get QNaN, and raise invalid
+      nop.i         0
+}
+;;
+
+// Set error tag and result, and raise Z flag if |x| = 1.0
+{ .mfi
+      nop.m         0
+(p6)  frcpa.s0      fRm, p0 = f1, f0        // Get inf, and raise Z flag
+      nop.i         0
+}
+;;
+
+{ .mfb
+(p6)  mov           atanh_GR_tag = 134
+(p6)  fmerge.s      f8 = f8, fRm            // result is +-inf
+      br.cond.sptk  __libm_error_region     // Exit if |x| >= 1.0
+}
+;;
+
+GLOBAL_LIBM_END(atanhf)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+{ .mfi
+      add           GR_Parameter_Y=-32,sp   // Parameter 2 value
+      nop.f         0
+.save   ar.pfs,GR_SAVE_PFS
+      mov           GR_SAVE_PFS=ar.pfs      // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+      add sp=-64,sp                         // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                     // Save gp
+};;
+
+{ .mmi
+      stfs [GR_Parameter_Y] = f1,16         // STORE Parameter 2 on stack
+      add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+{ .mib
+      stfs [GR_Parameter_X] = f10           // STORE Parameter 1 on stack
+      // Parameter 3 address
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+      nop.b 0
+}
+{ .mib
+      stfs [GR_Parameter_Y] = f8            // STORE Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support# // Call error handling function
+};;
+
+{ .mmi
+      add   GR_Parameter_RESULT = 48,sp
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmi
+      ldfs  f8 = [GR_Parameter_RESULT]      // Get return result off stack
+.restore sp
+      add   sp = 64,sp                      // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                 // Restore return address
+};;
+
+{ .mib
+      mov   gp = GR_SAVE_GP                 // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS            // Restore ar.pfs
+      br.ret.sptk     b0                    // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_atanhl.S b/sysdeps/ia64/fpu/e_atanhl.S
new file mode 100644
index 0000000000..cee1ba17b1
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_atanhl.S
@@ -0,0 +1,1156 @@
+.file "atanhl.s" 
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT 
+// LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,
+// EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA,OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code,and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History: 
+// 09/10/01  Initial version
+// 12/11/01  Corrected .restore syntax
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/10/03  Reordered header: .section, .global, .proc, .align;
+//           used data8 for long double table values
+//
+//*********************************************************************
+//
+//*********************************************************************
+//
+// Function: atanhl(x) computes the principle value of the inverse 
+// hyperbolic tangent of x.
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f8 (Input and Return Value)
+//                              f33-f73
+//
+//    General Purpose Registers:
+//      r32-r52
+//      r49-r52 (Used to pass arguments to error handling routine)
+//
+//    Predicate Registers:      p6-p15
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    atanhl(inf) = QNaN
+//    atanhl(-inf) = QNaN 
+//    atanhl(+/-0) = +/-0 
+//    atanhl(1) =  +inf 
+//    atanhl(-1) =  -inf 
+//    atanhl(|x|>1) = QNaN
+//    atanhl(SNaN) = QNaN
+//    atanhl(QNaN) = QNaN
+//
+//*********************************************************************
+//
+// Overview
+//
+// The method consists of two cases.
+//
+// If      |x| < 1/32  use case atanhl_near_zero;
+// else                 use case atanhl_regular;
+//
+// Case atanhl_near_zero:
+//
+//   atanhl(x) can be approximated by the Taylor series expansion
+//   up to order 17.
+//
+// Case atanhl_regular:
+//
+//   Here we use formula atanhl(x) = sign(x)*log1pl(2*|x|/(1-|x|))/2 and
+//   calculation is subdivided into two stages. The first stage is 
+//   calculating of X = 2*|x|/(1-|x|). The second one is calculating of 
+//   sign(x)*log1pl(X)/2. To obtain required accuracy we use precise division
+//   algorythm output of which is a pair of two extended precision values those
+//   approximate result of division with accuracy higher than working
+//   precision. This pair is passed to modified log1pl function.
+//
+//
+//   1. calculating of X = 2*|x|/(1-|x|)
+//   ( based on Peter Markstein's "IA-64 and Elementary Functions" book )
+//   ********************************************************************
+//
+//     a = 2*|x|
+//     b = 1 - |x|
+//     b_lo = |x| - (1 - b)
+//
+//     y = frcpa(b)         initial approximation of 1/b
+//     q = a*y              initial approximation of a/b
+//     
+//     e = 1 - b*y
+//     e2 = e + e^2
+//     e1 = e^2
+//     y1 = y + y*e2 = y + y*(e+e^2)
+//
+//     e3 = e + e1^2
+//     y2 = y + y1*e3 = y + y*(e+e^2+..+e^6)
+//
+//     r = a - b*q
+//     e = 1 - b*y2
+//     X = q + r*y2         high part of a/b
+//
+//     y3 = y2 + y2*e4
+//     r1 = a - b*X
+//     r1 = r1 - b_lo*X
+//     X_lo = r1*y3         low part of a/b
+//  
+//   2. special log1p algorithm overview
+//   ***********************************
+//
+//    Here we use a table lookup method. The basic idea is that in
+//    order to compute logl(Arg) = log1pl (Arg-1) for an argument Arg in [1,2), 
+//    we construct a value G such that G*Arg is close to 1 and that
+//    logl(1/G) is obtainable easily from a table of values calculated
+//    beforehand. Thus
+//
+//      logl(Arg) = logl(1/G) + logl(G*Arg)
+//           = logl(1/G) + logl(1 + (G*Arg - 1))
+//
+//    Because |G*Arg - 1| is small, the second term on the right hand
+//    side can be approximated by a short polynomial. We elaborate
+//    this method in several steps.
+//
+//    Step 0: Initialization
+//    ------
+//    We need to calculate logl(X + X_lo + 1). Obtain N, S_hi such that
+//
+//      X + X_lo + 1 = 2^N * ( S_hi + S_lo )   exactly
+//
+//    where S_hi in [1,2) and S_lo is a correction to S_hi in the sense
+//    that |S_lo| <= ulp(S_hi).
+//
+//    For the special version of log1p we add X_lo to S_lo (S_lo = S_lo + X_lo)
+//    !-----------------------------------------------------------------------!
+//
+//    Step 1: Argument Reduction
+//    ------
+//    Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
+//
+//      G := G_1 * G_2 * G_3
+//      r := (G * S_hi - 1) + G * S_lo
+//
+//    These G_j's have the property that the product is exactly 
+//    representable and that |r| < 2^(-12) as a result.
+//
+//    Step 2: Approximation
+//    ------
+//    logl(1 + r) is approximated by a short polynomial poly(r).
+//
+//    Step 3: Reconstruction
+//    ------
+//    Finally, log1pl(X + X_lo) = logl(X + X_lo + 1) is given by
+//
+//    logl(X + X_lo + 1) =  logl(2^N * (S_hi + S_lo))
+//                      ~=~ N*logl(2) + logl(1/G) + logl(1 + r)
+//                      ~=~ N*logl(2) + logl(1/G) + poly(r).
+//
+//    For detailed description see log1p1 function, regular path.
+//
+//*********************************************************************
+
+RODATA
+.align 64
+
+// ************* DO NOT CHANGE THE ORDER OF THESE TABLES *************
+
+LOCAL_OBJECT_START(Constants_TaylorSeries)
+data8  0xF0F0F0F0F0F0F0F1,0x00003FFA // C17
+data8  0x8888888888888889,0x00003FFB // C15
+data8  0x9D89D89D89D89D8A,0x00003FFB // C13
+data8  0xBA2E8BA2E8BA2E8C,0x00003FFB // C11
+data8  0xE38E38E38E38E38E,0x00003FFB // C9
+data8  0x9249249249249249,0x00003FFC // C7
+data8  0xCCCCCCCCCCCCCCCD,0x00003FFC // C5
+data8  0xAAAAAAAAAAAAAAAA,0x00003FFD // C3
+data4  0x3f000000                    // 1/2
+data4  0x00000000                    // pad 
+data4  0x00000000
+data4  0x00000000
+LOCAL_OBJECT_END(Constants_TaylorSeries)
+
+LOCAL_OBJECT_START(Constants_Q)
+data4  0x00000000,0xB1721800,0x00003FFE,0x00000000 // log2_hi
+data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000 // log2_lo
+data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000 // Q4
+data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000 // Q3
+data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000 // Q2
+data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000 // Q1
+LOCAL_OBJECT_END(Constants_Q)
+
+
+// Z1 - 16 bit fixed
+LOCAL_OBJECT_START(Constants_Z_1)
+data4  0x00008000
+data4  0x00007879
+data4  0x000071C8
+data4  0x00006BCB
+data4  0x00006667
+data4  0x00006187
+data4  0x00005D18
+data4  0x0000590C
+data4  0x00005556
+data4  0x000051EC
+data4  0x00004EC5
+data4  0x00004BDB
+data4  0x00004925
+data4  0x0000469F
+data4  0x00004445
+data4  0x00004211
+LOCAL_OBJECT_END(Constants_Z_1)
+
+// G1 and H1 - IEEE single and h1 - IEEE double
+LOCAL_OBJECT_START(Constants_G_H_h1)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F70F0F0,0x3D785196
+data8  0x3DA163A6617D741C
+data4  0x3F638E38,0x3DF13843
+data8  0x3E2C55E6CBD3D5BB
+data4  0x3F579430,0x3E2FF9A0
+data8  0xBE3EB0BFD86EA5E7
+data4  0x3F4CCCC8,0x3E647FD6
+data8  0x3E2E6A8C86B12760
+data4  0x3F430C30,0x3E8B3AE7
+data8  0x3E47574C5C0739BA
+data4  0x3F3A2E88,0x3EA30C68
+data8  0x3E20E30F13E8AF2F
+data4  0x3F321640,0x3EB9CEC8
+data8  0xBE42885BF2C630BD
+data4  0x3F2AAAA8,0x3ECF9927
+data8  0x3E497F3497E577C6
+data4  0x3F23D708,0x3EE47FC5
+data8  0x3E3E6A6EA6B0A5AB
+data4  0x3F1D89D8,0x3EF8947D
+data8  0xBDF43E3CD328D9BE
+data4  0x3F17B420,0x3F05F3A1
+data8  0x3E4094C30ADB090A
+data4  0x3F124920,0x3F0F4303
+data8  0xBE28FBB2FC1FE510
+data4  0x3F0D3DC8,0x3F183EBF
+data8  0x3E3A789510FDE3FA
+data4  0x3F088888,0x3F20EC80
+data8  0x3E508CE57CC8C98F
+data4  0x3F042108,0x3F29516A
+data8  0xBE534874A223106C
+LOCAL_OBJECT_END(Constants_G_H_h1)
+
+// Z2 - 16 bit fixed
+LOCAL_OBJECT_START(Constants_Z_2)
+data4  0x00008000
+data4  0x00007F81
+data4  0x00007F02
+data4  0x00007E85
+data4  0x00007E08
+data4  0x00007D8D
+data4  0x00007D12
+data4  0x00007C98
+data4  0x00007C20
+data4  0x00007BA8
+data4  0x00007B31
+data4  0x00007ABB
+data4  0x00007A45
+data4  0x000079D1
+data4  0x0000795D
+data4  0x000078EB
+LOCAL_OBJECT_END(Constants_Z_2)
+
+// G2 and H2 - IEEE single and h2 - IEEE double
+LOCAL_OBJECT_START(Constants_G_H_h2)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F7F00F8,0x3B7F875D
+data8  0x3DB5A11622C42273
+data4  0x3F7E03F8,0x3BFF015B
+data8  0x3DE620CF21F86ED3
+data4  0x3F7D08E0,0x3C3EE393
+data8  0xBDAFA07E484F34ED
+data4  0x3F7C0FC0,0x3C7E0586
+data8  0xBDFE07F03860BCF6
+data4  0x3F7B1880,0x3C9E75D2
+data8  0x3DEA370FA78093D6
+data4  0x3F7A2328,0x3CBDC97A
+data8  0x3DFF579172A753D0
+data4  0x3F792FB0,0x3CDCFE47
+data8  0x3DFEBE6CA7EF896B
+data4  0x3F783E08,0x3CFC15D0
+data8  0x3E0CF156409ECB43
+data4  0x3F774E38,0x3D0D874D
+data8  0xBE0B6F97FFEF71DF
+data4  0x3F766038,0x3D1CF49B
+data8  0xBE0804835D59EEE8
+data4  0x3F757400,0x3D2C531D
+data8  0x3E1F91E9A9192A74
+data4  0x3F748988,0x3D3BA322
+data8  0xBE139A06BF72A8CD
+data4  0x3F73A0D0,0x3D4AE46F
+data8  0x3E1D9202F8FBA6CF
+data4  0x3F72B9D0,0x3D5A1756
+data8  0xBE1DCCC4BA796223
+data4  0x3F71D488,0x3D693B9D
+data8  0xBE049391B6B7C239
+LOCAL_OBJECT_END(Constants_G_H_h2)
+
+// G3 and H3 - IEEE single and h3 - IEEE double 
+LOCAL_OBJECT_START(Constants_G_H_h3)
+data4  0x3F7FFC00,0x38800100
+data8  0x3D355595562224CD
+data4  0x3F7FF400,0x39400480
+data8  0x3D8200A206136FF6
+data4  0x3F7FEC00,0x39A00640
+data8  0x3DA4D68DE8DE9AF0
+data4  0x3F7FE400,0x39E00C41
+data8  0xBD8B4291B10238DC
+data4  0x3F7FDC00,0x3A100A21
+data8  0xBD89CCB83B1952CA
+data4  0x3F7FD400,0x3A300F22
+data8  0xBDB107071DC46826
+data4  0x3F7FCC08,0x3A4FF51C
+data8  0x3DB6FCB9F43307DB
+data4  0x3F7FC408,0x3A6FFC1D
+data8  0xBD9B7C4762DC7872
+data4  0x3F7FBC10,0x3A87F20B
+data8  0xBDC3725E3F89154A
+data4  0x3F7FB410,0x3A97F68B
+data8  0xBD93519D62B9D392
+data4  0x3F7FAC18,0x3AA7EB86
+data8  0x3DC184410F21BD9D
+data4  0x3F7FA420,0x3AB7E101
+data8  0xBDA64B952245E0A6
+data4  0x3F7F9C20,0x3AC7E701
+data8  0x3DB4B0ECAABB34B8
+data4  0x3F7F9428,0x3AD7DD7B
+data8  0x3D9923376DC40A7E
+data4  0x3F7F8C30,0x3AE7D474
+data8  0x3DC6E17B4F2083D3
+data4  0x3F7F8438,0x3AF7CBED
+data8  0x3DAE314B811D4394
+data4  0x3F7F7C40,0x3B03E1F3
+data8  0xBDD46F21B08F2DB1
+data4  0x3F7F7448,0x3B0BDE2F
+data8  0xBDDC30A46D34522B
+data4  0x3F7F6C50,0x3B13DAAA
+data8  0x3DCB0070B1F473DB
+data4  0x3F7F6458,0x3B1BD766
+data8  0xBDD65DDC6AD282FD
+data4  0x3F7F5C68,0x3B23CC5C
+data8  0xBDCDAB83F153761A
+data4  0x3F7F5470,0x3B2BC997
+data8  0xBDDADA40341D0F8F
+data4  0x3F7F4C78,0x3B33C711
+data8  0x3DCD1BD7EBC394E8
+data4  0x3F7F4488,0x3B3BBCC6
+data8  0xBDC3532B52E3E695
+data4  0x3F7F3C90,0x3B43BAC0
+data8  0xBDA3961EE846B3DE
+data4  0x3F7F34A0,0x3B4BB0F4
+data8  0xBDDADF06785778D4
+data4  0x3F7F2CA8,0x3B53AF6D
+data8  0x3DCC3ED1E55CE212
+data4  0x3F7F24B8,0x3B5BA620
+data8  0xBDBA31039E382C15
+data4  0x3F7F1CC8,0x3B639D12
+data8  0x3D635A0B5C5AF197
+data4  0x3F7F14D8,0x3B6B9444
+data8  0xBDDCCB1971D34EFC
+data4  0x3F7F0CE0,0x3B7393BC
+data8  0x3DC7450252CD7ADA
+data4  0x3F7F04F0,0x3B7B8B6D
+data8  0xBDB68F177D7F2A42
+LOCAL_OBJECT_END(Constants_G_H_h3)
+
+
+
+// Floating Point Registers
+
+FR_C17              = f50
+FR_C15              = f51
+FR_C13              = f52
+FR_C11              = f53
+FR_C9               = f54
+FR_C7               = f55
+FR_C5               = f56
+FR_C3               = f57
+FR_x2               = f58
+FR_x3               = f59
+FR_x4               = f60
+FR_x8               = f61
+
+FR_Rcp              = f61
+
+FR_A                = f33
+FR_R1               = f33
+
+FR_E1               = f34
+FR_E3               = f34
+FR_Y2               = f34
+FR_Y3               = f34
+
+FR_E2               = f35
+FR_Y1               = f35
+
+FR_B                = f36
+FR_Y0               = f37
+FR_E0               = f38
+FR_E4               = f39
+FR_Q0               = f40
+FR_R0               = f41
+FR_B_lo             = f42
+
+FR_abs_x            = f43
+FR_Bp               = f44
+FR_Bn               = f45
+FR_Yp               = f46
+FR_Yn               = f47
+
+FR_X                = f48
+FR_BB               = f48
+FR_X_lo             = f49
+
+FR_G                = f50
+FR_Y_hi             = f51
+FR_H                = f51
+FR_h                = f52
+FR_G2               = f53
+FR_H2               = f54
+FR_h2               = f55
+FR_G3               = f56
+FR_H3               = f57
+FR_h3               = f58
+
+FR_Q4               = f59
+FR_poly_lo          = f59
+FR_Y_lo             = f59
+
+FR_Q3               = f60
+FR_Q2               = f61
+
+FR_Q1               = f62
+FR_poly_hi          = f62
+
+FR_float_N          = f63
+
+FR_AA               = f64
+FR_S_lo             = f64
+
+FR_S_hi             = f65
+FR_r                = f65
+
+FR_log2_hi          = f66
+FR_log2_lo          = f67
+FR_Z                = f68
+FR_2_to_minus_N     = f69
+FR_rcub             = f70
+FR_rsq              = f71
+FR_05r              = f72
+FR_Half             = f73
+
+FR_Arg_X            = f50
+FR_Arg_Y            = f0
+FR_RESULT           = f8
+
+
+
+// General Purpose Registers
+
+GR_ad_05            = r33
+GR_Index1           = r34
+GR_ArgExp           = r34
+GR_Index2           = r35
+GR_ExpMask          = r35
+GR_NearZeroBound    = r36
+GR_signif           = r36
+GR_X_0              = r37
+GR_X_1              = r37
+GR_X_2              = r38
+GR_Index3           = r38
+GR_minus_N          = r39
+GR_Z_1              = r40
+GR_Z_2              = r40
+GR_N                = r41
+GR_Bias             = r42
+GR_M                = r43
+GR_ad_taylor        = r44
+GR_ad_taylor_2      = r45
+GR_ad2_tbl_3        = r45
+GR_ad_tbl_1         = r46
+GR_ad_tbl_2         = r47
+GR_ad_tbl_3         = r48
+GR_ad_q             = r49
+GR_ad_z_1           = r50
+GR_ad_z_2           = r51
+GR_ad_z_3           = r52
+
+//
+// Added for unwind support
+//
+GR_SAVE_PFS         = r46
+GR_SAVE_B0          = r47
+GR_SAVE_GP          = r48
+GR_Parameter_X      = r49
+GR_Parameter_Y      = r50
+GR_Parameter_RESULT = r51
+GR_Parameter_TAG    = r52
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(atanhl)
+
+{ .mfi
+      alloc         r32 = ar.pfs,0,17,4,0
+      fnma.s1       FR_Bp = f8,f1,f1 // b = 1 - |arg| (for x>0)
+      mov           GR_ExpMask = 0x1ffff
+}                    
+{ .mfi                
+      addl          GR_ad_taylor = @ltoff(Constants_TaylorSeries),gp
+      fma.s1        FR_Bn = f8,f1,f1 // b = 1 - |arg| (for x<0)
+      mov           GR_NearZeroBound = 0xfffa  // biased exp of 1/32
+};;                    
+{ .mfi                
+      getf.exp      GR_ArgExp = f8
+      fcmp.lt.s1    p6,p7 = f8,f0 // is negative?
+      nop.i         0
+}                    
+{ .mfi                
+      ld8           GR_ad_taylor = [GR_ad_taylor]
+      fmerge.s      FR_abs_x =  f1,f8
+      nop.i         0
+};;                    
+{ .mfi                
+      nop.m         0
+      fclass.m      p8,p0 = f8,0x1C7 // is arg NaT,Q/SNaN or +/-0 ?
+      nop.i         0
+}
+{ .mfi                
+      nop.m         0
+      fma.s1        FR_x2 = f8,f8,f0
+      nop.i         0
+};;                    
+{ .mfi                
+      add           GR_ad_z_1 = 0x0F0,GR_ad_taylor
+      fclass.m      p9,p0 = f8,0x0a // is arg -denormal ?
+      add           GR_ad_taylor_2 = 0x010,GR_ad_taylor
+}                    
+{ .mfi                
+      add           GR_ad_05 = 0x080,GR_ad_taylor
+      nop.f         0
+      nop.i         0
+};;                    
+{ .mfi                
+      ldfe          FR_C17 = [GR_ad_taylor],32
+      fclass.m      p10,p0 = f8,0x09 // is arg +denormal ?
+      add           GR_ad_tbl_1 = 0x040,GR_ad_z_1 // point to Constants_G_H_h1
+}                    
+{ .mfb                
+      add           GR_ad_z_2 = 0x140,GR_ad_z_1 // point to Constants_Z_2
+ (p8) fma.s0        f8 =  f8,f1,f0 // NaN or +/-0
+ (p8) br.ret.spnt   b0             // exit for Nan or +/-0
+};;                    
+{ .mfi                
+      ldfe          FR_C15 = [GR_ad_taylor_2],32
+      fclass.m      p15,p0 = f8,0x23 // is +/-INF ?
+      add           GR_ad_tbl_2 = 0x180,GR_ad_z_1 // point to Constants_G_H_h2
+}                    
+{ .mfb                
+      ldfe          FR_C13 = [GR_ad_taylor],32
+ (p9) fnma.s0       f8 =  f8,f8,f8 // -denormal
+ (p9) br.ret.spnt   b0             // exit for -denormal
+};;                    
+{ .mfi                
+      ldfe          FR_C11 = [GR_ad_taylor_2],32
+      fcmp.eq.s0       p13,p0 = FR_abs_x,f1 // is |arg| = 1?
+      nop.i         0
+}                    
+{ .mfb                
+      ldfe          FR_C9 = [GR_ad_taylor],32
+(p10) fma.s0        f8 =  f8,f8,f8 // +denormal
+(p10) br.ret.spnt   b0             // exit for +denormal
+};;                    
+{ .mfi                
+      ldfe          FR_C7 = [GR_ad_taylor_2],32
+ (p6) frcpa.s1      FR_Yn,p11 = f1,FR_Bn // y = frcpa(b)
+      and           GR_ArgExp = GR_ArgExp,GR_ExpMask // biased exponent
+}                    
+{ .mfb                
+      ldfe          FR_C5 = [GR_ad_taylor],32
+      fnma.s1       FR_B = FR_abs_x,f1,f1 // b = 1 - |arg|
+(p15) br.cond.spnt  atanhl_gt_one // |arg| > 1
+};;
+{ .mfb
+      cmp.gt        p14,p0 = GR_NearZeroBound,GR_ArgExp
+ (p7) frcpa.s1      FR_Yp,p12 = f1,FR_Bp // y = frcpa(b)
+(p13) br.cond.spnt  atanhl_eq_one // |arg| = 1/32
+}
+{ .mfb
+      ldfe          FR_C3 = [GR_ad_taylor_2],32
+      fma.s1        FR_A = FR_abs_x,f1,FR_abs_x // a = 2 * |arg|
+(p14) br.cond.spnt  atanhl_near_zero // |arg| < 1/32
+};;
+{ .mfi
+      nop.m         0
+      fcmp.gt.s0       p8,p0 = FR_abs_x,f1 // is |arg| > 1 ?
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+ (p6) fnma.s1       FR_B_lo = FR_Bn,f1,f1 // argt = 1 - (1 - |arg|)
+      nop.i         0
+}
+{ .mfi
+      ldfs          FR_Half = [GR_ad_05]
+ (p7) fnma.s1       FR_B_lo = FR_Bp,f1,f1
+      nop.i         0
+};;                    
+{ .mfi
+      nop.m         0
+ (p6) fnma.s1       FR_E0 = FR_Yn,FR_Bn,f1 // e = 1-b*y 
+      nop.i         0
+}                    
+{ .mfb                
+      nop.m         0
+ (p6) fma.s1        FR_Y0 = FR_Yn,f1,f0
+ (p8) br.cond.spnt  atanhl_gt_one // |arg| > 1
+};;
+{ .mfi
+      nop.m         0
+ (p7) fnma.s1       FR_E0 = FR_Yp,FR_Bp,f1 
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+ (p6) fma.s1        FR_Q0 = FR_A,FR_Yn,f0 // q = a*y
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+ (p7) fma.s1        FR_Q0 = FR_A,FR_Yp,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+ (p7) fma.s1        FR_Y0 = FR_Yp,f1,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fclass.nm     p10,p0 = f8,0x1FF  // test for unsupported
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_E2 = FR_E0,FR_E0,FR_E0 // e2 = e+e^2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_E1 = FR_E0,FR_E0,f0 // e1 = e^2
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+//    Return generated NaN or other value for unsupported values.
+(p10) fma.s0        f8 = f8, f0, f0
+(p10) br.ret.spnt   b0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Y1 = FR_Y0,FR_E2,FR_Y0 // y1 = y+y*e2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_E3 = FR_E1,FR_E1,FR_E0 // e3 = e+e1^2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_B_lo = FR_abs_x,f1,FR_B_lo // b_lo = argt-|arg|
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Y2 = FR_Y1,FR_E3,FR_Y0 // y2 = y+y1*e3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_R0 = FR_B,FR_Q0,FR_A // r = a-b*q
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_E4 = FR_B,FR_Y2,f1 // e4 = 1-b*y2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_X = FR_R0,FR_Y2,FR_Q0 // x = q+r*y2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Z = FR_X,f1,f1 // x+1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+ (p6) fnma.s1       FR_Half = FR_Half,f1,f0 // sign(arg)/2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Y3 = FR_Y2,FR_E4,FR_Y2 // y3 = y2+y2*e4
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_R1 = FR_B,FR_X,FR_A // r1 = a-b*x
+      nop.i         0
+};;
+{ .mfi
+      getf.sig      GR_signif = FR_Z // get significand of x+1
+      nop.f         0
+      nop.i         0
+};;
+
+
+{ .mfi
+      add           GR_ad_q = -0x060,GR_ad_z_1
+      nop.f         0
+      extr.u        GR_Index1 = GR_signif,59,4 // get high 4 bits of signif
+}
+{ .mfi
+      add           GR_ad_tbl_3 = 0x280,GR_ad_z_1 // point to Constants_G_H_h3
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      shladd        GR_ad_z_1 = GR_Index1,2,GR_ad_z_1 // point to Z_1
+      nop.f         0
+      extr.u        GR_X_0 = GR_signif,49,15 // get high 15 bits of significand
+};;
+{ .mfi
+      ld4           GR_Z_1 = [GR_ad_z_1] // load Z_1
+      fmax.s1       FR_AA = FR_X,f1 // for S_lo,form AA = max(X,1.0)
+      nop.i         0
+}
+{ .mfi
+      shladd        GR_ad_tbl_1 = GR_Index1,4,GR_ad_tbl_1 // point to G_1
+      nop.f         0
+      mov           GR_Bias = 0x0FFFF // exponent bias
+};;
+{ .mfi
+      ldfps         FR_G,FR_H = [GR_ad_tbl_1],8  // load G_1,H_1
+      fmerge.se     FR_S_hi =  f1,FR_Z // form |x+1|
+      nop.i         0
+};;
+{ .mfi
+      getf.exp      GR_N =  FR_Z // get N = exponent of x+1
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfd          FR_h = [GR_ad_tbl_1] // load h_1
+      fnma.s1       FR_R1 = FR_B_lo,FR_X,FR_R1 // r1 = r1-b_lo*x
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_log2_hi = [GR_ad_q],16 // load log2_hi
+      nop.f         0
+      pmpyshr2.u    GR_X_1 = GR_X_0,GR_Z_1,15 // get bits 30-15 of X_0 * Z_1
+};;
+//
+//    For performance,don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      ldfe          FR_log2_lo = [GR_ad_q],16 // load log2_lo
+      nop.f         0
+      sub           GR_N = GR_N,GR_Bias 
+};;
+{ .mfi
+      ldfe          FR_Q4 = [GR_ad_q],16  // load Q4
+      fms.s1        FR_S_lo = FR_AA,f1,FR_Z // form S_lo = AA - Z 
+      sub           GR_minus_N = GR_Bias,GR_N // form exponent of 2^(-N)
+};;
+{ .mmf
+      ldfe          FR_Q3 = [GR_ad_q],16 // load Q3
+      // put integer N into rightmost significand
+      setf.sig      FR_float_N = GR_N
+      fmin.s1       FR_BB = FR_X,f1 // for S_lo,form BB = min(X,1.0)
+};;
+{ .mfi
+      ldfe          FR_Q2 = [GR_ad_q],16 // load Q2
+      nop.f         0
+      extr.u        GR_Index2 = GR_X_1,6,4 // extract bits 6-9 of X_1 
+};;
+{ .mmi
+      ldfe          FR_Q1 = [GR_ad_q] // load Q1
+      shladd        GR_ad_z_2 = GR_Index2,2,GR_ad_z_2 // point to Z_2
+      nop.i         0
+};;
+{ .mmi
+      ld4           GR_Z_2 = [GR_ad_z_2] // load Z_2
+      shladd        GR_ad_tbl_2 = GR_Index2,4,GR_ad_tbl_2 // point to G_2
+      nop.i         0
+};;
+{ .mfi
+      ldfps         FR_G2,FR_H2 = [GR_ad_tbl_2],8 // load G_2,H_2
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      ldfd          FR_h2 = [GR_ad_tbl_2] // load h_2
+      fma.s1        FR_S_lo = FR_S_lo,f1,FR_BB // S_lo = S_lo + BB
+      nop.i         0
+}
+{ .mfi
+      setf.exp      FR_2_to_minus_N = GR_minus_N // form 2^(-N)
+      fma.s1        FR_X_lo = FR_R1,FR_Y3,f0 // x_lo = r1*y3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      nop.f         0
+      pmpyshr2.u    GR_X_2 = GR_X_1,GR_Z_2,15 // get bits 30-15 of X_1 * Z_2
+};;
+//
+//    For performance,don't use result of pmpyshr2.u for 4 cycles
+//
+{ .mfi
+      add           GR_ad2_tbl_3 = 8,GR_ad_tbl_3
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      nop.f         0 
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      nop.f         0 
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      nop.f         0 
+      nop.i         0
+};;
+
+//
+//    Now GR_X_2 can be used
+//
+{ .mfi
+      nop.m         0
+      nop.f         0
+      extr.u        GR_Index3 = GR_X_2,1,5 // extract bits 1-5 of X_2
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S_lo = FR_S_lo,f1,FR_X_lo // S_lo = S_lo + Arg_lo
+      nop.i         0
+};;
+
+{ .mfi
+      shladd        GR_ad_tbl_3 = GR_Index3,4,GR_ad_tbl_3 // point to G_3
+      fcvt.xf       FR_float_N = FR_float_N
+      nop.i         0
+}
+{ .mfi
+      shladd        GR_ad2_tbl_3 = GR_Index3,4,GR_ad2_tbl_3 // point to h_3
+      fma.s1        FR_Q1 = FR_Q1,FR_Half,f0 // sign(arg)*Q1/2
+      nop.i         0
+};;
+{ .mmi
+      ldfps         FR_G3,FR_H3 = [GR_ad_tbl_3],8 // load G_3,H_3
+      ldfd          FR_h3 = [GR_ad2_tbl_3] // load h_3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fmpy.s1       FR_G = FR_G,FR_G2 // G = G_1 * G_2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fadd.s1       FR_H = FR_H,FR_H2 // H = H_1 + H_2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fadd.s1       FR_h = FR_h,FR_h2 // h = h_1 + h_2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // S_lo = S_lo * 2^(-N)
+      fma.s1        FR_S_lo = FR_S_lo,FR_2_to_minus_N,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fmpy.s1       FR_G = FR_G,FR_G3 // G = (G_1 * G_2) * G_3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fadd.s1       FR_H = FR_H,FR_H3 // H = (H_1 + H_2) + H_3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fadd.s1       FR_h = FR_h,FR_h3 // h = (h_1 + h_2) + h_3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_r = FR_G,FR_S_hi,f1 // r = G * S_hi - 1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // Y_hi = N * log2_hi + H
+      fma.s1        FR_Y_hi = FR_float_N,FR_log2_hi,FR_H
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_h = FR_float_N,FR_log2_lo,FR_h // h = N * log2_lo + h
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_r = FR_G,FR_S_lo,FR_r // r = G * S_lo + (G * S_hi - 1)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_poly_lo = FR_r,FR_Q4,FR_Q3 // poly_lo = r * Q4 + Q3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fmpy.s1       FR_rsq = FR_r,FR_r // rsq = r * r
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_05r = FR_r,FR_Half,f0 // sign(arg)*r/2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1        FR_poly_lo = FR_poly_lo,FR_r,FR_Q2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rcub = FR_rsq,FR_r,f0 // rcub = r^3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // poly_hi = sing(arg)*(Q1*r^2 + r)/2
+      fma.s1        FR_poly_hi = FR_Q1,FR_rsq,FR_05r
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1        FR_poly_lo = FR_poly_lo,FR_rcub,FR_h
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // Y_lo = poly_hi + poly_lo/2
+      fma.s0        FR_Y_lo = FR_poly_lo,FR_Half,FR_poly_hi
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+     // Result = arctanh(x) = Y_hi/2 + Y_lo
+      fma.s0        f8 = FR_Y_hi,FR_Half,FR_Y_lo
+      br.ret.sptk   b0
+};;
+
+// Taylor's series
+atanhl_near_zero:
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x3 = FR_x2,f8,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x4 = FR_x2,FR_x2,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C17 = FR_C17,FR_x2,FR_C15
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C13 = FR_C13,FR_x2,FR_C11
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C9 = FR_C9,FR_x2,FR_C7
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C5 = FR_C5,FR_x2,FR_C3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x8 = FR_x4,FR_x4,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C17 = FR_C17,FR_x4,FR_C13
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C9 = FR_C9,FR_x4,FR_C5
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C17 = FR_C17,FR_x8,FR_C9
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fma.s0        f8 = FR_C17,FR_x3,f8
+      br.ret.sptk   b0 
+};;
+
+atanhl_eq_one:
+{ .mfi
+      nop.m         0
+      frcpa.s0      FR_Rcp,p0 = f1,f0 // get inf,and raise Z flag
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_Arg_X = f8, f8
+      nop.i         0
+};;
+{ .mfb
+      mov           GR_Parameter_TAG = 130
+      fmerge.s      FR_RESULT = f8,FR_Rcp // result is +-inf
+      br.cond.sptk  __libm_error_region // exit if |x| = 1.0
+};;
+
+atanhl_gt_one:
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_Arg_X = f8, f8
+      nop.i         0
+};;
+{ .mfb
+      mov           GR_Parameter_TAG = 129
+      frcpa.s0      FR_RESULT,p0 = f0,f0 // get QNaN,and raise invalid
+      br.cond.sptk  __libm_error_region // exit if |x| > 1.0
+};;
+
+GLOBAL_LIBM_END(atanhl)
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfe [GR_Parameter_Y] = FR_Arg_Y,16     // Save Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0,GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
+};;
+.body
+{ .mib
+        stfe [GR_Parameter_X] = FR_Arg_X        // Store Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+        nop.b 0                                 // Parameter 3 address
+}
+{ .mib
+        stfe [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region#)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_cosh.S b/sysdeps/ia64/fpu/e_cosh.S
index 205653d4bf..885456b389 100644
--- a/sysdeps/ia64/fpu/e_cosh.S
+++ b/sysdeps/ia64/fpu/e_cosh.S
@@ -1,10 +1,10 @@
 .file "cosh.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1081 +20,801 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version 
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-//
+// 05/07/01 Reworked to improve speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 11/15/02 Improved speed with new algorithm
+// 03/31/05 Reformatted delimiters between data tables
+
 // API
 //==============================================================
-// double = cosh(double)
-// input  floating point f8
-// output floating point f8
-
+// double cosh(double)
 
 // Overview of operation
 //==============================================================
-// There are four paths
+// Case 1:  0 < |x| < 0.25
+//  Evaluate cosh(x) by a 12th order polynomial
+//  Care is take for the order of multiplication; and A2 is not exactly 1/4!,
+//  A3 is not exactly 1/6!, etc.
+//  cosh(x) = 1 + (A1*x^2 + A2*x^4 + A3*x^6 + A4*x^8 + A5*x^10 + A6*x^12)
+//
+// Case 2:  0.25 < |x| < 710.47586
+//  Algorithm is based on the identity cosh(x) = ( exp(x) + exp(-x) ) / 2.
+//  The algorithm for exp is described as below.  There are a number of
+//  economies from evaluating both exp(x) and exp(-x).  Although we
+//  are evaluating both quantities, only where the quantities diverge do we
+//  duplicate the computations.  The basic algorithm for exp(x) is described
+//  below.
+//
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 128/log2
+//  n = int(w)
+//  x = n log2/128 + r + delta
 
-// 1. |x| < 0.25        COSH_BY_POLY
-// 2. |x| < 32          COSH_BY_TBL
-// 3. |x| < 2^14        COSH_BY_EXP
-// 4. |x_ >= 2^14       COSH_HUGE
+//  n = 128M + index_1 + 2^4 index_2
+//  x = M log2 + (log2/128) index_1 + (log2/8) index_2 + r + delta
 
-// For paths 1, and 2 SAFE is always 1.
-// For path  4, Safe is always 0.
-// SAFE = 1 means we cannot overflow.
+//  exp(x) = 2^M  2^(index_1/128)  2^(index_2/8) exp(r) exp(delta)
+//       Construct 2^M
+//       Get 2^(index_1/128) from table_1;
+//       Get 2^(index_2/8)   from table_2;
+//       Calculate exp(r) by 5th order polynomial
+//          r = x - n (log2/128)_high
+//          delta = - n (log2/128)_low
+//       Calculate exp(delta) as 1 + delta
 
-#include "libm_support.h"
 
-// Assembly macros
+// Special values
 //==============================================================
-cosh_FR_X            = f44
-cosh_FR_SGNX         = f40
-
-cosh_FR_Inv_log2by64 = f9
-cosh_FR_log2by64_lo  = f11
-cosh_FR_log2by64_hi  = f10
-
-cosh_FR_A1           = f9
-cosh_FR_A2           = f10
-cosh_FR_A3           = f11
-
-cosh_FR_Rcub         = f12
-cosh_FR_M_temp       = f13
-cosh_FR_R_temp       = f13
-cosh_FR_Rsq          = f13
-cosh_FR_R            = f14
-
-cosh_FR_M            = f38
-
-cosh_FR_B1           = f15
-cosh_FR_B2           = f32
-cosh_FR_B3           = f33
-
-cosh_FR_peven_temp1  = f34
-cosh_FR_peven_temp2  = f35
-cosh_FR_peven        = f36
-
-cosh_FR_podd_temp1   = f34
-cosh_FR_podd_temp2   = f35
-cosh_FR_podd         = f37
-
-cosh_FR_J_temp       = f9
-cosh_FR_J            = f10
+// cosh(+0)    = 1.0
+// cosh(-0)    = 1.0
 
-cosh_FR_Mmj          = f39
+// cosh(+qnan) = +qnan
+// cosh(-qnan) = -qnan
+// cosh(+snan) = +qnan
+// cosh(-snan) = -qnan
 
-cosh_FR_N_temp1      = f11
-cosh_FR_N_temp2      = f12
-cosh_FR_N            = f13
+// cosh(-inf)  = +inf
+// cosh(+inf)  = +inf
 
-cosh_FR_spos         = f14
-cosh_FR_sneg         = f15
-
-cosh_FR_Tjhi         = f32
-cosh_FR_Tjlo         = f33
-cosh_FR_Tmjhi        = f34
-cosh_FR_Tmjlo        = f35
-
-GR_mJ           = r35
-GR_J            = r36
-
-AD_mJ           = r38
-AD_J            = r39
-
-cosh_FR_C_hi         = f9
-cosh_FR_C_hi_temp    = f10
-cosh_FR_C_lo_temp1   = f11 
-cosh_FR_C_lo_temp2   = f12 
-cosh_FR_C_lo_temp3   = f13 
-
-cosh_FR_C_lo         = f38
-cosh_FR_S_hi         = f39
-
-cosh_FR_S_hi_temp1   = f10
-cosh_FR_Y_hi         = f11 
-cosh_FR_Y_lo_temp    = f12 
-cosh_FR_Y_lo         = f13 
-cosh_FR_COSH         = f9
-
-cosh_FR_X2           = f9
-cosh_FR_X4           = f10
-
-cosh_FR_P1           = f14
-cosh_FR_P2           = f15
-cosh_FR_P3           = f32
-cosh_FR_P4           = f33
-cosh_FR_P5           = f34
-cosh_FR_P6           = f35
-
-cosh_FR_TINY_THRESH  = f9
-
-cosh_FR_COSH_temp    = f10
-cosh_FR_SCALE        = f11 
+// Overflow and Underflow
+//=======================
+// cosh(x) = largest double normal when
+//     x = 710.47586 = 0x408633ce8fb9f87d
+//
+// There is no underflow.
 
-cosh_FR_hi_lo = f10
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input, output
+// f6 -> f15,  f32 -> f61
 
-cosh_FR_poly_podd_temp1    =  f11 
-cosh_FR_poly_podd_temp2    =  f13
-cosh_FR_poly_peven_temp1   =  f11
-cosh_FR_poly_peven_temp2   =  f13
+// General registers used:
+// r14 -> r40
 
-GR_SAVE_PFS                    = r41
-GR_SAVE_B0                     = r42
-GR_SAVE_GP                     = r43
+// Predicate registers used:
+// p6 -> p15
 
-GR_Parameter_X                 = r44
-GR_Parameter_Y                 = r45
-GR_Parameter_RESULT            = r46
+// Assembly macros
+//==============================================================
 
+rRshf                 = r14
+rN_neg                = r14
+rAD_TB1               = r15
+rAD_TB2               = r16
+rAD_P                 = r17
+rN                    = r18
+rIndex_1              = r19
+rIndex_2_16           = r20
+rM                    = r21
+rBiased_M             = r21
+rSig_inv_ln2          = r22
+rIndex_1_neg          = r22
+rExp_bias             = r23
+rExp_bias_minus_1     = r23
+rExp_mask             = r24
+rTmp                  = r24
+rGt_ln                = r24
+rIndex_2_16_neg       = r24
+rM_neg                = r25
+rBiased_M_neg         = r25
+rRshf_2to56           = r26
+rAD_T1_neg            = r26
+rExp_2tom56           = r28
+rAD_T2_neg            = r28
+rAD_T1                = r29
+rAD_T2                = r30
+rSignexp_x            = r31
+rExp_x                = r31
+
+GR_SAVE_B0            = r33
+GR_SAVE_PFS           = r34
+GR_SAVE_GP            = r35
+GR_SAVE_SP            = r36
+
+GR_Parameter_X        = r37
+GR_Parameter_Y        = r38
+GR_Parameter_RESULT   = r39
+GR_Parameter_TAG      = r40
+
+
+FR_X                  = f10
+FR_Y                  = f1
+FR_RESULT             = f8
+
+fRSHF_2TO56           = f6
+fINV_LN2_2TO63        = f7
+fW_2TO56_RSH          = f9
+f2TOM56               = f11
+fP5                   = f12
+fP4                   = f13
+fP3                   = f14
+fP2                   = f15
+
+fLn2_by_128_hi        = f33
+fLn2_by_128_lo        = f34
+
+fRSHF                 = f35
+fNfloat               = f36
+fNormX                = f37
+fR                    = f38
+fF                    = f39
+
+fRsq                  = f40
+f2M                   = f41
+fS1                   = f42
+fT1                   = f42
+fS2                   = f43
+fT2                   = f43
+fS                    = f43
+fWre_urm_f8           = f44
+fAbsX                 = f44
+
+fMIN_DBL_OFLOW_ARG    = f45
+fMAX_DBL_NORM_ARG     = f46
+fXsq                  = f47
+fX4                   = f48
+fGt_pln               = f49
+fTmp                  = f49
+
+fP54                  = f50
+fP5432                = f50
+fP32                  = f51
+fP                    = f52
+fP54_neg              = f53
+fP5432_neg            = f53
+fP32_neg              = f54
+fP_neg                = f55
+fF_neg                = f56
+
+f2M_neg               = f57
+fS1_neg               = f58
+fT1_neg               = f58
+fS2_neg               = f59
+fT2_neg               = f59
+fS_neg                = f59
+fExp                  = f60
+fExp_neg              = f61
+
+fA6                   = f50
+fA65                  = f50
+fA6543                = f50
+fA654321              = f50
+fA5                   = f51
+fA4                   = f52
+fA43                  = f52
+fA3                   = f53
+fA2                   = f54
+fA21                  = f54
+fA1                   = f55
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+RODATA
 .align 16
-double_cosh_arg_reduction:
-ASM_TYPE_DIRECTIVE(double_cosh_arg_reduction,@object)
-   data8 0xB8AA3B295C17F0BC, 0x00004005
-   data8 0xB17217F7D1000000, 0x00003FF8
-   data8 0xCF79ABC9E3B39804, 0x00003FD0
-ASM_SIZE_DIRECTIVE(double_cosh_arg_reduction)
-
-double_cosh_p_table:
-ASM_TYPE_DIRECTIVE(double_cosh_p_table,@object)
-   data8 0x8000000000000000, 0x00003FFE
-   data8 0xAAAAAAAAAAAAAB80, 0x00003FFA
-   data8 0xB60B60B60B4FE884, 0x00003FF5
-   data8 0xD00D00D1021D7370, 0x00003FEF
-   data8 0x93F27740C0C2F1CC, 0x00003FE9
-   data8 0x8FA02AC65BCBD5BC, 0x00003FE2
-ASM_SIZE_DIRECTIVE(double_cosh_p_table)
-
-double_cosh_ab_table:
-ASM_TYPE_DIRECTIVE(double_cosh_ab_table,@object)
-   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC
-   data8 0x88888888884ECDD5, 0x00003FF8
-   data8 0xD00D0C6DCC26A86B, 0x00003FF2
-   data8 0x8000000000000002, 0x00003FFE
-   data8 0xAAAAAAAAAA402C77, 0x00003FFA
-   data8 0xB60B6CC96BDB144D, 0x00003FF5
-ASM_SIZE_DIRECTIVE(double_cosh_ab_table)
-
-double_cosh_j_table:
-ASM_TYPE_DIRECTIVE(double_cosh_j_table,@object)
-   data8 0xB504F333F9DE6484, 0x00003FFE, 0x1EB2FB13, 0x00000000
-   data8 0xB6FD91E328D17791, 0x00003FFE, 0x1CE2CBE2, 0x00000000
-   data8 0xB8FBAF4762FB9EE9, 0x00003FFE, 0x1DDC3CBC, 0x00000000
-   data8 0xBAFF5AB2133E45FB, 0x00003FFE, 0x1EE9AA34, 0x00000000
-   data8 0xBD08A39F580C36BF, 0x00003FFE, 0x9EAEFDC1, 0x00000000
-   data8 0xBF1799B67A731083, 0x00003FFE, 0x9DBF517B, 0x00000000
-   data8 0xC12C4CCA66709456, 0x00003FFE, 0x1EF88AFB, 0x00000000
-   data8 0xC346CCDA24976407, 0x00003FFE, 0x1E03B216, 0x00000000
-   data8 0xC5672A115506DADD, 0x00003FFE, 0x1E78AB43, 0x00000000
-   data8 0xC78D74C8ABB9B15D, 0x00003FFE, 0x9E7B1747, 0x00000000
-   data8 0xC9B9BD866E2F27A3, 0x00003FFE, 0x9EFE3C0E, 0x00000000
-   data8 0xCBEC14FEF2727C5D, 0x00003FFE, 0x9D36F837, 0x00000000
-   data8 0xCE248C151F8480E4, 0x00003FFE, 0x9DEE53E4, 0x00000000
-   data8 0xD06333DAEF2B2595, 0x00003FFE, 0x9E24AE8E, 0x00000000
-   data8 0xD2A81D91F12AE45A, 0x00003FFE, 0x1D912473, 0x00000000
-   data8 0xD4F35AABCFEDFA1F, 0x00003FFE, 0x1EB243BE, 0x00000000
-   data8 0xD744FCCAD69D6AF4, 0x00003FFE, 0x1E669A2F, 0x00000000
-   data8 0xD99D15C278AFD7B6, 0x00003FFE, 0x9BBC610A, 0x00000000
-   data8 0xDBFBB797DAF23755, 0x00003FFE, 0x1E761035, 0x00000000
-   data8 0xDE60F4825E0E9124, 0x00003FFE, 0x9E0BE175, 0x00000000
-   data8 0xE0CCDEEC2A94E111, 0x00003FFE, 0x1CCB12A1, 0x00000000
-   data8 0xE33F8972BE8A5A51, 0x00003FFE, 0x1D1BFE90, 0x00000000
-   data8 0xE5B906E77C8348A8, 0x00003FFE, 0x1DF2F47A, 0x00000000
-   data8 0xE8396A503C4BDC68, 0x00003FFE, 0x1EF22F22, 0x00000000
-   data8 0xEAC0C6E7DD24392F, 0x00003FFE, 0x9E3F4A29, 0x00000000
-   data8 0xED4F301ED9942B84, 0x00003FFE, 0x1EC01A5B, 0x00000000
-   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE, 0x1E8CAC3A, 0x00000000
-   data8 0xF281773C59FFB13A, 0x00003FFE, 0x9DBB3FAB, 0x00000000
-   data8 0xF5257D152486CC2C, 0x00003FFE, 0x1EF73A19, 0x00000000
-   data8 0xF7D0DF730AD13BB9, 0x00003FFE, 0x9BB795B5, 0x00000000
-   data8 0xFA83B2DB722A033A, 0x00003FFE, 0x1EF84B76, 0x00000000
-   data8 0xFD3E0C0CF486C175, 0x00003FFE, 0x9EF5818B, 0x00000000
-   data8 0x8000000000000000, 0x00003FFF, 0x00000000, 0x00000000
-   data8 0x8164D1F3BC030773, 0x00003FFF, 0x1F77CACA, 0x00000000
-   data8 0x82CD8698AC2BA1D7, 0x00003FFF, 0x1EF8A91D, 0x00000000
-   data8 0x843A28C3ACDE4046, 0x00003FFF, 0x1E57C976, 0x00000000
-   data8 0x85AAC367CC487B15, 0x00003FFF, 0x9EE8DA92, 0x00000000
-   data8 0x871F61969E8D1010, 0x00003FFF, 0x1EE85C9F, 0x00000000
-   data8 0x88980E8092DA8527, 0x00003FFF, 0x1F3BF1AF, 0x00000000
-   data8 0x8A14D575496EFD9A, 0x00003FFF, 0x1D80CA1E, 0x00000000
-   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF, 0x9D0373AF, 0x00000000
-   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF, 0x9F167097, 0x00000000
-   data8 0x8EA4398B45CD53C0, 0x00003FFF, 0x1EB70051, 0x00000000
-   data8 0x9031DC431466B1DC, 0x00003FFF, 0x1F6EB029, 0x00000000
-   data8 0x91C3D373AB11C336, 0x00003FFF, 0x1DFD6D8E, 0x00000000
-   data8 0x935A2B2F13E6E92C, 0x00003FFF, 0x9EB319B0, 0x00000000
-   data8 0x94F4EFA8FEF70961, 0x00003FFF, 0x1EBA2BEB, 0x00000000
-   data8 0x96942D3720185A00, 0x00003FFF, 0x1F11D537, 0x00000000
-   data8 0x9837F0518DB8A96F, 0x00003FFF, 0x1F0D5A46, 0x00000000
-   data8 0x99E0459320B7FA65, 0x00003FFF, 0x9E5E7BCA, 0x00000000
-   data8 0x9B8D39B9D54E5539, 0x00003FFF, 0x9F3AAFD1, 0x00000000
-   data8 0x9D3ED9A72CFFB751, 0x00003FFF, 0x9E86DACC, 0x00000000
-   data8 0x9EF5326091A111AE, 0x00003FFF, 0x9F3EDDC2, 0x00000000
-   data8 0xA0B0510FB9714FC2, 0x00003FFF, 0x1E496E3D, 0x00000000
-   data8 0xA27043030C496819, 0x00003FFF, 0x9F490BF6, 0x00000000
-   data8 0xA43515AE09E6809E, 0x00003FFF, 0x1DD1DB48, 0x00000000
-   data8 0xA5FED6A9B15138EA, 0x00003FFF, 0x1E65EBFB, 0x00000000
-   data8 0xA7CD93B4E965356A, 0x00003FFF, 0x9F427496, 0x00000000
-   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF, 0x1F283C4A, 0x00000000
-   data8 0xAB7A39B5A93ED337, 0x00003FFF, 0x1F4B0047, 0x00000000
-   data8 0xAD583EEA42A14AC6, 0x00003FFF, 0x1F130152, 0x00000000
-   data8 0xAF3B78AD690A4375, 0x00003FFF, 0x9E8367C0, 0x00000000
-   data8 0xB123F581D2AC2590, 0x00003FFF, 0x9F705F90, 0x00000000
-   data8 0xB311C412A9112489, 0x00003FFF, 0x1EFB3C53, 0x00000000
-   data8 0xB504F333F9DE6484, 0x00003FFF, 0x1F32FB13, 0x00000000
-ASM_SIZE_DIRECTIVE(double_cosh_j_table)
-
-.align 32
-.global cosh#
 
-.section .text
-.proc  cosh#
-.align 32
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
 
-cosh: 
+// double-extended 1/ln(2)
+// 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
+// 3fff b8aa 3b29 5c17 f0bc
+// For speed the significand will be loaded directly with a movl and setf.sig
+//   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
+//   computations need to scale appropriately.
+// The constant 128/ln(2) is needed for the computation of w.  This is also
+//   obtained by scaling the computations.
+//
+// Two shifting constants are loaded directly with movl and setf.d.
+//   1. fRSHF_2TO56 = 1.1000..00 * 2^(63-7)
+//        This constant is added to x*1/ln2 to shift the integer part of
+//        x*128/ln2 into the rightmost bits of the significand.
+//        The result of this fma is fW_2TO56_RSH.
+//   2. fRSHF       = 1.1000..00 * 2^(63)
+//        This constant is subtracted from fW_2TO56_RSH * 2^(-56) to give
+//        the integer part of w, n, as a floating-point number.
+//        The result of this fms is fNfloat.
+
+
+LOCAL_OBJECT_START(exp_table_1)
+data8 0x408633ce8fb9f87e // smallest dbl overflow arg
+data8 0x408633ce8fb9f87d // largest dbl arg to give normal dbl result
+data8 0xb17217f7d1cf79ab , 0x00003ff7 // ln2/128 hi
+data8 0xc9e3b39803f2f6af , 0x00003fb7 // ln2/128 lo
+//
+// Table 1 is 2^(index_1/128) where
+// index_1 goes from 0 to 15
+//
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x80B1ED4FD999AB6C , 0x00003FFF
+data8 0x8164D1F3BC030773 , 0x00003FFF
+data8 0x8218AF4373FC25EC , 0x00003FFF
+data8 0x82CD8698AC2BA1D7 , 0x00003FFF
+data8 0x8383594EEFB6EE37 , 0x00003FFF
+data8 0x843A28C3ACDE4046 , 0x00003FFF
+data8 0x84F1F656379C1A29 , 0x00003FFF
+data8 0x85AAC367CC487B15 , 0x00003FFF
+data8 0x8664915B923FBA04 , 0x00003FFF
+data8 0x871F61969E8D1010 , 0x00003FFF
+data8 0x87DB357FF698D792 , 0x00003FFF
+data8 0x88980E8092DA8527 , 0x00003FFF
+data8 0x8955EE03618E5FDD , 0x00003FFF
+data8 0x8A14D575496EFD9A , 0x00003FFF
+data8 0x8AD4C6452C728924 , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_1)
+
+// Table 2 is 2^(index_1/8) where
+// index_2 goes from 0 to 7
+LOCAL_OBJECT_START(exp_table_2)
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
+data8 0x9837F0518DB8A96F , 0x00003FFF
+data8 0xA5FED6A9B15138EA , 0x00003FFF
+data8 0xB504F333F9DE6484 , 0x00003FFF
+data8 0xC5672A115506DADD , 0x00003FFF
+data8 0xD744FCCAD69D6AF4 , 0x00003FFF
+data8 0xEAC0C6E7DD24392F , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_2)
+
+LOCAL_OBJECT_START(exp_p_table)
+data8 0x3f8111116da21757 //P5
+data8 0x3fa55555d787761c //P4
+data8 0x3fc5555555555414 //P3
+data8 0x3fdffffffffffd6a //P2
+LOCAL_OBJECT_END(exp_p_table)
+
+LOCAL_OBJECT_START(cosh_p_table)
+data8 0x8FA02AC65BCBD5BC, 0x00003FE2  // A6
+data8 0xD00D00D1021D7370, 0x00003FEF  // A4
+data8 0xAAAAAAAAAAAAAB80, 0x00003FFA  // A2
+data8 0x93F27740C0C2F1CC, 0x00003FE9  // A5
+data8 0xB60B60B60B4FE884, 0x00003FF5  // A3
+data8 0x8000000000000000, 0x00003FFE  // A1
+LOCAL_OBJECT_END(cosh_p_table)
 
-#ifdef _LIBC
-.global __ieee754_cosh#
-.proc __ieee754_cosh#
-__ieee754_cosh:
-#endif
 
-// X NAN?
+.section .text
+GLOBAL_IEEE754_ENTRY(cosh)
 
-{ .mfi
-      alloc r32 = ar.pfs,0,12,4,0                  
-(p0)  fclass.m.unc  p6,p7 = f8, 0xc3	//@snan | @qnan 
-      nop.i 999
+{ .mlx
+      getf.exp        rSignexp_x = f8  // Must recompute if x unorm
+      movl            rSig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
 }
-;;
-
-
-{ .mfb
-      nop.m 999
-(p6)  fma.d.s0   f8 = f8,f1,f8                  
-(p6)  br.ret.spnt     b0 ;;                          
+{ .mlx
+      addl            rAD_TB1    = @ltoff(exp_table_1), gp
+      movl            rRshf_2to56 = 0x4768000000000000   // 1.10000 2^(63+56)
 }
+;;
 
-
-// X infinity 
 { .mfi
-      nop.m 999
-(p0)  fclass.m.unc  p6,p0 = f8, 0x23	//@inf 
-      nop.i 999 ;;
-}
-
-{ .mfb
-      nop.m 999
-(p6)     fmerge.s      f8 = f0,f8                  
-(p6)  br.ret.spnt     b0 ;;                          
+      ld8             rAD_TB1    = [rAD_TB1]
+      fclass.m        p6,p0 = f8,0x0b  // Test for x=unorm
+      mov             rExp_mask = 0x1ffff
 }
-
-
-
-// Put 0.25 in f9; p6 true if x < 0.25
-{ .mlx
-         nop.m 999
-(p0)     movl            r32 = 0x000000000000fffd ;;         
-}
-
 { .mfi
-(p0)  setf.exp        f9 = r32                         
-      nop.f 999
-      nop.i 999 ;;
+      mov             rExp_bias = 0xffff
+      fnorm.s1        fNormX   = f8
+      mov             rExp_2tom56 = 0xffff-56
 }
+;;
+
+// Form two constants we need
+//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128
+//  1.1000..000 * 2^(63+63-7) to right shift int(w) into the significand
 
 { .mfi
-      nop.m 999
-(p0)  fmerge.s      cosh_FR_X    = f0,f8                
+      setf.sig        fINV_LN2_2TO63 = rSig_inv_ln2 // form 1/ln2 * 2^63
+      fclass.m        p8,p0 = f8,0x07  // Test for x=0
       nop.i 999
 }
-
-{ .mfi
-      nop.m 999
-(p0)  fmerge.s      cosh_FR_SGNX = f8,f1                
-      nop.i 999 ;;
+{ .mlx
+      setf.d          fRSHF_2TO56 = rRshf_2to56 // Form const 1.100 * 2^(63+56)
+      movl            rRshf = 0x43e8000000000000 // 1.10000 2^63 for right shift
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fcmp.lt.unc     p0,p7 = cosh_FR_X,f9                    
-      nop.i 999 ;;
+      ldfpd           fMIN_DBL_OFLOW_ARG, fMAX_DBL_NORM_ARG = [rAD_TB1],16
+      fclass.m        p10,p0 = f8,0x1e3  // Test for x=inf, nan, NaT
+      nop.i           0
 }
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p7)  br.cond.sptk    L(COSH_BY_TBL) 
+{ .mfb
+      setf.exp        f2TOM56 = rExp_2tom56 // form 2^-56 for scaling Nfloat
+      nop.f           0
+(p6)  br.cond.spnt    COSH_UNORM            // Branch if x=unorm
 }
 ;;
 
-
-// COSH_BY_POLY: 
-// POLY cannot overflow so there is no need to call __libm_error_support
-// Get the values of P_x from the table
-
-{ .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(double_cosh_p_table), gp
-      nop.i 999
+COSH_COMMON:
+{ .mfi
+      ldfe            fLn2_by_128_hi  = [rAD_TB1],16
+      nop.f           0
+      nop.i           0
 }
-;;
-
-{ .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+{ .mfb
+      setf.d          fRSHF = rRshf // Form right shift const 1.100 * 2^63
+(p8)  fma.d.s0        f8 = f1,f1,f0           // quick exit for x=0
+(p8)  br.ret.spnt     b0
 }
 ;;
 
-
-// Calculate cosh_FR_X2 = ax*ax and cosh_FR_X4 = ax*ax*ax*ax
-{ .mmf
-         nop.m 999
-(p0)     ldfe       cosh_FR_P1 = [r34],16                 
-(p0)     fma.s1     cosh_FR_X2 = cosh_FR_X, cosh_FR_X, f0 ;;           
-}
-
-{ .mmi
-(p0)     ldfe       cosh_FR_P2 = [r34],16 ;;                 
-(p0)     ldfe       cosh_FR_P3 = [r34],16                 
-         nop.i 999 ;;
+{ .mfi
+      ldfe            fLn2_by_128_lo  = [rAD_TB1],16
+      nop.f           0
+      nop.i           0
 }
-
-{ .mmi
-(p0)     ldfe       cosh_FR_P4 = [r34],16 ;;                 
-(p0)     ldfe       cosh_FR_P5 = [r34],16                 
-         nop.i 999 ;;
+{ .mfb
+      and             rExp_x = rExp_mask, rSignexp_x // Biased exponent of x
+(p10) fma.d.s0        f8 = f8,f8,f0  // Result if x=inf, nan, NaT
+(p10) br.ret.spnt     b0               // quick exit for x=inf, nan, NaT
 }
+;;
 
+// After that last load rAD_TB1 points to the beginning of table 1
 { .mfi
-(p0)     ldfe       cosh_FR_P6 = [r34],16                 
-(p0)     fma.s1     cosh_FR_X4 = cosh_FR_X2, cosh_FR_X2, f0         
-         nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s0      p6,p0 = f8, f0       // Dummy to set D
+      sub             rExp_x = rExp_x, rExp_bias // True exponent of x
 }
+;;
 
-// Calculate cosh_FR_podd = x4 *(x4 * P_5 + P_3) + P_1
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_poly_podd_temp1 = cosh_FR_X4, cosh_FR_P5, cosh_FR_P3                
-         nop.i 999 ;;
+      nop.m           0
+      fmerge.s        fAbsX = f0, fNormX   // Form |x|
+      nop.i           0
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_podd            = cosh_FR_X4, cosh_FR_poly_podd_temp1, cosh_FR_P1   
-         nop.i 999
+{ .mfb
+      cmp.gt          p7, p0 = -2, rExp_x      // Test |x| < 2^(-2)
+      fma.s1          fXsq = fNormX, fNormX, f0  // x*x for small path
+(p7)  br.cond.spnt    COSH_SMALL               // Branch if 0 < |x| < 2^-2
 }
+;;
 
-// Calculate cosh_FR_peven =  p_even = x4 *(x4 * (x4 * P_6 + P_4) + P_2)
-{ .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_poly_peven_temp1 = cosh_FR_X4, cosh_FR_P6, cosh_FR_P4               
-         nop.i 999 ;;
-}
+// W = X * Inv_log2_by_128
+// By adding 1.10...0*2^63 we shift and get round_int(W) in significand.
+// We actually add 1.10...0*2^56 to X * Inv_log2 to do the same thing.
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_poly_peven_temp2 = cosh_FR_X4, cosh_FR_poly_peven_temp1, cosh_FR_P2 
-         nop.i 999 ;;
+      add             rAD_P = 0x180, rAD_TB1
+      fma.s1          fW_2TO56_RSH  = fNormX, fINV_LN2_2TO63, fRSHF_2TO56
+      add             rAD_TB2 = 0x100, rAD_TB1
 }
+;;
+
+// Divide arguments into the following categories:
+//  Certain Safe                - 0.25 <= |x| <= MAX_DBL_NORM_ARG
+//  Possible Overflow       p14 - MAX_DBL_NORM_ARG < |x| < MIN_DBL_OFLOW_ARG
+//  Certain Overflow        p15 - MIN_DBL_OFLOW_ARG <= |x| < +inf
+//
+// If the input is really a double arg, then there will never be
+// "Possible Overflow" arguments.
+//
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_peven       = cosh_FR_X4, cosh_FR_poly_peven_temp2, f0         
-         nop.i 999 ;;
+      ldfpd           fP5, fP4  = [rAD_P] ,16
+      fcmp.ge.s1      p15,p14 = fAbsX,fMIN_DBL_OFLOW_ARG
+      nop.i           0
 }
+;;
+
+// Nfloat = round_int(W)
+// The signficand of fW_2TO56_RSH contains the rounded integer part of W,
+// as a twos complement number in the lower bits (that is, it may be negative).
+// That twos complement number (called N) is put into rN.
+
+// Since fW_2TO56_RSH is scaled by 2^56, it must be multiplied by 2^-56
+// before the shift constant 1.10000 * 2^63 is subtracted to yield fNfloat.
+// Thus, fNfloat contains the floating point version of N
 
-// Y_lo = x2*p_odd + p_even
-// Calculate f8 = Y_hi + Y_lo 
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_Y_lo         = cosh_FR_X2, cosh_FR_podd,  cosh_FR_peven    
-         nop.i 999 ;;
+      ldfpd           fP3, fP2  = [rAD_P]
+(p14) fcmp.gt.unc.s1  p14,p0 = fAbsX,fMAX_DBL_NORM_ARG
+      nop.i           0
 }
-
 { .mfb
-         nop.m 999
-(p0)     fma.d.s0   f8                   = f1, f1, cosh_FR_Y_lo                        
-(p0)  br.ret.sptk     b0 ;;                          
+      nop.m           0
+      fms.s1          fNfloat = fW_2TO56_RSH, f2TOM56, fRSHF
+(p15) br.cond.spnt    COSH_CERTAIN_OVERFLOW
 }
+;;
 
-
-L(COSH_BY_TBL): 
-
-// Now that we are at TBL; so far all we know is that |x| >= 0.25.
-// The first two steps are the same for TBL and EXP, but if we are HUGE
-// Double
-// Go to HUGE if |x| >= 2^10, 10009 (register-biased) is e = 10 (true)
-// Single
-// Go to HUGE if |x| >= 2^7,  10006 (register-biased) is e =  7 (true)
-// we want to leave now. Go to HUGE if |x| >= 2^14
-// 1000d (register-biased) is e = 14 (true)
-
-{ .mlx
-      nop.m 999
-(p0)     movl            r32 = 0x0000000000010009 ;;              
+{ .mfi
+      getf.sig        rN        = fW_2TO56_RSH
+      nop.f           0
+      mov             rExp_bias_minus_1 = 0xfffe
 }
+;;
+
+// rIndex_1 has index_1
+// rIndex_2_16 has index_2 * 16
+// rBiased_M has M
 
+// rM has true M
+// r = x - Nfloat * ln2_by_128_hi
+// f = 1 - Nfloat * ln2_by_128_lo
 { .mfi
-(p0)     setf.exp        f9 = r32                              
-      nop.f 999
-      nop.i 999 ;;
+      and             rIndex_1 = 0x0f, rN
+      fnma.s1         fR   = fNfloat, fLn2_by_128_hi, fNormX
+      shr             rM = rN,  0x7
 }
-
 { .mfi
-      nop.m 999
-(p0)     fcmp.ge.unc     p6,p7 = cosh_FR_X,f9                  
-      nop.i 999 ;;
+      and             rIndex_2_16 = 0x70, rN
+      fnma.s1         fF   = fNfloat, fLn2_by_128_lo, f1
+      sub             rN_neg = r0, rN
 }
+;;
 
-{ .mib
-      nop.m 999
-      nop.i 999
-(p6)     br.cond.spnt    L(COSH_HUGE) ;;                             
+{ .mmi
+      and             rIndex_1_neg = 0x0f, rN_neg
+      add             rBiased_M = rExp_bias_minus_1, rM
+      shr             rM_neg = rN_neg,  0x7
 }
-
-// r32 = 1
-// r34 = N-1 
-// r35 = N
-// r36 = j
-// r37 = N+1
-
-// TBL can never overflow
-// cosh(x) = cosh(B+R)
-//         = cosh(B) cosh(R) + sinh(B) sinh(R) 
-// cosh(R) can be approximated by 1 + p_even
-// sinh(R) can be approximated by p_odd
-
-// ******************************************************
-// STEP 1 (TBL and EXP)
-// ******************************************************
-// Get the following constants.
-// f9  = Inv_log2by64
-// f10 = log2by64_hi
-// f11 = log2by64_lo
-
 { .mmi
-(p0)     adds                 r32 = 0x1,r0      
-(p0)     addl           r34   = @ltoff(double_cosh_arg_reduction), gp
-         nop.i 999
+      and             rIndex_2_16_neg = 0x70, rN_neg
+      add             rAD_T2 = rAD_TB2, rIndex_2_16
+      shladd          rAD_T1 = rIndex_1, 4, rAD_TB1
 }
 ;;
 
-// We want 2^(N-1) and 2^(-N-1). So bias N-1 and -N-1 and
-// put them in an exponent.
-// cosh_FR_spos = 2^(N-1) and cosh_FR_sneg = 2^(-N-1)
-// r39 = 0xffff + (N-1)  = 0xffff +N -1
-// r40 = 0xffff - (N +1) = 0xffff -N -1
-
-{ .mlx
-         ld8 r34 = [r34]
-(p0)     movl                r38 = 0x000000000000fffe ;; 
-}
+// rAD_T1 has address of T1
+// rAD_T2 has address if T2
 
 { .mmi
-(p0)     ldfe            cosh_FR_Inv_log2by64 = [r34],16 ;;            
-(p0)     ldfe            cosh_FR_log2by64_hi  = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mbb
-(p0)     ldfe            cosh_FR_log2by64_lo  = [r34],16            
-         nop.b 999
-         nop.b 999 ;;
+      setf.exp        f2M = rBiased_M
+      ldfe            fT2  = [rAD_T2]
+      nop.i           0
 }
-
-// Get the A coefficients
-// f9  = A_1
-// f10 = A_2
-// f11 = A_3
-
 { .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(double_cosh_ab_table), gp
-      nop.i 999
+      add             rBiased_M_neg = rExp_bias_minus_1, rM_neg
+      add             rAD_T2_neg = rAD_TB2, rIndex_2_16_neg
+      shladd          rAD_T1_neg = rIndex_1_neg, 4, rAD_TB1
 }
 ;;
 
+// Create Scale = 2^M
+// Load T1 and T2
 { .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+      ldfe            fT1  = [rAD_T1]
+      nop.m           0
+      nop.i           0
+}
+{ .mmf
+      setf.exp        f2M_neg = rBiased_M_neg
+      ldfe            fT2_neg  = [rAD_T2_neg]
+      fma.s1          fF_neg   = fNfloat, fLn2_by_128_lo, f1
 }
 ;;
 
-
-// Calculate M and keep it as integer and floating point.
-// M = round-to-integer(x*Inv_log2by64)
-// cosh_FR_M = M = truncate(ax/(log2/64))
-// Put the significand of M in r35
-//    and the floating point representation of M in cosh_FR_M
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_M      = cosh_FR_X, cosh_FR_Inv_log2by64, f0 
-      nop.i 999
+      nop.m           0
+      fma.s1          fRsq = fR, fR, f0
+      nop.i           0
 }
-
 { .mfi
-(p0)  ldfe            cosh_FR_A1 = [r34],16            
-      nop.f 999
-      nop.i 999 ;;
+      ldfe            fT1_neg  = [rAD_T1_neg]
+      fma.s1          fP54 = fR, fP5, fP4
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fcvt.fx.s1      cosh_FR_M_temp = cosh_FR_M                      
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP32 = fR, fP3, fP2
+      nop.i           0
 }
-
 { .mfi
-      nop.m 999
-(p0)  fnorm.s1        cosh_FR_M      = cosh_FR_M_temp                 
-      nop.i 999 ;;
+      nop.m           0
+      fnma.s1         fP54_neg = fR, fP5, fP4
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)  getf.sig        r35       = cosh_FR_M_temp                 
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fnma.s1         fP32_neg = fR, fP3, fP2
+      nop.i           0
 }
-
-// M is still in r35. Calculate j. j is the signed extension of the six lsb of M. It
-// has a range of -32 thru 31.
-// r35 = M
-// r36 = j 
-{ .mii
-      nop.m 999
-      nop.i 999 ;;
-(p0)  and            r36 = 0x3f, r35 ;;   
-}
-
-// Calculate R
-// f13 = f44 - f12*f10 = x - M*log2by64_hi
-// f14 = f13 - f8*f11 = R = (x - M*log2by64_hi) - M*log2by64_lo
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fnma.s1        cosh_FR_R_temp = cosh_FR_M, cosh_FR_log2by64_hi, cosh_FR_X      
-      nop.i 999
+      nop.m           0
+      fma.s1          fP5432  = fRsq, fP54, fP32
+      nop.i           0
 }
-
 { .mfi
-(p0)  ldfe            cosh_FR_A2 = [r34],16            
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS2  = fF,fT2,f0
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fnma.s1        cosh_FR_R      = cosh_FR_M, cosh_FR_log2by64_lo, cosh_FR_R_temp 
-      nop.i 999
-}
-
-// Get the B coefficients
-// f15 = B_1
-// f32 = B_2
-// f33 = B_3
-
-{ .mmi
-(p0)     ldfe            cosh_FR_A3 = [r34],16 ;;            
-(p0)     ldfe            cosh_FR_B1 = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe            cosh_FR_B2 = [r34],16 ;;            
-(p0)     ldfe            cosh_FR_B3 = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mii
-         nop.m 999
-(p0)     shl            r34 = r36,  0x2 ;;   
-(p0)     sxt1           r37 = r34 ;;         
+      nop.m           0
+      fma.s1          fS1  = f2M,fT1,f0
+      nop.i           0
 }
-
-// ******************************************************
-// STEP 2 (TBL and EXP)
-// ******************************************************
-// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-// f12 = R*R*R
-// f13 = R*R
-// f14 = R <== from above
-
 { .mfi
-      nop.m 999
-(p0)     fma.s1          cosh_FR_Rsq  = cosh_FR_R,   cosh_FR_R, f0  
-(p0)     shr            r36 = r37,  0x2 ;;   
-}
-
-// r34 = M-j = r35 - r36
-// r35 = N = (M-j)/64
-
-{ .mii
-(p0)     sub                  r34 = r35, r36    
-         nop.i 999 ;;
-(p0)     shr                  r35 = r34, 0x6 ;;    
-}
-
-{ .mii
-(p0)     sub                 r40 = r38, r35           
-(p0)     adds                 r37 = 0x1, r35    
-(p0)     add                 r39 = r38, r35 ;;           
-}
-
-// Get the address of the J table, add the offset,
-// addresses are sinh_AD_mJ and sinh_AD_J, get the T value
-// f32 = T(j)_hi
-// f33 = T(j)_lo
-// f34 = T(-j)_hi
-// f35 = T(-j)_lo
-
-{ .mmi
-(p0)     sub                  r34 = r35, r32    
-(p0)     addl    r37   = @ltoff(double_cosh_j_table), gp
-         nop.i 999
+      nop.m           0
+      fma.s1          fP5432_neg  = fRsq, fP54_neg, fP32_neg
+      nop.i           0
 }
 ;;
 
 { .mfi
-      ld8 r37 = [r37]
-(p0)  fma.s1          cosh_FR_Rcub = cosh_FR_Rsq, cosh_FR_R, f0  
-      nop.i 999
-}
-
-// ******************************************************
-// STEP 3 Now decide if we need to branch to EXP
-// ******************************************************
-// Put 32 in f9; p6 true if x < 32
-
-{ .mlx
-         nop.m 999
-(p0)     movl                r32 = 0x0000000000010004 ;;               
+      nop.m           0
+      fma.s1          fS1_neg  = f2M_neg,fT1_neg,f0
+      nop.i           0
 }
-
-// Calculate p_even
-// f34 = B_2 + Rsq *B_3
-// f35 = B_1 + Rsq*f34      = B_1 + Rsq * (B_2 + Rsq *B_3)
-// f36 = peven = Rsq * f35 = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_peven_temp1 = cosh_FR_Rsq, cosh_FR_B3,          cosh_FR_B2  
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS2_neg  = fF_neg,fT2_neg,f0
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_peven_temp2 = cosh_FR_Rsq, cosh_FR_peven_temp1, cosh_FR_B1  
-      nop.i 999
+      nop.m           0
+      fma.s1          fP     = fRsq, fP5432, fR
+      nop.i           0
 }
-
-// Calculate p_odd
-// f34 = A_2 + Rsq *A_3
-// f35 = A_1 + Rsq * (A_2 + Rsq *A_3)
-// f37 = podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_podd_temp1 = cosh_FR_Rsq,        cosh_FR_A3,         cosh_FR_A2  
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS   = fS1,fS2,f0
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)  setf.exp            cosh_FR_N_temp1 = r39            
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fms.s1          fP_neg     = fRsq, fP5432_neg, fR
+      nop.i           0
 }
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_peven       = cosh_FR_Rsq, cosh_FR_peven_temp2, f0     
-      nop.i 999
+      nop.m           0
+      fma.s1          fS_neg   = fS1_neg,fS2_neg,f0
+      nop.i           0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_podd_temp2 = cosh_FR_Rsq,        cosh_FR_podd_temp1, cosh_FR_A1  
-      nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      fmpy.s0         fTmp = fLn2_by_128_lo, fLn2_by_128_lo // Force inexact
+(p14) br.cond.spnt    COSH_POSSIBLE_OVERFLOW
 }
+;;
 
 { .mfi
-(p0)  setf.exp            f9  = r32                              
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fExp = fS, fP, fS
+      nop.i           0
 }
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_podd       = cosh_FR_podd_temp2, cosh_FR_Rcub,       cosh_FR_R   
-      nop.i 999
+      nop.m           0
+      fma.s1          fExp_neg = fS_neg, fP_neg, fS_neg
+      nop.i           0
 }
+;;
 
-// sinh_GR_mj contains the table offset for -j
-// sinh_GR_j  contains the table offset for +j
-// p6 is true when j <= 0
-
-{ .mlx
-(p0)     setf.exp            cosh_FR_N_temp2 = r40            
-(p0)     movl                r40 = 0x0000000000000020 ;;    
+{ .mfb
+      nop.m           0
+      fma.d.s0        f8 = fExp, f1, fExp_neg
+      br.ret.sptk     b0                  // Normal path exit
 }
+;;
 
-{ .mfi
-(p0)     sub                 GR_mJ = r40,  r36           
-(p0)     fmerge.se           cosh_FR_spos    = cosh_FR_N_temp1, f1 
-(p0)     adds                GR_J  = 0x20, r36 ;;           
+// Here if 0 < |x| < 0.25
+COSH_SMALL:
+{ .mmf
+      add             rAD_T1 = 0x1a0, rAD_TB1
+      add             rAD_T2 = 0x1d0, rAD_TB1
 }
+;;
 
-{ .mii
-         nop.m 999
-(p0)     shl                  GR_mJ = GR_mJ, 5 ;;   
-(p0)     add                  AD_mJ = r37, GR_mJ ;; 
+{ .mmf
+      ldfe            fA6 = [rAD_T1],16
+      ldfe            fA5 = [rAD_T2],16
+      nop.f           0
 }
+;;
 
 { .mmi
-         nop.m 999
-(p0)     ldfe                 cosh_FR_Tmjhi = [AD_mJ],16                 
-(p0)     shl                  GR_J  = GR_J, 5 ;;    
-}
-
-{ .mfi
-(p0)     ldfs                 cosh_FR_Tmjlo = [AD_mJ],16                 
-(p0)     fcmp.lt.unc.s1      p6,p7 = cosh_FR_X,f9                          
-(p0)     add                  AD_J  = r37, GR_J ;;  
+      ldfe            fA4 = [rAD_T1],16
+      ldfe            fA3 = [rAD_T2],16
+      nop.i           0
 }
+;;
 
 { .mmi
-(p0)     ldfe                 cosh_FR_Tjhi  = [AD_J],16 ;;                  
-(p0)     ldfs                 cosh_FR_Tjlo  = [AD_J],16                  
-         nop.i 999 ;;
-}
-
-{ .mfb
-         nop.m 999
-(p0)     fmerge.se           cosh_FR_sneg    = cosh_FR_N_temp2, f1 
-(p7)     br.cond.spnt        L(COSH_BY_EXP) ;;                            
-}
-
-// ******************************************************
-// If NOT branch to EXP
-// ******************************************************
-// Calculate C_hi
-// ******************************************************
-// cosh_FR_C_hi_temp = cosh_FR_sneg * cosh_FR_Tmjhi
-// cosh_FR_C_hi = cosh_FR_spos * cosh_FR_Tjhi + (cosh_FR_sneg * cosh_FR_Tmjhi)
-
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_C_hi_temp = cosh_FR_sneg, cosh_FR_Tmjhi, f0                   
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_C_hi      = cosh_FR_spos, cosh_FR_Tjhi,  cosh_FR_C_hi_temp    
-      nop.i 999
-}
-
-// ******************************************************
-// Calculate S_hi
-// ******************************************************
-// cosh_FR_S_hi_temp1 = cosh_FR_sneg * cosh_FR_Tmjhi
-// cosh_FR_S_hi = cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi_temp1
-
-{ .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_S_hi_temp1 =  cosh_FR_sneg, cosh_FR_Tmjhi, f0                
-      nop.i 999 ;;
-}
-
-// ******************************************************
-// Calculate C_lo
-// ******************************************************
-// cosh_FR_C_lo_temp1 = cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi
-// cosh_FR_C_lo_temp2 = cosh_FR_sneg * cosh_FR_Tmjlo + (cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi)
-// cosh_FR_C_lo_temp1 = cosh_FR_sneg * cosh_FR_Tmjlo
-// cosh_FR_C_lo_temp3 = cosh_FR_spos * cosh_FR_Tjlo + (cosh_FR_sneg * cosh_FR_Tmjlo)
-// cosh_FR_C_lo = cosh_FR_C_lo_temp3 + cosh_FR_C_lo_temp2
-
-{ .mfi
-      nop.m 999
-(p0)  fms.s1        cosh_FR_C_lo_temp1 = cosh_FR_spos, cosh_FR_Tjhi,  cosh_FR_C_hi        
-      nop.i 999
+      ldfe            fA2 = [rAD_T1],16
+      ldfe            fA1 = [rAD_T2],16
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fms.s1        cosh_FR_S_hi       =  cosh_FR_spos, cosh_FR_Tjhi, cosh_FR_S_hi_temp1 
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fX4 = fXsq, fXsq, f0
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo_temp2 = cosh_FR_sneg, cosh_FR_Tmjhi, cosh_FR_C_lo_temp1  
-      nop.i 999
+      nop.m           0
+      fma.s1          fA65 = fXsq, fA6, fA5
+      nop.i           0
 }
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo_temp1 = cosh_FR_sneg, cosh_FR_Tmjlo, f0                  
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA43 = fXsq, fA4, fA3
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo_temp3 =  cosh_FR_spos, cosh_FR_Tjlo,  cosh_FR_C_lo_temp1 
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA21 = fXsq, fA2, fA1
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo       =  cosh_FR_C_lo_temp3, f1,   cosh_FR_C_lo_temp2    
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA6543 = fX4, fA65, fA43
+      nop.i           0
 }
-
-// ******************************************************
-// cosh_FR_Y_lo_temp = cosh_FR_C_hi * cosh_FR_peven + cosh_FR_C_lo
-// cosh_FR_Y_lo = cosh_FR_S_hi * cosh_FR_podd + cosh_FR_Y_lo_temp
-// cosh_FR_COSH = Y_hi + Y_lo
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo_temp =  cosh_FR_C_hi, cosh_FR_peven, cosh_FR_C_lo       
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA654321 = fX4, fA6543, fA21
+      nop.i           0
 }
+;;
 
+// Dummy multiply to generate inexact
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo      =  cosh_FR_S_hi, cosh_FR_podd, cosh_FR_Y_lo_temp   
-      nop.i 999 ;;
+      nop.m           0
+      fmpy.s0         fTmp = fA6, fA6
+      nop.i           0
 }
-
 { .mfb
-      nop.m 999
-(p0)  fma.d.s0       f8 =  cosh_FR_C_hi, f1, cosh_FR_Y_lo                       
-(p0)  br.ret.sptk     b0 ;;                          
+      nop.m           0
+      fma.d.s0        f8 = fA654321, fXsq, f1
+      br.ret.sptk     b0                // Exit if 0 < |x| < 0.25
 }
+;;
 
-L(COSH_BY_EXP): 
-
-// When p7 is true,  we know that an overflow is not going to happen
-// When p7 is false, we must check for possible overflow
-// p7 is the over_SAFE flag
-// f44 = Scale * (Y_hi + Y_lo)
-//     =  cosh_FR_spos * (cosh_FR_Tjhi + cosh_FR_Y_lo)
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo_temp =  cosh_FR_peven, f1,       cosh_FR_podd           
-      nop.i 999
-}
+COSH_POSSIBLE_OVERFLOW:
 
-// Now we are in EXP. This is the only path where an overflow is possible
-// but not for certain. So this is the only path where over_SAFE has any use.
-// r34 still has N-1
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// There is a danger of double overflow            if N-1 > 0x3fe = 1022
+// Here if fMAX_DBL_NORM_ARG < |x| < fMIN_DBL_OFLOW_ARG
+// This cannot happen if input is a double, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-{ .mlx
-       nop.m 999
-(p0)   movl                r32          = 0x00000000000003fe ;;                       
-}
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest double, then we have
+// overflow
 
 { .mfi
-(p0)  cmp.gt.unc          p0,p7        = r34, r32                                 
-      nop.f 999
-      nop.i 999 ;;
+      mov             rGt_ln  = 0x103ff // Exponent for largest dbl + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo      =  cosh_FR_Tjhi,  cosh_FR_Y_lo_temp, cosh_FR_Tjlo       
-      nop.i 999 ;;
+      setf.exp        fGt_pln = rGt_ln  // Create largest double + 1 ulp
+      fma.d.s2        fWre_urm_f8 = fS, fP, fS    // Result with wre set
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_COSH_temp =  cosh_FR_Y_lo,  f1, cosh_FR_Tjhi                 
-      nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.d.s0       f44 = cosh_FR_spos,  cosh_FR_COSH_temp, f0                       
-      nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
+;;
 
-// If over_SAFE is set, return
 { .mfb
-       nop.m 999
-(p7)   fmerge.s            f8 = f44,f44
-(p7)  br.ret.sptk     b0 ;;                          
-}
-
-// Else see if we overflowed
-// S0 user supplied status
-// S2 user supplied status + WRE + TD  (Overflows)
-// If WRE is set then an overflow will not occur in EXP.
-// The input value that would cause a register (WRE) value to overflow is about 2^15
-// and this input would go into the HUGE path.
-// Answer with WRE is in f43.
-
-{ .mfi
-      nop.m 999
-(p0)  fsetc.s2            0x7F,0x42                                               
-      nop.i 999;;
-}
-
-{ .mfi
-      nop.m 999
-(p0)  fma.d.s2            f43  = cosh_FR_spos,  cosh_FR_COSH_temp, f0                      
-      nop.i 999 ;;
-}
-
-// 103FF => 103FF -FFFF = 400(true)
-// 400 + 3FF = 7FF, which is 1 more that the exponent of the largest
-// double (7FE). So 0 103FF 8000000000000000  is one ulp more than
-// largest double in register bias
-// Now  set p8 if the answer with WRE is greater than or equal this value
-// Also set p9 if the answer with WRE is less than or equal to negative this value
-
-{ .mlx
-       nop.m 999
-(p0)   movl                r32          = 0x00000000000103ff ;;                     
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    COSH_CERTAIN_OVERFLOW // Branch if overflow
 }
+;;
 
-{ .mmf
-       nop.m 999
-(p0)   setf.exp            f41          = r32                                    
-(p0)   fsetc.s2            0x7F,0x40 ;;                                               
+{ .mfb
+      nop.m           0
+      fma.d.s0        f8 = fS, fP, fS
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fcmp.ge.unc.s1      p8, p0       = f43, f41                               
-      nop.i 999
+COSH_CERTAIN_OVERFLOW:
+{ .mmi
+      sub             rTmp = rExp_mask, r0, 1
+;;
+      setf.exp        fTmp = rTmp
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fmerge.ns           f42 = f41, f41                                          
-      nop.i 999 ;;
-}
-
-// The error tag for overflow is 64
-{ .mii
-      nop.m 999
-      nop.i 999 ;;
-(p8)  mov                 r47 = 64 ;;                                               
+      alloc           r32=ar.pfs,1,4,4,0
+      fmerge.s        FR_X = f8,f8
+      nop.i           0
 }
-
 { .mfb
-      nop.m 999
-(p0)  fcmp.le.unc.s1      p9, p0 =  f43, f42                                      
-(p8)  br.cond.spnt __libm_error_region ;;
-}
-
-{ .mii
-      nop.m 999
-      nop.i 999 ;;
-(p9)  mov                 r47 = 64                                               
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p9)  br.cond.spnt __libm_error_region ;;
+      mov             GR_Parameter_TAG = 64
+      fma.d.s0        FR_RESULT = fTmp, fTmp, f0    // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
+// Here if x unorm
+COSH_UNORM:
 { .mfb
-      nop.m 999
-(p0)  fmerge.s            f8 = f44,f44                                            
-(p0)  br.ret.sptk     b0 ;;                          
-}
-
-
-// for COSH_HUGE, put 24000 in exponent; take sign from input; add 1
-// SAFE: SAFE is always 0 for HUGE
-
-L(COSH_HUGE): 
-
-{ .mlx
-      nop.m 999
-(p0)  movl                r32 = 0x0000000000015dbf ;;                                
+      getf.exp        rSignexp_x = fNormX    // Must recompute if x unorm
+      fcmp.eq.s0      p6, p0 = f8, f0        // Set D flag
+      br.cond.sptk    COSH_COMMON
 }
+;;
 
-{ .mfi
-(p0)  setf.exp            f9  = r32                                               
-      nop.f 999
-      nop.i 999 ;;
-}
+GLOBAL_IEEE754_END(cosh)
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1              cosh_FR_hi_lo = f1, f9, f1                              
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p0)  fma.d.s0            f44 = f9, cosh_FR_hi_lo, f0                             
-(p0)  mov                 r47 = 64                                               
-}
-;;
 
-.endp cosh#
-ASM_SIZE_DIRECTIVE(cosh#)
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
-
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-// (1)
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
         nop.f 0
@@ -1103,39 +823,32 @@ __libm_error_region:
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp=-64,sp                           // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP=gp                       // Save gp
 };;
-
-
-// (2)
 { .mmi
-        stfd [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+        stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0=b0                       // Save b0
 };;
-
 .body
-// (3)
 { .mib
-        stfd [GR_Parameter_X] = f8                    // STORE Parameter 1 on stack
+        stfd [GR_Parameter_X] = FR_X            // STORE Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
-        nop.b 0                                 
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = f44                   // STORE Parameter 3 on stack
+        stfd [GR_Parameter_Y] = FR_RESULT       // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#         // Call error handling function
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
-
-// (4)
 { .mmi
         ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
@@ -1148,8 +861,6 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
+LOCAL_LIBM_END(__libm_error_region)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_coshf.S b/sysdeps/ia64/fpu/e_coshf.S
index 969abc4ff6..97cb4e1771 100644
--- a/sysdeps/ia64/fpu/e_coshf.S
+++ b/sysdeps/ia64/fpu/e_coshf.S
@@ -1,10 +1,10 @@
 .file "coshf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1127 +20,692 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+
 // History
-//==============================================================
-// 2/02/00  Initial version
-// 2/16/00  The error tag for coshf overflow changed to 65 (from 64).
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+//*********************************************************************
+// 02/02/00 Initial version
+// 02/16/00 The error tag for coshf overflow changed to 65 (from 64).
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/07/01 Reworked to improve speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 11/15/02 Improved algorithm based on expf
+// 03/31/05 Reformatted delimiters between data tables
 //
 // API
-//==============================================================
-// float = coshf(float)
-// input  floating point f8
-// output floating point f8
-
-
+//*********************************************************************
+// float coshf(float)
+//
 // Overview of operation
-//==============================================================
-// There are four paths
-
-// 1. |x| < 0.25        COSH_BY_POLY
-// 2. |x| < 32          COSH_BY_TBL
-// 3. |x| < 2^14        COSH_BY_EXP
-// 4. |x_ >= 2^14       COSH_HUGE
-
-// For paths 1, and 2 SAFE is always 1.
-// For path  4, Safe is always 0.
-// SAFE = 1 means we cannot overflow.
-
-#include "libm_support.h"
-
-// Assembly macros
-//==============================================================
-coshf_FR_X            = f44
-coshf_FR_SGNX         = f40
-
-coshf_FR_Inv_log2by64 = f9
-coshf_FR_log2by64_lo  = f11
-coshf_FR_log2by64_hi  = f10
-
-coshf_FR_A1           = f9
-coshf_FR_A2           = f10
-coshf_FR_A3           = f11
-
-coshf_FR_Rcub         = f12
-coshf_FR_M_temp       = f13
-coshf_FR_R_temp       = f13
-coshf_FR_Rsq          = f13
-coshf_FR_R            = f14
-
-coshf_FR_M            = f38
-
-coshf_FR_B1           = f15
-coshf_FR_B2           = f32
-coshf_FR_B3           = f33
-
-coshf_FR_peven_temp1  = f34
-coshf_FR_peven_temp2  = f35
-coshf_FR_peven        = f36
-
-coshf_FR_podd_temp1   = f34
-coshf_FR_podd_temp2   = f35
-coshf_FR_podd         = f37
-
-coshf_FR_J_temp       = f9
-coshf_FR_J            = f10
-
-coshf_FR_Mmj          = f39
-
-coshf_FR_N_temp1      = f11
-coshf_FR_N_temp2      = f12
-coshf_FR_N            = f13
-
-coshf_FR_spos         = f14
-coshf_FR_sneg         = f15
-
-coshf_FR_Tjhi         = f32
-coshf_FR_Tjlo         = f33
-coshf_FR_Tmjhi        = f34
-coshf_FR_Tmjlo        = f35
-
-GR_mJ           = r35
-GR_J            = r36
-
-AD_mJ           = r38
-AD_J            = r39
-
-
-GR_SAVE_B0                    = r42
-GR_SAVE_PFS                   = r41
-GR_SAVE_GP                    = r43 
-
-GR_Parameter_X                = r44
-GR_Parameter_Y                = r45
-GR_Parameter_RESULT           = r46
-GR_Parameter_TAG              = r47
-
-FR_X             = f8
-FR_Y             = f0
-FR_RESULT        = f44
-
-
-coshf_FR_C_hi         = f9
-coshf_FR_C_hi_temp    = f10
-coshf_FR_C_lo_temp1   = f11 
-coshf_FR_C_lo_temp2   = f12 
-coshf_FR_C_lo_temp3   = f13 
-
-coshf_FR_C_lo         = f38
-coshf_FR_S_hi         = f39
+//*********************************************************************
+// Case 1:  0 < |x| < 0.25
+//  Evaluate cosh(x) by a 8th order polynomial
+//  Care is take for the order of multiplication; and A2 is not exactly 1/4!,
+//  A3 is not exactly 1/6!, etc.
+//  cosh(x) = 1 + (A1*x^2 + A2*x^4 + A3*x^6 + A4*x^8)
+//
+// Case 2:  0.25 < |x| < 89.41598
+//  Algorithm is based on the identity cosh(x) = ( exp(x) + exp(-x) ) / 2.
+//  The algorithm for exp is described as below.  There are a number of
+//  economies from evaluating both exp(x) and exp(-x).  Although we
+//  are evaluating both quantities, only where the quantities diverge do we
+//  duplicate the computations.  The basic algorithm for exp(x) is described
+//  below.
+//
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 64/log2
+//  NJ = int(w)
+//  x = NJ*log2/64 + R
 
-coshf_FR_S_hi_temp1   = f10
-coshf_FR_Y_hi         = f11 
-coshf_FR_Y_lo_temp    = f12 
-coshf_FR_Y_lo         = f13 
-coshf_FR_COSH         = f9
+//  NJ = 64*n + j
+//  x = n*log2 + (log2/64)*j + R
+//
+//  So, exp(x) = 2^n * 2^(j/64)* exp(R)
+//
+//  T =  2^n * 2^(j/64)
+//       Construct 2^n
+//       Get 2^(j/64) table
+//           actually all the entries of 2^(j/64) table are stored in DP and
+//           with exponent bits set to 0 -> multiplication on 2^n can be
+//           performed by doing logical "or" operation with bits presenting 2^n
+
+//  exp(R) = 1 + (exp(R) - 1)
+//  P = exp(R) - 1 approximated by Taylor series of 3rd degree
+//      P = A3*R^3 + A2*R^2 + R, A3 = 1/6, A2 = 1/2
+//
 
-coshf_FR_X2           = f9
-coshf_FR_X4           = f10
+//  The final result is reconstructed as follows
+//  exp(x) = T + T*P
 
-coshf_FR_P1           = f14
-coshf_FR_P2           = f15
-coshf_FR_P3           = f32
-coshf_FR_P4           = f33
-coshf_FR_P5           = f34
-coshf_FR_P6           = f35
+// Special values
+//*********************************************************************
+// coshf(+0)    = 1.0
+// coshf(-0)    = 1.0
 
-coshf_FR_TINY_THRESH  = f9
+// coshf(+qnan) = +qnan
+// coshf(-qnan) = -qnan
+// coshf(+snan) = +qnan
+// coshf(-snan) = -qnan
 
-coshf_FR_COSH_temp    = f10
-coshf_FR_SCALE        = f11 
+// coshf(-inf)  = +inf
+// coshf(+inf)  = +inf
 
-coshf_FR_hi_lo = f10
+// Overflow and Underflow
+//*********************************************************************
+// coshf(x) = largest single normal when
+//     x = 89.41598 = 0x42b2d4fc
+//
+// There is no underflow.
 
-coshf_FR_poly_podd_temp1    =  f11 
-coshf_FR_poly_podd_temp2    =  f13
-coshf_FR_poly_peven_temp1   =  f11
-coshf_FR_poly_peven_temp2   =  f13
+// Registers used
+//*********************************************************************
+// Floating Point registers used:
+// f8 input, output
+// f6,f7, f9 -> f15,  f32 -> f45
 
-// Data tables
-//==============================================================
+// General registers used:
+// r2, r3, r16 -> r38
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// Predicate registers used:
+// p6 -> p15
 
+// Assembly macros
+//*********************************************************************
+// integer registers used
+// scratch
+rNJ                   = r2
+rNJ_neg               = r3
+
+rJ_neg                = r16
+rN_neg                = r17
+rSignexp_x            = r18
+rExp_x                = r18
+rExp_mask             = r19
+rExp_bias             = r20
+rAd1                  = r21
+rAd2                  = r22
+rJ                    = r23
+rN                    = r24
+rTblAddr              = r25
+rA3                   = r26
+rExpHalf              = r27
+rLn2Div64             = r28
+rGt_ln                = r29
+r17ones_m1            = r29
+rRightShifter         = r30
+rJ_mask               = r30
+r64DivLn2             = r31
+rN_mask               = r31
+// stacked
+GR_SAVE_PFS           = r32
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_Parameter_X        = r35
+GR_Parameter_Y        = r36
+GR_Parameter_RESULT   = r37
+GR_Parameter_TAG      = r38
+
+// floating point registers used
+FR_X                  = f10
+FR_Y                  = f1
+FR_RESULT             = f8
+// scratch
+fRightShifter         = f6
+f64DivLn2             = f7
+fNormX                = f9
+fNint                 = f10
+fN                    = f11
+fR                    = f12
+fLn2Div64             = f13
+fA2                   = f14
+fA3                   = f15
+// stacked
+fP                    = f32
+fT                    = f33
+fMIN_SGL_OFLOW_ARG    = f34
+fMAX_SGL_NORM_ARG     = f35
+fRSqr                 = f36
+fA1                   = f37
+fA21                  = f37
+fA4                   = f38
+fA43                  = f38
+fA4321                = f38
+fX4                   = f39
+fTmp                  = f39
+fGt_pln               = f39
+fWre_urm_f8           = f40
+fXsq                  = f40
+fP_neg                = f41
+fT_neg                = f42
+fExp                  = f43
+fExp_neg              = f44
+fAbsX                 = f45
+
+
+RODATA
 .align 16
-single_coshf_arg_reduction:
-ASM_TYPE_DIRECTIVE(single_coshf_arg_reduction,@object)
-   data8 0xB8AA3B295C17F0BC, 0x00004005
-   data8 0xB17217F7D1000000, 0x00003FF8
-   data8 0xCF79ABC9E3B39804, 0x00003FD0
-ASM_SIZE_DIRECTIVE(single_coshf_arg_reduction)
-
-single_coshf_p_table:
-ASM_TYPE_DIRECTIVE(single_coshf_p_table,@object)
-   data8 0x8000000000000000, 0x00003FFE
-   data8 0xAAAAAAAAAAAAAB80, 0x00003FFA
-   data8 0xB60B60B60B4FE884, 0x00003FF5
-   data8 0xD00D00D1021D7370, 0x00003FEF
-   data8 0x93F27740C0C2F1CC, 0x00003FE9
-   data8 0x8FA02AC65BCBD5BC, 0x00003FE2
-ASM_SIZE_DIRECTIVE(single_coshf_p_table)
-
-single_coshf_ab_table:
-ASM_TYPE_DIRECTIVE(single_coshf_ab_table,@object)
-   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC
-   data8 0x88888888884ECDD5, 0x00003FF8
-   data8 0xD00D0C6DCC26A86B, 0x00003FF2
-   data8 0x8000000000000002, 0x00003FFE
-   data8 0xAAAAAAAAAA402C77, 0x00003FFA
-   data8 0xB60B6CC96BDB144D, 0x00003FF5
-ASM_SIZE_DIRECTIVE(single_coshf_ab_table)
-
-single_coshf_j_table:
-ASM_TYPE_DIRECTIVE(single_coshf_j_table,@object)
-   data8 0xB504F333F9DE6484, 0x00003FFE, 0x1EB2FB13, 0x00000000
-   data8 0xB6FD91E328D17791, 0x00003FFE, 0x1CE2CBE2, 0x00000000
-   data8 0xB8FBAF4762FB9EE9, 0x00003FFE, 0x1DDC3CBC, 0x00000000
-   data8 0xBAFF5AB2133E45FB, 0x00003FFE, 0x1EE9AA34, 0x00000000
-   data8 0xBD08A39F580C36BF, 0x00003FFE, 0x9EAEFDC1, 0x00000000
-   data8 0xBF1799B67A731083, 0x00003FFE, 0x9DBF517B, 0x00000000
-   data8 0xC12C4CCA66709456, 0x00003FFE, 0x1EF88AFB, 0x00000000
-   data8 0xC346CCDA24976407, 0x00003FFE, 0x1E03B216, 0x00000000
-   data8 0xC5672A115506DADD, 0x00003FFE, 0x1E78AB43, 0x00000000
-   data8 0xC78D74C8ABB9B15D, 0x00003FFE, 0x9E7B1747, 0x00000000
-   data8 0xC9B9BD866E2F27A3, 0x00003FFE, 0x9EFE3C0E, 0x00000000
-   data8 0xCBEC14FEF2727C5D, 0x00003FFE, 0x9D36F837, 0x00000000
-   data8 0xCE248C151F8480E4, 0x00003FFE, 0x9DEE53E4, 0x00000000
-   data8 0xD06333DAEF2B2595, 0x00003FFE, 0x9E24AE8E, 0x00000000
-   data8 0xD2A81D91F12AE45A, 0x00003FFE, 0x1D912473, 0x00000000
-   data8 0xD4F35AABCFEDFA1F, 0x00003FFE, 0x1EB243BE, 0x00000000
-   data8 0xD744FCCAD69D6AF4, 0x00003FFE, 0x1E669A2F, 0x00000000
-   data8 0xD99D15C278AFD7B6, 0x00003FFE, 0x9BBC610A, 0x00000000
-   data8 0xDBFBB797DAF23755, 0x00003FFE, 0x1E761035, 0x00000000
-   data8 0xDE60F4825E0E9124, 0x00003FFE, 0x9E0BE175, 0x00000000
-   data8 0xE0CCDEEC2A94E111, 0x00003FFE, 0x1CCB12A1, 0x00000000
-   data8 0xE33F8972BE8A5A51, 0x00003FFE, 0x1D1BFE90, 0x00000000
-   data8 0xE5B906E77C8348A8, 0x00003FFE, 0x1DF2F47A, 0x00000000
-   data8 0xE8396A503C4BDC68, 0x00003FFE, 0x1EF22F22, 0x00000000
-   data8 0xEAC0C6E7DD24392F, 0x00003FFE, 0x9E3F4A29, 0x00000000
-   data8 0xED4F301ED9942B84, 0x00003FFE, 0x1EC01A5B, 0x00000000
-   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE, 0x1E8CAC3A, 0x00000000
-   data8 0xF281773C59FFB13A, 0x00003FFE, 0x9DBB3FAB, 0x00000000
-   data8 0xF5257D152486CC2C, 0x00003FFE, 0x1EF73A19, 0x00000000
-   data8 0xF7D0DF730AD13BB9, 0x00003FFE, 0x9BB795B5, 0x00000000
-   data8 0xFA83B2DB722A033A, 0x00003FFE, 0x1EF84B76, 0x00000000
-   data8 0xFD3E0C0CF486C175, 0x00003FFE, 0x9EF5818B, 0x00000000
-   data8 0x8000000000000000, 0x00003FFF, 0x00000000, 0x00000000
-   data8 0x8164D1F3BC030773, 0x00003FFF, 0x1F77CACA, 0x00000000
-   data8 0x82CD8698AC2BA1D7, 0x00003FFF, 0x1EF8A91D, 0x00000000
-   data8 0x843A28C3ACDE4046, 0x00003FFF, 0x1E57C976, 0x00000000
-   data8 0x85AAC367CC487B15, 0x00003FFF, 0x9EE8DA92, 0x00000000
-   data8 0x871F61969E8D1010, 0x00003FFF, 0x1EE85C9F, 0x00000000
-   data8 0x88980E8092DA8527, 0x00003FFF, 0x1F3BF1AF, 0x00000000
-   data8 0x8A14D575496EFD9A, 0x00003FFF, 0x1D80CA1E, 0x00000000
-   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF, 0x9D0373AF, 0x00000000
-   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF, 0x9F167097, 0x00000000
-   data8 0x8EA4398B45CD53C0, 0x00003FFF, 0x1EB70051, 0x00000000
-   data8 0x9031DC431466B1DC, 0x00003FFF, 0x1F6EB029, 0x00000000
-   data8 0x91C3D373AB11C336, 0x00003FFF, 0x1DFD6D8E, 0x00000000
-   data8 0x935A2B2F13E6E92C, 0x00003FFF, 0x9EB319B0, 0x00000000
-   data8 0x94F4EFA8FEF70961, 0x00003FFF, 0x1EBA2BEB, 0x00000000
-   data8 0x96942D3720185A00, 0x00003FFF, 0x1F11D537, 0x00000000
-   data8 0x9837F0518DB8A96F, 0x00003FFF, 0x1F0D5A46, 0x00000000
-   data8 0x99E0459320B7FA65, 0x00003FFF, 0x9E5E7BCA, 0x00000000
-   data8 0x9B8D39B9D54E5539, 0x00003FFF, 0x9F3AAFD1, 0x00000000
-   data8 0x9D3ED9A72CFFB751, 0x00003FFF, 0x9E86DACC, 0x00000000
-   data8 0x9EF5326091A111AE, 0x00003FFF, 0x9F3EDDC2, 0x00000000
-   data8 0xA0B0510FB9714FC2, 0x00003FFF, 0x1E496E3D, 0x00000000
-   data8 0xA27043030C496819, 0x00003FFF, 0x9F490BF6, 0x00000000
-   data8 0xA43515AE09E6809E, 0x00003FFF, 0x1DD1DB48, 0x00000000
-   data8 0xA5FED6A9B15138EA, 0x00003FFF, 0x1E65EBFB, 0x00000000
-   data8 0xA7CD93B4E965356A, 0x00003FFF, 0x9F427496, 0x00000000
-   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF, 0x1F283C4A, 0x00000000
-   data8 0xAB7A39B5A93ED337, 0x00003FFF, 0x1F4B0047, 0x00000000
-   data8 0xAD583EEA42A14AC6, 0x00003FFF, 0x1F130152, 0x00000000
-   data8 0xAF3B78AD690A4375, 0x00003FFF, 0x9E8367C0, 0x00000000
-   data8 0xB123F581D2AC2590, 0x00003FFF, 0x9F705F90, 0x00000000
-   data8 0xB311C412A9112489, 0x00003FFF, 0x1EFB3C53, 0x00000000
-   data8 0xB504F333F9DE6484, 0x00003FFF, 0x1F32FB13, 0x00000000
-ASM_SIZE_DIRECTIVE(single_coshf_j_table)
-
-.align 32
-.global coshf#
-
-.section .text
-.proc  coshf#
-.align 32
-
-coshf: 
-
-#ifdef _LIBC
-.global __ieee754_coshf#
-.proc __ieee754_coshf#
-__ieee754_coshf:
-#endif
 
-// X NAN?
-
-
-{ .mfi
-      alloc r32 = ar.pfs,0,12,4,0                  
-(p0)  fclass.m.unc  p6,p7 = f8, 0xc3               
-	  nop.i 999 ;;                           
-}
-{ .mfb
-      nop.m 999
-(p6)  fma.s.s0   f8 = f8,f1,f8                  
-(p6)  br.ret.spnt b0 ;;                    
-}
-
-{ .mfi
-       nop.m 999
-       nop.f 999
-       nop.i 999 ;;
-}
+LOCAL_OBJECT_START(_coshf_table)
+data4 0x42b2d4fd         // Smallest single arg to overflow single result
+data4 0x42b2d4fc         // Largest single arg to give normal single result
+data4 0x00000000         // pad
+data4 0x00000000         // pad
+//
+// 2^(j/64) table, j goes from 0 to 63
+data8 0x0000000000000000 // 2^(0/64)
+data8 0x00002C9A3E778061 // 2^(1/64)
+data8 0x000059B0D3158574 // 2^(2/64)
+data8 0x0000874518759BC8 // 2^(3/64)
+data8 0x0000B5586CF9890F // 2^(4/64)
+data8 0x0000E3EC32D3D1A2 // 2^(5/64)
+data8 0x00011301D0125B51 // 2^(6/64)
+data8 0x0001429AAEA92DE0 // 2^(7/64)
+data8 0x000172B83C7D517B // 2^(8/64)
+data8 0x0001A35BEB6FCB75 // 2^(9/64)
+data8 0x0001D4873168B9AA // 2^(10/64)
+data8 0x0002063B88628CD6 // 2^(11/64)
+data8 0x0002387A6E756238 // 2^(12/64)
+data8 0x00026B4565E27CDD // 2^(13/64)
+data8 0x00029E9DF51FDEE1 // 2^(14/64)
+data8 0x0002D285A6E4030B // 2^(15/64)
+data8 0x000306FE0A31B715 // 2^(16/64)
+data8 0x00033C08B26416FF // 2^(17/64)
+data8 0x000371A7373AA9CB // 2^(18/64)
+data8 0x0003A7DB34E59FF7 // 2^(19/64)
+data8 0x0003DEA64C123422 // 2^(20/64)
+data8 0x0004160A21F72E2A // 2^(21/64)
+data8 0x00044E086061892D // 2^(22/64)
+data8 0x000486A2B5C13CD0 // 2^(23/64)
+data8 0x0004BFDAD5362A27 // 2^(24/64)
+data8 0x0004F9B2769D2CA7 // 2^(25/64)
+data8 0x0005342B569D4F82 // 2^(26/64)
+data8 0x00056F4736B527DA // 2^(27/64)
+data8 0x0005AB07DD485429 // 2^(28/64)
+data8 0x0005E76F15AD2148 // 2^(29/64)
+data8 0x0006247EB03A5585 // 2^(30/64)
+data8 0x0006623882552225 // 2^(31/64)
+data8 0x0006A09E667F3BCD // 2^(32/64)
+data8 0x0006DFB23C651A2F // 2^(33/64)
+data8 0x00071F75E8EC5F74 // 2^(34/64)
+data8 0x00075FEB564267C9 // 2^(35/64)
+data8 0x0007A11473EB0187 // 2^(36/64)
+data8 0x0007E2F336CF4E62 // 2^(37/64)
+data8 0x00082589994CCE13 // 2^(38/64)
+data8 0x000868D99B4492ED // 2^(39/64)
+data8 0x0008ACE5422AA0DB // 2^(40/64)
+data8 0x0008F1AE99157736 // 2^(41/64)
+data8 0x00093737B0CDC5E5 // 2^(42/64)
+data8 0x00097D829FDE4E50 // 2^(43/64)
+data8 0x0009C49182A3F090 // 2^(44/64)
+data8 0x000A0C667B5DE565 // 2^(45/64)
+data8 0x000A5503B23E255D // 2^(46/64)
+data8 0x000A9E6B5579FDBF // 2^(47/64)
+data8 0x000AE89F995AD3AD // 2^(48/64)
+data8 0x000B33A2B84F15FB // 2^(49/64)
+data8 0x000B7F76F2FB5E47 // 2^(50/64)
+data8 0x000BCC1E904BC1D2 // 2^(51/64)
+data8 0x000C199BDD85529C // 2^(52/64)
+data8 0x000C67F12E57D14B // 2^(53/64)
+data8 0x000CB720DCEF9069 // 2^(54/64)
+data8 0x000D072D4A07897C // 2^(55/64)
+data8 0x000D5818DCFBA487 // 2^(56/64)
+data8 0x000DA9E603DB3285 // 2^(57/64)
+data8 0x000DFC97337B9B5F // 2^(58/64)
+data8 0x000E502EE78B3FF6 // 2^(59/64)
+data8 0x000EA4AFA2A490DA // 2^(60/64)
+data8 0x000EFA1BEE615A27 // 2^(61/64)
+data8 0x000F50765B6E4540 // 2^(62/64)
+data8 0x000FA7C1819E90D8 // 2^(63/64)
+LOCAL_OBJECT_END(_coshf_table)
+
+LOCAL_OBJECT_START(cosh_p_table)
+data8 0x3efa3001dcf5905b // A4
+data8 0x3f56c1437543543e // A3
+data8 0x3fa5555572601504 // A2
+data8 0x3fdfffffffe2f097 // A1
+LOCAL_OBJECT_END(cosh_p_table)
 
-// X infinity 
-{ .mfi
-       nop.m 999
-(p0)  fclass.m.unc  p6,p0 = f8, 0x23               
-       nop.i 999 ;;
-}
 
-{ .mfb
-       nop.m 999
-(p6)     fmerge.s      f8 = f0,f8                  
-(p6)  br.ret.spnt    b0 ;;                  
-}
+.section .text
+GLOBAL_IEEE754_ENTRY(coshf)
 
-// Put 0.25 in f9; p6 true if x < 0.25
 { .mlx
-       nop.m 999
-(p0)     movl            r32 = 0x000000000000fffd ;;         
-}
-
-{ .mfi
-(p0)     setf.exp        f9 = r32                         
-       nop.f 999
-       nop.i 999 ;;
+      getf.exp        rSignexp_x = f8  // Must recompute if x unorm
+      movl            r64DivLn2 = 0x40571547652B82FE // 64/ln(2)
 }
-
-{ .mfi
-       nop.m 999
-(p0)  fmerge.s      coshf_FR_X    = f0,f8                
-       nop.i 999
+{ .mlx
+      addl            rTblAddr = @ltoff(_coshf_table),gp
+      movl            rRightShifter = 0x43E8000000000000 // DP Right Shifter
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)  fmerge.s      coshf_FR_SGNX = f8,f1                
-       nop.i 999 ;;
+      // point to the beginning of the table
+      ld8             rTblAddr = [rTblAddr]
+      fclass.m        p6, p0 = f8, 0x0b   // Test for x=unorm
+      addl            rA3 = 0x3E2AA, r0   // high bits of 1.0/6.0 rounded to SP
 }
-
 { .mfi
-       nop.m 999
-(p0)     fcmp.lt.unc     p0,p7 = coshf_FR_X,f9                    
-       nop.i 999 ;;
-}
-
-{ .mib
-       nop.m 999
-       nop.i 999
-(p7)     br.cond.sptk    L(COSH_BY_TBL) ;;                      
-}
-
-
-// COSH_BY_POLY: 
-
-// POLY cannot overflow so there is no need to call __libm_error_support
-// Get the values of P_x from the table
-
-{ .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(single_coshf_p_table), gp
-      nop.i 999
+      nop.m           0
+      fnorm.s1        fNormX = f8 // normalized x
+      addl            rExpHalf = 0xFFFE, r0 // exponent of 1/2
 }
 ;;
 
-{ .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-// Calculate coshf_FR_X2 = ax*ax and coshf_FR_X4 = ax*ax*ax*ax
-{ .mmf
-       nop.m 999
-(p0)     ldfe       coshf_FR_P1 = [r34],16                 
-(p0)     fma.s1     coshf_FR_X2 = coshf_FR_X, coshf_FR_X, f0 ;;           
-}
-
-{ .mmi
-(p0)     ldfe       coshf_FR_P2 = [r34],16 ;;                 
-(p0)     ldfe       coshf_FR_P3 = [r34],16                 
-       nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe       coshf_FR_P4 = [r34],16 ;;                 
-(p0)     ldfe       coshf_FR_P5 = [r34],16                 
-       nop.i 999 ;;
-}
-
 { .mfi
-(p0)     ldfe       coshf_FR_P6 = [r34],16                 
-(p0)     fma.s1     coshf_FR_X4 = coshf_FR_X2, coshf_FR_X2, f0         
-       nop.i 999 ;;
+      setf.d          f64DivLn2 = r64DivLn2 // load 64/ln(2) to FP reg
+      fclass.m        p15, p0 = f8, 0x1e3   // test for NaT,NaN,Inf
+      nop.i           0
 }
-
-// Calculate coshf_FR_podd = x4 *(x4 * P_5 + P_3) + P_1
-{ .mfi
-       nop.m 999
-(p0)     fma.s1     coshf_FR_poly_podd_temp1 = coshf_FR_X4, coshf_FR_P5, coshf_FR_P3                
-       nop.i 999 ;;
+{ .mlx
+      // load Right Shifter to FP reg
+      setf.d          fRightShifter = rRightShifter
+      movl            rLn2Div64 = 0x3F862E42FEFA39EF // DP ln(2)/64 in GR
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1     coshf_FR_podd            = coshf_FR_X4, coshf_FR_poly_podd_temp1, coshf_FR_P1   
-       nop.i 999
+      mov             rExp_mask = 0x1ffff
+      fcmp.eq.s1      p13, p0 = f0, f8 // test for x = 0.0
+      shl             rA3 = rA3, 12    // 0x3E2AA000, approx to 1.0/6.0 in SP
 }
-
-// Calculate coshf_FR_peven =  p_even = x4 *(x4 * (x4 * P_6 + P_4) + P_2)
-{ .mfi
-       nop.m 999
-(p0)     fma.s1     coshf_FR_poly_peven_temp1 = coshf_FR_X4, coshf_FR_P6, coshf_FR_P4               
-       nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    COSH_UNORM            // Branch if x=unorm
 }
+;;
 
+COSH_COMMON:
 { .mfi
-       nop.m 999
-(p0)     fma.s1     coshf_FR_poly_peven_temp2 = coshf_FR_X4, coshf_FR_poly_peven_temp1, coshf_FR_P2 
-       nop.i 999 ;;
+      setf.exp        fA2 = rExpHalf        // load A2 to FP reg
+      nop.f           0
+      mov             rExp_bias = 0xffff
 }
-
-{ .mfi
-       nop.m 999
-(p0)     fma.s1     coshf_FR_peven       = coshf_FR_X4, coshf_FR_poly_peven_temp2, f0         
-       nop.i 999 ;;
+{ .mfb
+      setf.d          fLn2Div64 = rLn2Div64 // load ln(2)/64 to FP reg
+(p15) fma.s.s0        f8 = f8, f8, f0       // result if x = NaT,NaN,Inf
+(p15) br.ret.spnt     b0                    // exit here if x = NaT,NaN,Inf
 }
-
-// Y_lo = x2*p_odd + p_even
-// Calculate f8 = Y_hi + Y_lo 
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1     coshf_FR_Y_lo         = coshf_FR_X2, coshf_FR_podd,  coshf_FR_peven    
-       nop.i 999 ;;
+      // min overflow and max normal threshold
+      ldfps           fMIN_SGL_OFLOW_ARG, fMAX_SGL_NORM_ARG = [rTblAddr], 8
+      nop.f           0
+      and             rExp_x = rExp_mask, rSignexp_x // Biased exponent of x
 }
-
 { .mfb
-       nop.m 999
-(p0)     fma.s.s0   f8                   = f1, f1, coshf_FR_Y_lo                        
-(p0)     br.ret.sptk    b0 ;;                                                        
-}
-
-
-L(COSH_BY_TBL): 
-
-// Now that we are at TBL; so far all we know is that |x| >= 0.25.
-// The first two steps are the same for TBL and EXP, but if we are HUGE
-// Double
-// Go to HUGE if |x| >= 2^10, 10009 (register-biased) is e = 10 (true)
-// Single
-// Go to HUGE if |x| >= 2^7,  10006 (register-biased) is e =  7 (true)
-// we want to leave now. Go to HUGE if |x| >= 2^14
-// 1000d (register-biased) is e = 14 (true)
-
-{ .mlx
-       nop.m 999
-(p0)     movl            r32 = 0x0000000000010006 ;;              
+      setf.s          fA3 = rA3                  // load A3 to FP reg
+(p13) fma.s.s0        f8 = f1, f1, f0            // result if x = 0.0
+(p13) br.ret.spnt     b0                         // exit here if x =0.0
 }
+;;
 
 { .mfi
-(p0)     setf.exp        f9 = r32                              
-       nop.f 999
-       nop.i 999 ;;
+      sub             rExp_x = rExp_x, rExp_bias // True exponent of x
+      fmerge.s        fAbsX = f0, fNormX         // Form |x|
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fcmp.ge.unc     p6,p7 = coshf_FR_X,f9                  
-       nop.i 999 ;;
-}
-
-{ .mib
-       nop.m 999
-       nop.i 999
-(p6)     br.cond.spnt    L(COSH_HUGE) ;;                             
+      nop.m           0
+      // x*(64/ln(2)) + Right Shifter
+      fma.s1          fNint = fNormX, f64DivLn2, fRightShifter
+      add             rTblAddr = 8, rTblAddr
 }
-
-// r32 = 1
-// r34 = N-1 
-// r35 = N
-// r36 = j
-// r37 = N+1
-
-// TBL can never overflow
-// coshf(x) = coshf(B+R)
-//         = coshf(B) coshf(R) + sinh(B) sinh(R) 
-// coshf(R) can be approximated by 1 + p_even
-// sinh(R) can be approximated by p_odd
-
-// ******************************************************
-// STEP 1 (TBL and EXP)
-// ******************************************************
-// Get the following constants.
-// f9  = Inv_log2by64
-// f10 = log2by64_hi
-// f11 = log2by64_lo
-
-{ .mmi
-(p0)     adds                 r32 = 0x1,r0      
-(p0)     addl           r34   = @ltoff(single_coshf_arg_reduction), gp
-         nop.i 999
+{ .mfb
+      cmp.gt          p7, p0 = -2, rExp_x        // Test |x| < 2^(-2)
+      fma.s1          fXsq = fNormX, fNormX, f0  // x*x for small path
+(p7)  br.cond.spnt    COSH_SMALL                 // Branch if 0 < |x| < 2^-2
 }
 ;;
 
-
-// We want 2^(N-1) and 2^(-N-1). So bias N-1 and -N-1 and
-// put them in an exponent.
-// coshf_FR_spos = 2^(N-1) and coshf_FR_sneg = 2^(-N-1)
-// r39 = 0xffff + (N-1)  = 0xffff +N -1
-// r40 = 0xffff - (N +1) = 0xffff -N -1
-
-{ .mlx
-         ld8 r34 = [r34]
-(p0)     movl                r38 = 0x000000000000fffe ;; 
-}
-
-{ .mmi
-(p0)     ldfe            coshf_FR_Inv_log2by64 = [r34],16 ;;            
-(p0)     ldfe            coshf_FR_log2by64_hi  = [r34],16            
-       nop.i 999 ;;
-}
-
-{ .mbb
-(p0)     ldfe            coshf_FR_log2by64_lo  = [r34],16            
-       nop.b 999
-       nop.b 999 ;;
-}
-
-// Get the A coefficients
-// f9  = A_1
-// f10 = A_2
-// f11 = A_3
-
-{ .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(single_coshf_ab_table), gp
-      nop.i 999
+{ .mfi
+      nop.m           0
+      // check for overflow
+      fcmp.ge.s1      p12, p13 = fAbsX, fMIN_SGL_OFLOW_ARG
+      mov             rJ_mask = 0x3f             // 6-bit mask for J
 }
 ;;
 
-{ .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+{ .mfb
+      nop.m           0
+      fms.s1          fN = fNint, f1, fRightShifter // n in FP register
+      // branch out if overflow
+(p12) br.cond.spnt    COSH_CERTAIN_OVERFLOW
 }
 ;;
 
-
-// Calculate M and keep it as integer and floating point.
-// M = round-to-integer(x*Inv_log2by64)
-// coshf_FR_M = M = truncate(ax/(log2/64))
-// Put the significand of M in r35
-//    and the floating point representation of M in coshf_FR_M
-
-{ .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_M      = coshf_FR_X, coshf_FR_Inv_log2by64, f0 
-       nop.i 999
-}
-
-{ .mfi
-(p0)     ldfe            coshf_FR_A1 = [r34],16            
-       nop.f 999
-       nop.i 999 ;;
-}
-
 { .mfi
-       nop.m 999
-(p0)     fcvt.fx.s1      coshf_FR_M_temp = coshf_FR_M                      
-       nop.i 999 ;;
+      getf.sig        rNJ = fNint                   // bits of n, j
+      // check for possible overflow
+      fcmp.gt.s1      p13, p0 = fAbsX, fMAX_SGL_NORM_ARG
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fnorm.s1        coshf_FR_M      = coshf_FR_M_temp                 
-       nop.i 999 ;;
+      addl            rN = 0xFFBF - 63, rNJ      // biased and shifted n-1,j
+      fnma.s1         fR = fLn2Div64, fN, fNormX // R = x - N*ln(2)/64
+      and             rJ = rJ_mask, rNJ          // bits of j
 }
-
 { .mfi
-(p0)     getf.sig        r35       = coshf_FR_M_temp                 
-       nop.f 999
-       nop.i 999 ;;
+      sub             rNJ_neg = r0, rNJ          // bits of n, j for -x
+      nop.f           0
+      andcm           rN_mask = -1, rJ_mask      // 0xff...fc0 to mask N
 }
-
-// M is still in r35. Calculate j. j is the signed extension of the six lsb of M. It
-// has a range of -32 thru 31.
-// r35 = M
-// r36 = j 
-
-{ .mii
-       nop.m 999
-       nop.i 999 ;;
-(p0)     and            r36 = 0x3f, r35 ;;   
-}
-
-// Calculate R
-// f13 = f44 - f12*f10 = x - M*log2by64_hi
-// f14 = f13 - f8*f11 = R = (x - M*log2by64_hi) - M*log2by64_lo
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fnma.s1        coshf_FR_R_temp = coshf_FR_M, coshf_FR_log2by64_hi, coshf_FR_X      
-       nop.i 999
+      shladd          rJ = rJ, 3, rTblAddr // address in the 2^(j/64) table
+      nop.f           0
+      and             rN = rN_mask, rN     // biased, shifted n-1
 }
-
 { .mfi
-(p0)     ldfe            coshf_FR_A2 = [r34],16            
-       nop.f 999
-       nop.i 999 ;;
+      addl            rN_neg = 0xFFBF - 63, rNJ_neg // -x biased, shifted n-1,j
+      nop.f           0
+      and             rJ_neg = rJ_mask, rNJ_neg     // bits of j for -x
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fnma.s1        coshf_FR_R      = coshf_FR_M, coshf_FR_log2by64_lo, coshf_FR_R_temp 
-       nop.i 999
+      ld8             rJ = [rJ]                    // Table value
+      nop.f           0
+      shl             rN = rN, 46 // 2^(n-1) bits in DP format
 }
-
-// Get the B coefficients
-// f15 = B_1
-// f32 = B_2
-// f33 = B_3
-
-{ .mmi
-(p0)     ldfe            coshf_FR_A3 = [r34],16 ;;            
-(p0)     ldfe            coshf_FR_B1 = [r34],16            
-       nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe            coshf_FR_B2 = [r34],16 ;;            
-(p0)     ldfe            coshf_FR_B3 = [r34],16            
-       nop.i 999 ;;
-}
-
-{ .mii
-       nop.m 999
-(p0)     shl            r34 = r36,  0x2 ;;   
-(p0)     sxt1           r37 = r34 ;;         
-}
-
-// ******************************************************
-// STEP 2 (TBL and EXP)
-// ******************************************************
-// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-// f12 = R*R*R
-// f13 = R*R
-// f14 = R <== from above
-
 { .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_Rsq  = coshf_FR_R,   coshf_FR_R, f0  
-(p0)     shr            r36 = r37,  0x2 ;;   
-}
-
-// r34 = M-j = r35 - r36
-// r35 = N = (M-j)/64
-
-{ .mii
-(p0)     sub                  r34 = r35, r36    
-       nop.i 999 ;;
-(p0)     shr                  r35 = r34, 0x6 ;;    
-}
-
-{ .mii
-(p0)     sub                 r40 = r38, r35           
-(p0)     adds                 r37 = 0x1, r35    
-(p0)     add                 r39 = r38, r35 ;;           
-}
-
-// Get the address of the J table, add the offset,
-// addresses are sinh_AD_mJ and sinh_AD_J, get the T value
-// f32 = T(j)_hi
-// f33 = T(j)_lo
-// f34 = T(-j)_hi
-// f35 = T(-j)_lo
-
-{ .mmi
-(p0)     sub                  r34 = r35, r32    
-(p0)     addl    r37   = @ltoff(single_coshf_j_table), gp
-         nop.i 999
+      shladd          rJ_neg = rJ_neg, 3, rTblAddr // addr in 2^(j/64) table -x
+      nop.f           0
+      and             rN_neg = rN_mask, rN_neg     // biased, shifted n-1 for -x
 }
 ;;
 
 { .mfi
-      ld8 r37 = [r37]
-(p0)     fma.s1          coshf_FR_Rcub = coshf_FR_Rsq, coshf_FR_R, f0  
-       nop.i 999
-}
-
-// ******************************************************
-// STEP 3 Now decide if we need to branch to EXP
-// ******************************************************
-// Put 32 in f9; p6 true if x < 32
-
-{ .mlx
-       nop.m 999
-(p0)     movl                r32 = 0x0000000000010004 ;;               
+      ld8             rJ_neg = [rJ_neg]            // Table value for -x
+      nop.f           0
+      shl             rN_neg = rN_neg, 46 // 2^(n-1) bits in DP format for -x
 }
-
-// Calculate p_even
-// f34 = B_2 + Rsq *B_3
-// f35 = B_1 + Rsq*f34      = B_1 + Rsq * (B_2 + Rsq *B_3)
-// f36 = peven = Rsq * f35 = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_peven_temp1 = coshf_FR_Rsq, coshf_FR_B3,          coshf_FR_B2  
-       nop.i 999 ;;
+      or              rN = rN, rJ // bits of 2^n * 2^(j/64) in DP format
+      nop.f           0
+      nop.i           0
 }
+;;
 
-{ .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_peven_temp2 = coshf_FR_Rsq, coshf_FR_peven_temp1, coshf_FR_B1  
-       nop.i 999
+{ .mmf
+      setf.d          fT = rN            // 2^(n-1) * 2^(j/64)
+      or              rN_neg = rN_neg, rJ_neg // -x bits of 2^n * 2^(j/64) in DP
+      fma.s1          fRSqr = fR, fR, f0 // R^2
 }
-
-// Calculate p_odd
-// f34 = A_2 + Rsq *A_3
-// f35 = A_1 + Rsq * (A_2 + Rsq *A_3)
-// f37 = podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_podd_temp1 = coshf_FR_Rsq,        coshf_FR_A3,         coshf_FR_A2  
-       nop.i 999 ;;
+      setf.d          fT_neg = rN_neg    // 2^(n-1) * 2^(j/64) for -x
+      fma.s1          fP = fA3, fR, fA2  // A3*R + A2
+      nop.i           0
 }
-
 { .mfi
-(p0)     setf.exp            coshf_FR_N_temp1 = r39            
-       nop.f 999
-       nop.i 999 ;;
+      nop.m           0
+      fnma.s1         fP_neg = fA3, fR, fA2  // A3*R + A2 for -x
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_peven       = coshf_FR_Rsq, coshf_FR_peven_temp2, f0     
-       nop.i 999
+      nop.m           0
+      fma.s1          fP = fP, fRSqr, fR // P = (A3*R + A2)*R^2 + R
+      nop.i           0
 }
-
 { .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_podd_temp2 = coshf_FR_Rsq,        coshf_FR_podd_temp1, coshf_FR_A1  
-       nop.i 999 ;;
+      nop.m           0
+      fms.s1          fP_neg = fP_neg, fRSqr, fR // P = (A3*R + A2)*R^2 + R, -x
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     setf.exp            f9  = r32                              
-       nop.f 999
-       nop.i 999 ;;
+      nop.m           0
+      fmpy.s0         fTmp = fLn2Div64, fLn2Div64       // Force inexact
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1          coshf_FR_podd       = coshf_FR_podd_temp2, coshf_FR_Rcub,       coshf_FR_R   
-       nop.i 999
-}
-
-// sinh_GR_mj contains the table offset for -j
-// sinh_GR_j  contains the table offset for +j
-// p6 is true when j <= 0
-
-{ .mlx
-(p0)     setf.exp            coshf_FR_N_temp2 = r40            
-(p0)     movl                r40 = 0x0000000000000020 ;;    
+      nop.m           0
+      fma.s1          fExp = fP, fT, fT                 // exp(x)/2
+      nop.i           0
 }
-
-{ .mfi
-(p0)     sub                 GR_mJ = r40,  r36           
-(p0)     fmerge.se           coshf_FR_spos    = coshf_FR_N_temp1, f1 
-(p0)     adds                GR_J  = 0x20, r36 ;;           
+{ .mfb
+      nop.m           0
+      fma.s1          fExp_neg = fP_neg, fT_neg, fT_neg // exp(-x)/2
+      // branch out if possible overflow result
+(p13) br.cond.spnt    COSH_POSSIBLE_OVERFLOW
 }
+;;
 
-{ .mii
-       nop.m 999
-(p0)     shl                  GR_mJ = GR_mJ, 5 ;;   
-(p0)     add                  AD_mJ = r37, GR_mJ ;; 
+{ .mfb
+      nop.m           0
+      // final result in the absence of overflow
+      fma.s.s0        f8 = fExp, f1, fExp_neg  // result = (exp(x)+exp(-x))/2
+      // exit here in the absence of overflow
+      br.ret.sptk     b0              // Exit main path, 0.25 <= |x| < 89.41598
 }
+;;
 
+// Here if 0 < |x| < 0.25.  Evaluate 8th order polynomial.
+COSH_SMALL:
 { .mmi
-       nop.m 999
-(p0)     ldfe                 coshf_FR_Tmjhi = [AD_mJ],16                 
-(p0)     shl                  GR_J  = GR_J, 5 ;;    
-}
-
-{ .mfi
-(p0)     ldfs                 coshf_FR_Tmjlo = [AD_mJ],16                 
-(p0)     fcmp.lt.unc.s1      p6,p7 = coshf_FR_X,f9                          
-(p0)     add                  AD_J  = r37, GR_J ;;  
+      add             rAd1 = 0x200, rTblAddr
+      add             rAd2 = 0x210, rTblAddr
+      nop.i           0
 }
+;;
 
 { .mmi
-(p0)     ldfe                 coshf_FR_Tjhi  = [AD_J],16 ;;                  
-(p0)     ldfs                 coshf_FR_Tjlo  = [AD_J],16                  
-       nop.i 999 ;;
-}
-
-{ .mfb
-       nop.m 999
-(p0)     fmerge.se           coshf_FR_sneg    = coshf_FR_N_temp2, f1 
-(p7)     br.cond.spnt        L(COSH_BY_EXP) ;;                            
-}
-
-// ******************************************************
-// If NOT branch to EXP
-// ******************************************************
-// Calculate C_hi
-// ******************************************************
-// coshf_FR_C_hi_temp = coshf_FR_sneg * coshf_FR_Tmjhi
-// coshf_FR_C_hi = coshf_FR_spos * coshf_FR_Tjhi + (coshf_FR_sneg * coshf_FR_Tmjhi)
-
-{ .mfi
-       nop.m 999
-(p0)    fma.s1         coshf_FR_C_hi_temp = coshf_FR_sneg, coshf_FR_Tmjhi, f0                   
-       nop.i 999 ;;
-}
-
-{ .mfi
-       nop.m 999
-(p0)    fma.s1         coshf_FR_C_hi      = coshf_FR_spos, coshf_FR_Tjhi,  coshf_FR_C_hi_temp    
-       nop.i 999
-}
-
-// ******************************************************
-// Calculate S_hi
-// ******************************************************
-// coshf_FR_S_hi_temp1 = coshf_FR_sneg * coshf_FR_Tmjhi
-// coshf_FR_S_hi = coshf_FR_spos * coshf_FR_Tjhi - coshf_FR_C_hi_temp1
-
-{ .mfi
-       nop.m 999
-(p0)     fma.s1        coshf_FR_S_hi_temp1 =  coshf_FR_sneg, coshf_FR_Tmjhi, f0                
-       nop.i 999 ;;
-}
-
-// ******************************************************
-// Calculate C_lo
-// ******************************************************
-// coshf_FR_C_lo_temp1 = coshf_FR_spos * coshf_FR_Tjhi - coshf_FR_C_hi
-// coshf_FR_C_lo_temp2 = coshf_FR_sneg * coshf_FR_Tmjlo + (coshf_FR_spos * coshf_FR_Tjhi - coshf_FR_C_hi)
-// coshf_FR_C_lo_temp1 = coshf_FR_sneg * coshf_FR_Tmjlo
-// coshf_FR_C_lo_temp3 = coshf_FR_spos * coshf_FR_Tjlo + (coshf_FR_sneg * coshf_FR_Tmjlo)
-// coshf_FR_C_lo = coshf_FR_C_lo_temp3 + coshf_FR_C_lo_temp2
-
-{ .mfi
-       nop.m 999
-(p0)     fms.s1        coshf_FR_C_lo_temp1 = coshf_FR_spos, coshf_FR_Tjhi,  coshf_FR_C_hi        
-       nop.i 999
-}
-
-{ .mfi
-       nop.m 999
-(p0)     fms.s1        coshf_FR_S_hi       =  coshf_FR_spos, coshf_FR_Tjhi, coshf_FR_S_hi_temp1 
-       nop.i 999 ;;
-}
-
-{ .mfi
-       nop.m 999
-(p0)     fma.s1        coshf_FR_C_lo_temp2 = coshf_FR_sneg, coshf_FR_Tmjhi, coshf_FR_C_lo_temp1  
-       nop.i 999
+      ldfpd           fA4, fA3 = [rAd1]
+      ldfpd           fA2, fA1 = [rAd2]
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1        coshf_FR_C_lo_temp1 = coshf_FR_sneg, coshf_FR_Tmjlo, f0                  
-       nop.i 999 ;;
+      nop.m           0
+      fma.s1          fX4 = fXsq, fXsq, f0
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)     fma.s1        coshf_FR_C_lo_temp3 =  coshf_FR_spos, coshf_FR_Tjlo,  coshf_FR_C_lo_temp1 
-       nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA43 = fXsq, fA4, fA3
+      nop.i           0
 }
-
 { .mfi
-       nop.m 999
-(p0)     fma.s1        coshf_FR_C_lo       =  coshf_FR_C_lo_temp3, f1,   coshf_FR_C_lo_temp2    
-       nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA21 = fXsq, fA2, fA1
+      nop.i           0
 }
-
-// ******************************************************
-// coshf_FR_Y_lo_temp = coshf_FR_C_hi * coshf_FR_peven + coshf_FR_C_lo
-// coshf_FR_Y_lo = coshf_FR_S_hi * coshf_FR_podd + coshf_FR_Y_lo_temp
-// coshf_FR_COSH = Y_hi + Y_lo
+;;
 
 { .mfi
-       nop.m 999
-(p0)    fma.s1         coshf_FR_Y_lo_temp =  coshf_FR_C_hi, coshf_FR_peven, coshf_FR_C_lo       
-       nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA4321 = fX4, fA43, fA21
+      nop.i           0
 }
+;;
 
+// Dummy multiply to generate inexact
 { .mfi
-       nop.m 999
-(p0)    fma.s1         coshf_FR_Y_lo      =  coshf_FR_S_hi, coshf_FR_podd, coshf_FR_Y_lo_temp   
-       nop.i 999 ;;
+      nop.m           0
+      fmpy.s0         fTmp = fA4, fA4
+      nop.i           0
 }
-
 { .mfb
-       nop.m 999
-(p0)    fma.s.s0       f8 =  coshf_FR_C_hi, f1, coshf_FR_Y_lo                       
-(p0)    br.ret.sptk        b0 ;;                                           
+      nop.m           0
+      fma.s.s0        f8 = fA4321, fXsq, f1
+      br.ret.sptk     b0                // Exit if 0 < |x| < 0.25
 }
+;;
 
+COSH_POSSIBLE_OVERFLOW:
 
-L(COSH_BY_EXP): 
+// Here if fMAX_SGL_NORM_ARG < x < fMIN_SGL_OFLOW_ARG
+// This cannot happen if input is a single, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-// When p7 is true,  we know that an overflow is not going to happen
-// When p7 is false, we must check for possible overflow
-// p7 is the over_SAFE flag
-// f44 = Scale * (Y_hi + Y_lo)
-//     =  coshf_FR_spos * (coshf_FR_Tjhi + coshf_FR_Y_lo)
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest single, then we have
+// overflow
 
 { .mfi
-       nop.m 999
-(p0)    fma.s1         coshf_FR_Y_lo_temp =  coshf_FR_peven, f1,       coshf_FR_podd           
-       nop.i 999
-}
-
-// Now we are in EXP. This is the only path where an overflow is possible
-// but not for certain. So this is the only path where over_SAFE has any use.
-// r34 still has N-1
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// There is a danger of double overflow            if N-1 > 0x3fe = 1022
-// There is a danger of single overflow            if N-1 > 0x7e = 126
-
-{ .mlx
-       nop.m 999
-(p0)   movl                r32          = 0x000000000000007e ;;                       
-}
-
-{ .mfi
-(p0)   cmp.gt.unc          p0,p7        = r34, r32                                 
-       nop.f 999
-       nop.i 999 ;;
+      mov             rGt_ln  = 0x1007f // Exponent for largest single + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)    fma.s1         coshf_FR_Y_lo      =  coshf_FR_Tjhi,  coshf_FR_Y_lo_temp, coshf_FR_Tjlo       
-       nop.i 999 ;;
+      setf.exp        fGt_pln = rGt_ln  // Create largest single + 1 ulp
+      fma.s.s2        fWre_urm_f8 = fP, fT, fT    // Result with wre set
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)    fma.s1         coshf_FR_COSH_temp =  coshf_FR_Y_lo,  f1, coshf_FR_Tjhi                 
-       nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)    fma.s.s0       f44 = coshf_FR_spos,  coshf_FR_COSH_temp, f0                       
-       nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
+;;
 
-// If over_SAFE is set, return
 { .mfb
-       nop.m 999
-(p7)   fmerge.s            f8 = f44,f44
-(p7)   br.ret.sptk        b0 ;;
-}
-
-// Else see if we overflowed
-// S0 user supplied status
-// S2 user supplied status + WRE + TD  (Overflows)
-// If WRE is set then an overflow will not occur in EXP.
-// The input value that would cause a register (WRE) value to overflow is about 2^15
-// and this input would go into the HUGE path.
-// Answer with WRE is in f43.
-
-{ .mfi
-       nop.m 999
-(p0)   fsetc.s2            0x7F,0x42                                               
-       nop.i 999;;
-}
-
-{ .mfi
-       nop.m 999
-(p0)   fma.s.s2            f43  = coshf_FR_spos,  coshf_FR_COSH_temp, f0                      
-       nop.i 999 ;;
-}
-
-// 1 more that the exponent of the largest double (7FE)  = 7FF
-// 7FF - 3FF = 400 (true); 400 + FFFF = 103FF (register-biased)
-// So 0 103FF 8000000000000000  is one ulp more than
-// largest double in register bias
-// 1 more that the exponent of the largest single (FE)  = FF
-// FF - 7F = 80 (true); 80 + FFFF = 1007F (register-biased)
-// Now  set p8 if the answer with WRE is greater than or equal this value
-// Also set p9 if the answer with WRE is less than or equal to negative this value
-
-{ .mlx
-       nop.m 999
-(p0)   movl                r32          = 0x000000000001007f ;;                     
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    COSH_CERTAIN_OVERFLOW // Branch if overflow
 }
+;;
 
-{ .mmf
-       nop.m 999
-(p0)   setf.exp            f41          = r32                                    
-(p0)   fsetc.s2            0x7F,0x40 ;;                                               
+{ .mfb
+      nop.m           0
+      fma.s.s0        f8 = fP, fT, fT
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
+;;
 
-{ .mfi
-       nop.m 999
-(p0)   fcmp.ge.unc.s1      p8, p0       = f43, f41                               
-       nop.i 999
+// here if overflow
+COSH_CERTAIN_OVERFLOW:
+{ .mmi
+      addl            r17ones_m1 = 0x1FFFE, r0
+;;
+      setf.exp        fTmp = r17ones_m1
+      nop.i           0
 }
+;;
 
 { .mfi
-       nop.m 999
-(p0)   fmerge.ns           f42 = f41, f41                                        
-       nop.i 999 ;;
-}
-
-// The error tag for overflow is 65
-{ .mii
-       nop.m 999
-       nop.i 999 ;;
-(p8)   mov                 GR_Parameter_TAG = 65 ;;                                              
+      alloc           r32 = ar.pfs, 0, 3, 4, 0 // get some registers
+      fmerge.s        FR_X = f8,f8
+      nop.i           0
 }
-
 { .mfb
-       nop.m 999
-(p0)   fcmp.le.unc.s1      p9, p0 =  f43, f42                                    
-(p8)   br.cond.spnt __libm_error_region ;;
-}
-
-{ .mii
-       nop.m 999
-       nop.i 999 ;;
-(p9)   mov                 GR_Parameter_TAG = 64                                              
-}
-
-{ .mib
-       nop.m 999
-       nop.i 999
-(p9)   br.cond.spnt __libm_error_region ;;
+      mov             GR_Parameter_TAG = 65
+      fma.s.s0        FR_RESULT = fTmp, fTmp, f0 // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
+// Here if x unorm
+COSH_UNORM:
 { .mfb
-       nop.m 999
-(p0)   fmerge.s            f8 = f44,f44                                          
-(p0)   br.ret.sptk b0 ;; 
-}
-
-
-L(COSH_HUGE): 
-
-// for COSH_HUGE, put 24000 in exponent; take sign from input; add 1
-// SAFE: SAFE is always 0 for HUGE
-
-{ .mlx
-       nop.m 999
-(p0)   movl                r32 = 0x0000000000015dbf ;;                               
-}
-
-{ .mfi
-(p0)   setf.exp            f9  = r32                                              
-       nop.f 999
-       nop.i 999 ;;
-}
-
-{ .mfi
-       nop.m 999
-(p0)   fma.s1              coshf_FR_hi_lo = f1, f9, f1                            
-       nop.i 999 ;;
+      getf.exp        rSignexp_x = fNormX    // Must recompute if x unorm
+      fcmp.eq.s0      p6, p0 = f8, f0        // Set D flag
+      br.cond.sptk    COSH_COMMON            // Return to main path
 }
+;;
 
-{ .mfi
-       nop.m 999
-(p0)   fma.s.s0            f44 = f9, coshf_FR_hi_lo, f0                           
-(p0)   mov                 GR_Parameter_TAG = 65                                               
-}
-.endp coshf
-ASM_SIZE_DIRECTIVE(coshf)
+GLOBAL_IEEE754_END(coshf)
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-        nop.f 0
+      add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+      nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
-.fframe 64 
-        add sp=-64,sp                           // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+.fframe 64
+      add sp=-64,sp                           // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                       // Save gp
 };;
 { .mmi
-        stfs [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
-.save   b0, GR_SAVE_B0                      
-        mov GR_SAVE_B0=b0                       // Save b0 
+      stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
+      add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0                       // Save b0
 };;
 .body
-{ .mib
-        stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack 
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  
-	nop.b 0                                 // Parameter 3 address
+{ .mfi
+      stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+      nop.f 0
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
 }
 { .mib
-        stfs [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y  
-        br.call.sptk.many b0=__libm_error_support#  // Call error handling function
+      stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
-        add   GR_Parameter_RESULT = 48,sp
+      add   GR_Parameter_RESULT = 48,sp
+      nop.m 0
+      nop.i 0
 };;
+
 { .mmi
-        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+      ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+      add   sp = 64,sp                       // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
-};; 
+      mov   gp = GR_SAVE_GP                  // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+      br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_coshl.S b/sysdeps/ia64/fpu/e_coshl.S
index daac20d9a3..b5872d0b24 100644
--- a/sysdeps/ia64/fpu/e_coshl.S
+++ b/sysdeps/ia64/fpu/e_coshl.S
@@ -1,10 +1,10 @@
 .file "coshl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2002, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,1129 +35,1061 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version 
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version 
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 1/23/01  Set inexact flag for large args.
+// 01/23/01 Set inexact flag for large args.
+// 05/07/01 Reworked to improve speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 12/06/02 Improved performance
 //
 // API
 //==============================================================
-// float       = cosh(float)
-// double      = cosh(double)
 // long double = coshl(long double)
 // input  floating point f8
 // output floating point f8
-
-
+//
+// Registers used
+//==============================================================
+// general registers: 
+// r14 -> r40
+// predicate registers used:
+// p6 -> p11
+// floating-point registers used:
+// f9 -> f15; f32 -> f90; 
+// f8 has input, then output
+//
 // Overview of operation
 //==============================================================
-// There are four paths
-
-// 1. |x| < 0.25        COSH_BY_POLY
-// 2. |x| < 32          COSH_BY_TBL
-// 3. |x| < 2^14        COSH_BY_EXP
-// 4. |x| >= 2^14       COSH_HUGE
-
-// For paths 1, and 2 SAFE is always 1.
-// For path  4, Safe is always 0.
-// SAFE = 1 means we cannot overflow.
-
-#include "libm_support.h"
-
+// There are seven paths
+// 1. 0 < |x| < 0.25          COSH_BY_POLY
+// 2. 0.25 <=|x| < 32         COSH_BY_TBL
+// 3. 32 <= |x| < 11357.21655 COSH_BY_EXP (merged path with COSH_BY_TBL)
+// 4. |x| >= 11357.21655      COSH_HUGE
+// 5. x=0                     Done with early exit
+// 6. x=inf,nan               Done with early exit
+// 7. x=denormal              COSH_DENORM
+//
+// For double extended we get overflow for x >= 400c b174 ddc0 31ae c0ea
+//                                           >= 11357.21655
+//
+//
+// 1. COSH_BY_POLY   0 < |x| < 0.25
+// ===============
+// Evaluate cosh(x) by a 12th order polynomial
+// Care is take for the order of multiplication; and P2 is not exactly 1/4!, 
+// P3 is not exactly 1/6!, etc.
+// cosh(x) = 1 + (P1*x^2 + P2*x^4 + P3*x^6 + P4*x^8 + P5*x^10 + P6*x^12)
+//
+// 2. COSH_BY_TBL   0.25 <= |x| < 32.0
+// =============
+// cosh(x) = cosh(B+R)
+//         = cosh(B)cosh(R) + sinh(B)sinh(R)
+// 
+// ax = |x| = M*log2/64 + R
+// B = M*log2/64
+// M = 64*N + j 
+//   We will calculate M and get N as (M-j)/64
+//   The division is a shift.
+// exp(B)  = exp(N*log2 + j*log2/64)
+//         = 2^N * 2^(j*log2/64)
+// cosh(B) = 1/2(e^B + e^-B)
+//         = 1/2(2^N * 2^(j*log2/64) + 2^-N * 2^(-j*log2/64)) 
+// cosh(B) = (2^(N-1) * 2^(j*log2/64) + 2^(-N-1) * 2^(-j*log2/64)) 
+// sinh(B) = (2^(N-1) * 2^(j*log2/64) - 2^(-N-1) * 2^(-j*log2/64)) 
+// 2^(j*log2/64) is stored as Tjhi + Tjlo , j= -32,....,32
+// Tjhi is double-extended (80-bit) and Tjlo is single(32-bit)
+//
+// R = ax - M*log2/64
+// R = ax - M*log2_by_64_hi - M*log2_by_64_lo
+// exp(R) = 1 + R +R^2(1/2! + R(1/3! + R(1/4! + ... + R(1/n!)...)
+//        = 1 + p_odd + p_even
+//        where the p_even uses the A coefficients and the p_even uses 
+//        the B coefficients
+//
+// So sinh(R) = 1 + p_odd + p_even -(1 -p_odd -p_even)/2 = p_odd
+//    cosh(R) = 1 + p_even
+//    cosh(B) = C_hi + C_lo
+//    sinh(B) = S_hi
+// cosh(x) = cosh(B)cosh(R) + sinh(B)sinh(R)
+//
+// 3. COSH_BY_EXP   32.0 <= |x| < 11357.21655  ( 400c b174 ddc0 31ae c0ea )
+// ==============
+// Can approximate result by exp(x)/2 in this region.
+// Y_hi = Tjhi
+// Y_lo = Tjhi * (p_odd + p_even) + Tjlo
+// cosh(x) = Y_hi + Y_lo
+//
+// 4. COSH_HUGE     |x| >= 11357.21655  ( 400c b174 ddc0 31ae c0ea )
+// ============
+// Set error tag and call error support
+//
+//
 // Assembly macros
 //==============================================================
-cosh_FR_X            = f44
-FR_RESULT            = f44
-cosh_FR_SGNX         = f40
-cosh_FR_all_ones     = f45
-
-FR_X                 = f8
-FR_Y                 = f0
-cosh_FR_Inv_log2by64 = f9
-cosh_FR_log2by64_lo  = f11
-cosh_FR_log2by64_hi  = f10
-
-cosh_FR_A1           = f9
-cosh_FR_A2           = f10
-cosh_FR_A3           = f11
-
-cosh_FR_Rcub         = f12
-cosh_FR_M_temp       = f13
-cosh_FR_R_temp       = f13
-cosh_FR_Rsq          = f13
-cosh_FR_R            = f14
-
-cosh_FR_M            = f38
-
-cosh_FR_tmp          = f15
-cosh_FR_B1           = f15
-cosh_FR_B2           = f32
-cosh_FR_B3           = f33
-
-cosh_FR_peven_temp1  = f34
-cosh_FR_peven_temp2  = f35
-cosh_FR_peven        = f36
-
-cosh_FR_podd_temp1   = f34
-cosh_FR_podd_temp2   = f35
-cosh_FR_podd         = f37
-
-cosh_FR_J_temp       = f9
-cosh_FR_J            = f10
-
-cosh_FR_Mmj          = f39
-
-cosh_FR_N_temp1      = f11
-cosh_FR_N_temp2      = f12
-cosh_FR_N            = f13
-
-cosh_FR_spos         = f14
-cosh_FR_sneg         = f15
-
-cosh_FR_Tjhi         = f32
-cosh_FR_Tjlo         = f33
-cosh_FR_Tmjhi        = f34
-cosh_FR_Tmjlo        = f35
-
-GR_mJ           = r35
-GR_J            = r36
-
-AD_mJ           = r38
-AD_J            = r39
-
-cosh_GR_all_ones     = r40
-
-GR_SAVE_PFS           = r41
-GR_SAVE_B0            = r42
-GR_SAVE_GP            = r43
-GR_Parameter_X        = r44
-GR_Parameter_Y        = r45
-GR_Parameter_RESULT   = r46
-GR_Parameter_TAG      = r47 
+r_ad5                 = r14
+r_rshf_2to57          = r15
+r_exp_denorm          = r15
+r_ad_mJ_lo            = r15
+r_ad_J_lo             = r16
+r_2Nm1                = r17
+r_2mNm1               = r18
+r_exp_x               = r18
+r_ad_J_hi             = r19
+r_ad2o                = r19
+r_ad_mJ_hi            = r20
+r_mj                  = r21
+r_ad2e                = r22
+r_ad3                 = r23
+r_ad1                 = r24
+r_Mmj                 = r24
+r_rshf                = r25
+r_M                   = r25
+r_N                   = r25
+r_jshf                = r26
+r_exp_2tom57          = r26
+r_j                   = r26
+r_exp_mask            = r27
+r_signexp_x           = r28
+r_signexp_0_5         = r28
+r_exp_0_25            = r29
+r_sig_inv_ln2         = r30
+r_exp_32              = r30
+r_exp_huge            = r30
+r_ad4                 = r31
+
+GR_SAVE_PFS           = r34
+GR_SAVE_B0            = r35
+GR_SAVE_GP            = r36
+
+GR_Parameter_X        = r37
+GR_Parameter_Y        = r38
+GR_Parameter_RESULT   = r39
+GR_Parameter_TAG      = r40
+
+
+f_ABS_X               = f9 
+f_X2                  = f10
+f_X4                  = f11
+f_tmp                 = f14
+f_RSHF                = f15
+
+f_Inv_log2by64        = f32
+f_log2by64_lo         = f33
+f_log2by64_hi         = f34
+f_A1                  = f35
+
+f_A2                  = f36
+f_A3                  = f37
+f_Rcub                = f38
+f_M_temp              = f39
+f_R_temp              = f40
+
+f_Rsq                 = f41
+f_R                   = f42
+f_M                   = f43
+f_B1                  = f44
+f_B2                  = f45
+
+f_B3                  = f46
+f_peven_temp1         = f47
+f_peven_temp2         = f48
+f_peven               = f49
+f_podd_temp1          = f50
+
+f_podd_temp2          = f51
+f_podd                = f52
+f_poly65              = f53
+f_poly6543            = f53
+f_poly6to1            = f53
+f_poly43              = f54
+f_poly21              = f55
+
+f_X3                  = f56
+f_INV_LN2_2TO63       = f57
+f_RSHF_2TO57          = f58
+f_2TOM57              = f59
+f_smlst_oflow_input   = f60
+
+f_pre_result          = f61
+f_huge                = f62
+f_spos                = f63
+f_sneg                = f64
+f_Tjhi                = f65
+
+f_Tjlo                = f66
+f_Tmjhi               = f67
+f_Tmjlo               = f68
+f_S_hi                = f69
+f_SC_hi_temp          = f70
+
+f_C_lo_temp1          = f71 
+f_C_lo_temp2          = f72 
+f_C_lo_temp3          = f73 
+f_C_lo_temp4          = f73 
+f_C_lo                = f74
+f_C_hi                = f75
+
+f_Y_hi                = f77 
+f_Y_lo_temp           = f78 
+f_Y_lo                = f79 
+f_NORM_X              = f80
+
+f_P1                  = f81
+f_P2                  = f82
+f_P3                  = f83
+f_P4                  = f84
+f_P5                  = f85
+
+f_P6                  = f86
+f_Tjhi_spos           = f87
+f_Tjlo_spos           = f88
+f_huge                = f89
+f_signed_hi_lo        = f90
 
-cosh_FR_C_hi         = f9
-cosh_FR_C_hi_temp    = f10
-cosh_FR_C_lo_temp1   = f11 
-cosh_FR_C_lo_temp2   = f12 
-cosh_FR_C_lo_temp3   = f13 
-
-cosh_FR_C_lo         = f38
-cosh_FR_S_hi         = f39
-
-cosh_FR_S_hi_temp1   = f10
-cosh_FR_Y_hi         = f11 
-cosh_FR_Y_lo_temp    = f12 
-cosh_FR_Y_lo         = f13 
-cosh_FR_COSH         = f9
-
-cosh_FR_X2           = f9
-cosh_FR_X4           = f10
-
-cosh_FR_P1           = f14
-cosh_FR_P2           = f15
-cosh_FR_P3           = f32
-cosh_FR_P4           = f33
-cosh_FR_P5           = f34
-cosh_FR_P6           = f35
-
-cosh_FR_TINY_THRESH  = f9
-
-cosh_FR_COSH_temp    = f10
-cosh_FR_SCALE        = f11 
-
-cosh_FR_hi_lo = f10
-
-cosh_FR_poly_podd_temp1    =  f11 
-cosh_FR_poly_podd_temp2    =  f13
-cosh_FR_poly_peven_temp1   =  f11
-cosh_FR_poly_peven_temp2   =  f13
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// DO NOT CHANGE ORDER OF THESE TABLES
+RODATA
 
 .align 16
-double_cosh_arg_reduction:
-ASM_TYPE_DIRECTIVE(double_cosh_arg_reduction,@object)
-   data8 0xB8AA3B295C17F0BC, 0x00004005
-   data8 0xB17217F7D1000000, 0x00003FF8
-   data8 0xCF79ABC9E3B39804, 0x00003FD0
-ASM_SIZE_DIRECTIVE(double_cosh_arg_reduction)
-
-double_cosh_p_table:
-ASM_TYPE_DIRECTIVE(double_cosh_p_table,@object)
-   data8 0x8000000000000000, 0x00003FFE
-   data8 0xAAAAAAAAAAAAAB80, 0x00003FFA
-   data8 0xB60B60B60B4FE884, 0x00003FF5
-   data8 0xD00D00D1021D7370, 0x00003FEF
-   data8 0x93F27740C0C2F1CC, 0x00003FE9
-   data8 0x8FA02AC65BCBD5BC, 0x00003FE2
-ASM_SIZE_DIRECTIVE(double_cosh_p_table)
-
-double_cosh_ab_table:
-ASM_TYPE_DIRECTIVE(double_cosh_ab_table,@object)
-   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC
-   data8 0x88888888884ECDD5, 0x00003FF8
-   data8 0xD00D0C6DCC26A86B, 0x00003FF2
-   data8 0x8000000000000002, 0x00003FFE
-   data8 0xAAAAAAAAAA402C77, 0x00003FFA
-   data8 0xB60B6CC96BDB144D, 0x00003FF5
-ASM_SIZE_DIRECTIVE(double_cosh_ab_table)
-
-double_cosh_j_table:
-ASM_TYPE_DIRECTIVE(double_cosh_j_table,@object)
-   data8 0xB504F333F9DE6484, 0x00003FFE, 0x1EB2FB13, 0x00000000
-   data8 0xB6FD91E328D17791, 0x00003FFE, 0x1CE2CBE2, 0x00000000
-   data8 0xB8FBAF4762FB9EE9, 0x00003FFE, 0x1DDC3CBC, 0x00000000
-   data8 0xBAFF5AB2133E45FB, 0x00003FFE, 0x1EE9AA34, 0x00000000
-   data8 0xBD08A39F580C36BF, 0x00003FFE, 0x9EAEFDC1, 0x00000000
-   data8 0xBF1799B67A731083, 0x00003FFE, 0x9DBF517B, 0x00000000
-   data8 0xC12C4CCA66709456, 0x00003FFE, 0x1EF88AFB, 0x00000000
-   data8 0xC346CCDA24976407, 0x00003FFE, 0x1E03B216, 0x00000000
-   data8 0xC5672A115506DADD, 0x00003FFE, 0x1E78AB43, 0x00000000
-   data8 0xC78D74C8ABB9B15D, 0x00003FFE, 0x9E7B1747, 0x00000000
-   data8 0xC9B9BD866E2F27A3, 0x00003FFE, 0x9EFE3C0E, 0x00000000
-   data8 0xCBEC14FEF2727C5D, 0x00003FFE, 0x9D36F837, 0x00000000
-   data8 0xCE248C151F8480E4, 0x00003FFE, 0x9DEE53E4, 0x00000000
-   data8 0xD06333DAEF2B2595, 0x00003FFE, 0x9E24AE8E, 0x00000000
-   data8 0xD2A81D91F12AE45A, 0x00003FFE, 0x1D912473, 0x00000000
-   data8 0xD4F35AABCFEDFA1F, 0x00003FFE, 0x1EB243BE, 0x00000000
-   data8 0xD744FCCAD69D6AF4, 0x00003FFE, 0x1E669A2F, 0x00000000
-   data8 0xD99D15C278AFD7B6, 0x00003FFE, 0x9BBC610A, 0x00000000
-   data8 0xDBFBB797DAF23755, 0x00003FFE, 0x1E761035, 0x00000000
-   data8 0xDE60F4825E0E9124, 0x00003FFE, 0x9E0BE175, 0x00000000
-   data8 0xE0CCDEEC2A94E111, 0x00003FFE, 0x1CCB12A1, 0x00000000
-   data8 0xE33F8972BE8A5A51, 0x00003FFE, 0x1D1BFE90, 0x00000000
-   data8 0xE5B906E77C8348A8, 0x00003FFE, 0x1DF2F47A, 0x00000000
-   data8 0xE8396A503C4BDC68, 0x00003FFE, 0x1EF22F22, 0x00000000
-   data8 0xEAC0C6E7DD24392F, 0x00003FFE, 0x9E3F4A29, 0x00000000
-   data8 0xED4F301ED9942B84, 0x00003FFE, 0x1EC01A5B, 0x00000000
-   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE, 0x1E8CAC3A, 0x00000000
-   data8 0xF281773C59FFB13A, 0x00003FFE, 0x9DBB3FAB, 0x00000000
-   data8 0xF5257D152486CC2C, 0x00003FFE, 0x1EF73A19, 0x00000000
-   data8 0xF7D0DF730AD13BB9, 0x00003FFE, 0x9BB795B5, 0x00000000
-   data8 0xFA83B2DB722A033A, 0x00003FFE, 0x1EF84B76, 0x00000000
-   data8 0xFD3E0C0CF486C175, 0x00003FFE, 0x9EF5818B, 0x00000000
-   data8 0x8000000000000000, 0x00003FFF, 0x00000000, 0x00000000
-   data8 0x8164D1F3BC030773, 0x00003FFF, 0x1F77CACA, 0x00000000
-   data8 0x82CD8698AC2BA1D7, 0x00003FFF, 0x1EF8A91D, 0x00000000
-   data8 0x843A28C3ACDE4046, 0x00003FFF, 0x1E57C976, 0x00000000
-   data8 0x85AAC367CC487B15, 0x00003FFF, 0x9EE8DA92, 0x00000000
-   data8 0x871F61969E8D1010, 0x00003FFF, 0x1EE85C9F, 0x00000000
-   data8 0x88980E8092DA8527, 0x00003FFF, 0x1F3BF1AF, 0x00000000
-   data8 0x8A14D575496EFD9A, 0x00003FFF, 0x1D80CA1E, 0x00000000
-   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF, 0x9D0373AF, 0x00000000
-   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF, 0x9F167097, 0x00000000
-   data8 0x8EA4398B45CD53C0, 0x00003FFF, 0x1EB70051, 0x00000000
-   data8 0x9031DC431466B1DC, 0x00003FFF, 0x1F6EB029, 0x00000000
-   data8 0x91C3D373AB11C336, 0x00003FFF, 0x1DFD6D8E, 0x00000000
-   data8 0x935A2B2F13E6E92C, 0x00003FFF, 0x9EB319B0, 0x00000000
-   data8 0x94F4EFA8FEF70961, 0x00003FFF, 0x1EBA2BEB, 0x00000000
-   data8 0x96942D3720185A00, 0x00003FFF, 0x1F11D537, 0x00000000
-   data8 0x9837F0518DB8A96F, 0x00003FFF, 0x1F0D5A46, 0x00000000
-   data8 0x99E0459320B7FA65, 0x00003FFF, 0x9E5E7BCA, 0x00000000
-   data8 0x9B8D39B9D54E5539, 0x00003FFF, 0x9F3AAFD1, 0x00000000
-   data8 0x9D3ED9A72CFFB751, 0x00003FFF, 0x9E86DACC, 0x00000000
-   data8 0x9EF5326091A111AE, 0x00003FFF, 0x9F3EDDC2, 0x00000000
-   data8 0xA0B0510FB9714FC2, 0x00003FFF, 0x1E496E3D, 0x00000000
-   data8 0xA27043030C496819, 0x00003FFF, 0x9F490BF6, 0x00000000
-   data8 0xA43515AE09E6809E, 0x00003FFF, 0x1DD1DB48, 0x00000000
-   data8 0xA5FED6A9B15138EA, 0x00003FFF, 0x1E65EBFB, 0x00000000
-   data8 0xA7CD93B4E965356A, 0x00003FFF, 0x9F427496, 0x00000000
-   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF, 0x1F283C4A, 0x00000000
-   data8 0xAB7A39B5A93ED337, 0x00003FFF, 0x1F4B0047, 0x00000000
-   data8 0xAD583EEA42A14AC6, 0x00003FFF, 0x1F130152, 0x00000000
-   data8 0xAF3B78AD690A4375, 0x00003FFF, 0x9E8367C0, 0x00000000
-   data8 0xB123F581D2AC2590, 0x00003FFF, 0x9F705F90, 0x00000000
-   data8 0xB311C412A9112489, 0x00003FFF, 0x1EFB3C53, 0x00000000
-   data8 0xB504F333F9DE6484, 0x00003FFF, 0x1F32FB13, 0x00000000
-ASM_SIZE_DIRECTIVE(double_cosh_j_table)
-
-.align 32
-.global coshl#
-
-.section .text
-.proc  coshl#
-.align 32
-
-coshl:
-
-#ifdef _LIBC
-.global __ieee754_coshl#
-.proc __ieee754_coshl#
-__ieee754_coshl:
-#endif
-
-// X NAN?
-
-{ .mfi
-      alloc r32 = ar.pfs,0,12,4,0                  
-(p0)  fclass.m.unc  p6,p7 = f8, 0xc3               
-      mov cosh_GR_all_ones = -1
-};;
-
-//   This is more than we need but it is in preparation
-//   for the values we add for error support. We push three
-//   addresses on the stack (3*8) = 24 bytes and one tag
-
-{ .mfb
-      nop.m 999
-(p6)     fma.s0   f8 = f8,f1,f8                  
-(p6)  br.ret.spnt     b0 ;;                          
-}
-
-
-// Make constant that will generate inexact when squared
-// X infinity 
-{ .mfi
-      setf.sig cosh_FR_all_ones = cosh_GR_all_ones 
-(p0)  fclass.m.unc  p6,p0 = f8, 0x23               
-      nop.i 999 ;;
-}
-
-{ .mfb
-      nop.m 999
-(p6)     fmerge.s      f8 = f0,f8                  
-(p6)  br.ret.spnt     b0 ;;
-}
+LOCAL_OBJECT_START(cosh_arg_reduction)
+//   data8 0xB8AA3B295C17F0BC, 0x00004005  // 64/log2 -- signif loaded with setf
+   data8 0xB17217F7D1000000, 0x00003FF8  // log2/64 high part
+   data8 0xCF79ABC9E3B39804, 0x00003FD0  // log2/64 low part
+   data8 0xb174ddc031aec0ea, 0x0000400c  // Smallest x to overflow (11357.21655)
+LOCAL_OBJECT_END(cosh_arg_reduction)
+
+LOCAL_OBJECT_START(cosh_p_table)
+   data8 0x8FA02AC65BCBD5BC, 0x00003FE2  // P6
+   data8 0xD00D00D1021D7370, 0x00003FEF  // P4
+   data8 0xAAAAAAAAAAAAAB80, 0x00003FFA  // P2
+   data8 0x93F27740C0C2F1CC, 0x00003FE9  // P5
+   data8 0xB60B60B60B4FE884, 0x00003FF5  // P3
+   data8 0x8000000000000000, 0x00003FFE  // P1
+LOCAL_OBJECT_END(cosh_p_table)
+
+LOCAL_OBJECT_START(cosh_ab_table)
+   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC  // A1
+   data8 0x88888888884ECDD5, 0x00003FF8  // A2
+   data8 0xD00D0C6DCC26A86B, 0x00003FF2  // A3
+   data8 0x8000000000000002, 0x00003FFE  // B1
+   data8 0xAAAAAAAAAA402C77, 0x00003FFA  // B2
+   data8 0xB60B6CC96BDB144D, 0x00003FF5  // B3
+LOCAL_OBJECT_END(cosh_ab_table)
+
+LOCAL_OBJECT_START(cosh_j_hi_table)
+   data8 0xB504F333F9DE6484, 0x00003FFE
+   data8 0xB6FD91E328D17791, 0x00003FFE
+   data8 0xB8FBAF4762FB9EE9, 0x00003FFE
+   data8 0xBAFF5AB2133E45FB, 0x00003FFE
+   data8 0xBD08A39F580C36BF, 0x00003FFE
+   data8 0xBF1799B67A731083, 0x00003FFE
+   data8 0xC12C4CCA66709456, 0x00003FFE
+   data8 0xC346CCDA24976407, 0x00003FFE
+   data8 0xC5672A115506DADD, 0x00003FFE
+   data8 0xC78D74C8ABB9B15D, 0x00003FFE
+   data8 0xC9B9BD866E2F27A3, 0x00003FFE
+   data8 0xCBEC14FEF2727C5D, 0x00003FFE
+   data8 0xCE248C151F8480E4, 0x00003FFE
+   data8 0xD06333DAEF2B2595, 0x00003FFE
+   data8 0xD2A81D91F12AE45A, 0x00003FFE
+   data8 0xD4F35AABCFEDFA1F, 0x00003FFE
+   data8 0xD744FCCAD69D6AF4, 0x00003FFE
+   data8 0xD99D15C278AFD7B6, 0x00003FFE
+   data8 0xDBFBB797DAF23755, 0x00003FFE
+   data8 0xDE60F4825E0E9124, 0x00003FFE
+   data8 0xE0CCDEEC2A94E111, 0x00003FFE
+   data8 0xE33F8972BE8A5A51, 0x00003FFE
+   data8 0xE5B906E77C8348A8, 0x00003FFE
+   data8 0xE8396A503C4BDC68, 0x00003FFE
+   data8 0xEAC0C6E7DD24392F, 0x00003FFE
+   data8 0xED4F301ED9942B84, 0x00003FFE
+   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE
+   data8 0xF281773C59FFB13A, 0x00003FFE
+   data8 0xF5257D152486CC2C, 0x00003FFE
+   data8 0xF7D0DF730AD13BB9, 0x00003FFE
+   data8 0xFA83B2DB722A033A, 0x00003FFE
+   data8 0xFD3E0C0CF486C175, 0x00003FFE
+   data8 0x8000000000000000, 0x00003FFF // Center of table
+   data8 0x8164D1F3BC030773, 0x00003FFF
+   data8 0x82CD8698AC2BA1D7, 0x00003FFF
+   data8 0x843A28C3ACDE4046, 0x00003FFF
+   data8 0x85AAC367CC487B15, 0x00003FFF
+   data8 0x871F61969E8D1010, 0x00003FFF
+   data8 0x88980E8092DA8527, 0x00003FFF
+   data8 0x8A14D575496EFD9A, 0x00003FFF
+   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF
+   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF
+   data8 0x8EA4398B45CD53C0, 0x00003FFF
+   data8 0x9031DC431466B1DC, 0x00003FFF
+   data8 0x91C3D373AB11C336, 0x00003FFF
+   data8 0x935A2B2F13E6E92C, 0x00003FFF
+   data8 0x94F4EFA8FEF70961, 0x00003FFF
+   data8 0x96942D3720185A00, 0x00003FFF
+   data8 0x9837F0518DB8A96F, 0x00003FFF
+   data8 0x99E0459320B7FA65, 0x00003FFF
+   data8 0x9B8D39B9D54E5539, 0x00003FFF
+   data8 0x9D3ED9A72CFFB751, 0x00003FFF
+   data8 0x9EF5326091A111AE, 0x00003FFF
+   data8 0xA0B0510FB9714FC2, 0x00003FFF
+   data8 0xA27043030C496819, 0x00003FFF
+   data8 0xA43515AE09E6809E, 0x00003FFF
+   data8 0xA5FED6A9B15138EA, 0x00003FFF
+   data8 0xA7CD93B4E965356A, 0x00003FFF
+   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF
+   data8 0xAB7A39B5A93ED337, 0x00003FFF
+   data8 0xAD583EEA42A14AC6, 0x00003FFF
+   data8 0xAF3B78AD690A4375, 0x00003FFF
+   data8 0xB123F581D2AC2590, 0x00003FFF
+   data8 0xB311C412A9112489, 0x00003FFF
+   data8 0xB504F333F9DE6484, 0x00003FFF
+LOCAL_OBJECT_END(cosh_j_hi_table)
+
+LOCAL_OBJECT_START(cosh_j_lo_table)
+   data4 0x1EB2FB13
+   data4 0x1CE2CBE2
+   data4 0x1DDC3CBC
+   data4 0x1EE9AA34
+   data4 0x9EAEFDC1
+   data4 0x9DBF517B
+   data4 0x1EF88AFB
+   data4 0x1E03B216
+   data4 0x1E78AB43
+   data4 0x9E7B1747
+   data4 0x9EFE3C0E
+   data4 0x9D36F837
+   data4 0x9DEE53E4
+   data4 0x9E24AE8E
+   data4 0x1D912473
+   data4 0x1EB243BE
+   data4 0x1E669A2F
+   data4 0x9BBC610A
+   data4 0x1E761035
+   data4 0x9E0BE175
+   data4 0x1CCB12A1
+   data4 0x1D1BFE90
+   data4 0x1DF2F47A
+   data4 0x1EF22F22
+   data4 0x9E3F4A29
+   data4 0x1EC01A5B
+   data4 0x1E8CAC3A
+   data4 0x9DBB3FAB
+   data4 0x1EF73A19
+   data4 0x9BB795B5
+   data4 0x1EF84B76
+   data4 0x9EF5818B
+   data4 0x00000000 // Center of table
+   data4 0x1F77CACA
+   data4 0x1EF8A91D
+   data4 0x1E57C976
+   data4 0x9EE8DA92
+   data4 0x1EE85C9F
+   data4 0x1F3BF1AF
+   data4 0x1D80CA1E
+   data4 0x9D0373AF
+   data4 0x9F167097
+   data4 0x1EB70051
+   data4 0x1F6EB029
+   data4 0x1DFD6D8E
+   data4 0x9EB319B0
+   data4 0x1EBA2BEB
+   data4 0x1F11D537
+   data4 0x1F0D5A46
+   data4 0x9E5E7BCA
+   data4 0x9F3AAFD1
+   data4 0x9E86DACC
+   data4 0x9F3EDDC2
+   data4 0x1E496E3D
+   data4 0x9F490BF6
+   data4 0x1DD1DB48
+   data4 0x1E65EBFB
+   data4 0x9F427496
+   data4 0x1F283C4A
+   data4 0x1F4B0047
+   data4 0x1F130152
+   data4 0x9E8367C0
+   data4 0x9F705F90
+   data4 0x1EFB3C53
+   data4 0x1F32FB13
+LOCAL_OBJECT_END(cosh_j_lo_table)
 
 
+.section .text
+GLOBAL_IEEE754_ENTRY(coshl)
 
-// Put 0.25 in f9; p6 true if x < 0.25
 { .mlx
-         nop.m 999
-(p0)     movl            r32 = 0x000000000000fffd ;;         
-}
-
-{ .mfi
-(p0)  setf.exp        f9 = r32                         
-      nop.f 999
-      nop.i 999 ;;
+      getf.exp        r_signexp_x = f8   // Get signexp of x, must redo if unorm
+      movl            r_sig_inv_ln2 = 0xb8aa3b295c17f0bc // significand of 1/ln2
 }
-
-{ .mfi
-      nop.m 999
-(p0)  fmerge.s      cosh_FR_X    = f0,f8                
-      nop.i 999
+{ .mlx
+      addl            r_ad1 = @ltoff(cosh_arg_reduction), gp
+      movl            r_rshf_2to57 = 0x4778000000000000 // 1.10000 2^(63+57)
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fmerge.s      cosh_FR_SGNX = f8,f1                
-      nop.i 999 ;;
+      ld8             r_ad1 = [r_ad1]
+      fmerge.s        f_ABS_X    = f0,f8
+      mov             r_exp_0_25 = 0x0fffd    // Form exponent for 0.25
 }
-
 { .mfi
-      nop.m 999
-(p0)  fcmp.lt.unc     p0,p7 = cosh_FR_X,f9                    
-      nop.i 999 ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p7)  br.cond.sptk    L(COSH_BY_TBL) 
+      nop.m           0
+      fnorm.s1        f_NORM_X = f8      
+      mov             r_exp_2tom57 = 0xffff-57
 }
 ;;
 
-
-// COSH_BY_POLY: 
-// POLY cannot overflow so there is no need to call __libm_error_support
-// Get the values of P_x from the table
-
-{ .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(double_cosh_p_table), gp
-      nop.i 999
+{ .mfi
+      setf.d          f_RSHF_2TO57 = r_rshf_2to57 // Form const 1.100 * 2^120
+      fclass.m        p10,p0 = f8, 0x0b           // Test for denorm
+      mov             r_exp_mask = 0x1ffff 
 }
-;;
-
-{ .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+{ .mlx
+      setf.sig        f_INV_LN2_2TO63 = r_sig_inv_ln2 // Form 1/ln2 * 2^63
+      movl            r_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift
 }
 ;;
 
-
-// Calculate cosh_FR_X2 = ax*ax and cosh_FR_X4 = ax*ax*ax*ax
-{ .mmf
-         nop.m 999
-(p0)     ldfe       cosh_FR_P1 = [r34],16                 
-(p0)     fma.s1     cosh_FR_X2 = cosh_FR_X, cosh_FR_X, f0 ;;           
-}
-
-{ .mmi
-(p0)     ldfe       cosh_FR_P2 = [r34],16 ;;                 
-(p0)     ldfe       cosh_FR_P3 = [r34],16                 
-         nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe       cosh_FR_P4 = [r34],16 ;;                 
-(p0)     ldfe       cosh_FR_P5 = [r34],16                 
-         nop.i 999 ;;
-}
-
 { .mfi
-(p0)     ldfe       cosh_FR_P6 = [r34],16                 
-(p0)     fma.s1     cosh_FR_X4 = cosh_FR_X2, cosh_FR_X2, f0         
-         nop.i 999 ;;
+      nop.m           0
+      fclass.m        p7,p0 = f8, 0x07  // Test if x=0
+      nop.i           0
 }
-
-// Calculate cosh_FR_podd = x4 *(x4 * P_5 + P_3) + P_1
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_poly_podd_temp1 = cosh_FR_X4, cosh_FR_P5, cosh_FR_P3                
-         nop.i 999 ;;
+      setf.exp        f_2TOM57 = r_exp_2tom57 // Form 2^-57 for scaling
+      nop.f           0
+      add             r_ad3 = 0x90, r_ad1  // Point to ab_table
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_podd            = cosh_FR_X4, cosh_FR_poly_podd_temp1, cosh_FR_P1   
-         nop.i 999
+      setf.d          f_RSHF = r_rshf     // Form right shift const 1.100 * 2^63
+      fclass.m        p6,p0 = f8, 0xe3     // Test if x nan, inf
+      add             r_ad4 = 0x2f0, r_ad1 // Point to j_hi_table midpoint
 }
-
-// Calculate cosh_FR_peven =  p_even = x4 *(x4 * (x4 * P_6 + P_4) + P_2)
-{ .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_poly_peven_temp1 = cosh_FR_X4, cosh_FR_P6, cosh_FR_P4               
-         nop.i 999 ;;
+{ .mib
+      add             r_ad2e = 0x20, r_ad1 // Point to p_table
+      nop.i           0
+(p10) br.cond.spnt    COSH_DENORM          // Branch if x denorm
 }
+;;
 
+// Common path -- return here from COSH_DENORM if x is unnorm
+COSH_COMMON:
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_poly_peven_temp2 = cosh_FR_X4, cosh_FR_poly_peven_temp1, cosh_FR_P2 
-         nop.i 999 ;;
+      ldfe            f_smlst_oflow_input = [r_ad2e],16
+(p7)  fma.s0          f8 = f1, f1, f0      // Result = 1.0 if x=0
+      add             r_ad5 = 0x580, r_ad1 // Point to j_lo_table midpoint
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_peven       = cosh_FR_X4, cosh_FR_poly_peven_temp2, f0         
-         nop.i 999 ;;
+{ .mib
+      ldfe            f_log2by64_hi  = [r_ad1],16       
+      and             r_exp_x = r_exp_mask, r_signexp_x
+(p7)  br.ret.spnt     b0                  // Exit if x=0
 }
+;;
 
-// Y_lo = x2*p_odd + p_even
-// Calculate f8 = Y_hi + Y_lo 
+// Get the A coefficients for COSH_BY_TBL
 { .mfi
-         nop.m 999
-(p0)     fma.s1     cosh_FR_Y_lo         = cosh_FR_X2, cosh_FR_podd,  cosh_FR_peven    
-         nop.i 999 ;;
+      ldfe            f_A1 = [r_ad3],16            
+      fcmp.lt.s1      p8,p9 = f8,f0           // Test for x<0
+      cmp.lt          p7,p0 = r_exp_x, r_exp_0_25  // Test x < 0.25
 }
-
 { .mfb
-         nop.m 999
-(p0)     fma.s0   f8                   = f1, f1, cosh_FR_Y_lo                        
-(p0)     br.ret.sptk     b0 ;;
-}
-
-
-L(COSH_BY_TBL): 
-
-// Now that we are at TBL; so far all we know is that |x| >= 0.25.
-// The first two steps are the same for TBL and EXP, but if we are HUGE
-// Double Extended
-// Go to HUGE if |x| >= 2^14, 1000d (register-biased) is e = 14 (true)
-// Double
-// Go to HUGE if |x| >= 2^10, 10009 (register-biased) is e = 10 (true)
-// Single
-// Go to HUGE if |x| >= 2^7,  10006 (register-biased) is e =  7 (true)
-// we want to leave now. Go to HUGE if |x| >= 2^14
-// 1000d (register-biased) is e = 14 (true)
-
-{ .mlx
-      nop.m 999
-(p0)     movl            r32 = 0x000000000001000d ;;              
-}
-
-{ .mfi
-(p0)     setf.exp        f9 = r32                              
-      nop.f 999
-      nop.i 999 ;;
+      add             r_ad2o = 0x30, r_ad2e  // Point to p_table odd coeffs
+(p6)  fma.s0          f8 = f8,f8,f0          // Result for x nan, inf          
+(p6)  br.ret.spnt     b0                     // Exit for x nan, inf
 }
+;;
 
+// Calculate X2 = ax*ax for COSH_BY_POLY
 { .mfi
-      nop.m 999
-(p0)     fcmp.ge.unc     p6,p7 = cosh_FR_X,f9                  
-      nop.i 999 ;;
+      ldfe            f_log2by64_lo  = [r_ad1],16       
+      nop.f           0
+      nop.i           0
 }
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p6)     br.cond.spnt    L(COSH_HUGE) ;;                             
+{ .mfb
+      ldfe            f_A2 = [r_ad3],16            
+      fma.s1          f_X2 = f_NORM_X, f_NORM_X, f0
+(p7)  br.cond.spnt    COSH_BY_POLY
 }
+;;
 
-// r32 = 1
-// r34 = N-1 
-// r35 = N
-// r36 = j
-// r37 = N+1
-
-// TBL can never overflow
-// cosh(x) = cosh(B+R)
-//         = cosh(B) cosh(R) + sinh(B) sinh(R) 
-// cosh(R) can be approximated by 1 + p_even
-// sinh(R) can be approximated by p_odd
-
+// Here if |x| >= 0.25
+COSH_BY_TBL: 
 // ******************************************************
-// STEP 1 (TBL and EXP)
+// STEP 1 (TBL and EXP) - Argument reduction
 // ******************************************************
-// Get the following constants.
-// f9  = Inv_log2by64
-// f10 = log2by64_hi
-// f11 = log2by64_lo
+// Get the following constants. 
+// Inv_log2by64
+// log2by64_hi
+// log2by64_lo
 
-{ .mmi
-(p0)     adds                 r32 = 0x1,r0      
-(p0)     addl           r34   = @ltoff(double_cosh_arg_reduction), gp
-         nop.i 999
-}
-;;
 
 // We want 2^(N-1) and 2^(-N-1). So bias N-1 and -N-1 and
 // put them in an exponent.
-// cosh_FR_spos = 2^(N-1) and cosh_FR_sneg = 2^(-N-1)
-// r39 = 0xffff + (N-1)  = 0xffff +N -1
-// r40 = 0xffff - (N +1) = 0xffff -N -1
-
-{ .mlx
-         ld8 r34 = [r34]
-(p0)     movl                r38 = 0x000000000000fffe ;; 
-}
-
-{ .mmi
-(p0)     ldfe            cosh_FR_Inv_log2by64 = [r34],16 ;;            
-(p0)     ldfe            cosh_FR_log2by64_hi  = [r34],16            
-         nop.i 999 ;;
-}
+// f_spos = 2^(N-1) and f_sneg = 2^(-N-1)
+// 0xffff + (N-1)  = 0xffff +N -1
+// 0xffff - (N +1) = 0xffff -N -1
 
-{ .mbb
-(p0)     ldfe            cosh_FR_log2by64_lo  = [r34],16            
-         nop.b 999
-         nop.b 999 ;;
-}
 
-// Get the A coefficients
-// f9  = A_1
-// f10 = A_2
-// f11 = A_3
-
-{ .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(double_cosh_ab_table), gp
-      nop.i 999
-}
-;;
+// Calculate M and keep it as integer and floating point.
+// M = round-to-integer(x*Inv_log2by64)
+// f_M = M = truncate(ax/(log2/64))
+// Put the integer representation of M in r_M
+//    and the floating point representation of M in f_M
 
+// Get the remaining A,B coefficients
 { .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+      ldfe            f_A3 = [r_ad3],16
+      nop.m           0
+      nop.i           0
 }
 ;;
 
-
-// Calculate M and keep it as integer and floating point.
-// M = round-to-integer(x*Inv_log2by64)
-// cosh_FR_M = M = truncate(ax/(log2/64))
-// Put the significand of M in r35
-//    and the floating point representation of M in cosh_FR_M
-
+// Use constant (1.100*2^(63-6)) to get rounded M into rightmost significand
+// |x| * 64 * 1/ln2 * 2^(63-6) + 1.1000 * 2^(63+(63-6))
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_M      = cosh_FR_X, cosh_FR_Inv_log2by64, f0 
-      nop.i 999
+      nop.m           0
+      fma.s1          f_M_temp = f_ABS_X, f_INV_LN2_2TO63, f_RSHF_2TO57
+      mov             r_signexp_0_5 = 0x0fffe // signexp of +0.5
 }
+;;
 
+// Test for |x| >= overflow limit
 { .mfi
-(p0)  ldfe            cosh_FR_A1 = [r34],16            
-      nop.f 999
-      nop.i 999 ;;
+      ldfe            f_B1 = [r_ad3],16
+      fcmp.ge.s1      p6,p0 = f_ABS_X, f_smlst_oflow_input
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fcvt.fx.s1      cosh_FR_M_temp = cosh_FR_M                      
-      nop.i 999 ;;
+      ldfe            f_B2 = [r_ad3],16
+      nop.f           0
+      mov             r_exp_32 = 0x10004
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fnorm.s1        cosh_FR_M      = cosh_FR_M_temp                 
-      nop.i 999 ;;
+// Subtract RSHF constant to get rounded M as a floating point value
+// M_temp * 2^(63-6) - 2^63
+{ .mfb
+      ldfe            f_B3 = [r_ad3],16            
+      fms.s1          f_M = f_M_temp, f_2TOM57, f_RSHF
+(p6)  br.cond.spnt    COSH_HUGE  // Branch if result will overflow
 }
+;;
 
 { .mfi
-(p0)  getf.sig        r35       = cosh_FR_M_temp                 
-      nop.f 999
-      nop.i 999 ;;
+      getf.sig        r_M = f_M_temp                 
+      nop.f           0
+      cmp.ge          p7,p6 = r_exp_x, r_exp_32 // Test if x >= 32
 }
+;;
 
-// M is still in r35. Calculate j. j is the signed extension of the six lsb of M. It
+// Calculate j. j is the signed extension of the six lsb of M. It 
 // has a range of -32 thru 31.
-// r35 = M
-// r36 = j 
-{ .mii
-      nop.m 999
-      nop.i 999 ;;
-(p0)  and            r36 = 0x3f, r35 ;;   
-}
 
 // Calculate R
-// f13 = f44 - f12*f10 = x - M*log2by64_hi
-// f14 = f13 - f8*f11 = R = (x - M*log2by64_hi) - M*log2by64_lo
-
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        cosh_FR_R_temp = cosh_FR_M, cosh_FR_log2by64_hi, cosh_FR_X      
-      nop.i 999
-}
+// ax - M*log2by64_hi
+// R = (ax - M*log2by64_hi) - M*log2by64_lo
 
 { .mfi
-(p0)  ldfe            cosh_FR_A2 = [r34],16            
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fnma.s1         f_R_temp = f_M, f_log2by64_hi, f_ABS_X
+      and             r_j = 0x3f, r_M
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fnma.s1        cosh_FR_R      = cosh_FR_M, cosh_FR_log2by64_lo, cosh_FR_R_temp 
-      nop.i 999
+{ .mii
+      nop.m           0
+      shl             r_jshf = r_j, 0x2 // Shift j so can sign extend it
+;;
+      sxt1            r_jshf = r_jshf
 }
+;;
 
-// Get the B coefficients
-// f15 = B_1
-// f32 = B_2
-// f33 = B_3
-
-{ .mmi
-(p0)     ldfe            cosh_FR_A3 = [r34],16 ;;            
-(p0)     ldfe            cosh_FR_B1 = [r34],16            
-         nop.i 999 ;;
+{ .mii
+      nop.m           0
+      shr             r_j = r_jshf, 0x2    // Now j has range -32 to 31
+      nop.i           0
 }
+;;
 
 { .mmi
-(p0)     ldfe            cosh_FR_B2 = [r34],16 ;;            
-(p0)     ldfe            cosh_FR_B3 = [r34],16            
-         nop.i 999 ;;
+      shladd          r_ad_J_hi = r_j, 4, r_ad4 // pointer to Tjhi
+      sub             r_Mmj = r_M, r_j          // M-j
+      sub             r_mj = r0, r_j            // Form -j
 }
+;;
 
-{ .mii
-         nop.m 999
-(p0)     shl            r34 = r36,  0x2 ;;   
-(p0)     sxt1           r37 = r34 ;;         
+// The TBL and EXP branches are merged and predicated
+// If TBL, p6 true, 0.25 <= |x| < 32
+// If EXP, p7 true, 32 <= |x| < overflow_limit
+//
+// N = (M-j)/64
+{ .mfi
+      ldfe            f_Tjhi = [r_ad_J_hi]
+      fnma.s1         f_R = f_M, f_log2by64_lo, f_R_temp 
+      shr             r_N = r_Mmj, 0x6            // N = (M-j)/64 
 }
-
-// ******************************************************
-// STEP 2 (TBL and EXP)
-// ******************************************************
-// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-// f12 = R*R*R
-// f13 = R*R
-// f14 = R <== from above
-
 { .mfi
-      nop.m 999
-(p0)     fma.s1          cosh_FR_Rsq  = cosh_FR_R,   cosh_FR_R, f0  
-(p0)     shr            r36 = r37,  0x2 ;;   
+      shladd          r_ad_mJ_hi = r_mj, 4, r_ad4 // pointer to Tmjhi
+      nop.f           0
+      shladd          r_ad_mJ_lo = r_mj, 2, r_ad5 // pointer to Tmjlo
 }
+;;
 
-// r34 = M-j = r35 - r36
-// r35 = N = (M-j)/64
-
-{ .mii
-(p0)     sub                  r34 = r35, r36    
-         nop.i 999 ;;
-(p0)     shr                  r35 = r34, 0x6 ;;    
+{ .mfi
+      sub             r_2mNm1 = r_signexp_0_5, r_N // signexp 2^(-N-1)
+      nop.f           0
+      shladd          r_ad_J_lo = r_j, 2, r_ad5   // pointer to Tjlo
 }
-
-{ .mii
-(p0)     sub                 r40 = r38, r35           
-(p0)     adds                 r37 = 0x1, r35    
-(p0)     add                 r39 = r38, r35 ;;           
+{ .mfi
+      ldfe            f_Tmjhi = [r_ad_mJ_hi]
+      nop.f           0
+      add             r_2Nm1 = r_signexp_0_5, r_N // signexp 2^(N-1)
 }
+;;
 
-// Get the address of the J table, add the offset,
-// addresses are sinh_AD_mJ and sinh_AD_J, get the T value
-// f32 = T(j)_hi
-// f33 = T(j)_lo
-// f34 = T(-j)_hi
-// f35 = T(-j)_lo
-
-{ .mmi
-(p0)     sub                  r34 = r35, r32    
-(p0)     addl    r37   = @ltoff(double_cosh_j_table), gp
-         nop.i 999
+{ .mmf
+      ldfs            f_Tmjlo = [r_ad_mJ_lo]
+      setf.exp        f_sneg = r_2mNm1            // Form 2^(-N-1)
+      nop.f           0
 }
 ;;
 
-{ .mfi
-      ld8 r37 = [r37]
-(p0)  fma.s1          cosh_FR_Rcub = cosh_FR_Rsq, cosh_FR_R, f0  
-      nop.i 999
+{ .mmf
+      ldfs            f_Tjlo  = [r_ad_J_lo]
+      setf.exp        f_spos = r_2Nm1             // Form 2^(N-1)
+      nop.f           0
 }
+;;
 
 // ******************************************************
-// STEP 3 Now decide if we need to branch to EXP
+// STEP 2 (TBL and EXP)
 // ******************************************************
-// Put 32 in f9; p6 true if x < 32
+// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
 
-{ .mlx
-         nop.m 999
-(p0)     movl                r32 = 0x0000000000010004 ;;               
+{ .mmf
+      nop.m           0
+      nop.m           0
+      fma.s1          f_Rsq  = f_R, f_R, f0
 }
+;;
 
-// Calculate p_even
-// f34 = B_2 + Rsq *B_3
-// f35 = B_1 + Rsq*f34      = B_1 + Rsq * (B_2 + Rsq *B_3)
-// f36 = peven = Rsq * f35 = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
-
-{ .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_peven_temp1 = cosh_FR_Rsq, cosh_FR_B3,          cosh_FR_B2  
-      nop.i 999 ;;
-}
 
+// Calculate p_even
+// B_2 + Rsq *B_3
+// B_1 + Rsq * (B_2 + Rsq *B_3)
+// p_even = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_peven_temp2 = cosh_FR_Rsq, cosh_FR_peven_temp1, cosh_FR_B1  
-      nop.i 999
+      nop.m           0
+      fma.s1          f_peven_temp1 = f_Rsq, f_B3, f_B2
+      nop.i           0
 }
-
 // Calculate p_odd
-// f34 = A_2 + Rsq *A_3
-// f35 = A_1 + Rsq * (A_2 + Rsq *A_3)
-// f37 = podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
-
+// A_2 + Rsq *A_3
+// A_1 + Rsq * (A_2 + Rsq *A_3)
+// podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_podd_temp1 = cosh_FR_Rsq,        cosh_FR_A3,         cosh_FR_A2  
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_podd_temp1 = f_Rsq, f_A3, f_A2
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)  setf.exp            cosh_FR_N_temp1 = r39            
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_Rcub = f_Rsq, f_R, f0
+      nop.i           0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_peven       = cosh_FR_Rsq, cosh_FR_peven_temp2, f0     
-      nop.i 999
-}
+// 
+// If TBL, 
+// Calculate S_hi and S_lo, and C_hi
+// SC_hi_temp = sneg * Tmjhi
+// S_hi = spos * Tjhi - SC_hi_temp
+// S_hi = spos * Tjhi - (sneg * Tmjhi)
+// C_hi = spos * Tjhi + SC_hi_temp
+// C_hi = spos * Tjhi + (sneg * Tmjhi)
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_podd_temp2 = cosh_FR_Rsq,        cosh_FR_podd_temp1, cosh_FR_A1  
-      nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_SC_hi_temp = f_sneg, f_Tmjhi, f0   
+      nop.i           0
 }
+;;
 
+// If TBL, 
+// C_lo_temp3 = sneg * Tmjlo
+// C_lo_temp4 = spos * Tjlo + C_lo_temp3
+// C_lo_temp4 = spos * Tjlo + (sneg * Tmjlo)
 { .mfi
-(p0)  setf.exp            f9  = r32                              
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_C_lo_temp3 =  f_sneg, f_Tmjlo, f0
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1          cosh_FR_podd       = cosh_FR_podd_temp2, cosh_FR_Rcub,       cosh_FR_R   
-      nop.i 999
-}
-
-// sinh_GR_mj contains the table offset for -j
-// sinh_GR_j  contains the table offset for +j
-// p6 is true when j <= 0
-
-{ .mlx
-(p0)     setf.exp            cosh_FR_N_temp2 = r40            
-(p0)     movl                r40 = 0x0000000000000020 ;;    
+      nop.m           0
+      fma.s1          f_peven_temp2 = f_Rsq, f_peven_temp1, f_B1
+      nop.i           0
 }
-
 { .mfi
-(p0)     sub                 GR_mJ = r40,  r36           
-(p0)     fmerge.se           cosh_FR_spos    = cosh_FR_N_temp1, f1 
-(p0)     adds                GR_J  = 0x20, r36 ;;           
+      nop.m           0
+      fma.s1          f_podd_temp2 = f_Rsq, f_podd_temp1, f_A1
+      nop.i           0
 }
+;;
 
-{ .mii
-         nop.m 999
-(p0)     shl                  GR_mJ = GR_mJ, 5 ;;   
-(p0)     add                  AD_mJ = r37, GR_mJ ;; 
+// If EXP, 
+// Compute 2^(N-1) * Tjhi and 2^(N-1) * Tjlo
+{ .mfi
+      nop.m           0
+(p7)  fma.s1          f_Tjhi_spos = f_Tjhi, f_spos, f0
+      nop.i           0
 }
-
-{ .mmi
-         nop.m 999
-(p0)     ldfe                 cosh_FR_Tmjhi = [AD_mJ],16                 
-(p0)     shl                  GR_J  = GR_J, 5 ;;    
+{ .mfi
+      nop.m           0
+(p7)  fma.s1          f_Tjlo_spos = f_Tjlo, f_spos, f0
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     ldfs                 cosh_FR_Tmjlo = [AD_mJ],16                 
-(p0)     fcmp.lt.unc.s1      p6,p7 = cosh_FR_X,f9                          
-(p0)     add                  AD_J  = r37, GR_J ;;  
+      nop.m           0
+(p6)  fma.s1          f_C_hi = f_spos, f_Tjhi, f_SC_hi_temp
+      nop.i           0
 }
+;;
 
-{ .mmi
-(p0)     ldfe                 cosh_FR_Tjhi  = [AD_J],16 ;;                  
-(p0)     ldfs                 cosh_FR_Tjlo  = [AD_J],16                  
-         nop.i 999 ;;
+{ .mfi
+      nop.m           0
+(p6)  fms.s1          f_S_hi = f_spos, f_Tjhi, f_SC_hi_temp
+      nop.i           0
 }
-
-{ .mfb
-         nop.m 999
-(p0)     fmerge.se           cosh_FR_sneg    = cosh_FR_N_temp2, f1 
-(p7)     br.cond.spnt        L(COSH_BY_EXP) ;;                            
+{ .mfi
+      nop.m           0
+(p6)  fma.s1          f_C_lo_temp4 = f_spos, f_Tjlo, f_C_lo_temp3
+      nop.i           0
 }
-
-// ******************************************************
-// If NOT branch to EXP
-// ******************************************************
-// Calculate C_hi
-// ******************************************************
-// cosh_FR_C_hi_temp = cosh_FR_sneg * cosh_FR_Tmjhi
-// cosh_FR_C_hi = cosh_FR_spos * cosh_FR_Tjhi + (cosh_FR_sneg * cosh_FR_Tmjhi)
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_C_hi_temp = cosh_FR_sneg, cosh_FR_Tmjhi, f0                   
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_peven = f_Rsq, f_peven_temp2, f0
+      nop.i           0
 }
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_C_hi      = cosh_FR_spos, cosh_FR_Tjhi,  cosh_FR_C_hi_temp    
-      nop.i 999
+      nop.m           0
+      fma.s1          f_podd = f_podd_temp2, f_Rcub, f_R
+      nop.i           0
 }
+;;
 
-// ******************************************************
-// Calculate S_hi
-// ******************************************************
-// cosh_FR_S_hi_temp1 = cosh_FR_sneg * cosh_FR_Tmjhi
-// cosh_FR_S_hi = cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi_temp1
+// If TBL,
+// C_lo_temp1 =  spos * Tjhi - C_hi
+// C_lo_temp2 =  sneg * Tmjlo + C_lo_temp1
+// C_lo_temp2 =  sneg * Tmjlo + (spos * Tjhi - C_hi)
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_S_hi_temp1 =  cosh_FR_sneg, cosh_FR_Tmjhi, f0                
-      nop.i 999 ;;
+      nop.m           0
+(p6)  fms.s1          f_C_lo_temp1 =  f_spos, f_Tjhi,  f_C_hi
+      nop.i           0
 }
-
-// ******************************************************
-// Calculate C_lo
-// ******************************************************
-// cosh_FR_C_lo_temp1 = cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi
-// cosh_FR_C_lo_temp2 = cosh_FR_sneg * cosh_FR_Tmjlo + (cosh_FR_spos * cosh_FR_Tjhi - cosh_FR_C_hi)
-// cosh_FR_C_lo_temp1 = cosh_FR_sneg * cosh_FR_Tmjlo
-// cosh_FR_C_lo_temp3 = cosh_FR_spos * cosh_FR_Tjlo + (cosh_FR_sneg * cosh_FR_Tmjlo)
-// cosh_FR_C_lo = cosh_FR_C_lo_temp3 + cosh_FR_C_lo_temp2
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fms.s1        cosh_FR_C_lo_temp1 = cosh_FR_spos, cosh_FR_Tjhi,  cosh_FR_C_hi        
-      nop.i 999
+      nop.m           0
+(p6)  fma.s1          f_C_lo_temp2 = f_sneg, f_Tmjhi, f_C_lo_temp1       
+      nop.i           0
 }
+;;
 
+// If EXP,
+// Y_hi = 2^(N-1) * Tjhi
+// Y_lo = 2^(N-1) * Tjhi * (p_odd + p_even) + 2^(N-1) * Tjlo
 { .mfi
-      nop.m 999
-(p0)  fms.s1        cosh_FR_S_hi       =  cosh_FR_spos, cosh_FR_Tjhi, cosh_FR_S_hi_temp1 
-      nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s1          f_Y_lo_temp =  f_peven, f1, f_podd
+      nop.i           0
 }
+;;
 
+// If TBL,
+// C_lo = C_lo_temp4 + C_lo_temp2
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo_temp2 = cosh_FR_sneg, cosh_FR_Tmjhi, cosh_FR_C_lo_temp1  
-      nop.i 999
+      nop.m           0
+(p6)  fma.s1          f_C_lo = f_C_lo_temp4, f1, f_C_lo_temp2
+      nop.i           0
 }
+;;
 
+// If TBL,
+// Y_hi = C_hi 
+// Y_lo = S_hi*p_odd + (C_hi*p_even + C_lo)
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo_temp1 = cosh_FR_sneg, cosh_FR_Tmjlo, f0                  
-      nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_Y_lo_temp = f_C_hi, f_peven, f_C_lo
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo_temp3 =  cosh_FR_spos, cosh_FR_Tjlo,  cosh_FR_C_lo_temp1 
-      nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s1          f_Y_lo = f_Tjhi_spos, f_Y_lo_temp, f_Tjlo_spos
+      nop.i           0
 }
+;;
 
+// Dummy multiply to generate inexact
 { .mfi
-      nop.m 999
-(p0)  fma.s1        cosh_FR_C_lo       =  cosh_FR_C_lo_temp3, f1,   cosh_FR_C_lo_temp2    
-      nop.i 999 ;;
+      nop.m           0
+      fmpy.s0         f_tmp = f_B2, f_B2
+      nop.i           0
 }
-
-// ******************************************************
-// cosh_FR_Y_lo_temp = cosh_FR_C_hi * cosh_FR_peven + cosh_FR_C_lo
-// cosh_FR_Y_lo = cosh_FR_S_hi * cosh_FR_podd + cosh_FR_Y_lo_temp
-// cosh_FR_COSH = Y_hi + Y_lo
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo_temp =  cosh_FR_C_hi, cosh_FR_peven, cosh_FR_C_lo       
-      nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_Y_lo = f_S_hi, f_podd, f_Y_lo_temp
+      nop.i           0
 }
+;;
 
+// f8 = answer = Y_hi + Y_lo
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo      =  cosh_FR_S_hi, cosh_FR_podd, cosh_FR_Y_lo_temp   
-      nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s0          f8 = f_Y_lo,  f1, f_Tjhi_spos
+      nop.i           0
 }
+;;
 
+// f8 = answer = Y_hi + Y_lo
 { .mfb
-      nop.m 999
-(p0)  fma.s0       f8 =  cosh_FR_C_hi, f1, cosh_FR_Y_lo                       
-(p0)  br.ret.sptk     b0 ;;
+      nop.m           0
+(p6)  fma.s0          f8 = f_Y_lo, f1, f_C_hi
+      br.ret.sptk     b0      // Exit for COSH_BY_TBL and COSH_BY_EXP
 }
+;;
 
-L(COSH_BY_EXP): 
-
-// When p7 is true,  we know that an overflow is not going to happen
-// When p7 is false, we must check for possible overflow
-// p7 is the over_SAFE flag
-// f44 = Scale * (Y_hi + Y_lo)
-//     =  cosh_FR_spos * (cosh_FR_Tjhi + cosh_FR_Y_lo)
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo_temp =  cosh_FR_peven, f1,       cosh_FR_podd           
-      nop.i 999
+// Here if 0 < |x| < 0.25
+COSH_BY_POLY: 
+{ .mmf
+      ldfe            f_P6 = [r_ad2e],16
+      ldfe            f_P5 = [r_ad2o],16
+      nop.f           0
 }
+;;
 
-// Now we are in EXP. This is the only path where an overflow is possible
-// but not for certain. So this is the only path where over_SAFE has any use.
-// r34 still has N-1
-// There is a danger of double-extended overflow   if N-1 > 0x3ffe = 16382
-// There is a danger of double overflow            if N-1 > 0x3fe  = 1022
-// There is a danger of single overflow            if N-1 > 0x7e   = 126
+{ .mmi
+      ldfe            f_P4 = [r_ad2e],16
+      ldfe            f_P3 = [r_ad2o],16
+      nop.i           0
+}
+;;
 
-{ .mlx
-       nop.m 999
-(p0)   movl                r32          = 0x0000000000003ffe ;;                       
+{ .mmi
+      ldfe            f_P2 = [r_ad2e],16
+      ldfe            f_P1 = [r_ad2o],16                 
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)  cmp.gt.unc          p0,p7        = r34, r32                                 
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_X3 = f_NORM_X, f_X2, f0
+      nop.i           0
 }
-
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_Y_lo      =  cosh_FR_Tjhi,  cosh_FR_Y_lo_temp, cosh_FR_Tjlo       
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_X4 = f_X2, f_X2, f0
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1         cosh_FR_COSH_temp =  cosh_FR_Y_lo,  f1, cosh_FR_Tjhi                 
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_poly65 = f_X2, f_P6, f_P5
+      nop.i           0
 }
-
 { .mfi
-      nop.m 999
-(p0)  fma.s0       f44 = cosh_FR_spos,  cosh_FR_COSH_temp, f0                       
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_poly43 = f_X2, f_P4, f_P3
+      nop.i           0
 }
+;;
 
-// Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p7)     fmpy.s0      cosh_FR_tmp = cosh_FR_all_ones, cosh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_poly21 = f_X2, f_P2, f_P1
+      nop.i           0
 }
+;;
 
-// If over_SAFE is set, return
-{ .mfb
-       nop.m 999
-(p7)   fmerge.s            f8 = f44,f44
-(p7)  br.ret.sptk     b0 ;;
+{ .mfi
+      nop.m           0
+      fma.s1          f_poly6543 = f_X4, f_poly65, f_poly43
+      nop.i           0
 }
-
-// Else see if we overflowed
-// S0 user supplied status
-// S2 user supplied status + WRE + TD  (Overflows)
-// If WRE is set then an overflow will not occur in EXP.
-// The input value that would cause a register (WRE) value to overflow is about 2^15
-// and this input would go into the HUGE path.
-// Answer with WRE is in f43.
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fsetc.s2            0x7F,0x42                                               
-      nop.i 999;;
+      nop.m           0
+      fma.s1          f_poly6to1 = f_X4, f_poly6543, f_poly21
+      nop.i           0
 }
+;;
 
+// Dummy multiply to generate inexact
 { .mfi
-      nop.m 999
-(p0)  fma.s2            f43  = cosh_FR_spos,  cosh_FR_COSH_temp, f0                      
-      nop.i 999 ;;
+      nop.m           0
+      fmpy.s0         f_tmp = f_P6, f_P6
+      nop.i           0
 }
-
-// 103FF => 103FF -FFFF = 400(true)
-// 400 + 3FF = 7FF, which is 1 more than the exponent of the largest
-// double (7FE). So 0 103FF 8000000000000000  is one ulp more than
-// largest double in register bias
-
-// 13FFF => 13FFF -FFFF = 4000(true)
-
-// Now  set p8 if the answer with WRE is greater than or equal this value
-// Also set p9 if the answer with WRE is less than or equal to negative this value
-
-{ .mlx
-       nop.m 999
-(p0)   movl                r32          = 0x0000000000013fff ;;                     
+{ .mfb
+      nop.m           0
+      fma.s0          f8 = f_poly6to1, f_X2, f1
+      br.ret.sptk     b0                // Exit COSH_BY_POLY
 }
+;;
 
-{ .mmf
-       nop.m 999
-(p0)   setf.exp            f41          = r32                                    
-(p0)   fsetc.s2            0x7F,0x40 ;;                                               
-}
 
-{ .mfi
-      nop.m 999
-(p0)  fcmp.ge.unc.s1      p8, p0       = f43, f41                               
-      nop.i 999
+// Here if x denorm or unorm
+COSH_DENORM:
+// Determine if x really a denorm and not a unorm
+{ .mmf
+      getf.exp        r_signexp_x = f_NORM_X
+      mov             r_exp_denorm = 0x0c001   // Real denorms have exp < this
+      fmerge.s        f_ABS_X = f0, f_NORM_X
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fmerge.ns           f42 = f41, f41                                          
-      nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s0      p10,p0 = f8, f0  // Set denorm flag
+      nop.i           0
 }
+;;
 
-// The error tag for overflow is 63
-{ .mii
-      nop.m 999
-      nop.i 999 ;;
-(p8)  mov                 GR_Parameter_TAG = 63 ;;                                               
+// Set p8 if really a denorm
+{ .mmi
+      and             r_exp_x = r_exp_mask, r_signexp_x
+;;
+      cmp.lt          p8,p9 = r_exp_x, r_exp_denorm
+      nop.i           0
 }
+;;
 
+// Identify denormal operands.
 { .mfb
-      nop.m 999
-(p0)  fcmp.le.unc.s1      p9, p0 =  f43, f42                                      
-(p8)  br.cond.spnt __libm_error_region ;;
-}
-
-{ .mii
-      nop.m 999
-      nop.i 999 ;;
-(p9)  mov                 GR_Parameter_TAG = 63                                               
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p9)  br.cond.spnt __libm_error_region ;;
-}
-
-// Dummy multiply to generate inexact
-{ .mfi
-         nop.m 999
-(p0)     fmpy.s0      cosh_FR_tmp = cosh_FR_all_ones, cosh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+(p8)  fma.s0          f8 =  f8,f8,f1 // If x denorm, result=1+x^2
+(p9)  br.cond.sptk    COSH_COMMON    // Return to main path if x unorm
 }
+;;
 
 { .mfb
-      nop.m 999
-(p0)  fmerge.s            f8 = f44,f44                                            
-(p0)  br.ret.sptk     b0 ;;
+      nop.m           0
+      nop.f           0
+      br.ret.sptk     b0            // Exit if x denorm
 }
+;;
 
 
-// for COSH_HUGE, put 24000 in exponent; take sign from input; add 1
-// SAFE: SAFE is always 0 for HUGE
-
-L(COSH_HUGE): 
-
-{ .mlx
-      nop.m 999
-(p0)  movl                r32 = 0x0000000000015dbf ;;                                
+// Here if |x| >= overflow limit
+COSH_HUGE: 
+// for COSH_HUGE, put 24000 in exponent; take sign from input
+{ .mmi
+      mov             r_exp_huge = 0x15dbf
+;;
+      setf.exp        f_huge  = r_exp_huge
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)  setf.exp            f9  = r32                                               
-      nop.f 999
-      nop.i 999 ;;
+      alloc           r32 = ar.pfs,0,5,4,0                  
+      fma.s1          f_signed_hi_lo = f_huge, f1, f1
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fma.s1              cosh_FR_hi_lo = f1, f9, f1                              
-      nop.i 999 ;;
+      nop.m           0
+      fma.s0          f_pre_result = f_signed_hi_lo, f_huge, f0
+      mov             GR_Parameter_TAG = 63
 }
+;;
+
+GLOBAL_IEEE754_END(coshl)
 
-{ .mfi
-      nop.m 999
-(p0)  fma.s0            f44 = f9, cosh_FR_hi_lo, f0                             
-(p0)  mov                 GR_Parameter_TAG = 63                                               
-}
-.endp coshl
-ASM_SIZE_DIRECTIVE(coshl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
+
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp              // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs                  // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
+        add sp=-64,sp                            // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+        mov GR_SAVE_GP=gp                        // Save gp
 };;
+
 { .mmi
-        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+        stfe [GR_Parameter_Y] = f0,16            // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp               // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+        mov GR_SAVE_B0=b0                        // Save b0
 };;
+
 .body
 { .mib
-        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfe [GR_Parameter_X] = f8               // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y   // Parameter 3 address
+        nop.b 0                            
 }
 { .mib
-        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        stfe [GR_Parameter_Y] = f_pre_result     // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#  // Call error handling function
+        br.call.sptk b0=__libm_error_support#    // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
+
 { .mmi
-        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfe  f8 = [GR_Parameter_RESULT]         // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                         // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                    // Restore return address
 };;
+
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        mov   gp = GR_SAVE_GP                    // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS               // Restore ar.pfs
+        br.ret.sptk     b0                       // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_exp.S b/sysdeps/ia64/fpu/e_exp.S
index db02336ecf..fcc247fb1a 100644
--- a/sysdeps/ia64/fpu/e_exp.S
+++ b/sysdeps/ia64/fpu/e_exp.S
@@ -1,10 +1,10 @@
 .file "exp.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,26 +20,26 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version 
+// 2/02/00  Initial version
 // 3/07/00  exp(inf)  = inf but now does NOT call error support
 //          exp(-inf) = 0   but now does NOT call error support
 // 4/04/00  Unwind support added
@@ -48,6 +48,12 @@
 // 11/30/00 Reworked to shorten main path, widen main path to include all
 //          args in normal range, and add quick exit for 0, nan, inf.
 // 12/05/00 Loaded constants earlier with setf to save 2 cycles.
+// 02/05/02 Corrected uninitialize predicate in POSSIBLE_UNDERFLOW path
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 09/07/02 Force inexact flag
+// 11/15/02 Split underflow path into zero/nonzero; eliminated fma in main path
+// 05/30/03 Set inexact flag on unmasked overflow/underflow
+// 03/31/05 Reformatted delimiters between data tables
 
 // API
 //==============================================================
@@ -67,187 +73,167 @@
 //       Construct 2^M
 //       Get 2^(index_1/128) from table_1;
 //       Get 2^(index_2/8)   from table_2;
-//       Calculate exp(r) by series
+//       Calculate exp(r) by 5th order polynomial
 //          r = x - n (log2/128)_high
 //          delta = - n (log2/128)_low
 //       Calculate exp(delta) as 1 + delta
 
 
-// Special values 
+// Special values
 //==============================================================
 // exp(+0)    = 1.0
 // exp(-0)    = 1.0
 
-// exp(+qnan) = +qnan 
-// exp(-qnan) = -qnan 
-// exp(+snan) = +qnan 
-// exp(-snan) = -qnan 
+// exp(+qnan) = +qnan
+// exp(-qnan) = -qnan
+// exp(+snan) = +qnan
+// exp(-snan) = -qnan
 
-// exp(-inf)  = +0 
+// exp(-inf)  = +0
 // exp(+inf)  = +inf
 
-// Overfow and Underfow
+// Overflow and Underflow
 //=======================
-// exp(-x) = smallest double normal when
-//     x = -708.396 = c086232bdd7abcd2
-
 // exp(x) = largest double normal when
-//     x = 709.7827 = 40862e42fefa39ef
+//     x = 709.7827 = 0x40862e42fefa39ef
+
+// exp(x) = smallest double normal when
+//     x = -708.396 = 0xc086232bdd7abcd2
 
+// exp(x) = largest round-to-nearest single zero when
+//     x = -745.1332 = 0xc0874910d52d3052
 
 
 // Registers used
 //==============================================================
-// Floating Point registers used: 
-// f8, input
-// f9 -> f15,  f32 -> f60
+// Floating Point registers used:
+// f8, input, output
+// f6 -> f15,  f32 -> f49
 
-// General registers used: 
-// r32 -> r60 
+// General registers used:
+// r14 -> r40
 
 // Predicate registers used:
 // p6 -> p15
 
-#include "libm_support.h"
-
 // Assembly macros
 //==============================================================
 
-exp_GR_rshf                   = r33
-EXP_AD_TB1                    = r34
-EXP_AD_TB2                    = r35
-EXP_AD_P                      = r36
-
-exp_GR_N                      = r37
-exp_GR_index_1                = r38
-exp_GR_index_2_16             = r39
-
-exp_GR_biased_M               = r40
-exp_GR_index_1_16             = r41
-EXP_AD_T1                     = r42
-EXP_AD_T2                     = r43
-exp_GR_sig_inv_ln2            = r44
-
-exp_GR_17ones                 = r45
-exp_GR_one                    = r46
-exp_TB1_size                  = r47
-exp_TB2_size                  = r48
-exp_GR_rshf_2to56             = r49
-
-exp_GR_gt_ln                  = r50
-exp_GR_exp_2tom56             = r51
-
-exp_GR_17ones_m1              = r52
-
-GR_SAVE_B0                    = r53
-GR_SAVE_PFS                   = r54
-GR_SAVE_GP                    = r55
-GR_SAVE_SP                    = r56
-
-GR_Parameter_X                = r57
-GR_Parameter_Y                = r58
-GR_Parameter_RESULT           = r59
-GR_Parameter_TAG              = r60
-
-
-FR_X             = f10
-FR_Y             = f1
-FR_RESULT        = f8
-
-EXP_RSHF_2TO56   = f6
-EXP_INV_LN2_2TO63 = f7
-EXP_W_2TO56_RSH  = f9
-EXP_2TOM56       = f11
-exp_P4           = f12 
-exp_P3           = f13 
-exp_P2           = f14 
-exp_P1           = f15 
-
-exp_ln2_by_128_hi  = f33 
-exp_ln2_by_128_lo  = f34 
-
-EXP_RSHF           = f35
-EXP_Nfloat         = f36 
-exp_W              = f37
-exp_r              = f38
-exp_f              = f39
-
-exp_rsq            = f40
-exp_rcube          = f41
-
-EXP_2M             = f42
-exp_S1             = f43
-exp_T1             = f44
-
-EXP_MIN_DBL_OFLOW_ARG = f45
-EXP_MAX_DBL_ZERO_ARG  = f46
-EXP_MAX_DBL_NORM_ARG  = f47
-EXP_MAX_DBL_UFLOW_ARG = f48
-EXP_MIN_DBL_NORM_ARG  = f49
-exp_rP4pP3         = f50
-exp_P_lo           = f51
-exp_P_hi           = f52
-exp_P              = f53
-exp_S              = f54
-
-EXP_NORM_f8        = f56   
-
-exp_wre_urm_f8     = f57
-exp_ftz_urm_f8     = f57
-
-exp_gt_pln         = f58
-
-exp_S2             = f59
-exp_T2             = f60
+rRshf                 = r14
+rAD_TB1               = r15
+rAD_T1                = r15
+rAD_TB2               = r16
+rAD_T2                = r16
+rAD_P                 = r17
+rN                    = r18
+rIndex_1              = r19
+rIndex_2_16           = r20
+rM                    = r21
+rBiased_M             = r21
+rIndex_1_16           = r21
+rSig_inv_ln2          = r22
+rExp_bias             = r23
+rExp_mask             = r24
+rTmp                  = r25
+rRshf_2to56           = r26
+rGt_ln                = r27
+rExp_2tom56           = r28
+
+
+GR_SAVE_B0            = r33
+GR_SAVE_PFS           = r34
+GR_SAVE_GP            = r35
+GR_SAVE_SP            = r36
+
+GR_Parameter_X        = r37
+GR_Parameter_Y        = r38
+GR_Parameter_RESULT   = r39
+GR_Parameter_TAG      = r40
+
+
+FR_X                  = f10
+FR_Y                  = f1
+FR_RESULT             = f8
+
+fRSHF_2TO56           = f6
+fINV_LN2_2TO63        = f7
+fW_2TO56_RSH          = f9
+f2TOM56               = f11
+fP5                   = f12
+fP54                  = f12
+fP5432                = f12
+fP4                   = f13
+fP3                   = f14
+fP32                  = f14
+fP2                   = f15
+fP                    = f15
+
+fLn2_by_128_hi        = f33
+fLn2_by_128_lo        = f34
+
+fRSHF                 = f35
+fNfloat               = f36
+fNormX                = f37
+fR                    = f38
+fF                    = f39
+
+fRsq                  = f40
+f2M                   = f41
+fS1                   = f42
+fT1                   = f42
+fS2                   = f43
+fT2                   = f43
+fS                    = f43
+fWre_urm_f8           = f44
+fFtz_urm_f8           = f44
+
+fMIN_DBL_OFLOW_ARG    = f45
+fMAX_DBL_ZERO_ARG     = f46
+fMAX_DBL_NORM_ARG     = f47
+fMIN_DBL_NORM_ARG     = f48
+fGt_pln               = f49
+fTmp                  = f49
 
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+RODATA
 .align 16
 
 // ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
 
 // double-extended 1/ln(2)
 // 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
-// 3fff b8aa 3b29 5c17 f0bc 
+// 3fff b8aa 3b29 5c17 f0bc
 // For speed the significand will be loaded directly with a movl and setf.sig
 //   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
 //   computations need to scale appropriately.
-// The constant 128/ln(2) is needed for the computation of w.  This is also 
+// The constant 128/ln(2) is needed for the computation of w.  This is also
 //   obtained by scaling the computations.
 //
-// Two shifting constants are loaded directly with movl and setf.d. 
-//   1. EXP_RSHF_2TO56 = 1.1000..00 * 2^(63-7) 
+// Two shifting constants are loaded directly with movl and setf.d.
+//   1. fRSHF_2TO56 = 1.1000..00 * 2^(63-7)
 //        This constant is added to x*1/ln2 to shift the integer part of
 //        x*128/ln2 into the rightmost bits of the significand.
-//        The result of this fma is EXP_W_2TO56_RSH.
-//   2. EXP_RSHF       = 1.1000..00 * 2^(63) 
-//        This constant is subtracted from EXP_W_2TO56_RSH * 2^(-56) to give
+//        The result of this fma is fW_2TO56_RSH.
+//   2. fRSHF       = 1.1000..00 * 2^(63)
+//        This constant is subtracted from fW_2TO56_RSH * 2^(-56) to give
 //        the integer part of w, n, as a floating-point number.
-//        The result of this fms is EXP_Nfloat.
+//        The result of this fms is fNfloat.
 
 
-exp_table_1:
-ASM_TYPE_DIRECTIVE(exp_table_1,@object)
-data8 0x40862e42fefa39f0 // smallest dbl overflow arg
-data8 0xc0874c0000000000 // approx largest arg for zero result
-data8 0x40862e42fefa39ef // largest dbl arg to give normal dbl result
-data8 0xc086232bdd7abcd3 // largest dbl underflow arg
-data8 0xc086232bdd7abcd2 // smallest dbl arg to give normal dbl result
-data8 0x0                // pad
+LOCAL_OBJECT_START(exp_table_1)
+data8 0x40862e42fefa39f0 // smallest dbl overflow arg, +709.7827
+data8 0xc0874910d52d3052 // largest arg for rnd-to-nearest 0 result, -745.133
+data8 0x40862e42fefa39ef // largest dbl arg to give normal dbl result, +709.7827
+data8 0xc086232bdd7abcd2 // smallest dbl arg to give normal dbl result, -708.396
 data8 0xb17217f7d1cf79ab , 0x00003ff7 // ln2/128 hi
 data8 0xc9e3b39803f2f6af , 0x00003fb7 // ln2/128 lo
-
+//
 // Table 1 is 2^(index_1/128) where
 // index_1 goes from 0 to 15
-
+//
 data8 0x8000000000000000 , 0x00003FFF
 data8 0x80B1ED4FD999AB6C , 0x00003FFF
 data8 0x8164D1F3BC030773 , 0x00003FFF
@@ -264,12 +250,11 @@ data8 0x88980E8092DA8527 , 0x00003FFF
 data8 0x8955EE03618E5FDD , 0x00003FFF
 data8 0x8A14D575496EFD9A , 0x00003FFF
 data8 0x8AD4C6452C728924 , 0x00003FFF
-ASM_SIZE_DIRECTIVE(exp_table_1)
+LOCAL_OBJECT_END(exp_table_1)
 
 // Table 2 is 2^(index_1/8) where
 // index_2 goes from 0 to 7
-exp_table_2:
-ASM_TYPE_DIRECTIVE(exp_table_2,@object)
+LOCAL_OBJECT_START(exp_table_2)
 data8 0x8000000000000000 , 0x00003FFF
 data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
 data8 0x9837F0518DB8A96F , 0x00003FFF
@@ -278,413 +263,356 @@ data8 0xB504F333F9DE6484 , 0x00003FFF
 data8 0xC5672A115506DADD , 0x00003FFF
 data8 0xD744FCCAD69D6AF4 , 0x00003FFF
 data8 0xEAC0C6E7DD24392F , 0x00003FFF
-ASM_SIZE_DIRECTIVE (exp_table_2)
-
+LOCAL_OBJECT_END(exp_table_2)
 
-exp_p_table:
-ASM_TYPE_DIRECTIVE(exp_p_table,@object)
-data8 0x3f8111116da21757 //P_4
-data8 0x3fa55555d787761c //P_3
-data8 0x3fc5555555555414 //P_2
-data8 0x3fdffffffffffd6a //P_1
-ASM_SIZE_DIRECTIVE(exp_p_table)
 
+LOCAL_OBJECT_START(exp_p_table)
+data8 0x3f8111116da21757 //P5
+data8 0x3fa55555d787761c //P4
+data8 0x3fc5555555555414 //P3
+data8 0x3fdffffffffffd6a //P2
+LOCAL_OBJECT_END(exp_p_table)
 
-.align 32
-.global exp#
 
 .section .text
-.proc  exp#
-.align 32
-exp: 
-#ifdef _LIBC
-.global __ieee754_exp#
-__ieee754_exp:
-#endif
+GLOBAL_IEEE754_ENTRY(exp)
 
 { .mlx
-      alloc      r32=ar.pfs,1,24,4,0                               
-      movl exp_GR_sig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
+      nop.m           0
+      movl            rSig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
 }
 { .mlx
-      addl       EXP_AD_TB1    = @ltoff(exp_table_1), gp
-      movl exp_GR_rshf_2to56 = 0x4768000000000000 ;;  // 1.10000 2^(63+56)
+      addl            rAD_TB1    = @ltoff(exp_table_1), gp
+      movl            rRshf_2to56 = 0x4768000000000000   // 1.10000 2^(63+56)
 }
 ;;
 
-// We do this fnorm right at the beginning to take any enabled
-// faults and to normalize any input unnormals so that SWA is not taken.
 { .mfi
-      ld8        EXP_AD_TB1    = [EXP_AD_TB1]
-      fclass.m   p8,p0 = f8,0x07  // Test for x=0
-      mov        exp_GR_17ones = 0x1FFFF                          
+      ld8             rAD_TB1    = [rAD_TB1]
+      fclass.m        p8,p0 = f8,0x07  // Test for x=0
+      mov             rExp_mask = 0x1ffff
 }
 { .mfi
-      mov        exp_TB1_size  = 0x100
-      fnorm      EXP_NORM_f8   = f8                                          
-      mov exp_GR_exp_2tom56 = 0xffff-56
+      mov             rExp_bias = 0xffff
+      fnorm.s1        fNormX   = f8
+      mov             rExp_2tom56 = 0xffff-56
 }
 ;;
 
 // Form two constants we need
-//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128 
+//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128
 //  1.1000..000 * 2^(63+63-7) to right shift int(w) into the significand
 
-{ .mmf
-      setf.sig  EXP_INV_LN2_2TO63 = exp_GR_sig_inv_ln2 // form 1/ln2 * 2^63
-      setf.d  EXP_RSHF_2TO56 = exp_GR_rshf_2to56 // Form const 1.100 * 2^(63+56)
-      fclass.m   p9,p0 = f8,0x22  // Test for x=-inf
+{ .mfi
+      setf.sig        fINV_LN2_2TO63 = rSig_inv_ln2 // form 1/ln2 * 2^63
+      fclass.m        p9,p0 = f8,0x22  // Test for x=-inf
+      nop.i           0
+}
+{ .mlx
+      setf.d          fRSHF_2TO56 = rRshf_2to56 // Form const 1.100 * 2^(63+56)
+      movl            rRshf = 0x43e8000000000000 // 1.10000 2^63 for right shift
 }
 ;;
 
-{ .mlx
-      setf.exp EXP_2TOM56 = exp_GR_exp_2tom56 // form 2^-56 for scaling Nfloat
-      movl exp_GR_rshf = 0x43e8000000000000   // 1.10000 2^63 for right shift
+{ .mfi
+      ldfpd           fMIN_DBL_OFLOW_ARG, fMAX_DBL_ZERO_ARG = [rAD_TB1],16
+      fclass.m        p10,p0 = f8,0x1e1  // Test for x=+inf, nan, NaT
+      nop.i           0
 }
 { .mfb
-      mov        exp_TB2_size  = 0x80
-(p8)  fma.d      f8 = f1,f1,f0           // quick exit for x=0
-(p8)  br.ret.spnt b0
-;;
+      setf.exp        f2TOM56 = rExp_2tom56 // form 2^-56 for scaling Nfloat
+(p9)  fma.d.s0        f8 = f0,f0,f0           // quick exit for x=-inf
+(p9)  br.ret.spnt     b0
 }
+;;
 
 { .mfi
-      ldfpd      EXP_MIN_DBL_OFLOW_ARG, EXP_MAX_DBL_ZERO_ARG = [EXP_AD_TB1],16
-      fclass.m   p10,p0 = f8,0x21  // Test for x=+inf
-      nop.i 999
+      ldfpd           fMAX_DBL_NORM_ARG, fMIN_DBL_NORM_ARG = [rAD_TB1],16
+      nop.f           0
+      nop.i           0
 }
 { .mfb
-      nop.m 999
-(p9)  fma.d      f8 = f0,f0,f0           // quick exit for x=-inf
-(p9)  br.ret.spnt b0
-;;                    
+      setf.d          fRSHF = rRshf // Form right shift const 1.100 * 2^63
+(p8)  fma.d.s0        f8 = f1,f1,f0           // quick exit for x=0
+(p8)  br.ret.spnt     b0
 }
-
-{ .mmf
-      ldfpd      EXP_MAX_DBL_NORM_ARG, EXP_MAX_DBL_UFLOW_ARG = [EXP_AD_TB1],16
-      setf.d  EXP_RSHF = exp_GR_rshf // Form right shift const 1.100 * 2^63
-      fclass.m   p11,p0 = f8,0xc3  // Test for x=nan
 ;;
-}
 
 { .mfb
-      ldfd      EXP_MIN_DBL_NORM_ARG = [EXP_AD_TB1],16
-      nop.f 999
-(p10) br.ret.spnt b0               // quick exit for x=+inf
-;;
+      ldfe            fLn2_by_128_hi  = [rAD_TB1],16
+(p10) fma.d.s0        f8 = f8,f8,f0  // Result if x=+inf, nan, NaT
+(p10) br.ret.spnt     b0               // quick exit for x=+inf, nan, NaT
 }
+;;
 
 { .mfi
-      ldfe       exp_ln2_by_128_hi  = [EXP_AD_TB1],16
-      nop.f 999
-      nop.i 999
-;;
+      ldfe            fLn2_by_128_lo  = [rAD_TB1],16
+      fcmp.eq.s0      p6,p0 = f8, f0       // Dummy to set D
+      nop.i           0
 }
-
-
-{ .mfb
-      ldfe       exp_ln2_by_128_lo  = [EXP_AD_TB1],16
-(p11) fmerge.s   f8 = EXP_NORM_f8, EXP_NORM_f8
-(p11) br.ret.spnt b0               // quick exit for x=nan
 ;;
-}
 
-// After that last load, EXP_AD_TB1 points to the beginning of table 1
+// After that last load, rAD_TB1 points to the beginning of table 1
 
 // W = X * Inv_log2_by_128
 // By adding 1.10...0*2^63 we shift and get round_int(W) in significand.
 // We actually add 1.10...0*2^56 to X * Inv_log2 to do the same thing.
 
 { .mfi
-      nop.m 999
-      fma.s1  EXP_W_2TO56_RSH  = EXP_NORM_f8, EXP_INV_LN2_2TO63, EXP_RSHF_2TO56
-      nop.i 999
-;;
+      nop.m           0
+      fma.s1          fW_2TO56_RSH  = fNormX, fINV_LN2_2TO63, fRSHF_2TO56
+      nop.i           0
 }
-
+;;
 
 // Divide arguments into the following categories:
-//  Certain Underflow/zero  p11 - -inf < x <= MAX_DBL_ZERO_ARG 
-//  Certain Underflow       p12 - MAX_DBL_ZERO_ARG < x <= MAX_DBL_UFLOW_ARG 
-//  Possible Underflow      p13 - MAX_DBL_UFLOW_ARG < x < MIN_DBL_NORM_ARG
+//  Certain Underflow       p11 - -inf < x <= MAX_DBL_ZERO_ARG
+//  Possible Underflow      p13 - MAX_DBL_ZERO_ARG < x < MIN_DBL_NORM_ARG
 //  Certain Safe                - MIN_DBL_NORM_ARG <= x <= MAX_DBL_NORM_ARG
 //  Possible Overflow       p14 - MAX_DBL_NORM_ARG < x < MIN_DBL_OFLOW_ARG
 //  Certain Overflow        p15 - MIN_DBL_OFLOW_ARG <= x < +inf
 //
-// If the input is really a double arg, then there will never be "Possible
-// Underflow" or "Possible Overflow" arguments.
+// If the input is really a double arg, then there will never be
+// "Possible Overflow" arguments.
 //
 
 { .mfi
-      add        EXP_AD_TB2 = exp_TB1_size, EXP_AD_TB1
-      fcmp.ge.s1  p15,p14 = EXP_NORM_f8,EXP_MIN_DBL_OFLOW_ARG
-      nop.i 999
-;;                        
+      add             rAD_TB2 = 0x100, rAD_TB1
+      fcmp.ge.s1      p15,p0 = fNormX,fMIN_DBL_OFLOW_ARG
+      nop.i           0
 }
+;;
 
 { .mfi
-      add        EXP_AD_P = exp_TB2_size, EXP_AD_TB2
-      fcmp.le.s1  p11,p12 = EXP_NORM_f8,EXP_MAX_DBL_ZERO_ARG
-      nop.i 999
-;;
+      add             rAD_P = 0x80, rAD_TB2
+      fcmp.le.s1      p11,p0 = fNormX,fMAX_DBL_ZERO_ARG
+      nop.i           0
 }
+;;
 
 { .mfb
-      ldfpd      exp_P4, exp_P3  = [EXP_AD_P] ,16
-(p14) fcmp.gt.unc.s1  p14,p0 = EXP_NORM_f8,EXP_MAX_DBL_NORM_ARG
-(p15) br.cond.spnt L(EXP_CERTAIN_OVERFLOW)
-;;
+      ldfpd           fP5, fP4  = [rAD_P] ,16
+      fcmp.gt.s1      p14,p0 = fNormX,fMAX_DBL_NORM_ARG
+(p15) br.cond.spnt    EXP_CERTAIN_OVERFLOW
 }
+;;
 
-
-// Nfloat = round_int(W) 
-// The signficand of EXP_W_2TO56_RSH contains the rounded integer part of W,
+// Nfloat = round_int(W)
+// The signficand of fW_2TO56_RSH contains the rounded integer part of W,
 // as a twos complement number in the lower bits (that is, it may be negative).
-// That twos complement number (called N) is put into exp_GR_N.
-
-// Since EXP_W_2TO56_RSH is scaled by 2^56, it must be multiplied by 2^-56
-// before the shift constant 1.10000 * 2^63 is subtracted to yield EXP_Nfloat.
-// Thus, EXP_Nfloat contains the floating point version of N
+// That twos complement number (called N) is put into rN.
 
+// Since fW_2TO56_RSH is scaled by 2^56, it must be multiplied by 2^-56
+// before the shift constant 1.10000 * 2^63 is subtracted to yield fNfloat.
+// Thus, fNfloat contains the floating point version of N
 
-{ .mfi
-      nop.m 999
-(p12) fcmp.le.unc  p12,p0 = EXP_NORM_f8,EXP_MAX_DBL_UFLOW_ARG
-      nop.i 999
-}
 { .mfb
-      ldfpd      exp_P2, exp_P1  = [EXP_AD_P]                                  
-      fms.s1          EXP_Nfloat = EXP_W_2TO56_RSH, EXP_2TOM56, EXP_RSHF 
-(p11) br.cond.spnt L(EXP_CERTAIN_UNDERFLOW_ZERO)
-;;
+      ldfpd           fP3, fP2  = [rAD_P]
+      fms.s1          fNfloat = fW_2TO56_RSH, f2TOM56, fRSHF
+(p11) br.cond.spnt    EXP_CERTAIN_UNDERFLOW
 }
+;;
 
 { .mfi
-      getf.sig        exp_GR_N        = EXP_W_2TO56_RSH
-(p13) fcmp.lt.unc  p13,p0 = EXP_NORM_f8,EXP_MIN_DBL_NORM_ARG
-      nop.i 999
-;;
+      getf.sig        rN        = fW_2TO56_RSH
+      nop.f           0
+      nop.i           0
 }
+;;
 
+// rIndex_1 has index_1
+// rIndex_2_16 has index_2 * 16
+// rBiased_M has M
+// rIndex_1_16 has index_1 * 16
 
-// exp_GR_index_1 has index_1
-// exp_GR_index_2_16 has index_2 * 16
-// exp_GR_biased_M has M
-// exp_GR_index_1_16 has index_1 * 16
-
-// r2 has true M
+// rM has true M
+// r = x - Nfloat * ln2_by_128_hi
+// f = 1 - Nfloat * ln2_by_128_lo
 { .mfi
-      and            exp_GR_index_1 = 0x0f, exp_GR_N
-      fnma.s1    exp_r   = EXP_Nfloat, exp_ln2_by_128_hi, EXP_NORM_f8 
-      shr            r2 = exp_GR_N,  0x7
+      and             rIndex_1 = 0x0f, rN
+      fnma.s1         fR   = fNfloat, fLn2_by_128_hi, fNormX
+      shr             rM = rN,  0x7
 }
 { .mfi
-      and            exp_GR_index_2_16 = 0x70, exp_GR_N
-      fnma.s1    exp_f   = EXP_Nfloat, exp_ln2_by_128_lo, f1 
-      nop.i 999
-;;                            
+      and             rIndex_2_16 = 0x70, rN
+      fnma.s1         fF   = fNfloat, fLn2_by_128_lo, f1
+      nop.i           0
 }
+;;
 
-
-// EXP_AD_T1 has address of T1                           
-// EXP_AD_T2 has address if T2                            
+// rAD_T1 has address of T1
+// rAD_T2 has address if T2
 
 { .mmi
-      addl           exp_GR_biased_M = 0xffff, r2 
-      add            EXP_AD_T2 = EXP_AD_TB2, exp_GR_index_2_16 
-      shladd         EXP_AD_T1 = exp_GR_index_1, 4, EXP_AD_TB1
-;;                            
+      add             rBiased_M = rExp_bias, rM
+      add             rAD_T2 = rAD_TB2, rIndex_2_16
+      shladd          rAD_T1 = rIndex_1, 4, rAD_TB1
 }
-
+;;
 
 // Create Scale = 2^M
-// r = x - Nfloat * ln2_by_128_hi 
-// f = 1 - Nfloat * ln2_by_128_lo 
-
 { .mmi
-      setf.exp        EXP_2M = exp_GR_biased_M                              
-      ldfe       exp_T2  = [EXP_AD_T2]                                
-      nop.i 999
-;;
+      setf.exp        f2M = rBiased_M
+      ldfe            fT2  = [rAD_T2]
+      nop.i           0
 }
+;;
 
 // Load T1 and T2
 { .mfi
-      ldfe       exp_T1  = [EXP_AD_T1]                                
-      nop.f 999
-      nop.i 999
-;;
+      ldfe            fT1  = [rAD_T1]
+      fmpy.s0         fTmp = fLn2_by_128_lo, fLn2_by_128_lo // Force inexact
+      nop.i           0
 }
-
+;;
 
 { .mfi
-        nop.m 999
-        fma.s1           exp_rsq = exp_r, exp_r, f0 
-        nop.i 999
+      nop.m           0
+      fma.s1          fRsq = fR, fR, f0
+      nop.i           0
 }
 { .mfi
-        nop.m 999
-        fma.s1        exp_rP4pP3 = exp_r, exp_P4, exp_P3               
-        nop.i 999
-;;
+      nop.m           0
+      fma.s1          fP54 = fR, fP5, fP4
+      nop.i           0
 }
-
-
+;;
 
 { .mfi
-        nop.m 999
-        fma.s1           exp_rcube = exp_r, exp_rsq, f0 
-        nop.i 999 
+      nop.m           0
+      fcmp.lt.s1      p13,p0 = fNormX,fMIN_DBL_NORM_ARG
+      nop.i           0
 }
 { .mfi
-        nop.m 999
-        fma.s1        exp_P_lo  = exp_r, exp_rP4pP3, exp_P2            
-        nop.i 999
-;;
+      nop.m           0
+      fma.s1          fP32 = fR, fP3, fP2
+      nop.i           0
 }
-
+;;
 
 { .mfi
-        nop.m 999
-        fma.s1        exp_P_hi  = exp_rsq, exp_P1, exp_r              
-        nop.i 999
+      nop.m           0
+      fma.s1          fP5432  = fRsq, fP54, fP32
+      nop.i           0
 }
-{ .mfi
-        nop.m 999
-        fma.s1        exp_S2  = exp_f,exp_T2,f0                       
-        nop.i 999
 ;;
-}
 
 { .mfi
-        nop.m 999
-        fma.s1        exp_S1  = EXP_2M,exp_T1,f0                      
-        nop.i 999
-;;
+      nop.m           0
+      fma.s1          fS1  = f2M,fT1,f0
+      nop.i           0
 }
-
-
 { .mfi
-        nop.m 999
-        fma.s1        exp_P     = exp_rcube, exp_P_lo, exp_P_hi       
-        nop.i 999
-;;
+      nop.m           0
+      fma.s1          fS2  = fF,fT2,f0
+      nop.i           0
 }
+;;
 
 { .mfi
-        nop.m 999
-        fma.s1        exp_S   = exp_S1,exp_S2,f0                      
-        nop.i 999
-;;
+      nop.m           0
+      fma.s1          fP     = fRsq, fP5432, fR
+      nop.i           0
 }
-
-{ .bbb
-(p12)   br.cond.spnt  L(EXP_CERTAIN_UNDERFLOW)
-(p13)   br.cond.spnt  L(EXP_POSSIBLE_UNDERFLOW)
-(p14)   br.cond.spnt  L(EXP_POSSIBLE_OVERFLOW)
-;;
+{ .mfi
+      nop.m           0
+      fma.s1          fS   = fS1,fS2,f0
+      nop.i           0
 }
+;;
 
+{ .mbb
+      nop.m           0
+(p13) br.cond.spnt    EXP_POSSIBLE_UNDERFLOW
+(p14) br.cond.spnt    EXP_POSSIBLE_OVERFLOW
+}
+;;
 
 { .mfb
-        nop.m 999
-        fma.d      f8 = exp_S, exp_P, exp_S 
-        br.ret.sptk     b0 ;;               // Normal path exit 
+      nop.m           0
+      fma.d.s0        f8 = fS, fP, fS
+      br.ret.sptk     b0                  // Normal path exit
 }
+;;
 
 
-L(EXP_POSSIBLE_OVERFLOW): 
+EXP_POSSIBLE_OVERFLOW:
 
-// We got an answer. EXP_MAX_DBL_NORM_ARG < x < EXP_MIN_DBL_OFLOW_ARG
-// overflow is a possibility, not a certainty
+// Here if fMAX_DBL_NORM_ARG < x < fMIN_DBL_OFLOW_ARG
+// This cannot happen if input is a double, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-{ .mfi
-	nop.m 999
-        fsetc.s2 0x7F,0x42                                          
-	nop.i 999 ;;
-}
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest double, then we have
+// overflow
 
 { .mfi
-	nop.m 999
-        fma.d.s2      exp_wre_urm_f8 = exp_S, exp_P, exp_S          
-	nop.i 999 ;;
+      mov             rGt_ln  = 0x103ff // Exponent for largest dbl + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
-
-// We define an overflow when the answer with
-//    WRE set
-//    user-defined rounding mode
-// is ldn +1
-
-// Is the exponent 1 more than the largest double?
-// If so, go to ERROR RETURN, else get the answer and 
-// leave.
-
-// Largest double is 7FE (biased double)
-//                   7FE - 3FF + FFFF = 103FE
-// Create + largest_double_plus_ulp
-// Create - largest_double_plus_ulp
-// Calculate answer with WRE set.
-
-// Cases when answer is ldn+1  are as follows:
-//  ldn                   ldn+1
-// --+----------|----------+------------
-//              | 
-//    +inf          +inf      -inf
-//                  RN         RN
-//                             RZ 
+;;
 
 { .mfi
-	nop.m 999
-        fsetc.s2 0x7F,0x40                                          
-        mov           exp_GR_gt_ln  = 0x103ff ;;                      
+      setf.exp        fGt_pln = rGt_ln  // Create largest double + 1 ulp
+      fma.d.s2        fWre_urm_f8 = fS, fP, fS    // Result with wre set
+      nop.i           0
 }
+;;
 
 { .mfi
-        setf.exp      exp_gt_pln    = exp_GR_gt_ln                 
-	nop.f 999
-	nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-       fcmp.ge.unc.s1 p6, p0 =  exp_wre_urm_f8, exp_gt_pln 	  
-	nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
+;;
 
 { .mfb
-	nop.m 999
-	nop.f 999
-(p6)   br.cond.spnt L(EXP_CERTAIN_OVERFLOW) ;; // Branch if really overflow
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    EXP_CERTAIN_OVERFLOW // Branch if overflow
 }
+;;
 
 { .mfb
-	nop.m 999
-       fma.d        f8 = exp_S, exp_P, exp_S                      
-       br.ret.sptk     b0 ;;             // Exit if really no overflow
+      nop.m           0
+      fma.d.s0        f8 = fS, fP, fS
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
+;;
 
-L(EXP_CERTAIN_OVERFLOW):
+EXP_CERTAIN_OVERFLOW:
 { .mmi
-      sub   exp_GR_17ones_m1 = exp_GR_17ones, r0, 1 ;;
-      setf.exp     f9 = exp_GR_17ones_m1
-      nop.i 999 ;;
+      sub             rTmp = rExp_mask, r0, 1
+;;
+      setf.exp        fTmp = rTmp
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-      fmerge.s FR_X = f8,f8
-      nop.i 999
+      alloc           r32=ar.pfs,1,4,4,0
+      fmerge.s        FR_X = f8,f8
+      nop.i           0
 }
 { .mfb
-      mov        GR_Parameter_TAG = 14
-      fma.d       FR_RESULT = f9, f9, f0    // Set I,O and +INF result
-      br.cond.sptk  __libm_error_region ;;                             
+      mov             GR_Parameter_TAG = 14
+      fma.d.s0        FR_RESULT = fTmp, fTmp, fTmp    // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
-L(EXP_POSSIBLE_UNDERFLOW): 
+EXP_POSSIBLE_UNDERFLOW:
 
-// We got an answer. EXP_MAX_DBL_UFLOW_ARG < x < EXP_MIN_DBL_NORM_ARG
-// underflow is a possibility, not a certainty
+// Here if fMAX_DBL_ZERO_ARG < x < fMIN_DBL_NORM_ARG
+// Underflow is a possibility, not a certainty
 
 // We define an underflow when the answer with
 //    ftz set
@@ -709,81 +637,119 @@ L(EXP_POSSIBLE_UNDERFLOW):
 //    largest dn                               smallest normal
 
 { .mfi
-	nop.m 999
-       fsetc.s2 0x7F,0x41                                          
-	nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x41                // Get user's round mode, set ftz
+      nop.i           0
 }
+;;
+
 { .mfi
-	nop.m 999
-       fma.d.s2      exp_ftz_urm_f8 = exp_S, exp_P, exp_S          
-	nop.i 999 ;;
+      nop.m           0
+      fma.d.s2        fFtz_urm_f8 = fS, fP, fS // Result with ftz set
+      nop.i           0
 }
+;;
+
 { .mfi
-	nop.m 999
-       fsetc.s2 0x7F,0x40                                          
-	nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                // Turn off ftz in sf2
+      nop.i           0
 }
+;;
+
 { .mfi
-	nop.m 999
-       fcmp.eq.unc.s1 p6, p0 =  exp_ftz_urm_f8, f0 	          
-	nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s1      p6, p7 = fFtz_urm_f8, f0 // Test for underflow
+      nop.i           0
 }
-{ .mfb
-	nop.m 999
-	nop.f 999
-(p6)   br.cond.spnt L(EXP_CERTAIN_UNDERFLOW) ;; // Branch if really underflow
+{ .mfi
+      nop.m           0
+      fma.d.s0        f8 = fS, fP, fS          // Compute result, set I, maybe U
+      nop.i           0
 }
-{ .mfb
-	nop.m 999
-       fma.d        f8 = exp_S, exp_P, exp_S                      
-       br.ret.sptk     b0 ;;                // Exit if really no underflow
+;;
+
+{ .mbb
+      nop.m           0
+(p6)  br.cond.spnt    EXP_UNDERFLOW_COMMON     // Branch if really underflow
+(p7)  br.ret.sptk     b0                       // Exit if really no underflow
 }
+;;
+
+EXP_CERTAIN_UNDERFLOW:
+// Here if  x < fMAX_DBL_ZERO_ARG
+// Result will be zero (or smallest denorm if round to +inf) with I, U set
+{ .mmi
+      mov             rTmp = 1
+;;
+      setf.exp        fTmp = rTmp               // Form small normal
+      nop.i           0
+}
+;;
 
-L(EXP_CERTAIN_UNDERFLOW):
 { .mfi
-      nop.m 999
-      fmerge.s FR_X = f8,f8
-      nop.i 999
+      nop.m           0
+      fmerge.se       fTmp = fTmp, fLn2_by_128_lo // Small with signif lsb 1
+      nop.i           0
 }
+;;
+      
 { .mfb
-      mov        GR_Parameter_TAG = 15
-      fma.d       FR_RESULT  = exp_S, exp_P, exp_S // Set I,U and tiny result
-      br.cond.sptk  __libm_error_region ;;                             
+      nop.m           0
+      fma.d.s0        f8 = fTmp, fTmp, f0 // Set I,U, tiny (+0.0) result
+      br.cond.sptk    EXP_UNDERFLOW_COMMON
 }
+;;
 
-L(EXP_CERTAIN_UNDERFLOW_ZERO):
-{ .mmi
-      mov   exp_GR_one = 1 ;;
-      setf.exp     f9 = exp_GR_one
-      nop.i 999 ;;
+EXP_UNDERFLOW_COMMON:
+// Determine if underflow result is zero or nonzero
+{ .mfi
+      alloc           r32=ar.pfs,1,4,4,0
+      fcmp.eq.s1      p6, p0 =  f8, f0
+      nop.i           0
 }
+;;
 
-{ .mfi
-      nop.m 999
-      fmerge.s FR_X = f8,f8
-      nop.i 999
+{ .mfb
+      nop.m           0
+      fmerge.s        FR_X = fNormX,fNormX
+(p6)  br.cond.spnt    EXP_UNDERFLOW_ZERO
+}
+;;
+
+EXP_UNDERFLOW_NONZERO:
+// Here if  x < fMIN_DBL_NORM_ARG and result nonzero;
+// I, U are set
+{ .mfb
+      mov             GR_Parameter_TAG = 15
+      nop.f           0                         // FR_RESULT already set
+      br.cond.sptk    __libm_error_region
 }
+;;
+
+EXP_UNDERFLOW_ZERO:
+// Here if x < fMIN_DBL_NORM_ARG and result zero;
+// I, U are set
 { .mfb
-      mov        GR_Parameter_TAG = 15
-      fma.d       FR_RESULT = f9, f9, f0    // Set I,U and tiny (+0.0) result
-      br.cond.sptk  __libm_error_region ;;                             
+      mov             GR_Parameter_TAG = 15
+      nop.f           0                         // FR_RESULT already set
+      br.cond.sptk    __libm_error_region
 }
+;;
 
-.endp exp
-ASM_SIZE_DIRECTIVE(exp)
+GLOBAL_IEEE754_END(exp)
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
-.fframe 64 
+.fframe 64
         add sp=-64,sp                           // Create new stack
         nop.f 0
         mov GR_SAVE_GP=gp                       // Save gp
@@ -791,24 +757,24 @@ __libm_error_region:
 { .mmi
         stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
         add GR_Parameter_X = 16,sp              // Parameter 1 address
-.save   b0, GR_SAVE_B0                      
-        mov GR_SAVE_B0=b0                       // Save b0 
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
 };;
 .body
 { .mib
-        stfd [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack 
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address 
-	nop.b 0                                      
+        stfd [GR_Parameter_X] = FR_X            // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+	nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y  
-        br.call.sptk b0=__libm_error_support#         // Call error handling function
+        stfd [GR_Parameter_Y] = FR_RESULT       // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 { .mmi
         ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
@@ -817,12 +783,11 @@ __libm_error_region:
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
-};; 
+};;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_exp10.S b/sysdeps/ia64/fpu/e_exp10.S
new file mode 100644
index 0000000000..eafa59dd7c
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_exp10.S
@@ -0,0 +1,605 @@
+.file "exp10.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/25/00 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 09/06/02 Improved performance; no inexact flags on exact cases
+// 01/29/03 Added missing } to bundle templates
+// 12/16/04 Call error handling on underflow.
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// double exp10(double)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x= (K + fh + fl + r)/log2(10), where
+// K is an integer, fh= 0.b1 b2 b3 b4 b5,
+// fl= 2^{-5}* 0.b6 b7 b8 b8 b10 (fh, fl >= 0),
+// and |r|<2^{-11}
+// Th is a table that stores 2^fh (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+// Tl is a table that stores 2^fl (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+//
+// 10^x is approximated as
+// 2^K * Th [ f ] * Tl [ f ] * (1+c1*e+c1*r+c2*r^2+c3*r^3+c4*r^4),
+// where e= (x*log2(10)_hi-RN(x*log2(10)_hi))+log2(10)_lo*x
+
+// Note there are only 22 non-zero values that produce an exact result:
+//  1.0, 2.0, ... 22.0.
+// We test for these cases and use s1 to avoid setting the inexact flag.
+
+// Special values
+//==============================================================
+// exp10(0)= 1
+// exp10(+inf)= inf
+// exp10(-inf)= 0
+//
+
+// Registers used
+//==============================================================
+// r2-r3, r14-r40
+// f6-f15, f32-f52
+// p6-p12
+//
+
+
+GR_TBL_START        = r2
+GR_LOG_TBL          = r3
+
+GR_OF_LIMIT         = r14
+GR_UF_LIMIT         = r15
+GR_EXP_CORR         = r16
+GR_F_low            = r17
+GR_F_high           = r18
+GR_K                = r19
+GR_Flow_ADDR        = r20
+
+GR_BIAS             = r21
+GR_Fh               = r22
+GR_Fh_ADDR          = r23
+GR_EXPMAX           = r24
+GR_BIAS53           = r25
+
+GR_ROUNDVAL         = r26
+GR_SNORM_LIMIT      = r26
+GR_MASK             = r27
+GR_KF0              = r28
+GR_MASK_low         = r29
+GR_COEFF_START      = r30
+GR_exact_limit      = r31
+
+GR_SAVE_B0          = r33
+GR_SAVE_PFS         = r34
+GR_SAVE_GP          = r35
+GR_SAVE_SP          = r36
+
+GR_Parameter_X      = r37
+GR_Parameter_Y      = r38
+GR_Parameter_RESULT = r39
+GR_Parameter_TAG    = r40
+
+
+FR_X                = f10
+FR_Y                = f1
+FR_RESULT           = f8
+
+
+FR_COEFF1           = f6
+FR_COEFF2           = f7
+FR_R                = f9
+FR_LOG2_10          = f10
+
+FR_2P53             = f11
+FR_KF0              = f12
+FR_COEFF3           = f13
+FR_COEFF4           = f14
+FR_UF_LIMIT         = f15
+
+FR_OF_LIMIT         = f32
+FR_DX_L210          = f33
+FR_ROUNDVAL         = f34
+FR_KF               = f35
+
+FR_2_TO_K           = f36
+FR_T_low            = f37
+FR_T_high           = f38
+FR_P34              = f39
+FR_R2               = f40
+
+FR_P12              = f41
+FR_T_low_K          = f42
+FR_P14              = f43
+FR_T                = f44
+FR_P                = f45
+
+FR_L2_10_low        = f46
+FR_L2_10_high       = f47
+FR_E0               = f48
+FR_E                = f49
+FR_exact_limit      = f50
+
+FR_int_x            = f51
+FR_SNORM_LIMIT      = f52
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+data8 0xd49a784bcd1b8afe, 0x00003fcb // log2(10)*2^(10-63)
+data8 0x9257edfe9b5fb698, 0x3fbf // log2(10)_low (bits 64...127)
+data8 0x3fac6b08d704a0c0, 0x3f83b2ab6fba4e77 // C_3 and C_4
+data8 0xb17217f7d1cf79ab, 0x00003ffe // C_1
+data8 0xf5fdeffc162c7541, 0x00003ffc // C_2
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+// 2^{0.00000 b6 b7 b8 b9 b10}
+data8 0x8000000000000000, 0x8016302f17467628
+data8 0x802c6436d0e04f50, 0x80429c17d77c18ed
+data8 0x8058d7d2d5e5f6b0, 0x806f17687707a7af
+data8 0x80855ad965e88b83, 0x809ba2264dada76a
+data8 0x80b1ed4fd999ab6c, 0x80c83c56b50cf77f
+data8 0x80de8f3b8b85a0af, 0x80f4e5ff089f763e
+data8 0x810b40a1d81406d4, 0x81219f24a5baa59d
+data8 0x813801881d886f7b, 0x814e67cceb90502c
+data8 0x8164d1f3bc030773, 0x817b3ffd3b2f2e47
+data8 0x8191b1ea15813bfd, 0x81a827baf7838b78
+data8 0x81bea1708dde6055, 0x81d51f0b8557ec1c
+data8 0x81eba08c8ad4536f, 0x820225f44b55b33b
+data8 0x8218af4373fc25eb, 0x822f3c7ab205c89a
+data8 0x8245cd9ab2cec048, 0x825c62a423d13f0c
+data8 0x8272fb97b2a5894c, 0x828998760d01faf3
+data8 0x82a0393fe0bb0ca8, 0x82b6ddf5dbc35906
+//
+// 2^{0.b1 b2 b3 b4 b5}
+data8 0x8000000000000000, 0x82cd8698ac2ba1d7
+data8 0x85aac367cc487b14, 0x88980e8092da8527
+data8 0x8b95c1e3ea8bd6e6, 0x8ea4398b45cd53c0
+data8 0x91c3d373ab11c336, 0x94f4efa8fef70961
+data8 0x9837f0518db8a96f, 0x9b8d39b9d54e5538
+data8 0x9ef5326091a111ad, 0xa27043030c496818
+data8 0xa5fed6a9b15138ea, 0xa9a15ab4ea7c0ef8
+data8 0xad583eea42a14ac6, 0xb123f581d2ac258f
+data8 0xb504f333f9de6484, 0xb8fbaf4762fb9ee9
+data8 0xbd08a39f580c36be, 0xc12c4cca66709456
+data8 0xc5672a115506dadd, 0xc9b9bd866e2f27a2
+data8 0xce248c151f8480e3, 0xd2a81d91f12ae45a
+data8 0xd744fccad69d6af4, 0xdbfbb797daf23755
+data8 0xe0ccdeec2a94e111, 0xe5b906e77c8348a8
+data8 0xeac0c6e7dd24392e, 0xefe4b99bdcdaf5cb
+data8 0xf5257d152486cc2c, 0xfa83b2db722a033a
+LOCAL_OBJECT_END(T_table)
+
+
+
+.section .text
+GLOBAL_IEEE754_ENTRY(exp10)
+
+
+{.mfi
+       alloc r32= ar.pfs, 1, 4, 4, 0
+       // will continue only for non-zero normal/denormal numbers
+       fclass.nm.unc p12, p7= f8, 0x1b
+       mov GR_BIAS53= 0xffff+63-10
+}
+{.mlx
+       // GR_TBL_START= pointer to log2(10), C_1...C_4 followed by T_table
+       addl GR_TBL_START= @ltoff(poly_coeffs), gp
+       movl GR_ROUNDVAL= 0x3fc00000             // 1.5 (SP)
+}
+;;
+
+{.mfi
+       ld8 GR_COEFF_START= [ GR_TBL_START ]     // Load pointer to coeff table
+       fcmp.lt.s1 p6, p8= f8, f0                // X<0 ?
+       nop.i 0
+}
+;;
+
+{.mlx
+       setf.exp FR_2P53= GR_BIAS53              // 2^{63-10}
+       movl GR_UF_LIMIT= 0xc07439b746e36b52     // (-2^10-51) / log2(10)
+}
+{.mlx
+       setf.s FR_ROUNDVAL= GR_ROUNDVAL
+       movl GR_OF_LIMIT= 0x40734413509f79fe     // Overflow threshold
+}
+;;
+
+{.mlx
+       ldfe FR_LOG2_10= [ GR_COEFF_START ], 16  // load log2(10)*2^(10-63)
+       movl GR_SNORM_LIMIT= 0xc0733a7146f72a41  // Smallest normal threshold
+}
+{.mib
+       nop.m 0
+       nop.i 0
+ (p12) br.cond.spnt SPECIAL_exp10               // Branch if nan, inf, zero
+}
+;;
+
+{.mmf
+       ldfe FR_L2_10_low= [ GR_COEFF_START ], 16 // load log2(10)_low
+       setf.d FR_OF_LIMIT= GR_OF_LIMIT           // Set overflow limit
+       fma.s0 f8= f8, f1, f0                     // normalize x
+}
+;;
+
+{.mfi
+       ldfpd FR_COEFF3, FR_COEFF4= [ GR_COEFF_START ], 16 // load C_3, C_4
+ (p8)  fcvt.fx.s1 FR_int_x = f8                   // Convert x to integer
+       nop.i 0
+}
+{.mfi
+       setf.d FR_UF_LIMIT= GR_UF_LIMIT            // Set underflow limit
+       fma.s1 FR_KF0= f8, FR_LOG2_10, FR_ROUNDVAL // y= (x*log2(10)*2^10 +
+                                                  //    1.5*2^63) * 2^(-63)
+       mov GR_EXP_CORR= 0xffff-126
+}
+;;
+
+{.mfi
+       setf.d FR_SNORM_LIMIT= GR_SNORM_LIMIT      // Set smallest normal limit
+       fma.s1 FR_L2_10_high= FR_LOG2_10, FR_2P53, f0 // FR_LOG2_10= log2(10)_hi
+       nop.i 0
+}
+;;
+
+{.mfi
+       ldfe FR_COEFF1= [ GR_COEFF_START ], 16    // load C_1
+       fms.s1 FR_KF= FR_KF0, f1, FR_ROUNDVAL     // (K+f)*2^(10-63)
+       mov GR_MASK= 1023
+}
+;;
+
+{.mfi
+       ldfe FR_COEFF2= [ GR_COEFF_START ], 16    // load C_2
+       fma.s1 FR_LOG2_10= f8, FR_L2_10_high, f0  // y0= x*log2(10)_hi
+       mov GR_MASK_low= 31
+}
+;;
+
+{.mlx
+       getf.sig GR_KF0= FR_KF0                   // (K+f)*2^10= round_to_int(y)
+ (p8)  movl GR_exact_limit= 0x41b00000           // Largest x for exact result,
+                                                 //  +22.0
+}
+;;
+
+{.mfi
+       add GR_LOG_TBL= 256, GR_COEFF_START       // Pointer to high T_table
+       fcmp.gt.s1 p12, p7= f8, FR_OF_LIMIT       // x>overflow threshold ?
+       nop.i 0
+}
+;;
+
+{.mfi
+ (p8)  setf.s FR_exact_limit = GR_exact_limit    // Largest x for exact result
+ (p8)  fcvt.xf FR_int_x = FR_int_x               // Integral part of x
+       shr GR_K= GR_KF0, 10                      // K
+}
+{.mfi
+       and GR_F_high= GR_MASK, GR_KF0            // f_high*32
+       fnma.s1 FR_R= FR_KF, FR_2P53, FR_LOG2_10  // r= x*log2(10)-2^{63-10}*
+                                                 //    [ (K+f)*2^{10-63} ]
+       and GR_F_low= GR_KF0, GR_MASK_low         // f_low
+}
+;;
+
+{.mmi
+       shladd GR_Flow_ADDR= GR_F_low, 3, GR_COEFF_START // address of 2^{f_low}
+       add GR_BIAS= GR_K, GR_EXP_CORR            // K= bias-2*63
+       shr GR_Fh= GR_F_high, 5                   // f_high
+}
+;;
+
+{.mfi
+       setf.exp FR_2_TO_K= GR_BIAS               // 2^{K-126}
+ (p7)  fcmp.lt.s1 p12, p7= f8, FR_UF_LIMIT       // x<underflow threshold ?
+       shladd GR_Fh_ADDR= GR_Fh, 3, GR_LOG_TBL   // address of 2^{f_high}
+}
+{.mfi
+       ldf8 FR_T_low= [ GR_Flow_ADDR ]           // load T_low= 2^{f_low}
+       fms.s1 FR_DX_L210= f8, FR_L2_10_high, FR_LOG2_10 // x*log2(10)_hi-
+                                                 //        RN(x*log2(10)_hi)
+       nop.i 0
+}
+;;
+
+{.mfi
+       ldf8 FR_T_high= [ GR_Fh_ADDR ]            // load T_high= 2^{f_high}
+       fma.s1 FR_P34= FR_COEFF4, FR_R, FR_COEFF3 // P34= C_3+C_4*r
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+       fma.s1 FR_R2= FR_R, FR_R, f0              // r*r
+ (p12) br.cond.spnt OUT_RANGE_exp10
+}
+;;
+
+{.mfi
+       nop.m 0
+       // e= (x*log2(10)_hi-RN(x*log2(10)_hi))+log2(10)_lo*x
+       fma.s1 FR_E0= f8, FR_L2_10_low, FR_DX_L210
+       cmp.eq p7,p9= r0,r0                       // Assume inexact result
+}
+{.mfi
+       nop.m 0
+       fma.s1 FR_P12= FR_COEFF2, FR_R, FR_COEFF1 // P12= C_1+C_2*r
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+ (p8)  fcmp.eq.s1 p9,p7= FR_int_x, f8            // Test x positive integer
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       fma.s1 FR_T_low_K= FR_T_low, FR_2_TO_K, f0 // T= 2^{K-126}*T_low
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fcmp.ge.s1 p11,p0= f8, FR_SNORM_LIMIT      // Test x for normal range
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_E= FR_E0, FR_COEFF1, f0          // E= C_1*e
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       fma.s1 FR_P14= FR_R2, FR_P34, FR_P12       // P14= P12+r2*P34
+       nop.i 0
+}
+;;
+
+// If x a positive integer, will it produce an exact result?
+//   p7 result will be inexact
+//   p9 result will be exact
+{.mfi
+       nop.m 0
+ (p9)  fcmp.le.s1 p9,p7= f8, FR_exact_limit       // Test x gives exact result
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       fma.s1 FR_T= FR_T_low_K, FR_T_high, f0     // T= T*T_high
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_P= FR_P14, FR_R, FR_E            // P= P14*r+E
+       nop.i 0
+}
+;;
+
+.pred.rel "mutex",p7,p9
+{.mfi
+       nop.m 0
+ (p7)  fma.d.s0 f8= FR_P, FR_T, FR_T              // result= T+T*P, inexact set
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+ (p9)  fma.d.s1 f8= FR_P, FR_T, FR_T              // result= T+T*P, exact use s1
+ (p11) br.ret.sptk b0                             // return, if result normal
+}
+;;
+
+// Here if result in denormal range (and not zero)
+{.mib
+       nop.m 0
+       mov GR_Parameter_TAG= 265
+       br.cond.sptk __libm_error_region           // Branch to error handling
+}
+;;
+
+SPECIAL_exp10:
+{.mfi
+       nop.m 0
+       fclass.m p6, p0= f8, 0x22                  // x= -Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p7, p0= f8, 0x21                  // x= +Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p8, p0= f8, 0x7                   // x= +/-Zero ?
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+ (p6)  mov f8= f0                                 // exp10(-Infinity)= 0
+ (p6)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       nop.f 0
+ (p7)  br.ret.spnt b0                             // exp10(+Infinity)= +Infinity
+}
+;;
+
+{.mfb
+       nop.m 0
+ (p8)  mov f8= f1                                 // exp10(+/-0)= 1
+ (p8)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.d.s0 f8= f8, f1, f0                    // Remaining cases: NaNs
+       br.ret.sptk b0
+}
+;;
+
+
+OUT_RANGE_exp10:
+
+// underflow: p6= 1
+// overflow: p8= 1
+
+.pred.rel "mutex",p6,p8
+{.mmi
+ (p8)  mov GR_EXPMAX= 0x1fffe
+ (p6)  mov GR_EXPMAX= 1
+       nop.i 0
+}
+;;
+
+{.mii
+       setf.exp FR_R= GR_EXPMAX
+ (p8)  mov GR_Parameter_TAG= 166
+ (p6)  mov GR_Parameter_TAG= 265
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.d.s0 f8= FR_R, FR_R, f0                // Create overflow/underflow
+       br.cond.sptk __libm_error_region           // Branch to error handling
+}
+;;
+
+GLOBAL_IEEE754_END(exp10)
+weak_alias (exp10, pow10)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+.prologue
+{.mfi
+       add GR_Parameter_Y= -32, sp                // Parameter 2 value
+       nop.f 0
+.save ar.pfs, GR_SAVE_PFS
+       mov GR_SAVE_PFS= ar.pfs                    // Save ar.pfs
+}
+
+{.mfi
+.fframe 64
+       add sp= -64, sp                            // Create new stack
+       nop.f 0
+       mov GR_SAVE_GP= gp                         // Save gp
+}
+;;
+
+{.mmi
+       stfd [ GR_Parameter_Y ]= FR_Y, 16          // STORE Parameter 2 on stack
+       add GR_Parameter_X= 16, sp                 // Parameter 1 address
+.save b0, GR_SAVE_B0
+       mov GR_SAVE_B0= b0                         // Save b0
+}
+;;
+
+.body
+{.mib
+       stfd [ GR_Parameter_X ]= FR_X              // STORE Parameter 1 on stack
+       add GR_Parameter_RESULT= 0, GR_Parameter_Y // Parameter 3 address
+       nop.b 0
+}
+{.mib
+       stfd [ GR_Parameter_Y ]= FR_RESULT         // STORE Parameter 3 on stack
+       add GR_Parameter_Y= -16, GR_Parameter_Y
+       br.call.sptk b0= __libm_error_support#    // Call error handling function
+}
+;;
+
+{.mmi
+       add GR_Parameter_RESULT= 48, sp
+       nop.m 0
+       nop.i 0
+}
+;;
+
+{.mmi
+       ldfd f8= [ GR_Parameter_RESULT ]          // Get return result off stack
+.restore sp
+       add sp= 64, sp                            // Restore stack pointer
+       mov b0= GR_SAVE_B0                        // Restore return address
+}
+;;
+
+{.mib
+       mov gp= GR_SAVE_GP                        // Restore gp
+       mov ar.pfs= GR_SAVE_PFS                   // Restore ar.pfs
+       br.ret.sptk b0                            // Return
+}
+;;
+
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type __libm_error_support#, @function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_exp10f.S b/sysdeps/ia64/fpu/e_exp10f.S
new file mode 100644
index 0000000000..fa54e9039f
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_exp10f.S
@@ -0,0 +1,557 @@
+.file "exp10f.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/25/00 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 09/06/02 Improved performance and accuracy; no inexact flags on exact cases
+// 01/29/03 Added missing } to bundle templates
+// 12/16/04 Call error handling on underflow.
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// float exp10f(float)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x= (K + fh + fl + r)/log2(10), where
+// K is an integer, fh= 0.b1 b2 b3 b4 b5,
+// fl= 2^{-5}* 0.b6 b7 b8 b8 b10 (fh, fl >= 0),
+// and |r|<2^{-11}
+// Th is a table that stores 2^fh (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+// Tl is a table that stores 2^fl (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+//
+// 10^x is approximated as
+// 2^K * Th [ f ] * Tl [ f ] * (1+c1*r+c2*r^2)
+
+// Note there are only 10 non-zero values that produce an exact result:
+//  1.0, 2.0, ... 10.0.
+// We test for these cases and use s1 to avoid setting the inexact flag.
+
+// Special values
+//==============================================================
+// exp10(0)= 1
+// exp10(+inf)= inf
+// exp10(-inf)= 0
+//
+
+// Registers used
+//==============================================================
+// r2-r3, r14-r40
+// f6-f15, f32-f52
+// p6-p12
+//
+
+
+GR_TBL_START        = r2
+GR_LOG_TBL          = r3
+
+GR_OF_LIMIT         = r14
+GR_UF_LIMIT         = r15
+GR_EXP_CORR         = r16
+GR_F_low            = r17
+GR_F_high           = r18
+GR_K                = r19
+GR_Flow_ADDR        = r20
+
+GR_BIAS             = r21
+GR_Fh               = r22
+GR_Fh_ADDR          = r23
+GR_EXPMAX           = r24
+
+GR_ROUNDVAL         = r26
+GR_SNORM_LIMIT      = r26
+GR_MASK             = r27
+GR_KF0              = r28
+GR_MASK_low         = r29
+GR_COEFF_START      = r30
+GR_exact_limit      = r31
+
+GR_SAVE_B0          = r33
+GR_SAVE_PFS         = r34
+GR_SAVE_GP          = r35
+GR_SAVE_SP          = r36
+
+GR_Parameter_X      = r37
+GR_Parameter_Y      = r38
+GR_Parameter_RESULT = r39
+GR_Parameter_TAG    = r40
+
+
+FR_X                = f10
+FR_Y                = f1
+FR_RESULT           = f8
+
+
+FR_COEFF1           = f6
+FR_COEFF2           = f7
+FR_R                = f9
+FR_LOG2_10          = f10
+
+FR_2P53             = f11
+FR_KF0              = f12
+FR_COEFF3           = f13
+FR_COEFF4           = f14
+FR_UF_LIMIT         = f15
+
+FR_OF_LIMIT         = f32
+FR_DX_L210          = f33
+FR_ROUNDVAL         = f34
+FR_KF               = f35
+
+FR_2_TO_K           = f36
+FR_T_low            = f37
+FR_T_high           = f38
+
+FR_P12              = f41
+FR_T_low_K          = f42
+FR_T                = f44
+FR_P                = f45
+
+FR_E                = f49
+FR_exact_limit      = f50
+
+FR_int_x            = f51
+FR_SNORM_LIMIT      = f52
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+data8 0xd49a784bcd1b8afe, 0x00003fcb // log2(10)*2^(10-63)
+data8 0xb17217f7d1cf79ab, 0x00004033 // C_1 * 2^53
+data8 0xf5fdeffc162c7541, 0x00004066 // C_2 * 2^106
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+// 2^{0.00000 b6 b7 b8 b9 b10}
+data8 0x8000000000000000, 0x8016302f17467628
+data8 0x802c6436d0e04f50, 0x80429c17d77c18ed
+data8 0x8058d7d2d5e5f6b0, 0x806f17687707a7af
+data8 0x80855ad965e88b83, 0x809ba2264dada76a
+data8 0x80b1ed4fd999ab6c, 0x80c83c56b50cf77f
+data8 0x80de8f3b8b85a0af, 0x80f4e5ff089f763e
+data8 0x810b40a1d81406d4, 0x81219f24a5baa59d
+data8 0x813801881d886f7b, 0x814e67cceb90502c
+data8 0x8164d1f3bc030773, 0x817b3ffd3b2f2e47
+data8 0x8191b1ea15813bfd, 0x81a827baf7838b78
+data8 0x81bea1708dde6055, 0x81d51f0b8557ec1c
+data8 0x81eba08c8ad4536f, 0x820225f44b55b33b
+data8 0x8218af4373fc25eb, 0x822f3c7ab205c89a
+data8 0x8245cd9ab2cec048, 0x825c62a423d13f0c
+data8 0x8272fb97b2a5894c, 0x828998760d01faf3
+data8 0x82a0393fe0bb0ca8, 0x82b6ddf5dbc35906
+//
+// 2^{0.b1 b2 b3 b4 b5}
+data8 0x8000000000000000, 0x82cd8698ac2ba1d7
+data8 0x85aac367cc487b14, 0x88980e8092da8527
+data8 0x8b95c1e3ea8bd6e6, 0x8ea4398b45cd53c0
+data8 0x91c3d373ab11c336, 0x94f4efa8fef70961
+data8 0x9837f0518db8a96f, 0x9b8d39b9d54e5538
+data8 0x9ef5326091a111ad, 0xa27043030c496818
+data8 0xa5fed6a9b15138ea, 0xa9a15ab4ea7c0ef8
+data8 0xad583eea42a14ac6, 0xb123f581d2ac258f
+data8 0xb504f333f9de6484, 0xb8fbaf4762fb9ee9
+data8 0xbd08a39f580c36be, 0xc12c4cca66709456
+data8 0xc5672a115506dadd, 0xc9b9bd866e2f27a2
+data8 0xce248c151f8480e3, 0xd2a81d91f12ae45a
+data8 0xd744fccad69d6af4, 0xdbfbb797daf23755
+data8 0xe0ccdeec2a94e111, 0xe5b906e77c8348a8
+data8 0xeac0c6e7dd24392e, 0xefe4b99bdcdaf5cb
+data8 0xf5257d152486cc2c, 0xfa83b2db722a033a
+LOCAL_OBJECT_END(T_table)
+
+
+
+.section .text
+GLOBAL_IEEE754_ENTRY(exp10f)
+
+
+{.mfi
+       alloc r32= ar.pfs, 1, 4, 4, 0
+       // will continue only for non-zero normal/denormal numbers
+       fclass.nm.unc p12, p7= f8, 0x1b
+       nop.i 0
+}
+{.mlx
+       // GR_TBL_START= pointer to log2(10), C_1...C_4 followed by T_table
+       addl GR_TBL_START= @ltoff(poly_coeffs), gp
+       movl GR_ROUNDVAL= 0x3fc00000             // 1.5 (SP)
+}
+;;
+
+{.mfi
+       ld8 GR_COEFF_START= [ GR_TBL_START ]     // Load pointer to coeff table
+       fcmp.lt.s1 p6, p8= f8, f0                // X<0 ?
+       nop.i 0
+}
+;;
+
+{.mlx
+       nop.m 0
+       movl GR_UF_LIMIT= 0xc2349e35             // (-2^7-22) / log2(10)
+}
+{.mlx
+       setf.s FR_ROUNDVAL= GR_ROUNDVAL
+       movl GR_OF_LIMIT= 0x421a209a             // Overflow threshold
+}
+;;
+
+{.mlx
+       ldfe FR_LOG2_10= [ GR_COEFF_START ], 16  // load log2(10)*2^(10-63)
+       movl GR_SNORM_LIMIT= 0xc217b818          // Smallest normal threshold
+}
+{.mib
+       nop.m 0
+       nop.i 0
+ (p12) br.cond.spnt SPECIAL_exp10               // Branch if nan, inf, zero
+}
+;;
+
+{.mfi
+       setf.s FR_OF_LIMIT= GR_OF_LIMIT           // Set overflow limit
+       fma.s0 f8= f8, f1, f0                     // normalize x
+       nop.i 0
+}
+;;
+
+{.mfi
+       setf.s FR_SNORM_LIMIT= GR_SNORM_LIMIT      // Set smallest normal limit
+ (p8)  fcvt.fx.s1 FR_int_x = f8                   // Convert x to integer
+       nop.i 0
+}
+{.mfi
+       setf.s FR_UF_LIMIT= GR_UF_LIMIT            // Set underflow limit
+       fma.s1 FR_KF0= f8, FR_LOG2_10, FR_ROUNDVAL // y= (x*log2(10)*2^10 +
+                                                  //    1.5*2^63) * 2^(-63)
+       mov GR_EXP_CORR= 0xffff-126
+}
+;;
+
+{.mfi
+       ldfe FR_COEFF1= [ GR_COEFF_START ], 16    // load C_1
+       fms.s1 FR_KF= FR_KF0, f1, FR_ROUNDVAL     // (K+f)*2^(10-63)
+       mov GR_MASK= 1023
+}
+;;
+
+{.mfi
+       ldfe FR_COEFF2= [ GR_COEFF_START ], 16    // load C_2
+       nop.f 0
+       mov GR_MASK_low= 31
+}
+;;
+
+{.mlx
+       getf.sig GR_KF0= FR_KF0                   // (K+f)*2^10= round_to_int(y)
+ (p8)  movl GR_exact_limit= 0x41200000           // Largest x for exact result,
+                                                 //  +10.0
+}
+;;
+
+{.mfi
+       add GR_LOG_TBL= 256, GR_COEFF_START       // Pointer to high T_table
+       fcmp.gt.s1 p12, p7= f8, FR_OF_LIMIT       // x>overflow threshold ?
+       nop.i 0
+}
+;;
+
+{.mfi
+ (p8)  setf.s FR_exact_limit = GR_exact_limit    // Largest x for exact result
+ (p8)  fcvt.xf FR_int_x = FR_int_x               // Integral part of x
+       shr GR_K= GR_KF0, 10                      // K
+}
+{.mfi
+       and GR_F_high= GR_MASK, GR_KF0            // f_high*32
+       fms.s1 FR_R= f8, FR_LOG2_10, FR_KF        // r*2^(-53)= [ x*log2(10)-
+                                                 //           (K+f) ] *2^{10-63}
+       and GR_F_low= GR_KF0, GR_MASK_low         // f_low
+}
+;;
+
+{.mmi
+       shladd GR_Flow_ADDR= GR_F_low, 3, GR_COEFF_START // address of 2^{f_low}
+       add GR_BIAS= GR_K, GR_EXP_CORR            // K= bias-2*63
+       shr GR_Fh= GR_F_high, 5                   // f_high
+}
+;;
+
+{.mfi
+       setf.exp FR_2_TO_K= GR_BIAS               // 2^{K-126}
+ (p7)  fcmp.lt.s1 p12, p7= f8, FR_UF_LIMIT       // x<underflow threshold ?
+       shladd GR_Fh_ADDR= GR_Fh, 3, GR_LOG_TBL   // address of 2^{f_high}
+}
+{.mfi
+       ldf8 FR_T_low= [ GR_Flow_ADDR ]           // load T_low= 2^{f_low}
+       nop.f 0
+       nop.i 0
+}
+;;
+
+{.mfb
+       ldf8 FR_T_high= [ GR_Fh_ADDR ]            // load T_high= 2^{f_high}
+       fcmp.ge.s1 p11, p0= f8, FR_SNORM_LIMIT    // Test x for normal range
+ (p12) br.cond.spnt OUT_RANGE_exp10
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_P12= FR_COEFF2, FR_R, FR_COEFF1 // P12= C_1+C_2*r
+       cmp.eq p7,p9= r0,r0                       // Assume inexact result
+}
+;;
+
+{.mfi
+       nop.m 0
+ (p8)  fcmp.eq.s1 p9,p7= FR_int_x, f8            // Test x positive integer
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       fma.s1 FR_T_low_K= FR_T_low, FR_2_TO_K, f0 // T= 2^{K-126}*T_low
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_P= FR_P12, FR_R, f0              // P= P12*r
+       nop.i 0
+}
+;;
+
+// If x a positive integer, will it produce an exact result?
+//   p7 result will be inexact
+//   p9 result will be exact
+{.mfi
+       nop.m 0
+ (p9)  fcmp.le.s1 p9,p7= f8, FR_exact_limit       // Test x gives exact result
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       fma.s1 FR_T= FR_T_low_K, FR_T_high, f0     // T= T*T_high
+       nop.i 0
+}
+;;
+
+.pred.rel "mutex",p7,p9
+{.mfi
+       nop.m 0
+ (p7)  fma.s.s0 f8= FR_P, FR_T, FR_T              // result= T+T*P, inexact set
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+ (p9)  fma.s.s1 f8= FR_P, FR_T, FR_T              // result= T+T*P, exact use s1
+ (p11) br.ret.sptk b0                             // return, if result normal
+}
+;;
+
+// Here if result in denormal range (and not zero)
+{.mib
+       nop.m 0
+       mov GR_Parameter_TAG= 266
+       br.cond.sptk __libm_error_region           // Branch to error handling
+}
+;;
+
+SPECIAL_exp10:
+{.mfi
+       nop.m 0
+       fclass.m p6, p0= f8, 0x22                  // x= -Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p7, p0= f8, 0x21                  // x= +Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p8, p0= f8, 0x7                   // x= +/-Zero ?
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+ (p6)  mov f8= f0                                 // exp10(-Infinity)= 0
+ (p6)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       nop.f 0
+ (p7)  br.ret.spnt b0                             // exp10(+Infinity)= +Infinity
+}
+;;
+
+{.mfb
+       nop.m 0
+ (p8)  mov f8= f1                                 // exp10(+/-0)= 1
+ (p8)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.s.s0 f8= f8, f1, f0                    // Remaining cases: NaNs
+       br.ret.sptk b0
+}
+;;
+
+
+OUT_RANGE_exp10:
+
+// underflow: p6= 1
+// overflow: p8= 1
+
+.pred.rel "mutex",p6,p8
+{.mmi
+ (p8)  mov GR_EXPMAX= 0x1fffe
+ (p6)  mov GR_EXPMAX= 1
+       nop.i 0
+}
+;;
+
+{.mii
+       setf.exp FR_R= GR_EXPMAX
+ (p8)  mov GR_Parameter_TAG= 167
+ (p6)  mov GR_Parameter_TAG= 266
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.s.s0 f8= FR_R, FR_R, f0                // Create overflow/underflow
+       br.cond.sptk __libm_error_region           // Branch to error handling
+}
+;;
+
+GLOBAL_IEEE754_END(exp10f)
+weak_alias (exp10f, pow10f)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+.prologue
+{.mfi
+       add GR_Parameter_Y= -32, sp                // Parameter 2 value
+       nop.f 0
+.save ar.pfs, GR_SAVE_PFS
+       mov GR_SAVE_PFS= ar.pfs                    // Save ar.pfs
+}
+
+{.mfi
+.fframe 64
+       add sp= -64, sp                            // Create new stack
+       nop.f 0
+       mov GR_SAVE_GP= gp                         // Save gp
+}
+;;
+
+{.mmi
+       stfs [ GR_Parameter_Y ]= FR_Y, 16          // STORE Parameter 2 on stack
+       add GR_Parameter_X= 16, sp                 // Parameter 1 address
+.save b0, GR_SAVE_B0
+       mov GR_SAVE_B0= b0                         // Save b0
+}
+;;
+
+.body
+{.mib
+       stfs [ GR_Parameter_X ]= FR_X              // STORE Parameter 1 on stack
+       add GR_Parameter_RESULT= 0, GR_Parameter_Y // Parameter 3 address
+       nop.b 0
+}
+{.mib
+       stfs [ GR_Parameter_Y ]= FR_RESULT         // STORE Parameter 3 on stack
+       add GR_Parameter_Y= -16, GR_Parameter_Y
+       br.call.sptk b0= __libm_error_support#    // Call error handling function
+}
+;;
+
+{.mmi
+       add GR_Parameter_RESULT= 48, sp
+       nop.m 0
+       nop.i 0
+}
+;;
+
+{.mmi
+       ldfs f8= [ GR_Parameter_RESULT ]          // Get return result off stack
+.restore sp
+       add sp= 64, sp                            // Restore stack pointer
+       mov b0= GR_SAVE_B0                        // Restore return address
+}
+;;
+
+{.mib
+       mov gp= GR_SAVE_GP                        // Restore gp
+       mov ar.pfs= GR_SAVE_PFS                   // Restore ar.pfs
+       br.ret.sptk b0                            // Return
+}
+;;
+
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type __libm_error_support#, @function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_exp10l.S b/sysdeps/ia64/fpu/e_exp10l.S
new file mode 100644
index 0000000000..a2e84b377c
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_exp10l.S
@@ -0,0 +1,811 @@
+.file "exp10l.s"
+
+
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/25/00 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 05/08/03 Reformatted assembly source; corrected overflow result for round to
+//          -inf and round to zero; exact results now don't set inexact flag
+// 12/16/04 Call error handling on underflow.
+//
+// API
+//==============================================================
+// long double exp10l(long double)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x= (K + f + r)/log2(10), where
+// K is an integer, f= 0.b1 b2... b8 (f>= 0),
+// and |r|<2^{-9}
+// T is a table that stores 2^f (256 entries) rounded to
+// double extended precision (only mantissa is stored)
+// D stores (2^f/T [ f ] - 1), rounded to single precision
+//
+// 10^x is approximated as
+// 2^K * T [ f ] * ((1+c1*r+c2*r^2+...+c6*r^6)*(1+c1*e)+D [ f ] ),
+// where e= log2(10)_lo*x+(log2(10)_hi*x-RN(log2(10)_hi*x))
+//
+
+
+
+// Special values
+//==============================================================
+// exp10(0)= 1
+// exp10(+inf)= inf
+// exp10(-inf)= 0
+//
+
+
+// Registers used
+//==============================================================
+// f6-f15, f32-f63
+// r14-r30, r32-r40
+// p6-p8, p11-p14
+//
+
+
+       FR_X        = f10
+       FR_Y        = f1
+       FR_RESULT   = f8
+
+       FR_COEFF1   = f6
+       FR_COEFF2   = f7
+       FR_KF0      = f9
+       FR_LOG10    = f10
+       FR_CONST1   = f11
+       FR_XL10     = f12
+       FR_COEFF3   = f13
+       FR_COEFF4   = f14
+       FR_UF_TEST  = f15
+       FR_OF_TEST  = f32
+       FR_L10_LOW  = f33
+       FR_COEFF5   = f34
+       FR_COEFF6   = f35
+       FR_L10      = f36
+       FR_C_L10    = f37
+       FR_XL10_H   = f38
+       FR_XL10_L   = f39
+       FR_KF       = f40
+       FR_E        = f41
+       FR_T        = f42
+       FR_D        = f43
+       FR_EXP_M_63 = f44
+       FR_R        = f45
+       FR_E1       = f46
+       FR_COEFF2   = f47
+       FR_P34      = f48
+       FR_P56      = f49
+       FR_R2       = f50
+       FR_RE       = f51
+       FR_D1       = f52
+       FR_P36      = f53
+       FR_R3E      = f54
+       FR_P1       = f55
+       FR_P        = f56
+       FR_T1       = f57
+       FR_XINT     = f58
+       FR_XINTF    = f59
+       FR_4        = f60
+       FR_28       = f61
+       FR_32       = f62
+       FR_SNORM_LIMIT = f63
+
+
+       GR_ADDR0    = r14
+       GR_D_ADDR   = r15
+       GR_ADDR     = r16
+       GR_B63      = r17
+       GR_KBITS    = r18
+       GR_F        = r19
+       GR_K        = r20
+       GR_D        = r21
+       GR_BM63     = r22
+       GR_T        = r23
+       GR_CONST1   = r24
+       GR_EMIN     = r25
+       GR_CONST2   = r26
+       GR_BM8      = r27
+       GR_SREG     = r28
+       GR_4_BIAS   = r29
+       GR_32_BIAS  = r30
+
+       GR_SAVE_B0  = r33
+       GR_SAVE_PFS = r34
+       GR_SAVE_GP  = r35
+       GR_SAVE_SP  = r36
+
+       GR_Parameter_X     = r37
+       GR_Parameter_Y     = r38
+       GR_Parameter_RESULT= r39
+       GR_Parameter_TAG   = r40
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+       data8 0xd49a784bcd1b8afe, 0x00004008 // log2(10)*2^8
+       data8 0x9a209a84fbcff798, 0x0000400b // overflow threshold
+       data8 0xb17217f7d1cf79ab, 0x00003ffe // C_1
+       data8 0xf5fdeffc162c7541, 0x00003ffc // C_2
+       data8 0x3fac6b08d704a0c0 // C_3
+       data8 0x3f83b2ab6fba4e77 // C_4
+       data8 0x3f55d87fe78a6731 // C_5
+       data8 0x3f2430912f86c787 // C_6
+       data8 0x9257edfe9b5fb698, 0x00003fbf // log2(10)_low (bits 64...127)
+       data8 0x9a1bc98027a81918, 0x0000c00b // Smallest normal threshold
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+       // 2^{0.b1 b2 b3 b4 b5 b6 b7 b8}
+       data8 0x8000000000000000, 0x8058d7d2d5e5f6b1
+       data8 0x80b1ed4fd999ab6c, 0x810b40a1d81406d4
+       data8 0x8164d1f3bc030773, 0x81bea1708dde6056
+       data8 0x8218af4373fc25ec, 0x8272fb97b2a5894c
+       data8 0x82cd8698ac2ba1d7, 0x83285071e0fc4547
+       data8 0x8383594eefb6ee37, 0x83dea15b9541b132
+       data8 0x843a28c3acde4046, 0x8495efb3303efd30
+       data8 0x84f1f656379c1a29, 0x854e3cd8f9c8c95d
+       data8 0x85aac367cc487b15, 0x86078a2f23642a9f
+       data8 0x8664915b923fba04, 0x86c1d919caef5c88
+       data8 0x871f61969e8d1010, 0x877d2afefd4e256c
+       data8 0x87db357ff698d792, 0x88398146b919f1d4
+       data8 0x88980e8092da8527, 0x88f6dd5af155ac6b
+       data8 0x8955ee03618e5fdd, 0x89b540a7902557a4
+       data8 0x8a14d575496efd9a, 0x8a74ac9a79896e47
+       data8 0x8ad4c6452c728924, 0x8b3522a38e1e1032
+       data8 0x8b95c1e3ea8bd6e7, 0x8bf6a434adde0085
+       data8 0x8c57c9c4646f4dde, 0x8cb932c1bae97a95
+       data8 0x8d1adf5b7e5ba9e6, 0x8d7ccfc09c50e2f8
+       data8 0x8ddf042022e69cd6, 0x8e417ca940e35a01
+       data8 0x8ea4398b45cd53c0, 0x8f073af5a2013520
+       data8 0x8f6a8117e6c8e5c4, 0x8fce0c21c6726481
+       data8 0x9031dc431466b1dc, 0x9095f1abc540ca6b
+       data8 0x90fa4c8beee4b12b, 0x915eed13c89689d3
+       data8 0x91c3d373ab11c336, 0x9228ffdc10a051ad
+       data8 0x928e727d9531f9ac, 0x92f42b88f673aa7c
+       data8 0x935a2b2f13e6e92c, 0x93c071a0eef94bc1
+       data8 0x9426ff0fab1c04b6, 0x948dd3ac8ddb7ed3
+       data8 0x94f4efa8fef70961, 0x955c5336887894d5
+       data8 0x95c3fe86d6cc7fef, 0x962bf1cbb8d97560
+       data8 0x96942d3720185a00, 0x96fcb0fb20ac4ba3
+       data8 0x97657d49f17ab08e, 0x97ce9255ec4357ab
+       data8 0x9837f0518db8a96f, 0x98a1976f7597e996
+       data8 0x990b87e266c189aa, 0x9975c1dd47518c77
+       data8 0x99e0459320b7fa65, 0x9a4b13371fd166ca
+       data8 0x9ab62afc94ff864a, 0x9b218d16f441d63d
+       data8 0x9b8d39b9d54e5539, 0x9bf93118f3aa4cc1
+       data8 0x9c6573682ec32c2d, 0x9cd200db8a0774cb
+       data8 0x9d3ed9a72cffb751, 0x9dabfdff6367a2aa
+       data8 0x9e196e189d472420, 0x9e872a276f0b98ff
+       data8 0x9ef5326091a111ae, 0x9f6386f8e28ba651
+       data8 0x9fd228256400dd06, 0xa041161b3d0121be
+       data8 0xa0b0510fb9714fc2, 0xa11fd9384a344cf7
+       data8 0xa18faeca8544b6e4, 0xa1ffd1fc25cea188
+       data8 0xa27043030c496819, 0xa2e102153e918f9e
+       data8 0xa3520f68e802bb93, 0xa3c36b345991b47c
+       data8 0xa43515ae09e6809e, 0xa4a70f0c95768ec5
+       data8 0xa5195786be9ef339, 0xa58bef536dbeb6ee
+       data8 0xa5fed6a9b15138ea, 0xa6720dc0be08a20c
+       data8 0xa6e594cfeee86b1e, 0xa7596c0ec55ff55b
+       data8 0xa7cd93b4e965356a, 0xa8420bfa298f70d1
+       data8 0xa8b6d5167b320e09, 0xa92bef41fa77771b
+       data8 0xa9a15ab4ea7c0ef8, 0xaa1717a7b5693979
+       data8 0xaa8d2652ec907629, 0xab0386ef48868de1
+       data8 0xab7a39b5a93ed337, 0xabf13edf162675e9
+       data8 0xac6896a4be3fe929, 0xace0413ff83e5d04
+       data8 0xad583eea42a14ac6, 0xadd08fdd43d01491
+       data8 0xae493452ca35b80e, 0xaec22c84cc5c9465
+       data8 0xaf3b78ad690a4375, 0xafb51906e75b8661
+       data8 0xb02f0dcbb6e04584, 0xb0a957366fb7a3c9
+       data8 0xb123f581d2ac2590, 0xb19ee8e8c94feb09
+       data8 0xb21a31a66618fe3b, 0xb295cff5e47db4a4
+       data8 0xb311c412a9112489, 0xb38e0e38419fae18
+       data8 0xb40aaea2654b9841, 0xb487a58cf4a9c180
+       data8 0xb504f333f9de6484, 0xb58297d3a8b9f0d2
+       data8 0xb60093a85ed5f76c, 0xb67ee6eea3b22b8f
+       data8 0xb6fd91e328d17791, 0xb77c94c2c9d725e9
+       data8 0xb7fbefca8ca41e7c, 0xb87ba337a1743834
+       data8 0xb8fbaf4762fb9ee9, 0xb97c143756844dbf
+       data8 0xb9fcd2452c0b9deb, 0xba7de9aebe5fea09
+       data8 0xbaff5ab2133e45fb, 0xbb81258d5b704b6f
+       data8 0xbc034a7ef2e9fb0d, 0xbc85c9c560e7b269
+       data8 0xbd08a39f580c36bf, 0xbd8bd84bb67ed483
+       data8 0xbe0f6809860993e2, 0xbe935317fc378238
+       data8 0xbf1799b67a731083, 0xbf9c3c248e2486f8
+       data8 0xc0213aa1f0d08db0, 0xc0a6956e8836ca8d
+       data8 0xc12c4cca66709456, 0xc1b260f5ca0fbb33
+       data8 0xc238d2311e3d6673, 0xc2bfa0bcfad907c9
+       data8 0xc346ccda24976407, 0xc3ce56c98d21b15d
+       data8 0xc4563ecc5334cb33, 0xc4de8523c2c07baa
+       data8 0xc5672a115506dadd, 0xc5f02dd6b0bbc3d9
+       data8 0xc67990b5aa245f79, 0xc70352f04336c51e
+       data8 0xc78d74c8abb9b15d, 0xc817f681416452b2
+       data8 0xc8a2d85c8ffe2c45, 0xc92e1a9d517f0ecc
+       data8 0xc9b9bd866e2f27a3, 0xca45c15afcc72624
+       data8 0xcad2265e4290774e, 0xcb5eecd3b38597c9
+       data8 0xcbec14fef2727c5d, 0xcc799f23d11510e5
+       data8 0xcd078b86503dcdd2, 0xcd95da6a9ff06445
+       data8 0xce248c151f8480e4, 0xceb3a0ca5dc6a55d
+       data8 0xcf4318cf191918c1, 0xcfd2f4683f94eeb5
+       data8 0xd06333daef2b2595, 0xd0f3d76c75c5db8d
+       data8 0xd184df6251699ac6, 0xd2164c023056bcab
+       data8 0xd2a81d91f12ae45a, 0xd33a5457a3029054
+       data8 0xd3ccf099859ac379, 0xd45ff29e0972c561
+       data8 0xd4f35aabcfedfa1f, 0xd5872909ab75d18a
+       data8 0xd61b5dfe9f9bce07, 0xd6aff9d1e13ba2fe
+       data8 0xd744fccad69d6af4, 0xd7da67311797f56a
+       data8 0xd870394c6db32c84, 0xd9067364d44a929c
+       data8 0xd99d15c278afd7b6, 0xda3420adba4d8704
+       data8 0xdacb946f2ac9cc72, 0xdb63714f8e295255
+       data8 0xdbfbb797daf23755, 0xdc9467913a4f1c92
+       data8 0xdd2d818508324c20, 0xddc705bcd378f7f0
+       data8 0xde60f4825e0e9124, 0xdefb4e1f9d1037f2
+       data8 0xdf9612deb8f04420, 0xe031430a0d99e627
+       data8 0xe0ccdeec2a94e111, 0xe168e6cfd3295d23
+       data8 0xe2055afffe83d369, 0xe2a23bc7d7d91226
+       data8 0xe33f8972be8a5a51, 0xe3dd444c46499619
+       data8 0xe47b6ca0373da88d, 0xe51a02ba8e26d681
+       data8 0xe5b906e77c8348a8, 0xe658797368b3a717
+       data8 0xe6f85aaaee1fce22, 0xe798aadadd5b9cbf
+       data8 0xe8396a503c4bdc68, 0xe8da9958464b42ab
+       data8 0xe97c38406c4f8c57, 0xea1e4756550eb27b
+       data8 0xeac0c6e7dd24392f, 0xeb63b74317369840
+       data8 0xec0718b64c1cbddc, 0xecaaeb8ffb03ab41
+       data8 0xed4f301ed9942b84, 0xedf3e6b1d418a491
+       data8 0xee990f980da3025b, 0xef3eab20e032bc6b
+       data8 0xefe4b99bdcdaf5cb, 0xf08b3b58cbe8b76a
+       data8 0xf13230a7ad094509, 0xf1d999d8b7708cc1
+       data8 0xf281773c59ffb13a, 0xf329c9233b6bae9c
+       data8 0xf3d28fde3a641a5b, 0xf47bcbbe6db9fddf
+       data8 0xf5257d152486cc2c, 0xf5cfa433e6537290
+       data8 0xf67a416c733f846e, 0xf7255510c4288239
+       data8 0xf7d0df730ad13bb9, 0xf87ce0e5b2094d9c
+       data8 0xf92959bb5dd4ba74, 0xf9d64a46eb939f35
+       data8 0xfa83b2db722a033a, 0xfb3193cc4227c3f4
+       data8 0xfbdfed6ce5f09c49, 0xfc8ec01121e447bb
+       data8 0xfd3e0c0cf486c175, 0xfdedd1b496a89f35
+       data8 0xfe9e115c7b8f884c, 0xff4ecb59511ec8a5
+LOCAL_OBJECT_END(T_table)
+
+
+LOCAL_OBJECT_START(D_table)
+       data4 0x00000000, 0x9f55c08f, 0x1e93ffa3, 0x1dcd43a8
+       data4 0x1f751f79, 0x9f3cdd88, 0x9f43d155, 0x1eda222c
+       data4 0x1ef35513, 0x9f597895, 0x9e698881, 0x1ec71073
+       data4 0x1e50e371, 0x9dc01e19, 0x1de74133, 0x1e2f028c
+       data4 0x9edefb47, 0x1ebbac48, 0x9e8b0330, 0x9e9e9314
+       data4 0x1edc1d11, 0x1f098529, 0x9f52827c, 0x1f50050d
+       data4 0x1f301e8e, 0x1f5b64d1, 0x9f45e3ee, 0x9ef64d6d
+       data4 0x1d6ec5e8, 0x9e61ad9a, 0x1d44ccbb, 0x9e4a8bbb
+       data4 0x9cf11576, 0x9dcce7e7, 0x9d02ac90, 0x1f26ccf0
+       data4 0x9f0877c6, 0x9ddd62ae, 0x9f4b7fc3, 0x1ea8ef6b
+       data4 0x1ea4378d, 0x1ef6fc38, 0x1db99fd9, 0x1f22bf6f
+       data4 0x1f53e172, 0x1e85504a, 0x9f37cc75, 0x1f0c5e17
+       data4 0x1dde8aac, 0x9cb42bb2, 0x1e153cd7, 0x1eb62bba
+       data4 0x9e9b941b, 0x9ea80e3c, 0x1f508823, 0x1ec3fd36
+       data4 0x1e9ffaa1, 0x1e21e2eb, 0x9d948b1d, 0x9e8ac93a
+       data4 0x1ef7ee6f, 0x9e80dda3, 0x1f0814be, 0x1dc5ddfe
+       data4 0x1eedb9d1, 0x9f2aaa26, 0x9ea5b0fc, 0x1edf702e
+       data4 0x9e391201, 0x1f1316bb, 0x1ea27fb7, 0x9e05ed18
+       data4 0x9f199ed2, 0x1ee7fd7c, 0x1f003db6, 0x9eac3793
+       data4 0x9e5b8c10, 0x9f3af17c, 0x1bc9a8be, 0x1ee3c004
+       data4 0x9f19b1b2, 0x9f242ce9, 0x9ce67dd1, 0x9e4f6275
+       data4 0x1e20742c, 0x1eb9328a, 0x9f477153, 0x1d969718
+       data4 0x9f1e6c43, 0x1f2f67f4, 0x9f39c7e4, 0x9e3c4feb
+       data4 0x1da3956b, 0x9e7c685d, 0x1f280911, 0x9f0d8afb
+       data4 0x1e314b40, 0x9eb4f250, 0x9f1a34ad, 0x1ef5d5e7
+       data4 0x9f145496, 0x1e604827, 0x9f1e5195, 0x1e9c1fc0
+       data4 0x1efde521, 0x1e69b385, 0x1f316830, 0x9f244eae
+       data4 0x1f1787ec, 0x9e939971, 0x1f0bb393, 0x9f0511d6
+       data4 0x1ed919de, 0x1d8b7b28, 0x1e5ca4a9, 0x1e7c357b
+       data4 0x9e3ff8e8, 0x1eef53b5, 0x9ed22ed7, 0x1f16659b
+       data4 0x9f2db102, 0x9e2c6a78, 0x1f328d7d, 0x9f2fec3c
+       data4 0x1eb395bd, 0x9f242b84, 0x9e2683e6, 0x1ed71e68
+       data4 0x1efd1df5, 0x9e9eeafd, 0x9ed2249c, 0x1eef129a
+       data4 0x1d1ea44c, 0x9e81f7ff, 0x1eaf77c9, 0x9ee7a285
+       data4 0x1e1864ed, 0x9ee7edbb, 0x9e15a27d, 0x9ae61655
+       data4 0x1f1ff1a2, 0x1da29755, 0x9e5f46fb, 0x1e901236
+       data4 0x9eecfb9b, 0x9f204d2f, 0x1ec64685, 0x9eb809bd
+       data4 0x9e0026c5, 0x1d9f1da1, 0x1f142b49, 0x9f20f22e
+       data4 0x1f24b067, 0x1f185a4c, 0x9f09765c, 0x9ece902f
+       data4 0x1e2ca5db, 0x1e6de464, 0x9f071f67, 0x1f1518c3
+       data4 0x1ea13ded, 0x1f0b8414, 0x1edb6ad4, 0x9e548740
+       data4 0x9ea10efb, 0x1ee48a60, 0x1e7954c5, 0x9edad013
+       data4 0x9f21517d, 0x9e9b6e0c, 0x9ee7f9a6, 0x9ebd4298
+       data4 0x9d65b24e, 0x1eed751f, 0x9f1573ea, 0x9d430377
+       data4 0x9e13fc0c, 0x1e47008a, 0x1e3d5c1d, 0x1ef41a91
+       data4 0x9e4a4ef7, 0x9e952f18, 0x1d620566, 0x1d9b8d33
+       data4 0x1db06247, 0x1e94b31e, 0x1f0730ad, 0x9d79ffb4
+       data4 0x1ed64d51, 0x9e91fd11, 0x9e28d35a, 0x9dea0ed9
+       data4 0x1e891def, 0x9ee28ac0, 0x1e1db99b, 0x9ee1ce38
+       data4 0x9bdd9bca, 0x1eb72cb9, 0x9e8c53c6, 0x1e0df6ca
+       data4 0x1e8f2ccd, 0x9e9b0886, 0x1eeb3bc7, 0x1ec7e772
+       data4 0x9e210776, 0x9daf246c, 0x1ea1f151, 0x1ece4dc6
+       data4 0x1ce741c8, 0x1ed3c88f, 0x9ec9a4fd, 0x9e0c8d30
+       data4 0x1d2fbb26, 0x9ef212a7, 0x1ee44f1c, 0x9e445550
+       data4 0x1e075f77, 0x9d9291a3, 0x1f09c2ee, 0x9e012c88
+       data4 0x1f057d62, 0x9e7bb0dc, 0x9d8758ee, 0x1ee8d6c1
+       data4 0x9e509a57, 0x9e4ca7b7, 0x1e2cb341, 0x9ec35106
+       data4 0x1ecf3baf, 0x1e11781c, 0x1ea0cc78, 0x1eb75ca6
+       data4 0x1e961e1a, 0x1eb88853, 0x1e7abf50, 0x1ee38704
+       data4 0x9dc5ab0f, 0x1afe197b, 0x9ec07523, 0x9d9b7f78
+       data4 0x1f011618, 0x1ed43b0b, 0x9f035945, 0x9e3fd014
+       data4 0x9bbda5cd, 0x9e83f8ab, 0x1e58a928, 0x1e392d61
+       data4 0x1efdbb52, 0x1ee310a8, 0x9ec7ecc1, 0x1e8c9ed6
+       data4 0x9ef82dee, 0x9e70545b, 0x9ea53fc4, 0x1e40f419
+LOCAL_OBJECT_END(D_table)
+
+
+
+.section .text
+GLOBAL_IEEE754_ENTRY(exp10l)
+
+{.mfi
+       alloc GR_SREG = ar.pfs, 1, 4, 4, 0
+       // will continue only for normal/denormal numbers
+       fclass.nm.unc p12, p7 = f8, 0x1b
+       // GR_ADDR0 = pointer to log2(10), C_1...C_6 followed by T_table
+       addl GR_ADDR0 = @ltoff(poly_coeffs), gp ;;
+}
+
+{.mfi
+       // load start address for C_1...C_6 followed by T_table
+       ld8 GR_ADDR0 = [ GR_ADDR0 ]
+       // X<0 ?
+       fcmp.lt.s1 p6, p8 = f8, f0
+       // GR_BM8 = bias-8
+       mov GR_BM8 = 0xffff-8
+}
+{.mlx
+       nop.m 0
+       // GR_EMIN = (-2^14-62)*2^{8}
+       movl GR_EMIN = 0xca807c00 ;;
+}
+
+{.mmb
+       // FR_CONST1 = 2^{-8}
+       setf.exp FR_CONST1 = GR_BM8
+       // load log2(10)*2^8
+       ldfe FR_LOG10 = [ GR_ADDR0 ], 16
+ (p12) br.cond.spnt SPECIAL_EXP10 ;;
+}
+
+{.mmf
+       setf.s FR_UF_TEST = GR_EMIN
+       // load overflow threshold
+       ldfe FR_OF_TEST = [ GR_ADDR0 ], 16
+       // normalize x
+       fma.s0 f8 = f8, f1, f0 ;;
+}
+
+{.mmi
+       // load C_1
+       ldfe FR_COEFF1 = [ GR_ADDR0 ], 16 ;;
+       // load C_2
+       ldfe FR_COEFF2 = [ GR_ADDR0 ], 16
+       nop.i 0 ;;
+}
+
+{.mmf
+       // GR_D_ADDR = pointer to D table
+       add GR_D_ADDR = 2048-64+96+32, GR_ADDR0
+       // load C_3, C_4
+       ldfpd FR_COEFF3, FR_COEFF4 = [ GR_ADDR0 ], 16
+       // y = x*log2(10)*2^8
+       fma.s1 FR_XL10 = f8, FR_LOG10, f0 ;;
+}
+
+{.mfi
+       // load C_5, C_6
+       ldfpd FR_COEFF5, FR_COEFF6 = [ GR_ADDR0 ], 16
+       // get int(x)
+       fcvt.fx.trunc.s1 FR_XINT = f8
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // FR_LOG10 = log2(10)
+       fma.s1 FR_L10 = FR_LOG10, FR_CONST1, f0
+       nop.i 0 ;;
+}
+
+{.mfi
+       // load log2(10)_low
+       ldfe FR_L10_LOW = [ GR_ADDR0 ], 16
+       // y0 = x*log2(10) = x*log2(10)_hi
+       fma.s1 FR_LOG10 = f8, FR_L10, f0
+       mov GR_EMIN = 0xffff-63
+}
+{.mfi
+       mov GR_32_BIAS = 0xffff + 5
+       // (K+f)*2^8 = round_to_int(y)
+       fcvt.fx.s1 FR_KF0 = FR_XL10
+       mov GR_4_BIAS = 0xffff + 2;;
+}
+
+{.mfi
+       // load smallest normal limit
+       ldfe FR_SNORM_LIMIT = [ GR_ADDR0 ], 16
+       // x>overflow threshold ?
+       fcmp.gt.s1 p12, p7 = f8, FR_OF_TEST
+       nop.i 0 ;;
+}
+
+{.mfi
+       setf.exp FR_32 = GR_32_BIAS
+       // x<underflow threshold ?
+  (p7) fcmp.lt.s1 p12, p7 = FR_XL10, FR_UF_TEST
+       nop.i 0 ;;
+}
+
+{.mfi
+       setf.exp FR_4 = GR_4_BIAS
+       fcvt.xf FR_XINTF = FR_XINT
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // FR_L10 = log2(10)_h*x-RN(log2(10)_h*x)
+       fms.s1 FR_L10 = f8, FR_L10, FR_LOG10
+       nop.i 0 ;;
+}
+
+{.mfi
+       getf.sig GR_BM8 = FR_KF0
+       fcvt.xf FR_KF0 = FR_KF0
+       mov GR_CONST2 = 255 ;;
+}
+
+{.mfi
+       // GR_CONST2 = f
+       and GR_CONST2 = GR_CONST2, GR_BM8
+       // FR_L10_LOW = e = log2(10)_l*x+(log2(10)_h*x-RN(log2(10)_h*x))
+       fma.s1 FR_L10_LOW = FR_L10_LOW, f8, FR_L10
+       // GR_BM8 = K
+       shr GR_BM8 = GR_BM8, 8 ;;
+}
+
+{.mmi
+       // address of D
+       shladd GR_D_ADDR = GR_CONST2, 2, GR_D_ADDR
+       // K+ = bias-63
+       add GR_BM8 = GR_BM8, GR_EMIN
+       // address of T
+       shladd GR_ADDR0 = GR_CONST2, 3, GR_ADDR0 ;;
+}
+
+{.mfb
+       // load D
+       ldfs FR_OF_TEST = [ GR_D_ADDR ]
+       // is input an integer ?
+       fcmp.eq.s1 p13, p14 = f8, FR_XINTF
+ (p12) br.cond.spnt OUT_RANGE_EXP10 ;;
+}
+
+{.mmf
+       // load T
+       ldf8 FR_UF_TEST = [ GR_ADDR0 ]
+       // FR_XL10 = 2^{K-63}
+       setf.exp FR_XL10 = GR_BM8
+       // r = x*log2(10)_hi-2^{-10}* [ (K+f)*2^{10} ]
+       fnma.s1 FR_KF0 = FR_KF0, FR_CONST1, FR_LOG10 ;;
+}
+
+{.mfi
+       nop.m 0
+       // get 28.0
+       fms.s1 FR_28 = FR_32, f1, FR_4
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // E = 1+C_1*e
+       fma.s1 FR_L10 = FR_L10_LOW, FR_COEFF1, f1
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // P12 = C_1+C_2*r
+       fma.s1 FR_COEFF2 = FR_COEFF2, FR_KF0, FR_COEFF1
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // P34 = C_3+C_4*r
+       fma.s1 FR_COEFF4 = FR_COEFF4, FR_KF0, FR_COEFF3
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // P56 = C_5+C_6*r
+       fma.s1 FR_COEFF5 = FR_COEFF6, FR_KF0, FR_COEFF5
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // GR_ADDR0 = r*r
+       fma.s1 FR_COEFF3 = FR_KF0, FR_KF0, f0
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // if input is integer, is it positive ?
+ (p13) fcmp.ge.s1 p13, p14 = f8, f0
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // r' = r*E
+       fma.s1 FR_KF0 = FR_KF0, FR_L10, f0
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // D' = D+C_1*e
+       fma.s1 FR_OF_TEST = FR_L10_LOW, FR_COEFF1, FR_OF_TEST
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // test if x >= smallest normal limit
+       fcmp.ge.s1 p11, p0 = f8, FR_SNORM_LIMIT
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // P36 = P34+r2*P56
+       fma.s1 FR_COEFF4 = FR_COEFF5, FR_COEFF3, FR_COEFF4
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // GR_D_ADDR = r'*r2
+       fma.s1 FR_COEFF3 = FR_COEFF3, FR_KF0, f0
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // is input below 28.0 ?
+ (p13) fcmp.lt.s1 p13, p14 = f8, FR_28
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // P' = P12*r'+D'
+       fma.s1 FR_COEFF2 = FR_COEFF2, FR_KF0, FR_OF_TEST
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // P = P'+r3*P36
+       fma.s1 FR_COEFF3 = FR_COEFF3, FR_COEFF4, FR_COEFF2
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // T = 2^{K-63}*T
+       fma.s1 FR_UF_TEST = FR_UF_TEST, FR_XL10, f0
+       nop.i 0 ;;
+}
+
+.pred.rel "mutex",p13,p14
+{.mfi
+       nop.m 0
+ (p13) fma.s1 f8 = FR_COEFF3, FR_UF_TEST, FR_UF_TEST
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+       // result = T+T*P
+ (p14) fma.s0 f8 = FR_COEFF3, FR_UF_TEST, FR_UF_TEST
+       // return
+ (p11) br.ret.sptk b0 ;;                  // return, if result normal
+}
+
+// Here if result in denormal range (and not zero)
+{.mib
+       nop.m 0
+       mov GR_Parameter_TAG= 264
+       br.cond.sptk __libm_error_region           // Branch to error handling
+}
+;;
+
+SPECIAL_EXP10:
+
+{.mfi
+       nop.m 0
+       // x = -Infinity ?
+       fclass.m p6, p0 = f8, 0x22
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // x = +Infinity ?
+       fclass.m p7, p0 = f8, 0x21
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // x = +/-Zero ?
+       fclass.m p8, p0 = f8, 0x7
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+       // exp10(-Infinity) = 0
+  (p6) mov f8 = f0
+  (p6) br.ret.spnt b0 ;;
+}
+
+{.mfb
+       nop.m 0
+       // exp10(+Infinity) = +Infinity
+       nop.f 0
+  (p7) br.ret.spnt b0 ;;
+}
+
+{.mfb
+       nop.m 0
+       // exp10(+/-0) = 1
+  (p8) mov f8 = f1
+  (p8) br.ret.spnt b0 ;;
+}
+
+{.mfb
+       nop.m 0
+       // Remaining cases: NaNs
+       fma.s0 f8 = f8, f1, f0
+       br.ret.sptk b0 ;;
+}
+
+
+OUT_RANGE_EXP10:
+
+// underflow: p6 = 1
+// overflow: p8 = 1
+
+.pred.rel "mutex",p6,p8
+{.mmi
+  (p8) mov GR_CONST1 = 0x1fffe
+  (p6) mov GR_CONST1 = 1
+       nop.i 0
+}
+;;
+
+{.mii
+       setf.exp FR_KF0 = GR_CONST1
+  (p8) mov GR_Parameter_TAG = 165
+  (p6) mov GR_Parameter_TAG = 264
+}
+;;
+
+{.mfb
+       nop.m 999
+       fma.s0 f8 = FR_KF0, FR_KF0, f0             // Create overflow/underflow
+       br.cond.sptk __libm_error_region           // Branch to error handling
+}
+;;
+
+GLOBAL_IEEE754_END(exp10l)
+weak_alias (exp10l, pow10l)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{.mfi
+       add GR_Parameter_Y = -32, sp // Parameter 2 value
+       nop.f 0
+.save ar.pfs, GR_SAVE_PFS
+       mov GR_SAVE_PFS = ar.pfs // Save ar.pfs
+}
+
+{.mfi
+.fframe 64
+       add sp = -64, sp // Create new stack
+       nop.f 0
+       mov GR_SAVE_GP = gp ;; // Save gp
+}
+
+{.mmi
+       stfe [ GR_Parameter_Y ] = FR_Y, 16 // STORE Parameter 2 on stack
+       add GR_Parameter_X = 16, sp // Parameter 1 address
+.save b0, GR_SAVE_B0
+       mov GR_SAVE_B0 = b0 ;; // Save b0
+}
+
+.body
+{.mib
+       stfe [ GR_Parameter_X ] = FR_X // STORE Parameter 1 on stack
+       add GR_Parameter_RESULT = 0, GR_Parameter_Y // Parameter 3 address
+       nop.b 0
+}
+{.mib
+       stfe [ GR_Parameter_Y ] = FR_RESULT // STORE Parameter 3 on stack
+       add GR_Parameter_Y = -16, GR_Parameter_Y
+       br.call.sptk b0 = __libm_error_support# ;; // Call error handling function
+}
+
+{.mmi
+       add GR_Parameter_RESULT = 48, sp
+       nop.m 0
+       nop.i 0 ;;
+}
+
+{.mmi
+       ldfe f8 = [ GR_Parameter_RESULT ] // Get return result off stack
+.restore sp
+       add sp = 64, sp // Restore stack pointer
+       mov b0 = GR_SAVE_B0 ;; // Restore return address
+}
+
+{.mib
+       mov gp = GR_SAVE_GP // Restore gp
+       mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
+       br.ret.sptk b0 ;; // Return
+}
+
+
+LOCAL_LIBM_END(__libm_error_region)
+.type __libm_error_support#, @function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/e_exp2.S b/sysdeps/ia64/fpu/e_exp2.S
new file mode 100644
index 0000000000..54f652e384
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_exp2.S
@@ -0,0 +1,564 @@
+.file "exp2.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/25/00  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 09/05/02  Improved performance
+// 01/17/03  Fixed to call error support when x=1024.0
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// double exp2(double)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x= (K + fh + fl + r), where
+// K is an integer, fh= 0.b1 b2 b3 b4 b5,
+// fl= 2^{-5}* 0.b6 b7 b8 b8 b10 (fh, fl >= 0),
+// and |r|<2^{-11}
+// Th is a table that stores 2^fh (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+// Tl is a table that stores 2^fl (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+//
+// 2^x is approximated as
+// 2^K * Th [ f ] * Tl [ f ] * (1+c1*r+c2*r^2+c3*r^3+c4*r^4)
+
+// Note: We use the following trick to speed up conversion from FP to integer:
+//
+// Let  x = K + r, where K is an integer, and  |r| <= 0.5
+// Let N be the number of significand bits for the FP format used
+//   ( N=64 for double-extended, N=53 for double)
+//
+// Then let y = 1.5 * 2^(N-1)  +  x    for RN mode
+//          K = y -  1.5 * 2^(N-1)
+//          r  = x - K
+//
+// If we want to obtain the integer part and the first m fractional bits of x,
+// we can use the same trick, but with a constant of  1.5 * 2^(N-1-m):
+//
+// Let x = K + f + r
+// f = 0.b_1 b_2 ... b_m
+// |r| <= 2^(-m-1)
+//
+// Then let y = 1.5 * 2^(N-1-m)  +  x    for RN mode
+//          (K+f) = y -  1.5 * 2^(N-1-m)
+//          r  = x - K
+
+
+// Special values
+//==============================================================
+// exp2(0)= 1
+// exp2(+inf)= inf
+// exp2(-inf)= 0
+//
+
+// Registers used
+//==============================================================
+// r2-r3, r14-r40
+// f6-f15, f32-f45
+// p6-p8, p12
+//
+
+
+GR_TBL_START        = r2
+GR_LOG_TBL          = r3
+
+GR_OF_LIMIT         = r14
+GR_UF_LIMIT         = r15
+GR_EXP_CORR         = r16
+GR_F_low            = r17
+GR_F_high           = r18
+GR_K                = r19
+GR_Flow_ADDR        = r20
+
+GR_BIAS             = r21
+GR_Fh               = r22
+GR_Fh_ADDR          = r23
+GR_EXPMAX           = r24
+GR_EMIN             = r25
+
+GR_ROUNDVAL         = r26
+GR_MASK             = r27
+GR_KF0              = r28
+GR_MASK_low         = r29
+GR_COEFF_START      = r30
+
+GR_SAVE_B0          = r33
+GR_SAVE_PFS         = r34
+GR_SAVE_GP          = r35
+GR_SAVE_SP          = r36
+
+GR_Parameter_X      = r37
+GR_Parameter_Y      = r38
+GR_Parameter_RESULT = r39
+GR_Parameter_TAG    = r40
+
+
+FR_X                = f10
+FR_Y                = f1
+FR_RESULT           = f8
+
+
+FR_COEFF1           = f6
+FR_COEFF2           = f7
+FR_R                = f9
+
+FR_KF0              = f12
+FR_COEFF3           = f13
+FR_COEFF4           = f14
+FR_UF_LIMIT         = f15
+
+FR_OF_LIMIT         = f32
+FR_EXPMIN           = f33
+FR_ROUNDVAL         = f34
+FR_KF               = f35
+
+FR_2_TO_K           = f36
+FR_T_low            = f37
+FR_T_high           = f38
+FR_P34              = f39
+FR_R2               = f40
+
+FR_P12              = f41
+FR_T_low_K          = f42
+FR_P14              = f43
+FR_T                = f44
+FR_P                = f45
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+data8 0x3fac6b08d704a0c0, 0x3f83b2ab6fba4e77 // C_3 and C_4
+data8 0xb17217f7d1cf79ab, 0x00003ffe // C_1
+data8 0xf5fdeffc162c7541, 0x00003ffc // C_2
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+// 2^{0.00000 b6 b7 b8 b9 b10}
+data8 0x8000000000000000, 0x8016302f17467628
+data8 0x802c6436d0e04f50, 0x80429c17d77c18ed
+data8 0x8058d7d2d5e5f6b0, 0x806f17687707a7af
+data8 0x80855ad965e88b83, 0x809ba2264dada76a
+data8 0x80b1ed4fd999ab6c, 0x80c83c56b50cf77f
+data8 0x80de8f3b8b85a0af, 0x80f4e5ff089f763e
+data8 0x810b40a1d81406d4, 0x81219f24a5baa59d
+data8 0x813801881d886f7b, 0x814e67cceb90502c
+data8 0x8164d1f3bc030773, 0x817b3ffd3b2f2e47
+data8 0x8191b1ea15813bfd, 0x81a827baf7838b78
+data8 0x81bea1708dde6055, 0x81d51f0b8557ec1c
+data8 0x81eba08c8ad4536f, 0x820225f44b55b33b
+data8 0x8218af4373fc25eb, 0x822f3c7ab205c89a
+data8 0x8245cd9ab2cec048, 0x825c62a423d13f0c
+data8 0x8272fb97b2a5894c, 0x828998760d01faf3
+data8 0x82a0393fe0bb0ca8, 0x82b6ddf5dbc35906
+//
+// 2^{0.b1 b2 b3 b4 b5}
+data8 0x8000000000000000, 0x82cd8698ac2ba1d7
+data8 0x85aac367cc487b14, 0x88980e8092da8527
+data8 0x8b95c1e3ea8bd6e6, 0x8ea4398b45cd53c0
+data8 0x91c3d373ab11c336, 0x94f4efa8fef70961
+data8 0x9837f0518db8a96f, 0x9b8d39b9d54e5538
+data8 0x9ef5326091a111ad, 0xa27043030c496818
+data8 0xa5fed6a9b15138ea, 0xa9a15ab4ea7c0ef8
+data8 0xad583eea42a14ac6, 0xb123f581d2ac258f
+data8 0xb504f333f9de6484, 0xb8fbaf4762fb9ee9
+data8 0xbd08a39f580c36be, 0xc12c4cca66709456
+data8 0xc5672a115506dadd, 0xc9b9bd866e2f27a2
+data8 0xce248c151f8480e3, 0xd2a81d91f12ae45a
+data8 0xd744fccad69d6af4, 0xdbfbb797daf23755
+data8 0xe0ccdeec2a94e111, 0xe5b906e77c8348a8
+data8 0xeac0c6e7dd24392e, 0xefe4b99bdcdaf5cb
+data8 0xf5257d152486cc2c, 0xfa83b2db722a033a
+LOCAL_OBJECT_END(T_table)
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(exp2)
+
+
+{.mfi
+       alloc r32= ar.pfs, 1, 4, 4, 0
+       // will continue only for non-zero normal/denormal numbers
+       fclass.nm p12, p0= f8, 0x1b
+       // GR_TBL_START= pointer to C_1...C_4 followed by T_table
+       addl GR_TBL_START= @ltoff(poly_coeffs), gp
+}
+{.mlx
+       mov GR_OF_LIMIT= 0xffff + 10              // Exponent of overflow limit
+       movl GR_ROUNDVAL= 0x5a400000              // 1.5*2^(63-10) (SP)
+}
+;;
+
+// Form special constant 1.5*2^(63-10) to give integer part and first 10
+// fractional bits of x
+{.mfi
+       setf.s FR_ROUNDVAL= GR_ROUNDVAL           // Form special constant
+       fcmp.lt.s1 p6, p8= f8, f0                 // X<0 ?
+       nop.i 0
+}
+{.mfb
+       ld8 GR_COEFF_START= [ GR_TBL_START ]      // Load pointer to coeff table
+       nop.f 0
+ (p12) br.cond.spnt SPECIAL_exp2                 // Branch if nan, inf, zero
+}
+;;
+
+{.mlx
+       setf.exp FR_OF_LIMIT= GR_OF_LIMIT         // Set overflow limit
+       movl GR_UF_LIMIT= 0xc4866000              // (-2^10-51) = -1075
+}
+;;
+
+{.mfi
+       ldfpd FR_COEFF3, FR_COEFF4= [ GR_COEFF_START ], 16 // load C_3, C_4
+       fma.s0 f8= f8, f1, f0                     // normalize x
+       nop.i 0
+}
+;;
+
+{.mmi
+       setf.s FR_UF_LIMIT= GR_UF_LIMIT           // Set underflow limit
+       ldfe FR_COEFF1= [ GR_COEFF_START ], 16    // load C_1
+       mov GR_EXP_CORR= 0xffff-126
+}
+;;
+
+{.mfi
+       ldfe FR_COEFF2= [ GR_COEFF_START ], 16    // load C_2
+       fma.s1 FR_KF0= f8, f1, FR_ROUNDVAL        // y= x + 1.5*2^(63-10)
+       nop.i 0
+}
+;;
+
+{.mfi
+       mov GR_MASK= 1023
+       fms.s1 FR_KF= FR_KF0, f1, FR_ROUNDVAL     // (K+f)
+       mov GR_MASK_low= 31
+}
+;;
+
+{.mfi
+       getf.sig GR_KF0= FR_KF0                   // (K+f)*2^10= round_to_int(y)
+       fcmp.ge.s1 p12, p7= f8, FR_OF_LIMIT       // x >= overflow threshold ?
+       add GR_LOG_TBL= 256, GR_COEFF_START       // Pointer to high T_table
+}
+;;
+
+{.mmi
+       and GR_F_low= GR_KF0, GR_MASK_low         // f_low
+       and GR_F_high= GR_MASK, GR_KF0            // f_high*32
+       shr GR_K= GR_KF0, 10                      // K
+}
+;;
+
+{.mmi
+       shladd GR_Flow_ADDR= GR_F_low, 3, GR_COEFF_START // address of 2^{f_low}
+       add GR_BIAS= GR_K, GR_EXP_CORR            // K= bias-2*63
+       shr GR_Fh= GR_F_high, 5                   // f_high
+}
+;;
+
+{.mfi
+       setf.exp FR_2_TO_K= GR_BIAS               // 2^{K-126}
+       fnma.s1 FR_R= FR_KF, f1, f8               // r= x - (K+f)
+       shladd GR_Fh_ADDR= GR_Fh, 3, GR_LOG_TBL   // address of 2^{f_high}
+}
+{.mlx
+       ldf8 FR_T_low= [ GR_Flow_ADDR ]           // load T_low= 2^{f_low}
+       movl GR_EMIN= 0xc47f8000                  // EMIN= -1022
+}
+;;
+
+{.mfi
+       ldf8 FR_T_high= [ GR_Fh_ADDR ]            // load T_high= 2^{f_high}
+ (p7)  fcmp.lt.s1 p12, p7= f8, FR_UF_LIMIT       // x<underflow threshold ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       setf.s FR_EXPMIN= GR_EMIN                 // FR_EXPMIN= EMIN
+       fma.s1 FR_P34= FR_COEFF4, FR_R, FR_COEFF3 // P34= C_3+C_4*r
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+       fma.s1 FR_R2= FR_R, FR_R, f0              // r*r
+ (p12) br.cond.spnt OUT_RANGE_exp2
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_P12= FR_COEFF2, FR_R, FR_COEFF1 // P12= C_1+C_2*r
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_T_low_K= FR_T_low, FR_2_TO_K, f0 // T= 2^{K-126}*T_low
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_P14= FR_R2, FR_P34, FR_P12       // P14= P12+r2*P34
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_T= FR_T_low_K, FR_T_high, f0     // T= T*T_high
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fcmp.lt.s0 p6, p8= f8, FR_EXPMIN           // underflow (x<EMIN) ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_P= FR_P14, FR_R, f0              // P= P14*r
+       nop.i 0
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.d.s0 f8= FR_P, FR_T, FR_T              // result= T+T*P
+ (p8)  br.ret.sptk b0                             // return
+}
+;;
+
+{.mfb
+ (p6)  mov GR_Parameter_TAG= 162
+       nop.f 0
+ (p6)  br.cond.sptk __libm_error_region
+}
+;;
+
+
+SPECIAL_exp2:
+{.mfi
+       nop.m 0
+       fclass.m p6, p0= f8, 0x22                  // x= -Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p7, p0= f8, 0x21                  // x= +Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p8, p0= f8, 0x7                   // x= +/-Zero ?
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+ (p6)  mov f8= f0                                 // exp2(-Infinity)= 0
+ (p6)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       nop.f 0
+ (p7)  br.ret.spnt b0                             // exp2(+Infinity)= +Infinity
+}
+;;
+
+{.mfb
+       nop.m 0
+ (p8)  mov f8= f1                                 // exp2(+/-0)= 1
+ (p8)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.d.s0 f8= f8, f1, f0                    // Remaining cases: NaNs
+       br.ret.sptk b0
+}
+;;
+
+
+OUT_RANGE_exp2:
+
+// overflow: p8= 1
+
+{.mii
+ (p8)  mov GR_EXPMAX= 0x1fffe
+       nop.i 0
+       nop.i 0
+}
+;;
+
+{.mmb
+ (p8)  mov GR_Parameter_TAG= 161
+ (p8)  setf.exp FR_R= GR_EXPMAX
+       nop.b 999
+}
+;;
+
+{.mfi
+       nop.m 999
+ (p8)  fma.d.s0 f8= FR_R, FR_R, f0                // Create overflow
+       nop.i 999
+}
+// underflow: p6= 1
+{.mii
+ (p6)  mov GR_Parameter_TAG= 162
+ (p6)  mov GR_EXPMAX= 1
+       nop.i 0
+}
+;;
+
+{.mmb
+       nop.m 0
+ (p6)  setf.exp FR_R= GR_EXPMAX
+       nop.b 999
+}
+;;
+
+{.mfb
+       nop.m 999
+ (p6)  fma.d.s0 f8= FR_R, FR_R, f0                // Create underflow
+       nop.b 0
+}
+;;
+
+GLOBAL_LIBM_END(exp2)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+.prologue
+{.mfi
+       add GR_Parameter_Y= -32, sp                // Parameter 2 value
+       nop.f 0
+.save ar.pfs, GR_SAVE_PFS
+       mov GR_SAVE_PFS= ar.pfs                    // Save ar.pfs
+}
+
+{.mfi
+.fframe 64
+       add sp= -64, sp                            // Create new stack
+       nop.f 0
+       mov GR_SAVE_GP= gp                         // Save gp
+}
+;;
+
+{.mmi
+       stfd [ GR_Parameter_Y ]= FR_Y, 16          // STORE Parameter 2 on stack
+       add GR_Parameter_X= 16, sp                 // Parameter 1 address
+.save b0, GR_SAVE_B0
+       mov GR_SAVE_B0= b0                         // Save b0
+}
+;;
+
+.body
+{.mib
+       stfd [ GR_Parameter_X ]= FR_X              // STORE Parameter 1 on stack
+       add GR_Parameter_RESULT= 0, GR_Parameter_Y // Parameter 3 address
+       nop.b 0
+}
+{.mib
+       stfd [ GR_Parameter_Y ]= FR_RESULT         // STORE Parameter 3 on stack
+       add GR_Parameter_Y= -16, GR_Parameter_Y
+       br.call.sptk b0= __libm_error_support#    // Call error handling function
+}
+;;
+
+{.mmi
+       add GR_Parameter_RESULT= 48, sp
+       nop.m 0
+       nop.i 0
+}
+;;
+
+{.mmi
+       ldfd f8= [ GR_Parameter_RESULT ]          // Get return result off stack
+.restore sp
+       add sp= 64, sp                            // Restore stack pointer
+       mov b0= GR_SAVE_B0                        // Restore return address
+}
+;;
+
+{.mib
+       mov gp= GR_SAVE_GP                        // Restore gp
+       mov ar.pfs= GR_SAVE_PFS                   // Restore ar.pfs
+       br.ret.sptk b0                            // Return
+}
+;;
+
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type __libm_error_support#, @function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_exp2f.S b/sysdeps/ia64/fpu/e_exp2f.S
new file mode 100644
index 0000000000..36354ae3bd
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_exp2f.S
@@ -0,0 +1,539 @@
+.file "exp2f.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/25/00  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 09/05/02  Improved performance and accuracy
+// 01/17/03  Fixed to call error support when x=128.0
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// float exp2f(float)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x= (K + fh + fl + r), where
+// K is an integer, fh= 0.b1 b2 b3 b4 b5,
+// fl= 2^{-5}* 0.b6 b7 b8 b8 b10 (fh, fl >= 0),
+// and |r|<2^{-11}
+// Th is a table that stores 2^fh (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+// Tl is a table that stores 2^fl (32 entries) rounded to
+// double extended precision (only mantissa is stored)
+//
+// 2^x is approximated as
+// 2^K * Th [ f ] * Tl [ f ] * (1+c1*r+c2*r^2)
+
+// Note: We use the following trick to speed up conversion from FP to integer:
+//
+// Let  x = K + r, where K is an integer, and  |r| <= 0.5
+// Let N be the number of significand bits for the FP format used
+//   ( N=64 for double-extended, N=53 for double)
+//
+// Then let y = 1.5 * 2^(N-1)  +  x    for RN mode
+//          K = y -  1.5 * 2^(N-1)
+//          r  = x - K
+//
+// If we want to obtain the integer part and the first m fractional bits of x,
+// we can use the same trick, but with a constant of  1.5 * 2^(N-1-m):
+//
+// Let x = K + f + r
+// f = 0.b_1 b_2 ... b_m
+// |r| <= 2^(-m-1)
+//
+// Then let y = 1.5 * 2^(N-1-m)  +  x    for RN mode
+//          (K+f) = y -  1.5 * 2^(N-1-m)
+//          r  = x - K
+
+
+// Special values
+//==============================================================
+// exp2(0)= 1
+// exp2(+inf)= inf
+// exp2(-inf)= 0
+//
+
+// Registers used
+//==============================================================
+// r2-r3, r14-r40
+// f6-f15, f32-f45
+// p6-p8, p12
+//
+
+
+GR_TBL_START        = r2
+GR_LOG_TBL          = r3
+
+GR_OF_LIMIT         = r14
+GR_UF_LIMIT         = r15
+GR_EXP_CORR         = r16
+GR_F_low            = r17
+GR_F_high           = r18
+GR_K                = r19
+GR_Flow_ADDR        = r20
+
+GR_BIAS             = r21
+GR_Fh               = r22
+GR_Fh_ADDR          = r23
+GR_EXPMAX           = r24
+GR_EMIN             = r25
+
+GR_ROUNDVAL         = r26
+GR_MASK             = r27
+GR_KF0              = r28
+GR_MASK_low         = r29
+GR_COEFF_START      = r30
+
+GR_SAVE_B0          = r33
+GR_SAVE_PFS         = r34
+GR_SAVE_GP          = r35
+GR_SAVE_SP          = r36
+
+GR_Parameter_X      = r37
+GR_Parameter_Y      = r38
+GR_Parameter_RESULT = r39
+GR_Parameter_TAG    = r40
+
+
+FR_X                = f10
+FR_Y                = f1
+FR_RESULT           = f8
+
+
+FR_COEFF1           = f6
+FR_COEFF2           = f7
+FR_R                = f9
+
+FR_KF0              = f12
+FR_UF_LIMIT         = f15
+
+FR_OF_LIMIT         = f32
+FR_EXPMIN           = f33
+FR_ROUNDVAL         = f34
+FR_KF               = f35
+
+FR_2_TO_K           = f36
+FR_T_low            = f37
+FR_T_high           = f38
+
+FR_P12              = f41
+FR_T_low_K          = f42
+FR_T                = f44
+FR_P                = f45
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+data8 0xb17217f7d1cf79ab, 0x00003ffe // C_1
+data8 0xf5fdeffc162c7541, 0x00003ffc // C_2
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+// 2^{0.00000 b6 b7 b8 b9 b10}
+data8 0x8000000000000000, 0x8016302f17467628
+data8 0x802c6436d0e04f50, 0x80429c17d77c18ed
+data8 0x8058d7d2d5e5f6b0, 0x806f17687707a7af
+data8 0x80855ad965e88b83, 0x809ba2264dada76a
+data8 0x80b1ed4fd999ab6c, 0x80c83c56b50cf77f
+data8 0x80de8f3b8b85a0af, 0x80f4e5ff089f763e
+data8 0x810b40a1d81406d4, 0x81219f24a5baa59d
+data8 0x813801881d886f7b, 0x814e67cceb90502c
+data8 0x8164d1f3bc030773, 0x817b3ffd3b2f2e47
+data8 0x8191b1ea15813bfd, 0x81a827baf7838b78
+data8 0x81bea1708dde6055, 0x81d51f0b8557ec1c
+data8 0x81eba08c8ad4536f, 0x820225f44b55b33b
+data8 0x8218af4373fc25eb, 0x822f3c7ab205c89a
+data8 0x8245cd9ab2cec048, 0x825c62a423d13f0c
+data8 0x8272fb97b2a5894c, 0x828998760d01faf3
+data8 0x82a0393fe0bb0ca8, 0x82b6ddf5dbc35906
+//
+// 2^{0.b1 b2 b3 b4 b5}
+data8 0x8000000000000000, 0x82cd8698ac2ba1d7
+data8 0x85aac367cc487b14, 0x88980e8092da8527
+data8 0x8b95c1e3ea8bd6e6, 0x8ea4398b45cd53c0
+data8 0x91c3d373ab11c336, 0x94f4efa8fef70961
+data8 0x9837f0518db8a96f, 0x9b8d39b9d54e5538
+data8 0x9ef5326091a111ad, 0xa27043030c496818
+data8 0xa5fed6a9b15138ea, 0xa9a15ab4ea7c0ef8
+data8 0xad583eea42a14ac6, 0xb123f581d2ac258f
+data8 0xb504f333f9de6484, 0xb8fbaf4762fb9ee9
+data8 0xbd08a39f580c36be, 0xc12c4cca66709456
+data8 0xc5672a115506dadd, 0xc9b9bd866e2f27a2
+data8 0xce248c151f8480e3, 0xd2a81d91f12ae45a
+data8 0xd744fccad69d6af4, 0xdbfbb797daf23755
+data8 0xe0ccdeec2a94e111, 0xe5b906e77c8348a8
+data8 0xeac0c6e7dd24392e, 0xefe4b99bdcdaf5cb
+data8 0xf5257d152486cc2c, 0xfa83b2db722a033a
+LOCAL_OBJECT_END(T_table)
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(exp2f)
+
+
+{.mfi
+       alloc r32= ar.pfs, 1, 4, 4, 0
+       // will continue only for non-zero normal/denormal numbers
+       fclass.nm p12, p0= f8, 0x1b
+       // GR_TBL_START= pointer to C_1...C_2 followed by T_table
+       addl GR_TBL_START= @ltoff(poly_coeffs), gp
+}
+{.mlx
+       mov GR_OF_LIMIT= 0xffff + 7               // Exponent of overflow limit
+       movl GR_ROUNDVAL= 0x5a400000              // 1.5*2^(63-10) (SP)
+}
+;;
+
+// Form special constant 1.5*2^(63-10) to give integer part and first 10
+// fractional bits of x
+{.mfi
+       setf.s FR_ROUNDVAL= GR_ROUNDVAL           // Form special constant
+       fcmp.lt.s1 p6, p8= f8, f0                 // X<0 ?
+       nop.i 0
+}
+{.mfb
+       ld8 GR_COEFF_START= [ GR_TBL_START ]      // Load pointer to coeff table
+       nop.f 0
+ (p12) br.cond.spnt SPECIAL_exp2                 // Branch if nan, inf, zero
+}
+;;
+
+{.mlx
+       setf.exp FR_OF_LIMIT= GR_OF_LIMIT         // Set overflow limit
+       movl GR_UF_LIMIT= 0xc3160000              // (-2^7-22) = -150
+}
+;;
+
+{.mfi
+       ldfe FR_COEFF1= [ GR_COEFF_START ], 16    // load C_1
+       fma.s0 f8= f8, f1, f0                     // normalize x
+       nop.i 0
+}
+;;
+
+{.mmi
+       ldfe FR_COEFF2= [ GR_COEFF_START ], 16    // load C_2
+       setf.s FR_UF_LIMIT= GR_UF_LIMIT           // Set underflow limit
+       mov GR_EXP_CORR= 0xffff-126
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_KF0= f8, f1, FR_ROUNDVAL        // y= x + 1.5*2^(63-10)
+       nop.i 0
+}
+;;
+
+{.mfi
+       mov GR_MASK= 1023
+       fms.s1 FR_KF= FR_KF0, f1, FR_ROUNDVAL     // (K+f)
+       mov GR_MASK_low= 31
+}
+;;
+
+{.mfi
+       getf.sig GR_KF0= FR_KF0                   // (K+f)*2^10= round_to_int(y)
+       fcmp.ge.s1 p12, p7= f8, FR_OF_LIMIT       // x >= overflow threshold ?
+       add GR_LOG_TBL= 256, GR_COEFF_START       // Pointer to high T_table
+}
+;;
+
+{.mmi
+       and GR_F_low= GR_KF0, GR_MASK_low         // f_low
+       and GR_F_high= GR_MASK, GR_KF0            // f_high*32
+       shr GR_K= GR_KF0, 10                      // K
+}
+;;
+
+{.mmi
+       shladd GR_Flow_ADDR= GR_F_low, 3, GR_COEFF_START // address of 2^{f_low}
+       add GR_BIAS= GR_K, GR_EXP_CORR            // K= bias-2*63
+       shr GR_Fh= GR_F_high, 5                   // f_high
+}
+;;
+
+{.mfi
+       setf.exp FR_2_TO_K= GR_BIAS               // 2^{K-126}
+       fnma.s1 FR_R= FR_KF, f1, f8               // r= x - (K+f)
+       shladd GR_Fh_ADDR= GR_Fh, 3, GR_LOG_TBL   // address of 2^{f_high}
+}
+{.mlx
+       ldf8 FR_T_low= [ GR_Flow_ADDR ]           // load T_low= 2^{f_low}
+       movl GR_EMIN= 0xc2fc0000                  // EMIN= -126
+}
+;;
+
+{.mfi
+       ldf8 FR_T_high= [ GR_Fh_ADDR ]            // load T_high= 2^{f_high}
+ (p7)  fcmp.lt.s1 p12, p7= f8, FR_UF_LIMIT       // x<underflow threshold ?
+       nop.i 0
+}
+;;
+
+{.mfb
+       setf.s FR_EXPMIN= GR_EMIN                 // FR_EXPMIN= EMIN
+       fma.s1 FR_P12= FR_COEFF2, FR_R, FR_COEFF1 // P12= C_1+C_2*r
+ (p12) br.cond.spnt OUT_RANGE_exp2
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_T_low_K= FR_T_low, FR_2_TO_K, f0 // T= 2^{K-126}*T_low
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_P= FR_R, FR_P12, f0              // P= P12+r
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fma.s1 FR_T= FR_T_low_K, FR_T_high, f0     // T= T*T_high
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fcmp.lt.s0 p6, p8= f8, FR_EXPMIN           // underflow (x<EMIN) ?
+       nop.i 0
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.s.s0 f8= FR_P, FR_T, FR_T              // result= T+T*P
+ (p8)  br.ret.sptk b0                             // return
+}
+;;
+
+{.mfb
+ (p6)  mov GR_Parameter_TAG= 164
+       nop.f 0
+ (p6)  br.cond.sptk __libm_error_region
+}
+;;
+
+
+SPECIAL_exp2:
+{.mfi
+       nop.m 0
+       fclass.m p6, p0= f8, 0x22                  // x= -Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p7, p0= f8, 0x21                  // x= +Infinity ?
+       nop.i 0
+}
+;;
+
+{.mfi
+       nop.m 0
+       fclass.m p8, p0= f8, 0x7                   // x= +/-Zero ?
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+ (p6)  mov f8= f0                                 // exp2(-Infinity)= 0
+ (p6)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       nop.f 0
+ (p7)  br.ret.spnt b0                             // exp2(+Infinity)= +Infinity
+}
+;;
+
+{.mfb
+       nop.m 0
+ (p8)  mov f8= f1                                 // exp2(+/-0)= 1
+ (p8)  br.ret.spnt b0
+}
+;;
+
+{.mfb
+       nop.m 0
+       fma.s.s0 f8= f8, f1, f0                    // Remaining cases: NaNs
+       br.ret.sptk b0
+}
+;;
+
+
+OUT_RANGE_exp2:
+
+// overflow: p8= 1
+
+{.mii
+ (p8)  mov GR_EXPMAX= 0x1fffe
+       nop.i 0
+       nop.i 0
+}
+;;
+
+{.mmb
+ (p8)  mov GR_Parameter_TAG= 163
+ (p8)  setf.exp FR_R= GR_EXPMAX
+       nop.b 999
+}
+;;
+
+{.mfi
+       nop.m 999
+ (p8)  fma.s.s0 f8= FR_R, FR_R, f0                // Create overflow
+       nop.i 999
+}
+// underflow: p6= 1
+{.mii
+ (p6)  mov GR_Parameter_TAG= 164
+ (p6)  mov GR_EXPMAX= 1
+       nop.i 0
+}
+;;
+
+{.mmb
+       nop.m 0
+ (p6)  setf.exp FR_R= GR_EXPMAX
+       nop.b 999
+}
+;;
+
+{.mfb
+       nop.m 999
+ (p6)  fma.s.s0 f8= FR_R, FR_R, f0                // Create underflow
+       nop.b 0
+}
+;;
+
+GLOBAL_LIBM_END(exp2f)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+.prologue
+{.mfi
+       add GR_Parameter_Y= -32, sp                // Parameter 2 value
+       nop.f 0
+.save ar.pfs, GR_SAVE_PFS
+       mov GR_SAVE_PFS= ar.pfs                    // Save ar.pfs
+}
+
+{.mfi
+.fframe 64
+       add sp= -64, sp                            // Create new stack
+       nop.f 0
+       mov GR_SAVE_GP= gp                         // Save gp
+}
+;;
+
+{.mmi
+       stfs [ GR_Parameter_Y ]= FR_Y, 16          // STORE Parameter 2 on stack
+       add GR_Parameter_X= 16, sp                 // Parameter 1 address
+.save b0, GR_SAVE_B0
+       mov GR_SAVE_B0= b0                         // Save b0
+}
+;;
+
+.body
+{.mib
+       stfs [ GR_Parameter_X ]= FR_X              // STORE Parameter 1 on stack
+       add GR_Parameter_RESULT= 0, GR_Parameter_Y // Parameter 3 address
+       nop.b 0
+}
+{.mib
+       stfs [ GR_Parameter_Y ]= FR_RESULT         // STORE Parameter 3 on stack
+       add GR_Parameter_Y= -16, GR_Parameter_Y
+       br.call.sptk b0= __libm_error_support#    // Call error handling function
+}
+;;
+
+{.mmi
+       add GR_Parameter_RESULT= 48, sp
+       nop.m 0
+       nop.i 0
+}
+;;
+
+{.mmi
+       ldfs f8= [ GR_Parameter_RESULT ]          // Get return result off stack
+.restore sp
+       add sp= 64, sp                            // Restore stack pointer
+       mov b0= GR_SAVE_B0                        // Restore return address
+}
+;;
+
+{.mib
+       mov gp= GR_SAVE_GP                        // Restore gp
+       mov ar.pfs= GR_SAVE_PFS                   // Restore ar.pfs
+       br.ret.sptk b0                            // Return
+}
+;;
+
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type __libm_error_support#, @function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_exp2l.S b/sysdeps/ia64/fpu/e_exp2l.S
new file mode 100644
index 0000000000..743ed3558b
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_exp2l.S
@@ -0,0 +1,807 @@
+.file "exp2l.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 07/27/00 Initial version
+// 08/15/00 Bundle added after call to __libm_error_support to properly
+// set [ the previously overwritten ] GR_Parameter_RESULT.
+// 02/02/01 Added libm_error_support calls for underflow
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 05/07/03 Reformatted assembly source
+//
+// API
+//==============================================================
+// long double exp2l(long double)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x= K + f + r, where
+// K is an integer, f= 0.b1 b2... b8 (f>= 0),
+// and |r|<2^{-8}
+// T is a table that stores 2^f (256 entries) rounded to
+// double extended precision (only mantissa is stored)
+// D stores (2^f/T [ f ] - 1), rounded to single precision
+//
+// 2^x is approximated as
+// 2^K * T [ f ] * (1+D [ f ] +c1*r+c2*r^2+...+c6*r^6)
+//
+
+
+
+// Special values
+//==============================================================
+// exp2(0)= 1
+// exp2(+inf)= inf
+// exp2(-inf)= 0
+//
+
+
+// Registers used
+//==============================================================
+// f6-f15, f32-f46
+// r2-r3, r8-r11, r14-r40
+// p6, p7, p8, p12
+
+       FR_X        = f10
+       FR_Y        = f1
+       FR_RESULT   = f8
+
+       FR_KF0      = f6
+       FR_EXP63    = f7
+       FR_T        = f9
+       FR_COEFF3   = f10
+       FR_COEFF4   = f11
+       FR_COEFF5   = f12
+       FR_COEFF6   = f13
+       FR_COEFF1   = f14
+       FR_COEFF2   = f15
+       FR_2P14     = f32
+       FR_UF_TEST  = f33
+       FR_D        = f34
+       FR_R        = f35
+       FR_2EXP     = f36
+       FR_EMIN     = f37
+       FR_P34      = f38
+       FR_P56      = f39
+       FR_R2       = f40
+       FR_P12      = f41
+       FR_TS       = f42
+       FR_P36      = f43
+       FR_P02      = f44
+       FR_R3       = f45
+       FR_P06      = f46
+
+
+       GR_ADDR0    = r2
+       GR_ADDR     = r2
+       GR_D_ADDR0  = r3
+       GR_D_ADDR   = r3
+       GR_LEADBITS = r8
+       GR_256      = r9
+       GR_EM63     = r10
+       GR_255      = r11
+       GR_EXPON    = r14
+       GR_BM63     = r15
+       GR_UF_TEST  = r16
+       GR_INDEX    = r17
+       GR_K        = r18
+       GR_KF       = r19
+       GR_2P14     = r19
+       GR_EMIN     = r20
+       GR_IT       = r21
+       GR_ID       = r22
+       GR_63       = r23
+       GR_CONST1   = r24
+       GR_EBIAS    = r25
+       GR_CONST2   = r26
+       GR_CONST3   = r27
+       GR_SIGNIF   = r28
+       GR_ARGEXP   = r29
+       GR_SGN      = r30
+       GR_EMIN1    = r31
+       GR_SREG     = r32
+
+       GR_SAVE_B0  = r33
+       GR_SAVE_PFS = r34
+       GR_SAVE_GP  = r35
+       GR_SAVE_SP  = r36
+
+       GR_Parameter_X     = r37
+       GR_Parameter_Y     = r38
+       GR_Parameter_RESULT= r39
+       GR_Parameter_TAG   = r40
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+       data8 0x3fac6b08d704a0c0 // C_3
+       data8 0x3f83b2ab6fba4e77 // C_4
+       data8 0x3f55d87fe78a6731 // C_5
+       data8 0x3f2430912f86c787 // C_6
+       data8 0xb17217f7d1cf79ab, 0x00003ffe // C_1
+       data8 0xf5fdeffc162c7541, 0x00003ffc // C_2
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+       data8 0x8000000000000000, 0x8058d7d2d5e5f6b1
+       data8 0x80b1ed4fd999ab6c, 0x810b40a1d81406d4
+       data8 0x8164d1f3bc030773, 0x81bea1708dde6056
+       data8 0x8218af4373fc25ec, 0x8272fb97b2a5894c
+       data8 0x82cd8698ac2ba1d7, 0x83285071e0fc4547
+       data8 0x8383594eefb6ee37, 0x83dea15b9541b132
+       data8 0x843a28c3acde4046, 0x8495efb3303efd30
+       data8 0x84f1f656379c1a29, 0x854e3cd8f9c8c95d
+       data8 0x85aac367cc487b15, 0x86078a2f23642a9f
+       data8 0x8664915b923fba04, 0x86c1d919caef5c88
+       data8 0x871f61969e8d1010, 0x877d2afefd4e256c
+       data8 0x87db357ff698d792, 0x88398146b919f1d4
+       data8 0x88980e8092da8527, 0x88f6dd5af155ac6b
+       data8 0x8955ee03618e5fdd, 0x89b540a7902557a4
+       data8 0x8a14d575496efd9a, 0x8a74ac9a79896e47
+       data8 0x8ad4c6452c728924, 0x8b3522a38e1e1032
+       data8 0x8b95c1e3ea8bd6e7, 0x8bf6a434adde0085
+       data8 0x8c57c9c4646f4dde, 0x8cb932c1bae97a95
+       data8 0x8d1adf5b7e5ba9e6, 0x8d7ccfc09c50e2f8
+       data8 0x8ddf042022e69cd6, 0x8e417ca940e35a01
+       data8 0x8ea4398b45cd53c0, 0x8f073af5a2013520
+       data8 0x8f6a8117e6c8e5c4, 0x8fce0c21c6726481
+       data8 0x9031dc431466b1dc, 0x9095f1abc540ca6b
+       data8 0x90fa4c8beee4b12b, 0x915eed13c89689d3
+       data8 0x91c3d373ab11c336, 0x9228ffdc10a051ad
+       data8 0x928e727d9531f9ac, 0x92f42b88f673aa7c
+       data8 0x935a2b2f13e6e92c, 0x93c071a0eef94bc1
+       data8 0x9426ff0fab1c04b6, 0x948dd3ac8ddb7ed3
+       data8 0x94f4efa8fef70961, 0x955c5336887894d5
+       data8 0x95c3fe86d6cc7fef, 0x962bf1cbb8d97560
+       data8 0x96942d3720185a00, 0x96fcb0fb20ac4ba3
+       data8 0x97657d49f17ab08e, 0x97ce9255ec4357ab
+       data8 0x9837f0518db8a96f, 0x98a1976f7597e996
+       data8 0x990b87e266c189aa, 0x9975c1dd47518c77
+       data8 0x99e0459320b7fa65, 0x9a4b13371fd166ca
+       data8 0x9ab62afc94ff864a, 0x9b218d16f441d63d
+       data8 0x9b8d39b9d54e5539, 0x9bf93118f3aa4cc1
+       data8 0x9c6573682ec32c2d, 0x9cd200db8a0774cb
+       data8 0x9d3ed9a72cffb751, 0x9dabfdff6367a2aa
+       data8 0x9e196e189d472420, 0x9e872a276f0b98ff
+       data8 0x9ef5326091a111ae, 0x9f6386f8e28ba651
+       data8 0x9fd228256400dd06, 0xa041161b3d0121be
+       data8 0xa0b0510fb9714fc2, 0xa11fd9384a344cf7
+       data8 0xa18faeca8544b6e4, 0xa1ffd1fc25cea188
+       data8 0xa27043030c496819, 0xa2e102153e918f9e
+       data8 0xa3520f68e802bb93, 0xa3c36b345991b47c
+       data8 0xa43515ae09e6809e, 0xa4a70f0c95768ec5
+       data8 0xa5195786be9ef339, 0xa58bef536dbeb6ee
+       data8 0xa5fed6a9b15138ea, 0xa6720dc0be08a20c
+       data8 0xa6e594cfeee86b1e, 0xa7596c0ec55ff55b
+       data8 0xa7cd93b4e965356a, 0xa8420bfa298f70d1
+       data8 0xa8b6d5167b320e09, 0xa92bef41fa77771b
+       data8 0xa9a15ab4ea7c0ef8, 0xaa1717a7b5693979
+       data8 0xaa8d2652ec907629, 0xab0386ef48868de1
+       data8 0xab7a39b5a93ed337, 0xabf13edf162675e9
+       data8 0xac6896a4be3fe929, 0xace0413ff83e5d04
+       data8 0xad583eea42a14ac6, 0xadd08fdd43d01491
+       data8 0xae493452ca35b80e, 0xaec22c84cc5c9465
+       data8 0xaf3b78ad690a4375, 0xafb51906e75b8661
+       data8 0xb02f0dcbb6e04584, 0xb0a957366fb7a3c9
+       data8 0xb123f581d2ac2590, 0xb19ee8e8c94feb09
+       data8 0xb21a31a66618fe3b, 0xb295cff5e47db4a4
+       data8 0xb311c412a9112489, 0xb38e0e38419fae18
+       data8 0xb40aaea2654b9841, 0xb487a58cf4a9c180
+       data8 0xb504f333f9de6484, 0xb58297d3a8b9f0d2
+       data8 0xb60093a85ed5f76c, 0xb67ee6eea3b22b8f
+       data8 0xb6fd91e328d17791, 0xb77c94c2c9d725e9
+       data8 0xb7fbefca8ca41e7c, 0xb87ba337a1743834
+       data8 0xb8fbaf4762fb9ee9, 0xb97c143756844dbf
+       data8 0xb9fcd2452c0b9deb, 0xba7de9aebe5fea09
+       data8 0xbaff5ab2133e45fb, 0xbb81258d5b704b6f
+       data8 0xbc034a7ef2e9fb0d, 0xbc85c9c560e7b269
+       data8 0xbd08a39f580c36bf, 0xbd8bd84bb67ed483
+       data8 0xbe0f6809860993e2, 0xbe935317fc378238
+       data8 0xbf1799b67a731083, 0xbf9c3c248e2486f8
+       data8 0xc0213aa1f0d08db0, 0xc0a6956e8836ca8d
+       data8 0xc12c4cca66709456, 0xc1b260f5ca0fbb33
+       data8 0xc238d2311e3d6673, 0xc2bfa0bcfad907c9
+       data8 0xc346ccda24976407, 0xc3ce56c98d21b15d
+       data8 0xc4563ecc5334cb33, 0xc4de8523c2c07baa
+       data8 0xc5672a115506dadd, 0xc5f02dd6b0bbc3d9
+       data8 0xc67990b5aa245f79, 0xc70352f04336c51e
+       data8 0xc78d74c8abb9b15d, 0xc817f681416452b2
+       data8 0xc8a2d85c8ffe2c45, 0xc92e1a9d517f0ecc
+       data8 0xc9b9bd866e2f27a3, 0xca45c15afcc72624
+       data8 0xcad2265e4290774e, 0xcb5eecd3b38597c9
+       data8 0xcbec14fef2727c5d, 0xcc799f23d11510e5
+       data8 0xcd078b86503dcdd2, 0xcd95da6a9ff06445
+       data8 0xce248c151f8480e4, 0xceb3a0ca5dc6a55d
+       data8 0xcf4318cf191918c1, 0xcfd2f4683f94eeb5
+       data8 0xd06333daef2b2595, 0xd0f3d76c75c5db8d
+       data8 0xd184df6251699ac6, 0xd2164c023056bcab
+       data8 0xd2a81d91f12ae45a, 0xd33a5457a3029054
+       data8 0xd3ccf099859ac379, 0xd45ff29e0972c561
+       data8 0xd4f35aabcfedfa1f, 0xd5872909ab75d18a
+       data8 0xd61b5dfe9f9bce07, 0xd6aff9d1e13ba2fe
+       data8 0xd744fccad69d6af4, 0xd7da67311797f56a
+       data8 0xd870394c6db32c84, 0xd9067364d44a929c
+       data8 0xd99d15c278afd7b6, 0xda3420adba4d8704
+       data8 0xdacb946f2ac9cc72, 0xdb63714f8e295255
+       data8 0xdbfbb797daf23755, 0xdc9467913a4f1c92
+       data8 0xdd2d818508324c20, 0xddc705bcd378f7f0
+       data8 0xde60f4825e0e9124, 0xdefb4e1f9d1037f2
+       data8 0xdf9612deb8f04420, 0xe031430a0d99e627
+       data8 0xe0ccdeec2a94e111, 0xe168e6cfd3295d23
+       data8 0xe2055afffe83d369, 0xe2a23bc7d7d91226
+       data8 0xe33f8972be8a5a51, 0xe3dd444c46499619
+       data8 0xe47b6ca0373da88d, 0xe51a02ba8e26d681
+       data8 0xe5b906e77c8348a8, 0xe658797368b3a717
+       data8 0xe6f85aaaee1fce22, 0xe798aadadd5b9cbf
+       data8 0xe8396a503c4bdc68, 0xe8da9958464b42ab
+       data8 0xe97c38406c4f8c57, 0xea1e4756550eb27b
+       data8 0xeac0c6e7dd24392f, 0xeb63b74317369840
+       data8 0xec0718b64c1cbddc, 0xecaaeb8ffb03ab41
+       data8 0xed4f301ed9942b84, 0xedf3e6b1d418a491
+       data8 0xee990f980da3025b, 0xef3eab20e032bc6b
+       data8 0xefe4b99bdcdaf5cb, 0xf08b3b58cbe8b76a
+       data8 0xf13230a7ad094509, 0xf1d999d8b7708cc1
+       data8 0xf281773c59ffb13a, 0xf329c9233b6bae9c
+       data8 0xf3d28fde3a641a5b, 0xf47bcbbe6db9fddf
+       data8 0xf5257d152486cc2c, 0xf5cfa433e6537290
+       data8 0xf67a416c733f846e, 0xf7255510c4288239
+       data8 0xf7d0df730ad13bb9, 0xf87ce0e5b2094d9c
+       data8 0xf92959bb5dd4ba74, 0xf9d64a46eb939f35
+       data8 0xfa83b2db722a033a, 0xfb3193cc4227c3f4
+       data8 0xfbdfed6ce5f09c49, 0xfc8ec01121e447bb
+       data8 0xfd3e0c0cf486c175, 0xfdedd1b496a89f35
+       data8 0xfe9e115c7b8f884c, 0xff4ecb59511ec8a5
+LOCAL_OBJECT_END(T_table)
+
+
+LOCAL_OBJECT_START(D_table)
+
+       data4 0x00000000, 0x9f55c08f, 0x1e93ffa3, 0x1dcd43a8
+       data4 0x1f751f79, 0x9f3cdd88, 0x9f43d155, 0x1eda222c
+       data4 0x1ef35513, 0x9f597895, 0x9e698881, 0x1ec71073
+       data4 0x1e50e371, 0x9dc01e19, 0x1de74133, 0x1e2f028c
+       data4 0x9edefb47, 0x1ebbac48, 0x9e8b0330, 0x9e9e9314
+       data4 0x1edc1d11, 0x1f098529, 0x9f52827c, 0x1f50050d
+       data4 0x1f301e8e, 0x1f5b64d1, 0x9f45e3ee, 0x9ef64d6d
+       data4 0x1d6ec5e8, 0x9e61ad9a, 0x1d44ccbb, 0x9e4a8bbb
+       data4 0x9cf11576, 0x9dcce7e7, 0x9d02ac90, 0x1f26ccf0
+       data4 0x9f0877c6, 0x9ddd62ae, 0x9f4b7fc3, 0x1ea8ef6b
+       data4 0x1ea4378d, 0x1ef6fc38, 0x1db99fd9, 0x1f22bf6f
+       data4 0x1f53e172, 0x1e85504a, 0x9f37cc75, 0x1f0c5e17
+       data4 0x1dde8aac, 0x9cb42bb2, 0x1e153cd7, 0x1eb62bba
+       data4 0x9e9b941b, 0x9ea80e3c, 0x1f508823, 0x1ec3fd36
+       data4 0x1e9ffaa1, 0x1e21e2eb, 0x9d948b1d, 0x9e8ac93a
+       data4 0x1ef7ee6f, 0x9e80dda3, 0x1f0814be, 0x1dc5ddfe
+       data4 0x1eedb9d1, 0x9f2aaa26, 0x9ea5b0fc, 0x1edf702e
+       data4 0x9e391201, 0x1f1316bb, 0x1ea27fb7, 0x9e05ed18
+       data4 0x9f199ed2, 0x1ee7fd7c, 0x1f003db6, 0x9eac3793
+       data4 0x9e5b8c10, 0x9f3af17c, 0x1bc9a8be, 0x1ee3c004
+       data4 0x9f19b1b2, 0x9f242ce9, 0x9ce67dd1, 0x9e4f6275
+       data4 0x1e20742c, 0x1eb9328a, 0x9f477153, 0x1d969718
+       data4 0x9f1e6c43, 0x1f2f67f4, 0x9f39c7e4, 0x9e3c4feb
+       data4 0x1da3956b, 0x9e7c685d, 0x1f280911, 0x9f0d8afb
+       data4 0x1e314b40, 0x9eb4f250, 0x9f1a34ad, 0x1ef5d5e7
+       data4 0x9f145496, 0x1e604827, 0x9f1e5195, 0x1e9c1fc0
+       data4 0x1efde521, 0x1e69b385, 0x1f316830, 0x9f244eae
+       data4 0x1f1787ec, 0x9e939971, 0x1f0bb393, 0x9f0511d6
+       data4 0x1ed919de, 0x1d8b7b28, 0x1e5ca4a9, 0x1e7c357b
+       data4 0x9e3ff8e8, 0x1eef53b5, 0x9ed22ed7, 0x1f16659b
+       data4 0x9f2db102, 0x9e2c6a78, 0x1f328d7d, 0x9f2fec3c
+       data4 0x1eb395bd, 0x9f242b84, 0x9e2683e6, 0x1ed71e68
+       data4 0x1efd1df5, 0x9e9eeafd, 0x9ed2249c, 0x1eef129a
+       data4 0x1d1ea44c, 0x9e81f7ff, 0x1eaf77c9, 0x9ee7a285
+       data4 0x1e1864ed, 0x9ee7edbb, 0x9e15a27d, 0x9ae61655
+       data4 0x1f1ff1a2, 0x1da29755, 0x9e5f46fb, 0x1e901236
+       data4 0x9eecfb9b, 0x9f204d2f, 0x1ec64685, 0x9eb809bd
+       data4 0x9e0026c5, 0x1d9f1da1, 0x1f142b49, 0x9f20f22e
+       data4 0x1f24b067, 0x1f185a4c, 0x9f09765c, 0x9ece902f
+       data4 0x1e2ca5db, 0x1e6de464, 0x9f071f67, 0x1f1518c3
+       data4 0x1ea13ded, 0x1f0b8414, 0x1edb6ad4, 0x9e548740
+       data4 0x9ea10efb, 0x1ee48a60, 0x1e7954c5, 0x9edad013
+       data4 0x9f21517d, 0x9e9b6e0c, 0x9ee7f9a6, 0x9ebd4298
+       data4 0x9d65b24e, 0x1eed751f, 0x9f1573ea, 0x9d430377
+       data4 0x9e13fc0c, 0x1e47008a, 0x1e3d5c1d, 0x1ef41a91
+       data4 0x9e4a4ef7, 0x9e952f18, 0x1d620566, 0x1d9b8d33
+       data4 0x1db06247, 0x1e94b31e, 0x1f0730ad, 0x9d79ffb4
+       data4 0x1ed64d51, 0x9e91fd11, 0x9e28d35a, 0x9dea0ed9
+       data4 0x1e891def, 0x9ee28ac0, 0x1e1db99b, 0x9ee1ce38
+       data4 0x9bdd9bca, 0x1eb72cb9, 0x9e8c53c6, 0x1e0df6ca
+       data4 0x1e8f2ccd, 0x9e9b0886, 0x1eeb3bc7, 0x1ec7e772
+       data4 0x9e210776, 0x9daf246c, 0x1ea1f151, 0x1ece4dc6
+       data4 0x1ce741c8, 0x1ed3c88f, 0x9ec9a4fd, 0x9e0c8d30
+       data4 0x1d2fbb26, 0x9ef212a7, 0x1ee44f1c, 0x9e445550
+       data4 0x1e075f77, 0x9d9291a3, 0x1f09c2ee, 0x9e012c88
+       data4 0x1f057d62, 0x9e7bb0dc, 0x9d8758ee, 0x1ee8d6c1
+       data4 0x9e509a57, 0x9e4ca7b7, 0x1e2cb341, 0x9ec35106
+       data4 0x1ecf3baf, 0x1e11781c, 0x1ea0cc78, 0x1eb75ca6
+       data4 0x1e961e1a, 0x1eb88853, 0x1e7abf50, 0x1ee38704
+       data4 0x9dc5ab0f, 0x1afe197b, 0x9ec07523, 0x9d9b7f78
+       data4 0x1f011618, 0x1ed43b0b, 0x9f035945, 0x9e3fd014
+       data4 0x9bbda5cd, 0x9e83f8ab, 0x1e58a928, 0x1e392d61
+       data4 0x1efdbb52, 0x1ee310a8, 0x9ec7ecc1, 0x1e8c9ed6
+       data4 0x9ef82dee, 0x9e70545b, 0x9ea53fc4, 0x1e40f419
+LOCAL_OBJECT_END(D_table)
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(exp2l)
+
+{.mii
+       // get exponent
+       getf.exp GR_EBIAS = f8
+       // GR_D_ADDR0 = pointer to D_table
+       addl GR_D_ADDR0 = @ltoff(D_table), gp
+       // GR_ADDR0 = pointer to C_1...C_6 followed by T_table
+       addl GR_ADDR0 = @ltoff(poly_coeffs), gp ;;
+}
+
+{.mfi
+       // get significand
+       getf.sig GR_SIGNIF = f8
+       // will continue only for normal/denormal numbers
+       fclass.nm.unc p12, p7 = f8, 0x1b
+       mov GR_63 = 63 ;;
+}
+
+{.mfi
+       nop.m 0
+       nop.f 0
+       // GR_CONST2 = bias+63-8
+       mov GR_CONST2 = 0xffff+55
+}
+{.mfi
+       // GR_CONST1 = bias+15
+       mov GR_CONST1 = 0xffff+15
+       nop.f 0
+       mov GR_CONST3 = 0x1ffff ;;
+}
+
+{.mfi
+       // load start address for C_1...C_6 followed by T_table
+       ld8 GR_ADDR = [ GR_ADDR0 ]
+       nop.f 0
+       // get sign of argument
+       andcm GR_SGN = GR_EBIAS, GR_CONST3
+}
+{.mfi
+       // GR_D_ADDR = pointer to D_table
+       ld8 GR_D_ADDR = [ GR_D_ADDR0 ]
+       nop.f 0
+       // get argument exponent
+       and GR_ARGEXP = GR_CONST3, GR_EBIAS ;;
+}
+
+{.mfi
+       alloc GR_SREG = ar.pfs, 1, 4, 4, 0
+       nop.f 0
+       // p6 = 1 if sign = 1
+       cmp.ne p6, p8 = GR_SGN, r0
+}
+{.mfi
+       // p7 = 1 if exponent> = 15 (argument out of range)
+       cmp.ge p7, p0 = GR_ARGEXP, GR_CONST1
+       nop.f 0
+       sub GR_EXPON = GR_CONST2, GR_ARGEXP ;;
+}
+
+{.mib
+       // load C_3, C_4
+       ldfpd FR_COEFF3, FR_COEFF4 = [ GR_ADDR ], 16
+       // get first exponent+8 bits
+       shr.u GR_LEADBITS = GR_SIGNIF, GR_EXPON
+ (p12) br.cond.spnt SPECIAL_exp2l
+}
+{.mib
+       mov GR_256 = 256
+       // exponent- = 63
+       sub GR_EM63 = GR_EBIAS, GR_63
+  (p7) br.cond.spnt OUT_RANGE_exp2l ;;
+}
+
+{.mlx
+       // load C_5, C_6
+       ldfpd FR_COEFF5, FR_COEFF6 = [ GR_ADDR ], 16
+       // GR_2P14 = 2^14
+       movl GR_2P14 = 0x46800000 ;;
+}
+
+{.mfi
+       // load C_1
+       ldfe FR_COEFF1 = [ GR_ADDR ], 16
+       fma.s0 f8 = f8, f1, f0
+       // GR_BM63 = bias-63
+       mov GR_BM63 = 0xffff-63 ;;
+}
+
+{.mlx
+       setf.s FR_2P14 = GR_2P14
+       // GR_UF_TEST = -2^14-62
+       movl GR_UF_TEST = 0xc6807c00
+}
+{.mfi
+       // load C_2
+       ldfe FR_COEFF2 = [ GR_ADDR ], 16
+       nop.f 0
+       mov GR_255 = 255 ;;
+}
+
+{.mib
+       // get 8-bit index
+       and GR_INDEX = GR_255, GR_LEADBITS
+       // get K = integer part
+       shr.u GR_K = GR_LEADBITS, 8
+       nop.b 0 ;;
+}
+
+{.mmi
+       // if sign = 1 && f>0, set p7 = 1
+  (p6) cmp.gt.unc p7, p0 = GR_INDEX, r0
+       setf.s FR_UF_TEST = GR_UF_TEST
+       shl GR_KF = GR_LEADBITS, GR_EXPON ;;
+}
+
+{.mfi
+       // if sign = 1 && f>0, set f = 1-f
+  (p7) sub GR_INDEX = GR_256, GR_INDEX
+       nop.f 0
+       // if sign = 1 && f>0, set K = K+1
+  (p7) add GR_K = GR_K, r0, 1 ;;
+}
+
+{.mfi
+       // FR_EXP63 = 2^{expon-63}
+       setf.exp FR_EXP63 = GR_EM63
+       nop.f 0
+       nop.i 0 ;;
+}
+
+.pred.rel "mutex", p6, p8
+{.mfi
+       // if sign = 0, set scale factor exponent S = K+bias-63
+  (p8) add GR_K = GR_K, GR_BM63
+       nop.f 0
+       // if sign = 1, set scale factor exponent S = -K+bias-63
+  (p6) sub GR_K = GR_BM63, GR_K ;;
+}
+
+{.mmi
+       // FR_KF0 = 2^{63-expon}*(K+f)
+       setf.sig FR_KF0 = GR_KF
+       nop.m 0
+       // GR_EMIN = EMIN = 2-2^14
+       mov GR_EMIN = 0x18cfff ;;
+}
+
+{.mfi
+       // get T_table index
+       shladd GR_IT = GR_INDEX, 3, GR_ADDR
+       // p7 = 1 if x> = 2^10
+       fcmp.ge.s1 p7, p12 = f8, FR_2P14
+       // get D_table index
+       shladd GR_ID = GR_INDEX, 2, GR_D_ADDR ;;
+}
+
+{.mfi
+       // load T_table value
+       ldf8 FR_T = [ GR_IT ]
+       // p7 = 1 if x<-2^10-50
+ (p12) fcmp.lt.s1 p7, p0 = f8, FR_UF_TEST
+       // GR_EMIN1 = EMIN = 2-2^14
+       shl GR_EMIN1 = GR_EMIN, 11 ;;
+}
+
+{.mmb
+       // f50 = scale factor = 2^{K-63}
+       setf.exp FR_2EXP = GR_K
+       // load D_table value
+       ldfs FR_D = [ GR_ID ]
+  (p7) br.cond.spnt OUT_RANGE_exp2l ;;
+}
+
+{.mfi
+       nop.m 0
+       // get r = x-(K+f)
+       fnma.s1 FR_R = FR_KF0, FR_EXP63, f8
+       nop.i 0 ;;
+}
+
+{.mfi
+       // FR_EMIN = EMIN
+       setf.s FR_EMIN = GR_EMIN1
+       // P34 = C_4*r+C_3
+       fma.s1 FR_P34 = FR_COEFF4, FR_R, FR_COEFF3
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // P56 = C_6*r+C_5
+       fma.s1 FR_P56 = FR_COEFF6, FR_R, FR_COEFF5
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       //  r*r
+       fma.s1 FR_R2 = FR_R, FR_R, f0
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // P12 = C_2*r+C_1
+       fma.s1 FR_P12 = FR_COEFF2, FR_R, FR_COEFF1
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // T* = scaling factor
+       fma.s1 FR_TS = FR_T, FR_2EXP, f0
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // P36 = P34+r2*P56
+       fma.s1 FR_P36 = FR_P56, FR_R2, FR_P34
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // P02 = D+r*P12
+       fma.s1 FR_P02 = FR_P12, FR_R, FR_D
+       nop.i 0
+}
+{.mfi
+       nop.m 0
+       // GR_ID = r*r2
+       fma.s1 FR_R3 = FR_R2, FR_R, f0
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // P06 = P02+r3*P36
+       fma.s1 FR_P06 = FR_P36, FR_R3, FR_P02
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // underflow (x<EMIN) ?
+       fcmp.lt.s0 p6, p8 = f8, FR_EMIN
+       nop.i 0 ;;
+}
+
+{.mfb
+       nop.m 0
+       // result = T+T*P06
+       fma.s0 f8 = FR_TS, FR_P06, FR_TS
+       // return
+  (p8) br.ret.sptk b0
+}
+{.mfb
+  (p6) mov GR_Parameter_TAG = 160
+       nop.f 0
+  (p6) br.cond.sptk __libm_error_region ;;
+}
+
+
+SPECIAL_exp2l:
+
+{.mfi
+       nop.m 0
+       // x = -Infinity ?
+       fclass.m p6, p0 = f8, 0x22
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // x = +Infinity ?
+       fclass.m p7, p0 = f8, 0x21
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // x = +/-Zero ?
+       fclass.m p8, p0 = f8, 0x7
+       nop.i 0
+}
+{.mfb
+       nop.m 0
+       // exp2l(-Infinity) = 0
+  (p6) mov f8 = f0
+  (p6) br.ret.spnt b0 ;;
+}
+
+{.mfb
+       nop.m 0
+       // exp2l(+Infinity) = +Infinity
+       nop.f 0
+  (p7) br.ret.spnt b0 ;;
+}
+
+{.mfb
+       nop.m 0
+       // exp2l(+/-0) = 1
+  (p8) mov f8 = f1
+  (p8) br.ret.spnt b0 ;;
+}
+
+{.mfb
+       nop.m 0
+       // Remaining cases: NaNs
+       fma.s0 f8 = f8, f1, f0
+       br.ret.sptk b0 ;;
+}
+
+
+OUT_RANGE_exp2l:
+
+
+{.mfi
+       // overflow: p8 = 1
+  (p8) mov GR_EM63 = 0x1fffe
+       // normalize input, to detect pseudo-zeroes
+       fma.s0 f8 = f8, f1, f0
+       nop.i 0 ;;
+}
+
+{.mfi
+       nop.m 0
+       // f8 = 0?
+       fcmp.eq.s1 p7, p0 = f8, f0
+       nop.i 0 ;;
+}
+
+{.mmb
+  (p8) mov GR_Parameter_TAG = 159
+  (p8) setf.exp FR_TS = GR_EM63
+       nop.b 999 ;;
+}
+
+{.mfb
+       nop.m 0
+       // pseudo-zero
+  (p7) mov f8 = f1
+  (p7) br.ret.sptk b0 ;;
+}
+
+{.mfi
+       nop.m 999
+  (p8) fma.s0 f8 = FR_TS, FR_TS, f0
+       nop.i 999
+}
+{.mii
+       nop.m 0
+       // underflow: p6 = 1
+  (p6) mov GR_EM63 = 1
+       nop.i 0 ;;
+}
+
+{.mmb
+  (p6) mov GR_Parameter_TAG = 160
+  (p6) setf.exp FR_TS = GR_EM63
+       nop.b 999 ;;
+}
+
+{.mfb
+       nop.m 999
+  (p6) fma.s0 f8 = FR_TS, FR_TS, f0
+       nop.b 0 ;;
+}
+
+
+GLOBAL_LIBM_END(exp2l)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{.mfi
+       add GR_Parameter_Y = -32, sp // Parameter 2 value
+       nop.f 0
+.save ar.pfs, GR_SAVE_PFS
+       mov GR_SAVE_PFS = ar.pfs // Save ar.pfs
+}
+{.mfi
+.fframe 64
+       add sp = -64, sp // Create new stack
+       nop.f 0
+       mov GR_SAVE_GP = gp ;; // Save gp
+}
+
+{.mmi
+       stfe [ GR_Parameter_Y ] = FR_Y, 16 // STORE Parameter 2 on stack
+       add GR_Parameter_X = 16, sp // Parameter 1 address
+.save b0, GR_SAVE_B0
+       mov GR_SAVE_B0 = b0 ;; // Save b0
+}
+
+.body
+{.mib
+       stfe [ GR_Parameter_X ] = FR_X // STORE Parameter 1 on stack
+       add GR_Parameter_RESULT = 0, GR_Parameter_Y // Parameter 3 address
+       nop.b 0
+}
+{.mib
+       stfe [ GR_Parameter_Y ] = FR_RESULT // STORE Parameter 3 on stack
+       add GR_Parameter_Y = -16, GR_Parameter_Y
+       br.call.sptk b0 = __libm_error_support# ;; // Call error handling function
+}
+
+{.mmi
+       add GR_Parameter_RESULT = 48, sp
+       nop.m 0
+       nop.i 0 ;;
+}
+
+{.mmi
+       ldfe f8 = [ GR_Parameter_RESULT ] // Get return result off stack
+.restore sp
+       add sp = 64, sp // Restore stack pointer
+       mov b0 = GR_SAVE_B0 ;; // Restore return address
+}
+
+{.mib
+       mov gp = GR_SAVE_GP // Restore gp
+       mov ar.pfs = GR_SAVE_PFS // Restore ar.pfs
+       br.ret.sptk b0 ;; // Return
+}
+
+
+LOCAL_LIBM_END(__libm_error_region)
+.type __libm_error_support#, @function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_expf.S b/sysdeps/ia64/fpu/e_expf.S
index 2aad021335..6fe0a833e2 100644
--- a/sysdeps/ia64/fpu/e_expf.S
+++ b/sysdeps/ia64/fpu/e_expf.S
@@ -1,10 +1,10 @@
 .file "expf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,589 +35,503 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 
 // History
-//==============================================================
-// 4/04/00  Unwind update
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+//*********************************************************************
+// 02/02/00 Original version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 8/21/00  Improvements to save 2 cycles on main path, and shorten x=0 case
+// 08/21/00 Improvements to save 2 cycles on main path, and shorten x=0 case
 // 12/07/00 Widen main path, shorten x=inf, nan paths
+// 03/15/01 Fix monotonicity problem around x=0 for round to +inf
+// 02/05/02 Corrected uninitialize predicate in POSSIBLE_UNDERFLOW path
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 07/26/02 Algorithm changed, accuracy improved
+// 09/26/02 support of higher precision inputs added, underflow threshold
+//          corrected
+// 11/15/02 Improved performance on Itanium 2, added possible over/under paths
+// 05/30/03 Set inexact flag on unmasked overflow/underflow
+// 03/31/05 Reformatted delimiters between data tables
+//
+//
+// API
+//*********************************************************************
+// float expf(float)
+//
+// Overview of operation
+//*********************************************************************
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 64/log2
+//  NJ = int(w)
+//  x = NJ*log2/64 + R
+
+//  NJ = 64*n + j
+//  x = n*log2 + (log2/64)*j + R
+//
+//  So, exp(x) = 2^n * 2^(j/64)* exp(R)
+//
+//  T =  2^n * 2^(j/64)
+//       Construct 2^n
+//       Get 2^(j/64) table
+//           actually all the entries of 2^(j/64) table are stored in DP and
+//           with exponent bits set to 0 -> multiplication on 2^n can be
+//           performed by doing logical "or" operation with bits presenting 2^n
+
+//  exp(R) = 1 + (exp(R) - 1)
+//  P = exp(R) - 1 approximated by Taylor series of 3rd degree
+//      P = A3*R^3 + A2*R^2 + R, A3 = 1/6, A2 = 1/2
 //
 
-#include "libm_support.h"
-
-// Assembly macros
-//==============================================================
-// integer registers used
-
- exp_GR_0x0f                = r33
- exp_GR_0xf0                = r34
+//  The final result is reconstructed as follows
+//  exp(x) = T + T*P
 
- EXP_AD_P_1                 = r36
- EXP_AD_P_2                 = r37
- EXP_AD_T1                  = r38
- EXP_AD_T2                  = r39
- exp_GR_Mint                = r40
+// Special values
+//*********************************************************************
+// expf(+0)    = 1.0
+// expf(-0)    = 1.0
 
- exp_GR_Mint_p_128          = r41
- exp_GR_Ind1                = r42
- EXP_AD_M1                  = r43
- exp_GR_Ind2                = r44
- EXP_AD_M2                  = r45
+// expf(+qnan) = +qnan
+// expf(-qnan) = -qnan
+// expf(+snan) = +qnan
+// expf(-snan) = -qnan
 
- exp_GR_min_oflow           = r46
- exp_GR_max_zero            = r47
- exp_GR_max_norm            = r48
- exp_GR_max_uflow           = r49
- exp_GR_min_norm            = r50
+// expf(-inf)  = +0
+// expf(+inf)  = +inf
 
- exp_GR_17ones              = r51
- exp_GR_gt_ln               = r52
- exp_GR_T2_size             = r53
+// Overflow and Underflow
+//*********************************************************************
+// expf(x) = largest single normal when
+//     x = 88.72283 = 0x42b17217
 
- exp_GR_17ones_m1           = r56
- exp_GR_one                 = r57
+// expf(x) = smallest single normal when
+//     x = -87.33654 = 0xc2aeac4f
 
+// expf(x) = largest round-to-nearest single zero when
+//     x = -103.97208 = 0xc2cff1b5
 
 
-GR_SAVE_B0                    = r53
-GR_SAVE_PFS                   = r55
-GR_SAVE_GP                    = r54 
+// Registers used
+//*********************************************************************
+// Floating Point registers used:
+// f8, input
+// f6,f7, f9 -> f15,  f32 -> f40
 
-GR_Parameter_X                = r59
-GR_Parameter_Y                = r60
-GR_Parameter_RESULT           = r61
-GR_Parameter_TAG              = r62
+// General registers used:
+// r3, r23 -> r38
 
-FR_X             = f10
-FR_Y             = f1
-FR_RESULT        = f8
+// Predicate registers used:
+// p10 -> p15
 
+// Assembly macros
+//*********************************************************************
+// integer registers used
+// scratch
+rNJ                   = r3
+
+rTmp                  = r23
+rJ                    = r23
+rN                    = r24
+rTblAddr              = r25
+rA3                   = r26
+rExpHalf              = r27
+rLn2Div64             = r28
+r17ones_m1            = r29
+rGt_ln                = r29
+rRightShifter         = r30
+r64DivLn2             = r31
+// stacked
+GR_SAVE_PFS           = r32
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_Parameter_X        = r35
+GR_Parameter_Y        = r36
+GR_Parameter_RESULT   = r37
+GR_Parameter_TAG      = r38
 
 // floating point registers used
-
- EXP_MIN_SGL_OFLOW_ARG      = f11
- EXP_MAX_SGL_ZERO_ARG       = f12
- EXP_MAX_SGL_NORM_ARG       = f13
- EXP_MAX_SGL_UFLOW_ARG      = f14
- EXP_MIN_SGL_NORM_ARG       = f15
-
- exp_coeff_P5               = f32
- exp_coeff_P6               = f33
- exp_coeff_P3               = f34
- exp_coeff_P4               = f35
-
- exp_coeff_P1               = f36
- exp_coeff_P2               = f37
- exp_Mx                     = f38
- exp_Mfloat                 = f39
- exp_R                      = f40
-
- exp_P1                     = f41
- exp_P2                     = f42
- exp_P3                     = f43
- exp_Rsq                    = f44
- exp_R4                     = f45
-
- exp_P4                     = f46
- exp_P5                     = f47
- exp_P6                     = f48
- exp_P7                     = f49
- exp_T1                     = f50
-
- exp_T2                     = f51
- exp_T                      = f52
- exp_A                      = f53
- exp_norm_f8                = f54
- exp_wre_urm_f8             = f55
-
- exp_ftz_urm_f8             = f56
- exp_gt_pln                 = f57
-
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+FR_X                  = f10
+FR_Y                  = f1
+FR_RESULT             = f8
+// scratch
+fRightShifter         = f6
+f64DivLn2             = f7
+fNormX                = f9
+fNint                 = f10
+fN                    = f11
+fR                    = f12
+fLn2Div64             = f13
+fA2                   = f14
+fA3                   = f15
+// stacked
+fP                    = f32
+fT                    = f33
+fMIN_SGL_OFLOW_ARG    = f34
+fMAX_SGL_ZERO_ARG     = f35
+fMAX_SGL_NORM_ARG     = f36
+fMIN_SGL_NORM_ARG     = f37
+fRSqr                 = f38
+fTmp                  = f39
+fGt_pln               = f39
+fWre_urm_f8           = f40
+fFtz_urm_f8           = f40
+
+
+RODATA
 .align 16
 
-exp_coeff_1_table:
-ASM_TYPE_DIRECTIVE(exp_coeff_1_table,@object)
-data8 0x3F56F35FDE4F8563 // p5
-data8 0x3F2A378BEFECCFDD // p6
-data8 0x3FE00000258C581D // p1
-data8 0x3FC555557AE7B3D4 // p2
-ASM_SIZE_DIRECTIVE(exp_coeff_1_table)
-
-
-exp_coeff_2_table:
-ASM_TYPE_DIRECTIVE(exp_coeff_2_table,@object)
-data8 0x3FA5551BB6592FAE // p3
-data8 0x3F8110E8EBFFD485 // p4
-ASM_SIZE_DIRECTIVE(exp_coeff_2_table)
-
-
-exp_T2_table:
-ASM_TYPE_DIRECTIVE(exp_T2_table,@object)
-data8 0xa175cf9cd7d85844 , 0x00003f46 // exp(-128)
-data8 0xdb7279415a1f9eed , 0x00003f47 // exp(-127)
-data8 0x95213b242bd8ca5f , 0x00003f49 // exp(-126)
-data8 0xcab03c968c989f83 , 0x00003f4a // exp(-125)
-data8 0x89bdb674702961ad , 0x00003f4c // exp(-124)
-data8 0xbb35a2eec278be35 , 0x00003f4d // exp(-123)
-data8 0xfe71b17f373e7e7a , 0x00003f4e // exp(-122)
-data8 0xace9a6ec52a39b63 , 0x00003f50 // exp(-121)
-data8 0xeb03423fe393cf1c , 0x00003f51 // exp(-120)
-data8 0x9fb52c5bcaef1693 , 0x00003f53 // exp(-119)
-data8 0xd910b6377ed60bf1 , 0x00003f54 // exp(-118)
-data8 0x9382dad8a9fdbfe4 , 0x00003f56 // exp(-117)
-data8 0xc87d0a84dea869a3 , 0x00003f57 // exp(-116)
-data8 0x883efb4c6d1087b0 , 0x00003f59 // exp(-115)
-data8 0xb92d7373dce9a502 , 0x00003f5a // exp(-114)
-data8 0xfbaeb020577fb0cb , 0x00003f5b // exp(-113)
-ASM_SIZE_DIRECTIVE(exp_T2_table)
-
-
-exp_T1_table:
-ASM_TYPE_DIRECTIVE(exp_T1_table,@object)
-data8 0x8000000000000000 , 0x00003fff // exp(16 * 0)
-data8 0x87975e8540010249 , 0x00004016 // exp(16 * 1) 
-data8 0x8fa1fe625b3163ec , 0x0000402d // exp(16 * 2) 
-data8 0x9826b576512a59d7 , 0x00004044 // exp(16 * 3) 
-data8 0xa12cc167acbe6902 , 0x0000405b // exp(16 * 4) 
-data8 0xaabbcdcc279f59e4 , 0x00004072 // exp(16 * 5) 
-data8 0xb4dbfaadc045d16f , 0x00004089 // exp(16 * 6) 
-data8 0xbf95e372ccdbf146 , 0x000040a0 // exp(16 * 7) 
-data8 0xcaf2a62eea10bbfb , 0x000040b7 // exp(16 * 8) 
-data8 0xd6fbeb62fddbd340 , 0x000040ce // exp(16 * 9) 
-data8 0xe3bbee32e4a440ea , 0x000040e5 // exp(16 * 10)
-data8 0xf13d8517c34199a8 , 0x000040fc // exp(16 * 11)
-data8 0xff8c2b166241eedd , 0x00004113 // exp(16 * 12)
-data8 0x875a04c0b38d6129 , 0x0000412b // exp(16 * 13)
-data8 0x8f610127db6774d7 , 0x00004142 // exp(16 * 14)
-data8 0x97e1dd87e5c20bb6 , 0x00004159 // exp(16 * 15)
-ASM_SIZE_DIRECTIVE(exp_T1_table)
-
-// Argument Reduction
-//  exp_Mx = (int)f8            ==> The value of f8 rounded to int is placed into the
-//                                  significand of exp_Mx as a two's
-//                                  complement number.
-
-// Later we want to have exp_Mx in a general register. Do this with a getf.sig
-// and call the general register exp_GR_Mint
-
-//  exp_Mfloat = (float)(int)f8 ==> the two's complement number in
-//                                  significand of exp_Mx is turned
-//                                  into a floating point number.
-//  R = 1 - exp_Mfloat          ==> reduced argument
-
-// Core Approximation
-// Calculate a series in R
-//  R * p6 + p5
-//  R * p4 + p3
-//  R * p2 + p1
-//  R^2
-//  R^4
-//  R^2(R * p6 + p5) + (R * p4 + p3)
-//  R^2(R * p2 + p1)
-//  R^4(R^2(R * p6 + p5) + (R * p4 + p3)) + (R^2(R * p2 + p1))
-//  R + 1
-//  exp(R) = (1 + R) + R^4(R^2(R * p6 + p5) + (R * p4 + p3)) + (R^2(R * p2 + p1))
-//  exp(R) = 1 + R + R^2 * p1 + R^3 * p2 + R^4 * p3 + R^5 * p4 + R^6 * p5 + R^7 * p6
-
-// Reconstruction
-// signficand of exp_Mx is two's complement,
-// -103 < x < 89
-// The smallest single denormal is 2^-149 = ssdn
-//    For e^x = ssdn
-//        x   = log(ssdn) = -103.279
-//    But with rounding result goes to ssdn until -103.972079
-// The largest single normal is  1.<23 1's> 2^126 ~ 2^127 = lsn
-//    For e^x = lsn
-//        x   = log(lsn) = 88.7228
+LOCAL_OBJECT_START(_expf_table)
+data4 0x42b17218         // Smallest sgl arg to overflow sgl result, +88.7228
+data4 0xc2cff1b5         // Largest sgl for rnd-to-nearest 0 result, -103.9720
+data4 0x42b17217         // Largest sgl arg to give normal sgl result, +88.7228
+data4 0xc2aeac4f         // Smallest sgl arg to give normal sgl result, -87.3365
 //
-// expf overflows                       when x > 42b17218 = 88.7228
-// expf returns largest single denormal when x = c2aeac50
-// expf goes to zero when                    x < c2cff1b5 
-
-// Consider range of 8-bit two's complement, -128 ---> 127
-// Add 128; range becomes                       0 ---> 255
-
-// The number (=i) in 0 ---> 255 is used as offset into two tables.
+// 2^(j/64) table, j goes from 0 to 63
+data8 0x0000000000000000 // 2^(0/64)
+data8 0x00002C9A3E778061 // 2^(1/64)
+data8 0x000059B0D3158574 // 2^(2/64)
+data8 0x0000874518759BC8 // 2^(3/64)
+data8 0x0000B5586CF9890F // 2^(4/64)
+data8 0x0000E3EC32D3D1A2 // 2^(5/64)
+data8 0x00011301D0125B51 // 2^(6/64)
+data8 0x0001429AAEA92DE0 // 2^(7/64)
+data8 0x000172B83C7D517B // 2^(8/64)
+data8 0x0001A35BEB6FCB75 // 2^(9/64)
+data8 0x0001D4873168B9AA // 2^(10/64)
+data8 0x0002063B88628CD6 // 2^(11/64)
+data8 0x0002387A6E756238 // 2^(12/64)
+data8 0x00026B4565E27CDD // 2^(13/64)
+data8 0x00029E9DF51FDEE1 // 2^(14/64)
+data8 0x0002D285A6E4030B // 2^(15/64)
+data8 0x000306FE0A31B715 // 2^(16/64)
+data8 0x00033C08B26416FF // 2^(17/64)
+data8 0x000371A7373AA9CB // 2^(18/64)
+data8 0x0003A7DB34E59FF7 // 2^(19/64)
+data8 0x0003DEA64C123422 // 2^(20/64)
+data8 0x0004160A21F72E2A // 2^(21/64)
+data8 0x00044E086061892D // 2^(22/64)
+data8 0x000486A2B5C13CD0 // 2^(23/64)
+data8 0x0004BFDAD5362A27 // 2^(24/64)
+data8 0x0004F9B2769D2CA7 // 2^(25/64)
+data8 0x0005342B569D4F82 // 2^(26/64)
+data8 0x00056F4736B527DA // 2^(27/64)
+data8 0x0005AB07DD485429 // 2^(28/64)
+data8 0x0005E76F15AD2148 // 2^(29/64)
+data8 0x0006247EB03A5585 // 2^(30/64)
+data8 0x0006623882552225 // 2^(31/64)
+data8 0x0006A09E667F3BCD // 2^(32/64)
+data8 0x0006DFB23C651A2F // 2^(33/64)
+data8 0x00071F75E8EC5F74 // 2^(34/64)
+data8 0x00075FEB564267C9 // 2^(35/64)
+data8 0x0007A11473EB0187 // 2^(36/64)
+data8 0x0007E2F336CF4E62 // 2^(37/64)
+data8 0x00082589994CCE13 // 2^(38/64)
+data8 0x000868D99B4492ED // 2^(39/64)
+data8 0x0008ACE5422AA0DB // 2^(40/64)
+data8 0x0008F1AE99157736 // 2^(41/64)
+data8 0x00093737B0CDC5E5 // 2^(42/64)
+data8 0x00097D829FDE4E50 // 2^(43/64)
+data8 0x0009C49182A3F090 // 2^(44/64)
+data8 0x000A0C667B5DE565 // 2^(45/64)
+data8 0x000A5503B23E255D // 2^(46/64)
+data8 0x000A9E6B5579FDBF // 2^(47/64)
+data8 0x000AE89F995AD3AD // 2^(48/64)
+data8 0x000B33A2B84F15FB // 2^(49/64)
+data8 0x000B7F76F2FB5E47 // 2^(50/64)
+data8 0x000BCC1E904BC1D2 // 2^(51/64)
+data8 0x000C199BDD85529C // 2^(52/64)
+data8 0x000C67F12E57D14B // 2^(53/64)
+data8 0x000CB720DCEF9069 // 2^(54/64)
+data8 0x000D072D4A07897C // 2^(55/64)
+data8 0x000D5818DCFBA487 // 2^(56/64)
+data8 0x000DA9E603DB3285 // 2^(57/64)
+data8 0x000DFC97337B9B5F // 2^(58/64)
+data8 0x000E502EE78B3FF6 // 2^(59/64)
+data8 0x000EA4AFA2A490DA // 2^(60/64)
+data8 0x000EFA1BEE615A27 // 2^(61/64)
+data8 0x000F50765B6E4540 // 2^(62/64)
+data8 0x000FA7C1819E90D8 // 2^(63/64)
+LOCAL_OBJECT_END(_expf_table)
 
-// i = abcd efgh = abcd * 16 + efgh = i1 * 16 + i2
-
-// i1 = (exp_GR_Mint + 128)  & 0xf0 (show 0xf0 as -0x10 to avoid assembler error)
-//                                  (The immediate in the AND is an 8-bit two's complement)
-// i1 = i1 + start of T1 table (EXP_AD_T1)
-//    Note that the entries in T1 are double-extended numbers on 16-byte boundaries
-//    and that i1 is already shifted left by 16 after the AND.
-
-// i2 must be shifted left by 4 before adding to the start of the table.
-// i2 = ((exp_GR_Mint + 128)  & 0x0f) << 4
-// i2 = i2 + start of T2 table (EXP_AD_T2)
-
-// T      = T1 * T2
-// A      = T * (1 + R)
-// answer = T *  (R^2 * p1 + R^3 * p2 + R^4 * p3 + R^5 * p4 + R^6 * p5 + R^7 * p6) +
-//          T *  (1 + R)
-//        = T * exp(R)
-
-
-.global expf#
 
 .section .text
-.proc  expf#
-.align 32
-expf:
-#ifdef _LIBC
-.global __ieee754_expf#
-__ieee754_expf:
-#endif
-
-{ .mfi
-     alloc      r32            = ar.pfs,1,26,4,0
-     fcvt.fx.s1   exp_Mx       =    f8
-     mov       exp_GR_17ones   =    0x1FFFF
+GLOBAL_IEEE754_ENTRY(expf)
+      
+{ .mlx
+      addl            rTblAddr = @ltoff(_expf_table),gp
+      movl            r64DivLn2 = 0x40571547652B82FE // 64/ln(2)
 }
 { .mlx
-     addl      EXP_AD_P_1      =    @ltoff(exp_coeff_1_table),gp
-     movl      exp_GR_min_oflow = 0x42b17218    
+      addl            rA3 = 0x3E2AA, r0 // high bits of 1.0/6.0 rounded to SP
+      movl            rRightShifter = 0x43E8000000000000 // DP Right Shifter
 }
 ;;
 
-// Fnorm done to take any enabled faults
 { .mfi
-     ld8       EXP_AD_P_1      =  [EXP_AD_P_1]
-     fclass.m  p6,p0      = f8, 0x07	//@zero
-     nop.i 999
+      // point to the beginning of the table
+      ld8             rTblAddr = [rTblAddr]
+      fclass.m        p14, p0 = f8, 0x22    // test for -INF
+      shl             rA3 = rA3, 12  // 0x3E2AA000, approx to 1.0/6.0 in SP
 }
 { .mfi
-     add       exp_GR_max_norm = -1, exp_GR_min_oflow  // 0x42b17217
-     fnorm     exp_norm_f8     =    f8
-     nop.i 999
+      nop.m           0
+      fnorm.s1        fNormX = f8           // normalized x
+      addl            rExpHalf = 0xFFFE, r0 // exponent of 1/2
 }
 ;;
 
 { .mfi
-     setf.s    EXP_MIN_SGL_OFLOW_ARG = exp_GR_min_oflow  // 0x42b17218
-     fclass.m  p7,p0      = f8, 0x22	// Test for x=-inf
-     mov       exp_GR_0xf0 = 0x0f0
+      setf.d          f64DivLn2 = r64DivLn2 // load 64/ln(2) to FP reg
+      fclass.m        p15, p0 = f8, 0x1e1   // test for NaT,NaN,+Inf
+      nop.i           0
 }
 { .mlx
-     setf.s    EXP_MAX_SGL_NORM_ARG = exp_GR_max_norm
-     movl      exp_GR_max_zero = 0xc2cff1b5    
+      // load Right Shifter to FP reg
+      setf.d          fRightShifter = rRightShifter
+      movl            rLn2Div64 = 0x3F862E42FEFA39EF // DP ln(2)/64 in GR
 }
 ;;
 
-
-{ .mlx
-     mov       exp_GR_0x0f = 0x00f
-     movl      exp_GR_max_uflow = 0xc2aeac50    
+{ .mfi
+      nop.m           0
+      fcmp.eq.s1      p13, p0 = f0, f8      // test for x = 0.0
+      nop.i           0
 }
 { .mfb
-     nop.m 999
-(p6) fma.s     f8 = f1,f1,f0
-(p6) br.ret.spnt   b0        // quick exit for x=0
+      setf.s          fA3 = rA3             // load A3 to FP reg
+(p14) fma.s.s0        f8 = f0, f1, f0       // result if x = -inf
+(p14) br.ret.spnt     b0                    // exit here if x = -inf
 }
 ;;
 
 { .mfi
-     setf.s    EXP_MAX_SGL_ZERO_ARG = exp_GR_max_zero
-     fclass.m  p8,p0      = f8, 0x21	// Test for x=+inf
-     adds      exp_GR_min_norm = 1, exp_GR_max_uflow  // 0xc2aeac51
+      setf.exp        fA2 = rExpHalf        // load A2 to FP reg
+      fcmp.eq.s0      p6, p0 = f8, f0       // Dummy to flag denorm
+      nop.i           0
 }
 { .mfb
-     ldfpd     exp_coeff_P5,exp_coeff_P6     =    [EXP_AD_P_1],16
-(p7) fma.s     f8 = f0,f0,f0
-(p7) br.ret.spnt   b0        // quick exit for x=-inf
-}
-;;
-
-{ .mmf
-     ldfpd     exp_coeff_P1,exp_coeff_P2     =    [EXP_AD_P_1],16
-     setf.s    EXP_MAX_SGL_UFLOW_ARG = exp_GR_max_uflow
-     fclass.m  p9,p0      = f8, 0xc3	// Test for x=nan
+      setf.d          fLn2Div64 = rLn2Div64 // load ln(2)/64 to FP reg
+(p15) fma.s.s0        f8 = f8, f1, f0       // result if x = NaT,NaN,+Inf
+(p15) br.ret.spnt     b0                    // exit here if x = NaT,NaN,+Inf
 }
 ;;
 
-{ .mmb
-     ldfpd     exp_coeff_P3,exp_coeff_P4     =    [EXP_AD_P_1],16
-     setf.s    EXP_MIN_SGL_NORM_ARG = exp_GR_min_norm
-(p8) br.ret.spnt   b0        // quick exit for x=+inf
+{ .mfb
+      // overflow and underflow_zero threshold
+      ldfps           fMIN_SGL_OFLOW_ARG, fMAX_SGL_ZERO_ARG = [rTblAddr], 8
+(p13) fma.s.s0        f8 = f1, f1, f0       // result if x = 0.0
+(p13) br.ret.spnt     b0                    // exit here if x =0.0
 }
 ;;
 
-// EXP_AD_P_1 now points to exp_T2_table
+      // max normal and underflow_denorm threshold
 { .mfi
-     mov exp_GR_T2_size           = 0x100
-     fcvt.xf   exp_Mfloat     =    exp_Mx
-     nop.i 999
+      ldfps           fMAX_SGL_NORM_ARG, fMIN_SGL_NORM_ARG = [rTblAddr], 8
+      nop.f           0
+      nop.i           0
 }
 ;;
 
-{ .mfb
-     getf.sig  exp_GR_Mint    =    exp_Mx
-(p9) fmerge.s     f8 = exp_norm_f8, exp_norm_f8
-(p9) br.ret.spnt   b0        // quick exit for x=nan
+{ .mfi
+      nop.m           0
+      // x*(64/ln(2)) + Right Shifter
+      fma.s1          fNint = fNormX, f64DivLn2, fRightShifter
+      nop.i           0
 }
 ;;
 
-{ .mmi
-     nop.m 999
-     mov      EXP_AD_T2       =  EXP_AD_P_1
-     add      EXP_AD_T1       =  exp_GR_T2_size,EXP_AD_P_1 ;;
-}
-
-
-{ .mmi
-     adds      exp_GR_Mint_p_128   =    0x80,exp_GR_Mint ;;
-     and       exp_GR_Ind1      =    exp_GR_Mint_p_128, exp_GR_0xf0
-     and       exp_GR_Ind2      =    exp_GR_Mint_p_128, exp_GR_0x0f ;;
-}
-
 // Divide arguments into the following categories:
-//  Certain Underflow/zero  p11 - -inf < x <= MAX_SGL_ZERO_ARG 
-//  Certain Underflow       p12 - MAX_SGL_ZERO_ARG < x <= MAX_SGL_UFLOW_ARG 
-//  Possible Underflow      p13 - MAX_SGL_UFLOW_ARG < x < MIN_SGL_NORM_ARG
+//  Certain Underflow       p11 - -inf < x <= MAX_SGL_ZERO_ARG
+//  Possible Underflow      p13 - MAX_SGL_ZERO_ARG < x < MIN_SGL_NORM_ARG
 //  Certain Safe                - MIN_SGL_NORM_ARG <= x <= MAX_SGL_NORM_ARG
 //  Possible Overflow       p14 - MAX_SGL_NORM_ARG < x < MIN_SGL_OFLOW_ARG
 //  Certain Overflow        p15 - MIN_SGL_OFLOW_ARG <= x < +inf
 //
-// If the input is really a single arg, then there will never be "Possible
-// Underflow" or "Possible Overflow" arguments.
+// If the input is really a single arg, then there will never be
+// "Possible Overflow" arguments.
 //
 
 { .mfi
-     add       EXP_AD_M1 =    exp_GR_Ind1,EXP_AD_T1
-     fcmp.ge.s1  p15,p14 = exp_norm_f8,EXP_MIN_SGL_OFLOW_ARG
-     nop.i 999
-}
-{ .mfi
-     shladd       EXP_AD_M2                =    exp_GR_Ind2,4,EXP_AD_T2
-     fms.s1    exp_R                    =    f1,f8,exp_Mfloat
-     nop.i 999 ;;
+      nop.m           0
+      // check for overflow
+      fcmp.ge.s1      p15, p0 = fNormX, fMIN_SGL_OFLOW_ARG
+      nop.i           0
 }
+;;
 
 { .mfi
-     ldfe           exp_T1    =    [EXP_AD_M1]
-     fcmp.le.s1  p11,p12 = exp_norm_f8,EXP_MAX_SGL_ZERO_ARG
-     nop.i 999 ;;
+      nop.m           0
+      // check for underflow and tiny (+0) result
+      fcmp.le.s1      p11, p0 = fNormX, fMAX_SGL_ZERO_ARG
+      nop.i           0
 }
-
 { .mfb
-      ldfe           exp_T2   =    [EXP_AD_M2]
-(p14) fcmp.gt.s1  p14,p0 = exp_norm_f8,EXP_MAX_SGL_NORM_ARG
-(p15) br.cond.spnt L(EXP_CERTAIN_OVERFLOW) ;;
-}
-
-{ .mfb
-      nop.m 999
-(p12) fcmp.le.s1  p12,p0 = exp_norm_f8,EXP_MAX_SGL_UFLOW_ARG
-(p11) br.cond.spnt L(EXP_CERTAIN_UNDERFLOW_ZERO)
+      nop.m           0
+      fms.s1          fN = fNint, f1, fRightShifter // n in FP register
+      // branch out if overflow
+(p15) br.cond.spnt    EXP_CERTAIN_OVERFLOW
 }
 ;;
 
-{ .mfi
-      nop.m 999
-(p13) fcmp.lt.s1  p13,p0 = exp_norm_f8,EXP_MIN_SGL_NORM_ARG
-      nop.i 999
+{ .mfb
+      getf.sig        rNJ = fNint           // bits of n, j
+      // check for underflow and deno result
+      fcmp.lt.s1      p13, p0 = fNormX, fMIN_SGL_NORM_ARG
+      // branch out if underflow and tiny (+0) result
+(p11) br.cond.spnt    EXP_CERTAIN_UNDERFLOW
 }
 ;;
 
-
 { .mfi
-     nop.m                 999
-     fma.s1    exp_Rsq   =    exp_R,exp_R,f0
-     nop.i                 999
+      nop.m           0
+      // check for possible overflow
+      fcmp.gt.s1      p14, p0 = fNormX, fMAX_SGL_NORM_ARG
+      extr.u          rJ = rNJ, 0, 6        // bits of j
 }
 { .mfi
-     nop.m                 999
-     fma.s1    exp_P3    =    exp_R,exp_coeff_P2,exp_coeff_P1
-     nop.i                 999 
+      addl            rN = 0xFFFF - 63, rNJ // biased and shifted n
+      fnma.s1         fR = fLn2Div64, fN, fNormX // R = x - N*ln(2)/64
+      nop.i           0
 }
 ;;
 
 { .mfi
-     nop.m                 999
-     fma.s1    exp_P1    =    exp_R,exp_coeff_P6,exp_coeff_P5
-     nop.i                 999 
-}
-{ .mfi
-     nop.m                 999
-     fma.s1    exp_P2    =    exp_R,exp_coeff_P4,exp_coeff_P3
-     nop.i                 999
+      shladd          rJ = rJ, 3, rTblAddr  // address in the 2^(j/64) table
+      nop.f           0
+      shr             rN = rN, 6            // biased n
 }
 ;;
 
-
 { .mfi
-     nop.m                 999
-     fma.s1    exp_P7    =    f1,exp_R,f1
-     nop.i                 999
+      ld8             rJ = [rJ]
+      nop.f           0
+      shl             rN = rN, 52           // 2^n bits in DP format
 }
 ;;
 
-
 { .mfi
-     nop.m                 999
-     fma.s1    exp_P5    =    exp_Rsq,exp_P3,f0
-     nop.i                 999
-}
-{ .mfi
-     nop.m                 999
-     fma.s1    exp_R4    =    exp_Rsq,exp_Rsq,f0
-     nop.i                 999 
+      or              rN = rN, rJ // bits of 2^n * 2^(j/64) in DP format
+      nop.f           0
+      nop.i           0
 }
 ;;
 
 { .mfi
-     nop.m                 999
-     fma.s1    exp_T     =    exp_T1,exp_T2,f0
-     nop.i                 999 
+      setf.d          fT = rN               // 2^n * 2^(j/64)
+      fma.s1          fP = fA3, fR, fA2     // A3*R + A2
+      nop.i           0
 }
 { .mfi
-     nop.m                 999
-     fma.s1    exp_P4    =    exp_Rsq,exp_P1,exp_P2
-     nop.i                 999 
+      nop.m           0
+      fma.s1          fRSqr = fR, fR, f0    // R^2
+      nop.i           0
 }
 ;;
 
 { .mfi
-     nop.m                 999
-     fma.s1    exp_A     =    exp_T,exp_P7,f0
-     nop.i                 999
-}
-{ .mfi
-     nop.m                 999
-     fma.s1    exp_P6    =    exp_R4,exp_P4,exp_P5
-     nop.i                 999
+      nop.m           0
+      fma.s1          fP = fP, fRSqr, fR    // P = (A3*R + A2)*R^2 + R
+      nop.i           0
 }
 ;;
 
-{ .bbb
-(p12) br.cond.spnt L(EXP_CERTAIN_UNDERFLOW)
-(p13) br.cond.spnt L(EXP_POSSIBLE_UNDERFLOW)
-(p14) br.cond.spnt L(EXP_POSSIBLE_OVERFLOW)
+{ .mbb
+      nop.m           0
+      // branch out if possible underflow
+(p13) br.cond.spnt    EXP_POSSIBLE_UNDERFLOW
+      // branch out if possible overflow result
+(p14) br.cond.spnt    EXP_POSSIBLE_OVERFLOW
 }
 ;;
 
 { .mfb
-     nop.m            999
-     fma.s     f8   =    exp_T,exp_P6,exp_A
-     br.ret.sptk     b0
+      nop.m           0
+      // final result in the absence of over- and underflow
+      fma.s.s0        f8 = fP, fT, fT
+      // exit here in the absence of over- and underflow
+      br.ret.sptk     b0
 }
 ;;
 
-L(EXP_POSSIBLE_OVERFLOW):
-
-// We got an answer. EXP_MAX_SGL_NORM_ARG < x < EXP_MIN_SGL_OFLOW_ARG
-// overflow is a possibility, not a certainty
-// Set wre in s2 and perform the last operation with s2
-
-// We define an overflow when the answer with
-//    WRE set
-//    user-defined rounding mode
-// is lsn +1
-
-// Is the exponent 1 more than the largest single?
-// If so, go to ERROR RETURN, else (no overflow) get the answer and
-// leave.
-
-// Largest single is FE (biased single)
-//                   FE - 7F + FFFF = 1007E
-
-// Create + largest_single_plus_ulp
-// Create - largest_single_plus_ulp
+EXP_POSSIBLE_OVERFLOW:
 
-// Calculate answer with WRE set.
+// Here if fMAX_SGL_NORM_ARG < x < fMIN_SGL_OFLOW_ARG
+// This cannot happen if input is a single, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-// Cases when answer is lsn+1  are as follows:
-
-//           midpoint
-//              |
-//  lsn         |         lsn+1
-// --+----------|----------+------------
-//              |
-//    +inf          +inf      -inf
-//                  RN         RN
-//                             RZ
-// exp_gt_pln contains the floating point number lsn+1.
-// The setf.exp puts 0x1007f in the exponent and 0x800... in the significand.
-
-// If the answer is >= lsn+1, we have overflowed.
-// Then p6 is TRUE. Set the overflow tag, save input in FR_X,
-// do the final calculation for IEEE result, and branch to error return.
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest single, then we have
+// overflow
 
 { .mfi
-       mov         exp_GR_gt_ln    = 0x1007F 
-       fsetc.s2    0x7F,0x42
-       nop.i 999
+      mov             rGt_ln  = 0x1007f // Exponent for largest single + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
 ;;
 
 { .mfi
-       setf.exp      exp_gt_pln    = exp_GR_gt_ln
-       fma.s.s2    exp_wre_urm_f8  = exp_T,  exp_P6, exp_A
-       nop.i 999
+      setf.exp        fGt_pln = rGt_ln  // Create largest single + 1 ulp
+      fma.s.s2        fWre_urm_f8 = fP, fT, fT    // Result with wre set
+      nop.i           0
 }
 ;;
 
 { .mfi
-       nop.m 999
-       fsetc.s2 0x7F,0x40
-       nop.i 999
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
 ;;
 
 { .mfi
-       nop.m 999
-       fcmp.ge.unc.s1 p6, p0       =  exp_wre_urm_f8, exp_gt_pln
-       nop.i 999
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
 ;;
 
 { .mfb
-       nop.m 999
-       nop.f 999
-(p6)   br.cond.spnt L(EXP_CERTAIN_OVERFLOW)  // Branch if really overflow
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    EXP_CERTAIN_OVERFLOW // Branch if overflow
 }
 ;;
 
 { .mfb
-       nop.m 999
-       fma.s        f8             = exp_T,  exp_P6, exp_A
-       br.ret.sptk     b0                 // Exit if really no overflow
+      nop.m           0
+      fma.s.s0        f8 = fP, fT, fT
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
 ;;
 
-L(EXP_CERTAIN_OVERFLOW):
+// here if overflow
+EXP_CERTAIN_OVERFLOW:
 { .mmi
-      sub   exp_GR_17ones_m1 = exp_GR_17ones, r0, 1 ;;
-      setf.exp     f9 = exp_GR_17ones_m1
-      nop.i 999 ;;
+      addl            r17ones_m1 = 0x1FFFE, r0
+;;
+      setf.exp        fTmp = r17ones_m1
+      nop.i           0
 }
+;;
 
 { .mfi
-      nop.m 999
-      fmerge.s FR_X = f8,f8
-      nop.i 999
+      alloc           r32=ar.pfs,0,3,4,0
+      fmerge.s        FR_X = f8,f8
+      nop.i           0
 }
 { .mfb
-      mov        GR_Parameter_TAG = 16
-      fma.s       FR_RESULT = f9, f9, f0    // Set I,O and +INF result
-      br.cond.sptk  __libm_error_region ;;                             
+      mov             GR_Parameter_TAG = 16
+      fma.s.s0        FR_RESULT = fTmp, fTmp, fTmp // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
-L(EXP_POSSIBLE_UNDERFLOW): 
+EXP_POSSIBLE_UNDERFLOW:
 
-// We got an answer. EXP_MAX_SGL_UFLOW_ARG < x < EXP_MIN_SGL_NORM_ARG
-// underflow is a possibility, not a certainty
+// Here if fMAX_SGL_ZERO_ARG < x < fMIN_SGL_NORM_ARG
+// Underflow is a possibility, not a certainty
 
 // We define an underflow when the answer with
 //    ftz set
@@ -637,144 +551,165 @@ L(EXP_POSSIBLE_UNDERFLOW):
 //                           E
 // -----+--------------------+--------------------+-----
 //      |                    |                    |
-//   1.1...10 2^-7f      1.1...11 2^-7f      1.0...00 2^-7e  
-//   0.1...11 2^-7e                                     (biased, 1)
+//   1.1...10 2^-3fff    1.1...11 2^-3fff    1.0...00 2^-3ffe
+//   0.1...11 2^-3ffe                                   (biased, 1)
 //    largest dn                               smallest normal
 
-// If the answer is = 0, we have underflowed.
-// Then p6 is TRUE. Set the underflow tag, save input in FR_X,
-// do the final calculation for IEEE result, and branch to error return.
-
 { .mfi
-       nop.m 999
-       fsetc.s2 0x7F,0x41
-       nop.i 999
+      nop.m           0
+      fsetc.s2        0x7F,0x41                // Get user's round mode, set ftz
+      nop.i           0
 }
 ;;
 
 { .mfi
-       nop.m 999
-       fma.s.s2     exp_ftz_urm_f8  = exp_T,  exp_P6, exp_A
-       nop.i 999
+      nop.m           0
+      fma.s.s2        fFtz_urm_f8 = fP, fT, fT // Result with ftz set
+      nop.i           0
 }
 ;;
 
-
 { .mfi
-       nop.m 999
-       fsetc.s2 0x7F,0x40
-       nop.i 999
+      nop.m           0
+      fsetc.s2        0x7F,0x40                // Turn off ftz in sf2
+      nop.i           0
 }
 ;;
 
 { .mfi
-       nop.m 999
-       fcmp.eq.unc.s1 p6, p0     =  exp_ftz_urm_f8, f0
-       nop.i 999
+      nop.m           0
+      fcmp.eq.s1      p6, p7 = fFtz_urm_f8, f0 // Test for underflow
+      nop.i           0
+}
+{ .mfi
+      nop.m           0
+      fma.s.s0        f8 = fP, fT, fT          // Compute result, set I, maybe U
+      nop.i           0
 }
 ;;
 
-{ .mfb
-       nop.m 999
-       nop.f 999
-(p6)   br.cond.spnt L(EXP_CERTAIN_UNDERFLOW)  // Branch if really underflow 
+{ .mbb
+      nop.m           0
+(p6)  br.cond.spnt    EXP_UNDERFLOW_COMMON     // Branch if really underflow
+(p7)  br.ret.sptk     b0                       // Exit if really no underflow
 }
 ;;
 
-{ .mfb
-       nop.m 999
-       fma.s        f8             = exp_T,  exp_P6, exp_A
-       br.ret.sptk     b0                  // Exit if really no underflow
+EXP_CERTAIN_UNDERFLOW:
+// Here if  x < fMAX_SGL_ZERO_ARG
+// Result will be zero (or smallest denorm if round to +inf) with I, U set
+{ .mmi
+      mov             rTmp = 1
+;;
+      setf.exp        fTmp = rTmp               // Form small normal
+      nop.i           0
 }
 ;;
 
-L(EXP_CERTAIN_UNDERFLOW):
 { .mfi
-      nop.m 999
-      fmerge.s FR_X = f8,f8
-      nop.i 999
+      nop.m           0
+      fmerge.se       fTmp = fTmp, f64DivLn2    // Small with non-trial signif
+      nop.i           0
 }
+;;
+      
 { .mfb
-      mov        GR_Parameter_TAG = 17
-      fma.s       FR_RESULT  = exp_T, exp_P6, exp_A // Set I,U and tiny result
-      br.cond.sptk  __libm_error_region ;;                             
+      nop.m           0
+      fma.s.s0        f8 = fTmp, fTmp, f0 // Set I,U, tiny (+0.0) result
+      br.cond.sptk    EXP_UNDERFLOW_COMMON
 }
+;;
 
-L(EXP_CERTAIN_UNDERFLOW_ZERO):
-{ .mmi
-      mov   exp_GR_one = 1 ;;
-      setf.exp     f9 = exp_GR_one
-      nop.i 999 ;;
+EXP_UNDERFLOW_COMMON:
+// Determine if underflow result is zero or nonzero
+{ .mfi
+      alloc           r32=ar.pfs,0,3,4,0
+      fcmp.eq.s1      p6, p0 =  f8, f0
+      nop.i           0
 }
+;;
 
-{ .mfi
-      nop.m 999
-      fmerge.s FR_X = f8,f8
-      nop.i 999
+{ .mfb
+      nop.m           0
+      fmerge.s        FR_X = fNormX,fNormX
+(p6)  br.cond.spnt    EXP_UNDERFLOW_ZERO
 }
+;;
+
+EXP_UNDERFLOW_NONZERO:
+// Here if  x < fMIN_SGL_NORM_ARG and result nonzero;
+// I, U are set
 { .mfb
-      mov        GR_Parameter_TAG = 17
-      fma.s       FR_RESULT = f9, f9, f0    // Set I,U and tiny (+0.0) result
-      br.cond.sptk  __libm_error_region ;;                             
+      mov             GR_Parameter_TAG = 17
+      nop.f           0                         // FR_RESULT already set
+      br.cond.sptk    __libm_error_region
 }
+;;
 
-.endp expf
-ASM_SIZE_DIRECTIVE(expf)
+EXP_UNDERFLOW_ZERO:
+// Here if x < fMIN_SGL_NORM_ARG and result zero;
+// I, U are set
+{ .mfb
+      mov             GR_Parameter_TAG = 17
+      nop.f           0                         // FR_RESULT already set
+      br.cond.sptk    __libm_error_region
+}
+;;
 
+GLOBAL_IEEE754_END(expf)
 
-.proc __libm_error_region
-__libm_error_region:
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-	nop.f 999
+      add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+      nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+      add sp=-64,sp                           // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                       // Save gp
 };;
 { .mmi
-        stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+      stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
+      add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+      mov GR_SAVE_B0=b0                       // Save b0
 };;
 .body
 { .mfi
-        stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        nop.f 0
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+      stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+      nop.f 0
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
 }
 { .mib
-        stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#   // Call error handling function
+      stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
 
 { .mmi
-        nop.m 0
-        nop.m 0
-        add   GR_Parameter_RESULT = 48,sp
+      add   GR_Parameter_RESULT = 48,sp
+      nop.m 0
+      nop.i 0
 };;
 
 { .mmi
-        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+      ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+      add   sp = 64,sp                       // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
-};; 
+      mov   gp = GR_SAVE_GP                  // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+      br.ret.sptk     b0                     // Return
+};;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 
 .type   __libm_error_support#,@function
diff --git a/sysdeps/ia64/fpu/e_fmod.S b/sysdeps/ia64/fpu/e_fmod.S
index 2b3ee9610f..dbd0a29698 100644
--- a/sysdeps/ia64/fpu/e_fmod.S
+++ b/sysdeps/ia64/fpu/e_fmod.S
@@ -1,11 +1,10 @@
 .file "fmod.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational
-// Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,38 +35,42 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //====================================================================
-// 2/02/00  Initial version
-// 3/02/00  New Algorithm
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 03/02/00 New Algorithm
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-//11/28/00  Set FR_Y to f9
+// 11/28/00 Set FR_Y to f9
+// 03/11/02 Fixed flags for fmod(qnan,zero)
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/28/03 Fix: fmod(sNaN,0) no longer sets errno
 //
 // API
 //====================================================================
-// double fmod(double,double);   
+// double fmod(double,double);
 //
 // Overview of operation
 //====================================================================
 //  fmod(a,b)=a-i*b,
-//  where i is an integer such that, if b!=0, 
+//  where i is an integer such that, if b!=0,
 //  |i|<|a/b| and |a/b-i|<1
 //
 // Algorithm
 //====================================================================
 // a). if |a|<|b|, return a
-// b). get quotient and reciprocal overestimates accurate to 
+// b). get quotient and reciprocal overestimates accurate to
 //     33 bits (q2,y2)
 // c). if the exponent difference (exponent(a)-exponent(b))
 //     is less than 32, truncate quotient to integer and
 //     finish in one iteration
 // d). if exponent(a)-exponent(b)>=32 (q2>=2^32)
 //     round quotient estimate to single precision (k=RN(q2)),
-//     calculate partial remainder (a'=a-k*b), 
+//     calculate partial remainder (a'=a-k*b),
 //     get quotient estimate (a'*y2), and repeat from c).
 //
 // Special cases
@@ -81,14 +84,9 @@
 // General registers:   r2,r29,r32 (ar.pfs), r33-r39
 // Floating point registers: f6-f15
 
-#include "libm_support.h"
-
-.section .text
-
-
 GR_SAVE_B0                    = r33
 GR_SAVE_PFS                   = r34
-GR_SAVE_GP                    = r35 
+GR_SAVE_GP                    = r35
 GR_SAVE_SP                    = r36
 
 GR_Parameter_X                = r37
@@ -101,17 +99,9 @@ FR_Y             = f9
 FR_RESULT        = f8
 
 
-.proc fmod#
-.align 32
-.global fmod#
-.align 32
+.section .text
+GLOBAL_IEEE754_ENTRY(fmod)
 
-fmod:
-#ifdef _LIBC
-.global __ieee754_fmod
-.type __ieee754_fmod,@function
-__ieee754_fmod:
-#endif
 // inputs in f8, f9
 // result in f8
 
@@ -133,12 +123,12 @@ __ieee754_fmod:
   // (1) y0
   frcpa.s1 f10,p6=f6,f7
   nop.i 0
-} 
+}
 
 // Y +-NAN, +-inf, +-0?     p7
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0xe7           
+      fclass.m.unc  p7,p0 = f9, 0xe7
       nop.i 999;;
 }
 
@@ -149,14 +139,14 @@ __ieee754_fmod:
 
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f8, 0xe3           
-      nop.i 999 
+      fclass.m.unc  p9,p0 = f8, 0xe3
+      nop.i 999
 }
 
 // |x| < |y|? Return x p8
 { .mfi
       nop.m 999
-(p0)  fcmp.lt.unc.s1 p8,p0 = f6,f7             
+      fcmp.lt.unc.s1 p8,p0 = f6,f7
       nop.i 999 ;;
 }
 
@@ -172,33 +162,33 @@ __ieee754_fmod:
   // (2) q0=a*y0
   (p6) fma.s1 f13=f6,f10,f0
   nop.i 0
-} 
+}
 { .mfi
   nop.m 0
   // (3) e0 = 1 - b * y0
   (p6) fnma.s1 f12=f7,f10,f1
   nop.i 0;;
-} 
+}
 
   {.mfi
   nop.m 0
   // normalize x (if |x|<|y|)
   (p8) fma.d.s0 f8=f8,f1,f0
   nop.i 0
-} 
+}
 {.bbb
-  (p9) br.cond.spnt L(FMOD_X_NAN_INF)
-  (p7) br.cond.spnt L(FMOD_Y_NAN_INF_ZERO)
+  (p9) br.cond.spnt FMOD_X_NAN_INF
+  (p7) br.cond.spnt FMOD_Y_NAN_INF_ZERO
   // if |x|<|y|, return
   (p8) br.ret.spnt    b0;;
 }
 
-  {.mfi 
+  {.mfi
   nop.m 0
   // normalize x
   fma.s0 f6=f6,f1,f0
   nop.i 0
-} 
+}
 {.mfi
   nop.m 0
   // normalize y
@@ -212,45 +202,45 @@ __ieee754_fmod:
   // (4) q1=q0+e0*q0
   (p6) fma.s1 f13=f12,f13,f13
   nop.i 0
-} 
+}
 { .mfi
   nop.m 0
   // (5) e1 = e0 * e0 + 2^-34
   (p6) fma.s1 f14=f12,f12,f11
   nop.i 0;;
-} 
+}
 {.mlx
   nop.m 0
   movl r2=0x33a00000;;
-} 
+}
 { .mfi
   nop.m 0
   // (6) y1 = y0 + e0 * y0
   (p6) fma.s1 f10=f12,f10,f10
   nop.i 0;;
-} 
+}
 {.mfi
   // set f12=1.25*2^{-24}
   setf.s f12=r2
   // (7) q2=q1+e1*q1
   (p6) fma.s1 f13=f13,f14,f13
   nop.i 0;;
-} 
+}
 {.mfi
   nop.m 0
   fmerge.s f9=f8,f9
   nop.i 0
-} 
+}
 { .mfi
   nop.m 0
   // (8) y2 = y1 + e1 * y1
   (p6) fma.s1 f10=f14,f10,f10
   // set p6=0, p10=0
   cmp.ne.and p6,p10=r0,r0;;
-} 
+}
 
 .align 32
-L(loop53):
+loop53:
   {.mfi
   nop.m 0
   // compare q2, 2^32
@@ -280,7 +270,7 @@ L(loop53):
   // normalize truncated quotient
   (p8) fcvt.xf f13=f11
   nop.i 0;;
-}  
+}
   { .mfi
   nop.m 0
   // calculate remainder (assuming f13=RZ(Q))
@@ -289,7 +279,7 @@ L(loop53):
 }
   {.mfi
   nop.m 0
-  // also if exponent>32, round quotient to single precision 
+  // also if exponent>32, round quotient to single precision
   // and subtract 1 ulp: q=q-q*(1.25*2^{-24})
   (p7) fnma.s.s1 f11=f13,f12,f13
   nop.i 0;;
@@ -332,7 +322,7 @@ L(loop53):
 .pred.rel "mutex",p6,p10
   {.mfb
   nop.m 0
-  // add b to estimated remainder (to cover the case when the quotient was overestimated) 
+  // add b to estimated remainder (to cover the case when the quotient was overestimated)
   // also set correct sign by using f9=|b|*sgn(a), f12=sgn(a)
   (p6) fma.d.s0 f8=f11,f12,f9
   nop.b 0
@@ -354,97 +344,114 @@ L(loop53):
   nop.m 0
   // if f14 was RZ(Q), set remainder to f14
   (p9) mov f6=f14
-  br.cond.sptk L(loop53);;
+  br.cond.sptk loop53;;
 }
 
 
 
-L(FMOD_X_NAN_INF): 
+FMOD_X_NAN_INF:
 
 // Y zero ?
-{.mfi 
+{.mfi
+  nop.m 0
+  fclass.m p10,p0=f8,0xc3     // Test x=nan
+  nop.i 0
+}
+{.mfi
   nop.m 0
   fma.s1 f10=f9,f1,f0
   nop.i 0;;
 }
+
+{.mfi
+  nop.m 0
+  fma.s0 f8=f8,f1,f0
+  nop.i 0
+}
 {.mfi
+  nop.m 0
+(p10) fclass.m p10,p0=f9,0x07 // Test x=nan, and y=zero
+  nop.i 0;;
+}
+
+{.mfb
  nop.m 0
  fcmp.eq.unc.s1 p11,p0=f10,f0
- nop.i 0;;
+(p10) br.ret.spnt b0;;        // Exit with result=x if x=nan and y=zero
 }
 {.mib
   nop.m 0
   nop.i 0
   // if Y zero
-  (p11) br.cond.spnt L(FMOD_Y_ZERO);;                        
+  (p11) br.cond.spnt FMOD_Y_ZERO;;
 }
 
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p8,p9 = f8, 0x23 
-      nop.i 999;; 
+      fclass.m.unc  p8,p9 = f8, 0x23
+      nop.i 999;;
 }
 // Y NaN ?
 {.mfi
-	 nop.m 999
+     nop.m 999
 (p8) fclass.m p9,p8=f9,0xc3
-	 nop.i 0;;
+     nop.i 0;;
 }
 {.mfi
-	  nop.m 999
-(p8)  frcpa.s0 f8,p0 = f8,f8           
+      nop.m 999
+(p8)  frcpa.s0 f8,p0 = f8,f8
       nop.i 0
-} 
+}
 { .mfi
       nop.m 999
-	// also set Denormal flag if necessary
+    // also set Denormal flag if necessary
 (p8)  fma.s0 f9=f9,f1,f0
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p8)  fma.d f8=f8,f1,f0                     
-	  nop.b 999 ;;                        
+(p8)  fma.d.s0 f8=f8,f1,f0
+      nop.b 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p9)  frcpa.s0 f8,p7=f8,f9                     
-      br.ret.sptk   b0 ;;                        
+(p9)  frcpa.s0 f8,p7=f8,f9
+      br.ret.sptk   b0 ;;
 }
 
 
-L(FMOD_Y_NAN_INF_ZERO): 
+FMOD_Y_NAN_INF_ZERO:
 
 // Y INF
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0x23           
+      fclass.m.unc  p7,p0 = f9, 0x23
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p7)  fma.d f8=f8,f1,f0                     
-(p7)  br.ret.spnt    b0 ;;                        
+(p7)  fma.d.s0 f8=f8,f1,f0
+(p7)  br.ret.spnt    b0 ;;
 }
 
 // Y NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f9, 0xc3           
+      fclass.m.unc  p9,p0 = f9, 0xc3
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p9)  fma.d f8=f9,f1,f0                     
-(p9)  br.ret.spnt    b0 ;;                        
+(p9)  fma.d.s0 f8=f9,f1,f0
+(p9)  br.ret.spnt    b0 ;;
 }
 
-L(FMOD_Y_ZERO):
+FMOD_Y_ZERO:
 // Y zero? Must be zero at this point
 // because it is the only choice left.
 // Return QNAN indefinite
@@ -452,60 +459,57 @@ L(FMOD_Y_ZERO):
 {.mfi
   nop.m 0
   // set Invalid
-  frcpa f12,p0=f0,f0
+  frcpa.s0 f12,p0=f0,f0
   nop.i 0
 }
 // X NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f8, 0xc3           
+      fclass.m.unc  p9,p10 = f8, 0xc3
       nop.i 999 ;;
 }
 { .mfi
       nop.m 999
-(p10)  fclass.nm  p9,p10 = f8, 0xff           
+(p10)  fclass.nm  p9,p10 = f8, 0xff
       nop.i 999 ;;
 }
 
 {.mfi
  nop.m 999
- (p9) frcpa f11,p7=f8,f0
+ (p9) frcpa.s0 f11,p7=f8,f0
  nop.i 0;;
 }
 
 { .mfi
       nop.m 999
-(p10)  frcpa         f11,p7 = f9,f9           
-(p0)  mov        GR_Parameter_TAG = 121 ;;                                 
+(p10)  frcpa.s0         f11,p7 = f9,f9
+      mov        GR_Parameter_TAG = 121 ;;
 }
 
 { .mfi
       nop.m 999
-(p0)  fmerge.s      f10 = f8, f8             
+      fmerge.s      f10 = f8, f8
       nop.i 999
 }
 
 { .mfb
       nop.m 999
-(p0)  fma.d f8=f11,f1,f0                     
-(p0)  br.sptk __libm_error_region;; 
+      fma.d.s0 f8=f11,f1,f0
+      br.sptk __libm_error_region;;
 }
 
-.endp fmod
-ASM_SIZE_DIRECTIVE(fmod)
-ASM_SIZE_DIRECTIVE(__ieee754_fmod)
+GLOBAL_IEEE754_END(fmod)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
-.fframe 64 
+.fframe 64
         add sp=-64,sp                           // Create new stack
         nop.f 0
         mov GR_SAVE_GP=gp                       // Save gp
@@ -513,18 +517,18 @@ __libm_error_region:
 { .mmi
         stfd [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
         add GR_Parameter_X = 16,sp              // Parameter 1 address
-.save   b0, GR_SAVE_B0                      
-        mov GR_SAVE_B0=b0                       // Save b0 
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
 };;
 .body
 { .mib
-        stfd [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack 
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  
-	nop.b 0                                 // Parameter 3 address
+        stfd [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+    nop.b 0                                 // Parameter 3 address
 }
 { .mib
         stfd [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
         br.call.sptk b0=__libm_error_support#  // Call error handling function
 };;
 { .mmi
@@ -539,13 +543,17 @@ __libm_error_region:
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
-};; 
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
+
+
+
diff --git a/sysdeps/ia64/fpu/e_fmodf.S b/sysdeps/ia64/fpu/e_fmodf.S
index 5b6390eeec..36e5807291 100644
--- a/sysdeps/ia64/fpu/e_fmodf.S
+++ b/sysdeps/ia64/fpu/e_fmodf.S
@@ -1,10 +1,10 @@
 .file "fmodf.s"
-// Copyright (c) 2000, 2001, Intel Corporation
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational 
-// Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,9 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// WARRANTY DISCLAIMER
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,38 +35,42 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //====================================================================
-// 2/02/00  Initial version
-// 3/02/00  New Algorithm
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 03/02/00 New Algorithm
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-//11/28/00  Set FR_Y to f9
+// 11/28/00 Set FR_Y to f9
+// 03/11/02 Fixed flags for fmodf(qnan,zero)
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/28/03 Fix: fmod(sNaN,0) no longer sets errno
 //
 // API
 //====================================================================
-// float fmodf(float,float);   
+// float fmodf(float,float);
 //
 // Overview of operation
 //====================================================================
 //  fmod(a,b)=a-i*b,
-//  where i is an integer such that, if b!=0, 
+//  where i is an integer such that, if b!=0,
 //  |i|<|a/b| and |a/b-i|<1
 
 // Algorithm
 //====================================================================
 // a). if |a|<|b|, return a
-// b). get quotient and reciprocal overestimates accurate to 
+// b). get quotient and reciprocal overestimates accurate to
 //     33 bits (q2,y2)
 // c). if the exponent difference (exponent(a)-exponent(b))
 //     is less than 32, truncate quotient to integer and
 //     finish in one iteration
 // d). if exponent(a)-exponent(b)>=32 (q2>=2^32)
 //     round quotient estimate to single precision (k=RN(q2)),
-//     calculate partial remainder (a'=a-k*b), 
+//     calculate partial remainder (a'=a-k*b),
 //     get quotient estimate (a'*y2), and repeat from c).
 
 // Special cases
@@ -82,13 +84,9 @@
 // General registers:   r2,r29,r32 (ar.pfs), r33-r39
 // Floating point registers: f6-f15
 
-#include "libm_support.h"
-
-.section .text
-
 GR_SAVE_B0                    = r33
 GR_SAVE_PFS                   = r34
-GR_SAVE_GP                    = r35 
+GR_SAVE_GP                    = r35
 GR_SAVE_SP                    = r36
 
 GR_Parameter_X                = r37
@@ -101,18 +99,9 @@ FR_Y             = f9
 FR_RESULT        = f8
 
 
+.section .text
+GLOBAL_IEEE754_ENTRY(fmodf)
 
-.proc fmodf#
-.align 32
-.global fmodf#
-.align 32
-
-fmodf:
-#ifdef _LIBC
-.global __ieee754_fmodf
-.type __ieee754_fmodf,@function
-__ieee754_fmodf:
-#endif
 // inputs in f8, f9
 // result in f8
 
@@ -134,13 +123,13 @@ __ieee754_fmodf:
   // (1) y0
   frcpa.s1 f10,p6=f6,f7
   nop.i 0
-} 
+}
 
 // eliminate special cases
 // Y +-NAN, +-inf, +-0?     p7
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0xe7           
+      fclass.m.unc  p7,p0 = f9, 0xe7
       nop.i 999;;
 }
 
@@ -151,14 +140,14 @@ __ieee754_fmodf:
 
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f8, 0xe3           
-      nop.i 999 
+      fclass.m.unc  p9,p0 = f8, 0xe3
+      nop.i 999
 }
 
 // |x| < |y|? Return x p8
 { .mfi
       nop.m 999
-(p0)  fcmp.lt.unc.s1 p8,p0 = f6,f7             
+      fcmp.lt.unc.s1 p8,p0 = f6,f7
       nop.i 999 ;;
 }
 
@@ -174,33 +163,33 @@ __ieee754_fmodf:
   // (2) q0=a*y0
   (p6) fma.s1 f13=f6,f10,f0
   nop.i 0
-} 
+}
 { .mfi
   nop.m 0
   // (3) e0 = 1 - b * y0
   (p6) fnma.s1 f12=f7,f10,f1
   nop.i 0;;
-} 
+}
 
   {.mfi
   nop.m 0
   // normalize x (if |x|<|y|)
   (p8) fma.s.s0 f8=f8,f1,f0
   nop.i 0
-} 
+}
 {.bbb
-  (p9) br.cond.spnt L(FMOD_X_NAN_INF)
-  (p7) br.cond.spnt L(FMOD_Y_NAN_INF_ZERO)
+  (p9) br.cond.spnt FMOD_X_NAN_INF
+  (p7) br.cond.spnt FMOD_Y_NAN_INF_ZERO
   // if |x|<|y|, return
   (p8) br.ret.spnt    b0;;
 }
 
-  {.mfi 
+  {.mfi
   nop.m 0
   // normalize x
   fma.s0 f6=f6,f1,f0
   nop.i 0
-} 
+}
 {.mfi
   nop.m 0
   // normalize y
@@ -215,45 +204,45 @@ __ieee754_fmodf:
   // (4) q1=q0+e0*q0
   (p6) fma.s1 f13=f12,f13,f13
   nop.i 0
-} 
+}
 { .mfi
   nop.m 0
   // (5) e1 = e0 * e0 + 2^-34
   (p6) fma.s1 f14=f12,f12,f11
   nop.i 0;;
-} 
+}
 {.mlx
   nop.m 0
   movl r2=0x33a00000;;
-} 
+}
 { .mfi
   nop.m 0
   // (6) y1 = y0 + e0 * y0
   (p6) fma.s1 f10=f12,f10,f10
   nop.i 0;;
-} 
+}
 {.mfi
   // set f12=1.25*2^{-24}
   setf.s f12=r2
   // (7) q2=q1+e1*q1
   (p6) fma.s1 f13=f13,f14,f13
   nop.i 0;;
-} 
+}
 {.mfi
   nop.m 0
   fmerge.s f9=f8,f9
   nop.i 0
-} 
+}
 { .mfi
   nop.m 0
   // (8) y2 = y1 + e1 * y1
   (p6) fma.s1 f10=f14,f10,f10
   // set p6=0, p10=0
   cmp.ne.and p6,p10=r0,r0;;
-} 
+}
 
 .align 32
-L(loop24):
+loop24:
   {.mfi
   nop.m 0
   // compare q2, 2^32
@@ -283,7 +272,7 @@ L(loop24):
   // normalize truncated quotient
   (p8) fcvt.xf f13=f11
   nop.i 0;;
-}  
+}
   { .mfi
   nop.m 0
   // calculate remainder (assuming f13=RZ(Q))
@@ -292,7 +281,7 @@ L(loop24):
 }
   {.mfi
   nop.m 0
-  // also if exponent>32, round quotient to single precision 
+  // also if exponent>32, round quotient to single precision
   // and subtract 1 ulp: q=q-q*(1.25*2^{-24})
   (p7) fnma.s.s1 f11=f13,f12,f13
   nop.i 0;;
@@ -335,7 +324,7 @@ L(loop24):
 .pred.rel "mutex",p6,p10
   {.mfb
   nop.m 0
-  // add b to estimated remainder (to cover the case when the quotient was overestimated) 
+  // add b to estimated remainder (to cover the case when the quotient was overestimated)
   // also set correct sign by using f9=|b|*sgn(a), f12=sgn(a)
   (p6) fma.s.s0 f8=f11,f12,f9
   nop.b 0
@@ -357,102 +346,118 @@ L(loop24):
   nop.m 0
   // if f14 was RZ(Q), set remainder to f14
   (p9) mov f6=f14
-  br.cond.sptk L(loop24);;
+  br.cond.sptk loop24;;
 }
 
   {  .mmb
-	nop.m 0				    
-	nop.m 0				    
-	br.ret.sptk b0;;
+    nop.m 0
+    nop.m 0
+    br.ret.sptk b0;;
  }
 
-L(FMOD_X_NAN_INF): 
+FMOD_X_NAN_INF:
 
 
 // Y zero ?
-{.mfi 
+{.mfi
+  nop.m 0
+  fclass.m p10,p0=f8,0xc3     // Test x=nan
+  nop.i 0
+}
+{.mfi
   nop.m 0
   fma.s1 f10=f9,f1,f0
   nop.i 0;;
 }
+
 {.mfi
+  nop.m 0
+  fma.s0 f8=f8,f1,f0
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+(p10) fclass.m p10,p0=f9,0x07 // Test x=nan, and y=zero
+  nop.i 0;;
+}
+{.mfb
  nop.m 0
  fcmp.eq.unc.s1 p11,p0=f10,f0
- nop.i 0;;
+(p10) br.ret.spnt b0;;        // Exit with result=x if x=nan and y=zero
 }
 {.mib
   nop.m 0
   nop.i 0
   // if Y zero
-  (p11) br.cond.spnt L(FMOD_Y_ZERO);;                        
+  (p11) br.cond.spnt FMOD_Y_ZERO;;
 }
 
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p8,p9 = f8, 0x23 
-      nop.i 999;; 
+      fclass.m.unc  p8,p9 = f8, 0x23
+      nop.i 999;;
 }
 // Y NaN ?
 {.mfi
-	 nop.m 999
+     nop.m 999
 (p8) fclass.m p9,p8=f9,0xc3
-	 nop.i 0;;
+     nop.i 0;;
 }
 {.mfi
-	nop.m 999
-(p8)  frcpa.s0 f8,p0 = f8,f8           
+    nop.m 999
+(p8)  frcpa.s0 f8,p0 = f8,f8
     nop.i 0
-} 
+}
 { .mfi
       nop.m 999
-	// also set Denormal flag if necessary
+    // also set Denormal flag if necessary
 (p8)  fma.s0 f9=f9,f1,f0
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p8)  fma.s f8=f8,f1,f0                     
-	  nop.b 999 ;;                        
+(p8)  fma.s.s0 f8=f8,f1,f0
+      nop.b 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p9)  frcpa.s0 f8,p7=f8,f9                     
-      br.ret.sptk    b0 ;;                        
+(p9)  frcpa.s0 f8,p7=f8,f9
+      br.ret.sptk    b0 ;;
 }
 
 
-L(FMOD_Y_NAN_INF_ZERO): 
+FMOD_Y_NAN_INF_ZERO:
 
 // Y INF
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0x23           
+      fclass.m.unc  p7,p0 = f9, 0x23
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p7)  fma.s f8=f8,f1,f0                     
-(p7)  br.ret.spnt    b0 ;;                        
+(p7)  fma.s.s0 f8=f8,f1,f0
+(p7)  br.ret.spnt    b0 ;;
 }
 
 // Y NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f9, 0xc3           
+      fclass.m.unc  p9,p0 = f9, 0xc3
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p9)  fma.s f8=f9,f1,f0                     
-(p9)  br.ret.spnt    b0 ;;                        
+(p9)  fma.s.s0 f8=f9,f1,f0
+(p9)  br.ret.spnt    b0 ;;
 }
 
-L(FMOD_Y_ZERO):
+FMOD_Y_ZERO:
 // Y zero? Must be zero at this point
 // because it is the only choice left.
 // Return QNAN indefinite
@@ -460,69 +465,66 @@ L(FMOD_Y_ZERO):
 {.mfi
   nop.m 0
   // set Invalid
-  frcpa f12,p0=f0,f0
+  frcpa.s0 f12,p0=f0,f0
   nop.i 999
 }
 // X NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f8, 0xc3           
+      fclass.m.unc  p9,p10 = f8, 0xc3
       nop.i 999 ;;
 }
 { .mfi
       nop.m 999
-(p10)  fclass.nm  p9,p10 = f8, 0xff           
+(p10)  fclass.nm  p9,p10 = f8, 0xff
       nop.i 999 ;;
 }
 
 {.mfi
  nop.m 999
- (p9) frcpa f11,p7=f8,f0
+ (p9) frcpa.s0 f11,p7=f8,f0
  nop.i 0;;
 }
 
 { .mfi
       nop.m 999
-(p10) frcpa f11,p7 = f0,f0           
+(p10) frcpa.s0 f11,p7 = f0,f0
 nop.i 999;;
 }
 
 { .mfi
       nop.m 999
-(p0)  fmerge.s      f10 = f8, f8             
+      fmerge.s      f10 = f8, f8
       nop.i 999
 }
 
 { .mfi
       nop.m 999
-(p0)  fma.s f8=f11,f1,f0                     
+      fma.s.s0 f8=f11,f1,f0
       nop.i 999;;
 }
 
-L(EXP_ERROR_RETURN): 
+EXP_ERROR_RETURN:
 
 
 { .mib
       nop.m 0
-(p0)  mov GR_Parameter_TAG=122                                 
-(p0)  br.sptk __libm_error_region;; 
+      mov GR_Parameter_TAG=122
+      br.sptk __libm_error_region;;
 }
 
-.endp fmodf
-ASM_SIZE_DIRECTIVE(fmodf)
-ASM_SIZE_DIRECTIVE(__ieee754_fmodf)
+GLOBAL_IEEE754_END(fmodf)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
-.fframe 64 
+.fframe 64
         add sp=-64,sp                           // Create new stack
         nop.f 0
         mov GR_SAVE_GP=gp                       // Save gp
@@ -530,18 +532,18 @@ __libm_error_region:
 { .mmi
         stfs [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
         add GR_Parameter_X = 16,sp              // Parameter 1 address
-.save   b0, GR_SAVE_B0                      
-        mov GR_SAVE_B0=b0                       // Save b0 
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
 };;
 .body
 { .mib
-        stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack 
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  
-	nop.b 0                                 // Parameter 3 address
+        stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+    nop.b 0                                 // Parameter 3 address
 }
 { .mib
         stfs [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
         br.call.sptk b0=__libm_error_support#;;  // Call error handling function
 }
 { .mmi
@@ -556,13 +558,14 @@ __libm_error_region:
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
-};; 
+};;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
+
diff --git a/sysdeps/ia64/fpu/e_fmodl.S b/sysdeps/ia64/fpu/e_fmodl.S
index 85c9f6ef82..3e87eb090f 100644
--- a/sysdeps/ia64/fpu/e_fmodl.S
+++ b/sysdeps/ia64/fpu/e_fmodl.S
@@ -1,11 +1,10 @@
 .file "fmodl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2004, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational
-// Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,555 +35,638 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //====================================================================
-// 2/02/00  Initial version
-// 3/02/00  New Algorithm
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
-//          set [the previously overwritten] GR_Parameter_RESULT.
-//11/28/00  Set FR_Y to f9
+// 02/02/00 Initial version
+// 03/02/00 New Algorithm
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
+// set [ the previously overwritten ] GR_Parameter_RESULT.
+// 11/28/00 Set FR_Y to f9
+// 03/11/02 Fixed flags for fmodl(qnan, zero)
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header:.section,.global,.proc,.align
+// 04/28/03 Fix: fmod(sNaN, 0) no longer sets errno
+// 11/23/04 Reformatted routine and improved speed
 //
 // API
 //====================================================================
-// long double fmodl(long double,long double);   
+// long double fmodl(long double, long double);
 //
 // Overview of operation
 //====================================================================
-//  fmod(a,b)=a-i*b,
-//  where i is an integer such that, if b!=0, 
-//  |i|<|a/b| and |a/b-i|<1
+// fmod(a, b)= a-i*b,
+// where i is an integer such that, if b!= 0,
+// |i|<|a/b| and |a/b-i|<1
 //
 // Algorithm
 //====================================================================
 // a). if |a|<|b|, return a
-// b). get quotient and reciprocal overestimates accurate to 
-//     33 bits (q2,y2)
+// b). get quotient and reciprocal overestimates accurate to
+// 33 bits (q2, y2)
 // c). if the exponent difference (exponent(a)-exponent(b))
-//     is less than 32, truncate quotient to integer and
-//     finish in one iteration
-// d). if exponent(a)-exponent(b)>=32 (q2>=2^32)
-//     round quotient estimate to single precision (k=RN(q2)),
-//     calculate partial remainder (a'=a-k*b), 
-//     get quotient estimate (a'*y2), and repeat from c).
+// is less than 32, truncate quotient to integer and
+// finish in one iteration
+// d). if exponent(a)-exponent(b)>= 32 (q2>= 2^32)
+// round quotient estimate to single precision (k= RN(q2)),
+// calculate partial remainder (a'= a-k*b),
+// get quotient estimate (a'*y2), and repeat from c).
 //
 // Registers used
 //====================================================================
-// Predicate registers: p6-p11
-// General registers:   r2,r29,r32 (ar.pfs), r33-r39
-// Floating point registers: f6-f15
 
-#include "libm_support.h"
+GR_SMALLBIASEXP     = r2
+GR_2P32             = r3
+GR_SMALLBIASEXP     = r20
+GR_ROUNDCONST       = r21
+GR_SIG_B            = r22
+GR_ARPFS            = r23
+GR_TMP1             = r24
+GR_TMP2             = r25
+GR_TMP3             = r26
+
+GR_SAVE_B0          = r33
+GR_SAVE_PFS         = r34
+GR_SAVE_GP          = r35
+GR_SAVE_SP          = r36
+
+GR_Parameter_X      = r37
+GR_Parameter_Y      = r38
+GR_Parameter_RESULT = r39
+GR_Parameter_TAG    = r40
+
+FR_X                = f10
+FR_Y                = f9
+FR_RESULT           = f8
+
+FR_ABS_A            = f6
+FR_ABS_B            = f7
+FR_Y_INV            = f10
+FR_SMALLBIAS        = f11
+FR_E0               = f12
+FR_Q                = f13
+FR_E1               = f14
+FR_2P32             = f15
+FR_TMPX             = f32
+FR_TMPY             = f33
+FR_ROUNDCONST       = f34
+FR_QINT             = f35
+FR_QRND24           = f36
+FR_NORM_B           = f37
+FR_TMP              = f38
+FR_TMP2             = f39
+FR_DFLAG            = f40
+FR_Y_INV0           = f41
+FR_Y_INV1           = f42
+FR_Q0               = f43
+FR_Q1               = f44
+FR_QINT_Z           = f45
+FR_QREM             = f46
+FR_B_SGN_A          = f47
 
 .section .text
+GLOBAL_IEEE754_ENTRY(fmodl)
 
-GR_SAVE_B0                    = r33
-GR_SAVE_PFS                   = r34
-GR_SAVE_GP                    = r35 
-GR_SAVE_SP                    = r36
+// inputs in f8, f9
+// result in f8
 
-GR_Parameter_X                = r37
-GR_Parameter_Y                = r38
-GR_Parameter_RESULT           = r39
-GR_Parameter_TAG              = r40
+{ .mfi
+       getf.sig GR_SIG_B = f9
+       // FR_ABS_A = |a|
+       fmerge.s FR_ABS_A = f0, f8
+       mov GR_SMALLBIASEXP = 0x0ffdd
+}
+{ .mfi
+       nop.m 0
+       // FR_ABS_B = |b|
+       fmerge.s FR_ABS_B = f0, f9
+       nop.i 0
+}
+;;
 
-FR_X             = f10
-FR_Y             = f9
-FR_RESULT        = f8
+{ .mfi
+       setf.exp FR_SMALLBIAS = GR_SMALLBIASEXP
+       // (1) y0
+       frcpa.s1 FR_Y_INV0, p6 = FR_ABS_A, FR_ABS_B
+       nop.i 0
+}
+;;
 
+{ .mlx
+       nop.m 0
+       movl GR_ROUNDCONST = 0x33a00000
+}
+;;
 
+// eliminate special cases
+{ .mmi
+       nop.m 0
+       nop.m 0
+       // y pseudo-zero ?
+       cmp.eq p7, p10 = GR_SIG_B, r0
+}
+;;
 
-.proc fmodl#
-.align 32
-.global fmodl#
-.align 32
+// set p7 if b +/-NAN, +/-inf, +/-0
+{ .mfi
+       nop.m 0
+ (p10) fclass.m p7, p10 = f9, 0xe7
+       nop.i 0
+}
+;;
 
-fmodl:
-#ifdef _LIBC
-.global __ieee754_fmodl
-.type __ieee754_fmodl,@function
-__ieee754_fmodl:
-#endif
-// inputs in f8, f9
-// result in f8
+{ .mfi
+       mov GR_2P32 = 0x1001f
+       // (2) q0 = a*y0
+ (p6)  fma.s1 FR_Q0 = FR_ABS_A, FR_Y_INV0, f0
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // (3) e0 = 1 - b * y0
+ (p6)  fnma.s1 FR_E0 = FR_ABS_B, FR_Y_INV0, f1
+       nop.i 0
+}
+;;
 
+// set p9 if a +/-NAN, +/-inf
 { .mfi
-  alloc r32=ar.pfs,1,4,4,0
-  // f6=|a|
-  fmerge.s f6=f0,f8
-  mov r2 = 0x0ffdd
+       nop.m 0
+       fclass.m.unc p9, p11 = f8, 0xe3
+       nop.i 0
 }
-  {.mfi
-  getf.sig r29=f9
-  // f7=|b|
-  fmerge.s f7=f0,f9
-  nop.i 0;;
+       // |a| < |b|? Return a, p8=1
+{ .mfi
+       nop.m 0
+ (p10) fcmp.lt.unc.s1 p8, p0 = FR_ABS_A, FR_ABS_B
+       nop.i 0
 }
+;;
 
+// set p7 if b +/-NAN, +/-inf, +/-0
 { .mfi
-  setf.exp f11 = r2
-  // (1) y0
-  frcpa.s1 f10,p6=f6,f7
-  nop.i 0;;
-} 
+       nop.m 0
+       // pseudo-NaN ?
+ (p10) fclass.nm p7, p0 = f9, 0xff
+       nop.i 0
+}
+;;
 
-// eliminate special cases
-{.mmi
-nop.m 0
-nop.m 0
-// y pseudo-zero ?
-cmp.eq p7,p10=r29,r0;;
+// set p9 if a is +/-NaN, +/-Inf
+{ .mfi
+       nop.m 0
+ (p11) fclass.nm p9, p0 = f8, 0xff
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // b denormal ? set D flag (if |a|<|b|)
+ (p8)  fnma.s0 FR_DFLAG = f9, f1, f9
+       nop.i 0
+}
+;;
+
+{ .mfi
+       // FR_2P32 = 2^32
+       setf.exp FR_2P32 = GR_2P32
+       // (4) q1 = q0+e0*q0
+ (p6)  fma.s1 FR_Q1 = FR_E0, FR_Q0, FR_Q0
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // (5) e1 = e0 * e0 + 2^-34
+ (p6)  fma.s1 FR_E1 = FR_E0, FR_E0, FR_SMALLBIAS
+       nop.i 0
 }
+;;
 
-// Y +-NAN, +-inf, +-0?     p7
 { .mfi
-      nop.m 999
-(p10)  fclass.m  p7,p10 = f9, 0xe7           
-      nop.i 999;;
+       nop.m 0
+       // normalize a (if |a|<|b|)
+ (p8)  fma.s0 f8 = f8, f1, f0
+       nop.i 0
 }
+{ .bbb
+ (p9) br.cond.spnt FMOD_A_NAN_INF
+ (p7) br.cond.spnt FMOD_B_NAN_INF_ZERO
+       // if |a|<|b|, return
+ (p8) br.ret.spnt b0
+}
+;;
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-// X +-NAN, +-inf, ?        p9
 
 { .mfi
-      nop.m 999
-(p0)  fclass.m.unc  p9,p11 = f8, 0xe3           
-      nop.i 999 
+       nop.m 0
+       // (6) y1 = y0 + e0 * y0
+ (p6)  fma.s1 FR_Y_INV1 = FR_E0, FR_Y_INV0, FR_Y_INV0
+       nop.i 0
 }
+;;
 
-// |x| < |y|? Return x p8
 { .mfi
-      nop.m 999
-(p10)  fcmp.lt.unc.s1 p8,p0 = f6,f7             
-      nop.i 999 ;;
-}
-
-  { .mfi
-  mov r2=0x1001f
-  // (2) q0=a*y0
-  (p6) fma.s1 f13=f6,f10,f0
-  nop.i 0
-} { .mfi
-  nop.m 0
-  // (3) e0 = 1 - b * y0
-  (p6) fnma.s1 f12=f7,f10,f1
-  nop.i 0;;
-} 
-
-// Y +-NAN, +-inf, +-0?     p7
-{ .mfi
-      nop.m 999
-	  // pseudo-NaN ?
-(p10)  fclass.nm  p7,p0 = f9, 0xff           
-      nop.i 999
-}
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-// X +-NAN, +-inf, ?        p9
-
-{ .mfi
-      nop.m 999
-(p11)  fclass.nm  p9,p0 = f8, 0xff          
-      nop.i 999;;
-}
-
-{ .mfi
-  nop.m 0
-  //  y denormal ? set D flag (if |x|<|y|)
-  (p8) fnma.s0 f10=f9,f1,f9
-  nop.i 0;;
-}
-
-
-{.mfi
-  nop.m 0
-  // normalize x (if |x|<|y|)
-  (p8) fma.s0 f8=f8,f1,f0
-  nop.i 0
-}
-{.bbb
-  (p9) br.cond.spnt L(FMOD_X_NAN_INF)
-  (p7) br.cond.spnt L(FMOD_Y_NAN_INF_ZERO)
-  // if |x|<|y|, return
-  (p8) br.ret.spnt    b0;;
-}
-
-  {.mfi 
-  nop.m 0
-  // x denormal ? set D flag
-  fnma.s0 f32=f6,f1,f6
-  nop.i 0
-} 
-{.mfi
-  nop.m 0
-  // y denormal ? set D flag
-  fnma.s0 f33=f7,f1,f7
-  nop.i 0;;
-}
-
-  {.mfi
-  // f15=2^32
-  setf.exp f15=r2
-  // (4) q1=q0+e0*q0
-  (p6) fma.s1 f13=f12,f13,f13
-  nop.i 0
-} 
+       nop.m 0
+       // a denormal ? set D flag
+       // b denormal ? set D flag
+       fcmp.eq.s0 p12,p0 = FR_ABS_A, FR_ABS_B
+       nop.i 0
+}
 { .mfi
-  nop.m 0
-  // (5) e1 = e0 * e0 + 2^-34
-  (p6) fma.s1 f14=f12,f12,f11
-  nop.i 0;;
-} 
-{.mlx
-  nop.m 0
-  movl r2=0x33a00000;;
-} 
-{ .mfi
-  nop.m 0
-  // (6) y1 = y0 + e0 * y0
-  (p6) fma.s1 f10=f12,f10,f10
-  nop.i 0;;
-} 
-{.mfi
-  // set f12=1.25*2^{-24}
-  setf.s f12=r2
-  // (7) q2=q1+e1*q1
-  (p6) fma.s1 f13=f13,f14,f13
-  nop.i 0;;
-} 
-{.mfi
-  nop.m 0
-  fmerge.s f9=f8,f9
-  nop.i 0
-} 
-{ .mfi
-  nop.m 0
-  // (8) y2 = y1 + e1 * y1
-  (p6) fma.s1 f10=f14,f10,f10
-  // set p6=0, p10=0
-  cmp.ne.and p6,p10=r0,r0;;
-} 
+       // set FR_ROUNDCONST = 1.25*2^{-24}
+       setf.s FR_ROUNDCONST = GR_ROUNDCONST
+       // (7) q2 = q1+e1*q1
+ (p6)  fma.s1 FR_Q = FR_Q1, FR_E1, FR_Q1
+       nop.i 0
+}
+;;
 
+{ .mfi
+       nop.m 0
+       fmerge.s FR_B_SGN_A = f8, f9
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // (8) y2 = y1 + e1 * y1
+ (p6)  fma.s1 FR_Y_INV = FR_E1, FR_Y_INV1, FR_Y_INV1
+       // set p6 = 0, p10 = 0
+       cmp.ne.and p6, p10 = r0, r0
+}
+;;
 
+//   will compute integer quotient bits (24 bits per iteration)
 .align 32
-L(loop64):
-  {.mfi
-  nop.m 0
-  // compare q2, 2^32
-  fcmp.lt.unc.s1 p8,p7=f13,f15
-  nop.i 0
-}
-  {.mfi
-  nop.m 0
-  // will truncate quotient to integer, if exponent<32 (in advance)
-  fcvt.fx.trunc.s1 f11=f13
-  nop.i 0;;
-}
-  {.mfi
-  nop.m 0
-  // if exponent>32, round quotient to single precision (perform in advance)
-  fma.s.s1 f13=f13,f1,f0
-  nop.i 0;;
-}
-
-
-  {.mfi
-  nop.m 0
-  // set f12=sgn(a)
-  (p8) fmerge.s f12=f8,f1
-  nop.i 0
-}
-  {.mfi
-  nop.m 0
-  // normalize truncated quotient
-  (p8) fcvt.xf f13=f11
-  nop.i 0;;
-}  
-  { .mfi
-  nop.m 0
-  // calculate remainder (assuming f13=RZ(Q))
-  (p7) fnma.s1 f14=f13,f7,f6
-  nop.i 0
-}
-  {.mfi
-  nop.m 0
-  // also if exponent>32, round quotient to single precision 
-  // and subtract 1 ulp: q=q-q*(1.25*2^{-24})
-  (p7) fnma.s.s1 f11=f13,f12,f13
-  nop.i 0;;
-}
-
-  {.mfi
-  nop.m 0
-  // (p8) calculate remainder (82-bit format)
-  (p8) fnma.s1 f11=f13,f7,f6
-  nop.i 0
-}
-  {.mfi
-  nop.m 0
-  // (p7) calculate remainder (assuming f11=RZ(Q))
-  (p7) fnma.s1 f6=f11,f7,f6
-  nop.i 0;;
-}
-
-
-  {.mfi
-  nop.m 0
-  // Final iteration (p8): is f6 the correct remainder (quotient was not overestimated) ?
-  (p8) fcmp.lt.unc.s1 p6,p10=f11,f0
-  nop.i 0;;
-}
-  {.mfi
-  nop.m 0
-  // get new quotient estimation: a'*y2
-  (p7) fma.s1 f13=f14,f10,f0
-  nop.i 0
-}
-  {.mfb
-  nop.m 0
-  // was f13=RZ(Q) ? (then new remainder f14>=0)
-  (p7) fcmp.lt.unc.s1 p7,p9=f14,f0
-  nop.b 0;;
-}
-
-
-.pred.rel "mutex",p6,p10
-  {.mfb
-  nop.m 0
-  // add b to estimated remainder (to cover the case when the quotient was overestimated) 
-  // also set correct sign by using f9=|b|*sgn(a), f12=sgn(a)
-  (p6) fma.s0 f8=f11,f12,f9
-  nop.b 0
-}
-  {.mfb
-  nop.m 0
-  // set correct sign of result before returning: f12=sgn(a)
-  (p10) fma.s0 f8=f11,f12,f0
-  (p8) br.ret.sptk b0;;
-}
-  {.mfi
-  nop.m 0
-  // if f13!=RZ(Q), get alternative quotient estimation: a''*y2
-  (p7) fma.s1 f13=f6,f10,f0
-  nop.i 0
-}
-  {.mfb
-  nop.m 0
-  // if f14 was RZ(Q), set remainder to f14
-  (p9) mov f6=f14
-  br.cond.sptk L(loop64);;
-}
-
-
-
-L(FMOD_X_NAN_INF): 
-
-// Y zero ?
-{.mfi 
-  nop.m 0
-  fma.s1 f10=f9,f1,f0
-  nop.i 0;;
-}
-{.mfi
- nop.m 0
- fcmp.eq.unc.s1 p11,p0=f10,f0
- nop.i 0;;
-}
-{.mib
-  nop.m 0
-  nop.i 0
-  // if Y zero
-  (p11) br.cond.spnt L(FMOD_Y_ZERO);;                        
-}
-
-// X infinity? Return QNAN indefinite
-{ .mfi
-	 // set p7 t0 0
-	 cmp.ne p7,p0=r0,r0
-(p0) fclass.m.unc  p8,p9 = f8, 0x23 
-     nop.i 999;; 
+loop64:
+{ .mfi
+       nop.m 0
+       // compare q2, 2^32
+       fcmp.lt.unc.s1 p8, p7 = FR_Q, FR_2P32
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // will truncate quotient to integer, if exponent<32 (in advance)
+       fcvt.fx.trunc.s1 FR_QINT = FR_Q
+       nop.i 0
+}
+;;
+
+{ .mfi
+       nop.m 0
+       // if exponent>32 round quotient to single precision (perform in advance)
+       fma.s.s1 FR_QRND24 = FR_Q, f1, f0
+       nop.i 0
+}
+;;
+
+{ .mfi
+       nop.m 0
+       // set FR_ROUNDCONST = sgn(a)
+ (p8)  fmerge.s FR_ROUNDCONST = f8, f1
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // normalize truncated quotient
+ (p8)  fcvt.xf FR_QRND24 = FR_QINT
+       nop.i 0
+}
+;;
+
+{ .mfi
+       nop.m 0
+       // calculate remainder (assuming FR_QRND24 = RZ(Q))
+ (p7)  fnma.s1 FR_E1 = FR_QRND24, FR_ABS_B, FR_ABS_A
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // also if exponent>32, round quotient to single precision
+       // and subtract 1 ulp: q = q-q*(1.25*2^{-24})
+ (p7)  fnma.s.s1 FR_QINT_Z = FR_QRND24, FR_ROUNDCONST, FR_QRND24
+       nop.i 0
+}
+;;
+
+{ .mfi
+       nop.m 0
+       // (p8) calculate remainder (82-bit format)
+ (p8)  fnma.s1 FR_QREM = FR_QRND24, FR_ABS_B, FR_ABS_A
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // (p7) calculate remainder (assuming FR_QINT_Z = RZ(Q))
+ (p7)  fnma.s1 FR_ABS_A = FR_QINT_Z, FR_ABS_B, FR_ABS_A
+       nop.i 0
 }
-// Y NaN ?
-{.mfi
-     nop.m 999
-(p8) fclass.m p9,p8=f9,0xc3
-	 nop.i 0;;
+;;
+
+{ .mfi
+       nop.m 0
+       // Final iteration (p8): is FR_ABS_A the correct remainder 
+       // (quotient was not overestimated) ?
+ (p8)  fcmp.lt.unc.s1 p6, p10 = FR_QREM, f0
+       nop.i 0
+}
+;;
+
+{ .mfi
+       nop.m 0
+       // get new quotient estimation: a'*y2
+ (p7)  fma.s1 FR_Q = FR_E1, FR_Y_INV, f0
+       nop.i 0
+}
+{ .mfb
+       nop.m 0
+       // was FR_Q = RZ(Q) ? (then new remainder FR_E1> = 0)
+ (p7)  fcmp.lt.unc.s1 p7, p9 = FR_E1, f0
+       nop.b 0
+}
+;;
+
+.pred.rel "mutex", p6, p10
+{ .mfb
+       nop.m 0
+       // add b to estimated remainder (to cover the case when the quotient was
+       // overestimated)
+       // also set correct sign by using 
+       // FR_B_SGN_A = |b|*sgn(a), FR_ROUNDCONST = sgn(a)
+ (p6)  fma.s0 f8 = FR_QREM, FR_ROUNDCONST, FR_B_SGN_A
+       nop.b 0
+}
+{ .mfb
+       nop.m 0
+       // set correct sign of result before returning: FR_ROUNDCONST = sgn(a)
+ (p10) fma.s0 f8 = FR_QREM, FR_ROUNDCONST, f0
+ (p8)  br.ret.sptk b0
+}
+;;
+
+{ .mfi
+       nop.m 0
+       // if f13! = RZ(Q), get alternative quotient estimation: a''*y2
+ (p7)  fma.s1 FR_Q = FR_ABS_A, FR_Y_INV, f0
+       nop.i 0
+}
+{ .mfb
+       nop.m 0
+       // if FR_E1 was RZ(Q), set remainder to FR_E1
+ (p9)  fma.s1 FR_ABS_A = FR_E1, f1, f0
+       br.cond.sptk loop64
+}
+;;
+
+FMOD_A_NAN_INF:
+
+// b zero ?
+{ .mfi
+       nop.m 0
+       fclass.m p10, p0 = f8, 0xc3 // Test a = nan
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       fma.s1 FR_NORM_B = f9, f1, f0
+       nop.i 0
 }
-// Y not pseudo-zero ? (r29 holds significand)
-{.mii
-     nop.m 999
-(p8) cmp.ne p7,p0=r29,r0
-     nop.i 0;;
+;;
+
+{ .mfi
+       nop.m 0
+       fma.s0 f8 = f8, f1, f0
+       nop.i 0
 }
-{.mfi
-	nop.m 999
-(p8)  frcpa.s0 f8,p0 = f8,f8           
-    nop.i 0
-} 
 { .mfi
-     nop.m 999
-	// also set Denormal flag if necessary
-(p7) fnma.s0 f9=f9,f1,f9
-     nop.i 999 ;;
+       nop.m 0
+ (p10) fclass.m p10, p0 = f9, 0x07 // Test x = nan, and y = zero
+       nop.i 0
 }
+;;
 
 { .mfb
-      nop.m 999
-(p8)  fma.s0 f8=f8,f1,f0                     
-	  nop.b 999 ;;                        
+       nop.m 0
+       fcmp.eq.unc.s1 p11, p0 = FR_NORM_B, f0
+ (p10) br.ret.spnt b0 // Exit with result = a if a = nan and b = zero
+}
+;;
+
+{ .mib
+       nop.m 0
+       nop.i 0
+       // if Y zero
+ (p11) br.cond.spnt FMOD_B_ZERO
+}
+;;
+
+// a= infinity? Return QNAN indefinite
+{ .mfi
+       // set p7 t0 0
+       cmp.ne p7, p0 = r0, r0
+       fclass.m.unc p8, p9 = f8, 0x23
+       nop.i 0
+}
+;;
+
+// b NaN ?
+{ .mfi
+       nop.m 0
+ (p8)  fclass.m p9, p8 = f9, 0xc3
+       nop.i 0
+}
+;;
+
+// b not pseudo-zero ? (GR_SIG_B holds significand)
+{ .mii
+       nop.m 0
+ (p8)  cmp.ne p7, p0 = GR_SIG_B, r0
+       nop.i 0
+}
+;;
+
+{ .mfi
+       nop.m 0
+ (p8)  frcpa.s0 f8, p0 = f8, f8
+       nop.i 0
+}
+{ .mfi
+       nop.m 0
+       // also set Denormal flag if necessary
+ (p7)  fnma.s0 f9 = f9, f1, f9
+       nop.i 0
 }
+;;
 
 { .mfb
-      nop.m 999
-(p9)  frcpa.s0 f8,p7=f8,f9                     
-      br.ret.sptk    b0 ;;                        
+       nop.m 0
+ (p8)  fma.s0 f8 = f8, f1, f0
+       nop.b 0
 }
+;;
 
+{ .mfb
+       nop.m 0
+ (p9)  frcpa.s0 f8, p7 = f8, f9
+       br.ret.sptk b0
+}
+;;
 
-L(FMOD_Y_NAN_INF_ZERO): 
-// Y INF
+FMOD_B_NAN_INF_ZERO:
+// b INF
 { .mfi
-      nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0x23           
-      nop.i 999 ;;
+       nop.m 0
+       fclass.m.unc p7, p0 = f9, 0x23
+       nop.i 0
 }
+;;
 
 { .mfb
-      nop.m 999
-(p7)  fma f8=f8,f1,f0                     
-(p7)  br.ret.spnt    b0 ;;                        
+       nop.m 0
+ (p7)  fma.s0 f8 = f8, f1, f0
+ (p7)  br.ret.spnt b0
 }
+;;
 
-// Y NAN?
+// b NAN?
 { .mfi
-      nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f9, 0xc3           
-      nop.i 999 ;;
+       nop.m 0
+       fclass.m.unc p9, p10 = f9, 0xc3
+       nop.i 0
 }
+;;
+
 { .mfi
-      nop.m 999
-(p10)  fclass.nm  p9,p0 = f9, 0xff           
-      nop.i 999 ;;
+       nop.m 0
+ (p10) fclass.nm p9, p0 = f9, 0xff
+       nop.i 0
 }
+;;
 
 { .mfb
-      nop.m 999
-(p9)  fma f8=f9,f1,f0                     
-(p9)  br.ret.spnt    b0 ;;                        
+       nop.m 0
+ (p9)  fma.s0 f8 = f9, f1, f0
+ (p9)  br.ret.spnt b0
 }
+;;
 
-L(FMOD_Y_ZERO):
+FMOD_B_ZERO:
 // Y zero? Must be zero at this point
 // because it is the only choice left.
 // Return QNAN indefinite
 
-{.mfi
-  nop.m 0
-  // set Invalid
-  frcpa f12,p0=f0,f0
-  nop.i 0
-}
-// X NAN?
 { .mfi
-      nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f8, 0xc3           
-      nop.i 999 ;;
+       nop.m 0
+       // set Invalid
+       frcpa.s0 FR_TMP, p0 = f0, f0
+       nop.i 0
 }
+;;
+
+// a NAN?
 { .mfi
-      nop.m 999
-(p10)  fclass.nm  p9,p10 = f8, 0xff           
-      nop.i 999 ;;
+       nop.m 0
+       fclass.m.unc p9, p10 = f8, 0xc3
+       nop.i 0
 }
+;;
 
-{.mfi
- nop.m 999
- (p9) frcpa f11,p7=f8,f0
- nop.i 0;;
+{ .mfi
+       alloc GR_ARPFS = ar.pfs, 1, 4, 4, 0
+ (p10) fclass.nm p9, p10 = f8, 0xff
+       nop.i 0
 }
-
+;;
 
 { .mfi
-      nop.m 999
-(p10) frcpa  f11,p7 = f9,f9           
-(p0)  mov    GR_Parameter_TAG = 120 ;;                                 
+       nop.m 0
+ (p9)  frcpa.s0 FR_TMP2, p7 = f8, f0
+       nop.i 0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p0)  fmerge.s      f10 = f8, f8             
-      nop.i 999
+       nop.m 0
+ (p10) frcpa.s0 FR_TMP2, p7 = f9, f9
+       mov GR_Parameter_TAG = 120
 }
+;;
 
+{ .mfi
+       nop.m 0
+       fmerge.s FR_X = f8, f8
+       nop.i 0
+}
 { .mfb
-      nop.m 999
-(p0)  fma f8=f11,f1,f0                     
-(p0)  br.sptk __libm_error_region;; 
+       nop.m 0
+       fma.s0 f8 = FR_TMP2, f1, f0
+       br.sptk __libm_error_region
 }
+;;
 
-.endp fmodl
-ASM_SIZE_DIRECTIVE(fmodl)
-ASM_SIZE_DIRECTIVE(__ieee754_fmodl)
+GLOBAL_IEEE754_END(fmodl)
 
-
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+       add GR_Parameter_Y = -32, sp // Parameter 2 value
+       nop.f 0
+.save ar.pfs, GR_SAVE_PFS
+       mov GR_SAVE_PFS = ar.pfs     // Save ar.pfs
 }
 { .mfi
-.fframe 64 
-        add sp=-64,sp                           // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
-};;
+.fframe 64
+       add sp = -64, sp             // Create new stack
+       nop.f 0
+       mov GR_SAVE_GP = gp          // Save gp
+}
+;;
+
 { .mmi
-        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
-.save   b0, GR_SAVE_B0                      
-        mov GR_SAVE_B0=b0                       // Save b0 
-};;
+       stfe [ GR_Parameter_Y ] = FR_Y, 16 // Save Parameter 2 on stack
+       add GR_Parameter_X = 16, sp  // Parameter 1 address
+.save b0, GR_SAVE_B0
+       mov GR_SAVE_B0 = b0          // Save b0
+}
+;;
+
 .body
 { .mib
-        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack 
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  
-	nop.b 0                                 // Parameter 3 address
+       stfe [ GR_Parameter_X ] = FR_X // Store Parameter 1 on stack
+       add GR_Parameter_RESULT = 0, GR_Parameter_Y
+       nop.b 0                      // Parameter 3 address
 }
 { .mib
-        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y  
-        br.call.sptk b0=__libm_error_support#  // Call error handling function
-};;
+       stfe [ GR_Parameter_Y ] = FR_RESULT // Store Parameter 3 on stack
+       add GR_Parameter_Y = -16, GR_Parameter_Y
+       br.call.sptk b0 = __libm_error_support# // Call error handling function
+}
+;;
+
 { .mmi
-        nop.m 0
-        nop.m 0
-        add   GR_Parameter_RESULT = 48,sp
-};;
+       nop.m 0
+       nop.m 0
+       add GR_Parameter_RESULT = 48, sp
+}
+;;
+
 { .mmi
-        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+       ldfe f8 = [ GR_Parameter_RESULT ] // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
-};;
-{ .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
-};; 
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+       add sp = 64, sp                   // Restore stack pointer
+       mov b0 = GR_SAVE_B0               // Restore return address
+}
+;;
 
+{ .mib
+       mov gp = GR_SAVE_GP               // Restore gp
+       mov ar.pfs = GR_SAVE_PFS          // Restore ar.pfs
+       br.ret.sptk b0                    // Return
+}
+;;
 
+LOCAL_LIBM_END(__libm_error_region)
 
-.type   __libm_error_support#,@function
+.type __libm_error_support#, @function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_logl.c b/sysdeps/ia64/fpu/e_gamma_r.c
index 41254ae60a..41254ae60a 100644
--- a/sysdeps/ia64/fpu/e_logl.c
+++ b/sysdeps/ia64/fpu/e_gamma_r.c
diff --git a/sysdeps/ia64/fpu/e_gammaf_r.c b/sysdeps/ia64/fpu/e_gammaf_r.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_gammaf_r.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/e_gammal_r.c b/sysdeps/ia64/fpu/e_gammal_r.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_gammal_r.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/e_hypot.S b/sysdeps/ia64/fpu/e_hypot.S
index 113aac3461..36cfd1e667 100644
--- a/sysdeps/ia64/fpu/e_hypot.S
+++ b/sysdeps/ia64/fpu/e_hypot.S
@@ -1,11 +1,10 @@
-.file "hypot.asm"
+.file "hypot.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the 
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,24 +35,27 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // History: 
-// 2/02/00  hand-optimized
-// 4/04/00  Unwind support added
-// 6/20/00  new version
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 hand-optimized
+// 04/04/00 Unwind support added
+// 06/20/00 new version
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/17/03 Added missing mutex directive
 //
-// *********************************************************************
+//*********************************************************************
 //                           ___________
 // Function:   hypot(x,y) = |(x^2 + y^2) = for double precision values
 //             x and y
 //             Also provides cabs functionality.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
@@ -68,7 +70,7 @@
 //
 //    Predicate Registers:      p6 - p10
 //
-// *********************************************************************
+//*********************************************************************
 //
 // IEEE Special Conditions:
 //
@@ -78,7 +80,7 @@
 //    hypot(QNaN and anything) = QNaN
 //    hypot(SNaN and anything ) = QNaN
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Implementation:
 //  x2 = x * x   in double-extended
@@ -86,9 +88,7 @@
 //  temp = x2 + y2   in double-extended
 //  sqrt(temp) rounded to double 
 //
-// *********************************************************************
-
-#include "libm_support.h"
+//*********************************************************************
 
 GR_SAVE_PFS         = r33
 GR_SAVE_B0          = r34
@@ -103,23 +103,12 @@ FR_Y                = f33
 FR_RESULT           = f8
 
 .section .text
-#ifndef _LIBC
-.proc cabs#
-.global cabs#
-cabs: 
-.endp cabs
-#endif
-.proc hypot#
-.global hypot#
-.align 64 
-
-hypot:
-#ifdef _LIBC
-.global __hypot
-__hypot:
-.global __ieee754_hypot
-__ieee754_hypot:
-#endif 
+
+LOCAL_LIBM_ENTRY(cabs)
+LOCAL_LIBM_END(cabs)
+
+GLOBAL_IEEE754_ENTRY(hypot)
+
 {.mfi
   alloc r32= ar.pfs,0,4,4,0
   // Compute x*x
@@ -221,6 +210,7 @@ __ieee754_hypot:
   mov r2=0x107fb;;
 }
 
+.pred.rel "mutex",p7,p8
 {.mfb
   nop.m 0
   // if f8=Infinity or f9=Zero, return |f8|
@@ -394,11 +384,9 @@ __ieee754_hypot:
 	 // No overflow
 (p9) br.ret.sptk b0;; 
 }
-.endp hypot
-ASM_SIZE_DIRECTIVE(hypot)
+GLOBAL_IEEE754_END(hypot)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -445,7 +433,8 @@ __libm_error_region:
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
 };;
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region) 
+LOCAL_LIBM_END(__libm_error_region#)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
+
diff --git a/sysdeps/ia64/fpu/e_hypotf.S b/sysdeps/ia64/fpu/e_hypotf.S
index 0a11ec5b41..d6fcbd1a01 100644
--- a/sysdeps/ia64/fpu/e_hypotf.S
+++ b/sysdeps/ia64/fpu/e_hypotf.S
@@ -1,11 +1,10 @@
-.file "hypotf.asm"
+.file "hypotf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the 
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,24 +35,27 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // History: 
-// 2/02/00  hand-optimized
-// 4/04/00  Unwind support added
-// 6/26/00  new version
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 hand-optimized
+// 04/04/00 Unwind support added
+// 06/26/00 new version
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/17/03 Added missing mutex directive
 //
-// *********************************************************************
+//*********************************************************************
 //                           ___________
 // Function:   hypotf(x,y) = |(x^2 + y^2) = for single precision values
 //             x and y
 //             Also provides cabsf functionality.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
@@ -68,7 +70,7 @@
 //
 //    Predicate Registers:      p6 - p10
 //
-// *********************************************************************
+//*********************************************************************
 //
 // IEEE Special Conditions:
 //
@@ -78,7 +80,7 @@
 //    hypotf(QNaN and anything) = QNaN
 //    hypotf(SNaN and anything ) = QNaN
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Implementation:
 //  x2 = x * x   in double-extended
@@ -86,9 +88,7 @@
 //  temp = x2 + y2   in double-extended
 //  sqrt(temp) rounded to single precision 
 //
-// *********************************************************************
-
-#include "libm_support.h"
+//*********************************************************************
 
 GR_SAVE_PFS         = r33
 GR_SAVE_B0          = r34
@@ -103,23 +103,11 @@ FR_Y                = f15
 FR_RESULT           = f8
 
 .section .text
-#ifndef _LIBC
-.proc cabsf#
-.global cabsf#
-cabsf: 
-.endp cabsf
-#endif
-.proc hypotf#
-.global hypotf#
-.align 64 
-
-hypotf: 
-#ifdef _LIBC
-.global __hypotf
-__hypotf:
-.global __ieee754_hypotf
-__ieee754_hypotf:
-#endif 
+
+LOCAL_LIBM_ENTRY(cabsf)
+LOCAL_LIBM_END(cabsf)
+
+GLOBAL_IEEE754_ENTRY(hypotf)
 {.mfi
   alloc r32= ar.pfs,0,4,4,0
   // Compute x*x
@@ -207,6 +195,7 @@ __ieee754_hypotf:
   nop.i 0;;
 }
 
+.pred.rel "mutex",p7,p8
 {.mfb
   nop.m 0
   // if f8=Infinity or f9=Zero, return |f8|
@@ -348,15 +337,13 @@ __ieee754_hypotf:
 	 // No overflow
 (p9) br.ret.sptk b0;; 
 }
-.endp hypotf
-ASM_SIZE_DIRECTIVE(hypotf)
+GLOBAL_IEEE754_END(hypotf)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mii
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-(p0)    mov   GR_Parameter_TAG = 47                   
+        mov   GR_Parameter_TAG = 47                   
 .save   ar.pfs,GR_SAVE_PFS
         mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
@@ -400,8 +387,9 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };; 
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/e_hypotl.S b/sysdeps/ia64/fpu/e_hypotl.S
index 986faf6fcc..988b86e761 100644
--- a/sysdeps/ia64/fpu/e_hypotl.S
+++ b/sysdeps/ia64/fpu/e_hypotl.S
@@ -1,11 +1,10 @@
-.file "hypotl.asm"
+.file "hypotl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the 
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,24 +35,26 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // History: 
-// 2/02/00  hand-optimized
-// 4/04/00  Unwind support added
-// 6/20/00  new version
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 hand-optimized
+// 04/04/00 Unwind support added
+// 06/20/00 new version
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
-// *********************************************************************
+//*********************************************************************
 //                           ___________
 // Function:   hypotl(x,y) = |(x^2 + y^2) = for double extended values
 //             x and y
 //             Also provides cabsl functionality.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
@@ -68,7 +69,7 @@
 //
 //    Predicate Registers:      p6 - p10
 //
-// *********************************************************************
+//*********************************************************************
 //
 // IEEE Special Conditions:
 //
@@ -78,7 +79,7 @@
 //    hypotl(QNaN and anything) = QNaN
 //    hypotl(SNaN and anything ) = QNaN
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Implementation:
 //  x2 = x * x   in double-extended
@@ -86,9 +87,7 @@
 //  temp = x2 + y2   in double-extended
 //  sqrt(temp) rounded to double extended
 //
-// *********************************************************************
-
-#include "libm_support.h"
+//*********************************************************************
 
 GR_SAVE_PFS         = r33
 GR_SAVE_B0          = r34
@@ -103,23 +102,11 @@ FR_Y                = f33
 FR_RESULT           = f8
 
 .section .text
-#ifndef _LIBC
-.proc cabsl#
-.global cabsl#
-cabsl: 
-.endp cabsl
-#endif
-.proc hypotl#
-.global hypotl#
-.align 64 
-
-hypotl: 
-#ifdef _LIBC
-.global __hypotl
-__hypotl:
-.global __ieee754_hypotl
-__ieee754_hypotl:
-#endif 
+
+LOCAL_LIBM_ENTRY(cabsl)
+LOCAL_LIBM_END(cabsl)
+
+GLOBAL_IEEE754_ENTRY(hypotl)
 {.mfi
   alloc r32= ar.pfs,0,4,4,0
   // Compute x*x
@@ -434,11 +421,9 @@ __ieee754_hypotl:
 	 // No overflow
 (p9) br.ret.sptk b0;; 
 }
-.endp hypotl
-ASM_SIZE_DIRECTIVE(hypotl)
+GLOBAL_IEEE754_END(hypotl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -485,7 +470,9 @@ __libm_error_region:
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
 };;
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region) 
+LOCAL_LIBM_END(__libm_error_region#)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
+
+
diff --git a/sysdeps/ia64/fpu/e_lgamma_r.c b/sysdeps/ia64/fpu/e_lgamma_r.c
new file mode 100644
index 0000000000..cb9efbfe02
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_lgamma_r.c
@@ -0,0 +1,71 @@
+/* file: lgamma_r.c */
+
+
+// Copyright (c) 2002 Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+// History
+//==============================================================
+// 02/04/02: Initial version
+// 02/22/02: Removed lgammaf_r, gammaf_r
+/*
+//   FUNCTIONS:    double  lgamma_r(double x, int* signgam)
+//                 double  gamma_r(double x, int* signgam)
+//                 Natural logarithm of GAMMA function
+*/
+
+#include "libm_support.h"
+
+
+extern double __libm_lgamma(double /*x*/, int* /*signgam*/, int /*signgamsz*/);
+
+
+double __ieee754_lgamma_r(double x, int* signgam)
+{
+    return __libm_lgamma(x, signgam, sizeof(*signgam));
+}
+weak_alias (__ieee754_lgamma_r, lgamma_r)
+
+#ifndef _LIBC
+double __ieee754_gamma_r(double x, int* signgam)
+{
+    return __libm_lgamma(x, signgam, sizeof(*signgam));
+}
+weak_alias (__ieee754_gamma_r, gamma_r)
+#endif
diff --git a/sysdeps/ia64/fpu/e_lgammaf_r.c b/sysdeps/ia64/fpu/e_lgammaf_r.c
new file mode 100644
index 0000000000..44911aeabd
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_lgammaf_r.c
@@ -0,0 +1,71 @@
+/* file: lgammaf_r.c */
+
+
+// Copyright (c) 2002 Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+// History
+//==============================================================
+// 02/04/02: Initial version
+// 02/22/02: Removed lgamma_r, gamma_r
+/*
+//   FUNCTIONS:    float   lgammaf_r(float x, int* signgam)
+//                 float   gammaf_r(float x, int* signgam)
+//                 Natural logarithm of GAMMA function
+*/
+
+#include "libm_support.h"
+
+
+extern float  __libm_lgammaf(float /*x*/, int* /*signgam*/, int /*signgamsz*/);
+
+
+float __ieee754_lgammaf_r(float x, int* signgam)
+{
+    return __libm_lgammaf(x, signgam, sizeof(*signgam));
+}
+weak_alias (__ieee754_lgammaf_r, lgammaf_r)
+
+#ifndef _LIBC
+float __ieee754_gammaf_r(float x, int* signgam)
+{
+    return __libm_lgammaf(x, signgam, sizeof(*signgam));
+}
+weak_alias (__ieee754_gammaf_r, gammaf_r)
+#endif
diff --git a/sysdeps/ia64/fpu/e_lgammal_r.c b/sysdeps/ia64/fpu/e_lgammal_r.c
new file mode 100644
index 0000000000..4451201b77
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_lgammal_r.c
@@ -0,0 +1,70 @@
+/* file: lgammal_r.c */
+
+
+// Copyright (c) 2002 Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+// History
+//==============================================================
+// 08/15/02: Initial version
+/*
+//   FUNCTIONS:    long double  lgammal_r(long double x, int* signgam)
+//                 long double  gammal_r(long double x, int* signgam)
+//                 Natural logarithm of GAMMA function
+*/
+
+#include "libm_support.h"
+
+
+extern double __libm_lgammal(long double /*x*/, int* /*signgam*/, int /*signgamsz*/);
+
+
+long double __ieee754_lgammal_r(long double x, int* signgam)
+{
+    return __libm_lgammal(x, signgam, sizeof(*signgam));
+}
+weak_alias (__ieee754_lgammal_r, lgammal_r)
+
+#ifndef _LIBC
+long double __ieee754_gammal_r(long double x, int* signgam)
+{
+    return __libm_lgammal(x, signgam, sizeof(*signgam));
+}
+weak_alias (__ieee754_gammal_r, gammal_r)
+#endif
diff --git a/sysdeps/ia64/fpu/e_log.S b/sysdeps/ia64/fpu/e_log.S
index 9ad1e5fe56..c644c6f8f7 100644
--- a/sysdeps/ia64/fpu/e_log.S
+++ b/sysdeps/ia64/fpu/e_log.S
@@ -1,10 +1,10 @@
 .file "log.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1085 +20,1710 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 6/16/00  Updated table to be rounded correctly
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 06/16/00 Updated table to be rounded correctly
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 8/17/00  Improved speed of main path by 5 cycles
+// 08/17/00 Improved speed of main path by 5 cycles
 //          Shortened path for x=1.0
-// 1/09/01  Improved speed, fixed flags for neg denormals
-//
+// 01/09/01 Improved speed, fixed flags for neg denormals
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 05/23/02 Modified algorithm. Now only one polynomial is used
+//          for |x-1| >= 1/256 and for |x-1| < 1/256
+// 12/11/02 Improved performance for Itanium 2
+// 03/31/05 Reformatted delimiters between data tables
 //
 // API
 //==============================================================
 // double log(double)
 // double log10(double)
 //
+//
 // Overview of operation
 //==============================================================
 // Background
+// ----------
 //
-// Consider  x = 2^N 1.f1 f2 f3 f4...f63
-// Log(x) = log(frcpa(x) x/frcpa(x))
-//        = log(1/frcpa(x)) + log(frcpa(x) x)
-//        = -log(frcpa(x)) + log(frcpa(x) x)
+// This algorithm is based on fact that
+// log(a b) = log(a) + log(b).
+// In our case we have x = 2^N f, where 1 <= f < 2.
+// So
+//   log(x) = log(2^N f) = log(2^N) + log(f) = n*log(2) + log(f)
 //
-// frcpa(x)       = 2^-N frcpa((1.f1 f2 ... f63)
+// To calculate log(f) we do following
+//   log(f) = log(f * frcpa(f) / frcpa(f)) =
+//          = log(f * frcpa(f)) + log(1/frcpa(f))
 //
-// -log(frcpa(x)) = -log(C) 
-//                = -log(2^-N) - log(frcpa(1.f1 f2 ... f63))
+// According to definition of IA-64's frcpa instruction it's a
+// floating point that approximates 1/f using a lookup on the
+// top of 8 bits of the input number's significand with relative
+// error < 2^(-8.886). So we have following
 //
-// -log(frcpa(x)) = -log(C) 
-//                = +Nlog2 - log(frcpa(1.f1 f2 ... f63))
+// |(1/f - frcpa(f)) / (1/f))| = |1 - f*frcpa(f)| < 1/256
 //
-// -log(frcpa(x)) = -log(C) 
-//                = +Nlog2 + log(frcpa(1.f1 f2 ... f63))
+// and
 //
-// Log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
-
-// Log(x) =  +Nlog2 + log(1./frcpa(1.f1 f2 ... f63)) + log(frcpa(x) x)
-// Log(x) =  +Nlog2 - log(/frcpa(1.f1 f2 ... f63))   + log(frcpa(x) x)
-// Log(x) =  +Nlog2 + T                              + log(frcpa(x) x)
+// log(f) = log(f * frcpa(f)) + log(1/frcpa(f)) =
+//        = log(1 + r) + T
+//
+// The first value can be computed by polynomial P(r) approximating
+// log(1 + r) on |r| < 1/256 and the second is precomputed tabular
+// value defined by top 8 bit of f.
 //
-// Log(x) =  +Nlog2 + T                     + log(C x)
+// Finally we have that  log(x) ~ (N*log(2) + T) + P(r)
 //
-// Cx = 1 + r
+// Note that if input argument is close to 1.0 (in our case it means
+// that |1 - x| < 1/256) we can use just polynomial approximation
+// because x = 2^0 * f = f = 1 + r and
+// log(x) = log(1 + r) ~ P(r)
 //
-// Log(x) =  +Nlog2 + T  + log(1+r)
-// Log(x) =  +Nlog2 + T  + Series( r - r^2/2 + r^3/3 - r^4/4 ....)
 //
-// 1.f1 f2 ... f8 has 256 entries.
-// They are 1 + k/2^8, k = 0 ... 255
-// These 256 values are the table entries.
+// To compute log10(x) we use the simple identity
+//
+//  log10(x) = log(x)/log(10)
+//
+// so we have that
+//
+//  log10(x) = (N*log(2) + T  + log(1+r)) / log(10) =
+//           = N*(log(2)/log(10)) + (T/log(10)) + log(1 + r)/log(10)
+//
 //
 // Implementation
-//===============
-// CASE 1:  |x-1| >= 2^-6
-// C = frcpa(x)
-// r = C * x - 1
+// --------------
+// It can be seen that formulas for log and log10 differ from one another
+// only by coefficients and tabular values. Namely as log as log10 are
+// calculated as (N*L1 + T) + L2*Series(r) where in case of log
+//   L1 = log(2)
+//   T  = log(1/frcpa(x))
+//   L2 = 1.0
+// and in case of log10
+//   L1 = log(2)/log(10)
+//   T  = log(1/frcpa(x))/log(10)
+//   L2 = 1.0/log(10)
 //
-// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4 + P4*r^5 + P5*r^6
+// So common code with two different entry points those set pointers
+// to the base address of coresponding data sets containing values
+// of L2,T and prepare integer representation of L1 needed for following
+// setf instruction.
 //
-// x = f * 2*n where f is 1.f_1f_2f_3....f_63
-// Nfloat = float(n)  where n is the true unbiased exponent
-// pre-index = f_1f_2....f_8
-// index = pre_index * 16
-// get the dxt table entry at index + offset = T
+// Note that both log and log10 use common approximation polynomial
+// it means we need only one set of coefficients of approximation.
 //
-// result = (T + Nfloat * log(2)) + rseries
 //
-// The T table is calculated as follows
-// Form x_k = 1 + k/2^8 where k goes from 0... 255
-//      y_k = frcpa(x_k)
-//      log(1/y_k)  in quad and round to double-extended
-
-// CASE 2:  |x-1| < 2^-6
-// w = x - 1
+// 1. |x-1| >= 1/256
+//   InvX = frcpa(x)
+//   r = InvX*x - 1
+//   P(r) = r*((r*A3 - A2) + r^4*((A4 + r*A5) + r^2*(A6 + r*A7)),
+//   all coefficients are calcutated in quad and rounded to double
+//   precision. A7,A6,A5,A4 are stored in memory whereas A3 and A2
+//   created with setf.
+//
+//   N = float(n) where n is true unbiased exponent of x
+//
+//   T is tabular value of log(1/frcpa(x)) calculated in quad precision
+//   and represented by two floating-point numbers 64-bit Thi and 32-bit Tlo.
+//   To load Thi,Tlo we get bits from 55 to 62 of register format significand
+//   as index and calculate two addresses
+//     ad_Thi = Thi_table_base_addr + 8 * index
+//     ad_Tlo = Tlo_table_base_addr + 4 * index
+//
+//   L2 (1.0 or 1.0/log(10) depending on function) is calculated in quad
+//   precision and rounded to double extended; it's loaded from memory.
+//
+//   L1 (log(2) or log10(2) depending on function) is calculated in quad
+//   precision and represented by two floating-point 64-bit numbers L1hi,L1lo
+//   stored in memory.
 //
-// Form wseries = w + Q1*w^2 + Q2*w^3 + ... + Q7*w^8 + Q8*w^9
+//   And final result = ((L1hi*N + Thi) + (N*L1lo + Tlo)) + L2*P(r)
+//
+//
+// 2. |x-1| < 1/256
+//   r = x - 1
+//   P(r) = r*((r*A3 - A2) + r^4*((A4 + r*A5) + r^2*(A6 + r*A7)),
+//   A7,A6,A5A4,A3,A2 are the same as in case |x-1| >= 1/256
+//
+//   And final results
+//     log(x)   = P(r)
+//     log10(x) = L2*P(r)
+//
+// 3. How we define is input argument such that |x-1| < 1/256 or not.
+//
+//    To do it we analyze biased exponent and integer representation of
+//    input argument
+//
+//      a) First we test is biased exponent equal to 0xFFFE or 0xFFFF (i.e.
+//         we test is 0.5 <= x < 2). This comparison can be performed using
+//         unsigned version of cmp instruction in such a way
+//         biased_exponent_of_x - 0xFFFE < 2
+//
+//
+//      b) Second (in case when result of a) is true) we need to compare x
+//         with 1-1/256 and 1+1/256 or in double precision memory representation
+//         with 0x3FEFE00000000000 and 0x3FF0100000000000 correspondingly.
+//         This comparison can be made like in a), using unsigned
+//         version of cmp i.e. ix - 0x3FEFE00000000000 < 0x0000300000000000.
+//         0x0000300000000000 is difference between 0x3FF0100000000000 and
+//         0x3FEFE00000000000
+//
+//    Note: NaT, any NaNs, +/-INF, +/-0, negatives and unnormalized numbers are
+//          filtered and processed on special branches.
 //
-// result = wseries
 
-// Special values 
+//
+// Special values
 //==============================================================
-
-
+//
 // log(+0)    = -inf
 // log(-0)    = -inf
-
-// log(+qnan) = +qnan 
-// log(-qnan) = -qnan 
-// log(+snan) = +qnan 
-// log(-snan) = -qnan 
-
+//
+// log(+qnan) = +qnan
+// log(-qnan) = -qnan
+// log(+snan) = +qnan
+// log(-snan) = -qnan
+//
 // log(-n)    = QNAN Indefinite
-// log(-inf)  = QNAN Indefinite 
-
+// log(-inf)  = QNAN Indefinite
+//
 // log(+inf)  = +inf
-
+//
+//
 // Registers used
 //==============================================================
-// Floating Point registers used: 
+// Floating Point registers used:
 // f8, input
-// f9 -> f15,  f32 -> f68
-
-// General registers used:  
-// r32 -> r51
-
+// f7 -> f15,  f32 -> f42
+//
+// General registers used:
+// r8  -> r11
+// r14 -> r23
+//
 // Predicate registers used:
 // p6 -> p15
 
-// p8 log base e
-// p6 log base e special
-// p9 used in the frcpa
-// p13 log base e large W
-// p14 log base e small w
-
-// p7 log base 10
-// p10 log base 10 large W
-// p11 log base 10 small w
-// p12 log base 10 special
-
-#include "libm_support.h"
-
 // Assembly macros
 //==============================================================
-
-log_int_Nfloat   = f9 
-log_Nfloat       = f10 
-
-log_P5           = f11 
-log_P4           = f12 
-log_P3           = f13 
-log_P2           = f14 
-log_half         = f15
-
-log_log2         = f32 
-log_T            = f33 
-
-log_rp_p4        = f34 
-log_rp_p32       = f35 
-log_rp_p2        = f36 
-log_w6           = f37
-log_rp_p10       = f38
-log_rcube        = f39
-log_rsq          = f40 
-
-log_T_plus_Nlog2 = f41 
-log_w3           = f42
-
-log_r            = f43
-log_C            = f44
-
-log_w            = f45
-log_Q8           = f46
-log_Q7           = f47
-log_Q4           = f48 
-log_Q3           = f49
-log_Q6           = f50 
-log_Q5           = f51
-log_Q2           = f52
-log_Q1           = f53 
-log_P1           = f53 
-
-log_rp_q7        = f54 
-log_rp_q65       = f55
-log_Qlo          = f56
-
-log_rp_q3        = f57
-log_rp_q21       = f58
-log_Qhi          = f59
-
-log_wsq          = f60
-log_w4           = f61
-log_Q            = f62
-
-log_inv_ln10     = f63
-log_log10_hi     = f64
-log_log10_lo     = f65
-log_rp_q10       = f66
-log_NORM_f8      = f67
-log_r2P_r        = f68 
-
-// ===================================
-
-log_GR_exp_17_ones               = r33
-log_GR_exp_16_ones               = r34
-log_GR_exp_f8                    = r35
-log_GR_signexp_f8                = r36
-log_GR_true_exp_f8               = r37
-log_GR_significand_f8            = r38
-log_GR_half_exp                  = r39
-log_GR_index                     = r39
-log_AD_1                         = r40
-log_GR_signexp_w                 = r41
-log_GR_fff9                      = r42
-log_AD_2                         = r43
-log_GR_exp_w                     = r44
-
-GR_SAVE_B0                       = r45
-GR_SAVE_GP                       = r46
-GR_SAVE_PFS                      = r47
-
-GR_Parameter_X                   = r48
-GR_Parameter_Y                   = r49
-GR_Parameter_RESULT              = r50
-log_GR_tag                       = r51
-
-
-// Data tables
+GR_TAG                 = r8
+GR_ad_1                = r8
+GR_ad_2                = r9
+GR_Exp                 = r10
+GR_N                   = r11
+
+GR_x                   = r14
+GR_dx                  = r15
+GR_NearOne             = r15
+GR_xorg                = r16
+GR_mask                = r16
+GR_05                  = r17
+GR_A3                  = r18
+GR_Sig                 = r19
+GR_Ind                 = r19
+GR_Nm1                 = r20
+GR_bias                = r21
+GR_ad_3                = r22
+GR_rexp                = r23
+
+
+GR_SAVE_B0             = r33
+GR_SAVE_PFS            = r34
+GR_SAVE_GP             = r35
+GR_SAVE_SP             = r36
+
+GR_Parameter_X         = r37
+GR_Parameter_Y         = r38
+GR_Parameter_RESULT    = r39
+GR_Parameter_TAG       = r40
+
+
+
+FR_NormX               = f7
+FR_RcpX                = f9
+FR_tmp                 = f9
+FR_r                   = f10
+FR_r2                  = f11
+FR_r4                  = f12
+FR_N                   = f13
+FR_Ln2hi               = f14
+FR_Ln2lo               = f15
+
+FR_A7                  = f32
+FR_A6                  = f33
+FR_A5                  = f34
+FR_A4                  = f35
+FR_A3                  = f36
+FR_A2                  = f37
+
+FR_Thi                 = f38
+FR_NxLn2hipThi         = f38
+FR_NxLn2pT             = f38
+FR_Tlo                 = f39
+FR_NxLn2lopTlo         = f39
+
+FR_InvLn10             = f40
+FR_A32                 = f41
+FR_A321                = f42
+
+
+FR_Y                   = f1
+FR_X                   = f10
+FR_RESULT              = f8
+
+
+// Data
 //==============================================================
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+RODATA
 .align 16
 
-log_table_1:
-ASM_TYPE_DIRECTIVE(log_table_1,@object)
-data8 0xBFC5555DA7212371 // P5
-data8 0x3FC999A19EEF5826 // P4
-data8 0x3FBC756AC654273B // Q8
-data8 0xBFC001A42489AB4D // Q7
-data8 0x3FC99999999A169B // Q4
-data8 0xBFD00000000019AC // Q3
-ASM_SIZE_DIRECTIVE(log_table_1)
-log_table_2:
-ASM_TYPE_DIRECTIVE(log_table_2,@object)
-data8 0xBFCFFFFFFFFEF009 // P3
-data8 0x3FD555555554ECB2 // P2
-data8 0x3FC2492479AA0DF8 // Q6
-data8 0xBFC5555544986F52 // Q5
-data8 0x3FD5555555555555 // Q2
-data8 0xBFE0000000000000 // Q1, P1 = -0.5
-
-
-data8 0xde5bd8a937287195, 0x00003ffd  // double-extended 1/ln(10)
-data8 0xb17217f7d1cf79ac, 0x00003ffe  // log2
-//      b17217f7d1cf79ab c9e3b39803f2f6a
-
-
-data8 0x80200aaeac44ef38 , 0x00003ff6 //   log(1/frcpa(1+  0/2^-8))
-
-data8 0xc09090a2c35aa070 , 0x00003ff7 //   log(1/frcpa(1+  1/2^-8))
-data8 0xa0c94fcb41977c75 , 0x00003ff8 //   log(1/frcpa(1+  2/2^-8))
-data8 0xe18b9c263af83301 , 0x00003ff8 //   log(1/frcpa(1+  3/2^-8))
-data8 0x8d35c8d6399c30ea , 0x00003ff9 //   log(1/frcpa(1+  4/2^-8))
-data8 0xadd4d2ecd601cbb8 , 0x00003ff9 //   log(1/frcpa(1+  5/2^-8))
-
-data8 0xce95403a192f9f01 , 0x00003ff9 //   log(1/frcpa(1+  6/2^-8))
-data8 0xeb59392cbcc01096 , 0x00003ff9 //   log(1/frcpa(1+  7/2^-8))
-data8 0x862c7d0cefd54c5d , 0x00003ffa //   log(1/frcpa(1+  8/2^-8))
-data8 0x94aa63c65e70d499 , 0x00003ffa //   log(1/frcpa(1+  9/2^-8))
-data8 0xa54a696d4b62b382 , 0x00003ffa //   log(1/frcpa(1+ 10/2^-8))
-
-data8 0xb3e4a796a5dac208 , 0x00003ffa //   log(1/frcpa(1+ 11/2^-8))
-data8 0xc28c45b1878340a9 , 0x00003ffa //   log(1/frcpa(1+ 12/2^-8))
-data8 0xd35c55f39d7a6235 , 0x00003ffa //   log(1/frcpa(1+ 13/2^-8))
-data8 0xe220f037b954f1f5 , 0x00003ffa //   log(1/frcpa(1+ 14/2^-8))
-data8 0xf0f3389b036834f3 , 0x00003ffa //   log(1/frcpa(1+ 15/2^-8))
-
-data8 0xffd3488d5c980465 , 0x00003ffa //   log(1/frcpa(1+ 16/2^-8))
-data8 0x87609ce2ed300490 , 0x00003ffb //   log(1/frcpa(1+ 17/2^-8))
-data8 0x8ede9321e8c85927 , 0x00003ffb //   log(1/frcpa(1+ 18/2^-8))
-data8 0x96639427f2f8e2f4 , 0x00003ffb //   log(1/frcpa(1+ 19/2^-8))
-data8 0x9defad3e8f73217b , 0x00003ffb //   log(1/frcpa(1+ 20/2^-8))
-
-data8 0xa582ebd50097029c , 0x00003ffb //   log(1/frcpa(1+ 21/2^-8))
-data8 0xac06dbe75ab80fee , 0x00003ffb //   log(1/frcpa(1+ 22/2^-8))
-data8 0xb3a78449b2d3ccca , 0x00003ffb //   log(1/frcpa(1+ 23/2^-8))
-data8 0xbb4f79635ab46bb2 , 0x00003ffb //   log(1/frcpa(1+ 24/2^-8))
-data8 0xc2fec93a83523f3f , 0x00003ffb //   log(1/frcpa(1+ 25/2^-8))
-
-data8 0xc99af2eaca4c4571 , 0x00003ffb //   log(1/frcpa(1+ 26/2^-8))
-data8 0xd1581106472fa653 , 0x00003ffb //   log(1/frcpa(1+ 27/2^-8))
-data8 0xd8002560d4355f2e , 0x00003ffb //   log(1/frcpa(1+ 28/2^-8))
-data8 0xdfcb43b4fe508632 , 0x00003ffb //   log(1/frcpa(1+ 29/2^-8))
-data8 0xe67f6dff709d4119 , 0x00003ffb //   log(1/frcpa(1+ 30/2^-8))
-
-data8 0xed393b1c22351280 , 0x00003ffb //   log(1/frcpa(1+ 31/2^-8))
-data8 0xf5192bff087bcc35 , 0x00003ffb //   log(1/frcpa(1+ 32/2^-8))
-data8 0xfbdf4ff6dfef2fa3 , 0x00003ffb //   log(1/frcpa(1+ 33/2^-8))
-data8 0x81559a97f92f9cc7 , 0x00003ffc //   log(1/frcpa(1+ 34/2^-8))
-data8 0x84be72bce90266e8 , 0x00003ffc //   log(1/frcpa(1+ 35/2^-8))
-
-data8 0x88bc74113f23def2 , 0x00003ffc //   log(1/frcpa(1+ 36/2^-8))
-data8 0x8c2ba3edf6799d11 , 0x00003ffc //   log(1/frcpa(1+ 37/2^-8))
-data8 0x8f9dc92f92ea08b1 , 0x00003ffc //   log(1/frcpa(1+ 38/2^-8))
-data8 0x9312e8f36efab5a7 , 0x00003ffc //   log(1/frcpa(1+ 39/2^-8))
-data8 0x968b08643409ceb6 , 0x00003ffc //   log(1/frcpa(1+ 40/2^-8))
-
-data8 0x9a062cba08a1708c , 0x00003ffc //   log(1/frcpa(1+ 41/2^-8))
-data8 0x9d845b3abf95485c , 0x00003ffc //   log(1/frcpa(1+ 42/2^-8))
-data8 0xa06fd841bc001bb4 , 0x00003ffc //   log(1/frcpa(1+ 43/2^-8))
-data8 0xa3f3a74652fbe0db , 0x00003ffc //   log(1/frcpa(1+ 44/2^-8))
-data8 0xa77a8fb2336f20f5 , 0x00003ffc //   log(1/frcpa(1+ 45/2^-8))
-
-data8 0xab0497015d28b0a0 , 0x00003ffc //   log(1/frcpa(1+ 46/2^-8))
-data8 0xae91c2be6ba6a615 , 0x00003ffc //   log(1/frcpa(1+ 47/2^-8))
-data8 0xb189d1b99aebb20b , 0x00003ffc //   log(1/frcpa(1+ 48/2^-8))
-data8 0xb51cced5de9c1b2c , 0x00003ffc //   log(1/frcpa(1+ 49/2^-8))
-data8 0xb819bee9e720d42f , 0x00003ffc //   log(1/frcpa(1+ 50/2^-8))
-
-data8 0xbbb2a0947b093a5d , 0x00003ffc //   log(1/frcpa(1+ 51/2^-8))
-data8 0xbf4ec1505811684a , 0x00003ffc //   log(1/frcpa(1+ 52/2^-8))
-data8 0xc2535bacfa8975ff , 0x00003ffc //   log(1/frcpa(1+ 53/2^-8))
-data8 0xc55a3eafad187eb8 , 0x00003ffc //   log(1/frcpa(1+ 54/2^-8))
-data8 0xc8ff2484b2c0da74 , 0x00003ffc //   log(1/frcpa(1+ 55/2^-8))
-
-data8 0xcc0b1a008d53ab76 , 0x00003ffc //   log(1/frcpa(1+ 56/2^-8))
-data8 0xcfb6203844b3209b , 0x00003ffc //   log(1/frcpa(1+ 57/2^-8))
-data8 0xd2c73949a47a19f5 , 0x00003ffc //   log(1/frcpa(1+ 58/2^-8))
-data8 0xd5daae18b49d6695 , 0x00003ffc //   log(1/frcpa(1+ 59/2^-8))
-data8 0xd8f08248cf7e8019 , 0x00003ffc //   log(1/frcpa(1+ 60/2^-8))
-
-data8 0xdca7749f1b3e540e , 0x00003ffc //   log(1/frcpa(1+ 61/2^-8))
-data8 0xdfc28e033aaaf7c7 , 0x00003ffc //   log(1/frcpa(1+ 62/2^-8))
-data8 0xe2e012a5f91d2f55 , 0x00003ffc //   log(1/frcpa(1+ 63/2^-8))
-data8 0xe600064ed9e292a8 , 0x00003ffc //   log(1/frcpa(1+ 64/2^-8))
-data8 0xe9226cce42b39f60 , 0x00003ffc //   log(1/frcpa(1+ 65/2^-8))
-
-data8 0xec4749fd97a28360 , 0x00003ffc //   log(1/frcpa(1+ 66/2^-8))
-data8 0xef6ea1bf57780495 , 0x00003ffc //   log(1/frcpa(1+ 67/2^-8))
-data8 0xf29877ff38809091 , 0x00003ffc //   log(1/frcpa(1+ 68/2^-8))
-data8 0xf5c4d0b245cb89be , 0x00003ffc //   log(1/frcpa(1+ 69/2^-8))
-data8 0xf8f3afd6fcdef3aa , 0x00003ffc //   log(1/frcpa(1+ 70/2^-8))
-
-data8 0xfc2519756be1abc7 , 0x00003ffc //   log(1/frcpa(1+ 71/2^-8))
-data8 0xff59119f503e6832 , 0x00003ffc //   log(1/frcpa(1+ 72/2^-8))
-data8 0x8147ce381ae0e146 , 0x00003ffd //   log(1/frcpa(1+ 73/2^-8))
-data8 0x82e45f06cb1ad0f2 , 0x00003ffd //   log(1/frcpa(1+ 74/2^-8))
-data8 0x842f5c7c573cbaa2 , 0x00003ffd //   log(1/frcpa(1+ 75/2^-8))
-
-data8 0x85ce471968c8893a , 0x00003ffd //   log(1/frcpa(1+ 76/2^-8))
-data8 0x876e8305bc04066d , 0x00003ffd //   log(1/frcpa(1+ 77/2^-8))
-data8 0x891012678031fbb3 , 0x00003ffd //   log(1/frcpa(1+ 78/2^-8))
-data8 0x8a5f1493d766a05f , 0x00003ffd //   log(1/frcpa(1+ 79/2^-8))
-data8 0x8c030c778c56fa00 , 0x00003ffd //   log(1/frcpa(1+ 80/2^-8))
-
-data8 0x8da85df17e31d9ae , 0x00003ffd //   log(1/frcpa(1+ 81/2^-8))
-data8 0x8efa663e7921687e , 0x00003ffd //   log(1/frcpa(1+ 82/2^-8))
-data8 0x90a22b6875c6a1f8 , 0x00003ffd //   log(1/frcpa(1+ 83/2^-8))
-data8 0x91f62cc8f5d24837 , 0x00003ffd //   log(1/frcpa(1+ 84/2^-8))
-data8 0x93a06cfc3857d980 , 0x00003ffd //   log(1/frcpa(1+ 85/2^-8))
-
-data8 0x94f66d5e6fd01ced , 0x00003ffd //   log(1/frcpa(1+ 86/2^-8))
-data8 0x96a330156e6772f2 , 0x00003ffd //   log(1/frcpa(1+ 87/2^-8))
-data8 0x97fb3582754ea25b , 0x00003ffd //   log(1/frcpa(1+ 88/2^-8))
-data8 0x99aa8259aad1bbf2 , 0x00003ffd //   log(1/frcpa(1+ 89/2^-8))
-data8 0x9b0492f6227ae4a8 , 0x00003ffd //   log(1/frcpa(1+ 90/2^-8))
-
-data8 0x9c5f8e199bf3a7a5 , 0x00003ffd //   log(1/frcpa(1+ 91/2^-8))
-data8 0x9e1293b9998c1daa , 0x00003ffd //   log(1/frcpa(1+ 92/2^-8))
-data8 0x9f6fa31e0b41f308 , 0x00003ffd //   log(1/frcpa(1+ 93/2^-8))
-data8 0xa0cda11eaf46390e , 0x00003ffd //   log(1/frcpa(1+ 94/2^-8))
-data8 0xa22c8f029cfa45aa , 0x00003ffd //   log(1/frcpa(1+ 95/2^-8))
-
-data8 0xa3e48badb7856b34 , 0x00003ffd //   log(1/frcpa(1+ 96/2^-8))
-data8 0xa5459a0aa95849f9 , 0x00003ffd //   log(1/frcpa(1+ 97/2^-8))
-data8 0xa6a79c84480cfebd , 0x00003ffd //   log(1/frcpa(1+ 98/2^-8))
-data8 0xa80a946d0fcb3eb2 , 0x00003ffd //   log(1/frcpa(1+ 99/2^-8))
-data8 0xa96e831a3ea7b314 , 0x00003ffd //   log(1/frcpa(1+100/2^-8))
-
-data8 0xaad369e3dc544e3b , 0x00003ffd //   log(1/frcpa(1+101/2^-8))
-data8 0xac92e9588952c815 , 0x00003ffd //   log(1/frcpa(1+102/2^-8))
-data8 0xadfa035aa1ed8fdc , 0x00003ffd //   log(1/frcpa(1+103/2^-8))
-data8 0xaf6219eae1ad6e34 , 0x00003ffd //   log(1/frcpa(1+104/2^-8))
-data8 0xb0cb2e6d8160f753 , 0x00003ffd //   log(1/frcpa(1+105/2^-8))
-
-data8 0xb2354249ad950f72 , 0x00003ffd //   log(1/frcpa(1+106/2^-8))
-data8 0xb3a056e98ef4a3b4 , 0x00003ffd //   log(1/frcpa(1+107/2^-8))
-data8 0xb50c6dba52c6292a , 0x00003ffd //   log(1/frcpa(1+108/2^-8))
-data8 0xb679882c33876165 , 0x00003ffd //   log(1/frcpa(1+109/2^-8))
-data8 0xb78c07429785cedc , 0x00003ffd //   log(1/frcpa(1+110/2^-8))
-
-data8 0xb8faeb8dc4a77d24 , 0x00003ffd //   log(1/frcpa(1+111/2^-8))
-data8 0xba6ad77eb36ae0d6 , 0x00003ffd //   log(1/frcpa(1+112/2^-8))
-data8 0xbbdbcc915e9bee50 , 0x00003ffd //   log(1/frcpa(1+113/2^-8))
-data8 0xbd4dcc44f8cf12ef , 0x00003ffd //   log(1/frcpa(1+114/2^-8))
-data8 0xbec0d81bf5b531fa , 0x00003ffd //   log(1/frcpa(1+115/2^-8))
-
-data8 0xc034f19c139186f4 , 0x00003ffd //   log(1/frcpa(1+116/2^-8))
-data8 0xc14cb69f7c5e55ab , 0x00003ffd //   log(1/frcpa(1+117/2^-8))
-data8 0xc2c2abbb6e5fd56f , 0x00003ffd //   log(1/frcpa(1+118/2^-8))
-data8 0xc439b2c193e6771e , 0x00003ffd //   log(1/frcpa(1+119/2^-8))
-data8 0xc553acb9d5c67733 , 0x00003ffd //   log(1/frcpa(1+120/2^-8))
-
-data8 0xc6cc96e441272441 , 0x00003ffd //   log(1/frcpa(1+121/2^-8))
-data8 0xc8469753eca88c30 , 0x00003ffd //   log(1/frcpa(1+122/2^-8))
-data8 0xc962cf3ce072b05c , 0x00003ffd //   log(1/frcpa(1+123/2^-8))
-data8 0xcadeba8771f694aa , 0x00003ffd //   log(1/frcpa(1+124/2^-8))
-data8 0xcc5bc08d1f72da94 , 0x00003ffd //   log(1/frcpa(1+125/2^-8))
-
-data8 0xcd7a3f99ea035c29 , 0x00003ffd //   log(1/frcpa(1+126/2^-8))
-data8 0xcef93860c8a53c35 , 0x00003ffd //   log(1/frcpa(1+127/2^-8))
-data8 0xd0192f68a7ed23df , 0x00003ffd //   log(1/frcpa(1+128/2^-8))
-data8 0xd19a201127d3c645 , 0x00003ffd //   log(1/frcpa(1+129/2^-8))
-data8 0xd2bb92f4061c172c , 0x00003ffd //   log(1/frcpa(1+130/2^-8))
-
-data8 0xd43e80b2ee8cc8fc , 0x00003ffd //   log(1/frcpa(1+131/2^-8))
-data8 0xd56173601fc4ade4 , 0x00003ffd //   log(1/frcpa(1+132/2^-8))
-data8 0xd6e6637efb54086f , 0x00003ffd //   log(1/frcpa(1+133/2^-8))
-data8 0xd80ad9f58f3c8193 , 0x00003ffd //   log(1/frcpa(1+134/2^-8))
-data8 0xd991d1d31aca41f8 , 0x00003ffd //   log(1/frcpa(1+135/2^-8))
-
-data8 0xdab7d02231484a93 , 0x00003ffd //   log(1/frcpa(1+136/2^-8))
-data8 0xdc40d532cde49a54 , 0x00003ffd //   log(1/frcpa(1+137/2^-8))
-data8 0xdd685f79ed8b265e , 0x00003ffd //   log(1/frcpa(1+138/2^-8))
-data8 0xde9094bbc0e17b1d , 0x00003ffd //   log(1/frcpa(1+139/2^-8))
-data8 0xe01c91b78440c425 , 0x00003ffd //   log(1/frcpa(1+140/2^-8))
-
-data8 0xe14658f26997e729 , 0x00003ffd //   log(1/frcpa(1+141/2^-8))
-data8 0xe270cdc2391e0d23 , 0x00003ffd //   log(1/frcpa(1+142/2^-8))
-data8 0xe3ffce3a2aa64922 , 0x00003ffd //   log(1/frcpa(1+143/2^-8))
-data8 0xe52bdb274ed82887 , 0x00003ffd //   log(1/frcpa(1+144/2^-8))
-data8 0xe6589852e75d7df6 , 0x00003ffd //   log(1/frcpa(1+145/2^-8))
-
-data8 0xe786068c79937a7d , 0x00003ffd //   log(1/frcpa(1+146/2^-8))
-data8 0xe91903adad100911 , 0x00003ffd //   log(1/frcpa(1+147/2^-8))
-data8 0xea481236f7d35bb0 , 0x00003ffd //   log(1/frcpa(1+148/2^-8))
-data8 0xeb77d48c692e6b14 , 0x00003ffd //   log(1/frcpa(1+149/2^-8))
-data8 0xeca84b83d7297b87 , 0x00003ffd //   log(1/frcpa(1+150/2^-8))
-
-data8 0xedd977f4962aa158 , 0x00003ffd //   log(1/frcpa(1+151/2^-8))
-data8 0xef7179a22f257754 , 0x00003ffd //   log(1/frcpa(1+152/2^-8))
-data8 0xf0a450d139366ca7 , 0x00003ffd //   log(1/frcpa(1+153/2^-8))
-data8 0xf1d7e0524ff9ffdb , 0x00003ffd //   log(1/frcpa(1+154/2^-8))
-data8 0xf30c29036a8b6cae , 0x00003ffd //   log(1/frcpa(1+155/2^-8))
-
-data8 0xf4412bc411ea8d92 , 0x00003ffd //   log(1/frcpa(1+156/2^-8))
-data8 0xf576e97564c8619d , 0x00003ffd //   log(1/frcpa(1+157/2^-8))
-data8 0xf6ad62fa1b5f172f , 0x00003ffd //   log(1/frcpa(1+158/2^-8))
-data8 0xf7e499368b55c542 , 0x00003ffd //   log(1/frcpa(1+159/2^-8))
-data8 0xf91c8d10abaffe22 , 0x00003ffd //   log(1/frcpa(1+160/2^-8))
-
-data8 0xfa553f7018c966f3 , 0x00003ffd //   log(1/frcpa(1+161/2^-8))
-data8 0xfb8eb13e185d802c , 0x00003ffd //   log(1/frcpa(1+162/2^-8))
-data8 0xfcc8e3659d9bcbed , 0x00003ffd //   log(1/frcpa(1+163/2^-8))
-data8 0xfe03d6d34d487fd2 , 0x00003ffd //   log(1/frcpa(1+164/2^-8))
-data8 0xff3f8c7581e9f0ae , 0x00003ffd //   log(1/frcpa(1+165/2^-8))
-
-data8 0x803e029e280173ae , 0x00003ffe //   log(1/frcpa(1+166/2^-8))
-data8 0x80dca10cc52d0757 , 0x00003ffe //   log(1/frcpa(1+167/2^-8))
-data8 0x817ba200632755a1 , 0x00003ffe //   log(1/frcpa(1+168/2^-8))
-data8 0x821b05f3b01d6774 , 0x00003ffe //   log(1/frcpa(1+169/2^-8))
-data8 0x82bacd623ff19d06 , 0x00003ffe //   log(1/frcpa(1+170/2^-8))
-
-data8 0x835af8c88e7a8f47 , 0x00003ffe //   log(1/frcpa(1+171/2^-8))
-data8 0x83c5f8299e2b4091 , 0x00003ffe //   log(1/frcpa(1+172/2^-8))
-data8 0x8466cb43f3d87300 , 0x00003ffe //   log(1/frcpa(1+173/2^-8))
-data8 0x850803a67c80ca4b , 0x00003ffe //   log(1/frcpa(1+174/2^-8))
-data8 0x85a9a1d11a23b461 , 0x00003ffe //   log(1/frcpa(1+175/2^-8))
-
-data8 0x864ba644a18e6e05 , 0x00003ffe //   log(1/frcpa(1+176/2^-8))
-data8 0x86ee1182dcc432f7 , 0x00003ffe //   log(1/frcpa(1+177/2^-8))
-data8 0x875a925d7e48c316 , 0x00003ffe //   log(1/frcpa(1+178/2^-8))
-data8 0x87fdaa109d23aef7 , 0x00003ffe //   log(1/frcpa(1+179/2^-8))
-data8 0x88a129ed4becfaf2 , 0x00003ffe //   log(1/frcpa(1+180/2^-8))
-
-data8 0x89451278ecd7f9cf , 0x00003ffe //   log(1/frcpa(1+181/2^-8))
-data8 0x89b29295f8432617 , 0x00003ffe //   log(1/frcpa(1+182/2^-8))
-data8 0x8a572ac5a5496882 , 0x00003ffe //   log(1/frcpa(1+183/2^-8))
-data8 0x8afc2d0ce3b2dadf , 0x00003ffe //   log(1/frcpa(1+184/2^-8))
-data8 0x8b6a69c608cfd3af , 0x00003ffe //   log(1/frcpa(1+185/2^-8))
-
-data8 0x8c101e106e899a83 , 0x00003ffe //   log(1/frcpa(1+186/2^-8))
-data8 0x8cb63de258f9d626 , 0x00003ffe //   log(1/frcpa(1+187/2^-8))
-data8 0x8d2539c5bd19e2b1 , 0x00003ffe //   log(1/frcpa(1+188/2^-8))
-data8 0x8dcc0e064b29e6f1 , 0x00003ffe //   log(1/frcpa(1+189/2^-8))
-data8 0x8e734f45d88357ae , 0x00003ffe //   log(1/frcpa(1+190/2^-8))
-
-data8 0x8ee30cef034a20db , 0x00003ffe //   log(1/frcpa(1+191/2^-8))
-data8 0x8f8b0515686d1d06 , 0x00003ffe //   log(1/frcpa(1+192/2^-8))
-data8 0x90336bba039bf32f , 0x00003ffe //   log(1/frcpa(1+193/2^-8))
-data8 0x90a3edd23d1c9d58 , 0x00003ffe //   log(1/frcpa(1+194/2^-8))
-data8 0x914d0de2f5d61b32 , 0x00003ffe //   log(1/frcpa(1+195/2^-8))
-
-data8 0x91be0c20d28173b5 , 0x00003ffe //   log(1/frcpa(1+196/2^-8))
-data8 0x9267e737c06cd34a , 0x00003ffe //   log(1/frcpa(1+197/2^-8))
-data8 0x92d962ae6abb1237 , 0x00003ffe //   log(1/frcpa(1+198/2^-8))
-data8 0x9383fa6afbe2074c , 0x00003ffe //   log(1/frcpa(1+199/2^-8))
-data8 0x942f0421651c1c4e , 0x00003ffe //   log(1/frcpa(1+200/2^-8))
-
-data8 0x94a14a3845bb985e , 0x00003ffe //   log(1/frcpa(1+201/2^-8))
-data8 0x954d133857f861e7 , 0x00003ffe //   log(1/frcpa(1+202/2^-8))
-data8 0x95bfd96468e604c4 , 0x00003ffe //   log(1/frcpa(1+203/2^-8))
-data8 0x9632d31cafafa858 , 0x00003ffe //   log(1/frcpa(1+204/2^-8))
-data8 0x96dfaabd86fa1647 , 0x00003ffe //   log(1/frcpa(1+205/2^-8))
-
-data8 0x9753261fcbb2a594 , 0x00003ffe //   log(1/frcpa(1+206/2^-8))
-data8 0x9800c11b426b996d , 0x00003ffe //   log(1/frcpa(1+207/2^-8))
-data8 0x9874bf4d45ae663c , 0x00003ffe //   log(1/frcpa(1+208/2^-8))
-data8 0x99231f5ee9a74f79 , 0x00003ffe //   log(1/frcpa(1+209/2^-8))
-data8 0x9997a18a56bcad28 , 0x00003ffe //   log(1/frcpa(1+210/2^-8))
-
-data8 0x9a46c873a3267e79 , 0x00003ffe //   log(1/frcpa(1+211/2^-8))
-data8 0x9abbcfc621eb6cb6 , 0x00003ffe //   log(1/frcpa(1+212/2^-8))
-data8 0x9b310cb0d354c990 , 0x00003ffe //   log(1/frcpa(1+213/2^-8))
-data8 0x9be14cf9e1b3515c , 0x00003ffe //   log(1/frcpa(1+214/2^-8))
-data8 0x9c5710b8cbb73a43 , 0x00003ffe //   log(1/frcpa(1+215/2^-8))
-
-data8 0x9ccd0abd301f399c , 0x00003ffe //   log(1/frcpa(1+216/2^-8))
-data8 0x9d7e67f3bdce8888 , 0x00003ffe //   log(1/frcpa(1+217/2^-8))
-data8 0x9df4ea81a99daa01 , 0x00003ffe //   log(1/frcpa(1+218/2^-8))
-data8 0x9e6ba405a54514ba , 0x00003ffe //   log(1/frcpa(1+219/2^-8))
-data8 0x9f1e21c8c7bb62b3 , 0x00003ffe //   log(1/frcpa(1+220/2^-8))
-
-data8 0x9f956593f6b6355c , 0x00003ffe //   log(1/frcpa(1+221/2^-8))
-data8 0xa00ce1092e5498c3 , 0x00003ffe //   log(1/frcpa(1+222/2^-8))
-data8 0xa0c08309c4b912c1 , 0x00003ffe //   log(1/frcpa(1+223/2^-8))
-data8 0xa1388a8c6faa2afa , 0x00003ffe //   log(1/frcpa(1+224/2^-8))
-data8 0xa1b0ca7095b5f985 , 0x00003ffe //   log(1/frcpa(1+225/2^-8))
-
-data8 0xa22942eb47534a00 , 0x00003ffe //   log(1/frcpa(1+226/2^-8))
-data8 0xa2de62326449d0a3 , 0x00003ffe //   log(1/frcpa(1+227/2^-8))
-data8 0xa357690f88bfe345 , 0x00003ffe //   log(1/frcpa(1+228/2^-8))
-data8 0xa3d0a93f45169a4b , 0x00003ffe //   log(1/frcpa(1+229/2^-8))
-data8 0xa44a22f7ffe65f30 , 0x00003ffe //   log(1/frcpa(1+230/2^-8))
-
-data8 0xa500c5e5b4c1aa36 , 0x00003ffe //   log(1/frcpa(1+231/2^-8))
-data8 0xa57ad064eb2ebbc2 , 0x00003ffe //   log(1/frcpa(1+232/2^-8))
-data8 0xa5f5152dedf4384e , 0x00003ffe //   log(1/frcpa(1+233/2^-8))
-data8 0xa66f9478856233ec , 0x00003ffe //   log(1/frcpa(1+234/2^-8))
-data8 0xa6ea4e7cca02c32e , 0x00003ffe //   log(1/frcpa(1+235/2^-8))
-
-data8 0xa765437325341ccf , 0x00003ffe //   log(1/frcpa(1+236/2^-8))
-data8 0xa81e21e6c75b4020 , 0x00003ffe //   log(1/frcpa(1+237/2^-8))
-data8 0xa899ab333fe2b9ca , 0x00003ffe //   log(1/frcpa(1+238/2^-8))
-data8 0xa9157039c51ebe71 , 0x00003ffe //   log(1/frcpa(1+239/2^-8))
-data8 0xa991713433c2b999 , 0x00003ffe //   log(1/frcpa(1+240/2^-8))
-
-data8 0xaa0dae5cbcc048b3 , 0x00003ffe //   log(1/frcpa(1+241/2^-8))
-data8 0xaa8a27ede5eb13ad , 0x00003ffe //   log(1/frcpa(1+242/2^-8))
-data8 0xab06de228a9e3499 , 0x00003ffe //   log(1/frcpa(1+243/2^-8))
-data8 0xab83d135dc633301 , 0x00003ffe //   log(1/frcpa(1+244/2^-8))
-data8 0xac3fb076adc7fe7a , 0x00003ffe //   log(1/frcpa(1+245/2^-8))
-
-data8 0xacbd3cbbe47988f1 , 0x00003ffe //   log(1/frcpa(1+246/2^-8))
-data8 0xad3b06b1a5dc57c3 , 0x00003ffe //   log(1/frcpa(1+247/2^-8))
-data8 0xadb90e94af887717 , 0x00003ffe //   log(1/frcpa(1+248/2^-8))
-data8 0xae3754a218f7c816 , 0x00003ffe //   log(1/frcpa(1+249/2^-8))
-data8 0xaeb5d9175437afa2 , 0x00003ffe //   log(1/frcpa(1+250/2^-8))
-
-data8 0xaf349c322e9c7cee , 0x00003ffe //   log(1/frcpa(1+251/2^-8))
-data8 0xafb39e30d1768d1c , 0x00003ffe //   log(1/frcpa(1+252/2^-8))
-data8 0xb032df51c2c93116 , 0x00003ffe //   log(1/frcpa(1+253/2^-8))
-data8 0xb0b25fd3e6035ad9 , 0x00003ffe //   log(1/frcpa(1+254/2^-8))
-data8 0xb1321ff67cba178c , 0x00003ffe //   log(1/frcpa(1+255/2^-8))
-ASM_SIZE_DIRECTIVE(log_table_2)
-
-   
-.align 32
-.global log#
-.global log10#
+LOCAL_OBJECT_START(log_data)
+// coefficients of polynomial approximation
+data8 0x3FC2494104381A8E // A7
+data8 0xBFC5556D556BBB69 // A6
+//
+// two parts of ln(2)
+data8 0x3FE62E42FEF00000,0x3DD473DE6AF278ED
+//
+data8 0x8000000000000000,0x3FFF // 1.0
+//
+data8 0x3FC999999988B5E9 // A5
+data8 0xBFCFFFFFFFF6FFF5 // A4
+//
+// hi parts of ln(1/frcpa(1+i/256)), i=0...255
+data8 0x3F60040155D5889D // 0
+data8 0x3F78121214586B54 // 1
+data8 0x3F841929F96832EF // 2
+data8 0x3F8C317384C75F06 // 3
+data8 0x3F91A6B91AC73386 // 4
+data8 0x3F95BA9A5D9AC039 // 5
+data8 0x3F99D2A8074325F3 // 6
+data8 0x3F9D6B2725979802 // 7
+data8 0x3FA0C58FA19DFAA9 // 8
+data8 0x3FA2954C78CBCE1A // 9
+data8 0x3FA4A94D2DA96C56 // 10
+data8 0x3FA67C94F2D4BB58 // 11
+data8 0x3FA85188B630F068 // 12
+data8 0x3FAA6B8ABE73AF4C // 13
+data8 0x3FAC441E06F72A9E // 14
+data8 0x3FAE1E6713606D06 // 15
+data8 0x3FAFFA6911AB9300 // 16
+data8 0x3FB0EC139C5DA600 // 17
+data8 0x3FB1DBD2643D190B // 18
+data8 0x3FB2CC7284FE5F1C // 19
+data8 0x3FB3BDF5A7D1EE64 // 20
+data8 0x3FB4B05D7AA012E0 // 21
+data8 0x3FB580DB7CEB5701 // 22
+data8 0x3FB674F089365A79 // 23
+data8 0x3FB769EF2C6B568D // 24
+data8 0x3FB85FD927506A47 // 25
+data8 0x3FB9335E5D594988 // 26
+data8 0x3FBA2B0220C8E5F4 // 27
+data8 0x3FBB0004AC1A86AB // 28
+data8 0x3FBBF968769FCA10 // 29
+data8 0x3FBCCFEDBFEE13A8 // 30
+data8 0x3FBDA727638446A2 // 31
+data8 0x3FBEA3257FE10F79 // 32
+data8 0x3FBF7BE9FEDBFDE5 // 33
+data8 0x3FC02AB352FF25F3 // 34
+data8 0x3FC097CE579D204C // 35
+data8 0x3FC1178E8227E47B // 36
+data8 0x3FC185747DBECF33 // 37
+data8 0x3FC1F3B925F25D41 // 38
+data8 0x3FC2625D1E6DDF56 // 39
+data8 0x3FC2D1610C868139 // 40
+data8 0x3FC340C59741142E // 41
+data8 0x3FC3B08B6757F2A9 // 42
+data8 0x3FC40DFB08378003 // 43
+data8 0x3FC47E74E8CA5F7C // 44
+data8 0x3FC4EF51F6466DE4 // 45
+data8 0x3FC56092E02BA516 // 46
+data8 0x3FC5D23857CD74D4 // 47
+data8 0x3FC6313A37335D76 // 48
+data8 0x3FC6A399DABBD383 // 49
+data8 0x3FC70337DD3CE41A // 50
+data8 0x3FC77654128F6127 // 51
+data8 0x3FC7E9D82A0B022D // 52
+data8 0x3FC84A6B759F512E // 53
+data8 0x3FC8AB47D5F5A30F // 54
+data8 0x3FC91FE49096581B // 55
+data8 0x3FC981634011AA75 // 56
+data8 0x3FC9F6C407089664 // 57
+data8 0x3FCA58E729348F43 // 58
+data8 0x3FCABB55C31693AC // 59
+data8 0x3FCB1E104919EFD0 // 60
+data8 0x3FCB94EE93E367CA // 61
+data8 0x3FCBF851C067555E // 62
+data8 0x3FCC5C0254BF23A5 // 63
+data8 0x3FCCC000C9DB3C52 // 64
+data8 0x3FCD244D99C85673 // 65
+data8 0x3FCD88E93FB2F450 // 66
+data8 0x3FCDEDD437EAEF00 // 67
+data8 0x3FCE530EFFE71012 // 68
+data8 0x3FCEB89A1648B971 // 69
+data8 0x3FCF1E75FADF9BDE // 70
+data8 0x3FCF84A32EAD7C35 // 71
+data8 0x3FCFEB2233EA07CD // 72
+data8 0x3FD028F9C7035C1C // 73
+data8 0x3FD05C8BE0D9635A // 74
+data8 0x3FD085EB8F8AE797 // 75
+data8 0x3FD0B9C8E32D1911 // 76
+data8 0x3FD0EDD060B78080 // 77
+data8 0x3FD122024CF0063F // 78
+data8 0x3FD14BE2927AECD4 // 79
+data8 0x3FD180618EF18ADF // 80
+data8 0x3FD1B50BBE2FC63B // 81
+data8 0x3FD1DF4CC7CF242D // 82
+data8 0x3FD214456D0EB8D4 // 83
+data8 0x3FD23EC5991EBA49 // 84
+data8 0x3FD2740D9F870AFB // 85
+data8 0x3FD29ECDABCDFA03 // 86
+data8 0x3FD2D46602ADCCEE // 87
+data8 0x3FD2FF66B04EA9D4 // 88
+data8 0x3FD335504B355A37 // 89
+data8 0x3FD360925EC44F5C // 90
+data8 0x3FD38BF1C3337E74 // 91
+data8 0x3FD3C25277333183 // 92
+data8 0x3FD3EDF463C1683E // 93
+data8 0x3FD419B423D5E8C7 // 94
+data8 0x3FD44591E0539F48 // 95
+data8 0x3FD47C9175B6F0AD // 96
+data8 0x3FD4A8B341552B09 // 97
+data8 0x3FD4D4F39089019F // 98
+data8 0x3FD501528DA1F967 // 99
+data8 0x3FD52DD06347D4F6 // 100
+data8 0x3FD55A6D3C7B8A89 // 101
+data8 0x3FD5925D2B112A59 // 102
+data8 0x3FD5BF406B543DB1 // 103
+data8 0x3FD5EC433D5C35AD // 104
+data8 0x3FD61965CDB02C1E // 105
+data8 0x3FD646A84935B2A1 // 106
+data8 0x3FD6740ADD31DE94 // 107
+data8 0x3FD6A18DB74A58C5 // 108
+data8 0x3FD6CF31058670EC // 109
+data8 0x3FD6F180E852F0B9 // 110
+data8 0x3FD71F5D71B894EF // 111
+data8 0x3FD74D5AEFD66D5C // 112
+data8 0x3FD77B79922BD37D // 113
+data8 0x3FD7A9B9889F19E2 // 114
+data8 0x3FD7D81B037EB6A6 // 115
+data8 0x3FD8069E33827230 // 116
+data8 0x3FD82996D3EF8BCA // 117
+data8 0x3FD85855776DCBFA // 118
+data8 0x3FD8873658327CCE // 119
+data8 0x3FD8AA75973AB8CE // 120
+data8 0x3FD8D992DC8824E4 // 121
+data8 0x3FD908D2EA7D9511 // 122
+data8 0x3FD92C59E79C0E56 // 123
+data8 0x3FD95BD750EE3ED2 // 124
+data8 0x3FD98B7811A3EE5B // 125
+data8 0x3FD9AF47F33D406B // 126
+data8 0x3FD9DF270C1914A7 // 127
+data8 0x3FDA0325ED14FDA4 // 128
+data8 0x3FDA33440224FA78 // 129
+data8 0x3FDA57725E80C382 // 130
+data8 0x3FDA87D0165DD199 // 131
+data8 0x3FDAAC2E6C03F895 // 132
+data8 0x3FDADCCC6FDF6A81 // 133
+data8 0x3FDB015B3EB1E790 // 134
+data8 0x3FDB323A3A635948 // 135
+data8 0x3FDB56FA04462909 // 136
+data8 0x3FDB881AA659BC93 // 137
+data8 0x3FDBAD0BEF3DB164 // 138
+data8 0x3FDBD21297781C2F // 139
+data8 0x3FDC039236F08818 // 140
+data8 0x3FDC28CB1E4D32FC // 141
+data8 0x3FDC4E19B84723C1 // 142
+data8 0x3FDC7FF9C74554C9 // 143
+data8 0x3FDCA57B64E9DB05 // 144
+data8 0x3FDCCB130A5CEBAF // 145
+data8 0x3FDCF0C0D18F326F // 146
+data8 0x3FDD232075B5A201 // 147
+data8 0x3FDD490246DEFA6B // 148
+data8 0x3FDD6EFA918D25CD // 149
+data8 0x3FDD9509707AE52F // 150
+data8 0x3FDDBB2EFE92C554 // 151
+data8 0x3FDDEE2F3445E4AE // 152
+data8 0x3FDE148A1A2726CD // 153
+data8 0x3FDE3AFC0A49FF3F // 154
+data8 0x3FDE6185206D516D // 155
+data8 0x3FDE882578823D51 // 156
+data8 0x3FDEAEDD2EAC990C // 157
+data8 0x3FDED5AC5F436BE2 // 158
+data8 0x3FDEFC9326D16AB8 // 159
+data8 0x3FDF2391A21575FF // 160
+data8 0x3FDF4AA7EE03192C // 161
+data8 0x3FDF71D627C30BB0 // 162
+data8 0x3FDF991C6CB3B379 // 163
+data8 0x3FDFC07ADA69A90F // 164
+data8 0x3FDFE7F18EB03D3E // 165
+data8 0x3FE007C053C5002E // 166
+data8 0x3FE01B942198A5A0 // 167
+data8 0x3FE02F74400C64EA // 168
+data8 0x3FE04360BE7603AC // 169
+data8 0x3FE05759AC47FE33 // 170
+data8 0x3FE06B5F1911CF51 // 171
+data8 0x3FE078BF0533C568 // 172
+data8 0x3FE08CD9687E7B0E // 173
+data8 0x3FE0A10074CF9019 // 174
+data8 0x3FE0B5343A234476 // 175
+data8 0x3FE0C974C89431CD // 176
+data8 0x3FE0DDC2305B9886 // 177
+data8 0x3FE0EB524BAFC918 // 178
+data8 0x3FE0FFB54213A475 // 179
+data8 0x3FE114253DA97D9F // 180
+data8 0x3FE128A24F1D9AFF // 181
+data8 0x3FE1365252BF0864 // 182
+data8 0x3FE14AE558B4A92D // 183
+data8 0x3FE15F85A19C765B // 184
+data8 0x3FE16D4D38C119FA // 185
+data8 0x3FE18203C20DD133 // 186
+data8 0x3FE196C7BC4B1F3A // 187
+data8 0x3FE1A4A738B7A33C // 188
+data8 0x3FE1B981C0C9653C // 189
+data8 0x3FE1CE69E8BB106A // 190
+data8 0x3FE1DC619DE06944 // 191
+data8 0x3FE1F160A2AD0DA3 // 192
+data8 0x3FE2066D7740737E // 193
+data8 0x3FE2147DBA47A393 // 194
+data8 0x3FE229A1BC5EBAC3 // 195
+data8 0x3FE237C1841A502E // 196
+data8 0x3FE24CFCE6F80D9A // 197
+data8 0x3FE25B2C55CD5762 // 198
+data8 0x3FE2707F4D5F7C40 // 199
+data8 0x3FE285E0842CA383 // 200
+data8 0x3FE294294708B773 // 201
+data8 0x3FE2A9A2670AFF0C // 202
+data8 0x3FE2B7FB2C8D1CC0 // 203
+data8 0x3FE2C65A6395F5F5 // 204
+data8 0x3FE2DBF557B0DF42 // 205
+data8 0x3FE2EA64C3F97654 // 206
+data8 0x3FE3001823684D73 // 207
+data8 0x3FE30E97E9A8B5CC // 208
+data8 0x3FE32463EBDD34E9 // 209
+data8 0x3FE332F4314AD795 // 210
+data8 0x3FE348D90E7464CF // 211
+data8 0x3FE35779F8C43D6D // 212
+data8 0x3FE36621961A6A99 // 213
+data8 0x3FE37C299F3C366A // 214
+data8 0x3FE38AE2171976E7 // 215
+data8 0x3FE399A157A603E7 // 216
+data8 0x3FE3AFCCFE77B9D1 // 217
+data8 0x3FE3BE9D503533B5 // 218
+data8 0x3FE3CD7480B4A8A2 // 219
+data8 0x3FE3E3C43918F76C // 220
+data8 0x3FE3F2ACB27ED6C6 // 221
+data8 0x3FE4019C2125CA93 // 222
+data8 0x3FE4181061389722 // 223
+data8 0x3FE42711518DF545 // 224
+data8 0x3FE436194E12B6BF // 225
+data8 0x3FE445285D68EA69 // 226
+data8 0x3FE45BCC464C893A // 227
+data8 0x3FE46AED21F117FC // 228
+data8 0x3FE47A1527E8A2D3 // 229
+data8 0x3FE489445EFFFCCB // 230
+data8 0x3FE4A018BCB69835 // 231
+data8 0x3FE4AF5A0C9D65D7 // 232
+data8 0x3FE4BEA2A5BDBE87 // 233
+data8 0x3FE4CDF28F10AC46 // 234
+data8 0x3FE4DD49CF994058 // 235
+data8 0x3FE4ECA86E64A683 // 236
+data8 0x3FE503C43CD8EB68 // 237
+data8 0x3FE513356667FC57 // 238
+data8 0x3FE522AE0738A3D7 // 239
+data8 0x3FE5322E26867857 // 240
+data8 0x3FE541B5CB979809 // 241
+data8 0x3FE55144FDBCBD62 // 242
+data8 0x3FE560DBC45153C6 // 243
+data8 0x3FE5707A26BB8C66 // 244
+data8 0x3FE587F60ED5B8FF // 245
+data8 0x3FE597A7977C8F31 // 246
+data8 0x3FE5A760D634BB8A // 247
+data8 0x3FE5B721D295F10E // 248
+data8 0x3FE5C6EA94431EF9 // 249
+data8 0x3FE5D6BB22EA86F5 // 250
+data8 0x3FE5E6938645D38F // 251
+data8 0x3FE5F673C61A2ED1 // 252
+data8 0x3FE6065BEA385926 // 253
+data8 0x3FE6164BFA7CC06B // 254
+data8 0x3FE62643FECF9742 // 255
+//
+// lo parts of ln(1/frcpa(1+i/256)), i=0...255
+data4 0x20E70672 // 0
+data4 0x1F60A5D0 // 1
+data4 0x218EABA0 // 2
+data4 0x21403104 // 3
+data4 0x20E9B54E // 4
+data4 0x21EE1382 // 5
+data4 0x226014E3 // 6
+data4 0x2095E5C9 // 7
+data4 0x228BA9D4 // 8
+data4 0x22932B86 // 9
+data4 0x22608A57 // 10
+data4 0x220209F3 // 11
+data4 0x212882CC // 12
+data4 0x220D46E2 // 13
+data4 0x21FA4C28 // 14
+data4 0x229E5BD9 // 15
+data4 0x228C9838 // 16
+data4 0x2311F954 // 17
+data4 0x221365DF // 18
+data4 0x22BD0CB3 // 19
+data4 0x223D4BB7 // 20
+data4 0x22A71BBE // 21
+data4 0x237DB2FA // 22
+data4 0x23194C9D // 23
+data4 0x22EC639E // 24
+data4 0x2367E669 // 25
+data4 0x232E1D5F // 26
+data4 0x234A639B // 27
+data4 0x2365C0E0 // 28
+data4 0x234646C1 // 29
+data4 0x220CBF9C // 30
+data4 0x22A00FD4 // 31
+data4 0x2306A3F2 // 32
+data4 0x23745A9B // 33
+data4 0x2398D756 // 34
+data4 0x23DD0B6A // 35
+data4 0x23DE338B // 36
+data4 0x23A222DF // 37
+data4 0x223164F8 // 38
+data4 0x23B4E87B // 39
+data4 0x23D6CCB8 // 40
+data4 0x220C2099 // 41
+data4 0x21B86B67 // 42
+data4 0x236D14F1 // 43
+data4 0x225A923F // 44
+data4 0x22748723 // 45
+data4 0x22200D13 // 46
+data4 0x23C296EA // 47
+data4 0x2302AC38 // 48
+data4 0x234B1996 // 49
+data4 0x2385E298 // 50
+data4 0x23175BE5 // 51
+data4 0x2193F482 // 52
+data4 0x23BFEA90 // 53
+data4 0x23D70A0C // 54
+data4 0x231CF30A // 55
+data4 0x235D9E90 // 56
+data4 0x221AD0CB // 57
+data4 0x22FAA08B // 58
+data4 0x23D29A87 // 59
+data4 0x20C4B2FE // 60
+data4 0x2381B8B7 // 61
+data4 0x23F8D9FC // 62
+data4 0x23EAAE7B // 63
+data4 0x2329E8AA // 64
+data4 0x23EC0322 // 65
+data4 0x2357FDCB // 66
+data4 0x2392A9AD // 67
+data4 0x22113B02 // 68
+data4 0x22DEE901 // 69
+data4 0x236A6D14 // 70
+data4 0x2371D33E // 71
+data4 0x2146F005 // 72
+data4 0x23230B06 // 73
+data4 0x22F1C77D // 74
+data4 0x23A89FA3 // 75
+data4 0x231D1241 // 76
+data4 0x244DA96C // 77
+data4 0x23ECBB7D // 78
+data4 0x223E42B4 // 79
+data4 0x23801BC9 // 80
+data4 0x23573263 // 81
+data4 0x227C1158 // 82
+data4 0x237BD749 // 83
+data4 0x21DDBAE9 // 84
+data4 0x23401735 // 85
+data4 0x241D9DEE // 86
+data4 0x23BC88CB // 87
+data4 0x2396D5F1 // 88
+data4 0x23FC89CF // 89
+data4 0x2414F9A2 // 90
+data4 0x2474A0F5 // 91
+data4 0x24354B60 // 92
+data4 0x23C1EB40 // 93
+data4 0x2306DD92 // 94
+data4 0x24353B6B // 95
+data4 0x23CD1701 // 96
+data4 0x237C7A1C // 97
+data4 0x245793AA // 98
+data4 0x24563695 // 99
+data4 0x23C51467 // 100
+data4 0x24476B68 // 101
+data4 0x212585A9 // 102
+data4 0x247B8293 // 103
+data4 0x2446848A // 104
+data4 0x246A53F8 // 105
+data4 0x246E496D // 106
+data4 0x23ED1D36 // 107
+data4 0x2314C258 // 108
+data4 0x233244A7 // 109
+data4 0x245B7AF0 // 110
+data4 0x24247130 // 111
+data4 0x22D67B38 // 112
+data4 0x2449F620 // 113
+data4 0x23BBC8B8 // 114
+data4 0x237D3BA0 // 115
+data4 0x245E8F13 // 116
+data4 0x2435573F // 117
+data4 0x242DE666 // 118
+data4 0x2463BC10 // 119
+data4 0x2466587D // 120
+data4 0x2408144B // 121
+data4 0x2405F0E5 // 122
+data4 0x22381CFF // 123
+data4 0x24154F9B // 124
+data4 0x23A4E96E // 125
+data4 0x24052967 // 126
+data4 0x2406963F // 127
+data4 0x23F7D3CB // 128
+data4 0x2448AFF4 // 129
+data4 0x24657A21 // 130
+data4 0x22FBC230 // 131
+data4 0x243C8DEA // 132
+data4 0x225DC4B7 // 133
+data4 0x23496EBF // 134
+data4 0x237C2B2B // 135
+data4 0x23A4A5B1 // 136
+data4 0x2394E9D1 // 137
+data4 0x244BC950 // 138
+data4 0x23C7448F // 139
+data4 0x2404A1AD // 140
+data4 0x246511D5 // 141
+data4 0x24246526 // 142
+data4 0x23111F57 // 143
+data4 0x22868951 // 144
+data4 0x243EB77F // 145
+data4 0x239F3DFF // 146
+data4 0x23089666 // 147
+data4 0x23EBFA6A // 148
+data4 0x23C51312 // 149
+data4 0x23E1DD5E // 150
+data4 0x232C0944 // 151
+data4 0x246A741F // 152
+data4 0x2414DF8D // 153
+data4 0x247B5546 // 154
+data4 0x2415C980 // 155
+data4 0x24324ABD // 156
+data4 0x234EB5E5 // 157
+data4 0x2465E43E // 158
+data4 0x242840D1 // 159
+data4 0x24444057 // 160
+data4 0x245E56F0 // 161
+data4 0x21AE30F8 // 162
+data4 0x23FB3283 // 163
+data4 0x247A4D07 // 164
+data4 0x22AE314D // 165
+data4 0x246B7727 // 166
+data4 0x24EAD526 // 167
+data4 0x24B41DC9 // 168
+data4 0x24EE8062 // 169
+data4 0x24A0C7C4 // 170
+data4 0x24E8DA67 // 171
+data4 0x231120F7 // 172
+data4 0x24401FFB // 173
+data4 0x2412DD09 // 174
+data4 0x248C131A // 175
+data4 0x24C0A7CE // 176
+data4 0x243DD4C8 // 177
+data4 0x24457FEB // 178
+data4 0x24DEEFBB // 179
+data4 0x243C70AE // 180
+data4 0x23E7A6FA // 181
+data4 0x24C2D311 // 182
+data4 0x23026255 // 183
+data4 0x2437C9B9 // 184
+data4 0x246BA847 // 185
+data4 0x2420B448 // 186
+data4 0x24C4CF5A // 187
+data4 0x242C4981 // 188
+data4 0x24DE1525 // 189
+data4 0x24F5CC33 // 190
+data4 0x235A85DA // 191
+data4 0x24A0B64F // 192
+data4 0x244BA0A4 // 193
+data4 0x24AAF30A // 194
+data4 0x244C86F9 // 195
+data4 0x246D5B82 // 196
+data4 0x24529347 // 197
+data4 0x240DD008 // 198
+data4 0x24E98790 // 199
+data4 0x2489B0CE // 200
+data4 0x22BC29AC // 201
+data4 0x23F37C7A // 202
+data4 0x24987FE8 // 203
+data4 0x22AFE20B // 204
+data4 0x24C8D7C2 // 205
+data4 0x24B28B7D // 206
+data4 0x23B6B271 // 207
+data4 0x24C77CB6 // 208
+data4 0x24EF1DCA // 209
+data4 0x24A4F0AC // 210
+data4 0x24CF113E // 211
+data4 0x2496BBAB // 212
+data4 0x23C7CC8A // 213
+data4 0x23AE3961 // 214
+data4 0x2410A895 // 215
+data4 0x23CE3114 // 216
+data4 0x2308247D // 217
+data4 0x240045E9 // 218
+data4 0x24974F60 // 219
+data4 0x242CB39F // 220
+data4 0x24AB8D69 // 221
+data4 0x23436788 // 222
+data4 0x24305E9E // 223
+data4 0x243E71A9 // 224
+data4 0x23C2A6B3 // 225
+data4 0x23FFE6CF // 226
+data4 0x2322D801 // 227
+data4 0x24515F21 // 228
+data4 0x2412A0D6 // 229
+data4 0x24E60D44 // 230
+data4 0x240D9251 // 231
+data4 0x247076E2 // 232
+data4 0x229B101B // 233
+data4 0x247B12DE // 234
+data4 0x244B9127 // 235
+data4 0x2499EC42 // 236
+data4 0x21FC3963 // 237
+data4 0x23E53266 // 238
+data4 0x24CE102D // 239
+data4 0x23CC45D2 // 240
+data4 0x2333171D // 241
+data4 0x246B3533 // 242
+data4 0x24931129 // 243
+data4 0x24405FFA // 244
+data4 0x24CF464D // 245
+data4 0x237095CD // 246
+data4 0x24F86CBD // 247
+data4 0x24E2D84B // 248
+data4 0x21ACBB44 // 249
+data4 0x24F43A8C // 250
+data4 0x249DB931 // 251
+data4 0x24A385EF // 252
+data4 0x238B1279 // 253
+data4 0x2436213E // 254
+data4 0x24F18A3B // 255
+LOCAL_OBJECT_END(log_data)
+
+
+LOCAL_OBJECT_START(log10_data)
+// coefficients of polynoimal approximation
+data8 0x3FC2494104381A8E // A7
+data8 0xBFC5556D556BBB69 // A6
+//
+// two parts of ln(2)/ln(10)
+data8 0x3FD3441350900000, 0x3DCEF3FDE623E256
+//
+data8 0xDE5BD8A937287195,0x3FFD // 1/ln(10)
+//
+data8 0x3FC999999988B5E9 // A5
+data8 0xBFCFFFFFFFF6FFF5 // A4
+//
+// Hi parts of ln(1/frcpa(1+i/256))/ln(10), i=0...255
+data8 0x3F4BD27045BFD024 // 0
+data8 0x3F64E84E793A474A // 1
+data8 0x3F7175085AB85FF0 // 2
+data8 0x3F787CFF9D9147A5 // 3
+data8 0x3F7EA9D372B89FC8 // 4
+data8 0x3F82DF9D95DA961C // 5
+data8 0x3F866DF172D6372B // 6
+data8 0x3F898D79EF5EEDEF // 7
+data8 0x3F8D22ADF3F9579C // 8
+data8 0x3F9024231D30C398 // 9
+data8 0x3F91F23A98897D49 // 10
+data8 0x3F93881A7B818F9E // 11
+data8 0x3F951F6E1E759E35 // 12
+data8 0x3F96F2BCE7ADC5B4 // 13
+data8 0x3F988D362CDF359E // 14
+data8 0x3F9A292BAF010981 // 15
+data8 0x3F9BC6A03117EB97 // 16
+data8 0x3F9D65967DE3AB08 // 17
+data8 0x3F9F061167FC31E7 // 18
+data8 0x3FA05409E4F7819B // 19
+data8 0x3FA125D0432EA20D // 20
+data8 0x3FA1F85D440D299B // 21
+data8 0x3FA2AD755749617C // 22
+data8 0x3FA381772A00E603 // 23
+data8 0x3FA45643E165A70A // 24
+data8 0x3FA52BDD034475B8 // 25
+data8 0x3FA5E3966B7E9295 // 26
+data8 0x3FA6BAAF47C5B244 // 27
+data8 0x3FA773B3E8C4F3C7 // 28
+data8 0x3FA84C51EBEE8D15 // 29
+data8 0x3FA906A6786FC1CA // 30
+data8 0x3FA9C197ABF00DD6 // 31
+data8 0x3FAA9C78712191F7 // 32
+data8 0x3FAB58C09C8D637C // 33
+data8 0x3FAC15A8BCDD7B7E // 34
+data8 0x3FACD331E2C2967B // 35
+data8 0x3FADB11ED766ABF4 // 36
+data8 0x3FAE70089346A9E6 // 37
+data8 0x3FAF2F96C6754AED // 38
+data8 0x3FAFEFCA8D451FD5 // 39
+data8 0x3FB0585283764177 // 40
+data8 0x3FB0B913AAC7D3A6 // 41
+data8 0x3FB11A294F2569F5 // 42
+data8 0x3FB16B51A2696890 // 43
+data8 0x3FB1CD03ADACC8BD // 44
+data8 0x3FB22F0BDD7745F5 // 45
+data8 0x3FB2916ACA38D1E7 // 46
+data8 0x3FB2F4210DF7663C // 47
+data8 0x3FB346A6C3C49065 // 48
+data8 0x3FB3A9FEBC605409 // 49
+data8 0x3FB3FD0C10A3AA54 // 50
+data8 0x3FB46107D3540A81 // 51
+data8 0x3FB4C55DD16967FE // 52
+data8 0x3FB51940330C000A // 53
+data8 0x3FB56D620EE7115E // 54
+data8 0x3FB5D2ABCF26178D // 55
+data8 0x3FB6275AA5DEBF81 // 56
+data8 0x3FB68D4EAF26D7EE // 57
+data8 0x3FB6E28C5C54A28D // 58
+data8 0x3FB7380B9665B7C7 // 59
+data8 0x3FB78DCCC278E85B // 60
+data8 0x3FB7F50C2CF25579 // 61
+data8 0x3FB84B5FD5EAEFD7 // 62
+data8 0x3FB8A1F6BAB2B226 // 63
+data8 0x3FB8F8D144557BDF // 64
+data8 0x3FB94FEFDCD61D92 // 65
+data8 0x3FB9A752EF316149 // 66
+data8 0x3FB9FEFAE7611EDF // 67
+data8 0x3FBA56E8325F5C86 // 68
+data8 0x3FBAAF1B3E297BB3 // 69
+data8 0x3FBB079479C372AC // 70
+data8 0x3FBB6054553B12F7 // 71
+data8 0x3FBBB95B41AB5CE5 // 72
+data8 0x3FBC12A9B13FE079 // 73
+data8 0x3FBC6C4017382BEA // 74
+data8 0x3FBCB41FBA42686C // 75
+data8 0x3FBD0E38CE73393E // 76
+data8 0x3FBD689B2193F132 // 77
+data8 0x3FBDC3472B1D285F // 78
+data8 0x3FBE0C06300D528B // 79
+data8 0x3FBE6738190E394B // 80
+data8 0x3FBEC2B50D208D9A // 81
+data8 0x3FBF0C1C2B936827 // 82
+data8 0x3FBF68216C9CC726 // 83
+data8 0x3FBFB1F6381856F3 // 84
+data8 0x3FC00742AF4CE5F8 // 85
+data8 0x3FC02C64906512D2 // 86
+data8 0x3FC05AF1E63E03B4 // 87
+data8 0x3FC0804BEA723AA8 // 88
+data8 0x3FC0AF1FD6711526 // 89
+data8 0x3FC0D4B2A88059FF // 90
+data8 0x3FC0FA5EF136A06C // 91
+data8 0x3FC1299A4FB3E305 // 92
+data8 0x3FC14F806253C3EC // 93
+data8 0x3FC175805D1587C1 // 94
+data8 0x3FC19B9A637CA294 // 95
+data8 0x3FC1CB5FC26EDE16 // 96
+data8 0x3FC1F1B4E65F2590 // 97
+data8 0x3FC218248B5DC3E5 // 98
+data8 0x3FC23EAED62ADC76 // 99
+data8 0x3FC26553EBD337BC // 100
+data8 0x3FC28C13F1B118FF // 101
+data8 0x3FC2BCAA14381385 // 102
+data8 0x3FC2E3A740B7800E // 103
+data8 0x3FC30ABFD8F333B6 // 104
+data8 0x3FC331F403985096 // 105
+data8 0x3FC35943E7A6068F // 106
+data8 0x3FC380AFAC6E7C07 // 107
+data8 0x3FC3A8377997B9E5 // 108
+data8 0x3FC3CFDB771C9ADB // 109
+data8 0x3FC3EDA90D39A5DE // 110
+data8 0x3FC4157EC09505CC // 111
+data8 0x3FC43D7113FB04C0 // 112
+data8 0x3FC4658030AD1CCE // 113
+data8 0x3FC48DAC404638F5 // 114
+data8 0x3FC4B5F56CBBB869 // 115
+data8 0x3FC4DE5BE05E7582 // 116
+data8 0x3FC4FCBC0776FD85 // 117
+data8 0x3FC525561E9256EE // 118
+data8 0x3FC54E0DF3198865 // 119
+data8 0x3FC56CAB7112BDE2 // 120
+data8 0x3FC59597BA735B15 // 121
+data8 0x3FC5BEA23A506FD9 // 122
+data8 0x3FC5DD7E08DE382E // 123
+data8 0x3FC606BDD3F92355 // 124
+data8 0x3FC6301C518A501E // 125
+data8 0x3FC64F3770618915 // 126
+data8 0x3FC678CC14C1E2D7 // 127
+data8 0x3FC6981005ED2947 // 128
+data8 0x3FC6C1DB5F9BB335 // 129
+data8 0x3FC6E1488ECD2880 // 130
+data8 0x3FC70B4B2E7E41B8 // 131
+data8 0x3FC72AE209146BF8 // 132
+data8 0x3FC7551C81BD8DCF // 133
+data8 0x3FC774DD76CC43BD // 134
+data8 0x3FC79F505DB00E88 // 135
+data8 0x3FC7BF3BDE099F30 // 136
+data8 0x3FC7E9E7CAC437F8 // 137
+data8 0x3FC809FE4902D00D // 138
+data8 0x3FC82A2757995CBD // 139
+data8 0x3FC85525C625E098 // 140
+data8 0x3FC8757A79831887 // 141
+data8 0x3FC895E2058D8E02 // 142
+data8 0x3FC8C13437695531 // 143
+data8 0x3FC8E1C812EF32BE // 144
+data8 0x3FC9026F112197E8 // 145
+data8 0x3FC923294888880A // 146
+data8 0x3FC94EEA4B8334F2 // 147
+data8 0x3FC96FD1B639FC09 // 148
+data8 0x3FC990CCA66229AB // 149
+data8 0x3FC9B1DB33334842 // 150
+data8 0x3FC9D2FD740E6606 // 151
+data8 0x3FC9FF49EEDCB553 // 152
+data8 0x3FCA209A84FBCFF7 // 153
+data8 0x3FCA41FF1E43F02B // 154
+data8 0x3FCA6377D2CE9377 // 155
+data8 0x3FCA8504BAE0D9F5 // 156
+data8 0x3FCAA6A5EEEBEFE2 // 157
+data8 0x3FCAC85B878D7878 // 158
+data8 0x3FCAEA259D8FFA0B // 159
+data8 0x3FCB0C0449EB4B6A // 160
+data8 0x3FCB2DF7A5C50299 // 161
+data8 0x3FCB4FFFCA70E4D1 // 162
+data8 0x3FCB721CD17157E2 // 163
+data8 0x3FCB944ED477D4EC // 164
+data8 0x3FCBB695ED655C7C // 165
+data8 0x3FCBD8F2364AEC0F // 166
+data8 0x3FCBFB63C969F4FF // 167
+data8 0x3FCC1DEAC134D4E9 // 168
+data8 0x3FCC4087384F4F80 // 169
+data8 0x3FCC6339498F09E1 // 170
+data8 0x3FCC86010FFC076B // 171
+data8 0x3FCC9D3D065C5B41 // 172
+data8 0x3FCCC029375BA079 // 173
+data8 0x3FCCE32B66978BA4 // 174
+data8 0x3FCD0643AFD51404 // 175
+data8 0x3FCD29722F0DEA45 // 176
+data8 0x3FCD4CB70070FE43 // 177
+data8 0x3FCD6446AB3F8C95 // 178
+data8 0x3FCD87B0EF71DB44 // 179
+data8 0x3FCDAB31D1FE99A6 // 180
+data8 0x3FCDCEC96FDC888E // 181
+data8 0x3FCDE69088763579 // 182
+data8 0x3FCE0A4E4A25C1FF // 183
+data8 0x3FCE2E2315755E32 // 184
+data8 0x3FCE461322D1648A // 185
+data8 0x3FCE6A0E95C7787B // 186
+data8 0x3FCE8E216243DD60 // 187
+data8 0x3FCEA63AF26E007C // 188
+data8 0x3FCECA74ED15E0B7 // 189
+data8 0x3FCEEEC692CCD259 // 190
+data8 0x3FCF070A36B8D9C0 // 191
+data8 0x3FCF2B8393E34A2D // 192
+data8 0x3FCF5014EF538A5A // 193
+data8 0x3FCF68833AF1B17F // 194
+data8 0x3FCF8D3CD9F3F04E // 195
+data8 0x3FCFA5C61ADD93E9 // 196
+data8 0x3FCFCAA8567EBA79 // 197
+data8 0x3FCFE34CC8743DD8 // 198
+data8 0x3FD0042BFD74F519 // 199
+data8 0x3FD016BDF6A18017 // 200
+data8 0x3FD023262F907322 // 201
+data8 0x3FD035CCED8D32A1 // 202
+data8 0x3FD042430E869FFB // 203
+data8 0x3FD04EBEC842B2DF // 204
+data8 0x3FD06182E84FD4AB // 205
+data8 0x3FD06E0CB609D383 // 206
+data8 0x3FD080E60BEC8F12 // 207
+data8 0x3FD08D7E0D894735 // 208
+data8 0x3FD0A06CC96A2055 // 209
+data8 0x3FD0AD131F3B3C55 // 210
+data8 0x3FD0C01771E775FB // 211
+data8 0x3FD0CCCC3CAD6F4B // 212
+data8 0x3FD0D986D91A34A8 // 213
+data8 0x3FD0ECA9B8861A2D // 214
+data8 0x3FD0F972F87FF3D5 // 215
+data8 0x3FD106421CF0E5F7 // 216
+data8 0x3FD11983EBE28A9C // 217
+data8 0x3FD12661E35B7859 // 218
+data8 0x3FD13345D2779D3B // 219
+data8 0x3FD146A6F597283A // 220
+data8 0x3FD15399E81EA83D // 221
+data8 0x3FD16092E5D3A9A6 // 222
+data8 0x3FD17413C3B7AB5D // 223
+data8 0x3FD1811BF629D6FA // 224
+data8 0x3FD18E2A47B46685 // 225
+data8 0x3FD19B3EBE1A4418 // 226
+data8 0x3FD1AEE9017CB450 // 227
+data8 0x3FD1BC0CED7134E1 // 228
+data8 0x3FD1C93712ABC7FF // 229
+data8 0x3FD1D66777147D3E // 230
+data8 0x3FD1EA3BD1286E1C // 231
+data8 0x3FD1F77BED932C4C // 232
+data8 0x3FD204C25E1B031F // 233
+data8 0x3FD2120F28CE69B1 // 234
+data8 0x3FD21F6253C48D00 // 235
+data8 0x3FD22CBBE51D60A9 // 236
+data8 0x3FD240CE4C975444 // 237
+data8 0x3FD24E37F8ECDAE7 // 238
+data8 0x3FD25BA8215AF7FC // 239
+data8 0x3FD2691ECC29F042 // 240
+data8 0x3FD2769BFFAB2DFF // 241
+data8 0x3FD2841FC23952C9 // 242
+data8 0x3FD291AA1A384978 // 243
+data8 0x3FD29F3B0E15584A // 244
+data8 0x3FD2B3A0EE479DF7 // 245
+data8 0x3FD2C142842C09E5 // 246
+data8 0x3FD2CEEACCB7BD6C // 247
+data8 0x3FD2DC99CE82FF20 // 248
+data8 0x3FD2EA4F902FD7D9 // 249
+data8 0x3FD2F80C186A25FC // 250
+data8 0x3FD305CF6DE7B0F6 // 251
+data8 0x3FD3139997683CE7 // 252
+data8 0x3FD3216A9BB59E7C // 253
+data8 0x3FD32F4281A3CEFE // 254
+data8 0x3FD33D2150110091 // 255
+//
+// Lo parts of ln(1/frcpa(1+i/256))/ln(10), i=0...255
+data4 0x1FB0EB5A // 0
+data4 0x206E5EE3 // 1
+data4 0x208F3609 // 2
+data4 0x2070EB03 // 3
+data4 0x1F314BAE // 4
+data4 0x217A889D // 5
+data4 0x21E63650 // 6
+data4 0x21C2F4A3 // 7
+data4 0x2192A10C // 8
+data4 0x1F84B73E // 9
+data4 0x2243FBCA // 10
+data4 0x21BD9C51 // 11
+data4 0x213C542B // 12
+data4 0x21047386 // 13
+data4 0x21217D8F // 14
+data4 0x226791B7 // 15
+data4 0x204CCE66 // 16
+data4 0x2234CE9F // 17
+data4 0x220675E2 // 18
+data4 0x22B8E5BA // 19
+data4 0x22C12D14 // 20
+data4 0x211D41F0 // 21
+data4 0x228507F3 // 22
+data4 0x22F7274B // 23
+data4 0x22A7FDD1 // 24
+data4 0x2244A06E // 25
+data4 0x215DCE69 // 26
+data4 0x22F5C961 // 27
+data4 0x22EBEF29 // 28
+data4 0x222A2CB6 // 29
+data4 0x22B9FE00 // 30
+data4 0x22E79EB7 // 31
+data4 0x222F9607 // 32
+data4 0x2189D87F // 33
+data4 0x2236DB45 // 34
+data4 0x22ED77FB // 35
+data4 0x21CB70F0 // 36
+data4 0x21B8ACE8 // 37
+data4 0x22EC58C1 // 38
+data4 0x22CFCC1C // 39
+data4 0x2343E77A // 40
+data4 0x237FBC7F // 41
+data4 0x230D472E // 42
+data4 0x234686FB // 43
+data4 0x23770425 // 44
+data4 0x223977EC // 45
+data4 0x2345800A // 46
+data4 0x237BC351 // 47
+data4 0x23191502 // 48
+data4 0x232BAC12 // 49
+data4 0x22692421 // 50
+data4 0x234D409D // 51
+data4 0x22EC3214 // 52
+data4 0x2376C916 // 53
+data4 0x22B00DD1 // 54
+data4 0x2309D910 // 55
+data4 0x22F925FD // 56
+data4 0x22A63A7B // 57
+data4 0x2106264A // 58
+data4 0x234227F9 // 59
+data4 0x1ECB1978 // 60
+data4 0x23460A62 // 61
+data4 0x232ED4B1 // 62
+data4 0x226DDC38 // 63
+data4 0x1F101A73 // 64
+data4 0x21B1F82B // 65
+data4 0x22752F19 // 66
+data4 0x2320BC15 // 67
+data4 0x236EEC5E // 68
+data4 0x23404D3E // 69
+data4 0x2304C517 // 70
+data4 0x22F7441A // 71
+data4 0x230D3D7A // 72
+data4 0x2264A9DF // 73
+data4 0x22410CC8 // 74
+data4 0x2342CCCB // 75
+data4 0x23560BD4 // 76
+data4 0x237BBFFE // 77
+data4 0x2373A206 // 78
+data4 0x22C871B9 // 79
+data4 0x2354B70C // 80
+data4 0x232EDB33 // 81
+data4 0x235DB680 // 82
+data4 0x230EF422 // 83
+data4 0x235316CA // 84
+data4 0x22EEEE8B // 85
+data4 0x2375C88C // 86
+data4 0x235ABD21 // 87
+data4 0x23A0D232 // 88
+data4 0x23F5FFB5 // 89
+data4 0x23D3CEC8 // 90
+data4 0x22A92204 // 91
+data4 0x238C64DF // 92
+data4 0x23B82896 // 93
+data4 0x22D633B8 // 94
+data4 0x23861E93 // 95
+data4 0x23CB594B // 96
+data4 0x2330387E // 97
+data4 0x21CD4702 // 98
+data4 0x2284C505 // 99
+data4 0x23D6995C // 100
+data4 0x23F6C807 // 101
+data4 0x239CEF5C // 102
+data4 0x239442B0 // 103
+data4 0x22B35EE5 // 104
+data4 0x2391E9A4 // 105
+data4 0x23A390F5 // 106
+data4 0x2349AC9C // 107
+data4 0x23FA5535 // 108
+data4 0x21E3A46A // 109
+data4 0x23B44ABA // 110
+data4 0x23CEA8E0 // 111
+data4 0x23F647DC // 112
+data4 0x2390D1A8 // 113
+data4 0x23D0CFA2 // 114
+data4 0x236E0872 // 115
+data4 0x23B88B91 // 116
+data4 0x2283C359 // 117
+data4 0x232F647F // 118
+data4 0x23122CD7 // 119
+data4 0x232CF564 // 120
+data4 0x232630FD // 121
+data4 0x23BEE1C8 // 122
+data4 0x23B2BD30 // 123
+data4 0x2301F1C0 // 124
+data4 0x23CE4D67 // 125
+data4 0x23A353C9 // 126
+data4 0x238086E8 // 127
+data4 0x22D0D29E // 128
+data4 0x23A3B3C8 // 129
+data4 0x23F69F4B // 130
+data4 0x23EA3C21 // 131
+data4 0x23951C88 // 132
+data4 0x2372AFFC // 133
+data4 0x23A6D1A8 // 134
+data4 0x22BBBAF4 // 135
+data4 0x227FA3DD // 136
+data4 0x23804D9B // 137
+data4 0x232D771F // 138
+data4 0x239CB57B // 139
+data4 0x2303CF34 // 140
+data4 0x22218C2A // 141
+data4 0x23991BEE // 142
+data4 0x23EB3596 // 143
+data4 0x230487FA // 144
+data4 0x2135DF4C // 145
+data4 0x2380FD2D // 146
+data4 0x23EB75E9 // 147
+data4 0x211C62C8 // 148
+data4 0x23F518F1 // 149
+data4 0x23FEF882 // 150
+data4 0x239097C7 // 151
+data4 0x223E2BDA // 152
+data4 0x23988F89 // 153
+data4 0x22E4A4AD // 154
+data4 0x23F03D9C // 155
+data4 0x23F5018F // 156
+data4 0x23E1E250 // 157
+data4 0x23FD3D90 // 158
+data4 0x22DEE2FF // 159
+data4 0x238342AB // 160
+data4 0x22E6736F // 161
+data4 0x233AFC28 // 162
+data4 0x2395F661 // 163
+data4 0x23D8B991 // 164
+data4 0x23CD58D5 // 165
+data4 0x21941FD6 // 166
+data4 0x23352915 // 167
+data4 0x235D09EE // 168
+data4 0x22DC7EF9 // 169
+data4 0x238BC9F3 // 170
+data4 0x2397DF8F // 171
+data4 0x2380A7BB // 172
+data4 0x23EFF48C // 173
+data4 0x21E67408 // 174
+data4 0x236420F7 // 175
+data4 0x22C8DFB5 // 176
+data4 0x239B5D35 // 177
+data4 0x23BDC09D // 178
+data4 0x239E822C // 179
+data4 0x23984F0A // 180
+data4 0x23EF2119 // 181
+data4 0x23F738B8 // 182
+data4 0x23B66187 // 183
+data4 0x23B06AD7 // 184
+data4 0x2369140F // 185
+data4 0x218DACE6 // 186
+data4 0x21DF23F1 // 187
+data4 0x235D8B34 // 188
+data4 0x23460333 // 189
+data4 0x23F11D62 // 190
+data4 0x23C37147 // 191
+data4 0x22B2AE2A // 192
+data4 0x23949211 // 193
+data4 0x23B69799 // 194
+data4 0x23DBEC75 // 195
+data4 0x229A6FB3 // 196
+data4 0x23FC6C60 // 197
+data4 0x22D01FFC // 198
+data4 0x235985F0 // 199
+data4 0x23F7ECA5 // 200
+data4 0x23F924D3 // 201
+data4 0x2381B92F // 202
+data4 0x243A0FBE // 203
+data4 0x24712D72 // 204
+data4 0x24594E2F // 205
+data4 0x220CD12A // 206
+data4 0x23D87FB0 // 207
+data4 0x2338288A // 208
+data4 0x242BB2CC // 209
+data4 0x220F6265 // 210
+data4 0x23BB7FE3 // 211
+data4 0x2301C0A2 // 212
+data4 0x246709AB // 213
+data4 0x23A619E2 // 214
+data4 0x24030E3B // 215
+data4 0x233C36CC // 216
+data4 0x241AAB77 // 217
+data4 0x243D41A3 // 218
+data4 0x23834A60 // 219
+data4 0x236AC7BF // 220
+data4 0x23B6D597 // 221
+data4 0x210E9474 // 222
+data4 0x242156E6 // 223
+data4 0x243A1D68 // 224
+data4 0x2472187C // 225
+data4 0x23834E86 // 226
+data4 0x23CA0807 // 227
+data4 0x24745887 // 228
+data4 0x23E2B0E1 // 229
+data4 0x2421EB67 // 230
+data4 0x23DCC64E // 231
+data4 0x22DF71D1 // 232
+data4 0x238D5ECA // 233
+data4 0x23CDE86F // 234
+data4 0x24131F45 // 235
+data4 0x240FE4E2 // 236
+data4 0x2317731A // 237
+data4 0x24015C76 // 238
+data4 0x2301A4E8 // 239
+data4 0x23E52A6D // 240
+data4 0x247D8A0D // 241
+data4 0x23DFEEBA // 242
+data4 0x22139FEC // 243
+data4 0x2454A112 // 244
+data4 0x23C21E28 // 245
+data4 0x2460D813 // 246
+data4 0x24258924 // 247
+data4 0x2425680F // 248
+data4 0x24194D1E // 249
+data4 0x24242C2F // 250
+data4 0x243DDE5E // 251
+data4 0x23DEB388 // 252
+data4 0x23E0E6EB // 253
+data4 0x24393E74 // 254
+data4 0x241B1863 // 255
+LOCAL_OBJECT_END(log10_data)
+
+
+
+// Code
+//==============================================================
 
-// log10 has p7 true, p8 false
-// log   has p8 true, p7 false
+// log   has p13 true, p14 false
+// log10 has p14 true, p13 false
 
 .section .text
-.proc  log10#
-.align 32
-
-log10:
-#ifdef _LIBC
-.global __ieee754_log10
-.type __ieee754_log10,@function
-__ieee754_log10:
-#endif
+GLOBAL_IEEE754_ENTRY(log10)
 { .mfi
-     alloc     r32=ar.pfs,1,15,4,0                    
-     frcpa.s1  log_C,p9 = f1,f8                 
-     cmp.eq.unc     p7,p8         = r0, r0 
-}
-{ .mfb
-     addl           log_AD_1   = @ltoff(log_table_1), gp
-     fnorm.s1 log_NORM_f8 = f8 
-     br.sptk        L(LOG_LOG10_X) 
+      getf.exp      GR_Exp = f8 // if x is unorm then must recompute
+      frcpa.s1      FR_RcpX,p0 = f1,f8
+      mov           GR_05 = 0xFFFE // biased exponent of A2=0.5
 }
-;;
-
-.endp log10
-ASM_SIZE_DIRECTIVE(log10)
-ASM_SIZE_DIRECTIVE(__ieee754_log10)
-
-
-.section .text
-.proc  log#
-.align 32
-log: 
-#ifdef _LIBC
-.global __ieee754_log
-.type __ieee754_log,@function
-__ieee754_log:
-#endif
+{ .mlx
+      addl          GR_ad_1 = @ltoff(log10_data),gp
+      movl          GR_A3 = 0x3fd5555555555557 // double precision memory
+                                               // representation of A3
+};;
 
 { .mfi
-     alloc     r32=ar.pfs,1,15,4,0                    
-     frcpa.s1  log_C,p9 = f1,f8                 
-     cmp.eq.unc     p8,p7         = r0, r0 
-}
-{ .mfi
-     addl           log_AD_1   = @ltoff(log_table_1), gp
-     fnorm.s1 log_NORM_f8 = f8 
-     nop.i 999
+      getf.sig      GR_Sig = f8 // get significand to calculate index
+      fclass.m      p8,p0 = f8,9 // is x positive unorm?
+      mov           GR_xorg = 0x3fefe // double precision memory msb of 255/256
 }
-;;
+{ .mib
+      ld8           GR_ad_1 = [GR_ad_1]
+      cmp.eq        p14,p13 = r0,r0 // set p14 to 1 for log10
+      br.cond.sptk  log_log10_common
+};;
+GLOBAL_IEEE754_END(log10)
 
-L(LOG_LOG10_X):
 
+GLOBAL_IEEE754_ENTRY(log)
 { .mfi
-     ld8 log_AD_1 = [log_AD_1]
-     fclass.m.unc p15,p0 = f8, 0x0b            // Test for x=unorm
-     mov        log_GR_fff9 = 0xfff9
-}
-{ .mfi
-     mov       log_GR_half_exp = 0x0fffe
-     fms.s1     log_w = f8,f1,f1              
-     mov       log_GR_exp_17_ones = 0x1ffff
-}
-;;
-
-{ .mmi
-     getf.exp   log_GR_signexp_f8 = f8 // If x unorm then must recompute
-     setf.exp   log_half = log_GR_half_exp  // Form 0.5 = -Q1
-     nop.i 999
-}
-;;
-
-{ .mmb
-     adds log_AD_2 = 0x30, log_AD_1
-     mov       log_GR_exp_16_ones = 0xffff
-(p15) br.cond.spnt L(LOG_DENORM)     
-}
-;;
-
-L(LOG_COMMON):
-{.mfi
-     ldfpd      log_P5,log_P4 = [log_AD_1],16           
-     fclass.m.unc p6,p0 = f8, 0xc3             // Test for x=nan
-     and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones  
+      getf.exp      GR_Exp = f8 // if x is unorm then must recompute
+      frcpa.s1      FR_RcpX,p0 = f1,f8
+      mov           GR_05 = 0xfffe
 }
-{.mfi
-     ldfpd      log_P3,log_P2 = [log_AD_2],16           
-     nop.f 999
-     nop.i 999
-}
-;;
+{ .mlx
+      addl          GR_ad_1 = @ltoff(log_data),gp
+      movl          GR_A3 = 0x3fd5555555555557 // double precision memory
+                                               // representation of A3
+};;
 
 { .mfi
-     ldfpd      log_Q8,log_Q7 = [log_AD_1],16           
-     fclass.m.unc p11,p0 = f8, 0x21            // Test for x=+inf
-     sub       log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones 
+      getf.sig      GR_Sig = f8 // get significand to calculate index
+      fclass.m      p8,p0 = f8,9 // is x positive unorm?
+      mov           GR_xorg = 0x3fefe // double precision memory msb of 255/256
 }
 { .mfi
-     ldfpd      log_Q6,log_Q5 = [log_AD_2],16           
-     nop.f 999
-     nop.i 999
-}
-;;
-
+      ld8           GR_ad_1 = [GR_ad_1]
+      nop.f         0
+      cmp.eq        p13,p14 = r0,r0 // set p13 to 1 for log
+};;
 
+log_log10_common:
 { .mfi
-     ldfpd      log_Q4,log_Q3 = [log_AD_1],16           
-     fma.s1     log_wsq     = log_w, log_w, f0
-     nop.i 999
-}
-{ .mfb
-     ldfpd      log_Q2,log_Q1 = [log_AD_2],16           
-(p6) fma.d.s0   f8 = f8,f1,f0      // quietize nan result if x=nan
-(p6) br.ret.spnt b0                // Exit for x=nan
+      getf.d        GR_x = f8 // double precision memory representation of x
+      fclass.m      p9,p0 = f8,0x1E1 // is x NaN, NaT or +Inf?
+      dep.z         GR_dx = 3, 44, 2 // Create 0x0000300000000000
+                                     // Difference between double precision
+                                     // memory representations of 257/256 and
+                                     // 255/256
 }
-;;
-
-
 { .mfi
-     setf.sig  log_int_Nfloat = log_GR_true_exp_f8
-     fcmp.eq.s1 p10,p0 = log_NORM_f8, f1  // Test for x=+1.0
-     nop.i 999
-}
-{ .mfb
-     nop.m 999
-     fms.s1     log_r = log_C,f8,f1
-(p11) br.ret.spnt b0               // Exit for x=+inf
-}
-;;
-
-
-{ .mmf
-     getf.sig   log_GR_significand_f8 = log_NORM_f8 
-     ldfe       log_inv_ln10 = [log_AD_2],16      
-     fclass.m.unc p6,p0 = f8, 0x07        // Test for x=0
-}
-;;
-
-
-{ .mfb
-     nop.m 999
-(p10) fmerge.s f8 = f0, f0
-(p10) br.ret.spnt b0                // Exit for x=1.0
-;;
-}
-
+      setf.exp      FR_A2 = GR_05 // create A2
+      fnorm.s1      FR_NormX = f8
+      mov           GR_bias = 0xffff
+};;
+  
 { .mfi
-     getf.exp   log_GR_signexp_w = log_w
-     fclass.m.unc p12,p0 = f8, 0x3a       // Test for x neg norm, unorm, inf
-     shl        log_GR_index = log_GR_significand_f8,1            
+      setf.d        FR_A3 = GR_A3 // create A3
+      fcmp.eq.s1    p12,p0 = f1,f8 // is x equal to 1.0?
+      dep.z         GR_xorg = GR_xorg, 44, 19 // 0x3fefe00000000000 
+                                              // double precision memory
+                                              // representation of 255/256
 }
-;;
+{ .mib
+      add           GR_ad_2 = 0x30,GR_ad_1 // address of A5,A4
+      add           GR_ad_3 = 0x840,GR_ad_1 // address of ln(1/frcpa) lo parts
+(p8)  br.cond.spnt  log_positive_unorms
+};;
 
+log_core:
 { .mfi
-     ldfe       log_log2 = [log_AD_2],16   
-     fnma.s1    log_rp_q10 = log_half, log_wsq, log_w
-     shr.u     log_GR_index = log_GR_index,56
+      ldfpd         FR_A7,FR_A6 = [GR_ad_1],16
+      fclass.m      p10,p0 = f8,0x3A // is x < 0?
+      sub           GR_Nm1 = GR_Exp,GR_05 // unbiased_exponent_of_x - 1
 }
-{ .mfb
-     nop.m 999
-     fma.s1      log_w3      = log_wsq, log_w, f0
-(p6) br.cond.spnt L(LOG_ZERO_NEG)      // Branch if x=0
-;;
-}
- 
-
 { .mfi
-     and log_GR_exp_w = log_GR_exp_17_ones, log_GR_signexp_w
-     fma.s1      log_w4      = log_wsq, log_wsq, f0
-     nop.i 999
-}
-{ .mfb
-     shladd log_AD_2 = log_GR_index,4,log_AD_2
-     fma.s1     log_rsq     = log_r, log_r, f0                   
-(p12) br.cond.spnt L(LOG_ZERO_NEG)     // Branch if x<0
-;;
-}
+      ldfpd         FR_A5,FR_A4 = [GR_ad_2],16
+(p9)  fma.d.s0      f8 = f8,f1,f0 // set V-flag
+      sub           GR_N = GR_Exp,GR_bias // unbiased_exponent_of_x
+};;
 
 { .mfi
-     ldfe       log_T = [log_AD_2]
-     fma.s1    log_rp_p4   = log_P5, log_r, log_P4
-     nop.i 999
+      setf.sig      FR_N = GR_N // copy unbiased exponent of x to significand
+      fms.s1        FR_r = FR_RcpX,f8,f1 // range reduction for |x-1|>=1/256
+      extr.u        GR_Ind = GR_Sig,55,8 // get bits from 55 to 62 as index
 }
-{ .mfi
-     nop.m 999
-     fma.s1      log_rp_p32 = log_P3, log_r, log_P2
-     nop.i 999
-;;
-}
-
+{ .mib
+      sub           GR_x = GR_x, GR_xorg // get diff between x and 255/256
+      cmp.gtu       p6, p7 = 2, GR_Nm1 // p6 true if 0.5 <= x < 2
+(p9)  br.ret.spnt   b0 // exit for NaN, NaT and +Inf
+};;
 
 { .mfi
-     nop.m 999
-     fma.s1    log_rp_q7   = log_Q8, log_w, log_Q7
-     nop.i 999
-}
-{ .mfi
-     nop.m 999
-     fma.s1    log_rp_q65  = log_Q6, log_w, log_Q5
-     nop.i 999
-;;
+      ldfpd         FR_Ln2hi,FR_Ln2lo = [GR_ad_1],16
+      fclass.m      p11,p0 = f8,0x07 // is x = 0?
+      shladd        GR_ad_3 = GR_Ind,2,GR_ad_3 // address of Tlo
 }
+{ .mib
+      shladd        GR_ad_2 = GR_Ind,3,GR_ad_2 // address of Thi
+(p6)  cmp.leu       p6, p7 = GR_x, GR_dx       // 255/256 <= x <= 257/256
+(p10) br.cond.spnt  log_negatives // jump if x is negative
+};;
 
-//    p13 <== large w log
-//    p14 <== small w log
+// p6 is true if |x-1| < 1/256
+// p7 is true if |x-1| >= 1/256
 { .mfi
-(p8) cmp.ge.unc p13,p14 = log_GR_exp_w, log_GR_fff9
-     fma.s1    log_rp_q3   = log_Q4, log_w, log_Q3
-     nop.i 999
-;;
-}
+      ldfd          FR_Thi = [GR_ad_2]
+(p6)  fms.s1        FR_r = f8,f1,f1 // range reduction for |x-1|<1/256
+      nop.i         0
+};;
 
-//    p10 <== large w log10
-//    p11 <== small w log10
-{ .mfi
-(p7) cmp.ge.unc p10,p11 = log_GR_exp_w, log_GR_fff9
-     fcvt.xf   log_Nfloat = log_int_Nfloat
-     nop.i 999
+{ .mmi
+(p7)  ldfs          FR_Tlo = [GR_ad_3]
+      nop.m         0
+      nop.i         0
 }
+{ .mfb
+      nop.m         0
+(p12) fma.d.s0      f8 = f0,f0,f0
+(p12) br.ret.spnt   b0 // exit for +1.0
+};;
 
+.pred.rel "mutex",p6,p7
 { .mfi
-     nop.m 999
-     fma.s1    log_rp_q21  = log_Q2, log_w3, log_rp_q10
-     nop.i 999 ;;
+(p6)  mov           GR_NearOne = 1
+      fms.s1        FR_A32 = FR_A3,FR_r,FR_A2 // A3*r-A2
+(p7)  mov           GR_NearOne = 0
 }
+{ .mfb
+      ldfe          FR_InvLn10 = [GR_ad_1],16
+      fma.s1        FR_r2 = FR_r,FR_r,f0 // r^2
+(p11) br.cond.spnt  log_zeroes // jump if x is zero
+};;
 
 { .mfi
-     nop.m 999
-     fma.s1    log_rcube   = log_rsq, log_r, f0
-     nop.i 999
+      nop.m         0
+      fma.s1        FR_A6 = FR_A7,FR_r,FR_A6 // A7*r+A6
+      nop.i         0
 }
 { .mfi
-     nop.m 999
-     fma.s1    log_rp_p10   = log_rsq, log_P1, log_r
-     nop.i 999
-;;
-}
+(p7)  cmp.eq.unc    p9,p0 = r0,r0  // set p9 if |x-1| > 1/256
+      fma.s1        FR_A4 = FR_A5,FR_r,FR_A4 // A5*r+A4
+(p14) cmp.eq.unc    p8,p0 = 1,GR_NearOne // set p8 to 1 if it's log10
+                                         // and argument near 1.0
+};;
 
 { .mfi
-     nop.m 999
-     fcmp.eq.s0 p6,p0 = f8,f0         // Sets flag on +denormal input
-     nop.i 999
-}
-{ .mfi
-     nop.m 999
-     fma.s1     log_rp_p2   = log_rp_p4, log_rsq, log_rp_p32
-     nop.i 999
-;;
-}
-
+(p6)  getf.exp      GR_rexp = FR_r  // Get signexp of x-1
+(p7)  fcvt.xf       FR_N = FR_N
+(p8)  cmp.eq        p9,p6 = r0,r0        // Also set p9 and clear p6 if log10 
+                                         // and arg near 1
+};;
 
 { .mfi
-     nop.m 999
-     fma.s1        log_w6     = log_w3, log_w3, f0           
-     nop.i 999 
+      nop.m         0
+      fma.s1        FR_r4 = FR_r2,FR_r2,f0 // r^4
+      nop.i         0
 }
 { .mfi
-     nop.m 999
-     fma.s1        log_Qlo     = log_rp_q7, log_wsq, log_rp_q65           
-     nop.i 999 
-}
-;;
+      nop.m         0
+(p8)  fma.s1        FR_NxLn2pT = f0,f0,f0  // Clear NxLn2pT if log10 near 1
+      nop.i         0
+};;
 
 { .mfi
-     nop.m 999
-     fma.s1        log_Qhi     = log_rp_q3, log_w4, log_rp_q21
-     nop.i 999 ;;
+      nop.m         0
+      // (A3*r+A2)*r^2+r
+      fma.s1        FR_A321 = FR_A32,FR_r2,FR_r
+      mov           GR_mask = 0x1ffff
 }
-
-
 { .mfi
-     nop.m 999
-     fma.s1        log_T_plus_Nlog2 = log_Nfloat,log_log2, log_T    
-     nop.i 999 ;;
-}
+      nop.m         0
+      // (A7*r+A6)*r^2+(A5*r+A4)
+      fma.s1        FR_A4 = FR_A6,FR_r2,FR_A4
+      nop.i         0
+};;
 
 { .mfi
-     nop.m 999
-     fma.s1        log_r2P_r = log_rp_p2, log_rcube, log_rp_p10           
-     nop.i 999 ;;
+(p6)  and           GR_rexp = GR_rexp, GR_mask
+      // N*Ln2hi+Thi
+(p7)  fma.s1        FR_NxLn2hipThi = FR_N,FR_Ln2hi,FR_Thi
+      nop.i         0
 }
+{ .mfi
+      nop.m         0
+      // N*Ln2lo+Tlo
+(p7)  fma.s1        FR_NxLn2lopTlo = FR_N,FR_Ln2lo,FR_Tlo
+      nop.i         0
+};;
 
-
-//    small w, log   <== p14
 { .mfi
-     nop.m 999
-(p14) fma.d        f8       = log_Qlo, log_w6, log_Qhi          
-     nop.i 999
+(p6)  sub           GR_rexp = GR_rexp, GR_bias // unbiased exponent of x-1
+(p9)  fma.s1        f8 = FR_A4,FR_r4,FR_A321 // P(r) if |x-1| >= 1/256 or
+                                             // log10 and |x-1| < 1/256
+      nop.i         0
 }
 { .mfi
-     nop.m 999
-     fma.s1        log_Q       = log_Qlo, log_w6, log_Qhi          
-     nop.i 999 ;;
-}
-
+      nop.m         0
+      // (N*Ln2hi+Thi) + (N*Ln2lo+Tlo)
+(p7)  fma.s1        FR_NxLn2pT = FR_NxLn2hipThi,f1,FR_NxLn2lopTlo
+      nop.i         0
+};;
 
 { .mfi
-     nop.m 999
-(p10) fma.s1        log_log10_hi     = log_T_plus_Nlog2, log_inv_ln10,f0
-     nop.i 999  ;;
-}
+(p6)  cmp.gt.unc    p10, p6 = -40, GR_rexp // Test |x-1| < 2^-40
+      nop.f         0
+      nop.i         0
+};;
 
-//    large w, log   <== p13
-.pred.rel "mutex",p13,p10
 { .mfi
-      nop.m 999
-(p13) fadd.d        f8              = log_T_plus_Nlog2, log_r2P_r 
-      nop.i 999 
-}
-{ .mfi
-      nop.m 999
-(p10) fma.s1     log_log10_lo     = log_inv_ln10, log_r2P_r,f0
-      nop.i 999  ;;
-}
-
+      nop.m         0
+(p10) fma.d.s0      f8 = FR_A32,FR_r2,FR_r // log(x) if |x-1| < 2^-40
+      nop.i         0
+};;
 
-//    small w, log10 <== p11
+.pred.rel "mutex",p6,p9
 { .mfi
-      nop.m 999
-(p11) fma.d      f8 = log_inv_ln10,log_Q,f0                         
-      nop.i 999 ;;
-}
-
-//    large w, log10 <== p10
-{ .mfb
-      nop.m 999
-(p10) fma.d      f8                = log_log10_hi, f1, log_log10_lo 
-      br.ret.sptk     b0 
-;;
+      nop.m         0
+(p6)  fma.d.s0      f8 = FR_A4,FR_r4,FR_A321 // log(x) if 2^-40 <= |x-1| < 1/256
+      nop.i         0
 }
-
-L(LOG_DENORM):
 { .mfb
-     getf.exp   log_GR_signexp_f8 = log_NORM_f8 
-     nop.f 999
-     br.cond.sptk L(LOG_COMMON)
-}
-;;
-
-L(LOG_ZERO_NEG): 
-
-// qnan snan inf norm     unorm 0 -+
-// 0    0    0   0        0     1 11      0x7
-// 0    0    1   1        1     0 10      0x3a
-
-// Save x (f8) in f10
-{ .mfi
-     nop.m 999
-     fmerge.s f10 = f8,f8 
-     nop.i 999  ;;
-}
-
-// p8 p9  means  ln(+-0)  = -inf
-// p7 p10 means  log(+-0) = -inf
-
-//    p13 means  ln(-)
-//    p14 means  log(-)
-
+      nop.m         0
+(p9)  fma.d.s0      f8 = f8,FR_InvLn10,FR_NxLn2pT // result if |x-1| >= 1/256
+                                                  // or log10 and |x-1| < 1/256
+      br.ret.sptk   b0
+};;
 
-{ .mfi
-     nop.m 999
-     fmerge.ns   f6 = f1,f1            // Form -1.0
-     nop.i 999  ;;
-}
+.align 32
+log_positive_unorms:
+{ .mmf
+      getf.exp      GR_Exp = FR_NormX // recompute biased exponent
+      getf.d        GR_x = FR_NormX   // recompute double precision x
+      fcmp.eq.s1    p12,p0 = f1,FR_NormX // is x equal to 1.0?
+};;
 
-// p9  means  ln(+-0)  = -inf
-// p10 means  log(+-0) = -inf
-// Log(+-0) = -inf 
+{ .mfb
+      getf.sig      GR_Sig = FR_NormX // recompute significand
+      fcmp.eq.s0    p15, p0 = f8, f0  // set denormal flag
+      br.cond.sptk  log_core
+};;
 
+.align 32
+log_zeroes:
 { .mfi
-	nop.m 999
-(p8)  fclass.m.unc  p9,p0 = f10, 0x07           
-	nop.i 999
+      nop.m         0
+      fmerge.s      FR_X = f8,f8 // keep input argument for subsequent
+                                 // call of __libm_error_support#
+      nop.i         0
 }
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc  p10,p0 = f10, 0x07           
-	nop.i 999 ;;
-}
-
-
-// p13  ln(-)
-// p14  log(-)
+      nop.m         0
+      fms.s1        FR_tmp = f0,f0,f1 // -1.0
+      nop.i         0
+};;
 
-// Log(-inf, -normal, -unnormal) = QNAN indefinite
-{ .mfi
-	nop.m 999
-(p8)  fclass.m.unc  p13,p0 = f10, 0x3a           
-	nop.i 999 
-}
+.pred.rel "mutex",p13,p14
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc  p14,p0 = f10, 0x3a           
-	nop.i 999  ;;
+(p13) mov           GR_TAG = 2 // set libm error in case of log
+      frcpa.s0      f8,p0 = FR_tmp,f0 // log(+/-0) should be equal to -INF.
+                                      // We can get it using frcpa because it
+                                      // sets result to the IEEE-754 mandated
+                                      // quotient of FR_tmp/f0.
+                                      // As far as FR_tmp is -1 it'll be -INF
+      nop.i         0
 }
+{ .mib
+(p14) mov           GR_TAG = 8 // set libm error in case of log10
+      nop.i         0
+      br.cond.sptk  log_libm_err
+};;
 
-
-.pred.rel "mutex",p9,p10
-{ .mfi
-(p9)     mov        log_GR_tag = 2       
-(p9)    frcpa f8,p11 = f6,f0                   
-            nop.i 999
-}
+.align 32
+log_negatives:
 { .mfi
-(p10)    mov        log_GR_tag = 8       
-(p10)   frcpa f8,p12 = f6,f0                   
-            nop.i 999 ;;
-}
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      nop.i         0
+};;
 
 .pred.rel "mutex",p13,p14
 { .mfi
-(p13)    mov        log_GR_tag = 3       
-(p13)    frcpa f8,p11 = f0,f0                   
-            nop.i 999
-}
-{ .mfb
-(p14)    mov        log_GR_tag = 9       
-(p14)   frcpa f8,p12 = f0,f0                   
-        br.cond.sptk __libm_error_region ;; 
-}
-.endp log
-ASM_SIZE_DIRECTIVE(log)
-ASM_SIZE_DIRECTIVE(__ieee754_log)
-
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
+(p13) mov           GR_TAG = 3 // set libm error in case of log
+      frcpa.s0      f8,p0 = f0,f0 // log(negatives) should be equal to NaN.
+                                  // We can get it using frcpa because it
+                                  // sets result to the IEEE-754 mandated
+                                  // quotient of f0/f0 i.e. NaN.
+(p14) mov           GR_TAG = 9 // set libm error in case of log10
+};;
 
+.align 32
+log_libm_err:
+{ .mmi
+      alloc         r32 = ar.pfs,1,4,4,0
+      mov           GR_Parameter_TAG = GR_TAG
+      nop.i         0
+};;
+GLOBAL_IEEE754_END(log)
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y = -32,sp         // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS = ar.pfs             // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp = -64,sp                       // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP = gp                   // Save gp
 };;
 
-
-// (2)
 { .mmi
-        stfd [GR_Parameter_Y] = f1,16         // STORE Parameter 2 on stack
+        stfd [GR_Parameter_Y] = FR_Y,16       // STORE Parameter 2 on stack
         add GR_Parameter_X = 16,sp            // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0 = b0                   // Save b0
 };;
 
 .body
-// (3)
 { .mib
-        stfd [GR_Parameter_X] = f10                   // STORE Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
-        nop.b 0                             
+        stfd [GR_Parameter_X] = FR_X          // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = f8                    // STORE Parameter 3 on stack
+        stfd [GR_Parameter_Y] = FR_RESULT     // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#         // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
 
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 
-// (4)
 { .mmi
-        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfd  f8 = [GR_Parameter_RESULT]      // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                      // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                 // Restore return address
 };;
+
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        mov   gp = GR_SAVE_GP                 // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS            // Restore ar.pfs
+        br.ret.sptk     b0                    // Return
 };;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/e_log2.S b/sysdeps/ia64/fpu/e_log2.S
new file mode 100644
index 0000000000..660a9526b6
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_log2.S
@@ -0,0 +1,711 @@
+.file "log2.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//=================================================================
+// 09/11/00 Initial version 
+// 03/19/01 Added one polynomial coefficient, to improve accuracy
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/18/03 Reformatted T[255]
+//
+// API
+//=================================================================
+// double log2(double)
+//
+// Overview of operation
+//=================================================================
+// Background
+//
+// Implementation
+//
+// Let x = 2^l * m, where     m=1.b1 b2 ... b8 b9 ... b52
+//     y=frcpa(m),   r=m*y-1, f=b1 b2 .. b8 (table index)
+// j=0 if f<128; j=1 if f>=128
+// T is a table that stores log2(1/y) (in entries 1..255) rounded to
+//   double extended precision; f is used as an index; T[255]=0
+// 
+// If f=0 and b9=0, r is set to 2^{-8}* 0.b9 b10 ... b52 = m-1 (fractional part of m),
+//                  and 0 is used instead of T[0] 
+//                  (polynomial evaluation only, for m=1+r, 0<=r<2^{-9})
+// If f=255, r is set to (m-2)/2  (T[255]=0, and only polynomial evaluation is used
+//                                 for m=2(1-r'), 0<=r'<2^{-9})
+//
+// log2(x) is approximated as
+//     (l-j) + T[f] + (c1*r+c2*r^2+...+c7*r^7), if f>0
+// 
+
+
+// Special values 
+//=================================================================
+//  log2(0)=-inf, raises Divide by Zero
+//  log2(+inf)=inf
+//  log2(x)=NaN,  raises Invalid if x<0
+//
+
+
+// Registers used
+//==============================================================
+//   f6-f15, f32-f33
+//   r2-r3, r23-r30
+//   p6,p7,p8,p12
+//
+
+
+GR_SAVE_B0                    = r33
+GR_SAVE_PFS                   = r34
+GR_SAVE_GP                    = r35 // This reg. can safely be used 
+GR_SAVE_SP                    = r36
+
+GR_Parameter_X                = r37
+GR_Parameter_Y                = r38
+GR_Parameter_RESULT           = r39
+GR_Parameter_TAG              = r40
+
+FR_X             = f10
+FR_Y             = f1
+FR_RESULT        = f8
+
+
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+data8 0xbfd0000000000000, 0x3fc999999999999a //C_4, C_5
+data8 0xbfc5555555555555, 0x3fc2492492492492 //C_6, C_7
+data8 0xb8aa3b295c17f0bc, 0x00003fff  // C_1
+data8 0xaaaaaaaaaaaaaaab, 0x00003ffd  // C_3=1/3
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+data8 0xb8d8752172fed131, 0x00003ff6
+data8 0x8ae7f475764180a3, 0x00003ff8
+data8 0xe7f73862e72ee35d, 0x00003ff8
+data8 0xa2b25310c941a2f2, 0x00003ff9
+data8 0xcbb91d671abb2e85, 0x00003ff9
+data8 0xfac91e34daa50483, 0x00003ff9
+data8 0x9504a5042eb495c5, 0x00003ffa
+data8 0xa9c4a0bbb580ee02, 0x00003ffa
+data8 0xc19264dc8a5e3bf9, 0x00003ffa
+data8 0xd67aa6703ebf4a77, 0x00003ffa
+data8 0xee76cac6d6e08ce7, 0x00003ffa
+data8 0x81c3f7de5434ed04, 0x00003ffb
+data8 0x8c563033a3ce01e4, 0x00003ffb
+data8 0x9876e9f09a98661c, 0x00003ffb
+data8 0xa31e0ac9b2326ce2, 0x00003ffb
+data8 0xadcf09e1fd10e4a5, 0x00003ffb
+data8 0xb889f992cf03cdb6, 0x00003ffb
+data8 0xc34eec68d901a714, 0x00003ffb
+data8 0xce1df524e9909ed9, 0x00003ffb
+data8 0xd8f726bcb0b80ad0, 0x00003ffb
+data8 0xe3da945b878e27d1, 0x00003ffb
+data8 0xeec851633b76a320, 0x00003ffb
+data8 0xf82ea4bb6101421a, 0x00003ffb
+data8 0x8197ddd7736b2864, 0x00003ffc
+data8 0x871dad4f994253f0, 0x00003ffc
+data8 0x8ca8cae3e892d549, 0x00003ffc
+data8 0x916d6e1559a4b697, 0x00003ffc
+data8 0x97028118efabeb7d, 0x00003ffc
+data8 0x9bcfbce1592ad5d5, 0x00003ffc
+data8 0xa16ee95d0da54a91, 0x00003ffc
+data8 0xa644dcf3403fa5d0, 0x00003ffc
+data8 0xab1ee14ffd659064, 0x00003ffc
+data8 0xb0cd12faebcc6757, 0x00003ffc
+data8 0xb5affdf9b3b221e0, 0x00003ffc
+data8 0xba970fb307c6ade1, 0x00003ffc
+data8 0xbf824f3a9f3e7561, 0x00003ffc
+data8 0xc544c055fde99333, 0x00003ffc
+data8 0xca39266532bdf26c, 0x00003ffc
+data8 0xcf31d124b8fa2f56, 0x00003ffc
+data8 0xd42ec7f59017b6ab, 0x00003ffc
+data8 0xd930124bea9a2c67, 0x00003ffc
+data8 0xde35b7af70e4dab3, 0x00003ffc
+data8 0xe33fbfbb8533ef03, 0x00003ffc
+data8 0xe77625911a7dcef3, 0x00003ffc
+data8 0xec884bd689cc12e3, 0x00003ffc
+data8 0xf19eeabf9e99a40a, 0x00003ffc
+data8 0xf6ba0a35e3d88051, 0x00003ffc
+data8 0xfbd9b237f7b4192b, 0x00003ffc
+data8 0x80111d4a1ee0c79e, 0x00003ffd
+data8 0x82a523a5f875bbfc, 0x00003ffd
+data8 0x84ccecdc92cd0815, 0x00003ffd
+data8 0x87653369d92c057a, 0x00003ffd
+data8 0x89ffd1742da3aa21, 0x00003ffd
+data8 0x8c2d2227d053d9b6, 0x00003ffd
+data8 0x8e5c189793f7f798, 0x00003ffd
+data8 0x90fd0a20e72f3c96, 0x00003ffd
+data8 0x932fa937301e59ae, 0x00003ffd
+data8 0x95d5061a5f0f5f7f, 0x00003ffd
+data8 0x980b5a2ef10e7023, 0x00003ffd
+data8 0x9a4361c5514d3c27, 0x00003ffd
+data8 0x9c7d1f7d541313fd, 0x00003ffd
+data8 0x9f2b16040b500d04, 0x00003ffd
+data8 0xa168a0fa9db22c98, 0x00003ffd
+data8 0xa3a7eaa1f9116293, 0x00003ffd
+data8 0xa5e8f5b4072a3d44, 0x00003ffd
+data8 0xa82bc4f11a5e88aa, 0x00003ffd
+data8 0xaa705b2001db8317, 0x00003ffd
+data8 0xacb6bb0e1e0f8005, 0x00003ffd
+data8 0xaefee78f75707221, 0x00003ffd
+data8 0xb148e37ec994dd99, 0x00003ffd
+data8 0xb394b1bdaca0bc17, 0x00003ffd
+data8 0xb5e255349707e496, 0x00003ffd
+data8 0xb831d0d2fda791cc, 0x00003ffd
+data8 0xba83278f6838ab20, 0x00003ffd
+data8 0xbcd65c67881c7d47, 0x00003ffd
+data8 0xbeb3e0f21d72dc92, 0x00003ffd
+data8 0xc10a7a03457d35dc, 0x00003ffd
+data8 0xc362f9b6f51eddd3, 0x00003ffd
+data8 0xc5bd6326ebfce656, 0x00003ffd
+data8 0xc7a0b3d0637c8f97, 0x00003ffd
+data8 0xc9fe96af0df8e4b5, 0x00003ffd
+data8 0xcc5e6c214b4a2cd7, 0x00003ffd
+data8 0xce46199f374d29cf, 0x00003ffd
+data8 0xd0a978a14c0d9ebe, 0x00003ffd
+data8 0xd293fecafec7f9b5, 0x00003ffd
+data8 0xd4faf1f6f5cf32e6, 0x00003ffd
+data8 0xd6e8595abaad34d1, 0x00003ffd
+data8 0xd952eb7a8ffc1593, 0x00003ffd
+data8 0xdb433ccd805f171e, 0x00003ffd
+data8 0xddb178dc43e6bd84, 0x00003ffd
+data8 0xdfa4bcfb333342a4, 0x00003ffd
+data8 0xe19953741ccea015, 0x00003ffd
+data8 0xe40cee16a2ff21c5, 0x00003ffd
+data8 0xe6048470cdbde8ea, 0x00003ffd
+data8 0xe7fd7308d6895b14, 0x00003ffd
+data8 0xe9f7bbb6a1ff9f87, 0x00003ffd
+data8 0xec7280138809433d, 0x00003ffd
+data8 0xee6fda4365cd051f, 0x00003ffd
+data8 0xf06e94a122ff1f12, 0x00003ffd
+data8 0xf26eb1151441fce5, 0x00003ffd
+data8 0xf470318b88a77e2f, 0x00003ffd
+data8 0xf67317f4d4c8aa58, 0x00003ffd
+data8 0xf8f8b250a9c4cde6, 0x00003ffd
+data8 0xfafec54831f1a484, 0x00003ffd
+data8 0xfd06449bf3eaea1e, 0x00003ffd
+data8 0xff0f324ddb19ab67, 0x00003ffd
+data8 0x808cc8320a9acf15, 0x00003ffe
+data8 0x8192b0748f2cef06, 0x00003ffe
+data8 0x829952f5e6a24ee5, 0x00003ffe
+data8 0x83a0b0bfafe1424e, 0x00003ffe
+data8 0x8466b29f9c41caea, 0x00003ffe
+data8 0x856f5aae0881d857, 0x00003ffe
+data8 0x8678c0eae8ee8190, 0x00003ffe
+data8 0x8782e6685676b9d7, 0x00003ffe
+data8 0x888dcc3abc4554ec, 0x00003ffe
+data8 0x89997378de7b98b8, 0x00003ffe
+data8 0x8aa5dd3be1044279, 0x00003ffe
+data8 0x8b6facdfd0360ab8, 0x00003ffe
+data8 0x8c7d6db7169e0cdb, 0x00003ffe
+data8 0x8d8bf424d6e130b2, 0x00003ffe
+data8 0x8e575b506f409fa6, 0x00003ffe
+data8 0x8f673e418776492c, 0x00003ffe
+data8 0x9077e9ed700ef9ba, 0x00003ffe
+data8 0x9144ef1baec80b20, 0x00003ffe
+data8 0x9256fcdb537f035f, 0x00003ffe
+data8 0x9369d68d75e7e1d6, 0x00003ffe
+data8 0x943880613b8f9f1e, 0x00003ffe
+data8 0x954cc1d9e0d94206, 0x00003ffe
+data8 0xd3c70a37bdf7a294, 0x0000bffd
+data8 0xd19bb053fb0284ec, 0x0000bffd
+data8 0xcffa1a3b7dafb8bf, 0x0000bffd
+data8 0xcdcbe1e2776479ee, 0x0000bffd
+data8 0xcc282218b8bfdda2, 0x0000bffd
+data8 0xc9f703a9afcb38ac, 0x0000bffd
+data8 0xc851146ab89593c6, 0x0000bffd
+data8 0xc61d08265927a860, 0x0000bffd
+data8 0xc474e39705912d26, 0x0000bffd
+data8 0xc23de19ec30c6e3e, 0x0000bffd
+data8 0xc09381cc45db45b4, 0x0000bffd
+data8 0xbee82b4e025ff90c, 0x0000bffd
+data8 0xbcace101149788ec, 0x0000bffd
+data8 0xbaff46962ea47964, 0x0000bffd
+data8 0xb950b1be5e0c14a2, 0x0000bffd
+data8 0xb7110e6ce866f2bc, 0x0000bffd
+data8 0xb5602ccc2a81db52, 0x0000bffd
+data8 0xb3ae4ce740fc8ef1, 0x0000bffd
+data8 0xb1fb6d92c8240ccc, 0x0000bffd
+data8 0xafb609c09b244abc, 0x0000bffd
+data8 0xae00d1cfdeb43cfd, 0x0000bffd
+data8 0xac4a967a8c8c9bd0, 0x0000bffd
+data8 0xaa93568c249e6c52, 0x0000bffd
+data8 0xa8db10cdff375343, 0x0000bffd
+data8 0xa68e6fc5a42376e3, 0x0000bffd
+data8 0xa4d3c25e68dc57f2, 0x0000bffd
+data8 0xa3180b0c192a3816, 0x0000bffd
+data8 0xa15b488e7aa329a0, 0x0000bffd
+data8 0x9f9d79a30f0e1d5f, 0x0000bffd
+data8 0x9dde9d050ee7d4ac, 0x0000bffd
+data8 0x9c1eb16d63d7356c, 0x0000bffd
+data8 0x9a5db592a310c36a, 0x0000bffd
+data8 0x989ba82907a9016f, 0x0000bffd
+data8 0x96d887e26cd57b79, 0x0000bffd
+data8 0x9514536e481c3a4f, 0x0000bffd
+data8 0x934f0979a3715fc9, 0x0000bffd
+data8 0x9188a8af1742a9d5, 0x0000bffd
+data8 0x8fc12fb6c470995f, 0x0000bffd
+data8 0x8df89d364e34f8f1, 0x0000bffd
+data8 0x8c2eefd0d3f67dd6, 0x0000bffd
+data8 0x8a642626eb093d54, 0x0000bffd
+data8 0x88983ed6985bae58, 0x0000bffd
+data8 0x86cb387b4a0feec6, 0x0000bffd
+data8 0x84fd11add101024b, 0x0000bffd
+data8 0x83c856dd81804b78, 0x0000bffd
+data8 0x81f84c2c62afd6f1, 0x0000bffd
+data8 0x80271d3e4be5ea5a, 0x0000bffd
+data8 0xfca991447e7b485d, 0x0000bffc
+data8 0xf90299c904793a3c, 0x0000bffc
+data8 0xf559511d2dc1ed69, 0x0000bffc
+data8 0xf2e72afee9bd2aee, 0x0000bffc
+data8 0xef39ff1d8a40770e, 0x0000bffc
+data8 0xeb8a7a2311c935dc, 0x0000bffc
+data8 0xe7d8990dc620012f, 0x0000bffc
+data8 0xe560b1e3b86e44b6, 0x0000bffc
+data8 0xe1aadb38caee80c4, 0x0000bffc
+data8 0xddf2a051f81b76a4, 0x0000bffc
+data8 0xdb7678bafcaf4b5f, 0x0000bffc
+data8 0xd7ba3a8f0df19bfc, 0x0000bffc
+data8 0xd3fb8fdbdd5cebdb, 0x0000bffc
+data8 0xd17b191905c35652, 0x0000bffc
+data8 0xcdb85d29cefd7121, 0x0000bffc
+data8 0xc9f32c3c88221ef6, 0x0000bffc
+data8 0xc76e5741a95b5dae, 0x0000bffc
+data8 0xc3a506d80d38c718, 0x0000bffc
+data8 0xbfd938ccef8b68c1, 0x0000bffc
+data8 0xbd4ff63e82eef78c, 0x0000bffc
+data8 0xb97ffa2b563865bd, 0x0000bffc
+data8 0xb6f3eb3011eddcea, 0x0000bffc
+data8 0xb31fb7d64898b3e6, 0x0000bffc
+data8 0xb090d63a409e7880, 0x0000bffc
+data8 0xacb8623c7ffa4f39, 0x0000bffc
+data8 0xa8dd5c83d2e45246, 0x0000bffc
+data8 0xa649e998a8d91f2e, 0x0000bffc
+data8 0xa26a93fed6faa94f, 0x0000bffc
+data8 0x9fd43df079d0db1f, 0x0000bffc
+data8 0x9d3cbe69aecac4c2, 0x0000bffc
+data8 0x99574f13c570d0fb, 0x0000bffc
+data8 0x96bce349bf7ee6c7, 0x0000bffc
+data8 0x92d30c9b86cee18e, 0x0000bffc
+data8 0x9035adef17c5bd5c, 0x0000bffc
+data8 0x8c4765e8e8b5f251, 0x0000bffc
+data8 0x89a70da448316ffa, 0x0000bffc
+data8 0x85b44a24474af78a, 0x0000bffc
+data8 0x8310f17aab5adf70, 0x0000bffc
+data8 0x806c6388d0965f29, 0x0000bffc
+data8 0xf8e69092bf0c5ead, 0x0000bffb
+data8 0xf397608bfd2d90e6, 0x0000bffb
+data8 0xee45be24d0eedbc4, 0x0000bffb
+data8 0xe646af233db881e9, 0x0000bffb
+data8 0xe0eee4e1ce3d06fb, 0x0000bffb
+data8 0xdb94a049e6e87a4f, 0x0000bffb
+data8 0xd3888ef9a4249f5a, 0x0000bffb
+data8 0xce280e6fbac39194, 0x0000bffb
+data8 0xc8c50b72319ad574, 0x0000bffb
+data8 0xc0abcd39f41e329b, 0x0000bffb
+data8 0xbb4279cfa7f9667b, 0x0000bffb
+data8 0xb5d69bac77ec398a, 0x0000bffb
+data8 0xb068306bf20d6233, 0x0000bffb
+data8 0xa83dc1b019ddb6a8, 0x0000bffb
+data8 0xa2c8eb1886c2d024, 0x0000bffb
+data8 0x9d517ee93f8e16c0, 0x0000bffb
+data8 0x97d77aae659b92fb, 0x0000bffb
+data8 0x8f9b91da5736d415, 0x0000bffb
+data8 0x8a1b06b09b7fd1d1, 0x0000bffb
+data8 0x8497daca0a2e077a, 0x0000bffb
+data8 0xfe241745a453f10c, 0x0000bffa
+data8 0xf3132d6708d723c5, 0x0000bffa
+data8 0xe7fcf2e21a0e7d77, 0x0000bffa
+data8 0xd75198b04afb8da9, 0x0000bffa
+data8 0xcc2dfe1a4a8ca305, 0x0000bffa
+data8 0xc10500d63aa65882, 0x0000bffa
+data8 0xb5d69bac77ec398a, 0x0000bffa
+data8 0xaaa2c95dc66abcde, 0x0000bffa
+data8 0x9f6984a342d13101, 0x0000bffa
+data8 0x942ac82e5387ac51, 0x0000bffa
+data8 0x88e68ea899a0976c, 0x0000bffa
+data8 0xefebc4409ccf872e, 0x0000bff9
+data8 0xd947b0c6642ef69e, 0x0000bff9
+data8 0xc2987d51e043d407, 0x0000bff9
+data8 0xabde1eeee6bfd257, 0x0000bff9
+data8 0x95188a9917cf2e01, 0x0000bff9
+data8 0xfc8f6a777c1b7f1e, 0x0000bff8
+data8 0xced727635c59725c, 0x0000bff8
+data8 0xa108358a4c904615, 0x0000bff8
+data8 0xe644fcbeb3ac9c90, 0x0000bff7
+data8 0x8a4bd667bf08e7de, 0x0000bff7
+data8 0x0000000000000000 // T[255] Low
+data8 0x0000000000000000 // T[255] High
+LOCAL_OBJECT_END(T_table)
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(log2)
+
+{ .mfi
+  alloc r32=ar.pfs,1,4,4,0     
+  // y=frcpa(x)  
+  frcpa.s1 f6,p0=f1,f8
+  // will form significand of 1.5 (to test whether the index is 128 or above) 
+  mov r24=0xc
+}
+{.mfi
+  nop.m 0
+  // normalize x 
+  fma.s1 f7=f8,f1,f0
+  // r2 = pointer to C_1...C_6 followed by T_table
+  addl r2 = @ltoff(poly_coeffs), gp;;
+}
+{.mfi
+  // get significand
+  getf.sig r25=f8
+  // f8 denormal ?
+  fclass.m p8,p10=f8,0x9
+  // will form significand of 1.5 (to test whether the index is 128 or above) 
+  shl r24=r24,60
+}
+{.mfi
+  mov r26=0x804
+  nop.f 0
+  // r23=bias-1
+  mov r23=0xfffe;;
+}
+
+{.mmf
+  getf.exp r29=f8
+  // load start address for C_1...C_6 followed by T_table
+  ld8 r2=[r2]
+  // will continue only for positive normal/denormal numbers          
+  fclass.nm.unc p12,p7 = f8, 0x19 ;;
+}
+
+.pred.rel "mutex",p8,p10
+{.mfi
+  // denormal input, repeat get significand (after normalization)
+  (p8) getf.sig r25=f7
+  // x=1 ?
+  fcmp.eq.s0 p6,p0=f8,f1
+  // get T_index
+  (p10) shr.u r28=r25,63-8
+}
+{.mfi
+  // f32=0.5
+  setf.exp f32=r23
+  nop.f 0
+  // r27=bias
+  mov r27=0xffff;;
+}
+
+{.mmi
+  // denormal input, repeat get exponent (after normalization)
+  (p8) getf.exp r29=f7
+  mov r23=0xff
+  // r26=0x80400...0 (threshold for using polynomial approximation)
+  shl r26=r26,64-12;;
+}
+
+{.mfb
+  add r3=48,r2
+  // r=1-x*y
+  fms.s1 f6=f6,f8,f1
+  (p12) br.cond.spnt SPECIAL_LOG2
+}
+{.mfi
+  // load C_4, C_5
+  ldfpd f10,f11=[r2],16
+  nop.f 0
+  cmp.geu p12,p0=r25,r24;;
+}
+
+{.mmi
+  // load C_6, C_7
+  ldfpd f12,f13=[r2],16
+  // r27=bias-1 (if index >=128, will add exponent+1) 
+  (p12) mov r27=0xfffe
+  (p8) shr.u r28=r25,63-8;;
+}
+
+
+{.mfi
+  // load C_1
+  ldfe f14=[r2],32
+  fmerge.se f7=f1,f7
+  // if first 9 bits after leading 1 are all zero, then p8=1
+  cmp.ltu p8,p12=r25,r26
+}
+{.mfi
+  // load C_3
+  ldfe f15=[r3]
+  nop.f 0
+  // get T_index
+  and r28=r28,r23;;
+}
+{.mfi
+  // r29=exponent-bias
+  sub r29=r29,r27
+  // x=1, return 0
+  (p6) fma.d.s0 f8=f0,f0,f0
+  // get T address
+  shladd r2=r28,4,r2
+}
+{.mfb
+  // first 8 bits after leading 1 are all ones ?
+  cmp.eq p10,p0=r23,r28
+  // if first 8 bits after leading bit are 0, use polynomial approx. only
+  (p8) fms.s1 f6=f7,f1,f1
+  // x=1, return
+  (p6) br.ret.spnt b0;;
+}
+{.mfi
+  // r26=1
+  mov r26=1
+  // if first 8 bits after leading 1 are all ones, use polynomial approx. only
+  (p10) fms.s1 f6=f7,f32,f1
+  nop.i 0;;
+}
+
+.pred.rel "mutex",p8,p12
+{.mmf
+  // load T (unless first 9 bits after leading 1 are 0)
+  (p12) ldfe f33=[r2]
+  // f8=expon - bias 
+  setf.sig f8=r29
+  // set T=0 (if first 9 bits after leading 1 are 0)
+  (p8) fma.s1 f33=f0,f0,f0;;
+}
+
+{.mfi
+  nop.m 0
+  // P12=1-0.5*r
+  fnma.s1 f32=f32,f6,f1
+  // r26=2^{63}
+  shl r26=r26,63
+}
+{.mfi
+  nop.m 0
+  // r2=r*r
+  fma.s1 f7=f6,f6,f0
+  nop.i 0;;
+}
+{.mfi
+  // significand(x)=1 ?
+  cmp.eq p0,p6=r26,r25
+  // P67=C_6+C_7*r
+  fma.s1 f13=f13,f6,f12
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // P45=C_4+C_5*r
+  fma.s1 f10=f11,f6,f10
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // C_1*r
+  (p6) fma.s1 f14=f14,f6,f0
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // normalize additive term (l=exponent of x)
+  fcvt.xf f8=f8
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // P13=1-0.5*r+C_3*r^2
+  (p6) fma.s1 f15=f15,f7,f32
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // P47=P45+r2*P67
+  (p6) fma.s1 f13=f13,f7,f10
+  // if significand(x)=1, return exponent (l)
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // r3=r^3
+  (p6) fma.s1 f7=f7,f6,f0
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // add T+l
+  (p6) fma.s1 f8=f8,f1,f33
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // P17=P13+r3*P47
+  (p6) fma.s1 f13=f13,f7,f15
+  nop.i 0;;
+}
+
+{.mfb
+  nop.m 0
+  // result=T+l+(C_1*r)*P16
+  (p6) fma.d.s0 f8=f13,f14,f8
+  // return
+  br.ret.sptk b0;;
+}
+
+
+SPECIAL_LOG2:
+{.mfi 
+  nop.m 0
+  // x=+Infinity ?
+  fclass.m p7,p0=f8,0x21
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // x=+/-Zero ?
+  fclass.m p8,p0=f8,0x7
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // x=-Infinity, -normal, -denormal ?
+  fclass.m p6,p0=f8,0x3a
+  nop.i 0;;
+}
+{.mfb
+  nop.m 0
+  // log2(+Infinity)=+Infinity
+  nop.f 0
+  (p7) br.ret.spnt b0;;
+}
+{.mfi
+  (p8) mov GR_Parameter_TAG = 170                          
+  // log2(+/-0)=-infinity, raises Divide by Zero
+  // set f8=-0
+  (p8) fmerge.ns f8=f0,f8
+  nop.i 0;;
+}
+{.mfb
+  nop.m 0
+  (p8) frcpa.s0 f8,p0=f1,f8
+  (p8) br.cond.sptk __libm_error_region;;
+}
+{.mfb
+  (p6) mov GR_Parameter_TAG = 171 
+  // x<0: return NaN, raise Invalid
+  (p6) frcpa.s0 f8,p0=f0,f0
+  (p6) br.cond.sptk __libm_error_region;;
+}                          
+  
+
+{.mfb
+  nop.m 0
+  // Remaining cases: NaNs
+  fma.d.s0 f8=f8,f1,f0
+  br.ret.sptk b0;;
+}
+
+GLOBAL_LIBM_END(log2)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                       // Save b0 
+};;
+.body
+{ .mib
+        stfd [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack 
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address 
+	nop.b 0                                      
+}
+{ .mib
+        stfd [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support#         // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
diff --git a/sysdeps/ia64/fpu/e_log2f.S b/sysdeps/ia64/fpu/e_log2f.S
new file mode 100644
index 0000000000..17d710a951
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_log2f.S
@@ -0,0 +1,551 @@
+.file "log2f.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 09/11/00 Initial version 
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// float log2f(float)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x = 2^l * m, where     m=1.b1 b2 ... b8 b9 ... b52
+//     y=frcpa(m),   r=m*y-1, f=b1 b2 .. b8 (table index)
+// j=0 if f<128; j=1 if f>=128
+// T is a table that stores log2(1/y) (in entries 1..255) rounded to
+//   double extended precision; f is used as an index; T[255]=0
+// 
+// If f=0 and b9=0, r is set to 2^{-8}* 0.b9 b10 ... b52 = m-1 (fractional part of m),
+//                  and 0 is used instead of T[0] 
+//                  (polynomial evaluation only, for m=1+r, 0<=r<2^{-9})
+// If f=255, r is set to (m-2)/2  (T[255]=0, and only polynomial evaluation is used
+//                                 for m=2(1-r'), 0<=r'<2^{-9})
+//
+// log2f(x) is approximated as
+//     (l-j) + T[f] + (c1*r+c2*r^2+...+c6*r^6), if f>0
+// 
+
+
+// Special values 
+//==============================================================
+//  log2f(0)=-inf, raises Divide by Zero
+//  log2f(+inf)=inf
+//  log2f(x)=NaN,  raises Invalid if x<0
+//
+
+
+// Registers used
+//==============================================================
+//   f6-f14
+//   r2-r3, r23-r30
+//   p6,p7,p8,p12
+//
+
+
+GR_SAVE_B0                    = r33
+GR_SAVE_PFS                   = r34
+GR_SAVE_GP                    = r35 // This reg. can safely be used 
+GR_SAVE_SP                    = r36
+
+GR_Parameter_X                = r37
+GR_Parameter_Y                = r38
+GR_Parameter_RESULT           = r39
+GR_Parameter_TAG              = r40
+
+FR_X             = f10
+FR_Y             = f1
+FR_RESULT        = f8
+
+
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+data8 0x3fdec709dc3a03fd, 0xbfd71547652b82fe //C_3 and C_4
+data8 0xb8aa3b295c17f0bc, 0x00003fff  // C_1
+data8 0xb8aa3b295c17f0bc, 0x0000bffe  // C_2
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+LOCAL_OBJECT_START(T_table)
+
+data8 0x3f671b0ea42e5fda, 0x3f815cfe8eaec830
+data8 0x3f8cfee70c5ce5dc, 0x3f94564a62192834
+data8 0x3f997723ace35766, 0x3f9f5923c69b54a1
+data8 0x3fa2a094a085d693, 0x3fa538941776b01e
+data8 0x3fa8324c9b914bc7, 0x3faacf54ce07d7e9
+data8 0x3fadced958dadc12, 0x3fb0387efbca869e
+data8 0x3fb18ac6067479c0, 0x3fb30edd3e13530d
+data8 0x3fb463c15936464e, 0x3fb5b9e13c3fa21d
+data8 0x3fb7113f3259e07a, 0x3fb869dd8d1b2035
+data8 0x3fb9c3bea49d3214, 0x3fbb1ee4d7961701
+data8 0x3fbc7b528b70f1c5, 0x3fbdd90a2c676ed4
+data8 0x3fbf05d4976c2028, 0x3fc032fbbaee6d65
+data8 0x3fc0e3b5a9f3284a, 0x3fc195195c7d125b
+data8 0x3fc22dadc2ab3497, 0x3fc2e050231df57d
+data8 0x3fc379f79c2b255b, 0x3fc42ddd2ba1b4a9
+data8 0x3fc4c89b9e6807f5, 0x3fc563dc29ffacb2
+data8 0x3fc619a25f5d798d, 0x3fc6b5ffbf367644
+data8 0x3fc752e1f660f8d6, 0x3fc7f049e753e7cf
+data8 0x3fc8a8980abfbd32, 0x3fc94724cca657be
+data8 0x3fc9e63a24971f46, 0x3fca85d8feb202f7
+data8 0x3fcb2602497d5346, 0x3fcbc6b6f5ee1c9b
+data8 0x3fcc67f7f770a67e, 0x3fcceec4b2234fba
+data8 0x3fcd91097ad13982, 0x3fce33dd57f3d335
+data8 0x3fced74146bc7b10, 0x3fcf7b3646fef683
+data8 0x3fd00223a943dc19, 0x3fd054a474bf0eb7
+data8 0x3fd0999d9b9259a1, 0x3fd0eca66d3b2581
+data8 0x3fd13ffa2e85b475, 0x3fd185a444fa0a7b
+data8 0x3fd1cb8312f27eff, 0x3fd21fa1441ce5e8
+data8 0x3fd265f526e603cb, 0x3fd2baa0c34be1ec
+data8 0x3fd3016b45de21ce, 0x3fd3486c38aa29a8
+data8 0x3fd38fa3efaa8262, 0x3fd3e562c0816a02
+data8 0x3fd42d141f53b646, 0x3fd474fd543f222c
+data8 0x3fd4bd1eb680e548, 0x3fd505789e234bd1
+data8 0x3fd54e0b64003b70, 0x3fd596d761c3c1f0
+data8 0x3fd5dfdcf1eeae0e, 0x3fd6291c6fd9329c
+data8 0x3fd6729637b59418, 0x3fd6bc4aa692e0fd
+data8 0x3fd7063a1a5fb4f2, 0x3fd75064f1ed0715
+data8 0x3fd79acb8cf10390, 0x3fd7d67c1e43ae5c
+data8 0x3fd8214f4068afa7, 0x3fd86c5f36dea3dc
+data8 0x3fd8b7ac64dd7f9d, 0x3fd8f4167a0c6f92
+data8 0x3fd93fd2d5e1bf1d, 0x3fd98bcd84296946
+data8 0x3fd9c8c333e6e9a5, 0x3fda152f142981b4
+data8 0x3fda527fd95fd8ff, 0x3fda9f5e3edeb9e6
+data8 0x3fdadd0b2b5755a7, 0x3fdb2a5d6f51ff83
+data8 0x3fdb686799b00be3, 0x3fdbb62f1b887cd8
+data8 0x3fdbf4979f666668, 0x3fdc332a6e8399d4
+data8 0x3fdc819dc2d45fe4, 0x3fdcc0908e19b7bd
+data8 0x3fdcffae611ad12b, 0x3fdd3ef776d43ff4
+data8 0x3fdd8e5002710128, 0x3fddcdfb486cb9a1
+data8 0x3fde0dd294245fe4, 0x3fde4dd622a28840
+data8 0x3fde8e06317114f0, 0x3fdece62fe9a9915
+data8 0x3fdf1f164a15389a, 0x3fdf5fd8a9063e35
+data8 0x3fdfa0c8937e7d5d, 0x3fdfe1e649bb6335
+data8 0x3fe011990641535a, 0x3fe032560e91e59e
+data8 0x3fe0532a5ebcd44a, 0x3fe0741617f5fc28
+data8 0x3fe08cd653f38839, 0x3fe0adeb55c1103b
+data8 0x3fe0cf181d5d1dd0, 0x3fe0f05ccd0aced7
+data8 0x3fe111b9875788ab, 0x3fe1332e6f1bcf73
+data8 0x3fe154bba77c2088, 0x3fe16df59bfa06c1
+data8 0x3fe18fadb6e2d3c2, 0x3fe1b17e849adc26
+data8 0x3fe1caeb6a0de814, 0x3fe1ece7c830eec9
+data8 0x3fe20efd3dae01df, 0x3fe2289de375d901
+data8 0x3fe24adf9b6a6fe0, 0x3fe26d3ad1aebcfc
+data8 0x3fe287100c2771f4, 0x3fe2a9983b3c1b28
+data8 0xbfda78e146f7bef4, 0xbfda33760a7f6051
+data8 0xbfd9ff43476fb5f7, 0xbfd9b97c3c4eec8f
+data8 0xbfd98504431717fc, 0xbfd93ee07535f967
+data8 0xbfd90a228d5712b2, 0xbfd8c3a104cb24f5
+data8 0xbfd88e9c72e0b226, 0xbfd847bc33d8618e
+data8 0xbfd812703988bb69, 0xbfd7dd0569c04bff
+data8 0xbfd7959c202292f1, 0xbfd75fe8d2c5d48f
+data8 0xbfd72a1637cbc183, 0xbfd6e221cd9d0cde
+data8 0xbfd6ac059985503b, 0xbfd675c99ce81f92
+data8 0xbfd63f6db2590482, 0xbfd5f6c138136489
+data8 0xbfd5c01a39fbd688, 0xbfd58952cf519193
+data8 0xbfd5526ad18493ce, 0xbfd51b6219bfe6ea
+data8 0xbfd4d1cdf8b4846f, 0xbfd49a784bcd1b8b
+data8 0xbfd4630161832547, 0xbfd42b6911cf5465
+data8 0xbfd3f3af3461e1c4, 0xbfd3bbd3a0a1dcfb
+data8 0xbfd383d62dac7ae7, 0xbfd34bb6b2546218
+data8 0xbfd313750520f520, 0xbfd2db10fc4d9aaf
+data8 0xbfd2a28a6dc90387, 0xbfd269e12f346e2c
+data8 0xbfd2311515e2e855, 0xbfd1f825f6d88e13
+data8 0xbfd1bf13a6c9c69f, 0xbfd185ddfa1a7ed0
+data8 0xbfd14c84c4dd6128, 0xbfd11307dad30b76
+data8 0xbfd0d9670f6941fe, 0xbfd09fa235ba2020
+data8 0xbfd0790adbb03009, 0xbfd03f09858c55fb
+data8 0xbfd004e3a7c97cbd, 0xbfcf9532288fcf69
+data8 0xbfcf205339208f27, 0xbfceab2a23a5b83e
+data8 0xbfce5ce55fdd37a5, 0xbfcde73fe3b1480f
+data8 0xbfcd714f44623927, 0xbfccfb1321b8c400
+data8 0xbfccac163c770dc9, 0xbfcc355b67195dd0
+data8 0xbfcbbe540a3f036f, 0xbfcb6ecf175f95e9
+data8 0xbfcaf74751e1be33, 0xbfca7f71fb7bab9d
+data8 0xbfca2f632320b86b, 0xbfc9b70ba539dfae
+data8 0xbfc93e6587910444, 0xbfc8edcae8352b6c
+data8 0xbfc874a0db01a719, 0xbfc7fb27199df16d
+data8 0xbfc7a9fec7d05ddf, 0xbfc72fff456ac70d
+data8 0xbfc6de7d66023dbc, 0xbfc663f6fac91316
+data8 0xbfc6121ac74813cf, 0xbfc5970c478fff4a
+data8 0xbfc51bab907a5c8a, 0xbfc4c93d33151b24
+data8 0xbfc44d527fdadf55, 0xbfc3fa87be0f3a1b
+data8 0xbfc3a797cd35d959, 0xbfc32ae9e278ae1a
+data8 0xbfc2d79c6937efdd, 0xbfc25a619370d9dc
+data8 0xbfc206b5bde2f8b8, 0xbfc188ecbd1d16be
+data8 0xbfc134e1b489062e, 0xbfc0b6894488e95f
+data8 0xbfc0621e2f556b5c, 0xbfc00d8c711a12cc
+data8 0xbfbf1cd21257e18c, 0xbfbe72ec117fa5b2
+data8 0xbfbdc8b7c49a1ddb, 0xbfbcc8d5e467b710
+data8 0xbfbc1ddc9c39c7a1, 0xbfbb7294093cdd0f
+data8 0xbfba7111df348494, 0xbfb9c501cdf75872
+data8 0xbfb918a16e46335b, 0xbfb81579a73e83c6
+data8 0xbfb7684f39f4ff2d, 0xbfb6bad3758efd87
+data8 0xbfb60d060d7e41ac, 0xbfb507b836033bb7
+data8 0xbfb4591d6310d85a, 0xbfb3aa2fdd27f1c3
+data8 0xbfb2faef55ccb372, 0xbfb1f3723b4ae6db
+data8 0xbfb14360d6136ffa, 0xbfb092fb594145c1
+data8 0xbfafc482e8b48a7e, 0xbfae6265ace11ae4
+data8 0xbfacff9e5c4341d0, 0xbfaaea3316095f72
+data8 0xbfa985bfc3495194, 0xbfa820a01ac754cb
+data8 0xbfa6bad3758efd87, 0xbfa554592bb8cd58
+data8 0xbfa3ed3094685a26, 0xbfa2855905ca70f6
+data8 0xbfa11cd1d5133413, 0xbf9dfd78881399f1
+data8 0xbf9b28f618cc85df, 0xbf98530faa3c087b
+data8 0xbf957bc3dddcd7fa, 0xbf92a3115322f9e6
+data8 0xbf8f91ed4eef8370, 0xbf89dae4ec6b8b2e
+data8 0xbf842106b1499209, 0xbf7cc89f97d67594
+data8 0xbf71497accf7e11d, 0x0000000000000000
+LOCAL_OBJECT_END(T_table)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(log2f)
+
+{ .mfi
+  alloc r32=ar.pfs,1,4,4,0     
+  // y=frcpa(x)  
+  frcpa.s1 f6,p0=f1,f8
+  // will form significand of 1.5 (to test whether the index is 128 or above) 
+  mov r24=0xc
+}
+{.mfi
+  nop.m 0
+  // normalize x 
+  fma.s1 f7=f8,f1,f0
+  // r2 = pointer to C_1...C_6 followed by T_table
+  addl r2 = @ltoff(poly_coeffs), gp;;
+}
+{.mfi
+  // get significand
+  getf.sig r25=f8
+  // f8 denormal ?
+  fclass.m p8,p10=f8,0x9
+  // will form significand of 1.5 (to test whether the index is 128 or above) 
+  shl r24=r24,60
+}
+{.mfi
+  mov r26=0x804
+  nop.f 0
+  // r23=bias-1
+  mov r23=0xfffe;;
+}
+
+{.mmf
+  getf.exp r29=f8
+  // load start address for C_1...C_6 followed by T_table
+  ld8 r2=[r2]
+  // will continue only for positive normal/denormal numbers          
+  fclass.nm.unc p12,p7 = f8, 0x19 ;;
+}
+
+.pred.rel "mutex",p8,p10
+{.mfi
+  // denormal input, repeat get significand (after normalization)
+  (p8) getf.sig r25=f7
+  // x=1 ?
+  fcmp.eq.s0 p6,p0=f8,f1
+  // get T_index
+  (p10) shr.u r28=r25,63-8
+}
+{.mfi
+  // f12=0.5
+  setf.exp f12=r23
+  nop.f 0
+  // r27=bias
+  mov r27=0xffff;;
+}
+
+{.mfb
+  // denormal input, repeat get exponent (after normalization)
+  (p8) getf.exp r29=f7
+  nop.f 0
+  (p12) br.cond.spnt SPECIAL_log2f
+}
+{.mfi
+  cmp.geu p12,p0=r25,r24
+  nop.f 0
+  mov r23=0xff;;
+}
+
+{.mfi
+  add r3=32,r2
+  // r=1-x*y
+  fms.s1 f6=f6,f8,f1
+  // r26=0x80400...0 (threshold for using polynomial approximation)
+  shl r26=r26,64-12
+}
+{.mfi
+  // load C_3, C_4
+  ldfpd f10,f11=[r2],16
+  nop.f 0
+  // r27=bias-1 (if index >=128, will add exponent+1) 
+  (p12) mov r27=0xfffe;;
+}
+
+{.mfi
+  // load C_1
+  ldfe f14=[r2],32
+  // x=1, return 0
+  (p6) fma.s.s0 f8=f0,f0,f0
+  (p8) shr.u r28=r25,63-8
+}
+{.mib
+  // load C_2
+  ldfe f13=[r3]
+  // r29=exponent-bias
+  sub r29=r29,r27
+  // x=1, return
+  (p6) br.ret.spnt b0;;
+}
+
+
+{.mfi
+  // get T_index
+  and r28=r28,r23
+  fmerge.se f7=f1,f7
+  // if first 9 bits after leading 1 are all zero, then p8=1
+  cmp.ltu p8,p12=r25,r26;;
+}
+{.mfi
+  // f8=expon - bias 
+  setf.sig f8=r29
+  nop.f 0
+  // get T address
+  shladd r2=r28,3,r2
+}
+{.mfi
+  // first 8 bits after leading 1 are all ones ?
+  cmp.eq p10,p0=r23,r28
+  // if first 8 bits after leading bit are 0, use polynomial approx. only
+  (p8) fms.s1 f6=f7,f1,f1
+  nop.i 0;;
+}
+{.mfi
+  //r26=1
+  mov r26=1
+  // if first 8 bits after leading 1 are all ones, use polynomial approx. only
+  (p10) fms.s1 f6=f7,f12,f1
+  nop.i 0;;
+}
+
+.pred.rel "mutex",p8,p12
+{.mmf
+  // load T (unless first 9 bits after leading 1 are 0)
+  (p12) ldfd f12=[r2]
+  nop.m 0
+  // set T=0 (if first 9 bits after leading 1 are 0)
+  (p8) fma.s1 f12=f0,f0,f0;;
+}
+
+{.mfi
+  nop.m 0
+  // P34=C_3+C_4*r
+  fma.s1 f10=f11,f6,f10
+  // r26=2^{63}
+  shl r26=r26,63
+}
+{.mfi
+  nop.m 0
+  // r2=r*r
+  fma.s1 f11=f6,f6,f0
+  nop.i 0;;
+}
+{.mfi
+  // significand of x is 1 ?
+  cmp.eq p0,p6=r25,r26
+  // P12=C_1+C_2*r
+  fma.s1 f14=f13,f6,f14
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // normalize additive term (l=exponent of x)
+  fcvt.xf f8=f8
+  // if significand(x)=1, return exponent (l)
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // add T+l
+  (p6) fma.s1 f8=f8,f1,f12
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // P14=P12+r2*P34
+  (p6) fma.s1 f13=f10,f11,f14
+  nop.i 0;;
+}
+
+{.mfb
+  nop.m 0
+  // result=T+l+r*P14
+  (p6) fma.s.s0 f8=f13,f6,f8
+  // return
+  br.ret.sptk b0;;
+}
+
+
+SPECIAL_log2f:
+{.mfi 
+  nop.m 0
+  // x=+Infinity ?
+  fclass.m p7,p0=f8,0x21
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // x=+/-Zero ?
+  fclass.m p8,p0=f8,0x7
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // x=-Infinity, -normal, -denormal ?
+  fclass.m p6,p0=f8,0x3a
+  nop.i 0;;
+}
+{.mfb
+  nop.m 0
+  // log2f(+Infinity)=+Infinity
+  nop.f 0
+  (p7) br.ret.spnt b0;;
+}
+{.mfi
+  (p8) mov GR_Parameter_TAG = 172                          
+  // log2f(+/-0)=-infinity, raises Divide by Zero
+  // set f8=-0
+  (p8) fmerge.ns f8=f0,f8
+  nop.i 0;;
+}
+{.mfb
+  nop.m 0
+  (p8) frcpa.s0 f8,p0=f1,f8
+  (p8) br.cond.sptk __libm_error_region;;
+}
+{.mfb
+  (p6) mov GR_Parameter_TAG = 173 
+  // x<0: return NaN, raise Invalid
+  (p6) frcpa.s0 f8,p0=f0,f0
+  (p6) br.cond.sptk __libm_error_region;;
+}                          
+  
+
+{.mfb
+  nop.m 0
+  // Remaining cases: NaNs
+  fma.s.s0 f8=f8,f1,f0
+  br.ret.sptk b0;;
+}
+
+GLOBAL_LIBM_END(log2f)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfs [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                       // Save b0 
+};;
+.body
+{ .mib
+        stfs [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack 
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address 
+	nop.b 0                                      
+}
+{ .mib
+        stfs [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support#         // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
+
+
diff --git a/sysdeps/ia64/fpu/e_log2l.S b/sysdeps/ia64/fpu/e_log2l.S
new file mode 100644
index 0000000000..b3fe63f182
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_log2l.S
@@ -0,0 +1,817 @@
+.file "log2l.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 09/25/00 Initial version 
+// 11/22/00 Fixed accuracy bug (for mantissas near 1, 2)
+// 12/07/00 Fixed C_1l constant, eliminated rounding errors in 
+//          reduced argument (x*frcpa(x)-1)
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// long double log2l(long double)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+// Implementation
+//
+// Let x = 2^l * m, where     m=1.b1 b2 ... b8 b9 ... b52
+//     y=frcpa(m),   r=m*y-1, f=b1 b2 .. b8 
+// T_hi is a table that stores the 24 most significant bits of log2(1/y) 
+// (in entries 1..255) in single precision format
+// T_low is a table that stores (log2(1/y)-T_high), rounded to double
+// precision 
+//
+// f is used as an index; T_high[255]=T_low[255]=0
+// 
+// If f=0 and b9=0, r is set to 2^{-8}* 0.b9 b10 ... b52 = m-1 (fractional part of m),
+//                  and 0 is used instead of T_high[0], T_low[0] 
+//                  (polynomial evaluation only, for m=1+r, 0<=r<2^{-9})
+// If f=255, r is set to (m-2)/2  (T[255]=0, and only polynomial evaluation is used
+//                                 for m=2(1-r'), 0<=r'<2^{-9})
+//
+// If 2^{-9}<=m<2-2^{-8} or (input not near 1), let C1r=(2^{16}+C1*r)-2^{16}
+//                       and let E=((RN(m*y)-1)-r)+(m*y-RN(m*y))
+// Else let C1r=C1*r (rounded to 64 significant bits)  and let  E=0
+//
+// Let D=C1*r-C1r
+//
+//
+// log2l(x) is approximated as
+//     (l+T_high[f]+C1r) + (D+r*(c1+c2*r+c3*r^2...+c8*r^7)+(T_low[f]+C_1*E))
+// 
+
+
+// Special values 
+//==============================================================
+//  log2l(0)=-inf, raises Divide by Zero
+//  log2l(+inf)=inf
+//  log2l(x)=NaN,  raises Invalid if x<0
+//
+
+
+// Registers used
+//==============================================================
+//   f6-f15, f32-f36
+//   r2-r3, r23-r23
+//   p6,p7,p8,p12
+//
+
+
+GR_SAVE_B0                    = r33
+GR_SAVE_PFS                   = r34
+GR_SAVE_GP                    = r35 // This reg. can safely be used 
+GR_SAVE_SP                    = r36
+
+GR_Parameter_X                = r37
+GR_Parameter_Y                = r38
+GR_Parameter_RESULT           = r39
+GR_Parameter_TAG              = r40
+
+FR_X             = f10
+FR_Y             = f1
+FR_RESULT        = f8
+
+
+
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(poly_coeffs)
+
+data8 0xb8aa3b295c17f0bc, 0x00003fff  // C_1
+data8 0x3fca61762a7aded9, 0xbfc71547652b82fe // C_7, C_8
+data8 0x3fd2776c50ef9bfe, 0xbfcec709dc3a03fd // C_5, C_6 
+data8 0x3fdec709dc3a03fd, 0xbfd71547652b82fe  // C_3, C_4
+//data8 0xd871319ff0342580, 0x0000bfbd	// C_1l (low part of C1)
+data8 0x82f0025f2dc582ee, 0x0000bfbe   // C_1l (low part of C1)
+data8 0xb8aa3b295c17f0bc, 0x0000bffe  // C_2
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+
+
+LOCAL_OBJECT_START(T_table)
+
+data4 0x3b38d875, 0x3c0ae7f4, 0x3c67f738, 0x3ca2b253
+data4 0x3ccbb91d, 0x3cfac91e, 0x3d1504a5, 0x3d29c4a0
+data4 0x3d419264, 0x3d567aa6, 0x3d6e76ca, 0x3d81c3f7
+data4 0x3d8c5630, 0x3d9876e9, 0x3da31e0a, 0x3dadcf09
+data4 0x3db889f9, 0x3dc34eec, 0x3dce1df5, 0x3dd8f726
+data4 0x3de3da94, 0x3deec851, 0x3df82ea4, 0x3e0197dd
+data4 0x3e071dad, 0x3e0ca8ca, 0x3e116d6e, 0x3e170281
+data4 0x3e1bcfbc, 0x3e216ee9, 0x3e2644dc, 0x3e2b1ee1
+data4 0x3e30cd12, 0x3e35affd, 0x3e3a970f, 0x3e3f824f
+data4 0x3e4544c0, 0x3e4a3926, 0x3e4f31d1, 0x3e542ec7
+data4 0x3e593012, 0x3e5e35b7, 0x3e633fbf, 0x3e677625
+data4 0x3e6c884b, 0x3e719eea, 0x3e76ba0a, 0x3e7bd9b2
+data4 0x3e80111d, 0x3e82a523, 0x3e84ccec, 0x3e876533
+data4 0x3e89ffd1, 0x3e8c2d22, 0x3e8e5c18, 0x3e90fd0a
+data4 0x3e932fa9, 0x3e95d506, 0x3e980b5a, 0x3e9a4361
+data4 0x3e9c7d1f, 0x3e9f2b16, 0x3ea168a0, 0x3ea3a7ea
+data4 0x3ea5e8f5, 0x3ea82bc4, 0x3eaa705b, 0x3eacb6bb
+data4 0x3eaefee7, 0x3eb148e3, 0x3eb394b1, 0x3eb5e255
+data4 0x3eb831d0, 0x3eba8327, 0x3ebcd65c, 0x3ebeb3e0
+data4 0x3ec10a7a, 0x3ec362f9, 0x3ec5bd63, 0x3ec7a0b3
+data4 0x3ec9fe96, 0x3ecc5e6c, 0x3ece4619, 0x3ed0a978
+data4 0x3ed293fe, 0x3ed4faf1, 0x3ed6e859, 0x3ed952eb
+data4 0x3edb433c, 0x3eddb178, 0x3edfa4bc, 0x3ee19953
+data4 0x3ee40cee, 0x3ee60484, 0x3ee7fd73, 0x3ee9f7bb
+data4 0x3eec7280, 0x3eee6fda, 0x3ef06e94, 0x3ef26eb1
+data4 0x3ef47031, 0x3ef67317, 0x3ef8f8b2, 0x3efafec5
+data4 0x3efd0644, 0x3eff0f32, 0x3f008cc8, 0x3f0192b0
+data4 0x3f029952, 0x3f03a0b0, 0x3f0466b2, 0x3f056f5a
+data4 0x3f0678c0, 0x3f0782e6, 0x3f088dcc, 0x3f099973
+data4 0x3f0aa5dd, 0x3f0b6fac, 0x3f0c7d6d, 0x3f0d8bf4
+data4 0x3f0e575b, 0x3f0f673e, 0x3f1077e9, 0x3f1144ef
+data4 0x3f1256fc, 0x3f1369d6, 0x3f143880, 0x3f154cc1
+data4 0x3f161c7a, 0x3f173227, 0x3f1802f2, 0x3f191a0f
+data4 0x3f19ebee, 0x3f1b047e, 0x3f1bd775, 0x3f1cf17b
+data4 0x3f1dc58e, 0x3f1ee10f, 0x3f1fb63f, 0x3f208bea
+data4 0x3f21a98f, 0x3f22805c, 0x3f2357a7, 0x3f247778
+data4 0x3f254fe9, 0x3f2628d9, 0x3f270249, 0x3f2824fb
+data4 0x3f28ff97, 0x3f29dab4, 0x3f2ab654, 0x3f2b9277
+data4 0x3f2cb8c8, 0x3f2d961e, 0x3f2e73fa, 0x3f2f525b
+data4 0x3f303143, 0x3f3110b1, 0x3f31f0a7, 0x3f32d125
+data4 0x3f33b22b, 0x3f3493bc, 0x3f3575d6, 0x3f36587b
+data4 0x3f373bab, 0x3f381f68, 0x3f3903b1, 0x3f39e888
+data4 0x3f3acdec, 0x3f3bb3e0, 0x3f3c9a63, 0x3f3d8177
+data4 0x3f3e1bd4, 0x3f3f03d9, 0x3f3fec71, 0x3f40d59b
+data4 0x3f41bf59, 0x3f42a9ab, 0x3f434635, 0x3f443180
+data4 0x3f451d61, 0x3f4609d9, 0x3f46a7d3, 0x3f479549
+data4 0x3f488357, 0x3f492261, 0x3f4a1171, 0x3f4b011c
+data4 0x3f4ba139, 0x3f4c91e8, 0x3f4d8334, 0x3f4e246a
+data4 0x3f4f16be, 0x3f5009b1, 0x3f50ac02, 0x3f51a001
+data4 0x3f524305, 0x3f533812, 0x3f53dbca, 0x3f54d1e7
+data4 0x3f55c8a8, 0x3f566d85, 0x3f57655b, 0x3f580af0
+data4 0x3f58b0d0, 0x3f59aa2c, 0x3f5a50c7, 0x3f5b4b3c
+data4 0x3f5bf294, 0x3f5cee26, 0x3f5d963c, 0x3f5e92ed
+data4 0x3f5f3bc3, 0x3f5fe4e7, 0x3f60e32d, 0x3f618d13
+data4 0x3f623748, 0x3f63372a, 0x3f63e223, 0x3f648d6b
+data4 0x3f658eee, 0x3f663afe, 0x3f66e75e, 0x3f67ea86
+data4 0x3f6897b0, 0x3f69452c, 0x3f69f2f9, 0x3f6af847
+data4 0x3f6ba6e2, 0x3f6c55d0, 0x3f6d0510, 0x3f6e0c8d
+data4 0x3f6ebc9f, 0x3f6f6d04, 0x3f701dbe, 0x3f70cecd
+data4 0x3f718030, 0x3f728ae6, 0x3f733d20, 0x3f73efaf
+data4 0x3f74a296, 0x3f7555d3, 0x3f760967, 0x3f76bd53
+data4 0x3f777197, 0x3f7880a1, 0x3f7935c2, 0x3f79eb3c
+data4 0x3f7aa10f, 0x3f7b573b, 0x3f7c0dc2, 0x3f7cc4a3
+data4 0x3f7d7bdf, 0x3f7e3376, 0x3f7eeb68, 0x00000000
+LOCAL_OBJECT_END(T_table)
+
+
+
+LOCAL_OBJECT_START(T_low)
+
+
+data8 0x3dc0b97f689876ef, 0x3dfd5d906028ac01
+data8 0x3df8b9cbb8d7240b, 0x3de0c941a2f220cd
+data8 0x3e09c6aecba15936, 0x3dfa6d528241827c
+data8 0x3dd0bad25714903c, 0x3e2776b01dc036a2
+data8 0x3e2b914bc77f158b, 0x3e1c0fafd29dc74a
+data8 0x3e28dadc119cd3de, 0x3e3bca869da085be
+data8 0x3e19d1e700f2200a, 0x3e3e13530cc37504
+data8 0x3e3936464d9c41ee, 0x3e3c3fa21c9499d0
+data8 0x3e3259e079b6c6e8, 0x3e2a364069c4f7f3
+data8 0x3e1274c84f6c6364, 0x3e3796170159f454
+data8 0x3e26e1e389f4364e, 0x3e28cedda8c7f658
+data8 0x3e376c2028433268, 0x3e4aee6d650c82e1
+data8 0x3e33e65094fbeeb4, 0x3e4c7d125aa92c5d
+data8 0x3e1559a4b69691d8, 0x3e18efabeb7d7221
+data8 0x3e4c2b255abaa8de, 0x3e37436952a4538b
+data8 0x3e4e6807f4ba00b8, 0x3e33ff5964190e42
+data8 0x3e4f5d798cead43c, 0x3e4f3676443bf453
+data8 0x3e4660f8d5bc1bf5, 0x3e2d4f9f3ab04f36
+data8 0x3e357f7a64ccd537, 0x3e394caf7c9b05af
+data8 0x3e225c7d17ab29b0, 0x3e4eb202f6d55a12
+data8 0x3e32faa68b19bcd2, 0x3e45ee1c9b566a8b
+data8 0x3e4770a67de054ff, 0x3e42234fb9de6d6b
+data8 0x3e4ad139825c6e19, 0x3e47f3d334814a93
+data8 0x3e2af1ec402867b6, 0x3e2bfbda0c956e3d
+data8 0x3e4287b831e77ff2, 0x3e54bf0eb77f7b89
+data8 0x3e5b9259a1029607, 0x3e4a764b015e699d
+data8 0x3e4d0b68ea883ab5, 0x3e33e829ecdadf46
+data8 0x3e52f27efef3031b, 0x3e3073979e4af89e
+data8 0x3e3b980f2cd6c253, 0x3e2a5f0f5f7f66a9
+data8 0x3e37788738117b02, 0x3e58aa29a784d52f
+data8 0x3e4f5504c4ff2466, 0x3e002d40340fa647
+data8 0x3e5f53b64592f4c3, 0x3e543f222c526802
+data8 0x3e5680e547a872fa, 0x3e5e234bd1154450
+data8 0x3e3000edc18b6d21, 0x3e1c3c1f000942a8
+data8 0x3e51eeae0e442d6e, 0x3e4fb265376623f2
+data8 0x3e57b5941782d830, 0x3e3a4b83f24ae52c
+data8 0x3e5a5fb4f23978de, 0x3e51ed071563fb02
+data8 0x3e49e2071f51a7a8, 0x3e5e43ae5b924234
+data8 0x3dfa2be9aedf374a, 0x3e56dea3dbba67d5
+data8 0x3e3375fe732b3c3e, 0x3e5a0c6f91f2e77e
+data8 0x3e55e1bf1c969e41, 0x3e30a5a5166b8eee
+data8 0x3e53e6e9a539d46c, 0x3e542981b3d7b0e6
+data8 0x3e595fd8ff36ad64, 0x3e5edeb9e65cbbb4
+data8 0x3e46aeab4d3434c1, 0x3e4ea3ff0564b010
+data8 0x3e59b00be2e3c25a, 0x3e5b887cd7b0821f
+data8 0x3e5f666668547b4d, 0x3e4d0733a805273f
+data8 0x3e26a2ff21c4aec5, 0x3e4c336f7a3a78f3
+data8 0x3e11ad12b628e2d0, 0x3e56d43ff3f0ea64
+data8 0x3e238809433cccd2, 0x3e40d9734147d40f
+data8 0x3e54245fe3e24e06, 0x3e251441fce4d48c
+data8 0x3e517114efc5d1f9, 0x3e5e9a99154b0d82
+data8 0x3e442a71337970f8, 0x3e420c7c69211fdf
+data8 0x3e537e7d5d43c6a7, 0x3e4376c66ad9ad8b
+data8 0x3e49054d678a4f1c, 0x3e5d23cb3bc19f18
+data8 0x3e6ebcd449dcab2b, 0x3e67f5fc2849c88a
+data8 0x3e63f388395d3e84, 0x3e65c1103b0ad7e9
+data8 0x3e6d5d1dd031f353, 0x3e5a159dae75c4d0
+data8 0x3e4d5e22aa75f71d, 0x3e5e379ee62e1e35
+data8 0x3e4df082213cb2dc, 0x3e6bfa06c156f521
+data8 0x3e66e2d3c19b517b, 0x3e426b7098590071
+data8 0x3e541bd027e9854e, 0x3e5061dd924b0ac0
+data8 0x3e6dae01df373a03, 0x3e3baec80b207b0b
+data8 0x3e6b6a6fe06bebac, 0x3e61aebcfc3ab5d1
+data8 0x3e584ee3e7c79d83, 0x3e6b3c1b2840cb40
+data8 0x3e6c842085d6befd, 0x3e6ac04fd7b141e0
+data8 0x3e6c48250474141d, 0x3e2d889b86125f69
+data8 0x3e6e74740225dad0, 0x3e45940d31d50a7c
+data8 0x3e695476a6c39ddc, 0x3e6d9a6d857a060a
+data8 0x3e4a3e9bb4b69337, 0x3e484f3ce4707ed6
+data8 0x3e39dd125d25fc27, 0x3e563fb400de8732
+data8 0x3e5fdd6d0ee28b48, 0x3e669d15b869bb07
+data8 0x3e40687cfad7964d, 0x3e69317990d43957
+data8 0x3e633d57e24ae1bd, 0x3e618bf03710eabb
+data8 0x3e4b4df6fccd1160, 0x3e3fb26ddaa1ec45
+data8 0x3e3810a5e1817fd4, 0x3e6857373642fa5c
+data8 0x3e673db6193add31, 0x3e63200c8acbc9c3
+data8 0x3e3d2dee448ebb62, 0x3e6a19723a80db6a
+data8 0x3e5e7cdab8fd3e6a, 0x3e671855cd660672
+data8 0x3e473c3c78a85ecd, 0x3e5f5e23056a7cf2
+data8 0x3e52538519527367, 0x3e4b573bcf2580e9
+data8 0x3e6d6f856fe90c60, 0x3e2d932a8487642e
+data8 0x3e5236fc78b6174c, 0x3e50cb91d406db50
+data8 0x3e650e8bd562aa57, 0x3e424ee3d9a82f2e
+data8 0x3e59363960e1e3d9, 0x3e379604c1150a3e
+data8 0x3e6d914f6c2ac258, 0x3e62967a451a7b48
+data8 0x3e684b5f01139cb2, 0x3e448bbfbf6d292c
+data8 0x3e6227e7fb487e73, 0x3e6d39d50290f458
+data8 0x3e58368342b4b668, 0x3e65dc0c25bd1763
+data8 0x3e61b7dc362e22b5, 0x3e671691f094bb80
+data8 0x3e5011642d5123f2, 0x3e4c4eb7f11e41be
+data8 0x3e5dcee36ca242cf, 0x3e6791cefff688f1
+data8 0x3e60e23c8dda4ecd, 0x3e48e6a22fe78cfe
+data8 0x3e6d703f244adc86, 0x3e6a281a85a5049d
+data8 0x3e570f20e6403d9e, 0x3e2211518a12956f
+data8 0x3e6737d1e54d71df, 0x3e66b1881476f5e9
+data8 0x3e6e1bbeef085376, 0x3e47cad4944a32be
+data8 0x3e527f2c738e7ee9, 0x3e699883a4b9fb29
+data8 0x3e5c17d1108740d9, 0x3e5d4a9c79a43389
+data8 0x3e49fdc24462ba3b, 0x3e24dbb3a60cceb2
+data8 0x3e5c5bf618780748, 0x3e5c38005b0c778c
+data8 0x3e6be168dd6dd3fe, 0x3e633ab9370693b0
+data8 0x3dd290556b0ae339, 0x3e607c317927096a
+data8 0x3e59651353b3d90e, 0x3e4d8751e5e0ae0d
+data8 0x3e46c81023272a85, 0x3e6b23c988f391b2
+data8 0x3e608741d215209c, 0x3e60b8ba506d758f
+data8 0x3e62ddbe74803297, 0x3e5dbb8b5087587d
+data8 0x3e642aa529048131, 0x3e3dcbda6835dcf4
+data8 0x3e6db503ce854d2a, 0x3e6dd00b49bc6849
+data8 0x3e4db2f11243bc84, 0x3e3b9848efc2ea97
+data8 0x3e58f18e17c82609, 0x3e6ed8645e16c312
+data8 0x3e4065bdb60a5dd4, 0x3e490453c6e6c30a
+data8 0x3e62373994aa31ba, 0x3e56305f0e6b2a95
+data8 0x3e68c1601a6614ee, 0x3e614e204f19d93f
+data8 0x3e6e5037ca773299, 0x3e693f98892561a6
+data8 0x3e639de4f4bf700d, 0x3e416c071e93fd97
+data8 0x3e65466991b415ef, 0x3e6896a324afac9d
+data8 0x3e44f64802e2f11c, 0x3e64d7d747e2191a
+data8 0x3e6174b7581de84c, 0x3e44c7b946e1d43c
+data8 0x3e6a3bcbe30512ec, 0x3e5d3ed411c95ce4
+data8 0x3e3e5b5735cfaf8e, 0x3e6e538ab34efb51
+data8 0x3e514e204f19d93f, 0x3e5a88e6550c89a4
+data8 0x3e66b97a5d9dfd8b, 0x3e5f46b1e14ebaf3
+data8 0x3e357665f6893f5d, 0x3e6bbf633078d1d5
+data8 0x3e5e7337a212c417, 0x3e3570fde15fc8cc
+data8 0x3e21119402da92b4, 0x3e6566e830d1ff3b
+data8 0x3e558883e480e220, 0x3e589ca3a68da411
+data8 0x3e44eb66df73d648, 0x3e1a0a629b1b7e68
+data8 0x3e54cc207b8c1116, 0x0000000000000000
+LOCAL_OBJECT_END(T_low)
+
+
+.section .text
+GLOBAL_IEEE754_ENTRY(log2l)
+
+{ .mfi
+  alloc r32=ar.pfs,1,4,4,0     
+  // normalize x 
+  // y=frcpa(x)  
+  frcpa.s1 f41,p0=f1,f8
+  // r26=bias-1
+  mov r26=0xfffe
+}
+{.mfi
+  // r23=bias+16
+  mov r23=0xffff+16
+  fma.s1 f7=f8,f1,f0
+  // r2 = pointer to C_1...C_6 followed by T_table
+  addl r2 = @ltoff(poly_coeffs), gp;;
+}
+{.mfi
+  // get significand
+  getf.sig r25=f8
+  // f8 denormal ?
+  fclass.m p8,p10=f8,0x9
+  // r24=bias-8
+  mov r24=0xffff-8;;
+}
+{.mfi
+  setf.exp f36=r26
+  nop.f 0
+  // r27=bias
+  mov r27=0xffff;;
+}
+
+{.mmf
+  getf.exp r29=f8
+  // load start address for C_1...C_7 followed by T_table
+  ld8 r2=[r2]
+  // will continue only for positive normal/unnormal numbers          
+  fclass.m.unc p0,p12 = f8, 0x19;; 
+}
+
+
+.pred.rel "mutex",p8,p10
+{.mfi
+  // denormal input, repeat get significand (after normalization)
+  (p8) getf.sig r25=f7
+  // x=1 ?
+  fcmp.eq.s0 p6,p0=f8,f1
+  // get T_index
+  (p10) shr.u r28=r25,63-8
+}
+{.mfi
+  // f32=2^16
+  setf.exp f32=r23
+  nop.f 0
+  mov r26=0x804;;
+}
+
+{.mfi
+  // denormal input, repeat get exponent (after normalization)
+  (p8) getf.exp r29=f7
+  // f33=0
+  mov f33=f0
+  // r26=0x80400...0 (threshold for using polynomial approximation)
+  shl r26=r26,64-12;;
+}
+
+{.mfb
+  add r3=16,r2 
+  // r=x*y-1
+  fms.s1 f6=f41,f8,f1
+  (p12) br.cond.spnt SPECIAL_log2l
+}
+{.mfi
+  // load C_1
+  ldfe f14=[r2],48
+  // RN(x*y)
+  fma.s1 f43=f41,f8,f0
+  mov r23=0xff;;
+}
+
+{.mmi
+  // load C_7, C_8
+  ldfpd f10,f11=[r3],16
+  // load C_3,C_4
+  ldfpd f15,f42=[r2],16
+  (p8) shr.u r28=r25,63-8;;
+}
+
+
+{.mfi
+  // load C_5, C_6
+  ldfpd f12,f13=[r3]
+  // pseudo-zero ?
+  fcmp.eq.s0 p7,p0=f7,f0
+  // if first 9 bits after leading 1 are all zero, then p8=1
+  cmp.ltu p8,p12=r25,r26
+}
+{.mfi
+  // load C1l
+  ldfe f34=[r2],16
+  fmerge.se f7=f1,f7
+  // get T_index
+  and r28=r28,r23;;
+}
+{.mfi
+  // r29=exponent-bias
+  sub r29=r29,r27
+  // if first 8 bits after leading bit are 0, use polynomial approx. only
+  (p8) fms.s1 f6=f7,f1,f1
+  // start address of T_low
+  add r3=1024+16,r2
+}
+{.mfi
+  // load C_2
+  ldfe f35=[r2],16
+  // x=1, return 0
+  (p6) fma.s0 f8=f0,f0,f0
+  // first 8 bits after leading 1 are all ones ?
+  cmp.eq p10,p0=r23,r28;;
+}
+
+{.mfb
+  // if first 8 bits after leading 1 are all ones, use polynomial approx. only
+  // add 1 to the exponent additive term, and estimate log2(1-r)
+  (p10) add r29=1,r29
+  nop.f 0
+  (p7) br.cond.spnt LOG2_PSEUDO_ZERO 
+}
+{.mfi
+  // get T_low adress 
+  shladd r3=r28,3,r3
+  // if first 8 bits after leading 1 are all ones, use polynomial approx. only
+  (p10) fms.s1 f6=f7,f36,f1
+  // p10 --> p8=1, p12=0
+  (p10) cmp.eq p8,p12=r0,r0;;
+}
+
+{.mfi
+  // get T_high address
+  shladd r2=r28,2,r2
+  // L(x*y)=x*y-RN(x*y)
+  fms.s1 f41=f41,f8,f43
+  nop.i 0
+}
+{.mfi
+  // p13=p12
+  (p12) cmp.eq.unc p13,p0=r0,r0
+  // RtH=RN(x*y)-1  (will eliminate rounding errors in r)
+  fms.s1 f43=f43,f1,f1
+  nop.i 0;;
+}
+
+.pred.rel "mutex",p8,p12
+{.mfb
+  // load T_high (unless first 9 bits after leading 1 are 0)
+  (p12) ldfs f7=[r2]
+  // set T_high=0 (if first 9 bits after leading 1 are 0)
+  (p8) fma.s1 f7=f0,f0,f0
+  // x=1, return
+  (p6) br.ret.spnt b0
+}
+.pred.rel "mutex",p8,p12
+{.mfi
+  // p12: load T_low
+  (p12) ldfd f36=[r3]
+  // p8: set T_low=0
+  (p8) fma.s1 f36=f0,f0,f0
+  (p8) cmp.eq p8,p12=r29,r0;; //nop.i 0;;
+}
+
+.pred.rel "mutex",p8,p12
+{.mfi
+  // f8=expon - bias 
+  setf.sig f8=r29
+  // general case: 2^{16}+C1*r
+  (p12) fma.s1 f33=f6,f14,f32
+  nop.i 0
+}
+{.mfi
+  // r26=1
+  mov r26=1
+  // p8 (mantissa is close to 1, or close to 2): 2^{-8}+C1*r
+  (p8) fma.s1 f32=f6,f14,f33
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // P78=C_7+C_8*r
+  fma.s1 f10=f11,f6,f10
+  // r26=2^{63}
+  shl r26=r26,63
+}
+{.mfi
+  nop.m 0
+  // P34=C_3+r*C_4
+  fma.s1 f15=f42,f6,f15
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // r2=r*r
+  fma.s1 f11=f6,f6,f0
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // P56=C_5+C_6*r
+  fma.s1 f13=f13,f6,f12
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // Rth-r
+  (p13) fms.s1 f43=f43,f1,f6
+  nop.i 0
+}
+{.mfi
+  // significand(x)=1 ?
+  cmp.eq p0,p6=r25,r26
+  // P12=C1l+C_2*r
+  fma.s1 f34=f35,f6,f34
+  nop.i 0;;
+}
+
+.pred.rel "mutex",p8,p12
+{.mfi
+  nop.m 0
+  // p12: C1r=(2^{16}+C1*r)-2^{16}
+  (p12) fms.s1 f32=f33,f1,f32
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // p8: C1r=C1*r (double extended)
+  (p8) fms.s1 f32=f32,f1,f33
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // L(x*y)*C_1+T_low
+  (p13) fma.s1 f36=f41,f14,f36
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // P58=P56+r2*P78
+  fma.s1 f13=f11,f10,f13
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // P14=P12+r2*P34
+  fma.s1 f15=f15,f11,f34
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // r4=r2*r2
+  fma.s1 f11=f11,f11,f0
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // normalize additive term (l=exponent of x)
+  fcvt.xf f8=f8
+  nop.i 0;;
+}
+
+
+{.mfi
+  nop.m 0
+  // D=C1*r-C1r
+  (p6) fms.s1 f12=f14,f6,f32
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // T_low'=(Rth-r)*C1+(L(x*y)*C1+T_low)
+  (p13) fma.s1 f36=f43,f14,f36
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // P18=P14+r4*P58
+  (p6) fma.s1 f13=f11,f13,f15
+  nop.i 0;;
+}
+
+{.mfi
+  nop.m 0
+  // add T_high+l
+  (p6) fma.s1 f8=f8,f1,f7
+  nop.i 0;;
+}
+
+
+{.mfi
+  nop.m 0
+  // D+T_low
+  (p6) fma.s1 f12=f12,f1,f36
+  nop.i 0;;
+}
+
+
+{.mfi
+  nop.m 0
+  // (T_high+l)+C1r
+  (p6) fma.s1 f8=f8,f1,f32
+  nop.i 0
+}
+{.mfi
+  nop.m 0
+  // (D+T_low)+r*P18
+  (p6) fma.s1 f13=f13,f6,f12
+  nop.i 0;;
+}
+
+//{.mfb
+//nop.m 0
+//mov f8=f36
+//fma.s0 f8=f13,f6,f0
+//br.ret.sptk b0;;
+//}
+
+
+{.mfb
+  nop.m 0
+  // result=((T_high+l)+C1r)+((D+T_low)+r*P18)
+  (p6) fma.s0 f8=f13,f1,f8
+  // return
+  br.ret.sptk b0;;
+}
+
+
+SPECIAL_log2l:
+{.mfi
+  nop.m 0
+  mov FR_X=f8
+  nop.i 0
+}
+{.mfi 
+  nop.m 0
+  // x=+Infinity ?
+  fclass.m p7,p0=f8,0x21
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // x=+/-Zero ?
+  fclass.m p8,p0=f7,0x7
+  nop.i 0;;
+}
+{.mfi
+  nop.m 0
+  // x=-Infinity, -normal, -denormal ?
+  fclass.m p6,p0=f8,0x3a
+  nop.i 0;;
+}
+{.mfb
+  nop.m 0
+  // log2l(+Infinity)=+Infinity
+  nop.f 0
+  (p7) br.ret.spnt b0;;
+}
+{.mfi
+  (p8) mov GR_Parameter_TAG = 168                          
+  // log2l(+/-0)=-infinity, raises Divide by Zero
+  // set f8=-0
+  (p8) fmerge.ns f8=f0,f8
+  nop.i 0;;
+}
+{.mfb
+  nop.m 0
+  (p8) frcpa.s0 f8,p0=f1,f8
+  (p8) br.cond.sptk __libm_error_region;;
+}
+{.mfb
+  (p6) mov GR_Parameter_TAG = 169 
+  // x<0: return NaN, raise Invalid
+  (p6) frcpa.s0 f8,p0=f0,f0
+  (p6) br.cond.sptk __libm_error_region;;
+}                          
+  
+
+{.mfb
+  nop.m 0
+  // Remaining cases: NaNs
+  fma.s0 f8=f8,f1,f0
+  br.ret.sptk b0;;
+}
+
+LOG2_PSEUDO_ZERO:
+
+{.mfi
+  nop.m 0
+  mov FR_X=f8
+  nop.i 0
+}
+{.mfi
+  mov GR_Parameter_TAG = 168                          
+  // log2l(+/-0)=-infinity, raises Divide by Zero
+  // set f8=-0
+  fmerge.ns f8=f0,f8
+  nop.i 0;;
+}
+{.mfb
+  nop.m 0
+  frcpa.s0 f8,p0=f1,f8
+  br.cond.sptk __libm_error_region;;
+}
+
+
+GLOBAL_IEEE754_END(log2l)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfe [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                       // Save b0 
+};;
+.body
+{ .mib
+        stfe [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack 
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address 
+	nop.b 0                                      
+}
+{ .mib
+        stfe [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support#         // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
diff --git a/sysdeps/ia64/fpu/e_logf.S b/sysdeps/ia64/fpu/e_logf.S
index 829d0abed0..3d11a296cc 100644
--- a/sysdeps/ia64/fpu/e_logf.S
+++ b/sysdeps/ia64/fpu/e_logf.S
@@ -1,10 +1,10 @@
 .file "logf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,860 +20,1074 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 3/01/00  Initial version
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 03/01/00 Initial version
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 1/10/01  Improved speed, fixed flags for neg denormals
-//
+// 01/10/01 Improved speed, fixed flags for neg denormals
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 05/23/02 Modified algorithm. Now only one polynomial is used
+//          for |x-1| >= 1/256 and for |x-1| < 1/256
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 03/31/05 Reformatted delimiters between data tables
 //
 // API
 //==============================================================
 // float logf(float)
 // float log10f(float)
 //
+//
 // Overview of operation
 //==============================================================
 // Background
+// ----------
 //
-// Consider  x = 2^N 1.f1 f2 f3 f4...f63
-// Log(x) = log(frcpa(x) x/frcpa(x))
-//        = log(1/frcpa(x)) + log(frcpa(x) x)
-//        = -log(frcpa(x)) + log(frcpa(x) x)
+// This algorithm is based on fact that
+// log(a b) = log(a) + log(b).
 //
-// frcpa(x)       = 2^-N frcpa((1.f1 f2 ... f63)
+// In our case we have x = 2^N f, where 1 <= f < 2.
+// So
+//   log(x) = log(2^N f) = log(2^N) + log(f) = n*log(2) + log(f)
 //
-// -log(frcpa(x)) = -log(C) 
-//                = -log(2^-N) - log(frcpa(1.f1 f2 ... f63))
+// To calculate log(f) we do following
+//   log(f) = log(f * frcpa(f) / frcpa(f)) =
+//          = log(f * frcpa(f)) + log(1/frcpa(f))
 //
-// -log(frcpa(x)) = -log(C) 
-//                = +Nlog2 - log(frcpa(1.f1 f2 ... f63))
+// According to definition of IA-64's frcpa instruction it's a
+// floating point that approximates 1/f using a lookup on the
+// top of 8 bits of the input number's significand with relative
+// error < 2^(-8.886). So we have following
 //
-// -log(frcpa(x)) = -log(C) 
-//                = +Nlog2 + log(frcpa(1.f1 f2 ... f63))
+// |(1/f - frcpa(f)) / (1/f))| = |1 - f*frcpa(f)| < 1/256
+//
+// and
+//
+// log(f) = log(f * frcpa(f)) + log(1/frcpa(f)) =
+//        = log(1 + r) + T
+//
+// The first value can be computed by polynomial P(r) approximating
+// log(1 + r) on |r| < 1/256 and the second is precomputed tabular
+// value defined by top 8 bit of f.
+//
+// Finally we have that  log(x) ~ (N*log(2) + T) + P(r)
+//
+// Note that if input argument is close to 1.0 (in our case it means
+// that |1 - x| < 1/256) we can use just polynomial approximation
+// because x = 2^0 * f = f = 1 + r and
+// log(x) = log(1 + r) ~ P(r)
 //
-// Log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
-
-// Log(x) =  +Nlog2 + log(1./frcpa(1.f1 f2 ... f63)) + log(frcpa(x) x)
-// Log(x) =  +Nlog2 - log(/frcpa(1.f1 f2 ... f63))   + log(frcpa(x) x)
-// Log(x) =  +Nlog2 + T                              + log(frcpa(x) x)
 //
-// Log(x) =  +Nlog2 + T                     + log(C x)
+// To compute log10(x) we just use identity:
 //
-// Cx = 1 + r
+//  log10(x) = log(x)/log(10)
 //
-// Log(x) =  +Nlog2 + T  + log(1+r)
-// Log(x) =  +Nlog2 + T  + Series( r - r^2/2 + r^3/3 - r^4/4 ....)
+// so we have that
+//
+//  log10(x) = (N*log(2) + T  + log(1+r)) / log(10) =
+//           = N*(log(2)/log(10)) + (T/log(10)) + log(1 + r)/log(10)
 //
-// 1.f1 f2 ... f8 has 256 entries.
-// They are 1 + k/2^8, k = 0 ... 255
-// These 256 values are the table entries.
 //
 // Implementation
-//===============
-// CASE 1:  |x-1| >= 2^-8
-// C = frcpa(x)
-// r = C * x - 1
+// --------------
+// It can be seen that formulas for log and log10 differ from one another
+// only by coefficients and tabular values. Namely as log as log10 are
+// calculated as (N*L1 + T) + L2*Series(r) where in case of log
+//   L1 = log(2)
+//   T  = log(1/frcpa(x))
+//   L2 = 1.0
+// and in case of log10
+//   L1 = log(2)/log(10)
+//   T  = log(1/frcpa(x))/log(10)
+//   L2 = 1.0/log(10)
 //
-// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4
+// So common code with two different entry points those set pointers
+// to the base address of coresponding data sets containing values
+// of L2,T and prepare integer representation of L1 needed for following
+// setf instruction can be used.
 //
-// x = f * 2*n where f is 1.f_1f_2f_3....f_63
-// Nfloat = float(n)  where n is the true unbiased exponent
-// pre-index = f_1f_2....f_8
-// index = pre_index * 16
-// get the dxt table entry at index + offset = T
+// Note that both log and log10 use common approximation polynomial
+// it means we need only one set of coefficients of approximation.
 //
-// result = (T + Nfloat * log(2)) + rseries
+// 1. Computation of log(x) for |x-1| >= 1/256
+//   InvX = frcpa(x)
+//   r = InvX*x - 1
+//   P(r) = r*((1 - A2*r) + r^2*(A3 - A4*r)) = r*P2(r),
+//   A4,A3,A2 are created with setf inctruction.
+//   We use Taylor series and so A4 = 1/4, A3 = 1/3,
+//   A2 = 1/2 rounded to double.
 //
-// The T table is calculated as follows
-// Form x_k = 1 + k/2^8 where k goes from 0... 255
-//      y_k = frcpa(x_k)
-//      log(1/y_k)  in quad and round to double
-
-// CASE 2:  |x-1| < 2^-6
-// w = x - 1
+//   N = float(n) where n is true unbiased exponent of x
 //
-// Form wseries = w + Q1*w^2 + Q2*w^3 + Q3*w^4
+//   T is tabular value of log(1/frcpa(x)) calculated in quad precision
+//   and rounded to double. To T we get bits from 55 to 62 of register
+//   format significand of x and calculate address
+//     ad_T = table_base_addr + 8 * index
 //
-// result = wseries
-
-// Special values 
+//   L2 (1.0 or 1.0/log(10) depending on function) is calculated in quad
+//   precision and rounded to double; it's loaded from memory
+//
+//   L1 (log(2) or log10(2) depending on function) is calculated in quad
+//   precision and rounded to double; it's created with setf.
+//
+//   And final result = P2(r)*(r*L2) + (T + N*L1)
+//
+//
+// 2. Computation of log(x) for |x-1| < 1/256
+//   r = x - 1
+//   P(r) = r*((1 - A2*r) + r^2*(A3 - A4*r)) = r*P2(r),
+//   A4,A3,A2 are the same as in case |x-1| >= 1/256
+//
+//   And final result = P2(r)*(r*L2)
+//
+// 3. How we define is input argument such that |x-1| < 1/256 or not.
+//
+//    To do it we analyze biased exponent and significand of input argment.
+//
+//      a) First we test is biased exponent equal to 0xFFFE or 0xFFFF (i.e.
+//         we test is 0.5 <= x < 2). This comparison can be performed using
+//         unsigned version of cmp instruction in such a way
+//         biased_exponent_of_x - 0xFFFE < 2
+//
+//
+//      b) Second (in case when result of a) is true) we need to compare x
+//         with 1-1/256 and 1+1/256 or in register format representation with
+//         0xFFFEFF00000000000000 and 0xFFFF8080000000000000 correspondingly.
+//         As far as biased exponent of x here can be equal only to 0xFFFE or
+//         0xFFFF we need to test only last bit of it. Also signifigand always
+//         has implicit bit set to 1 that can be exluded from comparison.
+//         Thus it's quite enough to generate 64-bit integer bits of that are
+//         ix[63] = biased_exponent_of_x[0] and ix[62-0] = significand_of_x[62-0]
+//         and compare it with 0x7F00000000000000 and 0x80800000000000000 (those
+//         obtained like ix from register representatinos of 255/256 and
+//         257/256). This comparison can be made like in a), using unsigned
+//         version of cmp i.e. ix - 0x7F00000000000000 < 0x0180000000000000.
+//         0x0180000000000000 is difference between 0x80800000000000000 and
+//         0x7F00000000000000.
+//
+//    Note: NaT, any NaNs, +/-INF, +/-0, negatives and unnormalized numbers are
+//          filtered and processed on special branches.
+//
+//
+// Special values
 //==============================================================
-
-
-// log(+0)    = -inf
-// log(-0)    = -inf
-
-// log(+qnan) = +qnan 
-// log(-qnan) = -qnan 
-// log(+snan) = +qnan 
-// log(-snan) = -qnan 
-
-// log(-n)    = QNAN Indefinite
-// log(-inf)  = QNAN Indefinite 
-
-// log(+inf)  = +inf
-
+//
+// logf(+0)    = -inf
+// logf(-0)    = -inf
+//
+// logf(+qnan) = +qnan
+// logf(-qnan) = -qnan
+// logf(+snan) = +qnan
+// logf(-snan) = -qnan
+//
+// logf(-n)    = QNAN Indefinite
+// logf(-inf)  = QNAN Indefinite
+//
+// logf(+inf)  = +inf
+//
 // Registers used
 //==============================================================
-// Floating Point registers used: 
+// Floating Point registers used:
 // f8, input
-// f9 -> f15,  f32 -> f47
-
-// General registers used:  
-// r32 -> r51
-
+// f12 -> f14,  f33 -> f39
+//
+// General registers used:
+// r8  -> r11
+// r14 -> r19
+//
 // Predicate registers used:
-// p6 -> p15
-
-// p8 log base e
-// p6 log base e special
-// p9 used in the frcpa
-// p13 log base e large W
-// p14 log base e small w
+// p6 -> p12
 
-// p7 log base 10
-// p10 log base 10 large W
-// p11 log base 10 small w
-// p12 log base 10 special
-
-#include "libm_support.h"
 
 // Assembly macros
 //==============================================================
 
-log_int_Nfloat   = f9 
-log_Nfloat       = f10 
-
-log_P3           = f11 
-log_P2           = f12 
-log_P1           = f13 
-log_inv_ln10     = f14
-log_log2         = f15 
-
-log_w            = f32
-log_T            = f33 
-log_rp_p32       = f34 
-log_rp_p2        = f35 
-log_rp_p10       = f36
-log_rsq          = f37 
-log_T_plus_Nlog2 = f38 
-log_r            = f39
-log_C            = f40
-log_rp_q32       = f41
-log_rp_q2        = f42
-log_rp_q10       = f43
-log_wsq          = f44
-log_Q            = f45
-log_inv_ln10     = f46
-log_NORM_f8      = f47
-
-// ===================================
-
-log_GR_exp_17_ones               = r33
-log_GR_exp_16_ones               = r34
-log_GR_exp_f8                    = r35
-log_GR_signexp_f8                = r36
-log_GR_true_exp_f8               = r37
-log_GR_significand_f8            = r38
-log_GR_index                     = r39
-log_AD_1                         = r40
-log_GR_signexp_w                 = r41
-log_GR_fff7                      = r42
-log_AD_2                         = r43
-log_GR_exp_w                     = r44
-
-GR_SAVE_B0                       = r45
-GR_SAVE_GP                       = r46
-GR_SAVE_PFS                      = r47
-
-GR_Parameter_X                   = r48
-GR_Parameter_Y                   = r49
-GR_Parameter_RESULT              = r50
-log_GR_tag                       = r51
+GR_TAG                 = r8
+GR_ad_T                = r8
+GR_N                   = r9
+GR_Exp                 = r10
+GR_Sig                 = r11
+
+GR_025                 = r14
+GR_05                  = r15
+GR_A3                  = r16
+GR_Ind                 = r17
+GR_dx                  = r15
+GR_Ln2                 = r19
+GR_de                  = r20
+GR_x                   = r21
+GR_xorg                = r22
+
+GR_SAVE_B0             = r33
+GR_SAVE_PFS            = r34
+GR_SAVE_GP             = r35
+GR_SAVE_SP             = r36
+
+GR_Parameter_X         = r37
+GR_Parameter_Y         = r38
+GR_Parameter_RESULT    = r39
+GR_Parameter_TAG       = r40
+
+
+FR_A2                  = f12
+FR_A3                  = f13
+FR_A4                  = f14
+
+FR_RcpX                = f33
+FR_r                   = f34
+FR_r2                  = f35
+FR_tmp                 = f35
+FR_Ln2                 = f36
+FR_T                   = f37
+FR_N                   = f38
+FR_NxLn2pT             = f38
+FR_NormX               = f39
+FR_InvLn10             = f40
+
+
+FR_Y                   = f1
+FR_X                   = f10
+FR_RESULT              = f8
 
 
 // Data tables
 //==============================================================
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+RODATA
 .align 16
-
-log_table_1:
-ASM_TYPE_DIRECTIVE(log_table_1,@object)
-data8 0xbfd0001008f39d59    // p3
-data8 0x3fd5556073e0c45a    // p2
-ASM_SIZE_DIRECTIVE(log_table_1)
-
-log_table_2:
-ASM_TYPE_DIRECTIVE(log_table_2,@object)
-data8 0xbfdffffffffaea15    // p1
-data8 0x3fdbcb7b1526e50e    // 1/ln10
-data8 0x3fe62e42fefa39ef    // Log(2)
-data8 0x0                   // pad
-
-data8 0x3F60040155D5889E    //log(1/frcpa(1+   0/256)
-data8 0x3F78121214586B54    //log(1/frcpa(1+   1/256)
-data8 0x3F841929F96832F0    //log(1/frcpa(1+   2/256)
-data8 0x3F8C317384C75F06    //log(1/frcpa(1+   3/256)
-data8 0x3F91A6B91AC73386    //log(1/frcpa(1+   4/256)
-data8 0x3F95BA9A5D9AC039    //log(1/frcpa(1+   5/256)
-data8 0x3F99D2A8074325F4    //log(1/frcpa(1+   6/256)
-data8 0x3F9D6B2725979802    //log(1/frcpa(1+   7/256)
-data8 0x3FA0C58FA19DFAAA    //log(1/frcpa(1+   8/256)
-data8 0x3FA2954C78CBCE1B    //log(1/frcpa(1+   9/256)
-data8 0x3FA4A94D2DA96C56    //log(1/frcpa(1+  10/256)
-data8 0x3FA67C94F2D4BB58    //log(1/frcpa(1+  11/256)
-data8 0x3FA85188B630F068    //log(1/frcpa(1+  12/256)
-data8 0x3FAA6B8ABE73AF4C    //log(1/frcpa(1+  13/256)
-data8 0x3FAC441E06F72A9E    //log(1/frcpa(1+  14/256)
-data8 0x3FAE1E6713606D07    //log(1/frcpa(1+  15/256)
-data8 0x3FAFFA6911AB9301    //log(1/frcpa(1+  16/256)
-data8 0x3FB0EC139C5DA601    //log(1/frcpa(1+  17/256)
-data8 0x3FB1DBD2643D190B    //log(1/frcpa(1+  18/256)
-data8 0x3FB2CC7284FE5F1C    //log(1/frcpa(1+  19/256)
-data8 0x3FB3BDF5A7D1EE64    //log(1/frcpa(1+  20/256)
-data8 0x3FB4B05D7AA012E0    //log(1/frcpa(1+  21/256)
-data8 0x3FB580DB7CEB5702    //log(1/frcpa(1+  22/256)
-data8 0x3FB674F089365A7A    //log(1/frcpa(1+  23/256)
-data8 0x3FB769EF2C6B568D    //log(1/frcpa(1+  24/256)
-data8 0x3FB85FD927506A48    //log(1/frcpa(1+  25/256)
-data8 0x3FB9335E5D594989    //log(1/frcpa(1+  26/256)
-data8 0x3FBA2B0220C8E5F5    //log(1/frcpa(1+  27/256)
-data8 0x3FBB0004AC1A86AC    //log(1/frcpa(1+  28/256)
-data8 0x3FBBF968769FCA11    //log(1/frcpa(1+  29/256)
-data8 0x3FBCCFEDBFEE13A8    //log(1/frcpa(1+  30/256)
-data8 0x3FBDA727638446A2    //log(1/frcpa(1+  31/256)
-data8 0x3FBEA3257FE10F7A    //log(1/frcpa(1+  32/256)
-data8 0x3FBF7BE9FEDBFDE6    //log(1/frcpa(1+  33/256)
-data8 0x3FC02AB352FF25F4    //log(1/frcpa(1+  34/256)
-data8 0x3FC097CE579D204D    //log(1/frcpa(1+  35/256)
-data8 0x3FC1178E8227E47C    //log(1/frcpa(1+  36/256)
-data8 0x3FC185747DBECF34    //log(1/frcpa(1+  37/256)
-data8 0x3FC1F3B925F25D41    //log(1/frcpa(1+  38/256)
-data8 0x3FC2625D1E6DDF57    //log(1/frcpa(1+  39/256)
-data8 0x3FC2D1610C86813A    //log(1/frcpa(1+  40/256)
-data8 0x3FC340C59741142E    //log(1/frcpa(1+  41/256)
-data8 0x3FC3B08B6757F2A9    //log(1/frcpa(1+  42/256)
-data8 0x3FC40DFB08378003    //log(1/frcpa(1+  43/256)
-data8 0x3FC47E74E8CA5F7C    //log(1/frcpa(1+  44/256)
-data8 0x3FC4EF51F6466DE4    //log(1/frcpa(1+  45/256)
-data8 0x3FC56092E02BA516    //log(1/frcpa(1+  46/256)
-data8 0x3FC5D23857CD74D5    //log(1/frcpa(1+  47/256)
-data8 0x3FC6313A37335D76    //log(1/frcpa(1+  48/256)
-data8 0x3FC6A399DABBD383    //log(1/frcpa(1+  49/256)
-data8 0x3FC70337DD3CE41B    //log(1/frcpa(1+  50/256)
-data8 0x3FC77654128F6127    //log(1/frcpa(1+  51/256)
-data8 0x3FC7E9D82A0B022D    //log(1/frcpa(1+  52/256)
-data8 0x3FC84A6B759F512F    //log(1/frcpa(1+  53/256)
-data8 0x3FC8AB47D5F5A310    //log(1/frcpa(1+  54/256)
-data8 0x3FC91FE49096581B    //log(1/frcpa(1+  55/256)
-data8 0x3FC981634011AA75    //log(1/frcpa(1+  56/256)
-data8 0x3FC9F6C407089664    //log(1/frcpa(1+  57/256)
-data8 0x3FCA58E729348F43    //log(1/frcpa(1+  58/256)
-data8 0x3FCABB55C31693AD    //log(1/frcpa(1+  59/256)
-data8 0x3FCB1E104919EFD0    //log(1/frcpa(1+  60/256)
-data8 0x3FCB94EE93E367CB    //log(1/frcpa(1+  61/256)
-data8 0x3FCBF851C067555F    //log(1/frcpa(1+  62/256)
-data8 0x3FCC5C0254BF23A6    //log(1/frcpa(1+  63/256)
-data8 0x3FCCC000C9DB3C52    //log(1/frcpa(1+  64/256)
-data8 0x3FCD244D99C85674    //log(1/frcpa(1+  65/256)
-data8 0x3FCD88E93FB2F450    //log(1/frcpa(1+  66/256)
-data8 0x3FCDEDD437EAEF01    //log(1/frcpa(1+  67/256)
-data8 0x3FCE530EFFE71012    //log(1/frcpa(1+  68/256)
-data8 0x3FCEB89A1648B971    //log(1/frcpa(1+  69/256)
-data8 0x3FCF1E75FADF9BDE    //log(1/frcpa(1+  70/256)
-data8 0x3FCF84A32EAD7C35    //log(1/frcpa(1+  71/256)
-data8 0x3FCFEB2233EA07CD    //log(1/frcpa(1+  72/256)
-data8 0x3FD028F9C7035C1C    //log(1/frcpa(1+  73/256)
-data8 0x3FD05C8BE0D9635A    //log(1/frcpa(1+  74/256)
-data8 0x3FD085EB8F8AE797    //log(1/frcpa(1+  75/256)
-data8 0x3FD0B9C8E32D1911    //log(1/frcpa(1+  76/256)
-data8 0x3FD0EDD060B78081    //log(1/frcpa(1+  77/256)
-data8 0x3FD122024CF0063F    //log(1/frcpa(1+  78/256)
-data8 0x3FD14BE2927AECD4    //log(1/frcpa(1+  79/256)
-data8 0x3FD180618EF18ADF    //log(1/frcpa(1+  80/256)
-data8 0x3FD1B50BBE2FC63B    //log(1/frcpa(1+  81/256)
-data8 0x3FD1DF4CC7CF242D    //log(1/frcpa(1+  82/256)
-data8 0x3FD214456D0EB8D4    //log(1/frcpa(1+  83/256)
-data8 0x3FD23EC5991EBA49    //log(1/frcpa(1+  84/256)
-data8 0x3FD2740D9F870AFB    //log(1/frcpa(1+  85/256)
-data8 0x3FD29ECDABCDFA04    //log(1/frcpa(1+  86/256)
-data8 0x3FD2D46602ADCCEE    //log(1/frcpa(1+  87/256)
-data8 0x3FD2FF66B04EA9D4    //log(1/frcpa(1+  88/256)
-data8 0x3FD335504B355A37    //log(1/frcpa(1+  89/256)
-data8 0x3FD360925EC44F5D    //log(1/frcpa(1+  90/256)
-data8 0x3FD38BF1C3337E75    //log(1/frcpa(1+  91/256)
-data8 0x3FD3C25277333184    //log(1/frcpa(1+  92/256)
-data8 0x3FD3EDF463C1683E    //log(1/frcpa(1+  93/256)
-data8 0x3FD419B423D5E8C7    //log(1/frcpa(1+  94/256)
-data8 0x3FD44591E0539F49    //log(1/frcpa(1+  95/256)
-data8 0x3FD47C9175B6F0AD    //log(1/frcpa(1+  96/256)
-data8 0x3FD4A8B341552B09    //log(1/frcpa(1+  97/256)
-data8 0x3FD4D4F3908901A0    //log(1/frcpa(1+  98/256)
-data8 0x3FD501528DA1F968    //log(1/frcpa(1+  99/256)
-data8 0x3FD52DD06347D4F6    //log(1/frcpa(1+ 100/256)
-data8 0x3FD55A6D3C7B8A8A    //log(1/frcpa(1+ 101/256)
-data8 0x3FD5925D2B112A59    //log(1/frcpa(1+ 102/256)
-data8 0x3FD5BF406B543DB2    //log(1/frcpa(1+ 103/256)
-data8 0x3FD5EC433D5C35AE    //log(1/frcpa(1+ 104/256)
-data8 0x3FD61965CDB02C1F    //log(1/frcpa(1+ 105/256)
-data8 0x3FD646A84935B2A2    //log(1/frcpa(1+ 106/256)
-data8 0x3FD6740ADD31DE94    //log(1/frcpa(1+ 107/256)
-data8 0x3FD6A18DB74A58C5    //log(1/frcpa(1+ 108/256)
-data8 0x3FD6CF31058670EC    //log(1/frcpa(1+ 109/256)
-data8 0x3FD6F180E852F0BA    //log(1/frcpa(1+ 110/256)
-data8 0x3FD71F5D71B894F0    //log(1/frcpa(1+ 111/256)
-data8 0x3FD74D5AEFD66D5C    //log(1/frcpa(1+ 112/256)
-data8 0x3FD77B79922BD37E    //log(1/frcpa(1+ 113/256)
-data8 0x3FD7A9B9889F19E2    //log(1/frcpa(1+ 114/256)
-data8 0x3FD7D81B037EB6A6    //log(1/frcpa(1+ 115/256)
-data8 0x3FD8069E33827231    //log(1/frcpa(1+ 116/256)
-data8 0x3FD82996D3EF8BCB    //log(1/frcpa(1+ 117/256)
-data8 0x3FD85855776DCBFB    //log(1/frcpa(1+ 118/256)
-data8 0x3FD8873658327CCF    //log(1/frcpa(1+ 119/256)
-data8 0x3FD8AA75973AB8CF    //log(1/frcpa(1+ 120/256)
-data8 0x3FD8D992DC8824E5    //log(1/frcpa(1+ 121/256)
-data8 0x3FD908D2EA7D9512    //log(1/frcpa(1+ 122/256)
-data8 0x3FD92C59E79C0E56    //log(1/frcpa(1+ 123/256)
-data8 0x3FD95BD750EE3ED3    //log(1/frcpa(1+ 124/256)
-data8 0x3FD98B7811A3EE5B    //log(1/frcpa(1+ 125/256)
-data8 0x3FD9AF47F33D406C    //log(1/frcpa(1+ 126/256)
-data8 0x3FD9DF270C1914A8    //log(1/frcpa(1+ 127/256)
-data8 0x3FDA0325ED14FDA4    //log(1/frcpa(1+ 128/256)
-data8 0x3FDA33440224FA79    //log(1/frcpa(1+ 129/256)
-data8 0x3FDA57725E80C383    //log(1/frcpa(1+ 130/256)
-data8 0x3FDA87D0165DD199    //log(1/frcpa(1+ 131/256)
-data8 0x3FDAAC2E6C03F896    //log(1/frcpa(1+ 132/256)
-data8 0x3FDADCCC6FDF6A81    //log(1/frcpa(1+ 133/256)
-data8 0x3FDB015B3EB1E790    //log(1/frcpa(1+ 134/256)
-data8 0x3FDB323A3A635948    //log(1/frcpa(1+ 135/256)
-data8 0x3FDB56FA04462909    //log(1/frcpa(1+ 136/256)
-data8 0x3FDB881AA659BC93    //log(1/frcpa(1+ 137/256)
-data8 0x3FDBAD0BEF3DB165    //log(1/frcpa(1+ 138/256)
-data8 0x3FDBD21297781C2F    //log(1/frcpa(1+ 139/256)
-data8 0x3FDC039236F08819    //log(1/frcpa(1+ 140/256)
-data8 0x3FDC28CB1E4D32FD    //log(1/frcpa(1+ 141/256)
-data8 0x3FDC4E19B84723C2    //log(1/frcpa(1+ 142/256)
-data8 0x3FDC7FF9C74554C9    //log(1/frcpa(1+ 143/256)
-data8 0x3FDCA57B64E9DB05    //log(1/frcpa(1+ 144/256)
-data8 0x3FDCCB130A5CEBB0    //log(1/frcpa(1+ 145/256)
-data8 0x3FDCF0C0D18F326F    //log(1/frcpa(1+ 146/256)
-data8 0x3FDD232075B5A201    //log(1/frcpa(1+ 147/256)
-data8 0x3FDD490246DEFA6B    //log(1/frcpa(1+ 148/256)
-data8 0x3FDD6EFA918D25CD    //log(1/frcpa(1+ 149/256)
-data8 0x3FDD9509707AE52F    //log(1/frcpa(1+ 150/256)
-data8 0x3FDDBB2EFE92C554    //log(1/frcpa(1+ 151/256)
-data8 0x3FDDEE2F3445E4AF    //log(1/frcpa(1+ 152/256)
-data8 0x3FDE148A1A2726CE    //log(1/frcpa(1+ 153/256)
-data8 0x3FDE3AFC0A49FF40    //log(1/frcpa(1+ 154/256)
-data8 0x3FDE6185206D516E    //log(1/frcpa(1+ 155/256)
-data8 0x3FDE882578823D52    //log(1/frcpa(1+ 156/256)
-data8 0x3FDEAEDD2EAC990C    //log(1/frcpa(1+ 157/256)
-data8 0x3FDED5AC5F436BE3    //log(1/frcpa(1+ 158/256)
-data8 0x3FDEFC9326D16AB9    //log(1/frcpa(1+ 159/256)
-data8 0x3FDF2391A2157600    //log(1/frcpa(1+ 160/256)
-data8 0x3FDF4AA7EE03192D    //log(1/frcpa(1+ 161/256)
-data8 0x3FDF71D627C30BB0    //log(1/frcpa(1+ 162/256)
-data8 0x3FDF991C6CB3B379    //log(1/frcpa(1+ 163/256)
-data8 0x3FDFC07ADA69A910    //log(1/frcpa(1+ 164/256)
-data8 0x3FDFE7F18EB03D3E    //log(1/frcpa(1+ 165/256)
-data8 0x3FE007C053C5002E    //log(1/frcpa(1+ 166/256)
-data8 0x3FE01B942198A5A1    //log(1/frcpa(1+ 167/256)
-data8 0x3FE02F74400C64EB    //log(1/frcpa(1+ 168/256)
-data8 0x3FE04360BE7603AD    //log(1/frcpa(1+ 169/256)
-data8 0x3FE05759AC47FE34    //log(1/frcpa(1+ 170/256)
-data8 0x3FE06B5F1911CF52    //log(1/frcpa(1+ 171/256)
-data8 0x3FE078BF0533C568    //log(1/frcpa(1+ 172/256)
-data8 0x3FE08CD9687E7B0E    //log(1/frcpa(1+ 173/256)
-data8 0x3FE0A10074CF9019    //log(1/frcpa(1+ 174/256)
-data8 0x3FE0B5343A234477    //log(1/frcpa(1+ 175/256)
-data8 0x3FE0C974C89431CE    //log(1/frcpa(1+ 176/256)
-data8 0x3FE0DDC2305B9886    //log(1/frcpa(1+ 177/256)
-data8 0x3FE0EB524BAFC918    //log(1/frcpa(1+ 178/256)
-data8 0x3FE0FFB54213A476    //log(1/frcpa(1+ 179/256)
-data8 0x3FE114253DA97D9F    //log(1/frcpa(1+ 180/256)
-data8 0x3FE128A24F1D9AFF    //log(1/frcpa(1+ 181/256)
-data8 0x3FE1365252BF0865    //log(1/frcpa(1+ 182/256)
-data8 0x3FE14AE558B4A92D    //log(1/frcpa(1+ 183/256)
-data8 0x3FE15F85A19C765B    //log(1/frcpa(1+ 184/256)
-data8 0x3FE16D4D38C119FA    //log(1/frcpa(1+ 185/256)
-data8 0x3FE18203C20DD133    //log(1/frcpa(1+ 186/256)
-data8 0x3FE196C7BC4B1F3B    //log(1/frcpa(1+ 187/256)
-data8 0x3FE1A4A738B7A33C    //log(1/frcpa(1+ 188/256)
-data8 0x3FE1B981C0C9653D    //log(1/frcpa(1+ 189/256)
-data8 0x3FE1CE69E8BB106B    //log(1/frcpa(1+ 190/256)
-data8 0x3FE1DC619DE06944    //log(1/frcpa(1+ 191/256)
-data8 0x3FE1F160A2AD0DA4    //log(1/frcpa(1+ 192/256)
-data8 0x3FE2066D7740737E    //log(1/frcpa(1+ 193/256)
-data8 0x3FE2147DBA47A394    //log(1/frcpa(1+ 194/256)
-data8 0x3FE229A1BC5EBAC3    //log(1/frcpa(1+ 195/256)
-data8 0x3FE237C1841A502E    //log(1/frcpa(1+ 196/256)
-data8 0x3FE24CFCE6F80D9A    //log(1/frcpa(1+ 197/256)
-data8 0x3FE25B2C55CD5762    //log(1/frcpa(1+ 198/256)
-data8 0x3FE2707F4D5F7C41    //log(1/frcpa(1+ 199/256)
-data8 0x3FE285E0842CA384    //log(1/frcpa(1+ 200/256)
-data8 0x3FE294294708B773    //log(1/frcpa(1+ 201/256)
-data8 0x3FE2A9A2670AFF0C    //log(1/frcpa(1+ 202/256)
-data8 0x3FE2B7FB2C8D1CC1    //log(1/frcpa(1+ 203/256)
-data8 0x3FE2C65A6395F5F5    //log(1/frcpa(1+ 204/256)
-data8 0x3FE2DBF557B0DF43    //log(1/frcpa(1+ 205/256)
-data8 0x3FE2EA64C3F97655    //log(1/frcpa(1+ 206/256)
-data8 0x3FE3001823684D73    //log(1/frcpa(1+ 207/256)
-data8 0x3FE30E97E9A8B5CD    //log(1/frcpa(1+ 208/256)
-data8 0x3FE32463EBDD34EA    //log(1/frcpa(1+ 209/256)
-data8 0x3FE332F4314AD796    //log(1/frcpa(1+ 210/256)
-data8 0x3FE348D90E7464D0    //log(1/frcpa(1+ 211/256)
-data8 0x3FE35779F8C43D6E    //log(1/frcpa(1+ 212/256)
-data8 0x3FE36621961A6A99    //log(1/frcpa(1+ 213/256)
-data8 0x3FE37C299F3C366A    //log(1/frcpa(1+ 214/256)
-data8 0x3FE38AE2171976E7    //log(1/frcpa(1+ 215/256)
-data8 0x3FE399A157A603E7    //log(1/frcpa(1+ 216/256)
-data8 0x3FE3AFCCFE77B9D1    //log(1/frcpa(1+ 217/256)
-data8 0x3FE3BE9D503533B5    //log(1/frcpa(1+ 218/256)
-data8 0x3FE3CD7480B4A8A3    //log(1/frcpa(1+ 219/256)
-data8 0x3FE3E3C43918F76C    //log(1/frcpa(1+ 220/256)
-data8 0x3FE3F2ACB27ED6C7    //log(1/frcpa(1+ 221/256)
-data8 0x3FE4019C2125CA93    //log(1/frcpa(1+ 222/256)
-data8 0x3FE4181061389722    //log(1/frcpa(1+ 223/256)
-data8 0x3FE42711518DF545    //log(1/frcpa(1+ 224/256)
-data8 0x3FE436194E12B6BF    //log(1/frcpa(1+ 225/256)
-data8 0x3FE445285D68EA69    //log(1/frcpa(1+ 226/256)
-data8 0x3FE45BCC464C893A    //log(1/frcpa(1+ 227/256)
-data8 0x3FE46AED21F117FC    //log(1/frcpa(1+ 228/256)
-data8 0x3FE47A1527E8A2D3    //log(1/frcpa(1+ 229/256)
-data8 0x3FE489445EFFFCCC    //log(1/frcpa(1+ 230/256)
-data8 0x3FE4A018BCB69835    //log(1/frcpa(1+ 231/256)
-data8 0x3FE4AF5A0C9D65D7    //log(1/frcpa(1+ 232/256)
-data8 0x3FE4BEA2A5BDBE87    //log(1/frcpa(1+ 233/256)
-data8 0x3FE4CDF28F10AC46    //log(1/frcpa(1+ 234/256)
-data8 0x3FE4DD49CF994058    //log(1/frcpa(1+ 235/256)
-data8 0x3FE4ECA86E64A684    //log(1/frcpa(1+ 236/256)
-data8 0x3FE503C43CD8EB68    //log(1/frcpa(1+ 237/256)
-data8 0x3FE513356667FC57    //log(1/frcpa(1+ 238/256)
-data8 0x3FE522AE0738A3D8    //log(1/frcpa(1+ 239/256)
-data8 0x3FE5322E26867857    //log(1/frcpa(1+ 240/256)
-data8 0x3FE541B5CB979809    //log(1/frcpa(1+ 241/256)
-data8 0x3FE55144FDBCBD62    //log(1/frcpa(1+ 242/256)
-data8 0x3FE560DBC45153C7    //log(1/frcpa(1+ 243/256)
-data8 0x3FE5707A26BB8C66    //log(1/frcpa(1+ 244/256)
-data8 0x3FE587F60ED5B900    //log(1/frcpa(1+ 245/256)
-data8 0x3FE597A7977C8F31    //log(1/frcpa(1+ 246/256)
-data8 0x3FE5A760D634BB8B    //log(1/frcpa(1+ 247/256)
-data8 0x3FE5B721D295F10F    //log(1/frcpa(1+ 248/256)
-data8 0x3FE5C6EA94431EF9    //log(1/frcpa(1+ 249/256)
-data8 0x3FE5D6BB22EA86F6    //log(1/frcpa(1+ 250/256)
-data8 0x3FE5E6938645D390    //log(1/frcpa(1+ 251/256)
-data8 0x3FE5F673C61A2ED2    //log(1/frcpa(1+ 252/256)
-data8 0x3FE6065BEA385926    //log(1/frcpa(1+ 253/256)
-data8 0x3FE6164BFA7CC06B    //log(1/frcpa(1+ 254/256)
-data8 0x3FE62643FECF9743    //log(1/frcpa(1+ 255/256)
-ASM_SIZE_DIRECTIVE(log_table_2)
-
-   
-.align 32
-.global logf#
-.global log10f#
-
-// log10 has p7 true, p8 false
-// log   has p8 true, p7 false
-
+LOCAL_OBJECT_START(logf_data)
+data8 0x3FF0000000000000 // 1.0
+//
+// ln(1/frcpa(1+i/256)), i=0...255
+data8 0x3F60040155D5889E // 0
+data8 0x3F78121214586B54 // 1
+data8 0x3F841929F96832F0 // 2
+data8 0x3F8C317384C75F06 // 3
+data8 0x3F91A6B91AC73386 // 4
+data8 0x3F95BA9A5D9AC039 // 5
+data8 0x3F99D2A8074325F4 // 6
+data8 0x3F9D6B2725979802 // 7
+data8 0x3FA0C58FA19DFAAA // 8
+data8 0x3FA2954C78CBCE1B // 9
+data8 0x3FA4A94D2DA96C56 // 10
+data8 0x3FA67C94F2D4BB58 // 11
+data8 0x3FA85188B630F068 // 12
+data8 0x3FAA6B8ABE73AF4C // 13
+data8 0x3FAC441E06F72A9E // 14
+data8 0x3FAE1E6713606D07 // 15
+data8 0x3FAFFA6911AB9301 // 16
+data8 0x3FB0EC139C5DA601 // 17
+data8 0x3FB1DBD2643D190B // 18
+data8 0x3FB2CC7284FE5F1C // 19
+data8 0x3FB3BDF5A7D1EE64 // 20
+data8 0x3FB4B05D7AA012E0 // 21
+data8 0x3FB580DB7CEB5702 // 22
+data8 0x3FB674F089365A7A // 23
+data8 0x3FB769EF2C6B568D // 24
+data8 0x3FB85FD927506A48 // 25
+data8 0x3FB9335E5D594989 // 26
+data8 0x3FBA2B0220C8E5F5 // 27
+data8 0x3FBB0004AC1A86AC // 28
+data8 0x3FBBF968769FCA11 // 29
+data8 0x3FBCCFEDBFEE13A8 // 30
+data8 0x3FBDA727638446A2 // 31
+data8 0x3FBEA3257FE10F7A // 32
+data8 0x3FBF7BE9FEDBFDE6 // 33
+data8 0x3FC02AB352FF25F4 // 34
+data8 0x3FC097CE579D204D // 35
+data8 0x3FC1178E8227E47C // 36
+data8 0x3FC185747DBECF34 // 37
+data8 0x3FC1F3B925F25D41 // 38
+data8 0x3FC2625D1E6DDF57 // 39
+data8 0x3FC2D1610C86813A // 40
+data8 0x3FC340C59741142E // 41
+data8 0x3FC3B08B6757F2A9 // 42
+data8 0x3FC40DFB08378003 // 43
+data8 0x3FC47E74E8CA5F7C // 44
+data8 0x3FC4EF51F6466DE4 // 45
+data8 0x3FC56092E02BA516 // 46
+data8 0x3FC5D23857CD74D5 // 47
+data8 0x3FC6313A37335D76 // 48
+data8 0x3FC6A399DABBD383 // 49
+data8 0x3FC70337DD3CE41B // 50
+data8 0x3FC77654128F6127 // 51
+data8 0x3FC7E9D82A0B022D // 52
+data8 0x3FC84A6B759F512F // 53
+data8 0x3FC8AB47D5F5A310 // 54
+data8 0x3FC91FE49096581B // 55
+data8 0x3FC981634011AA75 // 56
+data8 0x3FC9F6C407089664 // 57
+data8 0x3FCA58E729348F43 // 58
+data8 0x3FCABB55C31693AD // 59
+data8 0x3FCB1E104919EFD0 // 60
+data8 0x3FCB94EE93E367CB // 61
+data8 0x3FCBF851C067555F // 62
+data8 0x3FCC5C0254BF23A6 // 63
+data8 0x3FCCC000C9DB3C52 // 64
+data8 0x3FCD244D99C85674 // 65
+data8 0x3FCD88E93FB2F450 // 66
+data8 0x3FCDEDD437EAEF01 // 67
+data8 0x3FCE530EFFE71012 // 68
+data8 0x3FCEB89A1648B971 // 69
+data8 0x3FCF1E75FADF9BDE // 70
+data8 0x3FCF84A32EAD7C35 // 71
+data8 0x3FCFEB2233EA07CD // 72
+data8 0x3FD028F9C7035C1C // 73
+data8 0x3FD05C8BE0D9635A // 74
+data8 0x3FD085EB8F8AE797 // 75
+data8 0x3FD0B9C8E32D1911 // 76
+data8 0x3FD0EDD060B78081 // 77
+data8 0x3FD122024CF0063F // 78
+data8 0x3FD14BE2927AECD4 // 79
+data8 0x3FD180618EF18ADF // 80
+data8 0x3FD1B50BBE2FC63B // 81
+data8 0x3FD1DF4CC7CF242D // 82
+data8 0x3FD214456D0EB8D4 // 83
+data8 0x3FD23EC5991EBA49 // 84
+data8 0x3FD2740D9F870AFB // 85
+data8 0x3FD29ECDABCDFA04 // 86
+data8 0x3FD2D46602ADCCEE // 87
+data8 0x3FD2FF66B04EA9D4 // 88
+data8 0x3FD335504B355A37 // 89
+data8 0x3FD360925EC44F5D // 90
+data8 0x3FD38BF1C3337E75 // 91
+data8 0x3FD3C25277333184 // 92
+data8 0x3FD3EDF463C1683E // 93
+data8 0x3FD419B423D5E8C7 // 94
+data8 0x3FD44591E0539F49 // 95
+data8 0x3FD47C9175B6F0AD // 96
+data8 0x3FD4A8B341552B09 // 97
+data8 0x3FD4D4F3908901A0 // 98
+data8 0x3FD501528DA1F968 // 99
+data8 0x3FD52DD06347D4F6 // 100
+data8 0x3FD55A6D3C7B8A8A // 101
+data8 0x3FD5925D2B112A59 // 102
+data8 0x3FD5BF406B543DB2 // 103
+data8 0x3FD5EC433D5C35AE // 104
+data8 0x3FD61965CDB02C1F // 105
+data8 0x3FD646A84935B2A2 // 106
+data8 0x3FD6740ADD31DE94 // 107
+data8 0x3FD6A18DB74A58C5 // 108
+data8 0x3FD6CF31058670EC // 109
+data8 0x3FD6F180E852F0BA // 110
+data8 0x3FD71F5D71B894F0 // 111
+data8 0x3FD74D5AEFD66D5C // 112
+data8 0x3FD77B79922BD37E // 113
+data8 0x3FD7A9B9889F19E2 // 114
+data8 0x3FD7D81B037EB6A6 // 115
+data8 0x3FD8069E33827231 // 116
+data8 0x3FD82996D3EF8BCB // 117
+data8 0x3FD85855776DCBFB // 118
+data8 0x3FD8873658327CCF // 119
+data8 0x3FD8AA75973AB8CF // 120
+data8 0x3FD8D992DC8824E5 // 121
+data8 0x3FD908D2EA7D9512 // 122
+data8 0x3FD92C59E79C0E56 // 123
+data8 0x3FD95BD750EE3ED3 // 124
+data8 0x3FD98B7811A3EE5B // 125
+data8 0x3FD9AF47F33D406C // 126
+data8 0x3FD9DF270C1914A8 // 127
+data8 0x3FDA0325ED14FDA4 // 128
+data8 0x3FDA33440224FA79 // 129
+data8 0x3FDA57725E80C383 // 130
+data8 0x3FDA87D0165DD199 // 131
+data8 0x3FDAAC2E6C03F896 // 132
+data8 0x3FDADCCC6FDF6A81 // 133
+data8 0x3FDB015B3EB1E790 // 134
+data8 0x3FDB323A3A635948 // 135
+data8 0x3FDB56FA04462909 // 136
+data8 0x3FDB881AA659BC93 // 137
+data8 0x3FDBAD0BEF3DB165 // 138
+data8 0x3FDBD21297781C2F // 139
+data8 0x3FDC039236F08819 // 140
+data8 0x3FDC28CB1E4D32FD // 141
+data8 0x3FDC4E19B84723C2 // 142
+data8 0x3FDC7FF9C74554C9 // 143
+data8 0x3FDCA57B64E9DB05 // 144
+data8 0x3FDCCB130A5CEBB0 // 145
+data8 0x3FDCF0C0D18F326F // 146
+data8 0x3FDD232075B5A201 // 147
+data8 0x3FDD490246DEFA6B // 148
+data8 0x3FDD6EFA918D25CD // 149
+data8 0x3FDD9509707AE52F // 150
+data8 0x3FDDBB2EFE92C554 // 151
+data8 0x3FDDEE2F3445E4AF // 152
+data8 0x3FDE148A1A2726CE // 153
+data8 0x3FDE3AFC0A49FF40 // 154
+data8 0x3FDE6185206D516E // 155
+data8 0x3FDE882578823D52 // 156
+data8 0x3FDEAEDD2EAC990C // 157
+data8 0x3FDED5AC5F436BE3 // 158
+data8 0x3FDEFC9326D16AB9 // 159
+data8 0x3FDF2391A2157600 // 160
+data8 0x3FDF4AA7EE03192D // 161
+data8 0x3FDF71D627C30BB0 // 162
+data8 0x3FDF991C6CB3B379 // 163
+data8 0x3FDFC07ADA69A910 // 164
+data8 0x3FDFE7F18EB03D3E // 165
+data8 0x3FE007C053C5002E // 166
+data8 0x3FE01B942198A5A1 // 167
+data8 0x3FE02F74400C64EB // 168
+data8 0x3FE04360BE7603AD // 169
+data8 0x3FE05759AC47FE34 // 170
+data8 0x3FE06B5F1911CF52 // 171
+data8 0x3FE078BF0533C568 // 172
+data8 0x3FE08CD9687E7B0E // 173
+data8 0x3FE0A10074CF9019 // 174
+data8 0x3FE0B5343A234477 // 175
+data8 0x3FE0C974C89431CE // 176
+data8 0x3FE0DDC2305B9886 // 177
+data8 0x3FE0EB524BAFC918 // 178
+data8 0x3FE0FFB54213A476 // 179
+data8 0x3FE114253DA97D9F // 180
+data8 0x3FE128A24F1D9AFF // 181
+data8 0x3FE1365252BF0865 // 182
+data8 0x3FE14AE558B4A92D // 183
+data8 0x3FE15F85A19C765B // 184
+data8 0x3FE16D4D38C119FA // 185
+data8 0x3FE18203C20DD133 // 186
+data8 0x3FE196C7BC4B1F3B // 187
+data8 0x3FE1A4A738B7A33C // 188
+data8 0x3FE1B981C0C9653D // 189
+data8 0x3FE1CE69E8BB106B // 190
+data8 0x3FE1DC619DE06944 // 191
+data8 0x3FE1F160A2AD0DA4 // 192
+data8 0x3FE2066D7740737E // 193
+data8 0x3FE2147DBA47A394 // 194
+data8 0x3FE229A1BC5EBAC3 // 195
+data8 0x3FE237C1841A502E // 196
+data8 0x3FE24CFCE6F80D9A // 197
+data8 0x3FE25B2C55CD5762 // 198
+data8 0x3FE2707F4D5F7C41 // 199
+data8 0x3FE285E0842CA384 // 200
+data8 0x3FE294294708B773 // 201
+data8 0x3FE2A9A2670AFF0C // 202
+data8 0x3FE2B7FB2C8D1CC1 // 203
+data8 0x3FE2C65A6395F5F5 // 204
+data8 0x3FE2DBF557B0DF43 // 205
+data8 0x3FE2EA64C3F97655 // 206
+data8 0x3FE3001823684D73 // 207
+data8 0x3FE30E97E9A8B5CD // 208
+data8 0x3FE32463EBDD34EA // 209
+data8 0x3FE332F4314AD796 // 210
+data8 0x3FE348D90E7464D0 // 211
+data8 0x3FE35779F8C43D6E // 212
+data8 0x3FE36621961A6A99 // 213
+data8 0x3FE37C299F3C366A // 214
+data8 0x3FE38AE2171976E7 // 215
+data8 0x3FE399A157A603E7 // 216
+data8 0x3FE3AFCCFE77B9D1 // 217
+data8 0x3FE3BE9D503533B5 // 218
+data8 0x3FE3CD7480B4A8A3 // 219
+data8 0x3FE3E3C43918F76C // 220
+data8 0x3FE3F2ACB27ED6C7 // 221
+data8 0x3FE4019C2125CA93 // 222
+data8 0x3FE4181061389722 // 223
+data8 0x3FE42711518DF545 // 224
+data8 0x3FE436194E12B6BF // 225
+data8 0x3FE445285D68EA69 // 226
+data8 0x3FE45BCC464C893A // 227
+data8 0x3FE46AED21F117FC // 228
+data8 0x3FE47A1527E8A2D3 // 229
+data8 0x3FE489445EFFFCCC // 230
+data8 0x3FE4A018BCB69835 // 231
+data8 0x3FE4AF5A0C9D65D7 // 232
+data8 0x3FE4BEA2A5BDBE87 // 233
+data8 0x3FE4CDF28F10AC46 // 234
+data8 0x3FE4DD49CF994058 // 235
+data8 0x3FE4ECA86E64A684 // 236
+data8 0x3FE503C43CD8EB68 // 237
+data8 0x3FE513356667FC57 // 238
+data8 0x3FE522AE0738A3D8 // 239
+data8 0x3FE5322E26867857 // 240
+data8 0x3FE541B5CB979809 // 241
+data8 0x3FE55144FDBCBD62 // 242
+data8 0x3FE560DBC45153C7 // 243
+data8 0x3FE5707A26BB8C66 // 244
+data8 0x3FE587F60ED5B900 // 245
+data8 0x3FE597A7977C8F31 // 246
+data8 0x3FE5A760D634BB8B // 247
+data8 0x3FE5B721D295F10F // 248
+data8 0x3FE5C6EA94431EF9 // 249
+data8 0x3FE5D6BB22EA86F6 // 250
+data8 0x3FE5E6938645D390 // 251
+data8 0x3FE5F673C61A2ED2 // 252
+data8 0x3FE6065BEA385926 // 253
+data8 0x3FE6164BFA7CC06B // 254
+data8 0x3FE62643FECF9743 // 255
+LOCAL_OBJECT_END(logf_data)
+
+LOCAL_OBJECT_START(log10f_data)
+data8 0x3FDBCB7B1526E50E // 1/ln(10)
+//
+// ln(1/frcpa(1+i/256))/ln(10), i=0...255
+data8 0x3F4BD27045BFD025 // 0
+data8 0x3F64E84E793A474A // 1
+data8 0x3F7175085AB85FF0 // 2
+data8 0x3F787CFF9D9147A5 // 3
+data8 0x3F7EA9D372B89FC8 // 4
+data8 0x3F82DF9D95DA961C // 5
+data8 0x3F866DF172D6372C // 6
+data8 0x3F898D79EF5EEDF0 // 7
+data8 0x3F8D22ADF3F9579D // 8
+data8 0x3F9024231D30C398 // 9
+data8 0x3F91F23A98897D4A // 10
+data8 0x3F93881A7B818F9E // 11
+data8 0x3F951F6E1E759E35 // 12
+data8 0x3F96F2BCE7ADC5B4 // 13
+data8 0x3F988D362CDF359E // 14
+data8 0x3F9A292BAF010982 // 15
+data8 0x3F9BC6A03117EB97 // 16
+data8 0x3F9D65967DE3AB09 // 17
+data8 0x3F9F061167FC31E8 // 18
+data8 0x3FA05409E4F7819C // 19
+data8 0x3FA125D0432EA20E // 20
+data8 0x3FA1F85D440D299B // 21
+data8 0x3FA2AD755749617D // 22
+data8 0x3FA381772A00E604 // 23
+data8 0x3FA45643E165A70B // 24
+data8 0x3FA52BDD034475B8 // 25
+data8 0x3FA5E3966B7E9295 // 26
+data8 0x3FA6BAAF47C5B245 // 27
+data8 0x3FA773B3E8C4F3C8 // 28
+data8 0x3FA84C51EBEE8D15 // 29
+data8 0x3FA906A6786FC1CB // 30
+data8 0x3FA9C197ABF00DD7 // 31
+data8 0x3FAA9C78712191F7 // 32
+data8 0x3FAB58C09C8D637C // 33
+data8 0x3FAC15A8BCDD7B7E // 34
+data8 0x3FACD331E2C2967C // 35
+data8 0x3FADB11ED766ABF4 // 36
+data8 0x3FAE70089346A9E6 // 37
+data8 0x3FAF2F96C6754AEE // 38
+data8 0x3FAFEFCA8D451FD6 // 39
+data8 0x3FB0585283764178 // 40
+data8 0x3FB0B913AAC7D3A7 // 41
+data8 0x3FB11A294F2569F6 // 42
+data8 0x3FB16B51A2696891 // 43
+data8 0x3FB1CD03ADACC8BE // 44
+data8 0x3FB22F0BDD7745F5 // 45
+data8 0x3FB2916ACA38D1E8 // 46
+data8 0x3FB2F4210DF7663D // 47
+data8 0x3FB346A6C3C49066 // 48
+data8 0x3FB3A9FEBC60540A // 49
+data8 0x3FB3FD0C10A3AA54 // 50
+data8 0x3FB46107D3540A82 // 51
+data8 0x3FB4C55DD16967FE // 52
+data8 0x3FB51940330C000B // 53
+data8 0x3FB56D620EE7115E // 54
+data8 0x3FB5D2ABCF26178E // 55
+data8 0x3FB6275AA5DEBF81 // 56
+data8 0x3FB68D4EAF26D7EE // 57
+data8 0x3FB6E28C5C54A28D // 58
+data8 0x3FB7380B9665B7C8 // 59
+data8 0x3FB78DCCC278E85B // 60
+data8 0x3FB7F50C2CF2557A // 61
+data8 0x3FB84B5FD5EAEFD8 // 62
+data8 0x3FB8A1F6BAB2B226 // 63
+data8 0x3FB8F8D144557BDF // 64
+data8 0x3FB94FEFDCD61D92 // 65
+data8 0x3FB9A752EF316149 // 66
+data8 0x3FB9FEFAE7611EE0 // 67
+data8 0x3FBA56E8325F5C87 // 68
+data8 0x3FBAAF1B3E297BB4 // 69
+data8 0x3FBB079479C372AD // 70
+data8 0x3FBB6054553B12F7 // 71
+data8 0x3FBBB95B41AB5CE6 // 72
+data8 0x3FBC12A9B13FE079 // 73
+data8 0x3FBC6C4017382BEA // 74
+data8 0x3FBCB41FBA42686D // 75
+data8 0x3FBD0E38CE73393F // 76
+data8 0x3FBD689B2193F133 // 77
+data8 0x3FBDC3472B1D2860 // 78
+data8 0x3FBE0C06300D528B // 79
+data8 0x3FBE6738190E394C // 80
+data8 0x3FBEC2B50D208D9B // 81
+data8 0x3FBF0C1C2B936828 // 82
+data8 0x3FBF68216C9CC727 // 83
+data8 0x3FBFB1F6381856F4 // 84
+data8 0x3FC00742AF4CE5F8 // 85
+data8 0x3FC02C64906512D2 // 86
+data8 0x3FC05AF1E63E03B4 // 87
+data8 0x3FC0804BEA723AA9 // 88
+data8 0x3FC0AF1FD6711527 // 89
+data8 0x3FC0D4B2A8805A00 // 90
+data8 0x3FC0FA5EF136A06C // 91
+data8 0x3FC1299A4FB3E306 // 92
+data8 0x3FC14F806253C3ED // 93
+data8 0x3FC175805D1587C1 // 94
+data8 0x3FC19B9A637CA295 // 95
+data8 0x3FC1CB5FC26EDE17 // 96
+data8 0x3FC1F1B4E65F2590 // 97
+data8 0x3FC218248B5DC3E5 // 98
+data8 0x3FC23EAED62ADC76 // 99
+data8 0x3FC26553EBD337BD // 100
+data8 0x3FC28C13F1B11900 // 101
+data8 0x3FC2BCAA14381386 // 102
+data8 0x3FC2E3A740B7800F // 103
+data8 0x3FC30ABFD8F333B6 // 104
+data8 0x3FC331F403985097 // 105
+data8 0x3FC35943E7A60690 // 106
+data8 0x3FC380AFAC6E7C07 // 107
+data8 0x3FC3A8377997B9E6 // 108
+data8 0x3FC3CFDB771C9ADB // 109
+data8 0x3FC3EDA90D39A5DF // 110
+data8 0x3FC4157EC09505CD // 111
+data8 0x3FC43D7113FB04C1 // 112
+data8 0x3FC4658030AD1CCF // 113
+data8 0x3FC48DAC404638F6 // 114
+data8 0x3FC4B5F56CBBB869 // 115
+data8 0x3FC4DE5BE05E7583 // 116
+data8 0x3FC4FCBC0776FD85 // 117
+data8 0x3FC525561E9256EE // 118
+data8 0x3FC54E0DF3198865 // 119
+data8 0x3FC56CAB7112BDE2 // 120
+data8 0x3FC59597BA735B15 // 121
+data8 0x3FC5BEA23A506FDA // 122
+data8 0x3FC5DD7E08DE382F // 123
+data8 0x3FC606BDD3F92355 // 124
+data8 0x3FC6301C518A501F // 125
+data8 0x3FC64F3770618916 // 126
+data8 0x3FC678CC14C1E2D8 // 127
+data8 0x3FC6981005ED2947 // 128
+data8 0x3FC6C1DB5F9BB336 // 129
+data8 0x3FC6E1488ECD2881 // 130
+data8 0x3FC70B4B2E7E41B9 // 131
+data8 0x3FC72AE209146BF9 // 132
+data8 0x3FC7551C81BD8DCF // 133
+data8 0x3FC774DD76CC43BE // 134
+data8 0x3FC79F505DB00E88 // 135
+data8 0x3FC7BF3BDE099F30 // 136
+data8 0x3FC7E9E7CAC437F9 // 137
+data8 0x3FC809FE4902D00D // 138
+data8 0x3FC82A2757995CBE // 139
+data8 0x3FC85525C625E098 // 140
+data8 0x3FC8757A79831887 // 141
+data8 0x3FC895E2058D8E03 // 142
+data8 0x3FC8C13437695532 // 143
+data8 0x3FC8E1C812EF32BE // 144
+data8 0x3FC9026F112197E8 // 145
+data8 0x3FC923294888880B // 146
+data8 0x3FC94EEA4B8334F3 // 147
+data8 0x3FC96FD1B639FC09 // 148
+data8 0x3FC990CCA66229AC // 149
+data8 0x3FC9B1DB33334843 // 150
+data8 0x3FC9D2FD740E6607 // 151
+data8 0x3FC9FF49EEDCB553 // 152
+data8 0x3FCA209A84FBCFF8 // 153
+data8 0x3FCA41FF1E43F02B // 154
+data8 0x3FCA6377D2CE9378 // 155
+data8 0x3FCA8504BAE0D9F6 // 156
+data8 0x3FCAA6A5EEEBEFE3 // 157
+data8 0x3FCAC85B878D7879 // 158
+data8 0x3FCAEA259D8FFA0B // 159
+data8 0x3FCB0C0449EB4B6B // 160
+data8 0x3FCB2DF7A5C50299 // 161
+data8 0x3FCB4FFFCA70E4D1 // 162
+data8 0x3FCB721CD17157E3 // 163
+data8 0x3FCB944ED477D4ED // 164
+data8 0x3FCBB695ED655C7D // 165
+data8 0x3FCBD8F2364AEC0F // 166
+data8 0x3FCBFB63C969F4FF // 167
+data8 0x3FCC1DEAC134D4E9 // 168
+data8 0x3FCC4087384F4F80 // 169
+data8 0x3FCC6339498F09E2 // 170
+data8 0x3FCC86010FFC076C // 171
+data8 0x3FCC9D3D065C5B42 // 172
+data8 0x3FCCC029375BA07A // 173
+data8 0x3FCCE32B66978BA4 // 174
+data8 0x3FCD0643AFD51404 // 175
+data8 0x3FCD29722F0DEA45 // 176
+data8 0x3FCD4CB70070FE44 // 177
+data8 0x3FCD6446AB3F8C96 // 178
+data8 0x3FCD87B0EF71DB45 // 179
+data8 0x3FCDAB31D1FE99A7 // 180
+data8 0x3FCDCEC96FDC888F // 181
+data8 0x3FCDE6908876357A // 182
+data8 0x3FCE0A4E4A25C200 // 183
+data8 0x3FCE2E2315755E33 // 184
+data8 0x3FCE461322D1648A // 185
+data8 0x3FCE6A0E95C7787B // 186
+data8 0x3FCE8E216243DD60 // 187
+data8 0x3FCEA63AF26E007C // 188
+data8 0x3FCECA74ED15E0B7 // 189
+data8 0x3FCEEEC692CCD25A // 190
+data8 0x3FCF070A36B8D9C1 // 191
+data8 0x3FCF2B8393E34A2D // 192
+data8 0x3FCF5014EF538A5B // 193
+data8 0x3FCF68833AF1B180 // 194
+data8 0x3FCF8D3CD9F3F04F // 195
+data8 0x3FCFA5C61ADD93E9 // 196
+data8 0x3FCFCAA8567EBA7A // 197
+data8 0x3FCFE34CC8743DD8 // 198
+data8 0x3FD0042BFD74F519 // 199
+data8 0x3FD016BDF6A18017 // 200
+data8 0x3FD023262F907322 // 201
+data8 0x3FD035CCED8D32A1 // 202
+data8 0x3FD042430E869FFC // 203
+data8 0x3FD04EBEC842B2E0 // 204
+data8 0x3FD06182E84FD4AC // 205
+data8 0x3FD06E0CB609D383 // 206
+data8 0x3FD080E60BEC8F12 // 207
+data8 0x3FD08D7E0D894735 // 208
+data8 0x3FD0A06CC96A2056 // 209
+data8 0x3FD0AD131F3B3C55 // 210
+data8 0x3FD0C01771E775FB // 211
+data8 0x3FD0CCCC3CAD6F4B // 212
+data8 0x3FD0D986D91A34A9 // 213
+data8 0x3FD0ECA9B8861A2D // 214
+data8 0x3FD0F972F87FF3D6 // 215
+data8 0x3FD106421CF0E5F7 // 216
+data8 0x3FD11983EBE28A9D // 217
+data8 0x3FD12661E35B785A // 218
+data8 0x3FD13345D2779D3B // 219
+data8 0x3FD146A6F597283A // 220
+data8 0x3FD15399E81EA83D // 221
+data8 0x3FD16092E5D3A9A6 // 222
+data8 0x3FD17413C3B7AB5E // 223
+data8 0x3FD1811BF629D6FB // 224
+data8 0x3FD18E2A47B46686 // 225
+data8 0x3FD19B3EBE1A4418 // 226
+data8 0x3FD1AEE9017CB450 // 227
+data8 0x3FD1BC0CED7134E2 // 228
+data8 0x3FD1C93712ABC7FF // 229
+data8 0x3FD1D66777147D3F // 230
+data8 0x3FD1EA3BD1286E1C // 231
+data8 0x3FD1F77BED932C4C // 232
+data8 0x3FD204C25E1B031F // 233
+data8 0x3FD2120F28CE69B1 // 234
+data8 0x3FD21F6253C48D01 // 235
+data8 0x3FD22CBBE51D60AA // 236
+data8 0x3FD240CE4C975444 // 237
+data8 0x3FD24E37F8ECDAE8 // 238
+data8 0x3FD25BA8215AF7FC // 239
+data8 0x3FD2691ECC29F042 // 240
+data8 0x3FD2769BFFAB2E00 // 241
+data8 0x3FD2841FC23952C9 // 242
+data8 0x3FD291AA1A384978 // 243
+data8 0x3FD29F3B0E15584B // 244
+data8 0x3FD2B3A0EE479DF7 // 245
+data8 0x3FD2C142842C09E6 // 246
+data8 0x3FD2CEEACCB7BD6D // 247
+data8 0x3FD2DC99CE82FF21 // 248
+data8 0x3FD2EA4F902FD7DA // 249
+data8 0x3FD2F80C186A25FD // 250
+data8 0x3FD305CF6DE7B0F7 // 251
+data8 0x3FD3139997683CE7 // 252
+data8 0x3FD3216A9BB59E7C // 253
+data8 0x3FD32F4281A3CEFF // 254
+data8 0x3FD33D2150110092 // 255
+LOCAL_OBJECT_END(log10f_data)
+
+
+// Code
+//==============================================================
 .section .text
-.proc  log10f#
-.align 32
 
-log10f: 
-#ifdef _LIBC
-.global __ieee754_log10f
-.type __ieee754_log10f,@function
-__ieee754_log10f:
-#endif
-{ .mfi
-     alloc     r32=ar.pfs,1,15,4,0                    
-     frcpa.s1  log_C,p9 = f1,f8                 
-     cmp.eq.unc     p7,p8         = r0, r0 
-}
-{ .mfb
-     addl           log_AD_1   = @ltoff(log_table_1), gp
-     fnorm.s1 log_NORM_f8 = f8 
-     br.sptk        L(LOG_LOG10_X) 
-}
-;;
-
-.endp log10f
-ASM_SIZE_DIRECTIVE(log10f)
-ASM_SIZE_DIRECTIVE(__ieee754_log10f)
+// logf   has p13 true, p14 false
+// log10f has p14 true, p13 false
 
-
-
-.section .text
-.proc  logf#
-.align 32
-logf: 
-#ifdef _LIBC
-.global __ieee754_logf
-.type __ieee754_logf,@function
-__ieee754_logf:
-#endif
-
-{ .mfi
-     alloc     r32=ar.pfs,1,15,4,0                    
-     frcpa.s1  log_C,p9 = f1,f8                 
-     cmp.eq.unc     p8,p7         = r0, r0 
-}
+GLOBAL_IEEE754_ENTRY(log10f)
 { .mfi
-     addl           log_AD_1   = @ltoff(log_table_1), gp
-     fnorm.s1 log_NORM_f8 = f8 
-     nop.i 999
+      getf.exp      GR_Exp = f8 // if x is unorm then must recompute
+      frcpa.s1      FR_RcpX,p0 = f1,f8
+      mov           GR_05 = 0xFFFE // biased exponent of A2=0.5
 }
-;;
-
-L(LOG_LOG10_X):
-
+{ .mlx
+      addl          GR_ad_T = @ltoff(log10f_data),gp
+      movl          GR_A3 = 0x3FD5555555555555 // double precision memory
+                                               // representation of A3
+};;
 { .mfi
-     getf.exp   log_GR_signexp_f8 = f8 // If x unorm then must recompute
-     fclass.m.unc p15,p0 = f8, 0x0b            // Test for x=unorm
-     mov        log_GR_fff7 = 0xfff7
+      getf.sig      GR_Sig = f8 // if x is unorm then must recompute
+      fclass.m      p8,p0 = f8,9 // is x positive unorm?
+      sub           GR_025 = GR_05,r0,1 // biased exponent of A4=0.25
 }
+{ .mlx
+      ld8           GR_ad_T = [GR_ad_T]
+      movl          GR_Ln2 = 0x3FD34413509F79FF // double precision memory
+                                                // representation of
+                                                // log(2)/ln(10)
+};;
 { .mfi
-     ld8 log_AD_1 = [log_AD_1]
-     fms.s1     log_w = f8,f1,f1              
-     mov       log_GR_exp_17_ones = 0x1ffff
-}
-;;
-
-{ .mmi
-     getf.sig   log_GR_significand_f8 = f8 // If x unorm then must recompute
-     mov       log_GR_exp_16_ones = 0xffff
-     nop.i 999
-}
-;;
-
-{ .mmb
-     adds log_AD_2 = 0x10, log_AD_1
-     and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones  
-(p15) br.cond.spnt L(LOG_DENORM)     
-}
-;;
-
-L(LOG_COMMON):
-{.mfi
-     ldfpd      log_P3,log_P2 = [log_AD_1],16           
-     fclass.m.unc p6,p0 = f8, 0xc3             // Test for x=nan
-     shl        log_GR_index = log_GR_significand_f8,1            
-}
-{.mfi
-     sub       log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones 
-     nop.f 999
-     nop.i 999
+      setf.d        FR_A3 = GR_A3 // create A3
+      fcmp.eq.s1    p14,p13 = f0,f0 // set p14 to 1 for log10f
+      dep.z         GR_xorg = GR_05,55,8 // 0x7F00000000000000 integer number
+                                         // bits of that are
+                                         // GR_xorg[63]   = last bit of biased
+                                         //            exponent of 255/256
+                                         // GR_xorg[62-0] = bits from 62 to 0
+                                         //            of significand of 255/256
 }
-;;
+{ .mib
+      setf.exp      FR_A2 = GR_05 // create A2
+      sub           GR_de = GR_Exp,GR_05 // biased_exponent_of_x - 0xFFFE
+                                         // needed to comparion with 0.5 and 2.0
+      br.cond.sptk  logf_log10f_common
+};;
+GLOBAL_IEEE754_END(log10f)
 
+GLOBAL_IEEE754_ENTRY(logf)
 { .mfi
-     ldfpd      log_P1,log_inv_ln10 = [log_AD_2],16           
-     fclass.m.unc p11,p0 = f8, 0x21            // Test for x=+inf
-     shr.u     log_GR_index = log_GR_index,56
+      getf.exp      GR_Exp = f8 // if x is unorm then must recompute
+      frcpa.s1      FR_RcpX,p0 = f1,f8
+      mov           GR_05 = 0xFFFE // biased exponent of A2=-0.5
 }
+{ .mlx
+      addl          GR_ad_T = @ltoff(logf_data),gp
+      movl          GR_A3 = 0x3FD5555555555555 // double precision memory
+                                               // representation of A3
+};;
 { .mfi
-     setf.sig  log_int_Nfloat = log_GR_true_exp_f8
-     nop.f 999
-     nop.i 999
+      getf.sig      GR_Sig = f8 // if x is unorm then must recompute
+      fclass.m      p8,p0 = f8,9 // is x positive unorm?
+      dep.z         GR_xorg = GR_05,55,8 // 0x7F00000000000000 integer number
+                                         // bits of that are
+                                         // GR_xorg[63]   = last bit of biased
+                                         //            exponent of 255/256
+                                         // GR_xorg[62-0] = bits from 62 to 0
+                                         //            of significand of 255/256
 }
-;;
-
-
 { .mfi
-     ldfd       log_log2 = [log_AD_2],16   
-     fma.s1     log_wsq     = log_w, log_w, f0
-     nop.i 999
-}
-{ .mfb
-     nop.m 999
-(p6) fma.s.s0   f8 = f8,f1,f0      // quietize nan result if x=nan
-(p6) br.ret.spnt b0                // Exit for x=nan
-}
-;;
-
-
+      ld8           GR_ad_T = [GR_ad_T]
+      nop.f         0
+      sub           GR_025 = GR_05,r0,1 // biased exponent of A4=0.25
+};;
 { .mfi
-     shladd log_AD_2 = log_GR_index,3,log_AD_2
-     fcmp.eq.s1 p10,p0 = log_NORM_f8, f1  // Test for x=+1.0
-     nop.i 999
-}
-{ .mfb
-     nop.m 999
-     fms.s1     log_r = log_C,f8,f1
-(p11) br.ret.spnt b0               // Exit for x=+inf
-}
-;;
-
-
-{ .mmf
-     nop.m 999
-     nop.m 999
-     fclass.m.unc p6,p0 = f8, 0x07        // Test for x=0
-}
-;;
-
-
-{ .mfb
-     ldfd       log_T = [log_AD_2]
-(p10) fmerge.s f8 = f0, f0
-(p10) br.ret.spnt b0                // Exit for x=1.0
-;;
+      setf.d        FR_A3 = GR_A3 // create A3
+      fcmp.eq.s1    p13,p14 = f0,f0 // p13 - true for logf
+      sub           GR_de = GR_Exp,GR_05 // biased_exponent_of_x - 0xFFFE
+                                         // needed to comparion with 0.5 and 2.0
 }
-
+{ .mlx
+      setf.exp      FR_A2 = GR_05 // create A2
+      movl          GR_Ln2 = 0x3FE62E42FEFA39EF // double precision memory
+                                                // representation of log(2)
+};;
+logf_log10f_common:
 { .mfi
-     getf.exp   log_GR_signexp_w = log_w
-     fclass.m.unc p12,p0 = f8, 0x3a       // Test for x neg norm, unorm, inf
-     nop.i 999
-}
-;;
-
-{ .mmb
-     nop.m 999
-     nop.m 999
-(p6) br.cond.spnt L(LOG_ZERO_NEG)      // Branch if x=0
-;;
+      setf.exp      FR_A4 = GR_025 // create A4=0.25
+      fclass.m      p9,p0 = f8,0x3A // is x < 0 (including negateve unnormals)?
+      dep           GR_x = GR_Exp,GR_Sig,63,1 // produce integer that bits are
+                                              // GR_x[63] = GR_Exp[0]
+                                              // GR_x[62-0] = GR_Sig[62-0]
 }
- 
-
+{ .mib
+      sub           GR_N = GR_Exp,GR_05,1 // unbiased exponent of x
+      cmp.gtu       p6,p7 = 2,GR_de // is 0.5 <= x < 2.0?
+(p8)  br.cond.spnt  logf_positive_unorm
+};;
+logf_core:
 { .mfi
-     and log_GR_exp_w = log_GR_exp_17_ones, log_GR_signexp_w
-     nop.f 999
-     nop.i 999
+      setf.sig      FR_N = GR_N // copy unbiased exponent of x to the
+                                // significand field of FR_N
+      fclass.m      p10,p0 = f8,0x1E1 // is x NaN, NaT or +Inf?
+      dep.z         GR_dx = GR_05,54,3 // 0x0180000000000000 - difference
+                                       // between our integer representations
+                                       // of 257/256 and 255/256
 }
-{ .mfb
-     nop.m 999
-     fma.s1     log_rsq     = log_r, log_r, f0                   
-(p12) br.cond.spnt L(LOG_ZERO_NEG)     // Branch if x<0
-;;
-}
-
 { .mfi
-     nop.m 999
-     fma.s1      log_rp_p32 = log_P3, log_r, log_P2
-     nop.i 999
-}
+      nop.m         0
+      nop.f         0
+      sub           GR_x = GR_x,GR_xorg // difference between representations
+                                        // of x and 255/256
+};;
 { .mfi
-     nop.m 999
-     fma.s1    log_rp_q32   = log_P3, log_w, log_P2
-     nop.i 999
-;;
+      ldfd          FR_InvLn10 = [GR_ad_T],8
+      fcmp.eq.s1    p11,p0 = f8,f1 // is x equal to 1.0?
+      extr.u        GR_Ind = GR_Sig,55,8 // get bits from 55 to 62 as index
 }
-
+{ .mib
+      setf.d        FR_Ln2 = GR_Ln2 // create log(2) or log10(2)
+(p6)  cmp.gtu       p6,p7 = GR_dx,GR_x // set p6 if 255/256 <= x < 257/256
+(p9)  br.cond.spnt  logf_negatives // jump if input argument is negative number
+};;
+// p6 is true if |x-1| < 1/256
+// p7 is true if |x-1| >= 1/256
+.pred.rel "mutex",p6,p7
 { .mfi
-     nop.m 999
-     fcvt.xf   log_Nfloat = log_int_Nfloat
-     nop.i 999 ;;
+      shladd        GR_ad_T = GR_Ind,3,GR_ad_T // calculate address of T
+(p7)  fms.s1        FR_r = FR_RcpX,f8,f1 // range reduction for |x-1|>=1/256
+      extr.u        GR_Exp = GR_Exp,0,17 // exponent without sign
 }
-
+{ .mfb
+      nop.m         0
+(p6)  fms.s1        FR_r = f8,f1,f1 // range reduction for |x-1|<1/256
+(p10) br.cond.spnt  logf_nan_nat_pinf // exit for NaN, NaT or +Inf
+};;
+{ .mfb
+      ldfd          FR_T = [GR_ad_T] // load T
+(p11) fma.s.s0      f8 = f0,f0,f0
+(p11) br.ret.spnt   b0 // exit for x = 1.0
+};;
+{ .mib
+      nop.m         0
+      cmp.eq        p12,p0 = r0,GR_Exp // is x +/-0? (here it's quite enough
+                                       // only to compare exponent with 0
+                                       // because all unnormals already
+                                       // have been filtered)
+(p12) br.cond.spnt  logf_zeroes        // Branch if input argument is +/-0
+};;
 { .mfi
-     nop.m 999
-     fma.s1    log_rp_p10   = log_P1, log_r, f1
-     nop.i 999
+      nop.m         0
+      fnma.s1       FR_A2 = FR_A2,FR_r,f1 // A2*r+1
+      nop.i         0
 }
 { .mfi
-     nop.m 999
-     fma.s1    log_rp_q10  = log_P1, log_w, f1
-     nop.i 999
-;;
-}
-
-//    p13 <== large w log
-//    p14 <== small w log
+      nop.m         0
+      fma.s1        FR_r2 = FR_r,FR_r,f0  // r^2
+      nop.i         0
+};;
 { .mfi
-(p8) cmp.ge.unc p13,p14 = log_GR_exp_w, log_GR_fff7
-     fcmp.eq.s0 p6,p0 = f8,f0         // Sets flag on +denormal input
-     nop.i 999
-;;
+      nop.m         0
+      fcvt.xf       FR_N = FR_N // convert integer N in significand of FR_N
+                                // to floating-point representation
+      nop.i         0
 }
-
-//    p10 <== large w log10
-//    p11 <== small w log10
 { .mfi
-(p7) cmp.ge.unc p10,p11 = log_GR_exp_w, log_GR_fff7
-     nop.f 999
-     nop.i 999 ;;
-}
-
+      nop.m         0
+      fnma.s1       FR_A3 = FR_A4,FR_r,FR_A3 // A4*r+A3
+      nop.i         0
+};;
 { .mfi
-     nop.m 999
-     fma.s1        log_T_plus_Nlog2 = log_Nfloat,log_log2, log_T    
-     nop.i 999 ;;
+      nop.m         0
+      fma.s1        FR_r = FR_r,FR_InvLn10,f0 // For log10f we have r/log(10)
+      nop.i         0
 }
-
-
 { .mfi
-     nop.m 999
-     fma.s1     log_rp_p2   = log_rp_p32, log_rsq, log_rp_p10
-     nop.i 999
-}
+      nop.m         0
+      nop.f         0
+      nop.i         0
+};;
 { .mfi
-     nop.m 999
-     fma.s1     log_rp_q2   = log_rp_q32, log_wsq, log_rp_q10
-     nop.i 999
-;;
+      nop.m         0
+      fma.s1        FR_A2 = FR_A3,FR_r2,FR_A2 // (A4*r+A3)*r^2+(A2*r+1)
+      nop.i         0
 }
-
-
-//    small w, log   <== p14
 { .mfi
-     nop.m 999
-(p14) fma.s        f8       = log_rp_q2, log_w, f0
-     nop.i 999
-}
+      nop.m         0
+      fma.s1        FR_NxLn2pT = FR_N,FR_Ln2,FR_T // N*Ln2+T
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
 { .mfi
-     nop.m 999
-(p11) fma.s1        log_Q       = log_rp_q2, log_w, f0
-     nop.i 999 ;;
+      nop.m         0
+(p7)  fma.s.s0      f8 = FR_A2,FR_r,FR_NxLn2pT // result for |x-1|>=1/256
+      nop.i         0
 }
+{ .mfb
+      nop.m         0
+(p6)  fma.s.s0      f8 = FR_A2,FR_r,f0 // result for |x-1|<1/256
+      br.ret.sptk   b0
+};;
 
-
-//    large w, log   <== p13
-.pred.rel "mutex",p13,p10
+.align 32
+logf_positive_unorm:
 { .mfi
-      nop.m 999
-(p13) fma.s        f8        = log_rp_p2, log_r, log_T_plus_Nlog2
-      nop.i 999 
-}
+      nop.m         0
+(p8)  fma.s0        f8 = f8,f1,f0 // Normalize & set D-flag
+      nop.i         0
+};;
 { .mfi
-      nop.m 999
-(p10) fma.s1     log_Q     = log_rp_p2, log_r, log_T_plus_Nlog2
-      nop.i 999  ;;
-}
-
-
-//    log10
-{ .mfb
-      nop.m 999
-(p7)  fma.s      f8 = log_inv_ln10,log_Q,f0                         
-      br.ret.sptk     b0 
-;;
-}
-
-
-L(LOG_DENORM):
-{ .mmi
-     getf.exp   log_GR_signexp_f8 = log_NORM_f8 
-     nop.m 999
-     nop.i 999
-}
-;;
-{ .mmb
-     getf.sig   log_GR_significand_f8 = log_NORM_f8 
-     and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones  
-     br.cond.sptk L(LOG_COMMON)
-}
-;;
-
-L(LOG_ZERO_NEG): 
-
-// qnan snan inf norm     unorm 0 -+
-// 0    0    0   0        0     1 11      0x7
-// 0    0    1   1        1     0 10      0x3a
-
-// Save x (f8) in f10
+      getf.exp      GR_Exp = f8    // recompute biased exponent
+      nop.f         0
+      cmp.ne        p6,p7 = r0,r0  // p6 <- 0, p7 <- 1 because
+                                   // in case of unorm we are out
+                                   // interval [255/256; 257/256]
+};;
 { .mfi
-     nop.m 999
-     fmerge.s f10 = f8,f8 
-     nop.i 999  ;;
-}
-
-// p8 p9  means  ln(+-0)  = -inf
-// p7 p10 means  log(+-0) = -inf
-
-//    p13 means  ln(-)
-//    p14 means  log(-)
-
+      getf.sig      GR_Sig = f8 // recompute significand
+      nop.f         0
+      nop.i         0
+};;
+{ .mib
+      sub           GR_N = GR_Exp,GR_05,1 // unbiased exponent N
+      nop.i         0
+      br.cond.sptk  logf_core // return into main path
+};;
 
+.align 32
+logf_nan_nat_pinf:
 { .mfi
-     nop.m 999
-     fmerge.ns   f6 = f1,f1            // Form -1.0
-     nop.i 999  ;;
+      nop.m         0
+      fma.s.s0      f8 = f8,f1,f0 // set V-flag
+      nop.i         0
 }
+{ .mfb
+      nop.m         0
+      nop.f         0
+      br.ret.sptk   b0 // exit for NaN, NaT or +Inf
+};;
 
-// p9  means  ln(+-0)  = -inf
-// p10 means  log(+-0) = -inf
-// Log(+-0) = -inf 
-
-{ .mfi
-	nop.m 999
-(p8)  fclass.m.unc  p9,p0 = f10, 0x07           
-	nop.i 999
-}
+.align 32
+logf_zeroes:
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc  p10,p0 = f10, 0x07           
-	nop.i 999 ;;
+      nop.m         0
+      fmerge.s      FR_X = f8,f8 // keep input argument for subsequent
+                                 // call of __libm_error_support#
+      nop.i         0
 }
-
-
-// p13  ln(-)
-// p14  log(-)
-
-// Log(-inf, -normal, -unnormal) = QNAN indefinite
 { .mfi
-	nop.m 999
-(p8)  fclass.m.unc  p13,p0 = f10, 0x3a           
-	nop.i 999 
-}
+(p13) mov           GR_TAG = 4 // set libm error in case of logf
+      fms.s1        FR_tmp = f0,f0,f1 // -1.0
+      nop.i         0
+};;
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc  p14,p0 = f10, 0x3a           
-	nop.i 999  ;;
+      nop.m         0
+      frcpa.s0      f8,p0 = FR_tmp,f0 // log(+/-0) should be equal to -INF.
+                                      // We can get it using frcpa because it
+                                      // sets result to the IEEE-754 mandated
+                                      // quotient of FR_tmp/f0.
+                                      // As far as FR_tmp is -1 it'll be -INF
+      nop.i         0
 }
+{ .mib
+(p14) mov           GR_TAG = 10 // set libm error in case of log10f
+      nop.i         0
+      br.cond.sptk  logf_libm_err
+};;
 
-
-.pred.rel "mutex",p9,p10
+.align 32
+logf_negatives:
 { .mfi
-(p9)     mov        log_GR_tag = 4       
-(p9)    frcpa f8,p11 = f6,f0                   
-            nop.i 999
-}
+(p13) mov           GR_TAG = 5 // set libm error in case of logf
+      fmerge.s      FR_X = f8,f8 // keep input argument for subsequent
+                                 // call of __libm_error_support#
+      nop.i         0
+};;
 { .mfi
-(p10)    mov        log_GR_tag = 10       
-(p10)   frcpa f8,p12 = f6,f0                   
-            nop.i 999 ;;
-}
+(p14) mov           GR_TAG = 11 // set libm error in case of log10f
+      frcpa.s0      f8,p0 = f0,f0 // log(negatives) should be equal to NaN.
+                                  // We can get it using frcpa because it
+                                  // sets result to the IEEE-754 mandated
+                                  // quotient of f0/f0 i.e. NaN.
+      nop.i         0
+};;
 
-.pred.rel "mutex",p13,p14
-{ .mfi
-(p13)    mov        log_GR_tag = 5       
-(p13)    frcpa f8,p11 = f0,f0                   
-            nop.i 999
-}
-{ .mfb
-(p14)    mov        log_GR_tag = 11       
-(p14)   frcpa f8,p12 = f0,f0                   
-        br.cond.sptk __libm_error_region ;; 
-}
-.endp logf
-ASM_SIZE_DIRECTIVE(logf)
-ASM_SIZE_DIRECTIVE(__ieee754_logf)
+.align 32
+logf_libm_err:
+{ .mmi
+      alloc         r32 = ar.pfs,1,4,4,0
+      mov           GR_Parameter_TAG = GR_TAG
+      nop.i         0
+};;
+GLOBAL_IEEE754_END(logf)
 
 
 // Stack operations when calling error support.
@@ -890,70 +1104,56 @@ ASM_SIZE_DIRECTIVE(__ieee754_logf)
 //    save ar.pfs          save b0                                               restore gp
 //    save gp                                                                    restore ar.pfs
 
-
-
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+      add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+      nop.f 0
+.save ar.pfs,GR_SAVE_PFS
+      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+      add sp=-64,sp                           // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                       // Save gp
 };;
-
-
-// (2)
 { .mmi
-        stfs [GR_Parameter_Y] = f1,16         // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+      stfs [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+      add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+      mov GR_SAVE_B0=b0                       // Save b0
 };;
-
 .body
-// (3)
 { .mib
-        stfs [GR_Parameter_X] = f10                   // STORE Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
-        nop.b 0                             
+      stfs [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+      nop.b 0
 }
 { .mib
-        stfs [GR_Parameter_Y] = f8                    // STORE Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#         // Call error handling function
+      stfs [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#         // Call error handling function
 };;
-
 { .mmi
-        nop.m 0
-        nop.m 0
-        add   GR_Parameter_RESULT = 48,sp
+      nop.m 0
+      nop.m 0
+      add   GR_Parameter_RESULT = 48,sp
 };;
-
-// (4)
 { .mmi
-        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+      ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+      add   sp = 64,sp                       // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+      mov   gp = GR_SAVE_GP                  // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+      br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/e_logl.S b/sysdeps/ia64/fpu/e_logl.S
new file mode 100644
index 0000000000..3ebb20a632
--- /dev/null
+++ b/sysdeps/ia64/fpu/e_logl.S
@@ -0,0 +1,1200 @@
+.file "logl.s" 
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History: 
+// 05/21/01 Extracted logl and log10l from log1pl.s file, and optimized 
+//          all paths.
+// 06/20/01 Fixed error tag for x=-inf.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+//
+//*********************************************************************
+//
+//*********************************************************************
+//
+// Function:   Combined logl(x) and log10l(x) where
+//             logl(x)   = ln(x), for double-extended precision x values
+//             log10l(x) = log (x), for double-extended precision x values
+//                           10
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f8 (Input and Return Value)
+//                              f34-f76
+//
+//    General Purpose Registers:
+//      r32-r56
+//      r53-r56 (Used to pass arguments to error handling routine)
+//
+//    Predicate Registers:      p6-p14
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    Denormal  fault raised on denormal inputs
+//    Overflow exceptions cannot occur  
+//    Underflow exceptions raised when appropriate for log1p 
+//    (Error Handling Routine called for underflow)
+//    Inexact raised when appropriate by algorithm
+//
+//    logl(inf) = inf
+//    logl(-inf) = QNaN 
+//    logl(+/-0) = -inf 
+//    logl(SNaN) = QNaN
+//    logl(QNaN) = QNaN
+//    logl(EM_special Values) = QNaN
+//    log10l(inf) = inf
+//    log10l(-inf) = QNaN 
+//    log10l(+/-0) = -inf 
+//    log10l(SNaN) = QNaN
+//    log10l(QNaN) = QNaN
+//    log10l(EM_special Values) = QNaN
+//
+//*********************************************************************
+//
+// Overview
+//
+// The method consists of two cases.
+//
+// If      |X-1| < 2^(-7)	use case log_near1;
+// else      			use case log_regular;
+//
+// Case log_near1:
+//
+//   logl( 1 + X ) can be approximated by a simple polynomial
+//   in W = X-1. This polynomial resembles the truncated Taylor
+//   series W - W^/2 + W^3/3 - ...
+// 
+// Case log_regular:
+//
+//   Here we use a table lookup method. The basic idea is that in
+//   order to compute logl(Arg) for an argument Arg in [1,2), we 
+//   construct a value G such that G*Arg is close to 1 and that
+//   logl(1/G) is obtainable easily from a table of values calculated
+//   beforehand. Thus
+//
+//      logl(Arg) = logl(1/G) + logl(G*Arg)
+//      	 = logl(1/G) + logl(1 + (G*Arg - 1))
+//
+//   Because |G*Arg - 1| is small, the second term on the right hand
+//   side can be approximated by a short polynomial. We elaborate
+//   this method in four steps.
+//
+//   Step 0: Initialization
+//
+//   We need to calculate logl( X ). Obtain N, S_hi such that
+//
+//      X = 2^N * S_hi 	exactly
+//
+//   where S_hi in [1,2) 
+//
+//   Step 1: Argument Reduction
+//
+//   Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
+//
+//      G := G_1 * G_2 * G_3
+//      r := (G * S_hi - 1)
+//
+//   These G_j's have the property that the product is exactly 
+//   representable and that |r| < 2^(-12) as a result.
+//
+//   Step 2: Approximation
+//
+//
+//   logl(1 + r) is approximated by a short polynomial poly(r).
+//
+//   Step 3: Reconstruction
+//
+//
+//   Finally, logl( X ) is given by
+//
+//   logl( X )   =   logl( 2^N * S_hi )
+//                 ~=~  N*logl(2) + logl(1/G) + logl(1 + r)
+//                 ~=~  N*logl(2) + logl(1/G) + poly(r).
+//
+// **** Algorithm ****
+//
+// Case log_near1:
+//
+// Here we compute a simple polynomial. To exploit parallelism, we split
+// the polynomial into two portions.
+// 
+//       W := X - 1
+//       Wsq := W * W
+//       W4  := Wsq*Wsq
+//       W6  := W4*Wsq
+//       Y_hi := W + Wsq*(P_1 + W*(P_2 + W*(P_3 + W*P_4))
+//       Y_lo := W6*(P_5 + W*(P_6 + W*(P_7 + W*P_8)))
+//
+// Case log_regular:
+//
+// We present the algorithm in four steps.
+//
+//   Step 0. Initialization
+//   ----------------------
+//
+//   Z := X 
+//   N := unbaised exponent of Z
+//   S_hi := 2^(-N) * Z
+//
+//   Step 1. Argument Reduction
+//   --------------------------
+//
+//   Let
+//
+//      Z = 2^N * S_hi = 2^N * 1.d_1 d_2 d_3 ... d_63
+//
+//   We obtain G_1, G_2, G_3 by the following steps.
+//
+//
+//      Define		X_0 := 1.d_1 d_2 ... d_14. This is extracted
+//      		from S_hi.
+//
+//      Define		A_1 := 1.d_1 d_2 d_3 d_4. This is X_0 truncated
+//      		to lsb = 2^(-4).
+//
+//      Define		index_1 := [ d_1 d_2 d_3 d_4 ].
+//
+//      Fetch 		Z_1 := (1/A_1) rounded UP in fixed point with
+//      fixed point	lsb = 2^(-15).
+//      		Z_1 looks like z_0.z_1 z_2 ... z_15
+//      	        Note that the fetching is done using index_1.
+//      		A_1 is actually not needed in the implementation
+//      		and is used here only to explain how is the value
+//      		Z_1 defined.
+//
+//      Fetch		G_1 := (1/A_1) truncated to 21 sig. bits.
+//      floating pt.	Again, fetching is done using index_1. A_1
+//      		explains how G_1 is defined.
+//
+//      Calculate	X_1 := X_0 * Z_1 truncated to lsb = 2^(-14)
+//      		     = 1.0 0 0 0 d_5 ... d_14
+//      		This is accomplised by integer multiplication.
+//      		It is proved that X_1 indeed always begin
+//      		with 1.0000 in fixed point.
+//
+//
+//      Define		A_2 := 1.0 0 0 0 d_5 d_6 d_7 d_8. This is X_1 
+//      		truncated to lsb = 2^(-8). Similar to A_1,
+//      		A_2 is not needed in actual implementation. It
+//      		helps explain how some of the values are defined.
+//
+//      Define		index_2 := [ d_5 d_6 d_7 d_8 ].
+//
+//      Fetch 		Z_2 := (1/A_2) rounded UP in fixed point with
+//      fixed point	lsb = 2^(-15). Fetch done using index_2.
+//      		Z_2 looks like z_0.z_1 z_2 ... z_15
+//
+//      Fetch		G_2 := (1/A_2) truncated to 21 sig. bits.
+//      floating pt.
+//
+//      Calculate	X_2 := X_1 * Z_2 truncated to lsb = 2^(-14)
+//      		     = 1.0 0 0 0 0 0 0 0 d_9 d_10 ... d_14
+//      		This is accomplised by integer multiplication.
+//      		It is proved that X_2 indeed always begin
+//      		with 1.00000000 in fixed point.
+//
+//
+//      Define		A_3 := 1.0 0 0 0 0 0 0 0 d_9 d_10 d_11 d_12 d_13 1.
+//      		This is 2^(-14) + X_2 truncated to lsb = 2^(-13).
+//
+//      Define		index_3 := [ d_9 d_10 d_11 d_12 d_13 ].
+//
+//      Fetch		G_3 := (1/A_3) truncated to 21 sig. bits.
+//      floating pt.	Fetch is done using index_3.
+//
+//      Compute		G := G_1 * G_2 * G_3. 
+//
+//      This is done exactly since each of G_j only has 21 sig. bits.
+//
+//      Compute   
+//
+//      	r := (G*S_hi - 1) 
+//
+//
+//  Step 2. Approximation
+//  ---------------------
+//
+//   This step computes an approximation to logl( 1 + r ) where r is the
+//   reduced argument just obtained. It is proved that |r| <= 1.9*2^(-13);
+//   thus logl(1+r) can be approximated by a short polynomial:
+//
+//      logl(1+r) ~=~ poly = r + Q1 r^2 + ... + Q4 r^5
+//
+//
+//  Step 3. Reconstruction
+//  ----------------------
+//
+//   This step computes the desired result of logl(X):
+//
+//      logl(X)  =   logl( 2^N * S_hi )
+//      	  =   N*logl(2) + logl( S_hi )
+//      	  =   N*logl(2) + logl(1/G) +
+//      	      logl(1 + G*S_hi - 1 )
+//
+//   logl(2), logl(1/G_j) are stored as pairs of (single,double) numbers:
+//   log2_hi, log2_lo, log1byGj_hi, log1byGj_lo. The high parts are
+//   single-precision numbers and the low parts are double precision
+//   numbers. These have the property that
+//
+//      N*log2_hi + SUM ( log1byGj_hi )
+//
+//   is computable exactly in double-extended precision (64 sig. bits).
+//   Finally
+//
+//      Y_hi := N*log2_hi + SUM ( log1byGj_hi )
+//      Y_lo := poly_hi + [ poly_lo + 
+//              ( SUM ( log1byGj_lo ) + N*log2_lo ) ]
+//
+
+RODATA
+.align 64
+
+// ************* DO NOT CHANGE THE ORDER OF THESE TABLES *************
+
+// P_8, P_7, P_6, P_5, P_4, P_3, P_2, and P_1 
+
+LOCAL_OBJECT_START(Constants_P)
+data8  0xE3936754EFD62B15,0x00003FFB
+data8  0x8003B271A5E56381,0x0000BFFC
+data8  0x9249248C73282DB0,0x00003FFC
+data8  0xAAAAAA9F47305052,0x0000BFFC
+data8  0xCCCCCCCCCCD17FC9,0x00003FFC
+data8  0x8000000000067ED5,0x0000BFFD
+data8  0xAAAAAAAAAAAAAAAA,0x00003FFD
+data8  0xFFFFFFFFFFFFFFFE,0x0000BFFD
+LOCAL_OBJECT_END(Constants_P)
+
+// log2_hi, log2_lo, Q_4, Q_3, Q_2, and Q_1 
+
+LOCAL_OBJECT_START(Constants_Q)
+data8  0xB172180000000000,0x00003FFE
+data8  0x82E308654361C4C6,0x0000BFE2
+data8  0xCCCCCAF2328833CB,0x00003FFC
+data8  0x80000077A9D4BAFB,0x0000BFFD
+data8  0xAAAAAAAAAAABE3D2,0x00003FFD
+data8  0xFFFFFFFFFFFFDAB7,0x0000BFFD
+LOCAL_OBJECT_END(Constants_Q)
+
+// 1/ln10_hi, 1/ln10_lo
+
+LOCAL_OBJECT_START(Constants_1_by_LN10)
+data8  0xDE5BD8A937287195,0x00003FFD
+data8  0xD56EAABEACCF70C8,0x00003FBB
+LOCAL_OBJECT_END(Constants_1_by_LN10)
+
+
+// Z1 - 16 bit fixed
+ 
+LOCAL_OBJECT_START(Constants_Z_1)
+data4  0x00008000
+data4  0x00007879
+data4  0x000071C8
+data4  0x00006BCB
+data4  0x00006667
+data4  0x00006187
+data4  0x00005D18
+data4  0x0000590C
+data4  0x00005556
+data4  0x000051EC
+data4  0x00004EC5
+data4  0x00004BDB
+data4  0x00004925
+data4  0x0000469F
+data4  0x00004445
+data4  0x00004211
+LOCAL_OBJECT_END(Constants_Z_1)
+
+// G1 and H1 - IEEE single and h1 - IEEE double
+
+LOCAL_OBJECT_START(Constants_G_H_h1)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F70F0F0,0x3D785196
+data8  0x3DA163A6617D741C
+data4  0x3F638E38,0x3DF13843
+data8  0x3E2C55E6CBD3D5BB
+data4  0x3F579430,0x3E2FF9A0
+data8  0xBE3EB0BFD86EA5E7
+data4  0x3F4CCCC8,0x3E647FD6
+data8  0x3E2E6A8C86B12760
+data4  0x3F430C30,0x3E8B3AE7
+data8  0x3E47574C5C0739BA
+data4  0x3F3A2E88,0x3EA30C68
+data8  0x3E20E30F13E8AF2F
+data4  0x3F321640,0x3EB9CEC8
+data8  0xBE42885BF2C630BD
+data4  0x3F2AAAA8,0x3ECF9927
+data8  0x3E497F3497E577C6
+data4  0x3F23D708,0x3EE47FC5
+data8  0x3E3E6A6EA6B0A5AB
+data4  0x3F1D89D8,0x3EF8947D
+data8  0xBDF43E3CD328D9BE
+data4  0x3F17B420,0x3F05F3A1
+data8  0x3E4094C30ADB090A
+data4  0x3F124920,0x3F0F4303
+data8  0xBE28FBB2FC1FE510
+data4  0x3F0D3DC8,0x3F183EBF
+data8  0x3E3A789510FDE3FA
+data4  0x3F088888,0x3F20EC80
+data8  0x3E508CE57CC8C98F
+data4  0x3F042108,0x3F29516A
+data8  0xBE534874A223106C
+LOCAL_OBJECT_END(Constants_G_H_h1)
+
+// Z2 - 16 bit fixed
+
+LOCAL_OBJECT_START(Constants_Z_2)
+data4  0x00008000
+data4  0x00007F81
+data4  0x00007F02
+data4  0x00007E85
+data4  0x00007E08
+data4  0x00007D8D
+data4  0x00007D12
+data4  0x00007C98
+data4  0x00007C20
+data4  0x00007BA8
+data4  0x00007B31
+data4  0x00007ABB
+data4  0x00007A45
+data4  0x000079D1
+data4  0x0000795D
+data4  0x000078EB
+LOCAL_OBJECT_END(Constants_Z_2)
+
+// G2 and H2 - IEEE single and h2 - IEEE double
+
+LOCAL_OBJECT_START(Constants_G_H_h2)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F7F00F8,0x3B7F875D
+data8  0x3DB5A11622C42273
+data4  0x3F7E03F8,0x3BFF015B
+data8  0x3DE620CF21F86ED3
+data4  0x3F7D08E0,0x3C3EE393
+data8  0xBDAFA07E484F34ED
+data4  0x3F7C0FC0,0x3C7E0586
+data8  0xBDFE07F03860BCF6
+data4  0x3F7B1880,0x3C9E75D2
+data8  0x3DEA370FA78093D6
+data4  0x3F7A2328,0x3CBDC97A
+data8  0x3DFF579172A753D0
+data4  0x3F792FB0,0x3CDCFE47
+data8  0x3DFEBE6CA7EF896B
+data4  0x3F783E08,0x3CFC15D0
+data8  0x3E0CF156409ECB43
+data4  0x3F774E38,0x3D0D874D
+data8  0xBE0B6F97FFEF71DF
+data4  0x3F766038,0x3D1CF49B
+data8  0xBE0804835D59EEE8
+data4  0x3F757400,0x3D2C531D
+data8  0x3E1F91E9A9192A74
+data4  0x3F748988,0x3D3BA322
+data8  0xBE139A06BF72A8CD
+data4  0x3F73A0D0,0x3D4AE46F
+data8  0x3E1D9202F8FBA6CF
+data4  0x3F72B9D0,0x3D5A1756
+data8  0xBE1DCCC4BA796223
+data4  0x3F71D488,0x3D693B9D
+data8  0xBE049391B6B7C239
+LOCAL_OBJECT_END(Constants_G_H_h2)
+
+// G3 and H3 - IEEE single and h3 - IEEE double 
+
+LOCAL_OBJECT_START(Constants_G_H_h3)
+data4  0x3F7FFC00,0x38800100
+data8  0x3D355595562224CD
+data4  0x3F7FF400,0x39400480
+data8  0x3D8200A206136FF6
+data4  0x3F7FEC00,0x39A00640
+data8  0x3DA4D68DE8DE9AF0
+data4  0x3F7FE400,0x39E00C41
+data8  0xBD8B4291B10238DC
+data4  0x3F7FDC00,0x3A100A21
+data8  0xBD89CCB83B1952CA
+data4  0x3F7FD400,0x3A300F22
+data8  0xBDB107071DC46826
+data4  0x3F7FCC08,0x3A4FF51C
+data8  0x3DB6FCB9F43307DB
+data4  0x3F7FC408,0x3A6FFC1D
+data8  0xBD9B7C4762DC7872
+data4  0x3F7FBC10,0x3A87F20B
+data8  0xBDC3725E3F89154A
+data4  0x3F7FB410,0x3A97F68B
+data8  0xBD93519D62B9D392
+data4  0x3F7FAC18,0x3AA7EB86
+data8  0x3DC184410F21BD9D
+data4  0x3F7FA420,0x3AB7E101
+data8  0xBDA64B952245E0A6
+data4  0x3F7F9C20,0x3AC7E701
+data8  0x3DB4B0ECAABB34B8
+data4  0x3F7F9428,0x3AD7DD7B
+data8  0x3D9923376DC40A7E
+data4  0x3F7F8C30,0x3AE7D474
+data8  0x3DC6E17B4F2083D3
+data4  0x3F7F8438,0x3AF7CBED
+data8  0x3DAE314B811D4394
+data4  0x3F7F7C40,0x3B03E1F3
+data8  0xBDD46F21B08F2DB1
+data4  0x3F7F7448,0x3B0BDE2F
+data8  0xBDDC30A46D34522B
+data4  0x3F7F6C50,0x3B13DAAA
+data8  0x3DCB0070B1F473DB
+data4  0x3F7F6458,0x3B1BD766
+data8  0xBDD65DDC6AD282FD
+data4  0x3F7F5C68,0x3B23CC5C
+data8  0xBDCDAB83F153761A
+data4  0x3F7F5470,0x3B2BC997
+data8  0xBDDADA40341D0F8F
+data4  0x3F7F4C78,0x3B33C711
+data8  0x3DCD1BD7EBC394E8
+data4  0x3F7F4488,0x3B3BBCC6
+data8  0xBDC3532B52E3E695
+data4  0x3F7F3C90,0x3B43BAC0
+data8  0xBDA3961EE846B3DE
+data4  0x3F7F34A0,0x3B4BB0F4
+data8  0xBDDADF06785778D4
+data4  0x3F7F2CA8,0x3B53AF6D
+data8  0x3DCC3ED1E55CE212
+data4  0x3F7F24B8,0x3B5BA620
+data8  0xBDBA31039E382C15
+data4  0x3F7F1CC8,0x3B639D12
+data8  0x3D635A0B5C5AF197
+data4  0x3F7F14D8,0x3B6B9444
+data8  0xBDDCCB1971D34EFC
+data4  0x3F7F0CE0,0x3B7393BC
+data8  0x3DC7450252CD7ADA
+data4  0x3F7F04F0,0x3B7B8B6D
+data8  0xBDB68F177D7F2A42
+LOCAL_OBJECT_END(Constants_G_H_h3)
+
+
+// Floating Point Registers
+
+FR_Input_X      = f8 
+
+FR_Y_hi         = f34  
+FR_Y_lo         = f35
+
+FR_Scale        = f36
+FR_X_Prime      = f37 
+FR_S_hi         = f38  
+FR_W            = f39
+FR_G            = f40
+
+FR_H            = f41
+FR_wsq          = f42 
+FR_w4           = f43
+FR_h            = f44
+FR_w6           = f45  
+
+FR_G2           = f46
+FR_H2           = f47
+FR_poly_lo      = f48
+FR_P8           = f49  
+FR_poly_hi      = f50
+
+FR_P7           = f51  
+FR_h2           = f52 
+FR_rsq          = f53  
+FR_P6           = f54
+FR_r            = f55  
+
+FR_log2_hi      = f56  
+FR_log2_lo      = f57  
+FR_p87          = f58  
+FR_p876         = f58  
+FR_p8765        = f58  
+FR_float_N      = f59 
+FR_Q4           = f60 
+
+FR_p43          = f61  
+FR_p432         = f61  
+FR_p4321        = f61  
+FR_P4           = f62  
+FR_G3           = f63  
+FR_H3           = f64  
+FR_h3           = f65  
+
+FR_Q3           = f66  
+FR_P3           = f67  
+FR_Q2           = f68 
+FR_P2           = f69  
+FR_1LN10_hi     = f70 
+
+FR_Q1           = f71 
+FR_P1           = f72 
+FR_1LN10_lo     = f73 
+FR_P5           = f74 
+FR_rcub         = f75 
+
+FR_Output_X_tmp = f76 
+
+FR_X                = f8
+FR_Y                = f0
+FR_RESULT           = f76
+
+
+// General Purpose Registers
+
+GR_ad_p         = r33
+GR_Index1       = r34 
+GR_Index2       = r35 
+GR_signif       = r36 
+GR_X_0          = r37 
+GR_X_1          = r38 
+GR_X_2          = r39 
+GR_Z_1          = r40 
+GR_Z_2          = r41 
+GR_N            = r42 
+GR_Bias         = r43 
+GR_M            = r44 
+GR_Index3       = r45 
+GR_ad_p2        = r46
+GR_exp_mask     = r47 
+GR_exp_2tom7    = r48 
+GR_ad_ln10      = r49 
+GR_ad_tbl_1     = r50
+GR_ad_tbl_2     = r51
+GR_ad_tbl_3     = r52
+GR_ad_q         = r53
+GR_ad_z_1       = r54
+GR_ad_z_2       = r55
+GR_ad_z_3       = r56
+
+//
+// Added for unwind support
+//
+
+GR_SAVE_PFS         = r50
+GR_SAVE_B0          = r51
+GR_SAVE_GP          = r52
+GR_Parameter_X      = r53
+GR_Parameter_Y      = r54
+GR_Parameter_RESULT = r55
+GR_Parameter_TAG    = r56
+
+.section .text
+
+GLOBAL_IEEE754_ENTRY(logl)
+{ .mfi
+      alloc r32 = ar.pfs,0,21,4,0
+      fclass.m p6, p0 =  FR_Input_X, 0x1E3  // Test for natval, nan, inf
+      cmp.eq  p7, p14 = r0, r0              // Set p7 if logl
+}
+{ .mfb
+      addl GR_ad_z_1 = @ltoff(Constants_Z_1#),gp
+      fnorm.s1 FR_X_Prime = FR_Input_X      // Normalize x
+      br.cond.sptk LOGL_BEGIN
+}
+;;
+
+GLOBAL_IEEE754_END(logl)
+
+
+GLOBAL_IEEE754_ENTRY(log10l)
+{ .mfi
+      alloc r32 = ar.pfs,0,21,4,0
+      fclass.m p6, p0 =  FR_Input_X, 0x1E3  // Test for natval, nan, inf
+      cmp.ne  p7, p14 = r0, r0              // Set p14 if log10l
+}
+{ .mfb
+      addl GR_ad_z_1 = @ltoff(Constants_Z_1#),gp
+      fnorm.s1 FR_X_Prime = FR_Input_X      // Normalize x
+      nop.b 999
+}
+;;
+
+
+// Common code for logl and log10
+LOGL_BEGIN: 
+{ .mfi
+      ld8    GR_ad_z_1 = [GR_ad_z_1]          // Get pointer to Constants_Z_1
+      fclass.m p10, p0 =  FR_Input_X, 0x0b    // Test for denormal
+      mov GR_exp_2tom7 = 0x0fff8              // Exponent of 2^-7
+}
+;;
+
+{ .mfb
+      getf.sig GR_signif = FR_Input_X         // Get significand of x
+      fcmp.eq.s1 p9, p0 =  FR_Input_X, f1     // Test for x=1.0
+(p6)  br.cond.spnt LOGL_64_special            // Branch for nan, inf, natval
+}
+;;
+
+{ .mfi
+      add   GR_ad_tbl_1 = 0x040, GR_ad_z_1    // Point to Constants_G_H_h1
+      fcmp.lt.s1 p13, p0 =  FR_Input_X, f0    // Test for x<0
+      add   GR_ad_p = -0x100, GR_ad_z_1       // Point to Constants_P
+}
+{ .mib
+      add   GR_ad_z_2 = 0x140, GR_ad_z_1      // Point to Constants_Z_2
+      add   GR_ad_tbl_2 = 0x180, GR_ad_z_1    // Point to Constants_G_H_h2
+(p10) br.cond.spnt LOGL_64_denormal           // Branch for denormal
+}
+;;
+
+LOGL_64_COMMON:
+{ .mfi
+      add   GR_ad_q = 0x080, GR_ad_p          // Point to Constants_Q
+      fcmp.eq.s1 p8, p0 =  FR_Input_X, f0     // Test for x=0
+      extr.u GR_Index1 = GR_signif, 59, 4     // Get high 4 bits of signif
+}
+{ .mfb
+      add   GR_ad_tbl_3 = 0x280, GR_ad_z_1    // Point to Constants_G_H_h3
+(p9)  fma.s0  f8 = FR_Input_X, f0, f0         // If x=1, return +0.0
+(p9)  br.ret.spnt  b0                         // Exit if x=1
+}
+;;
+
+{ .mfi
+      shladd GR_ad_z_1 = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      fclass.nm p10, p0 =  FR_Input_X, 0x1FF  // Test for unsupported
+      extr.u GR_X_0 = GR_signif, 49, 15       // Get high 15 bits of significand
+}
+{ .mfi
+      ldfe FR_P8 = [GR_ad_p],16               // Load P_8 for near1 path
+      fsub.s1 FR_W = FR_X_Prime, f1           // W = x - 1
+      add   GR_ad_ln10 = 0x060, GR_ad_q       // Point to Constants_1_by_LN10
+}
+;;
+
+{ .mfi
+      ld4 GR_Z_1 = [GR_ad_z_1]                // Load Z_1
+      nop.f 999
+      mov GR_exp_mask = 0x1FFFF               // Create exponent mask
+}
+{ .mib
+      shladd GR_ad_tbl_1 = GR_Index1, 4, GR_ad_tbl_1  // Point to G_1
+      mov GR_Bias = 0x0FFFF                   // Create exponent bias
+(p13) br.cond.spnt LOGL_64_negative           // Branch if x<0
+}
+;;
+
+{ .mfb
+      ldfps  FR_G, FR_H = [GR_ad_tbl_1],8     // Load G_1, H_1
+      fmerge.se FR_S_hi =  f1,FR_X_Prime      // Form |x|
+(p8)  br.cond.spnt LOGL_64_zero               // Branch if x=0
+}
+;;
+
+{ .mmb
+      getf.exp GR_N =  FR_X_Prime             // Get N = exponent of x
+      ldfd  FR_h = [GR_ad_tbl_1]              // Load h_1
+(p10) br.cond.spnt LOGL_64_unsupported        // Branch for unsupported type
+}
+;;
+
+{ .mfi
+      ldfe FR_log2_hi = [GR_ad_q],16          // Load log2_hi
+      fcmp.eq.s0 p8, p0 =  FR_Input_X, f0     // Dummy op to flag denormals
+      pmpyshr2.u GR_X_1 = GR_X_0,GR_Z_1,15    // Get bits 30-15 of X_0 * Z_1
+}
+;;
+
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mmi
+      ldfe FR_log2_lo = [GR_ad_q],16          // Load log2_lo
+(p14) ldfe FR_1LN10_hi = [GR_ad_ln10],16      // If log10l, load 1/ln10_hi
+      sub GR_N = GR_N, GR_Bias 
+}
+;;
+
+{ .mmi
+      ldfe FR_Q4 = [GR_ad_q],16               // Load Q4
+(p14) ldfe FR_1LN10_lo = [GR_ad_ln10]         // If log10l, load 1/ln10_lo
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ldfe FR_Q3 = [GR_ad_q],16               // Load Q3
+      setf.sig FR_float_N = GR_N   // Put integer N into rightmost significand
+      nop.i 999
+}
+;;
+
+{ .mmi
+      getf.exp GR_M = FR_W                    // Get signexp of w = x - 1
+      ldfe FR_Q2 = [GR_ad_q],16               // Load Q2
+      extr.u GR_Index2 = GR_X_1, 6, 4         // Extract bits 6-9 of X_1 
+}
+;;
+
+{ .mmi
+      ldfe FR_Q1 = [GR_ad_q]                  // Load Q1
+      shladd GR_ad_z_2 = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+      add GR_ad_p2  = 0x30,GR_ad_p            // Point to P_4
+}
+;;
+
+{ .mmi
+      ld4 GR_Z_2 = [GR_ad_z_2]                // Load Z_2
+      shladd GR_ad_tbl_2 = GR_Index2, 4, GR_ad_tbl_2  // Point to G_2
+      and GR_M = GR_exp_mask, GR_M            // Get exponent of w = x - 1
+}
+;;
+
+{ .mmi
+      ldfps  FR_G2, FR_H2 = [GR_ad_tbl_2],8   // Load G_2, H_2
+      cmp.lt  p8, p9 =  GR_M, GR_exp_2tom7    // Test |x-1| < 2^-7
+      nop.i 999
+}
+;;
+
+// Paths are merged.
+//  p8 is for the near1 path: |x-1| < 2^-7
+//  p9 is for regular path:   |x-1| >= 2^-7
+
+{ .mmi
+      ldfd  FR_h2 = [GR_ad_tbl_2]             // Load h_2
+      nop.m 999
+      nop.i 999
+}
+;;
+
+{ .mmi
+(p8)  ldfe FR_P7 = [GR_ad_p],16               // Load P_7 for near1 path
+(p8)  ldfe FR_P4 = [GR_ad_p2],16              // Load P_4 for near1 path
+(p9)  pmpyshr2.u GR_X_2 = GR_X_1,GR_Z_2,15    // Get bits 30-15 of X_1 * Z_2
+}
+;;
+
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mmi
+(p8)  ldfe FR_P6 = [GR_ad_p],16               // Load P_6 for near1 path
+(p8)  ldfe FR_P3 = [GR_ad_p2],16              // Load P_3 for near1 path
+      nop.i 999
+}
+;;
+
+{ .mmf
+(p8)  ldfe FR_P5 = [GR_ad_p],16               // Load P_5 for near1 path
+(p8)  ldfe FR_P2 = [GR_ad_p2],16              // Load P_2 for near1 path
+(p8)  fmpy.s1 FR_wsq = FR_W, FR_W             // wsq = w * w for near1 path
+}
+;;
+
+{ .mmi
+(p8)  ldfe FR_P1 = [GR_ad_p2],16 ;;           // Load P_1 for near1 path
+      nop.m 999
+(p9)  extr.u GR_Index3 = GR_X_2, 1, 5         // Extract bits 1-5 of X_2
+}
+;;
+
+{ .mfi
+(p9)  shladd GR_ad_tbl_3 = GR_Index3, 4, GR_ad_tbl_3  // Point to G_3
+(p9)  fcvt.xf FR_float_N = FR_float_N
+      nop.i 999
+}
+;;
+
+{ .mfi
+(p9)  ldfps  FR_G3, FR_H3 = [GR_ad_tbl_3],8   // Load G_3, H_3
+      nop.f 999
+      nop.i 999
+}
+;;
+
+{ .mfi
+(p9)  ldfd  FR_h3 = [GR_ad_tbl_3]             // Load h_3
+(p9)  fmpy.s1 FR_G = FR_G, FR_G2              // G = G_1 * G_2
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p9)  fadd.s1 FR_H = FR_H, FR_H2              // H = H_1 + H_2
+      nop.i 999
+}
+;;
+
+{ .mmf
+      nop.m 999
+      nop.m 999
+(p9)  fadd.s1 FR_h = FR_h, FR_h2              // h = h_1 + h_2
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fmpy.s1 FR_w4 = FR_wsq, FR_wsq          // w4 = w^4 for near1 path
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_p87 = FR_W, FR_P8, FR_P7      // p87 = w * P8 + P7
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_p43 = FR_W, FR_P4, FR_P3      // p43 = w * P4 + P3
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fmpy.s1 FR_G = FR_G, FR_G3              // G = (G_1 * G_2) * G_3
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p9)  fadd.s1 FR_H = FR_H, FR_H3              // H = (H_1 + H_2) + H_3
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fadd.s1 FR_h = FR_h, FR_h3              // h = (h_1 + h_2) + h_3
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p8)  fmpy.s1 FR_w6 = FR_w4, FR_wsq           // w6 = w^6 for near1 path
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_p432 = FR_W, FR_p43, FR_P2    // p432 = w * p43 + P2
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_p876 = FR_W, FR_p87, FR_P6    // p876 = w * p87 + P6
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fms.s1 FR_r = FR_G, FR_S_hi, f1         // r = G * S_hi - 1
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p9)  fma.s1 FR_Y_hi = FR_float_N, FR_log2_hi, FR_H // Y_hi = N * log2_hi + H
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fma.s1 FR_h = FR_float_N, FR_log2_lo, FR_h  // h = N * log2_lo + h
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_p4321 = FR_W, FR_p432, FR_P1      // p4321 = w * p432 + P1
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_p8765 = FR_W, FR_p876, FR_P5      // p8765 = w * p876 + P5
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_r, FR_Q4, FR_Q3      // poly_lo = r * Q4 + Q3
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p9)  fmpy.s1 FR_rsq = FR_r, FR_r                 // rsq = r * r
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_Y_lo = FR_wsq, FR_p4321, f0       // Y_lo = wsq * p4321
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_Y_hi = FR_W, f1, f0               // Y_hi = w for near1 path
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_poly_lo, FR_r, FR_Q2 // poly_lo = poly_lo * r + Q2
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p9)  fma.s1 FR_rcub = FR_rsq, FR_r, f0           // rcub = r^3
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fma.s1 FR_Y_lo = FR_w6, FR_p8765,FR_Y_lo // Y_lo = w6 * p8765 + w2 * p4321
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fma.s1 FR_poly_hi = FR_Q1, FR_rsq, FR_r     // poly_hi = Q1 * rsq + r
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_poly_lo, FR_rcub, FR_h // poly_lo = poly_lo*r^3 + h
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fadd.s1 FR_Y_lo = FR_poly_hi, FR_poly_lo    // Y_lo = poly_hi + poly_lo 
+      nop.i 999
+}
+;;
+
+// Remainder of code is common for near1 and regular paths
+{ .mfi
+      nop.m 999
+(p7)  fadd.s0  f8 = FR_Y_lo,FR_Y_hi               // If logl, result=Y_lo+Y_hi
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p14) fmpy.s1 FR_Output_X_tmp = FR_Y_lo,FR_1LN10_hi
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p14) fma.s1  FR_Output_X_tmp = FR_Y_hi,FR_1LN10_lo,FR_Output_X_tmp
+      nop.i 999
+}
+;;
+
+{ .mfb
+      nop.m 999
+(p14) fma.s0  f8 = FR_Y_hi,FR_1LN10_hi,FR_Output_X_tmp
+      br.ret.sptk   b0                        // Common exit for 0 < x < inf
+}
+;;
+
+
+// Here if x=+-0
+LOGL_64_zero: 
+//
+//    If x=+-0 raise divide by zero and return -inf
+//  
+{ .mfi
+(p7)  mov   GR_Parameter_TAG = 0
+      fsub.s1 FR_Output_X_tmp = f0, f1 
+      nop.i 999
+}
+;;
+
+{ .mfb
+(p14) mov   GR_Parameter_TAG = 6 
+      frcpa.s0 FR_Output_X_tmp, p8 =  FR_Output_X_tmp, f0 
+      br.cond.sptk __libm_error_region
+}
+;;
+
+LOGL_64_special: 
+{ .mfi
+      nop.m 999
+      fclass.m.unc p8, p0 =  FR_Input_X, 0x1E1  // Test for natval, nan, +inf
+      nop.i 999
+}
+;;
+
+//     
+//    For SNaN raise invalid and return QNaN.
+//    For QNaN raise invalid and return QNaN.
+//    For +Inf return +Inf.
+//    
+{ .mfb
+      nop.m 999
+(p8)  fmpy.s0 f8 =  FR_Input_X, f1 
+(p8)  br.ret.sptk   b0                          // Return for natval, nan, +inf
+}
+;;
+
+//    
+//    For -Inf raise invalid and return QNaN.
+//    
+{ .mmi
+(p7)  mov   GR_Parameter_TAG = 1
+      nop.m 999
+      nop.i 999
+}
+;;
+
+{ .mfb
+(p14) mov   GR_Parameter_TAG = 7
+      fmpy.s0 FR_Output_X_tmp =  FR_Input_X, f0 
+      br.cond.sptk __libm_error_region
+}
+;;
+
+// Here if x denormal or unnormal
+LOGL_64_denormal:
+{ .mmi
+      getf.sig GR_signif = FR_X_Prime   // Get significand of normalized input
+      nop.m 999
+      nop.i 999
+}
+;;
+
+{ .mmb
+      getf.exp GR_N =  FR_X_Prime       // Get exponent of normalized input
+      nop.m 999
+      br.cond.sptk   LOGL_64_COMMON     // Branch back to common code
+}
+;;
+
+LOGL_64_unsupported: 
+//    
+//    Return generated NaN or other value.
+//    
+{ .mfb
+      nop.m 999
+      fmpy.s0 f8 = FR_Input_X, f0 
+      br.ret.sptk   b0
+}
+;;
+
+// Here if -inf < x < 0
+LOGL_64_negative: 
+//     
+//    Deal with x < 0 in a special way - raise
+//    invalid and produce QNaN indefinite.
+//    
+{ .mfi
+(p7)  mov   GR_Parameter_TAG = 1
+      frcpa.s0 FR_Output_X_tmp, p8 =  f0, f0
+      nop.i 999
+}
+;;
+
+{ .mib
+(p14) mov   GR_Parameter_TAG = 7
+      nop.i 999
+      br.cond.sptk __libm_error_region
+}
+;;
+
+
+GLOBAL_IEEE754_END(log10l)
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
+};;
+.body
+{ .mib
+        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+        nop.b 0                                 // Parameter 3 address
+}
+{ .mib
+        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+{ .mmi
+        nop.m 999
+        nop.m 999
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region#)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_pow.S b/sysdeps/ia64/fpu/e_pow.S
index 56f7f078ba..89449c79ec 100644
--- a/sysdeps/ia64/fpu/e_pow.S
+++ b/sysdeps/ia64/fpu/e_pow.S
@@ -1,10 +1,10 @@
 .file "pow.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,30 +35,42 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 2/03/00  Added p12 to definite over/under path. With odd power we did not
+// 02/02/00 Initial version
+// 02/03/00 Added p12 to definite over/under path. With odd power we did not
 //          maintain the sign of x in this path.
-// 4/04/00  Unwind support added
-// 4/19/00  pow(+-1,inf) now returns NaN
-//          pow(+-val, +-inf) returns 0 or inf, but now does not call error support
+// 04/04/00 Unwind support added
+// 04/19/00 pow(+-1,inf) now returns NaN
+//          pow(+-val, +-inf) returns 0 or inf, but now does not call error
+//          support
 //          Added s1 to fcvt.fx because invalid flag was incorrectly set.
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 9/07/00  Improved performance by eliminating bank conflicts and other stalls,
+// 09/07/00 Improved performance by eliminating bank conflicts and other stalls,
 //          and tweaking the critical path
-// 9/08/00  Per c99, pow(+-1,inf) now returns 1, and pow(+1,nan) returns 1
-// 9/28/00  Updated NaN**0 path 
-// 1/20/01  Fixed denormal flag settings.
-// 2/12/01  Improved speed.
+// 09/08/00 Per c99, pow(+-1,inf) now returns 1, and pow(+1,nan) returns 1
+// 09/28/00 Updated NaN**0 path
+// 01/20/01 Fixed denormal flag settings.
+// 02/13/01 Improved speed.
+// 03/19/01 Reordered exp polynomial to improve speed and eliminate monotonicity
+//          problem in round up, down, and to zero modes.  Also corrected
+//          overflow result when x negative, y odd in round up, down, zero.
+// 06/14/01 Added brace missing from bundle
+// 12/10/01 Corrected case where x negative, 2^52 <= |y| < 2^53, y odd integer.
+// 12/20/01 Fixed monotonity problem in round to nearest.
+// 02/08/02 Fixed overflow/underflow cases that were not calling error support.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 08/29/02 Improved Itanium 2 performance
+// 09/21/02 Added branch for |y*log(x)|<2^-11 to fix monotonicity problems.
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 03/31/05 Reformatted delimiters between data tables
 //
 // API
 //==============================================================
-// double pow(double)
-// float  powf(float)
+// double pow(double x, double y)
 //
 // Overview of operation
 //==============================================================
@@ -67,51 +79,51 @@
 // 1. Log(x)
 // 2. y Log(x)
 // 3. exp(y log(x))
-// 
+//
 // This means we work with the absolute value of x and merge in the sign later.
 //      Log(x) = G + delta + r -rsq/2 + p
 // G,delta depend on the exponent of x and table entries. The table entries are
 // indexed by the exponent of x, called K.
-// 
+//
 // The G and delta come out of the reduction; r is the reduced x.
-// 
+//
 // B = frcpa(x)
 // xB-1 is small means that B is the approximate inverse of x.
-// 
+//
 //      Log(x) = Log( (1/B)(Bx) )
 //             = Log(1/B) + Log(Bx)
 //             = Log(1/B) + Log( 1 + (Bx-1))
-// 
+//
 //      x  = 2^K 1.x_1x_2.....x_52
-//      B= frcpa(x) = 2^-k Cm 
+//      B= frcpa(x) = 2^-k Cm
 //      Log(1/B) = Log(1/(2^-K Cm))
 //      Log(1/B) = Log((2^K/ Cm))
 //      Log(1/B) = K Log(2) + Log(1/Cm)
-// 
+//
 //      Log(x)   = K Log(2) + Log(1/Cm) + Log( 1 + (Bx-1))
-// 
+//
 // If you take the significand of x, set the exponent to true 0, then Cm is
 // the frcpa. We tabulate the Log(1/Cm) values. There are 256 of them.
 // The frcpa table is indexed by 8 bits, the x_1 thru x_8.
 // m = x_1x_2...x_8 is an 8-bit index.
-// 
+//
 //      Log(1/Cm) = log(1/frcpa(1+m/256)) where m goes from 0 to 255.
-// 
+//
 // We tabluate as two doubles, T and t, where T +t is the value itself.
-// 
+//
 //      Log(x)   = (K Log(2)_hi + T) + (Log(2)_hi + t) + Log( 1 + (Bx-1))
 //      Log(x)   =  G + delta           + Log( 1 + (Bx-1))
-// 
+//
 // The Log( 1 + (Bx-1)) can be calculated as a series in r = Bx-1.
-// 
+//
 //      Log( 1 + (Bx-1)) = r - rsq/2 + p
-// 
+//
 // Then,
-//    
+//
 //      yLog(x) = yG + y delta + y(r-rsq/2) + yp
 //      yLog(x) = Z1 + e3      + Z2         + Z3 + (e2 + e3)
-// 
-// 
+//
+//
 //     exp(yLog(x)) = exp(Z1 + Z2 + Z3) exp(e1 + e2 + e3)
 //
 //
@@ -133,7 +145,7 @@
 //       exp(r)       = exp(Z - N log2/128)
 //
 //      r = s + d = (Z - N (log2/128)_hi) -N (log2/128)_lo
-//                =  Z - N (log2/128) 
+//                =  Z - N (log2/128)
 //
 //      Z         = s+d +N (log2/128)
 //
@@ -149,22 +161,22 @@
 //      n log2/128 = n_7n_6n_5 log2/8 + n_4n_3n_2n_1 log2/128
 //      n log2/128 = I2 log2/8 + I1 log2/128
 //
-//      N log2/128 = M log2 + I2 log2/8 + I1 log2/128 
+//      N log2/128 = M log2 + I2 log2/8 + I1 log2/128
 //
 //      exp(Z)    = exp(s) (1+d) exp(log(2^M) + log(2^I2/8) + log(2^I1/128))
 //      exp(Z)    = exp(s) (1+d1) (1+d2)(2^M) 2^I2/8 2^I1/128
 //      exp(Z)    = exp(s) f1 f2 (2^M) 2^I2/8 2^I1/128
 //
 // I1, I2 are table indices. Use a series for exp(s).
-// Then get exp(Z) 
+// Then get exp(Z)
 //
 //     exp(yLog(x)) = exp(Z1 + Z2 + Z3) exp(e1 + e2 + e3)
-//     exp(yLog(x)) = exp(Z) exp(Z3) f3 
-//     exp(yLog(x)) = exp(Z)f3 exp(Z3)  
-//     exp(yLog(x)) = A exp(Z3)  
+//     exp(yLog(x)) = exp(Z) exp(Z3) f3
+//     exp(yLog(x)) = exp(Z)f3 exp(Z3)
+//     exp(yLog(x)) = A exp(Z3)
 //
 // We actually calculate exp(Z3) -1.
-// Then, 
+// Then,
 //     exp(yLog(x)) = A + A( exp(Z3)   -1)
 //
 
@@ -175,142 +187,146 @@
 // ==============
 // The operation (K*log2_hi) must be exact. K is the true exponent of x.
 // If we allow gradual underflow (denormals), K can be represented in 12 bits
-// (as a two's complement number). We assume 13 bits as an engineering precaution.
-// 
+// (as a two's complement number). We assume 13 bits as an engineering
+// precaution.
+//
 //           +------------+----------------+-+
 //           |  13 bits   | 50 bits        | |
 //           +------------+----------------+-+
 //           0            1                66
 //                        2                34
-// 
+//
 // So we want the lsb(log2_hi) to be 2^-50
 // We get log2 as a quad-extended (15-bit exponent, 128-bit significand)
-// 
+//
 //      0 fffe b17217f7d1cf79ab c9e3b39803f2f6af (4...)
-// 
+//
 // Consider numbering the bits left to right, starting at 0 thru 127.
 // Bit 0 is the 2^-1 bit; bit 49 is the 2^-50 bit.
-// 
+//
 //  ...79ab
 //     0111 1001 1010 1011
 //     44
 //     89
-// 
-// So if we shift off the rightmost 14 bits, then (shift back only 
+//
+// So if we shift off the rightmost 14 bits, then (shift back only
 // the top half) we get
-// 
+//
 //      0 fffe b17217f7d1cf4000 e6af278ece600fcb dabc000000000000
-// 
+//
 // Put the right 64-bit signficand in an FR register, convert to double;
 // it is exact. Put the next 128 bits into a quad register and round to double.
 // The true exponent of the low part is -51.
-// 
+//
 // hi is 0 fffe b17217f7d1cf4000
 // lo is 0 ffcc e6af278ece601000
-// 
+//
 // Convert to double memory format and get
-// 
+//
 // hi is 0x3fe62e42fefa39e8
-// lo is 0x3cccd5e4f1d9cc02 
-// 
+// lo is 0x3cccd5e4f1d9cc02
+//
 // log2_hi + log2_lo is an accurate value for log2.
-// 
-// 
+//
+//
 // The T and t values
 // ==================
 // A similar method is used to generate the T and t values.
-// 
+//
 // K * log2_hi + T  must be exact.
-// 
+//
 // Smallest T,t
 // ----------
-// The smallest T,t is 
+// The smallest T,t is
 //       T                   t
-// data8 0x3f60040155d58800, 0x3c93bce0ce3ddd81  log(1/frcpa(1+0/256))=  +1.95503e-003
-// 
+// 0x3f60040155d58800, 0x3c93bce0ce3ddd81  log(1/frcpa(1+0/256))=  +1.95503e-003
+//
 // The exponent is 0x3f6 (biased)  or -9 (true).
 // For the smallest T value, what we want is to clip the significand such that
-// when it is shifted right by 9, its lsb is in the bit for 2^-51. The 9 is the specific 
-// for the first entry. In general, it is 0xffff - (biased 15-bit exponent).
+// when it is shifted right by 9, its lsb is in the bit for 2^-51. The 9 is the
+// specific for the first entry. In general, it is 0xffff - (biased 15-bit
+// exponent).
 
-// Independently, what we have calculated is the table value as a quad precision number.
+// Independently, what we have calculated is the table value as a quad
+// precision number.
 // Table entry 1 is
 // 0 fff6 80200aaeac44ef38 338f77605fdf8000
-// 
+//
 // We store this quad precision number in a data structure that is
-//    sign:           1 
+//    sign:           1
 //    exponent:      15
 //    signficand_hi: 64 (includes explicit bit)
 //    signficand_lo: 49
 // Because the explicit bit is included, the significand is 113 bits.
-// 
+//
 // Consider significand_hi for table entry 1.
-// 
-// 
+//
+//
 // +-+--- ... -------+--------------------+
 // | |
 // +-+--- ... -------+--------------------+
 // 0 1               4444444455555555556666
 //                   2345678901234567890123
-// 
+//
 // Labeled as above, bit 0 is 2^0, bit 1 is 2^-1, etc.
 // Bit 42 is 2^-42. If we shift to the right by 9, the bit in
 // bit 42 goes in 51.
-// 
+//
 // So what we want to do is shift bits 43 thru 63 into significand_lo.
-// This is shifting bit 42 into bit 63, taking care to retain the shifted-off bits.
-// Then shifting (just with signficaand_hi) back into bit 42. 
-//  
-// The shift_value is 63-42 = 21. In general, this is 
+// This is shifting bit 42 into bit 63, taking care to retain shifted-off bits.
+// Then shifting (just with signficaand_hi) back into bit 42.
+//
+// The shift_value is 63-42 = 21. In general, this is
 //      63 - (51 -(0xffff - 0xfff6))
 // For this example, it is
 //      63 - (51 - 9) = 63 - 42  = 21
-// 
-// This means we are shifting 21 bits into significand_lo.  We must maintain more
-// that a 128-bit signficand not to lose bits. So before the shift we put the 128-bit 
-// significand into a 256-bit signficand and then shift.
+//
+// This means we are shifting 21 bits into significand_lo. We must maintain more
+// that a 128-bit signficand not to lose bits. So before the shift we put the
+// 128-bit significand into a 256-bit signficand and then shift.
 // The 256-bit significand has four parts: hh, hl, lh, and ll.
-// 
+//
 // Start off with
 //      hh         hl         lh         ll
 //      <64>       <49><15_0> <64_0>     <64_0>
-// 
+//
 // After shift by 21 (then return for significand_hi),
 //      <43><21_0> <21><43>   <6><58_0>  <64_0>
-// 
+//
 // Take the hh part and convert to a double. There is no rounding here.
-// The conversion is exact. The true exponent of the high part is the same as the
-// true exponent of the input quad.
-// 
-// We have some 64 plus significand bits for the low part. In this example, we have
-// 70 bits. We want to round this to a double. Put them in a quad and then do a quad fnorm.
-// For this example the true exponent of the low part is 
+// The conversion is exact. The true exponent of the high part is the same as
+// the true exponent of the input quad.
+//
+// We have some 64 plus significand bits for the low part. In this example, we
+// have 70 bits. We want to round this to a double. Put them in a quad and then
+// do a quad fnorm.
+// For this example the true exponent of the low part is
 //      true_exponent_of_high - 43 = true_exponent_of_high - (64-21)
-// In general, this is 
-//      true_exponent_of_high - (64 - shift_value)  
-// 
-// 
+// In general, this is
+//      true_exponent_of_high - (64 - shift_value)
+//
+//
 // Largest T,t
 // ----------
 // The largest T,t is
-// data8 0x3fe62643fecf9742, 0x3c9e3147684bd37d    log(1/frcpa(1+255/256))=  +6.92171e-001
-// 
+// 0x3fe62643fecf9742, 0x3c9e3147684bd37d  log(1/frcpa(1+255/256))=+6.92171e-001
+//
 // Table entry 256 is
 // 0 fffe b1321ff67cba178c 51da12f4df5a0000
-// 
-// The shift value is 
+//
+// The shift value is
 //      63 - (51 -(0xffff - 0xfffe)) = 13
-// 
-// The true exponent of the low part is 
+//
+// The true exponent of the low part is
 //      true_exponent_of_high - (64 - shift_value)
 //      -1 - (64-13) = -52
 // Biased as a double, this is 0x3cb
-// 
-// 
-// 
+//
+//
+//
 // So then lsb(T) must be >= 2^-51
 // msb(Klog2_hi) <= 2^12
-// 
+//
 //              +--------+---------+
 //              |       51 bits    | <== largest T
 //              +--------+---------+
@@ -320,7 +336,6 @@
 // +------------+----------------+-+
 
 
-
 // Special Cases
 //==============================================================
 
@@ -385,63 +400,67 @@
 
 // X any   Y =0               +1
 
-#include "libm_support.h"
-
 // Assembly macros
 //==============================================================
 
 // integer registers used
 
-pow_AD_Tt                 = r33
-pow_GR_FFF7               = r34
-pow_GR_exp_Y              = r34 // duplicate
-pow_GR_17ones             = r35
-
-pow_AD_P                  = r36
-pow_AD_Q                  = r37
-pow_AD_tbl1               = r38
-pow_AD_tbl2               = r39
-pow_GR_exp_X              = r40
-pow_GR_true_exp_X         = r40 // duplicate
-
-pow_GR_offset             = r41
-pow_GR_exp_Xm1            = r42
-pow_GR_sig_X              = r43
-pow_GR_signexp_X          = r44
-
-pow_GR_signexp_Xm1        = r46
-pow_GR_int_W1             = r47
-pow_GR_int_W2             = r48
-pow_GR_int_N              = r49
-pow_GR_index1             = r50
-
-pow_GR_index2             = r51
-pow_AD_T1                 = r52
-pow_AD_T2                 = r53
-pow_GR_gt_ln              = r53 // duplicate
-pow_int_GR_M              = r54
-pow_GR_10033              = r55
-
-pow_GR_16ones             = r56
-pow_GR_sig_int_Y          = r57
-pow_GR_sign_Y_Gpr         = r58
-pow_GR_17ones_m1          = r59
-pow_GR_one                = r60
-pow_GR_sign_Y             = r60 
-
-pow_GR_signexp_Y_Gpr      = r61 
-pow_GR_exp_Y_Gpr          = r62 
-pow_GR_true_exp_Y_Gpr     = r63 
-pow_GR_signexp_Y          = r64 
-
-GR_SAVE_B0                = r65
-GR_SAVE_GP                = r66
-GR_SAVE_PFS               = r67
-
-GR_Parameter_X            = r68
-GR_Parameter_Y            = r69
-GR_Parameter_RESULT       = r70
-pow_GR_tag                = r71
+pow_GR_signexp_X          = r14
+pow_GR_17ones             = r15
+pow_AD_P                  = r16
+pow_GR_exp_2tom8          = r17
+pow_GR_sig_X              = r18
+pow_GR_10033              = r19
+pow_GR_16ones             = r20
+
+pow_AD_Tt                 = r21
+pow_GR_exp_X              = r22
+pow_AD_Q                  = r23
+pow_GR_true_exp_X         = r24
+pow_GR_y_zero             = r25
+
+pow_GR_exp_Y              = r26
+pow_AD_tbl1               = r27
+pow_AD_tbl2               = r28
+pow_GR_offset             = r29
+pow_GR_exp_Xm1            = r30
+pow_GR_xneg_yodd          = r31
+
+pow_GR_signexp_Xm1        = r35
+pow_GR_int_W1             = r36
+pow_GR_int_W2             = r37
+pow_GR_int_N              = r38
+pow_GR_index1             = r39
+pow_GR_index2             = r40
+
+pow_AD_T1                 = r41
+pow_AD_T2                 = r42
+pow_int_GR_M              = r43
+pow_GR_sig_int_Y          = r44
+pow_GR_sign_Y_Gpr         = r45
+
+pow_GR_17ones_m1          = r46
+pow_GR_one                = r47
+pow_GR_sign_Y             = r48
+pow_GR_signexp_Y_Gpr      = r49
+pow_GR_exp_Y_Gpr          = r50
+
+pow_GR_true_exp_Y_Gpr     = r51
+pow_GR_signexp_Y          = r52
+pow_GR_x_one              = r53
+pow_GR_exp_2toM63         = r54
+pow_GR_big_pos            = r55
+
+pow_GR_big_neg            = r56
+
+GR_SAVE_B0                = r50
+GR_SAVE_GP                = r51
+GR_SAVE_PFS               = r52
+
+GR_Parameter_X            = r53
+GR_Parameter_Y            = r54
+GR_Parameter_RESULT       = r55
+pow_GR_tag                = r56
 
 
 // floating point registers used
@@ -464,7 +483,8 @@ POW_log2_lo               = f43
 POW_r                     = f44
 POW_Q0_half               = f45
 
-POW_Q1                    = f46  
+POW_Q1                    = f46
+POW_tmp                   = f47
 POW_log2_hi               = f48
 POW_Q4                    = f49
 POW_P1                    = f50
@@ -476,6 +496,7 @@ POW_Yrcub                 = f54
 POW_log2_by_128_lo        = f55
 
 POW_v6                    = f56
+POW_xsq                   = f57
 POW_v4                    = f58
 POW_v2                    = f59
 POW_T                     = f60
@@ -484,6 +505,7 @@ POW_Tt                    = f61
 POW_RSHF                  = f62
 POW_v21ps                 = f63
 POW_s4                    = f64
+POW_twoV                  = f65
 
 POW_U                     = f66
 POW_G                     = f67
@@ -533,44 +555,45 @@ POW_1ps                   = f103
 POW_A                     = f104
 POW_es                    = f105
 
+POW_Xp1                   = f106
 POW_int_K                 = f107
 POW_K                     = f108
 POW_f123                  = f109
 POW_Gpr                   = f110
 
-POW_Y_Gpr                 = f111 
+POW_Y_Gpr                 = f111
 POW_int_Y                 = f112
+POW_abs_q                 = f114
+POW_2toM63                = f115
 
 POW_float_int_Y           = f116
 POW_ftz_urm_f8            = f117
 POW_wre_urm_f8            = f118
-POW_abs_A                 = f119
-POW_gt_pln                = f120
+POW_big_neg               = f119
+POW_big_pos               = f120
 
-POW_xsq                   = f121
-
-POW_twoV                  = f122
-POW_Xp1                   = f123
+POW_GY_Z2                 = f121
+POW_pYrcub_e3             = f122
+POW_d                     = f123
+POW_d2                    = f124
+POW_poly_d_hi             = f121
+POW_poly_d_lo             = f122
+POW_poly_d                = f121
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-pow_table_P:
-ASM_TYPE_DIRECTIVE(pow_table_P,@object)
+LOCAL_OBJECT_START(pow_table_P)
 data8 0x8000F7B249FF332D, 0x0000BFFC  // P_5
 data8 0xAAAAAAA9E7902C7F, 0x0000BFFC  // P_3
 data8 0x80000000000018E5, 0x0000BFFD  // P_1
 data8 0xb8aa3b295c17f0bc, 0x00004006  // inv_ln2_by_128
-
-
+//
+//
 data8 0x3FA5555555554A9E // Q_2
 data8 0x3F8111124F4DD9F9 // Q_3
 data8 0x3FE0000000000000 // Q_0
@@ -580,20 +603,18 @@ data8 0x43e8000000000000 // Right shift constant for exp
 data8 0xc9e3b39803f2f6af, 0x00003fb7  // ln2_by_128_lo
 data8 0x0000000000000000 // pad to eliminate bank conflicts with pow_table_Q
 data8 0x0000000000000000 // pad to eliminate bank conflicts with pow_table_Q
-ASM_SIZE_DIRECTIVE(pow_table_P)
+LOCAL_OBJECT_END(pow_table_P)
 
-pow_table_Q:
-ASM_TYPE_DIRECTIVE(pow_table_Q,@object)
+LOCAL_OBJECT_START(pow_table_Q)
 data8 0x9249FE7F0DC423CF, 0x00003FFC  // P_4
 data8 0xCCCCCCCC4ED2BA7F, 0x00003FFC  // P_2
 data8 0xAAAAAAAAAAAAB505, 0x00003FFD  // P_0
 data8 0x3fe62e42fefa39e8, 0x3cccd5e4f1d9cc02 // log2 hi lo =  +6.93147e-001
 data8 0xb17217f7d1cf79ab, 0x00003ff7  // ln2_by_128_hi
-ASM_SIZE_DIRECTIVE(pow_table_Q)
+LOCAL_OBJECT_END(pow_table_Q)
 
 
-pow_Tt:
-ASM_TYPE_DIRECTIVE(pow_Tt,@object)
+LOCAL_OBJECT_START(pow_Tt)
 data8 0x3f60040155d58800, 0x3c93bce0ce3ddd81 // log(1/frcpa(1+0/256))=  +1.95503e-003
 data8 0x3f78121214586a00, 0x3cb540e0a5cfc9bc // log(1/frcpa(1+1/256))=  +5.87661e-003
 data8 0x3f841929f9683200, 0x3cbdf1d57404da1f // log(1/frcpa(1+2/256))=  +9.81362e-003
@@ -850,13 +871,12 @@ data8 0x3fe5f673c61a2ed0, 0x3caa385eef5f2789 // log(1/frcpa(1+252/256))=  +6.863
 data8 0x3fe6065bea385924, 0x3cb11624f165c5b4 // log(1/frcpa(1+253/256))=  +6.88276e-001
 data8 0x3fe6164bfa7cc068, 0x3cbad884f87073fa // log(1/frcpa(1+254/256))=  +6.90222e-001
 data8 0x3fe62643fecf9740, 0x3cb78c51da12f4df // log(1/frcpa(1+255/256))=  +6.92171e-001
-ASM_SIZE_DIRECTIVE(pow_Tt)
+LOCAL_OBJECT_END(pow_Tt)
 
 
 // Table 1 is 2^(index_1/128) where
 // index_1 goes from 0 to 15
-pow_tbl1:
-ASM_TYPE_DIRECTIVE(pow_tbl1,@object)
+LOCAL_OBJECT_START(pow_tbl1)
 data8 0x8000000000000000 , 0x00003FFF
 data8 0x80B1ED4FD999AB6C , 0x00003FFF
 data8 0x8164D1F3BC030773 , 0x00003FFF
@@ -873,13 +893,12 @@ data8 0x88980E8092DA8527 , 0x00003FFF
 data8 0x8955EE03618E5FDD , 0x00003FFF
 data8 0x8A14D575496EFD9A , 0x00003FFF
 data8 0x8AD4C6452C728924 , 0x00003FFF
-ASM_SIZE_DIRECTIVE(pow_tbl1)
+LOCAL_OBJECT_END(pow_tbl1)
 
 
 // Table 2 is 2^(index_1/8) where
 // index_2 goes from 0 to 7
-pow_tbl2:
-ASM_TYPE_DIRECTIVE(pow_tbl2,@object)
+LOCAL_OBJECT_START(pow_tbl2)
 data8 0x8000000000000000 , 0x00003FFF
 data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
 data8 0x9837F0518DB8A96F , 0x00003FFF
@@ -888,402 +907,319 @@ data8 0xB504F333F9DE6484 , 0x00003FFF
 data8 0xC5672A115506DADD , 0x00003FFF
 data8 0xD744FCCAD69D6AF4 , 0x00003FFF
 data8 0xEAC0C6E7DD24392F , 0x00003FFF
-ASM_SIZE_DIRECTIVE(pow_tbl2)
-
-.global pow
+LOCAL_OBJECT_END(pow_tbl2)
 
 .section .text
-.proc  pow
-.align 32
-
-pow:
+GLOBAL_LIBM_ENTRY(pow)
 
+// Get exponent of x.  Will be used to calculate K.
 { .mfi
-          alloc         r32=ar.pfs,1,35,4,0 
-          fms.s1 POW_Xm1 = f8,f1,f1   // Will be used for r1 if x>0
-          mov           pow_GR_17ones  = 0x1FFFF
+          getf.exp     pow_GR_signexp_X = f8
+          fms.s1 POW_Xm1 = f8,f1,f1     // Will be used for r1 if x>0
+          mov           pow_GR_17ones   = 0x1FFFF
 }
 { .mfi
-(p0)      addl          pow_AD_P   = @ltoff(pow_table_P), gp
-          fma.s1 POW_Xp1 = f8,f1,f1   // Will be used for r1 if x<0
+          addl          pow_AD_P        = @ltoff(pow_table_P), gp
+          fma.s1 POW_Xp1 = f8,f1,f1     // Will be used for r1 if x<0
           nop.i 999
 ;;
 }
 
-
-// Get exponent of x.  Will be used to calculate K.
+// Get significand of x.  Will be used to get index to fetch T, Tt.
 { .mfi
-          getf.exp      pow_GR_signexp_X    = f8
-          frcpa.s1      POW_B, p6   = f1,f8
+          getf.sig      pow_GR_sig_X    = f8
+          frcpa.s1      POW_B, p6       = f1,f8
           nop.i 999
 }
 { .mfi
           ld8 pow_AD_P = [pow_AD_P]
-          fma.s1        POW_NORM_X     = f8,f1,f0
-          mov           pow_GR_FFF7    = 0xFFF7
+          fma.s1        POW_NORM_X      = f8,f1,f0
+          mov          pow_GR_exp_2tom8 = 0xFFF7
 }
 ;;
 
-
-
-// Get significand of x.  Will be used to get index to fetch T, Tt.
 // p13 = TRUE ==> X is unorm
 // DOUBLE 0x10033  exponent limit at which y is an integer
-// SINGLE 0x10016
 { .mfi
-          getf.sig      pow_GR_sig_X        = f8
-          fclass.m  p13,p0          = f8, 0x0b  // Test for x unorm
-          addl pow_GR_10033                 = 0x10033, r0
+          nop.m 999
+          fclass.m  p13,p0              = f8, 0x0b  // Test for x unorm
+          addl pow_GR_10033             = 0x10033, r0
 }
 { .mfi
           mov           pow_GR_16ones   = 0xFFFF
-          fma.s1        POW_NORM_Y     = f9,f1,f0
+          fma.s1        POW_NORM_Y      = f9,f1,f0
           nop.i 999
 }
 ;;
 
-
 // p14 = TRUE ==> X is ZERO
 { .mfi
           adds          pow_AD_Tt       = pow_Tt - pow_table_P,  pow_AD_P
-          fclass.m  p14,p15          = f8, 0x07
-          and           pow_GR_exp_X        = pow_GR_signexp_X, pow_GR_17ones
+          fclass.m  p14,p0              = f8, 0x07
+          and           pow_GR_exp_X    = pow_GR_signexp_X, pow_GR_17ones
 }
 { .mfi
-          adds          pow_AD_Q       = pow_table_Q - pow_table_P,  pow_AD_P
+          adds          pow_AD_Q        = pow_table_Q - pow_table_P,  pow_AD_P
           nop.f 999
           nop.i 999
 }
 ;;
 
 { .mfi
-          ldfe          POW_P5         = [pow_AD_P], 16
-          fcmp.lt.s1 p8,p9 = f8, f0    // Test for x<0
-          shl           pow_GR_offset       = pow_GR_sig_X, 1
+          ldfe          POW_P5          = [pow_AD_P], 16
+          fcmp.lt.s1 p8,p9 = f8, f0     // Test for x<0
+          nop.i 999
 }
 { .mib
-          ldfe          POW_P4         = [pow_AD_Q], 16
-          sub       pow_GR_true_exp_X       = pow_GR_exp_X, pow_GR_16ones
-(p13)     br.cond.spnt L(POW_X_DENORM)
+          ldfe          POW_P4          = [pow_AD_Q], 16
+          sub       pow_GR_true_exp_X   = pow_GR_exp_X, pow_GR_16ones
+(p13)     br.cond.spnt POW_X_DENORM
 }
 ;;
 
-
 // Continue normal and denormal paths here
-L(POW_COMMON):
+POW_COMMON:
 // p11 = TRUE ==> Y is a NAN
 { .mfi
-          ldfe          POW_P3         = [pow_AD_P], 16
-          fclass.m.unc  p11,p0         = f9, 0xc3
-          shr.u     pow_GR_offset           = pow_GR_offset,56
+          ldfe          POW_P3          = [pow_AD_P], 16
+          fclass.m  p11,p0              = f9, 0xc3
+          nop.i 999
 }
 { .mfi
-          ldfe          POW_P2         = [pow_AD_Q], 16
+          ldfe          POW_P2          = [pow_AD_Q], 16
           nop.f 999
-          nop.i 999
+          mov pow_GR_y_zero = 0
 }
 ;;
 
-
-
-// Compute xsq to decide later if |x|=1
-// p11 = TRUE ==> Y is a NaN
+// Note POW_Xm1 and POW_r1 are used interchangably
 { .mfi
-          setf.sig POW_int_K                = pow_GR_true_exp_X
-(p15)     fms.s1        POW_r          = POW_B, POW_NORM_X,f1
-          shladd pow_AD_Tt = pow_GR_offset, 4, pow_AD_Tt
+          alloc         r32=ar.pfs,2,19,4,0
+          fms.s1        POW_r           = POW_B, POW_NORM_X,f1
+          nop.i 999
 }
 { .mfi
-          nop.m 999
-(p8)      fnma.s1        POW_Xm1       = POW_Xp1,f1,f0
+          setf.sig POW_int_K            = pow_GR_true_exp_X
+(p8)      fnma.s1        POW_Xm1        = POW_Xp1,f1,f0
           nop.i 999
 }
 ;;
 
-
-
-// p12 = TRUE ==> X is ZERO and Y is ZERO
+// p12 = TRUE if Y is ZERO
+// Compute xsq to decide later if |x|=1
 { .mfi
-          ldfe          POW_P1         = [pow_AD_P], 16
-(p14)     fclass.m.unc  p12,p0              = f9, 0x07
-          nop.i 999
+          ldfe          POW_P1          = [pow_AD_P], 16
+          fclass.m      p12,p0          = f9, 0x07
+          shl           pow_GR_offset   = pow_GR_sig_X, 1
 }
 { .mfb
-          ldfe          POW_P0         = [pow_AD_Q], 16
+          ldfe          POW_P0          = [pow_AD_Q], 16
           fma.s1        POW_xsq = POW_NORM_X, POW_NORM_X, f0
-(p11)     br.cond.spnt   L(POW_Y_NAN)
+(p11)     br.cond.spnt  POW_Y_NAN       // Branch if y=nan
 }
 ;;
 
-
-.pred.rel "mutex",p8,p9
 // Get exponent of |x|-1 to use in comparison to 2^-8
-{ .mmf
-(p8)      getf.exp      pow_GR_signexp_Xm1  = POW_Xp1
-(p9)      getf.exp      pow_GR_signexp_Xm1  = POW_Xm1
-          fcvt.fx.s1   POW_int_Y            = POW_NORM_Y
+{ .mfi
+          getf.exp  pow_GR_signexp_Xm1  = POW_Xm1
+          fcvt.fx.s1   POW_int_Y        = POW_NORM_Y
+          shr.u     pow_GR_offset       = pow_GR_offset,56
 }
 ;;
 
-
 // p11 = TRUE ==> X is a NAN
 { .mfi
           ldfpd         POW_log2_hi, POW_log2_lo  = [pow_AD_Q], 16
-          fclass.m.unc  p11,p0              = f8, 0xc3
-          nop.i 999
-}
-{ .mib
-          ldfpd  POW_T, POW_Tt              = [pow_AD_Tt], 16
-          nop.i 999
-(p12)     br.cond.spnt L(POW_X_0_Y_0)
+          fclass.m      p11,p0          = f8, 0xc3
+          shladd pow_AD_Tt = pow_GR_offset, 4, pow_AD_Tt
 }
-;;
-
-
-// p14 = TRUE ==> X is zero
-//    p15 = TRUE ==> X is zero AND Y is negative
-//    p10 = TRUE ==> X is zero AND Y is >= zero 
 { .mfi
           ldfe          POW_inv_log2_by_128 = [pow_AD_P], 16
-(p14)     fcmp.lt.unc.s1 p15, p10           = f9,f0
-          nop.i 999
+          fma.s1 POW_delta              = f0,f0,f0 // delta=0 in case |x| near 1
+(p12)     mov pow_GR_y_zero = 1
 }
-{ .mfi
-          nop.m 999
-          nop.f 999
-          and       pow_GR_exp_Xm1          = pow_GR_signexp_Xm1, pow_GR_17ones
-} 
-;;
-
-
-// Determine if we will use the |x| near 1 path (p6) or normal path (p7)
-// p12 = TRUE ==> X is a NAN and Y is a zero
-// p13 = TRUE ==> X is a NAN and Y is anything else
-{ .mfi
-          getf.exp  pow_GR_signexp_Y        = POW_NORM_Y 
-(p11)     fclass.m.unc  p12,p13             = f9, 0x07
-          cmp.lt.unc p6,p7                  = pow_GR_exp_Xm1, pow_GR_FFF7
-}
-{ .mfi
-          ldfpd  POW_Q2, POW_Q3             = [pow_AD_P], 16
-          fma.s1        POW_rsq             = POW_r, POW_r,f0
-          nop.i 999
 ;;
-}
 
-// If on the x near 1 path, assign r1 to r and r1*r1 to rsq
 { .mfi
-          ldfpd  POW_Q0_half, POW_Q1             = [pow_AD_P], 16
-(p6)      fma.s1    POW_r                 = POW_r1, f1, f0
-          nop.i 999
+          ldfpd  POW_Q2, POW_Q3         = [pow_AD_P], 16
+          fma.s1 POW_G                  = f0,f0,f0  // G=0 in case |x| near 1
+          and       pow_GR_exp_Xm1      = pow_GR_signexp_Xm1, pow_GR_17ones
 }
-{ .mfi
-          nop.m 999
-(p6)      fma.s1    POW_rsq                 = POW_r1, POW_r1, f0
-          nop.i 999
 ;;
-}
-
 
+// Determine if we will use the |x| near 1 path (p6) or normal path (p7)
 { .mfi
-          ldfpd   POW_Q4, POW_RSHF          = [pow_AD_P], 16
-(p7)      fma.s1 POW_v6                     = POW_r,  POW_P5, POW_P4
-          and pow_GR_exp_Y                   = pow_GR_signexp_Y, pow_GR_17ones
+          getf.exp  pow_GR_signexp_Y    = POW_NORM_Y
+          nop.f 999
+          cmp.lt p6,p7                  = pow_GR_exp_Xm1, pow_GR_exp_2tom8
 }
 { .mfb
-          nop.m 999
-(p6)      fma.s1 POW_v6                     = POW_r1, POW_P5, POW_P4
-(p12)     br.cond.spnt L(POW_X_NAN_Y_0)
+          ldfpd  POW_T, POW_Tt          = [pow_AD_Tt], 16
+          fma.s1        POW_rsq         = POW_r, POW_r,f0
+(p11)     br.cond.spnt  POW_X_NAN       // Branch if x=nan and y not nan
 }
 ;;
 
-
+// If on the x near 1 path, assign r1 to r and r1*r1 to rsq
 { .mfi
-          nop.m 999
-(p7)      fma.s1 POW_v4                     = POW_P3, POW_r,  POW_P2 
-          andcm pow_GR_sign_Y               = pow_GR_signexp_Y, pow_GR_17ones
+          ldfpd  POW_Q0_half, POW_Q1    = [pow_AD_P], 16
+(p6)      fma.s1    POW_r               = POW_r1, f1, f0
+          nop.i 999
 }
 { .mfb
           nop.m 999
-(p6)      fma.s1 POW_v4                     = POW_P3, POW_r1, POW_P2 
-(p12)     br.cond.spnt L(POW_X_NAN_Y_0)
+(p6)      fma.s1    POW_rsq             = POW_r1, POW_r1, f0
+(p14)     br.cond.spnt POW_X_0          // Branch if x zero and y not nan
 }
 ;;
 
 { .mfi
-          nop.m 999
-          fcvt.xf POW_K                     = POW_int_K
+          ldfpd   POW_Q4, POW_RSHF      = [pow_AD_P], 16
+(p7)      fma.s1 POW_v6                 = POW_r,  POW_P5, POW_P4
           nop.i 999
 }
-{ .mfb
-          nop.m 999
-(p13)     fma.d f8                           = f8,f1,f0
-(p13)     br.ret.spnt  b0    // Exit if x nan, y anything but zero
+{ .mfi
+          mov pow_GR_exp_2toM63         = 0xffc0  // Exponent of 2^-63
+(p6)      fma.s1 POW_v6                 = POW_r1, POW_P5, POW_P4
+          nop.i 999
 }
 ;;
-          
-// p10 = TRUE ==> X is zero  AND Y is positive
-//  p8  = TRUE ==> X is zero  AND Y is outside integer range (treat as even int)
-//                   return +0
-//  p9  = TRUE ==> X is zero  AND Y is within integer range (may not be integer) 
+
 { .mfi
-(p10)     cmp.gt.unc p8,p9                  =  pow_GR_exp_Y, pow_GR_10033
-(p6)      fmerge.s POW_delta                 = f0,f0
+          setf.exp POW_2toM63 = pow_GR_exp_2toM63  // Form 2^-63 for test of q
+(p7)      fma.s1 POW_v4                 = POW_P3, POW_r,  POW_P2
           nop.i 999
 }
 { .mfi
           nop.m 999
-(p6)      fma.s1 POW_G                       = f0,f0,f0
+(p6)      fma.s1 POW_v4                 = POW_P3, POW_r1, POW_P2
           nop.i 999
 }
 ;;
 
 { .mfi
-          getf.sig pow_GR_sig_int_Y         = POW_int_Y
-          fnma.s1 POW_twoV                   = POW_NORM_Y, POW_rsq,f0
-          nop.i 999
-}
-{ .mfi
           nop.m 999
-          fma.s1 POW_U                      = POW_NORM_Y,POW_r,f0
+          fcvt.xf POW_K                 = POW_int_K
           nop.i 999
 }
 ;;
 
 { .mfi
-          ldfe      POW_log2_by_128_lo      = [pow_AD_P], 16
-(p6)      fma.s1 POW_v2                     = POW_P1, POW_r1, POW_P0 
-          nop.i 999
+          getf.sig pow_GR_sig_int_Y     = POW_int_Y
+          fnma.s1 POW_twoV              = POW_NORM_Y, POW_rsq,f0
+          and pow_GR_exp_Y              = pow_GR_signexp_Y, pow_GR_17ones
 }
-{ .mfi
-          ldfe          POW_log2_by_128_hi  = [pow_AD_Q], 16
-(p7)      fma.s1 POW_v2                     = POW_P1, POW_r,  POW_P0 
-          nop.i 999
+{ .mfb
+          andcm pow_GR_sign_Y           = pow_GR_signexp_Y, pow_GR_17ones
+          fma.s1 POW_U                  = POW_NORM_Y,POW_r,f0
+(p12)     br.cond.spnt POW_Y_0   // Branch if y=zero, x not zero or nan
 }
 ;;
 
-
+// p11 = TRUE ==> X is NEGATIVE but not inf
 { .mfi
-          nop.m 999
-          fcvt.xf   POW_float_int_Y               = POW_int_Y
+          ldfe      POW_log2_by_128_lo  = [pow_AD_P], 16
+          fclass.m  p11,p0              = f8, 0x1a
           nop.i 999
 }
 { .mfi
-          nop.m 999
-          fma.s1 POW_v3                     = POW_v6, POW_rsq,  POW_v4 
-          adds          pow_AD_tbl1       = pow_tbl1 - pow_Tt,  pow_AD_Q
+          ldfe      POW_log2_by_128_hi  = [pow_AD_Q], 16
+          fma.s1 POW_v2                 = POW_P1, POW_r,  POW_P0
+          nop.i 999
 }
 ;;
 
 { .mfi
           nop.m 999
-(p7)      fma.s1 POW_delta                  = POW_K, POW_log2_lo, POW_Tt
+          fcvt.xf   POW_float_int_Y     = POW_int_Y
           nop.i 999
 }
 { .mfi
           nop.m 999
-(p7)      fma.s1 POW_G                      = POW_K, POW_log2_hi, POW_T 
-          adds pow_AD_tbl2                  = pow_tbl2 - pow_tbl1,  pow_AD_tbl1
+          fma.s1 POW_v3                 = POW_v6, POW_rsq,  POW_v4
+          adds          pow_AD_tbl1     = pow_tbl1 - pow_Tt,  pow_AD_Q
 }
 ;;
 
-
 { .mfi
           nop.m 999
-          fms.s1 POW_e2                     = POW_NORM_Y, POW_r, POW_U
+(p7)      fma.s1 POW_delta              = POW_K, POW_log2_lo, POW_Tt
           nop.i 999
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_Z2                     = POW_twoV, POW_Q0_half, POW_U
-          nop.i 999
+(p7)      fma.s1 POW_G                  = POW_K, POW_log2_hi, POW_T
+          adds pow_AD_tbl2              = pow_tbl2 - pow_tbl1,  pow_AD_tbl1
 }
 ;;
 
-// p11 = TRUE ==> X is NEGATIVE 
-// p8  = TRUE ==> X is zero  AND Y is outside intger range (treat as even int)
-//                return +0
 { .mfi
           nop.m 999
-          fclass.m.unc  p11,p0              = f8, 0x1a
+          fms.s1 POW_e2                 = POW_NORM_Y, POW_r, POW_U
           nop.i 999
 }
-{ .mfb
+{ .mfi
           nop.m 999
-(p8)      fma.d f8                          = f0,f0,f0
-(p8)      br.ret.spnt b0
+          fma.s1 POW_Z2                 = POW_twoV, POW_Q0_half, POW_U
+          nop.i 999
 }
 ;;
 
-{ .mfi 
+{ .mfi
           nop.m 999
-          fma.s1 POW_Yrcub                 = POW_rsq, POW_U, f0
+          fma.s1 POW_Yrcub              = POW_rsq, POW_U, f0
           nop.i 999
 }
-{ .mfi 
+{ .mfi
           nop.m 999
-          fma.s1 POW_p                      = POW_rsq, POW_v3, POW_v2
+          fma.s1 POW_p                  = POW_rsq, POW_v3, POW_v2
           nop.i 999
 }
 ;;
 
-
-// p11 = TRUE ==> X is NEGATIVE
-//    p12 = TRUE ==> X is NEGATIVE  AND  Y  already int
+// p11 = TRUE ==> X is NEGATIVE but not inf
+//    p12 = TRUE ==> X is NEGATIVE  AND  Y  already even int
 //    p13 = TRUE ==> X is NEGATIVE  AND  Y possible int
 { .mfi
           nop.m 999
-          fma.s1 POW_Z1                     = POW_NORM_Y, POW_G, f0
-(p11)     cmp.ge.unc  p12,p13                = pow_GR_exp_Y, pow_GR_10033
+          fma.s1 POW_Z1                 = POW_NORM_Y, POW_G, f0
+(p11)     cmp.gt.unc  p12,p13           = pow_GR_exp_Y, pow_GR_10033
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_e3                     = POW_NORM_Y, POW_delta, f0
+          fma.s1 POW_Gpr                = POW_G, f1, POW_r
           nop.i 999
 }
 ;;
 
-// p9  = TRUE ==> X is zero  AND Y is within integer range (may not be integer)
-//    p6 = TRUE ==>  X is zero  AND  Y is an integer (may be even or odd)
-//    p7 = TRUE ==>  X is zero  AND  Y is NOT an integer, return +0
+// By adding RSHF (1.1000...*2^63) we put integer part in rightmost significand
 { .mfi
           nop.m 999
-(p9)      fcmp.eq.unc.s1 p6,p7             = POW_float_int_Y,  POW_NORM_Y
+          fma.s1 POW_W2  = POW_Z2, POW_inv_log2_by_128, POW_RSHF
           nop.i 999
 }
-{ .mfi 
+{ .mfi
           nop.m 999
-          fma.s1 POW_Gpr                    = POW_G, f1, POW_r
+          fms.s1 POW_UmZ2               = POW_U, f1, POW_Z2
           nop.i 999
 }
 ;;
 
-// By adding RSHF (1.1000...*2^63) we put integer part in rightmost significand
 { .mfi
           nop.m 999
-          fma.s1 POW_W2  = POW_Z2, POW_inv_log2_by_128, POW_RSHF
-          nop.i 999
-}
-{ .mfi
-          nop.m 999
-          fms.s1 POW_UmZ2                   = POW_U, f1, POW_Z2
+          fma.s1 POW_e3                 = POW_NORM_Y, POW_delta, f0
           nop.i 999
 }
 ;;
 
-
-// If x=0 and y>0, test y and flag denormal
-// p6  = TRUE ==>  X is zero  AND  Y is an integer (may be even or odd)
-//    p8 = TRUE ==>  X is zero  AND  Y is an odd  integer
-//    p9 = TRUE ==>  X is zero  AND  Y is an even integer
 { .mfi
           nop.m 999
-(p10)     fcmp.eq.s0 p15,p0 = f9,f0
-(p6)      tbit.nz.unc  p8,p9                = pow_GR_sig_int_Y,0
+          fma.s1 POW_Z3                 = POW_p, POW_Yrcub, f0
+          nop.i 999
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_Z3                      = POW_p, POW_Yrcub, f0
+          fma.s1 POW_GY_Z2              = POW_G, POW_NORM_Y, POW_Z2
           nop.i 999
 }
 ;;
@@ -1291,7 +1227,7 @@ L(POW_COMMON):
 // By adding RSHF (1.1000...*2^63) we put integer part in rightmost significand
 { .mfi
           nop.m 999
-          fms.s1 POW_e1                     = POW_NORM_Y, POW_G, POW_Z1
+          fms.s1 POW_e1                 = POW_NORM_Y, POW_G, POW_Z1
           nop.i 999
 }
 { .mfi
@@ -1301,81 +1237,60 @@ L(POW_COMMON):
 }
 ;;
 
+// p13 = TRUE ==> X is NEGATIVE  AND  Y possible int
+//     p10 = TRUE ==> X is NEG and Y is an int
+//     p12 = TRUE ==> X is NEG and Y is not an int
 { .mfi
           nop.m 999
-(p7)      fma.d f8  = f0,f0,f0  // Result +0 if x zero and y not integer
-          nop.i 999
+(p13)     fcmp.eq.unc.s1 p10,p12        = POW_float_int_Y,  POW_NORM_Y
+          mov pow_GR_xneg_yodd = 0
 }
-{ .mfb
+{ .mfi
           nop.m 999
-          fma.s1 POW_Y_Gpr                  = POW_NORM_Y, POW_Gpr, f0
-(p8)      br.ret.spnt b0        // Exit if x zero and y odd integer
+          fma.s1 POW_Y_Gpr              = POW_NORM_Y, POW_Gpr, f0
+          nop.i 999
 }
 ;;
 
 // By subtracting RSHF we get rounded integer POW_N2float
-// p15 = TRUE ==> X_0_Y_NEG
 { .mfi
           nop.m 999
           fms.s1 POW_N2float  = POW_W2, f1, POW_RSHF
           nop.i 999
 }
-{ .mfb
+{ .mfi
           nop.m 999
-          fma.s1 POW_UmZ2pV                 = POW_twoV,POW_Q0_half,POW_UmZ2
-(p15)     br.cond.spnt L(POW_X_0_Y_NEG)
+          fma.s1 POW_UmZ2pV             = POW_twoV,POW_Q0_half,POW_UmZ2
+          nop.i 999
 }
 ;;
 
-
-
 { .mfi
           nop.m 999
-          fma.s1 POW_Z3sq                   = POW_Z3, POW_Z3, f0
+          fma.s1 POW_Z3sq               = POW_Z3, POW_Z3, f0
           nop.i 999
 }
-{ .mfb
+{ .mfi
           nop.m 999
-          fma.s1 POW_v4                     = POW_Z3, POW_Q3, POW_Q2
-(p7)      br.ret.spnt b0     // Exit if x zero and y not an integer
+          fma.s1 POW_v4                 = POW_Z3, POW_Q3, POW_Q2
+          nop.i 999
 }
 ;;
 
-
-
 // Extract rounded integer from rightmost significand of POW_W2
 // By subtracting RSHF we get rounded integer POW_N1float
 { .mfi
-          getf.sig pow_GR_int_W2             = POW_W2
+          getf.sig pow_GR_int_W2        = POW_W2
           fms.s1 POW_N1float  = POW_W1, f1, POW_RSHF
           nop.i 999
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_v2                     = POW_Z3, POW_Q1, POW_Q0_half
+          fma.s1 POW_v2                 = POW_Z3, POW_Q1, POW_Q0_half
           nop.i 999
 }
 ;;
 
-
-
-
-// p13 = TRUE ==> X is NEGATIVE  AND  Y possible int
-//     p10 = TRUE ==> X is NEG and Y is an int
-//     p12 = TRUE ==> X is NEG and Y is not an int
-{ .mfi
-          nop.m 999
-(p13)     fcmp.eq.unc.s1 p10,p12             = POW_float_int_Y,  POW_NORM_Y
-          nop.i 999
-}
-{ .mfb
-          nop.m 999
-(p9)      fma.d f8  = f0,f0,f0   // Result +0 if x zero and y even integer
-(p9)      br.ret.spnt b0    // Exit if x zero and y even integer
-}
-;;
-
-
 { .mfi
           nop.m 999
           fnma.s1 POW_s2 = POW_N2float, POW_log2_by_128_hi, POW_Z2
@@ -1383,7 +1298,7 @@ L(POW_COMMON):
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_e2                     = POW_e2,f1,POW_UmZ2pV
+          fma.s1 POW_e2                 = POW_e2,f1,POW_UmZ2pV
           nop.i 999
 }
 ;;
@@ -1391,278 +1306,283 @@ L(POW_COMMON):
 // Extract rounded integer from rightmost significand of POW_W1
 // Test if x inf
 { .mfi
-          getf.sig pow_GR_int_W1             = POW_W1
-          fclass.m.unc p15,p0 = POW_NORM_X,  0x23
+          getf.sig pow_GR_int_W1        = POW_W1
+          fclass.m p15,p0 = POW_NORM_X,  0x23
           nop.i 999
 }
 { .mfb
           nop.m 999
           fnma.s1 POW_f2  = POW_N2float, POW_log2_by_128_lo, f1
-(p12)     br.cond.spnt L(POW_X_NEG_Y_NONINT)  // Branch if x neg, y not integer
+(p12)     br.cond.spnt POW_X_NEG_Y_NONINT  // Branch if x neg, y not integer
 }
 ;;
 
+// p11 = TRUE ==> X is +1.0
 // p12 = TRUE ==> X is NEGATIVE  AND Y is an odd integer
 { .mfi
-          getf.exp pow_GR_signexp_Y_Gpr       = POW_Y_Gpr
-          fma.s1 POW_v3                     = POW_Z3sq, POW_Q4, POW_v4
-(p10)     tbit.nz.unc  p12,p0                = pow_GR_sig_int_Y,0
+          getf.exp pow_GR_signexp_Y_Gpr = POW_Y_Gpr
+          fcmp.eq.s1 p11,p0 = POW_NORM_X, f1
+(p10)     tbit.nz.unc  p12,p0           = pow_GR_sig_int_Y,0
+}
+{ .mfi
+          nop.m 999
+          fma.s1 POW_v3                 = POW_Z3sq, POW_Q4, POW_v4
+          nop.i 999
 }
 ;;
 
-
 { .mfi
-          add pow_GR_int_N                   = pow_GR_int_W1, pow_GR_int_W2
+          nop.m 999
           fnma.s1 POW_f1  = POW_N1float, POW_log2_by_128_lo, f1
           nop.i 999
 }
 { .mfb
           nop.m 999
           fnma.s1 POW_s1  = POW_N1float, POW_log2_by_128_hi, POW_Z1
-(p15)     br.cond.spnt L(POW_X_INF)
+(p15)     br.cond.spnt POW_X_INF
 }
 ;;
 
-
 // Test x and y and flag denormal
 { .mfi
-          and pow_GR_index1                  = 0x0f, pow_GR_int_N
+          nop.m 999
           fcmp.eq.s0 p15,p0 = f8,f9
-          shr r2                             = pow_GR_int_N, 7
+          nop.i 999
 }
 { .mfi
-          and pow_GR_exp_Y_Gpr               = pow_GR_signexp_Y_Gpr, pow_GR_17ones
-          nop.f 999
-          and pow_GR_index2                  = 0x70, pow_GR_int_N
+          nop.m 999
+          fma.s1 POW_pYrcub_e3          = POW_p, POW_Yrcub, POW_e3
+          nop.i 999
 }
 ;;
 
-
-
 { .mfi
-          shladd pow_AD_T1                   = pow_GR_index1, 4, pow_AD_tbl1
+          nop.m 999
           fcmp.eq.s1 p7,p0 = POW_NORM_Y, f1  // Test for y=1.0
-          sub pow_GR_true_exp_Y_Gpr          = pow_GR_exp_Y_Gpr, pow_GR_16ones
+          nop.i 999
 }
 { .mfi
-          addl pow_int_GR_M                  = 0xFFFF, r2
-          fma.s1  POW_e12                     = POW_e1,f1,POW_e2
-          add pow_AD_T2                      = pow_AD_tbl2, pow_GR_index2
+          nop.m 999
+          fma.s1  POW_e12               = POW_e1,f1,POW_e2
+          nop.i 999
 }
 ;;
 
-
-{ .mmi
-          ldfe POW_T1                        = [pow_AD_T1],16
-          setf.exp POW_2M                    = pow_int_GR_M
-          andcm pow_GR_sign_Y_Gpr            = pow_GR_signexp_Y_Gpr, pow_GR_17ones
+{ .mfi
+          add pow_GR_int_N              = pow_GR_int_W1, pow_GR_int_W2
+(p11)     fma.d.s0 f8 = f1,f1,f0    // If x=1, result is +1
+          nop.i 999
+}
+{ .mib
+(p12)     mov pow_GR_xneg_yodd = 1
+          nop.i 999
+(p11)     br.ret.spnt b0            // Early exit if x=1.0, result is +1
 }
 ;;
 
-
-{ .mfb
-          ldfe POW_T2                        = [pow_AD_T2],16
-          fma.s1 POW_q                       = POW_Z3sq, POW_v3, POW_v2
+{ .mfi
+          and pow_GR_index1             = 0x0f, pow_GR_int_N
+          fma.s1 POW_q                  = POW_Z3sq, POW_v3, POW_v2
+          shr pow_int_GR_M              = pow_GR_int_N, 7    // M = N/128
+}
+{ .mib
+          and pow_GR_index2             = 0x70, pow_GR_int_N
+          cmp.eq p6, p0                 = pow_GR_xneg_yodd, r0
 (p7)      br.ret.spnt b0        // Early exit if y=1.0, result is x
 }
 ;;
 
-
-// double: p8 TRUE ==> |Y(G + r)| >= 10
-// single: p8 TRUE ==> |Y(G + r)| >= 7
-
-// double
-//     -2^10  -2^9             2^9   2^10
-// -----+-----+----+ ... +-----+-----+-----
-//  p8  |             p9             |  p8
-//      |     |       p10      |     |  
-// single
-//     -2^7   -2^6             2^6   2^7
-// -----+-----+----+ ... +-----+-----+-----
-//  p8  |             p9             |  p8
-//      |     |       p10      |     |
-
-
 { .mfi
-(p0)      cmp.le.unc p8,p9                   = 10, pow_GR_true_exp_Y_Gpr
-          fma.s1 POW_s                       = POW_s1, f1, POW_s2
-          nop.i 999
+          shladd pow_AD_T1              = pow_GR_index1, 4, pow_AD_tbl1
+          fma.s1 POW_s                  = POW_s1, f1, POW_s2
+          add pow_int_GR_M              = pow_GR_16ones, pow_int_GR_M
 }
 { .mfi
-          nop.m 999
-          fma.s1 POW_f12                     = POW_f1, POW_f2,f0
-          nop.i 999
+          add pow_AD_T2                 = pow_AD_tbl2, pow_GR_index2
+          fma.s1 POW_f12                = POW_f1, POW_f2,f0
+          and pow_GR_exp_Y_Gpr          = pow_GR_signexp_Y_Gpr, pow_GR_17ones
 }
 ;;
 
-
-{ .mfi
-          nop.f 999
-(p9)      cmp.le.unc p0,p10                  = 9, pow_GR_true_exp_Y_Gpr
+{ .mmi
+          ldfe POW_T1                   = [pow_AD_T1]
+          ldfe POW_T2                   = [pow_AD_T2]
+          sub pow_GR_true_exp_Y_Gpr     = pow_GR_exp_Y_Gpr, pow_GR_16ones
 }
 ;;
 
-
-
+{ .mfi
+          setf.exp POW_2M               = pow_int_GR_M
+          fma.s1 POW_e123               = POW_e12, f1, POW_e3
+          nop.i 999
+}
 { .mfb
-          nop.m 999
-          fma.s1 POW_e123                    = POW_e12, f1, POW_e3
-(p8)      br.cond.spnt L(POW_OVER_UNDER_X_NOT_INF)
+(p6)      cmp.gt p6, p0                 = -11, pow_GR_true_exp_Y_Gpr
+          fma.s1 POW_d                  = POW_GY_Z2, f1, POW_pYrcub_e3
+(p6)      br.cond.spnt POW_NEAR_ONE // branch if |y*log(x)| < 2^(-11)
 }
 ;;
 
-
-{ .mmf
-          fma.s1 POW_q                       = POW_Z3sq, POW_q, POW_Z3
+{ .mfi
+          nop.m 999
+          fma.s1 POW_q                  = POW_Z3sq, POW_q, POW_Z3
+          nop.i 999
 }
 ;;
 
+// p8 TRUE ==> |Y(G + r)| >= 10
 
+// double
+//     -2^10  -2^9             2^9   2^10
+// -----+-----+----+ ... +-----+-----+-----
+//  p8  |             p9             |  p8
+//      |     |       p10      |     |
+
+// Form signexp of constants to indicate overflow
 { .mfi
-          nop.m 999 
-          fma.s1 POW_ssq                     = POW_s, POW_s, f0
-          nop.i 999
+          mov         pow_GR_big_pos    = 0x103ff
+          fma.s1 POW_ssq                = POW_s, POW_s, f0
+          cmp.le p8,p9                  = 10, pow_GR_true_exp_Y_Gpr
 }
 { .mfi
-          nop.m 999 
-          fma.s1 POW_v4                      = POW_s, POW_Q3, POW_Q2
-          nop.i 999
+          mov         pow_GR_big_neg    = 0x303ff
+          fma.s1 POW_v4                 = POW_s, POW_Q3, POW_Q2
+          andcm pow_GR_sign_Y_Gpr       = pow_GR_signexp_Y_Gpr, pow_GR_17ones
 }
 ;;
 
+// Form big positive and negative constants to test for possible overflow
 { .mfi
-          nop.m 999
-          fma.s1 POW_v2                      = POW_s, POW_Q1, POW_Q0_half
-          nop.i 999
+          setf.exp POW_big_pos          = pow_GR_big_pos
+          fma.s1 POW_v2                 = POW_s, POW_Q1, POW_Q0_half
+(p9)      cmp.le.unc p0,p10             = 9, pow_GR_true_exp_Y_Gpr
 }
-{ .mfi
-          nop.m 999
-          fma.s1 POW_1ps                     = f1,f1,POW_s
-          nop.i 999
+{ .mfb
+          setf.exp POW_big_neg          = pow_GR_big_neg
+          fma.s1 POW_1ps                = f1,f1,POW_s
+(p8)      br.cond.spnt POW_OVER_UNDER_X_NOT_INF
 }
 ;;
 
+// f123 = f12*(e123+1) = f12*e123+f12
 { .mfi
           nop.m 999
-          fma.s1 POW_f3                      = POW_e123,f1,f1
+          fma.s1 POW_f123               = POW_e123,POW_f12,POW_f12
           nop.i 999
 }
 ;;
 
 { .mfi
           nop.m 999
-          fma.s1 POW_T1T2                    = POW_T1, POW_T2, f0
+          fma.s1 POW_T1T2               = POW_T1, POW_T2, f0
           nop.i 999
 }
-;;
-
 { .mfi
           nop.m 999
-          fma.s1 POW_v3                     = POW_ssq, POW_Q4, POW_v4
-          nop.i 999
+          fma.s1 POW_v3                 = POW_ssq, POW_Q4, POW_v4
+          cmp.ne p12,p13 = pow_GR_xneg_yodd, r0
 }
 ;;
 
 { .mfi
           nop.m 999
-          fma.s1 POW_v21ps                  = POW_ssq, POW_v2, POW_1ps
+          fma.s1 POW_v21ps              = POW_ssq, POW_v2, POW_1ps
           nop.i 999
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_s4                     = POW_ssq, POW_ssq, f0
+          fma.s1 POW_s4                 = POW_ssq, POW_ssq, f0
           nop.i 999
 }
 ;;
 
 { .mfi
           nop.m 999
-          fma.s1 POW_f123                    = POW_f12, POW_f3, f0
+(p12)     fnma.s1 POW_A                 =  POW_2M, POW_f123, f0
           nop.i 999
 }
+{ .mfi
+          nop.m 999
+(p13)     fma.s1 POW_A                  =  POW_2M, POW_f123, f0
+          cmp.eq p14,p11 = r0,r0   // Initialize p14 on, p11 off
+}
 ;;
 
 { .mfi
           nop.m 999
-          fma.s1 POW_A                      =  POW_2M, POW_T1T2, f0
+          fmerge.s POW_abs_q = f0, POW_q // Form |q| so can test its size
           nop.i 999
 }
 ;;
 
-
-
 { .mfi
-          nop.m 999
-(p12)     fmerge.s POW_f123 = f8,POW_f123  // if x neg, y odd int
+(p10)     cmp.eq p0,p14 = r0,r0    // Turn off p14 if no overflow
+          fma.s1 POW_es                 = POW_s4,  POW_v3, POW_v21ps
           nop.i 999
 }
 { .mfi
           nop.m 999
-//          fma.s1 POW_es                     = POW_ssq,  POW_v3, POW_v2
+          fma.s1 POW_A                  = POW_A, POW_T1T2, f0
           nop.i 999
 }
 ;;
 
 { .mfi
+// Test for |q| < 2^-63.  If so then reverse last two steps of the result
+// to avoid monotonicity problems for results near 1.0 in round up/down/zero.
+// p11 will be set if need to reverse the order, p14 if not.
           nop.m 999
-          fma.s1 POW_es                     = POW_s4,  POW_v3, POW_v21ps
+(p10)     fcmp.lt.s0 p11,p14 = POW_abs_q, POW_2toM63 // Test |q| <2^-63
           nop.i 999
 }
 ;;
 
-
+.pred.rel "mutex",p11,p14
 { .mfi
           nop.m 999
-          fma.s1 POW_A                      = POW_A, POW_f123, f0
+(p14)     fma.s1 POW_A                  = POW_A, POW_es, f0
           nop.i 999
 }
 { .mfi
           nop.m 999
-//          fma.s1 POW_es                     = POW_es, POW_ssq, POW_1ps
+(p11)     fma.s1 POW_A                  = POW_A, POW_q, POW_A
           nop.i 999
 }
 ;;
 
-
+// Dummy op to set inexact if |q| < 2^-63
 { .mfi
           nop.m 999
-          fma.s1 POW_A                      = POW_A, POW_es,f0
+(p11)     fma.d.s0 POW_tmp              = POW_A, POW_q, POW_A
           nop.i 999
 }
 ;;
 
-
-
+{ .mfi
+          nop.m 999
+(p14)     fma.d.s0 f8                   = POW_A, POW_q, POW_A
+          nop.i 999
+}
 { .mfb
           nop.m 999
-(p10)     fma.d f8                          = POW_A, POW_q, POW_A
-(p10)     br.ret.sptk     b0
+(p11)     fma.d.s0 f8                   = POW_A, POW_es, f0
+(p10)     br.ret.sptk     b0            // Exit main branch if no over/underflow
 }
 ;;
 
-
-
-
-
 // POSSIBLE_OVER_UNDER
-// p6 = TRUE ==> Y negative
+// p6 = TRUE ==> Y_Gpr negative
+// Result is already computed.  We just need to know if over/underflow occurred.
 
-{ .mfi
-        nop.m 999
-        fmerge.s POW_abs_A                = f0, POW_A
-        cmp.eq.unc p0,p6                  = pow_GR_sign_Y, r0
-}
-;;
-
-{ .mib
-        nop.m 999
-        nop.i 999
-(p6)    br.cond.spnt L(POW_POSSIBLE_UNDER) 
+{ .mfb
+        cmp.eq p0,p6                    = pow_GR_sign_Y_Gpr, r0
+        nop.f 999
+(p6)    br.cond.spnt POW_POSSIBLE_UNDER
 }
 ;;
 
 // POSSIBLE_OVER
-// We got an answer. 
+// We got an answer.
 // overflow is a possibility, not a certainty
 
 
@@ -1692,21 +1612,20 @@ L(POW_COMMON):
 //                  RN         RN
 //                             RZ
 
-
 // Put in s2 (td set, wre set)
 { .mfi
-        mov           pow_GR_gt_ln                 = 0x103ff 
+        nop.m 999
         fsetc.s2 0x7F,0x42
-        nop.i 999 
+        nop.i 999
 }
 ;;
 
-
 { .mfi
-        setf.exp POW_gt_pln                        = pow_GR_gt_ln
-        fma.d.s2 POW_wre_urm_f8                    = POW_abs_A, POW_q, POW_abs_A
-        nop.i 999 ;;
+        nop.m 999
+        fma.d.s2 POW_wre_urm_f8         = POW_A, POW_q, POW_A
+        nop.i 999
 }
+;;
 
 // Return s2 to default
 { .mfi
@@ -1716,31 +1635,67 @@ L(POW_COMMON):
 }
 ;;
 
-
 // p7 = TRUE ==> yes, we have an overflow
 { .mfi
         nop.m 999
-        fcmp.ge.unc.s1 p7, p0                    =  POW_wre_urm_f8, POW_gt_pln
+        fcmp.ge.s1 p7, p8               =  POW_wre_urm_f8, POW_big_pos
         nop.i 999
 }
 ;;
 
+{ .mfi
+        nop.m 999
+(p8)    fcmp.le.s1 p7, p0               =  POW_wre_urm_f8, POW_big_neg
+        nop.i 999
+}
+;;
 
+{ .mbb
+(p7)   mov pow_GR_tag                   = 24
+(p7)   br.cond.spnt __libm_error_region // Branch if overflow
+       br.ret.sptk     b0               // Exit if did not overflow
+}
+;;
 
-{ .mfb
-(p7)   mov pow_GR_tag                            = 24
-       fma.d f8                                  = POW_A, POW_q, POW_A
-(p7)   br.cond.spnt __libm_error_region 
+// Here if |y*log(x)| < 2^(-11)
+// pow(x,y) ~ exp(d) ~ 1 + d + 0.5*d^2 + Q1*d^3 + Q2*d^4, where d = y*log(x)
+.align 32
+POW_NEAR_ONE:
+
+{ .mfi
+          nop.m 999
+          fma.s1 POW_d2                 = POW_d, POW_d, f0
+          nop.i 999
 }
-{ .mfb
-       nop.m 999
-       nop.f 999
-(p0)   br.ret.sptk     b0 
+;;
+
+{ .mfi
+          nop.m 999
+          fma.s1 POW_poly_d_hi          = POW_d, POW_Q0_half, f1
+          nop.i 999
+}
+{ .mfi
+          nop.m 999
+          fma.s1 POW_poly_d_lo          = POW_d, POW_Q2, POW_Q1
+          nop.i 999
 }
 ;;
 
+{ .mfi
+          nop.m 999
+          fma.s1 POW_poly_d             = POW_d2, POW_poly_d_lo, POW_poly_d_hi
+          nop.i 999
+}
+;;
+
+{ .mfb
+          nop.m 999
+          fma.d.s0 f8                   = POW_d, POW_poly_d, f1
+          br.ret.sptk b0 // exit function for arguments |y*log(x)| < 2^(-11)
+}
+;;
 
-L(POW_POSSIBLE_UNDER):
+POW_POSSIBLE_UNDER:
 // We got an answer. input was < -2^9 but > -2^10 (double)
 // We got an answer. input was < -2^6 but > -2^7  (float)
 // underflow is a possibility, not a certainty
@@ -1763,124 +1718,250 @@ L(POW_POSSIBLE_UNDER):
 //   0.1...11 2^-3ffe                                   (biased, 1)
 //    largest dn                               smallest normal
 
-
 // Put in s2 (td set, ftz set)
 { .mfi
         nop.m 999
         fsetc.s2 0x7F,0x41
-        nop.i 999 
+        nop.i 999
 }
 ;;
 
-
-
 { .mfi
         nop.m 999
-        fma.d.s2 POW_ftz_urm_f8                    = POW_A, POW_q, POW_A
+        fma.d.s2 POW_ftz_urm_f8         = POW_A, POW_q, POW_A
         nop.i 999
 }
 ;;
 
-
 // Return s2 to default
 { .mfi
         nop.m 999
         fsetc.s2 0x7F,0x40
-        nop.i 999 
+        nop.i 999
 }
 ;;
 
-
 // p7 = TRUE ==> yes, we have an underflow
 { .mfi
         nop.m 999
-        fcmp.eq.unc.s1 p7, p0                     =  POW_ftz_urm_f8, f0
-        nop.i 999 
+        fcmp.eq.s1 p7, p0               =  POW_ftz_urm_f8, f0
+        nop.i 999
 }
 ;;
 
+{ .mbb
+(p7)    mov pow_GR_tag                  = 25
+(p7)    br.cond.spnt __libm_error_region // Branch if underflow
+        br.ret.sptk     b0               // Exit if did not underflow
+}
+;;
+
+POW_X_DENORM:
+// Here if x unorm. Use the NORM_X for getf instructions, and then back
+// to normal path
+{ .mfi
+        getf.exp      pow_GR_signexp_X  = POW_NORM_X
+        nop.f 999
+        nop.i 999
+}
+;;
 
+{ .mmi
+        getf.sig      pow_GR_sig_X      = POW_NORM_X
+;;
+        and           pow_GR_exp_X      = pow_GR_signexp_X, pow_GR_17ones
+        nop.i 999
+}
+;;
+
+{ .mib
+        sub       pow_GR_true_exp_X     = pow_GR_exp_X, pow_GR_16ones
+        nop.i 999
+        br.cond.sptk    POW_COMMON
+}
+;;
 
+POW_X_0:
+// Here if x=0 and y not nan
+//
+// We have the following cases:
+//  p6  x=0  and  y>0 and is an integer (may be even or odd)
+//  p7  x=0  and  y>0 and is NOT an integer, return +0
+//  p8  x=0  and  y>0 and so big as to always be an even integer, return +0
+//  p9  x=0  and  y>0 and may not be integer
+//  p10 x=0  and  y>0 and is an odd  integer, return x
+//  p11 x=0  and  y>0 and is an even integer, return +0
+//  p12 used in dummy fcmp to set denormal flag if y=unorm
+//  p13 x=0  and  y>0
+//  p14 x=0  and  y=0, branch to code for calling error handling
+//  p15 x=0  and  y<0, branch to code for calling error handling
+//
+{ .mfi
+        getf.sig pow_GR_sig_int_Y = POW_int_Y // Get signif of int_Y
+        fcmp.lt.s1 p15,p13 = f9, f0           // Test for y<0
+        and pow_GR_exp_Y = pow_GR_signexp_Y, pow_GR_17ones
+}
+{ .mfb
+        cmp.ne p14,p0 = pow_GR_y_zero,r0      // Test for y=0
+        fcvt.xf   POW_float_int_Y = POW_int_Y
+(p14)   br.cond.spnt POW_X_0_Y_0              // Branch if x=0 and y=0
+}
+;;
 
+// If x=0 and y>0, test y and flag denormal
 { .mfb
-(p7)    mov pow_GR_tag                           = 25
-        fma.d f8                                 = POW_A, POW_q, POW_A
-(p7)    br.cond.spnt __libm_error_region 
+(p13)   cmp.gt.unc p8,p9 = pow_GR_exp_Y, pow_GR_10033 // Test y +big = even int
+(p13)   fcmp.eq.s0 p12,p0 = f9,f0    // If x=0, y>0 dummy op to flag denormal
+(p15)   br.cond.spnt POW_X_0_Y_NEG // Branch if x=0 and y<0
 }
 ;;
 
+// Here if x=0 and y>0
+{ .mfi
+        nop.m 999
+(p9)    fcmp.eq.unc.s1 p6,p7 = POW_float_int_Y,  POW_NORM_Y // Test y=int
+        nop.i 999
+}
+{ .mfi
+        nop.m 999
+(p8)    fma.d.s0 f8 = f0,f0,f0 // If x=0, y>0 and large even int, return +0
+        nop.i 999
+}
+;;
 
+{ .mfi
+        nop.m 999
+(p7)    fma.d.s0 f8  = f0,f0,f0   // Result +0 if x=0 and y>0 and not integer
+(p6)    tbit.nz.unc p10,p11 = pow_GR_sig_int_Y,0 // If y>0 int, test y even/odd
+}
+;;
+
+// Note if x=0, y>0 and odd integer, just return x
 { .mfb
         nop.m 999
-        nop.f 999
-        br.ret.sptk     b0 
+(p11)   fma.d.s0 f8  = f0,f0,f0   // Result +0 if x=0 and y even integer
+        br.ret.sptk b0            // Exit if x=0 and y>0
 }
 ;;
 
+POW_X_0_Y_0:
+// When X is +-0 and Y is +-0, IEEE returns 1.0
+// We call error support with this value
 
-L(POW_X_DENORM):
-// Here if x unorm. Use the NORM_X for getf instructions, and the back
-// to normal path
-{ .mfi
-        getf.exp      pow_GR_signexp_X    = POW_NORM_X
-        nop.f 999
-        nop.i 999
+{ .mfb
+        mov pow_GR_tag                  = 26
+        fma.d.s0 f8                     = f1,f1,f0
+        br.cond.sptk __libm_error_region
 }
 ;;
 
+POW_X_0_Y_NEG:
+// When X is +-0 and Y is negative, IEEE returns
+// X     Y           answer
+// +0    -odd int    +inf
+// -0    -odd int    -inf
+
+// +0    !-odd int   +inf
+// -0    !-odd int   +inf
+
+// p6 == Y is a floating point number outside the integer.
+//       Hence it is an integer and is even.
+//       return +inf
+
+// p7 == Y is a floating point number within the integer range.
+//      p9  == (int_Y = NORM_Y), Y is an integer, which may be odd or even.
+//           p11 odd
+//              return (sign_of_x)inf
+//           p12 even
+//              return +inf
+//      p10 == Y is not an integer
+//         return +inf
+//
+
 { .mfi
-        getf.sig      pow_GR_sig_X        = POW_NORM_X
-        nop.f 999
-        nop.i 999
+          nop.m 999
+          nop.f 999
+          cmp.gt  p6,p7                 = pow_GR_exp_Y, pow_GR_10033
 }
 ;;
 
 { .mfi
-        and           pow_GR_exp_X        = pow_GR_signexp_X, pow_GR_17ones
-        nop.f 999
+          mov pow_GR_tag                = 27
+(p7)      fcmp.eq.unc.s1 p9,p10         = POW_float_int_Y,  POW_NORM_Y
+          nop.i 999
 }
 ;;
 
-{ .mib
-        sub       pow_GR_true_exp_X       = pow_GR_exp_X, pow_GR_16ones
-        shl           pow_GR_offset       = pow_GR_sig_X, 1
-        br.cond.sptk    L(POW_COMMON)
+{ .mfb
+          nop.m 999
+(p6)      frcpa.s0 f8,p13               = f1, f0
+(p6)      br.cond.sptk __libm_error_region   // x=0, y<0, y large neg int
+}
+;;
+
+{ .mfb
+          nop.m 999
+(p10)     frcpa.s0 f8,p13               = f1, f0
+(p10)     br.cond.sptk __libm_error_region   // x=0, y<0, y not int
 }
 ;;
 
+// x=0, y<0, y an int
+{ .mib
+          nop.m 999
+(p9)      tbit.nz.unc p11,p12           = pow_GR_sig_int_Y,0
+          nop.b 999
+}
+;;
 
-L(POW_X_0_Y_0):
-// When X is +-0 and Y is +-0, IEEE returns 1.0 
-// We call error support with this value 
+{ .mfi
+          nop.m 999
+(p12)     frcpa.s0 f8,p13               = f1,f0
+          nop.i 999
+}
+;;
 
 { .mfb
-         mov pow_GR_tag                     = 26
-         fma.d f8                           = f1,f1,f0
-         br.cond.sptk __libm_error_region
+          nop.m 999
+(p11)     frcpa.s0 f8,p13               = f1,f8
+          br.cond.sptk __libm_error_region
 }
 ;;
 
 
+POW_Y_0:
+// Here for y zero, x anything but zero and nan
+// Set flag if x denormal
+// Result is +1.0
+{ .mfi
+        nop.m 999
+        fcmp.eq.s0 p6,p0 = f8,f0    // Sets flag if x denormal
+        nop.i 999
+}
+{ .mfb
+        nop.m 999
+        fma.d.s0 f8 = f1,f1,f0
+        br.ret.sptk b0
+}
+;;
 
 
-L(POW_X_INF):
-// When X is +-inf and Y is +-, IEEE returns 
+POW_X_INF:
+// Here when X is +-inf
 
-// overflow                       
-// X +inf  Y +inf             +inf  
-// X -inf  Y +inf             +inf 
+// X +inf  Y +inf             +inf
+// X -inf  Y +inf             +inf
 
-// X +inf  Y >0               +inf    
+// X +inf  Y >0               +inf
 // X -inf  Y >0, !odd integer +inf     <== (-inf)^0.5 = +inf !!
-// X -inf  Y >0,  odd integer  -inf   
+// X -inf  Y >0,  odd integer -inf
 
-// underflow                     
-// X +inf  Y -inf             +0   
-// X -inf  Y -inf             +0  
+// X +inf  Y -inf             +0
+// X -inf  Y -inf             +0
 
-// X +inf  Y <0               +0      
-// X -inf  Y <0, !odd integer +0     
-// X -inf  Y <0, odd integer  -0    
+// X +inf  Y <0               +0
+// X -inf  Y <0, !odd integer +0
+// X -inf  Y <0, odd integer  -0
 
 // X + inf Y=+0                +1
 // X + inf Y=-0                +1
@@ -1892,32 +1973,30 @@ L(POW_X_INF):
 
 // p6 == Y is a floating point number outside the integer.
 //       Hence it is an integer and is even.
-//       p13 == (Y negative) 
+//       p13 == (Y negative)
 //          return +inf
 //       p14 == (Y positive)
 //          return +0
 
-
-
 // p7 == Y is a floating point number within the integer range.
 //      p9  == (int_Y = NORM_Y), Y is an integer, which may be odd or even.
 //           p11 odd
-//              p13 == (Y negative)    
+//              p13 == (Y negative)
 //                 return (sign_of_x)inf
-//              p14 == (Y positive) 
+//              p14 == (Y positive)
 //                 return (sign_of_x)0
-//           pxx even                
-//              p13 == (Y negative) 
-//                 return +inf     
+//           pxx even
+//              p13 == (Y negative)
+//                 return +inf
 //              p14 == (Y positive)
-//                 return +0     
+//                 return +0
 
 //      pxx == Y is not an integer
-//           p13 == (Y negative) 
+//           p13 == (Y negative)
 //                 return +inf
 //           p14 == (Y positive)
 //                 return +0
-// 
+//
 
 // If x=inf, test y and flag denormal
 { .mfi
@@ -1929,207 +2008,131 @@ L(POW_X_INF):
 
 { .mfi
           nop.m 999
-          fcmp.lt p13,p14                    = POW_NORM_Y,f0 
-          cmp.gt.unc  p6,p7                  = pow_GR_exp_Y, pow_GR_10033
+          fcmp.lt.s0 p13,p14            = POW_NORM_Y,f0
+          cmp.gt  p6,p7                 = pow_GR_exp_Y, pow_GR_10033
 }
 { .mfi
           nop.m 999
-          fclass.m p12,p0                    = f9, 0x23
+          fclass.m p12,p0               = f9, 0x23 //@inf
           nop.i 999
 }
 ;;
 
-
 { .mfi
           nop.m 999
-          fclass.m p15,p0                    = f9, 0x07	//@zero
+          fclass.m p15,p0               = f9, 0x07 //@zero
           nop.i 999
 }
 ;;
 
 { .mfb
           nop.m 999
-(p15)     fmerge.s f8 = f1,f1
-(p15)     br.ret.spnt b0
+(p15)     fmerge.s f8 = f1,f1      // Return +1.0 if x=inf, y=0
+(p15)     br.ret.spnt b0           // Exit if x=inf, y=0
 }
 ;;
 
-        
 { .mfi
-(p13)     mov pow_GR_tag                     = 25
-(p14)     frcpa.s1 f8,p10                       = f1,f0
+          nop.m 999
+(p14)     frcpa.s1 f8,p10 = f1,f0  // If x=inf, y>0, assume result +inf
           nop.i 999
 }
 { .mfb
-(p14)     mov pow_GR_tag                     = 24
-(p13)     fma.s1 f8                          = f0,f0,f0
-(p12)     br.ret.spnt b0
-}
-;;
-
-   
-
-{ .mfb
           nop.m 999
-(p7)      fcmp.eq.unc.s1 p9,p0              = POW_float_int_Y,  POW_NORM_Y
-          nop.b 999
+(p13)     fma.d.s0 f8 = f0,f0,f0   // If x=inf, y<0, assume result +0.0
+(p12)     br.ret.spnt b0           // Exit if x=inf, y=inf
 }
 ;;
 
+// Here if x=inf, and 0 < |y| < inf.  Need to correct results if y odd integer.
 { .mfi
           nop.m 999
-          nop.f 999
-(p9)      tbit.nz.unc p11,p0                 = pow_GR_sig_int_Y,0
-}
-;;
-
-{ .mfb
-          nop.m 999
-(p11)     fmerge.s f8 = POW_NORM_X,f8
-          br.ret.sptk b0 
+(p7)      fcmp.eq.unc.s1 p9,p0 = POW_float_int_Y,  POW_NORM_Y // Is y integer?
+          nop.i 999
 }
 ;;
 
-
-
-L(POW_X_0_Y_NEG):
-// When X is +-0 and Y is negative, IEEE returns 
-// X     Y           answer
-// +0    -odd int    +inf
-// -0    -odd int    -inf
-
-// +0    !-odd int   +inf
-// -0    !-odd int   +inf
-
-
-// p6 == Y is a floating point number outside the integer.
-//       Hence it is an integer and is even.
-//       return +inf
-
-// p7 == Y is a floating point number within the integer range.
-//      p9  == (int_Y = NORM_Y), Y is an integer, which may be odd or even.
-//           p11 odd
-//              return (sign_of_x)inf
-//           p12 even
-//              return +inf
-//      p10 == Y is not an integer
-//         return +inf
-// 
-// 
-
 { .mfi
           nop.m 999
           nop.f 999
-          cmp.gt.unc  p6,p7                  = pow_GR_exp_Y, pow_GR_10033
+(p9)      tbit.nz.unc p11,p0 = pow_GR_sig_int_Y,0  // Test for y odd integer
 }
 ;;
 
-
-{ .mfi
-          mov pow_GR_tag                     = 27
-(p7)      fcmp.eq.unc.s1 p9,p10              = POW_float_int_Y,  POW_NORM_Y
-          nop.i 999
-}
-;;
-
-
 { .mfb
           nop.m 999
-(p6)      frcpa.s0 f8,p13                       = f1, f0
-(p6)      br.cond.sptk __libm_error_region
-}
-;;
-
-{ .mfb
-          nop.m 999
-(p10)     frcpa.s0 f8,p13                       = f1, f0
-(p10)     br.cond.sptk __libm_error_region
+(p11)     fmerge.s f8 = POW_NORM_X,f8    // If y odd integer use sign of x
+          br.ret.sptk b0                 // Exit for x=inf, 0 < |y| < inf
 }
 ;;
 
 
+POW_X_NEG_Y_NONINT:
+// When X is negative and Y is a non-integer, IEEE
+// returns a qnan indefinite.
+// We call error support with this value
 
-{ .mib
-          nop.m 999
-(p9)      tbit.nz.unc p11,p12                = pow_GR_sig_int_Y,0
-          nop.b 999
+{ .mfb
+         mov pow_GR_tag                 = 28
+         frcpa.s0 f8,p6                 = f0,f0
+         br.cond.sptk __libm_error_region
 }
 ;;
 
-
-
+POW_X_NAN:
+// Here if x=nan, y not nan
 { .mfi
-          nop.m 999
-(p12)     frcpa.s0 f8,p13                      = f1,f0
-          nop.i 999
-}
-;;
-
-{ .mfb
-          nop.m 999
-(p11)     frcpa f8,p13                      = f1,f8 
-          br.cond.sptk __libm_error_region
+         nop.m 999
+         fclass.m  p9,p13 = f9, 0x07 // Test y=zero
+         nop.i 999
 }
 ;;
 
-
-
-
-L(POW_X_NEG_Y_NONINT):
-// When X is negative and Y is a non-integer, IEEE
-// returns a qnan indefinite.
-// We call error support with this value 
-
 { .mfb
-         mov pow_GR_tag                     = 28
-         frcpa f8,p6                        = f0,f0
-         br.cond.sptk __libm_error_region
+         nop.m 999
+(p13)    fma.d.s0 f8 = f8,f1,f0
+(p13)    br.ret.sptk  b0            // Exit if x nan, y anything but zero or nan
 }
 ;;
 
-
-
-
-L(POW_X_NAN_Y_0):
+POW_X_NAN_Y_0:
 // When X is a NAN and Y is zero, IEEE returns 1.
 // We call error support with this value.
-
 { .mfi
-         nop.m 0
-         fma.d.s0 f10 = f8,f1,f0 
-         nop.i 0
+         nop.m 999
+         fcmp.eq.s0 p6,p0 = f8,f0       // Dummy op to set invalid on snan
+         nop.i 999
 }
 { .mfb
-         mov pow_GR_tag                     = 29
-         fma.d.s0 f8 = f0,f0,f1 
+         mov pow_GR_tag                 = 29
+         fma.d.s0 f8 = f0,f0,f1
          br.cond.sptk __libm_error_region
 }
 ;;
 
 
-L(POW_OVER_UNDER_X_NOT_INF):
+POW_OVER_UNDER_X_NOT_INF:
 
 // p8 is TRUE for overflow
 // p9 is TRUE for underflow
 
 // if y is infinity, we should not over/underflow
 
-
 { .mfi
           nop.m 999
-          fcmp.eq.unc.s1     p14, p13        = POW_xsq,f1
-          cmp.eq.unc p8,p9                   = pow_GR_sign_Y_Gpr, r0
+          fcmp.eq.s1     p14, p13       = POW_xsq,f1  // Test |x|=1
+          cmp.eq p8,p9                  = pow_GR_sign_Y_Gpr, r0
 }
 ;;
 
 { .mfi
           nop.m 999
-(p14)     fclass.m.unc       p15, p0         = f9, 0x23
+(p14)     fclass.m.unc       p15, p0    = f9, 0x23 // If |x|=1, test y=inf
           nop.i 999
 }
 { .mfi
           nop.m 999
-(p13)     fclass.m.unc       p11,p0         = f9, 0x23
+(p13)     fclass.m.unc       p11,p0     = f9, 0x23 // If |x| not 1, test y=inf
           nop.i 999
 }
 ;;
@@ -2137,31 +2140,33 @@ L(POW_OVER_UNDER_X_NOT_INF):
 // p15 = TRUE if |x|=1, y=inf, return +1
 { .mfb
           nop.m 999
-(p15)     fma.d              f8              = f1,f1,f0
-(p15)     br.ret.spnt b0
+(p15)     fma.d.s0          f8          = f1,f1,f0 // If |x|=1, y=inf, result +1
+(p15)     br.ret.spnt b0                // Exit if |x|=1, y=inf
 }
 ;;
 
 .pred.rel "mutex",p8,p9
 {  .mfb
-(p8)      setf.exp           f8              = pow_GR_17ones
-(p9)      fmerge.s           f8              = f0,f0
-(p11)     br.ret.sptk b0
+(p8)      setf.exp           f8 = pow_GR_17ones // If exp(+big), result inf
+(p9)      fmerge.s           f8 = f0,f0         // If exp(-big), result 0
+(p11)     br.ret.sptk b0                // Exit if |x| not 1, y=inf
 }
+;;
 
 { .mfb
           nop.m 999
           nop.f 999
-          br.cond.sptk L(POW_OVER_UNDER_ERROR)
+          br.cond.sptk POW_OVER_UNDER_ERROR // Branch if y not inf
 }
 ;;
 
-L(POW_Y_NAN):
 
-// Is x = +1 then result is +1, else result is quiet Y
+POW_Y_NAN:
+// Here if y=nan, x anything
+// If x = +1 then result is +1, else result is quiet Y
 { .mfi
        nop.m 999
-       fcmp.eq.s1         p10,p9               = POW_NORM_X, f1 
+       fcmp.eq.s1         p10,p9        = POW_NORM_X, f1
        nop.i 999
 }
 ;;
@@ -2175,148 +2180,118 @@ L(POW_Y_NAN):
 
 { .mfi
        nop.m 999
-(p10)  fma.d f8 = f1,f1,f0 
+(p10)  fma.d.s0 f8 = f1,f1,f0
        nop.i 999
 }
 { .mfb
        nop.m 999
-(p9)   fma.d f8 = f9,f8,f0 
-       br.ret.sptk b0
+(p9)   fma.d.s0 f8 = f9,f8,f0
+       br.ret.sptk b0             // Exit y=nan
 }
 ;;
 
 
-L(POW_OVER_UNDER_ERROR):
+POW_OVER_UNDER_ERROR:
+// Here if we have overflow or underflow.
+// Enter with p12 true if x negative and y odd int to force -0 or -inf
 
 { .mfi
-          nop.m 999
-          fmerge.s f10                      = POW_NORM_X,POW_NORM_X
-          nop.i 999
-}
-{ .mfi
-          sub   pow_GR_17ones_m1            = pow_GR_17ones, r0, 1
-          nop.f 999
-          mov pow_GR_one                    = 0x1
+         sub   pow_GR_17ones_m1         = pow_GR_17ones, r0, 1
+         nop.f 999
+         mov pow_GR_one                 = 0x1
 }
 ;;
 
-// overflow
+// overflow, force inf with O flag
 { .mmb
-(p8)     mov pow_GR_tag                     = 24
-(p8)     setf.exp f11                       = pow_GR_17ones_m1
+(p8)     mov pow_GR_tag                 = 24
+(p8)     setf.exp POW_tmp               = pow_GR_17ones_m1
          nop.b 999
 }
 ;;
 
-        
-// underflow
+// underflow, force zero with I, U flags
 { .mmi
-(p9)    mov pow_GR_tag                     = 25
-(p9)    setf.exp f11                       = pow_GR_one
+(p9)    mov pow_GR_tag                  = 25
+(p9)    setf.exp POW_tmp                = pow_GR_one
         nop.i 999
 }
 ;;
 
-
-// p12 x is negative and y is an odd integer 
-
-
 { .mfi
         nop.m 999
-        fma.d f8                               = f11, f11, f0
+        fma.d.s0 f8                     = POW_tmp, POW_tmp, f0
         nop.i 999
 }
 ;;
 
+// p12 x is negative and y is an odd integer, change sign of result
 { .mfi
         nop.m 999
-(p12)   fmerge.ns f8                           = f8, f8
+(p12)   fnma.d.s0 f8                    = POW_tmp, POW_tmp, f0
         nop.i 999
 }
 ;;
 
-
-.endp pow
-ASM_SIZE_DIRECTIVE(pow)
-
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
+GLOBAL_LIBM_END(pow)
 
 
+LOCAL_LIBM_ENTRY(__libm_error_region)
 
-.proc __libm_error_region
-__libm_error_region:
-
-// Answer is inf for overflow and 0 for underflow.
 .prologue
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp     // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs         // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp=-64,sp                   // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP=gp               // Save gp
 };;
 
-
-// (2)
 { .mmi
         stfd [GR_Parameter_Y] = POW_NORM_Y,16 // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+        add GR_Parameter_X = 16,sp      // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0=b0               // Save b0
 };;
 
 .body
-// (3)
 { .mib
-        stfd [GR_Parameter_X] = POW_NORM_X              // STORE Parameter 1 on stack
+        stfd [GR_Parameter_X] = POW_NORM_X // STORE Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
-        nop.b 0                                
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = f8                      // STORE Parameter 3 on stack
+        stfd [GR_Parameter_Y] = f8      // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#           // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 
-// (4)
 { .mmi
-        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfd  f8 = [GR_Parameter_RESULT] // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                 // Restore stack pointer
+        mov   b0 = GR_SAVE_B0            // Restore return address
 };;
+
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        mov   gp = GR_SAVE_GP            // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS       // Restore ar.pfs
+        br.ret.sptk     b0               // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/e_powf.S b/sysdeps/ia64/fpu/e_powf.S
index d464058262..1406a94b65 100644
--- a/sysdeps/ia64/fpu/e_powf.S
+++ b/sysdeps/ia64/fpu/e_powf.S
@@ -1,10 +1,10 @@
 .file "powf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,30 +35,42 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 2/03/00  Added p12 to definite over/under path. With odd power we did not
+// 02/02/00 Initial version
+// 02/03/00 Added p12 to definite over/under path. With odd power we did not
 //          maintain the sign of x in this path.
-// 4/04/00  Unwind support added
-// 4/19/00  pow(+-1,inf) now returns NaN
-//          pow(+-val, +-inf) returns 0 or inf, but now does not call error support
+// 04/04/00 Unwind support added
+// 04/19/00 pow(+-1,inf) now returns NaN
+//          pow(+-val, +-inf) returns 0 or inf, but now does not call error
+//          support
 //          Added s1 to fcvt.fx because invalid flag was incorrectly set.
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 9/07/00  Improved performance by eliminating bank conflicts and other stalls,
+// 09/07/00 Improved performance by eliminating bank conflicts and other stalls,
 //          and tweaking the critical path
-// 9/08/00  Per c99, pow(+-1,inf) now returns 1, and pow(+1,nan) returns 1
-// 9/28/00  Updated NaN**0 path 
-// 1/20/01  Fixed denormal flag settings.
-// 2/12/01  Improved speed.
+// 09/08/00 Per c99, pow(+-1,inf) now returns 1, and pow(+1,nan) returns 1
+// 09/28/00 Updated NaN**0 path
+// 01/20/01 Fixed denormal flag settings.
+// 02/13/01 Improved speed.
+// 03/19/01 Reordered exp polynomial to improve speed and eliminate monotonicity
+//          problem in round up, down, and to zero modes.  Also corrected
+//          overflow result when x negative, y odd in round up, down, zero.
+// 06/14/01 Added brace missing from bundle
+// 12/10/01 Corrected case where x negative, 2^23 <= |y| < 2^24, y odd integer.
+// 02/08/02 Fixed overflow/underflow cases that were not calling error support.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 08/29/02 Improved Itanium 2 performance
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 10/09/03 Modified algorithm to improve performance, reduce table size, and
+//          fix boundary case powf(2.0,-150.0)
+// 03/31/05 Reformatted delimiters between data tables
 //
 // API
 //==============================================================
-// double pow(double)
-// float  powf(float)
+// float powf(float x, float y)
 //
 // Overview of operation
 //==============================================================
@@ -67,73 +79,69 @@
 // 1. Log(x)
 // 2. y Log(x)
 // 3. exp(y log(x))
-// 
+//
 // This means we work with the absolute value of x and merge in the sign later.
 //      Log(x) = G + delta + r -rsq/2 + p
 // G,delta depend on the exponent of x and table entries. The table entries are
 // indexed by the exponent of x, called K.
-// 
+//
 // The G and delta come out of the reduction; r is the reduced x.
-// 
+//
 // B = frcpa(x)
 // xB-1 is small means that B is the approximate inverse of x.
-// 
+//
 //      Log(x) = Log( (1/B)(Bx) )
 //             = Log(1/B) + Log(Bx)
 //             = Log(1/B) + Log( 1 + (Bx-1))
-// 
+//
 //      x  = 2^K 1.x_1x_2.....x_52
-//      B= frcpa(x) = 2^-k Cm 
+//      B= frcpa(x) = 2^-k Cm
 //      Log(1/B) = Log(1/(2^-K Cm))
 //      Log(1/B) = Log((2^K/ Cm))
 //      Log(1/B) = K Log(2) + Log(1/Cm)
-// 
+//
 //      Log(x)   = K Log(2) + Log(1/Cm) + Log( 1 + (Bx-1))
-// 
+//
 // If you take the significand of x, set the exponent to true 0, then Cm is
 // the frcpa. We tabulate the Log(1/Cm) values. There are 256 of them.
 // The frcpa table is indexed by 8 bits, the x_1 thru x_8.
 // m = x_1x_2...x_8 is an 8-bit index.
-// 
+//
 //      Log(1/Cm) = log(1/frcpa(1+m/256)) where m goes from 0 to 255.
-// 
-// We tabluate as two doubles, T and t, where T +t is the value itself.
-// 
-//      Log(x)   = (K Log(2)_hi + T) + (Log(2)_hi + t) + Log( 1 + (Bx-1))
-//      Log(x)   =  G + delta           + Log( 1 + (Bx-1))
-// 
+//
+// We tabluate as one double, T for single precision power
+//
+//      Log(x)   = (K Log(2)_hi + T) + (K Log(2)_lo) + Log( 1 + (Bx-1))
+//      Log(x)   =  G                +     delta     + Log( 1 + (Bx-1))
+//
 // The Log( 1 + (Bx-1)) can be calculated as a series in r = Bx-1.
-// 
+//
 //      Log( 1 + (Bx-1)) = r - rsq/2 + p
-// 
+//        where p = r^3(P0 + P1*r + P2*r^2)
+//
 // Then,
-//    
-//      yLog(x) = yG + y delta + y(r-rsq/2) + yp
-//      yLog(x) = Z1 + e3      + Z2         + Z3 + (e2 + e3)
-// 
-// 
-//     exp(yLog(x)) = exp(Z1 + Z2 + Z3) exp(e1 + e2 + e3)
 //
+//      yLog(x) = yG + y delta + y(r-rsq/2) + yp
+//      yLog(x) = Z1 + e3      + Z2         + Z3
 //
-//       exp(Z3) is another series.
-//       exp(e1 + e2 + e3) is approximated as f3 = 1 + (e1 + e2 + e3)
 //
-//       Z1 (128/log2) = number of log2/128 in Z1 is N1
-//       Z2 (128/log2) = number of log2/128 in Z2 is N2
+//     exp(yLog(x)) = exp(Z1 + Z2) exp(Z3) exp(e3)
 //
-//       s1 = Z1 - N1 log2/128
-//       s2 = Z2 - N2 log2/128
 //
-//       s = s1 + s2
-//       N = N1 + N2
+//       exp(Z3) is another series.
+//       exp(e3) is approximated as f3 = 1 +  e3
 //
 //       exp(Z1 + Z2) = exp(Z)
+//       Z (128/log2) = number of log2/128 in Z is N
+//
+//       s = Z - N log2/128
+//
 //       exp(Z)       = exp(s) exp(N log2/128)
 //
 //       exp(r)       = exp(Z - N log2/128)
 //
 //      r = s + d = (Z - N (log2/128)_hi) -N (log2/128)_lo
-//                =  Z - N (log2/128) 
+//                =  Z - N (log2/128)
 //
 //      Z         = s+d +N (log2/128)
 //
@@ -149,22 +157,20 @@
 //      n log2/128 = n_7n_6n_5 log2/8 + n_4n_3n_2n_1 log2/128
 //      n log2/128 = I2 log2/8 + I1 log2/128
 //
-//      N log2/128 = M log2 + I2 log2/8 + I1 log2/128 
+//      N log2/128 = M log2 + I2 log2/8 + I1 log2/128
 //
 //      exp(Z)    = exp(s) (1+d) exp(log(2^M) + log(2^I2/8) + log(2^I1/128))
-//      exp(Z)    = exp(s) (1+d1) (1+d2)(2^M) 2^I2/8 2^I1/128
-//      exp(Z)    = exp(s) f1 f2 (2^M) 2^I2/8 2^I1/128
+//      exp(Z)    = exp(s) f12 (2^M) 2^I2/8 2^I1/128
 //
 // I1, I2 are table indices. Use a series for exp(s).
-// Then get exp(Z) 
+// Then get exp(Z)
 //
-//     exp(yLog(x)) = exp(Z1 + Z2 + Z3) exp(e1 + e2 + e3)
-//     exp(yLog(x)) = exp(Z) exp(Z3) f3 
-//     exp(yLog(x)) = exp(Z)f3 exp(Z3)  
-//     exp(yLog(x)) = A exp(Z3)  
+//     exp(yLog(x)) = exp(Z) exp(Z3) f3
+//     exp(yLog(x)) = exp(Z)f3 exp(Z3)
+//     exp(yLog(x)) = A exp(Z3)
 //
 // We actually calculate exp(Z3) -1.
-// Then, 
+// Then,
 //     exp(yLog(x)) = A + A( exp(Z3)   -1)
 //
 
@@ -175,142 +181,146 @@
 // ==============
 // The operation (K*log2_hi) must be exact. K is the true exponent of x.
 // If we allow gradual underflow (denormals), K can be represented in 12 bits
-// (as a two's complement number). We assume 13 bits as an engineering precaution.
-// 
+// (as a two's complement number). We assume 13 bits as an engineering
+// precaution.
+//
 //           +------------+----------------+-+
 //           |  13 bits   | 50 bits        | |
 //           +------------+----------------+-+
 //           0            1                66
 //                        2                34
-// 
+//
 // So we want the lsb(log2_hi) to be 2^-50
 // We get log2 as a quad-extended (15-bit exponent, 128-bit significand)
-// 
+//
 //      0 fffe b17217f7d1cf79ab c9e3b39803f2f6af (4...)
-// 
+//
 // Consider numbering the bits left to right, starting at 0 thru 127.
 // Bit 0 is the 2^-1 bit; bit 49 is the 2^-50 bit.
-// 
+//
 //  ...79ab
 //     0111 1001 1010 1011
 //     44
 //     89
-// 
-// So if we shift off the rightmost 14 bits, then (shift back only 
+//
+// So if we shift off the rightmost 14 bits, then (shift back only
 // the top half) we get
-// 
+//
 //      0 fffe b17217f7d1cf4000 e6af278ece600fcb dabc000000000000
-// 
+//
 // Put the right 64-bit signficand in an FR register, convert to double;
 // it is exact. Put the next 128 bits into a quad register and round to double.
 // The true exponent of the low part is -51.
-// 
+//
 // hi is 0 fffe b17217f7d1cf4000
 // lo is 0 ffcc e6af278ece601000
-// 
+//
 // Convert to double memory format and get
-// 
+//
 // hi is 0x3fe62e42fefa39e8
-// lo is 0x3cccd5e4f1d9cc02 
-// 
+// lo is 0x3cccd5e4f1d9cc02
+//
 // log2_hi + log2_lo is an accurate value for log2.
-// 
-// 
+//
+//
 // The T and t values
 // ==================
 // A similar method is used to generate the T and t values.
-// 
+//
 // K * log2_hi + T  must be exact.
-// 
+//
 // Smallest T,t
 // ----------
-// The smallest T,t is 
+// The smallest T,t is
 //       T                   t
-// data8 0x3f60040155d58800, 0x3c93bce0ce3ddd81  log(1/frcpa(1+0/256))=  +1.95503e-003
-// 
+// 0x3f60040155d58800, 0x3c93bce0ce3ddd81  log(1/frcpa(1+0/256))=  +1.95503e-003
+//
 // The exponent is 0x3f6 (biased)  or -9 (true).
 // For the smallest T value, what we want is to clip the significand such that
-// when it is shifted right by 9, its lsb is in the bit for 2^-51. The 9 is the specific 
-// for the first entry. In general, it is 0xffff - (biased 15-bit exponent).
+// when it is shifted right by 9, its lsb is in the bit for 2^-51. The 9 is the
+// specific for the first entry. In general, it is 0xffff - (biased 15-bit
+// exponent).
 
-// Independently, what we have calculated is the table value as a quad precision number.
+// Independently, what we have calculated is the table value as a quad
+// precision number.
 // Table entry 1 is
 // 0 fff6 80200aaeac44ef38 338f77605fdf8000
-// 
+//
 // We store this quad precision number in a data structure that is
-//    sign:           1 
+//    sign:           1
 //    exponent:      15
 //    signficand_hi: 64 (includes explicit bit)
 //    signficand_lo: 49
 // Because the explicit bit is included, the significand is 113 bits.
-// 
+//
 // Consider significand_hi for table entry 1.
-// 
-// 
+//
+//
 // +-+--- ... -------+--------------------+
 // | |
 // +-+--- ... -------+--------------------+
 // 0 1               4444444455555555556666
 //                   2345678901234567890123
-// 
+//
 // Labeled as above, bit 0 is 2^0, bit 1 is 2^-1, etc.
 // Bit 42 is 2^-42. If we shift to the right by 9, the bit in
 // bit 42 goes in 51.
-// 
+//
 // So what we want to do is shift bits 43 thru 63 into significand_lo.
-// This is shifting bit 42 into bit 63, taking care to retain the shifted-off bits.
-// Then shifting (just with signficaand_hi) back into bit 42. 
-//  
-// The shift_value is 63-42 = 21. In general, this is 
+// This is shifting bit 42 into bit 63, taking care to retain shifted-off bits.
+// Then shifting (just with signficaand_hi) back into bit 42.
+//
+// The shift_value is 63-42 = 21. In general, this is
 //      63 - (51 -(0xffff - 0xfff6))
 // For this example, it is
 //      63 - (51 - 9) = 63 - 42  = 21
-// 
-// This means we are shifting 21 bits into significand_lo.  We must maintain more
-// that a 128-bit signficand not to lose bits. So before the shift we put the 128-bit 
-// significand into a 256-bit signficand and then shift.
+//
+// This means we are shifting 21 bits into significand_lo. We must maintain more
+// that a 128-bit signficand not to lose bits. So before the shift we put the
+// 128-bit significand into a 256-bit signficand and then shift.
 // The 256-bit significand has four parts: hh, hl, lh, and ll.
-// 
+//
 // Start off with
 //      hh         hl         lh         ll
 //      <64>       <49><15_0> <64_0>     <64_0>
-// 
+//
 // After shift by 21 (then return for significand_hi),
 //      <43><21_0> <21><43>   <6><58_0>  <64_0>
-// 
+//
 // Take the hh part and convert to a double. There is no rounding here.
-// The conversion is exact. The true exponent of the high part is the same as the
-// true exponent of the input quad.
-// 
-// We have some 64 plus significand bits for the low part. In this example, we have
-// 70 bits. We want to round this to a double. Put them in a quad and then do a quad fnorm.
-// For this example the true exponent of the low part is 
+// The conversion is exact. The true exponent of the high part is the same as
+// the true exponent of the input quad.
+//
+// We have some 64 plus significand bits for the low part. In this example, we
+// have 70 bits. We want to round this to a double. Put them in a quad and then
+// do a quad fnorm.
+// For this example the true exponent of the low part is
 //      true_exponent_of_high - 43 = true_exponent_of_high - (64-21)
-// In general, this is 
-//      true_exponent_of_high - (64 - shift_value)  
-// 
-// 
+// In general, this is
+//      true_exponent_of_high - (64 - shift_value)
+//
+//
 // Largest T,t
 // ----------
 // The largest T,t is
-// data8 0x3fe62643fecf9742, 0x3c9e3147684bd37d    log(1/frcpa(1+255/256))=  +6.92171e-001
-// 
+// 0x3fe62643fecf9742, 0x3c9e3147684bd37d  log(1/frcpa(1+255/256))=+6.92171e-001
+//
 // Table entry 256 is
 // 0 fffe b1321ff67cba178c 51da12f4df5a0000
-// 
-// The shift value is 
+//
+// The shift value is
 //      63 - (51 -(0xffff - 0xfffe)) = 13
-// 
-// The true exponent of the low part is 
+//
+// The true exponent of the low part is
 //      true_exponent_of_high - (64 - shift_value)
 //      -1 - (64-13) = -52
 // Biased as a double, this is 0x3cb
-// 
-// 
-// 
+//
+//
+//
 // So then lsb(T) must be >= 2^-51
 // msb(Klog2_hi) <= 2^12
-// 
+//
 //              +--------+---------+
 //              |       51 bits    | <== largest T
 //              +--------+---------+
@@ -318,7 +328,8 @@
 // +------------+----------------+-+
 // |  13 bits   | 50 bits        | |
 // +------------+----------------+-+
-
+//
+// Note: For powf only the table of T is needed
 
 
 // Special Cases
@@ -385,63 +396,70 @@
 
 // X any   Y =0               +1
 
-#include "libm_support.h"
-
 // Assembly macros
 //==============================================================
 
 // integer registers used
 
-pow_AD_Tt                 = r33
-pow_GR_FFF7               = r34
-pow_GR_exp_Y              = r34 // duplicate
-pow_GR_17ones             = r35
-
-pow_AD_P                  = r36
-pow_AD_Q                  = r37
-pow_AD_tbl1               = r38
-pow_AD_tbl2               = r39
-pow_GR_exp_X              = r40
-pow_GR_true_exp_X         = r40 // duplicate
-
-pow_GR_offset             = r41
-pow_GR_exp_Xm1            = r42
-pow_GR_sig_X              = r43
-pow_GR_signexp_X          = r44
-
-pow_GR_signexp_Xm1        = r46
-pow_GR_int_W1             = r47
-pow_GR_int_W2             = r48
-pow_GR_int_N              = r49
-pow_GR_index1             = r50
-
-pow_GR_index2             = r51
-pow_AD_T1                 = r52
-pow_AD_T2                 = r53
-pow_GR_gt_ln              = r53 // duplicate
-pow_int_GR_M              = r54
-pow_GR_10033              = r55
-
-pow_GR_16ones             = r56
-pow_GR_sig_int_Y          = r57
-pow_GR_sign_Y_Gpr         = r58
-pow_GR_17ones_m1          = r59
-pow_GR_one                = r60
-pow_GR_sign_Y             = r60 
-
-pow_GR_signexp_Y_Gpr      = r61 
-pow_GR_exp_Y_Gpr          = r62 
-pow_GR_true_exp_Y_Gpr     = r63 
-pow_GR_signexp_Y          = r64 
-
-GR_SAVE_B0                = r65
-GR_SAVE_GP                = r66
-GR_SAVE_PFS               = r67
-
-GR_Parameter_X            = r68
-GR_Parameter_Y            = r69
-GR_Parameter_RESULT       = r70
-pow_GR_tag                = r71
+pow_GR_exp_half           = r10
+pow_GR_signexp_Xm1        = r11
+pow_GR_tmp                = r11
+
+pow_GR_signexp_X          = r14
+pow_GR_17ones             = r15
+pow_GR_Fpsr               = r15
+pow_AD_P                  = r16
+pow_GR_rcs0_mask          = r16
+pow_GR_exp_2tom8          = r17
+pow_GR_rcs0               = r17
+pow_GR_sig_X              = r18
+pow_GR_10033              = r19
+pow_GR_16ones             = r20
+
+pow_AD_Tt                 = r21
+pow_GR_exp_X              = r22
+pow_AD_Q                  = r23
+pow_GR_true_exp_X         = r24
+pow_GR_y_zero             = r25
+
+pow_GR_exp_Y              = r26
+pow_AD_tbl1               = r27
+pow_AD_tbl2               = r28
+pow_GR_offset             = r29
+pow_GR_exp_Xm1            = r30
+pow_GR_xneg_yodd          = r31
+
+pow_GR_int_N              = r38
+pow_GR_index1             = r39
+pow_GR_index2             = r40
+
+pow_AD_T1                 = r41
+pow_AD_T2                 = r42
+pow_int_GR_M              = r43
+pow_GR_sig_int_Y          = r44
+pow_GR_sign_Y_Gpr         = r45
+
+pow_GR_17ones_m1          = r46
+pow_GR_one                = r47
+pow_GR_sign_Y             = r48
+pow_GR_signexp_Y_Gpr      = r49
+pow_GR_exp_Y_Gpr          = r50
+
+pow_GR_true_exp_Y_Gpr     = r51
+pow_GR_signexp_Y          = r52
+pow_GR_x_one              = r53
+pow_GR_big_pos            = r55
+
+pow_GR_big_neg            = r56
+
+GR_SAVE_B0                = r50
+GR_SAVE_GP                = r51
+GR_SAVE_PFS               = r52
+
+GR_Parameter_X            = r53
+GR_Parameter_Y            = r54
+GR_Parameter_RESULT       = r55
+pow_GR_tag                = r56
 
 
 // floating point registers used
@@ -450,23 +468,20 @@ POW_B                     = f32
 POW_NORM_X                = f33
 POW_Xm1                   = f34
 POW_r1                    = f34
-POW_P4                    = f35
 
-POW_P5                    = f36
 POW_NORM_Y                = f37
 POW_Q2                    = f38
-POW_Q3                    = f39
+POW_eps                   = f39
 POW_P2                    = f40
 
-POW_P3                    = f41
 POW_P0                    = f42
 POW_log2_lo               = f43
 POW_r                     = f44
 POW_Q0_half               = f45
 
-POW_Q1                    = f46  
+POW_tmp                   = f47
 POW_log2_hi               = f48
-POW_Q4                    = f49
+POW_Q1                    = f49
 POW_P1                    = f50
 
 POW_log2_by_128_hi        = f51
@@ -475,52 +490,33 @@ POW_rsq                   = f53
 POW_Yrcub                 = f54
 POW_log2_by_128_lo        = f55
 
-POW_v6                    = f56
-POW_v4                    = f58
+POW_xsq                   = f57
 POW_v2                    = f59
 POW_T                     = f60
 
-POW_Tt                    = f61
 POW_RSHF                  = f62
-POW_v21ps                 = f63
-POW_s4                    = f64
+POW_v210                  = f63
+POW_twoV                  = f65
 
 POW_U                     = f66
 POW_G                     = f67
 POW_delta                 = f68
-POW_v3                    = f69
 POW_V                     = f70
 
 POW_p                     = f71
-POW_Z1                    = f72
+POW_Z                     = f72
 POW_e3                    = f73
-POW_e2                    = f74
 POW_Z2                    = f75
 
-POW_e1                    = f76
 POW_W1                    = f77
-POW_UmZ2                  = f78
-POW_W2                    = f79
 POW_Z3                    = f80
 
-POW_int_W1                = f81
-POW_e12                   = f82
-POW_int_W2                = f83
-POW_UmZ2pV                = f84
 POW_Z3sq                  = f85
 
-POW_e123                  = f86
-POW_N1float               = f87
-POW_N2float               = f88
+POW_Nfloat                = f87
 POW_f3                    = f89
 POW_q                     = f90
 
-POW_s1                    = f91
-POW_Nfloat                = f92
-POW_s2                    = f93
-POW_f2                    = f94
-POW_f1                    = f95
-
 POW_T1                    = f96
 POW_T2                    = f97
 POW_2M                    = f98
@@ -533,330 +529,312 @@ POW_1ps                   = f103
 POW_A                     = f104
 POW_es                    = f105
 
+POW_Xp1                   = f106
 POW_int_K                 = f107
 POW_K                     = f108
 POW_f123                  = f109
 POW_Gpr                   = f110
 
-POW_Y_Gpr                 = f111 
+POW_Y_Gpr                 = f111
 POW_int_Y                 = f112
+POW_2Mqp1                 = f113
 
 POW_float_int_Y           = f116
 POW_ftz_urm_f8            = f117
 POW_wre_urm_f8            = f118
-POW_abs_A                 = f119
-POW_gt_pln                = f120
-
-POW_xsq                   = f121
-
-POW_twoV                  = f122
-POW_Xp1                   = f123
+POW_big_neg               = f119
+POW_big_pos               = f120
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-pow_table_P:
-ASM_TYPE_DIRECTIVE(pow_table_P,@object)
-data8 0x8000F7B249FF332D, 0x0000BFFC  // P_5
-data8 0xAAAAAAA9E7902C7F, 0x0000BFFC  // P_3
+LOCAL_OBJECT_START(pow_table_P)
 data8 0x80000000000018E5, 0x0000BFFD  // P_1
 data8 0xb8aa3b295c17f0bc, 0x00004006  // inv_ln2_by_128
-
-
+//
+//
 data8 0x3FA5555555554A9E // Q_2
-data8 0x3F8111124F4DD9F9 // Q_3
-data8 0x3FE0000000000000 // Q_0
+data8 0x0000000000000000 // Pad
 data8 0x3FC5555555554733 // Q_1
-data8 0x3F56C16D9360FFA0 // Q_4
 data8 0x43e8000000000000 // Right shift constant for exp
 data8 0xc9e3b39803f2f6af, 0x00003fb7  // ln2_by_128_lo
-data8 0x0000000000000000 // pad to eliminate bank conflicts with pow_table_Q
-data8 0x0000000000000000 // pad to eliminate bank conflicts with pow_table_Q
-ASM_SIZE_DIRECTIVE(pow_table_P)
+LOCAL_OBJECT_END(pow_table_P)
 
-pow_table_Q:
-ASM_TYPE_DIRECTIVE(pow_table_Q,@object)
-data8 0x9249FE7F0DC423CF, 0x00003FFC  // P_4
+LOCAL_OBJECT_START(pow_table_Q)
 data8 0xCCCCCCCC4ED2BA7F, 0x00003FFC  // P_2
 data8 0xAAAAAAAAAAAAB505, 0x00003FFD  // P_0
 data8 0x3fe62e42fefa39e8, 0x3cccd5e4f1d9cc02 // log2 hi lo =  +6.93147e-001
 data8 0xb17217f7d1cf79ab, 0x00003ff7  // ln2_by_128_hi
-ASM_SIZE_DIRECTIVE(pow_table_Q)
-
-
-pow_Tt:
-ASM_TYPE_DIRECTIVE(pow_Tt,@object)
-data8 0x3f60040155d58800, 0x3c93bce0ce3ddd81 // log(1/frcpa(1+0/256))=  +1.95503e-003
-data8 0x3f78121214586a00, 0x3cb540e0a5cfc9bc // log(1/frcpa(1+1/256))=  +5.87661e-003
-data8 0x3f841929f9683200, 0x3cbdf1d57404da1f // log(1/frcpa(1+2/256))=  +9.81362e-003
-data8 0x3f8c317384c75f00, 0x3c69806208c04c22 // log(1/frcpa(1+3/256))=  +1.37662e-002
-data8 0x3f91a6b91ac73380, 0x3c7874daa716eb32 // log(1/frcpa(1+4/256))=  +1.72376e-002
-data8 0x3f95ba9a5d9ac000, 0x3cacbb84e08d78ac // log(1/frcpa(1+5/256))=  +2.12196e-002
-data8 0x3f99d2a807432580, 0x3cbcf80538b441e1 // log(1/frcpa(1+6/256))=  +2.52177e-002
-data8 0x3f9d6b2725979800, 0x3c6095e5c8f8f359 // log(1/frcpa(1+7/256))=  +2.87291e-002
-data8 0x3fa0c58fa19dfa80, 0x3cb4c5d4e9d0dda2 // log(1/frcpa(1+8/256))=  +3.27573e-002
-data8 0x3fa2954c78cbce00, 0x3caa932b860ab8d6 // log(1/frcpa(1+9/256))=  +3.62953e-002
-data8 0x3fa4a94d2da96c40, 0x3ca670452b76bbd5 // log(1/frcpa(1+10/256))=  +4.03542e-002
-data8 0x3fa67c94f2d4bb40, 0x3ca84104f9941798 // log(1/frcpa(1+11/256))=  +4.39192e-002
-data8 0x3fa85188b630f040, 0x3cb40a882cbf0153 // log(1/frcpa(1+12/256))=  +4.74971e-002
-data8 0x3faa6b8abe73af40, 0x3c988d46e25c9059 // log(1/frcpa(1+13/256))=  +5.16017e-002
-data8 0x3fac441e06f72a80, 0x3cae3e930a1a2a96 // log(1/frcpa(1+14/256))=  +5.52072e-002
-data8 0x3fae1e6713606d00, 0x3c8a796f6283b580 // log(1/frcpa(1+15/256))=  +5.88257e-002
-data8 0x3faffa6911ab9300, 0x3c5193070351e88a // log(1/frcpa(1+16/256))=  +6.24574e-002
-data8 0x3fb0ec139c5da600, 0x3c623f2a75eb992d // log(1/frcpa(1+17/256))=  +6.61022e-002
-data8 0x3fb1dbd2643d1900, 0x3ca649b2ef8927f0 // log(1/frcpa(1+18/256))=  +6.97605e-002
-data8 0x3fb2cc7284fe5f00, 0x3cbc5e86599513e2 // log(1/frcpa(1+19/256))=  +7.34321e-002
-data8 0x3fb3bdf5a7d1ee60, 0x3c90bd4bb69dada3 // log(1/frcpa(1+20/256))=  +7.71173e-002
-data8 0x3fb4b05d7aa012e0, 0x3c54e377c9b8a54f // log(1/frcpa(1+21/256))=  +8.08161e-002
-data8 0x3fb580db7ceb5700, 0x3c7fdb2f98354cde // log(1/frcpa(1+22/256))=  +8.39975e-002
-data8 0x3fb674f089365a60, 0x3cb9994c9d3301c1 // log(1/frcpa(1+23/256))=  +8.77219e-002
-data8 0x3fb769ef2c6b5680, 0x3caaec639db52a79 // log(1/frcpa(1+24/256))=  +9.14602e-002
-data8 0x3fb85fd927506a40, 0x3c9f9f99a3cf8e25 // log(1/frcpa(1+25/256))=  +9.52125e-002
-data8 0x3fb9335e5d594980, 0x3ca15c3abd47d99a // log(1/frcpa(1+26/256))=  +9.84401e-002
-data8 0x3fba2b0220c8e5e0, 0x3cb4ca639adf6fc3 // log(1/frcpa(1+27/256))=  +1.02219e-001
-data8 0x3fbb0004ac1a86a0, 0x3ca7cb81bf959a59 // log(1/frcpa(1+28/256))=  +1.05469e-001
-data8 0x3fbbf968769fca00, 0x3cb0c646c121418e // log(1/frcpa(1+29/256))=  +1.09274e-001
-data8 0x3fbccfedbfee13a0, 0x3ca0465fce24ab4b // log(1/frcpa(1+30/256))=  +1.12548e-001
-data8 0x3fbda727638446a0, 0x3c82803f4e2e6603 // log(1/frcpa(1+31/256))=  +1.15832e-001
-data8 0x3fbea3257fe10f60, 0x3cb986a3f2313d1a // log(1/frcpa(1+32/256))=  +1.19677e-001
-data8 0x3fbf7be9fedbfde0, 0x3c97d16a6a621cf4 // log(1/frcpa(1+33/256))=  +1.22985e-001
-data8 0x3fc02ab352ff25f0, 0x3c9cc6baad365600 // log(1/frcpa(1+34/256))=  +1.26303e-001
-data8 0x3fc097ce579d2040, 0x3cb9ba16d329440b // log(1/frcpa(1+35/256))=  +1.29633e-001
-data8 0x3fc1178e8227e470, 0x3cb7bc671683f8e6 // log(1/frcpa(1+36/256))=  +1.33531e-001
-data8 0x3fc185747dbecf30, 0x3c9d1116f66d2345 // log(1/frcpa(1+37/256))=  +1.36885e-001
-data8 0x3fc1f3b925f25d40, 0x3c8162c9ef939ac6 // log(1/frcpa(1+38/256))=  +1.40250e-001
-data8 0x3fc2625d1e6ddf50, 0x3caad3a1ec384fc3 // log(1/frcpa(1+39/256))=  +1.43627e-001
-data8 0x3fc2d1610c868130, 0x3cb3ad997036941b // log(1/frcpa(1+40/256))=  +1.47015e-001
-data8 0x3fc340c597411420, 0x3cbc2308262c7998 // log(1/frcpa(1+41/256))=  +1.50414e-001
-data8 0x3fc3b08b6757f2a0, 0x3cb2170d6cdf0526 // log(1/frcpa(1+42/256))=  +1.53825e-001
-data8 0x3fc40dfb08378000, 0x3c9bb453c4f7b685 // log(1/frcpa(1+43/256))=  +1.56677e-001
-data8 0x3fc47e74e8ca5f70, 0x3cb836a48fdfce9d // log(1/frcpa(1+44/256))=  +1.60109e-001
-data8 0x3fc4ef51f6466de0, 0x3ca07a43919aa64b // log(1/frcpa(1+45/256))=  +1.63553e-001
-data8 0x3fc56092e02ba510, 0x3ca85006899d97b0 // log(1/frcpa(1+46/256))=  +1.67010e-001
-data8 0x3fc5d23857cd74d0, 0x3ca30a5ba6e7abbe // log(1/frcpa(1+47/256))=  +1.70478e-001
-data8 0x3fc6313a37335d70, 0x3ca905586f0ac97e // log(1/frcpa(1+48/256))=  +1.73377e-001
-data8 0x3fc6a399dabbd380, 0x3c9b2c6657a96684 // log(1/frcpa(1+49/256))=  +1.76868e-001
-data8 0x3fc70337dd3ce410, 0x3cb50bc52f55cdd8 // log(1/frcpa(1+50/256))=  +1.79786e-001
-data8 0x3fc77654128f6120, 0x3cad2eb7c9a39efe // log(1/frcpa(1+51/256))=  +1.83299e-001
-data8 0x3fc7e9d82a0b0220, 0x3cba127e90393c01 // log(1/frcpa(1+52/256))=  +1.86824e-001
-data8 0x3fc84a6b759f5120, 0x3cbd7fd52079f706 // log(1/frcpa(1+53/256))=  +1.89771e-001
-data8 0x3fc8ab47d5f5a300, 0x3cbfae141751a3de // log(1/frcpa(1+54/256))=  +1.92727e-001
-data8 0x3fc91fe490965810, 0x3cb69cf30a1c319e // log(1/frcpa(1+55/256))=  +1.96286e-001
-data8 0x3fc981634011aa70, 0x3ca5bb3d208bc42a // log(1/frcpa(1+56/256))=  +1.99261e-001
-data8 0x3fc9f6c407089660, 0x3ca04d68658179a0 // log(1/frcpa(1+57/256))=  +2.02843e-001
-data8 0x3fca58e729348f40, 0x3c99f5411546c286 // log(1/frcpa(1+58/256))=  +2.05838e-001
-data8 0x3fcabb55c31693a0, 0x3cb9a5350eb327d5 // log(1/frcpa(1+59/256))=  +2.08842e-001
-data8 0x3fcb1e104919efd0, 0x3c18965fcce7c406 // log(1/frcpa(1+60/256))=  +2.11855e-001
-data8 0x3fcb94ee93e367c0, 0x3cb503716da45184 // log(1/frcpa(1+61/256))=  +2.15483e-001
-data8 0x3fcbf851c0675550, 0x3cbdf1b3f7ab5378 // log(1/frcpa(1+62/256))=  +2.18516e-001
-data8 0x3fcc5c0254bf23a0, 0x3ca7aab9ed0b1d7b // log(1/frcpa(1+63/256))=  +2.21558e-001
-data8 0x3fccc000c9db3c50, 0x3c92a7a2a850072a // log(1/frcpa(1+64/256))=  +2.24609e-001
-data8 0x3fcd244d99c85670, 0x3c9f6019120edf4c // log(1/frcpa(1+65/256))=  +2.27670e-001
-data8 0x3fcd88e93fb2f450, 0x3c6affb96815e081 // log(1/frcpa(1+66/256))=  +2.30741e-001
-data8 0x3fcdedd437eaef00, 0x3c72553595897976 // log(1/frcpa(1+67/256))=  +2.33820e-001
-data8 0x3fce530effe71010, 0x3c90913b020fa182 // log(1/frcpa(1+68/256))=  +2.36910e-001
-data8 0x3fceb89a1648b970, 0x3c837ba4045bfd25 // log(1/frcpa(1+69/256))=  +2.40009e-001
-data8 0x3fcf1e75fadf9bd0, 0x3cbcea6d13e0498d // log(1/frcpa(1+70/256))=  +2.43117e-001
-data8 0x3fcf84a32ead7c30, 0x3ca5e3a67b3c6d77 // log(1/frcpa(1+71/256))=  +2.46235e-001
-data8 0x3fcfeb2233ea07c0, 0x3cba0c6f0049c5a6 // log(1/frcpa(1+72/256))=  +2.49363e-001
-data8 0x3fd028f9c7035c18, 0x3cb0a30b06677ff6 // log(1/frcpa(1+73/256))=  +2.52501e-001
-data8 0x3fd05c8be0d96358, 0x3ca0f1c77ccb5865 // log(1/frcpa(1+74/256))=  +2.55649e-001
-data8 0x3fd085eb8f8ae790, 0x3cbd513f45fe7a97 // log(1/frcpa(1+75/256))=  +2.58174e-001
-data8 0x3fd0b9c8e32d1910, 0x3c927449047ca006 // log(1/frcpa(1+76/256))=  +2.61339e-001
-data8 0x3fd0edd060b78080, 0x3c89b52d8435f53e // log(1/frcpa(1+77/256))=  +2.64515e-001
-data8 0x3fd122024cf00638, 0x3cbdd976fabda4bd // log(1/frcpa(1+78/256))=  +2.67701e-001
-data8 0x3fd14be2927aecd0, 0x3cb02f90ad0bc471 // log(1/frcpa(1+79/256))=  +2.70257e-001
-data8 0x3fd180618ef18ad8, 0x3cbd003792c71a98 // log(1/frcpa(1+80/256))=  +2.73461e-001
-data8 0x3fd1b50bbe2fc638, 0x3ca9ae64c6403ead // log(1/frcpa(1+81/256))=  +2.76675e-001
-data8 0x3fd1df4cc7cf2428, 0x3cb43f0455f7e395 // log(1/frcpa(1+82/256))=  +2.79254e-001
-data8 0x3fd214456d0eb8d0, 0x3cb0fbd748d75d30 // log(1/frcpa(1+83/256))=  +2.82487e-001
-data8 0x3fd23ec5991eba48, 0x3c906edd746b77e2 // log(1/frcpa(1+84/256))=  +2.85081e-001
-data8 0x3fd2740d9f870af8, 0x3ca9802e6a00a670 // log(1/frcpa(1+85/256))=  +2.88333e-001
-data8 0x3fd29ecdabcdfa00, 0x3cacecef70890cfa // log(1/frcpa(1+86/256))=  +2.90943e-001
-data8 0x3fd2d46602adcce8, 0x3cb97911955f3521 // log(1/frcpa(1+87/256))=  +2.94214e-001
-data8 0x3fd2ff66b04ea9d0, 0x3cb12dabe191d1c9 // log(1/frcpa(1+88/256))=  +2.96838e-001
-data8 0x3fd335504b355a30, 0x3cbdf9139df924ec // log(1/frcpa(1+89/256))=  +3.00129e-001
-data8 0x3fd360925ec44f58, 0x3cb253e68977a1e3 // log(1/frcpa(1+90/256))=  +3.02769e-001
-data8 0x3fd38bf1c3337e70, 0x3cb3d283d2a2da21 // log(1/frcpa(1+91/256))=  +3.05417e-001
-data8 0x3fd3c25277333180, 0x3cadaa5b035eae27 // log(1/frcpa(1+92/256))=  +3.08735e-001
-data8 0x3fd3edf463c16838, 0x3cb983d680d3c108 // log(1/frcpa(1+93/256))=  +3.11399e-001
-data8 0x3fd419b423d5e8c0, 0x3cbc86dd921c139d // log(1/frcpa(1+94/256))=  +3.14069e-001
-data8 0x3fd44591e0539f48, 0x3c86a76d6dc2782e // log(1/frcpa(1+95/256))=  +3.16746e-001
-data8 0x3fd47c9175b6f0a8, 0x3cb59a2e013c6b5f // log(1/frcpa(1+96/256))=  +3.20103e-001
-data8 0x3fd4a8b341552b08, 0x3c93f1e86e468694 // log(1/frcpa(1+97/256))=  +3.22797e-001
-data8 0x3fd4d4f390890198, 0x3cbf5e4ea7c5105a // log(1/frcpa(1+98/256))=  +3.25498e-001
-data8 0x3fd501528da1f960, 0x3cbf58da53e9ad10 // log(1/frcpa(1+99/256))=  +3.28206e-001
-data8 0x3fd52dd06347d4f0, 0x3cb98a28cebf6eef // log(1/frcpa(1+100/256))=  +3.30921e-001
-data8 0x3fd55a6d3c7b8a88, 0x3c9c76b67c2d1fd4 // log(1/frcpa(1+101/256))=  +3.33644e-001
-data8 0x3fd5925d2b112a58, 0x3c9029616a4331b8 // log(1/frcpa(1+102/256))=  +3.37058e-001
-data8 0x3fd5bf406b543db0, 0x3c9fb8292ecfc820 // log(1/frcpa(1+103/256))=  +3.39798e-001
-data8 0x3fd5ec433d5c35a8, 0x3cb71a1229d17eec // log(1/frcpa(1+104/256))=  +3.42545e-001
-data8 0x3fd61965cdb02c18, 0x3cbba94fe1dbb8d2 // log(1/frcpa(1+105/256))=  +3.45300e-001
-data8 0x3fd646a84935b2a0, 0x3c9ee496d2c9ae57 // log(1/frcpa(1+106/256))=  +3.48063e-001
-data8 0x3fd6740add31de90, 0x3cb1da3a6c7a9dfd // log(1/frcpa(1+107/256))=  +3.50833e-001
-data8 0x3fd6a18db74a58c0, 0x3cb494c257add8dc // log(1/frcpa(1+108/256))=  +3.53610e-001
-data8 0x3fd6cf31058670e8, 0x3cb0b244a70a8da9 // log(1/frcpa(1+109/256))=  +3.56396e-001
-data8 0x3fd6f180e852f0b8, 0x3c9db7aefa866720 // log(1/frcpa(1+110/256))=  +3.58490e-001
-data8 0x3fd71f5d71b894e8, 0x3cbe91c4bf324957 // log(1/frcpa(1+111/256))=  +3.61289e-001
-data8 0x3fd74d5aefd66d58, 0x3cb06b3d9bfac023 // log(1/frcpa(1+112/256))=  +3.64096e-001
-data8 0x3fd77b79922bd378, 0x3cb727d8804491f4 // log(1/frcpa(1+113/256))=  +3.66911e-001
-data8 0x3fd7a9b9889f19e0, 0x3ca2ef22df5bc543 // log(1/frcpa(1+114/256))=  +3.69734e-001
-data8 0x3fd7d81b037eb6a0, 0x3cb8fd3ba07a7ece // log(1/frcpa(1+115/256))=  +3.72565e-001
-data8 0x3fd8069e33827230, 0x3c8bd1e25866e61a // log(1/frcpa(1+116/256))=  +3.75404e-001
-data8 0x3fd82996d3ef8bc8, 0x3ca5aab9f5928928 // log(1/frcpa(1+117/256))=  +3.77538e-001
-data8 0x3fd85855776dcbf8, 0x3ca56f33337789d6 // log(1/frcpa(1+118/256))=  +3.80391e-001
-data8 0x3fd8873658327cc8, 0x3cbb8ef0401db49d // log(1/frcpa(1+119/256))=  +3.83253e-001
-data8 0x3fd8aa75973ab8c8, 0x3cbb9961f509a680 // log(1/frcpa(1+120/256))=  +3.85404e-001
-data8 0x3fd8d992dc8824e0, 0x3cb220512a53732d // log(1/frcpa(1+121/256))=  +3.88280e-001
-data8 0x3fd908d2ea7d9510, 0x3c985f0e513bfb5c // log(1/frcpa(1+122/256))=  +3.91164e-001
-data8 0x3fd92c59e79c0e50, 0x3cb82e073fd30d63 // log(1/frcpa(1+123/256))=  +3.93332e-001
-data8 0x3fd95bd750ee3ed0, 0x3ca4aa7cdb6dd8a8 // log(1/frcpa(1+124/256))=  +3.96231e-001
-data8 0x3fd98b7811a3ee58, 0x3caa93a5b660893e // log(1/frcpa(1+125/256))=  +3.99138e-001
-data8 0x3fd9af47f33d4068, 0x3cac294b3b3190ba // log(1/frcpa(1+126/256))=  +4.01323e-001
-data8 0x3fd9df270c1914a0, 0x3cbe1a58fd0cd67e // log(1/frcpa(1+127/256))=  +4.04245e-001
-data8 0x3fda0325ed14fda0, 0x3cb1efa7950fb57e // log(1/frcpa(1+128/256))=  +4.06442e-001
-data8 0x3fda33440224fa78, 0x3c8915fe75e7d477 // log(1/frcpa(1+129/256))=  +4.09379e-001
-data8 0x3fda57725e80c380, 0x3ca72bd1062b1b7f // log(1/frcpa(1+130/256))=  +4.11587e-001
-data8 0x3fda87d0165dd198, 0x3c91f7845f58dbad // log(1/frcpa(1+131/256))=  +4.14539e-001
-data8 0x3fdaac2e6c03f890, 0x3cb6f237a911c509 // log(1/frcpa(1+132/256))=  +4.16759e-001
-data8 0x3fdadccc6fdf6a80, 0x3c90ddc4b7687169 // log(1/frcpa(1+133/256))=  +4.19726e-001
-data8 0x3fdb015b3eb1e790, 0x3c692dd7d90e1e8e // log(1/frcpa(1+134/256))=  +4.21958e-001
-data8 0x3fdb323a3a635948, 0x3c6f85655cbe14de // log(1/frcpa(1+135/256))=  +4.24941e-001
-data8 0x3fdb56fa04462908, 0x3c95252d841994de // log(1/frcpa(1+136/256))=  +4.27184e-001
-data8 0x3fdb881aa659bc90, 0x3caa53a745a3642f // log(1/frcpa(1+137/256))=  +4.30182e-001
-data8 0x3fdbad0bef3db160, 0x3cb32f2540dcc16a // log(1/frcpa(1+138/256))=  +4.32437e-001
-data8 0x3fdbd21297781c28, 0x3cbd8e891e106f1d // log(1/frcpa(1+139/256))=  +4.34697e-001
-data8 0x3fdc039236f08818, 0x3c809435af522ba7 // log(1/frcpa(1+140/256))=  +4.37718e-001
-data8 0x3fdc28cb1e4d32f8, 0x3cb3944752fbd81e // log(1/frcpa(1+141/256))=  +4.39990e-001
-data8 0x3fdc4e19b84723c0, 0x3c9a465260cd3fe5 // log(1/frcpa(1+142/256))=  +4.42267e-001
-data8 0x3fdc7ff9c74554c8, 0x3c92447d5b6ca369 // log(1/frcpa(1+143/256))=  +4.45311e-001
-data8 0x3fdca57b64e9db00, 0x3cb44344a8a00c82 // log(1/frcpa(1+144/256))=  +4.47600e-001
-data8 0x3fdccb130a5ceba8, 0x3cbefaddfb97b73f // log(1/frcpa(1+145/256))=  +4.49895e-001
-data8 0x3fdcf0c0d18f3268, 0x3cbd3e7bfee57898 // log(1/frcpa(1+146/256))=  +4.52194e-001
-data8 0x3fdd232075b5a200, 0x3c9222599987447c // log(1/frcpa(1+147/256))=  +4.55269e-001
-data8 0x3fdd490246defa68, 0x3cabafe9a767a80d // log(1/frcpa(1+148/256))=  +4.57581e-001
-data8 0x3fdd6efa918d25c8, 0x3cb58a2624e1c6fd // log(1/frcpa(1+149/256))=  +4.59899e-001
-data8 0x3fdd9509707ae528, 0x3cbdc3babce578e7 // log(1/frcpa(1+150/256))=  +4.62221e-001
-data8 0x3fddbb2efe92c550, 0x3cb0ac0943c434a4 // log(1/frcpa(1+151/256))=  +4.64550e-001
-data8 0x3fddee2f3445e4a8, 0x3cbba9d07ce820e8 // log(1/frcpa(1+152/256))=  +4.67663e-001
-data8 0x3fde148a1a2726c8, 0x3cb6537e3375b205 // log(1/frcpa(1+153/256))=  +4.70004e-001
-data8 0x3fde3afc0a49ff38, 0x3cbfed5518dbc20e // log(1/frcpa(1+154/256))=  +4.72350e-001
-data8 0x3fde6185206d5168, 0x3cb6572601f73d5c // log(1/frcpa(1+155/256))=  +4.74702e-001
-data8 0x3fde882578823d50, 0x3c9b24abd4584d1a // log(1/frcpa(1+156/256))=  +4.77060e-001
-data8 0x3fdeaedd2eac9908, 0x3cb0ceb5e4d2c8f7 // log(1/frcpa(1+157/256))=  +4.79423e-001
-data8 0x3fded5ac5f436be0, 0x3ca72f21f1f5238e // log(1/frcpa(1+158/256))=  +4.81792e-001
-data8 0x3fdefc9326d16ab8, 0x3c85081a1639a45c // log(1/frcpa(1+159/256))=  +4.84166e-001
-data8 0x3fdf2391a21575f8, 0x3cbf11015bdd297a // log(1/frcpa(1+160/256))=  +4.86546e-001
-data8 0x3fdf4aa7ee031928, 0x3cb3795bc052a2d1 // log(1/frcpa(1+161/256))=  +4.88932e-001
-data8 0x3fdf71d627c30bb0, 0x3c35c61f0f5a88f3 // log(1/frcpa(1+162/256))=  +4.91323e-001
-data8 0x3fdf991c6cb3b378, 0x3c97d99419be6028 // log(1/frcpa(1+163/256))=  +4.93720e-001
-data8 0x3fdfc07ada69a908, 0x3cbfe9341ded70b1 // log(1/frcpa(1+164/256))=  +4.96123e-001
-data8 0x3fdfe7f18eb03d38, 0x3cb85718a640c33f // log(1/frcpa(1+165/256))=  +4.98532e-001
-data8 0x3fe007c053c5002c, 0x3cb3addc9c065f09 // log(1/frcpa(1+166/256))=  +5.00946e-001
-data8 0x3fe01b942198a5a0, 0x3c9d5aa4c77da6ac // log(1/frcpa(1+167/256))=  +5.03367e-001
-data8 0x3fe02f74400c64e8, 0x3cb5a0ee4450ef52 // log(1/frcpa(1+168/256))=  +5.05793e-001
-data8 0x3fe04360be7603ac, 0x3c9dd00c35630fe0 // log(1/frcpa(1+169/256))=  +5.08225e-001
-data8 0x3fe05759ac47fe30, 0x3cbd063e1f0bd82c // log(1/frcpa(1+170/256))=  +5.10663e-001
-data8 0x3fe06b5f1911cf50, 0x3cae8da674af5289 // log(1/frcpa(1+171/256))=  +5.13107e-001
-data8 0x3fe078bf0533c568, 0x3c62241edf5fd1f7 // log(1/frcpa(1+172/256))=  +5.14740e-001
-data8 0x3fe08cd9687e7b0c, 0x3cb3007febcca227 // log(1/frcpa(1+173/256))=  +5.17194e-001
-data8 0x3fe0a10074cf9018, 0x3ca496e84603816b // log(1/frcpa(1+174/256))=  +5.19654e-001
-data8 0x3fe0b5343a234474, 0x3cb46098d14fc90a // log(1/frcpa(1+175/256))=  +5.22120e-001
-data8 0x3fe0c974c89431cc, 0x3cac0a7cdcbb86c6 // log(1/frcpa(1+176/256))=  +5.24592e-001
-data8 0x3fe0ddc2305b9884, 0x3cb2f753210410ff // log(1/frcpa(1+177/256))=  +5.27070e-001
-data8 0x3fe0eb524bafc918, 0x3c88affd6682229e // log(1/frcpa(1+178/256))=  +5.28726e-001
-data8 0x3fe0ffb54213a474, 0x3cadeefbab9af993 // log(1/frcpa(1+179/256))=  +5.31214e-001
-data8 0x3fe114253da97d9c, 0x3cbaf1c2b8bc160a // log(1/frcpa(1+180/256))=  +5.33709e-001
-data8 0x3fe128a24f1d9afc, 0x3cb9cf4df375e650 // log(1/frcpa(1+181/256))=  +5.36210e-001
-data8 0x3fe1365252bf0864, 0x3c985a621d4be111 // log(1/frcpa(1+182/256))=  +5.37881e-001
-data8 0x3fe14ae558b4a92c, 0x3ca104c4aa8977d1 // log(1/frcpa(1+183/256))=  +5.40393e-001
-data8 0x3fe15f85a19c7658, 0x3cbadf26e540f375 // log(1/frcpa(1+184/256))=  +5.42910e-001
-data8 0x3fe16d4d38c119f8, 0x3cb3aea11caec416 // log(1/frcpa(1+185/256))=  +5.44592e-001
-data8 0x3fe18203c20dd130, 0x3cba82d1211d1d6d // log(1/frcpa(1+186/256))=  +5.47121e-001
-data8 0x3fe196c7bc4b1f38, 0x3cb6267acc4f4f4a // log(1/frcpa(1+187/256))=  +5.49656e-001
-data8 0x3fe1a4a738b7a33c, 0x3c858930213c987d // log(1/frcpa(1+188/256))=  +5.51349e-001
-data8 0x3fe1b981c0c9653c, 0x3c9bc2a4a30f697b // log(1/frcpa(1+189/256))=  +5.53895e-001
-data8 0x3fe1ce69e8bb1068, 0x3cb7ae6199cf2a00 // log(1/frcpa(1+190/256))=  +5.56447e-001
-data8 0x3fe1dc619de06944, 0x3c6b50bb38388177 // log(1/frcpa(1+191/256))=  +5.58152e-001
-data8 0x3fe1f160a2ad0da0, 0x3cbd05b2778a5e1d // log(1/frcpa(1+192/256))=  +5.60715e-001
-data8 0x3fe2066d7740737c, 0x3cb32e828f9c6bd6 // log(1/frcpa(1+193/256))=  +5.63285e-001
-data8 0x3fe2147dba47a390, 0x3cbd579851b8b672 // log(1/frcpa(1+194/256))=  +5.65001e-001
-data8 0x3fe229a1bc5ebac0, 0x3cbb321be5237ce8 // log(1/frcpa(1+195/256))=  +5.67582e-001
-data8 0x3fe237c1841a502c, 0x3cb3b56e0915ea64 // log(1/frcpa(1+196/256))=  +5.69306e-001
-data8 0x3fe24cfce6f80d98, 0x3cb34a4d1a422919 // log(1/frcpa(1+197/256))=  +5.71898e-001
-data8 0x3fe25b2c55cd5760, 0x3cb237401ea5015e // log(1/frcpa(1+198/256))=  +5.73630e-001
-data8 0x3fe2707f4d5f7c40, 0x3c9d30f20acc8341 // log(1/frcpa(1+199/256))=  +5.76233e-001
-data8 0x3fe285e0842ca380, 0x3cbc4d866d5f21c0 // log(1/frcpa(1+200/256))=  +5.78842e-001
-data8 0x3fe294294708b770, 0x3cb85e14d5dc54fa // log(1/frcpa(1+201/256))=  +5.80586e-001
-data8 0x3fe2a9a2670aff0c, 0x3c7e6f8f468bbf91 // log(1/frcpa(1+202/256))=  +5.83207e-001
-data8 0x3fe2b7fb2c8d1cc0, 0x3c930ffcf63c8b65 // log(1/frcpa(1+203/256))=  +5.84959e-001
-data8 0x3fe2c65a6395f5f4, 0x3ca0afe20b53d2d2 // log(1/frcpa(1+204/256))=  +5.86713e-001
-data8 0x3fe2dbf557b0df40, 0x3cb646be1188fbc9 // log(1/frcpa(1+205/256))=  +5.89350e-001
-data8 0x3fe2ea64c3f97654, 0x3c96516fa8df33b2 // log(1/frcpa(1+206/256))=  +5.91113e-001
-data8 0x3fe3001823684d70, 0x3cb96d64e16d1360 // log(1/frcpa(1+207/256))=  +5.93762e-001
-data8 0x3fe30e97e9a8b5cc, 0x3c98ef96bc97cca0 // log(1/frcpa(1+208/256))=  +5.95531e-001
-data8 0x3fe32463ebdd34e8, 0x3caef1dc9a56c1bf // log(1/frcpa(1+209/256))=  +5.98192e-001
-data8 0x3fe332f4314ad794, 0x3caa4f0ac5d5fa11 // log(1/frcpa(1+210/256))=  +5.99970e-001
-data8 0x3fe348d90e7464cc, 0x3cbe7889f0516acd // log(1/frcpa(1+211/256))=  +6.02643e-001
-data8 0x3fe35779f8c43d6c, 0x3ca96bbab7245411 // log(1/frcpa(1+212/256))=  +6.04428e-001
-data8 0x3fe36621961a6a98, 0x3ca31f32262db9fb // log(1/frcpa(1+213/256))=  +6.06217e-001
-data8 0x3fe37c299f3c3668, 0x3cb15c72c107ee29 // log(1/frcpa(1+214/256))=  +6.08907e-001
-data8 0x3fe38ae2171976e4, 0x3cba42a2554b2dd4 // log(1/frcpa(1+215/256))=  +6.10704e-001
-data8 0x3fe399a157a603e4, 0x3cb99c62286d8919 // log(1/frcpa(1+216/256))=  +6.12504e-001
-data8 0x3fe3afccfe77b9d0, 0x3ca11048f96a43bd // log(1/frcpa(1+217/256))=  +6.15210e-001
-data8 0x3fe3be9d503533b4, 0x3ca4022f47588c3e // log(1/frcpa(1+218/256))=  +6.17018e-001
-data8 0x3fe3cd7480b4a8a0, 0x3cb4ba7afc2dc56a // log(1/frcpa(1+219/256))=  +6.18830e-001
-data8 0x3fe3e3c43918f76c, 0x3c859673d064b8ba // log(1/frcpa(1+220/256))=  +6.21554e-001
-data8 0x3fe3f2acb27ed6c4, 0x3cb55c6b452a16a8 // log(1/frcpa(1+221/256))=  +6.23373e-001
-data8 0x3fe4019c2125ca90, 0x3cb8c367879c5a31 // log(1/frcpa(1+222/256))=  +6.25197e-001
-data8 0x3fe4181061389720, 0x3cb2c17a79c5cc6c // log(1/frcpa(1+223/256))=  +6.27937e-001
-data8 0x3fe42711518df544, 0x3ca5f38d47012fc5 // log(1/frcpa(1+224/256))=  +6.29769e-001
-data8 0x3fe436194e12b6bc, 0x3cb9854d65a9b426 // log(1/frcpa(1+225/256))=  +6.31604e-001
-data8 0x3fe445285d68ea68, 0x3ca3ff9b3a81cd81 // log(1/frcpa(1+226/256))=  +6.33442e-001
-data8 0x3fe45bcc464c8938, 0x3cb0a2d8011a6c05 // log(1/frcpa(1+227/256))=  +6.36206e-001
-data8 0x3fe46aed21f117fc, 0x3c8a2be41f8e9f3d // log(1/frcpa(1+228/256))=  +6.38053e-001
-data8 0x3fe47a1527e8a2d0, 0x3cba4a83594fab09 // log(1/frcpa(1+229/256))=  +6.39903e-001
-data8 0x3fe489445efffcc8, 0x3cbf306a23dcbcde // log(1/frcpa(1+230/256))=  +6.41756e-001
-data8 0x3fe4a018bcb69834, 0x3ca46c9285029fd1 // log(1/frcpa(1+231/256))=  +6.44543e-001
-data8 0x3fe4af5a0c9d65d4, 0x3cbbc1db897580e3 // log(1/frcpa(1+232/256))=  +6.46405e-001
-data8 0x3fe4bea2a5bdbe84, 0x3cb84d880d7ef775 // log(1/frcpa(1+233/256))=  +6.48271e-001
-data8 0x3fe4cdf28f10ac44, 0x3cb3ec4b7893ce1f // log(1/frcpa(1+234/256))=  +6.50140e-001
-data8 0x3fe4dd49cf994058, 0x3c897224d59d3408 // log(1/frcpa(1+235/256))=  +6.52013e-001
-data8 0x3fe4eca86e64a680, 0x3cbccf620f24f0cd // log(1/frcpa(1+236/256))=  +6.53889e-001
-data8 0x3fe503c43cd8eb68, 0x3c3f872c65971084 // log(1/frcpa(1+237/256))=  +6.56710e-001
-data8 0x3fe513356667fc54, 0x3cb9ca64cc3d52c8 // log(1/frcpa(1+238/256))=  +6.58595e-001
-data8 0x3fe522ae0738a3d4, 0x3cbe708164c75968 // log(1/frcpa(1+239/256))=  +6.60483e-001
-data8 0x3fe5322e26867854, 0x3cb9988ba4aea615 // log(1/frcpa(1+240/256))=  +6.62376e-001
-data8 0x3fe541b5cb979808, 0x3ca1662e3a6b95f5 // log(1/frcpa(1+241/256))=  +6.64271e-001
-data8 0x3fe55144fdbcbd60, 0x3cb3acd4ca45c1e0 // log(1/frcpa(1+242/256))=  +6.66171e-001
-data8 0x3fe560dbc45153c4, 0x3cb4988947959fed // log(1/frcpa(1+243/256))=  +6.68074e-001
-data8 0x3fe5707a26bb8c64, 0x3cb3017fe6607ba9 // log(1/frcpa(1+244/256))=  +6.69980e-001
-data8 0x3fe587f60ed5b8fc, 0x3cbe7a3266366ed4 // log(1/frcpa(1+245/256))=  +6.72847e-001
-data8 0x3fe597a7977c8f30, 0x3ca1e12b9959a90e // log(1/frcpa(1+246/256))=  +6.74763e-001
-data8 0x3fe5a760d634bb88, 0x3cb7c365e53d9602 // log(1/frcpa(1+247/256))=  +6.76682e-001
-data8 0x3fe5b721d295f10c, 0x3cb716c2551ccbf0 // log(1/frcpa(1+248/256))=  +6.78605e-001
-data8 0x3fe5c6ea94431ef8, 0x3ca02b2ed0e28261 // log(1/frcpa(1+249/256))=  +6.80532e-001
-data8 0x3fe5d6bb22ea86f4, 0x3caf43a8bbb2f974 // log(1/frcpa(1+250/256))=  +6.82462e-001
-data8 0x3fe5e6938645d38c, 0x3cbcedc98821b333 // log(1/frcpa(1+251/256))=  +6.84397e-001
-data8 0x3fe5f673c61a2ed0, 0x3caa385eef5f2789 // log(1/frcpa(1+252/256))=  +6.86335e-001
-data8 0x3fe6065bea385924, 0x3cb11624f165c5b4 // log(1/frcpa(1+253/256))=  +6.88276e-001
-data8 0x3fe6164bfa7cc068, 0x3cbad884f87073fa // log(1/frcpa(1+254/256))=  +6.90222e-001
-data8 0x3fe62643fecf9740, 0x3cb78c51da12f4df // log(1/frcpa(1+255/256))=  +6.92171e-001
-ASM_SIZE_DIRECTIVE(pow_Tt)
+LOCAL_OBJECT_END(pow_table_Q)
+
+
+LOCAL_OBJECT_START(pow_Tt)
+data8 0x3f60040155d58800 // log(1/frcpa(1+0/256))=  +1.95503e-003
+data8 0x3f78121214586a00 // log(1/frcpa(1+1/256))=  +5.87661e-003
+data8 0x3f841929f9683200 // log(1/frcpa(1+2/256))=  +9.81362e-003
+data8 0x3f8c317384c75f00 // log(1/frcpa(1+3/256))=  +1.37662e-002
+data8 0x3f91a6b91ac73380 // log(1/frcpa(1+4/256))=  +1.72376e-002
+data8 0x3f95ba9a5d9ac000 // log(1/frcpa(1+5/256))=  +2.12196e-002
+data8 0x3f99d2a807432580 // log(1/frcpa(1+6/256))=  +2.52177e-002
+data8 0x3f9d6b2725979800 // log(1/frcpa(1+7/256))=  +2.87291e-002
+data8 0x3fa0c58fa19dfa80 // log(1/frcpa(1+8/256))=  +3.27573e-002
+data8 0x3fa2954c78cbce00 // log(1/frcpa(1+9/256))=  +3.62953e-002
+data8 0x3fa4a94d2da96c40 // log(1/frcpa(1+10/256))=  +4.03542e-002
+data8 0x3fa67c94f2d4bb40 // log(1/frcpa(1+11/256))=  +4.39192e-002
+data8 0x3fa85188b630f040 // log(1/frcpa(1+12/256))=  +4.74971e-002
+data8 0x3faa6b8abe73af40 // log(1/frcpa(1+13/256))=  +5.16017e-002
+data8 0x3fac441e06f72a80 // log(1/frcpa(1+14/256))=  +5.52072e-002
+data8 0x3fae1e6713606d00 // log(1/frcpa(1+15/256))=  +5.88257e-002
+data8 0x3faffa6911ab9300 // log(1/frcpa(1+16/256))=  +6.24574e-002
+data8 0x3fb0ec139c5da600 // log(1/frcpa(1+17/256))=  +6.61022e-002
+data8 0x3fb1dbd2643d1900 // log(1/frcpa(1+18/256))=  +6.97605e-002
+data8 0x3fb2cc7284fe5f00 // log(1/frcpa(1+19/256))=  +7.34321e-002
+data8 0x3fb3bdf5a7d1ee60 // log(1/frcpa(1+20/256))=  +7.71173e-002
+data8 0x3fb4b05d7aa012e0 // log(1/frcpa(1+21/256))=  +8.08161e-002
+data8 0x3fb580db7ceb5700 // log(1/frcpa(1+22/256))=  +8.39975e-002
+data8 0x3fb674f089365a60 // log(1/frcpa(1+23/256))=  +8.77219e-002
+data8 0x3fb769ef2c6b5680 // log(1/frcpa(1+24/256))=  +9.14602e-002
+data8 0x3fb85fd927506a40 // log(1/frcpa(1+25/256))=  +9.52125e-002
+data8 0x3fb9335e5d594980 // log(1/frcpa(1+26/256))=  +9.84401e-002
+data8 0x3fba2b0220c8e5e0 // log(1/frcpa(1+27/256))=  +1.02219e-001
+data8 0x3fbb0004ac1a86a0 // log(1/frcpa(1+28/256))=  +1.05469e-001
+data8 0x3fbbf968769fca00 // log(1/frcpa(1+29/256))=  +1.09274e-001
+data8 0x3fbccfedbfee13a0 // log(1/frcpa(1+30/256))=  +1.12548e-001
+data8 0x3fbda727638446a0 // log(1/frcpa(1+31/256))=  +1.15832e-001
+data8 0x3fbea3257fe10f60 // log(1/frcpa(1+32/256))=  +1.19677e-001
+data8 0x3fbf7be9fedbfde0 // log(1/frcpa(1+33/256))=  +1.22985e-001
+data8 0x3fc02ab352ff25f0 // log(1/frcpa(1+34/256))=  +1.26303e-001
+data8 0x3fc097ce579d2040 // log(1/frcpa(1+35/256))=  +1.29633e-001
+data8 0x3fc1178e8227e470 // log(1/frcpa(1+36/256))=  +1.33531e-001
+data8 0x3fc185747dbecf30 // log(1/frcpa(1+37/256))=  +1.36885e-001
+data8 0x3fc1f3b925f25d40 // log(1/frcpa(1+38/256))=  +1.40250e-001
+data8 0x3fc2625d1e6ddf50 // log(1/frcpa(1+39/256))=  +1.43627e-001
+data8 0x3fc2d1610c868130 // log(1/frcpa(1+40/256))=  +1.47015e-001
+data8 0x3fc340c597411420 // log(1/frcpa(1+41/256))=  +1.50414e-001
+data8 0x3fc3b08b6757f2a0 // log(1/frcpa(1+42/256))=  +1.53825e-001
+data8 0x3fc40dfb08378000 // log(1/frcpa(1+43/256))=  +1.56677e-001
+data8 0x3fc47e74e8ca5f70 // log(1/frcpa(1+44/256))=  +1.60109e-001
+data8 0x3fc4ef51f6466de0 // log(1/frcpa(1+45/256))=  +1.63553e-001
+data8 0x3fc56092e02ba510 // log(1/frcpa(1+46/256))=  +1.67010e-001
+data8 0x3fc5d23857cd74d0 // log(1/frcpa(1+47/256))=  +1.70478e-001
+data8 0x3fc6313a37335d70 // log(1/frcpa(1+48/256))=  +1.73377e-001
+data8 0x3fc6a399dabbd380 // log(1/frcpa(1+49/256))=  +1.76868e-001
+data8 0x3fc70337dd3ce410 // log(1/frcpa(1+50/256))=  +1.79786e-001
+data8 0x3fc77654128f6120 // log(1/frcpa(1+51/256))=  +1.83299e-001
+data8 0x3fc7e9d82a0b0220 // log(1/frcpa(1+52/256))=  +1.86824e-001
+data8 0x3fc84a6b759f5120 // log(1/frcpa(1+53/256))=  +1.89771e-001
+data8 0x3fc8ab47d5f5a300 // log(1/frcpa(1+54/256))=  +1.92727e-001
+data8 0x3fc91fe490965810 // log(1/frcpa(1+55/256))=  +1.96286e-001
+data8 0x3fc981634011aa70 // log(1/frcpa(1+56/256))=  +1.99261e-001
+data8 0x3fc9f6c407089660 // log(1/frcpa(1+57/256))=  +2.02843e-001
+data8 0x3fca58e729348f40 // log(1/frcpa(1+58/256))=  +2.05838e-001
+data8 0x3fcabb55c31693a0 // log(1/frcpa(1+59/256))=  +2.08842e-001
+data8 0x3fcb1e104919efd0 // log(1/frcpa(1+60/256))=  +2.11855e-001
+data8 0x3fcb94ee93e367c0 // log(1/frcpa(1+61/256))=  +2.15483e-001
+data8 0x3fcbf851c0675550 // log(1/frcpa(1+62/256))=  +2.18516e-001
+data8 0x3fcc5c0254bf23a0 // log(1/frcpa(1+63/256))=  +2.21558e-001
+data8 0x3fccc000c9db3c50 // log(1/frcpa(1+64/256))=  +2.24609e-001
+data8 0x3fcd244d99c85670 // log(1/frcpa(1+65/256))=  +2.27670e-001
+data8 0x3fcd88e93fb2f450 // log(1/frcpa(1+66/256))=  +2.30741e-001
+data8 0x3fcdedd437eaef00 // log(1/frcpa(1+67/256))=  +2.33820e-001
+data8 0x3fce530effe71010 // log(1/frcpa(1+68/256))=  +2.36910e-001
+data8 0x3fceb89a1648b970 // log(1/frcpa(1+69/256))=  +2.40009e-001
+data8 0x3fcf1e75fadf9bd0 // log(1/frcpa(1+70/256))=  +2.43117e-001
+data8 0x3fcf84a32ead7c30 // log(1/frcpa(1+71/256))=  +2.46235e-001
+data8 0x3fcfeb2233ea07c0 // log(1/frcpa(1+72/256))=  +2.49363e-001
+data8 0x3fd028f9c7035c18 // log(1/frcpa(1+73/256))=  +2.52501e-001
+data8 0x3fd05c8be0d96358 // log(1/frcpa(1+74/256))=  +2.55649e-001
+data8 0x3fd085eb8f8ae790 // log(1/frcpa(1+75/256))=  +2.58174e-001
+data8 0x3fd0b9c8e32d1910 // log(1/frcpa(1+76/256))=  +2.61339e-001
+data8 0x3fd0edd060b78080 // log(1/frcpa(1+77/256))=  +2.64515e-001
+data8 0x3fd122024cf00638 // log(1/frcpa(1+78/256))=  +2.67701e-001
+data8 0x3fd14be2927aecd0 // log(1/frcpa(1+79/256))=  +2.70257e-001
+data8 0x3fd180618ef18ad8 // log(1/frcpa(1+80/256))=  +2.73461e-001
+data8 0x3fd1b50bbe2fc638 // log(1/frcpa(1+81/256))=  +2.76675e-001
+data8 0x3fd1df4cc7cf2428 // log(1/frcpa(1+82/256))=  +2.79254e-001
+data8 0x3fd214456d0eb8d0 // log(1/frcpa(1+83/256))=  +2.82487e-001
+data8 0x3fd23ec5991eba48 // log(1/frcpa(1+84/256))=  +2.85081e-001
+data8 0x3fd2740d9f870af8 // log(1/frcpa(1+85/256))=  +2.88333e-001
+data8 0x3fd29ecdabcdfa00 // log(1/frcpa(1+86/256))=  +2.90943e-001
+data8 0x3fd2d46602adcce8 // log(1/frcpa(1+87/256))=  +2.94214e-001
+data8 0x3fd2ff66b04ea9d0 // log(1/frcpa(1+88/256))=  +2.96838e-001
+data8 0x3fd335504b355a30 // log(1/frcpa(1+89/256))=  +3.00129e-001
+data8 0x3fd360925ec44f58 // log(1/frcpa(1+90/256))=  +3.02769e-001
+data8 0x3fd38bf1c3337e70 // log(1/frcpa(1+91/256))=  +3.05417e-001
+data8 0x3fd3c25277333180 // log(1/frcpa(1+92/256))=  +3.08735e-001
+data8 0x3fd3edf463c16838 // log(1/frcpa(1+93/256))=  +3.11399e-001
+data8 0x3fd419b423d5e8c0 // log(1/frcpa(1+94/256))=  +3.14069e-001
+data8 0x3fd44591e0539f48 // log(1/frcpa(1+95/256))=  +3.16746e-001
+data8 0x3fd47c9175b6f0a8 // log(1/frcpa(1+96/256))=  +3.20103e-001
+data8 0x3fd4a8b341552b08 // log(1/frcpa(1+97/256))=  +3.22797e-001
+data8 0x3fd4d4f390890198 // log(1/frcpa(1+98/256))=  +3.25498e-001
+data8 0x3fd501528da1f960 // log(1/frcpa(1+99/256))=  +3.28206e-001
+data8 0x3fd52dd06347d4f0 // log(1/frcpa(1+100/256))=  +3.30921e-001
+data8 0x3fd55a6d3c7b8a88 // log(1/frcpa(1+101/256))=  +3.33644e-001
+data8 0x3fd5925d2b112a58 // log(1/frcpa(1+102/256))=  +3.37058e-001
+data8 0x3fd5bf406b543db0 // log(1/frcpa(1+103/256))=  +3.39798e-001
+data8 0x3fd5ec433d5c35a8 // log(1/frcpa(1+104/256))=  +3.42545e-001
+data8 0x3fd61965cdb02c18 // log(1/frcpa(1+105/256))=  +3.45300e-001
+data8 0x3fd646a84935b2a0 // log(1/frcpa(1+106/256))=  +3.48063e-001
+data8 0x3fd6740add31de90 // log(1/frcpa(1+107/256))=  +3.50833e-001
+data8 0x3fd6a18db74a58c0 // log(1/frcpa(1+108/256))=  +3.53610e-001
+data8 0x3fd6cf31058670e8 // log(1/frcpa(1+109/256))=  +3.56396e-001
+data8 0x3fd6f180e852f0b8 // log(1/frcpa(1+110/256))=  +3.58490e-001
+data8 0x3fd71f5d71b894e8 // log(1/frcpa(1+111/256))=  +3.61289e-001
+data8 0x3fd74d5aefd66d58 // log(1/frcpa(1+112/256))=  +3.64096e-001
+data8 0x3fd77b79922bd378 // log(1/frcpa(1+113/256))=  +3.66911e-001
+data8 0x3fd7a9b9889f19e0 // log(1/frcpa(1+114/256))=  +3.69734e-001
+data8 0x3fd7d81b037eb6a0 // log(1/frcpa(1+115/256))=  +3.72565e-001
+data8 0x3fd8069e33827230 // log(1/frcpa(1+116/256))=  +3.75404e-001
+data8 0x3fd82996d3ef8bc8 // log(1/frcpa(1+117/256))=  +3.77538e-001
+data8 0x3fd85855776dcbf8 // log(1/frcpa(1+118/256))=  +3.80391e-001
+data8 0x3fd8873658327cc8 // log(1/frcpa(1+119/256))=  +3.83253e-001
+data8 0x3fd8aa75973ab8c8 // log(1/frcpa(1+120/256))=  +3.85404e-001
+data8 0x3fd8d992dc8824e0 // log(1/frcpa(1+121/256))=  +3.88280e-001
+data8 0x3fd908d2ea7d9510 // log(1/frcpa(1+122/256))=  +3.91164e-001
+data8 0x3fd92c59e79c0e50 // log(1/frcpa(1+123/256))=  +3.93332e-001
+data8 0x3fd95bd750ee3ed0 // log(1/frcpa(1+124/256))=  +3.96231e-001
+data8 0x3fd98b7811a3ee58 // log(1/frcpa(1+125/256))=  +3.99138e-001
+data8 0x3fd9af47f33d4068 // log(1/frcpa(1+126/256))=  +4.01323e-001
+data8 0x3fd9df270c1914a0 // log(1/frcpa(1+127/256))=  +4.04245e-001
+data8 0x3fda0325ed14fda0 // log(1/frcpa(1+128/256))=  +4.06442e-001
+data8 0x3fda33440224fa78 // log(1/frcpa(1+129/256))=  +4.09379e-001
+data8 0x3fda57725e80c380 // log(1/frcpa(1+130/256))=  +4.11587e-001
+data8 0x3fda87d0165dd198 // log(1/frcpa(1+131/256))=  +4.14539e-001
+data8 0x3fdaac2e6c03f890 // log(1/frcpa(1+132/256))=  +4.16759e-001
+data8 0x3fdadccc6fdf6a80 // log(1/frcpa(1+133/256))=  +4.19726e-001
+data8 0x3fdb015b3eb1e790 // log(1/frcpa(1+134/256))=  +4.21958e-001
+data8 0x3fdb323a3a635948 // log(1/frcpa(1+135/256))=  +4.24941e-001
+data8 0x3fdb56fa04462908 // log(1/frcpa(1+136/256))=  +4.27184e-001
+data8 0x3fdb881aa659bc90 // log(1/frcpa(1+137/256))=  +4.30182e-001
+data8 0x3fdbad0bef3db160 // log(1/frcpa(1+138/256))=  +4.32437e-001
+data8 0x3fdbd21297781c28 // log(1/frcpa(1+139/256))=  +4.34697e-001
+data8 0x3fdc039236f08818 // log(1/frcpa(1+140/256))=  +4.37718e-001
+data8 0x3fdc28cb1e4d32f8 // log(1/frcpa(1+141/256))=  +4.39990e-001
+data8 0x3fdc4e19b84723c0 // log(1/frcpa(1+142/256))=  +4.42267e-001
+data8 0x3fdc7ff9c74554c8 // log(1/frcpa(1+143/256))=  +4.45311e-001
+data8 0x3fdca57b64e9db00 // log(1/frcpa(1+144/256))=  +4.47600e-001
+data8 0x3fdccb130a5ceba8 // log(1/frcpa(1+145/256))=  +4.49895e-001
+data8 0x3fdcf0c0d18f3268 // log(1/frcpa(1+146/256))=  +4.52194e-001
+data8 0x3fdd232075b5a200 // log(1/frcpa(1+147/256))=  +4.55269e-001
+data8 0x3fdd490246defa68 // log(1/frcpa(1+148/256))=  +4.57581e-001
+data8 0x3fdd6efa918d25c8 // log(1/frcpa(1+149/256))=  +4.59899e-001
+data8 0x3fdd9509707ae528 // log(1/frcpa(1+150/256))=  +4.62221e-001
+data8 0x3fddbb2efe92c550 // log(1/frcpa(1+151/256))=  +4.64550e-001
+data8 0x3fddee2f3445e4a8 // log(1/frcpa(1+152/256))=  +4.67663e-001
+data8 0x3fde148a1a2726c8 // log(1/frcpa(1+153/256))=  +4.70004e-001
+data8 0x3fde3afc0a49ff38 // log(1/frcpa(1+154/256))=  +4.72350e-001
+data8 0x3fde6185206d5168 // log(1/frcpa(1+155/256))=  +4.74702e-001
+data8 0x3fde882578823d50 // log(1/frcpa(1+156/256))=  +4.77060e-001
+data8 0x3fdeaedd2eac9908 // log(1/frcpa(1+157/256))=  +4.79423e-001
+data8 0x3fded5ac5f436be0 // log(1/frcpa(1+158/256))=  +4.81792e-001
+data8 0x3fdefc9326d16ab8 // log(1/frcpa(1+159/256))=  +4.84166e-001
+data8 0x3fdf2391a21575f8 // log(1/frcpa(1+160/256))=  +4.86546e-001
+data8 0x3fdf4aa7ee031928 // log(1/frcpa(1+161/256))=  +4.88932e-001
+data8 0x3fdf71d627c30bb0 // log(1/frcpa(1+162/256))=  +4.91323e-001
+data8 0x3fdf991c6cb3b378 // log(1/frcpa(1+163/256))=  +4.93720e-001
+data8 0x3fdfc07ada69a908 // log(1/frcpa(1+164/256))=  +4.96123e-001
+data8 0x3fdfe7f18eb03d38 // log(1/frcpa(1+165/256))=  +4.98532e-001
+data8 0x3fe007c053c5002c // log(1/frcpa(1+166/256))=  +5.00946e-001
+data8 0x3fe01b942198a5a0 // log(1/frcpa(1+167/256))=  +5.03367e-001
+data8 0x3fe02f74400c64e8 // log(1/frcpa(1+168/256))=  +5.05793e-001
+data8 0x3fe04360be7603ac // log(1/frcpa(1+169/256))=  +5.08225e-001
+data8 0x3fe05759ac47fe30 // log(1/frcpa(1+170/256))=  +5.10663e-001
+data8 0x3fe06b5f1911cf50 // log(1/frcpa(1+171/256))=  +5.13107e-001
+data8 0x3fe078bf0533c568 // log(1/frcpa(1+172/256))=  +5.14740e-001
+data8 0x3fe08cd9687e7b0c // log(1/frcpa(1+173/256))=  +5.17194e-001
+data8 0x3fe0a10074cf9018 // log(1/frcpa(1+174/256))=  +5.19654e-001
+data8 0x3fe0b5343a234474 // log(1/frcpa(1+175/256))=  +5.22120e-001
+data8 0x3fe0c974c89431cc // log(1/frcpa(1+176/256))=  +5.24592e-001
+data8 0x3fe0ddc2305b9884 // log(1/frcpa(1+177/256))=  +5.27070e-001
+data8 0x3fe0eb524bafc918 // log(1/frcpa(1+178/256))=  +5.28726e-001
+data8 0x3fe0ffb54213a474 // log(1/frcpa(1+179/256))=  +5.31214e-001
+data8 0x3fe114253da97d9c // log(1/frcpa(1+180/256))=  +5.33709e-001
+data8 0x3fe128a24f1d9afc // log(1/frcpa(1+181/256))=  +5.36210e-001
+data8 0x3fe1365252bf0864 // log(1/frcpa(1+182/256))=  +5.37881e-001
+data8 0x3fe14ae558b4a92c // log(1/frcpa(1+183/256))=  +5.40393e-001
+data8 0x3fe15f85a19c7658 // log(1/frcpa(1+184/256))=  +5.42910e-001
+data8 0x3fe16d4d38c119f8 // log(1/frcpa(1+185/256))=  +5.44592e-001
+data8 0x3fe18203c20dd130 // log(1/frcpa(1+186/256))=  +5.47121e-001
+data8 0x3fe196c7bc4b1f38 // log(1/frcpa(1+187/256))=  +5.49656e-001
+data8 0x3fe1a4a738b7a33c // log(1/frcpa(1+188/256))=  +5.51349e-001
+data8 0x3fe1b981c0c9653c // log(1/frcpa(1+189/256))=  +5.53895e-001
+data8 0x3fe1ce69e8bb1068 // log(1/frcpa(1+190/256))=  +5.56447e-001
+data8 0x3fe1dc619de06944 // log(1/frcpa(1+191/256))=  +5.58152e-001
+data8 0x3fe1f160a2ad0da0 // log(1/frcpa(1+192/256))=  +5.60715e-001
+data8 0x3fe2066d7740737c // log(1/frcpa(1+193/256))=  +5.63285e-001
+data8 0x3fe2147dba47a390 // log(1/frcpa(1+194/256))=  +5.65001e-001
+data8 0x3fe229a1bc5ebac0 // log(1/frcpa(1+195/256))=  +5.67582e-001
+data8 0x3fe237c1841a502c // log(1/frcpa(1+196/256))=  +5.69306e-001
+data8 0x3fe24cfce6f80d98 // log(1/frcpa(1+197/256))=  +5.71898e-001
+data8 0x3fe25b2c55cd5760 // log(1/frcpa(1+198/256))=  +5.73630e-001
+data8 0x3fe2707f4d5f7c40 // log(1/frcpa(1+199/256))=  +5.76233e-001
+data8 0x3fe285e0842ca380 // log(1/frcpa(1+200/256))=  +5.78842e-001
+data8 0x3fe294294708b770 // log(1/frcpa(1+201/256))=  +5.80586e-001
+data8 0x3fe2a9a2670aff0c // log(1/frcpa(1+202/256))=  +5.83207e-001
+data8 0x3fe2b7fb2c8d1cc0 // log(1/frcpa(1+203/256))=  +5.84959e-001
+data8 0x3fe2c65a6395f5f4 // log(1/frcpa(1+204/256))=  +5.86713e-001
+data8 0x3fe2dbf557b0df40 // log(1/frcpa(1+205/256))=  +5.89350e-001
+data8 0x3fe2ea64c3f97654 // log(1/frcpa(1+206/256))=  +5.91113e-001
+data8 0x3fe3001823684d70 // log(1/frcpa(1+207/256))=  +5.93762e-001
+data8 0x3fe30e97e9a8b5cc // log(1/frcpa(1+208/256))=  +5.95531e-001
+data8 0x3fe32463ebdd34e8 // log(1/frcpa(1+209/256))=  +5.98192e-001
+data8 0x3fe332f4314ad794 // log(1/frcpa(1+210/256))=  +5.99970e-001
+data8 0x3fe348d90e7464cc // log(1/frcpa(1+211/256))=  +6.02643e-001
+data8 0x3fe35779f8c43d6c // log(1/frcpa(1+212/256))=  +6.04428e-001
+data8 0x3fe36621961a6a98 // log(1/frcpa(1+213/256))=  +6.06217e-001
+data8 0x3fe37c299f3c3668 // log(1/frcpa(1+214/256))=  +6.08907e-001
+data8 0x3fe38ae2171976e4 // log(1/frcpa(1+215/256))=  +6.10704e-001
+data8 0x3fe399a157a603e4 // log(1/frcpa(1+216/256))=  +6.12504e-001
+data8 0x3fe3afccfe77b9d0 // log(1/frcpa(1+217/256))=  +6.15210e-001
+data8 0x3fe3be9d503533b4 // log(1/frcpa(1+218/256))=  +6.17018e-001
+data8 0x3fe3cd7480b4a8a0 // log(1/frcpa(1+219/256))=  +6.18830e-001
+data8 0x3fe3e3c43918f76c // log(1/frcpa(1+220/256))=  +6.21554e-001
+data8 0x3fe3f2acb27ed6c4 // log(1/frcpa(1+221/256))=  +6.23373e-001
+data8 0x3fe4019c2125ca90 // log(1/frcpa(1+222/256))=  +6.25197e-001
+data8 0x3fe4181061389720 // log(1/frcpa(1+223/256))=  +6.27937e-001
+data8 0x3fe42711518df544 // log(1/frcpa(1+224/256))=  +6.29769e-001
+data8 0x3fe436194e12b6bc // log(1/frcpa(1+225/256))=  +6.31604e-001
+data8 0x3fe445285d68ea68 // log(1/frcpa(1+226/256))=  +6.33442e-001
+data8 0x3fe45bcc464c8938 // log(1/frcpa(1+227/256))=  +6.36206e-001
+data8 0x3fe46aed21f117fc // log(1/frcpa(1+228/256))=  +6.38053e-001
+data8 0x3fe47a1527e8a2d0 // log(1/frcpa(1+229/256))=  +6.39903e-001
+data8 0x3fe489445efffcc8 // log(1/frcpa(1+230/256))=  +6.41756e-001
+data8 0x3fe4a018bcb69834 // log(1/frcpa(1+231/256))=  +6.44543e-001
+data8 0x3fe4af5a0c9d65d4 // log(1/frcpa(1+232/256))=  +6.46405e-001
+data8 0x3fe4bea2a5bdbe84 // log(1/frcpa(1+233/256))=  +6.48271e-001
+data8 0x3fe4cdf28f10ac44 // log(1/frcpa(1+234/256))=  +6.50140e-001
+data8 0x3fe4dd49cf994058 // log(1/frcpa(1+235/256))=  +6.52013e-001
+data8 0x3fe4eca86e64a680 // log(1/frcpa(1+236/256))=  +6.53889e-001
+data8 0x3fe503c43cd8eb68 // log(1/frcpa(1+237/256))=  +6.56710e-001
+data8 0x3fe513356667fc54 // log(1/frcpa(1+238/256))=  +6.58595e-001
+data8 0x3fe522ae0738a3d4 // log(1/frcpa(1+239/256))=  +6.60483e-001
+data8 0x3fe5322e26867854 // log(1/frcpa(1+240/256))=  +6.62376e-001
+data8 0x3fe541b5cb979808 // log(1/frcpa(1+241/256))=  +6.64271e-001
+data8 0x3fe55144fdbcbd60 // log(1/frcpa(1+242/256))=  +6.66171e-001
+data8 0x3fe560dbc45153c4 // log(1/frcpa(1+243/256))=  +6.68074e-001
+data8 0x3fe5707a26bb8c64 // log(1/frcpa(1+244/256))=  +6.69980e-001
+data8 0x3fe587f60ed5b8fc // log(1/frcpa(1+245/256))=  +6.72847e-001
+data8 0x3fe597a7977c8f30 // log(1/frcpa(1+246/256))=  +6.74763e-001
+data8 0x3fe5a760d634bb88 // log(1/frcpa(1+247/256))=  +6.76682e-001
+data8 0x3fe5b721d295f10c // log(1/frcpa(1+248/256))=  +6.78605e-001
+data8 0x3fe5c6ea94431ef8 // log(1/frcpa(1+249/256))=  +6.80532e-001
+data8 0x3fe5d6bb22ea86f4 // log(1/frcpa(1+250/256))=  +6.82462e-001
+data8 0x3fe5e6938645d38c // log(1/frcpa(1+251/256))=  +6.84397e-001
+data8 0x3fe5f673c61a2ed0 // log(1/frcpa(1+252/256))=  +6.86335e-001
+data8 0x3fe6065bea385924 // log(1/frcpa(1+253/256))=  +6.88276e-001
+data8 0x3fe6164bfa7cc068 // log(1/frcpa(1+254/256))=  +6.90222e-001
+data8 0x3fe62643fecf9740 // log(1/frcpa(1+255/256))=  +6.92171e-001
+LOCAL_OBJECT_END(pow_Tt)
 
 
 // Table 1 is 2^(index_1/128) where
 // index_1 goes from 0 to 15
-pow_tbl1:
-ASM_TYPE_DIRECTIVE(pow_tbl1,@object)
+LOCAL_OBJECT_START(pow_tbl1)
 data8 0x8000000000000000 , 0x00003FFF
 data8 0x80B1ED4FD999AB6C , 0x00003FFF
 data8 0x8164D1F3BC030773 , 0x00003FFF
@@ -873,13 +851,12 @@ data8 0x88980E8092DA8527 , 0x00003FFF
 data8 0x8955EE03618E5FDD , 0x00003FFF
 data8 0x8A14D575496EFD9A , 0x00003FFF
 data8 0x8AD4C6452C728924 , 0x00003FFF
-ASM_SIZE_DIRECTIVE(pow_tbl1)
+LOCAL_OBJECT_END(pow_tbl1)
 
 
 // Table 2 is 2^(index_1/8) where
 // index_2 goes from 0 to 7
-pow_tbl2:
-ASM_TYPE_DIRECTIVE(pow_tbl2,@object)
+LOCAL_OBJECT_START(pow_tbl2)
 data8 0x8000000000000000 , 0x00003FFF
 data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
 data8 0x9837F0518DB8A96F , 0x00003FFF
@@ -888,781 +865,514 @@ data8 0xB504F333F9DE6484 , 0x00003FFF
 data8 0xC5672A115506DADD , 0x00003FFF
 data8 0xD744FCCAD69D6AF4 , 0x00003FFF
 data8 0xEAC0C6E7DD24392F , 0x00003FFF
-ASM_SIZE_DIRECTIVE(pow_tbl2)
-
-.global powf
+LOCAL_OBJECT_END(pow_tbl2)
 
 .section .text
-.proc  powf
-.align 32
-
-powf:
+GLOBAL_LIBM_ENTRY(powf)
 
+// Get exponent of x.  Will be used to calculate K.
 { .mfi
-          alloc         r32=ar.pfs,1,35,4,0 
-          fms.s1 POW_Xm1 = f8,f1,f1   // Will be used for r1 if x>0
-          mov           pow_GR_17ones  = 0x1FFFF
+          getf.exp     pow_GR_signexp_X = f8
+          fms.s1 POW_Xm1 = f8,f1,f1     // Will be used for r1 if x>0
+          mov           pow_GR_17ones   = 0x1FFFF
 }
 { .mfi
-(p0)      addl          pow_AD_P   = @ltoff(pow_table_P), gp
-          fma.s1 POW_Xp1 = f8,f1,f1   // Will be used for r1 if x<0
+          addl          pow_AD_P        = @ltoff(pow_table_P), gp
+          fma.s1 POW_Xp1 = f8,f1,f1     // Will be used for r1 if x<0
           nop.i 999
-;;
 }
+;;
 
-
-// Get exponent of x.  Will be used to calculate K.
+// Get significand of x.  Will be used to get index to fetch T, Tt.
 { .mfi
-          getf.exp      pow_GR_signexp_X    = f8
-          frcpa.s1      POW_B, p6   = f1,f8
-          nop.i 999
+          getf.sig      pow_GR_sig_X    = f8
+          frcpa.s1      POW_B, p6       = f1,f8
+          mov           pow_GR_exp_half = 0xFFFE   // Exponent for 0.5
 }
 { .mfi
           ld8 pow_AD_P = [pow_AD_P]
-          fma.s1        POW_NORM_X     = f8,f1,f0
-          mov           pow_GR_FFF7    = 0xFFF7
+          fma.s1        POW_NORM_X      = f8,f1,f0
+          mov          pow_GR_exp_2tom8 = 0xFFF7
 }
 ;;
 
-
-
-// Get significand of x.  Will be used to get index to fetch T, Tt.
-// p13 = TRUE ==> X is unorm
 // DOUBLE 0x10033  exponent limit at which y is an integer
-// SINGLE 0x10016
 { .mfi
-          getf.sig      pow_GR_sig_X        = f8
-          fclass.m  p13,p0          = f8, 0x0b  // Test for x unorm
-          addl pow_GR_10033                 = 0x10033, r0
+          nop.m 999
+          fcmp.lt.s1 p8,p9 = f8, f0     // Test for x<0
+          addl pow_GR_10033             = 0x10033, r0
 }
 { .mfi
           mov           pow_GR_16ones   = 0xFFFF
-          fma.s1        POW_NORM_Y     = f9,f1,f0
+          fma.s1        POW_NORM_Y      = f9,f1,f0
           nop.i 999
 }
 ;;
 
-
-// p14 = TRUE ==> X is ZERO
+// p13 = TRUE ==> X is unorm
 { .mfi
+          setf.exp      POW_Q0_half     = pow_GR_exp_half  // Form 0.5
+          fclass.m  p13,p0              = f8, 0x0b  // Test for x unorm
           adds          pow_AD_Tt       = pow_Tt - pow_table_P,  pow_AD_P
-          fclass.m  p14,p15          = f8, 0x07
-          and           pow_GR_exp_X        = pow_GR_signexp_X, pow_GR_17ones
 }
 { .mfi
-          adds          pow_AD_Q       = pow_table_Q - pow_table_P,  pow_AD_P
+          adds          pow_AD_Q        = pow_table_Q - pow_table_P,  pow_AD_P
           nop.f 999
           nop.i 999
 }
 ;;
 
+// p14 = TRUE ==> X is ZERO
 { .mfi
-          ldfe          POW_P5         = [pow_AD_P], 16
-          fcmp.lt.s1 p8,p9 = f8, f0    // Test for x<0
-          shl           pow_GR_offset       = pow_GR_sig_X, 1
+          ldfe          POW_P2          = [pow_AD_Q], 16
+          fclass.m  p14,p0              = f8, 0x07
+          nop.i 999
 }
-{ .mib
-          ldfe          POW_P4         = [pow_AD_Q], 16
-          sub       pow_GR_true_exp_X       = pow_GR_exp_X, pow_GR_16ones
-(p13)     br.cond.spnt L(POW_X_DENORM)
+// Note POW_Xm1 and POW_r1 are used interchangably
+{ .mfb
+          nop.m 999
+(p8)      fnma.s1        POW_Xm1        = POW_Xp1,f1,f0
+(p13)     br.cond.spnt POW_X_DENORM
 }
 ;;
 
-
 // Continue normal and denormal paths here
-L(POW_COMMON):
+POW_COMMON:
 // p11 = TRUE ==> Y is a NAN
 { .mfi
-          ldfe          POW_P3         = [pow_AD_P], 16
-          fclass.m.unc  p11,p0         = f9, 0xc3
-          shr.u     pow_GR_offset           = pow_GR_offset,56
+          and           pow_GR_exp_X    = pow_GR_signexp_X, pow_GR_17ones
+          fclass.m  p11,p0              = f9, 0xc3
+          nop.i 999
 }
 { .mfi
-          ldfe          POW_P2         = [pow_AD_Q], 16
-          nop.f 999
-          nop.i 999
+          nop.m 999
+          fms.s1        POW_r           = POW_B, POW_NORM_X,f1
+          mov pow_GR_y_zero = 0
 }
 ;;
 
+// Get exponent of |x|-1 to use in comparison to 2^-8
+{ .mmi
+          getf.exp  pow_GR_signexp_Xm1  = POW_Xm1
+          sub       pow_GR_true_exp_X   = pow_GR_exp_X, pow_GR_16ones
+          extr.u        pow_GR_offset   = pow_GR_sig_X, 55, 8
+}
+;;
 
-
-// Compute xsq to decide later if |x|=1
-// p11 = TRUE ==> Y is a NaN
 { .mfi
-          setf.sig POW_int_K                = pow_GR_true_exp_X
-(p15)     fms.s1        POW_r          = POW_B, POW_NORM_X,f1
-          shladd pow_AD_Tt = pow_GR_offset, 4, pow_AD_Tt
+          alloc         r32=ar.pfs,2,19,4,0
+          fcvt.fx.s1   POW_int_Y        = POW_NORM_Y
+          shladd pow_AD_Tt = pow_GR_offset, 3, pow_AD_Tt
 }
 { .mfi
-          nop.m 999
-(p8)      fnma.s1        POW_Xm1       = POW_Xp1,f1,f0
+          setf.sig POW_int_K            = pow_GR_true_exp_X
+          nop.f 999
           nop.i 999
 }
 ;;
 
-
-
-// p12 = TRUE ==> X is ZERO and Y is ZERO
+// p12 = TRUE if Y is ZERO
+// Compute xsq to decide later if |x|=1
 { .mfi
-          ldfe          POW_P1         = [pow_AD_P], 16
-(p14)     fclass.m.unc  p12,p0              = f9, 0x07
+          ldfe          POW_P1          = [pow_AD_P], 16
+          fclass.m      p12,p0          = f9, 0x07
           nop.i 999
 }
 { .mfb
-          ldfe          POW_P0         = [pow_AD_Q], 16
+          ldfe          POW_P0          = [pow_AD_Q], 16
           fma.s1        POW_xsq = POW_NORM_X, POW_NORM_X, f0
-(p11)     br.cond.spnt   L(POW_Y_NAN)
+(p11)     br.cond.spnt  POW_Y_NAN       // Branch if y=nan
 }
 ;;
 
-
-.pred.rel "mutex",p8,p9
-// Get exponent of |x|-1 to use in comparison to 2^-8
 { .mmf
-(p8)      getf.exp      pow_GR_signexp_Xm1  = POW_Xp1
-(p9)      getf.exp      pow_GR_signexp_Xm1  = POW_Xm1
-          fcvt.fx.s1   POW_int_Y            = POW_NORM_Y
+          getf.exp  pow_GR_signexp_Y    = POW_NORM_Y
+          ldfd  POW_T                   = [pow_AD_Tt]
+          fma.s1        POW_rsq         = POW_r, POW_r,f0
 }
 ;;
 
-
 // p11 = TRUE ==> X is a NAN
 { .mfi
           ldfpd         POW_log2_hi, POW_log2_lo  = [pow_AD_Q], 16
-          fclass.m.unc  p11,p0              = f8, 0xc3
+          fclass.m      p11,p0          = POW_NORM_X, 0xc3
           nop.i 999
 }
-{ .mib
-          ldfpd  POW_T, POW_Tt              = [pow_AD_Tt], 16
-          nop.i 999
-(p12)     br.cond.spnt L(POW_X_0_Y_0)
-}
-;;
-
-
-// p14 = TRUE ==> X is zero
-//    p15 = TRUE ==> X is zero AND Y is negative
-//    p10 = TRUE ==> X is zero AND Y is >= zero 
 { .mfi
           ldfe          POW_inv_log2_by_128 = [pow_AD_P], 16
-(p14)     fcmp.lt.unc.s1 p15, p10           = f9,f0
-          nop.i 999
+          fma.s1 POW_delta              = f0,f0,f0 // delta=0 in case |x| near 1
+(p12)     mov pow_GR_y_zero = 1
 }
-{ .mfi
-          nop.m 999
-          nop.f 999
-          and       pow_GR_exp_Xm1          = pow_GR_signexp_Xm1, pow_GR_17ones
-} 
 ;;
 
-
-// Determine if we will use the |x| near 1 path (p6) or normal path (p7)
-// p12 = TRUE ==> X is a NAN and Y is a zero
-// p13 = TRUE ==> X is a NAN and Y is anything else
-{ .mfi
-          getf.exp  pow_GR_signexp_Y        = POW_NORM_Y 
-(p11)     fclass.m.unc  p12,p13             = f9, 0x07
-          cmp.lt.unc p6,p7                  = pow_GR_exp_Xm1, pow_GR_FFF7
-}
-{ .mfi
-          ldfpd  POW_Q2, POW_Q3             = [pow_AD_P], 16
-          fma.s1        POW_rsq             = POW_r, POW_r,f0
-          nop.i 999
-;;
-}
-
-// If on the x near 1 path, assign r1 to r and r1*r1 to rsq
 { .mfi
-          ldfpd  POW_Q0_half, POW_Q1             = [pow_AD_P], 16
-(p6)      fma.s1    POW_r                 = POW_r1, f1, f0
-          nop.i 999
+          ldfd   POW_Q2                 = [pow_AD_P], 16
+          fnma.s1 POW_twoV              = POW_r, POW_Q0_half,f1
+          and       pow_GR_exp_Xm1      = pow_GR_signexp_Xm1, pow_GR_17ones
 }
 { .mfi
           nop.m 999
-(p6)      fma.s1    POW_rsq                 = POW_r1, POW_r1, f0
+          fma.s1 POW_U                  = POW_NORM_Y,POW_r,f0
           nop.i 999
-;;
-}
-
-
-{ .mfi
-          ldfpd   POW_Q4, POW_RSHF          = [pow_AD_P], 16
-(p7)      fma.s1 POW_v6                     = POW_r,  POW_P5, POW_P4
-          and pow_GR_exp_Y                   = pow_GR_signexp_Y, pow_GR_17ones
-}
-{ .mfb
-          nop.m 999
-(p6)      fma.s1 POW_v6                     = POW_r1, POW_P5, POW_P4
-(p12)     br.cond.spnt L(POW_X_NAN_Y_0)
 }
 ;;
 
-
+// Determine if we will use the |x| near 1 path (p6) or normal path (p7)
 { .mfi
           nop.m 999
-(p7)      fma.s1 POW_v4                     = POW_P3, POW_r,  POW_P2 
-          andcm pow_GR_sign_Y               = pow_GR_signexp_Y, pow_GR_17ones
+          fcvt.xf POW_K                 = POW_int_K
+          cmp.lt p6,p7                  = pow_GR_exp_Xm1, pow_GR_exp_2tom8
 }
 { .mfb
           nop.m 999
-(p6)      fma.s1 POW_v4                     = POW_P3, POW_r1, POW_P2 
-(p12)     br.cond.spnt L(POW_X_NAN_Y_0)
+          fma.s1 POW_G                  = f0,f0,f0  // G=0 in case |x| near 1
+(p11)     br.cond.spnt  POW_X_NAN       // Branch if x=nan and y not nan
 }
 ;;
 
+// If on the x near 1 path, assign r1 to r
 { .mfi
-          nop.m 999
-          fcvt.xf POW_K                     = POW_int_K
+          ldfpd  POW_Q1, POW_RSHF       = [pow_AD_P], 16
+(p6)      fma.s1    POW_r               = POW_r1, f1, f0
           nop.i 999
 }
 { .mfb
           nop.m 999
-(p13)     fma.s f8                           = f8,f1,f0
-(p13)     br.ret.spnt  b0    // Exit if x nan, y anything but zero
-}
-;;
-          
-// p10 = TRUE ==> X is zero  AND Y is positive
-//  p8  = TRUE ==> X is zero  AND Y is outside integer range (treat as even int)
-//                   return +0
-//  p9  = TRUE ==> X is zero  AND Y is within integer range (may not be integer) 
-{ .mfi
-(p10)     cmp.gt.unc p8,p9                  =  pow_GR_exp_Y, pow_GR_10033
-(p6)      fmerge.s POW_delta                 = f0,f0
-          nop.i 999
-}
-{ .mfi
-          nop.m 999
-(p6)      fma.s1 POW_G                       = f0,f0,f0
-          nop.i 999
+(p6)      fma.s1    POW_rsq             = POW_r1, POW_r1, f0
+(p14)     br.cond.spnt POW_X_0          // Branch if x zero and y not nan
 }
 ;;
 
 { .mfi
-          getf.sig pow_GR_sig_int_Y         = POW_int_Y
-          fnma.s1 POW_twoV                   = POW_NORM_Y, POW_rsq,f0
-          nop.i 999
+          getf.sig pow_GR_sig_int_Y     = POW_int_Y
+(p6)      fnma.s1 POW_twoV              = POW_r1, POW_Q0_half,f1
+          and pow_GR_exp_Y              = pow_GR_signexp_Y, pow_GR_17ones
 }
-{ .mfi
-          nop.m 999
-          fma.s1 POW_U                      = POW_NORM_Y,POW_r,f0
-          nop.i 999
+{ .mfb
+          andcm pow_GR_sign_Y           = pow_GR_signexp_Y, pow_GR_17ones
+(p6)      fma.s1 POW_U                  = POW_NORM_Y,POW_r1,f0
+(p12)     br.cond.spnt POW_Y_0   // Branch if y=zero, x not zero or nan
 }
 ;;
 
 { .mfi
-          ldfe      POW_log2_by_128_lo      = [pow_AD_P], 16
-(p6)      fma.s1 POW_v2                     = POW_P1, POW_r1, POW_P0 
+          ldfe      POW_log2_by_128_lo  = [pow_AD_P], 16
+(p7)      fma.s1 POW_Z2                 = POW_twoV, POW_U, f0
           nop.i 999
 }
 { .mfi
-          ldfe          POW_log2_by_128_hi  = [pow_AD_Q], 16
-(p7)      fma.s1 POW_v2                     = POW_P1, POW_r,  POW_P0 
+          ldfe      POW_log2_by_128_hi  = [pow_AD_Q], 16
+          nop.f 999
           nop.i 999
 }
 ;;
 
-
 { .mfi
           nop.m 999
-          fcvt.xf   POW_float_int_Y               = POW_int_Y
+          fcvt.xf   POW_float_int_Y     = POW_int_Y
           nop.i 999
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_v3                     = POW_v6, POW_rsq,  POW_v4 
-          adds          pow_AD_tbl1       = pow_tbl1 - pow_Tt,  pow_AD_Q
+(p7)      fma.s1 POW_G                  = POW_K, POW_log2_hi, POW_T
+          adds          pow_AD_tbl1     = pow_tbl1 - pow_Tt,  pow_AD_Q
 }
 ;;
 
+// p11 = TRUE ==> X is NEGATIVE but not inf
 { .mfi
           nop.m 999
-(p7)      fma.s1 POW_delta                  = POW_K, POW_log2_lo, POW_Tt
+          fclass.m  p11,p0              = POW_NORM_X, 0x1a
           nop.i 999
 }
 { .mfi
           nop.m 999
-(p7)      fma.s1 POW_G                      = POW_K, POW_log2_hi, POW_T 
-          adds pow_AD_tbl2                  = pow_tbl2 - pow_tbl1,  pow_AD_tbl1
+(p7)      fma.s1 POW_delta              = POW_K, POW_log2_lo, f0
+          adds pow_AD_tbl2              = pow_tbl2 - pow_tbl1,  pow_AD_tbl1
 }
 ;;
 
-
 { .mfi
           nop.m 999
-          fms.s1 POW_e2                     = POW_NORM_Y, POW_r, POW_U
+(p6)      fma.s1 POW_Z                  = POW_twoV, POW_U, f0
           nop.i 999
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_Z2                     = POW_twoV, POW_Q0_half, POW_U
-          nop.i 999
-}
-;;
-
-// p11 = TRUE ==> X is NEGATIVE 
-// p8  = TRUE ==> X is zero  AND Y is outside intger range (treat as even int)
-//                return +0
-{ .mfi
-          nop.m 999
-          fclass.m.unc  p11,p0              = f8, 0x1a
-          nop.i 999
-}
-{ .mfb
-          nop.m 999
-(p8)      fma.s f8                          = f0,f0,f0
-(p8)      br.ret.spnt b0
-}
-;;
-
-{ .mfi 
-          nop.m 999
-          fma.s1 POW_Yrcub                 = POW_rsq, POW_U, f0
-          nop.i 999
-}
-{ .mfi 
-          nop.m 999
-          fma.s1 POW_p                      = POW_rsq, POW_v3, POW_v2
+          fma.s1 POW_v2                 = POW_P1, POW_r,  POW_P0
           nop.i 999
 }
 ;;
 
-
-// p11 = TRUE ==> X is NEGATIVE
-//    p12 = TRUE ==> X is NEGATIVE  AND  Y  already int
+// p11 = TRUE ==> X is NEGATIVE but not inf
+//    p12 = TRUE ==> X is NEGATIVE  AND  Y  already even int
 //    p13 = TRUE ==> X is NEGATIVE  AND  Y possible int
 { .mfi
           nop.m 999
-          fma.s1 POW_Z1                     = POW_NORM_Y, POW_G, f0
-(p11)     cmp.ge.unc  p12,p13                = pow_GR_exp_Y, pow_GR_10033
+(p7)      fma.s1 POW_Z                  = POW_NORM_Y, POW_G, POW_Z2
+(p11)     cmp.gt.unc  p12,p13           = pow_GR_exp_Y, pow_GR_10033
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_e3                     = POW_NORM_Y, POW_delta, f0
+          fma.s1 POW_Gpr                = POW_G, f1, POW_r
           nop.i 999
 }
 ;;
 
-// p9  = TRUE ==> X is zero  AND Y is within integer range (may not be integer)
-//    p6 = TRUE ==>  X is zero  AND  Y is an integer (may be even or odd)
-//    p7 = TRUE ==>  X is zero  AND  Y is NOT an integer, return +0
 { .mfi
           nop.m 999
-(p9)      fcmp.eq.unc.s1 p6,p7             = POW_float_int_Y,  POW_NORM_Y
+          fma.s1 POW_Yrcub              = POW_rsq, POW_U, f0
           nop.i 999
 }
-{ .mfi 
+{ .mfi
           nop.m 999
-          fma.s1 POW_Gpr                    = POW_G, f1, POW_r
+          fma.s1 POW_p                  = POW_rsq, POW_P2, POW_v2
           nop.i 999
 }
 ;;
 
-// By adding RSHF (1.1000...*2^63) we put integer part in rightmost significand
+// Test if x inf
 { .mfi
           nop.m 999
-          fma.s1 POW_W2  = POW_Z2, POW_inv_log2_by_128, POW_RSHF
+          fclass.m p15,p0 = POW_NORM_X,  0x23
           nop.i 999
 }
+// By adding RSHF (1.1000...*2^63) we put integer part in rightmost significand
 { .mfi
           nop.m 999
-          fms.s1 POW_UmZ2                   = POW_U, f1, POW_Z2
+          fma.s1 POW_W1  = POW_Z, POW_inv_log2_by_128, POW_RSHF
           nop.i 999
 }
 ;;
 
-
-// If x=0 and y>0, test y and flag denormal
-// p6  = TRUE ==>  X is zero  AND  Y is an integer (may be even or odd)
-//    p8 = TRUE ==>  X is zero  AND  Y is an odd  integer
-//    p9 = TRUE ==>  X is zero  AND  Y is an even integer
+// p13 = TRUE ==> X is NEGATIVE  AND  Y possible int
+//     p10 = TRUE ==> X is NEG and Y is an int
+//     p12 = TRUE ==> X is NEG and Y is not an int
 { .mfi
           nop.m 999
-(p10)     fcmp.eq.s0 p15,p0 = f9,f0
-(p6)      tbit.nz.unc  p8,p9                = pow_GR_sig_int_Y,0
+(p13)     fcmp.eq.unc.s1 p10,p12        = POW_float_int_Y,  POW_NORM_Y
+          mov pow_GR_xneg_yodd = 0
 }
 { .mfi
           nop.m 999
-          fma.s1 POW_Z3                      = POW_p, POW_Yrcub, f0
+          fma.s1 POW_Y_Gpr              = POW_NORM_Y, POW_Gpr, f0
           nop.i 999
 }
 ;;
 
-// By adding RSHF (1.1000...*2^63) we put integer part in rightmost significand
-{ .mfi
-          nop.m 999
-          fms.s1 POW_e1                     = POW_NORM_Y, POW_G, POW_Z1
-          nop.i 999
-}
+// p11 = TRUE ==> X is +1.0
 { .mfi
           nop.m 999
-          fma.s1 POW_W1  = POW_Z1, POW_inv_log2_by_128, POW_RSHF
+          fcmp.eq.s1 p11,p0 = POW_NORM_X, f1
           nop.i 999
 }
 ;;
 
+// Extract rounded integer from rightmost significand of POW_W1
+// By subtracting RSHF we get rounded integer POW_Nfloat
 { .mfi
-          nop.m 999
-(p7)      fma.s f8  = f0,f0,f0  // Result +0 if x zero and y not integer
+          getf.sig pow_GR_int_N        = POW_W1
+          fms.s1 POW_Nfloat  = POW_W1, f1, POW_RSHF
           nop.i 999
 }
 { .mfb
           nop.m 999
-          fma.s1 POW_Y_Gpr                  = POW_NORM_Y, POW_Gpr, f0
-(p8)      br.ret.spnt b0        // Exit if x zero and y odd integer
+          fma.s1 POW_Z3                 = POW_p, POW_Yrcub, f0
+(p12)     br.cond.spnt POW_X_NEG_Y_NONINT  // Branch if x neg, y not integer
 }
 ;;
 
-// By subtracting RSHF we get rounded integer POW_N2float
-// p15 = TRUE ==> X_0_Y_NEG
+// p7  = TRUE ==> Y is +1.0
+// p12 = TRUE ==> X is NEGATIVE  AND Y is an odd integer
 { .mfi
-          nop.m 999
-          fms.s1 POW_N2float  = POW_W2, f1, POW_RSHF
-          nop.i 999
+          getf.exp pow_GR_signexp_Y_Gpr = POW_Y_Gpr
+          fcmp.eq.s1 p7,p0 = POW_NORM_Y, f1  // Test for y=1.0
+(p10)     tbit.nz.unc  p12,p0           = pow_GR_sig_int_Y,0
 }
 { .mfb
           nop.m 999
-          fma.s1 POW_UmZ2pV                 = POW_twoV,POW_Q0_half,POW_UmZ2
-(p15)     br.cond.spnt L(POW_X_0_Y_NEG)
+(p11)     fma.s.s0 f8 = f1,f1,f0    // If x=1, result is +1
+(p15)     br.cond.spnt POW_X_INF
 }
 ;;
 
-
-
+// Test x and y and flag denormal
 { .mfi
           nop.m 999
-          fma.s1 POW_Z3sq                   = POW_Z3, POW_Z3, f0
+          fcmp.eq.s0 p15,p0 = f8,f9
           nop.i 999
 }
 { .mfb
           nop.m 999
-          fma.s1 POW_v4                     = POW_Z3, POW_Q3, POW_Q2
-(p7)      br.ret.spnt b0     // Exit if x zero and y not an integer
+          fma.s1 POW_e3                 = POW_NORM_Y, POW_delta, f0
+(p11)     br.ret.spnt b0            // Early exit if x=1.0, result is +1
 }
 ;;
 
-
-
-// Extract rounded integer from rightmost significand of POW_W2
-// By subtracting RSHF we get rounded integer POW_N1float
 { .mfi
-          getf.sig pow_GR_int_W2             = POW_W2
-          fms.s1 POW_N1float  = POW_W1, f1, POW_RSHF
+(p12)     mov pow_GR_xneg_yodd = 1
+          fnma.s1 POW_f12  = POW_Nfloat, POW_log2_by_128_lo, f1
           nop.i 999
 }
-{ .mfi
+{ .mfb
           nop.m 999
-          fma.s1 POW_v2                     = POW_Z3, POW_Q1, POW_Q0_half
-          nop.i 999
+          fnma.s1 POW_s  = POW_Nfloat, POW_log2_by_128_hi, POW_Z
+(p7)      br.ret.spnt b0        // Early exit if y=1.0, result is x
 }
 ;;
 
-
-
-
-// p13 = TRUE ==> X is NEGATIVE  AND  Y possible int
-//     p10 = TRUE ==> X is NEG and Y is an int
-//     p12 = TRUE ==> X is NEG and Y is not an int
-{ .mfi
-          nop.m 999
-(p13)     fcmp.eq.unc.s1 p10,p12             = POW_float_int_Y,  POW_NORM_Y
-          nop.i 999
-}
-{ .mfb
-          nop.m 999
-(p9)      fma.s f8  = f0,f0,f0   // Result +0 if x zero and y even integer
-(p9)      br.ret.spnt b0    // Exit if x zero and y even integer
+{ .mmi
+          and pow_GR_index1             = 0x0f, pow_GR_int_N
+          and pow_GR_index2             = 0x70, pow_GR_int_N
+          shr pow_int_GR_M              = pow_GR_int_N, 7    // M = N/128
 }
 ;;
 
-
 { .mfi
-          nop.m 999
-          fnma.s1 POW_s2 = POW_N2float, POW_log2_by_128_hi, POW_Z2
-          nop.i 999
+          shladd pow_AD_T1              = pow_GR_index1, 4, pow_AD_tbl1
+          fma.s1 POW_q                  = POW_Z3, POW_Q1, POW_Q0_half
+          add pow_int_GR_M              = pow_GR_16ones, pow_int_GR_M
 }
 { .mfi
-          nop.m 999
-          fma.s1 POW_e2                     = POW_e2,f1,POW_UmZ2pV
+          add pow_AD_T2                 = pow_AD_tbl2, pow_GR_index2
+          fma.s1 POW_Z3sq               = POW_Z3, POW_Z3, f0
           nop.i 999
 }
 ;;
 
-// Extract rounded integer from rightmost significand of POW_W1
-// Test if x inf
-{ .mfi
-          getf.sig pow_GR_int_W1             = POW_W1
-          fclass.m.unc p15,p0 = POW_NORM_X,  0x23
+{ .mmi
+          ldfe POW_T1                   = [pow_AD_T1]
+          ldfe POW_T2                   = [pow_AD_T2]
           nop.i 999
 }
-{ .mfb
-          nop.m 999
-          fnma.s1 POW_f2  = POW_N2float, POW_log2_by_128_lo, f1
-(p12)     br.cond.spnt L(POW_X_NEG_Y_NONINT)  // Branch if x neg, y not integer
-}
 ;;
 
-// p12 = TRUE ==> X is NEGATIVE  AND Y is an odd integer
+// f123 = f12*(e3+1) = f12*e3+f12
 { .mfi
-          getf.exp pow_GR_signexp_Y_Gpr       = POW_Y_Gpr
-          fma.s1 POW_v3                     = POW_Z3sq, POW_Q4, POW_v4
-(p10)     tbit.nz.unc  p12,p0                = pow_GR_sig_int_Y,0
-}
-;;
-
-
-{ .mfi
-          add pow_GR_int_N                   = pow_GR_int_W1, pow_GR_int_W2
-          fnma.s1 POW_f1  = POW_N1float, POW_log2_by_128_lo, f1
+          setf.exp POW_2M               = pow_int_GR_M
+          fma.s1 POW_f123               = POW_e3,POW_f12,POW_f12
           nop.i 999
 }
-{ .mfb
+{ .mfi
           nop.m 999
-          fnma.s1 POW_s1  = POW_N1float, POW_log2_by_128_hi, POW_Z1
-(p15)     br.cond.spnt L(POW_X_INF)
+          fma.s1 POW_ssq                = POW_s, POW_s, f0
+          nop.i 999
 }
 ;;
 
-
-// Test x and y and flag denormal
-{ .mfi
-          and pow_GR_index1                  = 0x0f, pow_GR_int_N
-          fcmp.eq.s0 p15,p0 = f8,f9
-          shr r2                             = pow_GR_int_N, 7
-}
 { .mfi
-          and pow_GR_exp_Y_Gpr               = pow_GR_signexp_Y_Gpr, pow_GR_17ones
-          nop.f 999
-          and pow_GR_index2                  = 0x70, pow_GR_int_N
+          nop.m 999
+          fma.s1 POW_v2                 = POW_s, POW_Q2, POW_Q1
+          and pow_GR_exp_Y_Gpr          = pow_GR_signexp_Y_Gpr, pow_GR_17ones
 }
 ;;
 
-
-
-{ .mfi
-          shladd pow_AD_T1                   = pow_GR_index1, 4, pow_AD_tbl1
-          fcmp.eq.s1 p7,p0 = POW_NORM_Y, f1  // Test for y=1.0
-          sub pow_GR_true_exp_Y_Gpr          = pow_GR_exp_Y_Gpr, pow_GR_16ones
-}
 { .mfi
-          addl pow_int_GR_M                  = 0xFFFF, r2
-          fma.s1  POW_e12                     = POW_e1,f1,POW_e2
-          add pow_AD_T2                      = pow_AD_tbl2, pow_GR_index2
+          cmp.ne p12,p13 = pow_GR_xneg_yodd, r0
+          fma.s1 POW_q                  = POW_Z3sq, POW_q, POW_Z3
+          sub pow_GR_true_exp_Y_Gpr     = pow_GR_exp_Y_Gpr, pow_GR_16ones
 }
 ;;
 
+// p8 TRUE ==> |Y(G + r)| >= 7
 
-{ .mmi
-          ldfe POW_T1                        = [pow_AD_T1],16
-          setf.exp POW_2M                    = pow_int_GR_M
-          andcm pow_GR_sign_Y_Gpr            = pow_GR_signexp_Y_Gpr, pow_GR_17ones
-}
-;;
-
-
-{ .mfb
-          ldfe POW_T2                        = [pow_AD_T2],16
-          fma.s1 POW_q                       = POW_Z3sq, POW_v3, POW_v2
-(p7)      br.ret.spnt b0        // Early exit if y=1.0, result is x
-}
-;;
-
-
-// double: p8 TRUE ==> |Y(G + r)| >= 10
-// single: p8 TRUE ==> |Y(G + r)| >= 7
-
-// double
-//     -2^10  -2^9             2^9   2^10
-// -----+-----+----+ ... +-----+-----+-----
-//  p8  |             p9             |  p8
-//      |     |       p10      |     |  
 // single
 //     -2^7   -2^6             2^6   2^7
 // -----+-----+----+ ... +-----+-----+-----
 //  p8  |             p9             |  p8
 //      |     |       p10      |     |
 
-
-{ .mfi
-(p0)      cmp.le.unc p8,p9                   = 7, pow_GR_true_exp_Y_Gpr
-          fma.s1 POW_s                       = POW_s1, f1, POW_s2
-          nop.i 999
-}
-{ .mfi
-          nop.m 999
-          fma.s1 POW_f12                     = POW_f1, POW_f2,f0
-          nop.i 999
-}
-;;
-
-
+// Form signexp of constants to indicate overflow
 { .mfi
+          mov         pow_GR_big_pos    = 0x1007f
           nop.f 999
-(p9)      cmp.le.unc p0,p10                  = 6, pow_GR_true_exp_Y_Gpr
+          cmp.le p8,p9                  = 7, pow_GR_true_exp_Y_Gpr
 }
-;;
-
-
-
-{ .mfb
-          nop.m 999
-          fma.s1 POW_e123                    = POW_e12, f1, POW_e3
-(p8)      br.cond.spnt L(POW_OVER_UNDER_X_NOT_INF)
-}
-;;
-
-
-{ .mmf
-          fma.s1 POW_q                       = POW_Z3sq, POW_q, POW_Z3
-}
-;;
-
-
-{ .mfi
-          nop.m 999 
-          fma.s1 POW_ssq                     = POW_s, POW_s, f0
-          nop.i 999
-}
-{ .mfi
-          nop.m 999 
-          fma.s1 POW_v4                      = POW_s, POW_Q3, POW_Q2
-          nop.i 999
-}
-;;
-
 { .mfi
-          nop.m 999
-          fma.s1 POW_v2                      = POW_s, POW_Q1, POW_Q0_half
-          nop.i 999
-}
-{ .mfi
-          nop.m 999
-          fma.s1 POW_1ps                     = f1,f1,POW_s
-          nop.i 999
-}
-;;
-
-{ .mfi
-          nop.m 999
-          fma.s1 POW_f3                      = POW_e123,f1,f1
-          nop.i 999
-}
-;;
-
-{ .mfi
-          nop.m 999
-          fma.s1 POW_T1T2                    = POW_T1, POW_T2, f0
-          nop.i 999
-}
-;;
-
-{ .mfi
-          nop.m 999
-          fma.s1 POW_v3                     = POW_ssq, POW_Q4, POW_v4
-          nop.i 999
+          mov         pow_GR_big_neg    = 0x3007f
+          nop.f 999
+          andcm pow_GR_sign_Y_Gpr       = pow_GR_signexp_Y_Gpr, pow_GR_17ones
 }
 ;;
 
+// Form big positive and negative constants to test for possible overflow
+// Scale both terms of the polynomial by POW_f123
 { .mfi
-          nop.m 999
-          fma.s1 POW_v21ps                  = POW_ssq, POW_v2, POW_1ps
-          nop.i 999
+          setf.exp POW_big_pos          = pow_GR_big_pos
+          fma.s1 POW_ssq                = POW_ssq, POW_f123, f0
+(p9)      cmp.le.unc p0,p10             = 6, pow_GR_true_exp_Y_Gpr
 }
-{ .mfi
-          nop.m 999
-          fma.s1 POW_s4                     = POW_ssq, POW_ssq, f0
-          nop.i 999
+{ .mfb
+          setf.exp POW_big_neg          = pow_GR_big_neg
+          fma.s1 POW_1ps                = POW_s, POW_f123, POW_f123
+(p8)      br.cond.spnt POW_OVER_UNDER_X_NOT_INF
 }
 ;;
 
 { .mfi
           nop.m 999
-          fma.s1 POW_f123                    = POW_f12, POW_f3, f0
+(p12)     fnma.s1 POW_T1T2              = POW_T1, POW_T2, f0
           nop.i 999
 }
-;;
-
 { .mfi
           nop.m 999
-          fma.s1 POW_A                      =  POW_2M, POW_T1T2, f0
+(p13)     fma.s1 POW_T1T2               = POW_T1, POW_T2, f0
           nop.i 999
 }
 ;;
 
-
-
-{ .mfi
-          nop.m 999
-(p12)     fmerge.s POW_f123 = f8,POW_f123  // if x neg, y odd int
-          nop.i 999
-}
 { .mfi
           nop.m 999
-//          fma.s1 POW_es                     = POW_ssq,  POW_v3, POW_v2
+          fma.s1 POW_v210               = POW_s, POW_v2, POW_Q0_half
           nop.i 999
 }
-;;
-
 { .mfi
           nop.m 999
-          fma.s1 POW_es                     = POW_s4,  POW_v3, POW_v21ps
+          fma.s1 POW_2Mqp1              = POW_2M, POW_q, POW_2M
           nop.i 999
 }
 ;;
 
-
 { .mfi
           nop.m 999
-          fma.s1 POW_A                      = POW_A, POW_f123, f0
+          fma.s1 POW_es                 = POW_ssq, POW_v210, POW_1ps
           nop.i 999
 }
 { .mfi
           nop.m 999
-//          fma.s1 POW_es                     = POW_es, POW_ssq, POW_1ps
+          fma.s1 POW_A                  = POW_T1T2, POW_2Mqp1, f0
           nop.i 999
 }
 ;;
 
-
+// Dummy op to set inexact
 { .mfi
           nop.m 999
-          fma.s1 POW_A                      = POW_A, POW_es,f0
+          fma.s0 POW_tmp                = POW_2M, POW_q, POW_2M
           nop.i 999
 }
 ;;
 
-
-
 { .mfb
           nop.m 999
-(p10)     fma.s f8                          = POW_A, POW_q, POW_A
-(p10)     br.ret.sptk     b0
+          fma.s.s0 f8                   = POW_A, POW_es, f0
+(p10)     br.ret.sptk     b0            // Exit main branch if no over/underflow
 }
 ;;
 
-
-
-
-
 // POSSIBLE_OVER_UNDER
-// p6 = TRUE ==> Y negative
+// p6 = TRUE ==> Y_Gpr negative
+// Result is already computed.  We just need to know if over/underflow occurred.
 
-{ .mfi
-        nop.m 999
-        fmerge.s POW_abs_A                = f0, POW_A
-        cmp.eq.unc p0,p6                  = pow_GR_sign_Y, r0
-}
-;;
-
-{ .mib
-        nop.m 999
-        nop.i 999
-(p6)    br.cond.spnt L(POW_POSSIBLE_UNDER) 
+{ .mfb
+        cmp.eq p0,p6                    = pow_GR_sign_Y_Gpr, r0
+        nop.f 999
+(p6)    br.cond.spnt POW_POSSIBLE_UNDER
 }
 ;;
 
 // POSSIBLE_OVER
-// We got an answer. 
+// We got an answer.
 // overflow is a possibility, not a certainty
 
 
@@ -1692,21 +1402,20 @@ L(POW_COMMON):
 //                  RN         RN
 //                             RZ
 
-
 // Put in s2 (td set, wre set)
 { .mfi
-        mov           pow_GR_gt_ln                 = 0x1007f 
+        nop.m 999
         fsetc.s2 0x7F,0x42
-        nop.i 999 
+        nop.i 999
 }
 ;;
 
-
 { .mfi
-        setf.exp POW_gt_pln                        = pow_GR_gt_ln
-        fma.s.s2 POW_wre_urm_f8                    = POW_abs_A, POW_q, POW_abs_A
-        nop.i 999 ;;
+        nop.m 999
+        fma.s.s2 POW_wre_urm_f8         = POW_A, POW_es, f0
+        nop.i 999
 }
+;;
 
 // Return s2 to default
 { .mfi
@@ -1716,31 +1425,30 @@ L(POW_COMMON):
 }
 ;;
 
-
 // p7 = TRUE ==> yes, we have an overflow
 { .mfi
         nop.m 999
-        fcmp.ge.unc.s1 p7, p0                    =  POW_wre_urm_f8, POW_gt_pln
+        fcmp.ge.s1 p7, p8               =  POW_wre_urm_f8, POW_big_pos
         nop.i 999
 }
 ;;
 
-
-
-{ .mfb
-(p7)   mov pow_GR_tag                            = 30
-       fma.s f8                                  = POW_A, POW_q, POW_A
-(p7)   br.cond.spnt __libm_error_region 
+{ .mfi
+        nop.m 999
+(p8)    fcmp.le.s1 p7, p0               =  POW_wre_urm_f8, POW_big_neg
+        nop.i 999
 }
-{ .mfb
-       nop.m 999
-       nop.f 999
-(p0)   br.ret.sptk     b0 
+;;
+
+{ .mbb
+(p7)   mov pow_GR_tag                   = 30
+(p7)   br.cond.spnt __libm_error_region // Branch if overflow
+       br.ret.sptk     b0               // Exit if did not overflow
 }
 ;;
 
 
-L(POW_POSSIBLE_UNDER):
+POW_POSSIBLE_UNDER:
 // We got an answer. input was < -2^9 but > -2^10 (double)
 // We got an answer. input was < -2^6 but > -2^7  (float)
 // underflow is a possibility, not a certainty
@@ -1763,373 +1471,437 @@ L(POW_POSSIBLE_UNDER):
 //   0.1...11 2^-3ffe                                   (biased, 1)
 //    largest dn                               smallest normal
 
+// Form small constant (2^-170) to correct underflow result near region of 
+// smallest denormal in round-nearest.
 
 // Put in s2 (td set, ftz set)
+.pred.rel "mutex",p12,p13
 { .mfi
-        nop.m 999
+        mov pow_GR_Fpsr = ar40          // Read the fpsr--need to check rc.s0
         fsetc.s2 0x7F,0x41
-        nop.i 999 
+        mov pow_GR_rcs0_mask            = 0x0c00 // Set mask for rc.s0
+}
+{ .mfi
+(p12)   mov pow_GR_tmp                  = 0x2ffff - 170 
+        nop.f 999
+(p13)   mov pow_GR_tmp                  = 0x0ffff - 170 
 }
 ;;
 
-
-
 { .mfi
-        nop.m 999
-        fma.s.s2 POW_ftz_urm_f8                    = POW_A, POW_q, POW_A
+        setf.exp POW_eps                = pow_GR_tmp        // Form 2^-170
+        fma.s.s2 POW_ftz_urm_f8         = POW_A, POW_es, f0
         nop.i 999
 }
 ;;
 
-
 // Return s2 to default
 { .mfi
         nop.m 999
         fsetc.s2 0x7F,0x40
-        nop.i 999 
+        nop.i 999
 }
 ;;
 
-
 // p7 = TRUE ==> yes, we have an underflow
 { .mfi
         nop.m 999
-        fcmp.eq.unc.s1 p7, p0                     =  POW_ftz_urm_f8, f0
-        nop.i 999 
+        fcmp.eq.s1 p7, p0               =  POW_ftz_urm_f8, f0
+        nop.i 999
 }
 ;;
 
-
-
-
-{ .mfb
-(p7)    mov pow_GR_tag                           = 31
-        fma.s f8                                 = POW_A, POW_q, POW_A
-(p7)    br.cond.spnt __libm_error_region 
+{ .mmi
+(p7)    and pow_GR_rcs0  = pow_GR_rcs0_mask, pow_GR_Fpsr  // Isolate rc.s0
+;;
+(p7)    cmp.eq.unc p6,p0 = pow_GR_rcs0, r0    // Test for round to nearest
+        nop.i 999
 }
 ;;
 
-
-{ .mfb
+// Tweak result slightly if underflow to get correct rounding near smallest
+// denormal if round-nearest
+{ .mfi
         nop.m 999
-        nop.f 999
-        br.ret.sptk     b0 
+(p6)    fms.s.s0 f8                     = POW_A, POW_es, POW_eps
+        nop.i 999
+}
+{ .mbb
+(p7)    mov pow_GR_tag                  = 31
+(p7)    br.cond.spnt __libm_error_region // Branch if underflow
+        br.ret.sptk     b0               // Exit if did not underflow
 }
 ;;
 
-
-L(POW_X_DENORM):
-// Here if x unorm. Use the NORM_X for getf instructions, and the back
+POW_X_DENORM:
+// Here if x unorm. Use the NORM_X for getf instructions, and then back
 // to normal path
 { .mfi
-        getf.exp      pow_GR_signexp_X    = POW_NORM_X
+        getf.exp      pow_GR_signexp_X  = POW_NORM_X
         nop.f 999
         nop.i 999
 }
 ;;
 
-{ .mfi
-        getf.sig      pow_GR_sig_X        = POW_NORM_X
-        nop.f 999
+{ .mib
+        getf.sig      pow_GR_sig_X      = POW_NORM_X
         nop.i 999
+        br.cond.sptk    POW_COMMON
 }
 ;;
 
+POW_X_0:
+// Here if x=0 and y not nan
+//
+// We have the following cases:
+//  p6  x=0  and  y>0 and is an integer (may be even or odd)
+//  p7  x=0  and  y>0 and is NOT an integer, return +0
+//  p8  x=0  and  y>0 and so big as to always be an even integer, return +0
+//  p9  x=0  and  y>0 and may not be integer
+//  p10 x=0  and  y>0 and is an odd  integer, return x
+//  p11 x=0  and  y>0 and is an even integer, return +0
+//  p12 used in dummy fcmp to set denormal flag if y=unorm
+//  p13 x=0  and  y>0
+//  p14 x=0  and  y=0, branch to code for calling error handling
+//  p15 x=0  and  y<0, branch to code for calling error handling
+//
 { .mfi
-        and           pow_GR_exp_X        = pow_GR_signexp_X, pow_GR_17ones
-        nop.f 999
+        getf.sig pow_GR_sig_int_Y = POW_int_Y // Get signif of int_Y
+        fcmp.lt.s1 p15,p13 = f9, f0           // Test for y<0
+        and pow_GR_exp_Y = pow_GR_signexp_Y, pow_GR_17ones
+}
+{ .mfb
+        cmp.ne p14,p0 = pow_GR_y_zero,r0      // Test for y=0
+        fcvt.xf   POW_float_int_Y = POW_int_Y
+(p14)   br.cond.spnt POW_X_0_Y_0              // Branch if x=0 and y=0
 }
 ;;
 
-{ .mib
-        sub       pow_GR_true_exp_X       = pow_GR_exp_X, pow_GR_16ones
-        shl           pow_GR_offset       = pow_GR_sig_X, 1
-        br.cond.sptk    L(POW_COMMON)
+// If x=0 and y>0, test y and flag denormal
+{ .mfb
+(p13)   cmp.gt.unc p8,p9 = pow_GR_exp_Y, pow_GR_10033 // Test y +big = even int
+(p13)   fcmp.eq.s0 p12,p0 = f9,f0    // If x=0, y>0 dummy op to flag denormal
+(p15)   br.cond.spnt POW_X_0_Y_NEG // Branch if x=0 and y<0
 }
 ;;
 
+// Here if x=0 and y>0
+{ .mfi
+        nop.m 999
+(p9)    fcmp.eq.unc.s1 p6,p7 = POW_float_int_Y,  POW_NORM_Y // Test y=int
+        nop.i 999
+}
+{ .mfi
+        nop.m 999
+(p8)    fma.s.s0 f8 = f0,f0,f0 // If x=0, y>0 and large even int, return +0
+        nop.i 999
+}
+;;
 
-L(POW_X_0_Y_0):
-// When X is +-0 and Y is +-0, IEEE returns 1.0 
-// We call error support with this value 
+{ .mfi
+        nop.m 999
+(p7)    fma.s.s0 f8  = f0,f0,f0   // Result +0 if x=0 and y>0 and not integer
+(p6)    tbit.nz.unc p10,p11 = pow_GR_sig_int_Y,0 // If y>0 int, test y even/odd
+}
+;;
 
+// Note if x=0, y>0 and odd integer, just return x
 { .mfb
-         mov pow_GR_tag                     = 32
-         fma.s f8                           = f1,f1,f0
-         br.cond.sptk __libm_error_region
+        nop.m 999
+(p11)   fma.s.s0 f8  = f0,f0,f0   // Result +0 if x=0 and y even integer
+        br.ret.sptk b0            // Exit if x=0 and y>0
 }
 ;;
 
+POW_X_0_Y_0:
+// When X is +-0 and Y is +-0, IEEE returns 1.0
+// We call error support with this value
 
+{ .mfb
+        mov pow_GR_tag                  = 32
+        fma.s.s0 f8                     = f1,f1,f0
+        br.cond.sptk __libm_error_region
+}
+;;
 
+POW_X_0_Y_NEG:
+// When X is +-0 and Y is negative, IEEE returns
+// X     Y           answer
+// +0    -odd int    +inf
+// -0    -odd int    -inf
 
-L(POW_X_INF):
-// When X is +-inf and Y is +-, IEEE returns 
-
-// overflow                       
-// X +inf  Y +inf             +inf  
-// X -inf  Y +inf             +inf 
-
-// X +inf  Y >0               +inf    
-// X -inf  Y >0, !odd integer +inf     <== (-inf)^0.5 = +inf !!
-// X -inf  Y >0,  odd integer  -inf   
-
-// underflow                     
-// X +inf  Y -inf             +0   
-// X -inf  Y -inf             +0  
-
-// X +inf  Y <0               +0      
-// X -inf  Y <0, !odd integer +0     
-// X -inf  Y <0, odd integer  -0    
-
-// X + inf Y=+0                +1
-// X + inf Y=-0                +1
-// X - inf Y=+0                +1
-// X - inf Y=-0                +1
-
-// p13 == Y negative
-// p14 == Y positive
+// +0    !-odd int   +inf
+// -0    !-odd int   +inf
 
 // p6 == Y is a floating point number outside the integer.
 //       Hence it is an integer and is even.
-//       p13 == (Y negative) 
-//          return +inf
-//       p14 == (Y positive)
-//          return +0
-
-
+//       return +inf
 
 // p7 == Y is a floating point number within the integer range.
 //      p9  == (int_Y = NORM_Y), Y is an integer, which may be odd or even.
 //           p11 odd
-//              p13 == (Y negative)    
-//                 return (sign_of_x)inf
-//              p14 == (Y positive) 
-//                 return (sign_of_x)0
-//           pxx even                
-//              p13 == (Y negative) 
-//                 return +inf     
-//              p14 == (Y positive)
-//                 return +0     
-
-//      pxx == Y is not an integer
-//           p13 == (Y negative) 
-//                 return +inf
-//           p14 == (Y positive)
-//                 return +0
-// 
+//              return (sign_of_x)inf
+//           p12 even
+//              return +inf
+//      p10 == Y is not an integer
+//         return +inf
+//
 
-// If x=inf, test y and flag denormal
 { .mfi
           nop.m 999
-          fcmp.eq.s0 p10,p11 = f9,f0
-          nop.i 999
+          nop.f 999
+          cmp.gt  p6,p7                 = pow_GR_exp_Y, pow_GR_10033
 }
 ;;
 
 { .mfi
-          nop.m 999
-          fcmp.lt p13,p14                    = POW_NORM_Y,f0 
-          cmp.gt.unc  p6,p7                  = pow_GR_exp_Y, pow_GR_10033
-}
-{ .mfi
-          nop.m 999
-          fclass.m p12,p0                    = f9, 0x23
+          mov pow_GR_tag                = 33
+(p7)      fcmp.eq.unc.s1 p9,p10         = POW_float_int_Y,  POW_NORM_Y
           nop.i 999
 }
 ;;
 
-
-{ .mfi
+{ .mfb
           nop.m 999
-          fclass.m p15,p0                    = f9, 0x07	//@zero
-          nop.i 999
+(p6)      frcpa.s0 f8,p13               = f1, f0
+(p6)      br.cond.sptk __libm_error_region   // x=0, y<0, y large neg int
 }
 ;;
 
 { .mfb
           nop.m 999
-(p15)     fmerge.s f8 = f1,f1
-(p15)     br.ret.spnt b0
+(p10)     frcpa.s0 f8,p13               = f1, f0
+(p10)     br.cond.sptk __libm_error_region   // x=0, y<0, y not int
+}
+;;
+
+// x=0, y<0, y an int
+{ .mib
+          nop.m 999
+(p9)      tbit.nz.unc p11,p12           = pow_GR_sig_int_Y,0
+          nop.b 999
 }
 ;;
 
-        
 { .mfi
-(p13)     mov pow_GR_tag                     = 31
-(p14)     frcpa.s1 f8,p10                       = f1,f0
+          nop.m 999
+(p12)     frcpa.s0 f8,p13               = f1,f0
           nop.i 999
 }
-{ .mfb
-(p14)     mov pow_GR_tag                     = 30
-(p13)     fma.s1 f8                          = f0,f0,f0
-(p12)     br.ret.spnt b0
-}
 ;;
 
-   
-
 { .mfb
           nop.m 999
-(p7)      fcmp.eq.unc.s1 p9,p0              = POW_float_int_Y,  POW_NORM_Y
-          nop.b 999
+(p11)     frcpa.s0 f8,p13               = f1,f8
+          br.cond.sptk __libm_error_region
 }
 ;;
 
+
+POW_Y_0:
+// Here for y zero, x anything but zero and nan
+// Set flag if x denormal
+// Result is +1.0
 { .mfi
-          nop.m 999
-          nop.f 999
-(p9)      tbit.nz.unc p11,p0                 = pow_GR_sig_int_Y,0
+        nop.m 999
+        fcmp.eq.s0 p6,p0 = f8,f0    // Sets flag if x denormal
+        nop.i 999
 }
-;;
-
 { .mfb
-          nop.m 999
-(p11)     fmerge.s f8 = POW_NORM_X,f8
-          br.ret.sptk b0 
+        nop.m 999
+        fma.s.s0 f8 = f1,f1,f0
+        br.ret.sptk b0
 }
 ;;
 
 
+POW_X_INF:
+// Here when X is +-inf
 
-L(POW_X_0_Y_NEG):
-// When X is +-0 and Y is negative, IEEE returns 
-// X     Y           answer
-// +0    -odd int    +inf
-// -0    -odd int    -inf
+// X +inf  Y +inf             +inf
+// X -inf  Y +inf             +inf
 
-// +0    !-odd int   +inf
-// -0    !-odd int   +inf
+// X +inf  Y >0               +inf
+// X -inf  Y >0, !odd integer +inf     <== (-inf)^0.5 = +inf !!
+// X -inf  Y >0,  odd integer -inf
+
+// X +inf  Y -inf             +0
+// X -inf  Y -inf             +0
+
+// X +inf  Y <0               +0
+// X -inf  Y <0, !odd integer +0
+// X -inf  Y <0, odd integer  -0
 
+// X + inf Y=+0                +1
+// X + inf Y=-0                +1
+// X - inf Y=+0                +1
+// X - inf Y=-0                +1
+
+// p13 == Y negative
+// p14 == Y positive
 
 // p6 == Y is a floating point number outside the integer.
 //       Hence it is an integer and is even.
-//       return +inf
+//       p13 == (Y negative)
+//          return +inf
+//       p14 == (Y positive)
+//          return +0
 
 // p7 == Y is a floating point number within the integer range.
 //      p9  == (int_Y = NORM_Y), Y is an integer, which may be odd or even.
 //           p11 odd
-//              return (sign_of_x)inf
-//           p12 even
-//              return +inf
-//      p10 == Y is not an integer
-//         return +inf
-// 
-// 
+//              p13 == (Y negative)
+//                 return (sign_of_x)inf
+//              p14 == (Y positive)
+//                 return (sign_of_x)0
+//           pxx even
+//              p13 == (Y negative)
+//                 return +inf
+//              p14 == (Y positive)
+//                 return +0
 
+//      pxx == Y is not an integer
+//           p13 == (Y negative)
+//                 return +inf
+//           p14 == (Y positive)
+//                 return +0
+//
+
+// If x=inf, test y and flag denormal
 { .mfi
           nop.m 999
-          nop.f 999
-          cmp.gt.unc  p6,p7                  = pow_GR_exp_Y, pow_GR_10033
+          fcmp.eq.s0 p10,p11 = f9,f0
+          nop.i 999
 }
 ;;
 
-
 { .mfi
-          mov pow_GR_tag                     = 33
-(p7)      fcmp.eq.unc.s1 p9,p10              = POW_float_int_Y,  POW_NORM_Y
+          nop.m 999
+          fcmp.lt.s0 p13,p14            = POW_NORM_Y,f0
+          cmp.gt  p6,p7                 = pow_GR_exp_Y, pow_GR_10033
+}
+{ .mfi
+          nop.m 999
+          fclass.m p12,p0               = f9, 0x23 //@inf
           nop.i 999
 }
 ;;
 
+{ .mfi
+          nop.m 999
+          fclass.m p15,p0               = f9, 0x07 //@zero
+          nop.i 999
+}
+;;
 
 { .mfb
           nop.m 999
-(p6)      frcpa.s0 f8,p13                       = f1, f0
-(p6)      br.cond.sptk __libm_error_region
+(p15)     fmerge.s f8 = f1,f1      // Return +1.0 if x=inf, y=0
+(p15)     br.ret.spnt b0           // Exit if x=inf, y=0
 }
 ;;
 
+{ .mfi
+          nop.m 999
+(p14)     frcpa.s1 f8,p10 = f1,f0  // If x=inf, y>0, assume result +inf
+          nop.i 999
+}
 { .mfb
           nop.m 999
-(p10)     frcpa.s0 f8,p13                       = f1, f0
-(p10)     br.cond.sptk __libm_error_region
+(p13)     fma.s.s0 f8 = f0,f0,f0   // If x=inf, y<0, assume result +0.0
+(p12)     br.ret.spnt b0           // Exit if x=inf, y=inf
 }
 ;;
 
-
-
-{ .mib
+// Here if x=inf, and 0 < |y| < inf.  Need to correct results if y odd integer.
+{ .mfi
           nop.m 999
-(p9)      tbit.nz.unc p11,p12                = pow_GR_sig_int_Y,0
-          nop.b 999
+(p7)      fcmp.eq.unc.s1 p9,p0 = POW_float_int_Y,  POW_NORM_Y // Is y integer?
+          nop.i 999
 }
 ;;
 
-
-
 { .mfi
           nop.m 999
-(p12)     frcpa.s0 f8,p13                      = f1,f0
-          nop.i 999
+          nop.f 999
+(p9)      tbit.nz.unc p11,p0 = pow_GR_sig_int_Y,0  // Test for y odd integer
 }
 ;;
 
 { .mfb
           nop.m 999
-(p11)     frcpa f8,p13                      = f1,f8 
-          br.cond.sptk __libm_error_region
+(p11)     fmerge.s f8 = POW_NORM_X,f8    // If y odd integer use sign of x
+          br.ret.sptk b0                 // Exit for x=inf, 0 < |y| < inf
 }
 ;;
 
 
-
-
-L(POW_X_NEG_Y_NONINT):
+POW_X_NEG_Y_NONINT:
 // When X is negative and Y is a non-integer, IEEE
 // returns a qnan indefinite.
-// We call error support with this value 
+// We call error support with this value
 
 { .mfb
-         mov pow_GR_tag                     = 34
-         frcpa f8,p6                        = f0,f0
+         mov pow_GR_tag                 = 34
+         frcpa.s0 f8,p6                 = f0,f0
          br.cond.sptk __libm_error_region
 }
 ;;
 
+POW_X_NAN:
+// Here if x=nan, y not nan
+{ .mfi
+         nop.m 999
+         fclass.m  p9,p13 = f9, 0x07 // Test y=zero
+         nop.i 999
+}
+;;
 
+{ .mfb
+         nop.m 999
+(p13)    fma.s.s0 f8 = f8,f1,f0
+(p13)    br.ret.sptk  b0            // Exit if x nan, y anything but zero or nan
+}
+;;
 
-
-L(POW_X_NAN_Y_0):
+POW_X_NAN_Y_0:
 // When X is a NAN and Y is zero, IEEE returns 1.
 // We call error support with this value.
-
 { .mfi
-         nop.m 0
-         fma.s.s0 f10 = f8,f1,f0 
-         nop.i 0
+         nop.m 999
+         fcmp.eq.s0 p6,p0 = f8,f0       // Dummy op to set invalid on snan
+         nop.i 999
 }
 { .mfb
-         mov pow_GR_tag                     = 35
-         fma.s.s0 f8 = f0,f0,f1 
+         mov pow_GR_tag                 = 35
+         fma.s.s0 f8 = f0,f0,f1
          br.cond.sptk __libm_error_region
 }
 ;;
 
 
-L(POW_OVER_UNDER_X_NOT_INF):
+POW_OVER_UNDER_X_NOT_INF:
 
 // p8 is TRUE for overflow
 // p9 is TRUE for underflow
 
 // if y is infinity, we should not over/underflow
 
-
 { .mfi
           nop.m 999
-          fcmp.eq.unc.s1     p14, p13        = POW_xsq,f1
-          cmp.eq.unc p8,p9                   = pow_GR_sign_Y_Gpr, r0
+          fcmp.eq.s1     p14, p13       = POW_xsq,f1  // Test |x|=1
+          cmp.eq p8,p9                  = pow_GR_sign_Y_Gpr, r0
 }
 ;;
 
 { .mfi
           nop.m 999
-(p14)     fclass.m.unc       p15, p0         = f9, 0x23
+(p14)     fclass.m.unc       p15, p0    = f9, 0x23 // If |x|=1, test y=inf
           nop.i 999
 }
 { .mfi
           nop.m 999
-(p13)     fclass.m.unc       p11,p0         = f9, 0x23
+(p13)     fclass.m.unc       p11,p0     = f9, 0x23 // If |x| not 1, test y=inf
           nop.i 999
 }
 ;;
@@ -2137,31 +1909,33 @@ L(POW_OVER_UNDER_X_NOT_INF):
 // p15 = TRUE if |x|=1, y=inf, return +1
 { .mfb
           nop.m 999
-(p15)     fma.s              f8              = f1,f1,f0
-(p15)     br.ret.spnt b0
+(p15)     fma.s.s0          f8          = f1,f1,f0 // If |x|=1, y=inf, result +1
+(p15)     br.ret.spnt b0                // Exit if |x|=1, y=inf
 }
 ;;
 
 .pred.rel "mutex",p8,p9
 {  .mfb
-(p8)      setf.exp           f8              = pow_GR_17ones
-(p9)      fmerge.s           f8              = f0,f0
-(p11)     br.ret.sptk b0
+(p8)      setf.exp           f8 = pow_GR_17ones // If exp(+big), result inf
+(p9)      fmerge.s           f8 = f0,f0         // If exp(-big), result 0
+(p11)     br.ret.sptk b0                // Exit if |x| not 1, y=inf
 }
+;;
 
 { .mfb
           nop.m 999
           nop.f 999
-          br.cond.sptk L(POW_OVER_UNDER_ERROR)
+          br.cond.sptk POW_OVER_UNDER_ERROR // Branch if y not inf
 }
 ;;
 
-L(POW_Y_NAN):
 
-// Is x = +1 then result is +1, else result is quiet Y
+POW_Y_NAN:
+// Here if y=nan, x anything
+// If x = +1 then result is +1, else result is quiet Y
 { .mfi
        nop.m 999
-       fcmp.eq.s1         p10,p9               = POW_NORM_X, f1 
+       fcmp.eq.s1         p10,p9        = POW_NORM_X, f1
        nop.i 999
 }
 ;;
@@ -2175,148 +1949,118 @@ L(POW_Y_NAN):
 
 { .mfi
        nop.m 999
-(p10)  fma.s f8 = f1,f1,f0 
+(p10)  fma.s.s0 f8 = f1,f1,f0
        nop.i 999
 }
 { .mfb
        nop.m 999
-(p9)   fma.s f8 = f9,f8,f0 
-       br.ret.sptk b0
+(p9)   fma.s.s0 f8 = f9,f8,f0
+       br.ret.sptk b0             // Exit y=nan
 }
 ;;
 
 
-L(POW_OVER_UNDER_ERROR):
+POW_OVER_UNDER_ERROR:
+// Here if we have overflow or underflow.
+// Enter with p12 true if x negative and y odd int to force -0 or -inf
 
 { .mfi
-          nop.m 999
-          fmerge.s f10                      = POW_NORM_X,POW_NORM_X
-          nop.i 999
-}
-{ .mfi
-          sub   pow_GR_17ones_m1            = pow_GR_17ones, r0, 1
-          nop.f 999
-          mov pow_GR_one                    = 0x1
+         sub   pow_GR_17ones_m1         = pow_GR_17ones, r0, 1
+         nop.f 999
+         mov pow_GR_one                 = 0x1
 }
 ;;
 
-// overflow
+// overflow, force inf with O flag
 { .mmb
-(p8)     mov pow_GR_tag                     = 30
-(p8)     setf.exp f11                       = pow_GR_17ones_m1
+(p8)     mov pow_GR_tag                 = 30
+(p8)     setf.exp POW_tmp               = pow_GR_17ones_m1
          nop.b 999
 }
 ;;
 
-        
-// underflow
+// underflow, force zero with I, U flags
 { .mmi
-(p9)    mov pow_GR_tag                     = 31
-(p9)    setf.exp f11                       = pow_GR_one
+(p9)    mov pow_GR_tag                  = 31
+(p9)    setf.exp POW_tmp                = pow_GR_one
         nop.i 999
 }
 ;;
 
-
-// p12 x is negative and y is an odd integer 
-
-
 { .mfi
         nop.m 999
-        fma.s f8                               = f11, f11, f0
+        fma.s.s0 f8                     = POW_tmp, POW_tmp, f0
         nop.i 999
 }
 ;;
 
+// p12 x is negative and y is an odd integer, change sign of result
 { .mfi
         nop.m 999
-(p12)   fmerge.ns f8                           = f8, f8
+(p12)   fnma.s.s0 f8                    = POW_tmp, POW_tmp, f0
         nop.i 999
 }
 ;;
 
+GLOBAL_LIBM_END(powf)
 
-.endp powf
-ASM_SIZE_DIRECTIVE(powf)
-
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
 
+LOCAL_LIBM_ENTRY(__libm_error_region)
 
-
-.proc __libm_error_region
-__libm_error_region:
-
-// Answer is inf for overflow and 0 for underflow.
 .prologue
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp     // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs         // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp=-64,sp                   // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP=gp               // Save gp
 };;
 
-
-// (2)
 { .mmi
         stfs [GR_Parameter_Y] = POW_NORM_Y,16 // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+        add GR_Parameter_X = 16,sp      // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0=b0               // Save b0
 };;
 
 .body
-// (3)
 { .mib
-        stfs [GR_Parameter_X] = POW_NORM_X              // STORE Parameter 1 on stack
+        stfs [GR_Parameter_X] = POW_NORM_X // STORE Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
-        nop.b 0                                
+        nop.b 0
 }
 { .mib
-        stfs [GR_Parameter_Y] = f8                      // STORE Parameter 3 on stack
+        stfs [GR_Parameter_Y] = f8      // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#           // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 
-// (4)
 { .mmi
-        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfs  f8 = [GR_Parameter_RESULT] // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                 // Restore stack pointer
+        mov   b0 = GR_SAVE_B0            // Restore return address
 };;
+
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        mov   gp = GR_SAVE_GP            // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS       // Restore ar.pfs
+        br.ret.sptk     b0               // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/e_powl.S b/sysdeps/ia64/fpu/e_powl.S
index d286e9abad..3f93f6090e 100644
--- a/sysdeps/ia64/fpu/e_powl.S
+++ b/sysdeps/ia64/fpu/e_powl.S
@@ -1,10 +1,10 @@
 .file "powl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,61 +20,70 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Function:   powl(x,y), where
-//                         y
+//                          y
 //             powl(x,y) = x , for double extended precision x and y values
 //
-// *********************************************************************
+//*********************************************************************
 //
-// History: 
-// 2/02/00  (Hand Optimized)
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// History:
+// 02/02/00 (Hand Optimized)
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 1/22/01  Corrected results for powl(1,inf), powl(1,nan), and
+// 01/22/01 Corrected results for powl(1,inf), powl(1,nan), and
 //          powl(snan,0) to be 1 per C99, not nan.  Fixed many flag settings.
-// 2/06/01  Call __libm_error support if over/underflow when y=2.
-//
-// *********************************************************************
+// 02/06/01 Call __libm_error support if over/underflow when y=2.
+// 04/17/01 Support added for y close to 1 and x a non-special value.
+//          Shared software under/overflow detection for all paths
+// 02/07/02 Corrected sf3 setting to disable traps
+// 05/13/02 Improved performance of all paths
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+// 04/17/03 Added missing mutex directive
+// 10/13/03 Corrected .endp names to match .proc names
+//
+//*********************************************************************
 //
 // Resources Used:
 //
-//    Floating-Point Registers: 
-//                        f8  (Input and Return Value)
-//                        f9-f15,f32-f63,f99 
+//    Floating-Point Registers:
+//                        f8  (Input x and Return Value)
+//                        f9  (Input y)
+//                        f10-f15,f32-f79
 //
 //    General Purpose Registers:
-//                        Locals r32 - r61
+//                        Locals r14-24,r32-r65
 //                        Parameters to __libm_error_support r62,r63,r64,r65
 //
 //    Predicate Registers: p6-p15
 //
-// *********************************************************************
+//*********************************************************************
 //
 //  Special Cases and IEEE special conditions:
 //
 //    Denormal fault raised on denormal inputs
-//    Overflow exceptions raised when appropriate for pow 
-//    Underflow exceptions raised when appropriate for pow 
+//    Overflow exceptions raised when appropriate for pow
+//    Underflow exceptions raised when appropriate for pow
 //    (Error Handling Routine called for overflow and Underflow)
 //    Inexact raised when appropriate by algorithm
 //
@@ -102,8 +111,8 @@
 //  22. X or Y denorm/unorm and denorm/unorm operand trap is enabled,
 //      generate denorm/unorm fault except if invalid or div_0 raised.
 //
-// *********************************************************************
-// 
+//*********************************************************************
+//
 //  Algorithm
 //  =========
 //
@@ -113,23 +122,23 @@
 //    If Y = 0.5,  return sqrt(X).
 //
 //  Compute log(X) to extra precision.
-//  
+//
 //  ker_log_80( X, logX_hi, logX_lo, Safe );
 //
-//   ...logX_hi + logX_lo approximates log(X) to roughly 80 
+//   ...logX_hi + logX_lo approximates log(X) to roughly 80
 //   ...significant bits of accuracy.
 //
 //  Compute Y*log(X) to extra precision.
 //
 //    P_hi := Y * logX_hi
-//    P_lo := Y * logX_hi - P_hi	...using FMA
-//    P_lo := Y * logX_lo + P_lo	...using FMA
+//    P_lo := Y * logX_hi - P_hi       ...using FMA
+//    P_lo := Y * logX_lo + P_lo       ...using FMA
 //
 //  Compute exp(P_hi + P_lo)
 //
-//    Flag := 2; 
+//    Flag := 2;
 //    Expo_Range := 2; (assuming double-extended power function)
-//    ker_exp_64( P_hi, P_lo, Flag, Expo_Range, 
+//    ker_exp_64( P_hi, P_lo, Flag, Expo_Range,
 //                Z_hi, Z_lo, scale, Safe )
 //
 //    scale := sgn * scale
@@ -138,7 +147,7 @@
 //       return scale*Z_hi + (scale*Z_lo)
 //       quickly
 //    Else
-//       take necessary precaution in computing 
+//       take necessary precaution in computing
 //       scale*Z_hi + (scale*Z_lo)
 //       to set possible exceptions correctly.
 //    End If
@@ -152,8 +161,8 @@
 //   If Y is qNaN, return Y without exception.
 //   If X is qNaN, return X without exception.
 //
-//   At this point, X is real and Y is +-inf. 
-//   Thus |X| can only be 1, strictly bigger than 1, or 
+//   At this point, X is real and Y is +-inf.
+//   Thus |X| can only be 1, strictly bigger than 1, or
 //   strictly less than 1.
 //
 //   If |X| < 1, then
@@ -169,8 +178,8 @@
 //   ...Note that Y is real, finite, non-zero, and not +1.
 //
 //   If X is qNaN, return X without exception.
-//    
-//   If X is +-0, 
+//
+//   If X is +-0,
 //   return ( Y > 0 ? +0 : +inf )
 //
 //   If X is +inf
@@ -180,11 +189,11 @@
 //   return -0 ** -Y
 //   return ( Y > 0 ? +inf : +0 )
 //
-//  Case_Invalid 
+//  Case_Invalid
 //
 //   Return 0 * inf to generate a quiet NaN together
 //   with an invalid exception.
-// 
+//
 //  Implementation
 //  ==============
 //
@@ -193,15 +202,15 @@
 //
 //  STAGE 1
 //  -------
-//   This stage contains two threads. 
+//   This stage contains two threads.
 //
 //   Stage1.Thread1
 //
 //     fclass.m   X_excep,  X_ok   = X, (NatVal or s/qNaN) or
-//				  +-0, +-infinity
+//                              +-0, +-infinity
 //
 //     fclass.nm  X_unsupp, X_supp = X, (NatVal or s/qNaN) or
-//				  +-(0, unnorm, norm, infinity)
+//                              +-(0, unnorm, norm, infinity)
 //
 //     X_norm := fnorm( X ) with traps disabled
 //
@@ -209,26 +218,26 @@
 //     If (X_unsupp) goto Filtering (Step 2)
 //
 //     Stage1.Thread2
-//     ..............    
+//     ..............
 //
 //     fclass.m   Y_excep,  Y_ok   = Y, (NatVal or s/qNaN) or
-//				  +-0, +-infinity
+//                              +-0, +-infinity
 //
 //     fclass.nm  Y_unsupp, Y_supp = Y, (NatVal or s/qNaN) or
-//				  +-(0, unnorm, norm, infinity)
+//                              +-(0, unnorm, norm, infinity)
 //
 //     Y_norm := fnorm( Y ) with traps disabled
 //
 //     If (Y_excep)  goto Filtering (Step 2)
 //     If (Y_unsupp) goto Filtering (Step 2)
 //
-// 
+//
 //  STAGE 2
 //  -------
 //  This stage contains two threads.
 //
-//     Stage2.Thread1		
-//     ..............	
+//     Stage2.Thread1
+//     ..............
 //
 //     Set X_lt_0 if X < 0 (using fcmp)
 //     sgn := +1.0
@@ -245,14 +254,14 @@
 //   This stage contains two threads.
 //
 //
-//   Stage3.Thread1		
-//   .............. 	
+//   Stage3.Thread1
+//   ..............
 //
 //     X := fnorm(X) in prevailing traps
 //
 //
-//     Stage3.Thread2		
-//     ..............	
+//     Stage3.Thread2
+//     ..............
 //
 //     Y := fnorm(Y) in prevailing traps
 //
@@ -262,60 +271,56 @@
 //   Go to Case_Normal.
 //
 
-#include "libm_support.h"
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
-// Inv_L, L_hi, L_lo 
-.align 64
-Constants_exp_64_Arg:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Arg,@object)
-data4 0x5C17F0BC,0xB8AA3B29,0x0000400B,0x00000000 
-data4 0x00000000,0xB17217F4,0x00003FF2,0x00000000
-data4 0xF278ECE6,0xF473DE6A,0x00003FD4,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Arg)
-
-.align 64
-Constants_exp_64_Exponents:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Exponents,@object)
-data4 0x0000007E,0x00000000,0xFFFFFF83,0xFFFFFFFF
-data4 0x000003FE,0x00000000,0xFFFFFC03,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0xFFFFFFE2,0xFFFFFFFF,0xFFFFFFC4,0xFFFFFFFF
-data4 0xFFFFFFBA,0xFFFFFFFF,0xFFFFFFBA,0xFFFFFFFF
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Exponents)
-
-.align 64
-Constants_exp_64_A:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_A,@object)
-// Reversed 
-data4 0xB1B736A0,0xAAAAAAAB,0x00003FFA,0x00000000
-data4 0x90CD6327,0xAAAAAAAB,0x00003FFC,0x00000000
-data4 0xFFFFFFFF,0xFFFFFFFF,0x00003FFD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_exp_64_A)
-
-.align 64
-Constants_exp_64_P:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_P,@object)
-// Reversed 
-data4 0x43914A8A,0xD00D6C81,0x00003FF2,0x00000000
-data4 0x30304B30,0xB60BC4AC,0x00003FF5,0x00000000
-data4 0x7474C518,0x88888888,0x00003FF8,0x00000000
-data4 0x8DAE729D,0xAAAAAAAA,0x00003FFA,0x00000000
-data4 0xAAAAAF61,0xAAAAAAAA,0x00003FFC,0x00000000
-data4 0x000004C7,0x80000000,0x00003FFE,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_exp_64_P)
-
-.align 64
-Constants_exp_64_T1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T1,@object)
-data4 0x3F800000,0x3F8164D2,0x3F82CD87,0x3F843A29 
-data4 0x3F85AAC3,0x3F871F62,0x3F88980F,0x3F8A14D5 
+
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
+
+// double-extended 1/ln(2)
+// 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
+// 3fff b8aa 3b29 5c17 f0bc
+// For speed the significand will be loaded directly with a movl and setf.sig
+//   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
+//   computations need to scale appropriately.
+// The constant 2^12/ln(2) is needed for the computation of N.  This is also
+//   obtained by scaling the computations.
+//
+// Two shifting constants are loaded directly with movl and setf.d.
+//   1. RSHF_2TO51 = 1.1000..00 * 2^(63-12)
+//        This constant is added to x*1/ln2 to shift the integer part of
+//        x*2^12/ln2 into the rightmost bits of the significand.
+//        The result of this fma is N_signif.
+//   2. RSHF       = 1.1000..00 * 2^(63)
+//        This constant is subtracted from N_signif * 2^(-51) to give
+//        the integer part of N, N_fix, as a floating-point number.
+//        The result of this fms is float_N.
+RODATA
+
+.align 16
+// L_hi, L_lo
+LOCAL_OBJECT_START(Constants_exp_64_Arg)
+data8 0xB17217F400000000,0x00003FF2 // L_hi = hi part log(2)/2^12
+data8 0xF473DE6AF278ECE6,0x00003FD4 // L_lo = lo part log(2)/2^12
+LOCAL_OBJECT_END(Constants_exp_64_Arg)
+
+LOCAL_OBJECT_START(Constants_exp_64_A)
+// Reversed
+data8 0xAAAAAAABB1B736A0,0x00003FFA
+data8 0xAAAAAAAB90CD6327,0x00003FFC
+data8 0xFFFFFFFFFFFFFFFF,0x00003FFD
+LOCAL_OBJECT_END(Constants_exp_64_A)
+
+LOCAL_OBJECT_START(Constants_exp_64_P)
+// Reversed
+data8 0xD00D6C8143914A8A,0x00003FF2
+data8 0xB60BC4AC30304B30,0x00003FF5
+data8 0x888888887474C518,0x00003FF8
+data8 0xAAAAAAAA8DAE729D,0x00003FFA
+data8 0xAAAAAAAAAAAAAF61,0x00003FFC
+data8 0x80000000000004C7,0x00003FFE
+LOCAL_OBJECT_END(Constants_exp_64_P)
+
+LOCAL_OBJECT_START(Constants_exp_64_T1)
+data4 0x3F800000,0x3F8164D2,0x3F82CD87,0x3F843A29
+data4 0x3F85AAC3,0x3F871F62,0x3F88980F,0x3F8A14D5
 data4 0x3F8B95C2,0x3F8D1ADF,0x3F8EA43A,0x3F9031DC
 data4 0x3F91C3D3,0x3F935A2B,0x3F94F4F0,0x3F96942D
 data4 0x3F9837F0,0x3F99E046,0x3F9B8D3A,0x3F9D3EDA
@@ -330,274 +335,263 @@ data4 0x3FD744FD,0x3FD99D16,0x3FDBFBB8,0x3FDE60F5
 data4 0x3FE0CCDF,0x3FE33F89,0x3FE5B907,0x3FE8396A
 data4 0x3FEAC0C7,0x3FED4F30,0x3FEFE4BA,0x3FF28177
 data4 0x3FF5257D,0x3FF7D0DF,0x3FFA83B3,0x3FFD3E0C
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T1)
-
-.align 64
-Constants_exp_64_T2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T2,@object)
-data4 0x3F800000,0x3F80058C,0x3F800B18,0x3F8010A4 
-data4 0x3F801630,0x3F801BBD,0x3F80214A,0x3F8026D7 
-data4 0x3F802C64,0x3F8031F2,0x3F803780,0x3F803D0E 
-data4 0x3F80429C,0x3F80482B,0x3F804DB9,0x3F805349 
-data4 0x3F8058D8,0x3F805E67,0x3F8063F7,0x3F806987 
-data4 0x3F806F17,0x3F8074A8,0x3F807A39,0x3F807FCA 
-data4 0x3F80855B,0x3F808AEC,0x3F80907E,0x3F809610 
-data4 0x3F809BA2,0x3F80A135,0x3F80A6C7,0x3F80AC5A 
-data4 0x3F80B1ED,0x3F80B781,0x3F80BD14,0x3F80C2A8 
-data4 0x3F80C83C,0x3F80CDD1,0x3F80D365,0x3F80D8FA 
-data4 0x3F80DE8F,0x3F80E425,0x3F80E9BA,0x3F80EF50 
-data4 0x3F80F4E6,0x3F80FA7C,0x3F810013,0x3F8105AA 
-data4 0x3F810B41,0x3F8110D8,0x3F81166F,0x3F811C07 
-data4 0x3F81219F,0x3F812737,0x3F812CD0,0x3F813269 
-data4 0x3F813802,0x3F813D9B,0x3F814334,0x3F8148CE 
+LOCAL_OBJECT_END(Constants_exp_64_T1)
+
+LOCAL_OBJECT_START(Constants_exp_64_T2)
+data4 0x3F800000,0x3F80058C,0x3F800B18,0x3F8010A4
+data4 0x3F801630,0x3F801BBD,0x3F80214A,0x3F8026D7
+data4 0x3F802C64,0x3F8031F2,0x3F803780,0x3F803D0E
+data4 0x3F80429C,0x3F80482B,0x3F804DB9,0x3F805349
+data4 0x3F8058D8,0x3F805E67,0x3F8063F7,0x3F806987
+data4 0x3F806F17,0x3F8074A8,0x3F807A39,0x3F807FCA
+data4 0x3F80855B,0x3F808AEC,0x3F80907E,0x3F809610
+data4 0x3F809BA2,0x3F80A135,0x3F80A6C7,0x3F80AC5A
+data4 0x3F80B1ED,0x3F80B781,0x3F80BD14,0x3F80C2A8
+data4 0x3F80C83C,0x3F80CDD1,0x3F80D365,0x3F80D8FA
+data4 0x3F80DE8F,0x3F80E425,0x3F80E9BA,0x3F80EF50
+data4 0x3F80F4E6,0x3F80FA7C,0x3F810013,0x3F8105AA
+data4 0x3F810B41,0x3F8110D8,0x3F81166F,0x3F811C07
+data4 0x3F81219F,0x3F812737,0x3F812CD0,0x3F813269
+data4 0x3F813802,0x3F813D9B,0x3F814334,0x3F8148CE
 data4 0x3F814E68,0x3F815402,0x3F81599C,0x3F815F37
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T2)
-  
-.align 64
-Constants_exp_64_W1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W1,@object)
-data4 0x00000000,0x00000000,0x171EC4B4,0xBE384454
-data4 0x4AA72766,0xBE694741,0xD42518F8,0xBE5D32B6
-data4 0x3A319149,0x3E68D96D,0x62415F36,0xBE68F4DA
-data4 0xC9C86A3B,0xBE6DDA2F,0xF49228FE,0x3E6B2E50
-data4 0x1188B886,0xBE49C0C2,0x1A4C2F1F,0x3E64BFC2
-data4 0x2CB98B54,0xBE6A2FBB,0x9A55D329,0x3E5DC5DE
-data4 0x39A7AACE,0x3E696490,0x5C66DBA5,0x3E54728B
-data4 0xBA1C7D7D,0xBE62B0DB,0x09F1AF5F,0x3E576E04
-data4 0x1A0DD6A1,0x3E612500,0x795FBDEF,0xBE66A419
-data4 0xE1BD41FC,0xBE5CDE8C,0xEA54964F,0xBE621376
-data4 0x476E76EE,0x3E6370BE,0x3427EB92,0x3E390D1A 
-data4 0x2BF82BF8,0x3E1336DE,0xD0F7BD9E,0xBE5FF1CB 
-data4 0x0CEB09DD,0xBE60A355,0x0980F30D,0xBE5CA37E 
-data4 0x4C082D25,0xBE5C541B,0x3B467D29,0xBE5BBECA 
-data4 0xB9D946C5,0xBE400D8A,0x07ED374A,0xBE5E2A08 
-data4 0x365C8B0A,0xBE66CB28,0xD3403BCA,0x3E3AAD5B 
-data4 0xC7EA21E0,0x3E526055,0xE72880D6,0xBE442C75 
-data4 0x85222A43,0x3E58B2BB,0x522C42BF,0xBE5AAB79 
-data4 0x469DC2BC,0xBE605CB4,0xA48C40DC,0xBE589FA7 
-data4 0x1AA42614,0xBE51C214,0xC37293F4,0xBE48D087 
-data4 0xA2D673E0,0x3E367A1C,0x114F7A38,0xBE51BEBB 
-data4 0x661A4B48,0xBE6348E5,0x1D3B9962,0xBDF52643  
-data4 0x35A78A53,0x3E3A3B5E,0x1CECD788,0xBE46C46C 
-data4 0x7857D689,0xBE60B7EC,0xD14F1AD7,0xBE594D3D 
-data4 0x4C9A8F60,0xBE4F9C30,0x02DFF9D2,0xBE521873 
-data4 0x55E6D68F,0xBE5E4C88,0x667F3DC4,0xBE62140F 
-data4 0x3BF88747,0xBE36961B,0xC96EC6AA,0x3E602861 
-data4 0xD57FD718,0xBE3B5151,0xFC4A627B,0x3E561CD0 
-data4 0xCA913FEA,0xBE3A5217,0x9A5D193A,0x3E40A3CC 
-data4 0x10A9C312,0xBE5AB713,0xC5F57719,0x3E4FDADB 
-data4 0xDBDF59D5,0x3E361428,0x61B4180D,0x3E5DB5DB 
-data4 0x7408D856,0xBE42AD5F,0x31B2B707,0x3E2A3148
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W1)
-
-.align 64
-Constants_exp_64_W2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W2,@object)
-data4 0x00000000,0x00000000,0x37A3D7A2,0xBE641F25 
-data4 0xAD028C40,0xBE68DD57,0xF212B1B6,0xBE5C77D8 
-data4 0x1BA5B070,0x3E57878F,0x2ECAE6FE,0xBE55A36A 
-data4 0x569DFA3B,0xBE620608,0xA6D300A3,0xBE53B50E 
-data4 0x223F8F2C,0x3E5B5EF2,0xD6DE0DF4,0xBE56A0D9 
-data4 0xEAE28F51,0xBE64EEF3,0x367EA80B,0xBE5E5AE2 
-data4 0x5FCBC02D,0x3E47CB1A,0x9BDAFEB7,0xBE656BA0 
-data4 0x805AFEE7,0x3E6E70C6,0xA3415EBA,0xBE6E0509 
-data4 0x49BFF529,0xBE56856B,0x00508651,0x3E66DD33 
-data4 0xC114BC13,0x3E51165F,0xC453290F,0x3E53333D 
-data4 0x05539FDA,0x3E6A072B,0x7C0A7696,0xBE47CD87 
-data4 0xEB05C6D9,0xBE668BF4,0x6AE86C93,0xBE67C3E3 
-data4 0xD0B3E84B,0xBE533904,0x556B53CE,0x3E63E8D9 
-data4 0x63A98DC8,0x3E212C89,0x032A7A22,0xBE33138F 
-data4 0xBC584008,0x3E530FA9,0xCCB93C97,0xBE6ADF82 
-data4 0x8370EA39,0x3E5F9113,0xFB6A05D8,0x3E5443A4 
-data4 0x181FEE7A,0x3E63DACD,0xF0F67DEC,0xBE62B29D 
-data4 0x3DDE6307,0x3E65C483,0xD40A24C1,0x3E5BF030  
-data4 0x14E437BE,0x3E658B8F,0xED98B6C7,0xBE631C29 
-data4 0x04CF7C71,0x3E6335D2,0xE954A79D,0x3E529EED
-data4 0xF64A2FB8,0x3E5D9257,0x854ED06C,0xBE6BED1B 
-data4 0xD71405CB,0x3E5096F6,0xACB9FDF5,0xBE3D4893 
-data4 0x01B68349,0xBDFEB158,0xC6A463B9,0x3E628D35 
-data4 0xADE45917,0xBE559725,0x042FC476,0xBE68C29C 
-data4 0x01E511FA,0xBE67593B,0x398801ED,0xBE4A4313 
-data4 0xDA7C3300,0x3E699571,0x08062A9E,0x3E5349BE 
-data4 0x755BB28E,0x3E5229C4,0x77A1F80D,0x3E67E426 
-data4 0x6B69C352,0xBE52B33F,0x084DA57F,0xBE6B3550 
-data4 0xD1D09A20,0xBE6DB03F,0x2161B2C1,0xBE60CBC4 
-data4 0x78A2B771,0x3E56ED9C,0x9D0FA795,0xBE508E31 
-data4 0xFD1A54E9,0xBE59482A,0xB07FD23E,0xBE2A17CE 
-data4 0x17365712,0x3E68BF5C,0xB3785569,0x3E3956F9
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W2)
-
-.align 64
-Constants_log_80_P:
-ASM_TYPE_DIRECTIVE(Constants_log_80_P,@object)
-// 1/2, P_8, P_7, ..., P_1  
-data4 0x00000000, 0x80000000, 0x00003FFE, 0x00000000
-data4 0x3B1042BC, 0xCCCE8B88, 0x0000BFFB, 0x00000000
-data4 0xCADC2149, 0xE38997B7, 0x00003FFB, 0x00000000
-data4 0xB1ACB090, 0xFFFFFFFE, 0x0000BFFB, 0x00000000
-data4 0x06481C81, 0x92492498, 0x00003FFC, 0x00000000
-data4 0xAAAAB0EF, 0xAAAAAAAA, 0x0000BFFC, 0x00000000
-data4 0xCCC91416, 0xCCCCCCCC, 0x00003FFC, 0x00000000
-data4 0x00000000, 0x80000000, 0x0000BFFD, 0x00000000
-data4 0xAAAAAAAB, 0xAAAAAAAA, 0x00003FFD
-ASM_SIZE_DIRECTIVE(Constants_log_80_P)
-
-.align 64
-Constants_log_80_Q:
-ASM_TYPE_DIRECTIVE(Constants_log_80_Q,@object)
-// log2_hi, log2_lo, Q_6, Q_5, Q_4, Q_3, Q_2, Q_1 
-data4 0x00000000,0xB1721800,0x00003FFE,0x00000000
-data4 0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
-data4 0xA51BE0AF,0x92492453,0x00003FFC,0x00000000
-data4 0xA0CFD29F,0xAAAAAB73,0x0000BFFC,0x00000000
-data4 0xCCCE3872,0xCCCCCCCC,0x00003FFC,0x00000000
-data4 0xFFFFB4FB,0xFFFFFFFF,0x0000BFFC,0x00000000
-data4 0xAAAAAAAB,0xAAAAAAAA,0x00003FFD,0x00000000
-data4 0x00000000,0x80000000,0x0000BFFE,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_log_80_Q)
-
-.align 64
-Constants_log_80_Z_G_H_h1:
-ASM_TYPE_DIRECTIVE(Constants_log_80_Z_G_H_h1,@object)
-// Z1 - 16 bit fixed, G1 and H1 IEEE single, h1 IEEE double   
+LOCAL_OBJECT_END(Constants_exp_64_T2)
+
+LOCAL_OBJECT_START(Constants_exp_64_W1)
+data8 0x0000000000000000, 0xBE384454171EC4B4
+data8 0xBE6947414AA72766, 0xBE5D32B6D42518F8
+data8 0x3E68D96D3A319149, 0xBE68F4DA62415F36
+data8 0xBE6DDA2FC9C86A3B, 0x3E6B2E50F49228FE
+data8 0xBE49C0C21188B886, 0x3E64BFC21A4C2F1F
+data8 0xBE6A2FBB2CB98B54, 0x3E5DC5DE9A55D329
+data8 0x3E69649039A7AACE, 0x3E54728B5C66DBA5
+data8 0xBE62B0DBBA1C7D7D, 0x3E576E0409F1AF5F
+data8 0x3E6125001A0DD6A1, 0xBE66A419795FBDEF
+data8 0xBE5CDE8CE1BD41FC, 0xBE621376EA54964F
+data8 0x3E6370BE476E76EE, 0x3E390D1A3427EB92
+data8 0x3E1336DE2BF82BF8, 0xBE5FF1CBD0F7BD9E
+data8 0xBE60A3550CEB09DD, 0xBE5CA37E0980F30D
+data8 0xBE5C541B4C082D25, 0xBE5BBECA3B467D29
+data8 0xBE400D8AB9D946C5, 0xBE5E2A0807ED374A
+data8 0xBE66CB28365C8B0A, 0x3E3AAD5BD3403BCA
+data8 0x3E526055C7EA21E0, 0xBE442C75E72880D6
+data8 0x3E58B2BB85222A43, 0xBE5AAB79522C42BF
+data8 0xBE605CB4469DC2BC, 0xBE589FA7A48C40DC
+data8 0xBE51C2141AA42614, 0xBE48D087C37293F4
+data8 0x3E367A1CA2D673E0, 0xBE51BEBB114F7A38
+data8 0xBE6348E5661A4B48, 0xBDF526431D3B9962
+data8 0x3E3A3B5E35A78A53, 0xBE46C46C1CECD788
+data8 0xBE60B7EC7857D689, 0xBE594D3DD14F1AD7
+data8 0xBE4F9C304C9A8F60, 0xBE52187302DFF9D2
+data8 0xBE5E4C8855E6D68F, 0xBE62140F667F3DC4
+data8 0xBE36961B3BF88747, 0x3E602861C96EC6AA
+data8 0xBE3B5151D57FD718, 0x3E561CD0FC4A627B
+data8 0xBE3A5217CA913FEA, 0x3E40A3CC9A5D193A
+data8 0xBE5AB71310A9C312, 0x3E4FDADBC5F57719
+data8 0x3E361428DBDF59D5, 0x3E5DB5DB61B4180D
+data8 0xBE42AD5F7408D856, 0x3E2A314831B2B707
+LOCAL_OBJECT_END(Constants_exp_64_W1)
+
+LOCAL_OBJECT_START(Constants_exp_64_W2)
+data8 0x0000000000000000, 0xBE641F2537A3D7A2
+data8 0xBE68DD57AD028C40, 0xBE5C77D8F212B1B6
+data8 0x3E57878F1BA5B070, 0xBE55A36A2ECAE6FE
+data8 0xBE620608569DFA3B, 0xBE53B50EA6D300A3
+data8 0x3E5B5EF2223F8F2C, 0xBE56A0D9D6DE0DF4
+data8 0xBE64EEF3EAE28F51, 0xBE5E5AE2367EA80B
+data8 0x3E47CB1A5FCBC02D, 0xBE656BA09BDAFEB7
+data8 0x3E6E70C6805AFEE7, 0xBE6E0509A3415EBA
+data8 0xBE56856B49BFF529, 0x3E66DD3300508651
+data8 0x3E51165FC114BC13, 0x3E53333DC453290F
+data8 0x3E6A072B05539FDA, 0xBE47CD877C0A7696
+data8 0xBE668BF4EB05C6D9, 0xBE67C3E36AE86C93
+data8 0xBE533904D0B3E84B, 0x3E63E8D9556B53CE
+data8 0x3E212C8963A98DC8, 0xBE33138F032A7A22
+data8 0x3E530FA9BC584008, 0xBE6ADF82CCB93C97
+data8 0x3E5F91138370EA39, 0x3E5443A4FB6A05D8
+data8 0x3E63DACD181FEE7A, 0xBE62B29DF0F67DEC
+data8 0x3E65C4833DDE6307, 0x3E5BF030D40A24C1
+data8 0x3E658B8F14E437BE, 0xBE631C29ED98B6C7
+data8 0x3E6335D204CF7C71, 0x3E529EEDE954A79D
+data8 0x3E5D9257F64A2FB8, 0xBE6BED1B854ED06C
+data8 0x3E5096F6D71405CB, 0xBE3D4893ACB9FDF5
+data8 0xBDFEB15801B68349, 0x3E628D35C6A463B9
+data8 0xBE559725ADE45917, 0xBE68C29C042FC476
+data8 0xBE67593B01E511FA, 0xBE4A4313398801ED
+data8 0x3E699571DA7C3300, 0x3E5349BE08062A9E
+data8 0x3E5229C4755BB28E, 0x3E67E42677A1F80D
+data8 0xBE52B33F6B69C352, 0xBE6B3550084DA57F
+data8 0xBE6DB03FD1D09A20, 0xBE60CBC42161B2C1
+data8 0x3E56ED9C78A2B771, 0xBE508E319D0FA795
+data8 0xBE59482AFD1A54E9, 0xBE2A17CEB07FD23E
+data8 0x3E68BF5C17365712, 0x3E3956F9B3785569
+LOCAL_OBJECT_END(Constants_exp_64_W2)
+
+LOCAL_OBJECT_START(Constants_log_80_P)
+// P_8, P_7, ..., P_1
+data8 0xCCCE8B883B1042BC, 0x0000BFFB // P_8
+data8 0xE38997B7CADC2149, 0x00003FFB // P_7
+data8 0xFFFFFFFEB1ACB090, 0x0000BFFB // P_6
+data8 0x9249249806481C81, 0x00003FFC // P_5
+data8 0x0000000000000000, 0x00000000 // Pad for bank conflicts
+data8 0xAAAAAAAAAAAAB0EF, 0x0000BFFC // P_4
+data8 0xCCCCCCCCCCC91416, 0x00003FFC // P_3
+data8 0x8000000000000000, 0x0000BFFD // P_2
+data8 0xAAAAAAAAAAAAAAAB, 0x00003FFD // P_1
+LOCAL_OBJECT_END(Constants_log_80_P)
+
+LOCAL_OBJECT_START(Constants_log_80_Q)
+// log2_hi, log2_lo, Q_6, Q_5, Q_4, Q_3, Q_2, Q_1
+data8 0xB172180000000000,0x00003FFE
+data8 0x82E308654361C4C6,0x0000BFE2
+data8 0x92492453A51BE0AF,0x00003FFC
+data8 0xAAAAAB73A0CFD29F,0x0000BFFC
+data8 0xCCCCCCCCCCCE3872,0x00003FFC
+data8 0xFFFFFFFFFFFFB4FB,0x0000BFFC
+data8 0xAAAAAAAAAAAAAAAB,0x00003FFD
+data8 0x8000000000000000,0x0000BFFE
+LOCAL_OBJECT_END(Constants_log_80_Q)
+
+LOCAL_OBJECT_START(Constants_log_80_Z_G_H_h1)
+// Z1 - 16 bit fixed, G1 and H1 IEEE single, h1 IEEE double
 data4 0x00008000,0x3F800000,0x00000000,0x00000000
-data4 0x00000000,0x00000000,0x00000000,0x00000000 
+data4 0x00000000,0x00000000,0x00000000,0x00000000
 data4 0x00007879,0x3F70F0F0,0x3D785196,0x00000000
 data4 0xEBA0E0D1,0x8B1D330B,0x00003FDA,0x00000000
 data4 0x000071C8,0x3F638E38,0x3DF13843,0x00000000
 data4 0x9EADD553,0xE2AF365E,0x00003FE2,0x00000000
 data4 0x00006BCB,0x3F579430,0x3E2FF9A0,0x00000000
-data4 0x752F34A2,0xF585FEC3,0x0000BFE3,0x00000000  
+data4 0x752F34A2,0xF585FEC3,0x0000BFE3,0x00000000
 data4 0x00006667,0x3F4CCCC8,0x3E647FD6,0x00000000
-data4 0x893B03F3,0xF3546435,0x00003FE2,0x00000000  
-data4 0x00006187,0x3F430C30,0x3E8B3AE7,0x00000000 
-data4 0x39CDD2AC,0xBABA62E0,0x00003FE4,0x00000000 
-data4 0x00005D18,0x3F3A2E88,0x3EA30C68,0x00000000 
+data4 0x893B03F3,0xF3546435,0x00003FE2,0x00000000
+data4 0x00006187,0x3F430C30,0x3E8B3AE7,0x00000000
+data4 0x39CDD2AC,0xBABA62E0,0x00003FE4,0x00000000
+data4 0x00005D18,0x3F3A2E88,0x3EA30C68,0x00000000
 data4 0x457978A1,0x8718789F,0x00003FE2,0x00000000
-data4 0x0000590C,0x3F321640,0x3EB9CEC8,0x00000000 
-data4 0x3185E56A,0x9442DF96,0x0000BFE4,0x00000000 
-data4 0x00005556,0x3F2AAAA8,0x3ECF9927,0x00000000 
-data4 0x2BBE2CBD,0xCBF9A4BF,0x00003FE4,0x00000000 
-data4 0x000051EC,0x3F23D708,0x3EE47FC5,0x00000000 
-data4 0x852D5935,0xF3537535,0x00003FE3,0x00000000 
-data4 0x00004EC5,0x3F1D89D8,0x3EF8947D,0x00000000 
-data4 0x46CDF32F,0xA1F1E699,0x0000BFDF,0x00000000 
-data4 0x00004BDB,0x3F17B420,0x3F05F3A1,0x00000000 
-data4 0xD8484CE3,0x84A61856,0x00003FE4,0x00000000 
+data4 0x0000590C,0x3F321640,0x3EB9CEC8,0x00000000
+data4 0x3185E56A,0x9442DF96,0x0000BFE4,0x00000000
+data4 0x00005556,0x3F2AAAA8,0x3ECF9927,0x00000000
+data4 0x2BBE2CBD,0xCBF9A4BF,0x00003FE4,0x00000000
+data4 0x000051EC,0x3F23D708,0x3EE47FC5,0x00000000
+data4 0x852D5935,0xF3537535,0x00003FE3,0x00000000
+data4 0x00004EC5,0x3F1D89D8,0x3EF8947D,0x00000000
+data4 0x46CDF32F,0xA1F1E699,0x0000BFDF,0x00000000
+data4 0x00004BDB,0x3F17B420,0x3F05F3A1,0x00000000
+data4 0xD8484CE3,0x84A61856,0x00003FE4,0x00000000
 data4 0x00004925,0x3F124920,0x3F0F4303,0x00000000
-data4 0xFF28821B,0xC7DD97E0,0x0000BFE2,0x00000000    
-data4 0x0000469F,0x3F0D3DC8,0x3F183EBF,0x00000000 
-data4 0xEF1FD32F,0xD3C4A887,0x00003FE3,0x00000000  
-data4 0x00004445,0x3F088888,0x3F20EC80,0x00000000 
-data4 0x464C76DA,0x84672BE6,0x00003FE5,0x00000000 
+data4 0xFF28821B,0xC7DD97E0,0x0000BFE2,0x00000000
+data4 0x0000469F,0x3F0D3DC8,0x3F183EBF,0x00000000
+data4 0xEF1FD32F,0xD3C4A887,0x00003FE3,0x00000000
+data4 0x00004445,0x3F088888,0x3F20EC80,0x00000000
+data4 0x464C76DA,0x84672BE6,0x00003FE5,0x00000000
 data4 0x00004211,0x3F042108,0x3F29516A,0x00000000
-data4 0x18835FB9,0x9A43A511,0x0000BFE5,0x00000000 
-ASM_SIZE_DIRECTIVE(Constants_log_80_Z_G_H_h1)
-
-.align 64
-Constants_log_80_Z_G_H_h2:
-ASM_TYPE_DIRECTIVE(Constants_log_80_Z_G_H_h2,@object)
-// Z2 - 16 bit fixed, G2 and H2 IEEE single, h2 IEEE double   
-data4 0x00008000,0x3F800000,0x00000000,0x00000000 
-data4 0x00000000,0x00000000,0x00000000,0x00000000 
-data4 0x00007F81,0x3F7F00F8,0x3B7F875D,0x00000000 
+data4 0x18835FB9,0x9A43A511,0x0000BFE5,0x00000000
+LOCAL_OBJECT_END(Constants_log_80_Z_G_H_h1)
+
+LOCAL_OBJECT_START(Constants_log_80_Z_G_H_h2)
+// Z2 - 16 bit fixed, G2 and H2 IEEE single, h2 IEEE double
+data4 0x00008000,0x3F800000,0x00000000,0x00000000
+data4 0x00000000,0x00000000,0x00000000,0x00000000
+data4 0x00007F81,0x3F7F00F8,0x3B7F875D,0x00000000
 data4 0x211398BF,0xAD08B116,0x00003FDB,0x00000000
-data4 0x00007F02,0x3F7E03F8,0x3BFF015B,0x00000000 
-data4 0xC376958E,0xB106790F,0x00003FDE,0x00000000 
-data4 0x00007E85,0x3F7D08E0,0x3C3EE393,0x00000000 
-data4 0x79A7679A,0xFD03F242,0x0000BFDA,0x00000000 
-data4 0x00007E08,0x3F7C0FC0,0x3C7E0586,0x00000000 
-data4 0x05E7AE08,0xF03F81C3,0x0000BFDF,0x00000000 
-data4 0x00007D8D,0x3F7B1880,0x3C9E75D2,0x00000000 
+data4 0x00007F02,0x3F7E03F8,0x3BFF015B,0x00000000
+data4 0xC376958E,0xB106790F,0x00003FDE,0x00000000
+data4 0x00007E85,0x3F7D08E0,0x3C3EE393,0x00000000
+data4 0x79A7679A,0xFD03F242,0x0000BFDA,0x00000000
+data4 0x00007E08,0x3F7C0FC0,0x3C7E0586,0x00000000
+data4 0x05E7AE08,0xF03F81C3,0x0000BFDF,0x00000000
+data4 0x00007D8D,0x3F7B1880,0x3C9E75D2,0x00000000
 data4 0x049EB22F,0xD1B87D3C,0x00003FDE,0x00000000
-data4 0x00007D12,0x3F7A2328,0x3CBDC97A,0x00000000 
-data4 0x3A9E81E0,0xFABC8B95,0x00003FDF,0x00000000 
+data4 0x00007D12,0x3F7A2328,0x3CBDC97A,0x00000000
+data4 0x3A9E81E0,0xFABC8B95,0x00003FDF,0x00000000
 data4 0x00007C98,0x3F792FB0,0x3CDCFE47,0x00000000
-data4 0x7C4B5443,0xF5F3653F,0x00003FDF,0x00000000 
-data4 0x00007C20,0x3F783E08,0x3CFC15D0,0x00000000 
-data4 0xF65A1773,0xE78AB204,0x00003FE0,0x00000000  
-data4 0x00007BA8,0x3F774E38,0x3D0D874D,0x00000000 
-data4 0x7B8EF695,0xDB7CBFFF,0x0000BFE0,0x00000000 
-data4 0x00007B31,0x3F766038,0x3D1CF49B,0x00000000 
-data4 0xCF773FB3,0xC0241AEA,0x0000BFE0,0x00000000 
-data4 0x00007ABB,0x3F757400,0x3D2C531D,0x00000000 
-data4 0xC9539FDF,0xFC8F4D48,0x00003FE1,0x00000000  
-data4 0x00007A45,0x3F748988,0x3D3BA322,0x00000000 
-data4 0x954665C2,0x9CD035FB,0x0000BFE1,0x00000000  
-data4 0x000079D1,0x3F73A0D0,0x3D4AE46F,0x00000000 
-data4 0xDD367A30,0xEC9017C7,0x00003FE1,0x00000000 
-data4 0x0000795D,0x3F72B9D0,0x3D5A1756,0x00000000 
-data4 0xCB11189C,0xEE6625D3,0x0000BFE1,0x00000000 
-data4 0x000078EB,0x3F71D488,0x3D693B9D,0x00000000 
+data4 0x7C4B5443,0xF5F3653F,0x00003FDF,0x00000000
+data4 0x00007C20,0x3F783E08,0x3CFC15D0,0x00000000
+data4 0xF65A1773,0xE78AB204,0x00003FE0,0x00000000
+data4 0x00007BA8,0x3F774E38,0x3D0D874D,0x00000000
+data4 0x7B8EF695,0xDB7CBFFF,0x0000BFE0,0x00000000
+data4 0x00007B31,0x3F766038,0x3D1CF49B,0x00000000
+data4 0xCF773FB3,0xC0241AEA,0x0000BFE0,0x00000000
+data4 0x00007ABB,0x3F757400,0x3D2C531D,0x00000000
+data4 0xC9539FDF,0xFC8F4D48,0x00003FE1,0x00000000
+data4 0x00007A45,0x3F748988,0x3D3BA322,0x00000000
+data4 0x954665C2,0x9CD035FB,0x0000BFE1,0x00000000
+data4 0x000079D1,0x3F73A0D0,0x3D4AE46F,0x00000000
+data4 0xDD367A30,0xEC9017C7,0x00003FE1,0x00000000
+data4 0x0000795D,0x3F72B9D0,0x3D5A1756,0x00000000
+data4 0xCB11189C,0xEE6625D3,0x0000BFE1,0x00000000
+data4 0x000078EB,0x3F71D488,0x3D693B9D,0x00000000
 data4 0xBE11C424,0xA49C8DB5,0x0000BFE0,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_log_80_Z_G_H_h2)
- 
-.align 64
-Constants_log_80_h3_G_H:
-ASM_TYPE_DIRECTIVE(Constants_log_80_h3_G_H,@object)
-// h3 IEEE double extended, H3 and G3 IEEE single   
-data4 0x112666B0,0xAAACAAB1,0x00003FD3,0x3F7FFC00 
+LOCAL_OBJECT_END(Constants_log_80_Z_G_H_h2)
+
+LOCAL_OBJECT_START(Constants_log_80_h3_G_H)
+// h3 IEEE double extended, H3 and G3 IEEE single
+data4 0x112666B0,0xAAACAAB1,0x00003FD3,0x3F7FFC00
 data4 0x9B7FAD21,0x90051030,0x00003FD8,0x3F7FF400
-data4 0xF4D783C4,0xA6B46F46,0x00003FDA,0x3F7FEC00 
-data4 0x11C6DDCA,0xDA148D88,0x0000BFD8,0x3F7FE400 
+data4 0xF4D783C4,0xA6B46F46,0x00003FDA,0x3F7FEC00
+data4 0x11C6DDCA,0xDA148D88,0x0000BFD8,0x3F7FE400
 data4 0xCA964D95,0xCE65C1D8,0x0000BFD8,0x3F7FDC00
-data4 0x23412D13,0x883838EE,0x0000BFDB,0x3F7FD400 
-data4 0x983ED687,0xB7E5CFA1,0x00003FDB,0x3F7FCC08 
-data4 0xE3C3930B,0xDBE23B16,0x0000BFD9,0x3F7FC408 
-data4 0x48AA4DFC,0x9B92F1FC,0x0000BFDC,0x3F7FBC10 
-data4 0xCE9C8F7E,0x9A8CEB15,0x0000BFD9,0x3F7FB410 
-data4 0x0DECE74A,0x8C220879,0x00003FDC,0x3F7FAC18 
+data4 0x23412D13,0x883838EE,0x0000BFDB,0x3F7FD400
+data4 0x983ED687,0xB7E5CFA1,0x00003FDB,0x3F7FCC08
+data4 0xE3C3930B,0xDBE23B16,0x0000BFD9,0x3F7FC408
+data4 0x48AA4DFC,0x9B92F1FC,0x0000BFDC,0x3F7FBC10
+data4 0xCE9C8F7E,0x9A8CEB15,0x0000BFD9,0x3F7FB410
+data4 0x0DECE74A,0x8C220879,0x00003FDC,0x3F7FAC18
 data4 0x2F053150,0xB25CA912,0x0000BFDA,0x3F7FA420
-data4 0xD9A5BE20,0xA5876555,0x00003FDB,0x3F7F9C20 
-data4 0x2053F087,0xC919BB6E,0x00003FD9,0x3F7F9428 
-data4 0x041E9A77,0xB70BDA79,0x00003FDC,0x3F7F8C30 
-data4 0xEA1C9C30,0xF18A5C08,0x00003FDA,0x3F7F8438 
-data4 0x796D89E5,0xA3790D84,0x0000BFDD,0x3F7F7C40 
-data4 0xA2915A3A,0xE1852369,0x0000BFDD,0x3F7F7448 
-data4 0xA39ED868,0xD803858F,0x00003FDC,0x3F7F6C50 
-data4 0x9417EBB7,0xB2EEE356,0x0000BFDD,0x3F7F6458 
-data4 0x9BB0D07F,0xED5C1F8A,0x0000BFDC,0x3F7F5C68 
-data4 0xE87C740A,0xD6D201A0,0x0000BFDD,0x3F7F5470 
-data4 0x1CA74025,0xE8DEBF5E,0x00003FDC,0x3F7F4C78 
+data4 0xD9A5BE20,0xA5876555,0x00003FDB,0x3F7F9C20
+data4 0x2053F087,0xC919BB6E,0x00003FD9,0x3F7F9428
+data4 0x041E9A77,0xB70BDA79,0x00003FDC,0x3F7F8C30
+data4 0xEA1C9C30,0xF18A5C08,0x00003FDA,0x3F7F8438
+data4 0x796D89E5,0xA3790D84,0x0000BFDD,0x3F7F7C40
+data4 0xA2915A3A,0xE1852369,0x0000BFDD,0x3F7F7448
+data4 0xA39ED868,0xD803858F,0x00003FDC,0x3F7F6C50
+data4 0x9417EBB7,0xB2EEE356,0x0000BFDD,0x3F7F6458
+data4 0x9BB0D07F,0xED5C1F8A,0x0000BFDC,0x3F7F5C68
+data4 0xE87C740A,0xD6D201A0,0x0000BFDD,0x3F7F5470
+data4 0x1CA74025,0xE8DEBF5E,0x00003FDC,0x3F7F4C78
 data4 0x1F34A7EB,0x9A995A97,0x0000BFDC,0x3F7F4488
-data4 0x359EED97,0x9CB0F742,0x0000BFDA,0x3F7F3C90 
-data4 0xBBC6A1C8,0xD6F833C2,0x0000BFDD,0x3F7F34A0 
-data4 0xE71090EC,0xE1F68F2A,0x00003FDC,0x3F7F2CA8 
-data4 0xC160A74F,0xD1881CF1,0x0000BFDB,0x3F7F24B8 
-data4 0xD78CB5A4,0x9AD05AE2,0x00003FD6,0x3F7F1CC8 
-data4 0x9A77DC4B,0xE658CB8E,0x0000BFDD,0x3F7F14D8 
-data4 0x6BD6D312,0xBA281296,0x00003FDC,0x3F7F0CE0 
-data4 0xF95210D0,0xB478BBEB,0x0000BFDB,0x3F7F04F0 
-data4 0x38800100,0x39400480,0x39A00640,0x39E00C41 // H's start here 
-data4 0x3A100A21,0x3A300F22,0x3A4FF51C,0x3A6FFC1D 
+data4 0x359EED97,0x9CB0F742,0x0000BFDA,0x3F7F3C90
+data4 0xBBC6A1C8,0xD6F833C2,0x0000BFDD,0x3F7F34A0
+data4 0xE71090EC,0xE1F68F2A,0x00003FDC,0x3F7F2CA8
+data4 0xC160A74F,0xD1881CF1,0x0000BFDB,0x3F7F24B8
+data4 0xD78CB5A4,0x9AD05AE2,0x00003FD6,0x3F7F1CC8
+data4 0x9A77DC4B,0xE658CB8E,0x0000BFDD,0x3F7F14D8
+data4 0x6BD6D312,0xBA281296,0x00003FDC,0x3F7F0CE0
+data4 0xF95210D0,0xB478BBEB,0x0000BFDB,0x3F7F04F0
+data4 0x38800100,0x39400480,0x39A00640,0x39E00C41 // H's start here
+data4 0x3A100A21,0x3A300F22,0x3A4FF51C,0x3A6FFC1D
 data4 0x3A87F20B,0x3A97F68B,0x3AA7EB86,0x3AB7E101
-data4 0x3AC7E701,0x3AD7DD7B,0x3AE7D474,0x3AF7CBED 
-data4 0x3B03E1F3,0x3B0BDE2F,0x3B13DAAA,0x3B1BD766 
-data4 0x3B23CC5C,0x3B2BC997,0x3B33C711,0x3B3BBCC6 
-data4 0x3B43BAC0,0x3B4BB0F4,0x3B53AF6D,0x3B5BA620 
-data4 0x3B639D12,0x3B6B9444,0x3B7393BC,0x3B7B8B6D 
-ASM_SIZE_DIRECTIVE(Constants_log_80_h3_G_H)
-
-.align 64
-Constant_half:
-ASM_TYPE_DIRECTIVE(Constant_half,@object)
-data4 0x00000000,0x80000000,0x00003FFE
-ASM_SIZE_DIRECTIVE(Constant_half)
-
-GR_Expo_Range       = r32
-GR_Flag             = r33
+data4 0x3AC7E701,0x3AD7DD7B,0x3AE7D474,0x3AF7CBED
+data4 0x3B03E1F3,0x3B0BDE2F,0x3B13DAAA,0x3B1BD766
+data4 0x3B23CC5C,0x3B2BC997,0x3B33C711,0x3B3BBCC6
+data4 0x3B43BAC0,0x3B4BB0F4,0x3B53AF6D,0x3B5BA620
+data4 0x3B639D12,0x3B6B9444,0x3B7393BC,0x3B7B8B6D
+LOCAL_OBJECT_END(Constants_log_80_h3_G_H)
+
+GR_sig_inv_ln2      = r14
+GR_rshf_2to51       = r15
+GR_exp_2tom51       = r16
+GR_rshf             = r17
+GR_exp_half         = r18
+GR_sign_mask        = r19
+GR_exp_square_oflow = r20
+GR_exp_square_uflow = r21
+GR_exp_ynear1_oflow = r22
+GR_exp_ynear1_uflow = r23
+GR_signif_Z         = r24
+
+GR_signexp_x        = r32
+
+GR_exp_x            = r33
+
 GR_Table_Ptr        = r34
 
 GR_Table_Ptr1       = r35
-GR_BIAS             = r35
 
 GR_Index1           = r36
-GR_sign_mask        = r36
 
 GR_Index2           = r37
 GR_Expo_X           = r37
 
-GR_signif_Z         = r38
 GR_M                = r38
 
 GR_X_0              = r39
@@ -620,45 +614,49 @@ GR_k                = r44
 
 GR_Big_Pos_Exp      = r45
 
+GR_exp_pos_max      = r46
 
-GR_BIAS_p_k         = r47
-GR_BIASed_exp_y     = r47
+GR_exp_bias_p_k     = r47
 
-GR_Big_Neg_Exp      = r48
 GR_Index3           = r48
 GR_temp             = r48
 
 GR_vsm_expo         = r49
-GR_y_sign           = r49
 
 GR_T1_ptr           = r50
+GR_P_ptr1           = r50
 GR_T2_ptr           = r51
+GR_P_ptr2           = r51
 GR_N_fix            = r52
 GR_exp_y            = r53
 GR_signif_y         = r54
-GR_exp_and_sign_y   = r55
+GR_signexp_y        = r55
+GR_fraction_y       = r55
 GR_low_order_bit    = r56
-GR_get_exp_mask     = r57
-GR_exponent_zero    = r58
-
-// ** Registers for unwind support
+GR_exp_mask         = r57
+GR_exp_bias         = r58
+GR_y_sign           = r59
+GR_table_base       = r60
+GR_ptr_exp_Arg      = r61
+GR_Delta_Exp        = r62
+GR_Special_Exp      = r63
+GR_exp_neg_max      = r64
+GR_Big_Neg_Exp      = r65
+
+//** Registers for unwind support
 
 GR_SAVE_PFS         = r59
 GR_SAVE_B0          = r60
 GR_SAVE_GP          = r61
-GR_Parameter_X      = r62 
-GR_Parameter_Y      = r63 
-GR_Parameter_RESULT = r64 
-GR_Parameter_TAG    = r65 
+GR_Parameter_X      = r62
+GR_Parameter_Y      = r63
+GR_Parameter_RESULT = r64
+GR_Parameter_TAG    = r65
 
-FR_X      = f8
-FR_Y      = f9
-FR_RESULT = f99
-
-// **
+//**
 
 FR_Input_X          = f8
-FR_Output           = f8
+FR_Result           = f8
 FR_Input_Y          = f9
 
 FR_Neg              = f10
@@ -671,7 +669,6 @@ FR_poly_hi          = f11
 
 FR_Sgn              = f12
 
-FR_Neg_X            = f13
 FR_half_W           = f13
 
 FR_X_cor            = f14
@@ -698,13 +695,11 @@ FR_Scale            = f36
 FR_G_1              = f37
 FR_G                = f37
 FR_Wsq              = f37
-FR_L_Inv            = f37
 FR_temp             = f37
 
 FR_H_1              = f38
 FR_H                = f38
 FR_W4               = f38
-FR_float_N          = f38
 
 FR_h                = f39
 FR_h_1              = f39
@@ -720,9 +715,7 @@ FR_L_lo             = f41
 FR_A_1              = f41
 
 FR_h_2              = f42
-FR_P_6              = f42
 
-FR_abs_W            = f43
 FR_W1               = f43
 
 FR_G_3              = f44
@@ -740,7 +733,6 @@ FR_H_3              = f47
 
 FR_float_N          = f48
 
-FR_P_4              = f49
 FR_A_2              = f49
 
 FR_Q_4              = f50
@@ -768,7 +760,6 @@ FR_Two              = f56
 FR_Big              = f57
 
 FR_neg_2_mK         = f58
-FR_NBig             = f58
 
 FR_r                = f59
 
@@ -777,1652 +768,1253 @@ FR_poly_lo          = f60
 FR_poly             = f61
 
 FR_P_5              = f62
+FR_Result_small     = f62
 
 FR_rsq              = f63
 
-FR_Result           = f99
-FR_Result_small     = f100
-FR_Result_big       = f101
+FR_Delta            = f64
 
-.section .text
-.proc powl#
-.global powl#
-.align 64 
+FR_save_Input_X     = f65
+FR_norm_X           = f66
+FR_norm_Y           = f67
+FR_Y_lo_2           = f68
 
-powl: 
-{ .mfi
-alloc  GR_Expo_Range = ar.pfs,0,30,4,0
-(p0)   fclass.m.unc p7, p13 =  FR_Input_Y, 0x1E7 
-nop.i 0
-}
-{ .mfi
-(p0)   getf.exp GR_exp_and_sign_y = FR_Input_Y 
+FR_P_6              = f69
+FR_Result_big       = f69
+
+FR_RSHF_2TO51       = f70
+FR_INV_LN2_2TO63    = f71
+FR_2TOM51           = f72
+FR_RSHF             = f73
+FR_TMP1             = f74
+FR_TMP2             = f75
+FR_TMP3             = f76
+FR_Tscale           = f77
+FR_P_4              = f78
+FR_NBig             = f79
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(powl)
 //
-//     Save State
+//     Get significand of x.  It is the critical path.
 //
-(p0)   fclass.m.unc p6, p12 =  FR_Input_X, 0x1E7 
-nop.i 0
-};;
 { .mfi
-(p0)   getf.sig GR_signif_y = FR_Input_Y 
-(p0)   fcmp.eq.unc.s1 p12, p13 =  FR_Input_X, f1 
-nop.i 0
+      getf.sig GR_signif_Z = FR_Input_X    // Get significand of x
+      fclass.m p11, p12 = FR_Input_X, 0x0b // Test x unorm
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Check for y = 1 
-//     Identify EM unsupporteds.
-//     Load FR_half = .5
-//
-(p0)   fadd.s1 FR_Two = f1, f1 
-//
-//     Load 1/2 in GP register
-//
-nop.i 0 
+      nop.m 999
+      fnorm.s1 FR_norm_X = FR_Input_X      // Normalize x
+      mov GR_exp_half = 0xffff - 1         // Exponent for 0.5
 }
 ;;
 
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constant_half#), gp
-      nop.i 999
+{ .mfi
+      alloc  r32 = ar.pfs,0,30,4,0
+      fclass.m p7, p0 =  FR_Input_Y, 0x1E7 // Test y natval, nan, inf, zero
+      mov GR_exp_pos_max = 0x13fff         // Max exponent for pos oflow test
+}
+{ .mfi
+      addl GR_table_base = @ltoff(Constants_exp_64_Arg#), gp // Ptr to tables
+      fnorm.s1 FR_norm_Y = FR_Input_Y      // Normalize y
+      mov GR_exp_neg_max = 0x33fff         // Max exponent for neg oflow test
 }
 ;;
 
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
-      nop.m 999
-      nop.i 999
+{ .mfi
+      getf.exp GR_signexp_y = FR_Input_Y   // Get sign and exp of y
+(p12) fclass.m p11, p0 =  FR_Input_Y, 0x0b // Test y unorm
+      mov GR_sign_mask = 0x20000           // Sign mask
+}
+{ .mfi
+      ld8 GR_table_base = [GR_table_base]  // Get base address for tables
+      fadd.s1 FR_Two = f1, f1              // Form 2.0 for square test
+      mov GR_exp_mask = 0x1FFFF            // Exponent mask
 }
 ;;
 
-{ .mlx
-(p0)   ldfe FR_Half =[GR_Table_Ptr],0
-(p0)   movl GR_get_exp_mask = 0x1FFFF ;; 
+{ .mfi
+      getf.sig GR_signif_y = FR_Input_Y    // Get significand of y
+      fclass.m p6, p0 =  FR_Input_X, 0x1E7 // Test x natval, nan, inf, zero
+      nop.i 999
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)   fclass.nm.unc p9, p15 =  FR_Input_Y, 0x1FF 
-//
-//     Create FR_Two = 2
-//     Get exp and significand of Y
-//     Crate Masks
-//     sgn = 1
-//
-(p0)   and GR_exp_y = GR_get_exp_mask,GR_exp_and_sign_y
+      getf.exp GR_signexp_x = FR_Input_X   // Get signexp of x
+      fmerge.s FR_save_Input_X = FR_Input_X, FR_Input_X
+      extr.u GR_Index1 = GR_signif_Z, 59, 4  // Extract upper 4 signif bits of x
 }
-{ .mlx
-	nop.m 999
-(p0)   movl GR_exponent_zero = 0xFFFF ;; 
+{ .mfb
+      setf.exp FR_Half = GR_exp_half       // Load half
+      nop.f 999
+(p11) br.cond.spnt  POWL_DENORM            // Branch if x or y denorm/unorm
 }
+;;
+
+// Return here from POWL_DENORM
+POWL_COMMON:
 { .mfi
-	nop.m 999
-(p0)   mov FR_Sgn = f1 
-	nop.i 999
+      setf.exp FR_Big = GR_exp_pos_max     // Form big pos value for oflow test
+      fclass.nm p11, p0 = FR_Input_Y, 0x1FF // Test Y unsupported
+      shl GR_Index1 = GR_Index1,5          // Adjust index1 pointer x 32
 }
 { .mfi
-	nop.m 999
-(p0)   fcmp.eq.unc.s1 p10, p11 =  FR_Input_Y, f1 
-	nop.i 999 ;;
+      add GR_Table_Ptr = 0x7c0, GR_table_base // Constants_log_80_Z_G_H_h1
+      fma.s1 FR_Sgn = f1,f1,f0             // Assume result positive
+      mov GR_exp_bias = 0xFFFF             // Form exponent bias
 }
-{ .mfb
-	nop.m 999
+;;
+
 //
 //     Identify NatVals, NaNs, Infs, and Zeros.
-//     Load Half
 //
-(p0)   fclass.nm.unc p8, p14 =  FR_Input_X, 0x1FF 
-//      
-//     Remove sign bit from exponent of y.
-//     Check for x = 1 
-//
-(p6)   br.cond.spnt L(POWL_64_SPECIAL) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p7)   br.cond.spnt L(POWL_64_SPECIAL) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p8)   br.cond.spnt L(POWL_64_UNSUPPORT) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)   br.cond.spnt L(POWL_64_UNSUPPORT) ;; 
-}
-{ .mfi
-(p0)   cmp.lt.unc  p9, p0 = GR_exp_y,GR_exponent_zero 
-(p0)   fcmp.lt.unc.s1 p6, p13  =  FR_Input_X, f0 
 //
+//     Remove sign bit from exponent of y.
+//     Check for x = 1
 //     Branch on Infs, Nans, Zeros, and Natvals
 //     Check to see that exponent < 0
 //
-(p0)   sub GR_exp_y = GR_exp_y,GR_exponent_zero
-}
-//     x not zero, is y ==2? 
 { .mfi
-	nop.m 999
-(p11)  fcmp.eq.unc.s1 p7, p14 =  FR_Input_Y, FR_Two 
-	nop.i 999 ;;
+      setf.exp FR_NBig = GR_exp_neg_max    // Form big neg value for oflow test
+      fclass.nm p8, p0 =  FR_Input_X, 0x1FF  // Test X unsupported
+      and GR_exp_y = GR_exp_mask,GR_signexp_y // Get biased exponent of y
 }
 { .mfb
-	nop.m 999
-(p9)   fcmp.lt.unc.s1 p9, p0   =  FR_Input_X, f0 
-(p7)   br.cond.spnt L(POWL_64_SQUARE) ;;   // Branch if x not zero and y=2
-}
-{ .mfi
-	nop.m 999
-(p6)   fmerge.ns FR_Neg_X = FR_Input_X, FR_Input_X 
-	nop.i 999 ;;
+      add GR_Index1 = GR_Index1,GR_Table_Ptr
+      nop.f 999
+(p6)  br.cond.spnt POWL_64_SPECIAL         // Branch if x natval, nan, inf, zero
 }
-{ .mfi
-	nop.m 999
-(p10)  fmpy.s0 FR_Result = FR_Input_X, f1 
-//
-//     For y = 1, compute result = x 
-//     For x = 1, compute 1 
-//     When Y is one return X and possible raise 
-//     denormal operand exception.
-//     Remove exponent BIAS
+;;
+
+//     load Z_1 from Index1
+
+// There is logic starting here to determine if y is an integer when x < 0.
+// If 0 < |y| < 1 then clearly y is not an integer.
+// If |y| > 1, then the significand of y is shifted left by the size of
+//    the exponent of y.  This preserves the lsb of the integer part + the
+//    fractional bits.  The lsb of the integer can be tested to determine if
+//    the integer is even or odd.  The fractional bits can be tested.  If zero,
+//    then y is an integer.
 //
-(p6)   shl GR_exp_and_sign_y=  GR_signif_y,GR_exp_y ;; 
-}
 { .mfi
-(p9)   or  GR_exp_and_sign_y = 0xF,GR_signif_y 
-(p12)  fma.s0 FR_Result = FR_Input_Y, f0, f1 
-	nop.i 999 ;;
+      ld2 GR_Z_1 =[GR_Index1],4            // Load Z_1
+      fmerge.s FR_Z = f0, FR_norm_X        // Z = |x|
+      extr.u GR_X_0 = GR_signif_Z, 49, 15  // Extract X_0 from significand
 }
-{ .mii
-	nop.m 999
-(p6)   extr.u GR_exp_y = GR_exp_and_sign_y,63,1 ;; 
-(p6)   cmp.ne.unc  p9, p0 =  GR_exp_y, r0 
+{ .mfb
+      cmp.lt p9, p0 = GR_exp_y,GR_exp_bias // Test 0 < |y| < 1
+      nop.f 999
+(p7)  br.cond.spnt POWL_64_SPECIAL         // Branch if y natval, nan, inf, zero
 }
-{ .mii
-	nop.m 999
-//
-//     Both predicates can be set. 
-//     Don't consider  y's < 1.
-//
-(p6)   shl GR_signif_y=  GR_exp_and_sign_y,1 ;; 
-//
-//     Is shift off integer part of y.
-//     Get y's  even or odd bit.
-//
-(p6)   cmp.ne.unc  p8, p0  =  GR_signif_y, r0 
+;;
+
+{ .mfb
+      ldfs  FR_G_1 = [GR_Index1],4         // Load G_1
+      fcmp.eq.s1 p10, p0 =  FR_Input_Y, f1 // Test Y = +1.0
+(p8)  br.cond.spnt POWL_64_UNSUPPORT       // Branch if x unsupported
 }
-{ .mib
-	nop.m 999
-	nop.i 999
+;;
+
 //
-//     Is the fractional part of the y = 0?
-//     Is the integer even or odd. 
+//     X_0  = High order 15 bit of Z
 //
-(p10)  br.cond.spnt L(POWL_64_RETURN) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p12)  br.cond.spnt L(POWL_64_RETURN) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p8)   br.cond.spnt L(POWL_64_XNEG) ;;
+{ .mfb
+      ldfs  FR_H_1 = [GR_Index1],8             // Load H_1
+(p9)  fcmp.lt.unc.s1 p9, p0 = FR_Input_X, f0   // Test x<0, 0 <|y|<1
+(p11) br.cond.spnt POWL_64_UNSUPPORT           // Branch if y unsupported
 }
+;;
+
 { .mfi
-	nop.m 999
-(p9)   fmerge.ns FR_Sgn = FR_Sgn, FR_Sgn 
-	nop.i 999
+      ldfe FR_h_1 = [GR_Index1]                // Load h_1
+      fcmp.eq.s1 p7, p0 =  FR_Input_Y, FR_Two  // Test y = 2.0
+      pmpyshr2.u GR_X_1 = GR_X_0,GR_Z_1,15     // X_1 = X_0 * Z_1 (bits 15-30)
+                                               // Wait 4 cycles to use result
 }
 { .mfi
-	nop.m 999
-(p0)   fcmp.eq.unc.s0 p11, p0 =  FR_Input_Y, FR_Half 
-	nop.i 999 ;;
+      add GR_Table_Ptr = 0x9c0, GR_table_base  // Constants_log_80_Z_G_H_h2
+      nop.f 999
+      sub GR_exp_y = GR_exp_y,GR_exp_bias      // Get true exponent of y
 }
+;;
+
 //
-//     Raise possible denormal operand exception for both
-//     X and Y.
+//      Branch for (x < 0) and Y not an integer.
 //
 { .mfb
-	nop.m 999
-//
-//     Branch for (x < 0) and Y not an integer.
-//
-(p0)   fcmp.eq.unc.s0 p12, p0 =  FR_Input_X, f1 
-//
-//     For x < 0 and y integer, make x positive 
-//     For x < 0 and y odd integer,, set sign = -1.
-//
-(p11)  br.cond.spnt L(POWL_64_SQRT) ;; 
-}
-{ .mmf
-(p0)   cmp.eq.unc  p15, p14 =  r0, r0 
-	nop.m 999
-(p13)  fnorm.s1 FR_Z = FR_Input_X ;; 
-}
-{ .mfi
-	nop.m 999
-(p6)   fnorm.s1 FR_Z = FR_Neg_X 
-	nop.i 999
+      nop.m 999
+      fcmp.lt.s1 p6, p0  =  FR_Input_X, f0     // Test x < 0
+(p9)  br.cond.spnt POWL_64_XNEG                // Branch if x < 0, 0 < |y| < 1
 }
 ;;
 
-//
-//     Branch to embedded sqrt(x)
-//
-//
-//     Computes ln( x ) to extra precision 
-//     Input  FR 1: FR_X            
-//     Output FR 2: FR_Y_hi  
-//     Output FR 3: FR_Y_lo  
-//     Output PR 1: PR_Safe  
-//
-
-{ .mmi
+{ .mfi
       nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_log_80_Z_G_H_h1#), gp
+      fcmp.eq.s1 p12, p0 =  FR_Input_X, f1     // Test x=+1.0
       nop.i 999
 }
+{ .mfb
+      nop.m 999
+      fsub.s1 FR_W = FR_Z, f1                  // W = Z - 1
+(p7)  br.cond.spnt POWL_64_SQUARE              // Branch if y=2
+}
 ;;
 
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
+{ .mfi
       nop.m 999
-      nop.i 999
+(p10) fmpy.s0 FR_Result = FR_Input_X, f1       // If y=+1.0, result=x
+(p6)  shl GR_fraction_y=  GR_signif_y,GR_exp_y // Get lsb of int + fraction
+                                               // Wait 4 cycles to use result
 }
 ;;
 
-
-{ .mlx
-	nop.m 999
-(p0)   movl GR_BIAS = 0x000000000000FFFF ;; 
-}
 { .mfi
-	nop.m 999
-(p0)   fsub.s1 FR_W = FR_Z, f1 
-	nop.i 999 ;;
-}
-//     
-//     Z = Norm(X) - both + and - case 
-//     Set Safe = True
-//     
-{ .mmb
-(p0)   getf.sig GR_signif_Z = FR_Z 
-(p0)   getf.exp GR_N =  FR_Z 
-	nop.b 999 ;;
-}
-{ .mii
-	nop.m 999
-//     
-//     Get significand of Z 
-//     W = Z - 1
-//     
-(p0)   extr.u GR_Index1 = GR_signif_Z, 59, 4 ;;  
-//     
-//     Index1 = High order 4 bits of Z
-//     X_0  = High order 15 bit of Z 
-//
-(p0)   shl GR_Index1 = GR_Index1,5 ;; 
-}
-{ .mfi
-	nop.m 999
-//     
-//     Add offset to Index1 ptr.
-//     
-(p0)   fabs FR_abs_W =  FR_W 
-//     
-//     BIAS = 0x000...FFFF
-//     Adjust Index1 ptr ( x 32) .
-//     
-(p0)   add GR_Index1 = GR_Index1,GR_Table_Ptr  
+      nop.m 999
+(p12) fma.s0 FR_Result = FR_Input_Y, f0, f1    // If x=1.0, result=1, chk denorm
+      extr.u GR_Index2 = GR_X_1, 6, 4          // Extract index2
 }
-{ .mmi
-	nop.m 999 ;;
-(p0)   ld2 GR_Z_1 =[GR_Index1],4
-(p0)   extr.u GR_X_0 = GR_signif_Z, 49, 15  
+;;
+
+//
+//     N = exponent of Z
+//
+{ .mib
+      getf.exp GR_N =  FR_Z                    // Get exponent of Z (also x)
+      shl GR_Index2=GR_Index2,5                // Index2  x 32 bytes
+(p10) br.ret.spnt  b0                          // Exit if y=+1.0
 }
 ;;
 
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_log_80_Z_G_H_h2#), gp
+{ .mib
+      add GR_Index2 = GR_Index2, GR_Table_Ptr  // Pointer to table 2
       nop.i 999
+(p12) br.ret.spnt  b0                          // Exit if x=+1.0
 }
 ;;
 
 { .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
-      nop.m 999
+      ld2 GR_Z_2 =[GR_Index2],4                // Load Z_2
+;;
+      ldfs  FR_G_2 = [GR_Index2],4             // Load G_2
       nop.i 999
 }
 ;;
 
-
-{ .mmi
-(p0)   ldfs  FR_G_1 = [GR_Index1],4 ;; 
-(p0)   ldfs  FR_H_1 = [GR_Index1],8 
-	nop.i 999 ;;
+{ .mii
+      ldfs  FR_H_2 = [GR_Index2],8             // Load H_2
+(p6)  tbit.nz.unc p9, p0 = GR_fraction_y, 63   // Test x<0 and y odd integer
+      add GR_Table_Ptr = 0xbcc, GR_table_base  // Constants_log_80_h3_G_H, G_3
 }
+;;
+
 //
-//     Adjust Index2 (x 32). 
+//      For x < 0 and y odd integer,, set sign = -1.
 //
 { .mfi
-(p0)   ldfe FR_h_1 = [GR_Index1],0 
-	nop.f 999
-(p0)   pmpyshr2.u GR_X_1 = GR_X_0,GR_Z_1,15 ;; 
-}
-{ .mmi
-	nop.m 999 ;;
-//
-//     load Z_1 from Index1
-//     abs_W = |W|
-//     Point to Table2 
-//
-(p0)   getf.exp GR_M = FR_abs_W 
-//
-//     M = M - BIAS 
-//     Load G_1 
-//     N = exponent of Z 
-//
-       nop.i 999;;
+      getf.exp GR_M = FR_W                      // Get signexp of W
+      nop.f 999
+      pmpyshr2.u GR_X_2 = GR_X_1,GR_Z_2,15      // X_2 = X_1 * Z_2 (bits 15-30)
 }
-{ .mmi
-       nop.m 999
-       nop.m 999
-       nop.i 999;;
+{ .mfi
+      ldfe FR_h_2 = [GR_Index2]                // Load h_2
+(p9)  fnma.s1 FR_Sgn = f1, f1, f0          // If x<0, y odd int, result negative
+      sub GR_N = GR_N, GR_exp_bias             // Get true exponent of x = N
 }
-{ .mmi
-       nop.m 999
-       nop.m 999
-       nop.i 999;;
+;;
+
+{ .mfi
+      add GR_Table_Ptr1 = 0xdc0, GR_table_base // Ptr to H_3
+      fcmp.eq.s0 p11, p0 = FR_Input_Y, FR_Half // Test y=0.5, also set denorm
+(p6)  shl GR_fraction_y=  GR_fraction_y, 1     // Shift left 1 to get fraction
 }
-{ .mmi
-        nop.m 999
-        nop.m 999
-(p0)   extr.u GR_Index2 = GR_X_1, 6, 4 ;;  
+;;
+
+{ .mmb
+      setf.sig FR_float_N = GR_N
+(p6)  cmp.ne.unc p8, p0 = GR_fraction_y, r0    // Test x<0 and y not integer
+(p8)  br.cond.spnt POWL_64_XNEG                // Branch if x<0 and y not int
 }
-{ .mii
-	nop.m 999
-//     
-//     Extract Index2 
-//     Load H_1
-//     Is -8 > M ?
+;;
+
 //
-(p0)   shl GR_Index2=GR_Index2,5 ;; 
-(p0)   add GR_Index2 = GR_Index2, GR_Table_Ptr  
-}
+//      Raise possible denormal operand exception for both X and Y.
+//      Set pointers in case |x| near 1
+//      Branch to embedded sqrt(x) if y=0.5
 //
-//     M = exponent of abs_W
-//     X_1 = X_0 * Z_1 
-//     
-{ .mii
-(p0)   sub GR_M = GR_M, GR_BIAS  
-	nop.i 999 ;;
-(p0)   cmp.gt.unc  p7, p14 =  -8, GR_M 
+{ .mfi
+      add GR_P_ptr1 = 0x6b0, GR_table_base // Constants_log_80_P, P8, NEAR path
+      fcmp.eq.s0 p12, p0 =  FR_Input_X, FR_Input_Y // Dummy to set denormal
+      add GR_P_ptr2 = 0x700, GR_table_base // Constants_log_80_P, P4, NEAR path
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p7)   br.cond.spnt L(LOGL80_NEAR) ;; 
+{ .mfb
+      cmp.eq p15, p14 =  r0, r0            // Assume result safe (no over/under)
+      fsub.s1  FR_Delta = FR_Input_Y,f1    // Delta = y - 1.0
+(p11) br.cond.spnt POWL_64_SQRT            // Branch if y=0.5
 }
+;;
+
 //
-//     Load h_1
-//     Possible branch out.  
-//     Add offset of table to Index2 
+//     Computes ln( x ) to extra precision
+//     Input  FR 1: FR_X
+//     Output FR 2: FR_Y_hi
+//     Output FR 3: FR_Y_lo
+//     Output PR 1: PR_Safe
 //
 { .mfi
-(p0)   ld2 GR_Z_2 =[GR_Index2],4
-(p0)   fmerge.se FR_S =  f1,FR_Z
-(p0)   sub GR_N = GR_N, GR_BIAS  
+      and GR_M = GR_exp_mask, GR_M            // Mask to get exponent of W
+      nop.f 999
+      extr.u GR_Index3 = GR_X_2, 1, 5         // Get index3
 }
 ;;
 
 { .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_log_80_h3_G_H#), gp
-      nop.i 999
+      shladd GR_Table_Ptr1 = GR_Index3,2,GR_Table_Ptr1 // Ptr to H_3
+      shladd GR_Index3 = GR_Index3,4,GR_Table_Ptr      // Ptr to G_3
+      sub GR_M = GR_M, GR_exp_bias            // Get true exponent of W
 }
 ;;
 
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
-      nop.m 999
-      nop.i 999
+{ .mib
+      ldfs FR_G_3 = [GR_Index3],-12           // Load G_3
+      cmp.gt  p7, p14 =  -8, GR_M             // Test if |x-1| < 2^-8
+(p7)  br.cond.spnt LOGL80_NEAR                // Branch if |x-1| < 2^-8
 }
 ;;
 
-//     
-//     load Z_2 
-//     N - BIAS 
-//     Point to Table 3.
-//     S = merging of Z and 1.0
-//     
-{ .mmi
-(p0)   ldfs  FR_G_2 = [GR_Index2],4 
-(p0)   setf.sig FR_float_N = GR_N 
-(p0)   add GR_Table_Ptr1 = 0x200,GR_Table_Ptr ;;  
-}
-//
-//     load G_2 
-//     X_2 = X_1 * Z_2 
-//     Add offset to Table 2 ptr.
-//     float_N = significand of N
-//
-{ .mmi
-(p0)   ldfs  FR_H_2 = [GR_Index2],8 ;; 
-//
-//     load H_2 
-//     G = G * G_2
-//
-(p0)   ldfe FR_h_2 = [GR_Index2],0 
-(p0)   pmpyshr2.u GR_X_2 = GR_X_1,GR_Z_2,15 ;; 
-}
-{ .mmi
-       nop.m 999
-       nop.m 999
-       nop.i 999;;
-}
-{ .mmi
-       nop.m 999
-       nop.m 999
-       nop.i 999;;
-}
-{ .mmi
-        nop.m 999
-        nop.m 999
-        nop.i 999;;
+// Here if |x-1| >= 2^-8
+{ .mmf
+      ldfs FR_H_3 = [GR_Table_Ptr1]           // Load H_3
+      nop.m 999
+      nop.f 999
 }
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-(p0)   extr.u GR_Index3 = GR_X_2, 1, 5 ;;  
+;;
+
+{ .mfi
+      ldfe FR_h_3 = [GR_Index3]               // Load h_3
+      fmerge.se FR_S =  f1,FR_Z               // S = merge of 1.0 and signif(Z)
+      nop.i 999
 }
 { .mfi
-(p0)   shladd GR_Table_Ptr1 = GR_Index3,2,GR_Table_Ptr1 
-	nop.f 999
+      add GR_Table_Ptr = 0x740, GR_table_base // Constants_log_80_Q
+      fmpy.s1 FR_G = FR_G_1, FR_G_2           // G = G_1 * G_2
+      nop.i 999
+}
+;;
+
 //
-//     h = h_1 + h_2  
-//     Adjust Index3 
+//     Begin Loading Q's -  load log2_hi part
 //
-(p0)   shladd GR_Index3 = GR_Index3,4,GR_Table_Ptr ;; 
-}
-{ .mmb
-	nop.m 999
-(p0)   ldfe FR_h_3 = [GR_Index3],12 
-	nop.b 999 ;;
-}
-{ .mmf
-(p0)   ldfs FR_H_3 = [GR_Table_Ptr1],0 
+{ .mfi
+      ldfe FR_log2_hi = [GR_Table_Ptr],16     // Load log2_hi
+      fadd.s1 FR_H = FR_H_1, FR_H_2           // H = H_1 + H_2
+      nop.i 999
+};;
+
 //
-//     float_N = Make N a fp number
-//     Load h_3
-//     Get pointer to Q table.     
+//     h = h_1 + h_2
 //
-(p0)   ldfs  FR_G_3 = [GR_Index3],0 
-(p0)   fmpy.s1 FR_G = FR_G_1, FR_G_2 
+{ .mfi
+      ldfe FR_log2_lo = [GR_Table_Ptr],16     // Load log2_lo
+      fadd.s1 FR_h = FR_h_1, FR_h_2           // h = h_1 + h_2
+      nop.i 999
 }
 ;;
 
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_log_80_Q#), gp
+{ .mfi
+      ldfe FR_Q_6 = [GR_Table_Ptr],16         // Load Q_6
+      fcvt.xf FR_float_N = FR_float_N
       nop.i 999
 }
 ;;
 
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
-      nop.m 999
+{ .mfi
+      ldfe FR_Q_5 = [GR_Table_Ptr],16         // Load Q_5
+      nop.f 999
       nop.i 999
 }
 ;;
 
-
-
-{ .mfi
-(p0)   ldfe FR_log2_hi = [GR_Table_Ptr],16
-(p0)   fadd.s1 FR_H = FR_H_1, FR_H_2 
-	nop.i 999 ;;
-}
-{ .mmf
-	nop.m 999
-//
-//     G = G_1 * G_2 * G_3 
-//
-(p0)   ldfe FR_log2_lo = [GR_Table_Ptr],16 
-//
-//     load h_2 
-//     H = H_1 + H_2 
-//     Get Index3
 //
-(p0)   fadd.s1 FR_h = FR_h_1, FR_h_2 ;; 
-}
-//
-//     Load log2_lo part
-//     r = G*S -1
+//     G = G_1 * G_2 * G_3
 //
 { .mfi
-(p0)   ldfe FR_Q_6 = [GR_Table_Ptr],16 
-//
-//     Load H_3
-//
-(p0)   fcvt.xf FR_float_N = FR_float_N 
-	nop.i 999 ;;
+      ldfe FR_Q_4 = [GR_Table_Ptr],16         // Load Q_4
+      fmpy.s1 FR_G = FR_G, FR_G_3
+      nop.i 999
 }
+;;
+
 //
-//     Load Q_6
+//     H = H_1 + H_2 + H_3
 //
-{ .mmi
-(p0)   ldfe FR_Q_5 = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_Q_4 = [GR_Table_Ptr],16 
-	nop.i 999 ;;
-}
-{ .mmi
-(p0)   ldfe FR_Q_3 = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_Q_2 = [GR_Table_Ptr],16 
-	nop.i 999 ;;
+{ .mfi
+      ldfe FR_Q_3 = [GR_Table_Ptr],16         // Load Q_3
+      fadd.s1 FR_H = FR_H, FR_H_3
+      nop.i 999
 }
-{ .mmf
-	nop.m 999
-//
-//     poly_lo = Q_5 + r * Q_6
-//     Load Q_2
-//     rsq = r * r 
+;;
+
 //
-(p0)   ldfe FR_Q_1 = [GR_Table_Ptr],16 
+//     Y_lo = poly + Y_lo
 //
-//     h = h_1 + h_2 + h_3   
-//     H = H_1 + H_2 + H_3 
-//     Load G_3.
-//     Begin Loading Q's -  load log2_hi part
+//     h = h_1 + h_2 + h_3
 //
-(p0)   fmpy.s1 FR_G = FR_G, FR_G_3 
-}
 { .mfi
-	nop.m 999
-(p0)   fadd.s1 FR_H = FR_H, FR_H_3 
-	nop.i 999 
+      ldfe FR_Q_2 = [GR_Table_Ptr],16         // Load Q_2
+      fadd.s1 FR_h = FR_h, FR_h_3
+      nop.i 999
 }
 ;;
 
 //
-//     Y_lo = poly + Y_lo 
+//     GS_hi = G*S
+//     r = G*S -1
 //
-
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_exp_64_Arg#), gp
+{ .mfi
+      ldfe FR_Q_1 = [GR_Table_Ptr],16         // Load Q_1
+      fmpy.s1 FR_GS_hi = FR_G, FR_S
       nop.i 999
 }
-;;
-
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
+{ .mfi
       nop.m 999
+      fms.s1 FR_r = FR_G, FR_S, f1
       nop.i 999
 }
 ;;
 
-
-{ .mfi
-	nop.m 999
-(p0)   fadd.s1 FR_h = FR_h, FR_h_3 
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
 //
-//     Load Q_5
+//     poly_lo = Q_5 + r * Q_6
 //
-(p0)   fmpy.s1 FR_GS_hi = FR_G, FR_S 
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p0)   fms.s1 FR_r = FR_G, FR_S, f1 
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly_lo = FR_r, FR_Q_6, FR_Q_5 
-	nop.i 999
+      getf.exp GR_Delta_Exp =  FR_Delta     // Get signexp of y-1 for exp calc
+      fma.s1 FR_poly_lo = FR_r, FR_Q_6, FR_Q_5
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
 //
-//     GS_hi = G*S
-//     Load Q_4
+//     r_cor = GS_hi -1
 //
-(p0)   fsub.s1 FR_r_cor = FR_GS_hi, f1 
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fms.s1 FR_GS_lo = FR_G, FR_S, FR_GS_hi 
-	nop.i 999
-}
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly = FR_r, FR_Q_2, FR_Q_1 
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 FR_r_cor = FR_GS_hi, f1
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     Load Q_3
-//     r_cor = GS_hi -1
 //     GS_lo  = G*S - GS_hi
 //
-(p0)   fmpy.s1 FR_rsq = FR_r, FR_r 
-	nop.i 999
-}
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_G = FR_float_N, FR_log2_hi, FR_H 
-	nop.i 999 ;;
+      nop.m 999
+      fms.s1 FR_GS_lo = FR_G, FR_S, FR_GS_hi
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     poly = poly_hi + rsq * poly_lo 
-//     Tbl = float_N*log2_hi + H
+//     rsq = r * r
 //
-(p0)   fma.s1 FR_Y_lo = FR_float_N, FR_log2_lo, FR_h 
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-//
-//     r_cor = r_cor - r
-//     poly_hi = r * Q_2 + Q_1
-//
-(p0)   fma.s1 FR_poly_lo = FR_r, FR_poly_lo, FR_Q_4 
-	nop.i 999
+      nop.m 999
+      fmpy.s1 FR_rsq = FR_r, FR_r
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
 //
-//     Load Q_1
+//     G = float_N*log2_hi + H
 //
-(p0)   fsub.s1 FR_r_cor = FR_r_cor, FR_r 
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-// 
-//     Y_lo = float_N*log2_lo + h
-// 
-(p0)   fadd.s1 FR_Y_hi = FR_G, FR_r 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_G = FR_float_N, FR_log2_hi, FR_H
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     poly_lo = Q_4 + r * poly_lo;;
-//     r_cor = r_cor + GS_lo;;
+//     Y_lo = float_N*log2_lo + h
 //
-(p0)   fma.s1 FR_poly_lo = FR_r, FR_poly_lo, FR_Q_3 
-	nop.i 999
-}
 { .mfi
-	nop.m 999
-(p0)   fadd.s1 FR_r_cor = FR_r_cor, FR_GS_lo 
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fadd.s1 FR_r_cor = FR_r_cor, FR_Y_lo 
-	nop.i 999
+      nop.m 999
+      fma.s1 FR_Y_lo = FR_float_N, FR_log2_lo, FR_h
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     poly_lo = Q_3 + r * poly_lo;;
+//      poly_lo = Q_4 + r * poly_lo
+//      r_cor = r_cor - r
 //
-(p0)   fma.s1 FR_poly = FR_rsq, FR_poly_lo, FR_poly 
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p0)   fsub.s1 FR_Y_lo = FR_G, FR_Y_hi 
-	nop.i 999
-}
-{ .mmi
-(p0)   ldfe FR_L_Inv = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_L_hi = [GR_Table_Ptr],16 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly_lo = FR_r, FR_poly_lo, FR_Q_4
+      nop.i 999
 }
 { .mfi
-(p0)   ldfe FR_L_lo = [GR_Table_Ptr],16 
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 FR_r_cor = FR_r_cor, FR_r
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     Y_hi = Tbl + r 
-//     r_cor = r_cor + Y_lo 
+//      poly_hi = r * Q_2 + Q_1
+//      Y_hi = G + r
 //
-(p0)   fma.s1 FR_poly = FR_rsq, FR_poly, FR_r_cor 
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-//     Y_lo = Tbl - Y_hi 
-//     poly = rsq * poly + r_cor
-//
-(p0)   fadd.s1 FR_Y_lo = FR_Y_lo, FR_r 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly = FR_r, FR_Q_2, FR_Q_1
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
-//
-//     Y_lo =  Y_lo + r  
-//
-(p0)   fadd.s1 FR_Y_lo = FR_Y_lo, FR_poly 
-//
-//     Load L_Inv
-//     Load L_hi
-//     Load L_lo
-//     all long before they are needed.
-//     They are used in LOGL_RETURN PATH
-//
-br.cond.sptk L(LOGL_RETURN) ;; 
+{ .mfi
+      nop.m 999
+      fadd.s1 FR_Y_hi = FR_G, FR_r
+      nop.i 999
 }
-L(LOGL80_NEAR): 
+;;
+
 //
-//     Branch LOGL80_NEAR
+//      poly_lo = Q_3 + r * poly_lo
+//      r_cor = r_cor + GS_lo
 //
-
-{ .mmi
+{ .mfi
       nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_log_80_P#), gp
+      fma.s1 FR_poly_lo = FR_r, FR_poly_lo, FR_Q_3
       nop.i 999
 }
-;;
-
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
+{ .mfi
       nop.m 999
+      fadd.s1 FR_r_cor = FR_r_cor, FR_GS_lo
       nop.i 999
 }
 ;;
 
-{ .mfi
-	nop.m 999
-(p0)   fmpy.s1 FR_Wsq = FR_W, FR_W 
-(p0)   add GR_Table_Ptr1 = 0x50,GR_Table_Ptr  
-}
 //
-//     Adjust ptr to 1/2 
-//     Adjust Ptr1 to P_4
+//      Y_lo = G - Y_hi
 //
-{ .mmi
-(p0)   ldfe FR_Half = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_P_4 = [GR_Table_Ptr1],16 
-	nop.i 999
+{ .mfi
+      nop.m 999
+      fsub.s1 FR_Y_lo_2 = FR_G, FR_Y_hi
+      nop.i 999
 }
+;;
+
 //
-//     Load 1/2 
+//      r_cor = r_cor + Y_lo
+//      poly = poly_hi + rsq * poly_lo
 //
-{ .mmi
-(p0)   ldfe FR_P_8 = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_P_3 = [GR_Table_Ptr1],16 
-	nop.i 999
+{ .mfi
+      add  GR_Table_Ptr   = 0x0, GR_table_base   // Constants_exp_64_Arg
+      fadd.s1 FR_r_cor = FR_r_cor, FR_Y_lo
+      nop.i 999
 }
-{ .mmi
-(p0)   ldfe FR_P_7 = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_P_2 = [GR_Table_Ptr1],16 
-	nop.i 999
+{ .mfi
+      nop.m 999
+      fma.s1 FR_poly = FR_rsq, FR_poly_lo, FR_poly
+      nop.i 999
 }
+;;
+
 //
-//     Load P_7
-//     half_W = .5 * W
-//     Load P_3
-//
-{ .mmi
-(p0)   ldfe FR_P_6 = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_P_1 = [GR_Table_Ptr1],16 
-	nop.i 999 ;;
-}
+//      Load L_hi
+//      Load L_lo
+//      all long before they are needed.
+//      They are used in LOGL_RETURN PATH
 //
-//     Load P_6
-//     Wsq = w * w
-//     poly = w*P_4 + P_3 
-//     Load P_2
+//      Y_lo =  Y_lo + r
+//      poly = rsq * poly + r_cor
 //
 { .mfi
-(p0)   ldfe FR_P_5 = [GR_Table_Ptr],16 
-//
-//     Load P_5
-//     poly_lo =  w * P_8 + P_7 
-//     Y_hi = w - (1/2)w*w
-//     Load P_1
-//
-(p0)   fmpy.s1 FR_W4 = FR_Wsq, FR_Wsq 
-	nop.i 999
+      ldfe FR_L_hi = [GR_Table_Ptr],16           // Load L_hi
+      fadd.s1 FR_Y_lo = FR_Y_lo_2, FR_r
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 FR_W3 = FR_Wsq, FR_W 
-	nop.i 999 
+      nop.m 999
+      fma.s1 FR_poly = FR_rsq, FR_poly, FR_r_cor
+      nop.i 999
 }
 ;;
 
+{ .mfb
+      ldfe FR_L_lo = [GR_Table_Ptr],16           // Load L_lo
+      fadd.s1 FR_Y_lo = FR_Y_lo, FR_poly
+      br.cond.sptk LOGL_RETURN                   // Branch to common code
+}
+;;
+
+
+LOGL80_NEAR:
+// Here if |x-1| < 2^-8
 //
-//     Y_lo = W3 * poly + Y_lo
+//     Branch LOGL80_NEAR
 //
 
+{ .mmf
+      ldfe FR_P_8 = [GR_P_ptr1],16           // Load P_8
+      ldfe FR_P_4 = [GR_P_ptr2],16           // Load P_4
+      fmpy.s1 FR_Wsq = FR_W, FR_W
+}
+;;
+
 { .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_exp_64_Arg#), gp
+      ldfe FR_P_7 = [GR_P_ptr1],16           // Load P_7
+      ldfe FR_P_3 = [GR_P_ptr2],16           // Load P_3
       nop.i 999
 }
 ;;
 
 { .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
-      nop.m 999
+      ldfe FR_P_6 = [GR_P_ptr1],16           // Load P_6
+      ldfe FR_P_2 = [GR_P_ptr2],16           // Load P_2
       nop.i 999
 }
 ;;
 
-
 { .mmi
-(p0)   ldfe FR_L_Inv = [GR_Table_Ptr],16 ;; 
-(p0)   ldfe FR_L_hi = [GR_Table_Ptr],16 
-	nop.i 999 ;;
-}
-{ .mfi
-(p0)   ldfe FR_L_lo = [GR_Table_Ptr],16 
-//
-//     Load P_8
-//     Load P_4
-//
-(p0)   fmpy.s1 FR_half_W = FR_Half, FR_W 
-	nop.i 999 ;;
+      ldfe FR_P_5 = [GR_P_ptr1],16           // Load P_5
+      ldfe FR_P_1 = [GR_P_ptr2],16           // Load P_1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly_lo = FR_W, FR_P_8,FR_P_7 
-	nop.i 999
+      getf.exp GR_Delta_Exp =  FR_Delta      // Get signexp of y-1 for exp calc
+      fmpy.s1 FR_W4 = FR_Wsq, FR_Wsq
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly = FR_W, FR_P_4, FR_P_3 
-	nop.i 999 ;;
+      add  GR_Table_Ptr = 0x0, GR_table_base // Constants_exp_64_Arg
+      fmpy.s1 FR_W3 = FR_Wsq, FR_W
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 FR_Y_hi = FR_W, FR_half_W, FR_W 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_half_W = FR_Half, FR_W
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     W4 = Wsq * Wsq
-//     poly = w *poly + P_2
-//
-(p0)   fma.s1 FR_poly_lo = FR_W, FR_poly_lo, FR_P_6 
-	nop.i 999
+      ldfe FR_L_hi = [GR_Table_Ptr],16
+      fma.s1 FR_poly_lo = FR_W, FR_P_8,FR_P_7
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly = FR_W, FR_poly, FR_P_2 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly = FR_W, FR_P_4, FR_P_3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fsub.s1 FR_Y_lo = FR_W, FR_Y_hi 
-	nop.i 999 ;;
+      ldfe FR_L_lo = [GR_Table_Ptr],16
+      fnma.s1 FR_Y_hi = FR_W, FR_half_W, FR_W
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly = w * poly + P_1
-//     w3 = wsq * w
-//
-(p0)   fma.s1 FR_poly_lo = FR_W, FR_poly_lo, FR_P_5 
-	nop.i 999
+      nop.m 999
+      fma.s1 FR_poly_lo = FR_W, FR_poly_lo, FR_P_6
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     poly_lo = w * poly_lo + P_6
-//     Y_lo = W - Y_hi
-//
-(p0)   fma.s1 FR_poly = FR_W, FR_poly, FR_P_1 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly = FR_W, FR_poly, FR_P_2
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 FR_Y_lo = FR_W, FR_half_W, FR_Y_lo 
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 FR_Y_lo = FR_W, FR_Y_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly_lo = w * poly_lo + 
-//     Y_lo = Y_lo - w * (1/2)w
-//
-(p0)   fma.s1 FR_poly = FR_poly_lo, FR_W4, FR_poly 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly_lo = FR_W, FR_poly_lo, FR_P_5
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Y_lo = (W-Y_hi) - w * (1/2)w
-//     poly =  W4* poly_lo + poly 
-//
-(p0)   fma.s1 FR_Y_lo = FR_poly, FR_W3, FR_Y_lo 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly = FR_W, FR_poly, FR_P_1
+      nop.i 999
 }
-L(LOGL_RETURN): 
+;;
+
 { .mfi
-(p0)   add GR_Expo_Range = 0x2,r0  
-//
-//     Load L_Inv
-//     Load L_hi
-//     Load L_lo
-//     all long before they are needed.
-//
-//
-//     kernel_log_80 computed ln(X)
-//     and return logX_hi and logX_lo as results.
-//     PR_pow_Safe set as well. 
-//
-(p0)   fmpy.s1 FR_X_lo = FR_Input_Y, FR_logx_lo 
-//
-//     Compute Y * (logX_hi + logX_lo) 
-//     P_hi -> X 
-//     P_lo -> X_cor 
-//     (Manipulate names so that inputs are in
-//     the place kernel_exp expects them)
-//     Set GR_Flag to 2 
-//     Set GR_Expo_Range to Double
-// 
-//     This function computes exp( x  + x_cor) 
-//     Input  FR 1: FR_X            
-//     Input  FR 2: FR_X_cor  
-//     Input  GR 1: GR_Flag  
-//     Input  GR 2: GR_Expo_Range  
-//     Output FR 3: FR_Y_hi  
-//     Output FR 4: FR_Y_lo  
-//     Output FR 5: FR_Scale  
-//     Output PR 1: PR_Safe  
-// 
-(p0)   cmp.eq.unc  p15, p0 =  r0, r0 
+      nop.m 999
+      fnma.s1 FR_Y_lo = FR_W, FR_half_W, FR_Y_lo
+      nop.i 999
 }
 ;;
 
-{ .mmi
-(p0)  addl           GR_W1_ptr   = @ltoff(Constants_exp_64_W1#), gp
-(p0)  addl           GR_W2_ptr   = @ltoff(Constants_exp_64_W2#), gp
-(p0)  add GR_Flag = 0x2,r0  
+{ .mfi
+      nop.m 999
+      fma.s1 FR_poly = FR_poly_lo, FR_W4, FR_poly
+      nop.i 999
 }
 ;;
 
-{ .mmi
-      ld8 GR_W1_ptr = [GR_W1_ptr]
-      ld8 GR_W2_ptr = [GR_W2_ptr]
-(p0)   cmp.ne.unc  p7, p0 =  0x1, GR_Flag 
+{ .mfi
+      nop.m 999
+      fma.s1 FR_Y_lo = FR_poly, FR_W3, FR_Y_lo
+      nop.i 999
 }
 ;;
 
-{ .mlx
-	nop.m 999
-(p0)   movl GR_Mask = 0x1FFFF ;; 
-}
 
+LOGL_RETURN:
+// Common code for completion of both logx paths
 
-{ .mlx
-	nop.m 999
-(p0)   movl GR_BIAS = 0x0FFFF ;; 
-}
-{ .mfi
-	nop.m 999
 //
-//     X_lo =  Y * logX_lo
+//     L_hi, L_lo already loaded.
 //
-(p0)   fma.s1 FR_P_hi = FR_Input_Y, FR_logx_hi,FR_X_lo 
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
 //
-//     Set Safe=True 
-//     Flag is always 2 for this routine
+//     kernel_log_80 computed ln(X)
+//     and return logX_hi and logX_lo as results.
+//     PR_pow_Safe set as well.
 //
-(p0)   fmpy.s1 FR_float_N = FR_X, FR_L_Inv 
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
 //
-//     X_hi  = Y * logX_hi + X_lo
-//     Set GR_Flag = 2 for exp(x + xcor)
+//     Compute Y * (logX_hi + logX_lo)
+//     P_hi -> X
+//     P_lo -> X_cor
+//     (Manipulate names so that inputs are in
+//     the place kernel_exp expects them)
 //
-(p0)   fms.s1 FR_P_lo= FR_Input_Y, FR_logx_hi, FR_P_hi 
-	nop.i 999 ;;
+//     This function computes exp( x  + x_cor)
+//     Input  FR 1: FR_X
+//     Input  FR 2: FR_X_cor
+//     Output FR 3: FR_Y_hi
+//     Output FR 4: FR_Y_lo
+//     Output FR 5: FR_Scale
+//     Output PR 1: PR_Safe
+//
+//     P15 is True
+//
+// Load constants used in computing N using right-shift technique
+{ .mlx
+      mov GR_exp_2tom51 = 0xffff-51
+      movl GR_sig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
 }
-{ .mmi
-	nop.m 999 ;;
-(p0)   getf.exp GR_Expo_X = FR_X 
-	nop.i 999 ;;
+{ .mlx
+      add  GR_Special_Exp = -50,GR_exp_bias
+      movl GR_rshf_2to51 = 0x4718000000000000   // 1.10000 2^(63+51)
 }
-{ .mfi
-(p0)   and GR_Expo_X = GR_Expo_X, GR_Mask  
+;;
+
 //
-//     Calculate unBIASed exponent of X
 //     Point to Table of W1s
 //     Point to Table of W2s
 //
-(p0)   fcvt.fx.s1 FR_N = FR_float_N 
-	nop.i 999 ;;
-}
+{ .mmi
+      add GR_W1_ptr   = 0x2b0, GR_table_base    // Constants_exp_64_W1
+      add GR_W2_ptr   = 0x4b0, GR_table_base    // Constants_exp_64_W2
+      cmp.le p6,p0= GR_Delta_Exp,GR_Special_Exp
+};;
+
+// Form two constants we need
+//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128
+//  1.1000..000 * 2^(63+63-12) to right shift int(N) into the significand
+
 { .mfi
-	nop.m 999
-(p0)   fadd.s1 FR_P_lo = FR_P_lo, FR_X_lo 
-//
-//     Float_N = X * L_Inv
-//     Create exponent BIAS
-//     Get BIASed exponent of X
-//
-(p0)   sub GR_Expo_X = GR_Expo_X, GR_BIAS ;;  
+      setf.sig  FR_INV_LN2_2TO63 = GR_sig_inv_ln2 // form 1/ln2 * 2^63
+      nop.f 999
+      and GR_Delta_Exp=GR_Delta_Exp,GR_exp_mask  // Get exponent of y-1
 }
-{ .mib
-(p0)   cmp.gt.unc  p9, p0  =  -6, GR_Expo_X 
-	nop.i 999
-//
-//     N = fcvt.fx(float_N)
-//     If -6 > Expo_X, set P9
-//
-(p9)   br.cond.spnt L(EXPL_SMALL) 
+{ .mlx
+      setf.d  FR_RSHF_2TO51 = GR_rshf_2to51    // Form const 1.1000 * 2^(63+51)
+      movl GR_rshf = 0x43e8000000000000        // 1.10000 2^63 for right shift
 }
 ;;
 
-//
-//     If expo_X < -6 goto exp_small
-//
-{ .mmi
+{ .mfi
       nop.m 999
-(p0)  addl           GR_T1_ptr   = @ltoff(Constants_exp_64_T1#), gp
-(p0)  cmp.lt.unc  p10, p0 =  14, GR_Expo_X 
+      fmpy.s1 FR_X_lo = FR_Input_Y, FR_logx_lo // logx_lo is Y_lo
+      cmp.eq  p15, p0=  r0, r0                 // Set p15, assume safe
+};;
+
+{ .mmi
+      setf.exp FR_2TOM51 = GR_exp_2tom51 // Form 2^-51 for scaling float_N
+      setf.d  FR_RSHF = GR_rshf          // Form right shift const 1.1000 * 2^63
+      add GR_Table_Ptr1   = 0x50, GR_table_base // Constants_exp_64_P for
+                                                // EXPL_SMALL path
 }
 ;;
 
 { .mmi
-      ld8 GR_T1_ptr = [GR_T1_ptr]
-      nop.m 999
+      ldfe FR_P_6 = [GR_Table_Ptr1],16          // Load P_6 for EXPL_SMALL path
+;;
+      ldfe FR_P_5 = [GR_Table_Ptr1],16          // Load P_5 for EXPL_SMALL path
       nop.i 999
 }
 ;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     If 14 < Expo_X, set P10
-//     Create pointer to T1 table
-//  
-(p10)  br.cond.spnt L(EXPL_HUGE) ;;
+{ .mfi
+      ldfe FR_P_4 = [GR_Table_Ptr1],16          // Load P_4 for EXPL_SMALL path
+      fma.s1 FR_P_hi = FR_Input_Y, FR_logx_hi,FR_X_lo  // logx_hi ix Y_hi
+      nop.i 999
 }
-
+;;
 
 { .mmi
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_exp_64_Exponents#), gp
-(p0)  addl           GR_T2_ptr   = @ltoff(Constants_exp_64_T2#), gp
+      ldfe FR_P_3 = [GR_Table_Ptr1],16          // Load P_3 for EXPL_SMALL path
+;;
+      ldfe FR_P_2 = [GR_Table_Ptr1],16          // Load P_2 for EXPL_SMALL path
       nop.i 999
 }
 ;;
 
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
-      ld8 GR_T2_ptr = [GR_T2_ptr]
+// N = X * Inv_log2_by_2^12
+// By adding 1.10...0*2^63 we shift and get round_int(N_signif) in significand.
+// We actually add 1.10...0*2^51 to X * Inv_log2 to do the same thing.
+{ .mfi
+      ldfe FR_P_1 = [GR_Table_Ptr1]             // Load P_1 for EXPL_SMALL path
+      fma.s1 FR_N = FR_X, FR_INV_LN2_2TO63, FR_RSHF_2TO51
       nop.i 999
 }
+{ .mfb
+      nop.m 999
+      fms.s1 FR_P_lo= FR_Input_Y, FR_logx_hi, FR_P_hi  // P_hi is X
+(p6)  br.cond.spnt POWL_Y_ALMOST_1              // Branch if |y-1| < 2^-50
+}
 ;;
 
-
 { .mmi
-(p0)   shladd GR_Table_Ptr = GR_Expo_Range,4,GR_Table_Ptr ;;  
-//
-//     Adjust T1_ptr by x 4 for single-precision values
-//     Adjust T2_ptr by x 4 for single-precision values
-//
-(p0)   ld8 GR_Big_Pos_Exp = [GR_Table_Ptr],8
-	nop.i 999 ;;
-}
-//
-//     Load double W1
-//     Load +max exponent
-//
-{ .mfi
-(p0)   ld8 GR_Big_Neg_Exp = [GR_Table_Ptr],0
-//
-//     If 14 < Expo_X, goto exp_huge
-//
-(p0)   fcvt.xf FR_float_N = FR_N 
-	nop.i 999 
+      getf.exp GR_Expo_X = FR_X
+      add GR_T1_ptr   = 0x0b0, GR_table_base    // Constants_exp_64_T1
+      add GR_T2_ptr   = 0x1b0, GR_table_base    // Constants_exp_64_T2
 }
 ;;
 
-//
-//     Load double W2
-//     Load -max exponent
-//     Load ptr to A's
-//
+// float_N = round_int(N)
+// The signficand of N contains the rounded integer part of X * 2^12/ln2,
+// as a twos complement number in the lower bits (that is, it may be negative).
+// That twos complement number (called N) is put into GR_N_fix.
 
-{ .mmi
-(p0)  getf.sig GR_N_fix = FR_N 
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_exp_64_A#), gp
+// Since N is scaled by 2^51, it must be multiplied by 2^-51
+// before the shift constant 1.10000 * 2^63 is subtracted to yield float_N.
+// Thus, float_N contains the floating point version of N
+
+
+{ .mfi
+      add  GR_Table_Ptr   = 0x20, GR_table_base    // Constants_exp_64_A
+      fms.s1 FR_float_N = FR_N, FR_2TOM51, FR_RSHF // Form float_N
       nop.i 999
 }
-;;
+//     Create low part of Y(ln(x)_hi + ln(x)_lo) as P_lo
+{ .mfi
+      mov GR_Big_Pos_Exp = 0x3ffe               // 16382, largest safe exponent
+      fadd.s1 FR_P_lo = FR_P_lo, FR_X_lo
+      mov GR_Big_Neg_Exp = -0x3ffd              // -16381 smallest safe exponent
+};;
 
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
+{ .mfi
       nop.m 999
-      nop.i 999
+      fmpy.s1 FR_rsq = FR_X, FR_X               // rsq = X*X for EXPL_SMALL path
+      mov GR_vsm_expo = -70                     // Exponent for very small path
+}
+{ .mfi
+      nop.m 999
+      fma.s1 FR_poly_lo = FR_P_6, FR_X, FR_P_5  // poly_lo for EXPL_SMALL path
+      add GR_temp = 0x1,r0                      // For tiny signif if small path
 }
 ;;
 
 //
-//     Load single T1
-//     Load single T2
-//     W_1_p1 = W_1 + 1
-//
-{ .mmi
-(p0)   ldfe FR_A_3 = [GR_Table_Ptr],16 ;; 
-//
-//     Load A_3
-//     if k > big_pos_exp, set p14 and Safe=False
-//
-(p0)   ldfe FR_A_2 = [GR_Table_Ptr],16 
-(p0)   extr.u GR_M1 = GR_N_fix, 6, 6  
-}
-{ .mmi
-	nop.m 999 ;;
-(p0)   shladd GR_W1_ptr = GR_M1,3,GR_W1_ptr  
-//
-//     float_N = fcvt.xf(N) 
-//     N_fix = significand of N
-//     Create pointer to T2 table
-//
-(p0)   extr.u GR_M2 = GR_N_fix, 0, 6  
-}
-//
-//     r = r + X_cor
-//     Adjust W1_ptr by x 8 for double-precision values
-//     Adjust W2_ptr by x 8 for double-precision values
-//     Adjust Table_ptr by Expo_Rangex16 
+//      If expo_X < -6 goto exp_small
 //
 { .mmi
-(p0)   shladd GR_T1_ptr = GR_M1,2,GR_T1_ptr ;;  
-(p0)   ldfd  FR_W1 = [GR_W1_ptr],0 
-(p0)   shladd GR_W2_ptr = GR_M2,3,GR_W2_ptr  
+      getf.sig GR_N_fix = FR_N
+      ldfe FR_A_3 = [GR_Table_Ptr],16         // Load A_3
+      and GR_Expo_X = GR_Expo_X, GR_exp_mask  // Get exponent of X
 }
-//
-//     Load ptr to A's
-//
+;;
+
 { .mfi
-(p0)   ldfs  FR_T1 = [GR_T1_ptr],0 
-(p0)   fnma.s1 FR_r = FR_L_hi, FR_float_N, FR_X 
-(p0)   shladd GR_T2_ptr = GR_M2,2,GR_T2_ptr ;; 
+      ldfe FR_A_2 = [GR_Table_Ptr],16         // Load A_2
+      nop.f 999
+      sub GR_Expo_X = GR_Expo_X, GR_exp_bias  // Get true exponent of X
 }
-{ .mmi
-(p0)   ldfd  FR_W2 = [GR_W2_ptr],0 
-(p0)   ldfs  FR_T2 = [GR_T2_ptr],0 
+;;
+
 //
-//     r = x - L_hi * float_N
-//     M2 = extr.u(N_fix,0,6)
-//     M1 = extr.u(N_fix,6,6)
+//     If -6 > Expo_X, set P9 and branch
 //
-(p0)   extr GR_k = GR_N_fix, 12, 52 ;;  
+{ .mfb
+      cmp.gt  p9, p0  =  -6, GR_Expo_X
+      fnma.s1 FR_r = FR_L_hi, FR_float_N, FR_X // r = X - L_hi * float_N
+(p9)  br.cond.spnt EXPL_SMALL                  // Branch if |X| < 2^-6
 }
+;;
+
 //
-//     Load A_1
-//     poly = A_3 * r + A_2
-//     rsq = r*r
+//     If 14 <= Expo_X, set P10
 //
-{ .mii
-(p0)   add GR_BIAS_p_k = GR_BIAS, GR_k  
-(p0)   cmp.gt.unc  p14,p15 = GR_k,GR_Big_Pos_Exp ;; 
-(p15)  cmp.lt p14,p15 = GR_k,GR_Big_Neg_Exp
+{ .mib
+      cmp.le  p10, p0 =  14, GR_Expo_X
+      nop.i 999
+(p10) br.cond.spnt EXPL_HUGE                   // Branch if |X| >= 2^14
 }
+;;
+
 //
-//     BIAS_p_K = BIAS + k
-//     T = T1 * T2
+//      Load single T1
+//      Load single T2
+//      W_1_p1 = W_1 + 1
 //
-{ .mfi
-(p0)   setf.exp FR_Scale = GR_BIAS_p_k  
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fnma.s1 FR_r = FR_L_lo, FR_float_N, FR_r 
-	nop.i 999
+{ .mmi
+      nop.m 999
+      nop.m 999
+      extr.u GR_M1 = GR_N_fix, 6, 6            // Extract index M_1
 }
+;;
+
 //
-//     W = W_1_p1 * W2 + W1
+//      k = extr.u(N_fix,0,6)
 //
-{ .mfi
-(p0)   ldfe FR_A_1 = [GR_Table_Ptr],16 
-	nop.f 999
-	nop.i 999 ;;
+{ .mmi
+      shladd GR_W1_ptr = GR_M1,3,GR_W1_ptr     // Point to W1
+      shladd GR_T1_ptr = GR_M1,2,GR_T1_ptr     // Point to T1
+      extr.u GR_M2 = GR_N_fix, 0, 6            // Extract index M_2
 }
-{ .mfi
-	nop.m 999
-(p0)   fadd.s1 FR_W_1_p1 = FR_W1, f1 
-	nop.i 999 ;;
+;;
+
+// N_fix is only correct up to 50 bits because of our right shift technique.
+// Actually in the normal path we will have restricted K to about 14 bits.
+// Somewhat arbitrarily we extract 32 bits.
+{ .mmi
+      ldfd  FR_W1 = [GR_W1_ptr]
+      shladd GR_W2_ptr = GR_M2,3,GR_W2_ptr     // Point to W2
+      extr GR_k = GR_N_fix, 12, 32             // Extract k
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     k = extr.u(N_fix,0,6)
-//     r = r - N * L_lo
-//     Load ptr to Table of exponent thresholds.
-//
-(p0)   fadd.s1 FR_r = FR_r, FR_X_cor 
-	nop.i 999
+      ldfs  FR_T1 = [GR_T1_ptr]
+      fnma.s1 FR_r = FR_L_lo, FR_float_N, FR_r
+      shladd GR_T2_ptr = GR_M2,2,GR_T2_ptr     // Point to T2
 }
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 FR_T = FR_T1, FR_T2 
-	nop.i 999 ;;
+      add GR_exp_bias_p_k = GR_exp_bias, GR_k
+      nop.f 999
+      cmp.gt  p14,p15 = GR_k,GR_Big_Pos_Exp
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     if k < big_neg_exp, set p14 and Safe=False
-//     Load A_2
+//      if k < big_neg_exp, set p14 and Safe=False
 //
-(p0)   fma.s1 FR_W = FR_W2, FR_W_1_p1, FR_W1 
-	nop.i 999 ;;
+{ .mmi
+      ldfs  FR_T2 = [GR_T2_ptr]
+(p15) cmp.lt p14,p15 = GR_k,GR_Big_Neg_Exp
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly = FR_r, FR_A_3, FR_A_2 
-	nop.i 999
+;;
+
+{ .mmi
+      setf.exp FR_Scale = GR_exp_bias_p_k
+      ldfd  FR_W2 = [GR_W2_ptr]
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 FR_rsq = FR_r, FR_r 
-	nop.i 999 ;;
+      ldfe FR_A_1 = [GR_Table_Ptr],16
+      fadd.s1 FR_r = FR_r, FR_X_cor
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   mov FR_Y_hi = FR_T 
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 FR_W_1_p1 = FR_W1, f1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Scale = set_exp(BIAS_p_k)
-//     poly = r * poly + A_1
-//
-(p0)   fadd.s1 FR_Wp1 = FR_W, f1 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly = FR_r, FR_A_3, FR_A_2
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly = FR_r, FR_poly, FR_A_1 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_rsq = FR_r, FR_r
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly = FR_rsq, FR_poly,FR_r  
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_T = FR_T1, FR_T2
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Wp1 =  W + 1
-//     poly = rsq * poly + rk
-//
-(p0)   fma.s1 FR_Y_lo = FR_Wp1, FR_poly, FR_W 
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-//
-//     Y_lo = poly * Wp1 + W 
-//     Y_hi = T
-//
-(p0)   fmpy.s1 FR_Y_lo = FR_Y_lo, FR_T 
-//
-//     Y_lo = T * Y_lo
-//
-(p0)   br.cond.sptk L(EXPL_RETURN) ;; 
+      nop.m 999
+      fma.s1 FR_W = FR_W2, FR_W_1_p1, FR_W1
+      nop.i 999
 }
+;;
 
-L(EXPL_SMALL): 
-
-//
-//     r4 = rsq * rsq
-//
-
-{ .mmi
+{ .mfi
       nop.m 999
-(p0)  addl           GR_Table_Ptr1   = @ltoff(Constants_exp_64_P), gp
+      fma.s1 FR_TMP1 = FR_Scale, FR_Sgn, f0
       nop.i 999
 }
 ;;
 
-{ .mmi
-      ld8 GR_Table_Ptr1 = [GR_Table_Ptr1]
+{ .mfi
       nop.m 999
+      fma.s1 FR_poly = FR_r, FR_poly, FR_A_1
       nop.i 999
 }
 ;;
 
-{ .mmf
-	nop.m 999
-(p0)   ldfe FR_P_6 = [GR_Table_Ptr1],16 
-//
-//     Return  
-//
-(p0)   fadd.s1 FR_r = FR_X,f0 ;; 
+{ .mfi
+      nop.m 999
+      fma.s1 FR_TMP2 = FR_T, f1, f0            // TMP2 = Y_hi = T
+      nop.i 999
 }
+;;
 
-{ .mmi
+{ .mfi
       nop.m 999
-(p0)  addl           GR_Table_Ptr   = @ltoff(Constants_exp_64_Exponents#), gp
+      fadd.s1 FR_Wp1 = FR_W, f1
       nop.i 999
 }
 ;;
 
-{ .mmi
-      ld8 GR_Table_Ptr = [GR_Table_Ptr]
-(p0)  ldfe FR_P_5 = [GR_Table_Ptr1],16 
+{ .mfi
+      nop.m 999
+      fma.s1 FR_poly = FR_rsq, FR_poly,FR_r
       nop.i 999
 }
 ;;
 
-//
-//     Is input very small? 
-//     Load P_5
-//
-{ .mii
-(p0)   ldfe FR_P_4 = [GR_Table_Ptr1],16 
-(p0)   add GR_Table_Ptr = 0x040,GR_Table_Ptr ;;  
-(p0)   shladd GR_Table_Ptr = GR_Expo_Range,3,GR_Table_Ptr ;;  
-}
-{ .mmb
-(p0)   ldfe FR_P_3 = [GR_Table_Ptr1],16 
-//
-//     Adjust ptr.
-//
-(p0)   ld8  GR_vsm_expo = [GR_Table_Ptr],0
-	nop.b 999 ;;
-}
 { .mfi
-	nop.m 999
-//
-//     r = X (don't seem to need X_Cor) 
-//     Load the threshold exponents
-//
-(p0)   fmpy.s1 FR_rsq = FR_r, FR_r 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_Tscale = FR_T, FR_TMP1, f0    // Scale * Sgn * T
+      nop.i 999
 }
-//
-//     Load the negative integer
-//     Load P_5
-//
 { .mfi
-(p0)   cmp.lt.unc  p12, p0 =  GR_Expo_X, GR_vsm_expo 
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_Y_lo = FR_Wp1, FR_poly, FR_W
+      nop.i 999
 }
+;;
+
 { .mfb
-	nop.m 999
-//
-//     rsq = r * r
-//     Offset into exponents
-//
-(p0)   fmpy.s1 FR_r4 = FR_rsq, FR_rsq 
-(p12)  br.cond.spnt L(EXPL_VERY_SMALL) ;; 
+      nop.m 999
+      fmpy.s1 FR_TMP3 = FR_Y_lo, FR_Tscale
+      br.cond.sptk POWL_64_SHARED
 }
-{ .mfi
-(p0)   ldfe FR_P_2 = [GR_Table_Ptr1],16 
-//
-//     Load p4,p3,p2,p1
-//
-(p0)   fma.s1 FR_poly_lo = FR_P_6, FR_r, FR_P_5 
+;;
+
+
+EXPL_SMALL:
+// Here if |ylogx| < 2^-6
 //
-//     Y_lo = r4 * poly_lo + poly_hi
-//     Scale = 1.0
+//     Begin creating lsb to perturb final result
 //
-(p0)   add GR_temp = 0x1,r0 ;;  
+{ .mfi
+      setf.sig FR_temp = GR_temp
+      fma.s1 FR_poly_lo = FR_poly_lo, FR_X, FR_P_4
+      cmp.lt  p12, p0 =  GR_Expo_X, GR_vsm_expo   // Test |ylogx| < 2^-70
 }
-{ .mmf
-	nop.m 999
-(p0)   ldfe FR_P_1 = [GR_Table_Ptr1],0 
-(p0)   mov FR_Scale = f1 
+{ .mfi
+      nop.m 999
+      fma.s1 FR_poly_hi = FR_P_2, FR_X, FR_P_1
+      nop.i 999
 }
-//
-//     Begin creating lsb to perturb final result
-//
+;;
+
 { .mfi
-(p0)   setf.sig FR_temp = GR_temp 
-(p0)   mov FR_Y_hi = f1 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_TMP2 = f1, f1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     poly_lo = p_5 + p_6 * r
-//     poly_hi = p_1 + p_2 * r
-//
-(p0)   fma.s1 FR_poly_lo = FR_poly_lo, FR_r, FR_P_4 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_TMP1 = FR_Sgn, f1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly_lo = p_4 + poly_lo * r
-//     poly_hi = r + poly_hi * rsq
-//
-(p0)   fma.s1 FR_poly_lo = FR_poly_lo, FR_r, FR_P_3 
-	nop.i 999
+      nop.m 999
+      fmpy.s1 FR_r4 = FR_rsq, FR_rsq
+(p12) cmp.eq  p15, p0 =  r0, r0                   // Set safe if |ylogx| < 2^-70
 }
+{ .mfb
+      nop.m 999
+(p12) fmpy.s1 FR_TMP3 = FR_Sgn, FR_X
+(p12) br.cond.spnt POWL_64_SHARED                 // Branch if |ylogx| < 2^-70
+}
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly_hi = FR_P_2, FR_r, FR_P_1 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly_lo = FR_poly_lo, FR_X, FR_P_3
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, FR_r 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, FR_X
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//  
-//     poly_lo = p_3 + poly_lo * r
-//     Y_hi = 1, always
-//  
-(p0)   fma.s1 FR_Y_lo = FR_poly_lo, FR_r4, FR_poly_hi 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_Y_lo = FR_poly_lo, FR_r4, FR_poly_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Set lsb in fp register
-// 
-(p0)   for FR_temp = FR_Y_lo,FR_temp 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_TMP3 = FR_Y_lo, FR_TMP1      // Add sign info
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
+;;
+
 //
 //     Toggle on last bit of Y_lo
-//
-(p0)   fmerge.se FR_Y_lo = FR_Y_lo,FR_temp 
-//
 //     Set lsb of Y_lo to 1
 //
-(p0)   br.cond.sptk L(EXPL_RETURN) ;; 
-}
-L(EXPL_VERY_SMALL): 
 { .mfi
-	nop.m 999
-(p0)   mov FR_Y_lo = FR_r 
-(p0)   cmp.eq.unc  p15, p0 =  r0, r0 
+      nop.m 999
+      for FR_temp = FR_Y_lo,FR_temp
+      nop.i 999
 }
-{ .mfi
-       nop.m 999
-(p0)   mov FR_Scale = f1
-       nop.i 999
-};;
+;;
+
 { .mfb
-	nop.m 999
-(p0)   mov FR_Y_hi = f1 
-//
-//     If flag_not_1, 
-//     Y_hi = 1.0 
-//     Y_lo = X + X_cor
-//     PR_Safe = true
-//
-(p0)   br.cond.sptk L(EXPL_RETURN) ;; 
+      nop.m 999
+      fmerge.se FR_TMP3 = FR_TMP3,FR_temp
+      br.cond.sptk POWL_64_SHARED
 }
-L(EXPL_HUGE): 
+;;
+
+
+EXPL_HUGE:
+// Here if |ylogx| >= 2^14
 { .mfi
-	nop.m 999
-//
-//     Return for flag=2 
-//
-(p0)   fcmp.gt.unc.s1 p12, p13 =  FR_X, f0 
-(p0)   cmp.eq.unc  p14, p15 =  r0, r0 ;; 
+      mov GR_temp = 0x0A1DC               // If X < 0, exponent -24100
+      fcmp.gt.s1 p12, p13 =  FR_X, f0     // Test X > 0
+      cmp.eq  p14, p15 =  r0, r0          // Set Safe to false
 }
-{ .mlx
-	nop.m 999
-//
-//     Set Safe to false
-//     Is x > 0
-//
-(p12)  movl GR_Mask = 0x15DC0 ;; 
-}
-{ .mlx
-(p12)  setf.exp FR_Y_hi = GR_Mask 
-(p13)  movl GR_Mask = 0xA240 ;; 
+;;
+
+{ .mmi
+(p12) mov GR_Mask = 0x15DC0               // If X > 0, exponent +24000
+(p13) mov GR_Mask = 0x0A240               // If X < 0, exponent -24000
+      nop.i 999
 }
-{ .mlx
-(p13)  setf.exp FR_Y_hi = GR_Mask 
-//     
-//     x > 0: Create mask for Y_hi = 2**(24,000) 
-//     x <= 0: Create mask for Y_hi = 2**(-24,000) 
-//
-(p13)  movl GR_temp = 0xA1DC ;; 
+;;
+
+{ .mmf
+      setf.exp FR_TMP2 = GR_Mask          // Form Y_hi = TMP2
+(p13) setf.exp FR_Y_lo = GR_temp          // If X < 0, Y_lo = 2^-24100
+(p12) mov FR_Y_lo = f1                    // IF X > 0, Y_lo = 1.0
 }
+;;
+
 { .mfi
-(p13)  setf.exp FR_Y_lo = GR_temp 
-//
-//     x < =0: Create mask for 2**(-24,100)
-//     x <= 0: Y_lo = w**(-24,100)
-//
-(p12)  mov FR_Y_lo = f1 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_TMP1 = FR_TMP2, FR_Sgn   // TMP1 = Y_hi * Sgn
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
-(p12)  mov FR_Scale =  FR_Y_hi 
-	nop.i 999 ;;
+;;
+
+{ .mfb
+      nop.m 999
+      fmpy.s1 FR_TMP3 = FR_Y_lo,FR_TMP1   // TMP3 = Y_lo * (Y_hi * Sgn)
+      br.cond.sptk POWL_64_SHARED
 }
-{ .mfi
-	nop.m 999
+;;
+
+POWL_Y_ALMOST_1:
+// Here if delta = |y-1| < 2^-50
 //
-//     x > 0: Y_lo = 1.0
-//     x > 0: Scale = 2**(24,000) 
+//  x**(1 + delta) = x * e (ln(x)*delta) = x ( 1 + ln(x) * delta)
 //
-(p13)  mov FR_Scale = FR_Y_hi 
-	nop.i 999 ;;
-}
-L(EXPL_RETURN): 
+// Computation will be safe for 2^-16381 <= x < 2^16383
+
 { .mfi
-	nop.m 999
-//
-//     Scale = 2**(24,000)
-//
-//
-//     exp(y *ln(x)) almost complete 
-//     FR_Scale is Scale
-//     f34 is Z_hi 
-//     f35 is Z_lo 
-//
-(p0)   fmpy.s1 FR_Sgn = FR_Scale, FR_Sgn  
-	nop.i 999 ;;
+       mov GR_exp_ynear1_oflow = 0xffff + 16383
+       fma.s1 FR_TMP1 = FR_Input_X,FR_Delta,f0
+       and GR_exp_x = GR_exp_mask, GR_signexp_x
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     sgn * scale 
-//
-(p0)   fmpy.s1 FR_Y_lo = FR_Y_lo,FR_Sgn   
-	nop.i 999 ;;
+       cmp.lt  p15, p14 =  GR_exp_x, GR_exp_ynear1_oflow
+       fma.s1 FR_TMP2 = FR_logx_hi,f1,FR_X_lo
+       mov GR_exp_ynear1_uflow = 0xffff - 16381
 }
+;;
+
 { .mfb
-	nop.m 999
-//
-//     Z_lo * (sgn * scale) 
+(p15)  cmp.ge  p15, p14 =  GR_exp_x, GR_exp_ynear1_uflow
+       fma.s1 FR_TMP3 = FR_Input_X,f1,f0
+       br.cond.sptk POWL_64_SHARED
+};;
+
+POWL_64_SQUARE:
 //
-(p0)   fma.s0 FR_Result = FR_Y_hi, FR_Sgn, FR_Y_lo  
+//      Here if x not zero and y=2.
 //
-//     Z_hi * (sgn * scale)  + Z_lo
+//      Setup for multipath code
 //
-(p15)  br.cond.sptk L(POWL_64_RETURN) ;;
-}
 { .mfi
-	nop.m 999
-(p0)   fsetc.s3 0x7F,0x01
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-//
-//     Z_hi * (sgn * scale)  + Z_lo with wre & td
-//     Z_hi * (sgn * scale)  + Z_lo with fz  & td
-//
-(p0)   movl GR_T1_ptr = 0x00000000013FFF ;;
+      mov GR_exp_square_oflow = 0xffff + 8192   // Exponent where x*x overflows
+      fmerge.se FR_TMP1 = FR_Input_X, FR_Input_X
+      and GR_exp_x = GR_exp_mask, GR_signexp_x  // Get exponent of x
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s3  FR_Result_small = FR_Y_hi, FR_Sgn, FR_Y_lo  
-	nop.i 999
+      cmp.lt  p15, p14 =  GR_exp_x, GR_exp_square_oflow // Decide safe/unsafe
+      fmerge.se FR_TMP2 = FR_Input_X, FR_Input_X
+      mov GR_exp_square_uflow = 0xffff - 8191   // Exponent where x*x underflows
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fsetc.s3 0x7F,0x40
-	nop.i 999 ;;
+(p15) cmp.ge  p15, p14 =  GR_exp_x, GR_exp_square_uflow // Decide safe/unsafe
+      fma.s1 FR_TMP3 = f0,f0,f0
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     Return if no danger of over of underflow.
+//      This is the shared path that will set overflow and underflow.
 //
-(p0)   fsetc.s2 0x7F,0x42
-	nop.i 999;;
-}
-{ .mfi
-	nop.m 999
+POWL_64_SHARED:
+
 //
-//     S0 user supplied status
-//     S2 user supplied status + WRE + TD  (Overflows)
-//     S3 user supplied status + FZ + TD   (Underflows)
+//      Return if no danger of over or underflow.
 //
-(p0)   fma.s2  FR_Result_big = FR_Y_hi, FR_Sgn, FR_Y_lo  
-	nop.i 999 ;;
+{ .mfb
+      nop.m 999
+      fma.s0 FR_Result = FR_TMP1, FR_TMP2, FR_TMP3
+(p15) br.ret.sptk  b0      // Main path return if certain no over/underflow
 }
+;;
+
 //
-//     S0 user supplied status
-//     S2 user supplied status + WRE + TD  (Overflows)
-//     S3 user supplied status + FZ + TD   (Underflows)
+//      S0 user supplied status
+//      S2 user supplied status + WRE + TD  (Overflows)
+//      S2 user supplied status + FZ + TD   (Underflows)
 //
 //
 //     If (Safe) is true, then
@@ -2430,973 +2022,742 @@ L(EXPL_RETURN):
 //        No overflow or underflow here, but perhaps inexact.
 //        Return
 //     Else
-//       Determine if overflow or underflow  was raised.
-//       Fetch +/- overflow threshold for IEEE single, double,
-//       double extended
-//
-{ .mfi
-(p0)   setf.exp FR_Big = GR_T1_ptr
-(p0)   fsetc.s2 0x7F,0x40
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fclass.m.unc   p11, p0 =  FR_Result_small, 0x00F
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fmerge.ns FR_NBig = FR_Big, FR_Big
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-//
-//     Create largest double exponent + 1.
-//     Create smallest double exponent - 1.
-//     Identify denormals
-//
-(p0)   fcmp.ge.unc.s1 p8, p0 = FR_Result_big , FR_Big
-	nop.i 999 ;;
-}
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//     fcmp:   resultS2 <= - overflow threshold  
-//     fclass: resultS3 is denorm/unorm/0       
-//
-(p8)   mov   GR_Parameter_TAG = 18 ;;
-}
-{ .mfb
-	nop.m 999
-//
-//     fcmp:   resultS2 >= + overflow threshold  
-//
-(p0)   fcmp.le.unc.s1 p9, p0 = FR_Result_big, FR_NBig
-(p8)   br.cond.spnt __libm_error_region ;;
-}
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-(p9)   mov   GR_Parameter_TAG = 18
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)   br.cond.spnt __libm_error_region ;;
-}
-//
-//     Report that pow overflowed - either +Inf, or -Inf
-//
-{ .mmb
-(p11)  mov   GR_Parameter_TAG = 19
-	nop.m 999
-(p11)  br.cond.spnt __libm_error_region ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Report that pow underflowed
-//
-(p0)   br.cond.sptk L(POWL_64_RETURN) ;;
-}
-
+//       Determine if overflow or underflow was raised.
+//       Fetch +/- overflow threshold for IEEE double extended
 
-L(POWL_64_SQUARE):
-// Here if x not zero and y=2.
-// Must call __libm_error_support for overflow or underflow
-//
-//     S0 user supplied status
-//     S2 user supplied status + WRE + TD  (Overflows)
-//     S3 user supplied status + FZ + TD   (Underflows)
-//
 { .mfi
-	nop.m 999
-(p0)   fma.s0 FR_Result = FR_Input_X, FR_Input_X, f0
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p0)   fsetc.s3 0x7F,0x01
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)   movl GR_T1_ptr = 0x00000000013FFF ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fma.s3 FR_Result_small = FR_Input_X, FR_Input_X, f0
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p0)   fsetc.s3 0x7F,0x40
-	nop.i 999 ;;
+      nop.m 999
+      fsetc.s2 0x7F,0x41       // For underflow test, set S2=User+TD+FTZ
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Return if no danger of over of underflow.
-//
-(p0)   fsetc.s2 0x7F,0x42
-	nop.i 999;;
+      nop.m 999
+      fma.s2 FR_Result_small = FR_TMP1, FR_TMP2, FR_TMP3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s2 FR_Result_big = FR_Input_X, FR_Input_X, f0
-	nop.i 999 ;;
+      nop.m 999
+      fsetc.s2 0x7F,0x42       // For overflow test, set S2=User+TD+WRE
+      nop.i 999
 }
-//
-//     S0 user supplied status
-//     S2 user supplied status + WRE + TD  (Overflows)
-//     S3 user supplied status + FZ + TD   (Underflows)
-//
-//
-//     If (Safe) is true, then
-//        Compute result using user supplied status field.
-//        No overflow or underflow here, but perhaps inexact.
-//        Return
-//     Else
-//       Determine if overflow or underflow  was raised.
-//       Fetch +/- overflow threshold for IEEE single, double,
-//       double extended
-//
+;;
+
 { .mfi
-(p0)   setf.exp FR_Big = GR_T1_ptr
-(p0)   fsetc.s2 0x7F,0x40
-	nop.i 999 ;;
+      nop.m 999
+      fma.s2 FR_Result_big = FR_TMP1, FR_TMP2,FR_TMP3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc   p11, p0 =  FR_Result_small, 0x00F
-	nop.i 999 ;;
+      nop.m 999
+      fsetc.s2 0x7F,0x40       // Reset S2=User
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fmerge.ns FR_NBig = FR_Big, FR_Big
-	nop.i 999
+      nop.m 999
+      fclass.m p11, p0 = FR_Result_small, 0x00F // Test small result unorm/zero
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Create largest double exponent + 1.
-//     Create smallest double exponent - 1.
-//     Identify denormals
-//
-(p0)   fcmp.ge.unc.s1 p8, p0 = FR_Result_big , FR_Big
-	nop.i 999 ;;
-}
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//     fcmp:   resultS2 <= - overflow threshold  
-//     fclass: resultS3 is denorm/unorm/0       
-//
-(p8)   mov   GR_Parameter_TAG = 18 ;;
+      nop.m 999
+      fcmp.ge.s1 p8, p0 = FR_Result_big , FR_Big // Test >= + oflow threshold
+      nop.i 999
 }
+;;
+
 { .mfb
-	nop.m 999
-//
-//     fcmp:   resultS2 >= + overflow threshold  
-//
-(p0)   fcmp.le.unc.s1 p9, p0 = FR_Result_big, FR_NBig
-(p8)   br.cond.spnt __libm_error_region ;;
-}
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-(p9)   mov   GR_Parameter_TAG = 18
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)   br.cond.spnt __libm_error_region ;;
-}
-//
-//     Report that pow overflowed - either +Inf, or -Inf
-//
-{ .mmb
-(p11)  mov   GR_Parameter_TAG = 19
-	nop.m 999
-(p11)  br.cond.spnt __libm_error_region ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Report that pow underflowed
-//
-(p0)   br.cond.sptk L(POWL_64_RETURN) ;;
+(p11) mov   GR_Parameter_TAG = 19                // Set tag for underflow
+      fcmp.le.s1 p9, p0 = FR_Result_big, FR_NBig // Test <= - oflow threshold
+(p11) br.cond.spnt __libm_error_region           // Branch if pow underflowed
 }
+;;
 
+{ .mfb
+(p8)  mov   GR_Parameter_TAG = 18                // Set tag for overflow
+      nop.f 999
+(p8)  br.cond.spnt __libm_error_region           // Branch if pow +overflow
+}
+;;
 
+{ .mbb
+(p9)  mov   GR_Parameter_TAG = 18                // Set tag for overflow
+(p9)  br.cond.spnt __libm_error_region           // Branch if pow -overflow
+      br.ret.sptk  b0                            // Branch if result really ok
+}
+;;
 
 
-L(POWL_64_SPECIAL): 
+POWL_64_SPECIAL:
+// Here if x or y is NatVal, nan, inf, or zero
 { .mfi
-	nop.m 999
-(p0)   fcmp.eq.s1 p15, p0 =  FR_Input_X, f1  // Is x=+1
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.eq.s1 p15, p0 =  FR_Input_X, f1  // Test x=+1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p14, p0 =  FR_Input_Y, 0x023 
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p8, p0 =  FR_Input_X, 0x143  // Test x natval, snan
+      nop.i 999
 }
+;;
 
 { .mfi
-	nop.m 999
-(p15)   fcmp.eq.unc.s0 p6,p0 = FR_Input_Y, f0 // If x=1, flag invalid if y=SNaN
-	nop.i 999 
+      nop.m 999
+(p15) fcmp.eq.unc.s0 p6,p0 = FR_Input_Y, f0 // If x=1, flag invalid if y=SNaN
+      nop.i 999
 }
 { .mfb
-	nop.m 999
-(p15)   fmpy.s0 FR_Result = f1,f1        // If x=1, result=1
-(p15)   br.cond.spnt L(POWL_64_RETURN) ;;   // Exit if x=1
+      nop.m 999
+(p15) fmpy.s0 FR_Result = f1,f1             // If x=1, result=1
+(p15) br.ret.spnt b0                        // Exit if x=1
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p13, p0 =  FR_Input_X, 0x023 
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fclass.m.unc p8, p0 =  FR_Input_X, 0x143 
-	nop.i 999
+      nop.m 999
+      fclass.m p6, p0 =  FR_Input_Y, 0x007  // Test y zero
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p9, p0 =  FR_Input_Y, 0x143 
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p9, p0 =  FR_Input_Y, 0x143  // Test y natval, snan
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p10, p0 =  FR_Input_X, 0x083 
-	nop.i 999
+      nop.m 999
+      fclass.m p10, p0 =  FR_Input_X, 0x083 // Test x qnan
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p11, p0 =  FR_Input_Y, 0x083 
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fmpy.s0 FR_Result = FR_Input_Y, FR_Input_X // If x=snan, result=qnan
+(p6)  cmp.ne p8,p0 = r0,r0     // Don't exit if x=snan, y=0 ==> result=+1
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p6, p0 =  FR_Input_Y, 0x007 
-	nop.i 999
+      nop.m 999
+(p6)  fclass.m.unc p15, p0 =  FR_Input_X,0x007   // Test x=0, y=0
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
-(p0)   fcmp.eq.unc.s1 p7, p0 =  FR_Input_Y, f1 
-	nop.i 999 ;;
+{ .mfb
+      nop.m 999
+(p9)  fmpy.s0 FR_Result = FR_Input_Y, FR_Input_X // If y=snan, result=qnan
+(p8)  br.ret.spnt b0                             // Exit if x=snan, y not 0,
+                                                 //   result=qnan
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     set p13 if x +/- Inf 
-//     set p14 if y +/- Inf 
-//     set p8  if x  Natval or +/-SNaN  
-//     set p9  if y  Natval or +/-SNaN  
-//     set p10 if x QNaN
-//     set p11 if y QNaNs
-//     set p6  if y is +/-0 
-//     set p7  if y is 1
-//
-(p8)   fmpy.s0 FR_Result = FR_Input_Y, FR_Input_X 
-(p6)   cmp.ne p8,p0 = r0,r0 ;;  // Don't exit if x=snan, y=0 ==> result=+1
-}
-{ .mfb
-	nop.m 999
-(p9)   fmpy.s0 FR_Result = FR_Input_Y, FR_Input_X 
-(p8)   br.cond.spnt L(POWL_64_RETURN) ;; 
+      nop.m 999
+      fcmp.eq.s1 p7, p0 =  FR_Input_Y, f1        // Test y +1.0
+      nop.i 999
 }
 { .mfb
-	nop.m 999
-(p10)  fmpy.s0 FR_Result = FR_Input_X, f0 
-(p9)   br.cond.spnt L(POWL_64_RETURN) ;; 
-}
-{ .mfi
-	nop.m 999
-//
-//     Produce result for SNaN and NatVals and return
-//
-(p6)   fclass.m.unc p15, p0 =  FR_Input_X,0x007 
-	nop.i 999
+      nop.m 999
+(p10) fmpy.s0 FR_Result = FR_Input_X, f0         // If x=qnan, result=qnan
+(p9)  br.ret.spnt b0                             // Exit if y=snan, result=qnan
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     If Y +/- 0, set p15 if x +/- 0
-//
-(p6)   fclass.m.unc p8, p0 =  FR_Input_X,0x0C3 
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fclass.m.unc p8, p0 =  FR_Input_X,0x0C3    // Test x=nan, y=0
+      nop.i 999
 }
+;;
 
 { .mfi
-	nop.m 999
-(p6)   fcmp.eq.s0 p9,p0 = FR_Input_X, f0 // If y=0, flag if x denormal
-	nop.i 999
+      nop.m 999
+(p6)  fcmp.eq.s0 p9,p0 = FR_Input_X, f0          // If y=0, flag if x denormal
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p6)   fadd.s0 FR_Result = f1, f0
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fadd.s0 FR_Result = f1, f0                 // If y=0, result=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-// 
-//     Set p8 if y = +/-0 and X is a QNaN/SNaN
-//     If y = +/-0, let result = 1.0
-// 
-(p7)   fmpy.s0 FR_Result = FR_Input_X,f1
-//
-//     If y == 1, result = x * 1 
-//
-(p15)  mov GR_Parameter_TAG = 20 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p15)  br.cond.spnt __libm_error_region ;;
-}
-{ .mib
-	nop.m 999
-//
-//     If x and y are both zero, result = 1.0 and call error
-//     support. 
-//
-(p8)   mov GR_Parameter_TAG = 23 
-(p8)   br.cond.spnt __libm_error_region ;;
+      nop.m 999
+      fclass.m p11, p0 =  FR_Input_Y, 0x083      // Test y qnan
+      nop.i 999
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     If y = +/-0 and x is a QNaN, result = 1.0 and call error
-//     support. 
-//
-(p6)   br.cond.spnt L(POWL_64_RETURN) ;; 
+{ .mfb
+(p15) mov GR_Parameter_TAG = 20                  // Error tag for x=0, y=0
+(p7)  fmpy.s0 FR_Result = FR_Input_X,f1          // If y=1, result=x
+(p15) br.cond.spnt __libm_error_region           // Branch if x=0, y=0, result=1
 }
+;;
 
-// If x=0, y=-inf, go to the X_IS_ZERO path
 { .mfb
-	nop.m 999
-(p14)  fcmp.eq.unc.s1 p0,p14 = FR_Input_X,f0 
-(p7)   br.cond.spnt L(POWL_64_RETURN) ;; 
+(p8)  mov GR_Parameter_TAG = 23                  // Error tag for x=nan, y=0
+      fclass.m p14, p0 =  FR_Input_Y, 0x023      // Test y inf
+(p8)  br.cond.spnt __libm_error_region           // Branch if x=snan, y=0,
+                                                 //   result=1
 }
+;;
 
-{ .mfi
-	nop.m 999
-//
-//     Produce all results for x**0 and x**1 
-//     Let all the result x ** 0 == 1 and return
-//     Let all x ** 1 == x and return
-//
-(p10)  fmpy.s0 FR_Result = FR_Input_Y,FR_Input_X
-	nop.i 999 ;;
-}
 { .mfb
-	nop.m 999
-(p11)  fmpy.s0 FR_Result = FR_Input_Y,FR_Input_X
-(p10)  br.cond.spnt L(POWL_64_RETURN) ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p11)  br.cond.spnt L(POWL_64_RETURN) ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Return result for x or y QNaN input with QNaN result 
-//
-(p14)  br.cond.spnt L(POWL_64_Y_IS_INF) ;;
+      nop.m 999
+      fclass.m p13, p0 =  FR_Input_X, 0x023      // Test x inf
+(p6)  br.ret.spnt b0                             // Exit y=0, x not nan or 0,
+                                                 //   result=1
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p13)  br.cond.spnt L(POWL_64_X_IS_INF) ;;
+;;
+
+{ .mfb
+      nop.m 999
+(p14) fcmp.eq.unc.s1 p0,p14 = FR_Input_X,f0      // Test x not 0, y=inf
+(p7)  br.ret.spnt b0                             // Exit y=1, x not snan,
+                                                 //   result=x
 }
-L(POWL_64_X_IS_ZERO): 
-{ .mmb
-(p0)   getf.sig GR_signif_y = FR_Input_Y 
-(p0)   getf.exp GR_BIASed_exp_y = FR_Input_Y
-	nop.b 999 ;;
+;;
+
+{ .mfb
+      nop.m 999
+(p10) fmpy.s0 FR_Result = FR_Input_Y,FR_Input_X  // If x=qnan, y not snan,
+                                                 //   result=qnan
+(p10) br.ret.spnt b0                             // Exit x=qnan, y not snan,
+                                                 //   result=qnan
 }
-{ .mlx
-	nop.m 999
-(p0)   movl GR_Mask = 0x1FFFF
+;;
+
+{ .mfb
+      nop.m 999
+(p11) fmpy.s0 FR_Result = FR_Input_Y,FR_Input_X  // If y=qnan, x not nan or 1,
+                                                 //   result=qnan
+(p11) br.ret.spnt b0                             // Exit y=qnan, x not nan or 1,
+                                                 //   result=qnan
 }
-{ .mlx
-	nop.m 999
-(p0)   movl GR_y_sign = 0x20000 ;;
+;;
+
+{ .mbb
+      nop.m 999
+(p14) br.cond.spnt POWL_64_Y_IS_INF           // Branch if y=inf, x not 1 or nan
+(p13) br.cond.spnt POWL_64_X_IS_INF           // Branch if x=inf, y not 1 or nan
 }
-//
-//     Get BIASed exp and significand of y
+;;
+
+
+POWL_64_X_IS_ZERO:
+// Here if x=0, y not nan or 1 or inf or 0
+
+// There is logic starting here to determine if y is an integer when x = 0.
+// If 0 < |y| < 1 then clearly y is not an integer.
+// If |y| > 1, then the significand of y is shifted left by the size of
+//    the exponent of y.  This preserves the lsb of the integer part + the
+//    fractional bits.  The lsb of the integer can be tested to determine if
+//    the integer is even or odd.  The fractional bits can be tested.  If zero,
+//    then y is an integer.
 //
 { .mfi
-(p0)   and GR_exp_y = GR_Mask,GR_BIASed_exp_y
-	nop.f 999
-(p0)   and GR_y_sign = GR_y_sign,GR_BIASed_exp_y
-}
-{ .mlx
-	nop.m 999
-(p0)   movl GR_BIAS = 0xFFFF ;;
+      and GR_exp_y = GR_exp_mask,GR_signexp_y   // Get biased exponent of y
+      nop.f 999
+      and GR_y_sign = GR_sign_mask,GR_signexp_y // Get sign of y
 }
-{ .mfi
-(p0)   cmp.lt.unc  p9, p8 = GR_exp_y,GR_BIAS
-	nop.f 999
+;;
+
 //
 //     Maybe y is < 1 already, so
 //     can never be an integer.
-//     Remove sign bit from exponent.
-//
-(p0)   sub GR_exp_y = GR_exp_y,GR_BIAS ;;
-}
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//     Remove exponent BIAS
 //
-(p8)   shl GR_exp_y=  GR_signif_y,GR_exp_y ;;
-}
 { .mfi
-(p9)   or  GR_exp_y=  0xF,GR_signif_y
-	nop.f 999
-	nop.i 999 ;;
+      cmp.lt  p9, p8 = GR_exp_y,GR_exp_bias     // Test 0 < |y| < 1
+      nop.f 999
+      sub GR_exp_y = GR_exp_y,GR_exp_bias       // Get true exponent of y
 }
-{ .mii
-	nop.m 999
+;;
+
 //
 //     Shift significand of y looking for nonzero bits
 //     For y > 1, shift signif_y exp_y bits to the left
-//     For y < 1, turn on 4 low order bits of significand of y 
+//     For y < 1, turn on 4 low order bits of significand of y
 //     so that the fraction will always be non-zero
 //
-(p0)   shl GR_signif_y=  GR_exp_y,1 ;;
-(p0)   extr.u GR_low_order_bit = GR_exp_y,63,1
+{ .mmi
+(p9)  or  GR_exp_y=  0xF,GR_signif_y            // Force nonzero fraction if y<1
+;;
+      nop.m 999
+(p8)  shl GR_exp_y=  GR_signif_y,GR_exp_y       // Get lsb of int + fraction
+                                                // Wait 4 cycles to use result
 }
+;;
+
+{ .mmi
+      nop.m 999
+;;
+      nop.m 999
+      nop.i 999
+}
+;;
+
+{ .mmi
+      nop.m 999
+;;
+      nop.m 999
+      shl GR_fraction_y=  GR_exp_y,1            // Shift left 1 to get fraction
+}
+;;
+
 //
 //     Integer part of y  shifted off.
 //     Get y's low even or odd bit - y might not be an int.
 //
 { .mii
-(p0)   cmp.eq.unc  p13,p0  =  GR_signif_y, r0
-(p0)   cmp.eq.unc  p8,p9 =  GR_y_sign, r0 ;;
-//
-//     Is y an int?
-//     Is y positive
-//
-(p13)  cmp.ne.unc  p13,p0 =  GR_low_order_bit, r0 ;;
+      cmp.eq  p13,p0  =  GR_fraction_y, r0      // Test for y integer
+      cmp.eq  p8,p0 =  GR_y_sign, r0            // Test for y > 0
+;;
+(p13) tbit.nz.unc p13,p0 = GR_exp_y, 63         // Test if y an odd integer
+}
+;;
+
+{ .mfi
+(p13) cmp.eq.unc p13,p14 =  GR_y_sign, r0   // Test y pos odd integer
+(p8)  fcmp.eq.s0 p12,p0 = FR_Input_Y, f0    // If x=0 and y>0 flag if y denormal
+      nop.i 999
 }
+;;
+
 //
-//     Is y and int and odd?
+//     Return +/-0 when x=+/-0 and y is positive odd integer
 //
 { .mfb
-(p13)  cmp.eq.unc  p13,p14 =  GR_y_sign, r0
-(p8)   fcmp.eq.s0 p12,p0 = FR_Input_Y, f0 // If x=0 and y>0 flag if y denormal
-	nop.b 999 ;;
+      nop.m 999
+(p13) mov FR_Result = FR_Input_X            // If x=0,  y pos odd int, result=x
+(p13) br.ret.spnt b0                        // Exit x=0, y pos odd int, result=x
 }
-{ .mfb
-	nop.m 999
+;;
+
 //
-//     Is y and int and odd and positive?
+//     Return +/-inf when x=+/-0 and y is negative odd int
 //
-(p13)  mov FR_Result = FR_Input_X 
-(p13)  br.cond.sptk L(POWL_64_RETURN) ;;
+{ .mfb
+(p14) mov GR_Parameter_TAG = 21
+(p14) frcpa.s0 FR_Result, p0 = f1, FR_Input_X  // Result +-inf, set Z flag
+(p14) br.cond.spnt __libm_error_region
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     Return +/-0 when x=+/-0 and y is and odd pos. int
+//     Return +0 when x=+/-0 and y positive and not an odd integer
 //
-(p14)  frcpa.s0 FR_Result, p10 = f1, FR_Input_X
-(p14)  mov GR_Parameter_TAG = 21
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p14)  br.cond.spnt __libm_error_region ;;
+{ .mfb
+      nop.m 999
+(p8)  mov FR_Result = f0      // If x=0, y>0 and not odd integer, result=+0
+(p8)  br.ret.sptk b0          // Exit x=0, y>0 and not odd integer, result=+0
 }
+;;
 
-{ .mfb
-	nop.m 999
 //
-//     Return +/-0 when x=+/-Inf and y is and odd neg int
-//     and raise dz exception
+//     Return +inf when x=+/-0 and y is negative and not odd int
 //
-(p8)   mov FR_Result = f0
-(p8)   br.cond.sptk L(POWL_64_RETURN) ;;
+{ .mfb
+      mov GR_Parameter_TAG = 21
+      frcpa.s0 FR_Result, p10 = f1,f0   // Result +inf, raise Z flag
+      br.cond.sptk __libm_error_region
 }
-{ .mfi
-	nop.m 999
+;;
+
+
+POWL_64_X_IS_INF:
 //
-//     Return +0 when x=+/-0 and y > 0  and not odd.
+// Here if x=inf, y not 1 or nan
 //
-(p9)   frcpa.s0 FR_Result, p10 = f1,f0
-(p9)   mov GR_Parameter_TAG = 21
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)   br.cond.sptk __libm_error_region ;;
-}
-L(POWL_64_X_IS_INF): 
 { .mfi
-(p0)   getf.exp GR_exp_y = FR_Input_Y
-(p0)   fclass.m.unc p13, p0 =  FR_Input_X,0x022 
-(p0)   mov GR_Mask = 0x1FFFF ;;
+      and GR_exp_y = GR_exp_mask,GR_signexp_y   // Get biased exponent y
+      fclass.m p13, p0 =  FR_Input_X,0x022      // Test x=-inf
+      nop.i 999
 }
+;;
 
 { .mfi
-(p0)   getf.sig GR_signif_y = FR_Input_Y
-(p0)   fcmp.eq.s0 p9,p0 = FR_Input_Y, f0 // Flag if y denormal
-       nop.i 999 ;;
+      and GR_y_sign = GR_sign_mask,GR_signexp_y // Get sign of y
+      fcmp.eq.s0 p9,p0 = FR_Input_Y, f0         // Dummy to set flag if y denorm
+      nop.i 999
 }
+;;
 
 //
-//     Get exp and significand of y
-//     Create exponent mask and sign mask
+//     Maybe y is < 1 already, so
+//     isn't an int.
 //
-{ .mlx
-(p0)   and GR_low_order_bit = GR_Mask,GR_exp_y
-(p0)   movl GR_BIAS = 0xFFFF
+{ .mfi
+(p13) cmp.lt.unc  p9, p8 = GR_exp_y,GR_exp_bias // Test 0 < |y| < 1 if x=-inf
+      fclass.m p11, p0 =  FR_Input_X,0x021      // Test x=+inf
+      sub GR_exp_y = GR_exp_y,GR_exp_bias       // Get true exponent y
 }
-{ .mmi
-	nop.m 999 ;;
+;;
+
 //
-//     Remove sign bit from exponent.
+//     Shift significand of y looking for nonzero bits
+//     For y > 1, shift signif_y exp_y bits to the left
+//     For y < 1, turn on 4 low order bits of significand of y
+//     so that the fraction will always be non-zero
 //
-(p0)   cmp.lt.unc  p9, p8 = GR_low_order_bit,GR_BIAS
+{ .mmi
+(p9)  or  GR_exp_y=  0xF,GR_signif_y          // Force nonzero fraction if y<1
+;;
+(p11) cmp.eq.unc  p14,p12 = GR_y_sign, r0     // Test x=+inf, y>0
+(p8)  shl GR_exp_y=  GR_signif_y,GR_exp_y     // Get lsb of int + fraction
+                                              // Wait 4 cycles to use result
+}
+;;
+
 //
-//     Maybe y is < 1 already, so 
-//     isn't an int.
+//     Return +inf for x=+inf, y > 0
+//     Return +0   for x=+inf, y < 0
 //
-(p0)   sub GR_low_order_bit = GR_low_order_bit,GR_BIAS
+{ .mfi
+      nop.m 999
+(p12) mov FR_Result = f0                      // If x=+inf, y<0, result=+0
+      nop.i 999
 }
-{ .mlx
-	nop.m 999
-(p0)   movl GR_sign_mask = 0x20000 ;;
+{ .mfb
+      nop.m 999
+(p14) fma.s0 FR_Result = FR_Input_X,f1,f0     // If x=+inf, y>0, result=+inf
+(p11) br.ret.sptk b0                          // Exit x=+inf
 }
-{ .mfi
-(p0)   and GR_sign_mask = GR_sign_mask,GR_exp_y
+;;
+
 //
-//     Return +Inf when x=+/-0 and y < 0 and not odd and raise
-//     divide-by-zero exception.
+// Here only if x=-inf.  Wait until can use result of shl...
 //
-(p0)   fclass.m.unc p11, p0 =  FR_Input_X,0x021 
-	nop.i 999 ;;
-}
 { .mmi
-	nop.m 999 ;;
-//
-//     Is shift off integer part of y.
-//     Get y's even or odd bit - y might not be an int.
-//
-(p11)  cmp.eq.unc  p11,p12 = GR_sign_mask, r0
-//
-//     Remove exponent BIAS
-//
-(p8)   shl GR_exp_y = GR_signif_y,GR_low_order_bit ;;
+      nop.m 999
+;;
+      nop.m 999
+      nop.i 999
 }
+;;
+
 { .mfi
-(p9)   or  GR_exp_y = 0xF,GR_signif_y
-//
-//     Is y positive or negative when x is +Inf?
-//     Is y and int when x = -Inf 
-//
-(p11)  mov FR_Result = FR_Input_X 
-	nop.i 999 ;;
+      cmp.eq  p8,p9 = GR_y_sign, r0           // Test y pos
+      nop.f 999
+      shl GR_fraction_y = GR_exp_y,1          // Shift left 1 to get fraction
 }
-{ .mfi
-	nop.m 999
-(p12)  mov FR_Result = f0
-	nop.i 999 ;;
+;;
+
+{ .mmi
+      cmp.eq  p13,p0 = GR_fraction_y, r0      // Test y integer
+;;
+      nop.m 999
+(p13) tbit.nz.unc  p13,p0 = GR_exp_y, 63      // Test y odd integer
 }
-{ .mii
-	nop.m 999
+;;
+
 //
-//     Shift signficand looking for nonzero bits 
-//     For y non-ints, upset the significand.
+//     Is y even or odd?
 //
-(p0)   shl GR_signif_y = GR_exp_y,1 ;;
-(p13)  cmp.eq.unc  p13,p0  = GR_signif_y, r0
-}
 { .mii
-	nop.m 999
-(p0)   extr.u GR_low_order_bit = GR_exp_y,63,1 ;;
-(p13)  cmp.ne.unc  p13,p0 = GR_low_order_bit, r0
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p11)  br.cond.sptk L(POWL_64_RETURN) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p12)  br.cond.sptk L(POWL_64_RETURN) ;; 
+(p13) cmp.eq.unc  p14,p10 = GR_y_sign, r0     // Test x=-inf, y pos odd int
+(p13) cmp.ne.and  p8,p9 = r0,r0               // If y odd int, turn off p8,p9
+      nop.i 999
 }
+;;
+
 //
-//     Return Inf for y > 0
-//     Return +0  for y < 0
-//     Is y even or odd?
+//     Return -0   for x = -inf and y < 0 and odd int.
+//     Return -Inf for x = -inf and y > 0 and odd int.
 //
-{ .mii
-(p13)  cmp.eq.unc  p13,p10 = GR_sign_mask, r0
-(p0)   cmp.eq.unc  p8,p9 = GR_sign_mask, r0 ;;
-	nop.i 999
+{ .mfi
+      nop.m 999
+(p10) fmerge.ns FR_Result = f0, f0      // If x=-inf, y neg odd int, result=-0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+(p14) fmpy.s0 FR_Result = FR_Input_X,f1 // If x=-inf, y pos odd int, result=-inf
+      nop.i 999
+}
+;;
+
 //
-//     For x = -inf, y is and int, positive  
-//     and odd 
-//     Is y positive in general?
+//     Return Inf for x = -inf and y > 0 not an odd int.
+//     Return +0  for x = -inf and y < 0 not an odd int.
 //
-(p13)  mov FR_Result = FR_Input_X
-	nop.i 999 ;;
+.pred.rel "mutex",p8,p9
+{ .mfi
+      nop.m 999
+(p8)  fmerge.ns FR_Result = FR_Input_X, FR_Input_X // If x=-inf, y>0 not odd int
+                                                   //   result=+inf
+      nop.i 999
 }
 { .mfb
-	nop.m 999
-(p10)  fmerge.ns FR_Result = f0, f0 
-(p13)  br.cond.sptk L(POWL_64_RETURN) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p10)  br.cond.sptk L(POWL_64_RETURN) ;; 
+      nop.m 999
+(p9)  fmpy.s0 FR_Result = f0,f0                    // If x=-inf, y<0 not odd int
+                                                   //   result=+0
+      br.ret.sptk b0                               // Exit for x=-inf
 }
-{ .mfi
-	nop.m 999
+;;
+
+
+POWL_64_Y_IS_INF:
+// Here if y=inf, x not 1 or nan
 //
-//     Return -Inf for x = -inf and y > 0 and odd int.
-//     Return -0   for x = -inf and y < 0 and odd int.
+//     For y = +Inf and |x| < 1  returns 0
+//     For y = +Inf and |x| > 1  returns Inf
+//     For y = -Inf and |x| < 1  returns Inf
+//     For y = -Inf and |x| > 1  returns 0
+//     For y =  Inf and |x| = 1  returns 1
 //
-(p8)   fmerge.ns FR_Result = FR_Input_X, FR_Input_X 
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p9)   mov FR_Result = f0
-(p8)   br.cond.sptk L(POWL_64_RETURN) ;; 
+{ .mfi
+      nop.m 999
+      fclass.m p8, p0 =  FR_Input_Y, 0x021    // Test y=+inf
+      nop.i 999
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)   br.cond.sptk L(POWL_64_RETURN) ;; 
+;;
+
+{ .mfi
+      nop.m 999
+      fclass.m p9, p0 =  FR_Input_Y, 0x022    // Test y=-inf
+      nop.i 999
 }
-L(POWL_64_Y_IS_INF): 
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Return Inf for x = -inf and y > 0 not an odd int.
-//     Return +0  for x = -inf and y < 0 and not an odd int.
-//
-(p0)   fclass.m.unc p8, p0 =  FR_Input_Y, 0x021
-	nop.i 999
+      nop.m 999
+      fabs FR_X = FR_Input_X                  // Form |x|
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p9, p0 =  FR_Input_Y, 0x022
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.eq.s0 p10,p0 = FR_Input_X, f0      // flag if x denormal
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fabs FR_X = FR_Input_X
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fcmp.lt.unc.s1 p6, p0  =  FR_X, f1      // Test y=+inf, |x|<1
+      nop.i 999
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)   fcmp.eq.s0 p10,p0 = FR_Input_X, f0 // flag if x denormal
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fcmp.gt.unc.s1 p7, p0  =  FR_X, f1      // Test y=+inf, |x|>1
+      nop.i 999
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//     Find y = +/- Inf
-//     Compute |x|
-//
-(p8)   fcmp.lt.unc.s1 p6, p0  =  FR_X, f1
-	nop.i 999
+      nop.m 999
+(p9)  fcmp.lt.unc.s1 p12, p0 =  FR_X, f1      // Test y=-inf, |x|<1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p8)   fcmp.gt.unc.s1 p7, p0  =  FR_X, f1
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fmpy.s0 FR_Result = f0,f0               // If y=+inf, |x|<1, result=+0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p9)   fcmp.lt.unc.s1 p12, p0 =  FR_X, f1
-	nop.i 999
+      nop.m 999
+(p9)  fcmp.gt.unc.s1 p13, p0 =  FR_X, f1      // Test y=-inf, |x|>1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p9)   fcmp.gt.unc.s1 p13, p0 =  FR_X, f1
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fmpy.s0 FR_Result = FR_Input_Y, f1      // If y=+inf, |x|>1, result=+inf
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     For y = +Inf and |x| < 1  returns 0
-//     For y = +Inf and |x| > 1  returns Inf
-//     For y = -Inf and |x| < 1  returns Inf
-//     For y = -Inf and |x| > 1  returns 0
-//
-(p6)   mov FR_Result = f0
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.eq.s1 p14, p0 =  FR_X, f1          // Test y=inf, |x|=1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p7)   mov FR_Result = FR_Input_Y 
-	nop.i 999 ;;
+      nop.m 999
+(p12) fnma.s0 FR_Result = FR_Input_Y, f1, f0  // If y=-inf, |x|<1, result=+inf
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p12)  fmpy.s0 FR_Result = FR_Input_Y, FR_Input_Y
-	nop.i 999 ;;
+      nop.m 999
+(p13) mov FR_Result = f0                      // If y=-inf, |x|>1, result=+0
+      nop.i 999
 }
+;;
+
 { .mfb
-	nop.m 999
-(p13)  mov FR_Result = f0
-//
-//     Produce x ** +/- Inf results
-//
-(p6)   br.cond.spnt L(POWL_64_RETURN) ;;
+      nop.m 999
+(p14) fmpy.s0 FR_Result = f1,f1               // If y=inf, |x|=1, result=+1
+      br.ret.sptk b0                          // Common return for y=inf
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p7)   br.cond.spnt L(POWL_64_RETURN) ;;
+;;
+
+
+// Here if x or y denorm/unorm
+POWL_DENORM:
+{ .mmi
+      getf.sig GR_signif_Z = FR_norm_X   // Get significand of x
+;;
+      getf.exp GR_signexp_y = FR_norm_Y  // Get sign and exp of y
+      nop.i 999
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p12)  br.cond.spnt L(POWL_64_RETURN) ;;
+;;
+
+{ .mfi
+      getf.sig GR_signif_y = FR_norm_Y   // Get significand of y
+      nop.f 999
+      nop.i 999
 }
+;;
+
 { .mib
-	nop.m 999
-	nop.i 999
-(p13)  br.cond.spnt L(POWL_64_RETURN) ;;
+      getf.exp GR_signexp_x = FR_norm_X  // Get sign and exp of x
+      extr.u GR_Index1 = GR_signif_Z, 59, 4  // Extract upper 4 signif bits of x
+      br.cond.sptk  POWL_COMMON          // Branch back to main path
 }
-{ .mfb
-	nop.m 999
+;;
+
+
+POWL_64_UNSUPPORT:
 //
-//     +/-1 ** +/-Inf, result is +1
+//     Raise exceptions for specific
+//     values - pseudo NaN and
+//     infinities.
+//     Return NaN and raise invalid
 //
-(p0)   fmpy.s0 FR_Result = f1,f1
-(p0)   br.cond.sptk L(POWL_64_RETURN) ;;
-}
-L(POWL_64_UNSUPPORT): 
 { .mfb
-	nop.m 999
+      nop.m 999
+      fmpy.s0 FR_Result = FR_Input_X,f0
+      br.ret.sptk b0
+}
+;;
+
+POWL_64_XNEG:
 //
-//     Return NaN and raise invalid    
+//     Raise invalid for x < 0  and
+//     y not an integer
 //
-(p0)   fmpy.s0 FR_Result = FR_Input_X,f0
-// 
-//     Raise exceptions for specific
-//     values - pseudo NaN and
-//     infinities.  
-// 
-(p0)   br.cond.sptk L(POWL_64_RETURN) ;; 
-}
-L(POWL_64_XNEG): 
 { .mfi
-	nop.m 999
-(p0)   frcpa.s0 FR_Result, p8 =  f0, f0
-// 
-//     Raise invalid for x < 0  and
-//     y not an integer and
-// 
-(p0)   mov GR_Parameter_TAG = 22
+      nop.m 999
+      frcpa.s0 FR_Result, p8 =  f0, f0
+      mov GR_Parameter_TAG = 22
 }
 { .mib
-	nop.m 999
-	nop.i 999
-(p0)   br.cond.sptk __libm_error_region ;; 
+      nop.m 999
+      nop.i 999
+      br.cond.sptk __libm_error_region
 }
-L(POWL_64_SQRT): 
+;;
+
+POWL_64_SQRT:
 { .mfi
-	nop.m 999
-(p0)   frsqrta.s0 FR_Result,p10 = FR_Input_X
-	nop.i 999 ;;
+      nop.m 999
+      frsqrta.s0 FR_Result,p10 = FR_save_Input_X
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p10)  fma.s1   f62=FR_Half,FR_Input_X,f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   f62=FR_Half,FR_save_Input_X,f0
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (2)
-//     h = 1/2 * a in f9
-//
-(p10)  fma.s1   f63=FR_Result,FR_Result,f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   f63=FR_Result,FR_Result,f0
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (3)
-//     t1 = y0 * y0 in f10
-//
-(p10)  fnma.s1  f32=f63,f62,f11
-	nop.i 999 ;;
+      nop.m 999
+(p10) fnma.s1  f32=f63,f62,FR_Half
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (4)
-//     t2 = 1/2 - t1 * h in f10
-//
-(p10)  fma.s1   f33=f32,FR_Result,FR_Result
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   f33=f32,FR_Result,FR_Result
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (5)
-//     y1 = y0 + t2 * y0 in f13
-//
-(p10)  fma.s1   f34=f33,f62,f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   f34=f33,f62,f0
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (6)
-//     t3 = y1 * h in f10
-//
-(p10)  fnma.s1  f35=f34,f33,f11
-	nop.i 999 ;;
+      nop.m 999
+(p10) fnma.s1  f35=f34,f33,FR_Half
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (7)
-//     t4 = 1/2 - t3 * y1 in f10
-//
-(p10)  fma.s1   f63=f35,f33,f33
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   f63=f35,f33,f33
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (8)
-//     y2 = y1 + t4 * y1 in f13
-//
-(p10)  fma.s1   f32=FR_Input_X,f63,f0
-	nop.i 999
+      nop.m 999
+(p10) fma.s1   f32=FR_save_Input_X,f63,f0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Step (9)
-//     S = a * y2 in f10
-//
-(p10)  fma.s1   FR_Result=f63,f62,f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   FR_Result=f63,f62,f0
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (10)
-//     t5 = y2 * h in f9
-//
-(p10)  fma.s1   f33=f11,f63,f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   f33=f11,f63,f0
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (11)
-//     H = 1/2 * y2 in f11
-//
-(p10)  fnma.s1  f34=f32,f32,f8
-	nop.i 999
+      nop.m 999
+(p10) fnma.s1  f34=f32,f32,FR_save_Input_X
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Step (12)
-//     d = a - S * S in f12
-//
-(p10)  fnma.s1  f35=FR_Result,f63,f11
-	nop.i 999 ;;
+      nop.m 999
+(p10) fnma.s1  f35=FR_Result,f63,FR_Half
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (13)
-//     t6 = 1/2 - t5 * y2 in f7
-//
-(p10)  fma.s1   f62=f33,f34,f32
-	nop.i 999
+      nop.m 999
+(p10) fma.s1   f62=f33,f34,f32
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Step (14)
-//     S1 = S + d * H in f13
-//
-(p10)  fma.s1   f63=f33,f35,f33
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1   f63=f33,f35,f33
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-//
-//     Step (15)
-//     H1 = H + t6 * h in f7
-//
-(p10)  fnma.s1  f32=f62,f62,FR_Input_X
-	nop.i 999 ;;
+      nop.m 999
+(p10) fnma.s1  f32=f62,f62,FR_save_Input_X
+      nop.i 999 ;;
 }
 { .mfb
-	nop.m 999
-//
-//     Step (16)
-//     d1 = a - S1 * S1 
-//
-(p10)  fma.s0 FR_Result=f32,f63,f62
-//
-//     Step (17)
-//     R = S1 + d1 * H1 
-//
-(p10)  br.cond.sptk L(POWL_64_RETURN) ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Do the Newton-Raphson iteration from the EAS.
-//
-(p0)   br.cond.sptk L(POWL_64_RETURN) ;; 
+      nop.m 999
+(p10) fma.s0 FR_Result=f32,f63,f62
+      br.ret.sptk   b0                // Exit for x > 0, y = 0.5
 }
-//
-//     Take care of the degenerate cases.
-//
+;;
+
+GLOBAL_LIBM_END(powl)
 
-L(POWL_64_RETURN):
-{ .mfb
-       nop.m 999
-(p0)   mov   FR_Output = FR_Result
-(p0)   br.ret.sptk   b0 ;;
-}
-.endp powl
-ASM_SIZE_DIRECTIVE(powl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -3411,32 +2772,32 @@ __libm_error_region:
         mov GR_SAVE_GP=gp                       // Save gp
 };;
 { .mmi
-        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
+        stfe [GR_Parameter_Y] = FR_Input_Y,16   // Save Parameter 2 on stack
         add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
         mov GR_SAVE_B0=b0                       // Save b0
 };;
 .body
 { .mib
-        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+        stfe [GR_Parameter_X] = FR_save_Input_X // Store Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y
         nop.b 0                                 // Parameter 3 address
 }
 { .mib
-        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        stfe [GR_Parameter_Y] = FR_Result       // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#  // Call error handling function
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 { .mmi
-        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfe  f8 = [GR_Parameter_RESULT]        // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                        // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                   // Restore return address
 };;
 { .mib
         mov   gp = GR_SAVE_GP                  // Restore gp
@@ -3444,7 +2805,6 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region#)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_remainder.S b/sysdeps/ia64/fpu/e_remainder.S
index d8a27722de..f655567f52 100644
--- a/sysdeps/ia64/fpu/e_remainder.S
+++ b/sysdeps/ia64/fpu/e_remainder.S
@@ -1,10 +1,10 @@
-  .file "remainder.asm"
-// Copyright (C) 2000, 2001, Intel Corporation
+.file "remainder.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, Bob Norin, 
-// Shane Story, and Ping Tak Peter Tang of the Computational Software Lab, 
-// Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,17 +35,19 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //====================================================================
-// 2/02/00  Initial version
-// 3/02/00  New Algorithm
-// 4/04/00  Unwind support added
-// 7/21/00  Fixed quotient=2^{24*m+23}*1.q1...q23 1 bug
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 03/02/00 New Algorithm
+// 04/04/00 Unwind support added
+// 07/21/00 Fixed quotient=2^{24*m+23}*1.q1...q23 1 bug
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-//11/29/00  Set FR_Y to f9
+// 11/29/00 Set FR_Y to f9
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //====================================================================
@@ -78,16 +80,12 @@
 // a=+/- Inf, or b=+/-0: return NaN, call libm_error_support
 // a=NaN or b=NaN: return NaN
 
-#include "libm_support.h"
-
 // Registers used
 //====================================================================
 // Predicate registers: p6-p14
 // General registers:   r2,r3,r28,r29,r32 (ar.pfs), r33-r39
 // Floating point registers: f6-f15,f32
 
-  .section .text
-
 GR_SAVE_B0                    = r33
 GR_SAVE_PFS                   = r34
 GR_SAVE_GP                    = r35 
@@ -103,18 +101,9 @@ FR_Y             = f9
 FR_RESULT        = f8
 
 
+.section .text
+GLOBAL_IEEE754_ENTRY(remainder)
 
-  .proc  remainder#
-  .align 32
-  .global remainder#
-  .align 32
-
-remainder:
-#ifdef _LIBC
-.global __remainder
-.type __remainder,@function
-__remainder:
-#endif
 // inputs in f8, f9
 // result in f8
 
@@ -139,7 +128,7 @@ __remainder:
 // Y +-NAN, +-inf, +-0?     p11
 { .mfi
 	  setf.exp f32=r28
-(p0)  fclass.m.unc  p11,p0 = f9, 0xe7           
+      fclass.m.unc  p11,p0 = f9, 0xe7           
       nop.i 999
 }
 // qnan snan inf norm     unorm 0 -+
@@ -148,7 +137,7 @@ __remainder:
 // X +-NAN, +-inf, ?        p9
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f8, 0xe3           
+      fclass.m.unc  p9,p0 = f8, 0xe3           
       nop.i 999;; 
 }
 
@@ -167,8 +156,8 @@ __remainder:
 } 
 
 {.bbb
-  (p9) br.cond.spnt L(FREM_X_NAN_INF)
-  (p11) br.cond.spnt L(FREM_Y_NAN_INF_ZERO)
+  (p9) br.cond.spnt FREM_X_NAN_INF
+  (p11) br.cond.spnt FREM_Y_NAN_INF_ZERO
   nop.b 0
 }  {.mfi
    nop.m 0
@@ -178,7 +167,7 @@ __remainder:
 } 
 
 
-L(remloop24): 
+remloop24: 
   { .mfi
   nop.m 0
   // Step (2)
@@ -200,7 +189,7 @@ L(remloop24):
 {.mfi
   nop.m 0
   // q1=q0*(1+e0)
-  fma.s1 f15=f12,f7,f12
+  (p6) fma.s1 f15=f12,f7,f12
   nop.i 0
 }
 { .mfi
@@ -331,7 +320,7 @@ L(remloop24):
   //  (p9) set r=r2 (new a, if not last iteration)
   // (p10) new a =r
   (p10) mov f13=f6
-  (p12) br.cond.sptk L(remloop24);;
+  (p12) br.cond.sptk remloop24;;
 } 
 
 // last iteration
@@ -388,7 +377,7 @@ L(remloop24):
 }
 
 
-L(FREM_X_NAN_INF): 
+FREM_X_NAN_INF: 
 
 // Y zero ?
 {.mfi 
@@ -405,19 +394,19 @@ L(FREM_X_NAN_INF):
   nop.m 0
   nop.i 0
   // if Y zero
-  (p11) br.cond.spnt L(FREM_Y_ZERO);;                        
+  (p11) br.cond.spnt FREM_Y_ZERO;;                        
 }
 
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p8,p0 = f8, 0x23 
+      fclass.m.unc  p8,p0 = f8, 0x23 
       nop.i 999
 }
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p11,p0 = f8, 0x23 
+      fclass.m.unc  p11,p0 = f8, 0x23 
       nop.i 999;; 
 }
 // Y NaN ?
@@ -445,14 +434,14 @@ L(FREM_X_NAN_INF):
 }
 { .mfi
       nop.m 999
-(p8) fma.d f8=f8,f1,f0                     
+(p8) fma.d.s0 f8=f8,f1,f0                     
 	  nop.i 0 ;;                        
 }
 
 { .mfb
       nop.m 999
       frcpa.s0 f8,p7=f8,f9                     
-	  (p11) br.cond.spnt L(EXP_ERROR_RETURN);;                        
+	  (p11) br.cond.spnt EXP_ERROR_RETURN;;                        
 }
 { .mib
 	nop.m 0
@@ -461,35 +450,35 @@ L(FREM_X_NAN_INF):
 }
 
 
-L(FREM_Y_NAN_INF_ZERO): 
+FREM_Y_NAN_INF_ZERO: 
 
 // Y INF
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0x23           
+      fclass.m.unc  p7,p0 = f9, 0x23           
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p7)  fma.d f8=f8,f1,f0                     
+(p7)  fma.d.s0 f8=f8,f1,f0                     
 (p7)  br.ret.spnt    b0 ;;                        
 }
 
 // Y NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f9, 0xc3           
+      fclass.m.unc  p9,p0 = f9, 0xc3           
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p9)  fma.d f8=f9,f1,f0                     
+(p9)  fma.d.s0 f8=f9,f1,f0                     
 (p9)  br.ret.spnt    b0 ;;                        
 }
 
-L(FREM_Y_ZERO):
+FREM_Y_ZERO:
 // Y zero? Must be zero at this point
 // because it is the only choice left.
 // Return QNAN indefinite
@@ -497,7 +486,7 @@ L(FREM_Y_ZERO):
 // X NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f8, 0xc3           
+      fclass.m.unc  p9,p10 = f8, 0xc3           
       nop.i 999 ;;
 }
 { .mfi
@@ -508,47 +497,42 @@ L(FREM_Y_ZERO):
 
 {.mfi
  nop.m 999
- (p9) frcpa f11,p7=f8,f0
+ (p9) frcpa.s0 f11,p7=f8,f0
  nop.i 0;;
 }
 
 { .mfi
       nop.m 999
-(p10)  frcpa         f11,p7 = f0,f0  
+(p10)  frcpa.s0         f11,p7 = f0,f0  
 	  nop.i 999;;         
 }
 
 { .mfi
       nop.m 999
-(p0)  fmerge.s      f10 = f8, f8             
+      fmerge.s      f10 = f8, f8             
       nop.i 999
 }
 
 { .mfi
       nop.m 999
-(p0)  fma.d f8=f11,f1,f0                     
+      fma.d.s0 f8=f11,f1,f0                     
       nop.i 999
 }
 
 
-L(EXP_ERROR_RETURN): 
+EXP_ERROR_RETURN: 
 
 { .mib
-(p0)  mov   GR_Parameter_TAG = 124                                 
+      mov   GR_Parameter_TAG = 124                                 
 	  nop.i 999
-(p0)  br.sptk __libm_error_region;; 
+      br.sptk __libm_error_region;; 
 }
 
-.endp remainder
-ASM_SIZE_DIRECTIVE(remainder)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__remainder)
-#endif
+GLOBAL_IEEE754_END(remainder)
 
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -596,10 +580,11 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };; 
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
+
diff --git a/sysdeps/ia64/fpu/e_remainderf.S b/sysdeps/ia64/fpu/e_remainderf.S
index 40f9b32921..0e9bedd652 100644
--- a/sysdeps/ia64/fpu/e_remainderf.S
+++ b/sysdeps/ia64/fpu/e_remainderf.S
@@ -1,11 +1,10 @@
-  .file "remainderf.asm"
-// Copyright (C) 2000, 2001, Intel Corporation
+.file "remainderf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational 
-// Software Lab, 
-// Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,17 +35,19 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //====================================================================
-// 2/02/00 Initial version
-// 3/02/00 New algorithm  
-// 4/04/00 Unwind support added
-// 7/21/00 Fixed quotient=2^{24*m+23} bug
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 03/02/00 New algorithm  
+// 04/04/00 Unwind support added
+// 07/21/00 Fixed quotient=2^{24*m+23} bug
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-//11/29/00  Set FR_Y to f9
+// 11/29/00 Set FR_Y to f9
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //====================================================================
@@ -78,9 +79,6 @@
 //====================================================================
 // a=+/- Inf, or b=+/-0: return NaN, call libm_error_support
 // a=NaN or b=NaN: return NaN
-
-#include "libm_support.h"
-
 //
 // Registers used
 //====================================================================
@@ -89,8 +87,6 @@
 // Floating point registers: f6-f15
 //
 
-.section .text
-
 GR_SAVE_B0                    = r33
 GR_SAVE_PFS                   = r34
 GR_SAVE_GP                    = r35 
@@ -106,17 +102,9 @@ FR_Y             = f9
 FR_RESULT        = f8
 
 
-  .proc  remainderf#
-  .align 32
-  .global remainderf#
-  .align 32
+.section .text
+GLOBAL_IEEE754_ENTRY(remainderf)
 
-remainderf:
-#ifdef _LIBC
-.global __remainderf
-.type __remainderf,@function
-__remainderf:
-#endif
 // inputs in f8, f9
 // result in f8
 
@@ -141,7 +129,7 @@ __remainderf:
 // Y +-NAN, +-inf, +-0?     p11
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p11,p0 = f9, 0xe7           
+      fclass.m.unc  p11,p0 = f9, 0xe7           
       nop.i 999
 }
 // qnan snan inf norm     unorm 0 -+
@@ -150,7 +138,7 @@ __remainderf:
 // X +-NAN, +-inf, ?        p9
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f8, 0xe3           
+      fclass.m.unc  p9,p0 = f8, 0xe3           
       nop.i 999;; 
 }
 
@@ -168,8 +156,8 @@ __remainderf:
   nop.i 0;;
 } 
 {.bbb
-  (p9) br.cond.spnt L(FREM_X_NAN_INF)
-  (p11) br.cond.spnt L(FREM_Y_NAN_INF_ZERO)
+  (p9) br.cond.spnt FREM_X_NAN_INF
+  (p11) br.cond.spnt FREM_Y_NAN_INF_ZERO
   nop.b 0
 }  {.mfi
    nop.m 0
@@ -179,7 +167,7 @@ __remainderf:
 } 
 
 .align 32
-L(remloop24): 
+remloop24: 
   { .mfi
   // f12=2^{24}-2
   setf.s f12=r3
@@ -347,7 +335,7 @@ L(remloop24):
   // (p9) set r=r2 (new a, if not last iteration)
   // (p10) new a =r
   (p10) mov f13=f6
-  (p12) br.cond.sptk L(remloop24);;
+  (p12) br.cond.sptk remloop24;;
 } 
 
 // last iteration
@@ -408,7 +396,7 @@ L(remloop24):
 }
 
 
-L(FREM_X_NAN_INF): 
+FREM_X_NAN_INF: 
 
 // Y zero ?
 {.mfi 
@@ -425,19 +413,19 @@ L(FREM_X_NAN_INF):
   nop.m 0
   nop.i 0
   // if Y zero
-  (p11) br.cond.spnt L(FREM_Y_ZERO);;                        
+  (p11) br.cond.spnt FREM_Y_ZERO;;                        
 }
 
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p8,p0 = f8, 0x23 
+      fclass.m.unc  p8,p0 = f8, 0x23 
       nop.i 999
 }
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p11,p0 = f8, 0x23 
+      fclass.m.unc  p11,p0 = f8, 0x23 
       nop.i 999;; 
 }
 // Y NaN ?
@@ -465,14 +453,14 @@ L(FREM_X_NAN_INF):
 }
 { .mfi
       nop.m 999
-(p8) fma.s f8=f8,f1,f0                     
+(p8) fma.s.s0 f8=f8,f1,f0                     
 	  nop.i 0 ;;                        
 }
 
 { .mfb
       nop.m 999
       frcpa.s0 f8,p7=f8,f9                     
-	  (p11) br.cond.spnt L(EXP_ERROR_RETURN);;                        
+	  (p11) br.cond.spnt EXP_ERROR_RETURN;;                        
 }
 { .mib
 	nop.m 0
@@ -481,35 +469,35 @@ L(FREM_X_NAN_INF):
 }
 
 
-L(FREM_Y_NAN_INF_ZERO): 
+FREM_Y_NAN_INF_ZERO: 
 
 // Y INF
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0x23           
+      fclass.m.unc  p7,p0 = f9, 0x23           
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p7)  fma.s f8=f8,f1,f0                     
+(p7)  fma.s.s0 f8=f8,f1,f0                     
 (p7)  br.ret.spnt    b0 ;;                        
 }
 
 // Y NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p0 = f9, 0xc3           
+      fclass.m.unc  p9,p0 = f9, 0xc3           
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p9)  fma.s f8=f9,f1,f0                     
+(p9)  fma.s.s0 f8=f9,f1,f0                     
 (p9)  br.ret.spnt    b0 ;;                        
 }
 
-L(FREM_Y_ZERO):
+FREM_Y_ZERO:
 // Y zero? Must be zero at this point
 // because it is the only choice left.
 // Return QNAN indefinite
@@ -517,7 +505,7 @@ L(FREM_Y_ZERO):
 // X NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f8, 0xc3           
+      fclass.m.unc  p9,p10 = f8, 0xc3           
       nop.i 999 ;;
 }
 { .mfi
@@ -528,47 +516,42 @@ L(FREM_Y_ZERO):
 
 {.mfi
  nop.m 999
- (p9) frcpa f11,p7=f8,f0
+ (p9) frcpa.s0 f11,p7=f8,f0
  nop.i 0;;
 }
 
 { .mfi
       nop.m 999
-(p10)  frcpa         f11,p7 = f0,f0           
+(p10)  frcpa.s0         f11,p7 = f0,f0           
 nop.i 999;;
 }
 
 { .mfi
       nop.m 999
-(p0)  fmerge.s      f10 = f8, f8             
+      fmerge.s      f10 = f8, f8             
       nop.i 999
 }
 
 { .mfi
       nop.m 999
-(p0)  fma.s f8=f11,f1,f0                     
+      fma.s.s0 f8=f11,f1,f0                     
       nop.i 999
 }
 
 
-L(EXP_ERROR_RETURN): 
+EXP_ERROR_RETURN: 
 
 { .mib
-(p0)  mov   GR_Parameter_TAG = 125                                
+      mov   GR_Parameter_TAG = 125                                
 	  nop.i 999
-(p0)  br.sptk __libm_error_region;; 
+      br.sptk __libm_error_region;; 
 }
 
-.endp remainderf
-ASM_SIZE_DIRECTIVE(remainderf)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__remainderf)
-#endif
+GLOBAL_IEEE754_END(remainderf)
 
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -616,9 +599,11 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };; 
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
+
+
diff --git a/sysdeps/ia64/fpu/e_remainderl.S b/sysdeps/ia64/fpu/e_remainderl.S
index 5856861442..8c1630e3ab 100644
--- a/sysdeps/ia64/fpu/e_remainderl.S
+++ b/sysdeps/ia64/fpu/e_remainderl.S
@@ -1,10 +1,10 @@
-.file "remainderl.asm"
-// Copyright (C) 2000, 2001, Intel Corporation
+.file "remainderl.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the Computational 
-// Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,17 +35,19 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //====================================================================
-// 2/02/00  Initial version
-// 3/02/00  New algorithm 
-// 4/04/00  Unwind support added
-// 7/21/00  Fixed quotient=2^{24*m+23}*1.q1...q23 1 bug
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 03/02/00 New algorithm 
+// 04/04/00 Unwind support added
+// 07/21/00 Fixed quotient=2^{24*m+23}*1.q1...q23 1 bug
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-//11/29/00  Set FR_Y to f9
+// 11/29/00 Set FR_Y to f9
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //====================================================================
@@ -77,9 +79,6 @@
 //====================================================================
 // a=+/- Inf, or b=+/-0: return NaN, call libm_error_support
 // a=NaN or b=NaN: return NaN
-
-#include "libm_support.h"
-
 //
 // Registers used
 //====================================================================
@@ -87,8 +86,6 @@
 // General registers:   r2,r3,r28,r29,r32 (ar.pfs), r33-r39
 // Floating point registers: f6-f15,f32
 //
-.section .text
-
 
 GR_SAVE_B0                    = r33
 GR_SAVE_PFS                   = r34
@@ -105,19 +102,9 @@ FR_Y             = f9
 FR_RESULT        = f8
 
 
+.section .text
+GLOBAL_IEEE754_ENTRY(remainderl)
 
-
-  .proc  remainderl#
-  .align 32
-  .global remainderl#
-  .align 32
-
-remainderl:
-#ifdef _LIBC
-.global __remainderl
-.type __remainderl,@function
-__remainderl:
-#endif
 // inputs in f8, f9
 // result in f8
 
@@ -159,7 +146,7 @@ cmp.eq p11,p10=r29,r0;;
 // X +-NAN, +-inf, ?        p9
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p8 = f8, 0xe3           
+      fclass.m.unc  p9,p8 = f8, 0xe3           
       nop.i 999;; 
 }
 
@@ -196,8 +183,8 @@ cmp.eq p11,p10=r29,r0;;
 }
 
 {.bbb
-  (p9) br.cond.spnt L(FREM_X_NAN_INF)
-  (p11) br.cond.spnt L(FREM_Y_NAN_INF_ZERO)
+  (p9) br.cond.spnt FREM_X_NAN_INF
+  (p11) br.cond.spnt FREM_Y_NAN_INF_ZERO
   nop.b 0
 }  {.mfi
    nop.m 0
@@ -206,7 +193,7 @@ cmp.eq p11,p10=r29,r0;;
    nop.i 0;;
 } 
 
-L(remloop24): 
+remloop24: 
   { .mfi
   nop.m 0
   // Step (2)
@@ -228,7 +215,7 @@ L(remloop24):
 {.mfi
   nop.m 0
   // q1=q0*(1+e0)
-  fma.s1 f15=f12,f7,f12
+  (p6) fma.s1 f15=f12,f7,f12
   nop.i 0
 }
 { .mfi
@@ -358,7 +345,7 @@ L(remloop24):
   //  (p9) set r=r2 (new a, if not last iteration)
   // (p10) new a =r
   (p10) mov f13=f6
-  (p12) br.cond.sptk L(remloop24);;
+  (p12) br.cond.sptk remloop24;;
 } 
 
 // last iteration
@@ -416,7 +403,7 @@ L(remloop24):
 
 
 
-L(FREM_X_NAN_INF): 
+FREM_X_NAN_INF: 
 
 // Y zero ?
 {.mfi 
@@ -433,19 +420,19 @@ L(FREM_X_NAN_INF):
   nop.m 0
   nop.i 0
   // if Y zero
-  (p11) br.cond.spnt L(FREM_Y_ZERO);;                        
+  (p11) br.cond.spnt FREM_Y_ZERO;;                        
 }
 
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p8,p0 = f8, 0x23 
+      fclass.m.unc  p8,p0 = f8, 0x23 
       nop.i 999
 }
 // X infinity? Return QNAN indefinite
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p11,p0 = f8, 0x23 
+      fclass.m.unc  p11,p0 = f8, 0x23 
       nop.i 999;; 
 }
 // Y NaN ?
@@ -473,14 +460,14 @@ L(FREM_X_NAN_INF):
 }
 { .mfi
      nop.m 999
-(p8) fma f8=f8,f1,f0                     
+(p8) fma.s0 f8=f8,f1,f0                     
 	 nop.i 0 ;;                        
 }
 
 { .mfb
       nop.m 999
       frcpa.s0 f8,p7=f8,f9                     
-	  (p11) br.cond.spnt L(EXP_ERROR_RETURN);;                        
+	  (p11) br.cond.spnt EXP_ERROR_RETURN;;                        
 }
 { .mib
 	nop.m 0
@@ -489,24 +476,24 @@ L(FREM_X_NAN_INF):
 }
 
 
-L(FREM_Y_NAN_INF_ZERO): 
+FREM_Y_NAN_INF_ZERO: 
 // Y INF
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p7,p0 = f9, 0x23           
+      fclass.m.unc  p7,p0 = f9, 0x23           
       nop.i 999 ;;
 }
 
 { .mfb
       nop.m 999
-(p7)  fma f8=f8,f1,f0                     
+(p7)  fma.s0 f8=f8,f1,f0                     
 (p7)  br.ret.spnt    b0 ;;                        
 }
 
 // Y NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f9, 0xc3           
+      fclass.m.unc  p9,p10 = f9, 0xc3           
       nop.i 999 ;;
 }
 { .mfi
@@ -517,11 +504,11 @@ L(FREM_Y_NAN_INF_ZERO):
 
 { .mfb
       nop.m 999
-(p9)  fma f8=f9,f1,f0                     
+(p9)  fma.s0 f8=f9,f1,f0                     
 (p9)  br.ret.spnt    b0 ;;                        
 }
 
-L(FREM_Y_ZERO):
+FREM_Y_ZERO:
 // Y zero? Must be zero at this point
 // because it is the only choice left.
 // Return QNAN indefinite
@@ -529,7 +516,7 @@ L(FREM_Y_ZERO):
 // X NAN?
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc  p9,p10 = f8, 0xc3           
+      fclass.m.unc  p9,p10 = f8, 0xc3           
       nop.i 999 ;;
 }
 { .mfi
@@ -540,43 +527,38 @@ L(FREM_Y_ZERO):
 
 {.mfi
  nop.m 999
- (p9) frcpa f11,p7=f8,f0
+ (p9) frcpa.s0 f11,p7=f8,f0
  nop.i 0;;
 }
 { .mfi
       nop.m 999
-(p10)  frcpa   f11,p7 = f0,f0           
+(p10)  frcpa.s0   f11,p7 = f0,f0           
 	  nop.i 999;;
 }
 
 { .mfi
       nop.m 999
-(p0)  fmerge.s      f10 = f8, f8             
+      fmerge.s      f10 = f8, f8             
       nop.i 999
 }
 
 { .mfi
       nop.m 999
-(p0)  fma f8=f11,f1,f0                     
+      fma.s0 f8=f11,f1,f0                     
       nop.i 999;;
 }
 
-L(EXP_ERROR_RETURN): 
+EXP_ERROR_RETURN: 
 
 { .mib
-(p0)  mov   GR_Parameter_TAG = 123                                 
+      mov   GR_Parameter_TAG = 123                                 
 	  nop.i 999
-(p0)  br.sptk __libm_error_region;; 
+      br.sptk __libm_error_region;; 
 }
 
-.endp remainderl
-ASM_SIZE_DIRECTIVE(remainderl)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__remainderl)
-#endif
+GLOBAL_IEEE754_END(remainderl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -624,9 +606,12 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };; 
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
+
+
+
diff --git a/sysdeps/ia64/fpu/e_scalb.S b/sysdeps/ia64/fpu/e_scalb.S
index 7f5b5796de..3d48aab189 100644
--- a/sysdeps/ia64/fpu/e_scalb.S
+++ b/sysdeps/ia64/fpu/e_scalb.S
@@ -1,10 +1,10 @@
 .file "scalb.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,61 +20,83 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 1/26/01  Scalb completely reworked and now standalone version 
+// 02/02/00 Initial version
+// 01/26/01 Scalb completely reworked and now standalone version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/06/03 Improved performance
 //
 // API
 //==============================================================
-// double = scalb  (double x, double n) 
+// double = scalb  (double x, double n)
 // input  floating point f8 and floating point f9
 // output floating point f8
 //
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
 // Returns x* 2**n using an fma and detects overflow
-// and underflow.   
+// and underflow.
 //
 //
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x103fe                 -> Certain overflow
+//   exp_Result = 0x103fe                 -> Possible overflow
+//   0x0fc01 <= exp_Result < 0x103fe      -> No over/underflow (main path)
+//   0x0fc01 - 52 <= exp_Result < 0x0fc01 -> Possible underflow
+//   exp_Result < 0x0fc01 - 52            -> Certain underflow
 
-#include "libm_support.h"
-
+FR_Big         = f6
+FR_NBig        = f7
 FR_Floating_X  = f8
 FR_Result      = f8
 FR_Floating_N  = f9
 FR_Result2     = f9
-FR_Norm_N      = f10
-FR_Result3     = f11
-FR_Norm_X      = f12
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
 FR_N_float_int = f13
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-FR_Big         = f6
-FR_NBig        = f7
+FR_Norm_N      = f14
 
+GR_neg_ov_limit= r14
+GR_big_exp     = r14
 GR_N_Biased    = r15
 GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_exp_sure_ou = r19
 GR_Bias        = r20
 GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+GR_Scratch     = r28
+GR_signexp_N   = r29
+GR_exp_N       = r30
 
 GR_SAVE_B0          = r32
 GR_SAVE_GP          = r33
@@ -84,433 +106,447 @@ GR_Parameter_Y      = r36
 GR_Parameter_RESULT = r37
 GR_Tag              = r38
 
-.align 32
-.global scalb
-
 .section .text
-.proc  scalb
-.align 32
-
-scalb: 
-#ifdef _LIBC
-.global __ieee754_scalb
-.type __ieee754_scalb,@function
-__ieee754_scalb:
-#endif
+GLOBAL_IEEE754_ENTRY(scalb)
 
 //
 //   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
 //
 {    .mfi
-     alloc          r32=ar.pfs,0,3,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl  GR_Scratch  = 0x019C3F,r0 
+     getf.exp      GR_signexp_N = FR_Floating_N // Get signexp of n
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fcvt.fx.trunc.s1   FR_N_float_int = FR_Floating_N // Get N in significand
+     nop.i         0
+}
+;;
+
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p7,p0 = FR_Floating_N, 0x0b  // Test for n=unorm
+     nop.i         0
 }
 //
-//   Is y a NAN, INF, ZERO, +-?
+//   Normalize n
 //
 {    .mfi
-     nop.m 999
-     fclass.m.unc  p6,p0 = FR_Floating_N, 0xe7 //@snan | @qnan | @inf |  @zero
-     addl  GR_Scratch1  = 0x063BF,r0 
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+     fnorm.s1      FR_Norm_N = FR_Floating_N
+     nop.i         0
 }
 ;;
 
 //
-//   Convert N to a fp integer
-//   Normalize x
+//   Is n NAN, INF, ZERO, +-?
 //
 {    .mfi
-     nop.m 0
-     fnorm.s1  FR_Norm_N  =   FR_Floating_N 
-     nop.i 999
+     mov           GR_big_exp = 0x1003e      // Exponent at which n is integer
+     fclass.m      p9,p0 = FR_Floating_N, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_max_exp = 0x103fe      // Exponent of maximum double
 }
-{    .mfi
-     nop.m 999
-     fnorm.s1  FR_Norm_X  =   FR_Floating_X 
-     nop.i 999
-};;
-
 //
-//   Create 2*big
-//   Create 2**-big 
 //   Normalize x
-//   Branch on special values.
 //
-{ .mib
-     setf.exp      FR_Big = GR_Scratch                  
-     nop.i 0 
-(p6) br.cond.spnt  L(SCALB_NAN_INF_ZERO) 
+{ .mfb
+     nop.m         0
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+(p7) br.cond.spnt  SCALB_N_UNORM             // Branch if n=unorm
 }
-{ .mib
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.i 0 
-(p7) br.cond.spnt  L(SCALB_NAN_INF_ZERO) 
-};;
+;;
 
-//
-//   Convert N to a fp integer
-//   Create -35000
-//  
+SCALB_COMMON1:
+// Main path continues.  Also return here from u=unorm path.
+//   Handle special cases if x = Nan, Inf, Zero
+{ .mfb
+     nop.m         0
+     fcmp.lt.s1    p7,p0 = FR_Floating_N, f0  // Test N negative
+(p6) br.cond.spnt  SCALB_NAN_INF_ZERO
+}
+;;
+
+//   Handle special cases if n = Nan, Inf, Zero
 {    .mfi
-     addl  GR_Scratch = 1,r0
-     fcvt.fx.trunc.s1   FR_N_float_int = FR_Norm_N 
-     addl    GR_NBig = -35000,r0
+     getf.sig      GR_N_as_int = FR_N_float_int // Get n from significand
+     fclass.m      p8,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+     mov           GR_exp_sure_ou = 0x1000e // Exp_N where x*2^N sure over/under
+}
+{    .mfb
+     mov           GR_min_exp = 0x0fc01      // Exponent of minimum double
+     fcvt.xf       FR_N_float_int = FR_N_float_int // Convert N to FP integer
+(p9) br.cond.spnt  SCALB_NAN_INF_ZERO
 }
 ;;
 
-//
-//   Put N if a GP register
-//   Convert  N_float_int to floating point value
-//   Create 35000
-//   Build the exponent Bias
-//
-{    .mii
-     getf.sig     GR_N_as_int = FR_N_float_int
-     shl   GR_Scratch = GR_Scratch,63
-     addl  GR_Big = 35000,r0
+{    .mmi
+     and           GR_exp_N = GR_exp_mask, GR_signexp_N // Get exponent of N
+(p7) sub           GR_Big = r0, GR_Big          // Limit for N
+     nop.i         0
 }
-{    .mfi
-     addl GR_Bias = 0x0FFFF,r0
-     fcvt.xf  FR_N_float_int = FR_N_float_int
-     nop.i 0
-};;
+;;
 
-//
-//   Catch those fp values that are beyond 2**64-1
-//   Is N > 35000     
-//   Is N < -35000     
-//
-{     .mfi
-     cmp.ne.unc  p9,p10 = GR_N_as_int,GR_Scratch
-     nop.f 0
-     nop.i 0
+{    .mib
+     cmp.lt        p9,p0 = GR_exp_N, GR_big_exp // N possible non-integer?
+     cmp.ge        p6,p0 = GR_exp_N, GR_exp_sure_ou // N certain over/under?
+(p8) br.cond.spnt  SCALB_X_UNORM             // Branch if x=unorm
 }
-{     .mmi
-     cmp.ge.unc p6, p0 = GR_N_as_int, GR_Big
-     cmp.le.unc p8, p0 = GR_N_as_int, GR_NBig
-     nop.i 0
-};;
+;;
 
-//
-//   Is N really an int, only for those non-int indefinites?
-//   Create exp bias.     
-//
-{    .mfi
-     add GR_N_Biased = GR_Bias,GR_N_as_int
-(p9) fcmp.neq.unc.s1 p7,p0  =   FR_Norm_N, FR_N_float_int
-     nop.i 0
-};;
+SCALB_COMMON2:
+// Main path continues.  Also return here from x=unorm path.
+//   Create biased exponent for 2**N
+{    .mmi
+(p6) mov           GR_N_as_int = GR_Big      // Limit N
+;;
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.i         0
+}
+;;
 
-//
-//   Branch and return if N is not an int.
-//   Main path, create 2**N
-//
 {    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.i                      999
+     setf.exp      FR_Two_N = GR_N_Biased               // Form 2**N
+(p9) fcmp.neq.unc.s1 p9,p0 = FR_Norm_N, FR_N_float_int  // Test if N an integer
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X // Get exponent of X
 }
-{    .mfb
-     nop.m 0
-(p7) frcpa          f8,p11     =    f0,f0
-(p7) br.ret.spnt    b0          
-};;
+;;
 
 //
-//   Set denormal on denormal input x and denormal input N
+//   Compute biased result exponent
+//   Branch if N is not an integer
 //
-{    .mfi
-     nop.m                      999
-(p10)fcmp.ge.s1    p6,p8 = FR_Norm_N,f0
-     nop.i 0
-};;
-{    .mfi
-     nop.m                      999
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     nop.i                      999
+{    .mib
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     mov           GR_min_den_exp = 0x0fc01 - 52 // Exponent of min denorm dble
+(p9) br.cond.spnt  SCALB_N_NOT_INT
 }
-{    .mfi
-     nop.m                      999
-     fcmp.ge.s0    p12,p13 = FR_Floating_N,f0
-     nop.i 0
-};;
+;;
 
 //
-//   Adjust 2**N if N was very small or very large
+//   Raise Denormal operand flag with compare
+//   Do final operation
 //
-
 {    .mfi
-     nop.m 0
-(p6) fma.s1  FR_Two_N = FR_Big,f1,f0
-     nop.i 0
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,FR_Floating_N  // Dummy to set denorm
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
 }
-{ .mlx
-     nop.m 999
-(p0) movl GR_Scratch = 0x00000000000303FF 
-};;
-{    .mfi
-     nop.m 0
-(p8) fma.s1  FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
+{    .mfb
+     nop.m         0
+     fma.d.s0      FR_Result = FR_Two_N,FR_Norm_X,f0
+(p9) br.cond.spnt  SCALB_UNDERFLOW           // Branch if certain underflow
 }
-{    .mlx
-     nop.m 999
-(p0) movl GR_Scratch1= 0x00000000000103FF 
-};;
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  SCALB_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  SCALB_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  SCALB_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
 
-//   Set up necessary status fields 
+// Here if possible underflow.
+// Resulting exponent: 0x0fc01-52 <= exp_Result < 0x0fc01
+SCALB_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x103fe = exp_Result
+SCALB_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
 //
 //   S0 user supplied status
 //   S2 user supplied status + WRE + TD  (Overflows)
 //   S3 user supplied status + FZ + TD   (Underflows)
 //
 {    .mfi
-     nop.m 999
-(p0) fsetc.s3 0x7F,0x41
-     nop.i 999
+     mov           GR_pos_ov_limit = 0x103ff // Exponent for positive overflow
+     fsetc.s3      0x7F,0x41
+     nop.i         0
 }
 {    .mfi
-     nop.m 999
-(p0) fsetc.s2 0x7F,0x42
-     nop.i 999
-};;
+     mov           GR_neg_ov_limit = 0x303ff // Exponent for negative overflow
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
 
 //
-//   Do final operation
+//   Do final operation with s2 and s3
 //
 {    .mfi
-     setf.exp FR_NBig = GR_Scratch
-     fma.d.s0     FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.d.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
 }
 {    .mfi
-     nop.m                           999
-     fma.d.s3     FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
-{    .mfi
-     setf.exp FR_Big = GR_Scratch1
-     fma.d.s2     FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.d.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
 
 //   Check for overflow or underflow.
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflow)
-//   S3 user supplied status + FZ + TD   (Underflow)
-//
-//
 //   Restore s3
 //   Restore s2
 //
 {    .mfi
-     nop.m 0
-     fsetc.s3 0x7F,0x40
-     nop.i 999 
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
 }
 {    .mfi
-     nop.m 0
-     fsetc.s2 0x7F,0x40
-     nop.i 999
-};;
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
 
 //
 //   Is the result zero?
 //
 {    .mfi
-     nop.m 999
-     fclass.m.unc   p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
 {    .mfi
-     addl GR_Tag = 53, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
 
 //
 //   Detect masked underflow - Tiny + Inexact Only
 //
 {    .mfi
-     nop.m 999
+     nop.m         0
 (p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
+     nop.i         0
+}
+;;
 
 //
 //   Is result bigger the allowed range?
 //   Branch out for underflow
 //
 {    .mfb
-(p6) addl GR_Tag = 54, r0
+     nop.m          0
 (p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt L(SCALB_UNDERFLOW) 
-};;
+(p6) br.cond.spnt   SCALB_UNDERFLOW
+}
+;;
 
 //
 //   Branch out for overflow
 //
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt L(SCALB_OVERFLOW) 
-(p9) br.cond.spnt L(SCALB_OVERFLOW) 
-};;
+{ .bbb
+(p7) br.cond.spnt   SCALB_OVERFLOW
+(p9) br.cond.spnt   SCALB_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
 
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
+// Here if result overflows
+SCALB_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 53, r0     // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
 }
+;;
 
-L(SCALB_NAN_INF_ZERO): 
+// Here if result underflows
+SCALB_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 54, r0     // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
 
+SCALB_NAN_INF_ZERO:
+
+//
+//   Before entry, N has been converted to a fp integer in significand of 
+//     FR_N_float_int
+//
+//   Convert  N_float_int to floating point value
 //
-//   Convert N to a fp integer
-//  
 {    .mfi
-     addl  GR_Scratch = 1,r0
-     fcvt.fx.trunc.s1  FR_N_float_int = FR_Norm_N 
-     nop.i 999
+     getf.sig     GR_N_as_int = FR_N_float_int
+     fclass.m     p6,p0 = FR_Floating_N, 0xc3 //@snan | @qnan
+     nop.i        0
 }
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p6,p0 = FR_Floating_N, 0xc3 //@snan | @qnan 
-     nop.i 0
-};;
+     addl         GR_Scratch = 1,r0
+     fcvt.xf      FR_N_float_int = FR_N_float_int
+     nop.i        0
+}
+;;
+
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xc3 //@snan | @qnan 
-     shl   GR_Scratch = GR_Scratch,63
-};;
+     nop.m        0
+     fclass.m     p7,p0 = FR_Floating_X, 0xc3 //@snan | @qnan
+     shl          GR_Scratch = GR_Scratch,63
+}
+;;
+
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p8,p0 = FR_Floating_N, 0x21 // @inf
-     nop.i 0
-}
-  {  .mfi
-     nop.m 0
-     fclass.m.unc  p9,p0 = FR_Floating_N, 0x22 // @-inf
-     nop.i 0
-};;
+     nop.m        0
+     fclass.m     p8,p0 = FR_Floating_N, 0x21 // @inf
+     nop.i        0
+}
+{    .mfi
+     nop.m        0
+     fclass.m     p9,p0 = FR_Floating_N, 0x22 // @-inf
+     nop.i        0
+}
+;;
 
 //
 //   Either X or N is a Nan, return result and possible raise invalid.
 //
 {    .mfb
-     nop.m 0
-(p6) fma.d.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0 
+     nop.m        0
+(p6) fma.d.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0
 (p6) br.ret.spnt  b0
-};;
+}
+;;
+
 {    .mfb
-     getf.sig     GR_N_as_int = FR_N_float_int
-(p7) fma.d.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0 
+     nop.m        0
+(p7) fma.d.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0
 (p7) br.ret.spnt  b0
-};;
+}
+;;
 
 //
 //   If N + Inf do something special
 //   For N = -Inf, create Int
 //
 {    .mfb
-     nop.m 0
-(p8) fma.d.s0    FR_Result = FR_Floating_X, FR_Floating_N,f0 
-(p8) br.ret.spnt   b0
+     nop.m        0
+(p8) fma.d.s0     FR_Result = FR_Floating_X, FR_Floating_N,f0
+(p8) br.ret.spnt  b0
 }
 {    .mfi
-     nop.m 0
-(p9) fnma.d.s0   FR_Floating_N = FR_Floating_N, f1, f0 
-     nop.i 0
-};;
+     nop.m        0
+(p9) fnma.d.s0    FR_Floating_N = FR_Floating_N, f1, f0
+     nop.i        0
+}
+;;
 
 //
 //   If N==-Inf,return x/(-N)
 //
 {    .mfb
-     nop.m 0
-(p9) frcpa.s0        FR_Result,p6 =  FR_Floating_X,FR_Floating_N
-(p9) br.ret.spnt    b0          
-};;
-
-//
-//   Convert  N_float_int to floating point value
-//
-{     .mfi
-     cmp.ne.unc  p9,p0     =   GR_N_as_int,GR_Scratch
-     fcvt.xf  FR_N_float_int = FR_N_float_int
-     nop.i  0
-};;
+     cmp.ne       p7,p0 = GR_N_as_int,GR_Scratch
+(p9) frcpa.s0     FR_Result,p0 = FR_Floating_X,FR_Floating_N
+(p9) br.ret.spnt  b0
+}
+;;
 
 //
 //   Is N an integer.
 //
 {    .mfi
-     nop.m 0
-(p9) fcmp.neq.unc.s1 p7,p0  =   FR_Norm_N, FR_N_float_int
-     nop.i 0
-};;
+     nop.m        0
+(p7) fcmp.neq.unc.s1 p7,p0 = FR_Norm_N, FR_N_float_int
+     nop.i        0
+}
+;;
 
 //
 //   If N not an int, return NaN and raise invalid.
 //
 {    .mfb
-     nop.m 0
-(p7) frcpa.s0        FR_Result,p6     =    f0,f0
-(p7) br.ret.spnt    b0          
-};;
+     nop.m        0
+(p7) frcpa.s0     FR_Result,p0 = f0,f0
+(p7) br.ret.spnt  b0
+}
+;;
 
 //
-//   Always return x in other path. 
+//   Always return x in other path.
 //
 {    .mfb
-     nop.m 0
-     fma.d.s0      FR_Result = FR_Floating_X,f1,f0 
-     br.ret.sptk   b0
-};;
+     nop.m        0
+     fma.d.s0     FR_Result = FR_Floating_X,f1,f0
+     br.ret.sptk  b0
+}
+;;
 
-.endp scalb
-ASM_SIZE_DIRECTIVE(scalb)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__ieee754_scalb)
-#endif
-.proc __libm_error_region
-__libm_error_region:
+// Here if n not int
+// Return NaN and raise invalid.
+SCALB_N_NOT_INT:
+{    .mfb
+     nop.m        0
+     frcpa.s0     FR_Result,p0 = f0,f0
+     br.ret.sptk  b0
+}
+;;
+
+// Here if n=unorm
+SCALB_N_UNORM:
+{ .mfb
+     getf.exp      GR_signexp_N = FR_Norm_N // Get signexp of normalized n
+     fcvt.fx.trunc.s1   FR_N_float_int = FR_Norm_N // Get N in significand
+     br.cond.sptk  SCALB_COMMON1            // Return to main path
+}
+;;
 
-L(SCALB_OVERFLOW): 
-L(SCALB_UNDERFLOW): 
+// Here if x=unorm
+SCALB_X_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  SCALB_COMMON2            // Return to main path
+}
+;;
+
+GLOBAL_IEEE754_END(scalb)
+LOCAL_LIBM_ENTRY(__libm_error_region)
 
 //
 // Get stack address of N
 //
 .prologue
 { .mfi
-    add   GR_Parameter_Y=-32,sp         
+    add   GR_Parameter_Y=-32,sp
     nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
+    mov  GR_SAVE_PFS=ar.pfs
 }
 //
-// Adjust sp 
+// Adjust sp
 //
 { .mfi
 .fframe 64
-   add sp=-64,sp                         
+   add sp=-64,sp
    nop.f 0
-   mov GR_SAVE_GP=gp       
+   mov GR_SAVE_GP=gp
 };;
 
 //
-//  Store N on stack in correct position 
+//  Store N on stack in correct position
 //  Locate the address of x on stack
 //
 { .mmi
-   stfd [GR_Parameter_Y] = FR_Norm_N,16       
-   add GR_Parameter_X = 16,sp          
+   stfd [GR_Parameter_Y] = FR_Norm_N,16
+   add GR_Parameter_X = 16,sp
 .save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
+   mov GR_SAVE_B0=b0
 };;
 
 //
@@ -519,46 +555,45 @@ L(SCALB_UNDERFLOW):
 //
 .body
 { .mib
-   stfd [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
+   stfd [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
    nop.b 0
 }
 { .mib
-   stfd [GR_Parameter_Y] = FR_Result                 
+   stfd [GR_Parameter_Y] = FR_Result
    add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
+   br.call.sptk b0=__libm_error_support#
 };;
 
 //
 //  Get location of result on stack
 //
 { .mmi
+   add   GR_Parameter_RESULT = 48,sp
    nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
+   nop.i 0
 };;
 
 //
-//  Get the new result 
+//  Get the new result
 //
 { .mmi
-   ldfd  FR_Result = [GR_Parameter_RESULT]      
+   ldfd  FR_Result = [GR_Parameter_RESULT]
 .restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
 };;
 
 //
 //  Restore gp, ar.pfs and return
 //
 { .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_scalbf.S b/sysdeps/ia64/fpu/e_scalbf.S
index 40af080d38..e965667d7a 100644
--- a/sysdeps/ia64/fpu/e_scalbf.S
+++ b/sysdeps/ia64/fpu/e_scalbf.S
@@ -1,10 +1,10 @@
 .file "scalbf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,61 +20,83 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 1/26/01  Scalb completely reworked and now standalone version 
+// 02/02/00 Initial version
+// 01/26/01 Scalb completely reworked and now standalone version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/06/03 Improved performance
 //
 // API
 //==============================================================
-// float = scalbf  (float x, float n) 
+// float = scalbf  (float x, float n)
 // input  floating point f8 and floating point f9
 // output floating point f8
 //
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
 // Returns x* 2**n using an fma and detects overflow
-// and underflow.   
+// and underflow.
 //
 //
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x1007e                 -> Certain overflow
+//   exp_Result = 0x1007e                 -> Possible overflow
+//   0x0ff81 <= exp_Result < 0x1007e      -> No over/underflow (main path)
+//   0x0ff81 - 23 <= exp_Result < 0x0ff81 -> Possible underflow
+//   exp_Result < 0x0ff81 - 23            -> Certain underflow
 
-#include "libm_support.h"
-
+FR_Big         = f6
+FR_NBig        = f7
 FR_Floating_X  = f8
 FR_Result      = f8
 FR_Floating_N  = f9
 FR_Result2     = f9
-FR_Norm_N      = f10
-FR_Result3     = f11
-FR_Norm_X      = f12
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
 FR_N_float_int = f13
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-FR_Big         = f6
-FR_NBig        = f7
+FR_Norm_N      = f14
 
+GR_neg_ov_limit= r14
+GR_big_exp     = r14
 GR_N_Biased    = r15
 GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_exp_sure_ou = r19
 GR_Bias        = r20
 GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+GR_Scratch     = r28
+GR_signexp_N   = r29
+GR_exp_N       = r30
 
 GR_SAVE_B0          = r32
 GR_SAVE_GP          = r33
@@ -84,433 +106,447 @@ GR_Parameter_Y      = r36
 GR_Parameter_RESULT = r37
 GR_Tag              = r38
 
-.align 32
-.global scalbf
-
 .section .text
-.proc  scalbf
-.align 32
-
-scalbf: 
-#ifdef _LIBC
-.global __ieee754_scalbf
-.type __ieee754_scalbf,@function
-__ieee754_scalbf:
-#endif
+GLOBAL_IEEE754_ENTRY(scalbf)
 
 //
 //   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
 //
 {    .mfi
-     alloc          r32=ar.pfs,0,3,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl  GR_Scratch  = 0x019C3F,r0 
+     getf.exp      GR_signexp_N = FR_Floating_N // Get signexp of n
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fcvt.fx.trunc.s1   FR_N_float_int = FR_Floating_N // Get N in significand
+     nop.i         0
+}
+;;
+
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p7,p0 = FR_Floating_N, 0x0b  // Test for n=unorm
+     nop.i         0
 }
 //
-//   Is y a NAN, INF, ZERO, +-?
+//   Normalize n
 //
 {    .mfi
-     nop.m 999
-     fclass.m.unc  p6,p0 = FR_Floating_N, 0xe7 //@snan | @qnan | @inf |  @zero
-     addl  GR_Scratch1  = 0x063BF,r0 
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+     fnorm.s1      FR_Norm_N = FR_Floating_N
+     nop.i         0
 }
 ;;
 
 //
-//   Convert N to a fp integer
-//   Normalize x
+//   Is n NAN, INF, ZERO, +-?
 //
 {    .mfi
-     nop.m 0
-     fnorm.s1  FR_Norm_N  =   FR_Floating_N 
-     nop.i 999
+     mov           GR_big_exp = 0x1003e      // Exponent at which n is integer
+     fclass.m      p9,p0 = FR_Floating_N, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_max_exp = 0x1007e      // Exponent of maximum float
 }
-{    .mfi
-     nop.m 999
-     fnorm.s1  FR_Norm_X  =   FR_Floating_X 
-     nop.i 999
-};;
-
 //
-//   Create 2*big
-//   Create 2**-big 
 //   Normalize x
-//   Branch on special values.
 //
-{ .mib
-     setf.exp      FR_Big = GR_Scratch                  
-     nop.i 0 
-(p6) br.cond.spnt  L(SCALBF_NAN_INF_ZERO) 
+{ .mfb
+     nop.m         0
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+(p7) br.cond.spnt  SCALBF_N_UNORM             // Branch if n=unorm
 }
-{ .mib
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.i 0 
-(p7) br.cond.spnt  L(SCALBF_NAN_INF_ZERO) 
-};;
+;;
 
-//
-//   Convert N to a fp integer
-//   Create -35000
-//  
+SCALBF_COMMON1:
+// Main path continues.  Also return here from u=unorm path.
+//   Handle special cases if x = Nan, Inf, Zero
+{ .mfb
+     nop.m         0
+     fcmp.lt.s1    p7,p0 = FR_Floating_N, f0  // Test N negative
+(p6) br.cond.spnt  SCALBF_NAN_INF_ZERO
+}
+;;
+
+//   Handle special cases if n = Nan, Inf, Zero
 {    .mfi
-     addl  GR_Scratch = 1,r0
-     fcvt.fx.trunc.s1   FR_N_float_int = FR_Norm_N 
-     addl    GR_NBig = -35000,r0
+     getf.sig      GR_N_as_int = FR_N_float_int // Get n from significand
+     fclass.m      p8,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+     mov           GR_exp_sure_ou = 0x1000e // Exp_N where x*2^N sure over/under
+}
+{    .mfb
+     mov           GR_min_exp = 0x0ff81      // Exponent of minimum float
+     fcvt.xf       FR_N_float_int = FR_N_float_int // Convert N to FP integer
+(p9) br.cond.spnt  SCALBF_NAN_INF_ZERO
 }
 ;;
 
-//
-//   Put N if a GP register
-//   Convert  N_float_int to floating point value
-//   Create 35000
-//   Build the exponent Bias
-//
-{    .mii
-     getf.sig     GR_N_as_int = FR_N_float_int
-     shl   GR_Scratch = GR_Scratch,63
-     addl  GR_Big = 35000,r0
+{    .mmi
+     and           GR_exp_N = GR_exp_mask, GR_signexp_N // Get exponent of N
+(p7) sub           GR_Big = r0, GR_Big          // Limit for N
+     nop.i         0
 }
-{    .mfi
-     addl GR_Bias = 0x0FFFF,r0
-     fcvt.xf  FR_N_float_int = FR_N_float_int
-     nop.i 0
-};;
+;;
 
-//
-//   Catch those fp values that are beyond 2**64-1
-//   Is N > 35000     
-//   Is N < -35000     
-//
-{     .mfi
-     cmp.ne.unc  p9,p10 = GR_N_as_int,GR_Scratch
-     nop.f 0
-     nop.i 0
+{    .mib
+     cmp.lt        p9,p0 = GR_exp_N, GR_big_exp // N possible non-integer?
+     cmp.ge        p6,p0 = GR_exp_N, GR_exp_sure_ou // N certain over/under?
+(p8) br.cond.spnt  SCALBF_X_UNORM             // Branch if x=unorm
 }
-{     .mmi
-     cmp.ge.unc p6, p0 = GR_N_as_int, GR_Big
-     cmp.le.unc p8, p0 = GR_N_as_int, GR_NBig
-     nop.i 0
-};;
+;;
 
-//
-//   Is N really an int, only for those non-int indefinites?
-//   Create exp bias.     
-//
-{    .mfi
-     add GR_N_Biased = GR_Bias,GR_N_as_int
-(p9) fcmp.neq.unc.s1 p7,p0  =   FR_Norm_N, FR_N_float_int
-     nop.i 0
-};;
+SCALBF_COMMON2:
+// Main path continues.  Also return here from x=unorm path.
+//   Create biased exponent for 2**N
+{    .mmi
+(p6) mov           GR_N_as_int = GR_Big      // Limit N
+;;
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.i         0
+}
+;;
 
-//
-//   Branch and return if N is not an int.
-//   Main path, create 2**N
-//
 {    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.i                      999
+     setf.exp      FR_Two_N = GR_N_Biased               // Form 2**N
+(p9) fcmp.neq.unc.s1 p9,p0 = FR_Norm_N, FR_N_float_int  // Test if N an integer
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X // Get exponent of X
 }
-{    .mfb
-     nop.m 0
-(p7) frcpa          f8,p11     =    f0,f0
-(p7) br.ret.spnt    b0          
-};;
+;;
 
 //
-//   Set denormal on denormal input x and denormal input N
+//   Compute biased result exponent
+//   Branch if N is not an integer
 //
-{    .mfi
-     nop.m                      999
-(p10)fcmp.ge.s1    p6,p8 = FR_Norm_N,f0
-     nop.i 0
-};;
-{    .mfi
-     nop.m                      999
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     nop.i                      999
+{    .mib
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     mov           GR_min_den_exp = 0x0ff81 - 23 // Exponent of min denorm float
+(p9) br.cond.spnt  SCALBF_N_NOT_INT
 }
-{    .mfi
-     nop.m                      999
-     fcmp.ge.s0    p12,p13 = FR_Floating_N,f0
-     nop.i 0
-};;
+;;
 
 //
-//   Adjust 2**N if N was very small or very large
+//   Raise Denormal operand flag with compare
+//   Do final operation
 //
-
 {    .mfi
-     nop.m 0
-(p6) fma.s1  FR_Two_N = FR_Big,f1,f0
-     nop.i 0
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,FR_Floating_N  // Dummy to set denorm
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
 }
-{ .mlx
-     nop.m 999
-(p0) movl GR_Scratch = 0x000000000003007F 
-};;
-{    .mfi
-     nop.m 0
-(p8) fma.s1  FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
+{    .mfb
+     nop.m         0
+     fma.s.s0      FR_Result = FR_Two_N,FR_Norm_X,f0
+(p9) br.cond.spnt  SCALBF_UNDERFLOW           // Branch if certain underflow
 }
-{    .mlx
-     nop.m 999
-(p0) movl GR_Scratch1= 0x000000000001007F 
-};;
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  SCALBF_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  SCALBF_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  SCALBF_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
 
-//   Set up necessary status fields 
+// Here if possible underflow.
+// Resulting exponent: 0x0ff81-23 <= exp_Result < 0x0ff81
+SCALBF_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x1007e = exp_Result
+SCALBF_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
 //
 //   S0 user supplied status
 //   S2 user supplied status + WRE + TD  (Overflows)
 //   S3 user supplied status + FZ + TD   (Underflows)
 //
 {    .mfi
-     nop.m 999
-(p0) fsetc.s3 0x7F,0x41
-     nop.i 999
+     mov           GR_pos_ov_limit = 0x1007f // Exponent for positive overflow
+     fsetc.s3      0x7F,0x41
+     nop.i         0
 }
 {    .mfi
-     nop.m 999
-(p0) fsetc.s2 0x7F,0x42
-     nop.i 999
-};;
+     mov           GR_neg_ov_limit = 0x3007f // Exponent for negative overflow
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
 
 //
-//   Do final operation
+//   Do final operation with s2 and s3
 //
 {    .mfi
-     setf.exp FR_NBig = GR_Scratch
-     fma.s.s0     FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.s.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
 }
 {    .mfi
-     nop.m                           999
-     fma.s.s3     FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
-{    .mfi
-     setf.exp FR_Big = GR_Scratch1
-     fma.s.s2     FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.s.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
 
 //   Check for overflow or underflow.
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflow)
-//   S3 user supplied status + FZ + TD   (Underflow)
-//
-//
 //   Restore s3
 //   Restore s2
 //
 {    .mfi
-     nop.m 0
-     fsetc.s3 0x7F,0x40
-     nop.i 999 
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
 }
 {    .mfi
-     nop.m 0
-     fsetc.s2 0x7F,0x40
-     nop.i 999
-};;
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
 
 //
 //   Is the result zero?
 //
 {    .mfi
-     nop.m 999
-     fclass.m.unc   p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
 {    .mfi
-     addl GR_Tag = 55, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
 
 //
 //   Detect masked underflow - Tiny + Inexact Only
 //
 {    .mfi
-     nop.m 999
+     nop.m         0
 (p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
+     nop.i         0
+}
+;;
 
 //
 //   Is result bigger the allowed range?
 //   Branch out for underflow
 //
 {    .mfb
-(p6) addl GR_Tag = 56, r0
+     nop.m          0
 (p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt L(SCALBF_UNDERFLOW) 
-};;
+(p6) br.cond.spnt   SCALBF_UNDERFLOW
+}
+;;
 
 //
 //   Branch out for overflow
 //
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt L(SCALBF_OVERFLOW) 
-(p9) br.cond.spnt L(SCALBF_OVERFLOW) 
-};;
+{ .bbb
+(p7) br.cond.spnt   SCALBF_OVERFLOW
+(p9) br.cond.spnt   SCALBF_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
 
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
+// Here if result overflows
+SCALBF_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 55, r0     // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
 }
+;;
 
-L(SCALBF_NAN_INF_ZERO): 
+// Here if result underflows
+SCALBF_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 56, r0     // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
 
+SCALBF_NAN_INF_ZERO:
+
+//
+//   Before entry, N has been converted to a fp integer in significand of 
+//     FR_N_float_int
+//
+//   Convert  N_float_int to floating point value
 //
-//   Convert N to a fp integer
-//  
 {    .mfi
-     addl  GR_Scratch = 1,r0
-     fcvt.fx.trunc.s1  FR_N_float_int = FR_Norm_N 
-     nop.i 999
+     getf.sig     GR_N_as_int = FR_N_float_int
+     fclass.m     p6,p0 = FR_Floating_N, 0xc3 //@snan | @qnan
+     nop.i        0
 }
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p6,p0 = FR_Floating_N, 0xc3 //@snan | @qnan 
-     nop.i 0
-};;
+     addl         GR_Scratch = 1,r0
+     fcvt.xf      FR_N_float_int = FR_N_float_int
+     nop.i        0
+}
+;;
+
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xc3 //@snan | @qnan 
-     shl   GR_Scratch = GR_Scratch,63
-};;
+     nop.m        0
+     fclass.m     p7,p0 = FR_Floating_X, 0xc3 //@snan | @qnan
+     shl          GR_Scratch = GR_Scratch,63
+}
+;;
+
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p8,p0 = FR_Floating_N, 0x21 // @inf
-     nop.i 0
-}
-  {  .mfi
-     nop.m 0
-     fclass.m.unc  p9,p0 = FR_Floating_N, 0x22 // @-inf
-     nop.i 0
-};;
+     nop.m        0
+     fclass.m     p8,p0 = FR_Floating_N, 0x21 // @inf
+     nop.i        0
+}
+{    .mfi
+     nop.m        0
+     fclass.m     p9,p0 = FR_Floating_N, 0x22 // @-inf
+     nop.i        0
+}
+;;
 
 //
 //   Either X or N is a Nan, return result and possible raise invalid.
 //
 {    .mfb
-     nop.m 0
-(p6) fma.s.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0 
+     nop.m        0
+(p6) fma.s.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0
 (p6) br.ret.spnt  b0
-};;
+}
+;;
+
 {    .mfb
-     getf.sig     GR_N_as_int = FR_N_float_int
-(p7) fma.s.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0 
+     nop.m        0
+(p7) fma.s.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0
 (p7) br.ret.spnt  b0
-};;
+}
+;;
 
 //
 //   If N + Inf do something special
 //   For N = -Inf, create Int
 //
 {    .mfb
-     nop.m 0
-(p8) fma.s.s0    FR_Result = FR_Floating_X, FR_Floating_N,f0 
-(p8) br.ret.spnt   b0
+     nop.m        0
+(p8) fma.s.s0     FR_Result = FR_Floating_X, FR_Floating_N,f0
+(p8) br.ret.spnt  b0
 }
 {    .mfi
-     nop.m 0
-(p9) fnma.s.s0   FR_Floating_N = FR_Floating_N, f1, f0 
-     nop.i 0
-};;
+     nop.m        0
+(p9) fnma.s.s0    FR_Floating_N = FR_Floating_N, f1, f0
+     nop.i        0
+}
+;;
 
 //
 //   If N==-Inf,return x/(-N)
 //
 {    .mfb
-     nop.m 0
-(p9) frcpa.s0        FR_Result,p6 =  FR_Floating_X,FR_Floating_N
-(p9) br.ret.spnt    b0          
-};;
-
-//
-//   Convert  N_float_int to floating point value
-//
-{     .mfi
-     cmp.ne.unc  p9,p0     =   GR_N_as_int,GR_Scratch
-     fcvt.xf  FR_N_float_int = FR_N_float_int
-     nop.i  0
-};;
+     cmp.ne       p7,p0 = GR_N_as_int,GR_Scratch
+(p9) frcpa.s0     FR_Result,p0 = FR_Floating_X,FR_Floating_N
+(p9) br.ret.spnt  b0
+}
+;;
 
 //
 //   Is N an integer.
 //
 {    .mfi
-     nop.m 0
-(p9) fcmp.neq.unc.s1 p7,p0  =   FR_Norm_N, FR_N_float_int
-     nop.i 0
-};;
+     nop.m        0
+(p7) fcmp.neq.unc.s1 p7,p0 = FR_Norm_N, FR_N_float_int
+     nop.i        0
+}
+;;
 
 //
 //   If N not an int, return NaN and raise invalid.
 //
 {    .mfb
-     nop.m 0
-(p7) frcpa.s0        FR_Result,p6     =    f0,f0
-(p7) br.ret.spnt    b0          
-};;
+     nop.m        0
+(p7) frcpa.s0     FR_Result,p0 = f0,f0
+(p7) br.ret.spnt  b0
+}
+;;
 
 //
-//   Always return x in other path. 
+//   Always return x in other path.
 //
 {    .mfb
-     nop.m 0
-     fma.s.s0      FR_Result = FR_Floating_X,f1,f0 
-     br.ret.sptk   b0
-};;
+     nop.m        0
+     fma.s.s0     FR_Result = FR_Floating_X,f1,f0
+     br.ret.sptk  b0
+}
+;;
 
-.endp scalbf
-ASM_SIZE_DIRECTIVE(scalbf)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__ieee754_scalbf)
-#endif
-.proc __libm_error_region
-__libm_error_region:
+// Here if n not int
+// Return NaN and raise invalid.
+SCALBF_N_NOT_INT:
+{    .mfb
+     nop.m        0
+     frcpa.s0     FR_Result,p0 = f0,f0
+     br.ret.sptk  b0
+}
+;;
+
+// Here if n=unorm
+SCALBF_N_UNORM:
+{ .mfb
+     getf.exp      GR_signexp_N = FR_Norm_N // Get signexp of normalized n
+     fcvt.fx.trunc.s1   FR_N_float_int = FR_Norm_N // Get N in significand
+     br.cond.sptk  SCALBF_COMMON1            // Return to main path
+}
+;;
 
-L(SCALBF_OVERFLOW): 
-L(SCALBF_UNDERFLOW): 
+// Here if x=unorm
+SCALBF_X_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  SCALBF_COMMON2            // Return to main path
+}
+;;
+
+GLOBAL_IEEE754_END(scalbf)
+LOCAL_LIBM_ENTRY(__libm_error_region)
 
 //
 // Get stack address of N
 //
 .prologue
 { .mfi
-    add   GR_Parameter_Y=-32,sp         
+    add   GR_Parameter_Y=-32,sp
     nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
+    mov  GR_SAVE_PFS=ar.pfs
 }
 //
-// Adjust sp 
+// Adjust sp
 //
 { .mfi
 .fframe 64
-   add sp=-64,sp                         
+   add sp=-64,sp
    nop.f 0
-   mov GR_SAVE_GP=gp       
+   mov GR_SAVE_GP=gp
 };;
 
 //
-//  Store N on stack in correct position 
+//  Store N on stack in correct position
 //  Locate the address of x on stack
 //
 { .mmi
-   stfs [GR_Parameter_Y] = FR_Norm_N,16       
-   add GR_Parameter_X = 16,sp          
+   stfs [GR_Parameter_Y] = FR_Norm_N,16
+   add GR_Parameter_X = 16,sp
 .save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
+   mov GR_SAVE_B0=b0
 };;
 
 //
@@ -519,46 +555,45 @@ L(SCALBF_UNDERFLOW):
 //
 .body
 { .mib
-   stfs [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
+   stfs [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
    nop.b 0
 }
 { .mib
-   stfs [GR_Parameter_Y] = FR_Result                 
+   stfs [GR_Parameter_Y] = FR_Result
    add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
+   br.call.sptk b0=__libm_error_support#
 };;
 
 //
 //  Get location of result on stack
 //
 { .mmi
+   add   GR_Parameter_RESULT = 48,sp
    nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
+   nop.i 0
 };;
 
 //
-//  Get the new result 
+//  Get the new result
 //
 { .mmi
-   ldfs  FR_Result = [GR_Parameter_RESULT]      
+   ldfs  FR_Result = [GR_Parameter_RESULT]
 .restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
 };;
 
 //
 //  Restore gp, ar.pfs and return
 //
 { .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_scalbl.S b/sysdeps/ia64/fpu/e_scalbl.S
index 43eac7a2ad..9b6467ff20 100644
--- a/sysdeps/ia64/fpu/e_scalbl.S
+++ b/sysdeps/ia64/fpu/e_scalbl.S
@@ -1,10 +1,10 @@
 .file "scalbl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,61 +20,83 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 1/26/01  Scalb completely reworked and now standalone version 
+// 02/02/00 Initial version
+// 01/26/01 Scalb completely reworked and now standalone version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/06/03 Improved performance
 //
 // API
 //==============================================================
-// double-extended = scalbl  (double-extended x, double-extended n) 
+// long double = scalbl  (long double x, long double n)
 // input  floating point f8 and floating point f9
 // output floating point f8
 //
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
 // Returns x* 2**n using an fma and detects overflow
-// and underflow.   
+// and underflow.
 //
 //
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x13ffe                 -> Certain overflow
+//   exp_Result = 0x13ffe                 -> Possible overflow
+//   0x0c001 <= exp_Result < 0x13ffe      -> No over/underflow (main path)
+//   0x0c001 - 63 <= exp_Result < 0x0c001 -> Possible underflow
+//   exp_Result < 0x0c001 - 63            -> Certain underflow
 
-#include "libm_support.h"
-
+FR_Big         = f6
+FR_NBig        = f7
 FR_Floating_X  = f8
 FR_Result      = f8
 FR_Floating_N  = f9
 FR_Result2     = f9
-FR_Norm_N      = f10
-FR_Result3     = f11
-FR_Norm_X      = f12
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
 FR_N_float_int = f13
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-FR_Big         = f6
-FR_NBig        = f7
+FR_Norm_N      = f14
 
+GR_neg_ov_limit= r14
+GR_big_exp     = r14
 GR_N_Biased    = r15
 GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_exp_sure_ou = r19
 GR_Bias        = r20
 GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+GR_Scratch     = r28
+GR_signexp_N   = r29
+GR_exp_N       = r30
 
 GR_SAVE_B0          = r32
 GR_SAVE_GP          = r33
@@ -84,433 +106,447 @@ GR_Parameter_Y      = r36
 GR_Parameter_RESULT = r37
 GR_Tag              = r38
 
-.align 32
-.global scalbl
-
 .section .text
-.proc  scalbl
-.align 32
-
-scalbl: 
-#ifdef _LIBC
-.global __ieee754_scalbl
-.type __ieee754_scalbl,@function
-__ieee754_scalbl:
-#endif
+GLOBAL_IEEE754_ENTRY(scalbl)
 
 //
 //   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
 //
 {    .mfi
-     alloc          r32=ar.pfs,0,3,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl  GR_Scratch  = 0x019C3F,r0 
+     getf.exp      GR_signexp_N = FR_Floating_N // Get signexp of n
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fcvt.fx.trunc.s1   FR_N_float_int = FR_Floating_N // Get N in significand
+     nop.i         0
+}
+;;
+
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p7,p0 = FR_Floating_N, 0x0b  // Test for n=unorm
+     nop.i         0
 }
 //
-//   Is y a NAN, INF, ZERO, +-?
+//   Normalize n
 //
 {    .mfi
-     nop.m 999
-     fclass.m.unc  p6,p0 = FR_Floating_N, 0xe7 //@snan | @qnan | @inf |  @zero
-     addl  GR_Scratch1  = 0x063BF,r0 
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+     fnorm.s1      FR_Norm_N = FR_Floating_N
+     nop.i         0
 }
 ;;
 
 //
-//   Convert N to a fp integer
-//   Normalize x
+//   Is n NAN, INF, ZERO, +-?
 //
 {    .mfi
-     nop.m 0
-     fnorm.s1  FR_Norm_N  =   FR_Floating_N 
-     nop.i 999
+     mov           GR_big_exp = 0x1003e      // Exponent at which n is integer
+     fclass.m      p9,p0 = FR_Floating_N, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_max_exp = 0x13ffe      // Exponent of maximum long double
 }
-{    .mfi
-     nop.m 999
-     fnorm.s1  FR_Norm_X  =   FR_Floating_X 
-     nop.i 999
-};;
-
 //
-//   Create 2*big
-//   Create 2**-big 
 //   Normalize x
-//   Branch on special values.
 //
-{ .mib
-     setf.exp      FR_Big = GR_Scratch                  
-     nop.i 0 
-(p6) br.cond.spnt  L(SCALBL_NAN_INF_ZERO) 
+{ .mfb
+     nop.m         0
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+(p7) br.cond.spnt  SCALBL_N_UNORM             // Branch if n=unorm
 }
-{ .mib
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.i 0 
-(p7) br.cond.spnt  L(SCALBL_NAN_INF_ZERO) 
-};;
+;;
 
-//
-//   Convert N to a fp integer
-//   Create -35000
-//  
+SCALBL_COMMON1:
+// Main path continues.  Also return here from u=unorm path.
+//   Handle special cases if x = Nan, Inf, Zero
+{ .mfb
+     nop.m         0
+     fcmp.lt.s1    p7,p0 = FR_Floating_N, f0  // Test N negative
+(p6) br.cond.spnt  SCALBL_NAN_INF_ZERO
+}
+;;
+
+//   Handle special cases if n = Nan, Inf, Zero
 {    .mfi
-     addl  GR_Scratch = 1,r0
-     fcvt.fx.trunc.s1   FR_N_float_int = FR_Norm_N 
-     addl    GR_NBig = -35000,r0
+     getf.sig      GR_N_as_int = FR_N_float_int // Get n from significand
+     fclass.m      p8,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+     mov           GR_exp_sure_ou = 0x1000e // Exp_N where x*2^N sure over/under
+}
+{    .mfb
+     mov           GR_min_exp = 0x0c001      // Exponent of minimum long double
+     fcvt.xf       FR_N_float_int = FR_N_float_int // Convert N to FP integer
+(p9) br.cond.spnt  SCALBL_NAN_INF_ZERO
 }
 ;;
 
-//
-//   Put N if a GP register
-//   Convert  N_float_int to floating point value
-//   Create 35000
-//   Build the exponent Bias
-//
-{    .mii
-     getf.sig     GR_N_as_int = FR_N_float_int
-     shl   GR_Scratch = GR_Scratch,63
-     addl  GR_Big = 35000,r0
+{    .mmi
+     and           GR_exp_N = GR_exp_mask, GR_signexp_N // Get exponent of N
+(p7) sub           GR_Big = r0, GR_Big          // Limit for N
+     nop.i         0
 }
-{    .mfi
-     addl GR_Bias = 0x0FFFF,r0
-     fcvt.xf  FR_N_float_int = FR_N_float_int
-     nop.i 0
-};;
+;;
 
-//
-//   Catch those fp values that are beyond 2**64-1
-//   Is N > 35000     
-//   Is N < -35000     
-//
-{     .mfi
-     cmp.ne.unc  p9,p10 = GR_N_as_int,GR_Scratch
-     nop.f 0
-     nop.i 0
+{    .mib
+     cmp.lt        p9,p0 = GR_exp_N, GR_big_exp // N possible non-integer?
+     cmp.ge        p6,p0 = GR_exp_N, GR_exp_sure_ou // N certain over/under?
+(p8) br.cond.spnt  SCALBL_X_UNORM             // Branch if x=unorm
 }
-{     .mmi
-     cmp.ge.unc p6, p0 = GR_N_as_int, GR_Big
-     cmp.le.unc p8, p0 = GR_N_as_int, GR_NBig
-     nop.i 0
-};;
+;;
 
-//
-//   Is N really an int, only for those non-int indefinites?
-//   Create exp bias.     
-//
-{    .mfi
-     add GR_N_Biased = GR_Bias,GR_N_as_int
-(p9) fcmp.neq.unc.s1 p7,p0  =   FR_Norm_N, FR_N_float_int
-     nop.i 0
-};;
+SCALBL_COMMON2:
+// Main path continues.  Also return here from x=unorm path.
+//   Create biased exponent for 2**N
+{    .mmi
+(p6) mov           GR_N_as_int = GR_Big      // Limit N
+;;
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.i         0
+}
+;;
 
-//
-//   Branch and return if N is not an int.
-//   Main path, create 2**N
-//
 {    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.i                      999
+     setf.exp      FR_Two_N = GR_N_Biased               // Form 2**N
+(p9) fcmp.neq.unc.s1 p9,p0 = FR_Norm_N, FR_N_float_int  // Test if N an integer
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X // Get exponent of X
 }
-{    .mfb
-     nop.m 0
-(p7) frcpa          f8,p11     =    f0,f0
-(p7) br.ret.spnt    b0          
-};;
+;;
 
 //
-//   Set denormal on denormal input x and denormal input N
+//   Compute biased result exponent
+//   Branch if N is not an integer
 //
-{    .mfi
-     nop.m                      999
-(p10)fcmp.ge.s1    p6,p8 = FR_Norm_N,f0
-     nop.i 0
-};;
-{    .mfi
-     nop.m                      999
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     nop.i                      999
+{    .mib
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     mov           GR_min_den_exp = 0x0c001 - 63 // Exp of min denorm long dble
+(p9) br.cond.spnt  SCALBL_N_NOT_INT
 }
-{    .mfi
-     nop.m                      999
-     fcmp.ge.s0    p12,p13 = FR_Floating_N,f0
-     nop.i 0
-};;
+;;
 
 //
-//   Adjust 2**N if N was very small or very large
+//   Raise Denormal operand flag with compare
+//   Do final operation
 //
-
 {    .mfi
-     nop.m 0
-(p6) fma.s1  FR_Two_N = FR_Big,f1,f0
-     nop.i 0
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,FR_Floating_N  // Dummy to set denorm
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
 }
-{ .mlx
-     nop.m 999
-(p0) movl GR_Scratch = 0x0000000000033FFF 
-};;
-{    .mfi
-     nop.m 0
-(p8) fma.s1  FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
+{    .mfb
+     nop.m         0
+     fma.s0        FR_Result = FR_Two_N,FR_Norm_X,f0
+(p9) br.cond.spnt  SCALBL_UNDERFLOW           // Branch if certain underflow
 }
-{    .mlx
-     nop.m 999
-(p0) movl GR_Scratch1= 0x0000000000013FFF 
-};;
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  SCALBL_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  SCALBL_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  SCALBL_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
 
-//   Set up necessary status fields 
+// Here if possible underflow.
+// Resulting exponent: 0x0c001-63 <= exp_Result < 0x0c001
+SCALBL_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x13ffe = exp_Result
+SCALBL_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
 //
 //   S0 user supplied status
 //   S2 user supplied status + WRE + TD  (Overflows)
 //   S3 user supplied status + FZ + TD   (Underflows)
 //
 {    .mfi
-     nop.m 999
-(p0) fsetc.s3 0x7F,0x41
-     nop.i 999
+     mov           GR_pos_ov_limit = 0x13fff // Exponent for positive overflow
+     fsetc.s3      0x7F,0x41
+     nop.i         0
 }
 {    .mfi
-     nop.m 999
-(p0) fsetc.s2 0x7F,0x42
-     nop.i 999
-};;
+     mov           GR_neg_ov_limit = 0x33fff // Exponent for negative overflow
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
 
 //
-//   Do final operation
+//   Do final operation with s2 and s3
 //
 {    .mfi
-     setf.exp FR_NBig = GR_Scratch
-     fma.s0     FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.s3        FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
 }
 {    .mfi
-     nop.m                           999
-     fma.s3     FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
-{    .mfi
-     setf.exp FR_Big = GR_Scratch1
-     fma.s2     FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.s2        FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
 
 //   Check for overflow or underflow.
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflow)
-//   S3 user supplied status + FZ + TD   (Underflow)
-//
-//
 //   Restore s3
 //   Restore s2
 //
 {    .mfi
-     nop.m 0
-     fsetc.s3 0x7F,0x40
-     nop.i 999 
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
 }
 {    .mfi
-     nop.m 0
-     fsetc.s2 0x7F,0x40
-     nop.i 999
-};;
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
 
 //
 //   Is the result zero?
 //
 {    .mfi
-     nop.m 999
-     fclass.m.unc   p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
 {    .mfi
-     addl GR_Tag = 51, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
 
 //
 //   Detect masked underflow - Tiny + Inexact Only
 //
 {    .mfi
-     nop.m 999
+     nop.m         0
 (p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
+     nop.i         0
+}
+;;
 
 //
 //   Is result bigger the allowed range?
 //   Branch out for underflow
 //
 {    .mfb
-(p6) addl GR_Tag = 52, r0
+     nop.m          0
 (p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt L(SCALBL_UNDERFLOW) 
-};;
+(p6) br.cond.spnt   SCALBL_UNDERFLOW
+}
+;;
 
 //
 //   Branch out for overflow
 //
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt L(SCALBL_OVERFLOW) 
-(p9) br.cond.spnt L(SCALBL_OVERFLOW) 
-};;
+{ .bbb
+(p7) br.cond.spnt   SCALBL_OVERFLOW
+(p9) br.cond.spnt   SCALBL_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
 
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
+// Here if result overflows
+SCALBL_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 51, r0     // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
 }
+;;
 
-L(SCALBL_NAN_INF_ZERO): 
+// Here if result underflows
+SCALBL_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 52, r0     // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
 
+SCALBL_NAN_INF_ZERO:
+
+//
+//   Before entry, N has been converted to a fp integer in significand of 
+//     FR_N_float_int
+//
+//   Convert  N_float_int to floating point value
 //
-//   Convert N to a fp integer
-//  
 {    .mfi
-     addl  GR_Scratch = 1,r0
-     fcvt.fx.trunc.s1  FR_N_float_int = FR_Norm_N 
-     nop.i 999
+     getf.sig     GR_N_as_int = FR_N_float_int
+     fclass.m     p6,p0 = FR_Floating_N, 0xc3 //@snan | @qnan
+     nop.i        0
 }
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p6,p0 = FR_Floating_N, 0xc3 //@snan | @qnan 
-     nop.i 0
-};;
+     addl         GR_Scratch = 1,r0
+     fcvt.xf      FR_N_float_int = FR_N_float_int
+     nop.i        0
+}
+;;
+
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xc3 //@snan | @qnan 
-     shl   GR_Scratch = GR_Scratch,63
-};;
+     nop.m        0
+     fclass.m     p7,p0 = FR_Floating_X, 0xc3 //@snan | @qnan
+     shl          GR_Scratch = GR_Scratch,63
+}
+;;
+
 {    .mfi
-     nop.m 0
-     fclass.m.unc  p8,p0 = FR_Floating_N, 0x21 // @inf
-     nop.i 0
-}
-  {  .mfi
-     nop.m 0
-     fclass.m.unc  p9,p0 = FR_Floating_N, 0x22 // @-inf
-     nop.i 0
-};;
+     nop.m        0
+     fclass.m     p8,p0 = FR_Floating_N, 0x21 // @inf
+     nop.i        0
+}
+{    .mfi
+     nop.m        0
+     fclass.m     p9,p0 = FR_Floating_N, 0x22 // @-inf
+     nop.i        0
+}
+;;
 
 //
 //   Either X or N is a Nan, return result and possible raise invalid.
 //
 {    .mfb
-     nop.m 0
-(p6) fma.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0 
+     nop.m        0
+(p6) fma.s0       FR_Result = FR_Floating_N,FR_Floating_X,f0
 (p6) br.ret.spnt  b0
-};;
+}
+;;
+
 {    .mfb
-     getf.sig     GR_N_as_int = FR_N_float_int
-(p7) fma.s0     FR_Result = FR_Floating_N,FR_Floating_X,f0 
+     nop.m        0
+(p7) fma.s0       FR_Result = FR_Floating_N,FR_Floating_X,f0
 (p7) br.ret.spnt  b0
-};;
+}
+;;
 
 //
 //   If N + Inf do something special
 //   For N = -Inf, create Int
 //
 {    .mfb
-     nop.m 0
-(p8) fma.s0    FR_Result = FR_Floating_X, FR_Floating_N,f0 
-(p8) br.ret.spnt   b0
+     nop.m        0
+(p8) fma.s0       FR_Result = FR_Floating_X, FR_Floating_N,f0
+(p8) br.ret.spnt  b0
 }
 {    .mfi
-     nop.m 0
-(p9) fnma.s0   FR_Floating_N = FR_Floating_N, f1, f0 
-     nop.i 0
-};;
+     nop.m        0
+(p9) fnma.s0      FR_Floating_N = FR_Floating_N, f1, f0
+     nop.i        0
+}
+;;
 
 //
 //   If N==-Inf,return x/(-N)
 //
 {    .mfb
-     nop.m 0
-(p9) frcpa.s0        FR_Result,p6 =  FR_Floating_X,FR_Floating_N
-(p9) br.ret.spnt    b0          
-};;
-
-//
-//   Convert  N_float_int to floating point value
-//
-{     .mfi
-     cmp.ne.unc  p9,p0     =   GR_N_as_int,GR_Scratch
-     fcvt.xf  FR_N_float_int = FR_N_float_int
-     nop.i  0
-};;
+     cmp.ne       p7,p0 = GR_N_as_int,GR_Scratch
+(p9) frcpa.s0     FR_Result,p0 = FR_Floating_X,FR_Floating_N
+(p9) br.ret.spnt  b0
+}
+;;
 
 //
 //   Is N an integer.
 //
 {    .mfi
-     nop.m 0
-(p9) fcmp.neq.unc.s1 p7,p0  =   FR_Norm_N, FR_N_float_int
-     nop.i 0
-};;
+     nop.m        0
+(p7) fcmp.neq.unc.s1 p7,p0 = FR_Norm_N, FR_N_float_int
+     nop.i        0
+}
+;;
 
 //
 //   If N not an int, return NaN and raise invalid.
 //
 {    .mfb
-     nop.m 0
-(p7) frcpa.s0        FR_Result,p6     =    f0,f0
-(p7) br.ret.spnt    b0          
-};;
+     nop.m        0
+(p7) frcpa.s0     FR_Result,p0 = f0,f0
+(p7) br.ret.spnt  b0
+}
+;;
 
 //
-//   Always return x in other path. 
+//   Always return x in other path.
 //
 {    .mfb
-     nop.m 0
-     fma.s0      FR_Result = FR_Floating_X,f1,f0 
-     br.ret.sptk   b0
-};;
+     nop.m        0
+     fma.s0       FR_Result = FR_Floating_X,f1,f0
+     br.ret.sptk  b0
+}
+;;
 
-.endp scalbl
-ASM_SIZE_DIRECTIVE(scalbl)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__ieee754_scalbl)
-#endif
-.proc __libm_error_region
-__libm_error_region:
+// Here if n not int
+// Return NaN and raise invalid.
+SCALBL_N_NOT_INT:
+{    .mfb
+     nop.m        0
+     frcpa.s0     FR_Result,p0 = f0,f0
+     br.ret.sptk  b0
+}
+;;
+
+// Here if n=unorm
+SCALBL_N_UNORM:
+{ .mfb
+     getf.exp      GR_signexp_N = FR_Norm_N // Get signexp of normalized n
+     fcvt.fx.trunc.s1   FR_N_float_int = FR_Norm_N // Get N in significand
+     br.cond.sptk  SCALBL_COMMON1            // Return to main path
+}
+;;
 
-L(SCALBL_OVERFLOW): 
-L(SCALBL_UNDERFLOW): 
+// Here if x=unorm
+SCALBL_X_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  SCALBL_COMMON2            // Return to main path
+}
+;;
+
+GLOBAL_IEEE754_END(scalbl)
+LOCAL_LIBM_ENTRY(__libm_error_region)
 
 //
 // Get stack address of N
 //
 .prologue
 { .mfi
-    add   GR_Parameter_Y=-32,sp         
+    add   GR_Parameter_Y=-32,sp
     nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
+    mov  GR_SAVE_PFS=ar.pfs
 }
 //
-// Adjust sp 
+// Adjust sp
 //
 { .mfi
 .fframe 64
-   add sp=-64,sp                         
+   add sp=-64,sp
    nop.f 0
-   mov GR_SAVE_GP=gp       
+   mov GR_SAVE_GP=gp
 };;
 
 //
-//  Store N on stack in correct position 
+//  Store N on stack in correct position
 //  Locate the address of x on stack
 //
 { .mmi
-   stfe [GR_Parameter_Y] = FR_Norm_N,16       
-   add GR_Parameter_X = 16,sp          
+   stfe [GR_Parameter_Y] = FR_Norm_N,16
+   add GR_Parameter_X = 16,sp
 .save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
+   mov GR_SAVE_B0=b0
 };;
 
 //
@@ -519,46 +555,45 @@ L(SCALBL_UNDERFLOW):
 //
 .body
 { .mib
-   stfe [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
+   stfe [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
    nop.b 0
 }
 { .mib
-   stfe [GR_Parameter_Y] = FR_Result                 
+   stfe [GR_Parameter_Y] = FR_Result
    add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
+   br.call.sptk b0=__libm_error_support#
 };;
 
 //
 //  Get location of result on stack
 //
 { .mmi
+   add   GR_Parameter_RESULT = 48,sp
    nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
+   nop.i 0
 };;
 
 //
-//  Get the new result 
+//  Get the new result
 //
 { .mmi
-   ldfe  FR_Result = [GR_Parameter_RESULT]      
+   ldfe  FR_Result = [GR_Parameter_RESULT]
 .restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
 };;
 
 //
 //  Restore gp, ar.pfs and return
 //
 { .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_sinh.S b/sysdeps/ia64/fpu/e_sinh.S
index 4415dc7524..f60907b72b 100644
--- a/sysdeps/ia64/fpu/e_sinh.S
+++ b/sysdeps/ia64/fpu/e_sinh.S
@@ -1,10 +1,10 @@
 .file "sinh.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1249 +20,840 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
 // 10/12/00 Update to set denormal operand and underflow flags
-// 1/22/01  Fixed to set inexact flag for small args.
-//
+// 01/22/01 Fixed to set inexact flag for small args.
+// 05/02/01 Reworked to improve speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 11/20/02 Improved speed with new algorithm
+// 03/31/05 Reformatted delimiters between data tables
+
 // API
 //==============================================================
-// double = sinh(double)
-// input  floating point f8
-// output floating point f8
-//
-// Registers used
-//==============================================================
-// general registers: 
-// r32 -> r47
-// predicate registers used:
-// p6 p7 p8 p9
-// floating-point registers used:
-// f9 -> f15; f32 -> f45; 
-// f8 has input, then output
-//
+// double sinh(double)
+
 // Overview of operation
 //==============================================================
-// There are four paths
-// 1. |x| < 0.25        SINH_BY_POLY
-// 2. |x| < 32          SINH_BY_TBL
-// 3. |x| < 2^14        SINH_BY_EXP
-// 4. |x_ >= 2^14       SINH_HUGE
-//
-// For double extended we get infinity for x >= 400c b174 ddc0 31ae c0ea
-//                                           >= 1.0110001.... x 2^13
-//                                           >= 11357.2166
-//
-// But for double we get infinity for x >= 408633ce8fb9f87e
-//                                      >= 1.0110...x 2^9
-//                                      >= +7.10476e+002
-//
-// And for single we get infinity for x >= 42b3a496
-//                                      >= 1.0110... 2^6
-//                                      >= 89.8215
+// Case 1:  0 < |x| < 2^-60
+//  Result = x, computed by x+sgn(x)*x^2) to handle flags and rounding
 //
-// SAFE: If there is danger of overflow set SAFE to 0
-//       NOT implemented: if there is danger of underflow, set SAFE to 0
-// SAFE for all paths listed below
+// Case 2:  2^-60 < |x| < 0.25
+//  Evaluate sinh(x) by a 13th order polynomial
+//  Care is take for the order of multiplication; and A1 is not exactly 1/3!,
+//  A2 is not exactly 1/5!, etc.
+//  sinh(x) = x + (A1*x^3 + A2*x^5 + A3*x^7 + A4*x^9 + A5*x^11 + A6*x^13)
 //
-// 1. SINH_BY_POLY
-// ===============
-// If |x| is less than the tiny threshold, then clear SAFE 
-// For double, the tiny threshold is -1022 = -0x3fe => -3fe + ffff = fc01
-//             register-biased, this is fc01
-// For single, the tiny threshold is -126  = -7e    => -7e  + ffff = ff81
-// If |x| < tiny threshold, set SAFE = 0
+// Case 3:  0.25 < |x| < 710.47586
+//  Algorithm is based on the identity sinh(x) = ( exp(x) - exp(-x) ) / 2.
+//  The algorithm for exp is described as below.  There are a number of
+//  economies from evaluating both exp(x) and exp(-x).  Although we
+//  are evaluating both quantities, only where the quantities diverge do we
+//  duplicate the computations.  The basic algorithm for exp(x) is described
+//  below.
 //
-// 2. SINH_BY_TBL
-// =============
-// SAFE: SAFE is always 1 for TBL; 
-//
-// 3. SINH_BY_EXP
-// ==============
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// r34 has N-1; 16382 is in register biased form, 0x13ffd
-// There is danger of double overflow if N-1 > 0x3fe
-//                       in register biased form, 0x103fd
-// Analagously, there is danger of single overflow if N-1 > 0x7e
-//                       in register biased form, 0x1007d
-// SAFE: If there is danger of overflow set SAFE to 0
-//
-// 4. SINH_HUGE
-// ============
-// SAFE: SAFE is always 0 for HUGE
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 128/log2
+//  n = int(w)
+//  x = n log2/128 + r + delta
 
-#include "libm_support.h"
+//  n = 128M + index_1 + 2^4 index_2
+//  x = M log2 + (log2/128) index_1 + (log2/8) index_2 + r + delta
 
-//
-// Assembly macros
-//==============================================================
-sinh_FR_X            = f44
-sinh_FR_X2           = f9
-sinh_FR_X4           = f10
-sinh_FR_SGNX         = f40
-sinh_FR_all_ones     = f45
-sinh_FR_tmp          = f42
-
-sinh_FR_Inv_log2by64 = f9
-sinh_FR_log2by64_lo  = f11
-sinh_FR_log2by64_hi  = f10
-
-sinh_FR_A1           = f9
-sinh_FR_A2           = f10
-sinh_FR_A3           = f11
-
-sinh_FR_Rcub         = f12
-sinh_FR_M_temp       = f13
-sinh_FR_R_temp       = f13
-sinh_FR_Rsq          = f13
-sinh_FR_R            = f14
-
-sinh_FR_M            = f38
-
-sinh_FR_B1           = f15
-sinh_FR_B2           = f32
-sinh_FR_B3           = f33
-
-sinh_FR_peven_temp1  = f34
-sinh_FR_peven_temp2  = f35
-sinh_FR_peven        = f36
-
-sinh_FR_podd_temp1   = f34
-sinh_FR_podd_temp2   = f35
-sinh_FR_podd         = f37
-
-sinh_FR_poly_podd_temp1    =  f11 
-sinh_FR_poly_podd_temp2    =  f13
-sinh_FR_poly_peven_temp1   =  f11
-sinh_FR_poly_peven_temp2   =  f13
+//  exp(x) = 2^M  2^(index_1/128)  2^(index_2/8) exp(r) exp(delta)
+//       Construct 2^M
+//       Get 2^(index_1/128) from table_1;
+//       Get 2^(index_2/8)   from table_2;
+//       Calculate exp(r) by 5th order polynomial
+//          r = x - n (log2/128)_high
+//          delta = - n (log2/128)_low
+//       Calculate exp(delta) as 1 + delta
 
-sinh_FR_J_temp       = f9
-sinh_FR_J            = f10
 
-sinh_FR_Mmj          = f39
-
-sinh_FR_N_temp1      = f11
-sinh_FR_N_temp2      = f12
-sinh_FR_N            = f13
-
-sinh_FR_spos         = f14
-sinh_FR_sneg         = f15
-
-sinh_FR_Tjhi         = f32
-sinh_FR_Tjlo         = f33
-sinh_FR_Tmjhi        = f34
-sinh_FR_Tmjlo        = f35
-
-sinh_GR_mJ           = r35
-sinh_GR_J            = r36
-
-sinh_AD_mJ           = r38
-sinh_AD_J            = r39
-sinh_GR_all_ones     = r40
-
-sinh_FR_S_hi         = f9
-sinh_FR_S_hi_temp    = f10
-sinh_FR_S_lo_temp1   = f11 
-sinh_FR_S_lo_temp2   = f12 
-sinh_FR_S_lo_temp3   = f13 
-
-sinh_FR_S_lo         = f38
-sinh_FR_C_hi         = f39
+// Special values
+//==============================================================
+// sinh(+0)    = +0
+// sinh(-0)    = -0
 
-sinh_FR_C_hi_temp1   = f10
-sinh_FR_Y_hi         = f11 
-sinh_FR_Y_lo_temp    = f12 
-sinh_FR_Y_lo         = f13 
-sinh_FR_SINH         = f9
+// sinh(+qnan) = +qnan
+// sinh(-qnan) = -qnan
+// sinh(+snan) = +qnan
+// sinh(-snan) = -qnan
 
-sinh_FR_P1           = f14
-sinh_FR_P2           = f15
-sinh_FR_P3           = f32
-sinh_FR_P4           = f33
-sinh_FR_P5           = f34
-sinh_FR_P6           = f35
+// sinh(-inf)  = -inf
+// sinh(+inf)  = +inf
 
-sinh_FR_TINY_THRESH  = f9
+// Overflow and Underflow
+//=======================
+// sinh(x) = largest double normal when
+//     |x| = 710.47586 = 0x408633ce8fb9f87d
+//
+// Underflow is handled as described in case 1 above
 
-sinh_FR_SINH_temp    = f10
-sinh_FR_SCALE        = f11 
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input, output
+// f6 -> f15,  f32 -> f61
 
-sinh_FR_signed_hi_lo = f10
+// General registers used:
+// r14 -> r40
 
+// Predicate registers used:
+// p6 -> p15
 
-GR_SAVE_PFS          = r41
-GR_SAVE_B0           = r42
-GR_SAVE_GP           = r43
+// Assembly macros
+//==============================================================
 
-GR_Parameter_X       = r44
-GR_Parameter_Y       = r45
-GR_Parameter_RESULT  = r46
+rRshf                 = r14
+rN_neg                = r14
+rAD_TB1               = r15
+rAD_TB2               = r16
+rAD_P                 = r17
+rN                    = r18
+rIndex_1              = r19
+rIndex_2_16           = r20
+rM                    = r21
+rBiased_M             = r21
+rSig_inv_ln2          = r22
+rIndex_1_neg          = r22
+rExp_bias             = r23
+rExp_bias_minus_1     = r23
+rExp_mask             = r24
+rTmp                  = r24
+rGt_ln                = r24
+rIndex_2_16_neg       = r24
+rM_neg                = r25
+rBiased_M_neg         = r25
+rRshf_2to56           = r26
+rAD_T1_neg            = r26
+rExp_2tom56           = r28
+rAD_T2_neg            = r28
+rAD_T1                = r29
+rAD_T2                = r30
+rSignexp_x            = r31
+rExp_x                = r31
+
+GR_SAVE_B0            = r33
+GR_SAVE_PFS           = r34
+GR_SAVE_GP            = r35
+
+GR_Parameter_X        = r37
+GR_Parameter_Y        = r38
+GR_Parameter_RESULT   = r39
+GR_Parameter_TAG      = r40
+
+
+FR_X                  = f10
+FR_Y                  = f1
+FR_RESULT             = f8
+
+fRSHF_2TO56           = f6
+fINV_LN2_2TO63        = f7
+fW_2TO56_RSH          = f9
+f2TOM56               = f11
+fP5                   = f12
+fP4                   = f13
+fP3                   = f14
+fP2                   = f15
+
+fLn2_by_128_hi        = f33
+fLn2_by_128_lo        = f34
+
+fRSHF                 = f35
+fNfloat               = f36
+fNormX                = f37
+fR                    = f38
+fF                    = f39
+
+fRsq                  = f40
+f2M                   = f41
+fS1                   = f42
+fT1                   = f42
+fS2                   = f43
+fT2                   = f43
+fS                    = f43
+fWre_urm_f8           = f44
+fAbsX                 = f44
+
+fMIN_DBL_OFLOW_ARG    = f45
+fMAX_DBL_NORM_ARG     = f46
+fXsq                  = f47
+fX4                   = f48
+fGt_pln               = f49
+fTmp                  = f49
+
+fP54                  = f50
+fP5432                = f50
+fP32                  = f51
+fP                    = f52
+fP54_neg              = f53
+fP5432_neg            = f53
+fP32_neg              = f54
+fP_neg                = f55
+fF_neg                = f56
+
+f2M_neg               = f57
+fS1_neg               = f58
+fT1_neg               = f58
+fS2_neg               = f59
+fT2_neg               = f59
+fS_neg                = f59
+fExp                  = f60
+fExp_neg              = f61
+
+fA6                   = f50
+fA65                  = f50
+fA6543                = f50
+fA654321              = f50
+fA5                   = f51
+fA4                   = f52
+fA43                  = f52
+fA3                   = f53
+fA2                   = f54
+fA21                  = f54
+fA1                   = f55
+fX3                   = f56
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
+RODATA
 .align 16
-double_sinh_arg_reduction:
-ASM_TYPE_DIRECTIVE(double_sinh_arg_reduction,@object)
-   data8 0xB8AA3B295C17F0BC, 0x00004005
-   data8 0xB17217F7D1000000, 0x00003FF8
-   data8 0xCF79ABC9E3B39804, 0x00003FD0
-ASM_SIZE_DIRECTIVE(double_sinh_arg_reduction)
-
-double_sinh_p_table:
-ASM_TYPE_DIRECTIVE(double_sinh_p_table,@object)
-   data8 0xAAAAAAAAAAAAAAAB, 0x00003FFC
-   data8 0x8888888888888412, 0x00003FF8
-   data8 0xD00D00D00D4D39F2, 0x00003FF2
-   data8 0xB8EF1D28926D8891, 0x00003FEC
-   data8 0xD732377688025BE9, 0x00003FE5
-   data8 0xB08AF9AE78C1239F, 0x00003FDE
-ASM_SIZE_DIRECTIVE(double_sinh_p_table)
-
-double_sinh_ab_table:
-ASM_TYPE_DIRECTIVE(double_sinh_ab_table,@object)
-   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC
-   data8 0x88888888884ECDD5, 0x00003FF8
-   data8 0xD00D0C6DCC26A86B, 0x00003FF2
-   data8 0x8000000000000002, 0x00003FFE
-   data8 0xAAAAAAAAAA402C77, 0x00003FFA
-   data8 0xB60B6CC96BDB144D, 0x00003FF5
-ASM_SIZE_DIRECTIVE(double_sinh_ab_table)
-
-double_sinh_j_table:
-ASM_TYPE_DIRECTIVE(double_sinh_j_table,@object)
-   data8 0xB504F333F9DE6484, 0x00003FFE, 0x1EB2FB13, 0x00000000
-   data8 0xB6FD91E328D17791, 0x00003FFE, 0x1CE2CBE2, 0x00000000
-   data8 0xB8FBAF4762FB9EE9, 0x00003FFE, 0x1DDC3CBC, 0x00000000
-   data8 0xBAFF5AB2133E45FB, 0x00003FFE, 0x1EE9AA34, 0x00000000
-   data8 0xBD08A39F580C36BF, 0x00003FFE, 0x9EAEFDC1, 0x00000000
-   data8 0xBF1799B67A731083, 0x00003FFE, 0x9DBF517B, 0x00000000
-   data8 0xC12C4CCA66709456, 0x00003FFE, 0x1EF88AFB, 0x00000000
-   data8 0xC346CCDA24976407, 0x00003FFE, 0x1E03B216, 0x00000000
-   data8 0xC5672A115506DADD, 0x00003FFE, 0x1E78AB43, 0x00000000
-   data8 0xC78D74C8ABB9B15D, 0x00003FFE, 0x9E7B1747, 0x00000000
-   data8 0xC9B9BD866E2F27A3, 0x00003FFE, 0x9EFE3C0E, 0x00000000
-   data8 0xCBEC14FEF2727C5D, 0x00003FFE, 0x9D36F837, 0x00000000
-   data8 0xCE248C151F8480E4, 0x00003FFE, 0x9DEE53E4, 0x00000000
-   data8 0xD06333DAEF2B2595, 0x00003FFE, 0x9E24AE8E, 0x00000000
-   data8 0xD2A81D91F12AE45A, 0x00003FFE, 0x1D912473, 0x00000000
-   data8 0xD4F35AABCFEDFA1F, 0x00003FFE, 0x1EB243BE, 0x00000000
-   data8 0xD744FCCAD69D6AF4, 0x00003FFE, 0x1E669A2F, 0x00000000
-   data8 0xD99D15C278AFD7B6, 0x00003FFE, 0x9BBC610A, 0x00000000
-   data8 0xDBFBB797DAF23755, 0x00003FFE, 0x1E761035, 0x00000000
-   data8 0xDE60F4825E0E9124, 0x00003FFE, 0x9E0BE175, 0x00000000
-   data8 0xE0CCDEEC2A94E111, 0x00003FFE, 0x1CCB12A1, 0x00000000
-   data8 0xE33F8972BE8A5A51, 0x00003FFE, 0x1D1BFE90, 0x00000000
-   data8 0xE5B906E77C8348A8, 0x00003FFE, 0x1DF2F47A, 0x00000000
-   data8 0xE8396A503C4BDC68, 0x00003FFE, 0x1EF22F22, 0x00000000
-   data8 0xEAC0C6E7DD24392F, 0x00003FFE, 0x9E3F4A29, 0x00000000
-   data8 0xED4F301ED9942B84, 0x00003FFE, 0x1EC01A5B, 0x00000000
-   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE, 0x1E8CAC3A, 0x00000000
-   data8 0xF281773C59FFB13A, 0x00003FFE, 0x9DBB3FAB, 0x00000000
-   data8 0xF5257D152486CC2C, 0x00003FFE, 0x1EF73A19, 0x00000000
-   data8 0xF7D0DF730AD13BB9, 0x00003FFE, 0x9BB795B5, 0x00000000
-   data8 0xFA83B2DB722A033A, 0x00003FFE, 0x1EF84B76, 0x00000000
-   data8 0xFD3E0C0CF486C175, 0x00003FFE, 0x9EF5818B, 0x00000000
-   data8 0x8000000000000000, 0x00003FFF, 0x00000000, 0x00000000
-   data8 0x8164D1F3BC030773, 0x00003FFF, 0x1F77CACA, 0x00000000
-   data8 0x82CD8698AC2BA1D7, 0x00003FFF, 0x1EF8A91D, 0x00000000
-   data8 0x843A28C3ACDE4046, 0x00003FFF, 0x1E57C976, 0x00000000
-   data8 0x85AAC367CC487B15, 0x00003FFF, 0x9EE8DA92, 0x00000000
-   data8 0x871F61969E8D1010, 0x00003FFF, 0x1EE85C9F, 0x00000000
-   data8 0x88980E8092DA8527, 0x00003FFF, 0x1F3BF1AF, 0x00000000
-   data8 0x8A14D575496EFD9A, 0x00003FFF, 0x1D80CA1E, 0x00000000
-   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF, 0x9D0373AF, 0x00000000
-   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF, 0x9F167097, 0x00000000
-   data8 0x8EA4398B45CD53C0, 0x00003FFF, 0x1EB70051, 0x00000000
-   data8 0x9031DC431466B1DC, 0x00003FFF, 0x1F6EB029, 0x00000000
-   data8 0x91C3D373AB11C336, 0x00003FFF, 0x1DFD6D8E, 0x00000000
-   data8 0x935A2B2F13E6E92C, 0x00003FFF, 0x9EB319B0, 0x00000000
-   data8 0x94F4EFA8FEF70961, 0x00003FFF, 0x1EBA2BEB, 0x00000000
-   data8 0x96942D3720185A00, 0x00003FFF, 0x1F11D537, 0x00000000
-   data8 0x9837F0518DB8A96F, 0x00003FFF, 0x1F0D5A46, 0x00000000
-   data8 0x99E0459320B7FA65, 0x00003FFF, 0x9E5E7BCA, 0x00000000
-   data8 0x9B8D39B9D54E5539, 0x00003FFF, 0x9F3AAFD1, 0x00000000
-   data8 0x9D3ED9A72CFFB751, 0x00003FFF, 0x9E86DACC, 0x00000000
-   data8 0x9EF5326091A111AE, 0x00003FFF, 0x9F3EDDC2, 0x00000000
-   data8 0xA0B0510FB9714FC2, 0x00003FFF, 0x1E496E3D, 0x00000000
-   data8 0xA27043030C496819, 0x00003FFF, 0x9F490BF6, 0x00000000
-   data8 0xA43515AE09E6809E, 0x00003FFF, 0x1DD1DB48, 0x00000000
-   data8 0xA5FED6A9B15138EA, 0x00003FFF, 0x1E65EBFB, 0x00000000
-   data8 0xA7CD93B4E965356A, 0x00003FFF, 0x9F427496, 0x00000000
-   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF, 0x1F283C4A, 0x00000000
-   data8 0xAB7A39B5A93ED337, 0x00003FFF, 0x1F4B0047, 0x00000000
-   data8 0xAD583EEA42A14AC6, 0x00003FFF, 0x1F130152, 0x00000000
-   data8 0xAF3B78AD690A4375, 0x00003FFF, 0x9E8367C0, 0x00000000
-   data8 0xB123F581D2AC2590, 0x00003FFF, 0x9F705F90, 0x00000000
-   data8 0xB311C412A9112489, 0x00003FFF, 0x1EFB3C53, 0x00000000
-   data8 0xB504F333F9DE6484, 0x00003FFF, 0x1F32FB13, 0x00000000
-ASM_SIZE_DIRECTIVE(double_sinh_j_table)
-
-.align 32
-.global sinh#
 
-.section .text
-.proc  sinh#
-.align 32
-
-sinh: 
-#ifdef _LIBC
-.global __ieee754_sinh
-.type __ieee754_sinh,@function
-__ieee754_sinh:
-#endif
-
-// X infinity or NAN?
-// Take invalid fault if enabled
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
 
+// double-extended 1/ln(2)
+// 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
+// 3fff b8aa 3b29 5c17 f0bc
+// For speed the significand will be loaded directly with a movl and setf.sig
+//   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
+//   computations need to scale appropriately.
+// The constant 128/ln(2) is needed for the computation of w.  This is also
+//   obtained by scaling the computations.
+//
+// Two shifting constants are loaded directly with movl and setf.d.
+//   1. fRSHF_2TO56 = 1.1000..00 * 2^(63-7)
+//        This constant is added to x*1/ln2 to shift the integer part of
+//        x*128/ln2 into the rightmost bits of the significand.
+//        The result of this fma is fW_2TO56_RSH.
+//   2. fRSHF       = 1.1000..00 * 2^(63)
+//        This constant is subtracted from fW_2TO56_RSH * 2^(-56) to give
+//        the integer part of w, n, as a floating-point number.
+//        The result of this fms is fNfloat.
+
+
+LOCAL_OBJECT_START(exp_table_1)
+data8 0x408633ce8fb9f87e // smallest dbl overflow arg
+data8 0x408633ce8fb9f87d // largest dbl arg to give normal dbl result
+data8 0xb17217f7d1cf79ab , 0x00003ff7 // ln2/128 hi
+data8 0xc9e3b39803f2f6af , 0x00003fb7 // ln2/128 lo
+//
+// Table 1 is 2^(index_1/128) where
+// index_1 goes from 0 to 15
+//
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x80B1ED4FD999AB6C , 0x00003FFF
+data8 0x8164D1F3BC030773 , 0x00003FFF
+data8 0x8218AF4373FC25EC , 0x00003FFF
+data8 0x82CD8698AC2BA1D7 , 0x00003FFF
+data8 0x8383594EEFB6EE37 , 0x00003FFF
+data8 0x843A28C3ACDE4046 , 0x00003FFF
+data8 0x84F1F656379C1A29 , 0x00003FFF
+data8 0x85AAC367CC487B15 , 0x00003FFF
+data8 0x8664915B923FBA04 , 0x00003FFF
+data8 0x871F61969E8D1010 , 0x00003FFF
+data8 0x87DB357FF698D792 , 0x00003FFF
+data8 0x88980E8092DA8527 , 0x00003FFF
+data8 0x8955EE03618E5FDD , 0x00003FFF
+data8 0x8A14D575496EFD9A , 0x00003FFF
+data8 0x8AD4C6452C728924 , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_1)
+
+// Table 2 is 2^(index_1/8) where
+// index_2 goes from 0 to 7
+LOCAL_OBJECT_START(exp_table_2)
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
+data8 0x9837F0518DB8A96F , 0x00003FFF
+data8 0xA5FED6A9B15138EA , 0x00003FFF
+data8 0xB504F333F9DE6484 , 0x00003FFF
+data8 0xC5672A115506DADD , 0x00003FFF
+data8 0xD744FCCAD69D6AF4 , 0x00003FFF
+data8 0xEAC0C6E7DD24392F , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_2)
+
+
+LOCAL_OBJECT_START(exp_p_table)
+data8 0x3f8111116da21757 //P5
+data8 0x3fa55555d787761c //P4
+data8 0x3fc5555555555414 //P3
+data8 0x3fdffffffffffd6a //P2
+LOCAL_OBJECT_END(exp_p_table)
+
+LOCAL_OBJECT_START(sinh_p_table)
+data8 0xB08AF9AE78C1239F, 0x00003FDE  // A6
+data8 0xB8EF1D28926D8891, 0x00003FEC  // A4
+data8 0x8888888888888412, 0x00003FF8  // A2
+data8 0xD732377688025BE9, 0x00003FE5  // A5
+data8 0xD00D00D00D4D39F2, 0x00003FF2  // A3
+data8 0xAAAAAAAAAAAAAAAB, 0x00003FFC  // A1
+LOCAL_OBJECT_END(sinh_p_table)
 
-{ .mfi
-      alloc r32 = ar.pfs,0,12,4,0                  
-(p0)     fclass.m.unc  p6,p0 = f8, 0xe3	//@qnan | @snan | @inf 
-         mov sinh_GR_all_ones = -1
-}
-;;
 
+.section .text
+GLOBAL_IEEE754_ENTRY(sinh)
 
-{ .mfb
-         nop.m 999
-(p6)     fma.d.s0   f8 = f8,f1,f8               
-(p6)     br.ret.spnt     b0 ;;                          
+{ .mlx
+      getf.exp        rSignexp_x = f8  // Must recompute if x unorm
+      movl            rSig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
 }
-
-// Put 0.25 in f9; p6 true if x < 0.25
-// Make constant that will generate inexact when squared
 { .mlx
-         setf.sig sinh_FR_all_ones = sinh_GR_all_ones 
-(p0)     movl            r32 = 0x000000000000fffd ;;         
+      addl            rAD_TB1    = @ltoff(exp_table_1), gp
+      movl            rRshf_2to56 = 0x4768000000000000   // 1.10000 2^(63+56)
 }
+;;
 
 { .mfi
-(p0)     setf.exp        f9 = r32                         
-(p0)     fclass.m.unc  p7,p0 = f8, 0x07	//@zero
-         nop.i 999 ;;
+      ld8             rAD_TB1    = [rAD_TB1]
+      fclass.m        p6,p0 = f8,0x0b  // Test for x=unorm
+      mov             rExp_mask = 0x1ffff
 }
-
-{ .mfb
-         nop.m 999
-(p0)     fmerge.s      sinh_FR_X    = f0,f8             
-(p7)     br.ret.spnt     b0 ;;                          
-}
-
-// Identify denormal operands.
 { .mfi
-         nop.m 999
-         fclass.m.unc  p10,p0 = f8, 0x09        //  + denorm
-         nop.i 999
-};;
-{ .mfi
-         nop.m 999
-         fclass.m.unc  p11,p0 = f8, 0x0a        //  - denorm
-         nop.i 999 
+      mov             rExp_bias = 0xffff
+      fnorm.s1        fNormX   = f8
+      mov             rExp_2tom56 = 0xffff-56
 }
+;;
+
+// Form two constants we need
+//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128
+//  1.1000..000 * 2^(63+63-7) to right shift int(w) into the significand
 
 { .mfi
-         nop.m 999
-(p0)     fmerge.s      sinh_FR_SGNX = f8,f1             
-         nop.i 999 ;;
+      setf.sig        fINV_LN2_2TO63 = rSig_inv_ln2 // form 1/ln2 * 2^63
+      fclass.m        p8,p0 = f8,0x07  // Test for x=0
+      nop.i 999
 }
+{ .mlx
+      setf.d          fRSHF_2TO56 = rRshf_2to56 // Form const 1.100 * 2^(63+56)
+      movl            rRshf = 0x43e8000000000000 // 1.10000 2^63 for right shift
+}
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fcmp.lt.unc.s1  p0,p7 = sinh_FR_X,f9             
-         nop.i 999 ;;
+      ldfpd           fMIN_DBL_OFLOW_ARG, fMAX_DBL_NORM_ARG = [rAD_TB1],16
+      fclass.m        p10,p0 = f8,0x1e3  // Test for x=inf, nan, NaT
+      nop.i           0
 }
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p7)     br.cond.sptk    L(SINH_BY_TBL) ;;                      
-}
-
-
-L(SINH_BY_POLY): 
-
-// POLY cannot overflow so there is no need to call __libm_error_support
-// Set tiny_SAFE (p7) to 1(0) if answer is not tiny 
-// Currently we do not use tiny_SAFE. So the setting of tiny_SAFE is
-// commented out.
-//(p0)     movl            r32            = 0x000000000000fc01           
-//(p0)     setf.exp        f10            = r32                         
-//(p0)     fcmp.lt.unc.s1  p6,p7          = f8,f10                     
-// Here is essentially the algorithm for SINH_BY_POLY. Care is take for the order 
-// of multiplication; and P_1 is not exactly 1/3!, P_2 is not exactly 1/5!, etc.
-// Note that ax = |x|
-// sinh(x) = sign * (series(e^x) - series(e^-x))/2
-//         = sign * (ax + ax^3/3! + ax^5/5! + ax^7/7! + ax^9/9! + ax^11/11! + ax^13/13!)
-//         = sign * (ax   + ax * ( ax^2 * (1/3! + ax^4 * (1/7! + ax^4*1/11!)) )
-//                        + ax * ( ax^4 * (1/5! + ax^4 * (1/9! + ax^4*1/13!)) ) )
-//         = sign * (ax   + ax*p_odd + (ax*p_even))
-//         = sign * (ax   + Y_lo)
-// sinh(x) = sign * (Y_hi + Y_lo)
-// Get the values of P_x from the table
 { .mfb
-(p0)  addl           r34   = @ltoff(double_sinh_p_table), gp
-(p10) fma.d.s0       f8 =  f8,f8,f8
-(p10) br.ret.spnt    b0
+      setf.exp        f2TOM56 = rExp_2tom56 // form 2^-56 for scaling Nfloat
+      nop.f           0
+(p6)  br.cond.spnt    SINH_UNORM            // Branch if x=unorm
 }
 ;;
 
+SINH_COMMON:
+{ .mfi
+      ldfe            fLn2_by_128_hi  = [rAD_TB1],16
+      nop.f           0
+      nop.i           0
+}
 { .mfb
-      ld8 r34 = [r34]
-(p11) fnma.d.s0      f8 =  f8,f8,f8
-(p11) br.ret.spnt    b0
+      setf.d          fRSHF = rRshf // Form right shift const 1.100 * 2^63
+      nop.f           0
+(p8)  br.ret.spnt     b0                    // Exit for x=0, result=x
 }
 ;;
 
-// Calculate sinh_FR_X2 = ax*ax and sinh_FR_X4 = ax*ax*ax*ax
-{ .mmf
-         nop.m 999
-(p0)     ldfe            sinh_FR_P1 = [r34],16                 
-(p0)     fma.s1        sinh_FR_X2 = sinh_FR_X, sinh_FR_X, f0 ;;           
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_P2 = [r34],16 ;;                 
-(p0)     ldfe            sinh_FR_P3 = [r34],16                 
-         nop.i 999 ;;
+{ .mfi
+      ldfe            fLn2_by_128_lo  = [rAD_TB1],16
+      nop.f           0
+      nop.i           0
 }
-
-{ .mmi
-(p0)     ldfe            sinh_FR_P4 = [r34],16 ;;                 
-(p0)     ldfe            sinh_FR_P5 = [r34],16                 
-         nop.i 999 ;;
+{ .mfb
+      and             rExp_x = rExp_mask, rSignexp_x // Biased exponent of x
+(p10) fma.d.s0        f8 = f8,f1,f0  // Result if x=inf, nan, NaT
+(p10) br.ret.spnt     b0               // quick exit for x=inf, nan, NaT
 }
+;;
 
+// After that last load rAD_TB1 points to the beginning of table 1
 { .mfi
-(p0)     ldfe            sinh_FR_P6 = [r34],16                 
-(p0)     fma.s1        sinh_FR_X4 = sinh_FR_X2, sinh_FR_X2, f0         
-         nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s0      p6,p0 = f8, f0       // Dummy to set D
+      sub             rExp_x = rExp_x, rExp_bias // True exponent of x
 }
+;;
 
-// Calculate sinh_FR_podd = p_odd and sinh_FR_peven = p_even 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_podd_temp1 = sinh_FR_X4, sinh_FR_P5, sinh_FR_P3                
-         nop.i 999 ;;
+      nop.m           0
+      fmerge.s        fAbsX = f0, fNormX   // Form |x|
+      nop.i           0
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_podd_temp2 = sinh_FR_X4, sinh_FR_poly_podd_temp1, sinh_FR_P1   
-         nop.i 999
+{ .mfb
+      cmp.gt          p7, p0 = -2, rExp_x      // Test |x| < 2^(-2)
+      fma.s1          fXsq = fNormX, fNormX, f0  // x*x for small path
+(p7)  br.cond.spnt    SINH_SMALL               // Branch if 0 < |x| < 2^-2
 }
+;;
 
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_peven_temp1 = sinh_FR_X4, sinh_FR_P6, sinh_FR_P4               
-         nop.i 999 ;;
-}
+// W = X * Inv_log2_by_128
+// By adding 1.10...0*2^63 we shift and get round_int(W) in significand.
+// We actually add 1.10...0*2^56 to X * Inv_log2 to do the same thing.
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_podd       = sinh_FR_X2, sinh_FR_poly_podd_temp2, f0           
-         nop.i 999
+      add             rAD_P = 0x180, rAD_TB1
+      fma.s1          fW_2TO56_RSH  = fNormX, fINV_LN2_2TO63, fRSHF_2TO56
+      add             rAD_TB2 = 0x100, rAD_TB1
 }
+;;
 
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_peven_temp2 = sinh_FR_X4, sinh_FR_poly_peven_temp1, sinh_FR_P2 
-         nop.i 999 ;;
-}
+// Divide arguments into the following categories:
+//  Certain Safe                - 0.25 <= |x| <= MAX_DBL_NORM_ARG
+//  Possible Overflow       p14 - MAX_DBL_NORM_ARG < |x| < MIN_DBL_OFLOW_ARG
+//  Certain Overflow        p15 - MIN_DBL_OFLOW_ARG <= |x| < +inf
+//
+// If the input is really a double arg, then there will never be
+// "Possible Overflow" arguments.
+//
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_peven       = sinh_FR_X4, sinh_FR_poly_peven_temp2, f0         
-         nop.i 999 ;;
+      ldfpd           fP5, fP4  = [rAD_P] ,16
+      fcmp.ge.s1      p15,p14 = fAbsX,fMIN_DBL_OFLOW_ARG
+      nop.i           0
 }
+;;
 
-// Calculate sinh_FR_Y_lo = ax*p_odd + (ax*p_even)
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_Y_lo_temp    = sinh_FR_X, sinh_FR_peven, f0                    
-         nop.i 999 ;;
-}
+// Nfloat = round_int(W)
+// The signficand of fW_2TO56_RSH contains the rounded integer part of W,
+// as a twos complement number in the lower bits (that is, it may be negative).
+// That twos complement number (called N) is put into rN.
 
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_Y_lo         = sinh_FR_X, sinh_FR_podd,  sinh_FR_Y_lo_temp          
-         nop.i 999 ;;
-}
+// Since fW_2TO56_RSH is scaled by 2^56, it must be multiplied by 2^-56
+// before the shift constant 1.10000 * 2^63 is subtracted to yield fNfloat.
+// Thus, fNfloat contains the floating point version of N
 
-// Calculate sinh_FR_SINH = Y_hi + Y_lo. Note that ax = Y_hi
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_SINH        = sinh_FR_X, f1, sinh_FR_Y_lo                      
-         nop.i 999 ;;
+      ldfpd           fP3, fP2  = [rAD_P]
+(p14) fcmp.gt.unc.s1  p14,p0 = fAbsX,fMAX_DBL_NORM_ARG
+      nop.i           0
 }
-// Dummy multiply to generate inexact
-{ .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999
-}
-
-// Calculate f8 = sign * (Y_hi + Y_lo)
-// Go to return
 { .mfb
-         nop.m 999
-(p0)     fma.d.s0        f8 = sinh_FR_SGNX,sinh_FR_SINH,f0                       
-(p0)     br.ret.sptk     b0 ;;                          
+      nop.m           0
+      fms.s1          fNfloat = fW_2TO56_RSH, f2TOM56, fRSHF
+(p15) br.cond.spnt    SINH_CERTAIN_OVERFLOW
 }
+;;
 
-
-L(SINH_BY_TBL): 
-
-// Now that we are at TBL; so far all we know is that |x| >= 0.25.
-// The first two steps are the same for TBL and EXP, but if we are HUGE
-// we want to leave now. 
-// Double-extended:
-// Go to HUGE if |x| >= 2^14, 1000d (register-biased) is e = 14 (true)
-// Double
-// Go to HUGE if |x| >= 2^10, 10009 (register-biased) is e = 10 (true)
-// Single
-// Go to HUGE if |x| >= 2^7,  10006 (register-biased) is e =  7 (true)
-
-{ .mlx
-         nop.m 999
-(p0)     movl            r32 = 0x0000000000010009 ;;         
+{ .mfi
+      getf.sig        rN        = fW_2TO56_RSH
+      nop.f           0
+      mov             rExp_bias_minus_1 = 0xfffe
 }
+;;
 
+// rIndex_1 has index_1
+// rIndex_2_16 has index_2 * 16
+// rBiased_M has M
+
+// rM has true M
+// r = x - Nfloat * ln2_by_128_hi
+// f = 1 - Nfloat * ln2_by_128_lo
 { .mfi
-(p0)     setf.exp        f9 = r32                         
-         nop.f 999
-         nop.i 999 ;;
+      and             rIndex_1 = 0x0f, rN
+      fnma.s1         fR   = fNfloat, fLn2_by_128_hi, fNormX
+      shr             rM = rN,  0x7
 }
-
 { .mfi
-         nop.m 999
-(p0)     fcmp.ge.unc.s1  p6,p7 = sinh_FR_X,f9             
-         nop.i 999 ;;
+      and             rIndex_2_16 = 0x70, rN
+      fnma.s1         fF   = fNfloat, fLn2_by_128_lo, f1
+      sub             rN_neg = r0, rN
 }
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p6)     br.cond.spnt    L(SINH_HUGE) ;;                        
-}
-
-// r32 = 1
-// r34 = N-1 
-// r35 = N
-// r36 = j
-// r37 = N+1
-
-// TBL can never overflow
-// sinh(x) = sinh(B+R)
-//         = sinh(B)cosh(R) + cosh(B)sinh(R)
-// 
-// ax = |x| = M*log2/64 + R
-// B = M*log2/64
-// M = 64*N + j 
-//   We will calcualte M and get N as (M-j)/64
-//   The division is a shift.
-// exp(B)  = exp(N*log2 + j*log2/64)
-//         = 2^N * 2^(j*log2/64)
-// sinh(B) = 1/2(e^B -e^-B)
-//         = 1/2(2^N * 2^(j*log2/64) - 2^-N * 2^(-j*log2/64)) 
-// sinh(B) = (2^(N-1) * 2^(j*log2/64) - 2^(-N-1) * 2^(-j*log2/64)) 
-// cosh(B) = (2^(N-1) * 2^(j*log2/64) + 2^(-N-1) * 2^(-j*log2/64)) 
-// 2^(j*log2/64) is stored as Tjhi + Tjlo , j= -32,....,32
-// Tjhi is double-extended (80-bit) and Tjlo is single(32-bit)
-// R = ax - M*log2/64
-// R = ax - M*log2_by_64_hi - M*log2_by_64_lo
-// exp(R) = 1 + R +R^2(1/2! + R(1/3! + R(1/4! + ... + R(1/n!)...)
-//        = 1 + p_odd + p_even
-//        where the p_even uses the A coefficients and the p_even uses the B coefficients
-// So sinh(R) = 1 + p_odd + p_even -(1 -p_odd -p_even)/2 = p_odd
-//    cosh(R) = 1 + p_even
-//    sinh(B) = S_hi + S_lo
-//    cosh(B) = C_hi
-// sinh(x) = sinh(B)cosh(R) + cosh(B)sinh(R)
-// ******************************************************
-// STEP 1 (TBL and EXP)
-// ******************************************************
-// Get the following constants. 
-// f9  = Inv_log2by64
-// f10 = log2by64_hi
-// f11 = log2by64_lo
+;;
 
 { .mmi
-(p0)  adds                 r32 = 0x1,r0      
-(p0)  addl           r34   = @ltoff(double_sinh_arg_reduction), gp
-      nop.i 999
+      and             rIndex_1_neg = 0x0f, rN_neg
+      add             rBiased_M = rExp_bias_minus_1, rM
+      shr             rM_neg = rN_neg,  0x7
 }
-;;
-
 { .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+      and             rIndex_2_16_neg = 0x70, rN_neg
+      add             rAD_T2 = rAD_TB2, rIndex_2_16
+      shladd          rAD_T1 = rIndex_1, 4, rAD_TB1
 }
 ;;
 
-
-// We want 2^(N-1) and 2^(-N-1). So bias N-1 and -N-1 and
-// put them in an exponent.
-// sinh_FR_spos = 2^(N-1) and sinh_FR_sneg = 2^(-N-1)
-// r39 = 0xffff + (N-1)  = 0xffff +N -1
-// r40 = 0xffff - (N +1) = 0xffff -N -1
-
-{ .mlx
-         nop.m 999
-(p0)     movl                r38 = 0x000000000000fffe ;; 
-}
+// rAD_T1 has address of T1
+// rAD_T2 has address if T2
 
 { .mmi
-(p0)     ldfe            sinh_FR_Inv_log2by64 = [r34],16 ;;       
-(p0)     ldfe            sinh_FR_log2by64_hi  = [r34],16       
-         nop.i 999 ;;
-}
-
-{ .mbb
-(p0)     ldfe            sinh_FR_log2by64_lo  = [r34],16       
-         nop.b 999
-         nop.b 999 ;;
+      setf.exp        f2M = rBiased_M
+      ldfe            fT2  = [rAD_T2]
+      nop.i           0
 }
-
-// Get the A coefficients
-// f9  = A_1
-// f10 = A_2
-// f11 = A_3
-
 { .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(double_sinh_ab_table), gp
-      nop.i 999
+      add             rBiased_M_neg = rExp_bias_minus_1, rM_neg
+      add             rAD_T2_neg = rAD_TB2, rIndex_2_16_neg
+      shladd          rAD_T1_neg = rIndex_1_neg, 4, rAD_TB1
 }
 ;;
 
+// Create Scale = 2^M
+// Load T1 and T2
 { .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+      ldfe            fT1  = [rAD_T1]
+      nop.m           0
+      nop.i           0
 }
-;;
-
-
-// Calculate M and keep it as integer and floating point.
-// f38 = M = round-to-integer(x*Inv_log2by64)
-// sinh_FR_M = M = truncate(ax/(log2/64))
-// Put the significand of M in r35
-//    and the floating point representation of M in sinh_FR_M
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_M      = sinh_FR_X, sinh_FR_Inv_log2by64, f0 
-         nop.i 999
+{ .mmf
+      setf.exp        f2M_neg = rBiased_M_neg
+      ldfe            fT2_neg  = [rAD_T2_neg]
+      fma.s1          fF_neg   = fNfloat, fLn2_by_128_lo, f1
 }
+;;
 
 { .mfi
-(p0)     ldfe            sinh_FR_A1 = [r34],16            
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fRsq = fR, fR, f0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fcvt.fx.s1      sinh_FR_M_temp = sinh_FR_M                      
-         nop.i 999 ;;
+      ldfe            fT1_neg  = [rAD_T1_neg]
+      fma.s1          fP54 = fR, fP5, fP4
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fnorm.s1        sinh_FR_M      = sinh_FR_M_temp                 
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP32 = fR, fP3, fP2
+      nop.i           0
 }
-
 { .mfi
-(p0)     getf.sig        r35       = sinh_FR_M_temp                 
-         nop.f 999
-         nop.i 999 ;;
-}
-
-// M is still in r35. Calculate j. j is the signed extension of the six lsb of M. It 
-// has a range of -32 thru 31.
-// r35 = M
-// r36 = j 
-
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p0)     and            r36 = 0x3f, r35 ;;   
+      nop.m           0
+      fnma.s1         fP54_neg = fR, fP5, fP4
+      nop.i           0
 }
-
-// Calculate R
-// f13 = f44 - f12*f10 = ax - M*log2by64_hi
-// f14 = f13 - f8*f11  = R = (ax - M*log2by64_hi) - M*log2by64_lo
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fnma.s1           sinh_FR_R_temp = sinh_FR_M, sinh_FR_log2by64_hi, sinh_FR_X      
-         nop.i 999
+      nop.m           0
+      fnma.s1         fP32_neg = fR, fP3, fP2
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     ldfe            sinh_FR_A2 = [r34],16            
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP5432  = fRsq, fP54, fP32
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fnma.s1           sinh_FR_R      = sinh_FR_M, sinh_FR_log2by64_lo, sinh_FR_R_temp 
-         nop.i 999
-}
-
-// Get the B coefficients
-// f15 = B_1
-// f32 = B_2
-// f33 = B_3
-
-{ .mmi
-(p0)     ldfe            sinh_FR_A3 = [r34],16 ;;            
-(p0)     ldfe            sinh_FR_B1 = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_B2 = [r34],16 ;;            
-(p0)     ldfe            sinh_FR_B3 = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mii
-         nop.m 999
-(p0)     shl            r34 = r36,  0x2 ;;   
-(p0)     sxt1           r37 = r34 ;;         
-}
-
-// ******************************************************
-// STEP 2 (TBL and EXP)
-// ******************************************************
-// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-// f12 = R*R*R
-// f13 = R*R
-// f14 = R <== from above
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1             sinh_FR_Rsq  = sinh_FR_R,   sinh_FR_R, f0  
-(p0)     shr            r36 = r37,  0x2 ;;   
-}
-
-// r34 = M-j = r35 - r36
-// r35 = N = (M-j)/64
-
-{ .mii
-(p0)     sub                  r34 = r35, r36    
-         nop.i 999 ;;
-(p0)     shr                  r35 = r34, 0x6 ;;    
-}
-
-{ .mii
-(p0)     sub                 r40 = r38, r35           
-(p0)     adds                 r37 = 0x1, r35    
-(p0)     add                 r39 = r38, r35 ;;           
-}
-
-// Get the address of the J table, add the offset, 
-// addresses are sinh_AD_mJ and sinh_AD_J, get the T value
-// f32 = T(j)_hi
-// f33 = T(j)_lo
-// f34 = T(-j)_hi
-// f35 = T(-j)_lo
-
-{ .mmi
-(p0)  sub                  r34 = r35, r32    
-(p0)  addl           r37   = @ltoff(double_sinh_j_table), gp
-      nop.i 999
+      nop.m           0
+      fma.s1          fS2  = fF,fT2,f0
+      nop.i           0
 }
 ;;
 
-{ .mmi
-      ld8 r37 = [r37]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1             sinh_FR_Rcub = sinh_FR_Rsq, sinh_FR_R, f0  
-         nop.i 999
-}
-
-// ******************************************************
-// STEP 3 Now decide if we need to branch to EXP
-// ******************************************************
-// Put 32 in f9; p6 true if x < 32
-// Go to EXP if |x| >= 32 
-
-{ .mlx
-         nop.m 999
-(p0)     movl                r32 = 0x0000000000010004 ;;               
-}
-
-// Calculate p_even
-// f34 = B_2 + Rsq *B_3
-// f35 = B_1 + Rsq*f34      = B_1 + Rsq * (B_2 + Rsq *B_3)
-// f36 = p_even = Rsq * f35 = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven_temp1 = sinh_FR_Rsq, sinh_FR_B3,          sinh_FR_B2  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS1  = f2M,fT1,f0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven_temp2 = sinh_FR_Rsq, sinh_FR_peven_temp1, sinh_FR_B1  
-         nop.i 999
+      nop.m           0
+      fma.s1          fP5432_neg  = fRsq, fP54_neg, fP32_neg
+      nop.i           0
 }
-
-// Calculate p_odd
-// f34 = A_2 + Rsq *A_3
-// f35 = A_1 + Rsq * (A_2 + Rsq *A_3)
-// f37 = podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd_temp1 = sinh_FR_Rsq,        sinh_FR_A3,         sinh_FR_A2  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS1_neg  = f2M_neg,fT1_neg,f0
+      nop.i           0
 }
-
 { .mfi
-(p0)     setf.exp            sinh_FR_N_temp1 = r39            
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS2_neg  = fF_neg,fT2_neg,f0
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven       = sinh_FR_Rsq, sinh_FR_peven_temp2, f0     
-         nop.i 999
+      nop.m           0
+      fma.s1          fP     = fRsq, fP5432, fR
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd_temp2 = sinh_FR_Rsq,        sinh_FR_podd_temp1, sinh_FR_A1  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS   = fS1,fS2,f0
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     setf.exp            f9  = r32                              
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fms.s1          fP_neg     = fRsq, fP5432_neg, fR
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd       = sinh_FR_podd_temp2, sinh_FR_Rcub,       sinh_FR_R   
-         nop.i 999
+      nop.m           0
+      fma.s1          fS_neg   = fS1_neg,fS2_neg,f0
+      nop.i           0
 }
+;;
 
-// sinh_GR_mj contains the table offset for -j
-// sinh_GR_j  contains the table offset for +j
-// p6 is true when j <= 0
-
-{ .mlx
-(p0)     setf.exp            sinh_FR_N_temp2 = r40            
-(p0)     movl                r40 = 0x0000000000000020 ;;    
+{ .mfb
+      nop.m           0
+      fmpy.s0         fTmp = fLn2_by_128_lo, fLn2_by_128_lo // Force inexact
+(p14) br.cond.spnt    SINH_POSSIBLE_OVERFLOW
 }
+;;
 
 { .mfi
-(p0)     sub                 sinh_GR_mJ = r40,  r36           
-(p0)     fmerge.se           sinh_FR_spos    = sinh_FR_N_temp1, f1 
-(p0)     adds                sinh_GR_J  = 0x20, r36 ;;           
+      nop.m           0
+      fma.s1          fExp = fS, fP, fS
+      nop.i           0
 }
-
-{ .mii
-         nop.m 999
-(p0)     shl                  sinh_GR_mJ = sinh_GR_mJ, 5 ;;   
-(p0)     add                  sinh_AD_mJ = r37, sinh_GR_mJ ;; 
-}
-
-{ .mmi
-         nop.m 999
-(p0)     ldfe                 sinh_FR_Tmjhi = [sinh_AD_mJ],16                 
-(p0)     shl                  sinh_GR_J  = sinh_GR_J, 5 ;;    
-}
-
 { .mfi
-(p0)     ldfs                 sinh_FR_Tmjlo = [sinh_AD_mJ],16                 
-(p0)     fcmp.lt.unc.s1      p0,p7 = sinh_FR_X,f9                          
-(p0)     add                  sinh_AD_J  = r37, sinh_GR_J ;;  
-}
-
-{ .mmi
-(p0)     ldfe                 sinh_FR_Tjhi  = [sinh_AD_J],16 ;;                  
-(p0)     ldfs                 sinh_FR_Tjlo  = [sinh_AD_J],16                  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fExp_neg = fS_neg, fP_neg, fS_neg
+      nop.i           0
 }
+;;
 
 { .mfb
-         nop.m 999
-(p0)     fmerge.se           sinh_FR_sneg    = sinh_FR_N_temp2, f1 
-(p7)     br.cond.spnt        L(SINH_BY_EXP) ;;                            
+      nop.m           0
+      fms.d.s0        f8 = fExp, f1, fExp_neg
+      br.ret.sptk     b0                  // Normal path exit
 }
+;;
 
+// Here if 0 < |x| < 0.25
+SINH_SMALL:
 { .mfi
-         nop.m 999
-         nop.f 999
-         nop.i 999 ;;
+      add             rAD_T1 = 0x1a0, rAD_TB1
+      fcmp.lt.s1      p7, p8 = fNormX, f0       // Test sign of x
+      cmp.gt          p6, p0 = -60, rExp_x      // Test |x| < 2^(-60)
 }
-
-// ******************************************************
-// If NOT branch to EXP
-// ******************************************************
-// Calculate S_hi and S_lo
-// sinh_FR_S_hi_temp = sinh_FR_sneg * sinh_FR_Tmjhi
-// sinh_FR_S_hi = sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi_temp
-// sinh_FR_S_hi = sinh_FR_spos * sinh_FR_Tjhi - (sinh_FR_sneg * sinh_FR_Tmjlo)
-
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_hi_temp = sinh_FR_sneg, sinh_FR_Tmjhi, f0   
-         nop.i 999 ;;
+      add             rAD_T2 = 0x1d0, rAD_TB1
+      nop.f           0
+      nop.i           0
 }
+;;
 
-{ .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_hi = sinh_FR_spos, sinh_FR_Tjhi,  sinh_FR_S_hi_temp              
-         nop.i 999
+{ .mmb
+      ldfe            fA6 = [rAD_T1],16
+      ldfe            fA5 = [rAD_T2],16
+(p6)  br.cond.spnt    SINH_VERY_SMALL           // Branch if |x| < 2^(-60)
 }
+;;
 
-// Calculate C_hi
-// sinh_FR_C_hi_temp1 = sinh_FR_sneg * sinh_FR_Tmjhi
-// sinh_FR_C_hi = sinh_FR_spos * sinh_FR_Tjhi + sinh_FR_C_hi_temp1
-
-{ .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_C_hi_temp1 = sinh_FR_sneg, sinh_FR_Tmjhi, f0                   
-         nop.i 999 ;;
+{ .mmi
+      ldfe            fA4 = [rAD_T1],16
+      ldfe            fA3 = [rAD_T2],16
+      nop.i           0
 }
+;;
 
-// sinh_FR_S_lo_temp1 =  sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi
-// sinh_FR_S_lo_temp2 = -sinh_FR_sneg * sinh_FR_Tmjlo + (sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi)
-// sinh_FR_S_lo_temp2 = -sinh_FR_sneg * sinh_FR_Tmjlo + (sinh_FR_S_lo_temp1              )
-
-{ .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_lo_temp1 =  sinh_FR_spos, sinh_FR_Tjhi,  sinh_FR_S_hi            
-         nop.i 999
+{ .mmi
+      ldfe            fA2 = [rAD_T1]
+      ldfe            fA1 = [rAD_T2]
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_C_hi       = sinh_FR_spos, sinh_FR_Tjhi, sinh_FR_C_hi_temp1    
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fX3 = fNormX, fXsq, f0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)    fnma.s1        sinh_FR_S_lo_temp2 = sinh_FR_sneg, sinh_FR_Tmjhi, sinh_FR_S_lo_temp1       
-         nop.i 999
+      nop.m           0
+      fma.s1          fX4 = fXsq, fXsq, f0
+      nop.i           0
 }
-
-// sinh_FR_S_lo_temp1 = sinh_FR_sneg * sinh_FR_Tmjlo
-// sinh_FR_S_lo_temp3 = sinh_FR_spos * sinh_FR_Tjlo - sinh_FR_S_lo_temp1
-// sinh_FR_S_lo_temp3 = sinh_FR_spos * sinh_FR_Tjlo -(sinh_FR_sneg * sinh_FR_Tmjlo)
-// sinh_FR_S_lo = sinh_FR_S_lo_temp3 + sinh_FR_S_lo_temp2
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_lo_temp1 =  sinh_FR_sneg, sinh_FR_Tmjlo, f0                  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA65 = fXsq, fA6, fA5
+      nop.i           0
 }
-
-/////////// BUG FIX fma to fms -TK
 { .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_lo_temp3 =  sinh_FR_spos, sinh_FR_Tjlo,  sinh_FR_S_lo_temp1  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA43 = fXsq, fA4, fA3
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_lo       =  sinh_FR_S_lo_temp3, f1,   sinh_FR_S_lo_temp2     
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA21 = fXsq, fA2, fA1
+      nop.i           0
 }
-
-// Y_hi = S_hi 
-// Y_lo = C_hi*p_odd + (S_hi*p_even + S_lo)
-// sinh_FR_Y_lo_temp = sinh_FR_S_hi * sinh_FR_peven + sinh_FR_S_lo
-// sinh_FR_Y_lo      = sinh_FR_C_hi * sinh_FR_podd + sinh_FR_Y_lo_temp
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_Y_lo_temp  = sinh_FR_S_hi, sinh_FR_peven, sinh_FR_S_lo           
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA6543 = fX4, fA65, fA43
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_Y_lo       =  sinh_FR_C_hi, sinh_FR_podd, sinh_FR_Y_lo_temp      
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA654321 = fX4, fA6543, fA21
+      nop.i           0
 }
-
-// sinh_FR_SINH = Y_hi + Y_lo
-// f8 = answer = sinh_FR_SGNX * sinh_FR_SINH
+;;
 
 // Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999
+      nop.m           0
+      fmpy.s0         fTmp = fA6, fA6
+      nop.i           0
 }
-{ .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_SINH       =  sinh_FR_S_hi, f1, sinh_FR_Y_lo    
-         nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      fma.d.s0        f8 = fA654321, fX3, fNormX
+      br.ret.sptk     b0                // Exit if 2^-60 < |x| < 0.25
 }
+;;
 
+SINH_VERY_SMALL:
+// Here if 0 < |x| < 2^-60
+// Compute result by x + sgn(x)*x^2 to get properly rounded result
+.pred.rel "mutex",p7,p8
+{ .mfi
+      nop.m           0
+(p7)  fnma.d.s0       f8 = fNormX, fNormX, fNormX // If x<0 result ~ x-x^2
+      nop.i           0
+}
 { .mfb
-         nop.m 999
-(p0)    fma.d.s0       f8 = sinh_FR_SGNX, sinh_FR_SINH,f0                      
-(p0)    br.ret.sptk     b0 ;;                          
+      nop.m           0
+(p8)  fma.d.s0        f8 = fNormX, fNormX, fNormX // If x>0 result ~ x+x^2
+      br.ret.sptk     b0                          // Exit if |x| < 2^-60
 }
+;;
 
 
-L(SINH_BY_EXP): 
+SINH_POSSIBLE_OVERFLOW:
 
-// When p7 is true,  we know that an overflow is not going to happen
-// When p7 is false, we must check for possible overflow
-// p7 is the over_SAFE flag
-// Y_hi = Tjhi
-// Y_lo = Tjhi * (p_odd + p_even) +Tjlo
-// Scale = sign * 2^(N-1)
-// sinh_FR_Y_lo =  sinh_FR_Tjhi * (sinh_FR_peven + sinh_FR_podd)
-// sinh_FR_Y_lo =  sinh_FR_Tjhi * (sinh_FR_Y_lo_temp      )
+// Here if fMAX_DBL_NORM_ARG < |x| < fMIN_DBL_OFLOW_ARG
+// This cannot happen if input is a double, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-{ .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_Y_lo_temp =  sinh_FR_peven, f1, sinh_FR_podd                   
-         nop.i 999
-}
-
-// Now we are in EXP. This is the only path where an overflow is possible
-// but not for certain. So this is the only path where over_SAFE has any use.
-// r34 still has N-1
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// There is a danger of double overflow            if N-1 > 0x3fe = 1022
-{ .mlx
-         nop.m 999
-(p0)   movl                r32          = 0x00000000000003fe ;;                       
-}
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest double, then we have
+// overflow
 
 { .mfi
-(p0)   cmp.gt.unc          p0,p7        = r34, r32                                 
-(p0)   fmerge.s          sinh_FR_SCALE     = sinh_FR_SGNX, sinh_FR_spos                         
-         nop.i 999 ;;
-}
-
-{ .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_Y_lo      =  sinh_FR_Tjhi,  sinh_FR_Y_lo_temp, sinh_FR_Tjlo    
-         nop.i 999 ;;
+      mov             rGt_ln  = 0x103ff // Exponent for largest dbl + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
+;;
 
-// f8 = answer = scale * (Y_hi + Y_lo)
 { .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_SINH_temp = sinh_FR_Y_lo,  f1, sinh_FR_Tjhi       
-         nop.i 999 ;;
+      setf.exp        fGt_pln = rGt_ln  // Create largest double + 1 ulp
+      fma.d.s2        fWre_urm_f8 = fS, fP, fS    // Result with wre set
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)   fma.d.s0          f44          = sinh_FR_SCALE,  sinh_FR_SINH_temp, f0      
-         nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
+;;
 
-// Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p7)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
+;;
 
-// If over_SAFE is set, return
 { .mfb
-       nop.m 999
-(p7)   fmerge.s            f8 = f44,f44                                            
-(p7)   br.ret.sptk     b0 ;;                          
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    SINH_CERTAIN_OVERFLOW // Branch if overflow
 }
+;;
 
-// Else see if we overflowed
-// S0 user supplied status
-// S2 user supplied status + WRE + TD  (Overflows)
-// If WRE is set then an overflow will not occur in EXP.
-// The input value that would cause a register (WRE) value to overflow is about 2^15
-// and this input would go into the HUGE path.
-// Answer with WRE is in f43.
-
-{ .mfi
-         nop.m 999
-(p0)   fsetc.s2            0x7F,0x42                                               
-         nop.i 999;;
+{ .mfb
+      nop.m           0
+      fma.d.s0        f8 = fS, fP, fS
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
+;;
 
+SINH_CERTAIN_OVERFLOW:
 { .mfi
-         nop.m 999
-(p0)   fma.d.s2            f43  = sinh_FR_SCALE,  sinh_FR_SINH_temp, f0                      
-         nop.i 999 ;;
-}
-
-// 103FF => 103FF -FFFF = 400(true)
-// 400 + 3FF = 7FF, which is 1 more that the exponent of the largest
-// double (7FE). So 0 103FF 8000000000000000  is one ulp more than
-// largest double in register bias
-// Now  set p8 if the answer with WRE is greater than or equal this value
-// Also set p9 if the answer with WRE is less than or equal to negative this value
-
-{ .mlx
-         nop.m 999
-(p0)   movl                r32     = 0x000000000103FF ;;                              
+      sub             rTmp = rExp_mask, r0, 1
+      fcmp.lt.s1      p6, p7 = fNormX, f0    // Test for x < 0
+      nop.i           0
 }
+;;
 
 { .mmf
-         nop.m 999
-(p0)   setf.exp            f41 = r32                                               
-(p0)   fsetc.s2            0x7F,0x40 ;;                                               
-}
-
-{ .mfi
-         nop.m 999
-(p0)   fcmp.ge.unc.s1 p8, p0 =  f43, f41                                           
-         nop.i 999
+      alloc           r32=ar.pfs,1,4,4,0
+      setf.exp        fTmp = rTmp
+      fmerge.s        FR_X = f8,f8
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)   fmerge.ns           f42 = f41, f41                                          
-         nop.i 999 ;;
-}
-
-// The error tag for overflow is 127
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p8)   mov                 r47 = 127 ;;                                               
+      mov             GR_Parameter_TAG = 127
+(p6)  fnma.d.s0       FR_RESULT = fTmp, fTmp, f0    // Set I,O and -INF result
+      nop.i           0
 }
-
 { .mfb
-         nop.m 999
-(p0)   fcmp.le.unc.s1      p9, p0 =  f43, f42                                      
-(p8)   br.cond.spnt L(SINH_ERROR_SUPPORT) ;;
-}
-
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p9)   mov                 r47 = 127                                               
-}
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p9)   br.cond.spnt L(SINH_ERROR_SUPPORT) ;;
-}
-
-// Dummy multiply to generate inexact
-{ .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+(p7)  fma.d.s0        FR_RESULT = fTmp, fTmp, f0    // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
+// Here if x unorm
+SINH_UNORM:
 { .mfb
-         nop.m 999
-(p0)   fmerge.s            f8 = f44,f44                                            
-(p0)   br.ret.sptk     b0 ;;                          
-}
-
-L(SINH_HUGE): 
-
-// for SINH_HUGE, put 24000 in exponent; take sign from input; add 1
-// SAFE: SAFE is always 0 for HUGE
-
-{ .mlx
-         nop.m 999
-(p0)   movl                r32 = 0x0000000000015dbf ;;                                
+      getf.exp        rSignexp_x = fNormX    // Must recompute if x unorm
+      fcmp.eq.s0      p6, p0 = f8, f0        // Set D flag
+      br.cond.sptk    SINH_COMMON
 }
+;;
 
-{ .mfi
-(p0)   setf.exp            f9  = r32                                               
-         nop.f 999
-         nop.i 999 ;;
-}
+GLOBAL_IEEE754_END(sinh)
 
-{ .mfi
-         nop.m 999
-(p0)   fma.s1              sinh_FR_signed_hi_lo = sinh_FR_SGNX, f9, f1                       
-         nop.i 999 ;;
-}
 
-{ .mfi
-         nop.m 999
-(p0)   fma.d.s0            f44 = sinh_FR_signed_hi_lo,  f9, f0                          
-(p0)   mov                 r47 = 127                                               
-}
-.endp sinh
-ASM_SIZE_DIRECTIVE(sinh)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__ieee754_sinh)
-#endif
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
-
-.proc __libm_error_region
-__libm_error_region:
-L(SINH_ERROR_SUPPORT):
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-
-// (1)
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
         nop.f 0
@@ -1271,39 +862,32 @@ L(SINH_ERROR_SUPPORT):
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp=-64,sp                           // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP=gp                       // Save gp
 };;
-
-
-// (2)
 { .mmi
-        stfd [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+        stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0=b0                       // Save b0
 };;
-
 .body
-// (3)
 { .mib
-        stfd [GR_Parameter_X] = f8                     // STORE Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y   // Parameter 3 address
-        nop.b 0                            
+        stfd [GR_Parameter_X] = FR_X            // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = f44                    // STORE Parameter 3 on stack
+        stfd [GR_Parameter_Y] = FR_RESULT       // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#          // Call error handling function
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
-
-// (4)
 { .mmi
         ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
@@ -1316,8 +900,6 @@ L(SINH_ERROR_SUPPORT):
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
+LOCAL_LIBM_END(__libm_error_region)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_sinhf.S b/sysdeps/ia64/fpu/e_sinhf.S
index d5aa2dca16..6d808cb478 100644
--- a/sysdeps/ia64/fpu/e_sinhf.S
+++ b/sysdeps/ia64/fpu/e_sinhf.S
@@ -1,10 +1,10 @@
 .file "sinhf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1305 +20,729 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+
 // History
-//==============================================================
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+//*********************************************************************
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
 // 10/12/00 Update to set denormal operand and underflow flags
-// 1/22/01  Fixed to set inexact flag for small args.
+// 01/22/01 Fixed to set inexact flag for small args.
+// 05/02/01 Reworked to improve speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 11/20/02 Improved algorithm based on expf
+// 03/31/05 Reformatted delimiters between data tables
 //
 // API
-//==============================================================
-// float = sinhf(float)
-// input  floating point f8
-// output floating point f8
-//
-// Registers used
-//==============================================================
-// general registers: 
-// r32 -> r47
-// predicate registers used:
-// p6 p7 p8 p9
-// floating-point registers used:
-// f9 -> f15; f32 -> f45; 
-// f8 has input, then output
+//*********************************************************************
+// float sinhf(float)
 //
 // Overview of operation
-//==============================================================
-// There are four paths
-// 1. |x| < 0.25        SINH_BY_POLY
-// 2. |x| < 32          SINH_BY_TBL
-// 3. |x| < 2^14        SINH_BY_EXP
-// 4. |x_ >= 2^14       SINH_HUGE
-//
-// For double extended we get infinity for x >= 400c b174 ddc0 31ae c0ea
-//                                           >= 1.0110001.... x 2^13
-//                                           >= 11357.2166
+//*********************************************************************
+// Case 1:  0 < |x| < 2^-60
+//  Result = x, computed by x+sgn(x)*x^2) to handle flags and rounding
 //
-// But for double we get infinity for x >= 408633ce8fb9f87e
-//                                      >= 1.0110...x 2^9
-//                                      >= +7.10476e+002
+// Case 2:  2^-60 < |x| < 0.25
+//  Evaluate sinh(x) by a 9th order polynomial
+//  Care is take for the order of multiplication; and A2 is not exactly 1/5!,
+//  A3 is not exactly 1/7!, etc.
+//  sinh(x) = x + (A1*x^3 + A2*x^5 + A3*x^7 + A4*x^9)
 //
-// And for single we get infinity for x >= 42b3a496
-//                                      >= 1.0110... 2^6
-//                                      >= 89.8215
+// Case 3:  0.25 < |x| < 89.41598
+//  Algorithm is based on the identity sinh(x) = ( exp(x) - exp(-x) ) / 2.
+//  The algorithm for exp is described as below.  There are a number of
+//  economies from evaluating both exp(x) and exp(-x).  Although we
+//  are evaluating both quantities, only where the quantities diverge do we
+//  duplicate the computations.  The basic algorithm for exp(x) is described
+//  below.
 //
-// SAFE: If there is danger of overflow set SAFE to 0
-//       NOT implemented: if there is danger of underflow, set SAFE to 0
-// SAFE for all paths listed below
-//
-// 1. SINH_BY_POLY
-// ===============
-// If |x| is less than the tiny threshold, then clear SAFE 
-// For double, the tiny threshold is -1022 = -0x3fe => -3fe + ffff = fc01
-//             register-biased, this is fc01
-// For single, the tiny threshold is -126  = -7e    => -7e  + ffff = ff81
-// If |x| < tiny threshold, set SAFE = 0
-//
-// 2. SINH_BY_TBL
-// =============
-// SAFE: SAFE is always 1 for TBL; 
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 64/log2
+//  NJ = int(w)
+//  x = NJ*log2/64 + R
+
+//  NJ = 64*n + j
+//  x = n*log2 + (log2/64)*j + R
 //
-// 3. SINH_BY_EXP
-// ==============
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// r34 has N-1; 16382 is in register biased form, 0x13ffd
-// There is danger of double overflow if N-1 > 0x3fe
-//                       in register biased form, 0x103fd
-// Analagously, there is danger of single overflow if N-1 > 0x7e
-//                       in register biased form, 0x1007d
-// SAFE: If there is danger of overflow set SAFE to 0
+//  So, exp(x) = 2^n * 2^(j/64)* exp(R)
 //
-// 4. SINH_HUGE
-// ============
-// SAFE: SAFE is always 0 for HUGE
+//  T =  2^n * 2^(j/64)
+//       Construct 2^n
+//       Get 2^(j/64) table
+//           actually all the entries of 2^(j/64) table are stored in DP and
+//           with exponent bits set to 0 -> multiplication on 2^n can be
+//           performed by doing logical "or" operation with bits presenting 2^n
+
+//  exp(R) = 1 + (exp(R) - 1)
+//  P = exp(R) - 1 approximated by Taylor series of 3rd degree
+//      P = A3*R^3 + A2*R^2 + R, A3 = 1/6, A2 = 1/2
 //
 
-#include "libm_support.h"
-
-// Assembly macros
-//==============================================================
-sinh_FR_X            = f44
-sinh_FR_X2           = f9
-sinh_FR_X4           = f10
-sinh_FR_SGNX         = f40
-sinh_FR_all_ones     = f45
-sinh_FR_tmp          = f42
-
-sinh_FR_Inv_log2by64 = f9
-sinh_FR_log2by64_lo  = f11
-sinh_FR_log2by64_hi  = f10
-
-sinh_FR_A1           = f9
-sinh_FR_A2           = f10
-sinh_FR_A3           = f11
-
-sinh_FR_Rcub         = f12
-sinh_FR_M_temp       = f13
-sinh_FR_R_temp       = f13
-sinh_FR_Rsq          = f13
-sinh_FR_R            = f14
-
-sinh_FR_M            = f38
-
-sinh_FR_B1           = f15
-sinh_FR_B2           = f32
-sinh_FR_B3           = f33
+//  The final result is reconstructed as follows
+//  exp(x) = T + T*P
 
-sinh_FR_peven_temp1  = f34
-sinh_FR_peven_temp2  = f35
-sinh_FR_peven        = f36
+// Special values
+//*********************************************************************
+// sinhf(+0)    = +0
+// sinhf(-0)    = -0
 
-sinh_FR_podd_temp1   = f34
-sinh_FR_podd_temp2   = f35
-sinh_FR_podd         = f37
+// sinhf(+qnan) = +qnan
+// sinhf(-qnan) = -qnan
+// sinhf(+snan) = +qnan
+// sinhf(-snan) = -qnan
 
-sinh_FR_poly_podd_temp1    =  f11 
-sinh_FR_poly_podd_temp2    =  f13
-sinh_FR_poly_peven_temp1   =  f11
-sinh_FR_poly_peven_temp2   =  f13
+// sinhf(-inf)  = -inf
+// sinhf(+inf)  = +inf
 
-sinh_FR_J_temp       = f9
-sinh_FR_J            = f10
-
-sinh_FR_Mmj          = f39
-
-sinh_FR_N_temp1      = f11
-sinh_FR_N_temp2      = f12
-sinh_FR_N            = f13
-
-sinh_FR_spos         = f14
-sinh_FR_sneg         = f15
-
-sinh_FR_Tjhi         = f32
-sinh_FR_Tjlo         = f33
-sinh_FR_Tmjhi        = f34
-sinh_FR_Tmjlo        = f35
-
-sinh_GR_mJ           = r35
-sinh_GR_J            = r36
-
-sinh_AD_mJ           = r38
-sinh_AD_J            = r39
-sinh_GR_all_ones     = r40
-
-sinh_FR_S_hi         = f9
-sinh_FR_S_hi_temp    = f10
-sinh_FR_S_lo_temp1   = f11 
-sinh_FR_S_lo_temp2   = f12 
-sinh_FR_S_lo_temp3   = f13 
-
-sinh_FR_S_lo         = f38
-sinh_FR_C_hi         = f39
-
-sinh_FR_C_hi_temp1   = f10
-sinh_FR_Y_hi         = f11 
-sinh_FR_Y_lo_temp    = f12 
-sinh_FR_Y_lo         = f13 
-sinh_FR_SINH         = f9
-
-sinh_FR_P1           = f14
-sinh_FR_P2           = f15
-sinh_FR_P3           = f32
-sinh_FR_P4           = f33
-sinh_FR_P5           = f34
-sinh_FR_P6           = f35
-
-sinh_FR_TINY_THRESH  = f9
-
-sinh_FR_SINH_temp    = f10
-sinh_FR_SCALE        = f11 
-
-sinh_FR_signed_hi_lo = f10
-
-
-GR_SAVE_PFS          = r41
-GR_SAVE_B0           = r42
-GR_SAVE_GP           = r43
+// Overflow and Underflow
+//*********************************************************************
+// sinhf(x) = largest single normal when
+//     x = 89.41598 = 0x42b2d4fc
+//
+// Underflow is handled as described in case 1 above
 
-GR_Parameter_X       = r44
-GR_Parameter_Y       = r45
-GR_Parameter_RESULT  = r46
+// Registers used
+//*********************************************************************
+// Floating Point registers used:
+// f8 input, output
+// f6,f7, f9 -> f15,  f32 -> f45
 
-// Data tables
-//==============================================================
+// General registers used:
+// r2, r3, r16 -> r38
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// Predicate registers used:
+// p6 -> p15
 
+// Assembly macros
+//*********************************************************************
+// integer registers used
+// scratch
+rNJ                   = r2
+rNJ_neg               = r3
+
+rJ_neg                = r16
+rN_neg                = r17
+rSignexp_x            = r18
+rExp_x                = r18
+rExp_mask             = r19
+rExp_bias             = r20
+rAd1                  = r21
+rAd2                  = r22
+rJ                    = r23
+rN                    = r24
+rTblAddr              = r25
+rA3                   = r26
+rExpHalf              = r27
+rLn2Div64             = r28
+rGt_ln                = r29
+r17ones_m1            = r29
+rRightShifter         = r30
+rJ_mask               = r30
+r64DivLn2             = r31
+rN_mask               = r31
+// stacked
+GR_SAVE_PFS           = r32
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_Parameter_X        = r35
+GR_Parameter_Y        = r36
+GR_Parameter_RESULT   = r37
+GR_Parameter_TAG      = r38
+
+// floating point registers used
+FR_X                  = f10
+FR_Y                  = f1
+FR_RESULT             = f8
+// scratch
+fRightShifter         = f6
+f64DivLn2             = f7
+fNormX                = f9
+fNint                 = f10
+fN                    = f11
+fR                    = f12
+fLn2Div64             = f13
+fA2                   = f14
+fA3                   = f15
+// stacked
+fP                    = f32
+fT                    = f33
+fMIN_SGL_OFLOW_ARG    = f34
+fMAX_SGL_NORM_ARG     = f35
+fRSqr                 = f36
+fA1                   = f37
+fA21                  = f37
+fA4                   = f38
+fA43                  = f38
+fA4321                = f38
+fX4                   = f39
+fTmp                  = f39
+fGt_pln               = f39
+fWre_urm_f8           = f40
+fXsq                  = f40
+fP_neg                = f41
+fX3                   = f41
+fT_neg                = f42
+fExp                  = f43
+fExp_neg              = f44
+fAbsX                 = f45
+
+
+RODATA
 .align 16
-double_sinh_arg_reduction:
-ASM_TYPE_DIRECTIVE(double_sinh_arg_reduction,@object)
-   data8 0xB8AA3B295C17F0BC, 0x00004005
-   data8 0xB17217F7D1000000, 0x00003FF8
-   data8 0xCF79ABC9E3B39804, 0x00003FD0
-ASM_SIZE_DIRECTIVE(double_sinh_arg_reduction)
-
-double_sinh_p_table:
-ASM_TYPE_DIRECTIVE(double_sinh_p_table,@object)
-   data8 0xAAAAAAAAAAAAAAAB, 0x00003FFC
-   data8 0x8888888888888412, 0x00003FF8
-   data8 0xD00D00D00D4D39F2, 0x00003FF2
-   data8 0xB8EF1D28926D8891, 0x00003FEC
-   data8 0xD732377688025BE9, 0x00003FE5
-   data8 0xB08AF9AE78C1239F, 0x00003FDE
-ASM_SIZE_DIRECTIVE(double_sinh_p_table)
-
-double_sinh_ab_table:
-ASM_TYPE_DIRECTIVE(double_sinh_ab_table,@object)
-   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC
-   data8 0x88888888884ECDD5, 0x00003FF8
-   data8 0xD00D0C6DCC26A86B, 0x00003FF2
-   data8 0x8000000000000002, 0x00003FFE
-   data8 0xAAAAAAAAAA402C77, 0x00003FFA
-   data8 0xB60B6CC96BDB144D, 0x00003FF5
-ASM_SIZE_DIRECTIVE(double_sinh_ab_table)
-
-double_sinh_j_table:
-ASM_TYPE_DIRECTIVE(double_sinh_j_table,@object)
-   data8 0xB504F333F9DE6484, 0x00003FFE, 0x1EB2FB13, 0x00000000
-   data8 0xB6FD91E328D17791, 0x00003FFE, 0x1CE2CBE2, 0x00000000
-   data8 0xB8FBAF4762FB9EE9, 0x00003FFE, 0x1DDC3CBC, 0x00000000
-   data8 0xBAFF5AB2133E45FB, 0x00003FFE, 0x1EE9AA34, 0x00000000
-   data8 0xBD08A39F580C36BF, 0x00003FFE, 0x9EAEFDC1, 0x00000000
-   data8 0xBF1799B67A731083, 0x00003FFE, 0x9DBF517B, 0x00000000
-   data8 0xC12C4CCA66709456, 0x00003FFE, 0x1EF88AFB, 0x00000000
-   data8 0xC346CCDA24976407, 0x00003FFE, 0x1E03B216, 0x00000000
-   data8 0xC5672A115506DADD, 0x00003FFE, 0x1E78AB43, 0x00000000
-   data8 0xC78D74C8ABB9B15D, 0x00003FFE, 0x9E7B1747, 0x00000000
-   data8 0xC9B9BD866E2F27A3, 0x00003FFE, 0x9EFE3C0E, 0x00000000
-   data8 0xCBEC14FEF2727C5D, 0x00003FFE, 0x9D36F837, 0x00000000
-   data8 0xCE248C151F8480E4, 0x00003FFE, 0x9DEE53E4, 0x00000000
-   data8 0xD06333DAEF2B2595, 0x00003FFE, 0x9E24AE8E, 0x00000000
-   data8 0xD2A81D91F12AE45A, 0x00003FFE, 0x1D912473, 0x00000000
-   data8 0xD4F35AABCFEDFA1F, 0x00003FFE, 0x1EB243BE, 0x00000000
-   data8 0xD744FCCAD69D6AF4, 0x00003FFE, 0x1E669A2F, 0x00000000
-   data8 0xD99D15C278AFD7B6, 0x00003FFE, 0x9BBC610A, 0x00000000
-   data8 0xDBFBB797DAF23755, 0x00003FFE, 0x1E761035, 0x00000000
-   data8 0xDE60F4825E0E9124, 0x00003FFE, 0x9E0BE175, 0x00000000
-   data8 0xE0CCDEEC2A94E111, 0x00003FFE, 0x1CCB12A1, 0x00000000
-   data8 0xE33F8972BE8A5A51, 0x00003FFE, 0x1D1BFE90, 0x00000000
-   data8 0xE5B906E77C8348A8, 0x00003FFE, 0x1DF2F47A, 0x00000000
-   data8 0xE8396A503C4BDC68, 0x00003FFE, 0x1EF22F22, 0x00000000
-   data8 0xEAC0C6E7DD24392F, 0x00003FFE, 0x9E3F4A29, 0x00000000
-   data8 0xED4F301ED9942B84, 0x00003FFE, 0x1EC01A5B, 0x00000000
-   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE, 0x1E8CAC3A, 0x00000000
-   data8 0xF281773C59FFB13A, 0x00003FFE, 0x9DBB3FAB, 0x00000000
-   data8 0xF5257D152486CC2C, 0x00003FFE, 0x1EF73A19, 0x00000000
-   data8 0xF7D0DF730AD13BB9, 0x00003FFE, 0x9BB795B5, 0x00000000
-   data8 0xFA83B2DB722A033A, 0x00003FFE, 0x1EF84B76, 0x00000000
-   data8 0xFD3E0C0CF486C175, 0x00003FFE, 0x9EF5818B, 0x00000000
-   data8 0x8000000000000000, 0x00003FFF, 0x00000000, 0x00000000
-   data8 0x8164D1F3BC030773, 0x00003FFF, 0x1F77CACA, 0x00000000
-   data8 0x82CD8698AC2BA1D7, 0x00003FFF, 0x1EF8A91D, 0x00000000
-   data8 0x843A28C3ACDE4046, 0x00003FFF, 0x1E57C976, 0x00000000
-   data8 0x85AAC367CC487B15, 0x00003FFF, 0x9EE8DA92, 0x00000000
-   data8 0x871F61969E8D1010, 0x00003FFF, 0x1EE85C9F, 0x00000000
-   data8 0x88980E8092DA8527, 0x00003FFF, 0x1F3BF1AF, 0x00000000
-   data8 0x8A14D575496EFD9A, 0x00003FFF, 0x1D80CA1E, 0x00000000
-   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF, 0x9D0373AF, 0x00000000
-   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF, 0x9F167097, 0x00000000
-   data8 0x8EA4398B45CD53C0, 0x00003FFF, 0x1EB70051, 0x00000000
-   data8 0x9031DC431466B1DC, 0x00003FFF, 0x1F6EB029, 0x00000000
-   data8 0x91C3D373AB11C336, 0x00003FFF, 0x1DFD6D8E, 0x00000000
-   data8 0x935A2B2F13E6E92C, 0x00003FFF, 0x9EB319B0, 0x00000000
-   data8 0x94F4EFA8FEF70961, 0x00003FFF, 0x1EBA2BEB, 0x00000000
-   data8 0x96942D3720185A00, 0x00003FFF, 0x1F11D537, 0x00000000
-   data8 0x9837F0518DB8A96F, 0x00003FFF, 0x1F0D5A46, 0x00000000
-   data8 0x99E0459320B7FA65, 0x00003FFF, 0x9E5E7BCA, 0x00000000
-   data8 0x9B8D39B9D54E5539, 0x00003FFF, 0x9F3AAFD1, 0x00000000
-   data8 0x9D3ED9A72CFFB751, 0x00003FFF, 0x9E86DACC, 0x00000000
-   data8 0x9EF5326091A111AE, 0x00003FFF, 0x9F3EDDC2, 0x00000000
-   data8 0xA0B0510FB9714FC2, 0x00003FFF, 0x1E496E3D, 0x00000000
-   data8 0xA27043030C496819, 0x00003FFF, 0x9F490BF6, 0x00000000
-   data8 0xA43515AE09E6809E, 0x00003FFF, 0x1DD1DB48, 0x00000000
-   data8 0xA5FED6A9B15138EA, 0x00003FFF, 0x1E65EBFB, 0x00000000
-   data8 0xA7CD93B4E965356A, 0x00003FFF, 0x9F427496, 0x00000000
-   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF, 0x1F283C4A, 0x00000000
-   data8 0xAB7A39B5A93ED337, 0x00003FFF, 0x1F4B0047, 0x00000000
-   data8 0xAD583EEA42A14AC6, 0x00003FFF, 0x1F130152, 0x00000000
-   data8 0xAF3B78AD690A4375, 0x00003FFF, 0x9E8367C0, 0x00000000
-   data8 0xB123F581D2AC2590, 0x00003FFF, 0x9F705F90, 0x00000000
-   data8 0xB311C412A9112489, 0x00003FFF, 0x1EFB3C53, 0x00000000
-   data8 0xB504F333F9DE6484, 0x00003FFF, 0x1F32FB13, 0x00000000
-ASM_SIZE_DIRECTIVE(double_sinh_j_table)
-
-.align 32
-.global sinhf#
-
-.section .text
-.proc  sinhf#
-.align 32
-
-sinhf: 
-#ifdef _LIBC
-.global __ieee754_sinhf
-.type __ieee754_sinhf,@function
-__ieee754_sinhf:
-#endif
-
-// X infinity or NAN?
-// Take invalid fault if enabled
 
-
-{ .mfi
-      alloc r32 = ar.pfs,0,12,4,0                  
-(p0)     fclass.m.unc  p6,p0 = f8, 0xe3	//@qnan | @snan | @inf 
-         mov sinh_GR_all_ones = -1
-}
-;;
+LOCAL_OBJECT_START(_sinhf_table)
+data4 0x42b2d4fd         // Smallest single arg to overflow single result
+data4 0x42b2d4fc         // Largest single arg to give normal single result
+data4 0x00000000         // pad
+data4 0x00000000         // pad
+//
+// 2^(j/64) table, j goes from 0 to 63
+data8 0x0000000000000000 // 2^(0/64)
+data8 0x00002C9A3E778061 // 2^(1/64)
+data8 0x000059B0D3158574 // 2^(2/64)
+data8 0x0000874518759BC8 // 2^(3/64)
+data8 0x0000B5586CF9890F // 2^(4/64)
+data8 0x0000E3EC32D3D1A2 // 2^(5/64)
+data8 0x00011301D0125B51 // 2^(6/64)
+data8 0x0001429AAEA92DE0 // 2^(7/64)
+data8 0x000172B83C7D517B // 2^(8/64)
+data8 0x0001A35BEB6FCB75 // 2^(9/64)
+data8 0x0001D4873168B9AA // 2^(10/64)
+data8 0x0002063B88628CD6 // 2^(11/64)
+data8 0x0002387A6E756238 // 2^(12/64)
+data8 0x00026B4565E27CDD // 2^(13/64)
+data8 0x00029E9DF51FDEE1 // 2^(14/64)
+data8 0x0002D285A6E4030B // 2^(15/64)
+data8 0x000306FE0A31B715 // 2^(16/64)
+data8 0x00033C08B26416FF // 2^(17/64)
+data8 0x000371A7373AA9CB // 2^(18/64)
+data8 0x0003A7DB34E59FF7 // 2^(19/64)
+data8 0x0003DEA64C123422 // 2^(20/64)
+data8 0x0004160A21F72E2A // 2^(21/64)
+data8 0x00044E086061892D // 2^(22/64)
+data8 0x000486A2B5C13CD0 // 2^(23/64)
+data8 0x0004BFDAD5362A27 // 2^(24/64)
+data8 0x0004F9B2769D2CA7 // 2^(25/64)
+data8 0x0005342B569D4F82 // 2^(26/64)
+data8 0x00056F4736B527DA // 2^(27/64)
+data8 0x0005AB07DD485429 // 2^(28/64)
+data8 0x0005E76F15AD2148 // 2^(29/64)
+data8 0x0006247EB03A5585 // 2^(30/64)
+data8 0x0006623882552225 // 2^(31/64)
+data8 0x0006A09E667F3BCD // 2^(32/64)
+data8 0x0006DFB23C651A2F // 2^(33/64)
+data8 0x00071F75E8EC5F74 // 2^(34/64)
+data8 0x00075FEB564267C9 // 2^(35/64)
+data8 0x0007A11473EB0187 // 2^(36/64)
+data8 0x0007E2F336CF4E62 // 2^(37/64)
+data8 0x00082589994CCE13 // 2^(38/64)
+data8 0x000868D99B4492ED // 2^(39/64)
+data8 0x0008ACE5422AA0DB // 2^(40/64)
+data8 0x0008F1AE99157736 // 2^(41/64)
+data8 0x00093737B0CDC5E5 // 2^(42/64)
+data8 0x00097D829FDE4E50 // 2^(43/64)
+data8 0x0009C49182A3F090 // 2^(44/64)
+data8 0x000A0C667B5DE565 // 2^(45/64)
+data8 0x000A5503B23E255D // 2^(46/64)
+data8 0x000A9E6B5579FDBF // 2^(47/64)
+data8 0x000AE89F995AD3AD // 2^(48/64)
+data8 0x000B33A2B84F15FB // 2^(49/64)
+data8 0x000B7F76F2FB5E47 // 2^(50/64)
+data8 0x000BCC1E904BC1D2 // 2^(51/64)
+data8 0x000C199BDD85529C // 2^(52/64)
+data8 0x000C67F12E57D14B // 2^(53/64)
+data8 0x000CB720DCEF9069 // 2^(54/64)
+data8 0x000D072D4A07897C // 2^(55/64)
+data8 0x000D5818DCFBA487 // 2^(56/64)
+data8 0x000DA9E603DB3285 // 2^(57/64)
+data8 0x000DFC97337B9B5F // 2^(58/64)
+data8 0x000E502EE78B3FF6 // 2^(59/64)
+data8 0x000EA4AFA2A490DA // 2^(60/64)
+data8 0x000EFA1BEE615A27 // 2^(61/64)
+data8 0x000F50765B6E4540 // 2^(62/64)
+data8 0x000FA7C1819E90D8 // 2^(63/64)
+LOCAL_OBJECT_END(_sinhf_table)
+
+LOCAL_OBJECT_START(sinh_p_table)
+data8 0x3ec749d84bc96d7d // A4
+data8 0x3f2a0168d09557cf // A3
+data8 0x3f811111326ed15a // A2
+data8 0x3fc55555552ed1e2 // A1
+LOCAL_OBJECT_END(sinh_p_table)
 
 
-{ .mfb
-         nop.m 999
-(p6)     fma.s.s0   f8 = f8,f1,f8               
-(p6)     br.ret.spnt     b0 ;;                          
-}
+.section .text
+GLOBAL_IEEE754_ENTRY(sinhf)
 
-// Put 0.25 in f9; p6 true if x < 0.25
-// Make constant that will generate inexact when squared
 { .mlx
-         setf.sig sinh_FR_all_ones = sinh_GR_all_ones 
-(p0)     movl            r32 = 0x000000000000fffd ;;         
-}
-
-{ .mfi
-(p0)     setf.exp        f9 = r32                         
-(p0)     fclass.m.unc  p7,p0 = f8, 0x07	//@zero
-         nop.i 999 ;;
-}
-
-{ .mfb
-         nop.m 999
-(p0)     fmerge.s      sinh_FR_X    = f0,f8             
-(p7)     br.ret.spnt     b0 ;;                          
+      getf.exp        rSignexp_x = f8  // Must recompute if x unorm
+      movl            r64DivLn2 = 0x40571547652B82FE // 64/ln(2)
 }
-
-// Identify denormal operands.
-{ .mfi
-         nop.m 999
-         fclass.m.unc  p10,p0 = f8, 0x09        //  + denorm
-         nop.i 999
-};;
-{ .mfi
-         nop.m 999
-         fclass.m.unc  p11,p0 = f8, 0x0a        //  - denorm
-         nop.i 999 
-}
-
-{ .mfi
-         nop.m 999
-(p0)     fmerge.s      sinh_FR_SGNX = f8,f1             
-         nop.i 999 ;;
-}
-
-{ .mfi
-         nop.m 999
-(p0)     fcmp.lt.unc.s1  p0,p7 = sinh_FR_X,f9             
-         nop.i 999 ;;
-}
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p7)     br.cond.sptk    L(SINH_BY_TBL) ;;                      
-}
-
-
-L(SINH_BY_POLY): 
-
-// POLY cannot overflow so there is no need to call __libm_error_support
-// Set tiny_SAFE (p7) to 1(0) if answer is not tiny 
-// Currently we do not use tiny_SAFE. So the setting of tiny_SAFE is
-// commented out.
-//(p0)     movl            r32            = 0x000000000000fc01           
-//(p0)     setf.exp        f10            = r32                         
-//(p0)     fcmp.lt.unc.s1  p6,p7          = f8,f10                     
-// Here is essentially the algorithm for SINH_BY_POLY. Care is take for the order 
-// of multiplication; and P_1 is not exactly 1/3!, P_2 is not exactly 1/5!, etc.
-// Note that ax = |x|
-// sinh(x) = sign * (series(e^x) - series(e^-x))/2
-//         = sign * (ax + ax^3/3! + ax^5/5! + ax^7/7! + ax^9/9! + ax^11/11! + ax^13/13!)
-//         = sign * (ax   + ax * ( ax^2 * (1/3! + ax^4 * (1/7! + ax^4*1/11!)) )
-//                        + ax * ( ax^4 * (1/5! + ax^4 * (1/9! + ax^4*1/13!)) ) )
-//         = sign * (ax   + ax*p_odd + (ax*p_even))
-//         = sign * (ax   + Y_lo)
-// sinh(x) = sign * (Y_hi + Y_lo)
-// Get the values of P_x from the table
-{ .mfb
-(p0)  addl           r34   = @ltoff(double_sinh_p_table), gp
-(p10) fma.s.s0       f8 =  f8,f8,f8
-(p10) br.ret.spnt    b0
-}
-;;
-
-{ .mfb
-      ld8 r34 = [r34]
-(p11) fnma.s.s0      f8 =  f8,f8,f8
-(p11) br.ret.spnt    b0
+{ .mlx
+      addl            rTblAddr = @ltoff(_sinhf_table),gp
+      movl            rRightShifter = 0x43E8000000000000 // DP Right Shifter
 }
 ;;
 
-// Calculate sinh_FR_X2 = ax*ax and sinh_FR_X4 = ax*ax*ax*ax
-{ .mmf
-         nop.m 999
-(p0)     ldfe            sinh_FR_P1 = [r34],16                 
-(p0)     fma.s1        sinh_FR_X2 = sinh_FR_X, sinh_FR_X, f0 ;;           
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_P2 = [r34],16 ;;                 
-(p0)     ldfe            sinh_FR_P3 = [r34],16                 
-         nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_P4 = [r34],16 ;;                 
-(p0)     ldfe            sinh_FR_P5 = [r34],16                 
-         nop.i 999 ;;
-}
-
-{ .mfi
-(p0)     ldfe            sinh_FR_P6 = [r34],16                 
-(p0)     fma.s1        sinh_FR_X4 = sinh_FR_X2, sinh_FR_X2, f0         
-         nop.i 999 ;;
-}
-
-// Calculate sinh_FR_podd = p_odd and sinh_FR_peven = p_even 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_podd_temp1 = sinh_FR_X4, sinh_FR_P5, sinh_FR_P3                
-         nop.i 999 ;;
+      // point to the beginning of the table
+      ld8             rTblAddr = [rTblAddr]
+      fclass.m        p6, p0 = f8, 0x0b   // Test for x=unorm
+      addl            rA3 = 0x3E2AA, r0   // high bits of 1.0/6.0 rounded to SP
 }
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_podd_temp2 = sinh_FR_X4, sinh_FR_poly_podd_temp1, sinh_FR_P1   
-         nop.i 999
+      nop.m           0
+      fnorm.s1        fNormX = f8 // normalized x
+      addl            rExpHalf = 0xFFFE, r0 // exponent of 1/2
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_peven_temp1 = sinh_FR_X4, sinh_FR_P6, sinh_FR_P4               
-         nop.i 999 ;;
+      setf.d          f64DivLn2 = r64DivLn2 // load 64/ln(2) to FP reg
+      fclass.m        p15, p0 = f8, 0x1e3   // test for NaT,NaN,Inf
+      nop.i           0
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_podd       = sinh_FR_X2, sinh_FR_poly_podd_temp2, f0           
-         nop.i 999
+{ .mlx
+      // load Right Shifter to FP reg
+      setf.d          fRightShifter = rRightShifter
+      movl            rLn2Div64 = 0x3F862E42FEFA39EF // DP ln(2)/64 in GR
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_peven_temp2 = sinh_FR_X4, sinh_FR_poly_peven_temp1, sinh_FR_P2 
-         nop.i 999 ;;
+      mov             rExp_mask = 0x1ffff
+      fcmp.eq.s1      p13, p0 = f0, f8 // test for x = 0.0
+      shl             rA3 = rA3, 12    // 0x3E2AA000, approx to 1.0/6.0 in SP
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_peven       = sinh_FR_X4, sinh_FR_poly_peven_temp2, f0         
-         nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    SINH_UNORM            // Branch if x=unorm
 }
+;;
 
-// Calculate sinh_FR_Y_lo = ax*p_odd + (ax*p_even)
+SINH_COMMON:
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_Y_lo_temp    = sinh_FR_X, sinh_FR_peven, f0                    
-         nop.i 999 ;;
+      setf.exp        fA2 = rExpHalf        // load A2 to FP reg
+      nop.f           0
+      mov             rExp_bias = 0xffff
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_Y_lo         = sinh_FR_X, sinh_FR_podd,  sinh_FR_Y_lo_temp          
-         nop.i 999 ;;
+{ .mfb
+      setf.d          fLn2Div64 = rLn2Div64 // load ln(2)/64 to FP reg
+(p15) fma.s.s0        f8 = f8, f1, f0       // result if x = NaT,NaN,Inf
+(p15) br.ret.spnt     b0                    // exit here if x = NaT,NaN,Inf
 }
+;;
 
-// Calculate sinh_FR_SINH = Y_hi + Y_lo. Note that ax = Y_hi
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_SINH        = sinh_FR_X, f1, sinh_FR_Y_lo                      
-         nop.i 999 ;;
+      // min overflow and max normal threshold
+      ldfps           fMIN_SGL_OFLOW_ARG, fMAX_SGL_NORM_ARG = [rTblAddr], 8
+      nop.f           0
+      and             rExp_x = rExp_mask, rSignexp_x // Biased exponent of x
 }
-// Dummy multiply to generate inexact
-{ .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999
-}
-
-// Calculate f8 = sign * (Y_hi + Y_lo)
-// Go to return
 { .mfb
-         nop.m 999
-(p0)     fma.s.s0        f8 = sinh_FR_SGNX,sinh_FR_SINH,f0                       
-(p0)     br.ret.sptk     b0 ;;                          
-}
-
-
-L(SINH_BY_TBL): 
-
-// Now that we are at TBL; so far all we know is that |x| >= 0.25.
-// The first two steps are the same for TBL and EXP, but if we are HUGE
-// we want to leave now. 
-// Double-extended:
-// Go to HUGE if |x| >= 2^14, 1000d (register-biased) is e = 14 (true)
-// Double
-// Go to HUGE if |x| >= 2^10, 10009 (register-biased) is e = 10 (true)
-// Single
-// Go to HUGE if |x| >= 2^7,  10006 (register-biased) is e =  7 (true)
-
-{ .mlx
-         nop.m 999
-(p0)     movl            r32 = 0x0000000000010006 ;;         
+      setf.s          fA3 = rA3                  // load A3 to FP reg
+      nop.f           0
+(p13) br.ret.spnt     b0                         // exit here if x=0.0, return x
 }
+;;
 
 { .mfi
-(p0)     setf.exp        f9 = r32                         
-         nop.f 999
-         nop.i 999 ;;
+      sub             rExp_x = rExp_x, rExp_bias // True exponent of x
+      fmerge.s        fAbsX = f0, fNormX         // Form |x|
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fcmp.ge.unc.s1  p6,p7 = sinh_FR_X,f9             
-         nop.i 999 ;;
+      nop.m           0
+      // x*(64/ln(2)) + Right Shifter
+      fma.s1          fNint = fNormX, f64DivLn2, fRightShifter
+      add             rTblAddr = 8, rTblAddr
 }
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p6)     br.cond.spnt    L(SINH_HUGE) ;;                        
-}
-
-// r32 = 1
-// r34 = N-1 
-// r35 = N
-// r36 = j
-// r37 = N+1
-
-// TBL can never overflow
-// sinh(x) = sinh(B+R)
-//         = sinh(B)cosh(R) + cosh(B)sinh(R)
-// 
-// ax = |x| = M*log2/64 + R
-// B = M*log2/64
-// M = 64*N + j 
-//   We will calcualte M and get N as (M-j)/64
-//   The division is a shift.
-// exp(B)  = exp(N*log2 + j*log2/64)
-//         = 2^N * 2^(j*log2/64)
-// sinh(B) = 1/2(e^B -e^-B)
-//         = 1/2(2^N * 2^(j*log2/64) - 2^-N * 2^(-j*log2/64)) 
-// sinh(B) = (2^(N-1) * 2^(j*log2/64) - 2^(-N-1) * 2^(-j*log2/64)) 
-// cosh(B) = (2^(N-1) * 2^(j*log2/64) + 2^(-N-1) * 2^(-j*log2/64)) 
-// 2^(j*log2/64) is stored as Tjhi + Tjlo , j= -32,....,32
-// Tjhi is double-extended (80-bit) and Tjlo is single(32-bit)
-// R = ax - M*log2/64
-// R = ax - M*log2_by_64_hi - M*log2_by_64_lo
-// exp(R) = 1 + R +R^2(1/2! + R(1/3! + R(1/4! + ... + R(1/n!)...)
-//        = 1 + p_odd + p_even
-//        where the p_even uses the A coefficients and the p_even uses the B coefficients
-// So sinh(R) = 1 + p_odd + p_even -(1 -p_odd -p_even)/2 = p_odd
-//    cosh(R) = 1 + p_even
-//    sinh(B) = S_hi + S_lo
-//    cosh(B) = C_hi
-// sinh(x) = sinh(B)cosh(R) + cosh(B)sinh(R)
-// ******************************************************
-// STEP 1 (TBL and EXP)
-// ******************************************************
-// Get the following constants. 
-// f9  = Inv_log2by64
-// f10 = log2by64_hi
-// f11 = log2by64_lo
-
-{ .mmi
-(p0)  adds                 r32 = 0x1,r0      
-(p0)  addl           r34   = @ltoff(double_sinh_arg_reduction), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+{ .mfb
+      cmp.gt          p7, p0 = -2, rExp_x        // Test |x| < 2^(-2)
+      fma.s1          fXsq = fNormX, fNormX, f0  // x*x for small path
+(p7)  br.cond.spnt    SINH_SMALL                 // Branch if 0 < |x| < 2^-2
 }
 ;;
 
-
-// We want 2^(N-1) and 2^(-N-1). So bias N-1 and -N-1 and
-// put them in an exponent.
-// sinh_FR_spos = 2^(N-1) and sinh_FR_sneg = 2^(-N-1)
-// r39 = 0xffff + (N-1)  = 0xffff +N -1
-// r40 = 0xffff - (N +1) = 0xffff -N -1
-
-{ .mlx
-         nop.m 999
-(p0)     movl                r38 = 0x000000000000fffe ;; 
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_Inv_log2by64 = [r34],16 ;;       
-(p0)     ldfe            sinh_FR_log2by64_hi  = [r34],16       
-         nop.i 999 ;;
-}
-
-{ .mbb
-(p0)     ldfe            sinh_FR_log2by64_lo  = [r34],16       
-         nop.b 999
-         nop.b 999 ;;
-}
-
-// Get the A coefficients
-// f9  = A_1
-// f10 = A_2
-// f11 = A_3
-
-{ .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(double_sinh_ab_table), gp
-      nop.i 999
+{ .mfi
+      nop.m           0
+      // check for overflow
+      fcmp.ge.s1      p12, p13 = fAbsX, fMIN_SGL_OFLOW_ARG
+      mov             rJ_mask = 0x3f             // 6-bit mask for J
 }
 ;;
 
-{ .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+{ .mfb
+      nop.m           0
+      fms.s1          fN = fNint, f1, fRightShifter // n in FP register
+      // branch out if overflow
+(p12) br.cond.spnt    SINH_CERTAIN_OVERFLOW
 }
 ;;
 
-
-// Calculate M and keep it as integer and floating point.
-// f38 = M = round-to-integer(x*Inv_log2by64)
-// sinh_FR_M = M = truncate(ax/(log2/64))
-// Put the significand of M in r35
-//    and the floating point representation of M in sinh_FR_M
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_M      = sinh_FR_X, sinh_FR_Inv_log2by64, f0 
-         nop.i 999
+      getf.sig        rNJ = fNint                   // bits of n, j
+      // check for possible overflow
+      fcmp.gt.s1      p13, p0 = fAbsX, fMAX_SGL_NORM_ARG
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     ldfe            sinh_FR_A1 = [r34],16            
-         nop.f 999
-         nop.i 999 ;;
+      addl            rN = 0xFFBF - 63, rNJ      // biased and shifted n-1,j
+      fnma.s1         fR = fLn2Div64, fN, fNormX // R = x - N*ln(2)/64
+      and             rJ = rJ_mask, rNJ          // bits of j
 }
-
 { .mfi
-         nop.m 999
-(p0)     fcvt.fx.s1      sinh_FR_M_temp = sinh_FR_M                      
-         nop.i 999 ;;
+      sub             rNJ_neg = r0, rNJ          // bits of n, j for -x
+      nop.f           0
+      andcm           rN_mask = -1, rJ_mask      // 0xff...fc0 to mask N
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fnorm.s1        sinh_FR_M      = sinh_FR_M_temp                 
-         nop.i 999 ;;
+      shladd          rJ = rJ, 3, rTblAddr // address in the 2^(j/64) table
+      nop.f           0
+      and             rN = rN_mask, rN     // biased, shifted n-1
 }
-
 { .mfi
-(p0)     getf.sig        r35       = sinh_FR_M_temp                 
-         nop.f 999
-         nop.i 999 ;;
-}
-
-// M is still in r35. Calculate j. j is the signed extension of the six lsb of M. It 
-// has a range of -32 thru 31.
-// r35 = M
-// r36 = j 
-
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p0)     and            r36 = 0x3f, r35 ;;   
+      addl            rN_neg = 0xFFBF - 63, rNJ_neg // -x biased, shifted n-1,j
+      nop.f           0
+      and             rJ_neg = rJ_mask, rNJ_neg     // bits of j for -x
 }
-
-// Calculate R
-// f13 = f44 - f12*f10 = ax - M*log2by64_hi
-// f14 = f13 - f8*f11  = R = (ax - M*log2by64_hi) - M*log2by64_lo
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fnma.s1           sinh_FR_R_temp = sinh_FR_M, sinh_FR_log2by64_hi, sinh_FR_X      
-         nop.i 999
+      ld8             rJ = [rJ]                    // Table value
+      nop.f           0
+      shl             rN = rN, 46 // 2^(n-1) bits in DP format
 }
-
 { .mfi
-(p0)     ldfe            sinh_FR_A2 = [r34],16            
-         nop.f 999
-         nop.i 999 ;;
+      shladd          rJ_neg = rJ_neg, 3, rTblAddr // addr in 2^(j/64) table -x
+      nop.f           0
+      and             rN_neg = rN_mask, rN_neg     // biased, shifted n-1 for -x
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fnma.s1           sinh_FR_R      = sinh_FR_M, sinh_FR_log2by64_lo, sinh_FR_R_temp 
-         nop.i 999
+      ld8             rJ_neg = [rJ_neg]            // Table value for -x
+      nop.f           0
+      shl             rN_neg = rN_neg, 46 // 2^(n-1) bits in DP format for -x
 }
-
-// Get the B coefficients
-// f15 = B_1
-// f32 = B_2
-// f33 = B_3
-
-{ .mmi
-(p0)     ldfe            sinh_FR_A3 = [r34],16 ;;            
-(p0)     ldfe            sinh_FR_B1 = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_B2 = [r34],16 ;;            
-(p0)     ldfe            sinh_FR_B3 = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mii
-         nop.m 999
-(p0)     shl            r34 = r36,  0x2 ;;   
-(p0)     sxt1           r37 = r34 ;;         
-}
-
-// ******************************************************
-// STEP 2 (TBL and EXP)
-// ******************************************************
-// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-// f12 = R*R*R
-// f13 = R*R
-// f14 = R <== from above
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1             sinh_FR_Rsq  = sinh_FR_R,   sinh_FR_R, f0  
-(p0)     shr            r36 = r37,  0x2 ;;   
-}
-
-// r34 = M-j = r35 - r36
-// r35 = N = (M-j)/64
-
-{ .mii
-(p0)     sub                  r34 = r35, r36    
-         nop.i 999 ;;
-(p0)     shr                  r35 = r34, 0x6 ;;    
-}
-
-{ .mii
-(p0)     sub                 r40 = r38, r35           
-(p0)     adds                 r37 = 0x1, r35    
-(p0)     add                 r39 = r38, r35 ;;           
-}
-
-// Get the address of the J table, add the offset, 
-// addresses are sinh_AD_mJ and sinh_AD_J, get the T value
-// f32 = T(j)_hi
-// f33 = T(j)_lo
-// f34 = T(-j)_hi
-// f35 = T(-j)_lo
-
-{ .mmi
-(p0)  sub                  r34 = r35, r32    
-(p0)  addl           r37   = @ltoff(double_sinh_j_table), gp
-      nop.i 999
+      or              rN = rN, rJ // bits of 2^n * 2^(j/64) in DP format
+      nop.f           0
+      nop.i           0
 }
 ;;
 
-{ .mmi
-      ld8 r37 = [r37]
-      nop.m 999
-      nop.i 999
+{ .mmf
+      setf.d          fT = rN            // 2^(n-1) * 2^(j/64)
+      or              rN_neg = rN_neg, rJ_neg // -x bits of 2^n * 2^(j/64) in DP
+      fma.s1          fRSqr = fR, fR, f0 // R^2
 }
 ;;
 
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1             sinh_FR_Rcub = sinh_FR_Rsq, sinh_FR_R, f0  
-         nop.i 999
-}
-
-// ******************************************************
-// STEP 3 Now decide if we need to branch to EXP
-// ******************************************************
-// Put 32 in f9; p6 true if x < 32
-// Go to EXP if |x| >= 32 
-
-{ .mlx
-         nop.m 999
-(p0)     movl                r32 = 0x0000000000010004 ;;               
-}
-
-// Calculate p_even
-// f34 = B_2 + Rsq *B_3
-// f35 = B_1 + Rsq*f34      = B_1 + Rsq * (B_2 + Rsq *B_3)
-// f36 = p_even = Rsq * f35 = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven_temp1 = sinh_FR_Rsq, sinh_FR_B3,          sinh_FR_B2  
-         nop.i 999 ;;
-}
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven_temp2 = sinh_FR_Rsq, sinh_FR_peven_temp1, sinh_FR_B1  
-         nop.i 999
-}
-
-// Calculate p_odd
-// f34 = A_2 + Rsq *A_3
-// f35 = A_1 + Rsq * (A_2 + Rsq *A_3)
-// f37 = podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd_temp1 = sinh_FR_Rsq,        sinh_FR_A3,         sinh_FR_A2  
-         nop.i 999 ;;
-}
-
-{ .mfi
-(p0)     setf.exp            sinh_FR_N_temp1 = r39            
-         nop.f 999
-         nop.i 999 ;;
-}
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven       = sinh_FR_Rsq, sinh_FR_peven_temp2, f0     
-         nop.i 999
+      setf.d          fT_neg = rN_neg    // 2^(n-1) * 2^(j/64) for -x
+      fma.s1          fP = fA3, fR, fA2  // A3*R + A2
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd_temp2 = sinh_FR_Rsq,        sinh_FR_podd_temp1, sinh_FR_A1  
-         nop.i 999 ;;
+      nop.m           0
+      fnma.s1         fP_neg = fA3, fR, fA2  // A3*R + A2 for -x
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     setf.exp            f9  = r32                              
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP = fP, fRSqr, fR // P = (A3*R + A2)*R^2 + R
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd       = sinh_FR_podd_temp2, sinh_FR_Rcub,       sinh_FR_R   
-         nop.i 999
-}
-
-// sinh_GR_mj contains the table offset for -j
-// sinh_GR_j  contains the table offset for +j
-// p6 is true when j <= 0
-
-{ .mlx
-(p0)     setf.exp            sinh_FR_N_temp2 = r40            
-(p0)     movl                r40 = 0x0000000000000020 ;;    
+      nop.m           0
+      fms.s1          fP_neg = fP_neg, fRSqr, fR // P = (A3*R + A2)*R^2 + R, -x
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     sub                 sinh_GR_mJ = r40,  r36           
-(p0)     fmerge.se           sinh_FR_spos    = sinh_FR_N_temp1, f1 
-(p0)     adds                sinh_GR_J  = 0x20, r36 ;;           
-}
-
-{ .mii
-         nop.m 999
-(p0)     shl                  sinh_GR_mJ = sinh_GR_mJ, 5 ;;   
-(p0)     add                  sinh_AD_mJ = r37, sinh_GR_mJ ;; 
-}
-
-{ .mmi
-         nop.m 999
-(p0)     ldfe                 sinh_FR_Tmjhi = [sinh_AD_mJ],16                 
-(p0)     shl                  sinh_GR_J  = sinh_GR_J, 5 ;;    
+      nop.m           0
+      fmpy.s0         fTmp = fLn2Div64, fLn2Div64       // Force inexact
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     ldfs                 sinh_FR_Tmjlo = [sinh_AD_mJ],16                 
-(p0)     fcmp.lt.unc.s1      p0,p7 = sinh_FR_X,f9                          
-(p0)     add                  sinh_AD_J  = r37, sinh_GR_J ;;  
+      nop.m           0
+      fma.s1          fExp = fP, fT, fT                 // exp(x)/2
+      nop.i           0
 }
-
-{ .mmi
-(p0)     ldfe                 sinh_FR_Tjhi  = [sinh_AD_J],16 ;;                  
-(p0)     ldfs                 sinh_FR_Tjlo  = [sinh_AD_J],16                  
-         nop.i 999 ;;
-}
-
 { .mfb
-         nop.m 999
-(p0)     fmerge.se           sinh_FR_sneg    = sinh_FR_N_temp2, f1 
-(p7)     br.cond.spnt        L(SINH_BY_EXP) ;;                            
-}
-
-{ .mfi
-         nop.m 999
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fExp_neg = fP_neg, fT_neg, fT_neg // exp(-x)/2
+      // branch out if possible overflow result
+(p13) br.cond.spnt    SINH_POSSIBLE_OVERFLOW
 }
+;;
 
-// ******************************************************
-// If NOT branch to EXP
-// ******************************************************
-// Calculate S_hi and S_lo
-// sinh_FR_S_hi_temp = sinh_FR_sneg * sinh_FR_Tmjhi
-// sinh_FR_S_hi = sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi_temp
-// sinh_FR_S_hi = sinh_FR_spos * sinh_FR_Tjhi - (sinh_FR_sneg * sinh_FR_Tmjlo)
-
-{ .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_hi_temp = sinh_FR_sneg, sinh_FR_Tmjhi, f0   
-         nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      // final result in the absence of overflow
+      fms.s.s0        f8 = fExp, f1, fExp_neg  // result = (exp(x)-exp(-x))/2
+      // exit here in the absence of overflow
+      br.ret.sptk     b0              // Exit main path, 0.25 <= |x| < 89.41598
 }
+;;
 
+// Here if 0 < |x| < 0.25.  Evaluate 9th order polynomial.
+SINH_SMALL:
 { .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_hi = sinh_FR_spos, sinh_FR_Tjhi,  sinh_FR_S_hi_temp              
-         nop.i 999
+      add             rAd1 = 0x200, rTblAddr
+      fcmp.lt.s1      p7, p8 = fNormX, f0       // Test sign of x
+      cmp.gt          p6, p0 = -60, rExp_x      // Test |x| < 2^(-60)
 }
-
-// Calculate C_hi
-// sinh_FR_C_hi_temp1 = sinh_FR_sneg * sinh_FR_Tmjhi
-// sinh_FR_C_hi = sinh_FR_spos * sinh_FR_Tjhi + sinh_FR_C_hi_temp1
-
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_C_hi_temp1 = sinh_FR_sneg, sinh_FR_Tmjhi, f0                   
-         nop.i 999 ;;
+      add             rAd2 = 0x210, rTblAddr
+      nop.f           0
+      nop.i           0
 }
+;;
 
-// sinh_FR_S_lo_temp1 =  sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi
-// sinh_FR_S_lo_temp2 = -sinh_FR_sneg * sinh_FR_Tmjlo + (sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi)
-// sinh_FR_S_lo_temp2 = -sinh_FR_sneg * sinh_FR_Tmjlo + (sinh_FR_S_lo_temp1              )
-
-{ .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_lo_temp1 =  sinh_FR_spos, sinh_FR_Tjhi,  sinh_FR_S_hi            
-         nop.i 999
+{ .mmb
+      ldfpd           fA4, fA3 = [rAd1]
+      ldfpd           fA2, fA1 = [rAd2]
+(p6)  br.cond.spnt    SINH_VERY_SMALL           // Branch if |x| < 2^(-60)
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_C_hi       = sinh_FR_spos, sinh_FR_Tjhi, sinh_FR_C_hi_temp1    
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fX3 = fXsq, fNormX, f0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)    fnma.s1        sinh_FR_S_lo_temp2 = sinh_FR_sneg, sinh_FR_Tmjhi, sinh_FR_S_lo_temp1       
-         nop.i 999
+      nop.m           0
+      fma.s1          fX4 = fXsq, fXsq, f0
+      nop.i           0
 }
-
-// sinh_FR_S_lo_temp1 = sinh_FR_sneg * sinh_FR_Tmjlo
-// sinh_FR_S_lo_temp3 = sinh_FR_spos * sinh_FR_Tjlo - sinh_FR_S_lo_temp1
-// sinh_FR_S_lo_temp3 = sinh_FR_spos * sinh_FR_Tjlo -(sinh_FR_sneg * sinh_FR_Tmjlo)
-// sinh_FR_S_lo = sinh_FR_S_lo_temp3 + sinh_FR_S_lo_temp2
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_lo_temp1 =  sinh_FR_sneg, sinh_FR_Tmjlo, f0                  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA43 = fXsq, fA4, fA3
+      nop.i           0
 }
-
-/////////// BUG FIX fma to fms -TK
 { .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_lo_temp3 =  sinh_FR_spos, sinh_FR_Tjlo,  sinh_FR_S_lo_temp1  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA21 = fXsq, fA2, fA1
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_lo       =  sinh_FR_S_lo_temp3, f1,   sinh_FR_S_lo_temp2     
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA4321 = fX4, fA43, fA21
+      nop.i           0
 }
+;;
 
-// Y_hi = S_hi 
-// Y_lo = C_hi*p_odd + (S_hi*p_even + S_lo)
-// sinh_FR_Y_lo_temp = sinh_FR_S_hi * sinh_FR_peven + sinh_FR_S_lo
-// sinh_FR_Y_lo      = sinh_FR_C_hi * sinh_FR_podd + sinh_FR_Y_lo_temp
-
+// Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_Y_lo_temp  = sinh_FR_S_hi, sinh_FR_peven, sinh_FR_S_lo           
-         nop.i 999 ;;
+      nop.m           0
+      fmpy.s0         fTmp = fA4, fA4
+      nop.i           0
 }
-
-{ .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_Y_lo       =  sinh_FR_C_hi, sinh_FR_podd, sinh_FR_Y_lo_temp      
-         nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      fma.s.s0        f8 = fA4321, fX3, fNormX
+      br.ret.sptk     b0                // Exit if 2^-60 < |x| < 0.25
 }
+;;
 
-// sinh_FR_SINH = Y_hi + Y_lo
-// f8 = answer = sinh_FR_SGNX * sinh_FR_SINH
-
-// Dummy multiply to generate inexact
+SINH_VERY_SMALL:
+// Here if 0 < |x| < 2^-60
+// Compute result by x + sgn(x)*x^2 to get properly rounded result
+.pred.rel "mutex",p7,p8
 { .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999
+      nop.m           0
+(p7)  fnma.s.s0       f8 = fNormX, fNormX, fNormX // If x<0 result ~ x-x^2
+      nop.i           0
 }
-{ .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_SINH       =  sinh_FR_S_hi, f1, sinh_FR_Y_lo    
-         nop.i 999 ;;
-}
-
 { .mfb
-         nop.m 999
-(p0)    fma.s.s0       f8 = sinh_FR_SGNX, sinh_FR_SINH,f0                      
-(p0)    br.ret.sptk     b0 ;;                          
+      nop.m           0
+(p8)  fma.s.s0        f8 = fNormX, fNormX, fNormX // If x>0 result ~ x+x^2
+      br.ret.sptk     b0                          // Exit if |x| < 2^-60
 }
+;;
 
+SINH_POSSIBLE_OVERFLOW:
 
-L(SINH_BY_EXP): 
+// Here if fMAX_SGL_NORM_ARG < x < fMIN_SGL_OFLOW_ARG
+// This cannot happen if input is a single, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-// When p7 is true,  we know that an overflow is not going to happen
-// When p7 is false, we must check for possible overflow
-// p7 is the over_SAFE flag
-// Y_hi = Tjhi
-// Y_lo = Tjhi * (p_odd + p_even) +Tjlo
-// Scale = sign * 2^(N-1)
-// sinh_FR_Y_lo =  sinh_FR_Tjhi * (sinh_FR_peven + sinh_FR_podd)
-// sinh_FR_Y_lo =  sinh_FR_Tjhi * (sinh_FR_Y_lo_temp      )
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest single, then we have
+// overflow
 
 { .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_Y_lo_temp =  sinh_FR_peven, f1, sinh_FR_podd                   
-         nop.i 999
-}
-
-// Now we are in EXP. This is the only path where an overflow is possible
-// but not for certain. So this is the only path where over_SAFE has any use.
-// r34 still has N-1
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// There is a danger of double overflow            if N-1 > 0x3fe = 1022
-// There is a danger of single overflow            if N-1 > 0x7e = 126
-{ .mlx
-         nop.m 999
-(p0)   movl                r32          = 0x000000000000007e ;;                       
-}
-
-{ .mfi
-(p0)   cmp.gt.unc          p0,p7        = r34, r32                                 
-(p0)   fmerge.s          sinh_FR_SCALE     = sinh_FR_SGNX, sinh_FR_spos                         
-         nop.i 999 ;;
-}
-
-{ .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_Y_lo      =  sinh_FR_Tjhi,  sinh_FR_Y_lo_temp, sinh_FR_Tjlo    
-         nop.i 999 ;;
+      mov             rGt_ln  = 0x1007f // Exponent for largest single + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
+;;
 
-// f8 = answer = scale * (Y_hi + Y_lo)
 { .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_SINH_temp = sinh_FR_Y_lo,  f1, sinh_FR_Tjhi       
-         nop.i 999 ;;
+      setf.exp        fGt_pln = rGt_ln  // Create largest single + 1 ulp
+      fma.s.s2        fWre_urm_f8 = fP, fT, fT    // Result with wre set
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)   fma.s.s0          f44          = sinh_FR_SCALE,  sinh_FR_SINH_temp, f0      
-         nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
+;;
 
-// Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p7)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
+;;
 
-// If over_SAFE is set, return
 { .mfb
-       nop.m 999
-(p7)   fmerge.s            f8 = f44,f44                                            
-(p7)   br.ret.sptk     b0 ;;                          
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    SINH_CERTAIN_OVERFLOW // Branch if overflow
 }
+;;
 
-// Else see if we overflowed
-// S0 user supplied status
-// S2 user supplied status + WRE + TD  (Overflows)
-// If WRE is set then an overflow will not occur in EXP.
-// The input value that would cause a register (WRE) value to overflow is about 2^15
-// and this input would go into the HUGE path.
-// Answer with WRE is in f43.
-
-{ .mfi
-         nop.m 999
-(p0)   fsetc.s2            0x7F,0x42                                               
-         nop.i 999;;
+{ .mfb
+      nop.m           0
+      fma.s.s0        f8 = fP, fT, fT
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
+;;
 
+// here if overflow
+SINH_CERTAIN_OVERFLOW:
 { .mfi
-         nop.m 999
-(p0)   fma.s.s2            f43  = sinh_FR_SCALE,  sinh_FR_SINH_temp, f0                      
-         nop.i 999 ;;
-}
-
-// 1007F => 1007F -FFFF = 80(true)
-// 80 + 7F = FF, which is 1 more that the exponent of the largest
-// double (FE). So 0 1007F 8000000000000000  is one ulp more than
-// largest single in register bias
-// Now  set p8 if the answer with WRE is greater than or equal this value
-// Also set p9 if the answer with WRE is less than or equal to negative this value
-
-{ .mlx
-         nop.m 999
-(p0)   movl                r32     = 0x0000000001007F ;;                              
+      addl            r17ones_m1 = 0x1FFFE, r0
+      fcmp.lt.s1      p6, p7 = fNormX, f0     // Test for x < 0
+      nop.i           0
 }
+;;
 
 { .mmf
-         nop.m 999
-(p0)   setf.exp            f41 = r32                                               
-(p0)   fsetc.s2            0x7F,0x40 ;;                                               
-}
-
-{ .mfi
-         nop.m 999
-(p0)   fcmp.ge.unc.s1 p8, p0 =  f43, f41                                           
-         nop.i 999
+      alloc           r32 = ar.pfs, 0, 3, 4, 0 // get some registers
+      setf.exp        fTmp = r17ones_m1
+      fmerge.s        FR_X = f8,f8
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)   fmerge.ns           f42 = f41, f41                                          
-         nop.i 999 ;;
+      mov             GR_Parameter_TAG = 128
+(p6)  fnma.s.s0       FR_RESULT = fTmp, fTmp, f0 // Set I,O and -INF result
+      nop.i           0
 }
-
-// The error tag for overflow is 128
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p8)   mov                 r47 = 128 ;;                                               
-}
-
 { .mfb
-         nop.m 999
-(p0)   fcmp.le.unc.s1      p9, p0 =  f43, f42                                      
-(p8)   br.cond.spnt L(SINH_ERROR_SUPPORT) ;;
-}
-
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p9)   mov                 r47 = 128                                               
-}
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p9)   br.cond.spnt L(SINH_ERROR_SUPPORT) ;;
-}
-
-// Dummy multiply to generate inexact
-{ .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s.s0        FR_RESULT = fTmp, fTmp, f0 // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
+// Here if x unorm
+SINH_UNORM:
 { .mfb
-         nop.m 999
-(p0)   fmerge.s            f8 = f44,f44                                            
-(p0)   br.ret.sptk     b0 ;;                          
-}
-
-L(SINH_HUGE): 
-
-// for SINH_HUGE, put 24000 in exponent; take sign from input; add 1
-// SAFE: SAFE is always 0 for HUGE
-
-{ .mlx
-         nop.m 999
-(p0)   movl                r32 = 0x0000000000015dbf ;;                                
+      getf.exp        rSignexp_x = fNormX    // Must recompute if x unorm
+      fcmp.eq.s0      p6, p0 = f8, f0        // Set D flag
+      br.cond.sptk    SINH_COMMON            // Return to main path
 }
+;;
 
-{ .mfi
-(p0)   setf.exp            f9  = r32                                               
-         nop.f 999
-         nop.i 999 ;;
-}
+GLOBAL_IEEE754_END(sinhf)
 
-{ .mfi
-         nop.m 999
-(p0)   fma.s1              sinh_FR_signed_hi_lo = sinh_FR_SGNX, f9, f1                       
-         nop.i 999 ;;
-}
 
-{ .mfi
-         nop.m 999
-(p0)   fma.s.s0            f44 = sinh_FR_signed_hi_lo,  f9, f0                          
-(p0)   mov                 r47 = 128                                               
-}
-.endp sinhf
-ASM_SIZE_DIRECTIVE(sinhf)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__ieee754_sinhf)
-#endif
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
-
-.proc __libm_error_region
-__libm_error_region:
-L(SINH_ERROR_SUPPORT):
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-        nop.f 0
+      add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+      nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+      add sp=-64,sp                           // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                       // Save gp
 };;
-
-
-// (2)
 { .mmi
-        stfs [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+      stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
+      add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+      mov GR_SAVE_B0=b0                       // Save b0
 };;
-
 .body
-// (3)
-{ .mib
-        stfs [GR_Parameter_X] = f8                     // STORE Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y   // Parameter 3 address
-        nop.b 0                            
+{ .mfi
+      stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+      nop.f 0
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
 }
 { .mib
-        stfs [GR_Parameter_Y] = f44                    // STORE Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#          // Call error handling function
+      stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
-        add   GR_Parameter_RESULT = 48,sp
+      add   GR_Parameter_RESULT = 48,sp
+      nop.m 0
+      nop.i 0
 };;
 
-// (4)
 { .mmi
-        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+      ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+      add   sp = 64,sp                       // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+      mov   gp = GR_SAVE_GP                  // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+      br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_sinhl.S b/sysdeps/ia64/fpu/e_sinhl.S
index b880b95b64..5b4a4addc2 100644
--- a/sysdeps/ia64/fpu/e_sinhl.S
+++ b/sysdeps/ia64/fpu/e_sinhl.S
@@ -1,10 +1,10 @@
 .file "sinhl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2002, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,17 +35,20 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
 // 10/12/00 Update to set denormal operand and underflow flags
-// 1/22/01  Fixed to set inexact flag for small args.  Fixed incorrect 
+// 01/22/01 Fixed to set inexact flag for small args.  Fixed incorrect 
 //          call to __libm_error_support for 710.476 < x < 11357.2166.
+// 05/02/01 Reworked to improve speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 12/04/02 Improved performance
 //
 // API
 //==============================================================
@@ -56,1269 +59,1059 @@
 // Registers used
 //==============================================================
 // general registers: 
-// r32 -> r47
+// r14 -> r40
 // predicate registers used:
-// p6 p7 p8 p9
+// p6 -> p11
 // floating-point registers used:
-// f9 -> f15; f32 -> f45; 
+// f9 -> f15; f32 -> f90; 
 // f8 has input, then output
 //
 // Overview of operation
 //==============================================================
-// There are four paths
-// 1. |x| < 0.25        SINH_BY_POLY
-// 2. |x| < 32          SINH_BY_TBL
-// 3. |x| < 2^14        SINH_BY_EXP
-// 4. |x_ >= 2^14       SINH_HUGE
-//
-// For double extended we get infinity for x >= 400c b174 ddc0 31ae c0ea
-//                                           >= 1.0110001.... x 2^13
-//                                           >= 11357.2166
-//
-// But for double we get infinity for x >= 408633ce8fb9f87e
-//                                      >= 1.0110...x 2^9
-//                                      >= +7.10476e+002
+// There are seven paths
+// 1. 0 < |x| < 0.25          SINH_BY_POLY
+// 2. 0.25 <=|x| < 32         SINH_BY_TBL
+// 3. 32 <= |x| < 11357.21655 SINH_BY_EXP (merged path with SINH_BY_TBL)
+// 4. |x| >= 11357.21655      SINH_HUGE
+// 5. x=0                     Done with early exit
+// 6. x=inf,nan               Done with early exit
+// 7. x=denormal              SINH_DENORM
 //
-// And for single we get infinity for x >= 42b3a496
-//                                      >= 1.0110... 2^6
-//                                      >= 89.8215
+// For double extended we get overflow for x >= 400c b174 ddc0 31ae c0ea
+//                                           >= 11357.21655
 //
-// SAFE: If there is danger of overflow set SAFE to 0
-//       NOT implemented: if there is danger of underflow, set SAFE to 0
-// SAFE for all paths listed below
 //
-// 1. SINH_BY_POLY
+// 1. SINH_BY_POLY   0 < |x| < 0.25
 // ===============
-// If |x| is less than the tiny threshold, then clear SAFE 
-// For double, the tiny threshold is -1022 = -0x3fe => -3fe + ffff = fc01
-//             register-biased, this is fc01
-// For single, the tiny threshold is -126  = -7e    => -7e  + ffff = ff81
-// If |x| < tiny threshold, set SAFE = 0
+// Evaluate sinh(x) by a 13th order polynomial
+// Care is take for the order of multiplication; and P_1 is not exactly 1/3!, 
+// P_2 is not exactly 1/5!, etc.
+// sinh(x) = sign * (series(e^x) - series(e^-x))/2
+//         = sign * (ax + ax^3/3! + ax^5/5! + ax^7/7! + ax^9/9! + ax^11/11!
+//                        + ax^13/13!)
+//         = sign * (ax   + ax * ( ax^2 * (1/3! + ax^4 * (1/7! + ax^4*1/11!)) )
+//                        + ax * ( ax^4 * (1/5! + ax^4 * (1/9! + ax^4*1/13!)) ))
+//         = sign * (ax   + ax*p_odd + (ax*p_even))
+//         = sign * (ax   + Y_lo)
+// sinh(x) = sign * (Y_hi + Y_lo)
+// Note that ax = |x|
 //
-// 2. SINH_BY_TBL
+// 2. SINH_BY_TBL   0.25 <= |x| < 32.0
 // =============
-// SAFE: SAFE is always 1 for TBL; 
+// sinh(x) = sinh(B+R)
+//         = sinh(B)cosh(R) + cosh(B)sinh(R)
+// 
+// ax = |x| = M*log2/64 + R
+// B = M*log2/64
+// M = 64*N + j 
+//   We will calculate M and get N as (M-j)/64
+//   The division is a shift.
+// exp(B)  = exp(N*log2 + j*log2/64)
+//         = 2^N * 2^(j*log2/64)
+// sinh(B) = 1/2(e^B -e^-B)
+//         = 1/2(2^N * 2^(j*log2/64) - 2^-N * 2^(-j*log2/64)) 
+// sinh(B) = (2^(N-1) * 2^(j*log2/64) - 2^(-N-1) * 2^(-j*log2/64)) 
+// cosh(B) = (2^(N-1) * 2^(j*log2/64) + 2^(-N-1) * 2^(-j*log2/64)) 
+// 2^(j*log2/64) is stored as Tjhi + Tjlo , j= -32,....,32
+// Tjhi is double-extended (80-bit) and Tjlo is single(32-bit)
+//
+// R = ax - M*log2/64
+// R = ax - M*log2_by_64_hi - M*log2_by_64_lo
+// exp(R) = 1 + R +R^2(1/2! + R(1/3! + R(1/4! + ... + R(1/n!)...)
+//        = 1 + p_odd + p_even
+//        where the p_even uses the A coefficients and the p_even uses 
+//        the B coefficients
+//
+// So sinh(R) = 1 + p_odd + p_even -(1 -p_odd -p_even)/2 = p_odd
+//    cosh(R) = 1 + p_even
+//    sinh(B) = S_hi + S_lo
+//    cosh(B) = C_hi
+// sinh(x) = sinh(B)cosh(R) + cosh(B)sinh(R)
 //
-// 3. SINH_BY_EXP
+// 3. SINH_BY_EXP   32.0 <= |x| < 11357.21655  ( 400c b174 ddc0 31ae c0ea )
 // ==============
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// r34 has N-1; 16382 is in register biased form, 0x13ffd
-// There is danger of double overflow if N-1 > 0x3fe
-//                       in register biased form, 0x103fd
-// Analagously, there is danger of single overflow if N-1 > 0x7e
-//                       in register biased form, 0x1007d
-// SAFE: If there is danger of overflow set SAFE to 0
+// Can approximate result by exp(x)/2 in this region.
+// Y_hi = Tjhi
+// Y_lo = Tjhi * (p_odd + p_even) + Tjlo
+// sinh(x) = Y_hi + Y_lo
 //
-// 4. SINH_HUGE
+// 4. SINH_HUGE     |x| >= 11357.21655  ( 400c b174 ddc0 31ae c0ea )
 // ============
-// SAFE: SAFE is always 0 for HUGE
+// Set error tag and call error support
+//
 //
-
-#include "libm_support.h"
-
 // Assembly macros
 //==============================================================
-sinh_FR_X            = f44
-sinh_FR_X2           = f9
-sinh_FR_X4           = f10
-sinh_FR_SGNX         = f40
-sinh_FR_all_ones     = f45
-sinh_FR_tmp          = f42
-
-sinh_FR_Inv_log2by64 = f9
-sinh_FR_log2by64_lo  = f11
-sinh_FR_log2by64_hi  = f10
-
-sinh_FR_A1           = f9
-sinh_FR_A2           = f10
-sinh_FR_A3           = f11
-
-sinh_FR_Rcub         = f12
-sinh_FR_M_temp       = f13
-sinh_FR_R_temp       = f13
-sinh_FR_Rsq          = f13
-sinh_FR_R            = f14
-
-sinh_FR_M            = f38
-
-sinh_FR_B1           = f15
-sinh_FR_B2           = f32
-sinh_FR_B3           = f33
-
-sinh_FR_peven_temp1  = f34
-sinh_FR_peven_temp2  = f35
-sinh_FR_peven        = f36
+r_ad5                 = r14
+r_rshf_2to57          = r15
+r_exp_denorm          = r15
+r_ad_mJ_lo            = r15
+r_ad_J_lo             = r16
+r_2Nm1                = r17
+r_2mNm1               = r18
+r_exp_x               = r18
+r_ad_J_hi             = r19
+r_ad2o                = r19
+r_ad_mJ_hi            = r20
+r_mj                  = r21
+r_ad2e                = r22
+r_ad3                 = r23
+r_ad1                 = r24
+r_Mmj                 = r24
+r_rshf                = r25
+r_M                   = r25
+r_N                   = r25
+r_jshf                = r26
+r_exp_2tom57          = r26
+r_j                   = r26
+r_exp_mask            = r27
+r_signexp_x           = r28
+r_signexp_sgnx_0_5    = r28
+r_exp_0_25            = r29
+r_sig_inv_ln2         = r30
+r_exp_32              = r30
+r_exp_huge            = r30
+r_ad4                 = r31
+
+GR_SAVE_PFS           = r34
+GR_SAVE_B0            = r35
+GR_SAVE_GP            = r36
+
+GR_Parameter_X        = r37
+GR_Parameter_Y        = r38
+GR_Parameter_RESULT   = r39
+GR_Parameter_TAG      = r40
+
+
+f_ABS_X               = f9 
+f_X2                  = f10
+f_X4                  = f11
+f_tmp                 = f14
+f_RSHF                = f15
+
+f_Inv_log2by64        = f32
+f_log2by64_lo         = f33
+f_log2by64_hi         = f34
+f_A1                  = f35
+
+f_A2                  = f36
+f_A3                  = f37
+f_Rcub                = f38
+f_M_temp              = f39
+f_R_temp              = f40
+
+f_Rsq                 = f41
+f_R                   = f42
+f_M                   = f43
+f_B1                  = f44
+f_B2                  = f45
+
+f_B3                  = f46
+f_peven_temp1         = f47
+f_peven_temp2         = f48
+f_peven               = f49
+f_podd_temp1          = f50
+
+f_podd_temp2          = f51
+f_podd                = f52
+f_poly65              = f53
+f_poly6543            = f53
+f_poly6to1            = f53
+f_poly43              = f54
+f_poly21              = f55
+
+f_X3                  = f56
+f_INV_LN2_2TO63       = f57
+f_RSHF_2TO57          = f58
+f_2TOM57              = f59
+f_smlst_oflow_input   = f60
+
+f_pre_result          = f61
+f_huge                = f62
+f_spos                = f63
+f_sneg                = f64
+f_Tjhi                = f65
+
+f_Tjlo                = f66
+f_Tmjhi               = f67
+f_Tmjlo               = f68
+f_S_hi                = f69
+f_SC_hi_temp          = f70
+
+f_S_lo_temp1          = f71 
+f_S_lo_temp2          = f72 
+f_S_lo_temp3          = f73 
+f_S_lo_temp4          = f73 
+f_S_lo                = f74
+f_C_hi                = f75
+
+f_Y_hi                = f77 
+f_Y_lo_temp           = f78 
+f_Y_lo                = f79 
+f_NORM_X              = f80
+
+f_P1                  = f81
+f_P2                  = f82
+f_P3                  = f83
+f_P4                  = f84
+f_P5                  = f85
+
+f_P6                  = f86
+f_Tjhi_spos           = f87
+f_Tjlo_spos           = f88
+f_huge                = f89
+f_signed_hi_lo        = f90
 
-sinh_FR_podd_temp1   = f34
-sinh_FR_podd_temp2   = f35
-sinh_FR_podd         = f37
-
-sinh_FR_poly_podd_temp1    =  f11 
-sinh_FR_poly_podd_temp2    =  f13
-sinh_FR_poly_peven_temp1   =  f11
-sinh_FR_poly_peven_temp2   =  f13
-
-sinh_FR_J_temp       = f9
-sinh_FR_J            = f10
-
-sinh_FR_Mmj          = f39
-
-sinh_FR_N_temp1      = f11
-sinh_FR_N_temp2      = f12
-sinh_FR_N            = f13
-
-sinh_FR_spos         = f14
-sinh_FR_sneg         = f15
-
-sinh_FR_Tjhi         = f32
-sinh_FR_Tjlo         = f33
-sinh_FR_Tmjhi        = f34
-sinh_FR_Tmjlo        = f35
-
-sinh_GR_mJ           = r35
-sinh_GR_J            = r36
-
-sinh_AD_mJ           = r38
-sinh_AD_J            = r39
-sinh_GR_all_ones     = r40
-
-sinh_FR_S_hi         = f9
-sinh_FR_S_hi_temp    = f10
-sinh_FR_S_lo_temp1   = f11 
-sinh_FR_S_lo_temp2   = f12 
-sinh_FR_S_lo_temp3   = f13 
-
-sinh_FR_S_lo         = f38
-sinh_FR_C_hi         = f39
-
-sinh_FR_C_hi_temp1   = f10
-sinh_FR_Y_hi         = f11 
-sinh_FR_Y_lo_temp    = f12 
-sinh_FR_Y_lo         = f13 
-sinh_FR_SINH         = f9
-
-sinh_FR_P1           = f14
-sinh_FR_P2           = f15
-sinh_FR_P3           = f32
-sinh_FR_P4           = f33
-sinh_FR_P5           = f34
-sinh_FR_P6           = f35
-
-sinh_FR_TINY_THRESH  = f9
-
-sinh_FR_SINH_temp    = f10
-sinh_FR_SCALE        = f11 
-
-sinh_FR_signed_hi_lo = f10
-
-
-GR_SAVE_PFS          = r41
-GR_SAVE_B0           = r42
-GR_SAVE_GP           = r43
-
-GR_Parameter_X       = r44
-GR_Parameter_Y       = r45
-GR_Parameter_RESULT  = r46
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// DO NOT CHANGE ORDER OF THESE TABLES
+RODATA
 
 .align 16
-double_sinh_arg_reduction:
-ASM_TYPE_DIRECTIVE(double_sinh_arg_reduction,@object)
-   data8 0xB8AA3B295C17F0BC, 0x00004005
-   data8 0xB17217F7D1000000, 0x00003FF8
-   data8 0xCF79ABC9E3B39804, 0x00003FD0
-ASM_SIZE_DIRECTIVE(double_sinh_arg_reduction)
-
-double_sinh_p_table:
-ASM_TYPE_DIRECTIVE(double_sinh_p_table,@object)
-   data8 0xAAAAAAAAAAAAAAAB, 0x00003FFC
-   data8 0x8888888888888412, 0x00003FF8
-   data8 0xD00D00D00D4D39F2, 0x00003FF2
-   data8 0xB8EF1D28926D8891, 0x00003FEC
-   data8 0xD732377688025BE9, 0x00003FE5
-   data8 0xB08AF9AE78C1239F, 0x00003FDE
-ASM_SIZE_DIRECTIVE(double_sinh_p_table)
-
-double_sinh_ab_table:
-ASM_TYPE_DIRECTIVE(double_sinh_ab_table,@object)
-   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC
-   data8 0x88888888884ECDD5, 0x00003FF8
-   data8 0xD00D0C6DCC26A86B, 0x00003FF2
-   data8 0x8000000000000002, 0x00003FFE
-   data8 0xAAAAAAAAAA402C77, 0x00003FFA
-   data8 0xB60B6CC96BDB144D, 0x00003FF5
-ASM_SIZE_DIRECTIVE(double_sinh_ab_table)
-
-double_sinh_j_table:
-ASM_TYPE_DIRECTIVE(double_sinh_j_table,@object)
-   data8 0xB504F333F9DE6484, 0x00003FFE, 0x1EB2FB13, 0x00000000
-   data8 0xB6FD91E328D17791, 0x00003FFE, 0x1CE2CBE2, 0x00000000
-   data8 0xB8FBAF4762FB9EE9, 0x00003FFE, 0x1DDC3CBC, 0x00000000
-   data8 0xBAFF5AB2133E45FB, 0x00003FFE, 0x1EE9AA34, 0x00000000
-   data8 0xBD08A39F580C36BF, 0x00003FFE, 0x9EAEFDC1, 0x00000000
-   data8 0xBF1799B67A731083, 0x00003FFE, 0x9DBF517B, 0x00000000
-   data8 0xC12C4CCA66709456, 0x00003FFE, 0x1EF88AFB, 0x00000000
-   data8 0xC346CCDA24976407, 0x00003FFE, 0x1E03B216, 0x00000000
-   data8 0xC5672A115506DADD, 0x00003FFE, 0x1E78AB43, 0x00000000
-   data8 0xC78D74C8ABB9B15D, 0x00003FFE, 0x9E7B1747, 0x00000000
-   data8 0xC9B9BD866E2F27A3, 0x00003FFE, 0x9EFE3C0E, 0x00000000
-   data8 0xCBEC14FEF2727C5D, 0x00003FFE, 0x9D36F837, 0x00000000
-   data8 0xCE248C151F8480E4, 0x00003FFE, 0x9DEE53E4, 0x00000000
-   data8 0xD06333DAEF2B2595, 0x00003FFE, 0x9E24AE8E, 0x00000000
-   data8 0xD2A81D91F12AE45A, 0x00003FFE, 0x1D912473, 0x00000000
-   data8 0xD4F35AABCFEDFA1F, 0x00003FFE, 0x1EB243BE, 0x00000000
-   data8 0xD744FCCAD69D6AF4, 0x00003FFE, 0x1E669A2F, 0x00000000
-   data8 0xD99D15C278AFD7B6, 0x00003FFE, 0x9BBC610A, 0x00000000
-   data8 0xDBFBB797DAF23755, 0x00003FFE, 0x1E761035, 0x00000000
-   data8 0xDE60F4825E0E9124, 0x00003FFE, 0x9E0BE175, 0x00000000
-   data8 0xE0CCDEEC2A94E111, 0x00003FFE, 0x1CCB12A1, 0x00000000
-   data8 0xE33F8972BE8A5A51, 0x00003FFE, 0x1D1BFE90, 0x00000000
-   data8 0xE5B906E77C8348A8, 0x00003FFE, 0x1DF2F47A, 0x00000000
-   data8 0xE8396A503C4BDC68, 0x00003FFE, 0x1EF22F22, 0x00000000
-   data8 0xEAC0C6E7DD24392F, 0x00003FFE, 0x9E3F4A29, 0x00000000
-   data8 0xED4F301ED9942B84, 0x00003FFE, 0x1EC01A5B, 0x00000000
-   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE, 0x1E8CAC3A, 0x00000000
-   data8 0xF281773C59FFB13A, 0x00003FFE, 0x9DBB3FAB, 0x00000000
-   data8 0xF5257D152486CC2C, 0x00003FFE, 0x1EF73A19, 0x00000000
-   data8 0xF7D0DF730AD13BB9, 0x00003FFE, 0x9BB795B5, 0x00000000
-   data8 0xFA83B2DB722A033A, 0x00003FFE, 0x1EF84B76, 0x00000000
-   data8 0xFD3E0C0CF486C175, 0x00003FFE, 0x9EF5818B, 0x00000000
-   data8 0x8000000000000000, 0x00003FFF, 0x00000000, 0x00000000
-   data8 0x8164D1F3BC030773, 0x00003FFF, 0x1F77CACA, 0x00000000
-   data8 0x82CD8698AC2BA1D7, 0x00003FFF, 0x1EF8A91D, 0x00000000
-   data8 0x843A28C3ACDE4046, 0x00003FFF, 0x1E57C976, 0x00000000
-   data8 0x85AAC367CC487B15, 0x00003FFF, 0x9EE8DA92, 0x00000000
-   data8 0x871F61969E8D1010, 0x00003FFF, 0x1EE85C9F, 0x00000000
-   data8 0x88980E8092DA8527, 0x00003FFF, 0x1F3BF1AF, 0x00000000
-   data8 0x8A14D575496EFD9A, 0x00003FFF, 0x1D80CA1E, 0x00000000
-   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF, 0x9D0373AF, 0x00000000
-   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF, 0x9F167097, 0x00000000
-   data8 0x8EA4398B45CD53C0, 0x00003FFF, 0x1EB70051, 0x00000000
-   data8 0x9031DC431466B1DC, 0x00003FFF, 0x1F6EB029, 0x00000000
-   data8 0x91C3D373AB11C336, 0x00003FFF, 0x1DFD6D8E, 0x00000000
-   data8 0x935A2B2F13E6E92C, 0x00003FFF, 0x9EB319B0, 0x00000000
-   data8 0x94F4EFA8FEF70961, 0x00003FFF, 0x1EBA2BEB, 0x00000000
-   data8 0x96942D3720185A00, 0x00003FFF, 0x1F11D537, 0x00000000
-   data8 0x9837F0518DB8A96F, 0x00003FFF, 0x1F0D5A46, 0x00000000
-   data8 0x99E0459320B7FA65, 0x00003FFF, 0x9E5E7BCA, 0x00000000
-   data8 0x9B8D39B9D54E5539, 0x00003FFF, 0x9F3AAFD1, 0x00000000
-   data8 0x9D3ED9A72CFFB751, 0x00003FFF, 0x9E86DACC, 0x00000000
-   data8 0x9EF5326091A111AE, 0x00003FFF, 0x9F3EDDC2, 0x00000000
-   data8 0xA0B0510FB9714FC2, 0x00003FFF, 0x1E496E3D, 0x00000000
-   data8 0xA27043030C496819, 0x00003FFF, 0x9F490BF6, 0x00000000
-   data8 0xA43515AE09E6809E, 0x00003FFF, 0x1DD1DB48, 0x00000000
-   data8 0xA5FED6A9B15138EA, 0x00003FFF, 0x1E65EBFB, 0x00000000
-   data8 0xA7CD93B4E965356A, 0x00003FFF, 0x9F427496, 0x00000000
-   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF, 0x1F283C4A, 0x00000000
-   data8 0xAB7A39B5A93ED337, 0x00003FFF, 0x1F4B0047, 0x00000000
-   data8 0xAD583EEA42A14AC6, 0x00003FFF, 0x1F130152, 0x00000000
-   data8 0xAF3B78AD690A4375, 0x00003FFF, 0x9E8367C0, 0x00000000
-   data8 0xB123F581D2AC2590, 0x00003FFF, 0x9F705F90, 0x00000000
-   data8 0xB311C412A9112489, 0x00003FFF, 0x1EFB3C53, 0x00000000
-   data8 0xB504F333F9DE6484, 0x00003FFF, 0x1F32FB13, 0x00000000
-ASM_SIZE_DIRECTIVE(double_sinh_j_table)
-
-.align 32
-.global sinhl#
-
-.section .text
-.proc  sinhl#
-.align 32
-
-sinhl:
-#ifdef _LIBC
-.global __ieee754_sinhl
-.type __ieee754_sinhl,@function
-__ieee754_sinhl:
-#endif
-
-// X infinity or NAN?
-// Take invalid fault if enabled
-
-
-{ .mfi
-      alloc r32 = ar.pfs,0,12,4,0                  
-(p0)     fclass.m.unc  p6,p0 = f8, 0xe3	//@qnan | @snan | @inf 
-         mov sinh_GR_all_ones = -1
-}
-;;
+LOCAL_OBJECT_START(sinh_arg_reduction)
+//   data8 0xB8AA3B295C17F0BC, 0x00004005  // 64/log2 -- signif loaded with setf
+   data8 0xB17217F7D1000000, 0x00003FF8  // log2/64 high part
+   data8 0xCF79ABC9E3B39804, 0x00003FD0  // log2/64 low part
+   data8 0xb174ddc031aec0ea, 0x0000400c  // Smallest x to overflow (11357.21655)
+LOCAL_OBJECT_END(sinh_arg_reduction)
+
+LOCAL_OBJECT_START(sinh_p_table)
+   data8 0xB08AF9AE78C1239F, 0x00003FDE  // P6
+   data8 0xB8EF1D28926D8891, 0x00003FEC  // P4
+   data8 0x8888888888888412, 0x00003FF8  // P2
+   data8 0xD732377688025BE9, 0x00003FE5  // P5
+   data8 0xD00D00D00D4D39F2, 0x00003FF2  // P3
+   data8 0xAAAAAAAAAAAAAAAB, 0x00003FFC  // P1
+LOCAL_OBJECT_END(sinh_p_table)
+
+LOCAL_OBJECT_START(sinh_ab_table)
+   data8 0xAAAAAAAAAAAAAAAC, 0x00003FFC  // A1
+   data8 0x88888888884ECDD5, 0x00003FF8  // A2
+   data8 0xD00D0C6DCC26A86B, 0x00003FF2  // A3
+   data8 0x8000000000000002, 0x00003FFE  // B1
+   data8 0xAAAAAAAAAA402C77, 0x00003FFA  // B2
+   data8 0xB60B6CC96BDB144D, 0x00003FF5  // B3
+LOCAL_OBJECT_END(sinh_ab_table)
+
+LOCAL_OBJECT_START(sinh_j_hi_table)
+   data8 0xB504F333F9DE6484, 0x00003FFE
+   data8 0xB6FD91E328D17791, 0x00003FFE
+   data8 0xB8FBAF4762FB9EE9, 0x00003FFE
+   data8 0xBAFF5AB2133E45FB, 0x00003FFE
+   data8 0xBD08A39F580C36BF, 0x00003FFE
+   data8 0xBF1799B67A731083, 0x00003FFE
+   data8 0xC12C4CCA66709456, 0x00003FFE
+   data8 0xC346CCDA24976407, 0x00003FFE
+   data8 0xC5672A115506DADD, 0x00003FFE
+   data8 0xC78D74C8ABB9B15D, 0x00003FFE
+   data8 0xC9B9BD866E2F27A3, 0x00003FFE
+   data8 0xCBEC14FEF2727C5D, 0x00003FFE
+   data8 0xCE248C151F8480E4, 0x00003FFE
+   data8 0xD06333DAEF2B2595, 0x00003FFE
+   data8 0xD2A81D91F12AE45A, 0x00003FFE
+   data8 0xD4F35AABCFEDFA1F, 0x00003FFE
+   data8 0xD744FCCAD69D6AF4, 0x00003FFE
+   data8 0xD99D15C278AFD7B6, 0x00003FFE
+   data8 0xDBFBB797DAF23755, 0x00003FFE
+   data8 0xDE60F4825E0E9124, 0x00003FFE
+   data8 0xE0CCDEEC2A94E111, 0x00003FFE
+   data8 0xE33F8972BE8A5A51, 0x00003FFE
+   data8 0xE5B906E77C8348A8, 0x00003FFE
+   data8 0xE8396A503C4BDC68, 0x00003FFE
+   data8 0xEAC0C6E7DD24392F, 0x00003FFE
+   data8 0xED4F301ED9942B84, 0x00003FFE
+   data8 0xEFE4B99BDCDAF5CB, 0x00003FFE
+   data8 0xF281773C59FFB13A, 0x00003FFE
+   data8 0xF5257D152486CC2C, 0x00003FFE
+   data8 0xF7D0DF730AD13BB9, 0x00003FFE
+   data8 0xFA83B2DB722A033A, 0x00003FFE
+   data8 0xFD3E0C0CF486C175, 0x00003FFE
+   data8 0x8000000000000000, 0x00003FFF // Center of table
+   data8 0x8164D1F3BC030773, 0x00003FFF
+   data8 0x82CD8698AC2BA1D7, 0x00003FFF
+   data8 0x843A28C3ACDE4046, 0x00003FFF
+   data8 0x85AAC367CC487B15, 0x00003FFF
+   data8 0x871F61969E8D1010, 0x00003FFF
+   data8 0x88980E8092DA8527, 0x00003FFF
+   data8 0x8A14D575496EFD9A, 0x00003FFF
+   data8 0x8B95C1E3EA8BD6E7, 0x00003FFF
+   data8 0x8D1ADF5B7E5BA9E6, 0x00003FFF
+   data8 0x8EA4398B45CD53C0, 0x00003FFF
+   data8 0x9031DC431466B1DC, 0x00003FFF
+   data8 0x91C3D373AB11C336, 0x00003FFF
+   data8 0x935A2B2F13E6E92C, 0x00003FFF
+   data8 0x94F4EFA8FEF70961, 0x00003FFF
+   data8 0x96942D3720185A00, 0x00003FFF
+   data8 0x9837F0518DB8A96F, 0x00003FFF
+   data8 0x99E0459320B7FA65, 0x00003FFF
+   data8 0x9B8D39B9D54E5539, 0x00003FFF
+   data8 0x9D3ED9A72CFFB751, 0x00003FFF
+   data8 0x9EF5326091A111AE, 0x00003FFF
+   data8 0xA0B0510FB9714FC2, 0x00003FFF
+   data8 0xA27043030C496819, 0x00003FFF
+   data8 0xA43515AE09E6809E, 0x00003FFF
+   data8 0xA5FED6A9B15138EA, 0x00003FFF
+   data8 0xA7CD93B4E965356A, 0x00003FFF
+   data8 0xA9A15AB4EA7C0EF8, 0x00003FFF
+   data8 0xAB7A39B5A93ED337, 0x00003FFF
+   data8 0xAD583EEA42A14AC6, 0x00003FFF
+   data8 0xAF3B78AD690A4375, 0x00003FFF
+   data8 0xB123F581D2AC2590, 0x00003FFF
+   data8 0xB311C412A9112489, 0x00003FFF
+   data8 0xB504F333F9DE6484, 0x00003FFF
+LOCAL_OBJECT_END(sinh_j_hi_table)
+
+LOCAL_OBJECT_START(sinh_j_lo_table)
+   data4 0x1EB2FB13
+   data4 0x1CE2CBE2
+   data4 0x1DDC3CBC
+   data4 0x1EE9AA34
+   data4 0x9EAEFDC1
+   data4 0x9DBF517B
+   data4 0x1EF88AFB
+   data4 0x1E03B216
+   data4 0x1E78AB43
+   data4 0x9E7B1747
+   data4 0x9EFE3C0E
+   data4 0x9D36F837
+   data4 0x9DEE53E4
+   data4 0x9E24AE8E
+   data4 0x1D912473
+   data4 0x1EB243BE
+   data4 0x1E669A2F
+   data4 0x9BBC610A
+   data4 0x1E761035
+   data4 0x9E0BE175
+   data4 0x1CCB12A1
+   data4 0x1D1BFE90
+   data4 0x1DF2F47A
+   data4 0x1EF22F22
+   data4 0x9E3F4A29
+   data4 0x1EC01A5B
+   data4 0x1E8CAC3A
+   data4 0x9DBB3FAB
+   data4 0x1EF73A19
+   data4 0x9BB795B5
+   data4 0x1EF84B76
+   data4 0x9EF5818B
+   data4 0x00000000 // Center of table
+   data4 0x1F77CACA
+   data4 0x1EF8A91D
+   data4 0x1E57C976
+   data4 0x9EE8DA92
+   data4 0x1EE85C9F
+   data4 0x1F3BF1AF
+   data4 0x1D80CA1E
+   data4 0x9D0373AF
+   data4 0x9F167097
+   data4 0x1EB70051
+   data4 0x1F6EB029
+   data4 0x1DFD6D8E
+   data4 0x9EB319B0
+   data4 0x1EBA2BEB
+   data4 0x1F11D537
+   data4 0x1F0D5A46
+   data4 0x9E5E7BCA
+   data4 0x9F3AAFD1
+   data4 0x9E86DACC
+   data4 0x9F3EDDC2
+   data4 0x1E496E3D
+   data4 0x9F490BF6
+   data4 0x1DD1DB48
+   data4 0x1E65EBFB
+   data4 0x9F427496
+   data4 0x1F283C4A
+   data4 0x1F4B0047
+   data4 0x1F130152
+   data4 0x9E8367C0
+   data4 0x9F705F90
+   data4 0x1EFB3C53
+   data4 0x1F32FB13
+LOCAL_OBJECT_END(sinh_j_lo_table)
 
 
-{ .mfb
-         nop.m 999
-(p6)     fma.s0   f8 = f8,f1,f8               
-(p6)     br.ret.spnt     b0 ;;                          
-}
+.section .text
+GLOBAL_IEEE754_ENTRY(sinhl)
 
-// Put 0.25 in f9; p6 true if x < 0.25
-// Make constant that will generate inexact when squared
 { .mlx
-         setf.sig sinh_FR_all_ones = sinh_GR_all_ones 
-(p0)     movl            r32 = 0x000000000000fffd ;;         
-}
-
-{ .mfi
-(p0)     setf.exp        f9 = r32                         
-(p0)     fclass.m.unc  p7,p0 = f8, 0x07	//@zero
-         nop.i 999 ;;
-}
-
-{ .mfb
-         nop.m 999
-(p0)     fmerge.s      sinh_FR_X    = f0,f8             
-(p7)     br.ret.spnt     b0 ;;                          
+      getf.exp        r_signexp_x = f8   // Get signexp of x, must redo if unorm
+      movl            r_sig_inv_ln2 = 0xb8aa3b295c17f0bc // significand of 1/ln2
 }
-
-// Identify denormal operands.
-{ .mfi
-         nop.m 999
-         fclass.m.unc  p10,p0 = f8, 0x09        //  + denorm
-         nop.i 999
-};;
-{ .mfi
-         nop.m 999
-         fclass.m.unc  p11,p0 = f8, 0x0a        //  - denorm
-         nop.i 999 
+{ .mlx
+      addl            r_ad1 = @ltoff(sinh_arg_reduction), gp
+      movl            r_rshf_2to57 = 0x4778000000000000 // 1.10000 2^(63+57)
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fmerge.s      sinh_FR_SGNX = f8,f1             
-         nop.i 999 ;;
+      ld8             r_ad1 = [r_ad1]
+      fmerge.s        f_ABS_X    = f0,f8
+      mov             r_exp_0_25 = 0x0fffd    // Form exponent for 0.25
 }
-
 { .mfi
-         nop.m 999
-(p0)     fcmp.lt.unc.s1  p0,p7 = sinh_FR_X,f9             
-         nop.i 999 ;;
-}
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p7)     br.cond.sptk    L(SINH_BY_TBL) ;;                      
-}
-
-
-L(SINH_BY_POLY): 
-
-// POLY cannot overflow so there is no need to call __libm_error_support
-// Set tiny_SAFE (p7) to 1(0) if answer is not tiny 
-// Currently we do not use tiny_SAFE. So the setting of tiny_SAFE is
-// commented out.
-//(p0)     movl            r32            = 0x000000000000fc01           
-//(p0)     setf.exp        f10            = r32                         
-//(p0)     fcmp.lt.unc.s1  p6,p7          = f8,f10                     
-// Here is essentially the algorithm for SINH_BY_POLY. Care is take for the order 
-// of multiplication; and P_1 is not exactly 1/3!, P_2 is not exactly 1/5!, etc.
-// Note that ax = |x|
-// sinh(x) = sign * (series(e^x) - series(e^-x))/2
-//         = sign * (ax + ax^3/3! + ax^5/5! + ax^7/7! + ax^9/9! + ax^11/11! + ax^13/13!)
-//         = sign * (ax   + ax * ( ax^2 * (1/3! + ax^4 * (1/7! + ax^4*1/11!)) )
-//                        + ax * ( ax^4 * (1/5! + ax^4 * (1/9! + ax^4*1/13!)) ) )
-//         = sign * (ax   + ax*p_odd + (ax*p_even))
-//         = sign * (ax   + Y_lo)
-// sinh(x) = sign * (Y_hi + Y_lo)
-// Get the values of P_x from the table
-{ .mfb
-(p0)  addl           r34   = @ltoff(double_sinh_p_table), gp
-(p10) fma.s0       f8 =  f8,f8,f8
-(p10) br.ret.spnt    b0
-}
-;;
-
-{ .mfb
-      ld8 r34 = [r34]
-(p11) fnma.s0      f8 =  f8,f8,f8
-(p11) br.ret.spnt    b0
+      nop.m           0
+      fnorm.s1        f_NORM_X = f8      
+      mov             r_exp_2tom57 = 0xffff-57
 }
 ;;
 
-// Calculate sinh_FR_X2 = ax*ax and sinh_FR_X4 = ax*ax*ax*ax
-{ .mmf
-         nop.m 999
-(p0)     ldfe            sinh_FR_P1 = [r34],16                 
-(p0)     fma.s1        sinh_FR_X2 = sinh_FR_X, sinh_FR_X, f0 ;;           
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_P2 = [r34],16 ;;                 
-(p0)     ldfe            sinh_FR_P3 = [r34],16                 
-         nop.i 999 ;;
-}
-
-{ .mmi
-(p0)     ldfe            sinh_FR_P4 = [r34],16 ;;                 
-(p0)     ldfe            sinh_FR_P5 = [r34],16                 
-         nop.i 999 ;;
-}
-
-{ .mfi
-(p0)     ldfe            sinh_FR_P6 = [r34],16                 
-(p0)     fma.s1        sinh_FR_X4 = sinh_FR_X2, sinh_FR_X2, f0         
-         nop.i 999 ;;
-}
-
-// Calculate sinh_FR_podd = p_odd and sinh_FR_peven = p_even 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_podd_temp1 = sinh_FR_X4, sinh_FR_P5, sinh_FR_P3                
-         nop.i 999 ;;
+      setf.d          f_RSHF_2TO57 = r_rshf_2to57 // Form const 1.100 * 2^120
+      fclass.m        p10,p0 = f8, 0x0b           // Test for denorm
+      mov             r_exp_mask = 0x1ffff 
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_podd_temp2 = sinh_FR_X4, sinh_FR_poly_podd_temp1, sinh_FR_P1   
-         nop.i 999
+{ .mlx
+      setf.sig        f_INV_LN2_2TO63 = r_sig_inv_ln2 // Form 1/ln2 * 2^63
+      movl            r_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_peven_temp1 = sinh_FR_X4, sinh_FR_P6, sinh_FR_P4               
-         nop.i 999 ;;
+      nop.m           0
+      fclass.m        p7,p0 = f8, 0x07  // Test if x=0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_podd       = sinh_FR_X2, sinh_FR_poly_podd_temp2, f0           
-         nop.i 999
+      setf.exp        f_2TOM57 = r_exp_2tom57 // Form 2^-57 for scaling
+      nop.f           0
+      add             r_ad3 = 0x90, r_ad1  // Point to ab_table
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_poly_peven_temp2 = sinh_FR_X4, sinh_FR_poly_peven_temp1, sinh_FR_P2 
-         nop.i 999 ;;
+      setf.d          f_RSHF = r_rshf     // Form right shift const 1.100 * 2^63
+      fclass.m        p6,p0 = f8, 0xe3     // Test if x nan, inf
+      add             r_ad4 = 0x2f0, r_ad1 // Point to j_hi_table midpoint
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_peven       = sinh_FR_X4, sinh_FR_poly_peven_temp2, f0         
-         nop.i 999 ;;
+{ .mib
+      add             r_ad2e = 0x20, r_ad1 // Point to p_table
+      nop.i           0
+(p10) br.cond.spnt    SINH_DENORM          // Branch if x denorm
 }
+;;
 
-// Calculate sinh_FR_Y_lo = ax*p_odd + (ax*p_even)
+// Common path -- return here from SINH_DENORM if x is unnorm
+SINH_COMMON:
 { .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_Y_lo_temp    = sinh_FR_X, sinh_FR_peven, f0                    
-         nop.i 999 ;;
+      ldfe            f_smlst_oflow_input = [r_ad2e],16
+      nop.f           0
+      add             r_ad5 = 0x580, r_ad1 // Point to j_lo_table midpoint
 }
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_Y_lo         = sinh_FR_X, sinh_FR_podd,  sinh_FR_Y_lo_temp          
-         nop.i 999 ;;
+{ .mib
+      ldfe            f_log2by64_hi  = [r_ad1],16       
+      and             r_exp_x = r_exp_mask, r_signexp_x
+(p7)  br.ret.spnt     b0                  // Exit if x=0
 }
+;;
 
-// Calculate sinh_FR_SINH = Y_hi + Y_lo. Note that ax = Y_hi
-{ .mfi
-         nop.m 999
-(p0)     fma.s1      sinh_FR_SINH        = sinh_FR_X, f1, sinh_FR_Y_lo                      
-         nop.i 999 ;;
-}
-// Dummy multiply to generate inexact
+// Get the A coefficients for SINH_BY_TBL
 { .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999
+      ldfe            f_A1 = [r_ad3],16            
+      fcmp.lt.s1      p8,p9 = f8,f0           // Test for x<0
+      cmp.lt          p7,p0 = r_exp_x, r_exp_0_25  // Test x < 0.25
 }
-
-// Calculate f8 = sign * (Y_hi + Y_lo)
-// Go to return
 { .mfb
-         nop.m 999
-(p0)     fma.s0        f8 = sinh_FR_SGNX,sinh_FR_SINH,f0                       
-(p0)     br.ret.sptk     b0 ;;                          
-}
-
-
-L(SINH_BY_TBL): 
-
-// Now that we are at TBL; so far all we know is that |x| >= 0.25.
-// The first two steps are the same for TBL and EXP, but if we are HUGE
-// we want to leave now. 
-// Double-extended:
-// Go to HUGE if |x| >= 2^14, 1000d (register-biased) is e = 14 (true)
-// Double
-// Go to HUGE if |x| >= 2^10, 10009 (register-biased) is e = 10 (true)
-// Single
-// Go to HUGE if |x| >= 2^7,  10006 (register-biased) is e =  7 (true)
-
-{ .mlx
-         nop.m 999
-(p0)     movl            r32 = 0x000000000001000d ;;         
-}
-
-{ .mfi
-(p0)     setf.exp        f9 = r32                         
-         nop.f 999
-         nop.i 999 ;;
+      add             r_ad2o = 0x30, r_ad2e  // Point to p_table odd coeffs
+(p6)  fma.s0          f8 = f8,f1,f0          // Result for x nan, inf          
+(p6)  br.ret.spnt     b0                     // Exit for x nan, inf
 }
+;;
 
+// Calculate X2 = ax*ax for SINH_BY_POLY
 { .mfi
-         nop.m 999
-(p0)     fcmp.ge.unc.s1  p6,p7 = sinh_FR_X,f9             
-         nop.i 999 ;;
+      ldfe            f_log2by64_lo  = [r_ad1],16       
+      nop.f           0
+      nop.i           0
 }
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p6)     br.cond.spnt    L(SINH_HUGE) ;;                        
+{ .mfb
+      ldfe            f_A2 = [r_ad3],16            
+      fma.s1          f_X2 = f_NORM_X, f_NORM_X, f0
+(p7)  br.cond.spnt    SINH_BY_POLY
 }
+;;
 
-// r32 = 1
-// r34 = N-1 
-// r35 = N
-// r36 = j
-// r37 = N+1
-
-// TBL can never overflow
-// sinh(x) = sinh(B+R)
-//         = sinh(B)cosh(R) + cosh(B)sinh(R)
-// 
-// ax = |x| = M*log2/64 + R
-// B = M*log2/64
-// M = 64*N + j 
-//   We will calcualte M and get N as (M-j)/64
-//   The division is a shift.
-// exp(B)  = exp(N*log2 + j*log2/64)
-//         = 2^N * 2^(j*log2/64)
-// sinh(B) = 1/2(e^B -e^-B)
-//         = 1/2(2^N * 2^(j*log2/64) - 2^-N * 2^(-j*log2/64)) 
-// sinh(B) = (2^(N-1) * 2^(j*log2/64) - 2^(-N-1) * 2^(-j*log2/64)) 
-// cosh(B) = (2^(N-1) * 2^(j*log2/64) + 2^(-N-1) * 2^(-j*log2/64)) 
-// 2^(j*log2/64) is stored as Tjhi + Tjlo , j= -32,....,32
-// Tjhi is double-extended (80-bit) and Tjlo is single(32-bit)
-// R = ax - M*log2/64
-// R = ax - M*log2_by_64_hi - M*log2_by_64_lo
-// exp(R) = 1 + R +R^2(1/2! + R(1/3! + R(1/4! + ... + R(1/n!)...)
-//        = 1 + p_odd + p_even
-//        where the p_even uses the A coefficients and the p_even uses the B coefficients
-// So sinh(R) = 1 + p_odd + p_even -(1 -p_odd -p_even)/2 = p_odd
-//    cosh(R) = 1 + p_even
-//    sinh(B) = S_hi + S_lo
-//    cosh(B) = C_hi
-// sinh(x) = sinh(B)cosh(R) + cosh(B)sinh(R)
+// Here if |x| >= 0.25
+SINH_BY_TBL: 
 // ******************************************************
-// STEP 1 (TBL and EXP)
+// STEP 1 (TBL and EXP) - Argument reduction
 // ******************************************************
 // Get the following constants. 
-// f9  = Inv_log2by64
-// f10 = log2by64_hi
-// f11 = log2by64_lo
-
-{ .mmi
-(p0)  adds                 r32 = 0x1,r0      
-(p0)  addl           r34   = @ltoff(double_sinh_arg_reduction), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
-}
-;;
+// Inv_log2by64
+// log2by64_hi
+// log2by64_lo
 
 
 // We want 2^(N-1) and 2^(-N-1). So bias N-1 and -N-1 and
 // put them in an exponent.
-// sinh_FR_spos = 2^(N-1) and sinh_FR_sneg = 2^(-N-1)
-// r39 = 0xffff + (N-1)  = 0xffff +N -1
-// r40 = 0xffff - (N +1) = 0xffff -N -1
-
-{ .mlx
-         nop.m 999
-(p0)     movl                r38 = 0x000000000000fffe ;; 
-}
+// f_spos = 2^(N-1) and f_sneg = 2^(-N-1)
+// 0xffff + (N-1)  = 0xffff +N -1
+// 0xffff - (N +1) = 0xffff -N -1
 
-{ .mmi
-(p0)     ldfe            sinh_FR_Inv_log2by64 = [r34],16 ;;       
-(p0)     ldfe            sinh_FR_log2by64_hi  = [r34],16       
-         nop.i 999 ;;
-}
 
-{ .mbb
-(p0)     ldfe            sinh_FR_log2by64_lo  = [r34],16       
-         nop.b 999
-         nop.b 999 ;;
-}
-
-// Get the A coefficients
-// f9  = A_1
-// f10 = A_2
-// f11 = A_3
-
-{ .mmi
-      nop.m 999
-(p0)  addl           r34   = @ltoff(double_sinh_ab_table), gp
-      nop.i 999
-}
-;;
+// Calculate M and keep it as integer and floating point.
+// M = round-to-integer(x*Inv_log2by64)
+// f_M = M = truncate(ax/(log2/64))
+// Put the integer representation of M in r_M
+//    and the floating point representation of M in f_M
 
+// Get the remaining A,B coefficients
 { .mmi
-      ld8 r34 = [r34]
-      nop.m 999
-      nop.i 999
+      ldfe            f_A3 = [r_ad3],16
+      nop.m           0
+      nop.i           0
 }
 ;;
 
-
-// Calculate M and keep it as integer and floating point.
-// f38 = M = round-to-integer(x*Inv_log2by64)
-// sinh_FR_M = M = truncate(ax/(log2/64))
-// Put the significand of M in r35
-//    and the floating point representation of M in sinh_FR_M
-
+.pred.rel "mutex",p8,p9
+// Use constant (1.100*2^(63-6)) to get rounded M into rightmost significand
+// |x| * 64 * 1/ln2 * 2^(63-6) + 1.1000 * 2^(63+(63-6))
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_M      = sinh_FR_X, sinh_FR_Inv_log2by64, f0 
-         nop.i 999
+(p8)  mov             r_signexp_sgnx_0_5 = 0x2fffe // signexp of -0.5
+      fma.s1          f_M_temp = f_ABS_X, f_INV_LN2_2TO63, f_RSHF_2TO57
+(p9)  mov             r_signexp_sgnx_0_5 = 0x0fffe // signexp of +0.5
 }
+;;
 
+// Test for |x| >= overflow limit
 { .mfi
-(p0)     ldfe            sinh_FR_A1 = [r34],16            
-         nop.f 999
-         nop.i 999 ;;
+      ldfe            f_B1 = [r_ad3],16
+      fcmp.ge.s1      p6,p0 = f_ABS_X, f_smlst_oflow_input
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fcvt.fx.s1      sinh_FR_M_temp = sinh_FR_M                      
-         nop.i 999 ;;
+      ldfe            f_B2 = [r_ad3],16
+      nop.f           0
+      mov             r_exp_32 = 0x10004
 }
+;;
 
-{ .mfi
-         nop.m 999
-(p0)     fnorm.s1        sinh_FR_M      = sinh_FR_M_temp                 
-         nop.i 999 ;;
+// Subtract RSHF constant to get rounded M as a floating point value
+// M_temp * 2^(63-6) - 2^63
+{ .mfb
+      ldfe            f_B3 = [r_ad3],16            
+      fms.s1          f_M = f_M_temp, f_2TOM57, f_RSHF
+(p6)  br.cond.spnt    SINH_HUGE  // Branch if result will overflow
 }
+;;
 
 { .mfi
-(p0)     getf.sig        r35       = sinh_FR_M_temp                 
-         nop.f 999
-         nop.i 999 ;;
+      getf.sig        r_M = f_M_temp                 
+      nop.f           0
+      cmp.ge          p7,p6 = r_exp_x, r_exp_32 // Test if x >= 32
 }
+;;
 
-// M is still in r35. Calculate j. j is the signed extension of the six lsb of M. It 
+// Calculate j. j is the signed extension of the six lsb of M. It 
 // has a range of -32 thru 31.
-// r35 = M
-// r36 = j 
-
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p0)     and            r36 = 0x3f, r35 ;;   
-}
 
 // Calculate R
-// f13 = f44 - f12*f10 = ax - M*log2by64_hi
-// f14 = f13 - f8*f11  = R = (ax - M*log2by64_hi) - M*log2by64_lo
-
-{ .mfi
-         nop.m 999
-(p0)     fnma.s1           sinh_FR_R_temp = sinh_FR_M, sinh_FR_log2by64_hi, sinh_FR_X      
-         nop.i 999
-}
+// ax - M*log2by64_hi
+// R = (ax - M*log2by64_hi) - M*log2by64_lo
 
 { .mfi
-(p0)     ldfe            sinh_FR_A2 = [r34],16            
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fnma.s1         f_R_temp = f_M, f_log2by64_hi, f_ABS_X
+      and             r_j = 0x3f, r_M
 }
+;;
 
-{ .mfi
-         nop.m 999
-(p0)     fnma.s1           sinh_FR_R      = sinh_FR_M, sinh_FR_log2by64_lo, sinh_FR_R_temp 
-         nop.i 999
+{ .mii
+      nop.m           0
+      shl             r_jshf = r_j, 0x2 // Shift j so can sign extend it
+;;
+      sxt1            r_jshf = r_jshf
 }
+;;
 
-// Get the B coefficients
-// f15 = B_1
-// f32 = B_2
-// f33 = B_3
-
-{ .mmi
-(p0)     ldfe            sinh_FR_A3 = [r34],16 ;;            
-(p0)     ldfe            sinh_FR_B1 = [r34],16            
-         nop.i 999 ;;
+{ .mii
+      nop.m           0
+      shr             r_j = r_jshf, 0x2    // Now j has range -32 to 31
+      nop.i           0
 }
+;;
 
 { .mmi
-(p0)     ldfe            sinh_FR_B2 = [r34],16 ;;            
-(p0)     ldfe            sinh_FR_B3 = [r34],16            
-         nop.i 999 ;;
-}
-
-{ .mii
-         nop.m 999
-(p0)     shl            r34 = r36,  0x2 ;;   
-(p0)     sxt1           r37 = r34 ;;         
+      shladd          r_ad_J_hi = r_j, 4, r_ad4 // pointer to Tjhi
+      sub             r_Mmj = r_M, r_j          // M-j
+      sub             r_mj = r0, r_j            // Form -j
 }
+;;
 
-// ******************************************************
-// STEP 2 (TBL and EXP)
-// ******************************************************
-// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
-// f12 = R*R*R
-// f13 = R*R
-// f14 = R <== from above
-
+// The TBL and EXP branches are merged and predicated
+// If TBL, p6 true, 0.25 <= |x| < 32
+// If EXP, p7 true, 32 <= |x| < overflow_limit
+//
+// N = (M-j)/64
 { .mfi
-         nop.m 999
-(p0)     fma.s1             sinh_FR_Rsq  = sinh_FR_R,   sinh_FR_R, f0  
-(p0)     shr            r36 = r37,  0x2 ;;   
+      ldfe            f_Tjhi = [r_ad_J_hi]
+      fnma.s1         f_R = f_M, f_log2by64_lo, f_R_temp 
+      shr             r_N = r_Mmj, 0x6            // N = (M-j)/64 
 }
-
-// r34 = M-j = r35 - r36
-// r35 = N = (M-j)/64
-
-{ .mii
-(p0)     sub                  r34 = r35, r36    
-         nop.i 999 ;;
-(p0)     shr                  r35 = r34, 0x6 ;;    
+{ .mfi
+      shladd          r_ad_mJ_hi = r_mj, 4, r_ad4 // pointer to Tmjhi
+      nop.f           0
+      shladd          r_ad_mJ_lo = r_mj, 2, r_ad5 // pointer to Tmjlo
 }
+;;
 
-{ .mii
-(p0)     sub                 r40 = r38, r35           
-(p0)     adds                 r37 = 0x1, r35    
-(p0)     add                 r39 = r38, r35 ;;           
+{ .mfi
+      sub             r_2mNm1 = r_signexp_sgnx_0_5, r_N // signexp sgnx*2^(-N-1)
+      nop.f           0
+      shladd          r_ad_J_lo = r_j, 2, r_ad5   // pointer to Tjlo
 }
-
-// Get the address of the J table, add the offset, 
-// addresses are sinh_AD_mJ and sinh_AD_J, get the T value
-// f32 = T(j)_hi
-// f33 = T(j)_lo
-// f34 = T(-j)_hi
-// f35 = T(-j)_lo
-
-{ .mmi
-(p0)  sub                  r34 = r35, r32    
-(p0)  addl           r37   = @ltoff(double_sinh_j_table), gp
-      nop.i 999
+{ .mfi
+      ldfe            f_Tmjhi = [r_ad_mJ_hi]
+      nop.f           0
+      add             r_2Nm1 = r_signexp_sgnx_0_5, r_N // signexp sgnx*2^(N-1)
 }
 ;;
 
-{ .mmi
-      ld8 r37 = [r37]
-      nop.m 999
-      nop.i 999
+{ .mmf
+      ldfs            f_Tmjlo = [r_ad_mJ_lo]
+      setf.exp        f_sneg = r_2mNm1            // Form sgnx * 2^(-N-1)
+      nop.f           0
 }
 ;;
 
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1             sinh_FR_Rcub = sinh_FR_Rsq, sinh_FR_R, f0  
-         nop.i 999
+{ .mmf
+      ldfs            f_Tjlo  = [r_ad_J_lo]
+      setf.exp        f_spos = r_2Nm1             // Form sgnx * 2^(N-1)
+      nop.f           0
 }
+;;
 
 // ******************************************************
-// STEP 3 Now decide if we need to branch to EXP
+// STEP 2 (TBL and EXP)
 // ******************************************************
-// Put 32 in f9; p6 true if x < 32
-// Go to EXP if |x| >= 32 
+// Calculate Rsquared and Rcubed in preparation for p_even and p_odd
 
-{ .mlx
-         nop.m 999
-(p0)     movl                r32 = 0x0000000000010004 ;;               
+{ .mmf
+      nop.m           0
+      nop.m           0
+      fma.s1          f_Rsq  = f_R, f_R, f0
 }
+;;
 
-// Calculate p_even
-// f34 = B_2 + Rsq *B_3
-// f35 = B_1 + Rsq*f34      = B_1 + Rsq * (B_2 + Rsq *B_3)
-// f36 = p_even = Rsq * f35 = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
-
-{ .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven_temp1 = sinh_FR_Rsq, sinh_FR_B3,          sinh_FR_B2  
-         nop.i 999 ;;
-}
 
+// Calculate p_even
+// B_2 + Rsq *B_3
+// B_1 + Rsq * (B_2 + Rsq *B_3)
+// p_even = Rsq * (B_1 + Rsq * (B_2 + Rsq *B_3))
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven_temp2 = sinh_FR_Rsq, sinh_FR_peven_temp1, sinh_FR_B1  
-         nop.i 999
+      nop.m           0
+      fma.s1          f_peven_temp1 = f_Rsq, f_B3, f_B2
+      nop.i           0
 }
-
 // Calculate p_odd
-// f34 = A_2 + Rsq *A_3
-// f35 = A_1 + Rsq * (A_2 + Rsq *A_3)
-// f37 = podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
-
+// A_2 + Rsq *A_3
+// A_1 + Rsq * (A_2 + Rsq *A_3)
+// podd = R + Rcub * (A_1 + Rsq * (A_2 + Rsq *A_3))
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd_temp1 = sinh_FR_Rsq,        sinh_FR_A3,         sinh_FR_A2  
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_podd_temp1 = f_Rsq, f_A3, f_A2
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)     setf.exp            sinh_FR_N_temp1 = r39            
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_Rcub = f_Rsq, f_R, f0
+      nop.i           0
 }
+;;
 
-{ .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_peven       = sinh_FR_Rsq, sinh_FR_peven_temp2, f0     
-         nop.i 999
-}
+// 
+// If TBL, 
+// Calculate S_hi and S_lo, and C_hi
+// SC_hi_temp = sneg * Tmjhi
+// S_hi = spos * Tjhi - SC_hi_temp
+// S_hi = spos * Tjhi - (sneg * Tmjhi)
+// C_hi = spos * Tjhi + SC_hi_temp
+// C_hi = spos * Tjhi + (sneg * Tmjhi)
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd_temp2 = sinh_FR_Rsq,        sinh_FR_podd_temp1, sinh_FR_A1  
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_SC_hi_temp = f_sneg, f_Tmjhi, f0   
+      nop.i           0
 }
+;;
 
+// If TBL, 
+// S_lo_temp3 = sneg * Tmjlo
+// S_lo_temp4 = spos * Tjlo - S_lo_temp3
+// S_lo_temp4 = spos * Tjlo -(sneg * Tmjlo)
 { .mfi
-(p0)     setf.exp            f9  = r32                              
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_S_lo_temp3 =  f_sneg, f_Tmjlo, f0
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)     fma.s1          sinh_FR_podd       = sinh_FR_podd_temp2, sinh_FR_Rcub,       sinh_FR_R   
-         nop.i 999
+      nop.m           0
+      fma.s1          f_peven_temp2 = f_Rsq, f_peven_temp1, f_B1
+      nop.i           0
 }
-
-// sinh_GR_mj contains the table offset for -j
-// sinh_GR_j  contains the table offset for +j
-// p6 is true when j <= 0
-
-{ .mlx
-(p0)     setf.exp            sinh_FR_N_temp2 = r40            
-(p0)     movl                r40 = 0x0000000000000020 ;;    
-}
-
 { .mfi
-(p0)     sub                 sinh_GR_mJ = r40,  r36           
-(p0)     fmerge.se           sinh_FR_spos    = sinh_FR_N_temp1, f1 
-(p0)     adds                sinh_GR_J  = 0x20, r36 ;;           
-}
-
-{ .mii
-         nop.m 999
-(p0)     shl                  sinh_GR_mJ = sinh_GR_mJ, 5 ;;   
-(p0)     add                  sinh_AD_mJ = r37, sinh_GR_mJ ;; 
-}
-
-{ .mmi
-         nop.m 999
-(p0)     ldfe                 sinh_FR_Tmjhi = [sinh_AD_mJ],16                 
-(p0)     shl                  sinh_GR_J  = sinh_GR_J, 5 ;;    
+      nop.m           0
+      fma.s1          f_podd_temp2 = f_Rsq, f_podd_temp1, f_A1
+      nop.i           0
 }
+;;
 
+// If EXP, 
+// Compute sgnx * 2^(N-1) * Tjhi and sgnx * 2^(N-1) * Tjlo
 { .mfi
-(p0)     ldfs                 sinh_FR_Tmjlo = [sinh_AD_mJ],16                 
-(p0)     fcmp.lt.unc.s1      p0,p7 = sinh_FR_X,f9                          
-(p0)     add                  sinh_AD_J  = r37, sinh_GR_J ;;  
-}
-
-{ .mmi
-(p0)     ldfe                 sinh_FR_Tjhi  = [sinh_AD_J],16 ;;                  
-(p0)     ldfs                 sinh_FR_Tjlo  = [sinh_AD_J],16                  
-         nop.i 999 ;;
-}
-
-{ .mfb
-         nop.m 999
-(p0)     fmerge.se           sinh_FR_sneg    = sinh_FR_N_temp2, f1 
-(p7)     br.cond.spnt        L(SINH_BY_EXP) ;;                            
+      nop.m           0
+(p7)  fma.s1          f_Tjhi_spos = f_Tjhi, f_spos, f0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-         nop.f 999
-         nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s1          f_Tjlo_spos = f_Tjlo, f_spos, f0
+      nop.i           0
 }
-
-// ******************************************************
-// If NOT branch to EXP
-// ******************************************************
-// Calculate S_hi and S_lo
-// sinh_FR_S_hi_temp = sinh_FR_sneg * sinh_FR_Tmjhi
-// sinh_FR_S_hi = sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi_temp
-// sinh_FR_S_hi = sinh_FR_spos * sinh_FR_Tjhi - (sinh_FR_sneg * sinh_FR_Tmjlo)
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_hi_temp = sinh_FR_sneg, sinh_FR_Tmjhi, f0   
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fms.s1          f_S_hi = f_spos, f_Tjhi, f_SC_hi_temp
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_hi = sinh_FR_spos, sinh_FR_Tjhi,  sinh_FR_S_hi_temp              
-         nop.i 999
+      nop.m           0
+(p6)  fma.s1          f_C_hi = f_spos, f_Tjhi, f_SC_hi_temp
+      nop.i           0
 }
-
-// Calculate C_hi
-// sinh_FR_C_hi_temp1 = sinh_FR_sneg * sinh_FR_Tmjhi
-// sinh_FR_C_hi = sinh_FR_spos * sinh_FR_Tjhi + sinh_FR_C_hi_temp1
-
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_C_hi_temp1 = sinh_FR_sneg, sinh_FR_Tmjhi, f0                   
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fms.s1          f_S_lo_temp4 = f_spos, f_Tjlo, f_S_lo_temp3
+      nop.i           0
 }
-
-// sinh_FR_S_lo_temp1 =  sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi
-// sinh_FR_S_lo_temp2 = -sinh_FR_sneg * sinh_FR_Tmjlo + (sinh_FR_spos * sinh_FR_Tjhi - sinh_FR_S_hi)
-// sinh_FR_S_lo_temp2 = -sinh_FR_sneg * sinh_FR_Tmjlo + (sinh_FR_S_lo_temp1              )
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_lo_temp1 =  sinh_FR_spos, sinh_FR_Tjhi,  sinh_FR_S_hi            
-         nop.i 999
+      nop.m           0
+      fma.s1          f_peven = f_Rsq, f_peven_temp2, f0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_C_hi       = sinh_FR_spos, sinh_FR_Tjhi, sinh_FR_C_hi_temp1    
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_podd = f_podd_temp2, f_Rcub, f_R
+      nop.i           0
 }
+;;
+
+// If TBL,
+// S_lo_temp1 =  spos * Tjhi - S_hi
+// S_lo_temp2 = -sneg * Tmjlo + S_lo_temp1
+// S_lo_temp2 = -sneg * Tmjlo + (spos * Tjhi - S_hi)
 
 { .mfi
-         nop.m 999
-(p0)    fnma.s1        sinh_FR_S_lo_temp2 = sinh_FR_sneg, sinh_FR_Tmjhi, sinh_FR_S_lo_temp1       
-         nop.i 999
+      nop.m           0
+(p6)  fms.s1          f_S_lo_temp1 =  f_spos, f_Tjhi,  f_S_hi
+      nop.i           0
 }
-
-// sinh_FR_S_lo_temp1 = sinh_FR_sneg * sinh_FR_Tmjlo
-// sinh_FR_S_lo_temp3 = sinh_FR_spos * sinh_FR_Tjlo - sinh_FR_S_lo_temp1
-// sinh_FR_S_lo_temp3 = sinh_FR_spos * sinh_FR_Tjlo -(sinh_FR_sneg * sinh_FR_Tmjlo)
-// sinh_FR_S_lo = sinh_FR_S_lo_temp3 + sinh_FR_S_lo_temp2
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_lo_temp1 =  sinh_FR_sneg, sinh_FR_Tmjlo, f0                  
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fnma.s1         f_S_lo_temp2 = f_sneg, f_Tmjhi, f_S_lo_temp1       
+      nop.i           0
 }
+;;
 
-/////////// BUG FIX fma to fms -TK
+// If EXP,
+// Y_hi = sgnx * 2^(N-1) * Tjhi
+// Y_lo = sgnx * 2^(N-1) * Tjhi * (p_odd + p_even) + sgnx * 2^(N-1) * Tjlo
 { .mfi
-         nop.m 999
-(p0)    fms.s1         sinh_FR_S_lo_temp3 =  sinh_FR_spos, sinh_FR_Tjlo,  sinh_FR_S_lo_temp1  
-         nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s1          f_Y_lo_temp =  f_peven, f1, f_podd
+      nop.i           0
 }
+;;
 
+// If TBL,
+// S_lo = S_lo_temp4 + S_lo_temp2
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_S_lo       =  sinh_FR_S_lo_temp3, f1,   sinh_FR_S_lo_temp2     
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_S_lo = f_S_lo_temp4, f1, f_S_lo_temp2
+      nop.i           0
 }
+;;
 
+// If TBL,
 // Y_hi = S_hi 
 // Y_lo = C_hi*p_odd + (S_hi*p_even + S_lo)
-// sinh_FR_Y_lo_temp = sinh_FR_S_hi * sinh_FR_peven + sinh_FR_S_lo
-// sinh_FR_Y_lo      = sinh_FR_C_hi * sinh_FR_podd + sinh_FR_Y_lo_temp
-
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_Y_lo_temp  = sinh_FR_S_hi, sinh_FR_peven, sinh_FR_S_lo           
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_Y_lo_temp = f_S_hi, f_peven, f_S_lo
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_Y_lo       =  sinh_FR_C_hi, sinh_FR_podd, sinh_FR_Y_lo_temp      
-         nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s1          f_Y_lo = f_Tjhi_spos, f_Y_lo_temp, f_Tjlo_spos
+      nop.i           0
 }
-
-// sinh_FR_SINH = Y_hi + Y_lo
-// f8 = answer = sinh_FR_SGNX * sinh_FR_SINH
+;;
 
 // Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999
+      nop.m           0
+      fmpy.s0         f_tmp = f_B2, f_B2
+      nop.i           0
 }
 { .mfi
-         nop.m 999
-(p0)    fma.s1         sinh_FR_SINH       =  sinh_FR_S_hi, f1, sinh_FR_Y_lo    
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s1          f_Y_lo = f_C_hi, f_podd, f_Y_lo_temp
+      nop.i           0
 }
+;;
 
-{ .mfb
-         nop.m 999
-(p0)    fma.s0       f8 = sinh_FR_SGNX, sinh_FR_SINH,f0                      
-(p0)    br.ret.sptk     b0 ;;                          
+// f8 = answer = Y_hi + Y_lo
+{ .mfi
+      nop.m           0
+(p7)  fma.s0          f8 = f_Y_lo,  f1, f_Tjhi_spos
+      nop.i           0
 }
+;;
 
+// f8 = answer = Y_hi + Y_lo
+{ .mfb
+      nop.m           0
+(p6)  fma.s0          f8 = f_Y_lo, f1, f_S_hi
+      br.ret.sptk     b0      // Exit for SINH_BY_TBL and SINH_BY_EXP
+}
+;;
 
-L(SINH_BY_EXP): 
 
-// When p7 is true,  we know that an overflow is not going to happen
-// When p7 is false, we must check for possible overflow
-// p7 is the over_SAFE flag
-// Y_hi = Tjhi
-// Y_lo = Tjhi * (p_odd + p_even) +Tjlo
-// Scale = sign * 2^(N-1)
-// sinh_FR_Y_lo =  sinh_FR_Tjhi * (sinh_FR_peven + sinh_FR_podd)
-// sinh_FR_Y_lo =  sinh_FR_Tjhi * (sinh_FR_Y_lo_temp      )
+// Here if 0 < |x| < 0.25
+SINH_BY_POLY: 
+{ .mmf
+      ldfe            f_P6 = [r_ad2e],16
+      ldfe            f_P5 = [r_ad2o],16
+      nop.f           0
+}
+;;
 
-{ .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_Y_lo_temp =  sinh_FR_peven, f1, sinh_FR_podd                   
-         nop.i 999
+{ .mmi
+      ldfe            f_P4 = [r_ad2e],16
+      ldfe            f_P3 = [r_ad2o],16
+      nop.i           0
 }
+;;
 
-// Now we are in EXP. This is the only path where an overflow is possible
-// but not for certain. So this is the only path where over_SAFE has any use.
-// r34 still has N-1
-// There is a danger of double-extended overflow   if N-1 > 16382 = 0x3ffe
-// There is a danger of double overflow            if N-1 > 0x3fe = 1022
-{ .mlx
-         nop.m 999
-(p0)   movl                r32          = 0x0000000000003ffe ;;                       
+{ .mmi
+      ldfe            f_P2 = [r_ad2e],16
+      ldfe            f_P1 = [r_ad2o],16                 
+      nop.i           0
 }
+;;
 
 { .mfi
-(p0)   cmp.gt.unc          p0,p7        = r34, r32                                 
-(p0)   fmerge.s          sinh_FR_SCALE     = sinh_FR_SGNX, sinh_FR_spos                         
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_X3 = f_NORM_X, f_X2, f0
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_Y_lo      =  sinh_FR_Tjhi,  sinh_FR_Y_lo_temp, sinh_FR_Tjlo    
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_X4 = f_X2, f_X2, f0
+      nop.i           0
 }
+;;
 
-// f8 = answer = scale * (Y_hi + Y_lo)
 { .mfi
-         nop.m 999
-(p0)   fma.s1            sinh_FR_SINH_temp = sinh_FR_Y_lo,  f1, sinh_FR_Tjhi       
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_poly65 = f_X2, f_P6, f_P5
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)   fma.s0          f44          = sinh_FR_SCALE,  sinh_FR_SINH_temp, f0      
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_poly43 = f_X2, f_P4, f_P3
+      nop.i           0
 }
+;;
 
-// Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p7)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+      fma.s1          f_poly21 = f_X2, f_P2, f_P1
+      nop.i           0
 }
+;;
 
-// If over_SAFE is set, return
-{ .mfb
-       nop.m 999
-(p7)   fmerge.s            f8 = f44,f44                                            
-(p7)   br.ret.sptk     b0 ;;                          
+{ .mfi
+      nop.m           0
+      fma.s1          f_poly6543 = f_X4, f_poly65, f_poly43
+      nop.i           0
 }
-
-// Else see if we overflowed
-// S0 user supplied status
-// S2 user supplied status + WRE + TD  (Overflows)
-// If WRE is set then an overflow will not occur in EXP.
-// The input value that would cause a register (WRE) value to overflow is about 2^15
-// and this input would go into the HUGE path.
-// Answer with WRE is in f43.
+;;
 
 { .mfi
-         nop.m 999
-(p0)   fsetc.s2            0x7F,0x42                                               
-         nop.i 999;;
+      nop.m           0
+      fma.s1          f_poly6to1 = f_X4, f_poly6543, f_poly21
+      nop.i           0
 }
+;;
 
+// Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p0)   fma.s2            f43  = sinh_FR_SCALE,  sinh_FR_SINH_temp, f0                      
-         nop.i 999 ;;
+      nop.m           0
+      fmpy.s0         f_tmp = f_P6, f_P6
+      nop.i           0
 }
-
-// 13FFF => 13FFF -FFFF = 4000(true)
-// 4000 + 3FFF = 7FFF, which is 1 more that the exponent of the largest
-// long double (7FFE). So 0 13FFF 8000000000000000  is one ulp more than
-// largest long double in register bias
-// Now  set p8 if the answer with WRE is greater than or equal this value
-// Also set p9 if the answer with WRE is less than or equal to negative this value
-
-{ .mlx
-         nop.m 999
-(p0)   movl                r32     = 0x00000000013FFF ;;                              
+{ .mfb
+      nop.m           0
+      fma.s0          f8 = f_poly6to1, f_X3, f_NORM_X
+      br.ret.sptk     b0                // Exit SINH_BY_POLY
 }
+;;
 
-{ .mmf
-         nop.m 999
-(p0)   setf.exp            f41 = r32                                               
-(p0)   fsetc.s2            0x7F,0x40 ;;                                               
-}
 
-{ .mfi
-         nop.m 999
-(p0)   fcmp.ge.unc.s1 p8, p0 =  f43, f41                                           
-         nop.i 999
+// Here if x denorm or unorm
+SINH_DENORM:
+// Determine if x really a denorm and not a unorm
+{ .mmf
+      getf.exp        r_signexp_x = f_NORM_X
+      mov             r_exp_denorm = 0x0c001   // Real denorms have exp < this
+      fmerge.s        f_ABS_X = f0, f_NORM_X
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)   fmerge.ns           f42 = f41, f41                                          
-         nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s0      p10,p0 = f8, f0  // Set denorm flag
+      nop.i           0
 }
+;;
 
-// The error tag for overflow is 126
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p8)   mov                 r47 = 126 ;;                                               
+// Set p8 if really a denorm
+{ .mmi
+      and             r_exp_x = r_exp_mask, r_signexp_x
+;;
+      cmp.lt          p8,p9 = r_exp_x, r_exp_denorm
+      nop.i           0
 }
+;;
 
+// Identify denormal operands.
 { .mfb
-         nop.m 999
-(p0)   fcmp.le.unc.s1      p9, p0 =  f43, f42                                      
-(p8)   br.cond.spnt L(SINH_ERROR_SUPPORT) ;;
-}
-
-{ .mii
-         nop.m 999
-         nop.i 999 ;;
-(p9)   mov                 r47 = 126                                               
-}
-
-{ .mib
-         nop.m 999
-         nop.i 999
-(p9)   br.cond.spnt L(SINH_ERROR_SUPPORT) ;;
+      nop.m           0
+(p8)  fcmp.ge.unc.s1  p6,p7 = f8, f0   // Test sign of denorm
+(p9)  br.cond.sptk    SINH_COMMON    // Return to main path if x unorm
 }
+;;
 
-// Dummy multiply to generate inexact
 { .mfi
-         nop.m 999
-(p0)     fmpy.s0      sinh_FR_tmp = sinh_FR_all_ones, sinh_FR_all_ones
-         nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s0          f8 =  f8,f8,f8  // If x +denorm, result=x+x^2
+      nop.i           0 
 }
-
 { .mfb
-         nop.m 999
-(p0)   fmerge.s            f8 = f44,f44                                            
-(p0)   br.ret.sptk     b0 ;;                          
+      nop.m           0
+(p7)  fnma.s0         f8 =  f8,f8,f8  // If x -denorm, result=x-x^2
+      br.ret.sptk     b0            // Exit if x denorm
 }
+;;
 
-L(SINH_HUGE): 
-
-// for SINH_HUGE, put 24000 in exponent; take sign from input; add 1
-// SAFE: SAFE is always 0 for HUGE
 
-{ .mlx
-         nop.m 999
-(p0)   movl                r32 = 0x0000000000015dbf ;;                                
+// Here if |x| >= overflow limit
+SINH_HUGE: 
+// for SINH_HUGE, put 24000 in exponent; take sign from input
+{ .mmi
+      mov             r_exp_huge = 0x15dbf
+;;
+      setf.exp        f_huge  = r_exp_huge
+      nop.i           0
 }
+;;
 
+.pred.rel "mutex",p8,p9
 { .mfi
-(p0)   setf.exp            f9  = r32                                               
-         nop.f 999
-         nop.i 999 ;;
+      alloc           r32 = ar.pfs,0,5,4,0                  
+(p8)  fnma.s1         f_signed_hi_lo = f_huge, f1, f1
+      nop.i           0
 }
-
 { .mfi
-         nop.m 999
-(p0)   fma.s1              sinh_FR_signed_hi_lo = sinh_FR_SGNX, f9, f1                       
-         nop.i 999 ;;
+      nop.m           0
+(p9)  fma.s1          f_signed_hi_lo = f_huge, f1, f1
+      nop.i           0
 }
+;;
 
 { .mfi
-         nop.m 999
-(p0)   fma.s0            f44 = sinh_FR_signed_hi_lo,  f9, f0                          
-(p0)   mov                 r47 = 126                                               
-}
-.endp sinhl
-ASM_SIZE_DIRECTIVE(sinhl)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__ieee754_sinhl)
-#endif
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
-
-.proc __libm_error_region
-__libm_error_region:
-L(SINH_ERROR_SUPPORT):
+      nop.m           0
+      fma.s0          f_pre_result = f_signed_hi_lo, f_huge, f0
+      mov             GR_Parameter_TAG = 126
+}
+;;
+
+GLOBAL_IEEE754_END(sinhl)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp              // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs                  // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp=-64,sp                            // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP=gp                        // Save gp
 };;
 
-
-// (2)
 { .mmi
-        stfe [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+        stfe [GR_Parameter_Y] = f0,16            // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp               // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0=b0                        // Save b0
 };;
 
 .body
-// (3)
 { .mib
-        stfe [GR_Parameter_X] = f8                     // STORE Parameter 1 on stack
+        stfe [GR_Parameter_X] = f8               // STORE Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y   // Parameter 3 address
         nop.b 0                            
 }
 { .mib
-        stfe [GR_Parameter_Y] = f44                    // STORE Parameter 3 on stack
+        stfe [GR_Parameter_Y] = f_pre_result     // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#          // Call error handling function
+        br.call.sptk b0=__libm_error_support#    // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 
-// (4)
 { .mmi
-        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfe  f8 = [GR_Parameter_RESULT]         // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                         // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                    // Restore return address
 };;
+
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        mov   gp = GR_SAVE_GP                    // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS               // Restore ar.pfs
+        br.ret.sptk     b0                       // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/e_sqrt.S b/sysdeps/ia64/fpu/e_sqrt.S
index dd057f58ee..53e60ef23f 100644
--- a/sysdeps/ia64/fpu/e_sqrt.S
+++ b/sysdeps/ia64/fpu/e_sqrt.S
@@ -1,11 +1,11 @@
 .file "sqrt.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 // 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+// 
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,27 +35,28 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// ********************************************************************
+//********************************************************************
 // History
-// ********************************************************************
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+//********************************************************************
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
-// ********************************************************************
+//********************************************************************
 //
 // Function:   Combined sqrt(x), where
 //                        _
 //             sqrt(x) = |x, for double precision x values
 //
-// ********************************************************************
+//********************************************************************
 //
 // Accuracy:       Correctly Rounded
 //
-// ********************************************************************
+//********************************************************************
 //
 // Resources Used:
 //
@@ -68,7 +69,7 @@
 //
 //    Predicate Registers:      p6, p7, p8
 //
-// *********************************************************************
+//*********************************************************************
 //
 // IEEE Special Conditions:
 //
@@ -78,15 +79,13 @@
 //    sqrt(+/-0) = +/-0
 //    sqrt(negative) = QNaN and error handling is called
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Implementation:
 //
 //  Modified Newton-Raphson Algorithm
 //
-// *********************************************************************
-
-#include "libm_support.h"
+//*********************************************************************
 
 GR_SAVE_PFS          = r33
 GR_SAVE_B0           = r34
@@ -98,19 +97,7 @@ GR_Parameter_RESULT  = r39
 
 
 .section .text
-.proc sqrt#
-.global sqrt#
-.align 64 
-
-sqrt:
-#ifdef _LIBC
-.global __sqrt
-.type __sqrt,@function
-__sqrt:
-.global __ieee754_sqrt
-.type __ieee754_sqrt,@function
-__ieee754_sqrt:
-#endif
+GLOBAL_IEEE754_ENTRY(sqrt)
 { .mfi
   alloc r32= ar.pfs,0,5,4,0
   frsqrta.s0 f7,p6=f8
@@ -255,7 +242,7 @@ __ieee754_sqrt:
 
 { .mfb
   nop.m 0
-  (p0) mov   f8 = f7
+       mov   f8 = f7
   (p8) br.ret.sptk b0 ;;
 }
 { .mfb
@@ -264,12 +251,7 @@ __ieee754_sqrt:
   (p7) br.cond.sptk __libm_error_region ;;
 }
 // END DOUBLE PRECISION MINIMUM LATENCY SQUARE ROOT ALGORITHM
-.endp sqrt#
-ASM_SIZE_DIRECTIVE(sqrt)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__sqrt)
-ASM_SIZE_DIRECTIVE(__ieee754_sqrt)
-#endif
+GLOBAL_IEEE754_END(sqrt)
 
 // Stack operations when calling error support.
 //       (1)               (2)                          (3) (call)              (4)
@@ -286,8 +268,7 @@ ASM_SIZE_DIRECTIVE(__ieee754_sqrt)
 //    save gp                                                                    restore ar.pfs
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 
 //
 // This branch includes all those special values that are not negative,
@@ -352,8 +333,9 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
+
 
 
 .type   __libm_error_support#,@function
diff --git a/sysdeps/ia64/fpu/e_sqrtf.S b/sysdeps/ia64/fpu/e_sqrtf.S
index 1799845d6d..daa20454d7 100644
--- a/sysdeps/ia64/fpu/e_sqrtf.S
+++ b/sysdeps/ia64/fpu/e_sqrtf.S
@@ -1,10 +1,10 @@
 .file "sqrtf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,27 +35,29 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 // History:
 //
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Function:   Combined sqrtf(x), where
 //                         _
 //             sqrtf(x) = |x, for single precision x values
 //
-// ********************************************************************
+//********************************************************************
 //
 // Accuracy:       Correctly Rounded 
 //
-// ********************************************************************
+//********************************************************************
 //
 // Resources Used:
 //
@@ -68,7 +70,7 @@
 //
 //    Predicate Registers:      p6, p7, p8
 //
-// ********************************************************************
+//********************************************************************
 //
 // IEEE Special Conditions:
 //
@@ -78,15 +80,14 @@
 //    sqrtf(+/-0) = +/-0 
 //    sqrtf(negative) = QNaN and error handling is called
 //
-// ********************************************************************
+//********************************************************************
 //
 // Implementation:
 //
 //  Modified Newton-Raphson Algorithm
 //
-// ********************************************************************
+//********************************************************************
 
-#include "libm_support.h"
 
 GR_SAVE_B0                    = r34
 GR_SAVE_PFS                   = r33
@@ -102,21 +103,8 @@ FR_Y             = f0
 FR_RESULT        = f8
 
 
-
 .section .text
-.proc sqrtf#
-.global sqrtf#
-.align 64 
-
-sqrtf: 
-#ifdef _LIBC
-.global __sqrtf
-.type __sqrtf,@function
-__sqrtf:
-.global __ieee754_sqrtf
-.type __ieee754_sqrtf,@function
-__ieee754_sqrtf:
-#endif
+GLOBAL_IEEE754_ENTRY(sqrtf)
 { .mlx
   // BEGIN SINGLE PRECISION MINIMUM LATENCY SQUARE ROOT ALGORITHM
   alloc r32= ar.pfs,0,5,4,0
@@ -197,7 +185,7 @@ __ieee754_sqrtf:
   // Step (10)
   // d1 = a - S1 * S1 in f9
   (p6) fnma.s1 f9=f7,f7,f8
-  nop.i 0;;;
+  nop.i 0;;
 } { .mfb
   nop.m 0
   // Step (11)
@@ -207,27 +195,21 @@ __ieee754_sqrtf:
 // END SINGLE PRECISION MINIMUM LATENCY SQUARE ROOT ALGORITHM
 } { .mfb
   nop.m 0
-  (p0) mov   f8 = f7
+       mov   f8 = f7
   (p8) br.ret.sptk b0 ;;
 }
 //
 // This branch includes all those special values that are not negative,
 // with the result equal to frcpa(x)
 //
-.endp sqrtf
-ASM_SIZE_DIRECTIVE(sqrtf)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__sqrtf)
-ASM_SIZE_DIRECTIVE(__ieee754_sqrtf)
-#endif
+GLOBAL_IEEE754_END(sqrtf)
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mii
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-(p0)    mov   GR_Parameter_TAG = 50                   
+        mov   GR_Parameter_TAG = 50                   
 .save   ar.pfs,GR_SAVE_PFS
         mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
@@ -271,8 +253,7 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };; 
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 
 .type   __libm_error_support#,@function
diff --git a/sysdeps/ia64/fpu/e_sqrtl.S b/sysdeps/ia64/fpu/e_sqrtl.S
index e41148243a..6a5735d45a 100644
--- a/sysdeps/ia64/fpu/e_sqrtl.S
+++ b/sysdeps/ia64/fpu/e_sqrtl.S
@@ -1,10 +1,10 @@
 .file "sqrtl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,23 +35,25 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// ********************************************************************
+//********************************************************************
 //
 // History:
-// 2/02/00 (hand-optimized)
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 (hand-optimized)
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
-// ********************************************************************
+//********************************************************************
 //
 // Function:   Combined sqrtl(x), where
 //                         _
 //             sqrtl(x) = |x, for double-extended precision x values
 //
-// ********************************************************************
+//********************************************************************
 //
 // Resources Used:
 //
@@ -64,7 +66,7 @@
 //
 //    Predicate Registers:      p6, p7, p8
 //
-// ********************************************************************
+//********************************************************************
 //
 // IEEE Special Conditions:
 //
@@ -74,15 +76,13 @@
 //    sqrtl(+/-0) = +/-0
 //    sqrtl(negative) = QNaN and error handling is called
 //
-// ********************************************************************
+//********************************************************************
 //
 // Implementation:
 //
 //  Modified Newton-Raphson Algorithm
 //
-// ********************************************************************
-
-#include "libm_support.h"
+//********************************************************************
 
 GR_SAVE_PFS         = r33
 GR_SAVE_B0          = r34
@@ -97,19 +97,7 @@ FR_Y                = f0
 FR_RESULT           = f8
 
 .section .text
-.proc sqrtl#
-.global sqrtl#
-.align 64
-
-sqrtl:
-#ifdef _LIBC
-.global __sqrtl
-.type __sqrtl,@function
-__sqrtl:
-.global __ieee754_sqrtl
-.type __ieee754_sqrtl,@function
-__ieee754_sqrtl:
-#endif
+GLOBAL_IEEE754_ENTRY(sqrtl)
 { .mlx
 alloc r32= ar.pfs,0,5,4,0
   // exponent of +1/2 in r2
@@ -151,7 +139,7 @@ alloc r32= ar.pfs,0,5,4,0
 } 
 { .mfi
   nop.m 0
-  (p0) mov f15=f8
+       mov f15=f8
   nop.i 0;;
 } { .mfi
   nop.m 0
@@ -221,8 +209,8 @@ alloc r32= ar.pfs,0,5,4,0
   (p6) br.ret.sptk b0 ;;
 }
 { .mfb
-  (p0) mov GR_Parameter_TAG    = 48
-  (p0) mov   f8 = f7
+       mov GR_Parameter_TAG    = 48
+       mov   f8 = f7
   (p8) br.ret.sptk b0 ;;
 }
 //
@@ -232,15 +220,9 @@ alloc r32= ar.pfs,0,5,4,0
 
 
 // END DOUBLE EXTENDED PRECISION MINIMUM LATENCY SQUARE ROOT ALGORITHM
-.endp sqrtl#
-ASM_SIZE_DIRECTIVE(sqrtl)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__sqrtl)
-ASM_SIZE_DIRECTIVE(__ieee754_sqrtl)
-#endif
+GLOBAL_IEEE754_END(sqrtl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -288,7 +270,6 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region#)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/feholdexcpt.c b/sysdeps/ia64/fpu/feholdexcpt.c
index fd13de6c35..27c9a1109e 100644
--- a/sysdeps/ia64/fpu/feholdexcpt.c
+++ b/sysdeps/ia64/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999
 
@@ -31,3 +31,4 @@ feholdexcept (fenv_t *envp)
 
   return 1;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/ia64/fpu/fesetround.c b/sysdeps/ia64/fpu/fesetround.c
index 26a6be4ea3..13801c848b 100644
--- a/sysdeps/ia64/fpu/fesetround.c
+++ b/sysdeps/ia64/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
 
@@ -26,7 +26,7 @@ fesetround (int round)
   fenv_t fpsr;
 
   if (round & ~3)
-    return 0;
+    return 1;
 
   /* Get the current state.  */
   __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
@@ -37,5 +37,6 @@ fesetround (int round)
   /* Put the new state in effect.  */
   __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (fpsr) : "memory");
 
-  return 1;
+  return 0;
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/ia64/fpu/gen_import_file_list b/sysdeps/ia64/fpu/gen_import_file_list
new file mode 100644
index 0000000000..b8bd6a54f3
--- /dev/null
+++ b/sysdeps/ia64/fpu/gen_import_file_list
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+libm_dir=$1
+
+import() {
+	# $1 = name
+	# $2 = source file-name
+	# $3 = destination file-name
+	echo "$1 $libm_dir/$2 $3"
+}
+
+import_c() {
+	# $1 = name
+	# $2 = source file-name
+	# $3 = destination file-name
+	echo "$1 $libm_dir/$2 $3"
+}
+
+dummy_files="
+libm_cpu_defs.h
+libm_error_codes.h
+libm_support.h
+libm_error.c
+"
+
+for f in $dummy_files
+do
+  import_c DUMMY $f $f
+done
+
+import_c scalblnf scalblnf.c s_scalblnf.c
+
+for f in acos acosh asin atanh cosh exp2 exp10 fmod log2 pow remainder \
+	 scalb sinh sqrt; do
+ for t in "" f l; do
+  import $f$t $f$t.s e_$f$t.S
+ done
+done
+
+for f in atan2 exp; do
+ for t in "" f; do
+  import $f$t $f$t.s e_$f$t.S
+ done
+done
+import "atan" atan.s s_atan.S
+import "atanf" atanf.s s_atanf.S
+import "atan(2)?l" atanl.s s_atanl.S
+import "exp(m1)?l" expl_m1.s s_expm1l.S
+
+for t in "" f l; do
+  import "log(10)?$t" log$t.s e_log$t.S
+  import tgamma$t tgamma$t.s w_tgamma$t.S
+  import "(hypot|cabs)$t" hypot$t.s e_hypot$t.S
+done
+
+for f in asinh cbrt ceil erf erfc fabs floor \
+	 ilogb log1p logb modf nearbyint nextafter nexttoward \
+	 rint round significand fdim fma fmax tanh trunc; do
+ for t in "" f l; do
+  import $f$t $f$t.s s_$f$t.S
+ done
+done
+
+for t in "" f l; do
+  import "(tan|cot)$t" tancot$t.s s_tan$t.S
+done
+
+for t in "" f l; do
+  import "(sin|cos)$t" sincos$t.s s_cos$t.S
+  import_c frexp$t frexp$t.c s_frexp$t.c
+  import_c ldexp$t ldexp$t.c s_ldexp$t.c
+  import_c scalbn$t scalbn$t.c s_scalbn$t.c
+done
+
+import expm1 exp_m1.s s_expm1.S
+import expm1f expf_m1.s s_expm1f.S
+
+for f in frexp frexpf frexpl reduce; do
+  import __libm_$f libm_$f.s libm_$f.S
+done
+
+for t in "" f l; do
+  import __libm_ldexp$t libm_ldexp$t.s s_libm_ldexp$t.S
+  import "(__libm_)?(sincos|cis)$t" libm_sincos$t.s libm_sincos$t.S
+  import __libm_lgamma$t libm_lgamma$t.s libm_lgamma$t.S
+  import __libm_scalbn$t libm_scalbn$t.s s_libm_scalbn$t.S
+done
+import __libm_scalblnf libm_scalblnf.s libm_scalblnf.S
+import "__libm_(sin|cos|sincos)_large" libm_sincos_large.s \
+	libm_sincos_large.S
diff --git a/sysdeps/ia64/fpu/import_check b/sysdeps/ia64/fpu/import_check
new file mode 100644
index 0000000000..21176f578d
--- /dev/null
+++ b/sysdeps/ia64/fpu/import_check
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+objdir="$1"
+
+num_errors=0
+
+check_syms() {
+    global_count=0
+    entry_count=0
+    while read value type name; do
+	if [ $value = "U" ]; then
+	    name=$type
+	    # undefined symbols must start with double-underscore
+	    if [ $(expr $name : '\(..\)') != "__" ]; then
+		echo -e "$(basename $file):\tError: undefined reference $name doesn't start with \"__\"."
+		num_errors=$(($num_errors + 1))
+	    fi
+	    continue
+	fi
+
+	case "$type" in
+	    W)
+		entry_count=$(($entry_count + 1))
+		;;
+	    *)
+		entry_count=$(($entry_count + 1))
+		if [ "$(expr $name : '\(..\)')" != "__" ]; then
+		    global_count=$(($global_count + 1))
+		fi
+		;;
+	esac
+    done
+    if [ $entry_count -gt 1 -a $global_count -gt 0 ]; then
+	echo -e "$(basename $file):\tError: detected $global_count strong " \
+	    "global and $entry_count entry-points."
+	num_errors=$(($num_errors + 1))
+    fi
+}
+
+check_file() {
+    file=$1
+    size=$(readelf -S $file | \
+	(sz=0; while read line; do
+		if echo $line | fgrep -q " .rodata"; then
+		    read sz rest
+		    break
+		fi
+	    done;
+	    printf "%d" 0x$sz))
+
+    summands=$(readelf -s $file | fgrep " OBJECT " | tr -s ' ' |
+	cut -f4 -d' ' | sed 's,$,+,')0
+    sum=$(($summands))
+    if [ $sum != $size ]; then
+	echo -e "$(basename $file):\tError: sum of objects=$sum bytes, .rodata size=$size bytes"
+	num_errors=$(($num_errors + 1))
+    fi
+
+    tmp=$(tempfile -p syms)
+    nm -g $file > $tmp
+    check_syms < $tmp
+}
+
+do_checks() {
+    echo "Note: 1 error expected in w_tgammal.o due to 64-byte alignment-padding."
+    while read func_pattern src_file dst_file; do
+	if [ "$(expr $dst_file : '.*\(S\)$')" = "S" ]; then
+	    objfile=$(expr $dst_file : '\(.*\)[.]S$')
+	    check_file $objdir/$objfile.o
+	fi
+    done
+}
+
+do_checks < import_file_list
+
+if [ $num_errors -gt 0 ]; then
+    echo "FAILURE: Detected $num_errors error(s)."
+    exit 1
+fi
+echo SUCCESS
+exit 0
diff --git a/sysdeps/ia64/fpu/import_diffs b/sysdeps/ia64/fpu/import_diffs
new file mode 100644
index 0000000000..147280d5fd
--- /dev/null
+++ b/sysdeps/ia64/fpu/import_diffs
@@ -0,0 +1,7 @@
+#!/bin/sh
+do_diffs() {
+    while read func_pattern src_file dst_file; do
+	diff -up $src_file $dst_file
+    done
+}
+do_diffs < import_file_list
diff --git a/sysdeps/ia64/fpu/import_file.awk b/sysdeps/ia64/fpu/import_file.awk
new file mode 100644
index 0000000000..97fe77e181
--- /dev/null
+++ b/sysdeps/ia64/fpu/import_file.awk
@@ -0,0 +1,151 @@
+BEGIN {
+	getline;
+	while (!match($0, "^/[/*] static char cvs_id")) {
+		print;
+		getline;
+	}
+	getline;
+	while (!match($0, "^// WARRANTY DISCLAIMER")) {
+		print;
+		if (!getline) {
+			break;
+		}
+	}
+	if (getline)
+	{
+		printf								      \
+"// Redistribution and use in source and binary forms, with or without\n"     \
+"// modification, are permitted provided that the following conditions are\n" \
+"// met:\n"								      \
+"//\n"									      \
+"// * Redistributions of source code must retain the above copyright\n"	      \
+"// notice, this list of conditions and the following disclaimer.\n"	      \
+"//\n"									      \
+"// * Redistributions in binary form must reproduce the above copyright\n"    \
+"// notice, this list of conditions and the following disclaimer in the\n"    \
+"// documentation and/or other materials provided with the distribution.\n"   \
+"//\n"									      \
+"// * The name of Intel Corporation may not be used to endorse or promote\n"  \
+"// products derived from this software without specific prior written\n"     \
+"// permission.\n\n";
+		if (LICENSE_ONLY == "y") {
+			do {
+				print;
+			} while (getline);
+		}
+	}
+}
+
+/^[.]data/ {
+	print "RODATA";
+	next;
+}
+/^([a-zA-Z_0-9]*_(tb[l0-9]|Tt|[tT]able|data|low|coeffs|constants|CONSTANTS|reduction|Stirling)(_?([1-9cdimpqstPQT]+|tail))?|(Constants|Poly|coeff)_.+|(double_sin_?cos|double_cis)[fl]?_.+):/ {
+	table_name=substr($1,1,length($1)-1);
+	printf "LOCAL_OBJECT_START(%s)\n", table_name;
+	getline;
+	while (!match($0, "^[ \t]*data")) {
+		print;
+		getline;
+	}
+	while (match($0, "(//|^[ \t]*data)")) {
+		print;
+		getline;
+	}
+	printf "LOCAL_OBJECT_END(%s)\n\n", table_name;
+	next;
+}
+/^[.]proc[ \t]+__libm_(error_region|callout)/ {
+	printf "LOCAL_LIBM_ENTRY(%s)\n", $2;
+	getline;
+	next;
+}
+/^[.]endp[ \t]+__libm_(error_region|callout)/ {
+	printf "LOCAL_LIBM_END(%s)\n", $2;
+	next;
+}
+/^[.]global/ {
+	split($2, part, "#");
+	name=part[1];
+	if (match(name, "^"FUNC"$")) {
+		next;
+	}
+}
+/^[.]proc/ {
+	split($2, part, "#");
+	name=part[1];
+	if (match(name, "^"FUNC"$")) {
+		local_funcs=("^("			\
+			     "cis|cisf|cisl"		\
+			     "|cabs|cabsf|cabsl"	\
+			     "|cot|cotf|cotl"		\
+			     ")$");
+		ieee754_funcs=("^("					  \
+			       "atan2|atan2f|atan2l|atanl"		  \
+			       "|cos|cosf|cosl"				  \
+			       "|cosh|coshf|coshl"			  \
+			       "|exp|expf|expl"				  \
+			       "|exp10|exp10f|exp10l"			  \
+			       "|expm1|expm1f|expm1l"			  \
+			       "|fmod|fmodf|fmodl"			  \
+			       "|hypot|hypotf|hypotl"			  \
+			       "|fabs|fabsf|fabsl"			  \
+			       "|floor|floorf|floorl"			  \
+			       "|log1p|log1pf|log1pl"			  \
+			       "|log|log10|log10f|log10l|log2l|logf|logl" \
+			       "|remainder|remainderf|remainderl|"	  \
+			       "|rint|rintf|rintl|"			  \
+			       "|scalb|scalbf|scalbl"			  \
+			       "|sin|sinf|sinl"				  \
+			       "|sincos|sincosf|sincosl"		  \
+			       "|sinh|sinhf|sinhl"			  \
+			       "|sqrt|sqrtf|sqrtl"			  \
+			       "|tan|tanf|tanl"				  \
+			       ")$");
+		if (match(name, ieee754_funcs)) {
+			type="GLOBAL_IEEE754";
+		} else if (match (name, local_funcs)) {
+			type="LOCAL_LIBM";
+		} else {
+			type="GLOBAL_LIBM";
+		}
+		printf "%s_ENTRY(%s)\n", type, name;
+		getline;
+		while (!match($0, "^"name"#?:")) {
+			getline;
+		}
+		getline;
+		while (!match($0, "^.endp")) {
+			print
+			getline;
+		}
+		printf "%s_END(%s)\n", type, name;
+		if (match(name, "^exp10[fl]?$")) {
+			t=substr(name,6)
+			printf "weak_alias (exp10%s, pow10%s)\n", t, t
+		}
+		next;
+	}
+}
+/^[a-zA-Z_]+:/ {
+	split($1, part, ":");
+	name=part[1];
+	if (match(name, "^"FUNC"$")) {
+		printf "GLOBAL_LIBM_ENTRY(%s)\n", name;
+		getline;
+		while (!match($0, "^"name"#?:")) {
+			getline;
+		}
+		getline;
+		while (!match($0, "^.endp")) {
+			print
+			getline;
+		}
+		getline;
+		printf "GLOBAL_LIBM_END(%s)\n", name;
+		next;
+	}
+}
+
+{ print }
+
diff --git a/sysdeps/ia64/fpu/import_intel_libm b/sysdeps/ia64/fpu/import_intel_libm
new file mode 100644
index 0000000000..1aaa646a93
--- /dev/null
+++ b/sysdeps/ia64/fpu/import_intel_libm
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+# Notes:
+
+#  We don't import copysign finite, fpclassify, isinf, isnan, and signbit
+#  since our own versions are nicer and just as correct and fast (except
+#  perhaps that they don't handle non-finite arguments well?).
+#
+#  Also, leave out cabs for now since it doesn't seem overridable in
+#  glibc.
+
+libm_dir=$1
+
+import_s() {
+	# $1 = name
+	# $2 = source file-name
+	# $3 = destination file-name
+	echo "Importing $1 from $2 -> $3"
+	rm -f $3
+	awk -f import_file.awk FUNC=$1 $2 > $3
+}
+
+import_c() {
+	# $1 = name
+	# $2 = source file-name
+	# $3 = destination file-name
+	echo "Importing $1 from $2 -> $3"
+	rm -f $3
+	awk -f import_file.awk LICENSE_ONLY=y $2 > $3
+}
+
+do_imports() {
+    while read func_pattern src_file dst_file; do
+        case $src_file in
+	*.[ch])
+	    import_c "$func_pattern" "$src_file" "$dst_file"
+	    ;;
+	*)
+	    import_s "$func_pattern" "$src_file" "$dst_file"
+	    ;;
+	esac
+    done
+}
+
+./gen_import_file_list $libm_dir > import_file_list
+
+do_imports < import_file_list
+
+emptyfiles="
+e_gamma_r.c
+e_gammaf_r.c
+e_gammal_r.c
+s_sincos.c
+s_sincosf.c
+s_sincosl.c
+t_exp.c
+w_acosh.c
+w_acoshf.c
+w_acoshl.c
+w_atanh.c
+w_atanhf.c
+w_atanhl.c
+w_exp10.c
+w_exp10f.c
+w_exp10l.c
+w_exp2.c
+w_exp2f.c
+w_exp2l.c
+w_expl.c
+w_lgamma_r.c
+w_lgammaf_r.c
+w_lgammal_r.c
+w_log2.c
+w_log2f.c
+w_log2l.c
+w_sinh.c
+w_sinhf.c
+w_sinhl.c
+"
+for f in $emptyfiles
+do
+  rm -f $f
+  echo "/* Not needed. */" > $f
+done
+
+removedfiles="
+libm_atan2_reg.S
+s_ldexp.S
+s_ldexpf.S
+s_ldexpl.S
+s_scalbn.S
+s_scalbnf.S
+s_scalbnl.S
+"
+
+rm -f $removedfiles
+
+for f in lgammaf_r.c lgammal_r.c lgamma_r.c
+do
+  import_c $f $libm_dir/$f e_$f
+done
+
+for f in lgamma.c lgammaf.c lgammal.c
+do
+  import_c $f $libm_dir/$f w_$f
+done
diff --git a/sysdeps/ia64/fpu/libm-symbols.h b/sysdeps/ia64/fpu/libm-symbols.h
new file mode 100644
index 0000000000..5b5e4b7d7b
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm-symbols.h
@@ -0,0 +1,64 @@
+#include <sysdep.h>
+#undef ret	/* get rid of the stupid "ret" macro; it breaks br.ret */
+
+/* Support for compatible assembler handling.  */
+
+#ifdef __ELF__
+# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+# define ASM_TYPE_DIRECTIVE(name,T) .type name,T
+#else
+# define ASM_SIZE_DIRECTIVE(name)
+# define ASM_TYPE_DIRECTIVE(name,T)
+#endif
+
+#define LOCAL_LIBM_ENTRY(name)			\
+	.proc name;				\
+ name:
+
+#define LOCAL_LIBM_END(name)			\
+	.endp name;				\
+ ASM_SIZE_DIRECTIVE(name)
+
+
+#define RODATA		.rodata
+#define LOCAL_OBJECT_START(name)		\
+   name:;					\
+   ASM_TYPE_DIRECTIVE(name, @object)
+#define LOCAL_OBJECT_END(name)			\
+   ASM_SIZE_DIRECTIVE(name)
+
+#define GLOBAL_LIBM_ENTRY(name)			\
+	LOCAL_LIBM_ENTRY(name);			\
+	.global name
+#define GLOBAL_LIBM_END(name)		LOCAL_LIBM_END(name)
+
+#define INTERNAL_LIBM_ENTRY(name)		\
+	GLOBAL_LIBM_ENTRY(__libm_##name);	\
+	.global __libm_##name
+#define INTERNAL_LIBM_END(name)		GLOBAL_LIBM_END(__libm_##name)
+
+#define WEAK_LIBM_ENTRY(name)			\
+	.align 32;				\
+	LOCAL_LIBM_ENTRY(__##name);		\
+	.global __##name;			\
+ __##name:
+#define WEAK_LIBM_END(name)			\
+ weak_alias (__##name, name);			\
+ .hidden __##name;				\
+	LOCAL_LIBM_END(__##name);		\
+ ASM_SIZE_DIRECTIVE(__##name);			\
+ ASM_TYPE_DIRECTIVE(__##name, @function)
+
+#define GLOBAL_IEEE754_ENTRY(name)		\
+	WEAK_LIBM_ENTRY(name);			\
+	.global __ieee754_##name;		\
+	.hidden __ieee754_##name;		\
+ __ieee754_##name:
+#define GLOBAL_IEEE754_END(name)			\
+	WEAK_LIBM_END(name);				\
+ ASM_SIZE_DIRECTIVE(__ieee754_##name);			\
+ ASM_TYPE_DIRECTIVE(__ieee754_##name, @function)
+
+#if defined ASSEMBLER && !defined NOT_IN_libc
+# define __libm_error_support	HIDDEN_JUMPTARGET(__libm_error_support)
+#endif
diff --git a/sysdeps/ia64/fpu/libm-test-ulps b/sysdeps/ia64/fpu/libm-test-ulps
index 2f67d213b4..c5a2a08549 100644
--- a/sysdeps/ia64/fpu/libm-test-ulps
+++ b/sysdeps/ia64/fpu/libm-test-ulps
@@ -8,14 +8,14 @@ ildouble: 2
 ldouble: 2
 
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
 ildouble: 7
 ldouble: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 idouble: 1
 ildouble: 1
@@ -253,8 +253,8 @@ double: 1
 float: 4
 idouble: 1
 ifloat: 4
-ildouble: 1
-ldouble: 1
+ildouble: 6
+ldouble: 6
 Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
 ildouble: 1
 ldouble: 1
@@ -451,21 +451,26 @@ ifloat: 1
 # j0
 Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 2
 ldouble: 2
 Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 2
+double: 3
 float: 1
-idouble: 2
+idouble: 3
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 2
 ldouble: 2
 Test "j0 (8.0) == 0.171650807137553906090869407851972001":
@@ -488,21 +493,26 @@ idouble: 1
 # jn
 Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 2
 ldouble: 2
 Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 2
+double: 3
 float: 1
-idouble: 2
+idouble: 3
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 2
 ldouble: 2
 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
@@ -543,8 +553,8 @@ ifloat: 1
 ildouble: 2
 ldouble: 2
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 3
-ifloat: 3
+float: 4
+ifloat: 4
 ildouble: 1
 ldouble: 1
 Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
@@ -563,16 +573,16 @@ ildouble: 1
 ldouble: 1
 Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
 double: 3
-float: 1
+float: 2
 idouble: 3
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 ildouble: 1
 ldouble: 1
 
@@ -685,6 +695,8 @@ ldouble: 1
 
 # y1
 Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
 ildouble: 1
 ldouble: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
@@ -692,6 +704,11 @@ double: 3
 float: 1
 idouble: 3
 ifloat: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323";
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (2.0) == -0.107032431540937546888370772277476637":
 double: 1
 float: 1
@@ -737,6 +754,8 @@ ifloat: 1
 ildouble: 1
 ldouble: 1
 Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
 ildouble: 1
 ldouble: 1
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
@@ -744,6 +763,11 @@ double: 3
 float: 1
 idouble: 3
 ifloat: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323";
+float: 1
+ifloat: 1
+ldouble: 1
+ildouble: 1
 Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
 double: 1
 float: 1
@@ -757,6 +781,8 @@ float: 2
 idouble: 1
 ifloat: 2
 Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
 ildouble: 2
 ldouble: 2
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
@@ -769,13 +795,17 @@ float: 2
 ifloat: 2
 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
 double: 2
+float: 2
 idouble: 2
+ifloat: 2
 Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
 double: 3
 float: 1
 idouble: 3
 ifloat: 1
 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
 ildouble: 1
 ldouble: 1
 Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
@@ -926,8 +956,8 @@ double: 2
 float: 5
 idouble: 2
 ifloat: 5
-ildouble: 3
-ldouble: 3
+ildouble: 6
+ldouble: 6
 
 Function: Imaginary part of "cpow":
 double: 2
@@ -1028,10 +1058,10 @@ float: 1
 ifloat: 1
 
 Function: "j0":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
 ildouble: 2
 ldouble: 2
 
@@ -1045,9 +1075,9 @@ ldouble: 1
 
 Function: "jn":
 double: 3
-float: 3
+float: 4
 idouble: 3
-ifloat: 3
+ifloat: 4
 ildouble: 2
 ldouble: 2
 
diff --git a/sysdeps/ia64/fpu/libm_atan2_reg.S b/sysdeps/ia64/fpu/libm_atan2_reg.S
deleted file mode 100644
index 5649670d19..0000000000
--- a/sysdeps/ia64/fpu/libm_atan2_reg.S
+++ /dev/null
@@ -1,1234 +0,0 @@
-.file "libm_atan2_reg.s"
-
-// Copyright (C) 2000, 2001, Intel Corporation
-// All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * The name of Intel Corporation may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
-//
-// History
-//==============================================================
-// 2/02/00: Initial version
-// 4/04/00  Unwind support added
-
-#include "libm_support.h"
-
-.data
-
-.align 64
-ASM_TYPE_DIRECTIVE(Constants_atan#,@object)
-Constants_atan:
-data4   0x54442D18, 0x3FF921FB, 0x248D3132, 0x3E000000
-// double pi/2, single lo_pi/2, two**(-3)
-data4   0xAAAAAAA3, 0xAAAAAAAA, 0x0000BFFD, 0x00000000 // P_1
-data4   0xCCCC54B2, 0xCCCCCCCC, 0x00003FFC, 0x00000000 // P_2
-data4   0x47E4D0C2, 0x92492492, 0x0000BFFC, 0x00000000 // P_3
-data4   0x58870889, 0xE38E38E0, 0x00003FFB, 0x00000000 // P_4
-data4   0x290149F8, 0xBA2E895B, 0x0000BFFB, 0x00000000 // P_5
-data4   0x250F733D, 0x9D88E6D4, 0x00003FFB, 0x00000000 // P_6
-data4   0xFB8745A0, 0x884E51FF, 0x0000BFFB, 0x00000000 // P_7
-data4   0x394396BD, 0xE1C7412B, 0x00003FFA, 0x00000000 // P_8
-data4   0xAAAAA52F, 0xAAAAAAAA, 0x0000BFFD, 0x00000000 // Q_1
-data4   0xC75B60D3, 0xCCCCCCCC, 0x00003FFC, 0x00000000 // Q_2
-data4   0x011F1940, 0x924923AD, 0x0000BFFC, 0x00000000 // Q_3
-data4   0x2A5F89BD, 0xE36F716D, 0x00003FFB, 0x00000000 // Q_4
-//      Entries Tbl_hi  (double precision)
-//      B = 1+Index/16+1/32  Index = 0
-//      Entries Tbl_lo (single precision)
-//      B = 1+Index/16+1/32  Index = 0
-data4   0xA935BD8E, 0x3FE9A000, 0x23ACA08F, 0x00000000
-// Entries Tbl_hi  (double precision) Index = 0,1,...,15
-// B = 2^(-1)*(1+Index/16+1/32)
-// Entries Tbl_lo (single precision)
-// Index = 0,1,...,15  B = 2^(-1)*(1+Index/16+1/32)
-data4   0x7F175A34, 0x3FDE77EB, 0x238729EE, 0x00000000
-data4   0x73C1A40B, 0x3FE0039C, 0x249334DB, 0x00000000
-data4   0x5B5B43DA, 0x3FE0C614, 0x22CBA7D1, 0x00000000
-data4   0x88BE7C13, 0x3FE1835A, 0x246310E7, 0x00000000
-data4   0xE2CC9E6A, 0x3FE23B71, 0x236210E5, 0x00000000
-data4   0x8406CBCA, 0x3FE2EE62, 0x2462EAF5, 0x00000000
-data4   0x1CD41719, 0x3FE39C39, 0x24B73EF3, 0x00000000
-data4   0x5B795B55, 0x3FE44506, 0x24C11260, 0x00000000
-data4   0x5BB6EC04, 0x3FE4E8DE, 0x242519EE, 0x00000000
-data4   0x1F732FBA, 0x3FE587D8, 0x24D4346C, 0x00000000
-data4   0x115D7B8D, 0x3FE6220D, 0x24ED487B, 0x00000000
-data4   0x920B3D98, 0x3FE6B798, 0x2495FF1E, 0x00000000
-data4   0x8FBA8E0F, 0x3FE74897, 0x223D9531, 0x00000000
-data4   0x289FA093, 0x3FE7D528, 0x242B0411, 0x00000000
-data4   0x576CC2C5, 0x3FE85D69, 0x2335B374, 0x00000000
-data4   0xA99CC05D, 0x3FE8E17A, 0x24C27CFB, 0x00000000
-//
-//      Entries Tbl_hi  (double precision) Index = 0,1,...,15
-//      B = 2^(-2)*(1+Index/16+1/32)
-//      Entries Tbl_lo (single precision)
-//      Index = 0,1,...,15  B = 2^(-2)*(1+Index/16+1/32)
-//
-data4   0x510665B5, 0x3FD025FA, 0x24263482, 0x00000000
-data4   0x362431C9, 0x3FD1151A, 0x242C8DC9, 0x00000000
-data4   0x67E47C95, 0x3FD20255, 0x245CF9BA, 0x00000000
-data4   0x7A823CFE, 0x3FD2ED98, 0x235C892C, 0x00000000
-data4   0x29271134, 0x3FD3D6D1, 0x2389BE52, 0x00000000
-data4   0x586890E6, 0x3FD4BDEE, 0x24436471, 0x00000000
-data4   0x175E0F4E, 0x3FD5A2E0, 0x2389DBD4, 0x00000000
-data4   0x9F5FA6FD, 0x3FD68597, 0x2476D43F, 0x00000000
-data4   0x52817501, 0x3FD76607, 0x24711774, 0x00000000
-data4   0xB8DF95D7, 0x3FD84422, 0x23EBB501, 0x00000000
-data4   0x7CD0C662, 0x3FD91FDE, 0x23883A0C, 0x00000000
-data4   0x66168001, 0x3FD9F930, 0x240DF63F, 0x00000000
-data4   0x5422058B, 0x3FDAD00F, 0x23FE261A, 0x00000000
-data4   0x378624A5, 0x3FDBA473, 0x23A8CD0E, 0x00000000
-data4   0x0AAD71F8, 0x3FDC7655, 0x2422D1D0, 0x00000000
-data4   0xC9EC862B, 0x3FDD45AE, 0x2344A109, 0x00000000
-//
-//      Entries Tbl_hi  (double precision) Index = 0,1,...,15
-//      B = 2^(-3)*(1+Index/16+1/32)
-//      Entries Tbl_lo (single precision)
-//      Index = 0,1,...,15  B = 2^(-3)*(1+Index/16+1/32)
-//
-data4   0x84212B3D, 0x3FC068D5, 0x239874B6, 0x00000000
-data4   0x41060850, 0x3FC16465, 0x2335E774, 0x00000000
-data4   0x171A535C, 0x3FC25F6E, 0x233E36BE, 0x00000000
-data4   0xEDEB99A3, 0x3FC359E8, 0x239680A3, 0x00000000
-data4   0xC6092A9E, 0x3FC453CE, 0x230FB29E, 0x00000000
-data4   0xBA11570A, 0x3FC54D18, 0x230C1418, 0x00000000
-data4   0xFFB3AA73, 0x3FC645BF, 0x23F0564A, 0x00000000
-data4   0xE8A7D201, 0x3FC73DBD, 0x23D4A5E1, 0x00000000
-data4   0xE398EBC7, 0x3FC8350B, 0x23D4ADDA, 0x00000000
-data4   0x7D050271, 0x3FC92BA3, 0x23BCB085, 0x00000000
-data4   0x601081A5, 0x3FCA217E, 0x23BC841D, 0x00000000
-data4   0x574D780B, 0x3FCB1696, 0x23CF4A8E, 0x00000000
-data4   0x4D768466, 0x3FCC0AE5, 0x23BECC90, 0x00000000
-data4   0x4E1D5395, 0x3FCCFE65, 0x2323DCD2, 0x00000000
-data4   0x864C9D9D, 0x3FCDF110, 0x23F53F3A, 0x00000000
-data4   0x451D980C, 0x3FCEE2E1, 0x23CCB11F, 0x00000000
-data4   0x54442D18, 0x400921FB, 0x33145C07, 0x3CA1A626 // I two doubles
-data4   0x54442D18, 0x3FF921FB, 0x33145C07, 0x3C91A626 // I_by_2 two dbls
-data4   0x54442D18, 0x3FE921FB, 0x33145C07, 0x3C81A626 // I_by_4 two dbls
-data4   0x7F3321D2, 0x4002D97C, 0x4C9E8A0A, 0x3C9A7939 // 3I_by_4 two dbls
-ASM_SIZE_DIRECTIVE(Constants_atan#)
-.section .text
-
-.proc __libm_atan2_reg#
-.global __libm_atan2_reg#
-.align 64
-__libm_atan2_reg:
-
-
-{ .mfi
-       alloc  r32 = ar.pfs,0,20,4,0
-(p0)   mov f32 = f8
-       nop.i 0
-} 
-{ .mmi
-      nop.m 0
-(p0)  addl           r39   = @ltoff(Constants_atan#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 r39 = [r39]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-{ .mfi
-       nop 999	// EMbo added ...
-(p0)   mov f33 = f9
- nop.i 0
- } { .mfi
-       nop 999	// EMbo added ...
-(p0)   fclass.nm.unc p9,p0 = f32 ,0x1FF
-       nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.nm.unc p8,p0 = f33 ,0x1FF
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc  p6,p0 = f33 ,0x103
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc  p7,p0 = f32 ,0x103
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc p12,p0 = f33 ,0x0C3
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     Check for NatVals.
-//     Check for EM Unsupporteds
-//     Check for NaNs.
-//
-(p0)   fclass.m.unc p13,p0 = f32 ,0x0C3
-(p6)   br.cond.sptk L(ATAN_NATVAL);;
- } { .mbb
-	nop 999	// EMbo added ...
-(p7)   br.cond.sptk L(ATAN_NATVAL)
-(p8)   br.cond.sptk L(ATAN_UNSUPPORTED);;
- } { .mib
-(p0)   add r40 = 96, r39
-	nop 999	// EMbo added ...
-(p9)   br.cond.sptk L(ATAN_UNSUPPORTED);;
- } { .mib
-(p0)   ldfd  f50 = [r39],8
-	nop 999	// EMbo added ...
-(p12)  br.cond.sptk L(ATAN_NAN);;
- } { .mfb
-	nop 999	// EMbo added ...
-(p0)   fnorm.s1 f33 = f33
-(p13)  br.cond.sptk L(ATAN_NAN);;
- } { .mfi
-(p0)   ldfs  f51 = [r39],4
-//
-//     Remove sign bits from exponents
-//     Load 2**(-3)
-//     Normalize the input argument.
-//
-(p0)   fnorm.s1 f32 = f32
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   mov f82 = f1
-	nop 999;;	// EMbo added ...
- } { .mmi
-	nop 999;;	// EMbo added ...
-(p0)   ldfs  f78 = [r39],180
-	nop 999;;	// EMbo added ...
- } { .mmi
-(p0)   getf.exp r36 = f33;;
-//
-//     Get exp and sign of ArgX
-//     Get exp and sign of ArgY
-//     Load 2**(-3) and increment ptr to Q_4.
-//
-(p0)   getf.exp r37 = f32
-(p0)   shr.u r36 = r36,17;;
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmerge.s f84 =  f1,f32
-(p0)   shr.u r37 = r37,17;;
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     ArgX_abs = |ArgX|
-//     ArgY_abs = |ArgY|
-//     sign_X is sign bit of ArgX
-//     sign_Y is sign bit of ArgY
-//
-(p0)   fmerge.s f83 =  f1,f33
-(p0)   cmp.eq.unc  p8,p9 = 0x00000, r37;;
- } { .mfi
-	nop 999	// EMbo added ...
-(p8)   fadd.s1 f34 = f0, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p9)   fsub.s1 f34 = f0, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmin.s1 f36 = f83, f84
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmax.s1 f35 = f83, f84
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     Is ArgX_abs >= ArgY_abs
-//     Is sign_Y == 0?
-//
-(p0)   fcmp.ge.s1  p6,p7 = f83,f84
-	nop 999;;	// EMbo added ...
- } { .mii
-(p6)   cmp.eq.unc  p10, p11 =  0x00000, r36
-(p6)   add r38 = r0, r0;;
-//
-//     U = max(ArgX_abs,ArgY_abs)
-//     V = min(ArgX_abs,ArgY_abs)
-//     if p6, swap = 0
-//     if p7, swap = 1
-//
-//
-//     Let M = 1.0
-//     if p8, s_Y = 1.0
-//     if p9, s_Y = -1.0
-//
-(p7)   add r38 = 1,r0;;
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   frcpa.s1 f37, p6 =  f36, f35
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     E = frcpa(V,U)
-//
-(p10)  fsub.s1 f82 = f82, f1
-(p6)   br.cond.sptk L(ATAN_STEP2);;
- } { .mib
-	nop 999	// EMbo added ...
-	nop 999	// EMbo added ...
-// /**************************************************/
-// /********************* STEP2 **********************/
-// /**************************************************/
-(p0)   br.cond.spnt L(ATAN_SPECIAL_HANDLING);;
- }
-L(ATAN_STEP2):
- { .mlx
-	nop 999	// EMbo added ...
-(p0)   movl r47 =  0x8400000000000000
- } { .mlx
-	nop 999	// EMbo added ...
-(p0)   movl r48 =  0x0000000000000100;;
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f38 = f37, f36
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fcmp.lt.unc.s0  p0,p9 = f9,f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fcmp.lt.unc.s0  p0,p8 = f8,f1
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     Q = E * V
-//
-(p11)  fadd.s1 f82 = f82, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-(p0)   getf.sig r46 = f38
-(p0)   fcmp.lt.unc p6,p7 = f38,f78
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f38 = f37, f36
-(p0)   extr.u r42 = r46, 59, 4;;
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f50 = f82, f50
-(p0)   dep r47 = r42, r47, 59, 4
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f51 = f82, f51
-	nop 999;;	// EMbo added ...
- } { .mmi
-	nop 999;;	// EMbo added ...
-//
-//     Is Q < 2**(-3)?
-//
-//
-//     Do fcmp to raise any denormal operand
-//     exceptions.
-//
-(p0)   getf.exp r45 = f38
-	nop 999;;	// EMbo added ...
- } { .mib
-//
-//     lookup = b_1 b_2 b_3 B_4
-//
-//
-//     Generate 1.b_1 b_2 b_3 b_4 1 0 0 0 ... 0
-//
-(p0)   andcm r41 = 0x0003, r45
-	nop 999	// EMbo added ...
-//
-//     We waited a few extra cycles so P_lo and P_hi could be calculated.
-//     Load the constant 256 for loading up table entries.
-//
-//    /**************************************************/
-//    /********************* STEP3 **********************/
-//    /**************************************************/
-(p6)   br.cond.spnt L(ATAN_POLY);;
- } { .mii
-(p0)   setf.sig f39 = r47
-(p0)   cmp.eq.unc  p8, p9 =  0x0000, r41
-//
-//     z_hi = s exp 1.b_1 b_2 b_3 b_4 1 0 0 0 ... 0
-//     point to beginning of Tbl_hi entries - k = 0.
-//
-(p0)   add r40 = 16, r39
- } { .mmi
-(p0)   ldfe f73 = [r39],-16;;
-(p9)   sub r41 = r41,r0,1
-(p9)   add r40 = 16,r40
- } { .mfi
-(p8)   ldfd  f48 = [r40],8
-(p0)   fmpy.s1 f50 = f34, f50
-(p0)   xor r38 = r36,r38;;
- } { .mmi
-(p0)   ldfe f71 = [r39],-16;;
-(p8)   ldfs  f49 = [r40],8
-(p9)   pmpy2.r r41 = r41,r48;;
- } { .mfi
-(p0)   ldfe f69 = [r39],-16
-//
-//     Let z_hi have exponent and sign of original Q
-//     Load the Tbl_hi(0) else, increment pointer.
-//
-(p0)   fmerge.se f39 =  f38,f39
-(p9)   shladd r42 = r42,0x0004,r41;;
- } { .mmi
-(p9)   add r40 = r40, r42;;
-(p9)   ldfd  f48 = [r40],8
-	nop 999;;	// EMbo added ...
- } { .mmi
-(p0)   ldfe f67 = [r39],-16;;
-(p9)   ldfs  f49 = [r40],8
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     U_prime_hi = U + V * z_hi
-//     Load the Tbl_lo(0)
-//
-(p0)   fma.s1 f40 = f36, f39, f35
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fnma.s1 f42 = f35, f39, f36
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   mov f52 = f48
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   frcpa.s1 f43, p6 =  f1, f40
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     U_prime_lo = U - U_prime_hi
-//     k = k * 256 - result can be 0, 256, or 512.
-//
-(p0)   fsub.s1 f41 = f35, f40
-(p0)   cmp.eq.unc  p7, p6 =  0x00000, r38
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f52 = f34, f52
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p7)   fadd.s1 f54 = f0, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fsub.s1 f54 = f0, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fnma.s1 f80 = f43, f40, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fadd.s1 f79 = f41, f40
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f41 = f36, f39, f41
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f56 = f54, f52, f50
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f43 = f80, f43, f43
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     U_prime_lo =  U - U_hold
-//     lookup -> lookup * 16 + k
-//
-//
-//     V_prime =  V - U * z_hi
-//     U_prime_lo =  V * z_hi + U_prime_lo
-//
-(p0)   fsub.s1 f79 = f35, f79
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fnma.s1 f80 = f43, f40, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     C_hi = frcpa(1,U_prime_hi)
-//     U_prime_lo = U_prime_lo + U_hold
-//
-//
-//     C_hi_hold = 1 - C_hi * U_prime_hi (1)
-//
-//
-//     C_hi = C_hi + C_hi * C_hi_hold    (1)
-//
-//
-//     C_hi_hold = 1 - C_hi * U_prime_hi (2)
-//
-(p0)   fadd.s1 f41 = f41, f79
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     C_hi = C_hi + C_hi * C_hi_hold    (2)
-//
-(p0)   fma.s1 f43 = f80, f43, f43
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     C_hi_hold = 1 - C_hi * U_prime_hi (3)
-//
-(p0)   fnma.s1 f80 = f43, f40, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     C_hi = C_hi + C_hi * C_hi_hold    (3)
-//
-(p0)   fma.s1 f43 = f80, f43, f43
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     w_hi = V_prime * C_hi
-//
-(p0)   fmpy.s1 f44 = f42, f43
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f46 = f44, f44
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     wsq = w_hi * w_hi
-//     w_lo =  = V_prime - w_hi * U_prime_hi
-//
-(p0)   fnma.s1 f45 = f44, f40, f42
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f47 = f46, f73, f71
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     poly = Q_3 + wsq * Q_4
-//     w_lo =  = w_lo - w_hi * U_prime_lo
-//
-(p0)   fnma.s1 f45 = f44, f41, f45
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f47 = f46, f47, f69
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     poly = Q_2 + wsq * poly
-//     w_lo =  = w_lo * C_hi
-//
-(p0)   fmpy.s1 f45 = f43, f45
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f47 = f46, f47, f67
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     poly = Q_1 + wsq * poly
-//     A_lo = Tbl_lo + w_lo
-//     swap = xor(swap,sign_X)
-//
-(p0)   fadd.s1 f53 = f49, f45
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     Is (swap) != 0 ?
-//     poly = wsq * poly
-//     A_hi = Tbl_hi
-//
-(p0)   fmpy.s1 f47 = f46, f47
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     poly = wsq * poly
-//
-//
-//     if (p6) sigma = -1.0
-//     if (p7) sigma =  1.0
-//
-(p0)   fmpy.s1 f47 = f44, f47
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     P_hi = s_Y * P_hi
-//     A_lo = A_lo + poly
-//
-(p0)   fadd.s1 f53 = f53, f47
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     A_lo = A_lo + w_hi
-//     A_hi = s_Y * A_hi
-//
-(p0)   fadd.s1 f53 = f53, f44
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     result_hi = P_hi + sigma * A_hi
-//     result_lo = P_lo + sigma * A_lo
-//
-(p0)   fma.s1 f55 = f54, f53, f51
-(p0)   br.cond.sptk L(RETURN_ATAN);;
-} 
-//
-//     result  =  result_hi + result_lo * s_Y  (User Supplied Rounding Mode)
-//
-//     (p0)   fma.d.s0 f57 = f55, f34, f56
-//
-// /**************************************************/
-// /********************* STEP4 **********************/
-// /**************************************************/
-//
-L(ATAN_POLY):
-{ .mmi
-(p0)   xor r38 = r36,r38
-(p0)  addl           r39   = @ltoff(Constants_atan#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 r39 = [r39]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-
-{ .mlx
-	nop 999	// EMbo added ...
-(p0)   movl r47 =  0x24005;;
- } { .mfi
-(p0)   add r39 = 128, r39
-(p0)   fnma.s1 f81 = f37, f35, f1
-(p0)   cmp.eq.unc  p7, p6 =  0x00000, r38;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f77 = [r39],-16
-//
-//     Iterate 3 times E = E + E*(1.0 - E*U)
-//     Also load P_8, P_7, P_6, P_5, P_4
-//     E_hold = 1.0 - E * U     (1)
-//     A_temp = Q
-//
-(p0)   mov f85 = f38;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f76 = [r39],-16
-(p6)   fsub.s1 f54 = f0, f1;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f75 = [r39],-16
-//
-//     E = E + E_hold*E         (1)
-//     Point to P_8.
-//
-(p0)   fma.s1 f37 = f37, f81, f37;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f74 = [r39],-16
-(p0)   fnma.s1 f64 = f85, f35, f36;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f72 = [r39],-16
-(p7)   fadd.s1 f54 = f0, f1;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f70 = [r39],-16
-//
-//     E_hold = 1.0 - E * U     (2)
-//
-(p0)   fnma.s1 f81 = f37, f35, f1;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f68 = [r39],-16
-(p0)   fmpy.s1 f50 = f34, f50;;
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfe f66 = [r39],-16
-(p0)   fmpy.d.s0 f67 = f67, f67
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     E = E + E_hold*E         (2)
-//
-(p0)   fma.s1 f37 = f37, f81, f37
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     E_hold = 1.0 - E * U     (3)
-//
-(p0)   fnma.s1 f81 = f37, f35, f1
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     E = E + E_hold*E         (3)
-//     At this point E approximates 1/U to roughly working precision
-//     z = V*E approximates V/U
-//
-(p0)   fma.s1 f37 = f37, f81, f37
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     z =   V * E
-//
-(p0)   fmpy.s1 f59 = f36, f37
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f64 = f64, f37
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     zsq = z * z
-//     Also load P_3
-//
-(p0)   fmpy.s1 f60 = f59, f59
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fadd.s1 f52 = f85, f64
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f62 = f60, f77, f76
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f63 = f60, f70, f68
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     z8 = zsq * zsq
-//     Also load P_2
-//
-(p0)   fmpy.s1 f61 = f60, f60
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fsub.s1 f85 = f85, f52
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmerge.s  f65 = f52,f52
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f62 = f60, f62, f75
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f63 = f60, f63, f66
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     z8 = z8 * z8
-//     Also load P_1
-//     poly1 = _4 + zsq*(P_5 + zsq*(P_6 + zsq*(P_7 + zsq*P_8)))
-//     poly2 = zsq*(P_1 + zsq*(P_2 + zsq*P_3))
-//
-//
-//     poly1 = P_7 + zsq * P_8
-//     poly2 = P_2 + zsq * P_3
-//     poly1 = P_4 + zsq*(P_5 + zsq*(P_6 + zsq*poly1))
-//     poly2 = zsq*(P_1 + zsq*poly2)
-//
-//
-//     poly1 = P_6 + zsq * poly1
-//     poly2 = P_1 + zsq * poly2
-//     poly1 = P_4 + zsq*(P_5 + zsq*poly1)
-//     poly2 = zsq*poly2
-//
-(p0)   fmpy.s1 f61 = f61, f61
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fadd.s1 f64 = f85, f64
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f62 = f60, f62, f74
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     poly1 = P_5 + zsq * poly1
-//     poly2 = zsq * poly2
-//     poly1 = P_4 + zsq*poly1
-//
-(p0)   fmpy.s1 f63 = f63, f60
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     poly1 = P_4 + zsq * poly1
-//     swap = xor(swap,sign_X)
-//
-(p0)   fma.s1 f62 = f60, f62, f72
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     poly = z8*poly1 + poly2  (Typo in writeup)
-//     Is (swap) != 0 ?
-//
-//
-//     z_lo = V - A_temp * U
-//     if (p7) sigma =  1.0
-//     Writeup shows A_temp as A_hi
-//
-//
-//     z_lo = z_lo * E
-//     if (p6) sigma = -1.0
-//     z_lo = (V - A_temp * U) *E
-//
-//
-//     Fixup added to force inexact later -
-//     A_hi = A_temp + z_lo
-//     z_lo = (A_temp - A_hi) + z_lo
-//     z_lo = A_hi - z_lo -A_hi + z_lo = about 0
-//
-(p0)   fma.s1 f47 = f61, f62, f63
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     A_lo = z * poly + z_lo
-//
-(p0)   fma.s1 f53 = f59, f47, f64
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fadd.s1  f52 = f65, f53
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fsub.s1  f65 = f65, f52
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fmpy.s1 f52 = f34, f52
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fadd.s1  f53 = f65, f53
-	nop 999	// EMbo added ...
- } { .mfi
-(p0)   setf.exp f65 = r47
-(p0)   fma.s1 f56 = f54, f52, f50
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc  p6,p0 = f53,0x007
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     P_hi = s_Y * P_hi
-//     A_hi = s_Y * A_hi
-//
-//
-//     result_hi = P_hi + sigma * A_hi
-//
-(p6)   mov f53 = f65
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     tmp = P_hi - result_hi
-//
-(p0)   fsub.s1 f65 = f50, f56
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fma.s1 f65 = f52, f54, f65
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     tmp   = sigma * A_hi  + tmp
-//     sigma = A_lo * sigma  + P_lo
-//
-(p0)   fma.s1 f54 = f53, f54, f51
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     result_lo = s_Y * sigma + tmp
-//
-(p0)   fma.s1 f55 = f34, f54, f65
-	nop 999;;	// EMbo added ...
- } { .mfb
-       nop.m 0
-       mov f34 = f1
-(p0)   br.cond.sptk L(RETURN_ATAN);;
-}
-//
-//     result  =  result_hi + result_lo  (User Supplied Rounding Mode)
-//
-//     (p0)   fadd.d.s0 f57 = f55, f56
-L(ATAN_UNSUPPORTED):
-L(ATAN_NATVAL):
- { .mfb
-	nop 999	// EMbo added ...
-//
-//     Deal with the NatVal and unsupported cases.
-//     Raise invalid if warrented.
-//
-(p0)   fmpy.d.s0 f57 = f8, f9
-br.cond.sptk L(RETURN_ATAN);;
- }
-L(ATAN_NAN):
- { .mfb
-	nop 999	// EMbo added ...
-//
-//     If only one NaN, then generate the resulting
-//     NaN and return - may raise invalid.
-//
-(p0)   fmpy.d.s0 f57 = f8, f9
-(p0)   br.cond.sptk L(RETURN_ATAN);;
- }
-L(ATAN_SPECIAL_HANDLING):
-
- { .mmf
-(p0)   addl           r39   = @ltoff(Constants_atan#), gp
-       nop.m 999
-(p0)   fcmp.lt.s0 p0,p7 = f8,f1
- } 
-;;
-
-//
-//     Raise denormal operand faults if necessary
-//
-
-{ .mfi
-       ld8 r39 = [r39]
-(p0)   fcmp.lt.s0 p0,p6 = f9,f1
-	nop 999;;	// EMbo added ...
-} 
-;;
-
-
-
-{ .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc p6,p7 = f32,0x007
-	nop 999;;	// EMbo added ...
- } { .mlx
-	nop 999	// EMbo added ...
-(p0)   movl r47 = 992;;
- } { .mib
-(p0)   add r39 = r39, r47
-	nop 999	// EMbo added ...
-(p7)   br.cond.sptk L(ATAN_ArgY_Not_ZERO);;
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fclass.m.unc p14,p0 = f33,0x035
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fclass.m.unc p15,p0 = f33,0x036
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fclass.m.unc p13,p0 = f33,0x007
-	nop 999	// EMbo added ...
- } { .mfi
-(p0)   ldfd  f56 = [r39],8
-	nop 999	// EMbo added ...
-	nop 999;;	// EMbo added ...
- } { .mfi
-(p0)   ldfd  f55 = [r39],-8
-(p14)  fmerge.s f56 =  f32,f0
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     Return sign_Y * 0 when Y = +/-0 and X > 0
-//
-(p14)  fmerge.s f55 =  f32,f0
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p15)  fmerge.s f56 =  f32,f56
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     Return sign_Y * PI when X <  -0
-//
-//
-(p15)  fmerge.s f55 =  f32,f55
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fadd.d.s0 f57 = f56,f55
-      nop.i 0
- } { .bbb
-//
-//     Call error support function for atan(0,0)
-//     - expected value already computed.
-//
-    nop.b 0
-    nop.b 0
-(p0)  br.cond.sptk L(RETURN_ATAN)
- }
-L(ATAN_ArgY_Not_ZERO):
- { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc p9,p10 = f32,0x023
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-(p9)   fclass.m.unc p6,p0 = f33,0x017
-(p10)  br.cond.sptk L(ATAN_ArgY_Not_INF);;
- } { .mfi
-(p6)   add r39 = 16,r39
-(p9)   fclass.m.unc p7,p0 = f33,0x021
-	nop 999;;	// EMbo added ...
- } { .mmf
-	nop 999	// EMbo added ...
-(p0)   ldfd  f56 = [r39],8
-(p9)   fclass.m.unc p8,p0 = f33,0x022;;
- } { .mbb
-(p0)   ldfd  f55 = [r39],-8
-	nop 999	// EMbo added ...
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fmerge.s f56 =  f32,f56
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fmerge.s f55 =  f32,f55
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     Load I/2 and adjust its sign.
-//     Return +I/2 when ArgY = +Inf and ArgX = +/-0,normal
-//     Return -I/2 when ArgY = -Inf and ArgX = +/-0,normal
-//
-(p6)   fadd.d.s0  f57 =   f56,  f55
-(p6)   br.cond.sptk L(RETURN_ATAN);;
- } { .mmi
-(p7)   add r39 = 32,r39;;
-(p7)   ldfd  f56 = [r39],8
-	nop 999;;	// EMbo added ...
- } { .mmi
-	nop 999;;	// EMbo added ...
-(p7)   ldfd  f55 = [r39],-8
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p7)   fmerge.s f56 =  f32,f56
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p7)   fmerge.s f55 =  f32,f55
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     Load PI/4 and adjust its sign.
-//     Return +PI/4 when ArgY = +Inf and ArgX = +Inf
-//     Return -PI/4 when ArgY = -Inf and ArgX = +Inf
-//
-(p7)   fadd.d.s0  f57 =   f56,  f55
-(p7)   br.cond.sptk L(RETURN_ATAN);;
- } { .mmi
-(p8)   add r39 = 48,r39;;
-(p8)   ldfd f56 =[r39],8
-	nop 999;;	// EMbo added ...
- } { .mmi
-	nop 999;;	// EMbo added ...
-(p8)   ldfd f55 =[r39],-8
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p8)   fmerge.s f56 =  f32,f56
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p8)   fmerge.s f55 =  f32,f55
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     Load I/4 and adjust its sign.
-//     Return +3I/4 when ArgY = +Inf and ArgX = -Inf
-//     Return -3I/4 when ArgY = -Inf and ArgX = -Inf
-//
-(p8)   fadd.d.s0  f57 =   f56,  f55
-(p8)   br.cond.sptk L(RETURN_ATAN);;
- }
-L(ATAN_ArgY_Not_INF):
- { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc  p6,p0 = f33,0x007
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc  p7,p0 = f33,0x021
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p0)   fclass.m.unc  p8,p0 = f33,0x022
-(p6)   add r39 = 16,r39;;
- } { .mfi
-(p6)   ldfd f56 =[r39],8
-	nop 999	// EMbo added ...
-	nop 999;;	// EMbo added ...
- } { .mmi
-	nop 999;;	// EMbo added ...
-(p6)   ldfd f55 =[r39],-8
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fmerge.s f56 =  f32,f56
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p6)   fmerge.s f55 =  f32,f55
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     return = sign_Y * I/2 when ArgX = +/-0
-//
-(p6)   fadd.d.s0 f57 = f56, f55
-(p6)   br.cond.sptk L(RETURN_ATAN);;
- } { .mfi
-	nop 999	// EMbo added ...
-(p7)   fmerge.s f56 =  f32,f0
-	nop 999	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p7)   fmerge.s f55 =  f32,f0
-	nop 999;;	// EMbo added ...
- } { .mfb
-	nop 999	// EMbo added ...
-//
-//     return = sign_Y * 0 when ArgX = Inf
-//
-(p7)   fadd.d.s0 f57 = f56, f55
-(p7)   br.cond.sptk L(RETURN_ATAN);;
- } { .mfi
-(p8)   ldfd f56 = [r39],8
-	nop 999	// EMbo added ...
-	nop 999;;	// EMbo added ...
- } { .mmi
-	nop 999;;	// EMbo added ...
-(p8)   ldfd f55 = [r39],-8
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p8)   fmerge.s f56 =  f32,f56
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-(p8)   fmerge.s f55 =  f32,f55
-	nop 999;;	// EMbo added ...
- } { .mfi
-	nop 999	// EMbo added ...
-//
-//     return = sign_Y * I when ArgX = -Inf
-//
-(p8)   fadd.d.s0  f57 =   f56,  f55
-	nop 999	// EMbo added ...
- };;
-L(RETURN_ATAN):
-// mov    f8     = f57 ;;
-// The answer is in f57.
-// But Z_hi is f56
-//     Z_lo is f55
-//     s_Y  is f34
-//     W is in f9 and untouched
-
-{ .mfi
-	nop 999	
-mov    f8     = f56
-        nop.i 0
-};;
-
-{ .mfi
-	nop 999	
-mov    f10    = f55
-        nop.i 999
-}
-{ .mfb
-	nop 999	
-mov    f11    = f34
-br.ret.sptk   b0
-};;
-
-.endp __libm_atan2_reg
-ASM_SIZE_DIRECTIVE(__libm_atan2_reg)
diff --git a/sysdeps/ia64/fpu/libm_cpu_defs.h b/sysdeps/ia64/fpu/libm_cpu_defs.h
new file mode 100644
index 0000000000..516128c404
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_cpu_defs.h
@@ -0,0 +1,156 @@
+/* file: libm_cpu_defs.h */
+ 
+ 
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+
+#ifndef __LIBM_CPU_DEFS__H_INCLUDED__
+#define __LIBM_CPU_DEFS__H_INCLUDED__
+
+void __libm_sincos_pi4(double,double*,double*,int);
+void __libm_y0y1(double , double *, double *);
+void __libm_j0j1(double , double *, double *);
+double __libm_j0(double);
+double __libm_j1(double);
+double __libm_jn(int,double);
+double __libm_y0(double);
+double __libm_y1(double);
+double __libm_yn(int,double);
+
+double __libm_copysign (double, double);
+float __libm_copysignf (float, float);
+long double __libm_copysignl (long double, long double);
+
+extern double sqrt(double);
+extern double fabs(double);
+extern double log(double);
+extern double log1p(double);
+extern double sqrt(double);
+extern double sin(double);
+extern double exp(double);
+extern double modf(double, double *);
+extern double asinh(double);
+extern double acosh(double);
+extern double atanh(double);
+extern double tanh(double);
+extern double erf(double);
+extern double erfc(double);
+extern double j0(double);
+extern double j1(double);
+extern double jn(int, double);
+extern double y0(double);
+extern double y1(double);
+extern double yn(int, double);
+
+extern float  fabsf(float);
+extern float  asinhf(float);
+extern float  acoshf(float);
+extern float  atanhf(float);
+extern float  tanhf(float);
+extern float  erff(float);
+extern float  erfcf(float);
+extern float  j0f(float);
+extern float  j1f(float);
+extern float  jnf(int, float);
+extern float  y0f(float);
+extern float  y1f(float);
+extern float  ynf(int, float);
+
+extern long double log1pl(long double);
+extern long double logl(long double);
+extern long double sqrtl(long double);
+extern long double expl(long double);
+extern long double fabsl(long double);
+
+#if !(defined(SIZE_LONG_INT_32) || defined(SIZE_LONG_INT_64))
+#error long int size not established; define SIZE_LONG_INT_32 or SIZE_LONG_INT_64
+#endif
+
+#if (defined(SIZE_LONG_INT_32) && defined(SIZE_LONG_INT_64))
+#error multiple long int size definitions; define SIZE_LONG_INT_32 or SIZE_LONG_INT_64
+#endif
+
+#if !(defined(SIZE_LONG_LONG_INT_32) || defined(SIZE_LONG_LONG_INT_64))
+#error long long int size not established; define SIZE_LONG_LONG_INT_32 or SIZE_LONG_LONG_INT_64
+#endif
+
+#if (defined(SIZE_LONG_LONG_INT_32) && defined(SIZE_LONG_LONG_INT_64))
+#error multiple long long int size definitions; define SIZE_LONG_LONG_INT_32 or SIZE_LONG_LONG_INT_64
+#endif
+
+#define HI_SIGNIFICAND_LESS(X, HI) ((X)->hi_significand < 0x ## HI)
+#define f64abs(x) ((x) < 0.0 ? -(x) : (x))
+
+#define FP80_DECLARE()
+#define FP80_SET()
+#define FP80_RESET()
+
+#ifdef _LIBC
+# include <math.h>
+#else
+
+static const unsigned INF[] = {
+    DOUBLE_HEX(7ff00000, 00000000),
+    DOUBLE_HEX(fff00000, 00000000)
+};
+
+static const double _zeroo = 0.0;
+static const double _bigg = 1.0e300;
+static const double _ponee = 1.0;
+static const double _nonee = -1.0;
+
+#define INVALID    (_zeroo * *((double*)&INF[0]))
+#define PINF       *((double*)&INF[0])
+#define NINF       -PINF
+#define PINF_DZ    (_ponee/_zeroo)
+#define X_TLOSS    1.41484755040568800000e+16
+#endif
+
+/* Set these appropriately to make thread Safe */
+#define ERRNO_RANGE  errno = ERANGE
+#define ERRNO_DOMAIN errno = EDOM
+
+#ifndef _LIBC
+#if defined(__ICC) || defined(__ICL) || defined(__ECC) || defined(__ECL)
+# pragma warning( disable : 68 )	/* #68: integer conversion resulted in a change of sign */
+# pragma warning( disable : 186 )	/* #186: pointless comparison of unsigned integer with zero */
+# pragma warning( disable : 1572 )	/* #1572: floating-point equality and inequality comparisons are unreliable */
+#endif
+#endif
+
+#endif    /*__LIBM_CPU_DEFS__H_INCLUDED__*/
diff --git a/sysdeps/ia64/fpu/libm_error.c b/sysdeps/ia64/fpu/libm_error.c
index ebbaad02ad..8ef4bb5a73 100644
--- a/sysdeps/ia64/fpu/libm_error.c
+++ b/sysdeps/ia64/fpu/libm_error.c
@@ -1,9 +1,10 @@
-//
-// Copyright (C) 2000, 2001, Intel Corporation
+/* file: libm_error.c */
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story, James
-// Edwards, and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -19,6 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
+
 //
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -34,7 +36,7 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
@@ -47,45 +49,84 @@
 // 12/07/00: Added code to make scalbn error support equivalent to ldexp.
 //  2/07/01: Added __declspec(align(16)) to long double constants to correct
 //           alignment problem.
-//
+//  4/23/01: Added code for remquo
+//  6/07/01: Added code for fdim, lrint, lround, llrint, llround
+//           Deleted code for remquo
+//  8/15/01: Added code for scalbln, nexttoward
+// 12/10/01: Added code for erfc
+// 12/27/01: Added code for degree argument functions
+// 01/02/02: Added code for tand, cotd
+// 01/15/02: Corrected SVID/XOPEN code for log1p, pow, and acosh
+// 01/25/02: Corrected ISOC for lgamma and gamma to return EDOM for neg ints
+// 01/28/02: Corrected SVID/XOPEN stderr message for log2
+// 05/20/02: Added code for cot
+// 07/01/02: Added code for sinhcosh
+// 10/04/02: Underflow detection in ISOC path redefined to
+//           be zero rather than tiny and inexact
+// 12/06/02: Added code for annuity and compound
+// 01/30/03: Corrected test for underflow in ISOC path to not set denormal
+// 04/10/03: Corrected ISOC branch for gamma/lgamma to return ERANGE for neg ints.
+//           Added code for tgamma
+// 04/11/03: Corrected POSIX/SVID/XOPEN branches for gamma/lgamma
+//           to return EDOM for neg ints.
+// 09/08/03: Corrected XOPEN/SVID result for pow overflow with neg x, pos y.
+// 10/14/03: Added ILP32 ifdef
+// 12/12/03: Corrected XOPEN/SVID results for powf_zero_to_negative,
+//           powl_neg_to_non_integer, atan2f_zero, atan2df_zero,
+//           acoshf_lt_one, acosh_lt_one.
+// 12/07/04: Cast name strings as char *.
+// 12/08/04: Corrected POSIX behavior for atan2_zero, acos_gt_one, asin_gt_one,
+//           log_negative, log10_negative, log1p_negative, and log2_negative.
+//           Added SVID and XOPEN case log2l_zero.
+// 12/13/04: Corrected POSIX behavior for exp2_overflow, exp2_underflow,
+//           exp10_overflow, exp10_underflow.  Added ISOC to set errno for
+//           exp10_underflow.
+// 12/14/04: Corrected POSIX behavior for nextafter_overflow,
+//           nextafter_underflow, nexttoward_overflow, nexttoward_underflow.
+//           Added ISOC to set errno for nextafter and nexttoward underflow.
+// 12/15/04: Corrected POSIX behavior for exp, exp2, and exp10 underflow.
+// 03/31/05: Added missing ALIGNIT statement to 6 float constants.
 
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include "libm_support.h"
 
-#ifndef _LIBC
+#ifdef _LIBC
+# define pmatherr matherr
+# define pmatherrf matherrf
+# define pmatherrl matherrl
+#else
 _LIB_VERSION_TYPE
 #if defined( __POSIX__ )
-_LIB_VERSION = _POSIX_;
+_LIB_VERSIONIMF = _POSIX_;
 #elif defined( __XOPEN__ )
-_LIB_VERSION = _XOPEN_;
+_LIB_VERSIONIMF = _XOPEN_;
 #elif defined( __SVID__ )
-_LIB_VERSION = _SVID_;
+_LIB_VERSIONIMF = _SVID_;
 #elif defined( __IEEE__ )
-_LIB_VERSION = _IEEE_;
+_LIB_VERSIONIMF = _IEEE_;
 #else
-_LIB_VERSION = _ISOC_;
-#endif
+_LIB_VERSIONIMF = _ISOC_;
 #endif
 
 /************************************************************/
 /* matherrX function pointers and setusermatherrX functions */
 /************************************************************/
-#if 0
 int (*pmatherrf)(struct exceptionf*) = MATHERR_F;
 int (*pmatherr)(struct EXC_DECL_D*) = MATHERR_D;
 int (*pmatherrl)(struct exceptionl*) = matherrl;
 
 void __libm_setusermatherrf( int(*user_merrf)(struct exceptionf*) )
-{      pmatherrf = ( (user_merrf==NULL)? (MATHERR_F) : (user_merrf) ); }
+{   pmatherrf = ( (user_merrf==NULL)? (MATHERR_F) : (user_merrf) ); }
 
 void __libm_setusermatherr( int(*user_merr)(struct EXC_DECL_D*) )
-{      pmatherr = ( (user_merr==NULL)? (MATHERR_D) : (user_merr) );    }
+{   pmatherr = ( (user_merr==NULL)? (MATHERR_D) : (user_merr) );    }
 
 void __libm_setusermatherrl( int(*user_merrl)(struct exceptionl*) )
-{      pmatherrl = ( (user_merrl==NULL)? (matherrl) : (user_merrl) );  }
-#endif
+{   pmatherrl = ( (user_merrl==NULL)? (matherrl) : (user_merrl) );  }
+
+#endif /* !_LIBC */
 
 /***********************************************/
 /* error-handling function, libm_error_support */
@@ -93,7 +134,6 @@ void __libm_setusermatherrl( int(*user_merrl)(struct exceptionl*) )
 void __libm_error_support(void *arg1,void *arg2,void *retval,error_types input_tag)
 {
 
-
 # ifdef __cplusplus
 struct __exception exc;
 # else
@@ -103,44 +143,72 @@ struct exception  exc;
 struct exceptionf excf;
 struct exceptionl excl;
 
-# if defined opensource || defined _LIBC
+# ifdef __GNUC__
+#define ALIGNIT __attribute__ ((__aligned__ (16)))
+# elif defined opensource
 #define ALIGNIT
-#define ALIGNATTR __attribute__ ((__aligned__ (16)))
 # else
 #define ALIGNIT __declspec(align(16))
-#define ALIGNATTR
 # endif
 
-const char float_inf[4] = {0x00,0x00,0x80,0x7F};
-const char float_huge[4] = {0xFF,0xFF,0x7F,0x7F};
-const char float_zero[4] = {0x00,0x00,0x00,0x00};
-const char float_neg_inf[4] = {0x00,0x00,0x80,0xFF};
-const char float_neg_huge[4] = {0xFF,0xFF,0x7F,0xFF};
-const char float_neg_zero[4] = {0x00,0x00,0x00,0x80};
+# ifdef SIZE_LONG_INT_64
+#define __INT_64__ signed long
+# else
+# if ILP32
+#define __INT_64__ signed long long
+# else
+#define __INT_64__ __int64
+# endif
+# endif
+
+
+#define STATIC static
+
+ALIGNIT
+STATIC const char float_inf[4] = {0x00,0x00,0x80,0x7F};
+ALIGNIT
+STATIC const char float_huge[4] = {0xFF,0xFF,0x7F,0x7F};
+ALIGNIT
+STATIC const char float_zero[4] = {0x00,0x00,0x00,0x00};
 ALIGNIT
-const char double_inf[8] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x7F};
+STATIC const char float_neg_inf[4] = {0x00,0x00,0x80,0xFF};
+ALIGNIT
+STATIC const char float_neg_huge[4] = {0xFF,0xFF,0x7F,0xFF};
+ALIGNIT
+STATIC const char float_neg_zero[4] = {0x00,0x00,0x00,0x80};
+ALIGNIT
+STATIC const char double_inf[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x7F};
+#ifndef _LIBC
 ALIGNIT
-//const char double_huge[8] ALIGNATTR = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0x7F};
+STATIC const char double_huge[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0x7F};
+#endif
 ALIGNIT
-const char double_zero[8] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+STATIC const char double_zero[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 ALIGNIT
-const char double_neg_inf[8] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF};
+STATIC const char double_neg_inf[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF};
+#ifndef _LIBC
 ALIGNIT
-//const char double_neg_huge[8] ALIGNATTR = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0xFF};
+STATIC const char double_neg_huge[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0xFF};
+#endif
 ALIGNIT
-const char double_neg_zero[8] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80};
+STATIC const char double_neg_zero[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80};
 ALIGNIT
-const char long_double_inf[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00};
+STATIC const char long_double_inf[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x7F,0x00,0x00,0x00,0x00,0x00,0x00};
 ALIGNIT
-//const char long_double_huge[16] ALIGNATTR = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0x00};
+#ifndef _LIBC
+STATIC const char long_double_huge[16] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0x00};
+#endif
 ALIGNIT
-const char long_double_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
+STATIC const char long_double_zero[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
 ALIGNIT
-const char long_double_neg_inf[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00};
+STATIC const char long_double_neg_inf[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00};
 ALIGNIT
-//const char long_double_neg_huge[16] ALIGNATTR = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00};
+#ifndef _LIBC
+STATIC const char long_double_neg_huge[16] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0x00,0x00,0x00,0x00,0x00,0x00};
+#endif
 ALIGNIT
-const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00};
+STATIC const char long_double_neg_zero[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00};
+
 
 #define RETVAL_HUGE_VALL *(long double *)retval =  *(long double *)long_double_inf
 #define RETVAL_NEG_HUGE_VALL *(long double *)retval = *(long double *)long_double_neg_inf
@@ -157,6 +225,10 @@ const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0
 #define RETVAL_HUGEF *(float *)retval = *(float *) float_huge
 #define RETVAL_NEG_HUGEF *(float *)retval = *(float *) float_neg_huge
 
+#define ZEROL_VALUE *(long double *)long_double_zero
+#define ZEROD_VALUE *(double *)double_zero
+#define ZEROF_VALUE *(float *)float_zero
+
 #define RETVAL_ZEROL *(long double *)retval = *(long double *)long_double_zero
 #define RETVAL_ZEROD *(double *)retval = *(double *)double_zero
 #define RETVAL_ZEROF *(float *)retval = *(float *)float_zero
@@ -169,11 +241,11 @@ const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0
 #define RETVAL_ONED *(double *)retval = 1.0
 #define RETVAL_ONEF *(float *)retval = 1.0f
 
-#define NOT_MATHERRL excl.arg1=*(long double *)arg1;excl.arg2=*(long double *)arg2;excl.retval=*(long double *)retval;if(!matherrl(&excl))
-#define NOT_MATHERRD exc.arg1=*(double *)arg1;exc.arg2=*(double *)arg2;exc.retval=*(double *)retval;if(!MATHERR_D(&exc))
-#define NOT_MATHERRF excf.arg1=*(float *)arg1;excf.arg2=*(float *)arg2;excf.retval=*(float *)retval;if(!MATHERR_F(&excf))
+#define NOT_MATHERRL excl.arg1=*(long double *)arg1;excl.arg2=*(long double *)arg2;excl.retval=*(long double *)retval;if(!pmatherrl(&excl))
+#define NOT_MATHERRD exc.arg1=*(double *)arg1;exc.arg2=*(double *)arg2;exc.retval=*(double *)retval;if(!pmatherr(&exc))
+#define NOT_MATHERRF excf.arg1=*(float *)arg1;excf.arg2=*(float *)arg2;excf.retval=*(float *)retval;if(!pmatherrf(&excf))
 
-#define ifSVID if(_LIB_VERSION==_SVID_)
+#define ifSVID if(_LIB_VERSIONIMF==_SVID_)
 
 #define NAMEL excl.name
 #define NAMED exc.name
@@ -210,12 +282,13 @@ const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0
 #define INPUT_XL (excl.arg1=*(long double*)arg1)
 #define INPUT_XD (exc.arg1=*(double*)arg1)
 #define INPUT_XF (excf.arg1=*(float*)arg1)
-#define INPUT_YL (excl.arg1=*(long double*)arg2)
-#define INPUT_YD (exc.arg1=*(double*)arg2)
-#define INPUT_YF (excf.arg1=*(float*)arg2)
+#define INPUT_YL (excl.arg2=*(long double*)arg2)
+#define INPUT_YD (exc.arg2=*(double*)arg2)
+#define INPUT_YF (excf.arg2=*(float*)arg2)
 #define INPUT_RESL (*(long double *)retval)
 #define INPUT_RESD (*(double *)retval)
 #define INPUT_RESF (*(float *)retval)
+#define INPUT_RESI64 (*(__INT_64__ *)retval)
 
 #define WRITEL_LOG_ZERO fputs("logl: SING error\n",stderr)
 #define WRITED_LOG_ZERO fputs("log: SING error\n",stderr)
@@ -233,7 +306,7 @@ const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0
 #define WRITED_Y1_ZERO fputs("y1: DOMAIN error\n",stderr)
 #define WRITEF_Y1_ZERO fputs("y1f: DOMAIN error\n",stderr)
 #define WRITEL_Y1_NEGATIVE fputs("y1l: DOMAIN error\n",stderr)
-#define WRITED_Y1_NEGATIUE fputs("y1: DOMAIN error\n",stderr)
+#define WRITED_Y1_NEGATIVE fputs("y1: DOMAIN error\n",stderr)
 #define WRITEF_Y1_NEGATIVE fputs("y1f: DOMAIN error\n",stderr)
 #define WRITEL_YN_ZERO fputs("ynl: DOMAIN error\n",stderr)
 #define WRITED_YN_ZERO fputs("yn: DOMAIN error\n",stderr)
@@ -253,6 +326,12 @@ const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0
 #define WRITEL_LOG10_NEGATIVE fputs("log10l: DOMAIN error\n",stderr)
 #define WRITED_LOG10_NEGATIVE fputs("log10: DOMAIN error\n",stderr)
 #define WRITEF_LOG10_NEGATIVE fputs("log10f: DOMAIN error\n",stderr)
+#define WRITEL_LOG2_ZERO fputs("log2l: SING error\n",stderr)
+#define WRITED_LOG2_ZERO fputs("log2: SING error\n",stderr)
+#define WRITEF_LOG2_ZERO fputs("log2f: SING error\n",stderr)
+#define WRITEL_LOG2_NEGATIVE fputs("log2l: DOMAIN error\n",stderr)
+#define WRITED_LOG2_NEGATIVE fputs("log2: DOMAIN error\n",stderr)
+#define WRITEF_LOG2_NEGATIVE fputs("log2f: DOMAIN error\n",stderr)
 #define WRITEL_POW_ZERO_TO_ZERO fputs("powl(0,0): DOMAIN error\n",stderr)
 #define WRITED_POW_ZERO_TO_ZERO fputs("pow(0,0): DOMAIN error\n",stderr)
 #define WRITEF_POW_ZERO_TO_ZERO fputs("powf(0,0): DOMAIN error\n",stderr)
@@ -295,6 +374,9 @@ const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0
 #define WRITEL_GAMMA_NEGATIVE fputs("gammal: SING error\n",stderr)
 #define WRITED_GAMMA_NEGATIVE fputs("gamma: SING error\n",stderr)
 #define WRITEF_GAMMA_NEGATIVE fputs("gammaf: SING error\n",stderr)
+#define WRITEL_TGAMMA_NEGATIVE fputs("tgammal: SING error\n",stderr)
+#define WRITED_TGAMMA_NEGATIVE fputs("tgamma: SING error\n",stderr)
+#define WRITEF_TGAMMA_NEGATIVE fputs("tgammaf: SING error\n",stderr)
 #define WRITEL_J0_TLOSS  fputs("j0l: TLOSS error\n",stderr)
 #define WRITEL_Y0_TLOSS  fputs("y0l: TLOSS error\n",stderr)
 #define WRITEL_J1_TLOSS  fputs("j1l: TLOSS error\n",stderr)
@@ -313,16 +395,26 @@ const char long_double_neg_zero[16] ALIGNATTR = {0x00,0x00,0x00,0x00,0x00,0x00,0
 #define WRITEF_Y1_TLOSS  fputs("y1f: TLOSS error\n",stderr)
 #define WRITEF_JN_TLOSS  fputs("jnf: TLOSS error\n",stderr)
 #define WRITEF_YN_TLOSS  fputs("ynf: TLOSS error\n",stderr)
+#define WRITEL_ACOSD fputs("acosdl: DOMAIN error\n",stderr)
+#define WRITED_ACOSD fputs("acosd: DOMAIN error\n",stderr)
+#define WRITEF_ACOSD fputs("acosdf: DOMAIN error\n",stderr)
+#define WRITEL_ASIND fputs("asindl: DOMAIN error\n",stderr)
+#define WRITED_ASIND fputs("asind: DOMAIN error\n",stderr)
+#define WRITEF_ASIND fputs("asindf: DOMAIN error\n",stderr)
+#define WRITEL_ATAN2D_ZERO_BY_ZERO fputs("atan2dl: DOMAIN error\n",stderr)
+#define WRITED_ATAN2D_ZERO_BY_ZERO fputs("atan2d: DOMAIN error\n",stderr)
+#define WRITEF_ATAN2D_ZERO_BY_ZERO fputs("atan2df: DOMAIN error\n",stderr)
+
 
 /***********************/
 /* IEEE Path           */
 /***********************/
-if(_LIB_VERSION==_IEEE_) return;
+if(_LIB_VERSIONIMF==_IEEE_) return;
 
 /***********************/
 /* C9X Path           */
 /***********************/
-else if(_LIB_VERSION==_ISOC_)
+else if(_LIB_VERSIONIMF==_ISOC_)
 {
   switch(input_tag)
   {
@@ -341,21 +433,12 @@ else if(_LIB_VERSION==_ISOC_)
     case powl_overflow:
     case pow_overflow:
     case powf_overflow:
-    case powl_underflow:
-    case pow_underflow:
-    case powf_underflow:
     case expl_overflow:
     case exp_overflow:
     case expf_overflow:
-    case expl_underflow:
-    case exp_underflow:
-    case expf_underflow:
     case exp2l_overflow:
     case exp2_overflow:
     case exp2f_overflow:
-    case exp2l_underflow:
-    case exp2_underflow:
-    case exp2f_underflow:
     case exp10l_overflow:
     case exp10_overflow:
     case exp10f_overflow:
@@ -374,45 +457,135 @@ else if(_LIB_VERSION==_ISOC_)
     case scalbl_overflow:
     case scalb_overflow:
     case scalbf_overflow:
-    case scalbl_underflow:
-    case scalb_underflow:
-    case scalbf_underflow:
     case coshl_overflow:
     case cosh_overflow:
     case coshf_overflow:
     case nextafterl_overflow:
     case nextafter_overflow:
     case nextafterf_overflow:
+    case nextafterl_underflow:
+    case nextafter_underflow:
+    case nextafterf_underflow:
+    case nexttowardl_overflow:
+    case nexttoward_overflow:
+    case nexttowardf_overflow:
+    case nexttowardl_underflow:
+    case nexttoward_underflow:
+    case nexttowardf_underflow:
     case scalbnl_overflow:
     case scalbn_overflow:
     case scalbnf_overflow:
-    case scalbnl_underflow:
-    case scalbn_underflow:
-    case scalbnf_underflow:
+    case scalblnl_overflow:
+    case scalbln_overflow:
+    case scalblnf_overflow:
     case ldexpl_overflow:
     case ldexp_overflow:
     case ldexpf_overflow:
-    case ldexpl_underflow:
-    case ldexp_underflow:
-    case ldexpf_underflow:
     case lgammal_overflow:
     case lgamma_overflow:
     case lgammaf_overflow:
-    case lgammal_negative:
-    case lgamma_negative:
-    case lgammaf_negative:
     case gammal_overflow:
     case gamma_overflow:
     case gammaf_overflow:
+    case lgammal_negative:
+    case lgamma_negative:
+    case lgammaf_negative:
     case gammal_negative:
     case gamma_negative:
     case gammaf_negative:
     case ilogbl_zero:
     case ilogb_zero:
     case ilogbf_zero:
+    case fdiml_overflow:
+    case fdim_overflow:
+    case fdimf_overflow:
+    case llrintl_large:
+    case llrint_large:
+    case llrintf_large:
+    case llroundl_large:
+    case llround_large:
+    case llroundf_large:
+    case lrintl_large:
+    case lrint_large:
+    case lrintf_large:
+    case lroundl_large:
+    case lround_large:
+    case lroundf_large:
+    case tandl_overflow:
+    case tand_overflow:
+    case tandf_overflow:
+    case cotdl_overflow:
+    case cotd_overflow:
+    case cotdf_overflow:
+    case cotl_overflow:
+    case cot_overflow:
+    case cotf_overflow:
+    case sinhcoshl_overflow:
+    case sinhcosh_overflow:
+    case sinhcoshf_overflow:
+    case annuityl_overflow:
+    case annuity_overflow:
+    case annuityf_overflow:
+    case compoundl_overflow:
+    case compound_overflow:
+    case compoundf_overflow:
+    case tgammal_overflow:
+    case tgamma_overflow:
+    case tgammaf_overflow:
     {
          ERRNO_RANGE; break;
     }
+    case powl_underflow:
+    case expl_underflow:
+    case exp10l_underflow:
+    case exp2l_underflow:
+    case scalbl_underflow:
+    case scalbnl_underflow:
+    case scalblnl_underflow:
+    case ldexpl_underflow:
+    case erfcl_underflow:
+    case annuityl_underflow:
+    case compoundl_underflow:
+    {
+       /* Test for zero by testing 64 significand bits for zero. An integer
+          test is needed so denormal flag is not set by a floating-point test */
+       if ( INPUT_RESI64 == 0 ) ERRNO_RANGE;
+       break;
+    }
+    case pow_underflow:
+    case exp_underflow:
+    case exp10_underflow:
+    case exp2_underflow:
+    case scalb_underflow:
+    case scalbn_underflow:
+    case scalbln_underflow:
+    case ldexp_underflow:
+    case erfc_underflow:
+    case annuity_underflow:
+    case compound_underflow:
+    {
+       /* Test for zero by testing exp and significand bits for zero. An integer
+          test is needed so denormal flag is not set by a floating-point test */
+       if ( (INPUT_RESI64 << 1) == 0 ) ERRNO_RANGE;
+       break;
+    }
+    case powf_underflow:
+    case expf_underflow:
+    case exp10f_underflow:
+    case exp2f_underflow:
+    case scalbf_underflow:
+    case scalbnf_underflow:
+    case scalblnf_underflow:
+    case ldexpf_underflow:
+    case erfcf_underflow:
+    case annuityf_underflow:
+    case compoundf_underflow:
+    {
+       /* Test for zero by testing exp and significand bits for zero. An integer
+          test is needed so denormal flag is not set by a floating-point test */
+       if ( (INPUT_RESI64 << 33) == 0 ) ERRNO_RANGE;
+       break;
+    }
     case logl_negative:
     case log_negative:
     case logf_negative:
@@ -473,11 +646,35 @@ else if(_LIB_VERSION==_ISOC_)
     case ynl_negative:
     case yn_negative:
     case ynf_negative:
+    case acosdl_gt_one:
+    case acosd_gt_one:
+    case acosdf_gt_one:
+    case asindl_gt_one:
+    case asind_gt_one:
+    case asindf_gt_one:
+    case atan2dl_zero:
+    case atan2d_zero:
+    case atan2df_zero:
+    case annuityl_by_zero:
+    case annuity_by_zero:
+    case annuityf_by_zero:
+    case annuityl_less_m1:
+    case annuity_less_m1:
+    case annuityf_less_m1:
+    case compoundl_by_zero:
+    case compound_by_zero:
+    case compoundf_by_zero:
+    case compoundl_less_m1:
+    case compound_less_m1:
+    case compoundf_less_m1:
+    case tgammal_negative:
+    case tgamma_negative:
+    case tgammaf_negative:
     {
          ERRNO_DOMAIN; break;
     }
     default:
-      abort();
+      break;
    }
    return;
 }
@@ -486,22 +683,25 @@ else if(_LIB_VERSION==_ISOC_)
 /* _POSIX_ Path        */
 /***********************/
 
-else if(_LIB_VERSION==_POSIX_)
+else if(_LIB_VERSIONIMF==_POSIX_)
 {
 switch(input_tag)
   {
   case gammal_overflow:
   case lgammal_overflow:
+  case tgammal_overflow:
   {
        RETVAL_HUGE_VALL; ERRNO_RANGE; break;
   }
   case gamma_overflow:
   case lgamma_overflow:
+  case tgamma_overflow:
   {
        RETVAL_HUGE_VALD; ERRNO_RANGE; break;
   }
   case gammaf_overflow:
   case lgammaf_overflow:
+  case tgammaf_overflow:
   {
        RETVAL_HUGE_VALF; ERRNO_RANGE; break;
   }
@@ -511,6 +711,9 @@ switch(input_tag)
   case lgammal_negative:
   case lgamma_negative:
   case lgammaf_negative:
+  case tgammal_negative:
+  case tgamma_negative:
+  case tgammaf_negative:
   {
        ERRNO_DOMAIN; break;
   }
@@ -526,6 +729,36 @@ switch(input_tag)
   case scalbn_underflow:
   case scalbnf_overflow:
   case scalbnf_underflow:
+  case scalblnl_overflow:
+  case scalblnl_underflow:
+  case scalbln_overflow:
+  case scalbln_underflow:
+  case scalblnf_overflow:
+  case scalblnf_underflow:
+  case tandl_overflow:
+  case tand_overflow:
+  case tandf_overflow:
+  case cotdl_overflow:
+  case cotd_overflow:
+  case cotdf_overflow:
+  case cotl_overflow:
+  case cot_overflow:
+  case cotf_overflow:
+  case sinhcoshl_overflow:
+  case sinhcosh_overflow:
+  case sinhcoshf_overflow:
+  case nextafterl_overflow:
+  case nextafter_overflow:
+  case nextafterf_overflow:
+  case nextafterl_underflow:
+  case nextafter_underflow:
+  case nextafterf_underflow:
+  case nexttowardl_overflow:
+  case nexttoward_overflow:
+  case nexttowardf_overflow:
+  case nexttowardl_underflow:
+  case nexttoward_underflow:
+  case nexttowardf_underflow:
   {
        ERRNO_RANGE; break;
   }
@@ -596,7 +829,10 @@ switch(input_tag)
     /* y1l(x < 0) */
     /* ynl(x < 0) */
     {
-       RETVAL_NEG_HUGE_VALL; ERRNO_DOMAIN; break;
+#ifndef _LIBC
+       RETVAL_NEG_HUGE_VALL;
+#endif
+       ERRNO_DOMAIN; break;
     }
   case y0_negative:
   case y1_negative:
@@ -619,28 +855,33 @@ switch(input_tag)
   case logl_zero:
   case log1pl_zero:
   case log10l_zero:
+  case log2l_zero:
     /* logl(0) */
-    /* log1pl(0) */
+    /* log1pl(-1) */
     /* log10l(0) */
+    /* log2l(0) */
     {
        RETVAL_NEG_HUGE_VALL; ERRNO_RANGE; break;
     }
   case log_zero:
   case log1p_zero:
   case log10_zero:
-  case log2l_zero:
+  case log2_zero:
    /* log(0) */
-   /* log1p(0) */
+   /* log1p(-1) */
    /* log10(0) */
+   /* log2(0) */
     {
        RETVAL_NEG_HUGE_VALD; ERRNO_RANGE; break;
     }
   case logf_zero:
   case log1pf_zero:
   case log10f_zero:
+  case log2f_zero:
     /* logf(0) */
-    /* log1pf(0) */
+    /* log1pf(-1) */
     /* log10f(0) */
+    /* log2f(0) */
     {
        RETVAL_NEG_HUGE_VALF; ERRNO_RANGE; break;
     }
@@ -649,8 +890,9 @@ switch(input_tag)
   case log10l_negative:
   case log2l_negative:
     /* logl(x < 0) */
-    /* log1pl(x < 0) */
+    /* log1pl(x < -1) */
     /* log10l(x < 0) */
+    /* log2l(x < 0) */
     {
        ERRNO_DOMAIN; break;
     }
@@ -659,8 +901,9 @@ switch(input_tag)
   case log10_negative:
   case log2_negative:
     /* log(x < 0) */
-    /* log1p(x < 0) */
+    /* log1p(x < -1) */
     /* log10(x < 0) */
+    /* log2(x < 0) */
     {
        ERRNO_DOMAIN; break;
     }
@@ -669,40 +912,63 @@ switch(input_tag)
   case log10f_negative:
   case log2f_negative:
     /* logf(x < 0) */
-    /* log1pf(x < 0) */
+    /* log1pf(x < -1) */
     /* log10f(x < 0) */
+    /* log2f(x < 0) */
     {
        ERRNO_DOMAIN; break;
     }
   case expl_overflow:
+  case exp10l_overflow:
+  case exp2l_overflow:
     /* expl overflow */
+    /* exp10l overflow */
+    /* exp2l overflow */
     {
        RETVAL_HUGE_VALL; ERRNO_RANGE; break;
     }
   case exp_overflow:
+  case exp10_overflow:
+  case exp2_overflow:
     /* exp overflow */
+    /* exp10 overflow */
+    /* exp2 overflow */
     {
        RETVAL_HUGE_VALD; ERRNO_RANGE; break;
     }
   case expf_overflow:
+  case exp10f_overflow:
+  case exp2f_overflow:
     /* expf overflow */
     {
        RETVAL_HUGE_VALF; ERRNO_RANGE; break;
     }
   case expl_underflow:
+  case exp10l_underflow:
+  case exp2l_underflow:
     /* expl underflow */
+    /* exp10l underflow */
+    /* exp2l underflow */
     {
-       RETVAL_ZEROL; ERRNO_RANGE; break;
+       ERRNO_RANGE; break;
     }
   case exp_underflow:
+  case exp10_underflow:
+  case exp2_underflow:
     /* exp underflow */
+    /* exp10 underflow */
+    /* exp2 underflow */
     {
-       RETVAL_ZEROD; ERRNO_RANGE; break;
+       ERRNO_RANGE; break;
     }
   case expf_underflow:
+  case exp10f_underflow:
+  case exp2f_underflow:
     /* expf underflow */
+    /* exp10f underflow */
+    /* exp2f underflow */
     {
-       RETVAL_ZEROF; ERRNO_RANGE; break;
+       ERRNO_RANGE; break;
     }
   case j0l_gt_loss:
   case y0l_gt_loss:
@@ -750,41 +1016,68 @@ switch(input_tag)
        break;
     }
   case powl_overflow:
+  case annuityl_overflow:
+  case compoundl_overflow:
     /* powl(x,y) overflow */
     {
-       if (INPUT_RESL < 0) RETVAL_NEG_HUGE_VALL;
+       if (INPUT_RESL < ZEROL_VALUE /*0*/) RETVAL_NEG_HUGE_VALL;
        else RETVAL_HUGE_VALL;
        ERRNO_RANGE; break;
     }
   case pow_overflow:
+  case annuity_overflow:
+  case compound_overflow:
     /* pow(x,y) overflow */
     {
-       if (INPUT_RESD < 0) RETVAL_NEG_HUGE_VALD;
+       if (INPUT_RESD < ZEROD_VALUE /*0*/) RETVAL_NEG_HUGE_VALD;
        else RETVAL_HUGE_VALD;
        ERRNO_RANGE; break;
     }
   case powf_overflow:
+  case annuityf_overflow:
+  case compoundf_overflow:
     /* powf(x,y) overflow */
     {
-       if (INPUT_RESF < 0) RETVAL_NEG_HUGE_VALF;
+       if (INPUT_RESF < ZEROF_VALUE /*0*/) RETVAL_NEG_HUGE_VALF;
        else RETVAL_HUGE_VALF;
        ERRNO_RANGE; break;
     }
   case powl_underflow:
+  case annuityl_underflow:
+  case compoundl_underflow:
     /* powl(x,y) underflow */
     {
        RETVAL_ZEROL; ERRNO_RANGE; break;
     }
   case pow_underflow:
+  case annuity_underflow:
+  case compound_underflow:
     /* pow(x,y) underflow */
     {
        RETVAL_ZEROD; ERRNO_RANGE; break;
     }
-  case  powf_underflow:
+  case powf_underflow:
+  case annuityf_underflow:
+  case compoundf_underflow:
     /* powf(x,y) underflow */
     {
        RETVAL_ZEROF; ERRNO_RANGE; break;
     }
+  case annuityl_by_zero:
+  case annuityl_less_m1:
+  case compoundl_by_zero:
+  case compoundl_less_m1:
+  case annuity_by_zero:
+  case annuity_less_m1:
+  case compound_by_zero:
+  case compound_less_m1:
+  case annuityf_by_zero:
+  case annuityf_less_m1:
+  case compoundf_by_zero:
+  case compoundf_less_m1:
+    {
+       ERRNO_DOMAIN; break;
+    }
   case powl_zero_to_negative:
     /* 0**neg */
     {
@@ -832,37 +1125,25 @@ switch(input_tag)
        break;
     }
   case atan2l_zero:
+  case atan2dl_zero:
     /* atan2l(0,0) */
+    /* atan2dl(0,0) */
     {
-      /* XXX  arg1 and arg2 are switched!!!!  */
-       if (signbit (*(long double *) arg1))
-	 /* y == -0 */
-	 *(long double *) retval = copysignl (M_PIl, *(long double *) arg2);
-       else
-	 *(long double *) retval = *(long double *) arg2;
-       ERRNO_DOMAIN; break;
+       break;
     }
   case atan2_zero:
+  case atan2d_zero:
     /* atan2(0,0) */
+    /* atan2d(0,0) */
     {
-      /* XXX  arg1 and arg2 are switched!!!!  */
-       if (signbit (*(double *) arg1))
-	 /* y == -0 */
-	 *(double *) retval = copysign (M_PI, *(double *) arg2);
-       else
-	 *(double *) retval = *(double *) arg2;
-       ERRNO_DOMAIN; break;
+       break;
     }
-  case
-    atan2f_zero:
+  case atan2f_zero:
+  case atan2df_zero:
     /* atan2f(0,0) */
+    /* atan2df(0,0) */
     {
-       if (signbit (*(float *) arg2))
-	 /* y == -0 */
-	 *(float *) retval = copysignf (M_PI, *(float *) arg1);
-       else
-	 *(float *) retval = *(float *) arg1;
-       ERRNO_DOMAIN; break;
+       break;
     }
   case expm1l_overflow:
     /* expm1 overflow */
@@ -912,42 +1193,42 @@ switch(input_tag)
   case scalbl_underflow:
     /* scalbl underflow */
     {
-       if (INPUT_XL < 0) RETVAL_NEG_ZEROL;
+       if (INPUT_XL < ZEROL_VALUE /*0*/) RETVAL_NEG_ZEROL;
        else RETVAL_ZEROL;
        ERRNO_RANGE; break;
     }
   case scalb_underflow:
     /* scalb underflow */
     {
-       if (INPUT_XD < 0) RETVAL_NEG_ZEROD;
+       if (INPUT_XD < ZEROD_VALUE /*0*/) RETVAL_NEG_ZEROD;
        else RETVAL_ZEROD;
        ERRNO_RANGE; break;
     }
   case scalbf_underflow:
     /* scalbf underflow */
     {
-       if (INPUT_XF < 0) RETVAL_NEG_ZEROF;
+       if (INPUT_XF < ZEROF_VALUE /*0*/) RETVAL_NEG_ZEROF;
        else RETVAL_ZEROF;
        ERRNO_RANGE; break;
     }
   case scalbl_overflow:
     /* scalbl overflow */
     {
-       if (INPUT_XL < 0) RETVAL_NEG_HUGE_VALL;
+       if (INPUT_XL < ZEROL_VALUE /*0*/) RETVAL_NEG_HUGE_VALL;
        else RETVAL_HUGE_VALL;
        ERRNO_RANGE; break;
     }
   case scalb_overflow:
     /* scalb overflow */
     {
-       if (INPUT_XD < 0) RETVAL_NEG_HUGE_VALD;
+       if (INPUT_XD < ZEROD_VALUE /*0*/) RETVAL_NEG_HUGE_VALD;
        else RETVAL_HUGE_VALD;
        ERRNO_RANGE; break;
     }
   case scalbf_overflow:
     /* scalbf overflow */
     {
-       if (INPUT_XF < 0) RETVAL_NEG_HUGE_VALF;
+       if (INPUT_XF < ZEROF_VALUE /*0*/) RETVAL_NEG_HUGE_VALF;
        else RETVAL_HUGE_VALF;
        ERRNO_RANGE; break;
     }
@@ -967,32 +1248,44 @@ switch(input_tag)
         ERRNO_DOMAIN; break;
     }
   case acosl_gt_one:
+  case acosdl_gt_one:
     /* acosl(x > 1) */
+    /* acosdl(x > 1) */
     {
        ERRNO_DOMAIN; break;
     }
   case acos_gt_one:
+  case acosd_gt_one:
     /* acos(x > 1) */
+    /* acosd(x > 1) */
     {
-      ERRNO_DOMAIN; break;
+       ERRNO_DOMAIN; break;
     }
   case acosf_gt_one:
+  case acosdf_gt_one:
     /* acosf(x > 1) */
+    /* acosdf(x > 1) */
     {
-      ERRNO_DOMAIN; break;
+       ERRNO_DOMAIN; break;
     }
   case asinl_gt_one:
+  case asindl_gt_one:
     /* asinl(x > 1) */
+    /* asindl(x > 1) */
     {
        ERRNO_DOMAIN; break;
     }
   case asin_gt_one:
+  case asind_gt_one:
     /* asin(x > 1) */
+    /* asind(x > 1) */
     {
        ERRNO_DOMAIN; break;
     }
   case asinf_gt_one:
+  case asindf_gt_one:
     /* asinf(x > 1) */
+    /* asindf(x > 1) */
     {
        ERRNO_DOMAIN; break;
     }
@@ -1032,21 +1325,21 @@ switch(input_tag)
   case sinhl_overflow:
     /* sinhl overflows */
     {
-       if (INPUT_XL > 0) RETVAL_HUGE_VALL;
+       if (INPUT_XL > ZEROL_VALUE /*0*/) RETVAL_HUGE_VALL;
        else RETVAL_NEG_HUGE_VALL;
        ERRNO_RANGE; break;
     }
   case sinh_overflow:
     /* sinh overflows */
     {
-       if (INPUT_XD > 0) RETVAL_HUGE_VALD;
+       if (INPUT_XD > ZEROD_VALUE /*0*/) RETVAL_HUGE_VALD;
        else RETVAL_NEG_HUGE_VALD;
        ERRNO_RANGE; break;
     }
   case sinhf_overflow:
     /* sinhf overflows */
     {
-       if (INPUT_XF > 0) RETVAL_HUGE_VALF;
+       if (INPUT_XF > ZEROF_VALUE /*0*/) RETVAL_HUGE_VALF;
        else RETVAL_NEG_HUGE_VALF;
        ERRNO_RANGE; break;
     }
@@ -1081,7 +1374,7 @@ switch(input_tag)
       ERRNO_RANGE; break;
    }
   default:
-    abort();
+    break;
 }
 return;
 /* _POSIX_ */
@@ -1106,9 +1399,51 @@ else
   case scalbn_underflow:
   case scalbnf_overflow:
   case scalbnf_underflow:
+  case scalblnl_overflow:
+  case scalblnl_underflow:
+  case scalbln_overflow:
+  case scalbln_underflow:
+  case scalblnf_overflow:
+  case scalblnf_underflow:
+  case tandl_overflow:
+  case tand_overflow:
+  case tandf_overflow:
+  case cotdl_overflow:
+  case cotd_overflow:
+  case cotdf_overflow:
+  case cotl_overflow:
+  case cot_overflow:
+  case cotf_overflow:
+  case annuityl_overflow:
+  case annuityl_underflow:
+  case annuity_overflow:
+  case annuity_underflow:
+  case annuityf_overflow:
+  case annuityf_underflow:
+  case compoundl_overflow:
+  case compoundl_underflow:
+  case compound_overflow:
+  case compound_underflow:
+  case compoundf_overflow:
+  case compoundf_underflow:
   {
        ERRNO_RANGE; break;
   }
+  case annuityl_by_zero:
+  case annuityl_less_m1:
+  case annuity_by_zero:
+  case annuity_less_m1:
+  case annuityf_by_zero:
+  case annuityf_less_m1:
+  case compoundl_by_zero:
+  case compoundl_less_m1:
+  case compound_by_zero:
+  case compound_less_m1:
+  case compoundf_by_zero:
+  case compoundf_less_m1:
+  {
+       ERRNO_DOMAIN; break;
+  }
   case sqrtl_negative:
     /* sqrtl(x < 0) */
     {
@@ -1171,7 +1506,6 @@ else
        break;
     }
   case logl_zero:
-  case log2l_zero:
     /* logl(0) */
     {
        SINGL; NAMEL = (char *) "logl";
@@ -1193,7 +1527,6 @@ else
        break;
     }
   case log_zero:
-  case log2_zero:
     /* log(0) */
     {
        SINGD; NAMED = (char *) "log";
@@ -1215,7 +1548,6 @@ else
        break;
     }
   case logf_zero:
-  case log2f_zero:
     /* logf(0) */
     {
        SINGF; NAMEF = (char *) "logf";
@@ -1238,7 +1570,6 @@ else
     }
 
   case logl_negative:
-  case log2l_negative:
     /* logl(x < 0) */
     {
        DOMAINL; NAMEL = (char *) "logl";
@@ -1260,7 +1591,6 @@ else
        break;
     }
   case log_negative:
-  case log2_negative:
     /* log(x < 0) */
     {
        DOMAIND; NAMED = (char *) "log";
@@ -1282,7 +1612,6 @@ else
        break;
     }
   case logf_negative:
-  case log2f_negative:
     /* logf(x < 0) */
     {
        DOMAINF; NAMEF = (char *) "logf";
@@ -1361,7 +1690,7 @@ else
        else
        {
          RETVAL_NEG_HUGE_VALF;
-         NOT_MATHERRF {}ERRNO_DOMAIN;
+         NOT_MATHERRF {ERRNO_DOMAIN;}
        }
        *(float *)retval = excf.retval;
        break;
@@ -1555,6 +1884,132 @@ else
        *(float *)retval = excf.retval;
        break;
     }
+  case log2l_zero:
+    /* log2l(0) */
+    {
+       SINGL; NAMEL = (char *) "log2l";
+       ifSVID
+       {
+         RETVAL_NEG_HUGEL;
+         NOT_MATHERRL
+         {
+           WRITEL_LOG2_ZERO;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_NEG_HUGE_VALL;
+         NOT_MATHERRL {ERRNO_DOMAIN;}
+       }
+       *(long double *)retval = excl.retval;
+       break;
+    }
+  case log2_zero:
+    /* log2(0) */
+    {
+       SINGD; NAMED = (char *) "log2";
+       ifSVID
+       {
+         RETVAL_NEG_HUGED;
+         NOT_MATHERRD
+         {
+           WRITED_LOG2_ZERO;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_NEG_HUGE_VALD;
+         NOT_MATHERRD {ERRNO_DOMAIN;}
+       }
+       *(double *)retval = exc.retval;
+       break;
+    }
+  case log2f_zero:
+    /* log2f(0) */
+    {
+       SINGF; NAMEF = (char *) "log2f";
+       ifSVID
+       {
+         RETVAL_NEG_HUGEF;
+         NOT_MATHERRF
+         {
+          WRITEF_LOG2_ZERO;
+          ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_NEG_HUGE_VALF;
+         NOT_MATHERRF {ERRNO_DOMAIN;}
+       }
+       *(float *)retval = excf.retval;
+       break;
+    }
+  case log2l_negative:
+    /* log2l(x < 0) */
+    {
+       DOMAINL; NAMEL = (char *) "log2l";
+       ifSVID
+       {
+         RETVAL_NEG_HUGEL;
+         NOT_MATHERRL
+         {
+           WRITEL_LOG2_NEGATIVE;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_NEG_HUGE_VALL;
+         NOT_MATHERRL {ERRNO_DOMAIN;}
+       }
+       *(long double *)retval = excl.retval;
+       break;
+    }
+  case log2_negative:
+    /* log2(x < 0) */
+    {
+       DOMAIND; NAMED = (char *) "log2";
+       ifSVID
+       {
+         RETVAL_NEG_HUGED;
+         NOT_MATHERRD
+         {
+           WRITED_LOG2_NEGATIVE;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_NEG_HUGE_VALD;
+         NOT_MATHERRD {ERRNO_DOMAIN;}
+       }
+       *(double *)retval = exc.retval;
+       break;
+    }
+  case log2f_negative:
+    /* log2f(x < 0) */
+    {
+       DOMAINF; NAMEF = (char *) "log2f";
+       ifSVID
+       {
+         RETVAL_NEG_HUGEF;
+         NOT_MATHERRF
+         {
+           WRITEF_LOG2_NEGATIVE;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_NEG_HUGE_VALF;
+         NOT_MATHERRF {ERRNO_DOMAIN;}
+       }
+       *(float *)retval = excf.retval;
+       break;
+    }
   case expl_overflow:
     /* expl overflow */
     {
@@ -1637,7 +2092,7 @@ else
          NOT_MATHERRL
          {
             WRITEL_POW_ZERO_TO_ZERO;
-            ERRNO_RANGE;
+            ERRNO_DOMAIN;
          }
          *(long double *)retval = excl.retval;
        }
@@ -1654,7 +2109,7 @@ else
          NOT_MATHERRD
          {
             WRITED_POW_ZERO_TO_ZERO;
-            ERRNO_RANGE;
+            ERRNO_DOMAIN;
          }
          *(double *)retval = exc.retval;
        }
@@ -1671,7 +2126,7 @@ else
          NOT_MATHERRF
          {
           WRITEF_POW_ZERO_TO_ZERO;
-          ERRNO_RANGE;
+          ERRNO_DOMAIN;
          }
          *(float *)retval = excf.retval;
        }
@@ -1684,12 +2139,12 @@ else
        OVERFLOWL; NAMEL = (char *) "powl";
        ifSVID
        {
-         if (INPUT_XL < 0)  RETVAL_NEG_HUGEL;
+         if (INPUT_RESL < ZEROL_VALUE /*0*/) RETVAL_NEG_HUGEL;
          else RETVAL_HUGEL;
        }
        else
        {
-         if (INPUT_XL < 0) RETVAL_NEG_HUGE_VALL;
+         if (INPUT_RESL < ZEROL_VALUE /*0*/) RETVAL_NEG_HUGE_VALL;
          else RETVAL_HUGE_VALL;
        }
        NOT_MATHERRL {ERRNO_RANGE;}
@@ -1702,12 +2157,12 @@ else
        OVERFLOWD; NAMED = (char *) "pow";
        ifSVID
        {
-         if (INPUT_XD < 0) RETVAL_NEG_HUGED;
+         if (INPUT_RESD < ZEROD_VALUE /*0*/) RETVAL_NEG_HUGED;
          else RETVAL_HUGED;
        }
        else
        {
-         if (INPUT_XD < 0) RETVAL_NEG_HUGE_VALD;
+         if (INPUT_RESD < ZEROD_VALUE /*0*/) RETVAL_NEG_HUGE_VALD;
          else RETVAL_HUGE_VALD;
        }
        NOT_MATHERRD {ERRNO_RANGE;}
@@ -1720,12 +2175,12 @@ else
        OVERFLOWF; NAMEF = (char *) "powf";
        ifSVID
        {
-         if (INPUT_XF < 0) RETVAL_NEG_HUGEF;
+         if (INPUT_RESF < ZEROF_VALUE /*0*/) RETVAL_NEG_HUGEF;
          else RETVAL_HUGEF;
        }
        else
        {
-         if (INPUT_XF < 0) RETVAL_NEG_HUGE_VALF;
+         if (INPUT_RESF < ZEROF_VALUE /*0*/) RETVAL_NEG_HUGE_VALF;
          else RETVAL_HUGE_VALF;
        }
        NOT_MATHERRF {ERRNO_RANGE;}
@@ -1802,7 +2257,6 @@ else
     /* 0**neg */
     {
        DOMAINF; NAMEF = (char *) "powf";
-       RETVAL_NEG_HUGE_VALF;
        ifSVID
        {
          RETVAL_ZEROF;
@@ -1826,7 +2280,7 @@ else
        DOMAINL; NAMEL = (char *) "powl";
        ifSVID
        {
-         RETVAL_ZEROF;
+         RETVAL_ZEROL;
          NOT_MATHERRL
          {
            WRITEL_POW_NEG_TO_NON_INTEGER;
@@ -1884,8 +2338,8 @@ else
     /* pow(NaN,0.0) */
     /* Special Error */
     {
-       DOMAINL; NAMEL = (char *) "powl"; INPUT_XL; INPUT_YL;
-       excl.retval = *(long double *)arg1;
+       DOMAINL; NAMEL = (char *) "powl";
+       *(long double *)retval = *(long double *)arg1;
        NOT_MATHERRL {ERRNO_DOMAIN;}
        *(long double *)retval = excl.retval;
        break;
@@ -1894,8 +2348,8 @@ else
     /* pow(NaN,0.0) */
     /* Special Error */
     {
-       DOMAIND; NAMED = (char *) "pow"; INPUT_XD; INPUT_YD;
-       exc.retval = *(double *)arg1;
+       DOMAIND; NAMED = (char *) "pow";
+       *(double *)retval = *(double *)arg1;
        NOT_MATHERRD {ERRNO_DOMAIN;}
        *(double *)retval = exc.retval;
        break;
@@ -1904,8 +2358,8 @@ else
     /* powf(NaN,0.0) */
     /* Special Error */
     {
-       DOMAINF; NAMEF = (char *) "powf"; INPUT_XF; INPUT_YF;
-       excf.retval = *(float *)arg1;
+       DOMAINF; NAMEF = (char *) "powf";
+       *(float *)retval = *(float *)arg1;
        NOT_MATHERRF {ERRNO_DOMAIN;}
        *(float *)retval = excf.retval;
        break;
@@ -1948,11 +2402,61 @@ else
        DOMAINF; NAMEF = (char *) "atan2f";
        RETVAL_ZEROF;
        NOT_MATHERRF
+       {
          ifSVID
          {
             WRITEF_ATAN2_ZERO_BY_ZERO;
          }
-       ERRNO_DOMAIN;
+         ERRNO_DOMAIN;
+       }
+       *(float *)retval = excf.retval;
+       break;
+    }
+  case atan2dl_zero:
+    /* atan2dl(0.0,0.0) */
+    {
+       DOMAINL; NAMEL = (char *) "atan2dl";
+       RETVAL_ZEROL;
+       NOT_MATHERRL
+       {
+         ifSVID
+         {
+            WRITEL_ATAN2D_ZERO_BY_ZERO;
+         }
+         ERRNO_DOMAIN;
+       }
+       *(long double *)retval = excl.retval;
+       break;
+    }
+  case atan2d_zero:
+    /* atan2d(0.0,0.0) */
+    {
+       DOMAIND; NAMED = (char *) "atan2d";
+       RETVAL_ZEROD;
+       NOT_MATHERRD
+       {
+         ifSVID
+         {
+            WRITED_ATAN2D_ZERO_BY_ZERO;
+         }
+         ERRNO_DOMAIN;
+       }
+       *(double *)retval = exc.retval;
+       break;
+    }
+  case atan2df_zero:
+    /* atan2df(0.0,0.0) */
+    {
+       DOMAINF; NAMEF = (char *) "atan2df";
+       RETVAL_ZEROF;
+       NOT_MATHERRF
+       {
+         ifSVID
+         {
+            WRITEF_ATAN2D_ZERO_BY_ZERO;
+         }
+         ERRNO_DOMAIN;
+       }
        *(float *)retval = excf.retval;
        break;
     }
@@ -1988,17 +2492,17 @@ else
     /* scalbl underflow */
     {
        UNDERFLOWL; NAMEL = (char *) "scalbl";
-       if (INPUT_XL < 0.0L) RETVAL_NEG_ZEROL;
+       if (INPUT_XL < ZEROL_VALUE /*0.0L*/) RETVAL_NEG_ZEROL;
        else  RETVAL_ZEROL;
        NOT_MATHERRL {ERRNO_RANGE;}
-       *(long double *)retval = excf.retval;
+       *(long double *)retval = excl.retval;
        break;
     }
   case scalb_underflow:
     /* scalb underflow */
     {
        UNDERFLOWD; NAMED = (char *) "scalb";
-       if (INPUT_XD < 0.0) RETVAL_NEG_ZEROD;
+       if (INPUT_XD < ZEROD_VALUE /*0.0*/) RETVAL_NEG_ZEROD;
        else  RETVAL_ZEROD;
        NOT_MATHERRD {ERRNO_RANGE;}
        *(double *)retval = exc.retval;
@@ -2008,7 +2512,7 @@ else
     /* scalbf underflow */
     {
        UNDERFLOWF; NAMEF = (char *) "scalbf";
-       if (INPUT_XF < 0.0) RETVAL_NEG_ZEROF;
+       if (INPUT_XF < ZEROF_VALUE /*0.0*/) RETVAL_NEG_ZEROF;
        else  RETVAL_ZEROF;
        NOT_MATHERRF {ERRNO_RANGE;}
        *(float *)retval = excf.retval;
@@ -2018,7 +2522,7 @@ else
     /* scalbl overflow */
     {
        OVERFLOWL; NAMEL = (char *) "scalbl";
-       if (INPUT_XL < 0) RETVAL_NEG_HUGE_VALL;
+       if (INPUT_XL < ZEROL_VALUE /*0*/) RETVAL_NEG_HUGE_VALL;
        else RETVAL_HUGE_VALL;
        NOT_MATHERRL {ERRNO_RANGE;}
        *(long double *)retval = excl.retval;
@@ -2028,7 +2532,7 @@ else
     /* scalb overflow */
     {
        OVERFLOWD; NAMED = (char *) "scalb";
-       if (INPUT_XD < 0) RETVAL_NEG_HUGE_VALD;
+       if (INPUT_XD < ZEROD_VALUE /*0*/) RETVAL_NEG_HUGE_VALD;
        else RETVAL_HUGE_VALD;
        NOT_MATHERRD {ERRNO_RANGE;}
        *(double *)retval = exc.retval;
@@ -2038,7 +2542,7 @@ else
     /* scalbf overflow */
     {
        OVERFLOWF; NAMEF = (char *) "scalbf";
-       if (INPUT_XF < 0) RETVAL_NEG_HUGE_VALF;
+       if (INPUT_XF < ZEROF_VALUE /*0*/) RETVAL_NEG_HUGE_VALF;
        else RETVAL_HUGE_VALF;
        NOT_MATHERRF {ERRNO_RANGE;}
        *(float *)retval = excf.retval;
@@ -2212,6 +2716,126 @@ else
        *(float *)retval = excf.retval;
        break;
     }
+  case acosdl_gt_one:
+    /* acosdl(x > 1) */
+    {
+       DOMAINL; NAMEL = (char *) "acosdl";
+       RETVAL_ZEROL;
+       ifSVID
+       {
+         NOT_MATHERRL
+         {
+           WRITEL_ACOSD;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         NOT_MATHERRL {ERRNO_DOMAIN;}
+       }
+       *(long double *)retval = excl.retval;
+       break;
+    }
+  case acosd_gt_one:
+    /* acosd(x > 1) */
+    {
+       DOMAIND; NAMED = (char *) "acosd";
+       RETVAL_ZEROD;
+       ifSVID
+       {
+         NOT_MATHERRD
+         {
+           WRITED_ACOSD;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         NOT_MATHERRD {ERRNO_DOMAIN;}
+       }
+       *(double *)retval = exc.retval;
+       break;
+    }
+  case acosdf_gt_one:
+    /* acosdf(x > 1) */
+    {
+       DOMAINF; NAMEF = (char *) "acosdf";
+       RETVAL_ZEROF;
+       ifSVID
+       {
+         NOT_MATHERRF
+         {
+           WRITEF_ACOSD;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         NOT_MATHERRF {ERRNO_DOMAIN;}
+       }
+       *(float *)retval = excf.retval;
+       break;
+    }
+  case asindl_gt_one:
+    /* asindl(x > 1) */
+    {
+       DOMAINL; NAMEL = (char *) "asindl";
+       RETVAL_ZEROL;
+       ifSVID
+       {
+         NOT_MATHERRL
+         {
+           WRITEL_ASIND;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         NOT_MATHERRL {ERRNO_DOMAIN;}
+       }
+       *(long double *)retval = excl.retval;
+       break;
+    }
+  case asind_gt_one:
+    /* asind(x > 1) */
+    {
+       DOMAIND; NAMED = (char *) "asind";
+       RETVAL_ZEROD;
+       ifSVID
+       {
+         NOT_MATHERRD
+         {
+           WRITED_ASIND;
+           ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         NOT_MATHERRD {ERRNO_DOMAIN;}
+       }
+       *(double *)retval = exc.retval;
+       break;
+    }
+  case asindf_gt_one:
+    /* asindf(x > 1) */
+    {
+       DOMAINF; NAMEF = (char *) "asindf";
+       RETVAL_ZEROF;
+       ifSVID
+       {
+         NOT_MATHERRF
+         {
+            WRITEF_ASIND;
+            ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         NOT_MATHERRF {ERRNO_DOMAIN;}
+       }
+       *(float *)retval = excf.retval;
+       break;
+    }
  case coshl_overflow:
    /* coshl overflow */
    {
@@ -2266,12 +2890,12 @@ else
       OVERFLOWL; NAMEL = (char *) "sinhl";
       ifSVID
       {
-        if (INPUT_XL > 0.0) RETVAL_HUGEL;
+        if (INPUT_XL > ZEROL_VALUE /*0.0*/) RETVAL_HUGEL;
         else RETVAL_NEG_HUGEL;
       }
       else
       {
-        if (INPUT_XL > 0.0) RETVAL_HUGE_VALL;
+        if (INPUT_XL > ZEROL_VALUE /*0.0*/) RETVAL_HUGE_VALL;
         else RETVAL_NEG_HUGE_VALL;
       }
       NOT_MATHERRL {ERRNO_RANGE;}
@@ -2284,12 +2908,12 @@ else
       OVERFLOWD; NAMED = (char *) "sinh";
       ifSVID
       {
-        if (INPUT_XD > 0.0) RETVAL_HUGED;
+        if (INPUT_XD > ZEROD_VALUE /*0.0*/) RETVAL_HUGED;
         else RETVAL_NEG_HUGED;
       }
       else
       {
-        if (INPUT_XD > 0.0) RETVAL_HUGE_VALD;
+        if (INPUT_XD > ZEROD_VALUE /*0.0*/) RETVAL_HUGE_VALD;
         else RETVAL_NEG_HUGE_VALD;
       }
       NOT_MATHERRD {ERRNO_RANGE;}
@@ -2302,12 +2926,12 @@ else
       OVERFLOWF; NAMEF = (char *) "sinhf";
       ifSVID
       {
-        if( INPUT_XF > 0.0) RETVAL_HUGEF;
+        if (INPUT_XF > ZEROF_VALUE /*0.0*/) RETVAL_HUGEF;
         else RETVAL_NEG_HUGEF;
       }
       else
       {
-        if (INPUT_XF > 0.0) RETVAL_HUGE_VALF;
+        if (INPUT_XF > ZEROF_VALUE /*0.0*/) RETVAL_HUGE_VALF;
         else RETVAL_NEG_HUGE_VALF;
       }
       NOT_MATHERRF {ERRNO_RANGE;}
@@ -2326,7 +2950,10 @@ else
            ERRNO_DOMAIN;
          }
        }
-       else NOT_MATHERRL {ERRNO_DOMAIN;}
+       else
+       {
+           NOT_MATHERRL {ERRNO_DOMAIN;}
+       }
        *(long double *)retval = excl.retval;
        break;
     }
@@ -2338,11 +2965,14 @@ else
        {
          NOT_MATHERRD
          {
-          WRITEL_ACOSH;
+          WRITED_ACOSH;
           ERRNO_DOMAIN;
          }
        }
-       else NOT_MATHERRD {ERRNO_DOMAIN;}
+       else
+       {
+          NOT_MATHERRD {ERRNO_DOMAIN;}
+       }
        *(double *)retval = exc.retval;
        break;
     }
@@ -2363,7 +2993,7 @@ else
          NOT_MATHERRF {ERRNO_DOMAIN;}
        }
        *(float *)retval = excf.retval;
-       ERRNO_DOMAIN; break;
+       break;
     }
   case atanhl_gt_one:
     /* atanhl(|x| > 1) */
@@ -2422,7 +3052,7 @@ else
   case atanhl_eq_one:
     /* atanhl(|x| == 1) */
     {
-       SINGL; NAMEL = (char *)"atanhl";
+       SINGL; NAMEL = (char *) "atanhl";
        ifSVID
        {
          NOT_MATHERRL
@@ -2521,6 +3151,69 @@ else
        *(float *)retval = excf.retval;
        break;
     }
+  case gammal_negative:
+    /* gammal -int or 0 */
+    {
+       SINGL; NAMEL = (char *) "gammal";
+       ifSVID
+       {
+         RETVAL_HUGEL;
+         NOT_MATHERRL
+         {
+            WRITEL_GAMMA_NEGATIVE;
+            ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_HUGE_VALL;
+         NOT_MATHERRL {ERRNO_DOMAIN;}
+       }
+       *(long double *)retval = excl.retval;
+       break;
+    }
+  case gamma_negative:
+    /* gamma -int or 0 */
+    {
+       SINGD; NAMED = (char *) "gamma";
+       ifSVID
+       {
+         RETVAL_HUGED;
+         NOT_MATHERRD
+         {
+            WRITED_GAMMA_NEGATIVE;
+            ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_HUGE_VALD;
+         NOT_MATHERRD {ERRNO_DOMAIN;}
+       }
+       *(double *)retval = exc.retval;
+       break;
+    }
+  case gammaf_negative:
+    /* gammaf -int or 0 */
+    {
+       SINGF; NAMEF = (char *) "gammaf";
+       ifSVID
+       {
+         RETVAL_HUGEF;
+         NOT_MATHERRF
+         {
+            WRITEF_GAMMA_NEGATIVE;
+            ERRNO_DOMAIN;
+         }
+       }
+       else
+       {
+         RETVAL_HUGE_VALF;
+         NOT_MATHERRF {ERRNO_DOMAIN;}
+       }
+       *(float *)retval = excf.retval;
+       break;
+    }
   case lgammal_overflow:
     /* lgammal overflow */
     {
@@ -2632,64 +3325,106 @@ else
        *(float *)retval = excf.retval;
        break;
     }
-  case gammal_negative:
-    /* gammal -int or 0 */
+  case tgammal_overflow:
+    /* tgammal overflow */
     {
-       SINGL; NAMEL = (char *) "gammal";
+       OVERFLOWL; NAMEL = (char *) "tgammal";
        ifSVID
        {
          RETVAL_HUGEL;
+       }
+       else
+       {
+         RETVAL_HUGE_VALL;
+       }
+       NOT_MATHERRL {ERRNO_RANGE;}
+       *(long double *)retval = excl.retval;
+       break;
+    }
+  case tgamma_overflow:
+    /* tgamma overflow */
+    {
+       OVERFLOWD; NAMED = (char *) "tgamma";
+       ifSVID
+       {
+         RETVAL_HUGED;
+       }
+       else
+       {
+         RETVAL_HUGE_VALD;
+       }
+       NOT_MATHERRD {ERRNO_RANGE;}
+       *(double *)retval = exc.retval;
+       break;
+    }
+  case tgammaf_overflow:
+    /* tgammaf overflow */
+    {
+       OVERFLOWF; NAMEF = (char *) "tgammaf";
+       ifSVID
+       {
+         RETVAL_HUGEF;
+       }
+       else
+       {
+         RETVAL_HUGE_VALF;
+       }
+       NOT_MATHERRF {ERRNO_RANGE;}
+       *(float *)retval = excf.retval;
+       break;
+    }
+  case tgammal_negative:
+    /* tgammal -int or 0 */
+    {
+       SINGL; NAMEL = (char *) "tgammal";
+       ifSVID
+       {
          NOT_MATHERRL
          {
-            WRITEL_GAMMA_NEGATIVE;
-            ERRNO_DOMAIN;
+           WRITEL_TGAMMA_NEGATIVE;
+           ERRNO_DOMAIN;
          }
        }
        else
        {
-         RETVAL_HUGE_VALL;
          NOT_MATHERRL {ERRNO_DOMAIN;}
        }
        *(long double *)retval = excl.retval;
        break;
     }
-  case gamma_negative:
-    /* gamma -int or 0 */
+  case tgamma_negative:
+    /* tgamma -int or 0 */
     {
-       SINGD; NAMED = (char *) "gamma";
+       SINGD; NAMED = (char *) "tgamma";
        ifSVID
        {
-         RETVAL_HUGED;
          NOT_MATHERRD
          {
-            WRITED_GAMMA_NEGATIVE;
-            ERRNO_DOMAIN;
+           WRITED_TGAMMA_NEGATIVE;
+           ERRNO_DOMAIN;
          }
        }
        else
        {
-         RETVAL_HUGE_VALD;
          NOT_MATHERRD {ERRNO_DOMAIN;}
        }
        *(double *)retval = exc.retval;
        break;
     }
-  case gammaf_negative:
-    /* gammaf -int or 0 */
+  case tgammaf_negative:
+    /* tgammaf -int or 0 */
     {
-       SINGF; NAMEF = (char *) "gammaf";
+       SINGF; NAMEF = (char *) "tgammaf";
        ifSVID
        {
-         RETVAL_HUGEF;
          NOT_MATHERRF
          {
-            WRITEF_GAMMA_NEGATIVE;
-            ERRNO_DOMAIN;
+           WRITEF_TGAMMA_NEGATIVE;
+           ERRNO_DOMAIN;
          }
        }
        else
        {
-         RETVAL_HUGE_VALF;
          NOT_MATHERRF {ERRNO_DOMAIN;}
        }
        *(float *)retval = excf.retval;
@@ -3112,7 +3847,8 @@ else
            WRITEF_Y1_ZERO;
            ERRNO_DOMAIN;
          }
-       }else
+       }
+       else
        {
          RETVAL_NEG_HUGE_VALF;
          NOT_MATHERRF {ERRNO_DOMAIN;}
@@ -3336,7 +4072,7 @@ else
          RETVAL_NEG_HUGED;
          NOT_MATHERRD
          {
-           WRITED_Y1_NEGATIUE;
+           WRITED_Y1_NEGATIVE;
            ERRNO_DOMAIN;
          }
        }
@@ -3550,7 +4286,9 @@ else
        break;
     }
   default:
-    abort();
+    /* We don't want to abort () since SVID doesn't cover all math
+       library functions.  */
+    break;
    }
    return;
    }
diff --git a/sysdeps/ia64/fpu/libm_error_codes.h b/sysdeps/ia64/fpu/libm_error_codes.h
new file mode 100644
index 0000000000..4f0945ea1c
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_error_codes.h
@@ -0,0 +1,211 @@
+/* file: libm_error_codes.h */
+ 
+
+/* 
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+
+// Abstract:
+// ========================================================================
+// This file contains the interface to the Intel exception dispatcher.
+//
+//
+// History:
+// ========================================================================
+// 12/15/2004 Initial version - extracted from libm_support.h
+//
+*/
+
+#if !defined(__LIBM_ERROR_CODES_H__)
+#define __LIBM_ERROR_CODES_H__ 
+
+typedef enum
+{
+  logl_zero=0,   logl_negative,                  /*  0,  1 */
+  log_zero,      log_negative,                   /*  2,  3 */
+  logf_zero,     logf_negative,                  /*  4,  5 */
+  log10l_zero,   log10l_negative,                /*  6,  7 */
+  log10_zero,    log10_negative,                 /*  8,  9 */
+  log10f_zero,   log10f_negative,                /* 10, 11 */
+  expl_overflow, expl_underflow,                 /* 12, 13 */
+  exp_overflow,  exp_underflow,                  /* 14, 15 */
+  expf_overflow, expf_underflow,                 /* 16, 17 */
+  powl_overflow, powl_underflow,                 /* 18, 19 */
+  powl_zero_to_zero,                             /* 20     */
+  powl_zero_to_negative,                         /* 21     */
+  powl_neg_to_non_integer,                       /* 22     */
+  powl_nan_to_zero,                              /* 23     */
+  pow_overflow,  pow_underflow,                  /* 24, 25 */
+  pow_zero_to_zero,                              /* 26     */
+  pow_zero_to_negative,                          /* 27     */
+  pow_neg_to_non_integer,                        /* 28     */
+  pow_nan_to_zero,                               /* 29     */
+  powf_overflow, powf_underflow,                 /* 30, 31 */
+  powf_zero_to_zero,                             /* 32     */
+  powf_zero_to_negative,                         /* 33     */
+  powf_neg_to_non_integer,                       /* 34     */
+  powf_nan_to_zero,                              /* 35     */
+  atan2l_zero,                                   /* 36     */
+  atan2_zero,                                    /* 37     */
+  atan2f_zero,                                   /* 38     */
+  expm1l_overflow,                               /* 39     */
+  expm1l_underflow,                              /* 40     */
+  expm1_overflow,                                /* 41     */
+  expm1_underflow,                               /* 42     */
+  expm1f_overflow,                               /* 43     */
+  expm1f_underflow,                              /* 44     */
+  hypotl_overflow,                               /* 45     */
+  hypot_overflow,                                /* 46     */
+  hypotf_overflow,                               /* 47     */
+  sqrtl_negative,                                /* 48     */
+  sqrt_negative,                                 /* 49     */
+  sqrtf_negative,                                /* 50     */
+  scalbl_overflow, scalbl_underflow,             /* 51, 52  */
+  scalb_overflow,  scalb_underflow,              /* 53, 54  */
+  scalbf_overflow, scalbf_underflow,             /* 55, 56  */
+  acosl_gt_one, acos_gt_one, acosf_gt_one,       /* 57, 58, 59 */
+  asinl_gt_one, asin_gt_one, asinf_gt_one,       /* 60, 61, 62 */
+  coshl_overflow, cosh_overflow, coshf_overflow, /* 63, 64, 65 */
+  y0l_zero, y0l_negative,y0l_gt_loss,            /* 66, 67, 68 */
+  y0_zero, y0_negative,y0_gt_loss,               /* 69, 70, 71 */
+  y0f_zero, y0f_negative,y0f_gt_loss,            /* 72, 73, 74 */
+  y1l_zero, y1l_negative,y1l_gt_loss,            /* 75, 76, 77 */
+  y1_zero, y1_negative,y1_gt_loss,               /* 78, 79, 80 */
+  y1f_zero, y1f_negative,y1f_gt_loss,            /* 81, 82, 83 */
+  ynl_zero, ynl_negative,ynl_gt_loss,            /* 84, 85, 86 */
+  yn_zero, yn_negative,yn_gt_loss,               /* 87, 88, 89 */
+  ynf_zero, ynf_negative,ynf_gt_loss,            /* 90, 91, 92 */
+  j0l_gt_loss,                                   /* 93 */
+  j0_gt_loss,                                    /* 94 */
+  j0f_gt_loss,                                   /* 95 */
+  j1l_gt_loss,                                   /* 96 */
+  j1_gt_loss,                                    /* 97 */
+  j1f_gt_loss,                                   /* 98 */
+  jnl_gt_loss,                                   /* 99 */
+  jn_gt_loss,                                    /* 100 */
+  jnf_gt_loss,                                   /* 101 */
+  lgammal_overflow, lgammal_negative,lgammal_reserve, /* 102, 103, 104 */
+  lgamma_overflow, lgamma_negative,lgamma_reserve,    /* 105, 106, 107 */
+  lgammaf_overflow, lgammaf_negative, lgammaf_reserve,/* 108, 109, 110 */
+  gammal_overflow,gammal_negative, gammal_reserve,    /* 111, 112, 113 */
+  gamma_overflow, gamma_negative, gamma_reserve,      /* 114, 115, 116 */
+  gammaf_overflow,gammaf_negative,gammaf_reserve,     /* 117, 118, 119 */
+  fmodl_by_zero,                                 /* 120 */
+  fmod_by_zero,                                  /* 121 */
+  fmodf_by_zero,                                 /* 122 */
+  remainderl_by_zero,                            /* 123 */
+  remainder_by_zero,                             /* 124 */
+  remainderf_by_zero,                            /* 125 */
+  sinhl_overflow, sinh_overflow, sinhf_overflow, /* 126, 127, 128 */
+  atanhl_gt_one, atanhl_eq_one,                  /* 129, 130 */
+  atanh_gt_one, atanh_eq_one,                    /* 131, 132 */
+  atanhf_gt_one, atanhf_eq_one,                  /* 133, 134 */
+  acoshl_lt_one,                                 /* 135 */
+  acosh_lt_one,                                  /* 136 */
+  acoshf_lt_one,                                 /* 137 */
+  log1pl_zero,   log1pl_negative,                /* 138, 139 */
+  log1p_zero,    log1p_negative,                 /* 140, 141 */
+  log1pf_zero,   log1pf_negative,                /* 142, 143 */
+  ldexpl_overflow,   ldexpl_underflow,           /* 144, 145 */
+  ldexp_overflow,    ldexp_underflow,            /* 146, 147 */
+  ldexpf_overflow,   ldexpf_underflow,           /* 148, 149 */
+  logbl_zero,   logb_zero, logbf_zero,           /* 150, 151, 152 */
+  nextafterl_overflow,   nextafter_overflow,
+  nextafterf_overflow,                           /* 153, 154, 155 */
+  ilogbl_zero,  ilogb_zero, ilogbf_zero,         /* 156, 157, 158 */
+  exp2l_overflow, exp2l_underflow,               /* 159, 160 */
+  exp2_overflow,  exp2_underflow,                /* 161, 162 */
+  exp2f_overflow, exp2f_underflow,               /* 163, 164 */
+  exp10l_overflow, exp10_overflow,
+  exp10f_overflow,                               /* 165, 166, 167 */
+  log2l_zero,    log2l_negative,                 /* 168, 169 */
+  log2_zero,     log2_negative,                  /* 170, 171 */
+  log2f_zero,    log2f_negative,                 /* 172, 173 */
+  scalbnl_overflow, scalbnl_underflow,           /* 174, 175 */
+  scalbn_overflow,  scalbn_underflow,            /* 176, 177 */
+  scalbnf_overflow, scalbnf_underflow,           /* 178, 179 */
+  remquol_by_zero,                               /* 180 */
+  remquo_by_zero,                                /* 181 */
+  remquof_by_zero,                               /* 182 */
+  lrintl_large, lrint_large, lrintf_large,       /* 183, 184, 185 */
+  llrintl_large, llrint_large, llrintf_large,    /* 186, 187, 188 */
+  lroundl_large, lround_large, lroundf_large,    /* 189, 190, 191 */
+  llroundl_large, llround_large, llroundf_large, /* 192, 193, 194 */
+  fdiml_overflow, fdim_overflow, fdimf_overflow, /* 195, 196, 197 */
+  nexttowardl_overflow,   nexttoward_overflow,
+  nexttowardf_overflow,                          /* 198, 199, 200 */
+  scalblnl_overflow, scalblnl_underflow,         /* 201, 202 */
+  scalbln_overflow,  scalbln_underflow,          /* 203, 204 */
+  scalblnf_overflow, scalblnf_underflow,         /* 205, 206 */
+  erfcl_underflow, erfc_underflow, erfcf_underflow, /* 207, 208, 209 */
+  acosdl_gt_one, acosd_gt_one, acosdf_gt_one,    /* 210, 211, 212 */
+  asindl_gt_one, asind_gt_one, asindf_gt_one,    /* 213, 214, 215 */
+  atan2dl_zero, atan2d_zero, atan2df_zero,       /* 216, 217, 218 */
+  tandl_overflow, tand_overflow, tandf_overflow, /* 219, 220, 221 */
+  cotdl_overflow, cotd_overflow, cotdf_overflow, /* 222, 223, 224 */
+  cotl_overflow, cot_overflow, cotf_overflow,    /* 225, 226, 227 */
+  sinhcoshl_overflow, sinhcosh_overflow, sinhcoshf_overflow, /* 228, 229, 230 */
+  annuityl_by_zero, annuity_by_zero, annuityf_by_zero, /* 231, 232, 233 */
+  annuityl_less_m1, annuity_less_m1, annuityf_less_m1, /* 234, 235, 236 */
+  annuityl_overflow, annuity_overflow, annuityf_overflow, /* 237, 238, 239 */
+  annuityl_underflow, annuity_underflow, annuityf_underflow, /* 240, 241, 242 */
+  compoundl_by_zero, compound_by_zero, compoundf_by_zero, /* 243, 244, 245 */
+  compoundl_less_m1, compound_less_m1, compoundf_less_m1, /* 246, 247, 248 */
+  compoundl_overflow, compound_overflow, compoundf_overflow, /* 249, 250, 251 */
+  compoundl_underflow, compound_underflow, compoundf_underflow, /* 252, 253, 254 */
+  tgammal_overflow, tgammal_negative, tgammal_reserve, /* 255, 256, 257 */
+  tgamma_overflow, tgamma_negative, tgamma_reserve, /* 258, 259, 260 */
+  tgammaf_overflow, tgammaf_negative, tgammaf_reserve, /* 261, 262, 263 */
+  exp10l_underflow, exp10_underflow, exp10f_underflow, /* 264, 265, 266 */
+  nextafterl_underflow, nextafter_underflow, 
+  nextafterf_underflow,                                /* 267, 268, 269 */
+  nexttowardl_underflow, nexttoward_underflow, 
+  nexttowardf_underflow                                /* 270, 271, 272 */
+} error_types;
+
+#define LIBM_ERROR __libm_error_support
+
+extern void LIBM_ERROR(void*,void*,void*,error_types);
+#ifdef _LIBC
+libc_hidden_proto(LIBM_ERROR)
+#endif
+
+#define LIBM_ERROR1(x,r,e)	LIBM_ERROR(&(x), (void *)0, &(r), e)
+#define LIBM_ERROR2(x,y,r,e)	LIBM_ERROR(&(x), &(y), &(r), e)
+
+#endif // !defined(__LIBM_ERROR_CODES_H__)
diff --git a/sysdeps/ia64/fpu/libm_frexp.S b/sysdeps/ia64/fpu/libm_frexp.S
new file mode 100644
index 0000000000..c6bd676a40
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_frexp.S
@@ -0,0 +1,209 @@
+.file "libm_frexp.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 03/20/00 Improved speed
+// 06/01/00 Fixed bug when x a double-extended denormal
+// 12/08/00 Corrected label on .endp
+// 01/23/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// double __libm_frexp(double x, int* y, int int_type)
+// input  floating point f8, pointer to y (r33), int int_type (r34)
+// output floating point f8, returns the fraction of x, 0.5 <= fraction < 1.0
+// output int* y, returns the true exponent of x
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// int* y is returned as a 32 bit integer if int_type = 0
+// int* y is returned as a 64 bit integer if int_type = 1
+//
+// Overview of operation
+//==============================================================
+// break a floating point x number into fraction and an exponent
+// The fraction is returned as a double
+// The exponent is returned as an integer pointed to by y
+//    This is a true (not a biased exponent) but 0fffe is subtracted
+//    as a bias instead of 0xffff. This is because the fraction returned
+//    is between 0.5 and 1.0, not the expected IEEE range.
+//
+// The fraction is 0.5 <= fraction < 1.0
+//
+// Registers used
+//==============================================================
+//
+// general registers: 
+// r14  exponent bias for x negative
+// r15  exponent bias for x positive
+// r16  signexp of x
+// r17  exponent mask
+// r18  exponent of x
+// r19  exponent result
+// r20  signexp of 2^64
+// r32  on input contains the 64-bit IEEE double that is in f8
+// r33  on input pointer to 32-bit or 64-bit integer for exponent
+// r34  on input contains 0 if output int is 32 bits, else output int is 64 bits
+//
+// predicate registers:
+// p6   set if x is Nan, zero, or infinity
+// p7   set if x negative
+// p8   set if x positive
+// p9   set if x double-extended denormal
+// p10  set if int_type = 0, 32-bit integer
+// p11  set if int_type = 1, 64-bit integer
+//
+// floating-point registers:
+// f8  input, output
+// f9  normalized x
+// f10 signexp for significand result for x positive
+// f11 signexp for significand result for x negative
+// f12 2^64
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_frexp)
+
+// Set signexp for significand result for x>0
+// If x is a NaN, zero, or infinity, return it.
+// Put 0 in the int pointer.
+// x NAN, ZERO, INFINITY?
+// Set signexp for significand result for x<0
+{ .mfi
+        mov         r15 = 0x0fffe
+        fclass.m    p6,p7 = f8, 0xe7
+        mov         r14 = 0x2fffe
+}
+// Form signexp of 2^64 in case x double-extended denormal
+// Save the normalized value of input in f9
+// The normalization also sets fault flags and takes faults if necessary
+{ .mfi
+        mov         r20 = 0x1003f
+        fnorm.s0    f9 = f8 
+        nop.i 999 ;;
+}
+
+// Move signexp for significand result for x>0 to FP reg
+// Form 2^64 in case x double-extended denormal
+{ .mmi
+        setf.exp    f10 = r15
+        setf.exp    f12 = r20
+        nop.i 999 ;;
+}
+
+// Move signexp for significand result for x<0 to FP reg
+// p7 if x<0, else p8
+// If x=0,nan,inf, set p10 if output int to be 32 bits, or set p11 if 64 bits
+{ .mfi
+        setf.exp    f11 = r14
+(p7)    fcmp.lt.s0  p7,p8 = f8,f0
+(p6)    cmp.eq.unc  p10,p11 = r34, r0 ;; 
+}
+
+// If x NAN, ZERO, INFINITY, set *y=0 and exit
+{ .mmb
+(p10)   st4         [r33] = r0      // Store *y=0 as 32-bit integer
+(p11)   st8         [r33] = r0      // Store *y=0 as 64-bit integer
+(p6)    br.ret.spnt b0 ;;
+}
+
+// Form exponent mask
+// Test for fnorm(x) denormal, means x double-extended denormal
+{ .mfi
+        mov         r17 = 0x1ffff
+        fclass.m    p9,p0 = f9, 0x0b
+        nop.i 999 ;;
+}
+
+// If x double-extended denormal add 64 to exponent bias for scaling
+// If x double-extended denormal multiply x * 2^64 which is normal
+// Set p10 if output int to be 32 bits, or set p11 if 64 bits
+{ .mfi
+(p9)    add         r15 = 64, r15
+(p9)    fmpy.s0     f9 = f9, f12
+        cmp.eq      p10,p11 = r34, r0 ;; 
+}
+
+// true exponent stored to int pointer
+// the bias is treated as 0xfffe instead of 
+// normal 0xffff because we want the significand
+// to be in the range <=0.5 sig < 1.0
+// Store the value of the exponent at the pointer in r33
+
+// If x>0 form significand result 
+{ .mfi
+        nop.m 999
+(p8)    fmerge.se   f8 = f10,f9
+        nop.i 999  ;;
+}
+
+// Get signexp of normalized x
+// If x<0 form significand result 
+{ .mfi
+        getf.exp    r16 = f9
+(p7)    fmerge.se   f8 = f11,f9
+        nop.i 999  ;;
+}
+
+// Get exp of normalized x
+// Subtract off bias to get true exponent of x
+{ .mmi
+        and         r18 = r17,r16 ;;
+        sub         r19 = r18,r15
+        nop.i 999  ;;
+}
+
+// Store int *y as a 32-bit integer
+// Make the value a double
+{ .mfi
+(p10)   st4         [r33] = r19        // Store *y as 32-bit integer
+        fnorm.d.s0  f8 = f8
+        nop.i 999
+}
+{ .mfb
+(p11)   st8         [r33] = r19        // Store *y as 64-bit integer
+        nop.f 999
+        br.ret.sptk b0 ;;
+}
+
+GLOBAL_LIBM_END(__libm_frexp)
diff --git a/sysdeps/ia64/fpu/libm_frexpf.S b/sysdeps/ia64/fpu/libm_frexpf.S
new file mode 100644
index 0000000000..dde2d09b4b
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_frexpf.S
@@ -0,0 +1,209 @@
+.file "libm_frexpf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 03/20/00 Improved speed
+// 06/01/00 Fixed bug when x a double-extended denormal
+// 12/08/00 Corrected label on .endp
+// 01/23/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// float __libm_frexpf(float x, int* y, int int_type)
+// input  floating point f8, pointer to y (r33), int int_type (r34)
+// output floating point f8, returns the fraction of x, 0.5 <= fraction < 1.0
+// output int* y, returns the true exponent of x
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// int* y is returned as a 32 bit integer if int_type = 0
+// int* y is returned as a 64 bit integer if int_type = 1
+//
+// Overview of operation
+//==============================================================
+// break a floating point x number into fraction and an exponent
+// The fraction is returned as a float
+// The exponent is returned as an integer pointed to by y
+//    This is a true (not a biased exponent) but 0fffe is subtracted
+//    as a bias instead of 0xffff. This is because the fraction returned
+//    is between 0.5 and 1.0, not the expected IEEE range.
+//
+// The fraction is 0.5 <= fraction < 1.0
+//
+// Registers used
+//==============================================================
+//
+// general registers: 
+// r14  exponent bias for x negative
+// r15  exponent bias for x positive
+// r16  signexp of x
+// r17  exponent mask
+// r18  exponent of x
+// r19  exponent result
+// r20  signexp of 2^64
+// r32  on input contains the 32-bit IEEE float that is in f8
+// r33  on input pointer to 32-bit or 64-bit integer for exponent
+// r34  on input contains 0 if output int is 32 bits, else output int is 64 bits
+//
+// predicate registers:
+// p6   set if x is Nan, zero, or infinity
+// p7   set if x negative
+// p8   set if x positive
+// p9   set if x double-extended denormal
+// p10  set if int_type = 0, 32-bit integer
+// p11  set if int_type = 1, 64-bit integer
+//
+// floating-point registers:
+// f8  input, output
+// f9  normalized x
+// f10 signexp for significand result for x positive
+// f11 signexp for significand result for x negative
+// f12 2^64
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_frexpf)
+
+// Set signexp for significand result for x>0
+// If x is a NaN, zero, or infinity, return it.
+// Put 0 in the int pointer.
+// x NAN, ZERO, INFINITY?
+// Set signexp for significand result for x<0
+{ .mfi
+        mov         r15 = 0x0fffe
+        fclass.m    p6,p7 = f8, 0xe7
+        mov         r14 = 0x2fffe
+}
+// Form signexp of 2^64 in case x double-extended denormal
+// Save the normalized value of input in f9
+// The normalization also sets fault flags and takes faults if necessary
+{ .mfi
+        mov         r20 = 0x1003f
+        fnorm.s0    f9 = f8 
+        nop.i 999 ;;
+}
+
+// Move signexp for significand result for x>0 to FP reg
+// Form 2^64 in case x double-extended denormal
+{ .mmi
+        setf.exp    f10 = r15
+        setf.exp    f12 = r20
+        nop.i 999 ;;
+}
+
+// Move signexp for significand result for x<0 to FP reg
+// p7 if x<0, else p8
+// If x=0,nan,inf, set p10 if output int to be 32 bits, or set p11 if 64 bits
+{ .mfi
+        setf.exp    f11 = r14
+(p7)    fcmp.lt.s0  p7,p8 = f8,f0
+(p6)    cmp.eq.unc  p10,p11 = r34, r0 ;; 
+}
+
+// If x NAN, ZERO, INFINITY, set *y=0 and exit
+{ .mmb
+(p10)   st4         [r33] = r0      // Store *y=0 as 32-bit integer
+(p11)   st8         [r33] = r0      // Store *y=0 as 64-bit integer
+(p6)    br.ret.spnt b0 ;;
+}
+
+// Form exponent mask
+// Test for fnorm(x) denormal, means x double-extended denormal
+{ .mfi
+        mov         r17 = 0x1ffff
+        fclass.m    p9,p0 = f9, 0x0b
+        nop.i 999 ;;
+}
+
+// If x double-extended denormal add 64 to exponent bias for scaling
+// If x double-extended denormal multiply x * 2^64 which is normal
+// Set p10 if output int to be 32 bits, or set p11 if 64 bits
+{ .mfi
+(p9)    add         r15 = 64, r15
+(p9)    fmpy.s0     f9 = f9, f12
+        cmp.eq      p10,p11 = r34, r0 ;; 
+}
+
+// true exponent stored to int pointer
+// the bias is treated as 0xfffe instead of 
+// normal 0xffff because we want the significand
+// to be in the range <=0.5 sig < 1.0
+// Store the value of the exponent at the pointer in r33
+
+// If x>0 form significand result 
+{ .mfi
+        nop.m 999
+(p8)    fmerge.se   f8 = f10,f9
+        nop.i 999  ;;
+}
+
+// Get signexp of normalized x
+// If x<0 form significand result 
+{ .mfi
+        getf.exp    r16 = f9
+(p7)    fmerge.se   f8 = f11,f9
+        nop.i 999  ;;
+}
+
+// Get exp of normalized x
+// Subtract off bias to get true exponent of x
+{ .mmi
+        and         r18 = r17,r16 ;;
+        sub         r19 = r18,r15
+        nop.i 999  ;;
+}
+
+// Store int *y as a 32-bit integer
+// Make the value a float
+{ .mfi
+(p10)   st4         [r33] = r19        // Store *y as 32-bit integer
+        fnorm.s.s0  f8 = f8
+        nop.i 999
+}
+{ .mfb
+(p11)   st8         [r33] = r19        // Store *y as 64-bit integer
+        nop.f 999
+        br.ret.sptk b0 ;;
+}
+
+GLOBAL_LIBM_END(__libm_frexpf)
diff --git a/sysdeps/ia64/fpu/libm_frexpl.S b/sysdeps/ia64/fpu/libm_frexpl.S
new file mode 100644
index 0000000000..64f30b6364
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_frexpl.S
@@ -0,0 +1,209 @@
+.file "libm_frexpl.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 03/20/00 Improved speed
+// 06/01/00 Fixed bug when x a double-extended denormal
+// 12/08/00 Corrected label on .endp
+// 01/23/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// long double __libm_frexpl(long double x, int* y, int int_type)
+// input  floating point f8, pointer to y (r34), int int_type (r35)
+// output floating point f8, returns the fraction of x, 0.5 <= fraction < 1.0
+// output int* y, returns the true exponent of x
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// int* y is returned as a 32 bit integer if int_type = 0
+// int* y is returned as a 64 bit integer if int_type = 1
+//
+// Overview of operation
+//==============================================================
+// break a floating point x number into fraction and an exponent
+// The fraction is returned as a long double
+// The exponent is returned as an integer pointed to by y
+//    This is a true (not a biased exponent) but 0fffe is subtracted
+//    as a bias instead of 0xffff. This is because the fraction returned
+//    is between 0.5 and 1.0, not the expected IEEE range.
+//
+// The fraction is 0.5 <= fraction < 1.0
+//
+// Registers used
+//==============================================================
+//
+// general registers: 
+// r14  exponent bias for x negative
+// r15  exponent bias for x positive
+// r16  signexp of x
+// r17  exponent mask
+// r18  exponent of x
+// r19  exponent result
+// r20  signexp of 2^64
+// r32-33  on input contains the 80-bit IEEE long double that is in f8
+// r34  on input pointer to 32-bit or 64-bit integer for exponent
+// r35  on input contains 0 if output int is 32 bits, else output int is 64 bits
+//
+// predicate registers:
+// p6   set if x is Nan, zero, or infinity
+// p7   set if x negative
+// p8   set if x positive
+// p9   set if x double-extended denormal
+// p10  set if int_type = 0, 32-bit integer
+// p11  set if int_type = 1, 64-bit integer
+//
+// floating-point registers:
+// f8  input, output
+// f9  normalized x
+// f10 signexp for significand result for x positive
+// f11 signexp for significand result for x negative
+// f12 2^64
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_frexpl)
+
+// Set signexp for significand result for x>0
+// If x is a NaN, zero, or infinity, return it.
+// Put 0 in the int pointer.
+// x NAN, ZERO, INFINITY?
+// Set signexp for significand result for x<0
+{ .mfi
+        mov         r15 = 0x0fffe
+        fclass.m    p6,p7 = f8, 0xe7
+        mov         r14 = 0x2fffe
+}
+// Form signexp of 2^64 in case x double-extended denormal
+// Save the normalized value of input in f9
+// The normalization also sets fault flags and takes faults if necessary
+{ .mfi
+        mov         r20 = 0x1003f
+        fnorm.s0    f9 = f8 
+        nop.i 999 ;;
+}
+
+// Move signexp for significand result for x>0 to FP reg
+// Form 2^64 in case x double-extended denormal
+{ .mmi
+        setf.exp    f10 = r15
+        setf.exp    f12 = r20
+        nop.i 999 ;;
+}
+
+// Move signexp for significand result for x<0 to FP reg
+// p7 if x<0, else p8
+// If x=0,nan,inf, set p10 if output int to be 32 bits, or set p11 if 64 bits
+{ .mfi
+        setf.exp    f11 = r14
+(p7)    fcmp.lt.s0  p7,p8 = f8,f0
+(p6)    cmp.eq.unc  p10,p11 = r35, r0 ;; 
+}
+
+// If x NAN, ZERO, INFINITY, set *y=0 and exit
+{ .mmb
+(p10)   st4         [r34] = r0      // Store *y=0 as 32-bit integer
+(p11)   st8         [r34] = r0      // Store *y=0 as 64-bit integer
+(p6)    br.ret.spnt b0 ;;
+}
+
+// Form exponent mask
+// Test for fnorm(x) denormal, means x double-extended denormal
+{ .mfi
+        mov         r17 = 0x1ffff
+        fclass.m    p9,p0 = f9, 0x0b
+        nop.i 999 ;;
+}
+
+// If x double-extended denormal add 64 to exponent bias for scaling
+// If x double-extended denormal multiply x * 2^64 which is normal
+// Set p10 if output int to be 32 bits, or set p11 if 64 bits
+{ .mfi
+(p9)    add         r15 = 64, r15
+(p9)    fmpy.s0     f9 = f9, f12
+        cmp.eq      p10,p11 = r35, r0 ;; 
+}
+
+// true exponent stored to int pointer
+// the bias is treated as 0xfffe instead of 
+// normal 0xffff because we want the significand
+// to be in the range <=0.5 sig < 1.0
+// Store the value of the exponent at the pointer in r34
+
+// If x>0 form significand result 
+{ .mfi
+        nop.m 999
+(p8)    fmerge.se   f8 = f10,f9
+        nop.i 999  ;;
+}
+
+// Get signexp of normalized x
+// If x<0 form significand result 
+{ .mfi
+        getf.exp    r16 = f9
+(p7)    fmerge.se   f8 = f11,f9
+        nop.i 999  ;;
+}
+
+// Get exp of normalized x
+// Subtract off bias to get true exponent of x
+{ .mmi
+        and         r18 = r17,r16 ;;
+        sub         r19 = r18,r15
+        nop.i 999  ;;
+}
+
+// Store int *y as a 32-bit integer
+// Make the value a long double
+{ .mfi
+(p10)   st4         [r34] = r19        // Store *y as 32-bit integer
+        fnorm.s0    f8 = f8
+        nop.i 999
+}
+{ .mfb
+(p11)   st8         [r34] = r19        // Store *y as 64-bit integer
+        nop.f 999
+        br.ret.sptk b0 ;;
+}
+
+GLOBAL_LIBM_END(__libm_frexpl)
diff --git a/sysdeps/ia64/fpu/libm_lgamma.S b/sysdeps/ia64/fpu/libm_lgamma.S
new file mode 100644
index 0000000000..6096319ba5
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_lgamma.S
@@ -0,0 +1,3623 @@
+.file "libm_lgamma.s"
+
+
+// Copyright (c) 2002 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT
+// LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,
+// EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA,OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code,and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History:
+// 01/10/02  Initial version
+// 01/25/02  Corrected error tag numbers
+// 02/04/02  Added support of SIGN(GAMMA(x)) calculation
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 09/15/02  Fixed bug on the branch lgamma_negrecursion
+// 10/21/02  Now it returns SIGN(GAMMA(x))=-1 for negative zero
+// 02/10/03  Reordered header: .section, .global, .proc, .align
+// 07/22/03  Reformatted some data tables
+// 03/31/05  Reformatted delimiters between data tables
+//
+//*********************************************************************
+//
+//*********************************************************************
+//
+// Function: __libm_lgamma(double x, int* signgam, int szsigngam)
+// computes the principle value of the logarithm of the GAMMA function
+// of x. Signum of GAMMA(x) is stored to memory starting at the address
+// specified by the signgam.
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f6-f15
+//                              f32-f122
+//
+//    General Purpose Registers:
+//      r8-r11
+//      r14-r31
+//      r32-r36
+//      r37-r40 (Used to pass arguments to error handling routine)
+//
+//    Predicate Registers:      p6-p15
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    __libm_lgamma(+inf) = +inf
+//    __libm_lgamma(-inf) = QNaN
+//    __libm_lgamma(+/-0) = +inf
+//    __libm_lgamma(x<0, x - integer) = +inf
+//    __libm_lgamma(SNaN) = QNaN
+//    __libm_lgamma(QNaN) = QNaN
+//
+//*********************************************************************
+//
+// Overview
+//
+// The method consists of three cases.
+//
+// If      512 <= x < OVERFLOW_BOUNDARY   use case lgamma_pstirling;
+// else if 1 < x < 512                    use case lgamma_regular;
+// else if -17 < x < 1                    use case lgamma_negrecursion;
+// else if -512 <  x < -17                use case lgamma_negpoly;
+// else if x < -512                       use case lgamma_negstirling;
+// else if x is close to negative
+//         roots of ln(GAMMA(x))          use case lgamma_negroots;
+//
+//
+// Case 512 <= x < OVERFLOW_BOUNDARY
+// ---------------------------------
+//   Here we use algorithm based on the Stirling formula:
+//   ln(GAMMA(x)) = ln(sqrt(2*Pi)) + (x-0.5)ln(x) - x + (W2 + W4/x^2)/x
+//
+// Case 1 < x < 512
+// ----------------
+//   To calculate GAMMA(x) on this interval we use polynomial approximation
+//   on following intervals [0.875; 1.25), [1.25; 1.75), [1.75, 2.25),
+//   [2.25; 4), [2^i; 2^(i+1)), i=2..8
+//
+//   Following variants of approximation and argument reduction are used:
+//    1. [0.875; 1.25)
+//       ln(GAMMA(x)) ~ (x-1.0)*P17(x-1.0)
+//
+//    2. [1.25; 1.75)
+//       ln(GAMMA(x)) ~ (x-LocalMinimun)*P17(x-LocalMinimun)
+//
+//    3. [1.75, 2.25)
+//       ln(GAMMA(x)) ~ (x-2.0)*P17(x-2.0)
+//
+//    4. [2.25; 4)
+//       ln(GAMMA(x)) ~ P22(x)
+//
+//    5. [2^i; 2^(i+1)), i=2..8
+//       ln(GAMMA(x)) ~ P22((x-2^i)/2^i)
+//
+// Case -17 < x < 1
+// ----------------
+//   Here we use the recursive formula:
+//   ln(GAMMA(x)) = ln(GAMMA(x+1)) - ln(x)
+//
+//   Using this formula we reduce argument to base interval [1.0; 2.0]
+//
+// Case -512 <  x < -17
+// --------------------
+//   Here we use the formula:
+//   ln(GAMMA(-x)) = ln(Pi/(x*GAMMA(x)*sin(Pi*x))) =
+//   = -ln(x) - ln((GAMMA(x)) - ln(sin(Pi*r)/(Pi*r)) - ln(|r|)
+//   where r = x - rounded_to_nearest(x), i.e |r| <= 0.5 and
+//   ln(sin(Pi*r)/(Pi*r)) is approximated by 14-degree polynomial of r^2
+//
+//
+// Case x < -512
+// -------------
+//   Here we use algorithm based on the Stirling formula:
+//   ln(GAMMA(-x)) = -ln(sqrt(2*Pi)) + (-x-0.5)ln(x) + x - (W2 + W4/x^2)/x -
+//   - ln(sin(Pi*r)/(Pi*r)) - ln(|r|)
+//   where r = x - rounded_to_nearest(x).
+//
+// Neighbourhoods of negative roots
+// --------------------------------
+//   Here we use polynomial approximation
+//   ln(GAMMA(x-x0)) = ln(GAMMA(x0)) + (x-x0)*P14(x-x0),
+//   where x0 is a root of ln(GAMMA(x)) rounded to nearest double
+//   precision number.
+//
+
+//*********************************************************************
+
+FR_X                   = f10
+FR_Y                   = f1 // __libm_lgamma is single argument function
+FR_RESULT              = f8
+
+FR_B11                 = f6
+FR_B10                 = f7
+
+FR_int_N               = f9
+FR_N                   = f10
+FR_P5                  = f11
+FR_P4                  = f12
+FR_P3                  = f13
+FR_P2                  = f14
+FR_NormX               = f15
+
+FR_Ln2                 = f32
+FR_C01                 = f33
+FR_A17                 = f33
+FR_C00                 = f34
+FR_Xp2                 = f34
+FR_A00                 = f34
+FR_A16                 = f34
+FR_C11                 = f35
+FR_A15                 = f35
+FR_C10                 = f36
+FR_Xp3                 = f36
+FR_A14                 = f36
+FR_B1                  = f36
+FR_C21                 = f37
+FR_A13                 = f37
+FR_PR01                = f37
+FR_C20                 = f38
+FR_Xp6                 = f38
+FR_A12                 = f38
+FR_C31                 = f39
+FR_Xp7                 = f39
+FR_B0                  = f39
+FR_A11                 = f39
+FR_C30                 = f40
+FR_Xp8                 = f40
+FR_A10                 = f40
+FR_PR00                = f40
+FR_C41                 = f41
+FR_Xp9                 = f41
+FR_A9                  = f41
+FR_PR11                = f41
+FR_C40                 = f42
+FR_A8                  = f42
+FR_C51                 = f43
+FR_Xp11                = f43
+FR_A7                  = f43
+FR_C50                 = f44
+FR_C                   = f44
+FR_Xp12                = f44
+FR_A6                  = f44
+FR_Xm2                 = f45
+FR_Xp13                = f45
+FR_A5                  = f45
+FR_PR10                = f45
+FR_C61                 = f46
+FR_Xp14                = f46
+FR_A4                  = f46
+FR_PR21                = f46
+FR_C60                 = f47
+FR_Xp15                = f47
+FR_A3                  = f47
+FR_PR20                = f47
+FR_C71                 = f48
+FR_Xp16                = f48
+FR_A2                  = f48
+FR_PR31                = f48
+FR_C70                 = f49
+FR_Xp17                = f49
+FR_A1                  = f49
+FR_PR30                = f49
+FR_C81                 = f50
+FR_B17                 = f50
+FR_A0                  = f50
+FR_C80                 = f51
+FR_B16                 = f51
+FR_C91                 = f52
+FR_B15                 = f52
+FR_C90                 = f53
+FR_B14                 = f53
+FR_CA1                 = f54
+FR_B13                 = f54
+FR_CA0                 = f55
+FR_B12                 = f55
+FR_CN                  = f56
+FR_Qlo                 = f56
+FR_PRN                 = f56
+FR_B7                  = f57
+FR_B6                  = f58
+FR_Qhi                 = f59
+FR_x                   = f60
+FR_x2                  = f61
+FR_TpNxLn2             = f62
+FR_W2                  = f63
+FR_x4                  = f64
+FR_r4                  = f64
+FR_x8                  = f65
+FR_r8                  = f65
+FR_r05                 = f66
+FR_Xm05                = f66
+FR_B5                  = f66
+FR_LnSqrt2Pi           = f67
+FR_B4                  = f67
+FR_InvX                = f68
+FR_B3                  = f68
+FR_InvX2               = f69
+FR_B2                  = f69
+FR_W4                  = f70
+FR_OvfBound            = f71
+FR_05                  = f72
+FR_LocalMin            = f73
+FR_tmp                 = f73
+FR_LnX                 = f74
+FR_Xf                  = f75
+FR_InvXf               = f76
+FR_rf                  = f77
+FR_rf2                 = f78
+FR_P54f                = f79
+FR_P32f                = f80
+FR_rf3                 = f81
+FR_P10f                = f82
+FR_TpNxLn2f            = f83
+FR_Nf                  = f84
+FR_LnXf                = f85
+FR_int_Nf              = f86
+FR_Tf                  = f87
+FR_Xf2                 = f88
+FR_Xp10                = f89
+FR_w3                  = f90
+FR_S28                 = f90
+FR_w2                  = f91
+FR_S26                 = f91
+FR_w6                  = f92
+FR_S24                 = f92
+FR_w4                  = f93
+FR_S22                 = f93
+FR_w                   = f94
+FR_S20                 = f94
+FR_Q8                  = f95
+FR_S18                 = f95
+FR_Q7                  = f96
+FR_S16                 = f96
+FR_Q4                  = f97
+FR_S14                 = f97
+FR_Q3                  = f98
+FR_S12                 = f98
+FR_Q6                  = f99
+FR_S10                 = f99
+FR_Q5                  = f100
+FR_S8                  = f100
+FR_Q2                  = f101
+FR_S6                  = f101
+FR_Root                = f101
+FR_S4                  = f102
+FR_Q1                  = f102
+FR_S2                  = f103
+FR_Xp1                 = f104
+FR_Xf4                 = f105
+FR_Xf8                 = f106
+FR_Xfr                 = f107
+FR_Xf6                 = f108
+FR_Ntrunc              = f109
+FR_B9                  = f110
+FR_2                   = f110
+FR_B8                  = f111
+FR_3                   = f111
+FR_5                   = f112
+FR_Xp4                 = f113
+FR_Xp5                 = f114
+FR_P54                 = f115
+FR_P32                 = f116
+FR_P10                 = f117
+FR_r                   = f118
+FR_r2                  = f119
+FR_r3                  = f120
+FR_T                   = f121
+FR_int_Ntrunc          = f122
+
+//===================================
+
+GR_TAG                 = r8
+GR_ExpMask             = r8
+GR_ExpBias             = r9
+GR_ad_Roots            = r9
+GR_Expf                = r10
+GR_Arg                 = r10
+GR_SignExp             = r11
+GR_ArgXfr              = r11
+
+GR_Exp                 = r14
+GR_Arg125              = r14
+GR_RootInd             = r14
+GR_ArgAsIs             = r15
+GR_Arg175              = r15
+GR_Sig                 = r16
+GR_Ind                 = r17
+GR_ad_Dx               = r17
+GR_ad_1                = r18
+GR_SignExp_w           = r19
+GR_2_25                = r19
+GR_Arg025              = r19
+GR_Arg15               = r19
+GR_Arg17               = r19
+GR_Exp_w               = r19//21
+GR_ad_2                = r20
+GR_2xDx                = r21
+GR_SignOfGamma         = r21
+GR_fff9                = r22
+GR_Offs                = r22
+GR_ad_Co7              = r23
+GR_Arg075              = r23
+GR_Arg0875             = r23
+GR_ad_T                = r24
+GR_ad_Root             = r24
+GR_Ind                 = r24
+GR_ad_Co               = r25
+GR_ad_Ce               = r26
+GR_ad_Ce7              = r27
+GR_Arg05               = r27
+GR_Offs7               = r28
+GR_ArgXfrAsIs          = r28
+GR_ExpOf2              = r29
+GR_ad_LnT              = r29
+GR_Dx                  = r29
+GR_ExpOf256            = r30
+GR_0x30033             = r30
+GR_Root                = r30
+GR_PseudoRoot          = r30
+GR_ad_Data             = r31
+GR_ad_SignGam          = r31
+
+
+GR_SAVE_B0             = r33
+GR_SAVE_PFS            = r34
+GR_SAVE_GP             = r35
+GR_SAVE_SP             = r36
+
+GR_Parameter_X         = r37
+GR_Parameter_Y         = r38
+GR_Parameter_RESULT    = r39
+GR_Parameter_TAG       = r40
+
+
+
+// Data tables
+//==============================================================
+
+RODATA
+.align 16
+LOCAL_OBJECT_START(lgamma_data)
+// polynomial approximation of ln(GAMMA(x)), 2.25 <= x < 512
+// [2.25; 4)
+data8 0xF888E8D7892718A2,0xC001 // C01
+data8 0xF62F273BA12A4639,0x3FFD // C11
+data8 0xA93AC50A37EC8D38,0xBFFC // C21
+data8 0xB4CC43D2C161E057,0xBFFF // C31
+data8 0xC6AC672F0C1392C7,0xC000 // C41
+data8 0xA292B9AE3276942E,0xC001 // C51
+data8 0xE554E4CCCA6C7B7B,0xC001 // C61
+data8 0x92F0F55FBC87F860,0xC002 // C71
+data8 0xAF60D0112843F6C1,0xC002 // C81
+data8 0xC5956500FA3D92E7,0xC002 // C91
+data8 0xD3B22CCBD8587750,0xC002 // CA1
+data8 0xD888B6CF34159B54,0x4001 // C00
+data8 0xBCB79C8329FD9F44,0x3FFE // C10
+data8 0xCB8896FAD69C455D,0x4000 // C20
+data8 0xE510A424639EBF5E,0x4001 // C30
+data8 0xC65ED41B097486B3,0x4002 // C40
+// [4; 8)
+data8 0x9F1F3C822D03080E,0xC001 // C01
+data8 0x941CACFA9C0FA8A6,0xC001 // C11
+data8 0xFE34336391D99CB7,0xC000 // C21
+data8 0xC40BAEAA165F81A1,0xC000 // C31
+data8 0xFE3AE166E9B4DE8F,0xBFFF // C41
+data8 0xD744F91AF7DAF873,0xBFFE // C51
+data8 0x87871851E9C32D02,0x3FFD // C61
+data8 0x9C93C03C502E808F,0x3FFF // C71
+data8 0xF78BED07501D6A8E,0x3FFF // C81
+data8 0x92FE41BA8BEADF70,0x4000 // C91
+data8 0xA021878E1903A2C6,0x3FFF // CA1
+data8 0xC85EFAC379FAFEE2,0x4001 // C00
+data8 0xC10D7AAB7CEC7FF2,0x4001 // C10
+data8 0xB3537BDF603E454C,0x4001 // C20
+data8 0xA0D44E3D5BBE44C4,0x4001 // C30
+data8 0x8B9C229B6241E7B3,0x4001 // C40
+// [8; 16)
+data8 0xD16AB33AEC220DF6,0x3FFF // C01
+data8 0x987483646E150BCD,0x4000 // C11
+data8 0x80C10A24C863999B,0x4000 // C21
+data8 0xA39A8EB6F8AACE75,0x3FFF // C31
+data8 0x93E04A1379BEC764,0x3FFD // C41
+data8 0xD9F59C4BD3A69BD1,0xBFFE // C51
+data8 0x82094EC891179B1A,0xC000 // C61
+data8 0xC90CFE3A24F70659,0xC000 // C71
+data8 0x827984EA7C155184,0xC001 // C81
+data8 0x981BFDF79D1E0D80,0xC001 // C91
+data8 0xA37209A8B97D230D,0xC001 // CA1
+data8 0xAA1989737D6BA66D,0x3FFE // C00
+data8 0xDBC013A351630AF8,0x3FFF // C10
+data8 0x8B8D47698299389D,0x4000 // C20
+data8 0xACCDD1315DE06EB0,0x4000 // C30
+data8 0xD3414A5AC81BBB2D,0x4000 // C40
+// [16; 32)
+data8 0xECB2B0BE75C5F995,0x3FFF // C01
+data8 0x9DD28BD6DBC96500,0x4000 // C11
+data8 0x8521431B99C6244F,0x4000 // C21
+data8 0xA95F92612B8413C3,0x3FFF // C31
+data8 0x9C76E643B22D9544,0x3FFD // C41
+data8 0xDD90EA99417C8038,0xBFFE // C51
+data8 0x84EA6B6D32E5F906,0xC000 // C61
+data8 0xCDBFE499E05AA622,0xC000 // C71
+data8 0x8594A7DE35427100,0xC001 // C81
+data8 0x9BC1CB2C10DC702F,0xC001 // C91
+data8 0xA7602268762666B0,0xC001 // CA1
+data8 0xDA082BCC6BDB8F7B,0x3FFE // C00
+data8 0xEEBFE1C99322B85E,0x3FFF // C10
+data8 0x96FED4C785361946,0x4000 // C20
+data8 0xB9E3A7207C16B2FE,0x4000 // C30
+data8 0xE1E8170CED48E2C7,0x4000 // C40
+// [32; 64)
+data8 0xFD481EB9AEDD53E7,0x3FFF // C01
+data8 0xA216FB66AC8C53E1,0x4000 // C11
+data8 0x885FF935787553BA,0x4000 // C21
+data8 0xAD471CD89A313327,0x3FFF // C31
+data8 0x9FF13FBA139D21E0,0x3FFD // C41
+data8 0xE25E1663A6EE0266,0xBFFE // C51
+data8 0x87BE51DD5D262FA2,0xC000 // C61
+data8 0xD211A9D4CCE55696,0xC000 // C71
+data8 0x885BEFC29FDED3C9,0xC001 // C81
+data8 0x9EFA48E6367A67F6,0xC001 // C91
+data8 0xAAD3978FC0791297,0xC001 // CA1
+data8 0xF96D210DF37A0AEA,0x3FFE // C00
+data8 0xFE11DC6783917C82,0x3FFF // C10
+data8 0x9FFCD928291B7DDE,0x4000 // C20
+data8 0xC4518F4A80E09AE1,0x4000 // C30
+data8 0xEDDFE9E0FD297C63,0x4000 // C40
+// [64; 128)
+data8 0x840E2E62609B0AD3,0x4000 // C01
+data8 0xA5275A0DD0D3DDF8,0x4000 // C11
+data8 0x8AADC6ABFC441731,0x4000 // C21
+data8 0xB041C6696BE90E50,0x3FFF // C31
+data8 0xA4A8C9153F4B037E,0x3FFD // C41
+data8 0xE3C6A461A7B86736,0xBFFE // C51
+data8 0x89047681C6DE7673,0xC000 // C61
+data8 0xD42DF77A480092DF,0xC000 // C71
+data8 0x89C25D17F086FB20,0xC001 // C81
+data8 0xA09F907D02E34EC7,0xC001 // C91
+data8 0xAC998A9CB79805B7,0xC001 // CA1
+data8 0x875CC9B69AE964CC,0x3FFF // C00
+data8 0x847836BA85DD4C12,0x4000 // C10
+data8 0xA5F3CB2B32E74936,0x4000 // C20
+data8 0xCAE2197C96CB5A0F,0x4000 // C30
+data8 0xF50F7EB60DE5CD09,0x4000 // C40
+// [128; 256)
+data8 0x87D9065DD1876926,0x4000 // C01
+data8 0xA781C28FDAD7CC25,0x4000 // C11
+data8 0x8C6A4FCE35A7EC8D,0x4000 // C21
+data8 0xB27BA081728354F9,0x3FFF // C31
+data8 0xA82FEA7124B0EB2B,0x3FFD // C41
+data8 0xE4C996E42ECBF77A,0xBFFE // C51
+data8 0x89F1A92C84FA538F,0xC000 // C61
+data8 0xD5B6CFF7DB7F6070,0xC000 // C71
+data8 0x8AC6B561FAE38B66,0xC001 // C81
+data8 0xA1D1505C438D8F46,0xC001 // C91
+data8 0xADE2DC1C924FEC81,0xC001 // CA1
+data8 0x8EF6CC62A7E0EB5A,0x3FFF // C00
+data8 0x88A2FFC0ABCB00C0,0x4000 // C10
+data8 0xAA6EA8FCB75B065B,0x4000 // C20
+data8 0xCFC4B82B3D5C9363,0x4000 // C30
+data8 0xFA60FD85DE861771,0x4000 // C40
+// [256; 512)
+data8 0x8AAA7CE4ED5C1EFD,0x4000 // C01
+data8 0xA9679234FB56F1E1,0x4000 // C11
+data8 0x8DCE02287789D841,0x4000 // C21
+data8 0xB44328EF30A8DE7E,0x3FFF // C31
+data8 0xAB0DC564BFA1AB12,0x3FFD // C41
+data8 0xE5882B16FCF2D3CB,0xBFFE // C51
+data8 0x8AA7F48993006A86,0xC000 // C61
+data8 0xD6E63752D192750D,0xC000 // C71
+data8 0x8B90080B17853295,0xC001 // C81
+data8 0xA2BDD4253128D1AB,0xC001 // C91
+data8 0xAEE1A042F96B8121,0xC001 // CA1
+data8 0x94A9C37A42E43BA7,0x3FFF // C00
+data8 0x8BFA54E703878F5A,0x4000 // C10
+data8 0xADFA426DDF14647B,0x4000 // C20
+data8 0xD39C7F7B3958EAF0,0x4000 // C30
+data8 0xFE8C3987853C01E3,0x4000 // C40
+//
+// [2.25; 4)
+data8 0x943AF77763601441,0x4003 // C50
+data8 0xC8A93F9ECB06E891,0x4003 // C60
+data8 0xFC2E5A4AD33DE19D,0x4003 // C70
+data8 0x9526B75B38670119,0x4004 // C80
+data8 0xA7675879D68B587E,0x4004 // C90
+data8 0xB31DFA672D7FB8C0,0x4004 // CA0
+data8 0x83A27775D86F9A81,0xBFD7 // CN
+// [4; 8)
+data8 0xEB8049BA5E79ADA3,0x4000 // C50
+data8 0xC20C95EA99037228,0x4000 // C60
+data8 0x9D4A8C864053CEB8,0x4000 // C70
+data8 0xFC7716544AB0C5C9,0x3FFF // C80
+data8 0xC7EB985259EABA5F,0x3FFF // C90
+data8 0xC042FB3B4C95096D,0x3FFD // CA0
+data8 0xCC2A7F930856177B,0x3FEE // CN
+// [8; 16)
+data8 0xFE1903679D078C7A,0x4000 // C50
+data8 0x957C221AB90171F1,0x4001 // C60
+data8 0xAB2C53B2A78F4031,0x4001 // C70
+data8 0xBE080AE6063AE387,0x4001 // C80
+data8 0xCC019A0311605CB9,0x4001 // C90
+data8 0xD3739D85A12C8ADF,0x4001 // CA0
+data8 0x81FA4D2B7BD7A82D,0x3FEF // CN
+// [16; 32)
+data8 0x871F69E2DD221F02,0x4001 // C50
+data8 0x9E3EF2D477442A9C,0x4001 // C60
+data8 0xB48733582B3C82C5,0x4001 // C70
+data8 0xC7DB9B3C25854A2A,0x4001 // C80
+data8 0xD628B87975BE898F,0x4001 // C90
+data8 0xDDC569C321FF119C,0x4001 // CA0
+data8 0xB27B65560DF7ADA7,0x3FEF // CN
+// [32; 64)
+data8 0x8DE4127349719B22,0x4001 // C50
+data8 0xA5C30A7760F5FBB2,0x4001 // C60
+data8 0xBCB4096055AA2A4E,0x4001 // C70
+data8 0xD08F5F2FB4E7B899,0x4001 // C80
+data8 0xDF39ED39DC91F9CF,0x4001 // C90
+data8 0xE7063E45322F072E,0x4001 // CA0
+data8 0x85A9E11DDDDE67C8,0x3FF0 // CN
+// [64; 128)
+data8 0x91CA191EB80E8893,0x4001 // C50
+data8 0xA9F1D5A55397334A,0x4001 // C60
+data8 0xC1222710295094E3,0x4001 // C70
+data8 0xD52FFABBA6CBE5C6,0x4001 // C80
+data8 0xE3FD9D5282052E1D,0x4001 // C90
+data8 0xEBDBE47BB662F3EF,0x4001 // CA0
+data8 0xEF889F489D88FD31,0x3FF0 // CN
+// [128; 256)
+data8 0x94AA029C2286F8D2,0x4001 // C50
+data8 0xAD0549E55A72389F,0x4001 // C60
+data8 0xC4628899DAF94BA4,0x4001 // C70
+data8 0xD89432A4161C72CB,0x4001 // C80
+data8 0xE77ABA75E9C38F3A,0x4001 // C90
+data8 0xEF65BFFFF71347FF,0x4001 // CA0
+data8 0xE2627460064D918D,0x3FF1 // CN
+// [256; 512)
+data8 0x96E9890D722C2FC1,0x4001 // C50
+data8 0xAF6C2236F6A1CEC4,0x4001 // C60
+data8 0xC6EBB8C9F987D20D,0x4001 // C70
+data8 0xDB38CEFD5EF328CC,0x4001 // C80
+data8 0xEA3265DC66C9A0B4,0x4001 // C90
+data8 0xF2272D6B368C70B1,0x4001 // CA0
+data8 0xDBFF93ECEBCEF1F3,0x3FF2 // CN
+//
+data8 0x3FDD8B618D5AF8FE // point of local minimum on [1;2]
+data8 0x3FE0000000000000 // 0.5
+data8 0xBFC5555DA7212371 // P5
+data8 0x3FC999A19EEF5826 // P4
+data8 0xb17217f7d1cf79ac,0x3ffe // ln(2)
+data8 0xEB3F8E4325F5A535,0x3FFE // ln(sqrt(4*arcsin(1)))
+//
+data8 0xBFCFFFFFFFFEF009 // P3
+data8 0x3FD555555554ECB2 // P2
+data8 0xBF66C16C16C16C17 // W4=B4/12=-1/360
+data8 0x7F5754D9278B51A8 // overflow boundary (first inf result)
+data8 0xAAAAAAAAAAAAAAAB,0x3FFB // W2=B2/2=1/12
+//
+data8 0x3FBC756AC654273B // Q8
+data8 0xBFC001A42489AB4D // Q7
+data8 0x3FC99999999A169B // Q4
+data8 0xBFD00000000019AC // Q3
+data8 0x3FC2492479AA0DF8 // Q6
+data8 0xBFC5555544986F52 // Q5
+data8 0x3FD5555555555555 // Q2
+data8 0xBFE0000000000000 // Q1, P1 = -0.5
+//
+data8 0x80200aaeac44ef38,0x3ff6 // ln(1/frcpa(1+  0/2^-8))
+data8 0xc09090a2c35aa070,0x3ff7 // ln(1/frcpa(1+  1/2^-8))
+data8 0xa0c94fcb41977c75,0x3ff8 // ln(1/frcpa(1+  2/2^-8))
+data8 0xe18b9c263af83301,0x3ff8 // ln(1/frcpa(1+  3/2^-8))
+data8 0x8d35c8d6399c30ea,0x3ff9 // ln(1/frcpa(1+  4/2^-8))
+data8 0xadd4d2ecd601cbb8,0x3ff9 // ln(1/frcpa(1+  5/2^-8))
+data8 0xce95403a192f9f01,0x3ff9 // ln(1/frcpa(1+  6/2^-8))
+data8 0xeb59392cbcc01096,0x3ff9 // ln(1/frcpa(1+  7/2^-8))
+data8 0x862c7d0cefd54c5d,0x3ffa // ln(1/frcpa(1+  8/2^-8))
+data8 0x94aa63c65e70d499,0x3ffa // ln(1/frcpa(1+  9/2^-8))
+data8 0xa54a696d4b62b382,0x3ffa // ln(1/frcpa(1+ 10/2^-8))
+data8 0xb3e4a796a5dac208,0x3ffa // ln(1/frcpa(1+ 11/2^-8))
+data8 0xc28c45b1878340a9,0x3ffa // ln(1/frcpa(1+ 12/2^-8))
+data8 0xd35c55f39d7a6235,0x3ffa // ln(1/frcpa(1+ 13/2^-8))
+data8 0xe220f037b954f1f5,0x3ffa // ln(1/frcpa(1+ 14/2^-8))
+data8 0xf0f3389b036834f3,0x3ffa // ln(1/frcpa(1+ 15/2^-8))
+data8 0xffd3488d5c980465,0x3ffa // ln(1/frcpa(1+ 16/2^-8))
+data8 0x87609ce2ed300490,0x3ffb // ln(1/frcpa(1+ 17/2^-8))
+data8 0x8ede9321e8c85927,0x3ffb // ln(1/frcpa(1+ 18/2^-8))
+data8 0x96639427f2f8e2f4,0x3ffb // ln(1/frcpa(1+ 19/2^-8))
+data8 0x9defad3e8f73217b,0x3ffb // ln(1/frcpa(1+ 20/2^-8))
+data8 0xa582ebd50097029c,0x3ffb // ln(1/frcpa(1+ 21/2^-8))
+data8 0xac06dbe75ab80fee,0x3ffb // ln(1/frcpa(1+ 22/2^-8))
+data8 0xb3a78449b2d3ccca,0x3ffb // ln(1/frcpa(1+ 23/2^-8))
+data8 0xbb4f79635ab46bb2,0x3ffb // ln(1/frcpa(1+ 24/2^-8))
+data8 0xc2fec93a83523f3f,0x3ffb // ln(1/frcpa(1+ 25/2^-8))
+data8 0xc99af2eaca4c4571,0x3ffb // ln(1/frcpa(1+ 26/2^-8))
+data8 0xd1581106472fa653,0x3ffb // ln(1/frcpa(1+ 27/2^-8))
+data8 0xd8002560d4355f2e,0x3ffb // ln(1/frcpa(1+ 28/2^-8))
+data8 0xdfcb43b4fe508632,0x3ffb // ln(1/frcpa(1+ 29/2^-8))
+data8 0xe67f6dff709d4119,0x3ffb // ln(1/frcpa(1+ 30/2^-8))
+data8 0xed393b1c22351280,0x3ffb // ln(1/frcpa(1+ 31/2^-8))
+data8 0xf5192bff087bcc35,0x3ffb // ln(1/frcpa(1+ 32/2^-8))
+data8 0xfbdf4ff6dfef2fa3,0x3ffb // ln(1/frcpa(1+ 33/2^-8))
+data8 0x81559a97f92f9cc7,0x3ffc // ln(1/frcpa(1+ 34/2^-8))
+data8 0x84be72bce90266e8,0x3ffc // ln(1/frcpa(1+ 35/2^-8))
+data8 0x88bc74113f23def2,0x3ffc // ln(1/frcpa(1+ 36/2^-8))
+data8 0x8c2ba3edf6799d11,0x3ffc // ln(1/frcpa(1+ 37/2^-8))
+data8 0x8f9dc92f92ea08b1,0x3ffc // ln(1/frcpa(1+ 38/2^-8))
+data8 0x9312e8f36efab5a7,0x3ffc // ln(1/frcpa(1+ 39/2^-8))
+data8 0x968b08643409ceb6,0x3ffc // ln(1/frcpa(1+ 40/2^-8))
+data8 0x9a062cba08a1708c,0x3ffc // ln(1/frcpa(1+ 41/2^-8))
+data8 0x9d845b3abf95485c,0x3ffc // ln(1/frcpa(1+ 42/2^-8))
+data8 0xa06fd841bc001bb4,0x3ffc // ln(1/frcpa(1+ 43/2^-8))
+data8 0xa3f3a74652fbe0db,0x3ffc // ln(1/frcpa(1+ 44/2^-8))
+data8 0xa77a8fb2336f20f5,0x3ffc // ln(1/frcpa(1+ 45/2^-8))
+data8 0xab0497015d28b0a0,0x3ffc // ln(1/frcpa(1+ 46/2^-8))
+data8 0xae91c2be6ba6a615,0x3ffc // ln(1/frcpa(1+ 47/2^-8))
+data8 0xb189d1b99aebb20b,0x3ffc // ln(1/frcpa(1+ 48/2^-8))
+data8 0xb51cced5de9c1b2c,0x3ffc // ln(1/frcpa(1+ 49/2^-8))
+data8 0xb819bee9e720d42f,0x3ffc // ln(1/frcpa(1+ 50/2^-8))
+data8 0xbbb2a0947b093a5d,0x3ffc // ln(1/frcpa(1+ 51/2^-8))
+data8 0xbf4ec1505811684a,0x3ffc // ln(1/frcpa(1+ 52/2^-8))
+data8 0xc2535bacfa8975ff,0x3ffc // ln(1/frcpa(1+ 53/2^-8))
+data8 0xc55a3eafad187eb8,0x3ffc // ln(1/frcpa(1+ 54/2^-8))
+data8 0xc8ff2484b2c0da74,0x3ffc // ln(1/frcpa(1+ 55/2^-8))
+data8 0xcc0b1a008d53ab76,0x3ffc // ln(1/frcpa(1+ 56/2^-8))
+data8 0xcfb6203844b3209b,0x3ffc // ln(1/frcpa(1+ 57/2^-8))
+data8 0xd2c73949a47a19f5,0x3ffc // ln(1/frcpa(1+ 58/2^-8))
+data8 0xd5daae18b49d6695,0x3ffc // ln(1/frcpa(1+ 59/2^-8))
+data8 0xd8f08248cf7e8019,0x3ffc // ln(1/frcpa(1+ 60/2^-8))
+data8 0xdca7749f1b3e540e,0x3ffc // ln(1/frcpa(1+ 61/2^-8))
+data8 0xdfc28e033aaaf7c7,0x3ffc // ln(1/frcpa(1+ 62/2^-8))
+data8 0xe2e012a5f91d2f55,0x3ffc // ln(1/frcpa(1+ 63/2^-8))
+data8 0xe600064ed9e292a8,0x3ffc // ln(1/frcpa(1+ 64/2^-8))
+data8 0xe9226cce42b39f60,0x3ffc // ln(1/frcpa(1+ 65/2^-8))
+data8 0xec4749fd97a28360,0x3ffc // ln(1/frcpa(1+ 66/2^-8))
+data8 0xef6ea1bf57780495,0x3ffc // ln(1/frcpa(1+ 67/2^-8))
+data8 0xf29877ff38809091,0x3ffc // ln(1/frcpa(1+ 68/2^-8))
+data8 0xf5c4d0b245cb89be,0x3ffc // ln(1/frcpa(1+ 69/2^-8))
+data8 0xf8f3afd6fcdef3aa,0x3ffc // ln(1/frcpa(1+ 70/2^-8))
+data8 0xfc2519756be1abc7,0x3ffc // ln(1/frcpa(1+ 71/2^-8))
+data8 0xff59119f503e6832,0x3ffc // ln(1/frcpa(1+ 72/2^-8))
+data8 0x8147ce381ae0e146,0x3ffd // ln(1/frcpa(1+ 73/2^-8))
+data8 0x82e45f06cb1ad0f2,0x3ffd // ln(1/frcpa(1+ 74/2^-8))
+data8 0x842f5c7c573cbaa2,0x3ffd // ln(1/frcpa(1+ 75/2^-8))
+data8 0x85ce471968c8893a,0x3ffd // ln(1/frcpa(1+ 76/2^-8))
+data8 0x876e8305bc04066d,0x3ffd // ln(1/frcpa(1+ 77/2^-8))
+data8 0x891012678031fbb3,0x3ffd // ln(1/frcpa(1+ 78/2^-8))
+data8 0x8a5f1493d766a05f,0x3ffd // ln(1/frcpa(1+ 79/2^-8))
+data8 0x8c030c778c56fa00,0x3ffd // ln(1/frcpa(1+ 80/2^-8))
+data8 0x8da85df17e31d9ae,0x3ffd // ln(1/frcpa(1+ 81/2^-8))
+data8 0x8efa663e7921687e,0x3ffd // ln(1/frcpa(1+ 82/2^-8))
+data8 0x90a22b6875c6a1f8,0x3ffd // ln(1/frcpa(1+ 83/2^-8))
+data8 0x91f62cc8f5d24837,0x3ffd // ln(1/frcpa(1+ 84/2^-8))
+data8 0x93a06cfc3857d980,0x3ffd // ln(1/frcpa(1+ 85/2^-8))
+data8 0x94f66d5e6fd01ced,0x3ffd // ln(1/frcpa(1+ 86/2^-8))
+data8 0x96a330156e6772f2,0x3ffd // ln(1/frcpa(1+ 87/2^-8))
+data8 0x97fb3582754ea25b,0x3ffd // ln(1/frcpa(1+ 88/2^-8))
+data8 0x99aa8259aad1bbf2,0x3ffd // ln(1/frcpa(1+ 89/2^-8))
+data8 0x9b0492f6227ae4a8,0x3ffd // ln(1/frcpa(1+ 90/2^-8))
+data8 0x9c5f8e199bf3a7a5,0x3ffd // ln(1/frcpa(1+ 91/2^-8))
+data8 0x9e1293b9998c1daa,0x3ffd // ln(1/frcpa(1+ 92/2^-8))
+data8 0x9f6fa31e0b41f308,0x3ffd // ln(1/frcpa(1+ 93/2^-8))
+data8 0xa0cda11eaf46390e,0x3ffd // ln(1/frcpa(1+ 94/2^-8))
+data8 0xa22c8f029cfa45aa,0x3ffd // ln(1/frcpa(1+ 95/2^-8))
+data8 0xa3e48badb7856b34,0x3ffd // ln(1/frcpa(1+ 96/2^-8))
+data8 0xa5459a0aa95849f9,0x3ffd // ln(1/frcpa(1+ 97/2^-8))
+data8 0xa6a79c84480cfebd,0x3ffd // ln(1/frcpa(1+ 98/2^-8))
+data8 0xa80a946d0fcb3eb2,0x3ffd // ln(1/frcpa(1+ 99/2^-8))
+data8 0xa96e831a3ea7b314,0x3ffd // ln(1/frcpa(1+100/2^-8))
+data8 0xaad369e3dc544e3b,0x3ffd // ln(1/frcpa(1+101/2^-8))
+data8 0xac92e9588952c815,0x3ffd // ln(1/frcpa(1+102/2^-8))
+data8 0xadfa035aa1ed8fdc,0x3ffd // ln(1/frcpa(1+103/2^-8))
+data8 0xaf6219eae1ad6e34,0x3ffd // ln(1/frcpa(1+104/2^-8))
+data8 0xb0cb2e6d8160f753,0x3ffd // ln(1/frcpa(1+105/2^-8))
+data8 0xb2354249ad950f72,0x3ffd // ln(1/frcpa(1+106/2^-8))
+data8 0xb3a056e98ef4a3b4,0x3ffd // ln(1/frcpa(1+107/2^-8))
+data8 0xb50c6dba52c6292a,0x3ffd // ln(1/frcpa(1+108/2^-8))
+data8 0xb679882c33876165,0x3ffd // ln(1/frcpa(1+109/2^-8))
+data8 0xb78c07429785cedc,0x3ffd // ln(1/frcpa(1+110/2^-8))
+data8 0xb8faeb8dc4a77d24,0x3ffd // ln(1/frcpa(1+111/2^-8))
+data8 0xba6ad77eb36ae0d6,0x3ffd // ln(1/frcpa(1+112/2^-8))
+data8 0xbbdbcc915e9bee50,0x3ffd // ln(1/frcpa(1+113/2^-8))
+data8 0xbd4dcc44f8cf12ef,0x3ffd // ln(1/frcpa(1+114/2^-8))
+data8 0xbec0d81bf5b531fa,0x3ffd // ln(1/frcpa(1+115/2^-8))
+data8 0xc034f19c139186f4,0x3ffd // ln(1/frcpa(1+116/2^-8))
+data8 0xc14cb69f7c5e55ab,0x3ffd // ln(1/frcpa(1+117/2^-8))
+data8 0xc2c2abbb6e5fd56f,0x3ffd // ln(1/frcpa(1+118/2^-8))
+data8 0xc439b2c193e6771e,0x3ffd // ln(1/frcpa(1+119/2^-8))
+data8 0xc553acb9d5c67733,0x3ffd // ln(1/frcpa(1+120/2^-8))
+data8 0xc6cc96e441272441,0x3ffd // ln(1/frcpa(1+121/2^-8))
+data8 0xc8469753eca88c30,0x3ffd // ln(1/frcpa(1+122/2^-8))
+data8 0xc962cf3ce072b05c,0x3ffd // ln(1/frcpa(1+123/2^-8))
+data8 0xcadeba8771f694aa,0x3ffd // ln(1/frcpa(1+124/2^-8))
+data8 0xcc5bc08d1f72da94,0x3ffd // ln(1/frcpa(1+125/2^-8))
+data8 0xcd7a3f99ea035c29,0x3ffd // ln(1/frcpa(1+126/2^-8))
+data8 0xcef93860c8a53c35,0x3ffd // ln(1/frcpa(1+127/2^-8))
+data8 0xd0192f68a7ed23df,0x3ffd // ln(1/frcpa(1+128/2^-8))
+data8 0xd19a201127d3c645,0x3ffd // ln(1/frcpa(1+129/2^-8))
+data8 0xd2bb92f4061c172c,0x3ffd // ln(1/frcpa(1+130/2^-8))
+data8 0xd43e80b2ee8cc8fc,0x3ffd // ln(1/frcpa(1+131/2^-8))
+data8 0xd56173601fc4ade4,0x3ffd // ln(1/frcpa(1+132/2^-8))
+data8 0xd6e6637efb54086f,0x3ffd // ln(1/frcpa(1+133/2^-8))
+data8 0xd80ad9f58f3c8193,0x3ffd // ln(1/frcpa(1+134/2^-8))
+data8 0xd991d1d31aca41f8,0x3ffd // ln(1/frcpa(1+135/2^-8))
+data8 0xdab7d02231484a93,0x3ffd // ln(1/frcpa(1+136/2^-8))
+data8 0xdc40d532cde49a54,0x3ffd // ln(1/frcpa(1+137/2^-8))
+data8 0xdd685f79ed8b265e,0x3ffd // ln(1/frcpa(1+138/2^-8))
+data8 0xde9094bbc0e17b1d,0x3ffd // ln(1/frcpa(1+139/2^-8))
+data8 0xe01c91b78440c425,0x3ffd // ln(1/frcpa(1+140/2^-8))
+data8 0xe14658f26997e729,0x3ffd // ln(1/frcpa(1+141/2^-8))
+data8 0xe270cdc2391e0d23,0x3ffd // ln(1/frcpa(1+142/2^-8))
+data8 0xe3ffce3a2aa64922,0x3ffd // ln(1/frcpa(1+143/2^-8))
+data8 0xe52bdb274ed82887,0x3ffd // ln(1/frcpa(1+144/2^-8))
+data8 0xe6589852e75d7df6,0x3ffd // ln(1/frcpa(1+145/2^-8))
+data8 0xe786068c79937a7d,0x3ffd // ln(1/frcpa(1+146/2^-8))
+data8 0xe91903adad100911,0x3ffd // ln(1/frcpa(1+147/2^-8))
+data8 0xea481236f7d35bb0,0x3ffd // ln(1/frcpa(1+148/2^-8))
+data8 0xeb77d48c692e6b14,0x3ffd // ln(1/frcpa(1+149/2^-8))
+data8 0xeca84b83d7297b87,0x3ffd // ln(1/frcpa(1+150/2^-8))
+data8 0xedd977f4962aa158,0x3ffd // ln(1/frcpa(1+151/2^-8))
+data8 0xef7179a22f257754,0x3ffd // ln(1/frcpa(1+152/2^-8))
+data8 0xf0a450d139366ca7,0x3ffd // ln(1/frcpa(1+153/2^-8))
+data8 0xf1d7e0524ff9ffdb,0x3ffd // ln(1/frcpa(1+154/2^-8))
+data8 0xf30c29036a8b6cae,0x3ffd // ln(1/frcpa(1+155/2^-8))
+data8 0xf4412bc411ea8d92,0x3ffd // ln(1/frcpa(1+156/2^-8))
+data8 0xf576e97564c8619d,0x3ffd // ln(1/frcpa(1+157/2^-8))
+data8 0xf6ad62fa1b5f172f,0x3ffd // ln(1/frcpa(1+158/2^-8))
+data8 0xf7e499368b55c542,0x3ffd // ln(1/frcpa(1+159/2^-8))
+data8 0xf91c8d10abaffe22,0x3ffd // ln(1/frcpa(1+160/2^-8))
+data8 0xfa553f7018c966f3,0x3ffd // ln(1/frcpa(1+161/2^-8))
+data8 0xfb8eb13e185d802c,0x3ffd // ln(1/frcpa(1+162/2^-8))
+data8 0xfcc8e3659d9bcbed,0x3ffd // ln(1/frcpa(1+163/2^-8))
+data8 0xfe03d6d34d487fd2,0x3ffd // ln(1/frcpa(1+164/2^-8))
+data8 0xff3f8c7581e9f0ae,0x3ffd // ln(1/frcpa(1+165/2^-8))
+data8 0x803e029e280173ae,0x3ffe // ln(1/frcpa(1+166/2^-8))
+data8 0x80dca10cc52d0757,0x3ffe // ln(1/frcpa(1+167/2^-8))
+data8 0x817ba200632755a1,0x3ffe // ln(1/frcpa(1+168/2^-8))
+data8 0x821b05f3b01d6774,0x3ffe // ln(1/frcpa(1+169/2^-8))
+data8 0x82bacd623ff19d06,0x3ffe // ln(1/frcpa(1+170/2^-8))
+data8 0x835af8c88e7a8f47,0x3ffe // ln(1/frcpa(1+171/2^-8))
+data8 0x83c5f8299e2b4091,0x3ffe // ln(1/frcpa(1+172/2^-8))
+data8 0x8466cb43f3d87300,0x3ffe // ln(1/frcpa(1+173/2^-8))
+data8 0x850803a67c80ca4b,0x3ffe // ln(1/frcpa(1+174/2^-8))
+data8 0x85a9a1d11a23b461,0x3ffe // ln(1/frcpa(1+175/2^-8))
+data8 0x864ba644a18e6e05,0x3ffe // ln(1/frcpa(1+176/2^-8))
+data8 0x86ee1182dcc432f7,0x3ffe // ln(1/frcpa(1+177/2^-8))
+data8 0x875a925d7e48c316,0x3ffe // ln(1/frcpa(1+178/2^-8))
+data8 0x87fdaa109d23aef7,0x3ffe // ln(1/frcpa(1+179/2^-8))
+data8 0x88a129ed4becfaf2,0x3ffe // ln(1/frcpa(1+180/2^-8))
+data8 0x89451278ecd7f9cf,0x3ffe // ln(1/frcpa(1+181/2^-8))
+data8 0x89b29295f8432617,0x3ffe // ln(1/frcpa(1+182/2^-8))
+data8 0x8a572ac5a5496882,0x3ffe // ln(1/frcpa(1+183/2^-8))
+data8 0x8afc2d0ce3b2dadf,0x3ffe // ln(1/frcpa(1+184/2^-8))
+data8 0x8b6a69c608cfd3af,0x3ffe // ln(1/frcpa(1+185/2^-8))
+data8 0x8c101e106e899a83,0x3ffe // ln(1/frcpa(1+186/2^-8))
+data8 0x8cb63de258f9d626,0x3ffe // ln(1/frcpa(1+187/2^-8))
+data8 0x8d2539c5bd19e2b1,0x3ffe // ln(1/frcpa(1+188/2^-8))
+data8 0x8dcc0e064b29e6f1,0x3ffe // ln(1/frcpa(1+189/2^-8))
+data8 0x8e734f45d88357ae,0x3ffe // ln(1/frcpa(1+190/2^-8))
+data8 0x8ee30cef034a20db,0x3ffe // ln(1/frcpa(1+191/2^-8))
+data8 0x8f8b0515686d1d06,0x3ffe // ln(1/frcpa(1+192/2^-8))
+data8 0x90336bba039bf32f,0x3ffe // ln(1/frcpa(1+193/2^-8))
+data8 0x90a3edd23d1c9d58,0x3ffe // ln(1/frcpa(1+194/2^-8))
+data8 0x914d0de2f5d61b32,0x3ffe // ln(1/frcpa(1+195/2^-8))
+data8 0x91be0c20d28173b5,0x3ffe // ln(1/frcpa(1+196/2^-8))
+data8 0x9267e737c06cd34a,0x3ffe // ln(1/frcpa(1+197/2^-8))
+data8 0x92d962ae6abb1237,0x3ffe // ln(1/frcpa(1+198/2^-8))
+data8 0x9383fa6afbe2074c,0x3ffe // ln(1/frcpa(1+199/2^-8))
+data8 0x942f0421651c1c4e,0x3ffe // ln(1/frcpa(1+200/2^-8))
+data8 0x94a14a3845bb985e,0x3ffe // ln(1/frcpa(1+201/2^-8))
+data8 0x954d133857f861e7,0x3ffe // ln(1/frcpa(1+202/2^-8))
+data8 0x95bfd96468e604c4,0x3ffe // ln(1/frcpa(1+203/2^-8))
+data8 0x9632d31cafafa858,0x3ffe // ln(1/frcpa(1+204/2^-8))
+data8 0x96dfaabd86fa1647,0x3ffe // ln(1/frcpa(1+205/2^-8))
+data8 0x9753261fcbb2a594,0x3ffe // ln(1/frcpa(1+206/2^-8))
+data8 0x9800c11b426b996d,0x3ffe // ln(1/frcpa(1+207/2^-8))
+data8 0x9874bf4d45ae663c,0x3ffe // ln(1/frcpa(1+208/2^-8))
+data8 0x99231f5ee9a74f79,0x3ffe // ln(1/frcpa(1+209/2^-8))
+data8 0x9997a18a56bcad28,0x3ffe // ln(1/frcpa(1+210/2^-8))
+data8 0x9a46c873a3267e79,0x3ffe // ln(1/frcpa(1+211/2^-8))
+data8 0x9abbcfc621eb6cb6,0x3ffe // ln(1/frcpa(1+212/2^-8))
+data8 0x9b310cb0d354c990,0x3ffe // ln(1/frcpa(1+213/2^-8))
+data8 0x9be14cf9e1b3515c,0x3ffe // ln(1/frcpa(1+214/2^-8))
+data8 0x9c5710b8cbb73a43,0x3ffe // ln(1/frcpa(1+215/2^-8))
+data8 0x9ccd0abd301f399c,0x3ffe // ln(1/frcpa(1+216/2^-8))
+data8 0x9d7e67f3bdce8888,0x3ffe // ln(1/frcpa(1+217/2^-8))
+data8 0x9df4ea81a99daa01,0x3ffe // ln(1/frcpa(1+218/2^-8))
+data8 0x9e6ba405a54514ba,0x3ffe // ln(1/frcpa(1+219/2^-8))
+data8 0x9f1e21c8c7bb62b3,0x3ffe // ln(1/frcpa(1+220/2^-8))
+data8 0x9f956593f6b6355c,0x3ffe // ln(1/frcpa(1+221/2^-8))
+data8 0xa00ce1092e5498c3,0x3ffe // ln(1/frcpa(1+222/2^-8))
+data8 0xa0c08309c4b912c1,0x3ffe // ln(1/frcpa(1+223/2^-8))
+data8 0xa1388a8c6faa2afa,0x3ffe // ln(1/frcpa(1+224/2^-8))
+data8 0xa1b0ca7095b5f985,0x3ffe // ln(1/frcpa(1+225/2^-8))
+data8 0xa22942eb47534a00,0x3ffe // ln(1/frcpa(1+226/2^-8))
+data8 0xa2de62326449d0a3,0x3ffe // ln(1/frcpa(1+227/2^-8))
+data8 0xa357690f88bfe345,0x3ffe // ln(1/frcpa(1+228/2^-8))
+data8 0xa3d0a93f45169a4b,0x3ffe // ln(1/frcpa(1+229/2^-8))
+data8 0xa44a22f7ffe65f30,0x3ffe // ln(1/frcpa(1+230/2^-8))
+data8 0xa500c5e5b4c1aa36,0x3ffe // ln(1/frcpa(1+231/2^-8))
+data8 0xa57ad064eb2ebbc2,0x3ffe // ln(1/frcpa(1+232/2^-8))
+data8 0xa5f5152dedf4384e,0x3ffe // ln(1/frcpa(1+233/2^-8))
+data8 0xa66f9478856233ec,0x3ffe // ln(1/frcpa(1+234/2^-8))
+data8 0xa6ea4e7cca02c32e,0x3ffe // ln(1/frcpa(1+235/2^-8))
+data8 0xa765437325341ccf,0x3ffe // ln(1/frcpa(1+236/2^-8))
+data8 0xa81e21e6c75b4020,0x3ffe // ln(1/frcpa(1+237/2^-8))
+data8 0xa899ab333fe2b9ca,0x3ffe // ln(1/frcpa(1+238/2^-8))
+data8 0xa9157039c51ebe71,0x3ffe // ln(1/frcpa(1+239/2^-8))
+data8 0xa991713433c2b999,0x3ffe // ln(1/frcpa(1+240/2^-8))
+data8 0xaa0dae5cbcc048b3,0x3ffe // ln(1/frcpa(1+241/2^-8))
+data8 0xaa8a27ede5eb13ad,0x3ffe // ln(1/frcpa(1+242/2^-8))
+data8 0xab06de228a9e3499,0x3ffe // ln(1/frcpa(1+243/2^-8))
+data8 0xab83d135dc633301,0x3ffe // ln(1/frcpa(1+244/2^-8))
+data8 0xac3fb076adc7fe7a,0x3ffe // ln(1/frcpa(1+245/2^-8))
+data8 0xacbd3cbbe47988f1,0x3ffe // ln(1/frcpa(1+246/2^-8))
+data8 0xad3b06b1a5dc57c3,0x3ffe // ln(1/frcpa(1+247/2^-8))
+data8 0xadb90e94af887717,0x3ffe // ln(1/frcpa(1+248/2^-8))
+data8 0xae3754a218f7c816,0x3ffe // ln(1/frcpa(1+249/2^-8))
+data8 0xaeb5d9175437afa2,0x3ffe // ln(1/frcpa(1+250/2^-8))
+data8 0xaf349c322e9c7cee,0x3ffe // ln(1/frcpa(1+251/2^-8))
+data8 0xafb39e30d1768d1c,0x3ffe // ln(1/frcpa(1+252/2^-8))
+data8 0xb032df51c2c93116,0x3ffe // ln(1/frcpa(1+253/2^-8))
+data8 0xb0b25fd3e6035ad9,0x3ffe // ln(1/frcpa(1+254/2^-8))
+data8 0xb1321ff67cba178c,0x3ffe // ln(1/frcpa(1+255/2^-8))
+//
+data8 0xC7DC2985D3B44557,0x3FCA // A00
+//
+// polynomial approximation of ln(GAMMA(x)), 1 <= x < 2.25
+// [0.875,1.25)
+data8 0xBF9A04F7E40C8498,0x3FAB79D8D9380F03 // C17,C16
+data8 0xBFB3B63609CA0CBD,0x3FB5564EA1675539 // C13,C12
+data8 0xBFBC806766F48C41,0x3FC010B36CDA773A // C9,C8
+data8 0xD45CE0BD54BE3D67,0xBFFC // C5
+data8 0xCD26AADF559676D0,0xBFFD // C3
+data8 0x93C467E37DB0C7A7,0xBFFE // C1
+data8 0xBFB10C251723B123,0x3FB2669DAD69A12D // C15,C14
+data8 0xBFB748A3CFCE4717,0x3FB9A01DEE29966A // C11,C10
+data8 0xBFC2703A1D85497E,0x3FC5B40CB0FD353C // C7,C6
+data8 0x8A8991563ECBBA5D,0x3FFD // C4
+data8 0xD28D3312983E9844,0x3FFE // C2
+data8 0,0                       // C0
+// [1.25,1.75)
+data8 0xBF12680486396DE6,0x3F23C51FC332CD9D // C17,C16
+data8 0xBF422633DA3A1496,0x3F4CC70680768857 // C13,C12
+data8 0xBF6E2F1A1F804B5D,0x3F78FCE02A032428 // C9,C8
+data8 0x864D46FA895985C1,0xBFFA // C5
+data8 0x97213C6E35E12043,0xBFFC // C3
+data8 0x8A8A42A401D979B7,0x3FC7 // C1
+data8 0xBF2E098A8A2332A8,0x3F370E61B73B205C // C15,C14
+data8 0xBF56F9849D3BC6CC,0x3F6283126F58D7F4 // C11,C10
+data8 0xBF851F9F9516A98F,0x3F9266E797A1433F // C7,C6
+data8 0x845A14A6A81B0638,0x3FFB // C4
+data8 0xF7B95E4771C55C99,0x3FFD // C2
+data8 0xF8CDCDE61C520E0F,0xBFFB // C0
+// [1.75,2.25)
+data8 0xBEA01D7AFA5D8F52,0x3EB1010986E60253 // C17,C16
+data8 0xBEE3CBEDB4C918AA,0x3EF580F6D9D0F72D // C13,C12
+data8 0xBF2D3FD4C7F68563,0x3F40B36AF884AE9A // C9,C8
+data8 0xF2027E10C7B051EC,0xBFF7 // C5
+data8 0x89F000D2ABB03401,0xBFFB // C3
+data8 0xD8773039049E70B6,0x3FFD // C1
+data8 0xBEC112CD07CFC31A,0x3ED2528A428D30E1 // C15,C14
+data8 0xBF078DE5618D8C9F,0x3F1A127AD811A53D // C11,C10
+data8 0xBF538AC5C2BF540D,0x3F67ADD6EADB5718 // C7,C6
+data8 0xA8991563EC243383,0x3FF9 // C4
+data8 0xA51A6625307D3230,0x3FFD // C2
+data8 0,0                       // C0
+//
+// polynomial approximation of ln(sin(Pi*x)/(Pi*x)), 9 <= x <= 0.5
+data8 0xBFDC1BF0931AE591,0x3FD36D6D6CE263D7 //S28,S26
+data8 0xBFBD516F4FD9FB18,0xBFBBE1703F315086 //S20,S18
+data8 0xAAB5A3CCEFCD3628,0xBFFC //S12
+data8 0x80859B5C318E19A5,0xBFFD //S8
+data8 0x8A8991563EC7EB33,0xBFFE //S4
+data8 0xBFD23AB9E6CC88AC,0xBF9957F5146FC7AF //S24,S22
+data8 0xBFC007B324E23040,0xBFC248DEC29CAC4A //S16,S14
+data8 0xCD00EFF2F8F86899,0xBFFC //S10
+data8 0xADA06587FACD668B,0xBFFD //S6
+data8 0xD28D3312983E98A0,0xBFFF //S2
+//
+data8 0x8090F777D7942F73,0x4001 // PR01
+data8 0xE5B521193CF61E63,0x4000 // PR11
+data8 0xC02C000000001939 // (-15;-14)
+data8 0x0000000000000233 // (-15;-14)
+data8 0xC02A000000016124 // (-14;-13)
+data8 0x0000000000002BFB // (-14;-13)
+data8 0xC02800000011EED9 // (-13;-12)
+data8 0x0000000000025CBB // (-13;-12)
+data8 0xC026000000D7322A // (-12;-11)
+data8 0x00000000001E1095 // (-12;-11)
+data8 0xC0240000093F2777 // (-11;-10)
+data8 0x00000000013DD3DC // (-11;-10)
+data8 0xC02200005C7768FB // (-10;-9)
+data8 0x000000000C9539B9 // (-10;-9)
+data8 0xC02000034028B3F9 // (-9;-8)
+data8 0x000000007570C565 // (-9;-8)
+data8 0xC01C0033FDEDFE1F // (-8;-7)
+data8 0x00000007357E670E // (-8;-7)
+data8 0xC018016B25897C8D // (-7;-6)
+data8 0x000000346DC5D639 // (-7;-6)
+data8 0xC014086A57F0B6D9 // (-6;-5)
+data8 0x0000010624DD2F1B // (-6;-5)
+data8 0xC010284E78599581 // (-5;-4)
+data8 0x0000051EB851EB85 // (-5;-4)
+data8 0xC009260DBC9E59AF // (-4;-3)
+data8 0x000028F5C28F5C29 // (-4;-3)
+data8 0xC003A7FC9600F86C // (-3;-2)
+data8 0x0000666666666666 // (-3;-2)
+data8 0xCC15879606130890,0x4000 // PR21
+data8 0xB42FE3281465E1CC,0x4000 // PR31
+//
+data8 0x828185F0B95C9916,0x4001 // PR00
+//
+data8 0xD4D3C819E4E5654B,0x4000 // PR10
+data8 0xA82FBBA4FCC75298,0x4000 // PR20
+data8 0xC02DFFFFFFFFFE52 // (-15;-14)
+data8 0x000000000000001C // (-15;-14)
+data8 0xC02BFFFFFFFFE6C7 // (-14;-13)
+data8 0x00000000000001A6 // (-14;-13)
+data8 0xC029FFFFFFFE9EDC // (-13;-12)
+data8 0x0000000000002BFB // (-13;-12)
+data8 0xC027FFFFFFEE1127 // (-12;-11)
+data8 0x000000000001EEC8 // (-12;-11)
+data8 0xC025FFFFFF28CDD4 // (-11;-10)
+data8 0x00000000001E1095 // (-11;-10)
+data8 0xC023FFFFF6C0D7C0 // (-10;-9)
+data8 0x000000000101B2B3 // (-10;-9)
+data8 0xC021FFFFA3884BD0 // (-9;-8)
+data8 0x000000000D6BF94D // (-9;-8)
+data8 0xC01FFFF97F8159CF // (-8;-7)
+data8 0x00000000C9539B89 // (-8;-7)
+data8 0xC01BFFCBF76B86F0 // (-7;-6)
+data8 0x00000007357E670E // (-7;-6)
+data8 0xC017FE92F591F40D // (-6;-5)
+data8 0x000000346DC5D639 // (-6;-5)
+data8 0xC013F7577A6EEAFD // (-5;-4)
+data8 0x00000147AE147AE1 // (-5;-4)
+data8 0xC00FA471547C2FE5 // (-4;-3)
+data8 0x00000C49BA5E353F // (-4;-3)
+data8 0xC005FB410A1BD901 // (-3;-2)
+data8 0x000053F7CED91687 // (-3;-2)
+data8 0x80151BB918A293AA,0x4000 // PR30
+data8 0xB3C9F8F47422A314,0x400B // PRN
+//
+// right negative roots
+//(-3;-2)
+data8 0x40BFCF8B90BE7F6B,0x40B237623345EFC3 // A15,A14
+data8 0x407A92EFB03B281E,0x40728700C7819759 // A11,A10
+data8 0x403809F04EF4D0F2,0x4038D32F682D9593 // A7,A6
+data8 0xB4A5302C53C2F2D8,0x3FFF // A3
+data8 0xC1FF4B357A9B0383,0x3FFF // A1
+data8 0x409C46632EB4B2D3,0x4091A72AFA2148F5 // A13,A12
+data8 0x4059297AC79A88DB,0x40548EAA7BE7FA6B // A9,A8
+data8 0x4017339FE04B227F,0x4021718D7CA09E02 // A5,A4
+data8 0x9B775D8017AAE668,0x4001 // A2
+data8 0x8191DB68FF4366A1,0x3FC9 // A0
+//(-4;-3)
+data8 0x425260910D35307B,0x422668F5BE7983BB // A15,A14
+data8 0x41A4454DBE4BEE43,0x41799CA93F6EA817 // A11,A10
+data8 0x40FBB97AA1400F31,0x40D293C3F7ADAB15 // A7,A6
+data8 0xE089B8926AE4517B,0x4005 // A3
+data8 0xF90532F97D630C69,0x4001 // A1
+data8 0x41F9F0CF98C5F2EA,0x41D026336C6BF394 // A13,A12
+data8 0x415057F61156D5B8,0x41251EA3055CB754 // A9,A8
+data8 0x40A99A6337D9FC2B,0x408267203D776151 // A5,A4
+data8 0xCEA694BB8A8827A9,0x4003 // A2
+data8 0xF4B02F1D73D30EED,0x3FCD // A0
+//(-5;-4)
+data8 0x4412365489340979,0x43C86441BAFDEE39 // A15,A14
+data8 0x42ED68FCB19352DD,0x42A45FCE3905CD6F // A11,A10
+data8 0x41CD14FE49FD4FCA,0x41855E3DBFA89744 // A7,A6
+data8 0xAACD88D954E0EC16,0x400B // A3
+data8 0xD652E7A490B0DCDF,0x4003 // A1
+data8 0x437F52608E0E752A,0x433560E0633E33D5 // A13,A12
+data8 0x425C83998976DE3D,0x421433DCCD3B473B // A9,A8
+data8 0x4140261EB5732106,0x40F96D18E21AE6CC // A5,A4
+data8 0xA220AE6C09FA8A0E,0x4007 // A2
+data8 0xCC1682D17A2B5A58,0xBFCF // A0
+//(-6;-5)
+data8 0x4630E41D6386CF5A,0x45C2E7992C628C8C // A15,A14
+data8 0x447AABEC714F913A,0x440EDCAB45339F3A // A11,A10
+data8 0x42C9A8D00C97E3CE,0x425F7D8D5BEAB44D // A7,A6
+data8 0x929EC2B1FB95BB5B,0x4012 // A3
+data8 0xF6B970414D717D38,0x4005 // A1
+data8 0x45545E578976F6A2,0x44E738288DD52686 // A13,A12
+data8 0x43A20921FEC49492,0x433557FD7C6A41B3 // A9,A8
+data8 0x41F3E01773761DB4,0x418A225DF2DA6C47 // A5,A4
+data8 0xE7661976117F9312,0x400B // A2
+data8 0xC33C13FEE07494DE,0x3FCF // A0
+//(-7;-6)
+data8 0x4898F1E6133305AD,0x4802C5306FE4A850 // A15,A14
+data8 0x463FD37946B44094,0x45A8D489B784C2DD // A11,A10
+data8 0x43E9500995815F06,0x4354F21E2FEE6DF5 // A7,A6
+data8 0xEF281D1E1BBE10BD,0x4019 // A3
+data8 0xB4EF24F1D78C2029,0x4008 // A1
+data8 0x476AB1D5930011E5,0x46D4867E77BFB622 // A13,A12
+data8 0x45139151ECDEF7C5,0x447F3A2BC6BF466F // A9,A8
+data8 0x42C1D3D50713FA40,0x422F9C7B52556A1B // A5,A4
+data8 0xFE711A4267CEA83A,0x4010 // A2
+data8 0xD11E91B3FF8F4B94,0xBFD2 // A0
+//(-8;-7)
+data8 0x4B39E57569811B6E,0x4A7656073EB1FA21 // A15,A14
+data8 0x482C9B24A516B0BB,0x47698FF55139C62B // A11,A10
+data8 0x452393E2BC8E8D04,0x44628E1C710DA478 // A7,A6
+data8 0x9F2A95AF1B7A773F,0x4022 // A3
+data8 0x9DA03D51C303C918,0x400B // A1
+data8 0x49B24C241A3D5BCB,0x48F01CB936ECDA67 // A13,A12
+data8 0x46A712B3425C6797,0x45E5164114BD6DA1 // A9,A8
+data8 0x43A216A356069D01,0x42E25E42A45E2108 // A5,A4
+data8 0xC1F42ED57BBC2529,0x4016 // A2
+data8 0xB1C7B615A7DCA8A9,0xBFD7 // A0
+//(-9;-8)
+data8 0x4E09D478E5EE857D,0x4D1647782106E9AB // A15,A14
+data8 0x4A3C7F4D51927548,0x49497954796D743A // A11,A10
+data8 0x467387BD6AF0CBDF,0x4582843E134111D2 // A7,A6
+data8 0x9F003C6DE9666513,0x402B // A3
+data8 0x9D8447F6BF99950A,0x400E // A1
+data8 0x4C22364D238C61A9,0x4B300B18050AB940 // A13,A12
+data8 0x4857004D64215772,0x4765074E448C3C9A // A9,A8
+data8 0x44920E9EA07BF624,0x43A257BEC94BBF48 // A5,A4
+data8 0xC1D1C49AC5B2A4B4,0x401C // A2
+data8 0x9A749AF9F2D2E688,0x3FDB // A0
+//(-10;-9)
+data8 0x5102C7C43EA26C83,0x4FDCD174DEB0426B // A15,A14
+data8 0x4C6A036195CD5BAD,0x4B44ABB52B65628A // A11,A10
+data8 0x47D6439374B98FED,0x46B2C3903EF44D7D // A7,A6
+data8 0xE25BAF73AB8A7DB3,0x4034 // A3
+data8 0xB130901CA6D81B61,0x4011 // A1
+data8 0x4EB50BB0726AE206,0x4D907A96E6D2B6E2 // A13,A12
+data8 0x4A20975D78EAF01A,0x48FAF79C9C3E7908 // A9,A8
+data8 0x459044144129A247,0x446D6043FA3150A3 // A5,A4
+data8 0xF547997E083D9BA7,0x4022 // A2
+data8 0x977AF525A6ECA1BC,0x3FDC // A0
+//(-11;-10)
+data8 0x5420A5D5E90C6D73,0x52C4710A503DC67A // A15,A14
+data8 0x4EB2ED07BA88D2A8,0x4D581001ED9A5ECE // A11,A10
+data8 0x494A8A28E9E3DFEF,0x47F1E4E1E476793E // A7,A6
+data8 0xDD0C97E12D4A3378,0x403E // A3
+data8 0xDD7C12D5182FD543,0x4014 // A1
+data8 0x5167ED536877A072,0x500DF9AF21DDC0B6 // A13,A12
+data8 0x4BFEE6F04BC34FF8,0x4AA4175CEF736A5E // A9,A8
+data8 0x4698D1B4388FEC78,0x4541EDE7607A600D // A5,A4
+data8 0xBF9F645F282AC552,0x4029 // A2
+data8 0xAE1BBE4D3CDACCF4,0x3FE1 // A0
+//(-12;-11)
+data8 0x575F0EEF5FB7D4C0,0x55CBB7302B211A7C // A15,A14
+data8 0x5113A4F1825C7CB2,0x4F822A0D46E0605A // A11,A10
+data8 0x4ACED38FC8BE069A,0x493E3B56D2649F18 // A7,A6
+data8 0x8FA8FF5DF8B72D5E,0x4049 // A3
+data8 0x9845417E8598D642,0x4018 // A1
+data8 0x5437780541C3F2D3,0x52A56279B563C1B2 // A13,A12
+data8 0x4DF0F71A48C50188,0x4C600B358988DEBF // A9,A8
+data8 0x47AE7EE95BDA3DE9,0x46200599DC16B18F // A5,A4
+data8 0xB5249F914932E55D,0x4030 // A2
+data8 0xEAE760CD2C086094,0x3FE5 // A0
+//(-13;-12)
+data8 0x5ABA5848651F6D18,0x58EF60D8A817650B // A15,A14
+data8 0x538A8CA86E13EFB1,0x51C05DBD4D01076D // A11,A10
+data8 0x4C607594C339D259,0x4A9585BD5BF932BB // A7,A6
+data8 0xF26D282C36EC3611,0x4053 // A3
+data8 0xE467DF4810EE7EEE,0x401B // A1
+data8 0x5721D9BA485E8CC3,0x5555AF2CCFB2104D // A13,A12
+data8 0x4FF4619A17B14EA6,0x4E29B2F29EB9F8C4 // A9,A8
+data8 0x48CCF27629D46E79,0x47044715F991A63D // A5,A4
+data8 0xCBC92FB9BDAA95A9,0x4037 // A2
+data8 0xFB743A426163665B,0xBFE6 // A0
+//(-14;-13)
+data8 0x5E3295B24B353EAA,0x5C2B447E29796F20 // A15,A14
+data8 0x5615A35CB5EAFAE5,0x54106AB089C95CAF // A11,A10
+data8 0x4DFEC7D93501900A,0x4BF8C4C685F01B83 // A7,A6
+data8 0x820899603D9A74D5,0x405F // A3
+data8 0xB9949919933821CB,0x401F // A1
+data8 0x5A23373DB9A995AC,0x581CBA0AF7F53009 // A13,A12
+data8 0x520929836BB304CD,0x500386409A7076DA // A9,A8
+data8 0x49F480173FEAF90B,0x47F1ACB14B810793 // A5,A4
+data8 0x86881B8674DBF205,0x403F // A2
+data8 0x8CF3CC35AA2C5F90,0x3FED // A0
+//(-15;-14)
+data8 0x61C37D53BE0029D6,0x5F80667CD9D68354 // A15,A14
+data8 0x58B3F01898E6605B,0x567149652116DB6A // A11,A10
+data8 0x4FA82FA4F5D35B00,0x4D663DB00832DF8F // A7,A6
+data8 0xAE426731C9B94996,0x406A // A3
+data8 0xA264C84BE3708F3F,0x4023 // A1
+data8 0x5D3B254BC1C806A8,0x5AF72E736048B553 // A13,A12
+data8 0x542E476505104BB0,0x51EAD96CDC4FB48F // A9,A8
+data8 0x4B25095F498DB134,0x48E4B9FDEBFE24AB // A5,A4
+data8 0xCE076A5A116C1D34,0x4046 // A2
+data8 0x940013871A15050B,0x3FF1 // A0
+//
+// left negative roots
+//(-3;-2)
+data8 0x41AEB7998DBE2B2C,0xC19053D8FAC05DF7 // A16,A15
+data8 0x4133197BF1ADEAF9,0xC1150728B9B82072 // A12,A11
+data8 0x40BDBA65E74F4526,0xC0A12239BEEF8F72 // A8,A7
+data8 0xFA8256664F99E2AA,0x4004 // A4
+data8 0x9933F9E132D2A5DB,0x4002 // A2
+data8 0x416FFB167B85F77C,0xC15166AE0ACCF87C // A14,A13
+data8 0x40F75815106322C0,0xC0DA2D23C59C348D // A10,A9
+data8 0x4084373F7CC42043,0xC0685884581F8C61 // A6,A5
+data8 0xA0C2D6186460FF9D,0xC003 // A3
+data8 0xF5096D48258CA0AD,0xBFFF // A1
+//(-4;-3)
+data8 0xC3E5BD233016D4B9,0x43A084DAD2D94AB1 // A15,A14
+data8 0xC2CCFFF5E5AED722,0x4286D143AC7D29A6 // A11,A10
+data8 0xC1B7DBBE0680D07B,0x4173E8F3ABB79CED // A7,A6
+data8 0xE929ACEA59799BAF,0xC00A // A3
+data8 0xA5CCECB362B21E1C,0xC003 // A1
+data8 0xC357EED873871B81,0x43128E0B873204FC // A13,A12
+data8 0xC242225FA76E8450,0x41FD2F76AE7386CE // A9,A8
+data8 0xC13116F7806D0C7A,0x40EE8F829F141025 // A5,A4
+data8 0xFBB6F57021B5B397,0x4006 // A2
+data8 0xEEE019B4C05AC269,0xBFCB // A0
+//(-5;-4)
+data8 0xC626A52FE8AAA100,0x45B9FD1F4DDFE31E // A15,A14
+data8 0xC473812A5675F08B,0x440738530AECC254 // A11,A10
+data8 0xC2C5068B3F94AC27,0x425A8C5C539A500B // A7,A6
+data8 0x869FBFF732F20C3A,0xC012 // A3
+data8 0xE91251F7CF25A655,0xC005 // A1
+data8 0xC54C18CB48E5DA0F,0x44E07BD36FF561DF // A13,A12
+data8 0xC39BEC120D2FEBEA,0x4330FFA5388435BE // A9,A8
+data8 0xC1F13D5D163B7FB5,0x418752A6F5AC0F39 // A5,A4
+data8 0xDA99E33C51D360F0,0x400B // A2
+data8 0x9F47A66A2F53D9B9,0x3FD1 // A0
+//(-6;-5)
+data8 0xC8970DAC16B6D59E,0x480170728306FD76 // A15,A14
+data8 0xC63E0E5030604CF3,0x45A7924D74D57C65 // A11,A10
+data8 0xC3E8684E41730FC6,0x43544D54EA2E5B9A // A7,A6
+data8 0xEB7404450C47C5F4,0xC019 // A3
+data8 0xB30FB521D2C19F8B,0xC008 // A1
+data8 0xC768F34D35DF6320,0x46D348B3BB2E68B8 // A13,A12
+data8 0xC512AC2FE5EA638E,0x447DF44BC7FC5E17 // A9,A8
+data8 0xC2C15EA6B0AAFEF9,0x422EF5D308DBC420 // A5,A4
+data8 0xFBCEE5BCA70FD3A3,0x4010 // A2
+data8 0x8589A7CFFE0A3E86,0xBFD5 // A0
+//(-7;-6)
+data8 0xCB3995A0CC961E5A,0x4A7615C6C7116ADD // A15,A14
+data8 0xC82C5AFE0BF9C427,0x47695BD2F367668B // A11,A10
+data8 0xC52377E70BA14CF5,0x4462775E859E4392 // A7,A6
+data8 0x9EC8ED6E4C3D4DBE,0xC022 // A3
+data8 0x9D5FBD2E75520E65,0xC00B // A1
+data8 0xC9B21BB881A4DDF8,0x48EFEAB06FBA0207 // A13,A12
+data8 0xC6A6E8550CBC188F,0x45E4F3D26238B099 // A9,A8
+data8 0xC3A20427DF1B110A,0x42E24F3D636F2E4E // A5,A4
+data8 0xC1A4D12A82280CFB,0x4016 // A2
+data8 0xEF46D8DCCA9E8197,0x3FD2 // A0
+//(-8;-7)
+data8 0xCE0946982B27DE5B,0x4D15DBC6664E2DD2 // A15,A14
+data8 0xCA3C769F6B3B2B93,0x49497251CD0C4363 // A11,A10
+data8 0xC67384066C47F489,0x458281393433AB28 // A7,A6
+data8 0x9EF3459926D0F14F,0xC02B // A3
+data8 0x9D7BB7F2600DFF0B,0xC00E // A1
+data8 0xCC22351326C939A7,0x4B3009431C4F1D3F // A13,A12
+data8 0xC856FAADDD48815D,0x476502BC3ECA040C // A9,A8
+data8 0xC4920C2A84173810,0x43A255C052525F99 // A5,A4
+data8 0xC1C73B6554011EFA,0x401C // A2
+data8 0x954612700ADF8317,0xBFD8 // A0
+//(-9;-8)
+data8 0xD102F5CC7B590D3A,0x4FDD0F1C30E4EB22 // A15,A14
+data8 0xCC6A02912B0DF650,0x4B44AB18E4FCC159 // A11,A10
+data8 0xC7D64314B4A2FAAB,0x46B2C334AE5E2D34 // A7,A6
+data8 0xE2598724F7E28E99,0xC034 // A3
+data8 0xB12F6FE2E195452C,0xC011 // A1
+data8 0xCEB507747AF9356A,0x4D907802C08BA48F // A13,A12
+data8 0xCA2096E3DC29516F,0x48FAF6ED046A1DB7 // A9,A8
+data8 0xC59043D21BA5EE56,0x446D5FE468B30450 // A5,A4
+data8 0xF5460A8196B59C83,0x4022 // A2
+data8 0xB108F35A8EDA92D5,0xBFDD // A0
+//(-10;-9)
+data8 0xD420430D91F8265B,0x52C406CAAAC9E0EE // A15,A14
+data8 0xCEB2ECDDDAA3DAD1,0x4D580FDA97F92E3A // A11,A10
+data8 0xC94A8A192341B5D4,0x47F1E4D8C690D07B // A7,A6
+data8 0xDD0C5F920C2F0D2B,0xC03E // A3
+data8 0xDD7BED3631657B48,0xC014 // A1
+data8 0xD167F410E64E90A4,0x500DFFED20F714A7 // A13,A12
+data8 0xCBFEE6D9043169E9,0x4AA4174F64B40AA7 // A9,A8
+data8 0xC698D1A9AF0AB9C2,0x4541EDE14987A887 // A5,A4
+data8 0xBF9F43D461B3DE6E,0x4029 // A2
+data8 0xF3891A50642FAF26,0x3FE1 // A0
+//(-11;-10)
+data8 0xD75F0EEAF769D42A,0x55CBB72C8869183A // A15,A14
+data8 0xD113A4EF80394F77,0x4F822A0B96B3ECA9 // A11,A10
+data8 0xCACED38DC75763CB,0x493E3B5522D2D028 // A7,A6
+data8 0x8FA8FB5C92533701,0xC049 // A3
+data8 0x98453EDB9339C24E,0xC018 // A1
+data8 0xD43778026CCD4B20,0x52A5627753273B9B // A13,A12
+data8 0xCDF0F718DD7E1214,0x4C600B34582911EB // A9,A8
+data8 0xC7AE7EE7F112362C,0x46200599439C264F // A5,A4
+data8 0xB5249C335342B5BC,0x4030 // A2
+data8 0x881550711D143475,0x3FE4 // A0
+//(-12;-11)
+data8 0xDAB9C724EEEE2BBB,0x58EEC971340EDDBA // A15,A14
+data8 0xD38A8C8AE63BD8BF,0x51C05DB21CEE00D3 // A11,A10
+data8 0xCC607594C311C12D,0x4A9585BD5BE6AB57 // A7,A6
+data8 0xF26D282C36EC0E66,0xC053 // A3
+data8 0xE467DF1FA674BFAE,0xC01B // A1
+data8 0xD721DE506999AA9C,0x5555B34F71B45132 // A13,A12
+data8 0xCFF4619A476BF76F,0x4E29B2F2BBE7A67E // A9,A8
+data8 0xC8CCF27629D48EDC,0x47044715F991AB46 // A5,A4
+data8 0xCBC92FB9BDAA928D,0x4037 // A2
+data8 0xCE27C4F01CF53284,0xBFE6 // A0
+//(-13;-12)
+data8 0xDE3295B24355C5A1,0x5C2B447E298B562D // A15,A14
+data8 0xD615A35CB5E92103,0x54106AB089C95E8C // A11,A10
+data8 0xCDFEC7D935019005,0x4BF8C4C685F01B83 // A7,A6
+data8 0x820899603D9A74D5,0xC05F // A3
+data8 0xB9949916F8DF4AC4,0xC01F // A1
+data8 0xDA23373DBA0B7548,0x581CBA0AF7F45C01 // A13,A12
+data8 0xD20929836BB30934,0x500386409A7076D6 // A9,A8
+data8 0xC9F480173FEAF90B,0x47F1ACB14B810793 // A5,A4
+data8 0x86881B8674DBF205,0x403F // A2
+data8 0x8CFAFA9A142C1FF0,0x3FED // A0
+//(-14;-13)
+data8 0xE1C33F356FA2C630,0x5F8038B8AA919DD7 // A15,A14
+data8 0xD8B3F0167E14982D,0x5671496400BAE0DB // A11,A10
+data8 0xCFA82FA4F5D25C3E,0x4D663DB008328C58 // A7,A6
+data8 0xAE426731C9B94980,0xC06A // A3
+data8 0xA264C84BB8A66F86,0xC023 // A1
+data8 0xDD3B26E34762ED1E,0x5AF72F76E3C1B793 // A13,A12
+data8 0xD42E476507E3D06E,0x51EAD96CDD881DFA // A9,A8
+data8 0xCB25095F498DB15F,0x48E4B9FDEBFE24B5 // A5,A4
+data8 0xCE076A5A116C1D32,0x4046 // A2
+data8 0x94001BF5A24966F5,0x3FF1 // A0
+//(-15;-14)
+data8 0xE56DB8B72D7156FF,0x62EAB0CDB22539BE // A15,A14
+data8 0xDB63D76B0D3457E7,0x58E254823D0AE4FF // A11,A10
+data8 0xD15F060BF548404A,0x4EDE65C20CD4E961 // A7,A6
+data8 0x900DA565ED76C19D,0xC076 // A3
+data8 0x9868C809852DA712,0xC027 // A1
+data8 0xE067CCDA0408AAF0,0x5DE5A79C5C5C54AF // A13,A12
+data8 0xD6611ADBF5958ED0,0x53E0294092BE9677 // A9,A8
+data8 0xCC5EA28D90EE8C5D,0x49E014930EF336EE // A5,A4
+data8 0xB57930DCE7A61AE8,0x404E // A2
+data8 0x976BEC1F30DF151C,0x3FF5 // A0
+LOCAL_OBJECT_END(lgamma_data)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_lgamma)
+
+{ .mfi
+      getf.exp      GR_SignExp = f8
+      frcpa.s1      FR_C,p9 = f1,f8
+      mov           GR_ExpMask = 0x1ffff
+}
+{ .mfi
+      addl          GR_ad_Data = @ltoff(lgamma_data),gp
+      fcvt.fx.s1    FR_int_N = f8
+      mov           GR_2_25 = 0x4002 // 2.25
+};;
+{ .mfi
+      getf.d        GR_ArgAsIs = f8
+      fclass.m      p13,p0 = f8,0x1EF // is x NaTVal, NaN,
+                                      // +/-0, +/-INF or +/-deno?
+      mov           GR_ExpBias = 0xFFFF
+}
+{ .mfi
+      ld8           GR_ad_Data = [GR_ad_Data]
+      fcvt.fx.trunc.s1 FR_int_Ntrunc = f8
+      mov           GR_ExpOf256 = 0x10007
+};;
+{ .mfi
+      mov           GR_ExpOf2 = 0x10000
+      fcmp.lt.s1    p14,p15 = f8,f0 // p14 if x<0
+      dep.z         GR_Ind = GR_SignExp,8,4
+}
+{ .mfi
+      and           GR_Exp = GR_SignExp,GR_ExpMask
+      fma.s1        FR_2 = f1,f1,f1
+      cmp.lt        p10,p0 = GR_SignExp,GR_ExpBias
+};;
+{ .mfi
+      add           GR_ad_1 = 0xB80,GR_ad_Data
+      fnorm.s1      FR_NormX = f8
+      shr.u         GR_Arg = GR_ArgAsIs,48
+}
+{ .mib
+      add           GR_ad_Co = GR_Ind,GR_ad_Data
+      add           GR_ad_Ce = 0x10,GR_ad_Data
+      // jump if the input argument is NaTVal, NaN, +/-0, +/-INF or +/-deno
+(p13) br.cond.spnt  lgamma_spec
+};;
+lgamma_common:
+{ .mfi
+      ldfpd         FR_LocalMin,FR_05 = [GR_ad_1],16
+      fmerge.se     FR_x = f1,f8
+      add           GR_ad_2 = 0xBC0,GR_ad_Data
+}
+{ .mfb
+      add           GR_ad_Ce = GR_Ind,GR_ad_Ce
+      fms.s1        FR_w = f8,f1,f1 // x-1
+      // jump if the input argument is positive and  less than 1.0
+(p10) br.cond.spnt  lgamma_0_1
+};;
+{ .mfi
+      ldfe          FR_C01 = [GR_ad_Co],32
+      fnma.s1       FR_InvX = FR_C,f8,f1 // NR iteration #1
+(p15) cmp.lt.unc    p8,p0 = GR_ExpOf256,GR_SignExp
+}
+{ .mib
+      ldfe          FR_C11 = [GR_ad_Ce],32
+(p15) cmp.lt.unc    p11,p0 = GR_Arg,GR_2_25
+      // jump if the input argument isn't less than 512.0
+(p8)  br.cond.spnt  lgamma_pstirling
+};;
+{ .mfi
+      ldfe          FR_C21 = [GR_ad_Co],32
+(p14) fms.s1        FR_r = FR_C,f8,f1 // reduced arg for log(x)
+(p14) cmp.lt.unc    p0,p9 = GR_Exp,GR_ExpOf256
+}
+{ .mib
+      ldfe          FR_C31 = [GR_ad_Ce],32
+      add           GR_ad_Co7 = 0x12C0,GR_ad_2
+      // jump if the input argument is from range [1.0; 2.25)
+(p11) br.cond.spnt  lgamma_1_2
+};;
+{ .mfi
+      ldfe          FR_C41 = [GR_ad_Co],32
+      fcvt.xf       FR_N = FR_int_N
+      add           GR_ad_Ce7 = 0x1310,GR_ad_2
+}
+{ .mfb
+      ldfe          FR_C51 = [GR_ad_Ce],32
+(p14) fma.s1        FR_5 = FR_2,FR_2,f1
+      // jump if the input argument is less or equal to -512.0
+(p9)  br.cond.spnt  lgamma_negstirling
+};;
+{ .mfi
+      ldfe          FR_C61 = [GR_ad_Co],32
+(p14) fcvt.xf       FR_Ntrunc = FR_int_Ntrunc
+      shr           GR_Ind = GR_Ind,4
+}
+{ .mfi
+      ldfe          FR_C71 = [GR_ad_Ce],32
+(p14) fma.s1        FR_Xp1 = f1,f1,FR_NormX // x+1
+      cmp.eq        p6,p7 = GR_ExpOf2,GR_SignExp
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      ldfe          FR_C81 = [GR_ad_Co],32
+(p6)  fma.s1        FR_x = f0,f0,FR_NormX
+      shladd        GR_Offs7 = GR_Ind,2,GR_Ind // (ind*16)*5
+}
+{ .mfi
+      ldfe          FR_C91 = [GR_ad_Ce],32
+(p7)  fms.s1        FR_x = FR_x,f1,f1
+      add           GR_ad_Co7 = 0x800,GR_ad_Data
+};;
+{ .mfi
+      ldfe          FR_CA1 = [GR_ad_Co],32
+(p14) fma.s1        FR_3 = f1,f1,FR_2
+      shladd        GR_Offs7 = GR_Ind,1,GR_Offs7 // (ind*16)*7
+}
+{ .mfi
+      ldfe          FR_C00 = [GR_ad_Ce],32
+(p14) fma.s1        FR_Xp4 = FR_2,FR_2,FR_NormX
+      add           GR_ad_Ce7 = 0x810,GR_ad_Data
+};;
+{ .mfi
+      ldfe          FR_C10 = [GR_ad_Co],32
+(p6)  fms.s1        FR_Xm2 = FR_w,f1,f1
+      add           GR_ad_Co7 = GR_ad_Co7,GR_Offs7
+}
+{ .mfi
+      ldfe          FR_C20 = [GR_ad_Ce],32
+(p14) fma.s1        FR_r2 = FR_r,FR_r,f0 // log(x)
+      add           GR_ad_Ce7 = GR_ad_Ce7,GR_Offs7
+};;
+{ .mfi
+      ldfe          FR_C30 = [GR_ad_Co],32
+(p14) fms.s1        FR_Xf = FR_NormX,f1,FR_N  // xf = x - [x]
+(p14) mov           GR_Arg17 = 0xC031 // -17
+}
+{ .mfi
+      ldfe          FR_C40 = [GR_ad_Ce],32
+(p14) fma.s1        FR_Xp5 = FR_5,f1,FR_NormX
+(p14) sub           GR_Exp = GR_Exp,GR_ExpBias
+};;
+{ .mfi
+      ldfe          FR_C50 = [GR_ad_Co7],32
+(p14) fms.s1        FR_Xfr = FR_Xp1,f1,FR_Ntrunc // xfr = (x+1) - [x]
+(p14) cmp.lt.unc    p13,p0 = GR_Arg,GR_Arg17
+}
+{ .mfb
+      ldfe          FR_C60 = [GR_ad_Ce7],32
+(p14) fma.s1        FR_Xp10 = FR_5,FR_2,FR_NormX
+      // jump if the input argument is negative and great than -17.0
+(p13) br.cond.spnt  lgamma_negrecursion
+};;
+{ .mfi
+      ldfe          FR_C70 = [GR_ad_Co7],32
+      fma.s1        FR_C01 = FR_x,f1,FR_C01
+(p14) add           GR_ad_Ce = 0x1310,GR_ad_2
+}
+{ .mfi
+      ldfe          FR_C80 = [GR_ad_Ce7],32
+      fma.s1        FR_C11 = FR_x,f1,FR_C11
+(p14) add           GR_ad_Co = 0x12C0,GR_ad_2
+};;
+{ .mfi
+      ldfe          FR_C90 = [GR_ad_Co7],32
+      fma.s1        FR_C21 = FR_x,f1,FR_C21
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_CA0 = [GR_ad_Ce7],32
+      fma.s1        FR_C31 = FR_x,f1,FR_C31
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_CN = [GR_ad_Co7],32
+      fma.s1        FR_C41 = FR_x,f1,FR_C41
+      nop.i         0
+}
+{ .mfi
+(p14) ldfpd         FR_P5,FR_P4 = [GR_ad_1],16
+      fma.s1        FR_C51 = FR_x,f1,FR_C51
+      nop.i         0
+};;
+{ .mfi
+(p14) ldfpd         FR_P3,FR_P2 = [GR_ad_2],16
+      fma.s1        FR_C61 = FR_x,f1,FR_C61
+      nop.i         0
+}
+{ .mfi
+(p14) ldfe          FR_Ln2 = [GR_ad_1]
+      fma.s1        FR_C71 = FR_x,f1,FR_C71
+      nop.i         0
+};;
+{ .mfi
+(p14) ldfpd         FR_S28,FR_S26 = [GR_ad_Co],16
+      fma.s1        FR_C81 = FR_x,f1,FR_C81
+      add           GR_ad_2 = 0x60,GR_ad_2
+}
+{ .mfi
+(p14) ldfpd         FR_S24,FR_S22 = [GR_ad_Ce],16
+      fma.s1        FR_C91 = FR_x,f1,FR_C91
+      nop.i         0
+};;
+{ .mfi
+(p14) ldfpd         FR_S20,FR_S18 = [GR_ad_Co],16
+      fma.s1        FR_CA1 = FR_x,f1,FR_CA1
+      nop.i         0
+}
+{ .mfi
+(p14) ldfpd         FR_S16,FR_S14 = [GR_ad_Ce],16
+      fma.s1        FR_C01 = FR_C01,FR_x,FR_C00
+      nop.i         0
+};;
+{ .mfi
+(p14) getf.exp      GR_SignExp = FR_Xf
+      fma.s1        FR_C11 = FR_C11,FR_x,FR_C10
+      nop.i         0
+}
+{ .mfi
+(p14) ldfe          FR_S12 = [GR_ad_Co],16
+      fma.s1        FR_C21 = FR_C21,FR_x,FR_C20
+      nop.i         0
+};;
+{ .mfi
+(p14) getf.sig      GR_Sig = FR_Xf
+(p14) frcpa.s1      FR_InvXf,p0 = f1,FR_Xf
+      nop.i         0
+}
+{ .mfi
+(p14) ldfe          FR_S10 = [GR_ad_Ce],16
+      fma.s1        FR_C41 = FR_C41,FR_x,FR_C40
+      nop.i         0
+};;
+{ .mfi
+(p14) ldfe          FR_S8 = [GR_ad_Co],16
+      fma.s1        FR_C51 = FR_C51,FR_x,FR_C50
+      nop.i         0
+}
+{ .mfi
+(p14) ldfe          FR_S6 = [GR_ad_Ce],16
+      fma.s1        FR_C61 = FR_C61,FR_x,FR_C60
+(p14) and           GR_Expf = GR_SignExp,GR_ExpMask
+};;
+{ .mfi
+(p14) sub           GR_Expf = GR_Expf,GR_ExpBias
+      fma.s1        FR_C71 = FR_C71,FR_x,FR_C70
+(p14) shl           GR_Ind = GR_Sig,1
+}
+{ .mfi
+(p14) ldfe          FR_S4 = [GR_ad_Co],16
+      fma.s1        FR_C81 = FR_C81,FR_x,FR_C80
+(p14) cmp.eq.unc    p8,p0 = 0,GR_Sig
+};;
+{ .mfi
+(p14) setf.sig      FR_int_Nf = GR_Expf
+      fma.s1        FR_C91 = FR_C91,FR_x,FR_C90
+(p14) shr.u         GR_Ind = GR_Ind,56
+}
+{ .mfb
+(p14) ldfe          FR_S2 = [GR_ad_Ce],16
+      fma.s1        FR_CA1 = FR_CA1,FR_x,FR_CA0
+      // jump if the input argument is integer number from range (-512.0;-17.0]
+(p8)  br.cond.spnt  lgamma_singularity
+};;
+{ .mfi
+(p14) getf.sig      GR_Sig = FR_int_Ntrunc
+      fma.s1        FR_C01 = FR_C01,FR_C11,f0
+      nop.i         0
+}
+{ .mfi
+(p14) shladd        GR_ad_T = GR_Ind,4,GR_ad_2
+      fma.s1        FR_C31 = FR_C31,FR_x,FR_C30
+      nop.i         0
+};;
+{ .mfi
+(p14) ldfe          FR_Tf = [GR_ad_T]
+(p14) fms.s1        FR_rf = FR_InvXf,FR_Xf,f1 // reduced arg for log({x})
+(p14) extr.u        GR_Ind = GR_ArgAsIs,44,8
+}
+{ .mfi
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+      fma.s1        FR_C21 = FR_C21,FR_C41,f0
+      mov           GR_SignOfGamma = 1
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C51 = FR_C51,FR_C61,f0
+(p14) tbit.z.unc    p8,p0 = GR_Sig,0
+}
+{ .mfi
+(p14) shladd        GR_ad_T = GR_Ind,4,GR_ad_2
+(p6)  fma.s1        FR_CN = FR_CN,FR_Xm2,f0
+      nop.i         0
+};;
+{ .mfi
+(p14) setf.sig      FR_int_N = GR_Exp
+      fma.s1        FR_C71 = FR_C71,FR_C81,f0
+(p8)  sub           GR_SignOfGamma = r0,GR_SignOfGamma
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_Xf2 = FR_Xf,FR_Xf,f0
+      nop.i         0
+};;
+{ .mfi
+(p14) ldfe          FR_T = [GR_ad_T]
+      fma.s1        FR_C91 = FR_C91,FR_CA1,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_r2 = FR_r,FR_r,f0
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [r33] = GR_SignOfGamma
+      fma.s1        FR_C01 = FR_C01,FR_C31,f0
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [r33] = GR_SignOfGamma
+(p14) fma.s1        FR_P54 = FR_P5,FR_r,FR_P4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p14) fma.s1        FR_P54f = FR_P5,FR_rf,FR_P4
+      // jump if the input argument is non-integer from range (-512.0;-17.0]
+(p14) br.cond.spnt  lgamma_negpoly
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C21 = FR_C21,FR_C51,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C71 = FR_C71,FR_C91,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_CN  = FR_C01,FR_CN,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C21 = FR_C21,FR_C71,f0
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fma.d.s0      f8 = FR_C21,FR_CN,f0
+      br.ret.sptk   b0 // exit for arguments from range [2.25; 512.0)
+};;
+// branch for calculating of ln(GAMMA(x)) for -512 < x < -17
+//---------------------------------------------------------------------
+.align 32
+lgamma_negpoly:
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Xf4 = FR_Xf2,FR_Xf2,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf2,FR_S26
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S24 = FR_S24,FR_Xf2,FR_S22
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S20 = FR_S20,FR_Xf2,FR_S18
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S16 = FR_S16,FR_Xf2,FR_S14
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S12 = FR_S12,FR_Xf2,FR_S10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S8 = FR_S8,FR_Xf2,FR_S6
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S4 = FR_S4,FR_Xf2,FR_S2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rf2 = FR_rf,FR_rf,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32f = FR_P3,FR_rf,FR_P2 // log(x)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_r3 = FR_r2,FR_r,f0 // log(x)
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_Nf = FR_int_Nf // log({x})
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf4,FR_S24
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Xf8 = FR_Xf4,FR_Xf4,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S20 = FR_S20,FR_Xf4,FR_S16
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C21 = FR_C21,FR_C51,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S12 = FR_S12,FR_Xf4,FR_S8
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C71 = FR_C71,FR_C91,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_P10 = FR_r2,FR_05,FR_r // log(x)
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54 = FR_P54,FR_r2,FR_P32 // log(x)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_P10f = FR_rf2,FR_05,FR_rf // log({x})
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_N = FR_int_N // log(x)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rf3 = FR_rf2,FR_rf,f0 // log({x})
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54f = FR_P54f,FR_rf2,FR_P32f // log({x})
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf8,FR_S20
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_TpNxLn2f = FR_Nf,FR_Ln2,FR_Tf // log({x})
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_CN  = FR_C01,FR_CN,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C21 = FR_C21,FR_C71,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54 = FR_P54,FR_r3,FR_P10 // log(x)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_TpNxLn2 = FR_N,FR_Ln2,FR_T // log(x)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54f = FR_P54f,FR_rf3,FR_P10f // log({x})
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf8,FR_S12
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_C21 = FR_C21,FR_CN,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnX = FR_TpNxLn2,f1,FR_P54 // log(x)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnXf = FR_TpNxLn2f,f1,FR_P54f // log({x})
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf4,FR_S4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnX = FR_LnX,f1,FR_LnXf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_S28 = FR_S28,FR_Xf2,FR_C21
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fms.d.s0      f8 = FR_S28,f1,FR_LnX
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) for x >= 512
+//---------------------------------------------------------------------
+.align 32
+lgamma_pstirling:
+{ .mfi
+      ldfpd         FR_P5,FR_P4 = [GR_ad_1],16
+      nop.f         0
+      and           GR_Exp = GR_SignExp,GR_ExpMask
+}
+{ .mfi
+      ldfpd         FR_P3,FR_P2 = [GR_ad_2],16
+      fma.s1        FR_InvX = FR_C,FR_InvX,FR_C // NR iteration #1
+      mov           GR_ExpBias = 0xffff
+};;
+{ .mfi
+      ldfe          FR_Ln2 = [GR_ad_1],16
+      nop.f         0
+      sub           GR_Exp = GR_Exp,GR_ExpBias
+};;
+{ .mfi
+      ldfpd         FR_W4,FR_OvfBound = [GR_ad_2],16
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      setf.sig      FR_int_N = GR_Exp
+      fms.s1        FR_r = FR_C,f8,f1
+      nop.i         0
+};;
+{ .mmf
+      getf.sig      GR_Sig = FR_NormX
+      ldfe          FR_LnSqrt2Pi = [GR_ad_1],16
+      nop.f         0
+};;
+{ .mmf
+      ldfe          FR_W2 = [GR_ad_2],16
+      nop.m         0
+      fnma.s1       FR_InvX2 = FR_InvX,FR_NormX,f1 // NR iteration #2
+};;
+{ .mfi
+      add           GR_ad_2 = 0x40,GR_ad_2
+      nop.f         0
+      shl           GR_Ind = GR_Sig,1
+};;
+{ .mfi
+      mov           GR_SignOfGamma = 1
+      nop.f         0
+      shr.u         GR_Ind = GR_Ind,56
+};;
+{ .mfi
+      shladd        GR_ad_2 = GR_Ind,4,GR_ad_2
+      fma.s1        FR_r2 = FR_r,FR_r,f0
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+};;
+{ .mfi
+      ldfe          FR_T = [GR_ad_2]
+      fma.s1        FR_P54 = FR_P5,FR_r,FR_P4
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fcmp.le.s1    p6,p0 = FR_OvfBound,FR_NormX
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_InvX2 = FR_InvX,FR_InvX2,FR_InvX // NR iteration #2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_N = FR_int_N
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+      nop.f         0
+      // jump if x is great than OVERFLOW_BOUNDARY
+(p6)  br.cond.spnt  lgamma_overflow
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [r33] = GR_SignOfGamma
+      fma.s1        FR_r3 = FR_r2,FR_r,f0
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [r33] = GR_SignOfGamma
+      fnma.s1       FR_P10 = FR_r2,FR_05,FR_r
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54 = FR_P54,FR_r2,FR_P32
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_InvX = FR_InvX2,FR_NormX,f1 // NR iteration #3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_Xm05 = FR_NormX,f1,FR_05 // (x-1/2)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_TpNxLn2 = FR_N,FR_Ln2,FR_T
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54 = FR_P54,FR_r3,FR_P10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_InvX = FR_InvX2,FR_InvX,FR_InvX2 // NR iteration #3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fms.s1        FR_LnSqrt2Pi = FR_LnSqrt2Pi,f1,FR_NormX // ln(sqrt(2*Pi))-x
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnX = FR_TpNxLn2,f1,FR_P54
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_InvX2 = FR_InvX,FR_InvX,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // (x-1/2)*ln(x)+ln(sqrt(2*Pi))-x
+      fma.s1        FR_LnX = FR_LnX,FR_Xm05,FR_LnSqrt2Pi
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_W2 = FR_W4,FR_InvX2,FR_W2 // W2 + W4/x^2
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fma.d.s0      f8 = FR_InvX,FR_W2,FR_LnX
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) for x < -512
+//---------------------------------------------------------------------
+.align 32
+lgamma_negstirling:
+{ .mfi
+      ldfpd         FR_P5,FR_P4 = [GR_ad_1],16
+      fms.s1        FR_Xf = FR_NormX,f1,FR_N  // xf = x - [x]
+      and           GR_Exp = GR_SignExp,GR_ExpMask
+}
+{ .mfi
+      ldfpd         FR_P3,FR_P2 = [GR_ad_2],16
+      fma.s1        FR_InvX = FR_C,FR_InvX,FR_C // NR iteration #1
+      mov           GR_0x30033 = 0x30033
+};;
+{ .mfi
+      ldfe          FR_Ln2 = [GR_ad_1],16
+      nop.f         0
+      extr.u        GR_Ind = GR_ArgAsIs,44,8
+}
+{ .mib
+      ldfd          FR_W4 = [GR_ad_2],16
+      // jump if x is less or equal to -2^52, i.e. x is big negative integer
+      cmp.leu.unc   p7,p0 = GR_0x30033,GR_SignExp
+(p7)  br.cond.spnt  lgamma_singularity
+};;
+{ .mfi
+      ldfpd         FR_S28,FR_S26 = [GR_ad_Co7],16
+      nop.f         0
+      add           GR_ad_LnT = 0x50,GR_ad_2
+}
+{ .mfi
+      ldfpd         FR_S24,FR_S22 = [GR_ad_Ce7],16
+      nop.f         0
+      mov           GR_ExpBias = 0xffff
+};;
+{ .mfi
+      ldfpd         FR_S20,FR_S18 = [GR_ad_Co7],16
+      nop.f         0
+      shladd        GR_ad_T = GR_Ind,4,GR_ad_LnT
+}
+{ .mfi
+      ldfpd         FR_S16,FR_S14 = [GR_ad_Ce7],16
+      nop.f         0
+      sub           GR_Exp = GR_Exp,GR_ExpBias
+};;
+{ .mfi
+      ldfe          FR_S12 = [GR_ad_Co7],16
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_S10 = [GR_ad_Ce7],16
+      fms.s1        FR_r = FR_C,f8,f1
+      nop.i         0
+};;
+{ .mmf
+      ldfe          FR_S8 = [GR_ad_Co7],16
+      ldfe          FR_S6 = [GR_ad_Ce7],16
+      nop.f         0
+};;
+{ .mfi
+      ldfe          FR_S4 = [GR_ad_Co7],16
+      fma.s1        FR_Xf2 = FR_Xf,FR_Xf,f0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_S2 = [GR_ad_Ce7],16
+      fnma.s1       FR_InvX2 = FR_InvX,FR_NormX,f1 // NR iteration #2
+      nop.i         0
+};;
+{ .mfi
+      setf.sig      FR_int_N = GR_Exp
+      frcpa.s1      FR_InvXf,p9 = f1,FR_Xf // 1/xf
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_LnSqrt2Pi = [GR_ad_1],16
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      getf.exp      GR_SignExp = FR_Xf
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_W2 = [GR_ad_2],16
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      getf.sig      GR_Sig = FR_Xf
+      fma.s1        FR_P54 = FR_P5,FR_r,FR_P4
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_T = [GR_ad_T]
+      fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+};;
+{ .mfi
+      and           GR_Exp = GR_SignExp,GR_ExpMask
+      fma.s1        FR_r2 = FR_r,FR_r,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fms.s1        FR_Xm05 = FR_NormX,f1,FR_05 // (x-1/2)
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_InvX2 = FR_InvX,FR_InvX2,FR_InvX // NR iteration #2
+      extr.u        GR_Ind = GR_Sig,55,8
+}
+{ .mfi
+      sub           GR_Exp = GR_Exp,GR_ExpBias
+      fma.s1        FR_Xf4 = FR_Xf2,FR_Xf2,f0
+      cmp.eq        p6,p0 = 0,GR_Sig
+};;
+{ .mfi
+      setf.sig      FR_int_Nf = GR_Exp
+      fma.s1        FR_S28 = FR_S28,FR_Xf2,FR_S26
+      shladd        GR_ad_T = GR_Ind,4,GR_ad_LnT
+}
+{ .mfb
+      nop.m         0
+      fma.s1        FR_S24 = FR_S24,FR_Xf2,FR_S22
+      // jump if the input argument is integer number from range (-512.0;-17.0]
+(p6)  br.cond.spnt  lgamma_singularity
+};;
+{ .mfi
+      getf.sig      GR_Sig = FR_int_Ntrunc
+      fma.s1        FR_S20 = FR_S20,FR_Xf2,FR_S18
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S16 = FR_S16,FR_Xf2,FR_S14
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_Tf = [GR_ad_T]
+      fma.s1        FR_S12 = FR_S12,FR_Xf2,FR_S10
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S8 = FR_S8,FR_Xf2,FR_S6
+      mov           GR_SignOfGamma = 1
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_rf = FR_InvXf,FR_Xf,f1 // reduced arg rf
+      tbit.z        p8,p0 = GR_Sig,0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_r3 = FR_r2,FR_r,f0
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+};;
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_N = FR_int_N
+(p8)  sub           GR_SignOfGamma = r0,GR_SignOfGamma
+}
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_InvX = FR_InvX2,FR_NormX,f1 // NR iteration #3
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [r33] = GR_SignOfGamma
+      fma.s1        FR_P54 = FR_P54,FR_r2,FR_P32
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [r33] = GR_SignOfGamma
+      fnma.s1       FR_P10 = FR_r2,FR_05,FR_r
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Xf8 = FR_Xf4,FR_Xf4,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf4,FR_S24
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S20 = FR_S20,FR_Xf4,FR_S16
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S12 = FR_S12,FR_Xf4,FR_S8
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rf2 = FR_rf,FR_rf,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54f = FR_P5,FR_rf,FR_P4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32f = FR_P3,FR_rf,FR_P2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_InvX = FR_InvX2,FR_InvX,FR_InvX2 // NR iteration #3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_Nf = FR_int_Nf
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnSqrt2Pi = FR_NormX,f1,FR_LnSqrt2Pi // x+ln(sqrt(2*Pi))
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54 = FR_P54,FR_r3,FR_P10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf8,FR_S20
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rf3 = FR_rf2,FR_rf,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_P10f = FR_rf2,FR_05,FR_rf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_TpNxLn2 = FR_N,FR_Ln2,FR_T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54f = FR_P54f,FR_rf2,FR_P32f
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_InvX2 = FR_InvX,FR_InvX,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf8,FR_S12
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S4 = FR_S4,FR_Xf2,FR_S2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P54f = FR_P54f,FR_rf3,FR_P10f
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_TpNxLn2f = FR_Nf,FR_Ln2,FR_Tf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnX = FR_TpNxLn2,f1,FR_P54
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_W2 = FR_W4,FR_InvX2,FR_W2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S28 = FR_S28,FR_Xf4,FR_S4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnXf = FR_TpNxLn2f,f1,FR_P54f
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_LnX = FR_LnX,FR_Xm05,FR_LnSqrt2Pi
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnX = FR_InvX,FR_W2,FR_LnX
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_LnX = FR_S28,FR_Xf2,FR_LnX
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fms.d.s0      f8 = FR_LnX,f1,FR_LnXf
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) for 0 <= x < 1
+//---------------------------------------------------------------------
+.align 32
+lgamma_0_1:
+{ .mfi
+      ldfpd         FR_P5,FR_P4 = [GR_ad_1],16
+      fms.s1        FR_x = FR_NormX,f1,f0 // x
+      mov           GR_Arg025 = 0x3FD0
+}
+{ .mfi
+      ldfpd         FR_P3,FR_P2 = [GR_ad_2],16
+      nop.f         0
+      add           GR_ad_Co = 0x1C40,GR_ad_Data
+};;
+{ .mfi
+      ldfe          FR_Ln2 = [GR_ad_1],0x50
+      nop.f         0
+      // p6 if arg < 0.25
+      cmp.lt        p6,p9 = GR_Arg,GR_Arg025
+}
+{ .mfi
+      add           GR_ad_2 = 0x40,GR_ad_2
+      nop.f         0
+      mov           GR_Arg075 = 0x3FE8
+};;
+{ .mfi
+      ldfpd         FR_Q8,FR_Q7 = [GR_ad_1],16
+      fma.s1        FR_w2 = FR_w,FR_w,f0
+      // p7 if 0.25 <= arg < 0.75
+      // p8 if 0.75 <= arg < 1.0
+(p9)  cmp.lt.unc    p7,p8 = GR_Arg,GR_Arg075
+}
+{ .mfi
+      mov           GR_Arg0875 = 0x3FEC
+      nop.f         0
+      sub           GR_Exp = GR_Exp,GR_ExpBias
+};;
+{ .mfi
+      ldfpd         FR_Q6,FR_Q5 = [GR_ad_2],16
+      nop.f         0
+(p8)  cmp.lt        p9,p0 = GR_Arg,GR_Arg0875
+}
+{ .mfi
+      ldfpd         FR_Q4,FR_Q3 = [GR_ad_1],16
+      nop.f         0
+      add           GR_ad_Ce = 0x60,GR_ad_Co
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+      ldfd          FR_Q2 = [GR_ad_2],16
+      fms.s1        FR_r = FR_C,f8,f1
+(p7)  mov           GR_Offs = 0xC0
+}
+{ .mfi
+      setf.sig      FR_int_N = GR_Exp
+      nop.f         0
+(p8)  mov           GR_Offs = 0x180
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+(p9)  add           GR_ad_Co = GR_Offs,GR_ad_Co
+(p8)  fms.s1        FR_x = FR_NormX,f1,f1 // x-1
+      nop.i         0
+}
+{ .mfi
+(p9)  add           GR_ad_Ce = GR_Offs,GR_ad_Ce
+(p7)  fms.s1        FR_x = FR_NormX,f1,FR_LocalMin // x-LocalMin
+      cmp.lt        p10,p0 = GR_Arg,GR_Arg0875
+};;
+lgamma_common_0_2:
+{ .mfi
+      ldfpd         FR_A17,FR_A16 = [GR_ad_Co],16
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfpd         FR_A15,FR_A14 = [GR_ad_Ce],16
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      ldfpd         FR_A13,FR_A12 = [GR_ad_Co],16
+      nop.f         0
+(p10) extr.u        GR_Ind = GR_ArgAsIs,44,8
+}
+{ .mfi
+      ldfpd         FR_A11,FR_A10 = [GR_ad_Ce],16
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      ldfpd         FR_A9,FR_A8 = [GR_ad_Co],16
+(p10) fnma.s1       FR_Q1 = FR_05,FR_w2,FR_w
+      nop.i         0
+}
+{ .mfi
+      ldfpd         FR_A7,FR_A6 = [GR_ad_Ce],16
+(p10) fma.s1        FR_w3 = FR_w2,FR_w,f0
+      nop.i         0
+};;
+{ .mfi
+(p10) getf.exp      GR_SignExp_w = FR_w
+(p10) fma.s1        FR_w4 = FR_w2,FR_w2,f0
+      nop.i         0
+}
+{ .mfi
+(p10) shladd        GR_ad_2 = GR_Ind,4,GR_ad_2
+(p10) fma.s1        FR_r2 = FR_r,FR_r,f0
+      nop.i         0
+};;
+{ .mfi
+(p10) ldfe          FR_T = [GR_ad_2]
+(p10) fma.s1        FR_P54 = FR_P5,FR_r,FR_P4
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A5 = [GR_ad_Co],16
+(p10) fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_A4 = [GR_ad_Ce],16
+      fma.s1        FR_x2 = FR_x,FR_x,f0
+(p10) and           GR_Exp_w = GR_ExpMask, GR_SignExp_w
+}
+{ .mfi
+      ldfe          FR_A3 = [GR_ad_Co],16
+      nop.f         0
+(p10) mov           GR_fff9 = 0xfff9
+};;
+//    p13 <== large w __libm_lgamma
+//    p14 <== small w __libm_lgamma
+{ .mfi
+      ldfe          FR_A2 = [GR_ad_Ce],16
+(p10) fma.s1        FR_Q8 = FR_Q8,FR_w,FR_Q7
+(p10) cmp.ge.unc    p13,p14 = GR_Exp_w,GR_fff9
+}
+{ .mfi
+      ldfe          FR_A1 = [GR_ad_Co],16
+(p10) fma.s1        FR_Q6 = FR_Q6,FR_w,FR_Q5
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_A0 = [GR_ad_Ce],16
+(p10) fma.s1        FR_Q4 = FR_Q4,FR_w,FR_Q3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_Q2 = FR_Q2,FR_w3,FR_Q1
+      nop.i         0
+};;
+{ .mfi
+      // set p11 if signgum is 32-bit int
+      // set p12 if signgum is 64-bit int
+      cmp.eq        p12,p11 = 8,r34
+(p10) fma.s1        FR_r3 = FR_r2,FR_r,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fnma.s1       FR_P10 = FR_r2,FR_05,FR_r
+      mov           GR_SignOfGamma = 1
+};;
+.pred.rel "mutex",p11,p12
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p11) st4           [r33] = GR_SignOfGamma
+      fma.s1        FR_A17 = FR_A17,FR_x,FR_A16
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p12) st8           [r33] = GR_SignOfGamma
+      fma.s1        FR_A15 = FR_A15,FR_x,FR_A14
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p10) fcvt.xf       FR_N = FR_int_N
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_P54 = FR_P54,FR_r2,FR_P32
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A13 = FR_A13,FR_x,FR_A12
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A11 = FR_A11,FR_x,FR_A10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A9 = FR_A9,FR_x,FR_A8
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_x,FR_A6
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_Qlo = FR_Q8,FR_w2,FR_Q6
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_w6 = FR_w3,FR_w3,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_Qhi = FR_Q4,FR_w4,FR_Q2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A5 = FR_A5,FR_x,FR_A4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_TpNxLn2 = FR_N,FR_Ln2,FR_T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_x,FR_A2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_P54 = FR_P54,FR_r3,FR_P10
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A1 = FR_A1,FR_x,FR_A0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A17 = FR_A17,FR_x2,FR_A15
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A13 = FR_A13,FR_x2,FR_A11
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A9 = FR_A9,FR_x2,FR_A7
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x4 = FR_x2,FR_x2,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_LnX = FR_Qlo,FR_w6,FR_Qhi
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A5 = FR_A5,FR_x2,FR_A3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_LnX = FR_TpNxLn2,f1,FR_P54
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A17 = FR_A17,FR_x4,FR_A13
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x8 = FR_x4,FR_x4,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A9 = FR_A9,FR_x4,FR_A5
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A17 = FR_A17,FR_x8,FR_A9
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p10) fms.s1        FR_A1 = FR_A1,f1,FR_LnX
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fma.d.s0      f8 = FR_A17,FR_x2,FR_A1
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) for 1.0 <= x < 2.25
+//---------------------------------------------------------------------
+.align 32
+lgamma_1_2:
+{ .mfi
+      add           GR_ad_Co = 0x10B0,GR_ad_1
+      fcmp.eq.s1    p12,p0 = f1,FR_w
+      mov           GR_Arg125 = 0x3FF4
+}
+{ .mfi
+      add           GR_ad_Ce = 0x1110,GR_ad_1
+      nop.f         0
+      mov           GR_Arg175 = 0x3FFC
+};;
+{ .mfi
+      mov           GR_SignOfGamma = 1
+      fcmp.eq.s1    p13,p0 = f1,FR_NormX
+      cmp.lt        p6,p9 = GR_Arg,GR_Arg125 // 1.0 <= x < 1.25
+}
+{ .mfi
+      // set p10 if signgum is 32-bit int
+      // set p11 if signgum is 64-bit int
+      cmp.eq        p11,p10 = 8,r34
+      nop.f         0
+      cmp.ge        p8,p0 = GR_Arg,GR_Arg175 // x >= 1.75
+};;
+.pred.rel "mutex",p10,p11
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p10) st4           [r33] = GR_SignOfGamma
+(p12) fma.d.s0      f8 = f0,f0,f0
+(p9)  cmp.lt.unc    p7,p0 = GR_Arg,GR_Arg175 // 1.25 <= x < 1.75
+}
+{ .mib
+      // store sign of gamma(x) as 64-bit int
+(p11) st8           [r33] = GR_SignOfGamma
+      mov           GR_Offs = 0
+(p12) br.ret.spnt   b0 // fast exit for 2.0
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+(p7)  mov           GR_Offs = 0xC0
+(p7)  fms.s1        FR_x = FR_w,f1,FR_LocalMin
+      nop.i         0
+}
+{ .mfb
+(p8)  mov           GR_Offs = 0x180
+(p13) fma.d.s0      f8 = f0,f0,f0
+(p13) br.ret.spnt   b0 // fast exit for 1.0
+};;
+.pred.rel "mutex",p6,p8
+{ .mfi
+      add           GR_ad_Co = GR_ad_Co,GR_Offs
+(p8)  fms.s1        FR_x = FR_w,f1,f1
+      cmp.eq        p0,p10 = r0,r0
+}
+{ .mfb
+      add           GR_ad_Ce = GR_ad_Ce,GR_Offs
+(p6)  fma.s1        FR_x = f0,f0,FR_w
+      br.cond.sptk  lgamma_common_0_2
+};;
+// branch for calculating of ln(GAMMA(x)) for -17 < x < 0
+//---------------------------------------------------------------------
+.align 32
+lgamma_negrecursion:
+{ .mfi
+      getf.d        GR_ArgXfrAsIs = FR_Xfr
+      fma.s1        FR_Xp2 = FR_2,f1,FR_NormX
+      mov           GR_Arg05 = 0x3FE
+}
+{ .mfi
+      add           GR_ad_Roots = 0x1390,GR_ad_1
+      fma.s1        FR_NormX = FR_NormX,FR_Xfr,f0
+      mov           GR_Arg075 = 0x3FE8
+};;
+{ .mfi
+      getf.sig      GR_Sig = FR_int_Ntrunc
+      fma.s1        FR_Xp3 = FR_2,f1,FR_Xp1
+      shl           GR_Arg05 = GR_Arg05,52
+}
+{ .mfi
+      mov           GR_Arg025 = 0x3FD0
+      fma.s1        FR_Xp6 = FR_5,f1,FR_Xp1
+      add           GR_ad_Co = 0x1C40,GR_ad_Data
+};;
+{ .mfi
+      add           GR_ad_Dx = 8,GR_ad_Roots
+      fma.s1        FR_Xp7 = FR_2,f1,FR_Xp5
+      shr.u         GR_ArgXfr = GR_ArgXfrAsIs,48
+}
+{ .mfi
+      add           GR_ad_Ce = 0x60,GR_ad_Co
+      fma.s1        FR_Xp8 = FR_3,f1,FR_Xp5
+      cmp.lt        p6,p0 = GR_ArgXfrAsIs,GR_Arg05
+};;
+{ .mfi
+      and           GR_RootInd = 0xF,GR_Sig
+      fma.s1        FR_Xp9 = FR_2,FR_2,FR_Xp5
+      // p10 if arg < 0.25
+      cmp.lt        p10,p14 = GR_ArgXfr,GR_Arg025
+}
+{ .mfi
+(p6)  add           GR_ad_Roots = 0x120,GR_ad_Roots
+      fma.s1        FR_Xp11 = f1,f1,FR_Xp10
+(p6)  add           GR_ad_Dx = 0x120,GR_ad_Dx
+};;
+{ .mfi
+      shladd        GR_ad_Root = GR_RootInd,4,GR_ad_Roots
+      fma.s1        FR_Xp12 = FR_2,f1,FR_Xp10
+      // p11 if 0.25 <= arg < 0.75
+      // p12 if 0.75 <= arg < 1.0
+(p14) cmp.lt.unc    p11,p12 = GR_ArgXfr,GR_Arg075
+}
+{ .mfi
+      shladd        GR_ad_Dx = GR_RootInd,4,GR_ad_Dx
+      fma.s1        FR_Xp13 = FR_3,f1,FR_Xp10
+      cmp.eq        p0,p13 = 0,GR_Sig
+};;
+{ .mfi
+      ld8           GR_Root = [GR_ad_Root]
+      fma.s1        FR_Xp14 = FR_2,FR_2,FR_Xp10
+(p12) mov           GR_Offs = 0x180
+}
+{ .mfi
+      ldfd          FR_Root = [GR_ad_Root]
+      fma.s1        FR_Xp15 = FR_5,f1,FR_Xp10
+      and           GR_Sig = 0xF,GR_Sig
+};;
+{ .mfi
+      ld8           GR_Dx = [GR_ad_Dx]
+      fma.s1        FR_Xp16 = FR_3,FR_2,FR_Xp10
+(p13) cmp.ge.unc    p6,p0 = 0xD,GR_Sig
+}
+{ .mfi
+(p11) mov           GR_Offs = 0xC0
+(p13) fma.s1        FR_NormX = FR_NormX,FR_Xp1,f0
+(p13) cmp.ge.unc    p7,p0 = 0xB,GR_Sig
+};;
+{ .mfi
+(p14) add           GR_ad_Co = GR_Offs,GR_ad_Co
+(p6)  fma.s1        FR_Xp2 = FR_Xp2,FR_Xp3,f0
+(p13) cmp.ge.unc    p8,p0 = 0x9,GR_Sig
+}
+{ .mfi
+(p14) add           GR_ad_Ce = GR_Offs,GR_ad_Ce
+(p7)  fma.s1        FR_Xp4 = FR_Xp4,FR_Xp5,f0
+(p13) cmp.ge.unc    p9,p0 = 0x7,GR_Sig
+};;
+{ .mfi
+      ldfpd         FR_B17,FR_B16 = [GR_ad_Co],16
+(p8)  fma.s1        FR_Xp6 = FR_Xp6,FR_Xp7,f0
+(p13) cmp.ge.unc    p6,p0 = 0x5,GR_Sig
+}
+{ .mfi
+      ldfpd         FR_B15,FR_B14 = [GR_ad_Ce],16
+(p9)  fma.s1        FR_Xp8 = FR_Xp8,FR_Xp9,f0
+(p13) cmp.ge.unc    p7,p0 = 0x3,GR_Sig
+};;
+{ .mfi
+      ldfpd         FR_B13,FR_B12 = [GR_ad_Co],16
+(p6)  fma.s1        FR_Xp10 = FR_Xp10,FR_Xp11,f0
+(p13) cmp.ge.unc    p8,p0 = 0x1,GR_Sig
+}
+{ .mfi
+      ldfpd         FR_B11,FR_B10 = [GR_ad_Ce],16
+(p7)  fma.s1        FR_Xp12 = FR_Xp12,FR_Xp13,f0
+(p13) cmp.eq.unc    p9,p0 = 0,GR_Sig
+};;
+{ .mfi
+      ldfpd         FR_B9,FR_B8 = [GR_ad_Co],16
+(p8)  fma.s1        FR_Xp14 = FR_Xp14,FR_Xp15,f0
+      mov           GR_Arg15 = 0xC02E // -15
+}
+{ .mfi
+      ldfpd         FR_B7,FR_B6 = [GR_ad_Ce],16
+      fcmp.eq.s1    p15,p0 = f0,FR_Xf
+(p13) cmp.ge.unc    p6,p0 = 0xC,GR_Sig
+};;
+{ .mfi
+      ldfe          FR_B5 = [GR_ad_Co],16
+(p9)  fma.s1        FR_NormX = FR_NormX,FR_Xp16,f0
+      sub           GR_Root = GR_ArgAsIs,GR_Root
+}
+{ .mfi
+      sub           GR_RootInd = 0xE,GR_RootInd
+(p11) fms.s1        FR_x = FR_Xfr,f1,FR_LocalMin // x-LocalMin
+(p13) cmp.ge.unc    p7,p0 = 0x8,GR_Sig
+};;
+.pred.rel "mutex",p10,p12
+{ .mfi
+      ldfe          FR_B4 = [GR_ad_Ce],16
+(p10) fms.s1        FR_x = FR_Xfr,f1,f0 // x
+      add           GR_Root = GR_Root,GR_Dx
+}
+{ .mfb
+      cmp.gtu       p14,p0 = 0xE,GR_RootInd
+(p12) fms.s1        FR_x = FR_Xfr,f1,f1 // x-1
+(p15) br.cond.spnt  lgamma_singularity
+};;
+{ .mfi
+      ldfe          FR_B3 = [GR_ad_Co],16
+(p6)  fma.s1        FR_Xp2 = FR_Xp2,FR_Xp4,f0
+(p14) cmp.lt.unc    p11,p0 = GR_Arg,GR_Arg15
+}
+{ .mfi
+      ldfe          FR_B2 = [GR_ad_Ce],16
+(p7)  fma.s1        FR_Xp6 = FR_Xp6,FR_Xp8,f0
+      add           GR_2xDx = GR_Dx,GR_Dx
+};;
+{ .mfi
+      ldfe          FR_B1 = [GR_ad_Co],16
+      fms.s1        FR_r = f8,f1,FR_Root
+(p13) cmp.ge.unc    p6,p0 = 0x4,GR_Sig
+}
+{ .mib
+      ldfe          FR_B0 = [GR_ad_Ce],16
+(p11) cmp.leu.unc   p10,p0 = GR_Root,GR_2xDx
+(p10) br.cond.spnt  lgamma_negroots
+};;
+{ .mfi
+      ldfpd         FR_P5,FR_P4 = [GR_ad_1],16
+(p6)  fma.s1        FR_Xp10 = FR_Xp10,FR_Xp12,f0
+      tbit.z        p14,p15 = GR_Sig,0
+}
+{ .mfi
+      ldfpd         FR_P3,FR_P2 = [GR_ad_2],16
+      fnma.d.s0     FR_T = f1,f1,f8 //      nop.f         0
+
+(p13) cmp.ge.unc    p7,p0 = 0x2,GR_Sig
+};;
+{ .mfi
+      ldfe          FR_Ln2 = [GR_ad_1],0x50
+(p7)  fma.s1        FR_NormX = FR_NormX,FR_Xp14,f0
+      mov           GR_PseudoRoot = 0xBFFBC
+}
+{ .mlx
+      add           GR_ad_2 = 0x40,GR_ad_2
+      movl          GR_2xDx = 0x00002346DC5D6389
+};;
+{ .mfi
+      ldfpd         FR_Q8,FR_Q7 = [GR_ad_1],16
+      fma.s1        FR_x2 = FR_x,FR_x,f0
+      shl           GR_PseudoRoot = GR_PseudoRoot,44
+}
+{ .mfi
+      ldfpd         FR_Q6,FR_Q5 = [GR_ad_2],16
+      fma.s1        FR_B17 = FR_B17,FR_x,FR_B16
+(p13) cmp.ge.unc    p6,p0 = 0xA,GR_Sig
+};;
+{ .mfi
+      ldfpd         FR_Q4,FR_Q3 = [GR_ad_1],16
+(p6)  fma.s1        FR_Xp2 = FR_Xp2,FR_Xp6,f0
+      sub           GR_PseudoRoot = GR_ArgAsIs,GR_PseudoRoot
+}
+{ .mfi
+      ldfpd         FR_Q2,FR_Q1 = [GR_ad_2],16
+      fma.s1        FR_B15 = FR_B15,FR_x,FR_B14
+(p13) cmp.ge.unc    p7,p0 = 0x6,GR_Sig
+};;
+{ .mfi
+      add           GR_ad_Co = 0x12F0,GR_ad_2
+      fma.s1        FR_B13 = FR_B13,FR_x,FR_B12
+      cmp.leu.unc   p10,p0 = GR_PseudoRoot,GR_2xDx
+}
+{ .mfi
+      add           GR_ad_Ce = 0x1300,GR_ad_2
+      fma.s1        FR_B11 = FR_B11,FR_x,FR_B10
+      mov           GR_ExpMask = 0x1ffff
+};;
+{ .mfi
+(p10) ldfe          FR_PR01 = [GR_ad_Co],0xF0
+      fma.s1        FR_B9 = FR_B9,FR_x,FR_B8
+      mov           GR_ExpBias = 0xFFFF
+}
+{ .mfb
+(p10) ldfe          FR_PR11 = [GR_ad_Ce],0xF0
+      fma.s1        FR_B7 = FR_B7,FR_x,FR_B6
+(p10) br.cond.spnt  lgamma_pseudoroot
+};;
+{ .mfi
+(p13) cmp.ge.unc    p6,p0 = 0xE,GR_Sig
+(p7)  fma.s1        FR_NormX = FR_NormX,FR_Xp10,f0
+      tbit.z.unc    p8,p0 = GR_Sig,0
+}
+{ .mfi
+      mov           GR_SignOfGamma = 1
+      fma.s1        FR_B5 = FR_B5,FR_x,FR_B4
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_B3 = FR_B3,FR_x,FR_B2
+(p8)  sub           GR_SignOfGamma = r0,GR_SignOfGamma
+}
+{ .mfi
+      nop.m         0
+(p14) fms.s1        FR_w = f0,f0,f1
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [r33] = GR_SignOfGamma
+      fma.s1        FR_B1 = FR_B1,FR_x,FR_B0
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [r33] = GR_SignOfGamma
+      fma.s1        FR_B17 = FR_B17,FR_x2,FR_B15
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_B13 = FR_B13,FR_x2,FR_B11
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_B9 = FR_B9,FR_x2,FR_B7
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x4 = FR_x2,FR_x2,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p6)  fma.s1        FR_NormX = FR_NormX,FR_Xp2,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_B5 = FR_B5,FR_x2,FR_B3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_B17 = FR_B17,FR_x4,FR_B13
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x8 = FR_x4,FR_x4,f0
+      nop.i         0
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      nop.m         0
+(p15) fms.s1        FR_w = FR_NormX,f1,f1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p14) fnma.s1       FR_w = FR_NormX,f1,FR_w
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_B9 = FR_B9,FR_x4,FR_B5
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      frcpa.s1      FR_C,p0 = f1,FR_NormX
+      nop.i         0
+};;
+{ .mfi
+      getf.exp      GR_Exp = FR_NormX
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      getf.d        GR_ArgAsIs = FR_NormX
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_w2 = FR_w,FR_w,f0
+      nop.i         0
+}
+{ .mfi
+      and           GR_Exp = GR_Exp,GR_ExpMask
+      fma.s1        FR_Q8 = FR_Q8,FR_w,FR_Q7
+      nop.i         0
+};;
+{ .mfi
+      sub           GR_Exp = GR_Exp,GR_ExpBias
+      fma.s1        FR_B17 = FR_B17,FR_x8,FR_B9
+      extr.u        GR_Ind = GR_ArgAsIs,44,8
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Q6 = FR_Q6,FR_w,FR_Q5
+      nop.i         0
+};;
+{ .mfi
+      setf.sig      FR_int_N = GR_Exp
+      fms.s1        FR_r = FR_C,FR_NormX,f1
+      nop.i         0
+}
+{ .mfi
+      shladd        GR_ad_2 = GR_Ind,4,GR_ad_2
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      getf.exp      GR_SignExp_w = FR_w
+      fma.s1        FR_Q4 = FR_Q4,FR_w,FR_Q3
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_T = [GR_ad_2]
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      and           GR_Exp_w = GR_ExpMask, GR_SignExp_w
+      fnma.s1       FR_Q1 = FR_05,FR_w2,FR_w
+      mov           GR_fff9 = 0xfff9
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_w3 = FR_w2,FR_w,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_w4 = FR_w2,FR_w2,f0
+//    p13 <== large w __libm_lgamma
+//    p14 <== small w __libm_lgamma
+      cmp.ge        p13,p14 = GR_Exp_w,GR_fff9
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Qlo = FR_Q8,FR_w2,FR_Q6
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_r2 = FR_r,FR_r,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_B17 = FR_B17,FR_x2,FR_B1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_P54 = FR_P5,FR_r,FR_P4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_Q2 = FR_Q2,FR_w3,FR_Q1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_w6 = FR_w3,FR_w3,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fcvt.xf       FR_N = FR_int_N
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_r3 = FR_r2,FR_r,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fnma.s1       FR_P10 = FR_r2,FR_05,FR_r
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_P54 = FR_P54,FR_r2,FR_P32
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_Qhi = FR_Q4,FR_w4,FR_Q2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p14) fnma.s1       FR_Qlo = FR_Qlo,FR_w6,FR_B17
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_TpNxLn2 = FR_N,FR_Ln2,FR_T
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_P54 = FR_P54,FR_r3,FR_P10
+      nop.i         0
+};;
+.pred.rel "mutex",p13,p14
+{ .mfi
+      nop.m         0
+(p14) fms.d.s0      f8 = FR_Qlo,f1,FR_Qhi
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_LnX = FR_TpNxLn2,f1,FR_P54
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+(p13) fms.d.s0      f8 = FR_B17,f1,FR_LnX
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) near negative roots
+//---------------------------------------------------------------------
+.align 32
+lgamma_negroots:
+{ .mfi
+      shladd        GR_Offs = GR_RootInd,3,r0 //GR_RootInd*8
+      fma.s1        FR_r2 = FR_r,FR_r,f0
+      add           GR_ad_Co = 0x15C0,GR_ad_1//0x1590,GR_ad_1
+}
+{ .mfi
+      add           GR_ad_Ce = 0x1610,GR_ad_1//0x15E0,GR_ad_1
+      nop.f         0
+      cmp.lt        p6,p0 = GR_ArgXfrAsIs,GR_Arg05
+};;
+{ .mfi
+      add           GR_ad_Roots = 0x10A0,GR_ad_1
+      nop.f         0
+(p6)  add           GR_ad_Co = 0x820,GR_ad_Co
+}
+{ .mfi
+(p6)  add           GR_ad_Ce = 0x820,GR_ad_Ce
+      nop.f         0
+      shladd        GR_Offs = GR_RootInd,1,GR_Offs //GR_RootInd*10
+};;
+{ .mmi
+      shladd        GR_ad_Co = GR_Offs,4,GR_ad_Co
+      shladd        GR_ad_Ce = GR_Offs,4,GR_ad_Ce
+      cmp.eq        p8,p7 = r0,r0
+};;
+{ .mmi
+      ldfpd         FR_A15,FR_A14 = [GR_ad_Co],16
+      ldfpd         FR_A13,FR_A12 = [GR_ad_Ce],16
+      mov           GR_SignOfGamma = 1
+};;
+{ .mmi
+      ldfpd         FR_A11,FR_A10 = [GR_ad_Co],16
+      ldfpd         FR_A9,FR_A8   = [GR_ad_Ce],16
+(p6)  cmp.eq        p7,p8 = r0,GR_RootInd
+};;
+{ .mmi
+      ldfpd         FR_A7,FR_A6 = [GR_ad_Co],16
+      ldfpd         FR_A5,FR_A4 = [GR_ad_Ce],16
+      tbit.z        p11,p0 = GR_Sig,0
+};;
+{ .mmi
+      ldfe          FR_A3 = [GR_ad_Co],16
+      ldfe          FR_A2 = [GR_ad_Ce],16
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+};;
+{ .mmi
+      ldfe          FR_A1 = [GR_ad_Co],16
+      ldfe          FR_A0 = [GR_ad_Ce],16
+(p11) sub           GR_SignOfGamma = r0,GR_SignOfGamma
+};;
+{ .mfi
+      ldfe          FR_A00 = [GR_ad_Roots]
+      fma.s1        FR_r4 = FR_r2,FR_r2,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A15 = FR_A15,FR_r,FR_A14
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A13 = FR_A13,FR_r,FR_A12
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [r33] = GR_SignOfGamma
+      fma.s1        FR_A11 = FR_A11,FR_r,FR_A10
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [r33] = GR_SignOfGamma
+      fma.s1        FR_A9 = FR_A9,FR_r,FR_A8
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r,FR_A6
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A5 = FR_A5,FR_r,FR_A4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_r,FR_A2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_r8 = FR_r4,FR_r4,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A1 = FR_A1,FR_r,FR_A0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A15 = FR_A15,FR_r2,FR_A13
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A11 = FR_A11,FR_r2,FR_A9
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r2,FR_A5
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_r2,FR_A1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A15 = FR_A15,FR_r4,FR_A11
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r4,FR_A3
+      nop.i         0
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+      nop.m         0
+(p7)  fma.s1        FR_A1 = FR_A15,FR_r8,FR_A7
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p8)  fma.d.s0      f8 = FR_A15,FR_r8,FR_A7
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+(p7)  fma.d.s0      f8 = FR_A1,FR_r,FR_A00
+      br.ret.sptk   b0
+};;
+// branch for handling pseudo root on (-2;-1)
+//---------------------------------------------------------------------
+.align 32
+lgamma_pseudoroot:
+{ .mmi
+      ldfe          FR_PR21 = [GR_ad_Co],32
+      ldfe          FR_PR31 = [GR_ad_Ce],32
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+};;
+{ .mmi
+      ldfe          FR_PR00 = [GR_ad_Co],32
+      ldfe          FR_PR10 = [GR_ad_Ce],0xF0
+      mov           GR_SignOfGamma = 1
+};;
+{ .mmi
+      ldfe          FR_PR20 = [GR_ad_Co],0xF0
+      ldfe          FR_PR30 = [GR_ad_Ce]
+      tbit.z        p8,p0 = GR_Sig,0
+};;
+{ .mfi
+      ldfe          FR_PRN = [GR_ad_Co]
+      fma.s1        FR_PR01 = f8,f1,FR_PR01
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR11 = f8,f1,FR_PR11
+(p8)  sub           GR_SignOfGamma = r0,GR_SignOfGamma
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [r33] = GR_SignOfGamma
+      fma.s1        FR_PR21 = f8,f1,FR_PR21
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [r33] = GR_SignOfGamma
+      fma.s1        FR_PR31 = f8,f1,FR_PR31
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR01 = f8,FR_PR01,FR_PR00
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR11 = f8,FR_PR11,FR_PR10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR21 = f8,FR_PR21,FR_PR20
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR31 = f8,FR_PR31,FR_PR30
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR01 = FR_PR11,FR_PR01,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR21 = FR_PR31,FR_PR21,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_PR01 = FR_PR21,FR_PR01,f0
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fma.d.s0      f8 = FR_PR01,FR_PRN,f0
+      br.ret.sptk   b0
+};;
+// branch for handling +/-0, NaT, QNaN, +/-INF and denormalised numbers
+//---------------------------------------------------------------------
+.align 32
+lgamma_spec:
+{ .mfi
+      getf.exp      GR_SignExp = FR_NormX
+      fclass.m      p6,p0 = f8,0x21 // is arg +INF?
+      mov           GR_SignOfGamma = 1
+};;
+{ .mfi
+      getf.sig      GR_ArgAsIs = FR_NormX
+      fclass.m      p7,p0 = f8,0xB // is x deno?
+      // set p11 if signgum is 32-bit int
+      // set p12 if signgum is 64-bit int
+      cmp.eq        p12,p11 = 8,r34
+};;
+.pred.rel "mutex",p11,p12
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p11) st4           [r33] = GR_SignOfGamma
+      fclass.m      p8,p0 = f8,0x1C0 // is arg NaT or NaN?
+      dep.z         GR_Ind = GR_SignExp,8,4
+}
+{ .mib
+      // store sign of gamma(x) as 64-bit int
+(p12) st8           [r33] = GR_SignOfGamma
+      cmp.lt        p10,p0 = GR_SignExp,GR_ExpBias
+(p6)  br.ret.spnt   b0 // exit for +INF
+};;
+{ .mfi
+      and           GR_Exp = GR_SignExp,GR_ExpMask
+      fclass.m      p9,p0 = f8,0x22 // is arg -INF?
+      nop.i         0
+};;
+{ .mfi
+      add           GR_ad_Co = GR_Ind,GR_ad_Data
+(p7)  fma.s0        FR_tmp = f8,f8,f8
+      extr.u        GR_ArgAsIs = GR_ArgAsIs,11,52
+}
+{ .mfb
+      nop.m         0
+(p8)  fms.d.s0      f8 = f8,f1,f8
+(p8)  br.ret.spnt   b0 // exit for NaT and NaN
+};;
+{ .mib
+      nop.m         0
+      shr.u         GR_Arg = GR_ArgAsIs,48
+(p7)  br.cond.sptk  lgamma_common
+};;
+{ .mfb
+      nop.m         0
+(p9)  fmerge.s      f8 = f1,f8
+(p9)  br.ret.spnt   b0 // exit -INF
+};;
+// branch for handling negative integers and +/-0
+//---------------------------------------------------------------------
+.align 32
+lgamma_singularity:
+{ .mfi
+      mov           GR_ad_SignGam = r33
+      fclass.m      p6,p0 = f8, 0x6 // is x -0?
+      mov           GR_SignOfGamma = 1
+}
+{ .mfi
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+      fma.s1        FR_X = f0,f0,f8
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      frcpa.s0      f8,p0 = f1,f0
+      mov           GR_TAG = 106 // negative
+}
+{ .mib
+      nop.m         0
+(p6)  sub           GR_SignOfGamma = r0,GR_SignOfGamma
+      br.cond.sptk  lgamma_libm_err
+};;
+// overflow (x > OVERFLOV_BOUNDARY)
+//---------------------------------------------------------------------
+.align 32
+lgamma_overflow:
+{ .mfi
+      mov           GR_SignOfGamma = 1
+      nop.f         0
+      mov           r8 = 0x1FFFE
+};;
+{ .mfi
+      setf.exp      f9 = r8
+      fmerge.s      FR_X = f8,f8
+      mov           GR_TAG = 105 // overflow
+};;
+{ .mfi
+      mov           GR_ad_SignGam = r33
+      nop.f         0
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+}
+{ .mfi
+      nop.m         0
+      fma.d.s0      f8 = f9,f9,f0 // Set I,O and +INF result
+      nop.i         0
+};;
+//
+//---------------------------------------------------------------------
+.align 32
+lgamma_libm_err:
+{ .mmi
+      alloc         r32 = ar.pfs,1,4,4,0
+      mov           GR_Parameter_TAG = GR_TAG
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p10
+{ .mmi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [GR_ad_SignGam] = GR_SignOfGamma
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [GR_ad_SignGam] = GR_SignOfGamma
+      nop.i         0
+};;
+GLOBAL_LIBM_END(__libm_lgamma)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov   GR_SAVE_PFS=ar.pfs                // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add   sp=-64,sp                         // Create new stack
+        nop.f 0
+        mov   GR_SAVE_GP=gp                     // Save gp
+};;
+{ .mmi
+        stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
+};;
+.body
+{ .mib
+        stfd [GR_Parameter_X] = FR_X                  // STORE Parameter 1
+                                                      // on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+        nop.b 0
+}
+{ .mib
+        stfd [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3
+                                                      // on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#         // Call error handling
+                                                      // function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/libm_lgammaf.S b/sysdeps/ia64/fpu/libm_lgammaf.S
new file mode 100644
index 0000000000..4bd92c3b26
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_lgammaf.S
@@ -0,0 +1,2199 @@
+.file "libm_lgammaf.s"
+
+
+// Copyright (c) 2002 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT
+// LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,
+// EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA,OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code,and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History:
+// 01/10/02  Initial version
+// 01/25/02  Corrected parameter store, load, and tag for __libm_error_support
+// 02/01/02  Added support of SIGN(GAMMA(x)) calculation
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 09/16/02  Improved accuracy on intervals reduced to [1;1.25]
+// 10/21/02  Now it returns SIGN(GAMMA(x))=-1 for negative zero
+// 02/10/03  Reordered header: .section, .global, .proc, .align
+// 07/22/03  Reformatted some data tables
+// 03/31/05  Reformatted delimiters between data tables
+//
+//*********************************************************************
+//
+//*********************************************************************
+//
+// Function: __libm_lgammaf(float x, int* signgam, int szsigngam)
+// computes the principle value of the logarithm of the GAMMA function
+// of x. Signum of GAMMA(x) is stored to memory starting at the address
+// specified by the signgam.
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f6-f15
+//                              f32-f97
+//
+//    General Purpose Registers:
+//      r8-r11
+//      r14-r30
+//      r32-r36
+//      r37-r40 (Used to pass arguments to error handling routine)
+//
+//    Predicate Registers:      p6-p15
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    lgamma(+inf) = +inf
+//    lgamma(-inf) = +inf
+//    lgamma(+/-0) = +inf
+//    lgamma(x<0, x - integer) = +inf
+//    lgamma(SNaN) = QNaN
+//    lgamma(QNaN) = QNaN
+//
+//*********************************************************************
+//
+// Overview
+//
+// The method consists of three cases.
+//
+// If      2^13 <= x < OVERFLOW_BOUNDARY  use case lgammaf_pstirling;
+// else if 1 < x < 2^13                   use case lgammaf_regular;
+// else if -9 < x < 1                     use case lgammaf_negrecursion;
+// else if -2^13 <  x < -9                use case lgammaf_negpoly;
+// else if x < -2^13                      use case lgammaf_negstirling;
+// else if x is close to negative
+//         roots of ln(GAMMA(x))          use case lgammaf_negroots;
+//
+//
+// Case 2^13 <= x < OVERFLOW_BOUNDARY
+// ----------------------------------
+//   Here we use algorithm based on the Stirling formula:
+//     ln(GAMMA(x)) = ln(sqrt(2*Pi)) + (x-0.5)*ln(x) - x
+//
+// Case 1 < x < 2^13
+// -----------------
+//   To calculate ln(GAMMA(x)) for such arguments we use polynomial
+//   approximation on following intervals: [1.0; 1.25), [1.25; 1.5),
+//   [1.5, 1.75), [1.75; 2), [2; 4), [2^i; 2^(i+1)), i=1..8
+//
+//   Following variants of approximation and argument reduction are used:
+//    1. [1.0; 1.25)
+//       ln(GAMMA(x)) ~ (x-1.0)*P7(x)
+//
+//    2. [1.25; 1.5)
+//       ln(GAMMA(x)) ~ ln(GAMMA(x0))+(x-x0)*P8(x-x0),
+//       where x0 - point of local minimum on [1;2] rounded to nearest double
+//       precision number.
+//
+//    3. [1.5; 1.75)
+//       ln(GAMMA(x)) ~ P8(x)
+//
+//    4. [1.75; 2.0)
+//       ln(GAMMA(x)) ~ (x-2)*P7(x)
+//
+//    5. [2; 4)
+//       ln(GAMMA(x)) ~ (x-2)*P10(x)
+//
+//    6. [2^i; 2^(i+1)), i=2..8
+//       ln(GAMMA(x)) ~ P10((x-2^i)/2^i)
+//
+// Case -9 < x < 1
+// ---------------
+//   Here we use the recursive formula:
+//   ln(GAMMA(x)) = ln(GAMMA(x+1)) - ln(x)
+//
+//   Using this formula we reduce argument to base interval [1.0; 2.0]
+//
+// Case -2^13 < x < -9
+// --------------------
+//   Here we use the formula:
+//   ln(GAMMA(x)) = ln(Pi/(|x|*GAMMA(|x|)*sin(Pi*|x|))) =
+//   = -ln(|x|) - ln((GAMMA(|x|)) - ln(sin(Pi*r)/(Pi*r)) - ln(|r|)
+//   where r = x - rounded_to_nearest(x), i.e |r| <= 0.5 and
+//   ln(sin(Pi*r)/(Pi*r)) is approximated by 8-degree polynomial of r^2
+//
+// Case x < -2^13
+// --------------
+//   Here we use algorithm based on the Stirling formula:
+//   ln(GAMMA(x)) = -ln(sqrt(2*Pi)) + (|x|-0.5)ln(x) - |x| -
+//   - ln(sin(Pi*r)/(Pi*r)) - ln(|r|)
+//   where r = x - rounded_to_nearest(x).
+//
+// Neighbourhoods of negative roots
+// --------------------------------
+//   Here we use polynomial approximation
+//   ln(GAMMA(x-x0)) = ln(GAMMA(x0)) + (x-x0)*P14(x-x0),
+//   where x0 is a root of ln(GAMMA(x)) rounded to nearest double
+//   precision number.
+//
+//
+// Claculation of logarithm
+// ------------------------
+//   Consider  x = 2^N * xf so
+//   ln(x) = ln(frcpa(x)*x/frcpa(x))
+//         = ln(1/frcpa(x)) + ln(frcpa(x)*x)
+//
+//   frcpa(x) = 2^(-N) * frcpa(xf)
+//
+//   ln(1/frcpa(x)) = -ln(2^(-N)) - ln(frcpa(xf))
+//                  = N*ln(2) - ln(frcpa(xf))
+//                  = N*ln(2) + ln(1/frcpa(xf))
+//
+//   ln(x) = ln(1/frcpa(x)) + ln(frcpa(x)*x) =
+//         = N*ln(2) + ln(1/frcpa(xf)) + ln(frcpa(x)*x)
+//         = N*ln(2) + T + ln(frcpa(x)*x)
+//
+//   Let r = 1 - frcpa(x)*x, note that r is quite small by
+//   absolute value so
+//
+//   ln(x) = N*ln(2) + T + ln(1+r) ~ N*ln(2) + T + Series(r),
+//   where T - is precomputed tabular value,
+//   Series(r) = (P3*r + P2)*r^2 + (P1*r + 1)
+//
+//*********************************************************************
+
+GR_TAG                 = r8
+GR_ad_Data             = r8
+GR_ad_Co               = r9
+GR_ad_SignGam          = r10
+GR_ad_Ce               = r10
+GR_SignExp             = r11
+
+GR_ad_C650             = r14
+GR_ad_RootCo           = r14
+GR_ad_C0               = r15
+GR_Dx                  = r15
+GR_Ind                 = r16
+GR_Offs                = r17
+GR_IntNum              = r17
+GR_ExpBias             = r18
+GR_ExpMask             = r19
+GR_Ind4T               = r20
+GR_RootInd             = r20
+GR_Sig                 = r21
+GR_Exp                 = r22
+GR_PureExp             = r23
+GR_ad_C43              = r24
+GR_StirlBound          = r25
+GR_ad_T                = r25
+GR_IndX8               = r25
+GR_Neg2                = r25
+GR_2xDx                = r25
+GR_SingBound           = r26
+GR_IndX2               = r26
+GR_Neg4                = r26
+GR_ad_RootCe           = r26
+GR_Arg                 = r27
+GR_ExpOf2              = r28
+GR_fff7                = r28
+GR_Root                = r28
+GR_ReqBound            = r28
+GR_N                   = r29
+GR_ad_Root             = r30
+GR_ad_OvfBound         = r30
+GR_SignOfGamma         = r31
+
+GR_SAVE_B0             = r33
+GR_SAVE_PFS            = r34
+GR_SAVE_GP             = r35
+GR_SAVE_SP             = r36
+
+GR_Parameter_X         = r37
+GR_Parameter_Y         = r38
+GR_Parameter_RESULT    = r39
+GR_Parameter_TAG       = r40
+
+//*********************************************************************
+
+FR_X                   = f10
+FR_Y                   = f1 // lgammaf is single argument function
+FR_RESULT              = f8
+
+FR_x                   = f6
+FR_x2                  = f7
+
+FR_x3                  = f9
+FR_x4                  = f10
+FR_xm2                 = f11
+FR_w                   = f11
+FR_w2                  = f12
+FR_Q32                 = f13
+FR_Q10                 = f14
+FR_InvX                = f15
+
+FR_NormX               = f32
+
+FR_A0                  = f33
+FR_A1                  = f34
+FR_A2                  = f35
+FR_A3                  = f36
+FR_A4                  = f37
+FR_A5                  = f38
+FR_A6                  = f39
+FR_A7                  = f40
+FR_A8                  = f41
+FR_A9                  = f42
+FR_A10                 = f43
+
+FR_int_N               = f44
+FR_P3                  = f45
+FR_P2                  = f46
+FR_P1                  = f47
+FR_LocalMin            = f48
+FR_Ln2                 = f49
+FR_05                  = f50
+FR_LnSqrt2Pi           = f51
+FR_3                   = f52
+FR_r                   = f53
+FR_r2                  = f54
+FR_T                   = f55
+FR_N                   = f56
+FR_xm05                = f57
+FR_int_Ln              = f58
+FR_P32                 = f59
+FR_P10                 = f60
+
+FR_Xf                  = f61
+FR_InvXf               = f62
+FR_rf                  = f63
+FR_rf2                 = f64
+FR_Tf                  = f65
+FR_Nf                  = f66
+FR_xm05f               = f67
+FR_P32f                = f68
+FR_P10f                = f69
+FR_Lnf                 = f70
+FR_Xf2                 = f71
+FR_Xf4                 = f72
+FR_Xf8                 = f73
+FR_Ln                  = f74
+FR_xx                  = f75
+FR_Root                = f75
+FR_Req                 = f76
+FR_1pXf                = f77
+
+FR_S16                 = f78
+FR_R3                  = f78
+FR_S14                 = f79
+FR_R2                  = f79
+FR_S12                 = f80
+FR_R1                  = f80
+FR_S10                 = f81
+FR_R0                  = f81
+FR_S8                  = f82
+FR_rx                  = f82
+FR_S6                  = f83
+FR_rx2                 = f84
+FR_S4                  = f84
+FR_S2                  = f85
+
+FR_Xp1                 = f86
+FR_Xp2                 = f87
+FR_Xp3                 = f88
+FR_Xp4                 = f89
+FR_Xp5                 = f90
+FR_Xp6                 = f91
+FR_Xp7                 = f92
+FR_Xp8                 = f93
+FR_OverflowBound       = f93
+
+FR_2                   = f94
+FR_tmp                 = f95
+FR_int_Ntrunc          = f96
+FR_Ntrunc              = f97
+
+//*********************************************************************
+
+RODATA
+.align 32
+LOCAL_OBJECT_START(lgammaf_data)
+log_table_1:
+data8 0xbfd0001008f39d59 // P3
+data8 0x3fd5556073e0c45a // P2
+data8 0x3fe62e42fefa39ef // ln(2)
+data8 0x3fe0000000000000 // 0.5
+//
+data8 0x3F60040155D5889E //ln(1/frcpa(1+   0/256)
+data8 0x3F78121214586B54 //ln(1/frcpa(1+   1/256)
+data8 0x3F841929F96832F0 //ln(1/frcpa(1+   2/256)
+data8 0x3F8C317384C75F06 //ln(1/frcpa(1+   3/256)
+data8 0x3F91A6B91AC73386 //ln(1/frcpa(1+   4/256)
+data8 0x3F95BA9A5D9AC039 //ln(1/frcpa(1+   5/256)
+data8 0x3F99D2A8074325F4 //ln(1/frcpa(1+   6/256)
+data8 0x3F9D6B2725979802 //ln(1/frcpa(1+   7/256)
+data8 0x3FA0C58FA19DFAAA //ln(1/frcpa(1+   8/256)
+data8 0x3FA2954C78CBCE1B //ln(1/frcpa(1+   9/256)
+data8 0x3FA4A94D2DA96C56 //ln(1/frcpa(1+  10/256)
+data8 0x3FA67C94F2D4BB58 //ln(1/frcpa(1+  11/256)
+data8 0x3FA85188B630F068 //ln(1/frcpa(1+  12/256)
+data8 0x3FAA6B8ABE73AF4C //ln(1/frcpa(1+  13/256)
+data8 0x3FAC441E06F72A9E //ln(1/frcpa(1+  14/256)
+data8 0x3FAE1E6713606D07 //ln(1/frcpa(1+  15/256)
+data8 0x3FAFFA6911AB9301 //ln(1/frcpa(1+  16/256)
+data8 0x3FB0EC139C5DA601 //ln(1/frcpa(1+  17/256)
+data8 0x3FB1DBD2643D190B //ln(1/frcpa(1+  18/256)
+data8 0x3FB2CC7284FE5F1C //ln(1/frcpa(1+  19/256)
+data8 0x3FB3BDF5A7D1EE64 //ln(1/frcpa(1+  20/256)
+data8 0x3FB4B05D7AA012E0 //ln(1/frcpa(1+  21/256)
+data8 0x3FB580DB7CEB5702 //ln(1/frcpa(1+  22/256)
+data8 0x3FB674F089365A7A //ln(1/frcpa(1+  23/256)
+data8 0x3FB769EF2C6B568D //ln(1/frcpa(1+  24/256)
+data8 0x3FB85FD927506A48 //ln(1/frcpa(1+  25/256)
+data8 0x3FB9335E5D594989 //ln(1/frcpa(1+  26/256)
+data8 0x3FBA2B0220C8E5F5 //ln(1/frcpa(1+  27/256)
+data8 0x3FBB0004AC1A86AC //ln(1/frcpa(1+  28/256)
+data8 0x3FBBF968769FCA11 //ln(1/frcpa(1+  29/256)
+data8 0x3FBCCFEDBFEE13A8 //ln(1/frcpa(1+  30/256)
+data8 0x3FBDA727638446A2 //ln(1/frcpa(1+  31/256)
+data8 0x3FBEA3257FE10F7A //ln(1/frcpa(1+  32/256)
+data8 0x3FBF7BE9FEDBFDE6 //ln(1/frcpa(1+  33/256)
+data8 0x3FC02AB352FF25F4 //ln(1/frcpa(1+  34/256)
+data8 0x3FC097CE579D204D //ln(1/frcpa(1+  35/256)
+data8 0x3FC1178E8227E47C //ln(1/frcpa(1+  36/256)
+data8 0x3FC185747DBECF34 //ln(1/frcpa(1+  37/256)
+data8 0x3FC1F3B925F25D41 //ln(1/frcpa(1+  38/256)
+data8 0x3FC2625D1E6DDF57 //ln(1/frcpa(1+  39/256)
+data8 0x3FC2D1610C86813A //ln(1/frcpa(1+  40/256)
+data8 0x3FC340C59741142E //ln(1/frcpa(1+  41/256)
+data8 0x3FC3B08B6757F2A9 //ln(1/frcpa(1+  42/256)
+data8 0x3FC40DFB08378003 //ln(1/frcpa(1+  43/256)
+data8 0x3FC47E74E8CA5F7C //ln(1/frcpa(1+  44/256)
+data8 0x3FC4EF51F6466DE4 //ln(1/frcpa(1+  45/256)
+data8 0x3FC56092E02BA516 //ln(1/frcpa(1+  46/256)
+data8 0x3FC5D23857CD74D5 //ln(1/frcpa(1+  47/256)
+data8 0x3FC6313A37335D76 //ln(1/frcpa(1+  48/256)
+data8 0x3FC6A399DABBD383 //ln(1/frcpa(1+  49/256)
+data8 0x3FC70337DD3CE41B //ln(1/frcpa(1+  50/256)
+data8 0x3FC77654128F6127 //ln(1/frcpa(1+  51/256)
+data8 0x3FC7E9D82A0B022D //ln(1/frcpa(1+  52/256)
+data8 0x3FC84A6B759F512F //ln(1/frcpa(1+  53/256)
+data8 0x3FC8AB47D5F5A310 //ln(1/frcpa(1+  54/256)
+data8 0x3FC91FE49096581B //ln(1/frcpa(1+  55/256)
+data8 0x3FC981634011AA75 //ln(1/frcpa(1+  56/256)
+data8 0x3FC9F6C407089664 //ln(1/frcpa(1+  57/256)
+data8 0x3FCA58E729348F43 //ln(1/frcpa(1+  58/256)
+data8 0x3FCABB55C31693AD //ln(1/frcpa(1+  59/256)
+data8 0x3FCB1E104919EFD0 //ln(1/frcpa(1+  60/256)
+data8 0x3FCB94EE93E367CB //ln(1/frcpa(1+  61/256)
+data8 0x3FCBF851C067555F //ln(1/frcpa(1+  62/256)
+data8 0x3FCC5C0254BF23A6 //ln(1/frcpa(1+  63/256)
+data8 0x3FCCC000C9DB3C52 //ln(1/frcpa(1+  64/256)
+data8 0x3FCD244D99C85674 //ln(1/frcpa(1+  65/256)
+data8 0x3FCD88E93FB2F450 //ln(1/frcpa(1+  66/256)
+data8 0x3FCDEDD437EAEF01 //ln(1/frcpa(1+  67/256)
+data8 0x3FCE530EFFE71012 //ln(1/frcpa(1+  68/256)
+data8 0x3FCEB89A1648B971 //ln(1/frcpa(1+  69/256)
+data8 0x3FCF1E75FADF9BDE //ln(1/frcpa(1+  70/256)
+data8 0x3FCF84A32EAD7C35 //ln(1/frcpa(1+  71/256)
+data8 0x3FCFEB2233EA07CD //ln(1/frcpa(1+  72/256)
+data8 0x3FD028F9C7035C1C //ln(1/frcpa(1+  73/256)
+data8 0x3FD05C8BE0D9635A //ln(1/frcpa(1+  74/256)
+data8 0x3FD085EB8F8AE797 //ln(1/frcpa(1+  75/256)
+data8 0x3FD0B9C8E32D1911 //ln(1/frcpa(1+  76/256)
+data8 0x3FD0EDD060B78081 //ln(1/frcpa(1+  77/256)
+data8 0x3FD122024CF0063F //ln(1/frcpa(1+  78/256)
+data8 0x3FD14BE2927AECD4 //ln(1/frcpa(1+  79/256)
+data8 0x3FD180618EF18ADF //ln(1/frcpa(1+  80/256)
+data8 0x3FD1B50BBE2FC63B //ln(1/frcpa(1+  81/256)
+data8 0x3FD1DF4CC7CF242D //ln(1/frcpa(1+  82/256)
+data8 0x3FD214456D0EB8D4 //ln(1/frcpa(1+  83/256)
+data8 0x3FD23EC5991EBA49 //ln(1/frcpa(1+  84/256)
+data8 0x3FD2740D9F870AFB //ln(1/frcpa(1+  85/256)
+data8 0x3FD29ECDABCDFA04 //ln(1/frcpa(1+  86/256)
+data8 0x3FD2D46602ADCCEE //ln(1/frcpa(1+  87/256)
+data8 0x3FD2FF66B04EA9D4 //ln(1/frcpa(1+  88/256)
+data8 0x3FD335504B355A37 //ln(1/frcpa(1+  89/256)
+data8 0x3FD360925EC44F5D //ln(1/frcpa(1+  90/256)
+data8 0x3FD38BF1C3337E75 //ln(1/frcpa(1+  91/256)
+data8 0x3FD3C25277333184 //ln(1/frcpa(1+  92/256)
+data8 0x3FD3EDF463C1683E //ln(1/frcpa(1+  93/256)
+data8 0x3FD419B423D5E8C7 //ln(1/frcpa(1+  94/256)
+data8 0x3FD44591E0539F49 //ln(1/frcpa(1+  95/256)
+data8 0x3FD47C9175B6F0AD //ln(1/frcpa(1+  96/256)
+data8 0x3FD4A8B341552B09 //ln(1/frcpa(1+  97/256)
+data8 0x3FD4D4F3908901A0 //ln(1/frcpa(1+  98/256)
+data8 0x3FD501528DA1F968 //ln(1/frcpa(1+  99/256)
+data8 0x3FD52DD06347D4F6 //ln(1/frcpa(1+ 100/256)
+data8 0x3FD55A6D3C7B8A8A //ln(1/frcpa(1+ 101/256)
+data8 0x3FD5925D2B112A59 //ln(1/frcpa(1+ 102/256)
+data8 0x3FD5BF406B543DB2 //ln(1/frcpa(1+ 103/256)
+data8 0x3FD5EC433D5C35AE //ln(1/frcpa(1+ 104/256)
+data8 0x3FD61965CDB02C1F //ln(1/frcpa(1+ 105/256)
+data8 0x3FD646A84935B2A2 //ln(1/frcpa(1+ 106/256)
+data8 0x3FD6740ADD31DE94 //ln(1/frcpa(1+ 107/256)
+data8 0x3FD6A18DB74A58C5 //ln(1/frcpa(1+ 108/256)
+data8 0x3FD6CF31058670EC //ln(1/frcpa(1+ 109/256)
+data8 0x3FD6F180E852F0BA //ln(1/frcpa(1+ 110/256)
+data8 0x3FD71F5D71B894F0 //ln(1/frcpa(1+ 111/256)
+data8 0x3FD74D5AEFD66D5C //ln(1/frcpa(1+ 112/256)
+data8 0x3FD77B79922BD37E //ln(1/frcpa(1+ 113/256)
+data8 0x3FD7A9B9889F19E2 //ln(1/frcpa(1+ 114/256)
+data8 0x3FD7D81B037EB6A6 //ln(1/frcpa(1+ 115/256)
+data8 0x3FD8069E33827231 //ln(1/frcpa(1+ 116/256)
+data8 0x3FD82996D3EF8BCB //ln(1/frcpa(1+ 117/256)
+data8 0x3FD85855776DCBFB //ln(1/frcpa(1+ 118/256)
+data8 0x3FD8873658327CCF //ln(1/frcpa(1+ 119/256)
+data8 0x3FD8AA75973AB8CF //ln(1/frcpa(1+ 120/256)
+data8 0x3FD8D992DC8824E5 //ln(1/frcpa(1+ 121/256)
+data8 0x3FD908D2EA7D9512 //ln(1/frcpa(1+ 122/256)
+data8 0x3FD92C59E79C0E56 //ln(1/frcpa(1+ 123/256)
+data8 0x3FD95BD750EE3ED3 //ln(1/frcpa(1+ 124/256)
+data8 0x3FD98B7811A3EE5B //ln(1/frcpa(1+ 125/256)
+data8 0x3FD9AF47F33D406C //ln(1/frcpa(1+ 126/256)
+data8 0x3FD9DF270C1914A8 //ln(1/frcpa(1+ 127/256)
+data8 0x3FDA0325ED14FDA4 //ln(1/frcpa(1+ 128/256)
+data8 0x3FDA33440224FA79 //ln(1/frcpa(1+ 129/256)
+data8 0x3FDA57725E80C383 //ln(1/frcpa(1+ 130/256)
+data8 0x3FDA87D0165DD199 //ln(1/frcpa(1+ 131/256)
+data8 0x3FDAAC2E6C03F896 //ln(1/frcpa(1+ 132/256)
+data8 0x3FDADCCC6FDF6A81 //ln(1/frcpa(1+ 133/256)
+data8 0x3FDB015B3EB1E790 //ln(1/frcpa(1+ 134/256)
+data8 0x3FDB323A3A635948 //ln(1/frcpa(1+ 135/256)
+data8 0x3FDB56FA04462909 //ln(1/frcpa(1+ 136/256)
+data8 0x3FDB881AA659BC93 //ln(1/frcpa(1+ 137/256)
+data8 0x3FDBAD0BEF3DB165 //ln(1/frcpa(1+ 138/256)
+data8 0x3FDBD21297781C2F //ln(1/frcpa(1+ 139/256)
+data8 0x3FDC039236F08819 //ln(1/frcpa(1+ 140/256)
+data8 0x3FDC28CB1E4D32FD //ln(1/frcpa(1+ 141/256)
+data8 0x3FDC4E19B84723C2 //ln(1/frcpa(1+ 142/256)
+data8 0x3FDC7FF9C74554C9 //ln(1/frcpa(1+ 143/256)
+data8 0x3FDCA57B64E9DB05 //ln(1/frcpa(1+ 144/256)
+data8 0x3FDCCB130A5CEBB0 //ln(1/frcpa(1+ 145/256)
+data8 0x3FDCF0C0D18F326F //ln(1/frcpa(1+ 146/256)
+data8 0x3FDD232075B5A201 //ln(1/frcpa(1+ 147/256)
+data8 0x3FDD490246DEFA6B //ln(1/frcpa(1+ 148/256)
+data8 0x3FDD6EFA918D25CD //ln(1/frcpa(1+ 149/256)
+data8 0x3FDD9509707AE52F //ln(1/frcpa(1+ 150/256)
+data8 0x3FDDBB2EFE92C554 //ln(1/frcpa(1+ 151/256)
+data8 0x3FDDEE2F3445E4AF //ln(1/frcpa(1+ 152/256)
+data8 0x3FDE148A1A2726CE //ln(1/frcpa(1+ 153/256)
+data8 0x3FDE3AFC0A49FF40 //ln(1/frcpa(1+ 154/256)
+data8 0x3FDE6185206D516E //ln(1/frcpa(1+ 155/256)
+data8 0x3FDE882578823D52 //ln(1/frcpa(1+ 156/256)
+data8 0x3FDEAEDD2EAC990C //ln(1/frcpa(1+ 157/256)
+data8 0x3FDED5AC5F436BE3 //ln(1/frcpa(1+ 158/256)
+data8 0x3FDEFC9326D16AB9 //ln(1/frcpa(1+ 159/256)
+data8 0x3FDF2391A2157600 //ln(1/frcpa(1+ 160/256)
+data8 0x3FDF4AA7EE03192D //ln(1/frcpa(1+ 161/256)
+data8 0x3FDF71D627C30BB0 //ln(1/frcpa(1+ 162/256)
+data8 0x3FDF991C6CB3B379 //ln(1/frcpa(1+ 163/256)
+data8 0x3FDFC07ADA69A910 //ln(1/frcpa(1+ 164/256)
+data8 0x3FDFE7F18EB03D3E //ln(1/frcpa(1+ 165/256)
+data8 0x3FE007C053C5002E //ln(1/frcpa(1+ 166/256)
+data8 0x3FE01B942198A5A1 //ln(1/frcpa(1+ 167/256)
+data8 0x3FE02F74400C64EB //ln(1/frcpa(1+ 168/256)
+data8 0x3FE04360BE7603AD //ln(1/frcpa(1+ 169/256)
+data8 0x3FE05759AC47FE34 //ln(1/frcpa(1+ 170/256)
+data8 0x3FE06B5F1911CF52 //ln(1/frcpa(1+ 171/256)
+data8 0x3FE078BF0533C568 //ln(1/frcpa(1+ 172/256)
+data8 0x3FE08CD9687E7B0E //ln(1/frcpa(1+ 173/256)
+data8 0x3FE0A10074CF9019 //ln(1/frcpa(1+ 174/256)
+data8 0x3FE0B5343A234477 //ln(1/frcpa(1+ 175/256)
+data8 0x3FE0C974C89431CE //ln(1/frcpa(1+ 176/256)
+data8 0x3FE0DDC2305B9886 //ln(1/frcpa(1+ 177/256)
+data8 0x3FE0EB524BAFC918 //ln(1/frcpa(1+ 178/256)
+data8 0x3FE0FFB54213A476 //ln(1/frcpa(1+ 179/256)
+data8 0x3FE114253DA97D9F //ln(1/frcpa(1+ 180/256)
+data8 0x3FE128A24F1D9AFF //ln(1/frcpa(1+ 181/256)
+data8 0x3FE1365252BF0865 //ln(1/frcpa(1+ 182/256)
+data8 0x3FE14AE558B4A92D //ln(1/frcpa(1+ 183/256)
+data8 0x3FE15F85A19C765B //ln(1/frcpa(1+ 184/256)
+data8 0x3FE16D4D38C119FA //ln(1/frcpa(1+ 185/256)
+data8 0x3FE18203C20DD133 //ln(1/frcpa(1+ 186/256)
+data8 0x3FE196C7BC4B1F3B //ln(1/frcpa(1+ 187/256)
+data8 0x3FE1A4A738B7A33C //ln(1/frcpa(1+ 188/256)
+data8 0x3FE1B981C0C9653D //ln(1/frcpa(1+ 189/256)
+data8 0x3FE1CE69E8BB106B //ln(1/frcpa(1+ 190/256)
+data8 0x3FE1DC619DE06944 //ln(1/frcpa(1+ 191/256)
+data8 0x3FE1F160A2AD0DA4 //ln(1/frcpa(1+ 192/256)
+data8 0x3FE2066D7740737E //ln(1/frcpa(1+ 193/256)
+data8 0x3FE2147DBA47A394 //ln(1/frcpa(1+ 194/256)
+data8 0x3FE229A1BC5EBAC3 //ln(1/frcpa(1+ 195/256)
+data8 0x3FE237C1841A502E //ln(1/frcpa(1+ 196/256)
+data8 0x3FE24CFCE6F80D9A //ln(1/frcpa(1+ 197/256)
+data8 0x3FE25B2C55CD5762 //ln(1/frcpa(1+ 198/256)
+data8 0x3FE2707F4D5F7C41 //ln(1/frcpa(1+ 199/256)
+data8 0x3FE285E0842CA384 //ln(1/frcpa(1+ 200/256)
+data8 0x3FE294294708B773 //ln(1/frcpa(1+ 201/256)
+data8 0x3FE2A9A2670AFF0C //ln(1/frcpa(1+ 202/256)
+data8 0x3FE2B7FB2C8D1CC1 //ln(1/frcpa(1+ 203/256)
+data8 0x3FE2C65A6395F5F5 //ln(1/frcpa(1+ 204/256)
+data8 0x3FE2DBF557B0DF43 //ln(1/frcpa(1+ 205/256)
+data8 0x3FE2EA64C3F97655 //ln(1/frcpa(1+ 206/256)
+data8 0x3FE3001823684D73 //ln(1/frcpa(1+ 207/256)
+data8 0x3FE30E97E9A8B5CD //ln(1/frcpa(1+ 208/256)
+data8 0x3FE32463EBDD34EA //ln(1/frcpa(1+ 209/256)
+data8 0x3FE332F4314AD796 //ln(1/frcpa(1+ 210/256)
+data8 0x3FE348D90E7464D0 //ln(1/frcpa(1+ 211/256)
+data8 0x3FE35779F8C43D6E //ln(1/frcpa(1+ 212/256)
+data8 0x3FE36621961A6A99 //ln(1/frcpa(1+ 213/256)
+data8 0x3FE37C299F3C366A //ln(1/frcpa(1+ 214/256)
+data8 0x3FE38AE2171976E7 //ln(1/frcpa(1+ 215/256)
+data8 0x3FE399A157A603E7 //ln(1/frcpa(1+ 216/256)
+data8 0x3FE3AFCCFE77B9D1 //ln(1/frcpa(1+ 217/256)
+data8 0x3FE3BE9D503533B5 //ln(1/frcpa(1+ 218/256)
+data8 0x3FE3CD7480B4A8A3 //ln(1/frcpa(1+ 219/256)
+data8 0x3FE3E3C43918F76C //ln(1/frcpa(1+ 220/256)
+data8 0x3FE3F2ACB27ED6C7 //ln(1/frcpa(1+ 221/256)
+data8 0x3FE4019C2125CA93 //ln(1/frcpa(1+ 222/256)
+data8 0x3FE4181061389722 //ln(1/frcpa(1+ 223/256)
+data8 0x3FE42711518DF545 //ln(1/frcpa(1+ 224/256)
+data8 0x3FE436194E12B6BF //ln(1/frcpa(1+ 225/256)
+data8 0x3FE445285D68EA69 //ln(1/frcpa(1+ 226/256)
+data8 0x3FE45BCC464C893A //ln(1/frcpa(1+ 227/256)
+data8 0x3FE46AED21F117FC //ln(1/frcpa(1+ 228/256)
+data8 0x3FE47A1527E8A2D3 //ln(1/frcpa(1+ 229/256)
+data8 0x3FE489445EFFFCCC //ln(1/frcpa(1+ 230/256)
+data8 0x3FE4A018BCB69835 //ln(1/frcpa(1+ 231/256)
+data8 0x3FE4AF5A0C9D65D7 //ln(1/frcpa(1+ 232/256)
+data8 0x3FE4BEA2A5BDBE87 //ln(1/frcpa(1+ 233/256)
+data8 0x3FE4CDF28F10AC46 //ln(1/frcpa(1+ 234/256)
+data8 0x3FE4DD49CF994058 //ln(1/frcpa(1+ 235/256)
+data8 0x3FE4ECA86E64A684 //ln(1/frcpa(1+ 236/256)
+data8 0x3FE503C43CD8EB68 //ln(1/frcpa(1+ 237/256)
+data8 0x3FE513356667FC57 //ln(1/frcpa(1+ 238/256)
+data8 0x3FE522AE0738A3D8 //ln(1/frcpa(1+ 239/256)
+data8 0x3FE5322E26867857 //ln(1/frcpa(1+ 240/256)
+data8 0x3FE541B5CB979809 //ln(1/frcpa(1+ 241/256)
+data8 0x3FE55144FDBCBD62 //ln(1/frcpa(1+ 242/256)
+data8 0x3FE560DBC45153C7 //ln(1/frcpa(1+ 243/256)
+data8 0x3FE5707A26BB8C66 //ln(1/frcpa(1+ 244/256)
+data8 0x3FE587F60ED5B900 //ln(1/frcpa(1+ 245/256)
+data8 0x3FE597A7977C8F31 //ln(1/frcpa(1+ 246/256)
+data8 0x3FE5A760D634BB8B //ln(1/frcpa(1+ 247/256)
+data8 0x3FE5B721D295F10F //ln(1/frcpa(1+ 248/256)
+data8 0x3FE5C6EA94431EF9 //ln(1/frcpa(1+ 249/256)
+data8 0x3FE5D6BB22EA86F6 //ln(1/frcpa(1+ 250/256)
+data8 0x3FE5E6938645D390 //ln(1/frcpa(1+ 251/256)
+data8 0x3FE5F673C61A2ED2 //ln(1/frcpa(1+ 252/256)
+data8 0x3FE6065BEA385926 //ln(1/frcpa(1+ 253/256)
+data8 0x3FE6164BFA7CC06B //ln(1/frcpa(1+ 254/256)
+data8 0x3FE62643FECF9743 //ln(1/frcpa(1+ 255/256)
+//
+// [2;4)
+data8 0xBEB2CC7A38B9355F,0x3F035F2D1833BF4C // A10,A9
+data8 0xBFF51BAA7FD27785,0x3FFC9D5D5B6CDEFF // A2,A1
+data8 0xBF421676F9CB46C7,0x3F7437F2FA1436C6 // A8,A7
+data8 0xBFD7A7041DE592FE,0x3FE9F107FEE8BD29 // A4,A3
+// [4;8)
+data8 0x3F6BBBD68451C0CD,0xBF966EC3272A16F7 // A10,A9
+data8 0x40022A24A39AD769,0x4014190EDF49C8C5 // A2,A1
+data8 0x3FB130FD016EE241,0xBFC151B46E635248 // A8,A7
+data8 0x3FDE8F611965B5FE,0xBFEB5110EB265E3D // A4,A3
+// [8;16)
+data8 0x3F736EF93508626A,0xBF9FE5DBADF58AF1 // A10,A9
+data8 0x40110A9FC5192058,0x40302008A6F96B29 // A2,A1
+data8 0x3FB8E74E0CE1E4B5,0xBFC9B5DA78873656 // A8,A7
+data8 0x3FE99D0DF10022DC,0xBFF829C0388F9484 // A4,A3
+// [16;32)
+data8 0x3F7FFF9D6D7E9269,0xBFAA780A249AEDB1 // A10,A9
+data8 0x402082A807AEA080,0x4045ED9868408013 // A2,A1
+data8 0x3FC4E1E54C2F99B7,0xBFD5DE2D6FFF1490 // A8,A7
+data8 0x3FF75FC89584AE87,0xC006B4BADD886CAE // A4,A3
+// [32;64)
+data8 0x3F8CE54375841A5F,0xBFB801ABCFFA1BE2 // A10,A9
+data8 0x403040A8B1815BDA,0x405B99A917D24B7A // A2,A1
+data8 0x3FD30CAB81BFFA03,0xBFE41AEF61ECF48B // A8,A7
+data8 0x400650CC136BEC43,0xC016022046E8292B // A4,A3
+// [64;128)
+data8 0x3F9B69BD22CAA8B8,0xBFC6D48875B7A213 // A10,A9
+data8 0x40402028CCAA2F6D,0x40709AACEB3CBE0F // A2,A1
+data8 0x3FE22C6A5924761E,0xBFF342F5F224523D // A8,A7
+data8 0x4015CD405CCA331F,0xC025AAD10482C769 // A4,A3
+// [128;256)
+data8 0x3FAAAD9CD0E40D06,0xBFD63FC8505D80CB // A10,A9
+data8 0x40501008D56C2648,0x408364794B0F4376 // A2,A1
+data8 0x3FF1BE0126E00284,0xC002D8E3F6F7F7CA // A8,A7
+data8 0x40258C757E95D860,0xC0357FA8FD398011 // A4,A3
+// [256;512)
+data8 0x3FBA4DAC59D49FEB,0xBFE5F476D1C43A77 // A10,A9
+data8 0x40600800D890C7C6,0x40962C42AAEC8EF0 // A2,A1
+data8 0x40018680ECF19B89,0xC012A3EB96FB7BA4 // A8,A7
+data8 0x40356C4CDD3B60F9,0xC0456A34BF18F440 // A4,A3
+// [512;1024)
+data8 0x3FCA1B54F6225A5A,0xBFF5CD67BA10E048 // A10,A9
+data8 0x407003FED94C58C2,0x40A8F30B4ACBCD22 // A2,A1
+data8 0x40116A135EB66D8C,0xC022891B1CED527E // A8,A7
+data8 0x40455C4617FDD8BC,0xC0555F82729E59C4 // A4,A3
+// [1024;2048)
+data8 0x3FD9FFF9095C6EC9,0xC005B88CB25D76C9 // A10,A9
+data8 0x408001FE58FA734D,0x40BBB953BAABB0F3 // A2,A1
+data8 0x40215B2F9FEB5D87,0xC0327B539DEA5058 // A8,A7
+data8 0x40555444B3E8D64D,0xC0655A2B26F9FC8A // A4,A3
+// [2048;4096)
+data8 0x3FE9F065A1C3D6B1,0xC015ACF6FAE8D78D // A10,A9
+data8 0x409000FE383DD2B7,0x40CE7F5C1E8BCB8B // A2,A1
+data8 0x40315324E5DB2EBE,0xC04274194EF70D18 // A8,A7
+data8 0x4065504353FF2207,0xC075577FE1BFE7B6 // A4,A3
+// [4096;8192)
+data8 0x3FF9E6FBC6B1C70D,0xC025A62DAF76F85D // A10,A9
+data8 0x40A0007E2F61EBE8,0x40E0A2A23FB5F6C3 // A2,A1
+data8 0x40414E9BC0A0141A,0xC0527030F2B69D43 // A8,A7
+data8 0x40754E417717B45B,0xC085562A447258E5 // A4,A3
+//
+data8 0xbfdffffffffaea15 // P1
+data8 0x3FDD8B618D5AF8FE // point of local minimum on [1;2]
+data8 0x3FED67F1C864BEB5 // ln(sqrt(2*Pi))
+data8 0x4008000000000000 // 3.0
+//
+data8 0xBF9E1C289FB224AB,0x3FBF7422445C9460 // A6,A5
+data8 0xBFF01E76D66F8D8A // A0
+data8 0xBFE2788CFC6F91DA // A1 [1.0;1.25)
+data8 0x3FCB8CC69000EB5C,0xBFD41997A0C2C641 // A6,A5
+data8 0x3FFCAB0BFA0EA462 // A0
+data8 0xBFBF19B9BCC38A42 // A0 [1.25;1.5)
+data8 0x3FD51EE4DE0A364C,0xBFE00D7F98A16E4B // A6,A5
+data8 0x40210CE1F327E9E4 // A0
+data8 0x4001DB08F9DFA0CC // A0 [1.5;1.75)
+data8 0x3FE24F606742D252,0xBFEC81D7D12574EC // A6,A5
+data8 0x403BE636A63A9C27 // A0
+data8 0x4000A0CB38D6CF0A // A0 [1.75;2.0)
+data8 0x3FF1029A9DD542B4,0xBFFAD37C209D3B25 // A6,A5
+data8 0x405385E6FD9BE7EA // A0
+data8 0x478895F1C0000000 // Overflow boundary
+data8 0x400062D97D26B523,0xC00A03E1529FF023 // A6,A5
+data8 0x4069204C51E566CE // A0
+data8 0x0000000000000000 // pad
+data8 0x40101476B38FD501,0xC0199DE7B387C0FC // A6,A5
+data8 0x407EB8DAEC83D759 // A0
+data8 0x0000000000000000 // pad
+data8 0x401FDB008D65125A,0xC0296B506E665581 // A6,A5
+data8 0x409226D93107EF66 // A0
+data8 0x0000000000000000 // pad
+data8 0x402FB3EAAF3E7B2D,0xC039521142AD8E0D // A6,A5
+data8 0x40A4EFA4F072792E // A0
+data8 0x0000000000000000 // pad
+data8 0x403FA024C66B2563,0xC0494569F250E691 // A6,A5
+data8 0x40B7B747C9235BB8 // A0
+data8 0x0000000000000000 // pad
+data8 0x404F9607D6DA512C,0xC0593F0B2EDDB4BC // A6,A5
+data8 0x40CA7E29C5F16DE2 // A0
+data8 0x0000000000000000 // pad
+data8 0x405F90C5F613D98D,0xC0693BD130E50AAF // A6,A5
+data8 0x40DD4495238B190C // A0
+data8 0x0000000000000000 // pad
+//
+// polynomial approximation of ln(sin(Pi*x)/(Pi*x)), |x| <= 0.5
+data8 0xBFD58731A486E820,0xBFA4452CC28E15A9 // S16,S14
+data8 0xBFD013F6E1B86C4F,0xBFD5B3F19F7A341F // S8,S6
+data8 0xBFC86A0D5252E778,0xBFC93E08C9EE284B // S12,S10
+data8 0xBFE15132555C9EDD,0xBFFA51A662480E35 // S4,S2
+//
+// [1.0;1.25)
+data8 0xBFA697D6775F48EA,0x3FB9894B682A98E7 // A9,A8
+data8 0xBFCA8969253CFF55,0x3FD15124EFB35D9D // A5,A4
+data8 0xBFC1B00158AB719D,0x3FC5997D04E7F1C1 // A7,A6
+data8 0xBFD9A4D50BAFF989,0x3FEA51A661F5176A // A3,A2
+// [1.25;1.5)
+data8 0x3F838E0D35A6171A,0xBF831BBBD61313B7 // A8,A7
+data8 0x3FB08B40196425D0,0xBFC2E427A53EB830 // A4,A3
+data8 0x3F9285DDDC20D6C3,0xBFA0C90C9C223044 // A6,A5
+data8 0x3FDEF72BC8F5287C,0x3D890B3DAEBC1DFC // A2,A1
+// [1.5;1.75)
+data8 0x3F65D5A7EB31047F,0xBFA44EAC9BFA7FDE // A8,A7
+data8 0x40051FEFE7A663D8,0xC012A5CFE00A2522 // A4,A3
+data8 0x3FD0E1583AB00E08,0xBFF084AF95883BA5 // A6,A5
+data8 0x40185982877AE0A2,0xC015F83DB73B57B7 // A2,A1
+// [1.75;2.0)
+data8 0x3F4A9222032EB39A,0xBF8CBC9587EEA5A3 // A8,A7
+data8 0x3FF795400783BE49,0xC00851BC418B8A25 // A4,A3
+data8 0x3FBBC992783E8C5B,0xBFDFA67E65E89B29 // A6,A5
+data8 0x4012B408F02FAF88,0xC013284CE7CB0C39 // A2,A1
+//
+// roots
+data8 0xC003A7FC9600F86C // -2.4570247382208005860
+data8 0xC009260DBC9E59AF // -3.1435808883499798405
+data8 0xC005FB410A1BD901 // -2.7476826467274126919
+data8 0xC00FA471547C2FE5 // -3.9552942848585979085
+//
+// polynomial approximation of ln(GAMMA(x)) near roots
+// near -2.4570247382208005860
+data8 0x3FF694A6058D9592,0x40136EEBB003A92B // R3,R2
+data8 0x3FF83FE966AF5360,0x3C90323B6D1FE86D // R1,R0
+// near -3.1435808883499798405
+data8 0x405C11371268DA38,0x4039D4D2977D2C23 // R3,R2
+data8 0x401F20A65F2FAC62,0x3CDE9605E3AE7A62 // R1,R0
+// near -2.7476826467274126919
+data8 0xC034185AC31314FF,0x4023267F3C28DFE3 // R3,R2
+data8 0xBFFEA12DA904B194,0x3CA8FB8530BA7689 // R1,R0
+// near -2.7476826467274126919
+data8 0xC0AD25359E70C888,0x406F76DEAEA1B8C6 // R3,R2
+data8 0xC034B99D966C5644,0xBCBDDC0336980B58 // R1,R0
+LOCAL_OBJECT_END(lgammaf_data)
+
+//*********************************************************************
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_lgammaf)
+{ .mfi
+      getf.exp      GR_SignExp = f8
+      frcpa.s1      FR_InvX,p0 = f1,f8
+      mov           GR_ExpOf2 = 0x10000
+}
+{ .mfi
+      addl          GR_ad_Data = @ltoff(lgammaf_data),gp
+      fcvt.fx.s1    FR_int_N = f8
+      mov           GR_ExpMask = 0x1ffff
+};;
+{ .mfi
+      getf.sig      GR_Sig = f8
+      fclass.m      p13,p0 = f8,0x1EF // is x NaTVal, NaN,
+                                      // +/-0, +/-INF or +/-deno?
+      mov           GR_ExpBias = 0xffff
+}
+{ .mfi
+      ld8           GR_ad_Data = [GR_ad_Data]
+      fma.s1        FR_Xp1 = f8,f1,f1
+      mov           GR_StirlBound = 0x1000C
+};;
+{ .mfi
+      setf.exp      FR_2 = GR_ExpOf2
+      fmerge.se     FR_x = f1,f8
+      dep.z         GR_Ind = GR_SignExp,3,4
+}
+{ .mfi
+      cmp.eq        p8,p0 = GR_SignExp,GR_ExpBias
+      fcvt.fx.trunc.s1 FR_int_Ntrunc = f8
+      and           GR_Exp = GR_ExpMask,GR_SignExp
+};;
+{ .mfi
+      add           GR_ad_C650 = 0xB20,GR_ad_Data
+      fcmp.lt.s1    p14,p15 = f8,f0
+      extr.u        GR_Ind4T = GR_Sig,55,8
+}
+{ .mfb
+      sub           GR_PureExp = GR_Exp,GR_ExpBias
+      fnorm.s1      FR_NormX = f8
+      // jump if x is NaTVal, NaN, +/-0, +/-INF or +/-deno
+(p13) br.cond.spnt  lgammaf_spec
+};;
+lgammaf_core:
+{ .mfi
+      ldfpd         FR_P1,FR_LocalMin = [GR_ad_C650],16
+      fms.s1        FR_xm2 = f8,f1,f1
+      add           GR_ad_Co = 0x820,GR_ad_Data
+}
+{ .mib
+      ldfpd         FR_P3,FR_P2 = [GR_ad_Data],16
+      cmp.ltu       p9,p0 = GR_SignExp,GR_ExpBias
+      // jump if x is from the interval [1; 2)
+(p8)  br.cond.spnt  lgammaf_1_2
+};;
+{ .mfi
+      setf.sig      FR_int_Ln = GR_PureExp
+      fms.s1        FR_r = FR_InvX,f8,f1
+      shladd        GR_ad_Co = GR_Ind,3,GR_ad_Co
+}
+{ .mib
+      ldfpd         FR_LnSqrt2Pi,FR_3 = [GR_ad_C650],16
+      cmp.lt        p13,p12 = GR_Exp,GR_StirlBound
+      // jump if x is from the interval (0; 1)
+(p9)  br.cond.spnt  lgammaf_0_1
+};;
+{ .mfi
+      ldfpd         FR_Ln2,FR_05 = [GR_ad_Data],16
+      fma.s1        FR_Xp2 = f1,f1,FR_Xp1 // (x+2)
+      shladd        GR_ad_C650 = GR_Ind,2,GR_ad_C650
+}
+{ .mfi
+      add           GR_ad_Ce = 0x20,GR_ad_Co
+      nop.f         0
+      add           GR_ad_C43 = 0x30,GR_ad_Co
+};;
+{ .mfi
+      // load coefficients of polynomial approximation
+      // of ln(GAMMA(x)), 2 <= x < 2^13
+(p13) ldfpd         FR_A10,FR_A9 = [GR_ad_Co],16
+      fcvt.xf       FR_N = FR_int_N
+      cmp.eq.unc    p6,p7 = GR_ExpOf2,GR_SignExp
+}
+{ .mib
+(p13) ldfpd         FR_A8,FR_A7 = [GR_ad_Ce]
+(p14) cmp.le.unc    p9,p0 = GR_StirlBound,GR_Exp
+      // jump if x is less or equal to -2^13
+(p9)  br.cond.spnt  lgammaf_negstirling
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+(p13) ldfpd         FR_A6,FR_A5 = [GR_ad_C650],16
+(p6)  fma.s1        FR_x = f0,f0,FR_NormX
+      shladd        GR_ad_T = GR_Ind4T,3,GR_ad_Data
+}
+{ .mfi
+(p13) ldfpd         FR_A4,FR_A3 = [GR_ad_C43]
+(p7)  fms.s1        FR_x = FR_x,f1,f1
+(p14) mov           GR_ReqBound = 0x20005
+};;
+{ .mfi
+(p13) ldfpd         FR_A2,FR_A1 = [GR_ad_Co],16
+      fms.s1        FR_xm2 = FR_xm2,f1,f1
+(p14) extr.u        GR_Arg = GR_Sig,60,4
+}
+{ .mfi
+      mov           GR_SignOfGamma = 1 // set sign of gamma(x) to 1
+      fcvt.xf       FR_Ntrunc = FR_int_Ntrunc
+      nop.i         0
+};;
+{ .mfi
+      ldfd          FR_T = [GR_ad_T]
+      fma.s1        FR_r2 = FR_r,FR_r,f0
+      shl           GR_ReqBound = GR_ReqBound,3
+}
+{ .mfi
+      add           GR_ad_Co = 0xCA0,GR_ad_Data
+      fnma.s1       FR_Req = FR_Xp1,FR_NormX,f0 // -x*(x+1)
+(p14) shladd        GR_Arg = GR_Exp,4,GR_Arg
+};;
+{ .mfi
+(p13) ldfd          FR_A0 = [GR_ad_C650]
+      fma.s1        FR_Xp3 = FR_2,f1,FR_Xp1 // (x+3)
+(p14) cmp.le.unc    p9,p0 = GR_Arg,GR_ReqBound
+}
+{ .mfi
+(p14) add           GR_ad_Ce = 0x20,GR_ad_Co
+      fma.s1        FR_Xp4 = FR_2,FR_2,FR_NormX // (x+4)
+(p15) add           GR_ad_OvfBound = 0xBB8,GR_ad_Data
+};;
+{ .mfi
+      // load coefficients of polynomial approximation
+      // of ln(sin(Pi*xf)/(Pi*xf)), |xf| <= 0.5
+(p14) ldfpd         FR_S16,FR_S14 = [GR_ad_Co],16
+(p14) fms.s1        FR_Xf = FR_NormX,f1,FR_N  // xf = x - [x]
+(p14) sub           GR_SignOfGamma = r0,GR_SignOfGamma // set sign of
+                                                       // gamma(x) to -1
+}
+{ .mfb
+(p14) ldfpd         FR_S12,FR_S10 = [GR_ad_Ce],16
+      fma.s1        FR_Xp5 = FR_2,FR_2,FR_Xp1 // (x+5)
+      // jump if x is from the interval (-9; 0)
+(p9)  br.cond.spnt  lgammaf_negrecursion
+};;
+{ .mfi
+(p14) ldfpd         FR_S8,FR_S6 = [GR_ad_Co],16
+      fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+}
+{ .mfb
+(p14) ldfpd         FR_S4,FR_S2 = [GR_ad_Ce],16
+      fma.s1        FR_x2 = FR_x,FR_x,f0
+      // jump if x is from the interval (-2^13; -9)
+(p14) br.cond.spnt  lgammaf_negpoly
+};;
+{ .mfi
+      ldfd          FR_OverflowBound = [GR_ad_OvfBound]
+(p12) fcvt.xf       FR_N = FR_int_Ln
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+}
+{ .mfi
+      nop.m         0
+(p12) fma.s1        FR_P10 = FR_P1,FR_r,f1
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+.pred.rel "mutex",p9,p10
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4           [r33] = GR_SignOfGamma
+(p6)  fma.s1        FR_xx = FR_x,FR_xm2,f0
+      nop.i         0
+}
+{ .mfi
+      // store sign of gamma(x) as 64-bit int
+(p10) st8           [r33] = GR_SignOfGamma
+(p7)  fma.s1        FR_xx = f0,f0,FR_x
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A9 = FR_A10,FR_x,FR_A9
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A7 = FR_A8,FR_x,FR_A7
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A5 = FR_A6,FR_x,FR_A5
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A3 = FR_A4,FR_x,FR_A3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p15) fcmp.eq.unc.s1 p8,p0 = FR_NormX,FR_2 // is input argument 2.0?
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A1 = FR_A2,FR_x,FR_A1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p12) fma.s1        FR_T = FR_N,FR_Ln2,FR_T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p12) fma.s1        FR_P32 = FR_P32,FR_r2,FR_P10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_x4 = FR_x2,FR_x2,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_x3 = FR_x2,FR_xx,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A7 = FR_A9,FR_x2,FR_A7
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p8)  fma.s.s0      f8 = f0,f0,f0
+(p8)  br.ret.spnt   b0 // fast exit for 2.0
+};;
+{ .mfi
+      nop.m         0
+(p6)  fma.s1        FR_A0 = FR_A0,FR_xm2,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A3 = FR_A5,FR_x2,FR_A3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p15) fcmp.le.unc.s1 p8,p0 = FR_OverflowBound,FR_NormX // overflow test
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p12) fms.s1        FR_xm05 = FR_NormX,f1,FR_05
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p12) fma.s1        FR_Ln = FR_P32,FR_r,FR_T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p12) fms.s1        FR_LnSqrt2Pi = FR_LnSqrt2Pi,f1,FR_NormX
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_A0 = FR_A1,FR_xx,FR_A0
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p13) fma.s1        FR_A3 = FR_A7,FR_x4,FR_A3
+      // jump if result overflows
+(p8)  br.cond.spnt  lgammaf_overflow
+};;
+.pred.rel "mutex",p12,p13
+{ .mfi
+      nop.m         0
+(p12) fma.s.s0      f8 = FR_Ln,FR_xm05,FR_LnSqrt2Pi
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p13) fma.s.s0      f8 = FR_A3,FR_x3,FR_A0
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) for 0 < x < 1
+//---------------------------------------------------------------------
+.align 32
+lgammaf_0_1:
+{ .mfi
+      getf.sig      GR_Ind = FR_Xp1
+      fma.s1        FR_r2 = FR_r,FR_r,f0
+      mov           GR_fff7 = 0xFFF7
+}
+{ .mfi
+      ldfpd         FR_Ln2,FR_05 = [GR_ad_Data],16
+      fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      // input argument cann't be equal to 1.0
+      cmp.eq        p0,p14 = r0,r0
+};;
+{ .mfi
+      getf.exp      GR_Exp = FR_w
+      fcvt.xf       FR_N = FR_int_Ln
+      add           GR_ad_Co = 0xCE0,GR_ad_Data
+}
+{ .mfi
+      shladd        GR_ad_T = GR_Ind4T,3,GR_ad_Data
+      fma.s1        FR_P10 = FR_P1,FR_r,f1
+      add           GR_ad_Ce = 0xD00,GR_ad_Data
+};;
+{ .mfi
+      ldfd          FR_T = [GR_ad_T]
+      fma.s1        FR_w2 = FR_w,FR_w,f0
+      extr.u        GR_Ind = GR_Ind,61,2
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Q32 = FR_P3,FR_w,FR_P2
+////      add           GR_ad_C0 = 0xB30,GR_ad_Data
+      add           GR_ad_C0 = 0xB38,GR_ad_Data
+};;
+{ .mfi
+      and           GR_Exp = GR_Exp,GR_ExpMask
+      nop.f         0
+      shladd        GR_IndX8 = GR_Ind,3,r0
+}
+{ .mfi
+      shladd        GR_IndX2 = GR_Ind,1,r0
+      fma.s1        FR_Q10 = FR_P1,FR_w,f1
+      cmp.eq        p6,p15 = 0,GR_Ind
+};;
+{ .mfi
+      shladd        GR_ad_Co = GR_IndX8,3,GR_ad_Co
+(p6)  fma.s1        FR_x = f0,f0,FR_NormX
+      shladd        GR_ad_C0 = GR_IndX2,4,GR_ad_C0
+}
+{ .mfi
+      shladd        GR_ad_Ce = GR_IndX8,3,GR_ad_Ce
+      nop.f         0
+(p15) cmp.eq.unc    p7,p8 = 1,GR_Ind
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+      ldfpd         FR_A8,FR_A7 = [GR_ad_Co],16
+(p7)  fms.s1        FR_x = FR_NormX,f1,FR_LocalMin
+      cmp.ge        p10,p11 = GR_Exp,GR_fff7
+}
+{ .mfb
+      ldfpd         FR_A6,FR_A5 = [GR_ad_Ce],16
+(p8)  fma.s1        FR_x = f1,f1,FR_NormX
+      br.cond.sptk  lgamma_0_2_core
+};;
+// branch for calculating of ln(GAMMA(x)) for 1 <= x < 2
+//---------------------------------------------------------------------
+.align 32
+lgammaf_1_2:
+{ .mfi
+      add           GR_ad_Co = 0xCF0,GR_ad_Data
+      fcmp.eq.s1    p14,p0 = f1,FR_NormX // is input argument 1.0?
+      extr.u        GR_Ind = GR_Sig,61,2
+}
+{ .mfi
+      add           GR_ad_Ce = 0xD10,GR_ad_Data
+      nop.f         0
+////      add           GR_ad_C0 = 0xB40,GR_ad_Data
+      add           GR_ad_C0 = 0xB48,GR_ad_Data
+};;
+{ .mfi
+      shladd        GR_IndX8 = GR_Ind,3,r0
+      nop.f         0
+      shladd        GR_IndX2 = GR_Ind,1,r0
+}
+{ .mfi
+      cmp.eq        p6,p15 = 0,GR_Ind // p6 <- x from [1;1.25)
+      nop.f         0
+      cmp.ne        p9,p0 = r0,r0
+};;
+{ .mfi
+      shladd        GR_ad_Co = GR_IndX8,3,GR_ad_Co
+(p6)  fms.s1        FR_x = FR_NormX,f1,f1 // reduced x for [1;1.25)
+      shladd        GR_ad_C0 = GR_IndX2,4,GR_ad_C0
+}
+{ .mfi
+      shladd        GR_ad_Ce = GR_IndX8,3,GR_ad_Ce
+(p14) fma.s.s0      f8 = f0,f0,f0
+(p15) cmp.eq.unc    p7,p8 = 1,GR_Ind // p7 <- x from [1.25;1.5)
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+      ldfpd         FR_A8,FR_A7 = [GR_ad_Co],16
+(p7)  fms.s1        FR_x = FR_xm2,f1,FR_LocalMin
+      nop.i         0
+}
+{ .mfi
+      ldfpd         FR_A6,FR_A5 = [GR_ad_Ce],16
+(p8)  fma.s1        FR_x = f0,f0,FR_NormX
+(p9)  cmp.eq.unc    p10,p11 = r0,r0
+};;
+lgamma_0_2_core:
+{ .mmi
+      ldfpd         FR_A4,FR_A3 = [GR_ad_Co],16
+      ldfpd         FR_A2,FR_A1 = [GR_ad_Ce],16
+      mov           GR_SignOfGamma = 1 // set sign of gamma(x) to 1
+};;
+{ .mfi
+//      add           GR_ad_C0 = 8,GR_ad_C0
+      ldfd          FR_A0 = [GR_ad_C0]
+      nop.f         0
+      // set p13 if signgum is 32-bit int
+      // set p15 if signgum is 64-bit int
+      cmp.eq        p15,p13 = 8,r34
+};;
+.pred.rel "mutex",p13,p15
+{ .mmf
+      // store sign of gamma(x)
+(p13) st4           [r33] = GR_SignOfGamma // as 32-bit int
+(p15) st8           [r33] = GR_SignOfGamma // as 64-bit int
+(p11) fma.s1        FR_Q32 = FR_Q32,FR_w2,FR_Q10
+};;
+{ .mfb
+      nop.m         0
+(p10) fma.s1        FR_P32 = FR_P32,FR_r2,FR_P10
+(p14) br.ret.spnt   b0 // fast exit for 1.0
+};;
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_T = FR_N,FR_Ln2,FR_T
+      cmp.eq        p6,p7 = 0,GR_Ind // p6 <- x from [1;1.25)
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x2 = FR_x,FR_x,f0
+      cmp.eq        p8,p0 = r0,r0 // set p8 to 1 that means we on [1;2]
+};;
+{ .mfi
+      nop.m         0
+(p11) fma.s1        FR_Ln = FR_Q32,FR_w,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      nop.f         0
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fma.s1        FR_xx = f0,f0,FR_x
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p7)  fma.s1        FR_xx = f0,f0,f1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A8,FR_x,FR_A7
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A5 = FR_A6,FR_x,FR_A5
+(p9)  cmp.ne        p8,p0 = r0,r0 // set p8 to 0 that means we on [0;1]
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A4,FR_x,FR_A3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A1 = FR_A2,FR_x,FR_A1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x4 = FR_x2,FR_x2,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_Ln = FR_P32,FR_r,FR_T
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A5 = FR_A7,FR_x2,FR_A5
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A1 = FR_A3,FR_x2,FR_A1
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p8
+{ .mfi
+      nop.m         0
+(p9)  fms.d.s1      FR_A0 = FR_A0,FR_xx,FR_Ln
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p8)  fms.s1        FR_A0 = FR_A0,FR_xx,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.d.s1      FR_A1 = FR_A5,FR_x4,FR_A1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      nop.f         0
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fma.s.s0      f8 = FR_A1,FR_x2,FR_A0
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p7)  fma.s.s0      f8 = FR_A1,FR_x,FR_A0
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) for -9 < x < 1
+//---------------------------------------------------------------------
+.align 32
+lgammaf_negrecursion:
+{ .mfi
+      getf.sig      GR_N = FR_int_Ntrunc
+      fms.s1        FR_1pXf = FR_Xp2,f1,FR_Ntrunc // 1 + (x+1) - [x]
+      mov           GR_Neg2 = 2
+}
+{ .mfi
+      add           GR_ad_Co = 0xCE0,GR_ad_Data
+      fms.s1        FR_Xf = FR_Xp1,f1,FR_Ntrunc // (x+1) - [x]
+      mov           GR_Neg4 = 4
+};;
+{ .mfi
+      add           GR_ad_Ce = 0xD00,GR_ad_Data
+      fma.s1        FR_Xp6 = FR_2,FR_2,FR_Xp2 // (x+6)
+      add           GR_ad_C0 = 0xB30,GR_ad_Data
+}
+{ .mfi
+      sub           GR_Neg2 = r0,GR_Neg2
+      fma.s1        FR_Xp7 = FR_2,FR_3,FR_Xp1 // (x+7)
+      sub           GR_Neg4 = r0,GR_Neg4
+};;
+{ .mfi
+      cmp.ne        p8,p0 = r0,GR_N
+      fcmp.eq.s1    p13,p0 = FR_NormX,FR_Ntrunc
+      and           GR_IntNum = 0xF,GR_N
+}
+{ .mfi
+      cmp.lt        p6,p0 = GR_N,GR_Neg2
+      fma.s1        FR_Xp8 = FR_2,FR_3,FR_Xp2 // (x+8)
+      cmp.lt        p7,p0 = GR_N,GR_Neg4
+};;
+{ .mfi
+      getf.d        GR_Arg = FR_NormX
+(p6)  fma.s1        FR_Xp2 = FR_Xp2,FR_Xp3,f0
+(p8)  tbit.z.unc    p14,p15 = GR_IntNum,0
+}
+{ .mfi
+      sub           GR_RootInd = 0xE,GR_IntNum
+(p7)  fma.s1        FR_Xp4 = FR_Xp4,FR_Xp5,f0
+      add           GR_ad_Root = 0xDE0,GR_ad_Data
+};;
+{ .mfi
+      shladd        GR_ad_Root = GR_RootInd,3,GR_ad_Root
+      fms.s1        FR_x = FR_Xp1,f1,FR_Ntrunc // (x+1) - [x]
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+      nop.f         0
+(p13) br.cond.spnt  lgammaf_singularity
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      cmp.gt        p6,p0 = 0xA,GR_IntNum
+(p14) fma.s1        FR_Req = FR_Req,FR_Xf,f0
+      cmp.gt        p7,p0 = 0xD,GR_IntNum
+}
+{ .mfi
+(p15) mov           GR_SignOfGamma = 1 // set sign of gamma(x) to 1
+(p15) fnma.s1       FR_Req = FR_Req,FR_Xf,f0
+      cmp.leu       p0,p13 = 2,GR_RootInd
+};;
+{ .mfi
+      nop.m         0
+(p6)  fma.s1        FR_Xp6 = FR_Xp6,FR_Xp7,f0
+(p13) add           GR_ad_RootCo = 0xE00,GR_ad_Data
+};;
+{ .mfi
+      nop.m         0
+      fcmp.eq.s1    p12,p11 = FR_1pXf,FR_2
+      nop.i         0
+};;
+{ .mfi
+      getf.sig      GR_Sig = FR_1pXf
+      fcmp.le.s1    p9,p0 = FR_05,FR_Xf
+      nop.i         0
+}
+{ .mfi
+(p13) shladd        GR_RootInd = GR_RootInd,4,r0
+(p7)  fma.s1        FR_Xp2 = FR_Xp2,FR_Xp4,f0
+(p8)  cmp.gt.unc    p10,p0 = 0x9,GR_IntNum
+};;
+.pred.rel "mutex",p11,p12
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_Req = FR_Req,FR_Xp8,f0
+(p11) extr.u        GR_Ind = GR_Sig,61,2
+}
+{ .mfi
+(p13) add           GR_RootInd = GR_RootInd,GR_RootInd
+      nop.f         0
+(p12) mov           GR_Ind = 3
+};;
+{ .mfi
+      shladd        GR_IndX2 = GR_Ind,1,r0
+      nop.f         0
+      cmp.gt        p14,p0 = 2,GR_Ind
+}
+{ .mfi
+      shladd        GR_IndX8 = GR_Ind,3,r0
+      nop.f         0
+      cmp.eq        p6,p0 = 1,GR_Ind
+};;
+.pred.rel "mutex",p6,p9
+{ .mfi
+      shladd        GR_ad_Co = GR_IndX8,3,GR_ad_Co
+(p6)  fms.s1        FR_x = FR_Xf,f1,FR_LocalMin
+      cmp.gt        p10,p0 = 0xB,GR_IntNum
+}
+{ .mfi
+      shladd        GR_ad_Ce = GR_IndX8,3,GR_ad_Ce
+(p9)  fma.s1        FR_x = f0,f0,FR_1pXf
+      shladd        GR_ad_C0 = GR_IndX2,4,GR_ad_C0
+};;
+{ .mfi
+      // load coefficients of polynomial approximation
+      // of ln(GAMMA(x)), 1 <= x < 2
+      ldfpd         FR_A8,FR_A7 = [GR_ad_Co],16
+(p10) fma.s1        FR_Xp2 = FR_Xp2,FR_Xp6,f0
+      add           GR_ad_C0 = 8,GR_ad_C0
+}
+{ .mfi
+      ldfpd         FR_A6,FR_A5 = [GR_ad_Ce],16
+      nop.f         0
+(p14) add           GR_ad_Root = 0x10,GR_ad_Root
+};;
+{ .mfi
+      ldfpd         FR_A4,FR_A3 = [GR_ad_Co],16
+      nop.f         0
+      add           GR_ad_RootCe = 0xE10,GR_ad_Data
+}
+{ .mfi
+      ldfpd         FR_A2,FR_A1 = [GR_ad_Ce],16
+      nop.f         0
+(p14) add           GR_RootInd = 0x40,GR_RootInd
+};;
+{ .mmi
+      ldfd          FR_A0 = [GR_ad_C0]
+(p13) add           GR_ad_RootCo = GR_ad_RootCo,GR_RootInd
+(p13) add           GR_ad_RootCe = GR_ad_RootCe,GR_RootInd
+};;
+{ .mmi
+(p13) ld8           GR_Root = [GR_ad_Root]
+(p13) ldfd          FR_Root = [GR_ad_Root]
+      mov           GR_ExpBias = 0xffff
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x2 = FR_x,FR_x,f0
+      nop.i         0
+}
+{ .mlx
+(p8)  cmp.gt.unc    p10,p0 = 0xF,GR_IntNum
+      movl          GR_Dx = 0x000000014F8B588E
+};;
+{ .mfi
+      // load coefficients of polynomial approximation
+      // of ln(GAMMA(x)), x is close to one of negative roots
+(p13) ldfpd         FR_R3,FR_R2 = [GR_ad_RootCo]
+      // argumenth for logarithm
+(p10) fma.s1        FR_Req = FR_Req,FR_Xp2,f0
+      mov           GR_ExpMask = 0x1ffff
+}
+{ .mfi
+(p13) ldfpd         FR_R1,FR_R0 = [GR_ad_RootCe]
+      nop.f         0
+      // set p9 if signgum is 32-bit int
+      // set p8 if signgum is 64-bit int
+      cmp.eq        p8,p9 = 8,r34
+};;
+.pred.rel "mutex",p9,p8
+{ .mfi
+(p9)  st4           [r33] = GR_SignOfGamma // as 32-bit int
+      fma.s1        FR_A7 = FR_A8,FR_x,FR_A7
+(p13) sub           GR_Root = GR_Arg,GR_Root
+}
+{ .mfi
+(p8)  st8           [r33] = GR_SignOfGamma // as 64-bit int
+      fma.s1        FR_A5 = FR_A6,FR_x,FR_A5
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_w = FR_Req,f1,f1
+(p13) add           GR_Root = GR_Root,GR_Dx
+}
+{ .mfi
+      nop.m         0
+      nop.f         0
+(p13) add           GR_2xDx = GR_Dx,GR_Dx
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A4,FR_x,FR_A3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A1 = FR_A2,FR_x,FR_A1
+(p13) cmp.leu.unc   p10,p0 = GR_Root,GR_2xDx
+};;
+{ .mfi
+      nop.m         0
+      frcpa.s1      FR_InvX,p0 = f1,FR_Req
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fms.s1        FR_rx = FR_NormX,f1,FR_Root
+      nop.i         0
+};;
+{ .mfi
+      getf.exp      GR_SignExp = FR_Req
+      fma.s1        FR_x4 = FR_x2,FR_x2,f0
+      nop.i         0
+};;
+{ .mfi
+      getf.sig      GR_Sig = FR_Req
+      fma.s1        FR_A5 = FR_A7,FR_x2,FR_A5
+      nop.i         0
+};;
+{ .mfi
+      sub           GR_PureExp = GR_SignExp,GR_ExpBias
+      fma.s1        FR_w2 = FR_w,FR_w,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Q32 = FR_P3,FR_w,FR_P2
+      nop.i         0
+};;
+{ .mfi
+      setf.sig      FR_int_Ln = GR_PureExp
+      fma.s1        FR_A1 = FR_A3,FR_x2,FR_A1
+      extr.u        GR_Ind4T = GR_Sig,55,8
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Q10 = FR_P1,FR_w,f1
+      nop.i         0
+};;
+{ .mfi
+      shladd        GR_ad_T = GR_Ind4T,3,GR_ad_Data
+      fms.s1        FR_r = FR_InvX,FR_Req,f1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fms.s1        FR_rx2 = FR_rx,FR_rx,f0
+      nop.i         0
+};;
+{ .mfi
+      ldfd          FR_T = [GR_ad_T]
+(p10) fma.s1        FR_R2 = FR_R3,FR_rx,FR_R2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_R0 = FR_R1,FR_rx,FR_R0
+      nop.i         0
+};;
+{ .mfi
+      getf.exp      GR_Exp = FR_w
+      fma.s1        FR_A1 = FR_A5,FR_x4,FR_A1
+      mov           GR_ExpMask = 0x1ffff
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Q32 = FR_Q32, FR_w2,FR_Q10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_r2 = FR_r,FR_r,f0
+      mov           GR_fff7 = 0xFFF7
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P10 = FR_P1,FR_r,f1
+      and           GR_Exp = GR_ExpMask,GR_Exp
+}
+{ .mfb
+      nop.m         0
+(p10) fma.s.s0      f8 = FR_R2,FR_rx2,FR_R0
+(p10) br.ret.spnt   b0 // exit for arguments close to negative roots
+};;
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_N = FR_int_Ln
+      nop.i         0
+}
+{ .mfi
+      cmp.ge        p14,p15 = GR_Exp,GR_fff7
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A0 = FR_A1,FR_x,FR_A0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fma.s1        FR_Ln = FR_Q32,FR_w,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_P32 = FR_P32,FR_r2,FR_P10
+      cmp.eq        p6,p7 = 0,GR_Ind
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_T = FR_N,FR_Ln2,FR_T
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_Ln = FR_P32,FR_r,FR_T
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fms.s.s0      f8 = FR_A0,FR_x,FR_Ln
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p7)  fms.s.s0      f8 = FR_A0,f1,FR_Ln
+      br.ret.sptk   b0
+};;
+
+// branch for calculating of ln(GAMMA(x)) for x < -2^13
+//---------------------------------------------------------------------
+.align 32
+lgammaf_negstirling:
+{ .mfi
+      shladd        GR_ad_T = GR_Ind4T,3,GR_ad_Data
+      fms.s1        FR_Xf = FR_NormX,f1,FR_N  // xf = x - [x]
+      mov           GR_SingBound = 0x10016
+}
+{ .mfi
+      add           GR_ad_Co = 0xCA0,GR_ad_Data
+      fma.s1        FR_P32 = FR_P3,FR_r,FR_P2
+      nop.i         0
+};;
+{ .mfi
+      ldfd          FR_T = [GR_ad_T]
+      fcvt.xf       FR_int_Ln = FR_int_Ln
+      cmp.le        p6,p0 = GR_SingBound,GR_Exp
+}
+{ .mfb
+      add           GR_ad_Ce = 0x20,GR_ad_Co
+      fma.s1        FR_r2 = FR_r,FR_r,f0
+(p6)  br.cond.spnt  lgammaf_singularity
+};;
+{ .mfi
+      // load coefficients of polynomial approximation
+      // of ln(sin(Pi*xf)/(Pi*xf)), |xf| <= 0.5
+      ldfpd         FR_S16,FR_S14 = [GR_ad_Co],16
+      fma.s1        FR_P10 = FR_P1,FR_r,f1
+      nop.i         0
+}
+{ .mfi
+      ldfpd         FR_S12,FR_S10 = [GR_ad_Ce],16
+      fms.s1        FR_xm05 = FR_NormX,f1,FR_05
+      nop.i         0
+};;
+{ .mmi
+      ldfpd         FR_S8,FR_S6 = [GR_ad_Co],16
+      ldfpd         FR_S4,FR_S2 = [GR_ad_Ce],16
+      nop.i         0
+};;
+{ .mfi
+      getf.sig      GR_N = FR_int_Ntrunc // signgam calculation
+      fma.s1        FR_Xf2 = FR_Xf,FR_Xf,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      frcpa.s1      FR_InvXf,p0 = f1,FR_Xf
+      nop.i         0
+};;
+{ .mfi
+      getf.d        GR_Arg = FR_Xf
+      fcmp.eq.s1    p6,p0 = FR_NormX,FR_N
+      mov           GR_ExpBias = 0x3FF
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_T = FR_int_Ln,FR_Ln2,FR_T
+      extr.u        GR_Exp = GR_Arg,52,11
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32 = FR_P32,FR_r2,FR_P10
+      nop.i         0
+};;
+{ .mfi
+      sub           GR_PureExp = GR_Exp,GR_ExpBias
+      fma.s1        FR_S14 = FR_S16,FR_Xf2,FR_S14
+      extr.u        GR_Ind4T = GR_Arg,44,8
+}
+{ .mfb
+      mov           GR_SignOfGamma = 1 // set signgam to -1
+      fma.s1        FR_S10 = FR_S12,FR_Xf2,FR_S10
+(p6)  br.cond.spnt  lgammaf_singularity
+};;
+{ .mfi
+      setf.sig      FR_int_Ln = GR_PureExp
+      fms.s1        FR_rf = FR_InvXf,FR_Xf,f1
+      // set p14 if GR_N is even
+      tbit.z        p14,p0 = GR_N,0
+}
+{ .mfi
+      shladd        GR_ad_T = GR_Ind4T,3,GR_ad_Data
+      fma.s1        FR_Xf4 = FR_Xf2,FR_Xf2,f0
+      nop.i         0
+};;
+{ .mfi
+(p14) sub           GR_SignOfGamma = r0,GR_SignOfGamma // set signgam to -1
+      fma.s1        FR_S6 = FR_S8,FR_Xf2,FR_S6
+      nop.i         0
+}
+{ .mfi
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+      fma.s1        FR_S2 = FR_S4,FR_Xf2,FR_S2
+      nop.i         0
+};;
+{ .mfi
+      ldfd          FR_Tf = [GR_ad_T]
+      fma.s1        FR_Ln = FR_P32,FR_r,FR_T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_LnSqrt2Pi = FR_LnSqrt2Pi,f1,FR_NormX
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+(p9)  st4           [r33] = GR_SignOfGamma  // as 32-bit int
+      fma.s1        FR_rf2 = FR_rf,FR_rf,f0
+      nop.i         0
+}
+{ .mfi
+(p10) st8           [r33] = GR_SignOfGamma  // as 64-bit int
+      fma.s1        FR_S10 = FR_S14,FR_Xf4,FR_S10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32f = FR_P3,FR_rf,FR_P2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Xf8 = FR_Xf4,FR_Xf4,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P10f = FR_P1,FR_rf,f1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S2 = FR_S6,FR_Xf4,FR_S2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_Ln = FR_Ln,FR_xm05,FR_LnSqrt2Pi
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_Nf = FR_int_Ln
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S2 = FR_S10,FR_Xf8,FR_S2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Tf = FR_Nf,FR_Ln2,FR_Tf
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32f = FR_P32f,FR_rf2,FR_P10f // ??????
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_Ln = FR_S2,FR_Xf2,FR_Ln
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Lnf = FR_P32f,FR_rf,FR_Tf
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fms.s.s0      f8 = FR_Ln,f1,FR_Lnf
+      br.ret.sptk   b0
+};;
+// branch for calculating of ln(GAMMA(x)) for -2^13 < x < -9
+//---------------------------------------------------------------------
+.align 32
+lgammaf_negpoly:
+{ .mfi
+      getf.d        GR_Arg = FR_Xf
+      frcpa.s1      FR_InvXf,p0 = f1,FR_Xf
+      mov           GR_ExpBias = 0x3FF
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Xf2 = FR_Xf,FR_Xf,f0
+      nop.i         0
+};;
+{ .mfi
+      getf.sig      GR_N = FR_int_Ntrunc
+      fcvt.xf       FR_N = FR_int_Ln
+      mov           GR_SignOfGamma = 1
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A9 = FR_A10,FR_x,FR_A9
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P10 = FR_P1,FR_r,f1
+      extr.u        GR_Exp = GR_Arg,52,11
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_x4 = FR_x2,FR_x2,f0
+      nop.i         0
+};;
+{ .mfi
+      sub           GR_PureExp = GR_Exp,GR_ExpBias
+      fma.s1        FR_A7 = FR_A8,FR_x,FR_A7
+      tbit.z        p14,p0 = GR_N,0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A5 = FR_A6,FR_x,FR_A5
+      nop.i         0
+};;
+{ .mfi
+      setf.sig      FR_int_Ln = GR_PureExp
+      fma.s1        FR_A3 = FR_A4,FR_x,FR_A3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A1 = FR_A2,FR_x,FR_A1
+(p14) sub           GR_SignOfGamma = r0,GR_SignOfGamma
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_rf = FR_InvXf,FR_Xf,f1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Xf4 = FR_Xf2,FR_Xf2,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S14 = FR_S16,FR_Xf2,FR_S14
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S10 = FR_S12,FR_Xf2,FR_S10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_T = FR_N,FR_Ln2,FR_T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32 = FR_P32,FR_r2,FR_P10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S6 = FR_S8,FR_Xf2,FR_S6
+      extr.u        GR_Ind4T = GR_Arg,44,8
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S2 = FR_S4,FR_Xf2,FR_S2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A9,FR_x2,FR_A7
+      nop.i         0
+}
+{ .mfi
+      shladd        GR_ad_T = GR_Ind4T,3,GR_ad_Data
+      fma.s1        FR_A3 = FR_A5,FR_x2,FR_A3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Xf8 = FR_Xf4,FR_Xf4,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rf2 = FR_rf,FR_rf,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32f = FR_P3,FR_rf,FR_P2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P10f = FR_P1,FR_rf,f1
+      nop.i         0
+};;
+{ .mfi
+      ldfd          FR_Tf = [GR_ad_T]
+      fma.s1        FR_Ln = FR_P32,FR_r,FR_T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A0 = FR_A1,FR_x,FR_A0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S10 = FR_S14,FR_Xf4,FR_S10
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S2 = FR_S6,FR_Xf4,FR_S2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fcvt.xf       FR_Nf = FR_int_Ln
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A7,FR_x4,FR_A3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fcmp.eq.s1    p13,p0 = FR_NormX,FR_Ntrunc
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_x3 = FR_x2,FR_x,f0 // -x^3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_P32f = FR_P32f,FR_rf2,FR_P10f
+      nop.i         0
+};;
+{ .mfb
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+      fma.s1        FR_S2 = FR_S10,FR_Xf8,FR_S2
+(p13) br.cond.spnt  lgammaf_singularity
+};;
+.pred.rel "mutex",p9,p10
+{ .mmf
+(p9)  st4           [r33] = GR_SignOfGamma  // as 32-bit int
+(p10) st8           [r33] = GR_SignOfGamma  // as 64-bit int
+      fms.s1        FR_A0 = FR_A3,FR_x3,FR_A0 // -A3*x^3-A0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Tf = FR_Nf,FR_Ln2,FR_Tf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Ln = FR_S2,FR_Xf2,FR_Ln // S2*Xf^2+Ln
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Lnf = FR_P32f,FR_rf,FR_Tf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_Ln = FR_A0,f1,FR_Ln
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fms.s.s0      f8 = FR_Ln,f1,FR_Lnf
+      br.ret.sptk   b0
+};;
+// branch for handling +/-0, NaT, QNaN, +/-INF and denormalised numbers
+//---------------------------------------------------------------------
+.align 32
+lgammaf_spec:
+{ .mfi
+      getf.exp      GR_SignExp = FR_NormX
+      fclass.m      p6,p0 = f8,0x21 // is arg +INF?
+      mov           GR_SignOfGamma = 1 // set signgam to 1
+};;
+{ .mfi
+      getf.sig      GR_Sig = FR_NormX
+      fclass.m      p7,p0 = f8,0xB // is x deno?
+      // set p11 if signgum is 32-bit int
+      // set p12 if signgum is 64-bit int
+      cmp.eq        p12,p11 = 8,r34
+};;
+.pred.rel "mutex",p11,p12
+{ .mfi
+      // store sign of gamma(x) as 32-bit int
+(p11) st4           [r33] = GR_SignOfGamma
+      fclass.m      p8,p0 = f8,0x1C0 // is arg NaT or NaN?
+      dep.z         GR_Ind = GR_SignExp,3,4
+}
+{ .mib
+      // store sign of gamma(x) as 64-bit int
+(p12) st8           [r33] = GR_SignOfGamma
+      and           GR_Exp = GR_ExpMask,GR_SignExp
+(p6)  br.ret.spnt   b0 // exit for +INF
+};;
+{ .mfi
+      sub           GR_PureExp = GR_Exp,GR_ExpBias
+      fclass.m      p9,p0 = f8,0x22 // is arg -INF?
+      extr.u        GR_Ind4T = GR_Sig,55,8
+}
+{ .mfb
+      nop.m         0
+(p7)  fma.s0        FR_tmp = f1,f1,f8
+(p7)  br.cond.sptk  lgammaf_core
+};;
+{ .mfb
+      nop.m         0
+(p8)  fms.s.s0      f8 = f8,f1,f8
+(p8)  br.ret.spnt   b0 // exit for NaT and NaN
+};;
+{ .mfb
+      nop.m         0
+(p9)  fmerge.s      f8 = f1,f8
+(p9)  br.ret.spnt   b0 // exit -INF
+};;
+// branch for handling negative integers and +/-0
+//---------------------------------------------------------------------
+.align 32
+lgammaf_singularity:
+{ .mfi
+      mov           GR_SignOfGamma = 1 // set signgam to 1
+      fclass.m      p6,p0 = f8,0x6 // is x -0?
+      mov           GR_TAG = 109 // negative
+}
+{ .mfi
+      mov           GR_ad_SignGam = r33
+      fma.s1        FR_X = f0,f0,f8
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      frcpa.s0      f8,p0 = f1,f0
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+}
+{ .mib
+      nop.m         0
+(p6)  sub           GR_SignOfGamma = r0,GR_SignOfGamma
+      br.cond.sptk  lgammaf_libm_err
+};;
+// overflow (x > OVERFLOV_BOUNDARY)
+//---------------------------------------------------------------------
+.align 32
+lgammaf_overflow:
+{ .mfi
+      nop.m         0
+      nop.f         0
+      mov           r8 = 0x1FFFE
+};;
+{ .mfi
+      setf.exp      f9 = r8
+      fmerge.s      FR_X = f8,f8
+      mov           GR_TAG = 108 // overflow
+};;
+{ .mfi
+      mov           GR_ad_SignGam = r33
+      nop.f         0
+      // set p9  if signgum is 32-bit int
+      // set p10 if signgum is 64-bit int
+      cmp.eq        p10,p9 = 8,r34
+}
+{ .mfi
+      nop.m         0
+      fma.s.s0      f8 = f9,f9,f0 // Set I,O and +INF result
+      nop.i         0
+};;
+// gate to __libm_error_support#
+//---------------------------------------------------------------------
+.align 32
+lgammaf_libm_err:
+{ .mmi
+      alloc        r32 = ar.pfs,1,4,4,0
+      mov          GR_Parameter_TAG = GR_TAG
+      nop.i        0
+};;
+.pred.rel "mutex",p9,p10
+{ .mmi
+      // store sign of gamma(x) as 32-bit int
+(p9)  st4          [GR_ad_SignGam] = GR_SignOfGamma
+      // store sign of gamma(x) as 64-bit int
+(p10) st8          [GR_ad_SignGam] = GR_SignOfGamma
+      nop.i        0
+};;
+GLOBAL_LIBM_END(__libm_lgammaf)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+      add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+      nop.f 0
+.save ar.pfs,GR_SAVE_PFS
+      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+      add sp=-64,sp                           // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+      stfs [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+      add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0                       // Save b0
+};;
+.body
+{ .mib
+      stfs [GR_Parameter_X] = FR_X                  // STORE Parameter 1
+                                                    // on stack
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+      nop.b 0
+}
+{ .mib
+      stfs [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3
+                                                    // on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#         // Call error handling
+                                                    // function
+};;
+{ .mmi
+      nop.m 0
+      nop.m 0
+      add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+      ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+      add   sp = 64,sp                       // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+      mov   gp = GR_SAVE_GP                  // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+      br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/libm_lgammal.S b/sysdeps/ia64/fpu/libm_lgammal.S
new file mode 100644
index 0000000000..407b3452cd
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_lgammal.S
@@ -0,0 +1,7678 @@
+.file "libm_lgammal.s"
+
+
+// Copyright (c) 2002 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT
+// LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,
+// EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA,OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code,and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History:
+// 03/28/02  Original version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 08/21/02  Added support of SIGN(GAMMA(x)) calculation
+// 09/26/02  Algorithm description improved
+// 10/21/02  Now it returns SIGN(GAMMA(x))=-1 for negative zero
+// 02/10/03  Reordered header: .section, .global, .proc, .align
+// 03/31/05  Reformatted delimiters between data tables
+//
+//*********************************************************************
+//
+// Function: __libm_lgammal(long double x, int* signgam, int szsigngam)
+// computes the principal value of the logarithm of the GAMMA function
+// of x. Signum of GAMMA(x) is stored to memory starting at the address
+// specified by the signgam.
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f8 (Input and Return Value)
+//                              f9-f15
+//                              f32-f127
+//
+//    General Purpose Registers:
+//      r2, r3, r8-r11, r14-r31
+//      r32-r65
+//      r66-r69 (Used to pass arguments to error handling routine)
+//
+//    Predicate Registers:      p6-p15
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    __libm_lgammal(+inf) = +inf
+//    __libm_lgammal(-inf) = QNaN
+//    __libm_lgammal(+/-0) = +inf
+//    __libm_lgammal(x<0, x - integer) = QNaN
+//    __libm_lgammal(SNaN) = QNaN
+//    __libm_lgammal(QNaN) = QNaN
+//
+//*********************************************************************
+//
+// ALGORITHM DESCRIPTION
+//
+// Below we suppose that there is log(z) function which takes an long
+// double argument and returns result as a pair of long double numbers
+// lnHi and lnLo (such that sum lnHi + lnLo provides ~80 correct bits
+// of significand). Algorithm description for such log(z) function
+// see below.
+// Also, it this algorithm description we use the following notational
+// conventions:
+// a) pair A = (Ahi, Alo) means number A represented as sum of Ahi and Alo
+// b) C = A + B = (Ahi, Alo) + (Bhi, Blo) means multi-precision addition.
+//    The result would be C = (Chi, Clo). Notice, that Clo shouldn't be
+//    equal to Alo + Blo
+// c) D = A*B = (Ahi, Alo)*(Bhi, Blo) = (Dhi, Dlo) multi-precisiion
+//    multiplication.
+//
+// So, lgammal has the following computational paths:
+// 1) |x| < 0.5
+//    P = A1*|x| + A2*|x|^2 + ... + A22*|x|^22
+//    A1, A2, A3 represented as a sum of two double precision
+//    numbers and multi-precision computations are used for 3 higher
+//    terms of the polynomial. We get polynomial as a sum of two
+//    double extended numbers: P = (Phi, Plo)
+//    1.1) x > 0
+//         lgammal(x) = P - log(|x|) = (Phi, Plo) - (lnHi(|x|), lnLo(|x|))
+//    1.2) x < 0
+//         lgammal(x) = -P - log(|x|) - log(sin(Pi*x)/(Pi*x))
+//         P and log(|x|) are computed by the same way as in 1.1;
+//         - log(sin(Pi*x)/(Pi*x)) is approximated by a polynomial Plnsin.
+//         Plnsin:= fLnSin2*|x|^2 + fLnSin4*|x|^4 + ... + fLnSin36*|x|^36
+//         The first coefficient of Plnsin is represented as sum of two
+//         double precision numbers (fLnSin2, fLnSin2L). Multi-precision
+//         computations for higher two terms of Plnsin are used.
+//         So, the final result is reconstructed by the following formula
+//         lgammal(x) = (-(Phi, Plo) - (lnHi(|x|), lnLo(|x|))) -
+//                      - (PlnsinHi,PlnsinLo)
+//
+// 2)    0.5 <= x <   0.75  -> t = x - 0.625
+//     -0.75 <  x <= -0.5   -> t = x + 0.625
+//      2.25 <= x <   4.0   -> t = x/2 - 1.5
+//       4.0 <= x <   8.0   -> t = x/4 - 1.5
+//       -0.5 < x <= -0.40625 -> t = x + 0.5
+//       -2.6005859375 < x <= -2.5 -> t = x + 2.5
+//       1.3125 <= x < 1.5625 -> t = x - LOC_MIN, where LOC_MIN is point in
+//                                   which lgammal has local minimum. Exact
+//                                   value can be found in the table below,
+//                                   approximate value is ~1.46
+//
+//    lgammal(x) is approximated by the polynomial of 25th degree: P25(t)
+//    P25(t) = A0 + A1*t + ... + A25*t^25 = (Phi, Plo) + t^4*P21(t),
+//    where
+//    (Phi, Plo) is sum of four highest terms of the polynomial P25(t):
+//    (Phi, Plo) = ((A0, A0L) + (A1, A1L)*t) + t^2 *((A2, A2L) + (A3, A3L)*t),
+//    (Ai, AiL) - coefficients represented as pairs of DP numbers.
+//
+//    P21(t) = (PolC(t)*t^8 + PolD(t))*t^8 + PolE(t),
+//    where
+//    PolC(t) = C21*t^5 + C20*t^4 + ... + C16,
+//    C21 = A25, C20 = A24, ..., C16 = A20
+//
+//    PolD(t) = D7*t^7 + D6*t^6 + ... + D0,
+//    D7 = A19, D6 = A18, ..., D0 = A12
+//
+//    PolE(t) = E7*t^7 + E6*t^6 + ... + E0,
+//    E7 = A11, E6 = A10, ..., E0 = A4
+//
+//    Cis and Dis are represented as double precision numbers,
+//    Eis are represented as double extended numbers.
+//
+// 3) 0.75 <=  x < 1.3125   -> t = x - 1.0
+//    1.5625 <= x < 2.25   -> t = x - 2.0
+//    lgammal(x) is approximated by the polynomial of 25th degree: P25(t)
+//    P25(t) = A1*t + ... + A25*t^25, and computations are carried out
+//    by similar way as in the previous case
+//
+// 4) 10.0 < x <= Overflow Bound ("positive Sterling" range)
+//    lgammal(x) is approximated using Sterling's formula:
+//    lgammal(x) ~ ((x*(lnHi(x) - 1, lnLo(x))) - 0.5*(lnHi(x), lnLo(x))) +
+//                 + ((Chi, Clo) + S(1/x))
+//    where
+//    C = (Chi, Clo) - pair of double precision numbers representing constant
+//    0.5*ln(2*Pi);
+//    S(1/x) = 1/x * (B2 + B4*(1/x)^2 + ... + B20*(1/x)^18), B2, ..., B20 are
+//    Bernulli numbers. S is computed in native precision and then added to
+//    Clo;
+//    lnHi(x) - 1 is computed in native precision and the multiprecision
+//    multiplication (x, 0) *(lnHi(x) - 1, lnLo(x)) is used.
+//
+// 5) -INF < x <= -2^63, any negative integer < 0
+//    All numbers in this range are integers -> error handler is called
+//
+// 6) -2^63 < x <= -0.75 ("negative Sterling" range), x is "far" from root,
+//    lgammal(-t) for positive t is approximated using the following formula:
+//    lgammal(-t) = -lgammal(t)-log(t)-log(|dT|)+log(sin(Pi*|dT|)/(Pi*|dT|))
+//        where dT = -t -round_to_nearest_integer(-t)
+//    Last item is approximated by the same polynomial as described in 1.2.
+//    We split the whole range into three subranges due to different ways of
+//    approximation of the first terms.
+//    6.1) -2^63 < x < -6.0 ("negative Sterling" range)
+//       lgammal(t) is approximated exactly as in #4. The only difference that
+//       for -13.0 < x < -6.0 subrange instead of Bernulli numbers we use their
+//       minimax approximation on this range.
+//       log(t), log(|dT|) are approximated by the log routine mentioned above.
+//    6.2) -6.0 < x <= -0.75, |x + 1|> 2^(-7)
+//       log(t), log(|dT|) are approximated by the log routine mentioned above,
+//       lgammal(t) is approximated by polynomials of the 25th degree similar
+//       to ones from #2. Arguments z of the polynomials are as follows
+//       a) 0.75 <= t < 1.0 - 2^(-7),  z = 2*t - 1.5
+//       b) 1.0 - 2^(-7)  < t < 2.0,   z = t - 1.5
+//       c) 2.0  < t < 3.0,   z = t/2 - 1.5
+//       d) 3.0  < t < 4.0,   z = t/2 - 1.5. Notice, that range reduction is
+//          the same as in case c) but the set of coefficients is different
+//       e) 4.0  < t < 6.0,   z = t/4 - 1.5
+//    6.3) |x + 1| <= 2^(-7)
+//       log(1 + (x-1)) is approximated by Taylor series,
+//       log(sin(Pi*|dT|)/(Pi*|dT|)) is still approximated by polynomial but
+//       it has just 4th degree.
+//       log(|dT|) is approximated by the log routine mentioned above.
+//       lgammal(-x) is approximated by polynomial of 8th degree from (-x + 1).
+//
+// 7) -20.0 < x < -2.0, x falls in root "neighbourhood".
+//    "Neighbourhood" means that |lgammal(x)| < epsilon, where epsilon is
+//    different for every root (and it is stored in the table), but typically
+//    it is ~ 0.15. There are 35 roots significant from "double extended"
+//    point of view. We split all the roots into two subsets: "left" and "right"
+//    roots. Considering [-(N+1), -N] range we call root as "left" one if it
+//    lies closer to -(N+1) and "right" otherwise. There is no "left" root in
+//    the [-20, -19] range (it exists, but is insignificant for double extended
+//    precision). To determine if x falls in root "neighbourhood" we store
+//    significands of all the 35 roots as well as epsilon values (expressed
+//    by the left and right bound).
+//    In these ranges we approximate lgammal(x) by polynomial series of 19th
+//    degree:
+//    lgammal(x) = P19(t) = A0 + A1*t + ...+ A19*t^19, where t = x - EDP_Root,
+//    EDP_Root is the exact value of the corresponding root rounded to double
+//    extended precision. So, we have 35 different polynomials which make our
+//    table rather big. We may hope that x falls in root "neighbourhood"
+//    quite rarely -> ther might be no need in frequent use of different
+//    polynomials.
+//    A0, A1, A2, A3 are represented as pairs of double precision numbers,
+//    A4, A5 are long doubles, and to decrease the size of the table we
+//    keep the rest of coefficients in just double precision
+//
+//*********************************************************************
+// Algorithm for log(X) = (lnHi(X), lnLo(X))
+//
+//   ALGORITHM
+//
+//   Here we use a table lookup method. The basic idea is that in
+//   order to compute logl(Arg) for an argument Arg in [1,2), we
+//   construct a value G such that G*Arg is close to 1 and that
+//   logl(1/G) is obtainable easily from a table of values calculated
+//   beforehand. Thus
+//
+//      logl(Arg) = logl(1/G) + logl(G*Arg)
+//                = logl(1/G) + logl(1 + (G*Arg - 1))
+//
+//   Because |G*Arg - 1| is small, the second term on the right hand
+//   side can be approximated by a short polynomial. We elaborate
+//   this method in four steps.
+//
+//   Step 0: Initialization
+//
+//   We need to calculate logl( X ). Obtain N, S_hi such that
+//
+//      X = 2^N * S_hi exactly
+//
+//   where S_hi in [1,2)
+//
+//   Step 1: Argument Reduction
+//
+//   Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
+//
+//      G := G_1 * G_2 * G_3
+//      r := (G * S_hi - 1)
+//
+//   These G_j's have the property that the product is exactly
+//   representable and that |r| < 2^(-12) as a result.
+//
+//   Step 2: Approximation
+//
+//
+//   logl(1 + r) is approximated by a short polynomial poly(r).
+//
+//   Step 3: Reconstruction
+//
+//
+//   Finally, logl( X ) is given by
+//
+//   logl( X )   =   logl( 2^N * S_hi )
+//                 ~=~  N*logl(2) + logl(1/G) + logl(1 + r)
+//                 ~=~  N*logl(2) + logl(1/G) + poly(r).
+//
+//   IMPLEMENTATION
+//
+//   Step 0. Initialization
+//   ----------------------
+//
+//   Z := X
+//   N := unbaised exponent of Z
+//   S_hi := 2^(-N) * Z
+//
+//   Step 1. Argument Reduction
+//   --------------------------
+//
+//   Let
+//
+//      Z = 2^N * S_hi = 2^N * 1.d_1 d_2 d_3 ... d_63
+//
+//   We obtain G_1, G_2, G_3 by the following steps.
+//
+//
+//      Define          X_0 := 1.d_1 d_2 ... d_14. This is extracted
+//                      from S_hi.
+//
+//      Define          A_1 := 1.d_1 d_2 d_3 d_4. This is X_0 truncated
+//                      to lsb = 2^(-4).
+//
+//      Define          index_1 := [ d_1 d_2 d_3 d_4 ].
+//
+//      Fetch           Z_1 := (1/A_1) rounded UP in fixed point with
+//      fixed point     lsb = 2^(-15).
+//                      Z_1 looks like z_0.z_1 z_2 ... z_15
+//                      Note that the fetching is done using index_1.
+//                      A_1 is actually not needed in the implementation
+//                      and is used here only to explain how is the value
+//                      Z_1 defined.
+//
+//      Fetch           G_1 := (1/A_1) truncated to 21 sig. bits.
+//      floating pt.    Again, fetching is done using index_1. A_1
+//                      explains how G_1 is defined.
+//
+//      Calculate       X_1 := X_0 * Z_1 truncated to lsb = 2^(-14)
+//                           = 1.0 0 0 0 d_5 ... d_14
+//                      This is accomplised by integer multiplication.
+//                      It is proved that X_1 indeed always begin
+//                      with 1.0000 in fixed point.
+//
+//
+//      Define          A_2 := 1.0 0 0 0 d_5 d_6 d_7 d_8. This is X_1
+//                      truncated to lsb = 2^(-8). Similar to A_1,
+//                      A_2 is not needed in actual implementation. It
+//                      helps explain how some of the values are defined.
+//
+//      Define          index_2 := [ d_5 d_6 d_7 d_8 ].
+//
+//      Fetch           Z_2 := (1/A_2) rounded UP in fixed point with
+//      fixed point     lsb = 2^(-15). Fetch done using index_2.
+//                      Z_2 looks like z_0.z_1 z_2 ... z_15
+//
+//      Fetch           G_2 := (1/A_2) truncated to 21 sig. bits.
+//      floating pt.
+//
+//      Calculate       X_2 := X_1 * Z_2 truncated to lsb = 2^(-14)
+//                           = 1.0 0 0 0 0 0 0 0 d_9 d_10 ... d_14
+//                      This is accomplised by integer multiplication.
+//                      It is proved that X_2 indeed always begin
+//                      with 1.00000000 in fixed point.
+//
+//
+//      Define          A_3 := 1.0 0 0 0 0 0 0 0 d_9 d_10 d_11 d_12 d_13 1.
+//                      This is 2^(-14) + X_2 truncated to lsb = 2^(-13).
+//
+//      Define          index_3 := [ d_9 d_10 d_11 d_12 d_13 ].
+//
+//      Fetch           G_3 := (1/A_3) truncated to 21 sig. bits.
+//      floating pt.    Fetch is done using index_3.
+//
+//      Compute         G := G_1 * G_2 * G_3.
+//
+//      This is done exactly since each of G_j only has 21 sig. bits.
+//
+//      Compute
+//
+//               r := (G*S_hi - 1)
+//
+//
+//  Step 2. Approximation
+//  ---------------------
+//
+//   This step computes an approximation to logl( 1 + r ) where r is the
+//   reduced argument just obtained. It is proved that |r| <= 1.9*2^(-13);
+//   thus logl(1+r) can be approximated by a short polynomial:
+//
+//      logl(1+r) ~=~ poly = r + Q1 r^2 + ... + Q4 r^5
+//
+//
+//  Step 3. Reconstruction
+//  ----------------------
+//
+//   This step computes the desired result of logl(X):
+//
+//      logl(X)  =   logl( 2^N * S_hi )
+//               =   N*logl(2) + logl( S_hi )
+//               =   N*logl(2) + logl(1/G) +
+//                      logl(1 + G*S_hi - 1 )
+//
+//   logl(2), logl(1/G_j) are stored as pairs of (single,double) numbers:
+//   log2_hi, log2_lo, log1byGj_hi, log1byGj_lo. The high parts are
+//   single-precision numbers and the low parts are double precision
+//   numbers. These have the property that
+//
+//      N*log2_hi + SUM ( log1byGj_hi )
+//
+//   is computable exactly in double-extended precision (64 sig. bits).
+//   Finally
+//
+//      lnHi(X) := N*log2_hi + SUM ( log1byGj_hi )
+//      lnLo(X) := poly_hi + [ poly_lo +
+//              ( SUM ( log1byGj_lo ) + N*log2_lo ) ]
+//
+//
+//*********************************************************************
+// General Purpose Registers
+// scratch registers
+rPolDataPtr              = r2
+rLnSinDataPtr            = r3
+rExpX                    = r8
+rSignifX                 = r9
+rDelta                   = r10
+rSignExpX                = r11
+GR_ad_z_1                = r14
+r17Ones                  = r15
+GR_Index1                = r16
+rSignif1andQ             = r17
+GR_X_0                   = r18
+GR_X_1                   = r19
+GR_X_2                   = r20
+GR_Z_1                   = r21
+GR_Z_2                   = r22
+GR_N                     = r23
+rExpHalf                 = r24
+rExp8                    = r25
+rX0Dx                    = r25
+GR_ad_tbl_1              = r26
+GR_ad_tbl_2              = r27
+GR_ad_tbl_3              = r28
+GR_ad_q                  = r29
+GR_ad_z_1                = r30
+GR_ad_z_2                = r31
+// stacked registers
+rPFS_SAVED               = r32
+GR_ad_z_3                = r33
+rSgnGamAddr              = r34
+rSgnGamSize              = r35
+rLogDataPtr              = r36
+rZ1offsett               = r37
+rTmpPtr                  = r38
+rTmpPtr2                 = r39
+rTmpPtr3                 = r40
+rExp2                    = r41
+rExp2tom7                = r42
+rZ625                    = r42
+rExpOne                  = r43
+rNegSingularity          = r44
+rXint                    = r45
+rTbl1Addr                = r46
+rTbl2Addr                = r47
+rTbl3Addr                = r48
+rZ2Addr                  = r49
+rRootsAddr               = r50
+rRootsBndAddr            = r51
+rRoot                    = r52
+rRightBound              = r53
+rLeftBound               = r54
+rSignifDx                = r55
+rBernulliPtr             = r56
+rLnSinTmpPtr             = r56
+rIndex1Dx                = r57
+rIndexPol                = r58
+GR_Index3                = r59
+GR_Index2                = r60
+rSgnGam                  = r61
+rXRnd                    = r62
+
+GR_SAVE_B0               = r63
+GR_SAVE_GP               = r64
+GR_SAVE_PFS              = r65
+// output parameters when calling error handling routine
+GR_Parameter_X           = r66
+GR_Parameter_Y           = r67
+GR_Parameter_RESULT      = r68
+GR_Parameter_TAG         = r69
+
+//********************************************************************
+// Floating Point Registers
+// CAUTION: due to the lack of registers there exist (below in the code)
+// sometimes "unconventional" use of declared registers
+//
+fAbsX                    = f6
+fDelX4                   = f6
+fSignifX                 = f7
+// macros for error handling routine
+FR_X                     = f10 // first argument
+FR_Y                     = f1  // second argument (lgammal has just one)
+FR_RESULT                = f8  // result
+
+// First 7 Bernulli numbers
+fB2                      = f9
+fLnDeltaL                = f9
+fXSqr                    = f9
+fB4                      = f10
+fX4                      = f10
+fB6                      = f11
+fX6                      = f11
+fB8                      = f12
+fXSqrL                   = f12
+fB10                     = f13
+fRes7H                   = f13
+fB12                     = f14
+fRes7L                   = f14
+fB14                     = f15
+
+// stack registers
+// Polynomial coefficients: A0, ..., A25
+fA0                      = f32
+fA0L                     = f33
+fInvXL                   = f33
+fA1                      = f34
+fA1L                     = f35
+fA2                      = f36
+fA2L                     = f37
+fA3                      = f38
+fA3L                     = f39
+fA4                      = f40
+fA4L                     = f41
+fRes6H                   = f41
+fA5                      = f42
+fB2L                     = f42
+fA5L                     = f43
+fMinNegStir              = f43
+fRes6L                   = f43
+fA6                      = f44
+fMaxNegStir              = f44
+fA7                      = f45
+fLnDeltaH                = f45
+fA8                      = f46
+fBrnL                    = f46
+fA9                      = f47
+fBrnH                    = f47
+fA10                     = f48
+fRes5L                   = f48
+fA11                     = f49
+fRes5H                   = f49
+fA12                     = f50
+fDx6                     = f50
+fA13                     = f51
+fDx8                     = f51
+fA14                     = f52
+fDx4                     = f52
+fA15                     = f53
+fYL                      = f53
+fh3Dx                    = f53
+fA16                     = f54
+fYH                      = f54
+fH3Dx                    = f54
+fA17                     = f55
+fResLnDxL                = f55
+fG3Dx                    = f55
+fA18                     = f56
+fResLnDxH                = f56
+fh2Dx                    = f56
+fA19                     = f57
+fFloatNDx                = f57
+fA20                     = f58
+fPolyHiDx                = f58
+fhDx                     = f58
+fA21                     = f59
+fRDxCub                  = f59
+fHDx                     = f59
+fA22                     = f60
+fRDxSq                   = f60
+fGDx                     = f60
+fA23                     = f61
+fPolyLoDx                = f61
+fInvX3                   = f61
+fA24                     = f62
+fRDx                     = f62
+fInvX8                   = f62
+fA25                     = f63
+fInvX4                   = f63
+fPol                     = f64
+fPolL                    = f65
+// Coefficients of ln(sin(Pi*x)/Pi*x)
+fLnSin2                  = f66
+fLnSin2L                 = f67
+fLnSin4                  = f68
+fLnSin6                  = f69
+fLnSin8                  = f70
+fLnSin10                 = f71
+fLnSin12                 = f72
+fLnSin14                 = f73
+fLnSin16                 = f74
+fLnSin18                 = f75
+fDelX8                   = f75
+fLnSin20                 = f76
+fLnSin22                 = f77
+fDelX6                   = f77
+fLnSin24                 = f78
+fLnSin26                 = f79
+fLnSin28                 = f80
+fLnSin30                 = f81
+fhDelX                   = f81
+fLnSin32                 = f82
+fLnSin34                 = f83
+fLnSin36                 = f84
+fXint                    = f85
+fDxSqr                   = f85
+fRes3L                   = f86
+fRes3H                   = f87
+fRes4H                   = f88
+fRes4L                   = f89
+fResH                    = f90
+fResL                    = f91
+fDx                      = f92
+FR_MHalf                 = f93
+fRes1H                   = f94
+fRes1L                   = f95
+fRes2H                   = f96
+fRes2L                   = f97
+FR_FracX                 = f98
+fRcpX                    = f99
+fLnSinH                  = f99
+fTwo                     = f100
+fMOne                    = f100
+FR_G                     = f101
+FR_H                     = f102
+FR_h                     = f103
+FR_G2                    = f104
+FR_H2                    = f105
+FR_poly_lo               = f106
+FR_poly_hi               = f107
+FR_h2                    = f108
+FR_rsq                   = f109
+FR_r                     = f110
+FR_log2_hi               = f111
+FR_log2_lo               = f112
+fFloatN                  = f113
+FR_Q4                    = f114
+FR_G3                    = f115
+FR_H3                    = f116
+FR_h3                    = f117
+FR_Q3                    = f118
+FR_Q2                    = f119
+FR_Q1                    = f120
+fThirteen                = f121
+fSix                     = f121
+FR_rcub                  = f121
+// Last three Bernulli numbers
+fB16                     = f122
+fB18                     = f123
+fB20                     = f124
+fInvX                    = f125
+fLnSinL                  = f125
+fDxSqrL                  = f126
+fFltIntX                 = f126
+fRoot                    = f127
+fNormDx                  = f127
+
+// Data tables
+//==============================================================
+RODATA
+// ************* DO NOT CHANGE THE ORDER OF THESE TABLES *************
+.align 16
+LOCAL_OBJECT_START(lgammal_right_roots_data)
+// List of all right roots themselves
+data8 0x9D3FE4B007C360AB, 0x0000C000 // Range [-3, -2]
+data8 0xC9306DE4F2CD7BEE, 0x0000C000 // Range [-4, -3]
+data8 0x814273C2CCAC0618, 0x0000C001 // Range [-5, -4]
+data8 0xA04352BF85B6C865, 0x0000C001 // Range [-6, -5]
+data8 0xC00B592C4BE4676C, 0x0000C001 // Range [-7, -6]
+data8 0xE0019FEF6FF0F5BF, 0x0000C001 // Range [-8, -7]
+data8 0x80001A01459FC9F6, 0x0000C002 // Range [-9, -8]
+data8 0x900002E3BB47D86D, 0x0000C002 // Range [-10, -9]
+data8 0xA0000049F93BB992, 0x0000C002 // Range [-11, -10]
+data8 0xB0000006B9915316, 0x0000C002 // Range [-12, -11]
+data8 0xC00000008F76C773, 0x0000C002 // Range [-13, -12]
+data8 0xD00000000B09230A, 0x0000C002 // Range [-14, -13]
+data8 0xE000000000C9CBA5, 0x0000C002 // Range [-15, -14]
+data8 0xF0000000000D73FA, 0x0000C002 // Range [-16, -15]
+data8 0x8000000000006BA0, 0x0000C003 // Range [-17, -16]
+data8 0x8800000000000655, 0x0000C003 // Range [-18, -17]
+data8 0x900000000000005A, 0x0000C003 // Range [-19, -18]
+data8 0x9800000000000005, 0x0000C003 // Range [-20, -19]
+// List of bounds of ranges with special polynomial approximation near root
+// Only significands of bounds are actually stored
+data8 0xA000000000000000, 0x9800000000000000 // Bounds for root on [-3, -2]
+data8 0xCAB88035C5EFBB41, 0xC7E05E31F4B02115 // Bounds for root on [-4, -3]
+data8 0x817831B899735C72, 0x8114633941B8053A // Bounds for root on [-5, -4]
+data8 0xA04E8B34C6AA9476, 0xA039B4A42978197B // Bounds for root on [-6, -5]
+data8 0xC00D3D5E588A78A9, 0xC009BA25F7E858A6 // Bounds for root on [-7, -6]
+data8 0xE001E54202991EB4, 0xE001648416CE897F // Bounds for root on [-8, -7]
+data8 0x80001E56D13A6B9F, 0x8000164A3BAD888A // Bounds for root on [-9, -8]
+data8 0x9000035F0529272A, 0x9000027A0E3D94F0 // Bounds for root on [-10, -9]
+data8 0xA00000564D705880, 0xA000003F67EA0CC7 // Bounds for root on [-11, -10]
+data8 0xB0000007D87EE0EF, 0xB0000005C3A122A5 // Bounds for root on [-12, -11]
+data8 0xC0000000A75FE8B1, 0xC00000007AF818AC // Bounds for root on [-13, -12]
+data8 0xD00000000CDFFE36, 0xD000000009758BBF // Bounds for root on [-14, -13]
+data8 0xE000000000EB6D96, 0xE000000000ACF7B2 // Bounds for root on [-15, -14]
+data8 0xF0000000000FB1F9, 0xF0000000000B87FB // Bounds for root on [-16, -15]
+data8 0x8000000000007D90, 0x8000000000005C40 // Bounds for root on [-17, -16]
+data8 0x8800000000000763, 0x880000000000056D // Bounds for root on [-18, -17]
+data8 0x9000000000000069, 0x900000000000004D // Bounds for root on [-19, -18]
+data8 0x9800000000000006, 0x9800000000000005 // Bounds for root on [-20, -19]
+// List of all left roots themselves
+data8 0xAFDA0850DEC8065E, 0x0000C000 // Range [-3, -2]
+data8 0xFD238AA3E17F285C, 0x0000C000 // Range [-4, -3]
+data8 0x9FBABBD37757E6A2, 0x0000C001 // Range [-5, -4]
+data8 0xBFF497AC8FA06AFC, 0x0000C001 // Range [-6, -5]
+data8 0xDFFE5FBB5C377FE8, 0x0000C001 // Range [-7, -6]
+data8 0xFFFFCBFC0ACE7879, 0x0000C001 // Range [-8, -7]
+data8 0x8FFFFD1C425E8100, 0x0000C002 // Range [-9, -8]
+data8 0x9FFFFFB606BDFDCD, 0x0000C002 // Range [-10, -9]
+data8 0xAFFFFFF9466E9F1B, 0x0000C002 // Range [-11, -10]
+data8 0xBFFFFFFF70893874, 0x0000C002 // Range [-12, -11]
+data8 0xCFFFFFFFF4F6DCF6, 0x0000C002 // Range [-13, -12]
+data8 0xDFFFFFFFFF36345B, 0x0000C002 // Range [-14, -13]
+data8 0xEFFFFFFFFFF28C06, 0x0000C002 // Range [-15, -14]
+data8 0xFFFFFFFFFFFF28C0, 0x0000C002 // Range [-16, -15]
+data8 0x87FFFFFFFFFFF9AB, 0x0000C003 // Range [-17, -16]
+data8 0x8FFFFFFFFFFFFFA6, 0x0000C003 // Range [-18, -17]
+data8 0x97FFFFFFFFFFFFFB, 0x0000C003 // Range [-19, -18]
+data8 0x0000000000000000, 0x00000000 // pad to keep logic in the main path
+// List of bounds of ranges with special polynomial approximation near root
+// Only significands of bounds are actually stored
+data8 0xB235880944CC758E, 0xADD2F1A9FBE76C8B // Bounds for root on [-3, -2]
+data8 0xFD8E7844F307B07C, 0xFCA655C2152BDE4D // Bounds for root on [-4, -3]
+data8 0x9FC4D876EE546967, 0x9FAEE4AF68BC4292 // Bounds for root on [-5, -4]
+data8 0xBFF641FFBFCC44F1, 0xBFF2A47919F4BA89 // Bounds for root on [-6, -5]
+data8 0xDFFE9C803DEFDD59, 0xDFFE18932EB723FE // Bounds for root on [-7, -6]
+data8 0xFFFFD393FA47AFC3, 0xFFFFC317CF638AE1 // Bounds for root on [-8, -7]
+data8 0x8FFFFD8840279925, 0x8FFFFC9DCECEEE92 // Bounds for root on [-9, -8]
+data8 0x9FFFFFC0D34E2AF8, 0x9FFFFFA9619AA3B7 // Bounds for root on [-10, -9]
+data8 0xAFFFFFFA41C18246, 0xAFFFFFF82025A23C // Bounds for root on [-11, -10]
+data8 0xBFFFFFFF857ACB4E, 0xBFFFFFFF58032378 // Bounds for root on [-12, -11]
+data8 0xCFFFFFFFF6934AB8, 0xCFFFFFFFF313EF0A // Bounds for root on [-13, -12]
+data8 0xDFFFFFFFFF53A9E9, 0xDFFFFFFFFF13B5A5 // Bounds for root on [-14, -13]
+data8 0xEFFFFFFFFFF482CB, 0xEFFFFFFFFFF03F4F // Bounds for root on [-15, -14]
+data8 0xFFFFFFFFFFFF482D, 0xFFFFFFFFFFFF03F5 // Bounds for root on [-16, -15]
+data8 0x87FFFFFFFFFFFA98, 0x87FFFFFFFFFFF896 // Bounds for root on [-17, -16]
+data8 0x8FFFFFFFFFFFFFB3, 0x8FFFFFFFFFFFFF97 // Bounds for root on [-18, -17]
+data8 0x97FFFFFFFFFFFFFC, 0x97FFFFFFFFFFFFFB // Bounds for root on [-19, -18]
+LOCAL_OBJECT_END(lgammal_right_roots_data)
+
+LOCAL_OBJECT_START(lgammal_0_Half_data)
+// Polynomial coefficients for the lgammal(x), 0.0 < |x| < 0.5
+data8 0xBFD9A4D55BEAB2D6, 0xBC8AA3C097746D1F //A3
+data8 0x3FEA51A6625307D3, 0x3C7180E7BD2D0DCC //A2
+data8 0xBFE2788CFC6FB618, 0xBC9E9346C4692BCC //A1
+data8 0x8A8991563EC1BD13, 0x00003FFD //A4
+data8 0xD45CE0BD52C27EF2, 0x0000BFFC //A5
+data8 0xADA06587FA2BBD47, 0x00003FFC //A6
+data8 0x9381D0ED2194902A, 0x0000BFFC //A7
+data8 0x80859B3CF92D4192, 0x00003FFC //A8
+data8 0xE4033517C622A946, 0x0000BFFB //A9
+data8 0xCD00CE67A51FC82A, 0x00003FFB //A10
+data8 0xBA44E2A96C3B5700, 0x0000BFFB //A11
+data8 0xAAAD008FA46DBD99, 0x00003FFB //A12
+data8 0x9D604AC65A41153D, 0x0000BFFB //A13
+data8 0x917CECB864B5A861, 0x00003FFB //A14
+data8 0x85A4810EB730FDE4, 0x0000BFFB //A15
+data8 0xEF2761C38BD21F77, 0x00003FFA //A16
+data8 0xC913043A128367DA, 0x0000BFFA //A17
+data8 0x96A29B71FF7AFFAA, 0x00003FFA //A18
+data8 0xBB9FFA1A5FE649BB, 0x0000BFF9 //A19
+data8 0xB17982CD2DAA0EE3, 0x00003FF8 //A20
+data8 0xDE1DDCBFFB9453F0, 0x0000BFF6 //A21
+data8 0x87FBF5D7ACD9FA9D, 0x00003FF4 //A22
+LOCAL_OBJECT_END(lgammal_0_Half_data)
+
+LOCAL_OBJECT_START(Constants_Q)
+// log2_hi, log2_lo, Q_4, Q_3, Q_2, and Q_1
+data4  0x00000000,0xB1721800,0x00003FFE,0x00000000
+data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
+data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000
+data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000
+data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000
+data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000
+LOCAL_OBJECT_END(Constants_Q)
+
+LOCAL_OBJECT_START(Constants_Z_1)
+// Z1 - 16 bit fixed
+data4  0x00008000
+data4  0x00007879
+data4  0x000071C8
+data4  0x00006BCB
+data4  0x00006667
+data4  0x00006187
+data4  0x00005D18
+data4  0x0000590C
+data4  0x00005556
+data4  0x000051EC
+data4  0x00004EC5
+data4  0x00004BDB
+data4  0x00004925
+data4  0x0000469F
+data4  0x00004445
+data4  0x00004211
+LOCAL_OBJECT_END(Constants_Z_1)
+
+LOCAL_OBJECT_START(Constants_G_H_h1)
+// G1 and H1 - IEEE single and h1 - IEEE double
+data4  0x3F800000,0x00000000,0x00000000,0x00000000
+data4  0x3F70F0F0,0x3D785196,0x617D741C,0x3DA163A6
+data4  0x3F638E38,0x3DF13843,0xCBD3D5BB,0x3E2C55E6
+data4  0x3F579430,0x3E2FF9A0,0xD86EA5E7,0xBE3EB0BF
+data4  0x3F4CCCC8,0x3E647FD6,0x86B12760,0x3E2E6A8C
+data4  0x3F430C30,0x3E8B3AE7,0x5C0739BA,0x3E47574C
+data4  0x3F3A2E88,0x3EA30C68,0x13E8AF2F,0x3E20E30F
+data4  0x3F321640,0x3EB9CEC8,0xF2C630BD,0xBE42885B
+data4  0x3F2AAAA8,0x3ECF9927,0x97E577C6,0x3E497F34
+data4  0x3F23D708,0x3EE47FC5,0xA6B0A5AB,0x3E3E6A6E
+data4  0x3F1D89D8,0x3EF8947D,0xD328D9BE,0xBDF43E3C
+data4  0x3F17B420,0x3F05F3A1,0x0ADB090A,0x3E4094C3
+data4  0x3F124920,0x3F0F4303,0xFC1FE510,0xBE28FBB2
+data4  0x3F0D3DC8,0x3F183EBF,0x10FDE3FA,0x3E3A7895
+data4  0x3F088888,0x3F20EC80,0x7CC8C98F,0x3E508CE5
+data4  0x3F042108,0x3F29516A,0xA223106C,0xBE534874
+LOCAL_OBJECT_END(Constants_G_H_h1)
+
+LOCAL_OBJECT_START(Constants_Z_2)
+// Z2 - 16 bit fixed
+data4  0x00008000
+data4  0x00007F81
+data4  0x00007F02
+data4  0x00007E85
+data4  0x00007E08
+data4  0x00007D8D
+data4  0x00007D12
+data4  0x00007C98
+data4  0x00007C20
+data4  0x00007BA8
+data4  0x00007B31
+data4  0x00007ABB
+data4  0x00007A45
+data4  0x000079D1
+data4  0x0000795D
+data4  0x000078EB
+LOCAL_OBJECT_END(Constants_Z_2)
+
+LOCAL_OBJECT_START(Constants_G_H_h2)
+// G2 and H2 - IEEE single and h2 - IEEE double
+data4  0x3F800000,0x00000000,0x00000000,0x00000000
+data4  0x3F7F00F8,0x3B7F875D,0x22C42273,0x3DB5A116
+data4  0x3F7E03F8,0x3BFF015B,0x21F86ED3,0x3DE620CF
+data4  0x3F7D08E0,0x3C3EE393,0x484F34ED,0xBDAFA07E
+data4  0x3F7C0FC0,0x3C7E0586,0x3860BCF6,0xBDFE07F0
+data4  0x3F7B1880,0x3C9E75D2,0xA78093D6,0x3DEA370F
+data4  0x3F7A2328,0x3CBDC97A,0x72A753D0,0x3DFF5791
+data4  0x3F792FB0,0x3CDCFE47,0xA7EF896B,0x3DFEBE6C
+data4  0x3F783E08,0x3CFC15D0,0x409ECB43,0x3E0CF156
+data4  0x3F774E38,0x3D0D874D,0xFFEF71DF,0xBE0B6F97
+data4  0x3F766038,0x3D1CF49B,0x5D59EEE8,0xBE080483
+data4  0x3F757400,0x3D2C531D,0xA9192A74,0x3E1F91E9
+data4  0x3F748988,0x3D3BA322,0xBF72A8CD,0xBE139A06
+data4  0x3F73A0D0,0x3D4AE46F,0xF8FBA6CF,0x3E1D9202
+data4  0x3F72B9D0,0x3D5A1756,0xBA796223,0xBE1DCCC4
+data4  0x3F71D488,0x3D693B9D,0xB6B7C239,0xBE049391
+LOCAL_OBJECT_END(Constants_G_H_h2)
+
+LOCAL_OBJECT_START(Constants_G_H_h3)
+// G3 and H3 - IEEE single and h3 - IEEE double
+data4  0x3F7FFC00,0x38800100,0x562224CD,0x3D355595
+data4  0x3F7FF400,0x39400480,0x06136FF6,0x3D8200A2
+data4  0x3F7FEC00,0x39A00640,0xE8DE9AF0,0x3DA4D68D
+data4  0x3F7FE400,0x39E00C41,0xB10238DC,0xBD8B4291
+data4  0x3F7FDC00,0x3A100A21,0x3B1952CA,0xBD89CCB8
+data4  0x3F7FD400,0x3A300F22,0x1DC46826,0xBDB10707
+data4  0x3F7FCC08,0x3A4FF51C,0xF43307DB,0x3DB6FCB9
+data4  0x3F7FC408,0x3A6FFC1D,0x62DC7872,0xBD9B7C47
+data4  0x3F7FBC10,0x3A87F20B,0x3F89154A,0xBDC3725E
+data4  0x3F7FB410,0x3A97F68B,0x62B9D392,0xBD93519D
+data4  0x3F7FAC18,0x3AA7EB86,0x0F21BD9D,0x3DC18441
+data4  0x3F7FA420,0x3AB7E101,0x2245E0A6,0xBDA64B95
+data4  0x3F7F9C20,0x3AC7E701,0xAABB34B8,0x3DB4B0EC
+data4  0x3F7F9428,0x3AD7DD7B,0x6DC40A7E,0x3D992337
+data4  0x3F7F8C30,0x3AE7D474,0x4F2083D3,0x3DC6E17B
+data4  0x3F7F8438,0x3AF7CBED,0x811D4394,0x3DAE314B
+data4  0x3F7F7C40,0x3B03E1F3,0xB08F2DB1,0xBDD46F21
+data4  0x3F7F7448,0x3B0BDE2F,0x6D34522B,0xBDDC30A4
+data4  0x3F7F6C50,0x3B13DAAA,0xB1F473DB,0x3DCB0070
+data4  0x3F7F6458,0x3B1BD766,0x6AD282FD,0xBDD65DDC
+data4  0x3F7F5C68,0x3B23CC5C,0xF153761A,0xBDCDAB83
+data4  0x3F7F5470,0x3B2BC997,0x341D0F8F,0xBDDADA40
+data4  0x3F7F4C78,0x3B33C711,0xEBC394E8,0x3DCD1BD7
+data4  0x3F7F4488,0x3B3BBCC6,0x52E3E695,0xBDC3532B
+data4  0x3F7F3C90,0x3B43BAC0,0xE846B3DE,0xBDA3961E
+data4  0x3F7F34A0,0x3B4BB0F4,0x785778D4,0xBDDADF06
+data4  0x3F7F2CA8,0x3B53AF6D,0xE55CE212,0x3DCC3ED1
+data4  0x3F7F24B8,0x3B5BA620,0x9E382C15,0xBDBA3103
+data4  0x3F7F1CC8,0x3B639D12,0x5C5AF197,0x3D635A0B
+data4  0x3F7F14D8,0x3B6B9444,0x71D34EFC,0xBDDCCB19
+data4  0x3F7F0CE0,0x3B7393BC,0x52CD7ADA,0x3DC74502
+data4  0x3F7F04F0,0x3B7B8B6D,0x7D7F2A42,0xBDB68F17
+LOCAL_OBJECT_END(Constants_G_H_h3)
+
+LOCAL_OBJECT_START(lgammal_data)
+// Positive overflow value
+data8 0xB8D54C8BFFFDEBF4, 0x00007FF1
+LOCAL_OBJECT_END(lgammal_data)
+
+LOCAL_OBJECT_START(lgammal_Stirling)
+// Coefficients needed for Strirling's formula
+data8 0x3FED67F1C864BEB4 // High part of 0.5*ln(2*Pi)
+data8 0x3C94D252F2400510 // Low part of 0.5*ln(2*Pi)
+//
+// Bernulli numbers used in Striling's formula for -2^63 < |x| < -13.0
+//(B1H, B1L) = 8.3333333333333333333262747254e-02
+data8 0x3FB5555555555555, 0x3C55555555555555
+data8 0xB60B60B60B60B60B, 0x0000BFF6 //B2 = -2.7777777777777777777777777778e-03
+data8 0xD00D00D00D00D00D, 0x00003FF4 //B3 = 7.9365079365079365079365079365e-04
+data8 0x9C09C09C09C09C0A, 0x0000BFF4 //B4 = -5.9523809523809523809523809524e-04
+data8 0xDCA8F158C7F91AB8, 0x00003FF4 //B5 = 8.4175084175084175084175084175e-04
+data8 0xFB5586CCC9E3E410, 0x0000BFF5 //B6 = -1.9175269175269175269175269175e-03
+data8 0xD20D20D20D20D20D, 0x00003FF7 //B7 = 6.4102564102564102564102564103e-03
+data8 0xF21436587A9CBEE1, 0x0000BFF9 //B8 = -2.9550653594771241830065359477e-02
+data8 0xB7F4B1C0F033FFD1, 0x00003FFC //B9 = 1.7964437236883057316493849002e-01
+data8 0xB23B3808C0F9CF6E, 0x0000BFFF //B10 = -1.3924322169059011164274322169e+00
+// Polynomial coefficients for Stirling's formula, -13.0 < x < -6.0
+data8 0x3FB5555555555555, 0x3C4D75060289C58B //A0
+data8 0xB60B60B60B0F0876, 0x0000BFF6 //A1
+data8 0xD00D00CE54B1256C, 0x00003FF4 //A2
+data8 0x9C09BF46B58F75E1, 0x0000BFF4 //A3
+data8 0xDCA8483BC91ACC6D, 0x00003FF4 //A4
+data8 0xFB3965C939CC9FEE, 0x0000BFF5 //A5
+data8 0xD0723ADE3F0BC401, 0x00003FF7 //A6
+data8 0xE1ED7434E81F0B73, 0x0000BFF9 //A7
+data8 0x8069C6982F993283, 0x00003FFC //A8
+data8 0xC271F65BFA5BEE3F, 0x0000BFFD //A9
+LOCAL_OBJECT_END(lgammal_Stirling)
+
+LOCAL_OBJECT_START(lgammal_lnsin_data)
+// polynomial approximation of -ln(sin(Pi*x)/(Pi*x)), 0 < x <= 0.5
+data8 0x3FFA51A6625307D3, 0x3C81873332FAF94C //A2
+data8 0x8A8991563EC241C3, 0x00003FFE //A4
+data8 0xADA06588061805DF, 0x00003FFD //A6
+data8 0x80859B57C338D0F7, 0x00003FFD //A8
+data8 0xCD00F1C2D78754BD, 0x00003FFC //A10
+data8 0xAAB56B1D3A1F4655, 0x00003FFC //A12
+data8 0x924B6F2FBBED12B1, 0x00003FFC //A14
+data8 0x80008E58765F43FC, 0x00003FFC //A16
+data8 0x3FBC718EC115E429//A18
+data8 0x3FB99CE544FE183E//A20
+data8 0x3FB7251C09EAAD89//A22
+data8 0x3FB64A970733628C//A24
+data8 0x3FAC92D6802A3498//A26
+data8 0x3FC47E1165261586//A28
+data8 0xBFCA1BAA434750D4//A30
+data8 0x3FE460001C4D5961//A32
+data8 0xBFE6F06A3E4908AD//A34
+data8 0x3FE300889EBB203A//A36
+LOCAL_OBJECT_END(lgammal_lnsin_data)
+
+LOCAL_OBJECT_START(lgammal_half_3Q_data)
+// Polynomial coefficients for the lgammal(x), 0.5 <= x < 0.75
+data8 0xBFF7A648EE90C62E, 0x3C713F326857E066 // A3, A0L
+data8 0xBFF73E4B8BA780AE, 0xBCA953BC788877EF // A1, A1L
+data8 0x403774DCD58D0291, 0xC0415254D5AE6623 // D0, D1
+data8 0x40B07213855CBFB0, 0xC0B8855E25D2D229 // C20, C21
+data8 0x3FFB359F85FF5000, 0x3C9BAECE6EF9EF3A // A2, A2L
+data8 0x3FD717D498A3A8CC, 0xBC9088E101CFEDFA  // A0, A3L
+data8 0xAFEF36CC5AEC3FF0, 0x00004002 // E6
+data8 0xABE2054E1C34E791, 0x00004001 // E4
+data8 0xB39343637B2900D1, 0x00004000 // E2
+data8 0xD74FB710D53F58F6, 0x00003FFF // E0
+data8 0x4070655963BA4256, 0xC078DA9D263C4EA3 // D6, D7
+data8 0x405CD2B6A9B90978, 0xC065B3B9F4F4F171 // D4, D5
+data8 0x4049BC2204CF61FF, 0xC05337227E0BA152 // D2, D3
+data8 0x4095509A50C07A96, 0xC0A0747949D2FB45 // C18, C19
+data8 0x4082ECCBAD709414, 0xC08CD02FB088A702 // C16, C17
+data8 0xFFE4B2A61B508DD5, 0x0000C002 // E7
+data8 0xF461ADB8AE17E0A5, 0x0000C001 // E5
+data8 0xF5BE8B0B90325F20, 0x0000C000 // E3
+data8 0x877B275F3FB78DCA, 0x0000C000 // E1
+LOCAL_OBJECT_END(lgammal_half_3Q_data)
+
+LOCAL_OBJECT_START(lgammal_half_3Q_neg_data)
+// Polynomial coefficients for the lgammal(x), -0.75 < x <= -0.5
+data8 0xC014836EFD94899C, 0x3C9835679663B44F // A3, A0L
+data8 0xBFF276C7B4FB1875, 0xBC92D3D9FA29A1C0 // A1, A1L
+data8 0x40C5178F24E1A435, 0xC0D9DE84FBC5D76A // D0, D1
+data8 0x41D4D1B236BF6E93, 0xC1EBB0445CE58550 // C20, C21
+data8 0x4015718CD67F63D3, 0x3CC5354B6F04B59C // A2, A2L
+data8 0x3FF554493087E1ED, 0xBCB72715E37B02B9 // A0, A3L
+data8 0xE4AC7E915FA72229, 0x00004009 // E6
+data8 0xA28244206395FCC6, 0x00004007 // E4
+data8 0xFB045F19C07B2544, 0x00004004 // E2
+data8 0xE5C8A6E6A9BA7D7B, 0x00004002 // E0
+data8 0x4143943B55BF5118, 0xC158AC05EA675406 // D6, D7
+data8 0x4118F6833D19717C, 0xC12F51A6F375CC80 // D4, D5
+data8 0x40F00C209483481C, 0xC103F1DABF750259 // D2, D3
+data8 0x4191038F2D8F9E40, 0xC1A413066DA8AE4A // C18, C19
+data8 0x4170B537EDD833DE, 0xC1857E79424C61CE // C16, C17
+data8 0x8941D8AB4855DB73, 0x0000C00B // E7
+data8 0xBB822B131BD2E813, 0x0000C008 // E5
+data8 0x852B4C03B83D2D4F, 0x0000C006 // E3
+data8 0xC754CA7E2DDC0F1F, 0x0000C003 // E1
+LOCAL_OBJECT_END(lgammal_half_3Q_neg_data)
+
+LOCAL_OBJECT_START(lgammal_2Q_4_data)
+// Polynomial coefficients for the lgammal(x), 2.25 <= |x| < 4.0
+data8 0xBFCA4D55BEAB2D6F, 0x3C7ABC9DA14141F5 // A3, A0L
+data8 0x3FFD8773039049E7, 0x3C66CB7957A95BA4 // A1, A1L
+data8 0x3F45C3CC79E91E7D, 0xBF3A8E5005937E97 // D0, D1
+data8 0x3EC951E35E1C9203, 0xBEB030A90026C5DF // C20, C21
+data8 0x3FE94699894C1F4C, 0x3C91884D21D123F1 // A2, A2L
+data8 0x3FE62E42FEFA39EF, 0xBC66480CEB70870F // A0, A3L
+data8 0xF1C2EAFF0B3A7579, 0x00003FF5 // E6
+data8 0xB36AF863926B55A3, 0x00003FF7 // E4
+data8 0x9620656185BB44CA, 0x00003FF9 // E2
+data8 0xA264558FB0906AFF, 0x00003FFB // E0
+data8 0x3F03D59E9666C961, 0xBEF91115893D84A6 // D6, D7
+data8 0x3F19333611C46225, 0xBF0F89EB7D029870 // D4, D5
+data8 0x3F3055A96B347AFE, 0xBF243B5153E178A8 // D2, D3
+data8 0x3ED9A4AEF30C4BB2, 0xBED388138B1CEFF2 // C18, C19
+data8 0x3EEF7945A3C3A254, 0xBEE36F32A938EF11 // C16, C17
+data8 0x9028923F47C82118, 0x0000BFF5 // E7
+data8 0xCE0DAAFB6DC93B22, 0x0000BFF6 // E5
+data8 0xA0D0983B34AC4C8D, 0x0000BFF8 // E3
+data8 0x94D6C50FEB8B0CE7, 0x0000BFFA // E1
+LOCAL_OBJECT_END(lgammal_2Q_4_data)
+
+LOCAL_OBJECT_START(lgammal_4_8_data)
+// Polynomial coefficients for the lgammal(x), 4.0 <= |x| < 8.0
+data8 0xBFD6626BC9B31B54, 0x3CAA53C82493A92B // A3, A0L
+data8 0x401B4C420A50AD7C, 0x3C8C6E9929F789A3 // A1, A1L
+data8 0x3F49410427E928C2, 0xBF3E312678F8C146 // D0, D1
+data8 0x3ED51065F7CD5848, 0xBED052782A03312F // C20, C21
+data8 0x3FF735973273D5EC, 0x3C831DFC65BF8CCF // A2, A2L
+data8 0x401326643C4479C9, 0xBC6FA0498C5548A6 // A0, A3L
+data8 0x9382D8B3CD4EB7E3, 0x00003FF6 // E6
+data8 0xE9F92CAD8A85CBCD, 0x00003FF7 // E4
+data8 0xD58389FE38258CEC, 0x00003FF9 // E2
+data8 0x81310136363AE8AA, 0x00003FFC // E0
+data8 0x3F04F0AE38E78570, 0xBEF9E2144BB8F03C // D6, D7
+data8 0x3F1B5E992A6CBC2A, 0xBF10F3F400113911 // D4, D5
+data8 0x3F323EE00AAB7DEE, 0xBF2640FDFA9FB637 // D2, D3
+data8 0x3ED2143EBAFF067A, 0xBEBBDEB92D6FF35D // C18, C19
+data8 0x3EF173A42B69AAA4, 0xBEE78B9951A2EAA5 // C16, C17
+data8 0xAB3CCAC6344E52AA, 0x0000BFF5 // E7
+data8 0x81ACCB8915B16508, 0x0000BFF7 // E5
+data8 0xDA62C7221102C426, 0x0000BFF8 // E3
+data8 0xDF1BD44C4083580A, 0x0000BFFA // E1
+LOCAL_OBJECT_END(lgammal_4_8_data)
+
+LOCAL_OBJECT_START(lgammal_loc_min_data)
+// Polynomial coefficients for the lgammal(x), 1.3125 <= x < 1.5625
+data8 0xBB16C31AB5F1FB71, 0x00003FFF // xMin - point of local minimum
+data8 0xBFC2E4278DC6BC23, 0xBC683DA8DDCA9650 // A3, A0L
+data8 0x3BD4DB7D0CA61D5F, 0x386E719EDD01D801 // A1, A1L
+data8 0x3F4CC72638E1D93F, 0xBF4228EC9953CCB9 // D0, D1
+data8 0x3ED222F97A04613E,0xBED3DDD58095CB6C  // C20, C21
+data8 0x3FDEF72BC8EE38AB, 0x3C863AFF3FC48940 // A2, A2L
+data8 0xBFBF19B9BCC38A41,  0xBC7425F1BFFC1442// A0, A3L
+data8 0x941890032BEB34C3, 0x00003FF6 // E6
+data8 0xC7E701591CE534BC, 0x00003FF7 // E4
+data8 0x93373CBD05138DD4, 0x00003FF9 // E2
+data8 0x845A14A6A81C05D6, 0x00003FFB // E0
+data8 0x3F0F6C4DF6D47A13, 0xBF045DCDB5B49E19 // D6, D7
+data8 0x3F22E23345DDE59C, 0xBF1851159AFB1735 // D4, D5
+data8 0x3F37101EA4022B78, 0xBF2D721E6323AF13 // D2, D3
+data8 0x3EE691EBE82DF09D, 0xBEDD42550961F730 // C18, C19
+data8 0x3EFA793EDE99AD85, 0xBEF14000108E70BE // C16, C17
+data8 0xB7CBC033ACE0C99C, 0x0000BFF5 // E7
+data8 0xF178D1F7B1A45E27, 0x0000BFF6 // E5
+data8 0xA8FCFCA8106F471C, 0x0000BFF8 // E3
+data8 0x864D46FA898A9AD2, 0x0000BFFA // E1
+LOCAL_OBJECT_END(lgammal_loc_min_data)
+
+LOCAL_OBJECT_START(lgammal_03Q_1Q_data)
+// Polynomial coefficients for the lgammal(x), 0.75 <= |x| < 1.3125
+data8 0x3FD151322AC7D848, 0x3C7184DE0DB7B4EE // A4, A2L
+data8 0x3FD9A4D55BEAB2D6, 0x3C9E934AAB10845F // A3, A1L
+data8 0x3FB111289C381259, 0x3FAFFFCFB32AE18D // D2, D3
+data8 0x3FB3B1D9E0E3E00D, 0x3FB2496F0D3768DF // D0, D1
+data8 0xBA461972C057D439, 0x00003FFB         // E6
+data8 0x3FEA51A6625307D3, 0x3C76ABC886A72DA2 // A2, A4L
+data8 0x3FA8EFE46B32A70E, 0x3F8F31B3559576B6 // C17, C20
+data8 0xE403383700387D85, 0x00003FFB // E4
+data8 0x9381D0EE74BF7251, 0x00003FFC // E2
+data8 0x3FAA2177A6D28177, 0x3FA4895E65FBD995 // C18, C19
+data8 0x3FAAED2C77DBEE5D, 0x3FA94CA59385512C // D6, D7
+data8 0x3FAE1F522E8A5941, 0x3FAC785EF56DD87E // D4, D5
+data8 0x3FB556AD5FA56F0A, 0x3FA81F416E87C783 // E7, C16
+data8 0xCD00F1C2DC2C9F1E, 0x00003FFB // E5
+data8 0x3FE2788CFC6FB618, 0x3C8E52519B5B17CB // A1, A3L
+data8 0x80859B57C3E7F241, 0x00003FFC // E3
+data8 0xADA065880615F401, 0x00003FFC // E1
+data8 0xD45CE0BD530AB50E, 0x00003FFC // E0
+LOCAL_OBJECT_END(lgammal_03Q_1Q_data)
+
+LOCAL_OBJECT_START(lgammal_13Q_2Q_data)
+// Polynomial coefficients for the lgammal(x), 1.5625 <= |x| < 2.25
+data8 0x3F951322AC7D8483, 0x3C71873D88C6539D // A4, A2L
+data8 0xBFB13E001A557606, 0x3C56CB907018A101 // A3, A1L
+data8 0xBEC11B2EC1E7F6FC, 0x3EB0064ED9824CC7 // D2, D3
+data8 0xBEE3CBC963EC103A, 0x3ED2597A330C107D // D0, D1
+data8 0xBC6F2DEBDFE66F38, 0x0000BFF0 // E6
+data8 0x3FD4A34CC4A60FA6, 0x3C3AFC9BF775E8A0 // A2, A4L
+data8 0x3E48B0C542F85B32, 0xBE347F12EAF787AB // C17, C20
+data8 0xE9FEA63B6984FA1E, 0x0000BFF2 // E4
+data8 0x9C562E15FC703BBF, 0x0000BFF5 // E2
+data8 0xBE3C12A50AB0355E, 0xBE1C941626AE4717 // C18, C19
+data8 0xBE7AFA8714342BC4,0x3E69A12D2B7761CB // D6, D7
+data8 0xBE9E25EF1D526730, 0x3E8C762291889B99 // D4, D5
+data8 0x3EF580DCEE754733, 0xBE57C811D070549C // E7, C16
+data8 0xD093D878BE209C98, 0x00003FF1 // E5
+data8 0x3FDB0EE6072093CE, 0xBC6024B9E81281C4 // A1, A3L
+data8 0x859B57C31CB77D96, 0x00003FF4 // E3
+data8 0xBD6EB756DB617E8D, 0x00003FF6 // E1
+data8 0xF2027E10C7AF8C38, 0x0000BFF7 // E0
+LOCAL_OBJECT_END(lgammal_13Q_2Q_data)
+
+LOCAL_OBJECT_START(lgammal_8_10_data)
+// Polynomial coefficients for the lgammal(x), 8.0 <= |x| < 10.0
+// Multi Precision terms
+data8 0x40312008A3A23E5C, 0x3CE020B4F2E4083A //A1
+data8 0x4025358E82FCB70C, 0x3CD4A5A74AF7B99C //A0
+// Native precision terms
+data8 0xF0AA239FFBC616D2, 0x00004000 //A2
+data8 0x96A8EA798FE57D66, 0x0000BFFF //A3
+data8 0x8D501B7E3B9B9BDB, 0x00003FFE //A4
+data8 0x9EE062401F4B1DC2, 0x0000BFFD //A5
+data8 0xC63FD8CD31E93431, 0x00003FFC //A6
+data8 0x8461101709C23C30, 0x0000BFFC //A7
+data8 0xB96D7EA7EF3648B2, 0x00003FFB //A8
+data8 0x86886759D2ACC906, 0x0000BFFB //A9
+data8 0xC894B6E28265B183, 0x00003FFA //A10
+data8 0x98C4348CAD821662, 0x0000BFFA //A11
+data8 0xEC9B092226A94DF2, 0x00003FF9 //A12
+data8 0xB9F169FF9B98CDDC, 0x0000BFF9 //A13
+data8 0x9A3A32BB040894D3, 0x00003FF9 //A14
+data8 0xF9504CCC1003B3C3, 0x0000BFF8 //A15
+LOCAL_OBJECT_END(lgammal_8_10_data)
+
+LOCAL_OBJECT_START(lgammal_03Q_6_data)
+// Polynomial coefficients for the lgammal(x), 0.75 <= |x| < 1.0
+data8 0xBFBC47DCA479E295, 0xBC607E6C1A379D55 //A3
+data8 0x3FCA051C372609ED, 0x3C7B02D73EB7D831 //A0
+data8 0xBFE15FAFA86B04DB, 0xBC3F52EE4A8945B5 //A1
+data8 0x3FD455C4FF28F0BF, 0x3C75F8C6C99F30BB //A2
+data8 0xD2CF04CD934F03E1, 0x00003FFA //A4
+data8 0xDB4ED667E29256E1, 0x0000BFF9 //A5
+data8 0xF155A33A5B6021BF, 0x00003FF8 //A6
+data8 0x895E9B9D386E0338, 0x0000BFF8 //A7
+data8 0xA001BE94B937112E, 0x00003FF7 //A8
+data8 0xBD82846E490ED048, 0x0000BFF6 //A9
+data8 0xE358D24EC30DBB5D, 0x00003FF5 //A10
+data8 0x89C4F3652446B78B, 0x0000BFF5 //A11
+data8 0xA86043E10280193D, 0x00003FF4 //A12
+data8 0xCF3A2FBA61EB7682, 0x0000BFF3 //A13
+data8 0x3F300900CC9200EC //A14
+data8 0xBF23F42264B94AE8 //A15
+data8 0x3F18EEF29895FE73 //A16
+data8 0xBF0F3C4563E3EDFB //A17
+data8 0x3F0387DBBC385056 //A18
+data8 0xBEF81B4004F92900 //A19
+data8 0x3EECA6692A9A5B81 //A20
+data8 0xBEDF61A0059C15D3 //A21
+data8 0x3ECDA9F40DCA0111 //A22
+data8 0xBEB60FE788217BAF //A23
+data8 0x3E9661D795DFC8C6 //A24
+data8 0xBE66C7756A4EDEE5 //A25
+// Polynomial coefficients for the lgammal(x), 1.0 <= |x| < 2.0
+data8 0xBFC1AE55B180726B, 0xBC7DE1BC478453F5 //A3
+data8 0xBFBEEB95B094C191, 0xBC53456FF6F1C9D9 //A0
+data8 0x3FA2AED059BD608A, 0x3C0B65CC647D557F //A1
+data8 0x3FDDE9E64DF22EF2, 0x3C8993939A8BA8E4 //A2
+data8 0xF07C206D6B100CFF, 0x00003FFA //A4
+data8 0xED2CEA9BA52FE7FB, 0x0000BFF9 //A5
+data8 0xFCE51CED52DF3602, 0x00003FF8 //A6
+data8 0x8D45D27872326619, 0x0000BFF8 //A7
+data8 0xA2B78D6BCEBE27F7, 0x00003FF7 //A8
+data8 0xBF6DC0996A895B6F, 0x0000BFF6 //A9
+data8 0xE4B9AD335AF82D79, 0x00003FF5 //A10
+data8 0x8A451880195362A1, 0x0000BFF5 //A11
+data8 0xA8BE35E63089A7A9, 0x00003FF4 //A12
+data8 0xCF7FA175FA11C40C, 0x0000BFF3 //A13
+data8 0x3F300C282FAA3B02 //A14
+data8 0xBF23F6AEBDA68B80 //A15
+data8 0x3F18F6860E2224DD //A16
+data8 0xBF0F542B3CE32F28 //A17
+data8 0x3F039436218C9BF8 //A18
+data8 0xBEF8AE6307677AEC //A19
+data8 0x3EF0B55527B3A211 //A20
+data8 0xBEE576AC995E7605 //A21
+data8 0x3ED102DDC1365D2D //A22
+data8 0xBEC442184F97EA54 //A23
+data8 0x3ED4D2283DFE5FC6 //A24
+data8 0xBECB9219A9B46787 //A25
+// Polynomial coefficients for the lgammal(x), 2.0 <= |x| < 3.0
+data8 0xBFCA4D55BEAB2D6F, 0xBC66F80E5BFD5AF5 //A3
+data8 0x3FE62E42FEFA39EF, 0x3C7ABC9E3B347E3D //A0
+data8 0x3FFD8773039049E7, 0x3C66CB9007C426EA //A1
+data8 0x3FE94699894C1F4C, 0x3C918726EB111663 //A2
+data8 0xA264558FB0906209, 0x00003FFB //A4
+data8 0x94D6C50FEB902ADC, 0x0000BFFA //A5
+data8 0x9620656184243D17, 0x00003FF9 //A6
+data8 0xA0D0983B8BCA910B, 0x0000BFF8 //A7
+data8 0xB36AF8559B222BD3, 0x00003FF7 //A8
+data8 0xCE0DACB3260AE6E5, 0x0000BFF6 //A9
+data8 0xF1C2C0BF0437C7DB, 0x00003FF5 //A10
+data8 0x902A2F2F3AB74A92, 0x0000BFF5 //A11
+data8 0xAE05009B1B2C6E4C, 0x00003FF4 //A12
+data8 0xD5B71F6456D7D4CB, 0x0000BFF3 //A13
+data8 0x3F2F0351D71BC9C6 //A14
+data8 0xBF2B53BC56A3B793 //A15
+data8 0xBF18B12DC6F6B861 //A16
+data8 0xBF43EE6EB5215C2F //A17
+data8 0xBF5474787CDD455E //A18
+data8 0xBF642B503C9C060A //A19
+data8 0xBF6E07D1AA254AA3 //A20
+data8 0xBF71C785443AAEE8 //A21
+data8 0xBF6F67BF81B71052 //A22
+data8 0xBF63E4BCCF4FFABF //A23
+data8 0xBF50067F8C671D5A //A24
+data8 0xBF29C770D680A5AC //A25
+// Polynomial coefficients for the lgammal(x), 4.0 <= |x| < 6.0
+data8 0xBFD6626BC9B31B54, 0xBC85AABE08680902 //A3
+data8 0x401326643C4479C9, 0x3CAA53C26F31E364 //A0
+data8 0x401B4C420A50AD7C, 0x3C8C76D55E57DD8D //A1
+data8 0x3FF735973273D5EC, 0x3C83A0B78E09188A //A2
+data8 0x81310136363AAB6D, 0x00003FFC //A4
+data8 0xDF1BD44C4075C0E6, 0x0000BFFA //A5
+data8 0xD58389FE38D8D664, 0x00003FF9 //A6
+data8 0xDA62C7221D5B5F87, 0x0000BFF8 //A7
+data8 0xE9F92CAD0263E157, 0x00003FF7 //A8
+data8 0x81ACCB8606C165FE, 0x0000BFF7 //A9
+data8 0x9382D8D263D1C2A3, 0x00003FF6 //A10
+data8 0xAB3CCBA4C853B12C, 0x0000BFF5 //A11
+data8 0xCA0818BBCCC59296, 0x00003FF4 //A12
+data8 0xF18912691CBB5BD0, 0x0000BFF3 //A13
+data8 0x3F323EF5D8330339 //A14
+data8 0xBF2641132EA571F7 //A15
+data8 0x3F1B5D9576175CA9 //A16
+data8 0xBF10F56A689C623D //A17
+data8 0x3F04CACA9141A18D //A18
+data8 0xBEFA307AC9B4E85D //A19
+data8 0x3EF4B625939FBE32 //A20
+data8 0xBECEE6AC1420F86F //A21
+data8 0xBE9A95AE2E485964 //A22
+data8 0xBF039EF47F8C09BB //A23
+data8 0xBF05345957F7B7A9 //A24
+data8 0xBEF85AE6385D4CCC //A25
+// Polynomial coefficients for the lgammal(x), 3.0 <= |x| < 4.0
+data8 0xBFCA4D55BEAB2D6F, 0xBC667B20FF46C6A8 //A3
+data8 0x3FE62E42FEFA39EF, 0x3C7ABC9E3B398012 //A0
+data8 0x3FFD8773039049E7, 0x3C66CB9070238D77 //A1
+data8 0x3FE94699894C1F4C, 0x3C91873D8839B1CD //A2
+data8 0xA264558FB0906D7E, 0x00003FFB //A4
+data8 0x94D6C50FEB8AFD72, 0x0000BFFA //A5
+data8 0x9620656185B68F14, 0x00003FF9 //A6
+data8 0xA0D0983B34B7088A, 0x0000BFF8 //A7
+data8 0xB36AF863964AA440, 0x00003FF7 //A8
+data8 0xCE0DAAFB5497AFB8, 0x0000BFF6 //A9
+data8 0xF1C2EAFA79CC2864, 0x00003FF5 //A10
+data8 0x9028922A839572B8, 0x0000BFF5 //A11
+data8 0xAE1E62F870BA0278, 0x00003FF4 //A12
+data8 0xD4726F681E2ABA29, 0x0000BFF3 //A13
+data8 0x3F30559B9A02FADF //A14
+data8 0xBF243ADEB1266CAE //A15
+data8 0x3F19303B6F552603 //A16
+data8 0xBF0F768C288EC643 //A17
+data8 0x3F039D5356C21DE1 //A18
+data8 0xBEF81BCA8168E6BE //A19
+data8 0x3EEC74A53A06AD54 //A20
+data8 0xBEDED52D1A5DACDF //A21
+data8 0x3ECCB4C2C7087342 //A22
+data8 0xBEB4F1FAFDFF5C2F //A23
+data8 0x3E94C80B52D58904 //A24
+data8 0xBE64A328CBE92A27 //A25
+LOCAL_OBJECT_END(lgammal_03Q_6_data)
+
+LOCAL_OBJECT_START(lgammal_1pEps_data)
+// Polynomial coefficients for the lgammal(x), 1 - 2^(-7) <= |x| < 1 + 2^(-7)
+data8 0x93C467E37DB0C7A5, 0x00003FFE //A1
+data8 0xD28D3312983E9919, 0x00003FFE //A2
+data8 0xCD26AADF559A47E3, 0x00003FFD //A3
+data8 0x8A8991563EC22E81, 0x00003FFD //A4
+data8 0x3FCA8B9C168D52FE //A5
+data8 0x3FC5B40CB0696370 //A6
+data8 0x3FC270AC2229A65D //A7
+data8 0x3FC0110AF10FCBFC //A8
+// Polynomial coefficients for the log1p(x), - 2^(-7) <= |x| <  2^(-7)
+data8 0x3FBC71C71C71C71C //P8
+data8 0xBFC0000000000000 //P7
+data8 0x3FC2492492492492 //P6
+data8 0xBFC5555555555555 //P5
+data8 0x3FC999999999999A //P4
+data8 0xBFD0000000000000 //P3
+data8 0x3FD5555555555555 //P2
+data8 0xBFE0000000000000 //P1
+// short version of "lnsin" polynomial
+data8 0xD28D3312983E9918, 0x00003FFF //A2
+data8 0x8A8991563EC241B6, 0x00003FFE //A4
+data8 0xADA06588061830A5, 0x00003FFD //A6
+data8 0x80859B57C31CB746, 0x00003FFD //A8
+LOCAL_OBJECT_END(lgammal_1pEps_data)
+
+LOCAL_OBJECT_START(lgammal_neg2andHalf_data)
+// Polynomial coefficients for the lgammal(x), -2.005859375 <= x < -2.5
+data8 0xBF927781D4BB093A, 0xBC511D86D85B7045 // A3, A0L
+data8 0x3FF1A68793DEFC15, 0x3C9852AE2DA7DEEF // A1, A1L
+data8 0x408555562D45FAFD, 0xBF972CDAFE5FEFAD // D0, D1
+data8 0xC18682331EF492A5, 0xC1845E3E0D29606B // C20, C21
+data8 0x4013141822E16979, 0x3CCF8718B6E75F6C // A2, A2L
+data8 0xBFACCBF9F5ED0F15, 0xBBDD1AEB73297401 // A0, A3L
+data8 0xCCCDB17423046445, 0x00004006 // E6
+data8 0x800514E230A3A452, 0x00004005 // E4
+data8 0xAAE9A48EC162E76F, 0x00004003 // E2
+data8 0x81D4F88B3F3EA0FC, 0x00004002 // E0
+data8 0x40CF3F3E35238DA0, 0xC0F8B340945F1A7E // D6, D7
+data8 0x40BF89EC0BD609C6, 0xC095897242AEFEE2 // D4, D5
+data8 0x40A2482FF01DBC5C, 0xC02095E275FDCF62 // D2, D3
+data8 0xC1641354F2312A6A, 0xC17B3657F85258E9 // C18, C19
+data8 0xC11F964E9ECBE2C9, 0xC146D7A90F70696C // C16, C17
+data8 0xE7AECDE6AF8EA816, 0x0000BFEF // E7
+data8 0xD711252FEBBE1091, 0x0000BFEB // E5
+data8 0xE648BD10F8C43391, 0x0000BFEF // E3
+data8 0x948A1E78AA00A98D, 0x0000BFF4 // E1
+LOCAL_OBJECT_END(lgammal_neg2andHalf_data)
+
+LOCAL_OBJECT_START(lgammal_near_neg_half_data)
+// Polynomial coefficients for the lgammal(x), -0.5 < x < -0.40625
+data8 0xBFC1AE55B180726C, 0x3C8053CD734E6A1D // A3, A0L
+data8 0x3FA2AED059BD608A, 0x3C0CD3D2CDBA17F4 // A1, A1L
+data8 0x40855554DBCD1E1E, 0x3F96C51AC2BEE9E1 // D0, D1
+data8 0xC18682331EF4927D, 0x41845E3E0D295DFC // C20, C21
+data8 0x4011DE9E64DF22EF, 0x3CA692B70DAD6B7B // A2, A2L
+data8 0x3FF43F89A3F0EDD6, 0xBC4955AED0FA087D // A0, A3L
+data8 0xCCCD3F1DF4A2C1DD, 0x00004006 // E6
+data8 0x80028ADE33C7FCD9, 0x00004005 // E4
+data8 0xAACA474E485507EF, 0x00004003 // E2
+data8 0x80F07C206D6B0ECD, 0x00004002 // E0
+data8 0x40CF3F3E33E83056, 0x40F8B340944633D9 // D6, D7
+data8 0x40BF89EC059931F0, 0x409589723307AD20 // D4, D5
+data8 0x40A2482FD0054824, 0x402095CE7F19D011 // D2, D3
+data8 0xC1641354F2313614, 0x417B3657F8525354 // C18, C19
+data8 0xC11F964E9ECFD21C, 0x4146D7A90F701836 // C16, C17
+data8 0x86A9C01F0EA11E5A, 0x0000BFF5 // E7
+data8 0xBF6D8469142881C0, 0x0000BFF6 // E5
+data8 0x8D45D277BA8255F1, 0x0000BFF8 // E3
+data8 0xED2CEA9BA528BCC3, 0x0000BFF9 // E1
+LOCAL_OBJECT_END(lgammal_near_neg_half_data)
+
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+////////////// POLYNOMIAL COEFFICIENTS FOR "NEAR ROOTS" RANGES    /////////////
+////////////// THIS PART OF TABLE SHOULD BE ADDRESSED REALLY RARE /////////////
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+LOCAL_OBJECT_START(lgammal_right_roots_polynomial_data)
+// Polynomial coefficients for right root on [-3, -2]
+// Lgammal is aproximated by polynomial within [-.056244 ; .158208 ] range
+data8 0xBBBD5E9DCD11030B, 0xB867411D9FF87DD4 //A0
+data8 0x3FF83FE966AF535E, 0x3CAA21235B8A769A //A1
+data8 0x40136EEBB002F55C, 0x3CC3959A6029838E //A2
+data8 0xB4A5302C53C2BEDD, 0x00003FFF //A3
+data8 0x8B8C6BE504F2DA1C, 0x00004002 //A4
+data8 0xB99CFF02593B4D98, 0x00004001 //A5
+data8 0x4038D32F682AA1CF //A6
+data8 0x403809F04EE6C5B5 //A7
+data8 0x40548EAA81634CEE //A8
+data8 0x4059297ADB6BC03D //A9
+data8 0x407286FB8EC5C9DA //A10
+data8 0x407A92E05B744CFB //A11
+data8 0x4091A9D4144258CD //A12
+data8 0x409C4D01D24F367E //A13
+data8 0x40B1871B9A426A83 //A14
+data8 0x40BE51C48BD9A583 //A15
+data8 0x40D2140D0C6153E7 //A16
+data8 0x40E0FB2C989CE4A3 //A17
+data8 0x40E52739AB005641 //A18
+data8 0x41161E3E6DDF503A //A19
+// Polynomial coefficients for right root on [-4, -3]
+// Lgammal is aproximated by polynomial within [-.172797 ; .171573 ] range
+data8 0x3C172712B248E42E, 0x38CB8D17801A5D67 //A0
+data8 0x401F20A65F2FAC54, 0x3CCB9EA1817A824E //A1
+data8 0x4039D4D2977150EF, 0x3CDA42E149B6276A //A2
+data8 0xE089B8926AE2D9CB, 0x00004005 //A3
+data8 0x933901EBBB586C37, 0x00004008 //A4
+data8 0xCCD319BED1CFA1CD, 0x0000400A //A5
+data8 0x40D293C3F78D3C37 //A6
+data8 0x40FBB97AA0B6DD02 //A7
+data8 0x41251EA3345E5EB9 //A8
+data8 0x415057F65C92E7B0 //A9
+data8 0x41799C865241B505 //A10
+data8 0x41A445209EFE896B //A11
+data8 0x41D02D21880C953B //A12
+data8 0x41F9FFDE8C63E16D //A13
+data8 0x422504DC8302D2BE //A14
+data8 0x425111BF18C95414 //A15
+data8 0x427BCBE74A2B8EF7 //A16
+data8 0x42A7256F59B286F7 //A17
+data8 0x42D462D1586DE61F //A18
+data8 0x42FBB1228D6C5118 //A19
+// Polynomial coefficients for right root on [-5, -4]
+// Lgammal is aproximated by polynomial within [-.163171 ; .161988 ] range
+data8 0x3C5840FBAFDEE5BB, 0x38CAC0336E8C490A //A0
+data8 0x403ACA5CF4921642, 0x3CCEDCDDA5491E56 //A1
+data8 0x40744415CD813F8E, 0x3CFBFEBC17E39146 //A2
+data8 0xAACD88D954E3E1BD, 0x0000400B //A3
+data8 0xCB68C710D75ED802, 0x0000400F //A4
+data8 0x8130F5AB997277AC, 0x00004014 //A5
+data8 0x41855E3DBF99EBA7 //A6
+data8 0x41CD14FE49C49FC2 //A7
+data8 0x421433DCE281F07D //A8
+data8 0x425C8399C7A92B6F //A9
+data8 0x42A45FBE67840F1A //A10
+data8 0x42ED68D75F9E6C98 //A11
+data8 0x433567291C27E5BE //A12
+data8 0x437F5ED7A9D9FD28 //A13
+data8 0x43C720A65C8AB711 //A14
+data8 0x441120A6C1D40B9B //A15
+data8 0x44596F561F2D1CBE //A16
+data8 0x44A3507DA81D5C01 //A17
+data8 0x44EF06A31E39EEDF //A18
+data8 0x45333774C99F523F //A19
+// Polynomial coefficients for right root on [-6, -5]
+// Lgammal is aproximated by polynomial within [-.156450 ; .156126 ] range
+data8 0x3C71B82D6B2B3304, 0x3917186E3C0DC231 //A0
+data8 0x405ED72E0829AE02, 0x3C960C25157980EB //A1
+data8 0x40BCECC32EC22F9B, 0x3D5D8335A32F019C //A2
+data8 0x929EC2B1FB931F17, 0x00004012 //A3
+data8 0xD112EF96D37316DE, 0x00004018 //A4
+data8 0x9F00BB9BB13416AB, 0x0000401F //A5
+data8 0x425F7D8D5BDCB223 //A6
+data8 0x42C9A8D00C776CC6 //A7
+data8 0x433557FD8C481424 //A8
+data8 0x43A209221A953EF0 //A9
+data8 0x440EDC98D5618AB7 //A10
+data8 0x447AABD25E367378 //A11
+data8 0x44E73DE20CC3B288 //A12
+data8 0x455465257B4E0BD8 //A13
+data8 0x45C2011532085353 //A14
+data8 0x462FEE4CC191945B //A15
+data8 0x469C63AEEFEF0A7F //A16
+data8 0x4709D045390A3810 //A17
+data8 0x4778D360873C9F64 //A18
+data8 0x47E26965BE9A682A //A19
+// Polynomial coefficients for right root on [-7, -6]
+// Lgammal is aproximated by polynomial within [-.154582 ; .154521 ] range
+data8 0x3C75F103A1B00A48, 0x391C041C190C726D //A0
+data8 0x40869DE49E3AF2AA, 0x3D1C17E1F813063B //A1
+data8 0x410FCE23484CFD10, 0x3DB6F38C2F11DAB9 //A2
+data8 0xEF281D1E1BE2055A, 0x00004019 //A3
+data8 0xFCE3DA92AC55DFF8, 0x00004022 //A4
+data8 0x8E9EA838A20BD58E, 0x0000402C //A5
+data8 0x4354F21E2FB9E0C9 //A6
+data8 0x43E9500994CD4F09 //A7
+data8 0x447F3A2C23C033DF //A8
+data8 0x45139152656606D8 //A9
+data8 0x45A8D45F8D3BF2E8 //A10
+data8 0x463FD32110E5BFE5 //A11
+data8 0x46D490B3BDBAE0BE //A12
+data8 0x476AC3CAD905DD23 //A13
+data8 0x48018558217AD473 //A14
+data8 0x48970AF371D30585 //A15
+data8 0x492E6273A8BEFFE3 //A16
+data8 0x49C47CC9AE3F1073 //A17
+data8 0x4A5D38E8C35EFF45 //A18
+data8 0x4AF0123E89694CD8 //A19
+// Polynomial coefficients for right root on [-8, -7]
+// Lgammal is aproximated by polynomial within [-.154217 ; .154208 ] range
+data8 0xBCD2507D818DDD68, 0xB97F6940EA2871A0 //A0
+data8 0x40B3B407AA387BCB, 0x3D6320238F2C43D1 //A1
+data8 0x41683E85DAAFBAC7, 0x3E148D085958EA3A //A2
+data8 0x9F2A95AF1E10A548, 0x00004022 //A3
+data8 0x92F21522F482300E, 0x0000402E //A4
+data8 0x90B51AB03A1F244D, 0x0000403A //A5
+data8 0x44628E1C70EF534F //A6
+data8 0x452393E2BC32D244 //A7
+data8 0x45E5164141F4BA0B //A8
+data8 0x46A712B3A8AF5808 //A9
+data8 0x47698FD36CEDD0F2 //A10
+data8 0x482C9AE6BBAA3637 //A11
+data8 0x48F023821857C8E9 //A12
+data8 0x49B2569053FC106F //A13
+data8 0x4A74F646D5C1604B //A14
+data8 0x4B3811CF5ABA4934 //A15
+data8 0x4BFBB5DD6C84E233 //A16
+data8 0x4CC05021086F637B //A17
+data8 0x4D8450A345B0FB49 //A18
+data8 0x4E43825848865DB2 //A19
+// Polynomial coefficients for right root on [-9, -8]
+// Lgammal is aproximated by polynomial within [-.154160 ; .154158 ] range
+data8 0x3CDF4358564F2B46, 0x397969BEE6042F81 //A0
+data8 0x40E3B088FED67721, 0x3D82787BA937EE85 //A1
+data8 0x41C83A3893550EF4, 0x3E542ED57E244DA8 //A2
+data8 0x9F003C6DC56E0B8E, 0x0000402B //A3
+data8 0x92BDF64A3213A699, 0x0000403A //A4
+data8 0x9074F503AAD417AF, 0x00004049 //A5
+data8 0x4582843E1313C8CD //A6
+data8 0x467387BD6A7826C1 //A7
+data8 0x4765074E788CF440 //A8
+data8 0x4857004DD9D1E09D //A9
+data8 0x4949792ED7530EAF //A10
+data8 0x4A3C7F089A292ED3 //A11
+data8 0x4B30125BF0AABB86 //A12
+data8 0x4C224175195E307E //A13
+data8 0x4D14DC4C8B32C08D //A14
+data8 0x4E07F1DB2786197E //A15
+data8 0x4EFB8EA1C336DACB //A16
+data8 0x4FF03797EACD0F23 //A17
+data8 0x50E4304A8E68A730 //A18
+data8 0x51D3618FB2EC9F93 //A19
+// Polynomial coefficients for right root on [-10, -9]
+// Lgammal is aproximated by polynomial within [-.154152 ; .154152 ] range
+data8 0x3D42F34DA97ECF0C, 0x39FD1256F345B0D0 //A0
+data8 0x4116261203919787, 0x3DC12D44055588EB //A1
+data8 0x422EA8F32FB7FE99, 0x3ED849CE4E7B2D77 //A2
+data8 0xE25BAF73477A57B5, 0x00004034 //A3
+data8 0xEB021FD10060504A, 0x00004046 //A4
+data8 0x8220A208EE206C5F, 0x00004059 //A5
+data8 0x46B2C3903EC9DA14 //A6
+data8 0x47D64393744B9C67 //A7
+data8 0x48FAF79CCDC604DD //A8
+data8 0x4A20975DB8061EBA //A9
+data8 0x4B44AB9CBB38DB21 //A10
+data8 0x4C6A032F60094FE9 //A11
+data8 0x4D908103927634B4 //A12
+data8 0x4EB516CA21D30861 //A13
+data8 0x4FDB1BF12C58D318 //A14
+data8 0x510180AAE094A553 //A15
+data8 0x5226A8F2A2D45D57 //A16
+data8 0x534E00B6B0C8B809 //A17
+data8 0x5475022FE21215B2 //A18
+data8 0x5596B02BF6C5E19B //A19
+// Polynomial coefficients for right root on [-11, -10]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0x3D7AA9C2E2B1029C, 0x3A15FB37578544DB //A0
+data8 0x414BAF825A0C91D4, 0x3DFB9DA2CE398747 //A1
+data8 0x4297F3EC8AE0AF03, 0x3F34208B55FB8781 //A2
+data8 0xDD0C97D3197F56DE, 0x0000403E //A3
+data8 0x8F6F3AF7A5499674, 0x00004054 //A4
+data8 0xC68DA1AF6D878EEB, 0x00004069 //A5
+data8 0x47F1E4E1E2197CE0 //A6
+data8 0x494A8A28E597C3EB //A7
+data8 0x4AA4175D0D35D705 //A8
+data8 0x4BFEE6F0AF69E814 //A9
+data8 0x4D580FE7B3DBB3C6 //A10
+data8 0x4EB2ECE60E4608AF //A11
+data8 0x500E04BE3E2B4F24 //A12
+data8 0x5167F9450F0FB8FD //A13
+data8 0x52C342BDE747603F //A14
+data8 0x541F1699D557268C //A15
+data8 0x557927C5F079864E //A16
+data8 0x56D4D10FEEDB030C //A17
+data8 0x5832385DF86AD28A //A18
+data8 0x598898914B4D6523 //A19
+// Polynomial coefficients for right root on [-12, -11]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0xBD96F61647C58B03, 0xBA3ABB0C2A6C755B //A0
+data8 0x418308A82714B70D, 0x3E1088FC6A104C39 //A1
+data8 0x4306A493DD613C39, 0x3FB2341ECBF85741 //A2
+data8 0x8FA8FE98339474AB, 0x00004049 //A3
+data8 0x802CCDF570BA7942, 0x00004062 //A4
+data8 0xF3F748AF11A32890, 0x0000407A //A5
+data8 0x493E3B567EF178CF //A6
+data8 0x4ACED38F651BA362 //A7
+data8 0x4C600B357337F946 //A8
+data8 0x4DF0F71A52B54CCF //A9
+data8 0x4F8229F3B9FA2C70 //A10
+data8 0x5113A4C4979B770E //A11
+data8 0x52A56BC367F298D5 //A12
+data8 0x543785CF31842DC0 //A13
+data8 0x55C9FC37E3E40896 //A14
+data8 0x575CD5D1BA556C82 //A15
+data8 0x58F00A7AD99A9E08 //A16
+data8 0x5A824088688B008D //A17
+data8 0x5C15F75EF7E08EBD //A18
+data8 0x5DA462EA902F0C90 //A19
+// Polynomial coefficients for right root on [-13, -12]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0x3DC3191752ACFC9D, 0x3A26CB6629532DBF //A0
+data8 0x41BC8CFC051191BD, 0x3E68A84DA4E62AF2 //A1
+data8 0x43797926294A0148, 0x400F345FF3723CFF //A2
+data8 0xF26D2AF700B82625, 0x00004053 //A3
+data8 0xA238B24A4B1F7B15, 0x00004070 //A4
+data8 0xE793B5C0A41A264F, 0x0000408C //A5
+data8 0x4A9585BDDACE863D //A6
+data8 0x4C6075953448088A //A7
+data8 0x4E29B2F38D1FC670 //A8
+data8 0x4FF4619B079C440F //A9
+data8 0x51C05DAE118D8AD9 //A10
+data8 0x538A8C7F87326AD4 //A11
+data8 0x5555B6937588DAB3 //A12
+data8 0x5721E1F8B6E6A7DB //A13
+data8 0x58EDA1D7A77DD6E5 //A14
+data8 0x5AB8A9616B7DC9ED //A15
+data8 0x5C84942AA209ED17 //A16
+data8 0x5E518FC34C6F54EF //A17
+data8 0x601FB3F17BCCD9A0 //A18
+data8 0x61E61128D512FE97 //A1
+// Polynomial coefficients for right root on [-14, -13]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0xBE170D646421B3F5, 0xBAAD95F79FCB5097 //A0
+data8 0x41F7328CBFCD9AC7, 0x3E743B8B1E8AEDB1 //A1
+data8 0x43F0D0FA2DBDA237, 0x40A0422D6A227B55 //A2
+data8 0x82082DF2D32686CC, 0x0000405F //A3
+data8 0x8D64EE9B42E68B43, 0x0000407F //A4
+data8 0xA3FFD82E08C5F1F1, 0x0000409F //A5
+data8 0x4BF8C49D99123454 //A6
+data8 0x4DFEC79DDF11342F //A7
+data8 0x50038615A892F6BD //A8
+data8 0x520929453DB32EF1 //A9
+data8 0x54106A7808189A7F //A10
+data8 0x5615A302D03C207B //A11
+data8 0x581CC175AA736F5E //A12
+data8 0x5A233E071147C017 //A13
+data8 0x5C29E81917243F22 //A14
+data8 0x5E3184B0B5AC4707 //A15
+data8 0x6037C11DE62D8388 //A16
+data8 0x6240787C4B1C9D6C //A17
+data8 0x6448289235E80977 //A18
+data8 0x664B5352C6C3449E //A19
+// Polynomial coefficients for right root on [-15, -14]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0x3E562C2E34A9207D, 0x3ADC00DA3DFF7A83 //A0
+data8 0x42344C3B2F0D90AB, 0x3EB8A2E979F24536 //A1
+data8 0x4469BFFF28B50D07, 0x41181E3D05C1C294 //A2
+data8 0xAE38F64DCB24D9F8, 0x0000406A //A3
+data8 0xA5C3F52C1B350702, 0x0000408E //A4
+data8 0xA83BC857BCD67A1B, 0x000040B2 //A5
+data8 0x4D663B4727B4D80A //A6
+data8 0x4FA82C965B0F7788 //A7
+data8 0x51EAD58C02908D95 //A8
+data8 0x542E427970E073D8 //A9
+data8 0x56714644C558A818 //A10
+data8 0x58B3EC2040C77BAE //A11
+data8 0x5AF72AE6A83D45B1 //A12
+data8 0x5D3B214F611F5D12 //A13
+data8 0x5F7FF5E49C54E92A //A14
+data8 0x61C2E917AB765FB2 //A15
+data8 0x64066FD70907B4C1 //A16
+data8 0x664B3998D60D0F9B //A17
+data8 0x689178710782FA8B //A18
+data8 0x6AD14A66C1C7BEC3 //A19
+// Polynomial coefficients for right root on [-16, -15]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0xBE6D7E7192615BAE, 0xBB0137677D7CC719 //A0
+data8 0x4273077763F6628C, 0x3F09250FB8FC8EC9 //A1
+data8 0x44E6A1BF095B1AB3, 0x4178D5A74F6CB3B3 //A2
+data8 0x8F8E0D5060FCC76E, 0x00004076 //A3
+data8 0x800CC1DCFF092A63, 0x0000409E //A4
+data8 0xF3AB0BA9D14CDA72, 0x000040C5 //A5
+data8 0x4EDE3000A2F6D54F //A6
+data8 0x515EC613B9C8E241 //A7
+data8 0x53E003309FEEEA96 //A8
+data8 0x5660ED908D7C9A90 //A9
+data8 0x58E21E9B517B1A50 //A10
+data8 0x5B639745E4374EE2 //A11
+data8 0x5DE55BB626B2075D //A12
+data8 0x606772B7506BA747 //A13
+data8 0x62E9E581AB2E057B //A14
+data8 0x656CBAD1CF85D396 //A15
+data8 0x67EFF4EBD7989872 //A16
+data8 0x6A722D2B19B7E2F9 //A17
+data8 0x6CF5DEB3073B0743 //A18
+data8 0x6F744AC11550B93A //A19
+// Polynomial coefficients for right root on [-17, -16]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0xBEDCC6291188207E, 0xBB872E3FDD48F5B7 //A0
+data8 0x42B3076EE7525EF9, 0x3F6687A5038CA81C //A1
+data8 0x4566A1AAD96EBCB5, 0x421F0FEDFBF548D2 //A2
+data8 0x8F8D4D3DE9850DBA, 0x00004082 //A3
+data8 0x800BDD6DA2CE1859, 0x000040AE //A4
+data8 0xF3A8EC4C9CDC1CE5, 0x000040D9 //A5
+data8 0x505E2FAFDB812628 //A6
+data8 0x531EC5B3A7508719 //A7
+data8 0x55E002F77E99B628 //A8
+data8 0x58A0ED4C9B4DAE54 //A9
+data8 0x5B621E4A8240F90C //A10
+data8 0x5E2396E5C8849814 //A11
+data8 0x60E55B43D8C5CE71 //A12
+data8 0x63A7722F5D45D01D //A13
+data8 0x6669E4E010DCE45A //A14
+data8 0x692CBA120D5E78F6 //A15
+data8 0x6BEFF4045350B22E //A16
+data8 0x6EB22C9807C21819 //A17
+data8 0x7175DE20D04617C4 //A18
+data8 0x74344AB87C6D655F //A19
+// Polynomial coefficients for right root on [-18, -17]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0xBF28AEEE7B61D77C, 0xBBDBBB5FC57ABF79 //A0
+data8 0x42F436F56B3B8A0C, 0x3FA43EE3C5C576E9 //A1
+data8 0x45E98A22535D115D, 0x42984678BE78CC48 //A2
+data8 0xAC176F3775E6FCFC, 0x0000408E //A3
+data8 0xA3114F53A9FEB922, 0x000040BE //A4
+data8 0xA4D168A8334ABF41, 0x000040EE //A5
+data8 0x51E5B0E7EC7182BB //A6
+data8 0x54E77D67B876EAB6 //A7
+data8 0x57E9F7C30C09C4B6 //A8
+data8 0x5AED29B0488614CA //A9
+data8 0x5DF09486F87E79F9 //A10
+data8 0x60F30B199979654E //A11
+data8 0x63F60E02C7DCCC5F //A12
+data8 0x66F9B8A00EB01684 //A13
+data8 0x69FE2D3ED0700044 //A14
+data8 0x6D01C8363C7DCC84 //A15
+data8 0x700502B29C2F06E3 //A16
+data8 0x730962B4500F4A61 //A17
+data8 0x76103C6ED099192A //A18
+data8 0x79100C7132CFD6E3 //A19
+// Polynomial coefficients for right root on [-19, -18]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0x3F3C19A53328A0C3, 0x3BE04ADC3FBE1458 //A0
+data8 0x4336C16C16C16C19, 0x3FE58CE3AC4A7C28 //A1
+data8 0x46702E85C0898B70, 0x432C922E412CEC6E //A2
+data8 0xF57B99A1C034335D, 0x0000409A //A3
+data8 0x82EC9634223DF909, 0x000040CF //A4
+data8 0x94F66D7557E2EA60, 0x00004103 //A5
+data8 0x5376118B79AE34D0 //A6
+data8 0x56BAE7106D52E548 //A7
+data8 0x5A00BD48CC8E25AB //A8
+data8 0x5D4529722821B493 //A9
+data8 0x608B1654AF31BBC1 //A10
+data8 0x63D182CC98AEA859 //A11
+data8 0x6716D43D5EEB05E8 //A12
+data8 0x6A5DF884FC172E1C //A13
+data8 0x6DA3CA7EBB97976B //A14
+data8 0x70EA416D0BE6D2EF //A15
+data8 0x743176C31EBB65F2 //A16
+data8 0x7777C401A8715CF9 //A17
+data8 0x7AC1110C6D350440 //A18
+data8 0x7E02D0971CF84865 //A19
+// Polynomial coefficients for right root on [-20, -19]
+// Lgammal is aproximated by polynomial within [-.154151 ; .154151 ] range
+data8 0xBFAB767F9BE21803, 0xBC5ACEF5BB1BD8B5 //A0
+data8 0x4379999999999999, 0x4029241C7F5914C8 //A1
+data8 0x46F47AE147AE147A, 0x43AC2979B64B9D7E //A2
+data8 0xAEC33E1F67152993, 0x000040A7 //A3
+data8 0xD1B71758E219616F, 0x000040DF //A4
+data8 0x8637BD05AF6CF468, 0x00004118 //A5
+data8 0x55065E9F80F293DE //A6
+data8 0x588EADA78C44EE66 //A7
+data8 0x5C15798EE22DEF09 //A8
+data8 0x5F9E8ABFD644FA63 //A9
+data8 0x6325FD7FE29BD7CD //A10
+data8 0x66AFFC5C57E1F802 //A11
+data8 0x6A3774CD7D5C0181 //A12
+data8 0x6DC152724DE2A6FE //A13
+data8 0x7149BB138EB3D0C2 //A14
+data8 0x74D32FF8A70896C2 //A15
+data8 0x785D3749F9C72BD7 //A16
+data8 0x7BE5CCF65EBC4E40 //A17
+data8 0x7F641A891B5FC652 //A18
+data8 0x7FEFFFFFFFFFFFFF //A19
+LOCAL_OBJECT_END(lgammal_right_roots_polynomial_data)
+
+LOCAL_OBJECT_START(lgammal_left_roots_polynomial_data)
+// Polynomial coefficients for left root on [-3, -2]
+// Lgammal is aproximated by polynomial within [.084641 ; -.059553 ] range
+data8 0xBC0844590979B82E, 0xB8BC7CE8CE2ECC3B //A0
+data8 0xBFFEA12DA904B18C, 0xBC91A6B2BAD5EF6E //A1
+data8 0x4023267F3C265A51, 0x3CD7055481D03AED //A2
+data8 0xA0C2D618645F8E00, 0x0000C003 //A3
+data8 0xFA8256664F8CD2BE, 0x00004004 //A4
+data8 0xC2C422C103F57158, 0x0000C006 //A5
+data8 0x4084373F7CC70AF5 //A6
+data8 0xC0A12239BDD6BB95 //A7
+data8 0x40BDBA65E2709397 //A8
+data8 0xC0DA2D2504DFB085 //A9
+data8 0x40F758173CA5BF3C //A10
+data8 0xC11506C65C267E72 //A11
+data8 0x413318EE3A6B05FC //A12
+data8 0xC1517767F247DA98 //A13
+data8 0x41701237B4754D73 //A14
+data8 0xC18DB8A03BC5C3D8 //A15
+data8 0x41AB80953AC14A07 //A16
+data8 0xC1C9B7B76638D0A4 //A17
+data8 0x41EA727E3033E2D9 //A18
+data8 0xC20812C297729142 //A19
+//
+// Polynomial coefficients for left root on [-4, -3]
+// Lgammal is aproximated by polynomial within [.147147 ; -.145158 ] range
+data8 0xBC3130AE5C4F54DB, 0xB8ED23294C13398A //A0
+data8 0xC034B99D966C5646, 0xBCE2E5FE3BC3DBB9 //A1
+data8 0x406F76DEAE0436BD, 0x3D14974DDEC057BD //A2
+data8 0xE929ACEA5979BE96, 0x0000C00A //A3
+data8 0xF47C14F8A0D52771, 0x0000400E //A4
+data8 0x88B7BC036937481C, 0x0000C013 //A5
+data8 0x4173E8F3AB9FC266 //A6
+data8 0xC1B7DBBE062FB11B //A7
+data8 0x41FD2F76DE7A47A7 //A8
+data8 0xC242225FE53B124D //A9
+data8 0x4286D12AE2FBFA30 //A10
+data8 0xC2CCFFC267A3C4C0 //A11
+data8 0x431294E10008E014 //A12
+data8 0xC357FAC8C9A2DF6A //A13
+data8 0x439F2190AB9FAE01 //A14
+data8 0xC3E44C1D8E8C67C3 //A15
+data8 0x442A8901105D5A38 //A16
+data8 0xC471C4421E908C3A //A17
+data8 0x44B92CD4D59D6D17 //A18
+data8 0xC4FB3A078B5247FA //A19
+// Polynomial coefficients for left root on [-5, -4]
+// Lgammal is aproximated by polynomial within [.155671 ; -.155300 ] range
+data8 0xBC57BF3C6E8A94C1, 0xB902FB666934AC9E //A0
+data8 0xC05D224A3EF9E41F, 0xBCF6F5713913E440 //A1
+data8 0x40BB533C678A3955, 0x3D688E53E3C72538 //A2
+data8 0x869FBFF732E99B84, 0x0000C012 //A3
+data8 0xBA9537AD61392DEC, 0x00004018 //A4
+data8 0x89EAE8B1DEA06B05, 0x0000C01F //A5
+data8 0x425A8C5C53458D3C //A6
+data8 0xC2C5068B3ED6509B //A7
+data8 0x4330FFA575E99B4E //A8
+data8 0xC39BEC12DDDF7669 //A9
+data8 0x44073825725F74F9 //A10
+data8 0xC47380EBCA299047 //A11
+data8 0x44E084DD9B666437 //A12
+data8 0xC54C2DA6BF787ACF //A13
+data8 0x45B82D65C8D6FA42 //A14
+data8 0xC624D62113FE950A //A15
+data8 0x469200CC19B45016 //A16
+data8 0xC6FFDDC6DD938E2E //A17
+data8 0x476DD7C07184B9F9 //A18
+data8 0xC7D554A30085C052 //A19
+// Polynomial coefficients for left root on [-6, -5]
+// Lgammal is aproximated by polynomial within [.157425 ; -.157360 ] range
+data8 0x3C9E20A87C8B79F1, 0x39488BE34B2427DB //A0
+data8 0xC08661F6A43A5E12, 0xBD3D912526D759CC //A1
+data8 0x410F79DCB794F270, 0x3DB9BEE7CD3C1BF5 //A2
+data8 0xEB7404450D0005DB, 0x0000C019 //A3
+data8 0xF7AE9846DFE4D4AB, 0x00004022 //A4
+data8 0x8AF535855A95B6DA, 0x0000C02C //A5
+data8 0x43544D54E9FE240E //A6
+data8 0xC3E8684E40CE6CFC //A7
+data8 0x447DF44C1D803454 //A8
+data8 0xC512AC305439B2BA //A9
+data8 0x45A79226AF79211A //A10
+data8 0xC63E0DFF7244893A //A11
+data8 0x46D35216C3A83AF3 //A12
+data8 0xC76903BE0C390E28 //A13
+data8 0x48004A4DECFA4FD5 //A14
+data8 0xC8954FBD243DB8BE //A15
+data8 0x492BF3A31EB18DDA //A16
+data8 0xC9C2C6A864521F3A //A17
+data8 0x4A5AB127C62E8DA1 //A18
+data8 0xCAECF60EF3183C57 //A19
+// Polynomial coefficients for left root on [-7, -6]
+// Lgammal is aproximated by polynomial within [.157749 ; -.157739 ] range
+data8 0x3CC9B9E8B8D551D6, 0x3961813C8E1E10DB //A0
+data8 0xC0B3ABF7A5CEA91F, 0xBD55638D4BCB4CC4 //A1
+data8 0x4168349A25504236, 0x3E0287ECE50CCF76 //A2
+data8 0x9EC8ED6E4C219E67, 0x0000C022 //A3
+data8 0x9279EB1B799A3FF3, 0x0000402E //A4
+data8 0x90213EF8D9A5DBCF, 0x0000C03A //A5
+data8 0x4462775E857FB71C //A6
+data8 0xC52377E70B45FDBF //A7
+data8 0x45E4F3D28EDA8C28 //A8
+data8 0xC6A6E85571BD2D0B //A9
+data8 0x47695BB17E74DF74 //A10
+data8 0xC82C5AC0ED6A662F //A11
+data8 0x48EFF8159441C2E3 //A12
+data8 0xC9B22602C1B68AE5 //A13
+data8 0x4A74BA8CE7B34100 //A14
+data8 0xCB37C7E208482E4B //A15
+data8 0x4BFB5A1D57352265 //A16
+data8 0xCCC01CB3021212FF //A17
+data8 0x4D841613AC3431D1 //A18
+data8 0xCE431C9E9EE43AD9 //A19
+// Polynomial coefficients for left root on [-8, -7]
+// Lgammal is aproximated by polynomial within [.157799 ; -.157798 ] range
+data8 0xBCF9C7A33AD9478C, 0xB995B0470F11E5ED //A0
+data8 0xC0E3AF76FE4C2F8B, 0xBD8DBCD503250511 //A1
+data8 0x41C838E76CAAF0D5, 0x3E5D79F5E2E069C3 //A2
+data8 0x9EF345992B262CE0, 0x0000C02B //A3
+data8 0x92AE0292985FD559, 0x0000403A //A4
+data8 0x90615420C08F7D8C, 0x0000C049 //A5
+data8 0x45828139342CEEB7 //A6
+data8 0xC67384066C31E2D3 //A7
+data8 0x476502BC4DAC2C35 //A8
+data8 0xC856FAADFF22ADC6 //A9
+data8 0x49497243255AB3CE //A10
+data8 0xCA3C768489520F6B //A11
+data8 0x4B300D1EA47AF838 //A12
+data8 0xCC223B0508AC620E //A13
+data8 0x4D14D46583338CD8 //A14
+data8 0xCE07E7A87AA068E4 //A15
+data8 0x4EFB811AD2F8BEAB //A16
+data8 0xCFF0351B51508523 //A17
+data8 0x50E4364CCBF53100 //A18
+data8 0xD1D33CFD0BF96FA6 //A19
+// Polynomial coefficients for left root on [-9, -8]
+// Lgammal is aproximated by polynomial within [.157806 ; -.157806 ] range
+data8 0x3D333E4438B1B9D4, 0x39E7B956B83964C1 //A0
+data8 0xC11625EDFC63DCD8, 0xBDCF39625709EFAC //A1
+data8 0x422EA8C150480F16, 0x3EC16ED908AB7EDD //A2
+data8 0xE2598725E2E11646, 0x0000C034 //A3
+data8 0xEAFF2346DE3EBC98, 0x00004046 //A4
+data8 0x821E90DE12A0F05F, 0x0000C059 //A5
+data8 0x46B2C334AE5366FE //A6
+data8 0xC7D64314B43191B6 //A7
+data8 0x48FAF6ED5899E01B //A8
+data8 0xCA2096E4472AF37D //A9
+data8 0x4B44AAF49FB7E4C8 //A10
+data8 0xCC6A02469F2BD920 //A11
+data8 0x4D9080626D2EFC07 //A12
+data8 0xCEB515EDCF0695F7 //A13
+data8 0x4FDB1AC69BF36960 //A14
+data8 0xD1017F8274339270 //A15
+data8 0x5226A684961BAE2F //A16
+data8 0xD34E085C088404A5 //A17
+data8 0x547511892FF8960E //A18
+data8 0xD5968FA3B1ED67A9 //A19
+// Polynomial coefficients for left root on [-10, -9]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0xBD355818A2B42BA2, 0xB9B7320B6A0D61EA //A0
+data8 0xC14BAF7DA5F3770E, 0xBDE64AF9A868F719 //A1
+data8 0x4297F3E8791F9CD3, 0x3F2A553E59B4835E //A2
+data8 0xDD0C5F7E551BD13C, 0x0000C03E //A3
+data8 0x8F6F0A3B2EB08BBB, 0x00004054 //A4
+data8 0xC68D4D5AD230BA08, 0x0000C069 //A5
+data8 0x47F1E4D8C35D1A3E //A6
+data8 0xC94A8A191DB0A466 //A7
+data8 0x4AA4174F65FE6AE8 //A8
+data8 0xCBFEE6D90F94E9DD //A9
+data8 0x4D580FD3438BE16C //A10
+data8 0xCEB2ECD456D50224 //A11
+data8 0x500E049F7FE64546 //A12
+data8 0xD167F92D9600F378 //A13
+data8 0x52C342AE2B43261A //A14
+data8 0xD41F15DEEDA4B67E //A15
+data8 0x55792638748AFB7D //A16
+data8 0xD6D4D760074F6E6B //A17
+data8 0x5832469D58ED3FA9 //A18
+data8 0xD988769F3DC76642 //A19
+// Polynomial coefficients for left root on [-11, -10]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0xBDA050601F39778A, 0xBA0D4D1CE53E8241 //A0
+data8 0xC18308A7D8EA4039, 0xBE370C379D3EAD41 //A1
+data8 0x4306A49380644E6C, 0x3FBBB143C0E7B5C8 //A2
+data8 0x8FA8FB233E4AA6D2, 0x0000C049 //A3
+data8 0x802CC9D8AEAC207D, 0x00004062 //A4
+data8 0xF3F73EE651A37A13, 0x0000C07A //A5
+data8 0x493E3B550A7B9568 //A6
+data8 0xCACED38DAA060929 //A7
+data8 0x4C600B346BAB3BC6 //A8
+data8 0xCDF0F719193E3D26 //A9
+data8 0x4F8229F24528B151 //A10
+data8 0xD113A4C2D32FBBE2 //A11
+data8 0x52A56BC13DC4474D //A12
+data8 0xD43785CFAF5E3CE3 //A13
+data8 0x55C9FC3EA5941202 //A14
+data8 0xD75CD545A3341AF5 //A15
+data8 0x58F009911F77C282 //A16
+data8 0xDA8246294D210BEC //A17
+data8 0x5C1608AAC32C3A8E //A18
+data8 0xDDA446E570A397D5 //A19
+// Polynomial coefficients for left root on [-12, -11]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0x3DEACBB3081C502E, 0x3A8AA6F01DEDF745 //A0
+data8 0xC1BC8CFBFB0A9912, 0xBE6556B6504A2AE6 //A1
+data8 0x43797926206941D7, 0x40289A9644C2A216 //A2
+data8 0xF26D2A78446D0839, 0x0000C053 //A3
+data8 0xA238B1D937FFED38, 0x00004070 //A4
+data8 0xE793B4F6DE470538, 0x0000C08C //A5
+data8 0x4A9585BDC44DC45D //A6
+data8 0xCC60759520342C47 //A7
+data8 0x4E29B2F3694C0404 //A8
+data8 0xCFF4619AE7B6BBAB //A9
+data8 0x51C05DADF52B89E8 //A10
+data8 0xD38A8C7F48819A4A //A11
+data8 0x5555B6932D687860 //A12
+data8 0xD721E1FACB6C1B5B //A13
+data8 0x58EDA1E2677C8F91 //A14
+data8 0xDAB8A8EC523C1F71 //A15
+data8 0x5C84930133F30411 //A16
+data8 0xDE51952FDFD1EC49 //A17
+data8 0x601FCCEC1BBD25F1 //A18
+data8 0xE1E5F2D76B610920 //A19
+// Polynomial coefficients for left root on [-13, -12]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0xBE01612F373268ED, 0xBA97B7A18CDF103B //A0
+data8 0xC1F7328CBF7A4FAC, 0xBE89A25A6952F481 //A1
+data8 0x43F0D0FA2DBDA237, 0x40A0422EC1CE6084 //A2
+data8 0x82082DF2D32686C5, 0x0000C05F //A3
+data8 0x8D64EE9B42E68B36, 0x0000407F //A4
+data8 0xA3FFD82E08C630C9, 0x0000C09F //A5
+data8 0x4BF8C49D99123466 //A6
+data8 0xCDFEC79DDF1119ED //A7
+data8 0x50038615A892D242 //A8
+data8 0xD20929453DC8B537 //A9
+data8 0x54106A78083BA1EE //A10
+data8 0xD615A302C69E27B2 //A11
+data8 0x581CC175870FF16F //A12
+data8 0xDA233E0979E12B74 //A13
+data8 0x5C29E822BC568C80 //A14
+data8 0xDE31845DB5340FBC //A15
+data8 0x6037BFC6D498D5F9 //A16
+data8 0xE2407D92CD613E82 //A17
+data8 0x64483B9B62367EB7 //A18
+data8 0xE64B2DC830E8A799 //A1
+// Polynomial coefficients for left root on [-14, -13]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0x3E563D0B930B371F, 0x3AE779957E14F012 //A0
+data8 0xC2344C3B2F083767, 0xBEC0B7769AA3DD66 //A1
+data8 0x4469BFFF28B50D07, 0x41181E3F13ED2401 //A2
+data8 0xAE38F64DCB24D9EE, 0x0000C06A //A3
+data8 0xA5C3F52C1B3506F2, 0x0000408E //A4
+data8 0xA83BC857BCD6BA92, 0x0000C0B2 //A5
+data8 0x4D663B4727B4D81A //A6
+data8 0xCFA82C965B0F62E9 //A7
+data8 0x51EAD58C02905B71 //A8
+data8 0xD42E427970FA56AD //A9
+data8 0x56714644C57D8476 //A10
+data8 0xD8B3EC2037EC95F2 //A11
+data8 0x5AF72AE68BBA5B3D //A12
+data8 0xDD3B2152C67AA6B7 //A13
+data8 0x5F7FF5F082861B8B //A14
+data8 0xE1C2E8BE125A5B7A //A15
+data8 0x64066E92FE9EBE7D //A16
+data8 0xE64B4201CDF9F138 //A17
+data8 0x689186351E58AA88 //A18
+data8 0xEAD132A585DFC60A //A19
+// Polynomial coefficients for left root on [-15, -14]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0xBE6D7DDE12700AC1, 0xBB1E025BF1667FB5 //A0
+data8 0xC273077763F60AD5, 0xBF2A1698184C7A9A //A1
+data8 0x44E6A1BF095B1AB3, 0x4178D5AE8A4A2874 //A2
+data8 0x8F8E0D5060FCC767, 0x0000C076 //A3
+data8 0x800CC1DCFF092A57, 0x0000409E //A4
+data8 0xF3AB0BA9D14D37D1, 0x0000C0C5 //A5
+data8 0x4EDE3000A2F6D565 //A6
+data8 0xD15EC613B9C8C800 //A7
+data8 0x53E003309FEECCAA //A8
+data8 0xD660ED908D8B15C4 //A9
+data8 0x58E21E9B51A1C4AE //A10
+data8 0xDB639745DB82210D //A11
+data8 0x5DE55BB60C68FCF6 //A12
+data8 0xE06772BA3FCA23C6 //A13
+data8 0x62E9E58B4F702C31 //A14
+data8 0xE56CBA49B071ABE2 //A15
+data8 0x67EFF31E4F2BA36A //A16
+data8 0xEA7232C8804F32C3 //A17
+data8 0x6CF5EFEE929A0928 //A18
+data8 0xEF742EE03EC3E8FF //A19
+// Polynomial coefficients for left root on [-16, -15]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0xBEDCC628FEAC7A1B, 0xBB80582C8BEBB198 //A0
+data8 0xC2B3076EE752595E, 0xBF5388F55AFAE53E //A1
+data8 0x4566A1AAD96EBCB5, 0x421F0FEFE2444293 //A2
+data8 0x8F8D4D3DE9850DB2, 0x0000C082 //A3
+data8 0x800BDD6DA2CE184C, 0x000040AE //A4
+data8 0xF3A8EC4C9CDC7A43, 0x0000C0D9 //A5
+data8 0x505E2FAFDB81263F //A6
+data8 0xD31EC5B3A7506CD9 //A7
+data8 0x55E002F77E999810 //A8
+data8 0xD8A0ED4C9B5C2900 //A9
+data8 0x5B621E4A8267C401 //A10
+data8 0xDE2396E5BFCFDA7A //A11
+data8 0x60E55B43BE6F9A79 //A12
+data8 0xE3A772324C7405FA //A13
+data8 0x6669E4E9B7E57A2D //A14
+data8 0xE92CB989F8A8FB37 //A15
+data8 0x6BEFF2368849A36E //A16
+data8 0xEEB23234FE191D55 //A17
+data8 0x7175EF5D1080B105 //A18
+data8 0xF4342ED7B1B7BE31 //A19
+// Polynomial coefficients for left root on [-17, -16]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0xBF28AEEE7B58C790, 0xBBC4448DE371FA0A //A0
+data8 0xC2F436F56B3B89B1, 0xBF636755245AC63A //A1
+data8 0x45E98A22535D115D, 0x4298467DA93DB784 //A2
+data8 0xAC176F3775E6FCF2, 0x0000C08E //A3
+data8 0xA3114F53A9FEB908, 0x000040BE //A4
+data8 0xA4D168A8334AFE5A, 0x0000C0EE //A5
+data8 0x51E5B0E7EC7182CF //A6
+data8 0xD4E77D67B876D6B4 //A7
+data8 0x57E9F7C30C098C83 //A8
+data8 0xDAED29B0489EF7A7 //A9
+data8 0x5DF09486F8A524B8 //A10
+data8 0xE0F30B19910A2393 //A11
+data8 0x63F60E02AB3109F4 //A12
+data8 0xE6F9B8A3431854D5 //A13
+data8 0x69FE2D4A6D94218E //A14
+data8 0xED01C7E272A73560 //A15
+data8 0x7005017D82B186B6 //A16
+data8 0xF3096A81A69BD8AE //A17
+data8 0x76104951BAD67D5C //A18
+data8 0xF90FECC99786FD5B //A19
+// Polynomial coefficients for left root on [-18, -17]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0x3F3C19A53328E26A, 0x3BE238D7BA036B3B //A0
+data8 0xC336C16C16C16C13, 0xBFEACE245DEC56F3 //A1
+data8 0x46702E85C0898B70, 0x432C922B64FD1DA4 //A2
+data8 0xF57B99A1C0343350, 0x0000C09A //A3
+data8 0x82EC9634223DF90D, 0x000040CF //A4
+data8 0x94F66D7557E3237D, 0x0000C103 //A5
+data8 0x5376118B79AE34D6 //A6
+data8 0xD6BAE7106D52CE49 //A7
+data8 0x5A00BD48CC8E11AB //A8
+data8 0xDD4529722833E2DF //A9
+data8 0x608B1654AF5F46AF //A10
+data8 0xE3D182CC90D8723F //A11
+data8 0x6716D43D46706AA0 //A12
+data8 0xEA5DF888C5B428D3 //A13
+data8 0x6DA3CA85888931A6 //A14
+data8 0xF0EA40EF2AC7E070 //A15
+data8 0x743175D1A251AFCD //A16
+data8 0xF777CB6E2B550D73 //A17
+data8 0x7AC11E468A134A51 //A18
+data8 0xFE02B6BDD0FC40AA //A19
+// Polynomial coefficients for left root on [-19, -18]
+// Lgammal is aproximated by polynomial within [.157807 ; -.157807 ] range
+data8 0xBFAB767F9BE217FC, 0xBC4A5541CE0D8D0D //A0
+data8 0xC379999999999999, 0xC01A84981B490BE8 //A1
+data8 0x46F47AE147AE147A, 0x43AC2987BBC466EB //A2
+data8 0xAEC33E1F67152987, 0x0000C0A7 //A3
+data8 0xD1B71758E2196153, 0x000040DF //A4
+data8 0x8637BD05AF6D420E, 0x0000C118 //A5
+data8 0x55065E9F80F293B2 //A6
+data8 0xD88EADA78C44BFA7 //A7
+data8 0x5C15798EE22EC6CD //A8
+data8 0xDF9E8ABFD67895CF //A9
+data8 0x6325FD7FE13B0DE0 //A10
+data8 0xE6AFFC5C3DE70858 //A11
+data8 0x6A3774CE81C70D43 //A12
+data8 0xEDC1527412D8129F //A13
+data8 0x7149BABCDA8B7A72 //A14
+data8 0xF4D330AD49071BB5 //A15
+data8 0x785D4046F4C5F1FD //A16
+data8 0xFBE59BFEDBA73FAF //A17
+data8 0x7F64BEF2B2EC8DA1 //A18
+data8 0xFFEFFFFFFFFFFFFF //A19
+LOCAL_OBJECT_END(lgammal_left_roots_polynomial_data)
+
+
+//==============================================================
+// Code
+//==============================================================
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_lgammal)
+{ .mfi
+      getf.exp           rSignExpX = f8
+      // Test x for NaTVal, NaN, +/-0, +/-INF, denormals
+      fclass.m           p6,p0  = f8,0x1EF
+      addl               r17Ones = 0x1FFFF, r0 // exponent mask
+}
+{ .mfi
+      addl               GR_ad_z_1 = @ltoff(Constants_Z_1#),gp
+      fcvt.fx.s1         fXint = f8 // Convert arg to int (int repres. in FR)
+      adds               rDelta = 0x3FC, r0
+}
+;;
+{ .mfi
+      getf.sig           rSignifX = f8
+      fcmp.lt.s1         p15, p14 = f8, f0
+      shl                rDelta = rDelta, 20 // single precision 1.5
+}
+{ .mfi
+      ld8                GR_ad_z_1 = [GR_ad_z_1]// get pointer to Constants_Z_1
+      fma.s1             fTwo = f1, f1, f1      // 2.0
+      addl               rExp8 = 0x10002, r0    // exponent of 8.0
+}
+;;
+{ .mfi
+      alloc              rPFS_SAVED = ar.pfs, 0, 34, 4, 0 // get some registers
+      fmerge.s           fAbsX = f1, f8                   // |x|
+      and                rExpX = rSignExpX, r17Ones       // mask sign bit
+}
+{ .mib
+      addl               rExpHalf = 0xFFFE, r0 // exponent of 0.5
+      addl               rExp2 = 0x10000, r0 // exponent of 2.0
+      // branch out if x is NaTVal, NaN, +/-0, +/-INF, or denormalized number
+(p6)  br.cond.spnt       lgammal_spec
+}
+;;
+_deno_back_to_main_path:
+{ .mfi
+      // Point to Constants_G_H_h1
+      add                rTbl1Addr = 0x040, GR_ad_z_1
+      frcpa.s1           fRcpX, p0 = f1, f8 // initial approximation of 1/x
+      extr.u             GR_Index1 = rSignifX, 59, 4
+}
+{ .mib
+(p14) cmp.ge.unc         p8, p0 = rExpX, rExp8 // p8 = 1 if x >= 8.0
+      adds               rZ625 = 0x3F2, r0
+(p8)  br.cond.spnt       lgammal_big_positive // branch out if x >= 8.0
+}
+;;
+{ .mfi
+      shladd             rZ1offsett = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      fmerge.se          fSignifX =  f1, f8 // sifnificand of x
+      // Get high 15 bits of significand
+      extr.u             GR_X_0 = rSignifX, 49, 15
+}
+{ .mib
+      cmp.lt.unc         p9, p0 = rExpX, rExpHalf // p9 = 1 if |x| < 0.5
+      // set p11 if 2 <= x < 4
+(p14) cmp.eq.unc         p11, p0 = rExpX, rExp2
+(p9)  br.cond.spnt       lgammal_0_half // branch out if |x| < 0.5
+}
+;;
+{ .mfi
+      ld4                GR_Z_1 = [rZ1offsett] // Load Z_1
+      fms.s1             fA5L = f1, f1, f8 // for 0.75 <= x < 1.3125 path
+      shl                rZ625 = rZ625, 20 // sinfle precision 0.625
+}
+{ .mib
+      setf.s             FR_MHalf = rDelta
+      // set p10 if x >= 4.0
+(p14) cmp.gt.unc         p10, p0 = rExpX, rExp2
+      // branch to special path for 4.0 <= x < 8
+(p10) br.cond.spnt       lgammal_4_8
+}
+;;
+{ .mfi
+      // for 1.3125 <= x < 1.5625 path
+      addl               rPolDataPtr= @ltoff(lgammal_loc_min_data),gp
+      // argument of polynomial approximation for 1.5625 <= x < 2.25
+      fms.s1             fB4 = f8, f1, fTwo
+      cmp.eq             p12, p0 = rExpX, rExpHalf
+}
+{ .mib
+      addl               rExpOne = 0xFFFF, r0 // exponent of 1.0
+     // set p10 if significand of x >= 1.125
+(p11) cmp.le             p11, p0 = 2, GR_Index1
+(p11) br.cond.spnt       lgammal_2Q_4
+}
+;;
+{ .mfi
+      // point to xMin for 1.3125 <= x < 1.5625 path
+      ld8                rPolDataPtr = [rPolDataPtr]
+      fcvt.xf            fFltIntX = fXint // RTN(x)
+(p14) cmp.eq.unc         p13, p7 = rExpX, rExpOne // p13 set if 1.0 <= x < 2.0
+}
+{ .mib
+      setf.s             FR_FracX = rZ625
+      // set p12 if |x| < 0.75
+(p12) cmp.gt.unc         p12, p0 = 8, GR_Index1
+      // branch out to special path for |x| < 0.75
+(p12) br.cond.spnt       lgammal_half_3Q
+}
+;;
+.pred.rel "mutex", p7, p13
+{ .mfi
+      getf.sig           rXRnd = fXint // integer part of the input value
+      fnma.s1            fInvX = f8, fRcpX, f1 // start of 1st NR iteration
+      // Get bits 30-15 of X_0 * Z_1
+      pmpyshr2.u         GR_X_1 = GR_X_0,GR_Z_1,15
+}
+{ .mib
+(p7)  cmp.eq             p6, p0 = rExpX, rExp2 // p6 set if 2.0 <= x < 2.25
+(p13) cmp.le             p6, p0 = 9, GR_Index1
+      // branch to special path 1.5625 <= x < 2.25
+(p6)  br.cond.spnt       lgammal_13Q_2Q
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      shladd             GR_ad_tbl_1 = GR_Index1, 4, rTbl1Addr // Point to G_1
+      fma.s1             fSix = fTwo, fTwo, fTwo // 6.0
+      add                GR_ad_q = -0x60, GR_ad_z_1   // Point to Constants_Q
+}
+{ .mib
+      add                rTmpPtr3 = -0x50, GR_ad_z_1
+(p13) cmp.gt             p7, p0 = 5, GR_Index1
+      // branch to special path 0.75 <= x < 1.3125
+(p7)  br.cond.spnt       lgammal_03Q_1Q
+}
+;;
+{ .mfi
+      add                rTmpPtr = 8, GR_ad_tbl_1
+      fma.s1             fRoot = f8, f1, f1 // x + 1
+       // Absolute value of int arg. Will be used as index in table with roots
+      sub                rXRnd = r0, rXRnd
+}
+{ .mib
+      ldfe               fA5L = [rPolDataPtr], 16 // xMin
+      addl               rNegSingularity = 0x3003E, r0
+(p14) br.cond.spnt       lgammal_loc_min
+}
+;;
+{ .mfi
+      ldfps              FR_G, FR_H = [GR_ad_tbl_1], 8 // Load G_1, H_1
+      nop.f              0
+      add                rZ2Addr = 0x140, GR_ad_z_1  // Point to Constants_Z_2
+}
+{ .mib
+      ldfd               FR_h = [rTmpPtr] // Load h_1
+      // If arg is less or equal to -2^63
+      cmp.geu.unc        p8,p0 = rSignExpX, rNegSingularity
+      // Singularity for x < -2^63 since all such arguments are integers
+      // branch to special code which deals with singularity
+(p8)  br.cond.spnt       lgammal_singularity
+}
+;;
+{ .mfi
+      ldfe               FR_log2_hi = [GR_ad_q], 32 // Load log2_hi
+      nop.f              0
+      extr.u             GR_Index2 = GR_X_1, 6, 4 // Extract bits 6-9 of X_1
+}
+{ .mfi
+      ldfe               FR_log2_lo = [rTmpPtr3], 32 // Load log2_lo
+      fms.s1             fDx = f8, f1, fFltIntX // x - RTN(x)
+      // index in table with roots and bounds
+      adds               rXint = -2, rXRnd
+}
+;;
+{ .mfi
+      ldfe               FR_Q4 = [GR_ad_q], 32      // Load Q4
+      nop.f              0
+      // set p12 if x may be close to negative root: -19.5 < x < -2.0
+      cmp.gtu            p12, p0 = 18, rXint
+}
+{ .mfi
+      shladd             GR_ad_z_2 = GR_Index2, 2, rZ2Addr  // Point to Z_2
+      fma.s1             fRcpX = fInvX, fRcpX, fRcpX // end of 1st NR iteration
+      // Point to Constants_G_H_h2
+      add                rTbl2Addr = 0x180, GR_ad_z_1
+}
+;;
+{ .mfi
+      shladd             GR_ad_tbl_2 = GR_Index2, 4, rTbl2Addr // Point to G_2
+      // set p9 if x is integer and negative
+      fcmp.eq.s1         p9, p0 = f8,fFltIntX
+      // Point to Constants_G_H_h3
+      add                rTbl3Addr = 0x280, GR_ad_z_1
+}
+{ .mfi
+      ld4                GR_Z_2 = [GR_ad_z_2] // Load Z_2
+      nop.f              0
+      sub                GR_N = rExpX, rExpHalf, 1
+}
+;;
+{ .mfi
+      ldfe               FR_Q3 = [rTmpPtr3], 32 // Load Q3
+      nop.f              0
+      // Point to lnsin polynomial coefficients
+      adds               rLnSinDataPtr = 864, rTbl3Addr
+}
+{ .mfi
+      ldfe               FR_Q2 = [GR_ad_q],32 // Load Q2
+      nop.f              0
+      add                rTmpPtr = 8, GR_ad_tbl_2
+}
+;;
+{ .mfi
+      ldfe               FR_Q1 = [rTmpPtr3] // Load Q1
+      fcmp.lt.s1         p0, p15 = fAbsX, fSix // p15 is set when x < -6.0
+      // point to table with roots and bounds
+      adds               rRootsBndAddr = -1296, GR_ad_z_1
+}
+{ .mfb
+      // Put integer N into rightmost significand
+      setf.sig           fFloatN = GR_N
+      fma.s1             fThirteen = fSix, fTwo, f1 // 13.0
+      // Singularity if -2^63 < x < 0 and x is integer
+      // branch to special code which deals with singularity
+(p9)  br.cond.spnt       lgammal_singularity
+}
+;;
+{ .mfi
+      ldfps              FR_G2, FR_H2 = [GR_ad_tbl_2]  // Load G_2, H_2
+      // y = |x|/2^(exponent(x)) - 1.5
+      fms.s1             FR_FracX = fSignifX, f1, FR_MHalf
+      // Get bits 30-15 of X_1 * Z_2
+      pmpyshr2.u         GR_X_2 = GR_X_1,GR_Z_2,15
+}
+{ .mfi
+      ldfd               FR_h2 = [rTmpPtr] // Load h_2
+      fma.s1             fDxSqr = fDx, fDx, f0 // deltaX^2
+      adds               rTmpPtr3 = 128, rLnSinDataPtr
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      getf.exp           rRoot = fRoot // sign and biased exponent of (x + 1)
+      nop.f              0
+      // set p6 if -4 < x <= -2
+      cmp.eq             p6, p0 = rExpX, rExp2
+}
+{ .mfi
+      ldfpd              fLnSin2, fLnSin2L = [rLnSinDataPtr], 16
+      fnma.s1            fInvX = f8, fRcpX, f1 // start of 2nd NR iteration
+      sub                rIndexPol = rExpX, rExpHalf // index of polynom
+}
+;;
+{ .mfi
+      ldfe               fLnSin4 = [rLnSinDataPtr], 96
+      // p10 is set if x is potential "right" root
+      // p11 set for possible "left" root
+      fcmp.lt.s1         p10, p11 = fDx, f0
+      shl                rIndexPol = rIndexPol, 6  // (i*16)*4
+}
+{ .mfi
+      ldfpd              fLnSin18, fLnSin20 = [rTmpPtr3], 16
+      nop.f              0
+      mov                rExp2tom7 = 0x0fff8 // Exponent of 2^-7
+}
+;;
+{ .mfi
+      getf.sig           rSignifDx = fDx // Get significand of RTN(x)
+      nop.f              0
+      // set p6 if -4 < x <= -3.0
+(p6)  cmp.le.unc         p6, p0 = 0x8, GR_Index1
+}
+{ .mfi
+      ldfpd              fLnSin22, fLnSin24 = [rTmpPtr3], 16
+      nop.f              0
+      // mask sign bit in the exponent of (x + 1)
+      and                rRoot = rRoot, r17Ones
+}
+;;
+{ .mfi
+      ldfe               fLnSin16 = [rLnSinDataPtr], -80
+      nop.f              0
+      extr.u             GR_Index3 = GR_X_2, 1, 5 // Extract bits 1-5 of X_2
+}
+{ .mfi
+      ldfpd              fLnSin26, fLnSin28 = [rTmpPtr3], 16
+      nop.f              0
+      and                rXRnd = 1, rXRnd
+}
+;;
+{ .mfi
+      shladd             GR_ad_tbl_3 = GR_Index3, 4, rTbl3Addr // Point to G_3
+      fms.s1             fDxSqrL = fDx, fDx, fDxSqr // low part of deltaX^2
+      // potential "left" root
+(p11) adds               rRootsBndAddr = 560, rRootsBndAddr
+}
+{ .mib
+      ldfpd              fLnSin30, fLnSin32 = [rTmpPtr3], 16
+      // set p7 if |x+1| < 2^-7
+      cmp.lt             p7, p0 =  rRoot, rExp2tom7
+      // branch to special path for |x+1| < 2^-7
+(p7)  br.cond.spnt       _closeToNegOne
+}
+;;
+{ .mfi
+      ldfps              FR_G3, FR_H3 = [GR_ad_tbl_3], 8 // Load G_3, H_3
+      fcmp.lt.s1         p14, p0 = fAbsX, fThirteen // set p14 if x > -13.0
+      // base address of polynomial on range [-6.0, -0.75]
+      adds               rPolDataPtr = 3440, rTbl3Addr
+}
+{ .mfi
+      // (i*16)*4 + (i*16)*8 - offsett of polynomial on range [-6.0, -0.75]
+      shladd             rTmpPtr = rIndexPol, 2, rIndexPol
+      fma.s1             fXSqr = FR_FracX, FR_FracX, f0 // y^2
+      // point to left "near root" bound
+(p12) shladd             rRootsBndAddr = rXint, 4, rRootsBndAddr
+}
+;;
+{ .mfi
+      ldfpd              fLnSin34, fLnSin36 = [rTmpPtr3], 16
+      fma.s1             fRcpX = fInvX, fRcpX, fRcpX // end of 2nd NR iteration
+      // add special offsett if -4 < x <= -3.0
+(p6)  adds               rPolDataPtr = 640, rPolDataPtr
+}
+{ .mfi
+      // point to right "near root" bound
+      adds               rTmpPtr2 = 8, rRootsBndAddr
+      fnma.s1            fMOne = f1, f1, f0 // -1.0
+      // Point to Bernulli numbers
+      adds               rBernulliPtr = 544, rTbl3Addr
+}
+;;
+{ .mfi
+      // left bound of "near root" range
+(p12) ld8                rLeftBound = [rRootsBndAddr]
+      fmerge.se          fNormDx = f1, fDx // significand of DeltaX
+      // base address + offsett for polynomial coeff. on range [-6.0, -0.75]
+      add                rPolDataPtr = rPolDataPtr, rTmpPtr
+}
+{ .mfi
+      // right bound of "near root" range
+(p12) ld8                rRightBound = [rTmpPtr2]
+      fcvt.xf            fFloatN = fFloatN
+      // special "Bernulli" numbers for Stirling's formula for -13 < x < -6
+(p14) adds               rBernulliPtr = 160, rBernulliPtr
+}
+;;
+{ .mfi
+      ldfd               FR_h3 = [GR_ad_tbl_3] // Load h_3
+      fmpy.s1            FR_G = FR_G, FR_G2 // G = G_1 * G_2
+      adds               rTmpPtr3 = -160, rTmpPtr3
+}
+{ .mfb
+      adds               rTmpPtr = 80, rPolDataPtr
+      fadd.s1            FR_H = FR_H, FR_H2 // H = H_1 + H_2
+      // p15 is set if -2^63 < x < 6.0 and x is not an integer
+      // branch to path with implementation using Stirling's formula for neg. x
+(p15) br.cond.spnt       _negStirling
+}
+;;
+{ .mfi
+      ldfpd              fA3, fA3L = [rPolDataPtr], 16 // A3
+      fma.s1             fDelX4 = fDxSqr, fDxSqr, f0 // deltaX^4
+      // Get high 4 bits of signif
+      extr.u             rIndex1Dx = rSignifDx, 59, 4
+}
+{ .mfi
+      ldfe               fA5 = [rTmpPtr], -16 // A5
+      fadd.s1            FR_h = FR_h, FR_h2 // h = h_1 + h_2
+      adds               rLnSinTmpPtr = 16, rLnSinDataPtr
+}
+;;
+{ .mfi
+      ldfpd              fA0, fA0L = [rPolDataPtr], 16 // A0
+      fma.s1             fLnSin20 = fLnSin20, fDxSqr, fLnSin18
+      // Get high 15 bits of significand
+      extr.u             rX0Dx = rSignifDx, 49, 15
+}
+{ .mfi
+      ldfe               fA4 = [rTmpPtr], 192 // A4
+      fms.s1             fXSqrL = FR_FracX, FR_FracX, fXSqr // low part of y^2
+      shladd             GR_ad_z_1 = rIndex1Dx, 2, GR_ad_z_1 // Point to Z_1
+}
+;;
+{ .mfi
+      ldfpd              fA1, fA1L = [rPolDataPtr], 16 // A1
+      fma.s1             fX4 = fXSqr, fXSqr, f0 // y^4
+      adds               rTmpPtr2 = 32, rTmpPtr
+}
+{ .mfi
+      ldfpd              fA18, fA19 = [rTmpPtr], 16 // A18, A19
+      fma.s1             fLnSin24 = fLnSin24, fDxSqr, fLnSin22
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fLnSin6 = [rLnSinDataPtr], 32
+      fma.s1             fLnSin28 = fLnSin28, fDxSqr, fLnSin26
+      nop.i              0
+}
+{ .mfi
+      ldfe               fLnSin8 = [rLnSinTmpPtr], 32
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA20, fA21 = [rTmpPtr], 16 // A20, A21
+      fma.s1             fLnSin32 = fLnSin32, fDxSqr, fLnSin30
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA22, fA23 = [rTmpPtr2], 16 // A22, A23
+      fma.s1             fB20 = f1, f1, FR_MHalf // 2.5
+(p12) cmp.ltu.unc        p6, p0 = rSignifX, rLeftBound
+}
+;;
+{ .mfi
+      ldfpd              fA2, fA2L = [rPolDataPtr], 16 // A2
+      fmpy.s1            FR_G = FR_G, FR_G3 // G = (G_1 * G_2) * G_3
+      // set p6 if x falls in "near root" range
+(p6)  cmp.geu.unc        p6, p0 = rSignifX, rRightBound
+}
+{ .mfb
+      adds               rTmpPtr3 = -64, rTmpPtr
+      fadd.s1            FR_H = FR_H, FR_H3 // H = (H_1 + H_2) + H_3
+      // branch to special path if x falls in "near root" range
+(p6)  br.cond.spnt       _negRoots
+}
+;;
+{ .mfi
+      ldfpd              fA24, fA25 = [rTmpPtr2], 16 // A24, A25
+      fma.s1             fLnSin36 = fLnSin36, fDxSqr, fLnSin34
+(p11) cmp.eq.unc         p7, p0 = 1,rXint // p7 set if  -3.0 < x < -2.5
+}
+{ .mfi
+      adds               rTmpPtr = -48, rTmpPtr
+      fma.s1             fLnSin20 = fLnSin20, fDxSqr, fLnSin16
+      addl               rDelta = 0x5338, r0 // significand of -2.605859375
+}
+;;
+{ .mfi
+      getf.exp           GR_N =  fDx // Get N = exponent of DeltaX
+      fma.s1             fX6 = fX4, fXSqr, f0 // y^6
+      // p7 set if -2.605859375 <= x < -2.5
+(p7)  cmp.gt.unc         p7, p0 = rDelta, GR_X_0
+}
+{ .mfb
+      ld4                GR_Z_1 = [GR_ad_z_1] // Load Z_1
+      fma.s1             fDelX8 = fDelX4, fDelX4, f0 // deltaX^8
+      // branch to special path for -2.605859375 <= x < -2.5
+(p7)  br.cond.spnt       _neg2andHalf
+}
+;;
+{ .mfi
+      ldfpd              fA14, fA15 = [rTmpPtr3], 16 // A14, A15
+      fadd.s1            FR_h = FR_h, FR_h3 // h = (h_1 + h_2) + h_3
+      adds               rTmpPtr2 = 128 , rPolDataPtr
+}
+{ .mfi
+      ldfpd              fA16, fA17 = [rTmpPtr], 16 // A16, A17
+      fma.s1             fLnSin28 = fLnSin28, fDelX4, fLnSin24
+      adds               rPolDataPtr = 144 , rPolDataPtr
+}
+;;
+{ .mfi
+      ldfe               fLnSin10 = [rLnSinDataPtr], 32
+      fma.s1             fRes1H = fA3, FR_FracX, f0 // (A3*y)hi
+      and                GR_N = GR_N, r17Ones // mask sign bit
+}
+{ .mfi
+      ldfe               fLnSin12 = [rLnSinTmpPtr]
+      fma.s1             fDelX6 = fDxSqr, fDelX4, f0 // DeltaX^6
+      shladd             GR_ad_tbl_1 = rIndex1Dx, 4, rTbl1Addr // Point to G_1
+}
+;;
+{ .mfi
+      ldfe               fA13 = [rPolDataPtr], -32 // A13
+      fma.s1             fA4 = fA5, FR_FracX, fA4   // A5*y + A4
+      // Get bits 30-15 of X_0 * Z_1
+      pmpyshr2.u         GR_X_1 = rX0Dx, GR_Z_1, 15
+}
+{ .mfi
+      ldfe               fA12 = [rTmpPtr2], -32 // A12
+      fms.s1             FR_r = FR_G, fSignifX, f1 // r = G * S_hi - 1
+      sub                GR_N = GR_N, rExpHalf, 1 // unbisaed exponent of DeltaX
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+.pred.rel "mutex",p10,p11
+{ .mfi
+      ldfe               fA11 = [rPolDataPtr], -32 // A11
+      // High part of log(|x|) = Y_hi = N * log2_hi + H
+      fma.s1             fResH = fFloatN, FR_log2_hi, FR_H
+(p10) cmp.eq             p8, p9 = rXRnd, r0
+}
+{ .mfi
+      ldfe               fA10 = [rTmpPtr2], -32 // A10
+      fma.s1             fRes6H = fA1, FR_FracX, f0 // (A1*y)hi
+(p11) cmp.eq             p9, p8 = rXRnd, r0
+}
+;;
+{ .mfi
+      ldfe               fA9 = [rPolDataPtr], -32 // A9
+      fma.s1             fB14 = fLnSin6, fDxSqr, f0 // (LnSin6*deltaX^2)hi
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+{ .mfi
+      ldfe               fA8 = [rTmpPtr2], -32 // A8
+      fma.s1             fA18 = fA19, FR_FracX, fA18
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fA7 = [rPolDataPtr] // A7
+      fma.s1             fA23 = fA23, FR_FracX, fA22
+      nop.i              0
+}
+{ .mfi
+      ldfe               fA6 = [rTmpPtr2] // A6
+      fma.s1             fA21 = fA21, FR_FracX, fA20
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fLnSin14 = [rLnSinDataPtr]
+      fms.s1             fRes1L = fA3, FR_FracX, fRes1H // delta((A3*y)hi)
+      extr.u             GR_Index2 = GR_X_1, 6, 4 // Extract bits 6-9 of X_1
+}
+{ .mfi
+      setf.sig           fFloatNDx = GR_N
+      fadd.s1            fPol = fRes1H, fA2 // (A3*y + A2)hi
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              FR_G, FR_H = [GR_ad_tbl_1], 8 // Load G_1, H_1
+      fma.s1             fRes2H = fA4, fXSqr, f0 // ((A5 + A4*y)*y^2)hi
+      nop.i              0
+}
+{ .mfi
+      shladd             GR_ad_z_2 = GR_Index2, 2, rZ2Addr  // Point to Z_2
+      fma.s1             fA25 = fA25, FR_FracX, fA24
+      shladd             GR_ad_tbl_2 = GR_Index2, 4, rTbl2Addr  // Point to G_2
+}
+;;
+.pred.rel "mutex",p8,p9
+{ .mfi
+      ld4                GR_Z_2 = [GR_ad_z_2] // Load Z_2
+      fms.s1             fRes6L = fA1, FR_FracX, fRes6H // delta((A1*y)hi)
+      // sign of GAMMA(x) is negative
+(p8)  adds               rSgnGam = -1, r0
+}
+{ .mfi
+      adds               rTmpPtr = 8, GR_ad_tbl_2
+      fadd.s1            fRes3H = fRes6H, fA0 // (A1*y + A0)hi
+      // sign of GAMMA(x) is positive
+(p9)  adds               rSgnGam = 1, r0
+}
+;;
+{ .mfi
+      ldfps              FR_G2, FR_H2 = [GR_ad_tbl_2] // Load G_2, H_2
+      // (LnSin6*deltaX^2 + LnSin4)hi
+      fadd.s1            fLnSinH = fB14, fLnSin4
+      nop.i              0
+}
+{ .mfi
+      ldfd               FR_h2 = [rTmpPtr] // Load h_2
+      fms.s1             fB16 = fLnSin6, fDxSqr, fB14 // delta(LnSin6*deltaX^2)
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               fhDelX = [GR_ad_tbl_1] // Load h_1
+      fma.s1             fA21 = fA21, fXSqr, fA18
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36, fDelX4, fLnSin32
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes1L = fA3L, FR_FracX, fRes1L // (A3*y)lo
+      // Get bits 30-15 of X_1 * Z_
+      pmpyshr2.u         GR_X_2 = GR_X_1,GR_Z_2,15
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fPolL = fA2, fPol
+      nop.i              0
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      nop.m              0
+     // delta(((A5 + A4*y)*y^2)hi)
+      fms.s1             fRes2L = fA4, fXSqr, fRes2H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // (((A5 + A4*y)*y^2) + A3*y + A2)hi
+      fadd.s1            fRes4H = fRes2H, fPol
+      nop.i              0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fma.s1             fRes6L = fA1L, FR_FracX, fRes6L // (A1*y)lo
+      nop.i              0
+}
+{ .mfi
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fsub.s1            fRes3L = fA0, fRes3H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fLnSinL = fLnSin4, fLnSinH
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // ((LnSin6*deltaX^2 + LnSin4)*deltaX^2)hi
+      fma.s1             fB18 = fLnSinH, fDxSqr, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      adds               rTmpPtr = 8, rTbl3Addr
+      fma.s1             fB16 = fLnSin6, fDxSqrL, fB16 // (LnSin6*deltaX^2)lo
+      extr.u             GR_Index3 = GR_X_2, 1, 5 // Extract bits 1-5 of X_2
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fXSqr, fA23
+      nop.i              0
+}
+;;
+{ .mfi
+      shladd             GR_ad_tbl_3 = GR_Index3, 4, rTbl3Addr // Point to G_3
+      fadd.s1            fPolL = fPolL, fRes1H
+      nop.i              0
+}
+{ .mfi
+      shladd             rTmpPtr = GR_Index3, 4, rTmpPtr // Point to G_3
+      fadd.s1            fRes1L = fRes1L, fA2L // (A3*y)lo + A2lo
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              FR_G3, FR_H3 = [GR_ad_tbl_3] // Load G_3, H_3
+      fma.s1             fRes2L = fA4, fXSqrL, fRes2L // ((A5 + A4*y)*y^2)lo
+      nop.i              0
+}
+{ .mfi
+      ldfd               FR_h3 = [rTmpPtr] // Load h_3
+      fsub.s1            fRes4L = fPol, fRes4H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // ((((A5 + A4*y)*y^2) + A3*y + A2)*y^2)hi
+      fma.s1             fRes7H = fRes4H, fXSqr, f0
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, FR_FracX, fA14
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fRes3L, fRes6H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes6L = fRes6L, fA0L // (A1*y)lo + A0lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fLnSinL = fLnSinL, fB14
+
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // delta((LnSin6*deltaX^2 + LnSin4)*deltaX^2)
+      fms.s1             fB20 = fLnSinH, fDxSqr, fB18
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fPolL = fPolL, fRes1L // (A3*y + A2)lo
+
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // ((LnSin6*deltaX^2 + LnSin4)*deltaX^2 + LnSin2)hi
+      fadd.s1            fLnSin6 = fB18, fLnSin2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fRes2H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, FR_FracX, fA16
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // delta(((((A5 + A4*y)*y^2) + A3*y + A2)*y^2)
+      fms.s1             fRes7L = fRes4H, fXSqr, fRes7H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fPol = fRes7H, fRes3H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fRes3L, fRes6L // (A1*y + A0)lo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fX4, fA21
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (LnSin6*deltaX^2 + LnSin4)lo
+      fadd.s1            fLnSinL = fLnSinL, fB16
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB20 = fLnSinH, fDxSqrL, fB20
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fLnSin4 = fLnSin2, fLnSin6
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // (((LnSin6*deltaX^2 + LnSin4)*deltaX^2 + LnSin2)*DeltaX^2)hi
+      fma.s1             fLnSinH = fLnSin6, fDxSqr, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // ((A5 + A4*y)*y^2)lo + (A3*y + A2)lo
+      fadd.s1            fRes2L = fRes2L, fPolL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, fXSqr, fA15
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // ((((A5 + A4*y)*y^2) + A3*y + A2)*y^2)lo
+      fma.s1             fRes7L = fRes4H, fXSqrL, fRes7L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fPolL = fRes3H, fPol
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA13 = fA13, FR_FracX, fA12
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fA11, FR_FracX, fA10
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // ((LnSin6*deltaX^2 + LnSin4)*deltaX^2)lo
+      fma.s1             fB20 = fLnSinL, fDxSqr, fB20
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_G = FR_G, FR_G2 // G = G_1 * G_2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fLnSin4 = fLnSin4, fB18
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fLnSinL = fLnSin6, fDxSqr, fLnSinH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (((A5 + A4*y)*y^2) + A3*y + A2)lo
+      fadd.s1            fRes4L = fRes4L, fRes2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fhDelX = fhDelX, FR_h2 // h = h_1 + h_2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes7L = fRes7L, fRes3L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fPolL = fPolL, fRes7H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fcvt.xf            fFloatNDx = fFloatNDx
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_H = FR_H, FR_H2 // H = H_1 + H_2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_G = FR_G, FR_G3 // G = (G_1 * G_2) * G_3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // ((LnSin6*deltaX^2 + LnSin4)*deltaX^2)lo + (LnSin2)lo
+      fadd.s1            fLnSin2L = fLnSin2L, fB20
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fX4, fA17
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA13 = fA13, fXSqr, fA11
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, FR_FracX, fA8
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA7 = fA7, FR_FracX, fA6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36, fDelX8, fLnSin28
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin14 = fLnSin14, fDxSqr, fLnSin12
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin10 = fLnSin10, fDxSqr, fLnSin8
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_H = FR_H, FR_H3 // H = (H_1 + H_2) + H_3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRDx = FR_G, fNormDx, f1 // r = G * S_hi - 1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // poly_lo = r * Q4 + Q3
+      fma.s1             FR_poly_lo = FR_r, FR_Q4, FR_Q3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_rsq = FR_r, FR_r // rsq = r * r
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // ((((A5 + A4*y)*y^2) + A3*y + A2)*y^2)lo + (A1*y + A0)lo
+      fma.s1             fRes7L = fRes4L, fXSqr, fRes7L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fX4, fA13
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, fXSqr, fA7
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // h = N * log2_lo + h
+      fma.s1             FR_h = fFloatN, FR_log2_lo, FR_h
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fhDelX = fhDelX, FR_h3 // h = (h_1 + h_2) + h_3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36, fDelX6, fLnSin20
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin14 = fLnSin14, fDelX4, fLnSin10
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = r * Q4 + Q3
+      fma.s1             fPolyLoDx = fRDx, FR_Q4, FR_Q3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fmpy.s1            fRDxSq = fRDx, fRDx // rsq = r * r
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Y_hi = N * log2_hi + H
+      fma.s1             fResLnDxH = fFloatNDx, FR_log2_hi, FR_H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             FR_rcub = FR_rsq, FR_r, f0 // rcub = r^3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA25, fX4, fA9
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fPolL = fPolL, fRes7L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fLnSin4 = fLnSin4, fLnSin2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // h = N * log2_lo + h
+      fma.s1             fhDelX = fFloatNDx, FR_log2_lo, fhDelX
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36, fDelX8, fLnSin14
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // ((LnSin6*deltaX^2 + LnSin4)*deltaX^2 + LnSin2)lo
+      fma.s1             fLnSinL = fLnSin6, fDxSqrL, fLnSinL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1             fPolyLoDx = fPolyLoDx, fRDx, FR_Q2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fRDxCub = fRDxSq, fRDx, f0 // rcub = r^3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      famax.s0              fRes5H = fPol, fResH
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      //  High part of (lgammal(|x|) + log(|x|))
+      fadd.s1            fRes1H = fPol, fResH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_r, FR_Q2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPolL = fA9, fX6, fPolL // P25lo
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      famin.s0              fRes5L = fPol, fResH
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // High part of -(LnSin + log(|DeltaX|))
+      fnma.s1            fRes2H = fResLnDxH, f1, fLnSinH
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      // (((LnSin6*deltaX^2 + LnSin4)*deltaX^2 + LnSin2)*DeltaX^2)lo
+      fma.s1             fLnSinL = fLnSin4, fDxSqr, fLnSinL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36, fDelX6, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             fPolyHiDx = FR_Q1, fRDxSq, fRDx
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1             fPolyLoDx = fPolyLoDx, fRDxCub, fhDelX
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes1L = fRes5H, fRes1H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      //  -(lgammal(|x|) + log(|x|))hi
+      fnma.s1            fRes1H = fRes1H, f1, f0
+
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             FR_poly_hi = FR_Q1, FR_rsq, FR_r
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_rcub, FR_h
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes2L = fResLnDxH, fMOne, fRes2H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSinL = fLnSin36, fDxSqr, fLnSinL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // Y_lo = poly_hi + poly_lo
+      fadd.s1            fResLnDxL = fPolyHiDx, fPolyLoDx
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fRes5L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // high part of the final result
+      fadd.s1            fYH = fRes2H, fRes1H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Y_lo = poly_hi + poly_lo
+      fadd.s1            fResL = FR_poly_hi, FR_poly_lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      famax.s0              fRes4H = fRes2H, fRes1H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      famin.s0              fRes4L = fRes2H, fRes1H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (LnSin)lo + (log(|DeltaX|))lo
+      fsub.s1            fLnSinL = fLnSinL, fResLnDxL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fLnSinH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      //(lgammal(|x|))lo + (log(|x|))lo
+      fadd.s1            fPolL = fResL, fPolL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fYL = fRes4H, fYH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Low part of -(LnSin + log(|DeltaX|))
+      fadd.s1            fRes2L = fRes2L, fLnSinL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      //  High part of (lgammal(|x|) + log(|x|))
+      fadd.s1            fRes1L = fRes1L, fPolL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fYL = fYL, fRes4L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes2L = fRes2L, fRes1L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // low part of the final result
+      fadd.s1            fYL = fYL, fRes2L
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for -6.0 < x <= -0.75, non-integer, "far" from roots
+      fma.s0             f8 = fYH, f1, fYL
+      // exit here for -6.0 < x <= -0.75, non-integer, "far" from roots
+      br.ret.sptk        b0
+}
+;;
+
+// here if |x+1| < 2^(-7)
+.align 32
+_closeToNegOne:
+{ .mfi
+      getf.exp           GR_N =  fDx // Get N = exponent of x
+      fmerge.se          fAbsX =  f1, fDx // Form |deltaX|
+      // Get high 4 bits of significand of deltaX
+      extr.u             rIndex1Dx = rSignifDx, 59, 4
+}
+{ .mfi
+      addl               rPolDataPtr= @ltoff(lgammal_1pEps_data),gp
+      fma.s1             fA0L = fDxSqr, fDxSqr, f0 // deltaX^4
+      // sign of GAMMA is positive if p10 is set to 1
+(p10) adds               rSgnGam = 1, r0
+}
+;;
+{ .mfi
+      shladd             GR_ad_z_1 = rIndex1Dx, 2, GR_ad_z_1 // Point to Z_1
+      fnma.s1            fResL = fDx, f1, f0 // -(x+1)
+      // Get high 15 bits of significand
+      extr.u             GR_X_0 = rSignifDx, 49, 15
+}
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      shladd             GR_ad_tbl_1 = rIndex1Dx, 4, rTbl1Addr // Point to G_1
+}
+;;
+{ .mfi
+      ld4                GR_Z_1 = [GR_ad_z_1] // Load Z_1
+      nop.f              0
+      and                GR_N = GR_N, r17Ones // mask sign bit
+}
+{ .mfi
+      adds               rTmpPtr = 8, GR_ad_tbl_1
+      nop.f              0
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+;;
+{ .mfi
+      ldfps              FR_G, FR_H = [GR_ad_tbl_1],8 // Load G_1, H_1
+      nop.f              0
+      adds               rTmpPtr2 = 96, rPolDataPtr
+}
+{ .mfi
+      ldfd               FR_h = [rTmpPtr] // Load h_1
+      nop.f              0
+      // unbiased exponent of deltaX
+      sub                GR_N = GR_N, rExpHalf, 1
+}
+;;
+{ .mfi
+      adds               rTmpPtr3 = 192, rPolDataPtr
+      nop.f              0
+      // sign of GAMMA is negative if p11 is set to 1
+(p11) adds               rSgnGam = -1, r0
+}
+{ .mfi
+      ldfe               fA1 = [rPolDataPtr], 16 // A1
+      nop.f              0
+      nop.i              0
+}
+;;
+{.mfi
+      ldfe               fA2 = [rPolDataPtr], 16 // A2
+      nop.f              0
+      // Get bits 30-15 of X_0 * Z_1
+      pmpyshr2.u         GR_X_1 = GR_X_0,GR_Z_1,15
+}
+{ .mfi
+      ldfpd              fA20, fA19 = [rTmpPtr2], 16 // P8, P7
+      nop.f              0
+      nop.i              0
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      ldfe               fA3 = [rPolDataPtr], 16 // A3
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA18, fA17 = [rTmpPtr2], 16 // P6, P5
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fA4 = [rPolDataPtr], 16 // A4
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA16, fA15 = [rTmpPtr2], 16 // P4, p3
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA5L, fA6 = [rPolDataPtr], 16 // A5, A6
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA14, fA13 = [rTmpPtr2], 16 // P2, P1
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA7, fA8 = [rPolDataPtr], 16 // A7, A8
+      nop.f              0
+      extr.u             GR_Index2 = GR_X_1, 6, 4 // Extract bits 6-9 of X_1
+}
+{ .mfi
+      ldfe               fLnSin2 = [rTmpPtr2], 16
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      shladd             GR_ad_z_2 = GR_Index2, 2, rZ2Addr  // Point to Z_2
+      nop.f              0
+      shladd             GR_ad_tbl_2 = GR_Index2, 4, rTbl2Addr // Point to G_2
+}
+{ .mfi
+      ldfe               fLnSin4 = [rTmpPtr2], 32
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ld4                GR_Z_2 = [GR_ad_z_2] // Load Z_2
+      nop.f              0
+      adds               rTmpPtr = 8, GR_ad_tbl_2
+}
+{ .mfi
+      // Put integer N into rightmost significand
+      setf.sig           fFloatN = GR_N
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fLnSin6 = [rTmpPtr3]
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfe               fLnSin8 = [rTmpPtr2]
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              FR_G2, FR_H2 = [GR_ad_tbl_2],8 // Load G_2, H_2
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfd               FR_h2 = [rTmpPtr] // Load h_2
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fma.s1             fResH = fA20, fResL, fA19 //polynomial for log(|x|)
+     // Get bits 30-15 of X_1 * Z_2
+      pmpyshr2.u         GR_X_2 = GR_X_1,GR_Z_2,15
+}
+{ .mfi
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s1             fA2 = fA2, fDx, fA1 // polynomial for lgammal(|x|)
+      nop.i              0
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      nop.m              0
+      fma.s1             fA18 = fA18, fResL, fA17 //polynomial for log(|x|)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA16 = fA16, fResL, fA15 //polynomial for log(|x|)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA4 = fA4, fDx, fA3 // polynomial for lgammal(|x|)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA14 = fA14, fResL, fA13 //polynomial for log(|x|)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA6 = fA6, fDx, fA5L // polynomial for lgammal(|x|)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fA8, fDx, fA7 // polynomial for lgammal(|x|)
+      extr.u             GR_Index3 = GR_X_2, 1, 5 // Extract bits 1-5 of X_2
+}
+;;
+{ .mfi
+      shladd             GR_ad_tbl_3 = GR_Index3, 4, rTbl3Addr // Point to G_3
+      // loqw part of lnsin polynomial
+      fma.s1             fRes3L = fLnSin4, fDxSqr, fLnSin2
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              FR_G3, FR_H3 = [GR_ad_tbl_3], 8 // Load G_3, H_3
+      fcvt.xf            fFloatN = fFloatN // N as FP number
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fResH, fDxSqr, fA18 // High part of log(|x|)
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               FR_h3 = [GR_ad_tbl_3] // Load h_3
+      fma.s1             fA4 = fA4, fDxSqr, fA2 // Low part of lgammal(|x|)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // high part of lnsin polynomial
+      fma.s1             fRes3H = fLnSin8, fDxSqr, fLnSin6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_G = FR_G, FR_G2 // G = G_1 * G_2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_H = FR_H, FR_H2 // H = H_1 + H_2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_h = FR_h, FR_h2 // h = h_1 + h_2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA16 = fA16, fDxSqr, fA14 // Low part of log(|x|)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, fDxSqr, fA6 // High part of lgammal(|x|)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fResH, fA0L, fA16 // log(|x|)/deltaX^2 - deltaX
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_G = FR_G, FR_G3 // G = (G_1 * G_2) * G_3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_H = FR_H, FR_H3 // H = (H_1 + H_2) + H_3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_h = FR_h, FR_h3 // h = (h_1 + h_2) + h_3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fResH, fDxSqr, fResL // log(|x|)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, fA0L, fA4 // lgammal(|x|)/|x|
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             FR_r = FR_G, fAbsX, f1 // r = G * S_hi - 1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // high part of log(deltaX)= Y_hi = N * log2_hi + H
+      fma.s1             fRes4H = fFloatN, FR_log2_hi, FR_H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // h = N * log2_lo + h
+      fma.s1             FR_h = fFloatN, FR_log2_lo, FR_h
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fPol, fDx, fResH // lgammal(|x|) + log(|x|)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // lnsin/deltaX^2
+      fma.s1             fRes3H = fRes3H, fA0L, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = r * Q4 + Q3
+      fma.s1             FR_poly_lo = FR_r, FR_Q4, FR_Q3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_rsq = FR_r, FR_r // rsq = r * r
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // lnSin - log(|x|) - lgammal(|x|)
+      fms.s1             fResH = fRes3H, fDxSqr, fResH
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_r, FR_Q2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             FR_rcub = FR_rsq, FR_r, f0 // rcub = r^3
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             FR_poly_hi = FR_Q1, FR_rsq, FR_r
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_rcub, FR_h
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      // low part of log(|deltaX|) = Y_lo = poly_hi + poly_lo
+      fadd.s1            fRes4L = FR_poly_hi, FR_poly_lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fResH = fResH, fRes4L
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for |x+1|< 2^(-7) path
+      fsub.s0            f8 = fResH, fRes4H
+      // exit for |x+1|< 2^(-7) path
+      br.ret.sptk        b0
+}
+;;
+
+
+// here if -2^63 < x < -6.0 and x is not an integer
+// Also we are going to filter out cases when x falls in
+// range which is "close enough" to negative root. Rhis case
+// may occur only for -19.5 < x since other roots of lgamma are
+// insignificant from double extended point of view (they are closer
+// to RTN(x) than one ulp(x).
+.align 32
+_negStirling:
+{ .mfi
+      ldfe               fLnSin6 = [rLnSinDataPtr], 32
+      fnma.s1            fInvX = f8, fRcpX, f1 // start of 3rd NR iteration
+      // Get high 4 bits of significand of deltaX
+      extr.u             rIndex1Dx = rSignifDx, 59, 4
+}
+{ .mfi
+      ldfe               fLnSin8 = [rTmpPtr3], 32
+      fadd.s1            FR_h = FR_h, FR_h2 // h = h_1 + h_2
+(p12) cmp.ltu.unc        p6, p0 = rSignifX, rLeftBound
+}
+;;
+{ .mfi
+      ldfe               fLnSin10 = [rLnSinDataPtr], 32
+      fmpy.s1            FR_G = FR_G, FR_G3 // G = (G_1 * G_2) * G_3
+      // Get high 15 bits of significand
+      extr.u             GR_X_0 = rSignifDx, 49, 15
+}
+{ .mfi
+      shladd             GR_ad_z_1 = rIndex1Dx, 2, GR_ad_z_1  // Point to Z_1
+      fadd.s1            FR_H = FR_H, FR_H3 // H = (H_1 + H_2) + H_3
+      // set p6 if x falls in "near root" range
+(p6)  cmp.geu.unc        p6, p0 = rSignifX, rRightBound
+}
+;;
+{ .mfi
+      getf.exp           GR_N =  fDx // Get N = exponent of x
+      fma.s1             fDx4 = fDxSqr, fDxSqr, f0 // deltaX^4
+      adds               rTmpPtr = 96, rBernulliPtr
+}
+{ .mfb
+      ld4                GR_Z_1 = [GR_ad_z_1] // Load Z_1
+      fma.s1             fLnSin34 = fLnSin34, fDxSqr, fLnSin32
+      // branch to special path if x falls in "near root" range
+(p6)  br.cond.spnt       _negRoots
+}
+;;
+.pred.rel "mutex",p10,p11
+{ .mfi
+      ldfe               fLnSin12 = [rTmpPtr3]
+      fma.s1             fLnSin26 = fLnSin26, fDxSqr, fLnSin24
+(p10) cmp.eq             p8, p9 = rXRnd, r0
+}
+{ .mfi
+      ldfe               fLnSin14 = [rLnSinDataPtr]
+      fma.s1             fLnSin30 = fLnSin30, fDxSqr, fLnSin28
+(p11) cmp.eq             p9, p8 = rXRnd, r0
+}
+;;
+{ .mfi
+      ldfpd              fB2, fB2L = [rBernulliPtr], 16
+      fma.s1             fLnSin18 = fLnSin18, fDxSqr, fLnSin16
+      shladd             GR_ad_tbl_1 = rIndex1Dx, 4, rTbl1Addr // Point to G_1
+
+}
+{ .mfi
+      ldfe               fB14 = [rTmpPtr], 16
+      fma.s1             fLnSin22 = fLnSin22, fDxSqr, fLnSin20
+      and                GR_N = GR_N, r17Ones // mask sign bit
+}
+;;
+{ .mfi
+      ldfe               fB4 = [rBernulliPtr], 16
+      fma.s1             fInvX = fInvX, fRcpX, fRcpX // end of 3rd NR iteration
+      // Get bits 30-15 of X_0 * Z_1
+      pmpyshr2.u         GR_X_1 = GR_X_0,GR_Z_1,15
+}
+{ .mfi
+      ldfe               fB16 = [rTmpPtr], 16
+      fadd.s1            FR_h = FR_h, FR_h3 // h = (h_1 + h_2) + h_3
+      adds               rTmpPtr2 = 8, GR_ad_tbl_1
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      ldfe               fB6 = [rBernulliPtr], 16
+      fms.s1             FR_r = FR_G, fSignifX, f1 // r = G * S_hi - 1
+      adds               rTmpPtr3 = -48, rTmpPtr
+}
+{ .mfi
+      ldfe               fB18 = [rTmpPtr], 16
+      // High part of the log(|x|) = Y_hi = N * log2_hi + H
+      fma.s1             fResH = fFloatN, FR_log2_hi, FR_H
+      sub                GR_N = GR_N, rExpHalf, 1 // unbiased exponent of deltaX
+}
+;;
+.pred.rel "mutex",p8,p9
+{ .mfi
+      ldfe               fB8 = [rBernulliPtr], 16
+      fma.s1             fLnSin36 = fLnSin36, fDx4, fLnSin34
+      // sign of GAMMA(x) is negative
+(p8)  adds               rSgnGam = -1, r0
+}
+{ .mfi
+      ldfe               fB20 = [rTmpPtr], -160
+      fma.s1             fRes5H = fLnSin4, fDxSqr, f0
+      // sign of GAMMA(x) is positive
+(p9)  adds               rSgnGam = 1, r0
+
+}
+;;
+{ .mfi
+      ldfe               fB10 = [rBernulliPtr], 16
+      fma.s1             fLnSin30 = fLnSin30, fDx4, fLnSin26
+(p14) adds               rTmpPtr = -160, rTmpPtr
+}
+{ .mfi
+      ldfe               fB12 = [rTmpPtr3], 16
+      fma.s1             fDx8 = fDx4, fDx4, f0 // deltaX^8
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+;;
+{ .mfi
+      ldfps              fGDx, fHDx = [GR_ad_tbl_1], 8 // Load G_1, H_1
+      fma.s1             fDx6 = fDx4, fDxSqr, f0 // deltaX^6
+      extr.u             GR_Index2 = GR_X_1, 6, 4 // Extract bits 6-9 of X_1
+}
+{ .mfi
+      ldfd               fhDx = [rTmpPtr2] // Load h_1
+      fma.s1             fLnSin22 = fLnSin22, fDx4, fLnSin18
+      nop.i              0
+}
+;;
+{ .mfi
+      // Load two parts of C
+      ldfpd              fRes1H, fRes1L = [rTmpPtr], 16
+      fma.s1             fRcpX = fInvX, fInvX, f0  // (1/x)^2
+      shladd             GR_ad_tbl_2 = GR_Index2, 4, rTbl2Addr // Point to G_2
+}
+{ .mfi
+      shladd             GR_ad_z_2 = GR_Index2, 2, rZ2Addr  // Point to Z_2
+      fma.s1             FR_h = fFloatN, FR_log2_lo, FR_h// h = N * log2_lo + h
+      nop.i              0
+}
+;;
+{ .mfi
+      ld4                GR_Z_2 = [GR_ad_z_2] // Load Z_2
+      fnma.s1            fInvXL = f8, fInvX, f1 // relative error of 1/x
+      nop.i              0
+}
+{ .mfi
+      adds               rTmpPtr2 = 8, GR_ad_tbl_2
+      fma.s1             fLnSin8 = fLnSin8, fDxSqr, fLnSin6
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              FR_G2, FR_H2 = [GR_ad_tbl_2],8   // Load G_2, H_2
+      // poly_lo = r * Q4 + Q3
+      fma.s1             FR_poly_lo = FR_r, FR_Q4, FR_Q3
+      nop.i              0
+}
+{ .mfi
+      ldfd               fh2Dx = [rTmpPtr2] // Load h_2
+      fmpy.s1            FR_rsq = FR_r, FR_r // rsq = r * r
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA1L = fB2, fInvX, f0 // (B2*(1/x))hi
+      nop.i              0
+}
+{ .mfi
+      // Put integer N into rightmost significand
+      setf.sig           fFloatNDx = GR_N
+      fms.s1             fRes4H = fResH, f1, f1  // ln(|x|)hi - 1
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2H = fRes5H, fLnSin2//(lnSin4*DeltaX^2 + lnSin2)hi
+      // Get bits 30-15 of X_1 * Z_2
+      pmpyshr2.u         GR_X_2 = GR_X_1,GR_Z_2,15
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fRes5L = fLnSin4, fDxSqr, fRes5H
+      nop.i              0
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      nop.m              0
+      fma.s1             fInvX4 = fRcpX, fRcpX, f0 // (1/x)^4
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB6 = fB6, fRcpX, fB4
+      nop.i              0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fma.s1             fB18 = fB18, fRcpX, fB16
+      nop.i              0
+}
+{ .mfi
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s1             fInvXL = fInvXL, fInvX, f0 // low part of 1/x
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_r, FR_Q2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             FR_rcub = FR_rsq, FR_r, f0 // rcub = r^3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes3H = fRes4H, f8, f0 // (-|x|*(ln(|x|)-1))hi
+      extr.u             GR_Index3 = GR_X_2, 1, 5  // Extract bits 1-5 of X_2
+}
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             FR_poly_hi = FR_Q1, FR_rsq, FR_r
+      nop.i              0
+}
+;;
+{ .mfi
+      shladd             GR_ad_tbl_3 = GR_Index3, 4, rTbl3Addr // Point to G_3
+      fms.s1             fA2L = fB2, fInvX, fA1L // delta(B2*(1/x))
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnma.s1            fBrnH = fRes1H, f1, fA1L // (-C - S(1/x))hi
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              fG3Dx, fH3Dx = [GR_ad_tbl_3],8 // Load G_3, H_3
+      fma.s1             fInvX8 = fInvX4, fInvX4, f0 // (1/x)^8
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB10 = fB10, fRcpX, fB8
+      nop.i              0
+}
+;;
+
+{ .mfi
+      ldfd               fh3Dx = [GR_ad_tbl_3] // Load h_3
+      fma.s1             fB20 = fB20, fInvX4, fB18
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB14 = fB14, fRcpX, fB12
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36, fDx8, fLnSin30
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin12 = fLnSin12, fDxSqr, fLnSin10
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes2L = fLnSin2, fRes2H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fRes2H, fDxSqr, f0 // high part of LnSin
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fnma.s1            fResH = fResH, FR_MHalf, fResH // -0.5*ln(|x|)hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fmpy.s1            fGDx = fGDx, FR_G2 // G = G_1 * G_2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_rcub, FR_h
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // B2lo*(1/x)hi+ delta(B2*(1/x))
+      fma.s1             fA2L = fB2L, fInvX, fA2L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB20 = fB20, fInvX4, fB14
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB10 = fB10, fInvX4, fB6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fcvt.xf            fFloatNDx = fFloatNDx
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin14 = fLnSin14, fDx4, fLnSin12
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36, fDx8, fLnSin22
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fRes3L = fRes4H, f8, fRes3H // delta(-|x|*(ln(|x|)-1))
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fmpy.s1            fGDx = fGDx, fG3Dx // G = (G_1 * G_2) * G_3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // (-|x|*(ln(|x|)-1) - 0.5ln(|x|))hi
+      fadd.s1            fRes4H = fRes3H, fResH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA2L = fInvXL, fB2, fA2L //(B2*(1/x))lo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // low part of log(|x|) = Y_lo = poly_hi + poly_lo
+      fadd.s1            fResL = FR_poly_hi, FR_poly_lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB20 = fB20, fInvX8, fB10
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fInvX3 = fInvX, fRcpX, f0 // (1/x)^3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fHDx = fHDx, FR_H2 // H = H_1 + H_2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes5L = fRes5L, fLnSin2L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fRes5H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fhDx = fhDx, fh2Dx // h = h_1 + h_2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fBrnL = fRes1H, fMOne, fBrnH
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             FR_r = fGDx, fNormDx, f1 // r = G * S_hi - 1
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes3L = fResL, f8 , fRes3L // (-|x|*(ln(|x|)-1))lo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes4L = fRes3H, fRes4H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // low part of "Bernulli" polynomial
+      fma.s1             fB20 = fB20, fInvX3, fA2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnma.s1            fResL = fResL, FR_MHalf, fResL // -0.5*ln(|x|)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fHDx = fHDx, fH3Dx // H = (H_1 + H_2) + H_3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fPolL = fRes2H, fDxSqr, fPol
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fhDx = fhDx, fh3Dx // h = (h_1 + h_2) + h_3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // (-|x|*(ln(|x|)-1) - 0.5ln(|x|) - C - S(1/x))hi
+      fadd.s1            fB14 = fRes4H, fBrnH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = r * Q4 + Q3
+      fma.s1             FR_poly_lo = FR_r, FR_Q4, FR_Q3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_rsq = FR_r, FR_r // rsq = r * r
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fResH
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fBrnL = fBrnL, fA1L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (-|x|*(ln(|x|)-1))lo + (-0.5ln(|x|))lo
+      fadd.s1            fRes3L = fRes3L, fResL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnma.s1            fB20 = fRes1L, f1, fB20 // -Clo - S(1/x)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fRes5L // (lnSin4*DeltaX^2 + lnSin2)lo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPolL = fDxSqrL, fRes2H, fPolL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin14 = fLnSin14, fDx4, fLnSin8
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin36,  fDx8, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_r, FR_Q2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             FR_rcub = FR_rsq, FR_r, f0 // rcub = r^3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             FR_poly_hi = FR_Q1, FR_rsq, FR_r
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fB12 = fRes4H, fB14
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (-|x|*(ln(|x|)-1) - 0.5ln(|x|))lo
+      fadd.s1            fRes4L = fRes4L, fRes3L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fBrnL = fBrnL, fB20 // (-C - S(1/x))lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // high part of log(|DeltaX|) = Y_hi = N * log2_hi + H
+      fma.s1             fLnDeltaH = fFloatNDx, FR_log2_hi, fHDx
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // h = N * log2_lo + h
+      fma.s1             fhDx = fFloatNDx, FR_log2_lo, fhDx
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPolL = fRes2L, fDxSqr, fPolL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin14 = fLnSin36,  fDxSqr, fLnSin14
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (-|x|*(ln(|x|)-1) - 0.5ln(|x|))lo + (- C - S(1/x))lo
+      fadd.s1            fBrnL = fBrnL, fRes4L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fB12 = fB12, fBrnH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_rcub, fhDx
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnma.s1            fRes1H = fLnDeltaH, f1, fPol//(-ln(|DeltaX|) + LnSin)hi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPolL = fDxSqrL, fRes2L, fPolL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin36 = fLnSin14, fDx6, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (-|x|*(ln(|x|)-1) - 0.5ln(|x|) - C - S(1/x))lo
+      fadd.s1            fB12 = fB12, fBrnL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // low part of log(|DeltaX|) =  Y_lo = poly_hi + poly_lo
+      fadd.s1            fLnDeltaL= FR_poly_hi, FR_poly_lo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fRes1L = fLnDeltaH, fMOne, fRes1H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fPolL = fPolL, fLnSin36
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      //(-|x|*(ln(|x|)-1)-0.5ln(|x|) - C - S(1/x))hi + (-ln(|DeltaX|) + LnSin)hi
+      fadd.s1            f8 = fRes1H, fB14
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      //max((-|x|*(ln(|x|)-1)-0.5ln(|x|) - C - S(1/x))hi,
+      //    (-ln(|DeltaX|) + LnSin)hi)
+      famax.s1           fMaxNegStir = fRes1H, fB14
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      //min((-|x|*(ln(|x|)-1)-0.5ln(|x|) - C - S(1/x))hi,
+      //    (-ln(|DeltaX|) + LnSin)hi)
+      famin.s1           fMinNegStir = fRes1H, fB14
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fPol
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // (-ln(|DeltaX|))lo + (LnSin)lo
+      fnma.s1            fPolL = fLnDeltaL, f1, fPolL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            f9 = fMaxNegStir, f8 // delta1
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fPolL // (-ln(|DeltaX|) + LnSin)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            f9 = f9, fMinNegStir
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fB12
+      nop.i              0
+}
+;;
+{ .mfi
+      // low part of the result
+      fadd.s1            f9 = f9, fRes1L
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for -2^63 < x < -6.0 path
+      fma.s0             f8 = f8, f1, f9
+      // exit here  for -2^63 < x < -6.0 path
+      br.ret.sptk        b0
+}
+;;
+
+// here if x falls in neighbourhood of any negative root
+// "neighbourhood" typically means that |lgammal(x)| < 0.17
+// on the [-3.0,-2.0] range |lgammal(x)| has even less
+// magnitude
+// rXint contains index of the root
+// p10 is set if root belongs to "right" ones
+// p11 is set if root belongs to "left" ones
+// lgammal(x) is approximated by polynomial of
+// 19th degree from (x - root) argument
+.align 32
+_negRoots:
+{ .mfi
+      addl          rPolDataPtr= @ltoff(lgammal_right_roots_polynomial_data),gp
+      nop.f              0
+      shl                rTmpPtr2 = rXint, 7 // (i*16)*8
+}
+{ .mfi
+      adds               rRootsAddr = -288, rRootsBndAddr
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fRoot = [rRootsAddr] // FP representation of root
+      nop.f              0
+      shl                rTmpPtr = rXint, 6  // (i*16)*4
+}
+{ .mfi
+(p11) adds               rTmpPtr2 = 3536, rTmpPtr2
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      shladd             rTmpPtr = rXint, 4, rTmpPtr // (i*16) + (i*16)*4
+}
+{ .mfi
+      adds               rTmpPtr3 = 32, rTmpPtr2
+      nop.f              0
+      nop.i              0
+}
+;;
+.pred.rel "mutex",p10,p11
+{ .mfi
+      add                rTmpPtr3 = rTmpPtr, rTmpPtr3
+      nop.f              0
+(p10) cmp.eq             p8, p9 = rXRnd, r0
+}
+{ .mfi
+      // (i*16) + (i*16)*4 + (i*16)*8
+      add                rTmpPtr = rTmpPtr, rTmpPtr2
+      nop.f              0
+(p11) cmp.eq             p9, p8 = rXRnd, r0
+}
+;;
+{ .mfi
+      add                rTmpPtr2 = rPolDataPtr, rTmpPtr3
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      add                rPolDataPtr = rPolDataPtr, rTmpPtr // begin + offsett
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA0, fA0L = [rPolDataPtr], 16 // A0
+      nop.f              0
+      adds               rTmpPtr = 112, rTmpPtr2
+}
+{ .mfi
+      ldfpd              fA2, fA2L = [rTmpPtr2], 16 // A2
+      nop.f              0
+      cmp.eq             p12, p13 = 4, rSgnGamSize
+}
+;;
+{ .mfi
+      ldfpd              fA1, fA1L = [rPolDataPtr], 16 // A1
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfe               fA3 = [rTmpPtr2], 128 // A4
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA12, fA13 = [rTmpPtr], 16 // A12, A13
+      nop.f              0
+      adds               rTmpPtr3 = 64, rPolDataPtr
+}
+{ .mfi
+      ldfpd              fA16, fA17 = [rTmpPtr2], 16 // A16, A17
+      nop.f              0
+      adds               rPolDataPtr = 32, rPolDataPtr
+}
+;;
+.pred.rel "mutex",p8,p9
+{ .mfi
+      ldfpd              fA14, fA15 = [rTmpPtr], 16 // A14, A15
+      nop.f              0
+      // sign of GAMMA(x) is negative
+(p8)  adds               rSgnGam = -1, r0
+}
+{ .mfi
+      ldfpd              fA18, fA19 = [rTmpPtr2], 16 // A18, A19
+      nop.f              0
+      // sign of GAMMA(x) is positive
+(p9)  adds               rSgnGam = 1, r0
+}
+;;
+{ .mfi
+      ldfe               fA4 = [rPolDataPtr], 16 // A4
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA6, fA7 = [rTmpPtr3], 16 // A6, A7
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fA5 = [rPolDataPtr], 16 // A5
+      // if x equals to (rounded) root exactly
+      fcmp.eq.s1         p6, p0 = f8, fRoot
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA8, fA9 = [rTmpPtr3], 16 // A8, A9
+      fms.s1             FR_FracX = f8, f1, fRoot
+      nop.i              0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p12) st4                [rSgnGamAddr] = rSgnGam
+      nop.f              0
+      nop.i              0
+}
+{ .mfb
+      // store signgam if size of variable is 8 bytes
+(p13) st8                [rSgnGamAddr] = rSgnGam
+      // answer if x equals to (rounded) root exactly
+(p6)  fadd.s0            f8 = fA0, fA0L
+      // exit if x equals to (rounded) root exactly
+(p6)  br.ret.spnt        b0
+}
+;;
+{ .mmf
+      ldfpd              fA10, fA11 = [rTmpPtr3], 16 // A10, A11
+      nop.m              0
+      nop.f              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fA2, FR_FracX, f0 // (A2*x)hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA4L = FR_FracX, FR_FracX, f0 // x^2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, FR_FracX, fA16
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fma.s1             fA13 = fA13, FR_FracX, fA12
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA19 = fA19, FR_FracX, fA18
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, FR_FracX, fA14
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fPol = fA7, FR_FracX, fA6
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, FR_FracX, fA8
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fResL = fA2, FR_FracX, fResH // delta(A2*x)
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fadd.s1            fRes1H = fResH, fA1 // (A2*x + A1)hi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fA11, FR_FracX, fA10
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fma.s1             fA5L = fA4L, fA4L, f0 // x^4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA19 = fA19, fA4L, fA17
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, fA4L, fA13
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, FR_FracX, fA5
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fma.s1             fA3L = fA4L, FR_FracX, f0 // x^3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // delta(A2*x) + A2L*x = (A2*x)lo
+      fma.s1             fResL = fA2L, FR_FracX, fResL
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fsub.s1            fRes1L = fA1, fRes1H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fA11, fA4L, fA9
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fma.s1             fA19 = fA19, fA5L, fA15
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fPol = fPol, FR_FracX, fA4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fResL = fResL, fA1L // (A2*x)lo + A1
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fResH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes2H = fRes1H, FR_FracX, f0 // ((A2*x + A1)*x)hi
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fA19 = fA19, fA5L, fA11
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fPol = fPol, FR_FracX, fA3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fResL // (A2*x + A1)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // delta((A2*x + A1)*x)
+      fms.s1             fRes2L = fRes1H, FR_FracX, fRes2H
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fadd.s1            fRes3H = fRes2H, fA0 // ((A2*x + A1)*x + A0)hi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA19 = fA19, fA5L, f0
+      nop.i              0
+}
+
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes2L = fRes1L, FR_FracX, fRes2L // ((A2*x + A1)*x)lo
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fsub.s1            fRes3L = fRes2H, fRes3H
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fPol = fA19, FR_FracX, fPol
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fRes3L, fA0
+      nop.i              0
+}
+{.mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fA0L // ((A2*x + A1)*x)lo + A0L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fRes3L, fRes2L // (((A2*x + A1)*x) + A0)lo
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fRes3L = fPol, fA3L, fRes3L
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for arguments which are close to negative roots
+      fma.s0             f8 = fRes3H, f1, fRes3L
+      // exit here for arguments which are close to negative roots
+      br.ret.sptk        b0
+}
+;;
+
+// here if |x| < 0.5
+.align 32
+lgammal_0_half:
+{ .mfi
+      ld4                GR_Z_1 = [rZ1offsett] // Load Z_1
+      fma.s1             fA4L = f8, f8, f0 // x^2
+      addl               rPolDataPtr    = @ltoff(lgammal_0_Half_data), gp
+}
+{ .mfi
+      shladd             GR_ad_tbl_1 = GR_Index1, 4, rTbl1Addr// Point to G_1
+      nop.f              0
+      addl               rLnSinDataPtr    = @ltoff(lgammal_lnsin_data), gp
+}
+;;
+{ .mfi
+      ldfps              FR_G, FR_H = [GR_ad_tbl_1],8 // Load G_1, H_1
+      nop.f              0
+      // Point to Constants_Z_2
+      add                GR_ad_z_2 = 0x140, GR_ad_z_1
+}
+{ .mfi
+      add                GR_ad_q = -0x60, GR_ad_z_1 // Point to Constants_Q
+      nop.f              0
+      // Point to Constants_G_H_h2
+      add                GR_ad_tbl_2 = 0x180, GR_ad_z_1
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      // Point to Constants_G_H_h3
+      add                GR_ad_tbl_3 = 0x280, GR_ad_z_1
+}
+{ .mfi
+      ldfd               FR_h = [GR_ad_tbl_1] // Load h_1
+      nop.f              0
+      sub                GR_N = rExpX, rExpHalf, 1
+}
+;;
+{ .mfi
+      ld8                rLnSinDataPtr    = [rLnSinDataPtr]
+      nop.f              0
+      // Get bits 30-15 of X_0 * Z_1
+      pmpyshr2.u         GR_X_1 = GR_X_0,GR_Z_1,15
+}
+{ .mfi
+      ldfe               FR_log2_hi = [GR_ad_q],16 // Load log2_hi
+      nop.f              0
+      sub                GR_N = r0, GR_N
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      ldfe               FR_log2_lo = [GR_ad_q], 16 // Load log2_lo
+      nop.f              0
+      add                rTmpPtr2 = 320, rPolDataPtr
+}
+{ .mfi
+      add                rTmpPtr = 32, rPolDataPtr
+      nop.f              0
+      // exponent of 0.25
+      adds               rExp2 = -1, rExpHalf
+}
+;;
+{ .mfi
+      ldfpd              fA3, fA3L = [rPolDataPtr], 16 // A3
+      fma.s1             fA5L = fA4L, fA4L, f0 // x^4
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA1, fA1L = [rTmpPtr], 16 // A1
+      fms.s1             fB8 = f8, f8, fA4L // x^2 - <x^2>
+      // set p6 if -0.5 < x <= -0.25
+(p15) cmp.eq.unc         p6, p0 = rExpX, rExp2
+}
+;;
+{ .mfi
+      ldfpd              fA2, fA2L = [rPolDataPtr], 16 // A2
+      nop.f              0
+      // set p6 if -0.5 < x <= -0.40625
+(p6)  cmp.le.unc         p6, p0 = 10, GR_Index1
+}
+{ .mfi
+      ldfe               fA21 = [rTmpPtr2], -16 // A21
+      // Put integer N into rightmost significand
+      nop.f              0
+      adds               rTmpPtr = 240, rTmpPtr
+}
+;;
+{ .mfi
+      setf.sig           fFloatN = GR_N
+      nop.f              0
+      extr.u             GR_Index2 = GR_X_1, 6, 4 // Extract bits 6-9 of X_1
+}
+{ .mfi
+      ldfe               FR_Q4 = [GR_ad_q], 16 // Load Q4
+      nop.f              0
+      adds               rPolDataPtr = 304, rPolDataPtr
+}
+;;
+{ .mfi
+      ldfe               fA20 = [rTmpPtr2], -32 // A20
+      nop.f              0
+      shladd             GR_ad_z_2 = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+}
+{ .mfi
+      ldfe               fA19 = [rTmpPtr], -32 // A19
+      nop.f              0
+      shladd             GR_ad_tbl_2 = GR_Index2, 4, GR_ad_tbl_2// Point to G_2
+}
+;;
+{ .mfi
+      ldfe               fA17 = [rTmpPtr], -32 // A17
+      nop.f              0
+      adds               rTmpPtr3 = 8, GR_ad_tbl_2
+}
+{ .mfb
+      ldfe               fA18 = [rTmpPtr2], -32 // A18
+      nop.f              0
+      // branch to special path for -0.5 < x <= 0.40625
+(p6)  br.cond.spnt       lgammal_near_neg_half
+}
+;;
+{ .mmf
+      ld4                GR_Z_2 = [GR_ad_z_2] // Load Z_2
+      ldfe               fA15 = [rTmpPtr], -32 // A15
+      fma.s1             fB20 = fA5L, fA5L, f0 // x^8
+}
+;;
+{ .mmf
+      ldfe               fA16 = [rTmpPtr2], -32 // A16
+      ldfe               fA13 = [rTmpPtr], -32 // A13
+      fms.s1             fB16 = fA4L, fA4L, fA5L
+}
+;;
+{ .mmf
+      ldfps              FR_G2, FR_H2 = [GR_ad_tbl_2], 8 // Load G_2, H_2
+      ldfd               FR_h2 = [rTmpPtr3] // Load h_2
+      fmerge.s           fB10 = f8, fA5L // sign(x) * x^4
+}
+;;
+{ .mmi
+      ldfe               fA14 = [rTmpPtr2], -32 // A14
+      ldfe               fA11 = [rTmpPtr], -32 // A11
+      // Get bits 30-15 of X_1 * Z_2
+      pmpyshr2.u         GR_X_2 = GR_X_1,GR_Z_2,15
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      ldfe               fA12 = [rTmpPtr2], -32 // A12
+      fma.s1             fRes4H = fA3, fAbsX, f0
+      adds               rTmpPtr3 = 16, GR_ad_q
+}
+{ .mfi
+      ldfe               fA9 = [rTmpPtr], -32 // A9
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mmf
+      ldfe               fA10 = [rTmpPtr2], -32 // A10
+      ldfe               fA7 = [rTmpPtr], -32 // A7
+      fma.s1             fB18 = fB20, fB20, f0 // x^16
+}
+;;
+{ .mmf
+      ldfe               fA8 = [rTmpPtr2], -32 // A8
+      ldfe               fA22 = [rPolDataPtr], 16 // A22
+      fcvt.xf            fFloatN = fFloatN
+}
+;;
+{ .mfi
+      ldfe               fA5 = [rTmpPtr], -32 // A5
+      fma.s1             fA21 = fA21, fAbsX, fA20 // v16
+      extr.u             GR_Index3 = GR_X_2, 1, 5 // Extract bits 1-5 of X_2
+}
+{ .mfi
+      ldfe               fA6 = [rTmpPtr2], -32 // A6
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mmf
+      // Point to G_3
+      shladd             GR_ad_tbl_3 = GR_Index3, 4, GR_ad_tbl_3
+      ldfe               fA4 = [rTmpPtr2], -32 // A4
+      fma.s1             fA19 = fA19, fAbsX, fA18 // v13
+}
+;;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      ldfps              FR_G3, FR_H3 = [GR_ad_tbl_3],8 // Load G_3, H_3
+      fms.s1             fRes4L = fA3, fAbsX, fRes4H
+(p14) adds               rSgnGam = 1, r0
+}
+{ .mfi
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+      fadd.s1            fRes2H = fRes4H, fA2
+(p15) adds               rSgnGam = -1, r0
+}
+;;
+
+{ .mfi
+      ldfd               FR_h3 = [GR_ad_tbl_3] // Load h_3
+      fma.s1             fA17 = fA17, fAbsX, fA16 // v12
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               FR_Q3 = [GR_ad_q], 32 // Load Q3
+      fmpy.s1            FR_G = FR_G, FR_G2 // G = G_1 * G_2
+      nop.i              0
+}
+{ .mfi
+      ldfe               FR_Q2 = [rTmpPtr3], 16 // Load Q2
+      fadd.s1            FR_H = FR_H, FR_H2 // H = H_1 + H_2
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               FR_Q1 = [GR_ad_q] // Load Q1
+      fma.s1             fA15 = fA15, fAbsX, fA14 // v8
+      nop.i              0
+}
+{ .mfi
+      adds               rTmpPtr3 = 32, rLnSinDataPtr
+      fadd.s1            FR_h = FR_h, FR_h2 // h = h_1 + h_2
+      nop.i              0
+}
+;;
+{ .mmf
+      ldfpd              fLnSin2, fLnSin2L = [rLnSinDataPtr], 16
+      ldfe               fLnSin6 = [rTmpPtr3], 32
+      fma.s1             fA13 = fA13, fAbsX, fA12 // v7
+
+}
+;;
+{ .mfi
+      ldfe               fLnSin4 = [rLnSinDataPtr], 32
+      fma.s1             fRes4L = fA3L, fAbsX, fRes4L
+      nop.i              0
+}
+{ .mfi
+      ldfe               fLnSin10 = [rTmpPtr3], 32
+      fsub.s1            fRes2L = fA2, fRes2H
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fLnSin8 = [rLnSinDataPtr], 32
+      fma.s1             fResH = fRes2H, fAbsX, f0
+      nop.i              0
+}
+{ .mfi
+      ldfe               fLnSin14 = [rTmpPtr3], 32
+      fma.s1             fA22 = fA22, fA4L, fA21 // v15
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fLnSin12 = [rLnSinDataPtr], 32
+      fma.s1             fA9 = fA9, fAbsX, fA8 // v4
+      nop.i              0
+}
+{ .mfi
+      ldfd               fLnSin18 = [rTmpPtr3], 16
+      fma.s1             fA11 = fA11, fAbsX, fA10 // v5
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fLnSin16 = [rLnSinDataPtr], 24
+      fma.s1             fA19 = fA19, fA4L, fA17 // v11
+      nop.i              0
+}
+{ .mfi
+      ldfd               fLnSin22 = [rTmpPtr3], 16
+      fma.s1             fPolL = fA7, fAbsX, fA6
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               fLnSin20 = [rLnSinDataPtr], 16
+      fmpy.s1            FR_G = FR_G, FR_G3 // G = (G_1 * G_2) * G_3
+      nop.i              0
+}
+{ .mfi
+      ldfd               fLnSin26 = [rTmpPtr3], 16
+      fadd.s1            FR_H = FR_H, FR_H3 // H = (H_1 + H_2) + H_3
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               fLnSin24 = [rLnSinDataPtr], 16
+      fadd.s1            fRes2L = fRes2L, fRes4H
+      nop.i              0
+}
+{ .mfi
+      ldfd               fLnSin30 = [rTmpPtr3], 16
+      fadd.s1            fA2L = fA2L, fRes4L
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               fLnSin28 = [rLnSinDataPtr], 16
+      fms.s1             fResL = fRes2H, fAbsX, fResH
+      nop.i              0
+}
+{ .mfi
+      ldfd               fLnSin34 = [rTmpPtr3], 8
+      fadd.s1            fRes2H = fResH, fA1
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               fLnSin32 = [rLnSinDataPtr]
+      fma.s1             fA11 = fA11, fA4L, fA9 // v3
+      nop.i              0
+}
+{ .mfi
+      ldfd               fLnSin36 = [rTmpPtr3]
+      fma.s1             fA15 = fA15, fA4L, fA13 // v6
+      nop.i              0
+}
+;;
+
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fadd.s1            FR_h = FR_h, FR_h3 // h = (h_1 + h_2) + h_3
+      nop.i              0
+}
+{ .mfi
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s1             fA5 = fA5, fAbsX, fA4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             FR_r = FR_G, fSignifX, f1 // r = G * S_hi - 1
+      nop.i              0
+}
+{ .mfi
+      nop.m               0
+      // High part of the log(|x|): Y_hi = N * log2_hi + H
+      fms.s1             FR_log2_hi = fFloatN, FR_log2_hi, FR_H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fA3L = fRes2L, fA2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA22 = fA22, fA5L, fA19
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes2L = fA1, fRes2H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fRes3H = fRes2H, f8, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, fA5L, fA11 // v2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin18 = fLnSin18, fA4L, fLnSin16
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // h = N * log2_lo + h
+      fms.s1             FR_h = fFloatN, FR_log2_lo, FR_h
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPolL = fPolL, fA4L, fA5
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = r * Q4 + Q3
+      fma.s1             FR_poly_lo = FR_r, FR_Q4, FR_Q3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_rsq = FR_r, FR_r // rsq = r * r
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResL = fA3L, fAbsX, fResL
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin30 = fLnSin30, fA4L, fLnSin28
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fResH
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fRes3L = fRes2H, f8, fRes3H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1H = fRes3H, FR_log2_hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fB20, fA22, fA15
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin34 = fLnSin34, fA4L, fLnSin32
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin14 = fLnSin14, fA4L, fLnSin12
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_r, FR_Q2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnma.s1            FR_rcub = FR_rsq, FR_r, f0 // rcub = r^3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             FR_poly_hi = FR_Q1, FR_rsq, FR_r
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fA1L = fA1L, fResL
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin22 = fLnSin22, fA4L, fLnSin20
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin26 = fLnSin26, fA4L, fLnSin24
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes1L = FR_log2_hi, fRes1H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, fA5L, fPolL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin34 = fLnSin36, fA5L, fLnSin34
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin18 = fLnSin18, fA5L, fLnSin14
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin6 = fLnSin6, fA4L, fLnSin4
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin10 = fLnSin10, fA4L, fLnSin8
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             FR_poly_hi = FR_Q1, FR_rsq, FR_r
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fA1L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_rcub, FR_h
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB2 = fLnSin2, fA4L, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fRes3H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, fB10, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin26 = fLnSin26, fA5L, fLnSin22
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin34 = fLnSin34, fA5L, fLnSin30
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin10 = fLnSin10, fA5L, fLnSin6
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin2L = fLnSin2L, fA4L, f0
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      fma.s1             fRes3L = fRes2L, f8, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Y_lo = poly_hi + poly_lo
+      fsub.s1            FR_log2_lo = FR_poly_lo, FR_poly_hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fB4 = fLnSin2, fA4L, fB2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2H = fRes1H, fPol
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin34 = fLnSin34, fB20, fLnSin26
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin18 = fLnSin18, fB20, fLnSin10
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fLnSin2L = fB8, fLnSin2, fLnSin2L
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_log2_lo = FR_log2_lo, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes2L = fRes1H, fRes2H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB6 = fLnSin34, fB18, fLnSin18
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fB4 = fLnSin2L, fB4
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, FR_log2_lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fPol
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fB12 = fB6, fA5L, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fRes1L
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      fms.s1             fB14 = fB6, fA5L, fB12
+      nop.i              0
+}
+{ .mfb
+      nop.m              0
+      fadd.s1            fLnSin30 = fB2, fB12
+      // branch out if x is negative
+(p15) br.cond.spnt       _O_Half_neg
+}
+;;
+{ .mfb
+      nop.m              0
+      // sign(x)*Pol(|x|) - log(|x|)
+      fma.s0             f8 = fRes2H, f1, fRes2L
+      // it's an answer already for positive x
+      // exit if 0 < x < 0.5
+      br.ret.sptk        b0
+}
+;;
+
+// here if x is negative and |x| < 0.5
+.align 32
+_O_Half_neg:
+{ .mfi
+      nop.m              0
+      fma.s1             fB14 = fB16, fB6, fB14
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fLnSin16 = fB2, fLnSin30
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fResH = fLnSin30, fRes2H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fLnSin16 = fLnSin16, fB12
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fB4 = fB14, fB4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fLnSin16 = fB4, fLnSin16
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fResL = fRes2H, fResH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fResL = fResL, fLnSin30
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fLnSin16 = fLnSin16, fRes2L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fResL = fResL, fLnSin16
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for -0.5 < x < 0
+      fma.s0             f8 = fResH, f1, fResL
+      // exit for -0.5 < x < 0
+      br.ret.sptk        b0
+}
+;;
+
+// here if x >= 8.0
+// there are two computational paths:
+// 1) For x >10.0 Stirling's formula is used
+// 2) Polynomial approximation for 8.0 <= x <= 10.0
+.align 32
+lgammal_big_positive:
+{ .mfi
+      addl               rPolDataPtr = @ltoff(lgammal_data), gp
+      fmerge.se          fSignifX =  f1, f8
+      // Get high 15 bits of significand
+      extr.u             GR_X_0 = rSignifX, 49, 15
+}
+{.mfi
+      shladd             rZ1offsett = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      fnma.s1            fInvX = f8, fRcpX, f1 // start of 1st NR iteration
+      adds               rSignif1andQ = 0x5, r0
+}
+;;
+{.mfi
+      ld4                GR_Z_1 = [rZ1offsett] // Load Z_1
+      nop.f              0
+      shl                rSignif1andQ = rSignif1andQ, 61 // significand of 1.25
+}
+{  .mfi
+      cmp.eq             p8, p0 = rExpX, rExp8 // p8 = 1 if 8.0 <= x < 16
+      nop.f              0
+      adds               rSgnGam = 1, r0 // gamma is positive at this range
+}
+;;
+{ .mfi
+      shladd             GR_ad_tbl_1 = GR_Index1, 4, rTbl1Addr// Point to G_1
+      nop.f              0
+      add                GR_ad_q = -0x60, GR_ad_z_1 // Point to Constants_Q
+}
+{ .mlx
+      ld8                rPolDataPtr    = [rPolDataPtr]
+      movl               rDelta = 0x3FF2000000000000
+}
+;;
+{ .mfi
+      ldfps              FR_G, FR_H = [GR_ad_tbl_1],8 // Load G_1, H_1
+      nop.f              0
+      add                GR_ad_z_2 = 0x140, GR_ad_z_1 // Point to Constants_Z_2
+}
+{ .mfi
+      // Point to Constants_G_H_h2
+      add                GR_ad_tbl_2 = 0x180, GR_ad_z_1
+      nop.f              0
+      // p8 = 1 if 8.0 <= x <= 10.0
+(p8)  cmp.leu.unc        p8, p0 = rSignifX, rSignif1andQ
+}
+;;
+{ .mfi
+      ldfd               FR_h = [GR_ad_tbl_1] // Load h_1
+      nop.f              0
+      // Get bits 30-15 of X_0 * Z_1
+      pmpyshr2.u         GR_X_1 = GR_X_0,GR_Z_1,15
+}
+{ .mfb
+(p8)  setf.d             FR_MHalf = rDelta
+      nop.f              0
+(p8)  br.cond.spnt       lgammal_8_10 // branch out if 8.0 <= x <= 10.0
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      ldfe               fA1 = [rPolDataPtr], 16 // Load overflow threshold
+      fma.s1             fRcpX = fInvX, fRcpX, fRcpX // end of 1st NR iteration
+      // Point to Constants_G_H_h3
+      add                GR_ad_tbl_3 = 0x280, GR_ad_z_1
+}
+{ .mlx
+      nop.m              0
+      movl               rDelta = 0xBFE0000000000000 // -0.5 in DP
+}
+;;
+{ .mfi
+      ldfe               FR_log2_hi = [GR_ad_q],16 // Load log2_hi
+      nop.f              0
+      sub                GR_N = rExpX, rExpHalf, 1 // unbiased exponent of x
+}
+;;
+{ .mfi
+      ldfe               FR_log2_lo = [GR_ad_q],16 // Load log2_lo
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      setf.d             FR_MHalf = rDelta
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      // Put integer N into rightmost significand
+      setf.sig           fFloatN = GR_N
+      nop.f              0
+      extr.u             GR_Index2 = GR_X_1, 6, 4 // Extract bits 6-9 of X_1
+}
+{ .mfi
+      ldfe               FR_Q4 = [GR_ad_q], 16 // Load Q4
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      shladd             GR_ad_z_2 = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+      nop.f              0
+      shladd             GR_ad_tbl_2 = GR_Index2, 4, GR_ad_tbl_2// Point to G_2
+}
+{ .mfi
+      ldfe               FR_Q3 = [GR_ad_q], 16 // Load Q3
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ld4                GR_Z_2 = [GR_ad_z_2] // Load Z_2
+      fnma.s1            fInvX = f8, fRcpX, f1 // start of 2nd NR iteration
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              FR_G2, FR_H2 = [GR_ad_tbl_2], 8 // Load G_2, H_2
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               FR_h2 = [GR_ad_tbl_2] // Load h_2
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               FR_Q2 = [GR_ad_q],16 // Load Q2
+      nop.f              0
+      // Get bits 30-15 of X_1 * Z_2
+      pmpyshr2.u         GR_X_2 = GR_X_1,GR_Z_2,15
+}
+;;
+//
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
+//
+{ .mfi
+      ldfe               FR_Q1 = [GR_ad_q] // Load Q1
+      fcmp.gt.s1         p7,p0 = f8, fA1 // check if x > overflow threshold
+      nop.i              0
+}
+;;
+{.mfi
+      ldfpd              fA0, fA0L = [rPolDataPtr], 16 // Load two parts of C
+      fma.s1             fRcpX = fInvX, fRcpX, fRcpX // end of 2nd NR iteration
+      nop.i              0
+}
+;;
+{ .mfb
+      ldfpd              fB2, fA1 = [rPolDataPtr], 16
+      nop.f              0
+(p7)  br.cond.spnt       lgammal_overflow // branch if x > overflow threshold
+}
+;;
+{.mfi
+      ldfe               fB4 = [rPolDataPtr], 16
+      fcvt.xf            fFloatN = fFloatN
+      extr.u             GR_Index3 = GR_X_2, 1, 5 // Extract bits 1-5 of X_2
+}
+;;
+{ .mfi
+      shladd             GR_ad_tbl_3 = GR_Index3, 4, GR_ad_tbl_3// Point to G_3
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfe               fB6 = [rPolDataPtr], 16
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfps              FR_G3, FR_H3 = [GR_ad_tbl_3], 8 // Load G_3, H_3
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfd               FR_h3 = [GR_ad_tbl_3] // Load h_3
+      fmpy.s1            FR_G = FR_G, FR_G2 // G = G_1 * G_2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_H = FR_H, FR_H2 // H = H_1 + H_2
+      nop.i              0
+}
+;;
+
+{ .mfi
+      ldfe               fB8 = [rPolDataPtr], 16
+      fadd.s1            FR_h = FR_h, FR_h2 // h = h_1 + h_2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnma.s1            fInvX = f8, fRcpX, f1 // start of 3rd NR iteration
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fB10 = [rPolDataPtr], 16
+      nop.f              0
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+;;
+{ .mfi
+      ldfe               fB12 = [rPolDataPtr], 16
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fB14 = [rPolDataPtr], 16
+      nop.f              0
+      nop.i              0
+}
+;;
+
+{ .mfi
+      ldfe               fB16 = [rPolDataPtr], 16
+      // get double extended coefficients from two doubles
+      // two doubles are needed in Stitling's formula for negative x
+      fadd.s1            fB2 = fB2, fA1
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fB18 = [rPolDataPtr], 16
+      fma.s1             fInvX = fInvX, fRcpX, fRcpX // end of 3rd NR iteration
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fB20 = [rPolDataPtr], 16
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fmpy.s1            FR_G = FR_G, FR_G3 // G = (G_1 * G_2) * G_3
+      nop.i              0
+}
+{ .mfi
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fadd.s1            FR_H = FR_H, FR_H3 // H = (H_1 + H_2) + H_3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            FR_h = FR_h, FR_h3 // h = (h_1 + h_2) + h_3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRcpX = fInvX, fInvX, f0 // 1/x^2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA0L = fB2, fInvX, fA0L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             FR_r = fSignifX, FR_G, f1 // r = G * S_hi - 1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // High part of the log(x): Y_hi = N * log2_hi + H
+      fma.s1             fRes2H = fFloatN, FR_log2_hi, FR_H
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      // h = N * log2_lo + h
+      fma.s1             FR_h = fFloatN, FR_log2_lo, FR_h
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // High part of the log(x): Y_hi = N * log2_hi + H
+      fma.s1             fRes1H = fFloatN, FR_log2_hi, FR_H
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fPol = fB18, fRcpX, fB16 // v9
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA2L = fRcpX, fRcpX, f0   // v10
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fA3 = fB6, fRcpX, fB4     // v3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA4 = fB10, fRcpX, fB8    // v4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes2H =fRes2H, f1, f1 //  log_Hi(x) -1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // poly_lo = r * Q4 + Q3
+      fma.s1             FR_poly_lo = FR_r, FR_Q4, FR_Q3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes1H = fRes1H, FR_MHalf, f0 // -0.5*log_Hi(x)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fmpy.s1            FR_rsq = FR_r, FR_r // rsq = r * r
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA7 = fB14, fRcpX, fB12  // v7
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA8 = fA2L, fB20, fPol   // v8
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA2 = fA4, fA2L, fA3    // v2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA4L = fA2L, fA2L, f0    // v5
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fRes2H, f8, f0 // (x*(ln(x)-1))hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo * r + Q2
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_r, FR_Q2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             FR_rcub = FR_rsq, FR_r, f0 // rcub = r^3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // poly_hi = Q1 * rsq + r
+      fma.s1             FR_poly_hi = FR_Q1, FR_rsq, FR_r
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fRcpX, fInvX, f0 // 1/x^3
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA6 = fA8, fA2L, fA7   // v6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fResL = fRes2H, f8, fResH // d(x*(ln(x)-1))
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3H = fResH, fRes1H // (x*(ln(x)-1) -0.5ln(x))hi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // poly_lo = poly_lo*r^3 + h
+      fma.s1             FR_poly_lo = FR_poly_lo, FR_rcub, FR_h
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fA4L, fA6, fA2   // v1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // raise inexact exception
+      fma.s0             FR_log2_lo = FR_log2_lo, FR_log2_lo, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4H = fRes3H, fA0 // (x*(ln(x)-1) -0.5ln(x))hi + Chi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes3L = fResH, fRes3H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Y_lo = poly_hi + poly_lo
+      fadd.s1            fRes2L = FR_poly_hi, FR_poly_lo
+      nop.i              0
+}
+;;
+
+{ .mfi
+      nop.m              0
+      fma.s1             fA0L = fPol, fA11, fA0L // S(1/x) + Clo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fRes3L, fRes1H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes4L = fRes3H, fRes4H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResL = fRes2L, f8 , fResL // lo part of x*(ln(x)-1)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Clo + S(1/x) - 0.5*logLo(x)
+      fma.s1             fA0L = fRes2L, FR_MHalf, fA0L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fA0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Clo + S(1/x) - 0.5*logLo(x) + (x*(ln(x)-1))lo
+      fadd.s1            fA0L = fA0L, fResL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fA0L
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      fma.s0             f8 = fRes4H, f1, fRes4L
+      // exit for x > 10.0
+      br.ret.sptk        b0
+}
+;;
+// here if 8.0 <= x <= 10.0
+// Result = P15(y), where y = x/8.0 - 1.5
+.align 32
+lgammal_8_10:
+{ .mfi
+      addl               rPolDataPtr    = @ltoff(lgammal_8_10_data), gp
+      fms.s1             FR_FracX = fSignifX, f1, FR_MHalf // y = x/8.0 - 1.5
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+;;
+{ .mfi
+      ld8                rLnSinDataPtr = [rPolDataPtr]
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      adds               rZ1offsett = 32, rLnSinDataPtr
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      adds               rLnSinDataPtr = 48, rLnSinDataPtr
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA1, fA1L = [rPolDataPtr], 16 // A1
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfe               fA2 = [rZ1offsett], 32 // A5
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA0, fA0L = [rPolDataPtr], 16 // A0
+      fma.s1             FR_rsq = FR_FracX, FR_FracX, f0 // y^2
+      nop.i              0
+}
+{ .mfi
+      ldfe               fA3 = [rLnSinDataPtr],32 // A5
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mmf
+      ldfe               fA4 = [rZ1offsett], 32 // A4
+      ldfe               fA5 = [rLnSinDataPtr], 32 // A5
+      nop.f              0
+}
+;;
+{ .mmf
+      ldfe               fA6 = [rZ1offsett], 32 // A6
+      ldfe               fA7 = [rLnSinDataPtr], 32 // A7
+      nop.f              0
+}
+;;
+{ .mmf
+      ldfe               fA8 = [rZ1offsett], 32 // A8
+      ldfe               fA9 = [rLnSinDataPtr], 32 // A9
+      nop.f              0
+}
+;;
+{ .mmf
+      ldfe               fA10 = [rZ1offsett], 32 // A10
+      ldfe               fA11 = [rLnSinDataPtr], 32 // A11
+      nop.f              0
+}
+;;
+{ .mmf
+      ldfe               fA12 = [rZ1offsett], 32 // A12
+      ldfe               fA13 = [rLnSinDataPtr], 32 // A13
+      fma.s1             FR_Q4 = FR_rsq, FR_rsq, f0 // y^4
+}
+;;
+{ .mmf
+      ldfe               fA14 = [rZ1offsett], 32 // A14
+      ldfe               fA15 = [rLnSinDataPtr], 32 // A15
+      nop.f              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes1H = FR_FracX, fA1, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA3 = fA3, FR_FracX, fA2 // v4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA5 = fA5, FR_FracX, fA4 // v5
+      nop.i              0
+}
+;;
+{ .mfi
+      // store sign of GAMMA(x) if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fma.s1             fA3L = FR_Q4, FR_Q4, f0 // v9 = y^8
+      nop.i              0
+}
+{ .mfi
+      // store sign of GAMMA(x) if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s1             fA7 = fA7, FR_FracX, fA6 // v7
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, FR_FracX, fA8 // v8
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes1L = FR_FracX, fA1, fRes1H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fA11, FR_FracX, fA10 // v12
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA13 = fA13, FR_FracX, fA12 // v13
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fRes2H = fRes1H, f1, fA0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, FR_FracX, fA14 // v16
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA5 = fA5, FR_rsq, fA3 // v3
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, FR_rsq, fA7 // v6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes1L = FR_FracX, fA1L, fRes1L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes2L = fA0, f1, fRes2H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA13 = fA13, FR_rsq, fA11 // v11
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, FR_Q4, fA5 // v2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes1L = fRes1L, f1, fA0L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes2L = fRes2L, f1, fRes1H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, FR_Q4, fA13 // v10
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes2L = fRes1L, f1, fRes2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fA3L, fA15, fA9
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             f8 = FR_rsq , fPol, fRes2H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, FR_rsq, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes1L = fRes2H, f1, f8
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes1L = fRes1L, f1, fPol
+      nop.i              0
+}
+;;
+{.mfi
+      nop.m              0
+      fma.s1             fRes1L = fRes1L, f1, fRes2L
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      fma.s0             f8 = f8, f1, fRes1L
+      // exit for 8.0 <= x <= 10.0
+      br.ret.sptk        b0
+}
+;;
+
+// here if 4.0 <=x < 8.0
+.align 32
+lgammal_4_8:
+{ .mfi
+      addl               rPolDataPtr= @ltoff(lgammal_4_8_data),gp
+      fms.s1             FR_FracX = fSignifX, f1, FR_MHalf
+      adds               rSgnGam = 1, r0
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      nop.i              0
+}
+;;
+
+{ .mfb
+      adds               rTmpPtr = 160, rPolDataPtr
+      nop.f              0
+      // branch to special path which computes polynomial of 25th degree
+      br.sptk            lgamma_polynom25
+}
+;;
+
+// here if 2.25 <=x < 4.0
+.align 32
+lgammal_2Q_4:
+{ .mfi
+      addl               rPolDataPtr= @ltoff(lgammal_2Q_4_data),gp
+      fms.s1             FR_FracX = fSignifX, f1, FR_MHalf
+      adds               rSgnGam = 1, r0
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      nop.i              0
+}
+;;
+
+{ .mfb
+      adds               rTmpPtr = 160, rPolDataPtr
+      nop.f              0
+      // branch to special path which computes polynomial of 25th degree
+      br.sptk            lgamma_polynom25
+}
+;;
+
+// here if 0.5 <= |x| < 0.75
+.align 32
+lgammal_half_3Q:
+.pred.rel "mutex", p14, p15
+{ .mfi
+(p14) addl               rPolDataPtr= @ltoff(lgammal_half_3Q_data),gp
+     // FR_FracX = x - 0.625 for positive x
+(p14) fms.s1             FR_FracX = f8, f1, FR_FracX
+(p14) adds               rSgnGam = 1, r0
+}
+{ .mfi
+(p15) addl               rPolDataPtr= @ltoff(lgammal_half_3Q_neg_data),gp
+     // FR_FracX = x + 0.625 for negative x
+(p15) fma.s1             FR_FracX = f8, f1, FR_FracX
+(p15) adds               rSgnGam = -1, r0
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+       nop.f              0
+       nop.i              0
+}
+;;
+{ .mfb
+      adds               rTmpPtr = 160, rPolDataPtr
+      nop.f              0
+      // branch to special path which computes polynomial of 25th degree
+      br.sptk            lgamma_polynom25
+}
+;;
+// here if 1.3125 <= x < 1.5625
+.align 32
+lgammal_loc_min:
+{ .mfi
+      adds               rSgnGam = 1, r0
+      nop.f              0
+      nop.i              0
+}
+{ .mfb
+      adds               rTmpPtr = 160, rPolDataPtr
+      fms.s1             FR_FracX = f8, f1, fA5L
+      br.sptk            lgamma_polynom25
+}
+;;
+// here if -2.605859375 <= x < -2.5
+// special polynomial approximation used since neither "near root"
+// approximation nor reflection formula give satisfactory accuracy on
+// this range
+.align 32
+_neg2andHalf:
+{ .mfi
+      addl               rPolDataPtr= @ltoff(lgammal_neg2andHalf_data),gp
+      fma.s1             FR_FracX = fB20, f1, f8 // 2.5 + x
+      adds               rSgnGam = -1, r0
+}
+;;
+{.mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfb
+      adds               rTmpPtr = 160, rPolDataPtr
+      nop.f              0
+      // branch to special path which computes polynomial of 25th degree
+      br.sptk            lgamma_polynom25
+}
+;;
+
+// here if -0.5 < x <= -0.40625
+.align 32
+lgammal_near_neg_half:
+{ .mmf
+      addl               rPolDataPtr= @ltoff(lgammal_near_neg_half_data),gp
+      setf.exp           FR_FracX = rExpHalf
+      nop.f              0
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      adds               rSgnGam = -1, r0
+}
+;;
+{ .mfb
+      adds               rTmpPtr = 160, rPolDataPtr
+      fma.s1             FR_FracX = FR_FracX, f1, f8
+      // branch to special path which computes polynomial of 25th degree
+      br.sptk            lgamma_polynom25
+}
+;;
+
+// here if there an answer is P25(x)
+// rPolDataPtr, rTmpPtr point to coefficients
+// x is in FR_FracX register
+.align 32
+lgamma_polynom25:
+{ .mfi
+      ldfpd              fA3, fA0L = [rPolDataPtr], 16 // A3
+      nop.f              0
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+{ .mfi
+      ldfpd              fA18, fA19 = [rTmpPtr], 16 // D7, D6
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA1, fA1L = [rPolDataPtr], 16 // A1
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA16, fA17 = [rTmpPtr], 16 // D4, D5
+      nop.f              0
+}
+;;
+{ .mfi
+      ldfpd              fA12, fA13 = [rPolDataPtr], 16 // D0, D1
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA14, fA15 = [rTmpPtr], 16 // D2, D3
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA24, fA25 = [rPolDataPtr], 16 // C21, C20
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA22, fA23 = [rTmpPtr], 16 // C19, C18
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA2, fA2L = [rPolDataPtr], 16 // A2
+      fma.s1             fA4L = FR_FracX, FR_FracX, f0 // x^2
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA20, fA21 = [rTmpPtr], 16 // C17, C16
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfe               fA11 = [rTmpPtr], 16 // E7
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA0, fA3L = [rPolDataPtr], 16 // A0
+      nop.f              0
+      nop.i              0
+};;
+{ .mfi
+      ldfe               fA10 = [rPolDataPtr], 16 // E6
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfe               fA9 = [rTmpPtr], 16 // E5
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mmf
+      ldfe               fA8 = [rPolDataPtr], 16 // E4
+      ldfe               fA7 = [rTmpPtr], 16 // E3
+      nop.f              0
+}
+;;
+{ .mmf
+      ldfe               fA6 = [rPolDataPtr], 16 // E2
+      ldfe               fA5 = [rTmpPtr], 16 // E1
+      nop.f              0
+}
+;;
+{ .mfi
+      ldfe               fA4 = [rPolDataPtr], 16 // E0
+      fma.s1             fA5L = fA4L, fA4L, f0 // x^4
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fB2 = FR_FracX, FR_FracX, fA4L // x^2 - <x^2>
+      nop.i              0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fma.s1             fRes4H = fA3, FR_FracX, f0 // (A3*x)hi
+      nop.i              0
+}
+{ .mfi
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s1             fA19 = fA19, FR_FracX, fA18 // D7*x + D6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fA1, FR_FracX, f0 // (A1*x)hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB6 = fA1L, FR_FracX, fA0L // A1L*x + A0L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA17 = fA17, FR_FracX, fA16 // D5*x + D4
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, FR_FracX, fA14 // D3*x + D2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, FR_FracX, fA24 // C21*x + C20
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA13 = fA13, FR_FracX, fA12 // D1*x + D0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA23 = fA23, FR_FracX, fA22 // C19*x + C18
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA21 = fA21, FR_FracX, fA20 // C17*x + C16
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes4L = fA3, FR_FracX, fRes4H // delta((A3*x)hi)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2H = fRes4H, fA2 // (A3*x + A2)hi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fResL = fA1, FR_FracX, fResH // d(A1*x)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1H = fResH, fA0 // (A1*x + A0)hi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA19 = fA19, fA4L, fA17 // Dhi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fA11, FR_FracX, fA10 // E7*x + E6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // Doing this to raise inexact flag
+      fma.s0             fA10 = fA0, fA0, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA15 = fA15, fA4L, fA13 // Dlo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // (C21*x + C20)*x^2 + C19*x + C18
+      fma.s1             fA25 = fA25, fA4L, fA23
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA9 = fA9, FR_FracX, fA8 // E5*x + E4
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA7 = fA7, FR_FracX, fA6 // E3*x + E2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes4L = fA3L, FR_FracX, fRes4L // (A3*x)lo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes2L = fA2, fRes2H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fResL = fResL, fB6 // (A1L*x + A0L) + d(A1*x)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes1L = fA0, fRes1H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA5 = fA5, FR_FracX, fA4 // E1*x + E0
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB8 = fA5L, fA5L, f0  // x^8
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // ((C21*x + C20)*x^2 + C19*x + C18)*x^2 + C17*x + C16
+      fma.s1             fA25 = fA25, fA4L, fA21
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA19 = fA19, fA5L, fA15 // D
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fA11, fA4L, fA9 // Ehi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fRes4H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fA2L // (A3*x)lo + A2L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes3H = fRes2H, fA4L, f0 //  ((A3*x + A2)*x^2)hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fResH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes3L = fRes2H, fB2, f0 // (A3*x + A2)hi*d(x^2)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA7 = fA7, fA4L, fA5 // Elo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA25 = fA25, fB8, fA19 // C*x^8 + D
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fRes4L // (A3*x + A2)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fB4 = fRes2H, fA4L, fRes3H // d((A3*x + A2)*x^2))
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fResL // (A1*x + A0)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fB20 = fRes3H, fRes1H // Phi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA11 = fA11, fA5L, fA7 // E
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      //  ( (A3*x + A2)lo*<x^2> + (A3*x + A2)hi*d(x^2))
+      fma.s1             fRes3L = fRes2L, fA4L, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // d((A3*x + A2)*x^2)) + (A1*x + A0)lo
+      fadd.s1            fRes1L = fRes1L, fB4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fB18 = fRes1H, fB20
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fA25, fB8, fA11
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fB18 = fB18, fRes3H
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fRes4H = fPol, fA5L, fB20
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPolL = fPol, fA5L, f0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fB18 = fB18, fRes1L // Plo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes4L = fB20, fRes4H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fB18 = fB18, fPolL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fB18
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      fma.s0             f8 = fRes4H, f1, fRes4L
+      // P25(x) computed, exit here
+      br.ret.sptk        b0
+}
+;;
+
+
+// here if 0.75 <= x < 1.3125
+.align 32
+lgammal_03Q_1Q:
+{ .mfi
+      addl               rPolDataPtr= @ltoff(lgammal_03Q_1Q_data),gp
+      fma.s1             FR_FracX = fA5L, f1, f0 // x
+      adds               rSgnGam = 1, r0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB4 = fA5L, fA5L, f0 // x^2
+      nop.i              0
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfb
+      adds               rTmpPtr = 144, rPolDataPtr
+      nop.f              0
+      br.sptk            lgamma_polynom24x
+}
+;;
+
+// here if 1.5625 <= x < 2.25
+.align 32
+lgammal_13Q_2Q:
+{ .mfi
+      addl               rPolDataPtr= @ltoff(lgammal_13Q_2Q_data),gp
+      fma.s1             FR_FracX = fB4, f1, f0 // x
+      adds               rSgnGam = 1, r0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB4 = fB4, fB4, f0 // x^2
+      nop.i              0
+}
+;;
+{ .mfi
+      ld8                rPolDataPtr = [rPolDataPtr]
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfb
+      adds               rTmpPtr = 144, rPolDataPtr
+      nop.f              0
+      br.sptk            lgamma_polynom24x
+}
+;;
+
+// here if result is Pol24(x)
+// x is in FR_FracX,
+// rPolDataPtr, rTmpPtr point to coefficients
+.align 32
+lgamma_polynom24x:
+{ .mfi
+      ldfpd              fA4, fA2L = [rPolDataPtr], 16
+      nop.f              0
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+{ .mfi
+      ldfpd              fA23, fA24 = [rTmpPtr], 16 // C18, C19
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA3, fA1L = [rPolDataPtr], 16
+      fma.s1             fA5L = fB4, fB4, f0 // x^4
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA19, fA20 = [rTmpPtr], 16 // D6, D7
+      fms.s1             fB2 = FR_FracX, FR_FracX, fB4 // x^2 - <x^2>
+      nop.i              0
+}
+;;
+{ .mmf
+      ldfpd              fA15, fA16 = [rPolDataPtr], 16 // D2, D3
+      ldfpd              fA17, fA18 = [rTmpPtr], 16 // D4, D5
+      nop.f              0
+}
+;;
+{ .mmf
+      ldfpd              fA13, fA14 = [rPolDataPtr], 16 // D0, D1
+      ldfpd              fA12, fA21 = [rTmpPtr], 16 // E7, C16
+      nop.f              0
+}
+;;
+{ .mfi
+      ldfe               fA11 = [rPolDataPtr], 16 // E6
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfe               fA10 = [rTmpPtr], 16 // E5
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA2, fA4L = [rPolDataPtr], 16
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      ldfpd              fA1, fA3L = [rTmpPtr], 16
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      ldfpd              fA22, fA25 = [rPolDataPtr], 16 // C17, C20
+      fma.s1             fA0 = fA5L, fA5L, f0 // x^8
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA0L = fA5L, FR_FracX, f0 // x^5
+      nop.i              0
+}
+;;
+{ .mmf
+      ldfe               fA9 = [rPolDataPtr], 16 // E4
+      ldfe               fA8 = [rTmpPtr], 16 // E3
+      nop.f              0
+}
+;;
+{ .mmf
+      ldfe               fA7 = [rPolDataPtr], 16 // E2
+      ldfe               fA6 = [rTmpPtr], 16 // E1
+      nop.f              0
+}
+;;
+{ .mfi
+      ldfe               fA5 = [rTmpPtr], 16 // E0
+      fma.s1             fRes4H = fA4, fB4, f0 // A4*<x^2>
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fA24, FR_FracX, fA23 // C19*x + C18
+      nop.i              0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fma.s1             fRes1H = fA3, fB4, f0 // A3*<x^2>
+      nop.i              0
+}
+{ .mfi
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s1             fA1L = fA3, fB2,fA1L //  A3*d(x^2) + A1L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA20 = fA20, FR_FracX, fA19 // D7*x + D6
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA18 = fA18, FR_FracX, fA17 // D5*x + D4
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA16 = fA16, FR_FracX, fA15 // D3*x + D2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA14 = fA14, FR_FracX, fA13 // D1*x + D0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA2L = fA4, fB2,fA2L //  A4*d(x^2) + A2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA12 = fA12, FR_FracX, fA11 // E7*x + E6
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes2L = fA4, fB4, fRes4H  // delta(A4*<x^2>)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2H = fRes4H, fA2       // A4*<x^2> + A2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fms.s1             fRes3L = fA3, fB4, fRes1H  // delta(A3*<x^2>)
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3H = fRes1H, fA1       // A3*<x^2> + A1
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA20 = fA20, fB4, fA18 // (D7*x + D6)*x^2 + D5*x + D4
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA22 = fA22, FR_FracX, fA21 // C17*x + C16
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA16 = fA16, fB4, fA14 // (D3*x + D2)*x^2 + D1*x + D0
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fA25, fB4, fPol // C20*x^2 + C19*x + C18
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA2L = fA4L, fB4, fA2L //  A4L*<x^2> + A4*d(x^2) + A2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA1L = fA3L, fB4, fA1L //  A3L*<x^2> + A3*d(x^2) + A1L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes4L = fA2, fRes2H // d1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fResH = fRes2H, fB4, f0 // (A4*<x^2> + A2)*x^2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes1L = fA1, fRes3H // d1
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fB6 = fRes3H, FR_FracX, f0 // (A3*<x^2> + A1)*x
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fA10 = fA10, FR_FracX, fA9  // E5*x + E4
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA8 = fA8, FR_FracX, fA7 // E3*x + E2
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // (C20*x^2 + C19*x + C18)*x^2 + C17*x + C16
+      fma.s1             fPol = fPol, fB4, fA22
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA6 = fA6, FR_FracX, fA5 // E1*x + E0
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // A4L*<x^2> + A4*d(x^2) + A2L + delta(A4*<x^2>)
+      fadd.s1            fRes2L = fA2L, fRes2L
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // A3L*<x^2> + A3*d(x^2) + A1L + delta(A3*<x^2>)
+      fadd.s1            fRes3L = fA1L, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fRes4H // d2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fResL = fRes2H, fB4, fResH  // d(A4*<x^2> + A2)*x^2)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes1L = fRes1L, fRes1H // d2
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fms.s1             fB8 = fRes3H, FR_FracX, fB6 // d((A3*<x^2> + A1)*x)
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fB10 = fResH, fB6 // (A4*x^4 + .. + A1*x)hi
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA12 = fA12, fB4, fA10 // Ehi
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      // ((D7*x + D6)*x^2 + D5*x + D4)*x^4 + (D3*x + D2)*x^2 + D1*x + D0
+      fma.s1             fA20 = fA20, fA5L, fA16
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fA8 = fA8, fB4, fA6 // Elo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes2L = fRes2L, fRes4L // (A4*<x^2> + A2)lo
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      // d(A4*<x^2> + A2)*x^2) + A4*<x^2> + A2)*d(x^2)
+      fma.s1             fResL = fRes2H, fB2, fResL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fRes3L, fRes1L   // (A4*<x^2> + A2)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fB12 = fB6, fB10
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, fA0, fA20 // PolC*x^8 + PolD
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fma.s1             fPolL = fA12, fA5L, fA8 // E
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fResL = fB4, fRes2L, fResL // ((A4*<x^2> + A2)*x^2)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes3L = fRes3L, FR_FracX, fB8 // ((A3*<x^2> + A1)*x)lo
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fB12 = fB12, fResH
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fPol = fPol, fA0, fPolL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fRes3L, fResL
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes2H = fPol, fA0L, fB10
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes3L = fB12, fRes3L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fsub.s1            fRes4L = fB10, fRes2H
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fma.s1             fRes4L = fPol, fA0L, fRes4L
+      nop.i              0
+}
+;;
+{ .mfi
+      nop.m              0
+      fadd.s1            fRes4L = fRes4L, fRes3L
+      nop.i              0
+}
+;;
+{ .mfb
+      nop.m              0
+      // final result for all paths for which the result is Pol24(x)
+      fma.s0             f8 = fRes2H, f1, fRes4L
+      // here is the exit for all paths for which the result is Pol24(x)
+      br.ret.sptk        b0
+}
+;;
+
+
+//  here if x is natval, nan, +/-inf, +/-0, or denormal
+.align 32
+lgammal_spec:
+{ .mfi
+      nop.m              0
+      fclass.m           p9, p0 =  f8, 0xB // +/-denormals
+      nop.i              0
+};;
+{ .mfi
+      nop.m              0
+      fclass.m           p6, p0 =  f8, 0x1E1 // Test x for natval, nan, +inf
+      nop.i              0
+};;
+{ .mfb
+      nop.m              0
+      fclass.m           p7, p0 =  f8, 0x7 // +/-0
+(p9)  br.cond.sptk       lgammal_denormal_input
+};;
+{ .mfb
+      nop.m              0
+      nop.f              0
+      // branch out if if x is natval, nan, +inf
+(p6)  br.cond.spnt       lgammal_nan_pinf
+};;
+{ .mfb
+      nop.m              0
+      nop.f              0
+(p7)  br.cond.spnt       lgammal_singularity
+};;
+// if we are still here then x = -inf
+{ .mfi
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+      nop.f              0
+      adds               rSgnGam = 1, r0
+};;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      nop.f              0
+      nop.i              0
+}
+{ .mfb
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s0             f8 = f8,f8,f0 // return +inf, no call to error support
+      br.ret.spnt        b0
+};;
+
+// here if x is NaN, NatVal or +INF
+.align 32
+lgammal_nan_pinf:
+{ .mfi
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+      nop.f              0
+      adds               rSgnGam = 1, r0
+}
+;;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      fma.s0             f8 = f8,f1,f8 // return x+x if x is natval, nan, +inf
+      nop.i              0
+}
+{ .mfb
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      nop.f              0
+      br.ret.sptk        b0
+}
+;;
+
+// here if x denormal or unnormal
+.align 32
+lgammal_denormal_input:
+{ .mfi
+      nop.m              0
+      fma.s0             fResH = f1, f1, f8 // raise denormal exception
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      fnorm.s1           f8 = f8 // normalize input value
+      nop.i              0
+}
+;;
+{ .mfi
+      getf.sig           rSignifX = f8
+      fmerge.se          fSignifX =  f1, f8
+      nop.i              0
+}
+{ .mfi
+      getf.exp           rSignExpX = f8
+      fcvt.fx.s1         fXint = f8 // Convert arg to int (int repres. in FR)
+      nop.i              0
+}
+;;
+{ .mfi
+      getf.exp           rSignExpX = f8
+      fcmp.lt.s1         p15, p14 = f8, f0
+      nop.i              0
+}
+;;
+{ .mfb
+      and                rExpX = rSignExpX, r17Ones
+      fmerge.s           fAbsX = f1, f8 // |x|
+      br.cond.sptk       _deno_back_to_main_path
+}
+;;
+
+
+// here if overflow (x > overflow_bound)
+.align 32
+lgammal_overflow:
+{ .mfi
+      addl               r8 = 0x1FFFE, r0
+      nop.f              0
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+}
+{ .mfi
+      adds               rSgnGam = 1, r0
+      nop.f              0
+      nop.i              0
+}
+;;
+{ .mfi
+      setf.exp           f9 = r8
+      fmerge.s           FR_X = f8,f8
+      mov                GR_Parameter_TAG = 102 // overflow
+};;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      nop.f              0
+      nop.i              0
+}
+{ .mfb
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      fma.s0             FR_RESULT = f9,f9,f0 // Set I,O and +INF result
+      br.cond.sptk       __libm_error_region
+};;
+
+// here if x is negative integer or +/-0 (SINGULARITY)
+.align 32
+lgammal_singularity:
+{ .mfi
+      adds               rSgnGam = 1, r0
+      fclass.m           p8,p0 = f8,0x6 // is x -0?
+      mov                GR_Parameter_TAG = 103 // negative
+}
+{ .mfi
+      cmp.eq             p6, p7 = 4, rSgnGamSize
+      fma.s1             FR_X = f0,f0,f8
+      nop.i              0
+};;
+{ .mfi
+(p8)  sub                rSgnGam = r0, rSgnGam
+      nop.f              0
+      nop.i              0
+}
+{ .mfi
+      nop.m              0
+      nop.f              0
+      nop.i              0
+};;
+{ .mfi
+      // store signgam if size of variable is 4 bytes
+(p6)  st4                [rSgnGamAddr] = rSgnGam
+      nop.f              0
+      nop.i              0
+}
+{ .mfb
+      // store signgam if size of variable is 8 bytes
+(p7)  st8                [rSgnGamAddr] = rSgnGam
+      frcpa.s0           FR_RESULT, p0 = f1, f0
+      br.cond.sptk       __libm_error_region
+};;
+
+GLOBAL_LIBM_END(__libm_lgammal)
+
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
+};;
+.body
+{ .mib
+        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+        nop.b 0                                 // Parameter 3 address
+}
+{ .mib
+        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+{ .mmi
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 999
+        nop.i 999
+};;
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region#)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/libm_reduce.S b/sysdeps/ia64/fpu/libm_reduce.S
index 1c7f4e1e88..8bdf91d6de 100644
--- a/sysdeps/ia64/fpu/libm_reduce.S
+++ b/sysdeps/ia64/fpu/libm_reduce.S
@@ -1,10 +1,10 @@
 .file "libm_reduce.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,304 +20,310 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// History:  02/02/00 Initial Version
+// History:
+// 02/02/00 Initial Version
+// 05/13/02 Rescheduled for speed, changed interface to pass
+//          parameters in fp registers
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double data storage
 //
-// *********************************************************************
-// *********************************************************************
+//*********************************************************************
+//*********************************************************************
 //
 // Function:   __libm_pi_by_two_reduce(x) return r, c, and N where
 //             x = N * pi/4 + (r+c) , where |r+c| <= pi/4.
 //             This function is not designed to be used by the
 //             general user.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Accuracy:       Returns double-precision values
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
-//    Floating-Point Registers: f32-f70
+//    Floating-Point Registers:
+//      f8  = Input x, return value r
+//      f9  = return value c
+//      f32-f70
 //
 //    General Purpose Registers:
 //      r8  = return value N
-//      r32 = Address of x
-//      r33 = Address of where to place r and then c 
 //      r34-r64
 //
 //    Predicate Registers:      p6-p14
 //
-// *********************************************************************
+//*********************************************************************
 //
 // IEEE Special Conditions:
 //
-//    No condions should be raised. 
+//    No condions should be raised.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // I. Introduction
 // ===============
 //
 // For the forward trigonometric functions sin, cos, sincos, and
-// tan, the original algorithms for IA 64 handle arguments up to 
+// tan, the original algorithms for IA 64 handle arguments up to
 // 1 ulp less than 2^63 in magnitude. For double-extended arguments x,
-// |x| >= 2^63, this routine returns CASE, N and r_hi, r_lo where
-// 
+// |x| >= 2^63, this routine returns N and r_hi, r_lo where
+//
 //    x  is accurately approximated by
 //    2*K*pi  +  N * pi/2  +  r_hi + r_lo,  |r_hi+r_lo| <= pi/4.
 //    CASE = 1 or 2.
 //    CASE is 1 unless |r_hi + r_lo| < 2^(-33).
-// 
+//
 // The exact value of K is not determined, but that information is
 // not required in trigonometric function computations.
-// 
-// We first assume the argument x in question satisfies x >= 2^(63). 
+//
+// We first assume the argument x in question satisfies x >= 2^(63).
 // In particular, it is positive. Negative x can be handled by symmetry:
-// 
+//
 //   -x  is accurately approximated by
 //         -2*K*pi  +  (-N) * pi/2  -  (r_hi + r_lo),  |r_hi+r_lo| <= pi/4.
-// 
+//
 // The idea of the reduction is that
-// 
-// 	x  *  2/pi   =   N_big  +  N  +  f,	|f| <= 1/2
-// 
+//
+//       x  *  2/pi   =   N_big  +  N  +  f,      |f| <= 1/2
+//
 // Moreover, for double extended x, |f| >= 2^(-75). (This is an
 // non-obvious fact found by enumeration using a special algorithm
-// involving continued fraction.) The algorithm described below 
+// involving continued fraction.) The algorithm described below
 // calculates N and an accurate approximation of f.
-// 
-// Roughly speaking, an appropriate 256-bit (4 X 64) portion of 
+//
+// Roughly speaking, an appropriate 256-bit (4 X 64) portion of
 // 2/pi is multiplied with x to give the desired information.
-// 
+//
 // II. Representation of 2/PI
 // ==========================
-// 
+//
 // The value of 2/pi in binary fixed-point is
-// 
+//
 //            .101000101111100110......
-// 
+//
 // We store 2/pi in a table, starting at the position corresponding
-// to bit position 63 
-// 
+// to bit position 63
+//
 //   bit position  63 62 ... 0   -1 -2 -3 -4 -5 -6 -7  ....  -16576
-// 
-// 	 	0  0  ... 0  . 1  0  1  0  1  0  1  ....    X
-//                 
+//
+//              0  0  ... 0  . 1  0  1  0  1  0  1  ....    X
+//
 //                              ^
-// 	     	             |__ implied binary pt 
-// 
+//                               |__ implied binary pt
+//
 // III. Algorithm
 // ==============
-// 
+//
 // This describes the algorithm in the most natural way using
-// unsigned interger multiplication. The implementation section 
+// unsigned interger multiplication. The implementation section
 // describes how the integer arithmetic is simulated.
-// 
+//
 // STEP 0. Initialization
 // ----------------------
-// 
-// Let the input argument x be 
-// 
+//
+// Let the input argument x be
+//
 //     x = 2^m * ( 1. b_1 b_2 b_3 ... b_63 ),  63 <= m <= 16383.
-// 
-// The first crucial step is to fetch four 64-bit portions of 2/pi. 
+//
+// The first crucial step is to fetch four 64-bit portions of 2/pi.
 // To fulfill this goal, we calculate the bit position L of the
 // beginning of these 256-bit quantity by
-// 
+//
 //     L :=  62 - m.
-// 
-// Note that -16321 <= L <= -1 because 63 <= m <= 16383; and that 
+//
+// Note that -16321 <= L <= -1 because 63 <= m <= 16383; and that
 // the storage of 2/pi is adequate.
-// 
+//
 // Fetch P_1, P_2, P_3, P_4 beginning at bit position L thus:
-// 
+//
 //      bit position  L  L-1  L-2    ...  L-63
-// 
+//
 //      P_1    =      b   b    b     ...    b
-// 
+//
 // each b can be 0 or 1. Also, let P_0 be the two bits correspoding to
 // bit positions L+2 and L+1. So, when each of the P_j is interpreted
 // with appropriate scaling, we have
 //
 //      2/pi  =  P_big  + P_0 + (P_1 + P_2 + P_3 + P_4)  +  P_small
-// 
+//
 // Note that P_big and P_small can be ignored. The reasons are as follow.
 // First, consider P_big. If P_big = 0, we can certainly ignore it.
-// Otherwise, P_big >= 2^(L+3). Now, 
-// 
+// Otherwise, P_big >= 2^(L+3). Now,
+//
 //        P_big * ulp(x) >=  2^(L+3) * 2^(m-63)
-// 		      >=  2^(65-m  +  m-63 )
-// 		      >=  2^2
-// 
+//                   >=  2^(65-m  +  m-63 )
+//                   >=  2^2
+//
 // Thus, P_big * x is an integer of the form 4*K. So
-// 
-// 	x = 4*K * (pi/2) + x*(P_0 + P_1 + P_2 + P_3 + P_4)*(pi/2)
+//
+//       x = 4*K * (pi/2) + x*(P_0 + P_1 + P_2 + P_3 + P_4)*(pi/2)
 //                + x*P_small*(pi/2).
-// 
+//
 // Hence, P_big*x corresponds to information that can be ignored for
 // trigonometic function evaluation.
-// 
+//
 // Next, we must estimate the effect of ignoring P_small. The absolute
 // error made by ignoring P_small is bounded by
-// 
+//
 //       |P_small * x|  <=  ulp(P_4) * x
-// 		     <=  2^(L-255) * 2^(m+1)
-// 		     <=  2^(62-m-255 + m + 1)
-// 		     <=  2^(-192)
-// 
-// Since for double-extended precision, x * 2/pi = integer + f, 
+//                  <=  2^(L-255) * 2^(m+1)
+//                  <=  2^(62-m-255 + m + 1)
+//                  <=  2^(-192)
+//
+// Since for double-extended precision, x * 2/pi = integer + f,
 // 0.5 >= |f| >= 2^(-75), the relative error introduced by ignoring
 // P_small is bounded by 2^(-192+75) <= 2^(-117), which is acceptable.
-// 
+//
 // Further note that if x is split into x_hi + x_lo where x_lo is the
 // two bits corresponding to bit positions 2^(m-62) and 2^(m-63); then
-// 
-// 	P_0 * x_hi 
-// 
+//
+//       P_0 * x_hi
+//
 // is also an integer of the form 4*K; and thus can also be ignored.
 // Let M := P_0 * x_lo which is a small integer. The main part of the
 // calculation is really the multiplication of x with the four pieces
 // P_1, P_2, P_3, and P_4.
-// 
+//
 // Unless the reduced argument is extremely small in magnitude, it
 // suffices to carry out the multiplication of x with P_1, P_2, and
-// P_3. x*P_4 will be carried out and added on as a correction only 
+// P_3. x*P_4 will be carried out and added on as a correction only
 // when it is found to be needed. Note also that x*P_4 need not be
 // computed exactly. A straightforward multiplication suffices since
 // the rounding error thus produced would be bounded by 2^(-3*64),
 // that is 2^(-192) which is small enough as the reduced argument
 // is bounded from below by 2^(-75).
-// 
+//
 // Now that we have four 64-bit data representing 2/pi and a
 // 64-bit x. We first need to calculate a highly accurate product
 // of x and P_1, P_2, P_3. This is best understood as integer
 // multiplication.
-// 
-// 
+//
+//
 // STEP 1. Multiplication
 // ----------------------
-// 
-// 
+//
+//
 //                     ---------   ---------   ---------
-// 	             |  P_1  |   |  P_2  |   |  P_3  |
-// 	             ---------   ---------   ---------
-// 
+//                    |  P_1  |   |  P_2  |   |  P_3  |
+//                    ---------   ---------   ---------
+//
+//                                            ---------
+//             X                              |   X   |
 //                                            ---------
-// 	      X                              |   X   |
-// 	                                     ---------
 //      ----------------------------------------------------
 //
 //                                 ---------   ---------
-//	                         |  A_hi |   |  A_lo |
-//	                         ---------   ---------
+//                               |  A_hi |   |  A_lo |
+//                               ---------   ---------
 //
 //
 //                    ---------   ---------
-//	             |  B_hi |   |  B_lo |
-//	             ---------   ---------
+//                   |  B_hi |   |  B_lo |
+//                   ---------   ---------
 //
 //
-//        ---------   ---------  
-//	 |  C_hi |   |  C_lo |  
-//	 ---------   ---------  
+//        ---------   ---------
+//       |  C_hi |   |  C_lo |
+//       ---------   ---------
 //
 //      ====================================================
 //       ---------   ---------   ---------   ---------
-//	 |  S_0  |   |  S_1  |   |  S_2  |   |  S_3  |
-//	 ---------   ---------   ---------   ---------
+//       |  S_0  |   |  S_1  |   |  S_2  |   |  S_3  |
+//       ---------   ---------   ---------   ---------
 //
 //
 //
 // STEP 2. Get N and f
 // -------------------
-// 
+//
 // Conceptually, after the individual pieces S_0, S_1, ..., are obtained,
 // we have to sum them and obtain an integer part, N, and a fraction, f.
 // Here, |f| <= 1/2, and N is an integer. Note also that N need only to
 // be known to module 2^k, k >= 2. In the case when |f| is small enough,
 // we would need to add in the value x*P_4.
-// 
-// 
+//
+//
 // STEP 3. Get reduced argument
 // ----------------------------
-// 
+//
 // The value f is not yet the reduced argument that we seek. The
 // equation
-// 
-// 	x * 2/pi = 4K  + N  + f
-// 
+//
+//       x * 2/pi = 4K  + N  + f
+//
 // says that
-// 
+//
 //         x   =  2*K*pi  + N * pi/2  +  f * (pi/2).
-// 
+//
 // Thus, the reduced argument is given by
-// 
-// 	reduced argument =  f * pi/2.
-// 
+//
+//       reduced argument =  f * pi/2.
+//
 // This multiplication must be performed to extra precision.
-// 
+//
 // IV. Implementation
 // ==================
-// 
+//
 // Step 0. Initialization
 // ----------------------
-// 
+//
 // Set sgn_x := sign(x); x := |x|; x_lo := 2 lsb of x.
-// 
+//
 // In memory, 2/pi is stored contigously as
-// 
+//
 //  0x00000000 0x00000000 0xA2F....
 //                       ^
 //                       |__ implied binary bit
-// 
+//
 // Given x = 2^m * 1.xxxx...xxx; we calculate L := 62 - m. Thus
 // -1 <= L <= -16321. We fetch from memory 5 integer pieces of data.
-// 
+//
 // P_0 is the two bits corresponding to bit positions L+2 and L+1
 // P_1 is the 64-bit starting at bit position  L
 // P_2 is the 64-bit starting at bit position  L-64
 // P_3 is the 64-bit starting at bit position  L-128
 // P_4 is the 64-bit starting at bit position  L-192
-// 
+//
 // For example, if m = 63, P_0 would be 0 and P_1 would look like
 // 0xA2F...
-// 
+//
 // If m = 65, P_0 would be the two msb of 0xA, thus, P_0 is 10 in binary.
-// P_1 in binary would be  1 0 0 0 1 0 1 1 1 1 .... 
-//  
+// P_1 in binary would be  1 0 0 0 1 0 1 1 1 1 ....
+//
 // Step 1. Multiplication
 // ----------------------
-// 
+//
 // At this point, P_1, P_2, P_3, P_4 are integers. They are
 // supposed to be interpreted as
-// 
+//
 //  2^(L-63)     * P_1;
 //  2^(L-63-64)  * P_2;
 //  2^(L-63-128) * P_3;
 // 2^(L-63-192) * P_4;
-// 
+//
 // Since each of them need to be multiplied to x, we would scale
 // both x and the P_j's by some convenient factors: scale each
 // of P_j's up by 2^(63-L), and scale x down by 2^(L-63).
-// 
+//
 //   p_1 := fcvt.xf ( P_1 )
 //   p_2 := fcvt.xf ( P_2 ) * 2^(-64)
 //   p_3 := fcvt.xf ( P_3 ) * 2^(-128)
@@ -325,30 +331,30 @@
 //   x   := replace exponent of x by -1
 //          because 2^m    * 1.xxxx...xxx  * 2^(L-63)
 //          is      2^(-1) * 1.xxxx...xxx
-// 
+//
 // We are now faced with the task of computing the following
-// 
+//
 //                     ---------   ---------   ---------
-// 	             |  P_1  |   |  P_2  |   |  P_3  |
-// 	             ---------   ---------   ---------
-// 
+//                    |  P_1  |   |  P_2  |   |  P_3  |
+//                    ---------   ---------   ---------
+//
 //                                             ---------
-// 	      X                              |   X   |
-// 	                                     ---------
+//             X                              |   X   |
+//                                            ---------
 //       ----------------------------------------------------
-// 
+//
 //                                 ---------   ---------
-// 	                         |  A_hi |   |  A_lo |
-// 	                         ---------   ---------
-// 
+//                                |  A_hi |   |  A_lo |
+//                                ---------   ---------
+//
 //                     ---------   ---------
-// 	             |  B_hi |   |  B_lo |
-// 	             ---------   ---------
-// 
-//         ---------   ---------  
-// 	 |  C_hi |   |  C_lo |  
-// 	 ---------   ---------  
-// 
+//                    |  B_hi |   |  B_lo |
+//                    ---------   ---------
+//
+//         ---------   ---------
+//        |  C_hi |   |  C_lo |
+//        ---------   ---------
+//
 //      ====================================================
 //       -----------   ---------   ---------   ---------
 //       |    S_0  |   |  S_1  |   |  S_2  |   |  S_3  |
@@ -357,108 +363,108 @@
 //        |          |___ binary point
 //        |
 //        |___ possibly one more bit
-// 
+//
 // Let FPSR3 be set to round towards zero with widest precision
-// and exponent range. Unless an explicit FPSR is given, 
+// and exponent range. Unless an explicit FPSR is given,
 // round-to-nearest with widest precision and exponent range is
 // used.
-// 
+//
 // Define sigma_C := 2^63; sigma_B := 2^(-1); sigma_C := 2^(-65).
-// 
+//
 // Tmp_C := fmpy.fpsr3( x, p_1 );
 // If Tmp_C >= sigma_C then
 //    C_hi := Tmp_C;
 //    C_lo := x*p_1 - C_hi ...fma, exact
 // Else
 //    C_hi := fadd.fpsr3(sigma_C, Tmp_C) - sigma_C
-// 			...subtraction is exact, regardless
-// 			...of rounding direction
+//                   ...subtraction is exact, regardless
+//                   ...of rounding direction
 //    C_lo := x*p_1 - C_hi ...fma, exact
 // End If
-// 
+//
 // Tmp_B := fmpy.fpsr3( x, p_2 );
 // If Tmp_B >= sigma_B then
 //    B_hi := Tmp_B;
 //    B_lo := x*p_2 - B_hi ...fma, exact
 // Else
 //    B_hi := fadd.fpsr3(sigma_B, Tmp_B) - sigma_B
-// 			...subtraction is exact, regardless
-// 			...of rounding direction
+//                   ...subtraction is exact, regardless
+//                   ...of rounding direction
 //    B_lo := x*p_2 - B_hi ...fma, exact
 // End If
-// 
+//
 // Tmp_A := fmpy.fpsr3( x, p_3 );
 // If Tmp_A >= sigma_A then
 //    A_hi := Tmp_A;
 //    A_lo := x*p_3 - A_hi ...fma, exact
 // Else
 //    A_hi := fadd.fpsr3(sigma_A, Tmp_A) - sigma_A
-// 			...subtraction is exact, regardless
-// 			...of rounding direction
+//                   ...subtraction is exact, regardless
+//                   ...of rounding direction
 //    A_lo := x*p_3 - A_hi ...fma, exact
 // End If
-// 
+//
 // ...Note that C_hi is of integer value. We need only the
-// ...last few bits. Thus we can ensure C_hi is never a big 
+// ...last few bits. Thus we can ensure C_hi is never a big
 // ...integer, freeing us from overflow worry.
-// 
+//
 // Tmp_C := fadd.fpsr3( C_hi, 2^(70) ) - 2^(70);
 // ...Tmp_C is the upper portion of C_hi
 // C_hi := C_hi - Tmp_C
 // ...0 <= C_hi < 2^7
-// 
+//
 // Step 2. Get N and f
 // -------------------
-// 
-// At this point, we have all the components to obtain 
+//
+// At this point, we have all the components to obtain
 // S_0, S_1, S_2, S_3 and thus N and f. We start by adding
 // C_lo and B_hi. This sum together with C_hi gives a good
-// estimation of N and f. 
-// 
+// estimation of N and f.
+//
 // A := fadd.fpsr3( B_hi, C_lo )
 // B := max( B_hi, C_lo )
 // b := min( B_hi, C_lo )
-// 
-// a := (B - A) + b	...exact. Note that a is either 0
-// 			...or 2^(-64).
-// 
+//
+// a := (B - A) + b      ...exact. Note that a is either 0
+//                   ...or 2^(-64).
+//
 // N := round_to_nearest_integer_value( A );
-// f := A - N;		...exact because lsb(A) >= 2^(-64)
-// 			...and |f| <= 1/2.
-// 
-// f := f + a		...exact because a is 0 or 2^(-64);
-// 			...the msb of the sum is <= 1/2
-// 			...lsb >= 2^(-64).
-// 
+// f := A - N;            ...exact because lsb(A) >= 2^(-64)
+//                   ...and |f| <= 1/2.
+//
+// f := f + a            ...exact because a is 0 or 2^(-64);
+//                   ...the msb of the sum is <= 1/2
+//                   ...lsb >= 2^(-64).
+//
 // N := convert to integer format( C_hi + N );
 // M := P_0 * x_lo;
 // N := N + M;
-// 
+//
 // If sgn_x == 1 (that is original x was negative)
 // N := 2^10 - N
 // ...this maintains N to be non-negative, but still
 // ...equivalent to the (negated N) mod 4.
 // End If
-// 
+//
 // If |f| >= 2^(-33)
-// 
+//
 // ...Case 1
 // CASE := 1
 // g := A_hi + B_lo;
 // s_hi := f + g;
 // s_lo := (f - s_hi) + g;
-// 
+//
 // Else
-// 
+//
 // ...Case 2
 // CASE := 2
 // A := fadd.fpsr3( A_hi, B_lo )
 // B := max( A_hi, B_lo )
 // b := min( A_hi, B_lo )
-// 
-// a := (B - A) + b	...exact. Note that a is either 0
-// 			...or 2^(-128).
-// 
+//
+// a := (B - A) + b      ...exact. Note that a is either 0
+//                   ...or 2^(-128).
+//
 // f_hi := A + f;
 // f_lo := (f - f_hi) + A;
 // ...this is exact.
@@ -468,9 +474,9 @@
 // ...If f = 2^(-64), f-f_hi involves cancellation and is
 // ...exact. If f = -2^(-64), then A + f is exact. Hence
 // ...f-f_hi is -A exactly, giving f_lo = 0.
-// 
+//
 // f_lo := f_lo + a;
-// 
+//
 // If |f| >= 2^(-50) then
 //    s_hi := f_hi;
 //    s_lo := f_lo;
@@ -479,117 +485,111 @@
 //    s_hi := f_hi + f_lo
 //    s_lo := (f_hi - s_hi) + f_lo
 // End If
-// 
+//
 // End If
-// 
+//
 // Step 3. Get reduced argument
 // ----------------------------
-// 
+//
 // If sgn_x == 0 (that is original x is positive)
-// 
+//
 // D_hi := Pi_by_2_hi
 // D_lo := Pi_by_2_lo
 // ...load from table
-// 
+//
 // Else
-// 
+//
 // D_hi := neg_Pi_by_2_hi
 // D_lo := neg_Pi_by_2_lo
 // ...load from table
 // End If
-// 
+//
 // r_hi :=  s_hi*D_hi
-// r_lo :=  s_hi*D_hi - r_hi   	...fma
+// r_lo :=  s_hi*D_hi - r_hi         ...fma
 // r_lo := (s_hi*D_lo + r_lo) + s_lo*D_hi
-// 
-// Return  CASE, N, r_hi, r_lo
-//
-
-#include "libm_support.h"
-
-FR_X       = f32 
-FR_N       = f33 
-FR_p_1     = f34 
-FR_TWOM33  = f35 
-FR_TWOM50  = f36 
-FR_g       = f37 
-FR_p_2     = f38 
-FR_f       = f39 
-FR_s_lo    = f40 
-FR_p_3     = f41 
-FR_f_abs   = f42 
-FR_D_lo    = f43 
-FR_p_4     = f44 
-FR_D_hi    = f45 
-FR_Tmp2_C  = f46 
-FR_s_hi    = f47 
-FR_sigma_A = f48 
-FR_A       = f49 
-FR_sigma_B = f50 
-FR_B       = f51 
-FR_sigma_C = f52 
-FR_b       = f53 
-FR_ScaleP2 = f54 
-FR_ScaleP3 = f55 
-FR_ScaleP4 = f56 
-FR_Tmp_A   = f57 
-FR_Tmp_B   = f58 
-FR_Tmp_C   = f59 
-FR_A_hi    = f60 
-FR_f_hi    = f61 
-FR_r_hi    = f62 
-FR_A_lo    = f63 
-FR_B_hi    = f64 
-FR_a       = f65 
-FR_B_lo    = f66 
+//
+// Return  N, r_hi, r_lo
+//
+FR_input_X = f8
+FR_r_hi    = f8
+FR_r_lo    = f9
+
+FR_X       = f32
+FR_N       = f33
+FR_p_1     = f34
+FR_TWOM33  = f35
+FR_TWOM50  = f36
+FR_g       = f37
+FR_p_2     = f38
+FR_f       = f39
+FR_s_lo    = f40
+FR_p_3     = f41
+FR_f_abs   = f42
+FR_D_lo    = f43
+FR_p_4     = f44
+FR_D_hi    = f45
+FR_Tmp2_C  = f46
+FR_s_hi    = f47
+FR_sigma_A = f48
+FR_A       = f49
+FR_sigma_B = f50
+FR_B       = f51
+FR_sigma_C = f52
+FR_b       = f53
+FR_ScaleP2 = f54
+FR_ScaleP3 = f55
+FR_ScaleP4 = f56
+FR_Tmp_A   = f57
+FR_Tmp_B   = f58
+FR_Tmp_C   = f59
+FR_A_hi    = f60
+FR_f_hi    = f61
+FR_RSHF    = f62
+FR_A_lo    = f63
+FR_B_hi    = f64
+FR_a       = f65
+FR_B_lo    = f66
 FR_f_lo    = f67
-FR_r_lo    = f68 
-FR_C_hi    = f69 
-FR_C_lo    = f70 
+FR_N_fix   = f68
+FR_C_hi    = f69
+FR_C_lo    = f70
 
 GR_N       = r8
-GR_Address_of_Input  = r32 
-GR_Address_of_Outputs = r33 
-GR_Exp_x   = r36 
-GR_Temp    = r37 
-GR_BIASL63 = r38 
+GR_Exp_x   = r36
+GR_Temp    = r37
+GR_BIASL63 = r38
 GR_CASE    = r39
-GR_x_lo    = r40 
-GR_sgn_x   = r41 
+GR_x_lo    = r40
+GR_sgn_x   = r41
 GR_M       = r42
 GR_BASE    = r43
 GR_LENGTH1 = r44
 GR_LENGTH2 = r45
 GR_ASUB    = r46
 GR_P_0     = r47
-GR_P_1     = r48 
-GR_P_2     = r49 
-GR_P_3     = r50 
-GR_P_4     = r51 
+GR_P_1     = r48
+GR_P_2     = r49
+GR_P_3     = r50
+GR_P_4     = r51
 GR_START   = r52
 GR_SEGMENT = r53
 GR_A       = r54
-GR_B       = r55 
+GR_B       = r55
 GR_C       = r56
 GR_D       = r57
 GR_E       = r58
-GR_TEMP1   = r59 
-GR_TEMP2   = r60 
-GR_TEMP3   = r61 
-GR_TEMP4   = r62 
+GR_TEMP1   = r59
+GR_TEMP2   = r60
+GR_TEMP3   = r61
+GR_TEMP4   = r62
 GR_TEMP5   = r63
 GR_TEMP6   = r64
+GR_rshf    = r64
 
+RODATA
 .align 64
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
-Constants_Bits_of_2_by_pi:
-ASM_TYPE_DIRECTIVE(Constants_Bits_of_2_by_pi,@object)
+LOCAL_OBJECT_START(Constants_Bits_of_2_by_pi)
 data8 0x0000000000000000,0xA2F9836E4E441529
 data8 0xFC2757D1F534DDC0,0xDB6295993C439041
 data8 0xFE5163ABDEBBC561,0xB7246E3A424DD2E0
@@ -721,34 +721,33 @@ data8 0xB5D6DF8261DD9602,0x36169F3AC4A1A283
 data8 0x6DED727A8D39A9B8,0x825C326B5B2746ED
 data8 0x34007700D255F4FC,0x4D59018071E0E13F
 data8 0x89B295F364A8F1AE,0xA74B38FC4CEAB2BB
-ASM_SIZE_DIRECTIVE(Constants_Bits_of_2_by_pi)
+LOCAL_OBJECT_END(Constants_Bits_of_2_by_pi)
 
-Constants_Bits_of_pi_by_2:
-ASM_TYPE_DIRECTIVE(Constants_Bits_of_pi_by_2,@object)
-data4 0x2168C234,0xC90FDAA2,0x00003FFF,0x00000000
-data4 0x80DC1CD1,0xC4C6628B,0x00003FBF,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_Bits_of_pi_by_2)
+LOCAL_OBJECT_START(Constants_Bits_of_pi_by_2)
+data8 0xC90FDAA22168C234,0x00003FFF
+data8 0xC4C6628B80DC1CD1,0x00003FBF
+LOCAL_OBJECT_END(Constants_Bits_of_pi_by_2)
 
 .section .text
-.proc __libm_pi_by_2_reduce#
 .global __libm_pi_by_2_reduce#
-.align 64 
+.proc __libm_pi_by_2_reduce#
+.align 32
 
-__libm_pi_by_2_reduce: 
+__libm_pi_by_2_reduce:
 
-//    X is at the address in Address_of_Input
-//    Place the two-piece result at the address in Address_of_Outputs
-//    r followed by c
-//    N is returned
+//    X is in f8
+//    Place the two-piece result r (r_hi) in f8 and c (r_lo) in f9
+//    N is returned in r8
 
-{ .mmf
-alloc  r34 = ar.pfs,2,34,0,0
-(p0)  ldfe  FR_X = [GR_Address_of_Input]
-(p0)  fsetc.s3 0x00,0x7F ;;
+{ .mfi
+      alloc  r34 = ar.pfs,2,34,0,0
+      fsetc.s3 0x00,0x7F     // Set sf3 to round to zero, 82-bit prec, td, ftz
+      nop.i 999
 }
-{ .mlx
-	nop.m 999
-(p0)  movl GR_BIASL63 = 0x1003E
+{ .mfi
+      addl           GR_BASE   = @ltoff(Constants_Bits_of_2_by_pi#), gp
+      nop.f 999
+      mov GR_BIASL63 = 0x1003E
 }
 ;;
 
@@ -765,73 +764,61 @@ alloc  r34 = ar.pfs,2,34,0,0
 //    Address_BASE = shladd(SEGMENT,3) + BASE
 
 
-
 { .mmi
-      nop.m 999
-(p0)  addl           GR_BASE   = @ltoff(Constants_Bits_of_2_by_pi#), gp
-      nop.i 999
+      getf.exp GR_Exp_x = FR_input_X
+      ld8 GR_BASE = [GR_BASE]
+      mov GR_TEMP5 = 0x0FFFE
 }
 ;;
 
+//    Define sigma_C := 2^63; sigma_B := 2^(-1); sigma_A := 2^(-65).
 { .mmi
-      ld8 GR_BASE = [GR_BASE]
-      nop.m 999
+      getf.sig GR_x_lo = FR_input_X
+      mov GR_TEMP6 = 0x0FFBE
       nop.i 999
 }
 ;;
 
-
-{ .mlx
-	nop.m 999
-(p0)  movl GR_TEMP5 = 0x000000000000FFFE
-}
-{ .mmi
-	nop.m 999 ;;
-(p0)  setf.exp FR_sigma_B = GR_TEMP5
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl GR_TEMP6 = 0x000000000000FFBE ;;
-}
-//    Define sigma_C := 2^63; sigma_B := 2^(-1); sigma_A := 2^(-65).
-{ .mfi
-(p0)  setf.exp FR_sigma_A = GR_TEMP6
-	nop.f 999
-	nop.i 999 ;;
-}
-//    Special Code for testing DE arguments 
-//    (p0)  movl GR_BIASL63 = 0x0000000000013FFE
-//    (p0)  movl GR_x_lo = 0xFFFFFFFFFFFFFFFF
-//    (p0)  setf.exp FR_X = GR_BIASL63
-//    (p0)  setf.sig FR_ScaleP3 = GR_x_lo
-//    (p0)  fmerge.se FR_X = FR_X,FR_ScaleP3
+//    Special Code for testing DE arguments
+//          movl GR_BIASL63 = 0x0000000000013FFE
+//          movl GR_x_lo = 0xFFFFFFFFFFFFFFFF
+//          setf.exp FR_X = GR_BIASL63
+//          setf.sig FR_ScaleP3 = GR_x_lo
+//          fmerge.se FR_X = FR_X,FR_ScaleP3
 //    Set sgn_x := sign(x); x := |x|; x_lo := 2 lsb of x.
 //    2/pi is stored contigously as
 //    0x00000000 0x00000000.0xA2F....
 //    M = EXP - BIAS  ( M >= 63)
 //    Given x = 2^m * 1.xxxx...xxx; we calculate L := 62 - m.
 //    Thus -1 <= L <= -16321.
-{ .mmf
-(p0)  getf.exp GR_Exp_x = FR_X
-(p0)  getf.sig GR_x_lo = FR_X
-(p0)  fabs FR_X = FR_X ;;
+{ .mmi
+      setf.exp FR_sigma_B = GR_TEMP5
+      setf.exp FR_sigma_A = GR_TEMP6
+      extr.u GR_M = GR_Exp_x,0,17
 }
+;;
+
 { .mii
-(p0)  and  GR_x_lo = 0x03,GR_x_lo
-(p0)  extr.u GR_M = GR_Exp_x,0,17 ;;
-(p0)  sub  GR_START = GR_M,GR_BIASL63
+      and  GR_x_lo = 0x03,GR_x_lo
+      sub  GR_START = GR_M,GR_BIASL63
+      add  GR_BASE = 8,GR_BASE           // To effectively add 1 to SEGMENT
 }
-{ .mmi
-	nop.m 999 ;;
-(p0)  and  GR_LENGTH1 = 0x3F,GR_START
-(p0)  shr.u  GR_SEGMENT = GR_START,6
+;;
+
+{ .mii
+      and  GR_LENGTH1 = 0x3F,GR_START
+      shr.u  GR_SEGMENT = GR_START,6
+      nop.i 999
 }
+;;
+
 { .mmi
-	nop.m 999 ;;
-(p0)  add  GR_SEGMENT = 0x1,GR_SEGMENT
-(p0)  sub  GR_LENGTH2 = 0x40,GR_LENGTH1
+      shladd GR_BASE = GR_SEGMENT,3,GR_BASE
+      sub  GR_LENGTH2 = 0x40,GR_LENGTH1
+      cmp.le p6,p7 = 0x2,GR_LENGTH1
 }
+;;
+
 //    P_0 is the two bits corresponding to bit positions L+2 and L+1
 //    P_1 is the 64-bit starting at bit position  L
 //    P_2 is the 64-bit starting at bit position  L-64
@@ -849,13 +836,13 @@ alloc  r34 = ar.pfs,2,34,0,0
 //    P_4 is made up of Clo and Dhi
 //    P_4 = deposit Dlo, position 0, length2  into P_4, position length1
 //          deposit Ehi, position length2, length1 into P_4, position 0
-{ .mmi
-(p0)  cmp.le.unc p6,p7 = 0x2,GR_LENGTH1 ;;
-(p0)  shladd GR_BASE = GR_SEGMENT,3,GR_BASE
-(p7)  cmp.eq.unc p8,p9 = 0x1,GR_LENGTH1 ;;
+{ .mfi
+      ld8 GR_A = [GR_BASE],8
+      fabs FR_X = FR_input_X
+(p7)  cmp.eq.unc p8,p9 = 0x1,GR_LENGTH1
 }
-{ .mmi
-	nop.m 999
+;;
+
 //    ld_64 A at Base and increment Base by 8
 //    ld_64 B at Base and increment Base by 8
 //    ld_64 C at Base and increment Base by 8
@@ -866,31 +853,35 @@ alloc  r34 = ar.pfs,2,34,0,0
 //    A, B, C, D, and E look like    | length1 | length2   |
 //                                    ---------------------
 //                                       hi        lo
-(p0)  ld8 GR_A = [GR_BASE],8
-(p0)  extr.u GR_sgn_x = GR_Exp_x,17,1 ;;
-}
-{ .mmf
-	nop.m 999
-(p0)  ld8 GR_B = [GR_BASE],8
-(p0)  fmerge.se FR_X = FR_sigma_B,FR_X ;;
+{ .mlx
+      ld8 GR_B = [GR_BASE],8
+      movl GR_rshf = 0x43e8000000000000   // 1.10000 2^63 for right shift N_fix
 }
-{ .mii
-(p0)  ld8 GR_C = [GR_BASE],8
-(p8)  extr.u GR_Temp = GR_A,63,1 ;;
-(p0)  shl GR_TEMP1 = GR_A,GR_LENGTH1
+;;
+
+{ .mmi
+      ld8 GR_C = [GR_BASE],8
+      nop.m 999
+(p8)  extr.u GR_Temp = GR_A,63,1
 }
-{ .mii
-(p0)  ld8 GR_D = [GR_BASE],8
+;;
+
 //    If length1 >= 2,
 //       P_0 = deposit Ahi, position length2, 2 bit into P_0 at position 0.
-(p6)     shr.u GR_P_0 = GR_A,GR_LENGTH2 ;;
-(p0)  shl GR_TEMP2 = GR_B,GR_LENGTH1
+{ .mii
+      ld8 GR_D = [GR_BASE],8
+      shl GR_TEMP1 = GR_A,GR_LENGTH1   // MM instruction
+(p6)  shr.u GR_P_0 = GR_A,GR_LENGTH2   // MM instruction
 }
+;;
+
 { .mii
-(p0)  ld8 GR_E = [GR_BASE],-40
-(p0)  shr.u GR_P_1 = GR_B,GR_LENGTH2 ;;
-(p0)  shr.u GR_P_2 = GR_C,GR_LENGTH2
+      ld8 GR_E = [GR_BASE],-40
+      shl GR_TEMP2 = GR_B,GR_LENGTH1   // MM instruction
+      shr.u GR_P_1 = GR_B,GR_LENGTH2   // MM instruction
 }
+;;
+
 //    Else
 //       Load 16 bit of ASUB from (Base_Address_of_A - 2)
 //       P_0 = ASUB & 0x3
@@ -900,43 +891,56 @@ alloc  r34 = ar.pfs,2,34,0,0
 //          Deposit element 63 from Ahi and place in element 0 of P_0.
 //       Endif
 //    Endif
+
 { .mii
 (p7)  ld2 GR_ASUB = [GR_BASE],8
-(p0)  shl GR_TEMP3 = GR_C,GR_LENGTH1 ;;
-(p0)  shl GR_TEMP4 = GR_D,GR_LENGTH1
+      shl GR_TEMP3 = GR_C,GR_LENGTH1   // MM instruction
+      shr.u GR_P_2 = GR_C,GR_LENGTH2   // MM instruction
 }
+;;
+
 { .mii
-	nop.m 999
-(p0)  shr.u GR_P_3 = GR_D,GR_LENGTH2 ;;
-(p0)  shr.u GR_P_4 = GR_E,GR_LENGTH2
+      setf.d FR_RSHF = GR_rshf         // Form right shift const 1.100 * 2^63
+      shl GR_TEMP4 = GR_D,GR_LENGTH1   // MM instruction
+      shr.u GR_P_3 = GR_D,GR_LENGTH2   // MM instruction
 }
-{ .mii
+;;
+
+{ .mmi
 (p7)  and GR_P_0 = 0x03,GR_ASUB
-(p6)     and GR_P_0 = 0x03,GR_P_0 ;;
-(p0)  or GR_P_1 = GR_P_1,GR_TEMP1
+(p6)  and GR_P_0 = 0x03,GR_P_0
+      shr.u GR_P_4 = GR_E,GR_LENGTH2   // MM instruction
 }
+;;
+
 { .mmi
-(p8)  and GR_P_0 = 0x1,GR_P_0 ;;
-(p0)  or GR_P_2 = GR_P_2,GR_TEMP2
-(p8)  shl GR_P_0 = GR_P_0,0x1 ;;
-}
-{ .mii
-	nop.m 999
-(p0)  or GR_P_3 = GR_P_3,GR_TEMP3
-(p8)  or GR_P_0 = GR_P_0,GR_Temp
+      nop.m 999
+      or GR_P_1 = GR_P_1,GR_TEMP1
+(p8)  and GR_P_0 = 0x1,GR_P_0
 }
+;;
+
 { .mmi
-(p0)  setf.sig FR_p_1 = GR_P_1 ;;
-(p0)  setf.sig FR_p_2 = GR_P_2
-(p0)  or GR_P_4 = GR_P_4,GR_TEMP4 ;;
+      setf.sig FR_p_1 = GR_P_1
+      or GR_P_2 = GR_P_2,GR_TEMP2
+(p8)  shladd GR_P_0 = GR_P_0,1,GR_Temp
 }
+;;
+
+{ .mmf
+      setf.sig FR_p_2 = GR_P_2
+      or GR_P_3 = GR_P_3,GR_TEMP3
+      fmerge.se FR_X = FR_sigma_B,FR_X
+}
+;;
+
 { .mmi
-	nop.m 999 ;;
-(p0)  setf.sig FR_p_3 = GR_P_3
-(p0)  pmpy2.r GR_M = GR_P_0,GR_x_lo
+      setf.sig FR_p_3 = GR_P_3
+      or GR_P_4 = GR_P_4,GR_TEMP4
+      pmpy2.r GR_M = GR_P_0,GR_x_lo
 }
-{ .mlx
-(p0)  setf.sig FR_p_4 = GR_P_4
+;;
+
 //    P_1, P_2, P_3, P_4 are integers. They should be
 //    2^(L-63)     * P_1;
 //    2^(L-63-64)  * P_2;
@@ -954,18 +958,18 @@ alloc  r34 = ar.pfs,2,34,0,0
 //             |  P_1  |   |  P_2  |   |  P_3  |
 //             ---------   ---------   ---------
 //                                           ---------
-//	      X                              |   X   |
-//	                                     ---------
+//            X                              |   X   |
+//                                           ---------
 //      ----------------------------------------------------
 //                               ---------   ---------
-//	                         |  A_hi |   |  A_lo |
-//	                         ---------   ---------
+//                               |  A_hi |   |  A_lo |
+//                               ---------   ---------
 //                   ---------   ---------
-//	             |  B_hi |   |  B_lo |
-//	             ---------   ---------
+//                   |  B_hi |   |  B_lo |
+//                   ---------   ---------
+//       ---------   ---------
+//       |  C_hi |   |  C_lo |
 //       ---------   ---------
-//	 |  C_hi |   |  C_lo |
-//	 ---------   ---------
 //     ====================================================
 //    -----------   ---------   ---------   ---------
 //    |    S_0  |   |  S_1  |   |  S_2  |   |  S_3  |
@@ -977,52 +981,55 @@ alloc  r34 = ar.pfs,2,34,0,0
 //    and exponent range. Unless an explicit FPSR is given,
 //    round-to-nearest with widest precision and exponent range is
 //    used.
-(p0)  movl GR_TEMP1 = 0x000000000000FFBF
-}
 { .mmi
-	nop.m 999 ;;
-(p0)  setf.exp FR_ScaleP2 = GR_TEMP1
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl GR_TEMP4 = 0x000000000001003E
+      setf.sig FR_p_4 = GR_P_4
+      mov GR_TEMP1 = 0x0FFBF
+      nop.i 999
 }
+;;
+
 { .mmi
-	nop.m 999 ;;
-(p0)  setf.exp FR_sigma_C = GR_TEMP4
-	nop.i 999
+      setf.exp FR_ScaleP2 = GR_TEMP1
+      mov GR_TEMP2 = 0x0FF7F
+      nop.i 999
 }
-{ .mlx
-	nop.m 999
-(p0)  movl GR_TEMP2 = 0x000000000000FF7F ;;
+;;
+
+{ .mmi
+      setf.exp FR_ScaleP3 = GR_TEMP2
+      mov GR_TEMP4 = 0x1003E
+      nop.i 999
 }
+;;
+
 { .mmf
-	nop.m 999
-(p0)  setf.exp FR_ScaleP3 = GR_TEMP2
-(p0)  fcvt.xuf.s1 FR_p_1 = FR_p_1 ;;
+      setf.exp FR_sigma_C = GR_TEMP4
+      mov GR_Temp = 0x0FFDE
+      fcvt.xuf.s1 FR_p_1 = FR_p_1
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fcvt.xuf.s1 FR_p_2 = FR_p_2
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl GR_Temp = 0x000000000000FFDE ;;
-}
-{ .mmf
-	nop.m 999
-(p0)  setf.exp FR_TWOM33 = GR_Temp
-(p0)  fcvt.xuf.s1 FR_p_3 = FR_p_3 ;;
+      setf.exp FR_TWOM33 = GR_Temp
+      fcvt.xuf.s1 FR_p_2 = FR_p_2
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fcvt.xuf.s1 FR_p_4 = FR_p_4
-	nop.i 999 ;;
+      nop.m 999
+      fcvt.xuf.s1 FR_p_3 = FR_p_3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
+      nop.m 999
+      fcvt.xuf.s1 FR_p_4 = FR_p_4
+      nop.i 999
+}
+;;
+
 //    Tmp_C := fmpy.fpsr3( x, p_1 );
 //    Tmp_B := fmpy.fpsr3( x, p_2 );
 //    Tmp_A := fmpy.fpsr3( x, p_3 );
@@ -1048,55 +1055,62 @@ alloc  r34 = ar.pfs,2,34,0,0
 //      Exact, regardless ...of rounding direction
 //      A_lo := x*p_3 - A_hi ...fma, exact
 //    Endif
-(p0)  fmpy.s3 FR_Tmp_C = FR_X,FR_p_1
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 FR_p_2 = FR_p_2,FR_ScaleP2
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl GR_Temp = 0x0000000000000400
+      nop.m 999
+      fmpy.s3 FR_Tmp_C = FR_X,FR_p_1
+      nop.i 999
 }
-{ .mlx
-	nop.m 999
-(p0)  movl GR_TEMP3 = 0x000000000000FF3F ;;
+;;
+
+{ .mfi
+      mov GR_TEMP3 = 0x0FF3F
+      fmpy.s1 FR_p_2 = FR_p_2,FR_ScaleP2
+      nop.i 999
 }
+;;
+
 { .mmf
-	nop.m 999
-(p0)  setf.exp FR_ScaleP4 = GR_TEMP3
-(p0)  fmpy.s1 FR_p_3 = FR_p_3,FR_ScaleP3 ;;
+      setf.exp FR_ScaleP4 = GR_TEMP3
+      mov GR_TEMP4 = 0x10045
+      fmpy.s1 FR_p_3 = FR_p_3,FR_ScaleP3
 }
-{ .mlx
-	nop.m 999
-(p0)  movl GR_TEMP4 = 0x0000000000010045 ;;
+;;
+
+{ .mfi
+      nop.m 999
+      fadd.s3 FR_C_hi = FR_sigma_C,FR_Tmp_C   // For Tmp_C < sigma_C case
+      nop.i 999
 }
+;;
+
 { .mmf
-	nop.m 999
-(p0)  setf.exp FR_Tmp2_C = GR_TEMP4
-(p0)  fmpy.s3 FR_Tmp_B = FR_X,FR_p_2 ;;
+      setf.exp FR_Tmp2_C = GR_TEMP4
+      nop.m 999
+      fmpy.s3 FR_Tmp_B = FR_X,FR_p_2
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fcmp.ge.unc.s1 p12,  p9 = FR_Tmp_C,FR_sigma_C
-	nop.i 999 ;;
+      addl           GR_BASE   = @ltoff(Constants_Bits_of_pi_by_2#), gp
+      fcmp.ge.s1 p12,  p9 = FR_Tmp_C,FR_sigma_C
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fmpy.s3 FR_Tmp_A = FR_X,FR_p_3
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s3 FR_Tmp_A = FR_X,FR_p_3
+      nop.i 99
 }
+;;
+
 { .mfi
-	nop.m 999
+      ld8 GR_BASE = [GR_BASE]
 (p12) mov FR_C_hi = FR_Tmp_C
-	nop.i 999 ;;
+      nop.i 999
 }
 { .mfi
-(p0)  addl           GR_BASE   = @ltoff(Constants_Bits_of_pi_by_2#), gp
-(p9)  fadd.s3 FR_C_hi = FR_sigma_C,FR_Tmp_C
-	nop.i 999
+      nop.m 999
+(p9)  fsub.s1 FR_C_hi = FR_C_hi,FR_sigma_C
+      nop.i 999
 }
 ;;
 
@@ -1114,97 +1128,106 @@ alloc  r34 = ar.pfs,2,34,0,0
 //      Load from table
 //   End If
 
-
-{ .mmi
-      ld8 GR_BASE = [GR_BASE]
+{ .mfi
       nop.m 999
+      fmpy.s1 FR_p_4 = FR_p_4,FR_ScaleP4
       nop.i 999
 }
-;;
-
-
 { .mfi
-(p0) ldfe FR_D_hi = [GR_BASE],16
-(p0)  fmpy.s1 FR_p_4 = FR_p_4,FR_ScaleP4
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s3 FR_B_hi = FR_sigma_B,FR_Tmp_B     // For Tmp_B < sigma_B case
+      nop.i 999
 }
+;;
+
 { .mfi
-(p0) ldfe FR_D_lo = [GR_BASE],0
-(p0)  fcmp.ge.unc.s1 p13, p10 = FR_Tmp_B,FR_sigma_B
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s3 FR_A_hi = FR_sigma_A,FR_Tmp_A     // For Tmp_A < sigma_A case
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13) mov FR_B_hi = FR_Tmp_B
-	nop.i 999
+      nop.m 999
+      fcmp.ge.s1 p13, p10 = FR_Tmp_B,FR_sigma_B
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p12) fms.s1 FR_C_lo = FR_X,FR_p_1,FR_C_hi
-	nop.i 999 ;;
+      nop.m 999
+      fms.s1 FR_C_lo = FR_X,FR_p_1,FR_C_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10) fadd.s3 FR_B_hi = FR_sigma_B,FR_Tmp_B
-	nop.i 999
+      ldfe FR_D_hi = [GR_BASE],16
+      fcmp.ge.s1 p14, p11 = FR_Tmp_A,FR_sigma_A
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p9)  fsub.s1 FR_C_hi = FR_C_hi,FR_sigma_C
-	nop.i 999 ;;
+      ldfe FR_D_lo = [GR_BASE]
+(p13) mov FR_B_hi = FR_Tmp_B
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fcmp.ge.unc.s1 p14, p11 = FR_Tmp_A,FR_sigma_A
-	nop.i 999 ;;
+      nop.m 999
+(p10) fsub.s1 FR_B_hi = FR_B_hi,FR_sigma_B
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
+      nop.m 999
 (p14) mov FR_A_hi = FR_Tmp_A
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p11) fadd.s3 FR_A_hi = FR_sigma_A,FR_Tmp_A
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p9)  fms.s1 FR_C_lo = FR_X,FR_p_1,FR_C_hi
-(p0)  cmp.eq.unc p12,p9 = 0x1,GR_sgn_x
-}
-{ .mfi
-	nop.m 999
-(p13) fms.s1 FR_B_lo = FR_X,FR_p_2,FR_B_hi
-	nop.i 999 ;;
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10) fsub.s1 FR_B_hi = FR_B_hi,FR_sigma_B
-	nop.i 999
+      nop.m 999
+(p11) fsub.s1 FR_A_hi = FR_A_hi,FR_sigma_A
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //    Note that C_hi is of integer value. We need only the
 //    last few bits. Thus we can ensure C_hi is never a big
 //    integer, freeing us from overflow worry.
 //    Tmp_C := fadd.fpsr3( C_hi, 2^(70) ) - 2^(70);
 //    Tmp_C is the upper portion of C_hi
-(p0)  fadd.s3 FR_Tmp_C = FR_C_hi,FR_Tmp2_C
-	nop.i 999 ;;
+{ .mfi
+      nop.m 999
+      fadd.s3 FR_Tmp_C = FR_C_hi,FR_Tmp2_C
+      tbit.z p12,p9 = GR_Exp_x, 17
 }
+;;
+
 { .mfi
-	nop.m 999
-(p14) fms.s1 FR_A_lo = FR_X,FR_p_3,FR_A_hi
-	nop.i 999
+      nop.m 999
+      fms.s1 FR_B_lo = FR_X,FR_p_2,FR_B_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p11) fsub.s1 FR_A_hi = FR_A_hi,FR_sigma_A
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s3 FR_A = FR_B_hi,FR_C_lo
+      nop.i 999
 }
+;;
+
+{ .mfi
+      nop.m 999
+      fms.s1 FR_A_lo = FR_X,FR_p_3,FR_A_hi
+      nop.i 999
+}
+;;
+
 { .mfi
-	nop.m 999
+      nop.m 999
+      fsub.s1 FR_Tmp_C = FR_Tmp_C,FR_Tmp2_C
+      nop.i 999
+}
+;;
+
 //    *******************
 //    Step 2. Get N and f
 //    *******************
@@ -1215,168 +1238,213 @@ alloc  r34 = ar.pfs,2,34,0,0
 //    A := fadd.fpsr3( B_hi, C_lo )
 //    B := max( B_hi, C_lo )
 //    b := min( B_hi, C_lo )
-(p0)  fadd.s3 FR_A = FR_B_hi,FR_C_lo
-	nop.i 999
-}
 { .mfi
-	nop.m 999
-(p10) fms.s1 FR_B_lo = FR_X,FR_p_2,FR_B_hi
-	nop.i 999 ;;
+      nop.m 999
+      fmax.s1 FR_B = FR_B_hi,FR_C_lo
+      nop.i 999
 }
+;;
+
+// We use a right-shift trick to get the integer part of A into the rightmost
+// bits of the significand by adding 1.1000..00 * 2^63.  This operation is good
+// if |A| < 2^61, which it is in this case.  We are doing this to save a few
+// cycles over using fcvt.fx followed by fnorm.  The second step of the trick
+// is to subtract the same constant to float the rounded integer into a fp reg.
+
 { .mfi
-	nop.m 999
-(p0)  fsub.s1 FR_Tmp_C = FR_Tmp_C,FR_Tmp2_C
-	nop.i 999 ;;
+      nop.m 999
+//    N := round_to_nearest_integer_value( A );
+      fma.s1 FR_N_fix = FR_A, f1, FR_RSHF
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fmax.s1 FR_B = FR_B_hi,FR_C_lo
-	nop.i 999 ;;
+      nop.m 999
+      fmin.s1 FR_b = FR_B_hi,FR_C_lo
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fmin.s1 FR_b = FR_B_hi,FR_C_lo
-	nop.i 999
+      nop.m 999
+//    C_hi := C_hi - Tmp_C ...0 <= C_hi < 2^7
+      fsub.s1 FR_C_hi = FR_C_hi,FR_Tmp_C
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11) fms.s1 FR_A_lo = FR_X,FR_p_3,FR_A_hi
-	nop.i 999 ;;
+      nop.m 999
+//    a := (B - A) + b: Exact - note that a is either 0 or 2^(-64).
+      fsub.s1 FR_a = FR_B,FR_A
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//    N := round_to_nearest_integer_value( A );
-(p0)  fcvt.fx.s1 FR_N = FR_A
-	nop.i 999 ;;
+      nop.m 999
+      fms.s1 FR_N = FR_N_fix, f1, FR_RSHF
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//    C_hi := C_hi - Tmp_C ...0 <= C_hi < 2^7
-(p0)  fsub.s1 FR_C_hi = FR_C_hi,FR_Tmp_C
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 FR_a = FR_a,FR_b
+      nop.i 999
 }
+;;
+
+//    f := A - N; Exact because lsb(A) >= 2^(-64) and |f| <= 1/2.
+//    N := convert to integer format( C_hi + N );
+//    M := P_0 * x_lo;
+//    N := N + M;
 { .mfi
-	nop.m 999
-//    a := (B - A) + b: Exact - note that a is either 0 or 2^(-64).
-(p0)  fsub.s1 FR_a = FR_B,FR_A
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 FR_f = FR_A,FR_N
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//    f := A - N; Exact because lsb(A) >= 2^(-64) and |f| <= 1/2.
-(p0)  fnorm.s1 FR_N = FR_N
-	nop.i 999
+      nop.m 999
+      fadd.s1 FR_N = FR_N,FR_C_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_a = FR_a,FR_b
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fsub.s1 FR_D_hi = f0, FR_D_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fsub.s1 FR_f = FR_A,FR_N
-	nop.i 999
+      nop.m 999
+(p9)  fsub.s1 FR_D_lo = f0, FR_D_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//    N := convert to integer format( C_hi + N );
-//    M := P_0 * x_lo;
-//    N := N + M;
-(p0)  fadd.s1 FR_N = FR_N,FR_C_hi
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 FR_g = FR_A_hi,FR_B_lo          // For Case 1, g=A_hi+B_lo
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//    f = f + a	Exact because a is 0 or 2^(-64);
-//    the msb of the sum is <= 1/2 and lsb >= 2^(-64).
-(p0)  fadd.s1 FR_f = FR_f,FR_a
-	nop.i 999
+      nop.m 999
+      fadd.s3 FR_A = FR_A_hi,FR_B_lo          // For Case 2, A=A_hi+B_lo w/ sf3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Create 2**(-33)
-//
-(p0)  fcvt.fx.s1 FR_N = FR_N
-	nop.i 999 ;;
+      mov GR_Temp = 0x0FFCD                   // For Case 2, exponent of 2^-50
+      fmax.s1 FR_B = FR_A_hi,FR_B_lo          // For Case 2, B=max(A_hi,B_lo)
+      nop.i 999
 }
+;;
+
+//    f = f + a      Exact because a is 0 or 2^(-64);
+//    the msb of the sum is <= 1/2 and lsb >= 2^(-64).
 { .mfi
-	nop.m 999
-(p0)  fabs FR_f_abs = FR_f
-	nop.i 999 ;;
+      setf.exp FR_TWOM50 = GR_Temp            // For Case 2, form 2^-50
+      fcvt.fx.s1 FR_N = FR_N
+      nop.i 999
 }
 { .mfi
-(p0)  getf.sig GR_N = FR_N
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 FR_f = FR_f,FR_a
+      nop.i 999
 }
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-(p0)  add GR_N = GR_N,GR_M ;;
+;;
+
+{ .mfi
+      nop.m 999
+      fmin.s1 FR_b = FR_A_hi,FR_B_lo          // For Case 2, b=min(A_hi,B_lo)
+      nop.i 999
 }
-//    If sgn_x == 1 (that is original x was negative)
-//       N := 2^10 - N
-//       this maintains N to be non-negative, but still
-//       equivalent to the (negated N) mod 4.
-//    End If
-{ .mii
-(p12) sub GR_N = GR_Temp,GR_N
-(p0) cmp.eq.unc p12,p9 = 0x0,GR_sgn_x ;;
-	nop.i 999
+;;
+
+{ .mfi
+      nop.m 999
+      fsub.s1 FR_a = FR_B,FR_A                // For Case 2, a=B-A
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fcmp.ge.unc.s1 p13, p10 = FR_f_abs,FR_TWOM33
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 FR_s_hi = FR_f,FR_g             // For Case 1, s_hi=f+g
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p9) fsub.s1 FR_D_hi = f0, FR_D_hi
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 FR_f_hi = FR_A,FR_f             // For Case 2, f_hi=A+f
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)    fadd.s3 FR_A = FR_A_hi,FR_B_lo
-	nop.i 999
+      nop.m 999
+      fabs FR_f_abs = FR_f
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13)    fadd.s1 FR_g = FR_A_hi,FR_B_lo
-	nop.i 999 ;;
+      getf.sig GR_N = FR_N
+      fsetc.s3 0x7F,0x40                 // Reset sf3 to user settings + td
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)    fmax.s1 FR_B = FR_A_hi,FR_B_lo
-	nop.i 999
+      nop.m 999
+      fsub.s1 FR_s_lo = FR_f,FR_s_hi          // For Case 1, s_lo=f-s_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p9) fsub.s1 FR_D_lo = f0, FR_D_lo
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 FR_f_lo = FR_f,FR_f_hi          // For Case 2, f_lo=f-f_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)    fmin.s1 FR_b = FR_A_hi,FR_B_lo
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_r_hi = FR_s_hi,FR_D_hi       // For Case 1, r_hi=s_hi*D_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0) fsetc.s3 0x7F,0x40
-	nop.i 999
+      nop.m 999
+      fadd.s1 FR_a = FR_a,FR_b                // For Case 2, a=a+b
+      nop.i 999
 }
-{ .mlx
-	nop.m 999
-(p10)    movl GR_Temp = 0x000000000000FFCD ;;
+;;
+
+
+//    If sgn_x == 1 (that is original x was negative)
+//       N := 2^10 - N
+//       this maintains N to be non-negative, but still
+//       equivalent to the (negated N) mod 4.
+//    End If
+{ .mfi
+      add GR_N = GR_N,GR_M
+      fcmp.ge.s1 p13, p10 = FR_f_abs,FR_TWOM33
+      mov GR_Temp = 0x00400
 }
-{ .mmf
-	nop.m 999
-(p10)    setf.exp FR_TWOM50 = GR_Temp
-(p10)    fadd.s1 FR_f_hi = FR_A,FR_f ;;
+;;
+
+{ .mfi
+(p9)  sub GR_N = GR_Temp,GR_N
+      fadd.s1 FR_s_lo = FR_s_lo,FR_g           // For Case 1, s_lo=s_lo+g
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//       a := (B - A) + b	Exact.
+      nop.m 999
+      fadd.s1 FR_f_lo = FR_f_lo,FR_A           // For Case 2, f_lo=f_lo+A
+      nop.i 999
+}
+;;
+
+//       a := (B - A) + b      Exact.
 //       Note that a is either 0 or 2^(-128).
 //       f_hi := A + f;
 //       f_lo := (f - f_hi) + A
@@ -1387,68 +1455,32 @@ alloc  r34 = ar.pfs,2,34,0,0
 //       exact. If f = -2^(-64), then A + f is exact. Hence
 //       f-f_hi is -A exactly, giving f_lo = 0.
 //       f_lo := f_lo + a;
-(p10)    fsub.s1 FR_a = FR_B,FR_A
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p13)    fadd.s1 FR_s_hi = FR_f,FR_g
-	nop.i 999 ;;
-}
-{ .mlx
-	nop.m 999
+
 //    If |f| >= 2^(-33)
 //       Case 1
 //       CASE := 1
 //       g := A_hi + B_lo;
 //       s_hi := f + g;
 //       s_lo := (f - s_hi) + g;
-(p13)    movl GR_CASE = 0x1 ;;
-}
-{ .mlx
-	nop.m 999
 //   Else
 //       Case 2
 //       CASE := 2
 //       A := fadd.fpsr3( A_hi, B_lo )
 //       B := max( A_hi, B_lo )
 //       b := min( A_hi, B_lo )
-(p10)    movl GR_CASE = 0x2
-}
-{ .mfi
-	nop.m 999
-(p10)    fsub.s1 FR_f_lo = FR_f,FR_f_hi
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p10)    fadd.s1 FR_a = FR_a,FR_b
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p13)    fsub.s1 FR_s_lo = FR_f,FR_s_hi
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p13)    fadd.s1 FR_s_lo = FR_s_lo,FR_g
-	nop.i 999 ;;
-}
+
 { .mfi
-	nop.m 999
-(p10)    fcmp.ge.unc.s1 p14, p11 = FR_f_abs,FR_TWOM50
-	nop.i 999 ;;
+      nop.m 999
+(p10) fcmp.ge.unc.s1 p14, p11 = FR_f_abs,FR_TWOM50
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//       Create 2**(-50)
-(p10)    fadd.s1 FR_f_lo = FR_f_lo,FR_A
-	nop.i 999 ;;
+      nop.m 999
+(p13) fms.s1 FR_r_lo = FR_s_hi,FR_D_hi,FR_r_hi //For Case 1, r_lo=s_hi*D_hi+r_hi
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //       If |f| >= 2^(-50) then
 //          s_hi := f_hi;
 //          s_lo := f_lo;
@@ -1457,84 +1489,90 @@ alloc  r34 = ar.pfs,2,34,0,0
 //          s_hi := f_hi + f_lo
 //          s_lo := (f_hi - s_hi) + f_lo
 //       End If
-(p14)  mov FR_s_hi = FR_f_hi
-	nop.i 999 ;;
+{ .mfi
+      nop.m 999
+(p14) mov FR_s_hi = FR_f_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10)    fadd.s1 FR_f_lo = FR_f_lo,FR_a
-	nop.i 999 ;;
+      nop.m 999
+(p10) fadd.s1 FR_f_lo = FR_f_lo,FR_a
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p14)  mov FR_s_lo = FR_f_lo
-	nop.i 999
+      nop.m 999
+(p14) mov FR_s_lo = FR_f_lo
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p11)  fadd.s1 FR_f_lo = FR_f_lo,FR_A_lo
-	nop.i 999 ;;
+      nop.m 999
+(p11) fadd.s1 FR_f_lo = FR_f_lo,FR_A_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11)  fma.s1 FR_f_lo = FR_X,FR_p_4,FR_f_lo
-	nop.i 999 ;;
+      nop.m 999
+(p11) fma.s1 FR_f_lo = FR_X,FR_p_4,FR_f_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11)  fadd.s1 FR_s_hi = FR_f_hi,FR_f_lo
-	nop.i 999 ;;
+      nop.m 999
+(p13) fma.s1 FR_r_lo = FR_s_hi,FR_D_lo,FR_r_lo //For Case 1, r_lo=s_hi*D_lo+r_lo
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+(p11) fadd.s1 FR_s_hi = FR_f_hi,FR_f_lo
+      nop.i 999
+}
+;;
+
 //   r_hi :=  s_hi*D_hi
 //   r_lo :=  s_hi*D_hi - r_hi  with fma
 //   r_lo := (s_hi*D_lo + r_lo) + s_lo*D_hi
-(p0) fmpy.s1 FR_r_hi = FR_s_hi,FR_D_hi
-	nop.i 999
-}
 { .mfi
-	nop.m 999
-(p11)  fsub.s1 FR_s_lo = FR_f_hi,FR_s_hi
-	nop.i 999 ;;
+      nop.m 999
+(p10) fmpy.s1 FR_r_hi = FR_s_hi,FR_D_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0) fms.s1 FR_r_lo = FR_s_hi,FR_D_hi,FR_r_hi
-	nop.i 999
+      nop.m 999
+(p11) fsub.s1 FR_s_lo = FR_f_hi,FR_s_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11)  fadd.s1 FR_s_lo = FR_s_lo,FR_f_lo
-	nop.i 999 ;;
-}
-{ .mmi
-	nop.m 999 ;;
-//   Return  N, r_hi, r_lo
-//   We do not return CASE
-(p0) stfe [GR_Address_of_Outputs] = FR_r_hi,16
-	nop.i 999 ;;
+      nop.m 999
+(p10) fms.s1 FR_r_lo = FR_s_hi,FR_D_hi,FR_r_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0) fma.s1 FR_r_lo = FR_s_hi,FR_D_lo,FR_r_lo
-	nop.i 999 ;;
+      nop.m 999
+(p11) fadd.s1 FR_s_lo = FR_s_lo,FR_f_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0) fma.s1 FR_r_lo = FR_s_lo,FR_D_hi,FR_r_lo
-	nop.i 999 ;;
-}
-{ .mmi
-	nop.m 999 ;;
-(p0) stfe [GR_Address_of_Outputs] = FR_r_lo,-16
-	nop.i 999
+      nop.m 999
+(p10) fma.s1 FR_r_lo = FR_s_hi,FR_D_lo,FR_r_lo
+      nop.i 999
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p0) br.ret.sptk   b0 ;;
+;;
+
+//   Return  N, r_hi, r_lo
+//   We do not return CASE
+{ .mfb
+      nop.m 999
+      fma.s1 FR_r_lo = FR_s_lo,FR_D_hi,FR_r_lo
+      br.ret.sptk   b0
 }
+;;
 
-.endp __libm_pi_by_2_reduce
-ASM_SIZE_DIRECTIVE(__libm_pi_by_2_reduce)
+.endp __libm_pi_by_2_reduce#
diff --git a/sysdeps/ia64/fpu/libm_scalblnf.S b/sysdeps/ia64/fpu/libm_scalblnf.S
new file mode 100644
index 0000000000..af620d45f8
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_scalblnf.S
@@ -0,0 +1,450 @@
+.file "libm_scalblnf.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/03/01 Initial version
+// 08/23/01 Corrected error tag number
+// 02/06/02 Corrected to handle 32- or 64-bit integers
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/25/03 Improved performance
+//
+// API
+//==============================================================
+// float __libm_scalblnf  (float x, long int n, int long_int_type) 
+// input  floating point f8 and long int n (r33) 
+// input  long_int_type = 0 if long int defined as 32 bits, = 1 if 64 bits
+// output floating point f8
+//
+// Returns x* 2**n using an fma and detects overflow
+// and underflow.
+//
+//
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x1007e                 -> Certain overflow
+//   exp_Result = 0x1007e                 -> Possible overflow
+//   0x0ff81 <= exp_Result < 0x1007e      -> No over/underflow (main path)
+//   0x0ff81 - 23 <= exp_Result < 0x0ff81 -> Possible underflow
+//   exp_Result < 0x0ff81 - 23            -> Certain underflow
+
+FR_Big         = f6
+FR_NBig        = f7
+FR_Floating_X  = f8
+FR_Result      = f8
+FR_Result2     = f9
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
+
+GR_neg_ov_limit= r14
+GR_N_Biased    = r15
+GR_Big         = r16
+GR_NBig        = r17
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_Bias        = r20
+GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+
+GR_SAVE_B0          = r32
+GR_SAVE_GP          = r33
+GR_SAVE_PFS         = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Tag              = r38
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_scalblnf)
+
+//
+//   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
+//
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+//
+//   Normalize x
+//   Is long integer type 32 bits?
+//
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+     cmp.eq        p8,p9 = r34,r0
+}
+;;
+
+//   Sign extend N if long int is 32 bits
+{    .mfi
+(p9) mov           GR_N_as_int = r33     // Copy N if long int is 64 bits
+     fclass.m      p9,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+(p8) sxt4          GR_N_as_int = r33     // Sign extend N if long int is 32 bits
+}
+{ .mfi
+     mov           GR_NBig = -35000    // If N this small then certain underflow
+     nop.f         0
+     mov           GR_max_exp = 0x1007e      // Exponent of maximum float
+}
+;;
+
+//   Create biased exponent for 2**N
+{    .mfi
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.ge        p7, p0 = GR_N_as_int, GR_Big  // Certain overflow?
+}
+{    .mib
+     cmp.le        p8, p0 = GR_N_as_int, GR_NBig // Certain underflow?
+     mov           GR_min_exp = 0x0ff81      // Exponent of minimum float
+(p9) br.cond.spnt  SCALBNF_UNORM              // Branch if x=unorm
+}
+;;
+
+SCALBNF_COMMON:
+// Main path continues.  Also return here from x=unorm path.
+//   Create 2**N
+.pred.rel "mutex",p7,p8
+{    .mfi
+     setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+(p7) mov           GR_N_as_int = GR_Big      // Limit max N
+}
+{    .mfi
+(p8) mov           GR_N_as_int = GR_NBig     // Limit min N
+     nop.f         0
+(p8) cmp.eq        p7,p0 = r0,r0             // Set p7 if |N| big
+}
+;;
+
+//
+//   Create biased exponent for 2**N for N big
+//   Is N zero?
+//
+{    .mfi
+(p7) add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.eq.or     p6,p0 = r33,r0
+}
+{    .mfi
+     mov           GR_pos_ov_limit = 0x1007f // Exponent for positive overflow
+     nop.f         0
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+}
+;;
+
+//
+//   Create 2**N for N big
+//   Return x when N = 0 or X = Nan, Inf, Zero
+//
+{    .mfi
+(p7) setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+     mov           GR_min_den_exp = 0x0ff81 - 23 // Exponent of min denorm float
+}
+{    .mfb
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X
+(p6) fma.s.s0      FR_Result = FR_Floating_X, f1, f0
+(p6) br.ret.spnt   b0
+}
+;;
+
+//
+//   Raise Denormal operand flag with compare
+//   Compute biased result exponent
+//
+{    .mfi
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
+     mov           GR_neg_ov_limit = 0x3007f // Exponent for negative overflow
+}
+;;
+
+//
+//   Do final operation
+//
+{    .mfi
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fma.s.s0      FR_Result = FR_Two_N,FR_Norm_X,f0
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
+}
+{    .mfb
+     nop.m         0
+     nop.f         0
+(p9) br.cond.spnt  SCALBNF_UNDERFLOW           // Branch if certain underflow
+}
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  SCALBNF_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  SCALBNF_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  SCALBNF_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
+
+// Here if possible underflow.
+// Resulting exponent: 0x0ff81-23 <= exp_Result < 0x0ff81
+SCALBNF_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x1007e = exp_Result
+SCALBNF_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
+//
+//   S0 user supplied status
+//   S2 user supplied status + WRE + TD  (Overflows)
+//   S3 user supplied status + FZ + TD   (Underflows)
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x41
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
+
+//
+//   Do final operation with s2 and s3
+//
+{    .mfi
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.s.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+{    .mfi
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.s.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
+
+//   Check for overflow or underflow.
+//   Restore s3
+//   Restore s2
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
+
+//
+//   Is the result zero?
+//
+{    .mfi
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
+
+//
+//   Detect masked underflow - Tiny + Inexact Only
+//
+{    .mfi
+     nop.m         0
+(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
+     nop.i         0
+}
+;;
+
+//
+//   Is result bigger the allowed range?
+//   Branch out for underflow
+//
+{    .mfb
+     nop.m          0
+(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
+(p6) br.cond.spnt   SCALBNF_UNDERFLOW
+}
+;;
+
+//
+//   Branch out for overflow
+//
+{ .bbb
+(p7) br.cond.spnt   SCALBNF_OVERFLOW
+(p9) br.cond.spnt   SCALBNF_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
+
+// Here if result overflows
+SCALBNF_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 205, r0    // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
+}
+;;
+
+// Here if result underflows
+SCALBNF_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 206, r0    // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
+
+// Here if x=unorm
+SCALBNF_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  SCALBNF_COMMON            // Return to main path
+}
+;;
+
+
+GLOBAL_LIBM_END(__libm_scalblnf)
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+//
+// Get stack address of N
+//
+.prologue
+{ .mfi
+    add   GR_Parameter_Y=-32,sp
+    nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+    mov  GR_SAVE_PFS=ar.pfs
+}
+//
+// Adjust sp
+//
+{ .mfi
+.fframe 64
+   add sp=-64,sp
+   nop.f 0
+   mov GR_SAVE_GP=gp
+};;
+
+//
+//  Store N on stack in correct position
+//  Locate the address of x on stack
+//
+{ .mmi
+   st8 [GR_Parameter_Y] =  GR_N_as_int,16
+   add GR_Parameter_X = 16,sp
+.save   b0, GR_SAVE_B0
+   mov GR_SAVE_B0=b0
+};;
+
+//
+// Store x on the stack.
+// Get address for result on stack.
+//
+.body
+{ .mib
+   stfs [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+   nop.b 0
+}
+{ .mib
+   stfs [GR_Parameter_Y] = FR_Result
+   add   GR_Parameter_Y = -16,GR_Parameter_Y
+   br.call.sptk b0=__libm_error_support#
+};;
+
+//
+//  Get location of result on stack
+//
+{ .mmi
+   add   GR_Parameter_RESULT = 48,sp
+   nop.m 0
+   nop.i 0
+};;
+
+//
+//  Get the new result
+//
+{ .mmi
+   ldfs  FR_Result = [GR_Parameter_RESULT]
+.restore sp
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
+};;
+
+//
+//  Restore gp, ar.pfs and return
+//
+{ .mib
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/libm_sincos.S b/sysdeps/ia64/fpu/libm_sincos.S
new file mode 100644
index 0000000000..7fda2afac4
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_sincos.S
@@ -0,0 +1,783 @@
+.file "libm_sincos.s"
+
+
+// Copyright (c) 2002 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/01/02 Initial version
+// 02/18/02 Large arguments processing routine is excluded.
+//          External interface entry points are added
+// 03/13/02 Corrected restore of predicate registers
+// 03/19/02 Added stack unwind around call to __libm_cis_large
+// 09/05/02 Work range is widened by reduction strengthen (3 parts of Pi/16)
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/08/03 Improved performance
+// 02/11/04 cis is moved to the separate file.
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// 1) void sincos(double, double*s, double*c)
+// 2) __libm_sincos - internal LIBM function, that accepts
+//    argument in f8 and returns cosine through f8, sine through f9
+//
+// Overview of operation
+//==============================================================
+//
+// Step 1
+// ======
+// Reduce x to region -1/2*pi/2^k ===== 0 ===== +1/2*pi/2^k  where k=4
+//    divide x by pi/2^k.
+//    Multiply by 2^k/pi.
+//    nfloat = Round result to integer (round-to-nearest)
+//
+// r = x -  nfloat * pi/2^k
+//    Do this as ((((x -  nfloat * HIGH(pi/2^k))) -
+//                        nfloat * LOW(pi/2^k)) -
+//                        nfloat * LOWEST(pi/2^k) for increased accuracy.
+//    pi/2^k is stored as two numbers that when added make pi/2^k.
+//       pi/2^k = HIGH(pi/2^k) + LOW(pi/2^k)
+//    HIGH and LOW parts are rounded to zero values,
+//    and LOWEST is rounded to nearest one.
+//
+// x = (nfloat * pi/2^k) + r
+//    r is small enough that we can use a polynomial approximation
+//    and is referred to as the reduced argument.
+//
+// Step 3
+// ======
+// Take the unreduced part and remove the multiples of 2pi.
+// So nfloat = nfloat (with lower k+1 bits cleared) + lower k+1 bits
+//
+//    nfloat (with lower k+1 bits cleared) is a multiple of 2^(k+1)
+//    N * 2^(k+1)
+//    nfloat * pi/2^k = N * 2^(k+1) * pi/2^k + (lower k+1 bits) * pi/2^k
+//    nfloat * pi/2^k = N * 2 * pi + (lower k+1 bits) * pi/2^k
+//    nfloat * pi/2^k = N2pi + M * pi/2^k
+//
+//
+// Sin(x) = Sin((nfloat * pi/2^k) + r)
+//        = Sin(nfloat * pi/2^k) * Cos(r) + Cos(nfloat * pi/2^k) * Sin(r)
+//
+//          Sin(nfloat * pi/2^k) = Sin(N2pi + Mpi/2^k)
+//                               = Sin(N2pi)Cos(Mpi/2^k) + Cos(N2pi)Sin(Mpi/2^k)
+//                               = Sin(Mpi/2^k)
+//
+//          Cos(nfloat * pi/2^k) = Cos(N2pi + Mpi/2^k)
+//                               = Cos(N2pi)Cos(Mpi/2^k) + Sin(N2pi)Sin(Mpi/2^k)
+//                               = Cos(Mpi/2^k)
+//
+// Sin(x) = Sin(Mpi/2^k) Cos(r) + Cos(Mpi/2^k) Sin(r)
+//
+//
+// Step 4
+// ======
+// 0 <= M < 2^(k+1)
+// There are 2^(k+1) Sin entries in a table.
+// There are 2^(k+1) Cos entries in a table.
+//
+// Get Sin(Mpi/2^k) and Cos(Mpi/2^k) by table lookup.
+//
+//
+// Step 5
+// ======
+// Calculate Cos(r) and Sin(r) by polynomial approximation.
+//
+// Cos(r) = 1 + r^2 q1  + r^4 q2 + r^6 q3 + ... = Series for Cos
+// Sin(r) = r + r^3 p1  + r^5 p2 + r^7 p3 + ... = Series for Sin
+//
+// and the coefficients q1, q2, ... and p1, p2, ... are stored in a table
+//
+//
+// Calculate
+// Sin(x) = Sin(Mpi/2^k) Cos(r) + Cos(Mpi/2^k) Sin(r)
+//
+// as follows
+//
+//    S[m] = Sin(Mpi/2^k) and C[m] = Cos(Mpi/2^k)
+//    rsq = r*r
+//
+//
+//    P = p1 + r^2p2 + r^4p3 + r^6p4
+//    Q = q1 + r^2q2 + r^4q3 + r^6q4
+//
+//       rcub = r * rsq
+//       Sin(r) = r + rcub * P
+//              = r + r^3p1  + r^5p2 + r^7p3 + r^9p4 + ... = Sin(r)
+//
+//            The coefficients are not exactly these values, but almost.
+//
+//            p1 = -1/6  = -1/3!
+//            p2 = 1/120 =  1/5!
+//            p3 = -1/5040 = -1/7!
+//            p4 = 1/362889 = 1/9!
+//
+//       P =  r + rcub * P
+//
+//    Answer = S[m] Cos(r) + C[m] P
+//
+//       Cos(r) = 1 + rsq Q
+//       Cos(r) = 1 + r^2 Q
+//       Cos(r) = 1 + r^2 (q1 + r^2q2 + r^4q3 + r^6q4)
+//       Cos(r) = 1 + r^2q1 + r^4q2 + r^6q3 + r^8q4 + ...
+//
+//       S[m] Cos(r) = S[m](1 + rsq Q)
+//       S[m] Cos(r) = S[m] + S[m] rsq Q
+//       S[m] Cos(r) = S[m] + s_rsq Q
+//       Q           = S[m] + s_rsq Q
+//
+// Then,
+//
+//    Answer = Q + C[m] P
+
+// Registers used
+//==============================================================
+// general input registers:
+// r14 -> r39
+
+// predicate registers used:
+// p6 -> p14
+//
+// floating-point registers used
+// f9 -> f15
+// f32 -> f67
+
+// Assembly macros
+//==============================================================
+
+cis_Arg                     = f8
+
+cis_Sin_res                 = f9
+cis_Cos_res                 = f8
+
+cis_NORM_f8                 = f10
+cis_W                       = f11
+cis_int_Nfloat              = f12
+cis_Nfloat                  = f13
+
+cis_r                       = f14
+cis_rsq                     = f15
+cis_rcub                    = f32
+
+cis_Inv_Pi_by_16            = f33
+cis_Pi_by_16_hi             = f34
+cis_Pi_by_16_lo             = f35
+
+cis_Inv_Pi_by_64            = f36
+cis_Pi_by_16_lowest         = f37
+cis_r_exact                 = f38
+
+
+cis_P1                      = f39
+cis_Q1                      = f40
+cis_P2                      = f41
+cis_Q2                      = f42
+cis_P3                      = f43
+cis_Q3                      = f44
+cis_P4                      = f45
+cis_Q4                      = f46
+
+cis_P_temp1                 = f47
+cis_P_temp2                 = f48
+
+cis_Q_temp1                 = f49
+cis_Q_temp2                 = f50
+
+cis_P                       = f51
+
+cis_SIG_INV_PI_BY_16_2TO61  = f52
+cis_RSHF_2TO61              = f53
+cis_RSHF                    = f54
+cis_2TOM61                  = f55
+cis_NFLOAT                  = f56
+cis_W_2TO61_RSH             = f57
+
+cis_tmp                     = f58
+
+cis_Sm_sin                  = f59
+cis_Cm_sin                  = f60
+
+cis_Sm_cos                  = f61
+cis_Cm_cos                  = f62
+
+cis_srsq_sin                = f63
+cis_srsq_cos                = f64
+
+cis_Q_sin                   = f65
+cis_Q_cos                   = f66
+cis_Q                       = f67
+
+/////////////////////////////////////////////////////////////
+
+cis_pResSin                 = r33
+cis_pResCos                 = r34
+
+cis_GR_sig_inv_pi_by_16     = r14
+cis_GR_rshf_2to61           = r15
+cis_GR_rshf                 = r16
+cis_GR_exp_2tom61           = r17
+cis_GR_n                    = r18
+cis_GR_n_sin                = r19
+cis_exp_limit               = r20
+cis_r_signexp               = r21
+cis_AD_1                    = r22
+cis_r_sincos                = r23
+cis_r_exp                   = r24
+cis_r_17_ones               = r25
+cis_GR_m_sin                = r26
+cis_GR_32m_sin              = r26
+cis_GR_n_cos                = r27
+cis_GR_m_cos                = r28
+cis_GR_32m_cos              = r28
+cis_AD_2_sin                = r29
+cis_AD_2_cos                = r30
+cis_gr_tmp                  = r31
+
+GR_SAVE_B0                  = r35
+GR_SAVE_GP                  = r36
+rB0_SAVED                   = r37
+GR_SAVE_PFS                 = r38
+GR_SAVE_PR                  = r39
+
+RODATA
+
+.align 16
+// Pi/16 parts
+LOCAL_OBJECT_START(double_cis_pi)
+   data8 0xC90FDAA22168C234, 0x00003FFC // pi/16 1st part
+   data8 0xC4C6628B80DC1CD1, 0x00003FBC // pi/16 2nd part
+   data8 0xA4093822299F31D0, 0x00003F7A // pi/16 3rd part
+LOCAL_OBJECT_END(double_cis_pi)
+
+// Coefficients for polynomials
+LOCAL_OBJECT_START(double_cis_pq_k4)
+   data8 0x3EC71C963717C63A // P4
+   data8 0x3EF9FFBA8F191AE6 // Q4
+   data8 0xBF2A01A00F4E11A8 // P3
+   data8 0xBF56C16C05AC77BF // Q3
+   data8 0x3F8111111110F167 // P2
+   data8 0x3FA555555554DD45 // Q2
+   data8 0xBFC5555555555555 // P1
+   data8 0xBFDFFFFFFFFFFFFC // Q1
+LOCAL_OBJECT_END(double_cis_pq_k4)
+
+// Sincos table (S[m], C[m])
+LOCAL_OBJECT_START(double_sin_cos_beta_k4)
+data8 0x0000000000000000 , 0x00000000 // sin( 0 pi/16)  S0
+data8 0x8000000000000000 , 0x00003fff // cos( 0 pi/16)  C0
+//
+data8 0xc7c5c1e34d3055b3 , 0x00003ffc // sin( 1 pi/16)  S1
+data8 0xfb14be7fbae58157 , 0x00003ffe // cos( 1 pi/16)  C1
+//
+data8 0xc3ef1535754b168e , 0x00003ffd // sin( 2 pi/16)  S2
+data8 0xec835e79946a3146 , 0x00003ffe // cos( 2 pi/16)  C2
+//
+data8 0x8e39d9cd73464364 , 0x00003ffe // sin( 3 pi/16)  S3
+data8 0xd4db3148750d181a , 0x00003ffe // cos( 3 pi/16)  C3
+//
+data8 0xb504f333f9de6484 , 0x00003ffe // sin( 4 pi/16)  S4
+data8 0xb504f333f9de6484 , 0x00003ffe // cos( 4 pi/16)  C4
+//
+data8 0xd4db3148750d181a , 0x00003ffe // sin( 5 pi/16)  C3
+data8 0x8e39d9cd73464364 , 0x00003ffe // cos( 5 pi/16)  S3
+//
+data8 0xec835e79946a3146 , 0x00003ffe // sin( 6 pi/16)  C2
+data8 0xc3ef1535754b168e , 0x00003ffd // cos( 6 pi/16)  S2
+//
+data8 0xfb14be7fbae58157 , 0x00003ffe // sin( 7 pi/16)  C1
+data8 0xc7c5c1e34d3055b3 , 0x00003ffc // cos( 7 pi/16)  S1
+//
+data8 0x8000000000000000 , 0x00003fff // sin( 8 pi/16)  C0
+data8 0x0000000000000000 , 0x00000000 // cos( 8 pi/16)  S0
+//
+data8 0xfb14be7fbae58157 , 0x00003ffe // sin( 9 pi/16)  C1
+data8 0xc7c5c1e34d3055b3 , 0x0000bffc // cos( 9 pi/16)  -S1
+//
+data8 0xec835e79946a3146 , 0x00003ffe // sin(10 pi/16)  C2
+data8 0xc3ef1535754b168e , 0x0000bffd // cos(10 pi/16)  -S2
+//
+data8 0xd4db3148750d181a , 0x00003ffe // sin(11 pi/16)  C3
+data8 0x8e39d9cd73464364 , 0x0000bffe // cos(11 pi/16)  -S3
+//
+data8 0xb504f333f9de6484 , 0x00003ffe // sin(12 pi/16)  S4
+data8 0xb504f333f9de6484 , 0x0000bffe // cos(12 pi/16)  -S4
+//
+data8 0x8e39d9cd73464364 , 0x00003ffe // sin(13 pi/16) S3
+data8 0xd4db3148750d181a , 0x0000bffe // cos(13 pi/16) -C3
+//
+data8 0xc3ef1535754b168e , 0x00003ffd // sin(14 pi/16) S2
+data8 0xec835e79946a3146 , 0x0000bffe // cos(14 pi/16) -C2
+//
+data8 0xc7c5c1e34d3055b3 , 0x00003ffc // sin(15 pi/16) S1
+data8 0xfb14be7fbae58157 , 0x0000bffe // cos(15 pi/16) -C1
+//
+data8 0x0000000000000000 , 0x00000000 // sin(16 pi/16) S0
+data8 0x8000000000000000 , 0x0000bfff // cos(16 pi/16) -C0
+//
+data8 0xc7c5c1e34d3055b3 , 0x0000bffc // sin(17 pi/16) -S1
+data8 0xfb14be7fbae58157 , 0x0000bffe // cos(17 pi/16) -C1
+//
+data8 0xc3ef1535754b168e , 0x0000bffd // sin(18 pi/16) -S2
+data8 0xec835e79946a3146 , 0x0000bffe // cos(18 pi/16) -C2
+//
+data8 0x8e39d9cd73464364 , 0x0000bffe // sin(19 pi/16) -S3
+data8 0xd4db3148750d181a , 0x0000bffe // cos(19 pi/16) -C3
+//
+data8 0xb504f333f9de6484 , 0x0000bffe // sin(20 pi/16) -S4
+data8 0xb504f333f9de6484 , 0x0000bffe // cos(20 pi/16) -S4
+//
+data8 0xd4db3148750d181a , 0x0000bffe // sin(21 pi/16) -C3
+data8 0x8e39d9cd73464364 , 0x0000bffe // cos(21 pi/16) -S3
+//
+data8 0xec835e79946a3146 , 0x0000bffe // sin(22 pi/16) -C2
+data8 0xc3ef1535754b168e , 0x0000bffd // cos(22 pi/16) -S2
+//
+data8 0xfb14be7fbae58157 , 0x0000bffe // sin(23 pi/16) -C1
+data8 0xc7c5c1e34d3055b3 , 0x0000bffc // cos(23 pi/16) -S1
+//
+data8 0x8000000000000000 , 0x0000bfff // sin(24 pi/16) -C0
+data8 0x0000000000000000 , 0x00000000 // cos(24 pi/16) S0
+//
+data8 0xfb14be7fbae58157 , 0x0000bffe // sin(25 pi/16) -C1
+data8 0xc7c5c1e34d3055b3 , 0x00003ffc // cos(25 pi/16) S1
+//
+data8 0xec835e79946a3146 , 0x0000bffe // sin(26 pi/16) -C2
+data8 0xc3ef1535754b168e , 0x00003ffd // cos(26 pi/16) S2
+//
+data8 0xd4db3148750d181a , 0x0000bffe // sin(27 pi/16) -C3
+data8 0x8e39d9cd73464364 , 0x00003ffe // cos(27 pi/16) S3
+//
+data8 0xb504f333f9de6484 , 0x0000bffe // sin(28 pi/16) -S4
+data8 0xb504f333f9de6484 , 0x00003ffe // cos(28 pi/16) S4
+//
+data8 0x8e39d9cd73464364 , 0x0000bffe // sin(29 pi/16) -S3
+data8 0xd4db3148750d181a , 0x00003ffe // cos(29 pi/16) C3
+//
+data8 0xc3ef1535754b168e , 0x0000bffd // sin(30 pi/16) -S2
+data8 0xec835e79946a3146 , 0x00003ffe // cos(30 pi/16) C2
+//
+data8 0xc7c5c1e34d3055b3 , 0x0000bffc // sin(31 pi/16) -S1
+data8 0xfb14be7fbae58157 , 0x00003ffe // cos(31 pi/16) C1
+//
+data8 0x0000000000000000 , 0x00000000 // sin(32 pi/16) S0
+data8 0x8000000000000000 , 0x00003fff // cos(32 pi/16) C0
+LOCAL_OBJECT_END(double_sin_cos_beta_k4)
+
+.section .text
+
+GLOBAL_IEEE754_ENTRY(sincos)
+// cis_GR_sig_inv_pi_by_16 = significand of 16/pi
+{ .mlx
+      getf.exp      cis_r_signexp       = cis_Arg
+      movl          cis_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A
+
+}
+// cis_GR_rshf_2to61 = 1.1000 2^(63+63-2)
+{ .mlx
+      addl          cis_AD_1                = @ltoff(double_cis_pi), gp
+      movl          cis_GR_rshf_2to61       = 0x47b8000000000000
+};;
+
+{ .mfi
+      ld8           cis_AD_1            = [cis_AD_1]
+      fnorm.s1      cis_NORM_f8         = cis_Arg
+      cmp.eq        p13, p14            = r0, r0 // p13 set for sincos
+}
+// cis_GR_exp_2tom61 = exponent of scaling factor 2^-61
+{ .mib
+      mov           cis_GR_exp_2tom61   = 0xffff-61
+      nop.i         0
+      br.cond.sptk  _CIS_COMMON
+};;
+GLOBAL_IEEE754_END(sincos)
+
+GLOBAL_LIBM_ENTRY(__libm_sincos)
+// cis_GR_sig_inv_pi_by_16 = significand of 16/pi
+{ .mlx
+      getf.exp      cis_r_signexp       = cis_Arg
+      movl          cis_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A
+}
+// cis_GR_rshf_2to61 = 1.1000 2^(63+63-2)
+{ .mlx
+      addl          cis_AD_1            = @ltoff(double_cis_pi), gp
+      movl          cis_GR_rshf_2to61   = 0x47b8000000000000
+};;
+
+// p14 set for __libm_sincos and cis
+{ .mfi
+      ld8           cis_AD_1            = [cis_AD_1]
+      fnorm.s1      cis_NORM_f8         = cis_Arg
+      cmp.eq        p14, p13            = r0, r0
+}
+// cis_GR_exp_2tom61 = exponent of scaling factor 2^-61
+{ .mib
+      mov           cis_GR_exp_2tom61   = 0xffff-61
+      nop.i         0
+      nop.b         0
+};;
+
+_CIS_COMMON:
+//  Form two constants we need
+//  16/pi * 2^-2 * 2^63, scaled by 2^61 since we just loaded the significand
+//  1.1000...000 * 2^(63+63-2) to right shift int(W) into the low significand
+//  fcmp used to set denormal, and invalid on snans
+{ .mfi
+      setf.sig      cis_SIG_INV_PI_BY_16_2TO61 = cis_GR_sig_inv_pi_by_16
+      fclass.m      p6,p0                      = cis_Arg, 0xe7 // if x=0,inf,nan
+      addl          cis_gr_tmp                 = -1, r0
+}
+// 1.1000 2^63 for right shift
+{ .mlx
+      setf.d        cis_RSHF_2TO61             = cis_GR_rshf_2to61
+      movl          cis_GR_rshf                = 0x43e8000000000000
+};;
+
+//  Form another constant
+//  2^-61 for scaling Nfloat
+//  0x1001a is register_bias + 27.
+//  So if f8 >= 2^27, go to large arguments routine
+{ .mfi
+      alloc         GR_SAVE_PFS         = ar.pfs, 3, 5, 0, 0
+      fclass.m      p11,p0              = cis_Arg, 0x0b // Test for x=unorm
+      mov           cis_exp_limit       = 0x1001a
+}
+{ .mib
+      setf.exp      cis_2TOM61          = cis_GR_exp_2tom61
+      nop.i         0
+(p6)  br.cond.spnt  _CIS_SPECIAL_ARGS
+};;
+
+//  Load the two pieces of pi/16
+//  Form another constant
+//  1.1000...000 * 2^63, the right shift constant
+{ .mmb
+      ldfe          cis_Pi_by_16_hi     = [cis_AD_1],16
+      setf.d        cis_RSHF            = cis_GR_rshf
+(p11) br.cond.spnt  _CIS_UNORM          // Branch if x=unorm
+};;
+
+_CIS_COMMON2:
+// Return here if x=unorm
+// Create constant inexact set
+{ .mmi
+      ldfe          cis_Pi_by_16_lo     = [cis_AD_1],16
+      setf.sig      cis_tmp             = cis_gr_tmp
+      nop.i         0
+};;
+
+// Select exponent (17 lsb)
+{ .mfi
+      ldfe          cis_Pi_by_16_lowest = [cis_AD_1],16
+      nop.f         0
+      dep.z         cis_r_exp           = cis_r_signexp, 0, 17
+};;
+
+// Start loading P, Q coefficients
+// p10 is true if we must call routines to handle larger arguments
+// p10 is true if f8 exp is > 0x1001a
+{ .mmb
+      ldfpd         cis_P4,cis_Q4       = [cis_AD_1],16
+      cmp.ge        p10, p0             = cis_r_exp, cis_exp_limit
+(p10) br.cond.spnt  _CIS_LARGE_ARGS // go to |x| >= 2^27 path
+};;
+
+// cis_W = x * cis_Inv_Pi_by_16
+// Multiply x by scaled 16/pi and add large const to shift integer part of W to
+// rightmost bits of significand
+{ .mfi
+      ldfpd         cis_P3,cis_Q3       = [cis_AD_1],16
+      fma.s1 cis_W_2TO61_RSH = cis_NORM_f8,cis_SIG_INV_PI_BY_16_2TO61,cis_RSHF_2TO61
+      nop.i  0
+};;
+
+// get N = (int)cis_int_Nfloat
+// cis_NFLOAT = Round_Int_Nearest(cis_W)
+{ .mmf
+      getf.sig      cis_GR_n            = cis_W_2TO61_RSH
+      ldfpd  cis_P2,cis_Q2   = [cis_AD_1],16
+      fms.s1        cis_NFLOAT          = cis_W_2TO61_RSH,cis_2TOM61,cis_RSHF
+};;
+
+// cis_r = -cis_Nfloat * cis_Pi_by_16_hi + x
+{ .mfi
+      ldfpd         cis_P1,cis_Q1       = [cis_AD_1], 16
+      fnma.s1       cis_r               = cis_NFLOAT,cis_Pi_by_16_hi,cis_NORM_f8
+      nop.i         0
+};;
+
+// Add 2^(k-1) (which is in cis_r_sincos) to N
+{ .mmi
+      add           cis_GR_n_cos        = 0x8, cis_GR_n
+;;
+//Get M (least k+1 bits of N)
+      and           cis_GR_m_sin        = 0x1f,cis_GR_n
+      and           cis_GR_m_cos        = 0x1f,cis_GR_n_cos
+};;
+
+{ .mmi
+      nop.m         0
+      nop.m         0
+      shl           cis_GR_32m_sin      = cis_GR_m_sin,5
+};;
+
+// Add 32*M to address of sin_cos_beta table
+// cis_r =  cis_r -cis_Nfloat * cis_Pi_by_16_lo
+{ .mfi
+      add           cis_AD_2_sin        = cis_GR_32m_sin, cis_AD_1
+      fnma.s1       cis_r               = cis_NFLOAT, cis_Pi_by_16_lo,  cis_r
+      shl           cis_GR_32m_cos      = cis_GR_m_cos,5
+};;
+
+// Add 32*M to address of sin_cos_beta table
+{ .mmf
+      ldfe          cis_Sm_sin          = [cis_AD_2_sin],16
+      add           cis_AD_2_cos        = cis_GR_32m_cos, cis_AD_1
+      fclass.m.unc  p10,p0              = cis_Arg,0x0b  // den. input - uflow
+};;
+
+{ .mfi
+      ldfe          cis_Sm_cos          = [cis_AD_2_cos], 16
+      nop.i         0
+};;
+
+{ .mfi
+      ldfe          cis_Cm_sin          = [cis_AD_2_sin]
+      fma.s1        cis_rsq             = cis_r, cis_r,   f0  // get r^2
+      nop.i         0
+}
+// fmpy forces inexact flag
+{ .mfi
+      nop.m         0
+      fmpy.s0       cis_tmp             = cis_tmp,cis_tmp
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fnma.s1       cis_r_exact         = cis_NFLOAT, cis_Pi_by_16_lowest, cis_r
+      nop.i         0
+};;
+
+{ .mfi
+      ldfe          cis_Cm_cos          = [cis_AD_2_cos]
+      fma.s1        cis_P_temp1         = cis_rsq, cis_P4, cis_P3
+      nop.i         0
+}
+
+{ .mfi
+      nop.m         0
+      fma.s1        cis_Q_temp1         = cis_rsq, cis_Q4, cis_Q3
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fmpy.s1       cis_srsq_sin        = cis_Sm_sin, cis_rsq
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fmpy.s1       cis_srsq_cos        = cis_Sm_cos,cis_rsq
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cis_Q_temp2         = cis_rsq, cis_Q_temp1, cis_Q2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        cis_P_temp2         = cis_rsq, cis_P_temp1, cis_P2
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fmpy.s1       cis_rcub            = cis_r_exact, cis_rsq // get r^3
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cis_Q               = cis_rsq, cis_Q_temp2, cis_Q1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        cis_P               = cis_rsq, cis_P_temp2, cis_P1
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cis_Q_sin           = cis_srsq_sin,cis_Q, cis_Sm_sin
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        cis_Q_cos           = cis_srsq_cos,cis_Q, cis_Sm_cos
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cis_P               = cis_rcub,cis_P, cis_r_exact // final P
+      nop.i         0
+};;
+
+// If den. arg, force underflow to be set
+{ .mfi
+      nop.m         0
+(p10) fmpy.d.s0     cis_tmp             = cis_Arg,cis_Arg
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fma.d.s0      cis_Sin_res         = cis_Cm_sin,cis_P,cis_Q_sin//Final sin
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+      fma.d.s0      cis_Cos_res         = cis_Cm_cos,cis_P,cis_Q_cos//Final cos
+(p14) br.ret.sptk   b0  // common exit for __libm_sincos and cis main path
+};;
+
+{ .mmb
+      stfd          [cis_pResSin]       = cis_Sin_res
+      stfd          [cis_pResCos]       = cis_Cos_res
+      br.ret.sptk   b0 // common exit for sincos main path
+};;
+
+_CIS_SPECIAL_ARGS:
+// sin(+/-0) = +/-0
+// sin(Inf)  = NaN
+// sin(NaN)  = NaN
+{ .mfi
+      nop.m         999
+      fma.d.s0      cis_Sin_res          = cis_Arg, f0, f0 // sinf(+/-0,NaN,Inf)
+      nop.i         999
+};;
+// cos(+/-0) = 1.0
+// cos(Inf)  = NaN
+// cos(NaN)  = NaN
+{ .mfb
+      nop.m         999
+      fma.d.s0      cis_Cos_res          = cis_Arg, f0, f1 // cosf(+/-0,NaN,Inf)
+(p14) br.ret.sptk   b0 //spec exit for __libm_sincos and cis main path
+};;
+
+{ .mmb
+      stfd          [cis_pResSin]       = cis_Sin_res
+      stfd          [cis_pResCos]       = cis_Cos_res
+      br.ret.sptk   b0 // common exit for sincos main path
+};;
+
+_CIS_UNORM:
+// Here if x=unorm
+{ .mfb
+      getf.exp      cis_r_signexp       = cis_NORM_f8 // Get signexp of x
+      fcmp.eq.s0    p11,p0              = cis_Arg, f0 // Dummy op to set denorm
+      br.cond.sptk  _CIS_COMMON2        // Return to main path
+};;
+
+GLOBAL_LIBM_END(__libm_sincos)
+
+////  |x| > 2^27 path  ///////
+.proc _CIS_LARGE_ARGS
+_CIS_LARGE_ARGS:
+.prologue
+{ .mfi
+      nop.m         0
+      nop.f         0
+.save ar.pfs, GR_SAVE_PFS
+      mov           GR_SAVE_PFS         = ar.pfs
+}
+;;
+
+{ .mfi
+      mov           GR_SAVE_GP          = gp
+      nop.f         0
+.save b0, GR_SAVE_B0
+      mov           GR_SAVE_B0          = b0
+};;
+
+.body
+// Call of huge arguments sincos
+{ .mib
+      nop.m         0
+      mov           GR_SAVE_PR          = pr
+      br.call.sptk  b0                  = __libm_sincos_large
+};;
+
+{ .mfi
+      mov           gp                  = GR_SAVE_GP
+      nop.f         0
+      mov           pr                  = GR_SAVE_PR, 0x1fffe
+}
+;;
+
+{ .mfi
+      nop.m         0
+      nop.f         0
+      mov           b0                  = GR_SAVE_B0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.d.s0      cis_Cos_res         = cis_Cos_res, f1, f0
+      mov           ar.pfs              = GR_SAVE_PFS
+}
+{ .mfb
+      nop.m         0
+      fma.d.s0      cis_Sin_res         = cis_Sin_res, f1, f0
+(p14) br.ret.sptk   b0  // exit for |x| > 2^27 path (__libm_sincos and cis)
+};;
+
+{ .mmb
+      stfd          [cis_pResSin]       = cis_Sin_res
+      stfd          [cis_pResCos]       = cis_Cos_res
+      br.ret.sptk   b0 // exit for sincos |x| > 2^27 path
+};;
+.endp _CIS_LARGE_ARGS
+
+.type __libm_sincos_large#,@function
+.global __libm_sincos_large#
+
diff --git a/sysdeps/ia64/fpu/libm_sincos_large.S b/sysdeps/ia64/fpu/libm_sincos_large.S
new file mode 100644
index 0000000000..b09d3693a6
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_sincos_large.S
@@ -0,0 +1,2757 @@
+.file "libm_sincos_large.s"
+
+
+// Copyright (c) 2002 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/15/02 Initial version
+// 05/13/02 Changed interface to __libm_pi_by_2_reduce
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+// 05/15/03 Reformatted data tables
+//
+//
+// Overview of operation
+//==============================================================
+//
+// These functions calculate the sin and cos for inputs
+// greater than 2^10
+//
+// __libm_sin_large#
+// __libm_cos_large#
+// They accept argument in f8
+// and return result in f8 without final rounding
+//
+// __libm_sincos_large#
+// It accepts argument in f8
+// and returns cos in f8 and sin in f9 without final rounding
+//
+//
+//*********************************************************************
+//
+// Accuracy:       Within .7 ulps for 80-bit floating point values
+//                 Very accurate for double precision values
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f8 as Input Value, f8 and f9 as Return Values
+//                              f32-f103
+//
+//    General Purpose Registers:
+//      r32-r43
+//      r44-r45 (Used to pass arguments to pi_by_2 reduce routine)
+//
+//    Predicate Registers:      p6-p13
+//
+//*********************************************************************
+//
+//  IEEE Special Conditions:
+//
+//    Denormal  fault raised on denormal inputs
+//    Overflow exceptions do not occur
+//    Underflow exceptions raised when appropriate for sin
+//    (No specialized error handling for this routine)
+//    Inexact raised when appropriate by algorithm
+//
+//    sin(SNaN) = QNaN
+//    sin(QNaN) = QNaN
+//    sin(inf) = QNaN
+//    sin(+/-0) = +/-0
+//    cos(inf) = QNaN
+//    cos(SNaN) = QNaN
+//    cos(QNaN) = QNaN
+//    cos(0) = 1
+//
+//*********************************************************************
+//
+//  Mathematical Description
+//  ========================
+//
+//  The computation of FSIN and FCOS is best handled in one piece of
+//  code. The main reason is that given any argument Arg, computation
+//  of trigonometric functions first calculate N and an approximation
+//  to alpha where
+//
+//  Arg = N pi/2 + alpha, |alpha| <= pi/4.
+//
+//  Since
+//
+//  cos( Arg ) = sin( (N+1) pi/2 + alpha ),
+//
+//  therefore, the code for computing sine will produce cosine as long
+//  as 1 is added to N immediately after the argument reduction
+//  process.
+//
+//  Let M = N if sine
+//      N+1 if cosine.
+//
+//  Now, given
+//
+//  Arg = M pi/2  + alpha, |alpha| <= pi/4,
+//
+//  let I = M mod 4, or I be the two lsb of M when M is represented
+//  as 2's complement. I = [i_0 i_1]. Then
+//
+//  sin( Arg ) = (-1)^i_0  sin( alpha ) if i_1 = 0,
+//             = (-1)^i_0  cos( alpha )     if i_1 = 1.
+//
+//  For example:
+//       if M = -1, I = 11
+//         sin ((-pi/2 + alpha) = (-1) cos (alpha)
+//       if M = 0, I = 00
+//         sin (alpha) = sin (alpha)
+//       if M = 1, I = 01
+//         sin (pi/2 + alpha) = cos (alpha)
+//       if M = 2, I = 10
+//         sin (pi + alpha) = (-1) sin (alpha)
+//       if M = 3, I = 11
+//         sin ((3/2)pi + alpha) = (-1) cos (alpha)
+//
+//  The value of alpha is obtained by argument reduction and
+//  represented by two working precision numbers r and c where
+//
+//  alpha =  r  +  c     accurately.
+//
+//  The reduction method is described in a previous write up.
+//  The argument reduction scheme identifies 4 cases. For Cases 2
+//  and 4, because |alpha| is small, sin(r+c) and cos(r+c) can be
+//  computed very easily by 2 or 3 terms of the Taylor series
+//  expansion as follows:
+//
+//  Case 2:
+//  -------
+//
+//  sin(r + c) = r + c - r^3/6  accurately
+//  cos(r + c) = 1 - 2^(-67)    accurately
+//
+//  Case 4:
+//  -------
+//
+//  sin(r + c) = r + c - r^3/6 + r^5/120    accurately
+//  cos(r + c) = 1 - r^2/2 + r^4/24     accurately
+//
+//  The only cases left are Cases 1 and 3 of the argument reduction
+//  procedure. These two cases will be merged since after the
+//  argument is reduced in either cases, we have the reduced argument
+//  represented as r + c and that the magnitude |r + c| is not small
+//  enough to allow the usage of a very short approximation.
+//
+//  The required calculation is either
+//
+//  sin(r + c)  =  sin(r)  +  correction,  or
+//  cos(r + c)  =  cos(r)  +  correction.
+//
+//  Specifically,
+//
+//  sin(r + c) = sin(r) + c sin'(r) + O(c^2)
+//         = sin(r) + c cos (r) + O(c^2)
+//         = sin(r) + c(1 - r^2/2)  accurately.
+//  Similarly,
+//
+//  cos(r + c) = cos(r) - c sin(r) + O(c^2)
+//         = cos(r) - c(r - r^3/6)  accurately.
+//
+//  We therefore concentrate on accurately calculating sin(r) and
+//  cos(r) for a working-precision number r, |r| <= pi/4 to within
+//  0.1% or so.
+//
+//  The greatest challenge of this task is that the second terms of
+//  the Taylor series
+//
+//  r - r^3/3! + r^r/5! - ...
+//
+//  and
+//
+//  1 - r^2/2! + r^4/4! - ...
+//
+//  are not very small when |r| is close to pi/4 and the rounding
+//  errors will be a concern if simple polynomial accumulation is
+//  used. When |r| < 2^-3, however, the second terms will be small
+//  enough (6 bits or so of right shift) that a normal Horner
+//  recurrence suffices. Hence there are two cases that we consider
+//  in the accurate computation of sin(r) and cos(r), |r| <= pi/4.
+//
+//  Case small_r: |r| < 2^(-3)
+//  --------------------------
+//
+//  Since Arg = M pi/4 + r + c accurately, and M mod 4 is [i_0 i_1],
+//  we have
+//
+//  sin(Arg) = (-1)^i_0 * sin(r + c)    if i_1 = 0
+//       = (-1)^i_0 * cos(r + c)    if i_1 = 1
+//
+//  can be accurately approximated by
+//
+//  sin(Arg) = (-1)^i_0 * [sin(r) + c]  if i_1 = 0
+//           = (-1)^i_0 * [cos(r) - c*r] if i_1 = 1
+//
+//  because |r| is small and thus the second terms in the correction
+//  are unneccessary.
+//
+//  Finally, sin(r) and cos(r) are approximated by polynomials of
+//  moderate lengths.
+//
+//  sin(r) =  r + S_1 r^3 + S_2 r^5 + ... + S_5 r^11
+//  cos(r) =  1 + C_1 r^2 + C_2 r^4 + ... + C_5 r^10
+//
+//  We can make use of predicates to selectively calculate
+//  sin(r) or cos(r) based on i_1.
+//
+//  Case normal_r: 2^(-3) <= |r| <= pi/4
+//  ------------------------------------
+//
+//  This case is more likely than the previous one if one considers
+//  r to be uniformly distributed in [-pi/4 pi/4]. Again,
+//
+//  sin(Arg) = (-1)^i_0 * sin(r + c)    if i_1 = 0
+//           = (-1)^i_0 * cos(r + c)    if i_1 = 1.
+//
+//  Because |r| is now larger, we need one extra term in the
+//  correction. sin(Arg) can be accurately approximated by
+//
+//  sin(Arg) = (-1)^i_0 * [sin(r) + c(1-r^2/2)]      if i_1 = 0
+//           = (-1)^i_0 * [cos(r) - c*r*(1 - r^2/6)]    i_1 = 1.
+//
+//  Finally, sin(r) and cos(r) are approximated by polynomials of
+//  moderate lengths.
+//
+//  sin(r) =  r + PP_1_hi r^3 + PP_1_lo r^3 +
+//                PP_2 r^5 + ... + PP_8 r^17
+//
+//  cos(r) =  1 + QQ_1 r^2 + QQ_2 r^4 + ... + QQ_8 r^16
+//
+//  where PP_1_hi is only about 16 bits long and QQ_1 is -1/2.
+//  The crux in accurate computation is to calculate
+//
+//  r + PP_1_hi r^3   or  1 + QQ_1 r^2
+//
+//  accurately as two pieces: U_hi and U_lo. The way to achieve this
+//  is to obtain r_hi as a 10 sig. bit number that approximates r to
+//  roughly 8 bits or so of accuracy. (One convenient way is
+//
+//  r_hi := frcpa( frcpa( r ) ).)
+//
+//  This way,
+//
+//  r + PP_1_hi r^3 =  r + PP_1_hi r_hi^3 +
+//                          PP_1_hi (r^3 - r_hi^3)
+//              =  [r + PP_1_hi r_hi^3]  +
+//             [PP_1_hi (r - r_hi)
+//                (r^2 + r_hi r + r_hi^2) ]
+//              =  U_hi  +  U_lo
+//
+//  Since r_hi is only 10 bit long and PP_1_hi is only 16 bit long,
+//  PP_1_hi * r_hi^3 is only at most 46 bit long and thus computed
+//  exactly. Furthermore, r and PP_1_hi r_hi^3 are of opposite sign
+//  and that there is no more than 8 bit shift off between r and
+//  PP_1_hi * r_hi^3. Hence the sum, U_hi, is representable and thus
+//  calculated without any error. Finally, the fact that
+//
+//  |U_lo| <= 2^(-8) |U_hi|
+//
+//  says that U_hi + U_lo is approximating r + PP_1_hi r^3 to roughly
+//  8 extra bits of accuracy.
+//
+//  Similarly,
+//
+//  1 + QQ_1 r^2  =  [1 + QQ_1 r_hi^2]  +
+//                      [QQ_1 (r - r_hi)(r + r_hi)]
+//            =  U_hi  +  U_lo.
+//
+//  Summarizing, we calculate r_hi = frcpa( frcpa( r ) ).
+//
+//  If i_1 = 0, then
+//
+//    U_hi := r + PP_1_hi * r_hi^3
+//    U_lo := PP_1_hi * (r - r_hi) * (r^2 + r*r_hi + r_hi^2)
+//    poly := PP_1_lo r^3 + PP_2 r^5 + ... + PP_8 r^17
+//    correction := c * ( 1 + C_1 r^2 )
+//
+//  Else ...i_1 = 1
+//
+//    U_hi := 1 + QQ_1 * r_hi * r_hi
+//    U_lo := QQ_1 * (r - r_hi) * (r + r_hi)
+//    poly := QQ_2 * r^4 + QQ_3 * r^6 + ... + QQ_8 r^16
+//    correction := -c * r * (1 + S_1 * r^2)
+//
+//  End
+//
+//  Finally,
+//
+//  V := poly + ( U_lo + correction )
+//
+//                 /    U_hi  +  V         if i_0 = 0
+//  result := |
+//                 \  (-U_hi) -  V         if i_0 = 1
+//
+//  It is important that in the last step, negation of U_hi is
+//  performed prior to the subtraction which is to be performed in
+//  the user-set rounding mode.
+//
+//
+//  Algorithmic Description
+//  =======================
+//
+//  The argument reduction algorithm is tightly integrated into FSIN
+//  and FCOS which share the same code. The following is complete and
+//  self-contained. The argument reduction description given
+//  previously is repeated below.
+//
+//
+//  Step 0. Initialization.
+//
+//   If FSIN is invoked, set N_inc := 0; else if FCOS is invoked,
+//   set N_inc := 1.
+//
+//  Step 1. Check for exceptional and special cases.
+//
+//   * If Arg is +-0, +-inf, NaN, NaT, go to Step 10 for special
+//     handling.
+//   * If |Arg| < 2^24, go to Step 2 for reduction of moderate
+//     arguments. This is the most likely case.
+//   * If |Arg| < 2^63, go to Step 8 for pre-reduction of large
+//     arguments.
+//   * If |Arg| >= 2^63, go to Step 10 for special handling.
+//
+//  Step 2. Reduction of moderate arguments.
+//
+//  If |Arg| < pi/4     ...quick branch
+//     N_fix := N_inc   (integer)
+//     r     := Arg
+//     c     := 0.0
+//     Branch to Step 4, Case_1_complete
+//  Else        ...cf. argument reduction
+//     N     := Arg * two_by_PI (fp)
+//     N_fix := fcvt.fx( N )    (int)
+//     N     := fcvt.xf( N_fix )
+//     N_fix := N_fix + N_inc
+//     s     := Arg - N * P_1   (first piece of pi/2)
+//     w     := -N * P_2    (second piece of pi/2)
+//
+//     If |s| >= 2^(-33)
+//        go to Step 3, Case_1_reduce
+//     Else
+//        go to Step 7, Case_2_reduce
+//     Endif
+//  Endif
+//
+//  Step 3. Case_1_reduce.
+//
+//  r := s + w
+//  c := (s - r) + w    ...observe order
+//
+//  Step 4. Case_1_complete
+//
+//  ...At this point, the reduced argument alpha is
+//  ...accurately represented as r + c.
+//  If |r| < 2^(-3), go to Step 6, small_r.
+//
+//  Step 5. Normal_r.
+//
+//  Let [i_0 i_1] by the 2 lsb of N_fix.
+//  FR_rsq  := r * r
+//  r_hi := frcpa( frcpa( r ) )
+//  r_lo := r - r_hi
+//
+//  If i_1 = 0, then
+//    poly := r*FR_rsq*(PP_1_lo + FR_rsq*(PP_2 + ... FR_rsq*PP_8))
+//    U_hi := r + PP_1_hi*r_hi*r_hi*r_hi    ...any order
+//    U_lo := PP_1_hi*r_lo*(r*r + r*r_hi + r_hi*r_hi)
+//    correction := c + c*C_1*FR_rsq        ...any order
+//  Else
+//    poly := FR_rsq*FR_rsq*(QQ_2 + FR_rsq*(QQ_3 + ... + FR_rsq*QQ_8))
+//    U_hi := 1 + QQ_1 * r_hi * r_hi        ...any order
+//    U_lo := QQ_1 * r_lo * (r + r_hi)
+//    correction := -c*(r + S_1*FR_rsq*r)   ...any order
+//  Endif
+//
+//  V := poly + (U_lo + correction) ...observe order
+//
+//  result := (i_0 == 0?   1.0 : -1.0)
+//
+//  Last instruction in user-set rounding mode
+//
+//  result := (i_0 == 0?   result*U_hi + V :
+//                        result*U_hi - V)
+//
+//  Return
+//
+//  Step 6. Small_r.
+//
+//  ...Use flush to zero mode without causing exception
+//    Let [i_0 i_1] be the two lsb of N_fix.
+//
+//  FR_rsq := r * r
+//
+//  If i_1 = 0 then
+//     z := FR_rsq*FR_rsq; z := FR_rsq*z *r
+//     poly_lo := S_3 + FR_rsq*(S_4 + FR_rsq*S_5)
+//     poly_hi := r*FR_rsq*(S_1 + FR_rsq*S_2)
+//     correction := c
+//     result := r
+//  Else
+//     z := FR_rsq*FR_rsq; z := FR_rsq*z
+//     poly_lo := C_3 + FR_rsq*(C_4 + FR_rsq*C_5)
+//     poly_hi := FR_rsq*(C_1 + FR_rsq*C_2)
+//     correction := -c*r
+//     result := 1
+//  Endif
+//
+//  poly := poly_hi + (z * poly_lo + correction)
+//
+//  If i_0 = 1, result := -result
+//
+//  Last operation. Perform in user-set rounding mode
+//
+//  result := (i_0 == 0?     result + poly :
+//                          result - poly )
+//  Return
+//
+//  Step 7. Case_2_reduce.
+//
+//  ...Refer to the write up for argument reduction for
+//  ...rationale. The reduction algorithm below is taken from
+//  ...argument reduction description and integrated this.
+//
+//  w := N*P_3
+//  U_1 := N*P_2 + w        ...FMA
+//  U_2 := (N*P_2 - U_1) + w    ...2 FMA
+//  ...U_1 + U_2 is  N*(P_2+P_3) accurately
+//
+//  r := s - U_1
+//  c := ( (s - r) - U_1 ) - U_2
+//
+//  ...The mathematical sum r + c approximates the reduced
+//  ...argument accurately. Note that although compared to
+//  ...Case 1, this case requires much more work to reduce
+//  ...the argument, the subsequent calculation needed for
+//  ...any of the trigonometric function is very little because
+//  ...|alpha| < 1.01*2^(-33) and thus two terms of the
+//  ...Taylor series expansion suffices.
+//
+//  If i_1 = 0 then
+//     poly := c + S_1 * r * r * r  ...any order
+//     result := r
+//  Else
+//     poly := -2^(-67)
+//     result := 1.0
+//  Endif
+//
+//  If i_0 = 1, result := -result
+//
+//  Last operation. Perform in user-set rounding mode
+//
+//  result := (i_0 == 0?     result + poly :
+//                           result - poly )
+//
+//  Return
+//
+//
+//  Step 8. Pre-reduction of large arguments.
+//
+//  ...Again, the following reduction procedure was described
+//  ...in the separate write up for argument reduction, which
+//  ...is tightly integrated here.
+
+//  N_0 := Arg * Inv_P_0
+//  N_0_fix := fcvt.fx( N_0 )
+//  N_0 := fcvt.xf( N_0_fix)
+
+//  Arg' := Arg - N_0 * P_0
+//  w := N_0 * d_1
+//  N := Arg' * two_by_PI
+//  N_fix := fcvt.fx( N )
+//  N := fcvt.xf( N_fix )
+//  N_fix := N_fix + N_inc
+//
+//  s := Arg' - N * P_1
+//  w := w - N * P_2
+//
+//  If |s| >= 2^(-14)
+//     go to Step 3
+//  Else
+//     go to Step 9
+//  Endif
+//
+//  Step 9. Case_4_reduce.
+//
+//    ...first obtain N_0*d_1 and -N*P_2 accurately
+//   U_hi := N_0 * d_1      V_hi := -N*P_2
+//   U_lo := N_0 * d_1 - U_hi   V_lo := -N*P_2 - U_hi   ...FMAs
+//
+//   ...compute the contribution from N_0*d_1 and -N*P_3
+//   w := -N*P_3
+//   w := w + N_0*d_2
+//   t := U_lo + V_lo + w       ...any order
+//
+//   ...at this point, the mathematical value
+//   ...s + U_hi + V_hi  + t approximates the true reduced argument
+//   ...accurately. Just need to compute this accurately.
+//
+//   ...Calculate U_hi + V_hi accurately:
+//   A := U_hi + V_hi
+//   if |U_hi| >= |V_hi| then
+//      a := (U_hi - A) + V_hi
+//   else
+//      a := (V_hi - A) + U_hi
+//   endif
+//   ...order in computing "a" must be observed. This branch is
+//   ...best implemented by predicates.
+//   ...A + a  is U_hi + V_hi accurately. Moreover, "a" is
+//   ...much smaller than A: |a| <= (1/2)ulp(A).
+//
+//   ...Just need to calculate   s + A + a + t
+//   C_hi := s + A      t := t + a
+//   C_lo := (s - C_hi) + A
+//   C_lo := C_lo + t
+//
+//   ...Final steps for reduction
+//   r := C_hi + C_lo
+//   c := (C_hi - r) + C_lo
+//
+//   ...At this point, we have r and c
+//   ...And all we need is a couple of terms of the corresponding
+//   ...Taylor series.
+//
+//   If i_1 = 0
+//      poly := c + r*FR_rsq*(S_1 + FR_rsq*S_2)
+//      result := r
+//   Else
+//      poly := FR_rsq*(C_1 + FR_rsq*C_2)
+//      result := 1
+//   Endif
+//
+//   If i_0 = 1, result := -result
+//
+//   Last operation. Perform in user-set rounding mode
+//
+//   result := (i_0 == 0?     result + poly :
+//                            result - poly )
+//   Return
+//
+//   Large Arguments: For arguments above 2**63, a Payne-Hanek
+//   style argument reduction is used and pi_by_2 reduce is called.
+//
+
+
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(FSINCOS_CONSTANTS)
+
+data4 0x4B800000 // two**24
+data4 0xCB800000 // -two**24
+data4 0x00000000 // pad
+data4 0x00000000 // pad
+data8 0xA2F9836E4E44152A, 0x00003FFE // Inv_pi_by_2
+data8 0xC84D32B0CE81B9F1, 0x00004016 // P_0
+data8 0xC90FDAA22168C235, 0x00003FFF // P_1
+data8 0xECE675D1FC8F8CBB, 0x0000BFBD // P_2
+data8 0xB7ED8FBBACC19C60, 0x0000BF7C // P_3
+data4 0x5F000000 // two**63
+data4 0xDF000000 // -two**63
+data4 0x00000000 // pad
+data4 0x00000000 // pad
+data8 0xA397E5046EC6B45A, 0x00003FE7 // Inv_P_0
+data8 0x8D848E89DBD171A1, 0x0000BFBF // d_1
+data8 0xD5394C3618A66F8E, 0x0000BF7C // d_2
+data8 0xC90FDAA22168C234, 0x00003FFE // pi_by_4
+data8 0xC90FDAA22168C234, 0x0000BFFE // neg_pi_by_4
+data4 0x3E000000 // two**-3
+data4 0xBE000000 // -two**-3
+data4 0x00000000 // pad
+data4 0x00000000 // pad
+data4 0x2F000000 // two**-33
+data4 0xAF000000 // -two**-33
+data4 0x9E000000 // -two**-67
+data4 0x00000000 // pad
+data8 0xCC8ABEBCA21C0BC9, 0x00003FCE // PP_8
+data8 0xD7468A05720221DA, 0x0000BFD6 // PP_7
+data8 0xB092382F640AD517, 0x00003FDE // PP_6
+data8 0xD7322B47D1EB75A4, 0x0000BFE5 // PP_5
+data8 0xFFFFFFFFFFFFFFFE, 0x0000BFFD // C_1
+data8 0xAAAA000000000000, 0x0000BFFC // PP_1_hi
+data8 0xB8EF1D2ABAF69EEA, 0x00003FEC // PP_4
+data8 0xD00D00D00D03BB69, 0x0000BFF2 // PP_3
+data8 0x8888888888888962, 0x00003FF8 // PP_2
+data8 0xAAAAAAAAAAAB0000, 0x0000BFEC // PP_1_lo
+data8 0xD56232EFC2B0FE52, 0x00003FD2 // QQ_8
+data8 0xC9C99ABA2B48DCA6, 0x0000BFDA // QQ_7
+data8 0x8F76C6509C716658, 0x00003FE2 // QQ_6
+data8 0x93F27DBAFDA8D0FC, 0x0000BFE9 // QQ_5
+data8 0xAAAAAAAAAAAAAAAA, 0x0000BFFC // S_1
+data8 0x8000000000000000, 0x0000BFFE // QQ_1
+data8 0xD00D00D00C6E5041, 0x00003FEF // QQ_4
+data8 0xB60B60B60B607F60, 0x0000BFF5 // QQ_3
+data8 0xAAAAAAAAAAAAAA9B, 0x00003FFA // QQ_2
+data8 0xFFFFFFFFFFFFFFFE, 0x0000BFFD // C_1
+data8 0xAAAAAAAAAAAA719F, 0x00003FFA // C_2
+data8 0xB60B60B60356F994, 0x0000BFF5 // C_3
+data8 0xD00CFFD5B2385EA9, 0x00003FEF // C_4
+data8 0x93E4BD18292A14CD, 0x0000BFE9 // C_5
+data8 0xAAAAAAAAAAAAAAAA, 0x0000BFFC // S_1
+data8 0x88888888888868DB, 0x00003FF8 // S_2
+data8 0xD00D00D0055EFD4B, 0x0000BFF2 // S_3
+data8 0xB8EF1C5D839730B9, 0x00003FEC // S_4
+data8 0xD71EA3A4E5B3F492, 0x0000BFE5 // S_5
+data4 0x38800000 // two**-14
+data4 0xB8800000 // -two**-14
+LOCAL_OBJECT_END(FSINCOS_CONSTANTS)
+
+// sin and cos registers
+
+// FR
+FR_Input_X        = f8
+
+FR_r              = f8
+FR_c              = f9
+
+FR_Two_to_63      = f32
+FR_Two_to_24      = f33
+FR_Pi_by_4        = f33
+FR_Two_to_M14     = f34
+FR_Two_to_M33     = f35
+FR_Neg_Two_to_24  = f36
+FR_Neg_Pi_by_4    = f36
+FR_Neg_Two_to_M14 = f37
+FR_Neg_Two_to_M33 = f38
+FR_Neg_Two_to_M67 = f39
+FR_Inv_pi_by_2    = f40
+FR_N_float        = f41
+FR_N_fix          = f42
+FR_P_1            = f43
+FR_P_2            = f44
+FR_P_3            = f45
+FR_s              = f46
+FR_w              = f47
+FR_d_2            = f48
+FR_prelim         = f49
+FR_Z              = f50
+FR_A              = f51
+FR_a              = f52
+FR_t              = f53
+FR_U_1            = f54
+FR_U_2            = f55
+FR_C_1            = f56
+FR_C_2            = f57
+FR_C_3            = f58
+FR_C_4            = f59
+FR_C_5            = f60
+FR_S_1            = f61
+FR_S_2            = f62
+FR_S_3            = f63
+FR_S_4            = f64
+FR_S_5            = f65
+FR_poly_hi        = f66
+FR_poly_lo        = f67
+FR_r_hi           = f68
+FR_r_lo           = f69
+FR_rsq            = f70
+FR_r_cubed        = f71
+FR_C_hi           = f72
+FR_N_0            = f73
+FR_d_1            = f74
+FR_V              = f75
+FR_V_hi           = f75
+FR_V_lo           = f76
+FR_U_hi           = f77
+FR_U_lo           = f78
+FR_U_hiabs        = f79
+FR_V_hiabs        = f80
+FR_PP_8           = f81
+FR_QQ_8           = f81
+FR_PP_7           = f82
+FR_QQ_7           = f82
+FR_PP_6           = f83
+FR_QQ_6           = f83
+FR_PP_5           = f84
+FR_QQ_5           = f84
+FR_PP_4           = f85
+FR_QQ_4           = f85
+FR_PP_3           = f86
+FR_QQ_3           = f86
+FR_PP_2           = f87
+FR_QQ_2           = f87
+FR_QQ_1           = f88
+FR_N_0_fix        = f89
+FR_Inv_P_0        = f90
+FR_corr           = f91
+FR_poly           = f92
+FR_Neg_Two_to_M3  = f93
+FR_Two_to_M3      = f94
+FR_Neg_Two_to_63  = f94
+FR_P_0            = f95
+FR_C_lo           = f96
+FR_PP_1           = f97
+FR_PP_1_lo        = f98
+FR_ArgPrime       = f99
+
+// GR
+GR_Table_Base     = r32
+GR_Table_Base1    = r33
+GR_i_0            = r34
+GR_i_1            = r35
+GR_N_Inc          = r36
+GR_Sin_or_Cos     = r37
+
+GR_SAVE_B0        = r39
+GR_SAVE_GP        = r40
+GR_SAVE_PFS       = r41
+
+// sincos combined routine registers
+
+// GR
+GR_SINCOS_SAVE_PFS    = r32
+GR_SINCOS_SAVE_B0     = r33
+GR_SINCOS_SAVE_GP     = r34
+
+// FR
+FR_SINCOS_ARG         = f100
+FR_SINCOS_RES_SIN     = f101
+
+
+.section .text
+
+
+GLOBAL_LIBM_ENTRY(__libm_sincos_large)
+
+{ .mfi
+        alloc GR_SINCOS_SAVE_PFS = ar.pfs,0,3,0,0
+        fma.s1 FR_SINCOS_ARG     = f8, f1, f0  // Save argument for sin and cos
+        mov GR_SINCOS_SAVE_B0    = b0
+};;
+
+{ .mfb
+        mov GR_SINCOS_SAVE_GP    = gp
+        nop.f  0
+        br.call.sptk b0          = __libm_sin_large // Call sin
+};;
+
+{ .mfi
+        nop.m  0
+        fma.s1 FR_SINCOS_RES_SIN = f8, f1, f0 // Save sin result
+        nop.i  0
+};;
+
+{ .mfb
+        nop.m  0
+        fma.s1 f8                = FR_SINCOS_ARG, f1, f0 // Arg for cos
+        br.call.sptk b0          = __libm_cos_large // Call cos
+};;
+
+{ .mfi
+        mov    gp                = GR_SINCOS_SAVE_GP
+        fma.s1 f9                = FR_SINCOS_RES_SIN, f1, f0 // Out sin result
+        mov    b0                = GR_SINCOS_SAVE_B0
+};;
+
+{ .mib
+        nop.m  0
+        mov ar.pfs               = GR_SINCOS_SAVE_PFS
+        br.ret.sptk                b0 // sincos_large exit
+};;
+
+GLOBAL_LIBM_END(__libm_sincos_large)
+
+
+
+
+GLOBAL_LIBM_ENTRY(__libm_sin_large)
+
+{ .mlx
+alloc GR_Table_Base = ar.pfs,0,12,2,0
+       movl GR_Sin_or_Cos = 0x0 ;;
+}
+
+{ .mmi
+      nop.m 999
+      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ld8 GR_Table_Base = [GR_Table_Base]
+      nop.m 999
+      nop.i 999
+}
+;;
+
+
+{ .mib
+      nop.m 999
+      nop.i 999
+       br.cond.sptk SINCOS_CONTINUE ;;
+}
+
+GLOBAL_LIBM_END(__libm_sin_large)
+
+GLOBAL_LIBM_ENTRY(__libm_cos_large)
+
+{ .mlx
+alloc GR_Table_Base= ar.pfs,0,12,2,0
+       movl GR_Sin_or_Cos = 0x1 ;;
+}
+
+{ .mmi
+      nop.m 999
+      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ld8 GR_Table_Base = [GR_Table_Base]
+      nop.m 999
+      nop.i 999
+}
+;;
+
+//
+//     Load Table Address
+//
+SINCOS_CONTINUE:
+
+{ .mmi
+       add GR_Table_Base1 = 96, GR_Table_Base
+       ldfs FR_Two_to_24 = [GR_Table_Base], 4
+       nop.i 999
+}
+;;
+
+{ .mmi
+      nop.m 999
+//
+//     Load 2**24, load 2**63.
+//
+       ldfs FR_Neg_Two_to_24 = [GR_Table_Base], 12
+       mov   r41 = ar.pfs ;;
+}
+
+{ .mfi
+       ldfs FR_Two_to_63 = [GR_Table_Base1], 4
+//
+//     Check for unnormals - unsupported operands. We do not want
+//     to generate denormal exception
+//     Check for NatVals, QNaNs, SNaNs, +/-Infs
+//     Check for EM unsupporteds
+//     Check for Zero
+//
+       fclass.m.unc  p6, p8 =  FR_Input_X, 0x1E3
+       mov   r40 = gp ;;
+}
+
+{ .mfi
+      nop.m 999
+       fclass.nm.unc p8, p0 =  FR_Input_X, 0x1FF
+// GR_Sin_or_Cos denotes
+       mov   r39 = b0
+}
+
+{ .mfb
+       ldfs FR_Neg_Two_to_63 = [GR_Table_Base1], 12
+       fclass.m.unc p10, p0 = FR_Input_X, 0x007
+(p6)   br.cond.spnt SINCOS_SPECIAL ;;
+}
+
+{ .mib
+      nop.m 999
+      nop.i 999
+(p8)   br.cond.spnt SINCOS_SPECIAL ;;
+}
+
+{ .mib
+      nop.m 999
+      nop.i 999
+//
+//     Branch if +/- NaN, Inf.
+//     Load -2**24, load -2**63.
+//
+(p10)  br.cond.spnt SINCOS_ZERO ;;
+}
+
+{ .mmb
+       ldfe FR_Inv_pi_by_2 = [GR_Table_Base], 16
+       ldfe FR_Inv_P_0 = [GR_Table_Base1], 16
+      nop.b 999 ;;
+}
+
+{ .mmb
+      nop.m 999
+       ldfe     FR_d_1 = [GR_Table_Base1], 16
+      nop.b 999 ;;
+}
+//
+//     Raise possible denormal operand flag with useful fcmp
+//     Is x <= -2**63
+//     Load Inv_P_0 for pre-reduction
+//     Load Inv_pi_by_2
+//
+
+{ .mmb
+       ldfe     FR_P_0 = [GR_Table_Base], 16
+       ldfe FR_d_2 = [GR_Table_Base1], 16
+      nop.b 999 ;;
+}
+//
+//     Load P_0
+//     Load d_1
+//     Is x >= 2**63
+//     Is x <= -2**24?
+//
+
+{ .mmi
+       ldfe FR_P_1 = [GR_Table_Base], 16 ;;
+//
+//     Load P_1
+//     Load d_2
+//     Is x >= 2**24?
+//
+       ldfe FR_P_2 = [GR_Table_Base], 16
+      nop.i 999 ;;
+}
+
+{ .mmf
+      nop.m 999
+       ldfe FR_P_3 = [GR_Table_Base], 16
+       fcmp.le.unc.s1   p7, p8 = FR_Input_X, FR_Neg_Two_to_24
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Branch if +/- zero.
+//     Decide about the paths to take:
+//     If -2**24 < FR_Input_X < 2**24 - CASE 1 OR 2
+//     OTHERWISE - CASE 3 OR 4
+//
+       fcmp.le.unc.s1   p10, p11 = FR_Input_X, FR_Neg_Two_to_63
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p8)   fcmp.ge.s1 p7, p0 = FR_Input_X, FR_Two_to_24
+      nop.i 999
+}
+
+{ .mfi
+       ldfe FR_Pi_by_4 = [GR_Table_Base1], 16
+(p11)  fcmp.ge.s1   p10, p0 = FR_Input_X, FR_Two_to_63
+      nop.i 999 ;;
+}
+
+{ .mmi
+       ldfe FR_Neg_Pi_by_4 = [GR_Table_Base1], 16 ;;
+       ldfs FR_Two_to_M3 = [GR_Table_Base1], 4
+      nop.i 999 ;;
+}
+
+{ .mib
+       ldfs FR_Neg_Two_to_M3 = [GR_Table_Base1], 12
+      nop.i 999
+//
+//     Load P_2
+//     Load P_3
+//     Load pi_by_4
+//     Load neg_pi_by_4
+//     Load 2**(-3)
+//     Load -2**(-3).
+//
+(p10)  br.cond.spnt SINCOS_ARG_TOO_LARGE ;;
+}
+
+{ .mib
+      nop.m 999
+      nop.i 999
+//
+//     Branch out if x >= 2**63. Use Payne-Hanek Reduction
+//
+(p7)   br.cond.spnt SINCOS_LARGER_ARG ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Branch if Arg <= -2**24 or Arg >= 2**24 and use pre-reduction.
+//
+       fma.s1   FR_N_float = FR_Input_X, FR_Inv_pi_by_2, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+       fcmp.lt.unc.s1   p6, p7 = FR_Input_X, FR_Pi_by_4
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Select the case when |Arg| < pi/4
+//     Else Select the case when |Arg| >= pi/4
+//
+       fcvt.fx.s1 FR_N_fix = FR_N_float
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     N  = Arg * 2/pi
+//     Check if Arg < pi/4
+//
+(p6)   fcmp.gt.s1 p6, p7 = FR_Input_X, FR_Neg_Pi_by_4
+      nop.i 999 ;;
+}
+//
+//     Case 2: Convert integer N_fix back to normalized floating-point value.
+//     Case 1: p8 is only affected  when p6 is set
+//
+
+{ .mfi
+(p7)   ldfs FR_Two_to_M33 = [GR_Table_Base1], 4
+//
+//     Grab the integer part of N and call it N_fix
+//
+(p6)   fmerge.se FR_r = FR_Input_X, FR_Input_X
+//     If |x| < pi/4, r = x and c = 0
+//     lf |x| < pi/4, is x < 2**(-3).
+//     r = Arg
+//     c = 0
+(p6)   mov GR_N_Inc = GR_Sin_or_Cos ;;
+}
+
+{ .mmf
+      nop.m 999
+(p7)   ldfs FR_Neg_Two_to_M33 = [GR_Table_Base1], 4
+(p6)   fmerge.se FR_c = f0, f0
+}
+
+{ .mfi
+      nop.m 999
+(p6)   fcmp.lt.unc.s1   p8, p9 = FR_Input_X, FR_Two_to_M3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     lf |x| < pi/4, is -2**(-3)< x < 2**(-3) - set p8.
+//     If |x| >= pi/4,
+//     Create the right N for |x| < pi/4 and otherwise
+//     Case 2: Place integer part of N in GP register
+//
+(p7)   fcvt.xf FR_N_float = FR_N_fix
+      nop.i 999 ;;
+}
+
+{ .mmf
+      nop.m 999
+(p7)   getf.sig GR_N_Inc = FR_N_fix
+(p8)   fcmp.gt.s1 p8, p0 = FR_Input_X, FR_Neg_Two_to_M3 ;;
+}
+
+{ .mib
+      nop.m 999
+      nop.i 999
+//
+//     Load 2**(-33), -2**(-33)
+//
+(p8)   br.cond.spnt SINCOS_SMALL_R ;;
+}
+
+{ .mib
+      nop.m 999
+      nop.i 999
+(p6)   br.cond.sptk SINCOS_NORMAL_R ;;
+}
+//
+//     if |x| < pi/4, branch based on |x| < 2**(-3) or otherwise.
+//
+//
+//     In this branch, |x| >= pi/4.
+//
+
+{ .mfi
+       ldfs FR_Neg_Two_to_M67 = [GR_Table_Base1], 8
+//
+//     Load -2**(-67)
+//
+       fnma.s1  FR_s = FR_N_float, FR_P_1, FR_Input_X
+//
+//     w = N * P_2
+//     s = -N * P_1  + Arg
+//
+       add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos
+}
+
+{ .mfi
+      nop.m 999
+       fma.s1   FR_w = FR_N_float, FR_P_2, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Adjust N_fix by N_inc to determine whether sine or
+//     cosine is being calculated
+//
+       fcmp.lt.unc.s1 p7, p6 = FR_s, FR_Two_to_M33
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fcmp.gt.s1 p7, p6 = FR_s, FR_Neg_Two_to_M33
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//     Remember x >= pi/4.
+//     Is s <= -2**(-33) or s >= 2**(-33) (p6)
+//     or -2**(-33) < s < 2**(-33) (p7)
+(p6)   fms.s1 FR_r = FR_s, f1, FR_w
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fma.s1 FR_w = FR_N_float, FR_P_3, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fma.s1 FR_U_1 = FR_N_float, FR_P_2, FR_w
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p6)   fms.s1 FR_c = FR_s, f1, FR_r
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     For big s: r = s - w: No futher reduction is necessary
+//     For small s: w = N * P_3 (change sign) More reduction
+//
+(p6)   fcmp.lt.unc.s1 p8, p9 = FR_r, FR_Two_to_M3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p8)   fcmp.gt.s1 p8, p9 = FR_r, FR_Neg_Two_to_M3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fms.s1 FR_r = FR_s, f1, FR_U_1
+      nop.i 999
+}
+
+{ .mfb
+      nop.m 999
+//
+//     For big s: Is |r| < 2**(-3)?
+//     For big s: c = S - r
+//     For small s: U_1 = N * P_2 + w
+//
+//     If p8 is set, prepare to branch to Small_R.
+//     If p9 is set, prepare to branch to Normal_R.
+//     For big s,  r is complete here.
+//
+(p6)   fms.s1 FR_c = FR_c, f1, FR_w
+//
+//     For big s: c = c + w (w has not been negated.)
+//     For small s: r = S - U_1
+//
+(p8)   br.cond.spnt SINCOS_SMALL_R ;;
+}
+
+{ .mib
+      nop.m 999
+      nop.i 999
+(p9)   br.cond.sptk SINCOS_NORMAL_R ;;
+}
+
+{ .mfi
+(p7)   add GR_Table_Base1 = 224, GR_Table_Base1
+//
+//     Branch to SINCOS_SMALL_R or SINCOS_NORMAL_R
+//
+(p7)   fms.s1 FR_U_2 = FR_N_float, FR_P_2, FR_U_1
+//
+//     c = S - U_1
+//     r = S_1 * r
+//
+//
+(p7)   extr.u   GR_i_1 = GR_N_Inc, 0, 1
+}
+
+{ .mmi
+      nop.m 999 ;;
+//
+//     Get [i_0,i_1] - two lsb of N_fix_gr.
+//     Do dummy fmpy so inexact is always set.
+//
+(p7)   cmp.eq.unc p9, p10 = 0x0, GR_i_1
+(p7)   extr.u   GR_i_0 = GR_N_Inc, 1, 1 ;;
+}
+//
+//     For small s: U_2 = N * P_2 - U_1
+//     S_1 stored constant - grab the one stored with the
+//     coefficients.
+//
+
+{ .mfi
+(p7)   ldfe FR_S_1 = [GR_Table_Base1], 16
+//
+//     Check if i_1 and i_0  != 0
+//
+(p10)  fma.s1   FR_poly = f0, f1, FR_Neg_Two_to_M67
+(p7)   cmp.eq.unc p11, p12 = 0x0, GR_i_0 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fms.s1   FR_s = FR_s, f1, FR_r
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//     S = S - r
+//     U_2 = U_2 + w
+//     load S_1
+//
+(p7)   fma.s1   FR_rsq = FR_r, FR_r, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fma.s1   FR_U_2 = FR_U_2, f1, FR_w
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//(p7)   fmerge.se FR_Input_X = FR_r, FR_r
+(p7)   fmerge.se FR_prelim = FR_r, FR_r
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//(p10)  fma.s1 FR_Input_X = f0, f1, f1
+(p10)  fma.s1 FR_prelim = f0, f1, f1
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     FR_rsq = r * r
+//     Save r as the result.
+//
+(p7)   fms.s1   FR_c = FR_s, f1, FR_U_1
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     if ( i_1 ==0) poly = c + S_1*r*r*r
+//     else Result = 1
+//
+//(p12)  fnma.s1 FR_Input_X = FR_Input_X, f1, f0
+(p12)  fnma.s1 FR_prelim = FR_prelim, f1, f0
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fma.s1   FR_r = FR_S_1, FR_r, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p7)   fma.d.s1 FR_S_1 = FR_S_1, FR_S_1, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     If i_1 != 0, poly = 2**(-67)
+//
+(p7)   fms.s1 FR_c = FR_c, f1, FR_U_2
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     c = c - U_2
+//
+(p9)   fma.s1 FR_poly = FR_r, FR_rsq, FR_c
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     i_0 != 0, so Result = -Result
+//
+(p11)  fma.s1 FR_Input_X = FR_prelim, f1, FR_poly
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+(p12)  fms.s1 FR_Input_X = FR_prelim, f1, FR_poly
+//
+//     if (i_0 == 0),  Result = Result + poly
+//     else            Result = Result - poly
+//
+       br.ret.sptk   b0 ;;
+}
+SINCOS_LARGER_ARG:
+
+{ .mfi
+      nop.m 999
+       fma.s1 FR_N_0 = FR_Input_X, FR_Inv_P_0, f0
+      nop.i 999
+}
+;;
+
+//     This path for argument > 2*24
+//     Adjust table_ptr1 to beginning of table.
+//
+
+{ .mmi
+      nop.m 999
+      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ld8 GR_Table_Base = [GR_Table_Base]
+      nop.m 999
+      nop.i 999
+}
+;;
+
+
+//
+//     Point to  2*-14
+//     N_0 = Arg * Inv_P_0
+//
+
+{ .mmi
+       add GR_Table_Base = 688, GR_Table_Base ;;
+       ldfs FR_Two_to_M14 = [GR_Table_Base], 4
+      nop.i 999 ;;
+}
+
+{ .mfi
+       ldfs FR_Neg_Two_to_M14 = [GR_Table_Base], 0
+      nop.f 999
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Load values 2**(-14) and -2**(-14)
+//
+       fcvt.fx.s1 FR_N_0_fix = FR_N_0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     N_0_fix  = integer part of N_0
+//
+       fcvt.xf FR_N_0 = FR_N_0_fix
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Make N_0 the integer part
+//
+       fnma.s1 FR_ArgPrime = FR_N_0, FR_P_0, FR_Input_X
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+       fma.s1 FR_w = FR_N_0, FR_d_1, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Arg' = -N_0 * P_0 + Arg
+//     w  = N_0 * d_1
+//
+       fma.s1 FR_N_float = FR_ArgPrime, FR_Inv_pi_by_2, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     N = A' * 2/pi
+//
+       fcvt.fx.s1 FR_N_fix = FR_N_float
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     N_fix is the integer part
+//
+       fcvt.xf FR_N_float = FR_N_fix
+      nop.i 999 ;;
+}
+
+{ .mfi
+       getf.sig GR_N_Inc = FR_N_fix
+      nop.f 999
+      nop.i 999 ;;
+}
+
+{ .mii
+      nop.m 999
+      nop.i 999 ;;
+       add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     N is the integer part of the reduced-reduced argument.
+//     Put the integer in a GP register
+//
+       fnma.s1 FR_s = FR_N_float, FR_P_1, FR_ArgPrime
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+       fnma.s1 FR_w = FR_N_float, FR_P_2, FR_w
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     s = -N*P_1 + Arg'
+//     w = -N*P_2 + w
+//     N_fix_gr = N_fix_gr + N_inc
+//
+       fcmp.lt.unc.s1 p9, p8 = FR_s, FR_Two_to_M14
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)   fcmp.gt.s1 p9, p8 = FR_s, FR_Neg_Two_to_M14
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     For |s|  > 2**(-14) r = S + w (r complete)
+//     Else       U_hi = N_0 * d_1
+//
+(p9)   fma.s1 FR_V_hi = FR_N_float, FR_P_2, f0
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p9)   fma.s1 FR_U_hi = FR_N_0, FR_d_1, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Either S <= -2**(-14) or S >= 2**(-14)
+//     or -2**(-14) < s < 2**(-14)
+//
+(p8)   fma.s1 FR_r = FR_s, f1, FR_w
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p9)   fma.s1 FR_w = FR_N_float, FR_P_3, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     We need abs of both U_hi and V_hi - don't
+//     worry about switched sign of V_hi.
+//
+(p9)   fms.s1 FR_A = FR_U_hi, f1, FR_V_hi
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Big s: finish up c = (S - r) + w (c complete)
+//     Case 4: A =  U_hi + V_hi
+//     Note: Worry about switched sign of V_hi, so subtract instead of add.
+//
+(p9)   fnma.s1 FR_V_lo = FR_N_float, FR_P_2, FR_V_hi
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)   fms.s1 FR_U_lo = FR_N_0, FR_d_1, FR_U_hi
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)   fmerge.s FR_V_hiabs = f0, FR_V_hi
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//     For big s: c = S - r
+//     For small s do more work: U_lo = N_0 * d_1 - U_hi
+//
+(p9)   fmerge.s FR_U_hiabs = f0, FR_U_hi
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     For big s: Is |r| < 2**(-3)
+//     For big s: if p12 set, prepare to branch to Small_R.
+//     For big s: If p13 set, prepare to branch to Normal_R.
+//
+(p8)   fms.s1 FR_c = FR_s, f1, FR_r
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//     For small S: V_hi = N * P_2
+//                  w = N * P_3
+//     Note the product does not include the (-) as in the writeup
+//     so (-) missing for V_hi and w.
+//
+(p8)   fcmp.lt.unc.s1 p12, p13 = FR_r, FR_Two_to_M3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p12)  fcmp.gt.s1 p12, p13 = FR_r, FR_Neg_Two_to_M3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p8)   fma.s1 FR_c = FR_c, f1, FR_w
+      nop.i 999
+}
+
+{ .mfb
+      nop.m 999
+(p9)   fms.s1 FR_w = FR_N_0, FR_d_2, FR_w
+(p12)  br.cond.spnt SINCOS_SMALL_R ;;
+}
+
+{ .mib
+      nop.m 999
+      nop.i 999
+(p13)  br.cond.sptk SINCOS_NORMAL_R ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Big s: Vector off when |r| < 2**(-3).  Recall that p8 will be true.
+//     The remaining stuff is for Case 4.
+//     Small s: V_lo = N * P_2 + U_hi (U_hi is in place of V_hi in writeup)
+//     Note: the (-) is still missing for V_lo.
+//     Small s: w = w + N_0 * d_2
+//     Note: the (-) is now incorporated in w.
+//
+(p9)   fcmp.ge.unc.s1 p10, p11 = FR_U_hiabs, FR_V_hiabs
+       extr.u   GR_i_1 = GR_N_Inc, 0, 1 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     C_hi = S + A
+//
+(p9)   fma.s1 FR_t = FR_U_lo, f1, FR_V_lo
+       extr.u   GR_i_0 = GR_N_Inc, 1, 1 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     t = U_lo + V_lo
+//
+//
+(p10)  fms.s1 FR_a = FR_U_hi, f1, FR_A
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p11)  fma.s1 FR_a = FR_V_hi, f1, FR_A
+      nop.i 999
+}
+;;
+
+{ .mmi
+      nop.m 999
+      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ld8 GR_Table_Base = [GR_Table_Base]
+      nop.m 999
+      nop.i 999
+}
+;;
+
+
+{ .mfi
+       add GR_Table_Base = 528, GR_Table_Base
+//
+//     Is U_hiabs >= V_hiabs?
+//
+(p9)   fma.s1 FR_C_hi = FR_s, f1, FR_A
+      nop.i 999 ;;
+}
+
+{ .mmi
+       ldfe FR_C_1 = [GR_Table_Base], 16 ;;
+       ldfe FR_C_2 = [GR_Table_Base], 64
+      nop.i 999 ;;
+}
+
+{ .mmf
+      nop.m 999
+//
+//     c = c + C_lo  finished.
+//     Load  C_2
+//
+       ldfe FR_S_1 = [GR_Table_Base], 16
+//
+//     C_lo = S - C_hi
+//
+       fma.s1 FR_t = FR_t, f1, FR_w ;;
+}
+//
+//     r and c have been computed.
+//     Make sure ftz mode is set - should be automatic when using wre
+//     |r| < 2**(-3)
+//     Get [i_0,i_1] - two lsb of N_fix.
+//     Load S_1
+//
+
+{ .mfi
+       ldfe FR_S_2 = [GR_Table_Base], 64
+//
+//     t = t + w
+//
+(p10)  fms.s1 FR_a = FR_a, f1, FR_V_hi
+       cmp.eq.unc p9, p10 = 0x0, GR_i_0
+}
+
+{ .mfi
+      nop.m 999
+//
+//     For larger u than v: a = U_hi - A
+//     Else a = V_hi - A (do an add to account for missing (-) on V_hi
+//
+       fms.s1 FR_C_lo = FR_s, f1, FR_C_hi
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p11)  fms.s1 FR_a = FR_U_hi, f1, FR_a
+       cmp.eq.unc p11, p12 = 0x0, GR_i_1
+}
+
+{ .mfi
+      nop.m 999
+//
+//     If u > v: a = (U_hi - A)  + V_hi
+//     Else      a = (V_hi - A)  + U_hi
+//     In each case account for negative missing from V_hi.
+//
+       fma.s1 FR_C_lo = FR_C_lo, f1, FR_A
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     C_lo = (S - C_hi) + A
+//
+       fma.s1 FR_t = FR_t, f1, FR_a
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     t = t + a
+//
+       fma.s1 FR_C_lo = FR_C_lo, f1, FR_t
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     C_lo = C_lo + t
+//     Adjust Table_Base to beginning of table
+//
+       fma.s1 FR_r = FR_C_hi, f1, FR_C_lo
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Load S_2
+//
+       fma.s1 FR_rsq = FR_r, FR_r, f0
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Table_Base points to C_1
+//     r = C_hi + C_lo
+//
+       fms.s1 FR_c = FR_C_hi, f1, FR_r
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     if i_1 ==0: poly = S_2 * FR_rsq + S_1
+//     else        poly = C_2 * FR_rsq + C_1
+//
+//(p11)  fma.s1 FR_Input_X = f0, f1, FR_r
+(p11)  fma.s1 FR_prelim = f0, f1, FR_r
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//(p12)  fma.s1 FR_Input_X = f0, f1, f1
+(p12)  fma.s1 FR_prelim = f0, f1, f1
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Compute r_cube = FR_rsq * r
+//
+(p11)  fma.s1 FR_poly = FR_rsq, FR_S_2, FR_S_1
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p12)  fma.s1 FR_poly = FR_rsq, FR_C_2, FR_C_1
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//     Compute FR_rsq = r * r
+//     Is i_1 == 0 ?
+//
+       fma.s1 FR_r_cubed = FR_rsq, FR_r, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     c = C_hi - r
+//     Load  C_1
+//
+       fma.s1 FR_c = FR_c, f1, FR_C_lo
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//     if i_1 ==0: poly = r_cube * poly + c
+//     else        poly = FR_rsq * poly
+//
+//(p10)  fms.s1 FR_Input_X = f0, f1, FR_Input_X
+(p10)  fms.s1 FR_prelim = f0, f1, FR_prelim
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     if i_1 ==0: Result = r
+//     else        Result = 1.0
+//
+(p11)  fma.s1 FR_poly = FR_r_cubed, FR_poly, FR_c
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p12)  fma.s1 FR_poly = FR_rsq, FR_poly, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//     if i_0 !=0: Result = -Result
+//
+(p9)   fma.s1 FR_Input_X = FR_prelim, f1, FR_poly
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+(p10)  fms.s1 FR_Input_X = FR_prelim, f1, FR_poly
+//
+//     if i_0 == 0: Result = Result + poly
+//     else         Result = Result - poly
+//
+       br.ret.sptk   b0 ;;
+}
+SINCOS_SMALL_R:
+
+{ .mii
+      nop.m 999
+        extr.u  GR_i_1 = GR_N_Inc, 0, 1 ;;
+//
+//
+//      Compare both i_1 and i_0 with 0.
+//      if i_1 == 0, set p9.
+//      if i_0 == 0, set p11.
+//
+        cmp.eq.unc p9, p10 = 0x0, GR_i_1 ;;
+}
+
+{ .mfi
+      nop.m 999
+        fma.s1 FR_rsq = FR_r, FR_r, f0
+        extr.u  GR_i_0 = GR_N_Inc, 1, 1 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//  Z = Z * FR_rsq
+//
+(p10)   fnma.s1 FR_c = FR_c, FR_r, f0
+        cmp.eq.unc p11, p12 = 0x0, GR_i_0
+}
+;;
+
+// ******************************************************************
+// ******************************************************************
+// ******************************************************************
+//      r and c have been computed.
+//      We know whether this is the sine or cosine routine.
+//      Make sure ftz mode is set - should be automatic when using wre
+//      |r| < 2**(-3)
+//
+//      Set table_ptr1 to beginning of constant table.
+//      Get [i_0,i_1] - two lsb of N_fix_gr.
+//
+
+{ .mmi
+      nop.m 999
+      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ld8 GR_Table_Base = [GR_Table_Base]
+      nop.m 999
+      nop.i 999
+}
+;;
+
+
+//
+//      Set table_ptr1 to point to S_5.
+//      Set table_ptr1 to point to C_5.
+//      Compute FR_rsq = r * r
+//
+
+{ .mfi
+(p9)    add GR_Table_Base = 672, GR_Table_Base
+(p10)   fmerge.s FR_r = f1, f1
+(p10)   add GR_Table_Base = 592, GR_Table_Base ;;
+}
+//
+//      Set table_ptr1 to point to S_5.
+//      Set table_ptr1 to point to C_5.
+//
+
+{ .mmi
+(p9)    ldfe FR_S_5 = [GR_Table_Base], -16 ;;
+//
+//      if (i_1 == 0) load S_5
+//      if (i_1 != 0) load C_5
+//
+(p9)    ldfe FR_S_4 = [GR_Table_Base], -16
+      nop.i 999 ;;
+}
+
+{ .mmf
+(p10)   ldfe FR_C_5 = [GR_Table_Base], -16
+//
+//      Z = FR_rsq * FR_rsq
+//
+(p9)    ldfe FR_S_3 = [GR_Table_Base], -16
+//
+//      Compute FR_rsq = r * r
+//      if (i_1 == 0) load S_4
+//      if (i_1 != 0) load C_4
+//
+        fma.s1 FR_Z = FR_rsq, FR_rsq, f0 ;;
+}
+//
+//      if (i_1 == 0) load S_3
+//      if (i_1 != 0) load C_3
+//
+
+{ .mmi
+(p9)    ldfe FR_S_2 = [GR_Table_Base], -16 ;;
+//
+//      if (i_1 == 0) load S_2
+//      if (i_1 != 0) load C_2
+//
+(p9)    ldfe FR_S_1 = [GR_Table_Base], -16
+      nop.i 999
+}
+
+{ .mmi
+(p10)   ldfe FR_C_4 = [GR_Table_Base], -16 ;;
+(p10)   ldfe FR_C_3 = [GR_Table_Base], -16
+      nop.i 999 ;;
+}
+
+{ .mmi
+(p10)   ldfe FR_C_2 = [GR_Table_Base], -16 ;;
+(p10)   ldfe FR_C_1 = [GR_Table_Base], -16
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1 != 0):
+//      poly_lo = FR_rsq * C_5 + C_4
+//      poly_hi = FR_rsq * C_2 + C_1
+//
+(p9)    fma.s1 FR_Z = FR_Z, FR_r, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1 == 0) load S_1
+//      if (i_1 != 0) load C_1
+//
+(p9)    fma.s1 FR_poly_lo = FR_rsq, FR_S_5, FR_S_4
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//      c = -c * r
+//      dummy fmpy's to flag inexact.
+//
+(p9)    fma.d.s1 FR_S_4 = FR_S_4, FR_S_4, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      poly_lo = FR_rsq * poly_lo + C_3
+//      poly_hi = FR_rsq * poly_hi
+//
+        fma.s1  FR_Z = FR_Z, FR_rsq, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)    fma.s1 FR_poly_hi = FR_rsq, FR_S_2, FR_S_1
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1 == 0):
+//      poly_lo = FR_rsq * S_5 + S_4
+//      poly_hi = FR_rsq * S_2 + S_1
+//
+(p10)   fma.s1 FR_poly_lo = FR_rsq, FR_C_5, FR_C_4
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1 == 0):
+//      Z = Z * r  for only one of the small r cases - not there
+//      in original implementation notes.
+//
+(p9)    fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_S_3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly_hi = FR_rsq, FR_C_2, FR_C_1
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.d.s1 FR_C_1 = FR_C_1, FR_C_1, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)    fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//      poly_lo = FR_rsq * poly_lo + S_3
+//      poly_hi = FR_rsq * poly_hi
+//
+(p10)   fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_C_3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//  if (i_1 == 0): dummy fmpy's to flag inexact
+//  r = 1
+//
+(p9)    fma.s1 FR_poly_hi = FR_r, FR_poly_hi, f0
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//  poly_hi = r * poly_hi
+//
+        fma.s1  FR_poly = FR_Z, FR_poly_lo, FR_c
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p12)   fms.s1  FR_r = f0, f1, FR_r
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      poly_hi = Z * poly_lo + c
+//  if i_0 == 1: r = -r
+//
+        fma.s1  FR_poly = FR_poly, f1, FR_poly_hi
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p12)   fms.s1 FR_Input_X = FR_r, f1, FR_poly
+      nop.i 999
+}
+
+{ .mfb
+      nop.m 999
+//
+//      poly = poly + poly_hi
+//
+(p11)   fma.s1 FR_Input_X = FR_r, f1, FR_poly
+//
+//      if (i_0 == 0) Result = r + poly
+//      if (i_0 != 0) Result = r - poly
+//
+       br.ret.sptk   b0 ;;
+}
+SINCOS_NORMAL_R:
+
+{ .mii
+      nop.m 999
+        extr.u  GR_i_1 = GR_N_Inc, 0, 1 ;;
+//
+//      Set table_ptr1 and table_ptr2 to base address of
+//      constant table.
+        cmp.eq.unc p9, p10 = 0x0, GR_i_1 ;;
+}
+
+{ .mfi
+      nop.m 999
+        fma.s1  FR_rsq = FR_r, FR_r, f0
+        extr.u  GR_i_0 = GR_N_Inc, 1, 1 ;;
+}
+
+{ .mfi
+      nop.m 999
+        frcpa.s1 FR_r_hi, p6 = f1, FR_r
+        cmp.eq.unc p11, p12 = 0x0, GR_i_0
+}
+;;
+
+// ******************************************************************
+// ******************************************************************
+// ******************************************************************
+//
+//      r and c have been computed.
+//      We known whether this is the sine or cosine routine.
+//      Make sure ftz mode is set - should be automatic when using wre
+//      Get [i_0,i_1] - two lsb of N_fix_gr alone.
+//
+
+{ .mmi
+      nop.m 999
+      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ld8 GR_Table_Base = [GR_Table_Base]
+      nop.m 999
+      nop.i 999
+}
+;;
+
+
+{ .mfi
+(p10)   add GR_Table_Base = 384, GR_Table_Base
+//(p12)   fms.s1 FR_Input_X = f0, f1, f1
+(p12)   fms.s1 FR_prelim = f0, f1, f1
+(p9)    add GR_Table_Base = 224, GR_Table_Base ;;
+}
+
+{ .mmf
+      nop.m 999
+(p10)   ldfe FR_QQ_8 = [GR_Table_Base], 16
+//
+//      if (i_1==0) poly = poly * FR_rsq + PP_1_lo
+//      else        poly = FR_rsq * poly
+//
+//(p11)   fma.s1 FR_Input_X = f0, f1, f1 ;;
+(p11)   fma.s1 FR_prelim = f0, f1, f1 ;;
+}
+
+{ .mmf
+(p10)   ldfe FR_QQ_7 = [GR_Table_Base], 16
+//
+//  Adjust table pointers based on i_0
+//      Compute rsq = r * r
+//
+(p9)    ldfe FR_PP_8 = [GR_Table_Base], 16
+        fma.s1 FR_r_cubed = FR_r, FR_rsq, f0 ;;
+}
+
+{ .mmf
+(p9)    ldfe FR_PP_7 = [GR_Table_Base], 16
+(p10)   ldfe FR_QQ_6 = [GR_Table_Base], 16
+//
+//      Load PP_8 and QQ_8; PP_7 and QQ_7
+//
+        frcpa.s1 FR_r_hi, p6 = f1, FR_r_hi ;;
+}
+//
+//      if (i_1==0) poly =   PP_7 + FR_rsq * PP_8.
+//      else        poly =   QQ_7 + FR_rsq * QQ_8.
+//
+
+{ .mmb
+(p9)    ldfe FR_PP_6 = [GR_Table_Base], 16
+(p10)   ldfe FR_QQ_5 = [GR_Table_Base], 16
+      nop.b 999 ;;
+}
+
+{ .mmb
+(p9)    ldfe FR_PP_5 = [GR_Table_Base], 16
+(p10)   ldfe FR_S_1 = [GR_Table_Base], 16
+      nop.b 999 ;;
+}
+
+{ .mmb
+(p10)   ldfe FR_QQ_1 = [GR_Table_Base], 16
+(p9)    ldfe FR_C_1 = [GR_Table_Base], 16
+      nop.b 999 ;;
+}
+
+{ .mmi
+(p10)   ldfe FR_QQ_4 = [GR_Table_Base], 16 ;;
+(p9)    ldfe FR_PP_1 = [GR_Table_Base], 16
+      nop.i 999 ;;
+}
+
+{ .mmf
+(p10)   ldfe FR_QQ_3 = [GR_Table_Base], 16
+//
+//      if (i_1=0) corr = corr + c*c
+//      else       corr = corr * c
+//
+(p9)    ldfe FR_PP_4 = [GR_Table_Base], 16
+(p10)   fma.s1 FR_poly = FR_rsq, FR_QQ_8, FR_QQ_7 ;;
+}
+//
+//      if (i_1=0) poly = rsq * poly + PP_5
+//      else       poly = rsq * poly + QQ_5
+//      Load PP_4 or QQ_4
+//
+
+{ .mmf
+(p9)    ldfe FR_PP_3 = [GR_Table_Base], 16
+(p10)   ldfe FR_QQ_2 = [GR_Table_Base], 16
+//
+//      r_hi =   frcpa(frcpa(r)).
+//      r_cube = r * FR_rsq.
+//
+(p9)    fma.s1 FR_poly = FR_rsq, FR_PP_8, FR_PP_7 ;;
+}
+//
+//      Do dummy multiplies so inexact is always set.
+//
+
+{ .mfi
+(p9)    ldfe FR_PP_2 = [GR_Table_Base], 16
+//
+//      r_lo = r - r_hi
+//
+(p9)    fma.s1 FR_U_lo = FR_r_hi, FR_r_hi, f0
+      nop.i 999 ;;
+}
+
+{ .mmf
+      nop.m 999
+(p9)    ldfe FR_PP_1_lo = [GR_Table_Base], 16
+(p10)   fma.s1 FR_corr = FR_S_1, FR_r_cubed, FR_r
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_6
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1=0) U_lo = r_hi * r_hi
+//      else       U_lo = r_hi + r
+//
+(p9)    fma.s1 FR_corr = FR_C_1, FR_rsq, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1=0) corr = C_1 * rsq
+//      else       corr = S_1 * r_cubed + r
+//
+(p9)    fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_6
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_U_lo = FR_r_hi, f1, FR_r
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1=0) U_hi = r_hi + U_hi
+//      else       U_hi = QQ_1 * U_hi + 1
+//
+(p9)    fma.s1 FR_U_lo = FR_r, FR_r_hi, FR_U_lo
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//      U_hi = r_hi * r_hi
+//
+        fms.s1 FR_r_lo = FR_r, f1, FR_r_hi
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      Load PP_1, PP_6, PP_5, and C_1
+//      Load QQ_1, QQ_6, QQ_5, and S_1
+//
+        fma.s1 FR_U_hi = FR_r_hi, FR_r_hi, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_5
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fnma.s1 FR_corr = FR_corr, FR_c, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1=0) U_lo = r * r_hi + U_lo
+//      else       U_lo = r_lo * U_lo
+//
+(p9)    fma.s1 FR_corr = FR_corr, FR_c, FR_c
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)    fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_5
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1 =0) U_hi = r + U_hi
+//      if (i_1 =0) U_lo = r_lo * U_lo
+//
+//
+(p9)    fma.d.s1 FR_PP_5 = FR_PP_5, FR_PP_4, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)    fma.s1 FR_U_lo = FR_r, FR_r, FR_U_lo
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1=0) poly = poly * rsq + PP_6
+//      else       poly = poly * rsq + QQ_6
+//
+(p9)    fma.s1 FR_U_hi = FR_r_hi, FR_U_hi, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_4
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_U_hi = FR_QQ_1, FR_U_hi, f1
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.d.s1 FR_QQ_5 = FR_QQ_5, FR_QQ_5, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1!=0) U_hi = PP_1 * U_hi
+//      if (i_1!=0) U_lo = r * r  + U_lo
+//      Load PP_3 or QQ_3
+//
+(p9)    fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_4
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)    fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0
+      nop.i 999
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_U_lo = FR_QQ_1,FR_U_lo, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p9)    fma.s1 FR_U_hi = FR_PP_1, FR_U_hi, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      Load PP_2, QQ_2
+//
+(p9)    fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_3
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1==0) poly = FR_rsq * poly  + PP_3
+//      else        poly = FR_rsq * poly  + QQ_3
+//      Load PP_1_lo
+//
+(p9)    fma.s1 FR_U_lo = FR_PP_1, FR_U_lo, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1 =0) poly = poly * rsq + pp_r4
+//      else        poly = poly * rsq + qq_r4
+//
+(p9)    fma.s1 FR_U_hi = FR_r, f1, FR_U_hi
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_2
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1==0) U_lo =  PP_1_hi * U_lo
+//      else        U_lo =  QQ_1 * U_lo
+//
+(p9)    fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_2
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_0==0)  Result = 1
+//      else         Result = -1
+//
+        fma.s1 FR_V = FR_U_lo, f1, FR_corr
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly = FR_rsq, FR_poly, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1==0) poly =  FR_rsq * poly + PP_2
+//      else poly =  FR_rsq * poly + QQ_2
+//
+(p9)    fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_1_lo
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p10)   fma.s1 FR_poly = FR_rsq, FR_poly, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      V = U_lo + corr
+//
+(p9)    fma.s1 FR_poly = FR_r_cubed, FR_poly, f0
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//
+//      if (i_1==0) poly = r_cube * poly
+//      else        poly = FR_rsq * poly
+//
+        fma.s1  FR_V = FR_poly, f1, FR_V
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+//(p12)   fms.s1 FR_Input_X = FR_Input_X, FR_U_hi, FR_V
+(p12)   fms.s1 FR_Input_X = FR_prelim, FR_U_hi, FR_V
+      nop.i 999
+}
+
+{ .mfb
+      nop.m 999
+//
+//      V = V + poly
+//
+//(p11)   fma.s1 FR_Input_X = FR_Input_X, FR_U_hi, FR_V
+(p11)   fma.s1 FR_Input_X = FR_prelim, FR_U_hi, FR_V
+//
+//      if (i_0==0) Result = Result * U_hi + V
+//      else        Result = Result * U_hi - V
+//
+       br.ret.sptk   b0 ;;
+}
+
+//
+//      If cosine, FR_Input_X = 1
+//      If sine, FR_Input_X = +/-Zero (Input FR_Input_X)
+//      Results are exact, no exceptions
+//
+SINCOS_ZERO:
+
+{ .mmb
+        cmp.eq.unc p6, p7 = 0x1, GR_Sin_or_Cos
+      nop.m 999
+      nop.b 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p7)    fmerge.s FR_Input_X = FR_Input_X, FR_Input_X
+      nop.i 999
+}
+
+{ .mfb
+      nop.m 999
+(p6)    fmerge.s FR_Input_X = f1, f1
+       br.ret.sptk   b0 ;;
+}
+
+SINCOS_SPECIAL:
+
+//
+//      Path for Arg = +/- QNaN, SNaN, Inf
+//      Invalid can be raised. SNaNs
+//      become QNaNs
+//
+
+{ .mfb
+      nop.m 999
+        fmpy.s1 FR_Input_X = FR_Input_X, f0
+        br.ret.sptk   b0 ;;
+}
+GLOBAL_LIBM_END(__libm_cos_large)
+
+
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
+//
+//     Special Code to handle very large argument case.
+//     Call int __libm_pi_by_2_reduce(x,r,c) for |arguments| >= 2**63
+//     The interface is custom:
+//       On input:
+//         (Arg or x) is in f8
+//       On output:
+//         r is in f8
+//         c is in f9
+//         N is in r8
+//     Be sure to allocate at least 2 GP registers as output registers for
+//     __libm_pi_by_2_reduce.  This routine uses r49-50. These are used as
+//     scratch registers within the __libm_pi_by_2_reduce routine (for speed).
+//
+//     We know also that __libm_pi_by_2_reduce preserves f10-15, f71-127.  We
+//     use this to eliminate save/restore of key fp registers in this calling
+//     function.
+//
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
+
+LOCAL_LIBM_ENTRY(__libm_callout_2)
+SINCOS_ARG_TOO_LARGE:
+
+.prologue
+//      Readjust Table ptr
+{ .mfi
+        adds  GR_Table_Base1 = -16, GR_Table_Base1
+        nop.f 999
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+};;
+
+{ .mmi
+        ldfs FR_Two_to_M3 = [GR_Table_Base1],4
+        mov GR_SAVE_GP=gp                       // Save gp
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
+};;
+
+.body
+//
+//     Call argument reduction with x in f8
+//     Returns with N in r8, r in f8, c in f9
+//     Assumes f71-127 are preserved across the call
+//
+{ .mib
+        ldfs FR_Neg_Two_to_M3 = [GR_Table_Base1],0
+        nop.i 0
+        br.call.sptk b0=__libm_pi_by_2_reduce#
+};;
+
+{ .mfi
+        add   GR_N_Inc = GR_Sin_or_Cos,r8
+        fcmp.lt.unc.s1  p6, p0 = FR_r, FR_Two_to_M3
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+
+{ .mfi
+        mov   gp = GR_SAVE_GP                  // Restore gp
+(p6)    fcmp.gt.unc.s1  p6, p0 = FR_r, FR_Neg_Two_to_M3
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+};;
+
+{ .mbb
+        nop.m 999
+(p6)    br.cond.spnt SINCOS_SMALL_R            // Branch if |r| < 1/4
+        br.cond.sptk SINCOS_NORMAL_R ;;        // Branch if 1/4 <= |r| < pi/4
+}
+
+LOCAL_LIBM_END(__libm_callout_2)
+
+.type   __libm_pi_by_2_reduce#,@function
+.global __libm_pi_by_2_reduce#
+
diff --git a/sysdeps/ia64/fpu/libm_sincosf.S b/sysdeps/ia64/fpu/libm_sincosf.S
new file mode 100644
index 0000000000..cf23356ef4
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_sincosf.S
@@ -0,0 +1,745 @@
+.file "libm_sincosf.s"
+
+
+// Copyright (c) 2002 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/01/02 Initial version
+// 02/18/02 Large arguments processing routine is excluded.
+//          External interface entry points are added
+// 02/26/02 Added temporary return of results in r8, r9
+// 03/13/02 Corrected restore of predicate registers
+// 03/19/02 Added stack unwind around call to __libm_cisf_large
+// 09/05/02 Work range is widened by reduction strengthen (2 parts of Pi/16)
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 02/11/04 cisf is moved to the separate file.
+// 03/31/05 Reformatted delimiters between data tables
+
+// API
+//==============================================================
+// 1) void sincosf(float, float*s, float*c)
+// 2) __libm_sincosf - internal LIBM function, that accepts
+//    argument in f8 and returns cosine through f8, sine through f9
+
+//
+// Overview of operation
+//==============================================================
+//
+// Step 1
+// ======
+// Reduce x to region -1/2*pi/2^k ===== 0 ===== +1/2*pi/2^k  where k=4
+//    divide x by pi/2^k.
+//    Multiply by 2^k/pi.
+//    nfloat = Round result to integer (round-to-nearest)
+//
+// r = x -  nfloat * pi/2^k
+//    Do this as (x -  nfloat * HIGH(pi/2^k)) - nfloat * LOW(pi/2^k) for increased accuracy.
+//    pi/2^k is stored as two numbers that when added make pi/2^k.
+//       pi/2^k = HIGH(pi/2^k) + LOW(pi/2^k)
+//    HIGH part is rounded to zero, LOW - to nearest
+//
+// x = (nfloat * pi/2^k) + r
+//    r is small enough that we can use a polynomial approximation
+//    and is referred to as the reduced argument.
+//
+// Step 3
+// ======
+// Take the unreduced part and remove the multiples of 2pi.
+// So nfloat = nfloat (with lower k+1 bits cleared) + lower k+1 bits
+//
+//    nfloat (with lower k+1 bits cleared) is a multiple of 2^(k+1)
+//    N * 2^(k+1)
+//    nfloat * pi/2^k = N * 2^(k+1) * pi/2^k + (lower k+1 bits) * pi/2^k
+//    nfloat * pi/2^k = N * 2 * pi + (lower k+1 bits) * pi/2^k
+//    nfloat * pi/2^k = N2pi + M * pi/2^k
+//
+//
+// Sin(x) = Sin((nfloat * pi/2^k) + r)
+//        = Sin(nfloat * pi/2^k) * Cos(r) + Cos(nfloat * pi/2^k) * Sin(r)
+//
+//          Sin(nfloat * pi/2^k) = Sin(N2pi + Mpi/2^k)
+//                               = Sin(N2pi)Cos(Mpi/2^k) + Cos(N2pi)Sin(Mpi/2^k)
+//                               = Sin(Mpi/2^k)
+//
+//          Cos(nfloat * pi/2^k) = Cos(N2pi + Mpi/2^k)
+//                               = Cos(N2pi)Cos(Mpi/2^k) + Sin(N2pi)Sin(Mpi/2^k)
+//                               = Cos(Mpi/2^k)
+//
+// Sin(x) = Sin(Mpi/2^k) Cos(r) + Cos(Mpi/2^k) Sin(r)
+//
+//
+// Step 4
+// ======
+// 0 <= M < 2^(k+1)
+// There are 2^(k+1) Sin entries in a table.
+// There are 2^(k+1) Cos entries in a table.
+//
+// Get Sin(Mpi/2^k) and Cos(Mpi/2^k) by table lookup.
+//
+//
+// Step 5
+// ======
+// Calculate Cos(r) and Sin(r) by polynomial approximation.
+//
+// Cos(r) = 1 + r^2 q1  + r^4 q2 = Series for Cos
+// Sin(r) = r + r^3 p1  + r^5 p2 = Series for Sin
+//
+// and the coefficients q1, q2 and p1, p2 are stored in a table
+//
+//
+// Calculate
+// Sin(x) = Sin(Mpi/2^k) Cos(r) + Cos(Mpi/2^k) Sin(r)
+//
+// as follows
+//
+//    S[m] = Sin(Mpi/2^k) and C[m] = Cos(Mpi/2^k)
+//    rsq = r*r
+//
+//
+//    P = p1 + r^2p2
+//    Q = q1 + r^2q2
+//
+//       rcub = r * rsq
+//       Sin(r) = r + rcub * P
+//              = r + r^3p1  + r^5p2 = Sin(r)
+//
+//       P =  r + rcub * P
+//
+//    Answer = S[m] Cos(r) + C[m] P
+//
+//       Cos(r) = 1 + rsq Q
+//       Cos(r) = 1 + r^2 Q
+//       Cos(r) = 1 + r^2 (q1 + r^2q2)
+//       Cos(r) = 1 + r^2q1 + r^4q2
+//
+//       S[m] Cos(r) = S[m](1 + rsq Q)
+//       S[m] Cos(r) = S[m] + S[m] rsq Q
+//       S[m] Cos(r) = S[m] + s_rsq Q
+//       Q           = S[m] + s_rsq Q
+//
+// Then,
+//
+//    Answer = Q + C[m] P
+
+
+// Registers used
+//==============================================================
+// general input registers:
+// r14 -> r19
+// r32 -> r49
+
+// predicate registers used:
+// p6 -> p14
+
+// floating-point registers used
+// f9 -> f15
+// f32 -> f100
+
+// Assembly macros
+//==============================================================
+
+cisf_Arg                     = f8
+
+cisf_Sin_res                 = f9
+cisf_Cos_res                 = f8
+
+
+cisf_NORM_f8                 = f10
+cisf_W                       = f11
+cisf_int_Nfloat              = f12
+cisf_Nfloat                  = f13
+
+cisf_r                       = f14
+cisf_r_exact                 = f68
+cisf_rsq                     = f15
+cisf_rcub                    = f32
+
+cisf_Inv_Pi_by_16            = f33
+cisf_Pi_by_16_hi             = f34
+cisf_Pi_by_16_lo             = f35
+
+cisf_Inv_Pi_by_64            = f36
+cisf_Pi_by_64_hi             = f37
+cisf_Pi_by_64_lo             = f38
+
+
+cisf_P1                      = f39
+cisf_Q1                      = f40
+cisf_P2                      = f41
+cisf_Q2                      = f42
+cisf_P3                      = f43
+cisf_Q3                      = f44
+cisf_P4                      = f45
+cisf_Q4                      = f46
+
+cisf_P_temp1                 = f47
+cisf_P_temp2                 = f48
+
+cisf_Q_temp1                 = f49
+cisf_Q_temp2                 = f50
+
+cisf_P                       = f51
+
+cisf_SIG_INV_PI_BY_16_2TO61  = f52
+cisf_RSHF_2TO61              = f53
+cisf_RSHF                    = f54
+cisf_2TOM61                  = f55
+cisf_NFLOAT                  = f56
+cisf_W_2TO61_RSH             = f57
+
+cisf_tmp                     = f58
+
+cisf_Sm_sin                  = f59
+cisf_Cm_sin                  = f60
+
+cisf_Sm_cos                  = f61
+cisf_Cm_cos                  = f62
+
+cisf_srsq_sin                = f63
+cisf_srsq_cos                = f64
+
+cisf_Q_sin                   = f65
+cisf_Q_cos                   = f66
+cisf_Q                       = f67
+
+/////////////////////////////////////////////////////////////
+
+cisf_pResSin                 = r33
+cisf_pResCos                 = r34
+
+cisf_exp_limit               = r35
+cisf_r_signexp               = r36
+cisf_AD_beta_table           = r37
+cisf_r_sincos                = r38
+
+cisf_r_exp                   = r39
+cisf_r_17_ones               = r40
+
+cisf_GR_sig_inv_pi_by_16     = r14
+cisf_GR_rshf_2to61           = r15
+cisf_GR_rshf                 = r16
+cisf_GR_exp_2tom61           = r17
+cisf_GR_n                    = r18
+
+cisf_GR_n_sin                = r19
+cisf_GR_m_sin                = r41
+cisf_GR_32m_sin              = r41
+
+cisf_GR_n_cos                = r42
+cisf_GR_m_cos                = r43
+cisf_GR_32m_cos              = r43
+
+cisf_AD_2_sin                = r44
+cisf_AD_2_cos                = r45
+
+cisf_gr_tmp                  = r46
+GR_SAVE_B0                   = r47
+GR_SAVE_GP                   = r48
+rB0_SAVED                    = r49
+GR_SAVE_PFS                  = r50
+GR_SAVE_PR                   = r51
+cisf_AD_1                    = r52
+
+RODATA
+
+.align 16
+// Pi/16 parts
+LOCAL_OBJECT_START(double_cisf_pi)
+   data8 0xC90FDAA22168C234, 0x00003FFC // pi/16 1st part
+   data8 0xC4C6628B80DC1CD1, 0x00003FBC // pi/16 2nd part
+LOCAL_OBJECT_END(double_cisf_pi)
+
+// Coefficients for polynomials
+LOCAL_OBJECT_START(double_cisf_pq_k4)
+   data8 0x3F810FABB668E9A2 // P2
+   data8 0x3FA552E3D6DE75C9 // Q2
+   data8 0xBFC555554447BC7F // P1
+   data8 0xBFDFFFFFC447610A // Q1
+LOCAL_OBJECT_END(double_cisf_pq_k4)
+
+// Sincos table (S[m], C[m])
+LOCAL_OBJECT_START(double_sin_cos_beta_k4)
+    data8 0x0000000000000000 // sin ( 0 Pi / 16 )
+    data8 0x3FF0000000000000 // cos ( 0 Pi / 16 )
+//
+    data8 0x3FC8F8B83C69A60B // sin ( 1 Pi / 16 )
+    data8 0x3FEF6297CFF75CB0 // cos ( 1 Pi / 16 )
+//
+    data8 0x3FD87DE2A6AEA963 // sin ( 2 Pi / 16 )
+    data8 0x3FED906BCF328D46 // cos ( 2 Pi / 16 )
+//
+    data8 0x3FE1C73B39AE68C8 // sin ( 3 Pi / 16 )
+    data8 0x3FEA9B66290EA1A3 // cos ( 3 Pi / 16 )
+//
+    data8 0x3FE6A09E667F3BCD // sin ( 4 Pi / 16 )
+    data8 0x3FE6A09E667F3BCD // cos ( 4 Pi / 16 )
+//
+    data8 0x3FEA9B66290EA1A3 // sin ( 5 Pi / 16 )
+    data8 0x3FE1C73B39AE68C8 // cos ( 5 Pi / 16 )
+//
+    data8 0x3FED906BCF328D46 // sin ( 6 Pi / 16 )
+    data8 0x3FD87DE2A6AEA963 // cos ( 6 Pi / 16 )
+//
+    data8 0x3FEF6297CFF75CB0 // sin ( 7 Pi / 16 )
+    data8 0x3FC8F8B83C69A60B // cos ( 7 Pi / 16 )
+//
+    data8 0x3FF0000000000000 // sin ( 8 Pi / 16 )
+    data8 0x0000000000000000 // cos ( 8 Pi / 16 )
+//
+    data8 0x3FEF6297CFF75CB0 // sin ( 9 Pi / 16 )
+    data8 0xBFC8F8B83C69A60B // cos ( 9 Pi / 16 )
+//
+    data8 0x3FED906BCF328D46 // sin ( 10 Pi / 16 )
+    data8 0xBFD87DE2A6AEA963 // cos ( 10 Pi / 16 )
+//
+    data8 0x3FEA9B66290EA1A3 // sin ( 11 Pi / 16 )
+    data8 0xBFE1C73B39AE68C8 // cos ( 11 Pi / 16 )
+//
+    data8 0x3FE6A09E667F3BCD // sin ( 12 Pi / 16 )
+    data8 0xBFE6A09E667F3BCD // cos ( 12 Pi / 16 )
+//
+    data8 0x3FE1C73B39AE68C8 // sin ( 13 Pi / 16 )
+    data8 0xBFEA9B66290EA1A3 // cos ( 13 Pi / 16 )
+//
+    data8 0x3FD87DE2A6AEA963 // sin ( 14 Pi / 16 )
+    data8 0xBFED906BCF328D46 // cos ( 14 Pi / 16 )
+//
+    data8 0x3FC8F8B83C69A60B // sin ( 15 Pi / 16 )
+    data8 0xBFEF6297CFF75CB0 // cos ( 15 Pi / 16 )
+//
+    data8 0x0000000000000000 // sin ( 16 Pi / 16 )
+    data8 0xBFF0000000000000 // cos ( 16 Pi / 16 )
+//
+    data8 0xBFC8F8B83C69A60B // sin ( 17 Pi / 16 )
+    data8 0xBFEF6297CFF75CB0 // cos ( 17 Pi / 16 )
+//
+    data8 0xBFD87DE2A6AEA963 // sin ( 18 Pi / 16 )
+    data8 0xBFED906BCF328D46 // cos ( 18 Pi / 16 )
+//
+    data8 0xBFE1C73B39AE68C8 // sin ( 19 Pi / 16 )
+    data8 0xBFEA9B66290EA1A3 // cos ( 19 Pi / 16 )
+//
+    data8 0xBFE6A09E667F3BCD // sin ( 20 Pi / 16 )
+    data8 0xBFE6A09E667F3BCD // cos ( 20 Pi / 16 )
+//
+    data8 0xBFEA9B66290EA1A3 // sin ( 21 Pi / 16 )
+    data8 0xBFE1C73B39AE68C8 // cos ( 21 Pi / 16 )
+//
+    data8 0xBFED906BCF328D46 // sin ( 22 Pi / 16 )
+    data8 0xBFD87DE2A6AEA963 // cos ( 22 Pi / 16 )
+//
+    data8 0xBFEF6297CFF75CB0 // sin ( 23 Pi / 16 )
+    data8 0xBFC8F8B83C69A60B // cos ( 23 Pi / 16 )
+//
+    data8 0xBFF0000000000000 // sin ( 24 Pi / 16 )
+    data8 0x0000000000000000 // cos ( 24 Pi / 16 )
+//
+    data8 0xBFEF6297CFF75CB0 // sin ( 25 Pi / 16 )
+    data8 0x3FC8F8B83C69A60B // cos ( 25 Pi / 16 )
+//
+    data8 0xBFED906BCF328D46 // sin ( 26 Pi / 16 )
+    data8 0x3FD87DE2A6AEA963 // cos ( 26 Pi / 16 )
+//
+    data8 0xBFEA9B66290EA1A3 // sin ( 27 Pi / 16 )
+    data8 0x3FE1C73B39AE68C8 // cos ( 27 Pi / 16 )
+//
+    data8 0xBFE6A09E667F3BCD // sin ( 28 Pi / 16 )
+    data8 0x3FE6A09E667F3BCD // cos ( 28 Pi / 16 )
+//
+    data8 0xBFE1C73B39AE68C8 // sin ( 29 Pi / 16 )
+    data8 0x3FEA9B66290EA1A3 // cos ( 29 Pi / 16 )
+//
+    data8 0xBFD87DE2A6AEA963 // sin ( 30 Pi / 16 )
+    data8 0x3FED906BCF328D46 // cos ( 30 Pi / 16 )
+//
+    data8 0xBFC8F8B83C69A60B // sin ( 31 Pi / 16 )
+    data8 0x3FEF6297CFF75CB0 // cos ( 31 Pi / 16 )
+//
+    data8 0x0000000000000000 // sin ( 32 Pi / 16 )
+    data8 0x3FF0000000000000 // cos ( 32 Pi / 16 )
+LOCAL_OBJECT_END(double_sin_cos_beta_k4)
+
+.section .text
+
+GLOBAL_IEEE754_ENTRY(sincosf)
+// cis_GR_sig_inv_pi_by_16 = significand of 16/pi
+{ .mlx
+      alloc         GR_SAVE_PFS              = ar.pfs, 0, 21, 0, 0
+      movl          cisf_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A // 16/pi signd
+
+}
+// cis_GR_rshf_2to61 = 1.1000 2^(63+63-2)
+{ .mlx
+      addl          cisf_AD_1           = @ltoff(double_cisf_pi), gp
+      movl          cisf_GR_rshf_2to61  = 0x47b8000000000000 // 1.1 2^(63+63-2)
+};;
+
+{ .mfi
+      ld8           cisf_AD_1           = [cisf_AD_1]
+      fnorm.s1      cisf_NORM_f8        = cisf_Arg
+      cmp.eq        p13, p14            = r0, r0 // p13 set for sincos
+}
+// cis_GR_exp_2tom61 = exponent of scaling factor 2^-61
+{ .mib
+      mov           cisf_GR_exp_2tom61  = 0xffff-61
+      nop.i         0
+      br.cond.sptk  _CISF_COMMON
+};;
+GLOBAL_IEEE754_END(sincosf)
+
+GLOBAL_LIBM_ENTRY(__libm_sincosf)
+{ .mlx
+// cisf_GR_sig_inv_pi_by_16 = significand of 16/pi
+      alloc         GR_SAVE_PFS              = ar.pfs,0,21,0,0
+      movl          cisf_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A
+}
+// cisf_GR_rshf_2to61 = 1.1000 2^(63+63-2)
+{ .mlx
+      addl          cisf_AD_1           = @ltoff(double_cisf_pi), gp
+      movl          cisf_GR_rshf_2to61  = 0x47b8000000000000
+};;
+
+// p14 set for __libm_sincos and cis
+{ .mfi
+      ld8           cisf_AD_1           = [cisf_AD_1]
+      fnorm.s1      cisf_NORM_f8        = cisf_Arg
+      cmp.eq        p14, p13            = r0, r0
+}
+// cisf_GR_exp_2tom61 = exponent of scaling factor 2^-61
+{ .mib
+      mov           cisf_GR_exp_2tom61  = 0xffff-61
+      nop.i         0
+      nop.b         0
+};;
+
+_CISF_COMMON:
+//  Form two constants we need
+//  16/pi * 2^-2 * 2^63, scaled by 2^61 since we just loaded the significand
+//  1.1000...000 * 2^(63+63-2) to right shift int(W) into the low significand
+//  fcmp used to set denormal, and invalid on snans
+{ .mfi
+      setf.sig      cisf_SIG_INV_PI_BY_16_2TO61 = cisf_GR_sig_inv_pi_by_16
+      fclass.m      p6,p0                       = cisf_Arg, 0xe7//if x=0,inf,nan
+      addl          cisf_gr_tmp                 = -1, r0
+}
+// cisf_GR_rshf = 1.1000 2^63 for right shift
+{ .mlx
+      setf.d        cisf_RSHF_2TO61     = cisf_GR_rshf_2to61
+      movl          cisf_GR_rshf        = 0x43e8000000000000
+};;
+
+//  Form another constant
+//  2^-61 for scaling Nfloat
+//  0x10017 is register_bias + 24.
+//  So if f8 >= 2^24, go to large args routine
+{ .mmi
+      getf.exp      cisf_r_signexp      = cisf_Arg
+      setf.exp      cisf_2TOM61         = cisf_GR_exp_2tom61
+      mov           cisf_exp_limit      = 0x10017
+};;
+
+// Load the two pieces of pi/16
+// Form another constant
+//  1.1000...000 * 2^63, the right shift constant
+{ .mmb
+      ldfe          cisf_Pi_by_16_hi    = [cisf_AD_1],16
+      setf.d        cisf_RSHF           = cisf_GR_rshf
+(p6)  br.cond.spnt  _CISF_SPECIAL_ARGS
+};;
+
+{ .mmi
+      ldfe          cisf_Pi_by_16_lo    = [cisf_AD_1],16
+      setf.sig      cisf_tmp            = cisf_gr_tmp //constant for inexact set
+      nop.i         0
+};;
+
+// Start loading P, Q coefficients
+{ .mmi
+      ldfpd         cisf_P2,cisf_Q2     = [cisf_AD_1],16
+      nop.m         0
+      dep.z         cisf_r_exp          = cisf_r_signexp, 0, 17
+};;
+
+// p10 is true if we must call routines to handle larger arguments
+// p10 is true if f8 exp is >= 0x10017
+{ .mmb
+      ldfpd         cisf_P1,cisf_Q1     = [cisf_AD_1], 16
+      cmp.ge        p10, p0             = cisf_r_exp, cisf_exp_limit
+(p10) br.cond.spnt  _CISF_LARGE_ARGS    // go to |x| >= 2^24 path
+};;
+
+// cisf_W          = x * cisf_Inv_Pi_by_16
+// Multiply x by scaled 16/pi and add large const to shift integer part of W to
+//   rightmost bits of significand
+{ .mfi
+      nop.m  0
+      fma.s1 cisf_W_2TO61_RSH = cisf_NORM_f8,cisf_SIG_INV_PI_BY_16_2TO61,cisf_RSHF_2TO61
+      nop.i  0
+};;
+
+// cisf_NFLOAT = Round_Int_Nearest(cisf_W)
+{ .mfi
+      nop.m         0
+      fms.s1        cisf_NFLOAT         = cisf_W_2TO61_RSH,cisf_2TOM61,cisf_RSHF
+      nop.i         0
+};;
+
+// N = (int)cisf_int_Nfloat
+{ .mfi
+      getf.sig      cisf_GR_n           = cisf_W_2TO61_RSH
+      nop.f         0
+      nop.i         0
+};;
+
+// Add 2^(k-1) (which is in cisf_r_sincos) to N
+// cisf_r = -cisf_Nfloat * cisf_Pi_by_16_hi + x
+// cisf_r = cisf_r -cisf_Nfloat * cisf_Pi_by_16_lo
+{ .mfi
+      add     cisf_GR_n_cos = 0x8, cisf_GR_n
+      fnma.s1 cisf_r        = cisf_NFLOAT, cisf_Pi_by_16_hi, cisf_NORM_f8
+      nop.i   0
+};;
+
+//Get M (least k+1 bits of N)
+{ .mmi
+      and           cisf_GR_m_sin       = 0x1f,cisf_GR_n
+      and           cisf_GR_m_cos       = 0x1f,cisf_GR_n_cos
+      nop.i         0
+};;
+
+{ .mmi
+      shladd        cisf_AD_2_cos       = cisf_GR_m_cos,4, cisf_AD_1
+      shladd        cisf_AD_2_sin       = cisf_GR_m_sin,4, cisf_AD_1
+      nop.i         0
+};;
+
+// den. input to set uflow
+{ .mmf
+      ldfpd         cisf_Sm_sin, cisf_Cm_sin = [cisf_AD_2_sin]
+      ldfpd         cisf_Sm_cos, cisf_Cm_cos = [cisf_AD_2_cos]
+      fclass.m.unc  p10,p0                   = cisf_Arg,0x0b
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cisf_rsq            = cisf_r, cisf_r,   f0  // get r^2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fmpy.s0       cisf_tmp            = cisf_tmp,cisf_tmp // inexact flag
+      nop.i         0
+};;
+
+{ .mmf
+      nop.m         0
+      nop.m         0
+      fnma.s1       cisf_r_exact        = cisf_NFLOAT, cisf_Pi_by_16_lo, cisf_r
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cisf_P              = cisf_rsq, cisf_P2, cisf_P1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        cisf_Q              = cisf_rsq, cisf_Q2, cisf_Q1
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fmpy.s1       cisf_rcub           = cisf_r_exact, cisf_rsq // get r^3
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fmpy.s1       cisf_srsq_sin       = cisf_Sm_sin,cisf_rsq
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fmpy.s1       cisf_srsq_cos       = cisf_Sm_cos,cisf_rsq
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cisf_P              = cisf_rcub,cisf_P,cisf_r_exact
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        cisf_Q_sin          = cisf_srsq_sin,cisf_Q, cisf_Sm_sin
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        cisf_Q_cos          = cisf_srsq_cos,cisf_Q, cisf_Sm_cos
+      nop.i         0
+};;
+
+// If den. arg, force underflow to be set
+{ .mfi
+      nop.m         0
+(p10) fmpy.s.s0     cisf_tmp            = cisf_Arg,cisf_Arg
+      nop.i         0
+};;
+
+//Final sin
+{ .mfi
+      nop.m         0
+      fma.s.s0      cisf_Sin_res        = cisf_Cm_sin, cisf_P, cisf_Q_sin
+      nop.i         0
+}
+//Final cos
+{ .mfb
+      nop.m         0
+      fma.s.s0      cisf_Cos_res    = cisf_Cm_cos, cisf_P, cisf_Q_cos
+(p14) br.cond.sptk  _CISF_RETURN //com. exit for __libm_sincos and cis main path
+};;
+
+{ .mmb
+      stfs          [cisf_pResSin]      = cisf_Sin_res
+      stfs          [cisf_pResCos]      = cisf_Cos_res
+      br.ret.sptk   b0 // common exit for sincos main path
+};;
+
+_CISF_SPECIAL_ARGS:
+// sinf(+/-0) = +/-0
+// sinf(Inf)  = NaN
+// sinf(NaN)  = NaN
+{ .mfi
+      nop.m         999
+      fma.s.s0      cisf_Sin_res        = cisf_Arg, f0, f0 // sinf(+/-0,NaN,Inf)
+      nop.i         999
+};;
+
+// cosf(+/-0) = 1.0
+// cosf(Inf)  = NaN
+// cosf(NaN)  = NaN
+{ .mfb
+      nop.m         999
+      fma.s.s0      cisf_Cos_res        = cisf_Arg, f0, f1 // cosf(+/-0,NaN,Inf)
+(p14) br.cond.sptk  _CISF_RETURN //spec exit for __libm_sincos and cis main path
+};;
+
+{ .mmb
+      stfs          [cisf_pResSin]      = cisf_Sin_res
+      stfs          [cisf_pResCos]      = cisf_Cos_res
+      br.ret.sptk   b0 // special exit for sincos main path
+};;
+
+ // exit for sincos
+ // NOTE! r8 and r9 used only because of compiler issue
+ // connected with float point complex function arguments pass
+ // After fix of this issue this operations can be deleted
+_CISF_RETURN:
+{ .mmb
+      getf.s        r8                  = cisf_Cos_res
+      getf.s        r9                  = cisf_Sin_res
+      br.ret.sptk   b0 // exit for sincos
+};;
+GLOBAL_LIBM_END(__libm_sincosf)
+
+////  |x| > 2^24 path  ///////
+.proc _CISF_LARGE_ARGS
+_CISF_LARGE_ARGS:
+.prologue
+{ .mfi
+      nop.m         0
+      nop.f         0
+.save ar.pfs, GR_SAVE_PFS
+      mov           GR_SAVE_PFS         = ar.pfs
+};;
+
+{ .mfi
+      mov           GR_SAVE_GP          = gp
+      nop.f         0
+.save b0, GR_SAVE_B0
+      mov           GR_SAVE_B0          = b0
+};;
+
+.body
+// Call of huge arguments sincos
+{ .mib
+      nop.m         0
+      mov           GR_SAVE_PR          = pr
+      br.call.sptk  b0                  = __libm_sincos_large
+};;
+
+{ .mfi
+      mov           gp                  = GR_SAVE_GP
+      nop.f         0
+      mov           pr                  = GR_SAVE_PR, 0x1fffe
+}
+;;
+
+{ .mfi
+      nop.m         0
+      nop.f         0
+      mov           b0                  = GR_SAVE_B0
+}
+;;
+
+{ .mfi
+      nop.m         0
+      fma.s.s0      cisf_Cos_res        = cisf_Cos_res, f1, f0
+      mov           ar.pfs              = GR_SAVE_PFS
+}
+// exit for |x| > 2^24 path (__libm_sincos and cis)
+{ .mfb
+      nop.m         0
+      fma.s.s0      cisf_Sin_res        = cisf_Sin_res, f1, f0
+(p14) br.cond.sptk  _CISF_RETURN
+};;
+
+{ .mmb
+      stfs          [cisf_pResSin]      = cisf_Sin_res
+      stfs          [cisf_pResCos]      = cisf_Cos_res
+      br.ret.sptk   b0 // exit for sincos |x| > 2^24 path
+};;
+
+.endp _CISF_LARGE_ARGS
+
+.type   __libm_sincos_large#,@function
+.global __libm_sincos_large#
+
diff --git a/sysdeps/ia64/fpu/libm_sincosl.S b/sysdeps/ia64/fpu/libm_sincosl.S
new file mode 100644
index 0000000000..1d89ff4bd1
--- /dev/null
+++ b/sysdeps/ia64/fpu/libm_sincosl.S
@@ -0,0 +1,2528 @@
+.file "libm_sincosl.s"
+
+
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History:
+// 05/13/02 Initial version of sincosl (based on libm's sinl and cosl)
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+// 10/13/03 Corrected .file name
+// 02/11/04 cisl is moved to the separate file.
+// 10/26/04 Avoided using r14-31 as scratch so not clobbered by dynamic loader
+//
+//*********************************************************************
+//
+// Function:   Combined sincosl routine with 3 different API's
+//
+// API's
+//==============================================================
+// 1) void sincosl(long double, long double*s, long double*c)
+// 2) __libm_sincosl - internal LIBM function, that accepts
+//    argument in f8 and returns cosine through f8, sine through f9
+//
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f8 (Input x and cosl return value),
+//                              f9 (sinl returned)
+//                              f32-f121
+//
+//    General Purpose Registers:
+//      r32-r61
+//
+//    Predicate Registers:      p6-p15
+//
+//*********************************************************************
+//
+//  IEEE Special Conditions:
+//
+//    Denormal  fault raised on denormal inputs
+//    Overflow exceptions do not occur
+//    Underflow exceptions raised when appropriate for sincosl
+//    (No specialized error handling for this routine)
+//    Inexact raised when appropriate by algorithm
+//
+//    sincosl(SNaN) = QNaN, QNaN
+//    sincosl(QNaN) = QNaN, QNaN
+//    sincosl(inf)  = QNaN, QNaN
+//    sincosl(+/-0) = +/-0, 1
+//
+//*********************************************************************
+//
+//  Mathematical Description
+//  ========================
+//
+//  The computation of FSIN and FCOS performed in parallel.
+//
+//  Arg = N pi/2 + alpha, |alpha| <= pi/4.
+//
+//  cosl( Arg ) = sinl( (N+1) pi/2 + alpha ),
+//
+//  therefore, the code for computing sine will produce cosine as long
+//  as 1 is added to N immediately after the argument reduction
+//  process.
+//
+//  Let M = N if sine
+//      N+1 if cosine.
+//
+//  Now, given
+//
+//  Arg = M pi/2  + alpha, |alpha| <= pi/4,
+//
+//  let I = M mod 4, or I be the two lsb of M when M is represented
+//  as 2's complement. I = [i_0 i_1]. Then
+//
+//  sinl( Arg ) = (-1)^i_0  sinl( alpha ) if i_1 = 0,
+//             = (-1)^i_0  cosl( alpha )     if i_1 = 1.
+//
+//  For example:
+//       if M = -1, I = 11
+//         sin ((-pi/2 + alpha) = (-1) cos (alpha)
+//       if M = 0, I = 00
+//         sin (alpha) = sin (alpha)
+//       if M = 1, I = 01
+//         sin (pi/2 + alpha) = cos (alpha)
+//       if M = 2, I = 10
+//         sin (pi + alpha) = (-1) sin (alpha)
+//       if M = 3, I = 11
+//         sin ((3/2)pi + alpha) = (-1) cos (alpha)
+//
+//  The value of alpha is obtained by argument reduction and
+//  represented by two working precision numbers r and c where
+//
+//  alpha =  r  +  c     accurately.
+//
+//  The reduction method is described in a previous write up.
+//  The argument reduction scheme identifies 4 cases. For Cases 2
+//  and 4, because |alpha| is small, sinl(r+c) and cosl(r+c) can be
+//  computed very easily by 2 or 3 terms of the Taylor series
+//  expansion as follows:
+//
+//  Case 2:
+//  -------
+//
+//  sinl(r + c) = r + c - r^3/6 accurately
+//  cosl(r + c) = 1 - 2^(-67) accurately
+//
+//  Case 4:
+//  -------
+//
+//  sinl(r + c) = r + c - r^3/6 + r^5/120 accurately
+//  cosl(r + c) = 1 - r^2/2 + r^4/24    accurately
+//
+//  The only cases left are Cases 1 and 3 of the argument reduction
+//  procedure. These two cases will be merged since after the
+//  argument is reduced in either cases, we have the reduced argument
+//  represented as r + c and that the magnitude |r + c| is not small
+//  enough to allow the usage of a very short approximation.
+//
+//  The required calculation is either
+//
+//  sinl(r + c)  =  sinl(r)  +  correction,  or
+//  cosl(r + c)  =  cosl(r)  +  correction.
+//
+//  Specifically,
+//
+//  sinl(r + c) = sinl(r) + c sin'(r) + O(c^2)
+//       = sinl(r) + c cos (r) + O(c^2)
+//       = sinl(r) + c(1 - r^2/2)  accurately.
+//  Similarly,
+//
+//  cosl(r + c) = cosl(r) - c sinl(r) + O(c^2)
+//       = cosl(r) - c(r - r^3/6)  accurately.
+//
+//  We therefore concentrate on accurately calculating sinl(r) and
+//  cosl(r) for a working-precision number r, |r| <= pi/4 to within
+//  0.1% or so.
+//
+//  The greatest challenge of this task is that the second terms of
+//  the Taylor series
+//
+//  r - r^3/3! + r^r/5! - ...
+//
+//  and
+//
+//  1 - r^2/2! + r^4/4! - ...
+//
+//  are not very small when |r| is close to pi/4 and the rounding
+//  errors will be a concern if simple polynomial accumulation is
+//  used. When |r| < 2^-3, however, the second terms will be small
+//  enough (6 bits or so of right shift) that a normal Horner
+//  recurrence suffices. Hence there are two cases that we consider
+//  in the accurate computation of sinl(r) and cosl(r), |r| <= pi/4.
+//
+//  Case small_r: |r| < 2^(-3)
+//  --------------------------
+//
+//  Since Arg = M pi/4 + r + c accurately, and M mod 4 is [i_0 i_1],
+//  we have
+//
+//  sinl(Arg) = (-1)^i_0 * sinl(r + c)  if i_1 = 0
+//     = (-1)^i_0 * cosl(r + c)   if i_1 = 1
+//
+//  can be accurately approximated by
+//
+//  sinl(Arg) = (-1)^i_0 * [sinl(r) + c]  if i_1 = 0
+//           = (-1)^i_0 * [cosl(r) - c*r] if i_1 = 1
+//
+//  because |r| is small and thus the second terms in the correction
+//  are unneccessary.
+//
+//  Finally, sinl(r) and cosl(r) are approximated by polynomials of
+//  moderate lengths.
+//
+//  sinl(r) =  r + S_1 r^3 + S_2 r^5 + ... + S_5 r^11
+//  cosl(r) =  1 + C_1 r^2 + C_2 r^4 + ... + C_5 r^10
+//
+//  We can make use of predicates to selectively calculate
+//  sinl(r) or cosl(r) based on i_1.
+//
+//  Case normal_r: 2^(-3) <= |r| <= pi/4
+//  ------------------------------------
+//
+//  This case is more likely than the previous one if one considers
+//  r to be uniformly distributed in [-pi/4 pi/4]. Again,
+//
+//  sinl(Arg) = (-1)^i_0 * sinl(r + c)  if i_1 = 0
+//           = (-1)^i_0 * cosl(r + c)   if i_1 = 1.
+//
+//  Because |r| is now larger, we need one extra term in the
+//  correction. sinl(Arg) can be accurately approximated by
+//
+//  sinl(Arg) = (-1)^i_0 * [sinl(r) + c(1-r^2/2)]      if i_1 = 0
+//           = (-1)^i_0 * [cosl(r) - c*r*(1 - r^2/6)]    i_1 = 1.
+//
+//  Finally, sinl(r) and cosl(r) are approximated by polynomials of
+//  moderate lengths.
+//
+//  sinl(r) =  r + PP_1_hi r^3 + PP_1_lo r^3 +
+//                PP_2 r^5 + ... + PP_8 r^17
+//
+//  cosl(r) =  1 + QQ_1 r^2 + QQ_2 r^4 + ... + QQ_8 r^16
+//
+//  where PP_1_hi is only about 16 bits long and QQ_1 is -1/2.
+//  The crux in accurate computation is to calculate
+//
+//  r + PP_1_hi r^3   or  1 + QQ_1 r^2
+//
+//  accurately as two pieces: U_hi and U_lo. The way to achieve this
+//  is to obtain r_hi as a 10 sig. bit number that approximates r to
+//  roughly 8 bits or so of accuracy. (One convenient way is
+//
+//  r_hi := frcpa( frcpa( r ) ).)
+//
+//  This way,
+//
+//  r + PP_1_hi r^3 =  r + PP_1_hi r_hi^3 +
+//                          PP_1_hi (r^3 - r_hi^3)
+//            =  [r + PP_1_hi r_hi^3]  +
+//         [PP_1_hi (r - r_hi)
+//            (r^2 + r_hi r + r_hi^2) ]
+//            =  U_hi  +  U_lo
+//
+//  Since r_hi is only 10 bit long and PP_1_hi is only 16 bit long,
+//  PP_1_hi * r_hi^3 is only at most 46 bit long and thus computed
+//  exactly. Furthermore, r and PP_1_hi r_hi^3 are of opposite sign
+//  and that there is no more than 8 bit shift off between r and
+//  PP_1_hi * r_hi^3. Hence the sum, U_hi, is representable and thus
+//  calculated without any error. Finally, the fact that
+//
+//  |U_lo| <= 2^(-8) |U_hi|
+//
+//  says that U_hi + U_lo is approximating r + PP_1_hi r^3 to roughly
+//  8 extra bits of accuracy.
+//
+//  Similarly,
+//
+//  1 + QQ_1 r^2  =  [1 + QQ_1 r_hi^2]  +
+//                      [QQ_1 (r - r_hi)(r + r_hi)]
+//          =  U_hi  +  U_lo.
+//
+//  Summarizing, we calculate r_hi = frcpa( frcpa( r ) ).
+//
+//  If i_1 = 0, then
+//
+//    U_hi := r + PP_1_hi * r_hi^3
+//    U_lo := PP_1_hi * (r - r_hi) * (r^2 + r*r_hi + r_hi^2)
+//    poly := PP_1_lo r^3 + PP_2 r^5 + ... + PP_8 r^17
+//    correction := c * ( 1 + C_1 r^2 )
+//
+//  Else ...i_1 = 1
+//
+//    U_hi := 1 + QQ_1 * r_hi * r_hi
+//    U_lo := QQ_1 * (r - r_hi) * (r + r_hi)
+//    poly := QQ_2 * r^4 + QQ_3 * r^6 + ... + QQ_8 r^16
+//    correction := -c * r * (1 + S_1 * r^2)
+//
+//  End
+//
+//  Finally,
+//
+//  V := poly + ( U_lo + correction )
+//
+//                 /    U_hi  +  V         if i_0 = 0
+//  result := |
+//                 \  (-U_hi) -  V         if i_0 = 1
+//
+//  It is important that in the last step, negation of U_hi is
+//  performed prior to the subtraction which is to be performed in
+//  the user-set rounding mode.
+//
+//
+//  Algorithmic Description
+//  =======================
+//
+//  The argument reduction algorithm shares the same code between FSIN and FCOS.
+//  The argument reduction description given
+//  previously is repeated below.
+//
+//
+//  Step 0. Initialization.
+//
+//  Step 1. Check for exceptional and special cases.
+//
+//   * If Arg is +-0, +-inf, NaN, NaT, go to Step 10 for special
+//     handling.
+//   * If |Arg| < 2^24, go to Step 2 for reduction of moderate
+//     arguments. This is the most likely case.
+//   * If |Arg| < 2^63, go to Step 8 for pre-reduction of large
+//     arguments.
+//   * If |Arg| >= 2^63, go to Step 10 for special handling.
+//
+//  Step 2. Reduction of moderate arguments.
+//
+//  If |Arg| < pi/4   ...quick branch
+//     N_fix := N_inc (integer)
+//     r     := Arg
+//     c     := 0.0
+//     Branch to Step 4, Case_1_complete
+//  Else    ...cf. argument reduction
+//     N     := Arg * two_by_PI (fp)
+//     N_fix := fcvt.fx( N )  (int)
+//     N     := fcvt.xf( N_fix )
+//     N_fix := N_fix + N_inc
+//     s     := Arg - N * P_1 (first piece of pi/2)
+//     w     := -N * P_2  (second piece of pi/2)
+//
+//     If |s| >= 2^(-33)
+//        go to Step 3, Case_1_reduce
+//     Else
+//        go to Step 7, Case_2_reduce
+//     Endif
+//  Endif
+//
+//  Step 3. Case_1_reduce.
+//
+//  r := s + w
+//  c := (s - r) + w  ...observe order
+//
+//  Step 4. Case_1_complete
+//
+//  ...At this point, the reduced argument alpha is
+//  ...accurately represented as r + c.
+//  If |r| < 2^(-3), go to Step 6, small_r.
+//
+//  Step 5. Normal_r.
+//
+//  Let [i_0 i_1] by the 2 lsb of N_fix.
+//  FR_rsq  := r * r
+//  r_hi := frcpa( frcpa( r ) )
+//  r_lo := r - r_hi
+//
+//  If i_1 = 0, then
+//    poly := r*FR_rsq*(PP_1_lo + FR_rsq*(PP_2 + ... FR_rsq*PP_8))
+//    U_hi := r + PP_1_hi*r_hi*r_hi*r_hi  ...any order
+//    U_lo := PP_1_hi*r_lo*(r*r + r*r_hi + r_hi*r_hi)
+//    correction := c + c*C_1*FR_rsq    ...any order
+//  Else
+//    poly := FR_rsq*FR_rsq*(QQ_2 + FR_rsq*(QQ_3 + ... + FR_rsq*QQ_8))
+//    U_hi := 1 + QQ_1 * r_hi * r_hi    ...any order
+//    U_lo := QQ_1 * r_lo * (r + r_hi)
+//    correction := -c*(r + S_1*FR_rsq*r) ...any order
+//  Endif
+//
+//  V := poly + (U_lo + correction) ...observe order
+//
+//  result := (i_0 == 0?   1.0 : -1.0)
+//
+//  Last instruction in user-set rounding mode
+//
+//  result := (i_0 == 0?   result*U_hi + V :
+//                        result*U_hi - V)
+//
+//  Return
+//
+//  Step 6. Small_r.
+//
+//  ...Use flush to zero mode without causing exception
+//    Let [i_0 i_1] be the two lsb of N_fix.
+//
+//  FR_rsq := r * r
+//
+//  If i_1 = 0 then
+//     z := FR_rsq*FR_rsq; z := FR_rsq*z *r
+//     poly_lo := S_3 + FR_rsq*(S_4 + FR_rsq*S_5)
+//     poly_hi := r*FR_rsq*(S_1 + FR_rsq*S_2)
+//     correction := c
+//     result := r
+//  Else
+//     z := FR_rsq*FR_rsq; z := FR_rsq*z
+//     poly_lo := C_3 + FR_rsq*(C_4 + FR_rsq*C_5)
+//     poly_hi := FR_rsq*(C_1 + FR_rsq*C_2)
+//     correction := -c*r
+//     result := 1
+//  Endif
+//
+//  poly := poly_hi + (z * poly_lo + correction)
+//
+//  If i_0 = 1, result := -result
+//
+//  Last operation. Perform in user-set rounding mode
+//
+//  result := (i_0 == 0?     result + poly :
+//                          result - poly )
+//  Return
+//
+//  Step 7. Case_2_reduce.
+//
+//  ...Refer to the write up for argument reduction for
+//  ...rationale. The reduction algorithm below is taken from
+//  ...argument reduction description and integrated this.
+//
+//  w := N*P_3
+//  U_1 := N*P_2 + w    ...FMA
+//  U_2 := (N*P_2 - U_1) + w  ...2 FMA
+//  ...U_1 + U_2 is  N*(P_2+P_3) accurately
+//
+//  r := s - U_1
+//  c := ( (s - r) - U_1 ) - U_2
+//
+//  ...The mathematical sum r + c approximates the reduced
+//  ...argument accurately. Note that although compared to
+//  ...Case 1, this case requires much more work to reduce
+//  ...the argument, the subsequent calculation needed for
+//  ...any of the trigonometric function is very little because
+//  ...|alpha| < 1.01*2^(-33) and thus two terms of the
+//  ...Taylor series expansion suffices.
+//
+//  If i_1 = 0 then
+//     poly := c + S_1 * r * r * r  ...any order
+//     result := r
+//  Else
+//     poly := -2^(-67)
+//     result := 1.0
+//  Endif
+//
+//  If i_0 = 1, result := -result
+//
+//  Last operation. Perform in user-set rounding mode
+//
+//  result := (i_0 == 0?     result + poly :
+//                           result - poly )
+//
+//  Return
+//
+//
+//  Step 8. Pre-reduction of large arguments.
+//
+//  ...Again, the following reduction procedure was described
+//  ...in the separate write up for argument reduction, which
+//  ...is tightly integrated here.
+
+//  N_0 := Arg * Inv_P_0
+//  N_0_fix := fcvt.fx( N_0 )
+//  N_0 := fcvt.xf( N_0_fix)
+
+//  Arg' := Arg - N_0 * P_0
+//  w := N_0 * d_1
+//  N := Arg' * two_by_PI
+//  N_fix := fcvt.fx( N )
+//  N := fcvt.xf( N_fix )
+//  N_fix := N_fix + N_inc
+//
+//  s := Arg' - N * P_1
+//  w := w - N * P_2
+//
+//  If |s| >= 2^(-14)
+//     go to Step 3
+//  Else
+//     go to Step 9
+//  Endif
+//
+//  Step 9. Case_4_reduce.
+//
+//    ...first obtain N_0*d_1 and -N*P_2 accurately
+//   U_hi := N_0 * d_1    V_hi := -N*P_2
+//   U_lo := N_0 * d_1 - U_hi V_lo := -N*P_2 - U_hi ...FMAs
+//
+//   ...compute the contribution from N_0*d_1 and -N*P_3
+//   w := -N*P_3
+//   w := w + N_0*d_2
+//   t := U_lo + V_lo + w   ...any order
+//
+//   ...at this point, the mathematical value
+//   ...s + U_hi + V_hi  + t approximates the true reduced argument
+//   ...accurately. Just need to compute this accurately.
+//
+//   ...Calculate U_hi + V_hi accurately:
+//   A := U_hi + V_hi
+//   if |U_hi| >= |V_hi| then
+//      a := (U_hi - A) + V_hi
+//   else
+//      a := (V_hi - A) + U_hi
+//   endif
+//   ...order in computing "a" must be observed. This branch is
+//   ...best implemented by predicates.
+//   ...A + a  is U_hi + V_hi accurately. Moreover, "a" is
+//   ...much smaller than A: |a| <= (1/2)ulp(A).
+//
+//   ...Just need to calculate   s + A + a + t
+//   C_hi := s + A    t := t + a
+//   C_lo := (s - C_hi) + A
+//   C_lo := C_lo + t
+//
+//   ...Final steps for reduction
+//   r := C_hi + C_lo
+//   c := (C_hi - r) + C_lo
+//
+//   ...At this point, we have r and c
+//   ...And all we need is a couple of terms of the corresponding
+//   ...Taylor series.
+//
+//   If i_1 = 0
+//      poly := c + r*FR_rsq*(S_1 + FR_rsq*S_2)
+//      result := r
+//   Else
+//      poly := FR_rsq*(C_1 + FR_rsq*C_2)
+//      result := 1
+//   Endif
+//
+//   If i_0 = 1, result := -result
+//
+//   Last operation. Perform in user-set rounding mode
+//
+//   result := (i_0 == 0?     result + poly :
+//                            result - poly )
+//   Return
+//
+//   Large Arguments: For arguments above 2**63, a Payne-Hanek
+//   style argument reduction is used and pi_by_2 reduce is called.
+//
+
+
+RODATA
+.align 64
+
+LOCAL_OBJECT_START(FSINCOSL_CONSTANTS)
+
+sincosl_table_p:
+//data4 0x4E44152A, 0xA2F9836E, 0x00003FFE,0x00000000 // Inv_pi_by_2
+//data4 0xCE81B9F1, 0xC84D32B0, 0x00004016,0x00000000 // P_0
+//data4 0x2168C235, 0xC90FDAA2, 0x00003FFF,0x00000000 // P_1
+//data4 0xFC8F8CBB, 0xECE675D1, 0x0000BFBD,0x00000000 // P_2
+//data4 0xACC19C60, 0xB7ED8FBB, 0x0000BF7C,0x00000000 // P_3
+//data4 0xDBD171A1, 0x8D848E89, 0x0000BFBF,0x00000000 // d_1
+//data4 0x18A66F8E, 0xD5394C36, 0x0000BF7C,0x00000000 // d_2
+data8 0xA2F9836E4E44152A, 0x00003FFE // Inv_pi_by_2
+data8 0xC84D32B0CE81B9F1, 0x00004016 // P_0
+data8 0xC90FDAA22168C235, 0x00003FFF // P_1
+data8 0xECE675D1FC8F8CBB, 0x0000BFBD // P_2
+data8 0xB7ED8FBBACC19C60, 0x0000BF7C // P_3
+data8 0x8D848E89DBD171A1, 0x0000BFBF // d_1
+data8 0xD5394C3618A66F8E, 0x0000BF7C // d_2
+LOCAL_OBJECT_END(FSINCOSL_CONSTANTS)
+
+LOCAL_OBJECT_START(sincosl_table_d)
+//data4 0x2168C234, 0xC90FDAA2, 0x00003FFE,0x00000000 // pi_by_4
+//data4 0x6EC6B45A, 0xA397E504, 0x00003FE7,0x00000000 // Inv_P_0
+data8 0xC90FDAA22168C234, 0x00003FFE // pi_by_4
+data8 0xA397E5046EC6B45A, 0x00003FE7 // Inv_P_0
+data4 0x3E000000, 0xBE000000         // 2^-3 and -2^-3
+data4 0x2F000000, 0xAF000000         // 2^-33 and -2^-33
+data4 0x9E000000, 0x00000000         // -2^-67
+data4 0x00000000, 0x00000000         // pad
+LOCAL_OBJECT_END(sincosl_table_d)
+
+LOCAL_OBJECT_START(sincosl_table_pp)
+//data4 0xA21C0BC9, 0xCC8ABEBC, 0x00003FCE,0x00000000 // PP_8
+//data4 0x720221DA, 0xD7468A05, 0x0000BFD6,0x00000000 // PP_7
+//data4 0x640AD517, 0xB092382F, 0x00003FDE,0x00000000 // PP_6
+//data4 0xD1EB75A4, 0xD7322B47, 0x0000BFE5,0x00000000 // PP_5
+//data4 0xFFFFFFFE, 0xFFFFFFFF, 0x0000BFFD,0x00000000 // C_1
+//data4 0x00000000, 0xAAAA0000, 0x0000BFFC,0x00000000 // PP_1_hi
+//data4 0xBAF69EEA, 0xB8EF1D2A, 0x00003FEC,0x00000000 // PP_4
+//data4 0x0D03BB69, 0xD00D00D0, 0x0000BFF2,0x00000000 // PP_3
+//data4 0x88888962, 0x88888888, 0x00003FF8,0x00000000 // PP_2
+//data4 0xAAAB0000, 0xAAAAAAAA, 0x0000BFEC,0x00000000 // PP_1_lo
+data8 0xCC8ABEBCA21C0BC9, 0x00003FCE // PP_8
+data8 0xD7468A05720221DA, 0x0000BFD6 // PP_7
+data8 0xB092382F640AD517, 0x00003FDE // PP_6
+data8 0xD7322B47D1EB75A4, 0x0000BFE5 // PP_5
+data8 0xFFFFFFFFFFFFFFFE, 0x0000BFFD // C_1
+data8 0xAAAA000000000000, 0x0000BFFC // PP_1_hi
+data8 0xB8EF1D2ABAF69EEA, 0x00003FEC // PP_4
+data8 0xD00D00D00D03BB69, 0x0000BFF2 // PP_3
+data8 0x8888888888888962, 0x00003FF8 // PP_2
+data8 0xAAAAAAAAAAAB0000, 0x0000BFEC // PP_1_lo
+LOCAL_OBJECT_END(sincosl_table_pp)
+
+LOCAL_OBJECT_START(sincosl_table_qq)
+//data4 0xC2B0FE52, 0xD56232EF, 0x00003FD2 // QQ_8
+//data4 0x2B48DCA6, 0xC9C99ABA, 0x0000BFDA // QQ_7
+//data4 0x9C716658, 0x8F76C650, 0x00003FE2 // QQ_6
+//data4 0xFDA8D0FC, 0x93F27DBA, 0x0000BFE9 // QQ_5
+//data4 0xAAAAAAAA, 0xAAAAAAAA, 0x0000BFFC // S_1
+//data4 0x00000000, 0x80000000, 0x0000BFFE,0x00000000 // QQ_1
+//data4 0x0C6E5041, 0xD00D00D0, 0x00003FEF,0x00000000 // QQ_4
+//data4 0x0B607F60, 0xB60B60B6, 0x0000BFF5,0x00000000 // QQ_3
+//data4 0xAAAAAA9B, 0xAAAAAAAA, 0x00003FFA,0x00000000 // QQ_2
+data8 0xD56232EFC2B0FE52, 0x00003FD2 // QQ_8
+data8 0xC9C99ABA2B48DCA6, 0x0000BFDA // QQ_7
+data8 0x8F76C6509C716658, 0x00003FE2 // QQ_6
+data8 0x93F27DBAFDA8D0FC, 0x0000BFE9 // QQ_5
+data8 0xAAAAAAAAAAAAAAAA, 0x0000BFFC // S_1
+data8 0x8000000000000000, 0x0000BFFE // QQ_1
+data8 0xD00D00D00C6E5041, 0x00003FEF // QQ_4
+data8 0xB60B60B60B607F60, 0x0000BFF5 // QQ_3
+data8 0xAAAAAAAAAAAAAA9B, 0x00003FFA // QQ_2
+LOCAL_OBJECT_END(sincosl_table_qq)
+
+LOCAL_OBJECT_START(sincosl_table_c)
+//data4 0xFFFFFFFE, 0xFFFFFFFF, 0x0000BFFD,0x00000000 // C_1
+//data4 0xAAAA719F, 0xAAAAAAAA, 0x00003FFA,0x00000000 // C_2
+//data4 0x0356F994, 0xB60B60B6, 0x0000BFF5,0x00000000 // C_3
+//data4 0xB2385EA9, 0xD00CFFD5, 0x00003FEF,0x00000000 // C_4
+//data4 0x292A14CD, 0x93E4BD18, 0x0000BFE9,0x00000000 // C_5
+data8 0xFFFFFFFFFFFFFFFE, 0x0000BFFD // C_1
+data8 0xAAAAAAAAAAAA719F, 0x00003FFA // C_2
+data8 0xB60B60B60356F994, 0x0000BFF5 // C_3
+data8 0xD00CFFD5B2385EA9, 0x00003FEF // C_4
+data8 0x93E4BD18292A14CD, 0x0000BFE9 // C_5
+LOCAL_OBJECT_END(sincosl_table_c)
+
+LOCAL_OBJECT_START(sincosl_table_s)
+//data4 0xAAAAAAAA, 0xAAAAAAAA, 0x0000BFFC,0x00000000 // S_1
+//data4 0x888868DB, 0x88888888, 0x00003FF8,0x00000000 // S_2
+//data4 0x055EFD4B, 0xD00D00D0, 0x0000BFF2,0x00000000 // S_3
+//data4 0x839730B9, 0xB8EF1C5D, 0x00003FEC,0x00000000 // S_4
+//data4 0xE5B3F492, 0xD71EA3A4, 0x0000BFE5,0x00000000 // S_5
+data8 0xAAAAAAAAAAAAAAAA, 0x0000BFFC // S_1
+data8 0x88888888888868DB, 0x00003FF8 // S_2
+data8 0xD00D00D0055EFD4B, 0x0000BFF2 // S_3
+data8 0xB8EF1C5D839730B9, 0x00003FEC // S_4
+data8 0xD71EA3A4E5B3F492, 0x0000BFE5 // S_5
+data4 0x38800000, 0xB8800000         // two**-14 and -two**-14
+LOCAL_OBJECT_END(sincosl_table_s)
+
+FR_Input_X        = f8
+FR_Result         = f8
+FR_ResultS        = f9
+FR_ResultC        = f8
+FR_r              = f8
+FR_c              = f9
+
+FR_norm_x         = f9
+FR_inv_pi_2to63   = f10
+FR_rshf_2to64     = f11
+FR_2tom64         = f12
+FR_rshf           = f13
+FR_N_float_signif = f14
+FR_abs_x          = f15
+
+FR_r6             = f32
+FR_r7             = f33
+FR_Pi_by_4        = f34
+FR_Two_to_M14     = f35
+FR_Neg_Two_to_M14 = f36
+FR_Two_to_M33     = f37
+FR_Neg_Two_to_M33 = f38
+FR_Neg_Two_to_M67 = f39
+FR_Inv_pi_by_2    = f40
+FR_N_float        = f41
+FR_N_fix          = f42
+FR_P_1            = f43
+FR_P_2            = f44
+FR_P_3            = f45
+FR_s              = f46
+FR_w              = f47
+FR_Z              = f50
+FR_A              = f51
+FR_a              = f52
+FR_t              = f53
+FR_U_1            = f54
+FR_U_2            = f55
+FR_C_1            = f56
+FR_C_2            = f57
+FR_C_3            = f58
+FR_C_4            = f59
+FR_C_5            = f60
+FR_S_1            = f61
+FR_S_2            = f62
+FR_S_3            = f63
+FR_S_4            = f64
+FR_S_5            = f65
+FR_r_hi           = f68
+FR_r_lo           = f69
+FR_rsq            = f70
+FR_r_cubed        = f71
+FR_C_hi           = f72
+FR_N_0            = f73
+FR_d_1            = f74
+FR_V_hi           = f75
+FR_V_lo           = f76
+FR_U_hi           = f77
+FR_U_lo           = f78
+FR_U_hiabs        = f79
+FR_V_hiabs        = f80
+FR_PP_8           = f81
+FR_QQ_8           = f101
+FR_PP_7           = f82
+FR_QQ_7           = f102
+FR_PP_6           = f83
+FR_QQ_6           = f103
+FR_PP_5           = f84
+FR_QQ_5           = f104
+FR_PP_4           = f85
+FR_QQ_4           = f105
+FR_PP_3           = f86
+FR_QQ_3           = f106
+FR_PP_2           = f87
+FR_QQ_2           = f107
+FR_QQ_1           = f108
+FR_r_hi_sq        = f88
+FR_N_0_fix        = f89
+FR_Inv_P_0        = f90
+FR_d_2            = f93
+FR_P_0            = f95
+FR_C_lo           = f96
+FR_PP_1           = f97
+FR_PP_1_lo        = f98
+FR_ArgPrime       = f99
+FR_inexact        = f100
+
+FR_Neg_Two_to_M3  = f109
+FR_Two_to_M3      = f110
+
+FR_poly_hiS       = f66
+FR_poly_hiC       = f112
+
+FR_poly_loS       = f67
+FR_poly_loC       = f113
+
+FR_polyS          = f92
+FR_polyC          = f114
+
+FR_cS             = FR_c
+FR_cC             = f115
+
+FR_corrS          = f91
+FR_corrC          = f116
+
+FR_U_hiC          = f117
+FR_U_loC          = f118
+
+FR_VS             = f75
+FR_VC             = f119
+
+FR_FirstS         = f120
+FR_FirstC         = f121
+
+FR_U_hiS          = FR_U_hi
+FR_U_loS          = FR_U_lo
+
+FR_Tmp            = f94
+
+
+
+
+sincos_pResSin = r34
+sincos_pResCos = r35
+
+GR_exp_m2_to_m3= r36
+GR_N_Inc       = r37
+GR_Cis         = r38
+GR_signexp_x   = r40
+GR_exp_x       = r40
+GR_exp_mask    = r41
+GR_exp_2_to_63 = r42
+GR_exp_2_to_m3 = r43
+GR_exp_2_to_24 = r44
+
+GR_N_SignS     = r45
+GR_N_SignC     = r46
+GR_N_SinCos    = r47
+
+GR_sig_inv_pi  = r48
+GR_rshf_2to64  = r49
+GR_exp_2tom64  = r50
+GR_rshf        = r51
+GR_ad_p        = r52
+GR_ad_d        = r53
+GR_ad_pp       = r54
+GR_ad_qq       = r55
+GR_ad_c        = r56
+GR_ad_s        = r57
+GR_ad_ce       = r58
+GR_ad_se       = r59
+GR_ad_m14      = r60
+GR_ad_s1       = r61
+
+// For unwind support
+GR_SAVE_B0     = r39
+GR_SAVE_GP     = r40
+GR_SAVE_PFS    = r41
+
+
+.section .text
+
+GLOBAL_IEEE754_ENTRY(sincosl)
+{ .mlx  ///////////////////////////// 1 /////////////////
+      alloc r32 = ar.pfs,3,27,2,0
+      movl GR_sig_inv_pi = 0xa2f9836e4e44152a // significand of 1/pi
+}
+{ .mlx
+      mov GR_N_Inc = 0x0
+      movl GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+64)
+};;
+
+{ .mfi ///////////////////////////// 2 /////////////////
+      addl           GR_ad_p   = @ltoff(FSINCOSL_CONSTANTS#), gp
+      fclass.m p6, p0 =  FR_Input_X, 0x1E3 // Test x natval, nan, inf
+      mov GR_exp_2_to_m3 = 0xffff - 3      // Exponent of 2^-3
+}
+{ .mfb
+      mov GR_Cis = 0x0
+      fnorm.s1 FR_norm_x = FR_Input_X      // Normalize x
+    br.cond.sptk _COMMON_SINCOSL
+};;
+GLOBAL_IEEE754_END(sincosl)
+
+GLOBAL_LIBM_ENTRY(__libm_sincosl)
+{ .mlx  ///////////////////////////// 1 /////////////////
+      alloc r32 = ar.pfs,3,27,2,0
+      movl GR_sig_inv_pi = 0xa2f9836e4e44152a // significand of 1/pi
+}
+{ .mlx
+      mov GR_N_Inc = 0x0
+      movl GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+64)
+};;
+
+{ .mfi ///////////////////////////// 2 /////////////////
+      addl           GR_ad_p   = @ltoff(FSINCOSL_CONSTANTS#), gp
+      fclass.m p6, p0 =  FR_Input_X, 0x1E3 // Test x natval, nan, inf
+      mov GR_exp_2_to_m3 = 0xffff - 3      // Exponent of 2^-3
+}
+{ .mfb
+      mov GR_Cis = 0x1
+      fnorm.s1 FR_norm_x = FR_Input_X      // Normalize x
+      nop.b 0
+};;
+
+_COMMON_SINCOSL:
+{ .mfi ///////////////////////////// 3 /////////////////
+      setf.sig FR_inv_pi_2to63 = GR_sig_inv_pi // Form 1/pi * 2^63
+      nop.f 0
+      mov GR_exp_2tom64 = 0xffff - 64      // Scaling constant to compute N
+}
+{ .mlx
+      setf.d FR_rshf_2to64 = GR_rshf_2to64    // Form const 1.1000 * 2^(63+64)
+      movl GR_rshf = 0x43e8000000000000       // Form const 1.1000 * 2^63
+};;
+
+{ .mfi ///////////////////////////// 4 /////////////////
+      ld8 GR_ad_p = [GR_ad_p]              // Point to Inv_pi_by_2
+      fclass.m p7, p0 = FR_Input_X, 0x0b   // Test x denormal
+      nop.i 0
+};;
+
+{ .mfi    ///////////////////////////// 5 /////////////////
+      getf.exp GR_signexp_x = FR_Input_X   // Get sign and exponent of x
+      fclass.m p10, p0 = FR_Input_X, 0x007 // Test x zero
+      nop.i 0
+}
+{ .mib
+      mov GR_exp_mask = 0x1ffff            // Exponent mask
+      nop.i 0
+(p6)  br.cond.spnt SINCOSL_SPECIAL         // Branch if x natval, nan, inf
+};;
+
+{ .mfi ///////////////////////////// 6 /////////////////
+      setf.exp FR_2tom64 = GR_exp_2tom64   // Form 2^-64 for scaling N_float
+      nop.f 0
+      add GR_ad_d = 0x70, GR_ad_p          // Point to constant table d
+}
+{ .mib
+      setf.d FR_rshf = GR_rshf         // Form right shift const 1.1000 * 2^63
+      mov  GR_exp_m2_to_m3 = 0x2fffc       // Form -(2^-3)
+(p7)  br.cond.spnt SINCOSL_DENORMAL        // Branch if x denormal
+};;
+
+SINCOSL_COMMON2:
+{ .mfi ///////////////////////////// 7 /////////////////
+      and GR_exp_x = GR_exp_mask, GR_signexp_x // Get exponent of x
+      fclass.nm p8, p0 = FR_Input_X, 0x1FF // Test x unsupported type
+      mov GR_exp_2_to_63 = 0xffff + 63     // Exponent of 2^63
+}
+{ .mib
+      add GR_ad_pp = 0x40, GR_ad_d         // Point to constant table pp
+      mov GR_exp_2_to_24 = 0xffff + 24     // Exponent of 2^24
+(p10) br.cond.spnt SINCOSL_ZERO            // Branch if x zero
+};;
+
+{ .mfi ///////////////////////////// 8 /////////////////
+      ldfe FR_Inv_pi_by_2 = [GR_ad_p], 16  // Load 2/pi
+      fcmp.eq.s0 p15, p0 = FR_Input_X, f0  // Dummy to set denormal
+      add GR_ad_qq = 0xa0, GR_ad_pp        // Point to constant table qq
+}
+{ .mfi
+      ldfe FR_Pi_by_4 = [GR_ad_d], 16      // Load pi/4 for range test
+      nop.f 0
+      cmp.ge p10,p0 = GR_exp_x, GR_exp_2_to_63   // Is |x| >= 2^63
+};;
+
+{ .mfi ///////////////////////////// 9 /////////////////
+      ldfe FR_P_0 = [GR_ad_p], 16          // Load P_0 for pi/4 <= |x| < 2^63
+      fmerge.s FR_abs_x = f1, FR_norm_x    // |x|
+      add GR_ad_c = 0x90, GR_ad_qq         // Point to constant table c
+}
+{ .mfi
+      ldfe FR_Inv_P_0 = [GR_ad_d], 16      // Load 1/P_0 for pi/4 <= |x| < 2^63
+      nop.f 0
+      cmp.ge p7,p0 = GR_exp_x, GR_exp_2_to_24   // Is |x| >= 2^24
+};;
+
+{ .mfi ///////////////////////////// 10 /////////////////
+      ldfe FR_P_1 = [GR_ad_p], 16          // Load P_1 for pi/4 <= |x| < 2^63
+      nop.f 0
+      add GR_ad_s = 0x50, GR_ad_c          // Point to constant table s
+}
+{ .mfi
+      ldfe FR_PP_8 = [GR_ad_pp], 16        // Load PP_8 for 2^-3 < |r| < pi/4
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi ///////////////////////////// 11 /////////////////
+      ldfe FR_P_2 = [GR_ad_p], 16          // Load P_2 for pi/4 <= |x| < 2^63
+      nop.f 0
+      add GR_ad_ce = 0x40, GR_ad_c         // Point to end of constant table c
+}
+{ .mfi
+      ldfe FR_QQ_8 = [GR_ad_qq], 16        // Load QQ_8 for 2^-3 < |r| < pi/4
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi ///////////////////////////// 12 /////////////////
+      ldfe FR_QQ_7 = [GR_ad_qq], 16        // Load QQ_7 for 2^-3 < |r| < pi/4
+      fma.s1  FR_N_float_signif = FR_Input_X, FR_inv_pi_2to63, FR_rshf_2to64
+      add GR_ad_se = 0x40, GR_ad_s         // Point to end of constant table s
+}
+{ .mib
+      ldfe FR_PP_7 = [GR_ad_pp], 16        // Load PP_7 for 2^-3 < |r| < pi/4
+      mov GR_ad_s1 = GR_ad_s               // Save pointer to S_1
+(p10) br.cond.spnt SINCOSL_ARG_TOO_LARGE   // Branch if |x| >= 2^63
+                                           // Use Payne-Hanek Reduction
+};;
+
+{ .mfi ///////////////////////////// 13 /////////////////
+      ldfe FR_P_3 = [GR_ad_p], 16          // Load P_3 for pi/4 <= |x| < 2^63
+      fmerge.se FR_r = FR_norm_x, FR_norm_x // r = x, in case |x| < pi/4
+      add GR_ad_m14 = 0x50, GR_ad_s        // Point to constant table m14
+}
+{ .mfb
+      ldfps FR_Two_to_M3, FR_Neg_Two_to_M3 = [GR_ad_d], 8
+      fma.s1 FR_rsq = FR_norm_x, FR_norm_x, f0 // rsq = x*x, in case |x| < pi/4
+(p7)  br.cond.spnt SINCOSL_LARGER_ARG      // Branch if 2^24 <= |x| < 2^63
+                                           // Use pre-reduction
+};;
+
+{ .mmf ///////////////////////////// 14 /////////////////
+      ldfe FR_PP_6 = [GR_ad_pp], 16       // Load PP_6 for normal path
+      ldfe FR_QQ_6 = [GR_ad_qq], 16       // Load QQ_6 for normal path
+      fmerge.se FR_c = f0, f0             // c = 0 in case |x| < pi/4
+};;
+
+{ .mmf ///////////////////////////// 15 /////////////////
+      ldfe FR_PP_5 = [GR_ad_pp], 16       // Load PP_5 for normal path
+      ldfe FR_QQ_5 = [GR_ad_qq], 16       // Load QQ_5 for normal path
+      nop.f 0
+};;
+
+// Here if 0 < |x| < 2^24
+{ .mfi ///////////////////////////// 17 /////////////////
+      ldfe FR_S_5 = [GR_ad_se], -16       // Load S_5 if i_1=0
+      fcmp.lt.s1  p6, p7 = FR_abs_x, FR_Pi_by_4  // Test |x| < pi/4
+      nop.i 0
+}
+{ .mfi
+      ldfe FR_C_5 = [GR_ad_ce], -16       // Load C_5 if i_1=1
+      fms.s1 FR_N_float = FR_N_float_signif, FR_2tom64, FR_rshf
+      nop.i 0
+};;
+
+{ .mmi ///////////////////////////// 18 /////////////////
+      ldfe FR_S_4 = [GR_ad_se], -16       // Load S_4 if i_1=0
+      ldfe FR_C_4 = [GR_ad_ce], -16       // Load C_4 if i_1=1
+      nop.i 0
+};;
+
+//
+//     N  = Arg * 2/pi
+//     Check if Arg < pi/4
+//
+//
+//     Case 2: Convert integer N_fix back to normalized floating-point value.
+//     Case 1: p8 is only affected  when p6 is set
+//
+//
+//     Grab the integer part of N and call it N_fix
+//
+{ .mfi ///////////////////////////// 19 /////////////////
+(p7)  ldfps FR_Two_to_M33, FR_Neg_Two_to_M33 = [GR_ad_d], 8
+(p6)  fma.s1 FR_r_cubed = FR_r, FR_rsq, f0        // r^3 if |x| < pi/4
+(p6)  mov GR_N_Inc = 0x0                         // N_IncS if |x| < pi/4
+};;
+
+//     If |x| < pi/4, r = x and c = 0
+//     lf |x| < pi/4, is x < 2**(-3).
+//     r = Arg
+//     c = 0
+{ .mmi ///////////////////////////// 20 /////////////////
+(p7)  getf.sig  GR_N_Inc = FR_N_float_signif
+      nop.m 0
+(p6)  cmp.lt.unc p8,p0 = GR_exp_x, GR_exp_2_to_m3   // Is |x| < 2^-3
+};;
+
+//
+//     lf |x| < pi/4, is -2**(-3)< x < 2**(-3) - set p8.
+//     If |x| >= pi/4,
+//     Create the right N for |x| < pi/4 and otherwise
+//     Case 2: Place integer part of N in GP register
+//
+
+{ .mbb ///////////////////////////// 21 /////////////////
+      nop.m 0
+(p8)  br.cond.spnt SINCOSL_SMALL_R_0    // Branch if 0 < |x| < 2^-3
+(p6)  br.cond.spnt SINCOSL_NORMAL_R_0   // Branch if 2^-3 <= |x| < pi/4
+};;
+
+// Here if pi/4 <= |x| < 2^24
+{ .mfi
+      ldfs FR_Neg_Two_to_M67 = [GR_ad_d], 8     // Load -2^-67
+      fnma.s1 FR_s = FR_N_float, FR_P_1, FR_Input_X // s = -N * P_1  + Arg
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_w = FR_N_float, FR_P_2, f0      // w = N * P_2
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1 FR_r = FR_s, f1, FR_w        // r = s - w, assume |s| >= 2^-33
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fcmp.lt.s1 p7, p6 = FR_s, FR_Two_to_M33
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p7)  fcmp.gt.s1 p7, p6 = FR_s, FR_Neg_Two_to_M33 // p6 if |s| >= 2^-33, else p7
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1 FR_c = FR_s, f1, FR_r             // c = s - r, for |s| >= 2^-33
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_rsq = FR_r, FR_r, f0           // rsq = r * r, for |s| >= 2^-33
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p7)  fma.s1 FR_w = FR_N_float, FR_P_3, f0
+      nop.i 0
+};;
+
+{ .mmf
+      ldfe FR_C_1 = [GR_ad_pp], 16     // Load C_1 if i_1=0
+      ldfe FR_S_1 = [GR_ad_qq], 16     // Load S_1 if i_1=1
+      frcpa.s1 FR_r_hi, p15 = f1, FR_r  // r_hi = frcpa(r)
+};;
+
+{ .mfi
+      nop.m 0
+(p6)  fcmp.lt.unc.s1 p8, p13 = FR_r, FR_Two_to_M3 // If big s, test r with 2^-3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p7)  fma.s1 FR_U_1 = FR_N_float, FR_P_2, FR_w
+      nop.i 0
+};;
+
+//
+//     For big s: r = s - w: No futher reduction is necessary
+//     For small s: w = N * P_3 (change sign) More reduction
+//
+{ .mfi
+    nop.m 0
+(p8)  fcmp.gt.s1 p8, p13 = FR_r, FR_Neg_Two_to_M3 // If big s, p8 if |r| < 2^-3
+    nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_rsq, FR_PP_8, FR_PP_7 // poly = rsq*PP_8+PP_7
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_QQ_8, FR_QQ_7 // poly = rsq*QQ_8+QQ_7
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p7)  fms.s1 FR_r = FR_s, f1, FR_U_1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p6)  fma.s1 FR_r_cubed = FR_r, FR_rsq, f0  // rcubed = r * rsq
+      nop.i 0
+};;
+
+{ .mfi
+//
+//     For big s: Is |r| < 2**(-3)?
+//     For big s: c = S - r
+//     For small s: U_1 = N * P_2 + w
+//
+//     If p8 is set, prepare to branch to Small_R.
+//     If p9 is set, prepare to branch to Normal_R.
+//     For big s,  r is complete here.
+//
+//
+//     For big s: c = c + w (w has not been negated.)
+//     For small s: r = S - U_1
+//
+      nop.m 0
+(p6)  fms.s1 FR_c = FR_c, f1, FR_w
+      nop.i 0
+}
+{ .mbb
+      nop.m 0
+(p8)  br.cond.spnt  SINCOSL_SMALL_R_1  // Branch if |s|>=2^-33, |r| < 2^-3,
+                                       // and pi/4 <= |x| < 2^24
+(p13) br.cond.sptk  SINCOSL_NORMAL_R_1 // Branch if |s|>=2^-33, |r| >= 2^-3,
+                                       // and pi/4 <= |x| < 2^24
+};;
+
+SINCOSL_S_TINY:
+//
+// Here if |s| < 2^-33, and pi/4 <= |x| < 2^24
+//
+{ .mfi
+       and GR_N_SinCos = 0x1, GR_N_Inc
+       fms.s1 FR_U_2 = FR_N_float, FR_P_2, FR_U_1
+       tbit.z p8,p12       = GR_N_Inc, 0
+};;
+
+
+//
+//     For small s: U_2 = N * P_2 - U_1
+//     S_1 stored constant - grab the one stored with the
+//     coefficients.
+//
+{ .mfi
+      ldfe      FR_S_1 = [GR_ad_s1], 16
+      fma.s1  FR_polyC = f0, f1, FR_Neg_Two_to_M67
+      sub GR_N_SignS =  GR_N_Inc, GR_N_SinCos
+}
+{ .mfi
+      add GR_N_SignC =  GR_N_Inc, GR_N_SinCos
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1  FR_s = FR_s, f1, FR_r
+(p8)  tbit.z.unc p10,p11   = GR_N_SignC, 1
+}
+{ .mfi
+      nop.m 0
+      fma.s1  FR_rsq = FR_r, FR_r, f0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1  FR_U_2 = FR_U_2, f1, FR_w
+(p8)  tbit.z.unc p8,p9    = GR_N_SignS, 1
+};;
+
+{ .mfi
+      nop.m 0
+      fmerge.se FR_FirstS = FR_r, FR_r
+(p12) tbit.z.unc p14,p15  = GR_N_SignC, 1
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_FirstC = f0, f1, f1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1  FR_c = FR_s, f1, FR_U_1
+(p12) tbit.z.unc p12,p13  = GR_N_SignS, 1
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1  FR_r = FR_S_1, FR_r, f0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s0  FR_S_1 = FR_S_1, FR_S_1, f0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1 FR_c = FR_c, f1, FR_U_2
+      nop.i 0
+};;
+
+.pred.rel "mutex",p9,p15
+{ .mfi
+      nop.m 0
+(p9)  fms.s0 FR_FirstS   = f1, f0, FR_FirstS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p15) fms.s0 FR_FirstS   = f1, f0, FR_FirstS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p11,p13
+{ .mfi
+      nop.m 0
+(p11) fms.s0 FR_FirstC   = f1, f0, FR_FirstC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p13) fms.s0 FR_FirstC   = f1, f0, FR_FirstC
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_r, FR_rsq, FR_c
+      nop.i 0
+};;
+
+
+.pred.rel "mutex",p8,p9
+{ .mfi
+      nop.m 0
+(p8)  fma.s0 FR_ResultS = FR_FirstS, f1, FR_polyS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p9)  fms.s0 FR_ResultS = FR_FirstS, f1, FR_polyS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p10,p11
+{ .mfi
+      nop.m 0
+(p10) fma.s0 FR_ResultC = FR_FirstC, f1, FR_polyC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fms.s0 FR_ResultC = FR_FirstC, f1, FR_polyC
+      nop.i 0
+};;
+
+
+
+.pred.rel "mutex",p12,p13
+{ .mfi
+      nop.m 0
+(p12) fma.s0 FR_ResultS = FR_FirstC, f1, FR_polyC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p13) fms.s0 FR_ResultS = FR_FirstC, f1, FR_polyC
+      nop.i 0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi
+      nop.m 0
+(p14) fma.s0 FR_ResultC = FR_FirstS, f1, FR_polyS
+      nop.i 0
+}
+{ .mfb
+      cmp.eq  p10, p0 = 0x1, GR_Cis
+(p15) fms.s0 FR_ResultC = FR_FirstS, f1, FR_polyS
+(p10) br.ret.sptk               b0
+};;
+
+{ .mmb       // exit for sincosl
+      stfe  [sincos_pResSin] =  FR_ResultS
+      stfe  [sincos_pResCos] =  FR_ResultC
+      br.ret.sptk               b0
+};;
+
+
+
+
+
+
+SINCOSL_LARGER_ARG:
+//
+// Here if 2^24 <= |x| < 2^63
+//
+{ .mfi
+      ldfe FR_d_1 = [GR_ad_p], 16          // Load d_1 for |x| >= 2^24 path
+      fma.s1 FR_N_0 = FR_Input_X, FR_Inv_P_0, f0 //     N_0 = Arg * Inv_P_0
+      nop.i 0
+};;
+
+{ .mmi
+      ldfps FR_Two_to_M14, FR_Neg_Two_to_M14 = [GR_ad_m14]
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe FR_d_2 = [GR_ad_p], 16          // Load d_2 for |x| >= 2^24 path
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fcvt.fx.s1 FR_N_0_fix = FR_N_0 // N_0_fix  = integer part of N_0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fcvt.xf FR_N_0 = FR_N_0_fix //     Make N_0 the integer part
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fnma.s1 FR_ArgPrime = FR_N_0, FR_P_0, FR_Input_X // Arg'=-N_0*P_0+Arg
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_w = FR_N_0, FR_d_1, f0 //     w  = N_0 * d_1
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_N_float = FR_ArgPrime, FR_Inv_pi_by_2, f0 //  N = A' * 2/pi
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fcvt.fx.s1 FR_N_fix = FR_N_float //     N_fix is the integer part
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fcvt.xf FR_N_float = FR_N_fix
+      nop.i 0
+};;
+
+{ .mfi
+      getf.sig GR_N_Inc = FR_N_fix // N is the integer part of
+                                 // the reduced-reduced argument
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fnma.s1 FR_s = FR_N_float, FR_P_1, FR_ArgPrime //     s = -N*P_1 + Arg'
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fnma.s1 FR_w = FR_N_float, FR_P_2, FR_w //     w = -N*P_2 + w
+      nop.i 0
+};;
+
+//
+//     For |s|  > 2**(-14) r = S + w (r complete)
+//     Else       U_hi = N_0 * d_1
+//
+{ .mfi
+      nop.m 0
+      fcmp.lt.unc.s1 p9, p8 = FR_s, FR_Two_to_M14
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p9)  fcmp.gt.s1 p9, p8 = FR_s, FR_Neg_Two_to_M14  // p9 if |s| < 2^-14
+      nop.i 0
+};;
+
+//
+//     Either S <= -2**(-14) or S >= 2**(-14)
+//     or -2**(-14) < s < 2**(-14)
+//
+{ .mfi
+      nop.m 0
+(p9)  fma.s1 FR_V_hi = FR_N_float, FR_P_2, f0
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p9)  fma.s1 FR_U_hi = FR_N_0, FR_d_1, f0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p8)  fma.s1 FR_r = FR_s, f1, FR_w
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p9)  fma.s1 FR_w = FR_N_float, FR_P_3, f0
+      nop.i 0
+};;
+
+//
+//    We need abs of both U_hi and V_hi - don't
+//    worry about switched sign of V_hi.
+//
+//    Big s: finish up c = (S - r) + w (c complete)
+//    Case 4: A =  U_hi + V_hi
+//    Note: Worry about switched sign of V_hi, so subtract instead of add.
+//
+{ .mfi
+      nop.m 0
+(p9)  fms.s1 FR_A = FR_U_hi, f1, FR_V_hi
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p9)  fnma.s1 FR_V_lo = FR_N_float, FR_P_2, FR_V_hi
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p9)  fmerge.s FR_V_hiabs = f0, FR_V_hi
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p9)  fms.s1 FR_U_lo = FR_N_0, FR_d_1, FR_U_hi // For small s: U_lo=N_0*d_1-U_hi
+      nop.i 0
+};;
+
+//
+//    For big s: Is |r| < 2**(-3)
+//    For big s: if p12 set, prepare to branch to Small_R.
+//    For big s: If p13 set, prepare to branch to Normal_R.
+//
+{ .mfi
+      nop.m 0
+(p9)  fmerge.s FR_U_hiabs = f0, FR_U_hi
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p8)  fms.s1 FR_c = FR_s, f1, FR_r  //     For big s: c = S - r
+      nop.i 0
+};;
+
+//
+//    For small S: V_hi = N * P_2
+//                 w = N * P_3
+//    Note the product does not include the (-) as in the writeup
+//    so (-) missing for V_hi and w.
+//
+{ .mfi
+      nop.m 0
+(p8)  fcmp.lt.unc.s1 p12, p13 = FR_r, FR_Two_to_M3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p12) fcmp.gt.s1 p12, p13 = FR_r, FR_Neg_Two_to_M3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p8)  fma.s1 FR_c = FR_c, f1, FR_w
+      nop.i 0
+}
+{ .mfb
+      nop.m 0
+(p9)  fms.s1 FR_w = FR_N_0, FR_d_2, FR_w
+(p12) br.cond.spnt SINCOSL_SMALL_R      // Branch if |r| < 2^-3
+                                        // and 2^24 <= |x| < 2^63
+};;
+
+{ .mib
+      nop.m 0
+      nop.i 0
+(p13) br.cond.sptk SINCOSL_NORMAL_R     // Branch if |r| >= 2^-3
+                                        // and 2^24 <= |x| < 2^63
+};;
+
+SINCOSL_LARGER_S_TINY:
+//    Here if |s| < 2^-14, and 2^24 <= |x| < 2^63
+//
+//    Big s: Vector off when |r| < 2**(-3).  Recall that p8 will be true.
+//    The remaining stuff is for Case 4.
+//    Small s: V_lo = N * P_2 + U_hi (U_hi is in place of V_hi in writeup)
+//    Note: the (-) is still missing for V_lo.
+//    Small s: w = w + N_0 * d_2
+//    Note: the (-) is now incorporated in w.
+//
+{ .mfi
+      and GR_N_SinCos = 0x1, GR_N_Inc
+      fcmp.ge.unc.s1 p6, p7 = FR_U_hiabs, FR_V_hiabs
+      tbit.z p8,p12       = GR_N_Inc, 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_t = FR_U_lo, f1, FR_V_lo //     C_hi = S + A
+      nop.i 0
+};;
+
+{ .mfi
+      sub GR_N_SignS =  GR_N_Inc, GR_N_SinCos
+(p6)  fms.s1 FR_a = FR_U_hi, f1, FR_A
+      add GR_N_SignC =  GR_N_Inc, GR_N_SinCos
+}
+{ .mfi
+      nop.m 0
+(p7)  fma.s1 FR_a = FR_V_hi, f1, FR_A
+      nop.i 0
+};;
+
+{ .mmf
+      ldfe FR_C_1 = [GR_ad_c], 16
+      ldfe  FR_S_1 = [GR_ad_s], 16
+      fma.s1 FR_C_hi = FR_s, f1, FR_A
+};;
+
+{ .mmi
+      ldfe FR_C_2 = [GR_ad_c], 64
+      ldfe FR_S_2 = [GR_ad_s], 64
+(p8)  tbit.z.unc p10,p11   = GR_N_SignC, 1
+};;
+
+//
+//    r and c have been computed.
+//    Make sure ftz mode is set - should be automatic when using wre
+//    |r| < 2**(-3)
+//    Get [i_0,i_1] - two lsb of N_fix.
+//
+//    For larger u than v: a = U_hi - A
+//    Else a = V_hi - A (do an add to account for missing (-) on V_hi
+//
+{ .mfi
+      nop.m 0
+      fma.s1 FR_t = FR_t, f1, FR_w //     t = t + w
+(p8)  tbit.z.unc p8,p9    = GR_N_SignS, 1
+}
+{ .mfi
+      nop.m 0
+(p6)  fms.s1 FR_a = FR_a, f1, FR_V_hi
+      nop.i 0
+};;
+
+//
+//     If u > v: a = (U_hi - A)  + V_hi
+//     Else      a = (V_hi - A)  + U_hi
+//     In each case account for negative missing from V_hi.
+//
+{ .mfi
+      nop.m 0
+      fms.s1 FR_C_lo = FR_s, f1, FR_C_hi
+(p12) tbit.z.unc p14,p15  = GR_N_SignC, 1
+}
+{ .mfi
+      nop.m 0
+(p7)  fms.s1 FR_a = FR_U_hi, f1, FR_a
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_C_lo = FR_C_lo, f1, FR_A //     C_lo = (S - C_hi) + A
+(p12) tbit.z.unc p12,p13  = GR_N_SignS, 1
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_t = FR_t, f1, FR_a //     t = t + a
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_r = FR_C_hi, f1, FR_C_lo
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_C_lo = FR_C_lo, f1, FR_t //     C_lo = C_lo + t
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_rsq = FR_r, FR_r, f0
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fms.s1 FR_c = FR_C_hi, f1, FR_r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_FirstS = f0, f1, FR_r
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_FirstC = f0, f1, f1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_rsq, FR_S_2, FR_S_1
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_C_2, FR_C_1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_r_cubed = FR_rsq, FR_r, f0
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_c = FR_c, f1, FR_C_lo
+      nop.i 0
+};;
+
+.pred.rel "mutex",p9,p15
+{ .mfi
+      nop.m 0
+(p9)  fms.s0 FR_FirstS   = f1, f0, FR_FirstS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p15) fms.s0 FR_FirstS   = f1, f0, FR_FirstS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p11,p13
+{ .mfi
+      nop.m 0
+(p11) fms.s0 FR_FirstC   = f1, f0, FR_FirstC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p13) fms.s0 FR_FirstC   = f1, f0, FR_FirstC
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_r_cubed, FR_polyS, FR_c
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, f0
+      nop.i 0
+};;
+
+
+
+.pred.rel "mutex",p8,p9
+{ .mfi
+      nop.m 0
+(p8)  fma.s0 FR_ResultS = FR_FirstS, f1, FR_polyS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p9)  fms.s0 FR_ResultS = FR_FirstS, f1, FR_polyS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p10,p11
+{ .mfi
+      nop.m 0
+(p10) fma.s0 FR_ResultC = FR_FirstC, f1, FR_polyC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fms.s0 FR_ResultC = FR_FirstC, f1, FR_polyC
+      nop.i 0
+};;
+
+
+
+.pred.rel "mutex",p12,p13
+{ .mfi
+      nop.m 0
+(p12) fma.s0 FR_ResultS = FR_FirstC, f1, FR_polyC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p13) fms.s0 FR_ResultS = FR_FirstC, f1, FR_polyC
+      nop.i 0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi
+      nop.m 0
+(p14) fma.s0 FR_ResultC = FR_FirstS, f1, FR_polyS
+      nop.i 0
+}
+{ .mfb
+      cmp.eq  p10, p0 = 0x1, GR_Cis
+(p15) fms.s0 FR_ResultC = FR_FirstS, f1, FR_polyS
+(p10) br.ret.sptk               b0
+};;
+
+
+{ .mmb       // exit for sincosl
+      stfe  [sincos_pResSin] =  FR_ResultS
+      stfe  [sincos_pResCos] =  FR_ResultC
+      br.ret.sptk               b0
+};;
+
+
+
+SINCOSL_SMALL_R:
+//
+// Here if |r| < 2^-3
+//
+// Enter with r, c, and N_Inc computed
+//
+{ .mfi
+      nop.m 0
+      fma.s1 FR_rsq = FR_r, FR_r, f0   // rsq = r * r
+      nop.i 0
+};;
+
+{ .mmi
+      ldfe FR_S_5 = [GR_ad_se], -16    // Load S_5
+      ldfe FR_C_5 = [GR_ad_ce], -16    // Load C_5
+      nop.i 0
+};;
+
+{ .mmi
+      ldfe FR_S_4 = [GR_ad_se], -16    // Load S_4
+      ldfe FR_C_4 = [GR_ad_ce], -16    // Load C_4
+      nop.i 0
+};;
+
+SINCOSL_SMALL_R_0:
+// Entry point for 2^-3 < |x| < pi/4
+SINCOSL_SMALL_R_1:
+// Entry point for pi/4 < |x| < 2^24 and |r| < 2^-3
+{ .mfi
+      ldfe   FR_S_3 = [GR_ad_se], -16    // Load S_3
+      fma.s1 FR_r6  = FR_rsq, FR_rsq, f0 // Z = rsq * rsq
+      tbit.z p7,p11       = GR_N_Inc, 0
+}
+{ .mfi
+      ldfe    FR_C_3 = [GR_ad_ce], -16   // Load C_3
+      nop.f 0
+      and GR_N_SinCos = 0x1, GR_N_Inc
+};;
+
+{ .mfi
+      ldfe   FR_S_2 = [GR_ad_se], -16    // Load S_2
+      fnma.s1 FR_cC = FR_c, FR_r, f0     // c = -c * r
+      sub GR_N_SignS =  GR_N_Inc, GR_N_SinCos
+}
+{ .mfi
+      ldfe   FR_C_2 = [GR_ad_ce], -16    // Load C_2
+      nop.f 0
+      add GR_N_SignC =  GR_N_Inc, GR_N_SinCos
+};;
+
+{ .mmi
+      ldfe FR_S_1 = [GR_ad_se], -16    // Load S_1
+      ldfe FR_C_1 = [GR_ad_ce], -16    // Load C_1
+(p7)  tbit.z.unc p9,p10   = GR_N_SignC, 1
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_r7 = FR_r6, FR_r, f0     // Z = Z * r
+(p7)  tbit.z.unc p7,p8    = GR_N_SignS, 1
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_loS = FR_rsq, FR_S_5, FR_S_4 // poly_lo=rsq*S_5+S_4
+(p11) tbit.z.unc p13,p14  = GR_N_SignC, 1
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_loC = FR_rsq, FR_C_5, FR_C_4 // poly_lo=rsq*C_5+C_4
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_hiS = FR_rsq, FR_S_2, FR_S_1 // poly_hi=rsq*S_2+S_1
+(p11) tbit.z.unc p11,p12  = GR_N_SignS, 1
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_hiC = FR_rsq, FR_C_2, FR_C_1 // poly_hi=rsq*C_2+C_1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s0 FR_FirstS = FR_r, f1, f0
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s0 FR_FirstC = f1, f1, f0
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_r6 = FR_r6, FR_rsq, f0
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_r7 = FR_r7, FR_rsq, f0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_loS = FR_rsq, FR_poly_loS, FR_S_3 // p_lo=p_lo*rsq+S_3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_loC = FR_rsq, FR_poly_loC, FR_C_3 // p_lo=p_lo*rsq+C_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s0 FR_inexact = FR_S_4, FR_S_4, f0     // Dummy op to set inexact
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_hiS = FR_poly_hiS, FR_rsq, f0     // p_hi=p_hi*rsq
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_hiC = FR_poly_hiC, FR_rsq, f0     // p_hi=p_hi*rsq
+      nop.i 0
+};;
+
+.pred.rel "mutex",p8,p14
+{ .mfi
+      nop.m 0
+(p8)  fms.s0 FR_FirstS   = f1, f0, FR_FirstS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p14) fms.s0 FR_FirstS   = f1, f0, FR_FirstS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p10,p12
+{ .mfi
+      nop.m 0
+(p10) fms.s0 FR_FirstC   = f1, f0, FR_FirstC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p12) fms.s0 FR_FirstC   = f1, f0, FR_FirstC
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_r7, FR_poly_loS, FR_cS        // poly=Z*poly_lo+c
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_r6, FR_poly_loC, FR_cC        // poly=Z*poly_lo+c
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_poly_hiS = FR_r, FR_poly_hiS, f0       // p_hi=r*p_hi
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_polyS, f1, FR_poly_hiS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_polyC, f1, FR_poly_hiC
+      nop.i 0
+};;
+
+.pred.rel "mutex",p7,p8
+{ .mfi
+      nop.m 0
+(p7)  fma.s0 FR_ResultS = FR_FirstS, f1, FR_polyS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p8)  fms.s0 FR_ResultS = FR_FirstS, f1, FR_polyS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p9,p10
+{ .mfi
+      nop.m 0
+(p9)  fma.s0 FR_ResultC = FR_FirstC, f1, FR_polyC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p10) fms.s0 FR_ResultC = FR_FirstC, f1, FR_polyC
+      nop.i 0
+};;
+
+.pred.rel "mutex",p11,p12
+{ .mfi
+      nop.m 0
+(p11) fma.s0 FR_ResultS = FR_FirstC, f1, FR_polyC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p12) fms.s0 FR_ResultS = FR_FirstC, f1, FR_polyC
+      nop.i 0
+};;
+
+.pred.rel "mutex",p13,p14
+{ .mfi
+      nop.m 0
+(p13) fma.s0 FR_ResultC = FR_FirstS, f1, FR_polyS
+      nop.i 0
+}
+{ .mfb
+      cmp.eq  p15, p0 = 0x1, GR_Cis
+(p14) fms.s0 FR_ResultC = FR_FirstS, f1, FR_polyS
+(p15) br.ret.sptk               b0
+};;
+
+
+{ .mmb       // exit for sincosl
+      stfe  [sincos_pResSin] =  FR_ResultS
+      stfe  [sincos_pResCos] =  FR_ResultC
+      br.ret.sptk               b0
+};;
+
+
+
+
+
+
+SINCOSL_NORMAL_R:
+//
+// Here if 2^-3 <= |r| < pi/4
+// THIS IS THE MAIN PATH
+//
+// Enter with r, c, and N_Inc having been computed
+//
+{ .mfi
+      ldfe FR_PP_6 = [GR_ad_pp], 16    // Load PP_6
+      fma.s1 FR_rsq = FR_r, FR_r, f0   // rsq = r * r
+      nop.i 0
+}
+{ .mfi
+      ldfe FR_QQ_6 = [GR_ad_qq], 16    // Load QQ_6
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mmi
+      ldfe FR_PP_5 = [GR_ad_pp], 16    // Load PP_5
+      ldfe FR_QQ_5 = [GR_ad_qq], 16    // Load QQ_5
+      nop.i 0
+};;
+
+
+
+SINCOSL_NORMAL_R_0:
+// Entry for 2^-3 < |x| < pi/4
+.pred.rel "mutex",p9,p10
+{ .mmf
+      ldfe FR_C_1 = [GR_ad_pp], 16     // Load C_1
+      ldfe FR_S_1 = [GR_ad_qq], 16     // Load S_1
+      frcpa.s1 FR_r_hi, p6 = f1, FR_r  // r_hi = frcpa(r)
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_rsq, FR_PP_8, FR_PP_7 // poly = rsq*PP_8+PP_7
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_QQ_8, FR_QQ_7 // poly = rsq*QQ_8+QQ_7
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_r_cubed = FR_r, FR_rsq, f0  // rcubed = r * rsq
+      nop.i 0
+};;
+
+
+SINCOSL_NORMAL_R_1:
+// Entry for pi/4 <= |x| < 2^24
+.pred.rel "mutex",p9,p10
+{ .mmf
+      ldfe FR_PP_1 = [GR_ad_pp], 16             // Load PP_1_hi
+      ldfe FR_QQ_1 = [GR_ad_qq], 16             // Load QQ_1
+      frcpa.s1 FR_r_hi, p6 = f1, FR_r_hi        // r_hi = frpca(frcpa(r))
+};;
+
+{ .mfi
+      ldfe FR_PP_4 = [GR_ad_pp], 16             // Load PP_4
+      fma.s1 FR_polyS = FR_rsq, FR_polyS, FR_PP_6 // poly = rsq*poly+PP_6
+      and GR_N_SinCos = 0x1, GR_N_Inc
+}
+{ .mfi
+      ldfe FR_QQ_4 = [GR_ad_qq], 16             // Load QQ_4
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, FR_QQ_6 // poly = rsq*poly+QQ_6
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_corrS = FR_C_1, FR_rsq, f0       // corr = C_1 * rsq
+      sub GR_N_SignS =  GR_N_Inc, GR_N_SinCos
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_corrC = FR_S_1, FR_r_cubed, FR_r // corr = S_1 * r^3 + r
+      add GR_N_SignC =  GR_N_Inc, GR_N_SinCos
+};;
+
+{ .mfi
+      ldfe FR_PP_3 = [GR_ad_pp], 16             // Load PP_3
+      fma.s1 FR_r_hi_sq = FR_r_hi, FR_r_hi, f0  // r_hi_sq = r_hi * r_hi
+      tbit.z p7,p11       = GR_N_Inc, 0
+}
+{ .mfi
+      ldfe FR_QQ_3 = [GR_ad_qq], 16             // Load QQ_3
+      fms.s1 FR_r_lo = FR_r, f1, FR_r_hi        // r_lo = r - r_hi
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe FR_PP_2 = [GR_ad_pp], 16             // Load PP_2
+      fma.s1 FR_polyS = FR_rsq, FR_polyS, FR_PP_5 // poly = rsq*poly+PP_5
+(p7)  tbit.z.unc p9,p10   = GR_N_SignC, 1
+}
+{ .mfi
+      ldfe FR_QQ_2 = [GR_ad_qq], 16             // Load QQ_2
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, FR_QQ_5 // poly = rsq*poly+QQ_5
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe FR_PP_1_lo = [GR_ad_pp], 16          // Load PP_1_lo
+      fma.s1 FR_corrS = FR_corrS, FR_c, FR_c      // corr = corr * c + c
+(p7)  tbit.z.unc p7,p8    = GR_N_SignS, 1
+}
+{ .mfi
+      nop.m 0
+      fnma.s1 FR_corrC = FR_corrC, FR_c, f0       // corr = -corr * c
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_loS = FR_r, FR_r_hi, FR_r_hi_sq // U_lo = r*r_hi+r_hi_sq
+(p11) tbit.z.unc p13,p14  = GR_N_SignC, 1
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_loC = FR_r_hi, f1, FR_r        // U_lo = r_hi + r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_hiS = FR_r_hi, FR_r_hi_sq, f0  // U_hi = r_hi*r_hi_sq
+(p11) tbit.z.unc p11,p12  = GR_N_SignS, 1
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_hiC = FR_QQ_1, FR_r_hi_sq, f1  // U_hi = QQ_1*r_hi_sq+1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_rsq, FR_polyS, FR_PP_4 // poly = poly*rsq+PP_4
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, FR_QQ_4 // poly = poly*rsq+QQ_4
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_loS = FR_r, FR_r, FR_U_loS      // U_lo = r * r + U_lo
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_loC = FR_r_lo, FR_U_loC, f0     // U_lo = r_lo * U_lo
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_hiS = FR_PP_1, FR_U_hiS, f0     // U_hi = PP_1 * U_hi
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_rsq, FR_polyS, FR_PP_3 // poly = poly*rsq+PP_3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, FR_QQ_3 // poly = poly*rsq+QQ_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_loS = FR_r_lo, FR_U_loS, f0     // U_lo = r_lo * U_lo
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_loC = FR_QQ_1,FR_U_loC, f0      // U_lo = QQ_1 * U_lo
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_hiS = FR_r, f1, FR_U_hiS        // U_hi = r + U_hi
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_rsq, FR_polyS, FR_PP_2 // poly = poly*rsq+PP_2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, FR_QQ_2 // poly = poly*rsq+QQ_2
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_U_loS = FR_PP_1, FR_U_loS, f0     // U_lo = PP_1 * U_lo
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_rsq, FR_polyS, FR_PP_1_lo // poly =poly*rsq+PP1lo
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, f0      // poly = poly*rsq
+      nop.i 0
+};;
+
+
+.pred.rel "mutex",p8,p14
+{ .mfi
+      nop.m 0
+(p8)  fms.s0 FR_U_hiS   = f1, f0, FR_U_hiS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p14) fms.s0 FR_U_hiS   = f1, f0, FR_U_hiS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p10,p12
+{ .mfi
+      nop.m 0
+(p10) fms.s0 FR_U_hiC   = f1, f0, FR_U_hiC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p12) fms.s0 FR_U_hiC   = f1, f0, FR_U_hiC
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_VS = FR_U_loS, f1, FR_corrS        // V = U_lo + corr
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_VC = FR_U_loC, f1, FR_corrC        // V = U_lo + corr
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s0 FR_inexact = FR_PP_5, FR_PP_4, f0  // Dummy op to set inexact
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyS = FR_r_cubed, FR_polyS, f0  // poly = poly*r^3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_polyC = FR_rsq, FR_polyC, f0      // poly = poly*rsq
+      nop.i 0
+};;
+
+
+{ .mfi
+      nop.m 0
+      fma.s1 FR_VS = FR_polyS, f1, FR_VS           // V = poly + V
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1 FR_VC = FR_polyC, f1, FR_VC           // V = poly + V
+      nop.i 0
+};;
+
+
+
+.pred.rel "mutex",p7,p8
+{ .mfi
+      nop.m 0
+(p7)  fma.s0 FR_ResultS = FR_U_hiS, f1, FR_VS
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p8)  fms.s0 FR_ResultS = FR_U_hiS, f1, FR_VS
+      nop.i 0
+};;
+
+.pred.rel "mutex",p9,p10
+{ .mfi
+      nop.m 0
+(p9)  fma.s0 FR_ResultC = FR_U_hiC, f1, FR_VC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p10) fms.s0 FR_ResultC = FR_U_hiC, f1, FR_VC
+      nop.i 0
+};;
+
+
+
+.pred.rel "mutex",p11,p12
+{ .mfi
+      nop.m 0
+(p11) fma.s0 FR_ResultS = FR_U_hiC, f1, FR_VC
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p12) fms.s0 FR_ResultS = FR_U_hiC, f1, FR_VC
+      nop.i 0
+};;
+
+.pred.rel "mutex",p13,p14
+{ .mfi
+      nop.m 0
+(p13) fma.s0 FR_ResultC = FR_U_hiS, f1, FR_VS
+      nop.i 0
+}
+{ .mfb
+      cmp.eq  p15, p0 = 0x1, GR_Cis
+(p14) fms.s0 FR_ResultC = FR_U_hiS, f1, FR_VS
+(p15) br.ret.sptk               b0
+};;
+
+{ .mmb       // exit for sincosl
+      stfe  [sincos_pResSin] =  FR_ResultS
+      stfe  [sincos_pResCos] =  FR_ResultC
+      br.ret.sptk               b0
+};;
+
+
+
+
+
+SINCOSL_ZERO:
+
+{ .mfi
+      nop.m 0
+      fmerge.s FR_ResultS = FR_Input_X, FR_Input_X // If sin, result = input
+      nop.i 0
+}
+{ .mfb
+      cmp.eq  p15, p0 = 0x1, GR_Cis
+      fma.s0 FR_ResultC = f1, f1, f0    // If cos, result=1.0
+(p15) br.ret.sptk               b0
+};;
+
+{ .mmb       // exit for sincosl
+      stfe  [sincos_pResSin] =  FR_ResultS
+      stfe  [sincos_pResCos] =  FR_ResultC
+      br.ret.sptk               b0
+};;
+
+
+SINCOSL_DENORMAL:
+{ .mmb
+      getf.exp GR_signexp_x = FR_norm_x   // Get sign and exponent of x
+      nop.m 999
+      br.cond.sptk  SINCOSL_COMMON2        // Return to common code
+}
+;;
+
+
+SINCOSL_SPECIAL:
+//
+//    Path for Arg = +/- QNaN, SNaN, Inf
+//    Invalid can be raised. SNaNs
+//    become QNaNs
+//
+{ .mfi
+      cmp.eq  p15, p0 = 0x1, GR_Cis
+      fmpy.s0 FR_ResultS = FR_Input_X, f0
+      nop.i 0
+}
+{ .mfb
+      nop.m 0
+      fmpy.s0 FR_ResultC = FR_Input_X, f0
+(p15) br.ret.sptk               b0
+};;
+
+{ .mmb       // exit for sincosl
+      stfe  [sincos_pResSin] =  FR_ResultS
+      stfe  [sincos_pResCos] =  FR_ResultC
+      br.ret.sptk               b0
+};;
+
+GLOBAL_LIBM_END(__libm_sincosl)
+
+
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
+//
+//     Special Code to handle very large argument case.
+//     Call int __libm_pi_by_2_reduce(x,r,c) for |arguments| >= 2**63
+//     The interface is custom:
+//       On input:
+//         (Arg or x) is in f8
+//       On output:
+//         r is in f8
+//         c is in f9
+//         N is in r8
+//     Be sure to allocate at least 2 GP registers as output registers for
+//     __libm_pi_by_2_reduce.  This routine uses r62-63. These are used as
+//     scratch registers within the __libm_pi_by_2_reduce routine (for speed).
+//
+//     We know also that __libm_pi_by_2_reduce preserves f10-15, f71-127.  We
+//     use this to eliminate save/restore of key fp registers in this calling
+//     function.
+//
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
+
+LOCAL_LIBM_ENTRY(__libm_callout)
+SINCOSL_ARG_TOO_LARGE:
+.prologue
+{ .mfi
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+};;
+
+{ .mmi
+        setf.exp FR_Two_to_M3 = GR_exp_2_to_m3  // Form 2^-3
+        mov GR_SAVE_GP=gp                       // Save gp
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
+};;
+
+.body
+//
+//     Call argument reduction with x in f8
+//     Returns with N in r8, r in f8, c in f9
+//     Assumes f71-127 are preserved across the call
+//
+{ .mib
+        setf.exp FR_Neg_Two_to_M3 = GR_exp_m2_to_m3 // Form -(2^-3)
+        nop.i 0
+        br.call.sptk b0=__libm_pi_by_2_reduce#
+};;
+
+{ .mfi
+        mov   GR_N_Inc = r8
+        fcmp.lt.unc.s1  p6, p0 = FR_r, FR_Two_to_M3
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+
+{ .mfi
+        mov   gp = GR_SAVE_GP                  // Restore gp
+(p6)    fcmp.gt.unc.s1  p6, p0 = FR_r, FR_Neg_Two_to_M3
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+};;
+
+{ .mbb
+  nop.m 0
+(p6)    br.cond.spnt SINCOSL_SMALL_R     // Branch if |r|< 2^-3 for |x| >= 2^63
+        br.cond.sptk SINCOSL_NORMAL_R    // Branch if |r|>=2^-3 for |x| >= 2^63
+};;
+
+LOCAL_LIBM_END(__libm_callout)
+
+.type   __libm_pi_by_2_reduce#,@function
+.global __libm_pi_by_2_reduce#
+
+
+
diff --git a/sysdeps/ia64/fpu/libm_support.h b/sysdeps/ia64/fpu/libm_support.h
index 5d3498dfc9..dc9c0a2648 100644
--- a/sysdeps/ia64/fpu/libm_support.h
+++ b/sysdeps/ia64/fpu/libm_support.h
@@ -1,9 +1,11 @@
-//
-// Copyright (C) 2000, 2001, Intel Corporation
+/* file: libm_support.h */
+
+
+/*
+// Copyright (c) 2000 - 2004, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -19,6 +21,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
+
 //
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -34,236 +37,76 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 
 // History: 02/02/2000 Initial version
 //          2/28/2000 added tags for logb and nextafter
-//          3/22/2000 Changes to support _LIB_VERSION variable
+//          3/22/2000 Changes to support _LIB_VERSIONIMF variable
 //                    and filled some enum gaps. Added support for C99.
 //          5/31/2000 added prototypes for __libm_frexp_4l/8l
-//          8/10/2000 Changed declaration of _LIB_VERSION to work for library
+//          8/10/2000 Changed declaration of _LIB_VERSIONIMF to work for library
 //                    builds and other application builds (precompiler directives).
 //          8/11/2000 Added pointers-to-matherr-functions declarations to allow
 //                    for user-defined matherr functions in the dll build.
 //         12/07/2000 Added scalbn error_types values.
+//          5/01/2001 Added error_types values for C99 nearest integer
+//                    functions.
+//          6/07/2001 Added error_types values for fdim.
+//          6/18/2001 Added include of complex_support.h.
+//          8/03/2001 Added error_types values for nexttoward, scalbln.
+//          8/23/2001 Corrected tag numbers from 186 and higher.
+//          8/27/2001 Added check for long int and long long int definitions.
+//         12/10/2001 Added error_types for erfc.
+//         12/27/2001 Added error_types for degree argument functions.
+//         01/02/2002 Added error_types for tand, cotd.
+//         01/04/2002 Delete include of complex_support.h
+//         01/23/2002 Deleted prototypes for __libm_frexp*.  Added check for
+//                    multiple int, long int, and long long int definitions.
+//         05/20/2002 Added error_types for cot.
+//         06/27/2002 Added error_types for sinhcosh.
+//         12/05/2002 Added error_types for annuity and compound
+//         04/10/2003 Added error_types for tgammal/tgamma/tgammaf
+//         05/16/2003 FP-treatment macros copied here from IA32 libm_support.h
+//         06/02/2003 Added pad into struct fp80 (12/16 bytes).
+//         08/01/2003 Added struct ker80 and macros for multiprecision addition,
+//                    subtraction, multiplication, division, square root.
+//         08/07/2003 History section updated.
+//         09/03/2003 ALIGN(n) macro added.
+//         10/01/2003 LDOUBLE_ALIGN and fp80 corrected on linux to 16 bytes.
+//         11/24/2004 Added ifdef around definitions of INT32/64
+//         12/15/2004 Added error_types for exp10, nextafter, nexttoward
+//                    underflow.  Moved error codes into libm_error_codes.h.
 //
+*/
 
-#ifndef __ASSEMBLER__
-#include <math.h>
-
-float __libm_frexp_4f( float x, int*  exp);
-float _GI___libm_frexp_4f( float x, int*  exp);
-float __libm_frexp_8f( float x, int*  exp);
-double __libm_frexp_4( double x, int*  exp);
-double _GI___libm_frexp_4( double x, int*  exp);
-double __libm_frexp_8( double x, int*  exp);
-long double __libm_frexp_4l( long double x, int*  exp);
-long double _GI___libm_frexp_4l( long double x, int*  exp);
-long double __libm_frexp_8l( long double x, int*  exp);
-void __libm_sincos_pi4(double,double*,double*,int);
-void __libm_y0y1(double , double *, double *);
-void __libm_j0j1(double , double *, double *);
-double __libm_lgamma_kernel(double,int*,int,int);
-double __libm_j0(double);
-double __libm_j1(double);
-double __libm_jn(int,double);
-double __libm_y0(double);
-double __libm_y1(double);
-double __libm_yn(int,double);
-
-extern double rint(double);
-extern double sqrt(double);
-extern double fabs(double);
-extern double log(double);
-extern double log1p(double);
-extern double sqrt(double);
-extern double sin(double);
-extern double exp(double);
-extern double modf(double, double *);
-extern double asinh(double);
-extern double acosh(double);
-extern double atanh(double);
-extern double tanh(double);
-extern double erf(double);
-extern double erfc(double);
-extern double j0(double);
-extern double j1(double);
-extern double jn(int, double);
-extern double y0(double);
-extern double y1(double);
-extern double yn(int, double);
-
-extern float  fabsf(float);
-extern float  asinhf(float);
-extern float  acoshf(float);
-extern float  atanhf(float);
-extern float  tanhf(float);
-extern float  erff(float);
-extern float  erfcf(float);
-extern float  j0f(float);
-extern float  j1f(float);
-extern float  jnf(int, float);
-extern float  y0f(float);
-extern float  y1f(float);
-extern float  ynf(int, float);
-
-extern long double log1pl(long double);
-extern long double logl(long double);
-extern long double sqrtl(long double);
-extern long double expl(long double);
-
-extern long lround(double);
-extern long lroundf(float);
-extern long lroundl(long double);
+#ifndef __LIBM_SUPPORT_H_INCLUDED__
+#define __LIBM_SUPPORT_H_INCLUDED__
 
-#if !(defined(SIZE_INT_32) || defined(SIZE_INT_64))
-    #error integer size not established; define SIZE_INT_32 or SIZE_INT_64
+#ifndef _LIBC
+#if !(defined(_WIN32) || defined(_WIN64))
+# pragma const_seg(".rodata") /* place constant data in text (code) section */
 #endif
 
-struct fp64 { /*/ sign:1 exponent:11 significand:52 (implied leading 1)*/
-  unsigned lo_significand:32;
-  unsigned hi_significand:20;
-  unsigned exponent:11;
-  unsigned sign:1;
-};
+#if defined(__ICC) || defined(__ICL) || defined(__ECC) || defined(__ECL)
+# pragma warning( disable : 1682 )	/* #1682: ixplicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) */
+# pragma warning( disable : 1683 )	/* #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) */
+#endif
+#endif
 
-#define HI_SIGNIFICAND_LESS(X, HI) ((X)->hi_significand < 0x ## HI)
-#define f64abs(x) ((x) < 0.0 ? -(x) : (x))
+/* macros to form a double value in hex representation (unsigned int type) */
 
-typedef enum
-{
-  logl_zero=0,   logl_negative,                  /*  0,  1 */
-  log_zero,      log_negative,                   /*  2,  3 */
-  logf_zero,     logf_negative,                  /*  4,  5 */
-  log10l_zero,   log10l_negative,                /*  6,  7 */
-  log10_zero,    log10_negative,                 /*  8,  9 */
-  log10f_zero,   log10f_negative,                /* 10, 11 */
-  expl_overflow, expl_underflow,                 /* 12, 13 */
-  exp_overflow,  exp_underflow,                  /* 14, 15 */
-  expf_overflow, expf_underflow,                 /* 16, 17 */
-  powl_overflow, powl_underflow,                 /* 18, 19 */
-  powl_zero_to_zero,                             /* 20     */
-  powl_zero_to_negative,                         /* 21     */
-  powl_neg_to_non_integer,                       /* 22     */
-  powl_nan_to_zero,                              /* 23     */
-  pow_overflow,  pow_underflow,                  /* 24, 25 */
-  pow_zero_to_zero,                              /* 26     */
-  pow_zero_to_negative,                          /* 27     */
-  pow_neg_to_non_integer,                        /* 28     */
-  pow_nan_to_zero,                               /* 29     */
-  powf_overflow, powf_underflow,                 /* 30, 31 */
-  powf_zero_to_zero,                             /* 32     */
-  powf_zero_to_negative,                         /* 33     */
-  powf_neg_to_non_integer,                       /* 34     */
-  powf_nan_to_zero,                              /* 35     */
-  atan2l_zero,                                   /* 36     */
-  atan2_zero,                                    /* 37     */
-  atan2f_zero,                                   /* 38     */
-  expm1l_overflow,                               /* 39     */
-  expm1l_underflow,                              /* 40     */
-  expm1_overflow,                                /* 41     */
-  expm1_underflow,                               /* 42     */
-  expm1f_overflow,                               /* 43     */
-  expm1f_underflow,                              /* 44     */
-  hypotl_overflow,                               /* 45     */
-  hypot_overflow,                                /* 46     */
-  hypotf_overflow,                               /* 47     */
-  sqrtl_negative,                                /* 48     */
-  sqrt_negative,                                 /* 49     */
-  sqrtf_negative,                                /* 50     */
-  scalbl_overflow, scalbl_underflow,             /* 51, 52  */
-  scalb_overflow,  scalb_underflow,              /* 53, 54  */
-  scalbf_overflow, scalbf_underflow,             /* 55, 56  */
-  acosl_gt_one, acos_gt_one, acosf_gt_one,       /* 57, 58, 59 */
-  asinl_gt_one, asin_gt_one, asinf_gt_one,       /* 60, 61, 62 */
-  coshl_overflow, cosh_overflow, coshf_overflow, /* 63, 64, 65 */
-  y0l_zero, y0l_negative,y0l_gt_loss,            /* 66, 67, 68 */
-  y0_zero, y0_negative,y0_gt_loss,               /* 69, 70, 71 */
-  y0f_zero, y0f_negative,y0f_gt_loss,            /* 72, 73, 74 */
-  y1l_zero, y1l_negative,y1l_gt_loss,            /* 75, 76, 77 */
-  y1_zero, y1_negative,y1_gt_loss,               /* 78, 79, 80 */
-  y1f_zero, y1f_negative,y1f_gt_loss,            /* 81, 82, 83 */
-  ynl_zero, ynl_negative,ynl_gt_loss,            /* 84, 85, 86 */
-  yn_zero, yn_negative,yn_gt_loss,               /* 87, 88, 89 */
-  ynf_zero, ynf_negative,ynf_gt_loss,            /* 90, 91, 92 */
-  j0l_gt_loss,                                   /* 93 */
-  j0_gt_loss,                                    /* 94 */
-  j0f_gt_loss,                                   /* 95 */
-  j1l_gt_loss,                                   /* 96 */
-  j1_gt_loss,                                    /* 97 */
-  j1f_gt_loss,                                   /* 98 */
-  jnl_gt_loss,                                   /* 99 */
-  jn_gt_loss,                                    /* 100 */
-  jnf_gt_loss,                                   /* 101 */
-  lgammal_overflow, lgammal_negative,lgammal_reserve, /* 102, 103, 104 */
-  lgamma_overflow, lgamma_negative,lgamma_reserve,    /* 105, 106, 107 */
-  lgammaf_overflow, lgammaf_negative, lgammaf_reserve,/* 108, 109, 110 */
-  gammal_overflow,gammal_negative, gammal_reserve,    /* 111, 112, 113 */
-  gamma_overflow, gamma_negative, gamma_reserve,      /* 114, 115, 116 */
-  gammaf_overflow,gammaf_negative,gammaf_reserve,     /* 117, 118, 119 */
-  fmodl_by_zero,                                 /* 120 */
-  fmod_by_zero,                                  /* 121 */
-  fmodf_by_zero,                                 /* 122 */
-  remainderl_by_zero,                            /* 123 */
-  remainder_by_zero,                             /* 124 */
-  remainderf_by_zero,                            /* 125 */
-  sinhl_overflow, sinh_overflow, sinhf_overflow, /* 126, 127, 128 */
-  atanhl_gt_one, atanhl_eq_one,                  /* 129, 130 */
-  atanh_gt_one, atanh_eq_one,                    /* 131, 132 */
-  atanhf_gt_one, atanhf_eq_one,                  /* 133, 134 */
-  acoshl_lt_one,                                 /* 135 */
-  acosh_lt_one,                                  /* 136 */
-  acoshf_lt_one,                                 /* 137 */
-  log1pl_zero,   log1pl_negative,                /* 138, 139 */
-  log1p_zero,    log1p_negative,                 /* 140, 141 */
-  log1pf_zero,   log1pf_negative,                /* 142, 143 */
-  ldexpl_overflow,   ldexpl_underflow,           /* 144, 145 */
-  ldexp_overflow,    ldexp_underflow,            /* 146, 147 */
-  ldexpf_overflow,   ldexpf_underflow,           /* 148, 149 */
-  logbl_zero,   logb_zero, logbf_zero,           /* 150, 151, 152 */
-  nextafterl_overflow,   nextafter_overflow,
-  nextafterf_overflow,                           /* 153, 154, 155 */
-  ilogbl_zero,  ilogb_zero, ilogbf_zero,         /* 156, 157, 158 */
-  exp2l_overflow, exp2l_underflow,               /* 159, 160 */
-  exp2_overflow,  exp2_underflow,                /* 161, 162 */
-  exp2f_overflow, exp2f_underflow,               /* 163, 164 */
-  exp10l_overflow, exp10_overflow,
-  exp10f_overflow,                               /* 165, 166, 167 */
-  log2l_zero,    log2l_negative,                 /* 168, 169 */
-  log2_zero,     log2_negative,                  /* 170, 171 */
-  log2f_zero,    log2f_negative,                 /* 172, 173 */
-  scalbnl_overflow, scalbnl_underflow,           /* 174, 175 */
-  scalbn_overflow,  scalbn_underflow,            /* 176, 177 */
-  scalbnf_overflow, scalbnf_underflow            /* 178, 179 */
-} error_types;
-
-void __libm_error_support(void*,void*,void*,error_types);
-libc_hidden_proto(__libm_error_support)
-
-#define BIAS_64  1023
-#define EXPINF_64  2047
-
-#define DOUBLE_HEX(HI, LO) 0x ## LO, 0x ## HI
-
-#if 0
-static const unsigned INF[] = {
-    DOUBLE_HEX(7ff00000, 00000000),
-    DOUBLE_HEX(fff00000, 00000000)
-};
+#define DOUBLE_HEX(hi,lo) 0x##lo,0x##hi /*LITTLE_ENDIAN*/
 
-static const double _zeroo = 0.0;
-static const double _bigg = 1.0e300;
-static const double _ponee = 1.0;
-static const double _nonee = -1.0;
+#include "libm_cpu_defs.h"
 
-#define INVALID    (_zeroo * *((double*)&INF[0]))
-#define PINF       *((double*)&INF[0])
-#define NINF       -PINF
-#define PINF_DZ    (_ponee/_zeroo)
-#define X_TLOSS    1.41484755040568800000e+16
+#if !(defined (IA64))
+#  include "libm_dll.h"
+#  include "libm_dispatch.h"
 #endif
 
+#include "libm_error_codes.h"
+
 struct exceptionf
 {
   int type;
@@ -290,8 +133,6 @@ struct exception
 #  endif
 # endif
 
-
-
 struct exceptionl
 {
   int type;
@@ -299,33 +140,27 @@ struct exceptionl
   long double arg1, arg2, retval;
 };
 
-#ifdef _MS_
-#define        MATHERR_F       _matherrf
-#define        MATHERR_D       _matherr
+#if (defined (_MS_) && defined (IA64))
+#define   MATHERR_F   _matherrf
+#define   MATHERR_D   _matherr
 #else
-#define        MATHERR_F       matherrf
-#define        MATHERR_D       matherr
+#define MATHERR_F   matherrf
+#define MATHERR_D   matherr
 #endif
 
 # ifdef __cplusplus
-#define        EXC_DECL_D      __exception
+#define EXC_DECL_D  __exception
 #else
 // exception is a reserved name in C++
-#define        EXC_DECL_D      exception
+#define EXC_DECL_D  exception
 #endif
 
 extern int MATHERR_F(struct exceptionf*);
 extern int MATHERR_D(struct EXC_DECL_D*);
 extern int matherrl(struct exceptionl*);
 
-
-/* Set these appropriately to make thread Safe */
-#define ERRNO_RANGE  errno = ERANGE
-#define ERRNO_DOMAIN errno = EDOM
-
-
-// Add code to support _LIB_VERSION
 #ifndef _LIBC
+// Add code to support _LIB_VERSIONIMF
 typedef enum
 {
     _IEEE_ = -1, // IEEE-like behavior
@@ -334,30 +169,883 @@ typedef enum
     _POSIX_,     // Posix
     _ISOC_       // ISO C9X
 } _LIB_VERSION_TYPE;
-
-extern _LIB_VERSION_TYPE _LIB_VERSION;
 #endif
 
-// This is a run-time variable and may effect
+// This is a run-time variable and may affect
 // floating point behavior of the libm functions
 
-#elif defined _LIBC
+#if !defined( LIBM_BUILD )
+#if defined( _DLL )
+extern _LIB_VERSION_TYPE __declspec(dllimport) _LIB_VERSIONIMF;
+#else
+extern _LIB_VERSION_TYPE _LIB_VERSIONIMF;
+#endif  /* _DLL */
+#else
+extern int (*pmatherrf)(struct exceptionf*);
+extern int (*pmatherr)(struct EXC_DECL_D*);
+extern int (*pmatherrl)(struct exceptionl*);
+#endif  /* LIBM_BUILD */
 
-# if !defined NOT_IN_libc && defined SHARED && defined DO_VERSIONING \
-     && !defined HAVE_BROKEN_ALIAS_ATTRIBUTE && !defined NO_HIDDEN
-#  define __libm_error_support  __GI___libm_error_support
-# endif
+/* memory format definitions (LITTLE_ENDIAN only) */
+
+#if !(defined(SIZE_INT_32) || defined(SIZE_INT_64))
+# error "You need to define SIZE_INT_32 or SIZE_INT_64"
+#endif
+
+#if (defined(SIZE_INT_32) && defined(SIZE_INT_64))
+#error multiple integer size definitions; define SIZE_INT_32 or SIZE_INT_64
+#endif
+
+#if !(defined(SIZE_LONG_32) || defined(SIZE_LONG_64))
+# error "You need to define SIZE_LONG_32 or SIZE_LONG_64"
+#endif
+
+#if (defined(SIZE_LONG_32) && defined(SIZE_LONG_64))
+#error multiple integer size definitions; define SIZE_LONG_32 or SIZE_LONG_64
+#endif
+
+#if !defined(__USE_EXTERNAL_FPMEMTYP_H__)
+
+#define BIAS_32  0x007F
+#define BIAS_64  0x03FF
+#define BIAS_80  0x3FFF
+
+#define MAXEXP_32  0x00FE
+#define MAXEXP_64  0x07FE
+#define MAXEXP_80  0x7FFE
+
+#define EXPINF_32  0x00FF
+#define EXPINF_64  0x07FF
+#define EXPINF_80  0x7FFF
+
+struct fp32 { /*// sign:1 exponent:8 significand:23 (implied leading 1)*/
+#if defined(SIZE_INT_32)
+    unsigned significand:23;
+    unsigned exponent:8;
+    unsigned sign:1;
+#elif defined(SIZE_INT_64)
+    unsigned significand:23;
+    unsigned exponent:8;
+    unsigned sign:1;
+#endif
+};
 
-#endif	/* __ASSEMBLER__ */
+struct fp64 { /*/ sign:1 exponent:11 significand:52 (implied leading 1)*/
+#if defined(SIZE_INT_32)
+    unsigned lo_significand:32;
+    unsigned hi_significand:20;
+    unsigned exponent:11;
+    unsigned sign:1;
+#elif defined(SIZE_INT_64)
+    unsigned significand:52;
+    unsigned exponent:11;
+    unsigned sign:1;
+#endif
+};
 
-/* Support for compatible assembler handling.  */
-#if !defined L && defined _LIBC
-#define L(name) .L##name
+struct fp80 { /*/ sign:1 exponent:15 significand:64 (NO implied bits) */
+#if defined(SIZE_INT_32)
+    unsigned         lo_significand;
+    unsigned         hi_significand;
+    unsigned         exponent:15;
+    unsigned         sign:1;
+#elif defined(SIZE_INT_64)
+    unsigned         significand;
+    unsigned         exponent:15;
+    unsigned         sign:1;
+#endif
+    unsigned         pad:16;
+#if !(defined(__unix__) && defined(__i386__))
+    unsigned         padwin:32;
 #endif
-#ifdef __ELF__
-#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
-#define ASM_TYPE_DIRECTIVE(name,T) .type name,T
+};
+
+#endif /*__USE_EXTERNAL_FPMEMTYP_H__*/
+
+#if !(defined(opensource))
+typedef          __int32  INT32;
+typedef   signed __int32 SINT32;
+typedef unsigned __int32 UINT32;
+
+typedef          __int64  INT64;
+typedef   signed __int64 SINT64;
+typedef unsigned __int64 UINT64;
 #else
-#define ASM_SIZE_DIRECTIVE(name)
-#define ASM_TYPE_DIRECTIVE(name,T)
+typedef          int  INT32;
+typedef   signed int SINT32;
+typedef unsigned int UINT32;
+
+typedef          long long  INT64;
+typedef   signed long long SINT64;
+typedef unsigned long long UINT64;
+#endif
+
+#if (defined(_WIN32) || defined(_WIN64))        /* Windows */
+# define I64CONST(bits) 0x##bits##i64
+# define U64CONST(bits) 0x##bits##ui64
+#elif (defined(__linux__) && defined(_M_IA64))  /* Linux,64 */
+# define I64CONST(bits) 0x##bits##L
+# define U64CONST(bits) 0x##bits##uL
+#else                                           /* Linux,32 */
+# define I64CONST(bits) 0x##bits##LL
+# define U64CONST(bits) 0x##bits##uLL
+#endif
+
+struct ker80 {
+    union {
+        long double ldhi;
+        struct fp80 fphi;
+    };
+    union {
+        long double ldlo;
+        struct fp80 fplo;
+    };
+    int ex;
+};
+
+/* Addition: x+y                                            */
+/* The result is sum rhi+rlo                                */
+/* Temporary variables: t1                                  */
+/* All variables are in long double precision               */
+/* Correct if no overflow (algorithm by D.Knuth)           */
+#define __LIBM_ADDL1_K80( rhi,rlo,x,y, t1 )                 \
+    rhi = x   + y;                                          \
+    rlo = rhi - x;                                          \
+    t1  = rhi - rlo;                                        \
+    rlo = y   - rlo;                                        \
+    t1  = x   - t1;                                         \
+    rlo = rlo + t1;
+
+/* Addition: (xhi+xlo) + (yhi+ylo)                          */
+/* The result is sum rhi+rlo                                */
+/* Temporary variables: t1                                  */
+/* All variables are in long double precision               */
+/* Correct if no overflow (algorithm by T.J.Dekker)         */
+#define __LIBM_ADDL2_K80( rhi,rlo,xhi,xlo,yhi,ylo, t1 )     \
+    rlo = xhi+yhi;                                          \
+    if ( VALUE_GT_80(FP80(xhi),FP80(yhi)) ) {               \
+        t1=xhi-rlo;t1=t1+yhi;t1=t1+ylo;t1=t1+xlo;           \
+    } else {                                                \
+        t1=yhi-rlo;t1=t1+xhi;t1=t1+xlo;t1=t1+ylo;           \
+    }                                                       \
+    rhi=rlo+t1;                                             \
+    rlo=rlo-rhi;rlo=rlo+t1;
+
+/* Addition: r=x+y                                          */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Temporary variables: t1                                  */
+/* Correct if x and y belong to interval [2^-8000;2^8000],  */
+/* or when one or both of them are zero                     */
+#if   defined(SIZE_INT_32)
+#define __LIBM_ADDL_K80(r,x,y, t1)                          \
+    if ( ((y)->ex+(y)->fphi.exponent-134 <                  \
+          (x)->ex+(x)->fphi.exponent)       &&              \
+         ((x)->ex+(x)->fphi.exponent <                      \
+          (y)->ex+(y)->fphi.exponent+134)   &&              \
+         !SIGNIFICAND_ZERO_80(&((x)->fphi)) &&              \
+         !SIGNIFICAND_ZERO_80(&((y)->fphi)) )               \
+    {                                                       \
+        /* y/2^134 < x < y*2^134,               */          \
+        /* and x,y are nonzero finite numbers   */          \
+        if ( (x)->ex != (y)->ex ) {                         \
+            /* adjust x->ex to y->ex */                     \
+            /* t1 = 2^(x->ex - y->ex) */                    \
+            FP80(t1)->sign = 0;                             \
+            FP80(t1)->exponent = BIAS_80 + (x)->ex-(y)->ex; \
+            /*  exponent is correct because             */  \
+            /*  |x->ex - y->ex| =                       */  \
+            /*  = |  (x->ex + x->fphi.exponent) -       */  \
+            /*      -(y->ex + y->fphi.exponent) +       */  \
+            /*              + y->fphi.exponent  -       */  \
+            /*              - x->fphi.exponent     | <  */  \
+            /*  < |  (x->ex+x->fphi.exponent) -         */  \
+            /*      -(y->ex+y->fphi.exponent)      | +  */  \
+            /*   +|  y->fphi.exponent -                 */  \
+            /*      -x->fphi.exponent              | <  */  \
+            /*  < 134 + 16000                           */  \
+            FP80(t1)->hi_significand = 0x80000000;          \
+            FP80(t1)->lo_significand = 0x00000000;          \
+            (x)->ex = (y)->ex;                              \
+            (x)->ldhi *= t1;                                \
+            (x)->ldlo *= t1;                                \
+        }                                                   \
+        /* r==x+y */                                        \
+        (r)->ex = (y)->ex;                                  \
+        __LIBM_ADDL2_K80( (r)->ldhi,(r)->ldlo,              \
+            (x)->ldhi,(x)->ldlo, (y)->ldhi,(y)->ldlo, t1 ); \
+    } else if ( SIGNIFICAND_ZERO_80(&((x)->fphi)) ||        \
+             ((y)->ex+(y)->fphi.exponent-BIAS_80 - 134 >=   \
+              (x)->ex+(x)->fphi.exponent-BIAS_80) )         \
+    {                                                       \
+        /* |x|<<|y| */                                      \
+        *(r) = *(y);                                        \
+    } else {                                                \
+        /* |y|<<|x| */                                      \
+        *(r) = *(x);                                        \
+    }
+#elif defined(SIZE_INT_64)
+#define __LIBM_ADDL_K80(r,x,y, t1)                          \
+    if ( ((y)->ex+(y)->fphi.exponent-134 <                  \
+          (x)->ex+(x)->fphi.exponent)       &&              \
+         ((x)->ex+(x)->fphi.exponent <                      \
+          (y)->ex+(y)->fphi.exponent+134)   &&              \
+         !SIGNIFICAND_ZERO_80(&((x)->fphi)) &&              \
+         !SIGNIFICAND_ZERO_80(&((y)->fphi)) )               \
+    {                                                       \
+        /* y/2^134 < x < y*2^134,               */          \
+        /* and x,y are nonzero finite numbers   */          \
+        if ( (x)->ex != (y)->ex ) {                         \
+            /* adjust x->ex to y->ex */                     \
+            /* t1 = 2^(x->ex - y->ex) */                    \
+            FP80(t1)->sign = 0;                             \
+            FP80(t1)->exponent = BIAS_80 + (x)->ex-(y)->ex; \
+            /*  exponent is correct because             */  \
+            /*  |x->ex - y->ex| =                       */  \
+            /*  = |  (x->ex + x->fphi.exponent) -       */  \
+            /*      -(y->ex + y->fphi.exponent) +       */  \
+            /*              + y->fphi.exponent  -       */  \
+            /*              - x->fphi.exponent     | <  */  \
+            /*  < |  (x->ex+x->fphi.exponent) -         */  \
+            /*      -(y->ex+y->fphi.exponent)      | +  */  \
+            /*   +|  y->fphi.exponent -                 */  \
+            /*      -x->fphi.exponent              | <  */  \
+            /*  < 134 + 16000                           */  \
+            FP80(t1)->significand = 0x8000000000000000;     \
+            (x)->ex = (y)->ex;                              \
+            (x)->ldhi *= t1;                                \
+            (x)->ldlo *= t1;                                \
+        }                                                   \
+        /* r==x+y */                                        \
+        (r)->ex = (y)->ex;                                  \
+        __LIBM_ADDL2_K80( (r)->ldhi,(r)->ldlo,              \
+            (x)->ldhi,(x)->ldlo, (y)->ldhi,(y)->ldlo, t1 ); \
+    } else if ( SIGNIFICAND_ZERO_80(&((x)->fphi)) ||        \
+             ((y)->ex+(y)->fphi.exponent-BIAS_80 - 134 >=   \
+              (x)->ex+(x)->fphi.exponent-BIAS_80) )         \
+    {                                                       \
+        /* |x|<<|y| */                                      \
+        *(r) = *(y);                                        \
+    } else {                                                \
+        /* |y|<<|x| */                                      \
+        *(r) = *(x);                                        \
+    }
+#endif
+
+/* Addition: r=x+y                                          */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Temporary variables: t1                                  */
+/* Correct for any finite x and y                           */
+#define __LIBM_ADDL_NORM_K80(r,x,y, t1)                     \
+    if ( ((x)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((x)->fphi.exponent-BIAS_80>+8000) ||              \
+         ((y)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((y)->fphi.exponent-BIAS_80>+8000) )               \
+    {                                                       \
+        __libm_normalizel_k80(x);                           \
+        __libm_normalizel_k80(y);                           \
+    }                                                       \
+    __LIBM_ADDL_K80(r,x,y, t1)
+
+/* Subtraction: x-y                                         */
+/* The result is sum rhi+rlo                                */
+/* Temporary variables: t1                                  */
+/* All variables are in long double precision               */
+/* Correct if no overflow (algorithm by D.Knuth)           */
+#define __LIBM_SUBL1_K80( rhi, rlo, x, y, t1 )              \
+    rhi = x   - y;                                          \
+    rlo = rhi - x;                                          \
+    t1  = rhi - rlo;                                        \
+    rlo = y   + rlo;                                        \
+    t1  = x   - t1;                                         \
+    rlo = t1  - rlo;
+
+/* Subtraction: (xhi+xlo) - (yhi+ylo)                       */
+/* The result is sum rhi+rlo                                */
+/* Temporary variables: t1                                  */
+/* All variables are in long double precision               */
+/* Correct if no overflow (algorithm by T.J.Dekker)         */
+#define __LIBM_SUBL2_K80( rhi,rlo,xhi,xlo,yhi,ylo, t1 )     \
+    rlo = xhi-yhi;                                          \
+    if ( VALUE_GT_80(FP80(xhi),FP80(yhi)) ) {               \
+        t1=xhi-rlo;t1=t1-yhi;t1=t1-ylo;t1=t1+xlo;           \
+    } else {                                                \
+        t1=yhi+rlo;t1=xhi-t1;t1=t1+xlo;t1=t1-ylo;           \
+    }                                                       \
+    rhi=rlo+t1;                                             \
+    rlo=rlo-rhi;rlo=rlo+t1;
+
+/* Subtraction: r=x-y                                       */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Temporary variables: t1                                  */
+/* Correct if x and y belong to interval [2^-8000;2^8000],  */
+/* or when one or both of them are zero                     */
+#if   defined(SIZE_INT_32)
+#define __LIBM_SUBL_K80(r,x,y, t1)                          \
+    if ( ((y)->ex+(y)->fphi.exponent-134 <                  \
+          (x)->ex+(x)->fphi.exponent)       &&              \
+         ((x)->ex+(x)->fphi.exponent <                      \
+          (y)->ex+(y)->fphi.exponent+134)   &&              \
+         !SIGNIFICAND_ZERO_80(&((x)->fphi)) &&              \
+         !SIGNIFICAND_ZERO_80(&((y)->fphi)) )               \
+    {                                                       \
+        /* y/2^134 < x < y*2^134,               */          \
+        /* and x,y are nonzero finite numbers   */          \
+        if ( (x)->ex != (y)->ex ) {                         \
+            /* adjust x->ex to y->ex */                     \
+            /* t1 = 2^(x->ex - y->ex) */                    \
+            FP80(t1)->sign = 0;                             \
+            FP80(t1)->exponent = BIAS_80 + (x)->ex-(y)->ex; \
+            /*  exponent is correct because             */  \
+            /*  |x->ex - y->ex| =                       */  \
+            /*  = |  (x->ex + x->fphi.exponent) -       */  \
+            /*      -(y->ex + y->fphi.exponent) +       */  \
+            /*              + y->fphi.exponent  -       */  \
+            /*              - x->fphi.exponent     | <  */  \
+            /*  < |  (x->ex+x->fphi.exponent) -         */  \
+            /*      -(y->ex+y->fphi.exponent)      | +  */  \
+            /*   +|  y->fphi.exponent -                 */  \
+            /*      -x->fphi.exponent              | <  */  \
+            /*  < 134 + 16000                           */  \
+            FP80(t1)->hi_significand = 0x80000000;          \
+            FP80(t1)->lo_significand = 0x00000000;          \
+            (x)->ex = (y)->ex;                              \
+            (x)->ldhi *= t1;                                \
+            (x)->ldlo *= t1;                                \
+        }                                                   \
+        /* r==x+y */                                        \
+        (r)->ex = (y)->ex;                                  \
+        __LIBM_SUBL2_K80( (r)->ldhi,(r)->ldlo,              \
+            (x)->ldhi,(x)->ldlo, (y)->ldhi,(y)->ldlo, t1 ); \
+    } else if ( SIGNIFICAND_ZERO_80(&((x)->fphi)) ||        \
+             ((y)->ex+(y)->fphi.exponent-BIAS_80 - 134 >=   \
+              (x)->ex+(x)->fphi.exponent-BIAS_80) )         \
+    {                                                       \
+        /* |x|<<|y| */                                      \
+        (r)->ex   =   (y)->ex;                              \
+        (r)->ldhi = -((y)->ldhi);                           \
+        (r)->ldlo = -((y)->ldlo);                           \
+    } else {                                                \
+        /* |y|<<|x| */                                      \
+        *(r) = *(x);                                        \
+    }
+#elif defined(SIZE_INT_64)
+#define __LIBM_SUBL_K80(r,x,y, t1)                          \
+    if ( ((y)->ex+(y)->fphi.exponent-134 <                  \
+          (x)->ex+(x)->fphi.exponent)       &&              \
+         ((x)->ex+(x)->fphi.exponent <                      \
+          (y)->ex+(y)->fphi.exponent+134)   &&              \
+         !SIGNIFICAND_ZERO_80(&((x)->fphi)) &&              \
+         !SIGNIFICAND_ZERO_80(&((y)->fphi)) )               \
+    {                                                       \
+        /* y/2^134 < x < y*2^134,               */          \
+        /* and x,y are nonzero finite numbers   */          \
+        if ( (x)->ex != (y)->ex ) {                         \
+            /* adjust x->ex to y->ex */                     \
+            /* t1 = 2^(x->ex - y->ex) */                    \
+            FP80(t1)->sign = 0;                             \
+            FP80(t1)->exponent = BIAS_80 + (x)->ex-(y)->ex; \
+            /*  exponent is correct because             */  \
+            /*  |x->ex - y->ex| =                       */  \
+            /*  = |  (x->ex + x->fphi.exponent) -       */  \
+            /*      -(y->ex + y->fphi.exponent) +       */  \
+            /*              + y->fphi.exponent  -       */  \
+            /*              - x->fphi.exponent     | <  */  \
+            /*  < |  (x->ex+x->fphi.exponent) -         */  \
+            /*      -(y->ex+y->fphi.exponent)      | +  */  \
+            /*   +|  y->fphi.exponent -                 */  \
+            /*      -x->fphi.exponent              | <  */  \
+            /*  < 134 + 16000                           */  \
+            FP80(t1)->significand = 0x8000000000000000;     \
+            (x)->ex = (y)->ex;                              \
+            (x)->ldhi *= t1;                                \
+            (x)->ldlo *= t1;                                \
+        }                                                   \
+        /* r==x+y */                                        \
+        (r)->ex = (y)->ex;                                  \
+        __LIBM_SUBL2_K80( (r)->ldhi,(r)->ldlo,              \
+            (x)->ldhi,(x)->ldlo, (y)->ldhi,(y)->ldlo, t1 ); \
+    } else if ( SIGNIFICAND_ZERO_80(&((x)->fphi)) ||        \
+             ((y)->ex+(y)->fphi.exponent-BIAS_80 - 134 >=   \
+              (x)->ex+(x)->fphi.exponent-BIAS_80) )         \
+    {                                                       \
+        /* |x|<<|y| */                                      \
+        (r)->ex   =   (y)->ex;                              \
+        (r)->ldhi = -((y)->ldhi);                           \
+        (r)->ldlo = -((y)->ldlo);                           \
+    } else {                                                \
+        /* |y|<<|x| */                                      \
+        *(r) = *(x);                                        \
+    }
+#endif
+
+/* Subtraction: r=x+y                                       */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Temporary variables: t1                                  */
+/* Correct for any finite x and y                           */
+#define __LIBM_SUBL_NORM_K80(r,x,y, t1)                     \
+    if ( ((x)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((x)->fphi.exponent-BIAS_80>+8000) ||              \
+         ((y)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((y)->fphi.exponent-BIAS_80>+8000) )               \
+    {                                                       \
+        __libm_normalizel_k80(x);                           \
+        __libm_normalizel_k80(y);                           \
+    }                                                       \
+    __LIBM_SUBL_K80(r,x,y, t1)
+
+/* Multiplication: x*y                                      */
+/* The result is sum rhi+rlo                                */
+/* Here t32 is the constant 2^32+1                          */
+/* Temporary variables: t1,t2,t3,t4,t5,t6                   */
+/* All variables are in long double precision               */
+/* Correct if no over/underflow (algorithm by T.J.Dekker)   */
+#define __LIBM_MULL1_K80(rhi,rlo,x,y,                       \
+                                     t32,t1,t2,t3,t4,t5,t6) \
+    t1=(x)*(t32); t3=x-t1; t3=t3+t1; t4=x-t3;               \
+    t1=(y)*(t32); t5=y-t1; t5=t5+t1; t6=y-t5;               \
+    t1=(t3)*(t5);                                           \
+    t2=(t3)*(t6)+(t4)*(t5);                                 \
+    rhi=t1+t2;                                              \
+    rlo=t1-rhi; rlo=rlo+t2; rlo=rlo+(t4*t6);
+
+/* Multiplication: (xhi+xlo)*(yhi+ylo)                      */
+/* The result is sum rhi+rlo                                */
+/* Here t32 is the constant 2^32+1                          */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8             */
+/* All variables are in long double precision               */
+/* Correct if no over/underflow (algorithm by T.J.Dekker)   */
+#define __LIBM_MULL2_K80(rhi,rlo,xhi,xlo,yhi,ylo,           \
+                               t32,t1,t2,t3,t4,t5,t6,t7,t8) \
+    __LIBM_MULL1_K80(t7,t8,xhi,yhi, t32,t1,t2,t3,t4,t5,t6)  \
+    t1=(xhi)*(ylo)+(xlo)*(yhi); t1=t1+t8;                   \
+    rhi=t7+t1;                                              \
+    rlo=t7-rhi; rlo=rlo+t1;
+
+/* Multiplication: r=x*y                                    */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Here t32 is the constant 2^32+1                          */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8             */
+/* Correct if x and y belong to interval [2^-8000;2^8000]   */
+#define __LIBM_MULL_K80(r,x,y, t32,t1,t2,t3,t4,t5,t6,t7,t8) \
+    (r)->ex = (x)->ex + (y)->ex;                            \
+    __LIBM_MULL2_K80((r)->ldhi,(r)->ldlo,                   \
+        (x)->ldhi,(x)->ldlo,(y)->ldhi,(y)->ldlo,            \
+        t32,t1,t2,t3,t4,t5,t6,t7,t8)
+
+/* Multiplication: r=x*y                                    */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Here t32 is the constant 2^32+1                          */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8             */
+/* Correct for any finite x and y                           */
+#define __LIBM_MULL_NORM_K80(r,x,y,                         \
+                               t32,t1,t2,t3,t4,t5,t6,t7,t8) \
+    if ( ((x)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((x)->fphi.exponent-BIAS_80>+8000) ||              \
+         ((y)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((y)->fphi.exponent-BIAS_80>+8000) )               \
+    {                                                       \
+        __libm_normalizel_k80(x);                           \
+        __libm_normalizel_k80(y);                           \
+    }                                                       \
+    __LIBM_MULL_K80(r,x,y, t32,t1,t2,t3,t4,t5,t6,t7,t8)
+
+/* Division: (xhi+xlo)/(yhi+ylo)                            */
+/* The result is sum rhi+rlo                                */
+/* Here t32 is the constant 2^32+1                          */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8,t9          */
+/* All variables are in long double precision               */
+/* Correct if no over/underflow (algorithm by T.J.Dekker)   */
+#define __LIBM_DIVL2_K80(rhi,rlo,xhi,xlo,yhi,ylo,           \
+                            t32,t1,t2,t3,t4,t5,t6,t7,t8,t9) \
+    t7=(xhi)/(yhi);                                         \
+    __LIBM_MULL1_K80(t8,t9,t7,yhi, t32,t1,t2,t3,t4,t5,t6)   \
+    t1=xhi-t8; t1=t1-t9; t1=t1+xlo; t1=t1-(t7)*(ylo);       \
+    t1=(t1)/(yhi);                                          \
+    rhi=t7+t1;                                              \
+    rlo=t7-rhi; rlo=rlo+t1;
+
+/* Division: r=x/y                                          */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Here t32 is the constant 2^32+1                          */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8,t9          */
+/* Correct if x and y belong to interval [2^-8000;2^8000]   */
+#define __LIBM_DIVL_K80(r,x,y,                              \
+                            t32,t1,t2,t3,t4,t5,t6,t7,t8,t9) \
+    (r)->ex = (x)->ex - (y)->ex;                            \
+    __LIBM_DIVL2_K80( (r)->ldhi,(r)->ldlo,                  \
+        (x)->ldhi,(x)->ldlo,(y)->ldhi,(y)->ldlo,            \
+        t32,t1,t2,t3,t4,t5,t6,t7,t8,t9)
+
+/* Division: r=x/y                                          */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Here t32 is the constant 2^32+1                          */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8             */
+/* Correct for any finite x and y                           */
+#define __LIBM_DIVL_NORM_K80(r,x,y,                         \
+                            t32,t1,t2,t3,t4,t5,t6,t7,t8,t9) \
+    if ( ((x)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((x)->fphi.exponent-BIAS_80>+8000) ||              \
+         ((y)->fphi.exponent-BIAS_80<-8000) ||              \
+         ((y)->fphi.exponent-BIAS_80>+8000) )               \
+    {                                                       \
+        __libm_normalizel_k80(x);                           \
+        __libm_normalizel_k80(y);                           \
+    }                                                       \
+    __LIBM_DIVL_K80(r,x,y, t32,t1,t2,t3,t4,t5,t6,t7,t8,t9)
+
+/* Square root: sqrt(xhi+xlo)                               */
+/* The result is sum rhi+rlo                                */
+/* Here t32 is the constant 2^32+1                          */
+/*      half is the constant 0.5                            */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8,t9          */
+/* All variables are in long double precision               */
+/* Correct for positive xhi+xlo (algorithm by T.J.Dekker)   */
+#define __LIBM_SQRTL2_NORM_K80(rhi,rlo,xhi,xlo,             \
+                       t32,half,t1,t2,t3,t4,t5,t6,t7,t8,t9) \
+    t7=sqrtl(xhi);                                          \
+    __LIBM_MULL1_K80(t8,t9,t7,t7, t32,t1,t2,t3,t4,t5,t6)    \
+    t1=xhi-t8; t1=t1-t9; t1=t1+xlo; t1=(t1)*(half);         \
+    t1=(t1)/(t7);                                           \
+    rhi=t7+t1;                                              \
+    rlo=t7-rhi; rlo=rlo+t1;
+
+/* Square root: r=sqrt(x)                                   */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Here t32 is the constant 2^32+1                          */
+/*      half is the constant 0.5                            */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8,t9          */
+/* Correct if x belongs to interval [2^-16000;2^16000]      */
+#define __LIBM_SQRTL_K80(r,x,                               \
+                       t32,half,t1,t2,t3,t4,t5,t6,t7,t8,t9) \
+    if ( ((x)->ex & 1) == 1 ) {                             \
+        (x)->ex    = (x)->ex + 1;                           \
+        (x)->ldhi *= half;                                  \
+        (x)->ldlo *= half;                                  \
+    }                                                       \
+    (r)->ex = (x)->ex >> 1;                                 \
+    __LIBM_SQRTL2_NORM_K80( (r)->ldhi,(r)->ldlo,            \
+        (x)->ldhi,(x)->ldlo,                                \
+        t32,half,t1,t2,t3,t4,t5,t6,t7,t8,t9)
+
+/* Square root: r=sqrt(x)                                   */
+/* Variables r,x,y are pointers to struct ker80,            */
+/* all other variables are in long double precision         */
+/* Here t32 is the constant 2^32+1                          */
+/*      half is the constant 0.5                            */
+/* Temporary variables: t1,t2,t3,t4,t5,t6,t7,t8,t9          */
+/* Correct for any positive x                               */
+#define __LIBM_SQRTL_NORM_K80(r,x,                          \
+                       t32,half,t1,t2,t3,t4,t5,t6,t7,t8,t9) \
+    if ( ((x)->fphi.exponent-BIAS_80<-16000) ||             \
+         ((x)->fphi.exponent-BIAS_80>+16000) )              \
+    {                                                       \
+        __libm_normalizel_k80(x);                           \
+    }                                                       \
+    __LIBM_SQRTL_K80(r,x, t32,half,t1,t2,t3,t4,t5,t6,t7,t8,t9)
+
+
+#ifdef __INTEL_COMPILER
+#define ALIGN(n) __declspec(align(n))
+#else /* __INTEL_COMPILER */
+#define ALIGN(n)
+#endif /* __INTEL_COMPILER */
+
+/* macros to form a long double value in hex representation (unsigned short type) */
+
+#if (defined(__unix__) && defined(__i386__))
+# define LDOUBLE_ALIGN 12	/* IA32 Linux: 12-byte alignment */
+#else	/*__linux__ & IA32*/
+# define LDOUBLE_ALIGN 16	/* EFI2/IA32 Win or IPF Win/Linux: 16-byte alignment */
+#endif	/*__linux__ & IA32*/
+
+#if (LDOUBLE_ALIGN == 16)
+#define _XPD_ ,0x0000,0x0000,0x0000
+#else /*12*/
+#define _XPD_ ,0x0000
+#endif
+
+#define LDOUBLE_HEX(w4,w3,w2,w1,w0) 0x##w0,0x##w1,0x##w2,0x##w3,0x##w4 _XPD_ /*LITTLE_ENDIAN*/
+
+/* macros to sign-expand low 'num' bits of 'val' to native integer */
+
+#if defined(SIZE_INT_32)
+# define SIGN_EXPAND(val,num)  ((int)(val) << (32-(num))) >> (32-(num)) /* sign expand of 'num' LSBs */
+#elif defined(SIZE_INT_64)
+# define SIGN_EXPAND(val,num)  ((int)(val) << (64-(num))) >> (64-(num)) /* sign expand of 'num' LSBs */
+#endif
+
+/* macros to form pointers to FP number on-the-fly */
+
+#define FP32(f)  ((struct fp32 *)&f)
+#define FP64(d)  ((struct fp64 *)&d)
+#define FP80(ld) ((struct fp80 *)&ld)
+
+/* macros to extract signed low and high doubleword of long double */
+
+#if defined(SIZE_INT_32)
+# define HI_DWORD_80(ld) ((((FP80(ld)->sign << 15) | FP80(ld)->exponent) << 16) | \
+                          ((FP80(ld)->hi_significand >> 16) & 0xFFFF))
+# define LO_DWORD_80(ld) SIGN_EXPAND(FP80(ld)->lo_significand, 32)
+#elif defined(SIZE_INT_64)
+# define HI_DWORD_80(ld) ((((FP80(ld)->sign << 15) | FP80(ld)->exponent) << 16) | \
+                          ((FP80(ld)->significand >> 48) & 0xFFFF))
+# define LO_DWORD_80(ld) SIGN_EXPAND(FP80(ld)->significand, 32)
+#endif
+
+/* macros to extract hi bits of significand.
+ * note that explicit high bit do not count (returns as is)
+ */
+
+#if defined(SIZE_INT_32)
+# define HI_SIGNIFICAND_80(X,NBITS) ((X)->hi_significand >> (31 - (NBITS)))
+#elif defined(SIZE_INT_64)
+# define HI_SIGNIFICAND_80(X,NBITS) ((X)->significand >> (63 - (NBITS)))
+#endif
+
+/* macros to check, whether a significand bits are all zero, or some of them are non-zero.
+ * note that SIGNIFICAND_ZERO_80 tests high bit also, but SIGNIFICAND_NONZERO_80 does not
+ */
+
+#define SIGNIFICAND_ZERO_32(X)     ((X)->significand == 0)
+#define SIGNIFICAND_NONZERO_32(X)  ((X)->significand != 0)
+
+#if defined(SIZE_INT_32)
+# define SIGNIFICAND_ZERO_64(X)    (((X)->hi_significand == 0) && ((X)->lo_significand == 0))
+# define SIGNIFICAND_NONZERO_64(X) (((X)->hi_significand != 0) || ((X)->lo_significand != 0))
+#elif defined(SIZE_INT_64)
+# define SIGNIFICAND_ZERO_64(X)    ((X)->significand == 0)
+# define SIGNIFICAND_NONZERO_64(X) ((X)->significand != 0)
+#endif
+
+#if defined(SIZE_INT_32)
+# define SIGNIFICAND_ZERO_80(X)    (((X)->hi_significand == 0x00000000) && ((X)->lo_significand == 0))
+# define SIGNIFICAND_NONZERO_80(X) (((X)->hi_significand != 0x80000000) || ((X)->lo_significand != 0))
+#elif defined(SIZE_INT_64)
+# define SIGNIFICAND_ZERO_80(X)    ((X)->significand == 0x0000000000000000)
+# define SIGNIFICAND_NONZERO_80(X) ((X)->significand != 0x8000000000000000)
+#endif
+
+/* macros to compare long double with constant value, represented as hex */
+
+#define SIGNIFICAND_EQ_HEX_32(X,BITS) ((X)->significand == 0x ## BITS)
+#define SIGNIFICAND_GT_HEX_32(X,BITS) ((X)->significand >  0x ## BITS)
+#define SIGNIFICAND_GE_HEX_32(X,BITS) ((X)->significand >= 0x ## BITS)
+#define SIGNIFICAND_LT_HEX_32(X,BITS) ((X)->significand <  0x ## BITS)
+#define SIGNIFICAND_LE_HEX_32(X,BITS) ((X)->significand <= 0x ## BITS)
+
+#if defined(SIZE_INT_32)
+# define SIGNIFICAND_EQ_HEX_64(X,HI,LO) \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand == 0x ## LO))
+# define SIGNIFICAND_GT_HEX_64(X,HI,LO) (((X)->hi_significand > 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand >  0x ## LO)))
+# define SIGNIFICAND_GE_HEX_64(X,HI,LO) (((X)->hi_significand > 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand >= 0x ## LO)))
+# define SIGNIFICAND_LT_HEX_64(X,HI,LO) (((X)->hi_significand < 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand <  0x ## LO)))
+# define SIGNIFICAND_LE_HEX_64(X,HI,LO) (((X)->hi_significand < 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand <= 0x ## LO)))
+#elif defined(SIZE_INT_64)
+# define SIGNIFICAND_EQ_HEX_64(X,HI,LO) ((X)->significand == 0x ## HI ## LO)
+# define SIGNIFICAND_GT_HEX_64(X,HI,LO) ((X)->significand >  0x ## HI ## LO)
+# define SIGNIFICAND_GE_HEX_64(X,HI,LO) ((X)->significand >= 0x ## HI ## LO)
+# define SIGNIFICAND_LT_HEX_64(X,HI,LO) ((X)->significand <  0x ## HI ## LO)
+# define SIGNIFICAND_LE_HEX_64(X,HI,LO) ((X)->significand <= 0x ## HI ## LO)
+#endif
+
+#if defined(SIZE_INT_32)
+# define SIGNIFICAND_EQ_HEX_80(X,HI,LO) \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand == 0x ## LO))
+# define SIGNIFICAND_GT_HEX_80(X,HI,LO) (((X)->hi_significand > 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand >  0x ## LO)))
+# define SIGNIFICAND_GE_HEX_80(X,HI,LO) (((X)->hi_significand > 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand >= 0x ## LO)))
+# define SIGNIFICAND_LT_HEX_80(X,HI,LO) (((X)->hi_significand < 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand <  0x ## LO)))
+# define SIGNIFICAND_LE_HEX_80(X,HI,LO) (((X)->hi_significand < 0x ## HI) || \
+    (((X)->hi_significand == 0x ## HI) && ((X)->lo_significand <= 0x ## LO)))
+#elif defined(SIZE_INT_64)
+# define SIGNIFICAND_EQ_HEX_80(X,HI,LO) ((X)->significand == 0x ## HI ## LO)
+# define SIGNIFICAND_GT_HEX_80(X,HI,LO) ((X)->significand >  0x ## HI ## LO)
+# define SIGNIFICAND_GE_HEX_80(X,HI,LO) ((X)->significand >= 0x ## HI ## LO)
+# define SIGNIFICAND_LT_HEX_80(X,HI,LO) ((X)->significand <  0x ## HI ## LO)
+# define SIGNIFICAND_LE_HEX_80(X,HI,LO) ((X)->significand <= 0x ## HI ## LO)
+#endif
+
+#define VALUE_EQ_HEX_32(X,EXP,BITS) \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_EQ_HEX_32(X, BITS)))
+#define VALUE_GT_HEX_32(X,EXP,BITS) (((X)->exponent > (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_GT_HEX_32(X, BITS))))
+#define VALUE_GE_HEX_32(X,EXP,BITS) (((X)->exponent > (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_GE_HEX_32(X, BITS))))
+#define VALUE_LT_HEX_32(X,EXP,BITS) (((X)->exponent < (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_LT_HEX_32(X, BITS))))
+#define VALUE_LE_HEX_32(X,EXP,BITS) (((X)->exponent < (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_LE_HEX_32(X, BITS))))
+
+#define VALUE_EQ_HEX_64(X,EXP,HI,LO) \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_EQ_HEX_64(X, HI, LO)))
+#define VALUE_GT_HEX_64(X,EXP,HI,LO) (((X)->exponent > (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_GT_HEX_64(X, HI, LO))))
+#define VALUE_GE_HEX_64(X,EXP,HI,LO) (((X)->exponent > (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_GE_HEX_64(X, HI, LO))))
+#define VALUE_LT_HEX_64(X,EXP,HI,LO) (((X)->exponent < (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_LT_HEX_64(X, HI, LO))))
+#define VALUE_LE_HEX_64(X,EXP,HI,LO) (((X)->exponent < (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_LE_HEX_64(X, HI, LO))))
+
+#define VALUE_EQ_HEX_80(X,EXP,HI,LO) \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_EQ_HEX_80(X, HI, LO)))
+#define VALUE_GT_HEX_80(X,EXP,HI,LO) (((X)->exponent > (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_GT_HEX_80(X, HI, LO))))
+#define VALUE_GE_HEX_80(X,EXP,HI,LO) (((X)->exponent > (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_GE_HEX_80(X, HI, LO))))
+#define VALUE_LT_HEX_80(X,EXP,HI,LO) (((X)->exponent < (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_LT_HEX_80(X, HI, LO))))
+#define VALUE_LE_HEX_80(X,EXP,HI,LO) (((X)->exponent < (EXP)) || \
+   (((X)->exponent == (EXP)) && (SIGNIFICAND_LE_HEX_80(X, HI, LO))))
+
+/* macros to compare two long doubles */
+
+#define SIGNIFICAND_EQ_32(X,Y) ((X)->significand == (Y)->significand)
+#define SIGNIFICAND_GT_32(X,Y) ((X)->significand > (Y)->significand)
+#define SIGNIFICAND_GE_32(X,Y) ((X)->significand >= (Y)->significand)
+#define SIGNIFICAND_LT_32(X,Y) ((X)->significand < (Y)->significand)
+#define SIGNIFICAND_LE_32(X,Y) ((X)->significand <= (Y)->significand)
+
+#if defined(SIZE_INT_32)
+# define SIGNIFICAND_EQ_64(X,Y) \
+  (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand == (Y)->lo_significand))
+# define SIGNIFICAND_GT_64(X,Y) (((X)->hi_significand > (Y)->hi_significand) || \
+  (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand >  (Y)->lo_significand)))
+# define SIGNIFICAND_GE_64(X,Y) (((X)->hi_significand > (Y)->hi_significand) || \
+  (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand >= (Y)->lo_significand)))
+# define SIGNIFICAND_LT_64(X,Y) (((X)->hi_significand < (Y)->hi_significand) || \
+  (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand <  (Y)->lo_significand)))
+# define SIGNIFICAND_LE_64(X,Y) (((X)->hi_significand < (Y)->hi_significand) || \
+  (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand <= (Y)->lo_significand)))
+#elif defined(SIZE_INT_64)
+# define SIGNIFICAND_EQ_64(X,Y) ((X)->significand == (Y)->significand)
+# define SIGNIFICAND_GT_64(X,Y) ((X)->significand >  (Y)->significand)
+# define SIGNIFICAND_GE_64(X,Y) ((X)->significand >= (Y)->significand)
+# define SIGNIFICAND_LT_64(X,Y) ((X)->significand <  (Y)->significand)
+# define SIGNIFICAND_LE_64(X,Y) ((X)->significand <= (Y)->significand)
 #endif
+
+#if defined(SIZE_INT_32)
+# define SIGNIFICAND_EQ_80(X,Y) \
+    (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand == (Y)->lo_significand))
+# define SIGNIFICAND_GT_80(X,Y) (((X)->hi_significand > (Y)->hi_significand) || \
+    (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand >  (Y)->lo_significand)))
+# define SIGNIFICAND_GE_80(X,Y) (((X)->hi_significand > (Y)->hi_significand) || \
+    (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand >= (Y)->lo_significand)))
+# define SIGNIFICAND_LT_80(X,Y) (((X)->hi_significand < (Y)->hi_significand) || \
+    (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand <  (Y)->lo_significand)))
+# define SIGNIFICAND_LE_80(X,Y) (((X)->hi_significand < (Y)->hi_significand) || \
+    (((X)->hi_significand == (Y)->hi_significand) && ((X)->lo_significand <= (Y)->lo_significand)))
+#elif defined(SIZE_INT_64)
+# define SIGNIFICAND_EQ_80(X,Y) ((X)->significand == (Y)->significand)
+# define SIGNIFICAND_GT_80(X,Y) ((X)->significand >  (Y)->significand)
+# define SIGNIFICAND_GE_80(X,Y) ((X)->significand >= (Y)->significand)
+# define SIGNIFICAND_LT_80(X,Y) ((X)->significand <  (Y)->significand)
+# define SIGNIFICAND_LE_80(X,Y) ((X)->significand <= (Y)->significand)
+#endif
+
+#define VALUE_EQ_32(X,Y) \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_EQ_32(X, Y)))
+#define VALUE_GT_32(X,Y) (((X)->exponent > (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_GT_32(X, Y))))
+#define VALUE_GE_32(X,Y) (((X)->exponent > (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_GE_32(X, Y))))
+#define VALUE_LT_32(X,Y) (((X)->exponent < (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_LT_32(X, Y))))
+#define VALUE_LE_32(X,Y) (((X)->exponent < (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_LE_32(X, Y))))
+
+#define VALUE_EQ_64(X,Y) \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_EQ_64(X, Y)))
+#define VALUE_GT_64(X,Y) (((X)->exponent > (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_GT_64(X, Y))))
+#define VALUE_GE_64(X,Y) (((X)->exponent > (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_GE_64(X, Y))))
+#define VALUE_LT_64(X,Y) (((X)->exponent < (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_LT_64(X, Y))))
+#define VALUE_LE_64(X,Y) (((X)->exponent < (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_LE_64(X, Y))))
+
+#define VALUE_EQ_80(X,Y) \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_EQ_80(X, Y)))
+#define VALUE_GT_80(X,Y) (((X)->exponent > (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_GT_80(X, Y))))
+#define VALUE_GE_80(X,Y) (((X)->exponent > (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_GE_80(X, Y))))
+#define VALUE_LT_80(X,Y) (((X)->exponent < (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_LT_80(X, Y))))
+#define VALUE_LE_80(X,Y) (((X)->exponent < (Y)->exponent) || \
+   (((X)->exponent == (Y)->exponent) && (SIGNIFICAND_LE_80(X, Y))))
+
+/* add/subtract 1 ulp macros */
+
+#if defined(SIZE_INT_32)
+# define ADD_ULP_80(X) \
+    if ((++(X)->lo_significand == 0) && \
+        (++(X)->hi_significand == (((X)->exponent == 0) ? 0x80000000 : 0))) \
+    { \
+        (X)->hi_significand |= 0x80000000; \
+        ++(X)->exponent; \
+    }
+# define SUB_ULP_80(X) \
+    if (--(X)->lo_significand == 0xFFFFFFFF) { \
+        --(X)->hi_significand; \
+        if (((X)->exponent != 0) && \
+            ((X)->hi_significand == 0x7FFFFFFF) && \
+            (--(X)->exponent != 0)) \
+        { \
+            (X)->hi_significand |= 0x80000000; \
+        } \
+    }
+#elif defined(SIZE_INT_64)
+# define ADD_ULP_80(X) \
+    if (++(X)->significand == (((X)->exponent == 0) ? 0x8000000000000000 : 0))) { \
+        (X)->significand |= 0x8000000000000000; \
+        ++(X)->exponent; \
+    }
+# define SUB_ULP_80(X) \
+    { \
+        --(X)->significand; \
+        if (((X)->exponent != 0) && \
+            ((X)->significand == 0x7FFFFFFFFFFFFFFF) && \
+            (--(X)->exponent != 0)) \
+        { \
+            (X)->significand |= 0x8000000000000000; \
+        } \
+    }
+#endif
+
+
+/* error codes */
+
+#define DOMAIN     1   /* argument domain error */
+#define SING       2   /* argument singularity */
+#define OVERFLOW   3   /* overflow range error */
+#define UNDERFLOW  4   /* underflow range error */
+#define TLOSS      5   /* total loss of precision */
+#define PLOSS      6   /* partial loss of precision */
+
+/* */
+
+#define VOLATILE_32 /*volatile*/
+#define VOLATILE_64 /*volatile*/
+#define VOLATILE_80 /*volatile*/
+
+#define QUAD_TYPE _Quad
+
+#endif    /*__LIBM_SUPPORT_H_INCLUDED__*/
diff --git a/sysdeps/ia64/fpu/printf_fphex.c b/sysdeps/ia64/fpu/printf_fphex.c
index 42f64b2ab2..5def1905d8 100644
--- a/sysdeps/ia64/fpu/printf_fphex.c
+++ b/sysdeps/ia64/fpu/printf_fphex.c
@@ -1,5 +1,5 @@
 /* Print floating point number in hexadecimal notation according to ISO C99.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2005 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
@@ -78,4 +78,4 @@ do {									      \
 	}								      \
 } while (0)
 
-#include <sysdeps/generic/printf_fphex.c>
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ia64/fpu/s_asinh.S b/sysdeps/ia64/fpu/s_asinh.S
new file mode 100644
index 0000000000..7eba39eb40
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_asinh.S
@@ -0,0 +1,1138 @@
+.file "asinh.s"
+
+
+// Copyright (c) 2000 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// ==============================================================
+// History
+// ==============================================================
+// 04/02/01 Initial version
+// 04/19/01 Improved speed of the paths #1,2,3,4,5
+// 10/18/01 Improved accuracy
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 05/21/03 Improved performance, fixed to handle unorms
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+// ==============================================================
+// double asinh(double)
+//
+// Overview of operation
+// ==============================================================
+//
+// There are 7 paths:
+// 1. x = 0.0
+//    Return asinh(x) = 0.0
+//
+// 2. 0.0 <|x| < 2^(-3)
+//    Return asinh(x) = POL13(x),
+//         where POL13(x) = (x^2*C13 + ...)*x^2 + C5)*x^2 + C3)*x^3 + x
+//
+// 3. 2^(-3) <= |x| < 2^63
+//    Return asinh(x) = sign(x)*(log(|x| + sqrt(x^2 + 1.0)))
+//    To compute x + sqrt(x^2 + 1.0) modified Newton Raphson method is used
+//      (3 iterations)
+//    Algorithm description for log function see below.
+//
+// 4. 2^63 <= |x| < +INF
+//    Return asinh(x) = sign(x)*log(2*|x|)
+//    Algorithm description for log function see below.
+//
+// 5. x = INF
+//    Return asinh(x) = INF
+//
+// 6. x = [S,Q]NaN
+//    Return asinh(x) = QNaN
+//
+// 7. x = denormal
+//    Return asinh(x) = x correctly rounded
+//
+//==============================================================
+// Algorithm Description for log(x) function
+// Below we are using the fact that inequality x - 1.0 > 2^(-6) is always
+//   true for this asinh implementation
+//
+// Consider  x = 2^N 1.f1 f2 f3 f4...f63
+// Log(x) = log(frcpa(x) x/frcpa(x))
+//        = log(1/frcpa(x)) + log(frcpa(x) x)
+//        = -log(frcpa(x)) + log(frcpa(x) x)
+//
+// frcpa(x)       = 2^-N frcpa((1.f1 f2 ... f63)
+//
+// -log(frcpa(x)) = -log(C)
+//                = -log(2^-N) - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 + log(frcpa(1.f1 f2 ... f63))
+//
+// Log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + log(1./frcpa(1.f1 f2 ... f63)) + log(frcpa(x) x)
+// Log(x) =  +Nlog2 - log(/frcpa(1.f1 f2 ... f63))   + log(frcpa(x) x)
+// Log(x) =  +Nlog2 + T                              + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + T                     + log(C x)
+//
+// Cx = 1 + r
+//
+// Log(x) =  +Nlog2 + T  + log(1+r)
+// Log(x) =  +Nlog2 + T  + Series( r - r^2/2 + r^3/3 - r^4/4 ....)
+//
+// 1.f1 f2 ... f8 has 256 entries.
+// They are 1 + k/2^8, k = 0 ... 255
+// These 256 values are the table entries.
+//
+// Implementation
+//==============================================================
+// C = frcpa(x)
+// r = C * x - 1
+//
+// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4 + P4*r^5 + P5*r^6
+//
+// x = f * 2*n where f is 1.f_1f_2f_3....f_63
+// Nfloat = float(n)  where n is the true unbiased exponent
+// pre-index = f_1f_2....f_8
+// index = pre_index * 16
+// get the dxt table entry at index + offset = T
+//
+// result = (T + Nfloat * log(2)) + rseries
+//
+// The T table is calculated as follows
+// Form x_k = 1 + k/2^8 where k goes from 0... 255
+//      y_k = frcpa(x_k)
+//      log(1/y_k)  in quad and round to double-extended
+//
+//
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f9 -> f15,  f32 -> f68
+
+// General registers used:
+// r14 -> r27
+
+// Predicate registers used:
+// p6 -> p14
+
+// p6 to filter out case when x = [Q,S]NaN or INF or zero
+// p7 to filter out case when x < 0.0
+// p8 to select path #2
+// p9 used in the frcpa from path #3
+// p11 to filter out case when x >= 0
+// p12 to filter out case when x = unorm
+// p13 to select path #4
+// Assembly macros
+//==============================================================
+log_GR_exp_17_ones    = r14
+log_GR_signexp_f8     = r15
+log_table_address2    = r16
+log_GR_exp_16_ones    = r17
+log_GR_exp_f8         = r18
+log_GR_true_exp_f8    = r19
+log_GR_significand_f8 = r20
+log_GR_index          = r21
+log_GR_comp2          = r22
+asinh_GR_f8           = r23
+asinh_GR_comp         = r24
+asinh_GR_f8           = r25
+log_table_address3    = r26
+NR_table_address      = r27
+
+//==============================================================
+log_y            = f9
+NR1              = f10
+NR2              = f11
+log_y_rs         = f12
+log_y_rs_iter    = f13
+log_y_rs_iter1   = f14
+fNormX           = f15
+asinh_w_sq       = f32
+log_C13          = f33
+log_C11          = f34
+log_P3           = f35
+log_P2           = f36
+log_P1           = f37
+log_P5           = f38
+log_P4           = f39
+log_C3           = f40
+log_C5           = f41
+log_C7           = f42
+log2             = f43
+asinh_f8         = f44
+log_C            = f45
+log_arg          = f46
+log_C9           = f47
+asinh_w_four     = f48
+log_int_Nfloat   = f49
+log_r            = f50
+log_rsq          = f51
+log_rp_p4        = f52
+log_rp_p32       = f53
+log_rcube        = f54
+log_rp_p10       = f55
+log_rp_p2        = f56
+log_Nfloat       = f57
+log_T            = f58
+log_r2P_r        = f59
+log_T_plus_Nlog2 = f60
+asinh_w_3        = f61
+asinh_w_5        = f62
+asinh_w_cube     = f63
+asinh_w_7        = f64
+log_arg_early    = f65
+asinh_w_9        = f66
+asinh_w_13       = f67
+asinh_w_seven    = f68
+
+// Data tables
+//==============================================================
+
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(log_table_1)
+data8 0xBFC5555DA7212371 // P5
+data8 0x3FC999A19EEF5826 // P4
+data8 0xBFCFFFFFFFFEF009 // P3
+data8 0x3FD555555554ECB2 // P2
+data8 0xBFE0000000000000 // P1 = -0.5
+data8 0x0000000000000000 // pad
+data8 0xb17217f7d1cf79ac, 0x00003ffe  // log2
+LOCAL_OBJECT_END(log_table_1)
+
+LOCAL_OBJECT_START(log_table_2)
+data8 0x3FE0000000000000 // 0.5
+data8 0x4008000000000000 // 3.0
+//
+data8 0x8824BE4D74BC4F00, 0x00003FF9 // C13
+data8 0xB725A2CD9556CC57, 0x0000BFF9 // C11
+data8 0xF8E339127FBFF49D, 0x00003FF9 // C9
+data8 0xB6DB6D7DCE17CB78, 0x0000BFFA // C7
+data8 0x999999998802CCEF, 0x00003FFB // C5
+data8 0xAAAAAAAAAAA8DC40, 0x0000BFFC // C3
+LOCAL_OBJECT_END(log_table_2)
+
+
+LOCAL_OBJECT_START(log_table_3)
+data8 0x80200aaeac44ef38 , 0x00003ff6 //   log(1/frcpa(1+  0/2^-8))
+//
+data8 0xc09090a2c35aa070 , 0x00003ff7 //   log(1/frcpa(1+  1/2^-8))
+data8 0xa0c94fcb41977c75 , 0x00003ff8 //   log(1/frcpa(1+  2/2^-8))
+data8 0xe18b9c263af83301 , 0x00003ff8 //   log(1/frcpa(1+  3/2^-8))
+data8 0x8d35c8d6399c30ea , 0x00003ff9 //   log(1/frcpa(1+  4/2^-8))
+data8 0xadd4d2ecd601cbb8 , 0x00003ff9 //   log(1/frcpa(1+  5/2^-8))
+//
+data8 0xce95403a192f9f01 , 0x00003ff9 //   log(1/frcpa(1+  6/2^-8))
+data8 0xeb59392cbcc01096 , 0x00003ff9 //   log(1/frcpa(1+  7/2^-8))
+data8 0x862c7d0cefd54c5d , 0x00003ffa //   log(1/frcpa(1+  8/2^-8))
+data8 0x94aa63c65e70d499 , 0x00003ffa //   log(1/frcpa(1+  9/2^-8))
+data8 0xa54a696d4b62b382 , 0x00003ffa //   log(1/frcpa(1+ 10/2^-8))
+//
+data8 0xb3e4a796a5dac208 , 0x00003ffa //   log(1/frcpa(1+ 11/2^-8))
+data8 0xc28c45b1878340a9 , 0x00003ffa //   log(1/frcpa(1+ 12/2^-8))
+data8 0xd35c55f39d7a6235 , 0x00003ffa //   log(1/frcpa(1+ 13/2^-8))
+data8 0xe220f037b954f1f5 , 0x00003ffa //   log(1/frcpa(1+ 14/2^-8))
+data8 0xf0f3389b036834f3 , 0x00003ffa //   log(1/frcpa(1+ 15/2^-8))
+//
+data8 0xffd3488d5c980465 , 0x00003ffa //   log(1/frcpa(1+ 16/2^-8))
+data8 0x87609ce2ed300490 , 0x00003ffb //   log(1/frcpa(1+ 17/2^-8))
+data8 0x8ede9321e8c85927 , 0x00003ffb //   log(1/frcpa(1+ 18/2^-8))
+data8 0x96639427f2f8e2f4 , 0x00003ffb //   log(1/frcpa(1+ 19/2^-8))
+data8 0x9defad3e8f73217b , 0x00003ffb //   log(1/frcpa(1+ 20/2^-8))
+//
+data8 0xa582ebd50097029c , 0x00003ffb //   log(1/frcpa(1+ 21/2^-8))
+data8 0xac06dbe75ab80fee , 0x00003ffb //   log(1/frcpa(1+ 22/2^-8))
+data8 0xb3a78449b2d3ccca , 0x00003ffb //   log(1/frcpa(1+ 23/2^-8))
+data8 0xbb4f79635ab46bb2 , 0x00003ffb //   log(1/frcpa(1+ 24/2^-8))
+data8 0xc2fec93a83523f3f , 0x00003ffb //   log(1/frcpa(1+ 25/2^-8))
+//
+data8 0xc99af2eaca4c4571 , 0x00003ffb //   log(1/frcpa(1+ 26/2^-8))
+data8 0xd1581106472fa653 , 0x00003ffb //   log(1/frcpa(1+ 27/2^-8))
+data8 0xd8002560d4355f2e , 0x00003ffb //   log(1/frcpa(1+ 28/2^-8))
+data8 0xdfcb43b4fe508632 , 0x00003ffb //   log(1/frcpa(1+ 29/2^-8))
+data8 0xe67f6dff709d4119 , 0x00003ffb //   log(1/frcpa(1+ 30/2^-8))
+//
+data8 0xed393b1c22351280 , 0x00003ffb //   log(1/frcpa(1+ 31/2^-8))
+data8 0xf5192bff087bcc35 , 0x00003ffb //   log(1/frcpa(1+ 32/2^-8))
+data8 0xfbdf4ff6dfef2fa3 , 0x00003ffb //   log(1/frcpa(1+ 33/2^-8))
+data8 0x81559a97f92f9cc7 , 0x00003ffc //   log(1/frcpa(1+ 34/2^-8))
+data8 0x84be72bce90266e8 , 0x00003ffc //   log(1/frcpa(1+ 35/2^-8))
+//
+data8 0x88bc74113f23def2 , 0x00003ffc //   log(1/frcpa(1+ 36/2^-8))
+data8 0x8c2ba3edf6799d11 , 0x00003ffc //   log(1/frcpa(1+ 37/2^-8))
+data8 0x8f9dc92f92ea08b1 , 0x00003ffc //   log(1/frcpa(1+ 38/2^-8))
+data8 0x9312e8f36efab5a7 , 0x00003ffc //   log(1/frcpa(1+ 39/2^-8))
+data8 0x968b08643409ceb6 , 0x00003ffc //   log(1/frcpa(1+ 40/2^-8))
+//
+data8 0x9a062cba08a1708c , 0x00003ffc //   log(1/frcpa(1+ 41/2^-8))
+data8 0x9d845b3abf95485c , 0x00003ffc //   log(1/frcpa(1+ 42/2^-8))
+data8 0xa06fd841bc001bb4 , 0x00003ffc //   log(1/frcpa(1+ 43/2^-8))
+data8 0xa3f3a74652fbe0db , 0x00003ffc //   log(1/frcpa(1+ 44/2^-8))
+data8 0xa77a8fb2336f20f5 , 0x00003ffc //   log(1/frcpa(1+ 45/2^-8))
+//
+data8 0xab0497015d28b0a0 , 0x00003ffc //   log(1/frcpa(1+ 46/2^-8))
+data8 0xae91c2be6ba6a615 , 0x00003ffc //   log(1/frcpa(1+ 47/2^-8))
+data8 0xb189d1b99aebb20b , 0x00003ffc //   log(1/frcpa(1+ 48/2^-8))
+data8 0xb51cced5de9c1b2c , 0x00003ffc //   log(1/frcpa(1+ 49/2^-8))
+data8 0xb819bee9e720d42f , 0x00003ffc //   log(1/frcpa(1+ 50/2^-8))
+//
+data8 0xbbb2a0947b093a5d , 0x00003ffc //   log(1/frcpa(1+ 51/2^-8))
+data8 0xbf4ec1505811684a , 0x00003ffc //   log(1/frcpa(1+ 52/2^-8))
+data8 0xc2535bacfa8975ff , 0x00003ffc //   log(1/frcpa(1+ 53/2^-8))
+data8 0xc55a3eafad187eb8 , 0x00003ffc //   log(1/frcpa(1+ 54/2^-8))
+data8 0xc8ff2484b2c0da74 , 0x00003ffc //   log(1/frcpa(1+ 55/2^-8))
+//
+data8 0xcc0b1a008d53ab76 , 0x00003ffc //   log(1/frcpa(1+ 56/2^-8))
+data8 0xcfb6203844b3209b , 0x00003ffc //   log(1/frcpa(1+ 57/2^-8))
+data8 0xd2c73949a47a19f5 , 0x00003ffc //   log(1/frcpa(1+ 58/2^-8))
+data8 0xd5daae18b49d6695 , 0x00003ffc //   log(1/frcpa(1+ 59/2^-8))
+data8 0xd8f08248cf7e8019 , 0x00003ffc //   log(1/frcpa(1+ 60/2^-8))
+//
+data8 0xdca7749f1b3e540e , 0x00003ffc //   log(1/frcpa(1+ 61/2^-8))
+data8 0xdfc28e033aaaf7c7 , 0x00003ffc //   log(1/frcpa(1+ 62/2^-8))
+data8 0xe2e012a5f91d2f55 , 0x00003ffc //   log(1/frcpa(1+ 63/2^-8))
+data8 0xe600064ed9e292a8 , 0x00003ffc //   log(1/frcpa(1+ 64/2^-8))
+data8 0xe9226cce42b39f60 , 0x00003ffc //   log(1/frcpa(1+ 65/2^-8))
+//
+data8 0xec4749fd97a28360 , 0x00003ffc //   log(1/frcpa(1+ 66/2^-8))
+data8 0xef6ea1bf57780495 , 0x00003ffc //   log(1/frcpa(1+ 67/2^-8))
+data8 0xf29877ff38809091 , 0x00003ffc //   log(1/frcpa(1+ 68/2^-8))
+data8 0xf5c4d0b245cb89be , 0x00003ffc //   log(1/frcpa(1+ 69/2^-8))
+data8 0xf8f3afd6fcdef3aa , 0x00003ffc //   log(1/frcpa(1+ 70/2^-8))
+//
+data8 0xfc2519756be1abc7 , 0x00003ffc //   log(1/frcpa(1+ 71/2^-8))
+data8 0xff59119f503e6832 , 0x00003ffc //   log(1/frcpa(1+ 72/2^-8))
+data8 0x8147ce381ae0e146 , 0x00003ffd //   log(1/frcpa(1+ 73/2^-8))
+data8 0x82e45f06cb1ad0f2 , 0x00003ffd //   log(1/frcpa(1+ 74/2^-8))
+data8 0x842f5c7c573cbaa2 , 0x00003ffd //   log(1/frcpa(1+ 75/2^-8))
+//
+data8 0x85ce471968c8893a , 0x00003ffd //   log(1/frcpa(1+ 76/2^-8))
+data8 0x876e8305bc04066d , 0x00003ffd //   log(1/frcpa(1+ 77/2^-8))
+data8 0x891012678031fbb3 , 0x00003ffd //   log(1/frcpa(1+ 78/2^-8))
+data8 0x8a5f1493d766a05f , 0x00003ffd //   log(1/frcpa(1+ 79/2^-8))
+data8 0x8c030c778c56fa00 , 0x00003ffd //   log(1/frcpa(1+ 80/2^-8))
+//
+data8 0x8da85df17e31d9ae , 0x00003ffd //   log(1/frcpa(1+ 81/2^-8))
+data8 0x8efa663e7921687e , 0x00003ffd //   log(1/frcpa(1+ 82/2^-8))
+data8 0x90a22b6875c6a1f8 , 0x00003ffd //   log(1/frcpa(1+ 83/2^-8))
+data8 0x91f62cc8f5d24837 , 0x00003ffd //   log(1/frcpa(1+ 84/2^-8))
+data8 0x93a06cfc3857d980 , 0x00003ffd //   log(1/frcpa(1+ 85/2^-8))
+//
+data8 0x94f66d5e6fd01ced , 0x00003ffd //   log(1/frcpa(1+ 86/2^-8))
+data8 0x96a330156e6772f2 , 0x00003ffd //   log(1/frcpa(1+ 87/2^-8))
+data8 0x97fb3582754ea25b , 0x00003ffd //   log(1/frcpa(1+ 88/2^-8))
+data8 0x99aa8259aad1bbf2 , 0x00003ffd //   log(1/frcpa(1+ 89/2^-8))
+data8 0x9b0492f6227ae4a8 , 0x00003ffd //   log(1/frcpa(1+ 90/2^-8))
+//
+data8 0x9c5f8e199bf3a7a5 , 0x00003ffd //   log(1/frcpa(1+ 91/2^-8))
+data8 0x9e1293b9998c1daa , 0x00003ffd //   log(1/frcpa(1+ 92/2^-8))
+data8 0x9f6fa31e0b41f308 , 0x00003ffd //   log(1/frcpa(1+ 93/2^-8))
+data8 0xa0cda11eaf46390e , 0x00003ffd //   log(1/frcpa(1+ 94/2^-8))
+data8 0xa22c8f029cfa45aa , 0x00003ffd //   log(1/frcpa(1+ 95/2^-8))
+//
+data8 0xa3e48badb7856b34 , 0x00003ffd //   log(1/frcpa(1+ 96/2^-8))
+data8 0xa5459a0aa95849f9 , 0x00003ffd //   log(1/frcpa(1+ 97/2^-8))
+data8 0xa6a79c84480cfebd , 0x00003ffd //   log(1/frcpa(1+ 98/2^-8))
+data8 0xa80a946d0fcb3eb2 , 0x00003ffd //   log(1/frcpa(1+ 99/2^-8))
+data8 0xa96e831a3ea7b314 , 0x00003ffd //   log(1/frcpa(1+100/2^-8))
+//
+data8 0xaad369e3dc544e3b , 0x00003ffd //   log(1/frcpa(1+101/2^-8))
+data8 0xac92e9588952c815 , 0x00003ffd //   log(1/frcpa(1+102/2^-8))
+data8 0xadfa035aa1ed8fdc , 0x00003ffd //   log(1/frcpa(1+103/2^-8))
+data8 0xaf6219eae1ad6e34 , 0x00003ffd //   log(1/frcpa(1+104/2^-8))
+data8 0xb0cb2e6d8160f753 , 0x00003ffd //   log(1/frcpa(1+105/2^-8))
+//
+data8 0xb2354249ad950f72 , 0x00003ffd //   log(1/frcpa(1+106/2^-8))
+data8 0xb3a056e98ef4a3b4 , 0x00003ffd //   log(1/frcpa(1+107/2^-8))
+data8 0xb50c6dba52c6292a , 0x00003ffd //   log(1/frcpa(1+108/2^-8))
+data8 0xb679882c33876165 , 0x00003ffd //   log(1/frcpa(1+109/2^-8))
+data8 0xb78c07429785cedc , 0x00003ffd //   log(1/frcpa(1+110/2^-8))
+//
+data8 0xb8faeb8dc4a77d24 , 0x00003ffd //   log(1/frcpa(1+111/2^-8))
+data8 0xba6ad77eb36ae0d6 , 0x00003ffd //   log(1/frcpa(1+112/2^-8))
+data8 0xbbdbcc915e9bee50 , 0x00003ffd //   log(1/frcpa(1+113/2^-8))
+data8 0xbd4dcc44f8cf12ef , 0x00003ffd //   log(1/frcpa(1+114/2^-8))
+data8 0xbec0d81bf5b531fa , 0x00003ffd //   log(1/frcpa(1+115/2^-8))
+//
+data8 0xc034f19c139186f4 , 0x00003ffd //   log(1/frcpa(1+116/2^-8))
+data8 0xc14cb69f7c5e55ab , 0x00003ffd //   log(1/frcpa(1+117/2^-8))
+data8 0xc2c2abbb6e5fd56f , 0x00003ffd //   log(1/frcpa(1+118/2^-8))
+data8 0xc439b2c193e6771e , 0x00003ffd //   log(1/frcpa(1+119/2^-8))
+data8 0xc553acb9d5c67733 , 0x00003ffd //   log(1/frcpa(1+120/2^-8))
+//
+data8 0xc6cc96e441272441 , 0x00003ffd //   log(1/frcpa(1+121/2^-8))
+data8 0xc8469753eca88c30 , 0x00003ffd //   log(1/frcpa(1+122/2^-8))
+data8 0xc962cf3ce072b05c , 0x00003ffd //   log(1/frcpa(1+123/2^-8))
+data8 0xcadeba8771f694aa , 0x00003ffd //   log(1/frcpa(1+124/2^-8))
+data8 0xcc5bc08d1f72da94 , 0x00003ffd //   log(1/frcpa(1+125/2^-8))
+//
+data8 0xcd7a3f99ea035c29 , 0x00003ffd //   log(1/frcpa(1+126/2^-8))
+data8 0xcef93860c8a53c35 , 0x00003ffd //   log(1/frcpa(1+127/2^-8))
+data8 0xd0192f68a7ed23df , 0x00003ffd //   log(1/frcpa(1+128/2^-8))
+data8 0xd19a201127d3c645 , 0x00003ffd //   log(1/frcpa(1+129/2^-8))
+data8 0xd2bb92f4061c172c , 0x00003ffd //   log(1/frcpa(1+130/2^-8))
+//
+data8 0xd43e80b2ee8cc8fc , 0x00003ffd //   log(1/frcpa(1+131/2^-8))
+data8 0xd56173601fc4ade4 , 0x00003ffd //   log(1/frcpa(1+132/2^-8))
+data8 0xd6e6637efb54086f , 0x00003ffd //   log(1/frcpa(1+133/2^-8))
+data8 0xd80ad9f58f3c8193 , 0x00003ffd //   log(1/frcpa(1+134/2^-8))
+data8 0xd991d1d31aca41f8 , 0x00003ffd //   log(1/frcpa(1+135/2^-8))
+//
+data8 0xdab7d02231484a93 , 0x00003ffd //   log(1/frcpa(1+136/2^-8))
+data8 0xdc40d532cde49a54 , 0x00003ffd //   log(1/frcpa(1+137/2^-8))
+data8 0xdd685f79ed8b265e , 0x00003ffd //   log(1/frcpa(1+138/2^-8))
+data8 0xde9094bbc0e17b1d , 0x00003ffd //   log(1/frcpa(1+139/2^-8))
+data8 0xe01c91b78440c425 , 0x00003ffd //   log(1/frcpa(1+140/2^-8))
+//
+data8 0xe14658f26997e729 , 0x00003ffd //   log(1/frcpa(1+141/2^-8))
+data8 0xe270cdc2391e0d23 , 0x00003ffd //   log(1/frcpa(1+142/2^-8))
+data8 0xe3ffce3a2aa64922 , 0x00003ffd //   log(1/frcpa(1+143/2^-8))
+data8 0xe52bdb274ed82887 , 0x00003ffd //   log(1/frcpa(1+144/2^-8))
+data8 0xe6589852e75d7df6 , 0x00003ffd //   log(1/frcpa(1+145/2^-8))
+//
+data8 0xe786068c79937a7d , 0x00003ffd //   log(1/frcpa(1+146/2^-8))
+data8 0xe91903adad100911 , 0x00003ffd //   log(1/frcpa(1+147/2^-8))
+data8 0xea481236f7d35bb0 , 0x00003ffd //   log(1/frcpa(1+148/2^-8))
+data8 0xeb77d48c692e6b14 , 0x00003ffd //   log(1/frcpa(1+149/2^-8))
+data8 0xeca84b83d7297b87 , 0x00003ffd //   log(1/frcpa(1+150/2^-8))
+//
+data8 0xedd977f4962aa158 , 0x00003ffd //   log(1/frcpa(1+151/2^-8))
+data8 0xef7179a22f257754 , 0x00003ffd //   log(1/frcpa(1+152/2^-8))
+data8 0xf0a450d139366ca7 , 0x00003ffd //   log(1/frcpa(1+153/2^-8))
+data8 0xf1d7e0524ff9ffdb , 0x00003ffd //   log(1/frcpa(1+154/2^-8))
+data8 0xf30c29036a8b6cae , 0x00003ffd //   log(1/frcpa(1+155/2^-8))
+//
+data8 0xf4412bc411ea8d92 , 0x00003ffd //   log(1/frcpa(1+156/2^-8))
+data8 0xf576e97564c8619d , 0x00003ffd //   log(1/frcpa(1+157/2^-8))
+data8 0xf6ad62fa1b5f172f , 0x00003ffd //   log(1/frcpa(1+158/2^-8))
+data8 0xf7e499368b55c542 , 0x00003ffd //   log(1/frcpa(1+159/2^-8))
+data8 0xf91c8d10abaffe22 , 0x00003ffd //   log(1/frcpa(1+160/2^-8))
+//
+data8 0xfa553f7018c966f3 , 0x00003ffd //   log(1/frcpa(1+161/2^-8))
+data8 0xfb8eb13e185d802c , 0x00003ffd //   log(1/frcpa(1+162/2^-8))
+data8 0xfcc8e3659d9bcbed , 0x00003ffd //   log(1/frcpa(1+163/2^-8))
+data8 0xfe03d6d34d487fd2 , 0x00003ffd //   log(1/frcpa(1+164/2^-8))
+data8 0xff3f8c7581e9f0ae , 0x00003ffd //   log(1/frcpa(1+165/2^-8))
+//
+data8 0x803e029e280173ae , 0x00003ffe //   log(1/frcpa(1+166/2^-8))
+data8 0x80dca10cc52d0757 , 0x00003ffe //   log(1/frcpa(1+167/2^-8))
+data8 0x817ba200632755a1 , 0x00003ffe //   log(1/frcpa(1+168/2^-8))
+data8 0x821b05f3b01d6774 , 0x00003ffe //   log(1/frcpa(1+169/2^-8))
+data8 0x82bacd623ff19d06 , 0x00003ffe //   log(1/frcpa(1+170/2^-8))
+//
+data8 0x835af8c88e7a8f47 , 0x00003ffe //   log(1/frcpa(1+171/2^-8))
+data8 0x83c5f8299e2b4091 , 0x00003ffe //   log(1/frcpa(1+172/2^-8))
+data8 0x8466cb43f3d87300 , 0x00003ffe //   log(1/frcpa(1+173/2^-8))
+data8 0x850803a67c80ca4b , 0x00003ffe //   log(1/frcpa(1+174/2^-8))
+data8 0x85a9a1d11a23b461 , 0x00003ffe //   log(1/frcpa(1+175/2^-8))
+//
+data8 0x864ba644a18e6e05 , 0x00003ffe //   log(1/frcpa(1+176/2^-8))
+data8 0x86ee1182dcc432f7 , 0x00003ffe //   log(1/frcpa(1+177/2^-8))
+data8 0x875a925d7e48c316 , 0x00003ffe //   log(1/frcpa(1+178/2^-8))
+data8 0x87fdaa109d23aef7 , 0x00003ffe //   log(1/frcpa(1+179/2^-8))
+data8 0x88a129ed4becfaf2 , 0x00003ffe //   log(1/frcpa(1+180/2^-8))
+//
+data8 0x89451278ecd7f9cf , 0x00003ffe //   log(1/frcpa(1+181/2^-8))
+data8 0x89b29295f8432617 , 0x00003ffe //   log(1/frcpa(1+182/2^-8))
+data8 0x8a572ac5a5496882 , 0x00003ffe //   log(1/frcpa(1+183/2^-8))
+data8 0x8afc2d0ce3b2dadf , 0x00003ffe //   log(1/frcpa(1+184/2^-8))
+data8 0x8b6a69c608cfd3af , 0x00003ffe //   log(1/frcpa(1+185/2^-8))
+//
+data8 0x8c101e106e899a83 , 0x00003ffe //   log(1/frcpa(1+186/2^-8))
+data8 0x8cb63de258f9d626 , 0x00003ffe //   log(1/frcpa(1+187/2^-8))
+data8 0x8d2539c5bd19e2b1 , 0x00003ffe //   log(1/frcpa(1+188/2^-8))
+data8 0x8dcc0e064b29e6f1 , 0x00003ffe //   log(1/frcpa(1+189/2^-8))
+data8 0x8e734f45d88357ae , 0x00003ffe //   log(1/frcpa(1+190/2^-8))
+//
+data8 0x8ee30cef034a20db , 0x00003ffe //   log(1/frcpa(1+191/2^-8))
+data8 0x8f8b0515686d1d06 , 0x00003ffe //   log(1/frcpa(1+192/2^-8))
+data8 0x90336bba039bf32f , 0x00003ffe //   log(1/frcpa(1+193/2^-8))
+data8 0x90a3edd23d1c9d58 , 0x00003ffe //   log(1/frcpa(1+194/2^-8))
+data8 0x914d0de2f5d61b32 , 0x00003ffe //   log(1/frcpa(1+195/2^-8))
+//
+data8 0x91be0c20d28173b5 , 0x00003ffe //   log(1/frcpa(1+196/2^-8))
+data8 0x9267e737c06cd34a , 0x00003ffe //   log(1/frcpa(1+197/2^-8))
+data8 0x92d962ae6abb1237 , 0x00003ffe //   log(1/frcpa(1+198/2^-8))
+data8 0x9383fa6afbe2074c , 0x00003ffe //   log(1/frcpa(1+199/2^-8))
+data8 0x942f0421651c1c4e , 0x00003ffe //   log(1/frcpa(1+200/2^-8))
+//
+data8 0x94a14a3845bb985e , 0x00003ffe //   log(1/frcpa(1+201/2^-8))
+data8 0x954d133857f861e7 , 0x00003ffe //   log(1/frcpa(1+202/2^-8))
+data8 0x95bfd96468e604c4 , 0x00003ffe //   log(1/frcpa(1+203/2^-8))
+data8 0x9632d31cafafa858 , 0x00003ffe //   log(1/frcpa(1+204/2^-8))
+data8 0x96dfaabd86fa1647 , 0x00003ffe //   log(1/frcpa(1+205/2^-8))
+//
+data8 0x9753261fcbb2a594 , 0x00003ffe //   log(1/frcpa(1+206/2^-8))
+data8 0x9800c11b426b996d , 0x00003ffe //   log(1/frcpa(1+207/2^-8))
+data8 0x9874bf4d45ae663c , 0x00003ffe //   log(1/frcpa(1+208/2^-8))
+data8 0x99231f5ee9a74f79 , 0x00003ffe //   log(1/frcpa(1+209/2^-8))
+data8 0x9997a18a56bcad28 , 0x00003ffe //   log(1/frcpa(1+210/2^-8))
+//
+data8 0x9a46c873a3267e79 , 0x00003ffe //   log(1/frcpa(1+211/2^-8))
+data8 0x9abbcfc621eb6cb6 , 0x00003ffe //   log(1/frcpa(1+212/2^-8))
+data8 0x9b310cb0d354c990 , 0x00003ffe //   log(1/frcpa(1+213/2^-8))
+data8 0x9be14cf9e1b3515c , 0x00003ffe //   log(1/frcpa(1+214/2^-8))
+data8 0x9c5710b8cbb73a43 , 0x00003ffe //   log(1/frcpa(1+215/2^-8))
+//
+data8 0x9ccd0abd301f399c , 0x00003ffe //   log(1/frcpa(1+216/2^-8))
+data8 0x9d7e67f3bdce8888 , 0x00003ffe //   log(1/frcpa(1+217/2^-8))
+data8 0x9df4ea81a99daa01 , 0x00003ffe //   log(1/frcpa(1+218/2^-8))
+data8 0x9e6ba405a54514ba , 0x00003ffe //   log(1/frcpa(1+219/2^-8))
+data8 0x9f1e21c8c7bb62b3 , 0x00003ffe //   log(1/frcpa(1+220/2^-8))
+//
+data8 0x9f956593f6b6355c , 0x00003ffe //   log(1/frcpa(1+221/2^-8))
+data8 0xa00ce1092e5498c3 , 0x00003ffe //   log(1/frcpa(1+222/2^-8))
+data8 0xa0c08309c4b912c1 , 0x00003ffe //   log(1/frcpa(1+223/2^-8))
+data8 0xa1388a8c6faa2afa , 0x00003ffe //   log(1/frcpa(1+224/2^-8))
+data8 0xa1b0ca7095b5f985 , 0x00003ffe //   log(1/frcpa(1+225/2^-8))
+//
+data8 0xa22942eb47534a00 , 0x00003ffe //   log(1/frcpa(1+226/2^-8))
+data8 0xa2de62326449d0a3 , 0x00003ffe //   log(1/frcpa(1+227/2^-8))
+data8 0xa357690f88bfe345 , 0x00003ffe //   log(1/frcpa(1+228/2^-8))
+data8 0xa3d0a93f45169a4b , 0x00003ffe //   log(1/frcpa(1+229/2^-8))
+data8 0xa44a22f7ffe65f30 , 0x00003ffe //   log(1/frcpa(1+230/2^-8))
+//
+data8 0xa500c5e5b4c1aa36 , 0x00003ffe //   log(1/frcpa(1+231/2^-8))
+data8 0xa57ad064eb2ebbc2 , 0x00003ffe //   log(1/frcpa(1+232/2^-8))
+data8 0xa5f5152dedf4384e , 0x00003ffe //   log(1/frcpa(1+233/2^-8))
+data8 0xa66f9478856233ec , 0x00003ffe //   log(1/frcpa(1+234/2^-8))
+data8 0xa6ea4e7cca02c32e , 0x00003ffe //   log(1/frcpa(1+235/2^-8))
+//
+data8 0xa765437325341ccf , 0x00003ffe //   log(1/frcpa(1+236/2^-8))
+data8 0xa81e21e6c75b4020 , 0x00003ffe //   log(1/frcpa(1+237/2^-8))
+data8 0xa899ab333fe2b9ca , 0x00003ffe //   log(1/frcpa(1+238/2^-8))
+data8 0xa9157039c51ebe71 , 0x00003ffe //   log(1/frcpa(1+239/2^-8))
+data8 0xa991713433c2b999 , 0x00003ffe //   log(1/frcpa(1+240/2^-8))
+//
+data8 0xaa0dae5cbcc048b3 , 0x00003ffe //   log(1/frcpa(1+241/2^-8))
+data8 0xaa8a27ede5eb13ad , 0x00003ffe //   log(1/frcpa(1+242/2^-8))
+data8 0xab06de228a9e3499 , 0x00003ffe //   log(1/frcpa(1+243/2^-8))
+data8 0xab83d135dc633301 , 0x00003ffe //   log(1/frcpa(1+244/2^-8))
+data8 0xac3fb076adc7fe7a , 0x00003ffe //   log(1/frcpa(1+245/2^-8))
+//
+data8 0xacbd3cbbe47988f1 , 0x00003ffe //   log(1/frcpa(1+246/2^-8))
+data8 0xad3b06b1a5dc57c3 , 0x00003ffe //   log(1/frcpa(1+247/2^-8))
+data8 0xadb90e94af887717 , 0x00003ffe //   log(1/frcpa(1+248/2^-8))
+data8 0xae3754a218f7c816 , 0x00003ffe //   log(1/frcpa(1+249/2^-8))
+data8 0xaeb5d9175437afa2 , 0x00003ffe //   log(1/frcpa(1+250/2^-8))
+//
+data8 0xaf349c322e9c7cee , 0x00003ffe //   log(1/frcpa(1+251/2^-8))
+data8 0xafb39e30d1768d1c , 0x00003ffe //   log(1/frcpa(1+252/2^-8))
+data8 0xb032df51c2c93116 , 0x00003ffe //   log(1/frcpa(1+253/2^-8))
+data8 0xb0b25fd3e6035ad9 , 0x00003ffe //   log(1/frcpa(1+254/2^-8))
+data8 0xb1321ff67cba178c , 0x00003ffe //   log(1/frcpa(1+255/2^-8))
+LOCAL_OBJECT_END(log_table_3)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(asinh)
+
+{ .mfi
+      getf.exp   asinh_GR_f8 = f8        // Must recompute later if x unorm
+      fclass.m   p12,p0 = f8, 0x0b       // Test x unorm
+      mov        log_GR_exp_17_ones = 0x1ffff
+}
+{ .mfi
+      addl       NR_table_address = @ltoff(log_table_1), gp
+      fma.s1     log_y = f8, f8, f1      // y = x^2 + 1
+      mov        asinh_GR_comp = 0xfffc
+}
+;;
+
+{ .mfi
+      mov        log_GR_exp_16_ones = 0xffff //BIAS
+      fclass.m   p6,p0 = f8, 0xe7        // Test for x = NaN and inf and zero
+      mov        log_GR_comp2 = 0x1003e
+}
+{ .mfi
+      ld8        NR_table_address = [NR_table_address]
+      fma.s1     asinh_w_sq = f8,f8,f0   // x^2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fcmp.lt.s1 p7,p11 = f8,f0          // if x<0
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+      fnorm.s1   fNormX = f8             // Normalize x
+(p12) br.cond.spnt ASINH_UNORM           // Branch if x=unorm
+}
+;;
+
+ASINH_COMMON:
+// Return here if x=unorm and not denorm
+{ .mfi
+      //to get second table address
+      adds       log_table_address2 = 0x40, NR_table_address
+      fma.s1     log_arg = f8,f1,f8
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+(p6)  fma.d.s0   f8 = f8,f1,f8           // quietize nan result if x=nan
+(p6)  br.ret.spnt b0                     // Exit for x=nan and inf and zero
+}
+;;
+
+{ .mfi
+      ldfpd      NR1,NR2 = [log_table_address2],16
+      frsqrta.s1 log_y_rs,p0 = log_y     // z=1/sqrt(y)
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfe       log_C13 = [log_table_address2],16
+      nop.f      0
+      and        asinh_GR_f8 = asinh_GR_f8,log_GR_exp_17_ones
+}
+;;
+
+{ .mib
+      ldfe       log_C11 = [log_table_address2],16
+      cmp.le     p13,p0 = log_GR_comp2,asinh_GR_f8
+(p13) br.cond.spnt LOG_COMMON1           // Branch if path 4, |x| >= 2^63
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter = log_y_rs,log_y,f0  // y*z
+      nop.i      0
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+(p11) mov        asinh_f8 = fNormX
+      nop.i      0
+}
+{ .mfb
+      cmp.gt     p8,p0 = asinh_GR_comp,asinh_GR_f8
+(p7)  fnma.s1    asinh_f8 = fNormX,f1,f0
+(p8)  br.cond.spnt ASINH_NEAR_ZERO       // Branch if path 2, 0 < |x| < 2^-3
+}
+;;
+
+// Here if main path, 2^-3 <= |x| < 2^63
+///////////////////////////////// The first iteration /////////////////////////
+{ .mfi
+      ldfpd      log_P5,log_P4 = [NR_table_address],16
+      fnma.s1    log_y_rs_iter = log_y_rs_iter,log_y_rs,NR2     // 3-(y*z)*z
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs,NR1,f0               // 0.5*z
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfpd      log_P3,log_P2 = [NR_table_address],16
+      // (0.5*z)*(3-(y*z)*z)
+      fma.s1     log_y_rs_iter = log_y_rs_iter1,log_y_rs_iter,f0
+      nop.i      0
+}
+;;
+
+/////////////////////////// The second iteration /////////////////////////////
+{ .mfi
+      ldfd       log_P1 = [NR_table_address],16
+      fma.s1     log_y_rs = log_y_rs_iter,log_y,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    log_y_rs = log_y_rs,log_y_rs_iter,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfe       log2 = [NR_table_address],16
+      // (0.5*z)*(3-(y*z)*z)
+      fma.s1     log_y_rs_iter = log_y_rs_iter1,log_y_rs,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      // (0.5*z)*(3-(y*z)*z)
+      fma.s1     log_arg_early = log_y_rs_iter1,log_y_rs,f0
+      nop.i      0
+}
+;;
+
+////////////////////////////////// The third iteration ////////////////////////
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs = log_y_rs_iter,log_y,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_arg_early = log_arg_early,log_y,asinh_f8
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    log_y_rs = log_y_rs,log_y_rs_iter,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter1,log_y,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      frcpa.s1   log_C,p0 = f1,log_arg_early
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.exp   log_GR_signexp_f8 = log_arg_early
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.sig   log_GR_significand_f8 = log_arg_early
+      // (0.5*z)*(3-(y*z)*z)*y + |x|
+      fma.s1     log_arg = log_y_rs_iter1,log_y_rs,asinh_f8
+      //to get third table address
+      adds       log_table_address3 = 0x70, NR_table_address
+}
+;;
+
+///////////////////////////////// The end NR iterations /////////////////////
+{ .mfi
+      nop.m      0
+      nop.f      0
+      //significant bit destruction
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+}
+;;
+
+{ .mfi
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+(p7)  fnma.s1    log2 = log2,f1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      fms.s1     log_r = log_C,log_arg,f1  // C = frcpa(x); r = C * x - 1
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*16 + index
+      shladd     log_table_address3 = log_GR_index,4,log_table_address3
+;;
+      ldfe       log_T = [log_table_address3]
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0          //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p4 = log_P5, log_r, log_P4   //P5*r + P4
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2  //P3*r + P2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rcube = log_rsq, log_r, f0      //r^3
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_rsq, log_P1, log_r //P1*r^2 + r
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //(P5*r + P4)*r^2 + P3*r + P2
+      fma.s1     log_rp_p2 = log_rp_p4, log_rsq, log_rp_p32
+      nop.i      0
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+(p11) fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T  //N*log2 + T if x>0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+(p7)  fms.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T  //N*log2 - T if x<0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //((P5*r + P4)*r^2 + P3*r + P2)*w^3 + P1*r^2 + r
+      fma.s1     log_r2P_r = log_rp_p2, log_rcube, log_rp_p10
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //  N*log2 + T + ((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r
+(p11) fadd.d.s0  f8 = log_T_plus_Nlog2,log_r2P_r
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+      // -N*log2 - T - ((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r
+(p7)  fsub.d.s0  f8 = log_T_plus_Nlog2,log_r2P_r
+      br.ret.sptk b0           // Exit main path, path 3: 2^-3 <= |x| < 2^63
+}
+;;
+
+// Here if path 4, |x| >= 2^63
+LOG_COMMON1:
+{ .mfi
+      ldfpd      log_P5,log_P4 = [NR_table_address],16
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfpd      log_P3,log_P2 = [NR_table_address],16
+      frcpa.s1   log_C,p0 = f1,log_arg
+      nop.i      0
+}
+;;
+
+{ .mmi
+      getf.exp   log_GR_signexp_f8 = log_arg
+      ldfd       log_P1 = [NR_table_address],16
+      nop.i      0
+}
+;;
+
+{ .mmi
+      getf.sig   log_GR_significand_f8 = log_arg
+      ldfe       log2 = [NR_table_address],16
+      nop.i      0
+}
+;;
+
+{ .mfi
+      adds       log_table_address3 = 0x70, NR_table_address
+      nop.f      0
+      //significant bit destruction
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+}
+;;
+
+{ .mmf
+      nop.m      0
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+      fms.s1     log_r = log_C,log_arg,f1  //C = frcpa(x); r = C * x - 1
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      nop.f      0
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*16 + index
+      shladd     log_table_address3 = log_GR_index,4,log_table_address3
+;;
+      ldfe       log_T = [log_table_address3]
+      nop.i      0
+
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0          //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p4 = log_P5, log_r, log_P4   //P5*r + P4
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2  //P3*r + P2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+(p7)  fnma.s1    log2 = log2,f1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rcube = log_rsq, log_r, f0      //r^3
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_rsq, log_P1, log_r //P1*r^2 + r
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //(P5*r + P4)*r^2 + P3*r + P2
+      fma.s1     log_rp_p2 = log_rp_p4, log_rsq, log_rp_p32
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+(p7)  fnma.s1    log_T = log_T,f1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T    //N*log2 + T
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      //((P5*r + P4)*r^2 + P3*r + P2)*w^3 + P1*r^2 + r
+      fma.s1     log_r2P_r = log_rp_p2, log_rcube, log_rp_p10
+      nop.i      0
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+      //  N*log2 + T + ((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r
+(p11) fadd.d.s0  f8 = log_T_plus_Nlog2,log_r2P_r
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+      // -N*log2 - T - ((P5*r + P4)*r^2 + P3*r + P2)*r^3 + P1*r^2 + r
+(p7)  fsub.d.s0  f8 = log_T_plus_Nlog2,log_r2P_r
+      br.ret.sptk b0              // Exit path 4, |x| >= 2^63
+}
+;;
+
+// Here is path 2, 0 < |x| < 2^-3
+ASINH_NEAR_ZERO:
+{ .mfi
+      ldfe       log_C9 = [log_table_address2],16
+      fma.s1     asinh_w_cube = asinh_w_sq,fNormX,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfe       log_C7 = [log_table_address2],16
+      fma.s1     asinh_w_four = asinh_w_sq,asinh_w_sq,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfe       log_C5 = [log_table_address2],16
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfe       log_C3 = [log_table_address2],16
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_13 = log_C13,asinh_w_sq,log_C11
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_9 = log_C9,asinh_w_sq,log_C7
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_3 = log_C5,asinh_w_sq,log_C3
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_seven = asinh_w_four,asinh_w_cube,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_7 = asinh_w_13,asinh_w_four,asinh_w_9
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_5 = asinh_w_3,asinh_w_cube,fNormX
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fma.d.s0   f8 = asinh_w_7,asinh_w_seven,asinh_w_5
+      br.ret.sptk b0                   // Exit path 2 (0.0 <|x| < 2^(-3))
+}
+;;
+
+ASINH_UNORM:
+// Here if x=unorm
+{ .mfi
+      getf.exp   asinh_GR_f8 = fNormX  // Recompute if x unorm
+      fclass.m   p0,p13 = fNormX, 0x0b // Test x denorm
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fcmp.eq.s0 p14,p0 = f8, f0       // Dummy to set denormal flag
+(p13) br.cond.sptk ASINH_COMMON        // Continue if x unorm and not denorm
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+(p7)  fma.d.s0   f8 = f8,f8,f8         // Result x+x^2 if x=-denorm
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+(p11) fnma.d.s0  f8 = f8,f8,f8         // Result x-x^2 if x=+denorm
+      br.ret.spnt b0                   // Exit if denorm
+}
+;;
+
+GLOBAL_LIBM_END(asinh)
+
diff --git a/sysdeps/ia64/fpu/s_asinhf.S b/sysdeps/ia64/fpu/s_asinhf.S
new file mode 100644
index 0000000000..df616deae0
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_asinhf.S
@@ -0,0 +1,937 @@
+.file "asinhf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// ==============================================================
+// History
+// ==============================================================
+// 04/02/01 Initial version
+// 04/19/01 Improved speed of the paths #1,2,3,4,5
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 05/21/03 Improved performance, fixed to handle unorms
+//
+// API
+// ==============================================================
+// float asinhf(float)
+//
+// Overview of operation
+// ==============================================================
+//
+// There are 7 paths:
+// 1. x = 0.0
+//    Return asinhf(x) = 0.0
+// 2. 0.0 <|x| < 2^(-5)
+//    Return asinhf(x) = Pol5(x), where Pol5(x) = ((x^2)*C1 + C0)*x^3 + x
+
+// 3. 2^(-5) <= |x| < 2^51
+//    Return asinhf(x) = sign(x)*(log(|x| + sqrt(x^2 + 1.0)))
+//    To compute x + sqrt(x^2 + 1.0) modified Newton Raphson method is used
+//    (2 iterations)
+//    Algorithm description for log function see below.
+//
+// 4. 2^51 <= |x| < +INF
+//    Return asinhf(x) = sign(x)*log(2*|x|)
+//    Algorithm description for log function see below.
+//
+// 5. x = INF
+//    Return asinhf(x) = INF
+//
+// 6. x = [S,Q]NaN
+//    Return asinhf(x) = QNaN
+//
+// 7. x = denormal
+//    Return asinhf(x) = x
+//
+//==============================================================
+// Algorithm Description for log(x) function
+// Below we are using the fact that inequality x - 1.0 > 2^(-6) is always
+// true for this asinh implementation
+//
+// Consider  x = 2^N 1.f1 f2 f3 f4...f63
+// Log(x) = log(frcpa(x) x/frcpa(x))
+//        = log(1/frcpa(x)) + log(frcpa(x) x)
+//        = -log(frcpa(x)) + log(frcpa(x) x)
+//
+// frcpa(x)       = 2^-N frcpa((1.f1 f2 ... f63)
+//
+// -log(frcpa(x)) = -log(C)
+//                = -log(2^-N) - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 - log(frcpa(1.f1 f2 ... f63))
+//
+// -log(frcpa(x)) = -log(C)
+//                = +Nlog2 + log(frcpa(1.f1 f2 ... f63))
+//
+// Log(x) = log(1/frcpa(x)) + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + log(1./frcpa(1.f1 f2 ... f63)) + log(frcpa(x) x)
+// Log(x) =  +Nlog2 - log(/frcpa(1.f1 f2 ... f63))   + log(frcpa(x) x)
+// Log(x) =  +Nlog2 + T                              + log(frcpa(x) x)
+//
+// Log(x) =  +Nlog2 + T                     + log(C x)
+//
+// Cx = 1 + r
+//
+// Log(x) =  +Nlog2 + T  + log(1+r)
+// Log(x) =  +Nlog2 + T  + Series( r - r^2/2 + r^3/3 - r^4/4 ....)
+//
+// 1.f1 f2 ... f8 has 256 entries.
+// They are 1 + k/2^8, k = 0 ... 255
+// These 256 values are the table entries.
+//
+// Implementation
+//==============================================================
+// C = frcpa(x)
+// r = C * x - 1
+//
+// Form rseries = r + P1*r^2 + P2*r^3 + P3*r^4
+//
+// x = f * 2*n where f is 1.f_1f_2f_3....f_63
+// Nfloat = float(n)  where n is the true unbiased exponent
+// pre-index = f_1f_2....f_8
+// index = pre_index * 8
+// get the dxt table entry at index + offset = T
+//
+// result = (T + Nfloat * log(2)) + rseries
+//
+// The T table is calculated as follows
+// Form x_k = 1 + k/2^8 where k goes from 0... 255
+//      y_k = frcpa(x_k)
+//      log(1/y_k)  in quad and round to double-extended
+//
+//
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f9 -> f15,  f32 -> f55
+
+// General registers used:
+// r14 -> r27
+
+// Predicate registers used:
+// p6 -> p14
+
+// p6 to filter out case when x = [Q,S]NaN or INF or zero
+// p7 to filter out case when x < 0.0
+// p8 to select path #2
+
+// p11 to filter out case when x >= 0
+// p12 to filter out case when x = + denormal
+// p13 to select path #4
+// p14 to filtef out case when x = - denormal
+// Assembly macros
+//==============================================================
+log_GR_exp_17_ones    = r14
+log_GR_signexp_f8     = r15
+log_table_address2    = r16
+log_GR_exp_16_ones    = r17
+log_GR_exp_f8         = r18
+log_GR_true_exp_f8    = r19
+log_GR_significand_f8 = r20
+log_GR_index          = r21
+log_GR_comp2          = r22
+asinh_GR_f8           = r23
+asinh_GR_comp         = r24
+asinh_GR_f8           = r25
+log_table_address3    = r26
+NR_table_address      = r27
+
+//==============================================================
+log_y            = f9
+NR1              = f10
+NR2              = f11
+log_y_rs         = f12
+log_y_rs_iter    = f13
+log_y_rs_iter1   = f14
+fNormX           = f15
+asinh_w_sq       = f32
+log_arg_early    = f33
+log_y_rs_iter2   = f34
+log_P3           = f35
+log_P2           = f36
+log_P1           = f37
+log2             = f38
+log_C0           = f39
+log_C1           = f40
+asinh_f8         = f41
+log_C            = f42
+log_arg          = f43
+asinh_w_cube     = f44
+log_int_Nfloat   = f45
+log_r            = f46
+log_rsq          = f47
+asinh_w_1        = f48
+log_rp_p32       = f49
+log_rcube        = f50
+log_rp_p10       = f51
+log_rp_p2        = f52
+log_Nfloat       = f53
+log_T            = f54
+log_T_plus_Nlog2 = f55
+
+// Data tables
+//==============================================================
+
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(log_table_1)
+
+data8 0xbfd0001008f39d59 // p3
+data8 0x3fd5556073e0c45a // p2
+data8 0xbfdffffffffaea15 // p1
+data8 0x3fe62e42fefa39ef // log(2)
+LOCAL_OBJECT_END(log_table_1)
+
+LOCAL_OBJECT_START(log_table_2)
+data8 0x3FE0000000000000 // 0.5
+data8 0x4008000000000000 // 3.0
+data8 0x9979C79685A5EB16, 0x00003FFB // C1 3FFB9979C79685A5EB16
+data8 0xAAAAA96F80786D62, 0x0000BFFC // C0 BFFCAAAAA96F80786D62
+LOCAL_OBJECT_END(log_table_2)
+
+LOCAL_OBJECT_START(log_table_3)
+data8 0x3F60040155D5889E    //log(1/frcpa(1+   0/256)
+data8 0x3F78121214586B54    //log(1/frcpa(1+   1/256)
+data8 0x3F841929F96832F0    //log(1/frcpa(1+   2/256)
+data8 0x3F8C317384C75F06    //log(1/frcpa(1+   3/256)
+data8 0x3F91A6B91AC73386    //log(1/frcpa(1+   4/256)
+data8 0x3F95BA9A5D9AC039    //log(1/frcpa(1+   5/256)
+data8 0x3F99D2A8074325F4    //log(1/frcpa(1+   6/256)
+data8 0x3F9D6B2725979802    //log(1/frcpa(1+   7/256)
+data8 0x3FA0C58FA19DFAAA    //log(1/frcpa(1+   8/256)
+data8 0x3FA2954C78CBCE1B    //log(1/frcpa(1+   9/256)
+data8 0x3FA4A94D2DA96C56    //log(1/frcpa(1+  10/256)
+data8 0x3FA67C94F2D4BB58    //log(1/frcpa(1+  11/256)
+data8 0x3FA85188B630F068    //log(1/frcpa(1+  12/256)
+data8 0x3FAA6B8ABE73AF4C    //log(1/frcpa(1+  13/256)
+data8 0x3FAC441E06F72A9E    //log(1/frcpa(1+  14/256)
+data8 0x3FAE1E6713606D07    //log(1/frcpa(1+  15/256)
+data8 0x3FAFFA6911AB9301    //log(1/frcpa(1+  16/256)
+data8 0x3FB0EC139C5DA601    //log(1/frcpa(1+  17/256)
+data8 0x3FB1DBD2643D190B    //log(1/frcpa(1+  18/256)
+data8 0x3FB2CC7284FE5F1C    //log(1/frcpa(1+  19/256)
+data8 0x3FB3BDF5A7D1EE64    //log(1/frcpa(1+  20/256)
+data8 0x3FB4B05D7AA012E0    //log(1/frcpa(1+  21/256)
+data8 0x3FB580DB7CEB5702    //log(1/frcpa(1+  22/256)
+data8 0x3FB674F089365A7A    //log(1/frcpa(1+  23/256)
+data8 0x3FB769EF2C6B568D    //log(1/frcpa(1+  24/256)
+data8 0x3FB85FD927506A48    //log(1/frcpa(1+  25/256)
+data8 0x3FB9335E5D594989    //log(1/frcpa(1+  26/256)
+data8 0x3FBA2B0220C8E5F5    //log(1/frcpa(1+  27/256)
+data8 0x3FBB0004AC1A86AC    //log(1/frcpa(1+  28/256)
+data8 0x3FBBF968769FCA11    //log(1/frcpa(1+  29/256)
+data8 0x3FBCCFEDBFEE13A8    //log(1/frcpa(1+  30/256)
+data8 0x3FBDA727638446A2    //log(1/frcpa(1+  31/256)
+data8 0x3FBEA3257FE10F7A    //log(1/frcpa(1+  32/256)
+data8 0x3FBF7BE9FEDBFDE6    //log(1/frcpa(1+  33/256)
+data8 0x3FC02AB352FF25F4    //log(1/frcpa(1+  34/256)
+data8 0x3FC097CE579D204D    //log(1/frcpa(1+  35/256)
+data8 0x3FC1178E8227E47C    //log(1/frcpa(1+  36/256)
+data8 0x3FC185747DBECF34    //log(1/frcpa(1+  37/256)
+data8 0x3FC1F3B925F25D41    //log(1/frcpa(1+  38/256)
+data8 0x3FC2625D1E6DDF57    //log(1/frcpa(1+  39/256)
+data8 0x3FC2D1610C86813A    //log(1/frcpa(1+  40/256)
+data8 0x3FC340C59741142E    //log(1/frcpa(1+  41/256)
+data8 0x3FC3B08B6757F2A9    //log(1/frcpa(1+  42/256)
+data8 0x3FC40DFB08378003    //log(1/frcpa(1+  43/256)
+data8 0x3FC47E74E8CA5F7C    //log(1/frcpa(1+  44/256)
+data8 0x3FC4EF51F6466DE4    //log(1/frcpa(1+  45/256)
+data8 0x3FC56092E02BA516    //log(1/frcpa(1+  46/256)
+data8 0x3FC5D23857CD74D5    //log(1/frcpa(1+  47/256)
+data8 0x3FC6313A37335D76    //log(1/frcpa(1+  48/256)
+data8 0x3FC6A399DABBD383    //log(1/frcpa(1+  49/256)
+data8 0x3FC70337DD3CE41B    //log(1/frcpa(1+  50/256)
+data8 0x3FC77654128F6127    //log(1/frcpa(1+  51/256)
+data8 0x3FC7E9D82A0B022D    //log(1/frcpa(1+  52/256)
+data8 0x3FC84A6B759F512F    //log(1/frcpa(1+  53/256)
+data8 0x3FC8AB47D5F5A310    //log(1/frcpa(1+  54/256)
+data8 0x3FC91FE49096581B    //log(1/frcpa(1+  55/256)
+data8 0x3FC981634011AA75    //log(1/frcpa(1+  56/256)
+data8 0x3FC9F6C407089664    //log(1/frcpa(1+  57/256)
+data8 0x3FCA58E729348F43    //log(1/frcpa(1+  58/256)
+data8 0x3FCABB55C31693AD    //log(1/frcpa(1+  59/256)
+data8 0x3FCB1E104919EFD0    //log(1/frcpa(1+  60/256)
+data8 0x3FCB94EE93E367CB    //log(1/frcpa(1+  61/256)
+data8 0x3FCBF851C067555F    //log(1/frcpa(1+  62/256)
+data8 0x3FCC5C0254BF23A6    //log(1/frcpa(1+  63/256)
+data8 0x3FCCC000C9DB3C52    //log(1/frcpa(1+  64/256)
+data8 0x3FCD244D99C85674    //log(1/frcpa(1+  65/256)
+data8 0x3FCD88E93FB2F450    //log(1/frcpa(1+  66/256)
+data8 0x3FCDEDD437EAEF01    //log(1/frcpa(1+  67/256)
+data8 0x3FCE530EFFE71012    //log(1/frcpa(1+  68/256)
+data8 0x3FCEB89A1648B971    //log(1/frcpa(1+  69/256)
+data8 0x3FCF1E75FADF9BDE    //log(1/frcpa(1+  70/256)
+data8 0x3FCF84A32EAD7C35    //log(1/frcpa(1+  71/256)
+data8 0x3FCFEB2233EA07CD    //log(1/frcpa(1+  72/256)
+data8 0x3FD028F9C7035C1C    //log(1/frcpa(1+  73/256)
+data8 0x3FD05C8BE0D9635A    //log(1/frcpa(1+  74/256)
+data8 0x3FD085EB8F8AE797    //log(1/frcpa(1+  75/256)
+data8 0x3FD0B9C8E32D1911    //log(1/frcpa(1+  76/256)
+data8 0x3FD0EDD060B78081    //log(1/frcpa(1+  77/256)
+data8 0x3FD122024CF0063F    //log(1/frcpa(1+  78/256)
+data8 0x3FD14BE2927AECD4    //log(1/frcpa(1+  79/256)
+data8 0x3FD180618EF18ADF    //log(1/frcpa(1+  80/256)
+data8 0x3FD1B50BBE2FC63B    //log(1/frcpa(1+  81/256)
+data8 0x3FD1DF4CC7CF242D    //log(1/frcpa(1+  82/256)
+data8 0x3FD214456D0EB8D4    //log(1/frcpa(1+  83/256)
+data8 0x3FD23EC5991EBA49    //log(1/frcpa(1+  84/256)
+data8 0x3FD2740D9F870AFB    //log(1/frcpa(1+  85/256)
+data8 0x3FD29ECDABCDFA04    //log(1/frcpa(1+  86/256)
+data8 0x3FD2D46602ADCCEE    //log(1/frcpa(1+  87/256)
+data8 0x3FD2FF66B04EA9D4    //log(1/frcpa(1+  88/256)
+data8 0x3FD335504B355A37    //log(1/frcpa(1+  89/256)
+data8 0x3FD360925EC44F5D    //log(1/frcpa(1+  90/256)
+data8 0x3FD38BF1C3337E75    //log(1/frcpa(1+  91/256)
+data8 0x3FD3C25277333184    //log(1/frcpa(1+  92/256)
+data8 0x3FD3EDF463C1683E    //log(1/frcpa(1+  93/256)
+data8 0x3FD419B423D5E8C7    //log(1/frcpa(1+  94/256)
+data8 0x3FD44591E0539F49    //log(1/frcpa(1+  95/256)
+data8 0x3FD47C9175B6F0AD    //log(1/frcpa(1+  96/256)
+data8 0x3FD4A8B341552B09    //log(1/frcpa(1+  97/256)
+data8 0x3FD4D4F3908901A0    //log(1/frcpa(1+  98/256)
+data8 0x3FD501528DA1F968    //log(1/frcpa(1+  99/256)
+data8 0x3FD52DD06347D4F6    //log(1/frcpa(1+ 100/256)
+data8 0x3FD55A6D3C7B8A8A    //log(1/frcpa(1+ 101/256)
+data8 0x3FD5925D2B112A59    //log(1/frcpa(1+ 102/256)
+data8 0x3FD5BF406B543DB2    //log(1/frcpa(1+ 103/256)
+data8 0x3FD5EC433D5C35AE    //log(1/frcpa(1+ 104/256)
+data8 0x3FD61965CDB02C1F    //log(1/frcpa(1+ 105/256)
+data8 0x3FD646A84935B2A2    //log(1/frcpa(1+ 106/256)
+data8 0x3FD6740ADD31DE94    //log(1/frcpa(1+ 107/256)
+data8 0x3FD6A18DB74A58C5    //log(1/frcpa(1+ 108/256)
+data8 0x3FD6CF31058670EC    //log(1/frcpa(1+ 109/256)
+data8 0x3FD6F180E852F0BA    //log(1/frcpa(1+ 110/256)
+data8 0x3FD71F5D71B894F0    //log(1/frcpa(1+ 111/256)
+data8 0x3FD74D5AEFD66D5C    //log(1/frcpa(1+ 112/256)
+data8 0x3FD77B79922BD37E    //log(1/frcpa(1+ 113/256)
+data8 0x3FD7A9B9889F19E2    //log(1/frcpa(1+ 114/256)
+data8 0x3FD7D81B037EB6A6    //log(1/frcpa(1+ 115/256)
+data8 0x3FD8069E33827231    //log(1/frcpa(1+ 116/256)
+data8 0x3FD82996D3EF8BCB    //log(1/frcpa(1+ 117/256)
+data8 0x3FD85855776DCBFB    //log(1/frcpa(1+ 118/256)
+data8 0x3FD8873658327CCF    //log(1/frcpa(1+ 119/256)
+data8 0x3FD8AA75973AB8CF    //log(1/frcpa(1+ 120/256)
+data8 0x3FD8D992DC8824E5    //log(1/frcpa(1+ 121/256)
+data8 0x3FD908D2EA7D9512    //log(1/frcpa(1+ 122/256)
+data8 0x3FD92C59E79C0E56    //log(1/frcpa(1+ 123/256)
+data8 0x3FD95BD750EE3ED3    //log(1/frcpa(1+ 124/256)
+data8 0x3FD98B7811A3EE5B    //log(1/frcpa(1+ 125/256)
+data8 0x3FD9AF47F33D406C    //log(1/frcpa(1+ 126/256)
+data8 0x3FD9DF270C1914A8    //log(1/frcpa(1+ 127/256)
+data8 0x3FDA0325ED14FDA4    //log(1/frcpa(1+ 128/256)
+data8 0x3FDA33440224FA79    //log(1/frcpa(1+ 129/256)
+data8 0x3FDA57725E80C383    //log(1/frcpa(1+ 130/256)
+data8 0x3FDA87D0165DD199    //log(1/frcpa(1+ 131/256)
+data8 0x3FDAAC2E6C03F896    //log(1/frcpa(1+ 132/256)
+data8 0x3FDADCCC6FDF6A81    //log(1/frcpa(1+ 133/256)
+data8 0x3FDB015B3EB1E790    //log(1/frcpa(1+ 134/256)
+data8 0x3FDB323A3A635948    //log(1/frcpa(1+ 135/256)
+data8 0x3FDB56FA04462909    //log(1/frcpa(1+ 136/256)
+data8 0x3FDB881AA659BC93    //log(1/frcpa(1+ 137/256)
+data8 0x3FDBAD0BEF3DB165    //log(1/frcpa(1+ 138/256)
+data8 0x3FDBD21297781C2F    //log(1/frcpa(1+ 139/256)
+data8 0x3FDC039236F08819    //log(1/frcpa(1+ 140/256)
+data8 0x3FDC28CB1E4D32FD    //log(1/frcpa(1+ 141/256)
+data8 0x3FDC4E19B84723C2    //log(1/frcpa(1+ 142/256)
+data8 0x3FDC7FF9C74554C9    //log(1/frcpa(1+ 143/256)
+data8 0x3FDCA57B64E9DB05    //log(1/frcpa(1+ 144/256)
+data8 0x3FDCCB130A5CEBB0    //log(1/frcpa(1+ 145/256)
+data8 0x3FDCF0C0D18F326F    //log(1/frcpa(1+ 146/256)
+data8 0x3FDD232075B5A201    //log(1/frcpa(1+ 147/256)
+data8 0x3FDD490246DEFA6B    //log(1/frcpa(1+ 148/256)
+data8 0x3FDD6EFA918D25CD    //log(1/frcpa(1+ 149/256)
+data8 0x3FDD9509707AE52F    //log(1/frcpa(1+ 150/256)
+data8 0x3FDDBB2EFE92C554    //log(1/frcpa(1+ 151/256)
+data8 0x3FDDEE2F3445E4AF    //log(1/frcpa(1+ 152/256)
+data8 0x3FDE148A1A2726CE    //log(1/frcpa(1+ 153/256)
+data8 0x3FDE3AFC0A49FF40    //log(1/frcpa(1+ 154/256)
+data8 0x3FDE6185206D516E    //log(1/frcpa(1+ 155/256)
+data8 0x3FDE882578823D52    //log(1/frcpa(1+ 156/256)
+data8 0x3FDEAEDD2EAC990C    //log(1/frcpa(1+ 157/256)
+data8 0x3FDED5AC5F436BE3    //log(1/frcpa(1+ 158/256)
+data8 0x3FDEFC9326D16AB9    //log(1/frcpa(1+ 159/256)
+data8 0x3FDF2391A2157600    //log(1/frcpa(1+ 160/256)
+data8 0x3FDF4AA7EE03192D    //log(1/frcpa(1+ 161/256)
+data8 0x3FDF71D627C30BB0    //log(1/frcpa(1+ 162/256)
+data8 0x3FDF991C6CB3B379    //log(1/frcpa(1+ 163/256)
+data8 0x3FDFC07ADA69A910    //log(1/frcpa(1+ 164/256)
+data8 0x3FDFE7F18EB03D3E    //log(1/frcpa(1+ 165/256)
+data8 0x3FE007C053C5002E    //log(1/frcpa(1+ 166/256)
+data8 0x3FE01B942198A5A1    //log(1/frcpa(1+ 167/256)
+data8 0x3FE02F74400C64EB    //log(1/frcpa(1+ 168/256)
+data8 0x3FE04360BE7603AD    //log(1/frcpa(1+ 169/256)
+data8 0x3FE05759AC47FE34    //log(1/frcpa(1+ 170/256)
+data8 0x3FE06B5F1911CF52    //log(1/frcpa(1+ 171/256)
+data8 0x3FE078BF0533C568    //log(1/frcpa(1+ 172/256)
+data8 0x3FE08CD9687E7B0E    //log(1/frcpa(1+ 173/256)
+data8 0x3FE0A10074CF9019    //log(1/frcpa(1+ 174/256)
+data8 0x3FE0B5343A234477    //log(1/frcpa(1+ 175/256)
+data8 0x3FE0C974C89431CE    //log(1/frcpa(1+ 176/256)
+data8 0x3FE0DDC2305B9886    //log(1/frcpa(1+ 177/256)
+data8 0x3FE0EB524BAFC918    //log(1/frcpa(1+ 178/256)
+data8 0x3FE0FFB54213A476    //log(1/frcpa(1+ 179/256)
+data8 0x3FE114253DA97D9F    //log(1/frcpa(1+ 180/256)
+data8 0x3FE128A24F1D9AFF    //log(1/frcpa(1+ 181/256)
+data8 0x3FE1365252BF0865    //log(1/frcpa(1+ 182/256)
+data8 0x3FE14AE558B4A92D    //log(1/frcpa(1+ 183/256)
+data8 0x3FE15F85A19C765B    //log(1/frcpa(1+ 184/256)
+data8 0x3FE16D4D38C119FA    //log(1/frcpa(1+ 185/256)
+data8 0x3FE18203C20DD133    //log(1/frcpa(1+ 186/256)
+data8 0x3FE196C7BC4B1F3B    //log(1/frcpa(1+ 187/256)
+data8 0x3FE1A4A738B7A33C    //log(1/frcpa(1+ 188/256)
+data8 0x3FE1B981C0C9653D    //log(1/frcpa(1+ 189/256)
+data8 0x3FE1CE69E8BB106B    //log(1/frcpa(1+ 190/256)
+data8 0x3FE1DC619DE06944    //log(1/frcpa(1+ 191/256)
+data8 0x3FE1F160A2AD0DA4    //log(1/frcpa(1+ 192/256)
+data8 0x3FE2066D7740737E    //log(1/frcpa(1+ 193/256)
+data8 0x3FE2147DBA47A394    //log(1/frcpa(1+ 194/256)
+data8 0x3FE229A1BC5EBAC3    //log(1/frcpa(1+ 195/256)
+data8 0x3FE237C1841A502E    //log(1/frcpa(1+ 196/256)
+data8 0x3FE24CFCE6F80D9A    //log(1/frcpa(1+ 197/256)
+data8 0x3FE25B2C55CD5762    //log(1/frcpa(1+ 198/256)
+data8 0x3FE2707F4D5F7C41    //log(1/frcpa(1+ 199/256)
+data8 0x3FE285E0842CA384    //log(1/frcpa(1+ 200/256)
+data8 0x3FE294294708B773    //log(1/frcpa(1+ 201/256)
+data8 0x3FE2A9A2670AFF0C    //log(1/frcpa(1+ 202/256)
+data8 0x3FE2B7FB2C8D1CC1    //log(1/frcpa(1+ 203/256)
+data8 0x3FE2C65A6395F5F5    //log(1/frcpa(1+ 204/256)
+data8 0x3FE2DBF557B0DF43    //log(1/frcpa(1+ 205/256)
+data8 0x3FE2EA64C3F97655    //log(1/frcpa(1+ 206/256)
+data8 0x3FE3001823684D73    //log(1/frcpa(1+ 207/256)
+data8 0x3FE30E97E9A8B5CD    //log(1/frcpa(1+ 208/256)
+data8 0x3FE32463EBDD34EA    //log(1/frcpa(1+ 209/256)
+data8 0x3FE332F4314AD796    //log(1/frcpa(1+ 210/256)
+data8 0x3FE348D90E7464D0    //log(1/frcpa(1+ 211/256)
+data8 0x3FE35779F8C43D6E    //log(1/frcpa(1+ 212/256)
+data8 0x3FE36621961A6A99    //log(1/frcpa(1+ 213/256)
+data8 0x3FE37C299F3C366A    //log(1/frcpa(1+ 214/256)
+data8 0x3FE38AE2171976E7    //log(1/frcpa(1+ 215/256)
+data8 0x3FE399A157A603E7    //log(1/frcpa(1+ 216/256)
+data8 0x3FE3AFCCFE77B9D1    //log(1/frcpa(1+ 217/256)
+data8 0x3FE3BE9D503533B5    //log(1/frcpa(1+ 218/256)
+data8 0x3FE3CD7480B4A8A3    //log(1/frcpa(1+ 219/256)
+data8 0x3FE3E3C43918F76C    //log(1/frcpa(1+ 220/256)
+data8 0x3FE3F2ACB27ED6C7    //log(1/frcpa(1+ 221/256)
+data8 0x3FE4019C2125CA93    //log(1/frcpa(1+ 222/256)
+data8 0x3FE4181061389722    //log(1/frcpa(1+ 223/256)
+data8 0x3FE42711518DF545    //log(1/frcpa(1+ 224/256)
+data8 0x3FE436194E12B6BF    //log(1/frcpa(1+ 225/256)
+data8 0x3FE445285D68EA69    //log(1/frcpa(1+ 226/256)
+data8 0x3FE45BCC464C893A    //log(1/frcpa(1+ 227/256)
+data8 0x3FE46AED21F117FC    //log(1/frcpa(1+ 228/256)
+data8 0x3FE47A1527E8A2D3    //log(1/frcpa(1+ 229/256)
+data8 0x3FE489445EFFFCCC    //log(1/frcpa(1+ 230/256)
+data8 0x3FE4A018BCB69835    //log(1/frcpa(1+ 231/256)
+data8 0x3FE4AF5A0C9D65D7    //log(1/frcpa(1+ 232/256)
+data8 0x3FE4BEA2A5BDBE87    //log(1/frcpa(1+ 233/256)
+data8 0x3FE4CDF28F10AC46    //log(1/frcpa(1+ 234/256)
+data8 0x3FE4DD49CF994058    //log(1/frcpa(1+ 235/256)
+data8 0x3FE4ECA86E64A684    //log(1/frcpa(1+ 236/256)
+data8 0x3FE503C43CD8EB68    //log(1/frcpa(1+ 237/256)
+data8 0x3FE513356667FC57    //log(1/frcpa(1+ 238/256)
+data8 0x3FE522AE0738A3D8    //log(1/frcpa(1+ 239/256)
+data8 0x3FE5322E26867857    //log(1/frcpa(1+ 240/256)
+data8 0x3FE541B5CB979809    //log(1/frcpa(1+ 241/256)
+data8 0x3FE55144FDBCBD62    //log(1/frcpa(1+ 242/256)
+data8 0x3FE560DBC45153C7    //log(1/frcpa(1+ 243/256)
+data8 0x3FE5707A26BB8C66    //log(1/frcpa(1+ 244/256)
+data8 0x3FE587F60ED5B900    //log(1/frcpa(1+ 245/256)
+data8 0x3FE597A7977C8F31    //log(1/frcpa(1+ 246/256)
+data8 0x3FE5A760D634BB8B    //log(1/frcpa(1+ 247/256)
+data8 0x3FE5B721D295F10F    //log(1/frcpa(1+ 248/256)
+data8 0x3FE5C6EA94431EF9    //log(1/frcpa(1+ 249/256)
+data8 0x3FE5D6BB22EA86F6    //log(1/frcpa(1+ 250/256)
+data8 0x3FE5E6938645D390    //log(1/frcpa(1+ 251/256)
+data8 0x3FE5F673C61A2ED2    //log(1/frcpa(1+ 252/256)
+data8 0x3FE6065BEA385926    //log(1/frcpa(1+ 253/256)
+data8 0x3FE6164BFA7CC06B    //log(1/frcpa(1+ 254/256)
+data8 0x3FE62643FECF9743    //log(1/frcpa(1+ 255/256)
+LOCAL_OBJECT_END(log_table_3)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(asinhf)
+
+{ .mfi
+      getf.exp   asinh_GR_f8 = f8        // Must recompute later if x unorm
+      fclass.m   p12,p0 = f8, 0x0b       // Test x unorm
+      mov        log_GR_exp_17_ones = 0x1ffff
+}
+{ .mfi
+      addl       NR_table_address = @ltoff(log_table_1), gp
+      fma.s1     log_y = f8, f8, f1      // y = x^2 + 1
+      mov        asinh_GR_comp = 0xfffa
+}
+;;
+
+{ .mfi
+      mov        log_GR_exp_16_ones = 0xffff //BIAS
+      fclass.m   p6,p0 = f8, 0xe7        // Test for x = NaN and inf and zero
+      mov        log_GR_comp2 = 0x10032
+}
+{ .mfi
+      ld8        NR_table_address = [NR_table_address]
+      fma.s1     asinh_w_sq = f8,f8,f0   // x^2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fcmp.lt.s1 p7,p11 = f8,f0          // if x<0
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+      fnorm.s1   fNormX = f8             // Normalize x
+(p12) br.cond.spnt ASINH_UNORM           // Branch if x=unorm
+}
+;;
+
+ASINH_COMMON:
+// Return here if x=unorm and not denorm
+{ .mfi
+      //to get second table address
+      adds       log_table_address2 = 0x20, NR_table_address
+      fma.s1     log_arg = f8,f1,f8
+}
+{ .mfb
+      nop.m      0
+(p6)  fma.s.s0   f8 = f8,f1,f8           // quietize nan result if x=nan
+(p6)  br.ret.spnt b0                     // Exit for x=nan and inf and zero
+}
+;;
+
+{ .mfi
+      ldfpd      NR1,NR2 = [log_table_address2],16
+      frsqrta.s1 log_y_rs,p0 = log_y     // z=1/sqrt(y)
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfe       log_C1 = [log_table_address2],16
+      nop.f      0
+      and        asinh_GR_f8 = asinh_GR_f8,log_GR_exp_17_ones
+}
+;;
+
+{ .mib
+      ldfe       log_C0 = [log_table_address2],16
+      cmp.le     p13,p0 = log_GR_comp2,asinh_GR_f8
+(p13) br.cond.spnt LOG_COMMON1           // Branch if path 4: |x| >= 2^51
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter = log_y_rs,log_y,f0  // y*z
+      nop.i      0
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+(p11) mov        asinh_f8 = fNormX
+      nop.i      0
+}
+{ .mfb
+      cmp.gt     p8,p0 = asinh_GR_comp,asinh_GR_f8
+(p7)  fnma.s1    asinh_f8 = fNormX,f1,f0
+(p8)  br.cond.spnt ASINH_NEAR_ZERO       // Branch if path 2: 0 < |x| < 2^-5
+}
+;;
+
+// Here if main path, 2^-5 <= |x| < 2^51
+///////////////////////////////// The first iteration /////////////////////////
+{ .mfi
+      ldfpd      log_P3,log_P2 = [NR_table_address],16
+      fnma.s1    log_y_rs_iter2 = log_y_rs_iter,log_y_rs,NR2    // 3-(y*z)*z
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs,NR1,f0               // 0.5*z
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfpd      log_P1,log2 = [NR_table_address],16
+      // (0.5*z)*(3-(y*z)*z)
+      fma.s1     log_y_rs_iter = log_y_rs_iter1,log_y_rs_iter2,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      // (0.5*z)*(3-(y*z)*z)
+      fma.s1     log_arg_early = log_y_rs_iter1,log_y_rs_iter2,f0
+      nop.i      0
+}
+;;
+
+////////////////////////////////// The second iteration ////////////////////////
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs = log_y_rs_iter,log_y,f0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter,NR1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_arg_early = log_arg_early,log_y,asinh_f8
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fnma.s1    log_y_rs = log_y_rs,log_y_rs_iter,NR2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_y_rs_iter1 = log_y_rs_iter1,log_y,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      frcpa.s1   log_C,p0 = f1,log_arg_early
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.exp   log_GR_signexp_f8 = log_arg_early
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.sig   log_GR_significand_f8 = log_arg_early
+      // (0.5*z)*(3-(y*z)*z)*y + |x|
+      fma.s1     log_arg = log_y_rs_iter1,log_y_rs,asinh_f8
+      //to get third table address
+      adds       log_table_address3 = 0x30, NR_table_address
+}
+;;
+
+/////////////////////////////////////////// The end NR iterations /////////////
+
+{ .mfi
+      nop.m      0
+      nop.f      0
+      //significant bit destruction
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+}
+;;
+
+{ .mfi
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+(p7)  fnma.s1    log2 = log2,f1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      fms.s1     log_r = log_C,log_arg,f1  //C = frcpa(x); r = C * x - 1
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*16 + index
+      shladd     log_table_address3 = log_GR_index,3,log_table_address3
+;;
+      ldfd       log_T = [log_table_address3]
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0          //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2  //P3*r + P2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_P1, log_r, f1
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p2 = log_rp_p32, log_rsq, log_rp_p10
+      nop.i      0
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+(p11) fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T  //N*log2 + T if x>0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+(p7)  fms.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T  //N*log2 - T if x<0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+(p11) fma.s.s0   f8 = log_rp_p2,log_r,log_T_plus_Nlog2
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+(p7)  fnma.s.s0  f8 = log_rp_p2,log_r,log_T_plus_Nlog2
+      br.ret.sptk b0          // Exit main path, path 3: 2^-5 <= |x| < 2^51
+}
+;;
+
+
+// Here if path 4, |x| >= 2^51
+LOG_COMMON1:
+{ .mfi
+      ldfpd      log_P3,log_P2 = [NR_table_address],16
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      ldfpd      log_P1,log2 = [NR_table_address],16
+      frcpa.s1   log_C,p0 = f1,log_arg
+      nop.i      0
+}
+;;
+
+{ .mfi
+      getf.exp   log_GR_signexp_f8 = log_arg
+      nop.f      0
+      //to get third table address
+      adds       log_table_address3 = 0x30, NR_table_address
+}
+;;
+
+{ .mfi
+      getf.sig   log_GR_significand_f8 = log_arg
+      nop.f      0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      nop.f      0
+      //to destroy the most bit in the significant area
+      and        log_GR_exp_f8 = log_GR_signexp_f8, log_GR_exp_17_ones
+}
+;;
+
+{ .mmf
+      nop.m      0
+      //BIAS subtraction
+      sub        log_GR_true_exp_f8 = log_GR_exp_f8, log_GR_exp_16_ones
+      fms.s1     log_r = log_C,log_arg,f1  //C = frcpa(x); r = C * x - 1
+}
+;;
+
+{ .mfi
+      setf.sig   log_int_Nfloat = log_GR_true_exp_f8
+      nop.f      0
+      extr.u     log_GR_index = log_GR_significand_f8,55,8 //Extract 8 bits
+}
+;;
+
+{ .mmi
+      //pre-index*16 + index
+      shladd     log_table_address3 = log_GR_index,3,log_table_address3
+;;
+      ldfd       log_T = [log_table_address3]
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rsq = log_r, log_r, f0          //r^2
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p32 = log_P3, log_r, log_P2  //P3*r + P2
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p10 = log_P1, log_r, f1
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+(p7)  fnma.s1    log2 = log2,f1,f0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+      //convert N to the floating-point format
+      fcvt.xf    log_Nfloat = log_int_Nfloat
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     log_rp_p2 = log_rp_p32, log_rsq, log_rp_p10
+      nop.i      0
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+(p11) fma.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T  //N*log2 + T if x>0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+(p7)  fms.s1     log_T_plus_Nlog2 = log_Nfloat,log2,log_T  //N*log2 - T if x<0
+      nop.i      0
+}
+;;
+
+{ .mfi
+      nop.m      0
+(p11) fma.s.s0   f8 = log_rp_p2,log_r,log_T_plus_Nlog2
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+(p7)  fnma.s.s0  f8 = log_rp_p2,log_r,log_T_plus_Nlog2
+      br.ret.sptk b0           // Exit path 4, |x| >= 2^51
+}
+;;
+
+// Here if path 2, 0 < |x| < 2^-5
+ASINH_NEAR_ZERO:
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_1 = asinh_w_sq,log_C1,log_C0
+      nop.i      0
+}
+{ .mfi
+      nop.m      0
+      fma.s1     asinh_w_cube = asinh_w_sq,fNormX,f0
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fma.s.s0   f8 = asinh_w_1,asinh_w_cube,fNormX
+      br.ret.sptk b0          // Exit path 2, 0 < |x| < 2^-5
+}
+;;
+
+ASINH_UNORM:
+// Here if x=unorm
+{ .mfi
+      getf.exp   asinh_GR_f8 = fNormX  // Recompute if x unorm
+      fclass.m   p0,p13 = fNormX, 0x0b // Test x denorm
+      nop.i      0
+}
+;;
+
+{ .mfb
+      nop.m      0
+      fcmp.eq.s0 p14,p0 = f8, f0       // Dummy to set denormal flag
+(p13) br.cond.sptk ASINH_COMMON        // Continue if x unorm and not denorm
+}
+;;
+
+.pred.rel "mutex",p7,p11
+{ .mfi
+      nop.m      0
+(p7)  fma.s.s0   f8 = f8,f8,f8         // Result x+x^2 if x=-denorm
+      nop.i      0
+}
+{ .mfb
+      nop.m      0
+(p11) fnma.s.s0  f8 = f8,f8,f8         // Result x-x^2 if x=+denorm
+      br.ret.spnt b0                   // Exit if denorm
+}
+;;
+
+GLOBAL_LIBM_END(asinhf)
diff --git a/sysdeps/ia64/fpu/s_asinhl.S b/sysdeps/ia64/fpu/s_asinhl.S
new file mode 100644
index 0000000000..d3a5507a32
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_asinhl.S
@@ -0,0 +1,1347 @@
+.file "asinhl.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History: 
+// 09/04/01 Initial version
+// 09/13/01 Performance improved, symmetry problems fixed
+// 10/10/01 Performance improved, split issues removed
+// 12/11/01 Changed huges_logp to not be global
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+//
+//*********************************************************************
+//
+// API
+//==============================================================
+// long double asinhl(long double);
+//
+// Overview of operation
+//==============================================================
+// 
+// There are 6 paths:
+// 1. x = 0, [S,Q]Nan or +/-INF
+//    Return asinhl(x) = x + x;
+// 
+// 2. x = + denormal
+//    Return asinhl(x) = x - x^2;
+//            
+// 3. x = - denormal
+//    Return asinhl(x) = x + x^2;
+//            
+// 4. 'Near 0': max denormal < |x| < 1/128
+//    Return asinhl(x) = sign(x)*(x+x^3*(c3+x^2*(c5+x^2*(c7+x^2*(c9)))));
+//
+// 5. 'Huges': |x| > 2^63
+//    Return asinhl(x) = sign(x)*(logl(2*x));
+//                    
+// 6. 'Main path': 1/128 < |x| < 2^63
+//    b_hi + b_lo = x + sqrt(x^2 + 1);
+//    asinhl(x) = sign(x)*(log_special(b_hi, b_lo));
+//  
+// Algorithm description                                                      
+//==============================================================
+//
+// Main path algorithm 
+// ( thanks to Peter Markstein for the idea of sqrt(x^2+1) computation! )
+// *************************************************************************
+//
+// There are 3 parts of x+sqrt(x^2+1) computation:
+//
+//  1) p2 = (p2_hi+p2_lo) = x^2+1 obtaining
+//     ------------------------------------
+//     p2_hi = x2_hi + 1, where x2_hi = x * x;
+//     p2_lo = x2_lo + p1_lo, where 
+//                            x2_lo = FMS(x*x-x2_hi), 
+//                            p1_lo = (1 - p2_hi) + x2_hi;
+//
+//  2) g = (g_hi+g_lo) = sqrt(p2) = sqrt(p2_hi+p2_lo)
+//     ----------------------------------------------
+//     r = invsqrt(p2_hi) (8-bit reciprocal square root approximation);
+//     g = p2_hi * r (first 8 bit-approximation of sqrt);
+//     
+//     h = 0.5 * r;
+//     e = 0.5 - g * h;
+//     g = g * e + g (second 16 bit-approximation of sqrt);
+//     
+//     h = h * e + h;
+//     e = 0.5 - g * h;
+//     g = g * e + g (third 32 bit-approximation of sqrt);
+//
+//     h = h * e + h;
+//     e = 0.5 - g * h;
+//     g_hi = g * e + g (fourth 64 bit-approximation of sqrt);
+//  
+//     Remainder computation:
+//     h = h * e + h;
+//     d = (p2_hi - g_hi * g_hi) + p2_lo;
+//     g_lo = d * h;
+//
+//  3) b = (b_hi + b_lo) = x + g, where g = (g_hi + g_lo) = sqrt(x^2+1)
+//     -------------------------------------------------------------------
+//     b_hi = (g_hi + x) + gl;
+//     b_lo = (g_hi - b_hi) + x + gl;
+//     
+//  Now we pass b presented as sum b_hi + b_lo to special version
+//  of logl function which accept a pair of arguments as
+//  'mutiprecision' value.   
+//  
+//  Special log algorithm overview
+//  ================================
+//   Here we use a table lookup method. The basic idea is that in
+//   order to compute logl(Arg) = logl (Arg-1) for an argument Arg in [1,2), 
+//   we construct a value G such that G*Arg is close to 1 and that
+//   logl(1/G) is obtainable easily from a table of values calculated
+//   beforehand. Thus
+//
+//      logl(Arg) = logl(1/G) + logl((G*Arg - 1))
+//
+//   Because |G*Arg - 1| is small, the second term on the right hand
+//   side can be approximated by a short polynomial. We elaborate
+//   this method in four steps.
+//
+//   Step 0: Initialization
+//
+//   We need to calculate logl( X ). Obtain N, S_hi such that
+//
+//      X = 2^N * ( S_hi + S_lo )   exactly
+//
+//   where S_hi in [1,2) and S_lo is a correction to S_hi in the sense
+//   that |S_lo| <= ulp(S_hi).
+//
+//   For the special version of logl: S_lo = b_lo
+//   !-----------------------------------------------!
+//
+//   Step 1: Argument Reduction
+//
+//   Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
+//
+//      G := G_1 * G_2 * G_3
+//      r := (G * S_hi - 1) + G * S_lo
+//
+//   These G_j's have the property that the product is exactly 
+//   representable and that |r| < 2^(-12) as a result.
+//
+//   Step 2: Approximation
+//
+//   logl(1 + r) is approximated by a short polynomial poly(r).
+//
+//   Step 3: Reconstruction
+//
+//   Finally, 
+//
+//   logl( X )   =   logl( 2^N * (S_hi + S_lo) )
+//                 ~=~  N*logl(2) + logl(1/G) + logl(1 + r)
+//                 ~=~  N*logl(2) + logl(1/G) + poly(r).
+//
+//   For detailed description see logl or log1pl function, regular path.
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input
+// f32 -> f101 (70 registers)
+
+// General registers used:  
+// r32 -> r57 (26 registers)
+
+// Predicate registers used:
+// p6 -> p11
+// p6  for '0, NaNs, Inf' path
+// p7  for '+ denormals' path 
+// p8  for 'near 0' path
+// p9  for 'huges' path
+// p10 for '- denormals' path 
+// p11 for negative values
+//
+// Data tables
+//==============================================================
+     
+RODATA
+.align 64
+
+// C7, C9 'near 0' polynomial coefficients
+LOCAL_OBJECT_START(Poly_C_near_0_79)
+data8 0xF8DC939BBEDD5A54, 0x00003FF9
+data8 0xB6DB6DAB21565AC5, 0x0000BFFA
+LOCAL_OBJECT_END(Poly_C_near_0_79)
+
+// C3, C5 'near 0' polynomial coefficients
+LOCAL_OBJECT_START(Poly_C_near_0_35)
+data8 0x999999999991D582, 0x00003FFB
+data8 0xAAAAAAAAAAAAAAA9, 0x0000BFFC
+LOCAL_OBJECT_END(Poly_C_near_0_35)
+
+// Q coeffs 
+LOCAL_OBJECT_START(Constants_Q)
+data4  0x00000000,0xB1721800,0x00003FFE,0x00000000 
+data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
+data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000
+data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000
+data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000
+data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000 
+LOCAL_OBJECT_END(Constants_Q)
+
+// Z1 - 16 bit fixed
+LOCAL_OBJECT_START(Constants_Z_1)
+data4  0x00008000
+data4  0x00007879
+data4  0x000071C8
+data4  0x00006BCB
+data4  0x00006667
+data4  0x00006187
+data4  0x00005D18
+data4  0x0000590C
+data4  0x00005556
+data4  0x000051EC
+data4  0x00004EC5
+data4  0x00004BDB
+data4  0x00004925
+data4  0x0000469F
+data4  0x00004445
+data4  0x00004211
+LOCAL_OBJECT_END(Constants_Z_1)
+
+// G1 and H1 - IEEE single and h1 - IEEE double
+LOCAL_OBJECT_START(Constants_G_H_h1)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F70F0F0,0x3D785196
+data8  0x3DA163A6617D741C
+data4  0x3F638E38,0x3DF13843
+data8  0x3E2C55E6CBD3D5BB
+data4  0x3F579430,0x3E2FF9A0
+data8  0xBE3EB0BFD86EA5E7
+data4  0x3F4CCCC8,0x3E647FD6
+data8  0x3E2E6A8C86B12760
+data4  0x3F430C30,0x3E8B3AE7
+data8  0x3E47574C5C0739BA
+data4  0x3F3A2E88,0x3EA30C68
+data8  0x3E20E30F13E8AF2F
+data4  0x3F321640,0x3EB9CEC8
+data8  0xBE42885BF2C630BD
+data4  0x3F2AAAA8,0x3ECF9927
+data8  0x3E497F3497E577C6
+data4  0x3F23D708,0x3EE47FC5
+data8  0x3E3E6A6EA6B0A5AB
+data4  0x3F1D89D8,0x3EF8947D
+data8  0xBDF43E3CD328D9BE
+data4  0x3F17B420,0x3F05F3A1
+data8  0x3E4094C30ADB090A
+data4  0x3F124920,0x3F0F4303
+data8  0xBE28FBB2FC1FE510
+data4  0x3F0D3DC8,0x3F183EBF
+data8  0x3E3A789510FDE3FA
+data4  0x3F088888,0x3F20EC80
+data8  0x3E508CE57CC8C98F
+data4  0x3F042108,0x3F29516A
+data8  0xBE534874A223106C
+LOCAL_OBJECT_END(Constants_G_H_h1)
+
+// Z2 - 16 bit fixed
+LOCAL_OBJECT_START(Constants_Z_2)
+data4  0x00008000
+data4  0x00007F81
+data4  0x00007F02
+data4  0x00007E85
+data4  0x00007E08
+data4  0x00007D8D
+data4  0x00007D12
+data4  0x00007C98
+data4  0x00007C20
+data4  0x00007BA8
+data4  0x00007B31
+data4  0x00007ABB
+data4  0x00007A45
+data4  0x000079D1
+data4  0x0000795D
+data4  0x000078EB
+LOCAL_OBJECT_END(Constants_Z_2)
+
+// G2 and H2 - IEEE single and h2 - IEEE double
+LOCAL_OBJECT_START(Constants_G_H_h2)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F7F00F8,0x3B7F875D
+data8  0x3DB5A11622C42273
+data4  0x3F7E03F8,0x3BFF015B
+data8  0x3DE620CF21F86ED3
+data4  0x3F7D08E0,0x3C3EE393
+data8  0xBDAFA07E484F34ED
+data4  0x3F7C0FC0,0x3C7E0586
+data8  0xBDFE07F03860BCF6
+data4  0x3F7B1880,0x3C9E75D2
+data8  0x3DEA370FA78093D6
+data4  0x3F7A2328,0x3CBDC97A
+data8  0x3DFF579172A753D0
+data4  0x3F792FB0,0x3CDCFE47
+data8  0x3DFEBE6CA7EF896B
+data4  0x3F783E08,0x3CFC15D0
+data8  0x3E0CF156409ECB43
+data4  0x3F774E38,0x3D0D874D
+data8  0xBE0B6F97FFEF71DF
+data4  0x3F766038,0x3D1CF49B
+data8  0xBE0804835D59EEE8
+data4  0x3F757400,0x3D2C531D
+data8  0x3E1F91E9A9192A74
+data4  0x3F748988,0x3D3BA322
+data8  0xBE139A06BF72A8CD
+data4  0x3F73A0D0,0x3D4AE46F
+data8  0x3E1D9202F8FBA6CF
+data4  0x3F72B9D0,0x3D5A1756
+data8  0xBE1DCCC4BA796223
+data4  0x3F71D488,0x3D693B9D
+data8  0xBE049391B6B7C239
+LOCAL_OBJECT_END(Constants_G_H_h2)
+
+// G3 and H3 - IEEE single and h3 - IEEE double 
+LOCAL_OBJECT_START(Constants_G_H_h3)
+data4  0x3F7FFC00,0x38800100
+data8  0x3D355595562224CD
+data4  0x3F7FF400,0x39400480
+data8  0x3D8200A206136FF6
+data4  0x3F7FEC00,0x39A00640
+data8  0x3DA4D68DE8DE9AF0
+data4  0x3F7FE400,0x39E00C41
+data8  0xBD8B4291B10238DC
+data4  0x3F7FDC00,0x3A100A21
+data8  0xBD89CCB83B1952CA
+data4  0x3F7FD400,0x3A300F22
+data8  0xBDB107071DC46826
+data4  0x3F7FCC08,0x3A4FF51C
+data8  0x3DB6FCB9F43307DB
+data4  0x3F7FC408,0x3A6FFC1D
+data8  0xBD9B7C4762DC7872
+data4  0x3F7FBC10,0x3A87F20B
+data8  0xBDC3725E3F89154A
+data4  0x3F7FB410,0x3A97F68B
+data8  0xBD93519D62B9D392
+data4  0x3F7FAC18,0x3AA7EB86
+data8  0x3DC184410F21BD9D
+data4  0x3F7FA420,0x3AB7E101
+data8  0xBDA64B952245E0A6
+data4  0x3F7F9C20,0x3AC7E701
+data8  0x3DB4B0ECAABB34B8
+data4  0x3F7F9428,0x3AD7DD7B
+data8  0x3D9923376DC40A7E
+data4  0x3F7F8C30,0x3AE7D474
+data8  0x3DC6E17B4F2083D3
+data4  0x3F7F8438,0x3AF7CBED
+data8  0x3DAE314B811D4394
+data4  0x3F7F7C40,0x3B03E1F3
+data8  0xBDD46F21B08F2DB1
+data4  0x3F7F7448,0x3B0BDE2F
+data8  0xBDDC30A46D34522B
+data4  0x3F7F6C50,0x3B13DAAA
+data8  0x3DCB0070B1F473DB
+data4  0x3F7F6458,0x3B1BD766
+data8  0xBDD65DDC6AD282FD
+data4  0x3F7F5C68,0x3B23CC5C
+data8  0xBDCDAB83F153761A
+data4  0x3F7F5470,0x3B2BC997
+data8  0xBDDADA40341D0F8F
+data4  0x3F7F4C78,0x3B33C711
+data8  0x3DCD1BD7EBC394E8
+data4  0x3F7F4488,0x3B3BBCC6
+data8  0xBDC3532B52E3E695
+data4  0x3F7F3C90,0x3B43BAC0
+data8  0xBDA3961EE846B3DE
+data4  0x3F7F34A0,0x3B4BB0F4
+data8  0xBDDADF06785778D4
+data4  0x3F7F2CA8,0x3B53AF6D
+data8  0x3DCC3ED1E55CE212
+data4  0x3F7F24B8,0x3B5BA620
+data8  0xBDBA31039E382C15
+data4  0x3F7F1CC8,0x3B639D12
+data8  0x3D635A0B5C5AF197
+data4  0x3F7F14D8,0x3B6B9444
+data8  0xBDDCCB1971D34EFC
+data4  0x3F7F0CE0,0x3B7393BC
+data8  0x3DC7450252CD7ADA
+data4  0x3F7F04F0,0x3B7B8B6D
+data8  0xBDB68F177D7F2A42
+LOCAL_OBJECT_END(Constants_G_H_h3)
+
+// Assembly macros
+//==============================================================
+
+// Floating Point Registers
+
+FR_Arg          = f8
+FR_Res          = f8
+FR_AX           = f32
+FR_XLog_Hi      = f33 
+FR_XLog_Lo      = f34 
+
+    // Special logl registers
+FR_Y_hi         = f35  
+FR_Y_lo         = f36
+
+FR_Scale        = f37
+FR_X_Prime      = f38 
+FR_S_hi         = f39  
+FR_W            = f40
+FR_G            = f41
+
+FR_H            = f42
+FR_wsq          = f43 
+FR_w4           = f44
+FR_h            = f45
+FR_w6           = f46  
+
+FR_G2           = f47
+FR_H2           = f48
+FR_poly_lo      = f49
+FR_P8           = f50  
+FR_poly_hi      = f51
+
+FR_P7           = f52  
+FR_h2           = f53 
+FR_rsq          = f54  
+FR_P6           = f55
+FR_r            = f56  
+
+FR_log2_hi      = f57  
+FR_log2_lo      = f58  
+ 
+FR_float_N      = f59 
+FR_Q4           = f60 
+
+FR_G3           = f61  
+FR_H3           = f62  
+FR_h3           = f63  
+
+FR_Q3           = f64  
+FR_Q2           = f65 
+FR_1LN10_hi     = f66 
+
+FR_Q1           = f67 
+FR_1LN10_lo     = f68 
+FR_P5           = f69 
+FR_rcub         = f70 
+
+FR_Neg_One      = f71 
+FR_Z            = f72 
+FR_AA           = f73 
+FR_BB           = f74 
+FR_S_lo         = f75 
+FR_2_to_minus_N = f76 
+
+
+    // Huge & Main path prolog registers
+FR_Half         = f77
+FR_Two          = f78
+FR_X2           = f79
+FR_P2           = f80
+FR_P2L          = f81
+FR_Rcp          = f82
+FR_GG           = f83
+FR_HH           = f84
+FR_EE           = f85
+FR_DD           = f86
+FR_GL           = f87
+FR_A            = f88
+FR_AL           = f89
+FR_B            = f90
+FR_BL           = f91
+FR_Tmp          = f92
+
+    // Near 0 & Huges path prolog registers
+FR_C3           = f93
+FR_C5           = f94
+FR_C7           = f95
+FR_C9           = f96
+
+FR_X3           = f97
+FR_X4           = f98
+FR_P9           = f99
+FR_P5           = f100
+FR_P3           = f101
+
+
+// General Purpose Registers
+
+    // General prolog registers
+GR_PFS          = r32
+GR_TwoN7        = r40
+GR_TwoP63       = r41
+GR_ExpMask      = r42
+GR_ArgExp       = r43
+GR_Half         = r44
+
+    // Near 0 path prolog registers
+GR_Poly_C_35    = r45
+GR_Poly_C_79    = r46
+
+    // Special logl registers
+GR_Index1       = r34 
+GR_Index2       = r35 
+GR_signif       = r36 
+GR_X_0          = r37 
+GR_X_1          = r38 
+GR_X_2          = r39 
+GR_Z_1          = r40 
+GR_Z_2          = r41 
+GR_N            = r42 
+GR_Bias         = r43 
+GR_M            = r44 
+GR_Index3       = r45 
+GR_exp_2tom80   = r45 
+GR_exp_mask     = r47 
+GR_exp_2tom7    = r48 
+GR_ad_ln10      = r49 
+GR_ad_tbl_1     = r50
+GR_ad_tbl_2     = r51
+GR_ad_tbl_3     = r52
+GR_ad_q         = r53
+GR_ad_z_1       = r54
+GR_ad_z_2       = r55
+GR_ad_z_3       = r56
+GR_minus_N      = r57
+
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(asinhl)
+
+{ .mfi
+      alloc     GR_PFS        = ar.pfs,0,27,0,0
+      fma.s1    FR_P2         = FR_Arg, FR_Arg, f1  // p2 = x^2 + 1
+      mov   	GR_Half       = 0xfffe              // 0.5's exp
+}
+{ .mfi
+      addl      GR_Poly_C_79  = @ltoff(Poly_C_near_0_79), gp // C7, C9 coeffs
+      fma.s1    FR_X2         = FR_Arg, FR_Arg, f0           // Obtain x^2
+      addl      GR_Poly_C_35  = @ltoff(Poly_C_near_0_35), gp // C3, C5 coeffs
+};;
+
+{ .mfi
+      getf.exp  GR_ArgExp     = FR_Arg        // get arument's exponent
+      fabs      FR_AX         = FR_Arg        // absolute value of argument
+      mov       GR_TwoN7      = 0xfff8        // 2^-7 exp
+}
+{ .mfi
+      ld8       GR_Poly_C_79  = [GR_Poly_C_79] // get actual coeff table address
+      fma.s0       FR_Two        = f1, f1, f1        // construct 2.0
+      mov       GR_ExpMask    = 0x1ffff        // mask for exp
+};;
+
+{ .mfi
+      ld8       GR_Poly_C_35  = [GR_Poly_C_35] // get actual coeff table address
+      fclass.m  p6,p0         = FR_Arg, 0xe7   // if arg NaN inf zero
+      mov       GR_TwoP63     = 0x1003e        // 2^63 exp
+}
+{ .mfi
+      addl      GR_ad_z_1     = @ltoff(Constants_Z_1#),gp
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      setf.exp	FR_Half       = GR_Half              // construct 0.5
+      fclass.m  p7,p0         = FR_Arg, 0x09  //  if arg + denorm
+      and       GR_ArgExp     = GR_ExpMask, GR_ArgExp // select exp
+}
+{ .mfb
+      ld8       GR_ad_z_1     = [GR_ad_z_1]   // Get pointer to Constants_Z_1
+      nop.f 0
+      nop.b 0
+};;
+{ .mfi
+      ldfe      FR_C9         = [GR_Poly_C_79],16 // load C9
+      fclass.m  p10,p0        = FR_Arg, 0x0a    //  if arg - denorm
+      cmp.gt    p8, p0        = GR_TwoN7,  GR_ArgExp // if arg < 2^-7 ('near 0')
+}
+{ .mfb
+      cmp.le    p9, p0        = GR_TwoP63, GR_ArgExp  // if arg > 2^63 ('huges')
+(p6)  fma.s0    FR_Res        = FR_Arg,f1,FR_Arg     // r = a + a
+(p6)  br.ret.spnt b0                            // return       
+};;
+// (X^2 + 1) computation
+{ .mfi
+(p8)  ldfe      FR_C5         = [GR_Poly_C_35],16        // load C5
+      fms.s1    FR_Tmp        = f1, f1, FR_P2           // Tmp = 1 - p2
+      add       GR_ad_tbl_1   = 0x040, GR_ad_z_1    // Point to Constants_G_H_h1
+}
+{ .mfb
+(p8)  ldfe      FR_C7         = [GR_Poly_C_79],16        // load C7
+(p7)  fnma.s0   FR_Res        =  FR_Arg,FR_Arg,FR_Arg // r = a - a*a
+(p7)  br.ret.spnt b0                              // return
+};;
+
+{ .mfi
+(p8)  ldfe      FR_C3         = [GR_Poly_C_35],16     // load C3
+      fcmp.lt.s1 p11, p12      = FR_Arg, f0     // if arg is negative
+      add       GR_ad_q       = -0x60, GR_ad_z_1    // Point to Constants_P
+}
+{ .mfb
+      add       GR_ad_z_2     = 0x140, GR_ad_z_1    // Point to Constants_Z_2
+(p10) fma.s0    FR_Res        =  FR_Arg,FR_Arg,FR_Arg // r = a + a*a
+(p10) br.ret.spnt b0                             // return
+};;
+
+{ .mfi
+      add       GR_ad_tbl_2   = 0x180, GR_ad_z_1    // Point to Constants_G_H_h2
+      frsqrta.s1 FR_Rcp, p0   = FR_P2           // Rcp = 1/p2 reciprocal appr.
+      add       GR_ad_tbl_3   = 0x280, GR_ad_z_1    // Point to Constants_G_H_h3
+}
+{ .mfi
+      nop.m 0
+      fms.s1    FR_P2L        = FR_AX, FR_AX, FR_X2 //low part of p2=fma(X*X-p2)
+      mov       GR_Bias       = 0x0FFFF            // Create exponent bias
+};;
+
+{ .mfb
+      nop.m 0
+(p9)  fms.s1    FR_XLog_Hi    = FR_Two, FR_AX, f0  // Hi  of log1p arg = 2*X - 1
+(p9)  br.cond.spnt huges_logl                      // special version of log1p
+};;
+
+{ .mfb
+      ldfe      FR_log2_hi    = [GR_ad_q],16      // Load log2_hi
+(p8)  fma.s1    FR_X3         = FR_X2, FR_Arg, f0        // x^3 = x^2 * x
+(p8)  br.cond.spnt near_0                                // Go to near 0 branch
+};;
+
+{ .mfi
+      ldfe      FR_log2_lo    = [GR_ad_q],16      // Load log2_lo
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe      FR_Q4         = [GR_ad_q],16          // Load Q4
+      fma.s1    FR_Tmp        = FR_Tmp, f1, FR_X2       // Tmp = Tmp + x^2
+      mov       GR_exp_mask   = 0x1FFFF        // Create exponent mask
+};;
+
+{ .mfi
+      ldfe      FR_Q3         = [GR_ad_q],16   // Load Q3
+      fma.s1    FR_GG         = FR_Rcp, FR_P2, f0        // g = Rcp * p2
+                                               // 8 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_HH         = FR_Half, FR_Rcp, f0      // h = 0.5 * Rcp
+      nop.i 0
+};;
+{ .mfi
+      ldfe      FR_Q2         = [GR_ad_q],16      // Load Q2
+      fnma.s1   FR_EE         = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_P2L        = FR_Tmp, f1, FR_P2L // low part of p2 = Tmp + p2l
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe      FR_Q1         = [GR_ad_q]                // Load Q1
+      fma.s1    FR_GG         = FR_GG, FR_EE, FR_GG     // g = g * e + g 
+                                              // 16 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_HH         = FR_HH, FR_EE, FR_HH     // h = h * e + h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fnma.s1   FR_EE         = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_GG         = FR_GG, FR_EE, FR_GG     // g = g * e + g 
+                                              // 32 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_HH         = FR_HH, FR_EE, FR_HH     // h = h * e + h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fnma.s1   FR_EE         = FR_GG, FR_HH, FR_Half   // e = 0.5 - g * h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_GG         = FR_GG, FR_EE, FR_GG     // g = g * e + g 
+                                              // 64 bit Newton Raphson iteration
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_HH         = FR_HH, FR_EE, FR_HH     // h = h * e + h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fnma.s1   FR_DD         = FR_GG, FR_GG, FR_P2  // Remainder d = g * g - p2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_XLog_Hi     = FR_AX, f1, FR_GG // bh = z + gh
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_DD         = FR_DD, f1, FR_P2L       // add p2l: d = d + p2l
+      nop.i 0
+};;
+
+
+{ .mfi
+      getf.sig  GR_signif     = FR_XLog_Hi     // Get significand of x+1
+      fmerge.ns FR_Neg_One    = f1, f1         // Form -1.0
+      mov       GR_exp_2tom7  = 0x0fff8        // Exponent of 2^-7
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_GL         = FR_DD, FR_HH, f0        // gl = d * h
+      extr.u    GR_Index1     = GR_signif, 59, 4    // Get high 4 bits of signif
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_XLog_Hi     = FR_DD,  FR_HH, FR_XLog_Hi // bh = bh + gl
+      nop.i 0
+};;
+
+{ .mmi
+      shladd    GR_ad_z_1     = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      shladd    GR_ad_tbl_1   = GR_Index1, 4, GR_ad_tbl_1  // Point to G_1
+      extr.u    GR_X_0        = GR_signif, 49, 15 // Get high 15 bits of signif.
+};;
+
+{ .mmi
+      ld4       GR_Z_1        = [GR_ad_z_1]    // Load Z_1
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmi
+      ldfps     FR_G, FR_H    = [GR_ad_tbl_1],8     // Load G_1, H_1
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1    FR_XLog_Lo     = FR_GG,  f1,   FR_XLog_Hi // bl = gh - bh
+      pmpyshr2.u GR_X_1       = GR_X_0,GR_Z_1,15  // Get bits 30-15 of X_0 * Z_1
+};;
+
+// WE CANNOT USE GR_X_1 IN NEXT 3 CYCLES BECAUSE OF POSSIBLE 10 CLOCKS STALL!
+// "DEAD" ZONE!
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fmerge.se FR_S_hi       =  f1,FR_XLog_Hi            // Form |x+1|
+      nop.i 0
+};;
+
+{ .mmi
+      getf.exp  GR_N          =  FR_XLog_Hi    // Get N = exponent of x+1
+      ldfd      FR_h          = [GR_ad_tbl_1]        // Load h_1
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      extr.u    GR_Index2     = GR_X_1, 6, 4      // Extract bits 6-9 of X_1 
+};;
+
+
+{ .mfi
+      shladd    GR_ad_tbl_2   = GR_Index2, 4, GR_ad_tbl_2  // Point to G_2
+      fma.s1    FR_XLog_Lo    = FR_XLog_Lo, f1, FR_AX // bl = bl + x
+      mov       GR_exp_2tom80 = 0x0ffaf           // Exponent of 2^-80
+}
+{ .mfi
+      shladd    GR_ad_z_2     = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+      nop.f 0
+      sub       GR_N          = GR_N, GR_Bias // sub bias from exp
+};;
+
+{ .mmi
+      ldfps     FR_G2, FR_H2  = [GR_ad_tbl_2],8       // Load G_2, H_2
+      ld4       GR_Z_2        = [GR_ad_z_2]                // Load Z_2
+      sub       GR_minus_N    = GR_Bias, GR_N         // Form exponent of 2^(-N)
+};;
+
+{ .mmi
+      ldfd      FR_h2         = [GR_ad_tbl_2]             // Load h_2
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmi
+      setf.sig  FR_float_N    = GR_N        // Put integer N into rightmost sign
+      setf.exp  FR_2_to_minus_N = GR_minus_N   // Form 2^(-N)
+      pmpyshr2.u GR_X_2       = GR_X_1,GR_Z_2,15 // Get bits 30-15 of X_1 * Z_2
+};;
+
+// WE CANNOT USE GR_X_2 IN NEXT 3 CYCLES ("DEAD" ZONE!) 
+// BECAUSE OF POSSIBLE 10 CLOCKS STALL!
+// So we can negate Q coefficients there for negative values
+
+{ .mfi
+      nop.m 0
+(p11) fma.s1    FR_Q1         = FR_Q1, FR_Neg_One, f0 // Negate Q1
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_XLog_Lo     = FR_XLog_Lo, f1, FR_GL // bl = bl + gl
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p11) fma.s1    FR_Q2         = FR_Q2, FR_Neg_One, f0 // Negate Q2
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p11) fma.s1    FR_Q3         = FR_Q3, FR_Neg_One, f0 // Negate Q3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p11) fma.s1    FR_Q4         = FR_Q4, FR_Neg_One, f0 // Negate Q4
+      extr.u    GR_Index3     = GR_X_2, 1, 5         // Extract bits 1-5 of X_2
+};;
+
+{ .mfi
+      shladd    GR_ad_tbl_3   = GR_Index3, 4, GR_ad_tbl_3  // Point to G_3
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfps     FR_G3, FR_H3  = [GR_ad_tbl_3],8   // Load G_3, H_3
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfd      FR_h3         = [GR_ad_tbl_3]            // Load h_3
+	  fcvt.xf   FR_float_N    = FR_float_N
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_G          = FR_G, FR_G2              // G = G_1 * G_2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_H          = FR_H, FR_H2              // H = H_1 + H_2
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_h          = FR_h, FR_h2              // h = h_1 + h_2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_S_lo       = FR_XLog_Lo, FR_2_to_minus_N, f0 //S_lo=S_lo*2^-N
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_G          = FR_G, FR_G3             // G = (G_1 * G_2) * G_3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_H          = FR_H, FR_H3             // H = (H_1 + H_2) + H_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_h          = FR_h, FR_h3             // h = (h_1 + h_2) + h_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1    FR_r          = FR_G, FR_S_hi, f1           // r = G * S_hi - 1
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_Y_hi       = FR_float_N, FR_log2_hi, FR_H // Y_hi=N*log2_hi+H
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_h          = FR_float_N, FR_log2_lo, FR_h  // h=N*log2_lo+h
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_r          = FR_G, FR_S_lo, FR_r  // r=G*S_lo+(G*S_hi-1)
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_lo    = FR_r, FR_Q4, FR_Q3      // poly_lo = r * Q4 + Q3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_rsq        = FR_r, FR_r              // rsq = r * r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_lo    = FR_poly_lo, FR_r, FR_Q2 // poly_lo=poly_lo*r+Q2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_rcub       = FR_rsq, FR_r, f0        // rcub = r^3
+      nop.i 0
+};;
+
+.pred.rel "mutex",p12,p11
+{ .mfi
+      nop.m 0
+(p12) fma.s1    FR_poly_hi    = FR_Q1, FR_rsq, FR_r // poly_hi = Q1*rsq + r
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fms.s1    FR_poly_hi    = FR_Q1, FR_rsq, FR_r     // poly_hi = Q1*rsq + r
+      nop.i 0
+};;
+
+
+.pred.rel "mutex",p12,p11
+{ .mfi
+      nop.m 0
+(p12) fma.s1    FR_poly_lo    = FR_poly_lo, FR_rcub, FR_h//poly_lo=poly_lo*r^3+h
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fms.s1    FR_poly_lo    = FR_poly_lo, FR_rcub, FR_h//poly_lo=poly_lo*r^3+h
+      nop.i 0
+}
+;;
+
+{ .mfi
+      nop.m 0
+      fadd.s0   FR_Y_lo       = FR_poly_hi, FR_poly_lo  
+	                                                     // Y_lo=poly_hi+poly_lo
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fma.s0    FR_Y_hi       = FR_Y_hi, FR_Neg_One, f0 // FR_Y_hi sign for neg
+      nop.i 0
+};;
+
+{ .mfb
+      nop.m 0
+      fadd.s0   FR_Res        = FR_Y_lo,FR_Y_hi    // Result=Y_lo+Y_hi
+      br.ret.sptk   b0                         // Common exit for 2^-7 < x < inf
+};;
+
+// * SPECIAL VERSION OF LOGL FOR HUGE ARGUMENTS *
+
+huges_logl:
+{ .mfi
+      getf.sig  GR_signif     = FR_XLog_Hi     // Get significand of x+1
+      fmerge.ns FR_Neg_One    = f1, f1         // Form -1.0
+      mov       GR_exp_2tom7  = 0x0fff8        // Exponent of 2^-7
+};;
+
+{ .mfi
+      add       GR_ad_tbl_1   = 0x040, GR_ad_z_1    // Point to Constants_G_H_h1
+      nop.f 0
+      add       GR_ad_q       = -0x60, GR_ad_z_1    // Point to Constants_P
+}
+{ .mfi
+      add       GR_ad_z_2     = 0x140, GR_ad_z_1    // Point to Constants_Z_2
+      nop.f 0
+      add       GR_ad_tbl_2   = 0x180, GR_ad_z_1    // Point to Constants_G_H_h2
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      extr.u    GR_Index1     = GR_signif, 59, 4    // Get high 4 bits of signif
+}
+{ .mfi
+      add       GR_ad_tbl_3   = 0x280, GR_ad_z_1    // Point to Constants_G_H_h3
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      shladd    GR_ad_z_1     = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      nop.f 0
+      extr.u    GR_X_0        = GR_signif, 49, 15 // Get high 15 bits of signif.
+};;
+
+{ .mfi
+      ld4       GR_Z_1        = [GR_ad_z_1]    // Load Z_1
+      nop.f 0
+      mov       GR_exp_mask   = 0x1FFFF        // Create exponent mask
+}
+{ .mfi
+      shladd    GR_ad_tbl_1   = GR_Index1, 4, GR_ad_tbl_1  // Point to G_1
+      nop.f 0
+      mov       GR_Bias       = 0x0FFFF            // Create exponent bias
+};;
+
+{ .mfi
+      ldfps     FR_G, FR_H    = [GR_ad_tbl_1],8     // Load G_1, H_1
+      fmerge.se FR_S_hi       =  f1,FR_XLog_Hi            // Form |x+1|
+      nop.i 0
+};;
+
+{ .mmi
+      getf.exp  GR_N          =  FR_XLog_Hi          // Get N = exponent of x+1
+      ldfd      FR_h          = [GR_ad_tbl_1]        // Load h_1
+      nop.i 0
+};;
+
+{ .mfi
+      ldfe      FR_log2_hi    = [GR_ad_q],16      // Load log2_hi
+      nop.f 0
+      pmpyshr2.u GR_X_1       = GR_X_0,GR_Z_1,15  // Get bits 30-15 of X_0 * Z_1
+};;
+
+// WE CANNOT USE GR_X_1 IN NEXT 3 CYCLES BECAUSE OF POSSIBLE 10 CLOCKS STALL!
+// "DEAD" ZONE!
+
+{ .mmi
+      ldfe      FR_log2_lo    = [GR_ad_q],16      // Load log2_lo
+      sub       GR_N          = GR_N, GR_Bias 
+      mov       GR_exp_2tom80 = 0x0ffaf           // Exponent of 2^-80
+};;
+
+{ .mfi
+      ldfe      FR_Q4         = [GR_ad_q],16          // Load Q4
+      nop.f 0
+      sub       GR_minus_N    = GR_Bias, GR_N         // Form exponent of 2^(-N)
+};;
+
+{ .mmf
+      ldfe      FR_Q3         = [GR_ad_q],16   // Load Q3
+      setf.sig  FR_float_N    = GR_N        // Put integer N into rightmost sign
+      nop.f 0
+};;
+
+{ .mmi
+      nop.m 0
+      ldfe      FR_Q2         = [GR_ad_q],16      // Load Q2
+      extr.u    GR_Index2     = GR_X_1, 6, 4      // Extract bits 6-9 of X_1 
+};;
+
+{ .mmi
+      ldfe      FR_Q1         = [GR_ad_q]                // Load Q1
+      shladd    GR_ad_z_2     = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+      nop.i 0
+};;
+
+{ .mmi
+      ld4       GR_Z_2        = [GR_ad_z_2]                // Load Z_2
+      shladd    GR_ad_tbl_2   = GR_Index2, 4, GR_ad_tbl_2  // Point to G_2
+      nop.i 0
+};;
+
+{ .mmi
+      ldfps     FR_G2, FR_H2  = [GR_ad_tbl_2],8       // Load G_2, H_2
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mfi
+      ldfd      FR_h2         = [GR_ad_tbl_2]             // Load h_2
+      nop.f 0
+      nop.i 0
+}
+{ .mfi
+      setf.exp  FR_2_to_minus_N = GR_minus_N   // Form 2^(-N)
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      pmpyshr2.u GR_X_2       = GR_X_1,GR_Z_2,15 // Get bits 30-15 of X_1 * Z_2
+};;
+
+// WE CANNOT USE GR_X_2 IN NEXT 3 CYCLES BECAUSE OF POSSIBLE 10 CLOCKS STALL!
+// "DEAD" ZONE!
+// JUST HAVE TO INSERT 3 NOP CYCLES (nothing to do here)
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      nop.f 0
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+(p11) fma.s1    FR_Q4         = FR_Q4, FR_Neg_One, f0 // Negate Q4
+      extr.u    GR_Index3     = GR_X_2, 1, 5          // Extract bits 1-5 of X_2
+ };;
+
+{ .mfi
+      shladd    GR_ad_tbl_3   = GR_Index3, 4, GR_ad_tbl_3  // Point to G_3
+	  fcvt.xf   FR_float_N    = FR_float_N
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fma.s1    FR_Q3         = FR_Q3, FR_Neg_One, f0 // Negate Q3
+      nop.i 0
+};;
+
+{ .mfi
+      ldfps     FR_G3, FR_H3  = [GR_ad_tbl_3],8   // Load G_3, H_3
+(p11) fma.s1    FR_Q2         = FR_Q2, FR_Neg_One, f0 // Negate Q2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fma.s1    FR_Q1         = FR_Q1, FR_Neg_One, f0 // Negate Q1
+      nop.i 0
+};;
+
+{ .mfi
+      ldfd      FR_h3         = [GR_ad_tbl_3]            // Load h_3
+      fmpy.s1   FR_G          = FR_G, FR_G2              // G = G_1 * G_2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_H          = FR_H, FR_H2              // H = H_1 + H_2
+      nop.i 0
+};;
+
+{ .mmf
+      nop.m 0
+      nop.m 0
+      fadd.s1   FR_h          = FR_h, FR_h2              // h = h_1 + h_2
+};;
+
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_G          = FR_G, FR_G3             // G = (G_1 * G_2) * G_3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_H          = FR_H, FR_H3             // H = (H_1 + H_2) + H_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s1   FR_h          = FR_h, FR_h3             // h = (h_1 + h_2) + h_3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fms.s1    FR_r          = FR_G, FR_S_hi, f1           // r = G * S_hi - 1
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_Y_hi       = FR_float_N, FR_log2_hi, FR_H // Y_hi=N*log2_hi+H
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_h          = FR_float_N, FR_log2_lo, FR_h  // h=N*log2_lo+h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_lo    = FR_r, FR_Q4, FR_Q3      // poly_lo = r * Q4 + Q3
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fmpy.s1   FR_rsq        = FR_r, FR_r              // rsq = r * r
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_poly_lo    = FR_poly_lo, FR_r, FR_Q2 // poly_lo=poly_lo*r+Q2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_rcub       = FR_rsq, FR_r, f0        // rcub = r^3
+      nop.i 0
+};;
+
+.pred.rel "mutex",p12,p11
+{ .mfi
+      nop.m 0
+(p12) fma.s1    FR_poly_hi    = FR_Q1, FR_rsq, FR_r // poly_hi = Q1*rsq + r
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fms.s1    FR_poly_hi    = FR_Q1, FR_rsq, FR_r // poly_hi = Q1*rsq + r
+      nop.i 0
+};;
+
+
+.pred.rel "mutex",p12,p11
+{ .mfi
+      nop.m 0
+(p12) fma.s1    FR_poly_lo    = FR_poly_lo, FR_rcub, FR_h//poly_lo=poly_lo*r^3+h
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fms.s1    FR_poly_lo    = FR_poly_lo, FR_rcub, FR_h//poly_lo=poly_lo*r^3+h
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fadd.s0   FR_Y_lo       = FR_poly_hi, FR_poly_lo  // Y_lo=poly_hi+poly_lo
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+(p11) fma.s0    FR_Y_hi       = FR_Y_hi, FR_Neg_One, f0 // FR_Y_hi sign for neg
+      nop.i 0
+};;
+
+{ .mfb
+      nop.m 0
+      fadd.s0   FR_Res        = FR_Y_lo,FR_Y_hi    // Result=Y_lo+Y_hi
+      br.ret.sptk   b0                         // Common exit for 2^-7 < x < inf
+};;
+
+// NEAR ZERO POLYNOMIAL INTERVAL
+near_0:
+{ .mfi
+      nop.m 0
+      fma.s1    FR_X4         = FR_X2, FR_X2, f0 // x^4 = x^2 * x^2
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_P9         = FR_C9,FR_X2,FR_C7  // p9 = C9*x^2 + C7
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1    FR_P5         = FR_C5,FR_X2,FR_C3  // p5 = C5*x^2 + C3
+      nop.i 0
+};;
+
+{ .mfi
+      nop.m 0
+      fma.s1    FR_P3         = FR_P9,FR_X4,FR_P5  // p3 = p9*x^4 + p5
+      nop.i 0
+};;
+
+{ .mfb
+      nop.m 0
+      fma.s0    FR_Res        = FR_P3,FR_X3,FR_Arg // res = p3*C3 + x
+      br.ret.sptk   b0                          // Near 0 path return
+};;
+
+GLOBAL_LIBM_END(asinhl)
+
+
+
diff --git a/sysdeps/ia64/fpu/s_atan.S b/sysdeps/ia64/fpu/s_atan.S
index c0daabd3d7..720ecad28a 100644
--- a/sysdeps/ia64/fpu/s_atan.S
+++ b/sysdeps/ia64/fpu/s_atan.S
@@ -1,10 +1,10 @@
 .file "atan.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,947 +20,734 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 4/13/00: Improved speed
-// 4/19/00: Removed the qualifying predicate from the fmerge.s that
-//          takes the absolute value.
-// 6/16/00: Reassigned FP registers to eliminate stalls on loads
-// 8/30/00: Saved 5 cycles in main path by rearranging large argument logic
-//          and delaying use of result of fcmp in load by 1 group
+// 02/02/00  Initial version
+// 04/13/00  Improved speed
+// 04/19/00  Removed the qualifying predicate from the fmerge.s that
+//           takes the absolute value.
+// 06/16/00  Reassigned FP registers to eliminate stalls on loads
+// 08/30/00  Saved 5 cycles in main path by rearranging large argument logic
+//           and delaying use of result of fcmp in load by 1 group
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 08/20/02  Use atan2 algorithm with x=1 for better accuracy
+// 02/06/03  Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
-// double atan( double x);
+// double atan(double Y)
 //
 // Overview of operation
 //==============================================================
-// atan(x) = sign(X)pi/2 - atan(1/x)
 //
-// We have two paths: |x| > 1 and |x| <= 1
+// The atan function returns values in the interval [-pi/2,+pi/2].
 //
-// |x| >  1
-// ==========================================
+// The algorithm used is the atan2(Y,X) algorithm where we fix X=1.0.
 //
-// c  = frcpa(x) which is approximately 1/x
+// There are two basic paths: swap true and swap false.
+// atan2(Y,X) ==> atan2(V/U) where U >= V. If Y > X, we must swap.
 //
-// xc = 1- B
-// B  = 1-xc
+// p6  swap True    |Y| > |X|
+// p7  swap False   |Y| <= |X|
 //
-// Approximate 1/(1-B)^k by a polynomial in B, poly(B)
-// k is 45.
 //
-// poly(B)     = 1 + r1 B + r2 B^2 + ...+ r10 B^10
+// Simple trigonometric identities show
+//   Region 1
+//         |Y|<=1.0, V=Y, U=1.0     atan2(Y,X) = sgnY * (0 + atan(V/U))
 //
-// c^k         = (1-B)^k/x^k
-// c^k/(1-B)^k = 1/x^k 
-// c^k poly(B) = 1/x^k
-
-// poly(x)     = series(atan(1/x)) = 1/x - 1/3x^3 + 1/5x^5 - 1/7x^7 .... + 1/45 x^45
-//                                 = 1/x^45 ( x^44 - x^42/3 + x^40/5 - x^38/7 ... +1)
-//                                 = 1/x^45 ( y^22 - y^21/3 + y^20/5 - y^19/7 ... +1)
-//        
-//                                 = c^45 poly(B) poly(x)
-//                                 = c^45 r(B) q(y)
-
-// q(y) = q0 + q1 y + q2 y^2 + ... + q22 y^22
-// where q22 is 1.0
-
-// atan(x) = sign(X)pi/2 -  c^45 r(B) q(y)
-
-// |x| <=  1
-// ==========================================
-// poly(x)    = series(atan(x))   = x - x^3/3 + x^5/5 + .....
-// poly(x)    = series(atan(x))   = x  + x^3(- 1/3 + x^2/5 + ..... +x^47/47)
-// poly(x)    = series(atan(x))   = x  + x^3(p0 + x^2/5 + ..... + x^44/47)
-// poly(x)    = series(atan(x))   = x  + x^3(p0 + y/5 + ..... + y^22/47)
-   
-// where p0 is about -1/3.
-
-// atan(x) = poly(x)
-
-#include "libm_support.h"
+//   Region 2
+//         |Y|>1.0, V=1.0, U=Y      atan2(Y,X) = sgnY * (pi/2 - atan(V/U))
+//
+//
+// We compute atan(V/U) from the identity
+//      atan(z) + atan([(V/U)-z] / [1+(V/U)z])
+//      where z is a limited precision approximation (16 bits) to V/U
+//
+// z is calculated with the assistance of the frcpa instruction.
+//
+// atan(z) is calculated by a polynomial z + z^3 * p(w),  w=z^2
+// where p(w) = P0+P1*w+...+P22*w^22
+//
+// Let d = [(V/U)-z] / [1+(V/U)z]) = (V-U*z)/(U+V*z)
+//
+// Approximate atan(d) by d + P0*d^3
+// Let F = 1/(U+V*z) * (1-a), where |a|< 2^-8.8.
+// Compute q(a) = 1 + a + ... + a^5.
+// Then F*q(a) approximates the reciprocal to more than 50 bits.
 
-// Special Values
+// Special values
 //==============================================================
 // atan(QNAN)  = QNAN
 // atan(SNAN)  = quieted SNAN
-// atan(+-inf) = +- pi/2     
+// atan(+-inf) = +- pi/2
 // atan(+-0)   = +-0
 
-
-
 // Registers used
 //==============================================================
 
-// predicate registers used: 
-// p6 -> p11
+// predicate registers used:
+// p6 -> p15
 
-// floating-point registers used:  
-// f32 -> f127
+// floating-point registers used:
+// f8, input
+// f32 -> f116
 
 // general registers used
-// r32 -> r37
+// r14 -> r16
 
 // Assembly macros
 //==============================================================
-atan_Pi_by_2                  = f32
-atan_S_PI                     = f33
-atan_ABS_f8                   = f34
-
-atan_R0                       = f35
-atan_R1                       = f36
-atan_R2                       = f37
-atan_R3                       = f38 
-atan_R4                       = f39 
-atan_R5                       = f40 
-atan_R6                       = f41
-atan_R7                       = f42
-atan_R8                       = f43 
-atan_R9                       = f44 
-atan_R10                      = f45 
-
-atan_Q0                       = f46
-
-atan_Q1                       = f47 
-atan_Q2                       = f48
-atan_Q3                       = f49
-atan_Q4                       = f50
-atan_Q5                       = f51 
-atan_Q6                       = f52 
-atan_Q7                       = f53 
-atan_Q8                       = f54 
-atan_Q9                       = f55 
-atan_Q10                      = f56 
-
-atan_Q11                      = f57 
-atan_Q12                      = f58
-atan_Q13                      = f59
-atan_Q14                      = f60
-atan_Q15                      = f61 
-atan_Q16                      = f62 
-atan_Q17                      = f63 
-atan_Q18                      = f64 
-atan_Q19                      = f65 
-atan_Q20                      = f66 
-atan_Q21                      = f67 
-atan_Q22                      = f68 
-
-// P and Q constants are mutually exclusive 
-// so they can share macro definitions
-atan_P0                       = f46
-
-atan_P1                       = f47 
-atan_P2                       = f48
-atan_P3                       = f49
-atan_P4                       = f10
-atan_P5                       = f11 
-atan_P6                       = f12 
-atan_P7                       = f13 
-atan_P10                      = f103 
-
-atan_P11                      = f114 
-atan_P12                      = f58
-atan_P13                      = f59
-atan_P14                      = f60
-atan_P15                      = f61 
-atan_P16                      = f62 
-atan_P17                      = f63 
-atan_P18                      = f64 
-atan_P19                      = f65 
-atan_P20                      = f14 
-atan_P21                      = f99 
-atan_P22                      = f68 
-// end of P constant macros
-
-atan_C                        = f69
-atan_Y                        = f70
-atan_B                        = f71
-atan_Z                        = f72
-atan_V11                      = f73
-atan_V12                      = f74
-
-atan_V7                       = f75
-atan_V8                       = f76
-
-atan_W13                      = f77
-atan_W11                      = f78
-
-atan_V3                       = f79
-atan_V4                       = f80
-
-atan_G11                      = f81
-atan_G12                      = f82
-atan_G7                       = f83
-atan_G8                       = f84
-
-atan_Z1                       = f85
-atan_W7                       = f86
-
-atan_G3                       = f87
-atan_W8                       = f88
-atan_V9                       = f89
-atan_V10                      = f90
-
-atan_G10                      = f91
-atan_W3                       = f92
-atan_G4                       = f93
-atan_G9                       = f94
-                                
-atan_G6                       = f95
-atan_W4                       = f96
-atan_Z2                       = f97
-atan_V6                       = f98
-                              
-atan_V2                       = f99
-atan_W6                       = f100
-atan_W10                      = f101
-atan_Y3                       = f102
-                              
-atan_G2                       = f103
-
-atan_Y8                       = f104
-                              
-atan_G5                       = f105
-atan_Z3                       = f106
-atan_Z4                       = f107
-atan_W2                       = f108
-atan_V5                       = f109
-                            
-atan_W5                       = f110
-atan_G1                       = f111
-atan_Y11                      = f112
-                             
-atan_Z5                       = f113
-atan_Z6                       = f114
-atan_V1                       = f115
-atan_W1                       = f116
-                              
-atan_Z7                       = f117
-atan_Q                        = f118
-atan_Z                        = f119
-atan_abs_f8                   = f120                            
-
-atan_V13                      = f121
-atan_Xcub                     = f122
-atan_Y12                      = f123
-atan_P                        = f124
-
-atan_NORM_f8                  = f125
-
-atan_P8                       = f126
-atan_P9                       = f127
-
-
-
-
-atan_GR_AD_R                 = r14
-atan_GR_AD_Q                 = r15
-atan_GR_AD_P                 = r16
-atan_GR_10172                = r17 
-atan_GR_exp_f8               = r18 
-atan_GR_signexp_f8           = r19
-atan_GR_exp_mask             = r20
-
-
 
+EXP_AD_P1                    = r14
+EXP_AD_P2                    = r15
+rsig_near_one                = r16
+
+atan2_Y                      = f8
+atan2_X                      = f1
+
+atan2_u1_X                   = f32
+atan2_u1_Y                   = f33
+atan2_z2_X                   = f34
+
+atan2_two                    = f36
+atan2_B1sq_Y                 = f37
+atan2_z1_X                   = f38
+atan2_B1X                    = f40
+
+atan2_B1Y                    = f41
+atan2_wp_X                   = f42
+atan2_B1sq_X                 = f43
+atan2_z                      = f44
+atan2_w                      = f45
+
+atan2_P0                     = f46
+atan2_P1                     = f47
+atan2_P2                     = f48
+atan2_P3                     = f49
+atan2_P4                     = f50
+
+atan2_P5                     = f51
+atan2_P6                     = f52
+atan2_P7                     = f53
+atan2_P8                     = f54
+atan2_P9                     = f55
+
+atan2_P10                    = f56
+atan2_P11                    = f57
+atan2_P12                    = f58
+atan2_P13                    = f59
+atan2_P14                    = f60
+
+atan2_P15                    = f61
+atan2_P16                    = f62
+atan2_P17                    = f63
+atan2_P18                    = f64
+atan2_P19                    = f65
+
+atan2_P20                    = f66
+atan2_P21                    = f67
+atan2_P22                    = f68
+atan2_pi_by_2                = f69
+atan2_sgn_pi_by_2            = f69
+atan2_V13                    = f70
+
+atan2_W11                    = f71
+atan2_E                      = f72
+atan2_wp_Y                   = f73
+atan2_V11                    = f74
+atan2_V12                    = f75
+
+atan2_V7                     = f76
+atan2_V8                     = f77
+atan2_W7                     = f78
+atan2_W8                     = f79
+atan2_W3                     = f80
+
+atan2_W4                     = f81
+atan2_V3                     = f82
+atan2_V4                     = f83
+atan2_F                      = f84
+atan2_gV                     = f85
+
+atan2_V10                    = f86
+atan2_zcub                   = f87
+atan2_V6                     = f88
+atan2_V9                     = f89
+atan2_W10                    = f90
+
+atan2_W6                     = f91
+atan2_W2                     = f92
+atan2_V2                     = f93
+atan2_alpha                  = f94
+atan2_alpha_1                = f95
+
+atan2_gVF                    = f96
+atan2_V5                     = f97
+atan2_W12                    = f98
+atan2_W5                     = f99
+atan2_alpha_sq               = f100
+
+atan2_Cp                     = f101
+atan2_V1                     = f102
+atan2_ysq                    = f103
+atan2_W1                     = f104
+atan2_alpha_cub              = f105
+
+atan2_C                      = f106
+atan2_d                      = f108
+atan2_A_hi                   = f109
+atan2_dsq                    = f110
+
+atan2_pd                     = f111
+atan2_A_lo                   = f112
+atan2_A                      = f113
+atan2_Pp                     = f114
+atan2_sgnY                   = f115
+
+atan2_sig_near_one           = f116
+atan2_near_one               = f116
 
 /////////////////////////////////////////////////////////////
 
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-double_atan_constants_R:
-ASM_TYPE_DIRECTIVE(double_atan_constants_R,@object)
-   data8 0xB36B46B9C5443CED, 0x0000401C  //R8
-   data8 0x842633E0D126261F, 0x0000401F  //R9
-   data8 0xBE04FFFFFFFF46E0, 0x00004010  //R4
-   data8 0xE8C62000244D66E2, 0x00004013  //R5
-   data8 0xF2790C001E3789B3, 0x00004016  //R6
-   data8 0xDCD2CCF97D7C764F, 0x00004019  //R7
-   data8 0xB40000000000000B, 0x00004004  //R1
-   data8 0xB265F3D38F5EE28F, 0x00004021  //R10
-   data8 0x8160000000000001, 0x00004009  //R2
-   data8 0xFD5BFFFFFFFE55CD, 0x0000400C  //R3
-   data8 0xC90FDAA22168C235, 0x00003FFF  // pi/2
-ASM_SIZE_DIRECTIVE(double_atan_constants_R)
-
-double_atan_constants_Q:
-ASM_TYPE_DIRECTIVE(double_atan_constants_Q,@object)
-   data8 0xEBD602FA7761BC33, 0x00003FF9  //Q8
-   data8 0x8CB1CABD6A91913C, 0x0000BFFA  //Q9
-   data8 0x84C665C37D623CD2, 0x00003FF7  //Q4
-   data8 0x8DE0D1673DAEA9BC, 0x0000BFF8  //Q5
-   data8 0xF658ADBE2C6E6FCC, 0x00003FF8  //Q6
-
-   data8 0xB56307BE1DD3FFB6, 0x0000BFF9  //Q7
-   data8 0xAAAAAAAAAAAA8000, 0x0000BFFD  //Q21
-   data8 0x8000000000000000, 0x00003FFF  //Q22
-   data8 0x924924923A9D710C, 0x0000BFFC  //Q19
-   data8 0xCCCCCCCCCC9380E7, 0x00003FFC  //Q20
- 
-   data8 0xA644DC250EFA2800, 0x00003FED  //Q0
-   data8 0x83DEAE24EEBF5E44, 0x0000BFF1  //Q1
-   data8 0xC758CCC64793D4EC, 0x00003FF3  //Q2
-   data8 0xBFDC0B54E7C89DCE, 0x0000BFF5  //Q3
-   data8 0x888855199D1290AF, 0x0000BFFB  //Q15
-
-   data8 0x9D89D3BE514B0178, 0x00003FFB  //Q16
-   data8 0xBA2E8B4DEC70282A, 0x0000BFFB  //Q17
-   data8 0xE38E38DF9E9FC83B, 0x00003FFB  //Q18
-   data8 0x9F8781CC990029D9, 0x00003FFA  //Q10
-   data8 0xB0B39472DEBA3C79, 0x0000BFFA  //Q11
-
-   data8 0xC2AFAEF8C85B0BC6, 0x00003FFA  //Q12
-   data8 0xD780E539797525DD, 0x0000BFFA  //Q13
-   data8 0xF0EDC449AC786DF9, 0x00003FFA  //Q14
-ASM_SIZE_DIRECTIVE(double_atan_constants_Q)
-
-
-
-double_atan_constants_P:
-ASM_TYPE_DIRECTIVE(double_atan_constants_P,@object)
-   data8 0xB1899EC590CDB8DF, 0x0000BFFA //P10
-   data8 0xA1E79850A67D59B0, 0x00003FFA //P11
-   data8 0x911D8B30C2A96E6D, 0x0000BFF3 //P20
-   data8 0xB87233C68A640706, 0x00003FF0 //P21
-   data8 0xD78E4B82F3C29D7A, 0x0000BFFA //P8
-
-   data8 0xC2EBE37AF932C14F, 0x00003FFA //P9
-   data8 0xBA2E8B94AA104DD6, 0x0000BFFB //P4
-   data8 0x9D89D7A640B71D38, 0x00003FFB //P5
-   data8 0x88887CA2CE9B2A40, 0x0000BFFB //P6
-   data8 0xF0F017D57A919C1E, 0x00003FFA //P7
-
-   data8 0xD0D635F230C80E06, 0x0000BFF8 //P16
-   data8 0xE847BECA7209B479, 0x00003FF7 //P17
-   data8 0xD14C6A2AAE0D5B07, 0x0000BFF6 //P18
-   data8 0x915F612A5C469117, 0x00003FF5 //P19
-   data8 0x921EDE5FD0DBBBE2, 0x0000BFFA //P12
-
-   data8 0xFFD303C2C8535445, 0x00003FF9 //P13
-   data8 0xD30DF50E295386F7, 0x0000BFF9 //P14
-   data8 0x9E81F2B1BBD210A8, 0x00003FF9 //P15
-   data8 0xAAAAAAAAAAAAA800, 0x0000BFFD //P0
-   data8 0xCCCCCCCCCCC7D476, 0x00003FFC //P1
-
-   data8 0x9249249247838066, 0x0000BFFC //P2
-   data8 0xE38E38E302290D68, 0x00003FFB //P3
-   data8 0xDF7F0A816F7E5025, 0x0000BFEC //P22
-ASM_SIZE_DIRECTIVE(double_atan_constants_P)
-
-
-.align 32
-.global atan#
-
-////////////////////////////////////////////////////////
-
+LOCAL_OBJECT_START(atan2_tb1)
+data8 0xA21922DC45605EA1 ,  0x00003FFA // P11
+data8 0xB199DD6D2675C40F ,  0x0000BFFA // P10
+data8 0xC2F01E5DDD100DBE ,  0x00003FFA // P9
+data8 0xD78F28FC2A592781 ,  0x0000BFFA // P8
+data8 0xF0F03ADB3FC930D3 ,  0x00003FFA // P7
+data8 0x88887EBB209E3543 ,  0x0000BFFB // P6
+data8 0x9D89D7D55C3287A5 ,  0x00003FFB // P5
+data8 0xBA2E8B9793955C77 ,  0x0000BFFB // P4
+data8 0xE38E38E320A8A098 ,  0x00003FFB // P3
+data8 0x9249249247E37913 ,  0x0000BFFC // P2
+data8 0xCCCCCCCCCCC906CD ,  0x00003FFC // P1
+data8 0xAAAAAAAAAAAAA8A9 ,  0x0000BFFD // P0
+data8 0x0000000000000000 ,  0x00000000 // pad to avoid bank conflict
+LOCAL_OBJECT_END(atan2_tb1)
+
+LOCAL_OBJECT_START(atan2_tb2)
+data8 0xCE585A259BD8374C ,  0x00003FF0 // P21
+data8 0x9F90FB984D8E39D0 ,  0x0000BFF3 // P20
+data8 0x9D3436AABE218776 ,  0x00003FF5 // P19
+data8 0xDEC343E068A6D2A8 ,  0x0000BFF6 // P18
+data8 0xF396268151CFB11C ,  0x00003FF7 // P17
+data8 0xD818B4BB43D84BF2 ,  0x0000BFF8 // P16
+data8 0xA2270D30A90AA220 ,  0x00003FF9 // P15
+data8 0xD5F4F2182E7A8725 ,  0x0000BFF9 // P14
+data8 0x80D601879218B53A ,  0x00003FFA // P13
+data8 0x9297B23CCFFB291F ,  0x0000BFFA // P12
+data8 0xFE7E52D2A89995B3 ,  0x0000BFEC // P22
+data8 0xC90FDAA22168C235 ,  0x00003FFF // pi/2
+LOCAL_OBJECT_END(atan2_tb2)
 
 
-.section .text
-.proc  atan#
-.align 32
 
-atan: 
-
-{ .mmf
-(p0)  addl      atan_GR_AD_P   = @ltoff(double_atan_constants_P), gp
-(p0)  addl      atan_GR_AD_Q   = @ltoff(double_atan_constants_Q), gp
-(p0)  fmerge.s  atan_ABS_f8  = f0,f8                       
-}
-;;
 
-{ .mmf
-      ld8 atan_GR_AD_P = [atan_GR_AD_P]
-      ld8 atan_GR_AD_Q = [atan_GR_AD_Q]
-(p0)  frcpa.s1     atan_C,p8 = f1,f8                                  
-}
-;;
+.section .text
+GLOBAL_LIBM_ENTRY(atan)
 
-{ .mmf
-(p0)  addl      atan_GR_AD_R   = @ltoff(double_atan_constants_R), gp
-(p0)  addl      atan_GR_exp_mask = 0x1ffff, r0
-(p0)  fma.s1       atan_Y = f8,f8,f0                                  
+{ .mfi
+           nop.m 999
+           frcpa.s1     atan2_u1_Y,p7 = f1,atan2_Y
+           nop.i 999
 }
+{ .mfi
+           addl         EXP_AD_P1   = @ltoff(atan2_tb1), gp
+           fma.s1       atan2_two  = f1,f1,f1
+           nop.i 999
 ;;
-
-// This fnorm takes faults or sets fault flags
-{ .mmf
-(p0)  mov       atan_GR_10172 = 0x10172
-      ld8 atan_GR_AD_R = [atan_GR_AD_R]
-(p0)  fnorm     atan_NORM_f8  = f8
 }
-;;
-
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    0   0        0     1 11
-// c                      7
-
-// p9 set if we have a NAN or +-0
 
-{ .mmf
-(p0)  ldfe      atan_Q8  = [atan_GR_AD_Q],16 
-(p0)  ldfe      atan_P10    = [atan_GR_AD_P],16                   
-(p0)  fclass.m.unc p9, p0   = f8, 0xc7                         
+{ .mfi
+           ld8  EXP_AD_P1 = [EXP_AD_P1]
+           frcpa.s1     atan2_u1_X,p6 = f1,atan2_X
+           nop.i 999
 }
-;;
-
-
-{ .mmi
-(p0)  ldfe      atan_Q9  = [atan_GR_AD_Q],16 
-(p0)  ldfe      atan_P11    = [atan_GR_AD_P],16                   
-      nop.i 999   
+{ .mfi
+           nop.m 999
+           fma.s1       atan2_ysq  = atan2_Y,atan2_Y,f0
+           nop.i 999
 }
 ;;
 
-        
-{ .mmf
-(p0)  ldfe      atan_Q4      = [atan_GR_AD_Q],16 
-(p0)  ldfe      atan_P20     = [atan_GR_AD_P],16                   
-(p9)  fma.d.s0  f8          = f8,f1,f0
-;;
-}
-
-// Exit if we have a NAN or +-0
-{ .mmb
-(p0)  ldfe      atan_Q5     = [atan_GR_AD_Q],16 
-(p0)  ldfe      atan_P21    = [atan_GR_AD_P],16                   
-(p9)  br.ret.spnt b0
-;;
+{ .mfi
+           add  EXP_AD_P2 = 0xd0,EXP_AD_P1
+           fmerge.s     atan2_sgnY = atan2_Y,f1
+           nop.i 999
 }
-
-
-// p6 is TRUE if |x| <= 1
-// p7 is TRUE if |x| >  1
-{ .mmf
-(p0)  ldfe      atan_Q6  = [atan_GR_AD_Q],16 
-(p0)  ldfe      atan_P8  = [atan_GR_AD_P],16                   
-(p0)  fcmp.le.unc  p6,p7 = atan_ABS_f8, f1 
 ;;
-}
 
 
 { .mfi
-(p0)  ldfe         atan_Q7  = [atan_GR_AD_Q],16 
-(p0)  fma.s1       atan_Z   = atan_C, atan_C, f0                        
-      nop.i 999   
+           ldfe         atan2_P11  = [EXP_AD_P1],16
+           fclass.m p10,p0 = atan2_Y, 0xc3     // Test for y=nan
+           nop.i 999
 }
 { .mfi
-(p0)  ldfe         atan_P9  = [atan_GR_AD_P],16                   
-(p0)  fnma.s1      atan_B   = atan_C,f8, f1                             
-      nop.i 999    ;;
+           ldfe         atan2_P21  = [EXP_AD_P2],16
+           nop.f 999
+           nop.i 999
+;;
 }
 
 
 { .mfi
-(p0)  ldfe         atan_Q21  = [atan_GR_AD_Q],16 
-(p0)  fma.s1       atan_V12  = atan_Y, atan_Y, f0                      
-      nop.i 999   
+           ldfe         atan2_P10  = [EXP_AD_P1],16
+           fnma.s1      atan2_B1Y  = atan2_u1_Y, atan2_Y, atan2_two
+           nop.i 999
 }
 { .mfi
-(p0)  ldfe         atan_P4    = [atan_GR_AD_P],16                   
-(p0)  fma.s1       atan_Xcub  = f8, atan_Y  , f0                        
-      nop.i 999   
-;;
-}
-
-
-{ .mmi
-(p7)  ldfe      atan_Q22         = [atan_GR_AD_Q],16 
-(p6)  ldfe      atan_P5          = [atan_GR_AD_P],16                   
-(p6)  cmp.eq.unc  p8,p0 = r0,r0
-;;
-}
-
-
-{ .mmi
-(p7)  ldfe      atan_Q19   = [atan_GR_AD_Q],16 
-(p6)  ldfe      atan_P6    = [atan_GR_AD_P],16                   
-(p7)  cmp.eq.unc  p9,p0 = r0,r0
-;;
-}
-
-
-{ .mmi
-(p7)  ldfe      atan_Q20  = [atan_GR_AD_Q],16 
-(p6)  ldfe      atan_P7    = [atan_GR_AD_P],16                   
-      nop.i 999   
+           ldfe         atan2_P20  = [EXP_AD_P2],16
+           fma.s1       atan2_wp_Y   = atan2_u1_Y, atan2_u1_Y, f0
+           nop.i 999
 ;;
 }
 
 { .mfi
-(p7)  ldfe      atan_Q0  = [atan_GR_AD_Q],16 
-(p6)  fma.s1       atan_V13 = atan_Y, atan_P11, atan_P10              
-      nop.i 999   
+           ldfe         atan2_P9   = [EXP_AD_P1],16
+           fma.s1       atan2_z1_X = atan2_u1_X, atan2_Y, f0
+           nop.i 999
 }
 { .mfi
-(p6)  ldfe      atan_P16    = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_V11 = atan_Y, atan_Q9, atan_Q8                
-      nop.i 999    ;;
+           ldfe         atan2_P19  = [EXP_AD_P2],16
+           fnma.s1      atan2_B1X  = atan2_u1_X, atan2_X, atan2_two
+           nop.i 999
 }
-
+;;
 
 { .mfi
-(p7)  ldfe      atan_Q1  = [atan_GR_AD_Q],16 
-(p7)  fma.s1       atan_G12 = atan_B, atan_B, f0                      
-      nop.i 999   
+           ldfe         atan2_P8   = [EXP_AD_P1],16
+           fma.s1       atan2_z2_X = atan2_u1_X, atan2_ysq, f0
+           nop.i 999
 }
-{ .mfi
-(p6)  ldfe      atan_P17    = [atan_GR_AD_P],16                   
-(p0)  fma.s1       atan_V9  = atan_V12, atan_V12, f0                  
-      nop.i 999    ;;
+{ .mfb
+           ldfe         atan2_P18  = [EXP_AD_P2],16
+(p10)      fma.d.s0 f8 = atan2_Y,atan2_X,f0   // If y=nan, result quietized y
+(p10)      br.ret.spnt b0        // Exit if y=nan
 }
+;;
 
-
+// p6 true if swap,    means |y| >  1.0    or ysq > 1.0
+// p7 true if no swap, means 1.0 >= |y|    or 1.0 >= ysq
 { .mfi
-(p7)  ldfe      atan_Q2  = [atan_GR_AD_Q],16 
-(p6)  fma.s1       atan_W11 = atan_Y, atan_P21, atan_P20              
-      nop.i 999   
+           ldfe         atan2_P7   = [EXP_AD_P1],16
+           fcmp.ge.s1 p7,p6    = f1, atan2_ysq
+           nop.i 999
 }
-{ .mfi
-(p6)  ldfe      atan_P18    = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_V7  = atan_Y, atan_Q5, atan_Q4                
-      nop.i 999    ;;
+{ .mmf
+           ldfe         atan2_P17  = [EXP_AD_P2],16
+           nop.m 999
+           nop.f 999
 }
+;;
 
 { .mfi
-(p7)  ldfe      atan_Q3  = [atan_GR_AD_Q],16 
-(p7)  fma.s1    atan_Z1  = atan_Z, atan_Z, f0                      
-      nop.i 999   
+           ldfe         atan2_P6   = [EXP_AD_P1],16
+           fma.s1       atan2_E         = atan2_u1_Y, atan2_B1Y, atan2_Y
+           nop.i 999
 }
 { .mfi
-(p6)  ldfe      atan_P19    = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_Y3  = atan_Y  , atan_V12, f0                  
-      nop.i 999    ;;
+           ldfe         atan2_P16  = [EXP_AD_P2],16
+           fma.s1       atan2_B1sq_Y = atan2_B1Y, atan2_B1Y, f0
+           nop.i 999
+;;
 }
 
 { .mfi
-(p7)  ldfe      atan_R8  = [atan_GR_AD_R],16 
-(p6)  fma.s1       atan_V11 = atan_Y, atan_P9, atan_P8                
-      nop.i 999   
+           ldfe         atan2_P5   = [EXP_AD_P1],16
+(p7)       fma.s1       atan2_wp_X   = atan2_z1_X, atan2_z1_X, f0
+           nop.i 999
 }
 { .mfi
-(p6)  ldfe      atan_P12    = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_V8  = atan_Y, atan_Q7, atan_Q6                
-      nop.i 999    ;;
-}
-
-{ .mmi
-(p7)  ldfe      atan_R9     = [atan_GR_AD_R],16 
-(p6)  ldfe      atan_P13    = [atan_GR_AD_P],16                   
-      nop.i 999   
+           ldfe         atan2_P15       = [EXP_AD_P2],16
+(p7)       fma.s1       atan2_B1sq_X = atan2_B1X, atan2_B1X, f0
+           nop.i 999
 ;;
 }
 
 { .mfi
-(p7)  ldfe      atan_R4  = [atan_GR_AD_R],16 
-(p6)  fma.s1    atan_V7  = atan_Y, atan_P5, atan_P4                 
-      nop.i 999   
+           ldfe         atan2_P4   = [EXP_AD_P1],16
+(p6)       fma.s1       atan2_z         = atan2_u1_Y, atan2_B1Y, f0
+           nop.i 999
 }
 { .mfi
-(p6)  ldfe      atan_P14    = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_W13 = atan_Y, atan_Q22, atan_Q21              
-      nop.i 999    ;;
+           ldfe         atan2_P14  = [EXP_AD_P2],16
+(p7)       fma.s1       atan2_E         = atan2_z2_X, atan2_B1X, atan2_X
+           nop.i 999
+;;
 }
 
 
 { .mfi
-(p7)  ldfe      atan_R5  = [atan_GR_AD_R],16 
-(p6)  fma.s1    atan_Y12 = atan_V9 , atan_V9 , f0                   
-      nop.i 999   
+           ldfe         atan2_P3        = [EXP_AD_P1],16
+           fcmp.eq.s0  p14,p15=atan2_X,atan2_Y  // Dummy for denorm and invalid
+           nop.i 999
 }
-{ .mfi
-(p6)  ldfe      atan_P15    = [atan_GR_AD_P],16                   
-(p7)  fma.s1    atan_Y8 = atan_V9 , atan_V9 , f0                   
-      nop.i 999    ;;
+{ .mmf
+           ldfe         atan2_P13  = [EXP_AD_P2],16
+           nop.m 999
+(p7)       fma.s1       atan2_z         = atan2_z1_X, atan2_B1X, f0
+;;
 }
 
-
 { .mfi
-(p7)  ldfe      atan_R6  = [atan_GR_AD_R],16 
-(p6)  fma.s1    atan_V8  = atan_Y, atan_P7, atan_P6                 
-      nop.i 999   
+           ldfe         atan2_P2        = [EXP_AD_P1],16
+(p6)       fma.s1       atan2_w         = atan2_wp_Y, atan2_B1sq_Y,f0
+           nop.i 999
 }
-{ .mfi
-(p6)  ldfe      atan_P0     = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_W11 = atan_Y, atan_Q20, atan_Q19              
-      nop.i 999    ;;
+{ .mlx
+           ldfe         atan2_P12  = [EXP_AD_P2],16
+           movl         rsig_near_one = 0x8000000000000001 // signif near 1.0
+;;
 }
 
-
 { .mfi
-(p7)  ldfe      atan_R7  = [atan_GR_AD_R],16 
-(p7)  fma.s1    atan_Z2  = atan_Z1 , atan_Z1,  f0                  
-      nop.i 999   
+           ldfe         atan2_P1        = [EXP_AD_P1],16
+           fclass.m p9,p0 = atan2_Y, 0x23  // test if y inf
+           nop.i 999
 }
 { .mfi
-(p6)  ldfe      atan_P1     = [atan_GR_AD_P],16                   
-(p6)  fma.s1       atan_V10 = atan_V12, atan_V13, atan_V11             
-      nop.i 999    ;;
+           ldfe         atan2_P22       = [EXP_AD_P2],16
+(p7)       fma.s1       atan2_w         = atan2_wp_X, atan2_B1sq_X,f0
+           nop.i 999
+;;
 }
 
 { .mfi
-(p7)  ldfe      atan_Q15 = [atan_GR_AD_Q],16 
-(p6)  fma.s1    atan_W7  = atan_Y, atan_P17, atan_P16               
-      nop.i 999   
+           ldfe         atan2_P0        = [EXP_AD_P1],16
+           frcpa.s1     atan2_F,p0     = f1, atan2_E
+           nop.i 999
 }
 { .mfi
-(p6)  ldfe      atan_P2     = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_V3  = atan_Y, atan_Q1 , atan_Q0               
-      nop.i 999    ;;
+           ldfe         atan2_pi_by_2   = [EXP_AD_P2],16
+(p6)       fnma.s1       atan2_gV        = atan2_Y, atan2_z, atan2_X
+           nop.i 999
+;;
 }
 
 { .mfi
-(p7)  ldfe      atan_Q16 = [atan_GR_AD_Q],16 
-(p7)  fma.s1    atan_G9  = atan_G12, atan_G12, f0                  
-      nop.i 999   
+           setf.sig      atan2_sig_near_one = rsig_near_one
+(p7)       fnma.s1       atan2_gV        = atan2_X, atan2_z, atan2_Y
+           nop.i 999
 }
-{ .mfi
-(p6)  ldfe      atan_P3     = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_V6  = atan_V12, atan_V8,  atan_V7             
-      nop.i 999    ;;
+{ .mfb
+           nop.m 999
+(p9)       fma.d.s0  f8 = atan2_sgnY, atan2_pi_by_2, f0  // +-pi/2 if y inf
+(p9)       br.ret.spnt b0      // exit if y inf, result is +-pi/2
+;;
 }
 
-
 { .mfi
-(p7)  ldfe      atan_R1     = [atan_GR_AD_R],16 
-(p6)  fma.s1       atan_W8  = atan_Y, atan_P19, atan_P18               
-      nop.i 999   
+           nop.m 999
+           fma.s1       atan2_V13       = atan2_w, atan2_P11, atan2_P10
+           nop.i 999
 }
 { .mfi
-(p6)  ldfe      atan_P22    = [atan_GR_AD_P],16                   
-(p7)  fma.s1       atan_V4  = atan_Y, atan_Q3 , atan_Q2               
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W11       = atan2_w, atan2_P21, atan2_P20
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      getf.exp     atan_GR_signexp_f8  = atan_NORM_f8
-(p7)  fma.s1       atan_Y11 = atan_Y3 , atan_Y8 , f0                  
-      nop.i 999   
+           nop.m 999
+           fma.s1       atan2_V11       = atan2_w, atan2_P9, atan2_P8
+           nop.i 999
 }
 { .mfi
-(p7)  ldfe      atan_Q17    = [atan_GR_AD_Q],16 
-(p6)  fma.s1       atan_V6  = atan_V12, atan_V8,  atan_V7             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_V12       = atan2_w, atan2_w, f0
+           nop.i 999
+;;
 }
 
-
 { .mfi
-(p7)  ldfe      atan_Q18    = [atan_GR_AD_Q],16 
-(p6)  fma.s1       atan_W3  = atan_Y, atan_P13, atan_P12               
-      nop.i 999   
+           nop.m 999
+           fma.s1       atan2_V8        = atan2_w, atan2_P7 , atan2_P6
+           nop.i 999
 }
 { .mfi
-(p7)  ldfe      atan_R10    = [atan_GR_AD_R],16 
-(p7)  fma.s1       atan_G11 = atan_B, atan_R9 , atan_R8               
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W8        = atan2_w, atan2_P19, atan2_P18
+           nop.i 999
+;;
 }
 
-
 { .mfi
-(p7)  ldfe      atan_Q10    = [atan_GR_AD_Q],16 
-(p7)  fma.s1    atan_Z3     = atan_Z1 , atan_Z2 , f0                  
-(p0)  and       atan_GR_exp_f8 = atan_GR_signexp_f8,atan_GR_exp_mask
+           nop.m 999
+           fnma.s1      atan2_alpha     = atan2_E, atan2_F, f1
+           nop.i 999
 }
 { .mfi
-(p7)  ldfe      atan_R2     = [atan_GR_AD_R],16 
-(p7)  fma.s1       atan_Z4  = atan_Z2 , atan_Z2 , f0                  
-      nop.i 999    ;;
+           nop.m 999
+           fnma.s1      atan2_alpha_1   = atan2_E, atan2_F, atan2_two
+           nop.i 999
+;;
 }
 
 
 { .mfi
-(p7)  ldfe      atan_Q11 = [atan_GR_AD_Q],16 
-(p6)  fma.s1    atan_W4  = atan_Y, atan_P15, atan_P14               
-      nop.i 999
+           nop.m 999
+           fma.s1       atan2_V7        = atan2_w, atan2_P5 , atan2_P4
+           nop.i 999
 }
 { .mfi
-(p7)  ldfe      atan_R3     = [atan_GR_AD_R],16 
-(p7)  fma.s1       atan_G7  = atan_B, atan_R5 , atan_R4               
-(p0)  cmp.le.unc   p11,p0  = atan_GR_10172,atan_GR_exp_f8 
-;;
-}
-
-
-{ .mmf
-(p9)  ldfe      atan_Q12 = [atan_GR_AD_Q],16 
-(p0)  ldfe      atan_S_PI     = [atan_GR_AD_R],16 
-(p8)  fma.s1       atan_W6  = atan_V12, atan_W8,  atan_W7             
+           nop.m 999
+           fma.s1       atan2_W7        = atan2_w, atan2_P17, atan2_P16
+           nop.i 999
 ;;
 }
 
-
-
 { .mfi
-(p9)  ldfe      atan_Q13 = [atan_GR_AD_Q],16 
-(p8)  fma.s1       atan_V3  = atan_Y, atan_P1 , atan_P0                
-(p11) cmp.ne.and p6,p7 = r0,r0
+           nop.m 999
+           fma.s1       atan2_V4        = atan2_w, atan2_P3 , atan2_P2
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p8)  fma.s1       atan_V5  = atan_V9 , atan_V10, atan_V6             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W4        = atan2_w, atan2_P15, atan2_P14
+           nop.i 999
+;;
 }
 
-
-.pred.rel "mutex",p6,p7,p11
 { .mfi
-(p7)  ldfe      atan_Q14 = [atan_GR_AD_Q],16 
-(p6)  fma.s1       atan_Y12 = atan_V9 , atan_Y12, f0                   
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_V3        = atan2_w, atan2_P1 , atan2_P0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1    atan_G8  = atan_B, atan_R7 , atan_R6               
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W3        = atan2_w, atan2_P13, atan2_P12
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p6)  fma.s1       atan_V4  = atan_Y, atan_P3 , atan_P2                
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_V10       = atan2_V12, atan2_V13, atan2_V11
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W7  = atan_Y, atan_Q16, atan_Q15              
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_gVF       = atan2_gV, atan2_F, f0
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p6)  fma.s1       atan_W10 = atan_V12, atan_P22, atan_W11            
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_alpha_sq  = atan2_alpha, atan2_alpha, f0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_G3  = atan_B, atan_R1 , f1                    
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_Cp        = atan2_alpha, atan2_alpha_1, f1
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p6)  fma.s1    atan_W2  = atan_V12, atan_W4 , atan_W3             
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_V9        = atan2_V12, atan2_V12, f0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_V2  = atan_V12, atan_V4 , atan_V3              
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W10       = atan2_V12, atan2_P22 , atan2_W11
+           nop.i 999
+;;
 }
 
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W8  = atan_Y, atan_Q18, atan_Q17              
-      nop.i 999   
+           nop.m 999
+           fma.s1       atan2_V6        = atan2_V12, atan2_V8 , atan2_V7
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_G10 = atan_G12, atan_R10, atan_G11            
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W6        = atan2_V12, atan2_W8 , atan2_W7
+           nop.i 999
+;;
 }
 
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_V10 = atan_V12, atan_Q10, atan_V11            
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_V2        = atan2_V12, atan2_V4 , atan2_V3
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_G6  = atan_G12, atan_G8 , atan_G7             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W2        = atan2_V12, atan2_W4  , atan2_W3
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p6)  fma.s1       atan_V2  = atan_V12, atan_V4,  atan_V3             
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_alpha_cub = atan2_alpha, atan2_alpha_sq, f0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_G4  = atan_B  , atan_R3 , atan_R2             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_C         = atan2_gVF, atan2_Cp, f0
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p6)  fma.s1       atan_W5  = atan_V9 , atan_W10, atan_W6             
-      nop.i 999    
-}
-{ .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W3  = atan_Y  , atan_Q12, atan_Q11            
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W12       = atan2_V9, atan2_V9, f0
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_Z5  = atan_Z3 , atan_Z4 , f0                  
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_V5        = atan2_V9, atan2_V10, atan2_V6
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W10 = atan_V12, atan_W13, atan_W11            
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W5        = atan2_V9, atan2_W10, atan2_W6
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W4  = atan_Y  , atan_Q14, atan_Q13            
-      nop.i 999    
+           nop.m 999
+           fclass.m p8,p0 = atan2_Y, 0x07  // Test for y=0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W6  = atan_V12, atan_W8,  atan_W7             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_d         = atan2_alpha_cub, atan2_C, atan2_C
+           nop.i 999
 }
+;;
 
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_V5  = atan_V9 , atan_V10, atan_V6             
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_W12       = atan2_V9, atan2_W12, f0
+           nop.i 999
 }
-{ .mfi
-      nop.m 999
-(p7)  fma.s1       atan_G5  = atan_G9 , atan_G10, atan_G6             
-      nop.i 999    ;;
-}
-
+;;
 
 { .mfi
-      nop.m 999
-(p6)  fma.s1       atan_V1  = atan_V9 , atan_V5 , atan_V2             
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_V1        = atan2_V9, atan2_V5, atan2_V2
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_G2  = atan_G12, atan_G4 , atan_G3             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_W1        = atan2_V9, atan2_W5, atan2_W2
+           nop.i 999
+;;
 }
 
-
-{ .mfi
-      nop.m 999
-(p6)  fma.s1       atan_W1  = atan_V9 , atan_W5 , atan_W2             
-      nop.i 999    
-}
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_Z6  = atan_Z4 , atan_C  , f0                  
-      nop.i 999    ;;
+           nop.m 999
+(p8)       fmerge.s     f8              = atan2_sgnY, f0  // +-0 if y=0
+           nop.i 999
 }
-
-{ .mfi
-      nop.m 999
-(p0)  fmerge.s    atan_S_PI = f8, atan_S_PI
-      nop.i 999     ;;
+{ .mfb
+           nop.m 999
+           fma.s1       atan2_zcub      = atan2_z, atan2_w, f0
+(p8)       br.ret.spnt b0      // Exit if y=0
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W5  = atan_V9 , atan_W10, atan_W6             
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_pd        = atan2_P0, atan2_d, f0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W2  = atan_V12, atan_W4 , atan_W3             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_dsq       = atan2_d, atan2_d, f0
+           nop.i 999
+;;
 }
 
 
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_G1  = atan_G9 , atan_G5 , atan_G2             
-      nop.i 999    
+           nop.m 999
+           fmerge.se    atan2_near_one = f1, atan2_sig_near_one // Const ~1.0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_V1  = atan_V9 , atan_V5 , atan_V2             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_Pp        = atan2_W12, atan2_W1, atan2_V1
+           nop.i 999
+;;
 }
 
-
 { .mfi
-      nop.m 999
-(p6)  fma.s1       atan_P   = atan_Y12, atan_W1 , atan_V1              
-      nop.i 999    
+           nop.m 999
+           fma.s1       atan2_sgn_pi_by_2 = atan2_pi_by_2, atan2_sgnY, f0
+           nop.i 999
 }
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_Z7  = atan_Z5 , atan_Z6 , f0                  
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_A_lo      = atan2_pd, atan2_dsq, atan2_d
+           nop.i 999
+;;
 }
 
 
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_W1  = atan_V9 , atan_W5 , atan_W2             
-      nop.i 999    ;;
+           nop.m 999
+           fma.s1       atan2_A_hi      = atan2_zcub, atan2_Pp, atan2_z
+           nop.i 999
+;;
 }
 
 
 { .mfi
-      nop.m 999
-(p11) fma.d.s0  f8 = atan_S_PI,f1,f0
-      nop.i 999
+           nop.m 999
+(p6)       fma.s1       atan2_A         = atan2_A_hi, f1, atan2_A_lo
+           nop.i 999
 }
+// For |Y| <= |X| and X > 0, result is A_hi + A_lo
 { .mfi
-      nop.m 999
-(p7)  fma.s1       atan_Z   = atan_G1 , atan_Z7 , f0                  
-      nop.i 999    ;;
-}
-
-
-{ .mfi
-      nop.m 999
-(p7)  fma.s1       atan_Q   = atan_Y11, atan_W1 , atan_V1             
-      nop.i 999    ;;
+           nop.m 999
+(p7)       fma.d.s0       f8         = atan2_A_hi, f1, atan2_A_lo
+           nop.i 999
+;;
 }
 
-
-{ .mfi
-      nop.m 999
-(p6)  fma.d.s0    f8       = atan_P  , atan_Xcub  , f8               
-      nop.i 999    
-}
+// For |Y| > |X|, result is  +- pi/2 - (A_hi + A_lo)
+// We perturb A by multiplying by 1.0+1ulp as we produce the result
+// in order to get symmetrically rounded results in directed rounding modes.
+// If we don't do this, there are a few cases where the trailing 11 bits of
+// the significand of the result, before converting to double, are zero.  These
+// cases do not round symmetrically in round to +infinity or round to -infinity.
 { .mfb
-      nop.m 999
-(p7)  fnma.d.s0    f8       = atan_Z  , atan_Q  , atan_S_PI           
-(p0)  br.ret.sptk    b0    ;;
+           nop.m 999
+(p6)       fnma.d.s0      f8        = atan2_A, atan2_near_one, atan2_sgn_pi_by_2
+           br.ret.sptk  b0
+;;
 }
 
-.endp atan
-ASM_SIZE_DIRECTIVE(atan)
+GLOBAL_LIBM_END(atan)
diff --git a/sysdeps/ia64/fpu/s_atanf.S b/sysdeps/ia64/fpu/s_atanf.S
index b0a68737aa..4da68c7f08 100644
--- a/sysdeps/ia64/fpu/s_atanf.S
+++ b/sysdeps/ia64/fpu/s_atanf.S
@@ -1,12 +1,10 @@
 .file "atanf.s"
 
-// THIS IS NOT OPTIMIZED AND NOT OFFICIAL
 
-// Copyright (C) 2000, 2001, Intel Corporation
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -22,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,16 +35,18 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 
 
 // History
 //==============================================================
-// ?/??/00  Initial revision 
-// 8/17/00  Changed predicate register macro-usage to direct predicate
+// 02/20/00 Initial version
+// 08/17/00 Changed predicate register macro-usage to direct predicate
 //          names due to an assembler bug.
-
-#include "libm_support.h"
+// 02/06/02 Corrected .section statement
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align;
+//          added missing bundling
 
 //
 // Assembly macros
@@ -140,16 +140,11 @@ atanf_answer       = f8
 //atanf_pred_GT1     = p7
 
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-atanf_coeff_1_table:
-ASM_TYPE_DIRECTIVE(atanf_coeff_1_table,@object)
+LOCAL_OBJECT_START(atanf_coeff_1_table)
 data8 0x40c4c241be751ff2  // r4
 data8 0x40e9f300c2f3070b  // r5
 data8 0x409babffef772075  // r3
@@ -164,12 +159,11 @@ data8 0xbfc2473c5145ee38  // p3
 data8 0x3fbc4f512b1865f5  // p4
 data8 0x3fc9997e7afbff4e  // p2
 data8 0x3ff921fb54442d18  // pi/2
-ASM_SIZE_DIRECTIVE(atanf_coeff_1_table)
+LOCAL_OBJECT_END(atanf_coeff_1_table)
 
 
 
-atanf_coeff_2_table:
-ASM_TYPE_DIRECTIVE(atanf_coeff_2_table,@object)
+LOCAL_OBJECT_START(atanf_coeff_2_table)
 data8 0x4035000000004284  // r1
 data8 0x406cdffff336a59b  // r2
 data8 0x3fbc4f512b1865f5  // p4 = q6
@@ -182,18 +176,12 @@ data8 0xbfa6e10ba401393f  // p7
 data8 0x3f97105b4160f86b  // p8
 data8 0xbf7deaadaa336451  // p9
 data8 0x3f522e5d33bc9baa  // p10
-ASM_SIZE_DIRECTIVE(atanf_coeff_2_table)
-
-
-
-.global atanf 
+LOCAL_OBJECT_END(atanf_coeff_2_table)
 
-.text
-.proc  atanf
 
-.align 32
-atanf:
 
+.section .text
+GLOBAL_LIBM_ENTRY(atanf)
 
 {     .mfi 
      alloc      r32                  = ar.pfs,1,2,0,0
@@ -325,7 +313,7 @@ atanf:
 {     .mfb 
      nop.m                 999
      fma.s1    atanf_x5  =    atanf_t,atanf_xcub,f0
-(p8)  br.cond.spnt   L(ATANF_X_INF_NAN_ZERO)
+(p8)  br.cond.spnt   ATANF_X_INF_NAN_ZERO
 } 
 ;;
  
@@ -487,7 +475,7 @@ atanf:
  
 {     .mfi 
      nop.m                           999
-     fma       atanf_sgnx_piby2    =    atanf_sgn_x,atanf_piby2,f0
+     fma.s0       atanf_sgnx_piby2    =    atanf_sgn_x,atanf_piby2,f0
      nop.i                           999
 } 
 {     .mfi 
@@ -530,27 +518,39 @@ atanf:
 {     .mfi 
                     nop.m                      999
 //(atanf_pred_GT1)    fnma.s    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
-(p7)    fnma.s    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
+(p7)    fnma.s.s0    atanf_answer   =    atanf_poly_q,atanf_z21_poly_r,atanf_sgnx_piby2
                     nop.i                      999;;
 } 
  
 {     .mfb 
                     nop.m                      999
 //(atanf_pred_LE1)    fma.s     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
-(p6)    fma.s     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
+(p6)    fma.s.s0     atanf_answer   =    atanf_x11,atanf_poly_p1,atanf_poly_p4
                     br.ret.sptk b0
 } 
 
 
 
-L(ATANF_X_INF_NAN_ZERO):
+ATANF_X_INF_NAN_ZERO:
 
-      fclass.m p8,p9 = f8,0x23	// @inf
+{ .mfi
+      nop.m 0
+      fclass.m p8,p9 = f8,0x23  // @inf
+      nop.i 0
+}
 ;;
+{ .mfi
+      nop.m 0
 (p8)  fmerge.s f8 = f8, atanf_piby2
+      nop.i 0
+}
 ;;
-      fnorm.s f8 = f8
+{ .mfb
+      nop.m 0
+      fnorm.s.s0 f8 = f8
       br.ret.sptk b0
+}
+;;
+
+GLOBAL_LIBM_END(atanf)
 
-.endp atanf
-ASM_SIZE_DIRECTIVE(atanf)
diff --git a/sysdeps/ia64/fpu/s_atanl.S b/sysdeps/ia64/fpu/s_atanl.S
index 28d44c1850..1a23611307 100644
--- a/sysdeps/ia64/fpu/s_atanl.S
+++ b/sysdeps/ia64/fpu/s_atanl.S
@@ -1,10 +1,10 @@
 .file "atanl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,41 +35,53 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 //
-// *********************************************************************
+//*********************************************************************
 //
 // History
-// 2/02/00  (hand-optimized)
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 (hand-optimized)
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 03/13/01 Fixed flags when denormal raised on intermediate result
+// 01/08/02 Improved speed.
+// 02/06/02 Corrected .section statement
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+// 03/31/05 Reformatted delimiters between data tables
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Function:   atanl(x) = inverse tangent(x), for double extended x values
-// Function:   atan2l(y,x) = atan(y/x), for double extended x values
+// Function:   atan2l(y,x) = atan(y/x), for double extended y, x values
+//
+// API
+//
+//  long double atanl  (long double x)
+//  long double atan2l (long double y, long double x)
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
 //    Floating-Point Registers: f8 (Input and Return Value)
-//                              f9-f15
-//                              f32-f79
+//                              f9 (Input for atan2l)
+//                              f10-f15, f32-f83
 //
 //    General Purpose Registers:
-//      r32-r48
-//      r49,r50,r51,r52 (Arguments to error support for 0,0 case)
+//      r32-r51
+//      r49-r52 (Arguments to error support for 0,0 case)
 //
 //    Predicate Registers:      p6-p15
 //
-// *********************************************************************
+//*********************************************************************
 //
 // IEEE Special Conditions:
 //
-//    Denormal  fault raised on denormal inputs
+//    Denormal fault raised on denormal inputs
 //    Underflow exceptions may occur 
 //    Special error handling for the y=0 and x=0 case
 //    Inexact raised when appropriate by algorithm
@@ -92,7 +104,7 @@
 //    atan2l(+/-Inf, Inf) = +/-pi/4
 //    atan2l(+/-Inf, -Inf) = +/-3pi/4
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Mathematical Description
 // ---------------------------
@@ -108,16 +120,16 @@
 //
 //
 //        (Arg_X, Arg_Y) x
-//                        \ 
-//                \ 
-//                 \ 
-//                  \ 
+//                        \
+//                \
+//                 \
+//                  \
 //                   \ angle between is ATANL(Arg_Y,Arg_X)
 
 
 
 
-//                    \ 
+//                    \
 //                     ------------------> X-axis
 
 //                   Origin
@@ -232,14 +244,14 @@
 //       z_hi = 2^k * 1.b_1 b_2 b_3 b_4 1
 //
 // then
-//                                            /                \ 
+//                                            /                \
 //                                            |  (V/U) - z_hi  |
 
 //      arctan(V/U) = arctan(z_hi) + acrtan| -------------- |
 //                                            | 1 + (V/U)*z_hi |
 //                                            \                /
 //
-//                                            /                \ 
+//                                            /                \
 //                                            |   V - z_hi*U   |
 
 //                  = arctan(z_hi) + acrtan| -------------- |
@@ -295,7 +307,7 @@
 //    U      := max( |Arg_X|, |Arg_Y| )
 //    V      := min( |Arg_X|, |Arg_Y| )
 //
-//    execute: frcap E, pred, V, U
+//    execute: frcpa E, pred, V, U
 //    If pred is 0, go to Step 5 for special cases handling.
 //
 // Step 2. Decide on branch.
@@ -399,7 +411,7 @@
 //
 //    z := V * E     ...z approximates V/U to roughly working precision
 //    zsq := z * z
-//    z8 := zsq * zsq; z8 := z8 * z8
+//    z4 := zsq * zsq; z8 := z4 * z4
 //
 //    poly1 := P_4 + zsq*(P_5 + zsq*(P_6 + zsq*(P_7 + zsq*P_8)))
 //    poly2 := zsq*(P_1 + zsq*(P_2 + zsq*P_3))
@@ -438,12 +450,11 @@
 //
 // Step 5. Special Cases
 //
-//    If pred is 0 where pred is obtained in
-//        frcap E, pred, V, U
+//    These are detected early in the function by fclass instructions.
 //
-//    we are in one of those special cases of 0,+-inf or NaN
+//    We are in one of those special cases when X or Y is 0,+-inf or NaN
 //
-//    If one of U and V is NaN, return U+V (which will generate
+//    If one of X and Y is NaN, return X+Y (which will generate
 //    invalid in case one is a signaling NaN). Otherwise,
 //    return the Result as described in the table
 //
@@ -469,8 +480,6 @@
 //
 //
 
-#include "libm_support.h"
-
 ArgY_orig   =   f8
 Result      =   f8
 FR_RESULT   =   f8
@@ -504,6 +513,7 @@ Res_hi      =   f49
 Res_lo      =   f50
 Z           =   f52
 zsq         =   f53
+z4          =   f54
 z8          =   f54
 poly1       =   f55
 poly2       =   f56
@@ -521,8 +531,8 @@ P_5         =   f67
 P_6         =   f68
 P_7         =   f69
 P_8         =   f70
-TWO_TO_NEG3 =   f71
-U_hold      =   f72
+U_hold      =   f71
+TWO_TO_NEG3 =   f72
 C_hi_hold   =   f73
 E_hold      =   f74
 M           =   f75
@@ -530,6 +540,11 @@ ArgX_abs    =   f76
 ArgY_abs    =   f77
 Result_lo   =   f78
 A_temp      =   f79
+FR_temp     =   f80
+Xsq         =   f81
+Ysq         =   f82
+tmp_small   =   f83
+
 GR_SAVE_PFS   = r33
 GR_SAVE_B0    = r34
 GR_SAVE_GP    = r35
@@ -545,1415 +560,1401 @@ exp_ArgY      = r44
 exponent_Q    = r45 
 significand_Q = r46 
 special       = r47 
-special1      = r48 
+sp_exp_Q      = r48 
+sp_exp_4sig_Q = r49 
+table_base    = r50 
+int_temp      = r51
+
 GR_Parameter_X      = r49
 GR_Parameter_Y      = r50
 GR_Parameter_RESULT = r51
 GR_Parameter_TAG    = r52
-int_temp            = r52
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-.align 64 
-
-Constants_atan:
-ASM_TYPE_DIRECTIVE(Constants_atan,@object)
-data4    0x54442D18, 0x3FF921FB, 0x248D3132, 0x3E000000
-//       double pi/2, single lo_pi/2, two**(-3)
-data4    0xAAAAAAA3, 0xAAAAAAAA, 0x0000BFFD, 0x00000000 // P_1
-data4    0xCCCC54B2, 0xCCCCCCCC, 0x00003FFC, 0x00000000 // P_2
-data4    0x47E4D0C2, 0x92492492, 0x0000BFFC, 0x00000000 // P_3
-data4    0x58870889, 0xE38E38E0, 0x00003FFB, 0x00000000 // P_4
-data4    0x290149F8, 0xBA2E895B, 0x0000BFFB, 0x00000000 // P_5
-data4    0x250F733D, 0x9D88E6D4, 0x00003FFB, 0x00000000 // P_6
-data4    0xFB8745A0, 0x884E51FF, 0x0000BFFB, 0x00000000 // P_7
-data4    0x394396BD, 0xE1C7412B, 0x00003FFA, 0x00000000 // P_8
-data4    0xAAAAA52F, 0xAAAAAAAA, 0x0000BFFD, 0x00000000 // Q_1
-data4    0xC75B60D3, 0xCCCCCCCC, 0x00003FFC, 0x00000000 // Q_2
-data4    0x011F1940, 0x924923AD, 0x0000BFFC, 0x00000000 // Q_3
-data4    0x2A5F89BD, 0xE36F716D, 0x00003FFB, 0x00000000 // Q_4
+GR_temp             = r52
+
+RODATA
+.align 16 
+
+LOCAL_OBJECT_START(Constants_atan)
+//       double pi/2
+data8 0x3FF921FB54442D18
+//       single lo_pi/2, two**(-3)
+data4 0x248D3132, 0x3E000000
+data8 0xAAAAAAAAAAAAAAA3, 0xBFFD // P_1
+data8 0xCCCCCCCCCCCC54B2, 0x3FFC // P_2
+data8 0x9249249247E4D0C2, 0xBFFC // P_3
+data8 0xE38E38E058870889, 0x3FFB // P_4
+data8 0xBA2E895B290149F8, 0xBFFB // P_5
+data8 0x9D88E6D4250F733D, 0x3FFB // P_6
+data8 0x884E51FFFB8745A0, 0xBFFB // P_7
+data8 0xE1C7412B394396BD, 0x3FFA // P_8
+data8 0xAAAAAAAAAAAAA52F, 0xBFFD // Q_1
+data8 0xCCCCCCCCC75B60D3, 0x3FFC // Q_2
+data8 0x924923AD011F1940, 0xBFFC // Q_3
+data8 0xE36F716D2A5F89BD, 0x3FFB // Q_4
 //
 //    Entries Tbl_hi  (double precision)
 //    B = 1+Index/16+1/32  Index = 0
 //    Entries Tbl_lo (single precision)
 //    B = 1+Index/16+1/32  Index = 0
 //
-data4   0xA935BD8E, 0x3FE9A000, 0x23ACA08F, 0x00000000
+data8 0x3FE9A000A935BD8E 
+data4 0x23ACA08F, 0x00000000
 //
 //    Entries Tbl_hi  (double precision) Index = 0,1,...,15
 //    B = 2^(-1)*(1+Index/16+1/32)
 //    Entries Tbl_lo (single precision)
 //    Index = 0,1,...,15  B = 2^(-1)*(1+Index/16+1/32)
 //
-data4   0x7F175A34, 0x3FDE77EB, 0x238729EE, 0x00000000
-data4   0x73C1A40B, 0x3FE0039C, 0x249334DB, 0x00000000
-data4   0x5B5B43DA, 0x3FE0C614, 0x22CBA7D1, 0x00000000
-data4   0x88BE7C13, 0x3FE1835A, 0x246310E7, 0x00000000
-data4   0xE2CC9E6A, 0x3FE23B71, 0x236210E5, 0x00000000
-data4   0x8406CBCA, 0x3FE2EE62, 0x2462EAF5, 0x00000000
-data4   0x1CD41719, 0x3FE39C39, 0x24B73EF3, 0x00000000
-data4   0x5B795B55, 0x3FE44506, 0x24C11260, 0x00000000
-data4   0x5BB6EC04, 0x3FE4E8DE, 0x242519EE, 0x00000000
-data4   0x1F732FBA, 0x3FE587D8, 0x24D4346C, 0x00000000
-data4   0x115D7B8D, 0x3FE6220D, 0x24ED487B, 0x00000000
-data4   0x920B3D98, 0x3FE6B798, 0x2495FF1E, 0x00000000
-data4   0x8FBA8E0F, 0x3FE74897, 0x223D9531, 0x00000000
-data4   0x289FA093, 0x3FE7D528, 0x242B0411, 0x00000000
-data4   0x576CC2C5, 0x3FE85D69, 0x2335B374, 0x00000000
-data4   0xA99CC05D, 0x3FE8E17A, 0x24C27CFB, 0x00000000
+data8 0x3FDE77EB7F175A34 
+data4 0x238729EE, 0x00000000
+data8 0x3FE0039C73C1A40B 
+data4 0x249334DB, 0x00000000
+data8 0x3FE0C6145B5B43DA 
+data4 0x22CBA7D1, 0x00000000
+data8 0x3FE1835A88BE7C13 
+data4 0x246310E7, 0x00000000
+data8 0x3FE23B71E2CC9E6A 
+data4 0x236210E5, 0x00000000
+data8 0x3FE2EE628406CBCA 
+data4 0x2462EAF5, 0x00000000
+data8 0x3FE39C391CD41719 
+data4 0x24B73EF3, 0x00000000
+data8 0x3FE445065B795B55 
+data4 0x24C11260, 0x00000000
+data8 0x3FE4E8DE5BB6EC04 
+data4 0x242519EE, 0x00000000
+data8 0x3FE587D81F732FBA 
+data4 0x24D4346C, 0x00000000
+data8 0x3FE6220D115D7B8D 
+data4 0x24ED487B, 0x00000000
+data8 0x3FE6B798920B3D98 
+data4 0x2495FF1E, 0x00000000
+data8 0x3FE748978FBA8E0F 
+data4 0x223D9531, 0x00000000
+data8 0x3FE7D528289FA093 
+data4 0x242B0411, 0x00000000
+data8 0x3FE85D69576CC2C5 
+data4 0x2335B374, 0x00000000
+data8 0x3FE8E17AA99CC05D 
+data4 0x24C27CFB, 0x00000000
 //
 //    Entries Tbl_hi  (double precision) Index = 0,1,...,15
 //    B = 2^(-2)*(1+Index/16+1/32)
 //    Entries Tbl_lo (single precision)
 //    Index = 0,1,...,15  B = 2^(-2)*(1+Index/16+1/32)
 //
-data4    0x510665B5, 0x3FD025FA, 0x24263482, 0x00000000
-data4    0x362431C9, 0x3FD1151A, 0x242C8DC9, 0x00000000
-data4    0x67E47C95, 0x3FD20255, 0x245CF9BA, 0x00000000
-data4    0x7A823CFE, 0x3FD2ED98, 0x235C892C, 0x00000000
-data4    0x29271134, 0x3FD3D6D1, 0x2389BE52, 0x00000000
-data4    0x586890E6, 0x3FD4BDEE, 0x24436471, 0x00000000
-data4    0x175E0F4E, 0x3FD5A2E0, 0x2389DBD4, 0x00000000
-data4    0x9F5FA6FD, 0x3FD68597, 0x2476D43F, 0x00000000
-data4    0x52817501, 0x3FD76607, 0x24711774, 0x00000000
-data4    0xB8DF95D7, 0x3FD84422, 0x23EBB501, 0x00000000
-data4    0x7CD0C662, 0x3FD91FDE, 0x23883A0C, 0x00000000
-data4    0x66168001, 0x3FD9F930, 0x240DF63F, 0x00000000
-data4    0x5422058B, 0x3FDAD00F, 0x23FE261A, 0x00000000
-data4    0x378624A5, 0x3FDBA473, 0x23A8CD0E, 0x00000000
-data4    0x0AAD71F8, 0x3FDC7655, 0x2422D1D0, 0x00000000
-data4    0xC9EC862B, 0x3FDD45AE, 0x2344A109, 0x00000000
+data8 0x3FD025FA510665B5 
+data4 0x24263482, 0x00000000
+data8 0x3FD1151A362431C9
+data4 0x242C8DC9, 0x00000000
+data8 0x3FD2025567E47C95
+data4 0x245CF9BA, 0x00000000
+data8 0x3FD2ED987A823CFE
+data4 0x235C892C, 0x00000000
+data8 0x3FD3D6D129271134
+data4 0x2389BE52, 0x00000000
+data8 0x3FD4BDEE586890E6
+data4 0x24436471, 0x00000000
+data8 0x3FD5A2E0175E0F4E
+data4 0x2389DBD4, 0x00000000
+data8 0x3FD685979F5FA6FD
+data4 0x2476D43F, 0x00000000
+data8 0x3FD7660752817501
+data4 0x24711774, 0x00000000
+data8 0x3FD84422B8DF95D7
+data4 0x23EBB501, 0x00000000
+data8 0x3FD91FDE7CD0C662
+data4 0x23883A0C, 0x00000000
+data8 0x3FD9F93066168001
+data4 0x240DF63F, 0x00000000
+data8 0x3FDAD00F5422058B
+data4 0x23FE261A, 0x00000000
+data8 0x3FDBA473378624A5
+data4 0x23A8CD0E, 0x00000000
+data8 0x3FDC76550AAD71F8
+data4 0x2422D1D0, 0x00000000
+data8 0x3FDD45AEC9EC862B
+data4 0x2344A109, 0x00000000
 //
 //    Entries Tbl_hi  (double precision) Index = 0,1,...,15
 //    B = 2^(-3)*(1+Index/16+1/32)
 //    Entries Tbl_lo (single precision)
 //    Index = 0,1,...,15  B = 2^(-3)*(1+Index/16+1/32)
 //
-data4    0x84212B3D, 0x3FC068D5, 0x239874B6, 0x00000000
-data4    0x41060850, 0x3FC16465, 0x2335E774, 0x00000000
-data4    0x171A535C, 0x3FC25F6E, 0x233E36BE, 0x00000000
-data4    0xEDEB99A3, 0x3FC359E8, 0x239680A3, 0x00000000
-data4    0xC6092A9E, 0x3FC453CE, 0x230FB29E, 0x00000000
-data4    0xBA11570A, 0x3FC54D18, 0x230C1418, 0x00000000
-data4    0xFFB3AA73, 0x3FC645BF, 0x23F0564A, 0x00000000
-data4    0xE8A7D201, 0x3FC73DBD, 0x23D4A5E1, 0x00000000
-data4    0xE398EBC7, 0x3FC8350B, 0x23D4ADDA, 0x00000000
-data4    0x7D050271, 0x3FC92BA3, 0x23BCB085, 0x00000000
-data4    0x601081A5, 0x3FCA217E, 0x23BC841D, 0x00000000
-data4    0x574D780B, 0x3FCB1696, 0x23CF4A8E, 0x00000000
-data4    0x4D768466, 0x3FCC0AE5, 0x23BECC90, 0x00000000
-data4    0x4E1D5395, 0x3FCCFE65, 0x2323DCD2, 0x00000000
-data4    0x864C9D9D, 0x3FCDF110, 0x23F53F3A, 0x00000000
-data4    0x451D980C, 0x3FCEE2E1, 0x23CCB11F, 0x00000000
-
-data4    0x54442D18, 0x400921FB, 0x33145C07, 0x3CA1A626 // PI two doubles
-data4    0x54442D18, 0x3FF921FB, 0x33145C07, 0x3C91A626 // PI_by_2 two dbles
-data4    0x54442D18, 0x3FE921FB, 0x33145C07, 0x3C81A626 // PI_by_4 two dbles
-data4    0x7F3321D2, 0x4002D97C, 0x4C9E8A0A, 0x3C9A7939 // 3PI_by_4 two dbles
-ASM_SIZE_DIRECTIVE(Constants_atan)
-
-
-.text
-.proc atanl#
-.global atanl#
-.align 64
-
-atanl: 
-{ .mfb
-	nop.m 999
-(p0)   mov ArgX_orig = f1 
-(p0)   br.cond.sptk atan2l ;;
-}
-.endp atanl
-ASM_SIZE_DIRECTIVE(atanl)
-
-.text
-.proc atan2l#
-.global atan2l#
-#ifdef _LIBC
-.proc __atan2l#
-.global __atan2l#
-.proc __ieee754_atan2l#
-.global __ieee754_atan2l#
-#endif
-.align 64 
-
-
-atan2l:
-#ifdef _LIBC
-__atan2l:
-__ieee754_atan2l:
-#endif
-{ .mfi
-alloc r32 = ar.pfs, 0, 17 , 4, 0
-(p0)  mov   ArgY = ArgY_orig
-}
-{ .mfi
-	nop.m 999
-(p0)  mov   ArgX = ArgX_orig
-	nop.i 999
-};;
+data8 0x3FC068D584212B3D
+data4 0x239874B6, 0x00000000
+data8 0x3FC1646541060850
+data4 0x2335E774, 0x00000000
+data8 0x3FC25F6E171A535C
+data4 0x233E36BE, 0x00000000
+data8 0x3FC359E8EDEB99A3
+data4 0x239680A3, 0x00000000
+data8 0x3FC453CEC6092A9E
+data4 0x230FB29E, 0x00000000
+data8 0x3FC54D18BA11570A
+data4 0x230C1418, 0x00000000
+data8 0x3FC645BFFFB3AA73
+data4 0x23F0564A, 0x00000000
+data8 0x3FC73DBDE8A7D201
+data4 0x23D4A5E1, 0x00000000
+data8 0x3FC8350BE398EBC7
+data4 0x23D4ADDA, 0x00000000
+data8 0x3FC92BA37D050271
+data4 0x23BCB085, 0x00000000
+data8 0x3FCA217E601081A5
+data4 0x23BC841D, 0x00000000
+data8 0x3FCB1696574D780B
+data4 0x23CF4A8E, 0x00000000
+data8 0x3FCC0AE54D768466
+data4 0x23BECC90, 0x00000000
+data8 0x3FCCFE654E1D5395
+data4 0x2323DCD2, 0x00000000
+data8 0x3FCDF110864C9D9D
+data4 0x23F53F3A, 0x00000000
+data8 0x3FCEE2E1451D980C
+data4 0x23CCB11F, 0x00000000
+//
+data8 0x400921FB54442D18, 0x3CA1A62633145C07 // PI two doubles
+data8 0x3FF921FB54442D18, 0x3C91A62633145C07 // PI_by_2 two dbles
+data8 0x3FE921FB54442D18, 0x3C81A62633145C07 // PI_by_4 two dbles
+data8 0x4002D97C7F3321D2, 0x3C9A79394C9E8A0A // 3PI_by_4 two dbles
+LOCAL_OBJECT_END(Constants_atan)
+
+
+.section .text
+GLOBAL_IEEE754_ENTRY(atanl)
+
+// Use common code with atan2l after setting x=1.0
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p7,p0 = ArgY_orig, 0x103
-	nop.i 999 
+      alloc r32 = ar.pfs, 0, 17, 4, 0
+      fma.s1 Ysq = ArgY_orig, ArgY_orig, f0          // Form y*y
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//
-//  Save original input args and load table ptr.
-//
-(p0)   fclass.m.unc p6,p0 = ArgX_orig, 0x103
-	nop.i 999
-};;
+      addl table_ptr1 = @ltoff(Constants_atan#), gp  // Address of table pointer
+      fma.s1 Xsq = f1, f1, f0                        // Form x*x
+      nop.i 999
+}
+;;
+
 { .mfi
-(p0)   addl      table_ptr1   = @ltoff(Constants_atan#), gp
-(p0)   fclass.m.unc p0,p9 = ArgY_orig, 0x1FF
-	nop.i 999 ;;
+      ld8 table_ptr1 = [table_ptr1]                  // Get table pointer
+      fnorm.s1 ArgY = ArgY_orig
+      nop.i 999
 }
 { .mfi
-       ld8 table_ptr1 = [table_ptr1]
-(p0)   fclass.m.unc p0,p8 = ArgX_orig, 0x1FF
-	nop.i 999
+      nop.m 999
+      fnorm.s1 ArgX = f1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p13,p0 = ArgY_orig, 0x0C3
-	nop.i 999 ;;
+      getf.exp sign_X = f1               // Get signexp of x
+      fmerge.s ArgX_abs = f0, f1         // Form |x|
+      nop.i 999
 }
 { .mfi
-(p0)   fclass.m.unc p12,p0 = ArgX_orig, 0x0C3
-	nop.i 999
+      nop.m 999
+      fnorm.s1 ArgX_orig = f1
+      nop.i 999
 }
+;;
 
+{ .mfi
+      getf.exp sign_Y = ArgY_orig        // Get signexp of y
+      fmerge.s ArgY_abs = f0, ArgY_orig  // Form |y|
+      mov table_base = table_ptr1        // Save base pointer to tables
+}
+;;
 
-//
-//     Check for NatVals.
-//     Check for everything - if false, then must be pseudo-zero
-//     or pseudo-nan (IA unsupporteds).
-//
-{ .mib
-	nop.m 999
-	nop.i 999
-(p6)   br.cond.spnt L(ATANL_NATVAL) ;;
+{ .mfi
+      ldfd P_hi = [table_ptr1],8         // Load double precision hi part of pi
+      fclass.m p8,p0 = ArgY_orig, 0x1e7  // Test y natval, nan, inf, zero
+      nop.i 999 
 }
+;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-(p7)   br.cond.spnt L(ATANL_NATVAL) ;;
+{ .mfi
+      ldfps P_lo, TWO_TO_NEG3 = [table_ptr1], 8 // Load P_lo and constant 2^-3
+      nop.f 999 
+      nop.i 999 
 }
-{ .mib
-(p0)   ldfd P_hi = [table_ptr1],8
-	nop.i 999
-(p8)   br.cond.spnt L(ATANL_UNSUPPORTED) ;;
+{ .mfi
+      nop.m 999
+      fma.s1 M = f1, f1, f0              // Set M = 1.0
+      nop.i 999 
 }
-{ .mbb
-(p0)   add table_ptr2 = 96, table_ptr1
-(p9)   br.cond.spnt L(ATANL_UNSUPPORTED)
+;;
+
 //
-//     Load double precision high-order part of pi
+//     Check for everything - if false, then must be pseudo-zero
+//     or pseudo-nan (IA unsupporteds).
 //
-(p12)  br.cond.spnt L(ATANL_NAN) ;;
-}
 { .mfb
-	nop.m 999
-(p0)   fnorm.s1 ArgX = ArgX
-(p13)  br.cond.spnt L(ATANL_NAN) ;;
-}
-//
-//     Normalize the input argument.
-//     Branch out if NaN inputs
-//
-{ .mmf
-(p0)   ldfs P_lo = [table_ptr1], 4
-	nop.m 999
-(p0)   fnorm.s1 ArgY = ArgY ;;
+      nop.m 999
+      fclass.m p0,p12 = f1, 0x1FF        // Test x unsupported
+(p8)  br.cond.spnt ATANL_Y_SPECIAL       // Branch if y natval, nan, inf, zero
 }
-{ .mmf
-	nop.m 999
-(p0)   ldfs TWO_TO_NEG3 = [table_ptr1], 180
-//
+;;
+
 //     U = max(ArgX_abs,ArgY_abs)
 //     V = min(ArgX_abs,ArgY_abs)
-//     if PR1, swap = 0
-//     if PR2, swap = 1
-//
-(p0)   mov M = f1 ;;
-}
 { .mfi
-	nop.m 999
-//
-//     Get exp and sign of ArgX
-//     Get exp and sign of ArgY
-//     Load 2**(-3) and increment ptr to Q_4.
-//
-(p0)   fmerge.s ArgX_abs = f1, ArgX
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.ge.s1 p6,p7 = Xsq, Ysq        // Test for |x| >= |y| using squares
+      nop.i 999 
 }
-//
-//     load single precision low-order part of pi = P_lo
-//
+{ .mfb
+      nop.m 999
+      fma.s1 V = ArgX_abs, f1, f0        // Set V assuming |x| < |y|
+      br.cond.sptk ATANL_COMMON          // Branch to common code
+}
+;;
+
+GLOBAL_IEEE754_END(atanl)
+
+GLOBAL_IEEE754_ENTRY(atan2l)
+
 { .mfi
-(p0)   getf.exp sign_X = ArgX
-(p0)   fmerge.s ArgY_abs = f1, ArgY
-	nop.i 999 ;;
+      alloc r32 = ar.pfs, 0, 17, 4, 0
+      fma.s1 Ysq = ArgY_orig, ArgY_orig, f0          // Form y*y
+      nop.i 999
 }
-{ .mii
-(p0)   getf.exp sign_Y = ArgY
-	nop.i 999 ;;
-(p0)   shr sign_X = sign_X, 17 ;;
+{ .mfi
+      addl table_ptr1 = @ltoff(Constants_atan#), gp  // Address of table pointer
+      fma.s1 Xsq = ArgX_orig, ArgX_orig, f0          // Form x*x
+      nop.i 999
 }
-{ .mii
-	nop.m 999
-(p0)   shr sign_Y = sign_Y, 17 ;;
-(p0)   cmp.eq.unc p8, p9 = 0x00000, sign_Y ;;
+;;
+
+{ .mfi
+      ld8 table_ptr1 = [table_ptr1]                  // Get table pointer
+      fnorm.s1 ArgY = ArgY_orig
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Is ArgX_abs >= ArgY_abs
-//     Is sign_Y == 0?
-//
-(p0)   fmax.s1 U = ArgX_abs, ArgY_abs
-	nop.i 999
+      nop.m 999
+      fnorm.s1 ArgX = ArgX_orig
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     ArgX_abs = |ArgX|
-//     ArgY_abs = |ArgY|
-//     sign_X is sign bit of ArgX
-//     sign_Y is sign bit of ArgY
-//
-(p0)   fcmp.ge.s1 p6, p7 = ArgX_abs, ArgY_abs
-	nop.i 999 ;;
+      getf.exp sign_X = ArgX_orig        // Get signexp of x
+      fmerge.s ArgX_abs = f0, ArgX_orig  // Form |x|
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fmin.s1 V = ArgX_abs, ArgY_abs
-	nop.i 999 ;;
+      getf.exp sign_Y = ArgY_orig        // Get signexp of y
+      fmerge.s ArgY_abs = f0, ArgY_orig  // Form |y|
+      mov table_base = table_ptr1        // Save base pointer to tables
 }
+;;
+
 { .mfi
-	nop.m 999
-(p8)   fadd.s1 s_Y = f0, f1
-(p6)   cmp.eq.unc p10, p11 = 0x00000, sign_X
+      ldfd P_hi = [table_ptr1],8         // Load double precision hi part of pi
+      fclass.m p8,p0 = ArgY_orig, 0x1e7  // Test y natval, nan, inf, zero
+      nop.i 999 
 }
-{ .mii
-(p6)   add swap = r0, r0
-	nop.i 999 ;;
-(p7)   add swap = 1, r0
+;;
+
+{ .mfi
+      ldfps P_lo, TWO_TO_NEG3 = [table_ptr1], 8 // Load P_lo and constant 2^-3
+      fclass.m p9,p0 = ArgX_orig, 0x1e7  // Test x natval, nan, inf, zero
+      nop.i 999 
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+      fma.s1 M = f1, f1, f0              // Set M = 1.0
+      nop.i 999 
+}
+;;
+
 //
-//     Let M = 1.0
-//     if p8, s_Y = 1.0
-//     if p9, s_Y = -1.0
+//     Check for everything - if false, then must be pseudo-zero
+//     or pseudo-nan (IA unsupporteds).
 //
-(p10)  fsub.s1 M = M, f1
-	nop.i 999 ;;
+{ .mfb
+      nop.m 999
+      fclass.m p0,p12 = ArgX_orig, 0x1FF // Test x unsupported
+(p8)  br.cond.spnt ATANL_Y_SPECIAL       // Branch if y natval, nan, inf, zero
 }
+;;
+
+//     U = max(ArgX_abs,ArgY_abs)
+//     V = min(ArgX_abs,ArgY_abs)
 { .mfi
-	nop.m 999
-(p9)   fsub.s1 s_Y = f0, f1
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.ge.s1 p6,p7 = Xsq, Ysq        // Test for |x| >= |y| using squares
+      nop.i 999 
 }
+{ .mfb
+      nop.m 999
+      fma.s1 V = ArgX_abs, f1, f0        // Set V assuming |x| < |y|
+(p9)  br.cond.spnt ATANL_X_SPECIAL       // Branch if x natval, nan, inf, zero
+}
+;;
+
+// Now common code for atanl and atan2l
+ATANL_COMMON:
 { .mfi
-	nop.m 999
-(p0)   frcpa.s1 E, p6 = V, U
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p0,p13 = ArgY_orig, 0x1FF // Test y unsupported
+      shr sign_X = sign_X, 17            // Get sign bit of x
 }
-{ .mbb
-	nop.m 999
+{ .mfi
+      nop.m 999
+      fma.s1 U = ArgY_abs, f1, f0        // Set U assuming |x| < |y|
+      adds table_ptr1 = 176, table_ptr1  // Point to Q4
+}
+;;
+
+{ .mfi
+(p6)  add swap = r0, r0                  // Set swap=0 if |x| >= |y|
+(p6)  frcpa.s1 E, p0 = ArgY_abs, ArgX_abs // Compute E if |x| >= |y|
+      shr sign_Y = sign_Y, 17            // Get sign bit of y
+}
+{ .mfb
+      nop.m 999
+(p6)  fma.s1 V = ArgY_abs, f1, f0        // Set V if |x| >= |y|
+(p12) br.cond.spnt ATANL_UNSUPPORTED     // Branch if x unsupported
+}
+;;
+
+// Set p8 if y >=0
+// Set p9 if y < 0
+// Set p10 if |x| >= |y| and x >=0
+// Set p11 if |x| >= |y| and x < 0
+{ .mfi
+      cmp.eq p8, p9 = 0, sign_Y          // Test for y >= 0
+(p7)  frcpa.s1 E, p0 = ArgX_abs, ArgY_abs // Compute E if |x| < |y|
+(p7)  add swap = 1, r0                   // Set swap=1 if |x| < |y|
+}
+{ .mfb
+(p6)  cmp.eq.unc p10, p11 = 0, sign_X    // If |x| >= |y|, test for x >= 0
+(p6)  fma.s1 U = ArgX_abs, f1, f0        // Set U if |x| >= |y|
+(p13) br.cond.spnt ATANL_UNSUPPORTED     // Branch if y unsupported
+}
+;;
+
 //
-//     E = frcpa(V,U)
+//     if p8, s_Y = 1.0
+//     if p9, s_Y = -1.0
 //
-(p6)   br.cond.sptk L(ATANL_STEP2)
-(p0)   br.cond.spnt L(ATANL_SPECIAL_HANDLING) ;;
+.pred.rel "mutex",p8,p9
+{ .mfi
+      nop.m 999
+(p8)  fadd.s1 s_Y = f0, f1               // If y >= 0 set s_Y = 1.0
+      nop.i 999
 }
-L(ATANL_STEP2): 
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 Q = E, V
-	nop.i 999
+      nop.m 999
+(p9)  fsub.s1 s_Y = f0, f1               // If y < 0 set s_Y = -1.0
+      nop.i 999
 }
+;;
+
+.pred.rel "mutex",p10,p11
 { .mfi
-	nop.m 999
-(p0)   fcmp.eq.s0     p0, p9 = f1, ArgY_orig
-	nop.i 999 ;;
+      nop.m 999
+(p10) fsub.s1 M = M, f1                  // If |x| >= |y| and x >=0, set M=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Is Q < 2**(-3)?
-//
-(p0)   fcmp.eq.s0     p0, p8 = f1, ArgX_orig
-	nop.i 999
+      nop.m 999
+(p11) fadd.s1 M = M, f1                  // If |x| >= |y| and x < 0, set M=2.0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11)  fadd.s1 M = M, f1
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.eq.s0 p0, p9 = ArgX_orig, ArgY_orig // Dummy to set denormal flag
+      nop.i 999
 }
-{ .mlx
-	nop.m 999
 // *************************************************
 // ********************* STEP2 *********************
 // *************************************************
-(p0)   movl special = 0x8400000000000000
-}
-{ .mlx
-	nop.m 999
 //
-//     lookup = b_1 b_2 b_3 B_4
+//     Q = E * V
 //
-(p0)   movl special1 = 0x0000000000000100 ;;
+{ .mfi
+      nop.m 999
+      fmpy.s1 Q = E, V
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Do fnorms to raise any denormal operand
-//     exceptions.
-//
-(p0)   fmpy.s1 P_hi = M, P_hi
-	nop.i 999
+      nop.m 999
+      fnma.s1 E_hold = E, U, f1           // E_hold = 1.0 - E*U (1) if POLY path
+      nop.i 999
 }
+;;
+
+// Create a single precision representation of the signexp of Q with the 
+// 4 most significant bits of the significand followed by a 1 and then 18 0's
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 P_lo = M, P_lo
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 P_hi = M, P_hi
+      dep.z special = 0x1, 18, 1           // Form 0x0000000000040000
 }
 { .mfi
-	nop.m 999
-//
-//     Q = E * V
-//
-(p0)   fcmp.lt.unc.s1 p6, p7 = Q, TWO_TO_NEG3
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 P_lo = M, P_lo
+      add table_ptr2 = 32, table_ptr1
 }
-{ .mmb
-(p0)   getf.sig significand_Q = Q
-(p0)   getf.exp exponent_Q =  Q
-	nop.b 999 ;;
+;;
+
+{ .mfi
+      nop.m 999
+      fma.s1 A_temp = Q, f1, f0            // Set A_temp if POLY path
+      nop.i 999
 }
-{ .mmi
-	nop.m 999 ;;
-(p0)   andcm k = 0x0003, exponent_Q
-(p0)   extr.u lookup = significand_Q, 59, 4 ;;
+{ .mfi
+      nop.m 999
+      fma.s1 E = E, E_hold, E              // E = E + E*E_hold (1) if POLY path
+      nop.i 999
 }
-{ .mib
-	nop.m 999
-(p0)   dep special = lookup, special, 59, 4
+;;
+
 //
-//     Generate 1.b_1 b_2 b_3 b_4 1 0 0 0 ... 0
+//     Is Q < 2**(-3)?
+//     swap = xor(swap,sign_X)
 //
-(p6)   br.cond.spnt L(ATANL_POLY) ;;
-}
 { .mfi
-(p0)   cmp.eq.unc p8, p9 = 0x0000, k
-(p0)   fmpy.s1 P_hi = s_Y, P_hi
+      nop.m 999
+      fcmp.lt.s1 p9, p0 = Q, TWO_TO_NEG3    // Test Q < 2^-3
+      xor swap = sign_X, swap
+}
+;;
+
+//     P_hi = s_Y * P_hi
+{ .mmf
+      getf.exp exponent_Q =  Q              // Get signexp of Q
+      cmp.eq.unc p7, p6 = 0x00000, swap
+      fmpy.s1 P_hi = s_Y, P_hi
+}
+;;
+
 //
-//     We waited a few extra cycles so P_lo and P_hi could be calculated.
-//     Load the constant 256 for loading up table entries.
+//     if (PR_1) sigma = -1.0
+//     if (PR_2) sigma =  1.0
+//
+{ .mfi
+      getf.sig significand_Q = Q            // Get significand of Q
+(p6)  fsub.s1 sigma = f0, f1
+      nop.i 999
+}
+{ .mfb
+(p9)  add table_ptr1 = 128, table_base      // Point to P8 if POLY path
+(p7)  fadd.s1 sigma = f0, f1
+(p9)  br.cond.spnt ATANL_POLY               // Branch to POLY if 0 < Q < 2^-3
+}
+;;
+
 //
 // *************************************************
 // ******************** STEP3 **********************
 // *************************************************
-(p0)   add table_ptr2 = 16, table_ptr1
-}
 //
-//     Let z_hi have exponent and sign of original Q
-//     Load the Tbl_hi(0) else, increment pointer.
+//     lookup = b_1 b_2 b_3 B_4
 //
-{ .mii
-(p0)   ldfe Q_4 = [table_ptr1], -16
-(p0)   xor swap = sign_X, swap ;;
-(p9)   sub k = k, r0, 1
-}
 { .mmi
-(p0)   setf.sig z_hi = special
-(p0)   ldfe Q_3 = [table_ptr1], -16
-(p9)   add table_ptr2 = 16, table_ptr2 ;;
+      nop.m 999
+      nop.m 999
+      andcm k = 0x0003, exponent_Q  // k=0,1,2,3 for exp_Q=0,-1,-2,-3
 }
+;;
+
 //
-//     U_hold = U - U_prime_hi
-//     k = k * 256 - Result can be 0, 256, or 512.
+//  Generate sign_exp_Q b_1 b_2 b_3 b_4 1 0 0 0 ... 0  in single precision 
+//  representation.  Note sign of Q is always 0.
 //
-{ .mmb
-(p0)   ldfe Q_2 = [table_ptr1], -16
-(p8)   ldfd Tbl_hi = [table_ptr2], 8
-	nop.b 999 ;;
+{ .mfi
+      cmp.eq p8, p9 = 0x0000, k             // Test k=0
+      nop.f 999
+      extr.u lookup = significand_Q, 59, 4  // Extract b_1 b_2 b_3 b_4 for index
 }
-//
-//     U_prime_lo =  U_hold + V * z_hi
-//     lookup -> lookup * 16 + k
-//
-{ .mmi
-(p0)   ldfe Q_1 = [table_ptr1], -16 ;;
-(p8)   ldfs Tbl_lo = [table_ptr2], 8
-//
-//     U_prime_hi = U + V * z_hi
-//     Load the Tbl_lo(0)
-//
-(p9)   pmpy2.r k = k, special1 ;;
+{ .mfi
+      sub sp_exp_Q = 0x7f, k                // Form single prec biased exp of Q
+      nop.f 999
+      sub k = k, r0, 1                      // Decrement k
 }
-{ .mii
-	nop.m 999
-	nop.i 999 
-	nop.i 999 ;;
+;;
+
+//     Form pointer to B index table
+{ .mfi
+      ldfe Q_4 = [table_ptr1], -16          // Load Q_4
+      nop.f 999
+(p9)  shl k = k, 8                          // k = 0, 256, or 512
 }
-{ .mii
-	nop.m 999
-	nop.i 999 
-	nop.i 999 ;;
+{ .mfi
+(p9)  shladd table_ptr2 = lookup, 4, table_ptr2
+      nop.f 999
+      shladd sp_exp_4sig_Q = sp_exp_Q, 4, lookup // Shift and add in 4 high bits
 }
-{ .mii
-	nop.m 999
-	nop.i 999 
-	nop.i 999 ;;
+;;
+
+{ .mmi
+(p8)  add table_ptr2 = -16, table_ptr2      // Pointer if original k was 0
+(p9)  add table_ptr2 = k, table_ptr2        // Pointer if k was 1, 2, 3
+      dep special = sp_exp_4sig_Q, special, 19, 13 // Form z_hi as single prec
 }
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-(p9)   shladd lookup = lookup, 0x0004, k ;;
+;;
+
+//     z_hi = s exp 1.b_1 b_2 b_3 b_4 1 0 0 0 ... 0
+{ .mmi
+      ldfd Tbl_hi = [table_ptr2], 8         // Load Tbl_hi from index table
+;;
+      setf.s z_hi = special                 // Form z_hi
+      nop.i 999
 }
 { .mmi
-(p9)   add table_ptr2 = table_ptr2, lookup ;;
-//
-//     V_prime =  V - U * z_hi
-//
-(p9)   ldfd Tbl_hi = [table_ptr2], 8
-	nop.i 999 ;;
+      ldfs Tbl_lo = [table_ptr2], 8         // Load Tbl_lo from index table
+;;
+      ldfe Q_3 = [table_ptr1], -16          // Load Q_3
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ldfe Q_2 = [table_ptr1], -16          // Load Q_2
+      nop.m 999
+      nop.i 999
 }
+;;
+
 { .mmf
-	nop.m 999
-//
-//     C_hi = frcpa(1,U_prime_hi)
-//
-(p9)   ldfs Tbl_lo = [table_ptr2], 8
-//
-//     z_hi = s exp 1.b_1 b_2 b_3 b_4 1 0 0 0 ... 0
-//     Point to beginning of Tbl_hi entries - k = 0.
-//
-(p0)   fmerge.se z_hi = Q, z_hi ;;
+      ldfe Q_1 = [table_ptr1], -16          // Load Q_1
+      nop.m 999
+      nop.f 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s1 U_prime_hi = V, z_hi, U
-	nop.i 999
+      nop.m 999
+      fma.s1 U_prime_hi = V, z_hi, U        // U_prime_hi = U + V * z_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 V_prime = U, z_hi, V
-	nop.i 999 ;;
+      nop.m 999
+      fnma.s1 V_prime = U, z_hi, V          // V_prime =  V - U * z_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   mov A_hi = Tbl_hi
-	nop.i 999 ;;
+      nop.m 999
+      mov A_hi = Tbl_hi                     // Start with A_hi = Tbl_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fsub.s1 U_hold = U, U_prime_hi
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 U_hold = U, U_prime_hi        // U_hold = U - U_prime_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   frcpa.s1 C_hi, p6 = f1, U_prime_hi
-	nop.i 999 ;;
+      nop.m 999
+      frcpa.s1 C_hi, p0 = f1, U_prime_hi    // C_hi = frcpa(1,U_prime_hi)
+      nop.i 999
 }
+;;
+
 { .mfi
-(p0)   cmp.eq.unc p7, p6 = 0x00000, swap
-(p0)   fmpy.s1 A_hi = s_Y, A_hi
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 A_hi = s_Y, A_hi              // A_hi = s_Y * A_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly = wsq * poly
-//
-(p7)   fadd.s1 sigma = f0, f1
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 U_prime_lo = z_hi, V, U_hold   // U_prime_lo =  U_hold + V * z_hi
+      nop.i 999
 }
+;;
+
+//     C_hi_hold = 1 - C_hi * U_prime_hi (1)
 { .mfi
-	nop.m 999
-(p0)   fma.s1 U_prime_lo = z_hi, V, U_hold
-	nop.i 999
+      nop.m 999
+      fnma.s1 C_hi_hold = C_hi, U_prime_hi, f1 
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p6)   fsub.s1 sigma = f0, f1
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 Res_hi = sigma, A_hi, P_hi   // Res_hi = P_hi + sigma * A_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 C_hi_hold = C_hi, U_prime_hi, f1
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 C_hi = C_hi_hold, C_hi, C_hi // C_hi = C_hi + C_hi * C_hi_hold (1)
+      nop.i 999
 }
+;;
+
+//     C_hi_hold = 1 - C_hi * U_prime_hi (2)
 { .mfi
-	nop.m 999
-//
-//     A_lo = A_lo + w_hi
-//     A_hi = s_Y * A_hi
-//
-(p0)   fma.s1 Res_hi = sigma, A_hi, P_hi
-	nop.i 999 ;;
+      nop.m 999
+      fnma.s1 C_hi_hold = C_hi, U_prime_hi, f1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     C_hi_hold = 1 - C_hi * U_prime_hi (1)
-//
-(p0)   fma.s1 C_hi = C_hi_hold, C_hi, C_hi
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 C_hi = C_hi_hold, C_hi, C_hi // C_hi = C_hi + C_hi * C_hi_hold (2)
+      nop.i 999
 }
+;;
+
+//     C_hi_hold = 1 - C_hi * U_prime_hi (3)
 { .mfi
-	nop.m 999
-//
-//     C_hi = C_hi + C_hi * C_hi_hold    (1)
-//
-(p0)   fnma.s1 C_hi_hold = C_hi, U_prime_hi, f1
-	nop.i 999 ;;
+      nop.m 999
+      fnma.s1 C_hi_hold = C_hi, U_prime_hi, f1 
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     C_hi_hold = 1 - C_hi * U_prime_hi (2)
-//
-(p0)   fma.s1 C_hi = C_hi_hold, C_hi, C_hi
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 C_hi = C_hi_hold, C_hi, C_hi // C_hi = C_hi + C_hi * C_hi_hold (3)
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     C_hi = C_hi + C_hi * C_hi_hold    (2)
-//
-(p0)   fnma.s1 C_hi_hold = C_hi, U_prime_hi, f1
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 w_hi = V_prime, C_hi           // w_hi = V_prime * C_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     C_hi_hold = 1 - C_hi * U_prime_hi (3)
-//
-(p0)   fma.s1 C_hi = C_hi_hold, C_hi, C_hi
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 wsq = w_hi, w_hi               // wsq = w_hi * w_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     C_hi = C_hi + C_hi * C_hi_hold    (3)
-//
-(p0)   fmpy.s1 w_hi = V_prime, C_hi
-	nop.i 999 ;;
+      nop.m 999
+      fnma.s1 w_lo = w_hi, U_prime_hi, V_prime // w_lo = V_prime-w_hi*U_prime_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     w_hi = V_prime * C_hi
-//
-(p0)   fmpy.s1 wsq = w_hi, w_hi
-	nop.i 999
+      nop.m 999
+      fma.s1 poly =  wsq, Q_4, Q_3           // poly = Q_3 + wsq * Q_4
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 w_lo = w_hi, U_prime_hi, V_prime
-	nop.i 999 ;;
+      nop.m 999
+      fnma.s1 w_lo = w_hi, U_prime_lo, w_lo  // w_lo = w_lo - w_hi * U_prime_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     wsq = w_hi * w_hi
-//     w_lo =  = V_prime - w_hi * U_prime_hi
-//
-(p0)   fma.s1 poly =  wsq, Q_4, Q_3
-	nop.i 999
+      nop.m 999
+      fma.s1 poly = wsq, poly, Q_2           // poly = Q_2 + wsq * poly
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 w_lo = w_hi, U_prime_lo, w_lo
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 w_lo = C_hi, w_lo              // w_lo =  = w_lo * C_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly = Q_3 + wsq * Q_4
-//     w_lo =  = w_lo - w_hi * U_prime_lo
-//
-(p0)   fma.s1 poly = wsq, poly, Q_2
-	nop.i 999
+      nop.m 999
+      fma.s1 poly = wsq, poly, Q_1           // poly = Q_1 + wsq * poly
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 w_lo = C_hi, w_lo
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 A_lo = Tbl_lo, w_lo            // A_lo = Tbl_lo + w_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly = Q_2 + wsq * poly
-//     w_lo =  = w_lo * C_hi
-//
-(p0)   fma.s1 poly = wsq, poly, Q_1
-	nop.i 999
+      nop.m 999
+      fmpy.s0 Q_1 =  Q_1, Q_1                // Dummy operation to raise inexact
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fadd.s1 A_lo = Tbl_lo, w_lo
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 poly = wsq, poly               // poly = wsq * poly
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Result  =  Res_hi + Res_lo * s_Y  (User Supplied Rounding Mode)
-//
-(p0)   fmpy.s0 Q_1 =  Q_1, Q_1
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 poly = w_hi, poly              // poly = w_hi * poly
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly = Q_1 + wsq * poly
-//     A_lo = Tbl_lo + w_lo
-//     swap = xor(swap,sign_X)
-//
-(p0)   fmpy.s1 poly = wsq, poly
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 A_lo = A_lo, poly              // A_lo = A_lo + poly
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Is (swap) != 0 ?
-//     poly = wsq * poly
-//     A_hi = Tbl_hi
-//
-(p0)   fmpy.s1 poly = w_hi, poly
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 A_lo = A_lo, w_hi              // A_lo = A_lo + w_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     if (PR_1) sigma = -1.0
-//     if (PR_2) sigma =  1.0
-//
-(p0)   fadd.s1 A_lo = A_lo, poly
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 Res_lo = sigma, A_lo, P_lo      // Res_lo = P_lo + sigma * A_lo
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     P_hi = s_Y * P_hi
-//     A_lo = A_lo + poly
+//     Result  =  Res_hi + Res_lo * s_Y  (User Supplied Rounding Mode)
 //
-(p0)   fadd.s1 A_lo = A_lo, w_hi
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fma.s1 Res_lo = sigma, A_lo, P_lo
-	nop.i 999 ;;
-}
 { .mfb
-	nop.m 999
-//
-//     Res_hi = P_hi + sigma * A_hi
-//     Res_lo = P_lo + sigma * A_lo
-//
-(p0)   fma.s0 Result = Res_lo, s_Y, Res_hi
-//
-//     Raise inexact.
-//
-br.ret.sptk   b0 ;;
-}
-//
-//     poly1 = P_5 + zsq * poly1
-//     poly2 = zsq * poly2
-//
-L(ATANL_POLY): 
-{ .mmf
-(p0)   xor swap = sign_X, swap
-	nop.m 999
-(p0)   fnma.s1 E_hold = E, U, f1 ;;
+      nop.m 999
+      fma.s0 Result = Res_lo, s_Y, Res_hi
+      br.ret.sptk   b0                        // Exit table path 2^-3 <= V/U < 1
 }
-{ .mfi
-	nop.m 999
-(p0)   mov A_temp = Q
+;;
+
+
+ATANL_POLY: 
+// Here if 0 < V/U < 2^-3
 //
-//     poly1 = P_4 + zsq * poly1
-//     swap = xor(swap,sign_X)
+// ***********************************************
+// ******************** STEP4 ********************
+// ***********************************************
+
 //
-//     sign_X            gr_002
-//     swap              gr_004
-//     poly1 = poly1 <== Done with poly1
-//     poly1 = P_4 + zsq * poly1
-//     swap = xor(swap,sign_X)
+//     Following:
+//     Iterate 3 times E = E + E*(1.0 - E*U)
+//     Also load P_8, P_7, P_6, P_5, P_4
 //
-(p0)   cmp.eq.unc p7, p6 = 0x00000, swap
-}
-{ .mfi
-	nop.m 999
-(p0)   fmpy.s1 P_hi = s_Y, P_hi
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p6)   fsub.s1 sigma = f0, f1
-	nop.i 999
+      ldfe P_8 = [table_ptr1], -16            // Load P_8
+      fnma.s1 z_lo = A_temp, U, V             // z_lo = V - A_temp * U
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p7)   fadd.s1 sigma = f0, f1
-	nop.i 999 ;;
-}
-
-// ***********************************************
-// ******************** STEP4 ********************
-// ***********************************************
-
-{ .mmi
       nop.m 999
-(p0)  addl           table_ptr1   = @ltoff(Constants_atan#), gp
+      fnma.s1 E_hold = E, U, f1               // E_hold = 1.0 - E*U (2)
       nop.i 999
 }
 ;;
 
 { .mmi
-      ld8 table_ptr1 = [table_ptr1]
-      nop.m 999
+      ldfe P_7 = [table_ptr1], -16            // Load P_7
+;;
+      ldfe P_6 = [table_ptr1], -16            // Load P_6
       nop.i 999
 }
 ;;
 
-
 { .mfi
-	nop.m 999
-(p0)   fma.s1 E = E, E_hold, E
-//
-//     Following:
-//     Iterate 3 times E = E + E*(1.0 - E*U)
-//     Also load P_8, P_7, P_6, P_5, P_4
-//     E_hold = 1.0 - E * U     (1)
-//     A_temp = Q
-//
-(p0)   add table_ptr1 = 128, table_ptr1 ;;
-}
-{ .mmf
-	nop.m 999
-//
-//     E = E + E_hold*E         (1)
-//     Point to P_8.
-//
-(p0)   ldfe P_8 = [table_ptr1], -16
-//
-//     poly = z8*poly1 + poly2  (Typo in writeup)
-//     Is (swap) != 0 ?
-//
-(p0)   fnma.s1 z_lo = A_temp, U, V ;;
+      ldfe P_5 = [table_ptr1], -16            // Load P_5
+      fma.s1 E = E, E_hold, E                 // E = E + E_hold*E (2)
+      nop.i 999
 }
-{ .mmb
-	nop.m 999
-//
-//     E_hold = 1.0 - E * U     (2)
-//
-(p0)   ldfe P_7 = [table_ptr1], -16
-	nop.b 999 ;;
+;;
+
+{ .mmi
+      ldfe P_4 = [table_ptr1], -16            // Load P_4
+;;
+      ldfe P_3 = [table_ptr1], -16            // Load P_3
+      nop.i 999
 }
-{ .mmb
-	nop.m 999
-//
-//     E = E + E_hold*E         (2)
-//
-(p0)   ldfe P_6 = [table_ptr1], -16
-	nop.b 999 ;;
+;;
+
+{ .mfi
+      ldfe P_2 = [table_ptr1], -16            // Load P_2
+      fnma.s1 E_hold = E, U, f1               // E_hold = 1.0 - E*U (3)
+      nop.i 999
 }
-{ .mmb
-	nop.m 999
-//
-//     E_hold = 1.0 - E * U     (3)
-//
-(p0)   ldfe P_5 = [table_ptr1], -16
-	nop.b 999 ;;
+{ .mlx
+      nop.m 999
+      movl         int_temp = 0x24005         // Signexp for small neg number
 }
+;;
+
 { .mmf
-	nop.m 999
-//
-//     E = E + E_hold*E         (3)
+      ldfe P_1 = [table_ptr1], -16            // Load P_1
+      setf.exp     tmp_small = int_temp       // Form small neg number
+      fma.s1 E = E, E_hold, E                 // E = E + E_hold*E (3)
+}
+;;
+
 //
 //
 // At this point E approximates 1/U to roughly working precision
-// z = V*E approximates V/U
+// Z = V*E approximates V/U
 //
-(p0)   ldfe P_4 = [table_ptr1], -16
-(p0)   fnma.s1 E_hold = E, U, f1 ;;
+{ .mfi
+      nop.m 999
+      fmpy.s1 Z = V, E                         // Z = V * E
+      nop.i 999
 }
-{ .mmb
-	nop.m 999
-//
-//     Z =   V * E
-//
-(p0)   ldfe P_3 = [table_ptr1], -16
-	nop.b 999 ;;
+{ .mfi
+      nop.m 999
+      fmpy.s1 z_lo = z_lo, E                   // z_lo = z_lo * E
+      nop.i 999
 }
-{ .mmb
-	nop.m 999
+;;
+
 //
-//     zsq = Z * Z
+//     Now what we want to do is
+//     poly1 = P_4 + zsq*(P_5 + zsq*(P_6 + zsq*(P_7 + zsq*P_8)))
+//     poly2 = zsq*(P_1 + zsq*(P_2 + zsq*P_3))
 //
-(p0)   ldfe P_2 = [table_ptr1], -16
-	nop.b 999 ;;
-}
-{ .mmb
-	nop.m 999
 //
-//     z8 = zsq * zsq
+//     Fixup added to force inexact later -
+//     A_hi = A_temp + z_lo
+//     z_lo = (A_temp - A_hi) + z_lo
 //
-(p0)   ldfe P_1 = [table_ptr1], -16
-	nop.b 999 ;;
-}
-{ .mlx
-	nop.m 999
-(p0)   movl         int_temp = 0x24005
-}
 { .mfi
-	nop.m 999
-(p0)   fma.s1 E = E, E_hold, E
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 zsq = Z, Z                        // zsq = Z * Z
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 E_hold = E, U, f1
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 A_hi = A_temp, z_lo               // A_hi = A_temp + z_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s1 E = E, E_hold, E
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 poly1 = zsq, P_8, P_7              // poly1 = P_7 + zsq * P_8
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 Z = V, E
-	nop.i 999
+      nop.m 999
+      fma.s1 poly2 = zsq, P_3, P_2              // poly2 = P_2 + zsq * P_3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     z_lo = V - A_temp * U
-//     if (PR_2) sigma =  1.0
-//
-(p0)   fmpy.s1 z_lo = z_lo, E
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 z4 = zsq, zsq                     // z4 = zsq * zsq
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 zsq = Z, Z
-	nop.i 999
+      nop.m 999
+      fsub.s1 A_temp = A_temp, A_hi             // A_temp = A_temp - A_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     z_lo = z_lo * E
-//     if (PR_1) sigma = -1.0
-//
-(p0)   fadd.s1 A_hi = A_temp, z_lo
-	nop.i 999 ;;
+      nop.m 999
+      fmerge.s     tmp = A_hi, A_hi             // Copy tmp = A_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     z8 = z8 * z8
-//
-//
-//     Now what we want to do is
-//     poly1 = P_4 + zsq*(P_5 + zsq*(P_6 + zsq*(P_7 + zsq*P_8)))
-//     poly2 = zsq*(P_1 + zsq*(P_2 + zsq*P_3))
-//
-(p0)   fma.s1 poly1 = zsq, P_8, P_7
-	nop.i 999
+      nop.m 999
+      fma.s1 poly1 = zsq, poly1, P_6            // poly1 = P_6 + zsq * poly1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 poly2 = zsq, P_3, P_2
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 poly2 = zsq, poly2, P_1            // poly2 = P_2 + zsq * poly2
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 z8 = zsq, zsq
-	nop.i 999
+      nop.m 999
+      fmpy.s1 z8 = z4, z4                       // z8 = z4 * z4
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fsub.s1 A_temp = A_temp, A_hi
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 z_lo = A_temp, z_lo               // z_lo = (A_temp - A_hi) + z_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     A_lo = Z * poly + z_lo
-//
-(p0)   fmerge.s     tmp = A_hi, A_hi
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 poly1 = zsq, poly1, P_5            // poly1 = P_5 + zsq * poly1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     poly1 = P_7 + zsq * P_8
-//     poly2 = P_2 + zsq * P_3
-//
-(p0)   fma.s1 poly1 = zsq, poly1, P_6
-	nop.i 999
+      nop.m 999
+      fmpy.s1 poly2 = poly2, zsq                // poly2 = zsq * poly2
+      nop.i 999
 }
+;;
+
+//     Create small GR double in case need to raise underflow
 { .mfi
-	nop.m 999
-(p0)   fma.s1 poly2 = zsq, poly2, P_1
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 poly1 = zsq, poly1, P_4            // poly1 = P_4 + zsq * poly1
+      dep GR_temp = -1,r0,0,53
 }
+;;
+
+//     Create small double in case need to raise underflow
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 z8 = z8, z8
-	nop.i 999
+      setf.d FR_temp = GR_temp	
+      fma.s1 poly = z8, poly1, poly2            // poly = poly2 + z8 * poly1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fadd.s1 z_lo = A_temp, z_lo
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 A_lo = Z, poly, z_lo               // A_lo = z_lo + Z * poly
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     poly1 = P_6 + zsq * poly1
-//     poly2 = P_2 + zsq * poly2
-//
-(p0)   fma.s1 poly1 = zsq, poly1, P_5
-	nop.i 999
+      nop.m 999
+      fadd.s1      A_hi = tmp, A_lo             // A_hi = tmp + A_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 poly2 = poly2, zsq
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1      tmp = tmp, A_hi              // tmp = tmp - A_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Result  =  Res_hi + Res_lo  (User Supplied Rounding Mode)
-//
-(p0)   fmpy.s1 P_5 = P_5, P_5
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 A_hi = s_Y, A_hi                  // A_hi = s_Y * A_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s1 poly1 = zsq, poly1, P_4
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1      A_lo = tmp, A_lo             // A_lo = tmp + A_lo
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 poly = z8, poly1, poly2
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 Res_hi = sigma, A_hi, P_hi         // Res_hi = P_hi + sigma * A_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
+      nop.m 999
+      fsub.s1 tmp =  P_hi, Res_hi               // tmp = P_hi - Res_hi
+      nop.i 999
+}
+;;
+
 //
-//     Fixup added to force inexact later -
-//     A_hi = A_temp + z_lo
-//     z_lo = (A_temp - A_hi) + z_lo
+//     Test if A_lo is zero
 //
-(p0)   fma.s1 A_lo = Z, poly, z_lo
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p0)   fadd.s1      A_hi = tmp, A_lo
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p6,p0 = A_lo, 0x007              // Test A_lo = 0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fsub.s1      tmp = tmp, A_hi
-	nop.i 999
+      nop.m 999
+(p6)  mov          A_lo = tmp_small             // If A_lo zero, make very small
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fmpy.s1 A_hi = s_Y, A_hi
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 tmp = A_hi, sigma, tmp             // tmp = sigma * A_hi  + tmp
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fadd.s1      A_lo = tmp, A_lo
-	nop.i 999
+      nop.m 999
+      fma.s1 sigma =  A_lo, sigma, P_lo         // sigma = A_lo * sigma  + P_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-(p0)   setf.exp     tmp = int_temp
+      nop.m 999
+      fma.s1 Res_lo = s_Y, sigma, tmp           // Res_lo = s_Y * sigma + tmp
+      nop.i 999
+}
+;;
+
 //
-//     P_hi = s_Y * P_hi
-//     A_hi = s_Y * A_hi
+//     Test if Res_lo is denormal
 //
-(p0)   fma.s1 Res_hi = sigma, A_hi, P_hi
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fclass.m.unc p6,p0 = A_lo, 0x007
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p6)   mov          A_lo = tmp
-	nop.i 999
+      nop.m 999
+      fclass.m p14, p15 = Res_lo, 0x0b
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     Res_hi = P_hi + sigma * A_hi
+//     Compute Result = Res_lo + Res_hi.  Use s3 if Res_lo is denormal.
 //
-(p0)   fsub.s1 tmp =  P_hi, Res_hi
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-//
-//     tmp = P_hi - Res_hi
-//
-(p0)   fma.s1 tmp = A_hi, sigma, tmp
-	nop.i 999
+      nop.m 999
+(p14) fadd.s3 Result = Res_lo, Res_hi     // Result for Res_lo denormal
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 sigma =  A_lo, sigma, P_lo
-	nop.i 999 ;;
+      nop.m 999
+(p15) fadd.s0 Result = Res_lo, Res_hi     // Result for Res_lo normal
+      nop.i 999
 }
+;;
+
+//	
+//     If Res_lo is denormal test if Result equals zero
+//	
 { .mfi
-	nop.m 999
-//
-//     tmp   = sigma * A_hi  + tmp
-//     sigma = A_lo * sigma  + P_lo
-//
-(p0)   fma.s1 Res_lo = s_Y, sigma, tmp
-	nop.i 999 ;;
+      nop.m 999
+(p14) fclass.m.unc p14, p0 = Result, 0x07
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
+;;
+
 //
-//     Res_lo = s_Y * sigma + tmp
+//     If Res_lo is denormal and Result equals zero, raise inexact, underflow
+//     by squaring small double
 //
-(p0)   fadd.s0 Result = Res_lo, Res_hi
-br.ret.sptk   b0 ;;
+{ .mfb
+      nop.m 999
+(p14) fmpy.d.s0 FR_temp = FR_temp, FR_temp
+      br.ret.sptk   b0                     // Exit POLY path, 0 < Q < 2^-3
 }
-L(ATANL_NATVAL): 
-L(ATANL_UNSUPPORTED): 
-L(ATANL_NAN): 
+;;
+
+
+ATANL_UNSUPPORTED: 
 { .mfb
-	nop.m 999
-(p0)   fmpy.s0 Result = ArgX,ArgY 
-(p0)   br.ret.sptk   b0 ;;
+      nop.m 999
+      fmpy.s0 Result = ArgX,ArgY 
+      br.ret.sptk   b0
 }
-L(ATANL_SPECIAL_HANDLING): 
+;;
+
+// Here if y natval, nan, inf, zero
+ATANL_Y_SPECIAL:
+// Here if x natval, nan, inf, zero
+ATANL_X_SPECIAL:
 { .mfi
-	nop.m 999
-(p0)   fcmp.eq.s0     p0, p6 = f1, ArgY_orig
-	nop.i 999
+      nop.m 999
+      fclass.m p13,p12 = ArgY_orig, 0x0c3  // Test y nan
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fcmp.eq.s0     p0, p5 = f1, ArgX_orig
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p15,p14 = ArgY_orig, 0x103  // Test y natval
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fclass.m.unc p6, p7 = ArgY, 0x007
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)   movl special = 992
+      nop.m 999
+(p12) fclass.m p13,p0 = ArgX_orig, 0x0c3  // Test x nan
+      nop.i 999
 }
 ;;
 
-
-{ .mmi
+{ .mfi
       nop.m 999
-(p0)  addl           table_ptr1   = @ltoff(Constants_atan#), gp
+(p14) fclass.m p15,p0 = ArgX_orig, 0x103  // Test x natval
       nop.i 999
 }
 ;;
 
-{ .mmi
-      ld8 table_ptr1 = [table_ptr1]
+{ .mfb
       nop.m 999
-      nop.i 999
+(p13) fmpy.s0 Result = ArgX_orig, ArgY_orig // Result nan if x or y nan
+(p13) br.ret.spnt b0                      // Exit if x or y nan
+}
+;;
+
+{ .mfb
+      nop.m 999
+(p15) fmpy.s0 Result = ArgX_orig, ArgY_orig // Result natval if x or y natval
+(p15) br.ret.spnt b0                      // Exit if x or y natval
 }
 ;;
 
 
-{ .mib
-(p0)   add table_ptr1 = table_ptr1, special
-	nop.i 999
-(p7)   br.cond.spnt L(ATANL_ArgY_Not_ZERO) ;;
+// Here if x or y inf or zero
+ATANL_SPECIAL_HANDLING: 
+{ .mfi
+      nop.m 999
+      fclass.m p6, p7 = ArgY_orig, 0x007        // Test y zero
+      mov special = 992                         // Offset to table
 }
+;;
+
+{ .mfb
+      add table_ptr1 = table_base, special      // Point to 3pi/4
+      fcmp.eq.s0 p0, p9 = ArgX_orig, ArgY_orig  // Dummy to set denormal flag
+(p7)  br.cond.spnt ATANL_ArgY_Not_ZERO          // Branch if y not zero
+}
+;;
+
+// Here if y zero
 { .mmf
-(p0)   ldfd  Result = [table_ptr1], 8
-	nop.m 999
-(p6)   fclass.m.unc p14, p0 = ArgX, 0x035 ;;
+      ldfd  Result = [table_ptr1], 8            // Get pi high
+      nop.m 999
+      fclass.m p14, p0 = ArgX, 0x035            // Test for x>=+0
 }
+;;
+
 { .mmf
-	nop.m 999
-(p0)   ldfd  Result_lo = [table_ptr1], -8
-(p6)   fclass.m.unc p15, p0 = ArgX, 0x036 ;;
+      nop.m 999
+      ldfd  Result_lo = [table_ptr1], -8        // Get pi lo
+      fclass.m p15, p0 = ArgX, 0x036            // Test for x<=-0
 }
+;;
+
+//
+//     Return sign_Y * 0 when  ArgX > +0
+//
 { .mfi
-	nop.m 999
-(p14)  fmerge.s Result = ArgY, f0
-	nop.i 999
+      nop.m 999
+(p14) fmerge.s Result = ArgY, f0               // If x>=+0, y=0, hi sgn(y)*0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p6)   fclass.m.unc p13, p0 = ArgX, 0x007
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p13, p0 = ArgX, 0x007           // Test for x=0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p14)  fmerge.s Result_lo = ArgY, f0
-	nop.i 999 ;;
+      nop.m 999
+(p14) fmerge.s Result_lo = ArgY, f0            // If x>=+0, y=0, lo sgn(y)*0
+      nop.i 999
 }
+;;
+
 { .mfi
-(p13)  mov GR_Parameter_TAG = 36 
-	nop.f 999
-	nop.i 999 ;;
+(p13) mov GR_Parameter_TAG = 36                // Error tag for x=0, y=0
+      nop.f 999
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//     Return sign_Y * 0 when  ArgX > +0
+//     Return sign_Y * pi when  ArgX < -0
 //
-(p15)  fmerge.s Result = ArgY, Result
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p15)  fmerge.s Result_lo = ArgY, Result_lo
-	nop.i 999 ;;
+      nop.m 999
+(p15) fmerge.s Result = ArgY, Result           // If x<0, y=0, hi=sgn(y)*pi
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
-//
-//     Return sign_Y * 0 when  ArgX < -0
-//
-(p0)   fadd.s0 Result = Result, Result_lo
-(p13)  br.cond.spnt __libm_error_region ;;
+;;
+
+{ .mfi
+      nop.m 999
+(p15) fmerge.s Result_lo = ArgY, Result_lo     // If x<0, y=0, lo=sgn(y)*pi
+      nop.i 999
 }
-{ .mib
-	nop.m 999
-	nop.i 999
+;;
+
 //
-//     Call error support funciton for atan(0,0)
+//     Call error support function for atan(0,0)
 //
-(p0)    br.ret.sptk   b0 ;;
-}
-L(ATANL_ArgY_Not_ZERO): 
-{ .mfi
-	nop.m 999
-(p0)   fclass.m.unc p9, p10 = ArgY, 0x023
-	nop.i 999 ;;
+{ .mfb
+      nop.m 999
+      fadd.s0 Result = Result, Result_lo
+(p13) br.cond.spnt __libm_error_region         // Branch if atan(0,0)
 }
+;;
+
 { .mib
-	nop.m 999
-	nop.i 999
-(p10)  br.cond.spnt  L(ATANL_ArgY_Not_INF) ;;
-}
-{ .mfi
-	nop.m 999
-(p9)   fclass.m.unc p6, p0 = ArgX, 0x017
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p9)   fclass.m.unc p7, p0 = ArgX, 0x021
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p9)   fclass.m.unc p8, p0 = ArgX, 0x022
-	nop.i 999 ;;
-}
-{ .mmi
-(p6)   add table_ptr1 =  16, table_ptr1 ;;
-(p0)   ldfd Result = [table_ptr1], 8
-	nop.i 999 ;;
-}
-{ .mfi
-(p0)   ldfd Result_lo = [table_ptr1], -8
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p6)   fmerge.s Result = ArgY, Result
-	nop.i 999 ;;
+      nop.m 999
+      nop.i 999
+      br.ret.sptk   b0                         // Exit for y=0, x not 0
 }
+;;
+
+// Here if y not zero
+ATANL_ArgY_Not_ZERO: 
 { .mfi
-	nop.m 999
-(p6)   fmerge.s Result_lo = ArgY, Result_lo
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p0, p10 = ArgY, 0x023           // Test y inf
+      nop.i 999
 }
+;;
+
 { .mfb
-	nop.m 999
-(p6)    fadd.s0 Result = Result, Result_lo
-(p6)    br.ret.sptk   b0 ;;
+      nop.m 999
+      fclass.m p6, p0 = ArgX, 0x017            // Test for 0 <= |x| < inf
+(p10) br.cond.spnt  ATANL_ArgY_Not_INF         // Branch if 0 < |y| < inf
 }
+;;
+
+// Here if y=inf
 //
-//     Load PI/2 and adjust its sign.
 //     Return +PI/2 when ArgY = +Inf and ArgX = +/-0 or normal
 //     Return -PI/2 when ArgY = -Inf and ArgX = +/-0 or normal
+//     Return +PI/4 when ArgY = +Inf and ArgX = +Inf
+//     Return -PI/4 when ArgY = -Inf and ArgX = +Inf
+//     Return +3PI/4 when ArgY = +Inf and ArgX = -Inf
+//     Return -3PI/4 when ArgY = -Inf and ArgX = -Inf
 //
-{ .mmi
-(p7)   add table_ptr1 = 32, table_ptr1 ;;
-(p7)   ldfd Result = [table_ptr1], 8
-	nop.i 999 ;;
-}
 { .mfi
-(p7)   ldfd Result_lo = [table_ptr1], -8
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p7)   fmerge.s Result = ArgY, Result
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p7, p0 = ArgX, 0x021            // Test for x=+inf
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p7)   fmerge.s Result_lo = ArgY, Result_lo
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p7)    fadd.s0 Result = Result, Result_lo
-(p7)    br.ret.sptk   b0 ;;
+(p6)  add table_ptr1 =  16, table_ptr1         // Point to pi/2, if x finite 
+      fclass.m p8, p0 = ArgX, 0x022            // Test for x=-inf
+      nop.i 999
 }
-//
-//     Load PI/4 and adjust its sign.
-//     Return +PI/4 when ArgY = +Inf and ArgX = +Inf
-//     Return -PI/4 when ArgY = -Inf and ArgX = +Inf
-//
+;;
+
 { .mmi
-(p8)   add table_ptr1 = 48, table_ptr1 ;;
-(p8)   ldfd Result = [table_ptr1], 8
-	nop.i 999 ;;
+(p7)  add table_ptr1 =  32, table_ptr1         // Point to pi/4 if x=+inf
+;;
+(p8)  add table_ptr1 =  48, table_ptr1         // Point to 3pi/4 if x=-inf
+
+      nop.i 999
 }
-{ .mfi
-(p8)   ldfd Result_lo = [table_ptr1], -8
-	nop.f 999
-	nop.i 999 ;;
+;;
+
+{ .mmi
+      ldfd Result = [table_ptr1], 8            // Load pi/2, pi/4, or 3pi/4 hi
+;;
+      ldfd Result_lo = [table_ptr1], -8        // Load pi/2, pi/4, or 3pi/4 lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p8)   fmerge.s Result = ArgY, Result
-	nop.i 999 ;;
+      nop.m 999
+      fmerge.s Result = ArgY, Result           // Merge sgn(y) in hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p8)   fmerge.s Result_lo = ArgY, Result_lo
-	nop.i 999 ;;
+      nop.m 999
+      fmerge.s Result_lo = ArgY, Result_lo     // Merge sgn(y) in lo
+      nop.i 999
 }
+;;
+
 { .mfb
-	nop.m 999
-(p8)   fadd.s0 Result = Result, Result_lo
-(p8)   br.ret.sptk   b0 ;; 
+      nop.m 999
+      fadd.s0 Result = Result, Result_lo       // Compute complete result
+      br.ret.sptk   b0                         // Exit for y=inf
 }
-L(ATANL_ArgY_Not_INF): 
-{ .mfi
-	nop.m 999
+;;
+
+// Here if y not INF, and x=0 or INF
+ATANL_ArgY_Not_INF: 
 //
-//     Load PI/4 and adjust its sign.
-//     Return +3PI/4 when ArgY = +Inf and ArgX = -Inf
-//     Return -3PI/4 when ArgY = -Inf and ArgX = -Inf
+//     Return +PI/2 when ArgY NOT Inf, ArgY > 0 and ArgX = +/-0
+//     Return -PI/2 when ArgY NOT Inf, ArgY < 0 and ArgX = +/-0
+//     Return +0    when ArgY NOT Inf, ArgY > 0 and ArgX = +Inf
+//     Return -0    when ArgY NOT Inf, ArgY > 0 and ArgX = +Inf
+//     Return +PI   when ArgY NOT Inf, ArgY > 0 and ArgX = -Inf
+//     Return -PI   when ArgY NOT Inf, ArgY > 0 and ArgX = -Inf
 //
-(p0)  fclass.m.unc p6, p0 = ArgX, 0x007
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p7, p0 = ArgX, 0x021
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc p8, p0 = ArgX, 0x022
-	nop.i 999 ;;
-}
-{ .mmi
-(p6)  add table_ptr1 = 16, table_ptr1 ;;
-(p6)  ldfd Result = [table_ptr1], 8
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p7, p9 = ArgX, 0x021            // Test for x=+inf
+      nop.i 999
 }
+;;
+
 { .mfi
-(p6)  ldfd Result_lo = [table_ptr1], -8
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m p6, p0 = ArgX, 0x007            // Test for x=0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p6)  fmerge.s Result = ArgY, Result
-	nop.i 999 ;;
+(p6)  add table_ptr1 = 16, table_ptr1          // Point to pi/2
+      fclass.m p8, p0 = ArgX, 0x022            // Test for x=-inf
+      nop.i 999
 }
+;;
+
+.pred.rel "mutex",p7,p9
 { .mfi
-	nop.m 999
-(p6)  fmerge.s Result_lo = ArgY, Result_lo
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p6)  fadd.s0 Result = Result, Result_lo
-(p6)  br.ret.spnt   b0 ;;
+(p9)  ldfd Result = [table_ptr1], 8           // Load pi or pi/2 hi
+(p7)  fmerge.s Result = ArgY, f0              // If y not inf, x=+inf, sgn(y)*0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    return = sign_Y * PI/2 when ArgX = 0
-//
-(p7)  fmerge.s Result = ArgY, f0
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p7)  fnorm.s0 Result = Result
-(p7)  br.ret.spnt   b0 ;;
-}
-//
-//    return = sign_Y * 0 when ArgX = Inf
-//
-{ .mmi
-(p8)  ldfd Result = [table_ptr1], 8 ;;
-(p8)  ldfd Result_lo = [table_ptr1], -8
-	nop.i 999 ;;
+(p9)  ldfd Result_lo = [table_ptr1], -8       // Load pi or pi/2 lo
+(p7)  fnorm.s0 Result = Result                // If y not inf, x=+inf normalize
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p8)  fmerge.s Result = ArgY, Result
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fmerge.s Result = ArgY, Result          // Merge sgn(y) in hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p8)  fmerge.s Result_lo = ArgY, Result_lo
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fmerge.s Result_lo = ArgY, Result_lo    // Merge sgn(y) in lo
+      nop.i 999
 }
+;;
+
 { .mfb
-	nop.m 999
-(p8)  fadd.s0 Result = Result, Result_lo
-(p8)  br.ret.sptk   b0 ;;
+      nop.m 999
+(p9)  fadd.s0 Result = Result, Result_lo      // Compute complete result
+      br.ret.spnt   b0                        // Exit for y not inf, x=0,inf
 }
-//
-//    return = sign_Y * PI when ArgX = -Inf
-//
-.endp atan2l
-ASM_SIZE_DIRECTIVE(atan2l)
-ASM_SIZE_DIRECTIVE(__atan2l)
-ASM_SIZE_DIRECTIVE(__ieee754_atan2l)
+;;
+
+GLOBAL_IEEE754_END(atan2l)
  
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -2001,7 +2002,6 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region) 
+LOCAL_LIBM_END(__libm_error_region#)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_cbrt.S b/sysdeps/ia64/fpu/s_cbrt.S
index 1e23b6024d..7a74ac19be 100644
--- a/sysdeps/ia64/fpu/s_cbrt.S
+++ b/sysdeps/ia64/fpu/s_cbrt.S
@@ -1,11 +1,10 @@
-.file "cbrt.asm"
+.file "cbrt.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang 
-// of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,27 +20,30 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version 
-// 5/19/00: New version (modified algorithm)
+// 02/02/00 Initial version
+// 05/19/00 New version (modified algorithm)
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Updated polynomial coefficients (changed to Remez coefficients),
+//          to slightly improve accuracy
 //
 // API
 //==============================================================
@@ -53,637 +55,713 @@
 //
 // Implementation
 //
-//   cbrt(a) = cbrt(a y) / cbrt(y)
-//          = cbrt(1 - (1 - a y)) * 1/cbrt(y)
+// Let y= frcpa(a), where a is the argument
+//
+// cbrt(a)= cbrt(a*y)/cbrt(y) = cbrt(1 - (1-a*y)) * (1/cbrt(y))
+//
+// For all values of y, the 3 possible significands of 1/cbrt(y)
+// are stored in a table (T0) to 64 bits of accuracy. (There are
+// 3 possible significands because the exponent of y modulo 3
+// can be 0, 1, or 2.)
 //
-// where y = frcpa(a). 
 //
-//  * cbrt(1 - (1 - a y)) is approximated by a degree-5 polynomial 
-//   
-//  1 - (1/3)*r - (1/9)*r^2 - (5/81)*r^3 - (10/243)*r^4 - (22/729)*r^5
-// 
-//  in r = 1 - a y.
+// * cbrt(1 - (1-a*y)) is approximated by a degree-5 polynomial ~
+//
+// ~ 1 - (1/3)*r - (1/9)*r^2 - (5/81)*r^3 - (10/243)*r^4 - (22/729)*r^5
+//
+// in r = 1-a*y.
 //
-//  * The values 1/cbrt(y) are stored in a table of constants T0
-//   to 64 bits of accuracy
 //
 // The table values are stored for three exponent values and are
 // then multiplied by e/3 where e is the exponent of the input number.
 // This computation is carried out in parallel with the polynomial
 // evaluation:
 //
-//      T = 2^(e/3) * T0
+// T= 2^(e/3) * T0
 
 
 
 
 
 //===============
-// input = x
-// C = frcpa(x)
-// r = 1 - C * x
+// input= x
+// C= frcpa(x)
+// r= 1 - C * x
 //
-// Special values 
+// Special values
 //==============================================================
 
 
 
 // Registers used
 //==============================================================
-//   f6-f15
-//   r2, r23-r26, r28-r30
-//   p6,p7,p8,p12
+// f6-f15
+// GR_GP, r23-r26, r28-r30
+// p6, p7, p8, p12
+
+       FR_R        = f6
+       FR_COEFF1   = f7
+       FR_COEFF2   = f9
+       FR_COEFF3   = f10
+       FR_COEFF4   = f11
+       FR_COEFF5   = f12
+       FR_R2       = f13
+       FR_ARG      = f14
+       FR_P23      = f15
+       FR_P25      = f32
+       FR_P15      = f33
+       FR_P1       = f34
+       FR_P45      = f35
+       FR_2EXP     = f36
+       FR_TMP63    = f37
+
+       GR_GP       = r2
+       GR_ADDR     = r2
+       GR_CONST1   = r3
+       GR_I1       = r8
+       GR_EXP      = r9
+       GR_ADDR2    = r10
+       GR_IT1      = r11
+       GR_TMP2     = r11
+       GR_EXPON    = r15
+       GR_TMP1     = r16
+       GR_TMP6     = r16
+       GR_ITB1     = r17
+       GR_TMP3     = r18
+       GR_TMP4     = r19
+       GR_TMP63    = r19
+       GR_TMP5     = r20
+       GR_EXP_BY_3 = r20
+       GR_CONST4   = r21
+       GR_TMP6     = r22
+       GR_INDEX    = r23
+       GR_EBIAS    = r24
+       GR_SIGNIF   = r25
+       GR_SIGNIF2  = r25
+       GR_TEST     = r25
+       GR_ARGEXP   = r26
+       GR_CONST2   = r27
+       GR_SIGN     = r28
+       GR_REM      = r29
+       GR_CONST3   = r30
+       GR_SEXP     = r31
+
+
+
 
-#include "libm_support.h"
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-poly_coeffs:
-ASM_TYPE_DIRECTIVE(poly_coeffs,@object)
-data8 0xaaaaaaaaaaaaaaab, 0x00003ffd  // 1/3
-data8 0x3fbc71c71c71c71d, 0x3faf9add3c0ca459
-data8 0x3fa511e8d2b3183b, 0x3f9ee7113506ac13
-ASM_SIZE_DIRECTIVE(poly_coeffs)
-
-T_table:
-ASM_TYPE_DIRECTIVE(T_table,@object)
-
-data8 0x80155c748c374836, 0xa160019ed37fb4ae
-data8 0xcb51ddcb9e93095e, 0x8040404b0879f7f9
-data8 0xa1960b5966da4608, 0xcb95f333968ad59b
-data8 0x806b5dce4b405c10, 0xa1cc5dbe6dc2aab4
-data8 0xcbda64292d3ffd97, 0x8096b586974669b1
-data8 0xa202f97995b69c0d, 0xcc1f3184af961596
-data8 0x80bcd273d952a028, 0xa232fe6eb0c0577d
-data8 0xcc5bb1ac954d33e2, 0x80e898c52813f2f3
-data8 0xa26a2582012f6e17, 0xcca12e9831fc6402
-data8 0x81149add67c2d208, 0xa2a197e5d10465cb
-data8 0xcce70a67b64f24ad, 0x813b4e2c856b6e9a
-data8 0xa2d25a532efefbc8, 0xcd24794726477ea5
-data8 0x8167c1dde03de7aa, 0xa30a5bd6e49e4ab8
-data8 0xcd6b096a0b70ee87, 0x818ed973b811135e
-data8 0xa33b9c9b59879e24, 0xcda9177738b15a90
-data8 0x81bbc0c33e13ec98, 0xa3742fca6a3c1f21
-data8 0xcdf05f2247dffab9, 0x81e33e69fbe7504a
-data8 0xa3a5f1273887bf22, 0xce2f0f347f96f906
-data8 0x820aec524e3c23e9, 0xa3d7ef508ff11574
-data8 0xce6e0be0cd551a61, 0x823880f78e70b805
-data8 0xa4115ce30548bc15, 0xceb666b2c347d1de
-data8 0x826097a62a8e5200, 0xa443df0e53df577a
-data8 0xcef609b0cb874f00, 0x8288dfe00e9b5eaf
-data8 0xa4769fa5913c0ec3, 0xcf35fb5447e5c765
-data8 0x82b15a10c5371624, 0xa4a99f303bc7def5
-data8 0xcf763c47ee869f00, 0x82da06a527b18937
-data8 0xa4dcde37779adf4b, 0xcfb6cd3888d71785
-data8 0x8302e60b635ab394, 0xa5105d46152c938a
-data8 0xcff7aed4fbfbb447, 0x832bf8b2feec2f0e
-data8 0xa5441ce89825cb8d, 0xd038e1ce5167e3c6
-data8 0x83553f0ce00e276b, 0xa5781dad3e54d899
-data8 0xd07a66d7bfa0ebba, 0x837eb98b50f8322a
-data8 0xa5ac602406c4e68c, 0xd0bc3ea6b32d1b21
-data8 0x83a270f44c84f699, 0xa5d9601d95c2c0bc
-data8 0xd0f4f0e8f36c1bf8, 0x83cc4d7cfcfac5ca
-data8 0xa60e1e1a2de14745, 0xd1376458e34b037e
-data8 0x83f65f78a8872b4c, 0xa6431f6e3fbd9658
-data8 0xd17a2ca133f78572, 0x8420a75f2f7b53c8
-data8 0xa67864b0d432fda4, 0xd1bd4a80301c5715
-data8 0x844510461ff14209, 0xa6a6444aa0243c0b
-data8 0xd1f71682b2fa4575, 0x846fbd91b930bed2
-data8 0xa6dc094d10f25792, 0xd23ad555f773f059
-data8 0x84947e18234f3294, 0xa70a574cc02bba69
-data8 0xd2752c7039a5bf73, 0x84bf92755825045a
-data8 0xa7409e2af9549084, 0xd2b98ee008c06b59
-data8 0x84e4ac0ee112ba51, 0xa76f5c64ca2cf13b
-data8 0xd2f4735ffd700280, 0x8509ef44b86f20be
-data8 0xa79e4f0babab5dc0, 0xd32f99ed6d9ac0e1
-data8 0x85359d5d91768427, 0xa7d5579ae5164b85
-data8 0xd374f0666c75d51c, 0x855b3bd5b7384357
-data8 0xa804bd3c6fe61cc8, 0xd3b0a7d13618e4a1
-data8 0x858104f0c415f79a, 0xa8345895e5250a5a
-data8 0xd3eca2ea53bcec0c, 0x85a6f90390d29864
-data8 0xa8642a122b44ef0b, 0xd428e23874f13a17
-data8 0x85d3772fcd56a1dd, 0xa89c38ca18f6108b
-data8 0xd46f82fe293bc6d3, 0x85f9c982fcc002f3
-data8 0xa8cc81063b6e87ca, 0xd4ac57e9b7186420
-data8 0x862047e0e7ea554b, 0xa8fd00bfa409285e
-data8 0xd4e972becb04e8b8, 0x8646f2a26f7f5852
-data8 0xa92db8664d5516da, 0xd526d40a7a9b43a3
-data8 0x866dca21754096b5, 0xa95ea86b75cc2c20
-data8 0xd5647c5b73917370, 0x8694ceb8dfd17a37
-data8 0xa98fd141a4992deb, 0xd5a26c4201bd6d13
-data8 0x86bc00c49e9307e8, 0xa9c1335cae7446ba
-data8 0xd5e0a45015350a7e, 0x86dccd74fce79610
-data8 0xa9ea8686f556f645, 0xd614b539c6194104
-data8 0x870453c845acf90f, 0xaa1c52d17906bb19
-data8 0xd6537310e224283f, 0x872c089a1e90342c
-data8 0xaa4e59b046dab887, 0xd6927ab62244c917
-data8 0x8753ec4a92d16c5e, 0xaa809b9c60d1890b
-data8 0xd6d1ccc1fc4ef4b7, 0x877bff3aca19f6b4
-data8 0xaab319102f3f9b33, 0xd71169cea98fdded
-data8 0x879d88b6fe1c324c, 0xaadd5a18c1e21274
-data8 0xd746a66a5bc9f6d9, 0x87c5f346dbf98c3a
-data8 0xab1045f2ac31bdf5, 0xd786ce8f0fae5317
-data8 0x87e7c653efacef2c, 0xab3ae3ab2df7231e
-data8 0xd7bc7ff214c4e75a, 0x881089d4e73ffefc
-data8 0xab6e3f945d1e96fc, 0xd7fd35467a517ed1
-data8 0x88397e6a366f2a8a, 0xaba1d953a08fa94e
-data8 0xd83e38838648d815, 0x885bc559e5e1c081
-data8 0xabcd090db7ef4c3f, 0xd874a1db598b8951
-data8 0x887e2ee392bb7a93, 0xabf864602d7c323d
-data8 0xd8ab42205b80edaf, 0x88a7a8587e404257
-data8 0xac2ca5886ccf9b57, 0xd8ed1849d202f965
-data8 0x88ca5eda67594784, 0xac5861d4aa441f0f
-data8 0xd92432bd5a173685, 0x88f4356166bd590e
-data8 0xac8d183fe3a2fbed, 0xd9669ca45b03c23e
-data8 0x89173a0acf5ce026, 0xacb93703ff51571e
-data8 0xd99e3327cf89574e, 0x893a62a098b6a57b
-data8 0xace5830ad0c3f14b, 0xd9d602b19b100466
-data8 0x895daf637236ae2c, 0xad11fca5d78b3ff2
-data8 0xda0e0ba86c096841, 0x89883b9d1c2fa9c5
-data8 0xad4797fddf91a798, 0xda5195fcdb1c3dce
-data8 0x89abd8dd374a5d7b, 0xad747701e559ebcb
-data8 0xda8a1eb87a491f6c, 0x89cf9b1dcd197fa0
-data8 0xada184a47e9c7613, 0xdac2e230b91c3f84
-data8 0x89f382a258ea79de, 0xadcec13ab0dda8ff
-data8 0xdafbe0d0b66aea30, 0x8a178faf06648f29
-data8 0xadfc2d1a5fd21ba8, 0xdb351b04a8fafced
-data8 0x8a3bc288b3e1d18a, 0xae29c89a5053c33a
-data8 0xdb6e9139e33cdd8e, 0x8a601b74f4d1f835
-data8 0xae5794122b638df9, 0xdba843ded7151ea1
-data8 0x8a849aba14274764, 0xae858fda8137ae0a
-data8 0xdbe2336319b61fc8, 0x8aa9409f16cdbc9b
-data8 0xaeb3bc4ccc56d3d1, 0xdc1c60376789fa68
-data8 0x8ace0d6bbe2cb316, 0xaee219c374c09920
-data8 0xdc56cacda82d0cd5, 0x8af301688ab33558
-data8 0xaf10a899d3235fe7, 0xdc917398f2797814
-data8 0x8b181cdebe6f3206, 0xaf3f692c341fe8b4
-data8 0xdccc5b0d90a3e628, 0x8b3d60185fafcb7c
-data8 0xaf6e5bd7db9ae6c2, 0xdd0781a10469f0f2
-data8 0x8b62cb603bb2fad0, 0xaf9d80fb081cd91b
-data8 0xdd42e7ca0b52838f, 0x8b80d7d6bc4104de
-data8 0xafc35ce063eb3787, 0xdd729ad01c69114d
-data8 0x8ba68bf73ac74f39, 0xaff2ddcb5f28f03d
-data8 0xddae749c001fbf5e, 0x8bcc68fb9f9f7335
-data8 0xb022923b148e05c5, 0xddea8f50a51c69b1
-data8 0x8bf26f31c534fca2, 0xb0527a919adbf58b
-data8 0xde26eb69a0f0f111, 0x8c10f86e13a1a1f9
-data8 0xb078f3ab1d701c65, 0xde576480262399bc
-data8 0x8c3749916cc6abb5, 0xb0a93a6870649f31
-data8 0xde943789645933c8, 0x8c5dc4c4f7706032
-data8 0xb0d9b624d62ec856, 0xded14d58139a28af
-data8 0x8c7cac3a8c42e3e0, 0xb100a5f53fb3c8e1
-data8 0xdf025c00bbf2b5c7, 0x8ca373f1b7bf2716
-data8 0xb131821882f5540a, 0xdf3feb44d723a713
-data8 0x8cc29907fb951294, 0xb158bf8e4cb04055
-data8 0xdf715bc16c159be0, 0x8ce9ae4e9492aac8
-data8 0xb189fd69d56b238f, 0xdfaf66240e29cda8
-data8 0x8d0911dddbfdad0e, 0xb1b189958e8108e4
-data8 0xdfe139cbf6e19bdc, 0x8d3075c4f20f04ee
-data8 0xb1e32a8165b09832, 0xe01fc0fe94d9fc52
-data8 0x8d5018a9d4de77d5, 0xb20b0678fc271eec
-data8 0xe051f92ffcc0bd60, 0x8d77cc47dd143515
-data8 0xb23d0bd3f7592b6e, 0xe090feec9c9a06ac
-data8 0x8d97af6352739cb7, 0xb26538b2db8420dc
-data8 0xe0c39d0c9ff862d6, 0x8db7af523167800f
-data8 0xb28d89e339ceca14, 0xe0f668eeb99f188d
-data8 0x8ddfd80bc68c32ff, 0xb2c022ca12e55a16
-data8 0xe1362890eb663139, 0x8e00197e1e7c88fe
-data8 0xb2e8c6852c6b03f1, 0xe1695c7212aecbaa
-data8 0x8e207859f77e20e7, 0xb3118f4eda9fe40f
-data8 0xe19cbf0391bbbbe9, 0x8e40f4ce60c9f8e2
-data8 0xb33a7d6268109ebe, 0xe1d050901c531e85
-data8 0x8e69ba46cf2fde4d, 0xb36ddbc5ea70ec55
-data8 0xe2110903b4f4047a, 0x8e8a7a00bd7ae63e
-data8 0xb3971e9b39264023, 0xe2450559b4d80b6d
-data8 0x8eab57ef1cf2f529, 0xb3c0877ecc18e24a
-data8 0xe27931a231554ef3, 0x8ecc5442cffb1dad
-data8 0xb3ea16ae3a6c905f, 0xe2ad8e2ac3c5b04b
-data8 0x8eed6f2d2a4acbfe, 0xb413cc67aa0e4d2d
-data8 0xe2e21b41b9694cce, 0x8f0ea8dff24441ff
-data8 0xb43da8e9d163e1af, 0xe316d93615862714
-data8 0x8f385c95d696b817, 0xb47233773b84d425
-data8 0xe3590bd86a0d30f9, 0x8f59dc43edd930f3
-data8 0xb49c6825430fe730, 0xe38e38e38e38e38e
-data8 0x8f7b7b5f5ffad1c4, 0xb4c6c46bcdb27dcf
-data8 0xe3c397d1e6db7839, 0x8f9d3a1bea165f38
-data8 0xb4f1488c0b35d26f, 0xe3f928f5953feb9e
-data8 0x8fbf18adc34b66da, 0xb51bf4c7c51f0168
-data8 0xe42eeca17c62886c, 0x8fe117499e356095
-data8 0xb546c9616087ab9c, 0xe464e32943446305
-data8 0x90033624aa685f8d, 0xb571c69bdffd9a70
-data8 0xe49b0ce15747a8a2, 0x9025757495f36b86
-data8 0xb59cecbae56984c3, 0xe4d16a1eee94e9d4
-data8 0x903f3a5dcc091203, 0xb5bd64512bb14bb7
-data8 0xe4fa52107353f67d, 0x9061b2fceb2bdbab
-data8 0xb5e8d2a4bf5ba416, 0xe5310a471f4d2dc3
-data8 0x90844ca7211032a7, 0xb6146a9a1bc47819
-data8 0xe567f6f1c2b9c224, 0x90a7079403e6a15d
-data8 0xb6402c7749d621c0, 0xe59f18689a9e4c9a
-data8 0x90c9e3fbafd63799, 0xb66c1882fb435ea2
-data8 0xe5d66f04b8a68ecf, 0x90ece216c8a16ee4
-data8 0xb6982f048c999a56, 0xe60dfb2005c192e9
-data8 0x9110021e7b516f0a, 0xb6c47044075b4142
-data8 0xe645bd1544c7ea51, 0x912a708a39be9075
-data8 0xb6e5bd6bfd02bafd, 0xe66fb21b505b20a0
-data8 0x914dcc7b31146370, 0xb7124a2736ff8ef2
-data8 0xe6a7d32af4a7c59a, 0x91714af8cfe984d5
-data8 0xb73f026a01e94177, 0xe6e02b129c6a5ae4
-data8 0x918c00a6f3795e97, 0xb760a959f1d0a7a7
-data8 0xe70a9136a7403039, 0x91afbc299ed0295d
-data8 0xb78dae7e06868ab0, 0xe74349fb2d92a589
-data8 0x91d39add3e958db0, 0xb7badff8ad9e4e02
-data8 0xe77c3a9c86ed7d42, 0x91ee9920a8974d92
-data8 0xb7dce25b8e17ae9f, 0xe7a713f88151518a
-data8 0x9212b5fcac537c19, 0xb80a6226904045e2
-data8 0xe7e067453317ed2b, 0x9236f6b256923fcf
-data8 0xb8380f1cafd73c1c, 0xe819f37a81871bb5
-data8 0x92523ee6f90dcfc3, 0xb85a6ea8e321b4d8
-data8 0xe8454236bfaeca14, 0x9276bef031e6eb79
-data8 0xb8886b684ae7d2fa, 0xe87f32f24c3fc90e
-data8 0x929236ec237a24ad, 0xb8ab0726fa00cf5d
-data8 0xe8aacd8688892ba6, 0x92b6f70b7efe9dc3
-data8 0xb8d954a4d13b7cb1, 0xe8e523fd32f606f7
-data8 0x92d29f61eec7dc2b, 0xb8fc2d4f6cd9f04a
-data8 0xe9110b5311407927, 0x92f7a05d5b8ba92f
-data8 0xb92acc851476b1ab, 0xe94bc8bf0c108fa3
-data8 0x931379a403be5c16, 0xb94de2d841a184c2
-data8 0xe977fdc439c2ca3c, 0x9338bc44de2e3f34
-data8 0xb97cd4c36c92693c, 0xe9b3236528fc349e
-data8 0x9354c71412c69486, 0xb9a0297f172665e3
-data8 0xe9dfa70b745ac1b4, 0x937a4c273907e262
-data8 0xb9cf6f21e36c3924, 0xea1b36268d0eaa38
-data8 0x93968919f6e7975d, 0xb9f3030951267208
-data8 0xea480963fd394197, 0x93bc516fdd4680c9
-data8 0xba229d6a618e7c59, 0xea84034425f27484
-data8 0x93d8c123d9be59b2, 0xba467144459f9855
-data8 0xeab12713138dd1cc, 0x93f546c955e60076
-data8 0xba6a60c3c48f1a4b, 0xeade6db73a5e503b
-data8 0x941b70a65879079f, 0xba9a76056b67ee7a
-data8 0xeb1b0268343b121b, 0x943829f337410591
-data8 0xbabea699563ada6e, 0xeb489b0b2bdb5f14
-data8 0x9454f995765bc4d2, 0xbae2f350b262cc4b
-data8 0xeb765721e85f03d0, 0x947b86b57f5842ed
-data8 0xbb1385a23be24e57, 0xebb389645f222f62
-data8 0x94988aeb23470f86, 0xbb3814975e17c680
-data8 0xebe198f090607e0c, 0x94b5a5dc9695f42a
-data8 0xbb5cc031009bf467, 0xec0fcc9321024509
-data8 0x94d2d7a9170d8b42, 0xbb81889680024764
-data8 0xec3e247da8b82f61, 0x94f9e87dd78bf019
-data8 0xbbb2c0d8703ae95d, 0xec7c27d21321c9f7
-data8 0x95175019a503d89e, 0xbbd7cd09ba3c5463
-data8 0xecaad5278824e453, 0x9534cefa625fcb3a
-data8 0xbbfcf68c4977718f, 0xecd9a76d097d4e77
-data8 0x955265405c491a25, 0xbc223d88cfc88eee
-data8 0xed089ed5dcd99446, 0x9570130c1f9bb857
-data8 0xbc47a2284fee4ff8, 0xed37bb95add09a1c
-data8 0x9597ca4119525184, 0xbc79ac0916ed7b8a
-data8 0xed76c70508f904b6, 0x95b5af6fb5aa4d3c
-data8 0xbc9f5670d1a13030, 0xeda63bb05e7f93c6
-data8 0x95d3ac9273aafd7a, 0xbcc51f068cb95c1d
-data8 0xedd5d661daed2dc4, 0x95f1c1cafdfd3684
-data8 0xbceb05f4b30a9bc0, 0xee05974eef86b903
-data8 0x960fef3b430b8d5f, 0xbd110b6604c7d306
-data8 0xee357ead791fc670, 0x962e350575b409c5
-data8 0xbd372f8598620f19, 0xee658cb3c134a463
-data8 0x964c934c0dfc1708, 0xbd5d727edb6b3c7e
-data8 0xee95c1987f080211, 0x966b0a31c9c6bc7d
-data8 0xbd83d47d937bbc6d, 0xeec61d92d8c4314f
-data8 0x968999d9ad8d264e, 0xbdaa55addf1ae47d
-data8 0xeef6a0da64a014ac, 0x96a8426705198795
-data8 0xbdd0f63c36aa73f0, 0xef274ba72a07c811
-data8 0x96c703fd64445ee5, 0xbdf7b6556d550a15
-data8 0xef581e31a2c91260, 0x96e5dec0a7b4268d
-data8 0xbe1e9626b1ffa96b, 0xef8918b2bc43aec6
-data8 0x9704d2d4f59f79f3, 0xbe4595dd903e5371
-data8 0xefba3b63d89d7cbf, 0x9723e05ebe91b9b0
-data8 0xbe6cb5a7f14bc935, 0xefeb867ecffaa607
-data8 0x97430782be323831, 0xbe93f5b41d047cf7
-data8 0xf01cfa3df1b9c9fa, 0x97624865fc0df8bf
-data8 0xbebb5630bae4c15f, 0xf04e96dc05b43e2d
-data8 0x9781a32dcc640b2a, 0xbee2d74cd30a430c
-data8 0xf0805c944d827454, 0x97a117ffd0f48e46
-data8 0xbf0a7937cf38d981, 0xf0b24ba285c495cb
-data8 0x97c0a701f9d263c9, 0xbf323c217be2bc8c
-data8 0xf0e46442e76f6569, 0x97e0505a8637a036
-data8 0xbf5a203a09342bbb, 0xf116a6b2291d7896
-data8 0x97f57a9fb0b08c6e, 0xbf74cad1c14ebfc4
-data8 0xf1383fa9e9b5b381, 0x9815503365914a9d
-data8 0xbf9ce6a497a89f78, 0xf16ac84f90083b9b
-data8 0x98354085054fd204, 0xbfc52428bec6e72f
-data8 0xf19d7b686dcb03d7, 0x98554bbbf8a77902
-data8 0xbfed838fddab024b, 0xf1d0593311db1757
-data8 0x987571fffb7f94f6, 0xc016050c0420981a
-data8 0xf20361ee8f1c711e, 0x9895b3791dd03c23
-data8 0xc03ea8cfabddc330, 0xf23695da7de51d3f
-data8 0x98ab43a5fc65d0c8, 0xc059d3cbd65ddbce
-data8 0xf258d095e465cc35, 0x98cbb2d196bd713d
-data8 0xc082b122a3c78c9d, 0xf28c4d0bfc982b34
-data8 0x98ec3d9ec7b6f21a, 0xc0abb1499ae736c4
-data8 0xf2bff55eb3f0ea71, 0x990ce436db5e8344
-data8 0xc0d4d474c3aedaaf, 0xf2f3c9cf9884636e
-data8 0x9922b8218160967a, 0xc0f054ca33eb3437
-data8 0xf31670135ab9cc0f, 0x99438d686f75779d
-data8 0xc119b2c67e600ed0, 0xf34a8e9f0b54cdfb
-data8 0x99647eea131fa20b, 0xc1433453de2033ff
-data8 0xf37ed9fa6b8add3f, 0x997a85045a47c6d0
-data8 0xc15ef3e44e10032d, 0xf3a1cfe884ef6bb6
-data8 0x999ba5f14f8add02, 0xc188b130431d80e6
-data8 0xf3d66689dcc8e8d3, 0x99bce38b5465ecae
-data8 0xc1b2929d6067730e, 0xf40b2ab069d5c96a
-data8 0x99d31ca0887f30f9, 0xc1ce9268f31cc734
-data8 0xf42e718b90c8bc16, 0x99f48a669c74c09e
-data8 0xc1f8b0877c1b0c08, 0xf463822a0a3b4b00
-data8 0x9a16154eb445c873, 0xc222f35a87b415ba
-data8 0xf498c1076015faf8, 0x9a2c822ec198d667
-data8 0xc23f3467349e5c88, 0xf4bc5a19a33990b5
-data8 0x9a4e3e080cd91b78, 0xc269b4e40e088c01
-data8 0xf4f1e6a7d6f5425f, 0x9a70177afe52322e
-data8 0xc2945aac24daaf6e, 0xf527a232cf6be334
-data8 0x9a86b8fa94eebe10, 0xc2b0de05e43c1d66
-data8 0xf54b8ecdcda90851, 0x9aa8c42866ae2958
-data8 0xc2dbc275e1229d09, 0xf5819949c7ad87b4
-data8 0x9abf86f9e12fc45e, 0xc2f86fca9d80eeff
-data8 0xf5a5bac9213b48a9, 0x9ae1c462fc05f49d
-data8 0xc323938449a2587e, 0xf5dc1501f324a812
-data8 0x9af8a8dc936b84d0, 0xc3406b40a538ed20
-data8 0xf6006bee86b5589e, 0x9b1b19033be35730
-data8 0xc36bcee8211d15e0, 0xf63716b2fa067fa4
-data8 0x9b3da7daf04c2892, 0xc397593adf2ba366
-data8 0xf66df22fb6132b9c, 0x9b54c2e4c8a9012b
-data8 0xc3b475b6206155d5, 0xf6929fb98225deb1
-data8 0x9b77854e6c661200, 0xc3e0410243b97383
-data8 0xf6c9cd13021e3fea, 0x9b8ec2e678d56d2f
-data8 0xc3fd890709833d37, 0xf6eeb177472cedae
-data8 0x9ba60e6a5ca133b6, 0xc41ae295f7e7fa06
-data8 0xf713abf4cb0b3afb, 0x9bc919ea66a151a4
-data8 0xc44709f7bb8a4dd2, 0xf74b4d5333684ef1
-data8 0x9be0887c09ef82bb, 0xc4648fb0e0bec4c1
-data8 0xf7707f75a72f8e94, 0x9c03c8d5fffc3503
-data8 0xc490f9a94695ba14, 0xf7a874b97927af44
-data8 0x9c1b5ad21a81cbb9, 0xc4aeac0173b7d390
-data8 0xf7cddf140aedf1d8, 0x9c3ed09216e9ca02
-data8 0xc4db5941007aa853, 0xf806291bacb7f7a9
-data8 0x9c568656c0423def, 0xc4f938aec206291a
-data8 0xf82bcc43b92eafef, 0x9c7a320af242ce60
-data8 0xc52629e899dfd622, 0xf8646bf0defb759e
-data8 0x9c920bf7a8c01dc2, 0xc54436e44043b965
-data8 0xf88a487dfc3ff5f7, 0x9ca9f475d98b159c
-data8 0xc562563abf9ea07f, 0xf8b03c2b46cdc17f
-data8 0x9ccdeca60e80b5f8, 0xc58fa7d1dc42921c
-data8 0xf8e95541c152ae7a, 0x9ce5f9d4653d4902
-data8 0xc5adf561b91e110a, 0xf90f832c2700c160
-data8 0x9cfe15cb38bfdd8e, 0xc5cc5591bdbd82fa
-data8 0xf935c88e0c7f419b, 0x9d225b983f6c1f96
-data8 0xc5fa08f1ff20593c, 0xf96f5cd84fd86873
-data8 0x9d3a9cca32261ed7, 0xc618980a79ce6862
-data8 0xf995dd53ebdd9d6d, 0x9d52ecfccebe1768
-data8 0xc6373a09e34b50fa, 0xf9bc75a034436a41
-data8 0x9d77818d95b82f86, 0xc66550a6e0baaf35
-data8 0xf9f686f26d5518de, 0x9d8ff7893fa4706c
-data8 0xc6842241926342c9, 0xfa1d5b39b910a8c5
-data8 0x9da87cbef36f2a5e, 0xc6a3070b7c93bb9e
-data8 0xfa4447acc4ecbfd2, 0x9dcd6140b4a35aeb
-data8 0xc6d18260bb84081b, 0xfa7ed7e51e6fdfb4
-data8 0x9de60cd06dc6e2d4, 0xc6f0977c9416828b
-data8 0xfaa601394d49a1a0, 0x9dfec7d4cc43b76f
-data8 0xc70fc0117c641630, 0xfacd431644ce0e40
-data8 0x9e17925ec9fccc4a, 0xc72efc34d7e615be
-data8 0xfaf49d96f7a75909, 0x9e3cdf6db57dc075
-data8 0xc75dfb441594141e, 0xfb2fd3c65e562fd5
-data8 0x9e55d110b63637a8, 0xc77d68aa019bda4c
-data8 0xfb576c5762024805, 0x9e6ed27594550d2e
-data8 0xc79ce9ea478dbc4f, 0xfb7f1debc22c4040
-data8 0x9e87e3adc385d393, 0xc7bc7f1ae453219d
-data8 0xfba6e89f32d0190a, 0x9ead9b54b37a1055
-data8 0xc7ec0476e15e141a, 0xfbe2c803a0894893
-data8 0x9ec6d46a3d7de215, 0xc80bcbe16f1d540f
-data8 0xfc0ad1ff0ed9ecf0, 0x9ee01d9108be3154
-data8 0xc82ba78a5d349735, 0xfc32f57bdfbcbe7f
-data8 0x9ef976db07288d04, 0xc84b978847a06b87
-data8 0xfc5b32968f99b21c, 0x9f12e05a4759ec25
-data8 0xc86b9bf1ee817bc6, 0xfc83896bc861ab08
-data8 0x9f2c5a20f4da6668, 0xc88bb4de3667cdf4
-data8 0xfcabfa1861ed4815, 0x9f52af78ed1733ca
-data8 0xc8bc00e7fe9e23a3, 0xfce8d3cea7d3163e
-data8 0x9f6c52426a39d003, 0xc8dc4d7ff2d25232
-data8 0xfd118595143ee273, 0x9f860593d42fd7f3
-data8 0xc8fcaeebcb40eb47, 0xfd3a519943d4865a
-data8 0x9f9fc97fdb96bd51, 0xc91d25431426a663
-data8 0xfd6337f8e1ae5a4b, 0x9fb99e194f4a7037
-data8 0xc93db09d7fdb2949, 0xfd8c38d1c8e927eb
-data8 0x9fd383731ca51db9, 0xc95e5112e721582a
-data8 0xfdb5544205095a53, 0x9fed79a04fbf9423
-data8 0xc97f06bb49787677, 0xfdde8a67d2613531
-data8 0xa00780b413b24ee8, 0xc99fd1aecd6e1b06
-data8 0xfe07db619e781611, 0xa02eab2c4474b0cd
-data8 0xc9d12a3e27bb1625, 0xfe460768d80bf758
-data8 0xa048dcd51ccfd142, 0xc9f22ad82ba3d5f0
-data8 0xfe6f9bfb06cd32f6, 0xa0631fa894b11b8d
-data8 0xca134113105e67b2, 0xfe994bcd3d14fcc2
-data8 0xa07d73ba65e680af, 0xca346d07b045a876
-data8 0xfec316fecaf3f2ab, 0xa097d91e6aaf71b0
-data8 0xca55aecf0e94bb88, 0xfeecfdaf33fadb80
-data8 0xa0b24fe89e02602f, 0xca77068257be9bab
-data8 0xff16fffe2fa8fad6, 0xa0ccd82d1bd2f68b
-data8 0xca98743ae1c693a8, 0xff411e0ba9db886d
-data8 0xa0e77200215909e6, 0xcab9f8122c99a101
-data8 0xff6b57f7c33e4e9a, 0xa1021d760d584855
-data8 0xcadb9221e268c3b5, 0xff95ade2d1bd7358
-data8 0xa11cdaa36068a57d, 0xcafd4283d8043dfd
-data8 0xffc01fed60f86fb5, 0xa137a99cbd3f880b
-data8 0xcb1f09520d37c6fb, 0xffeaae3832b63956
-ASM_SIZE_DIRECTIVE(T_table)
-
-
-
-
-
-
-.align 32
-.global cbrt#
+LOCAL_OBJECT_START(poly_coeffs)
+
+       data8 0xaaaaaaaaaaaaaab4, 0x0000bffd // ~ 1/3
+       data8 0xbfbc71c71c718e45, 0xbfaf9add3c0bbb43
+       data8 0xbfa511edb93dc98d, 0xbf9ee71c45f0dfbc
+LOCAL_OBJECT_END(poly_coeffs)
+
+
+//   For every entry B in the frcpa table, this table contains
+// the significands of cbrt(1/B), cbrt(2/B), cbrt(4/B).
+// The index to this table is the same as the frcpa index.
+
+LOCAL_OBJECT_START(T_table)
+
+
+       data8 0x80155c748c374836, 0xa160019ed37fb4ae
+       data8 0xcb51ddcb9e93095e, 0x8040404b0879f7f9
+       data8 0xa1960b5966da4608, 0xcb95f333968ad59b
+       data8 0x806b5dce4b405c10, 0xa1cc5dbe6dc2aab4
+       data8 0xcbda64292d3ffd97, 0x8096b586974669b1
+       data8 0xa202f97995b69c0d, 0xcc1f3184af961596
+       data8 0x80bcd273d952a028, 0xa232fe6eb0c0577d
+       data8 0xcc5bb1ac954d33e2, 0x80e898c52813f2f3
+       data8 0xa26a2582012f6e17, 0xcca12e9831fc6402
+       data8 0x81149add67c2d208, 0xa2a197e5d10465cb
+       data8 0xcce70a67b64f24ad, 0x813b4e2c856b6e9a
+       data8 0xa2d25a532efefbc8, 0xcd24794726477ea5
+       data8 0x8167c1dde03de7aa, 0xa30a5bd6e49e4ab8
+       data8 0xcd6b096a0b70ee87, 0x818ed973b811135e
+       data8 0xa33b9c9b59879e24, 0xcda9177738b15a90
+       data8 0x81bbc0c33e13ec98, 0xa3742fca6a3c1f21
+       data8 0xcdf05f2247dffab9, 0x81e33e69fbe7504a
+       data8 0xa3a5f1273887bf22, 0xce2f0f347f96f906
+       data8 0x820aec524e3c23e9, 0xa3d7ef508ff11574
+       data8 0xce6e0be0cd551a61, 0x823880f78e70b805
+       data8 0xa4115ce30548bc15, 0xceb666b2c347d1de
+       data8 0x826097a62a8e5200, 0xa443df0e53df577a
+       data8 0xcef609b0cb874f00, 0x8288dfe00e9b5eaf
+       data8 0xa4769fa5913c0ec3, 0xcf35fb5447e5c765
+       data8 0x82b15a10c5371624, 0xa4a99f303bc7def5
+       data8 0xcf763c47ee869f00, 0x82da06a527b18937
+       data8 0xa4dcde37779adf4b, 0xcfb6cd3888d71785
+       data8 0x8302e60b635ab394, 0xa5105d46152c938a
+       data8 0xcff7aed4fbfbb447, 0x832bf8b2feec2f0e
+       data8 0xa5441ce89825cb8d, 0xd038e1ce5167e3c6
+       data8 0x83553f0ce00e276b, 0xa5781dad3e54d899
+       data8 0xd07a66d7bfa0ebba, 0x837eb98b50f8322a
+       data8 0xa5ac602406c4e68c, 0xd0bc3ea6b32d1b21
+       data8 0x83a270f44c84f699, 0xa5d9601d95c2c0bc
+       data8 0xd0f4f0e8f36c1bf8, 0x83cc4d7cfcfac5ca
+       data8 0xa60e1e1a2de14745, 0xd1376458e34b037e
+       data8 0x83f65f78a8872b4c, 0xa6431f6e3fbd9658
+       data8 0xd17a2ca133f78572, 0x8420a75f2f7b53c8
+       data8 0xa67864b0d432fda4, 0xd1bd4a80301c5715
+       data8 0x844510461ff14209, 0xa6a6444aa0243c0b
+       data8 0xd1f71682b2fa4575, 0x846fbd91b930bed2
+       data8 0xa6dc094d10f25792, 0xd23ad555f773f059
+       data8 0x84947e18234f3294, 0xa70a574cc02bba69
+       data8 0xd2752c7039a5bf73, 0x84bf92755825045a
+       data8 0xa7409e2af9549084, 0xd2b98ee008c06b59
+       data8 0x84e4ac0ee112ba51, 0xa76f5c64ca2cf13b
+       data8 0xd2f4735ffd700280, 0x8509ef44b86f20be
+       data8 0xa79e4f0babab5dc0, 0xd32f99ed6d9ac0e1
+       data8 0x85359d5d91768427, 0xa7d5579ae5164b85
+       data8 0xd374f0666c75d51c, 0x855b3bd5b7384357
+       data8 0xa804bd3c6fe61cc8, 0xd3b0a7d13618e4a1
+       data8 0x858104f0c415f79a, 0xa8345895e5250a5a
+       data8 0xd3eca2ea53bcec0c, 0x85a6f90390d29864
+       data8 0xa8642a122b44ef0b, 0xd428e23874f13a17
+       data8 0x85d3772fcd56a1dd, 0xa89c38ca18f6108b
+       data8 0xd46f82fe293bc6d3, 0x85f9c982fcc002f3
+       data8 0xa8cc81063b6e87ca, 0xd4ac57e9b7186420
+       data8 0x862047e0e7ea554b, 0xa8fd00bfa409285e
+       data8 0xd4e972becb04e8b8, 0x8646f2a26f7f5852
+       data8 0xa92db8664d5516da, 0xd526d40a7a9b43a3
+       data8 0x866dca21754096b5, 0xa95ea86b75cc2c20
+       data8 0xd5647c5b73917370, 0x8694ceb8dfd17a37
+       data8 0xa98fd141a4992deb, 0xd5a26c4201bd6d13
+       data8 0x86bc00c49e9307e8, 0xa9c1335cae7446ba
+       data8 0xd5e0a45015350a7e, 0x86dccd74fce79610
+       data8 0xa9ea8686f556f645, 0xd614b539c6194104
+       data8 0x870453c845acf90f, 0xaa1c52d17906bb19
+       data8 0xd6537310e224283f, 0x872c089a1e90342c
+       data8 0xaa4e59b046dab887, 0xd6927ab62244c917
+       data8 0x8753ec4a92d16c5e, 0xaa809b9c60d1890b
+       data8 0xd6d1ccc1fc4ef4b7, 0x877bff3aca19f6b4
+       data8 0xaab319102f3f9b33, 0xd71169cea98fdded
+       data8 0x879d88b6fe1c324c, 0xaadd5a18c1e21274
+       data8 0xd746a66a5bc9f6d9, 0x87c5f346dbf98c3a
+       data8 0xab1045f2ac31bdf5, 0xd786ce8f0fae5317
+       data8 0x87e7c653efacef2c, 0xab3ae3ab2df7231e
+       data8 0xd7bc7ff214c4e75a, 0x881089d4e73ffefc
+       data8 0xab6e3f945d1e96fc, 0xd7fd35467a517ed1
+       data8 0x88397e6a366f2a8a, 0xaba1d953a08fa94e
+       data8 0xd83e38838648d815, 0x885bc559e5e1c081
+       data8 0xabcd090db7ef4c3f, 0xd874a1db598b8951
+       data8 0x887e2ee392bb7a93, 0xabf864602d7c323d
+       data8 0xd8ab42205b80edaf, 0x88a7a8587e404257
+       data8 0xac2ca5886ccf9b57, 0xd8ed1849d202f965
+       data8 0x88ca5eda67594784, 0xac5861d4aa441f0f
+       data8 0xd92432bd5a173685, 0x88f4356166bd590e
+       data8 0xac8d183fe3a2fbed, 0xd9669ca45b03c23e
+       data8 0x89173a0acf5ce026, 0xacb93703ff51571e
+       data8 0xd99e3327cf89574e, 0x893a62a098b6a57b
+       data8 0xace5830ad0c3f14b, 0xd9d602b19b100466
+       data8 0x895daf637236ae2c, 0xad11fca5d78b3ff2
+       data8 0xda0e0ba86c096841, 0x89883b9d1c2fa9c5
+       data8 0xad4797fddf91a798, 0xda5195fcdb1c3dce
+       data8 0x89abd8dd374a5d7b, 0xad747701e559ebcb
+       data8 0xda8a1eb87a491f6c, 0x89cf9b1dcd197fa0
+       data8 0xada184a47e9c7613, 0xdac2e230b91c3f84
+       data8 0x89f382a258ea79de, 0xadcec13ab0dda8ff
+       data8 0xdafbe0d0b66aea30, 0x8a178faf06648f29
+       data8 0xadfc2d1a5fd21ba8, 0xdb351b04a8fafced
+       data8 0x8a3bc288b3e1d18a, 0xae29c89a5053c33a
+       data8 0xdb6e9139e33cdd8e, 0x8a601b74f4d1f835
+       data8 0xae5794122b638df9, 0xdba843ded7151ea1
+       data8 0x8a849aba14274764, 0xae858fda8137ae0a
+       data8 0xdbe2336319b61fc8, 0x8aa9409f16cdbc9b
+       data8 0xaeb3bc4ccc56d3d1, 0xdc1c60376789fa68
+       data8 0x8ace0d6bbe2cb316, 0xaee219c374c09920
+       data8 0xdc56cacda82d0cd5, 0x8af301688ab33558
+       data8 0xaf10a899d3235fe7, 0xdc917398f2797814
+       data8 0x8b181cdebe6f3206, 0xaf3f692c341fe8b4
+       data8 0xdccc5b0d90a3e628, 0x8b3d60185fafcb7c
+       data8 0xaf6e5bd7db9ae6c2, 0xdd0781a10469f0f2
+       data8 0x8b62cb603bb2fad0, 0xaf9d80fb081cd91b
+       data8 0xdd42e7ca0b52838f, 0x8b80d7d6bc4104de
+       data8 0xafc35ce063eb3787, 0xdd729ad01c69114d
+       data8 0x8ba68bf73ac74f39, 0xaff2ddcb5f28f03d
+       data8 0xddae749c001fbf5e, 0x8bcc68fb9f9f7335
+       data8 0xb022923b148e05c5, 0xddea8f50a51c69b1
+       data8 0x8bf26f31c534fca2, 0xb0527a919adbf58b
+       data8 0xde26eb69a0f0f111, 0x8c10f86e13a1a1f9
+       data8 0xb078f3ab1d701c65, 0xde576480262399bc
+       data8 0x8c3749916cc6abb5, 0xb0a93a6870649f31
+       data8 0xde943789645933c8, 0x8c5dc4c4f7706032
+       data8 0xb0d9b624d62ec856, 0xded14d58139a28af
+       data8 0x8c7cac3a8c42e3e0, 0xb100a5f53fb3c8e1
+       data8 0xdf025c00bbf2b5c7, 0x8ca373f1b7bf2716
+       data8 0xb131821882f5540a, 0xdf3feb44d723a713
+       data8 0x8cc29907fb951294, 0xb158bf8e4cb04055
+       data8 0xdf715bc16c159be0, 0x8ce9ae4e9492aac8
+       data8 0xb189fd69d56b238f, 0xdfaf66240e29cda8
+       data8 0x8d0911dddbfdad0e, 0xb1b189958e8108e4
+       data8 0xdfe139cbf6e19bdc, 0x8d3075c4f20f04ee
+       data8 0xb1e32a8165b09832, 0xe01fc0fe94d9fc52
+       data8 0x8d5018a9d4de77d5, 0xb20b0678fc271eec
+       data8 0xe051f92ffcc0bd60, 0x8d77cc47dd143515
+       data8 0xb23d0bd3f7592b6e, 0xe090feec9c9a06ac
+       data8 0x8d97af6352739cb7, 0xb26538b2db8420dc
+       data8 0xe0c39d0c9ff862d6, 0x8db7af523167800f
+       data8 0xb28d89e339ceca14, 0xe0f668eeb99f188d
+       data8 0x8ddfd80bc68c32ff, 0xb2c022ca12e55a16
+       data8 0xe1362890eb663139, 0x8e00197e1e7c88fe
+       data8 0xb2e8c6852c6b03f1, 0xe1695c7212aecbaa
+       data8 0x8e207859f77e20e7, 0xb3118f4eda9fe40f
+       data8 0xe19cbf0391bbbbe9, 0x8e40f4ce60c9f8e2
+       data8 0xb33a7d6268109ebe, 0xe1d050901c531e85
+       data8 0x8e69ba46cf2fde4d, 0xb36ddbc5ea70ec55
+       data8 0xe2110903b4f4047a, 0x8e8a7a00bd7ae63e
+       data8 0xb3971e9b39264023, 0xe2450559b4d80b6d
+       data8 0x8eab57ef1cf2f529, 0xb3c0877ecc18e24a
+       data8 0xe27931a231554ef3, 0x8ecc5442cffb1dad
+       data8 0xb3ea16ae3a6c905f, 0xe2ad8e2ac3c5b04b
+       data8 0x8eed6f2d2a4acbfe, 0xb413cc67aa0e4d2d
+       data8 0xe2e21b41b9694cce, 0x8f0ea8dff24441ff
+       data8 0xb43da8e9d163e1af, 0xe316d93615862714
+       data8 0x8f385c95d696b817, 0xb47233773b84d425
+       data8 0xe3590bd86a0d30f9, 0x8f59dc43edd930f3
+       data8 0xb49c6825430fe730, 0xe38e38e38e38e38e
+       data8 0x8f7b7b5f5ffad1c4, 0xb4c6c46bcdb27dcf
+       data8 0xe3c397d1e6db7839, 0x8f9d3a1bea165f38
+       data8 0xb4f1488c0b35d26f, 0xe3f928f5953feb9e
+       data8 0x8fbf18adc34b66da, 0xb51bf4c7c51f0168
+       data8 0xe42eeca17c62886c, 0x8fe117499e356095
+       data8 0xb546c9616087ab9c, 0xe464e32943446305
+       data8 0x90033624aa685f8d, 0xb571c69bdffd9a70
+       data8 0xe49b0ce15747a8a2, 0x9025757495f36b86
+       data8 0xb59cecbae56984c3, 0xe4d16a1eee94e9d4
+       data8 0x903f3a5dcc091203, 0xb5bd64512bb14bb7
+       data8 0xe4fa52107353f67d, 0x9061b2fceb2bdbab
+       data8 0xb5e8d2a4bf5ba416, 0xe5310a471f4d2dc3
+       data8 0x90844ca7211032a7, 0xb6146a9a1bc47819
+       data8 0xe567f6f1c2b9c224, 0x90a7079403e6a15d
+       data8 0xb6402c7749d621c0, 0xe59f18689a9e4c9a
+       data8 0x90c9e3fbafd63799, 0xb66c1882fb435ea2
+       data8 0xe5d66f04b8a68ecf, 0x90ece216c8a16ee4
+       data8 0xb6982f048c999a56, 0xe60dfb2005c192e9
+       data8 0x9110021e7b516f0a, 0xb6c47044075b4142
+       data8 0xe645bd1544c7ea51, 0x912a708a39be9075
+       data8 0xb6e5bd6bfd02bafd, 0xe66fb21b505b20a0
+       data8 0x914dcc7b31146370, 0xb7124a2736ff8ef2
+       data8 0xe6a7d32af4a7c59a, 0x91714af8cfe984d5
+       data8 0xb73f026a01e94177, 0xe6e02b129c6a5ae4
+       data8 0x918c00a6f3795e97, 0xb760a959f1d0a7a7
+       data8 0xe70a9136a7403039, 0x91afbc299ed0295d
+       data8 0xb78dae7e06868ab0, 0xe74349fb2d92a589
+       data8 0x91d39add3e958db0, 0xb7badff8ad9e4e02
+       data8 0xe77c3a9c86ed7d42, 0x91ee9920a8974d92
+       data8 0xb7dce25b8e17ae9f, 0xe7a713f88151518a
+       data8 0x9212b5fcac537c19, 0xb80a6226904045e2
+       data8 0xe7e067453317ed2b, 0x9236f6b256923fcf
+       data8 0xb8380f1cafd73c1c, 0xe819f37a81871bb5
+       data8 0x92523ee6f90dcfc3, 0xb85a6ea8e321b4d8
+       data8 0xe8454236bfaeca14, 0x9276bef031e6eb79
+       data8 0xb8886b684ae7d2fa, 0xe87f32f24c3fc90e
+       data8 0x929236ec237a24ad, 0xb8ab0726fa00cf5d
+       data8 0xe8aacd8688892ba6, 0x92b6f70b7efe9dc3
+       data8 0xb8d954a4d13b7cb1, 0xe8e523fd32f606f7
+       data8 0x92d29f61eec7dc2b, 0xb8fc2d4f6cd9f04a
+       data8 0xe9110b5311407927, 0x92f7a05d5b8ba92f
+       data8 0xb92acc851476b1ab, 0xe94bc8bf0c108fa3
+       data8 0x931379a403be5c16, 0xb94de2d841a184c2
+       data8 0xe977fdc439c2ca3c, 0x9338bc44de2e3f34
+       data8 0xb97cd4c36c92693c, 0xe9b3236528fc349e
+       data8 0x9354c71412c69486, 0xb9a0297f172665e3
+       data8 0xe9dfa70b745ac1b4, 0x937a4c273907e262
+       data8 0xb9cf6f21e36c3924, 0xea1b36268d0eaa38
+       data8 0x93968919f6e7975d, 0xb9f3030951267208
+       data8 0xea480963fd394197, 0x93bc516fdd4680c9
+       data8 0xba229d6a618e7c59, 0xea84034425f27484
+       data8 0x93d8c123d9be59b2, 0xba467144459f9855
+       data8 0xeab12713138dd1cc, 0x93f546c955e60076
+       data8 0xba6a60c3c48f1a4b, 0xeade6db73a5e503b
+       data8 0x941b70a65879079f, 0xba9a76056b67ee7a
+       data8 0xeb1b0268343b121b, 0x943829f337410591
+       data8 0xbabea699563ada6e, 0xeb489b0b2bdb5f14
+       data8 0x9454f995765bc4d2, 0xbae2f350b262cc4b
+       data8 0xeb765721e85f03d0, 0x947b86b57f5842ed
+       data8 0xbb1385a23be24e57, 0xebb389645f222f62
+       data8 0x94988aeb23470f86, 0xbb3814975e17c680
+       data8 0xebe198f090607e0c, 0x94b5a5dc9695f42a
+       data8 0xbb5cc031009bf467, 0xec0fcc9321024509
+       data8 0x94d2d7a9170d8b42, 0xbb81889680024764
+       data8 0xec3e247da8b82f61, 0x94f9e87dd78bf019
+       data8 0xbbb2c0d8703ae95d, 0xec7c27d21321c9f7
+       data8 0x95175019a503d89e, 0xbbd7cd09ba3c5463
+       data8 0xecaad5278824e453, 0x9534cefa625fcb3a
+       data8 0xbbfcf68c4977718f, 0xecd9a76d097d4e77
+       data8 0x955265405c491a25, 0xbc223d88cfc88eee
+       data8 0xed089ed5dcd99446, 0x9570130c1f9bb857
+       data8 0xbc47a2284fee4ff8, 0xed37bb95add09a1c
+       data8 0x9597ca4119525184, 0xbc79ac0916ed7b8a
+       data8 0xed76c70508f904b6, 0x95b5af6fb5aa4d3c
+       data8 0xbc9f5670d1a13030, 0xeda63bb05e7f93c6
+       data8 0x95d3ac9273aafd7a, 0xbcc51f068cb95c1d
+       data8 0xedd5d661daed2dc4, 0x95f1c1cafdfd3684
+       data8 0xbceb05f4b30a9bc0, 0xee05974eef86b903
+       data8 0x960fef3b430b8d5f, 0xbd110b6604c7d306
+       data8 0xee357ead791fc670, 0x962e350575b409c5
+       data8 0xbd372f8598620f19, 0xee658cb3c134a463
+       data8 0x964c934c0dfc1708, 0xbd5d727edb6b3c7e
+       data8 0xee95c1987f080211, 0x966b0a31c9c6bc7d
+       data8 0xbd83d47d937bbc6d, 0xeec61d92d8c4314f
+       data8 0x968999d9ad8d264e, 0xbdaa55addf1ae47d
+       data8 0xeef6a0da64a014ac, 0x96a8426705198795
+       data8 0xbdd0f63c36aa73f0, 0xef274ba72a07c811
+       data8 0x96c703fd64445ee5, 0xbdf7b6556d550a15
+       data8 0xef581e31a2c91260, 0x96e5dec0a7b4268d
+       data8 0xbe1e9626b1ffa96b, 0xef8918b2bc43aec6
+       data8 0x9704d2d4f59f79f3, 0xbe4595dd903e5371
+       data8 0xefba3b63d89d7cbf, 0x9723e05ebe91b9b0
+       data8 0xbe6cb5a7f14bc935, 0xefeb867ecffaa607
+       data8 0x97430782be323831, 0xbe93f5b41d047cf7
+       data8 0xf01cfa3df1b9c9fa, 0x97624865fc0df8bf
+       data8 0xbebb5630bae4c15f, 0xf04e96dc05b43e2d
+       data8 0x9781a32dcc640b2a, 0xbee2d74cd30a430c
+       data8 0xf0805c944d827454, 0x97a117ffd0f48e46
+       data8 0xbf0a7937cf38d981, 0xf0b24ba285c495cb
+       data8 0x97c0a701f9d263c9, 0xbf323c217be2bc8c
+       data8 0xf0e46442e76f6569, 0x97e0505a8637a036
+       data8 0xbf5a203a09342bbb, 0xf116a6b2291d7896
+       data8 0x97f57a9fb0b08c6e, 0xbf74cad1c14ebfc4
+       data8 0xf1383fa9e9b5b381, 0x9815503365914a9d
+       data8 0xbf9ce6a497a89f78, 0xf16ac84f90083b9b
+       data8 0x98354085054fd204, 0xbfc52428bec6e72f
+       data8 0xf19d7b686dcb03d7, 0x98554bbbf8a77902
+       data8 0xbfed838fddab024b, 0xf1d0593311db1757
+       data8 0x987571fffb7f94f6, 0xc016050c0420981a
+       data8 0xf20361ee8f1c711e, 0x9895b3791dd03c23
+       data8 0xc03ea8cfabddc330, 0xf23695da7de51d3f
+       data8 0x98ab43a5fc65d0c8, 0xc059d3cbd65ddbce
+       data8 0xf258d095e465cc35, 0x98cbb2d196bd713d
+       data8 0xc082b122a3c78c9d, 0xf28c4d0bfc982b34
+       data8 0x98ec3d9ec7b6f21a, 0xc0abb1499ae736c4
+       data8 0xf2bff55eb3f0ea71, 0x990ce436db5e8344
+       data8 0xc0d4d474c3aedaaf, 0xf2f3c9cf9884636e
+       data8 0x9922b8218160967a, 0xc0f054ca33eb3437
+       data8 0xf31670135ab9cc0f, 0x99438d686f75779d
+       data8 0xc119b2c67e600ed0, 0xf34a8e9f0b54cdfb
+       data8 0x99647eea131fa20b, 0xc1433453de2033ff
+       data8 0xf37ed9fa6b8add3f, 0x997a85045a47c6d0
+       data8 0xc15ef3e44e10032d, 0xf3a1cfe884ef6bb6
+       data8 0x999ba5f14f8add02, 0xc188b130431d80e6
+       data8 0xf3d66689dcc8e8d3, 0x99bce38b5465ecae
+       data8 0xc1b2929d6067730e, 0xf40b2ab069d5c96a
+       data8 0x99d31ca0887f30f9, 0xc1ce9268f31cc734
+       data8 0xf42e718b90c8bc16, 0x99f48a669c74c09e
+       data8 0xc1f8b0877c1b0c08, 0xf463822a0a3b4b00
+       data8 0x9a16154eb445c873, 0xc222f35a87b415ba
+       data8 0xf498c1076015faf8, 0x9a2c822ec198d667
+       data8 0xc23f3467349e5c88, 0xf4bc5a19a33990b5
+       data8 0x9a4e3e080cd91b78, 0xc269b4e40e088c01
+       data8 0xf4f1e6a7d6f5425f, 0x9a70177afe52322e
+       data8 0xc2945aac24daaf6e, 0xf527a232cf6be334
+       data8 0x9a86b8fa94eebe10, 0xc2b0de05e43c1d66
+       data8 0xf54b8ecdcda90851, 0x9aa8c42866ae2958
+       data8 0xc2dbc275e1229d09, 0xf5819949c7ad87b4
+       data8 0x9abf86f9e12fc45e, 0xc2f86fca9d80eeff
+       data8 0xf5a5bac9213b48a9, 0x9ae1c462fc05f49d
+       data8 0xc323938449a2587e, 0xf5dc1501f324a812
+       data8 0x9af8a8dc936b84d0, 0xc3406b40a538ed20
+       data8 0xf6006bee86b5589e, 0x9b1b19033be35730
+       data8 0xc36bcee8211d15e0, 0xf63716b2fa067fa4
+       data8 0x9b3da7daf04c2892, 0xc397593adf2ba366
+       data8 0xf66df22fb6132b9c, 0x9b54c2e4c8a9012b
+       data8 0xc3b475b6206155d5, 0xf6929fb98225deb1
+       data8 0x9b77854e6c661200, 0xc3e0410243b97383
+       data8 0xf6c9cd13021e3fea, 0x9b8ec2e678d56d2f
+       data8 0xc3fd890709833d37, 0xf6eeb177472cedae
+       data8 0x9ba60e6a5ca133b6, 0xc41ae295f7e7fa06
+       data8 0xf713abf4cb0b3afb, 0x9bc919ea66a151a4
+       data8 0xc44709f7bb8a4dd2, 0xf74b4d5333684ef1
+       data8 0x9be0887c09ef82bb, 0xc4648fb0e0bec4c1
+       data8 0xf7707f75a72f8e94, 0x9c03c8d5fffc3503
+       data8 0xc490f9a94695ba14, 0xf7a874b97927af44
+       data8 0x9c1b5ad21a81cbb9, 0xc4aeac0173b7d390
+       data8 0xf7cddf140aedf1d8, 0x9c3ed09216e9ca02
+       data8 0xc4db5941007aa853, 0xf806291bacb7f7a9
+       data8 0x9c568656c0423def, 0xc4f938aec206291a
+       data8 0xf82bcc43b92eafef, 0x9c7a320af242ce60
+       data8 0xc52629e899dfd622, 0xf8646bf0defb759e
+       data8 0x9c920bf7a8c01dc2, 0xc54436e44043b965
+       data8 0xf88a487dfc3ff5f7, 0x9ca9f475d98b159c
+       data8 0xc562563abf9ea07f, 0xf8b03c2b46cdc17f
+       data8 0x9ccdeca60e80b5f8, 0xc58fa7d1dc42921c
+       data8 0xf8e95541c152ae7a, 0x9ce5f9d4653d4902
+       data8 0xc5adf561b91e110a, 0xf90f832c2700c160
+       data8 0x9cfe15cb38bfdd8e, 0xc5cc5591bdbd82fa
+       data8 0xf935c88e0c7f419b, 0x9d225b983f6c1f96
+       data8 0xc5fa08f1ff20593c, 0xf96f5cd84fd86873
+       data8 0x9d3a9cca32261ed7, 0xc618980a79ce6862
+       data8 0xf995dd53ebdd9d6d, 0x9d52ecfccebe1768
+       data8 0xc6373a09e34b50fa, 0xf9bc75a034436a41
+       data8 0x9d77818d95b82f86, 0xc66550a6e0baaf35
+       data8 0xf9f686f26d5518de, 0x9d8ff7893fa4706c
+       data8 0xc6842241926342c9, 0xfa1d5b39b910a8c5
+       data8 0x9da87cbef36f2a5e, 0xc6a3070b7c93bb9e
+       data8 0xfa4447acc4ecbfd2, 0x9dcd6140b4a35aeb
+       data8 0xc6d18260bb84081b, 0xfa7ed7e51e6fdfb4
+       data8 0x9de60cd06dc6e2d4, 0xc6f0977c9416828b
+       data8 0xfaa601394d49a1a0, 0x9dfec7d4cc43b76f
+       data8 0xc70fc0117c641630, 0xfacd431644ce0e40
+       data8 0x9e17925ec9fccc4a, 0xc72efc34d7e615be
+       data8 0xfaf49d96f7a75909, 0x9e3cdf6db57dc075
+       data8 0xc75dfb441594141e, 0xfb2fd3c65e562fd5
+       data8 0x9e55d110b63637a8, 0xc77d68aa019bda4c
+       data8 0xfb576c5762024805, 0x9e6ed27594550d2e
+       data8 0xc79ce9ea478dbc4f, 0xfb7f1debc22c4040
+       data8 0x9e87e3adc385d393, 0xc7bc7f1ae453219d
+       data8 0xfba6e89f32d0190a, 0x9ead9b54b37a1055
+       data8 0xc7ec0476e15e141a, 0xfbe2c803a0894893
+       data8 0x9ec6d46a3d7de215, 0xc80bcbe16f1d540f
+       data8 0xfc0ad1ff0ed9ecf0, 0x9ee01d9108be3154
+       data8 0xc82ba78a5d349735, 0xfc32f57bdfbcbe7f
+       data8 0x9ef976db07288d04, 0xc84b978847a06b87
+       data8 0xfc5b32968f99b21c, 0x9f12e05a4759ec25
+       data8 0xc86b9bf1ee817bc6, 0xfc83896bc861ab08
+       data8 0x9f2c5a20f4da6668, 0xc88bb4de3667cdf4
+       data8 0xfcabfa1861ed4815, 0x9f52af78ed1733ca
+       data8 0xc8bc00e7fe9e23a3, 0xfce8d3cea7d3163e
+       data8 0x9f6c52426a39d003, 0xc8dc4d7ff2d25232
+       data8 0xfd118595143ee273, 0x9f860593d42fd7f3
+       data8 0xc8fcaeebcb40eb47, 0xfd3a519943d4865a
+       data8 0x9f9fc97fdb96bd51, 0xc91d25431426a663
+       data8 0xfd6337f8e1ae5a4b, 0x9fb99e194f4a7037
+       data8 0xc93db09d7fdb2949, 0xfd8c38d1c8e927eb
+       data8 0x9fd383731ca51db9, 0xc95e5112e721582a
+       data8 0xfdb5544205095a53, 0x9fed79a04fbf9423
+       data8 0xc97f06bb49787677, 0xfdde8a67d2613531
+       data8 0xa00780b413b24ee8, 0xc99fd1aecd6e1b06
+       data8 0xfe07db619e781611, 0xa02eab2c4474b0cd
+       data8 0xc9d12a3e27bb1625, 0xfe460768d80bf758
+       data8 0xa048dcd51ccfd142, 0xc9f22ad82ba3d5f0
+       data8 0xfe6f9bfb06cd32f6, 0xa0631fa894b11b8d
+       data8 0xca134113105e67b2, 0xfe994bcd3d14fcc2
+       data8 0xa07d73ba65e680af, 0xca346d07b045a876
+       data8 0xfec316fecaf3f2ab, 0xa097d91e6aaf71b0
+       data8 0xca55aecf0e94bb88, 0xfeecfdaf33fadb80
+       data8 0xa0b24fe89e02602f, 0xca77068257be9bab
+       data8 0xff16fffe2fa8fad6, 0xa0ccd82d1bd2f68b
+       data8 0xca98743ae1c693a8, 0xff411e0ba9db886d
+       data8 0xa0e77200215909e6, 0xcab9f8122c99a101
+       data8 0xff6b57f7c33e4e9a, 0xa1021d760d584855
+       data8 0xcadb9221e268c3b5, 0xff95ade2d1bd7358
+       data8 0xa11cdaa36068a57d, 0xcafd4283d8043dfd
+       data8 0xffc01fed60f86fb5, 0xa137a99cbd3f880b
+       data8 0xcb1f09520d37c6fb, 0xffeaae3832b63956
+LOCAL_OBJECT_END(T_table)
+
+
+
+
+
+
 
 .section .text
-.proc  cbrt#
-.align 32
-cbrt: 
-
-
-{ .mfi
-  // get significand
-  getf.sig r23=f8
-  // will continue only for normal/denormal numbers          
-  (p0)  fclass.nm.unc p12,p0 = f8, 0x1b           
-  // r2 = pointer to C_1,...,C_5 followed by T_table
-  addl r2 = @ltoff(poly_coeffs), gp
+GLOBAL_LIBM_ENTRY(cbrt)
+
+
+{.mfi
+       // get significand
+       getf.sig GR_SIGNIF = f8
+       // normalize a
+       fma.s1 FR_ARG = f8, f1, f0
+       // GR_GP = pointer to C_1,..., C_5 followed by T_table
+       addl GR_GP = @ltoff(poly_coeffs), gp ;;
 }
+
 {.mfi
-  // get exponent
-  getf.exp r24=f8   
-  // normalize a
-  fma.s1 f14=f8,f1,f0
-  // r29=bias-((2^{12}-1)/3) -63=0xffff-0x555-0x3f=0xfa6b
-  mov r29=0xfa6b;;    
+       // get exponent
+       getf.exp GR_ARGEXP = f8
+       // will continue only for normal/denormal numbers
+       fclass.m.unc p12, p13 = f8, 0x1e7
+       // GR_CONST4 = bias-((2^{12}-1)/3)-63 = 0xffff-0x555-0x3f = 0xfa6b
+       mov GR_CONST4 = 0xfa6b ;;
 }
+
 {.mlx
-  mov r25=0x20000
-  // r28=2^52
-  movl r28=0x8000000000000000;;
-}
-{.mfb
-  // load start address for C_1,...,C_5 followed by T_table
-  ld8 r3=[r2]
-  (p12) fma.d.s0 f8=f8,f1,f0
-  (p12) br.ret.spnt b0
+       mov GR_CONST2 = 0x20000
+       // GR_CONST3 = 2^52
+       movl GR_CONST3 = 0x8000000000000000 ;;
 }
+
+.pred.rel "mutex", p12, p13
 {.mfi
-  nop.m 0
-  // y=frcpa(a)
-  frcpa.s0 f8,p6=f1,f8
-  // p7=1 if denormal input
-  cmp.gtu p7,p0=r28,r23;;
+       // load start address for C_1,..., C_5 followed by T_table
+       ld8 GR_ADDR = [ GR_GP ]
+       // y = frcpa(a)
+ (p13) frcpa.s0 f8, p0 = f1, f8
+       // p7 = 1 if denormal input
+       cmp.gtu p7, p0 = GR_CONST3, GR_SIGNIF
+}
+{.mfb
+       nop.m 0
+       // if argument is 0, +/-Infinity, NaN, or NaTVal, then return
+ (p12) fma.d.s0 f8 = f8, f1, f0
+ (p12) br.ret.spnt b0 ;;
 }
+
 {.mmi
-  // get exponent
-  (p7) getf.exp r24=f14
-  // get normalized significand
-  (p7) getf.sig r23=f14
-  // r28=bias-(2^{12}-1)
-  mov r28=0xf000;;
+       // get exponent (for denormal input)
+ (p7) getf.exp GR_ARGEXP = FR_ARG
+       // get normalized significand (for denormal input)
+ (p7) getf.sig GR_SIGNIF = FR_ARG
+       // GR_CONST1 = bias-(2^{12}-1)
+       mov GR_CONST1 = 0xf000 ;;
 }
+
 {.mii
-  // get r26=sign
-  and r26=r24,r25
-  // eliminate leading 1 from r23=1st table index
-  shl r23=r23,1
-  // eliminate sign from exponent (r25)
-  andcm r25=r24,r25;;
+       // get GR_SIGN = sign
+       and GR_SIGN = GR_ARGEXP, GR_CONST2
+       // eliminate leading 1 from GR_I1 = 1st table index
+       shl GR_I1 = GR_SIGNIF, 1
+       // eliminate sign from exponent
+       andcm GR_EXP = GR_ARGEXP, GR_CONST2 ;;
 }
+
 {.mib
-  add r2=32,r3
-  // r23=1st table index (y_index,8 bits)
-  shr.u r23=r23,56
-  nop.b 0
+       add GR_ADDR2 = 32, GR_ADDR
+       // GR_IT1 = 1st table index (y_index, 8 bits)
+       shr.u GR_IT1 = GR_I1, 56
+       nop.b 0
 }
 {.mib
-  // load C_1
-  ldfe f7=[r3],16
-  // subtract bias from r25=exponent
-  sub r25=r25,r28
-  nop.b 0;;
+       // load C_1
+       ldfe FR_COEFF1 = [ GR_ADDR ], 16
+       // subtract bias from GR_EXPON = exponent
+       sub GR_EXPON = GR_EXP, GR_CONST1
+       nop.b 0 ;;
 }
+
 {.mib
-  // load C_2, C_3
-  ldfpd f9,f10=[r3]
-  // 1: exponent*=5;  // (2^{16}-1)/3=0x5555
-  shladd r24=r25,2,r25
-  nop.b 0
+       // load C_2, C_3
+       ldfpd FR_COEFF2, FR_COEFF3 = [ GR_ADDR ]
+       // 1: exponent* = 5; // (2^{16}-1)/3 = 0x5555
+       shladd GR_TMP1 = GR_EXPON, 2, GR_EXPON
+       nop.b 0
 }
 {.mib
-  // load C_4, C_5
-  ldfpd f11,f12=[r2],16
-  // r23=3*y_index
-  shladd r23=r23,1,r23
-  nop.b 0;;
+       // load C_4, C_5
+       ldfpd FR_COEFF4, FR_COEFF5 = [ GR_ADDR2 ], 16
+       // GR_TMP2 = 3*y_index
+       shladd GR_TMP2 = GR_IT1, 1, GR_IT1
+       nop.b 0 ;;
 }
 
 {.mfi
-  // r30=(5*expon)*16+5*expon=(0x55)*expon
-  shladd r30=r24,4,r24
-  // r=1-a*y
-  (p6) fnma.s1 f6=f8,f14,f1
-  // adjust T_table pointer by 1st index
-  shladd r2=r23,3,r2;;
+       // GR_TMP6 = (5*expon)*16+5*expon = (0x55)*expon
+       shladd GR_TMP6 = GR_TMP1, 4, GR_TMP1
+       // r = 1-a*y
+       fnma.s1 FR_R = f8, FR_ARG, f1
+       // adjust T_table pointer by 1st index
+       shladd GR_ITB1 = GR_TMP2, 3, GR_ADDR2 ;;
 }
 
 {.mii
-  nop.m 0
-  // r24=(0x5500)*expon
-  shl r24=r30,8;;
-  // r24=(0x5555)*expon
-  add r24=r24,r30;;
+       // eliminate leading 1 from significand
+       add GR_SIGNIF2 = GR_SIGNIF, GR_SIGNIF
+       // GR_TMP3 = (0x5500)*expon
+       shl GR_TMP3 = GR_TMP6, 8 ;;
+       // GR_TMP4 = (0x5555)*expon
+       add GR_TMP4 = GR_TMP3, GR_TMP6 ;;
 }
+
 {.mii
-  // r24=(0x5556)*expon  // 0x5556=(2^{16}+2)/3
-  add r24=r24,r25
-  nop.i 0;;
-  // r24=floor(expon/3)
-  shr r24=r24,16;;
+       // GR_TMP5 = (0x5556)*expon // 0x5556 = (2^{16}+2)/3
+       add GR_TMP5 = GR_TMP4, GR_EXPON
+       nop.i 0 ;;
+       // GR_EXP_BY_3 = floor(expon/3)
+       shr GR_EXP_BY_3 = GR_TMP5, 16 ;;
 }
+
 {.mfi
-  // r28=3*exponent
-  shladd r28=r24,1,r24
-  // r2=r*r
-  (p6) fma.s1 f13=f6,f6,f0
-  // bias exponent
-  add r24=r29,r24;;
+       // GR_TMP6 = 3*exponent
+       shladd GR_TMP6 = GR_EXP_BY_3, 1, GR_EXP_BY_3
+       // r*r
+       fma.s1 FR_R2 = FR_R, FR_R, f0
+       // bias exponent
+       add GR_EBIAS = GR_CONST4, GR_EXP_BY_3 ;;
 }
+
 {.mfi
-  // get remainder of exponent/3 : r25-r28
-  sub r25=r25,r28
-  // c2+c3*r
-  (p6) fma.s1 f9=f10,f6,f9
-  // add sign to exponent
-  or r24=r24,r26
+       // get remainder of exponent/3
+       sub GR_REM = GR_EXPON, GR_TMP6
+       // c2+c3*r
+       fma.s1 FR_P23 = FR_COEFF3, FR_R, FR_COEFF2
+       nop.i 0
 }
 {.mfi
-  nop.m 0
-  // c4+c5*r
-  (p6) fma.s1 f11=f12,f6,f11
-  nop.i 0;;
+       // add sign to exponent
+       or GR_SEXP = GR_EBIAS, GR_SIGN
+       // c4+c5*r
+       fma.s1 FR_P45 = FR_COEFF5, FR_R, FR_COEFF4
+       mov GR_TMP63 = 63+0xffff ;;
 }
+
 {.mmi
-  // f14=sign*2^{exponent/3}
-  (p6) setf.exp f14=r24
-  // adjust T_table pointer by 2nd index
-  shladd r2=r25,3,r2
-  nop.i 0;;
+       // FR_2EXP = sign*2^{exponent/3}
+       setf.exp FR_2EXP = GR_SEXP
+       // adjust T_table pointer by 2nd index
+       shladd GR_INDEX = GR_REM, 3, GR_ITB1
+       // is the argument of the form 2^(3*k) ?
+       // get (significand - leading 1) | (exponent mod 3)
+       or GR_TEST = GR_REM, GR_SIGNIF2 ;;
 }
+
 {.mmi
-  // load T
-  (p6) ldf8 f8=[r2]
-  nop.m 0
-  nop.i 0;;
+       // 2^63
+       setf.exp FR_TMP63 = GR_TMP63
+       // load T
+       ldf8 f8 = [ GR_INDEX ]
+       // is the argument of the form 2^(3*k) ?
+       cmp.eq p14, p0 = GR_TEST, r0 ;;
 }
 
 {.mfi
-  nop.m 0
-  // (c2+c3*r)+r^2*(c4+c5*r)
-  (p6) fma.s1 f9=f11,f13,f9
-  nop.i 0
+       nop.m 0
+       // (c2+c3*r)+r^2*(c4+c5*r)
+       fma.s1 FR_P25 = FR_P45, FR_R2, FR_P23
+       nop.i 0
 }
 {.mfi
-  nop.m 0
-  // c1*r
-  (p6) fma.s1 f7=f7,f6,f0
-  nop.i 0;;
+       nop.m 0
+       // c1*r
+       fma.s1 FR_P1 = FR_COEFF1, FR_R, f0
+       nop.i 0 ;;
+}
+
+{.mfb
+       nop.m 0
+ (p14) fma.d.s0 f8 = FR_2EXP, FR_TMP63, f0
+ (p14) br.ret.spnt b0 ;;
 }
 
 {.mfi
-  nop.m 0
-  // P=c1*r+r^2*[(c2+c3*r)+r^2*(c4+c5*r)]
-  (p6) fma.s1 f9=f9,f13,f7
-  nop.i 0
+       nop.m 0
+       // P = c1*r+r^2* [ (c2+c3*r)+r^2*(c4+c5*r) ]
+       fma.s1 FR_P15 = FR_P25, FR_R2, FR_P1
+       nop.i 0
 }
 {.mfi
-  nop.m 0
-  // T'=T*(2^exp)
-  (p6) fma.s1 f8=f8,f14,f0
-  nop.i 0;;
+       nop.m 0
+       // T' = T*(2^exp)
+       fma.s1 f8 = f8, FR_2EXP, f0
+       nop.i 0 ;;
 }
+
 {.mfb
-  nop.m 0
-  // result = T'-T'*P
-  (p6) fnma.d.s0 f8=f8,f9,f8
-  br.ret.sptk b0;;
+       nop.m 0
+       // result = T'+T'*P
+       fma.d.s0 f8 = f8, FR_P15, f8
+       br.ret.sptk b0 ;;
 }
-.endp cbrt
-ASM_SIZE_DIRECTIVE(cbrt)
+
+
+GLOBAL_LIBM_END(cbrt)
diff --git a/sysdeps/ia64/fpu/s_cbrtf.S b/sysdeps/ia64/fpu/s_cbrtf.S
index 20167797b8..612fb85ea3 100644
--- a/sysdeps/ia64/fpu/s_cbrtf.S
+++ b/sysdeps/ia64/fpu/s_cbrtf.S
@@ -1,11 +1,10 @@
-.file "cbrtf.asm"
+.file "cbrtf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang 
-// of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,27 +20,30 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version 
-// 5/18/00: New version (modified algorithm)
+// 02/02/00 Initial version
+// 05/18/00 New version (modified algorithm)
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Rescheduled some instructions for better performance
+//          on Itanium 2, and reformatted
 //
 // API
 //==============================================================
@@ -53,616 +55,711 @@
 //
 // Implementation
 //
-//   cbrt(a) = cbrt(a y) / cbrt(y)
-//          = cbrt(1 - (1 - a y)) * 1/cbrt(y)
+// Let y= frcpa(a), where a is the argument
 //
-// where y = frcpa(a). 
+// cbrt(a)= cbrt(a*y)/cbrt(y) = cbrt(1 - (1-a*y)) * (1/cbrt(y))
 //
-//  * cbrt(1 - (1 - a y)) is approximated by a degree-2 polynomial 
-//   
-//  1 - (1/3)*r - (1/9)*r^2
-// 
-//  in r = 1 - a y.
+// For all values of y, the 3 possible significands of 1/cbrt(y)
+// are stored in a table (T0) to 64 bits of accuracy. (There are
+// 3 possible significands because the exponent of y modulo 3
+// can be 0, 1, or 2.)
 //
-//  * The values 1/cbrt(y) are stored in a table of constants T0
-//   to 64 bits of accuracy
+//
+// * cbrt(1 - (1-a*y)) is approximated by a degree-2 polynomial
+//
+// 1 - (1/3)*r - (1/9)*r^2
+//
+// in r = 1-a*y.
 //
 // The table values are stored for three exponent values and are
-// then multiplied by e/3 where e is the exponent of the input number.
+// then multiplied by 2^(e/3) where e is the exponent of the input number.
 // This computation is carried out in parallel with the polynomial
 // evaluation:
 //
-//      T = 2^(e/3) * T0
+// T= 2^(e/3) * T0
 
 
 
 
 
 //===============
-// input = x
-// C = frcpa(x)
-// r = 1 - C * x
+// input= x
+// C= frcpa(x)
+// r= 1 - C * x
 //
-// Special values 
+// Special values
 //==============================================================
 
 
 
 // Registers used
 //==============================================================
-//   f6-f15
-//   r2, r23-r26, r28-r30
-//   p6,p7,p8,p12
+// p6, p7, p8, p12
+
+       FR_R      = f6
+       FR_COEFF1 = f7
+       FR_COEFF2 = f9
+       FR_T0     = f10
+       FR_T1     = f11
+       FR_T2     = f12
+       FR_2M63   = f13
+       FR_ARG    = f14
+       FR_Y      = f15
+
+       GR_GP     = r2
+       GR_ADDR   = r2
+       GR_TMP5   = r3
+       GR_CONST  = r8
+       GR_TMP63  = r8
+       GR_SIGN   = r9
+       GR_CT2    = r10
+       GR_CT3    = r11
+       GR_TMP4   = r14
+       GR_EBIAS3 = r15
+       GR_REM    = r16
+       GR_SEXP   = r17
+       GR_2P63   = r18
+       GR_SIGNIF = r19
+       GR_I1     = r20
+       GR_EBIAS  = r21
+       GR_EXP    = r22
+       GR_IT1    = r23
+       GR_E5     = r24
+       GR_IT1_3  = r25
+       GR_TP1    = r26
+       GR_TMP    = r27
+       GR_TMP2   = r28
+       GR_TMP3   = r29
+       GR_EXP3   = r30
+       GR_ARGEXP = r31
+
+
 
-#include "libm_support.h"
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-poly_coeffs:
-ASM_TYPE_DIRECTIVE(poly_coeffs,@object)
-data8 0xaaaaaaaaaaaaaaab, 0x00003ffd // 1/3
-data8 0xe38e38e38e38e38e, 0x00003ffb // 1/9
-ASM_SIZE_DIRECTIVE(poly_coeffs)
-
-
-T_table:
-ASM_TYPE_DIRECTIVE(T_table,@object)
-
-data8 0x80155c748c374836, 0xa160019ed37fb4ae
-data8 0xcb51ddcb9e93095e, 0x8040404b0879f7f9
-data8 0xa1960b5966da4608, 0xcb95f333968ad59b
-data8 0x806b5dce4b405c10, 0xa1cc5dbe6dc2aab4
-data8 0xcbda64292d3ffd97, 0x8096b586974669b1
-data8 0xa202f97995b69c0d, 0xcc1f3184af961596
-data8 0x80bcd273d952a028, 0xa232fe6eb0c0577d
-data8 0xcc5bb1ac954d33e2, 0x80e898c52813f2f3
-data8 0xa26a2582012f6e17, 0xcca12e9831fc6402
-data8 0x81149add67c2d208, 0xa2a197e5d10465cb
-data8 0xcce70a67b64f24ad, 0x813b4e2c856b6e9a
-data8 0xa2d25a532efefbc8, 0xcd24794726477ea5
-data8 0x8167c1dde03de7aa, 0xa30a5bd6e49e4ab8
-data8 0xcd6b096a0b70ee87, 0x818ed973b811135e
-data8 0xa33b9c9b59879e24, 0xcda9177738b15a90
-data8 0x81bbc0c33e13ec98, 0xa3742fca6a3c1f21
-data8 0xcdf05f2247dffab9, 0x81e33e69fbe7504a
-data8 0xa3a5f1273887bf22, 0xce2f0f347f96f906
-data8 0x820aec524e3c23e9, 0xa3d7ef508ff11574
-data8 0xce6e0be0cd551a61, 0x823880f78e70b805
-data8 0xa4115ce30548bc15, 0xceb666b2c347d1de
-data8 0x826097a62a8e5200, 0xa443df0e53df577a
-data8 0xcef609b0cb874f00, 0x8288dfe00e9b5eaf
-data8 0xa4769fa5913c0ec3, 0xcf35fb5447e5c765
-data8 0x82b15a10c5371624, 0xa4a99f303bc7def5
-data8 0xcf763c47ee869f00, 0x82da06a527b18937
-data8 0xa4dcde37779adf4b, 0xcfb6cd3888d71785
-data8 0x8302e60b635ab394, 0xa5105d46152c938a
-data8 0xcff7aed4fbfbb447, 0x832bf8b2feec2f0e
-data8 0xa5441ce89825cb8d, 0xd038e1ce5167e3c6
-data8 0x83553f0ce00e276b, 0xa5781dad3e54d899
-data8 0xd07a66d7bfa0ebba, 0x837eb98b50f8322a
-data8 0xa5ac602406c4e68c, 0xd0bc3ea6b32d1b21
-data8 0x83a270f44c84f699, 0xa5d9601d95c2c0bc
-data8 0xd0f4f0e8f36c1bf8, 0x83cc4d7cfcfac5ca
-data8 0xa60e1e1a2de14745, 0xd1376458e34b037e
-data8 0x83f65f78a8872b4c, 0xa6431f6e3fbd9658
-data8 0xd17a2ca133f78572, 0x8420a75f2f7b53c8
-data8 0xa67864b0d432fda4, 0xd1bd4a80301c5715
-data8 0x844510461ff14209, 0xa6a6444aa0243c0b
-data8 0xd1f71682b2fa4575, 0x846fbd91b930bed2
-data8 0xa6dc094d10f25792, 0xd23ad555f773f059
-data8 0x84947e18234f3294, 0xa70a574cc02bba69
-data8 0xd2752c7039a5bf73, 0x84bf92755825045a
-data8 0xa7409e2af9549084, 0xd2b98ee008c06b59
-data8 0x84e4ac0ee112ba51, 0xa76f5c64ca2cf13b
-data8 0xd2f4735ffd700280, 0x8509ef44b86f20be
-data8 0xa79e4f0babab5dc0, 0xd32f99ed6d9ac0e1
-data8 0x85359d5d91768427, 0xa7d5579ae5164b85
-data8 0xd374f0666c75d51c, 0x855b3bd5b7384357
-data8 0xa804bd3c6fe61cc8, 0xd3b0a7d13618e4a1
-data8 0x858104f0c415f79a, 0xa8345895e5250a5a
-data8 0xd3eca2ea53bcec0c, 0x85a6f90390d29864
-data8 0xa8642a122b44ef0b, 0xd428e23874f13a17
-data8 0x85d3772fcd56a1dd, 0xa89c38ca18f6108b
-data8 0xd46f82fe293bc6d3, 0x85f9c982fcc002f3
-data8 0xa8cc81063b6e87ca, 0xd4ac57e9b7186420
-data8 0x862047e0e7ea554b, 0xa8fd00bfa409285e
-data8 0xd4e972becb04e8b8, 0x8646f2a26f7f5852
-data8 0xa92db8664d5516da, 0xd526d40a7a9b43a3
-data8 0x866dca21754096b5, 0xa95ea86b75cc2c20
-data8 0xd5647c5b73917370, 0x8694ceb8dfd17a37
-data8 0xa98fd141a4992deb, 0xd5a26c4201bd6d13
-data8 0x86bc00c49e9307e8, 0xa9c1335cae7446ba
-data8 0xd5e0a45015350a7e, 0x86dccd74fce79610
-data8 0xa9ea8686f556f645, 0xd614b539c6194104
-data8 0x870453c845acf90f, 0xaa1c52d17906bb19
-data8 0xd6537310e224283f, 0x872c089a1e90342c
-data8 0xaa4e59b046dab887, 0xd6927ab62244c917
-data8 0x8753ec4a92d16c5e, 0xaa809b9c60d1890b
-data8 0xd6d1ccc1fc4ef4b7, 0x877bff3aca19f6b4
-data8 0xaab319102f3f9b33, 0xd71169cea98fdded
-data8 0x879d88b6fe1c324c, 0xaadd5a18c1e21274
-data8 0xd746a66a5bc9f6d9, 0x87c5f346dbf98c3a
-data8 0xab1045f2ac31bdf5, 0xd786ce8f0fae5317
-data8 0x87e7c653efacef2c, 0xab3ae3ab2df7231e
-data8 0xd7bc7ff214c4e75a, 0x881089d4e73ffefc
-data8 0xab6e3f945d1e96fc, 0xd7fd35467a517ed1
-data8 0x88397e6a366f2a8a, 0xaba1d953a08fa94e
-data8 0xd83e38838648d815, 0x885bc559e5e1c081
-data8 0xabcd090db7ef4c3f, 0xd874a1db598b8951
-data8 0x887e2ee392bb7a93, 0xabf864602d7c323d
-data8 0xd8ab42205b80edaf, 0x88a7a8587e404257
-data8 0xac2ca5886ccf9b57, 0xd8ed1849d202f965
-data8 0x88ca5eda67594784, 0xac5861d4aa441f0f
-data8 0xd92432bd5a173685, 0x88f4356166bd590e
-data8 0xac8d183fe3a2fbed, 0xd9669ca45b03c23e
-data8 0x89173a0acf5ce026, 0xacb93703ff51571e
-data8 0xd99e3327cf89574e, 0x893a62a098b6a57b
-data8 0xace5830ad0c3f14b, 0xd9d602b19b100466
-data8 0x895daf637236ae2c, 0xad11fca5d78b3ff2
-data8 0xda0e0ba86c096841, 0x89883b9d1c2fa9c5
-data8 0xad4797fddf91a798, 0xda5195fcdb1c3dce
-data8 0x89abd8dd374a5d7b, 0xad747701e559ebcb
-data8 0xda8a1eb87a491f6c, 0x89cf9b1dcd197fa0
-data8 0xada184a47e9c7613, 0xdac2e230b91c3f84
-data8 0x89f382a258ea79de, 0xadcec13ab0dda8ff
-data8 0xdafbe0d0b66aea30, 0x8a178faf06648f29
-data8 0xadfc2d1a5fd21ba8, 0xdb351b04a8fafced
-data8 0x8a3bc288b3e1d18a, 0xae29c89a5053c33a
-data8 0xdb6e9139e33cdd8e, 0x8a601b74f4d1f835
-data8 0xae5794122b638df9, 0xdba843ded7151ea1
-data8 0x8a849aba14274764, 0xae858fda8137ae0a
-data8 0xdbe2336319b61fc8, 0x8aa9409f16cdbc9b
-data8 0xaeb3bc4ccc56d3d1, 0xdc1c60376789fa68
-data8 0x8ace0d6bbe2cb316, 0xaee219c374c09920
-data8 0xdc56cacda82d0cd5, 0x8af301688ab33558
-data8 0xaf10a899d3235fe7, 0xdc917398f2797814
-data8 0x8b181cdebe6f3206, 0xaf3f692c341fe8b4
-data8 0xdccc5b0d90a3e628, 0x8b3d60185fafcb7c
-data8 0xaf6e5bd7db9ae6c2, 0xdd0781a10469f0f2
-data8 0x8b62cb603bb2fad0, 0xaf9d80fb081cd91b
-data8 0xdd42e7ca0b52838f, 0x8b80d7d6bc4104de
-data8 0xafc35ce063eb3787, 0xdd729ad01c69114d
-data8 0x8ba68bf73ac74f39, 0xaff2ddcb5f28f03d
-data8 0xddae749c001fbf5e, 0x8bcc68fb9f9f7335
-data8 0xb022923b148e05c5, 0xddea8f50a51c69b1
-data8 0x8bf26f31c534fca2, 0xb0527a919adbf58b
-data8 0xde26eb69a0f0f111, 0x8c10f86e13a1a1f9
-data8 0xb078f3ab1d701c65, 0xde576480262399bc
-data8 0x8c3749916cc6abb5, 0xb0a93a6870649f31
-data8 0xde943789645933c8, 0x8c5dc4c4f7706032
-data8 0xb0d9b624d62ec856, 0xded14d58139a28af
-data8 0x8c7cac3a8c42e3e0, 0xb100a5f53fb3c8e1
-data8 0xdf025c00bbf2b5c7, 0x8ca373f1b7bf2716
-data8 0xb131821882f5540a, 0xdf3feb44d723a713
-data8 0x8cc29907fb951294, 0xb158bf8e4cb04055
-data8 0xdf715bc16c159be0, 0x8ce9ae4e9492aac8
-data8 0xb189fd69d56b238f, 0xdfaf66240e29cda8
-data8 0x8d0911dddbfdad0e, 0xb1b189958e8108e4
-data8 0xdfe139cbf6e19bdc, 0x8d3075c4f20f04ee
-data8 0xb1e32a8165b09832, 0xe01fc0fe94d9fc52
-data8 0x8d5018a9d4de77d5, 0xb20b0678fc271eec
-data8 0xe051f92ffcc0bd60, 0x8d77cc47dd143515
-data8 0xb23d0bd3f7592b6e, 0xe090feec9c9a06ac
-data8 0x8d97af6352739cb7, 0xb26538b2db8420dc
-data8 0xe0c39d0c9ff862d6, 0x8db7af523167800f
-data8 0xb28d89e339ceca14, 0xe0f668eeb99f188d
-data8 0x8ddfd80bc68c32ff, 0xb2c022ca12e55a16
-data8 0xe1362890eb663139, 0x8e00197e1e7c88fe
-data8 0xb2e8c6852c6b03f1, 0xe1695c7212aecbaa
-data8 0x8e207859f77e20e7, 0xb3118f4eda9fe40f
-data8 0xe19cbf0391bbbbe9, 0x8e40f4ce60c9f8e2
-data8 0xb33a7d6268109ebe, 0xe1d050901c531e85
-data8 0x8e69ba46cf2fde4d, 0xb36ddbc5ea70ec55
-data8 0xe2110903b4f4047a, 0x8e8a7a00bd7ae63e
-data8 0xb3971e9b39264023, 0xe2450559b4d80b6d
-data8 0x8eab57ef1cf2f529, 0xb3c0877ecc18e24a
-data8 0xe27931a231554ef3, 0x8ecc5442cffb1dad
-data8 0xb3ea16ae3a6c905f, 0xe2ad8e2ac3c5b04b
-data8 0x8eed6f2d2a4acbfe, 0xb413cc67aa0e4d2d
-data8 0xe2e21b41b9694cce, 0x8f0ea8dff24441ff
-data8 0xb43da8e9d163e1af, 0xe316d93615862714
-data8 0x8f385c95d696b817, 0xb47233773b84d425
-data8 0xe3590bd86a0d30f9, 0x8f59dc43edd930f3
-data8 0xb49c6825430fe730, 0xe38e38e38e38e38e
-data8 0x8f7b7b5f5ffad1c4, 0xb4c6c46bcdb27dcf
-data8 0xe3c397d1e6db7839, 0x8f9d3a1bea165f38
-data8 0xb4f1488c0b35d26f, 0xe3f928f5953feb9e
-data8 0x8fbf18adc34b66da, 0xb51bf4c7c51f0168
-data8 0xe42eeca17c62886c, 0x8fe117499e356095
-data8 0xb546c9616087ab9c, 0xe464e32943446305
-data8 0x90033624aa685f8d, 0xb571c69bdffd9a70
-data8 0xe49b0ce15747a8a2, 0x9025757495f36b86
-data8 0xb59cecbae56984c3, 0xe4d16a1eee94e9d4
-data8 0x903f3a5dcc091203, 0xb5bd64512bb14bb7
-data8 0xe4fa52107353f67d, 0x9061b2fceb2bdbab
-data8 0xb5e8d2a4bf5ba416, 0xe5310a471f4d2dc3
-data8 0x90844ca7211032a7, 0xb6146a9a1bc47819
-data8 0xe567f6f1c2b9c224, 0x90a7079403e6a15d
-data8 0xb6402c7749d621c0, 0xe59f18689a9e4c9a
-data8 0x90c9e3fbafd63799, 0xb66c1882fb435ea2
-data8 0xe5d66f04b8a68ecf, 0x90ece216c8a16ee4
-data8 0xb6982f048c999a56, 0xe60dfb2005c192e9
-data8 0x9110021e7b516f0a, 0xb6c47044075b4142
-data8 0xe645bd1544c7ea51, 0x912a708a39be9075
-data8 0xb6e5bd6bfd02bafd, 0xe66fb21b505b20a0
-data8 0x914dcc7b31146370, 0xb7124a2736ff8ef2
-data8 0xe6a7d32af4a7c59a, 0x91714af8cfe984d5
-data8 0xb73f026a01e94177, 0xe6e02b129c6a5ae4
-data8 0x918c00a6f3795e97, 0xb760a959f1d0a7a7
-data8 0xe70a9136a7403039, 0x91afbc299ed0295d
-data8 0xb78dae7e06868ab0, 0xe74349fb2d92a589
-data8 0x91d39add3e958db0, 0xb7badff8ad9e4e02
-data8 0xe77c3a9c86ed7d42, 0x91ee9920a8974d92
-data8 0xb7dce25b8e17ae9f, 0xe7a713f88151518a
-data8 0x9212b5fcac537c19, 0xb80a6226904045e2
-data8 0xe7e067453317ed2b, 0x9236f6b256923fcf
-data8 0xb8380f1cafd73c1c, 0xe819f37a81871bb5
-data8 0x92523ee6f90dcfc3, 0xb85a6ea8e321b4d8
-data8 0xe8454236bfaeca14, 0x9276bef031e6eb79
-data8 0xb8886b684ae7d2fa, 0xe87f32f24c3fc90e
-data8 0x929236ec237a24ad, 0xb8ab0726fa00cf5d
-data8 0xe8aacd8688892ba6, 0x92b6f70b7efe9dc3
-data8 0xb8d954a4d13b7cb1, 0xe8e523fd32f606f7
-data8 0x92d29f61eec7dc2b, 0xb8fc2d4f6cd9f04a
-data8 0xe9110b5311407927, 0x92f7a05d5b8ba92f
-data8 0xb92acc851476b1ab, 0xe94bc8bf0c108fa3
-data8 0x931379a403be5c16, 0xb94de2d841a184c2
-data8 0xe977fdc439c2ca3c, 0x9338bc44de2e3f34
-data8 0xb97cd4c36c92693c, 0xe9b3236528fc349e
-data8 0x9354c71412c69486, 0xb9a0297f172665e3
-data8 0xe9dfa70b745ac1b4, 0x937a4c273907e262
-data8 0xb9cf6f21e36c3924, 0xea1b36268d0eaa38
-data8 0x93968919f6e7975d, 0xb9f3030951267208
-data8 0xea480963fd394197, 0x93bc516fdd4680c9
-data8 0xba229d6a618e7c59, 0xea84034425f27484
-data8 0x93d8c123d9be59b2, 0xba467144459f9855
-data8 0xeab12713138dd1cc, 0x93f546c955e60076
-data8 0xba6a60c3c48f1a4b, 0xeade6db73a5e503b
-data8 0x941b70a65879079f, 0xba9a76056b67ee7a
-data8 0xeb1b0268343b121b, 0x943829f337410591
-data8 0xbabea699563ada6e, 0xeb489b0b2bdb5f14
-data8 0x9454f995765bc4d2, 0xbae2f350b262cc4b
-data8 0xeb765721e85f03d0, 0x947b86b57f5842ed
-data8 0xbb1385a23be24e57, 0xebb389645f222f62
-data8 0x94988aeb23470f86, 0xbb3814975e17c680
-data8 0xebe198f090607e0c, 0x94b5a5dc9695f42a
-data8 0xbb5cc031009bf467, 0xec0fcc9321024509
-data8 0x94d2d7a9170d8b42, 0xbb81889680024764
-data8 0xec3e247da8b82f61, 0x94f9e87dd78bf019
-data8 0xbbb2c0d8703ae95d, 0xec7c27d21321c9f7
-data8 0x95175019a503d89e, 0xbbd7cd09ba3c5463
-data8 0xecaad5278824e453, 0x9534cefa625fcb3a
-data8 0xbbfcf68c4977718f, 0xecd9a76d097d4e77
-data8 0x955265405c491a25, 0xbc223d88cfc88eee
-data8 0xed089ed5dcd99446, 0x9570130c1f9bb857
-data8 0xbc47a2284fee4ff8, 0xed37bb95add09a1c
-data8 0x9597ca4119525184, 0xbc79ac0916ed7b8a
-data8 0xed76c70508f904b6, 0x95b5af6fb5aa4d3c
-data8 0xbc9f5670d1a13030, 0xeda63bb05e7f93c6
-data8 0x95d3ac9273aafd7a, 0xbcc51f068cb95c1d
-data8 0xedd5d661daed2dc4, 0x95f1c1cafdfd3684
-data8 0xbceb05f4b30a9bc0, 0xee05974eef86b903
-data8 0x960fef3b430b8d5f, 0xbd110b6604c7d306
-data8 0xee357ead791fc670, 0x962e350575b409c5
-data8 0xbd372f8598620f19, 0xee658cb3c134a463
-data8 0x964c934c0dfc1708, 0xbd5d727edb6b3c7e
-data8 0xee95c1987f080211, 0x966b0a31c9c6bc7d
-data8 0xbd83d47d937bbc6d, 0xeec61d92d8c4314f
-data8 0x968999d9ad8d264e, 0xbdaa55addf1ae47d
-data8 0xeef6a0da64a014ac, 0x96a8426705198795
-data8 0xbdd0f63c36aa73f0, 0xef274ba72a07c811
-data8 0x96c703fd64445ee5, 0xbdf7b6556d550a15
-data8 0xef581e31a2c91260, 0x96e5dec0a7b4268d
-data8 0xbe1e9626b1ffa96b, 0xef8918b2bc43aec6
-data8 0x9704d2d4f59f79f3, 0xbe4595dd903e5371
-data8 0xefba3b63d89d7cbf, 0x9723e05ebe91b9b0
-data8 0xbe6cb5a7f14bc935, 0xefeb867ecffaa607
-data8 0x97430782be323831, 0xbe93f5b41d047cf7
-data8 0xf01cfa3df1b9c9fa, 0x97624865fc0df8bf
-data8 0xbebb5630bae4c15f, 0xf04e96dc05b43e2d
-data8 0x9781a32dcc640b2a, 0xbee2d74cd30a430c
-data8 0xf0805c944d827454, 0x97a117ffd0f48e46
-data8 0xbf0a7937cf38d981, 0xf0b24ba285c495cb
-data8 0x97c0a701f9d263c9, 0xbf323c217be2bc8c
-data8 0xf0e46442e76f6569, 0x97e0505a8637a036
-data8 0xbf5a203a09342bbb, 0xf116a6b2291d7896
-data8 0x97f57a9fb0b08c6e, 0xbf74cad1c14ebfc4
-data8 0xf1383fa9e9b5b381, 0x9815503365914a9d
-data8 0xbf9ce6a497a89f78, 0xf16ac84f90083b9b
-data8 0x98354085054fd204, 0xbfc52428bec6e72f
-data8 0xf19d7b686dcb03d7, 0x98554bbbf8a77902
-data8 0xbfed838fddab024b, 0xf1d0593311db1757
-data8 0x987571fffb7f94f6, 0xc016050c0420981a
-data8 0xf20361ee8f1c711e, 0x9895b3791dd03c23
-data8 0xc03ea8cfabddc330, 0xf23695da7de51d3f
-data8 0x98ab43a5fc65d0c8, 0xc059d3cbd65ddbce
-data8 0xf258d095e465cc35, 0x98cbb2d196bd713d
-data8 0xc082b122a3c78c9d, 0xf28c4d0bfc982b34
-data8 0x98ec3d9ec7b6f21a, 0xc0abb1499ae736c4
-data8 0xf2bff55eb3f0ea71, 0x990ce436db5e8344
-data8 0xc0d4d474c3aedaaf, 0xf2f3c9cf9884636e
-data8 0x9922b8218160967a, 0xc0f054ca33eb3437
-data8 0xf31670135ab9cc0f, 0x99438d686f75779d
-data8 0xc119b2c67e600ed0, 0xf34a8e9f0b54cdfb
-data8 0x99647eea131fa20b, 0xc1433453de2033ff
-data8 0xf37ed9fa6b8add3f, 0x997a85045a47c6d0
-data8 0xc15ef3e44e10032d, 0xf3a1cfe884ef6bb6
-data8 0x999ba5f14f8add02, 0xc188b130431d80e6
-data8 0xf3d66689dcc8e8d3, 0x99bce38b5465ecae
-data8 0xc1b2929d6067730e, 0xf40b2ab069d5c96a
-data8 0x99d31ca0887f30f9, 0xc1ce9268f31cc734
-data8 0xf42e718b90c8bc16, 0x99f48a669c74c09e
-data8 0xc1f8b0877c1b0c08, 0xf463822a0a3b4b00
-data8 0x9a16154eb445c873, 0xc222f35a87b415ba
-data8 0xf498c1076015faf8, 0x9a2c822ec198d667
-data8 0xc23f3467349e5c88, 0xf4bc5a19a33990b5
-data8 0x9a4e3e080cd91b78, 0xc269b4e40e088c01
-data8 0xf4f1e6a7d6f5425f, 0x9a70177afe52322e
-data8 0xc2945aac24daaf6e, 0xf527a232cf6be334
-data8 0x9a86b8fa94eebe10, 0xc2b0de05e43c1d66
-data8 0xf54b8ecdcda90851, 0x9aa8c42866ae2958
-data8 0xc2dbc275e1229d09, 0xf5819949c7ad87b4
-data8 0x9abf86f9e12fc45e, 0xc2f86fca9d80eeff
-data8 0xf5a5bac9213b48a9, 0x9ae1c462fc05f49d
-data8 0xc323938449a2587e, 0xf5dc1501f324a812
-data8 0x9af8a8dc936b84d0, 0xc3406b40a538ed20
-data8 0xf6006bee86b5589e, 0x9b1b19033be35730
-data8 0xc36bcee8211d15e0, 0xf63716b2fa067fa4
-data8 0x9b3da7daf04c2892, 0xc397593adf2ba366
-data8 0xf66df22fb6132b9c, 0x9b54c2e4c8a9012b
-data8 0xc3b475b6206155d5, 0xf6929fb98225deb1
-data8 0x9b77854e6c661200, 0xc3e0410243b97383
-data8 0xf6c9cd13021e3fea, 0x9b8ec2e678d56d2f
-data8 0xc3fd890709833d37, 0xf6eeb177472cedae
-data8 0x9ba60e6a5ca133b6, 0xc41ae295f7e7fa06
-data8 0xf713abf4cb0b3afb, 0x9bc919ea66a151a4
-data8 0xc44709f7bb8a4dd2, 0xf74b4d5333684ef1
-data8 0x9be0887c09ef82bb, 0xc4648fb0e0bec4c1
-data8 0xf7707f75a72f8e94, 0x9c03c8d5fffc3503
-data8 0xc490f9a94695ba14, 0xf7a874b97927af44
-data8 0x9c1b5ad21a81cbb9, 0xc4aeac0173b7d390
-data8 0xf7cddf140aedf1d8, 0x9c3ed09216e9ca02
-data8 0xc4db5941007aa853, 0xf806291bacb7f7a9
-data8 0x9c568656c0423def, 0xc4f938aec206291a
-data8 0xf82bcc43b92eafef, 0x9c7a320af242ce60
-data8 0xc52629e899dfd622, 0xf8646bf0defb759e
-data8 0x9c920bf7a8c01dc2, 0xc54436e44043b965
-data8 0xf88a487dfc3ff5f7, 0x9ca9f475d98b159c
-data8 0xc562563abf9ea07f, 0xf8b03c2b46cdc17f
-data8 0x9ccdeca60e80b5f8, 0xc58fa7d1dc42921c
-data8 0xf8e95541c152ae7a, 0x9ce5f9d4653d4902
-data8 0xc5adf561b91e110a, 0xf90f832c2700c160
-data8 0x9cfe15cb38bfdd8e, 0xc5cc5591bdbd82fa
-data8 0xf935c88e0c7f419b, 0x9d225b983f6c1f96
-data8 0xc5fa08f1ff20593c, 0xf96f5cd84fd86873
-data8 0x9d3a9cca32261ed7, 0xc618980a79ce6862
-data8 0xf995dd53ebdd9d6d, 0x9d52ecfccebe1768
-data8 0xc6373a09e34b50fa, 0xf9bc75a034436a41
-data8 0x9d77818d95b82f86, 0xc66550a6e0baaf35
-data8 0xf9f686f26d5518de, 0x9d8ff7893fa4706c
-data8 0xc6842241926342c9, 0xfa1d5b39b910a8c5
-data8 0x9da87cbef36f2a5e, 0xc6a3070b7c93bb9e
-data8 0xfa4447acc4ecbfd2, 0x9dcd6140b4a35aeb
-data8 0xc6d18260bb84081b, 0xfa7ed7e51e6fdfb4
-data8 0x9de60cd06dc6e2d4, 0xc6f0977c9416828b
-data8 0xfaa601394d49a1a0, 0x9dfec7d4cc43b76f
-data8 0xc70fc0117c641630, 0xfacd431644ce0e40
-data8 0x9e17925ec9fccc4a, 0xc72efc34d7e615be
-data8 0xfaf49d96f7a75909, 0x9e3cdf6db57dc075
-data8 0xc75dfb441594141e, 0xfb2fd3c65e562fd5
-data8 0x9e55d110b63637a8, 0xc77d68aa019bda4c
-data8 0xfb576c5762024805, 0x9e6ed27594550d2e
-data8 0xc79ce9ea478dbc4f, 0xfb7f1debc22c4040
-data8 0x9e87e3adc385d393, 0xc7bc7f1ae453219d
-data8 0xfba6e89f32d0190a, 0x9ead9b54b37a1055
-data8 0xc7ec0476e15e141a, 0xfbe2c803a0894893
-data8 0x9ec6d46a3d7de215, 0xc80bcbe16f1d540f
-data8 0xfc0ad1ff0ed9ecf0, 0x9ee01d9108be3154
-data8 0xc82ba78a5d349735, 0xfc32f57bdfbcbe7f
-data8 0x9ef976db07288d04, 0xc84b978847a06b87
-data8 0xfc5b32968f99b21c, 0x9f12e05a4759ec25
-data8 0xc86b9bf1ee817bc6, 0xfc83896bc861ab08
-data8 0x9f2c5a20f4da6668, 0xc88bb4de3667cdf4
-data8 0xfcabfa1861ed4815, 0x9f52af78ed1733ca
-data8 0xc8bc00e7fe9e23a3, 0xfce8d3cea7d3163e
-data8 0x9f6c52426a39d003, 0xc8dc4d7ff2d25232
-data8 0xfd118595143ee273, 0x9f860593d42fd7f3
-data8 0xc8fcaeebcb40eb47, 0xfd3a519943d4865a
-data8 0x9f9fc97fdb96bd51, 0xc91d25431426a663
-data8 0xfd6337f8e1ae5a4b, 0x9fb99e194f4a7037
-data8 0xc93db09d7fdb2949, 0xfd8c38d1c8e927eb
-data8 0x9fd383731ca51db9, 0xc95e5112e721582a
-data8 0xfdb5544205095a53, 0x9fed79a04fbf9423
-data8 0xc97f06bb49787677, 0xfdde8a67d2613531
-data8 0xa00780b413b24ee8, 0xc99fd1aecd6e1b06
-data8 0xfe07db619e781611, 0xa02eab2c4474b0cd
-data8 0xc9d12a3e27bb1625, 0xfe460768d80bf758
-data8 0xa048dcd51ccfd142, 0xc9f22ad82ba3d5f0
-data8 0xfe6f9bfb06cd32f6, 0xa0631fa894b11b8d
-data8 0xca134113105e67b2, 0xfe994bcd3d14fcc2
-data8 0xa07d73ba65e680af, 0xca346d07b045a876
-data8 0xfec316fecaf3f2ab, 0xa097d91e6aaf71b0
-data8 0xca55aecf0e94bb88, 0xfeecfdaf33fadb80
-data8 0xa0b24fe89e02602f, 0xca77068257be9bab
-data8 0xff16fffe2fa8fad6, 0xa0ccd82d1bd2f68b
-data8 0xca98743ae1c693a8, 0xff411e0ba9db886d
-data8 0xa0e77200215909e6, 0xcab9f8122c99a101
-data8 0xff6b57f7c33e4e9a, 0xa1021d760d584855
-data8 0xcadb9221e268c3b5, 0xff95ade2d1bd7358
-data8 0xa11cdaa36068a57d, 0xcafd4283d8043dfd
-data8 0xffc01fed60f86fb5, 0xa137a99cbd3f880b
-data8 0xcb1f09520d37c6fb, 0xffeaae3832b63956
-ASM_SIZE_DIRECTIVE(T_table)
-
-
-
-
-
-
-.align 32
-.global cbrtf#
+LOCAL_OBJECT_START(poly_coeffs)
+
+       data8 0xaaaab19b7e1f5ef9, 0x00003ffd // ~ 1/3
+       data8 0xe38e5192a5a8e56c, 0x00003ffb // ~ 1/9
+LOCAL_OBJECT_END(poly_coeffs)
+
+//   For every entry B in the frcpa table, this table contains
+// the significands of cbrt(1/B), cbrt(2/B), cbrt(4/B).
+// The index to this table is the same as the frcpa index.
+
+LOCAL_OBJECT_START(T_table)
+
+       data8 0x80155c748c374836, 0xa160019ed37fb4ae
+       data8 0xcb51ddcb9e93095e, 0x8040404b0879f7f9
+       data8 0xa1960b5966da4608, 0xcb95f333968ad59b
+       data8 0x806b5dce4b405c10, 0xa1cc5dbe6dc2aab4
+       data8 0xcbda64292d3ffd97, 0x8096b586974669b1
+       data8 0xa202f97995b69c0d, 0xcc1f3184af961596
+       data8 0x80bcd273d952a028, 0xa232fe6eb0c0577d
+       data8 0xcc5bb1ac954d33e2, 0x80e898c52813f2f3
+       data8 0xa26a2582012f6e17, 0xcca12e9831fc6402
+       data8 0x81149add67c2d208, 0xa2a197e5d10465cb
+       data8 0xcce70a67b64f24ad, 0x813b4e2c856b6e9a
+       data8 0xa2d25a532efefbc8, 0xcd24794726477ea5
+       data8 0x8167c1dde03de7aa, 0xa30a5bd6e49e4ab8
+       data8 0xcd6b096a0b70ee87, 0x818ed973b811135e
+       data8 0xa33b9c9b59879e24, 0xcda9177738b15a90
+       data8 0x81bbc0c33e13ec98, 0xa3742fca6a3c1f21
+       data8 0xcdf05f2247dffab9, 0x81e33e69fbe7504a
+       data8 0xa3a5f1273887bf22, 0xce2f0f347f96f906
+       data8 0x820aec524e3c23e9, 0xa3d7ef508ff11574
+       data8 0xce6e0be0cd551a61, 0x823880f78e70b805
+       data8 0xa4115ce30548bc15, 0xceb666b2c347d1de
+       data8 0x826097a62a8e5200, 0xa443df0e53df577a
+       data8 0xcef609b0cb874f00, 0x8288dfe00e9b5eaf
+       data8 0xa4769fa5913c0ec3, 0xcf35fb5447e5c765
+       data8 0x82b15a10c5371624, 0xa4a99f303bc7def5
+       data8 0xcf763c47ee869f00, 0x82da06a527b18937
+       data8 0xa4dcde37779adf4b, 0xcfb6cd3888d71785
+       data8 0x8302e60b635ab394, 0xa5105d46152c938a
+       data8 0xcff7aed4fbfbb447, 0x832bf8b2feec2f0e
+       data8 0xa5441ce89825cb8d, 0xd038e1ce5167e3c6
+       data8 0x83553f0ce00e276b, 0xa5781dad3e54d899
+       data8 0xd07a66d7bfa0ebba, 0x837eb98b50f8322a
+       data8 0xa5ac602406c4e68c, 0xd0bc3ea6b32d1b21
+       data8 0x83a270f44c84f699, 0xa5d9601d95c2c0bc
+       data8 0xd0f4f0e8f36c1bf8, 0x83cc4d7cfcfac5ca
+       data8 0xa60e1e1a2de14745, 0xd1376458e34b037e
+       data8 0x83f65f78a8872b4c, 0xa6431f6e3fbd9658
+       data8 0xd17a2ca133f78572, 0x8420a75f2f7b53c8
+       data8 0xa67864b0d432fda4, 0xd1bd4a80301c5715
+       data8 0x844510461ff14209, 0xa6a6444aa0243c0b
+       data8 0xd1f71682b2fa4575, 0x846fbd91b930bed2
+       data8 0xa6dc094d10f25792, 0xd23ad555f773f059
+       data8 0x84947e18234f3294, 0xa70a574cc02bba69
+       data8 0xd2752c7039a5bf73, 0x84bf92755825045a
+       data8 0xa7409e2af9549084, 0xd2b98ee008c06b59
+       data8 0x84e4ac0ee112ba51, 0xa76f5c64ca2cf13b
+       data8 0xd2f4735ffd700280, 0x8509ef44b86f20be
+       data8 0xa79e4f0babab5dc0, 0xd32f99ed6d9ac0e1
+       data8 0x85359d5d91768427, 0xa7d5579ae5164b85
+       data8 0xd374f0666c75d51c, 0x855b3bd5b7384357
+       data8 0xa804bd3c6fe61cc8, 0xd3b0a7d13618e4a1
+       data8 0x858104f0c415f79a, 0xa8345895e5250a5a
+       data8 0xd3eca2ea53bcec0c, 0x85a6f90390d29864
+       data8 0xa8642a122b44ef0b, 0xd428e23874f13a17
+       data8 0x85d3772fcd56a1dd, 0xa89c38ca18f6108b
+       data8 0xd46f82fe293bc6d3, 0x85f9c982fcc002f3
+       data8 0xa8cc81063b6e87ca, 0xd4ac57e9b7186420
+       data8 0x862047e0e7ea554b, 0xa8fd00bfa409285e
+       data8 0xd4e972becb04e8b8, 0x8646f2a26f7f5852
+       data8 0xa92db8664d5516da, 0xd526d40a7a9b43a3
+       data8 0x866dca21754096b5, 0xa95ea86b75cc2c20
+       data8 0xd5647c5b73917370, 0x8694ceb8dfd17a37
+       data8 0xa98fd141a4992deb, 0xd5a26c4201bd6d13
+       data8 0x86bc00c49e9307e8, 0xa9c1335cae7446ba
+       data8 0xd5e0a45015350a7e, 0x86dccd74fce79610
+       data8 0xa9ea8686f556f645, 0xd614b539c6194104
+       data8 0x870453c845acf90f, 0xaa1c52d17906bb19
+       data8 0xd6537310e224283f, 0x872c089a1e90342c
+       data8 0xaa4e59b046dab887, 0xd6927ab62244c917
+       data8 0x8753ec4a92d16c5e, 0xaa809b9c60d1890b
+       data8 0xd6d1ccc1fc4ef4b7, 0x877bff3aca19f6b4
+       data8 0xaab319102f3f9b33, 0xd71169cea98fdded
+       data8 0x879d88b6fe1c324c, 0xaadd5a18c1e21274
+       data8 0xd746a66a5bc9f6d9, 0x87c5f346dbf98c3a
+       data8 0xab1045f2ac31bdf5, 0xd786ce8f0fae5317
+       data8 0x87e7c653efacef2c, 0xab3ae3ab2df7231e
+       data8 0xd7bc7ff214c4e75a, 0x881089d4e73ffefc
+       data8 0xab6e3f945d1e96fc, 0xd7fd35467a517ed1
+       data8 0x88397e6a366f2a8a, 0xaba1d953a08fa94e
+       data8 0xd83e38838648d815, 0x885bc559e5e1c081
+       data8 0xabcd090db7ef4c3f, 0xd874a1db598b8951
+       data8 0x887e2ee392bb7a93, 0xabf864602d7c323d
+       data8 0xd8ab42205b80edaf, 0x88a7a8587e404257
+       data8 0xac2ca5886ccf9b57, 0xd8ed1849d202f965
+       data8 0x88ca5eda67594784, 0xac5861d4aa441f0f
+       data8 0xd92432bd5a173685, 0x88f4356166bd590e
+       data8 0xac8d183fe3a2fbed, 0xd9669ca45b03c23e
+       data8 0x89173a0acf5ce026, 0xacb93703ff51571e
+       data8 0xd99e3327cf89574e, 0x893a62a098b6a57b
+       data8 0xace5830ad0c3f14b, 0xd9d602b19b100466
+       data8 0x895daf637236ae2c, 0xad11fca5d78b3ff2
+       data8 0xda0e0ba86c096841, 0x89883b9d1c2fa9c5
+       data8 0xad4797fddf91a798, 0xda5195fcdb1c3dce
+       data8 0x89abd8dd374a5d7b, 0xad747701e559ebcb
+       data8 0xda8a1eb87a491f6c, 0x89cf9b1dcd197fa0
+       data8 0xada184a47e9c7613, 0xdac2e230b91c3f84
+       data8 0x89f382a258ea79de, 0xadcec13ab0dda8ff
+       data8 0xdafbe0d0b66aea30, 0x8a178faf06648f29
+       data8 0xadfc2d1a5fd21ba8, 0xdb351b04a8fafced
+       data8 0x8a3bc288b3e1d18a, 0xae29c89a5053c33a
+       data8 0xdb6e9139e33cdd8e, 0x8a601b74f4d1f835
+       data8 0xae5794122b638df9, 0xdba843ded7151ea1
+       data8 0x8a849aba14274764, 0xae858fda8137ae0a
+       data8 0xdbe2336319b61fc8, 0x8aa9409f16cdbc9b
+       data8 0xaeb3bc4ccc56d3d1, 0xdc1c60376789fa68
+       data8 0x8ace0d6bbe2cb316, 0xaee219c374c09920
+       data8 0xdc56cacda82d0cd5, 0x8af301688ab33558
+       data8 0xaf10a899d3235fe7, 0xdc917398f2797814
+       data8 0x8b181cdebe6f3206, 0xaf3f692c341fe8b4
+       data8 0xdccc5b0d90a3e628, 0x8b3d60185fafcb7c
+       data8 0xaf6e5bd7db9ae6c2, 0xdd0781a10469f0f2
+       data8 0x8b62cb603bb2fad0, 0xaf9d80fb081cd91b
+       data8 0xdd42e7ca0b52838f, 0x8b80d7d6bc4104de
+       data8 0xafc35ce063eb3787, 0xdd729ad01c69114d
+       data8 0x8ba68bf73ac74f39, 0xaff2ddcb5f28f03d
+       data8 0xddae749c001fbf5e, 0x8bcc68fb9f9f7335
+       data8 0xb022923b148e05c5, 0xddea8f50a51c69b1
+       data8 0x8bf26f31c534fca2, 0xb0527a919adbf58b
+       data8 0xde26eb69a0f0f111, 0x8c10f86e13a1a1f9
+       data8 0xb078f3ab1d701c65, 0xde576480262399bc
+       data8 0x8c3749916cc6abb5, 0xb0a93a6870649f31
+       data8 0xde943789645933c8, 0x8c5dc4c4f7706032
+       data8 0xb0d9b624d62ec856, 0xded14d58139a28af
+       data8 0x8c7cac3a8c42e3e0, 0xb100a5f53fb3c8e1
+       data8 0xdf025c00bbf2b5c7, 0x8ca373f1b7bf2716
+       data8 0xb131821882f5540a, 0xdf3feb44d723a713
+       data8 0x8cc29907fb951294, 0xb158bf8e4cb04055
+       data8 0xdf715bc16c159be0, 0x8ce9ae4e9492aac8
+       data8 0xb189fd69d56b238f, 0xdfaf66240e29cda8
+       data8 0x8d0911dddbfdad0e, 0xb1b189958e8108e4
+       data8 0xdfe139cbf6e19bdc, 0x8d3075c4f20f04ee
+       data8 0xb1e32a8165b09832, 0xe01fc0fe94d9fc52
+       data8 0x8d5018a9d4de77d5, 0xb20b0678fc271eec
+       data8 0xe051f92ffcc0bd60, 0x8d77cc47dd143515
+       data8 0xb23d0bd3f7592b6e, 0xe090feec9c9a06ac
+       data8 0x8d97af6352739cb7, 0xb26538b2db8420dc
+       data8 0xe0c39d0c9ff862d6, 0x8db7af523167800f
+       data8 0xb28d89e339ceca14, 0xe0f668eeb99f188d
+       data8 0x8ddfd80bc68c32ff, 0xb2c022ca12e55a16
+       data8 0xe1362890eb663139, 0x8e00197e1e7c88fe
+       data8 0xb2e8c6852c6b03f1, 0xe1695c7212aecbaa
+       data8 0x8e207859f77e20e7, 0xb3118f4eda9fe40f
+       data8 0xe19cbf0391bbbbe9, 0x8e40f4ce60c9f8e2
+       data8 0xb33a7d6268109ebe, 0xe1d050901c531e85
+       data8 0x8e69ba46cf2fde4d, 0xb36ddbc5ea70ec55
+       data8 0xe2110903b4f4047a, 0x8e8a7a00bd7ae63e
+       data8 0xb3971e9b39264023, 0xe2450559b4d80b6d
+       data8 0x8eab57ef1cf2f529, 0xb3c0877ecc18e24a
+       data8 0xe27931a231554ef3, 0x8ecc5442cffb1dad
+       data8 0xb3ea16ae3a6c905f, 0xe2ad8e2ac3c5b04b
+       data8 0x8eed6f2d2a4acbfe, 0xb413cc67aa0e4d2d
+       data8 0xe2e21b41b9694cce, 0x8f0ea8dff24441ff
+       data8 0xb43da8e9d163e1af, 0xe316d93615862714
+       data8 0x8f385c95d696b817, 0xb47233773b84d425
+       data8 0xe3590bd86a0d30f9, 0x8f59dc43edd930f3
+       data8 0xb49c6825430fe730, 0xe38e38e38e38e38e
+       data8 0x8f7b7b5f5ffad1c4, 0xb4c6c46bcdb27dcf
+       data8 0xe3c397d1e6db7839, 0x8f9d3a1bea165f38
+       data8 0xb4f1488c0b35d26f, 0xe3f928f5953feb9e
+       data8 0x8fbf18adc34b66da, 0xb51bf4c7c51f0168
+       data8 0xe42eeca17c62886c, 0x8fe117499e356095
+       data8 0xb546c9616087ab9c, 0xe464e32943446305
+       data8 0x90033624aa685f8d, 0xb571c69bdffd9a70
+       data8 0xe49b0ce15747a8a2, 0x9025757495f36b86
+       data8 0xb59cecbae56984c3, 0xe4d16a1eee94e9d4
+       data8 0x903f3a5dcc091203, 0xb5bd64512bb14bb7
+       data8 0xe4fa52107353f67d, 0x9061b2fceb2bdbab
+       data8 0xb5e8d2a4bf5ba416, 0xe5310a471f4d2dc3
+       data8 0x90844ca7211032a7, 0xb6146a9a1bc47819
+       data8 0xe567f6f1c2b9c224, 0x90a7079403e6a15d
+       data8 0xb6402c7749d621c0, 0xe59f18689a9e4c9a
+       data8 0x90c9e3fbafd63799, 0xb66c1882fb435ea2
+       data8 0xe5d66f04b8a68ecf, 0x90ece216c8a16ee4
+       data8 0xb6982f048c999a56, 0xe60dfb2005c192e9
+       data8 0x9110021e7b516f0a, 0xb6c47044075b4142
+       data8 0xe645bd1544c7ea51, 0x912a708a39be9075
+       data8 0xb6e5bd6bfd02bafd, 0xe66fb21b505b20a0
+       data8 0x914dcc7b31146370, 0xb7124a2736ff8ef2
+       data8 0xe6a7d32af4a7c59a, 0x91714af8cfe984d5
+       data8 0xb73f026a01e94177, 0xe6e02b129c6a5ae4
+       data8 0x918c00a6f3795e97, 0xb760a959f1d0a7a7
+       data8 0xe70a9136a7403039, 0x91afbc299ed0295d
+       data8 0xb78dae7e06868ab0, 0xe74349fb2d92a589
+       data8 0x91d39add3e958db0, 0xb7badff8ad9e4e02
+       data8 0xe77c3a9c86ed7d42, 0x91ee9920a8974d92
+       data8 0xb7dce25b8e17ae9f, 0xe7a713f88151518a
+       data8 0x9212b5fcac537c19, 0xb80a6226904045e2
+       data8 0xe7e067453317ed2b, 0x9236f6b256923fcf
+       data8 0xb8380f1cafd73c1c, 0xe819f37a81871bb5
+       data8 0x92523ee6f90dcfc3, 0xb85a6ea8e321b4d8
+       data8 0xe8454236bfaeca14, 0x9276bef031e6eb79
+       data8 0xb8886b684ae7d2fa, 0xe87f32f24c3fc90e
+       data8 0x929236ec237a24ad, 0xb8ab0726fa00cf5d
+       data8 0xe8aacd8688892ba6, 0x92b6f70b7efe9dc3
+       data8 0xb8d954a4d13b7cb1, 0xe8e523fd32f606f7
+       data8 0x92d29f61eec7dc2b, 0xb8fc2d4f6cd9f04a
+       data8 0xe9110b5311407927, 0x92f7a05d5b8ba92f
+       data8 0xb92acc851476b1ab, 0xe94bc8bf0c108fa3
+       data8 0x931379a403be5c16, 0xb94de2d841a184c2
+       data8 0xe977fdc439c2ca3c, 0x9338bc44de2e3f34
+       data8 0xb97cd4c36c92693c, 0xe9b3236528fc349e
+       data8 0x9354c71412c69486, 0xb9a0297f172665e3
+       data8 0xe9dfa70b745ac1b4, 0x937a4c273907e262
+       data8 0xb9cf6f21e36c3924, 0xea1b36268d0eaa38
+       data8 0x93968919f6e7975d, 0xb9f3030951267208
+       data8 0xea480963fd394197, 0x93bc516fdd4680c9
+       data8 0xba229d6a618e7c59, 0xea84034425f27484
+       data8 0x93d8c123d9be59b2, 0xba467144459f9855
+       data8 0xeab12713138dd1cc, 0x93f546c955e60076
+       data8 0xba6a60c3c48f1a4b, 0xeade6db73a5e503b
+       data8 0x941b70a65879079f, 0xba9a76056b67ee7a
+       data8 0xeb1b0268343b121b, 0x943829f337410591
+       data8 0xbabea699563ada6e, 0xeb489b0b2bdb5f14
+       data8 0x9454f995765bc4d2, 0xbae2f350b262cc4b
+       data8 0xeb765721e85f03d0, 0x947b86b57f5842ed
+       data8 0xbb1385a23be24e57, 0xebb389645f222f62
+       data8 0x94988aeb23470f86, 0xbb3814975e17c680
+       data8 0xebe198f090607e0c, 0x94b5a5dc9695f42a
+       data8 0xbb5cc031009bf467, 0xec0fcc9321024509
+       data8 0x94d2d7a9170d8b42, 0xbb81889680024764
+       data8 0xec3e247da8b82f61, 0x94f9e87dd78bf019
+       data8 0xbbb2c0d8703ae95d, 0xec7c27d21321c9f7
+       data8 0x95175019a503d89e, 0xbbd7cd09ba3c5463
+       data8 0xecaad5278824e453, 0x9534cefa625fcb3a
+       data8 0xbbfcf68c4977718f, 0xecd9a76d097d4e77
+       data8 0x955265405c491a25, 0xbc223d88cfc88eee
+       data8 0xed089ed5dcd99446, 0x9570130c1f9bb857
+       data8 0xbc47a2284fee4ff8, 0xed37bb95add09a1c
+       data8 0x9597ca4119525184, 0xbc79ac0916ed7b8a
+       data8 0xed76c70508f904b6, 0x95b5af6fb5aa4d3c
+       data8 0xbc9f5670d1a13030, 0xeda63bb05e7f93c6
+       data8 0x95d3ac9273aafd7a, 0xbcc51f068cb95c1d
+       data8 0xedd5d661daed2dc4, 0x95f1c1cafdfd3684
+       data8 0xbceb05f4b30a9bc0, 0xee05974eef86b903
+       data8 0x960fef3b430b8d5f, 0xbd110b6604c7d306
+       data8 0xee357ead791fc670, 0x962e350575b409c5
+       data8 0xbd372f8598620f19, 0xee658cb3c134a463
+       data8 0x964c934c0dfc1708, 0xbd5d727edb6b3c7e
+       data8 0xee95c1987f080211, 0x966b0a31c9c6bc7d
+       data8 0xbd83d47d937bbc6d, 0xeec61d92d8c4314f
+       data8 0x968999d9ad8d264e, 0xbdaa55addf1ae47d
+       data8 0xeef6a0da64a014ac, 0x96a8426705198795
+       data8 0xbdd0f63c36aa73f0, 0xef274ba72a07c811
+       data8 0x96c703fd64445ee5, 0xbdf7b6556d550a15
+       data8 0xef581e31a2c91260, 0x96e5dec0a7b4268d
+       data8 0xbe1e9626b1ffa96b, 0xef8918b2bc43aec6
+       data8 0x9704d2d4f59f79f3, 0xbe4595dd903e5371
+       data8 0xefba3b63d89d7cbf, 0x9723e05ebe91b9b0
+       data8 0xbe6cb5a7f14bc935, 0xefeb867ecffaa607
+       data8 0x97430782be323831, 0xbe93f5b41d047cf7
+       data8 0xf01cfa3df1b9c9fa, 0x97624865fc0df8bf
+       data8 0xbebb5630bae4c15f, 0xf04e96dc05b43e2d
+       data8 0x9781a32dcc640b2a, 0xbee2d74cd30a430c
+       data8 0xf0805c944d827454, 0x97a117ffd0f48e46
+       data8 0xbf0a7937cf38d981, 0xf0b24ba285c495cb
+       data8 0x97c0a701f9d263c9, 0xbf323c217be2bc8c
+       data8 0xf0e46442e76f6569, 0x97e0505a8637a036
+       data8 0xbf5a203a09342bbb, 0xf116a6b2291d7896
+       data8 0x97f57a9fb0b08c6e, 0xbf74cad1c14ebfc4
+       data8 0xf1383fa9e9b5b381, 0x9815503365914a9d
+       data8 0xbf9ce6a497a89f78, 0xf16ac84f90083b9b
+       data8 0x98354085054fd204, 0xbfc52428bec6e72f
+       data8 0xf19d7b686dcb03d7, 0x98554bbbf8a77902
+       data8 0xbfed838fddab024b, 0xf1d0593311db1757
+       data8 0x987571fffb7f94f6, 0xc016050c0420981a
+       data8 0xf20361ee8f1c711e, 0x9895b3791dd03c23
+       data8 0xc03ea8cfabddc330, 0xf23695da7de51d3f
+       data8 0x98ab43a5fc65d0c8, 0xc059d3cbd65ddbce
+       data8 0xf258d095e465cc35, 0x98cbb2d196bd713d
+       data8 0xc082b122a3c78c9d, 0xf28c4d0bfc982b34
+       data8 0x98ec3d9ec7b6f21a, 0xc0abb1499ae736c4
+       data8 0xf2bff55eb3f0ea71, 0x990ce436db5e8344
+       data8 0xc0d4d474c3aedaaf, 0xf2f3c9cf9884636e
+       data8 0x9922b8218160967a, 0xc0f054ca33eb3437
+       data8 0xf31670135ab9cc0f, 0x99438d686f75779d
+       data8 0xc119b2c67e600ed0, 0xf34a8e9f0b54cdfb
+       data8 0x99647eea131fa20b, 0xc1433453de2033ff
+       data8 0xf37ed9fa6b8add3f, 0x997a85045a47c6d0
+       data8 0xc15ef3e44e10032d, 0xf3a1cfe884ef6bb6
+       data8 0x999ba5f14f8add02, 0xc188b130431d80e6
+       data8 0xf3d66689dcc8e8d3, 0x99bce38b5465ecae
+       data8 0xc1b2929d6067730e, 0xf40b2ab069d5c96a
+       data8 0x99d31ca0887f30f9, 0xc1ce9268f31cc734
+       data8 0xf42e718b90c8bc16, 0x99f48a669c74c09e
+       data8 0xc1f8b0877c1b0c08, 0xf463822a0a3b4b00
+       data8 0x9a16154eb445c873, 0xc222f35a87b415ba
+       data8 0xf498c1076015faf8, 0x9a2c822ec198d667
+       data8 0xc23f3467349e5c88, 0xf4bc5a19a33990b5
+       data8 0x9a4e3e080cd91b78, 0xc269b4e40e088c01
+       data8 0xf4f1e6a7d6f5425f, 0x9a70177afe52322e
+       data8 0xc2945aac24daaf6e, 0xf527a232cf6be334
+       data8 0x9a86b8fa94eebe10, 0xc2b0de05e43c1d66
+       data8 0xf54b8ecdcda90851, 0x9aa8c42866ae2958
+       data8 0xc2dbc275e1229d09, 0xf5819949c7ad87b4
+       data8 0x9abf86f9e12fc45e, 0xc2f86fca9d80eeff
+       data8 0xf5a5bac9213b48a9, 0x9ae1c462fc05f49d
+       data8 0xc323938449a2587e, 0xf5dc1501f324a812
+       data8 0x9af8a8dc936b84d0, 0xc3406b40a538ed20
+       data8 0xf6006bee86b5589e, 0x9b1b19033be35730
+       data8 0xc36bcee8211d15e0, 0xf63716b2fa067fa4
+       data8 0x9b3da7daf04c2892, 0xc397593adf2ba366
+       data8 0xf66df22fb6132b9c, 0x9b54c2e4c8a9012b
+       data8 0xc3b475b6206155d5, 0xf6929fb98225deb1
+       data8 0x9b77854e6c661200, 0xc3e0410243b97383
+       data8 0xf6c9cd13021e3fea, 0x9b8ec2e678d56d2f
+       data8 0xc3fd890709833d37, 0xf6eeb177472cedae
+       data8 0x9ba60e6a5ca133b6, 0xc41ae295f7e7fa06
+       data8 0xf713abf4cb0b3afb, 0x9bc919ea66a151a4
+       data8 0xc44709f7bb8a4dd2, 0xf74b4d5333684ef1
+       data8 0x9be0887c09ef82bb, 0xc4648fb0e0bec4c1
+       data8 0xf7707f75a72f8e94, 0x9c03c8d5fffc3503
+       data8 0xc490f9a94695ba14, 0xf7a874b97927af44
+       data8 0x9c1b5ad21a81cbb9, 0xc4aeac0173b7d390
+       data8 0xf7cddf140aedf1d8, 0x9c3ed09216e9ca02
+       data8 0xc4db5941007aa853, 0xf806291bacb7f7a9
+       data8 0x9c568656c0423def, 0xc4f938aec206291a
+       data8 0xf82bcc43b92eafef, 0x9c7a320af242ce60
+       data8 0xc52629e899dfd622, 0xf8646bf0defb759e
+       data8 0x9c920bf7a8c01dc2, 0xc54436e44043b965
+       data8 0xf88a487dfc3ff5f7, 0x9ca9f475d98b159c
+       data8 0xc562563abf9ea07f, 0xf8b03c2b46cdc17f
+       data8 0x9ccdeca60e80b5f8, 0xc58fa7d1dc42921c
+       data8 0xf8e95541c152ae7a, 0x9ce5f9d4653d4902
+       data8 0xc5adf561b91e110a, 0xf90f832c2700c160
+       data8 0x9cfe15cb38bfdd8e, 0xc5cc5591bdbd82fa
+       data8 0xf935c88e0c7f419b, 0x9d225b983f6c1f96
+       data8 0xc5fa08f1ff20593c, 0xf96f5cd84fd86873
+       data8 0x9d3a9cca32261ed7, 0xc618980a79ce6862
+       data8 0xf995dd53ebdd9d6d, 0x9d52ecfccebe1768
+       data8 0xc6373a09e34b50fa, 0xf9bc75a034436a41
+       data8 0x9d77818d95b82f86, 0xc66550a6e0baaf35
+       data8 0xf9f686f26d5518de, 0x9d8ff7893fa4706c
+       data8 0xc6842241926342c9, 0xfa1d5b39b910a8c5
+       data8 0x9da87cbef36f2a5e, 0xc6a3070b7c93bb9e
+       data8 0xfa4447acc4ecbfd2, 0x9dcd6140b4a35aeb
+       data8 0xc6d18260bb84081b, 0xfa7ed7e51e6fdfb4
+       data8 0x9de60cd06dc6e2d4, 0xc6f0977c9416828b
+       data8 0xfaa601394d49a1a0, 0x9dfec7d4cc43b76f
+       data8 0xc70fc0117c641630, 0xfacd431644ce0e40
+       data8 0x9e17925ec9fccc4a, 0xc72efc34d7e615be
+       data8 0xfaf49d96f7a75909, 0x9e3cdf6db57dc075
+       data8 0xc75dfb441594141e, 0xfb2fd3c65e562fd5
+       data8 0x9e55d110b63637a8, 0xc77d68aa019bda4c
+       data8 0xfb576c5762024805, 0x9e6ed27594550d2e
+       data8 0xc79ce9ea478dbc4f, 0xfb7f1debc22c4040
+       data8 0x9e87e3adc385d393, 0xc7bc7f1ae453219d
+       data8 0xfba6e89f32d0190a, 0x9ead9b54b37a1055
+       data8 0xc7ec0476e15e141a, 0xfbe2c803a0894893
+       data8 0x9ec6d46a3d7de215, 0xc80bcbe16f1d540f
+       data8 0xfc0ad1ff0ed9ecf0, 0x9ee01d9108be3154
+       data8 0xc82ba78a5d349735, 0xfc32f57bdfbcbe7f
+       data8 0x9ef976db07288d04, 0xc84b978847a06b87
+       data8 0xfc5b32968f99b21c, 0x9f12e05a4759ec25
+       data8 0xc86b9bf1ee817bc6, 0xfc83896bc861ab08
+       data8 0x9f2c5a20f4da6668, 0xc88bb4de3667cdf4
+       data8 0xfcabfa1861ed4815, 0x9f52af78ed1733ca
+       data8 0xc8bc00e7fe9e23a3, 0xfce8d3cea7d3163e
+       data8 0x9f6c52426a39d003, 0xc8dc4d7ff2d25232
+       data8 0xfd118595143ee273, 0x9f860593d42fd7f3
+       data8 0xc8fcaeebcb40eb47, 0xfd3a519943d4865a
+       data8 0x9f9fc97fdb96bd51, 0xc91d25431426a663
+       data8 0xfd6337f8e1ae5a4b, 0x9fb99e194f4a7037
+       data8 0xc93db09d7fdb2949, 0xfd8c38d1c8e927eb
+       data8 0x9fd383731ca51db9, 0xc95e5112e721582a
+       data8 0xfdb5544205095a53, 0x9fed79a04fbf9423
+       data8 0xc97f06bb49787677, 0xfdde8a67d2613531
+       data8 0xa00780b413b24ee8, 0xc99fd1aecd6e1b06
+       data8 0xfe07db619e781611, 0xa02eab2c4474b0cd
+       data8 0xc9d12a3e27bb1625, 0xfe460768d80bf758
+       data8 0xa048dcd51ccfd142, 0xc9f22ad82ba3d5f0
+       data8 0xfe6f9bfb06cd32f6, 0xa0631fa894b11b8d
+       data8 0xca134113105e67b2, 0xfe994bcd3d14fcc2
+       data8 0xa07d73ba65e680af, 0xca346d07b045a876
+       data8 0xfec316fecaf3f2ab, 0xa097d91e6aaf71b0
+       data8 0xca55aecf0e94bb88, 0xfeecfdaf33fadb80
+       data8 0xa0b24fe89e02602f, 0xca77068257be9bab
+       data8 0xff16fffe2fa8fad6, 0xa0ccd82d1bd2f68b
+       data8 0xca98743ae1c693a8, 0xff411e0ba9db886d
+       data8 0xa0e77200215909e6, 0xcab9f8122c99a101
+       data8 0xff6b57f7c33e4e9a, 0xa1021d760d584855
+       data8 0xcadb9221e268c3b5, 0xff95ade2d1bd7358
+       data8 0xa11cdaa36068a57d, 0xcafd4283d8043dfd
+       data8 0xffc01fed60f86fb5, 0xa137a99cbd3f880b
+       data8 0xcb1f09520d37c6fb, 0xffeaae3832b63956
+LOCAL_OBJECT_END(T_table)
+
+
+
+
+
+
 
 .section .text
-.proc  cbrtf#
-.align 32
-cbrtf: 
+GLOBAL_LIBM_ENTRY(cbrtf)
 
 
-{ .mfi
-  getf.sig r28=f8
-     // will continue only for normal/denormal numbers          
-(p0)  fclass.nm.unc p12,p7 = f8, 0x1b           
-  // r2 = pointer to C_1,C_2 followed by T_table
-  addl r2 = @ltoff(poly_coeffs), gp
+{.mfi
+       getf.sig GR_SIGNIF = f8
+       // will continue only for normal/denormal numbers
+       fclass.nm.unc p12, p7 = f8, 0x1b
+       // GR_GP = pointer to C_1, C_2 followed by T_table
+       nop.i 0
 }
 {.mfi
-  // r29=bias-((2^8-1)/3) -63=0xffff-0x55-0x3f=0xff6b
-  mov r29=0xff6b    
-  // normalize a
-  fma.s1 f14=f8,f1,f0
-  nop.i 0;;
+       addl GR_GP = @ltoff(poly_coeffs), gp
+       // normalize a
+       fma.s1 FR_ARG = f8, f1, f0
+       // GR_CT3 = bias-((2^8-1)/3) -63 = 0xffff-0x55-0x3f = 0xff6b
+       mov GR_CT3 = 0xff6b ;;
 }
-{.mib
-  nop.m 0
-  (p7) cmp.eq p12,p0=r28,r0
-  nop.b 0;;
+
+{.mmi
+       // get exponent
+       getf.exp GR_ARGEXP = f8
+       // load start address for C_1, C_2 followed by T_table
+       ld8 GR_ADDR = [ GR_GP ]
+       nop.i 0 ;;
 }
-{.mfb
-  // load start address for C_1,C_2 followed by T_table
-  ld8 r2=[r2]
-  (p12) fma.s.s0 f8=f8,f1,f0
-  (p12) br.ret.spnt b0;;
+
+{.mlx
+       // check if input significand is 0
+ (p7)  cmp.eq p12, p7 = GR_SIGNIF, r0
+       // GR_2P63 = 2^63
+       movl GR_2P63 = 0x8000000000000000 ;;
+}
+
+{.mfi
+       nop.m 0
+       // y = frcpa(a)
+       // p7 = 1 for normal and denormal (but non-zero) arguments
+ (p7)  frcpa.s0 FR_Y, p0 = f1, f8
+       // p9 = 1 if denormal input
+       cmp.gtu p9, p0 = GR_2P63, GR_SIGNIF
 }
-{.mmf 
-  // load C_1
-  ldfe f7=[r2],16
-  nop.m 0
-  // y=frcpa(a)
-  frcpa.s0 f8,p6=f1,f8;;
+{.mfb
+       // load C_1
+       ldfe FR_COEFF1 = [ GR_ADDR ], 16
+       // if argument is 0, +/-Infinity, or NaN, return
+ (p12) fma.s.s0 f8 = f8, f1, f0
+ (p12) br.ret.spnt b0 ;;
 }
+
 {.mmi
-  // load C_2
-  ldfe f9=[r2],16
-  // r28=bias-(2^8-1)
-  mov r28=0xff00
-  nop.i 0;;
+       // get normalized significand (for denormal inputs only)
+ (p9)  getf.sig GR_SIGNIF = FR_ARG
+       // load C_2
+       ldfe FR_COEFF2 = [ GR_ADDR ], 16
+       // GR_CT2 = bias-(2^8-1)
+       mov GR_CT2 = 0xff00
 }
-{.mmi
-  // get normalized significand
-  getf.sig r23=f14
-  // get exponent
-  getf.exp r24=f14
-  mov r25=0x20000;;
+
+{.mii
+       // get exponent (for denormal inputs only)
+ (p9)  getf.exp GR_ARGEXP = FR_ARG
+       nop.i 0
+       mov GR_CONST = 0x20000 ;;
 }
+
+
 {.mii
-  // get r26=sign
-  and r26=r24,r25
-  // eliminate leading 1 from r23=1st table index
-  shl r23=r23,1
-  // eliminate sign from exponent (r25)
-  andcm r25=r24,r25;;
+       // get GR_SIGN = sign
+       and GR_SIGN = GR_ARGEXP, GR_CONST
+       // eliminate leading 1 from GR_I1 = 1st table index
+       shl GR_I1 = GR_SIGNIF, 1
+       // eliminate sign from exponent
+       andcm GR_EBIAS = GR_ARGEXP, GR_CONST ;;
 }
+
+
 {.mfi
-  // subtract bias from r25=exponent
-  sub r25=r25,r28
-  // r=1-a*y
-  (p6) fnma.s1 f6=f8,f14,f1
-  // r23=1st table index (y_index8 bits)
-  shr.u r23=r23,56;;
+       // subtract bias from GR_EXP = exponent
+       sub GR_EXP = GR_EBIAS, GR_CT2
+       // r = 1-a*y
+       fnma.s1 FR_R = FR_Y, FR_ARG, f1
+       // GR_IT1 = 1st table index (y_index8 bits)
+       shr.u GR_IT1 = GR_I1, 56 ;;
 }
+
+
 {.mii
-  // 1: exponent*=5;  // (2^{16}-1)/3=0x5555
-  shladd r24=r25,2,r25
-  // r23=3*y_index
-  shladd r23=r23,1,r23;;
-  // r30=(5*expon)*16+5*expon=(0x55)*expon
-  shladd r30=r24,4,r24;;
+       // 1: exponent* = 5; // (2^{16}-1)/3 = 0x5555
+       shladd GR_E5 = GR_EXP, 2, GR_EXP
+       // GR_IT1_3 = 3*y_index
+       shladd GR_IT1_3 = GR_IT1, 1, GR_IT1
+       nop.i 0 ;;
+}
+
+
+{.mmi
+       // GR_TMP5 = (5*expon)*16+5*expon = (0x55)*expon
+       shladd GR_TMP5 = GR_E5, 4, GR_E5
+       // adjust T_table pointer by 1st index
+       shladd GR_TP1 = GR_IT1_3, 3, GR_ADDR
+       nop.i 0 ;;
 }
+
+
 {.mmi
-  // adjust T_table pointer by 1st index
-  shladd r2=r23,3,r2;;
-  // f10=T[0][y]
-  (p6) ldf8 f10=[r2],8
-  // r24=(0x5500)*expon
-  shl r24=r30,8;;
+       // FR_T0 = T [ 0 ] [ y ]
+       ldf8 FR_T0 = [ GR_TP1 ], 8
+       // get 2^{-63}
+       mov GR_TMP63 = 0xffff + 63
+       // GR_TMP = (0x5500)*expon
+       shl GR_TMP = GR_TMP5, 8 ;;
 }
+
+
 {.mfi
-  // f11=T[1][y]
-  (p6) ldf8 f11=[r2],8
-  // P_1=C_1+C_2*r
-  (p6) fma.s1 f7=f9,f6,f7
-  // r24=(0x5555)*expon
-  add r24=r24,r30;;
+       // FR_T1 = T [ 1 ] [ y ]
+       ldf8 FR_T1 = [ GR_TP1 ], 8
+       // P_1 = C_1+C_2*r
+       fma.s1 FR_COEFF1 = FR_COEFF2, FR_R, FR_COEFF1
+       // GR_TMP2 = (0x5555)*expon
+       add GR_TMP2 = GR_TMP, GR_TMP5 ;;
 }
+
+
 {.mmi
-  // r24=(0x5556)*expon  // 0x5556=(2^{16}+2)/3
-  add r24=r24,r25;;
-  // f8=T[2][y]
-  (p6) ldf8 f8=[r2]
-  // r24=floor(expon/3)
-  shr r24=r24,16;;
+       // GR_TMP3 = (0x5556)*expon // 0x5556 = (2^{16}+2)/3
+       add GR_TMP3 = GR_TMP2, GR_EXP ;;
+       // FR_T2 = T [ 2 ] [ y ]
+       ldf8 FR_T2 = [ GR_TP1 ]
+       // GR_EXP3 = floor(expon/3)
+       shr GR_EXP3 = GR_TMP3, 16 ;;
 }
+
+
 {.mmi
-  nop.m 0
-  // r28=3*exponent
-  shladd r28=r24,1,r24
-  // bias exponent
-  add r24=r29,r24;;
+       setf.exp FR_2M63 = GR_TMP63
+       // GR_TMP4 = 3*exponent
+       shladd GR_TMP4 = GR_EXP3, 1, GR_EXP3
+       // bias exponent
+       add GR_EBIAS3 = GR_CT3, GR_EXP3 ;;
+}
+
+
+{.mmf
+       // get remainder of exponent/3
+       sub GR_REM = GR_EXP, GR_TMP4
+       // add sign to exponent
+       or GR_SEXP = GR_EBIAS3, GR_SIGN
+       // P_2 = -r*P_1
+       fnma.s1 FR_R = FR_COEFF1, FR_R, f0 ;;
 }
+
+
+
 {.mmi
-  // get remainder of exponent/3
-  sub r25=r25,r28
-  // add sign to exponent
-  or r24=r24,r26
-  nop.i 0;;
-}  
-{.mfi
-  nop.m 0
-  // P_2=-r*P_1
-  (p6) fnma.s1 f6=f7,f6,f0
-  // remainder=0 ?
-  (p6) cmp.eq.unc p7,p8=r0,r25;;
+       // FR_ARG = sign*2^{exponent/3}
+       setf.exp FR_ARG = GR_SEXP
+       nop.m 0
+       // remainder = 0 ?
+       // p7=1 if input exponent is 3*j (remainder is 0)
+       cmp.eq.unc p7, p8 = r0, GR_REM ;;
 }
+
+
 {.mfi
-  // f14=sign*2^{exponent/3}
-  (p6) setf.exp f14=r24
-  nop.f 0
-  // remainder = 1 ?
-  (p8) cmp.eq.unc p8,p12=1,r25;;
+       // remainder = 1 ?
+       // p8=1 if input exponent is 3*j+1 (remainder is 1)
+       // p12=1 if input exponent is 3*j+2 (remainder is 2)
+  (p8) cmp.eq.unc p8, p12 = 1, GR_REM
+       // p7=1 -> remainder = 0 -> use T = FR_T0
+  (p7)  fma.s1 f8 = FR_T0, FR_R, FR_T0
+       // argument is of the form 2^(3*k) ?
+       // ( GR_I1 holds significand bits, without the leading 1)
+       or GR_I1 = GR_I1, GR_REM ;;
 }
-.pred.rel "mutex",p7,p8
+
+
+.pred.rel "mutex", p12, p8
 {.mfi
-  nop.m 0
-  // remainder=0 -> use T=f10
-  (p7) fma.s1 f8=f10,f6,f10
-  nop.i 0
+       nop.m 0
+       // p8=1 -> remainder = 1 -> use FR_T1
+  (p8) fma.s1 f8 = FR_T1, FR_R, FR_T1
+       // argument is of the form 2^(3*k) ?
+       cmp.eq p14, p7 = GR_I1, r0
 }
+
+
 {.mfi
-  nop.m 0
-  // remainder =1 -> use f11
-  (p8) fma.s1 f8=f11,f6,f11
-  nop.i 0;;
+       nop.m 0
+       // p12=1 -> remainder=2 -> result = T+T*P_2
+ (p12) fma.s1 f8 = FR_T2, FR_R, FR_T2
+       nop.i 0 ;;
 }
+
+
+.pred.rel "mutex", p14, p7
 {.mfi
-  nop.m 0
-  // result=T+T*P_2
-  (p12) fma.s.s0 f8=f8,f6,f8
-  nop.i 0;;
+       nop.m 0
+       // if argument is sgn*2^{3*(expon/3)}
+ (p14) fma.s.s0 f8 = FR_2M63, FR_ARG, f0
+       nop.i 0
 }
 {.mfb
-  nop.m 0
-  // T*=sgn*2^{expon/3}
-  (p6) fma.s.s0 f8=f8,f14,f0
-  br.ret.sptk b0;;
+       nop.m 0
+       // T* = sgn*2^{expon/3}
+  (p7) fma.s.s0 f8 = f8, FR_ARG, f0
+       br.ret.sptk b0 ;;
 }
-.endp cbrtf
-ASM_SIZE_DIRECTIVE(cbrtf)
+
+
+GLOBAL_LIBM_END(cbrtf)
+
+
+
+
diff --git a/sysdeps/ia64/fpu/s_cbrtl.S b/sysdeps/ia64/fpu/s_cbrtl.S
index d4bbf8fdbf..76ef12f334 100644
--- a/sysdeps/ia64/fpu/s_cbrtl.S
+++ b/sysdeps/ia64/fpu/s_cbrtl.S
@@ -1,11 +1,10 @@
-.file "cbrtl.asm"
+.file "cbrtl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2004, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Cristina Iordache, Ted Kubaska, 
-// Bob Norin, Shane Story, and Ping Tak Peter Tang 
-// of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,26 +20,29 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 4/28/00: Initial version 
+// 04/28/00 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header:.section,.global,.proc,.align
+// 11/23/04 Reformatted routine and improved speed
 //
 // API
 //==============================================================
@@ -52,851 +54,933 @@
 //
 // Implementation
 //
-//   cbrt(a) = cbrt(a y) / cbrt(y)
-//          = cbrt(1 - (1 - a y)) * 1/cbrt(y)
+// The result is computed as
+// cbrt(x)= cbrt(1 - (1 - x*y)) * (1/cbrt(y))
+// where y = frcpa(x) = (-1)^sgn_y * 2^(3*k+j) * m_y,  
+//       m_y in [1,2),  j in {0,1,2}
 //
-// where y = frcpa(a). 
+//  cbrt(1 - (1 - x*y)) is approximated by a degree-6 polynomial
+//  in r= 1 - x*y :
+// P = 1 - c_1 r - c_2 * r^2 - c_3 * r^3 - c_4 * r^4 - c_5 * r^5 - c_6 * r^6
 //
-//  * cbrt(1 - (1 - a y)) is approximated by a degree-6 polynomial 
-//   
-//  1 - c_1 r - c_2 * r^2 - c_3 * r^3 - c_4 * r^4 - c_5 * r^5 - c_6 * r^6
-// 
-//  in r = 1 - a y.
 //
-//  * The values 1/cbrt(y) are stored as two tables of constants T_hi
-//   (double-extended precision) and D (single precision) as follows:
+// The values (1/cbrt(y)) are stored as two tables of constants T_hi
+// (double-extended precision) and D (single precision) as follows:
+// T_hi (1 + D)= 1/cbrt(y) to about 80 bits of accuracy
 //
-//        T_hi (1 + D) = 1/cbrt(y) to about 80 bits of accuracy
+// The tables are only stored for three exponent values (i.e. 
+// only for 2^j * m_y, where j in {0,1,2} and m_y covers the 256
+// possible mantissas for an frcpa result); the index is formed
+// by the 8 leading mantissa bits of x, which is the same index used
+// by the hardware to get frcpa(x).
 //
-// The tables are only stored for three exponent values and are
-// then multiplied by e/3 where e is the exponent of the input number.
-// This computation is carried out in parallel with the polynomial
-// evaluation:
+// The table values are multiplied by 2^k where e is the exponent of 
+// the input number.  This multiplication is carried out in parallel with
+// the polynomial evaluation:
+// T= 2^(k) * T_hi
 //
-//      T = 2^(e/3) * T_hi
-
-
-
-
+//=======================================================================
 
 //===============
-// input = x
-// C = frcpa(x)
-// r = C * x - 1
-//
-// Special values 
+// Special values
 //==============================================================
 
-
-
 // Registers used
 //==============================================================
-//   f6-f15
-//   r2-r3, r23-r30
-//   p6,p7,p12
+// p6, p7, p12
+           FR_R       =  f6
+           FR_C1      =  f7
+           FR_C2      =  f9
+           FR_C3      =  f10
+           FR_C4      =  f11
+           FR_C5      =  f12
+           FR_C6      =  f13
+           FR_XNORM   =  f14
+           FR_D       =  f15
+           FR_SPECIAL =  f32
+           FR_RCP     =  f33
+           FR_R2      =  f34
+           FR_P1      =  f35
+           FR_P2      =  f36
+           FR_P3      =  f37
+           FR_P4      =  f38
+           FR_P5      =  f39
+           FR_R3      =  f40
+           FR_T       =  f41
+           FR_TF      =  f42
+           FR_P       =  f43
+           FR_SGNEXP  =  f44
+
+           GR_ADDR       = r2
+           GR_C_START    = r2
+           GR_ARGSIG     = r3
+           GR_NORMSIG    = r15
+           GR_D_ADDR     = r16
+           GR_D_START    = r16
+           GR_INDEX2     = r17
+           GR_IX2        = r17
+           GR_NORMEXP    = r18
+           GR_EXP5       = r19
+           GR_EXP3       = r20
+           GR_EXP6       = r20
+           GR_EXP17      = r21
+           GR_TMP1       = r21
+           GR_SGNMASK    = r22
+           GR_T_INDEX    = r23
+           GR_IX_T       = r23  
+           GR_IX_D       = r24
+           GR_D_INDEX    = r24
+           GR_TMP2       = r25
+           GR_TMP3       = r25
+           GR_TMP4       = r25
+           GR_EXP_RES    = r26
+           GR_BIAS23     = r27
+           GR_EXPBIAS    = r27
+           GR_EXP_MOD_3  = r28
+           GR_SIGN       = r29
+           GR_EXPSIGNRES = r29
+           GR_REMTMP     = r30
+           GR_NORMEXPSGN = r31
 
-#include "libm_support.h"
 
 // Data tables
 //==============================================================
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+RODATA
 
 .align 16
 
-poly_coeffs:
-ASM_TYPE_DIRECTIVE(poly_coeffs,@object)
-data8 0xaaaaaaaaaaaaaab1, 0x00003ffd // C_1
-data8 0xe38e38e38e38e3e0, 0x00003ffb // C_2
-data8 0x3faf9add3c0be9a6, 0x3fa511e8d2b1f749 // C_3, C_4
-data8 0x3f9ee71b2c6ebe99, 0x3f9809180fd0340c // C_5, C_6
-ASM_SIZE_DIRECTIVE(poly_coeffs)
-
-T_table:
-ASM_TYPE_DIRECTIVE(T_table,@object)
-
-data8 0x80155c748c374836, 0x8040404b0879f7f9
-data8 0x806b5dce4b405c10, 0x8096b586974669b1
-data8 0x80bcd273d952a028, 0x80e898c52813f2f3
-data8 0x81149add67c2d208, 0x813b4e2c856b6e9a
-data8 0x8167c1dde03de7aa, 0x818ed973b811135e
-data8 0x81bbc0c33e13ec98, 0x81e33e69fbe7504a
-data8 0x820aec524e3c23e9, 0x823880f78e70b805
-data8 0x826097a62a8e5200, 0x8288dfe00e9b5eaf
-data8 0x82b15a10c5371624, 0x82da06a527b18937
-data8 0x8302e60b635ab394, 0x832bf8b2feec2f0e
-data8 0x83553f0ce00e276b, 0x837eb98b50f8322a
-data8 0x83a270f44c84f699, 0x83cc4d7cfcfac5ca
-data8 0x83f65f78a8872b4c, 0x8420a75f2f7b53c8
-data8 0x844510461ff14209, 0x846fbd91b930bed2
-data8 0x84947e18234f3294, 0x84bf92755825045a
-data8 0x84e4ac0ee112ba51, 0x8509ef44b86f20be
-data8 0x85359d5d91768427, 0x855b3bd5b7384357
-data8 0x858104f0c415f79a, 0x85a6f90390d29864
-data8 0x85d3772fcd56a1dd, 0x85f9c982fcc002f3
-data8 0x862047e0e7ea554b, 0x8646f2a26f7f5852
-data8 0x866dca21754096b5, 0x8694ceb8dfd17a37
-data8 0x86bc00c49e9307e8, 0x86dccd74fce79610
-data8 0x870453c845acf90f, 0x872c089a1e90342c
-data8 0x8753ec4a92d16c5e, 0x877bff3aca19f6b4
-data8 0x879d88b6fe1c324c, 0x87c5f346dbf98c3a
-data8 0x87e7c653efacef2c, 0x881089d4e73ffefc
-data8 0x88397e6a366f2a8a, 0x885bc559e5e1c081
-data8 0x887e2ee392bb7a93, 0x88a7a8587e404257
-data8 0x88ca5eda67594784, 0x88f4356166bd590e
-data8 0x89173a0acf5ce026, 0x893a62a098b6a57b
-data8 0x895daf637236ae2c, 0x89883b9d1c2fa9c5
-data8 0x89abd8dd374a5d7b, 0x89cf9b1dcd197fa0
-data8 0x89f382a258ea79de, 0x8a178faf06648f29
-data8 0x8a3bc288b3e1d18a, 0x8a601b74f4d1f835
-data8 0x8a849aba14274764, 0x8aa9409f16cdbc9b
-data8 0x8ace0d6bbe2cb316, 0x8af301688ab33558
-data8 0x8b181cdebe6f3206, 0x8b3d60185fafcb7c
-data8 0x8b62cb603bb2fad0, 0x8b80d7d6bc4104de
-data8 0x8ba68bf73ac74f39, 0x8bcc68fb9f9f7335
-data8 0x8bf26f31c534fca2, 0x8c10f86e13a1a1f9
-data8 0x8c3749916cc6abb5, 0x8c5dc4c4f7706032
-data8 0x8c7cac3a8c42e3e0, 0x8ca373f1b7bf2716
-data8 0x8cc29907fb951294, 0x8ce9ae4e9492aac8
-data8 0x8d0911dddbfdad0e, 0x8d3075c4f20f04ee
-data8 0x8d5018a9d4de77d5, 0x8d77cc47dd143515
-data8 0x8d97af6352739cb7, 0x8db7af523167800f
-data8 0x8ddfd80bc68c32ff, 0x8e00197e1e7c88fe
-data8 0x8e207859f77e20e7, 0x8e40f4ce60c9f8e2
-data8 0x8e69ba46cf2fde4d, 0x8e8a7a00bd7ae63e
-data8 0x8eab57ef1cf2f529, 0x8ecc5442cffb1dad
-data8 0x8eed6f2d2a4acbfe, 0x8f0ea8dff24441ff
-data8 0x8f385c95d696b817, 0x8f59dc43edd930f3
-data8 0x8f7b7b5f5ffad1c4, 0x8f9d3a1bea165f38
-data8 0x8fbf18adc34b66da, 0x8fe117499e356095
-data8 0x90033624aa685f8d, 0x9025757495f36b86
-data8 0x903f3a5dcc091203, 0x9061b2fceb2bdbab
-data8 0x90844ca7211032a7, 0x90a7079403e6a15d
-data8 0x90c9e3fbafd63799, 0x90ece216c8a16ee4
-data8 0x9110021e7b516f0a, 0x912a708a39be9075
-data8 0x914dcc7b31146370, 0x91714af8cfe984d5
-data8 0x918c00a6f3795e97, 0x91afbc299ed0295d
-data8 0x91d39add3e958db0, 0x91ee9920a8974d92
-data8 0x9212b5fcac537c19, 0x9236f6b256923fcf
-data8 0x92523ee6f90dcfc3, 0x9276bef031e6eb79
-data8 0x929236ec237a24ad, 0x92b6f70b7efe9dc3
-data8 0x92d29f61eec7dc2b, 0x92f7a05d5b8ba92f
-data8 0x931379a403be5c16, 0x9338bc44de2e3f34
-data8 0x9354c71412c69486, 0x937a4c273907e262
-data8 0x93968919f6e7975d, 0x93bc516fdd4680c9
-data8 0x93d8c123d9be59b2, 0x93f546c955e60076
-data8 0x941b70a65879079f, 0x943829f337410591
-data8 0x9454f995765bc4d2, 0x947b86b57f5842ed
-data8 0x94988aeb23470f86, 0x94b5a5dc9695f42a
-data8 0x94d2d7a9170d8b42, 0x94f9e87dd78bf019
-data8 0x95175019a503d89e, 0x9534cefa625fcb3a
-data8 0x955265405c491a25, 0x9570130c1f9bb857
-data8 0x9597ca4119525184, 0x95b5af6fb5aa4d3c
-data8 0x95d3ac9273aafd7a, 0x95f1c1cafdfd3684
-data8 0x960fef3b430b8d5f, 0x962e350575b409c5
-data8 0x964c934c0dfc1708, 0x966b0a31c9c6bc7d
-data8 0x968999d9ad8d264e, 0x96a8426705198795
-data8 0x96c703fd64445ee5, 0x96e5dec0a7b4268d
-data8 0x9704d2d4f59f79f3, 0x9723e05ebe91b9b0
-data8 0x97430782be323831, 0x97624865fc0df8bf
-data8 0x9781a32dcc640b2a, 0x97a117ffd0f48e46
-data8 0x97c0a701f9d263c9, 0x97e0505a8637a036
-data8 0x97f57a9fb0b08c6e, 0x9815503365914a9d
-data8 0x98354085054fd204, 0x98554bbbf8a77902
-data8 0x987571fffb7f94f6, 0x9895b3791dd03c23
-data8 0x98ab43a5fc65d0c8, 0x98cbb2d196bd713d
-data8 0x98ec3d9ec7b6f21a, 0x990ce436db5e8344
-data8 0x9922b8218160967a, 0x99438d686f75779d
-data8 0x99647eea131fa20b, 0x997a85045a47c6d0
-data8 0x999ba5f14f8add02, 0x99bce38b5465ecae
-data8 0x99d31ca0887f30f9, 0x99f48a669c74c09e
-data8 0x9a16154eb445c873, 0x9a2c822ec198d667
-data8 0x9a4e3e080cd91b78, 0x9a70177afe52322e
-data8 0x9a86b8fa94eebe10, 0x9aa8c42866ae2958
-data8 0x9abf86f9e12fc45e, 0x9ae1c462fc05f49d
-data8 0x9af8a8dc936b84d0, 0x9b1b19033be35730
-data8 0x9b3da7daf04c2892, 0x9b54c2e4c8a9012b
-data8 0x9b77854e6c661200, 0x9b8ec2e678d56d2f
-data8 0x9ba60e6a5ca133b6, 0x9bc919ea66a151a4
-data8 0x9be0887c09ef82bb, 0x9c03c8d5fffc3503
-data8 0x9c1b5ad21a81cbb9, 0x9c3ed09216e9ca02
-data8 0x9c568656c0423def, 0x9c7a320af242ce60
-data8 0x9c920bf7a8c01dc2, 0x9ca9f475d98b159c
-data8 0x9ccdeca60e80b5f8, 0x9ce5f9d4653d4902
-data8 0x9cfe15cb38bfdd8e, 0x9d225b983f6c1f96
-data8 0x9d3a9cca32261ed7, 0x9d52ecfccebe1768
-data8 0x9d77818d95b82f86, 0x9d8ff7893fa4706c
-data8 0x9da87cbef36f2a5e, 0x9dcd6140b4a35aeb
-data8 0x9de60cd06dc6e2d4, 0x9dfec7d4cc43b76f
-data8 0x9e17925ec9fccc4a, 0x9e3cdf6db57dc075
-data8 0x9e55d110b63637a8, 0x9e6ed27594550d2e
-data8 0x9e87e3adc385d393, 0x9ead9b54b37a1055
-data8 0x9ec6d46a3d7de215, 0x9ee01d9108be3154
-data8 0x9ef976db07288d04, 0x9f12e05a4759ec25
-data8 0x9f2c5a20f4da6668, 0x9f52af78ed1733ca
-data8 0x9f6c52426a39d003, 0x9f860593d42fd7f3
-data8 0x9f9fc97fdb96bd51, 0x9fb99e194f4a7037
-data8 0x9fd383731ca51db9, 0x9fed79a04fbf9423
-data8 0xa00780b413b24ee8, 0xa02eab2c4474b0cd
-data8 0xa048dcd51ccfd142, 0xa0631fa894b11b8d
-data8 0xa07d73ba65e680af, 0xa097d91e6aaf71b0
-data8 0xa0b24fe89e02602f, 0xa0ccd82d1bd2f68b
-data8 0xa0e77200215909e6, 0xa1021d760d584855
-data8 0xa11cdaa36068a57d, 0xa137a99cbd3f880b
-data8 0xa160019ed37fb4ae, 0xa1960b5966da4608
-data8 0xa1cc5dbe6dc2aab4, 0xa202f97995b69c0d
-data8 0xa232fe6eb0c0577d, 0xa26a2582012f6e17
-data8 0xa2a197e5d10465cb, 0xa2d25a532efefbc8
-data8 0xa30a5bd6e49e4ab8, 0xa33b9c9b59879e24
-data8 0xa3742fca6a3c1f21, 0xa3a5f1273887bf22
-data8 0xa3d7ef508ff11574, 0xa4115ce30548bc15
-data8 0xa443df0e53df577a, 0xa4769fa5913c0ec3
-data8 0xa4a99f303bc7def5, 0xa4dcde37779adf4b
-data8 0xa5105d46152c938a, 0xa5441ce89825cb8d
-data8 0xa5781dad3e54d899, 0xa5ac602406c4e68c
-data8 0xa5d9601d95c2c0bc, 0xa60e1e1a2de14745
-data8 0xa6431f6e3fbd9658, 0xa67864b0d432fda4
-data8 0xa6a6444aa0243c0b, 0xa6dc094d10f25792
-data8 0xa70a574cc02bba69, 0xa7409e2af9549084
-data8 0xa76f5c64ca2cf13b, 0xa79e4f0babab5dc0
-data8 0xa7d5579ae5164b85, 0xa804bd3c6fe61cc8
-data8 0xa8345895e5250a5a, 0xa8642a122b44ef0b
-data8 0xa89c38ca18f6108b, 0xa8cc81063b6e87ca
-data8 0xa8fd00bfa409285e, 0xa92db8664d5516da
-data8 0xa95ea86b75cc2c20, 0xa98fd141a4992deb
-data8 0xa9c1335cae7446ba, 0xa9ea8686f556f645
-data8 0xaa1c52d17906bb19, 0xaa4e59b046dab887
-data8 0xaa809b9c60d1890b, 0xaab319102f3f9b33
-data8 0xaadd5a18c1e21274, 0xab1045f2ac31bdf5
-data8 0xab3ae3ab2df7231e, 0xab6e3f945d1e96fc
-data8 0xaba1d953a08fa94e, 0xabcd090db7ef4c3f
-data8 0xabf864602d7c323d, 0xac2ca5886ccf9b57
-data8 0xac5861d4aa441f0f, 0xac8d183fe3a2fbed
-data8 0xacb93703ff51571e, 0xace5830ad0c3f14b
-data8 0xad11fca5d78b3ff2, 0xad4797fddf91a798
-data8 0xad747701e559ebcb, 0xada184a47e9c7613
-data8 0xadcec13ab0dda8ff, 0xadfc2d1a5fd21ba8
-data8 0xae29c89a5053c33a, 0xae5794122b638df9
-data8 0xae858fda8137ae0a, 0xaeb3bc4ccc56d3d1
-data8 0xaee219c374c09920, 0xaf10a899d3235fe7
-data8 0xaf3f692c341fe8b4, 0xaf6e5bd7db9ae6c2
-data8 0xaf9d80fb081cd91b, 0xafc35ce063eb3787
-data8 0xaff2ddcb5f28f03d, 0xb022923b148e05c5
-data8 0xb0527a919adbf58b, 0xb078f3ab1d701c65
-data8 0xb0a93a6870649f31, 0xb0d9b624d62ec856
-data8 0xb100a5f53fb3c8e1, 0xb131821882f5540a
-data8 0xb158bf8e4cb04055, 0xb189fd69d56b238f
-data8 0xb1b189958e8108e4, 0xb1e32a8165b09832
-data8 0xb20b0678fc271eec, 0xb23d0bd3f7592b6e
-data8 0xb26538b2db8420dc, 0xb28d89e339ceca14
-data8 0xb2c022ca12e55a16, 0xb2e8c6852c6b03f1
-data8 0xb3118f4eda9fe40f, 0xb33a7d6268109ebe
-data8 0xb36ddbc5ea70ec55, 0xb3971e9b39264023
-data8 0xb3c0877ecc18e24a, 0xb3ea16ae3a6c905f
-data8 0xb413cc67aa0e4d2d, 0xb43da8e9d163e1af
-data8 0xb47233773b84d425, 0xb49c6825430fe730
-data8 0xb4c6c46bcdb27dcf, 0xb4f1488c0b35d26f
-data8 0xb51bf4c7c51f0168, 0xb546c9616087ab9c
-data8 0xb571c69bdffd9a70, 0xb59cecbae56984c3
-data8 0xb5bd64512bb14bb7, 0xb5e8d2a4bf5ba416
-data8 0xb6146a9a1bc47819, 0xb6402c7749d621c0
-data8 0xb66c1882fb435ea2, 0xb6982f048c999a56
-data8 0xb6c47044075b4142, 0xb6e5bd6bfd02bafd
-data8 0xb7124a2736ff8ef2, 0xb73f026a01e94177
-data8 0xb760a959f1d0a7a7, 0xb78dae7e06868ab0
-data8 0xb7badff8ad9e4e02, 0xb7dce25b8e17ae9f
-data8 0xb80a6226904045e2, 0xb8380f1cafd73c1c
-data8 0xb85a6ea8e321b4d8, 0xb8886b684ae7d2fa
-data8 0xb8ab0726fa00cf5d, 0xb8d954a4d13b7cb1
-data8 0xb8fc2d4f6cd9f04a, 0xb92acc851476b1ab
-data8 0xb94de2d841a184c2, 0xb97cd4c36c92693c
-data8 0xb9a0297f172665e3, 0xb9cf6f21e36c3924
-data8 0xb9f3030951267208, 0xba229d6a618e7c59
-data8 0xba467144459f9855, 0xba6a60c3c48f1a4b
-data8 0xba9a76056b67ee7a, 0xbabea699563ada6e
-data8 0xbae2f350b262cc4b, 0xbb1385a23be24e57
-data8 0xbb3814975e17c680, 0xbb5cc031009bf467
-data8 0xbb81889680024764, 0xbbb2c0d8703ae95d
-data8 0xbbd7cd09ba3c5463, 0xbbfcf68c4977718f
-data8 0xbc223d88cfc88eee, 0xbc47a2284fee4ff8
-data8 0xbc79ac0916ed7b8a, 0xbc9f5670d1a13030
-data8 0xbcc51f068cb95c1d, 0xbceb05f4b30a9bc0
-data8 0xbd110b6604c7d306, 0xbd372f8598620f19
-data8 0xbd5d727edb6b3c7e, 0xbd83d47d937bbc6d
-data8 0xbdaa55addf1ae47d, 0xbdd0f63c36aa73f0
-data8 0xbdf7b6556d550a15, 0xbe1e9626b1ffa96b
-data8 0xbe4595dd903e5371, 0xbe6cb5a7f14bc935
-data8 0xbe93f5b41d047cf7, 0xbebb5630bae4c15f
-data8 0xbee2d74cd30a430c, 0xbf0a7937cf38d981
-data8 0xbf323c217be2bc8c, 0xbf5a203a09342bbb
-data8 0xbf74cad1c14ebfc4, 0xbf9ce6a497a89f78
-data8 0xbfc52428bec6e72f, 0xbfed838fddab024b
-data8 0xc016050c0420981a, 0xc03ea8cfabddc330
-data8 0xc059d3cbd65ddbce, 0xc082b122a3c78c9d
-data8 0xc0abb1499ae736c4, 0xc0d4d474c3aedaaf
-data8 0xc0f054ca33eb3437, 0xc119b2c67e600ed0
-data8 0xc1433453de2033ff, 0xc15ef3e44e10032d
-data8 0xc188b130431d80e6, 0xc1b2929d6067730e
-data8 0xc1ce9268f31cc734, 0xc1f8b0877c1b0c08
-data8 0xc222f35a87b415ba, 0xc23f3467349e5c88
-data8 0xc269b4e40e088c01, 0xc2945aac24daaf6e
-data8 0xc2b0de05e43c1d66, 0xc2dbc275e1229d09
-data8 0xc2f86fca9d80eeff, 0xc323938449a2587e
-data8 0xc3406b40a538ed20, 0xc36bcee8211d15e0
-data8 0xc397593adf2ba366, 0xc3b475b6206155d5
-data8 0xc3e0410243b97383, 0xc3fd890709833d37
-data8 0xc41ae295f7e7fa06, 0xc44709f7bb8a4dd2
-data8 0xc4648fb0e0bec4c1, 0xc490f9a94695ba14
-data8 0xc4aeac0173b7d390, 0xc4db5941007aa853
-data8 0xc4f938aec206291a, 0xc52629e899dfd622
-data8 0xc54436e44043b965, 0xc562563abf9ea07f
-data8 0xc58fa7d1dc42921c, 0xc5adf561b91e110a
-data8 0xc5cc5591bdbd82fa, 0xc5fa08f1ff20593c
-data8 0xc618980a79ce6862, 0xc6373a09e34b50fa
-data8 0xc66550a6e0baaf35, 0xc6842241926342c9
-data8 0xc6a3070b7c93bb9e, 0xc6d18260bb84081b
-data8 0xc6f0977c9416828b, 0xc70fc0117c641630
-data8 0xc72efc34d7e615be, 0xc75dfb441594141e
-data8 0xc77d68aa019bda4c, 0xc79ce9ea478dbc4f
-data8 0xc7bc7f1ae453219d, 0xc7ec0476e15e141a
-data8 0xc80bcbe16f1d540f, 0xc82ba78a5d349735
-data8 0xc84b978847a06b87, 0xc86b9bf1ee817bc6
-data8 0xc88bb4de3667cdf4, 0xc8bc00e7fe9e23a3
-data8 0xc8dc4d7ff2d25232, 0xc8fcaeebcb40eb47
-data8 0xc91d25431426a663, 0xc93db09d7fdb2949
-data8 0xc95e5112e721582a, 0xc97f06bb49787677
-data8 0xc99fd1aecd6e1b06, 0xc9d12a3e27bb1625
-data8 0xc9f22ad82ba3d5f0, 0xca134113105e67b2
-data8 0xca346d07b045a876, 0xca55aecf0e94bb88
-data8 0xca77068257be9bab, 0xca98743ae1c693a8
-data8 0xcab9f8122c99a101, 0xcadb9221e268c3b5
-data8 0xcafd4283d8043dfd, 0xcb1f09520d37c6fb
-data8 0xcb51ddcb9e93095e, 0xcb95f333968ad59b
-data8 0xcbda64292d3ffd97, 0xcc1f3184af961596
-data8 0xcc5bb1ac954d33e2, 0xcca12e9831fc6402
-data8 0xcce70a67b64f24ad, 0xcd24794726477ea5
-data8 0xcd6b096a0b70ee87, 0xcda9177738b15a90
-data8 0xcdf05f2247dffab9, 0xce2f0f347f96f906
-data8 0xce6e0be0cd551a61, 0xceb666b2c347d1de
-data8 0xcef609b0cb874f00, 0xcf35fb5447e5c765
-data8 0xcf763c47ee869f00, 0xcfb6cd3888d71785
-data8 0xcff7aed4fbfbb447, 0xd038e1ce5167e3c6
-data8 0xd07a66d7bfa0ebba, 0xd0bc3ea6b32d1b21
-data8 0xd0f4f0e8f36c1bf8, 0xd1376458e34b037e
-data8 0xd17a2ca133f78572, 0xd1bd4a80301c5715
-data8 0xd1f71682b2fa4575, 0xd23ad555f773f059
-data8 0xd2752c7039a5bf73, 0xd2b98ee008c06b59
-data8 0xd2f4735ffd700280, 0xd32f99ed6d9ac0e1
-data8 0xd374f0666c75d51c, 0xd3b0a7d13618e4a1
-data8 0xd3eca2ea53bcec0c, 0xd428e23874f13a17
-data8 0xd46f82fe293bc6d3, 0xd4ac57e9b7186420
-data8 0xd4e972becb04e8b8, 0xd526d40a7a9b43a3
-data8 0xd5647c5b73917370, 0xd5a26c4201bd6d13
-data8 0xd5e0a45015350a7e, 0xd614b539c6194104
-data8 0xd6537310e224283f, 0xd6927ab62244c917
-data8 0xd6d1ccc1fc4ef4b7, 0xd71169cea98fdded
-data8 0xd746a66a5bc9f6d9, 0xd786ce8f0fae5317
-data8 0xd7bc7ff214c4e75a, 0xd7fd35467a517ed1
-data8 0xd83e38838648d815, 0xd874a1db598b8951
-data8 0xd8ab42205b80edaf, 0xd8ed1849d202f965
-data8 0xd92432bd5a173685, 0xd9669ca45b03c23e
-data8 0xd99e3327cf89574e, 0xd9d602b19b100466
-data8 0xda0e0ba86c096841, 0xda5195fcdb1c3dce
-data8 0xda8a1eb87a491f6c, 0xdac2e230b91c3f84
-data8 0xdafbe0d0b66aea30, 0xdb351b04a8fafced
-data8 0xdb6e9139e33cdd8e, 0xdba843ded7151ea1
-data8 0xdbe2336319b61fc8, 0xdc1c60376789fa68
-data8 0xdc56cacda82d0cd5, 0xdc917398f2797814
-data8 0xdccc5b0d90a3e628, 0xdd0781a10469f0f2
-data8 0xdd42e7ca0b52838f, 0xdd729ad01c69114d
-data8 0xddae749c001fbf5e, 0xddea8f50a51c69b1
-data8 0xde26eb69a0f0f111, 0xde576480262399bc
-data8 0xde943789645933c8, 0xded14d58139a28af
-data8 0xdf025c00bbf2b5c7, 0xdf3feb44d723a713
-data8 0xdf715bc16c159be0, 0xdfaf66240e29cda8
-data8 0xdfe139cbf6e19bdc, 0xe01fc0fe94d9fc52
-data8 0xe051f92ffcc0bd60, 0xe090feec9c9a06ac
-data8 0xe0c39d0c9ff862d6, 0xe0f668eeb99f188d
-data8 0xe1362890eb663139, 0xe1695c7212aecbaa
-data8 0xe19cbf0391bbbbe9, 0xe1d050901c531e85
-data8 0xe2110903b4f4047a, 0xe2450559b4d80b6d
-data8 0xe27931a231554ef3, 0xe2ad8e2ac3c5b04b
-data8 0xe2e21b41b9694cce, 0xe316d93615862714
-data8 0xe3590bd86a0d30f9, 0xe38e38e38e38e38e
-data8 0xe3c397d1e6db7839, 0xe3f928f5953feb9e
-data8 0xe42eeca17c62886c, 0xe464e32943446305
-data8 0xe49b0ce15747a8a2, 0xe4d16a1eee94e9d4
-data8 0xe4fa52107353f67d, 0xe5310a471f4d2dc3
-data8 0xe567f6f1c2b9c224, 0xe59f18689a9e4c9a
-data8 0xe5d66f04b8a68ecf, 0xe60dfb2005c192e9
-data8 0xe645bd1544c7ea51, 0xe66fb21b505b20a0
-data8 0xe6a7d32af4a7c59a, 0xe6e02b129c6a5ae4
-data8 0xe70a9136a7403039, 0xe74349fb2d92a589
-data8 0xe77c3a9c86ed7d42, 0xe7a713f88151518a
-data8 0xe7e067453317ed2b, 0xe819f37a81871bb5
-data8 0xe8454236bfaeca14, 0xe87f32f24c3fc90e
-data8 0xe8aacd8688892ba6, 0xe8e523fd32f606f7
-data8 0xe9110b5311407927, 0xe94bc8bf0c108fa3
-data8 0xe977fdc439c2ca3c, 0xe9b3236528fc349e
-data8 0xe9dfa70b745ac1b4, 0xea1b36268d0eaa38
-data8 0xea480963fd394197, 0xea84034425f27484
-data8 0xeab12713138dd1cc, 0xeade6db73a5e503b
-data8 0xeb1b0268343b121b, 0xeb489b0b2bdb5f14
-data8 0xeb765721e85f03d0, 0xebb389645f222f62
-data8 0xebe198f090607e0c, 0xec0fcc9321024509
-data8 0xec3e247da8b82f61, 0xec7c27d21321c9f7
-data8 0xecaad5278824e453, 0xecd9a76d097d4e77
-data8 0xed089ed5dcd99446, 0xed37bb95add09a1c
-data8 0xed76c70508f904b6, 0xeda63bb05e7f93c6
-data8 0xedd5d661daed2dc4, 0xee05974eef86b903
-data8 0xee357ead791fc670, 0xee658cb3c134a463
-data8 0xee95c1987f080211, 0xeec61d92d8c4314f
-data8 0xeef6a0da64a014ac, 0xef274ba72a07c811
-data8 0xef581e31a2c91260, 0xef8918b2bc43aec6
-data8 0xefba3b63d89d7cbf, 0xefeb867ecffaa607
-data8 0xf01cfa3df1b9c9fa, 0xf04e96dc05b43e2d
-data8 0xf0805c944d827454, 0xf0b24ba285c495cb
-data8 0xf0e46442e76f6569, 0xf116a6b2291d7896
-data8 0xf1383fa9e9b5b381, 0xf16ac84f90083b9b
-data8 0xf19d7b686dcb03d7, 0xf1d0593311db1757
-data8 0xf20361ee8f1c711e, 0xf23695da7de51d3f
-data8 0xf258d095e465cc35, 0xf28c4d0bfc982b34
-data8 0xf2bff55eb3f0ea71, 0xf2f3c9cf9884636e
-data8 0xf31670135ab9cc0f, 0xf34a8e9f0b54cdfb
-data8 0xf37ed9fa6b8add3f, 0xf3a1cfe884ef6bb6
-data8 0xf3d66689dcc8e8d3, 0xf40b2ab069d5c96a
-data8 0xf42e718b90c8bc16, 0xf463822a0a3b4b00
-data8 0xf498c1076015faf8, 0xf4bc5a19a33990b5
-data8 0xf4f1e6a7d6f5425f, 0xf527a232cf6be334
-data8 0xf54b8ecdcda90851, 0xf5819949c7ad87b4
-data8 0xf5a5bac9213b48a9, 0xf5dc1501f324a812
-data8 0xf6006bee86b5589e, 0xf63716b2fa067fa4
-data8 0xf66df22fb6132b9c, 0xf6929fb98225deb1
-data8 0xf6c9cd13021e3fea, 0xf6eeb177472cedae
-data8 0xf713abf4cb0b3afb, 0xf74b4d5333684ef1
-data8 0xf7707f75a72f8e94, 0xf7a874b97927af44
-data8 0xf7cddf140aedf1d8, 0xf806291bacb7f7a9
-data8 0xf82bcc43b92eafef, 0xf8646bf0defb759e
-data8 0xf88a487dfc3ff5f7, 0xf8b03c2b46cdc17f
-data8 0xf8e95541c152ae7a, 0xf90f832c2700c160
-data8 0xf935c88e0c7f419b, 0xf96f5cd84fd86873
-data8 0xf995dd53ebdd9d6d, 0xf9bc75a034436a41
-data8 0xf9f686f26d5518de, 0xfa1d5b39b910a8c5
-data8 0xfa4447acc4ecbfd2, 0xfa7ed7e51e6fdfb4
-data8 0xfaa601394d49a1a0, 0xfacd431644ce0e40
-data8 0xfaf49d96f7a75909, 0xfb2fd3c65e562fd5
-data8 0xfb576c5762024805, 0xfb7f1debc22c4040
-data8 0xfba6e89f32d0190a, 0xfbe2c803a0894893
-data8 0xfc0ad1ff0ed9ecf0, 0xfc32f57bdfbcbe7f
-data8 0xfc5b32968f99b21c, 0xfc83896bc861ab08
-data8 0xfcabfa1861ed4815, 0xfce8d3cea7d3163e
-data8 0xfd118595143ee273, 0xfd3a519943d4865a
-data8 0xfd6337f8e1ae5a4b, 0xfd8c38d1c8e927eb
-data8 0xfdb5544205095a53, 0xfdde8a67d2613531
-data8 0xfe07db619e781611, 0xfe460768d80bf758
-data8 0xfe6f9bfb06cd32f6, 0xfe994bcd3d14fcc2
-data8 0xfec316fecaf3f2ab, 0xfeecfdaf33fadb80
-data8 0xff16fffe2fa8fad6, 0xff411e0ba9db886d
-data8 0xff6b57f7c33e4e9a, 0xff95ade2d1bd7358
-data8 0xffc01fed60f86fb5, 0xffeaae3832b63956
-ASM_SIZE_DIRECTIVE(T_table)
-
-
-
-
-
-D_table:
-ASM_TYPE_DIRECTIVE(D_table,@object)
-data4 0x1e50f488, 0x1ebdc559, 0x1e649ec1, 0x9eed9b2c
-data4 0x9e511c44, 0x9ec6d551, 0x9eefe248, 0x9e313854
-data4 0x9f54ff18, 0x9d231411, 0x1ee5d63c, 0x9edf6b95
-data4 0x9f332aaa, 0x1dc92a84, 0x1f73fb7b, 0x1e32f100
-data4 0x9ea636f5, 0x9f6c3353, 0x9f405552, 0x1f33fd97
-data4 0x1e975291, 0x9e59a11e, 0x1e47b0ba, 0x9d8ad33e
-data4 0x1ea51bf6, 0x1f25d782, 0x9ecf534d, 0x1f55436f
-data4 0x1d0975e4, 0x9f0633a1, 0x1f3e840a, 0x1f523a4c
-data4 0x9f53cbbc, 0x9c8b5661, 0x9f6bc8eb, 0x1f4f6c7b
-data4 0x9ed9b376, 0x9f5b30b6, 0x1f64fa5e, 0x1cbcc3e0
-data4 0x1f343548, 0x1f62a6a2, 0x9f336abb, 0x9f1d15af
-data4 0x1f476c83, 0x1ea86421, 0x1f33b2cf, 0x9e8f1348
-data4 0x1f6fa829, 0x9f30ee3a, 0x9ebd6146, 0x1f2db598
-data4 0x1ef9600d, 0x1f5b1427, 0x9edd741b, 0x1f51ef4e
-data4 0x9f1aa57d, 0x9ee9b5e0, 0x9f17ecd7, 0x1ead71ff
-data4 0x1f6c910e, 0x9e1837df, 0x9f0f17d9, 0x9e8350dd
-data4 0x9d292f1b, 0x9e33b3ab, 0x9d6f0fe8, 0x9ed8c7cc
-data4 0x9ec598c8, 0x9d56758c, 0x1e090c1e, 0x9ed4b941
-data4 0x9f1fc4cf, 0x1f63513a, 0x9edd0abc, 0x1e3924dd
-data4 0x1f60d56f, 0x1ea84424, 0x9e88f4fb, 0x1f205c09
-data4 0x1ec9ae4e, 0x1d2d5738, 0x9f2c9f6d, 0x1e0765c2
-data4 0x1e8bbdd7, 0x9f16d9f1, 0x9ea62627, 0x1f13904c
-data4 0x1e566ab8, 0x9dca3d1a, 0x9e91f2a1, 0x9f14641c
-data4 0x9f278946, 0x1f490c1e, 0x1f575eb6, 0x1f50b3fd
-data4 0x9da32efb, 0x1ea95e59, 0x9e41e058, 0x9eada15f
-data4 0x9e4fe66c, 0x1f3abc98, 0x1f1b8d1e, 0x9ece97e4
-data4 0x1d188aed, 0x9e89b6ee, 0x1f287478, 0x9e8a161a
-data4 0x1e4749f7, 0x9e68084a, 0x1e867f33, 0x9f462b63
-data4 0x1db30792, 0x1f59a767, 0x9d1da4ae, 0x9f472a33
-data4 0x1d1e91cd, 0x9f414824, 0x9f473d4f, 0x1f4b5783
-data4 0x9f5b04b8, 0x9f5c205b, 0x1f309617, 0x9f0d6852
-data4 0x9d96a609, 0x9f0965c2, 0x9e23f467, 0x9f089884
-data4 0x9ec71458, 0x9ed6e955, 0x1e5e8691, 0x1f5b2bbc
-data4 0x9f128268, 0x1ed40f5b, 0x1dc430ce, 0x1f345986
-data4 0x1d778f72, 0x1e9b11d6, 0x9f5a40be, 0x9e07f61a
-data4 0x9ed641a7, 0x9f334787, 0x1e952fd0, 0x1edeb5e2
-data4 0x9e9f3eb1, 0x9e379fd9, 0x1f13102a, 0x9e5e80e1
-data4 0x1c757944, 0x1dae2260, 0x1f183ab7, 0x1e55d576
-data4 0x9e6bb99f, 0x9f52d7cb, 0x9e73a0f5, 0x1d4e1d14
-data4 0x9dd05b53, 0x1f2261e4, 0x9d4ee73d, 0x1ede515e
-data4 0x1f22a573, 0x9ecac348, 0x1e6a2ac0, 0x1e2787d2
-data4 0x9eb64b87, 0x1f0c69c6, 0x9f470a01, 0x9d7c1686
-data4 0x1e468ebe, 0x9f21ee2f, 0x9ee52116, 0x9e20f715
-data4 0x1ed18533, 0x9f005b38, 0x9f20cb95, 0x1da72967
-data4 0x1f1ba5d7, 0x1e2f8b16, 0x9c794f96, 0x9ca74ea3
-data4 0x1f410555, 0x9eff2b96, 0x1ce8f0b1, 0x1f0cee77
-data4 0x1f191edd, 0x9ed5fcbc, 0x1f30f242, 0x9e0ad369
-data4 0x1ed8f3c8, 0x1f52bb0e, 0x9e9ce408, 0x1f18907f
-data4 0x9ecdad40, 0x9e8af91d, 0x1d46698a, 0x9f4b93d6
-data4 0x9f3f5d33, 0x1e2e52f7, 0x9f13aeec, 0x9f3b1969
-data4 0x1f0996f4, 0x9f2a03df, 0x1e264767, 0x1f3ab1fb
-data4 0x9f3193c9, 0x9f21ce22, 0x9eab624c, 0x9ecd8fb1
-data4 0x1eaf9a85, 0x1f0c6a2c, 0x1eecbe61, 0x1f3fead9
-data4 0x1f1d3a29, 0x1e9099ce, 0x1eadd875, 0x1e4dbfb8
-data4 0x9dc640d2, 0x1f413680, 0x9f3f57b3, 0x1dfa1553
-data4 0x1ec71c6b, 0x1e00cc00, 0x9f271e55, 0x1e5a88bb
-data4 0x1f46cc2b, 0x1ee80ff9, 0x9e29c6f3, 0x1f15e229
-data4 0x9ea83d66, 0x1f37408e, 0x9dacb66e, 0x1e6f6259
-data4 0x9f106973, 0x1dd4e5ac, 0x1cbfdcc8, 0x9f231c9f
-data4 0x9e8677e4, 0x9e9e695a, 0x1efd782b, 0x9dd26959
-data4 0x9e80af69, 0x1f386fb3, 0x1f022e8c, 0x9e839967
-data4 0x1ce6796f, 0x1e4c22c2, 0x1e57ef24, 0x1e919804
-data4 0x9d7ea090, 0x1e40140a, 0x1f261b46, 0x1db75be2
-data4 0x1f145019, 0x9e3102b9, 0x9e22507b, 0x1eae813c
-data4 0x1f117e97, 0x1f282296, 0x1f3814b3, 0x1e17977b
-data4 0x1f39d6ff, 0x9f1c81b9, 0x9eb5bcad, 0x1f0f596e
-data4 0x1e757fd5, 0x9f090daa, 0x9f2532fc, 0x9eebafbb
-data4 0x1f086556, 0x9eeedde8, 0x9f32e174, 0x1e33c030
-data4 0x1f1f145a, 0x1e6e556c, 0x1e419ffb, 0x9eb6019a
-data4 0x9e872a2e, 0x1e113136, 0x1e93096f, 0x1f39be40
-data4 0x1f1665ad, 0x9db81d7d, 0x9cd29091, 0x1e3f4af7
-data4 0x9f23176c, 0x9eccf9b3, 0x1f34fc6c, 0x9ed36894
-data4 0x1ef08e06, 0x9f3b46bb, 0x9f2c850b, 0x1f1565a4
-data4 0x1e887bc3, 0x1e92629c, 0x9f11ac9e, 0x9e5579f3
-data4 0x1e4d5790, 0x9ee1c3d1, 0x9e916aec, 0x9eb8d9b8
-data4 0x1db46105, 0x1e168663, 0x1f26a942, 0x9f0f0383
-data4 0x9f079032, 0x9ecae1d8, 0x1ed3b34c, 0x9edc5ee6
-data4 0x9e8a75a7, 0x1f3c3de2, 0x9ee5041e, 0x1f08c727
-data4 0x1d02d7ae, 0x9f36adda, 0x9ef9a857, 0x9ef5cb3a
-data4 0x9eee73da, 0x9da5d629, 0x1e0e99be, 0x1e5159b9
-data4 0x1f2eac89, 0x9e8eedc5, 0x1dd0ec90, 0x1f229aff
-data4 0x1ed9c3e6, 0x1e95c55a, 0x9f0c24e4, 0x1e8afed6
-data4 0x1e599a96, 0x1e881b21, 0x1eab84b9, 0x9ba2bb0e
-data4 0x9e33ab10, 0x1f1710b5, 0x1ebfa271, 0x9e90bbc5
-data4 0x9f32515b, 0x9b32aae8, 0x1eda455c, 0x1da8186e
-data4 0x9e8917ff, 0x1ec4d08e, 0x1c90069d, 0x9f2f1d29
-data4 0x9ecee86d, 0x9f234d1f, 0x1f370724, 0x1da87496
-data4 0x1e7959f0, 0x9e8ada34, 0x1f1c7f6f, 0x1edd576b
-data4 0x9de91e8b, 0x1ec4ef89, 0x1f32078a, 0x1e9925e2
-data4 0x9d8eeccb, 0x9ea3d011, 0x1f231fdf, 0x9f1dbdfa
-data4 0x1e7507a3, 0x1ec42614, 0x9e8693cb, 0x9ec68398
-data4 0x1d5b05fb, 0x1de32119, 0x9f003429, 0x9ec16d92
-data4 0x9f095315, 0x9f119d2c, 0x9ed0c984, 0x9f090662
-data4 0x9e59aa1f, 0x9ed4e64a, 0x9f2798a7, 0x9f23624d
-data4 0x1e0467d9, 0x1f22e7e7, 0x1e915256, 0x9cb4df70
-data4 0x9e6f687c, 0x9e3c35e5, 0x9e5757ab, 0x9f031fa1
-data4 0x1f25bff7, 0x1f0e58c2, 0x1ef3ce04, 0x1f002ecb
-data4 0x9ebdc836, 0x9ed657dd, 0x9f149441, 0x9e8544b2
-data4 0x1cd8ff1e, 0x1e9bb463, 0x1eaa1c5c, 0x1f200c1a
-data4 0x1edbfbaf, 0x1f18724d, 0x9ed63c22, 0x9f08e045
-data4 0x1f13ad07, 0x9e949311, 0x9f0c50d4, 0x1e824516
-data4 0x1d5e52ba, 0x1d583fbd, 0x1e3b60a9, 0x9effe6d3
-data4 0x1f0d0508, 0x1f00be77, 0x9e404bfa, 0x9e1ca381
-data4 0x9f084dd8, 0x9e6db85d, 0x1db698e4, 0x9ebd1871
-data4 0x9ecc2679, 0x1ee68442, 0x1edb1050, 0x9dbc96a4
-data4 0x9f27c1f4, 0x1c99b756, 0x1eb4400a, 0x9f24390a
-data4 0x1d927875, 0x9f074faa, 0x1e9dc2c3, 0x1f13c0d2
-data4 0x1e3c9685, 0x9e6b6f75, 0x9db9cb31, 0x1ea5f3aa
-data4 0x9d992c61, 0x1f1015e4, 0x1f194f70, 0x9e19d2b3
-data4 0x9d89116c, 0x1f23cd35, 0x1e33d3a2, 0x1ee331b8
-data4 0x1d5ba7ec, 0x9f273788, 0x9e6907f4, 0x9ed5f912
-data4 0x9edd458d, 0x1e2ca7b2, 0x1ef81fe4, 0x1dc7ade6
-data4 0x1e876e51, 0x9f04ec89, 0x1f1da63a, 0x1ec02bd0
-data4 0x9e71326f, 0x1e7847b4, 0x1f0de618, 0x9e036cb6
-data4 0x1eec61e2, 0x1ef1758b, 0x9ee880a3, 0x1ed269d7
-data4 0x1e27edd3, 0x9e8a81a1, 0x1eacb84d, 0x9e1aad37
-data4 0x1f1aa8f7, 0x1e9bbd90, 0x1ea1b61f, 0x9ed41c2f
-data4 0x1dbb5dd6, 0x1f0ec733, 0x9df06b1b, 0x1e06fef1
-data4 0x9edede3a, 0x1edeb5e2, 0x1f0e63ee, 0x9db316bb
-data4 0x9efc1ad3, 0x1f01fbb5, 0x9cc0d078, 0x1ea28b36
-data4 0x9e9dd205, 0x9e791534, 0x1da1c8d5, 0x9e8195cc
-data4 0x1f0681a4, 0x1eeaf1e2, 0x9ef83b37, 0x9f22a92b
-data4 0x1eabc4ce, 0x1f10eefb, 0x1e06d9aa, 0x1e7cacd5
-data4 0x1f1ea087, 0x1eb21983, 0x9f100c78, 0x1e840abe
-data4 0x9efab66c, 0x1f183fa8, 0x9e84ee68, 0x9eea083d
-data4 0x9ee23a74, 0x1f1351d7, 0x9ec5d42a, 0x9f071f57
-data4 0x9ef578d9, 0x9f1aa7e7, 0x1eb02044, 0x1f151a2e
-data4 0x9c0dc8b2, 0x9ef4087a, 0x1ec12b93, 0x1c1a946b
-data4 0x1e89946f, 0x9dafe8c3, 0x1d295288, 0x9e8497ab
-data4 0x1ec000c6, 0x1e102f29, 0x1e542256, 0x1e67d44d
-data4 0x1ef688d8, 0x1f0e0f29, 0x1e67861f, 0x1e869748
-data4 0x1ee6aa6e, 0x9e4d228b, 0x9e50be5b, 0x1e9fe225
-data4 0x9ea34102, 0x9e628a3b, 0x9ed9fd83, 0x1ecd7109
-data4 0x1f1864ff, 0x1ea19b76, 0x1db0d1c9, 0x9dff519b
-data4 0x1e8fea71, 0x9ee82e9a, 0x9f08919b, 0x9ef5c8ae
-data4 0x9ee446a4, 0x1ea59444, 0x1eb74230, 0x1ea13fbf
-data4 0x9ea6a3ea, 0x1e5f2797, 0x9e0adb07, 0x9d3adadd
-data4 0x1ebf2ee2, 0x1da19bfa, 0x1e8dea6d, 0x1ec4fea9
-data4 0x1e669f22, 0x1dc5f919, 0x9ed25caa, 0x1ee475b1
-data4 0x1ed0603e, 0x9eacb35c, 0x1dc00b27, 0x1e2f9991
-data4 0x1e7b0406, 0x1eaa3387, 0x9d865bde, 0x1eb78a48
-data4 0x1c40ae2e, 0x1ee9838b, 0x9f0f0d7f, 0x1e3e5d26
-data4 0x1e99e7a6, 0x9e681ccf, 0x9e93ed65, 0x9eeb6a66
-data4 0x1e29e9af, 0x9e96f923, 0x9e74f11d, 0x9f1474da
-data4 0x1eec2ea7, 0x1ebf7aa3, 0x9c25dcca, 0x9f0553c2
-data4 0x9e599efd, 0x1d2ab490, 0x1e95d7cd, 0x9ee4b20e
-data4 0x9d988ce5, 0x9ef9787e, 0x9dbbba5b, 0x9f12c304
-data4 0x1e3b9d70, 0x1e7bcae8, 0x9d98bb6e, 0x9e8e6b01
-data4 0x9f07d03b, 0x9d67c822, 0x9f0ef69e, 0x1c7c0fe3
-data4 0x9e9bfbb9, 0x9e83b84b, 0x1efbf15e, 0x9ecfa6a6
-data4 0x9c91158e, 0x9ecf6770, 0x1ee1e3a8, 0x9dc95ec0
-data4 0x1ef603f7, 0x1d5e52ba, 0x1c477d1b, 0x9e955cd8
-data4 0x1ed665b0, 0x9e8376c4, 0x9c0ee88e, 0x1e8c989e
-data4 0x1ea2df29, 0x9d961e5c, 0x1e101813, 0x1e7fffff
-data4 0x9e5abff4, 0x1dbddd71, 0x1eb69100, 0x1e71f114
-data4 0x1e9ca798, 0x1ef62c8d, 0x9db4e55a, 0x1dbe69ce
-data4 0x9ef1c01f, 0x1f044a2a, 0x9eb9e0d7, 0x9ee59745
-data4 0x9e874803, 0x1ea0b418, 0x9e13572a, 0x1ddbb3a2
-data4 0x9ec0e391, 0x1e89fba1, 0x1ee8b261, 0x9e5d25f0
-data4 0x9ef222cb, 0x9ef135ec, 0x1ea04b9a, 0x9f04291f
-data4 0x9e969254, 0x9ee32f08, 0x9ed909d3, 0x9e362640
-data4 0x9ec20735, 0x1e50131b, 0x9ed4e049, 0x1ee8e817
-data4 0x1e1e09c0, 0x9ea643c5, 0x9e5a1ab6, 0x9e389059
-data4 0x1e560947, 0x1d02b877, 0x1e4475ab, 0x9ea9aaf6
-data4 0x1e95bc5e, 0x1eaf6afd, 0x1d43067d, 0x9d043821
-data4 0x9e97baa9, 0x1de5c4f9, 0x9e9a0069, 0x9e1b9944
-data4 0x1eb13686, 0x9eb907eb, 0x1e059589, 0x1cbd0f93
-data4 0x9eb7e6ae, 0x1e9fa175, 0x1ee5bdf4, 0x1e8052f7
-data4 0x9c80d1e3, 0x1bfbe28e, 0x9e672b3b, 0x9ecacf19
-data4 0x9e3c04be, 0x1dfe8c5c, 0x1e1ba9cb, 0x1eb40b1e
-data4 0x1ec7e7f6, 0x9d0d45b3, 0x1ef0113b, 0x9a155fa3
-data4 0x1e28ec3b, 0x1e7ca8df, 0x9d2f91b4, 0x1eccd9ed
-data4 0x9ed943bc, 0x9ccaab19, 0x9e8a5c58, 0x1ec3bca8
-data4 0x1ed78dc7, 0x9ed391a8, 0x9e938f6e, 0x9ec4a030
-data4 0x9e80346e, 0x1e7a4686, 0x9e284315, 0x9e39584c
-data4 0x1ebdc9b4, 0x9e9cfce5, 0x9ef55c65, 0x1e2941e7
-data4 0x9efbe59f, 0x1d87c41b, 0x1e40befc, 0x1e3d05b5
-data4 0x1de9ea67, 0x1ec9a21c, 0x1decb69a, 0x1df6e75a
-data4 0x9e8030ab, 0x9db20540, 0x9ef1e977, 0x1e3cdc43
-data4 0x1e0492b0, 0x9e91d872, 0x1e775346, 0x9e939978
-data4 0x1eb2714e, 0x1e49a203, 0x9e10195a, 0x1ef1ffc3
-data4 0x9ea8b709, 0x9e832e27, 0x1ed5ac3b, 0x1edb20a6
-data4 0x1e4dbd4e, 0x1efbb932, 0x1d8170ec, 0x1e6c4849
-data4 0x1f008e17, 0x1e8000c4, 0x1d855ecf, 0x9e37cb85
-data4 0x1ecffdf5, 0x1eba6519, 0x9edbe600, 0x1ea3e5e7
-data4 0x1ed4fb39, 0x1f00be77, 0x1e6f4484, 0x9e9e7107
-data4 0x9e30b29d, 0x9ee6e174, 0x1e3a2656, 0x9dd72f3f
-data4 0x9ee12138, 0x1ed16fed, 0x9ece8a02, 0x9ca5b249
-data4 0x9eafd508, 0x9ef0e9fc, 0x1d1307ac, 0x1eecee20
-data4 0x1cf60c6f, 0x9d556216, 0x9eaed175, 0x9ec919f4
-data4 0x1ec2c988, 0x1cd82772, 0x9dc99456, 0x1eab0467
-data4 0x1e89b36f, 0x1c757944, 0x1eef9abd, 0x9e98664d
-ASM_SIZE_DIRECTIVE(D_table)
-
-
-
-
-
-.align 32
-.global cbrtl#
+LOCAL_OBJECT_START(poly_coeffs)
+
+       data8 0xaaaaaaaaaaaaaab1, 0x00003ffd // C_1
+       data8 0xe38e38e38e38e3e0, 0x00003ffb // C_2
+       data8 0x3faf9add3c0be9a6, 0x3fa511e8d2b1f749 // C_3, C_4
+       data8 0x3f9ee71b2c6ebe99, 0x3f9809180fd0340c // C_5, C_6
+LOCAL_OBJECT_END(poly_coeffs)
 
-.section .text
-.proc  cbrtl#
-.align 32
-cbrtl: 
 
+LOCAL_OBJECT_START(T_table)
+
+       data8 0x80155c748c374836, 0x8040404b0879f7f9
+       data8 0x806b5dce4b405c10, 0x8096b586974669b1
+       data8 0x80bcd273d952a028, 0x80e898c52813f2f3
+       data8 0x81149add67c2d208, 0x813b4e2c856b6e9a
+       data8 0x8167c1dde03de7aa, 0x818ed973b811135e
+       data8 0x81bbc0c33e13ec98, 0x81e33e69fbe7504a
+       data8 0x820aec524e3c23e9, 0x823880f78e70b805
+       data8 0x826097a62a8e5200, 0x8288dfe00e9b5eaf
+       data8 0x82b15a10c5371624, 0x82da06a527b18937
+       data8 0x8302e60b635ab394, 0x832bf8b2feec2f0e
+       data8 0x83553f0ce00e276b, 0x837eb98b50f8322a
+       data8 0x83a270f44c84f699, 0x83cc4d7cfcfac5ca
+       data8 0x83f65f78a8872b4c, 0x8420a75f2f7b53c8
+       data8 0x844510461ff14209, 0x846fbd91b930bed2
+       data8 0x84947e18234f3294, 0x84bf92755825045a
+       data8 0x84e4ac0ee112ba51, 0x8509ef44b86f20be
+       data8 0x85359d5d91768427, 0x855b3bd5b7384357
+       data8 0x858104f0c415f79a, 0x85a6f90390d29864
+       data8 0x85d3772fcd56a1dd, 0x85f9c982fcc002f3
+       data8 0x862047e0e7ea554b, 0x8646f2a26f7f5852
+       data8 0x866dca21754096b5, 0x8694ceb8dfd17a37
+       data8 0x86bc00c49e9307e8, 0x86dccd74fce79610
+       data8 0x870453c845acf90f, 0x872c089a1e90342c
+       data8 0x8753ec4a92d16c5e, 0x877bff3aca19f6b4
+       data8 0x879d88b6fe1c324c, 0x87c5f346dbf98c3a
+       data8 0x87e7c653efacef2c, 0x881089d4e73ffefc
+       data8 0x88397e6a366f2a8a, 0x885bc559e5e1c081
+       data8 0x887e2ee392bb7a93, 0x88a7a8587e404257
+       data8 0x88ca5eda67594784, 0x88f4356166bd590e
+       data8 0x89173a0acf5ce026, 0x893a62a098b6a57b
+       data8 0x895daf637236ae2c, 0x89883b9d1c2fa9c5
+       data8 0x89abd8dd374a5d7b, 0x89cf9b1dcd197fa0
+       data8 0x89f382a258ea79de, 0x8a178faf06648f29
+       data8 0x8a3bc288b3e1d18a, 0x8a601b74f4d1f835
+       data8 0x8a849aba14274764, 0x8aa9409f16cdbc9b
+       data8 0x8ace0d6bbe2cb316, 0x8af301688ab33558
+       data8 0x8b181cdebe6f3206, 0x8b3d60185fafcb7c
+       data8 0x8b62cb603bb2fad0, 0x8b80d7d6bc4104de
+       data8 0x8ba68bf73ac74f39, 0x8bcc68fb9f9f7335
+       data8 0x8bf26f31c534fca2, 0x8c10f86e13a1a1f9
+       data8 0x8c3749916cc6abb5, 0x8c5dc4c4f7706032
+       data8 0x8c7cac3a8c42e3e0, 0x8ca373f1b7bf2716
+       data8 0x8cc29907fb951294, 0x8ce9ae4e9492aac8
+       data8 0x8d0911dddbfdad0e, 0x8d3075c4f20f04ee
+       data8 0x8d5018a9d4de77d5, 0x8d77cc47dd143515
+       data8 0x8d97af6352739cb7, 0x8db7af523167800f
+       data8 0x8ddfd80bc68c32ff, 0x8e00197e1e7c88fe
+       data8 0x8e207859f77e20e7, 0x8e40f4ce60c9f8e2
+       data8 0x8e69ba46cf2fde4d, 0x8e8a7a00bd7ae63e
+       data8 0x8eab57ef1cf2f529, 0x8ecc5442cffb1dad
+       data8 0x8eed6f2d2a4acbfe, 0x8f0ea8dff24441ff
+       data8 0x8f385c95d696b817, 0x8f59dc43edd930f3
+       data8 0x8f7b7b5f5ffad1c4, 0x8f9d3a1bea165f38
+       data8 0x8fbf18adc34b66da, 0x8fe117499e356095
+       data8 0x90033624aa685f8d, 0x9025757495f36b86
+       data8 0x903f3a5dcc091203, 0x9061b2fceb2bdbab
+       data8 0x90844ca7211032a7, 0x90a7079403e6a15d
+       data8 0x90c9e3fbafd63799, 0x90ece216c8a16ee4
+       data8 0x9110021e7b516f0a, 0x912a708a39be9075
+       data8 0x914dcc7b31146370, 0x91714af8cfe984d5
+       data8 0x918c00a6f3795e97, 0x91afbc299ed0295d
+       data8 0x91d39add3e958db0, 0x91ee9920a8974d92
+       data8 0x9212b5fcac537c19, 0x9236f6b256923fcf
+       data8 0x92523ee6f90dcfc3, 0x9276bef031e6eb79
+       data8 0x929236ec237a24ad, 0x92b6f70b7efe9dc3
+       data8 0x92d29f61eec7dc2b, 0x92f7a05d5b8ba92f
+       data8 0x931379a403be5c16, 0x9338bc44de2e3f34
+       data8 0x9354c71412c69486, 0x937a4c273907e262
+       data8 0x93968919f6e7975d, 0x93bc516fdd4680c9
+       data8 0x93d8c123d9be59b2, 0x93f546c955e60076
+       data8 0x941b70a65879079f, 0x943829f337410591
+       data8 0x9454f995765bc4d2, 0x947b86b57f5842ed
+       data8 0x94988aeb23470f86, 0x94b5a5dc9695f42a
+       data8 0x94d2d7a9170d8b42, 0x94f9e87dd78bf019
+       data8 0x95175019a503d89e, 0x9534cefa625fcb3a
+       data8 0x955265405c491a25, 0x9570130c1f9bb857
+       data8 0x9597ca4119525184, 0x95b5af6fb5aa4d3c
+       data8 0x95d3ac9273aafd7a, 0x95f1c1cafdfd3684
+       data8 0x960fef3b430b8d5f, 0x962e350575b409c5
+       data8 0x964c934c0dfc1708, 0x966b0a31c9c6bc7d
+       data8 0x968999d9ad8d264e, 0x96a8426705198795
+       data8 0x96c703fd64445ee5, 0x96e5dec0a7b4268d
+       data8 0x9704d2d4f59f79f3, 0x9723e05ebe91b9b0
+       data8 0x97430782be323831, 0x97624865fc0df8bf
+       data8 0x9781a32dcc640b2a, 0x97a117ffd0f48e46
+       data8 0x97c0a701f9d263c9, 0x97e0505a8637a036
+       data8 0x97f57a9fb0b08c6e, 0x9815503365914a9d
+       data8 0x98354085054fd204, 0x98554bbbf8a77902
+       data8 0x987571fffb7f94f6, 0x9895b3791dd03c23
+       data8 0x98ab43a5fc65d0c8, 0x98cbb2d196bd713d
+       data8 0x98ec3d9ec7b6f21a, 0x990ce436db5e8344
+       data8 0x9922b8218160967a, 0x99438d686f75779d
+       data8 0x99647eea131fa20b, 0x997a85045a47c6d0
+       data8 0x999ba5f14f8add02, 0x99bce38b5465ecae
+       data8 0x99d31ca0887f30f9, 0x99f48a669c74c09e
+       data8 0x9a16154eb445c873, 0x9a2c822ec198d667
+       data8 0x9a4e3e080cd91b78, 0x9a70177afe52322e
+       data8 0x9a86b8fa94eebe10, 0x9aa8c42866ae2958
+       data8 0x9abf86f9e12fc45e, 0x9ae1c462fc05f49d
+       data8 0x9af8a8dc936b84d0, 0x9b1b19033be35730
+       data8 0x9b3da7daf04c2892, 0x9b54c2e4c8a9012b
+       data8 0x9b77854e6c661200, 0x9b8ec2e678d56d2f
+       data8 0x9ba60e6a5ca133b6, 0x9bc919ea66a151a4
+       data8 0x9be0887c09ef82bb, 0x9c03c8d5fffc3503
+       data8 0x9c1b5ad21a81cbb9, 0x9c3ed09216e9ca02
+       data8 0x9c568656c0423def, 0x9c7a320af242ce60
+       data8 0x9c920bf7a8c01dc2, 0x9ca9f475d98b159c
+       data8 0x9ccdeca60e80b5f8, 0x9ce5f9d4653d4902
+       data8 0x9cfe15cb38bfdd8e, 0x9d225b983f6c1f96
+       data8 0x9d3a9cca32261ed7, 0x9d52ecfccebe1768
+       data8 0x9d77818d95b82f86, 0x9d8ff7893fa4706c
+       data8 0x9da87cbef36f2a5e, 0x9dcd6140b4a35aeb
+       data8 0x9de60cd06dc6e2d4, 0x9dfec7d4cc43b76f
+       data8 0x9e17925ec9fccc4a, 0x9e3cdf6db57dc075
+       data8 0x9e55d110b63637a8, 0x9e6ed27594550d2e
+       data8 0x9e87e3adc385d393, 0x9ead9b54b37a1055
+       data8 0x9ec6d46a3d7de215, 0x9ee01d9108be3154
+       data8 0x9ef976db07288d04, 0x9f12e05a4759ec25
+       data8 0x9f2c5a20f4da6668, 0x9f52af78ed1733ca
+       data8 0x9f6c52426a39d003, 0x9f860593d42fd7f3
+       data8 0x9f9fc97fdb96bd51, 0x9fb99e194f4a7037
+       data8 0x9fd383731ca51db9, 0x9fed79a04fbf9423
+       data8 0xa00780b413b24ee8, 0xa02eab2c4474b0cd
+       data8 0xa048dcd51ccfd142, 0xa0631fa894b11b8d
+       data8 0xa07d73ba65e680af, 0xa097d91e6aaf71b0
+       data8 0xa0b24fe89e02602f, 0xa0ccd82d1bd2f68b
+       data8 0xa0e77200215909e6, 0xa1021d760d584855
+       data8 0xa11cdaa36068a57d, 0xa137a99cbd3f880b
+       data8 0xa160019ed37fb4ae, 0xa1960b5966da4608
+       data8 0xa1cc5dbe6dc2aab4, 0xa202f97995b69c0d
+       data8 0xa232fe6eb0c0577d, 0xa26a2582012f6e17
+       data8 0xa2a197e5d10465cb, 0xa2d25a532efefbc8
+       data8 0xa30a5bd6e49e4ab8, 0xa33b9c9b59879e24
+       data8 0xa3742fca6a3c1f21, 0xa3a5f1273887bf22
+       data8 0xa3d7ef508ff11574, 0xa4115ce30548bc15
+       data8 0xa443df0e53df577a, 0xa4769fa5913c0ec3
+       data8 0xa4a99f303bc7def5, 0xa4dcde37779adf4b
+       data8 0xa5105d46152c938a, 0xa5441ce89825cb8d
+       data8 0xa5781dad3e54d899, 0xa5ac602406c4e68c
+       data8 0xa5d9601d95c2c0bc, 0xa60e1e1a2de14745
+       data8 0xa6431f6e3fbd9658, 0xa67864b0d432fda4
+       data8 0xa6a6444aa0243c0b, 0xa6dc094d10f25792
+       data8 0xa70a574cc02bba69, 0xa7409e2af9549084
+       data8 0xa76f5c64ca2cf13b, 0xa79e4f0babab5dc0
+       data8 0xa7d5579ae5164b85, 0xa804bd3c6fe61cc8
+       data8 0xa8345895e5250a5a, 0xa8642a122b44ef0b
+       data8 0xa89c38ca18f6108b, 0xa8cc81063b6e87ca
+       data8 0xa8fd00bfa409285e, 0xa92db8664d5516da
+       data8 0xa95ea86b75cc2c20, 0xa98fd141a4992deb
+       data8 0xa9c1335cae7446ba, 0xa9ea8686f556f645
+       data8 0xaa1c52d17906bb19, 0xaa4e59b046dab887
+       data8 0xaa809b9c60d1890b, 0xaab319102f3f9b33
+       data8 0xaadd5a18c1e21274, 0xab1045f2ac31bdf5
+       data8 0xab3ae3ab2df7231e, 0xab6e3f945d1e96fc
+       data8 0xaba1d953a08fa94e, 0xabcd090db7ef4c3f
+       data8 0xabf864602d7c323d, 0xac2ca5886ccf9b57
+       data8 0xac5861d4aa441f0f, 0xac8d183fe3a2fbed
+       data8 0xacb93703ff51571e, 0xace5830ad0c3f14b
+       data8 0xad11fca5d78b3ff2, 0xad4797fddf91a798
+       data8 0xad747701e559ebcb, 0xada184a47e9c7613
+       data8 0xadcec13ab0dda8ff, 0xadfc2d1a5fd21ba8
+       data8 0xae29c89a5053c33a, 0xae5794122b638df9
+       data8 0xae858fda8137ae0a, 0xaeb3bc4ccc56d3d1
+       data8 0xaee219c374c09920, 0xaf10a899d3235fe7
+       data8 0xaf3f692c341fe8b4, 0xaf6e5bd7db9ae6c2
+       data8 0xaf9d80fb081cd91b, 0xafc35ce063eb3787
+       data8 0xaff2ddcb5f28f03d, 0xb022923b148e05c5
+       data8 0xb0527a919adbf58b, 0xb078f3ab1d701c65
+       data8 0xb0a93a6870649f31, 0xb0d9b624d62ec856
+       data8 0xb100a5f53fb3c8e1, 0xb131821882f5540a
+       data8 0xb158bf8e4cb04055, 0xb189fd69d56b238f
+       data8 0xb1b189958e8108e4, 0xb1e32a8165b09832
+       data8 0xb20b0678fc271eec, 0xb23d0bd3f7592b6e
+       data8 0xb26538b2db8420dc, 0xb28d89e339ceca14
+       data8 0xb2c022ca12e55a16, 0xb2e8c6852c6b03f1
+       data8 0xb3118f4eda9fe40f, 0xb33a7d6268109ebe
+       data8 0xb36ddbc5ea70ec55, 0xb3971e9b39264023
+       data8 0xb3c0877ecc18e24a, 0xb3ea16ae3a6c905f
+       data8 0xb413cc67aa0e4d2d, 0xb43da8e9d163e1af
+       data8 0xb47233773b84d425, 0xb49c6825430fe730
+       data8 0xb4c6c46bcdb27dcf, 0xb4f1488c0b35d26f
+       data8 0xb51bf4c7c51f0168, 0xb546c9616087ab9c
+       data8 0xb571c69bdffd9a70, 0xb59cecbae56984c3
+       data8 0xb5bd64512bb14bb7, 0xb5e8d2a4bf5ba416
+       data8 0xb6146a9a1bc47819, 0xb6402c7749d621c0
+       data8 0xb66c1882fb435ea2, 0xb6982f048c999a56
+       data8 0xb6c47044075b4142, 0xb6e5bd6bfd02bafd
+       data8 0xb7124a2736ff8ef2, 0xb73f026a01e94177
+       data8 0xb760a959f1d0a7a7, 0xb78dae7e06868ab0
+       data8 0xb7badff8ad9e4e02, 0xb7dce25b8e17ae9f
+       data8 0xb80a6226904045e2, 0xb8380f1cafd73c1c
+       data8 0xb85a6ea8e321b4d8, 0xb8886b684ae7d2fa
+       data8 0xb8ab0726fa00cf5d, 0xb8d954a4d13b7cb1
+       data8 0xb8fc2d4f6cd9f04a, 0xb92acc851476b1ab
+       data8 0xb94de2d841a184c2, 0xb97cd4c36c92693c
+       data8 0xb9a0297f172665e3, 0xb9cf6f21e36c3924
+       data8 0xb9f3030951267208, 0xba229d6a618e7c59
+       data8 0xba467144459f9855, 0xba6a60c3c48f1a4b
+       data8 0xba9a76056b67ee7a, 0xbabea699563ada6e
+       data8 0xbae2f350b262cc4b, 0xbb1385a23be24e57
+       data8 0xbb3814975e17c680, 0xbb5cc031009bf467
+       data8 0xbb81889680024764, 0xbbb2c0d8703ae95d
+       data8 0xbbd7cd09ba3c5463, 0xbbfcf68c4977718f
+       data8 0xbc223d88cfc88eee, 0xbc47a2284fee4ff8
+       data8 0xbc79ac0916ed7b8a, 0xbc9f5670d1a13030
+       data8 0xbcc51f068cb95c1d, 0xbceb05f4b30a9bc0
+       data8 0xbd110b6604c7d306, 0xbd372f8598620f19
+       data8 0xbd5d727edb6b3c7e, 0xbd83d47d937bbc6d
+       data8 0xbdaa55addf1ae47d, 0xbdd0f63c36aa73f0
+       data8 0xbdf7b6556d550a15, 0xbe1e9626b1ffa96b
+       data8 0xbe4595dd903e5371, 0xbe6cb5a7f14bc935
+       data8 0xbe93f5b41d047cf7, 0xbebb5630bae4c15f
+       data8 0xbee2d74cd30a430c, 0xbf0a7937cf38d981
+       data8 0xbf323c217be2bc8c, 0xbf5a203a09342bbb
+       data8 0xbf74cad1c14ebfc4, 0xbf9ce6a497a89f78
+       data8 0xbfc52428bec6e72f, 0xbfed838fddab024b
+       data8 0xc016050c0420981a, 0xc03ea8cfabddc330
+       data8 0xc059d3cbd65ddbce, 0xc082b122a3c78c9d
+       data8 0xc0abb1499ae736c4, 0xc0d4d474c3aedaaf
+       data8 0xc0f054ca33eb3437, 0xc119b2c67e600ed0
+       data8 0xc1433453de2033ff, 0xc15ef3e44e10032d
+       data8 0xc188b130431d80e6, 0xc1b2929d6067730e
+       data8 0xc1ce9268f31cc734, 0xc1f8b0877c1b0c08
+       data8 0xc222f35a87b415ba, 0xc23f3467349e5c88
+       data8 0xc269b4e40e088c01, 0xc2945aac24daaf6e
+       data8 0xc2b0de05e43c1d66, 0xc2dbc275e1229d09
+       data8 0xc2f86fca9d80eeff, 0xc323938449a2587e
+       data8 0xc3406b40a538ed20, 0xc36bcee8211d15e0
+       data8 0xc397593adf2ba366, 0xc3b475b6206155d5
+       data8 0xc3e0410243b97383, 0xc3fd890709833d37
+       data8 0xc41ae295f7e7fa06, 0xc44709f7bb8a4dd2
+       data8 0xc4648fb0e0bec4c1, 0xc490f9a94695ba14
+       data8 0xc4aeac0173b7d390, 0xc4db5941007aa853
+       data8 0xc4f938aec206291a, 0xc52629e899dfd622
+       data8 0xc54436e44043b965, 0xc562563abf9ea07f
+       data8 0xc58fa7d1dc42921c, 0xc5adf561b91e110a
+       data8 0xc5cc5591bdbd82fa, 0xc5fa08f1ff20593c
+       data8 0xc618980a79ce6862, 0xc6373a09e34b50fa
+       data8 0xc66550a6e0baaf35, 0xc6842241926342c9
+       data8 0xc6a3070b7c93bb9e, 0xc6d18260bb84081b
+       data8 0xc6f0977c9416828b, 0xc70fc0117c641630
+       data8 0xc72efc34d7e615be, 0xc75dfb441594141e
+       data8 0xc77d68aa019bda4c, 0xc79ce9ea478dbc4f
+       data8 0xc7bc7f1ae453219d, 0xc7ec0476e15e141a
+       data8 0xc80bcbe16f1d540f, 0xc82ba78a5d349735
+       data8 0xc84b978847a06b87, 0xc86b9bf1ee817bc6
+       data8 0xc88bb4de3667cdf4, 0xc8bc00e7fe9e23a3
+       data8 0xc8dc4d7ff2d25232, 0xc8fcaeebcb40eb47
+       data8 0xc91d25431426a663, 0xc93db09d7fdb2949
+       data8 0xc95e5112e721582a, 0xc97f06bb49787677
+       data8 0xc99fd1aecd6e1b06, 0xc9d12a3e27bb1625
+       data8 0xc9f22ad82ba3d5f0, 0xca134113105e67b2
+       data8 0xca346d07b045a876, 0xca55aecf0e94bb88
+       data8 0xca77068257be9bab, 0xca98743ae1c693a8
+       data8 0xcab9f8122c99a101, 0xcadb9221e268c3b5
+       data8 0xcafd4283d8043dfd, 0xcb1f09520d37c6fb
+       data8 0xcb51ddcb9e93095e, 0xcb95f333968ad59b
+       data8 0xcbda64292d3ffd97, 0xcc1f3184af961596
+       data8 0xcc5bb1ac954d33e2, 0xcca12e9831fc6402
+       data8 0xcce70a67b64f24ad, 0xcd24794726477ea5
+       data8 0xcd6b096a0b70ee87, 0xcda9177738b15a90
+       data8 0xcdf05f2247dffab9, 0xce2f0f347f96f906
+       data8 0xce6e0be0cd551a61, 0xceb666b2c347d1de
+       data8 0xcef609b0cb874f00, 0xcf35fb5447e5c765
+       data8 0xcf763c47ee869f00, 0xcfb6cd3888d71785
+       data8 0xcff7aed4fbfbb447, 0xd038e1ce5167e3c6
+       data8 0xd07a66d7bfa0ebba, 0xd0bc3ea6b32d1b21
+       data8 0xd0f4f0e8f36c1bf8, 0xd1376458e34b037e
+       data8 0xd17a2ca133f78572, 0xd1bd4a80301c5715
+       data8 0xd1f71682b2fa4575, 0xd23ad555f773f059
+       data8 0xd2752c7039a5bf73, 0xd2b98ee008c06b59
+       data8 0xd2f4735ffd700280, 0xd32f99ed6d9ac0e1
+       data8 0xd374f0666c75d51c, 0xd3b0a7d13618e4a1
+       data8 0xd3eca2ea53bcec0c, 0xd428e23874f13a17
+       data8 0xd46f82fe293bc6d3, 0xd4ac57e9b7186420
+       data8 0xd4e972becb04e8b8, 0xd526d40a7a9b43a3
+       data8 0xd5647c5b73917370, 0xd5a26c4201bd6d13
+       data8 0xd5e0a45015350a7e, 0xd614b539c6194104
+       data8 0xd6537310e224283f, 0xd6927ab62244c917
+       data8 0xd6d1ccc1fc4ef4b7, 0xd71169cea98fdded
+       data8 0xd746a66a5bc9f6d9, 0xd786ce8f0fae5317
+       data8 0xd7bc7ff214c4e75a, 0xd7fd35467a517ed1
+       data8 0xd83e38838648d815, 0xd874a1db598b8951
+       data8 0xd8ab42205b80edaf, 0xd8ed1849d202f965
+       data8 0xd92432bd5a173685, 0xd9669ca45b03c23e
+       data8 0xd99e3327cf89574e, 0xd9d602b19b100466
+       data8 0xda0e0ba86c096841, 0xda5195fcdb1c3dce
+       data8 0xda8a1eb87a491f6c, 0xdac2e230b91c3f84
+       data8 0xdafbe0d0b66aea30, 0xdb351b04a8fafced
+       data8 0xdb6e9139e33cdd8e, 0xdba843ded7151ea1
+       data8 0xdbe2336319b61fc8, 0xdc1c60376789fa68
+       data8 0xdc56cacda82d0cd5, 0xdc917398f2797814
+       data8 0xdccc5b0d90a3e628, 0xdd0781a10469f0f2
+       data8 0xdd42e7ca0b52838f, 0xdd729ad01c69114d
+       data8 0xddae749c001fbf5e, 0xddea8f50a51c69b1
+       data8 0xde26eb69a0f0f111, 0xde576480262399bc
+       data8 0xde943789645933c8, 0xded14d58139a28af
+       data8 0xdf025c00bbf2b5c7, 0xdf3feb44d723a713
+       data8 0xdf715bc16c159be0, 0xdfaf66240e29cda8
+       data8 0xdfe139cbf6e19bdc, 0xe01fc0fe94d9fc52
+       data8 0xe051f92ffcc0bd60, 0xe090feec9c9a06ac
+       data8 0xe0c39d0c9ff862d6, 0xe0f668eeb99f188d
+       data8 0xe1362890eb663139, 0xe1695c7212aecbaa
+       data8 0xe19cbf0391bbbbe9, 0xe1d050901c531e85
+       data8 0xe2110903b4f4047a, 0xe2450559b4d80b6d
+       data8 0xe27931a231554ef3, 0xe2ad8e2ac3c5b04b
+       data8 0xe2e21b41b9694cce, 0xe316d93615862714
+       data8 0xe3590bd86a0d30f9, 0xe38e38e38e38e38e
+       data8 0xe3c397d1e6db7839, 0xe3f928f5953feb9e
+       data8 0xe42eeca17c62886c, 0xe464e32943446305
+       data8 0xe49b0ce15747a8a2, 0xe4d16a1eee94e9d4
+       data8 0xe4fa52107353f67d, 0xe5310a471f4d2dc3
+       data8 0xe567f6f1c2b9c224, 0xe59f18689a9e4c9a
+       data8 0xe5d66f04b8a68ecf, 0xe60dfb2005c192e9
+       data8 0xe645bd1544c7ea51, 0xe66fb21b505b20a0
+       data8 0xe6a7d32af4a7c59a, 0xe6e02b129c6a5ae4
+       data8 0xe70a9136a7403039, 0xe74349fb2d92a589
+       data8 0xe77c3a9c86ed7d42, 0xe7a713f88151518a
+       data8 0xe7e067453317ed2b, 0xe819f37a81871bb5
+       data8 0xe8454236bfaeca14, 0xe87f32f24c3fc90e
+       data8 0xe8aacd8688892ba6, 0xe8e523fd32f606f7
+       data8 0xe9110b5311407927, 0xe94bc8bf0c108fa3
+       data8 0xe977fdc439c2ca3c, 0xe9b3236528fc349e
+       data8 0xe9dfa70b745ac1b4, 0xea1b36268d0eaa38
+       data8 0xea480963fd394197, 0xea84034425f27484
+       data8 0xeab12713138dd1cc, 0xeade6db73a5e503b
+       data8 0xeb1b0268343b121b, 0xeb489b0b2bdb5f14
+       data8 0xeb765721e85f03d0, 0xebb389645f222f62
+       data8 0xebe198f090607e0c, 0xec0fcc9321024509
+       data8 0xec3e247da8b82f61, 0xec7c27d21321c9f7
+       data8 0xecaad5278824e453, 0xecd9a76d097d4e77
+       data8 0xed089ed5dcd99446, 0xed37bb95add09a1c
+       data8 0xed76c70508f904b6, 0xeda63bb05e7f93c6
+       data8 0xedd5d661daed2dc4, 0xee05974eef86b903
+       data8 0xee357ead791fc670, 0xee658cb3c134a463
+       data8 0xee95c1987f080211, 0xeec61d92d8c4314f
+       data8 0xeef6a0da64a014ac, 0xef274ba72a07c811
+       data8 0xef581e31a2c91260, 0xef8918b2bc43aec6
+       data8 0xefba3b63d89d7cbf, 0xefeb867ecffaa607
+       data8 0xf01cfa3df1b9c9fa, 0xf04e96dc05b43e2d
+       data8 0xf0805c944d827454, 0xf0b24ba285c495cb
+       data8 0xf0e46442e76f6569, 0xf116a6b2291d7896
+       data8 0xf1383fa9e9b5b381, 0xf16ac84f90083b9b
+       data8 0xf19d7b686dcb03d7, 0xf1d0593311db1757
+       data8 0xf20361ee8f1c711e, 0xf23695da7de51d3f
+       data8 0xf258d095e465cc35, 0xf28c4d0bfc982b34
+       data8 0xf2bff55eb3f0ea71, 0xf2f3c9cf9884636e
+       data8 0xf31670135ab9cc0f, 0xf34a8e9f0b54cdfb
+       data8 0xf37ed9fa6b8add3f, 0xf3a1cfe884ef6bb6
+       data8 0xf3d66689dcc8e8d3, 0xf40b2ab069d5c96a
+       data8 0xf42e718b90c8bc16, 0xf463822a0a3b4b00
+       data8 0xf498c1076015faf8, 0xf4bc5a19a33990b5
+       data8 0xf4f1e6a7d6f5425f, 0xf527a232cf6be334
+       data8 0xf54b8ecdcda90851, 0xf5819949c7ad87b4
+       data8 0xf5a5bac9213b48a9, 0xf5dc1501f324a812
+       data8 0xf6006bee86b5589e, 0xf63716b2fa067fa4
+       data8 0xf66df22fb6132b9c, 0xf6929fb98225deb1
+       data8 0xf6c9cd13021e3fea, 0xf6eeb177472cedae
+       data8 0xf713abf4cb0b3afb, 0xf74b4d5333684ef1
+       data8 0xf7707f75a72f8e94, 0xf7a874b97927af44
+       data8 0xf7cddf140aedf1d8, 0xf806291bacb7f7a9
+       data8 0xf82bcc43b92eafef, 0xf8646bf0defb759e
+       data8 0xf88a487dfc3ff5f7, 0xf8b03c2b46cdc17f
+       data8 0xf8e95541c152ae7a, 0xf90f832c2700c160
+       data8 0xf935c88e0c7f419b, 0xf96f5cd84fd86873
+       data8 0xf995dd53ebdd9d6d, 0xf9bc75a034436a41
+       data8 0xf9f686f26d5518de, 0xfa1d5b39b910a8c5
+       data8 0xfa4447acc4ecbfd2, 0xfa7ed7e51e6fdfb4
+       data8 0xfaa601394d49a1a0, 0xfacd431644ce0e40
+       data8 0xfaf49d96f7a75909, 0xfb2fd3c65e562fd5
+       data8 0xfb576c5762024805, 0xfb7f1debc22c4040
+       data8 0xfba6e89f32d0190a, 0xfbe2c803a0894893
+       data8 0xfc0ad1ff0ed9ecf0, 0xfc32f57bdfbcbe7f
+       data8 0xfc5b32968f99b21c, 0xfc83896bc861ab08
+       data8 0xfcabfa1861ed4815, 0xfce8d3cea7d3163e
+       data8 0xfd118595143ee273, 0xfd3a519943d4865a
+       data8 0xfd6337f8e1ae5a4b, 0xfd8c38d1c8e927eb
+       data8 0xfdb5544205095a53, 0xfdde8a67d2613531
+       data8 0xfe07db619e781611, 0xfe460768d80bf758
+       data8 0xfe6f9bfb06cd32f6, 0xfe994bcd3d14fcc2
+       data8 0xfec316fecaf3f2ab, 0xfeecfdaf33fadb80
+       data8 0xff16fffe2fa8fad6, 0xff411e0ba9db886d
+       data8 0xff6b57f7c33e4e9a, 0xff95ade2d1bd7358
+       data8 0xffc01fed60f86fb5, 0xffeaae3832b63956
+LOCAL_OBJECT_END(T_table)
+
+
+LOCAL_OBJECT_START(D_table)
+
+       data4 0x1e50f488, 0x1ebdc559, 0x1e649ec1, 0x9eed9b2c
+       data4 0x9e511c44, 0x9ec6d551, 0x9eefe248, 0x9e313854
+       data4 0x9f54ff18, 0x9d231411, 0x1ee5d63c, 0x9edf6b95
+       data4 0x9f332aaa, 0x1dc92a84, 0x1f73fb7b, 0x1e32f100
+       data4 0x9ea636f5, 0x9f6c3353, 0x9f405552, 0x1f33fd97
+       data4 0x1e975291, 0x9e59a11e, 0x1e47b0ba, 0x9d8ad33e
+       data4 0x1ea51bf6, 0x1f25d782, 0x9ecf534d, 0x1f55436f
+       data4 0x1d0975e4, 0x9f0633a1, 0x1f3e840a, 0x1f523a4c
+       data4 0x9f53cbbc, 0x9c8b5661, 0x9f6bc8eb, 0x1f4f6c7b
+       data4 0x9ed9b376, 0x9f5b30b6, 0x1f64fa5e, 0x1cbcc3e0
+       data4 0x1f343548, 0x1f62a6a2, 0x9f336abb, 0x9f1d15af
+       data4 0x1f476c83, 0x1ea86421, 0x1f33b2cf, 0x9e8f1348
+       data4 0x1f6fa829, 0x9f30ee3a, 0x9ebd6146, 0x1f2db598
+       data4 0x1ef9600d, 0x1f5b1427, 0x9edd741b, 0x1f51ef4e
+       data4 0x9f1aa57d, 0x9ee9b5e0, 0x9f17ecd7, 0x1ead71ff
+       data4 0x1f6c910e, 0x9e1837df, 0x9f0f17d9, 0x9e8350dd
+       data4 0x9d292f1b, 0x9e33b3ab, 0x9d6f0fe8, 0x9ed8c7cc
+       data4 0x9ec598c8, 0x9d56758c, 0x1e090c1e, 0x9ed4b941
+       data4 0x9f1fc4cf, 0x1f63513a, 0x9edd0abc, 0x1e3924dd
+       data4 0x1f60d56f, 0x1ea84424, 0x9e88f4fb, 0x1f205c09
+       data4 0x1ec9ae4e, 0x1d2d5738, 0x9f2c9f6d, 0x1e0765c2
+       data4 0x1e8bbdd7, 0x9f16d9f1, 0x9ea62627, 0x1f13904c
+       data4 0x1e566ab8, 0x9dca3d1a, 0x9e91f2a1, 0x9f14641c
+       data4 0x9f278946, 0x1f490c1e, 0x1f575eb6, 0x1f50b3fd
+       data4 0x9da32efb, 0x1ea95e59, 0x9e41e058, 0x9eada15f
+       data4 0x9e4fe66c, 0x1f3abc98, 0x1f1b8d1e, 0x9ece97e4
+       data4 0x1d188aed, 0x9e89b6ee, 0x1f287478, 0x9e8a161a
+       data4 0x1e4749f7, 0x9e68084a, 0x1e867f33, 0x9f462b63
+       data4 0x1db30792, 0x1f59a767, 0x9d1da4ae, 0x9f472a33
+       data4 0x1d1e91cd, 0x9f414824, 0x9f473d4f, 0x1f4b5783
+       data4 0x9f5b04b8, 0x9f5c205b, 0x1f309617, 0x9f0d6852
+       data4 0x9d96a609, 0x9f0965c2, 0x9e23f467, 0x9f089884
+       data4 0x9ec71458, 0x9ed6e955, 0x1e5e8691, 0x1f5b2bbc
+       data4 0x9f128268, 0x1ed40f5b, 0x1dc430ce, 0x1f345986
+       data4 0x1d778f72, 0x1e9b11d6, 0x9f5a40be, 0x9e07f61a
+       data4 0x9ed641a7, 0x9f334787, 0x1e952fd0, 0x1edeb5e2
+       data4 0x9e9f3eb1, 0x9e379fd9, 0x1f13102a, 0x9e5e80e1
+       data4 0x1c757944, 0x1dae2260, 0x1f183ab7, 0x1e55d576
+       data4 0x9e6bb99f, 0x9f52d7cb, 0x9e73a0f5, 0x1d4e1d14
+       data4 0x9dd05b53, 0x1f2261e4, 0x9d4ee73d, 0x1ede515e
+       data4 0x1f22a573, 0x9ecac348, 0x1e6a2ac0, 0x1e2787d2
+       data4 0x9eb64b87, 0x1f0c69c6, 0x9f470a01, 0x9d7c1686
+       data4 0x1e468ebe, 0x9f21ee2f, 0x9ee52116, 0x9e20f715
+       data4 0x1ed18533, 0x9f005b38, 0x9f20cb95, 0x1da72967
+       data4 0x1f1ba5d7, 0x1e2f8b16, 0x9c794f96, 0x9ca74ea3
+       data4 0x1f410555, 0x9eff2b96, 0x1ce8f0b1, 0x1f0cee77
+       data4 0x1f191edd, 0x9ed5fcbc, 0x1f30f242, 0x9e0ad369
+       data4 0x1ed8f3c8, 0x1f52bb0e, 0x9e9ce408, 0x1f18907f
+       data4 0x9ecdad40, 0x9e8af91d, 0x1d46698a, 0x9f4b93d6
+       data4 0x9f3f5d33, 0x1e2e52f7, 0x9f13aeec, 0x9f3b1969
+       data4 0x1f0996f4, 0x9f2a03df, 0x1e264767, 0x1f3ab1fb
+       data4 0x9f3193c9, 0x9f21ce22, 0x9eab624c, 0x9ecd8fb1
+       data4 0x1eaf9a85, 0x1f0c6a2c, 0x1eecbe61, 0x1f3fead9
+       data4 0x1f1d3a29, 0x1e9099ce, 0x1eadd875, 0x1e4dbfb8
+       data4 0x9dc640d2, 0x1f413680, 0x9f3f57b3, 0x1dfa1553
+       data4 0x1ec71c6b, 0x1e00cc00, 0x9f271e55, 0x1e5a88bb
+       data4 0x1f46cc2b, 0x1ee80ff9, 0x9e29c6f3, 0x1f15e229
+       data4 0x9ea83d66, 0x1f37408e, 0x9dacb66e, 0x1e6f6259
+       data4 0x9f106973, 0x1dd4e5ac, 0x1cbfdcc8, 0x9f231c9f
+       data4 0x9e8677e4, 0x9e9e695a, 0x1efd782b, 0x9dd26959
+       data4 0x9e80af69, 0x1f386fb3, 0x1f022e8c, 0x9e839967
+       data4 0x1ce6796f, 0x1e4c22c2, 0x1e57ef24, 0x1e919804
+       data4 0x9d7ea090, 0x1e40140a, 0x1f261b46, 0x1db75be2
+       data4 0x1f145019, 0x9e3102b9, 0x9e22507b, 0x1eae813c
+       data4 0x1f117e97, 0x1f282296, 0x1f3814b3, 0x1e17977b
+       data4 0x1f39d6ff, 0x9f1c81b9, 0x9eb5bcad, 0x1f0f596e
+       data4 0x1e757fd5, 0x9f090daa, 0x9f2532fc, 0x9eebafbb
+       data4 0x1f086556, 0x9eeedde8, 0x9f32e174, 0x1e33c030
+       data4 0x1f1f145a, 0x1e6e556c, 0x1e419ffb, 0x9eb6019a
+       data4 0x9e872a2e, 0x1e113136, 0x1e93096f, 0x1f39be40
+       data4 0x1f1665ad, 0x9db81d7d, 0x9cd29091, 0x1e3f4af7
+       data4 0x9f23176c, 0x9eccf9b3, 0x1f34fc6c, 0x9ed36894
+       data4 0x1ef08e06, 0x9f3b46bb, 0x9f2c850b, 0x1f1565a4
+       data4 0x1e887bc3, 0x1e92629c, 0x9f11ac9e, 0x9e5579f3
+       data4 0x1e4d5790, 0x9ee1c3d1, 0x9e916aec, 0x9eb8d9b8
+       data4 0x1db46105, 0x1e168663, 0x1f26a942, 0x9f0f0383
+       data4 0x9f079032, 0x9ecae1d8, 0x1ed3b34c, 0x9edc5ee6
+       data4 0x9e8a75a7, 0x1f3c3de2, 0x9ee5041e, 0x1f08c727
+       data4 0x1d02d7ae, 0x9f36adda, 0x9ef9a857, 0x9ef5cb3a
+       data4 0x9eee73da, 0x9da5d629, 0x1e0e99be, 0x1e5159b9
+       data4 0x1f2eac89, 0x9e8eedc5, 0x1dd0ec90, 0x1f229aff
+       data4 0x1ed9c3e6, 0x1e95c55a, 0x9f0c24e4, 0x1e8afed6
+       data4 0x1e599a96, 0x1e881b21, 0x1eab84b9, 0x9ba2bb0e
+       data4 0x9e33ab10, 0x1f1710b5, 0x1ebfa271, 0x9e90bbc5
+       data4 0x9f32515b, 0x9b32aae8, 0x1eda455c, 0x1da8186e
+       data4 0x9e8917ff, 0x1ec4d08e, 0x1c90069d, 0x9f2f1d29
+       data4 0x9ecee86d, 0x9f234d1f, 0x1f370724, 0x1da87496
+       data4 0x1e7959f0, 0x9e8ada34, 0x1f1c7f6f, 0x1edd576b
+       data4 0x9de91e8b, 0x1ec4ef89, 0x1f32078a, 0x1e9925e2
+       data4 0x9d8eeccb, 0x9ea3d011, 0x1f231fdf, 0x9f1dbdfa
+       data4 0x1e7507a3, 0x1ec42614, 0x9e8693cb, 0x9ec68398
+       data4 0x1d5b05fb, 0x1de32119, 0x9f003429, 0x9ec16d92
+       data4 0x9f095315, 0x9f119d2c, 0x9ed0c984, 0x9f090662
+       data4 0x9e59aa1f, 0x9ed4e64a, 0x9f2798a7, 0x9f23624d
+       data4 0x1e0467d9, 0x1f22e7e7, 0x1e915256, 0x9cb4df70
+       data4 0x9e6f687c, 0x9e3c35e5, 0x9e5757ab, 0x9f031fa1
+       data4 0x1f25bff7, 0x1f0e58c2, 0x1ef3ce04, 0x1f002ecb
+       data4 0x9ebdc836, 0x9ed657dd, 0x9f149441, 0x9e8544b2
+       data4 0x1cd8ff1e, 0x1e9bb463, 0x1eaa1c5c, 0x1f200c1a
+       data4 0x1edbfbaf, 0x1f18724d, 0x9ed63c22, 0x9f08e045
+       data4 0x1f13ad07, 0x9e949311, 0x9f0c50d4, 0x1e824516
+       data4 0x1d5e52ba, 0x1d583fbd, 0x1e3b60a9, 0x9effe6d3
+       data4 0x1f0d0508, 0x1f00be77, 0x9e404bfa, 0x9e1ca381
+       data4 0x9f084dd8, 0x9e6db85d, 0x1db698e4, 0x9ebd1871
+       data4 0x9ecc2679, 0x1ee68442, 0x1edb1050, 0x9dbc96a4
+       data4 0x9f27c1f4, 0x1c99b756, 0x1eb4400a, 0x9f24390a
+       data4 0x1d927875, 0x9f074faa, 0x1e9dc2c3, 0x1f13c0d2
+       data4 0x1e3c9685, 0x9e6b6f75, 0x9db9cb31, 0x1ea5f3aa
+       data4 0x9d992c61, 0x1f1015e4, 0x1f194f70, 0x9e19d2b3
+       data4 0x9d89116c, 0x1f23cd35, 0x1e33d3a2, 0x1ee331b8
+       data4 0x1d5ba7ec, 0x9f273788, 0x9e6907f4, 0x9ed5f912
+       data4 0x9edd458d, 0x1e2ca7b2, 0x1ef81fe4, 0x1dc7ade6
+       data4 0x1e876e51, 0x9f04ec89, 0x1f1da63a, 0x1ec02bd0
+       data4 0x9e71326f, 0x1e7847b4, 0x1f0de618, 0x9e036cb6
+       data4 0x1eec61e2, 0x1ef1758b, 0x9ee880a3, 0x1ed269d7
+       data4 0x1e27edd3, 0x9e8a81a1, 0x1eacb84d, 0x9e1aad37
+       data4 0x1f1aa8f7, 0x1e9bbd90, 0x1ea1b61f, 0x9ed41c2f
+       data4 0x1dbb5dd6, 0x1f0ec733, 0x9df06b1b, 0x1e06fef1
+       data4 0x9edede3a, 0x1edeb5e2, 0x1f0e63ee, 0x9db316bb
+       data4 0x9efc1ad3, 0x1f01fbb5, 0x9cc0d078, 0x1ea28b36
+       data4 0x9e9dd205, 0x9e791534, 0x1da1c8d5, 0x9e8195cc
+       data4 0x1f0681a4, 0x1eeaf1e2, 0x9ef83b37, 0x9f22a92b
+       data4 0x1eabc4ce, 0x1f10eefb, 0x1e06d9aa, 0x1e7cacd5
+       data4 0x1f1ea087, 0x1eb21983, 0x9f100c78, 0x1e840abe
+       data4 0x9efab66c, 0x1f183fa8, 0x9e84ee68, 0x9eea083d
+       data4 0x9ee23a74, 0x1f1351d7, 0x9ec5d42a, 0x9f071f57
+       data4 0x9ef578d9, 0x9f1aa7e7, 0x1eb02044, 0x1f151a2e
+       data4 0x9c0dc8b2, 0x9ef4087a, 0x1ec12b93, 0x1c1a946b
+       data4 0x1e89946f, 0x9dafe8c3, 0x1d295288, 0x9e8497ab
+       data4 0x1ec000c6, 0x1e102f29, 0x1e542256, 0x1e67d44d
+       data4 0x1ef688d8, 0x1f0e0f29, 0x1e67861f, 0x1e869748
+       data4 0x1ee6aa6e, 0x9e4d228b, 0x9e50be5b, 0x1e9fe225
+       data4 0x9ea34102, 0x9e628a3b, 0x9ed9fd83, 0x1ecd7109
+       data4 0x1f1864ff, 0x1ea19b76, 0x1db0d1c9, 0x9dff519b
+       data4 0x1e8fea71, 0x9ee82e9a, 0x9f08919b, 0x9ef5c8ae
+       data4 0x9ee446a4, 0x1ea59444, 0x1eb74230, 0x1ea13fbf
+       data4 0x9ea6a3ea, 0x1e5f2797, 0x9e0adb07, 0x9d3adadd
+       data4 0x1ebf2ee2, 0x1da19bfa, 0x1e8dea6d, 0x1ec4fea9
+       data4 0x1e669f22, 0x1dc5f919, 0x9ed25caa, 0x1ee475b1
+       data4 0x1ed0603e, 0x9eacb35c, 0x1dc00b27, 0x1e2f9991
+       data4 0x1e7b0406, 0x1eaa3387, 0x9d865bde, 0x1eb78a48
+       data4 0x1c40ae2e, 0x1ee9838b, 0x9f0f0d7f, 0x1e3e5d26
+       data4 0x1e99e7a6, 0x9e681ccf, 0x9e93ed65, 0x9eeb6a66
+       data4 0x1e29e9af, 0x9e96f923, 0x9e74f11d, 0x9f1474da
+       data4 0x1eec2ea7, 0x1ebf7aa3, 0x9c25dcca, 0x9f0553c2
+       data4 0x9e599efd, 0x1d2ab490, 0x1e95d7cd, 0x9ee4b20e
+       data4 0x9d988ce5, 0x9ef9787e, 0x9dbbba5b, 0x9f12c304
+       data4 0x1e3b9d70, 0x1e7bcae8, 0x9d98bb6e, 0x9e8e6b01
+       data4 0x9f07d03b, 0x9d67c822, 0x9f0ef69e, 0x1c7c0fe3
+       data4 0x9e9bfbb9, 0x9e83b84b, 0x1efbf15e, 0x9ecfa6a6
+       data4 0x9c91158e, 0x9ecf6770, 0x1ee1e3a8, 0x9dc95ec0
+       data4 0x1ef603f7, 0x1d5e52ba, 0x1c477d1b, 0x9e955cd8
+       data4 0x1ed665b0, 0x9e8376c4, 0x9c0ee88e, 0x1e8c989e
+       data4 0x1ea2df29, 0x9d961e5c, 0x1e101813, 0x1e7fffff
+       data4 0x9e5abff4, 0x1dbddd71, 0x1eb69100, 0x1e71f114
+       data4 0x1e9ca798, 0x1ef62c8d, 0x9db4e55a, 0x1dbe69ce
+       data4 0x9ef1c01f, 0x1f044a2a, 0x9eb9e0d7, 0x9ee59745
+       data4 0x9e874803, 0x1ea0b418, 0x9e13572a, 0x1ddbb3a2
+       data4 0x9ec0e391, 0x1e89fba1, 0x1ee8b261, 0x9e5d25f0
+       data4 0x9ef222cb, 0x9ef135ec, 0x1ea04b9a, 0x9f04291f
+       data4 0x9e969254, 0x9ee32f08, 0x9ed909d3, 0x9e362640
+       data4 0x9ec20735, 0x1e50131b, 0x9ed4e049, 0x1ee8e817
+       data4 0x1e1e09c0, 0x9ea643c5, 0x9e5a1ab6, 0x9e389059
+       data4 0x1e560947, 0x1d02b877, 0x1e4475ab, 0x9ea9aaf6
+       data4 0x1e95bc5e, 0x1eaf6afd, 0x1d43067d, 0x9d043821
+       data4 0x9e97baa9, 0x1de5c4f9, 0x9e9a0069, 0x9e1b9944
+       data4 0x1eb13686, 0x9eb907eb, 0x1e059589, 0x1cbd0f93
+       data4 0x9eb7e6ae, 0x1e9fa175, 0x1ee5bdf4, 0x1e8052f7
+       data4 0x9c80d1e3, 0x1bfbe28e, 0x9e672b3b, 0x9ecacf19
+       data4 0x9e3c04be, 0x1dfe8c5c, 0x1e1ba9cb, 0x1eb40b1e
+       data4 0x1ec7e7f6, 0x9d0d45b3, 0x1ef0113b, 0x9a155fa3
+       data4 0x1e28ec3b, 0x1e7ca8df, 0x9d2f91b4, 0x1eccd9ed
+       data4 0x9ed943bc, 0x9ccaab19, 0x9e8a5c58, 0x1ec3bca8
+       data4 0x1ed78dc7, 0x9ed391a8, 0x9e938f6e, 0x9ec4a030
+       data4 0x9e80346e, 0x1e7a4686, 0x9e284315, 0x9e39584c
+       data4 0x1ebdc9b4, 0x9e9cfce5, 0x9ef55c65, 0x1e2941e7
+       data4 0x9efbe59f, 0x1d87c41b, 0x1e40befc, 0x1e3d05b5
+       data4 0x1de9ea67, 0x1ec9a21c, 0x1decb69a, 0x1df6e75a
+       data4 0x9e8030ab, 0x9db20540, 0x9ef1e977, 0x1e3cdc43
+       data4 0x1e0492b0, 0x9e91d872, 0x1e775346, 0x9e939978
+       data4 0x1eb2714e, 0x1e49a203, 0x9e10195a, 0x1ef1ffc3
+       data4 0x9ea8b709, 0x9e832e27, 0x1ed5ac3b, 0x1edb20a6
+       data4 0x1e4dbd4e, 0x1efbb932, 0x1d8170ec, 0x1e6c4849
+       data4 0x1f008e17, 0x1e8000c4, 0x1d855ecf, 0x9e37cb85
+       data4 0x1ecffdf5, 0x1eba6519, 0x9edbe600, 0x1ea3e5e7
+       data4 0x1ed4fb39, 0x1f00be77, 0x1e6f4484, 0x9e9e7107
+       data4 0x9e30b29d, 0x9ee6e174, 0x1e3a2656, 0x9dd72f3f
+       data4 0x9ee12138, 0x1ed16fed, 0x9ece8a02, 0x9ca5b249
+       data4 0x9eafd508, 0x9ef0e9fc, 0x1d1307ac, 0x1eecee20
+       data4 0x1cf60c6f, 0x9d556216, 0x9eaed175, 0x9ec919f4
+       data4 0x1ec2c988, 0x1cd82772, 0x9dc99456, 0x1eab0467
+       data4 0x1e89b36f, 0x1c757944, 0x1eef9abd, 0x9e98664d
+LOCAL_OBJECT_END(D_table)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(cbrtl)
 
 { .mfi
-  getf.sig r3=f8
-     // will continue only for normal/denormal numbers          
-(p0)  fclass.nm.unc p12,p7 = f8, 0x1b           
-  // r2 = pointer to C_1...C_6 followed by T_table
-  addl r2 = @ltoff(poly_coeffs), gp;;
+       getf.sig GR_ARGSIG = f8
+       // will continue on main path only for normal/denormal numbers
+       // all other values will be filtered out and will exit early
+       fclass.nm.unc p12, p7 = f8, 0x1b
+       // GR_ADDR = pointer to C_1...C_6 followed by T_table
+       addl GR_ADDR = @ltoff(poly_coeffs), gp
 }
-{.mfi
-  // r29=2/3*bias -63=0xaaaa-0x3f=0xaa6b
-  mov r29=0xaa6b    
-  // normalize a
-  fma.s1 f14=f8,f1,f0
-  // r27 = pointer to D table
-  addl r27 = @ltoff(D_table), gp;;
+{ .mfi
+       // GR_BIAS23 = 2/3*bias -63 = 0xaaaa-0x3f = 0xaa6b
+       mov GR_BIAS23 = 0xaa6b
+       // normalize a
+       fma.s1 FR_XNORM = f8, f1, f0
+       // GR_D_ADDR = pointer to D table
+       addl GR_D_ADDR = @ltoff(D_table), gp
 }
-{.mib
-  nop.m 0
-  (p7) cmp.eq p12,p0=r3,r0
-  nop.b 0;;
+;;
+
+{ .mmf
+       // load start address for C_1...C_6 followed by T_table
+       ld8 GR_C_START = [ GR_ADDR ]
+       // load start address of D table
+       ld8 GR_D_START = [ GR_D_ADDR ]
+       // y = frcpa(a)
+       frcpa.s1 FR_RCP, p6 = f1, f8
 }
-{.mfb
-  // load start address for C_1...C_6 followed by T_table
-  ld8 r2=[r2]
-  (p12) fma.s0 f8=f8,f1,f0
-  (p12) br.ret.spnt b0;;
+;;
+
+{ .mmi
+        // get normalized significand
+       getf.sig GR_NORMSIG = FR_XNORM
+        // get exponent
+       getf.exp GR_NORMEXPSGN = FR_XNORM
+ (p7)  cmp.eq p12, p0 = GR_ARGSIG, r0
 }
-{.mmf 
-  // load C_1
-  ldfe f7=[r2],16
-  // load start address of D table
-  ld8 r27=[r27]
-  // y=frcpa(a)
-  frcpa.s0 f8,p6=f1,f8;;
+;;
+
+{ .mii
+       // load C_1
+       ldfe FR_C1 = [ GR_C_START ], 16
+       mov GR_SGNMASK = 0x20000
+       nop.i 0
 }
-{.mmi
-  // load C_2
-  ldfe f9=[r2],16;;
-   // load C_3, C_4
-  ldfpd f10,f11=[r2],16
-  nop.i 0;;
+;;
+
+{ .mfb
+       // load C_2
+       ldfe FR_C2 = [ GR_C_START ], 16
+ (p12) fma.s0 f8 = f8, f1, f0
+       // NaN/Infinities exit early
+ (p12) br.ret.spnt b0
+}
+;;
+
+{ .mfi
+       // load C_3, C_4
+       ldfpd FR_C3, FR_C4 = [ GR_C_START ], 16
+       // y = frcpa(a), set flags and result when argument is 0
+       // only used when p6=0
+       frcpa.s0 f8, p0 = f1, f8
+       nop.i 0
 }
-{.mmi
-  // get normalized significand
-  getf.sig r23=f14
-  // get exponent
-  getf.exp r24=f14
-  mov r25=0x20000;;
+;;
+
+{ .mii
+       // get GR_SIGN = sign
+       and GR_SIGN = GR_NORMEXPSGN, GR_SGNMASK
+       // eliminate leading 1 from GR_NORMSIG = 2nd table index
+       shl GR_INDEX2 = GR_NORMSIG, 1
+       // eliminate sign from exponent 
+       andcm GR_NORMEXP = GR_NORMEXPSGN, GR_SGNMASK
 }
-{.mii
-  // get r26=sign
-  and r26=r24,r25
-  // eliminate leading 1 from r23=2nd table index
-  shl r23=r23,1
-  // eliminate sign from exponent (r25)
-  andcm r25=r24,r25;;
+;;
+
+{ .mfi
+       // load C_5, C_6
+ (p6)  ldfpd FR_C5, FR_C6 = [ GR_C_START ], 16
+       // r = 1-a*y
+ (p6)  fnma.s1 FR_R = FR_RCP, FR_XNORM, f1
+       // Start computation of floor(exponent/3) by
+       // computing (2^20+2)/3*exponent = exponent*0x55556
+       // 1: exponent* = 5; 
+       // (2^{16}-1)/3 = 0x5555: 
+       // will form 0x5555*exponent by using shladd's
+       shladd GR_EXP5 = GR_NORMEXP, 2, GR_NORMEXP
 }
-{.mfi
-  // load C_5,C_6
-  (p6) ldfpd f12,f13=[r2],16
-  // r=1-a*y
-  (p6) fnma.s1 f6=f8,f14,f1
-  // 1: exponent*=5;  // (2^{16}-1)/3=0x5555
-  shladd r24=r25,2,r25;;
+;;
+
+{ .mib
+       // Next several integer steps compute floor(exponent/3)
+       // GR_TMP1 = (5*expon)*16
+       shladd GR_TMP1 = GR_EXP5, 4, r0
+       // GR_EXP3 = 3*exponent
+       shladd GR_EXP3 = GR_NORMEXP, 1, GR_NORMEXP
+       nop.b 0
 }
-{.mib
-  // r30=(5*expon)*16
-  shladd r30=r24,4,r0
-  // r28=3*exponent
-  shladd r28=r25,1,r25
-  nop.b 0;;
+;;
+
+{ .mmi
+       // GR_EXP6 = 6*exponent
+       shladd GR_EXP6 = GR_EXP3, 1, r0
+       // GR_EXP17 = 17*expon
+       add GR_EXP17 = GR_EXP5, GR_TMP1
+       // GR_IX2 = 2nd table index (8 bits)
+       shr.u GR_IX2 = GR_INDEX2, 56
 }
-{.mmi
-  // r28=6*exponent
-  shladd r28=r28,1,r0
-  // r24=17*expon
-  add r24=r24,r30
-  // r23=2nd table index (8 bits)
-  shr.u r23=r23,56;;
+;;
+
+{ .mmi
+       // adjust T_table pointer by 2nd index
+       shladd GR_T_INDEX = GR_IX2, 3, GR_C_START
+       // adjust D_table pointer by 2nd index
+       shladd GR_D_INDEX = GR_IX2, 2, GR_D_START
+       // GR_TMP2 = (17*expon)*16^2
+       shl GR_TMP2 = GR_EXP17, 8
 }
-{.mmi
-  // adjust T_table pointer by 2nd index
-  shladd r2=r23,3,r2
-  // adjust D_table pointer by 2nd index
-  shladd r27=r23,2,r27
-  // r30=(17*expon)*16^2
-  shl r30=r24,8;;
+;;
+
+{ .mmi
+       // GR_TMP3 = expon*(2^16-1)/3
+       add GR_TMP3 = GR_EXP17, GR_TMP2
+;;
+       // GR_TMP4 = expon*(2^20+2)/3 = expon*0x55556
+       shladd GR_TMP4 = GR_TMP3, 4, GR_EXP6
+       nop.i 0
 }
-{.mmi
-  // r24=expon*(2^16-1)/3
-  add r24=r24,r30;;
-  // r24=expon*(2^20+2)/3=expon*0x55556
-  shladd r24=r24,4,r28
-  nop.i 0;;
+;;
+
+{ .mii
+       nop.m 0
+       // GR_EXP_RES = floor(expon/3)
+       shr.u GR_EXP_RES = GR_TMP4, 20
+       nop.i 0
 }
-{.mii
-  nop.m 0
-  // r24=floor(expon/3)
-  shr.u r24=r24,20
-  nop.i 0;;
+;;
+
+{ .mmi
+       nop.m 0
+       // r16 = 3*exponent
+       shladd r16 = GR_EXP_RES, 1, GR_EXP_RES
+       // bias exponent
+       add GR_EXPBIAS = GR_BIAS23, GR_EXP_RES
 }
-{.mmi
-  nop.m 0
-  // r28=3*exponent
-  shladd r28=r24,1,r24
-  // bias exponent
-  add r24=r29,r24;;
+;;
+
+{ .mmi
+       // get remainder of exponent/3
+       sub GR_EXP_MOD_3 = GR_NORMEXP, r16
+;;
+       // add sign to exponent
+       or GR_EXPSIGNRES = GR_EXPBIAS, GR_SIGN
+       // remainder << = 8
+       shl GR_REMTMP = GR_EXP_MOD_3, 8
 }
-{.mmi
-  // get remainder of exponent/3
-  sub r25=r25,r28;;
-  // add sign to exponent
-  or r24=r24,r26
-  // remainder <<=8
-  shl r25=r25,8;;
-}  
-{.mfi
-  // adjust D_table pointer by 1st index
-  shladd r27=r25,2,r27
-  // P_1=C_1+C_2*r
-  (p6) fma.s1 f7=f9,f6,f7
-  // adjust T_table pointer by 1st index
-  shladd r2=r25,3,r2
+;;
+
+{ .mfi
+       // adjust D_table pointer by 1st index
+       shladd GR_IX_D = GR_REMTMP, 2, GR_D_INDEX
+       // P_1 = C_1+C_2*r
+ (p6)  fma.s1 FR_P1 = FR_C2, FR_R, FR_C1
+       // adjust T_table pointer by 1st index
+       shladd GR_IX_T = GR_REMTMP, 3, GR_T_INDEX
 }
-{.mfi
-  // f14=sign*2^{exponent/3}
-  (p6) setf.exp f14=r24
-  // r2=r*r
-  (p6) fma.s1 f9=f6,f6,f0
-  nop.i 0;;
+{ .mfi
+       // FR_SGNEXP = sign*2^{exponent/3}
+ (p6)  setf.exp FR_SGNEXP = GR_EXPSIGNRES
+       // r^2 = r*r
+ (p6)  fma.s1 FR_R2 = FR_R, FR_R, f0
+       nop.i 0
 }
-{.mfi
-  // load D
-  (p6) ldfs f15=[r27]
-  // P_2=C_3+C_4*r
-  (p6) fma.s1 f10=f11,f6,f10
-  nop.i 0
+;;
+
+{ .mfi
+       // load D
+ (p6)  ldfs FR_D = [ GR_IX_D ]
+       // P_2 = C_3+C_4*r
+ (p6)  fma.s1 FR_P2 = FR_C4, FR_R, FR_C3
+       nop.i 0
 }
-{.mfi
-  // load T
-  (p6) ldf8 f8=[r2]
-  // P_3=C_5+C_6*r
-  (p6) fma.s1 f12=f13,f6,f12
-  nop.i 0;;
+{ .mfi
+       // load T
+ (p6)  ldf8 FR_T = [ GR_IX_T ]
+       // P_3 = C_5+C_6*r
+ (p6)  fma.s1 FR_P3 = FR_C6, FR_R, FR_C5
+       nop.i 0
 }
-{.mfi
-  nop.m 0
-  // P_4=D-r*P_1
-  (p6) fnma.s1 f15=f6,f7,f15
-  nop.i 0
+;;
+
+{ .mfi
+       nop.m 0
+       // P_4 = D-r*P_1
+ (p6)  fnma.s1 FR_P4 = FR_R, FR_P1, FR_D
+       nop.i 0
 }
-{.mfi
-  nop.m 0
-  // r3=r*r2
-  (p6) fma.s1 f6=f6,f9,f0
-  nop.i 0;;
+{ .mfi
+       nop.m 0
+       // r^3 = r*r^2
+ (p6)  fma.s1 FR_R3 = FR_R, FR_R2, f0
+       nop.i 0
 }
-{.mfi
-  nop.m 0
-  // P_5=P_2+r2*P_3
-  (p6) fma.s1 f10=f9,f12,f10
-  nop.i 0;;
+;;
+
+{ .mfi
+       nop.m 0
+       // P_5 = P_2+r2*P_3
+ (p6)  fma.s1 FR_P5 = FR_R2, FR_P3, FR_P2
+       nop.i 0
 }
-{.mfi
-  nop.m 0
-  // T=T*(sign*2^{exponent/3})
-  (p6) fma.s1 f8=f8,f14,f0
-  nop.i 0
+;;
+
+{ .mfi
+       nop.m 0
+       // T = T*(sign*2^{exponent/3})
+ (p6)  fma.s1 FR_TF = FR_T, FR_SGNEXP, f0
+       nop.i 0
 }
-{.mfi
-  nop.m 0
-  // P=P_4-r3*P_5
-  (p6) fnma.s1 f6=f6,f10,f15
-  nop.i 0;;
+{ .mfi
+       nop.m 0
+       // P = P_4-r3*P_5
+ (p6)  fnma.s1 FR_P = FR_R3, FR_P5, FR_P4
+       nop.i 0
 }
-{.mfb
-  nop.m 0
-  // result=T+T*p
-  (p6) fma.s0 f8=f8,f6,f8
-  br.ret.sptk b0;;
+;;
+
+{ .mfb
+       nop.m 0
+       // result = T+T*p
+ (p6)  fma.s0 f8 = FR_TF, FR_P, FR_TF
+       br.ret.sptk b0
 }
-.endp cbrtl
-ASM_SIZE_DIRECTIVE(cbrtl)
+;;
+
+GLOBAL_LIBM_END(cbrtl)
+
+
diff --git a/sysdeps/ia64/fpu/s_ceil.S b/sysdeps/ia64/fpu/s_ceil.S
index f7e6d2cfa6..d1d2980618 100644
--- a/sysdeps/ia64/fpu/s_ceil.S
+++ b/sysdeps/ia64/fpu/s_ceil.S
@@ -1,10 +1,10 @@
 .file "ceil.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,90 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-
-#include "libm_support.h"
-
-.align 32
-.global ceil#
-
-.section .text
-.proc  ceil#
-.align 32
-
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 6/13/00: Improved speed
-// 6/27/00: Eliminated incorrect invalid flag setting
+// 02/02/00 Initial version
+// 06/13/00 Improved speed
+// 06/27/00 Eliminated incorrect invalid flag setting
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance
+//==============================================================
 
 // API
 //==============================================================
 // double ceil(double x)
+//==============================================================
 
-// general input registers:  
-
-ceil_GR_FFFF      = r14
-ceil_GR_signexp   = r15
-ceil_GR_exponent  = r16
-ceil_GR_expmask   = r17
-ceil_GR_bigexp    = r18
-
-
-// predicate registers used: 
+// general input registers:
+// r14 - r19
 
-// p6  ==> Input is NaN, infinity, zero
-// p7  ==> Input is denormal
-// p8  ==> Input is <0
-// p9  ==> Input is >=0
-// p10 ==> Input is already an integer (bigger than largest integer)
-// p11 ==> Input is not a large integer
-// p12 ==> Input is a smaller integer
-// p13 ==> Input is not an even integer, so inexact must be set
-// p14 ==> Input is between -1 and 0, so result will be -0 and inexact
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
+rSignexpM1 = r19
 
+// floating-point registers:
+// f8 - f13
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
+fAdj       = f12
+fPreResult = f13
 
-CEIL_SIGNED_ZERO  = f7
-CEIL_NORM_f8      = f9                        
-CEIL_FFFF         = f10 
-CEIL_INEXACT      = f11 
-CEIL_FLOAT_INT_f8 = f12
-CEIL_INT_f8       = f13
-CEIL_adj          = f14
-CEIL_MINUS_ONE    = f15
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // double ceil(double x)
-// Return an integer value (represented as a double) that is the smallest 
+// Return an integer value (represented as a double) that is the smallest
 // value not less than x
 // This is x rounded toward +infinity to an integral value.
 // Inexact is set if x != ceil(x)
-// **************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+//==============================================================
 
 // double_extended
 // if the exponent is > 1003e => 3F(true) = 63(decimal)
@@ -124,139 +101,124 @@ CEIL_MINUS_ONE    = f15
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
 
-ceil:
+.section .text
+GLOBAL_LIBM_ENTRY(ceil)
 
 { .mfi
-      getf.exp ceil_GR_signexp  = f8
-      fcvt.fx.trunc.s1     CEIL_INT_f8  = f8
-      addl        ceil_GR_bigexp = 0x10033, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10033, r0 // Set exponent at which is integer
 }
 { .mfi
-      addl        ceil_GR_FFFF      = -1,r0
-      fcmp.lt.s1  p8,p9 = f8,f0
-      mov         ceil_GR_expmask    = 0x1FFFF ;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.trunc.s1 fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// p7 ==> denorm
 { .mfi
-      setf.sig    CEIL_FFFF  = ceil_GR_FFFF
-      fclass.m    p7,p0 = f8, 0x0b
-      nop.i 999
+      mov              rSignexpM1  = 0x2FFFF // Form signexp of -1
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test x < 0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-      fnorm           CEIL_NORM_f8  = f8
-      nop.i 999 ;;
+{ .mfb
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     CEIL_UNORM            // Branch if x unorm
 }
+;;
 
-// Form 0 with sign of input in case negative zero is needed
-{ .mfi
-      nop.m 999
-      fmerge.s           CEIL_SIGNED_ZERO = f8, f0
-      nop.i 999
-}
+CEIL_COMMON:
+// Return here from CEIL_UNORM
 { .mfi
-      nop.m 999
-      fsub.s1           CEIL_MINUS_ONE = f0, f1
-      nop.i 999 ;;
-}
-
-// p6 ==> NAN, INF, ZERO
-{ .mfb
-      nop.m 999
-      fclass.m      p6,p10 = f8, 0xe7
-(p7)  br.cond.spnt  L(CEIL_DENORM) ;;
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e7     // Test x natval, nan, inf, 0
+      nop.i            0
 }
+;;
 
-L(CEIL_COMMON):
 .pred.rel "mutex",p8,p9
-// Set adjustment to add to trunc(x) for result
-//   If x>0,  adjustment is 1.0
-//   If x<=0, adjustment is 0.0
 { .mfi
-      and      ceil_GR_exponent = ceil_GR_signexp, ceil_GR_expmask
-(p9)  fadd.s1  CEIL_adj = f1,f0
-      nop.i 999
+      nop.m            0
+(p8)  fma.s1           fAdj = f0, f0, f0     // If x < 0, adjustment is 0
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p8)  fadd.s1  CEIL_adj = f0,f0
-      nop.i 999 ;;
+      nop.m            0
+(p9)  fma.s1           fAdj = f1, f1, f0     // If x > 0, adjustment is +1
+      nop.i            0
 }
+;;
 
 { .mfi
-(p10) cmp.ge.unc    p10,p11 = ceil_GR_exponent, ceil_GR_bigexp
-(p6)  fnorm.d f8 = f8
-      nop.i 999 ;;
+      nop.m            0
+      fcvt.xf          fPreResult = fXInt    // trunc(x)
+      nop.i            0
 }
-
-{ .mfi
-      nop.m 999
-(p11) fcvt.xf         CEIL_FLOAT_INT_f8   = CEIL_INT_f8
-      nop.i 999 ;;
+{ .mfb
+      nop.m            0
+(p6)  fma.d.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf, 0
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf, 0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p10) fnorm.d f8 = CEIL_NORM_f8
-      nop.i 999 ;;
+{ .mmi
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+;;
+      cmp.ge           p7,p6 = rExp, rBigexp  // Is |x| >= 2^52?
+(p8)  cmp.lt.unc       p10,p0 = rSignexp, rSignexpM1 // Is -1 < x < 0?
 }
+;;
 
-// Is -1 < x < 0?  If so, result will be -0.  Special case it with p14 set.
+// If -1 < x < 0, we turn off p6 and compute result as -0
 { .mfi
-      nop.m 999
-(p8)  fcmp.gt.unc.s1 p14,p0 = CEIL_NORM_f8, CEIL_MINUS_ONE
-      nop.i 999 ;;
+(p10) cmp.ne           p6,p0 = r0,r0
+(p10) fmerge.s         f8 = fNormX, f0
+      nop.i            0
 }
+;;
 
+.pred.rel "mutex",p6,p7
 { .mfi
-(p14) cmp.ne  p11,p0 = r0,r0
-(p14) fnorm.d f8 = CEIL_SIGNED_ZERO
-      nop.i 999
+      nop.m            0
+(p6)  fma.d.s0         f8 = fPreResult, f1, fAdj // Result if !int, |x| < 2^52
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p14) fmpy.s0     CEIL_INEXACT = CEIL_FFFF,CEIL_FFFF
-      nop.i 999 ;;
+      nop.m            0
+(p7)  fma.d.s0         f8 = fNormX, f1, f0    // Result, if |x| >= 2^52
+(p10) cmp.eq           p6,p0 = r0,r0          // If -1 < x < 0, turn on p6 again
 }
+;;
 
 { .mfi
-      nop.m 999
-(p11) fadd.d   f8 = CEIL_FLOAT_INT_f8,CEIL_adj
-      nop.i 999 ;;
-}
-{ .mfi
-      nop.m 999
-(p11) fcmp.eq.unc.s1  p12,p13  = CEIL_FLOAT_INT_f8, CEIL_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fcmp.eq.unc.s1   p8, p9 = fPreResult, fNormX // Is trunc(x) = x ?
+      nop.i            0
 }
+;;
 
-// Set inexact if result not equal to input
 { .mfi
-      nop.m 999
-(p13) fmpy.s0     CEIL_INEXACT = CEIL_FFFF,CEIL_FFFF
-      nop.i 999
+      nop.m            0
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
 }
-// Set result to input if integer
 { .mfb
-      nop.m 999
-(p12) fnorm.d f8 = CEIL_NORM_f8
-      br.ret.sptk    b0 ;;
+      nop.m            0
+(p8)  fma.d.s0         f8 = fNormX, f1, f0    // If x int, result normalized x
+      br.ret.sptk      b0                     // Exit main path, 0 < |x| < 2^52
 }
+;;
+
 
-// Here if input denorm
-L(CEIL_DENORM):
+CEIL_UNORM:
+// Here if x unorm
 { .mfb
-      getf.exp ceil_GR_signexp  = CEIL_NORM_f8
-      fcvt.fx.trunc.s1     CEIL_INT_f8  = CEIL_NORM_f8
-      br.cond.sptk  L(CEIL_COMMON) ;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     CEIL_COMMON            // Return to main path
 }
+;;
 
-.endp ceil
-ASM_SIZE_DIRECTIVE(ceil)
+GLOBAL_LIBM_END(ceil)
diff --git a/sysdeps/ia64/fpu/s_ceilf.S b/sysdeps/ia64/fpu/s_ceilf.S
index d1011052e8..051534a202 100644
--- a/sysdeps/ia64/fpu/s_ceilf.S
+++ b/sysdeps/ia64/fpu/s_ceilf.S
@@ -1,10 +1,10 @@
 .file "ceilf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,90 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-
-#include "libm_support.h"
-
-.align 32
-.global ceilf#
-
-.section .text
-.proc  ceilf#
-.align 32
-
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 6/13/00: Improved speed
-// 6/27/00: Eliminated incorrect invalid flag setting
+// 02/02/00 Initial version
+// 06/13/00 Improved speed
+// 06/27/00 Eliminated incorrect invalid flag setting
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance
+//==============================================================
 
 // API
 //==============================================================
 // float ceilf(float x)
+//==============================================================
 
-// general input registers:  
-
-ceil_GR_FFFF      = r14
-ceil_GR_signexp   = r15
-ceil_GR_exponent  = r16
-ceil_GR_expmask   = r17
-ceil_GR_bigexp    = r18
-
-
-// predicate registers used: 
+// general input registers:
+// r14 - r19
 
-// p6  ==> Input is NaN, infinity, zero
-// p7  ==> Input is denormal
-// p8  ==> Input is <0
-// p9  ==> Input is >=0
-// p10 ==> Input is already an integer (bigger than largest integer)
-// p11 ==> Input is not a large integer
-// p12 ==> Input is a smaller integer
-// p13 ==> Input is not an even integer, so inexact must be set
-// p14 ==> Input is between -1 and 0, so result will be -0 and inexact
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
+rSignexpM1 = r19
 
+// floating-point registers:
+// f8 - f13
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
+fAdj       = f12
+fPreResult = f13
 
-CEIL_SIGNED_ZERO  = f7
-CEIL_NORM_f8      = f9                        
-CEIL_FFFF         = f10 
-CEIL_INEXACT      = f11 
-CEIL_FLOAT_INT_f8 = f12
-CEIL_INT_f8       = f13
-CEIL_adj          = f14
-CEIL_MINUS_ONE    = f15
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // float ceilf(float x)
-// Return an integer value (represented as a float) that is the smallest 
+// Return an integer value (represented as a float) that is the smallest
 // value not less than x
 // This is x rounded toward +infinity to an integral value.
 // Inexact is set if x != ceilf(x)
-// **************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+//==============================================================
 
 // double_extended
 // if the exponent is > 1003e => 3F(true) = 63(decimal)
@@ -124,139 +101,124 @@ CEIL_MINUS_ONE    = f15
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
 
-ceilf:
+.section .text
+GLOBAL_LIBM_ENTRY(ceilf)
 
 { .mfi
-      getf.exp ceil_GR_signexp  = f8
-      fcvt.fx.trunc.s1     CEIL_INT_f8  = f8
-      addl        ceil_GR_bigexp = 0x10016, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10016, r0 // Set exponent at which is integer
 }
 { .mfi
-      addl        ceil_GR_FFFF      = -1,r0
-      fcmp.lt.s1  p8,p9 = f8,f0
-      mov         ceil_GR_expmask    = 0x1FFFF ;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.trunc.s1 fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// p7 ==> denorm
 { .mfi
-      setf.sig    CEIL_FFFF  = ceil_GR_FFFF
-      fclass.m    p7,p0 = f8, 0x0b
-      nop.i 999
+      mov              rSignexpM1  = 0x2FFFF // Form signexp of -1
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test x < 0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-      fnorm           CEIL_NORM_f8  = f8
-      nop.i 999 ;;
+{ .mfb
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     CEIL_UNORM            // Branch if x unorm
 }
+;;
 
-// Form 0 with sign of input in case negative zero is needed
-{ .mfi
-      nop.m 999
-      fmerge.s           CEIL_SIGNED_ZERO = f8, f0
-      nop.i 999
-}
+CEIL_COMMON:
+// Return here from CEIL_UNORM
 { .mfi
-      nop.m 999
-      fsub.s1           CEIL_MINUS_ONE = f0, f1
-      nop.i 999 ;;
-}
-
-// p6 ==> NAN, INF, ZERO
-{ .mfb
-      nop.m 999
-      fclass.m      p6,p10 = f8, 0xe7
-(p7)  br.cond.spnt  L(CEIL_DENORM) ;;
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e7     // Test x natval, nan, inf, 0
+      nop.i            0
 }
+;;
 
-L(CEIL_COMMON):
 .pred.rel "mutex",p8,p9
-// Set adjustment to add to trunc(x) for result
-//   If x>0,  adjustment is 1.0
-//   If x<=0, adjustment is 0.0
 { .mfi
-      and      ceil_GR_exponent = ceil_GR_signexp, ceil_GR_expmask
-(p9)  fadd.s1  CEIL_adj = f1,f0
-      nop.i 999
+      nop.m            0
+(p8)  fma.s1           fAdj = f0, f0, f0     // If x < 0, adjustment is 0
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p8)  fadd.s1  CEIL_adj = f0,f0
-      nop.i 999 ;;
+      nop.m            0
+(p9)  fma.s1           fAdj = f1, f1, f0     // If x > 0, adjustment is +1
+      nop.i            0
 }
+;;
 
 { .mfi
-(p10) cmp.ge.unc    p10,p11 = ceil_GR_exponent, ceil_GR_bigexp
-(p6)  fnorm.s f8 = f8
-      nop.i 999 ;;
+      nop.m            0
+      fcvt.xf          fPreResult = fXInt    // trunc(x)
+      nop.i            0
 }
-
-{ .mfi
-      nop.m 999
-(p11) fcvt.xf         CEIL_FLOAT_INT_f8   = CEIL_INT_f8
-      nop.i 999 ;;
+{ .mfb
+      nop.m            0
+(p6)  fma.s.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf, 0
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf, 0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p10) fnorm.s f8 = CEIL_NORM_f8
-      nop.i 999 ;;
+{ .mmi
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+;;
+      cmp.ge           p7,p6 = rExp, rBigexp  // Is |x| >= 2^23?
+(p8)  cmp.lt.unc       p10,p0 = rSignexp, rSignexpM1 // Is -1 < x < 0?
 }
+;;
 
-// Is -1 < x < 0?  If so, result will be -0.  Special case it with p14 set.
+// If -1 < x < 0, we turn off p6 and compute result as -0
 { .mfi
-      nop.m 999
-(p8)  fcmp.gt.unc.s1 p14,p0 = CEIL_NORM_f8, CEIL_MINUS_ONE
-      nop.i 999 ;;
+(p10) cmp.ne           p6,p0 = r0,r0
+(p10) fmerge.s         f8 = fNormX, f0
+      nop.i            0
 }
+;;
 
+.pred.rel "mutex",p6,p7
 { .mfi
-(p14) cmp.ne  p11,p0 = r0,r0
-(p14) fnorm.s f8 = CEIL_SIGNED_ZERO
-      nop.i 999
+      nop.m            0
+(p6)  fma.s.s0         f8 = fPreResult, f1, fAdj // Result if !int, |x| < 2^23
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p14) fmpy.s0     CEIL_INEXACT = CEIL_FFFF,CEIL_FFFF
-      nop.i 999 ;;
+      nop.m            0
+(p7)  fma.s.s0         f8 = fNormX, f1, f0    // Result, if |x| >= 2^23
+(p10) cmp.eq           p6,p0 = r0,r0          // If -1 < x < 0, turn on p6 again
 }
+;;
 
 { .mfi
-      nop.m 999
-(p11) fadd.s   f8 = CEIL_FLOAT_INT_f8,CEIL_adj
-      nop.i 999 ;;
-}
-{ .mfi
-      nop.m 999
-(p11) fcmp.eq.unc.s1  p12,p13  = CEIL_FLOAT_INT_f8, CEIL_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fcmp.eq.unc.s1   p8, p9 = fPreResult, fNormX // Is trunc(x) = x ?
+      nop.i            0
 }
+;;
 
-// Set inexact if result not equal to input
 { .mfi
-      nop.m 999
-(p13) fmpy.s0     CEIL_INEXACT = CEIL_FFFF,CEIL_FFFF
-      nop.i 999
+      nop.m            0
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
 }
-// Set result to input if integer
 { .mfb
-      nop.m 999
-(p12) fnorm.s f8 = CEIL_NORM_f8
-      br.ret.sptk    b0 ;;
+      nop.m            0
+(p8)  fma.s.s0         f8 = fNormX, f1, f0    // If x int, result normalized x
+      br.ret.sptk      b0                     // Exit main path, 0 < |x| < 2^23
 }
+;;
+
 
-// Here if input denorm
-L(CEIL_DENORM):
+CEIL_UNORM:
+// Here if x unorm
 { .mfb
-      getf.exp ceil_GR_signexp  = CEIL_NORM_f8
-      fcvt.fx.trunc.s1     CEIL_INT_f8  = CEIL_NORM_f8
-      br.cond.sptk  L(CEIL_COMMON) ;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     CEIL_COMMON            // Return to main path
 }
+;;
 
-.endp ceilf
-ASM_SIZE_DIRECTIVE(ceilf)
+GLOBAL_LIBM_END(ceilf)
diff --git a/sysdeps/ia64/fpu/s_ceill.S b/sysdeps/ia64/fpu/s_ceill.S
index d3d8719584..71cb01d3fa 100644
--- a/sysdeps/ia64/fpu/s_ceill.S
+++ b/sysdeps/ia64/fpu/s_ceill.S
@@ -1,10 +1,10 @@
 .file "ceill.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,90 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-
-#include "libm_support.h"
-
-.align 32
-.global ceill#
-
-.section .text
-.proc  ceill#
-.align 32
-
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 6/13/00: Improved speed
-// 6/27/00: Eliminated incorrect invalid flag setting
+// 02/02/00 Initial version
+// 06/13/00 Improved speed
+// 06/27/00 Eliminated incorrect invalid flag setting
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance
+//==============================================================
 
 // API
 //==============================================================
-// double ceill(double x)
-
-// general input registers:  
-
-ceil_GR_FFFF      = r14
-ceil_GR_signexp   = r15
-ceil_GR_exponent  = r16
-ceil_GR_expmask   = r17
-ceil_GR_bigexp    = r18
-
+// long double ceill(long double x)
+//==============================================================
 
-// predicate registers used: 
+// general input registers:
+// r14 - r19
 
-// p6  ==> Input is NaN, infinity, zero
-// p7  ==> Input is denormal
-// p8  ==> Input is <0
-// p9  ==> Input is >=0
-// p10 ==> Input is already an integer (bigger than largest integer)
-// p11 ==> Input is not a large integer
-// p12 ==> Input is a smaller integer
-// p13 ==> Input is not an even integer, so inexact must be set
-// p14 ==> Input is between -1 and 0, so result will be -0 and inexact
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
+rSignexpM1 = r19
 
+// floating-point registers:
+// f8 - f13
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
+fAdj       = f12
+fPreResult = f13
 
-CEIL_SIGNED_ZERO  = f7
-CEIL_NORM_f8      = f9                        
-CEIL_FFFF         = f10 
-CEIL_INEXACT      = f11 
-CEIL_FLOAT_INT_f8 = f12
-CEIL_INT_f8       = f13
-CEIL_adj          = f14
-CEIL_MINUS_ONE    = f15
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // long double ceill(long double x)
-// Return an integer value (represented as a long double) that is the smallest 
+// Return an integer value (represented as a long double) that is the smallest
 // value not less than x
 // This is x rounded toward +infinity to an integral value.
 // Inexact is set if x != ceill(x)
-// **************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+//==============================================================
 
 // double_extended
 // if the exponent is > 1003e => 3F(true) = 63(decimal)
@@ -124,139 +101,124 @@ CEIL_MINUS_ONE    = f15
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
 
-ceill:
+.section .text
+GLOBAL_LIBM_ENTRY(ceill)
 
 { .mfi
-      getf.exp ceil_GR_signexp  = f8
-      fcvt.fx.trunc.s1     CEIL_INT_f8  = f8
-      addl        ceil_GR_bigexp = 0x1003e, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x1003e, r0 // Set exponent at which is integer
 }
 { .mfi
-      addl        ceil_GR_FFFF      = -1,r0
-      fcmp.lt.s1  p8,p9 = f8,f0
-      mov         ceil_GR_expmask    = 0x1FFFF ;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.trunc.s1 fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// p7 ==> denorm
 { .mfi
-      setf.sig    CEIL_FFFF  = ceil_GR_FFFF
-      fclass.m    p7,p0 = f8, 0x0b
-      nop.i 999
+      mov              rSignexpM1  = 0x2FFFF // Form signexp of -1
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test x < 0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-      fnorm           CEIL_NORM_f8  = f8
-      nop.i 999 ;;
+{ .mfb
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     CEIL_UNORM            // Branch if x unorm
 }
+;;
 
-// Form 0 with sign of input in case negative zero is needed
-{ .mfi
-      nop.m 999
-      fmerge.s           CEIL_SIGNED_ZERO = f8, f0
-      nop.i 999
-}
+CEIL_COMMON:
+// Return here from CEIL_UNORM
 { .mfi
-      nop.m 999
-      fsub.s1           CEIL_MINUS_ONE = f0, f1
-      nop.i 999 ;;
-}
-
-// p6 ==> NAN, INF, ZERO
-{ .mfb
-      nop.m 999
-      fclass.m      p6,p10 = f8, 0xe7
-(p7)  br.cond.spnt  L(CEIL_DENORM) ;;
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e7     // Test x natval, nan, inf, 0
+      nop.i            0
 }
+;;
 
-L(CEIL_COMMON):
 .pred.rel "mutex",p8,p9
-// Set adjustment to add to trunc(x) for result
-//   If x>0,  adjustment is 1.0
-//   If x<=0, adjustment is 0.0
 { .mfi
-      and      ceil_GR_exponent = ceil_GR_signexp, ceil_GR_expmask
-(p9)  fadd.s1  CEIL_adj = f1,f0
-      nop.i 999
+      nop.m            0
+(p8)  fma.s1           fAdj = f0, f0, f0     // If x < 0, adjustment is 0
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p8)  fadd.s1  CEIL_adj = f0,f0
-      nop.i 999 ;;
+      nop.m            0
+(p9)  fma.s1           fAdj = f1, f1, f0     // If x > 0, adjustment is +1
+      nop.i            0
 }
+;;
 
 { .mfi
-(p10) cmp.ge.unc    p10,p11 = ceil_GR_exponent, ceil_GR_bigexp
-(p6)  fnorm   f8 = f8
-      nop.i 999 ;;
+      nop.m            0
+      fcvt.xf          fPreResult = fXInt    // trunc(x)
+      nop.i            0
 }
-
-{ .mfi
-      nop.m 999
-(p11) fcvt.xf         CEIL_FLOAT_INT_f8   = CEIL_INT_f8
-      nop.i 999 ;;
+{ .mfb
+      nop.m            0
+(p6)  fma.s0           f8 = f8, f1, f0       // Result if x natval, nan, inf, 0
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf, 0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p10) fnorm   f8 = CEIL_NORM_f8
-      nop.i 999 ;;
+{ .mmi
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+;;
+      cmp.ge           p7,p6 = rExp, rBigexp  // Is |x| >= 2^63?
+(p8)  cmp.lt.unc       p10,p0 = rSignexp, rSignexpM1 // Is -1 < x < 0?
 }
+;;
 
-// Is -1 < x < 0?  If so, result will be -0.  Special case it with p14 set.
+// If -1 < x < 0, we turn off p6 and compute result as -0
 { .mfi
-      nop.m 999
-(p8)  fcmp.gt.unc.s1 p14,p0 = CEIL_NORM_f8, CEIL_MINUS_ONE
-      nop.i 999 ;;
+(p10) cmp.ne           p6,p0 = r0,r0
+(p10) fmerge.s         f8 = fNormX, f0
+      nop.i            0
 }
+;;
 
+.pred.rel "mutex",p6,p7
 { .mfi
-(p14) cmp.ne  p11,p0 = r0,r0
-(p14) fnorm   f8 = CEIL_SIGNED_ZERO
-      nop.i 999
+      nop.m            0
+(p6)  fma.s0           f8 = fPreResult, f1, fAdj // Result if !int, |x| < 2^63
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p14) fmpy.s0     CEIL_INEXACT = CEIL_FFFF,CEIL_FFFF
-      nop.i 999 ;;
+      nop.m            0
+(p7)  fma.s0           f8 = fNormX, f1, f0    // Result, if |x| >= 2^63
+(p10) cmp.eq           p6,p0 = r0,r0          // If -1 < x < 0, turn on p6 again
 }
+;;
 
 { .mfi
-      nop.m 999
-(p11) fadd     f8 = CEIL_FLOAT_INT_f8,CEIL_adj
-      nop.i 999 ;;
-}
-{ .mfi
-      nop.m 999
-(p11) fcmp.eq.unc.s1  p12,p13  = CEIL_FLOAT_INT_f8, CEIL_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fcmp.eq.unc.s1   p8, p9 = fPreResult, fNormX // Is trunc(x) = x ?
+      nop.i            0
 }
+;;
 
-// Set inexact if result not equal to input
 { .mfi
-      nop.m 999
-(p13) fmpy.s0     CEIL_INEXACT = CEIL_FFFF,CEIL_FFFF
-      nop.i 999
+      nop.m            0
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
 }
-// Set result to input if integer
 { .mfb
-      nop.m 999
-(p12) fnorm   f8 = CEIL_NORM_f8
-      br.ret.sptk    b0 ;;
+      nop.m            0
+(p8)  fma.s0           f8 = fNormX, f1, f0    // If x int, result normalized x
+      br.ret.sptk      b0                     // Exit main path, 0 < |x| < 2^63
 }
+;;
+
 
-// Here if input denorm
-L(CEIL_DENORM):
+CEIL_UNORM:
+// Here if x unorm
 { .mfb
-      getf.exp ceil_GR_signexp  = CEIL_NORM_f8
-      fcvt.fx.trunc.s1     CEIL_INT_f8  = CEIL_NORM_f8
-      br.cond.sptk  L(CEIL_COMMON) ;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     CEIL_COMMON            // Return to main path
 }
+;;
 
-.endp ceill
-ASM_SIZE_DIRECTIVE(ceill)
+GLOBAL_LIBM_END(ceill)
diff --git a/sysdeps/ia64/fpu/s_copysign.S b/sysdeps/ia64/fpu/s_copysign.S
index e0d08cb721..0903565ff3 100644
--- a/sysdeps/ia64/fpu/s_copysign.S
+++ b/sysdeps/ia64/fpu/s_copysign.S
@@ -23,12 +23,16 @@ ENTRY (__copysign)
 {
 	fmerge.s fret0 = farg1, farg0
 	br.ret.sptk.many rp
-}	
+}
 END (__copysign)
 
 strong_alias (__copysign, __copysignf)
 strong_alias (__copysign, __copysignl)
 
+strong_alias (__copysign, __libm_copysign)
+strong_alias (__copysign, __libm_copysignf)
+strong_alias (__copysign, __libm_copysignl)
+
 weak_alias (__copysign, copysign)
 weak_alias (__copysignf, copysignf)
 weak_alias (__copysignl, copysignl)
diff --git a/sysdeps/ia64/fpu/s_cos.S b/sysdeps/ia64/fpu/s_cos.S
index 6540aec724..fc121fce19 100644
--- a/sysdeps/ia64/fpu/s_cos.S
+++ b/sysdeps/ia64/fpu/s_cos.S
@@ -1,10 +1,10 @@
 .file "sincos.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,17 +35,25 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial revision
-// 4/02/00  Unwind support added.
-// 6/16/00  Updated tables to enforce symmetry
-// 8/31/00  Saved 2 cycles in main path, and 9 in other paths.
-// 9/20/00  The updated tables regressed to an old version, so reinstated them
+// 02/02/00 Initial version
+// 04/02/00 Unwind support added.
+// 06/16/00 Updated tables to enforce symmetry
+// 08/31/00 Saved 2 cycles in main path, and 9 in other paths.
+// 09/20/00 The updated tables regressed to an old version, so reinstated them
 // 10/18/00 Changed one table entry to ensure symmetry
-// 1/03/01  Improved speed, fixed flag settings for small arguments.
+// 01/03/01 Improved speed, fixed flag settings for small arguments.
+// 02/18/02 Large arguments processing routine excluded
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 06/03/02 Insure inexact flag set for large arg result
+// 09/05/02 Work range is widened by reduction strengthen (3 parts of Pi/16)
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/08/03 Improved performance
+// 10/28/04 Saved sincos_r_sincos to avoid clobber by dynamic loader 
+// 03/31/05 Reformatted delimiters between data tables
 
 // API
 //==============================================================
@@ -63,9 +71,13 @@
 //    nfloat = Round result to integer (round-to-nearest)
 //
 // r = x -  nfloat * pi/2^k
-//    Do this as (x -  nfloat * HIGH(pi/2^k)) - nfloat * LOW(pi/2^k) for increased accuracy.
+//    Do this as ((((x -  nfloat * HIGH(pi/2^k))) - 
+//                        nfloat * LOW(pi/2^k)) - 
+//                        nfloat * LOWEST(pi/2^k) for increased accuracy.
 //    pi/2^k is stored as two numbers that when added make pi/2^k.
 //       pi/2^k = HIGH(pi/2^k) + LOW(pi/2^k)
+//    HIGH and LOW parts are rounded to zero values, 
+//    and LOWEST is rounded to nearest one.
 //
 // x = (nfloat * pi/2^k) + r
 //    r is small enough that we can use a polynomial approximation
@@ -121,7 +133,7 @@
 //
 // as follows
 //
-//    Sm = Sin(Mpi/2^k) and Cm = Cos(Mpi/2^k)
+//    S[m] = Sin(Mpi/2^k) and C[m] = Cos(Mpi/2^k)
 //    rsq = r*r
 //
 //
@@ -141,32 +153,31 @@
 //
 //       P =  r + rcub * P
 //
-//    Answer = Sm Cos(r) + Cm P
+//    Answer = S[m] Cos(r) + [Cm] P
 //
 //       Cos(r) = 1 + rsq Q
 //       Cos(r) = 1 + r^2 Q
 //       Cos(r) = 1 + r^2 (q1 + r^2q2 + r^4q3 + r^6q4)
 //       Cos(r) = 1 + r^2q1 + r^4q2 + r^6q3 + r^8q4 + ...
 //
-//       Sm Cos(r) = Sm(1 + rsq Q)
-//       Sm Cos(r) = Sm + Sm rsq Q
-//       Sm Cos(r) = Sm + s_rsq Q
-//       Q         = Sm + s_rsq Q
+//       S[m] Cos(r) = S[m](1 + rsq Q)
+//       S[m] Cos(r) = S[m] + Sm rsq Q
+//       S[m] Cos(r) = S[m] + s_rsq Q
+//       Q         = S[m] + s_rsq Q
 //
 // Then,
 //
-//    Answer = Q + Cm P
+//    Answer = Q + C[m] P
 
-#include "libm_support.h"
 
 // Registers used
 //==============================================================
 // general input registers:
-// r14 -> r19
-// r32 -> r45
+// r14 -> r26
+// r32 -> r35
 
 // predicate registers used:
-// p6 -> p14
+// p6 -> p11
 
 // floating-point registers used
 // f9 -> f15
@@ -174,99 +185,94 @@
 
 // Assembly macros
 //==============================================================
-sind_NORM_f8                 = f9
-sind_W                       = f10
-sind_int_Nfloat              = f11
-sind_Nfloat                  = f12
+sincos_NORM_f8                 = f9
+sincos_W                       = f10
+sincos_int_Nfloat              = f11
+sincos_Nfloat                  = f12
 
-sind_r                       = f13
-sind_rsq                     = f14
-sind_rcub                    = f15
+sincos_r                       = f13
+sincos_rsq                     = f14
+sincos_rcub                    = f15
+sincos_save_tmp                = f15
 
-sind_Inv_Pi_by_16            = f32
-sind_Pi_by_16_hi             = f33
-sind_Pi_by_16_lo             = f34
+sincos_Inv_Pi_by_16            = f32
+sincos_Pi_by_16_1              = f33
+sincos_Pi_by_16_2              = f34
 
-sind_Inv_Pi_by_64            = f35
-sind_Pi_by_64_hi             = f36
-sind_Pi_by_64_lo             = f37
+sincos_Inv_Pi_by_64            = f35
 
-sind_Sm                      = f38
-sind_Cm                      = f39
+sincos_Pi_by_16_3              = f36
 
-sind_P1                      = f40
-sind_Q1                      = f41
-sind_P2                      = f42
-sind_Q2                      = f43
-sind_P3                      = f44
-sind_Q3                      = f45
-sind_P4                      = f46
-sind_Q4                      = f47
+sincos_r_exact                 = f37
 
-sind_P_temp1                 = f48
-sind_P_temp2                 = f49
+sincos_Sm                      = f38
+sincos_Cm                      = f39
 
-sind_Q_temp1                 = f50
-sind_Q_temp2                 = f51
+sincos_P1                      = f40
+sincos_Q1                      = f41
+sincos_P2                      = f42
+sincos_Q2                      = f43
+sincos_P3                      = f44
+sincos_Q3                      = f45
+sincos_P4                      = f46
+sincos_Q4                      = f47
 
-sind_P                       = f52
-sind_Q                       = f53
+sincos_P_temp1                 = f48
+sincos_P_temp2                 = f49
 
-sind_srsq                    = f54
+sincos_Q_temp1                 = f50
+sincos_Q_temp2                 = f51
 
-sind_SIG_INV_PI_BY_16_2TO61  = f55
-sind_RSHF_2TO61              = f56
-sind_RSHF                    = f57
-sind_2TOM61                  = f58
-sind_NFLOAT                  = f59
-sind_W_2TO61_RSH             = f60
-
-fp_tmp                       = f61
-
-/////////////////////////////////////////////////////////////
+sincos_P                       = f52
+sincos_Q                       = f53
 
-sind_AD_1                    = r33
-sind_AD_2                    = r34
-sind_exp_limit               = r35
-sind_r_signexp               = r36
-sind_AD_beta_table           = r37
-sind_r_sincos                = r38
+sincos_srsq                    = f54
 
-sind_r_exp                   = r39
-sind_r_17_ones               = r40
+sincos_SIG_INV_PI_BY_16_2TO61  = f55
+sincos_RSHF_2TO61              = f56
+sincos_RSHF                    = f57
+sincos_2TOM61                  = f58
+sincos_NFLOAT                  = f59
+sincos_W_2TO61_RSH             = f60
 
-sind_GR_sig_inv_pi_by_16     = r14
-sind_GR_rshf_2to61           = r15
-sind_GR_rshf                 = r16
-sind_GR_exp_2tom61           = r17
-sind_GR_n                    = r18
-sind_GR_m                    = r19
-sind_GR_32m                  = r19
+fp_tmp                         = f61
 
-gr_tmp                       = r41
-GR_SAVE_PFS                  = r41
-GR_SAVE_B0                   = r42
-GR_SAVE_GP                   = r43
-
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+/////////////////////////////////////////////////////////////
 
+sincos_GR_sig_inv_pi_by_16     = r14
+sincos_GR_rshf_2to61           = r15
+sincos_GR_rshf                 = r16
+sincos_GR_exp_2tom61           = r17
+sincos_GR_n                    = r18
+sincos_GR_m                    = r19
+sincos_GR_32m                  = r19
+sincos_GR_all_ones             = r19
+sincos_AD_1                    = r20
+sincos_AD_2                    = r21
+sincos_exp_limit               = r22
+sincos_r_signexp               = r23
+sincos_r_17_ones               = r24
+sincos_r_sincos                = r25
+sincos_r_exp                   = r26
+
+GR_SAVE_PFS                    = r33
+GR_SAVE_B0                     = r34
+GR_SAVE_GP                     = r35
+GR_SAVE_r_sincos               = r36
+
+
+RODATA
+
+// Pi/16 parts
 .align 16
-double_sind_pi:
-ASM_TYPE_DIRECTIVE(double_sind_pi,@object)
-//   data8 0xA2F9836E4E44152A, 0x00004001 // 16/pi (significand loaded w/ setf)
-//         c90fdaa22168c234
-   data8 0xC90FDAA22168C234, 0x00003FFC // pi/16 hi
-//         c4c6628b80dc1cd1  29024e088a
-   data8 0xC4C6628B80DC1CD1, 0x00003FBC // pi/16 lo
-ASM_SIZE_DIRECTIVE(double_sind_pi)
-
-double_sind_pq_k4:
-ASM_TYPE_DIRECTIVE(double_sind_pq_k4,@object)
+LOCAL_OBJECT_START(double_sincos_pi)
+   data8 0xC90FDAA22168C234, 0x00003FFC // pi/16 1st part
+   data8 0xC4C6628B80DC1CD1, 0x00003FBC // pi/16 2nd part
+   data8 0xA4093822299F31D0, 0x00003F7A // pi/16 3rd part
+LOCAL_OBJECT_END(double_sincos_pi)
+
+// Coefficients for polynomials
+LOCAL_OBJECT_START(double_sincos_pq_k4)
    data8 0x3EC71C963717C63A // P4
    data8 0x3EF9FFBA8F191AE6 // Q4
    data8 0xBF2A01A00F4E11A8 // P3
@@ -275,125 +281,112 @@ ASM_TYPE_DIRECTIVE(double_sind_pq_k4,@object)
    data8 0x3FA555555554DD45 // Q2
    data8 0xBFC5555555555555 // P1
    data8 0xBFDFFFFFFFFFFFFC // Q1
-ASM_SIZE_DIRECTIVE(double_sind_pq_k4)
+LOCAL_OBJECT_END(double_sincos_pq_k4)
 
+// Sincos table (S[m], C[m])
+LOCAL_OBJECT_START(double_sin_cos_beta_k4)
 
-double_sin_cos_beta_k4:
-ASM_TYPE_DIRECTIVE(double_sin_cos_beta_k4,@object)
 data8 0x0000000000000000 , 0x00000000 // sin( 0 pi/16)  S0
 data8 0x8000000000000000 , 0x00003fff // cos( 0 pi/16)  C0
-
+//
 data8 0xc7c5c1e34d3055b3 , 0x00003ffc // sin( 1 pi/16)  S1
 data8 0xfb14be7fbae58157 , 0x00003ffe // cos( 1 pi/16)  C1
-
+//
 data8 0xc3ef1535754b168e , 0x00003ffd // sin( 2 pi/16)  S2
 data8 0xec835e79946a3146 , 0x00003ffe // cos( 2 pi/16)  C2
-
+//
 data8 0x8e39d9cd73464364 , 0x00003ffe // sin( 3 pi/16)  S3
 data8 0xd4db3148750d181a , 0x00003ffe // cos( 3 pi/16)  C3
-
+//
 data8 0xb504f333f9de6484 , 0x00003ffe // sin( 4 pi/16)  S4
 data8 0xb504f333f9de6484 , 0x00003ffe // cos( 4 pi/16)  C4
-
-
+//
 data8 0xd4db3148750d181a , 0x00003ffe // sin( 5 pi/16)  C3
 data8 0x8e39d9cd73464364 , 0x00003ffe // cos( 5 pi/16)  S3
-
+//
 data8 0xec835e79946a3146 , 0x00003ffe // sin( 6 pi/16)  C2
 data8 0xc3ef1535754b168e , 0x00003ffd // cos( 6 pi/16)  S2
-
+//
 data8 0xfb14be7fbae58157 , 0x00003ffe // sin( 7 pi/16)  C1
 data8 0xc7c5c1e34d3055b3 , 0x00003ffc // cos( 7 pi/16)  S1
-
+//
 data8 0x8000000000000000 , 0x00003fff // sin( 8 pi/16)  C0
 data8 0x0000000000000000 , 0x00000000 // cos( 8 pi/16)  S0
-
-
+//
 data8 0xfb14be7fbae58157 , 0x00003ffe // sin( 9 pi/16)  C1
 data8 0xc7c5c1e34d3055b3 , 0x0000bffc // cos( 9 pi/16)  -S1
-
+//
 data8 0xec835e79946a3146 , 0x00003ffe // sin(10 pi/16)  C2
 data8 0xc3ef1535754b168e , 0x0000bffd // cos(10 pi/16)  -S2
-
+//
 data8 0xd4db3148750d181a , 0x00003ffe // sin(11 pi/16)  C3
 data8 0x8e39d9cd73464364 , 0x0000bffe // cos(11 pi/16)  -S3
-
+//
 data8 0xb504f333f9de6484 , 0x00003ffe // sin(12 pi/16)  S4
 data8 0xb504f333f9de6484 , 0x0000bffe // cos(12 pi/16)  -S4
-
-
+//
 data8 0x8e39d9cd73464364 , 0x00003ffe // sin(13 pi/16) S3
 data8 0xd4db3148750d181a , 0x0000bffe // cos(13 pi/16) -C3
-
+//
 data8 0xc3ef1535754b168e , 0x00003ffd // sin(14 pi/16) S2
 data8 0xec835e79946a3146 , 0x0000bffe // cos(14 pi/16) -C2
-
+//
 data8 0xc7c5c1e34d3055b3 , 0x00003ffc // sin(15 pi/16) S1
 data8 0xfb14be7fbae58157 , 0x0000bffe // cos(15 pi/16) -C1
-
+//
 data8 0x0000000000000000 , 0x00000000 // sin(16 pi/16) S0
 data8 0x8000000000000000 , 0x0000bfff // cos(16 pi/16) -C0
-
-
+//
 data8 0xc7c5c1e34d3055b3 , 0x0000bffc // sin(17 pi/16) -S1
 data8 0xfb14be7fbae58157 , 0x0000bffe // cos(17 pi/16) -C1
-
+//
 data8 0xc3ef1535754b168e , 0x0000bffd // sin(18 pi/16) -S2
 data8 0xec835e79946a3146 , 0x0000bffe // cos(18 pi/16) -C2
-
+//
 data8 0x8e39d9cd73464364 , 0x0000bffe // sin(19 pi/16) -S3
 data8 0xd4db3148750d181a , 0x0000bffe // cos(19 pi/16) -C3
-
+//
 data8 0xb504f333f9de6484 , 0x0000bffe // sin(20 pi/16) -S4
 data8 0xb504f333f9de6484 , 0x0000bffe // cos(20 pi/16) -S4
-
-
+//
 data8 0xd4db3148750d181a , 0x0000bffe // sin(21 pi/16) -C3
 data8 0x8e39d9cd73464364 , 0x0000bffe // cos(21 pi/16) -S3
-
+//
 data8 0xec835e79946a3146 , 0x0000bffe // sin(22 pi/16) -C2
 data8 0xc3ef1535754b168e , 0x0000bffd // cos(22 pi/16) -S2
-
+//
 data8 0xfb14be7fbae58157 , 0x0000bffe // sin(23 pi/16) -C1
 data8 0xc7c5c1e34d3055b3 , 0x0000bffc // cos(23 pi/16) -S1
-
+//
 data8 0x8000000000000000 , 0x0000bfff // sin(24 pi/16) -C0
 data8 0x0000000000000000 , 0x00000000 // cos(24 pi/16) S0
-
-
+//
 data8 0xfb14be7fbae58157 , 0x0000bffe // sin(25 pi/16) -C1
 data8 0xc7c5c1e34d3055b3 , 0x00003ffc // cos(25 pi/16) S1
-
+//
 data8 0xec835e79946a3146 , 0x0000bffe // sin(26 pi/16) -C2
 data8 0xc3ef1535754b168e , 0x00003ffd // cos(26 pi/16) S2
-
+//
 data8 0xd4db3148750d181a , 0x0000bffe // sin(27 pi/16) -C3
 data8 0x8e39d9cd73464364 , 0x00003ffe // cos(27 pi/16) S3
-
+//
 data8 0xb504f333f9de6484 , 0x0000bffe // sin(28 pi/16) -S4
 data8 0xb504f333f9de6484 , 0x00003ffe // cos(28 pi/16) S4
-
-
+//
 data8 0x8e39d9cd73464364 , 0x0000bffe // sin(29 pi/16) -S3
 data8 0xd4db3148750d181a , 0x00003ffe // cos(29 pi/16) C3
-
+//
 data8 0xc3ef1535754b168e , 0x0000bffd // sin(30 pi/16) -S2
 data8 0xec835e79946a3146 , 0x00003ffe // cos(30 pi/16) C2
-
+//
 data8 0xc7c5c1e34d3055b3 , 0x0000bffc // sin(31 pi/16) -S1
 data8 0xfb14be7fbae58157 , 0x00003ffe // cos(31 pi/16) C1
-
+//
 data8 0x0000000000000000 , 0x00000000 // sin(32 pi/16) S0
 data8 0x8000000000000000 , 0x00003fff // cos(32 pi/16) C0
-ASM_SIZE_DIRECTIVE(double_sin_cos_beta_k4)
+LOCAL_OBJECT_END(double_sin_cos_beta_k4)
 
-.align 32
-.global sin#
-.global cos#
-#ifdef _LIBC
-.global __sin#
-.global __cos#
-#endif
+.section .text
 
 ////////////////////////////////////////////////////////
 // There are two entry points: sin and cos
@@ -402,3100 +395,374 @@ ASM_SIZE_DIRECTIVE(double_sin_cos_beta_k4)
 // If from sin, p8 is true
 // If from cos, p9 is true
 
-.section .text
-.proc  sin#
-#ifdef _LIBC
-.proc  __sin#
-#endif
-.align 32
-
-sin:
-#ifdef _LIBC
-__sin:
-#endif
+GLOBAL_IEEE754_ENTRY(sin)
 
 { .mlx
-      alloc          r32=ar.pfs,1,13,0,0
-      movl sind_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A // significand of 16/pi
+      getf.exp      sincos_r_signexp    = f8
+      movl sincos_GR_sig_inv_pi_by_16   = 0xA2F9836E4E44152A // signd of 16/pi
 }
 { .mlx
-      addl           sind_AD_1   = @ltoff(double_sind_pi), gp
-      movl sind_GR_rshf_2to61 = 0x47b8000000000000 // 1.1000 2^(63+63-2)
+      addl          sincos_AD_1         = @ltoff(double_sincos_pi), gp
+      movl sincos_GR_rshf_2to61         = 0x47b8000000000000 // 1.1 2^(63+63-2)
 }
 ;;
 
 { .mfi
-      ld8 sind_AD_1 = [sind_AD_1]
-      fnorm     sind_NORM_f8  = f8
-      cmp.eq     p8,p9         = r0, r0
+      ld8           sincos_AD_1         = [sincos_AD_1]
+      fnorm.s0      sincos_NORM_f8      = f8  // Normalize argument
+      cmp.eq        p8,p9               = r0, r0 // set p8 (clear p9) for sin
 }
 { .mib
-      mov sind_GR_exp_2tom61 = 0xffff-61 // exponent of scaling factor 2^-61
-      mov            sind_r_sincos = 0x0
-      br.cond.sptk   L(SIND_SINCOS)
+      mov           sincos_GR_exp_2tom61  = 0xffff-61 // exponent of scale 2^-61
+      mov           sincos_r_sincos       = 0x0 // sincos_r_sincos = 0 for sin
+      br.cond.sptk  _SINCOS_COMMON  // go to common part
 }
 ;;
 
-.endp sin
-ASM_SIZE_DIRECTIVE(sin)
-
+GLOBAL_IEEE754_END(sin)
 
-.section .text
-.proc  cos#
-#ifdef _LIBC
-.proc  __cos#
-#endif
-.align 32
-cos:
-#ifdef _LIBC
-__cos:
-#endif
+GLOBAL_IEEE754_ENTRY(cos)
 
 { .mlx
-      alloc          r32=ar.pfs,1,13,0,0
-      movl sind_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A // significand of 16/pi
+      getf.exp      sincos_r_signexp    = f8
+      movl sincos_GR_sig_inv_pi_by_16   = 0xA2F9836E4E44152A // signd of 16/pi
 }
 { .mlx
-      addl           sind_AD_1   = @ltoff(double_sind_pi), gp
-      movl sind_GR_rshf_2to61 = 0x47b8000000000000 // 1.1000 2^(63+63-2)
+      addl          sincos_AD_1         = @ltoff(double_sincos_pi), gp
+      movl sincos_GR_rshf_2to61         = 0x47b8000000000000 // 1.1 2^(63+63-2)
 }
 ;;
 
 { .mfi
-      ld8 sind_AD_1 = [sind_AD_1]
-      fnorm.s1     sind_NORM_f8  = f8
-      cmp.eq     p9,p8         = r0, r0
+      ld8           sincos_AD_1         = [sincos_AD_1]
+      fnorm.s1      sincos_NORM_f8      = f8 // Normalize argument
+      cmp.eq        p9,p8               = r0, r0 // set p9 (clear p8) for cos
 }
 { .mib
-      mov sind_GR_exp_2tom61 = 0xffff-61 // exponent of scaling factor 2^-61
-      mov            sind_r_sincos = 0x8
-      br.cond.sptk   L(SIND_SINCOS)
+      mov           sincos_GR_exp_2tom61  = 0xffff-61 // exp of scale 2^-61
+      mov           sincos_r_sincos       = 0x8 // sincos_r_sincos = 8 for cos
+      nop.b         999
 }
 ;;
 
-
 ////////////////////////////////////////////////////////
 // All entry points end up here.
-// If from sin, sind_r_sincos is 0 and p8 is true
-// If from cos, sind_r_sincos is 8 = 2^(k-1) and p9 is true
-// We add sind_r_sincos to N
+// If from sin, sincos_r_sincos is 0 and p8 is true
+// If from cos, sincos_r_sincos is 8 = 2^(k-1) and p9 is true
+// We add sincos_r_sincos to N
 
-L(SIND_SINCOS):
+///////////// Common sin and cos part //////////////////
+_SINCOS_COMMON:
 
 
 // Form two constants we need
 //  16/pi * 2^-2 * 2^63, scaled by 2^61 since we just loaded the significand
 //  1.1000...000 * 2^(63+63-2) to right shift int(W) into the low significand
-// fcmp used to set denormal, and invalid on snans
 { .mfi
-      setf.sig sind_SIG_INV_PI_BY_16_2TO61 = sind_GR_sig_inv_pi_by_16
-      fcmp.eq.s0 p12,p0=f8,f0
-      mov       sind_r_17_ones    = 0x1ffff
+      setf.sig      sincos_SIG_INV_PI_BY_16_2TO61 = sincos_GR_sig_inv_pi_by_16
+      fclass.m      p6,p0                         = f8, 0xe7 // if x = 0,inf,nan
+      mov           sincos_exp_limit              = 0x1001a
 }
 { .mlx
-      setf.d sind_RSHF_2TO61 = sind_GR_rshf_2to61
-      movl sind_GR_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift
-}
+      setf.d        sincos_RSHF_2TO61   = sincos_GR_rshf_2to61
+      movl          sincos_GR_rshf      = 0x43e8000000000000 // 1.1 2^63
+}                                                            // Right shift
 ;;
 
 // Form another constant
 //  2^-61 for scaling Nfloat
-// 0x10009 is register_bias + 10.
-// So if f8 > 2^10 = Gamma, go to DBX
+// 0x1001a is register_bias + 27.
+// So if f8 >= 2^27, go to large argument routines
 { .mfi
-      setf.exp sind_2TOM61 = sind_GR_exp_2tom61
-      fclass.m  p13,p0 = f8, 0x23           // Test for x inf
-      mov       sind_exp_limit = 0x10009
+      alloc         r32                 = ar.pfs, 1, 4, 0, 0
+      fclass.m      p11,p0              = f8, 0x0b // Test for x=unorm
+      mov           sincos_GR_all_ones  = -1 // For "inexect" constant create
+}
+{ .mib
+      setf.exp      sincos_2TOM61       = sincos_GR_exp_2tom61
+      nop.i         999
+(p6)  br.cond.spnt  _SINCOS_SPECIAL_ARGS
 }
 ;;
 
 // Load the two pieces of pi/16
 // Form another constant
 //  1.1000...000 * 2^63, the right shift constant
-{ .mmf
-      ldfe      sind_Pi_by_16_hi  = [sind_AD_1],16
-      setf.d sind_RSHF = sind_GR_rshf
-      fclass.m  p14,p0 = f8, 0xc3           // Test for x nan
+{ .mmb
+      ldfe          sincos_Pi_by_16_1   = [sincos_AD_1],16
+      setf.d        sincos_RSHF         = sincos_GR_rshf
+(p11) br.cond.spnt  _SINCOS_UNORM       // Branch if x=unorm
 }
 ;;
 
-{ .mfi
-      ldfe      sind_Pi_by_16_lo  = [sind_AD_1],16
-(p13) frcpa.s0 f8,p12=f0,f0               // force qnan indef for x=inf
-      addl gr_tmp = -1,r0
-}
-{ .mfb
-      addl           sind_AD_beta_table   = @ltoff(double_sin_cos_beta_k4), gp
-      nop.f 999
-(p13) br.ret.spnt    b0 ;;                // Exit for x=inf
-}
-
-// Start loading P, Q coefficients
-// SIN(0)
-{ .mfi
-      ldfpd      sind_P4,sind_Q4 = [sind_AD_1],16
-(p8)  fclass.m.unc  p6,p0 = f8, 0x07      // Test for sin(0)
-      nop.i 999
-}
-{ .mfb
-      addl           sind_AD_beta_table   = @ltoff(double_sin_cos_beta_k4), gp
-(p14) fma.d f8=f8,f1,f0                   // qnan for x=nan
-(p14) br.ret.spnt    b0 ;;                // Exit for x=nan
-}
-
+_SINCOS_COMMON2:
+// Return here if x=unorm
+// Create constant used to set inexact
+{ .mmi
+      ldfe          sincos_Pi_by_16_2   = [sincos_AD_1],16
+      setf.sig      fp_tmp              = sincos_GR_all_ones
+      nop.i         999
+};;
 
-// COS(0)
+// Select exponent (17 lsb)
 { .mfi
-      getf.exp  sind_r_signexp    = f8
-(p9)  fclass.m.unc  p7,p0 = f8, 0x07      // Test for sin(0)
-      nop.i 999
-}
-{ .mfi
-      ld8 sind_AD_beta_table = [sind_AD_beta_table]
-      nop.f 999
-      nop.i 999 ;;
-}
-
-{ .mmb
-      ldfpd      sind_P3,sind_Q3 = [sind_AD_1],16
-      setf.sig fp_tmp = gr_tmp // Create constant such that fmpy sets inexact
-(p6)  br.ret.spnt    b0 ;;
-}
-
-{ .mfb
-      and       sind_r_exp = sind_r_17_ones, sind_r_signexp
-(p7)  fmerge.s      f8 = f1,f1
-(p7)  br.ret.spnt    b0 ;;
-}
+      ldfe          sincos_Pi_by_16_3   = [sincos_AD_1],16
+      nop.f         999
+      dep.z         sincos_r_exp        = sincos_r_signexp, 0, 17 
+};;
 
+// Polynomial coefficients (Q4, P4, Q3, P3, Q2, Q1, P2, P1) loading
 // p10 is true if we must call routines to handle larger arguments
-// p10 is true if f8 exp is > 0x10009
-
-{ .mfi
-      ldfpd      sind_P2,sind_Q2 = [sind_AD_1],16
-      nop.f 999
-      cmp.ge  p10,p0 = sind_r_exp,sind_exp_limit
-}
-;;
+// p10 is true if f8 exp is >= 0x1001a (2^27)
+{ .mmb
+      ldfpd         sincos_P4,sincos_Q4 = [sincos_AD_1],16
+      cmp.ge        p10,p0              = sincos_r_exp,sincos_exp_limit 
+(p10) br.cond.spnt  _SINCOS_LARGE_ARGS // Go to "large args" routine
+};;
 
-// sind_W          = x * sind_Inv_Pi_by_16
+// sincos_W          = x * sincos_Inv_Pi_by_16
 // Multiply x by scaled 16/pi and add large const to shift integer part of W to
 //   rightmost bits of significand
 { .mfi
-      ldfpd      sind_P1,sind_Q1 = [sind_AD_1]
-      fma.s1 sind_W_2TO61_RSH = sind_NORM_f8,sind_SIG_INV_PI_BY_16_2TO61,sind_RSHF_2TO61
-      nop.i 999
-}
-{ .mbb
-(p10) cmp.ne.unc p11,p12=sind_r_sincos,r0  // p11 call __libm_cos_double_dbx
-                                           // p12 call __libm_sin_double_dbx
-(p11) br.cond.spnt L(COSD_DBX)
-(p12) br.cond.spnt L(SIND_DBX)
-}
-;;
-
+      ldfpd         sincos_P3,sincos_Q3 = [sincos_AD_1],16
+      fma.s1 sincos_W_2TO61_RSH = sincos_NORM_f8,sincos_SIG_INV_PI_BY_16_2TO61,sincos_RSHF_2TO61
+      nop.i         999
+};;
 
-// sind_NFLOAT = Round_Int_Nearest(sind_W)
+// get N = (int)sincos_int_Nfloat
+// sincos_NFLOAT = Round_Int_Nearest(sincos_W)
 // This is done by scaling back by 2^-61 and subtracting the shift constant
-{ .mfi
-      nop.m 999
-      fms.s1 sind_NFLOAT = sind_W_2TO61_RSH,sind_2TOM61,sind_RSHF
-      nop.i 999 ;;
-}
-
-
-// get N = (int)sind_int_Nfloat
-{ .mfi
-      getf.sig  sind_GR_n = sind_W_2TO61_RSH
-      nop.f 999
-      nop.i 999 ;;
-}
-
-// Add 2^(k-1) (which is in sind_r_sincos) to N
-// sind_r          = -sind_Nfloat * sind_Pi_by_16_hi + x
-// sind_r          = sind_r -sind_Nfloat * sind_Pi_by_16_lo
-{ .mfi
-      add       sind_GR_n = sind_GR_n, sind_r_sincos
-      fnma.s1  sind_r      = sind_NFLOAT, sind_Pi_by_16_hi, sind_NORM_f8
-      nop.i 999 ;;
-}
-
-
-// Get M (least k+1 bits of N)
-{ .mmi
-      and       sind_GR_m = 0x1f,sind_GR_n ;;
-      nop.m 999
-      shl       sind_GR_32m = sind_GR_m,5 ;;
-}
-
-// Add 32*M to address of sin_cos_beta table
-{ .mmi
-      add       sind_AD_2 = sind_GR_32m, sind_AD_beta_table
-      nop.m 999
-      nop.i 999 ;;
-}
-
-{ .mfi
-      ldfe      sind_Sm = [sind_AD_2],16
-(p8)  fclass.m.unc p10,p0=f8,0x0b  // If sin, note denormal input to set uflow
-      nop.i 999 ;;
-}
-
-{ .mfi
-      ldfe      sind_Cm = [sind_AD_2]
-      fnma.s1  sind_r      = sind_NFLOAT, sind_Pi_by_16_lo,  sind_r
-      nop.i 999 ;;
-}
-
-// get rsq
-{ .mfi
-      nop.m 999
-      fma.s1   sind_rsq  = sind_r, sind_r,   f0
-      nop.i 999
-}
-{ .mfi
-      nop.m 999
-      fmpy.s0  fp_tmp = fp_tmp,fp_tmp // fmpy forces inexact flag
-      nop.i 999 ;;
-}
-
-// form P and Q series
-{ .mfi
-      nop.m 999
-      fma.s1      sind_P_temp1 = sind_rsq, sind_P4, sind_P3
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-      fma.s1      sind_Q_temp1 = sind_rsq, sind_Q4, sind_Q3
-      nop.i 999 ;;
-}
-
-// get rcube and sm*rsq
-{ .mfi
-      nop.m 999
-      fmpy.s1     sind_srsq    = sind_Sm,sind_rsq
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-      fmpy.s1     sind_rcub    = sind_r, sind_rsq
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-      fma.s1      sind_Q_temp2 = sind_rsq, sind_Q_temp1, sind_Q2
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-      fma.s1      sind_P_temp2 = sind_rsq, sind_P_temp1, sind_P2
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-      fma.s1      sind_Q       = sind_rsq, sind_Q_temp2, sind_Q1
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-      fma.s1      sind_P       = sind_rsq, sind_P_temp2, sind_P1
-      nop.i 999 ;;
-}
-
-// Get final P and Q
-{ .mfi
-      nop.m 999
-      fma.s1   sind_Q = sind_srsq,sind_Q, sind_Sm
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-      fma.s1   sind_P = sind_rcub,sind_P, sind_r
-      nop.i 999 ;;
-}
-
-// If sin(denormal), force inexact to be set
-{ .mfi
-      nop.m 999
-(p10) fmpy.d.s0 fp_tmp = f8,f8
-      nop.i 999 ;;
-}
-
-// Final calculation
-{ .mfb
-      nop.m 999
-      fma.d    f8     = sind_Cm, sind_P, sind_Q
-      br.ret.sptk    b0 ;;
-}
-.endp cos#
-ASM_SIZE_DIRECTIVE(cos#)
-
-
-
-.proc __libm_callout_1s
-__libm_callout_1s:
-L(SIND_DBX):
-.prologue
-{ .mfi
-        nop.m 0
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs
-}
-;;
-
-{ .mfi
-        mov GR_SAVE_GP=gp
-        nop.f 0
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0
-}
-
-.body
-{ .mib
-      nop.m 999
-      nop.i 999
-      br.call.sptk.many   b0=__libm_sin_double_dbx# ;;
-}
-;;
-
-
-{ .mfi
-       mov gp        = GR_SAVE_GP
-       nop.f  999
-       mov b0        = GR_SAVE_B0
-}
-;;
-
-{ .mib
-      nop.m 999
-      mov ar.pfs    = GR_SAVE_PFS
-      br.ret.sptk     b0 ;;
-}
-.endp  __libm_callout_1s
-ASM_SIZE_DIRECTIVE(__libm_callout_1s)
-
-
-.proc __libm_callout_1c
-__libm_callout_1c:
-L(COSD_DBX):
-.prologue
-{ .mfi
-        nop.m 0
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs
-}
-;;
-
-{ .mfi
-        mov GR_SAVE_GP=gp
-        nop.f 0
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0
-}
-
-.body
-{ .mib
-      nop.m 999
-      nop.i 999
-      br.call.sptk.many   b0=__libm_cos_double_dbx# ;;
-}
-;;
-
-
-{ .mfi
-       mov gp        = GR_SAVE_GP
-       nop.f  999
-       mov b0        = GR_SAVE_B0
-}
-;;
-
-{ .mib
-      nop.m 999
-      mov ar.pfs    = GR_SAVE_PFS
-      br.ret.sptk     b0 ;;
-}
-.endp  __libm_callout_1c
-ASM_SIZE_DIRECTIVE(__libm_callout_1c)
-
-
-// ====================================================================
-// ====================================================================
-
-// These functions calculate the sin and cos for inputs
-// greater than 2^10
-// __libm_sin_double_dbx# and __libm_cos_double_dbx#
-
-// *********************************************************************
-// *********************************************************************
-//
-// Function:   Combined sin(x) and cos(x), where
-//
-//             sin(x) = sine(x), for double precision x values
-//             cos(x) = cosine(x), for double precision x values
-//
-// *********************************************************************
-//
-// Accuracy:       Within .7 ulps for 80-bit floating point values
-//                 Very accurate for double precision values
-//
-// *********************************************************************
-//
-// Resources Used:
-//
-//    Floating-Point Registers: f8 (Input and Return Value)
-//                              f32-f99
-//
-//    General Purpose Registers:
-//      r32-r43
-//      r44-r45 (Used to pass arguments to pi_by_2 reduce routine)
-//
-//    Predicate Registers:      p6-p13
-//
-// *********************************************************************
-//
-//  IEEE Special Conditions:
-//
-//    Denormal  fault raised on denormal inputs
-//    Overflow exceptions do not occur
-//    Underflow exceptions raised when appropriate for sin
-//    (No specialized error handling for this routine)
-//    Inexact raised when appropriate by algorithm
-//
-//    sin(SNaN) = QNaN
-//    sin(QNaN) = QNaN
-//    sin(inf) = QNaN
-//    sin(+/-0) = +/-0
-//    cos(inf) = QNaN
-//    cos(SNaN) = QNaN
-//    cos(QNaN) = QNaN
-//    cos(0) = 1
-//
-// *********************************************************************
-//
-//  Mathematical Description
-//  ========================
-//
-//  The computation of FSIN and FCOS is best handled in one piece of
-//  code. The main reason is that given any argument Arg, computation
-//  of trigonometric functions first calculate N and an approximation
-//  to alpha where
-//
-//  Arg = N pi/2 + alpha, |alpha| <= pi/4.
-//
-//  Since
-//
-//  cos( Arg ) = sin( (N+1) pi/2 + alpha ),
-//
-//  therefore, the code for computing sine will produce cosine as long
-//  as 1 is added to N immediately after the argument reduction
-//  process.
-//
-//  Let M = N if sine
-//      N+1 if cosine.
-//
-//  Now, given
-//
-//  Arg = M pi/2  + alpha, |alpha| <= pi/4,
-//
-//  let I = M mod 4, or I be the two lsb of M when M is represented
-//  as 2's complement. I = [i_0 i_1]. Then
-//
-//  sin( Arg ) = (-1)^i_0  sin( alpha )	if i_1 = 0,
-//             = (-1)^i_0  cos( alpha )     if i_1 = 1.
-//
-//  For example:
-//       if M = -1, I = 11
-//         sin ((-pi/2 + alpha) = (-1) cos (alpha)
-//       if M = 0, I = 00
-//         sin (alpha) = sin (alpha)
-//       if M = 1, I = 01
-//         sin (pi/2 + alpha) = cos (alpha)
-//       if M = 2, I = 10
-//         sin (pi + alpha) = (-1) sin (alpha)
-//       if M = 3, I = 11
-//         sin ((3/2)pi + alpha) = (-1) cos (alpha)
-//
-//  The value of alpha is obtained by argument reduction and
-//  represented by two working precision numbers r and c where
-//
-//  alpha =  r  +  c     accurately.
-//
-//  The reduction method is described in a previous write up.
-//  The argument reduction scheme identifies 4 cases. For Cases 2
-//  and 4, because |alpha| is small, sin(r+c) and cos(r+c) can be
-//  computed very easily by 2 or 3 terms of the Taylor series
-//  expansion as follows:
-//
-//  Case 2:
-//  -------
-//
-//  sin(r + c) = r + c - r^3/6	accurately
-//  cos(r + c) = 1 - 2^(-67)	accurately
-//
-//  Case 4:
-//  -------
-//
-//  sin(r + c) = r + c - r^3/6 + r^5/120	accurately
-//  cos(r + c) = 1 - r^2/2 + r^4/24		accurately
-//
-//  The only cases left are Cases 1 and 3 of the argument reduction
-//  procedure. These two cases will be merged since after the
-//  argument is reduced in either cases, we have the reduced argument
-//  represented as r + c and that the magnitude |r + c| is not small
-//  enough to allow the usage of a very short approximation.
-//
-//  The required calculation is either
-//
-//  sin(r + c)  =  sin(r)  +  correction,  or
-//  cos(r + c)  =  cos(r)  +  correction.
-//
-//  Specifically,
-//
-//	sin(r + c) = sin(r) + c sin'(r) + O(c^2)
-//		   = sin(r) + c cos (r) + O(c^2)
-//		   = sin(r) + c(1 - r^2/2)  accurately.
-//  Similarly,
-//
-//	cos(r + c) = cos(r) - c sin(r) + O(c^2)
-//		   = cos(r) - c(r - r^3/6)  accurately.
-//
-//  We therefore concentrate on accurately calculating sin(r) and
-//  cos(r) for a working-precision number r, |r| <= pi/4 to within
-//  0.1% or so.
-//
-//  The greatest challenge of this task is that the second terms of
-//  the Taylor series
-//
-//	r - r^3/3! + r^r/5! - ...
-//
-//  and
-//
-//	1 - r^2/2! + r^4/4! - ...
-//
-//  are not very small when |r| is close to pi/4 and the rounding
-//  errors will be a concern if simple polynomial accumulation is
-//  used. When |r| < 2^-3, however, the second terms will be small
-//  enough (6 bits or so of right shift) that a normal Horner
-//  recurrence suffices. Hence there are two cases that we consider
-//  in the accurate computation of sin(r) and cos(r), |r| <= pi/4.
-//
-//  Case small_r: |r| < 2^(-3)
-//  --------------------------
-//
-//  Since Arg = M pi/4 + r + c accurately, and M mod 4 is [i_0 i_1],
-//  we have
-//
-//	sin(Arg) = (-1)^i_0 * sin(r + c)	if i_1 = 0
-//		 = (-1)^i_0 * cos(r + c) 	if i_1 = 1
-//
-//  can be accurately approximated by
-//
-//  sin(Arg) = (-1)^i_0 * [sin(r) + c]	if i_1 = 0
-//           = (-1)^i_0 * [cos(r) - c*r] if i_1 = 1
-//
-//  because |r| is small and thus the second terms in the correction
-//  are unneccessary.
-//
-//  Finally, sin(r) and cos(r) are approximated by polynomials of
-//  moderate lengths.
-//
-//  sin(r) =  r + S_1 r^3 + S_2 r^5 + ... + S_5 r^11
-//  cos(r) =  1 + C_1 r^2 + C_2 r^4 + ... + C_5 r^10
-//
-//  We can make use of predicates to selectively calculate
-//  sin(r) or cos(r) based on i_1.
-//
-//  Case normal_r: 2^(-3) <= |r| <= pi/4
-//  ------------------------------------
-//
-//  This case is more likely than the previous one if one considers
-//  r to be uniformly distributed in [-pi/4 pi/4]. Again,
-//
-//  sin(Arg) = (-1)^i_0 * sin(r + c)	if i_1 = 0
-//           = (-1)^i_0 * cos(r + c) 	if i_1 = 1.
-//
-//  Because |r| is now larger, we need one extra term in the
-//  correction. sin(Arg) can be accurately approximated by
-//
-//  sin(Arg) = (-1)^i_0 * [sin(r) + c(1-r^2/2)]      if i_1 = 0
-//           = (-1)^i_0 * [cos(r) - c*r*(1 - r^2/6)]    i_1 = 1.
-//
-//  Finally, sin(r) and cos(r) are approximated by polynomials of
-//  moderate lengths.
-//
-//	sin(r) =  r + PP_1_hi r^3 + PP_1_lo r^3 +
-//	              PP_2 r^5 + ... + PP_8 r^17
-//
-//	cos(r) =  1 + QQ_1 r^2 + QQ_2 r^4 + ... + QQ_8 r^16
-//
-//  where PP_1_hi is only about 16 bits long and QQ_1 is -1/2.
-//  The crux in accurate computation is to calculate
-//
-//  r + PP_1_hi r^3   or  1 + QQ_1 r^2
-//
-//  accurately as two pieces: U_hi and U_lo. The way to achieve this
-//  is to obtain r_hi as a 10 sig. bit number that approximates r to
-//  roughly 8 bits or so of accuracy. (One convenient way is
-//
-//  r_hi := frcpa( frcpa( r ) ).)
-//
-//  This way,
-//
-//	r + PP_1_hi r^3 =  r + PP_1_hi r_hi^3 +
-//	                        PP_1_hi (r^3 - r_hi^3)
-//		        =  [r + PP_1_hi r_hi^3]  +
-//			   [PP_1_hi (r - r_hi)
-//			      (r^2 + r_hi r + r_hi^2) ]
-//		        =  U_hi  +  U_lo
-//
-//  Since r_hi is only 10 bit long and PP_1_hi is only 16 bit long,
-//  PP_1_hi * r_hi^3 is only at most 46 bit long and thus computed
-//  exactly. Furthermore, r and PP_1_hi r_hi^3 are of opposite sign
-//  and that there is no more than 8 bit shift off between r and
-//  PP_1_hi * r_hi^3. Hence the sum, U_hi, is representable and thus
-//  calculated without any error. Finally, the fact that
-//
-//	|U_lo| <= 2^(-8) |U_hi|
-//
-//  says that U_hi + U_lo is approximating r + PP_1_hi r^3 to roughly
-//  8 extra bits of accuracy.
-//
-//  Similarly,
-//
-//	1 + QQ_1 r^2  =  [1 + QQ_1 r_hi^2]  +
-//	                    [QQ_1 (r - r_hi)(r + r_hi)]
-//		      =  U_hi  +  U_lo.
-//
-//  Summarizing, we calculate r_hi = frcpa( frcpa( r ) ).
-//
-//  If i_1 = 0, then
-//
-//    U_hi := r + PP_1_hi * r_hi^3
-//    U_lo := PP_1_hi * (r - r_hi) * (r^2 + r*r_hi + r_hi^2)
-//    poly := PP_1_lo r^3 + PP_2 r^5 + ... + PP_8 r^17
-//    correction := c * ( 1 + C_1 r^2 )
-//
-//  Else ...i_1 = 1
-//
-//    U_hi := 1 + QQ_1 * r_hi * r_hi
-//    U_lo := QQ_1 * (r - r_hi) * (r + r_hi)
-//    poly := QQ_2 * r^4 + QQ_3 * r^6 + ... + QQ_8 r^16
-//    correction := -c * r * (1 + S_1 * r^2)
-//
-//  End
-//
-//  Finally,
-//
-//	V := poly + ( U_lo + correction )
-//
-//                 /    U_hi  +  V         if i_0 = 0
-//	result := |
-//                 \  (-U_hi) -  V         if i_0 = 1
-//
-//  It is important that in the last step, negation of U_hi is
-//  performed prior to the subtraction which is to be performed in
-//  the user-set rounding mode.
-//
-//
-//  Algorithmic Description
-//  =======================
-//
-//  The argument reduction algorithm is tightly integrated into FSIN
-//  and FCOS which share the same code. The following is complete and
-//  self-contained. The argument reduction description given
-//  previously is repeated below.
-//
-//
-//  Step 0. Initialization.
-//
-//   If FSIN is invoked, set N_inc := 0; else if FCOS is invoked,
-//   set N_inc := 1.
-//
-//  Step 1. Check for exceptional and special cases.
-//
-//   * If Arg is +-0, +-inf, NaN, NaT, go to Step 10 for special
-//     handling.
-//   * If |Arg| < 2^24, go to Step 2 for reduction of moderate
-//     arguments. This is the most likely case.
-//   * If |Arg| < 2^63, go to Step 8 for pre-reduction of large
-//     arguments.
-//   * If |Arg| >= 2^63, go to Step 10 for special handling.
-//
-//  Step 2. Reduction of moderate arguments.
-//
-//  If |Arg| < pi/4 	...quick branch
-//     N_fix := N_inc	(integer)
-//     r     := Arg
-//     c     := 0.0
-//     Branch to Step 4, Case_1_complete
-//  Else 		...cf. argument reduction
-//     N     := Arg * two_by_PI	(fp)
-//     N_fix := fcvt.fx( N )	(int)
-//     N     := fcvt.xf( N_fix )
-//     N_fix := N_fix + N_inc
-//     s     := Arg - N * P_1	(first piece of pi/2)
-//     w     := -N * P_2	(second piece of pi/2)
-//
-//     If |s| >= 2^(-33)
-//        go to Step 3, Case_1_reduce
-//     Else
-//        go to Step 7, Case_2_reduce
-//     Endif
-//  Endif
-//
-//  Step 3. Case_1_reduce.
-//
-//  r := s + w
-//  c := (s - r) + w	...observe order
-//
-//  Step 4. Case_1_complete
-//
-//  ...At this point, the reduced argument alpha is
-//  ...accurately represented as r + c.
-//  If |r| < 2^(-3), go to Step 6, small_r.
-//
-//  Step 5. Normal_r.
-//
-//  Let [i_0 i_1] by the 2 lsb of N_fix.
-//  FR_rsq  := r * r
-//  r_hi := frcpa( frcpa( r ) )
-//  r_lo := r - r_hi
-//
-//  If i_1 = 0, then
-//    poly := r*FR_rsq*(PP_1_lo + FR_rsq*(PP_2 + ... FR_rsq*PP_8))
-//    U_hi := r + PP_1_hi*r_hi*r_hi*r_hi	...any order
-//    U_lo := PP_1_hi*r_lo*(r*r + r*r_hi + r_hi*r_hi)
-//    correction := c + c*C_1*FR_rsq		...any order
-//  Else
-//    poly := FR_rsq*FR_rsq*(QQ_2 + FR_rsq*(QQ_3 + ... + FR_rsq*QQ_8))
-//    U_hi := 1 + QQ_1 * r_hi * r_hi		...any order
-//    U_lo := QQ_1 * r_lo * (r + r_hi)
-//    correction := -c*(r + S_1*FR_rsq*r)	...any order
-//  Endif
-//
-//  V := poly + (U_lo + correction)	...observe order
-//
-//  result := (i_0 == 0?   1.0 : -1.0)
-//
-//  Last instruction in user-set rounding mode
-//
-//  result := (i_0 == 0?   result*U_hi + V :
-//                        result*U_hi - V)
-//
-//  Return
-//
-//  Step 6. Small_r.
-//
-//  ...Use flush to zero mode without causing exception
-//    Let [i_0 i_1] be the two lsb of N_fix.
-//
-//  FR_rsq := r * r
-//
-//  If i_1 = 0 then
-//     z := FR_rsq*FR_rsq; z := FR_rsq*z *r
-//     poly_lo := S_3 + FR_rsq*(S_4 + FR_rsq*S_5)
-//     poly_hi := r*FR_rsq*(S_1 + FR_rsq*S_2)
-//     correction := c
-//     result := r
-//  Else
-//     z := FR_rsq*FR_rsq; z := FR_rsq*z
-//     poly_lo := C_3 + FR_rsq*(C_4 + FR_rsq*C_5)
-//     poly_hi := FR_rsq*(C_1 + FR_rsq*C_2)
-//     correction := -c*r
-//     result := 1
-//  Endif
-//
-//  poly := poly_hi + (z * poly_lo + correction)
-//
-//  If i_0 = 1, result := -result
-//
-//  Last operation. Perform in user-set rounding mode
-//
-//  result := (i_0 == 0?     result + poly :
-//                          result - poly )
-//  Return
-//
-//  Step 7. Case_2_reduce.
-//
-//  ...Refer to the write up for argument reduction for
-//  ...rationale. The reduction algorithm below is taken from
-//  ...argument reduction description and integrated this.
-//
-//  w := N*P_3
-//  U_1 := N*P_2 + w		...FMA
-//  U_2 := (N*P_2 - U_1) + w	...2 FMA
-//  ...U_1 + U_2 is  N*(P_2+P_3) accurately
-//
-//  r := s - U_1
-//  c := ( (s - r) - U_1 ) - U_2
-//
-//  ...The mathematical sum r + c approximates the reduced
-//  ...argument accurately. Note that although compared to
-//  ...Case 1, this case requires much more work to reduce
-//  ...the argument, the subsequent calculation needed for
-//  ...any of the trigonometric function is very little because
-//  ...|alpha| < 1.01*2^(-33) and thus two terms of the
-//  ...Taylor series expansion suffices.
-//
-//  If i_1 = 0 then
-//     poly := c + S_1 * r * r * r	...any order
-//     result := r
-//  Else
-//     poly := -2^(-67)
-//     result := 1.0
-//  Endif
-//
-//  If i_0 = 1, result := -result
-//
-//  Last operation. Perform in user-set rounding mode
-//
-//  result := (i_0 == 0?     result + poly :
-//                           result - poly )
-//
-//  Return
-//
-//
-//  Step 8. Pre-reduction of large arguments.
-//
-//  ...Again, the following reduction procedure was described
-//  ...in the separate write up for argument reduction, which
-//  ...is tightly integrated here.
-
-//  N_0 := Arg * Inv_P_0
-//  N_0_fix := fcvt.fx( N_0 )
-//  N_0 := fcvt.xf( N_0_fix)
-
-//  Arg' := Arg - N_0 * P_0
-//  w := N_0 * d_1
-//  N := Arg' * two_by_PI
-//  N_fix := fcvt.fx( N )
-//  N := fcvt.xf( N_fix )
-//  N_fix := N_fix + N_inc
-//
-//  s := Arg' - N * P_1
-//  w := w - N * P_2
-//
-//  If |s| >= 2^(-14)
-//     go to Step 3
-//  Else
-//     go to Step 9
-//  Endif
-//
-//  Step 9. Case_4_reduce.
-//
-//    ...first obtain N_0*d_1 and -N*P_2 accurately
-//   U_hi := N_0 * d_1		V_hi := -N*P_2
-//   U_lo := N_0 * d_1 - U_hi	V_lo := -N*P_2 - U_hi	...FMAs
-//
-//   ...compute the contribution from N_0*d_1 and -N*P_3
-//   w := -N*P_3
-//   w := w + N_0*d_2
-//   t := U_lo + V_lo + w		...any order
-//
-//   ...at this point, the mathematical value
-//   ...s + U_hi + V_hi  + t approximates the true reduced argument
-//   ...accurately. Just need to compute this accurately.
-//
-//   ...Calculate U_hi + V_hi accurately:
-//   A := U_hi + V_hi
-//   if |U_hi| >= |V_hi| then
-//      a := (U_hi - A) + V_hi
-//   else
-//      a := (V_hi - A) + U_hi
-//   endif
-//   ...order in computing "a" must be observed. This branch is
-//   ...best implemented by predicates.
-//   ...A + a  is U_hi + V_hi accurately. Moreover, "a" is
-//   ...much smaller than A: |a| <= (1/2)ulp(A).
-//
-//   ...Just need to calculate   s + A + a + t
-//   C_hi := s + A		t := t + a
-//   C_lo := (s - C_hi) + A
-//   C_lo := C_lo + t
-//
-//   ...Final steps for reduction
-//   r := C_hi + C_lo
-//   c := (C_hi - r) + C_lo
-//
-//   ...At this point, we have r and c
-//   ...And all we need is a couple of terms of the corresponding
-//   ...Taylor series.
-//
-//   If i_1 = 0
-//      poly := c + r*FR_rsq*(S_1 + FR_rsq*S_2)
-//      result := r
-//   Else
-//      poly := FR_rsq*(C_1 + FR_rsq*C_2)
-//      result := 1
-//   Endif
-//
-//   If i_0 = 1, result := -result
-//
-//   Last operation. Perform in user-set rounding mode
-//
-//   result := (i_0 == 0?     result + poly :
-//                            result - poly )
-//   Return
-//
-//   Large Arguments: For arguments above 2**63, a Payne-Hanek
-//   style argument reduction is used and pi_by_2 reduce is called.
-//
-
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-.align 64
-
-FSINCOS_CONSTANTS:
-ASM_TYPE_DIRECTIVE(FSINCOS_CONSTANTS,@object)
-data4 0x4B800000, 0xCB800000, 0x00000000,0x00000000 // two**24, -two**24
-data4 0x4E44152A, 0xA2F9836E, 0x00003FFE,0x00000000 // Inv_pi_by_2
-data4 0xCE81B9F1, 0xC84D32B0, 0x00004016,0x00000000 // P_0
-data4 0x2168C235, 0xC90FDAA2, 0x00003FFF,0x00000000 // P_1
-data4 0xFC8F8CBB, 0xECE675D1, 0x0000BFBD,0x00000000 // P_2
-data4 0xACC19C60, 0xB7ED8FBB, 0x0000BF7C,0x00000000 // P_3
-data4 0x5F000000, 0xDF000000, 0x00000000,0x00000000 // two_to_63, -two_to_63
-data4 0x6EC6B45A, 0xA397E504, 0x00003FE7,0x00000000 // Inv_P_0
-data4 0xDBD171A1, 0x8D848E89, 0x0000BFBF,0x00000000 // d_1
-data4 0x18A66F8E, 0xD5394C36, 0x0000BF7C,0x00000000 // d_2
-data4 0x2168C234, 0xC90FDAA2, 0x00003FFE,0x00000000 // pi_by_4
-data4 0x2168C234, 0xC90FDAA2, 0x0000BFFE,0x00000000 // neg_pi_by_4
-data4 0x3E000000, 0xBE000000, 0x00000000,0x00000000 // two**-3, -two**-3
-data4 0x2F000000, 0xAF000000, 0x9E000000,0x00000000 // two**-33, -two**-33, -two**-67
-data4 0xA21C0BC9, 0xCC8ABEBC, 0x00003FCE,0x00000000 // PP_8
-data4 0x720221DA, 0xD7468A05, 0x0000BFD6,0x00000000 // PP_7
-data4 0x640AD517, 0xB092382F, 0x00003FDE,0x00000000 // PP_6
-data4 0xD1EB75A4, 0xD7322B47, 0x0000BFE5,0x00000000 // PP_5
-data4 0xFFFFFFFE, 0xFFFFFFFF, 0x0000BFFD,0x00000000 // C_1
-data4 0x00000000, 0xAAAA0000, 0x0000BFFC,0x00000000 // PP_1_hi
-data4 0xBAF69EEA, 0xB8EF1D2A, 0x00003FEC,0x00000000 // PP_4
-data4 0x0D03BB69, 0xD00D00D0, 0x0000BFF2,0x00000000 // PP_3
-data4 0x88888962, 0x88888888, 0x00003FF8,0x00000000 // PP_2
-data4 0xAAAB0000, 0xAAAAAAAA, 0x0000BFEC,0x00000000 // PP_1_lo
-data4 0xC2B0FE52, 0xD56232EF, 0x00003FD2,0x00000000 // QQ_8
-data4 0x2B48DCA6, 0xC9C99ABA, 0x0000BFDA,0x00000000 // QQ_7
-data4 0x9C716658, 0x8F76C650, 0x00003FE2,0x00000000 // QQ_6
-data4 0xFDA8D0FC, 0x93F27DBA, 0x0000BFE9,0x00000000 // QQ_5
-data4 0xAAAAAAAA, 0xAAAAAAAA, 0x0000BFFC,0x00000000 // S_1
-data4 0x00000000, 0x80000000, 0x0000BFFE,0x00000000 // QQ_1
-data4 0x0C6E5041, 0xD00D00D0, 0x00003FEF,0x00000000 // QQ_4
-data4 0x0B607F60, 0xB60B60B6, 0x0000BFF5,0x00000000 // QQ_3
-data4 0xAAAAAA9B, 0xAAAAAAAA, 0x00003FFA,0x00000000 // QQ_2
-data4 0xFFFFFFFE, 0xFFFFFFFF, 0x0000BFFD,0x00000000 // C_1
-data4 0xAAAA719F, 0xAAAAAAAA, 0x00003FFA,0x00000000 // C_2
-data4 0x0356F994, 0xB60B60B6, 0x0000BFF5,0x00000000 // C_3
-data4 0xB2385EA9, 0xD00CFFD5, 0x00003FEF,0x00000000 // C_4
-data4 0x292A14CD, 0x93E4BD18, 0x0000BFE9,0x00000000 // C_5
-data4 0xAAAAAAAA, 0xAAAAAAAA, 0x0000BFFC,0x00000000 // S_1
-data4 0x888868DB, 0x88888888, 0x00003FF8,0x00000000 // S_2
-data4 0x055EFD4B, 0xD00D00D0, 0x0000BFF2,0x00000000 // S_3
-data4 0x839730B9, 0xB8EF1C5D, 0x00003FEC,0x00000000 // S_4
-data4 0xE5B3F492, 0xD71EA3A4, 0x0000BFE5,0x00000000 // S_5
-data4 0x38800000, 0xB8800000, 0x00000000            // two**-14, -two**-14
-ASM_SIZE_DIRECTIVE(FSINCOS_CONSTANTS)
-
-FR_Input_X        = f8
-FR_Neg_Two_to_M3  = f32
-FR_Two_to_63      = f32
-FR_Two_to_24      = f33
-FR_Pi_by_4        = f33
-FR_Two_to_M14     = f34
-FR_Two_to_M33     = f35
-FR_Neg_Two_to_24  = f36
-FR_Neg_Pi_by_4    = f36
-FR_Neg_Two_to_M14 = f37
-FR_Neg_Two_to_M33 = f38
-FR_Neg_Two_to_M67 = f39
-FR_Inv_pi_by_2    = f40
-FR_N_float        = f41
-FR_N_fix          = f42
-FR_P_1            = f43
-FR_P_2            = f44
-FR_P_3            = f45
-FR_s              = f46
-FR_w              = f47
-FR_c              = f48
-FR_r              = f49
-FR_Z              = f50
-FR_A              = f51
-FR_a              = f52
-FR_t              = f53
-FR_U_1            = f54
-FR_U_2            = f55
-FR_C_1            = f56
-FR_C_2            = f57
-FR_C_3            = f58
-FR_C_4            = f59
-FR_C_5            = f60
-FR_S_1            = f61
-FR_S_2            = f62
-FR_S_3            = f63
-FR_S_4            = f64
-FR_S_5            = f65
-FR_poly_hi        = f66
-FR_poly_lo        = f67
-FR_r_hi           = f68
-FR_r_lo           = f69
-FR_rsq            = f70
-FR_r_cubed        = f71
-FR_C_hi           = f72
-FR_N_0            = f73
-FR_d_1            = f74
-FR_V              = f75
-FR_V_hi           = f75
-FR_V_lo           = f76
-FR_U_hi           = f77
-FR_U_lo           = f78
-FR_U_hiabs        = f79
-FR_V_hiabs        = f80
-FR_PP_8           = f81
-FR_QQ_8           = f81
-FR_PP_7           = f82
-FR_QQ_7           = f82
-FR_PP_6           = f83
-FR_QQ_6           = f83
-FR_PP_5           = f84
-FR_QQ_5           = f84
-FR_PP_4           = f85
-FR_QQ_4           = f85
-FR_PP_3           = f86
-FR_QQ_3           = f86
-FR_PP_2           = f87
-FR_QQ_2           = f87
-FR_QQ_1           = f88
-FR_N_0_fix        = f89
-FR_Inv_P_0        = f90
-FR_corr           = f91
-FR_poly           = f92
-FR_d_2            = f93
-FR_Two_to_M3      = f94
-FR_Neg_Two_to_63  = f94
-FR_P_0            = f95
-FR_C_lo           = f96
-FR_PP_1           = f97
-FR_PP_1_lo        = f98
-FR_ArgPrime       = f99
-
-GR_Table_Base  = r32
-GR_Table_Base1 = r33
-GR_i_0         = r34
-GR_i_1         = r35
-GR_N_Inc       = r36
-GR_Sin_or_Cos  = r37
-
-GR_SAVE_B0     = r39
-GR_SAVE_GP     = r40
-GR_SAVE_PFS    = r41
-
-.section .text
-.proc __libm_sin_double_dbx#
-.align 64
-__libm_sin_double_dbx:
-
-{ .mlx
-alloc GR_Table_Base = ar.pfs,0,12,2,0
-       movl GR_Sin_or_Cos = 0x0 ;;
-}
-
-{ .mmi
-      nop.m 999
-      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-
-{ .mib
-      nop.m 999
-      nop.i 999
-       br.cond.sptk L(SINCOS_CONTINUE) ;;
-}
-
-.endp __libm_sin_double_dbx#
-ASM_SIZE_DIRECTIVE(__libm_sin_double_dbx)
-
-.section .text
-.proc __libm_cos_double_dbx#
-__libm_cos_double_dbx:
-
-{ .mlx
-alloc GR_Table_Base= ar.pfs,0,12,2,0
-       movl GR_Sin_or_Cos = 0x1 ;;
-}
-
-{ .mmi
-      nop.m 999
-      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-//
-//     Load Table Address
-//
-L(SINCOS_CONTINUE):
-
-{ .mmi
-       add GR_Table_Base1 = 96, GR_Table_Base
-       ldfs	FR_Two_to_24 = [GR_Table_Base], 4
-       nop.i 999
-}
-;;
-
-{ .mmi
-      nop.m 999
-//
-//     Load 2**24, load 2**63.
-//
-       ldfs	FR_Neg_Two_to_24 = [GR_Table_Base], 12
-       mov   r41 = ar.pfs ;;
-}
-
-{ .mfi
-       ldfs	FR_Two_to_63 = [GR_Table_Base1], 4
-//
-//     Check for unnormals - unsupported operands. We do not want
-//     to generate denormal exception
-//     Check for NatVals, QNaNs, SNaNs, +/-Infs
-//     Check for EM unsupporteds
-//     Check for Zero
-//
-       fclass.m.unc  p6, p8 =  FR_Input_X, 0x1E3
-       mov   r40 = gp ;;
-}
-
-{ .mfi
-      nop.m 999
-       fclass.nm.unc p8, p0 =  FR_Input_X, 0x1FF
-// GR_Sin_or_Cos denotes
-       mov   r39 = b0
-}
-
-{ .mfb
-       ldfs	FR_Neg_Two_to_63 = [GR_Table_Base1], 12
-       fclass.m.unc p10, p0 = FR_Input_X, 0x007
-(p6)   br.cond.spnt L(SINCOS_SPECIAL) ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p8)   br.cond.spnt L(SINCOS_SPECIAL) ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-//
-//     Branch if +/- NaN, Inf.
-//     Load -2**24, load -2**63.
-//
-(p10)  br.cond.spnt L(SINCOS_ZERO) ;;
-}
-
-{ .mmb
-       ldfe	FR_Inv_pi_by_2 = [GR_Table_Base], 16
-       ldfe	FR_Inv_P_0 = [GR_Table_Base1], 16
-      nop.b 999 ;;
-}
-
-{ .mmb
-      nop.m 999
-       ldfe		FR_d_1 = [GR_Table_Base1], 16
-      nop.b 999 ;;
-}
-//
-//     Raise possible denormal operand flag with useful fcmp
-//     Is x <= -2**63
-//     Load Inv_P_0 for pre-reduction
-//     Load Inv_pi_by_2
-//
-
-{ .mmb
-       ldfe		FR_P_0 = [GR_Table_Base], 16
-       ldfe	FR_d_2 = [GR_Table_Base1], 16
-      nop.b 999 ;;
-}
-//
-//     Load P_0
-//     Load d_1
-//     Is x >= 2**63
-//     Is x <= -2**24?
-//
-
-{ .mmi
-       ldfe	FR_P_1 = [GR_Table_Base], 16 ;;
-//
-//     Load P_1
-//     Load d_2
-//     Is x >= 2**24?
-//
-       ldfe	FR_P_2 = [GR_Table_Base], 16
-      nop.i 999 ;;
-}
-
-{ .mmf
-      nop.m 999
-       ldfe	FR_P_3 = [GR_Table_Base], 16
-       fcmp.le.unc.s1	p7, p8 = FR_Input_X, FR_Neg_Two_to_24
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Branch if +/- zero.
-//     Decide about the paths to take:
-//     If -2**24 < FR_Input_X < 2**24 - CASE 1 OR 2
-//     OTHERWISE - CASE 3 OR 4
-//
-       fcmp.le.unc.s0	p10, p11 = FR_Input_X, FR_Neg_Two_to_63
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p8)   fcmp.ge.s1 p7, p0 = FR_Input_X, FR_Two_to_24
-      nop.i 999
-}
-
-{ .mfi
-       ldfe	FR_Pi_by_4 = [GR_Table_Base1], 16
-(p11)  fcmp.ge.s1	p10, p0 = FR_Input_X, FR_Two_to_63
-      nop.i 999 ;;
-}
-
-{ .mmi
-       ldfe	FR_Neg_Pi_by_4 = [GR_Table_Base1], 16 ;;
-       ldfs	FR_Two_to_M3 = [GR_Table_Base1], 4
-      nop.i 999 ;;
-}
-
-{ .mib
-       ldfs	FR_Neg_Two_to_M3 = [GR_Table_Base1], 12
-      nop.i 999
-//
-//     Load P_2
-//     Load P_3
-//     Load pi_by_4
-//     Load neg_pi_by_4
-//     Load 2**(-3)
-//     Load -2**(-3).
-//
-(p10)  br.cond.spnt L(SINCOS_ARG_TOO_LARGE) ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-//
-//     Branch out if x >= 2**63. Use Payne-Hanek Reduction
-//
-(p7)   br.cond.spnt L(SINCOS_LARGER_ARG) ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Branch if Arg <= -2**24 or Arg >= 2**24 and use pre-reduction.
-//
-       fma.s1	FR_N_float = FR_Input_X, FR_Inv_pi_by_2, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-       fcmp.lt.unc.s1	p6, p7 = FR_Input_X, FR_Pi_by_4
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Select the case when |Arg| < pi/4
-//     Else Select the case when |Arg| >= pi/4
-//
-       fcvt.fx.s1 FR_N_fix = FR_N_float
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     N  = Arg * 2/pi
-//     Check if Arg < pi/4
-//
-(p6)   fcmp.gt.s1 p6, p7 = FR_Input_X, FR_Neg_Pi_by_4
-      nop.i 999 ;;
-}
-//
-//     Case 2: Convert integer N_fix back to normalized floating-point value.
-//     Case 1: p8 is only affected  when p6 is set
-//
-
-{ .mfi
-(p7)   ldfs FR_Two_to_M33 = [GR_Table_Base1], 4
-//
-//     Grab the integer part of N and call it N_fix
-//
-(p6)   fmerge.se FR_r = FR_Input_X, FR_Input_X
-//     If |x| < pi/4, r = x and c = 0
-//     lf |x| < pi/4, is x < 2**(-3).
-//     r = Arg
-//     c = 0
-(p6)   mov GR_N_Inc = GR_Sin_or_Cos ;;
-}
-
 { .mmf
-      nop.m 999
-(p7)   ldfs FR_Neg_Two_to_M33 = [GR_Table_Base1], 4
-(p6)   fmerge.se FR_c = f0, f0
-}
-
-{ .mfi
-      nop.m 999
-(p6)   fcmp.lt.unc.s1	p8, p9 = FR_Input_X, FR_Two_to_M3
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     lf |x| < pi/4, is -2**(-3)< x < 2**(-3) - set p8.
-//     If |x| >= pi/4,
-//     Create the right N for |x| < pi/4 and otherwise
-//     Case 2: Place integer part of N in GP register
-//
-(p7)   fcvt.xf FR_N_float = FR_N_fix
-      nop.i 999 ;;
-}
-
-{ .mmf
-      nop.m 999
-(p7)   getf.sig	GR_N_Inc = FR_N_fix
-(p8)   fcmp.gt.s1 p8, p0 = FR_Input_X, FR_Neg_Two_to_M3 ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-//
-//     Load 2**(-33), -2**(-33)
-//
-(p8)   br.cond.spnt L(SINCOS_SMALL_R) ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p6)   br.cond.sptk L(SINCOS_NORMAL_R) ;;
-}
-//
-//     if |x| < pi/4, branch based on |x| < 2**(-3) or otherwise.
-//
-//
-//     In this branch, |x| >= pi/4.
-//
-
-{ .mfi
-       ldfs FR_Neg_Two_to_M67 = [GR_Table_Base1], 8
-//
-//     Load -2**(-67)
-//
-       fnma.s1	FR_s = FR_N_float, FR_P_1, FR_Input_X
-//
-//     w = N * P_2
-//     s = -N * P_1  + Arg
-//
-       add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos
-}
-
-{ .mfi
-      nop.m 999
-       fma.s1	FR_w = FR_N_float, FR_P_2, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Adjust N_fix by N_inc to determine whether sine or
-//     cosine is being calculated
-//
-       fcmp.lt.unc.s1 p7, p6 = FR_s, FR_Two_to_M33
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fcmp.gt.s1 p7, p6 = FR_s, FR_Neg_Two_to_M33
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//     Remember x >= pi/4.
-//     Is s <= -2**(-33) or s >= 2**(-33) (p6)
-//     or -2**(-33) < s < 2**(-33) (p7)
-(p6)   fms.s1 FR_r = FR_s, f1, FR_w
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fma.s1 FR_w = FR_N_float, FR_P_3, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fma.s1 FR_U_1 = FR_N_float, FR_P_2, FR_w
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p6)   fms.s1 FR_c = FR_s, f1, FR_r
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     For big s: r = s - w: No futher reduction is necessary
-//     For small s: w = N * P_3 (change sign) More reduction
-//
-(p6)   fcmp.lt.unc.s1 p8, p9 = FR_r, FR_Two_to_M3
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p8)   fcmp.gt.s1 p8, p9 = FR_r, FR_Neg_Two_to_M3
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fms.s1 FR_r = FR_s, f1, FR_U_1
-      nop.i 999
-}
-
-{ .mfb
-      nop.m 999
-//
-//     For big s: Is |r| < 2**(-3)?
-//     For big s: c = S - r
-//     For small s: U_1 = N * P_2 + w
-//
-//     If p8 is set, prepare to branch to Small_R.
-//     If p9 is set, prepare to branch to Normal_R.
-//     For big s,  r is complete here.
-//
-(p6)   fms.s1 FR_c = FR_c, f1, FR_w
-//
-//     For big s: c = c + w (w has not been negated.)
-//     For small s: r = S - U_1
-//
-(p8)   br.cond.spnt	L(SINCOS_SMALL_R) ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p9)   br.cond.sptk	L(SINCOS_NORMAL_R) ;;
-}
-
-{ .mfi
-(p7)   add GR_Table_Base1 = 224, GR_Table_Base1
-//
-//     Branch to SINCOS_SMALL_R or SINCOS_NORMAL_R
-//
-(p7)   fms.s1 FR_U_2 = FR_N_float, FR_P_2, FR_U_1
-//
-//     c = S - U_1
-//     r = S_1 * r
-//
-//
-(p7)   extr.u	GR_i_1 = GR_N_Inc, 0, 1
-}
-
-{ .mmi
-      nop.m 999 ;;
-//
-//     Get [i_0,i_1] - two lsb of N_fix_gr.
-//     Do dummy fmpy so inexact is always set.
-//
-(p7)   cmp.eq.unc p9, p10 = 0x0, GR_i_1
-(p7)   extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
-}
-//
-//     For small s: U_2 = N * P_2 - U_1
-//     S_1 stored constant - grab the one stored with the
-//     coefficients.
-//
-
-{ .mfi
-(p7)   ldfe FR_S_1 = [GR_Table_Base1], 16
-//
-//     Check if i_1 and i_0  != 0
-//
-(p10)  fma.s1	FR_poly = f0, f1, FR_Neg_Two_to_M67
-(p7)   cmp.eq.unc p11, p12 = 0x0, GR_i_0 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fms.s1	FR_s = FR_s, f1, FR_r
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//     S = S - r
-//     U_2 = U_2 + w
-//     load S_1
-//
-(p7)   fma.s1	FR_rsq = FR_r, FR_r, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fma.s1	FR_U_2 = FR_U_2, f1, FR_w
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fmerge.se FR_Input_X = FR_r, FR_r
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)  fma.s1 FR_Input_X = f0, f1, f1
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     FR_rsq = r * r
-//     Save r as the result.
-//
-(p7)   fms.s1	FR_c = FR_s, f1, FR_U_1
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     if ( i_1 ==0) poly = c + S_1*r*r*r
-//     else Result = 1
-//
-(p12)  fnma.s1 FR_Input_X = FR_Input_X, f1, f0
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fma.s1	FR_r = FR_S_1, FR_r, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p7)   fma.d.s0	FR_S_1 = FR_S_1, FR_S_1, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     If i_1 != 0, poly = 2**(-67)
-//
-(p7)   fms.s1 FR_c = FR_c, f1, FR_U_2
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     c = c - U_2
-//
-(p9)   fma.s1 FR_poly = FR_r, FR_rsq, FR_c
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     i_0 != 0, so Result = -Result
-//
-(p11)  fma.d.s0 FR_Input_X = FR_Input_X, f1, FR_poly
-      nop.i 999 ;;
-}
-
-{ .mfb
-      nop.m 999
-(p12)  fms.d.s0 FR_Input_X = FR_Input_X, f1, FR_poly
-//
-//     if (i_0 == 0),  Result = Result + poly
-//     else            Result = Result - poly
-//
-       br.ret.sptk   b0 ;;
-}
-L(SINCOS_LARGER_ARG):
+      getf.sig      sincos_GR_n         = sincos_W_2TO61_RSH
+      ldfpd         sincos_P2,sincos_Q2 = [sincos_AD_1],16
+      fms.s1 sincos_NFLOAT = sincos_W_2TO61_RSH,sincos_2TOM61,sincos_RSHF
+};;
 
+// sincos_r          = -sincos_Nfloat * sincos_Pi_by_16_1 + x
 { .mfi
-      nop.m 999
-       fma.s1 FR_N_0 = FR_Input_X, FR_Inv_P_0, f0
-      nop.i 999
-}
-;;
-
-//     This path for argument > 2*24
-//     Adjust table_ptr1 to beginning of table.
-//
-
-{ .mmi
-      nop.m 999
-      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
-      nop.i 999
-}
-;;
+      ldfpd         sincos_P1,sincos_Q1 = [sincos_AD_1],16
+      fnma.s1 sincos_r = sincos_NFLOAT, sincos_Pi_by_16_1, sincos_NORM_f8
+      nop.i         999 
+};;
 
+// Add 2^(k-1) (which is in sincos_r_sincos) to N
 { .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
-}
+      add           sincos_GR_n         = sincos_GR_n, sincos_r_sincos
 ;;
+// Get M (least k+1 bits of N)
+      and           sincos_GR_m         = 0x1f,sincos_GR_n
+      nop.i         999 
+};;
 
-
-//
-//     Point to  2*-14
-//     N_0 = Arg * Inv_P_0
-//
-
-{ .mmi
-       add GR_Table_Base = 688, GR_Table_Base ;;
-       ldfs FR_Two_to_M14 = [GR_Table_Base], 4
-      nop.i 999 ;;
-}
-
-{ .mfi
-       ldfs FR_Neg_Two_to_M14 = [GR_Table_Base], 0
-      nop.f 999
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Load values 2**(-14) and -2**(-14)
-//
-       fcvt.fx.s1 FR_N_0_fix = FR_N_0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     N_0_fix  = integer part of N_0
-//
-       fcvt.xf FR_N_0 = FR_N_0_fix
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Make N_0 the integer part
-//
-       fnma.s1 FR_ArgPrime = FR_N_0, FR_P_0, FR_Input_X
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-       fma.s1 FR_w = FR_N_0, FR_d_1, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Arg' = -N_0 * P_0 + Arg
-//     w  = N_0 * d_1
-//
-       fma.s1 FR_N_float = FR_ArgPrime, FR_Inv_pi_by_2, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     N = A' * 2/pi
-//
-       fcvt.fx.s1 FR_N_fix = FR_N_float
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     N_fix is the integer part
-//
-       fcvt.xf FR_N_float = FR_N_fix
-      nop.i 999 ;;
-}
-
+// sincos_r          = sincos_r -sincos_Nfloat * sincos_Pi_by_16_2
 { .mfi
-       getf.sig GR_N_Inc = FR_N_fix
-      nop.f 999
-      nop.i 999 ;;
-}
-
-{ .mii
-      nop.m 999
-      nop.i 999 ;;
-       add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos ;;
-}
+      nop.m         999
+      fnma.s1 sincos_r = sincos_NFLOAT, sincos_Pi_by_16_2,  sincos_r
+      shl           sincos_GR_32m       = sincos_GR_m,5
+};;
 
+// Add 32*M to address of sin_cos_beta table
+// For sin denorm. - set uflow
 { .mfi
-      nop.m 999
-//
-//     N is the integer part of the reduced-reduced argument.
-//     Put the integer in a GP register
-//
-       fnma.s1 FR_s = FR_N_float, FR_P_1, FR_ArgPrime
-      nop.i 999
-}
+      add           sincos_AD_2         = sincos_GR_32m, sincos_AD_1
+(p8)  fclass.m.unc  p10,p0              = f8,0x0b
+      nop.i         999 
+};;
 
+// Load Sin and Cos table value using obtained index m  (sincosf_AD_2)
 { .mfi
-      nop.m 999
-       fnma.s1 FR_w = FR_N_float, FR_P_2, FR_w
-      nop.i 999 ;;
-}
+      ldfe          sincos_Sm           = [sincos_AD_2],16
+      nop.f         999 
+      nop.i         999 
+};;
 
+// get rsq = r*r
 { .mfi
-      nop.m 999
-//
-//     s = -N*P_1 + Arg'
-//     w = -N*P_2 + w
-//     N_fix_gr = N_fix_gr + N_inc
-//
-       fcmp.lt.unc.s1 p9, p8 = FR_s, FR_Two_to_M14
-      nop.i 999 ;;
+      ldfe          sincos_Cm           = [sincos_AD_2]
+      fma.s1        sincos_rsq          = sincos_r, sincos_r,   f0 // r^2 = r*r
+      nop.i         999
 }
-
 { .mfi
-      nop.m 999
-(p9)   fcmp.gt.s1 p9, p8 = FR_s, FR_Neg_Two_to_M14
-      nop.i 999 ;;
-}
+      nop.m         999
+      fmpy.s0       fp_tmp              = fp_tmp,fp_tmp // forces inexact flag
+      nop.i         999 
+};;
 
+// sincos_r_exact = sincos_r -sincos_Nfloat * sincos_Pi_by_16_3
 { .mfi
-      nop.m 999
-//
-//     For |s|  > 2**(-14) r = S + w (r complete)
-//     Else       U_hi = N_0 * d_1
-//
-(p9)   fma.s1 FR_V_hi = FR_N_float, FR_P_2, f0
-      nop.i 999
-}
+      nop.m         999
+      fnma.s1 sincos_r_exact = sincos_NFLOAT, sincos_Pi_by_16_3, sincos_r
+      nop.i         999 
+};;
 
+// Polynomials calculation 
+// P_1 = P4*r^2 + P3
+// Q_2 = Q4*r^2 + Q3
 { .mfi
-      nop.m 999
-(p9)   fma.s1 FR_U_hi = FR_N_0, FR_d_1, f0
-      nop.i 999 ;;
+      nop.m         999
+      fma.s1        sincos_P_temp1      = sincos_rsq, sincos_P4, sincos_P3
+      nop.i         999
 }
-
 { .mfi
-      nop.m 999
-//
-//     Either S <= -2**(-14) or S >= 2**(-14)
-//     or -2**(-14) < s < 2**(-14)
-//
-(p8)   fma.s1 FR_r = FR_s, f1, FR_w
-      nop.i 999
-}
+      nop.m         999
+      fma.s1        sincos_Q_temp1      = sincos_rsq, sincos_Q4, sincos_Q3
+      nop.i         999 
+};;
 
+// get rcube = r^3 and S[m]*r^2
 { .mfi
-      nop.m 999
-(p9)   fma.s1 FR_w = FR_N_float, FR_P_3, f0
-      nop.i 999 ;;
+      nop.m         999
+      fmpy.s1       sincos_srsq         = sincos_Sm,sincos_rsq
+      nop.i         999
 }
-
 { .mfi
-      nop.m 999
-//
-//     We need abs of both U_hi and V_hi - don't
-//     worry about switched sign of V_hi.
-//
-(p9)   fms.s1 FR_A = FR_U_hi, f1, FR_V_hi
-      nop.i 999
-}
+      nop.m         999
+      fmpy.s1       sincos_rcub         = sincos_r_exact, sincos_rsq
+      nop.i         999 
+};;
 
+// Polynomials calculation 
+// Q_2 = Q_1*r^2 + Q2
+// P_1 = P_1*r^2 + P2
 { .mfi
-      nop.m 999
-//
-//     Big s: finish up c = (S - r) + w (c complete)
-//     Case 4: A =  U_hi + V_hi
-//     Note: Worry about switched sign of V_hi, so subtract instead of add.
-//
-(p9)   fnma.s1 FR_V_lo = FR_N_float, FR_P_2, FR_V_hi
-      nop.i 999 ;;
+      nop.m         999
+      fma.s1        sincos_Q_temp2      = sincos_rsq, sincos_Q_temp1, sincos_Q2
+      nop.i         999
 }
-
 { .mfi
-      nop.m 999
-(p9)   fms.s1 FR_U_lo = FR_N_0, FR_d_1, FR_U_hi
-      nop.i 999 ;;
-}
+      nop.m         999
+      fma.s1        sincos_P_temp2      = sincos_rsq, sincos_P_temp1, sincos_P2
+      nop.i         999 
+};;
 
+// Polynomials calculation 
+// Q = Q_2*r^2 + Q1
+// P = P_2*r^2 + P1
 { .mfi
-      nop.m 999
-(p9)   fmerge.s FR_V_hiabs = f0, FR_V_hi
-      nop.i 999
+      nop.m         999
+      fma.s1        sincos_Q            = sincos_rsq, sincos_Q_temp2, sincos_Q1
+      nop.i         999
 }
-
 { .mfi
-      nop.m 999
-//     For big s: c = S - r
-//     For small s do more work: U_lo = N_0 * d_1 - U_hi
-//
-(p9)   fmerge.s FR_U_hiabs = f0, FR_U_hi
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     For big s: Is |r| < 2**(-3)
-//     For big s: if p12 set, prepare to branch to Small_R.
-//     For big s: If p13 set, prepare to branch to Normal_R.
-//
-(p8)   fms.s1 FR_c = FR_s, f1, FR_r
-      nop.i 999
-}
+      nop.m         999
+      fma.s1        sincos_P            = sincos_rsq, sincos_P_temp2, sincos_P1
+      nop.i         999 
+};;
 
+// Get final P and Q
+// Q = Q*S[m]*r^2 + S[m]
+// P = P*r^3 + r
 { .mfi
-      nop.m 999
-//
-//     For small S: V_hi = N * P_2
-//                  w = N * P_3
-//     Note the product does not include the (-) as in the writeup
-//     so (-) missing for V_hi and w.
-//
-(p8)   fcmp.lt.unc.s1 p12, p13 = FR_r, FR_Two_to_M3
-      nop.i 999 ;;
+      nop.m         999
+      fma.s1        sincos_Q            = sincos_srsq,sincos_Q, sincos_Sm
+      nop.i         999
 }
-
 { .mfi
-      nop.m 999
-(p12)  fcmp.gt.s1 p12, p13 = FR_r, FR_Neg_Two_to_M3
-      nop.i 999 ;;
-}
+      nop.m         999
+      fma.s1        sincos_P            = sincos_rcub,sincos_P, sincos_r_exact
+      nop.i         999 
+};;
 
+// If sin(denormal), force underflow to be set
 { .mfi
-      nop.m 999
-(p8)   fma.s1 FR_c = FR_c, f1, FR_w
-      nop.i 999
-}
+      nop.m         999
+(p10) fmpy.d.s0     fp_tmp              = sincos_NORM_f8,sincos_NORM_f8
+      nop.i         999
+};;
 
+// Final calculation
+// result = C[m]*P + Q
 { .mfb
-      nop.m 999
-(p9)   fms.s1 FR_w = FR_N_0, FR_d_2, FR_w
-(p12)  br.cond.spnt L(SINCOS_SMALL_R) ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p13)  br.cond.sptk L(SINCOS_NORMAL_R) ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Big s: Vector off when |r| < 2**(-3).  Recall that p8 will be true.
-//     The remaining stuff is for Case 4.
-//     Small s: V_lo = N * P_2 + U_hi (U_hi is in place of V_hi in writeup)
-//     Note: the (-) is still missing for V_lo.
-//     Small s: w = w + N_0 * d_2
-//     Note: the (-) is now incorporated in w.
-//
-(p9)   fcmp.ge.unc.s1 p10, p11 = FR_U_hiabs, FR_V_hiabs
-       extr.u	GR_i_1 = GR_N_Inc, 0, 1 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     C_hi = S + A
-//
-(p9)   fma.s1 FR_t = FR_U_lo, f1, FR_V_lo
-       extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     t = U_lo + V_lo
-//
-//
-(p10)  fms.s1 FR_a = FR_U_hi, f1, FR_A
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p11)  fma.s1 FR_a = FR_V_hi, f1, FR_A
-      nop.i 999
-}
-;;
-
-{ .mmi
-      nop.m 999
-      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-
-{ .mfi
-       add GR_Table_Base = 528, GR_Table_Base
-//
-//     Is U_hiabs >= V_hiabs?
-//
-(p9)   fma.s1 FR_C_hi = FR_s, f1, FR_A
-      nop.i 999 ;;
-}
-
-{ .mmi
-       ldfe FR_C_1 = [GR_Table_Base], 16 ;;
-       ldfe FR_C_2 = [GR_Table_Base], 64
-      nop.i 999 ;;
-}
-
-{ .mmf
-      nop.m 999
-//
-//     c = c + C_lo  finished.
-//     Load  C_2
-//
-       ldfe	FR_S_1 = [GR_Table_Base], 16
-//
-//     C_lo = S - C_hi
-//
-       fma.s1 FR_t = FR_t, f1, FR_w ;;
-}
-//
-//     r and c have been computed.
-//     Make sure ftz mode is set - should be automatic when using wre
-//     |r| < 2**(-3)
-//     Get [i_0,i_1] - two lsb of N_fix.
-//     Load S_1
-//
-
-{ .mfi
-       ldfe FR_S_2 = [GR_Table_Base], 64
-//
-//     t = t + w
-//
-(p10)  fms.s1 FR_a = FR_a, f1, FR_V_hi
-       cmp.eq.unc p9, p10 = 0x0, GR_i_0
-}
-
-{ .mfi
-      nop.m 999
-//
-//     For larger u than v: a = U_hi - A
-//     Else a = V_hi - A (do an add to account for missing (-) on V_hi
-//
-       fms.s1 FR_C_lo = FR_s, f1, FR_C_hi
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p11)  fms.s1 FR_a = FR_U_hi, f1, FR_a
-       cmp.eq.unc p11, p12 = 0x0, GR_i_1
-}
-
-{ .mfi
-      nop.m 999
-//
-//     If u > v: a = (U_hi - A)  + V_hi
-//     Else      a = (V_hi - A)  + U_hi
-//     In each case account for negative missing from V_hi.
-//
-       fma.s1 FR_C_lo = FR_C_lo, f1, FR_A
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     C_lo = (S - C_hi) + A
-//
-       fma.s1 FR_t = FR_t, f1, FR_a
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     t = t + a
-//
-       fma.s1 FR_C_lo = FR_C_lo, f1, FR_t
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     C_lo = C_lo + t
-//     Adjust Table_Base to beginning of table
-//
-       fma.s1 FR_r = FR_C_hi, f1, FR_C_lo
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Load S_2
-//
-       fma.s1 FR_rsq = FR_r, FR_r, f0
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Table_Base points to C_1
-//     r = C_hi + C_lo
-//
-       fms.s1 FR_c = FR_C_hi, f1, FR_r
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     if i_1 ==0: poly = S_2 * FR_rsq + S_1
-//     else        poly = C_2 * FR_rsq + C_1
-//
-(p11)  fma.s1 FR_Input_X = f0, f1, FR_r
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p12)  fma.s1 FR_Input_X = f0, f1, f1
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Compute r_cube = FR_rsq * r
-//
-(p11)  fma.s1 FR_poly = FR_rsq, FR_S_2, FR_S_1
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p12)  fma.s1 FR_poly = FR_rsq, FR_C_2, FR_C_1
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//     Compute FR_rsq = r * r
-//     Is i_1 == 0 ?
-//
-       fma.s1 FR_r_cubed = FR_rsq, FR_r, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     c = C_hi - r
-//     Load  C_1
-//
-       fma.s1 FR_c = FR_c, f1, FR_C_lo
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//     if i_1 ==0: poly = r_cube * poly + c
-//     else        poly = FR_rsq * poly
-//
-(p10)  fms.s1 FR_Input_X = f0, f1, FR_Input_X
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//     if i_1 ==0: Result = r
-//     else        Result = 1.0
-//
-(p11)  fma.s1 FR_poly = FR_r_cubed, FR_poly, FR_c
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p12)  fma.s1 FR_poly = FR_rsq, FR_poly, f0
-      nop.i 999 ;;
-}
+      nop.m         999
+      fma.d.s0      f8                  = sincos_Cm, sincos_P, sincos_Q
+      br.ret.sptk   b0  // Exit for common path
+};;
 
+////////// x = 0/Inf/NaN path //////////////////
+_SINCOS_SPECIAL_ARGS:
+.pred.rel "mutex",p8,p9
+// sin(+/-0) = +/-0
+// sin(Inf)  = NaN
+// sin(NaN)  = NaN
 { .mfi
-      nop.m 999
-//
-//     if i_0 !=0: Result = -Result
-//
-(p9)   fma.d.s0 FR_Input_X = FR_Input_X, f1, FR_poly
-      nop.i 999 ;;
+      nop.m         999
+(p8)  fma.d.s0      f8                  = f8, f0, f0 // sin(+/-0,NaN,Inf)
+      nop.i         999
 }
-
+// cos(+/-0) = 1.0
+// cos(Inf)  = NaN
+// cos(NaN)  = NaN
 { .mfb
-      nop.m 999
-(p10)  fms.d.s0 FR_Input_X = FR_Input_X, f1, FR_poly
-//
-//     if i_0 == 0: Result = Result + poly
-//     else         Result = Result - poly
-//
-       br.ret.sptk   b0 ;;
-}
-L(SINCOS_SMALL_R):
-
-{ .mii
-      nop.m 999
-      	extr.u	GR_i_1 = GR_N_Inc, 0, 1 ;;
-//
-//
-//      Compare both i_1 and i_0 with 0.
-//      if i_1 == 0, set p9.
-//      if i_0 == 0, set p11.
-//
-      	cmp.eq.unc p9, p10 = 0x0, GR_i_1 ;;
-}
-
-{ .mfi
-      nop.m 999
-      	fma.s1 FR_rsq = FR_r, FR_r, f0
-      	extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-// 	Z = Z * FR_rsq
-//
-(p10)	fnma.s1	FR_c = FR_c, FR_r, f0
-      	cmp.eq.unc p11, p12 = 0x0, GR_i_0
-}
-;;
-
-// ******************************************************************
-// ******************************************************************
-// ******************************************************************
-//      r and c have been computed.
-//      We know whether this is the sine or cosine routine.
-//      Make sure ftz mode is set - should be automatic when using wre
-//      |r| < 2**(-3)
-//
-//      Set table_ptr1 to beginning of constant table.
-//      Get [i_0,i_1] - two lsb of N_fix_gr.
-//
-
-{ .mmi
-      nop.m 999
-      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-
-//
-//      Set table_ptr1 to point to S_5.
-//      Set table_ptr1 to point to C_5.
-//      Compute FR_rsq = r * r
-//
-
-{ .mfi
-(p9)  	add GR_Table_Base = 672, GR_Table_Base
-(p10)	fmerge.s FR_r = f1, f1
-(p10) 	add GR_Table_Base = 592, GR_Table_Base ;;
-}
-//
-//      Set table_ptr1 to point to S_5.
-//      Set table_ptr1 to point to C_5.
-//
-
-{ .mmi
-(p9)  	ldfe FR_S_5 = [GR_Table_Base], -16 ;;
-//
-//      if (i_1 == 0) load S_5
-//      if (i_1 != 0) load C_5
-//
-(p9)  	ldfe FR_S_4 = [GR_Table_Base], -16
-      nop.i 999 ;;
-}
-
-{ .mmf
-(p10) 	ldfe FR_C_5 = [GR_Table_Base], -16
-//
-//      Z = FR_rsq * FR_rsq
-//
-(p9)  	ldfe FR_S_3 = [GR_Table_Base], -16
-//
-//      Compute FR_rsq = r * r
-//      if (i_1 == 0) load S_4
-//      if (i_1 != 0) load C_4
-//
-       	fma.s1 FR_Z = FR_rsq, FR_rsq, f0 ;;
-}
-//
-//      if (i_1 == 0) load S_3
-//      if (i_1 != 0) load C_3
-//
-
-{ .mmi
-(p9)  	ldfe FR_S_2 = [GR_Table_Base], -16 ;;
-//
-//      if (i_1 == 0) load S_2
-//      if (i_1 != 0) load C_2
-//
-(p9)  	ldfe FR_S_1 = [GR_Table_Base], -16
-      nop.i 999
-}
-
-{ .mmi
-(p10) 	ldfe FR_C_4 = [GR_Table_Base], -16 ;;
-(p10)  	ldfe FR_C_3 = [GR_Table_Base], -16
-      nop.i 999 ;;
-}
-
-{ .mmi
-(p10) 	ldfe FR_C_2 = [GR_Table_Base], -16 ;;
-(p10) 	ldfe FR_C_1 = [GR_Table_Base], -16
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1 != 0):
-//      poly_lo = FR_rsq * C_5 + C_4
-//      poly_hi = FR_rsq * C_2 + C_1
-//
-(p9)  	fma.s1 FR_Z = FR_Z, FR_r, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1 == 0) load S_1
-//      if (i_1 != 0) load C_1
-//
-(p9)  	fma.s1 FR_poly_lo = FR_rsq, FR_S_5, FR_S_4
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//      c = -c * r
-//      dummy fmpy's to flag inexact.
-//
-(p9)	fma.d.s0 FR_S_4 = FR_S_4, FR_S_4, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      poly_lo = FR_rsq * poly_lo + C_3
-//      poly_hi = FR_rsq * poly_hi
-//
-        fma.s1	FR_Z = FR_Z, FR_rsq, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p9)  	fma.s1 FR_poly_hi = FR_rsq, FR_S_2, FR_S_1
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1 == 0):
-//      poly_lo = FR_rsq * S_5 + S_4
-//      poly_hi = FR_rsq * S_2 + S_1
-//
-(p10) 	fma.s1 FR_poly_lo = FR_rsq, FR_C_5, FR_C_4
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1 == 0):
-//      Z = Z * r  for only one of the small r cases - not there
-//      in original implementation notes.
-//
-(p9)  	fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_S_3
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10) 	fma.s1 FR_poly_hi = FR_rsq, FR_C_2, FR_C_1
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.d.s0 FR_C_1 = FR_C_1, FR_C_1, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p9)  	fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//      poly_lo = FR_rsq * poly_lo + S_3
-//      poly_hi = FR_rsq * poly_hi
-//
-(p10) 	fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_C_3
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10) 	fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-// 	if (i_1 == 0): dummy fmpy's to flag inexact
-// 	r = 1
-//
-(p9)	fma.s1 FR_poly_hi = FR_r, FR_poly_hi, f0
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-// 	poly_hi = r * poly_hi
-//
-        fma.s1	FR_poly = FR_Z, FR_poly_lo, FR_c
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p12)	fms.s1	FR_r = f0, f1, FR_r
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      poly_hi = Z * poly_lo + c
-// 	if i_0 == 1: r = -r
-//
-     	fma.s1	FR_poly = FR_poly, f1, FR_poly_hi
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p12)	fms.d.s0 FR_Input_X = FR_r, f1, FR_poly
-      nop.i 999
-}
+      nop.m         999
+(p9)  fma.d.s0      f8                  = f8, f0, f1 // cos(+/-0,NaN,Inf)
+      br.ret.sptk   b0 // Exit for x = 0/Inf/NaN path
+};;
 
+_SINCOS_UNORM:
+// Here if x=unorm
 { .mfb
-      nop.m 999
-//
-//      poly = poly + poly_hi
-//
-(p11)	fma.d.s0 FR_Input_X = FR_r, f1, FR_poly
-//
-//      if (i_0 == 0) Result = r + poly
-//      if (i_0 != 0) Result = r - poly
-//
-       br.ret.sptk   b0 ;;
-}
-L(SINCOS_NORMAL_R):
-
-{ .mii
-      nop.m 999
-    	extr.u	GR_i_1 = GR_N_Inc, 0, 1 ;;
-//
-//      Set table_ptr1 and table_ptr2 to base address of
-//      constant table.
-    	cmp.eq.unc p9, p10 = 0x0, GR_i_1 ;;
-}
+      getf.exp      sincos_r_signexp    = sincos_NORM_f8 // Get signexp of x 
+      fcmp.eq.s0    p11,p0              = f8, f0  // Dummy op to set denorm flag
+      br.cond.sptk  _SINCOS_COMMON2     // Return to main path
+};;
 
-{ .mfi
-      nop.m 999
-    	fma.s1	FR_rsq = FR_r, FR_r, f0
-    	extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
-}
+GLOBAL_IEEE754_END(cos)
 
+//////////// x >= 2^27 - large arguments routine call ////////////
+LOCAL_LIBM_ENTRY(__libm_callout_sincos)
+_SINCOS_LARGE_ARGS:
+.prologue
 { .mfi
-      nop.m 999
-    	frcpa.s1 FR_r_hi, p6 = f1, FR_r
-    	cmp.eq.unc p11, p12 = 0x0, GR_i_0
+      mov           GR_SAVE_r_sincos    = sincos_r_sincos // Save sin or cos
+      nop.f         999
+.save ar.pfs,GR_SAVE_PFS
+      mov           GR_SAVE_PFS         = ar.pfs
 }
 ;;
 
-// ******************************************************************
-// ******************************************************************
-// ******************************************************************
-//
-//      r and c have been computed.
-//      We known whether this is the sine or cosine routine.
-//      Make sure ftz mode is set - should be automatic when using wre
-//      Get [i_0,i_1] - two lsb of N_fix_gr alone.
-//
-
-{ .mmi
-      nop.m 999
-      addl           GR_Table_Base   = @ltoff(FSINCOS_CONSTANTS#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
-}
-;;
-
-
-{ .mfi
-(p10)	add GR_Table_Base = 384, GR_Table_Base
-(p12)	fms.s1 FR_Input_X = f0, f1, f1
-(p9)	add GR_Table_Base = 224, GR_Table_Base ;;
-}
-
-{ .mmf
-      nop.m 999
-(p10)	ldfe FR_QQ_8 = [GR_Table_Base], 16
-//
-//      if (i_1==0) poly = poly * FR_rsq + PP_1_lo
-//      else        poly = FR_rsq * poly
-//
-(p11)	fma.s1 FR_Input_X = f0, f1, f1 ;;
-}
-
-{ .mmf
-(p10)	ldfe FR_QQ_7 = [GR_Table_Base], 16
-//
-// 	Adjust table pointers based on i_0
-//      Compute rsq = r * r
-//
-(p9)	ldfe FR_PP_8 = [GR_Table_Base], 16
-    	fma.s1 FR_r_cubed = FR_r, FR_rsq, f0 ;;
-}
-
-{ .mmf
-(p9)	ldfe FR_PP_7 = [GR_Table_Base], 16
-(p10)	ldfe FR_QQ_6 = [GR_Table_Base], 16
-//
-//      Load PP_8 and QQ_8; PP_7 and QQ_7
-//
-    	frcpa.s1 FR_r_hi, p6 = f1, FR_r_hi ;;
-}
-//
-//      if (i_1==0) poly =   PP_7 + FR_rsq * PP_8.
-//      else        poly =   QQ_7 + FR_rsq * QQ_8.
-//
-
-{ .mmb
-(p9)	ldfe FR_PP_6 = [GR_Table_Base], 16
-(p10)	ldfe FR_QQ_5 = [GR_Table_Base], 16
-      nop.b 999 ;;
-}
-
-{ .mmb
-(p9)	ldfe FR_PP_5 = [GR_Table_Base], 16
-(p10)	ldfe FR_S_1 = [GR_Table_Base], 16
-      nop.b 999 ;;
-}
-
-{ .mmb
-(p10)	ldfe FR_QQ_1 = [GR_Table_Base], 16
-(p9)	ldfe FR_C_1 = [GR_Table_Base], 16
-      nop.b 999 ;;
-}
-
-{ .mmi
-(p10)	ldfe FR_QQ_4 = [GR_Table_Base], 16 ;;
-(p9)	ldfe FR_PP_1 = [GR_Table_Base], 16
-      nop.i 999 ;;
-}
-
-{ .mmf
-(p10)	ldfe FR_QQ_3 = [GR_Table_Base], 16
-//
-//      if (i_1=0) corr = corr + c*c
-//      else       corr = corr * c
-//
-(p9)	ldfe FR_PP_4 = [GR_Table_Base], 16
-(p10)	fma.s1 FR_poly = FR_rsq, FR_QQ_8, FR_QQ_7 ;;
-}
-//
-//      if (i_1=0) poly = rsq * poly + PP_5
-//      else       poly = rsq * poly + QQ_5
-//      Load PP_4 or QQ_4
-//
-
-{ .mmf
-(p9)	ldfe FR_PP_3 = [GR_Table_Base], 16
-(p10)	ldfe FR_QQ_2 = [GR_Table_Base], 16
-//
-//      r_hi =   frcpa(frcpa(r)).
-//      r_cube = r * FR_rsq.
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_PP_8, FR_PP_7 ;;
-}
-//
-//      Do dummy multiplies so inexact is always set.
-//
-
-{ .mfi
-(p9)	ldfe FR_PP_2 = [GR_Table_Base], 16
-//
-//      r_lo = r - r_hi
-//
-(p9)	fma.s1 FR_U_lo = FR_r_hi, FR_r_hi, f0
-      nop.i 999 ;;
-}
-
-{ .mmf
-      nop.m 999
-(p9)	ldfe FR_PP_1_lo = [GR_Table_Base], 16
-(p10)	fma.s1 FR_corr = FR_S_1, FR_r_cubed, FR_r
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_6
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1=0) U_lo = r_hi * r_hi
-//      else       U_lo = r_hi + r
-//
-(p9)	fma.s1 FR_corr = FR_C_1, FR_rsq, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1=0) corr = C_1 * rsq
-//      else       corr = S_1 * r_cubed + r
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_6
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_U_lo = FR_r_hi, f1, FR_r
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1=0) U_hi = r_hi + U_hi
-//      else       U_hi = QQ_1 * U_hi + 1
-//
-(p9)	fma.s1 FR_U_lo = FR_r, FR_r_hi, FR_U_lo
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-//
-//      U_hi = r_hi * r_hi
-//
-    	fms.s1 FR_r_lo = FR_r, f1, FR_r_hi
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      Load PP_1, PP_6, PP_5, and C_1
-//      Load QQ_1, QQ_6, QQ_5, and S_1
-//
-    	fma.s1 FR_U_hi = FR_r_hi, FR_r_hi, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_5
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fnma.s1	FR_corr = FR_corr, FR_c, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1=0) U_lo = r * r_hi + U_lo
-//      else       U_lo = r_lo * U_lo
-//
-(p9)	fma.s1 FR_corr = FR_corr, FR_c, FR_c
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_5
-      nop.i 999
-}
-
 { .mfi
-      nop.m 999
-//
-//      if (i_1 =0) U_hi = r + U_hi
-//      if (i_1 =0) U_lo = r_lo * U_lo
-//
-//
-(p9)	fma.d.s0 FR_PP_5 = FR_PP_5, FR_PP_4, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p9)	fma.s1 FR_U_lo = FR_r, FR_r, FR_U_lo
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1=0) poly = poly * rsq + PP_6
-//      else       poly = poly * rsq + QQ_6
-//
-(p9)	fma.s1 FR_U_hi = FR_r_hi, FR_U_hi, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_4
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_U_hi = FR_QQ_1, FR_U_hi, f1
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.d.s0 FR_QQ_5 = FR_QQ_5, FR_QQ_5, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1!=0) U_hi = PP_1 * U_hi
-//      if (i_1!=0) U_lo = r * r  + U_lo
-//      Load PP_3 or QQ_3
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_4
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p9)	fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0
-      nop.i 999
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_U_lo = FR_QQ_1,FR_U_lo, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p9)	fma.s1 FR_U_hi = FR_PP_1, FR_U_hi, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_3
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      Load PP_2, QQ_2
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_3
-      nop.i 999 ;;
+      mov           GR_SAVE_GP          = gp
+      nop.f         999
+.save b0, GR_SAVE_B0
+      mov           GR_SAVE_B0          = b0
 }
 
-{ .mfi
-      nop.m 999
-//
-//      if (i_1==0) poly = FR_rsq * poly  + PP_3
-//      else        poly = FR_rsq * poly  + QQ_3
-//      Load PP_1_lo
-//
-(p9)	fma.s1 FR_U_lo = FR_PP_1, FR_U_lo, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1 =0) poly = poly * rsq + pp_r4
-//      else        poly = poly * rsq + qq_r4
-//
-(p9)	fma.s1 FR_U_hi = FR_r, f1, FR_U_hi
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_2
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1==0) U_lo =  PP_1_hi * U_lo
-//      else        U_lo =  QQ_1 * U_lo
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_2
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_0==0)  Result = 1
-//      else         Result = -1
-//
-     	fma.s1 FR_V = FR_U_lo, f1, FR_corr
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1==0) poly =  FR_rsq * poly + PP_2
-//      else poly =  FR_rsq * poly + QQ_2
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_1_lo
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      V = U_lo + corr
-//
-(p9)	fma.s1 FR_poly = FR_r_cubed, FR_poly, f0
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-//
-//      if (i_1==0) poly = r_cube * poly
-//      else        poly = FR_rsq * poly
-//
-    	fma.s1	FR_V = FR_poly, f1, FR_V
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p12)	fms.d.s0 FR_Input_X = FR_Input_X, FR_U_hi, FR_V
-      nop.i 999
-}
-
-{ .mfb
-      nop.m 999
-//
-//      V = V + poly
-//
-(p11)	fma.d.s0 FR_Input_X = FR_Input_X, FR_U_hi, FR_V
-//
-//      if (i_0==0) Result = Result * U_hi + V
-//      else        Result = Result * U_hi - V
-//
-       br.ret.sptk   b0 ;;
-}
-
-//
-//      If cosine, FR_Input_X = 1
-//      If sine, FR_Input_X = +/-Zero (Input FR_Input_X)
-//      Results are exact, no exceptions
-//
-L(SINCOS_ZERO):
-
-{ .mmb
-        cmp.eq.unc p6, p7 = 0x1, GR_Sin_or_Cos
-      nop.m 999
-      nop.b 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p7)    fmerge.s FR_Input_X = FR_Input_X, FR_Input_X
-      nop.i 999
-}
-
-{ .mfb
-      nop.m 999
-(p6)    fmerge.s FR_Input_X = f1, f1
-       br.ret.sptk   b0 ;;
-}
-
-L(SINCOS_SPECIAL):
-
-//
-//      Path for Arg = +/- QNaN, SNaN, Inf
-//      Invalid can be raised. SNaNs
-//      become QNaNs
-//
-
-{ .mfb
-      nop.m 999
-        fmpy.d.s0 FR_Input_X = FR_Input_X, f0
-        br.ret.sptk   b0 ;;
-}
-.endp __libm_cos_double_dbx#
-ASM_SIZE_DIRECTIVE(__libm_cos_double_dbx#)
-
-
-
-//
-//      Call int pi_by_2_reduce(double* x, double *y)
-//      for |arguments| >= 2**63
-//      Address to save r and c as double
-//
-//
-//      psp    sp+64
-//             sp+48  -> f0 c
-//      r45    sp+32  -> f0 r
-//      r44 -> sp+16  -> InputX
-//      sp     sp     -> scratch provided to callee
-
+.body
+{ .mbb
+      setf.sig      sincos_save_tmp     = sincos_GR_all_ones// inexact set
+      nop.b         999
+(p8)  br.call.sptk.many b0              = __libm_sin_large# // sin(large_X)
 
+};;
 
-.proc __libm_callout_2
-__libm_callout_2:
-L(SINCOS_ARG_TOO_LARGE):
+{ .mbb
+      cmp.ne        p9,p0               = GR_SAVE_r_sincos, r0 // set p9 if cos
+      nop.b         999
+(p9)  br.call.sptk.many b0              = __libm_cos_large# // cos(large_X)
+};;
 
-.prologue
 { .mfi
-        add   r45=-32,sp                        // Parameter: r address
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+      mov           gp                  = GR_SAVE_GP
+      fma.d.s0      f8                  = f8, f1, f0 // Round result to double
+      mov           b0                  = GR_SAVE_B0
 }
+// Force inexact set
 { .mfi
-.fframe 64
-        add sp=-64,sp                           // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
-};;
-{ .mmi
-        stfe [r45] = f0,16                      // Clear Parameter r on stack
-        add  r44 = 16,sp                        // Parameter x address
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
-};;
-.body
-{ .mib
-        stfe [r45] = f0,-16                     // Clear Parameter c on stack
-        nop.i 0
-        nop.b 0
-}
-{ .mib
-        stfe [r44] = FR_Input_X                 // Store Parameter x on stack
-        nop.i 0
-        br.call.sptk b0=__libm_pi_by_2_reduce# ;;
+      nop.m         999
+      fmpy.s0       sincos_save_tmp     = sincos_save_tmp, sincos_save_tmp
+      nop.i         999 
 };;
 
-
-{ .mii
-        ldfe  FR_Input_X =[r44],16
-//
-//      Get r and c off stack
-//
-        adds  GR_Table_Base1 = -16, GR_Table_Base1
-//
-//      Get r and c off stack
-//
-        add   GR_N_Inc = GR_Sin_or_Cos,r8 ;;
-}
-{ .mmb
-        ldfe  FR_r =[r45],16
-//
-//      Get X off the stack
-//      Readjust Table ptr
-//
-        ldfs FR_Two_to_M3 = [GR_Table_Base1],4
-        nop.b 999 ;;
-}
-{ .mmb
-        ldfs FR_Neg_Two_to_M3 = [GR_Table_Base1],0
-        ldfe  FR_c =[r45]
-        nop.b 999 ;;
-}
-
-{ .mfi
-.restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        fcmp.lt.unc.s1  p6, p0 = FR_r, FR_Two_to_M3
-        mov   b0 = GR_SAVE_B0                  // Restore return address
-};;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        nop.b 0
+      nop.m         999
+      mov           ar.pfs              = GR_SAVE_PFS
+      br.ret.sptk   b0 // Exit for large arguments routine call
 };;
 
+LOCAL_LIBM_END(__libm_callout_sincos)
 
-{ .mfi
-      nop.m 999
-(p6)    fcmp.gt.unc.s1	p6, p0 = FR_r, FR_Neg_Two_to_M3
-      nop.i 999 ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-(p6)    br.cond.spnt L(SINCOS_SMALL_R) ;;
-}
-
-{ .mib
-      nop.m 999
-      nop.i 999
-        br.cond.sptk L(SINCOS_NORMAL_R) ;;
-}
-
-.endp __libm_callout_2
-ASM_SIZE_DIRECTIVE(__libm_callout_2)
-
-.type   __libm_pi_by_2_reduce#,@function
-.global __libm_pi_by_2_reduce#
-
+.type    __libm_sin_large#,@function
+.global  __libm_sin_large#
+.type    __libm_cos_large#,@function
+.global  __libm_cos_large#
 
-.type __libm_sin_double_dbx#,@function
-.global __libm_sin_double_dbx#
-.type __libm_cos_double_dbx#,@function
-.global __libm_cos_double_dbx#
diff --git a/sysdeps/ia64/fpu/s_cosf.S b/sysdeps/ia64/fpu/s_cosf.S
index 0e47255b3f..bcdf1b0c02 100644
--- a/sysdeps/ia64/fpu/s_cosf.S
+++ b/sysdeps/ia64/fpu/s_cosf.S
@@ -1,12 +1,10 @@
-
 .file "sincosf.s"
 
 
-// Copyright (C) 2000, 2001, Intel Corporation
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -22,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,663 +35,683 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
-
-
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
 // History
 //==============================================================
-// 2/02/00  Initial revision 
-// 4/02/00  Unwind support added.
-// 5/10/00  Improved speed with new algorithm.
-// 8/08/00  Improved speed by avoiding SIR flush.
-// 8/17/00  Changed predicate register macro-usage to direct predicate
-//          names due to an assembler bug.
-// 8/30/00  Put sin_of_r before sin_tbl_S_cos_of_r to gain a cycle 
-// 1/02/00  Fixed flag settings, improved speed.
+// 02/02/00 Initial version
+// 04/02/00 Unwind support added.
+// 06/16/00 Updated tables to enforce symmetry
+// 08/31/00 Saved 2 cycles in main path, and 9 in other paths.
+// 09/20/00 The updated tables regressed to an old version, so reinstated them
+// 10/18/00 Changed one table entry to ensure symmetry
+// 01/03/01 Improved speed, fixed flag settings for small arguments.
+// 02/18/02 Large arguments processing routine excluded
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 06/03/02 Insure inexact flag set for large arg result
+// 09/05/02 Single precision version is made using double precision one as base
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 03/31/05 Reformatted delimiters between data tables
 //
 // API
 //==============================================================
 // float sinf( float x);
 // float cosf( float x);
 //
+// Overview of operation
+//==============================================================
+//
+// Step 1
+// ======
+// Reduce x to region -1/2*pi/2^k ===== 0 ===== +1/2*pi/2^k  where k=4
+//    divide x by pi/2^k.
+//    Multiply by 2^k/pi.
+//    nfloat = Round result to integer (round-to-nearest)
+//
+// r = x -  nfloat * pi/2^k
+//    Do this as (x -  nfloat * HIGH(pi/2^k)) - nfloat * LOW(pi/2^k) 
+
+//    for increased accuracy.
+//    pi/2^k is stored as two numbers that when added make pi/2^k.
+//       pi/2^k = HIGH(pi/2^k) + LOW(pi/2^k)
+//    HIGH part is rounded to zero, LOW - to nearest
+//
+// x = (nfloat * pi/2^k) + r
+//    r is small enough that we can use a polynomial approximation
+//    and is referred to as the reduced argument.
+//
+// Step 3
+// ======
+// Take the unreduced part and remove the multiples of 2pi.
+// So nfloat = nfloat (with lower k+1 bits cleared) + lower k+1 bits
+//
+//    nfloat (with lower k+1 bits cleared) is a multiple of 2^(k+1)
+//    N * 2^(k+1)
+//    nfloat * pi/2^k = N * 2^(k+1) * pi/2^k + (lower k+1 bits) * pi/2^k
+//    nfloat * pi/2^k = N * 2 * pi + (lower k+1 bits) * pi/2^k
+//    nfloat * pi/2^k = N2pi + M * pi/2^k
+//
+//
+// Sin(x) = Sin((nfloat * pi/2^k) + r)
+//        = Sin(nfloat * pi/2^k) * Cos(r) + Cos(nfloat * pi/2^k) * Sin(r)
+//
+//          Sin(nfloat * pi/2^k) = Sin(N2pi + Mpi/2^k)
+//                               = Sin(N2pi)Cos(Mpi/2^k) + Cos(N2pi)Sin(Mpi/2^k)
+//                               = Sin(Mpi/2^k)
+//
+//          Cos(nfloat * pi/2^k) = Cos(N2pi + Mpi/2^k)
+//                               = Cos(N2pi)Cos(Mpi/2^k) + Sin(N2pi)Sin(Mpi/2^k)
+//                               = Cos(Mpi/2^k)
+//
+// Sin(x) = Sin(Mpi/2^k) Cos(r) + Cos(Mpi/2^k) Sin(r)
+//
+//
+// Step 4
+// ======
+// 0 <= M < 2^(k+1)
+// There are 2^(k+1) Sin entries in a table.
+// There are 2^(k+1) Cos entries in a table.
+//
+// Get Sin(Mpi/2^k) and Cos(Mpi/2^k) by table lookup.
+//
+//
+// Step 5
+// ======
+// Calculate Cos(r) and Sin(r) by polynomial approximation.
+//
+// Cos(r) = 1 + r^2 q1  + r^4 q2  = Series for Cos
+// Sin(r) = r + r^3 p1  + r^5 p2  = Series for Sin
+//
+// and the coefficients q1, q2 and p1, p2 are stored in a table
+//
+//
+// Calculate
+// Sin(x) = Sin(Mpi/2^k) Cos(r) + Cos(Mpi/2^k) Sin(r)
+//
+// as follows
+//
+//    S[m] = Sin(Mpi/2^k) and C[m] = Cos(Mpi/2^k)
+//    rsq = r*r
+//
+//
+//    P = P1 + r^2*P2
+//    Q = Q1 + r^2*Q2
+//
+//       rcub = r * rsq
+//       Sin(r) = r + rcub * P
+//              = r + r^3p1  + r^5p2 = Sin(r)
+//
+//            The coefficients are not exactly these values, but almost.
+//
+//            p1 = -1/6  = -1/3!
+//            p2 = 1/120 =  1/5!
+//            p3 = -1/5040 = -1/7!
+//            p4 = 1/362889 = 1/9!
+//
+//       P =  r + r^3 * P
+//
+//    Answer = S[m] Cos(r) + C[m] P
+//
+//       Cos(r) = 1 + rsq Q
+//       Cos(r) = 1 + r^2 Q
+//       Cos(r) = 1 + r^2 (q1 + r^2q2)
+//       Cos(r) = 1 + r^2q1 + r^4q2
+//
+//       S[m] Cos(r) = S[m](1 + rsq Q)
+//       S[m] Cos(r) = S[m] + S[m] rsq Q
+//       S[m] Cos(r) = S[m] + s_rsq Q
+//       Q         = S[m] + s_rsq Q
+//
+// Then,
+//
+//    Answer = Q + C[m] P
+
+
+// Registers used
+//==============================================================
+// general input registers:
+// r14 -> r19
+// r32 -> r45
+
+// predicate registers used:
+// p6 -> p14
+
+// floating-point registers used
+// f9 -> f15
+// f32 -> f61
 
-#include "libm_support.h"	
-	
 // Assembly macros
 //==============================================================
+sincosf_NORM_f8                 = f9
+sincosf_W                       = f10
+sincosf_int_Nfloat              = f11
+sincosf_Nfloat                  = f12
 
-// SIN_Sin_Flag               = p6
-// SIN_Cos_Flag               = p7
-
-// integer registers used
-
- SIN_AD_PQ_1                = r33
- SIN_AD_PQ_2                = r33
- sin_GR_sincos_flag         = r34
- sin_GR_Mint                = r35
-
- sin_GR_index               = r36
- gr_tmp                     = r37
-
- GR_SAVE_B0                 = r37
- GR_SAVE_GP                 = r38
- GR_SAVE_PFS                = r39
-
-
-// floating point registers used
-
- sin_coeff_P1               = f32
- sin_coeff_P2               = f33
- sin_coeff_Q1               = f34
- sin_coeff_Q2               = f35
- sin_coeff_P4               = f36
- sin_coeff_P5               = f37
- sin_coeff_Q3               = f38
- sin_coeff_Q4               = f39
- sin_Mx                     = f40
- sin_Mfloat                 = f41
- sin_tbl_S                  = f42
- sin_tbl_C                  = f43
- sin_r                      = f44
- sin_rcube                  = f45
- sin_tsq                    = f46
- sin_r7                     = f47
- sin_t                      = f48
- sin_poly_p2                = f49
- sin_poly_p1                = f50
- fp_tmp                     = f51
- sin_poly_p3                = f52
- sin_poly_p4                = f53
- sin_of_r                   = f54
- sin_S_t                    = f55
- sin_poly_q2                = f56
- sin_poly_q1                = f57
- sin_S_tcube                = f58
- sin_poly_q3                = f59
- sin_poly_q4                = f60
- sin_tbl_S_tcube            = f61
- sin_tbl_S_cos_of_r         = f62
-
- sin_coeff_Q5               = f63
- sin_coeff_Q6               = f64
- sin_coeff_P3               = f65
-
- sin_poly_q5                = f66
- sin_poly_q12               = f67
- sin_poly_q3456             = f68
- fp_tmp2                    = f69
- SIN_NORM_f8                = f70
-
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+sincosf_r                       = f13
+sincosf_rsq                     = f14
+sincosf_rcub                    = f15
+sincosf_save_tmp                = f15
 
-.align 16
+sincosf_Inv_Pi_by_16            = f32
+sincosf_Pi_by_16_1              = f33
+sincosf_Pi_by_16_2              = f34
 
-sin_coeff_1_table:
-ASM_TYPE_DIRECTIVE(sin_coeff_1_table,@object)
-data8 0xBF56C16C16BF6462       // q3
-data8 0x3EFA01A0128B9EBC       // q4
-data8 0xBE927E42FDF33FFE       // q5
-data8 0x3E21DA5C72A446F3       // q6
-data8 0x3EC71DD1D5E421A4       // p4
-data8 0xBE5AC5C9D0ACF95A       // p5
-data8 0xBFC55555555554CA       // p1
-data8 0x3F811111110F2395       // p2
-data8 0xBFE0000000000000       // q1
-data8 0x3FA55555555554EF       // q2
-data8 0xBF2A01A011232913       // p3
-data8 0x0000000000000000       // pad
- 
-
-/////////////////////////////////////////
-
-data8 0xBFE1A54991426566   //sin(-32)
-data8 0x3FEAB1F5305DE8E5   //cos(-32)
-data8 0x3FD9DBC0B640FC81   //sin(-31)
-data8 0x3FED4591C3E12A20   //cos(-31)
-data8 0x3FEF9DF47F1C903D   //sin(-30)
-data8 0x3FC3BE82F2505A52   //cos(-30)
-data8 0x3FE53C7D20A6C9E7   //sin(-29)
-data8 0xBFE7F01658314E47   //cos(-29)
-data8 0xBFD156853B4514D6   //sin(-28)
-data8 0xBFEECDAAD1582500   //cos(-28)
-data8 0xBFEE9AA1B0E5BA30   //sin(-27)
-data8 0xBFD2B266F959DED5   //cos(-27)
-data8 0xBFE866E0FAC32583   //sin(-26)
-data8 0x3FE4B3902691A9ED   //cos(-26)
-data8 0x3FC0F0E6F31E809D   //sin(-25)
-data8 0x3FEFB7EEF59504FF   //cos(-25)
-data8 0x3FECFA7F7919140F   //sin(-24)
-data8 0x3FDB25BFB50A609A   //cos(-24)
-data8 0x3FEB143CD0247D02   //sin(-23)
-data8 0xBFE10CF7D591F272   //cos(-23)
-data8 0x3F8220A29F6EB9F4   //sin(-22)
-data8 0xBFEFFFADD8D4ACDA   //cos(-22)
-data8 0xBFEAC5E20BB0D7ED   //sin(-21)
-data8 0xBFE186FF83773759   //cos(-21)
-data8 0xBFED36D8F55D3CE0   //sin(-20)
-data8 0x3FDA1E043964A83F   //cos(-20)
-data8 0xBFC32F2D28F584CF   //sin(-19)
-data8 0x3FEFA377DE108258   //cos(-19)
-data8 0x3FE8081668131E26   //sin(-18)
-data8 0x3FE52150815D2470   //cos(-18)
-data8 0x3FEEC3C4AC42882B   //sin(-17)
-data8 0xBFD19C46B07F58E7   //cos(-17)
-data8 0x3FD26D02085F20F8   //sin(-16)
-data8 0xBFEEA5257E962F74   //cos(-16)
-data8 0xBFE4CF2871CEC2E8   //sin(-15)
-data8 0xBFE84F5D069CA4F3   //cos(-15)
-data8 0xBFEFB30E327C5E45   //sin(-14)
-data8 0x3FC1809AEC2CA0ED   //cos(-14)
-data8 0xBFDAE4044881C506   //sin(-13)
-data8 0x3FED09CDD5260CB7   //cos(-13)
-data8 0x3FE12B9AF7D765A5   //sin(-12)
-data8 0x3FEB00DA046B65E3   //cos(-12)
-data8 0x3FEFFFEB762E93EB   //sin(-11)
-data8 0x3F7220AE41EE2FDF   //cos(-11)
-data8 0x3FE1689EF5F34F52   //sin(-10)
-data8 0xBFEAD9AC890C6B1F   //cos(-10)
-data8 0xBFDA6026360C2F91   //sin( -9)
-data8 0xBFED27FAA6A6196B   //cos( -9)
-data8 0xBFEFA8D2A028CF7B   //sin( -8)
-data8 0xBFC29FBEBF632F94   //cos( -8)
-data8 0xBFE50608C26D0A08   //sin( -7)
-data8 0x3FE81FF79ED92017   //cos( -7)
-data8 0x3FD1E1F18AB0A2C0   //sin( -6)
-data8 0x3FEEB9B7097822F5   //cos( -6)
-data8 0x3FEEAF81F5E09933   //sin( -5)
-data8 0x3FD22785706B4AD9   //cos( -5)
-data8 0x3FE837B9DDDC1EAE   //sin( -4)
-data8 0xBFE4EAA606DB24C1   //cos( -4)
-data8 0xBFC210386DB6D55B   //sin( -3)
-data8 0xBFEFAE04BE85E5D2   //cos( -3)
-data8 0xBFED18F6EAD1B446   //sin( -2)
-data8 0xBFDAA22657537205   //cos( -2)
-data8 0xBFEAED548F090CEE   //sin( -1)
-data8 0x3FE14A280FB5068C   //cos( -1)
-data8 0x0000000000000000   //sin(  0)
-data8 0x3FF0000000000000   //cos(  0)
-data8 0x3FEAED548F090CEE   //sin(  1)
-data8 0x3FE14A280FB5068C   //cos(  1)
-data8 0x3FED18F6EAD1B446   //sin(  2)
-data8 0xBFDAA22657537205   //cos(  2)
-data8 0x3FC210386DB6D55B   //sin(  3)
-data8 0xBFEFAE04BE85E5D2   //cos(  3)
-data8 0xBFE837B9DDDC1EAE   //sin(  4)
-data8 0xBFE4EAA606DB24C1   //cos(  4)
-data8 0xBFEEAF81F5E09933   //sin(  5)
-data8 0x3FD22785706B4AD9   //cos(  5)
-data8 0xBFD1E1F18AB0A2C0   //sin(  6)
-data8 0x3FEEB9B7097822F5   //cos(  6)
-data8 0x3FE50608C26D0A08   //sin(  7)
-data8 0x3FE81FF79ED92017   //cos(  7)
-data8 0x3FEFA8D2A028CF7B   //sin(  8)
-data8 0xBFC29FBEBF632F94   //cos(  8)
-data8 0x3FDA6026360C2F91   //sin(  9)
-data8 0xBFED27FAA6A6196B   //cos(  9)
-data8 0xBFE1689EF5F34F52   //sin( 10)
-data8 0xBFEAD9AC890C6B1F   //cos( 10)
-data8 0xBFEFFFEB762E93EB   //sin( 11)
-data8 0x3F7220AE41EE2FDF   //cos( 11)
-data8 0xBFE12B9AF7D765A5   //sin( 12)
-data8 0x3FEB00DA046B65E3   //cos( 12)
-data8 0x3FDAE4044881C506   //sin( 13)
-data8 0x3FED09CDD5260CB7   //cos( 13)
-data8 0x3FEFB30E327C5E45   //sin( 14)
-data8 0x3FC1809AEC2CA0ED   //cos( 14)
-data8 0x3FE4CF2871CEC2E8   //sin( 15)
-data8 0xBFE84F5D069CA4F3   //cos( 15)
-data8 0xBFD26D02085F20F8   //sin( 16)
-data8 0xBFEEA5257E962F74   //cos( 16)
-data8 0xBFEEC3C4AC42882B   //sin( 17)
-data8 0xBFD19C46B07F58E7   //cos( 17)
-data8 0xBFE8081668131E26   //sin( 18)
-data8 0x3FE52150815D2470   //cos( 18)
-data8 0x3FC32F2D28F584CF   //sin( 19)
-data8 0x3FEFA377DE108258   //cos( 19)
-data8 0x3FED36D8F55D3CE0   //sin( 20)
-data8 0x3FDA1E043964A83F   //cos( 20)
-data8 0x3FEAC5E20BB0D7ED   //sin( 21)
-data8 0xBFE186FF83773759   //cos( 21)
-data8 0xBF8220A29F6EB9F4   //sin( 22)
-data8 0xBFEFFFADD8D4ACDA   //cos( 22)
-data8 0xBFEB143CD0247D02   //sin( 23)
-data8 0xBFE10CF7D591F272   //cos( 23)
-data8 0xBFECFA7F7919140F   //sin( 24)
-data8 0x3FDB25BFB50A609A   //cos( 24)
-data8 0xBFC0F0E6F31E809D   //sin( 25)
-data8 0x3FEFB7EEF59504FF   //cos( 25)
-data8 0x3FE866E0FAC32583   //sin( 26)
-data8 0x3FE4B3902691A9ED   //cos( 26)
-data8 0x3FEE9AA1B0E5BA30   //sin( 27)
-data8 0xBFD2B266F959DED5   //cos( 27)
-data8 0x3FD156853B4514D6   //sin( 28)
-data8 0xBFEECDAAD1582500   //cos( 28)
-data8 0xBFE53C7D20A6C9E7   //sin( 29)
-data8 0xBFE7F01658314E47   //cos( 29)
-data8 0xBFEF9DF47F1C903D   //sin( 30)
-data8 0x3FC3BE82F2505A52   //cos( 30)
-data8 0xBFD9DBC0B640FC81   //sin( 31)
-data8 0x3FED4591C3E12A20   //cos( 31)
-data8 0x3FE1A54991426566   //sin( 32)
-data8 0x3FEAB1F5305DE8E5   //cos( 32)
-ASM_SIZE_DIRECTIVE(sin_coeff_1_table)
-
-//////////////////////////////////////////
-
-
-.global sinf
-.global cosf
-#ifdef _LIBC
-.global __sinf
-.global __cosf
-#endif
-
-.text
-.proc cosf
-#ifdef _LIBC
-.proc __cosf
-#endif
-.align 32
-
-
-cosf:
-#ifdef _LIBC
-__cosf:
-#endif
-{ .mfi
-     alloc          r32                      = ar.pfs,1,7,0,0
-     fcvt.fx.s1     sin_Mx                   =    f8
-     cmp.ne    p6,p7     =    r0,r0        // p7 set if cos
-}
-{ .mfi
-     addl           SIN_AD_PQ_1              =    @ltoff(sin_coeff_1_table),gp
-     fnorm.s0 SIN_NORM_f8 = f8        // Sets denormal or invalid
-     mov sin_GR_sincos_flag = 0x0
-}
-;;
+sincosf_Inv_Pi_by_64            = f35
 
-{ .mfi
-     ld8       SIN_AD_PQ_1    =    [SIN_AD_PQ_1]
-     fclass.m.unc  p9,p0      =    f8, 0x07
-     cmp.ne p8,p0 = r0,r0
-}
-{ .mfb
-     nop.m 999
-     nop.f 999
-     br.sptk L(SINCOSF_COMMON)
-}
-;;
+sincosf_Pi_by_16_3              = f36
 
-.endp cosf
-ASM_SIZE_DIRECTIVE(cosf)
+sincosf_r_exact                 = f37
 
+sincosf_Sm                      = f38
+sincosf_Cm                      = f39
 
-.text
-.proc  sinf
-#ifdef _LIBC
-.proc  __sinf
-#endif
-.align 32
+sincosf_P1                      = f40
+sincosf_Q1                      = f41
+sincosf_P2                      = f42
+sincosf_Q2                      = f43
+sincosf_P3                      = f44
+sincosf_Q3                      = f45
+sincosf_P4                      = f46
+sincosf_Q4                      = f47
 
-sinf:
-#ifdef _LIBC
-__sinf:	
-#endif
-{ .mfi
-     alloc          r32                      = ar.pfs,1,7,0,0
-     fcvt.fx.s1     sin_Mx                   =    f8
-     cmp.eq    p6,p7     =    r0,r0        // p6 set if sin
-}
-{ .mfi
-     addl           SIN_AD_PQ_1              =    @ltoff(sin_coeff_1_table),gp
-     fnorm.s0 SIN_NORM_f8 = f8        // Sets denormal or invalid
-     mov sin_GR_sincos_flag = 0x1
-}
-;;
+sincosf_P_temp1                 = f48
+sincosf_P_temp2                 = f49
 
-{ .mfi
-     ld8       SIN_AD_PQ_1    =    [SIN_AD_PQ_1]
-     fclass.m.unc  p8,p0      =    f8, 0x07
-     cmp.ne p9,p0 = r0,r0
-}
-{ .mfb
-     nop.m 999
-     nop.f 999
-     br.sptk L(SINCOSF_COMMON)
-}
-;;
+sincosf_Q_temp1                 = f50
+sincosf_Q_temp2                 = f51
 
+sincosf_P                       = f52
+sincosf_Q                       = f53
 
-L(SINCOSF_COMMON):
+sincosf_srsq                    = f54
 
-// Here with p6 if sin, p7 if cos, p8 if sin(0), p9 if cos(0)
+sincosf_SIG_INV_PI_BY_16_2TO61  = f55
+sincosf_RSHF_2TO61              = f56
+sincosf_RSHF                    = f57
+sincosf_2TOM61                  = f58
+sincosf_NFLOAT                  = f59
+sincosf_W_2TO61_RSH             = f60
 
+fp_tmp                          = f61
 
-{ .mmf
-     ldfpd      sin_coeff_Q3, sin_coeff_Q4     = [SIN_AD_PQ_1], 16
-     nop.m 999
-     fclass.m.unc  p11,p0      =    f8, 0x23	// Test for x=inf
-}
-;;
+/////////////////////////////////////////////////////////////
 
-{ .mfb
-     ldfpd      sin_coeff_Q5, sin_coeff_Q6     = [SIN_AD_PQ_1], 16
-     fclass.m.unc  p10,p0      =    f8, 0xc3	// Test for x=nan
-(p8) br.ret.spnt b0                   // Exit for sin(0)
-}
-{ .mfb
-     nop.m 999
-(p9) fma.s      f8 = f1,f1,f0
-(p9) br.ret.spnt b0                   // Exit for cos(0)
-}
-;;
+sincosf_AD_1                    = r33
+sincosf_AD_2                    = r34
+sincosf_exp_limit               = r35
+sincosf_r_signexp               = r36
+sincosf_AD_beta_table           = r37
+sincosf_r_sincos                = r38
 
-{ .mmf
-     ldfpd      sin_coeff_P4, sin_coeff_P5     = [SIN_AD_PQ_1], 16
-     addl gr_tmp = -1,r0
-     fcvt.xf    sin_Mfloat                     =    sin_Mx
-}
-;;
+sincosf_r_exp                   = r39
+sincosf_r_17_ones               = r40
 
-{     .mfi
-     getf.sig  sin_GR_Mint    =    sin_Mx
-(p11) frcpa.s0      f8,p13      =    f0,f0  // qnan indef if x=inf
-     nop.i 999
-}
-{     .mfb
-     ldfpd      sin_coeff_P1, sin_coeff_P2     = [SIN_AD_PQ_1], 16
-     nop.f 999
-(p11) br.ret.spnt b0                   // Exit for x=inf
-}
-;;
+sincosf_GR_sig_inv_pi_by_16     = r14
+sincosf_GR_rshf_2to61           = r15
+sincosf_GR_rshf                 = r16
+sincosf_GR_exp_2tom61           = r17
+sincosf_GR_n                    = r18
+sincosf_GR_m                    = r19
+sincosf_GR_32m                  = r19
+sincosf_GR_all_ones             = r19
 
-{     .mfi
-     ldfpd      sin_coeff_Q1, sin_coeff_Q2     = [SIN_AD_PQ_1], 16
-     nop.f                      999
-     cmp.ge    p8,p9          = -33,sin_GR_Mint
-}
-{     .mfb
-     add       sin_GR_index   =    32,sin_GR_Mint
-(p10) fma.s      f8 = f8,f1,f0         // Force qnan if x=nan
-(p10) br.ret.spnt b0                   // Exit for x=nan
-}
-;;
+gr_tmp                          = r41
+GR_SAVE_PFS                     = r41
+GR_SAVE_B0                      = r42
+GR_SAVE_GP                      = r43
 
-{ .mmi
-     ldfd      sin_coeff_P3   = [SIN_AD_PQ_1], 16
-(p9) cmp.le    p8,p0        = 33, sin_GR_Mint 
-     shl       sin_GR_index   =    sin_GR_index,4
-}
-;;
+RODATA
+.align 16
+
+// Pi/16 parts
+LOCAL_OBJECT_START(double_sincosf_pi)
+   data8 0xC90FDAA22168C234, 0x00003FFC // pi/16 1st part
+   data8 0xC4C6628B80DC1CD1, 0x00003FBC // pi/16 2nd part
+LOCAL_OBJECT_END(double_sincosf_pi)
+
+// Coefficients for polynomials
+LOCAL_OBJECT_START(double_sincosf_pq_k4)
+   data8 0x3F810FABB668E9A2 // P2
+   data8 0x3FA552E3D6DE75C9 // Q2
+   data8 0xBFC555554447BC7F // P1
+   data8 0xBFDFFFFFC447610A // Q1
+LOCAL_OBJECT_END(double_sincosf_pq_k4)
+
+// Sincos table (S[m], C[m])
+LOCAL_OBJECT_START(double_sin_cos_beta_k4)
+    data8 0x0000000000000000 // sin ( 0 Pi / 16 )
+    data8 0x3FF0000000000000 // cos ( 0 Pi / 16 )
+//
+    data8 0x3FC8F8B83C69A60B // sin ( 1 Pi / 16 )
+    data8 0x3FEF6297CFF75CB0 // cos ( 1 Pi / 16 )
+//
+    data8 0x3FD87DE2A6AEA963 // sin ( 2 Pi / 16 )
+    data8 0x3FED906BCF328D46 // cos ( 2 Pi / 16 )
+//
+    data8 0x3FE1C73B39AE68C8 // sin ( 3 Pi / 16 )
+    data8 0x3FEA9B66290EA1A3 // cos ( 3 Pi / 16 )
+//
+    data8 0x3FE6A09E667F3BCD // sin ( 4 Pi / 16 )
+    data8 0x3FE6A09E667F3BCD // cos ( 4 Pi / 16 )
+//
+    data8 0x3FEA9B66290EA1A3 // sin ( 5 Pi / 16 )
+    data8 0x3FE1C73B39AE68C8 // cos ( 5 Pi / 16 )
+//
+    data8 0x3FED906BCF328D46 // sin ( 6 Pi / 16 )
+    data8 0x3FD87DE2A6AEA963 // cos ( 6 Pi / 16 )
+//
+    data8 0x3FEF6297CFF75CB0 // sin ( 7 Pi / 16 )
+    data8 0x3FC8F8B83C69A60B // cos ( 7 Pi / 16 )
+//
+    data8 0x3FF0000000000000 // sin ( 8 Pi / 16 )
+    data8 0x0000000000000000 // cos ( 8 Pi / 16 )
+//
+    data8 0x3FEF6297CFF75CB0 // sin ( 9 Pi / 16 )
+    data8 0xBFC8F8B83C69A60B // cos ( 9 Pi / 16 )
+//
+    data8 0x3FED906BCF328D46 // sin ( 10 Pi / 16 )
+    data8 0xBFD87DE2A6AEA963 // cos ( 10 Pi / 16 )
+//
+    data8 0x3FEA9B66290EA1A3 // sin ( 11 Pi / 16 )
+    data8 0xBFE1C73B39AE68C8 // cos ( 11 Pi / 16 )
+//
+    data8 0x3FE6A09E667F3BCD // sin ( 12 Pi / 16 )
+    data8 0xBFE6A09E667F3BCD // cos ( 12 Pi / 16 )
+//
+    data8 0x3FE1C73B39AE68C8 // sin ( 13 Pi / 16 )
+    data8 0xBFEA9B66290EA1A3 // cos ( 13 Pi / 16 )
+//
+    data8 0x3FD87DE2A6AEA963 // sin ( 14 Pi / 16 )
+    data8 0xBFED906BCF328D46 // cos ( 14 Pi / 16 )
+//
+    data8 0x3FC8F8B83C69A60B // sin ( 15 Pi / 16 )
+    data8 0xBFEF6297CFF75CB0 // cos ( 15 Pi / 16 )
+//
+    data8 0x0000000000000000 // sin ( 16 Pi / 16 )
+    data8 0xBFF0000000000000 // cos ( 16 Pi / 16 )
+//
+    data8 0xBFC8F8B83C69A60B // sin ( 17 Pi / 16 )
+    data8 0xBFEF6297CFF75CB0 // cos ( 17 Pi / 16 )
+//
+    data8 0xBFD87DE2A6AEA963 // sin ( 18 Pi / 16 )
+    data8 0xBFED906BCF328D46 // cos ( 18 Pi / 16 )
+//
+    data8 0xBFE1C73B39AE68C8 // sin ( 19 Pi / 16 )
+    data8 0xBFEA9B66290EA1A3 // cos ( 19 Pi / 16 )
+//
+    data8 0xBFE6A09E667F3BCD // sin ( 20 Pi / 16 )
+    data8 0xBFE6A09E667F3BCD // cos ( 20 Pi / 16 )
+//
+    data8 0xBFEA9B66290EA1A3 // sin ( 21 Pi / 16 )
+    data8 0xBFE1C73B39AE68C8 // cos ( 21 Pi / 16 )
+//
+    data8 0xBFED906BCF328D46 // sin ( 22 Pi / 16 )
+    data8 0xBFD87DE2A6AEA963 // cos ( 22 Pi / 16 )
+//
+    data8 0xBFEF6297CFF75CB0 // sin ( 23 Pi / 16 )
+    data8 0xBFC8F8B83C69A60B // cos ( 23 Pi / 16 )
+//
+    data8 0xBFF0000000000000 // sin ( 24 Pi / 16 )
+    data8 0x0000000000000000 // cos ( 24 Pi / 16 )
+//
+    data8 0xBFEF6297CFF75CB0 // sin ( 25 Pi / 16 )
+    data8 0x3FC8F8B83C69A60B // cos ( 25 Pi / 16 )
+//
+    data8 0xBFED906BCF328D46 // sin ( 26 Pi / 16 )
+    data8 0x3FD87DE2A6AEA963 // cos ( 26 Pi / 16 )
+//
+    data8 0xBFEA9B66290EA1A3 // sin ( 27 Pi / 16 )
+    data8 0x3FE1C73B39AE68C8 // cos ( 27 Pi / 16 )
+//
+    data8 0xBFE6A09E667F3BCD // sin ( 28 Pi / 16 )
+    data8 0x3FE6A09E667F3BCD // cos ( 28 Pi / 16 )
+//
+    data8 0xBFE1C73B39AE68C8 // sin ( 29 Pi / 16 )
+    data8 0x3FEA9B66290EA1A3 // cos ( 29 Pi / 16 )
+//
+    data8 0xBFD87DE2A6AEA963 // sin ( 30 Pi / 16 )
+    data8 0x3FED906BCF328D46 // cos ( 30 Pi / 16 )
+//
+    data8 0xBFC8F8B83C69A60B // sin ( 31 Pi / 16 )
+    data8 0x3FEF6297CFF75CB0 // cos ( 31 Pi / 16 )
+//
+    data8 0x0000000000000000 // sin ( 32 Pi / 16 )
+    data8 0x3FF0000000000000 // cos ( 32 Pi / 16 )
+LOCAL_OBJECT_END(double_sin_cos_beta_k4)
 
+.section .text
 
-{     .mfi
-     setf.sig fp_tmp = gr_tmp  // Create constant such that fmpy sets inexact
-     fnma.s1   sin_r     =    f1,sin_Mfloat,SIN_NORM_f8
-(p8) cmp.eq.unc p11,p12=sin_GR_sincos_flag,r0  // p11 if must call dbl cos
-                                               // p12 if must call dbl sin
-}
-{    .mbb
-     add       SIN_AD_PQ_2    =    sin_GR_index,SIN_AD_PQ_1
-(p11) br.cond.spnt COS_DOUBLE
-(p12) br.cond.spnt SIN_DOUBLE
-}
-;;
+////////////////////////////////////////////////////////
+// There are two entry points: sin and cos
+// If from sin, p8 is true
+// If from cos, p9 is true
 
-.pred.rel "mutex",p6,p7    //SIN_Sin_Flag, SIN_Cos_Flag
-{     .mmi
-(p6) ldfpd     sin_tbl_S,sin_tbl_C =    [SIN_AD_PQ_2]
-(p7) ldfpd     sin_tbl_C,sin_tbl_S =    [SIN_AD_PQ_2]
-               nop.i                           999
-}
-;;
+GLOBAL_IEEE754_ENTRY(sinf)
 
-{     .mfi
-     nop.m                 999
-(p6) fclass.m.unc p8,p0 = f8, 0x0b // If sin, note denormal input to set uflow
-     nop.i                 999
+{ .mlx
+      alloc         r32                 = ar.pfs,1,13,0,0
+      movl  sincosf_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A //signd of 16/pi
 }
-{     .mfi
-     nop.m                 999
-     fma.s1    sin_t     =    sin_r,sin_r,f0
-     nop.i                 999
-}
-;;
+{ .mlx
+      addl         sincosf_AD_1         = @ltoff(double_sincosf_pi), gp
+      movl  sincosf_GR_rshf_2to61       = 0x47b8000000000000 // 1.1 2^(63+63-2)
+};;
 
-{     .mfi
-     nop.m                 999
-     fma.s1    sin_rcube =    sin_t,sin_r,f0
-     nop.i                 999
-}
-{     .mfi
-     nop.m                 999
-     fma.s1    sin_tsq   =    sin_t,sin_t,f0
-     nop.i                 999
+{ .mfi
+      ld8           sincosf_AD_1        = [sincosf_AD_1]
+      fnorm.s1      sincosf_NORM_f8     = f8     // Normalize argument
+      cmp.eq        p8,p9               = r0, r0 // set p8 (clear p9) for sin
 }
-;;
+{ .mib
+      mov           sincosf_GR_exp_2tom61 = 0xffff-61 // exponent of scale 2^-61
+      mov           sincosf_r_sincos      = 0x0       // 0 for sin
+      br.cond.sptk  _SINCOSF_COMMON                 // go to common part
+};;
 
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_q3    =    sin_t,sin_coeff_Q4,sin_coeff_Q3
-     nop.i                      999
-}
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_q5    =    sin_t,sin_coeff_Q6,sin_coeff_Q5
-     nop.i                      999
-}
-;;
+GLOBAL_IEEE754_END(sinf)
 
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_p1    =    sin_t,sin_coeff_P5,sin_coeff_P4
-     nop.i                      999
-}
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_p2    =    sin_t,sin_coeff_P2,sin_coeff_P1
-     nop.i                      999
-}
-;;
+GLOBAL_IEEE754_ENTRY(cosf)
 
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_q1    =    sin_t,sin_coeff_Q2,sin_coeff_Q1
-     nop.i                      999
-}
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_S_t   =    sin_t,sin_tbl_S,f0
-     nop.i                      999
+{ .mlx
+      alloc         r32                 = ar.pfs,1,13,0,0
+      movl  sincosf_GR_sig_inv_pi_by_16 = 0xA2F9836E4E44152A //signd of 16/pi
 }
-;;
+{ .mlx
+      addl          sincosf_AD_1        = @ltoff(double_sincosf_pi), gp
+      movl  sincosf_GR_rshf_2to61       = 0x47b8000000000000 // 1.1 2^(63+63-2)
+};;
 
-{     .mfi
-     nop.m                 999
-(p8) fmpy.s.s0 fp_tmp2 = f8,f8  // Dummy mult to set underflow if sin(denormal)
-     nop.i                 999
-}
-{     .mfi
-     nop.m                 999
-     fma.s1    sin_r7    =    sin_rcube,sin_tsq,f0
-     nop.i                 999
+{ .mfi
+      ld8           sincosf_AD_1        = [sincosf_AD_1]
+      fnorm.s1      sincosf_NORM_f8     = f8        // Normalize argument
+      cmp.eq        p9,p8               = r0, r0    // set p9 (clear p8) for cos
 }
-;;
+{ .mib
+      mov           sincosf_GR_exp_2tom61 = 0xffff-61 // exponent of scale 2^-61
+      mov           sincosf_r_sincos      = 0x8       // 8 for cos
+      nop.b         999
+};;
+
+////////////////////////////////////////////////////////
+// All entry points end up here.
+// If from sin, sincosf_r_sincos is 0 and p8 is true
+// If from cos, sincosf_r_sincos is 8 = 2^(k-1) and p9 is true
+// We add sincosf_r_sincos to N
+
+///////////// Common sin and cos part //////////////////
+_SINCOSF_COMMON:
+
+//  Form two constants we need
+//  16/pi * 2^-2 * 2^63, scaled by 2^61 since we just loaded the significand
+//  1.1000...000 * 2^(63+63-2) to right shift int(W) into the low significand
+//  fcmp used to set denormal, and invalid on snans
+{ .mfi
+      setf.sig      sincosf_SIG_INV_PI_BY_16_2TO61 = sincosf_GR_sig_inv_pi_by_16
+      fclass.m      p6,p0                          = f8, 0xe7 // if x=0,inf,nan
+      mov           sincosf_exp_limit              = 0x10017
+}
+{ .mlx
+      setf.d        sincosf_RSHF_2TO61  = sincosf_GR_rshf_2to61
+      movl          sincosf_GR_rshf     = 0x43e8000000000000 // 1.1000 2^63
+};;                                                          // Right shift
+
+//  Form another constant
+//  2^-61 for scaling Nfloat
+//  0x10017 is register_bias + 24.
+//  So if f8 >= 2^24, go to large argument routines
+{ .mmi
+      getf.exp      sincosf_r_signexp   = f8
+      setf.exp      sincosf_2TOM61      = sincosf_GR_exp_2tom61
+      addl          gr_tmp              = -1,r0 // For "inexect" constant create
+};;
+
+// Load the two pieces of pi/16
+// Form another constant
+//  1.1000...000 * 2^63, the right shift constant
+{ .mmb
+      ldfe          sincosf_Pi_by_16_1  = [sincosf_AD_1],16
+      setf.d        sincosf_RSHF        = sincosf_GR_rshf
+(p6)  br.cond.spnt  _SINCOSF_SPECIAL_ARGS
+};;
 
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_q3456 =    sin_tsq,sin_poly_q5,sin_poly_q3
-     nop.i                      999
-}
-;;
+// Getting argument's exp for "large arguments" filtering
+{ .mmi
+      ldfe          sincosf_Pi_by_16_2  = [sincosf_AD_1],16
+      setf.sig      fp_tmp              = gr_tmp // constant for inexact set
+      nop.i         999
+};;
 
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_p3    =    sin_t,sin_poly_p1,sin_coeff_P3
-     nop.i                      999
-}
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_p4    =    sin_rcube,sin_poly_p2,sin_r
-     nop.i                      999
-}
-;;
+// Polynomial coefficients (Q2, Q1, P2, P1) loading
+{ .mmi
+      ldfpd         sincosf_P2,sincosf_Q2 = [sincosf_AD_1],16
+      nop.m         999 
+      nop.i         999 
+};;
 
-{     .mfi
-     nop.m                           999
-     fma.s1    sin_tbl_S_tcube     =    sin_S_t,sin_tsq,f0
-     nop.i                           999
-}
-{     .mfi
-     nop.m                      999
-     fma.s1    sin_poly_q12   =    sin_S_t,sin_poly_q1,sin_tbl_S
-     nop.i                      999
-}
-;;
+// Select exponent (17 lsb)
+{ .mmi
+      ldfpd         sincosf_P1,sincosf_Q1 = [sincosf_AD_1],16
+      nop.m         999 
+      dep.z         sincosf_r_exp         = sincosf_r_signexp, 0, 17
+};;
 
-{     .mfi
-     nop.m                 999
-     fma.d.s1  sin_of_r  =    sin_r7,sin_poly_p3,sin_poly_p4
-     nop.i                 999
-}
-;;
+// p10 is true if we must call routines to handle larger arguments
+// p10 is true if f8 exp is >= 0x10017 (2^24)
+{ .mfb
+      cmp.ge        p10,p0              = sincosf_r_exp,sincosf_exp_limit
+      nop.f         999
+(p10) br.cond.spnt  _SINCOSF_LARGE_ARGS // Go to "large args" routine
+};;
+
+// sincosf_W          = x * sincosf_Inv_Pi_by_16
+// Multiply x by scaled 16/pi and add large const to shift integer part of W to
+//   rightmost bits of significand
+{ .mfi
+      nop.m         999 
+      fma.s1 sincosf_W_2TO61_RSH = sincosf_NORM_f8, sincosf_SIG_INV_PI_BY_16_2TO61, sincosf_RSHF_2TO61
+      nop.i         999 
+};;
 
-{     .mfi
-     nop.m                           999
-     fma.d.s1  sin_tbl_S_cos_of_r  =    sin_tbl_S_tcube,sin_poly_q3456,sin_poly_q12
-     nop.i                           999
-}
-{     .mfi
-     nop.m                           999
-     fmpy.s0   fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
-     nop.i                           999
-}
-;;
+// sincosf_NFLOAT = Round_Int_Nearest(sincosf_W)
+// This is done by scaling back by 2^-61 and subtracting the shift constant
+{ .mfi
+      nop.m         999
+      fms.s1 sincosf_NFLOAT = sincosf_W_2TO61_RSH,sincosf_2TOM61,sincosf_RSHF
+      nop.i         999 
+};;
 
+// get N = (int)sincosf_int_Nfloat
+{ .mfi
+      getf.sig      sincosf_GR_n        = sincosf_W_2TO61_RSH // integer N value
+      nop.f         999
+      nop.i         999 
+};;
 
-.pred.rel "mutex",p6,p7    //SIN_Sin_Flag, SIN_Cos_Flag
-{     .mfi
-               nop.m            999
-//(SIN_Sin_Flag) fma.s     f8   =    sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
-(p6) fma.s     f8   =    sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
-               nop.i            999
-}
-{     .mfb
-               nop.m            999
-//(SIN_Cos_Flag) fnma.s    f8   =    sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
-(p7) fnma.s    f8   =    sin_tbl_C,sin_of_r,sin_tbl_S_cos_of_r
-               br.ret.sptk     b0
-}
+// Add 2^(k-1) (which is in sincosf_r_sincos=8) to N
+// sincosf_r          = -sincosf_Nfloat * sincosf_Pi_by_16_1 + x
+{ .mfi
+      add           sincosf_GR_n        = sincosf_GR_n, sincosf_r_sincos
+      fnma.s1 sincosf_r = sincosf_NFLOAT, sincosf_Pi_by_16_1, sincosf_NORM_f8
+      nop.i         999 
+};;
 
-.endp sinf
-ASM_SIZE_DIRECTIVE(sinf)
+// Get M (least k+1 bits of N)
+{ .mmi
+      and           sincosf_GR_m        = 0x1f,sincosf_GR_n // Put mask 0x1F  - 
+      nop.m         999                                     // - select k+1 bits
+      nop.i         999
+};;
 
+// Add 16*M to address of sin_cos_beta table
+{ .mfi
+      shladd        sincosf_AD_2        = sincosf_GR_32m, 4, sincosf_AD_1
+(p8)  fclass.m.unc  p10,p0              = f8,0x0b  // If sin denormal input -
+      nop.i         999 
+};;
 
-.proc SIN_DOUBLE 
-SIN_DOUBLE:
-.prologue
+// Load Sin and Cos table value using obtained index m  (sincosf_AD_2)
 { .mfi
-        nop.m 0
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs
-}
-;;
+      ldfd          sincosf_Sm          = [sincosf_AD_2],8 // Sin value S[m]
+(p9)  fclass.m.unc  p11,p0              = f8,0x0b  // If cos denormal input -
+      nop.i         999                            // - set denormal
+};;
 
+// sincosf_r          = sincosf_r -sincosf_Nfloat * sincosf_Pi_by_16_2
 { .mfi
-        mov GR_SAVE_GP=gp
-        nop.f 0
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0
+      ldfd          sincosf_Cm          = [sincosf_AD_2] // Cos table value C[m]
+      fnma.s1  sincosf_r_exact = sincosf_NFLOAT, sincosf_Pi_by_16_2, sincosf_r
+      nop.i         999
 }
+// get rsq = r*r
+{ .mfi
+      nop.m         999
+      fma.s1        sincosf_rsq         = sincosf_r, sincosf_r,  f0 // r^2 = r*r
+      nop.i         999
+};;
 
-.body
-{ .mmb
-       nop.m 999
-       nop.m 999
-       br.call.sptk.many   b0=sin 
+{ .mfi
+      nop.m         999
+      fmpy.s0       fp_tmp              = fp_tmp, fp_tmp // forces inexact flag
+      nop.i         999                                
+};;
+
+// Polynomials calculation 
+// Q = Q2*r^2 + Q1
+// P = P2*r^2 + P1
+{ .mfi
+      nop.m         999
+      fma.s1        sincosf_Q           = sincosf_rsq, sincosf_Q2, sincosf_Q1
+      nop.i         999
 }
-;;
+{ .mfi
+      nop.m         999
+      fma.s1        sincosf_P           = sincosf_rsq, sincosf_P2, sincosf_P1
+      nop.i         999 
+};;
 
+// get rcube and S[m]*r^2
 { .mfi
-       mov gp        = GR_SAVE_GP
-       nop.f 999
-       mov b0        = GR_SAVE_B0
+      nop.m         999
+      fmpy.s1       sincosf_srsq        = sincosf_Sm,sincosf_rsq // r^2*S[m]
+      nop.i         999
 }
-;;
-
 { .mfi
-      nop.m 999
-      fma.s f8 = f8,f1,f0
-(p0)  mov ar.pfs    = GR_SAVE_PFS
+      nop.m         999
+      fmpy.s1       sincosf_rcub        = sincosf_r_exact, sincosf_rsq
+      nop.i         999 
+};;
+
+// Get final P and Q
+// Q = Q*S[m]*r^2 + S[m]
+// P = P*r^3 + r
+{ .mfi
+      nop.m         999
+      fma.s1        sincosf_Q           = sincosf_srsq,sincosf_Q, sincosf_Sm
+      nop.i         999
 }
-{ .mib
-      nop.m 999
-      nop.i 999
-(p0)  br.ret.sptk     b0 
+{ .mfi
+      nop.m         999
+      fma.s1        sincosf_P           = sincosf_rcub,sincosf_P,sincosf_r_exact
+      nop.i         999 
+};;
+
+// If sinf(denormal) - force underflow to be set
+.pred.rel "mutex",p10,p11
+{ .mfi
+      nop.m         999
+(p10) fmpy.s.s0     fp_tmp              = f8,f8 // forces underflow flag
+      nop.i         999                         // for denormal sine args
 }
-;;
+// If cosf(denormal) - force denormal to be set
+{ .mfi
+      nop.m         999
+(p11) fma.s.s0     fp_tmp              = f8, f1, f8 // forces denormal flag
+      nop.i         999                              // for denormal cosine args
+};;
 
-.endp  SIN_DOUBLE
-ASM_SIZE_DIRECTIVE(SIN_DOUBLE)
 
+// Final calculation
+// result = C[m]*P + Q
+{ .mfb
+      nop.m         999
+      fma.s.s0      f8                  = sincosf_Cm, sincosf_P, sincosf_Q
+      br.ret.sptk   b0 // Exit for common path
+};;
+
+////////// x = 0/Inf/NaN path //////////////////
+_SINCOSF_SPECIAL_ARGS:
+.pred.rel "mutex",p8,p9
+// sinf(+/-0) = +/-0
+// sinf(Inf)  = NaN
+// sinf(NaN)  = NaN
+{ .mfi
+      nop.m         999
+(p8)  fma.s.s0      f8                  = f8, f0, f0 // sinf(+/-0,NaN,Inf)
+      nop.i         999
+}
+// cosf(+/-0) = 1.0
+// cosf(Inf)  = NaN
+// cosf(NaN)  = NaN
+{ .mfb
+      nop.m         999
+(p9)  fma.s.s0      f8                  = f8, f0, f1 // cosf(+/-0,NaN,Inf)
+      br.ret.sptk   b0 // Exit for x = 0/Inf/NaN path
+};;
+
+GLOBAL_IEEE754_END(cosf)
 
-.proc COS_DOUBLE 
-COS_DOUBLE:
+//////////// x >= 2^24 - large arguments routine call ////////////
+LOCAL_LIBM_ENTRY(__libm_callout_sincosf)
+_SINCOSF_LARGE_ARGS:
 .prologue
 { .mfi
-        nop.m 0
-        nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs
+      mov           sincosf_GR_all_ones = -1 // 0xffffffff
+      nop.f         999
+.save ar.pfs,GR_SAVE_PFS
+      mov           GR_SAVE_PFS         = ar.pfs
 }
 ;;
 
 { .mfi
-        mov GR_SAVE_GP=gp
-        nop.f 0
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0
+      mov           GR_SAVE_GP          = gp
+      nop.f         999
+.save b0, GR_SAVE_B0
+      mov           GR_SAVE_B0          = b0
 }
-
 .body
-{ .mmb
-       nop.m 999
-       nop.m 999
-       br.call.sptk.many   b0=cos 
-}
-;;
 
-{ .mfi
-       mov gp        = GR_SAVE_GP
-       nop.f 999
-       mov b0        = GR_SAVE_B0
-}
-;;
+{ .mbb
+      setf.sig      sincosf_save_tmp    = sincosf_GR_all_ones  // inexact set
+      nop.b         999
+(p8)  br.call.sptk.many b0              = __libm_sin_large# // sinf(large_X)
+};;
+
+{ .mbb
+      cmp.ne        p9,p0               = sincosf_r_sincos, r0 // set p9 if cos
+      nop.b         999
+(p9)  br.call.sptk.many b0              = __libm_cos_large# // cosf(large_X)
+};;
 
 { .mfi
-      nop.m 999
-      fma.s f8 = f8,f1,f0
-(p0)  mov ar.pfs    = GR_SAVE_PFS
-}
-{ .mib
-      nop.m 999
-      nop.i 999
-(p0)  br.ret.sptk     b0 
+      mov           gp                  = GR_SAVE_GP
+      fma.s.s0      f8                  = f8, f1, f0 // Round result to single
+      mov           b0                  = GR_SAVE_B0
 }
-;;
-
-.endp  COS_DOUBLE
-ASM_SIZE_DIRECTIVE(COS_DOUBLE)
+{ .mfi // force inexact set
+      nop.m         999
+      fmpy.s0       sincosf_save_tmp    = sincosf_save_tmp, sincosf_save_tmp 
+      nop.i         999                                               
+};;
 
+{ .mib
+      nop.m         999
+      mov           ar.pfs              = GR_SAVE_PFS
+      br.ret.sptk   b0 // Exit for large arguments routine call
+};;
+LOCAL_LIBM_END(__libm_callout_sincosf)
 
+.type    __libm_sin_large#, @function
+.global  __libm_sin_large#
+.type    __libm_cos_large#, @function
+.global  __libm_cos_large#
 
-.type sin,@function
-.global sin 
-.type cos,@function
-.global cos 
diff --git a/sysdeps/ia64/fpu/s_cosl.S b/sysdeps/ia64/fpu/s_cosl.S
index 2755580c0d..8d71e50c1a 100644
--- a/sysdeps/ia64/fpu/s_cosl.S
+++ b/sysdeps/ia64/fpu/s_cosl.S
@@ -1,10 +1,10 @@
 .file "sincosl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2004, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,76 +20,82 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 //
-// History: 
-// 2/02/2000 (hand-optimized)
-// 4/04/00  Unwind support added
+// History:
+// 02/02/00 (hand-optimized)
+// 04/04/00 Unwind support added
+// 07/30/01 Improved speed on all paths
+// 08/20/01 Fixed bundling typo
+// 05/13/02 Changed interface to __libm_pi_by_2_reduce
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+// 10/13/03 Corrected final .endp name to match .proc
+// 10/26/04 Avoided using r14-31 as scratch so not clobbered by dynamic loader
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Function:   Combined sinl(x) and cosl(x), where
 //
 //             sinl(x) = sine(x), for double-extended precision x values
 //             cosl(x) = cosine(x), for double-extended precision x values
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
-//    Floating-Point Registers: f8 (Input and Return Value) 
+//    Floating-Point Registers: f8 (Input and Return Value)
 //                              f32-f99
 //
 //    General Purpose Registers:
-//      r32-r43 
-//      r44-r45 (Used to pass arguments to pi_by_2 reduce routine)
+//      r32-r58
 //
 //    Predicate Registers:      p6-p13
 //
-// *********************************************************************
+//*********************************************************************
 //
 //  IEEE Special Conditions:
 //
 //    Denormal  fault raised on denormal inputs
 //    Overflow exceptions do not occur
-//    Underflow exceptions raised when appropriate for sin 
+//    Underflow exceptions raised when appropriate for sin
 //    (No specialized error handling for this routine)
 //    Inexact raised when appropriate by algorithm
 //
 //    sinl(SNaN) = QNaN
 //    sinl(QNaN) = QNaN
-//    sinl(inf) = QNaN 
+//    sinl(inf) = QNaN
 //    sinl(+/-0) = +/-0
-//    cosl(inf) = QNaN 
+//    cosl(inf) = QNaN
 //    cosl(SNaN) = QNaN
 //    cosl(QNaN) = QNaN
 //    cosl(0) = 1
-// 
-// *********************************************************************
+//
+//*********************************************************************
 //
 //  Mathematical Description
 //  ========================
 //
-//  The computation of FSIN and FCOS is best handled in one piece of 
-//  code. The main reason is that given any argument Arg, computation 
-//  of trigonometric functions first calculate N and an approximation 
+//  The computation of FSIN and FCOS is best handled in one piece of
+//  code. The main reason is that given any argument Arg, computation
+//  of trigonometric functions first calculate N and an approximation
 //  to alpha where
 //
 //  Arg = N pi/2 + alpha, |alpha| <= pi/4.
@@ -98,62 +104,62 @@
 //
 //  cosl( Arg ) = sinl( (N+1) pi/2 + alpha ),
 //
-//  therefore, the code for computing sine will produce cosine as long 
-//  as 1 is added to N immediately after the argument reduction 
+//  therefore, the code for computing sine will produce cosine as long
+//  as 1 is added to N immediately after the argument reduction
 //  process.
 //
 //  Let M = N if sine
-//      N+1 if cosine.  
+//      N+1 if cosine.
 //
 //  Now, given
 //
 //  Arg = M pi/2  + alpha, |alpha| <= pi/4,
 //
-//  let I = M mod 4, or I be the two lsb of M when M is represented 
+//  let I = M mod 4, or I be the two lsb of M when M is represented
 //  as 2's complement. I = [i_0 i_1]. Then
 //
-//  sinl( Arg ) = (-1)^i_0  sinl( alpha )	if i_1 = 0,
+//  sinl( Arg ) = (-1)^i_0  sinl( alpha )        if i_1 = 0,
 //             = (-1)^i_0  cosl( alpha )     if i_1 = 1.
 //
 //  For example:
-//       if M = -1, I = 11   
+//       if M = -1, I = 11
 //         sin ((-pi/2 + alpha) = (-1) cos (alpha)
-//       if M = 0, I = 00   
+//       if M = 0, I = 00
 //         sin (alpha) = sin (alpha)
-//       if M = 1, I = 01   
+//       if M = 1, I = 01
 //         sin (pi/2 + alpha) = cos (alpha)
-//       if M = 2, I = 10   
+//       if M = 2, I = 10
 //         sin (pi + alpha) = (-1) sin (alpha)
-//       if M = 3, I = 11   
+//       if M = 3, I = 11
 //         sin ((3/2)pi + alpha) = (-1) cos (alpha)
 //
-//  The value of alpha is obtained by argument reduction and 
+//  The value of alpha is obtained by argument reduction and
 //  represented by two working precision numbers r and c where
 //
 //  alpha =  r  +  c     accurately.
 //
 //  The reduction method is described in a previous write up.
-//  The argument reduction scheme identifies 4 cases. For Cases 2 
-//  and 4, because |alpha| is small, sinl(r+c) and cosl(r+c) can be 
-//  computed very easily by 2 or 3 terms of the Taylor series 
+//  The argument reduction scheme identifies 4 cases. For Cases 2
+//  and 4, because |alpha| is small, sinl(r+c) and cosl(r+c) can be
+//  computed very easily by 2 or 3 terms of the Taylor series
 //  expansion as follows:
 //
 //  Case 2:
 //  -------
 //
-//  sinl(r + c) = r + c - r^3/6	accurately
-//  cosl(r + c) = 1 - 2^(-67)	accurately
+//  sinl(r + c) = r + c - r^3/6        accurately
+//  cosl(r + c) = 1 - 2^(-67)        accurately
 //
 //  Case 4:
 //  -------
 //
-//  sinl(r + c) = r + c - r^3/6 + r^5/120	accurately
-//  cosl(r + c) = 1 - r^2/2 + r^4/24		accurately
+//  sinl(r + c) = r + c - r^3/6 + r^5/120        accurately
+//  cosl(r + c) = 1 - r^2/2 + r^4/24                accurately
 //
-//  The only cases left are Cases 1 and 3 of the argument reduction 
-//  procedure. These two cases will be merged since after the 
-//  argument is reduced in either cases, we have the reduced argument 
-//  represented as r + c and that the magnitude |r + c| is not small 
+//  The only cases left are Cases 1 and 3 of the argument reduction
+//  procedure. These two cases will be merged since after the
+//  argument is reduced in either cases, we have the reduced argument
+//  represented as r + c and that the magnitude |r + c| is not small
 //  enough to allow the usage of a very short approximation.
 //
 //  The required calculation is either
@@ -163,32 +169,32 @@
 //
 //  Specifically,
 //
-//	sinl(r + c) = sinl(r) + c sin'(r) + O(c^2)
-//		   = sinl(r) + c cos (r) + O(c^2)
-//		   = sinl(r) + c(1 - r^2/2)  accurately.
+//        sinl(r + c) = sinl(r) + c sin'(r) + O(c^2)
+//                   = sinl(r) + c cos (r) + O(c^2)
+//                   = sinl(r) + c(1 - r^2/2)  accurately.
 //  Similarly,
 //
-//	cosl(r + c) = cosl(r) - c sinl(r) + O(c^2)
-//		   = cosl(r) - c(r - r^3/6)  accurately.
+//        cosl(r + c) = cosl(r) - c sinl(r) + O(c^2)
+//                   = cosl(r) - c(r - r^3/6)  accurately.
 //
-//  We therefore concentrate on accurately calculating sinl(r) and 
+//  We therefore concentrate on accurately calculating sinl(r) and
 //  cosl(r) for a working-precision number r, |r| <= pi/4 to within
 //  0.1% or so.
 //
-//  The greatest challenge of this task is that the second terms of 
+//  The greatest challenge of this task is that the second terms of
 //  the Taylor series
-//	
-//	r - r^3/3! + r^r/5! - ...
+//
+//        r - r^3/3! + r^r/5! - ...
 //
 //  and
 //
-//	1 - r^2/2! + r^4/4! - ...
+//        1 - r^2/2! + r^4/4! - ...
 //
-//  are not very small when |r| is close to pi/4 and the rounding 
-//  errors will be a concern if simple polynomial accumulation is 
-//  used. When |r| < 2^-3, however, the second terms will be small 
-//  enough (6 bits or so of right shift) that a normal Horner 
-//  recurrence suffices. Hence there are two cases that we consider 
+//  are not very small when |r| is close to pi/4 and the rounding
+//  errors will be a concern if simple polynomial accumulation is
+//  used. When |r| < 2^-3, however, the second terms will be small
+//  enough (6 bits or so of right shift) that a normal Horner
+//  recurrence suffices. Hence there are two cases that we consider
 //  in the accurate computation of sinl(r) and cosl(r), |r| <= pi/4.
 //
 //  Case small_r: |r| < 2^(-3)
@@ -197,88 +203,88 @@
 //  Since Arg = M pi/4 + r + c accurately, and M mod 4 is [i_0 i_1],
 //  we have
 //
-//	sinl(Arg) = (-1)^i_0 * sinl(r + c)	if i_1 = 0
-//		 = (-1)^i_0 * cosl(r + c) 	if i_1 = 1
+//        sinl(Arg) = (-1)^i_0 * sinl(r + c)        if i_1 = 0
+//                 = (-1)^i_0 * cosl(r + c)         if i_1 = 1
 //
 //  can be accurately approximated by
 //
-//  sinl(Arg) = (-1)^i_0 * [sinl(r) + c]	if i_1 = 0
+//  sinl(Arg) = (-1)^i_0 * [sinl(r) + c]        if i_1 = 0
 //           = (-1)^i_0 * [cosl(r) - c*r] if i_1 = 1
 //
-//  because |r| is small and thus the second terms in the correction 
+//  because |r| is small and thus the second terms in the correction
 //  are unneccessary.
 //
-//  Finally, sinl(r) and cosl(r) are approximated by polynomials of 
+//  Finally, sinl(r) and cosl(r) are approximated by polynomials of
 //  moderate lengths.
 //
 //  sinl(r) =  r + S_1 r^3 + S_2 r^5 + ... + S_5 r^11
 //  cosl(r) =  1 + C_1 r^2 + C_2 r^4 + ... + C_5 r^10
 //
-//  We can make use of predicates to selectively calculate 
-//  sinl(r) or cosl(r) based on i_1. 
+//  We can make use of predicates to selectively calculate
+//  sinl(r) or cosl(r) based on i_1.
 //
 //  Case normal_r: 2^(-3) <= |r| <= pi/4
 //  ------------------------------------
 //
 //  This case is more likely than the previous one if one considers
 //  r to be uniformly distributed in [-pi/4 pi/4]. Again,
-// 
-//  sinl(Arg) = (-1)^i_0 * sinl(r + c)	if i_1 = 0
-//           = (-1)^i_0 * cosl(r + c) 	if i_1 = 1.
 //
-//  Because |r| is now larger, we need one extra term in the 
+//  sinl(Arg) = (-1)^i_0 * sinl(r + c)        if i_1 = 0
+//           = (-1)^i_0 * cosl(r + c)         if i_1 = 1.
+//
+//  Because |r| is now larger, we need one extra term in the
 //  correction. sinl(Arg) can be accurately approximated by
 //
 //  sinl(Arg) = (-1)^i_0 * [sinl(r) + c(1-r^2/2)]      if i_1 = 0
 //           = (-1)^i_0 * [cosl(r) - c*r*(1 - r^2/6)]    i_1 = 1.
 //
-//  Finally, sinl(r) and cosl(r) are approximated by polynomials of 
+//  Finally, sinl(r) and cosl(r) are approximated by polynomials of
 //  moderate lengths.
 //
-//	sinl(r) =  r + PP_1_hi r^3 + PP_1_lo r^3 + 
-//	              PP_2 r^5 + ... + PP_8 r^17
+//        sinl(r) =  r + PP_1_hi r^3 + PP_1_lo r^3 +
+//                      PP_2 r^5 + ... + PP_8 r^17
 //
-//	cosl(r) =  1 + QQ_1 r^2 + QQ_2 r^4 + ... + QQ_8 r^16
+//        cosl(r) =  1 + QQ_1 r^2 + QQ_2 r^4 + ... + QQ_8 r^16
 //
-//  where PP_1_hi is only about 16 bits long and QQ_1 is -1/2. 
-//  The crux in accurate computation is to calculate 
+//  where PP_1_hi is only about 16 bits long and QQ_1 is -1/2.
+//  The crux in accurate computation is to calculate
 //
 //  r + PP_1_hi r^3   or  1 + QQ_1 r^2
 //
-//  accurately as two pieces: U_hi and U_lo. The way to achieve this 
-//  is to obtain r_hi as a 10 sig. bit number that approximates r to 
+//  accurately as two pieces: U_hi and U_lo. The way to achieve this
+//  is to obtain r_hi as a 10 sig. bit number that approximates r to
 //  roughly 8 bits or so of accuracy. (One convenient way is
 //
 //  r_hi := frcpa( frcpa( r ) ).)
 //
 //  This way,
 //
-//	r + PP_1_hi r^3 =  r + PP_1_hi r_hi^3 +
-//	                        PP_1_hi (r^3 - r_hi^3)
-//		        =  [r + PP_1_hi r_hi^3]  +  
-//			   [PP_1_hi (r - r_hi) 
-//			      (r^2 + r_hi r + r_hi^2) ]
-//		        =  U_hi  +  U_lo
+//        r + PP_1_hi r^3 =  r + PP_1_hi r_hi^3 +
+//                                PP_1_hi (r^3 - r_hi^3)
+//                        =  [r + PP_1_hi r_hi^3]  +
+//                           [PP_1_hi (r - r_hi)
+//                              (r^2 + r_hi r + r_hi^2) ]
+//                        =  U_hi  +  U_lo
 //
 //  Since r_hi is only 10 bit long and PP_1_hi is only 16 bit long,
-//  PP_1_hi * r_hi^3 is only at most 46 bit long and thus computed 
-//  exactly. Furthermore, r and PP_1_hi r_hi^3 are of opposite sign 
-//  and that there is no more than 8 bit shift off between r and 
-//  PP_1_hi * r_hi^3. Hence the sum, U_hi, is representable and thus 
-//  calculated without any error. Finally, the fact that 
+//  PP_1_hi * r_hi^3 is only at most 46 bit long and thus computed
+//  exactly. Furthermore, r and PP_1_hi r_hi^3 are of opposite sign
+//  and that there is no more than 8 bit shift off between r and
+//  PP_1_hi * r_hi^3. Hence the sum, U_hi, is representable and thus
+//  calculated without any error. Finally, the fact that
 //
-//	|U_lo| <= 2^(-8) |U_hi|
+//        |U_lo| <= 2^(-8) |U_hi|
 //
-//  says that U_hi + U_lo is approximating r + PP_1_hi r^3 to roughly 
+//  says that U_hi + U_lo is approximating r + PP_1_hi r^3 to roughly
 //  8 extra bits of accuracy.
 //
 //  Similarly,
 //
-//	1 + QQ_1 r^2  =  [1 + QQ_1 r_hi^2]  +
-//	                    [QQ_1 (r - r_hi)(r + r_hi)]
-//		      =  U_hi  +  U_lo.
-//		      
-//  Summarizing, we calculate r_hi = frcpa( frcpa( r ) ). 
+//        1 + QQ_1 r^2  =  [1 + QQ_1 r_hi^2]  +
+//                            [QQ_1 (r - r_hi)(r + r_hi)]
+//                      =  U_hi  +  U_lo.
+//
+//  Summarizing, we calculate r_hi = frcpa( frcpa( r ) ).
 //
 //  If i_1 = 0, then
 //
@@ -297,35 +303,35 @@
 //  End
 //
 //  Finally,
-// 
-//	V := poly + ( U_lo + correction )
+//
+//        V := poly + ( U_lo + correction )
 //
 //                 /    U_hi  +  V         if i_0 = 0
-//	result := |
+//        result := |
 //                 \  (-U_hi) -  V         if i_0 = 1
 //
-//  It is important that in the last step, negation of U_hi is 
-//  performed prior to the subtraction which is to be performed in 
-//  the user-set rounding mode. 
+//  It is important that in the last step, negation of U_hi is
+//  performed prior to the subtraction which is to be performed in
+//  the user-set rounding mode.
 //
 //
 //  Algorithmic Description
 //  =======================
 //
-//  The argument reduction algorithm is tightly integrated into FSIN 
-//  and FCOS which share the same code. The following is complete and 
-//  self-contained. The argument reduction description given 
+//  The argument reduction algorithm is tightly integrated into FSIN
+//  and FCOS which share the same code. The following is complete and
+//  self-contained. The argument reduction description given
 //  previously is repeated below.
 //
 //
-//  Step 0. Initialization. 
+//  Step 0. Initialization.
 //
 //   If FSIN is invoked, set N_inc := 0; else if FCOS is invoked,
 //   set N_inc := 1.
 //
 //  Step 1. Check for exceptional and special cases.
 //
-//   * If Arg is +-0, +-inf, NaN, NaT, go to Step 10 for special 
+//   * If Arg is +-0, +-inf, NaN, NaT, go to Step 10 for special
 //     handling.
 //   * If |Arg| < 2^24, go to Step 2 for reduction of moderate
 //     arguments. This is the most likely case.
@@ -335,18 +341,18 @@
 //
 //  Step 2. Reduction of moderate arguments.
 //
-//  If |Arg| < pi/4 	...quick branch
-//     N_fix := N_inc	(integer)
+//  If |Arg| < pi/4         ...quick branch
+//     N_fix := N_inc        (integer)
 //     r     := Arg
 //     c     := 0.0
 //     Branch to Step 4, Case_1_complete
-//  Else 		...cf. argument reduction
-//     N     := Arg * two_by_PI	(fp)
-//     N_fix := fcvt.fx( N )	(int)
+//  Else                 ...cf. argument reduction
+//     N     := Arg * two_by_PI        (fp)
+//     N_fix := fcvt.fx( N )        (int)
 //     N     := fcvt.xf( N_fix )
 //     N_fix := N_fix + N_inc
-//     s     := Arg - N * P_1	(first piece of pi/2)
-//     w     := -N * P_2	(second piece of pi/2)
+//     s     := Arg - N * P_1        (first piece of pi/2)
+//     w     := -N * P_2        (second piece of pi/2)
 //
 //     If |s| >= 2^(-33)
 //        go to Step 3, Case_1_reduce
@@ -358,8 +364,8 @@
 //  Step 3. Case_1_reduce.
 //
 //  r := s + w
-//  c := (s - r) + w	...observe order
-//   
+//  c := (s - r) + w        ...observe order
+//
 //  Step 4. Case_1_complete
 //
 //  ...At this point, the reduced argument alpha is
@@ -375,17 +381,17 @@
 //
 //  If i_1 = 0, then
 //    poly := r*FR_rsq*(PP_1_lo + FR_rsq*(PP_2 + ... FR_rsq*PP_8))
-//    U_hi := r + PP_1_hi*r_hi*r_hi*r_hi	...any order
+//    U_hi := r + PP_1_hi*r_hi*r_hi*r_hi        ...any order
 //    U_lo := PP_1_hi*r_lo*(r*r + r*r_hi + r_hi*r_hi)
-//    correction := c + c*C_1*FR_rsq		...any order
+//    correction := c + c*C_1*FR_rsq                ...any order
 //  Else
 //    poly := FR_rsq*FR_rsq*(QQ_2 + FR_rsq*(QQ_3 + ... + FR_rsq*QQ_8))
-//    U_hi := 1 + QQ_1 * r_hi * r_hi		...any order
+//    U_hi := 1 + QQ_1 * r_hi * r_hi                ...any order
 //    U_lo := QQ_1 * r_lo * (r + r_hi)
-//    correction := -c*(r + S_1*FR_rsq*r)	...any order
+//    correction := -c*(r + S_1*FR_rsq*r)        ...any order
 //  Endif
 //
-//  V := poly + (U_lo + correction)	...observe order
+//  V := poly + (U_lo + correction)        ...observe order
 //
 //  result := (i_0 == 0?   1.0 : -1.0)
 //
@@ -397,7 +403,7 @@
 //  Return
 //
 //  Step 6. Small_r.
-// 
+//
 //  ...Use flush to zero mode without causing exception
 //    Let [i_0 i_1] be the two lsb of N_fix.
 //
@@ -412,7 +418,7 @@
 //  Else
 //     z := FR_rsq*FR_rsq; z := FR_rsq*z
 //     poly_lo := C_3 + FR_rsq*(C_4 + FR_rsq*C_5)
-//     poly_hi := FR_rsq*(C_1 + FR_rsq*C_2) 
+//     poly_hi := FR_rsq*(C_1 + FR_rsq*C_2)
 //     correction := -c*r
 //     result := 1
 //  Endif
@@ -429,15 +435,15 @@
 //
 //  Step 7. Case_2_reduce.
 //
-//  ...Refer to the write up for argument reduction for 
+//  ...Refer to the write up for argument reduction for
 //  ...rationale. The reduction algorithm below is taken from
 //  ...argument reduction description and integrated this.
 //
 //  w := N*P_3
-//  U_1 := N*P_2 + w		...FMA
-//  U_2 := (N*P_2 - U_1) + w	...2 FMA
+//  U_1 := N*P_2 + w                ...FMA
+//  U_2 := (N*P_2 - U_1) + w        ...2 FMA
 //  ...U_1 + U_2 is  N*(P_2+P_3) accurately
-//   
+//
 //  r := s - U_1
 //  c := ( (s - r) - U_1 ) - U_2
 //
@@ -446,29 +452,29 @@
 //  ...Case 1, this case requires much more work to reduce
 //  ...the argument, the subsequent calculation needed for
 //  ...any of the trigonometric function is very little because
-//  ...|alpha| < 1.01*2^(-33) and thus two terms of the 
+//  ...|alpha| < 1.01*2^(-33) and thus two terms of the
 //  ...Taylor series expansion suffices.
 //
 //  If i_1 = 0 then
-//     poly := c + S_1 * r * r * r	...any order
+//     poly := c + S_1 * r * r * r        ...any order
 //     result := r
 //  Else
 //     poly := -2^(-67)
 //     result := 1.0
 //  Endif
-//   
+//
 //  If i_0 = 1, result := -result
 //
 //  Last operation. Perform in user-set rounding mode
 //
 //  result := (i_0 == 0?     result + poly :
 //                           result - poly )
-//   
+//
 //  Return
 //
-//  
+//
 //  Step 8. Pre-reduction of large arguments.
-// 
+//
 //  ...Again, the following reduction procedure was described
 //  ...in the separate write up for argument reduction, which
 //  ...is tightly integrated here.
@@ -476,13 +482,13 @@
 //  N_0 := Arg * Inv_P_0
 //  N_0_fix := fcvt.fx( N_0 )
 //  N_0 := fcvt.xf( N_0_fix)
-   
+
 //  Arg' := Arg - N_0 * P_0
 //  w := N_0 * d_1
 //  N := Arg' * two_by_PI
 //  N_fix := fcvt.fx( N )
 //  N := fcvt.xf( N_fix )
-//  N_fix := N_fix + N_inc 
+//  N_fix := N_fix + N_inc
 //
 //  s := Arg' - N * P_1
 //  w := w - N * P_2
@@ -494,15 +500,15 @@
 //  Endif
 //
 //  Step 9. Case_4_reduce.
-// 
+//
 //    ...first obtain N_0*d_1 and -N*P_2 accurately
-//   U_hi := N_0 * d_1		V_hi := -N*P_2
-//   U_lo := N_0 * d_1 - U_hi	V_lo := -N*P_2 - U_hi	...FMAs
+//   U_hi := N_0 * d_1                V_hi := -N*P_2
+//   U_lo := N_0 * d_1 - U_hi        V_lo := -N*P_2 - U_hi        ...FMAs
 //
 //   ...compute the contribution from N_0*d_1 and -N*P_3
 //   w := -N*P_3
 //   w := w + N_0*d_2
-//   t := U_lo + V_lo + w		...any order
+//   t := U_lo + V_lo + w                ...any order
 //
 //   ...at this point, the mathematical value
 //   ...s + U_hi + V_hi  + t approximates the true reduced argument
@@ -517,12 +523,12 @@
 //   endif
 //   ...order in computing "a" must be observed. This branch is
 //   ...best implemented by predicates.
-//   ...A + a  is U_hi + V_hi accurately. Moreover, "a" is 
+//   ...A + a  is U_hi + V_hi accurately. Moreover, "a" is
 //   ...much smaller than A: |a| <= (1/2)ulp(A).
 //
 //   ...Just need to calculate   s + A + a + t
-//   C_hi := s + A		t := t + a
-//   C_lo := (s - C_hi) + A	
+//   C_hi := s + A                t := t + a
+//   C_lo := (s - C_hi) + A
 //   C_lo := C_lo + t
 //
 //   ...Final steps for reduction
@@ -548,156 +554,192 @@
 //   result := (i_0 == 0?     result + poly :
 //                            result - poly )
 //   Return
-//  
+//
 //   Large Arguments: For arguments above 2**63, a Payne-Hanek
 //   style argument reduction is used and pi_by_2 reduce is called.
 //
 
-#include "libm_support.h" 
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-.align 64 
-
-FSINCOSL_CONSTANTS:
-ASM_TYPE_DIRECTIVE(FSINCOSL_CONSTANTS,@object)
-data4 0x4B800000, 0xCB800000, 0x00000000,0x00000000 // two**24, -two**24
-data4 0x4E44152A, 0xA2F9836E, 0x00003FFE,0x00000000 // Inv_pi_by_2
-data4 0xCE81B9F1, 0xC84D32B0, 0x00004016,0x00000000 // P_0 
-data4 0x2168C235, 0xC90FDAA2, 0x00003FFF,0x00000000 // P_1 
-data4 0xFC8F8CBB, 0xECE675D1, 0x0000BFBD,0x00000000 // P_2 
-data4 0xACC19C60, 0xB7ED8FBB, 0x0000BF7C,0x00000000 // P_3 
-data4 0x5F000000, 0xDF000000, 0x00000000,0x00000000 // two_to_63, -two_to_63
-data4 0x6EC6B45A, 0xA397E504, 0x00003FE7,0x00000000 // Inv_P_0 
-data4 0xDBD171A1, 0x8D848E89, 0x0000BFBF,0x00000000 // d_1 
-data4 0x18A66F8E, 0xD5394C36, 0x0000BF7C,0x00000000 // d_2 
-data4 0x2168C234, 0xC90FDAA2, 0x00003FFE,0x00000000 // pi_by_4 
-data4 0x2168C234, 0xC90FDAA2, 0x0000BFFE,0x00000000 // neg_pi_by_4 
-data4 0x3E000000, 0xBE000000, 0x00000000,0x00000000 // two**-3, -two**-3
-data4 0x2F000000, 0xAF000000, 0x9E000000,0x00000000 // two**-33, -two**-33, -two**-67
-data4 0xA21C0BC9, 0xCC8ABEBC, 0x00003FCE,0x00000000 // PP_8 
-data4 0x720221DA, 0xD7468A05, 0x0000BFD6,0x00000000 // PP_7 
-data4 0x640AD517, 0xB092382F, 0x00003FDE,0x00000000 // PP_6 
-data4 0xD1EB75A4, 0xD7322B47, 0x0000BFE5,0x00000000 // PP_5 
-data4 0xFFFFFFFE, 0xFFFFFFFF, 0x0000BFFD,0x00000000 // C_1 
-data4 0x00000000, 0xAAAA0000, 0x0000BFFC,0x00000000 // PP_1_hi 
-data4 0xBAF69EEA, 0xB8EF1D2A, 0x00003FEC,0x00000000 // PP_4 
-data4 0x0D03BB69, 0xD00D00D0, 0x0000BFF2,0x00000000 // PP_3 
-data4 0x88888962, 0x88888888, 0x00003FF8,0x00000000 // PP_2
-data4 0xAAAB0000, 0xAAAAAAAA, 0x0000BFEC,0x00000000 // PP_1_lo 
-data4 0xC2B0FE52, 0xD56232EF, 0x00003FD2,0x00000000 // QQ_8
-data4 0x2B48DCA6, 0xC9C99ABA, 0x0000BFDA,0x00000000 // QQ_7
-data4 0x9C716658, 0x8F76C650, 0x00003FE2,0x00000000 // QQ_6
-data4 0xFDA8D0FC, 0x93F27DBA, 0x0000BFE9,0x00000000 // QQ_5
-data4 0xAAAAAAAA, 0xAAAAAAAA, 0x0000BFFC,0x00000000 // S_1 
-data4 0x00000000, 0x80000000, 0x0000BFFE,0x00000000 // QQ_1 
-data4 0x0C6E5041, 0xD00D00D0, 0x00003FEF,0x00000000 // QQ_4 
-data4 0x0B607F60, 0xB60B60B6, 0x0000BFF5,0x00000000 // QQ_3 
-data4 0xAAAAAA9B, 0xAAAAAAAA, 0x00003FFA,0x00000000 // QQ_2 
-data4 0xFFFFFFFE, 0xFFFFFFFF, 0x0000BFFD,0x00000000 // C_1 
-data4 0xAAAA719F, 0xAAAAAAAA, 0x00003FFA,0x00000000 // C_2 
-data4 0x0356F994, 0xB60B60B6, 0x0000BFF5,0x00000000 // C_3
-data4 0xB2385EA9, 0xD00CFFD5, 0x00003FEF,0x00000000 // C_4 
-data4 0x292A14CD, 0x93E4BD18, 0x0000BFE9,0x00000000 // C_5
-data4 0xAAAAAAAA, 0xAAAAAAAA, 0x0000BFFC,0x00000000 // S_1 
-data4 0x888868DB, 0x88888888, 0x00003FF8,0x00000000 // S_2 
-data4 0x055EFD4B, 0xD00D00D0, 0x0000BFF2,0x00000000 // S_3 
-data4 0x839730B9, 0xB8EF1C5D, 0x00003FEC,0x00000000 // S_4
-data4 0xE5B3F492, 0xD71EA3A4, 0x0000BFE5,0x00000000 // S_5
-data4 0x38800000, 0xB8800000, 0x00000000            // two**-14, -two**-14
-ASM_SIZE_DIRECTIVE(FSINCOSL_CONSTANTS)
-
-FR_Input_X        = f8 
-FR_Neg_Two_to_M3  = f32 
-FR_Two_to_63      = f32 
-FR_Two_to_24      = f33 
-FR_Pi_by_4        = f33 
-FR_Two_to_M14     = f34 
-FR_Two_to_M33     = f35 
-FR_Neg_Two_to_24  = f36 
-FR_Neg_Pi_by_4    = f36 
-FR_Neg_Two_to_M14 = f37 
-FR_Neg_Two_to_M33 = f38 
-FR_Neg_Two_to_M67 = f39 
-FR_Inv_pi_by_2    = f40 
-FR_N_float        = f41 
-FR_N_fix          = f42 
-FR_P_1            = f43 
-FR_P_2            = f44 
-FR_P_3            = f45 
-FR_s              = f46 
-FR_w              = f47 
-FR_c              = f48 
-FR_r              = f49 
-FR_Z              = f50 
-FR_A              = f51 
-FR_a              = f52 
-FR_t              = f53 
-FR_U_1            = f54 
-FR_U_2            = f55 
-FR_C_1            = f56 
-FR_C_2            = f57 
-FR_C_3            = f58 
-FR_C_4            = f59 
-FR_C_5            = f60 
-FR_S_1            = f61 
-FR_S_2            = f62 
-FR_S_3            = f63 
-FR_S_4            = f64 
-FR_S_5            = f65 
-FR_poly_hi        = f66 
-FR_poly_lo        = f67 
-FR_r_hi           = f68 
-FR_r_lo           = f69 
-FR_rsq            = f70 
-FR_r_cubed        = f71 
-FR_C_hi           = f72 
-FR_N_0            = f73 
-FR_d_1            = f74 
-FR_V              = f75 
-FR_V_hi           = f75 
-FR_V_lo           = f76 
-FR_U_hi           = f77 
-FR_U_lo           = f78 
-FR_U_hiabs        = f79 
-FR_V_hiabs        = f80 
-FR_PP_8           = f81 
-FR_QQ_8           = f81 
-FR_PP_7           = f82 
-FR_QQ_7           = f82 
-FR_PP_6           = f83 
-FR_QQ_6           = f83 
-FR_PP_5           = f84 
-FR_QQ_5           = f84 
-FR_PP_4           = f85 
-FR_QQ_4           = f85 
-FR_PP_3           = f86 
-FR_QQ_3           = f86 
-FR_PP_2           = f87 
-FR_QQ_2           = f87 
-FR_QQ_1           = f88 
-FR_N_0_fix        = f89 
-FR_Inv_P_0        = f90 
-FR_corr           = f91 
-FR_poly           = f92 
-FR_d_2            = f93 
-FR_Two_to_M3      = f94 
-FR_Neg_Two_to_63  = f94 
-FR_P_0            = f95 
-FR_C_lo           = f96 
-FR_PP_1           = f97 
-FR_PP_1_lo        = f98 
-FR_ArgPrime       = f99 
-
-GR_Table_Base  = r32 
-GR_Table_Base1 = r33 
-GR_i_0         = r34
-GR_i_1         = r35
-GR_N_Inc       = r36 
-GR_Sin_or_Cos  = r37 
+
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(FSINCOSL_CONSTANTS)
+
+sincosl_table_p:
+data8 0xA2F9836E4E44152A, 0x00003FFE // Inv_pi_by_2
+data8 0xC84D32B0CE81B9F1, 0x00004016 // P_0
+data8 0xC90FDAA22168C235, 0x00003FFF // P_1
+data8 0xECE675D1FC8F8CBB, 0x0000BFBD // P_2
+data8 0xB7ED8FBBACC19C60, 0x0000BF7C // P_3
+data8 0x8D848E89DBD171A1, 0x0000BFBF // d_1
+data8 0xD5394C3618A66F8E, 0x0000BF7C // d_2
+LOCAL_OBJECT_END(FSINCOSL_CONSTANTS)
+
+LOCAL_OBJECT_START(sincosl_table_d)
+data8 0xC90FDAA22168C234, 0x00003FFE // pi_by_4
+data8 0xA397E5046EC6B45A, 0x00003FE7 // Inv_P_0
+data4 0x3E000000, 0xBE000000         // 2^-3 and -2^-3
+data4 0x2F000000, 0xAF000000         // 2^-33 and -2^-33
+data4 0x9E000000, 0x00000000         // -2^-67
+data4 0x00000000, 0x00000000         // pad
+LOCAL_OBJECT_END(sincosl_table_d)
+
+LOCAL_OBJECT_START(sincosl_table_pp)
+data8 0xCC8ABEBCA21C0BC9, 0x00003FCE // PP_8
+data8 0xD7468A05720221DA, 0x0000BFD6 // PP_7
+data8 0xB092382F640AD517, 0x00003FDE // PP_6
+data8 0xD7322B47D1EB75A4, 0x0000BFE5 // PP_5
+data8 0xFFFFFFFFFFFFFFFE, 0x0000BFFD // C_1
+data8 0xAAAA000000000000, 0x0000BFFC // PP_1_hi
+data8 0xB8EF1D2ABAF69EEA, 0x00003FEC // PP_4
+data8 0xD00D00D00D03BB69, 0x0000BFF2 // PP_3
+data8 0x8888888888888962, 0x00003FF8 // PP_2
+data8 0xAAAAAAAAAAAB0000, 0x0000BFEC // PP_1_lo
+LOCAL_OBJECT_END(sincosl_table_pp)
+
+LOCAL_OBJECT_START(sincosl_table_qq)
+data8 0xD56232EFC2B0FE52, 0x00003FD2 // QQ_8
+data8 0xC9C99ABA2B48DCA6, 0x0000BFDA // QQ_7
+data8 0x8F76C6509C716658, 0x00003FE2 // QQ_6
+data8 0x93F27DBAFDA8D0FC, 0x0000BFE9 // QQ_5
+data8 0xAAAAAAAAAAAAAAAA, 0x0000BFFC // S_1
+data8 0x8000000000000000, 0x0000BFFE // QQ_1
+data8 0xD00D00D00C6E5041, 0x00003FEF // QQ_4
+data8 0xB60B60B60B607F60, 0x0000BFF5 // QQ_3
+data8 0xAAAAAAAAAAAAAA9B, 0x00003FFA // QQ_2
+LOCAL_OBJECT_END(sincosl_table_qq)
+
+LOCAL_OBJECT_START(sincosl_table_c)
+data8 0xFFFFFFFFFFFFFFFE, 0x0000BFFD // C_1
+data8 0xAAAAAAAAAAAA719F, 0x00003FFA // C_2
+data8 0xB60B60B60356F994, 0x0000BFF5 // C_3
+data8 0xD00CFFD5B2385EA9, 0x00003FEF // C_4
+data8 0x93E4BD18292A14CD, 0x0000BFE9 // C_5
+LOCAL_OBJECT_END(sincosl_table_c)
+
+LOCAL_OBJECT_START(sincosl_table_s)
+data8 0xAAAAAAAAAAAAAAAA, 0x0000BFFC // S_1
+data8 0x88888888888868DB, 0x00003FF8 // S_2
+data8 0xD00D00D0055EFD4B, 0x0000BFF2 // S_3
+data8 0xB8EF1C5D839730B9, 0x00003FEC // S_4
+data8 0xD71EA3A4E5B3F492, 0x0000BFE5 // S_5
+data4 0x38800000, 0xB8800000                        // two**-14 and -two**-14
+LOCAL_OBJECT_END(sincosl_table_s)
+
+FR_Input_X        = f8
+FR_Result         = f8
+
+FR_r              = f8
+FR_c              = f9
+
+FR_norm_x         = f9
+FR_inv_pi_2to63   = f10
+FR_rshf_2to64     = f11
+FR_2tom64         = f12
+FR_rshf           = f13
+FR_N_float_signif = f14
+FR_abs_x          = f15
+FR_Pi_by_4        = f34
+FR_Two_to_M14     = f35
+FR_Neg_Two_to_M14 = f36
+FR_Two_to_M33     = f37
+FR_Neg_Two_to_M33 = f38
+FR_Neg_Two_to_M67 = f39
+FR_Inv_pi_by_2    = f40
+FR_N_float        = f41
+FR_N_fix          = f42
+FR_P_1            = f43
+FR_P_2            = f44
+FR_P_3            = f45
+FR_s              = f46
+FR_w              = f47
+FR_d_2            = f48
+FR_tmp_result     = f49
+FR_Z              = f50
+FR_A              = f51
+FR_a              = f52
+FR_t              = f53
+FR_U_1            = f54
+FR_U_2            = f55
+FR_C_1            = f56
+FR_C_2            = f57
+FR_C_3            = f58
+FR_C_4            = f59
+FR_C_5            = f60
+FR_S_1            = f61
+FR_S_2            = f62
+FR_S_3            = f63
+FR_S_4            = f64
+FR_S_5            = f65
+FR_poly_hi        = f66
+FR_poly_lo        = f67
+FR_r_hi           = f68
+FR_r_lo           = f69
+FR_rsq            = f70
+FR_r_cubed        = f71
+FR_C_hi           = f72
+FR_N_0            = f73
+FR_d_1            = f74
+FR_V              = f75
+FR_V_hi           = f75
+FR_V_lo           = f76
+FR_U_hi           = f77
+FR_U_lo           = f78
+FR_U_hiabs        = f79
+FR_V_hiabs        = f80
+FR_PP_8           = f81
+FR_QQ_8           = f101
+FR_PP_7           = f82
+FR_QQ_7           = f102
+FR_PP_6           = f83
+FR_QQ_6           = f103
+FR_PP_5           = f84
+FR_QQ_5           = f104
+FR_PP_4           = f85
+FR_QQ_4           = f105
+FR_PP_3           = f86
+FR_QQ_3           = f106
+FR_PP_2           = f87
+FR_QQ_2           = f107
+FR_QQ_1           = f108
+FR_r_hi_sq        = f88
+FR_N_0_fix        = f89
+FR_Inv_P_0        = f90
+FR_corr           = f91
+FR_poly           = f92
+FR_Neg_Two_to_M3  = f93
+FR_Two_to_M3      = f94
+FR_P_0            = f95
+FR_C_lo           = f96
+FR_PP_1           = f97
+FR_PP_1_lo        = f98
+FR_ArgPrime       = f99
+FR_inexact        = f100
+
+GR_exp_m2_to_m3= r36
+GR_N_Inc       = r37
+GR_Sin_or_Cos  = r38
+GR_signexp_x   = r40
+GR_exp_x       = r40
+GR_exp_mask    = r41
+GR_exp_2_to_63 = r42
+GR_exp_2_to_m3 = r43
+GR_exp_2_to_24 = r44
+
+GR_sig_inv_pi  = r45
+GR_rshf_2to64  = r46
+GR_exp_2tom64  = r47
+GR_rshf        = r48
+GR_ad_p        = r49
+GR_ad_d        = r50
+GR_ad_pp       = r51
+GR_ad_qq       = r52
+GR_ad_c        = r53
+GR_ad_s        = r54
+GR_ad_ce       = r55
+GR_ad_se       = r56
+GR_ad_m14      = r57
+GR_ad_s1       = r58
 
 // Added for unwind support
 
@@ -706,386 +748,377 @@ GR_SAVE_GP     = r40
 GR_SAVE_PFS    = r41
 
 
-.global sinl#
-.global cosl#
-#ifdef _LIBC
-.global __sinl#
-.global __cosl#
-#endif
-
 .section .text
-.proc sinl#
-#ifdef _LIBC
-.proc __sinl#
-#endif
-.align 64 
-sinl:
-#ifdef _LIBC
-__sinl:
-#endif
+
+GLOBAL_IEEE754_ENTRY(sinl)
 { .mlx
-alloc GR_Table_Base = ar.pfs,0,12,2,0
-(p0)   movl GR_Sin_or_Cos = 0x0 ;;
+      alloc r32 = ar.pfs,0,27,2,0
+      movl GR_sig_inv_pi = 0xa2f9836e4e44152a // significand of 1/pi
 }
-
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Base   = @ltoff(FSINCOSL_CONSTANTS#), gp
-      nop.i 999
+{ .mlx
+      mov GR_Sin_or_Cos = 0x0
+      movl GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+64)
 }
 ;;
 
-{ .mmb
-      ld8 GR_Table_Base = [GR_Table_Base]
+{ .mfi
+      addl           GR_ad_p   = @ltoff(FSINCOSL_CONSTANTS#), gp
+      fclass.m p6, p0 =  FR_Input_X, 0x1E3 // Test x natval, nan, inf
+      mov GR_exp_2_to_m3 = 0xffff - 3      // Exponent of 2^-3
+}
+{ .mfb
       nop.m 999
-(p0)   br.cond.sptk L(SINCOSL_CONTINUE) ;;
+      fnorm.s1 FR_norm_x = FR_Input_X      // Normalize x
+      br.cond.sptk SINCOSL_CONTINUE
 }
 ;;
 
+GLOBAL_IEEE754_END(sinl)
 
-.endp sinl#
-ASM_SIZE_DIRECTIVE(sinl#)
-
-.section .text
-.proc cosl#
-cosl:
-#ifdef _LIBC
-.proc __cosl#
-__cosl:
-#endif
+GLOBAL_IEEE754_ENTRY(cosl)
+{ .mlx
+      alloc r32 = ar.pfs,0,27,2,0
+      movl GR_sig_inv_pi = 0xa2f9836e4e44152a // significand of 1/pi
+}
 { .mlx
-alloc GR_Table_Base= ar.pfs,0,12,2,0
-(p0)   movl GR_Sin_or_Cos = 0x1 ;;
+      mov GR_Sin_or_Cos = 0x1
+      movl GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+64)
 }
 ;;
 
-{ .mmi
+{ .mfi
+      addl           GR_ad_p   = @ltoff(FSINCOSL_CONSTANTS#), gp
+      fclass.m p6, p0 =  FR_Input_X, 0x1E3 // Test x natval, nan, inf
+      mov GR_exp_2_to_m3 = 0xffff - 3      // Exponent of 2^-3
+}
+{ .mfi
       nop.m 999
-(p0)  addl           GR_Table_Base   = @ltoff(FSINCOSL_CONSTANTS#), gp
+      fnorm.s1 FR_norm_x = FR_Input_X      // Normalize x
       nop.i 999
 }
 ;;
 
-{ .mmb
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.b 999
+SINCOSL_CONTINUE:
+{ .mfi
+      setf.sig FR_inv_pi_2to63 = GR_sig_inv_pi // Form 1/pi * 2^63
+      nop.f 999
+      mov GR_exp_2tom64 = 0xffff - 64      // Scaling constant to compute N
+}
+{ .mlx
+      setf.d FR_rshf_2to64 = GR_rshf_2to64    // Form const 1.1000 * 2^(63+64)
+      movl GR_rshf = 0x43e8000000000000       // Form const 1.1000 * 2^63
 }
 ;;
 
+{ .mfi
+      ld8 GR_ad_p = [GR_ad_p]              // Point to Inv_pi_by_2
+      fclass.m p7, p0 = FR_Input_X, 0x0b   // Test x denormal
+      nop.i 999
+}
+;;
 
-
-//
-//     Load Table Address
-//
-
-L(SINCOSL_CONTINUE): 
-{ .mmi
-(p0)   add GR_Table_Base1 = 96, GR_Table_Base
-(p0)   ldfs	FR_Two_to_24 = [GR_Table_Base], 4
-// GR_Sin_or_Cos denotes 
-(p0)   mov   r39 = b0 ;;
+{ .mfi
+      getf.exp GR_signexp_x = FR_Input_X   // Get sign and exponent of x
+      fclass.m p10, p0 = FR_Input_X, 0x007 // Test x zero
+      nop.i 999
 }
-{ .mmi
-       nop.m 0
-//
-//     Load 2**24, load 2**63.
-//
-(p0)   ldfs	FR_Neg_Two_to_24 = [GR_Table_Base], 12
-       nop.i 0
+{ .mib
+      mov GR_exp_mask = 0x1ffff            // Exponent mask
+      nop.i 999
+(p6)  br.cond.spnt SINCOSL_SPECIAL         // Branch if x natval, nan, inf
 }
+;;
+
 { .mfi
-(p0)   ldfs	FR_Two_to_63 = [GR_Table_Base1], 4
-//
-//     Check for unnormals - unsupported operands. We do not want
-//     to generate denormal exception
-//     Check for NatVals, QNaNs, SNaNs, +/-Infs
-//     Check for EM unsupporteds
-//     Check for Zero 
-//
-(p0)   fclass.m.unc  p6, p0 =  FR_Input_X, 0x1E3
-       nop.i 0
-};;
-{ .mmf
-        nop.m 999
-(p0)   ldfs	FR_Neg_Two_to_63 = [GR_Table_Base1], 12
-(p0)   fclass.nm.unc p8, p0 =  FR_Input_X, 0x1FF
-}
-{ .mfb
-	nop.m 999
-(p0)   fclass.m.unc p10, p0 = FR_Input_X, 0x007
-(p6)   br.cond.spnt L(SINCOSL_SPECIAL) ;;
+      setf.exp FR_2tom64 = GR_exp_2tom64   // Form 2^-64 for scaling N_float
+      nop.f 0
+      add GR_ad_d = 0x70, GR_ad_p          // Point to constant table d
 }
 { .mib
-	nop.m 999
-	nop.i 999
-(p8)   br.cond.spnt L(SINCOSL_SPECIAL) ;;
+      setf.d FR_rshf = GR_rshf         // Form right shift const 1.1000 * 2^63
+      mov  GR_exp_m2_to_m3 = 0x2fffc       // Form -(2^-3)
+(p7)  br.cond.spnt SINCOSL_DENORMAL        // Branch if x denormal
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Branch if +/- NaN, Inf.
-//     Load -2**24, load -2**63.
-//
-(p10)  br.cond.spnt L(SINCOSL_ZERO) ;;
+;;
+
+SINCOSL_COMMON:
+{ .mfi
+      and GR_exp_x = GR_exp_mask, GR_signexp_x // Get exponent of x
+      fclass.nm p8, p0 = FR_Input_X, 0x1FF // Test x unsupported type
+      mov GR_exp_2_to_63 = 0xffff + 63     // Exponent of 2^63
 }
-{ .mmb
-(p0)   ldfe	FR_Inv_pi_by_2 = [GR_Table_Base], 16
-(p0)   ldfe	FR_Inv_P_0 = [GR_Table_Base1], 16
-	nop.b 999 ;;
+{ .mib
+      add GR_ad_pp = 0x40, GR_ad_d         // Point to constant table pp
+      mov GR_exp_2_to_24 = 0xffff + 24     // Exponent of 2^24
+(p10) br.cond.spnt SINCOSL_ZERO            // Branch if x zero
 }
-{ .mmb
-(p0)   ldfe		FR_d_1 = [GR_Table_Base1], 16
-//
-//     Raise possible denormal operand flag with useful fcmp
-//     Is x <= -2**63
-//     Load Inv_P_0 for pre-reduction
-//     Load Inv_pi_by_2
-//
-(p0)   ldfe		FR_P_0 = [GR_Table_Base], 16
-	nop.b 999 ;;
+;;
+
+{ .mfi
+      ldfe FR_Inv_pi_by_2 = [GR_ad_p], 16  // Load 2/pi
+      fcmp.eq.s0 p15, p0 = FR_Input_X, f0  // Dummy to set denormal
+      add GR_ad_qq = 0xa0, GR_ad_pp        // Point to constant table qq
 }
-{ .mmb
-(p0)   ldfe	FR_d_2 = [GR_Table_Base1], 16
-//
-//     Load P_0
-//     Load d_1
-//     Is x >= 2**63
-//     Is x <= -2**24?
-//
-(p0)   ldfe	FR_P_1 = [GR_Table_Base], 16
-	nop.b 999 ;;
+{ .mfi
+      ldfe FR_Pi_by_4 = [GR_ad_d], 16      // Load pi/4 for range test
+      nop.f 999
+      cmp.ge p10,p0 = GR_exp_x, GR_exp_2_to_63   // Is |x| >= 2^63
 }
-//
-//     Load P_1
-//     Load d_2
-//     Is x >= 2**24?
-//
+;;
+
 { .mfi
-(p0)   ldfe	FR_P_2 = [GR_Table_Base], 16
-(p0)   fcmp.le.unc.s1	p7, p8 = FR_Input_X, FR_Neg_Two_to_24
-	nop.i 999 ;;
+      ldfe FR_P_0 = [GR_ad_p], 16          // Load P_0 for pi/4 <= |x| < 2^63
+      fmerge.s FR_abs_x = f1, FR_norm_x    // |x|
+      add GR_ad_c = 0x90, GR_ad_qq         // Point to constant table c
 }
-{ .mbb
-(p0)   ldfe	FR_P_3 = [GR_Table_Base], 16
-	nop.b 999
-	nop.b 999 ;;
+{ .mfi
+      ldfe FR_Inv_P_0 = [GR_ad_d], 16      // Load 1/P_0 for pi/4 <= |x| < 2^63
+      nop.f 999
+      cmp.ge p7,p0 = GR_exp_x, GR_exp_2_to_24   // Is |x| >= 2^24
 }
+;;
+
 { .mfi
-	nop.m 999
-(p8)   fcmp.ge.s1 p7, p0 = FR_Input_X, FR_Two_to_24
-	nop.i 999
+      ldfe FR_P_1 = [GR_ad_p], 16          // Load P_1 for pi/4 <= |x| < 2^63
+      nop.f 999
+      add GR_ad_s = 0x50, GR_ad_c          // Point to constant table s
 }
 { .mfi
-(p0)   ldfe	FR_Pi_by_4 = [GR_Table_Base1], 16
-//
-//     Branch if +/- zero.
-//     Decide about the paths to take:
-//     If -2**24 < FR_Input_X < 2**24 - CASE 1 OR 2 
-//     OTHERWISE - CASE 3 OR 4 
-//
-(p0)   fcmp.le.unc.s0	p10, p11 = FR_Input_X, FR_Neg_Two_to_63
-	nop.i 999 ;;
+      ldfe FR_PP_8 = [GR_ad_pp], 16        // Load PP_8 for 2^-3 < |r| < pi/4
+      nop.f 999
+      nop.i 999
 }
-{ .mmi
-(p0)   ldfe	FR_Neg_Pi_by_4 = [GR_Table_Base1], 16 ;;
-(p0)   ldfs	FR_Two_to_M3 = [GR_Table_Base1], 4
-	nop.i 999
+;;
+
+{ .mfi
+      ldfe FR_P_2 = [GR_ad_p], 16          // Load P_2 for pi/4 <= |x| < 2^63
+      nop.f 999
+      add GR_ad_ce = 0x40, GR_ad_c         // Point to end of constant table c
 }
 { .mfi
-	nop.m 999
-(p11)  fcmp.ge.s1	p10, p0 = FR_Input_X, FR_Two_to_63
-	nop.i 999 ;;
+      ldfe FR_QQ_8 = [GR_ad_qq], 16        // Load QQ_8 for 2^-3 < |r| < pi/4
+      nop.f 999
+      nop.i 999
 }
-{ .mib
-(p0)   ldfs	FR_Neg_Two_to_M3 = [GR_Table_Base1], 12
-	nop.i 999
-//
-//     Load P_2
-//     Load P_3
-//     Load pi_by_4
-//     Load neg_pi_by_4
-//     Load 2**(-3)
-//     Load -2**(-3).
-//
-(p10)  br.cond.spnt L(SINCOSL_ARG_TOO_LARGE) ;;
+;;
+
+{ .mfi
+      ldfe FR_QQ_7 = [GR_ad_qq], 16        // Load QQ_7 for 2^-3 < |r| < pi/4
+      fma.s1        FR_N_float_signif = FR_Input_X, FR_inv_pi_2to63, FR_rshf_2to64
+      add GR_ad_se = 0x40, GR_ad_s         // Point to end of constant table s
 }
 { .mib
-	nop.m 999
-	nop.i 999
-//
-//     Branch out if x >= 2**63. Use Payne-Hanek Reduction
-//
-(p7)   br.cond.spnt L(SINCOSL_LARGER_ARG) ;;
+      ldfe FR_PP_7 = [GR_ad_pp], 16        // Load PP_7 for 2^-3 < |r| < pi/4
+      mov GR_ad_s1 = GR_ad_s               // Save pointer to S_1
+(p10) br.cond.spnt SINCOSL_ARG_TOO_LARGE   // Branch if |x| >= 2^63
+                                           // Use Payne-Hanek Reduction
 }
+;;
+
 { .mfi
-	nop.m 999
-// 
-//     Branch if Arg <= -2**24 or Arg >= 2**24 and use pre-reduction.
-//
-(p0)   fma.s1	FR_N_float = FR_Input_X, FR_Inv_pi_by_2, f0
-	nop.i 999 ;;
+      ldfe FR_P_3 = [GR_ad_p], 16          // Load P_3 for pi/4 <= |x| < 2^63
+      fmerge.se FR_r = FR_norm_x, FR_norm_x // r = x, in case |x| < pi/4
+      add GR_ad_m14 = 0x50, GR_ad_s        // Point to constant table m14
 }
-{ .mfi
-	nop.m 999
-(p0)   fcmp.lt.unc.s1	p6, p7 = FR_Input_X, FR_Pi_by_4
-	nop.i 999 ;;
+{ .mfb
+      ldfps FR_Two_to_M3, FR_Neg_Two_to_M3 = [GR_ad_d], 8
+      fma.s1 FR_rsq = FR_norm_x, FR_norm_x, f0 // rsq = x*x, in case |x| < pi/4
+(p7)  br.cond.spnt SINCOSL_LARGER_ARG      // Branch if 2^24 <= |x| < 2^63
+                                           // Use pre-reduction
+}
+;;
+
+{ .mmf
+      ldfe FR_PP_6 = [GR_ad_pp], 16       // Load PP_6 for normal path
+      ldfe FR_QQ_6 = [GR_ad_qq], 16       // Load QQ_6 for normal path
+      fmerge.se FR_c = f0, f0             // c = 0 in case |x| < pi/4
 }
+;;
+
+{ .mmf
+      ldfe FR_PP_5 = [GR_ad_pp], 16       // Load PP_5 for normal path
+      ldfe FR_QQ_5 = [GR_ad_qq], 16       // Load QQ_5 for normal path
+      nop.f 999
+}
+;;
+
+// Here if 0 < |x| < 2^24
 { .mfi
-	nop.m 999
-// 
-//     Select the case when |Arg| < pi/4 
-//     Else Select the case when |Arg| >= pi/4 
-//
-(p0)   fcvt.fx.s1 FR_N_fix = FR_N_float
-	nop.i 999 ;;
+      ldfe FR_S_5 = [GR_ad_se], -16       // Load S_5 if i_1=0
+      fcmp.lt.s1  p6, p7 = FR_abs_x, FR_Pi_by_4  // Test |x| < pi/4
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      ldfe FR_C_5 = [GR_ad_ce], -16       // Load C_5 if i_1=1
+      fms.s1 FR_N_float = FR_N_float_signif, FR_2tom64, FR_rshf
+      nop.i 999
+}
+;;
+
+{ .mmi
+      ldfe FR_S_4 = [GR_ad_se], -16       // Load S_4 if i_1=0
+      ldfe FR_C_4 = [GR_ad_ce], -16       // Load C_4 if i_1=1
+      nop.i 999
+}
+;;
+
 //
 //     N  = Arg * 2/pi
 //     Check if Arg < pi/4
 //
-(p6)   fcmp.gt.s1 p6, p7 = FR_Input_X, FR_Neg_Pi_by_4
-	nop.i 999 ;;
-}
 //
 //     Case 2: Convert integer N_fix back to normalized floating-point value.
 //     Case 1: p8 is only affected  when p6 is set
 //
-{ .mfi
-(p7)   ldfs FR_Two_to_M33 = [GR_Table_Base1], 4
 //
 //     Grab the integer part of N and call it N_fix
 //
-(p6)   fmerge.se FR_r = FR_Input_X, FR_Input_X
-//     If |x| < pi/4, r = x and c = 0 
+{ .mfi
+(p7)  ldfps FR_Two_to_M33, FR_Neg_Two_to_M33 = [GR_ad_d], 8
+(p6)  fma.s1 FR_r_cubed = FR_r, FR_rsq, f0        // r^3 if |x| < pi/4
+(p6)  mov GR_N_Inc = GR_Sin_or_Cos                // N_Inc if |x| < pi/4
+}
+;;
+
+//     If |x| < pi/4, r = x and c = 0
 //     lf |x| < pi/4, is x < 2**(-3).
-//     r = Arg 
+//     r = Arg
 //     c = 0
-(p6)   mov GR_N_Inc = GR_Sin_or_Cos ;;
-}
-{ .mmf
-	nop.m 999
-(p7)   ldfs FR_Neg_Two_to_M33 = [GR_Table_Base1], 4
-(p6)   fmerge.se FR_c = f0, f0
-}
-{ .mfi
-	nop.m 999
-(p6)   fcmp.lt.unc.s1	p8, p9 = FR_Input_X, FR_Two_to_M3
-	nop.i 999 ;;
+{ .mmi
+(p7)  getf.sig        GR_N_Inc = FR_N_float_signif
+(p6)  cmp.lt.unc p8,p0 = GR_exp_x, GR_exp_2_to_m3   // Is |x| < 2^-3
+(p6)  tbit.z p9,p10 = GR_N_Inc, 0         // p9  if i_1=0, N mod 4 = 0,1
+                                          // p10 if i_1=1, N mod 4 = 2,3
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
 //     lf |x| < pi/4, is -2**(-3)< x < 2**(-3) - set p8.
-//     If |x| >= pi/4, 
-//     Create the right N for |x| < pi/4 and otherwise 
+//     If |x| >= pi/4,
+//     Create the right N for |x| < pi/4 and otherwise
 //     Case 2: Place integer part of N in GP register
 //
-(p7)   fcvt.xf FR_N_float = FR_N_fix
-	nop.i 999 ;;
-}
-{ .mmf
-	nop.m 999
-(p7)   getf.sig	GR_N_Inc = FR_N_fix
-(p8)   fcmp.gt.s1 p8, p0 = FR_Input_X, FR_Neg_Two_to_M3 ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Load 2**(-33), -2**(-33)
-//
-(p8)   br.cond.spnt L(SINCOSL_SMALL_R) ;;
+
+
+{ .mbb
+      nop.m 999
+(p8)  br.cond.spnt SINCOSL_SMALL_R_0    // Branch if 0 < |x| < 2^-3
+(p6)  br.cond.spnt SINCOSL_NORMAL_R_0   // Branch if 2^-3 <= |x| < pi/4
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p6)   br.cond.sptk L(SINCOSL_NORMAL_R) ;;
+;;
+
+// Here if pi/4 <= |x| < 2^24
+{ .mfi
+      ldfs FR_Neg_Two_to_M67 = [GR_ad_d], 8     // Load -2^-67
+      fnma.s1 FR_s = FR_N_float, FR_P_1, FR_Input_X // s = -N * P_1  + Arg
+      add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos    // Adjust N_Inc for sin/cos
 }
-//
-//     if |x| < pi/4, branch based on |x| < 2**(-3) or otherwise.
-//
-//
-//     In this branch, |x| >= pi/4.
-// 
 { .mfi
-(p0)   ldfs FR_Neg_Two_to_M67 = [GR_Table_Base1], 8
-//
-//     Load -2**(-67)
-// 
-(p0)   fnma.s1	FR_s = FR_N_float, FR_P_1, FR_Input_X
-//
-//     w = N * P_2
-//     s = -N * P_1  + Arg
-//
-(p0)   add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos
+      nop.m 999
+      fma.s1 FR_w = FR_N_float, FR_P_2, f0      // w = N * P_2
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fma.s1	FR_w = FR_N_float, FR_P_2, f0
-	nop.i 999 ;;
+      nop.m 999
+      fms.s1 FR_r = FR_s, f1, FR_w        // r = s - w, assume |s| >= 2^-33
+      tbit.z p9,p10 = GR_N_Inc, 0         // p9  if i_1=0, N mod 4 = 0,1
+                                          // p10 if i_1=1, N mod 4 = 2,3
 }
+;;
+
 { .mfi
-	nop.m 999
-// 
-//     Adjust N_fix by N_inc to determine whether sine or
-//     cosine is being calculated
-//
-(p0)   fcmp.lt.unc.s1 p7, p6 = FR_s, FR_Two_to_M33
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.lt.s1 p7, p6 = FR_s, FR_Two_to_M33
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p7)   fcmp.gt.s1 p7, p6 = FR_s, FR_Neg_Two_to_M33
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fcmp.gt.s1 p7, p6 = FR_s, FR_Neg_Two_to_M33 // p6 if |s| >= 2^-33, else p7
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//     Remember x >= pi/4.
-//     Is s <= -2**(-33) or s >= 2**(-33) (p6)
-//     or -2**(-33) < s < 2**(-33) (p7)
-(p6)   fms.s1 FR_r = FR_s, f1, FR_w
-	nop.i 999
+      nop.m 999
+      fms.s1 FR_c = FR_s, f1, FR_r             // c = s - r, for |s| >= 2^-33
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p7)   fma.s1 FR_w = FR_N_float, FR_P_3, f0
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_rsq = FR_r, FR_r, f0           // rsq = r * r, for |s| >= 2^-33
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p7)   fma.s1 FR_U_1 = FR_N_float, FR_P_2, FR_w
-	nop.i 999
+      nop.m 999
+(p7)  fma.s1 FR_w = FR_N_float, FR_P_3, f0
+      nop.i 999
 }
+;;
+
+{ .mmf
+(p9)  ldfe FR_C_1 = [GR_ad_pp], 16     // Load C_1 if i_1=0
+(p10) ldfe FR_S_1 = [GR_ad_qq], 16     // Load S_1 if i_1=1
+      frcpa.s1 FR_r_hi, p15 = f1, FR_r  // r_hi = frcpa(r)
+}
+;;
+
 { .mfi
-	nop.m 999
-(p6)   fms.s1 FR_c = FR_s, f1, FR_r
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fcmp.lt.unc.s1 p8, p13 = FR_r, FR_Two_to_M3 // If big s, test r with 2^-3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-// 
-//     For big s: r = s - w: No futher reduction is necessary 
+      nop.m 999
+(p7)  fma.s1 FR_U_1 = FR_N_float, FR_P_2, FR_w
+      nop.i 999
+}
+;;
+
+//
+//     For big s: r = s - w: No futher reduction is necessary
 //     For small s: w = N * P_3 (change sign) More reduction
 //
-(p6)   fcmp.lt.unc.s1 p8, p9 = FR_r, FR_Two_to_M3
-	nop.i 999 ;;
+{ .mfi
+        nop.m 999
+(p8)   fcmp.gt.s1 p8, p13 = FR_r, FR_Neg_Two_to_M3 // If big s, p8 if |r| < 2^-3
+        nop.i 999 ;;
 }
+
 { .mfi
-	nop.m 999
-(p8)   fcmp.gt.s1 p8, p9 = FR_r, FR_Neg_Two_to_M3
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly = FR_rsq, FR_PP_8, FR_PP_7 // poly = rsq*PP_8+PP_7 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+(p10) fma.s1 FR_poly = FR_rsq, FR_QQ_8, FR_QQ_7 // poly = rsq*QQ_8+QQ_7 if i_1=1
+      nop.i 999
+}
+;;
+
+{ .mfi
+        nop.m 999
 (p7)   fms.s1 FR_r = FR_s, f1, FR_U_1
-	nop.i 999
+        nop.i 999
 }
-{ .mfb
-	nop.m 999
+;;
+
+{ .mfi
+      nop.m 999
+(p6)  fma.s1 FR_r_cubed = FR_r, FR_rsq, f0  // rcubed = r * rsq
+      nop.i 999
+}
+;;
+
+{ .mfi
 //
 //     For big s: Is |r| < 2**(-3)?
 //     For big s: c = S - r
@@ -1095,355 +1128,356 @@ L(SINCOSL_CONTINUE):
 //     If p9 is set, prepare to branch to Normal_R.
 //     For big s,  r is complete here.
 //
-(p6)   fms.s1 FR_c = FR_c, f1, FR_w
-// 
+//
 //     For big s: c = c + w (w has not been negated.)
 //     For small s: r = S - U_1
 //
-(p8)   br.cond.spnt	L(SINCOSL_SMALL_R) ;;
+      nop.m 999
+(p6)  fms.s1 FR_c = FR_c, f1, FR_w
+      nop.i 999
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)   br.cond.sptk	L(SINCOSL_NORMAL_R) ;;
+{ .mbb
+      nop.m 999
+(p8)  br.cond.spnt    SINCOSL_SMALL_R_1  // Branch if |s|>=2^-33, |r| < 2^-3,
+                                         // and pi/4 <= |x| < 2^24
+(p13) br.cond.sptk    SINCOSL_NORMAL_R_1 // Branch if |s|>=2^-33, |r| >= 2^-3,
+                                         // and pi/4 <= |x| < 2^24
 }
-{ .mfi
-(p7)   add GR_Table_Base1 = 224, GR_Table_Base1
+;;
+
+SINCOSL_S_TINY:
 //
-//     Branch to SINCOSL_SMALL_R or SINCOSL_NORMAL_R
+// Here if |s| < 2^-33, and pi/4 <= |x| < 2^24
+//
+{ .mfi
+       fms.s1 FR_U_2 = FR_N_float, FR_P_2, FR_U_1
 //
-(p7)   fms.s1 FR_U_2 = FR_N_float, FR_P_2, FR_U_1
-// 
 //     c = S - U_1
 //     r = S_1 * r
 //
 //
-(p7)   extr.u	GR_i_1 = GR_N_Inc, 0, 1 ;;
 }
+;;
+
 { .mmi
-	nop.m 999
+        nop.m 999
 //
 //     Get [i_0,i_1] - two lsb of N_fix_gr.
 //     Do dummy fmpy so inexact is always set.
 //
-(p7)   cmp.eq.unc p9, p10 = 0x0, GR_i_1
-(p7)   extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
+      tbit.z p9,p10 = GR_N_Inc, 0      // p9  if i_1=0, N mod 4 = 0,1
+                                       // p10 if i_1=1, N mod 4 = 2,3
 }
-// 
+;;
+
+//
 //     For small s: U_2 = N * P_2 - U_1
 //     S_1 stored constant - grab the one stored with the
 //     coefficients.
-// 
+//
 { .mfi
-(p7)   ldfe FR_S_1 = [GR_Table_Base1], 16
+       ldfe FR_S_1 = [GR_ad_s1], 16
 //
 //     Check if i_1 and i_0  != 0
 //
-(p10)  fma.s1	FR_poly = f0, f1, FR_Neg_Two_to_M67
-(p7)   cmp.eq.unc p11, p12 = 0x0, GR_i_0 ;;
+(p10)  fma.s1        FR_poly = f0, f1, FR_Neg_Two_to_M67
+      tbit.z p11,p12 = GR_N_Inc, 1     // p11 if i_0=0, N mod 4 = 0,2
+                                       // p12 if i_0=1, N mod 4 = 1,3
 }
+;;
+
 { .mfi
-	nop.m 999
-(p7)   fms.s1	FR_s = FR_s, f1, FR_r
-	nop.i 999
+        nop.m 999
+       fms.s1        FR_s = FR_s, f1, FR_r
+        nop.i 999
 }
 { .mfi
-	nop.m 999
-// 
+        nop.m 999
+//
 //     S = S - r
 //     U_2 = U_2 + w
 //     load S_1
 //
-(p7)   fma.s1	FR_rsq = FR_r, FR_r, f0
-	nop.i 999 ;;
+       fma.s1        FR_rsq = FR_r, FR_r, f0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p7)   fma.s1	FR_U_2 = FR_U_2, f1, FR_w
-	nop.i 999
+        nop.m 999
+       fma.s1        FR_U_2 = FR_U_2, f1, FR_w
+        nop.i 999
 }
 { .mfi
-	nop.m 999
-(p7)   fmerge.se FR_Input_X = FR_r, FR_r
-	nop.i 999 ;;
+        nop.m 999
+       fmerge.se FR_tmp_result = FR_r, FR_r
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p10)  fma.s1 FR_Input_X = f0, f1, f1
-	nop.i 999 ;;
+        nop.m 999
+(p10)  fma.s1 FR_tmp_result = f0, f1, f1
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-// 
+        nop.m 999
+//
 //     FR_rsq = r * r
 //     Save r as the result.
 //
-(p7)   fms.s1	FR_c = FR_s, f1, FR_U_1
-	nop.i 999 ;;
+       fms.s1        FR_c = FR_s, f1, FR_U_1
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-// 
+        nop.m 999
+//
 //     if ( i_1 ==0) poly = c + S_1*r*r*r
 //     else Result = 1
 //
-(p12)  fnma.s1 FR_Input_X = FR_Input_X, f1, f0
-	nop.i 999
+(p12)  fnma.s1 FR_tmp_result = FR_tmp_result, f1, f0
+        nop.i 999
 }
 { .mfi
-	nop.m 999
-(p7)   fma.s1	FR_r = FR_S_1, FR_r, f0
-	nop.i 999 ;;
+        nop.m 999
+       fma.s1        FR_r = FR_S_1, FR_r, f0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p7)   fma.s0	FR_S_1 = FR_S_1, FR_S_1, f0
-	nop.i 999 ;;
+        nop.m 999
+       fma.s0        FR_S_1 = FR_S_1, FR_S_1, f0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     If i_1 != 0, poly = 2**(-67)
 //
-(p7)   fms.s1 FR_c = FR_c, f1, FR_U_2
-	nop.i 999 ;;
+       fms.s1 FR_c = FR_c, f1, FR_U_2
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-// 
+        nop.m 999
+//
 //     c = c - U_2
-// 
+//
 (p9)   fma.s1 FR_poly = FR_r, FR_rsq, FR_c
-	nop.i 999 ;;
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     i_0 != 0, so Result = -Result
 //
-(p11)  fma.s0 FR_Input_X = FR_Input_X, f1, FR_poly
-	nop.i 999 ;;
+(p11)  fma.s0 FR_Result = FR_tmp_result, f1, FR_poly
+        nop.i 999 ;;
 }
 { .mfb
-	nop.m 999
-(p12)  fms.s0 FR_Input_X = FR_Input_X, f1, FR_poly
+        nop.m 999
+(p12)  fms.s0 FR_Result = FR_tmp_result, f1, FR_poly
 //
 //     if (i_0 == 0),  Result = Result + poly
 //     else            Result = Result - poly
 //
-(p0)    br.ret.sptk   b0 ;;
-}
-L(SINCOSL_LARGER_ARG): 
-{ .mfi
-	nop.m 999
-(p0)   fma.s1 FR_N_0 = FR_Input_X, FR_Inv_P_0, f0
-	nop.i 999
+        br.ret.sptk   b0         // Exit if |s| < 2^-33, and pi/4 <= |x| < 2^24
 }
 ;;
 
-//     This path for argument > 2*24 
-//     Adjust table_ptr1 to beginning of table.
+SINCOSL_LARGER_ARG:
 //
-
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Base   = @ltoff(FSINCOSL_CONSTANTS#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
+// Here if 2^24 <= |x| < 2^63
+//
+{ .mfi
+      ldfe FR_d_1 = [GR_ad_p], 16          // Load d_1 for |x| >= 2^24 path
+       fma.s1 FR_N_0 = FR_Input_X, FR_Inv_P_0, f0
+        nop.i 999
 }
 ;;
 
-
-// 
-//     Point to  2*-14 
+//
 //     N_0 = Arg * Inv_P_0
 //
+//     Load values 2**(-14) and -2**(-14)
 { .mmi
-(p0)   add GR_Table_Base = 688, GR_Table_Base ;;
-(p0)   ldfs FR_Two_to_M14 = [GR_Table_Base], 4
-	nop.i 999 ;;
+       ldfps FR_Two_to_M14, FR_Neg_Two_to_M14 = [GR_ad_m14]
+        nop.i 999 ;;
 }
 { .mfi
-(p0)   ldfs FR_Neg_Two_to_M14 = [GR_Table_Base], 0
-	nop.f 999
-	nop.i 999 ;;
+      ldfe FR_d_2 = [GR_ad_p], 16          // Load d_2 for |x| >= 2^24 path
+        nop.f 999
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     Load values 2**(-14) and -2**(-14)
 //
-(p0)   fcvt.fx.s1 FR_N_0_fix = FR_N_0
-	nop.i 999 ;;
+       fcvt.fx.s1 FR_N_0_fix = FR_N_0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     N_0_fix  = integer part of N_0
 //
-(p0)   fcvt.xf FR_N_0 = FR_N_0_fix 
-	nop.i 999 ;;
+       fcvt.xf FR_N_0 = FR_N_0_fix
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     Make N_0 the integer part
 //
-(p0)   fnma.s1 FR_ArgPrime = FR_N_0, FR_P_0, FR_Input_X
-	nop.i 999
+       fnma.s1 FR_ArgPrime = FR_N_0, FR_P_0, FR_Input_X
+        nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fma.s1 FR_w = FR_N_0, FR_d_1, f0
-	nop.i 999 ;;
+        nop.m 999
+       fma.s1 FR_w = FR_N_0, FR_d_1, f0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     Arg' = -N_0 * P_0 + Arg
 //     w  = N_0 * d_1
 //
-(p0)   fma.s1 FR_N_float = FR_ArgPrime, FR_Inv_pi_by_2, f0
-	nop.i 999 ;;
+       fma.s1 FR_N_float = FR_ArgPrime, FR_Inv_pi_by_2, f0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     N = A' * 2/pi	
+//     N = A' * 2/pi
 //
-(p0)   fcvt.fx.s1 FR_N_fix = FR_N_float
-	nop.i 999 ;;
+       fcvt.fx.s1 FR_N_fix = FR_N_float
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     N_fix is the integer part	
+//     N_fix is the integer part
 //
-(p0)   fcvt.xf FR_N_float = FR_N_fix 
-	nop.i 999 ;;
+       fcvt.xf FR_N_float = FR_N_fix
+        nop.i 999 ;;
 }
 { .mfi
-(p0)   getf.sig GR_N_Inc = FR_N_fix
-	nop.f 999
-	nop.i 999 ;;
+       getf.sig GR_N_Inc = FR_N_fix
+        nop.f 999
+        nop.i 999 ;;
 }
 { .mii
-	nop.m 999
-	nop.i 999 ;;
-(p0)   add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos ;;
+        nop.m 999
+        nop.i 999 ;;
+       add GR_N_Inc = GR_N_Inc, GR_Sin_or_Cos ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     N is the integer part of the reduced-reduced argument.
 //     Put the integer in a GP register
 //
-(p0)   fnma.s1 FR_s = FR_N_float, FR_P_1, FR_ArgPrime
-	nop.i 999
+       fnma.s1 FR_s = FR_N_float, FR_P_1, FR_ArgPrime
+        nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fnma.s1 FR_w = FR_N_float, FR_P_2, FR_w
-	nop.i 999 ;;
+        nop.m 999
+       fnma.s1 FR_w = FR_N_float, FR_P_2, FR_w
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     s = -N*P_1 + Arg'
 //     w = -N*P_2 + w
 //     N_fix_gr = N_fix_gr + N_inc
 //
-(p0)   fcmp.lt.unc.s1 p9, p8 = FR_s, FR_Two_to_M14
-	nop.i 999 ;;
+       fcmp.lt.unc.s1 p9, p8 = FR_s, FR_Two_to_M14
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p9)   fcmp.gt.s1 p9, p8 = FR_s, FR_Neg_Two_to_M14
-	nop.i 999 ;;
+        nop.m 999
+(p9)   fcmp.gt.s1 p9, p8 = FR_s, FR_Neg_Two_to_M14  // p9 if |s| < 2^-14
+        nop.i 999 ;;
 }
+
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     For |s|  > 2**(-14) r = S + w (r complete)
 //     Else       U_hi = N_0 * d_1
 //
 (p9)   fma.s1 FR_V_hi = FR_N_float, FR_P_2, f0
-	nop.i 999
+        nop.i 999
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 (p9)   fma.s1 FR_U_hi = FR_N_0, FR_d_1, f0
-	nop.i 999 ;;
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     Either S <= -2**(-14) or S >= 2**(-14)
 //     or -2**(-14) < s < 2**(-14)
 //
 (p8)   fma.s1 FR_r = FR_s, f1, FR_w
-	nop.i 999
+        nop.i 999
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 (p9)   fma.s1 FR_w = FR_N_float, FR_P_3, f0
-	nop.i 999 ;;
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     We need abs of both U_hi and V_hi - don't
 //     worry about switched sign of V_hi.
 //
 (p9)   fms.s1 FR_A = FR_U_hi, f1, FR_V_hi
-	nop.i 999
+        nop.i 999
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     Big s: finish up c = (S - r) + w (c complete)	
+//     Big s: finish up c = (S - r) + w (c complete)
 //     Case 4: A =  U_hi + V_hi
 //     Note: Worry about switched sign of V_hi, so subtract instead of add.
 //
 (p9)   fnma.s1 FR_V_lo = FR_N_float, FR_P_2, FR_V_hi
-	nop.i 999 ;;
+        nop.i 999 ;;
 }
 { .mmf
-	nop.m 999
-	nop.m 999
+        nop.m 999
+        nop.m 999
 (p9)   fms.s1 FR_U_lo = FR_N_0, FR_d_1, FR_U_hi
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 (p9)   fmerge.s FR_V_hiabs = f0, FR_V_hi
-	nop.i 999 ;;
+        nop.i 999 ;;
 }
+//{ .mfb
+//(p9)   fmerge.s f8= FR_V_lo,FR_V_lo
+//(p9)   br.ret.sptk b0
+//}
+//;;
 { .mfi
-	nop.m 999
+        nop.m 999
 //     For big s: c = S - r
 //     For small s do more work: U_lo = N_0 * d_1 - U_hi
 //
 (p9)   fmerge.s FR_U_hiabs = f0, FR_U_hi
-	nop.i 999
+        nop.i 999
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     For big s: Is |r| < 2**(-3)	
+//     For big s: Is |r| < 2**(-3)
 //     For big s: if p12 set, prepare to branch to Small_R.
 //     For big s: If p13 set, prepare to branch to Normal_R.
 //
-(p8)   fms.s1 FR_c = FR_s, f1, FR_r 
-	nop.i 999 ;;
+(p8)   fms.s1 FR_c = FR_s, f1, FR_r
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     For small S: V_hi = N * P_2
 //                  w = N * P_3
@@ -1451,104 +1485,99 @@ L(SINCOSL_LARGER_ARG):
 //     so (-) missing for V_hi and w.
 //
 (p8)   fcmp.lt.unc.s1 p12, p13 = FR_r, FR_Two_to_M3
-	nop.i 999 ;;
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 (p12)  fcmp.gt.s1 p12, p13 = FR_r, FR_Neg_Two_to_M3
-	nop.i 999 ;;
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 (p8)   fma.s1 FR_c = FR_c, f1, FR_w
-	nop.i 999
+        nop.i 999
 }
 { .mfb
-	nop.m 999
+        nop.m 999
 (p9)   fms.s1 FR_w = FR_N_0, FR_d_2, FR_w
-(p12)  br.cond.spnt L(SINCOSL_SMALL_R) ;;
+(p12)  br.cond.spnt SINCOSL_SMALL_R      // Branch if |r| < 2^-3
+                                         // and 2^24 <= |x| < 2^63
 }
+;;
+
 { .mib
-	nop.m 999
-	nop.i 999
-(p13)  br.cond.sptk L(SINCOSL_NORMAL_R) ;;
+        nop.m 999
+        nop.i 999
+(p13)  br.cond.sptk SINCOSL_NORMAL_R     // Branch if |r| >= 2^-3
+                                         // and 2^24 <= |x| < 2^63
 }
+;;
+
+SINCOSL_LARGER_S_TINY:
+//
+// Here if |s| < 2^-14, and 2^24 <= |x| < 2^63
+//
 { .mfi
-	nop.m 999
-// 
-//     Big s: Vector off when |r| < 2**(-3).  Recall that p8 will be true. 
+        nop.m 999
+//
+//     Big s: Vector off when |r| < 2**(-3).  Recall that p8 will be true.
 //     The remaining stuff is for Case 4.
 //     Small s: V_lo = N * P_2 + U_hi (U_hi is in place of V_hi in writeup)
 //     Note: the (-) is still missing for V_lo.
 //     Small s: w = w + N_0 * d_2
 //     Note: the (-) is now incorporated in w.
 //
-(p9)   fcmp.ge.unc.s1 p10, p11 = FR_U_hiabs, FR_V_hiabs
-(p0)   extr.u	GR_i_1 = GR_N_Inc, 0, 1
+       fcmp.ge.unc.s1 p7, p8 = FR_U_hiabs, FR_V_hiabs
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     C_hi = S + A
 //
-(p9)   fma.s1 FR_t = FR_U_lo, f1, FR_V_lo
-(p0)   extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
+       fma.s1 FR_t = FR_U_lo, f1, FR_V_lo
 }
+;;
+
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     t = U_lo + V_lo 
+//     t = U_lo + V_lo
 //
 //
-(p10)  fms.s1 FR_a = FR_U_hi, f1, FR_A
-	nop.i 999 ;;
+(p7)  fms.s1 FR_a = FR_U_hi, f1, FR_A
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p11)  fma.s1 FR_a = FR_V_hi, f1, FR_A
-	nop.i 999
-}
-;;
-
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Base   = @ltoff(FSINCOSL_CONSTANTS#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
-      nop.i 999
+        nop.m 999
+(p8)  fma.s1 FR_a = FR_V_hi, f1, FR_A
+        nop.i 999
 }
 ;;
 
-
 { .mfi
-(p0)   add GR_Table_Base = 528, GR_Table_Base
 //
 //     Is U_hiabs >= V_hiabs?
 //
-(p9)   fma.s1 FR_C_hi = FR_s, f1, FR_A
-	nop.i 999 ;;
+        nop.m 999
+       fma.s1 FR_C_hi = FR_s, f1, FR_A
+        nop.i 999 ;;
 }
 { .mmi
-(p0)   ldfe FR_C_1 = [GR_Table_Base], 16 ;;
-(p0)   ldfe FR_C_2 = [GR_Table_Base], 64
-	nop.i 999 ;;
+       ldfe FR_C_1 = [GR_ad_c], 16 ;;
+       ldfe FR_C_2 = [GR_ad_c], 64
+        nop.i 999 ;;
 }
 //
 //     c = c + C_lo  finished.
 //     Load  C_2
 //
 { .mfi
-(p0)   ldfe	FR_S_1 = [GR_Table_Base], 16
+       ldfe        FR_S_1 = [GR_ad_s], 16
 //
-//     C_lo = S - C_hi 
+//     C_lo = S - C_hi
 //
-(p0)   fma.s1 FR_t = FR_t, f1, FR_w
-	nop.i 999 ;;
+       fma.s1 FR_t = FR_t, f1, FR_w
+        nop.i 999 ;;
 }
 //
 //     r and c have been computed.
@@ -1558,855 +1587,695 @@ L(SINCOSL_LARGER_ARG):
 //     Load S_1
 //
 { .mfi
-(p0)   ldfe FR_S_2 = [GR_Table_Base], 64
+       ldfe FR_S_2 = [GR_ad_s], 64
 //
-//     t = t + w	
+//     t = t + w
 //
-(p10)  fms.s1 FR_a = FR_a, f1, FR_V_hi
-(p0)   cmp.eq.unc p9, p10 = 0x0, GR_i_0 ;;
+(p7)  fms.s1 FR_a = FR_a, f1, FR_V_hi
+      tbit.z p9,p10 = GR_N_Inc, 0      // p9  if i_1=0, N mod 4 = 0,1
+                                       // p10 if i_1=1, N mod 4 = 2,3
 }
+;;
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     For larger u than v: a = U_hi - A
 //     Else a = V_hi - A (do an add to account for missing (-) on V_hi
 //
-(p0)   fms.s1 FR_C_lo = FR_s, f1, FR_C_hi
-	nop.i 999 ;;
+       fms.s1 FR_C_lo = FR_s, f1, FR_C_hi
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p11)  fms.s1 FR_a = FR_U_hi, f1, FR_a
-(p0)   cmp.eq.unc p11, p12 = 0x0, GR_i_1 ;;
+        nop.m 999
+(p8)  fms.s1 FR_a = FR_U_hi, f1, FR_a
+      tbit.z p11,p12 = GR_N_Inc, 1     // p11 if i_0=0, N mod 4 = 0,2
+                                       // p12 if i_0=1, N mod 4 = 1,3
 }
+;;
+
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     If u > v: a = (U_hi - A)  + V_hi
 //     Else      a = (V_hi - A)  + U_hi
 //     In each case account for negative missing from V_hi.
 //
-(p0)   fma.s1 FR_C_lo = FR_C_lo, f1, FR_A
-	nop.i 999 ;;
+       fma.s1 FR_C_lo = FR_C_lo, f1, FR_A
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     C_lo = (S - C_hi) + A	
+//     C_lo = (S - C_hi) + A
 //
-(p0)   fma.s1 FR_t = FR_t, f1, FR_a
-	nop.i 999 ;;
+       fma.s1 FR_t = FR_t, f1, FR_a
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     t = t + a 
+//     t = t + a
 //
-(p0)   fma.s1 FR_C_lo = FR_C_lo, f1, FR_t
-	nop.i 999 ;;
+       fma.s1 FR_C_lo = FR_C_lo, f1, FR_t
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     C_lo = C_lo + t
-//     Adjust Table_Base to beginning of table
 //
-(p0)   fma.s1 FR_r = FR_C_hi, f1, FR_C_lo
-	nop.i 999 ;;
+       fma.s1 FR_r = FR_C_hi, f1, FR_C_lo
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     Load S_2
 //
-(p0)   fma.s1 FR_rsq = FR_r, FR_r, f0
-	nop.i 999
+       fma.s1 FR_rsq = FR_r, FR_r, f0
+        nop.i 999
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     Table_Base points to C_1
 //     r = C_hi + C_lo
 //
-(p0)   fms.s1 FR_c = FR_C_hi, f1, FR_r
-	nop.i 999 ;;
+       fms.s1 FR_c = FR_C_hi, f1, FR_r
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     if i_1 ==0: poly = S_2 * FR_rsq + S_1
 //     else        poly = C_2 * FR_rsq + C_1
 //
-(p11)  fma.s1 FR_Input_X = f0, f1, FR_r
-	nop.i 999 ;;
+(p9)  fma.s1 FR_tmp_result = f0, f1, FR_r
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p12)  fma.s1 FR_Input_X = f0, f1, f1
-	nop.i 999 ;;
+        nop.m 999
+(p10)  fma.s1 FR_tmp_result = f0, f1, f1
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     Compute r_cube = FR_rsq * r	
+//     Compute r_cube = FR_rsq * r
 //
-(p11)  fma.s1 FR_poly = FR_rsq, FR_S_2, FR_S_1
-	nop.i 999 ;;
+(p9)  fma.s1 FR_poly = FR_rsq, FR_S_2, FR_S_1
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p12)  fma.s1 FR_poly = FR_rsq, FR_C_2, FR_C_1
-	nop.i 999
+        nop.m 999
+(p10)  fma.s1 FR_poly = FR_rsq, FR_C_2, FR_C_1
+        nop.i 999
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     Compute FR_rsq = r * r
 //     Is i_1 == 0 ?
 //
-(p0)   fma.s1 FR_r_cubed = FR_rsq, FR_r, f0
-	nop.i 999 ;;
+       fma.s1 FR_r_cubed = FR_rsq, FR_r, f0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     c = C_hi - r
 //     Load  C_1
 //
-(p0)   fma.s1 FR_c = FR_c, f1, FR_C_lo
-	nop.i 999
+       fma.s1 FR_c = FR_c, f1, FR_C_lo
+        nop.i 999
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     if i_1 ==0: poly = r_cube * poly + c
 //     else        poly = FR_rsq * poly
 //
-(p10)  fms.s1 FR_Input_X = f0, f1, FR_Input_X
-	nop.i 999 ;;
+(p12)  fms.s1 FR_tmp_result = f0, f1, FR_tmp_result
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
 //     if i_1 ==0: Result = r
 //     else        Result = 1.0
 //
-(p11)  fma.s1 FR_poly = FR_r_cubed, FR_poly, FR_c
-	nop.i 999 ;;
+(p9)  fma.s1 FR_poly = FR_r_cubed, FR_poly, FR_c
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p12)  fma.s1 FR_poly = FR_rsq, FR_poly, f0
-	nop.i 999 ;;
+        nop.m 999
+(p10)  fma.s1 FR_poly = FR_rsq, FR_poly, f0
+        nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+        nop.m 999
 //
-//     if i_0 !=0: Result = -Result 
+//     if i_0 !=0: Result = -Result
 //
-(p9)   fma.s0 FR_Input_X = FR_Input_X, f1, FR_poly
-	nop.i 999 ;;
+(p11)   fma.s0 FR_Result = FR_tmp_result, f1, FR_poly
+        nop.i 999 ;;
 }
 { .mfb
-	nop.m 999
-(p10)  fms.s0 FR_Input_X = FR_Input_X, f1, FR_poly
+        nop.m 999
+(p12)  fms.s0 FR_Result = FR_tmp_result, f1, FR_poly
 //
 //     if i_0 == 0: Result = Result + poly
 //     else         Result = Result - poly
 //
-(p0)    br.ret.sptk   b0 ;;
+      br.ret.sptk   b0         // Exit for |s| < 2^-14, and 2^24 <= |x| < 2^63
 }
-L(SINCOSL_SMALL_R): 
-{ .mii
-	nop.m 999
-(p0)  	extr.u	GR_i_1 = GR_N_Inc, 0, 1 ;;
+;;
+
+
+SINCOSL_SMALL_R:
+//
+// Here if |r| < 2^-3
 //
+// Enter with r, c, and N_Inc computed
 //
 //      Compare both i_1 and i_0 with 0.
 //      if i_1 == 0, set p9.
 //      if i_0 == 0, set p11.
 //
-(p0)  	cmp.eq.unc p9, p10 = 0x0, GR_i_1 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)  	fma.s1 FR_rsq = FR_r, FR_r, f0
-(p0)  	extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
-}
+
 { .mfi
-	nop.m 999
-//
-// 	Z = Z * FR_rsq 
-//
-(p10)	fnma.s1	FR_c = FR_c, FR_r, f0
-(p0)  	cmp.eq.unc p11, p12 = 0x0, GR_i_0
+      nop.m 999
+      fma.s1 FR_rsq = FR_r, FR_r, f0   // rsq = r * r
+      tbit.z p9,p10 = GR_N_Inc, 0      // p9  if i_1=0, N mod 4 = 0,1
+                                       // p10 if i_1=1, N mod 4 = 2,3
 }
 ;;
 
-// ******************************************************************
-// ******************************************************************
-// ******************************************************************
-//      r and c have been computed.
-//      We know whether this is the sine or cosine routine.
-//      Make sure ftz mode is set - should be automatic when using wre
-//      |r| < 2**(-3)
-//
-//      Set table_ptr1 to beginning of constant table.
-//      Get [i_0,i_1] - two lsb of N_fix_gr.
-//
-
 { .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Base   = @ltoff(FSINCOSL_CONSTANTS#), gp
+(p9)  ldfe FR_S_5 = [GR_ad_se], -16    // Load S_5 if i_1=0
+(p10) ldfe FR_C_5 = [GR_ad_ce], -16    // Load C_5 if i_1=1
       nop.i 999
 }
 ;;
 
 { .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
+(p9)  ldfe FR_S_4 = [GR_ad_se], -16    // Load S_4 if i_1=0
+(p10) ldfe FR_C_4 = [GR_ad_ce], -16    // Load C_4 if i_1=1
       nop.i 999
 }
 ;;
 
-
-// 
-//      Set table_ptr1 to point to S_5.
-//      Set table_ptr1 to point to C_5.
-//      Compute FR_rsq = r * r
-//
-{ .mfi
-(p9)  	add GR_Table_Base = 672, GR_Table_Base
-(p10)	fmerge.s FR_r = f1, f1
-(p10) 	add GR_Table_Base = 592, GR_Table_Base ;;
+SINCOSL_SMALL_R_0:
+// Entry point for 2^-3 < |x| < pi/4
+.pred.rel "mutex",p9,p10
+SINCOSL_SMALL_R_1:
+// Entry point for pi/4 < |x| < 2^24 and |r| < 2^-3
+.pred.rel "mutex",p9,p10
+{ .mfi
+(p9)  ldfe FR_S_3 = [GR_ad_se], -16    // Load S_3 if i_1=0
+      fma.s1 FR_Z = FR_rsq, FR_rsq, f0 // Z = rsq * rsq
+      nop.i 999
 }
-// 
-//      Set table_ptr1 to point to S_5.
-//      Set table_ptr1 to point to C_5.
-//
-{ .mmi
-(p9)  	ldfe FR_S_5 = [GR_Table_Base], -16 ;;
-//
-//      if (i_1 == 0) load S_5
-//      if (i_1 != 0) load C_5
-//
-(p9)  	ldfe FR_S_4 = [GR_Table_Base], -16
-	nop.i 999 ;;
+{ .mfi
+(p10) ldfe FR_C_3 = [GR_ad_ce], -16    // Load C_3 if i_1=1
+(p10) fnma.s1 FR_c = FR_c, FR_r, f0    // c = -c * r if i_1=0
+      nop.i 999
 }
+;;
+
 { .mmf
-(p10) 	ldfe FR_C_5 = [GR_Table_Base], -16
-// 
-//      Z = FR_rsq * FR_rsq
-//
-(p9)  	ldfe FR_S_3 = [GR_Table_Base], -16
-//
-//      Compute FR_rsq = r * r
-//      if (i_1 == 0) load S_4
-//      if (i_1 != 0) load C_4
-//
-(p0)   	fma.s1 FR_Z = FR_rsq, FR_rsq, f0 ;;
-}
-//
-//      if (i_1 == 0) load S_3
-//      if (i_1 != 0) load C_3
-//
-{ .mmi
-(p9)  	ldfe FR_S_2 = [GR_Table_Base], -16 ;;
-//
-//      if (i_1 == 0) load S_2
-//      if (i_1 != 0) load C_2
-//
-(p9)  	ldfe FR_S_1 = [GR_Table_Base], -16
-	nop.i 999
-}
-{ .mmi
-(p10) 	ldfe FR_C_4 = [GR_Table_Base], -16 ;;
-(p10)  	ldfe FR_C_3 = [GR_Table_Base], -16
-	nop.i 999 ;;
+(p9)  ldfe FR_S_2 = [GR_ad_se], -16    // Load S_2 if i_1=0
+(p10) ldfe FR_C_2 = [GR_ad_ce], -16    // Load C_2 if i_1=1
+(p10) fmerge.s FR_r = f1, f1
 }
+;;
+
 { .mmi
-(p10) 	ldfe FR_C_2 = [GR_Table_Base], -16 ;;
-(p10) 	ldfe FR_C_1 = [GR_Table_Base], -16
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-//
-//      if (i_1 != 0):
-//      poly_lo = FR_rsq * C_5 + C_4
-//      poly_hi = FR_rsq * C_2 + C_1
-//
-(p9)  	fma.s1 FR_Z = FR_Z, FR_r, f0
-	nop.i 999 ;;
+(p9)  ldfe FR_S_1 = [GR_ad_se], -16    // Load S_1 if i_1=0
+(p10) ldfe FR_C_1 = [GR_ad_ce], -16    // Load C_1 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1 == 0) load S_1
-//      if (i_1 != 0) load C_1
-//
-(p9)  	fma.s1 FR_poly_lo = FR_rsq, FR_S_5, FR_S_4
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_Z = FR_Z, FR_r, f0     // Z = Z * r if i_1=0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      c = -c * r
-//      dummy fmpy's to flag inexact.
-//
-(p9)	fma.s0 FR_S_4 = FR_S_4, FR_S_4, f0
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_rsq, FR_S_5, FR_S_4 // poly_lo=rsq*S_5+S_4 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      poly_lo = FR_rsq * poly_lo + C_3
-//      poly_hi = FR_rsq * poly_hi
-//
-(p0)    fma.s1	FR_Z = FR_Z, FR_rsq, f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly_lo = FR_rsq, FR_C_5, FR_C_4 // poly_lo=rsq*C_5+C_4 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p9)  	fma.s1 FR_poly_hi = FR_rsq, FR_S_2, FR_S_1
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_poly_hi = FR_rsq, FR_S_2, FR_S_1 // poly_hi=rsq*S_2+S_1 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      if (i_1 == 0):
-//      poly_lo = FR_rsq * S_5 + S_4
-//      poly_hi = FR_rsq * S_2 + S_1
-//
-(p10) 	fma.s1 FR_poly_lo = FR_rsq, FR_C_5, FR_C_4
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly_hi = FR_rsq, FR_C_2, FR_C_1 // poly_hi=rsq*C_2+C_1 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1 == 0):
-//      Z = Z * r  for only one of the small r cases - not there
-//      in original implementation notes.
-// 
-(p9)  	fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_S_3
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_Z = FR_Z, FR_rsq, f0             // Z = Z * rsq
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10) 	fma.s1 FR_poly_hi = FR_rsq, FR_C_2, FR_C_1
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_S_3 // p_lo=p_lo*rsq+S_3, i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10)	fma.s0 FR_C_1 = FR_C_1, FR_C_1, f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_C_3 // p_lo=p_lo*rsq+C_3, i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p9)  	fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0
-	nop.i 999
+      nop.m 999
+(p9)  fma.s0 FR_inexact = FR_S_4, FR_S_4, f0     // Dummy op to set inexact
+      tbit.z p11,p12 = GR_N_Inc, 1     // p11 if i_0=0, N mod 4 = 0,2
+                                       // p12 if i_0=1, N mod 4 = 1,3
 }
 { .mfi
-	nop.m 999
-//
-//      poly_lo = FR_rsq * poly_lo + S_3
-//      poly_hi = FR_rsq * poly_hi
-//
-(p10) 	fma.s1 FR_poly_lo = FR_rsq, FR_poly_lo, FR_C_3
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s0 FR_inexact = FR_C_1, FR_C_1, f0     // Dummy op to set inexact
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10) 	fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0     // p_hi=p_hi*rsq if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-// 	if (i_1 == 0): dummy fmpy's to flag inexact
-// 	r = 1
-//
-(p9)	fma.s1 FR_poly_hi = FR_r, FR_poly_hi, f0
-	nop.i 999
+      nop.m 999
+(p10) fma.s1 FR_poly_hi = FR_poly_hi, FR_rsq, f0     // p_hi=p_hi*rsq if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-// 	poly_hi = r * poly_hi 
-//
-(p0)    fma.s1	FR_poly = FR_Z, FR_poly_lo, FR_c
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly = FR_Z, FR_poly_lo, FR_c        // poly=Z*poly_lo+c
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p12)	fms.s1	FR_r = f0, f1, FR_r
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly_hi = FR_r, FR_poly_hi, f0       // p_hi=r*p_hi if i_1=0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      poly_hi = Z * poly_lo + c	
-// 	if i_0 == 1: r = -r     
-//
-(p0) 	fma.s1	FR_poly = FR_poly, f1, FR_poly_hi
-	nop.i 999 ;;
+      nop.m 999
+(p12) fms.s1 FR_r = f0, f1, FR_r                     // r = -r if i_0=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p12)	fms.s0 FR_Input_X = FR_r, f1, FR_poly
-	nop.i 999
+      nop.m 999
+      fma.s1 FR_poly = FR_poly, f1, FR_poly_hi       // poly=poly+poly_hi
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
-//
-//      poly = poly + poly_hi	
-//
-(p11)	fma.s0 FR_Input_X = FR_r, f1, FR_poly
+;;
+
 //
 //      if (i_0 == 0) Result = r + poly
 //      if (i_0 != 0) Result = r - poly
 //
-(p0)    br.ret.sptk   b0 ;;
-}
-L(SINCOSL_NORMAL_R): 
-{ .mii
-	nop.m 999
-(p0)	extr.u	GR_i_1 = GR_N_Inc, 0, 1 ;;
-//
-//      Set table_ptr1 and table_ptr2 to base address of
-//      constant table.
-(p0)	cmp.eq.unc p9, p10 = 0x0, GR_i_1 ;;
-}
 { .mfi
-	nop.m 999
-(p0)	fma.s1	FR_rsq = FR_r, FR_r, f0
-(p0)	extr.u	GR_i_0 = GR_N_Inc, 1, 1 ;;
+      nop.m 999
+(p11) fma.s0 FR_Result = FR_r, f1, FR_poly
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
-(p0)	frcpa.s1 FR_r_hi, p6 = f1, FR_r
-(p0)	cmp.eq.unc p11, p12 = 0x0, GR_i_0
+{ .mfb
+      nop.m 999
+(p12) fms.s0 FR_Result = FR_r, f1, FR_poly
+      br.ret.sptk   b0                               // Exit for |r| < 2^-3
 }
 ;;
 
-// ******************************************************************
-// ******************************************************************
-// ******************************************************************
+
+SINCOSL_NORMAL_R:
 //
-//      r and c have been computed.
-//      We known whether this is the sine or cosine routine.
-//      Make sure ftz mode is set - should be automatic when using wre
-//      Get [i_0,i_1] - two lsb of N_fix_gr alone.
+// Here if 2^-3 <= |r| < pi/4
+// THIS IS THE MAIN PATH
 //
-
-{ .mmi
-      nop.m 999
-(p0)  addl           GR_Table_Base   = @ltoff(FSINCOSL_CONSTANTS#), gp
+// Enter with r, c, and N_Inc having been computed
+//
+{ .mfi
+      ldfe FR_PP_6 = [GR_ad_pp], 16    // Load PP_6
+      fma.s1 FR_rsq = FR_r, FR_r, f0   // rsq = r * r
+      tbit.z p9,p10 = GR_N_Inc, 0      // p9  if i_1=0, N mod 4 = 0,1
+                                       // p10 if i_1=1, N mod 4 = 2,3
+}
+{ .mfi
+      ldfe FR_QQ_6 = [GR_ad_qq], 16    // Load QQ_6
+      nop.f 999
       nop.i 999
 }
 ;;
 
 { .mmi
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.m 999
+(p9)  ldfe FR_PP_5 = [GR_ad_pp], 16    // Load PP_5 if i_1=0
+(p10) ldfe FR_QQ_5 = [GR_ad_qq], 16    // Load QQ_5 if i_1=1
       nop.i 999
 }
 ;;
 
+SINCOSL_NORMAL_R_0:
+// Entry for 2^-3 < |x| < pi/4
+.pred.rel "mutex",p9,p10
+{ .mmf
+(p9)  ldfe FR_C_1 = [GR_ad_pp], 16     // Load C_1 if i_1=0
+(p10) ldfe FR_S_1 = [GR_ad_qq], 16     // Load S_1 if i_1=1
+      frcpa.s1 FR_r_hi, p6 = f1, FR_r  // r_hi = frcpa(r)
+}
+;;
 
 { .mfi
-(p10)	add GR_Table_Base = 384, GR_Table_Base
-(p12)	fms.s1 FR_Input_X = f0, f1, f1
-(p9)	add GR_Table_Base = 224, GR_Table_Base ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly = FR_rsq, FR_PP_8, FR_PP_7 // poly = rsq*PP_8+PP_7 if i_1=0
+      nop.i 999
 }
 { .mfi
-(p10)	ldfe FR_QQ_8 = [GR_Table_Base], 16
-//
-//      if (i_1==0) poly = poly * FR_rsq + PP_1_lo
-//      else        poly = FR_rsq * poly
-//
-(p11)	fma.s1 FR_Input_X = f0, f1, f1
-	nop.i 999 ;;
-}
-{ .mmb
-(p10)	ldfe FR_QQ_7 = [GR_Table_Base], 16
-//
-// 	Adjust table pointers based on i_0 
-//      Compute rsq = r * r
-//
-(p9)	ldfe FR_PP_8 = [GR_Table_Base], 16
-	nop.b 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly = FR_rsq, FR_QQ_8, FR_QQ_7 // poly = rsq*QQ_8+QQ_7 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)	fma.s1 FR_r_cubed = FR_r, FR_rsq, f0
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_r_cubed = FR_r, FR_rsq, f0  // rcubed = r * rsq
+      nop.i 999
 }
+;;
+
+
+SINCOSL_NORMAL_R_1:
+// Entry for pi/4 <= |x| < 2^24
+.pred.rel "mutex",p9,p10
 { .mmf
-(p9)	ldfe FR_PP_7 = [GR_Table_Base], 16
-(p10)	ldfe FR_QQ_6 = [GR_Table_Base], 16
-//
-//      Load PP_8 and QQ_8; PP_7 and QQ_7
-//
-(p0)	frcpa.s1 FR_r_hi, p6 = f1, FR_r_hi ;;
-}
-//
-//      if (i_1==0) poly =   PP_7 + FR_rsq * PP_8.
-//      else        poly =   QQ_7 + FR_rsq * QQ_8.
-//
-{ .mmb
-(p9)	ldfe FR_PP_6 = [GR_Table_Base], 16
-(p10)	ldfe FR_QQ_5 = [GR_Table_Base], 16
-	nop.b 999 ;;
-}
-{ .mmb
-(p9)	ldfe FR_PP_5 = [GR_Table_Base], 16
-(p10)	ldfe FR_S_1 = [GR_Table_Base], 16
-	nop.b 999 ;;
-}
-{ .mmb
-(p10)	ldfe FR_QQ_1 = [GR_Table_Base], 16
-(p9)	ldfe FR_C_1 = [GR_Table_Base], 16
-	nop.b 999 ;;
-}
-{ .mmb
-(p10)	ldfe FR_QQ_4 = [GR_Table_Base], 16
-(p9)	ldfe FR_PP_1 = [GR_Table_Base], 16
-	nop.b 999 ;;
-}
-{ .mmb
-(p10)	ldfe FR_QQ_3 = [GR_Table_Base], 16
-//
-//      if (i_1=0) corr = corr + c*c
-//      else       corr = corr * c 
-//
-(p9)	ldfe FR_PP_4 = [GR_Table_Base], 16
-	nop.b 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_QQ_8, FR_QQ_7
-	nop.i 999 ;;
-}
-//
-//      if (i_1=0) poly = rsq * poly + PP_5 
-//      else       poly = rsq * poly + QQ_5 
-//      Load PP_4 or QQ_4
-//
-{ .mmi
-(p9)	ldfe FR_PP_3 = [GR_Table_Base], 16 ;;
-(p10)	ldfe FR_QQ_2 = [GR_Table_Base], 16
-	nop.i 999
+(p9)  ldfe FR_PP_1 = [GR_ad_pp], 16             // Load PP_1_hi if i_1=0
+(p10) ldfe FR_QQ_1 = [GR_ad_qq], 16             // Load QQ_1    if i_1=1
+      frcpa.s1 FR_r_hi, p6 = f1, FR_r_hi        // r_hi = frpca(frcpa(r))
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      r_hi =   frcpa(frcpa(r)).
-//      r_cube = r * FR_rsq.
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_PP_8, FR_PP_7
-	nop.i 999 ;;
+(p9)  ldfe FR_PP_4 = [GR_ad_pp], 16             // Load PP_4 if i_1=0
+(p9)  fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_6 // poly = rsq*poly+PP_6 if i_1=0
+      nop.i 999
 }
-//
-//      Do dummy multiplies so inexact is always set. 
-//
 { .mfi
-(p9)	ldfe FR_PP_2 = [GR_Table_Base], 16
-//
-//      r_lo = r - r_hi	
-//
-(p9)	fma.s1 FR_U_lo = FR_r_hi, FR_r_hi, f0
-	nop.i 999 ;;
-}
-{ .mbb
-(p9)	ldfe FR_PP_1_lo = [GR_Table_Base], 16
-	nop.b 999
-	nop.b 999 ;;
+(p10) ldfe FR_QQ_4 = [GR_ad_qq], 16             // Load QQ_4 if i_1=1
+(p10) fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_6 // poly = rsq*poly+QQ_6 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_corr = FR_S_1, FR_r_cubed, FR_r
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_corr = FR_C_1, FR_rsq, f0       // corr = C_1 * rsq if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_6
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_corr = FR_S_1, FR_r_cubed, FR_r // corr = S_1 * r^3 + r if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1=0) U_lo = r_hi * r_hi
-//      else       U_lo = r_hi + r
-//
-(p9)	fma.s1 FR_corr = FR_C_1, FR_rsq, f0
-	nop.i 999 ;;
+(p9)  ldfe FR_PP_3 = [GR_ad_pp], 16             // Load PP_3 if i_1=0
+      fma.s1 FR_r_hi_sq = FR_r_hi, FR_r_hi, f0  // r_hi_sq = r_hi * r_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      if (i_1=0) corr = C_1 * rsq
-//      else       corr = S_1 * r_cubed + r
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_6
-	nop.i 999 ;;
+(p10) ldfe FR_QQ_3 = [GR_ad_qq], 16             // Load QQ_3 if i_1=1
+      fms.s1 FR_r_lo = FR_r, f1, FR_r_hi        // r_lo = r - r_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_U_lo = FR_r_hi, f1, FR_r
-	nop.i 999
+(p9)  ldfe FR_PP_2 = [GR_ad_pp], 16             // Load PP_2 if i_1=0
+(p9)  fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_5 // poly = rsq*poly+PP_5 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      if (i_1=0) U_hi = r_hi + U_hi 
-//      else       U_hi = QQ_1 * U_hi + 1
-//
-(p9)	fma.s1 FR_U_lo = FR_r, FR_r_hi, FR_U_lo
-	nop.i 999 ;;
+(p10) ldfe FR_QQ_2 = [GR_ad_qq], 16             // Load QQ_2 if i_1=1
+(p10) fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_5 // poly = rsq*poly+QQ_5 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      U_hi = r_hi * r_hi	
-//
-(p0)	fms.s1 FR_r_lo = FR_r, f1, FR_r_hi
-	nop.i 999
+(p9)  ldfe FR_PP_1_lo = [GR_ad_pp], 16          // Load PP_1_lo if i_1=0
+(p9)  fma.s1 FR_corr = FR_corr, FR_c, FR_c      // corr = corr * c + c if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      Load PP_1, PP_6, PP_5, and C_1
-//      Load QQ_1, QQ_6, QQ_5, and S_1
-//
-(p0)	fma.s1 FR_U_hi = FR_r_hi, FR_r_hi, f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fnma.s1 FR_corr = FR_corr, FR_c, f0       // corr = -corr * c if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_5
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_U_lo = FR_r, FR_r_hi, FR_r_hi_sq // U_lo = r*r_hi+r_hi_sq, i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10)	fnma.s1	FR_corr = FR_corr, FR_c, f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_U_lo = FR_r_hi, f1, FR_r        // U_lo = r_hi + r if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1=0) U_lo = r * r_hi + U_lo 
-//      else       U_lo = r_lo * U_lo
-//
-(p9)	fma.s1 FR_corr = FR_corr, FR_c, FR_c
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_U_hi = FR_r_hi, FR_r_hi_sq, f0  // U_hi = r_hi*r_hi_sq if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_5
-	nop.i 999
+      nop.m 999
+(p10) fma.s1 FR_U_hi = FR_QQ_1, FR_r_hi_sq, f1  // U_hi = QQ_1*r_hi_sq+1, i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1 =0) U_hi = r + U_hi
-//      if (i_1 =0) U_lo = r_lo * U_lo 
-//      
-//
-(p9)	fma.s0 FR_PP_5 = FR_PP_5, FR_PP_4, f0
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_4 // poly = poly*rsq+PP_4 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p9)	fma.s1 FR_U_lo = FR_r, FR_r, FR_U_lo
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_4 // poly = poly*rsq+QQ_4 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_U_lo = FR_r, FR_r, FR_U_lo      // U_lo = r * r + U_lo if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      if (i_1=0) poly = poly * rsq + PP_6
-//      else       poly = poly * rsq + QQ_6 
-//
-(p9)	fma.s1 FR_U_hi = FR_r_hi, FR_U_hi, f0
-	nop.i 999
+      nop.m 999
+(p10) fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0     // U_lo = r_lo * U_lo if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_4
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_U_hi = FR_PP_1, FR_U_hi, f0     // U_hi = PP_1 * U_hi if i_1=0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_U_hi = FR_QQ_1, FR_U_hi, f1
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_3 // poly = poly*rsq+PP_3 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10)	fma.s0 FR_QQ_5 = FR_QQ_5, FR_QQ_5, f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_3 // poly = poly*rsq+QQ_3 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1!=0) U_hi = PP_1 * U_hi  
-//      if (i_1!=0) U_lo = r * r  + U_lo  
-//      Load PP_3 or QQ_3
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_4
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0     // U_lo = r_lo * U_lo if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p9)	fma.s1 FR_U_lo = FR_r_lo, FR_U_lo, f0
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_U_lo = FR_QQ_1,FR_U_lo, f0      // U_lo = QQ_1 * U_lo if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_U_lo = FR_QQ_1,FR_U_lo, f0
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_U_hi = FR_r, f1, FR_U_hi        // U_hi = r + U_hi if i_1=0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p9)	fma.s1 FR_U_hi = FR_PP_1, FR_U_hi, f0
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_2 // poly = poly*rsq+PP_2 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_3
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_2 // poly = poly*rsq+QQ_2 if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      Load PP_2, QQ_2
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_3
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_U_lo = FR_PP_1, FR_U_lo, f0     // U_lo = PP_1 * U_lo if i_1=0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1==0) poly = FR_rsq * poly  + PP_3
-//      else        poly = FR_rsq * poly  + QQ_3
-//      Load PP_1_lo
-//
-(p9)	fma.s1 FR_U_lo = FR_PP_1, FR_U_lo, f0
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_1_lo // poly =poly*rsq+PP1lo i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      if (i_1 =0) poly = poly * rsq + pp_r4
-//      else        poly = poly * rsq + qq_r4
-//
-(p9)	fma.s1 FR_U_hi = FR_r, f1, FR_U_hi
-	nop.i 999
+      nop.m 999
+(p10) fma.s1 FR_poly = FR_rsq, FR_poly, f0      // poly = poly*rsq if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_QQ_2
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_V = FR_U_lo, f1, FR_corr        // V = U_lo + corr
+      tbit.z p11,p12 = GR_N_Inc, 1              // p11 if i_0=0, N mod 4 = 0,2
+                                                // p12 if i_0=1, N mod 4 = 1,3
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1==0) U_lo =  PP_1_hi * U_lo
-//      else        U_lo =  QQ_1 * U_lo
-//
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_2
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s0 FR_inexact = FR_PP_5, FR_PP_4, f0  // Dummy op to set inexact
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      if (i_0==0)  Result = 1
-//      else         Result = -1
-//
-(p0) 	fma.s1 FR_V = FR_U_lo, f1, FR_corr
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s0 FR_inexact = FR_QQ_5, FR_QQ_5, f0  // Dummy op to set inexact
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, f0
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly = FR_r_cubed, FR_poly, f0  // poly = poly*r^3 if i_1=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      if (i_1==0) poly =  FR_rsq * poly + PP_2
-//      else poly =  FR_rsq * poly + QQ_2
-// 
-(p9)	fma.s1 FR_poly = FR_rsq, FR_poly, FR_PP_1_lo
-	nop.i 999 ;;
+      nop.m 999
+(p10) fma.s1 FR_poly = FR_rsq, FR_poly, f0      // poly = poly*rsq if i_1=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)	fma.s1 FR_poly = FR_rsq, FR_poly, f0
-	nop.i 999 ;;
+      nop.m 999
+(p11) fma.s1 FR_tmp_result = f0, f1, f1// tmp_result=+1.0 if i_0=0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//      V = U_lo + corr
-//
-(p9)	fma.s1 FR_poly = FR_r_cubed, FR_poly, f0
-	nop.i 999 ;;
+      nop.m 999
+(p12) fms.s1 FR_tmp_result = f0, f1, f1// tmp_result=-1.0 if i_0=1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//      if (i_1==0) poly = r_cube * poly
-//      else        poly = FR_rsq * poly
-//
-(p0)	fma.s1	FR_V = FR_poly, f1, FR_V
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_V = FR_poly, f1, FR_V           // V = poly + V
+      nop.i 999
 }
+;;
+
+// If i_0 = 0  Result =  U_hi + V
+// If i_0 = 1  Result = -U_hi - V
 { .mfi
-	nop.m 999
-(p12)	fms.s0 FR_Input_X = FR_Input_X, FR_U_hi, FR_V
-	nop.i 999
+        nop.m 999
+(p11)        fma.s0 FR_Result = FR_tmp_result, FR_U_hi, FR_V
+        nop.i 999
 }
 { .mfb
-	nop.m 999
-//
-//      V = V + poly	
-//
-(p11)	fma.s0 FR_Input_X = FR_Input_X, FR_U_hi, FR_V
-//
-//      if (i_0==0) Result = Result * U_hi + V
-//      else        Result = Result * U_hi - V
-//
-(p0)    br.ret.sptk   b0 
-};;
-
-//
-//    	If cosine, FR_Input_X = 1
-//    	If sine, FR_Input_X = +/-Zero (Input FR_Input_X)
-//    	Results are exact, no exceptions
-//
+        nop.m 999
+(p12)        fms.s0 FR_Result = FR_tmp_result, FR_U_hi, FR_V
+        br.ret.sptk   b0                     // Exit for 2^-3 <= |r| < pi/4
+}
+;;
 
-L(SINCOSL_ZERO):
-{ .mbb
-(p0)    cmp.eq.unc p6, p7 = 0x1, GR_Sin_or_Cos
-        nop.b 999
-        nop.b 999 ;;
+SINCOSL_ZERO:
+// Here if x = 0
+{ .mfi
+      cmp.eq.unc p6, p7 = 0x1, GR_Sin_or_Cos
+      nop.f 999
+      nop.i 999
 }
+;;
+
 { .mfi
-        nop.m 999
-(p7)    fmerge.s FR_Input_X = FR_Input_X, FR_Input_X
-        nop.i 999
+      nop.m 999
+(p7)  fmerge.s FR_Result = FR_Input_X, FR_Input_X // If sin, result = input
+      nop.i 999
 }
 { .mfb
-        nop.m 999
-(p6)    fmerge.s FR_Input_X = f1, f1
-(p0)    br.ret.sptk   b0 ;;
+      nop.m 999
+(p6)  fma.s0 FR_Result = f1, f1, f0    // If cos, result=1.0
+      br.ret.sptk   b0                  // Exit for x=0
+}
+;;
+
+
+SINCOSL_DENORMAL:
+{ .mmb
+      getf.exp GR_signexp_x = FR_norm_x   // Get sign and exponent of x
+      nop.m 999
+      br.cond.sptk  SINCOSL_COMMON        // Return to common code
 }
-L(SINCOSL_SPECIAL):
+;;
+
+SINCOSL_SPECIAL:
 { .mfb
         nop.m 999
 //
@@ -2414,106 +2283,83 @@ L(SINCOSL_SPECIAL):
 //      Invalid can be raised. SNaNs
 //      become QNaNs
 //
-(p0)    fmpy.s0 FR_Input_X = FR_Input_X, f0
-(p0)    br.ret.sptk   b0 ;;
+        fmpy.s0 FR_Result = FR_Input_X, f0
+        br.ret.sptk   b0 ;;
 }
-.endp cosl#
-ASM_SIZE_DIRECTIVE(cosl#)
 
-//      Call int pi_by_2_reduce(double* x, double *y)
-//      for |arguments| >= 2**63
-//      Address to save r and c as double 
-//
-//             sp+32  -> f0
-//      r45    sp+16  -> f0
-//      r44 -> sp     -> InputX  
-//      
+GLOBAL_IEEE754_END(cosl)
 
-.proc __libm_callout
-__libm_callout:
-L(SINCOSL_ARG_TOO_LARGE): 
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
+//
+//     Special Code to handle very large argument case.
+//     Call int __libm_pi_by_2_reduce(x,r,c) for |arguments| >= 2**63
+//     The interface is custom:
+//       On input:
+//         (Arg or x) is in f8
+//       On output:
+//         r is in f8
+//         c is in f9
+//         N is in r8
+//     Be sure to allocate at least 2 GP registers as output registers for
+//     __libm_pi_by_2_reduce.  This routine uses r59-60. These are used as
+//     scratch registers within the __libm_pi_by_2_reduce routine (for speed).
+//
+//     We know also that __libm_pi_by_2_reduce preserves f10-15, f71-127.  We
+//     use this to eliminate save/restore of key fp registers in this calling
+//     function.
+//
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
+
+LOCAL_LIBM_ENTRY(__libm_callout)
+SINCOSL_ARG_TOO_LARGE:
 .prologue
 { .mfi
-        add   r45=-32,sp                        // Parameter: r address 
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
         mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
-}
-{ .mfi
-.fframe 64
-        add sp=-64,sp                           // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
 };;
+
 { .mmi
-        stfe [r45] = f0,16                      // Clear Parameter r on stack
-        add  r44 = 16,sp                        // Parameter x address
+        setf.exp FR_Two_to_M3 = GR_exp_2_to_m3  // Form 2^-3
+        mov GR_SAVE_GP=gp                       // Save gp
 .save   b0, GR_SAVE_B0
         mov GR_SAVE_B0=b0                       // Save b0
 };;
+
 .body
+//
+//     Call argument reduction with x in f8
+//     Returns with N in r8, r in f8, c in f9
+//     Assumes f71-127 are preserved across the call
+//
 { .mib
-        stfe [r45] = f0,-16                     // Clear Parameter c on stack 
-        nop.i 0
-        nop.b 0
-}
-{ .mib
-        stfe [r44] = FR_Input_X                 // Store Parameter x on stack
+        setf.exp FR_Neg_Two_to_M3 = GR_exp_m2_to_m3 // Form -(2^-3)
         nop.i 0
-(p0)    br.call.sptk b0=__libm_pi_by_2_reduce# ;;
+        br.call.sptk b0=__libm_pi_by_2_reduce#
 };;
-{ .mii
-(p0)    ldfe  FR_Input_X =[r44],16
-//
-//      Get r and c off stack
-//
-(p0)    adds  GR_Table_Base1 = -16, GR_Table_Base1
-//
-//      Get r and c off stack
-//
-(p0)    add   GR_N_Inc = GR_Sin_or_Cos,r8 ;;
-}
-{ .mmb
-(p0)    ldfe  FR_r =[r45],16
-//
-//      Get X off the stack
-//      Readjust Table ptr
-//
-(p0)    ldfs FR_Two_to_M3 = [GR_Table_Base1],4
-	nop.b 999 ;;
-}
-{ .mmb
-(p0)    ldfs FR_Neg_Two_to_M3 = [GR_Table_Base1],0
-(p0)    ldfe  FR_c =[r45]
-	nop.b 999 ;;
-}
+
 { .mfi
-.restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-(p0)    fcmp.lt.unc.s1	p6, p0 = FR_r, FR_Two_to_M3
+        add   GR_N_Inc = GR_Sin_or_Cos,r8
+        fcmp.lt.unc.s1        p6, p0 = FR_r, FR_Two_to_M3
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
-{ .mib
+
+{ .mfi
         mov   gp = GR_SAVE_GP                  // Restore gp
+(p6)    fcmp.gt.unc.s1        p6, p0 = FR_r, FR_Neg_Two_to_M3
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        nop.b 0
 };;
-{ .mfi
-	nop.m 999
-(p6)    fcmp.gt.unc.s1	p6, p0 = FR_r, FR_Neg_Two_to_M3
-	nop.i 999 ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p6)    br.cond.spnt L(SINCOSL_SMALL_R) ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p0)    br.cond.sptk L(SINCOSL_NORMAL_R) ;;
-}
-.endp __libm_callout
-ASM_SIZE_DIRECTIVE(__libm_callout)
+
+{ .mbb
+        nop.m 999
+(p6)    br.cond.spnt SINCOSL_SMALL_R     // Branch if |r|< 2^-3 for |x| >= 2^63
+        br.cond.sptk SINCOSL_NORMAL_R    // Branch if |r|>=2^-3 for |x| >= 2^63
+};;
+
+LOCAL_LIBM_END(__libm_callout)
 .type   __libm_pi_by_2_reduce#,@function
 .global __libm_pi_by_2_reduce#
diff --git a/sysdeps/ia64/fpu/s_erf.S b/sysdeps/ia64/fpu/s_erf.S
new file mode 100644
index 0000000000..7174a197fb
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_erf.S
@@ -0,0 +1,926 @@
+.file "erf.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/15/01 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// double erf(double)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+//
+// There are 9 paths:
+// 1. x = +/-0.0
+//    Return erf(x) = +/-0.0
+//
+// 2. 0.0 < |x| < 0.5
+//    Return erf(x) = x *Pol9(x^2)
+//
+// 3. For several subranges of 0.5 <= |x| < 5.90625
+//    Return erf(x) = sign(x)*Pol19(y), 
+//    where y = (|x|-b)/a, Pol19(y) = A0 + A1*y^1 + A2*y^2 + ... + A19*y^19
+//
+//    For each subrange there is particular set of coefficients.
+//    Below is the list of subranges:
+//    3.1 0.5 <= |x| < 1.0     b = a = 0.5
+//    3.2 1.0 <= |x| < 2.0,    b = a = 1.0
+//    3.3 2.0 <= |x| < 3.25    b = a = 2.0
+//    3.4 4.0 <= |x| < 5.90625 b = 4.0, a = 2.0
+//
+// 4. 3.25 <= |x| < 4.0
+//    Return erf(x) = sign(x)*Pol14(|x| - 3.25)
+//
+// 5. 5.90625 <= |x| < +INF
+//    Return erf(x) = sign(x)*(1.0d - 2^(-63))
+//
+// 6. |x| = INF
+//    Return erf(x) = sign(x) * 1.0
+//
+// 7. x = [S,Q]NaN 
+//    Return erf(x) = QNaN
+//
+// 8. x is positive denormal
+//    Return erf(x) = A0*x - x^2,
+//    where A0 = 2.0/sqrt(Pi)
+//
+// 9. x is negative denormal
+//    Return erf(x) = A0*x + x^2,
+//    where A0 = 2.0/sqrt(Pi)
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input, output
+// f32 -> f63
+
+// General registers used:  
+// r32 -> r48, r2, r3
+
+// Predicate registers used:
+// p0, p6 -> p15
+
+// p6           to filter out case when x = denormal
+// p7           to filter out case when x = [Q,S]NaN or +/-0,
+//              used also to process denormals
+// p8           to filter out case when 3.25 <= |x| < 4.0, 
+//              used also to process denormals
+// p9           to filter out case when |x| = inf
+// p10          to filter out case when |x| < 0.5
+// p11          set when |x| < 3.25 or |x| > 4.0
+// p12          to filter out case when |x| >= 5.90625
+// p13          set if 4.0 <=|x| < 5.90625
+// p14          set to 1 for positive x
+// p15          set to 1 for negative x
+
+// Assembly macros
+//==============================================================
+rDataPtr           = r2
+rDataPtr1          = r3
+
+rBias              = r33
+rCoeffAddr3        = r34
+rThreeAndQ         = r35
+rCoeffAddr2        = r36
+rMask              = r37
+rArg               = r38
+rSignBit           = r39
+rAbsArg            = r40
+rSaturation        = r41
+rIndex             = r42
+rCoeffAddr1        = r43
+rCoeffAddr4        = r44
+rShiftedArg        = r45
+rShiftedArgMasked  = r46
+rBiasedExpOf4      = r47
+rShiftedAbsArg     = r48
+
+//==============================================================
+fA0                = f32
+fA1                = f33
+fA2                = f34
+fA3                = f35
+fA4                = f36
+fA5                = f37
+fA6                = f38
+fA7                = f39
+fA8                = f40
+fA9                = f41
+fA10               = f42
+fA11               = f43
+fA12               = f44
+fA13               = f45
+fA14               = f46
+fA15               = f47
+fA16               = f48
+fA17               = f49
+fA18               = f50
+fA19               = f51
+fArgSqr            = f52
+fArgAbsNorm        = f53
+fSignumX           = f54
+fRes               = f55
+fThreeAndQ         = f56
+fArgAbs            = f57
+fTSqr              = f58
+fTQuadr            = f59
+fTDeg3             = f60
+fTDeg7             = f61
+fArgAbsNormSgn     = f62                          
+fTQuadrSgn         = f63
+
+// Data tables
+//==============================================================
+RODATA
+
+.align 64
+
+LOCAL_OBJECT_START(erf_data)
+// Coefficients ##0..15
+// Polynomial coefficients for the erf(x), 0.5 <= |x| < 1.0 
+data8 0xB69AC40646D1F6C1, 0x00003FD2 //A19
+data8 0x90AD48C0118FA10C, 0x00003FD7 //A18
+data8 0x826FBAD055EA4AB8, 0x0000BFDB //A17
+data8 0x8DAB171246CC2B89, 0x00003FDC //A16
+data8 0xC0B1D6662F8A7564, 0x00003FDF //A15
+data8 0xA46374AC35099BAF, 0x0000BFE1 //A14
+data8 0xB2F230996346EF27, 0x0000BFE4 //A13
+data8 0xCDEC50950FACE04A, 0x00003FE6 //A12
+data8 0x826014649396E9D2, 0x00003FE9 //A11
+data8 0xCDB787DC718B13F9, 0x0000BFEB //A10
+data8 0x8E0B23C24EE0C8EE, 0x0000BFED //A9
+data8 0xA49EA40A4E5A3F76, 0x00003FF0 //A8
+data8 0xB11E30BE912617D3, 0x00003FF0 //A7
+data8 0xCCF89D9351CE26E3, 0x0000BFF4 //A6
+data8 0xEFF75AD1F0F22809, 0x00003FF2 //A5
+data8 0xBB793EF404C09A22, 0x00003FF8 //A4
+// Polynomial coefficients for the erf(x), 1.0 <= |x| < 2.0 
+data8 0xBAE93FF4174EA59B, 0x00003FE6 //A19
+data8 0x8A0FD46092F95D44, 0x0000BFEA //A18
+data8 0xA37B3242B7809E12, 0x00003FEC //A17
+data8 0xA0330A5CD2E91689, 0x0000BFED //A16
+data8 0x8E34A678F3497D17, 0x0000BFEC //A15
+data8 0xAC185D45A2772384, 0x00003FEF //A14
+data8 0xB0C11347CE7EEDE8, 0x00003FEF //A13
+data8 0xD3330DC14EA0E4EB, 0x0000BFF2 //A12
+data8 0xB4A6DFDE578A428F, 0x00003FF1 //A11
+data8 0xA0B4034310D2D9CB, 0x00003FF5 //A10
+data8 0xF71662D3132B7759, 0x0000BFF5 //A9
+data8 0x9C88BF157695E9EC, 0x0000BFF7 //A8
+data8 0xF84B80EFCA43895D, 0x00003FF8 //A7
+data8 0x9722D22DA628A17B, 0x00003FF7 //A6
+data8 0x8DB0A586F8F3381F, 0x0000BFFB //A5
+data8 0x8DB0A5879F87E5BE, 0x00003FFB //A4
+// Polynomial coefficients for the erf(x), 2.0 <= |x| < 3.25 
+data8 0x9C4AF1F3A4B21AFC, 0x00003FF6 //A19
+data8 0x8D40D5D5DB741AB8, 0x0000BFF9 //A18
+data8 0xDEBE7099E0A75BA4, 0x00003FFA //A17
+data8 0xB99A33294D32429D, 0x0000BFFB //A16
+data8 0x8109D9C7197BC7C9, 0x00003FFB //A15
+data8 0xC30DE8E2EFC2D760, 0x00003FFA //A14
+data8 0x80DDA28C5B35DC73, 0x0000BFFC //A13
+data8 0x9BE4DE5095BACE0D, 0x00003FF9 //A12
+data8 0xDA4092509EE7D111, 0x00003FFC //A11
+data8 0x89D98C561B0C9040, 0x0000BFFD //A10
+data8 0xD20B26EB2F0881D4, 0x0000BFF9 //A9
+data8 0xD089C56948731561, 0x00003FFD //A8
+data8 0xDD704DEFFB21B7E7, 0x0000BFFD //A7
+data8 0xF0C9A6BBDE469115, 0x00003FF9 //A6
+data8 0xD673A02CB5766633, 0x00003FFD //A5
+data8 0x8D162CBAD8A12649, 0x0000BFFE //A4
+// Polynomial coefficients for the erf(x), 4.0 <= |x| < 6.0  
+data8 0xD4428B75C6FE8FD1, 0x0000BFFC //A19
+data8 0xF76BE1935675D5C8, 0x00003FFE //A18
+data8 0xFD6BB3B14AA7A8E6, 0x0000BFFF //A17
+data8 0x8BE8F573D348DDA4, 0x00004000 //A16
+data8 0x81E91923A1030502, 0x0000BFFF //A15
+data8 0xCE7FE87B26CFD286, 0x0000BFFE //A14
+data8 0x84EF6B4E17404384, 0x00004000 //A13
+data8 0x91FEF33015404991, 0x0000C000 //A12
+data8 0xDEDF6A9370747E56, 0x00003FFF //A11
+data8 0x8397E6FF56CDFD9D, 0x0000BFFF //A10
+data8 0xFAD1CE912473937B, 0x00003FFD //A9
+data8 0xC48C1EA8AAA624EA, 0x0000BFFC //A8
+data8 0xFECAF0097ACF981B, 0x00003FFA //A7
+data8 0x8829A394065E4B95, 0x0000BFF9 //A6
+data8 0xED3003E477A53EE7, 0x00003FF6 //A5
+data8 0xA4C07E9BB3FCB0F3, 0x0000BFF4 //A4
+//
+// Coefficients ##16..19
+// Polynomial coefficients for the erf(x), 0.5 <= |x| < 1.0 
+data8 0x95FA98C337005D13, 0x0000BFF9 //A3
+data8 0xE0F7E524D2808A97, 0x0000BFFB //A2
+data8 0xE0F7E524D2808A98, 0x00003FFD //A1
+data8 0x853F7AE0C76E915F, 0x00003FFE //A0
+// Polynomial coefficients for the erf(x), 1.0 <= |x| < 2.0 
+data8 0x8DB0A587A96ABCF0, 0x00003FFC //A3
+data8 0xD488F84B7DE18DA8, 0x0000BFFD //A2
+data8 0xD488F84B7DE12E9C, 0x00003FFD //A1
+data8 0xD7BB3D3A08445636, 0x00003FFE //A0
+// Polynomial coefficients for the erf(x), 2.0 <= |x| < 3.25
+data8 0xC58571D23D5C4B3A, 0x00003FFD //A3
+data8 0xA94DCF467CD6AFF3, 0x0000BFFC //A2
+data8 0xA94DCF467CD10A16, 0x00003FFA //A1
+data8 0xFECD70A13CAF1997, 0x00003FFE //A0 
+// Polynomial coefficients for the erf(x), 4.0 <= |x| < 6.0 
+data8 0xB01D2B4F0D5AB8B0, 0x00003FF1 //A3
+data8 0x8858A465CE594BD1, 0x0000BFEE //A2
+data8 0x8858A447456DE61D, 0x00003FEA //A1
+data8 0xFFFFFFBDC88BB107, 0x00003FFE //A0
+// Polynomial coefficients for the erf(x), 0.0 <= |x| < 0.5 
+data8 0xBE839EDBB36C7FCE //A9
+data8 0x3EBB7745A18DD242 //A8
+data8 0xBF4C02DB238F2AFC //A5
+data8 0x3F7565BCD0A9A3EA //A4
+data8 0xC093A3581BCF3333, 0x0000BFFD //A1
+data8 0xBEEF4BB82AD8AE22 //A7
+data8 0x3F1F9A2A57A218CD //A6
+data8 0xBF9B82CE3127F4E4 //A3
+data8 0x3FBCE2F21A042B25 //A2
+data8 0x906EBA8214DB688D, 0x00003FFF //A0
+// 1.0 - 2^(-63)
+data8 0xFFFFFFFFFFFFFFFF, 0x00003FFE 
+// Polynomial coefficients for the erf(x), 3.25 <= |x| < 4.0 
+data8 0x95E91576C7A12250, 0x00003FE7 //A14
+data8 0x8E5E0D0E1F5D3CB5, 0x0000BFEA //A13
+data8 0xED761DAFAF814DE9, 0x00003FEB //A12
+data8 0xB3A77D921D0ACFC7, 0x0000BFEC //A11
+data8 0xA662D27096B08D7C, 0x0000BFEC //A10
+data8 0xDA0F410AE6233EA5, 0x00003FEF //A9
+data8 0xAB4A8B16B3124327, 0x0000BFF1 //A8
+data8 0xB241E236A5EDCED3, 0x00003FF2 //A7
+data8 0x8A2A65BA1F551F77, 0x0000BFF3 //A6
+data8 0xA4852D0B1D87000A, 0x00003FF3 //A5
+data8 0x963EB00039489476, 0x0000BFF3 //A4
+data8 0xCD5244FF4F7313A5, 0x00003FF2 //A3
+data8 0xC6F1E695363BCB26, 0x0000BFF1 //A2
+data8 0xF4DAF4680DA54C02, 0x00003FEF //A1
+data8 0xFFFFB7CFB3F2ABBE, 0x00003FFE //A0
+// A = 2.0/sqrt(Pi)
+data8 0x906EBA8214DB688D, 0x00003FFF 
+LOCAL_OBJECT_END(erf_data)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(erf)
+
+{ .mfi
+      alloc          r32 = ar.pfs, 0, 17, 0, 0
+      fmerge.se      fArgAbsNorm = f1, f8         // normalized x
+      adds           rSignBit = 0x1, r0
+}
+{ .mfi
+      addl           rDataPtr = @ltoff(erf_data), gp
+      fma.s1         fArgSqr = f8, f8, f0         // x^2
+      addl           rThreeAndQ = 0x400A0, r0     // shifted bits of 3.25
+}
+;;
+{ .mfi
+      getf.d         rArg = f8                    // x in GR 
+      fclass.m       p6,p0 = f8, 0x0b             // is x denormal ?
+      shl            rThreeAndQ = rThreeAndQ, 44  // bits of 3.25
+}
+{ .mfi
+      ld8            rDataPtr = [rDataPtr]
+      nop.f          0
+      addl           rBiasedExpOf4 = 0x40100, r0  // shifted bits of 4.0
+}
+;;
+{ .mfi
+      addl           rSaturation = 0x4017A, r0    // shifted bits of 5.90625
+      fclass.m       p7,p0 = f8, 0xc7             // is x [S,Q]NaN or +/-0 ?
+      shl            rSignBit = rSignBit, 63      // mask for sign bit
+}
+{ .mfi
+      addl           rMask = 0x7FF00, r0          // Mask for index bits
+      nop.f          0
+      addl           rBias = 0x3FE00, r0          // bias of 0.5 << 8
+}
+;;
+{ .mfi
+      setf.d         fThreeAndQ = rThreeAndQ      // 3.25 if FP register
+      fclass.m       p9,p0 = f8, 0x23             // is x +/- inf?
+      shr.u          rShiftedArg = rArg, 44
+}
+{ .mfb
+      andcm          rAbsArg = rArg, rSignBit     // |x| in GR
+      nop.f          0
+(p6)  br.cond.spnt   erf_denormal                 // branch out if x is denormal
+}
+;;   
+{ .mfi
+      and            rShiftedArgMasked = rShiftedArg, rMask // bias of x << 8
+      fmerge.s       fArgAbs = f1, f8             // |x|
+      shr            rShiftedAbsArg = rAbsArg, 44
+}
+{ .mfb
+      cmp.lt         p8, p11 = rThreeAndQ, rAbsArg // p8 = 1 if |x| >= 3.25
+(p7)  fma.d.s0       f8 = f8,f1,f8                // NaN or +/-0
+(p7)  br.ret.spnt    b0                           // exit for x = NaN or +/-0
+}
+;;              
+{ .mfi
+      sub            rIndex = rShiftedArgMasked, rBias // index << 8
+      nop.f          0 
+      cmp.lt         p10, p0 = rShiftedArgMasked, rBias // p10 = 1 if |x| < 0.5 
+}
+{ .mfb
+      // p8 = 1 if 3.25 <= |x| < 4.0 
+(p8)  cmp.lt         p8, p11 = rShiftedAbsArg, rBiasedExpOf4 
+      fms.s1         fArgAbsNorm = fArgAbsNorm, f1, f1
+(p10) br.cond.spnt   erf_near_zero // branch out if |x| < 0.5
+}
+;;
+.pred.rel "mutex", p8, p11
+{ .mfi
+(p8)  adds           rCoeffAddr1 = 1392, rDataPtr // coeff. for 3.25 <=|x|<4.0
+(p9)  fmerge.s       f8 = f8,f1                   // +/- inf
+      nop.i          0
+}
+{ .mfb
+(p11) add            rCoeffAddr1 = rDataPtr, rIndex// coeff. ##0,2,..14
+      nop.f          0
+(p9)  br.ret.spnt    b0                            // exit for x = +/- inf
+}
+;;
+{ .mfi
+      adds           rCoeffAddr2 = 16, rCoeffAddr1 
+      fmerge.s       fSignumX = f8, f1            // signum(x)
+      nop.i          0
+} 
+{ .mfb
+      cmp.lt         p12, p0 = rSaturation, rShiftedAbsArg // |x| > 5.90625?
+      nop.f          0
+(p12) br.cond.spnt   erf_saturation               // branch out if x |x| >= 6.0
+}
+;;
+// Here if paths #3,4
+// if path #4 we'll branch out after loading of 14 necessary coefficients
+{.mfi
+      ldfe           fA19 = [rCoeffAddr1], 32
+      nop.f          0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA18 = [rCoeffAddr2], 32
+      nop.f          0
+      adds           rCoeffAddr3 = 1024, rDataPtr
+}
+;;
+{.mfi
+      ldfe           fA17 = [rCoeffAddr1], 32
+      nop.f          0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA16 = [rCoeffAddr2], 32
+      nop.f          0
+      nop.i          0
+}
+;;
+{.mfi
+      ldfe           fA15 = [rCoeffAddr1], 32
+      fma.s1         fTSqr = fArgAbsNorm, fArgAbsNorm, f0
+      shr.u          rIndex = rIndex, 2
+}
+{.mfi
+      ldfe           fA14 = [rCoeffAddr2], 32
+      nop.f          0
+      adds           rCoeffAddr4 = 16, r0
+}
+;;
+{.mfi
+      ldfe           fA13 = [rCoeffAddr1], 32
+      nop.f          0
+      // address of coefficients ##16..23
+      add            rCoeffAddr3 = rCoeffAddr3, rIndex 
+}
+{.mfi
+      ldfe           fA12 = [rCoeffAddr2], 32
+      nop.f          0
+      cmp.lt         p15, p14 = rArg, r0
+}
+;;
+{.mfi
+      ldfe           fA11 = [rCoeffAddr1], 32
+      nop.f          0
+      add            rCoeffAddr4 = rCoeffAddr3, rCoeffAddr4
+}
+{.mfi
+      ldfe           fA10 = [rCoeffAddr2], 32
+      nop.f          0
+      nop.i          0
+}
+;;
+{.mfi
+      ldfe           fA9 = [rCoeffAddr1], 32
+      nop.f          0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA8 = [rCoeffAddr2], 32
+      nop.f          0
+      nop.i          0
+}
+;;
+{.mfi
+      ldfe           fA7 = [rCoeffAddr1], 32
+      fms.s1         fArgAbs = fArgAbs, f1, fThreeAndQ
+      nop.i          0
+}
+{.mfb
+      ldfe           fA6 = [rCoeffAddr2], 32
+      nop.f          0
+(p8)  br.cond.spnt   erf_3q_4 // branch out if  3.25 < |x| < 4.0
+}                                    
+;;
+{.mfi
+      ldfe           fA5 = [rCoeffAddr1], 32
+      fma.s1         fTDeg3 = fArgAbsNorm, fTSqr, f0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA4 = [rCoeffAddr2], 32
+      fma.s1         fTQuadr = fTSqr, fTSqr, f0
+      nop.i          0
+}
+;;
+// Path #3 Polynomial Pol19(y) computation; y = fArgAbsNorm
+{.mfi
+      ldfe           fA3 = [rCoeffAddr3], 32
+      fma.s1         fArgAbsNormSgn = fArgAbsNorm, fSignumX, f0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA2 = [rCoeffAddr4], 32
+      nop.f          0
+      nop.i          0
+}
+;;
+{.mfi
+      ldfe           fA1 = [rCoeffAddr3], 32
+      fma.s1         fRes = fA19, fArgAbsNorm, fA18
+      nop.i          0
+}
+{.mfi
+      ldfe           fA0 = [rCoeffAddr4], 32
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA17 = fA17, fArgAbsNorm, fA16
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA15 = fA15, fArgAbsNorm, fA14
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fTDeg7 = fTDeg3, fTQuadr, f0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA13 = fA13, fArgAbsNorm, fA12
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA11 = fA11, fArgAbsNorm, fA10
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA9 = fA9, fArgAbsNorm, fA8
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes, fTSqr, fA17
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA7 = fA7, fArgAbsNorm, fA6
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA5 = fA5, fArgAbsNorm, f0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA15 = fA15, fTSqr, fA13  
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA4 = fA4, fArgAbsNorm, fA3
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA2 = fA2, fArgAbsNorm, fA1
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA11 = fA11, fTSqr, fA9
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fA7 = fA7, fTSqr, fA5
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fRes = fRes, fTQuadr, fA15
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fA4 = fA4, fTSqr, fA2
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes, fTQuadr, fA11
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fA4 = fA7, fTDeg3, fA4
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes,  fTDeg7, fA4
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      // result for negative argument
+(p15) fms.d.s0       f8 = fRes, fArgAbsNormSgn, fA0
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+      // result for positive argument
+(p14) fma.d.s0       f8 = fRes, fArgAbsNormSgn, fA0
+      br.ret.sptk    b0
+}
+
+// Here if  3.25 < |x| < 4.0
+.align 32
+erf_3q_4:                                   
+.pred.rel "mutex", p14, p15
+{ .mfi
+      ldfe           fA5 = [rCoeffAddr1], 32
+      fma.s1         fTSqr = fArgAbs, fArgAbs, f0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fA19, fArgAbs, fA18
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA17 = fA17, fArgAbs, fA16
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA15 = fA15, fArgAbs, fA14
+      nop.i          0
+}
+;;      
+{ .mfi
+      nop.m          0
+      fma.s1         fA13 = fA13, fArgAbs, fA12
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA11 = fA11, fArgAbs, fA10
+      nop.i          0
+}
+;;     
+{ .mfi
+      nop.m          0
+      fma.s1         fA9 = fA9, fArgAbs, fA8
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fArgAbsNormSgn = fArgAbs, fSignumX, f0
+      nop.i          0
+}
+;;     
+{ .mfi
+      nop.m          0
+      fma.s1         fTQuadr = fTSqr, fTSqr, f0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes, fTSqr, fA17
+      nop.i          0
+}
+;;  
+{ .mfi
+      nop.m          0
+      fma.s1         fA15 = fA15, fTSqr, fA13
+      nop.i          0
+}
+;;  
+{ .mfi
+      nop.m          0
+      fma.s1         fA11 = fA11, fTSqr, fA9
+      nop.i          0
+}  
+{ .mfi
+      nop.m          0
+      fma.s1         fA7 = fA7, fArgAbs, fA6
+      nop.i          0
+}
+;; 
+{ .mfi
+      nop.m          0
+      fma.s1         fTDeg7 = fTQuadr, fTSqr, f0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes, fTQuadr, fA15
+      nop.i          0
+}
+;; 
+{ .mfi
+      nop.m          0
+      fma.s1         fA11 = fA11, fTSqr, fA7 
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes, fTDeg7, fA11
+      nop.i          0
+}
+;; 
+{ .mfi
+      nop.m          0
+      // result for negative argument
+(p15) fms.d.s0       f8 = fRes, fArgAbsNormSgn, fA5
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+      // result for positive argument
+(p14) fma.d.s0       f8 = fRes, fArgAbsNormSgn, fA5
+      br.ret.sptk    b0
+}
+;;
+
+// Here if |x| < 0.5
+.align 32
+erf_near_zero:
+{ .mfi
+      adds           rCoeffAddr1 = 1280, rDataPtr // address of A9
+      fma.s1         fTSqr = fArgSqr, fArgSqr, f0 // x^4 
+      nop.i          0
+}
+{ .mfi
+      adds           rCoeffAddr2 = 1328, rDataPtr // address of A7
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      ldfpd          fA9, fA8 = [rCoeffAddr1], 16
+      nop.f          0
+      nop.i          0
+}
+{ .mfi
+      ldfpd          fA7, fA6 = [rCoeffAddr2], 16
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      ldfpd          fA5, fA4 = [rCoeffAddr1], 16
+      nop.f          0
+      nop.i          0
+}
+{ .mfi
+      ldfpd          fA3, fA2 = [rCoeffAddr2], 16
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      ldfe           fA1 = [rCoeffAddr1]
+      nop.f          0
+      nop.i          0
+}
+{ .mfi
+      ldfe           fA0 = [rCoeffAddr2]
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fTQuadr = fTSqr, fTSqr, f0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fA9, fArgSqr, fA8
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA7 = fA7, fArgSqr, fA6
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA3 = fA3, fArgSqr, fA2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA5 = fA5, fArgSqr, fA4
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA1 = fA1, fArgSqr, fA0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fTQuadrSgn = fTQuadr, f8, f0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes, fTSqr, fA7
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA1 = fA3, fTSqr, fA1
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fRes = fRes, fTSqr, fA5
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA1 = fA1, f8, f0
+      nop.i          0
+}
+;;
+{ .mfb
+      nop.m          0
+      fma.d.s0       f8 = fRes, fTQuadrSgn, fA1 // x*Pol9(x^2)
+      br.ret.sptk    b0                              // Exit for |x| < 0.5
+};;
+
+// Here if 5.90625 <= |x| < +inf
+.align 32
+erf_saturation:
+{ .mfi
+      adds           rDataPtr = 1376, rDataPtr     // address of A0
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      ldfe           fA0 = [rDataPtr]
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfb
+      nop.m          0
+      fma.d.s0       f8 = fA0, fSignumX, f0       // sign(x)*(1.0 - 2^(-63))
+      // Exit for 5.90625 <= |x| < +inf
+      br.ret.sptk    b0                          // Exit for 5.90625 <=|x|< +inf
+}
+;;
+      
+// Here if x is double precision denormal
+.align 32
+erf_denormal:
+{ .mfi
+      adds           rDataPtr = 1632, rDataPtr    // address of A0
+      fclass.m       p7,p8 = f8, 0x0a             // is x -denormal ?
+      nop.i          0
+}
+;;
+{ .mfi
+      ldfe           fA0 = [rDataPtr]             // A0
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fA0 = fA0,f8,f0              // A0*x
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+(p7)  fma.d.s0       f8 = f8,f8,fA0               // -denormal
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p8)  fnma.d.s0      f8 = f8,f8,fA0               // +denormal
+      br.ret.sptk    b0                           // Exit for denormal
+}
+;;
+
+GLOBAL_LIBM_END(erf)
+
+
diff --git a/sysdeps/ia64/fpu/s_erfc.S b/sysdeps/ia64/fpu/s_erfc.S
new file mode 100644
index 0000000000..addfef44c2
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_erfc.S
@@ -0,0 +1,1199 @@
+.file "erfc.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 11/12/01  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/06/03  Reordered header: .section, .global, .proc, .align
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// double erfc(double)
+//
+// Overview of operation
+//==============================================================
+// 1. 0 <= x <= 28.0
+//    
+//    erfc(x)  = P14(z) * exp( -x^2 ), z = x - x(i).
+//
+//    Comment:
+//
+//    Let x(i) = -1.0 + 2^(i/4),i=0,...19. So we have 20 unequal
+//    argument intervals [x(i),x(i+1)] with length ratio q = 2^(1/4).
+//    Values x(i) we have in the table erfc_xb_table.
+// 
+//    Let x(i)<= x < x(i+1).
+//    We can find i as exponent of number (x + 1)^4.
+// 
+//    Let P14(z) - polynomial approximation of degree 14 for function
+//    erfc(z+x(i)) * exp( (z+x(i))^2) and 0 <= z <= x(i+1)-x(i).
+//    Polynomial coeffitients we have in the table erfc_p_table.
+//
+//    So we can find result for erfc(x) as above.
+//    Algorithm description for exp function see below.   
+//                     
+// 2. -6 <= x < 0
+//
+//      erfc(x)  = 2.0 - erfc(-x)
+//
+// 3. x > 28.0
+//    erfc(x)  ~=~ 0.0                      
+//
+// 4. x < -6.0            
+//    erfc(x)  ~=~ 2.0                      
+
+// Special values 
+//==============================================================
+// erfc(+0)    = 1.0
+// erfc(-0)    = 1.0
+
+// erfc(+qnan) = +qnan 
+// erfc(-qnan) = -qnan 
+// erfc(+snan) = +qnan 
+// erfc(-snan) = -qnan 
+
+// erfc(-inf)  = 2.0 
+// erfc(+inf)  = +0
+
+//==============================================================
+// Take double exp(double) from libm_64.
+//
+// Overview of operation
+//==============================================================
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 128/log2
+//  n = int(w)
+//  x = n log2/128 + r + delta
+
+//  n = 128M + index_1 + 2^4 index_2
+//  x = M log2 + (log2/128) index_1 + (log2/8) index_2 + r + delta
+
+//  exp(x) = 2^M  2^(index_1/128)  2^(index_2/8) exp(r) exp(delta)
+//       Construct 2^M
+//       Get 2^(index_1/128) from table_1;
+//       Get 2^(index_2/8)   from table_2;
+//       Calculate exp(r) by series
+//          r = x - n (log2/128)_high
+//          delta = - n (log2/128)_low
+//       Calculate exp(delta) as 1 + delta
+//==============================================================
+//  Comment for exp for erfc:
+//
+//  We use quad precision for calculate input argument -x^2 and add
+//  result low bits to value delta in exp.  
+
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input
+// f9 -> f15,  f32 -> f93
+
+// General registers used: 
+// r32 -> r68 
+
+// Predicate registers used:
+// p6 -> p15
+
+// Assembly macros
+//==============================================================
+
+exp_GR_rshf            = r33
+EXP_AD_TB1             = r34
+EXP_AD_TB2             = r35
+EXP_AD_P               = r36
+exp_GR_N               = r37
+exp_GR_index_1         = r38
+exp_GR_index_2_16      = r39
+exp_GR_biased_M        = r40
+EXP_AD_T1              = r41
+EXP_AD_T2              = r42
+exp_GR_sig_inv_ln2     = r43
+exp_GR_17ones          = r44
+exp_TB1_size           = r45
+exp_TB2_size           = r46
+exp_GR_rshf_2to56      = r47
+exp_GR_exp_2tom56      = r48
+
+// GR for erfc(x)
+//==============================================================
+GR_POS_ARG_ASYMP       = r49
+GR_NEG_ARG_ASYMP       = r50
+GR_ARG_ASYMP           = r51
+GR_ERFC_XB_TB          = r52
+GR_ERFC_P_TB           = r53
+GR_IndxPlusBias        = r54
+GR_BIAS                = r55
+GR_P_A12               = r56
+GR_P_A13               = r57
+GR_AbsArg              = r58
+GR_ShftXBi             = r59
+GR_ShftPi              = r60
+GR_mBIAS               = r61
+GR_ShftPi_bias         = r62
+GR_ShftXBi_bias        = r63
+GR_ShftA12             = r64
+GR_ShftA13             = r65
+GR_EpsNorm             = r66
+GR_0x1                 = r67
+GR_ShftPi_8            = r68
+
+// GR for __libm_support call
+
+//==============================================================
+
+GR_SAVE_B0             = r61
+GR_SAVE_PFS            = r62
+GR_SAVE_GP             = r63
+GR_SAVE_SP             = r64
+
+GR_Parameter_X         = r65
+GR_Parameter_Y         = r66
+GR_Parameter_RESULT    = r67
+GR_Parameter_TAG       = r68
+
+
+// FR for exp(-x^2)
+//==============================================================
+FR_X                   = f10
+FR_Y                   = f1
+FR_RESULT              = f8
+
+EXP_2TOM56             = f6
+EXP_INV_LN2_2TO63      = f7
+EXP_W_2TO56_RSH        = f9
+EXP_RSHF_2TO56         = f10
+
+exp_P4                 = f11 
+exp_P3                 = f12 
+exp_P2                 = f13 
+exp_P1                 = f14 
+exp_ln2_by_128_hi      = f15
+ 
+exp_ln2_by_128_lo      = f32 
+EXP_RSHF               = f33
+EXP_Nfloat             = f34 
+exp_r                  = f35
+exp_f                  = f36
+exp_rsq                = f37
+exp_rcube              = f38
+EXP_2M                 = f39
+exp_S1                 = f40
+exp_T1                 = f41
+exp_rP4pP3             = f42
+exp_P_lo               = f43
+exp_P_hi               = f44
+exp_P                  = f45
+exp_S                  = f46
+EXP_NORM_f8            = f47   
+exp_S2                 = f48
+exp_T2                 = f49
+
+// FR for erfc(x)
+//==============================================================
+FR_AbsArg              = f50
+FR_Tmp                 = f51
+FR_Xb                  = f52
+FR_A0                  = f53
+FR_A1                  = f54
+FR_A2                  = f55
+FR_A3                  = f56
+FR_A4                  = f57
+FR_A5                  = f58
+FR_A6                  = f59
+FR_A7                  = f60
+FR_A8                  = f61
+FR_A9                  = f62
+FR_A10                 = f63
+FR_A11                 = f64
+FR_A12                 = f65
+FR_A13                 = f66
+FR_A14                 = f67
+
+FR_P14_0_1             = f68
+FR_P14_0_2             = f69
+FR_P14_1_1             = f70
+FR_P14_1_2             = f71
+FR_P14_2_1             = f72
+FR_P14_2_2             = f73
+FR_P14_3_1             = f74
+FR_P14_3_2             = f75
+FR_P14_6_1             = f76
+
+FR_P14_7_1             = f77
+FR_P14_7_2             = f78
+FR_P14_8_1             = f79
+FR_P14_8_2             = f80
+FR_P14_12_1            = f81
+FR_P14_13_1            = f82
+FR_P14_13_2            = f83
+FR_Pol                 = f84
+FR_Exp                 = f85
+FR_2                   = f86
+f8_sq_lo               = f87
+FR_LocArg              = f88
+FR_Tmpf                = f89
+FR_Tmp1                = f90
+FR_EpsNorm             = f91
+FR_UnfBound            = f92
+FR_NormX               = f93
+
+
+// Data tables
+//==============================================================
+RODATA
+.align 16
+
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
+
+LOCAL_OBJECT_START(exp_table_1)
+
+data8 0x403a8b12fc6e4892 , 0          // underflow boundary
+data8 0xb17217f7d1cf79ab , 0x00003ff7 // ln2/128 hi
+data8 0xc9e3b39803f2f6af , 0x00003fb7 // ln2/128 lo
+//
+// Table 1 is 2^(index_1/128) where
+// index_1 goes from 0 to 15
+//
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x80B1ED4FD999AB6C , 0x00003FFF
+data8 0x8164D1F3BC030773 , 0x00003FFF
+data8 0x8218AF4373FC25EC , 0x00003FFF
+data8 0x82CD8698AC2BA1D7 , 0x00003FFF
+data8 0x8383594EEFB6EE37 , 0x00003FFF
+data8 0x843A28C3ACDE4046 , 0x00003FFF
+data8 0x84F1F656379C1A29 , 0x00003FFF
+data8 0x85AAC367CC487B15 , 0x00003FFF
+data8 0x8664915B923FBA04 , 0x00003FFF
+data8 0x871F61969E8D1010 , 0x00003FFF
+data8 0x87DB357FF698D792 , 0x00003FFF
+data8 0x88980E8092DA8527 , 0x00003FFF
+data8 0x8955EE03618E5FDD , 0x00003FFF
+data8 0x8A14D575496EFD9A , 0x00003FFF
+data8 0x8AD4C6452C728924 , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_1)
+
+// Table 2 is 2^(index_1/8) where
+// index_2 goes from 0 to 7
+LOCAL_OBJECT_START(exp_table_2)
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
+data8 0x9837F0518DB8A96F , 0x00003FFF
+data8 0xA5FED6A9B15138EA , 0x00003FFF
+data8 0xB504F333F9DE6484 , 0x00003FFF
+data8 0xC5672A115506DADD , 0x00003FFF
+data8 0xD744FCCAD69D6AF4 , 0x00003FFF
+data8 0xEAC0C6E7DD24392F , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_2)
+
+LOCAL_OBJECT_START(exp_p_table)
+data8 0x3f8111116da21757 //P_4
+data8 0x3fa55555d787761c //P_3
+data8 0x3fc5555555555414 //P_2
+data8 0x3fdffffffffffd6a //P_1
+LOCAL_OBJECT_END(exp_p_table)
+
+LOCAL_OBJECT_START(erfc_xb_table)
+data8 0x0000000000000000, 0x00000000 //XB[0] = +0.00000000000000000000e-01L
+data8 0xC1BF828C6DC54B7A, 0x00003FFC //XB[1] = +1.89207115002721066717e-01L
+data8 0xD413CCCFE7799211, 0x00003FFD //XB[2] = +4.14213562373095048802e-01L
+data8 0xAE89F995AD3AD5E8, 0x00003FFE //XB[3] = +6.81792830507429086062e-01L
+data8 0x8000000000000000, 0x00003FFF //XB[4] = +1.00000000000000000000e+00L
+data8 0xB06FE0A31B7152DF, 0x00003FFF //XB[5] = +1.37841423000544213343e+00L
+data8 0xEA09E667F3BCC909, 0x00003FFF //XB[6] = +1.82842712474619009760e+00L
+data8 0x9744FCCAD69D6AF4, 0x00004000 //XB[7] = +2.36358566101485817212e+00L
+data8 0xC000000000000000, 0x00004000 //XB[8] = +3.00000000000000000000e+00L
+data8 0xF06FE0A31B7152DF, 0x00004000 //XB[9] = +3.75682846001088426687e+00L
+data8 0x9504F333F9DE6484, 0x00004001 //XB[10] = +4.65685424949238019521e+00L
+data8 0xB744FCCAD69D6AF4, 0x00004001 //XB[11] = +5.72717132202971634425e+00L
+data8 0xE000000000000000, 0x00004001 //XB[12] = +7.00000000000000000000e+00L
+data8 0x8837F0518DB8A96F, 0x00004002 //XB[13] = +8.51365692002176853374e+00L
+data8 0xA504F333F9DE6484, 0x00004002 //XB[14] = +1.03137084989847603904e+01L
+data8 0xC744FCCAD69D6AF4, 0x00004002 //XB[15] = +1.24543426440594326885e+01L
+data8 0xF000000000000000, 0x00004002 //XB[16] = +1.50000000000000000000e+01L
+data8 0x9037F0518DB8A96F, 0x00004003 //XB[17] = +1.80273138400435370675e+01L
+data8 0xAD04F333F9DE6484, 0x00004003 //XB[18] = +2.16274169979695207808e+01L
+data8 0xCF44FCCAD69D6AF4, 0x00004003 //XB[19] = +2.59086852881188653770e+01L
+LOCAL_OBJECT_END(erfc_xb_table)
+
+LOCAL_OBJECT_START(erfc_p_table)
+
+// Pol0 
+data8 0x8000000000000000, 0x00003FFF //A0 = +1.00000000000000000000e+00L
+data8 0x906EBA8214DB688D, 0x0000BFFF //A1 = -1.12837916709551257389e+00L
+data8 0xFFFFFFFFFFFFFFEB, 0x00003FFE //A2 = +9.99999999999999998841e-01L
+data8 0xC093A3581BCF2925, 0x0000BFFE //A3 = -7.52252778063674869885e-01L
+data8 0xFFFFFFFFFFF7CDBD, 0x00003FFD //A4 = +4.99999999999985440383e-01L
+data8 0x9A0FB5E014AE3EFB, 0x0000BFFD //A5 = -3.00901111224757482205e-01L
+data8 0xAAAAAAAA4672B0BD, 0x00003FFC //A6 = +1.66666666643879582201e-01L
+data8 0xB011F45C9F590FC0, 0x0000BFFB //A7 = -8.59717455640916223912e-02L
+data8 0xAAAAA89474161033, 0x00003FFA //A8 = +4.16666588928413935202e-02L
+data8 0x9C818E2CE37D4214, 0x0000BFF9 //A9 = -1.91047455656271634308e-02L
+data8 0x8885969315AB76A1, 0x00003FF8 //A10 = +8.33263115449753085659e-03L
+data8 0xE36112A686F5165B, 0x0000BFF6 //A11 = -3.46953111013788405745e-03L
+data8 0xB3DD6B2DB3307D2E, 0x00003FF5 //A12 = +1.37226041156280127011e-03L
+data8 0x8018A34267FED226, 0x0000BFF4 //A13 = -4.88648380816410282971e-04L
+data8 0xFBBA6A7AEBD3ABD9, 0x00003FF1 //A14 = +1.20033353451879025825e-04L
+// Pol1 
+data8 0xD15A1EF03BB91E71, 0x00003FFE //A0 = +8.17781385088640600540e-01L
+data8 0xD1A4ADDAC3337118, 0x0000BFFE //A1 = -8.18919053944410683867e-01L
+data8 0xA9AF9FFA2AD18CB0, 0x00003FFE //A2 = +6.62836073471060947628e-01L
+data8 0xECB77514F0F151B3, 0x0000BFFD //A3 = -4.62337168508812580002e-01L
+data8 0x934AB35EA5CD5EEB, 0x00003FFD //A4 = +2.87679295829458273854e-01L
+data8 0xA71410A68C1EF21C, 0x0000BFFC //A5 = -1.63162479558223113104e-01L
+data8 0xAF506A335238094A, 0x00003FFB //A6 = +8.56025978958108330224e-02L
+data8 0xABFDF67F968765A7, 0x0000BFFA //A7 = -4.19902447551140139048e-02L
+data8 0x9F0B0165A6CDCA99, 0x00003FF9 //A8 = +1.94144274984979538382e-02L
+data8 0x8B8197BFC346CDEA, 0x0000BFF8 //A9 = -8.51478404279186775501e-03L
+data8 0xE950D763FE51AB1E, 0x00003FF6 //A10 = +3.56011637267641495904e-03L
+data8 0xBA821A59FC05FBAD, 0x0000BFF5 //A11 = -1.42294475244146555952e-03L
+data8 0x8D535042E11A0D89, 0x00003FF4 //A12 = +5.39113782651680545599e-04L
+data8 0xBE589447DB26564E, 0x0000BFF2 //A13 = -1.81528103431449706486e-04L
+data8 0xABC8C7EF636F5B0A, 0x00003FF0 //A14 = +4.09565689009869217620e-05L
+// Pol2 
+data8 0xA9973ABB272898B2, 0x00003FFE //A0 = +6.62463827792779356910e-01L
+data8 0x945F1A7993F7AADD, 0x0000BFFE //A1 = -5.79576162988785154930e-01L
+data8 0xD84439C6609A8A62, 0x00003FFD //A2 = +4.22395520654665085222e-01L
+data8 0x8A1BBAA7E9CB8C52, 0x0000BFFD //A3 = -2.69742806431984313298e-01L
+data8 0x9F0F67364B466975, 0x00003FFC //A4 = +1.55332195938916594663e-01L
+data8 0xA843F180287DAF7F, 0x0000BFFB //A5 = -8.21608416782158837025e-02L
+data8 0xA59D71B7C690E545, 0x00003FFA //A6 = +4.04333536247671644540e-02L
+data8 0x991A733518C74874, 0x0000BFF9 //A7 = -1.86893701691354422481e-02L
+data8 0x85E7F91148F9F6D2, 0x00003FF8 //A8 = +8.17298243522623724858e-03L
+data8 0xDEE0607CC9D6777E, 0x0000BFF6 //A9 = -3.40082507754089306495e-03L
+data8 0xB145D2CC470B306B, 0x00003FF5 //A10 = +1.35248373238824318949e-03L
+data8 0x86FAEBB4438A20FA, 0x0000BFF4 //A11 = -5.14908443679775343409e-04L
+data8 0xC2503856CE48A657, 0x00003FF2 //A12 = +1.85311660448280465934e-04L
+data8 0xF52642F22A26965B, 0x0000BFF0 //A13 = -5.84481856856861454591e-05L
+data8 0xC98588E1A95FFDBD, 0x00003FEE //A14 = +1.20116245684500489648e-05L
+// Pol3 
+data8 0x887CBA2C47B1E2B5, 0x00003FFE //A0 = +5.33153186617432643784e-01L
+data8 0xCD81909CF194328E, 0x0000BFFD //A1 = -4.01379126699602646289e-01L
+data8 0x84DCA15C52122372, 0x00003FFD //A2 = +2.59495775718310530164e-01L
+data8 0x993AA9C76AD28157, 0x0000BFFC //A3 = -1.49637844845261107836e-01L
+data8 0xA140CD8A96FADBA5, 0x00003FFB //A4 = +7.87368829650154013961e-02L
+data8 0x9D36B25E76E56EEA, 0x0000BFFA //A5 = -3.83822410143975630292e-02L
+data8 0x8F8BCC2C0536ECD3, 0x00003FF9 //A6 = +1.75227153523910189727e-02L
+data8 0xF77EDC644BA17AF9, 0x0000BFF7 //A7 = -7.55296479527793552675e-03L
+data8 0xCAB8AC76793C1151, 0x00003FF6 //A8 = +3.09328279988546711083e-03L
+data8 0x9E8FCBC793D555AF, 0x0000BFF5 //A9 = -1.20972979110659888616e-03L
+data8 0xEDC1328664A0CE79, 0x00003FF3 //A10 = +4.53481058502015766058e-04L
+data8 0xAAE3CAAB9D117591, 0x0000BFF2 //A11 = -1.62973223928790256249e-04L
+data8 0xE7704D06A3080C19, 0x00003FF0 //A12 = +5.51792801195012080688e-05L
+data8 0x875A5B53E510F305, 0x0000BFEF //A13 = -1.61353297293572230995e-05L
+data8 0xC8F10CDDB9CC9A42, 0x00003FEC //A14 = +2.99426321046583353559e-06L
+// Pol4 
+data8 0xDAEC3C07CAB590C1, 0x00003FFD //A0 = +4.27583576155807004411e-01L
+data8 0x8BE271F8BE0280AC, 0x0000BFFD //A1 = -2.73212014783898564863e-01L
+data8 0x9E13941E19661429, 0x00003FFC //A2 = +1.54371561371908397882e-01L
+data8 0xA241BFC48377449D, 0x0000BFFB //A3 = -7.92269689413235358504e-02L
+data8 0x99E56877AD00D1AE, 0x00003FFA //A4 = +3.75722962151600767952e-02L
+data8 0x887E78DA3BA57C80, 0x0000BFF9 //A5 = -1.66618690872055148862e-02L
+data8 0xE465CAA9F4D54FD8, 0x00003FF7 //A6 = +6.97014232347351913821e-03L
+data8 0xB57930370208D4A7, 0x0000BFF6 //A7 = -2.76906420823065422653e-03L
+data8 0x89A90B5DF0C0C55E, 0x00003FF5 //A8 = +1.05026496655247749532e-03L
+data8 0xC83DB867F08D93C6, 0x0000BFF3 //A9 = -3.81929578900287685559e-04L
+data8 0x8C0C9113FC8061FA, 0x00003FF2 //A10 = +1.33561218944256209215e-04L
+data8 0xBC17A73E9CA51313, 0x0000BFF0 //A11 = -4.48447217225392170834e-05L
+data8 0xED10FE8FC0E44CAD, 0x00003FEE //A12 = +1.41302576244352578317e-05L
+data8 0xFE49912328516F81, 0x0000BFEC //A13 = -3.78917710289305330220e-06L
+data8 0xA8F6077E25DAFD33, 0x00003FEA //A14 = +6.29428967202166402369e-07L
+// Pol5 
+data8 0xAF72220985BED710, 0x00003FFD //A0 = +3.42667640364081975844e-01L
+data8 0xBC1CB559042410AB, 0x0000BFFC //A1 = -1.83703263815036934677e-01L
+data8 0xB730BF62E0B63A3C, 0x00003FFB //A2 = +8.94484474229911741150e-02L
+data8 0xA4F307B1D1A1534E, 0x0000BFFA //A3 = -4.02708340235238993824e-02L
+data8 0x8B0327F5117861DB, 0x00003FF9 //A4 = +1.69692783752415790321e-02L
+data8 0xDD4059307B2B081C, 0x0000BFF7 //A5 = -6.75205569219747369303e-03L
+data8 0xA761D738974FECF6, 0x00003FF6 //A6 = +2.55404953403837072821e-03L
+data8 0xF208F6D704F4B487, 0x0000BFF4 //A7 = -9.23290315545127419886e-04L
+data8 0xA7F3658D34EC10B9, 0x00003FF3 //A8 = +3.20340668304962386053e-04L
+data8 0xE079C35CEFD4E6D6, 0x0000BFF1 //A9 = -1.07038324953715640850e-04L
+data8 0x90C5CDD19BB3DD2F, 0x00003FF0 //A10 = +3.45164947021915687751e-05L
+data8 0xB3911863705825F6, 0x0000BFEE //A11 = -1.07030140392753204852e-05L
+data8 0xD023CF5C3F915685, 0x00003FEC //A12 = +3.10152594473606007552e-06L
+data8 0xCA7016FADFF584F5, 0x0000BFEA //A13 = -7.54139761055503416594e-07L
+data8 0xEEBB5CC0901D2BB0, 0x00003FE7 //A14 = +1.11168196441717301549e-07L
+// Pol6 
+data8 0x8CD1160326A754AF, 0x00003FFD //A0 = +2.75032699474947383325e-01L
+data8 0xFB22A4C657119388, 0x0000BFFB //A1 = -1.22624671271190511269e-01L
+data8 0xD02B2CA872A774E9, 0x00003FFA //A2 = +5.08224243596176920409e-02L
+data8 0xA23302E146E9E406, 0x0000BFF9 //A3 = -1.97997146844646077750e-02L
+data8 0xEF8918FEDE237C98, 0x00003FF7 //A4 = +7.31004448401605074486e-03L
+data8 0xA8A8B598FA20D881, 0x0000BFF6 //A5 = -2.57353242430059589053e-03L
+data8 0xE3964D9788BFF50F, 0x00003FF4 //A6 = +8.68175969920725727944e-04L
+data8 0x93B83C10B7210AC7, 0x0000BFF3 //A7 = -2.81752903983413936245e-04L
+data8 0xB913B752B0D56A42, 0x00003FF1 //A8 = +8.82515983758695613094e-05L
+data8 0xE0623EFA0B1E8DE9, 0x0000BFEF //A9 = -2.67486302195396417310e-05L
+data8 0x83C4D1A4019E1D2E, 0x00003FEE //A10 = +7.85403393879249335151e-06L
+data8 0x950CBA5D80D8125E, 0x0000BFEC //A11 = -2.22101388436550539151e-06L
+data8 0x9CE72C0409A3E800, 0x00003FEA //A12 = +5.84509280984781223375e-07L
+data8 0x88CCD7A000D1C213, 0x0000BFE8 //A13 = -1.27405082040077425019e-07L
+data8 0x8DF4EC84F093B1C0, 0x00003FE5 //A14 = +1.65259388738830506389e-08L
+// Pol7 
+data8 0xE2BF82A153B1B82E, 0x00003FFC //A0 = +2.21433678719152843912e-01L
+data8 0xA72A9AE0BD7F29D5, 0x0000BFFB //A1 = -8.16242313227913578068e-02L
+data8 0xE98939292289EDBE, 0x00003FF9 //A2 = +2.85078159732432477516e-02L
+data8 0x9B93E5E0EEFF9516, 0x0000BFF8 //A3 = -9.49571084105114051468e-03L
+data8 0xC6B39897AABC47BC, 0x00003FF6 //A4 = +3.03194499398790451607e-03L
+data8 0xF442AC7D84DDF1E0, 0x0000BFF4 //A5 = -9.31779649708690069328e-04L
+data8 0x90FBD9F8B41DF23E, 0x00003FF3 //A6 = +2.76534642660360753287e-04L
+data8 0xA6AC59077C78B437, 0x0000BFF1 //A7 = -7.94759910003852154521e-05L
+data8 0xB9FC0BADD531E5E9, 0x00003FEF //A8 = +2.21710864553358009804e-05L
+data8 0xC9CFC8CD93648856, 0x0000BFED //A9 = -6.01445608619100503330e-06L
+data8 0xD4FA51B86A9B2494, 0x00003FEB //A10 = +1.58680833469323702924e-06L
+data8 0xD8D0ED030032926D, 0x0000BFE9 //A11 = -4.03851487695924456733e-07L
+data8 0xCCA1CA2AC3EB8973, 0x00003FE7 //A12 = +9.52891963880517988726e-08L
+data8 0x9E26A080F9DA39DE, 0x0000BFE5 //A13 = -1.84111863600343741644e-08L
+data8 0x8F3DC58F64A92C62, 0x00003FE2 //A14 = +2.08443519336792003049e-09L
+// Pol8 
+data8 0xB74C13E914E9666F, 0x00003FFC //A0 = +1.79001151181389950418e-01L
+data8 0xDEB57268A58B763B, 0x0000BFFA //A1 = -5.43722600071728705200e-02L
+data8 0x821FF0D4C605A4CD, 0x00003FF9 //A2 = +1.58843711598712515609e-02L
+data8 0x92C830DD423DB924, 0x0000BFF7 //A3 = -4.47943101836927657394e-03L
+data8 0xA04E61767A095BB6, 0x00003FF5 //A4 = +1.22303905230942532198e-03L
+data8 0xA9EF64E0F6654358, 0x0000BFF3 //A5 = -3.24125543666296226957e-04L
+data8 0xAF39C8969BD163E8, 0x00003FF1 //A6 = +8.35541329311315562274e-05L
+data8 0xB01273B34197330C, 0x0000BFEF //A7 = -2.09894273215824495783e-05L
+data8 0xACAE4C820B99EBAC, 0x00003FED //A8 = +5.14629050848703676006e-06L
+data8 0xA57BF2AEA52B92DF, 0x0000BFEB //A9 = -1.23295315941138567172e-06L
+data8 0x9AD6FE7A852DA239, 0x00003FE9 //A10 = +2.88411640627675721042e-07L
+data8 0x8BFE95FCD7B92763, 0x0000BFE7 //A11 = -6.51900079707465044843e-08L
+data8 0xE9F15C8E7F58CF90, 0x00003FE4 //A12 = +1.36172642554216769522e-08L
+data8 0x9E90F22B11FAF8B5, 0x0000BFE2 //A13 = -2.30744183054978535129e-09L
+data8 0xF8CF74F1A138FBBA, 0x00003FDE //A14 = +2.26291720693360003233e-10L
+// Pol9 
+data8 0x94D45274A831ED57, 0x00003FFC //A0 = +1.45341194505862183128e-01L
+data8 0x94D4518B699A4A68, 0x0000BFFA //A1 = -3.63352952323113355459e-02L
+data8 0x90C3B59FF403A916, 0x00003FF8 //A2 = +8.83572327421709216515e-03L
+data8 0x893B796D0E9B4867, 0x0000BFF6 //A3 = -2.09399904729894563201e-03L
+data8 0xFDFFA94903DCB8EA, 0x00003FF3 //A4 = +4.84464029001979577664e-04L
+data8 0xE5CE7C2E4B05CF16, 0x0000BFF1 //A5 = -1.09580317663729186599e-04L
+data8 0xCB88CC8F1146FDAE, 0x00003FEF //A6 = +2.42631878042764234194e-05L
+data8 0xB0AA52C6F44E47C8, 0x0000BFED //A7 = -5.26503698764159271674e-06L
+data8 0x966DD813170F8EBD, 0x00003FEB //A8 = +1.12078397189300511086e-06L
+data8 0xFB75782788A6E378, 0x0000BFE8 //A9 = -2.34189317246047219283e-07L
+data8 0xCDF787C4E5FDCF2A, 0x00003FE6 //A10 = +4.79554094892420966704e-08L
+data8 0xA34CD3DFAC12AA45, 0x0000BFE4 //A11 = -9.50531730989412282035e-09L
+data8 0xEEBB49645DE0E34C, 0x00003FE1 //A12 = +1.73700091999434388879e-09L
+data8 0x8C86D8677DEACFBA, 0x0000BFDF //A13 = -2.55616650187281815453e-10L
+data8 0xBDB223D0FE2A7D6B, 0x00003FDB //A14 = +2.15659223402509415592e-11L
+// Pol10 
+data8 0xF2C1812715E4050A, 0x00003FFB //A0 = +1.18533143048567888157e-01L
+data8 0xC7DA2C565ADAEE57, 0x0000BFF9 //A1 = -2.43960252726894623056e-02L
+data8 0xA15CEFFD632F697D, 0x00003FF7 //A2 = +4.92440908672041077933e-03L
+data8 0xFFCFF4D3FB118F69, 0x0000BFF4 //A3 = -9.75846593969603576904e-04L
+data8 0xC73F437D2F226C56, 0x00003FF2 //A4 = +1.90016864347860462550e-04L
+data8 0x989D7E1F60845811, 0x0000BFF0 //A5 = -3.63863004988760879054e-05L
+data8 0xE615A5A669361BE1, 0x00003FED //A6 = +6.85705419984646959791e-06L
+data8 0xAACD08E0BE6270F8, 0x0000BFEB //A7 = -1.27256599602163049440e-06L
+data8 0xF9DEE9C1C02A3062, 0x00003FE8 //A8 = +2.32710274258898439253e-07L
+data8 0xB420E960508A3003, 0x0000BFE6 //A9 = -4.19394488070741280136e-08L
+data8 0xFF5E3ECA229CB0C7, 0x00003FE3 //A10 = +7.43219121339261970485e-09L
+data8 0xAF86504D78D35E89, 0x0000BFE1 //A11 = -1.27711000692808421573e-09L
+data8 0xDE1CE78ADB6DDF04, 0x00003FDE //A12 = +2.02010513073041015283e-10L
+data8 0xE124FFAA267301A5, 0x0000BFDB //A13 = -2.55959692063871343080e-11L
+data8 0x81F1BEBEFBE168D2, 0x00003FD8 //A14 = +1.84661980716000872722e-12L
+// Pol11 
+data8 0xC6CE5D7D18203EAA, 0x00003FFB //A0 = +9.70732978630764996752e-02L
+data8 0x86E8A30A76923C88, 0x0000BFF9 //A1 = -1.64683517829920230086e-02L
+data8 0xB4A1CBB7576B4183, 0x00003FF6 //A2 = +2.75622581042760461528e-03L
+data8 0xEEB782FBC8BB352B, 0x0000BFF3 //A3 = -4.55316242981110299585e-04L
+data8 0x9BC489CC00C7E63A, 0x00003FF1 //A4 = +7.42758405750422020216e-05L
+data8 0xC8D418A9F2A78515, 0x0000BFEE //A5 = -1.19703114831817055481e-05L
+data8 0xFFE671DCEE8665A8, 0x00003FEB //A6 = +1.90660487794668853072e-06L
+data8 0xA1313247D3E35365, 0x0000BFE9 //A7 = -3.00243820009225833104e-07L
+data8 0xC8D5A87C970712B1, 0x00003FE6 //A8 = +4.67604496871825103188e-08L
+data8 0xF77258CEF4675E25, 0x0000BFE3 //A9 = -7.20164586117313631144e-09L
+data8 0x96549D79C0F33C27, 0x00003FE1 //A10 = +1.09379854902340983112e-09L
+data8 0xB16A6CC5A3AE6E01, 0x0000BFDE //A11 = -1.61358659378896671620e-10L
+data8 0xC0970F2551C52F96, 0x00003FDB //A12 = +2.18949565869759698947e-11L
+data8 0xA6E029ABB3BB500C, 0x0000BFD8 //A13 = -2.37144541649446501026e-12L
+data8 0xA3E43F3857D1B6A5, 0x00003FD4 //A14 = +1.45564973108152568130e-13L
+// Pol12 
+data8 0xA36E35FC807B3E64, 0x00003FFB //A0 = +7.98000543291529334886e-02L
+data8 0xB725A29237C8F94F, 0x0000BFF8 //A1 = -1.11784064873715046550e-02L
+data8 0xCB51EF23EAD5F327, 0x00003FF5 //A2 = +1.55120891755237931425e-03L
+data8 0xDFA838770AE711A2, 0x0000BFF2 //A3 = -2.13296043002775850891e-04L
+data8 0xF3D7B777730B202D, 0x00003FEF //A4 = +2.90683082614108095819e-05L
+data8 0x83C5FF0D475796DD, 0x0000BFED //A5 = -3.92715403535014263671e-06L
+data8 0x8D37B41345244FD5, 0x00003FEA //A6 = +5.26076523514903487927e-07L
+data8 0x9616B7E9C40C1DCC, 0x0000BFE7 //A7 = -6.98905176445499510102e-08L
+data8 0x9E38FDF61B26699A, 0x00003FE4 //A8 = +9.20976891314475742405e-09L
+data8 0xA565DFE27AEA03A1, 0x0000BFE1 //A9 = -1.20342845518628622757e-09L
+data8 0xAAEB9EFB497EC812, 0x00003FDE //A10 = +1.55451193328690040046e-10L
+data8 0xABD305A38349EAEB, 0x0000BFDB //A11 = -1.95341618552982314342e-11L
+data8 0x9EDB00104DB66DD9, 0x00003FD8 //A12 = +2.25747200093121867690e-12L
+data8 0xE9F80AF513F2B8AB, 0x0000BFD4 //A13 = -2.07806143133802417637e-13L
+data8 0xC2B840C3859AB166, 0x00003FD0 //A14 = +1.08091168358477817812e-14L
+// Pol13 
+data8 0x86CD0BF01914407A, 0x00003FFB //A0 = +6.58207829138836028568e-02L
+data8 0xF9F4A17FA70807C3, 0x0000BFF7 //A1 = -7.62803922344113067603e-03L
+data8 0xE63BF84EDE20EDAA, 0x00003FF4 //A2 = +8.78273993036530088653e-04L
+data8 0xD2B746011B39D879, 0x0000BFF1 //A3 = -1.00477176633442906101e-04L
+data8 0xBFA4F1F66023C975, 0x00003FEE //A4 = +1.14228914411837438985e-05L
+data8 0xAD3A05E1F1F0EA8F, 0x0000BFEB //A5 = -1.29063913420827451449e-06L
+data8 0x9BA1F2E56DBE1B49, 0x00003FE8 //A6 = +1.44944165416032280452e-07L
+data8 0x8AFE93AF627BAFA6, 0x0000BFE5 //A7 = -1.61810825806733824014e-08L
+data8 0xF6CEAB6E78304875, 0x00003FE1 //A8 = +1.79575947795401009493e-09L
+data8 0xD9BFD64FD9166ECF, 0x0000BFDE //A9 = -1.98041892772535870322e-10L
+data8 0xBE482C8AEA403737, 0x00003FDB //A10 = +2.16325508593741350803e-11L
+data8 0xA1FB98FA19E62A4F, 0x0000BFD8 //A11 = -2.30191407969654156362e-12L
+data8 0xFDB2E0599016AD1E, 0x00003FD4 //A12 = +2.25329742249079975388e-13L
+data8 0x9E179A99CDD4BF4B, 0x0000BFD1 //A13 = -1.75517603530017718494e-14L
+data8 0xDE4DE992A707C7BC, 0x00003FCC //A14 = +7.71273133169032472595e-16L
+// Pol14 
+data8 0xDF0639E60CF6E96C, 0x00003FFA //A0 = +5.44492971101228988138e-02L
+data8 0xAB6737B6065BD1C2, 0x0000BFF7 //A1 = -5.23081035867078490333e-03L
+data8 0x8322CC0765FD9C27, 0x00003FF4 //A2 = +5.00243857322493802503e-04L
+data8 0xC7C37C447AABC9BE, 0x0000BFF0 //A3 = -4.76273572257807668623e-05L
+data8 0x977C068C67DD09B3, 0x00003FED //A4 = +4.51458915834329225528e-06L
+data8 0xE4C00648054CBD72, 0x0000BFE9 //A5 = -4.26080256412742187632e-07L
+data8 0xABF9032C426C0F54, 0x00003FE6 //A6 = +4.00405155179176153559e-08L
+data8 0x80BD82177111B70D, 0x0000BFE3 //A7 = -3.74683488305340664541e-09L
+data8 0xBFEFB2BBFC4AAE16, 0x00003FDF //A8 = +3.49130134089615132836e-10L
+data8 0x8E68BCEC2A2F6025, 0x0000BFDC //A9 = -3.23800879252444001040e-11L
+data8 0xD19FEF92B2157585, 0x00003FD8 //A10 = +2.97894685764287382560e-12L
+data8 0x967A0ECC142382D9, 0x0000BFD5 //A11 = -2.67300472044743953909e-13L
+data8 0xC6D8869855133985, 0x00003FD1 //A12 = +2.20763189681614758000e-14L
+data8 0xD10AC0B228ABCECC, 0x0000BFCD //A13 = -1.45052027893524847250e-15L
+data8 0xF7C6DEB4522487A3, 0x00003FC8 //A14 = +5.37280367113168366711e-17L
+// Pol15 
+data8 0xB8F57DECFAC3B255, 0x00003FFA //A0 = +4.51559943173131409760e-02L
+data8 0xEC1B8A6C822C036F, 0x0000BFF6 //A1 = -3.60271577347565115947e-03L
+data8 0x963A6DD66951B72E, 0x00003FF3 //A2 = +2.86537625289770759336e-04L
+data8 0xBE93F9E80DF4AE0A, 0x0000BFEF //A3 = -2.27186718010906557773e-05L
+data8 0xF10589FC10D908E0, 0x00003FEB //A4 = +1.79575113004740124999e-06L
+data8 0x97F1A2435C7877EF, 0x0000BFE8 //A5 = -1.41508767557208714648e-07L
+data8 0xBEFF2FB5F00E9327, 0x00003FE4 //A6 = +1.11174782364058338591e-08L
+data8 0xEF5E09DC714DF198, 0x0000BFE0 //A7 = -8.70813302639377671664e-10L
+data8 0x958A6EB9408970A4, 0x00003FDD //A8 = +6.80032608255179732632e-11L
+data8 0xBA31F40954675710, 0x0000BFD9 //A9 = -5.29198388081297293593e-12L
+data8 0xE63B9CEEDC4CF0E6, 0x00003FD5 //A10 = +4.08975721481205179918e-13L
+data8 0x8AF8F1E3FED32CEC, 0x0000BFD2 //A11 = -3.08580807479307213059e-14L
+data8 0x9A88033A08842BEA, 0x00003FCE //A12 = +2.14455258045503137285e-15L
+data8 0x88BCF775B7B3A939, 0x0000BFCA //A13 = -1.18601440246395438386e-16L
+data8 0x88687B63A5B7135E, 0x00003FC5 //A14 = +3.69734984736162880476e-18L
+// Pol16 
+data8 0x99B8A501204BF3E7, 0x00003FFA //A0 = +3.75296063885057657456e-02L
+data8 0xA33FA20D2867C79C, 0x0000BFF6 //A1 = -2.49097544033960143953e-03L
+data8 0xACFD14CA6AA55829, 0x00003FF2 //A2 = +1.64974783411741182991e-04L
+data8 0xB6E9B4ED9B378B09, 0x0000BFEE //A3 = -1.09024594422859744844e-05L
+data8 0xC0FD95D38ADCF301, 0x00003FEA //A4 = +7.18945888498730738040e-07L
+data8 0xCB302F7AAFFFA074, 0x0000BFE6 //A5 = -4.73084450875945514829e-08L
+data8 0xD578674188198402, 0x00003FE2 //A6 = +3.10640208133938026422e-09L
+data8 0xDFCC6ED4219E7FC4, 0x0000BFDE //A7 = -2.03543610142159316364e-10L
+data8 0xEA1F448AA373E4A9, 0x00003FDA //A8 = +1.33083028465054001215e-11L
+data8 0xF44780B8EACD37B5, 0x0000BFD6 //A9 = -8.67854438613319891312e-13L
+data8 0xFD55794492F53AEE, 0x00003FD2 //A10 = +5.62514216652784597182e-14L
+data8 0x805C040421E7A098, 0x0000BFCF //A11 = -3.56269003968981157635e-15L
+data8 0xEFCCD20DE93A138E, 0x00003FCA //A12 = +2.07993414310230172191e-16L
+data8 0xB259764466732080, 0x0000BFC6 //A13 = -9.66834364652262630640e-18L
+data8 0x9597C1DB6AF830E4, 0x00003FC1 //A14 = +2.53420063550355940811e-19L
+// Pol17 
+data8 0xFFFCBD66BAA4368C, 0x00003FF9 //A0 = +3.12484454387527380657e-02L
+data8 0xE28174723762D197, 0x0000BFF5 //A1 = -1.72810121976742793952e-03L
+data8 0xC81D832836019EC4, 0x00003FF1 //A2 = +9.54224026432644399736e-05L
+data8 0xB0885530C7D7AB5B, 0x0000BFED //A3 = -5.26107996417947739207e-06L
+data8 0x9B7EA64F62F6FD06, 0x00003FE9 //A4 = +2.89631495607631932854e-07L
+data8 0x88C24ACAA9042166, 0x0000BFE5 //A5 = -1.59208376111789845204e-08L
+data8 0xF033E5CD9B7F2822, 0x00003FE0 //A6 = +8.73852423930118273815e-10L
+data8 0xD2A1B161FB4DFBFE, 0x0000BFDC //A7 = -4.78920839886600387264e-11L
+data8 0xB86B27FCBB5A1E9D, 0x00003FD8 //A8 = +2.62074563162805723295e-12L
+data8 0xA124E1303F08E508, 0x0000BFD4 //A9 = -1.43124677534734729453e-13L
+data8 0x8C0B270950D7C697, 0x00003FD0 //A10 = +7.77397948226387851915e-15L
+data8 0xEE034E350C65D2D9, 0x0000BFCB //A11 = -4.12886586201102092942e-16L
+data8 0xBA94473E52495304, 0x00003FC7 //A12 = +2.02289587087169937807e-17L
+data8 0xE913D34CBB853CEE, 0x0000BFC2 //A13 = -7.89697093687557412061e-19L
+data8 0xA44576A85E8CAB59, 0x00003FBD //A14 = +1.73929048516879172258e-20L
+// Pol18 
+data8 0xD579A3FE4622DED2, 0x00003FF9 //A0 = +2.60589793198885278242e-02L
+data8 0x9D97EB84E7CD89C8, 0x0000BFF5 //A1 = -1.20234251012583627659e-03L
+data8 0xE86EFDC2CCA5C47B, 0x00003FF0 //A2 = +5.54164790116744315389e-05L
+data8 0xAB39FA5621E39B15, 0x0000BFEC //A3 = -2.55147332073979814633e-06L
+data8 0xFC0244F58F8D8097, 0x00003FE7 //A4 = +1.17350772365097747003e-07L
+data8 0xB941D44B71B14FE2, 0x0000BFE3 //A5 = -5.39169255673480031672e-09L
+data8 0x880B4A40B6F2C901, 0x00003FDF //A6 = +2.47462779512141204748e-10L
+data8 0xC7998AE5652CDCFC, 0x0000BFDA //A7 = -1.13459336509953900777e-11L
+data8 0x92438AA45915CD95, 0x00003FD6 //A8 = +5.19633524685027215673e-13L
+data8 0xD6067243AD3AEAE6, 0x0000BFD1 //A9 = -2.37615683835509918256e-14L
+data8 0x9BD0722A07669E4D, 0x00003FCD //A10 = +1.08117849400479298186e-15L
+data8 0xDDF6F1B79F50E3C4, 0x0000BFC8 //A11 = -4.81309059042573202592e-17L
+data8 0x91F283C0351A9ACA, 0x00003FC4 //A12 = +1.97795505638619048412e-18L
+data8 0x990BC4FAFA9C7542, 0x0000BFBF //A13 = -6.48174913943425248713e-20L
+data8 0xB536865B89676892, 0x00003FB9 //A14 = +1.19916696090758913485e-21L
+// Pol19 
+data8 0xB241CEB1B7C953F1, 0x00003FF9 //A0 = +2.17598950382519671244e-02L
+data8 0xDBD6FBA9B11B85E1, 0x0000BFF4 //A1 = -8.38622198373701898430e-04L
+data8 0x877605B1AD082441, 0x00003FF0 //A2 = +3.22964249573360786077e-05L
+data8 0xA6D04DC067A5D310, 0x0000BFEB //A3 = -1.24285881515578912302e-06L
+data8 0xCD458A72BC161315, 0x00003FE6 //A4 = +4.77935289502172654216e-08L
+data8 0xFC6902CFB5DE90A2, 0x0000BFE1 //A5 = -1.83652591038905929358e-09L
+data8 0x9B12B0707DFE615C, 0x00003FDD //A6 = +7.05190381049444126079e-11L
+data8 0xBE67972F2C8EE5AE, 0x0000BFD8 //A7 = -2.70581282732878853626e-12L
+data8 0xE99D8CAF9A3FFE02, 0x00003FD3 //A8 = +1.03746090805854376435e-13L
+data8 0x8F35F5BBEF9E4299, 0x0000BFCF //A9 = -3.97489765699919189983e-15L
+data8 0xAF6E62C3C91B7178, 0x00003FCA //A10 = +1.52162305785839987182e-16L
+data8 0xD6636229C1646963, 0x0000BFC5 //A11 = -5.81100425482928485309e-18L
+data8 0x810331BF289E068F, 0x00003FC1 //A12 = +2.18555638648715837944e-19L
+data8 0x8E3D07CA59546B83, 0x0000BFBC //A13 = -7.53003820427900359431e-21L
+data8 0xD5970B291ED73560, 0x00003FB6 //A14 = +1.76677518655145552907e-22L
+LOCAL_OBJECT_END(erfc_p_table)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(erfc)
+
+{ .mfi
+      alloc       r32 = ar.pfs, 0, 33, 4, 0
+      fma.s1      FR_Tmp = f1, f1, f8                      // |x|+1, if x >= 0
+      nop.i       0
+}
+{ .mfi
+      addl        EXP_AD_TB1    = @ltoff(exp_table_1), gp
+      fms.s1      FR_Tmp1 = f1, f1, f8                      // |x|+1, if x < 0
+      mov         exp_GR_rshf_2to56 = 0x4768            // begin 1.1 2^(63+56)
+};;
+
+{ .mfi
+      ld8         EXP_AD_TB1    = [EXP_AD_TB1]
+      fcmp.ge.s1  p6,p7 = f8, f0                        // p6: x >= 0 ,p7: x<0
+      mov         exp_GR_rshf_2to56 = 0x4768            // begin 1.1 2^(63+56)
+}
+{ .mlx
+      mov         exp_TB1_size  = 0x100           
+      movl        exp_GR_sig_inv_ln2 = 0xb8aa3b295c17f0bc   //signif. of 1/ln2
+};;
+
+{ .mfi
+      nop.m       0
+      fclass.m    p8,p0 = f8,0x07                                 // p8: x = 0
+      shl         exp_GR_rshf_2to56 = exp_GR_rshf_2to56, 48 //end 1.1 2^(63+56)
+}
+{ .mfi
+      mov         exp_GR_exp_2tom56 = 0xffff-56
+      fnma.s1     EXP_NORM_f8   = f8, f8, f0             // high bits for -x^2
+      nop.i       0                      
+};;
+
+
+.pred.rel "mutex",p6,p7
+{ .mfi
+      setf.sig    EXP_INV_LN2_2TO63 = exp_GR_sig_inv_ln2  // form 1/ln2 * 2^63
+(p6)  fma.s1      FR_AbsArg = f1, f0, f8                     // |x|, if x >= 0
+      mov         GR_POS_ARG_ASYMP = 0x403C            
+}
+{ .mfi
+      mov         GR_NEG_ARG_ASYMP = 0x4018
+(p7)  fms.s1      FR_AbsArg = f1, f0, f8                      // |x|, if x < 0
+      mov         exp_GR_rshf = 0x43e8       // begin 1.1 2^63 for right shift
+};;
+
+{ .mfi
+      setf.exp    EXP_2TOM56 = exp_GR_exp_2tom56   // 2^-56 for scaling Nfloat
+      fclass.m    p10,p0 = f8, 0x21                           // p10: x = +inf
+      mov         exp_GR_17ones = 0x1FFFF       
+}
+{ .mlx                    
+      setf.d      EXP_RSHF_2TO56 = exp_GR_rshf_2to56   // const 1.10*2^(63+56)
+      movl        GR_ERFC_XB_TB = 0x1A0 
+};;
+
+
+.pred.rel "mutex",p6,p7
+{ .mfi
+      ldfd        FR_UnfBound = [EXP_AD_TB1], 16
+(p6)  fma.s1      FR_Tmp = FR_Tmp, FR_Tmp, f0               // (|x|+1)^2,x >=0
+      shl         exp_GR_rshf = exp_GR_rshf, 48 //end 1.1 2^63 for right shift
+}
+{ .mfi
+      nop.m       0      
+(p7)  fma.s1      FR_Tmp = FR_Tmp1, FR_Tmp1, f0              // (|x|+1)^2, x<0
+      mov         GR_0x1 = 0x1 
+};;
+
+{ .mfi
+      mov         GR_BIAS = 0x0FFFF
+      fclass.m    p9,p0 = f8, 0x22                             // p9: x = -inf
+      shl         GR_EpsNorm = GR_0x1,53
+}
+{ .mfb
+      mov         exp_TB2_size  = 0x80
+(p8)  fma.d.s0    f8 = f1, f1, f0                         //p8: y = 1.0, x = 0
+(p8)  br.ret.spnt b0                               //p8:  quick exit for x = 0
+};;
+
+{ .mfi
+      nop.m       0
+      fclass.m    p11,p0 = f8, 0xc3                          // p11: x = nan
+      nop.i       0 
+}
+{ .mfi
+      setf.d      EXP_RSHF = exp_GR_rshf //Form right shift const 1.100 * 2^63
+      fma.s1      FR_NormX = f8,f1,f0
+      nop.i       0
+};;
+
+{ .mfi
+      setf.d      FR_EpsNorm = GR_EpsNorm   
+      nop.f       0      
+(p6)  shl         GR_ARG_ASYMP = GR_POS_ARG_ASYMP, 48//p6:ARG_ASYMP= 28.0,x>=0
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_2 = f1, f1, f1
+      nop.i       0
+};;
+
+{ .mfi
+      ldfe        exp_ln2_by_128_hi  = [EXP_AD_TB1],16
+      fma.s1      f8_sq_lo = f8, f8, EXP_NORM_f8          // low bits for -x^2
+(p7)  shl         GR_ARG_ASYMP = GR_NEG_ARG_ASYMP, 48//p6:ARG_ASYMP= 6.0,x < 0
+};;
+
+{ .mfi
+      sub         GR_mBIAS = r0, GR_BIAS    
+      fma.s1      FR_Tmp = FR_Tmp, FR_Tmp, f0                     // (|x|+1)^4
+      nop.i       0
+}
+{ .mfi
+      ldfe        exp_ln2_by_128_lo  = [EXP_AD_TB1], 16
+      nop.f       0
+      nop.i       0 
+};;
+
+{ .mfi
+      getf.d      GR_AbsArg = FR_AbsArg 
+      nop.f       0
+      add         GR_ERFC_XB_TB = GR_ERFC_XB_TB, EXP_AD_TB1//pointer to XB_TBL
+}
+{ .mfb
+      shladd      GR_ShftPi_bias = GR_BIAS, 4, GR_mBIAS // BIAS *  2^4 - BIAS
+(p9)  fma.d.s0    f8 = f1, f1, f1                   // p9: y = 2 for x = -inf
+(p9)  br.ret.spnt b0                           // p9: quick exit for x = -inf
+};;
+
+{ .mfi
+      add         GR_ERFC_P_TB = 0x140, GR_ERFC_XB_TB      // pointer to P_TBL
+      fma.s1    EXP_W_2TO56_RSH = EXP_NORM_f8,EXP_INV_LN2_2TO63,EXP_RSHF_2TO56
+      shladd      GR_ShftPi_bias = GR_ShftPi_bias, 4, r0        //  BIAS * 240
+}
+{ .mfb    
+      nop.m       0
+(p10) fma.d.s0       f8 = f0, f1, f0                   // p10: y = 0 for x = +inf
+(p10) br.ret.spnt b0                           // p10: quick exit for x = +inf
+};;
+
+
+.pred.rel "mutex",p6,p7
+{ .mfi
+(p6)  cmp.gt.unc  p15,p0 = GR_AbsArg,GR_ARG_ASYMP   //p15: x > 28.0,p6: x >= 0
+      nop.f       0    
+(p7)  cmp.gt.unc  p14,p0 = GR_AbsArg, GR_ARG_ASYMP  //p14: x < - 6.0,p7: x < 0
+}
+{ .mfb
+      add         EXP_AD_TB2 = exp_TB1_size, EXP_AD_TB1
+(p11) fma.d.s0    f8 = f8, f1, f0                     //p11: y = x for x = nan
+(p11) br.ret.spnt b0                             //p11: quick exit for x = nan
+};;
+                        
+{ .mfi 
+      add         EXP_AD_P = exp_TB2_size, EXP_AD_TB2     
+      fms.s1      f8_sq_lo = f1, f1, f8_sq_lo         // 1 - low bits for -x^2
+      nop.i       0
+};;
+
+{ .mfi
+      ldfpd       exp_P4, exp_P3  = [EXP_AD_P], 16
+      fmerge.s    FR_X = f8,f8
+      shladd      GR_ShftXBi_bias = GR_mBIAS, 4, r0
+} 
+{ .mfb
+      nop.m       0
+(p14) fnma.d.s0   FR_RESULT = FR_EpsNorm,FR_EpsNorm,FR_2 //p14:y ~=~ 2,x< -6.0
+(p14) br.ret.spnt b0                            //p14: quick exit for x < -6.0
+};;
+
+//p15: y ~=~ 0.0(result with underflow error), x > ARG_ASYMP = 28, 
+{ .mfi
+      ldfpd       exp_P2, exp_P1  = [EXP_AD_P]
+      fma.d.s0    FR_Tmpf = f1, f1, FR_EpsNorm                      // flag i
+      nop.i       0
+}
+{ .mfb
+(p15) mov         GR_Parameter_TAG = 208
+(p15) fma.d.s0    FR_RESULT = FR_EpsNorm,FR_EpsNorm,f0 
+(p15) br.cond.spnt __libm_error_region
+};;
+
+//p8: x < 27.0, result without ungerflow error
+{ .mfi
+      getf.exp    GR_IndxPlusBias = FR_Tmp         // exp + bias for (|x|+1)^4
+      fcmp.lt.s1  p8,p0 = FR_NormX,FR_UnfBound      
+      nop.i       0
+}
+{ .mfi
+      nop.m       0
+      fms.s1      EXP_Nfloat = EXP_W_2TO56_RSH, EXP_2TOM56, EXP_RSHF
+      nop.i       0
+};;
+
+{ .mmi
+      shladd      GR_ShftXBi = GR_IndxPlusBias, 4, GR_ShftXBi_bias
+      shladd      GR_ShftPi = GR_IndxPlusBias, 4, GR_ShftPi_bias
+      shl         GR_ShftPi_8 = GR_IndxPlusBias, 8       
+};;
+
+{ .mmi
+      getf.sig    exp_GR_N        = EXP_W_2TO56_RSH      
+      add         GR_ERFC_XB_TB = GR_ERFC_XB_TB, GR_ShftXBi// pointer to XB[i]
+      sub         GR_ShftPi = GR_ShftPi_8, GR_ShftPi             // (256-16)*i
+};;
+
+{ .mmi
+      ldfe        FR_Xb  = [GR_ERFC_XB_TB]
+      add         GR_ShftA12 = 0xC0, GR_ShftPi        // pointer shift for A12
+      add         GR_ShftA13 = 0xD0, GR_ShftPi        // pointer shift for A13 
+};;
+
+{ .mfi
+      add         GR_P_A13 = GR_ERFC_P_TB, GR_ShftA13        // pointer to A13
+      nop.f       0
+      and         exp_GR_index_1 = 0x0f, exp_GR_N         
+}
+{ .mfi
+      add         GR_P_A12 = GR_ERFC_P_TB, GR_ShftA12        // pointer to A12
+      fnma.s1     exp_r   = EXP_Nfloat, exp_ln2_by_128_hi, EXP_NORM_f8
+      nop.i       0
+};;
+
+{ .mfi
+      ldfe        FR_A12 = [GR_P_A12], -64  
+      nop.f       0
+      and         exp_GR_index_2_16 = 0x70, exp_GR_N 
+}
+{ .mfi
+      ldfe        FR_A13 = [GR_P_A13], -64 
+      nop.f       0
+      shladd      EXP_AD_T1 = exp_GR_index_1, 4, EXP_AD_TB1 
+};;            
+
+{ .mmi              
+      ldfe        FR_A8 = [GR_P_A12], 32
+      ldfe        FR_A9 = [GR_P_A13], 32  
+      add         EXP_AD_T2 = EXP_AD_TB2, exp_GR_index_2_16
+};;
+
+{ .mmi
+      ldfe        FR_A10 = [GR_P_A12], -96
+      ldfe        FR_A11 = [GR_P_A13], -96
+      nop.i       0      
+};;
+
+{ .mmi
+      ldfe        FR_A4 = [GR_P_A12], 32
+      ldfe        FR_A5 = [GR_P_A13], 32 
+      shr         r2 = exp_GR_N,  0x7
+};;
+
+{ .mfi       
+      ldfe        FR_A6 = [GR_P_A12], -64  
+      fma.s1      exp_rP4pP3 = exp_r, exp_P4, exp_P3
+      nop.i       0
+}
+{ .mfi      
+      ldfe        FR_A7 = [GR_P_A13], -64 
+      fma.s1      exp_rsq = exp_r, exp_r, f0
+      nop.i       0
+};;
+
+{ .mmi
+      ldfe        FR_A2 = [GR_P_A12], -32
+      ldfe        FR_A3 = [GR_P_A13], -32  
+      addl        exp_GR_biased_M = 0xffff, r2
+};;
+
+{ .mmi      
+      ldfe        FR_A0 = [GR_P_A12], 224
+      ldfe        FR_A1 = [GR_P_A13]
+      nop.i       0
+};;
+
+{ .mfi
+      ldfe        FR_A14 = [GR_P_A12]
+      fms.s1      FR_LocArg = FR_AbsArg, f1, FR_Xb          // xloc = x - x[i]
+      nop.i       0
+};;
+
+{ .mmi
+      setf.exp    EXP_2M = exp_GR_biased_M
+      ldfe        exp_T1  = [EXP_AD_T1]
+      nop.i       0
+};;
+
+{ .mfi
+      ldfe        exp_T2  = [EXP_AD_T2]
+      fma.s1      exp_P_hi  = exp_rsq, exp_P1, exp_r
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0                  
+      fma.s1      exp_rcube = exp_r, exp_rsq, f0
+      nop.i       0
+}    
+{ .mfi          
+      nop.m       0       
+      fma.s1      exp_P_lo  = exp_r, exp_rP4pP3, exp_P2
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fnma.s1     exp_f   = EXP_Nfloat, exp_ln2_by_128_lo, f8_sq_lo
+      nop.i       0  
+};;            
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_0_1 = FR_LocArg, FR_LocArg, f0            // xloc ^2
+      nop.i       0 
+}
+{ .mfi
+      nop.m       0 
+      fma.s1      FR_P14_0_2 = FR_A13, FR_LocArg, FR_A12
+      nop.i       0 
+};;
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_1_1 = FR_A9, FR_LocArg, FR_A8 
+      nop.i       0
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_1_2 = FR_A11, FR_LocArg, FR_A10 
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_2_1 = FR_A5, FR_LocArg, FR_A4
+      nop.i       0                   
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_2_2 = FR_A7, FR_LocArg, FR_A6
+      nop.i       0
+};;                       
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_3_1 = FR_A1, FR_LocArg, FR_A0
+      nop.i       0
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_3_2 = FR_A3, FR_LocArg, FR_A2
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_6_1 = FR_P14_0_1, FR_A14, FR_P14_0_2
+      nop.i       0
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_7_2 = FR_P14_0_1, FR_P14_0_1, f0
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_7_1 = FR_P14_0_1, FR_P14_1_2, FR_P14_1_1
+      nop.i       0
+}
+{ .mfi
+      nop.m       0
+      fma.s1      exp_S2  = exp_f, exp_T2, f0
+      nop.i       0
+};;
+{ .mfi
+      nop.m       0        
+      fma.s1      exp_S1  = EXP_2M, exp_T1, f0
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_8_1 = FR_P14_0_1, FR_P14_3_2, FR_P14_3_1
+      nop.i       0
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_8_2 = FR_P14_0_1, FR_P14_2_2, FR_P14_2_1
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_12_1 = FR_P14_7_2, FR_P14_6_1, FR_P14_7_1
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0  
+      fma.s1      exp_S   = exp_S1, exp_S2, f0     
+      nop.i       0                    
+}
+{ .mfi
+      nop.m       0
+      fma.s1      exp_P     = exp_rcube, exp_P_lo, exp_P_hi
+      nop.i       0
+};;
+
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_13_1 = FR_P14_7_2, FR_P14_8_2, FR_P14_8_1
+      nop.i       0
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_P14_13_2 = FR_P14_7_2, FR_P14_7_2, f0           // xloc^8
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fma.s1      FR_Exp = exp_S, exp_P, exp_S                    // exp(-x^2)
+      nop.i       0          
+}
+{ .mfi
+      nop.m       0
+      fma.s1      FR_Pol = FR_P14_13_2, FR_P14_12_1, FR_P14_13_1 
+      nop.i       0
+};;
+
+{ .mfi
+      nop.m       0
+      fma.d.s0    FR_Tmpf = f8, f1, f0                             //  flag  d
+      nop.i       0 
+};;
+
+//p6: result for     0 < x < = 28.0,
+//p7: result for    -6.0  <= x < 0,
+//p8: exit   for   - 6.0  <=   x < UnfBound ~=~ 26.54..
+                             
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m       0
+(p6)  fma.d.s0    f8 = FR_Exp, FR_Pol, f0  
+      nop.i       0         
+}
+{ .mfb
+      mov         GR_Parameter_TAG = 208
+(p7)  fnma.d.s0   f8 = FR_Exp, FR_Pol, FR_2         
+(p8)  br.ret.sptk b0                     
+};;
+
+GLOBAL_LIBM_END(erfc)
+
+// call via (p15) br.cond.spnt   __libm_error_region
+//          for  x > ARG_ASYMP = 28.0
+// or
+//
+// after .endp erfc for UnfBound < = x < = ARG_ASYMP = 28.0
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp                       // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                                      // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                                           // Save gp
+};;
+{ .mmi
+        stfd [GR_Parameter_Y] = FR_Y,16          // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp                      // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                                           // Save b0
+};;
+.body
+{ .mib
+        stfd [GR_Parameter_X] = FR_X             // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0                                      
+}
+{ .mib
+        stfd [GR_Parameter_Y] = FR_RESULT        // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]        // Get return result off stack
+.restore sp
+        add   sp = 64,sp                              // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                        // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                                    // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS                           // Restore ar.pfs
+        br.ret.sptk     b0                                           // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
+
diff --git a/sysdeps/ia64/fpu/s_erfcf.S b/sysdeps/ia64/fpu/s_erfcf.S
new file mode 100644
index 0000000000..2e3eeab3c7
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_erfcf.S
@@ -0,0 +1,983 @@
+.file "erfcf.s"
+
+
+// Copyright (c) 2002 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 01/17/02  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/06/03  Reordered header: .section, .global, .proc, .align
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// float erfcf(float)
+//
+// Overview of operation
+//==============================================================
+// 1. 0 <= x <= 10.06
+//    
+//    erfcf(x)  = P15(x) * exp( -x^2 )
+//
+//    Comment:
+//
+//    Let x(0)=0, x(i) = 2^(i), i=1,...3, x(4)= 10.06
+// 
+//    Let x(i)<= x < x(i+1).
+//    We can find i as exponent of argument x (let i = 0 for 0<= x < 2  )
+// 
+//    Let P15(x) - polynomial approximation of degree 15 for function
+//    erfcf(x) * exp( x^2) and x(i) <= x <= x(i+1), i = 0,1,2,3
+//    Polynomial coeffitients we have in the table erfc_p_table.
+//
+//    So we can find result for erfcf(x) as above.
+//    Algorithm description for exp function see below.
+//                     
+// 2. -4.4 <= x < 0
+//
+//    erfcf(x)  = 2.0 - erfcf(-x)
+//
+// 3. x > 10.06
+//
+//    erfcf(x)  ~=~ 0.0
+//
+// 4. x < -4.4
+//            
+//    erfcf(x)  ~=~ 2.0
+
+// Special values 
+//==============================================================
+// erfcf(+0)    = 1.0
+// erfcf(-0)    = 1.0
+
+// erfcf(+qnan) = +qnan 
+// erfcf(-qnan) = -qnan 
+// erfcf(+snan) = +qnan 
+// erfcf(-snan) = -qnan 
+
+// erfcf(-inf)  = 2.0 
+// erfcf(+inf)  = +0
+
+//==============================================================
+// Take double exp(double) from libm_64.
+//
+// Overview of operation
+//==============================================================
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 128/log2
+//  n = int(w)
+//  x = n log2/128 + r + delta
+
+//  n = 128M + index_1 + 2^4 index_2
+//  x = M log2 + (log2/128) index_1 + (log2/8) index_2 + r + delta
+
+//  exp(x) = 2^M  2^(index_1/128)  2^(index_2/8) exp(r) exp(delta)
+//       Construct 2^M
+//       Get 2^(index_1/128) from table_1;
+//       Get 2^(index_2/8)   from table_2;
+//       Calculate exp(r) by series
+//          r = x - n (log2/128)_high
+//          delta = - n (log2/128)_low
+//       Calculate exp(delta) as 1 + delta
+//
+// Comment for erfcf:
+//
+// Let exp(r) = 1 + x + 0.5*x^2 + (1/6)*x^3
+// Let delta  = 0.
+//==============================================================
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input
+// f6,f7,f9 -> f11,  f32 -> f92
+
+// General registers used: 
+// r14 -> r22,r32 -> r50 
+
+// Predicate registers used:
+// p6 -> p15
+
+// Assembly macros
+//==============================================================
+EXP_AD_TB1             = r14
+exp_GR_sig_inv_ln2     = r15
+exp_TB1_size           = r16
+exp_GR_rshf_2to56      = r17
+exp_GR_exp_2tom56      = r18
+
+exp_GR_rshf            = r33
+EXP_AD_TB2             = r34
+EXP_AD_P               = r35
+exp_GR_N               = r36
+exp_GR_index_1         = r37
+exp_GR_index_2_16      = r38
+exp_GR_biased_M        = r39
+EXP_AD_T1              = r40
+EXP_AD_T2              = r41
+exp_TB2_size           = r42
+
+// GR for erfcf(x)
+//==============================================================
+GR_IndxPlusBias        = r19
+GR_ExpMask             = r20
+GR_BIAS                = r21
+GR_ShftPi_bias         = r22
+
+GR_P_POINT_1           = r43
+GR_P_POINT_2           = r44
+GR_P_POINT_3           = r45
+GR_P_POINT_4           = r46
+
+GR_ShftPi              = r47
+GR_EpsNorm             = r48
+
+GR_05                  = r49
+GR_1_by_6              = r50
+
+// GR for __libm_support call
+//==============================================================
+
+GR_SAVE_B0             = r43
+GR_SAVE_PFS            = r44
+GR_SAVE_GP             = r45
+GR_SAVE_SP             = r46
+
+GR_Parameter_X         = r47
+GR_Parameter_Y         = r48
+GR_Parameter_RESULT    = r49
+GR_Parameter_TAG       = r50
+
+
+// FR for exp(-x^2)
+//==============================================================
+FR_X                   = f10
+FR_Y                   = f1
+FR_RESULT              = f8
+
+EXP_2TOM56             = f6
+EXP_INV_LN2_2TO63      = f7
+EXP_W_2TO56_RSH        = f9
+exp_ln2_by_128_hi      = f11
+
+EXP_RSHF_2TO56         = f32 
+exp_ln2_by_128_lo      = f33 
+EXP_RSHF               = f34
+EXP_Nfloat             = f35 
+exp_r                  = f36
+exp_rsq                = f37
+EXP_2M                 = f38
+exp_S1                 = f39
+exp_T1                 = f40
+exp_P                  = f41
+exp_S                  = f42
+EXP_NORM_f8            = f43   
+exp_S2                 = f44
+exp_T2                 = f45
+
+// FR for erfcf(x)
+//==============================================================
+FR_AbsArg              = f46
+FR_Tmp                 = f47
+FR_Tmp1                = f48
+FR_Tmpf                = f49
+FR_NormX               = f50
+
+FR_A15                 = f51
+FR_A14                 = f52
+
+FR_A13                 = f53
+FR_A12                 = f54
+
+FR_A11                 = f55
+FR_A10                 = f56
+
+FR_A9                  = f57
+FR_A8                  = f58
+
+FR_A7                  = f59
+FR_A6                  = f60
+
+FR_A5                  = f61
+FR_A4                  = f62
+
+FR_A3                  = f63
+FR_A2                  = f64
+
+FR_A1                  = f65
+FR_A0                  = f66
+
+FR_P15_0_1             = f67
+FR_P15_1_1             = f68
+FR_P15_1_2             = f69
+FR_P15_2_1             = f70
+FR_P15_2_2             = f71
+FR_P15_3_1             = f72
+FR_P15_3_2             = f73
+FR_P15_4_1             = f74
+FR_P15_4_2             = f75
+FR_P15_7_1             = f76
+FR_P15_7_2             = f77
+FR_P15_8_1             = f78
+FR_P15_9_1             = f79
+FR_P15_9_2             = f80
+FR_P15_13_1            = f81
+FR_P15_14_1            = f82
+FR_P15_14_2            = f83
+
+FR_2                   = f84
+FR_05                  = f85
+FR_1_by_6              = f86
+FR_Pol                 = f87
+FR_Exp                 = f88
+
+FR_POS_ARG_ASYMP       = f89
+FR_NEG_ARG_ASYMP       = f90
+
+FR_UnfBound            = f91
+FR_EpsNorm             = f92
+
+// Data tables
+//==============================================================
+RODATA
+.align 16
+
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
+
+// double-extended 1/ln(2)
+// 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
+// 3fff b8aa 3b29 5c17 f0bc 
+// For speed the significand will be loaded directly with a movl and setf.sig
+//   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
+//   computations need to scale appropriately.
+// The constant 128/ln(2) is needed for the computation of w.  This is also 
+//   obtained by scaling the computations.
+//
+// Two shifting constants are loaded directly with movl and setf.d. 
+//   1. EXP_RSHF_2TO56 = 1.1000..00 * 2^(63-7) 
+//        This constant is added to x*1/ln2 to shift the integer part of
+//        x*128/ln2 into the rightmost bits of the significand.
+//        The result of this fma is EXP_W_2TO56_RSH.
+//   2. EXP_RSHF       = 1.1000..00 * 2^(63) 
+//        This constant is subtracted from EXP_W_2TO56_RSH * 2^(-56) to give
+//        the integer part of w, n, as a floating-point number.
+//        The result of this fms is EXP_Nfloat.
+
+
+LOCAL_OBJECT_START(exp_table_1)
+
+data4 0x4120f5c3, 0x408ccccd      //POS_ARG_ASYMP = 10.06, NEG_ARG_ASYMP = 4.4
+data4 0x41131Cdf, 0x00800000     //UnfBound ~=~ 9.1, EpsNorm ~=~ 1.1754944e-38
+//
+data8 0xb17217f7d1cf79ab , 0x00003ff7                            // ln2/128 hi
+data8 0xc9e3b39803f2f6af , 0x00003fb7                            // ln2/128 lo
+//
+// Table 1 is 2^(index_1/128) where
+// index_1 goes from 0 to 15
+//
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x80B1ED4FD999AB6C , 0x00003FFF
+data8 0x8164D1F3BC030773 , 0x00003FFF
+data8 0x8218AF4373FC25EC , 0x00003FFF
+data8 0x82CD8698AC2BA1D7 , 0x00003FFF
+data8 0x8383594EEFB6EE37 , 0x00003FFF
+data8 0x843A28C3ACDE4046 , 0x00003FFF
+data8 0x84F1F656379C1A29 , 0x00003FFF
+data8 0x85AAC367CC487B15 , 0x00003FFF
+data8 0x8664915B923FBA04 , 0x00003FFF
+data8 0x871F61969E8D1010 , 0x00003FFF
+data8 0x87DB357FF698D792 , 0x00003FFF
+data8 0x88980E8092DA8527 , 0x00003FFF
+data8 0x8955EE03618E5FDD , 0x00003FFF
+data8 0x8A14D575496EFD9A , 0x00003FFF
+data8 0x8AD4C6452C728924 , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_1)
+
+// Table 2 is 2^(index_1/8) where
+// index_2 goes from 0 to 7
+
+LOCAL_OBJECT_START(exp_table_2)
+
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
+data8 0x9837F0518DB8A96F , 0x00003FFF
+data8 0xA5FED6A9B15138EA , 0x00003FFF
+data8 0xB504F333F9DE6484 , 0x00003FFF
+data8 0xC5672A115506DADD , 0x00003FFF
+data8 0xD744FCCAD69D6AF4 , 0x00003FFF
+data8 0xEAC0C6E7DD24392F , 0x00003FFF
+LOCAL_OBJECT_END(exp_table_2)
+
+LOCAL_OBJECT_START(erfc_p_table)
+
+// Pol_0 
+data8 0xBEA3260C63CB0446             //A15 = -5.70673541831883454676e-07
+data8 0x3EE63D6178077654             //A14 = +1.06047480138940182343e-05
+data8 0xBF18646BC5FC70A7             //A13 = -9.30491237309283694347e-05
+data8 0x3F40F92F909117FE             //A12 = +5.17986512144075019133e-04
+data8 0xBF611344289DE1E6             //A11 = -2.08438217390159994419e-03
+data8 0x3F7AF9FE6AD16DC0             //A10 = +6.58606893292862351928e-03
+data8 0xBF91D219E196CBA7             //A9 = -1.74030345858217321001e-02
+data8 0x3FA4AFDDA355854C             //A8 = +4.04042493708041968315e-02
+data8 0xBFB5D465BB7025AE             //A7 = -8.52721769916999425445e-02
+data8 0x3FC54C15A95B717D             //A6 = +1.66384418195672549029e-01
+data8 0xBFD340A75B4B1AB5             //A5 = -3.00821150926292166899e-01
+data8 0x3FDFFFC0BFCD247F             //A4 = +4.99984919839853542841e-01
+data8 0xBFE81270C361852B             //A3 = -7.52251035312075583309e-01
+data8 0x3FEFFFFFC67295FC             //A2 = +9.99999892800303301771e-01
+data8 0xBFF20DD74F8CD2BF             //A1 = -1.12837916445020868099e+00
+data8 0x3FEFFFFFFFFE7C1D             //A0 = +9.99999999988975570714e-01
+// Pol_1 
+data8 0xBDE8EC4BDD953B56             //A15 = -1.81338928934942767144e-10
+data8 0x3E43607F269E2A1C             //A14 = +9.02309090272196442358e-09
+data8 0xBE8C4D9E69C10E02             //A13 = -2.10875261143659275328e-07
+data8 0x3EC9CF2F84566725             //A12 = +3.07671055805877356583e-06
+data8 0xBF007980B1B46A4D             //A11 = -3.14228438702169818945e-05
+data8 0x3F2F4C3AD6DEF24A             //A10 = +2.38783056770846320260e-04
+data8 0xBF56F5129F8D30FA             //A9 = -1.40120333363130546426e-03
+data8 0x3F7AA6C7ABFC38EE             //A8 = +6.50671002200751820429e-03
+data8 0xBF98E7522CB84BEF             //A7 = -2.43199195666185511109e-02
+data8 0x3FB2F68EB1C3D073             //A6 = +7.40746673580490638637e-02
+data8 0xBFC7C16055AC6385             //A5 = -1.85588876564704611769e-01
+data8 0x3FD8A707AEF5A440             //A4 = +3.85194702967570635211e-01
+data8 0xBFE547BFE39AE2EA             //A3 = -6.65008492032112467310e-01
+data8 0x3FEE7C91BDF13578             //A2 = +9.52706213932898128515e-01
+data8 0xBFF1CB5B61F8C589             //A1 = -1.11214769621105541214e+00
+data8 0x3FEFEA56BC81FD37             //A0 = +9.97355812243688815239e-01
+// Pol_2 
+data8 0xBD302724A12F46E0             //A15 = -5.73866382814058809406e-14
+data8 0x3D98889B75D3102E             //A14 = +5.57829983681360947356e-12
+data8 0xBDF16EA15074A1E9             //A13 = -2.53671153922423457844e-10
+data8 0x3E3EC6E688CFEE5F             //A12 = +7.16581828336436419561e-09
+data8 0xBE82E5ED44C52609             //A11 = -1.40802202239825487803e-07
+data8 0x3EC120BE5CE42353             //A10 = +2.04180535157522081699e-06
+data8 0xBEF7B8B0311A1911             //A9 = -2.26225266204633600888e-05
+data8 0x3F29A281F43FC238             //A8 = +1.95577968156184077632e-04
+data8 0xBF55E19858B3B7A4             //A7 = -1.33552434527526534043e-03
+data8 0x3F7DAC8C3D12E5FD             //A6 = +7.24463253680473816303e-03
+data8 0xBF9FF9C04613FB47             //A5 = -3.12261622211693854028e-02
+data8 0x3FBB3D5DBF9D9366             //A4 = +1.06405123978743883370e-01
+data8 0xBFD224DE9F62C258             //A3 = -2.83500342989133623476e-01
+data8 0x3FE28A95CB8C6D3E             //A2 = +5.79417131000276437708e-01
+data8 0xBFEC21205D358672             //A1 = -8.79043752717008257224e-01
+data8 0x3FEDAE44D5EDFE5B             //A0 = +9.27523057776805771830e-01
+// Pol_3 
+data8 0xBCA3BCA734AC82F1             //A15 = -1.36952437983096410260e-16
+data8 0x3D16740DC3990612             //A14 = +1.99425676175410093285e-14
+data8 0xBD77F4353812C46A             //A13 = -1.36162367755616790260e-12
+data8 0x3DCFD0BE13C73DB4             //A12 = +5.78718761040355136007e-11
+data8 0xBE1D728DF71189B4             //A11 = -1.71406885583934105120e-09
+data8 0x3E64252C8CB710B5             //A10 = +3.75233795940731111303e-08
+data8 0xBEA514B93180F33D             //A9 = -6.28261292774310809962e-07
+data8 0x3EE1381118CC7151             //A8 = +8.21066421390821904504e-06
+data8 0xBF1634404FB0FA72             //A7 = -8.47019436358372148764e-05
+data8 0x3F46B2CBBCF0EB32             //A6 = +6.92700845213200923490e-04
+data8 0xBF725C2B445E6D81             //A5 = -4.48243046949004063741e-03
+data8 0x3F974E7CFA4D89D9             //A4 = +2.27603462002522228717e-02
+data8 0xBFB6D7BAC2E342D1             //A3 = -8.92292714882032736443e-02
+data8 0x3FD0D156AD9CE2A6             //A2 = +2.62777013343603696631e-01
+data8 0xBFE1C228572AADB0             //A1 = -5.54950876471982857725e-01
+data8 0x3FE8A739F48B9A3B             //A0 = +7.70413377406675619766e-01
+LOCAL_OBJECT_END(erfc_p_table)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(erfcf)
+
+// Form index i for table erfc_p_table as exponent of x 
+// We use i + bias in real calculations 
+{ .mlx
+      getf.exp       GR_IndxPlusBias = f8          // (sign + exp + bias) of x
+      movl           exp_GR_sig_inv_ln2 = 0xb8aa3b295c17f0bc //signif.of 1/ln2
+}
+{ .mlx
+      addl           EXP_AD_TB1    = @ltoff(exp_table_1), gp
+      movl           exp_GR_rshf_2to56 = 0x4768000000000000 // 1.100 2^(63+56)
+}
+;;
+
+// Form argument EXP_NORM_f8 for exp(-x^2)
+{ .mfi
+      ld8            EXP_AD_TB1    = [EXP_AD_TB1]
+      fcmp.ge.s1     p6,p7 = f8, f0                     // p6: x >= 0 ,p7: x<0
+      mov            GR_BIAS = 0x0FFFF
+}
+{ .mfi
+      mov            exp_GR_exp_2tom56 = 0xffff-56
+      fnma.s1        EXP_NORM_f8   = f8, f8, f0                       //  -x^2
+      mov            GR_ExpMask  = 0x1ffff
+}
+;;
+
+// Form two constants we need
+//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128 
+//  1.1000..000 * 2^(63+63-7) to right shift int(w) into the significand
+
+// p9:  x = 0,+inf,-inf,nan,unnorm.
+// p10: x!= 0,+inf,-inf,nan,unnorm.
+{ .mfi
+      setf.sig       EXP_INV_LN2_2TO63 = exp_GR_sig_inv_ln2 // Form 1/ln2*2^63
+      fclass.m       p9,p10 = f8,0xef       
+      shl            GR_ShftPi_bias = GR_BIAS, 7
+}
+{ .mfi
+      setf.d         EXP_RSHF_2TO56 = exp_GR_rshf_2to56 //Const 1.10*2^(63+56)
+      nop.f          0
+      and            GR_IndxPlusBias = GR_IndxPlusBias, GR_ExpMask // i + bias
+}
+;;
+
+{ .mfi
+      alloc          r32 = ar.pfs, 0, 15, 4, 0
+(p6)  fma.s1         FR_AbsArg = f1, f0, f8                  // |x| if x >= 0
+      cmp.lt         p15,p0 = GR_IndxPlusBias, GR_BIAS//p15: i < 0 (for |x|<1)
+}
+{ .mlx
+      setf.exp       EXP_2TOM56 = exp_GR_exp_2tom56 //2^-56 for scaling Nfloat
+      movl           exp_GR_rshf = 0x43e8000000000000 //1.10 2^63,right shift.
+}
+;;
+
+{ .mfi
+      ldfps          FR_POS_ARG_ASYMP, FR_NEG_ARG_ASYMP = [EXP_AD_TB1],8
+      nop.f          0
+(p15) mov            GR_IndxPlusBias = GR_BIAS            //Let i = 0 if i < 0
+}
+{ .mlx
+      mov            GR_P_POINT_3 = 0x1A0
+      movl           GR_05 = 0x3fe0000000000000
+}
+;;
+
+// Form shift GR_ShftPi from the beginning of erfc_p_table 
+// to the polynomial with number i
+{ .mfi
+      ldfps          FR_UnfBound, FR_EpsNorm = [EXP_AD_TB1],8
+      nop.f          0
+      shl            GR_ShftPi = GR_IndxPlusBias, 7
+}
+{ .mfi
+      setf.d         EXP_RSHF = exp_GR_rshf   // Form right shift 1.100 * 2^63
+(p7)  fms.s1         FR_AbsArg = f1, f0, f8                   // |x|  if x < 0
+      mov            exp_TB1_size  = 0x100 
+}
+;;
+
+// Form pointer GR_P_POINT_3 to the beginning of erfc_p_table 
+{ .mfi
+      setf.d         FR_05 = GR_05
+      nop.f          0
+      sub            GR_ShftPi = GR_ShftPi,GR_ShftPi_bias
+}
+{ .mfb
+      add            GR_P_POINT_3 = GR_P_POINT_3, EXP_AD_TB1
+      nop.f          0
+(p9)  br.cond.spnt   SPECIAL                  // For x = 0,+inf,-inf,nan,unnorm
+}
+;;
+
+{ .mfi
+      add            GR_P_POINT_1 = GR_P_POINT_3, GR_ShftPi
+      nop.f          0
+      add            GR_P_POINT_2 = GR_P_POINT_3, GR_ShftPi
+}
+{ .mfi
+      ldfe           exp_ln2_by_128_hi  = [EXP_AD_TB1],16 
+      fma.s1         FR_NormX = f8,f1,f0
+      add            GR_P_POINT_3 = GR_P_POINT_3, GR_ShftPi
+}
+;;
+
+// Load coefficients for polynomial P15(x)
+{ .mfi
+      ldfpd          FR_A15, FR_A14 = [GR_P_POINT_1], 16
+      nop.f          0      
+      add            GR_P_POINT_3 = 0x30, GR_P_POINT_3
+}
+{ .mfi
+      ldfe           exp_ln2_by_128_lo  = [EXP_AD_TB1], 16
+      nop.f          0      
+      add            GR_P_POINT_2 = 0x20, GR_P_POINT_2 
+}
+;;
+
+// Now EXP_AD_TB1 points to the beginning of table 1
+{ .mlx
+      ldfpd          FR_A13, FR_A12 = [GR_P_POINT_1] 
+      movl           GR_1_by_6 = 0x3FC5555555555555
+}
+{ .mfi
+      add            GR_P_POINT_4 = 0x30, GR_P_POINT_2
+      nop.f          0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      ldfpd          FR_A11, FR_A10 = [GR_P_POINT_2]
+      fma.s1         FR_2 = f1, f1, f1
+      mov            exp_TB2_size  = 0x80
+}
+{ .mfi
+      ldfpd          FR_A9, FR_A8 = [GR_P_POINT_3],16
+      nop.f          0
+      add            GR_P_POINT_1 = 0x60 ,GR_P_POINT_1
+}
+;;
+
+// W = X * Inv_log2_by_128
+// By adding 1.10...0*2^63 we shift and get round_int(W) in significand.
+// We actually add 1.10...0*2^56 to X * Inv_log2 to do the same thing.
+{ .mfi
+      ldfpd          FR_A7, FR_A6 = [GR_P_POINT_3] 
+      fma.s1     EXP_W_2TO56_RSH = EXP_NORM_f8,EXP_INV_LN2_2TO63,EXP_RSHF_2TO56
+      add            EXP_AD_TB2 = exp_TB1_size, EXP_AD_TB1
+      
+}
+{ .mfi
+      ldfpd          FR_A5, FR_A4 = [GR_P_POINT_4], 16
+      nop.f          0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      ldfpd          FR_A3, FR_A2 = [GR_P_POINT_4]
+      fmerge.s       FR_X = f8,f8
+      nop.i          0
+}
+{ .mfi 
+      ldfpd          FR_A1, FR_A0 = [GR_P_POINT_1]
+      nop.f          0
+      nop.i          0
+}
+;;
+
+//p14: x < - NEG_ARG_ASYMP = -4.4 -> erfcf(x) ~=~ 2.0
+{ .mfi
+      setf.d         FR_1_by_6  = GR_1_by_6
+(p7)  fcmp.gt.unc.s1 p14,p0 = FR_AbsArg, FR_NEG_ARG_ASYMP          //p7: x < 0
+      nop.i          0
+}
+;;
+
+//p15: x > POS_ARG_ASYMP = 10.06 -> erfcf(x) ~=~ 0.0
+{ .mfi
+      nop.m          0
+(p6)  fcmp.gt.unc.s1 p15,p0 = FR_AbsArg, FR_POS_ARG_ASYMP          //p6: x > 0
+      nop.i          0
+}                       
+;;
+
+{ .mfi
+      nop.m          0
+      fcmp.le.s1     p8,p0 = FR_NormX, FR_UnfBound        // p8: x <= UnfBound
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p14) fnma.s.s0      FR_RESULT = FR_EpsNorm, FR_EpsNorm, FR_2//y = 2 if x <-4.4
+(p14) br.ret.spnt    b0
+}
+;;
+
+// Nfloat = round_int(W) 
+// The signficand of EXP_W_2TO56_RSH contains the rounded integer part of W,
+// as a twos complement number in the lower bits (that is, it may be negative).
+// That twos complement number (called N) is put into exp_GR_N.
+
+// Since EXP_W_2TO56_RSH is scaled by 2^56, it must be multiplied by 2^-56
+// before the shift constant 1.10000 * 2^63 is subtracted to yield EXP_Nfloat.
+// Thus, EXP_Nfloat contains the floating point version of N
+
+{ .mfi
+      nop.m          0
+      fms.s1         EXP_Nfloat = EXP_W_2TO56_RSH, EXP_2TOM56, EXP_RSHF
+      nop.i          0
+} 
+{ .mfb
+(p15) mov            GR_Parameter_TAG = 209
+(p15) fma.s.s0       FR_RESULT = FR_EpsNorm,FR_EpsNorm,f0 //Result.for x>10.06
+(p15) br.cond.spnt   __libm_error_region
+}                   
+;;
+
+// Now we can calculate polynomial P15(x)
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_1_1 = FR_AbsArg, FR_AbsArg, f0             // x ^2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_0_1 = FR_A15, FR_AbsArg, FR_A14
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_1_2 = FR_A13, FR_AbsArg, FR_A12 
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      getf.sig       exp_GR_N        = EXP_W_2TO56_RSH 
+      fma.s1         FR_P15_2_1 = FR_A9, FR_AbsArg, FR_A8 
+      nop.i          0 
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_2_2 = FR_A11, FR_AbsArg, FR_A10 
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_3_1 = FR_A5, FR_AbsArg, FR_A4
+      nop.i          0                   
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_3_2 = FR_A7, FR_AbsArg, FR_A6
+      nop.i          0
+}
+;;
+
+// exp_GR_index_1 has index_1
+// exp_GR_index_2_16 has index_2 * 16
+// exp_GR_biased_M has M
+// exp_GR_index_1_16 has index_1 * 16
+
+// r2 has true M
+{ .mfi
+      and            exp_GR_index_1 = 0x0f, exp_GR_N
+      fma.s1         FR_P15_4_1 = FR_A1, FR_AbsArg, FR_A0
+      shr            r2 = exp_GR_N,  0x7
+       
+}
+{ .mfi
+      and            exp_GR_index_2_16 = 0x70, exp_GR_N
+      fma.s1         FR_P15_4_2 = FR_A3, FR_AbsArg, FR_A2
+      nop.i          0
+}
+;;
+
+// EXP_AD_T1 has address of T1                           
+// EXP_AD_T2 has address if T2                            
+
+{ .mfi
+      add            EXP_AD_T2 = EXP_AD_TB2, exp_GR_index_2_16
+      nop.f          0                      
+      shladd         EXP_AD_T1 = exp_GR_index_1, 4, EXP_AD_TB1
+}
+{ .mfi
+      addl           exp_GR_biased_M = 0xffff, r2
+      fnma.s1        exp_r   = EXP_Nfloat, exp_ln2_by_128_hi, EXP_NORM_f8
+      nop.i          0
+}
+;;
+
+// Create Scale = 2^M
+// r = x - Nfloat * ln2_by_128_hi 
+ 
+{ .mfi
+      setf.exp       EXP_2M = exp_GR_biased_M
+      fma.s1         FR_P15_7_1 = FR_P15_0_1, FR_P15_1_1, FR_P15_1_2
+      nop.i          0
+}
+{ .mfi
+      ldfe           exp_T2  = [EXP_AD_T2]      
+      nop.f          0
+      nop.i          0
+}
+;;
+
+// Load T1 and T2
+
+{ .mfi
+      ldfe           exp_T1  = [EXP_AD_T1]
+      fma.s1         FR_P15_7_2 = FR_P15_1_1, FR_P15_1_1, f0            // x^4
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_8_1 = FR_P15_1_1, FR_P15_2_2, FR_P15_2_1 
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_9_1 = FR_P15_1_1, FR_P15_4_2, FR_P15_4_1 
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_9_2 = FR_P15_1_1, FR_P15_3_2, FR_P15_3_1 
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         exp_P = FR_1_by_6, exp_r, FR_05 
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         exp_rsq = exp_r, exp_r, f0 
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_13_1 = FR_P15_7_2, FR_P15_7_1, FR_P15_8_1 
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_14_1 = FR_P15_7_2, FR_P15_9_2, FR_P15_9_1 
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_14_2 = FR_P15_7_2, FR_P15_7_2, f0           // x^8
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         exp_P     = exp_P, exp_rsq, exp_r
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         exp_S1  = EXP_2M, exp_T2, f0   
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_Pol = FR_P15_14_2, FR_P15_13_1, FR_P15_14_1  // P15(x)
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         exp_S   = exp_S1, exp_T1, f0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_Exp = exp_S, exp_P, exp_S                 // exp(-x^2)
+      nop.i          0          
+}
+;;   
+
+{ .mfi
+      nop.m          0
+      fma.s.s0       FR_Tmpf = f8, f1, f0                          //  Flag  d
+      nop.i          0 
+}
+;;
+
+//p6: result for     0 < x < = POS_ARG_ASYMP 
+//p7: result for   - NEG_ARG_ASYMP  <= x < 0
+//p8: exit   for   - NEG_ARG_ASYMP <= x <= UnfBound, x!=0
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m          0
+(p6)  fma.s.s0       f8 = FR_Exp, FR_Pol, f0 
+      nop.i          0         
+}
+{ .mfb
+      mov            GR_Parameter_TAG = 209
+(p7)  fnma.s.s0      f8 = FR_Exp, FR_Pol, FR_2
+(p8)  br.ret.sptk    b0 
+}
+;;
+
+//p10: branch for  UnfBound < x < = POS_ARG_ASYMP
+{ .mfb
+      nop.m          0
+      nop.f          0
+(p10) br.cond.spnt   __libm_error_region  
+}
+;;
+
+//Only via (p9)  br.cond.spnt   SPECIAL  for x = 0,+inf,-inf,nan,unnorm
+SPECIAL:
+
+{ .mfi
+      nop.m          0
+      fclass.m.unc   p10,p0 = f8,0x07                            // p10: x = 0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fclass.m.unc   p11,p0 = f8,0x21                         // p11: x = +inf
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fclass.m.unc   p12,p0 = f8,0x22                          // p12 x = -inf
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p10) fma.s.s0       f8 = f1, f1, f0
+(p10) br.ret.sptk    b0                                // Quick exit for x = 0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fclass.m.unc   p13,p0 = f8,0xc3                          // p13: x = nan
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p11) fma.s.s0       f8 = f0, f1, f0
+(p11) br.ret.spnt    b0                             // Quick exit for x = +inf
+}
+;;
+{ .mfi
+      nop.m          0
+      fclass.m.unc   p14,p0 = f8,0x0b                 // P14: x = unnormalized
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p12) fma.s.s0       f8 = f1, f1, f1
+(p12) br.ret.spnt    b0                             // Quick exit for x = -inf
+}
+;;
+
+{ .mfb
+      nop.m          0
+(p13) fma.s.s0       f8 = f8, f1, f0
+(p13) br.ret.sptk    b0                              // Quick exit for x = nan
+}
+;;
+
+{ .mfb
+      nop.m          0
+(p14) fnma.s.s0      f8 = f8, f1, f1
+(p14) br.ret.sptk    b0                     // Quick exit for x = unnormalized
+}
+;;
+
+GLOBAL_LIBM_END(erfcf)
+
+
+// Call via (p10) br.cond.spnt   __libm_error_region
+//          for  UnfBound < x < = POS_ARG_ASYMP 
+// and
+// 
+// call via (p15) br.cond.spnt   __libm_error_region
+//          for  x > POS_ARG_ASYMP
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp                       // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                                      // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                                           // Save gp
+};;
+{ .mmi
+        stfs [GR_Parameter_Y] = FR_Y,16          // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp                      // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                                           // Save b0
+};;
+.body
+{ .mib
+        stfs [GR_Parameter_X] = FR_X             // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0                                      
+}
+{ .mib
+        stfs [GR_Parameter_Y] = FR_RESULT        // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfs  f8 = [GR_Parameter_RESULT]        // Get return result off stack
+.restore sp
+        add   sp = 64,sp                              // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                        // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                                    // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS                           // Restore ar.pfs
+        br.ret.sptk     b0                                           // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
+
diff --git a/sysdeps/ia64/fpu/s_erfcl.S b/sysdeps/ia64/fpu/s_erfcl.S
new file mode 100644
index 0000000000..266e1e1c91
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_erfcl.S
@@ -0,0 +1,2066 @@
+.file "erfcl.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 11/12/01  Initial version
+// 02/08/02  Added missing }
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/10/03  Reordered header: .section, .global, .proc, .align;
+//           used data8 for long double table values
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// long double erfcl(long double)
+//
+// Implementation and Algorithm Notes:
+//==============================================================
+// 1. 0 <= x <= 107.0
+//    
+//    erfcl(x) ~=~ P15(z) * expl( -x^2 )/(dx + x), z = x - xc(i).
+//
+//    Comment:
+//
+//    Let x(i) = -1.0 + 2^(i/4),i=0,...27. So we have 28 unequal
+//    argument intervals [x(i),x(i+1)] with length ratio q = 2^(1/4).
+//    Values xc(i) we have in the table erfc_xc_table,xc(i)=x(i)for i = 0
+//    and xc(i)= 0.5*( x(i)+x(i+1) ) for i>0.
+// 
+//    Let x(i)<= x < x(i+1).
+//    We can find i as exponent of number (x + 1)^4.
+// 
+//    Let P15(z)= a0+ a1*z +..+a15*z^15 - polynomial approximation of degree 15
+//    for function      erfcl(z+xc(i)) * expl( (z+xc(i))^2)* (dx+z+xc(i)) and 
+//    -0.5*[x(i+1)-x(i)] <= z <= 0.5*[x(i+1)-x(i)].
+//
+//    Let  Q(z)= (P(z)- S)/S, S = a0, rounded to 16 bits.
+//    Polynomial coeffitients for Q(z) we have in the table erfc_Q_table as
+//    long double values
+//
+//    We use multi precision to calculate input argument -x^2 for expl and 
+//    for u = 1/(dx + x). 
+//
+//    Algorithm description for expl function see below. In accordance with
+//    denotation of this algorithm we have for expl:
+//
+//    expl(X) ~=~ 2^K*T_1*(1+W_1)*T_2*(1+W_2)*(1+ poly(r)), X = -x^2. 
+//
+//    Final calculations for erfcl:
+// 
+//    erfcl(x) ~=~
+//
+//         2^K*T_1*(1+W_1)*T_2*(1+W_2)*(1+ poly(r))*(1-dy)*S*(1+Q(z))*u*(1+du),
+//
+//    where dy - low bits of x^2 and u, u*du - hi and low bits of 1/(dx + x).
+//
+//    The order of calculations is the next:
+//
+//    1)  M = 2^K*T_1*T_2*S          without rounding error,
+//    2)  W = W_1 + (W_2 + W_1*W_2), where 1+W  ~=~ (1+W_1)(1+W_2),
+//    3)  H = W - dy,                where 1+H  ~=~ (1+W )(1-dy),
+//    4)  R = poly(r)*H + poly(r),    
+//    5)  R = H + R              ,   where 1+R  ~=~ (1+H )(1+poly(r)),
+//    6)  G = Q(z)*R + Q(z),
+//    7)  R1 = R + du,               where 1+R1 ~=~ (1+R)(1+du),
+//    8)  G1 = R1 + G,               where 1+G1 ~=~ (1+R1)(1+Q(z)),
+//    9)  V  = G1*M*u,
+//    10) erfcl(x) ~=~ M*u + V     
+//                     
+// 2. -6.5 <= x < 0
+//
+//    erfcl(x)  = 2.0 - erfl(-x)
+//
+// 3. x > 107.0
+//    erfcl(x)  ~=~ 0.0                      
+//
+// 4. x < -6.5            
+//    erfcl(x)  ~=~ 2.0                      
+
+// Special values 
+//==============================================================
+// erfcl(+0)    = 1.0
+// erfcl(-0)    = 1.0
+
+// erfcl(+qnan) = +qnan 
+// erfcl(-qnan) = -qnan 
+// erfcl(+snan) = +qnan 
+// erfcl(-snan) = -qnan 
+
+// erfcl(-inf)  = 2.0 
+// erfcl(+inf)  = +0
+
+//==============================================================
+// Algorithm description of used expl function.
+//
+// Implementation and Algorithm Notes:
+//
+//  ker_exp_64( in_FR  : X,
+//            out_FR : Y_hi,
+//            out_FR : Y_lo,
+//            out_FR : scale,
+//            out_PR : Safe )
+//
+// On input, X is in register format
+//
+// On output, 
+//
+//   scale*(Y_hi + Y_lo)  approximates  exp(X)
+//
+// The accuracy is sufficient for a highly accurate 64 sig.
+// bit implementation.  Safe is set if there is no danger of 
+// overflow/underflow when the result is composed from scale, 
+// Y_hi and Y_lo. Thus, we can have a fast return if Safe is set. 
+// Otherwise, one must prepare to handle the possible exception 
+// appropriately.  Note that SAFE not set (false) does not mean 
+// that overflow/underflow will occur; only the setting of SAFE
+// guarantees the opposite.
+//
+// **** High Level Overview **** 
+//
+// The method consists of three cases.
+// 
+// If           |X| < Tiny  use case exp_tiny;
+// else if  |X| < 2^(-6)    use case exp_small;
+// else     use case exp_regular;
+//
+// Case exp_tiny:
+//
+//   1 + X     can be used to approximate exp(X) 
+//   X + X^2/2 can be used to approximate exp(X) - 1
+//
+// Case exp_small:
+//
+//   Here, exp(X) and exp(X) - 1 can all be 
+//   appproximated by a relatively simple polynomial.
+//
+//   This polynomial resembles the truncated Taylor series
+//
+//  exp(w) = 1 + w + w^2/2! + w^3/3! + ... + w^n/n!
+//
+// Case exp_regular:
+//
+//   Here we use a table lookup method. The basic idea is that in
+//   order to compute exp(X), we accurately decompose X into
+//
+//   X = N * log(2)/(2^12)  + r,    |r| <= log(2)/2^13.
+//
+//   Hence
+//
+//   exp(X) = 2^( N / 2^12 ) * exp(r).
+//
+//   The value 2^( N / 2^12 ) is obtained by simple combinations
+//   of values calculated beforehand and stored in table; exp(r)
+//   is approximated by a short polynomial because |r| is small.
+//
+//   We elaborate this method in 4 steps.
+//
+//   Step 1: Reduction
+//
+//   The value 2^12/log(2) is stored as a double-extended number
+//   L_Inv.
+//
+//   N := round_to_nearest_integer( X * L_Inv )
+//
+//   The value log(2)/2^12 is stored as two numbers L_hi and L_lo so
+//   that r can be computed accurately via
+//
+//   r := (X - N*L_hi) - N*L_lo
+//
+//   We pick L_hi such that N*L_hi is representable in 64 sig. bits
+//   and thus the FMA   X - N*L_hi   is error free. So r is the 
+//   1 rounding error from an exact reduction with respect to 
+//   
+//   L_hi + L_lo.
+//
+//   In particular, L_hi has 30 significant bit and can be stored
+//   as a double-precision number; L_lo has 64 significant bits and
+//   stored as a double-extended number.
+//
+//   Step 2: Approximation
+//
+//   exp(r) - 1 is approximated by a short polynomial of the form
+//   
+//   r + A_1 r^2 + A_2 r^3 + A_3 r^4 .
+//
+//   Step 3: Composition from Table Values 
+//
+//   The value 2^( N / 2^12 ) can be composed from a couple of tables
+//   of precalculated values. First, express N as three integers
+//   K, M_1, and M_2 as
+//
+//     N  =  K * 2^12  + M_1 * 2^6 + M_2
+//
+//   Where 0 <= M_1, M_2 < 2^6; and K can be positive or negative.
+//   When N is represented in 2's complement, M_2 is simply the 6
+//   lsb's, M_1 is the next 6, and K is simply N shifted right
+//   arithmetically (sign extended) by 12 bits.
+//
+//   Now, 2^( N / 2^12 ) is simply  
+//  
+//      2^K * 2^( M_1 / 2^6 ) * 2^( M_2 / 2^12 )
+//
+//   Clearly, 2^K needs no tabulation. The other two values are less
+//   trivial because if we store each accurately to more than working
+//   precision, than its product is too expensive to calculate. We
+//   use the following method.
+//
+//   Define two mathematical values, delta_1 and delta_2, implicitly
+//   such that
+//
+//     T_1 = exp( [M_1 log(2)/2^6]  -  delta_1 ) 
+//     T_2 = exp( [M_2 log(2)/2^12] -  delta_2 )
+//
+//   are representable as 24 significant bits. To illustrate the idea,
+//   we show how we define delta_1: 
+//
+//     T_1     := round_to_24_bits( exp( M_1 log(2)/2^6 ) )
+//     delta_1  = (M_1 log(2)/2^6) - log( T_1 )  
+//
+//   The last equality means mathematical equality. We then tabulate
+//
+//     W_1 := exp(delta_1) - 1
+//     W_2 := exp(delta_2) - 1
+//
+//   Both in double precision.
+//
+//   From the tabulated values T_1, T_2, W_1, W_2, we compose the values
+//   T and W via
+//
+//     T := T_1 * T_2           ...exactly
+//     W := W_1 + (1 + W_1)*W_2 
+//
+//   W approximates exp( delta ) - 1  where delta = delta_1 + delta_2.
+//   The mathematical product of T and (W+1) is an accurate representation
+//   of 2^(M_1/2^6) * 2^(M_2/2^12).
+//
+//   Step 4. Reconstruction
+//
+//   Finally, we can reconstruct exp(X), exp(X) - 1. 
+//   Because
+//
+//  X = K * log(2) + (M_1*log(2)/2^6  - delta_1) 
+//             + (M_2*log(2)/2^12 - delta_2)
+//             + delta_1 + delta_2 + r      ...accurately
+//   We have
+//
+//  exp(X) ~=~ 2^K * ( T + T*[exp(delta_1+delta_2+r) - 1] )
+//         ~=~ 2^K * ( T + T*[exp(delta + r) - 1]         )
+//         ~=~ 2^K * ( T + T*[(exp(delta)-1)  
+//               + exp(delta)*(exp(r)-1)]   )
+//             ~=~ 2^K * ( T + T*( W + (1+W)*poly(r) ) )
+//             ~=~ 2^K * ( Y_hi  +  Y_lo )
+//
+//   where Y_hi = T  and Y_lo = T*(W + (1+W)*poly(r))
+//
+//   For exp(X)-1, we have
+//
+//  exp(X)-1 ~=~ 2^K * ( Y_hi + Y_lo ) - 1
+//       ~=~ 2^K * ( Y_hi + Y_lo - 2^(-K) )
+//
+//   and we combine Y_hi + Y_lo - 2^(-N)  into the form of two 
+//   numbers  Y_hi + Y_lo carefully.
+//
+//   **** Algorithm Details ****
+//
+//   A careful algorithm must be used to realize the mathematical ideas
+//   accurately. We describe each of the three cases. We assume SAFE
+//   is preset to be TRUE.
+//
+//   Case exp_tiny:
+//
+//   The important points are to ensure an accurate result under 
+//   different rounding directions and a correct setting of the SAFE 
+//   flag.
+//
+//   If expm1 is 1, then
+//      SAFE  := False  ...possibility of underflow
+//      Scale := 1.0
+//      Y_hi  := X
+//      Y_lo  := 2^(-17000)
+//   Else
+//      Scale := 1.0
+//      Y_hi  := 1.0
+//      Y_lo  := X  ...for different rounding modes
+//   Endif
+//
+//   Case exp_small:
+//
+//   Here we compute a simple polynomial. To exploit parallelism, we split
+//   the polynomial into several portions.
+//
+//   Let r = X 
+//
+//   If exp     ...i.e. exp( argument )
+//
+//      rsq := r * r; 
+//      r4  := rsq*rsq
+//      poly_lo := P_3 + r*(P_4 + r*(P_5 + r*P_6))
+//      poly_hi := r + rsq*(P_1 + r*P_2)
+//      Y_lo    := poly_hi + r4 * poly_lo
+//      Y_hi    := 1.0
+//      Scale   := 1.0
+//
+//   Else           ...i.e. exp( argument ) - 1
+//
+//      rsq := r * r
+//      r4  := rsq * rsq
+//      r6  := rsq * r4
+//      poly_lo := r6*(Q_5 + r*(Q_6 + r*Q_7))
+//      poly_hi := Q_1 + r*(Q_2 + r*(Q_3 + r*Q_4))
+//      Y_lo    := rsq*poly_hi +  poly_lo
+//      Y_hi    := X
+//      Scale   := 1.0
+//
+//   Endif
+//
+//  Case exp_regular:
+//
+//  The previous description contain enough information except the
+//  computation of poly and the final Y_hi and Y_lo in the case for
+//  exp(X)-1.
+//
+//  The computation of poly for Step 2:
+//
+//   rsq := r*r
+//   poly := r + rsq*(A_1 + r*(A_2 + r*A_3))
+//
+//  For the case exp(X) - 1, we need to incorporate 2^(-K) into
+//  Y_hi and Y_lo at the end of Step 4.
+//
+//   If K > 10 then
+//      Y_lo := Y_lo - 2^(-K)
+//   Else
+//      If K < -10 then
+//   Y_lo := Y_hi + Y_lo
+//   Y_hi := -2^(-K)
+//      Else
+//   Y_hi := Y_hi - 2^(-K)
+//      End If
+//   End If
+//
+
+// Overview of operation
+//==============================================================
+
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input
+// f9 -> f14,  f36 -> f126
+
+// General registers used: 
+// r32 -> r71 
+
+// Predicate registers used:
+// p6 -> p15
+
+// Assembly macros
+//==============================================================
+// GR for exp(X)
+GR_ad_Arg           = r33
+GR_ad_C             = r34
+GR_ERFC_S_TB        = r35
+GR_signexp_x        = r36
+GR_exp_x            = r36
+GR_exp_mask         = r37
+GR_ad_W1            = r38
+GR_ad_W2            = r39
+GR_M2               = r40
+GR_M1               = r41
+GR_K                = r42
+GR_exp_2_k          = r43
+GR_ad_T1            = r44
+GR_ad_T2            = r45
+GR_N_fix            = r46
+GR_ad_P             = r47
+GR_exp_bias         = r48
+GR_BIAS             = r48
+GR_exp_half         = r49
+GR_sig_inv_ln2      = r50
+GR_rshf_2to51       = r51
+GR_exp_2tom51       = r52
+GR_rshf             = r53
+
+// GR for erfcl(x)
+//==============================================================
+
+GR_ERFC_XC_TB       = r54
+GR_ERFC_P_TB        = r55
+GR_IndxPlusBias     = r56
+GR_P_POINT_1        = r57
+GR_P_POINT_2        = r58
+GR_AbsArg           = r59
+GR_ShftXBi          = r60
+GR_ShftPi           = r61
+GR_mBIAS            = r62
+GR_ShftPi_bias      = r63
+GR_ShftXBi_bias     = r64
+GR_ShftA14          = r65
+GR_ShftA15          = r66
+GR_EpsNorm          = r67
+GR_0x1              = r68
+GR_ShftPi_8         = r69
+GR_26PlusBias       = r70
+GR_27PlusBias       = r71
+
+// GR for __libm_support call
+//==============================================================
+GR_SAVE_B0          = r64
+GR_SAVE_PFS         = r65
+GR_SAVE_GP          = r66
+GR_SAVE_SP          = r67
+
+GR_Parameter_X      = r68
+GR_Parameter_Y      = r69
+GR_Parameter_RESULT = r70
+GR_Parameter_TAG    = r71
+
+//==============================================================
+// Floating Point Registers
+//
+FR_RSHF_2TO51       = f10
+FR_INV_LN2_2TO63    = f11
+FR_W_2TO51_RSH      = f12
+FR_2TOM51           = f13
+FR_RSHF             = f14
+
+FR_scale            = f36
+FR_float_N          = f37
+FR_N_signif         = f38
+FR_L_hi             = f39
+FR_L_lo             = f40
+FR_r                = f41
+FR_W1               = f42
+FR_T1               = f43
+FR_W2               = f44
+FR_T2               = f45
+FR_rsq              = f46
+FR_C2               = f47
+FR_C3               = f48
+FR_poly             = f49
+FR_P6               = f49
+FR_T                = f50
+FR_P5               = f50
+FR_P4               = f51
+FR_W                = f51
+FR_P3               = f52
+FR_Wp1              = f52
+FR_P2               = f53
+FR_P1               = f54
+FR_Q7               = f56
+FR_Q6               = f57
+FR_Q5               = f58
+FR_Q4               = f59
+FR_Q3               = f60
+FR_Q2               = f61
+FR_Q1               = f62
+FR_C1               = f63
+FR_A15              = f64
+FR_ch_dx            = f65
+FR_T_scale          = f66
+FR_norm_x           = f67
+FR_AbsArg           = f68
+FR_POS_ARG_ASYMP    = f69
+FR_NEG_ARG_ASYMP    = f70
+FR_Tmp              = f71
+FR_Xc               = f72
+FR_A0               = f73
+FR_A1               = f74
+FR_A2               = f75
+FR_A3               = f76
+FR_A4               = f77
+FR_A5               = f78
+FR_A6               = f79
+FR_A7               = f80
+FR_A8               = f81
+FR_A9               = f82
+FR_A10              = f83
+FR_A11              = f84
+FR_A12              = f85
+FR_A13              = f86
+FR_A14              = f87
+FR_P15_0_1          = f88
+FR_P15_8_1          = f88
+FR_P15_1_1          = f89
+FR_P15_8_2          = f89
+FR_P15_1_2          = f90
+FR_P15_2_1          = f91
+FR_P15_2_2          = f92
+FR_P15_3_1          = f93
+FR_P15_3_2          = f94
+FR_P15_4_2          = f95
+FR_P15_7_1          = f96
+FR_P15_7_2          = f97
+FR_P15_9_1          = f98
+FR_P15_9_2          = f99
+FR_P15_13_1         = f100
+FR_P15_14_1         = f101
+FR_P15_14_2         = f102
+FR_Tmp2             = f103
+FR_Xpdx_lo          = f104
+FR_2                = f105
+FR_xsq_lo           = f106
+FR_LocArg           = f107
+FR_Tmpf             = f108
+FR_Tmp1             = f109
+FR_EpsNorm          = f110
+FR_UnfBound         = f111
+FR_NormX            = f112
+FR_Xpdx_hi          = f113
+FR_dU               = f114
+FR_H                = f115
+FR_G                = f116
+FR_V                = f117
+FR_M                = f118
+FR_U                = f119
+FR_Q                = f120
+FR_S                = f121
+FR_R                = f122
+FR_res_pos_x_hi     = f123
+FR_res_pos_x_lo     = f124
+FR_dx               = f125
+FR_dx1              = f126
+
+// for error handler routine
+FR_X                = f9
+FR_Y                = f0
+FR_RESULT           = f8
+
+// Data tables
+//==============================================================
+RODATA
+.align 16
+
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
+LOCAL_OBJECT_START(exp_table_1)
+
+data8 0xae89f995ad3ad5ea , 0x00003ffe      // x = 0.681..,bound for dx = 0.875
+data8 0x405AC00000000000 , 0x401A000000000000        //ARG_ASYMP,NEG_ARG_ASYMP
+data8 0x3FE4000000000000 , 0x3FEC000000000000                    //0.625,0.875
+data8 0xD5126065B720A4e9 , 0x00004005                    // underflow boundary
+data8 0x8000000000000000 , 0x00000001                             //FR_EpsNorm
+LOCAL_OBJECT_END(exp_table_1)
+
+LOCAL_OBJECT_START(Constants_exp_64_Arg)
+data8 0xB17217F400000000,0x00003FF2 //L_hi = hi part log(2)/2^12
+data8 0xF473DE6AF278ECE6,0x00003FD4 //L_lo = lo part log(2)/2^12
+LOCAL_OBJECT_END(Constants_exp_64_Arg)
+
+LOCAL_OBJECT_START(Constants_exp_64_C)
+data8 0xAAAAAAABB1B736A0,0x00003FFA // C3
+data8 0xAAAAAAAB90CD6327,0x00003FFC // C2
+data8 0xFFFFFFFFFFFFFFFF,0x00003FFD // C1
+LOCAL_OBJECT_END(Constants_exp_64_C)
+
+LOCAL_OBJECT_START(Constants_exp_64_T1)
+data4 0x3F800000,0x3F8164D2,0x3F82CD87,0x3F843A29 
+data4 0x3F85AAC3,0x3F871F62,0x3F88980F,0x3F8A14D5 
+data4 0x3F8B95C2,0x3F8D1ADF,0x3F8EA43A,0x3F9031DC
+data4 0x3F91C3D3,0x3F935A2B,0x3F94F4F0,0x3F96942D
+data4 0x3F9837F0,0x3F99E046,0x3F9B8D3A,0x3F9D3EDA
+data4 0x3F9EF532,0x3FA0B051,0x3FA27043,0x3FA43516
+data4 0x3FA5FED7,0x3FA7CD94,0x3FA9A15B,0x3FAB7A3A
+data4 0x3FAD583F,0x3FAF3B79,0x3FB123F6,0x3FB311C4
+data4 0x3FB504F3,0x3FB6FD92,0x3FB8FBAF,0x3FBAFF5B
+data4 0x3FBD08A4,0x3FBF179A,0x3FC12C4D,0x3FC346CD
+data4 0x3FC5672A,0x3FC78D75,0x3FC9B9BE,0x3FCBEC15
+data4 0x3FCE248C,0x3FD06334,0x3FD2A81E,0x3FD4F35B
+data4 0x3FD744FD,0x3FD99D16,0x3FDBFBB8,0x3FDE60F5
+data4 0x3FE0CCDF,0x3FE33F89,0x3FE5B907,0x3FE8396A
+data4 0x3FEAC0C7,0x3FED4F30,0x3FEFE4BA,0x3FF28177
+data4 0x3FF5257D,0x3FF7D0DF,0x3FFA83B3,0x3FFD3E0C
+LOCAL_OBJECT_END(Constants_exp_64_T1)
+
+LOCAL_OBJECT_START(Constants_exp_64_T2)
+data4 0x3F800000,0x3F80058C,0x3F800B18,0x3F8010A4 
+data4 0x3F801630,0x3F801BBD,0x3F80214A,0x3F8026D7 
+data4 0x3F802C64,0x3F8031F2,0x3F803780,0x3F803D0E 
+data4 0x3F80429C,0x3F80482B,0x3F804DB9,0x3F805349 
+data4 0x3F8058D8,0x3F805E67,0x3F8063F7,0x3F806987 
+data4 0x3F806F17,0x3F8074A8,0x3F807A39,0x3F807FCA 
+data4 0x3F80855B,0x3F808AEC,0x3F80907E,0x3F809610 
+data4 0x3F809BA2,0x3F80A135,0x3F80A6C7,0x3F80AC5A 
+data4 0x3F80B1ED,0x3F80B781,0x3F80BD14,0x3F80C2A8 
+data4 0x3F80C83C,0x3F80CDD1,0x3F80D365,0x3F80D8FA 
+data4 0x3F80DE8F,0x3F80E425,0x3F80E9BA,0x3F80EF50 
+data4 0x3F80F4E6,0x3F80FA7C,0x3F810013,0x3F8105AA 
+data4 0x3F810B41,0x3F8110D8,0x3F81166F,0x3F811C07 
+data4 0x3F81219F,0x3F812737,0x3F812CD0,0x3F813269 
+data4 0x3F813802,0x3F813D9B,0x3F814334,0x3F8148CE 
+data4 0x3F814E68,0x3F815402,0x3F81599C,0x3F815F37
+LOCAL_OBJECT_END(Constants_exp_64_T2)
+
+LOCAL_OBJECT_START(Constants_exp_64_W1)
+data8 0x0000000000000000, 0xBE384454171EC4B4
+data8 0xBE6947414AA72766, 0xBE5D32B6D42518F8
+data8 0x3E68D96D3A319149, 0xBE68F4DA62415F36
+data8 0xBE6DDA2FC9C86A3B, 0x3E6B2E50F49228FE
+data8 0xBE49C0C21188B886, 0x3E64BFC21A4C2F1F
+data8 0xBE6A2FBB2CB98B54, 0x3E5DC5DE9A55D329
+data8 0x3E69649039A7AACE, 0x3E54728B5C66DBA5
+data8 0xBE62B0DBBA1C7D7D, 0x3E576E0409F1AF5F
+data8 0x3E6125001A0DD6A1, 0xBE66A419795FBDEF
+data8 0xBE5CDE8CE1BD41FC, 0xBE621376EA54964F
+data8 0x3E6370BE476E76EE, 0x3E390D1A3427EB92
+data8 0x3E1336DE2BF82BF8, 0xBE5FF1CBD0F7BD9E
+data8 0xBE60A3550CEB09DD, 0xBE5CA37E0980F30D
+data8 0xBE5C541B4C082D25, 0xBE5BBECA3B467D29
+data8 0xBE400D8AB9D946C5, 0xBE5E2A0807ED374A
+data8 0xBE66CB28365C8B0A, 0x3E3AAD5BD3403BCA
+data8 0x3E526055C7EA21E0, 0xBE442C75E72880D6
+data8 0x3E58B2BB85222A43, 0xBE5AAB79522C42BF
+data8 0xBE605CB4469DC2BC, 0xBE589FA7A48C40DC
+data8 0xBE51C2141AA42614, 0xBE48D087C37293F4
+data8 0x3E367A1CA2D673E0, 0xBE51BEBB114F7A38
+data8 0xBE6348E5661A4B48, 0xBDF526431D3B9962
+data8 0x3E3A3B5E35A78A53, 0xBE46C46C1CECD788
+data8 0xBE60B7EC7857D689, 0xBE594D3DD14F1AD7
+data8 0xBE4F9C304C9A8F60, 0xBE52187302DFF9D2
+data8 0xBE5E4C8855E6D68F, 0xBE62140F667F3DC4
+data8 0xBE36961B3BF88747, 0x3E602861C96EC6AA
+data8 0xBE3B5151D57FD718, 0x3E561CD0FC4A627B
+data8 0xBE3A5217CA913FEA, 0x3E40A3CC9A5D193A
+data8 0xBE5AB71310A9C312, 0x3E4FDADBC5F57719
+data8 0x3E361428DBDF59D5, 0x3E5DB5DB61B4180D
+data8 0xBE42AD5F7408D856, 0x3E2A314831B2B707
+LOCAL_OBJECT_END(Constants_exp_64_W1)
+
+LOCAL_OBJECT_START(Constants_exp_64_W2)
+data8 0x0000000000000000, 0xBE641F2537A3D7A2
+data8 0xBE68DD57AD028C40, 0xBE5C77D8F212B1B6
+data8 0x3E57878F1BA5B070, 0xBE55A36A2ECAE6FE
+data8 0xBE620608569DFA3B, 0xBE53B50EA6D300A3
+data8 0x3E5B5EF2223F8F2C, 0xBE56A0D9D6DE0DF4
+data8 0xBE64EEF3EAE28F51, 0xBE5E5AE2367EA80B
+data8 0x3E47CB1A5FCBC02D, 0xBE656BA09BDAFEB7
+data8 0x3E6E70C6805AFEE7, 0xBE6E0509A3415EBA
+data8 0xBE56856B49BFF529, 0x3E66DD3300508651
+data8 0x3E51165FC114BC13, 0x3E53333DC453290F
+data8 0x3E6A072B05539FDA, 0xBE47CD877C0A7696
+data8 0xBE668BF4EB05C6D9, 0xBE67C3E36AE86C93
+data8 0xBE533904D0B3E84B, 0x3E63E8D9556B53CE
+data8 0x3E212C8963A98DC8, 0xBE33138F032A7A22
+data8 0x3E530FA9BC584008, 0xBE6ADF82CCB93C97
+data8 0x3E5F91138370EA39, 0x3E5443A4FB6A05D8
+data8 0x3E63DACD181FEE7A, 0xBE62B29DF0F67DEC
+data8 0x3E65C4833DDE6307, 0x3E5BF030D40A24C1
+data8 0x3E658B8F14E437BE, 0xBE631C29ED98B6C7
+data8 0x3E6335D204CF7C71, 0x3E529EEDE954A79D
+data8 0x3E5D9257F64A2FB8, 0xBE6BED1B854ED06C
+data8 0x3E5096F6D71405CB, 0xBE3D4893ACB9FDF5
+data8 0xBDFEB15801B68349, 0x3E628D35C6A463B9
+data8 0xBE559725ADE45917, 0xBE68C29C042FC476
+data8 0xBE67593B01E511FA, 0xBE4A4313398801ED
+data8 0x3E699571DA7C3300, 0x3E5349BE08062A9E
+data8 0x3E5229C4755BB28E, 0x3E67E42677A1F80D
+data8 0xBE52B33F6B69C352, 0xBE6B3550084DA57F
+data8 0xBE6DB03FD1D09A20, 0xBE60CBC42161B2C1
+data8 0x3E56ED9C78A2B771, 0xBE508E319D0FA795
+data8 0xBE59482AFD1A54E9, 0xBE2A17CEB07FD23E
+data8 0x3E68BF5C17365712, 0x3E3956F9B3785569
+LOCAL_OBJECT_END(Constants_exp_64_W2)
+
+
+LOCAL_OBJECT_START(erfc_xc_table)
+
+data8 0x0000000000000000, 0x00000000 //XC[0] = +0.00000000000000000000e-01L
+data8 0x9A79C70000000000, 0x00003FFD //XC[1] = +3.01710337400436401367e-01L
+data8 0x8C49EF0000000000, 0x00003FFE //XC[2] = +5.48003137111663818359e-01L
+data8 0xD744FC0000000000, 0x00003FFE //XC[3] = +8.40896368026733398438e-01L
+data8 0x9837F00000000000, 0x00003FFF //XC[4] = +1.18920707702636718750e+00L
+data8 0xCD3CE30000000000, 0x00003FFF //XC[5] = +1.60342061519622802734e+00L
+data8 0x8624F70000000000, 0x00004000 //XC[6] = +2.09600615501403808594e+00L
+data8 0xABA27E0000000000, 0x00004000 //XC[7] = +2.68179273605346679688e+00L
+data8 0xD837F00000000000, 0x00004000 //XC[8] = +3.37841415405273437500e+00L
+data8 0x869E710000000000, 0x00004001 //XC[9] = +4.20684099197387695313e+00L
+data8 0xA624F70000000000, 0x00004001 //XC[10] = +5.19201231002807617188e+00L
+data8 0xCBA27E0000000000, 0x00004001 //XC[11] = +6.36358547210693359375e+00L
+data8 0xF837F00000000000, 0x00004001 //XC[12] = +7.75682830810546875000e+00L
+data8 0x969E710000000000, 0x00004002 //XC[13] = +9.41368198394775390625e+00L
+data8 0xB624F70000000000, 0x00004002 //XC[14] = +1.13840246200561523438e+01L
+data8 0xDBA27E0000000000, 0x00004002 //XC[15] = +1.37271709442138671875e+01L
+data8 0x841BF80000000000, 0x00004003 //XC[16] = +1.65136566162109375000e+01L
+data8 0x9E9E710000000000, 0x00004003 //XC[17] = +1.98273639678955078125e+01L
+data8 0xBE24F70000000000, 0x00004003 //XC[18] = +2.37680492401123046875e+01L
+data8 0xE3A27E0000000000, 0x00004003 //XC[19] = +2.84543418884277343750e+01L
+data8 0x881BF80000000000, 0x00004004 //XC[20] = +3.40273132324218750000e+01L
+data8 0xA29E710000000000, 0x00004004 //XC[21] = +4.06547279357910156250e+01L
+data8 0xC224F70000000000, 0x00004004 //XC[22] = +4.85360984802246093750e+01L
+data8 0xE7A27E0000000000, 0x00004004 //XC[23] = +5.79086837768554687500e+01L
+data8 0x8A1BF80000000000, 0x00004005 //XC[24] = +6.90546264648437500000e+01L
+data8 0xA49E710000000000, 0x00004005 //XC[25] = +8.23094558715820312500e+01L
+data8 0xC424F70000000000, 0x00004005 //XC[26] = +9.80721969604492187500e+01L
+data8 0xD5A27E0000000000, 0x00004005 //XC[27] = +1.06817367553710937500e+02L
+LOCAL_OBJECT_END(erfc_xc_table)
+
+LOCAL_OBJECT_START(erfc_s_table)
+
+data8 0xE000000000000000, 0x00003FFE //s[0] = +8.75000000000000000000e-01L
+data8 0xDCEF000000000000, 0x00003FFE //s[1] = +8.63021850585937500000e-01L
+data8 0xD79D000000000000, 0x00003FFE //s[2] = +8.42239379882812500000e-01L
+data8 0xB25E000000000000, 0x00003FFE //s[3] = +6.96746826171875000000e-01L
+data8 0xB0EA000000000000, 0x00003FFE //s[4] = +6.91070556640625000000e-01L
+data8 0xAE3F000000000000, 0x00003FFE //s[5] = +6.80648803710937500000e-01L
+data8 0xAB05000000000000, 0x00003FFE //s[6] = +6.68045043945312500000e-01L
+data8 0xA7AC000000000000, 0x00003FFE //s[7] = +6.54968261718750000000e-01L
+data8 0xA478000000000000, 0x00003FFE //s[8] = +6.42456054687500000000e-01L
+data8 0xA18D000000000000, 0x00003FFE //s[9] = +6.31057739257812500000e-01L
+data8 0x9EF8000000000000, 0x00003FFE //s[10] = +6.20971679687500000000e-01L
+data8 0x9CBA000000000000, 0x00003FFE //s[11] = +6.12213134765625000000e-01L
+data8 0x9ACD000000000000, 0x00003FFE //s[12] = +6.04690551757812500000e-01L
+data8 0x992A000000000000, 0x00003FFE //s[13] = +5.98297119140625000000e-01L
+data8 0x97C7000000000000, 0x00003FFE //s[14] = +5.92880249023437500000e-01L
+data8 0x969C000000000000, 0x00003FFE //s[15] = +5.88317871093750000000e-01L
+data8 0x95A0000000000000, 0x00003FFE //s[16] = +5.84472656250000000000e-01L
+data8 0x94CB000000000000, 0x00003FFE //s[17] = +5.81222534179687500000e-01L
+data8 0x9419000000000000, 0x00003FFE //s[18] = +5.78506469726562500000e-01L
+data8 0x9383000000000000, 0x00003FFE //s[19] = +5.76217651367187500000e-01L
+data8 0x9305000000000000, 0x00003FFE //s[20] = +5.74295043945312500000e-01L
+data8 0x929B000000000000, 0x00003FFE //s[21] = +5.72677612304687500000e-01L
+data8 0x9242000000000000, 0x00003FFE //s[22] = +5.71319580078125000000e-01L
+data8 0x91F8000000000000, 0x00003FFE //s[23] = +5.70190429687500000000e-01L
+data8 0x91B9000000000000, 0x00003FFE //s[24] = +5.69229125976562500000e-01L
+data8 0x9184000000000000, 0x00003FFE //s[25] = +5.68420410156250000000e-01L
+data8 0x9158000000000000, 0x00003FFE //s[26] = +5.67749023437500000000e-01L
+data8 0x9145000000000000, 0x00003FFE //s[27] = +5.67459106445312500000e-01L
+LOCAL_OBJECT_END(erfc_s_table)
+
+LOCAL_OBJECT_START(erfc_Q_table)
+// Q(z)= (P(z)- S)/S
+//
+// Pol0 
+data8 0x98325D50F9DC3499, 0x0000BFAA //A0 = +3.07358861423101280650e-26L
+data8 0xED35081A2494DDD9, 0x00003FF8 //A1 = +1.44779757616302832466e-02L
+data8 0x9443549BCD0F94CE, 0x0000BFFD //A2 = -2.89576190966300084405e-01L
+data8 0xC7FD4B98ECF3DBBF, 0x00003FFD //A3 = +3.90604364793467799170e-01L
+data8 0xB82CE31288B49759, 0x0000BFFD //A4 = -3.59717460644199233866e-01L
+data8 0x8A8293447BEF69B5, 0x00003FFD //A5 = +2.70527460203054582368e-01L
+data8 0xB5793E30EE36766C, 0x0000BFFC //A6 = -1.77220317589265674647e-01L
+data8 0xD6066D16BBDECE17, 0x00003FFB //A7 = +1.04504444366724593714e-01L
+data8 0xE7C783CE3C997BD8, 0x0000BFFA //A8 = -5.65867565781331646771e-02L
+data8 0xE9969EBC2F5B2828, 0x00003FF9 //A9 = +2.85142040533900194955e-02L
+data8 0xDD31D619F29AD7BF, 0x0000BFF8 //A10 = -1.35006514390540367929e-02L
+data8 0xC63A20EB59768F3A, 0x00003FF7 //A11 = +6.04940993680332271481e-03L
+data8 0xA8DEC641AACEB600, 0x0000BFF6 //A12 = -2.57675495383156581601e-03L
+data8 0x87F0E77BA914FBEB, 0x00003FF5 //A13 = +1.03714776726541296794e-03L
+data8 0xC306C2894C5CEF2D, 0x0000BFF3 //A14 = -3.71983348634136412407e-04L
+data8 0xBDAB416A989D0697, 0x00003FF1 //A15 = +9.04412111877987292294e-05L
+// Pol1 
+data8 0x82808893DA2DD83F, 0x00003FEE //A0 = +7.77853035974467145290e-06L
+data8 0xAE9CD9DCADC86113, 0x0000BFFB //A1 = -8.52601070853077921197e-02L
+data8 0x9D429743E312AD9F, 0x0000BFFB //A2 = -7.67871682732076080494e-02L
+data8 0x8637FC533AE805DC, 0x00003FFC //A3 = +1.31072943286859831330e-01L
+data8 0xF68DBE3639ABCB6E, 0x0000BFFB //A4 = -1.20387540845703264588e-01L
+data8 0xB168FFC3CFA71256, 0x00003FFB //A5 = +8.66260511047190247534e-02L
+data8 0xDBC5078A7EA89236, 0x0000BFFA //A6 = -5.36546988077281230848e-02L
+data8 0xF4331FEDB2CB838F, 0x00003FF9 //A7 = +2.98095344165515989564e-02L
+data8 0xF909173C0E61C25D, 0x0000BFF8 //A8 = -1.51999213123642373375e-02L
+data8 0xEC83560A2ACB23E9, 0x00003FF7 //A9 = +7.21780491979582106904e-03L
+data8 0xD350D62C4FEAD8F5, 0x0000BFF6 //A10 = -3.22442272982896360044e-03L
+data8 0xB2F44F4B3FD9B826, 0x00003FF5 //A11 = +1.36531322425499451283e-03L
+data8 0x9078BC61927671C6, 0x0000BFF4 //A12 = -5.51115510818844954547e-04L
+data8 0xDF67AC6287A63B03, 0x00003FF2 //A13 = +2.13055585989529858265e-04L
+data8 0xA719CFEE67FCE1CE, 0x0000BFF1 //A14 = -7.96798844477905965933e-05L
+data8 0xEF926367BABBB029, 0x00003FEF //A15 = +2.85591875675765038065e-05L
+// Pol2 
+data8 0x82B5E5A93B059C50, 0x00003FEF //A0 = +1.55819100856330860049e-05L
+data8 0xDC856BC2542B1938, 0x0000BFFB //A1 = -1.07676355235999875911e-01L
+data8 0xDF225EF5694F14AE, 0x0000BFF8 //A2 = -1.36190345125628043277e-02L
+data8 0xDAF66A954ED22428, 0x00003FFA //A3 = +5.34576571853233908886e-02L
+data8 0xD28AE4F21A392EC6, 0x0000BFFA //A4 = -5.14019911949062230820e-02L
+data8 0x9441A95713F0DB5B, 0x00003FFA //A5 = +3.61954321717769771045e-02L
+data8 0xB0957B5C483C7A04, 0x0000BFF9 //A6 = -2.15556535133667988704e-02L
+data8 0xBB9260E812814F71, 0x00003FF8 //A7 = +1.14484735825400480057e-02L
+data8 0xB68AB17287ABAB04, 0x0000BFF7 //A8 = -5.57073273108465072470e-03L
+data8 0xA56A95E0BC0EF01B, 0x00003FF6 //A9 = +2.52405318381952650677e-03L
+data8 0x8D19C7D286839C00, 0x0000BFF5 //A10 = -1.07651294935087466892e-03L
+data8 0xE45DB3766711A0D3, 0x00003FF3 //A11 = +4.35573615323234291196e-04L
+data8 0xB05949F947FA7AEF, 0x0000BFF2 //A12 = -1.68179306983868501372e-04L
+data8 0x82901D055A0D5CB6, 0x00003FF1 //A13 = +6.22572626227726684168e-05L
+data8 0xBB957698542D6FD0, 0x0000BFEF //A14 = -2.23617364009159182821e-05L
+data8 0x810740E1DF572394, 0x00003FEE //A15 = +7.69068800065192940487e-06L
+// Pol3 
+data8 0x9526D1C87655AFA8, 0x00003FEC //A0 = +2.22253260814242012255e-06L
+data8 0xA47E21EBFE73F72F, 0x0000BFF8 //A1 = -1.00398379581527733314e-02L
+data8 0xDE65685FCDF7A913, 0x0000BFFA //A2 = -5.42959286802879105148e-02L
+data8 0xED289CB8F97D4860, 0x00003FFA //A3 = +5.79000589346770417248e-02L
+data8 0xAA3100D5A7D870F1, 0x0000BFFA //A4 = -4.15506394006027604387e-02L
+data8 0xCA0567032C5308C0, 0x00003FF9 //A5 = +2.46607791863290331169e-02L
+data8 0xD3E1794A50F31BEB, 0x0000BFF8 //A6 = -1.29321751094401754013e-02L
+data8 0xCAA02CB4C87CC1F0, 0x00003FF7 //A7 = +6.18364508551740736863e-03L
+data8 0xB3F126AF16B121F2, 0x0000BFF6 //A8 = -2.74569696838501870748e-03L
+data8 0x962B2D64D3900510, 0x00003FF5 //A9 = +1.14569596409019883022e-03L
+data8 0xED8785714A9A00FB, 0x0000BFF3 //A10 = -4.53051338046340380512e-04L
+data8 0xB325DA4515D8B54C, 0x00003FF2 //A11 = +1.70848714622328427290e-04L
+data8 0x8179C36354571747, 0x0000BFF1 //A12 = -6.17387951061077132522e-05L
+data8 0xB40F241C01C907E9, 0x00003FEF //A13 = +2.14647227210702861416e-05L
+data8 0xF436D84AD7D4D316, 0x0000BFED //A14 = -7.27815144835213913238e-06L
+data8 0x9EB432503FB0B7BC, 0x00003FEC //A15 = +2.36487228755136968792e-06L
+// Pol4 
+data8 0xE0BA539E4AFC4741, 0x00003FED //A0 = +6.69741148991838024429e-06L
+data8 0x8583BF71139452CF, 0x0000BFFA //A1 = -3.25963476363756051657e-02L
+data8 0x8384FEF6D08AD6CE, 0x0000BFF9 //A2 = -1.60546283500634200479e-02L
+data8 0xB1E67DFB84C97036, 0x00003FF9 //A3 = +2.17163525195697635702e-02L
+data8 0xFB6ACEE6899E360D, 0x0000BFF8 //A4 = -1.53452892792759316229e-02L
+data8 0x8D2B869EB9149905, 0x00003FF8 //A5 = +8.61633440480716870830e-03L
+data8 0x8A90BFE0FD869A41, 0x0000BFF7 //A6 = -4.22868126950622376530e-03L
+data8 0xF7536A76E59F54D2, 0x00003FF5 //A7 = +1.88694643606912107006e-03L
+data8 0xCCF6FE58C16E1CC7, 0x0000BFF4 //A8 = -7.81878732767742447339e-04L
+data8 0x9FCC6ED9914FAA24, 0x00003FF3 //A9 = +3.04791577214885118730e-04L
+data8 0xEC7F5AAACAE593E8, 0x0000BFF1 //A10 = -1.12770784960291779798e-04L
+data8 0xA72CE628A114C940, 0x00003FF0 //A11 = +3.98577182157456408782e-05L
+data8 0xE2DCC5750FD769BA, 0x0000BFEE //A12 = -1.35220520471857266339e-05L
+data8 0x9459160B1E6F1F8D, 0x00003FED //A13 = +4.42111470121432700283e-06L
+data8 0xBE0A05701BD0DD42, 0x0000BFEB //A14 = -1.41590196994052764542e-06L
+data8 0xE905D729105081BF, 0x00003FE9 //A15 = +4.34038814785401120999e-07L
+// Pol5 
+data8 0xA33649C3AB459832, 0x00003FEE //A0 = +9.72819704141525206634e-06L
+data8 0x9E4EA2F44C9A24BD, 0x0000BFFA //A1 = -3.86492123987296806210e-02L
+data8 0xE80C0B1280F357BF, 0x0000BFF2 //A2 = -2.21297306012713370124e-04L
+data8 0xDAECCE90A4D45D9A, 0x00003FF7 //A3 = +6.68106161291482829670e-03L
+data8 0xA4006572071BDD4B, 0x0000BFF7 //A4 = -5.00493005170532147076e-03L
+data8 0xB07FD7EB1F4D8E8E, 0x00003FF6 //A5 = +2.69316693731732554959e-03L
+data8 0xA1F471D42ADD73A1, 0x0000BFF5 //A6 = -1.23561753760779610478e-03L
+data8 0x8611D0ED1B4C8176, 0x00003FF4 //A7 = +5.11434914439322741260e-04L
+data8 0xCDADB789B487A541, 0x0000BFF2 //A8 = -1.96150380913036018825e-04L
+data8 0x9470252731687FEE, 0x00003FF1 //A9 = +7.07807859951401721129e-05L
+data8 0xCB9399AD1C376D85, 0x0000BFEF //A10 = -2.42682175234436724152e-05L
+data8 0x858D815F9CA0A9F7, 0x00003FEE //A11 = +7.96036454038012144300e-06L
+data8 0xA878D338E6E6A079, 0x0000BFEC //A12 = -2.51042802626063073967e-06L
+data8 0xCD2C2F079D2FCB36, 0x00003FEA //A13 = +7.64327468786076941271e-07L
+data8 0xF5EF4A4B2EA426F2, 0x0000BFE8 //A14 = -2.29044563492386125272e-07L
+data8 0x8CE52181393820FC, 0x00003FE7 //A15 = +6.56093668622712763489e-08L
+// Pol6 
+data8 0xB2015D7F1864B7CF, 0x00003FEC //A0 = +2.65248615880090351276e-06L
+data8 0x954EA7A861B4462A, 0x0000BFFA //A1 = -3.64519642954351295215e-02L
+data8 0x9E46F2A4D9157E69, 0x00003FF7 //A2 = +4.83023498390681965101e-03L
+data8 0xA0D12B422FFD5BAD, 0x00003FF5 //A3 = +1.22693684633643883352e-03L
+data8 0xB291D16A560A740E, 0x0000BFF5 //A4 = -1.36237794246703606647e-03L
+data8 0xC138941BC8AF4A9D, 0x00003FF4 //A5 = +7.37079658343628747256e-04L
+data8 0xA761669D61B405CF, 0x0000BFF3 //A6 = -3.19252914480518163396e-04L
+data8 0x8053680F1C84607E, 0x00003FF2 //A7 = +1.22381025852939439541e-04L
+data8 0xB518F4B6F25015F9, 0x0000BFF0 //A8 = -4.31770048258291369742e-05L
+data8 0xEFF526AC70B9411E, 0x00003FEE //A9 = +1.43025887824433324525e-05L
+data8 0x970B2A848DF5B5C2, 0x0000BFED //A10 = -4.50145058393497252604e-06L
+data8 0xB614D2E61DB86963, 0x00003FEB //A11 = +1.35661172167726780059e-06L
+data8 0xD34EA4D283EC33FA, 0x0000BFE9 //A12 = -3.93590335713880681528e-07L
+data8 0xED209EBD68E1145F, 0x00003FE7 //A13 = +1.10421060667544991323e-07L
+data8 0x83A126E22A17568D, 0x0000BFE6 //A14 = -3.06473811074239684132e-08L
+data8 0x8B778496EDE9F415, 0x00003FE4 //A15 = +8.11804009754249175736e-09L
+// Pol7 
+data8 0x8E152F522501B7B9, 0x00003FEE //A0 = +8.46879203970927626532e-06L
+data8 0xFD22F92EE21F491E, 0x0000BFF9 //A1 = -3.09004656656418947425e-02L
+data8 0xAF0C41847D89EC14, 0x00003FF7 //A2 = +5.34203719233189217519e-03L
+data8 0xB7C539C400445956, 0x0000BFF3 //A3 = -3.50514245383356287965e-04L
+data8 0x8428C78B2B1E3622, 0x0000BFF3 //A4 = -2.52073850239006530978e-04L
+data8 0xAFC0CCC7D1A05F5B, 0x00003FF2 //A5 = +1.67611241057491801028e-04L
+data8 0x95DC7272C5695A5A, 0x0000BFF1 //A6 = -7.14593512262564106636e-05L
+data8 0xD6FCA68A61F0E835, 0x00003FEF //A7 = +2.56284375437771117850e-05L
+data8 0x8B71C74DEA936C66, 0x0000BFEE //A8 = -8.31153675277218441096e-06L
+data8 0xA8AC71E2A56AA2C9, 0x00003FEC //A9 = +2.51343269277107451413e-06L
+data8 0xC15DED6C44B46046, 0x0000BFEA //A10 = -7.20347851650066610771e-07L
+data8 0xD42BA1DFBD1277AC, 0x00003FE8 //A11 = +1.97599119274780745741e-07L
+data8 0xE03A81F2C976D11A, 0x0000BFE6 //A12 = -5.22072765405802337371e-08L
+data8 0xE56A19A67DD66100, 0x00003FE4 //A13 = +1.33536787408751203998e-08L
+data8 0xE964D255CB31DFFA, 0x0000BFE2 //A14 = -3.39632729387679010008e-09L
+data8 0xE22E62E932B704D4, 0x00003FE0 //A15 = +8.22842400379225526299e-10L
+// Pol8 
+data8 0xB8B835882D46A6C8, 0x00003FEF //A0 = +2.20202883282415435401e-05L
+data8 0xC9D1F63F89B74E90, 0x0000BFF9 //A1 = -2.46362504515706189782e-02L
+data8 0x8E376748B1274F30, 0x00003FF7 //A2 = +4.34010070001387441657e-03L
+data8 0x98174C7EA49B5B37, 0x0000BFF4 //A3 = -5.80181163659971286762e-04L
+data8 0x8D2C40506AE9FF97, 0x00003FEF //A4 = +1.68291159100251734927e-05L
+data8 0xD9A580C115B9D150, 0x00003FEF //A5 = +2.59454841475194555896e-05L
+data8 0xDB35B21F1C3F99CE, 0x0000BFEE //A6 = -1.30659192305072674545e-05L
+data8 0x99FAADAE17A3050E, 0x00003FED //A7 = +4.58893813631592314881e-06L
+data8 0xBA1D259BCD6987A9, 0x0000BFEB //A8 = -1.38665627771423394637e-06L
+data8 0xCDD7FF5BEA0145C2, 0x00003FE9 //A9 = +3.83413844219813384124e-07L
+data8 0xD60857176CE6AB9D, 0x0000BFE7 //A10 = -9.96666862214499946343e-08L
+data8 0xD446A2402112DF4C, 0x00003FE5 //A11 = +2.47121687566658908126e-08L
+data8 0xCA87133235F1F495, 0x0000BFE3 //A12 = -5.89433000014933371980e-09L
+data8 0xBB15B0021581C8B6, 0x00003FE1 //A13 = +1.36122047057936849125e-09L
+data8 0xAC9D6585D4AF505E, 0x0000BFDF //A14 = -3.13984547328132268695e-10L
+data8 0x975A1439C3795183, 0x00003FDD //A15 = +6.88268624429648826457e-11L
+// Pol9 
+data8 0x99A7676284CDC9FE, 0x00003FEF //A0 = +1.83169747921764176475e-05L
+data8 0x9AD0AE249A02896C, 0x0000BFF9 //A1 = -1.88983346204739151909e-02L
+data8 0xCB89B4AEC19898BE, 0x00003FF6 //A2 = +3.10574208447745576452e-03L
+data8 0xEBBC47E30E1AC2C2, 0x0000BFF3 //A3 = -4.49629730048297442064e-04L
+data8 0xD1E35B7FCE1CF859, 0x00003FF0 //A4 = +5.00412261289558493438e-05L
+data8 0xB40743664EF24552, 0x0000BFEB //A5 = -1.34131589671166307319e-06L
+data8 0xCAD2F5C596FFE1B4, 0x0000BFEB //A6 = -1.51115702599728593837e-06L
+data8 0xAE42B6D069DFDDF2, 0x00003FEA //A7 = +6.49171330116787223873e-07L
+data8 0xD0739A05BB43A714, 0x0000BFE8 //A8 = -1.94135651872623440782e-07L
+data8 0xD745B854AB601BD7, 0x00003FE6 //A9 = +5.01219983943456578062e-08L
+data8 0xCC4066E13E338B13, 0x0000BFE4 //A10 = -1.18890061172430768892e-08L
+data8 0xB6EAADB55A6C3CB4, 0x00003FE2 //A11 = +2.66178850259168707794e-09L
+data8 0x9CC6C178AD3F96AD, 0x0000BFE0 //A12 = -5.70349182959704086428e-10L
+data8 0x81D0E2AA27DEB74A, 0x00003FDE //A13 = +1.18066926578104076645e-10L
+data8 0xD75FB9049190BEFD, 0x0000BFDB //A14 = -2.44851795398843967972e-11L
+data8 0xA9384A51D48C8703, 0x00003FD9 //A15 = +4.80951837368635202609e-12L
+// Pol10 
+data8 0xD2B3482EE449C535, 0x00003FEE //A0 = +1.25587177382575655080e-05L
+data8 0xE7939B2D0607DFCF, 0x0000BFF8 //A1 = -1.41343131436717436429e-02L
+data8 0x8810EB4AC5F0F1CE, 0x00003FF6 //A2 = +2.07620377002350121270e-03L
+data8 0x9546589602AEB955, 0x0000BFF3 //A3 = -2.84719065122144294949e-04L
+data8 0x9333434342229798, 0x00003FF0 //A4 = +3.50952732796136549298e-05L
+data8 0xEB36A98FD81D3DEB, 0x0000BFEC //A5 = -3.50495464815398722482e-06L
+data8 0xAC370EFA025D0477, 0x00003FE8 //A6 = +1.60387784498518639254e-07L
+data8 0xC8DF7F8ACA099426, 0x00003FE6 //A7 = +4.67693991699936842330e-08L
+data8 0xAC694AD4921C02CF, 0x0000BFE5 //A8 = -2.00713167514877937714e-08L
+data8 0xB6E29F2FDE2D8C1A, 0x00003FE3 //A9 = +5.32266106167252495164e-09L
+data8 0xA41F8EEA75474358, 0x0000BFE1 //A10 = -1.19415398856537468324e-09L
+data8 0x869D778A1C56D3D6, 0x00003FDF //A11 = +2.44863450057778470469e-10L
+data8 0xD02658BF31411F4C, 0x0000BFDC //A12 = -4.73277831746128372261e-11L
+data8 0x9A4A95EE59127779, 0x00003FDA //A13 = +8.77044784978207256260e-12L
+data8 0xE518330AF013C2F6, 0x0000BFD7 //A14 = -1.62781453276882333209e-12L
+data8 0xA036A9DF71BD108A, 0x00003FD5 //A15 = +2.84596398987114375607e-13L
+// Pol11 
+data8 0x9191CFBF001F3BB3, 0x00003FEE //A0 = +8.67662287973472452343e-06L
+data8 0xAA47E0CF01AE9730, 0x0000BFF8 //A1 = -1.03931136509584404513e-02L
+data8 0xAEABE7F17B01D18F, 0x00003FF5 //A2 = +1.33263784731775399430e-03L
+data8 0xAC0D6A309D04E5DB, 0x0000BFF2 //A3 = -1.64081956462118568288e-04L
+data8 0xA08357DF458054D0, 0x00003FEF //A4 = +1.91346477952797715021e-05L
+data8 0x8A1596B557440FE0, 0x0000BFEC //A5 = -2.05761687274453412571e-06L
+data8 0xCDA0EAE0A5615E9A, 0x00003FE8 //A6 = +1.91506542215670149741e-07L
+data8 0xD36A08FB4E104F9A, 0x0000BFE4 //A7 = -1.23059260396551086769e-08L
+data8 0xD7433F91E78A7A11, 0x0000BFDF //A8 = -3.91560549815575091188e-10L
+data8 0xC2F5308FD4F5CE62, 0x00003FDF //A9 = +3.54626121852421163117e-10L
+data8 0xC83876915F49D630, 0x0000BFDD //A10 = -9.10497688901018285126e-11L
+data8 0xA11C605DEAE1FE9C, 0x00003FDB //A11 = +1.83161825409194847892e-11L
+data8 0xE7977BC1342D19BF, 0x0000BFD8 //A12 = -3.29111645807102123274e-12L
+data8 0x9BC3A7D6396C6756, 0x00003FD6 //A13 = +5.53385887288503961220e-13L
+data8 0xD0110D5683740B8C, 0x0000BFD3 //A14 = -9.24001363293241428519e-14L
+data8 0x81786D7856A5CC92, 0x00003FD1 //A15 = +1.43741041714595023996e-14L
+// Pol12 
+data8 0xB85654F6033B3372, 0x00003FEF //A0 = +2.19747106911869287049e-05L
+data8 0xF78B40078736B406, 0x0000BFF7 //A1 = -7.55444170413862312647e-03L
+data8 0xDA8FDE84D88E5D5D, 0x00003FF4 //A2 = +8.33747822263358628569e-04L
+data8 0xBC2D3F3891721AA9, 0x0000BFF1 //A3 = -8.97296647669960333635e-05L
+data8 0x9D15ACFD3BF50064, 0x00003FEE //A4 = +9.36297600601039610762e-06L
+data8 0xFBED3D03F3C1B671, 0x0000BFEA //A5 = -9.38500137149172923985e-07L
+data8 0xBEE615E3B2FA16C8, 0x00003FE7 //A6 = +8.88941676851808958175e-08L
+data8 0x843D32692CF5662A, 0x0000BFE4 //A7 = -7.69732580860195238520e-09L
+data8 0x99E74472FD94E22B, 0x00003FE0 //A8 = +5.59897264617128952416e-10L
+data8 0xCEF63DABF4C32E15, 0x0000BFDB //A9 = -2.35288414996279313219e-11L
+data8 0xA2D86C25C0991123, 0x0000BFD8 //A10 = -2.31417232327307408235e-12L
+data8 0xF50C1B31D2E922BD, 0x00003FD6 //A11 = +8.70582858983364191159e-13L
+data8 0xC0F093DEC2B019A1, 0x0000BFD4 //A12 = -1.71364927865227509533e-13L
+data8 0xFC1441C4CD105981, 0x00003FD1 //A13 = +2.79864052545369490865e-14L
+data8 0x9CC959853267F026, 0x0000BFCF //A14 = -4.35170017302700609509e-15L
+data8 0xB06BA14016154F1E, 0x00003FCC //A15 = +6.12081320471295704631e-16L
+// Pol13 
+data8 0xA59E74BF544F2422, 0x00003FEF //A0 = +1.97433196215210145261e-05L
+data8 0xB2814F4EDAE15330, 0x0000BFF7 //A1 = -5.44754383528015875700e-03L
+data8 0x867C249D378F0A23, 0x00003FF4 //A2 = +5.13019308804593120161e-04L
+data8 0xC76644393388AB68, 0x0000BFF0 //A3 = -4.75405403392600215101e-05L
+data8 0x91143AD5CCA229FE, 0x00003FED //A4 = +4.32369180778264703719e-06L
+data8 0xCE6A11FB6840A974, 0x0000BFE9 //A5 = -3.84476663329551178495e-07L
+data8 0x8EC29F66C59DE243, 0x00003FE6 //A6 = +3.32389596787155456596e-08L
+data8 0xBE3FCDDCA94CA24E, 0x0000BFE2 //A7 = -2.76849073931513325199e-09L
+data8 0xF06A84BDC70A0B0D, 0x00003FDE //A8 = +2.18657158231304988330e-10L
+data8 0x8B8E6969D056D124, 0x0000BFDB //A9 = -1.58657139740906811035e-11L
+data8 0x8984985AA29A0567, 0x00003FD7 //A10 = +9.77123802231106533829e-13L
+data8 0xA53ABA084300137C, 0x0000BFD2 //A11 = -3.66882970952892030306e-14L
+data8 0xA90EC851E91C3319, 0x0000BFCE //A12 = -2.34614750044359490986e-15L
+data8 0xEC9CAF64237B5060, 0x00003FCC //A13 = +8.20912960028437475035e-16L
+data8 0xA9156668FCF01479, 0x0000BFCA //A14 = -1.46656639874123613261e-16L
+data8 0xBAEF58D8118DD5D4, 0x00003FC7 //A15 = +2.02675278255254907493e-17L
+// Pol14 
+data8 0xC698952E9CEAA800, 0x00003FEF //A0 = +2.36744912073515619263e-05L
+data8 0x800395F8C7B4FA00, 0x0000BFF7 //A1 = -3.90667746392883642897e-03L
+data8 0xA3B2467B6B391831, 0x00003FF3 //A2 = +3.12226081793919541155e-04L
+data8 0xCF2061122A69D72B, 0x0000BFEF //A3 = -2.46914006692526122176e-05L
+data8 0x817FAB6B5DEB9924, 0x00003FEC //A4 = +1.92968114320180123521e-06L
+data8 0x9FC190F5827740E7, 0x0000BFE8 //A5 = -1.48784479265231093475e-07L
+data8 0xC1FE5C1835C8AFCD, 0x00003FE4 //A6 = +1.12919132662720380018e-08L
+data8 0xE7216A9FBB204DA3, 0x0000BFE0 //A7 = -8.40847981461949000003e-10L
+data8 0x867566ED95C5C64F, 0x00003FDD //A8 = +6.11446929759298780795e-11L
+data8 0x97A8BFA723F0F014, 0x0000BFD9 //A9 = -4.31041298699752869577e-12L
+data8 0xA3D24B7034984522, 0x00003FD5 //A10 = +2.91005377301348717042e-13L
+data8 0xA5AAA371C22F3741, 0x0000BFD1 //A11 = -1.83926825395757259128e-14L
+data8 0x95352E5597EACC23, 0x00003FCD //A12 = +1.03533666540077850452e-15L
+data8 0xCCEBE3043B689428, 0x0000BFC8 //A13 = -4.44352525147076912166e-17L
+data8 0xA779DAB4BE1F80BB, 0x0000BFBC //A14 = -8.86610526981738255206e-21L
+data8 0xB171271F3517282C, 0x00003FC1 //A15 = +3.00598445879282370850e-19L
+// Pol15 
+data8 0xB7AC727D1C3FEB05, 0x00003FEE //A0 = +1.09478009914822049780e-05L
+data8 0xB6E6274485C10B0A, 0x0000BFF6 //A1 = -2.79081782038927199588e-03L
+data8 0xC5CAE2122D009506, 0x00003FF2 //A2 = +1.88629638738336219173e-04L
+data8 0xD466E7957D0A3362, 0x0000BFEE //A3 = -1.26601440424012313479e-05L
+data8 0xE2593D798DA20E2E, 0x00003FEA //A4 = +8.43214222346512003230e-07L
+data8 0xEF2D2BBA7D2882CC, 0x0000BFE6 //A5 = -5.56876064495961858535e-08L
+data8 0xFA5819BB4AE974C2, 0x00003FE2 //A6 = +3.64298674151704370449e-09L
+data8 0x819BB0CE825FBB28, 0x0000BFDF //A7 = -2.35755881668932259913e-10L
+data8 0x84871099BF728B8F, 0x00003FDB //A8 = +1.50666434199945890414e-11L
+data8 0x858188962DFEBC9F, 0x0000BFD7 //A9 = -9.48617116568458677088e-13L
+data8 0x840F38FF2FBAE753, 0x00003FD3 //A10 = +5.86461827778372616657e-14L
+data8 0xFF47EAF69577B213, 0x0000BFCE //A11 = -3.54273456410181081472e-15L
+data8 0xEF402CCB4D29FAF8, 0x00003FCA //A12 = +2.07516888659313950588e-16L
+data8 0xD6B789E01141231B, 0x0000BFC6 //A13 = -1.16398290506765191078e-17L
+data8 0xB5EEE343E9CFE3EC, 0x00003FC2 //A14 = +6.16413506924643419723e-19L
+data8 0x859B41A39D600346, 0x0000BFBE //A15 = -2.82922705825870414438e-20L
+// Pol16 
+data8 0x85708B69FD184E11, 0x00003FED //A0 = +3.97681079176353356199e-06L
+data8 0x824D92BC60A1F70A, 0x0000BFF6 //A1 = -1.98826630037499070532e-03L
+data8 0xEDCF7D3576BB5258, 0x00003FF1 //A2 = +1.13396885054265675352e-04L
+data8 0xD7FC59226A947CDF, 0x0000BFED //A3 = -6.43687650810478871875e-06L
+data8 0xC32C51B574E2651E, 0x00003FE9 //A4 = +3.63538268539251809118e-07L
+data8 0xAF67910F5681401F, 0x0000BFE5 //A5 = -2.04197779750247395258e-08L
+data8 0x9CB3E8D7DCD1EA9D, 0x00003FE1 //A6 = +1.14016272459029850306e-09L
+data8 0x8B14ECFBF7D4F114, 0x0000BFDD //A7 = -6.32470533185766848692e-11L
+data8 0xF518253AE4A3AE72, 0x00003FD8 //A8 = +3.48299974583453268369e-12L
+data8 0xD631A5699AA2F334, 0x0000BFD4 //A9 = -1.90242426474085078079e-13L
+data8 0xB971AD4C30C56E5D, 0x00003FD0 //A10 = +1.02942127356740047925e-14L
+data8 0x9ED0065A601F3160, 0x0000BFCC //A11 = -5.50991880383698965959e-16L
+data8 0x863A04008E12867C, 0x00003FC8 //A12 = +2.91057593756148904838e-17L
+data8 0xDF62F9F44F5C7170, 0x0000BFC3 //A13 = -1.51372666097522872780e-18L
+data8 0xBA4E118E88CFDD31, 0x00003FBF //A14 = +7.89032177282079635722e-20L
+data8 0x942AD897FC4D2F2A, 0x0000BFBB //A15 = -3.92195756076319409245e-21L
+// Pol17 
+data8 0xCB8514540566C717, 0x00003FEF //A0 = +2.42614557068144130848e-05L
+data8 0xB94F08D6816E0CD4, 0x0000BFF5 //A1 = -1.41379340061829929314e-03L
+data8 0x8E7C342C2DABB51B, 0x00003FF1 //A2 = +6.79422240687700109911e-05L
+data8 0xDA69DAFF71E30D5B, 0x0000BFEC //A3 = -3.25461473899657142468e-06L
+data8 0xA6D5B2DB69B4B3F6, 0x00003FE8 //A4 = +1.55376978584082701045e-07L
+data8 0xFDF4F76BC1D1BD47, 0x0000BFE3 //A5 = -7.39111857092131684572e-09L
+data8 0xC08BC52C95B12C2D, 0x00003FDF //A6 = +3.50239092565793882444e-10L
+data8 0x91624BF6D3A3F6C9, 0x0000BFDB //A7 = -1.65282439890232458821e-11L
+data8 0xDA91F7A450DE4270, 0x00003FD6 //A8 = +7.76517285902715940501e-13L
+data8 0xA380ADF55416E624, 0x0000BFD2 //A9 = -3.63048822989374426852e-14L
+data8 0xF350FC0CEDEE0FD6, 0x00003FCD //A10 = +1.68834630987974622269e-15L
+data8 0xB3FA19FBDC8F023C, 0x0000BFC9 //A11 = -7.80525639701804380489e-17L
+data8 0x8435328C80940126, 0x00003FC5 //A12 = +3.58349966898667910204e-18L
+data8 0xC0D22F655BA5EF39, 0x0000BFC0 //A13 = -1.63325770165403860181e-19L
+data8 0x8F14B9EBD5A9AB25, 0x00003FBC //A14 = +7.57464305512080733773e-21L
+data8 0xCD4804BBF6DC1B6F, 0x0000BFB7 //A15 = -3.39609459750208886298e-22L
+// Pol18 
+data8 0xE251DFE45AB0C22E, 0x00003FEE //A0 = +1.34897126299700418200e-05L
+data8 0x83943CC7D59D4215, 0x0000BFF5 //A1 = -1.00386850310061655307e-03L
+data8 0xAA57896951134BCA, 0x00003FF0 //A2 = +4.06126834109940757047e-05L
+data8 0xDC0A67051E1C4A2C, 0x0000BFEB //A3 = -1.63943048164477430317e-06L
+data8 0x8DCB3C0A8CD07BBE, 0x00003FE7 //A4 = +6.60279229777753829876e-08L
+data8 0xB64DE81C24F7F265, 0x0000BFE2 //A5 = -2.65287705357477481067e-09L
+data8 0xE9CBB7A990DBA8B5, 0x00003FDD //A6 = +1.06318007608620426224e-10L
+data8 0x9583D4B85C2ADC6F, 0x0000BFD9 //A7 = -4.24947087941505088222e-12L
+data8 0xBEB0EE8114EEDF77, 0x00003FD4 //A8 = +1.69367754741562774916e-13L
+data8 0xF2791BB8F06BDA93, 0x0000BFCF //A9 = -6.72997988617021128704e-15L
+data8 0x99A907F6A92195B4, 0x00003FCB //A10 = +2.66558091161711891239e-16L
+data8 0xC213E5E6F833BB93, 0x0000BFC6 //A11 = -1.05209746502719578617e-17L
+data8 0xF41FBBA6B343960F, 0x00003FC1 //A12 = +4.13562069721140021224e-19L
+data8 0x98F194AEE31D188D, 0x0000BFBD //A13 = -1.61935414722333263347e-20L
+data8 0xC42F5029BB622157, 0x00003FB8 //A14 = +6.49121108201931196678e-22L
+data8 0xF43BD08079E50E0F, 0x0000BFB3 //A15 = -2.52531675510242468317e-23L
+// Pol19 
+data8 0x82557B149A04D08E, 0x00003FEF //A0 = +1.55370127331027842820e-05L
+data8 0xBAAB433307CE614B, 0x0000BFF4 //A1 = -7.12085701486669872724e-04L
+data8 0xCB52D9DBAC16FE82, 0x00003FEF //A2 = +2.42380662859334411743e-05L
+data8 0xDD214359DBBCE7D1, 0x0000BFEA //A3 = -8.23773197624244883859e-07L
+data8 0xF01E8E968139524C, 0x00003FE5 //A4 = +2.79535729459988509676e-08L
+data8 0x82286A057E0916CE, 0x0000BFE1 //A5 = -9.47023128967039348510e-10L
+data8 0x8CDDDC4E8D013365, 0x00003FDC //A6 = +3.20293663356974901319e-11L
+data8 0x982FEEE90D4E8751, 0x0000BFD7 //A7 = -1.08135537312234452657e-12L
+data8 0xA41D1E84083B8FD6, 0x00003FD2 //A8 = +3.64405720894915411836e-14L
+data8 0xB0A1B6111B72E159, 0x0000BFCD //A9 = -1.22562851790685744085e-15L
+data8 0xBDB77DE6B650FFA2, 0x00003FC8 //A10 = +4.11382657214908334175e-17L
+data8 0xCB54E95CDB66978A, 0x0000BFC3 //A11 = -1.37782909696752432371e-18L
+data8 0xD959E428A62B1B6C, 0x00003FBE //A12 = +4.60258936838597812582e-20L
+data8 0xE7D49EC23F1A16A0, 0x0000BFB9 //A13 = -1.53412587409583783059e-21L
+data8 0xFDE429BC9947B2BE, 0x00003FB4 //A14 = +5.25034823750902928092e-23L
+data8 0x872137A062C042EF, 0x0000BFB0 //A15 = -1.74651114923000080365e-24L
+// Pol20 
+data8 0x8B9B185C6A2659AC, 0x00003FEF //A0 = +1.66423130594825442963e-05L
+data8 0x84503AD52588A1E8, 0x0000BFF4 //A1 = -5.04735556466270303549e-04L
+data8 0xF26C7C2B566388E1, 0x00003FEE //A2 = +1.44495826764677427386e-05L
+data8 0xDDDA15FEE262BB47, 0x0000BFE9 //A3 = -4.13231361893675488873e-07L
+data8 0xCACEBC73C90C2FE0, 0x00003FE4 //A4 = +1.18049538609157282958e-08L
+data8 0xB9314D00022B41DD, 0x0000BFDF //A5 = -3.36863342776746896664e-10L
+data8 0xA8E9FBDC714638B9, 0x00003FDA //A6 = +9.60164921624768038366e-12L
+data8 0x99E246C0CC8CA6F6, 0x0000BFD5 //A7 = -2.73352704217713596798e-13L
+data8 0x8C04E7B5DF372EA1, 0x00003FD0 //A8 = +7.77262480048865685174e-15L
+data8 0xFE7B90CAA0B6D5F7, 0x0000BFCA //A9 = -2.20728537958846147109e-16L
+data8 0xE6F40BAD4EC6CB4F, 0x00003FC5 //A10 = +6.26000182616999972048e-18L
+data8 0xD14F4E0538F0F992, 0x0000BFC0 //A11 = -1.77292283439752259258e-19L
+data8 0xBD5A7FAA548CC749, 0x00003FBB //A12 = +5.01214569023722089225e-21L
+data8 0xAB15D69425373A67, 0x0000BFB6 //A13 = -1.41518447770061562822e-22L
+data8 0x9EF95456F75B4DF4, 0x00003FB1 //A14 = +4.10938011540250142351e-24L
+data8 0x8FADCC45E81433E7, 0x0000BFAC //A15 = -1.16062889679749879834e-25L
+// Pol21 
+data8 0xB47A917B0F7B50AE, 0x00003FEF //A0 = +2.15147474240529518138e-05L
+data8 0xBB77DC3BA0C937B3, 0x0000BFF3 //A1 = -3.57567223048598672970e-04L
+data8 0x90694DFF4EBF7370, 0x00003FEE //A2 = +8.60758700336677694536e-06L
+data8 0xDE5379AA90A98F3F, 0x0000BFE8 //A3 = -2.07057292787309736495e-07L
+data8 0xAB0322293F1F9CA0, 0x00003FE3 //A4 = +4.97711123919916694625e-09L
+data8 0x837119E59D3B7AC2, 0x0000BFDE //A5 = -1.19545621970063369582e-10L
+data8 0xC9E5B74A38ECF3FC, 0x00003FD8 //A6 = +2.86913359605586285967e-12L
+data8 0x9AEF5110C6885352, 0x0000BFD3 //A7 = -6.88048865490621757799e-14L
+data8 0xED988D52189CE6A3, 0x00003FCD //A8 = +1.64865278639132278935e-15L
+data8 0xB6063CECD8012B6D, 0x0000BFC8 //A9 = -3.94702428606368525374e-17L
+data8 0x8B541EB15E79CEEC, 0x00003FC3 //A10 = +9.44127272399408815784e-19L
+data8 0xD51A136D8C75BC25, 0x0000BFBD //A11 = -2.25630369561137931232e-20L
+data8 0xA2C1C5E19CC79E6F, 0x00003FB8 //A12 = +5.38517493921589837361e-22L
+data8 0xF86F9772306F56C1, 0x0000BFB2 //A13 = -1.28438352359240135735e-23L
+data8 0xC32F6FEEDE86528E, 0x00003FAD //A14 = +3.15338862172962186458e-25L
+data8 0x9534ED189744D7D4, 0x0000BFA8 //A15 = -7.53301543611470014315e-27L
+// Pol22 
+data8 0xCBA0A2DB94A2C494, 0x00003FEF //A0 = +2.42742878212752702946e-05L
+data8 0x84C089154A49E0E8, 0x0000BFF3 //A1 = -2.53204520651046300034e-04L
+data8 0xABF5665BD0D8B0CD, 0x00003FED //A2 = +5.12476542947092361490e-06L
+data8 0xDEA1C518E3EEE872, 0x0000BFE7 //A3 = -1.03671063536324831083e-07L
+data8 0x900B77F271559AE8, 0x00003FE2 //A4 = +2.09612770408581408652e-09L
+data8 0xBA4C74A262BE3E4E, 0x0000BFDC //A5 = -4.23594098489216166935e-11L
+data8 0xF0D1680FCC1EAF97, 0x00003FD6 //A6 = +8.55557381760467917779e-13L
+data8 0x9B8F8E033BB83A24, 0x0000BFD1 //A7 = -1.72707138247091685914e-14L
+data8 0xC8DCA6A691DB8335, 0x00003FCB //A8 = +3.48439884388851942939e-16L
+data8 0x819A6CB9CEA5E9BD, 0x0000BFC6 //A9 = -7.02580471688245511753e-18L
+data8 0xA726B4F622585BEA, 0x00003FC0 //A10 = +1.41582572516648501043e-19L
+data8 0xD7727648A4095986, 0x0000BFBA //A11 = -2.85141885626054217632e-21L
+data8 0x8AB627E09CF45997, 0x00003FB5 //A12 = +5.73697507862703019314e-23L
+data8 0xB28C15C117CC604F, 0x0000BFAF //A13 = -1.15383428132352407085e-24L
+data8 0xECB8428626DA072C, 0x00003FA9 //A14 = +2.39025879246942839796e-26L
+data8 0x98B731BCFA2CE2B2, 0x0000BFA4 //A15 = -4.81885474332093262902e-28L
+// Pol23 
+data8 0xC6D013811314D31B, 0x00003FED //A0 = +5.92508308918577687876e-06L
+data8 0xBBF3057B8DBACBCF, 0x0000BFF2 //A1 = -1.79242422493281965934e-04L
+data8 0xCCADECA501162313, 0x00003FEC //A2 = +3.04996061562356504918e-06L
+data8 0xDED1FDBE8CCAF3DB, 0x0000BFE6 //A3 = -5.18793887648024117154e-08L
+data8 0xF27B74EDDCA65859, 0x00003FE0 //A4 = +8.82145297317787820675e-10L
+data8 0x83E4415687F01A0C, 0x0000BFDB //A5 = -1.49943414247603665601e-11L
+data8 0x8F6CB350861CE446, 0x00003FD5 //A6 = +2.54773288906376920377e-13L
+data8 0x9BE8456A30CBFC02, 0x0000BFCF //A7 = -4.32729710913845745148e-15L
+data8 0xA9694F7E1033977D, 0x00003FC9 //A8 = +7.34704698157502347441e-17L
+data8 0xB8035A3D5AF82D85, 0x0000BFC3 //A9 = -1.24692123826025468001e-18L
+data8 0xC7CB4B3ACB905FDA, 0x00003FBD //A10 = +2.11540249352095943317e-20L
+data8 0xD8D70AEB2E58D729, 0x0000BFB7 //A11 = -3.58731705184186608576e-22L
+data8 0xEB27A61B1D5C7697, 0x00003FB1 //A12 = +6.07861113430709162243e-24L
+data8 0xFEF9ED74D4F4C9B0, 0x0000BFAB //A13 = -1.02984099170876754831e-25L
+data8 0x8E6F410068C12043, 0x00003FA6 //A14 = +1.79777721804459361762e-27L
+data8 0x9AE2F6705481630E, 0x0000BFA0 //A15 = -3.05459905177379058768e-29L
+// Pol24 
+data8 0xD2D858D5B01C9434, 0x00003FEE //A0 = +1.25673476165670766128e-05L
+data8 0x8505330F8B4FDE49, 0x0000BFF2 //A1 = -1.26858053564784963985e-04L
+data8 0xF39171C8B1D418C2, 0x00003FEB //A2 = +1.81472407620770441249e-06L
+data8 0xDEF065C3D7BFD26E, 0x0000BFE5 //A3 = -2.59535215807652675043e-08L
+data8 0xCC0199EA6ACA630C, 0x00003FDF //A4 = +3.71085215769339916703e-10L
+data8 0xBAA25319F01ED248, 0x0000BFD9 //A5 = -5.30445960650683029105e-12L
+data8 0xAAB28A84F8CFE4D1, 0x00003FD3 //A6 = +7.58048850973457592162e-14L
+data8 0x9C14B931AEB311A8, 0x0000BFCD //A7 = -1.08302915828084288776e-15L
+data8 0x8EADA745715A0714, 0x00003FC7 //A8 = +1.54692159263197000533e-17L
+data8 0x82643F3F722CE6B5, 0x0000BFC1 //A9 = -2.20891945694400066611e-19L
+data8 0xEE42ECDE465A99E4, 0x00003FBA //A10 = +3.15336372779307614198e-21L
+data8 0xD99FC74326ACBFC0, 0x0000BFB4 //A11 = -4.50036161691276556269e-23L
+data8 0xC6A4DCACC554911E, 0x00003FAE //A12 = +6.41853356148678957077e-25L
+data8 0xB550CEA09DA96F44, 0x0000BFA8 //A13 = -9.15410112414783078242e-27L
+data8 0xAA9149317996F32F, 0x00003FA2 //A14 = +1.34554050666508391264e-28L
+data8 0x9C3008EFE3F52F19, 0x0000BF9C //A15 = -1.92516125328592532359e-30L
+// Pol25 
+data8 0xA68E78218806283F, 0x00003FEF //A0 = +1.98550844852103406280e-05L
+data8 0xBC41423996DC8A37, 0x0000BFF1 //A1 = -8.97669395268764751516e-05L
+data8 0x90E55AE31A2F8271, 0x00003FEB //A2 = +1.07955871580069359702e-06L
+data8 0xDF022272DA4A3BEF, 0x0000BFE4 //A3 = -1.29807937275957214439e-08L
+data8 0xAB95DCBFFB0BAAB8, 0x00003FDE //A4 = +1.56056011861921437794e-10L
+data8 0x83FF2547BA9011FF, 0x0000BFD8 //A5 = -1.87578539510813332135e-12L
+data8 0xCB0C353560EEDC45, 0x00003FD1 //A6 = +2.25428217090412574481e-14L
+data8 0x9C24CEB86E76D2C5, 0x0000BFCB //A7 = -2.70866279585559299821e-16L
+data8 0xF01AFA23DDFDAE0E, 0x00003FC4 //A8 = +3.25403467375734083376e-18L
+data8 0xB892BDFBCF1D9740, 0x0000BFBE //A9 = -3.90848978133441513662e-20L
+data8 0x8DDBBF34415AAECA, 0x00003FB8 //A10 = +4.69370027479731756829e-22L
+data8 0xDA04170D07458C3B, 0x0000BFB1 //A11 = -5.63558091177482043435e-24L
+data8 0xA76F391095A9563A, 0x00003FAB //A12 = +6.76262416498584003290e-26L
+data8 0x8098FA125C18D8DB, 0x0000BFA5 //A13 = -8.11564737276592661642e-28L
+data8 0xCB9E4D5C08923227, 0x00003F9E //A14 = +1.00391606269366059664e-29L
+data8 0x9CEC3BF7A0BE2CAF, 0x0000BF98 //A15 = -1.20888920108938909316e-31L
+// Pol26 
+data8 0xC17AB25E269272F7, 0x00003FEE //A0 = +1.15322640047234590651e-05L
+data8 0x85310509E633FEF2, 0x0000BFF1 //A1 = -6.35106483144690768696e-05L
+data8 0xAC5E4C4DCB2D940C, 0x00003FEA //A2 = +6.42122148740412561597e-07L
+data8 0xDF0AAD0571FFDD48, 0x0000BFE3 //A3 = -6.49136789710824396482e-09L
+data8 0x9049D8440AFD180F, 0x00003FDD //A4 = +6.56147932223174570008e-11L
+data8 0xBAA936477C5FA9D7, 0x0000BFD6 //A5 = -6.63153032879993841863e-13L
+data8 0xF17261294EAB1443, 0x00003FCF //A6 = +6.70149477756803680009e-15L
+data8 0x9C22F87C31DB007A, 0x0000BFC9 //A7 = -6.77134581402030645534e-17L
+data8 0xC9E98E633942AC12, 0x00003FC2 //A8 = +6.84105580182052870823e-19L
+data8 0x828998181309642C, 0x0000BFBC //A9 = -6.91059649300859944955e-21L
+data8 0xA8C3D4DCE1ECBAB6, 0x00003FB5 //A10 = +6.97995542988331257517e-23L
+data8 0xDA288D52CC4C351A, 0x0000BFAE //A11 = -7.04907829139578377009e-25L
+data8 0x8CEEACB790B5F374, 0x00003FA8 //A12 = +7.11526399101774993883e-27L
+data8 0xB61C8A29D98F24C0, 0x0000BFA1 //A13 = -7.18303147470398859453e-29L
+data8 0xF296F69FE45BDA7D, 0x00003F9A //A14 = +7.47537230021540031251e-31L
+data8 0x9D4B25BF6FB7234B, 0x0000BF94 //A15 = -7.57340869663212138051e-33L
+// Pol27 
+data8 0xC7772CC326D6FBB8, 0x00003FEE //A0 = +1.18890718679826004395e-05L
+data8 0xE0F9D5410565D55D, 0x0000BFF0 //A1 = -5.36384368533203585378e-05L
+data8 0x85C0BE825680E148, 0x00003FEA //A2 = +4.98268406609692971520e-07L
+data8 0x9F058A389D7BA177, 0x0000BFE3 //A3 = -4.62813885933188677790e-09L
+data8 0xBD0B751F0A6BAC7A, 0x00003FDC //A4 = +4.29838009673609430305e-11L
+data8 0xE0B6823570502E9D, 0x0000BFD5 //A5 = -3.99170340031272728535e-13L
+data8 0x858A9C52FC426D86, 0x00003FCF //A6 = +3.70651975271664045723e-15L
+data8 0x9EB4438BFDF1928D, 0x0000BFC8 //A7 = -3.44134780748056488222e-17L
+data8 0xBC968DCD8C06D74E, 0x00003FC1 //A8 = +3.19480670422195579127e-19L
+data8 0xE0133A405F782125, 0x0000BFBA //A9 = -2.96560935615546392028e-21L
+data8 0x851AFEBB70D07E79, 0x00003FB4 //A10 = +2.75255617931932536111e-23L
+data8 0x9E1E21A841BF8738, 0x0000BFAD //A11 = -2.55452923487640676799e-25L
+data8 0xBBCF2EF1C6E72327, 0x00003FA6 //A12 = +2.37048675755308004410e-27L
+data8 0xDF0D320CF12B8BCB, 0x0000BF9F //A13 = -2.19945804585962185550e-29L
+data8 0x8470A76DE5FCADD8, 0x00003F99 //A14 = +2.04056213851532266258e-31L
+data8 0x9D41C15F6A6FBB04, 0x0000BF92 //A15 = -1.89291056020108587823e-33L
+LOCAL_OBJECT_END(erfc_Q_table)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(erfcl)
+ 
+{ .mfi
+      alloc          r32 = ar.pfs, 0, 36, 4, 0
+      fma.s1         FR_Tmp = f1, f1, f8                   // |x|+1, if x >= 0
+      nop.i          0
+}
+{ .mfi
+      addl           GR_ad_Arg    = @ltoff(exp_table_1), gp
+      fms.s1         FR_Tmp1 = f1, f1, f8                   // |x|+1, if x < 0
+      mov            GR_rshf_2to51 = 0x4718         // begin 1.10000 2^(63+51)
+}
+;;
+
+{ .mfi
+      ld8            GR_ad_Arg = [GR_ad_Arg]             // Point to Arg table
+      fcmp.ge.s1     p6,p7 = f8, f0                     // p6: x >= 0 ,p7: x<0
+      shl            GR_rshf_2to51 = GR_rshf_2to51,48 // end 1.10000 2^(63+51)
+}
+{ .mlx
+      mov            GR_rshf = 0x43e8     // begin 1.1000 2^63 for right shift
+      movl           GR_sig_inv_ln2 = 0xb8aa3b295c17f0bc   // signif. of 1/ln2
+}
+;;
+
+{ .mfi
+      mov            GR_exp_2tom51 = 0xffff-51
+      fclass.m       p8,p0 = f8,0x07                            // p8:   x = 0
+      shl            GR_rshf = GR_rshf,48   // end 1.1000 2^63 for right shift
+}
+{ .mfi
+      nop.m          0
+      fnma.s1        FR_norm_x   = f8, f8, f0             //high bits for -x^2
+      nop.i          0         
+}
+;;
+
+.pred.rel "mutex",p6,p7
+{ .mfi
+      setf.sig       FR_INV_LN2_2TO63 = GR_sig_inv_ln2    // form 1/ln2 * 2^63
+(p6)  fma.s1         FR_AbsArg = f1, f0, f8                  // |x|, if x >= 0
+      nop.i          0    
+}
+{ .mfi
+      setf.d         FR_RSHF_2TO51 = GR_rshf_2to51    //const 1.10 * 2^(63+51)
+(p7)  fms.s1         FR_AbsArg = f1, f0, f8                   // |x|, if x < 0
+      mov            GR_exp_mask = 0x1FFFF               // Form exponent mask
+}
+;;
+
+{ .mfi
+      ldfe           FR_ch_dx = [GR_ad_Arg], 16
+      fclass.m       p10,p0 = f8, 0x21                        // p10: x = +inf
+      mov            GR_exp_bias = 0x0FFFF                // Set exponent bias
+}
+{ .mlx                    
+      setf.d         FR_RSHF = GR_rshf      // Right shift const 1.1000 * 2^63
+      movl           GR_ERFC_XC_TB = 0x650  
+}
+;;
+
+.pred.rel "mutex",p6,p7
+{ .mfi
+      setf.exp       FR_2TOM51 = GR_exp_2tom51    // 2^-51 for scaling float_N
+(p6)  fma.s1         FR_Tmp = FR_Tmp, FR_Tmp, f0            // (|x|+1)^2,x >=0
+      nop.i          0
+}
+{ .mfi
+      ldfpd          FR_POS_ARG_ASYMP,FR_NEG_ARG_ASYMP = [GR_ad_Arg], 16
+(p7)  fma.s1         FR_Tmp = FR_Tmp1, FR_Tmp1, f0           // (|x|+1)^2, x<0
+      mov            GR_0x1 = 0x1 
+}
+;;
+
+//p8: y = 1.0, x = 0.0,quick exit 
+{ .mfi
+      ldfpd          FR_dx,FR_dx1 = [GR_ad_Arg], 16
+      fclass.m       p9,p0 = f8, 0x22                          // p9: x = -inf
+      nop.i          0
+
+}
+{ .mfb
+      nop.m          0      
+(p8)  fma.s0         f8 = f1, f1, f0     
+(p8)  br.ret.spnt    b0             
+}
+;;
+
+{ .mfi
+      ldfe           FR_UnfBound = [GR_ad_Arg], 16      
+      fclass.m       p11,p0 = f8, 0xc3                        // p11: x = nan
+      mov            GR_BIAS = 0x0FFFF 
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_NormX = f8,f1,f0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      ldfe           FR_EpsNorm = [GR_ad_Arg], 16
+      fmerge.s       FR_X = f8,f8
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_xsq_lo = f8, f8, FR_norm_x        // low bits for -x^2
+      nop.i          0
+}
+;;
+
+{ .mfi
+      add            GR_ad_C = 0x20, GR_ad_Arg             // Point to C table
+      nop.f          0 
+      add            GR_ad_T1 = 0x50, GR_ad_Arg           // Point to T1 table
+}
+{ .mfi
+      add            GR_ad_T2 = 0x150, GR_ad_Arg          // Point to T2 table
+      nop.f          0 
+      add            GR_ERFC_XC_TB = GR_ERFC_XC_TB, GR_ad_Arg //poin.to XB_TBL
+}
+;;
+
+{ .mfi
+      getf.exp       GR_signexp_x = FR_norm_x  // Extr. sign and exponent of x
+      fma.s1         FR_Tmp = FR_Tmp, FR_Tmp, f0                  // (|x|+1)^4
+      add            GR_ad_W1 = 0x100, GR_ad_T2           // Point to W1 table
+}
+{ .mfi
+      ldfe           FR_L_hi = [GR_ad_Arg],16                      // Get L_hi
+      nop.f          0
+      add            GR_ad_W2 = 0x300, GR_ad_T2           // Point to W2 table
+}
+;;
+
+// p9: y = 2.0, x = -inf, quick exit
+{ .mfi
+      sub            GR_mBIAS = r0, GR_BIAS 
+      fma.s1         FR_2 = f1, f1, f1
+      nop.i          0      
+}
+{ .mfb
+      ldfe           FR_L_lo = [GR_ad_Arg],16                      // Get L_lo
+(p9)  fma.s0         f8 = f1, f1, f1  
+(p9)  br.ret.spnt    b0 
+}
+;;
+
+// p10: y = 0.0, x = +inf, quick exit
+{ .mfi
+      adds           GR_ERFC_P_TB = 0x380, GR_ERFC_XC_TB   // pointer to P_TBL
+      fma.s1         FR_N_signif = FR_norm_x, FR_INV_LN2_2TO63, FR_RSHF_2TO51
+      and            GR_exp_x = GR_signexp_x, GR_exp_mask
+}
+{ .mfb    
+      adds           GR_ERFC_S_TB = 0x1C0, GR_ERFC_XC_TB   // pointer to S_TBL
+(p10) fma.s0         f8 = f0, f1, f0 
+(p10) br.ret.spnt    b0  
+}
+;;
+
+// p12: |x| < 0.681...  ->  dx = 0.875 (else dx = 0.625 )
+// p11: y = x, x = nan, quick exit
+{ .mfi
+      ldfe           FR_C3 = [GR_ad_C],16           // Get C3 for normal path
+      fcmp.lt.s1     p12,p0 = FR_AbsArg, FR_ch_dx          
+      shl            GR_ShftPi_bias = GR_BIAS, 8                //  BIAS * 256
+}
+{ .mfb
+      sub            GR_exp_x = GR_exp_x, GR_exp_bias          // Get exponent
+(p11) fma.s0         f8 = f8, f1, f0
+(p11) br.ret.spnt    b0                     
+
+}
+;;
+
+{ .mfi
+      ldfe           FR_C2 = [GR_ad_C],16              // Get A2 for main path
+      nop.f          0
+      nop.i          0
+}
+;;
+
+//p15: x > POS_ARG_ASYMP = 107.0 -> erfcl(x) ~=~ 0.0
+{ .mfi
+      ldfe           FR_C1 = [GR_ad_C],16              // Get C1 for main path
+(p6)  fcmp.gt.unc.s1 p15,p0 = FR_AbsArg, FR_POS_ARG_ASYMP        // p6: x >= 0
+      nop.i          0    
+}
+{ .mfb
+      nop.m          0
+(p12) fma.s1         FR_dx = FR_dx1, f1, f0   //p12: dx = 0.875 for x < 0.681
+      nop.b          0
+}
+;;
+
+//p14: x < - NEG_ARG_ASYMP = -6.5 -> erfcl(x) ~=~ 2.0
+{ .mfi
+      nop.m          0
+(p7)  fcmp.gt.unc.s1 p14,p0 = FR_AbsArg,FR_NEG_ARG_ASYMP          // p7: x < 0
+      shladd         GR_ShftXBi_bias = GR_mBIAS, 4, r0
+}
+;; 
+
+{ .mfi
+      nop.m          0
+      fma.s0         FR_Tmpf = f1, f1, FR_EpsNorm                    // flag i
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fms.s1         FR_float_N = FR_N_signif, FR_2TOM51, FR_RSHF  
+      nop.i          0
+}
+;;
+
+// p8: x < UnfBound ~=~ 106.53... -> result without underflow error
+// p14: y ~=~ 2, x < -6.5,quick exit
+{ .mfi
+      getf.exp       GR_IndxPlusBias = FR_Tmp      // exp + bias for (|x|+1)^4
+      fcmp.lt.s1     p8,p0 = FR_NormX,FR_UnfBound   
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p14) fnma.s0        FR_RESULT = FR_EpsNorm,FR_EpsNorm,FR_2
+(p14) br.ret.spnt    b0               
+
+}
+;;
+
+// p15: y ~=~ 0.0 (result with underflow error), x > POS_ARG_ASYMP = 107.0,
+// call __libm_error_region 
+{ .mfb
+(p15) mov            GR_Parameter_TAG = 207
+(p15) fma.s0         FR_RESULT = FR_EpsNorm,FR_EpsNorm,f0 
+(p15) br.cond.spnt   __libm_error_region        
+}
+;;
+
+{ .mfi
+      getf.sig       GR_N_fix = FR_N_signif          // Get N from significand
+      nop.f          0
+      shl            GR_ShftPi = GR_IndxPlusBias, 8
+     
+}
+{ .mfi
+      shladd         GR_ShftXBi = GR_IndxPlusBias, 4, GR_ShftXBi_bias
+      nop.f          0
+      nop.i          0
+}
+;;
+
+{ .mmi
+      add            GR_ERFC_S_TB = GR_ERFC_S_TB, GR_ShftXBi    //poin.to S[i]
+      add            GR_ERFC_XC_TB = GR_ERFC_XC_TB, GR_ShftXBi //poin.to XC[i]
+      sub            GR_ShftPi = GR_ShftPi, GR_ShftPi_bias            // 256*i
+}
+;;
+
+{ .mfi
+      ldfe           FR_Xc  = [GR_ERFC_XC_TB]
+      fma.s1         FR_Xpdx_hi = FR_AbsArg, f1, FR_dx              //  x + dx
+      add            GR_ShftA14 = 0xE0, GR_ShftPi     // pointer shift for A14
+
+ 
+}
+{ .mfi
+      ldfe           FR_S  = [GR_ERFC_S_TB]
+      fnma.s1        FR_r = FR_L_hi, FR_float_N, FR_norm_x//r= -L_hi*float_N+x
+      add            GR_ShftA15 = 0xF0, GR_ShftPi     // pointer shift for A15
+}
+;;
+
+{ .mfi
+      add            GR_P_POINT_1 = GR_ERFC_P_TB, GR_ShftA14 // pointer to A14
+      fcmp.gt.s1     p9,p10 = FR_AbsArg, FR_dx      //p9: x > dx, p10: x <= dx
+      extr.u         GR_M1 = GR_N_fix, 6, 6               // Extract index M_1
+}
+{ .mfi
+      add            GR_P_POINT_2 = GR_ERFC_P_TB, GR_ShftA15 // pointer to A15
+      nop.f          0
+      nop.i          0
+
+}
+;;
+
+{ .mfi              
+      ldfe           FR_A14 = [GR_P_POINT_1], -32
+      nop.f          0                  
+      extr.u         GR_M2 = GR_N_fix, 0, 6               // Extract index M_2
+}
+{ .mfi              
+      ldfe           FR_A15 = [GR_P_POINT_2], -32
+      nop.f          0            
+      shladd         GR_ad_W1 = GR_M1,3,GR_ad_W1                // Point to W1
+}
+;;
+
+{ .mfi
+      ldfe           FR_A12 = [GR_P_POINT_1], -64
+      nop.f          0
+      extr           GR_K = GR_N_fix, 12, 32         // Extract limite range K
+}
+{ .mfi
+      ldfe           FR_A13 = [GR_P_POINT_2], -64
+      nop.f          0
+      shladd         GR_ad_T1 = GR_M1,2,GR_ad_T1                // Point to T1
+}
+;;    
+
+{ .mfi
+      ldfe           FR_A8 = [GR_P_POINT_1], 32
+      nop.f          0
+      add            GR_exp_2_k = GR_exp_bias, GR_K    // Form exponent of 2^k
+}
+{ .mfi
+      ldfe           FR_A9 = [GR_P_POINT_2], 32
+      nop.f          0
+      shladd         GR_ad_W2 = GR_M2,3,GR_ad_W2                // Point to W2
+}
+;;
+  
+{ .mfi
+      ldfe           FR_A10 = [GR_P_POINT_1], -96   
+      nop.f          0
+      shladd         GR_ad_T2 = GR_M2,2,GR_ad_T2                // Point to T2
+}
+{ .mfi
+      ldfe           FR_A11 = [GR_P_POINT_2], -96    
+      fnma.s1        FR_r = FR_L_lo, FR_float_N, FR_r //r = -L_lo*float_N + r
+      nop.i          0
+}
+;;   
+
+{ .mfi              
+      ldfe           FR_A4 = [GR_P_POINT_1], 32
+(p10) fms.s1         FR_Tmp = FR_dx,f1, FR_Xpdx_hi   //for lo  of  x+dx, x<=dx
+      nop.i          0
+}
+{ .mfi              
+      ldfe           FR_A5 = [GR_P_POINT_2], 32
+(p9)  fms.s1         FR_Tmp = FR_AbsArg, f1, FR_Xpdx_hi //for lo of x+dx, x>dx
+      nop.i          0
+}
+;;
+
+{ .mfi       
+      ldfe           FR_A6 = [GR_P_POINT_1], -64     
+      frcpa.s1       FR_U,p11 = f1, FR_Xpdx_hi          //  hi of  1 /(x + dx)
+      nop.i          0
+}
+{ .mfi      
+      ldfe           FR_A7 = [GR_P_POINT_2], -64  
+      nop.f          0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      ldfe           FR_A2 = [GR_P_POINT_1], -32
+      nop.f          0            
+      nop.i          0       
+}
+{ .mfi
+      ldfe           FR_A3 = [GR_P_POINT_2], -32
+      nop.f          0      
+      nop.i          0       
+}
+;;
+
+{ .mfi      
+      ldfe           FR_A0 = [GR_P_POINT_1], 224
+      nop.f          0
+      nop.i          0
+}
+{ .mfi
+      ldfe           FR_A1 = [GR_P_POINT_2]
+      fms.s1         FR_LocArg = FR_AbsArg, f1, FR_Xc       // xloc = x - x[i]
+      nop.i          0
+}
+;;
+
+{ .mfi
+      ldfd           FR_W1 = [GR_ad_W1],0                            // Get W1
+      nop.f          0            
+      nop.i          0       
+}
+{ .mfi
+      ldfd           FR_W2 = [GR_ad_W2],0                            // Get W2
+      fma.s1         FR_poly = FR_r, FR_C3, FR_C2        // poly = r * A3 + A2
+      nop.i          0       
+}
+;;
+
+{ .mfi
+      ldfs           FR_T1 = [GR_ad_T1],0                            // Get T1
+(p10) fma.s1         FR_Xpdx_lo = FR_AbsArg,f1, FR_Tmp//lo of x + dx , x <= dx
+      nop.i          0 
+}
+{ .mfi
+      ldfs           FR_T2 = [GR_ad_T2],0                            // Get T2
+(p9)  fma.s1         FR_Xpdx_lo = FR_dx,f1, FR_Tmp   // lo  of  x + dx, x > dx
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fnma.s1        FR_Tmp1 = FR_Xpdx_hi, FR_U, FR_2        //  N-R, iter. N1
+      nop.i          0 
+}
+{ .mfi
+      nop.m          0
+      fmpy.s1        FR_rsq = FR_r, FR_r                        // rsq = r * r
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      setf.exp       FR_scale = GR_exp_2_k                  // Set scale = 2^k
+      fma.s1         FR_P15_1_1 = FR_LocArg, FR_LocArg, f0          // xloc ^2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0 
+      fma.s1         FR_P15_0_1 = FR_A15, FR_LocArg, FR_A14 
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_1_2 = FR_A13, FR_LocArg, FR_A12 
+      nop.i          0 
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_poly = FR_r, FR_poly, FR_C1    // poly = r * poly + A1
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_2_1 = FR_A9, FR_LocArg, FR_A8 
+      nop.i          0 
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_2_2 = FR_A11, FR_LocArg, FR_A10 
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_U = FR_U, FR_Tmp1, f0                //  N-R, iter. N1
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_3_1 = FR_A5, FR_LocArg, FR_A4
+      nop.i          0                   
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_3_2 = FR_A7, FR_LocArg, FR_A6
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_4_2 = FR_A3, FR_LocArg, FR_A2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_W = FR_W1, FR_W2, FR_W2            // W = W1 * W2 + W2
+      nop.i          0
+}
+;; 
+                      
+{ .mfi
+      nop.m          0
+      fmpy.s1        FR_T = FR_T1, FR_T2                        // T = T1 * T2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_7_1 = FR_P15_0_1, FR_P15_1_1, FR_P15_1_2
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_7_2 = FR_P15_1_1, FR_P15_1_1, f0         // xloc^4
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_8_1 = FR_P15_1_1, FR_P15_2_2, FR_P15_2_1
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fnma.s1        FR_Tmp = FR_Xpdx_hi, FR_U, FR_2         //  N-R, iter. N2
+      nop.i          0
+}
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_poly = FR_rsq, FR_poly, FR_r  // poly = rsq * poly + r
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_9_1 = FR_P15_1_1, FR_P15_4_2, FR_A0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_9_2 = FR_P15_1_1, FR_P15_3_2, FR_P15_3_1
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_W = FR_W, f1, FR_W1                      // W = W + W1
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_T_scale = FR_T, FR_scale, f0    // T_scale = T * scale
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_13_1 = FR_P15_7_2, FR_P15_7_1, FR_P15_8_1
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_U = FR_U, FR_Tmp, f0                 //  N-R, iter. N2
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_14_1 = FR_P15_7_2, FR_P15_9_2, FR_P15_9_1
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_P15_14_2 = FR_P15_7_2, FR_P15_7_2, f0        // xloc^8
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_M =  FR_T_scale, FR_S, f0 
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fnma.s1        FR_Tmp = FR_Xpdx_hi, FR_U, FR_2         //  N-R, iter. N3
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_Q = FR_P15_14_2, FR_P15_13_1, FR_P15_14_1
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fms.s1         FR_H = FR_W, f1, FR_xsq_lo              // H = W - xsq_lo
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_U = FR_U, FR_Tmp, f0                 //  N-R, iter. N3
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_Q = FR_A1, FR_LocArg, FR_Q         
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fnma.s1        FR_Tmp = FR_Xpdx_hi, FR_U, f1                   // for du
+      nop.i          0 
+}
+{ .mfi
+      nop.m          0
+      fma.s1         FR_R = FR_H, FR_poly, FR_poly  
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_res_pos_x_hi = FR_M, FR_U, f0                 //  M *U
+      nop.i          0
+ 
+}
+;;  
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_R = FR_R, f1, FR_H            // R = H + P(r) + H*P(r)
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s0         FR_Tmpf = f8, f1, f0                          //  flag  d
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fnma.s1        FR_dU = FR_Xpdx_lo, FR_U, FR_Tmp 
+      nop.i          0 
+}
+;;
+
+// p7: we begin to calculate y(x) = 2 - erfcl(-x) in multi precision
+// for -6.5 <= x < 0
+{ .mfi
+      nop.m          0
+      fms.s1         FR_res_pos_x_lo = FR_M, FR_U, FR_res_pos_x_hi 
+      nop.i          0                      
+ 
+}
+{ .mfi
+      nop.m          0
+(p7)  fnma.s1        FR_Tmp1 = FR_res_pos_x_hi, f1, FR_2           //p7: x < 0
+      nop.i          0                      
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_G = FR_R, FR_Q, FR_Q    
+      nop.i          0
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_Tmp = FR_R, f1, FR_dU                       //  R + du
+      nop.i          0
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+(p7)  fnma.s1        FR_Tmp2 = FR_Tmp1, f1, FR_2                   //p7: x < 0
+      nop.i          0                      
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_G = FR_G, f1, FR_Tmp    
+      nop.i          0
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+(p7)  fnma.s1        FR_Tmp2 = FR_res_pos_x_hi, f1, FR_Tmp2        //p7: x < 0
+      nop.i          0                      
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         FR_V = FR_G, FR_res_pos_x_hi, f0          // V = G * M *U
+      nop.i          0
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+(p7)  fma.s1         FR_res_pos_x_lo = FR_res_pos_x_lo, f1, FR_V   //p7: x < 0
+      nop.i          0                      
+ 
+}
+;;
+
+{ .mfi
+      nop.m          0
+(p7)  fnma.s1        FR_Tmp2 = FR_res_pos_x_lo, f1, FR_Tmp2        //p7: x < 0
+      nop.i          0                      
+ 
+}
+;;
+
+
+//p6: result for     0 < x < = POS_ARG_ASYMP 
+//p7: result for   - NEG_ARG_ASYMP  <= x < 0
+//p8: exit   for   - NEG_ARG_ASYMP  <=   x < UnfBound
+
+ERFC_RESULT:                 
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m          0
+(p6)  fma.s0         f8 = FR_M, FR_U, FR_V                       // p6: x >= 0
+      nop.i          0         
+}
+{ .mfb
+      mov            GR_Parameter_TAG = 207
+(p7)  fma.s0         f8 = FR_Tmp2, f1, FR_Tmp1                    // p7: x < 0
+(p8)  br.ret.sptk    b0                                      
+};;
+
+GLOBAL_LIBM_END(erfcl)
+
+// call via (p15) br.cond.spnt   __libm_error_region
+//          for  x > POS_ARG_ASYMP
+// or
+//
+// after .endp erfcl for UnfBound < = x < = POS_ARG_ASYMP
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp                       // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                                      // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                                           // Save gp
+};;
+{ .mmi
+        stfe [GR_Parameter_Y] = FR_Y,16          // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp                      // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                                           // Save b0
+};;
+.body
+{ .mib
+        stfe [GR_Parameter_X] = FR_X             // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0        
+}
+{ .mib
+        stfe [GR_Parameter_Y] = FR_RESULT        // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]        // Get return result off stack
+.restore sp
+        add   sp = 64,sp                              // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                        // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                                    // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS                           // Restore ar.pfs
+        br.ret.sptk     b0                                           // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
+
diff --git a/sysdeps/ia64/fpu/s_erff.S b/sysdeps/ia64/fpu/s_erff.S
new file mode 100644
index 0000000000..ed0aaac488
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_erff.S
@@ -0,0 +1,558 @@
+.file "erff.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/14/01 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/06/03 Reordered header: .section, .global, .proc, .align
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// float erff(float)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+//
+// There are 8 paths:
+// 1. x = +/-0.0
+//    Return erff(x) = +/-0.0
+//
+// 2. 0.0 < |x| < 0.125
+//    Return erff(x) = x *Pol3(x^2),
+//    where Pol3(x^2) = C3*x^6 + C2*x^4 + C1*x^2 + C0
+//
+// 3. 0.125 <= |x| < 4.0
+//    Return erff(x) = sign(x)*PolD(x)*PolC(|x|) + sign(x)*PolA(|x|),
+//    where sign(x)*PolD(x) = sign(x)*(|x|^7 + D2*x^6 + D1*|x|^5 + D0*x^4),
+//          PolC(|x|) = B0*x^4 + C3*|x|^3 + C2*|x|^2 + C1*|x| + C0,
+//          PolA(|x|) = A3|x|^3 + A2*x^2 + A1*|x| + A0
+//
+//    Actually range 0.125<=|x|< 4.0 is splitted to 5 subranges.
+//    For each subrange there is particular set of coefficients.
+//    Below is the list of subranges:
+//    3.1 0.125 <= |x| < 0.25
+//    3.2 0.25 <= |x| < 0.5
+//    3.3 0.5 <= |x| < 1.0
+//    3.4 1.0 <= |x| < 2.0
+//    3.5 2.0 <= |x| < 4.0
+//
+// 4. 4.0 <= |x| < +INF
+//    Return erff(x) = sign(x)*(1.0d - 2^(-52))
+//
+// 5. |x| = INF
+//    Return erff(x) = sign(x) * 1.0
+//
+// 6. x = [S,Q]NaN 
+//    Return erff(x) = QNaN
+//
+// 7. x is positive denormal
+//    Return erff(x) = C0*x - x^2,
+//    where C0 = 2.0/sqrt(Pi)
+//
+// 8. x is negative denormal
+//    Return erff(x) = C0*x + x^2,
+//    where C0 = 2.0/sqrt(Pi)
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input
+// f32 -> f59
+
+// General registers used:  
+// r32 -> r45, r2, r3
+
+// Predicate registers used:
+// p0, p6 -> p12, p14, p15
+
+// p6           to filter out case when x = [Q,S]NaN or +/-0
+// p7           to filter out case when x = denormal
+// p8           set if |x| >= 0.3125, used also to process denormal input
+// p9           to filter out case when |x| = inf
+// p10          to filter out case when |x| < 0.125
+// p11          to filter out case when 0.125 <= |x| < 4.0
+// p12          to filter out case when |x| >= 4.0
+// p14          set to 1 for positive x
+// p15          set to 1 for negative x
+
+// Assembly macros
+//==============================================================
+rDataPtr           = r2
+rDataPtr1          = r3
+
+rBias              = r33
+rCoeffAddr3        = r34
+rCoeffAddr1        = r35
+rCoeffAddr2        = r36
+rOffset2           = r37
+rBias2             = r38
+rMask              = r39
+rArg               = r40
+rBound             = r41
+rSignBit           = r42
+rAbsArg            = r43
+rDataPtr2          = r44
+rSaturation        = r45
+
+//==============================================================
+fA0                = f32
+fA1                = f33
+fA2                = f34
+fA3                = f35
+fC0                = f36
+fC1                = f37
+fC2                = f38
+fC3                = f39
+fD0                = f40
+fD1                = f41
+fD2                = f42
+fB0                = f43
+fArgSqr            = f44
+fAbsArg            = f45
+fSignumX           = f46
+fArg4              = f47
+fArg4Sgn           = f48
+fArg3              = f49
+fArg3Sgn           = f50
+fArg7Sgn           = f51
+fArg6Sgn           = f52
+fPolC              = f53
+fPolCTmp           = f54
+fPolA              = f55
+fPolATmp           = f56
+fPolD              = f57
+fPolDTmp           = f58
+fArgSqrSgn         = f59
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(erff_data)
+// Polynomial coefficients for the erf(x), 0.125 <= |x| < 0.25
+data8 0xBE4218BB56B49E66 // C0
+data8 0x3F7AFB8315DA322B // C1
+data8 0x3F615D6EBEE0CA32 // C2
+data8 0xBF468D71CF4F0918 // C3
+data8 0x40312115B0932F24 // D0
+data8 0xC0160D6CD0991EA3 // D1
+data8 0xBFE04A567A6DBE4A // D2
+data8 0xBF4207BC640D1509 // B0   
+// Polynomial coefficients for the erf(x), 0.25 <= |x| < 0.5
+data8 0x3F90849356383F58 // C0
+data8 0x3F830BD5BA240F09 // C1
+data8 0xBF3FA4970E2BCE23 // C2
+data8 0xBF6061798E58D0FD // C3
+data8 0xBF68C0D83DD22E02 // D0
+data8 0x401C0A9EE4108F94 // D1
+data8 0xC01056F9B5E387F5 // D2
+data8 0x3F1C9744E36A5706 // B0
+// Polynomial coefficients for the erf(x), 0.5 <= |x| < 1.0
+data8 0x3F85F7D419A13DE3 // C0
+data8 0x3F791A13FF66D45A // C1
+data8 0x3F46B17B16B5929F // C2
+data8 0xBF5124947A8BF45E // C3
+data8 0x3FA1B3FD95EA9564 // D0
+data8 0x40250CECD79A020A // D1
+data8 0xC0190DC96FF66CCD // D2
+data8 0x3F4401AE28BA4DD5 // B0
+// Polynomial coefficients for the erf(x), 1.0 <= |x| < 2.0
+data8 0xBF49E07E3584C3AE // C0
+data8 0x3F3166621131445C // C1
+data8 0xBF65B7FC1EAC2099 // C2
+data8 0x3F508C6BD211D736 // C3
+data8 0xC053FABD70601067 // D0
+data8 0x404A06640EE87808 // D1
+data8 0xC0283F30817A3F08 // D2
+data8 0xBF2F6DBBF4D6257F // B0
+// Polynomial coefficients for the erf(x), 2.0 <= |x| < 4.0
+data8 0xBF849855D67E9407 // C0
+data8 0x3F5ECA5FEC01C70C // C1
+data8 0xBF483110C30FABA4 // C2
+data8 0x3F1618DA72860403 // C3
+data8 0xC08A5C9D5FE8B9F6 // D0
+data8 0x406EFF5F088CEC4B // D1
+data8 0xC03A5743DF38FDE0 // D2
+data8 0xBEE397A9FA5686A2 // B0
+// Polynomial coefficients for the erf(x), -0.125 < x < 0.125 
+data8 0x3FF20DD7504270CB // C0
+data8 0xBFD8127465AFE719 // C1
+data8 0x3FBCE2D77791DD77 // C2
+data8 0xBF9B582755CDF345 // C3
+// Polynomial coefficients for the erf(x), 0.125 <= |x| < 0.25
+data8 0xBD54E7E451AF0E36 // A0
+data8 0x3FF20DD75043FE20 // A1
+data8 0xBE05680ACF8280E4 // A2
+data8 0xBFD812745E92C3D3 // A3
+// Polynomial coefficients for the erf(x), 0.25 <= |x| < 0.5
+data8 0xBE1ACEC2859CB55F // A0
+data8 0x3FF20DD75E8D2B64 // A1
+data8 0xBEABC6A83208FCFC // A2
+data8 0xBFD81253E42E7B99 // A3
+// Polynomial coefficients for the erf(x), 0.5 <= |x| < 1.0
+data8 0x3EABD5A2482B4979 // A0
+data8 0x3FF20DCAA52085D5 // A1
+data8 0x3F13A994A348795B // A2
+data8 0xBFD8167B2DFCDE44 // A3
+// Polynomial coefficients for the erf(x), 1.0 <= |x| < 2.0
+data8 0xBF5BA377DDAB4E17 // A0
+data8 0x3FF2397F1D8FC0ED // A1
+data8 0xBF9945BFC1915C21 // A2
+data8 0xBFD747AAABB690D8 // A3
+// Polynomial coefficients for the erf(x), 2.0 <= |x| < 4.0
+data8 0x3FF0E2920E0391AF // A0
+data8 0xC00D249D1A95A5AE // A1
+data8 0x40233905061C3803 // A2
+data8 0xC027560B851F7690 // A3
+//
+data8 0x3FEFFFFFFFFFFFFF // 1.0 - epsilon
+data8 0x3FF20DD750429B6D // C0 = 2.0/sqrt(Pi)
+LOCAL_OBJECT_END(erff_data)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(erff)
+
+{ .mfi
+      alloc          r32 = ar.pfs, 0, 14, 0, 0
+      fmerge.s       fAbsArg = f1, f8             // |x|
+      addl           rMask = 0x806, r0
+}
+{ .mfi
+      addl           rDataPtr = @ltoff(erff_data), gp
+      fma.s1         fArgSqr = f8, f8, f0         // x^2
+      adds           rSignBit = 0x1, r0
+}
+;;
+
+{ .mfi
+      getf.s         rArg = f8                    // x in GR 
+      fclass.m       p7,p0 = f8, 0x0b             // is x denormal ?
+      // sign bit and 2 most bits in significand
+      shl            rMask = rMask, 20               
+}
+{ .mfi
+      ld8            rDataPtr = [rDataPtr]
+      nop.f          0
+      adds           rBias2 = 0x1F0, r0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fmerge.s       fSignumX = f8, f1            // signum(x)
+      shl            rSignBit = rSignBit, 31      // mask for sign bit
+}
+{ .mfi
+      adds           rBound = 0x3E0, r0
+      nop.f          0
+      adds           rSaturation = 0x408, r0
+}
+;;
+
+{ .mfi
+      andcm          rOffset2 = rArg, rMask
+      fclass.m       p6,p0 = f8, 0xc7             // is x [S,Q]NaN or +/-0 ?
+      shl            rBound = rBound, 20          // 0.125f in GR 
+}
+{ .mfb
+      andcm          rAbsArg = rArg, rSignBit     // |x| in GR
+      nop.f          0
+(p7)  br.cond.spnt   erff_denormal               // branch out if x is denormal
+}
+;;
+
+{ .mfi
+      adds           rCoeffAddr2 = 352, rDataPtr
+      fclass.m       p9,p0 = f8, 0x23            // is x +/- inf?
+      shr            rOffset2 = rOffset2, 21
+}
+{ .mfi
+      cmp.lt         p10, p8 = rAbsArg, rBound   // |x| < 0.125? 
+      nop.f          0
+      adds           rCoeffAddr3 = 16, rDataPtr
+}
+;;
+
+{ .mfi
+(p8)  sub            rBias = rOffset2, rBias2
+      fma.s1         fArg4 = fArgSqr, fArgSqr, f0 // x^4
+      shl            rSaturation = rSaturation, 20// 4.0 in GR (saturation bound)
+}
+{ .mfb
+(p10) adds           rBias = 0x14, r0
+(p6)  fma.s.s0       f8 = f8,f1,f8                // NaN or +/-0
+(p6)  br.ret.spnt    b0                           // exit for x = NaN or +/-0
+}
+;;
+
+{ .mfi
+      shladd         rCoeffAddr1 = rBias, 4, rDataPtr
+      fma.s1         fArg3Sgn = fArgSqr, f8, f0  // sign(x)*|x|^3
+      // is |x| < 4.0? 
+      cmp.lt         p11, p12 = rAbsArg, rSaturation  
+}
+{ .mfi
+      shladd         rCoeffAddr3 = rBias, 4, rCoeffAddr3
+      fma.s1         fArg3 = fArgSqr, fAbsArg, f0 // |x|^3
+      shladd         rCoeffAddr2 = rBias, 3, rCoeffAddr2
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fC0, fC1 = [rCoeffAddr1]
+(p9)  fmerge.s       f8 = f8,f1                   // +/- inf
+(p12) adds           rDataPtr = 512, rDataPtr 
+}
+{ .mfb
+(p11) ldfpd          fC2, fC3 = [rCoeffAddr3], 16
+      nop.f          0
+(p9)  br.ret.spnt    b0                           // exit for x = +/- inf
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fA0, fA1 = [rCoeffAddr2], 16
+      nop.f          0
+      nop.i          0
+}
+{ .mfi
+      add            rCoeffAddr1 = 48, rCoeffAddr1
+      nop.f          0
+      nop.i          0
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fD0, fD1 = [rCoeffAddr3]
+      nop.f          0
+      nop.i          0
+}
+{ .mfb
+(p11) ldfpd          fD2, fB0 = [rCoeffAddr1]
+      // sign(x)*|x|^2
+      fma.s1         fArgSqrSgn = fArgSqr, fSignumX, f0
+(p10) br.cond.spnt   erff_near_zero
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fA2, fA3 = [rCoeffAddr2], 16
+      fcmp.lt.s1     p15, p14 = f8,f0
+      nop.i          0
+}
+{ .mfb
+(p12) ldfd           fA0 = [rDataPtr]
+      fma.s1         fArg4Sgn = fArg4, fSignumX, f0 // sign(x)*|x|^4
+(p12) br.cond.spnt   erff_saturation
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fArg7Sgn = fArg4, fArg3Sgn, f0  // sign(x)*|x|^7
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fArg6Sgn = fArg3, fArg3Sgn, f0  // sign(x)*|x|^6
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolC = fC3, fAbsArg, fC2    // C3*|x| + C2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fPolCTmp = fC1, fAbsArg, fC0 // C1*|x| + C0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolA = fA1, fAbsArg, fA0    // A1*|x| + A0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolD = fD1, fAbsArg, fD0    // D1*|x| + D0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      // sign(x)*(|x|^7 + D2*x^6)
+      fma.s1         fPolDTmp = fArg6Sgn, fD2, fArg7Sgn
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolATmp = fA3, fAbsArg, fA2  // A3*|x| + A2 
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fB0 = fB0, fArg4, f0          // B0*x^4
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      // C3*|x|^3 + C2*x^2 + C1*|x| + C0
+      fma.s1         fPolC = fPolC, fArgSqr, fPolCTmp  
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      // PolD = sign(x)*(|x|^7 + D2*x^6 + D1*|x|^5 + D0*x^4)
+      fma.d.s1       fPolD = fPolD, fArg4Sgn, fPolDTmp  
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      // PolA = A3|x|^3 + A2*x^2 + A1*|x| + A0 
+      fma.d.s1       fPolA = fPolATmp, fArgSqr, fPolA 
+      nop.i          0
+}
+;;                 
+
+{ .mfi
+      nop.m          0
+      // PolC = B0*x^4 + C3*|x|^3 + C2*|x|^2 + C1*|x| + C0 
+      fma.d.s1       fPolC = fPolC, f1, fB0 
+      nop.i          0
+}
+;;     
+
+{ .mfi
+      nop.m          0
+(p14) fma.s.s0       f8 = fPolC, fPolD, fPolA     // for positive x
+      nop.i          0                           
+}
+{ .mfb
+      nop.m          0
+(p15) fms.s.s0       f8 = fPolC, fPolD, fPolA     // for negative x
+      br.ret.sptk    b0                           // Exit for 0.125 <=|x|< 4.0
+};;
+
+
+// Here if |x| < 0.125
+erff_near_zero:
+{ .mfi
+      nop.m          0
+      fma.s1         fPolC = fC3, fArgSqr, fC2    // C3*x^2 + C2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fPolCTmp = fC1, fArgSqr, fC0  // C1*x^2 + C0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolC = fPolC, fArg4, fPolCTmp // C3*x^6 + C2*x^4 + C1*x^2 + C0
+      nop.i          0
+};;
+
+{ .mfb
+      nop.m          0
+      // x*(C3*x^6 + C2*x^4 + C1*x^2 + C0)
+      fma.s.s0       f8 = fPolC, f8, f0
+      br.ret.sptk    b0                           // Exit for |x| < 0.125
+};;
+
+// Here if 4.0 <= |x| < +inf
+erff_saturation:
+{ .mfb
+      nop.m          0
+      fma.s.s0       f8 = fA0, fSignumX, f0       // sign(x)*(1.0d - 2^(-52))
+      // Exit for 4.0 <= |x| < +inf
+      br.ret.sptk    b0                           // Exit for 4.0 <=|x|< +inf
+}
+;;
+      
+// Here if x is single precision denormal
+erff_denormal:
+{ .mfi
+      adds           rDataPtr = 520, rDataPtr     // address of C0
+      fclass.m       p7,p8 = f8, 0x0a             // is x -denormal ?
+      nop.i          0
+}
+;;
+{ .mfi
+      ldfd           fC0 = [rDataPtr]             // C0
+      nop.f          0
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fC0 = fC0,f8,f0              // C0*x
+      nop.i          0
+}
+;;
+{ .mfi
+      nop.m          0
+(p7)  fma.s.s0       f8 = f8,f8,fC0               // -denormal
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p8)  fnma.s.s0      f8 = f8,f8,fC0               // +denormal
+      br.ret.sptk    b0                           // Exit for denormal
+}
+;;
+
+GLOBAL_LIBM_END(erff)
diff --git a/sysdeps/ia64/fpu/s_erfl.S b/sysdeps/ia64/fpu/s_erfl.S
new file mode 100644
index 0000000000..10da22ce36
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_erfl.S
@@ -0,0 +1,1240 @@
+.file "erfl.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 11/21/01  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 08/14/02  Changed mli templates to mlx
+// 02/06/03  Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// long double erfl(long double)
+//
+// Overview of operation
+//==============================================================
+//
+// Algorithm description
+// ---------------------
+//
+// There are 4 paths:
+//
+// 1. Special path: x = 0, Inf, NaNs, denormal
+//    Return erfl(x) = +/-0.0 for zeros
+//    Return erfl(x) = QNaN for NaNs
+//    Return erfl(x) = sign(x)*1.0 for Inf
+//    Return erfl(x) = (A0H+A0L)*x + x^2, ((A0H+A0L) = 2.0/sqrt(Pi))
+//                                             for denormals
+//
+// 2. [0;1/8] path: 0.0 < |x| < 1/8
+//    Return erfl(x) = x*(A1H+A1L) + x^3*A3 + ... + x^15*A15
+//
+// 3. Main path: 1/8 <= |x| < 6.53
+//    For several ranges of 1/8 <= |x| < 6.53
+//    Return erfl(x) = sign(x)*((A0H+A0L) + y*(A1H+A1L) + y^2*(A2H+A2L) + 
+//                                       + y^3*A3 + y^4*A4 + ... + y^25*A25 )
+//    where y = (|x|/a) - b
+//
+//    For each range there is particular set of coefficients.
+//    Below is the list of ranges:
+//    1/8  <= |x| < 1/4     a = 0.125, b = 1.5
+//    1/4  <= |x| < 1/2     a = 0.25,  b = 1.5
+//    1/2  <= |x| < 1.0     a = 0.5,   b = 1.5
+//    1.0  <= |x| < 2.0     a = 1.0,   b = 1.5
+//    2.0  <= |x| < 3.25    a = 2.0,   b = 1.5
+//    3.25 <= |x| < 4.0     a = 2.0,   b = 2.0
+//    4.0  <= |x| < 6.53    a = 4.0,   b = 1.5
+//    ( [3.25;4.0] subrange separated for monotonicity issues resolve )
+//
+// 4. Saturation path: 6.53 <= |x| < +INF 
+//    Return erfl(x) = sign(x)*(1.0 - tiny_value)
+//    (tiny_value ~ 1e-1233)
+//
+// Implementation notes
+// --------------------
+//
+// 1. Special path: x = 0, INF, NaNa, denormals
+//
+//    This branch is cut off by one fclass operation.
+//    Then zeros+nans, infinities and denormals processed separately.
+//    For denormals we had to use multiprecision A0 coefficient to reach
+//    necessary accuracy: (A0H+A0L)*x-x^2
+//
+// 2. [0;1/8] path: 0.0 < |x| < 1/8
+//
+//    First coefficient of polynomial we must split to multiprecision too.
+//    Also we can parallelise computations:
+//    (x*(A1H+A1L)) calculated in parallel with "tail" (x^3*A3 + ... + x^15*A15)
+//    Furthermore the second part is factorized using binary tree technique.
+//
+// 3. Main path: 1/8 <= |x| < 6.53
+//
+//    Multiprecision have to be performed only for first few
+//    polynomial iterations (up to 3-rd x degree)
+//    Here we use the same parallelisation way as above:
+//    Split whole polynomial to first, "multiprecision" part, and second, 
+//    so called "tail", native precision part.
+//
+//    1) Multiprecision part:  
+//    [v1=(A0H+A0L)+y*(A1H+A1L)] + [v2=y^2*((A2H+A2L)+y*A3)]
+//    v1 and v2 terms calculated in parallel
+//
+//    2) Tail part:
+//    v3 = x^4 * ( A4 + x*A5 + ... + x^21*A25 )
+//    v3 is splitted to 2 even parts (10 coefficient in each one).
+//    These 2 parts are also factorized using binary tree technique.
+//    
+//    So Multiprecision and Tail parts cost is almost the same
+//    and we have both results ready before final summation.
+//
+// 4. Saturation path: 6.53 <= |x| < +INF 
+//
+//    We use formula sign(x)*(1.0 - tiny_value) instead of simple sign(x)*1.0
+//    just to meet IEEE requirements for different rounding modes in this case.
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8 - input & output
+// f32 -> f90
+
+// General registers used:  
+// r2, r3, r32 -> r52 
+
+// Predicate registers used:
+// p0, p6 -> p11, p14, p15
+
+// p6  - arg is zero, denormal or special IEEE
+// p7  - arg is in [4;8] binary interval
+// p8  - arg is in [3.25;4] interval
+// p9  - arg < 1/8
+// p10 - arg is NOT in [3.25;4] interval
+// p11 - arg in saturation domain
+// p14 - arg is positive
+// p15 - arg is negative
+
+// Assembly macros
+//==============================================================
+rDataPtr           = r2
+rTailDataPtr       = r3
+
+rBias              = r33
+rSignBit           = r34
+rInterval          = r35
+
+rArgExp            = r36
+rArgSig            = r37
+r3p25Offset        = r38
+r2to4              = r39
+r1p25              = r40
+rOffset            = r41
+r1p5               = r42
+rSaturation        = r43
+r3p25Sign          = r44
+rTiny              = r45
+rAddr1             = r46
+rAddr2             = r47
+rTailAddr1         = r48
+rTailAddr2         = r49
+rTailOffset        = r50
+rTailAddOffset     = r51
+rShiftedDataPtr    = r52
+
+//==============================================================
+fA0H               = f32
+fA0L               = f33
+fA1H               = f34
+fA1L               = f35
+fA2H               = f36
+fA2L               = f37
+fA3                = f38
+fA4                = f39
+fA5                = f40
+fA6                = f41
+fA7                = f42
+fA8                = f43
+fA9                = f44
+fA10               = f45
+fA11               = f46
+fA12               = f47
+fA13               = f48
+fA14               = f49
+fA15               = f50
+fA16               = f51
+fA17               = f52
+fA18               = f53
+fA19               = f54
+fA20               = f55 
+fA21               = f56 
+fA22               = f57 
+fA23               = f58
+fA24               = f59
+fA25               = f60
+
+fArgSqr            = f61
+fArgCube           = f62
+fArgFour           = f63
+fArgEight          = f64
+
+fArgAbsNorm        = f65
+fArgAbsNorm2       = f66
+fArgAbsNorm2L      = f67
+fArgAbsNorm3       = f68
+fArgAbsNorm4       = f69
+fArgAbsNorm11      = f70
+
+fRes               = f71
+fResH              = f72
+fResL              = f73
+fRes1H             = f74
+fRes1L             = f75
+fRes1Hd            = f76
+fRes2H             = f77
+fRes2L             = f78
+fRes3H             = f79
+fRes3L             = f80
+fRes4              = f81
+
+fTT                = f82 
+fTH                = f83
+fTL                = f84
+fTT2               = f85 
+fTH2               = f86
+fTL2               = f87
+
+f1p5               = f88
+f2p0               = f89
+fTiny              = f90
+
+
+// Data tables
+//==============================================================
+RODATA
+
+.align 64
+LOCAL_OBJECT_START(erfl_data)
+////////// Main tables ///////////
+_0p125_to_0p25_data: // exp = 2^-3
+// Polynomial coefficients for the erf(x), 1/8 <= |x| < 1/4 
+data8 0xACD9ED470F0BB048, 0x0000BFF4 //A3 = -6.5937529303909561891162915809e-04
+data8 0xBF6A254428DDB452 //A2H = -3.1915980570631852578089571182e-03
+data8 0xBC131B3BE3AC5079 //A2L = -2.5893976889070198978842231134e-19
+data8 0x3FC16E2D7093CD8C //A1H = 1.3617485043469590433318217038e-01
+data8 0x3C6979A52F906B4C //A1L = 1.1048096806003284897639351952e-17
+data8 0x3FCAC45E37FE2526 //A0H = 2.0911767705937583938791135552e-01
+data8 0x3C648D48536C61E3 //A0L = 8.9129592834861155344147026365e-18
+data8 0xD1FC135B4A30E746, 0x00003F90 //A25 = 6.3189963203954877364460345654e-34
+data8 0xB1C79B06DD8C988C, 0x00003F97 //A24 = 6.8478253118093953461840838106e-32
+data8 0xCC7AE121D1DEDA30, 0x0000BF9A //A23 = -6.3010264109146390803803408666e-31
+data8 0x8927B8841D1E0CA8, 0x0000BFA1 //A22 = -5.4098171537601308358556861717e-29
+data8 0xB4E84D6D0C8F3515, 0x00003FA4 //A21 = 5.7084320046554628404861183887e-28
+data8 0xC190EAE69A67959A, 0x00003FAA //A20 = 3.9090359419467121266470910523e-26
+data8 0x90122425D312F680, 0x0000BFAE //A19 = -4.6551806872355374409398000522e-25
+data8 0xF8456C9C747138D6, 0x0000BFB3 //A18 = -2.5670639225386507569611436435e-23
+data8 0xCDCAE0B3C6F65A3A, 0x00003FB7 //A17 = 3.4045511783329546779285646369e-22
+data8 0x8F41909107C62DCC, 0x00003FBD //A16 = 1.5167830861896169812375771948e-20
+data8 0x82F0FCB8A4B8C0A3, 0x0000BFC1 //A15 = -2.2182328575376704666050112195e-19
+data8 0x92E992C58B7C3847, 0x0000BFC6 //A14 = -7.9641369349930600223371163611e-18
+LOCAL_OBJECT_END(erfl_data)
+
+LOCAL_OBJECT_START(_0p25_to_0p5_data)
+// Polynomial coefficients for the erf(x), 1/4 <= |x| < 1/2 
+data8 0xF083628E8F7CE71D, 0x0000BFF6 //A3 = -3.6699405305266733332335619531e-03
+data8 0xBF978749A434FE4E //A2H = -2.2977018973732214746075186440e-02
+data8 0xBC30B3FAFBC21107 //A2L = -9.0547407100537663337591537643e-19
+data8 0x3FCF5F0CDAF15313 //A1H = 2.4508820238647696654332719390e-01
+data8 0x3C1DFF29F5AD8117 //A1L = 4.0653155218104625249413579084e-19
+data8 0x3FD9DD0D2B721F38 //A0H = 4.0411690943482225790717166092e-01
+data8 0x3C874C71FEF1759E //A0L = 4.0416653425001310671815863946e-17
+data8 0xA621D99B8C12595E, 0x0000BFAB //A25 = -6.7100271986703749013021666304e-26
+data8 0xBD7BBACB439992E5, 0x00003FAE //A24 = 6.1225362452814749024566661525e-25
+data8 0xFF2FEFF03A98E410, 0x00003FB2 //A23 = 1.3192871864994282747963195183e-23
+data8 0xAE8180957ABE6FD5, 0x0000BFB6 //A22 = -1.4434787102181180110707433640e-22
+data8 0xAF0566617B453AA6, 0x0000BFBA //A21 = -2.3163848847252215762970075142e-21
+data8 0x8F33D3616B9B8257, 0x00003FBE //A20 = 3.0324297082969526400202995913e-20
+data8 0xD58AB73354438856, 0x00003FC1 //A19 = 3.6175397854863872232142412590e-19
+data8 0xD214550E2F3210DF, 0x0000BFC5 //A18 = -5.6942141660091333278722310354e-18
+data8 0xE2CA60C328F3BBF5, 0x0000BFC8 //A17 = -4.9177359011428870333915211291e-17
+data8 0x88D9BB274F9B3873, 0x00003FCD //A16 = 9.4959118337089189766177270051e-16
+data8 0xCA4A00AB538A2DB2, 0x00003FCF //A15 = 5.6146496538690657993449251855e-15
+data8 0x9CC8FFFBDDCF9853, 0x0000BFD4 //A14 = -1.3925319209173383944263942226e-13
+LOCAL_OBJECT_END(_0p25_to_0p5_data)
+
+LOCAL_OBJECT_START(_0p5_to_1_data)
+// Polynomial coefficients for the erf(x), 1/2 <= |x| < 1 
+data8 0xDB742C8FB372DBE0, 0x00003FF6 //A3 = 3.3485993187250381721535255963e-03
+data8 0xBFBEDC5644353C26 //A2H = -1.2054957547410136142751468924e-01
+data8 0xBC6D7215B023455F //A2L = -1.2770012232203569059818773287e-17
+data8 0x3FD492E42D78D2C4 //A1H = 3.2146553459760363047337250464e-01
+data8 0x3C83A163CAC22E05 //A1L = 3.4053365952542489137756724868e-17
+data8 0x3FE6C1C9759D0E5F //A0H = 7.1115563365351508462453011816e-01
+data8 0x3C8B1432F2CBC455 //A0L = 4.6974407716428899960674098333e-17
+data8 0x95A6B92162813FF8, 0x00003FC3 //A25 = 1.0140763985766801318711038400e-18
+data8 0xFE5EC3217F457B83, 0x0000BFC6 //A24 = -1.3789434273280972156856405853e-17
+data8 0x9B49651031B5310B, 0x0000BFC8 //A23 = -3.3672435142472427475576375889e-17
+data8 0xDBF73927E19B7C8D, 0x00003FCC //A22 = 7.6315938248752024965922341872e-16
+data8 0xF55CBA3052730592, 0x00003FCB //A21 = 4.2563559623888750271176552350e-16
+data8 0xA1DC9380DA82CFF6, 0x0000BFD2 //A20 = -3.5940500736023122607663701015e-14
+data8 0xAAD1AE1067F3D577, 0x00003FD2 //A19 = 3.7929451192558641569555227613e-14
+data8 0xCD1DB83F3B9D2090, 0x00003FD7 //A18 = 1.4574374961011929143375716362e-12
+data8 0x87235ACB5E8BB298, 0x0000BFD9 //A17 = -3.8408559294899660346666452560e-12
+data8 0xDA417B78FF9F46B4, 0x0000BFDC //A16 = -4.9625621225715971268115023451e-11
+data8 0xF075762685484436, 0x00003FDE //A15 = 2.1869603559309150844390066920e-10
+data8 0xB989FDB3795165C7, 0x00003FE1 //A14 = 1.3499740992928183247608593000e-09
+LOCAL_OBJECT_END(_0p5_to_1_data)
+
+LOCAL_OBJECT_START(_1_to_2_data)
+// Polynomial coefficients for the erf(x), 1 <= |x| < 2.0 
+data8 0x8E15015F5B55BEAC, 0x00003FFC //A3 = 1.3875200409423426678618977531e-01
+data8 0xBFC6D5A95D0A1B7E //A2H = -1.7839543383544403942764233761e-01
+data8 0xBC7499F704C80E02 //A2L = -1.7868888188464394090788198634e-17
+data8 0x3FBE723726B824A8 //A1H = 1.1893028922362935961842822508e-01
+data8 0x3C6B77F399C2AD27 //A1L = 1.1912589318015368492508652194e-17
+data8 0x3FEEEA5557137ADF //A0H = 9.6610514647531064991170524081e-01
+data8 0x3C963D0DDD0A762F //A0L = 7.7155271023949055047261953350e-17
+data8 0x8FAA405DAD409771, 0x0000BFDB //A25 = -1.6332824616946528652252813763e-11
+data8 0x941386F4697976D8, 0x0000BFDD //A24 = -6.7337295147729213955410252613e-11
+data8 0xBCBE75234530B404, 0x00003FDF //A23 = 3.4332329029092304943838374908e-10
+data8 0xF55E2CE71A00D040, 0x00003FDF //A22 = 4.4632156034175937694868068394e-10
+data8 0xA6CADFE489D2671F, 0x0000BFE3 //A21 = -4.8543000253822277507724949798e-09
+data8 0xA4C69F11FEAFB3A8, 0x00003FE2 //A20 = 2.3978044150868471771557059958e-09
+data8 0xD63441E3BED59703, 0x00003FE6 //A19 = 4.9873285553412397317802071288e-08
+data8 0xDFDAED9D3089D732, 0x0000BFE7 //A18 = -1.0424069510877052249228047044e-07
+data8 0xB47287FF165756A5, 0x0000BFE9 //A17 = -3.3610945128073834488448164164e-07
+data8 0xCDAF2DC0A79A9059, 0x00003FEB //A16 = 1.5324673941628851136481785187e-06
+data8 0x9FD6A7B2ECE8EDA9, 0x00003FEA //A15 = 5.9544479989469083598476592569e-07
+data8 0xEC6E63BB4507B585, 0x0000BFEE //A14 = -1.4092398243085031882423746824e-05
+LOCAL_OBJECT_END(_1_to_2_data)
+
+LOCAL_OBJECT_START(_2_to_3p25_data)
+// Polynomial coefficients for the erf(x), 2 <= |x| < 3.25 
+data8 0xCEDBA58E8EE6F055, 0x00003FF7 //A3 = 6.3128050215859026984338771121e-03
+data8 0xBF5B60D5E974CBBD //A2H = -1.6710366233609740427984435840e-03
+data8 0xBC0E11E2AEC18AF6 //A2L = -2.0376133202996259839305825162e-19
+data8 0x3F32408E9BA3327E //A1H = 2.7850610389349567379974059733e-04
+data8 0x3BE41010E4B3B224 //A1L = 3.3987633691879253781833531576e-20
+data8 0x3FEFFFD1AC4135F9 //A0H = 9.9997790950300136092465663751e-01
+data8 0x3C8EEAFA1E97EAE0 //A0L = 5.3633970564750967956196033852e-17
+data8 0xBF9C6F2C6D7263C1, 0x00003FF0 //A25 = 4.5683639377039166585098497471e-05
+data8 0xCB4167CC4798096D, 0x00003FF0 //A24 = 4.8459885139772945417160731273e-05
+data8 0xE1394FECFE972D32, 0x0000BFF2 //A23 = -2.1479022581129892562916533804e-04
+data8 0xC7F9E47581FC2A5F, 0x0000BFF2 //A22 = -1.9071211076537531370822343363e-04
+data8 0xDD612EDFAA41BEAE, 0x00003FF2 //A21 = 2.1112405918671957390188348542e-04
+data8 0x8C166AA4CB2AD8FD, 0x0000BFF4 //A20 = -5.3439165021555312536009227942e-04
+data8 0xEFBE33D9F62B68D4, 0x0000BFF2 //A19 = -2.2863672131516067770956697877e-04
+data8 0xCCB92F5D91562494, 0x00003FF5 //A18 = 1.5619154280865226092321881421e-03
+data8 0x80A5DBE71D4BA0E2, 0x0000BFF6 //A17 = -1.9630109664962540123775799179e-03
+data8 0xA0ADEB2D4C41347A, 0x0000BFF4 //A16 = -6.1294315248639348947483422457e-04
+data8 0xB1F5D4911B911665, 0x00003FF7 //A15 = 5.4309165882071876864550213817e-03
+data8 0xF2F3D8D21E8762E0, 0x0000BFF7 //A14 = -7.4143227286535936033409745884e-03
+LOCAL_OBJECT_END(_2_to_3p25_data)
+
+LOCAL_OBJECT_START(_4_to_6p53_data)
+// Polynomial coefficients for the erf(x), 4 <= |x| < 6.53 
+data8 0xDF3151BE8652827E, 0x00003FD5 //A3 = 3.9646979666953349095427642209e-13
+data8 0xBD1C4A9787DF888B //A2H = -2.5127788450714750484839908889e-14
+data8 0xB99B35483E4603FD //A2L = -3.3536613901268985626466020210e-31
+data8 0x3CD2DBF507F1A1F3 //A1H = 1.0468963266736687758710258897e-15
+data8 0x398A97B60913B4BD //A1L = 1.6388968267515149775818013207e-31
+data8 0x3FEFFFFFFFFFFFFF //A0H = 9.9999999999999988897769753748e-01
+data8 0x3C99CC25E658129E //A0L = 8.9502895736398715695745861054e-17
+data8 0xB367B21294713D39, 0x00003FFB //A25 = 8.7600127403270828432337605471e-02
+data8 0xCEE3A423ADEC0F4C, 0x00003FFD //A24 = 4.0408051429309221404807497715e-01
+data8 0xC389626CF2D727C0, 0x00003FFE //A23 = 7.6381507072332210580356159947e-01
+data8 0xD15A03E082D0A307, 0x00003FFE //A22 = 8.1777977210259904277239787430e-01
+data8 0x8FD3DA92675E8E00, 0x00003FFE //A21 = 5.6182638239203638864793584264e-01
+data8 0xFD375E6EE167AA58, 0x00003FFC //A20 = 2.4728152801285544751731937424e-01
+data8 0x89A9482FADE66AE1, 0x00003FFB //A19 = 6.7217410998398471333985773237e-02
+data8 0xC62E1F02606C04DD, 0x00003FF7 //A18 = 6.0479785358923404401184993359e-03
+data8 0xEE7BF2BE71CC531C, 0x0000BFF5 //A17 = -1.8194898432032114199803271708e-03
+data8 0x8084081981CDC79C, 0x0000BFF5 //A16 = -9.8049734947701208487713246099e-04
+data8 0x8975DFB834C118C3, 0x0000BFF0 //A15 = -3.2773123965143773578608926094e-05
+data8 0x965DA4A80008B7BC, 0x0000BFEE //A14 = -8.9624997201558650125662820562e-06
+LOCAL_OBJECT_END(_4_to_6p53_data)
+
+LOCAL_OBJECT_START(_3p25_to_4_data)
+// Polynomial coefficients for the erf(x), 3.25 <= |x| < 4 
+data8 0xB01D29846286CE08, 0x00003FEE //A3 = 1.0497207328743021499800978059e-05
+data8 0xBEC10B1488AEB234 //A2H = -2.0317175474986489113480084279e-06
+data8 0xBB7F19701B8B74F9 //A2L = -4.1159669348226960337518214996e-22
+data8 0x3E910B1488AEB234 //A1H = 2.5396469343733111391850105348e-07
+data8 0x3B4F1944906D5D60 //A1L = 5.1448487494628801547474934193e-23
+data8 0x3FEFFFFFF7B91176 //A0H = 9.9999998458274208523732795584e-01
+data8 0x3C70B2865615DB3F //A0L = 1.4482653192002495179309994964e-17
+data8 0xA818D085D56F3021, 0x00003FEC //A25 = 2.5048394770210505593609705765e-06
+data8 0xD9C5C509AAE5561F, 0x00003FEC //A24 = 3.2450636894654766492719395406e-06
+data8 0x9682D71C549EEB07, 0x0000BFED //A23 = -4.4855801709974050650263470866e-06
+data8 0xBC230E1EB6FBF8B9, 0x00003FEA //A22 = 7.0086469577174843181452303996e-07
+data8 0xE1432649FF29D4DE, 0x0000BFEA //A21 = -8.3916747195472308725504497231e-07
+data8 0xB40CEEBD2803D2F0, 0x0000BFEF //A20 = -2.1463694318102769992677291330e-05
+data8 0xEAAB57ABFFA003EB, 0x00003FEF //A19 = 2.7974761309213643228699449426e-05
+data8 0xFBFA4D0B893A5BFB, 0x0000BFEE //A18 = -1.5019043571612821858165073446e-05
+data8 0xBB6AA248EED3E364, 0x0000BFF0 //A17 = -4.4683584873907316507141131797e-05
+data8 0x86C1B3AE3E500ED9, 0x00003FF2 //A16 = 1.2851395412345761361068234880e-04
+data8 0xB60729445F0C37B5, 0x0000BFF2 //A15 = -1.7359540313300841352152461287e-04
+data8 0xCA389F9E707337B1, 0x00003FF1 //A14 = 9.6426575465763394281615740282e-05
+LOCAL_OBJECT_END(_3p25_to_4_data)
+
+
+//////// "Tail" tables //////////
+LOCAL_OBJECT_START(_0p125_to_0p25_data_tail)
+// Polynomial coefficients for the erf(x), 1/8 <= |x| < 1/4 
+data8 0x93086CBD21ED3962, 0x00003FCA //A13 = 1.2753071968462837024755878679e-16
+data8 0x83CB5045A6D4B419, 0x00003FCF //A12 = 3.6580237062957773626379648530e-15
+data8 0x8FCDB723209690EB, 0x0000BFD3 //A11 = -6.3861616307180801527566117146e-14
+data8 0xCAA173F680B5D56B, 0x0000BFD7 //A10 = -1.4397775466324880354578008779e-12
+data8 0xF0CEA934AD6AC013, 0x00003FDB //A9 = 2.7376616955640415767655526857e-11
+data8 0x81C69F9D0B5AB8EE, 0x00003FE0 //A8 = 4.7212187567505249115688961488e-10
+data8 0xA8B590298C20A194, 0x0000BFE4 //A7 = -9.8201697105565925460801441797e-09
+data8 0x84F3DE72AC964615, 0x0000BFE8 //A6 = -1.2382176987480830706988411266e-07
+data8 0xC01A1398868CC4BD, 0x00003FEC //A5 = 2.8625408039722670291121341583e-06
+data8 0xCC43247F4410C54A, 0x00003FEF //A4 = 2.4349960762505993017186935493e-05
+LOCAL_OBJECT_END(_0p125_to_0p25_data_tail)
+
+LOCAL_OBJECT_START(_0p25_to_0p5_data_tail)
+// Polynomial coefficients for the erf(x), 1/4 <= |x| < 1/2 
+data8 0x8CEAC59AF361B78A, 0x0000BFD6 //A13 = -5.0063802958258679384986669123e-13
+data8 0x9BC67404F348C0CE, 0x00003FDB //A12 = 1.7709590771868743572061278273e-11
+data8 0xF4B5D0348AFAAC7A, 0x00003FDB //A11 = 2.7820329729584630464848160970e-11
+data8 0x83AB447FF619DA4A, 0x0000BFE2 //A10 = -1.9160363295631539615395477207e-09
+data8 0x82115AB487202E7B, 0x00003FE0 //A9 = 4.7318386460142606822119637959e-10
+data8 0xB84D5B0AE17054AA, 0x00003FE8 //A8 = 1.7164477188916895004843908951e-07
+data8 0xB2E085C1C4AA06E5, 0x0000BFE9 //A7 = -3.3318445266863554512523957574e-07
+data8 0xCD3CA2E6C3971666, 0x0000BFEE //A6 = -1.2233070175554502732980949519e-05
+data8 0xBA445C53F8DD40E6, 0x00003FF0 //A5 = 4.4409521535330413551781808621e-05
+data8 0xAA94D5E68033B764, 0x00003FF4 //A4 = 6.5071635765452563856926608000e-04
+LOCAL_OBJECT_END(_0p25_to_0p5_data_tail)
+
+LOCAL_OBJECT_START(_0p5_to_1_data_tail)
+// Polynomial coefficients for the erf(x), 1/2 <= |x| < 1 
+data8 0x9ED99EDF111CB785, 0x0000BFE4 //A13 = -9.2462916180079278241704711522e-09
+data8 0xDEAF7539AE2FB062, 0x0000BFE5 //A12 = -2.5923990465973151101298441139e-08
+data8 0xA392D5E5CC9DB1A7, 0x00003FE9 //A11 = 3.0467952847327075747032372101e-07
+data8 0xC311A7619B96CA1A, 0x00003FE8 //A10 = 1.8167212632079596881709988649e-07
+data8 0x82082E6B6A93F116, 0x0000BFEE //A9 = -7.7505086843257228386931766018e-06
+data8 0x96D9997CF326A36D, 0x00003FEE //A8 = 8.9913605625817479172071008270e-06
+data8 0x97057D85DCB0ED99, 0x00003FF2 //A7 = 1.4402527482741758767786898553e-04
+data8 0xDC23BCB3599C0490, 0x0000BFF3 //A6 = -4.1988296144950673955519083419e-04
+data8 0xDA150C4867208A81, 0x0000BFF5 //A5 = -1.6638352864915033417887831090e-03
+data8 0x9A4DAF550A2CC29A, 0x00003FF8 //A4 = 9.4179355839141698591817907680e-03
+LOCAL_OBJECT_END(_0p5_to_1_data_tail)
+
+LOCAL_OBJECT_START(_1_to_2_data_tail)
+// Polynomial coefficients for the erf(x), 1 <= |x| < 2.0 
+data8 0x969EAC5C7B46CAB9, 0x00003FEF //A13 = 1.7955281439310148162059582795e-05
+data8 0xA2ED832912E9FCD9, 0x00003FF1 //A12 = 7.7690020847111408916570845775e-05
+data8 0x85677C39C48E43E7, 0x0000BFF3 //A11 = -2.5444839340796031538582511806e-04
+data8 0xC2DAFA91683DAAE4, 0x0000BFF1 //A10 = -9.2914288456063075386925076097e-05
+data8 0xE01C061CBC6A2825, 0x00003FF5 //A9 = 1.7098195515864039518892834211e-03
+data8 0x9AD7271CAFD01C78, 0x0000BFF6 //A8 = -2.3626776207372761518718893636e-03
+data8 0x9B6B9D30EDD5F4FF, 0x0000BFF7 //A7 = -4.7430532011804570628999212874e-03
+data8 0x9E51EB9623F1D446, 0x00003FF9 //A6 = 1.9326171998839772791190405201e-02
+data8 0xF391B935C12546DE, 0x0000BFF8 //A5 = -1.4866286152953671441682166195e-02
+data8 0xB6AD4AE850DBF526, 0x0000BFFA //A4 = -4.4598858458861014323191919669e-02
+LOCAL_OBJECT_END(_1_to_2_data_tail)
+
+LOCAL_OBJECT_START(_2_to_3p25_data_tail)
+// Polynomial coefficients for the erf(x), 2 <= |x| < 3.25 
+data8 0x847C24DAC7C7558B, 0x00003FF5 //A13 = 1.0107798565424606512130100541e-03
+data8 0xCB6340EAF02C3DF8, 0x00003FF8 //A12 = 1.2413800617425931997420375435e-02
+data8 0xB5163D252DBBC107, 0x0000BFF9 //A11 = -2.2105330871844825370020459523e-02
+data8 0x82FF9C0B68E331E4, 0x00003FF9 //A10 = 1.5991024756001692140897408128e-02
+data8 0xE9519E4A49752E04, 0x00003FF7 //A9 = 7.1203253651891723548763348088e-03
+data8 0x8D52F11B7AE846D9, 0x0000BFFA //A8 = -3.4502927613795425888684181521e-02
+data8 0xCCC5A3E32BC6FA30, 0x00003FFA //A7 = 4.9993171868423886228679106871e-02
+data8 0xC1791AD8284A1919, 0x0000BFFA //A6 = -4.7234635220336795411997070641e-02
+data8 0x853DAAA35A8A3C18, 0x00003FFA //A5 = 3.2529512934760303976755163452e-02
+data8 0x88E42D8F47FAB60E, 0x0000BFF9 //A4 = -1.6710366233609742619461063050e-02
+LOCAL_OBJECT_END(_2_to_3p25_data_tail)
+
+LOCAL_OBJECT_START(_4_to_6p53_data_tail)
+// Polynomial coefficients for the erf(x), 4 <= |x| < 6.53 
+data8 0xD8235ABF08B8A6D1, 0x00003FEE //A13 = 1.2882834877224764938429832586e-05
+data8 0xAEDF44F9C77844C2, 0x0000BFEC //A12 = -2.6057980393716019511497492890e-06
+data8 0xCCD5490956A4FCFD, 0x00003FEA //A11 = 7.6306293047300300284923464089e-07
+data8 0xF71AF0126EE26AEA, 0x0000BFE8 //A10 = -2.3013467500738417953513680935e-07
+data8 0xE4CE68089858AC20, 0x00003FE6 //A9 = 5.3273112263151109935867439775e-08
+data8 0xBD15106FBBAEE593, 0x0000BFE4 //A8 = -1.1006037358336556244645388790e-08
+data8 0x8BBF9A5769B6E480, 0x00003FE2 //A7 = 2.0336075804332107927300019116e-09
+data8 0xB049D845D105E302, 0x0000BFDF //A6 = -3.2066683399502826067820249320e-10
+data8 0xBAC69B3F0DFE5483, 0x00003FDC //A5 = 4.2467901578369360007795282687e-11
+data8 0xA29C398F83F8A0D1, 0x0000BFD9 //A4 = -4.6216613698438694005327544047e-12
+LOCAL_OBJECT_END(_4_to_6p53_data_tail)
+
+LOCAL_OBJECT_START(_3p25_to_4_data_tail)
+// Polynomial coefficients for the erf(x), 3.25 <= |x| < 4 
+data8 0x95BE1BEAD738160F, 0x00003FF2 //A13 = 1.4280568455209843005829620687e-04
+data8 0x8108C8FFAC0F0B21, 0x0000BFF4 //A12 = -4.9222685622046459346377033307e-04
+data8 0xD72A7FAEE7832BBE, 0x00003FF4 //A11 = 8.2079319302109644436194651098e-04
+data8 0x823AB4281CA7BBE7, 0x0000BFF5 //A10 = -9.9357079675971109178261577703e-04
+data8 0xFA1232D476048D11, 0x00003FF4 //A9 = 9.5394549599882496825916138915e-04
+data8 0xC463D7AF88025FB2, 0x0000BFF4 //A8 = -7.4916843357898101689031755368e-04
+data8 0xFEBE32B6B379D072, 0x00003FF3 //A7 = 4.8588363901002111193445057206e-04
+data8 0x882829BB68409BF3, 0x0000BFF3 //A6 = -2.5969865184916169002074135516e-04
+data8 0xED2F886E29DAAB09, 0x00003FF1 //A5 = 1.1309894347742479284610149994e-04
+data8 0xA4C07129436555B2, 0x0000BFF0 //A4 = -3.9279872584973887163830479579e-05
+LOCAL_OBJECT_END(_3p25_to_4_data_tail)
+
+
+LOCAL_OBJECT_START(_0_to_1o8_data)
+// Polynomial coefficients for the erf(x), 0.0 <= |x| < 0.125 
+data8 0x3FF20DD750429B6D, 0x3C71AE3A8DDFFEDE //A1H, A1L
+data8 0xF8B0DACE42525CC2, 0x0000BFEE //A15
+data8 0xFCD02E1BF0EC2C37, 0x00003FF1 //A13
+data8 0xE016D968FE473B5E, 0x0000BFF4 //A11
+data8 0xAB2DE68711BF5A79, 0x00003FF7 //A9
+data8 0xDC16718944518309, 0x0000BFF9 //A7
+data8 0xE71790D0215F0C8F, 0x00003FFB //A5
+data8 0xC093A3581BCF3612, 0x0000BFFD //A3
+LOCAL_OBJECT_END(_0_to_1o8_data)
+
+
+LOCAL_OBJECT_START(_denorm_data)
+data8 0x3FF20DD750429B6D //A1H = 1.1283791670955125585606992900e+00
+data8 0x3C71AE3A914FED80 //A1L = 1.5335459613165880745599768129e-17
+LOCAL_OBJECT_END(_denorm_data)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(erfl)
+
+{ .mfi
+      alloc          r32         = ar.pfs, 0, 21, 0, 0 
+      fmerge.se      fArgAbsNorm = f1, f8      // normalized x (1.0 <= x < 2.0)
+      addl           rSignBit    = 0x20000, r0 // Set sign bit for exponent
+}
+{ .mlx
+      addl           rDataPtr    = @ltoff(erfl_data), gp // Get common data ptr
+      movl           r1p5        = 0x3FF8000000000000    // 1.5 in dbl repres.
+};;
+
+{ .mfi
+      getf.exp       rArgExp     = f8              // Get arg exponent
+      fclass.m       p6,p0       = f8, 0xEF // Filter 0, denormals and specials 
+                            // 0xEF = @qnan|@snan|@pos|@neg|@zero|@unorm|@inf
+      addl           rBias       = 0xfffc, r0 // Value to subtract from exp 
+                                              // to get actual interval number
+}
+{ .mfi
+      ld8            rDataPtr    = [rDataPtr]  // Get real common data pointer
+      fma.s1         fArgSqr     = f8, f8, f0  // x^2 (for [0;1/8] path)
+      addl           r2to4       = 0x10000, r0 // unbiased exponent 
+                                               // for [2;4] binary interval
+};;
+
+{ .mfi
+      getf.sig       rArgSig     = f8              // Get arg significand 
+      fcmp.lt.s1     p15, p14    = f8, f0          // Is arg negative/positive?
+      addl           rSaturation = 0xd0e, r0       // First 12 bits of
+                                                   // saturation value signif.
+}
+{ .mfi
+      setf.d         f1p5        = r1p5            // 1.5 construction 
+      fma.s1         f2p0        = f1,f1,f1        // 2.0 construction
+      addl           r3p25Sign   = 0xd00, r0       // First 12 bits of
+                                                   // 3.25 value signif.
+};;
+
+{ .mfi
+      addl           rTailDataPtr = 0x700, rDataPtr  // Pointer to "tail" data
+      nop.f          0
+      andcm          rArgExp     = rArgExp, rSignBit // Remove sign of exp
+}
+{ .mfb
+      addl           rTiny       = 0xf000, r0 // Tiny value for saturation path
+      nop.f          0
+(p6)  br.cond.spnt   erfl_spec              // Branch to zero, denorm & specs
+};;
+
+{ .mfi
+      sub            rInterval   = rArgExp, rBias // Get actual interval number
+      nop.f          0
+      shr.u          rArgSig     = rArgSig, 52    // Leave only 12 bits of sign. 
+}
+{ .mfi
+      adds           rShiftedDataPtr = 0x10, rDataPtr // Second ptr to data
+      nop.f          0
+      cmp.eq         p8, p10     = r2to4, rArgExp // If exp is in 2to4 interval?
+};;
+
+{ .mfi
+(p8)  cmp.le         p8, p10     = r3p25Sign, rArgSig // If sign. is greater 
+                            //  than 1.25? (means arg is in [3.25;4] interval)
+      nop.f          0
+      shl            rOffset     = rInterval, 8 // Make offset from 
+                                                // interval number
+}
+{ .mfi
+      cmp.gt         p9, p0      = 0x0, rInterval // If interval is less than 0
+                                                  // (means arg is in [0; 1/8])
+      nop.f          0
+      cmp.eq         p7, p0      = 0x5, rInterval // If arg is in [4:8] interv.?
+};;
+
+{ .mfi
+(p8)  adds           rOffset     = 0x200, rOffset // Add additional offset 
+                                 // if arg is in [3.25;4] (another data set)
+      fma.s1         fArgCube    = fArgSqr, f8, f0  // x^3 (for [0;1/8] path)
+      shl            rTailOffset = rInterval, 7  // Make offset to "tail" data
+                                                 // from interval number
+}
+{ .mib
+      setf.exp       fTiny       = rTiny // Construct "tiny" value 
+                                         // for saturation path
+      cmp.ltu        p11, p0     = 0x5, rInterval // if arg > 8
+(p9)  br.cond.spnt   _0_to_1o8       
+};;
+
+{ .mfi
+      add            rAddr1      = rDataPtr, rOffset // Get address for 
+                                                     // interval data 
+      nop.f          0
+      shl            rTailAddOffset = rInterval, 5 // Offset to interval
+                                                   // "tail" data 
+}
+{ .mib
+      add            rAddr2      = rShiftedDataPtr, rOffset // Get second
+                                                 // address for interval data 
+(p7)  cmp.leu        p11, p0     = rSaturation, rArgSig // if arg is 
+                                                        // in [6.53;8] interval
+(p11) br.cond.spnt   _saturation // Branch to Saturation path
+};;
+
+{ .mmi
+      ldfe           fA3         = [rAddr1], 0x90 // Load A3
+      ldfpd          fA2H, fA2L  = [rAddr2], 16 // Load A2High, A2Low
+      add            rTailOffset = rTailOffset, rTailAddOffset // "Tail" offset
+};;
+
+{ .mmi
+      ldfe           fA20        = [rAddr1], 16 // Load A20
+      ldfpd          fA1H, fA1L  = [rAddr2], 16 // Load A1High, A1Low
+(p8)  adds           rTailOffset = 0x140, rTailOffset // Additional offset
+                                                      //  for [3.24;4] interval
+};;
+
+{ .mmi
+      ldfe           fA19        = [rAddr1], 16 // Load A19
+      ldfpd          fA0H, fA0L  = [rAddr2], 16 // Load A0High, A0Low
+      add            rTailAddr1  = rTailDataPtr, rTailOffset // First tail
+                                                             // data address
+};;
+
+.pred.rel "mutex",p8,p10
+{ .mfi
+      ldfe           fA18        = [rAddr1], 16 // Load A18
+(p8)  fms.s1         fArgAbsNorm = fArgAbsNorm, f1, f2p0 // Add 2.0 
+                          // to normalized arg (for [3.24;4] interval)
+      adds           rTailAddr2  = 0x10, rTailAddr1  // First tail
+                                                     // data address
+}
+{ .mfi
+      ldfe           fA25        = [rAddr2], 16 // Load A25 
+(p10) fms.s1         fArgAbsNorm = fArgAbsNorm, f1, f1p5  // Add 1.5 
+                                                // to normalized arg
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA17        = [rAddr1], 16 // Load A17
+      ldfe           fA24        = [rAddr2], 16 // Load A24
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA16        = [rAddr1], 16 // Load A16
+      ldfe           fA23        = [rAddr2], 16 // Load A23
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA15        = [rAddr1], 16 // Load A15
+      ldfe           fA22        = [rAddr2], 16 // Load A22
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA14        = [rAddr1], 16 // Load A14
+      ldfe           fA21        = [rAddr2], 16 // Load A21
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA13        = [rTailAddr1], 32              // Load A13
+      fms.s1         fArgAbsNorm2 = fArgAbsNorm, fArgAbsNorm, f0 // x^2
+      nop.i          0
+}
+{ .mfi
+      ldfe           fA12        = [rTailAddr2], 32 // Load A12
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA11        = [rTailAddr1], 32       // Load A11
+      fma.s1         fRes3H      = fA3, fArgAbsNorm, fA2H // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi
+      ldfe           fA10        = [rTailAddr2], 32     // Load A10
+      fma.s1         fTH         = fA3, fArgAbsNorm, f0 // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA9         = [rTailAddr1], 32 // Load A9
+      fma.s1         fTT2        = fA1L, fArgAbsNorm, f0 // A1*x+A0
+      nop.i          0
+}
+{ .mfi
+      ldfe           fA8         = [rTailAddr2], 32 // Load A8
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA7         = [rTailAddr1], 32 // Load A7
+      ldfe           fA6         = [rTailAddr2], 32 // Load A6
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA5         = [rTailAddr1], 32 // Load A5
+      ldfe           fA4         = [rTailAddr2], 32 // Load A4
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm2L = fArgAbsNorm, fArgAbsNorm, fArgAbsNorm2
+                                                    // Low part of x^2 (delta)
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm4  = fArgAbsNorm2, fArgAbsNorm2, f0 // x^4
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fRes3L      = fA2H, f1, fRes3H // // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm3 = fArgAbsNorm2, fArgAbsNorm, f0 // x^3
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fTH2        = fA1H, fArgAbsNorm, fTT2 // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA23        = fA24,  fArgAbsNorm, fA23 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA21        = fA22,  fArgAbsNorm, fA21 // Polynomial tail 
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA12        = fA13,  fArgAbsNorm, fA12 // Polynomial tail
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes3L      = fRes3L, f1, fTH // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA19        = fA20,  fArgAbsNorm, fA19 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1H      = fTH2, f1, fA0H // A1*x+A0
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fTL2        = fA1H, fArgAbsNorm, fTH2 // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA8         = fA9,  fArgAbsNorm, fA8 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA10        = fA11,  fArgAbsNorm, fA10 // Polynomial tail
+      nop.i          0
+};;
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA16,  fArgAbsNorm, fA15 // Polynomial tail
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA17        = fA18,  fArgAbsNorm, fA17 // Polynomial tail
+      nop.i          0
+};;
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm11 = fArgAbsNorm4, fArgAbsNorm4, f0 // x^8
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA4         = fA5,  fArgAbsNorm, fA4 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes3L      = fRes3L, f1, fA2L // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA6         = fA7,  fArgAbsNorm, fA6 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTL2        = fTL2, f1, fTT2 // A1*x+A0
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1L      = fA0H, f1, fRes1H // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA23        = fA25,  fArgAbsNorm2, fA23 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA12        = fA14,  fArgAbsNorm2, fA12 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA19        = fA21,  fArgAbsNorm2, fA19  // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA8         = fA10,  fArgAbsNorm2, fA8 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA17,  fArgAbsNorm2, fA15 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fArgAbsNorm11 = fArgAbsNorm11, fArgAbsNorm3, f0 // x^11
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTT         = fRes3L, fArgAbsNorm2, f0 // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA4         = fA6,  fArgAbsNorm2, fA4 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes1L, f1, fTH2 // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA19        = fA23,  fArgAbsNorm4, fA19 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA8         = fA12,  fArgAbsNorm4, fA8 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTT         = fRes3H, fArgAbsNorm2L, fTT // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes1L, f1, fTL2 // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA19,  fArgAbsNorm4, fA15 // Polynomial tail
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA4         = fA8,  fArgAbsNorm4, fA4 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes2H      = fRes3H, fArgAbsNorm2, fTT // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes1L, f1, fA0L // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes4       = fA15, fArgAbsNorm11, fA4 // Result of 
+                                                      // polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fRes2L      = fRes3H, fArgAbsNorm2, fRes2H // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fResH       = fRes2H, f1, fRes1H // High result
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes4, fArgAbsNorm4, fRes1L // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fRes2L      = fRes2L, f1, fTT // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fResL       = fRes1H, f1, fResH // Low result
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes1L, f1, fRes2L // Low result
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fResL       = fResL, f1, fRes2H // Low result
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+(p15) fneg           fResH       = fResH // Invert high result if arg is neg.
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fResL       = fResL, f1, fRes1L // Low result
+      nop.i          0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m          0
+(p14) fma.s0         f8          = fResH, f1, fResL // Add high and low results
+      nop.i          0
+}
+{ .mfb 
+      nop.m          0
+(p15) fms.s0         f8          = fResH, f1, fResL // Add high and low results
+      br.ret.sptk    b0          // Main path return
+};;
+
+//  satiration path ////////////////////////////////////////////////////////////
+_saturation:
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m          0
+(p14) fms.s0            f8          = f1, f1, fTiny // Saturation result r = 1-tiny
+      nop.i 0
+};;
+{ .mfb 
+      nop.m          0
+(p15) fnma.s0           f8          = f1, f1, fTiny // Saturation result r = tiny-1
+      br.ret.sptk    b0         // Saturation path return
+};;
+
+
+//  0, denormals and special IEEE numbers path /////////////////////////////////
+erfl_spec:
+
+{ .mfi 
+      addl           rDataPtr    = 0xBE0, rDataPtr // Ptr to denormals coeffs
+      fclass.m       p6,p0       = f8, 0x23 // To filter infinities
+                                          // 0x23 = @pos|@neg|@inf 
+      nop.i          0
+};;
+
+{ .mfi 
+      ldfpd          fA1H, fA1L  = [rDataPtr] // Load denormals coeffs A1H, A1L
+      fclass.m       p7,p0       = f8, 0xC7 // To filter NaNs & Zeros
+                                 // 0xC7 = @pos|@neg|@zero|@qnan|@snan
+      nop.i          0
+};;
+
+{ .mfb 
+      nop.m          0
+(p6)  fmerge.s       f8          = f8, f1     // +/-1 for INF args 
+(p6)  br.ret.spnt    b0                       // exit for x = INF
+};;
+
+{ .mfb 
+      nop.m          0
+(p7)  fma.s0         f8          = f8, f1, f8    // +/-0 for 0 args 
+                                                 // and NaNs for NaNs
+(p7)  br.ret.spnt    b0                          // exit for x = NaN or +/-0
+};;
+
+{ .mfi 
+      nop.m          0
+      fnorm.s0       f8          = f8            // Normalize arg
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1H      = f8, fA1H, f0   // HighRes
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1L      = f8, fA1L, f0   // LowRes
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1Hd     = f8, fA1H, fRes1H // HighRes delta
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fRes        = fRes1L, f1,  fRes1Hd // LowRes+HighRes delta
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fRes        = f8, f8, fRes // r=x^2+r
+      nop.i          0
+};;
+
+{ .mfb 
+      nop.m          0
+      fma.s0         f8          = fRes, f1, fRes1H  // res = r+ResHigh
+      br.ret.sptk    b0          // 0, denormals, specials return
+};;
+
+
+//  0 < |x| < 1/8 path /////////////////////////////////////////////////////////
+_0_to_1o8:
+
+{ .mmi 
+      adds           rAddr1      = 0xB60, rDataPtr // Ptr 1 to coeffs
+      adds           rAddr2      = 0xB80, rDataPtr // Ptr 2 to coeffs
+      nop.i          0
+};;
+
+{ .mmi 
+      ldfpd          fA1H, fA1L  = [rAddr1], 16 // Load A1High, A1Low
+      ldfe           fA13        = [rAddr2], 16 // Load A13
+      nop.i          0
+};;
+
+{ .mmi 
+      ldfe           fA15        = [rAddr1], 48 // Load A15
+      ldfe           fA11        = [rAddr2], 32 // Load A11
+      nop.i          0
+};;
+
+{ .mmi 
+      ldfe           fA9         = [rAddr1], 32 // Load A9
+      ldfe           fA7         = [rAddr2], 32 // Load A7
+      nop.i          0
+};;
+
+{ .mmi 
+      ldfe           fA5         = [rAddr1]  // Load A5
+      ldfe           fA3         = [rAddr2] // Load A3
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1H      = f8, fA1H, f0 // x*(A1H+A1L)
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1L      = f8, fA1L, f0 // x*(A1H+A1L)
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fA11        = fA13, fArgSqr, fA11 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fArgFour    = fArgSqr, fArgSqr, f0 // a^4        
+      nop.i          0
+};;
+
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fA3         = fA5, fArgSqr, fA3 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA7         = fA9, fArgSqr, fA7 // Polynomial tail
+      nop.i          0
+};;
+
+
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1Hd     = f8, fA1H, fRes1H // x*(A1H+A1L) delta
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fA11        = fA15, fArgFour, fA11 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fA3         = fA7, fArgFour, fA3 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fArgEight   = fArgFour, fArgFour, f0 // a^8
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         f8          = fRes1L, f1,  fRes1Hd // x*(A1H+A1L)
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fRes        = fA11, fArgEight, fA3 //Polynomial tail result
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         f8          = fRes, fArgCube, f8 // (Polynomial tail)*x^3
+      nop.i          0
+};;
+
+{ .mfb 
+      nop.m          0
+      fma.s0         f8          = f8, f1, fRes1H  // (Polynomial tail)*x^3 + 
+                                                   // + x*(A1H+A1L)
+      br.ret.sptk    b0          // [0;1/8] interval return
+};;
+
+    
+GLOBAL_LIBM_END(erfl)
+
+
+
diff --git a/sysdeps/ia64/fpu/s_expm1.S b/sysdeps/ia64/fpu/s_expm1.S
index 19a237990c..09a22bbbdd 100644
--- a/sysdeps/ia64/fpu/s_expm1.S
+++ b/sysdeps/ia64/fpu/s_expm1.S
@@ -1,10 +1,10 @@
 .file "exp_m1.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1694 +20,821 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
-// HISTORY
-// 2/02/00  Initial Version 
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial Version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 07/07/01 Improved speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 11/20/02 Improved speed, algorithm based on exp
+// 03/31/05 Reformatted delimiters between data tables
+
+// API
+//==============================================================
+// double expm1(double)
+
+// Overview of operation
+//==============================================================
+// 1. Inputs of Nan, Inf, Zero, NatVal handled with special paths
+//
+// 2. |x| < 2^-60
+//    Result = x, computed by x + x*x to handle appropriate flags and rounding
+//
+// 3. 2^-60 <= |x| < 2^-2
+//    Result determined by 13th order Taylor series polynomial
+//    expm1f(x) = x + Q2*x^2 + ... + Q13*x^13
+//
+// 4. x < -48.0
+//    Here we know result is essentially -1 + eps, where eps only affects
+//    rounded result.  Set I.
+//
+// 5. x >= 709.7827
+//    Result overflows.  Set I, O, and call error support
 //
-// ********************************************************************* 
-//
-// Function:   Combined exp(x) and expm1(x), where
-//                       x 
-//             exp(x) = e , for double precision x values
-//                         x
-//             expm1(x) = e  - 1  for double precision x values
-//
-// ********************************************************************* 
-//
-// Accuracy:       Within .7 ulps for 80-bit floating point values
-//                 Very accurate for double precision values
-//
-// ********************************************************************* 
-//
-// Resources Used:
-//
-//    Floating-Point Registers: f8  (Input and Return Value) 
-//                              f9,f32-f61, f99-f102 
-//
-//    General Purpose Registers: 
-//      r32-r61
-//      r62-r65 (Used to pass arguments to error handling routine)
-//                                     
-//    Predicate Registers:      p6-p15
-//
-// ********************************************************************* 
-//
-// IEEE Special Conditions:
-//
-//    Denormal  fault raised on denormal inputs  
-//    Overflow exceptions raised when appropriate for exp and expm1
-//    Underflow exceptions raised when appropriate for exp and expm1
-//    (Error Handling Routine called for overflow and Underflow)
-//    Inexact raised when appropriate by algorithm 
-//
-//    exp(inf) = inf
-//    exp(-inf) = +0
-//    exp(SNaN) = QNaN
-//    exp(QNaN) = QNaN
-//    exp(0) = 1
-//    exp(EM_special Values) = QNaN
-//    exp(inf) = inf
-//    expm1(-inf) = -1 
-//    expm1(SNaN) = QNaN
-//    expm1(QNaN) = QNaN
-//    expm1(0) = 0
-//    expm1(EM_special Values) = QNaN
-//    
-// ********************************************************************* 
-//
-// Implementation and Algorithm Notes:
-//
-//  ker_exp_64( in_FR  : X,
-//            in_GR  : Flag,
-//            in_GR  : Expo_Range
-//            out_FR : Y_hi,
-//            out_FR : Y_lo,
-//            out_FR : scale,
-//            out_PR : Safe )
-//
-// On input, X is in register format and 
-// Flag  = 0 for exp,
-// Flag  = 1 for expm1,
-//
-// On output, provided X and X_cor are real numbers, then
-//
-//   scale*(Y_hi + Y_lo)  approximates  exp(X)       if Flag is 0
-//   scale*(Y_hi + Y_lo)  approximates  exp(X)-1     if Flag is 1
-//
-// The accuracy is sufficient for a highly accurate 64 sig.
-// bit implementation.  Safe is set if there is no danger of 
-// overflow/underflow when the result is composed from scale, 
-// Y_hi and Y_lo. Thus, we can have a fast return if Safe is set. 
-// Otherwise, one must prepare to handle the possible exception 
-// appropriately.  Note that SAFE not set (false) does not mean 
-// that overflow/underflow will occur; only the setting of SAFE
-// guarantees the opposite.
-//
-// **** High Level Overview **** 
-//
-// The method consists of three cases.
-// 
-// If           |X| < Tiny	use case exp_tiny;
-// else if	|X| < 2^(-6)	use case exp_small;
-// else		use case exp_regular;
-//
-// Case exp_tiny:
-//
-//   1 + X     can be used to approximate exp(X) or exp(X+X_cor);
-//   X + X^2/2 can be used to approximate exp(X) - 1
-//
-// Case exp_small:
-//
-//   Here, exp(X), exp(X+X_cor), and exp(X) - 1 can all be 
-//   appproximated by a relatively simple polynomial.
-//
-//   This polynomial resembles the truncated Taylor series
-//
-//	exp(w) = 1 + w + w^2/2! + w^3/3! + ... + w^n/n!
-//
-// Case exp_regular:
-//
-//   Here we use a table lookup method. The basic idea is that in
-//   order to compute exp(X), we accurately decompose X into
-//
-//   X = N * log(2)/(2^12)  + r,	|r| <= log(2)/2^13.
-//
-//   Hence
-//
-//   exp(X) = 2^( N / 2^12 ) * exp(r).
-//
-//   The value 2^( N / 2^12 ) is obtained by simple combinations
-//   of values calculated beforehand and stored in table; exp(r)
-//   is approximated by a short polynomial because |r| is small.
-//
-//   We elaborate this method in 4 steps.
-//
-//   Step 1: Reduction
-//
-//   The value 2^12/log(2) is stored as a double-extended number
-//   L_Inv.
-//
-//   N := round_to_nearest_integer( X * L_Inv )
-//
-//   The value log(2)/2^12 is stored as two numbers L_hi and L_lo so
-//   that r can be computed accurately via
-//
-//   r := (X - N*L_hi) - N*L_lo
-//
-//   We pick L_hi such that N*L_hi is representable in 64 sig. bits
-//   and thus the FMA   X - N*L_hi   is error free. So r is the 
-//   1 rounding error from an exact reduction with respect to 
-//   
-//   L_hi + L_lo.
-//
-//   In particular, L_hi has 30 significant bit and can be stored
-//   as a double-precision number; L_lo has 64 significant bits and
-//   stored as a double-extended number.
-//
-//   In the case Flag = 2, we further modify r by
-//
-//   r := r + X_cor.
-//
-//   Step 2: Approximation
-//
-//   exp(r) - 1 is approximated by a short polynomial of the form
-//   
-//   r + A_1 r^2 + A_2 r^3 + A_3 r^4 .
-//
-//   Step 3: Composition from Table Values 
-//
-//   The value 2^( N / 2^12 ) can be composed from a couple of tables
-//   of precalculated values. First, express N as three integers
-//   K, M_1, and M_2 as
-//
-//     N  =  K * 2^12  + M_1 * 2^6 + M_2
-//
-//   Where 0 <= M_1, M_2 < 2^6; and K can be positive or negative.
-//   When N is represented in 2's complement, M_2 is simply the 6
-//   lsb's, M_1 is the next 6, and K is simply N shifted right
-//   arithmetically (sign extended) by 12 bits.
-//
-//   Now, 2^( N / 2^12 ) is simply  
-//	
-//      2^K * 2^( M_1 / 2^6 ) * 2^( M_2 / 2^12 )
-//
-//   Clearly, 2^K needs no tabulation. The other two values are less
-//   trivial because if we store each accurately to more than working
-//   precision, than its product is too expensive to calculate. We
-//   use the following method.
-//
-//   Define two mathematical values, delta_1 and delta_2, implicitly
-//   such that
-//
-//     T_1 = exp( [M_1 log(2)/2^6]  -  delta_1 ) 
-//     T_2 = exp( [M_2 log(2)/2^12] -  delta_2 )
-//
-//   are representable as 24 significant bits. To illustrate the idea,
-//   we show how we define delta_1: 
-//
-//     T_1     := round_to_24_bits( exp( M_1 log(2)/2^6 ) )
-//     delta_1  = (M_1 log(2)/2^6) - log( T_1 )  
-//
-//   The last equality means mathematical equality. We then tabulate
-//
-//     W_1 := exp(delta_1) - 1
-//     W_2 := exp(delta_2) - 1
-//
-//   Both in double precision.
-//
-//   From the tabulated values T_1, T_2, W_1, W_2, we compose the values
-//   T and W via
-//
-//     T := T_1 * T_2			...exactly
-//     W := W_1 + (1 + W_1)*W_2	
-//
-//   W approximates exp( delta ) - 1  where delta = delta_1 + delta_2.
-//   The mathematical product of T and (W+1) is an accurate representation
-//   of 2^(M_1/2^6) * 2^(M_2/2^12).
-//
-//   Step 4. Reconstruction
-//
-//   Finally, we can reconstruct exp(X), exp(X) - 1. 
-//   Because
-//
-//	X = K * log(2) + (M_1*log(2)/2^6  - delta_1) 
-//		       + (M_2*log(2)/2^12 - delta_2)
-//		       + delta_1 + delta_2 + r 		...accurately
-//   We have
-//
-//	exp(X) ~=~ 2^K * ( T + T*[exp(delta_1+delta_2+r) - 1] )
-//	       ~=~ 2^K * ( T + T*[exp(delta + r) - 1]         )
-//	       ~=~ 2^K * ( T + T*[(exp(delta)-1)  
-//				 + exp(delta)*(exp(r)-1)]   )
-//             ~=~ 2^K * ( T + T*( W + (1+W)*poly(r) ) )
-//             ~=~ 2^K * ( Y_hi  +  Y_lo )
-//
-//   where Y_hi = T  and Y_lo = T*(W + (1+W)*poly(r))
-//
-//   For exp(X)-1, we have
-//
-//	exp(X)-1 ~=~ 2^K * ( Y_hi + Y_lo ) - 1
-//		 ~=~ 2^K * ( Y_hi + Y_lo - 2^(-K) )
-//
-//   and we combine Y_hi + Y_lo - 2^(-N)  into the form of two 
-//   numbers  Y_hi + Y_lo carefully.
-//
-//   **** Algorithm Details ****
-//
-//   A careful algorithm must be used to realize the mathematical ideas
-//   accurately. We describe each of the three cases. We assume SAFE
-//   is preset to be TRUE.
-//
-//   Case exp_tiny:
-//
-//   The important points are to ensure an accurate result under 
-//   different rounding directions and a correct setting of the SAFE 
-//   flag.
-//
-//   If Flag is 1, then
-//      SAFE  := False	...possibility of underflow
-//      Scale := 1.0
-//      Y_hi  := X
-//      Y_lo  := 2^(-17000)
-//   Else
-//      Scale := 1.0
-//      Y_hi  := 1.0
-//      Y_lo  := X	...for different rounding modes
-//   Endif
-//
-//   Case exp_small:
-//
-//   Here we compute a simple polynomial. To exploit parallelism, we split
-//   the polynomial into several portions.
-//
-//   Let r = X 
-//
-//   If Flag is not 1	...i.e. exp( argument )
-//
-//      rsq := r * r; 
-//      r4  := rsq*rsq
-//      poly_lo := P_3 + r*(P_4 + r*(P_5 + r*P_6))
-//      poly_hi := r + rsq*(P_1 + r*P_2)
-//      Y_lo    := poly_hi + r4 * poly_lo
-//      set lsb(Y_lo) to 1
-//      Y_hi    := 1.0
-//      Scale   := 1.0
-//
-//   Else			...i.e. exp( argument ) - 1
-//
-//      rsq := r * r
-//      r4  := rsq * rsq
-//      r6  := rsq * r4
-//      poly_lo := r6*(Q_5 + r*(Q_6 + r*Q_7))
-//      poly_hi := Q_1 + r*(Q_2 + r*(Q_3 + r*Q_4))
-//      Y_lo    := rsq*poly_hi +  poly_lo
-//      set lsb(Y_lo) to 1
-//      Y_hi    := X
-//      Scale   := 1.0
-//
-//   Endif
-//
-//  Case exp_regular:
-//
-//  The previous description contain enough information except the
-//  computation of poly and the final Y_hi and Y_lo in the case for
-//  exp(X)-1.
-//
-//  The computation of poly for Step 2:
-//
-//   rsq := r*r
-//   poly := r + rsq*(A_1 + r*(A_2 + r*A_3))
-//
-//  For the case exp(X) - 1, we need to incorporate 2^(-K) into
-//  Y_hi and Y_lo at the end of Step 4.
-//
-//   If K > 10 then
-//      Y_lo := Y_lo - 2^(-K)
-//   Else
-//      If K < -10 then
-//	 Y_lo := Y_hi + Y_lo
-//	 Y_hi := -2^(-K)
-//      Else
-//	 Y_hi := Y_hi - 2^(-K)
-//      End If
-//   End If
-//
-
-#include "libm_support.h"
-
-GR_SAVE_PFS          = r59
-GR_SAVE_B0           = r60
-GR_SAVE_GP           = r61
-
-GR_Parameter_X       = r62
-GR_Parameter_Y       = r63
-GR_Parameter_RESULT  = r64
-
-FR_X             = f9
-FR_Y             = f1
-FR_RESULT        = f99
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
-.align 64 
-Constants_exp_64_Arg:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Arg,@object)
-data4 0x5C17F0BC,0xB8AA3B29,0x0000400B,0x00000000 
-data4 0x00000000,0xB17217F4,0x00003FF2,0x00000000
-data4 0xF278ECE6,0xF473DE6A,0x00003FD4,0x00000000
-// /* Inv_L, L_hi, L_lo */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Arg)
-
-.align 64 
-Constants_exp_64_Exponents:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Exponents,@object)
-data4 0x0000007E,0x00000000,0xFFFFFF83,0xFFFFFFFF
-data4 0x000003FE,0x00000000,0xFFFFFC03,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0xFFFFFFE2,0xFFFFFFFF,0xFFFFFFC4,0xFFFFFFFF
-data4 0xFFFFFFBA,0xFFFFFFFF,0xFFFFFFBA,0xFFFFFFFF
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Exponents)
-
-.align 64 
-Constants_exp_64_A:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_A,@object)
-data4 0xB1B736A0,0xAAAAAAAB,0x00003FFA,0x00000000
-data4 0x90CD6327,0xAAAAAAAB,0x00003FFC,0x00000000
-data4 0xFFFFFFFF,0xFFFFFFFF,0x00003FFD,0x00000000
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_A)
-
-.align 64 
-Constants_exp_64_P:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_P,@object)
-data4 0x43914A8A,0xD00D6C81,0x00003FF2,0x00000000
-data4 0x30304B30,0xB60BC4AC,0x00003FF5,0x00000000
-data4 0x7474C518,0x88888888,0x00003FF8,0x00000000
-data4 0x8DAE729D,0xAAAAAAAA,0x00003FFA,0x00000000
-data4 0xAAAAAF61,0xAAAAAAAA,0x00003FFC,0x00000000
-data4 0x000004C7,0x80000000,0x00003FFE,0x00000000 
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_P)
-
-.align 64 
-Constants_exp_64_Q:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Q,@object)
-data4 0xA49EF6CA,0xD00D56F7,0x00003FEF,0x00000000
-data4 0x1C63493D,0xD00D59AB,0x00003FF2,0x00000000
-data4 0xFB50CDD2,0xB60B60B5,0x00003FF5,0x00000000
-data4 0x7BA68DC8,0x88888888,0x00003FF8,0x00000000
-data4 0xAAAAAC8D,0xAAAAAAAA,0x00003FFA,0x00000000
-data4 0xAAAAACCA,0xAAAAAAAA,0x00003FFC,0x00000000
-data4 0x00000000,0x80000000,0x00003FFE,0x00000000 
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Q)
-
-.align 64 
-Constants_exp_64_T1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T1,@object)
-data4 0x3F800000,0x3F8164D2,0x3F82CD87,0x3F843A29 
-data4 0x3F85AAC3,0x3F871F62,0x3F88980F,0x3F8A14D5 
-data4 0x3F8B95C2,0x3F8D1ADF,0x3F8EA43A,0x3F9031DC
-data4 0x3F91C3D3,0x3F935A2B,0x3F94F4F0,0x3F96942D
-data4 0x3F9837F0,0x3F99E046,0x3F9B8D3A,0x3F9D3EDA
-data4 0x3F9EF532,0x3FA0B051,0x3FA27043,0x3FA43516
-data4 0x3FA5FED7,0x3FA7CD94,0x3FA9A15B,0x3FAB7A3A
-data4 0x3FAD583F,0x3FAF3B79,0x3FB123F6,0x3FB311C4
-data4 0x3FB504F3,0x3FB6FD92,0x3FB8FBAF,0x3FBAFF5B
-data4 0x3FBD08A4,0x3FBF179A,0x3FC12C4D,0x3FC346CD
-data4 0x3FC5672A,0x3FC78D75,0x3FC9B9BE,0x3FCBEC15
-data4 0x3FCE248C,0x3FD06334,0x3FD2A81E,0x3FD4F35B
-data4 0x3FD744FD,0x3FD99D16,0x3FDBFBB8,0x3FDE60F5
-data4 0x3FE0CCDF,0x3FE33F89,0x3FE5B907,0x3FE8396A
-data4 0x3FEAC0C7,0x3FED4F30,0x3FEFE4BA,0x3FF28177
-data4 0x3FF5257D,0x3FF7D0DF,0x3FFA83B3,0x3FFD3E0C
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T1)
-
-.align 64 
-Constants_exp_64_T2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T2,@object)
-data4 0x3F800000,0x3F80058C,0x3F800B18,0x3F8010A4 
-data4 0x3F801630,0x3F801BBD,0x3F80214A,0x3F8026D7 
-data4 0x3F802C64,0x3F8031F2,0x3F803780,0x3F803D0E 
-data4 0x3F80429C,0x3F80482B,0x3F804DB9,0x3F805349 
-data4 0x3F8058D8,0x3F805E67,0x3F8063F7,0x3F806987 
-data4 0x3F806F17,0x3F8074A8,0x3F807A39,0x3F807FCA 
-data4 0x3F80855B,0x3F808AEC,0x3F80907E,0x3F809610 
-data4 0x3F809BA2,0x3F80A135,0x3F80A6C7,0x3F80AC5A 
-data4 0x3F80B1ED,0x3F80B781,0x3F80BD14,0x3F80C2A8 
-data4 0x3F80C83C,0x3F80CDD1,0x3F80D365,0x3F80D8FA 
-data4 0x3F80DE8F,0x3F80E425,0x3F80E9BA,0x3F80EF50 
-data4 0x3F80F4E6,0x3F80FA7C,0x3F810013,0x3F8105AA 
-data4 0x3F810B41,0x3F8110D8,0x3F81166F,0x3F811C07 
-data4 0x3F81219F,0x3F812737,0x3F812CD0,0x3F813269 
-data4 0x3F813802,0x3F813D9B,0x3F814334,0x3F8148CE 
-data4 0x3F814E68,0x3F815402,0x3F81599C,0x3F815F37
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T2)
-
-.align 64 
-Constants_exp_64_W1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W1,@object)
-data4 0x00000000,0x00000000,0x171EC4B4,0xBE384454
-data4 0x4AA72766,0xBE694741,0xD42518F8,0xBE5D32B6
-data4 0x3A319149,0x3E68D96D,0x62415F36,0xBE68F4DA
-data4 0xC9C86A3B,0xBE6DDA2F,0xF49228FE,0x3E6B2E50
-data4 0x1188B886,0xBE49C0C2,0x1A4C2F1F,0x3E64BFC2
-data4 0x2CB98B54,0xBE6A2FBB,0x9A55D329,0x3E5DC5DE
-data4 0x39A7AACE,0x3E696490,0x5C66DBA5,0x3E54728B
-data4 0xBA1C7D7D,0xBE62B0DB,0x09F1AF5F,0x3E576E04
-data4 0x1A0DD6A1,0x3E612500,0x795FBDEF,0xBE66A419
-data4 0xE1BD41FC,0xBE5CDE8C,0xEA54964F,0xBE621376
-data4 0x476E76EE,0x3E6370BE,0x3427EB92,0x3E390D1A 
-data4 0x2BF82BF8,0x3E1336DE,0xD0F7BD9E,0xBE5FF1CB 
-data4 0x0CEB09DD,0xBE60A355,0x0980F30D,0xBE5CA37E 
-data4 0x4C082D25,0xBE5C541B,0x3B467D29,0xBE5BBECA 
-data4 0xB9D946C5,0xBE400D8A,0x07ED374A,0xBE5E2A08 
-data4 0x365C8B0A,0xBE66CB28,0xD3403BCA,0x3E3AAD5B 
-data4 0xC7EA21E0,0x3E526055,0xE72880D6,0xBE442C75 
-data4 0x85222A43,0x3E58B2BB,0x522C42BF,0xBE5AAB79 
-data4 0x469DC2BC,0xBE605CB4,0xA48C40DC,0xBE589FA7 
-data4 0x1AA42614,0xBE51C214,0xC37293F4,0xBE48D087 
-data4 0xA2D673E0,0x3E367A1C,0x114F7A38,0xBE51BEBB 
-data4 0x661A4B48,0xBE6348E5,0x1D3B9962,0xBDF52643  
-data4 0x35A78A53,0x3E3A3B5E,0x1CECD788,0xBE46C46C 
-data4 0x7857D689,0xBE60B7EC,0xD14F1AD7,0xBE594D3D 
-data4 0x4C9A8F60,0xBE4F9C30,0x02DFF9D2,0xBE521873 
-data4 0x55E6D68F,0xBE5E4C88,0x667F3DC4,0xBE62140F 
-data4 0x3BF88747,0xBE36961B,0xC96EC6AA,0x3E602861 
-data4 0xD57FD718,0xBE3B5151,0xFC4A627B,0x3E561CD0 
-data4 0xCA913FEA,0xBE3A5217,0x9A5D193A,0x3E40A3CC 
-data4 0x10A9C312,0xBE5AB713,0xC5F57719,0x3E4FDADB 
-data4 0xDBDF59D5,0x3E361428,0x61B4180D,0x3E5DB5DB 
-data4 0x7408D856,0xBE42AD5F,0x31B2B707,0x3E2A3148 
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W1)
-
-.align 64 
-Constants_exp_64_W2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W2,@object)
-data4 0x00000000,0x00000000,0x37A3D7A2,0xBE641F25 
-data4 0xAD028C40,0xBE68DD57,0xF212B1B6,0xBE5C77D8 
-data4 0x1BA5B070,0x3E57878F,0x2ECAE6FE,0xBE55A36A 
-data4 0x569DFA3B,0xBE620608,0xA6D300A3,0xBE53B50E 
-data4 0x223F8F2C,0x3E5B5EF2,0xD6DE0DF4,0xBE56A0D9 
-data4 0xEAE28F51,0xBE64EEF3,0x367EA80B,0xBE5E5AE2 
-data4 0x5FCBC02D,0x3E47CB1A,0x9BDAFEB7,0xBE656BA0 
-data4 0x805AFEE7,0x3E6E70C6,0xA3415EBA,0xBE6E0509 
-data4 0x49BFF529,0xBE56856B,0x00508651,0x3E66DD33 
-data4 0xC114BC13,0x3E51165F,0xC453290F,0x3E53333D 
-data4 0x05539FDA,0x3E6A072B,0x7C0A7696,0xBE47CD87 
-data4 0xEB05C6D9,0xBE668BF4,0x6AE86C93,0xBE67C3E3 
-data4 0xD0B3E84B,0xBE533904,0x556B53CE,0x3E63E8D9 
-data4 0x63A98DC8,0x3E212C89,0x032A7A22,0xBE33138F 
-data4 0xBC584008,0x3E530FA9,0xCCB93C97,0xBE6ADF82 
-data4 0x8370EA39,0x3E5F9113,0xFB6A05D8,0x3E5443A4 
-data4 0x181FEE7A,0x3E63DACD,0xF0F67DEC,0xBE62B29D 
-data4 0x3DDE6307,0x3E65C483,0xD40A24C1,0x3E5BF030  
-data4 0x14E437BE,0x3E658B8F,0xED98B6C7,0xBE631C29 
-data4 0x04CF7C71,0x3E6335D2,0xE954A79D,0x3E529EED 
-data4 0xF64A2FB8,0x3E5D9257,0x854ED06C,0xBE6BED1B 
-data4 0xD71405CB,0x3E5096F6,0xACB9FDF5,0xBE3D4893 
-data4 0x01B68349,0xBDFEB158,0xC6A463B9,0x3E628D35 
-data4 0xADE45917,0xBE559725,0x042FC476,0xBE68C29C 
-data4 0x01E511FA,0xBE67593B,0x398801ED,0xBE4A4313 
-data4 0xDA7C3300,0x3E699571,0x08062A9E,0x3E5349BE 
-data4 0x755BB28E,0x3E5229C4,0x77A1F80D,0x3E67E426 
-data4 0x6B69C352,0xBE52B33F,0x084DA57F,0xBE6B3550 
-data4 0xD1D09A20,0xBE6DB03F,0x2161B2C1,0xBE60CBC4 
-data4 0x78A2B771,0x3E56ED9C,0x9D0FA795,0xBE508E31 
-data4 0xFD1A54E9,0xBE59482A,0xB07FD23E,0xBE2A17CE 
-data4 0x17365712,0x3E68BF5C,0xB3785569,0x3E3956F9
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W2)
-
-.section .text
-.proc expm1#
-.global expm1#
-.align 64 
+// 6. 2^-2 <= x < 709.7827  or  -48.0 <= x < -2^-2  
+//    This is the main path.  The algorithm is described below:
 
-expm1: 
-#ifdef _LIBC
-.global __expm1#
-__expm1:
-#endif
-
-
-{ .mii
-      alloc r32 = ar.pfs,0,30,4,0
-(p0)  add r33 = 1, r0  
-(p0)  cmp.eq.unc  p7, p0 =  r0, r0 
-}
-;;
-
-
-//
-//    Set p7 true for expm1
-//    Set Flag = r33 = 1 for expm1
-//    These are really no longer necesary, but are a remnant 
-//       when this file had multiple entry points.
-//       They should be carefully removed
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 128/log2
+//  n = int(w)
+//  x = n log2/128 + r + delta
+
+//  n = 128M + index_1 + 2^4 index_2
+//  x = M log2 + (log2/128) index_1 + (log2/8) index_2 + r + delta
+
+//  exp(x) = 2^M  2^(index_1/128)  2^(index_2/8) exp(r) exp(delta)
+//       Construct 2^M
+//       Get 2^(index_1/128) from table_1;
+//       Get 2^(index_2/8)   from table_2;
+//       Calculate exp(r) by series by 5th order polynomial
+//          r = x - n (log2/128)_high
+//          delta = - n (log2/128)_low
+//       Calculate exp(delta) as 1 + delta
+
+
+// Special values
+//==============================================================
+// expm1(+0)    = +0.0
+// expm1(-0)    = -0.0
+
+// expm1(+qnan) = +qnan
+// expm1(-qnan) = -qnan
+// expm1(+snan) = +qnan
+// expm1(-snan) = -qnan
+
+// expm1(-inf)  = -1.0
+// expm1(+inf)  = +inf
+
+// Overflow and Underflow
+//=======================
+// expm1(x) = largest double normal when
+//     x = 709.7827 = 40862e42fefa39ef
+//
+// Underflow is handled as described in case 2 above.
+
+
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f9 -> f15,  f32 -> f75
+
+// General registers used:
+// r14 -> r40
+
+// Predicate registers used:
+// p6 -> p15
+
+// Assembly macros
+//==============================================================
+
+rRshf                  = r14
+rAD_TB1                = r15
+rAD_T1                 = r15
+rAD_TB2                = r16
+rAD_T2                 = r16
+rAD_Ln2_lo             = r17
+rAD_P                  = r17
+
+rN                     = r18
+rIndex_1               = r19
+rIndex_2_16            = r20
+
+rM                     = r21
+rBiased_M              = r21
+rIndex_1_16            = r22
+rSignexp_x             = r23
+rExp_x                 = r24
+rSig_inv_ln2           = r25
+
+rAD_Q1                 = r26
+rAD_Q2                 = r27
+rTmp                   = r27
+rExp_bias              = r28
+rExp_mask              = r29
+rRshf_2to56            = r30
+
+rGt_ln                 = r31
+rExp_2tom56            = r31
+
+
+GR_SAVE_B0             = r33
+GR_SAVE_PFS            = r34
+GR_SAVE_GP             = r35
+GR_SAVE_SP             = r36
+
+GR_Parameter_X         = r37
+GR_Parameter_Y         = r38
+GR_Parameter_RESULT    = r39
+GR_Parameter_TAG       = r40
+
+
+FR_X                   = f10
+FR_Y                   = f1
+FR_RESULT              = f8
+
+fRSHF_2TO56            = f6
+fINV_LN2_2TO63         = f7
+fW_2TO56_RSH           = f9
+f2TOM56                = f11
+fP5                    = f12
+fP54                   = f50
+fP5432                 = f50
+fP4                    = f13
+fP3                    = f14
+fP32                   = f14
+fP2                    = f15
+
+fLn2_by_128_hi         = f33
+fLn2_by_128_lo         = f34
+
+fRSHF                  = f35
+fNfloat                = f36
+fW                     = f37
+fR                     = f38
+fF                     = f39
+
+fRsq                   = f40
+fRcube                 = f41
+
+f2M                    = f42
+fS1                    = f43
+fT1                    = f44
+
+fMIN_DBL_OFLOW_ARG     = f45
+fMAX_DBL_MINUS_1_ARG   = f46
+fMAX_DBL_NORM_ARG      = f47
+fP_lo                  = f51
+fP_hi                  = f52
+fP                     = f53
+fS                     = f54
+
+fNormX                 = f56
+
+fWre_urm_f8            = f57
+
+fGt_pln                = f58
+fTmp                   = f58
+
+fS2                    = f59
+fT2                    = f60
+fSm1                   = f61
+
+fXsq                   = f62
+fX6                    = f63
+fX4                    = f63
+fQ7                    = f64
+fQ76                   = f64
+fQ7654                 = f64
+fQ765432               = f64
+fQ6                    = f65
+fQ5                    = f66
+fQ54                   = f66
+fQ4                    = f67
+fQ3                    = f68
+fQ32                   = f68
+fQ2                    = f69
+fQD                    = f70
+fQDC                   = f70
+fQDCBA                 = f70
+fQDCBA98               = f70
+fQDCBA98765432         = f70
+fQC                    = f71
+fQB                    = f72
+fQBA                   = f72
+fQA                    = f73
+fQ9                    = f74
+fQ98                   = f74
+fQ8                    = f75
+
+// Data tables
+//==============================================================
+
+RODATA
+.align 16
+
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
+
+// double-extended 1/ln(2)
+// 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
+// 3fff b8aa 3b29 5c17 f0bc
+// For speed the significand will be loaded directly with a movl and setf.sig
+//   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
+//   computations need to scale appropriately.
+// The constant 128/ln(2) is needed for the computation of w.  This is also
+//   obtained by scaling the computations.
+//
+// Two shifting constants are loaded directly with movl and setf.d.
+//   1. fRSHF_2TO56 = 1.1000..00 * 2^(63-7)
+//        This constant is added to x*1/ln2 to shift the integer part of
+//        x*128/ln2 into the rightmost bits of the significand.
+//        The result of this fma is fW_2TO56_RSH.
+//   2. fRSHF       = 1.1000..00 * 2^(63)
+//        This constant is subtracted from fW_2TO56_RSH * 2^(-56) to give
+//        the integer part of w, n, as a floating-point number.
+//        The result of this fms is fNfloat.
+
+
+LOCAL_OBJECT_START(exp_Table_1)
+data8 0x40862e42fefa39f0 // smallest dbl overflow arg
+data8 0xc048000000000000 // approx largest arg for minus one result
+data8 0x40862e42fefa39ef // largest dbl arg to give normal dbl result
+data8 0x0                // pad
+data8 0xb17217f7d1cf79ab , 0x00003ff7 // ln2/128 hi
+data8 0xc9e3b39803f2f6af , 0x00003fb7 // ln2/128 lo
+//
+// Table 1 is 2^(index_1/128) where
+// index_1 goes from 0 to 15
+//
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x80B1ED4FD999AB6C , 0x00003FFF
+data8 0x8164D1F3BC030773 , 0x00003FFF
+data8 0x8218AF4373FC25EC , 0x00003FFF
+data8 0x82CD8698AC2BA1D7 , 0x00003FFF
+data8 0x8383594EEFB6EE37 , 0x00003FFF
+data8 0x843A28C3ACDE4046 , 0x00003FFF
+data8 0x84F1F656379C1A29 , 0x00003FFF
+data8 0x85AAC367CC487B15 , 0x00003FFF
+data8 0x8664915B923FBA04 , 0x00003FFF
+data8 0x871F61969E8D1010 , 0x00003FFF
+data8 0x87DB357FF698D792 , 0x00003FFF
+data8 0x88980E8092DA8527 , 0x00003FFF
+data8 0x8955EE03618E5FDD , 0x00003FFF
+data8 0x8A14D575496EFD9A , 0x00003FFF
+data8 0x8AD4C6452C728924 , 0x00003FFF
+LOCAL_OBJECT_END(exp_Table_1)
+
+// Table 2 is 2^(index_1/8) where
+// index_2 goes from 0 to 7
+LOCAL_OBJECT_START(exp_Table_2)
+data8 0x8000000000000000 , 0x00003FFF
+data8 0x8B95C1E3EA8BD6E7 , 0x00003FFF
+data8 0x9837F0518DB8A96F , 0x00003FFF
+data8 0xA5FED6A9B15138EA , 0x00003FFF
+data8 0xB504F333F9DE6484 , 0x00003FFF
+data8 0xC5672A115506DADD , 0x00003FFF
+data8 0xD744FCCAD69D6AF4 , 0x00003FFF
+data8 0xEAC0C6E7DD24392F , 0x00003FFF
+LOCAL_OBJECT_END(exp_Table_2)
+
+
+LOCAL_OBJECT_START(exp_p_table)
+data8 0x3f8111116da21757 //P5
+data8 0x3fa55555d787761c //P4
+data8 0x3fc5555555555414 //P3
+data8 0x3fdffffffffffd6a //P2
+LOCAL_OBJECT_END(exp_p_table)
+
+LOCAL_OBJECT_START(exp_Q1_table)
+data8 0x3de6124613a86d09 // QD = 1/13!
+data8 0x3e21eed8eff8d898 // QC = 1/12!
+data8 0x3ec71de3a556c734 // Q9 = 1/9!
+data8 0x3efa01a01a01a01a // Q8 = 1/8!
+data8 0x8888888888888889,0x3ff8 // Q5 = 1/5!
+data8 0xaaaaaaaaaaaaaaab,0x3ffc // Q3 = 1/3!
+data8 0x0,0x0            // Pad to avoid bank conflicts
+LOCAL_OBJECT_END(exp_Q1_table)
+
+LOCAL_OBJECT_START(exp_Q2_table)
+data8 0x3e5ae64567f544e4 // QB = 1/11!
+data8 0x3e927e4fb7789f5c // QA = 1/10!
+data8 0x3f2a01a01a01a01a // Q7 = 1/7!
+data8 0x3f56c16c16c16c17 // Q6 = 1/6!
+data8 0xaaaaaaaaaaaaaaab,0x3ffa // Q4 = 1/4!
+data8 0x8000000000000000,0x3ffe // Q2 = 1/2!
+LOCAL_OBJECT_END(exp_Q2_table)
 
 
+.section .text
+GLOBAL_IEEE754_ENTRY(expm1)
 
-{ .mfi
-(p0)  add r32 = 1,r0  
-(p0)  fnorm.s1 f9 = f8 
-      nop.i 999
+{ .mlx
+      getf.exp        rSignexp_x = f8  // Must recompute if x unorm
+      movl            rSig_inv_ln2 = 0xb8aa3b295c17f0bc  // signif of 1/ln2
 }
-
-
-{ .mfi
-      nop.m 999
-(p0)  fclass.m.unc p6, p8 =  f8, 0x1E7 
-      nop.i 999
+{ .mlx
+      addl            rAD_TB1    = @ltoff(exp_Table_1), gp
+      movl            rRshf_2to56 = 0x4768000000000000   // 1.10000 2^(63+56)
 }
+;;
 
+// We do this fnorm right at the beginning to normalize
+// any input unnormals so that SWA is not taken.
 { .mfi
-      nop.m 999
-(p0)  fclass.nm.unc p9, p0 =  f8, 0x1FF 
-      nop.i 999
+      ld8             rAD_TB1    = [rAD_TB1]
+      fclass.m        p6,p0 = f8,0x0b  // Test for x=unorm
+      mov             rExp_mask = 0x1ffff
 }
-
 { .mfi
-	nop.m 999
-(p0)  mov f36 = f1 
-	nop.i 999 ;;
-}
-
-//     
-//    Identify NatVals, NaNs, Infs, and Zeros. 
-//    Identify EM unsupporteds. 
-//    Save special input registers 
-//
-//    Create FR_X_cor      = 0.0 
-//           GR_Flag       = 0 
-//           GR_Expo_Range = 1
-//           FR_Scale      = 1.0
-//
-
-{ .mfb
-	nop.m 999
-(p0)  mov f32 = f0 
-(p6)  br.cond.spnt EXP_64_SPECIAL ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)  br.cond.spnt EXP_64_UNSUPPORTED ;; 
-}
-
-//     
-//    Branch out for special input values 
-//     
-
-{ .mfi
-(p0)  cmp.ne.unc p12, p13 = 0x01, r33
-(p0)  fcmp.lt.unc.s0 p9,p0 =  f8, f0 
-(p0)  cmp.eq.unc  p15, p0 =  r0, r0 
-}
-
-//     
-//    Raise possible denormal operand exception 
-//    Normalize x 
-//     
-//    This function computes exp( x  + x_cor) 
-//    Input  FR 1: FR_X            
-//    Input  FR 2: FR_X_cor  
-//    Input  GR 1: GR_Flag  
-//    Input  GR 2: GR_Expo_Range  
-//    Output FR 3: FR_Y_hi  
-//    Output FR 4: FR_Y_lo  
-//    Output FR 5: FR_Scale  
-//    Output PR 1: PR_Safe  
-
-//
-//    Prepare to load constants
-//    Set Safe = True
-//
-
-{ .mmi
-(p0)  addl           r34   = @ltoff(Constants_exp_64_Arg#), gp
-(p0)  addl           r40   = @ltoff(Constants_exp_64_W1#),  gp
-(p0)  addl           r41   = @ltoff(Constants_exp_64_W2#),  gp
-}
-;;
-
-{ .mmi
-      ld8 r34 = [r34]
-      ld8 r40 = [r40]
-(p0)  addl           r50   = @ltoff(Constants_exp_64_T1#),  gp
-}
-;;
-
-
-{ .mmi
-      ld8 r41  = [r41]
-(p0)  ldfe f37 = [r34],16 
-(p0)  addl           r51   = @ltoff(Constants_exp_64_T2#),  gp
-}
-;;
-
-//
-//    N = fcvt.fx(float_N)
-//    Set p14 if -6 > expo_X 
-//
-
-
-//
-//    Bias = 0x0FFFF
-//    expo_X = expo_X and Mask  
-//
-
-//
-//    Load L_lo
-//    Set p10 if 14 < expo_X 
-//
-
-{ .mmi
-      ld8  r50 = [r50]
-(p0)  ldfe f40 = [r34],16 
-      nop.i 999
-}
-;;
-
-{ .mlx
-	nop.m 999
-(p0)  movl r58 = 0x0FFFF 
+      mov             rExp_bias = 0xffff
+      fnorm.s1        fNormX   = f8
+      mov             rExp_2tom56 = 0xffff-56
 }
 ;;
 
-//
-//    Load W2_ptr
-//    Branch to SMALL is expo_X < -6
-//
+// Form two constants we need
+//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128
+//  1.1000..000 * 2^(63+63-7) to right shift int(w) into the significand
 
-//
-//    float_N = X * L_Inv
-//    expo_X = exponent of X
-//    Mask = 0x1FFFF
-//
-
-{ .mmi
-      ld8  r51 = [r51]
-(p0)  ldfe f41 = [r34],16 
+{ .mfi
+      setf.sig        fINV_LN2_2TO63 = rSig_inv_ln2 // form 1/ln2 * 2^63
+      fclass.m        p8,p0 = f8,0x07  // Test for x=0
+      nop.i           0
 }
-;;
-
 { .mlx
-(p0)  addl           r34   = @ltoff(Constants_exp_64_Exponents#),  gp
-(p0)  movl r39 = 0x1FFFF
-}
-;;
-
-{ .mmi
-      ld8  r34 = [r34]
-(p0)  getf.exp r37 = f9 
-      nop.i 999
+      setf.d          fRSHF_2TO56 = rRshf_2to56 // Form 1.100 * 2^(63+56)
+      movl            rRshf = 0x43e8000000000000   // 1.10000 2^63 for rshift
 }
 ;;
 
-{ .mii
-      nop.m 999
-      nop.i 999 
-(p0)  and  r37 = r37, r39 ;;  
-}
-
-{ .mmi
-(p0)  sub r37 = r37, r58 ;;  
-(p0)  cmp.gt.unc  p14, p0 =  -6, r37 
-(p0)  cmp.lt.unc  p10, p0 =  14, r37 ;; 
-}
-
 { .mfi
-	nop.m 999
-//
-//    Load L_inv 
-//    Set p12 true for Flag = 0 (exp)
-//    Set p13 true for Flag = 1 (expm1)
-//
-(p0)  fmpy.s1 f38 = f9, f37 
-	nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-//
-//    Load L_hi
-//    expo_X = expo_X - Bias
-//    get W1_ptr      
-//
-(p0)  fcvt.fx.s1 f39 = f38
-(p14) br.cond.spnt EXP_SMALL ;; 
+      setf.exp        f2TOM56 = rExp_2tom56 // form 2^-56 for scaling Nfloat
+      fclass.m        p9,p0 = f8,0x22  // Test for x=-inf
+      add             rAD_TB2 = 0x140, rAD_TB1 // Point to Table 2
 }
-
 { .mib
-	nop.m 999
-	nop.i 999
-(p10) br.cond.spnt EXP_HUGE ;; 
-}
-
-{ .mmi
-(p0)  shladd r34 = r32,4,r34 
-(p0)  addl           r35   = @ltoff(Constants_exp_64_A#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-      ld8  r35 = [r35]
-      nop.m 999
-      nop.i 999
+      add             rAD_Q1 = 0x1e0, rAD_TB1 // Point to Q table for small path
+      add             rAD_Ln2_lo = 0x30, rAD_TB1 // Point to ln2_by_128_lo
+(p6)  br.cond.spnt    EXPM1_UNORM // Branch if x unorm
 }
 ;;
 
-//
-//    Load T_1,T_2
-//
-
-{ .mmb
-(p0)  ldfe f51 = [r35],16 
-(p0)  ld8 r45 = [r34],8
-	nop.b 999 ;;
-}
-//    
-//    Set Safe = True  if k >= big_expo_neg  
-//    Set Safe = False if k < big_expo_neg  
-//    
-
-{ .mmb
-(p0)  ldfe f49 = [r35],16 
-(p0)  ld8 r48 = [r34],0
-	nop.b 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Branch to HUGE is expo_X > 14 
-//
-(p0)  fcvt.xf f38 = f39 
-	nop.i 999 ;;
-}
-
-{ .mfi
-(p0)  getf.sig r52 = f39 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mii
-	nop.m 999
-(p0)  extr.u r43 = r52, 6, 6 ;;  
-//
-//    r = r - float_N * L_lo
-//    K = extr(N_fix,12,52)
-//
-(p0)  shladd r40 = r43,3,r40 ;; 
-}
-
+EXPM1_COMMON:
 { .mfi
-(p0)  shladd r50 = r43,2,r50 
-(p0)  fnma.s1 f42 = f40, f38, f9 
-//
-//    float_N = float(N)
-//    N_fix = signficand N 
-//
-(p0)  extr.u r42 = r52, 0, 6  
-}
-
-{ .mmi
-(p0)  ldfd  f43 = [r40],0 ;; 
-(p0)  shladd r41 = r42,3,r41 
-(p0)  shladd r51 = r42,2,r51 
+      ldfpd           fMIN_DBL_OFLOW_ARG, fMAX_DBL_MINUS_1_ARG = [rAD_TB1],16
+      fclass.m        p10,p0 = f8,0x1e1  // Test for x=+inf, NaN, NaT
+      add             rAD_Q2 = 0x50, rAD_Q1   // Point to Q table for small path
 }
-//
-//    W_1_p1 = 1 + W_1
-//
-
-{ .mmi
-(p0)  ldfs  f44 = [r50],0 ;; 
-(p0)  ldfd  f45 = [r41],0 
-//
-//    M_2 = extr(N_fix,0,6)
-//    M_1 = extr(N_fix,6,6)
-//    r = X - float_N * L_hi
-//
-(p0)  extr r44 = r52, 12, 52  
-}
-
-{ .mmi
-(p0)  ldfs  f46 = [r51],0 ;; 
-(p0)  sub r46 = r58, r44  
-(p0)  cmp.gt.unc  p8, p15 =  r44, r45 
-}
-//    
-//    W = W_1 + W_1_p1*W_2 
-//    Load  A_2 
-//    Bias_m_K = Bias - K
-//
-
-{ .mii
-(p0)  ldfe f40 = [r35],16 
-//
-//    load A_1
-//    poly = A_2 + r*A_3 
-//    rsq = r * r  
-//    neg_2_mK = exponent of Bias_m_k
-//
-(p0)  add r47 = r58, r44 ;;  
-//    
-//    Set Safe = True  if k <= big_expo_pos  
-//    Set Safe = False  if k >  big_expo_pos  
-//    Load A_3
-//    
-(p15) cmp.lt p8,p15 = r44,r48 ;;
-}
-
-{ .mmf
-(p0)  setf.exp f61 = r46 
-//    
-//    Bias_p + K = Bias + K
-//    T = T_1 * T_2
-//    
-(p0)  setf.exp f36 = r47 
-(p0)  fnma.s1 f42 = f41, f38, f42 ;; 
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Load W_1,W_2
-//    Load big_exp_pos, load big_exp_neg
-//
-(p0)  fadd.s1 f47 = f43, f1 
-	nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      nop.f           0
+(p8)  br.ret.spnt     b0                        // Exit for x=0, return x
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fma.s1 f52 = f42, f51, f49 
-	nop.i 999
+      ldfd            fMAX_DBL_NORM_ARG = [rAD_TB1],16
+      nop.f           0
+      and             rExp_x = rExp_mask, rSignexp_x // Biased exponent of x
 }
-
-{ .mfi
-	nop.m 999
-(p0)  fmpy.s1 f48 = f42, f42 
-	nop.i 999 ;;
+{ .mfb
+      setf.d          fRSHF = rRshf // Form right shift const 1.100 * 2^63
+(p9)  fms.d.s0        f8 = f0,f0,f1            // quick exit for x=-inf
+(p9)  br.ret.spnt     b0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 f53 = f44, f46 
-	nop.i 999 ;;
+      ldfpd           fQD, fQC = [rAD_Q1], 16  // Load coeff for small path
+      nop.f           0
+      sub             rExp_x = rExp_x, rExp_bias // True exponent of x
 }
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 f54 = f45, f47, f43 
-	nop.i 999
+{ .mfb
+      ldfpd           fQB, fQA = [rAD_Q2], 16  // Load coeff for small path
+(p10) fma.d.s0        f8 = f8, f1, f0          // For x=+inf, NaN, NaT
+(p10) br.ret.spnt     b0                       // Exit for x=+inf, NaN, NaT
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fneg f61 =  f61 
-	nop.i 999 ;;
+      ldfpd           fQ9, fQ8 = [rAD_Q1], 16  // Load coeff for small path
+      fma.s1          fXsq = fNormX, fNormX, f0  // x*x for small path
+      cmp.gt          p7, p8 = -2, rExp_x      // Test |x| < 2^(-2)
 }
-
 { .mfi
-	nop.m 999
-(p0)  fma.s1 f52 = f42, f52, f40 
-	nop.i 999 ;;
+      ldfpd           fQ7, fQ6 = [rAD_Q2], 16  // Load coeff for small path
+      nop.f           0
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 f55 = f54, f1 
-	nop.i 999
+      ldfe            fQ5 = [rAD_Q1], 16       // Load coeff for small path
+      nop.f           0
+      nop.i           0
 }
-
-{ .mfi
-	nop.m 999
-//
-//    W + Wp1 * poly     
-// 
-(p0)  mov f34 = f53 
-	nop.i 999 ;;
+{ .mib
+      ldfe            fQ4 = [rAD_Q2], 16       // Load coeff for small path
+(p7)  cmp.gt.unc      p6, p7 = -60, rExp_x     // Test |x| < 2^(-60)
+(p7)  br.cond.spnt    EXPM1_SMALL              // Branch if 2^-60 <= |x| < 2^-2
 }
+;;
 
-{ .mfi
-	nop.m 999
-//
-//    A_1 + r * poly 
-//    Scale = setf_exp(Bias_p_k) 
-//
-(p0)  fma.s1 f52 = f48, f52, f42 
-	nop.i 999 ;;
-}
+// W = X * Inv_log2_by_128
+// By adding 1.10...0*2^63 we shift and get round_int(W) in significand.
+// We actually add 1.10...0*2^56 to X * Inv_log2 to do the same thing.
 
 { .mfi
-	nop.m 999
-//
-//    poly = r + rsq(A_1 + r*poly) 
-//    Wp1 = 1 + W
-//    neg_2_mK = -neg_2_mK
-//
-(p0)  fma.s1 f35 = f55, f52, f54
-	nop.i 999 ;;
+      ldfe            fLn2_by_128_hi  = [rAD_TB1],32
+      fma.s1          fW_2TO56_RSH  = fNormX, fINV_LN2_2TO63, fRSHF_2TO56
+      nop.i           0
 }
-
 { .mfb
-	nop.m 999
-(p0)  fmpy.s1 f35 = f35, f53 
-//   
-//    Y_hi = T
-//    Y_lo = T * (W + Wp1*poly)
-//
-(p12) br.cond.sptk EXP_MAIN ;; 
+      ldfe            fLn2_by_128_lo  = [rAD_Ln2_lo]
+(p6)  fma.d.s0        f8 = f8, f8, f8 // If x < 2^-60, result=x+x*x
+(p6)  br.ret.spnt     b0              // Exit if x < 2^-60
 }
-//
-//    Branch if exp(x)  
-//    Continue for exp(x-1)
-//
+;;
 
-{ .mii
-(p0)  cmp.lt.unc  p12, p13 =  10, r44 
-	nop.i 999 ;;
-//
-//    Set p12 if 10 < K, Else p13 
-//
-(p13) cmp.gt.unc  p13, p14 =  -10, r44 ;; 
-}
+// Divide arguments into the following categories:
+//  Certain minus one       p11 - -inf < x <= MAX_DBL_MINUS_1_ARG
+//  Possible Overflow       p14 - MAX_DBL_NORM_ARG < x < MIN_DBL_OFLOW_ARG
+//  Certain Overflow        p15 - MIN_DBL_OFLOW_ARG <= x < +inf
 //
-//    K > 10:  Y_lo = Y_lo + neg_2_mK
-//    K <=10:  Set p13 if -10 > K, Else set p14 
+// If the input is really a double arg, then there will never be "Possible
+// Overflow" arguments.
 //
 
-{ .mfi
-(p13) cmp.eq  p15, p0 =  r0, r0 
-(p14) fadd.s1 f34 = f61, f34 
-	nop.i 999 ;;
-}
+// After that last load, rAD_TB1 points to the beginning of table 1
 
 { .mfi
-	nop.m 999
-(p12) fadd.s1 f35 = f35, f61 
-	nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p15,p14 = fNormX,fMIN_DBL_OFLOW_ARG
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p13) fadd.s1 f35 = f35, f34 
-	nop.i 999
+      add             rAD_P = 0x80, rAD_TB2
+      fcmp.le.s1      p11,p0 = fNormX,fMAX_DBL_MINUS_1_ARG
+      nop.i           0
 }
+;;
 
 { .mfb
-	nop.m 999
-//
-//    K <= 10 and K < -10, Set Safe = True
-//    K <= 10 and K < 10,   Y_lo = Y_hi + Y_lo 
-//    K <= 10 and K > =-10, Y_hi = Y_hi + neg_2_mk 
-// 
-(p13) mov f34 = f61 
-(p0)  br.cond.sptk EXP_MAIN ;; 
-}
-EXP_SMALL: 
-
-{ .mmi
-(p12)  addl           r35   = @ltoff(Constants_exp_64_P#), gp
-(p0)   addl           r34   = @ltoff(Constants_exp_64_Exponents#), gp
-      nop.i 999
+      ldfpd           fP5, fP4  = [rAD_P] ,16
+(p14) fcmp.gt.unc.s1  p14,p0 = fNormX,fMAX_DBL_NORM_ARG
+(p15) br.cond.spnt    EXPM1_CERTAIN_OVERFLOW
 }
 ;;
 
-{ .mmi
-(p12) ld8 r35 = [r35]
-      ld8 r34 = [r34]
-      nop.i 999
-}
-;;
+// Nfloat = round_int(W)
+// The signficand of fW_2TO56_RSH contains the rounded integer part of W,
+// as a twos complement number in the lower bits (that is, it may be negative).
+// That twos complement number (called N) is put into rN.
 
+// Since fW_2TO56_RSH is scaled by 2^56, it must be multiplied by 2^-56
+// before the shift constant 1.10000 * 2^63 is subtracted to yield fNfloat.
+// Thus, fNfloat contains the floating point version of N
 
-{ .mmi
-(p13)  addl           r35   = @ltoff(Constants_exp_64_Q#), gp
-       nop.m 999
-       nop.i 999
+{ .mfb
+      ldfpd           fP3, fP2  = [rAD_P]
+      fms.s1          fNfloat = fW_2TO56_RSH, f2TOM56, fRSHF
+(p11) br.cond.spnt    EXPM1_CERTAIN_MINUS_ONE
 }
 ;;
 
-
-// 
-//    Return
-//    K <= 10 and K < 10,   Y_hi = neg_2_mk 
-// 
-//    /*******************************************************/
-//    /*********** Branch EXP_SMALL  *************************/
-//    /*******************************************************/
-
 { .mfi
-(p13) ld8 r35 = [r35]
-(p0)  mov f42 = f9 
-(p0)  add r34 = 0x48,r34  
+      getf.sig        rN = fW_2TO56_RSH
+      nop.f           0
+      nop.i           0
 }
 ;;
 
-//
-//    Flag = 0
-//    r4 = rsq * rsq
-//
-
-{ .mfi
-(p0)  ld8 r49 =[r34],0
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    Flag = 1
-//
-(p0)  cmp.lt.unc  p14, p0 =  r37, r49 ;; 
-}
-
-{ .mfi
-	nop.m 999
-//
-//    r = X
-//
-(p0)  fmpy.s1 f48 = f42, f42 
-	nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-//
-//    rsq = r * r
-//
-(p0)  fmpy.s1 f50 = f48, f48 
-//
-//    Is input very small?
-//
-(p14) br.cond.spnt EXP_VERY_SMALL ;; 
-}
-//
-//    Flag_not1: Y_hi = 1.0
-//    Flag is 1: r6 = rsq * r4
-//
+// rIndex_1 has index_1
+// rIndex_2_16 has index_2 * 16
+// rBiased_M has M
+// rIndex_1_16 has index_1 * 16
 
+// r = x - Nfloat * ln2_by_128_hi
+// f = 1 - Nfloat * ln2_by_128_lo
 { .mfi
-(p12) ldfe f52 = [r35],16 
-(p12) mov f34 = f1 
-(p0)  add r53 = 0x1,r0 ;;  
+      and             rIndex_1 = 0x0f, rN
+      fnma.s1         fR   = fNfloat, fLn2_by_128_hi, fNormX
+      shr             rM = rN,  0x7
 }
-
 { .mfi
-(p13) ldfe f51 = [r35],16 
-//
-//    Flag_not_1: Y_lo = poly_hi + r4 * poly_lo
-//
-(p13) mov f34 = f9 
-	nop.i 999 ;;
-}
-
-{ .mmf
-(p12) ldfe f53 = [r35],16 
-//
-//    For Flag_not_1, Y_hi = X
-//    Scale = 1
-//    Create 0x000...01
-//
-(p0)  setf.sig f37 = r53 
-(p0)  mov f36 = f1 ;; 
-}
-
-{ .mmi
-(p13) ldfe f52 = [r35],16 ;; 
-(p12) ldfe f54 = [r35],16 
-	nop.i 999 ;;
+      and             rIndex_2_16 = 0x70, rN
+      fnma.s1         fF   = fNfloat, fLn2_by_128_lo, f1
+      nop.i           0
 }
+;;
 
-{ .mfi
-(p13) ldfe f53 = [r35],16 
-(p13) fmpy.s1 f58 = f48, f50 
-	nop.i 999 ;;
-}
-//
-//    Flag_not1: poly_lo = P_5 + r*P_6
-//    Flag_1: poly_lo = Q_6 + r*Q_7
-//
-
-{ .mmi
-(p13) ldfe f54 = [r35],16 ;; 
-(p12) ldfe f55 = [r35],16 
-	nop.i 999 ;;
-}
+// rAD_T1 has address of T1
+// rAD_T2 has address if T2
 
 { .mmi
-(p12) ldfe f56 = [r35],16 ;; 
-(p13) ldfe f55 = [r35],16 
-	nop.i 999 ;;
+      add             rBiased_M = rExp_bias, rM
+      add             rAD_T2 = rAD_TB2, rIndex_2_16
+      shladd          rAD_T1 = rIndex_1, 4, rAD_TB1
 }
+;;
 
+// Create Scale = 2^M
+// Load T1 and T2
 { .mmi
-(p12) ldfe f57 = [r35],0 ;; 
-(p13) ldfe f56 = [r35],16 
-	nop.i 999 ;;
-}
-
-{ .mfi
-(p13) ldfe f57 = [r35],0 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    For  Flag_not_1, load p5,p6,p1,p2
-//    Else load p5,p6,p1,p2
-//
-(p12) fma.s1 f60 = f52, f42, f53 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p13) fma.s1 f60 = f51, f42, f52 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p12) fma.s1 f60 = f60, f42, f54 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p12) fma.s1 f59 = f56, f42, f57 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p13) fma.s1 f60 = f42, f60, f53 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p12) fma.s1 f59 = f59, f48, f42 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Flag_1: poly_lo = Q_5 + r*(Q_6 + r*Q_7) 
-//    Flag_not1: poly_lo = P_4 + r*(P_5 + r*P_6)
-//    Flag_not1: poly_hi = (P_1 + r*P_2)
-//
-(p13) fmpy.s1 f60 = f60, f58 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p12) fma.s1 f60 = f60, f42, f55 
-	nop.i 999 ;;
+      setf.exp        f2M = rBiased_M
+      ldfe            fT2  = [rAD_T2]
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Flag_1: poly_lo = r6 *(Q_5 + ....)
-//    Flag_not1: poly_hi =  r + rsq *(P_1 + r*P_2)
-//
-(p12) fma.s1 f35 = f60, f50, f59 
-	nop.i 999
+      ldfe            fT1  = [rAD_T1]
+      fmpy.s0         fTmp = fLn2_by_128_lo, fLn2_by_128_lo // Force inexact
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p13) fma.s1 f59 = f54, f42, f55 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP54 = fR, fP5, fP4
+      nop.i           0
 }
-
 { .mfi
-	nop.m 999
-//
-//    Flag_not1: Y_lo = rsq* poly_hi + poly_lo 
-//    Flag_1: poly_lo = rsq* poly_hi + poly_lo 
-//
-(p13) fma.s1 f59 = f59, f42, f56 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Flag_not_1: (P_1 + r*P_2) 
-//
-(p13) fma.s1 f59 = f59, f42, f57 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP32 = fR, fP3, fP2
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Flag_not_1: poly_hi = r + rsq * (P_1 + r*P_2) 
-//
-(p13) fma.s1 f35 = f59, f48, f60 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fRsq = fR, fR, f0
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Create 0.000...01
-//
-(p0)  for f37 = f35, f37 
-	nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-//
-//    Set lsb of Y_lo to 1
-//
-(p0)  fmerge.se f35 = f35,f37 
-(p0)  br.cond.sptk EXP_MAIN ;; 
-}
-EXP_VERY_SMALL: 
-
-{ .mmi
-      nop.m 999
-(p13) addl r34 = @ltoff(Constants_exp_64_Exponents#),gp 
-      nop.i 999;;
+      nop.m           0
+      fma.s1          fP5432  = fRsq, fP54, fP32
+      nop.i           0
 }
+;;
 
 { .mfi
-(p13) ld8  r34 = [r34];
-(p12) mov f35 = f9 
-      nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-(p12) mov f34 = f1 
-(p12) br.cond.sptk EXP_MAIN ;; 
-}
-
-{ .mlx
-(p13) add  r34 = 8,r34 
-(p13) movl r39 = 0x0FFFE ;; 
+      nop.m           0
+      fma.s1          fS2  = fF,fT2,f0
+      nop.i           0
 }
-//
-//    Load big_exp_neg 
-//    Create 1/2's exponent
-//
-
-{ .mii
-(p13) setf.exp f56 = r39 
-(p13) shladd r34 = r32,4,r34 ;;  
-	nop.i 999
-}
-//
-//    Negative exponents are stored after positive
-//
-
 { .mfi
-(p13) ld8 r45 = [r34],0
-//
-//    Y_hi = x
-//    Scale = 1
-//
-(p13) fmpy.s1 f35 = f9, f9 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fS1  = f2M,fT1,f0
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Reset Safe if necessary 
-//    Create 1/2
-//
-(p13) mov f34 = f9 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP = fRsq, fP5432, fR
+      nop.i           0
 }
+;;
 
 { .mfi
-(p13) cmp.lt.unc  p0, p15 =  r37, r45 
-(p13) mov f36 = f1 
-	nop.i 999 ;;
+      nop.m           0
+      fms.s1          fSm1 = fS1,fS2,f1    // S - 1.0
+      nop.i           0
 }
-
 { .mfb
-	nop.m 999
-//
-//    Y_lo = x * x
-//
-(p13) fmpy.s1 f35 = f35, f56 
-//
-//    Y_lo = x*x/2 
-//
-(p13) br.cond.sptk EXP_MAIN ;; 
-}
-EXP_HUGE: 
-
-{ .mfi
-	nop.m 999
-(p0)  fcmp.gt.unc.s1 p14, p0 =  f9, f0 
-	nop.i 999
-}
-
-{ .mlx
-	nop.m 999
-(p0)  movl r39 = 0x15DC0 ;; 
-}
-
-{ .mfi
-(p14) setf.exp f34 = r39 
-(p14) mov f35 = f1 
-(p14) cmp.eq  p0, p15 =  r0, r0 ;; 
+      nop.m           0
+      fma.s1          fS   = fS1,fS2,f0
+(p14) br.cond.spnt    EXPM1_POSSIBLE_OVERFLOW
 }
+;;
 
 { .mfb
-	nop.m 999
-(p14) mov f36 = f34 
-//
-//    If x > 0, Set Safe = False
-//    If x > 0, Y_hi = 2**(24,000)
-//    If x > 0, Y_lo = 1.0
-//    If x > 0, Scale = 2**(24,000)
-//
-(p14) br.cond.sptk EXP_MAIN ;; 
-}
-
-{ .mlx
-	nop.m 999
-(p12) movl r39 = 0xA240 
-}
-
-{ .mlx
-	nop.m 999
-(p12) movl r38 = 0xA1DC ;; 
-}
-
-{ .mmb
-(p13) cmp.eq  p15, p14 =  r0, r0 
-(p12) setf.exp f34 = r39 
-	nop.b 999 ;;
-}
-
-{ .mlx
-(p12) setf.exp f35 = r38 
-(p13) movl r39 = 0xFF9C 
+      nop.m           0
+      fma.d.s0        f8 = fS, fP, fSm1
+      br.ret.sptk     b0                // Normal path exit
 }
+;;
 
-{ .mfi
-	nop.m 999
-(p13) fsub.s1 f34 = f0, f1
-	nop.i 999 ;;
+// Here if 2^-60 <= |x| <2^-2
+// Compute 13th order polynomial
+EXPM1_SMALL:
+{ .mmf
+      ldfe            fQ3 = [rAD_Q1], 16
+      ldfe            fQ2 = [rAD_Q2], 16
+      fma.s1          fX4 = fXsq, fXsq, f0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p12) mov f36 = f34 
-(p12) cmp.eq  p0, p15 =  r0, r0 ;; 
+      nop.m           0
+      fma.s1          fQDC = fQD, fNormX, fQC
+      nop.i           0
 }
-
 { .mfi
-(p13) setf.exp f35 = r39 
-(p13) mov f36 = f1 
-	nop.i 999 ;;
-}
-EXP_MAIN: 
-
-{ .mfi
-(p0)  cmp.ne.unc p12, p0 = 0x01, r33
-(p0)  fmpy.s1 f101 = f36, f35 
-	nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-(p0)  fma.d.s0 f99 = f34, f36, f101 
-(p15)  br.cond.sptk EXP_64_RETURN;;
+      nop.m           0
+      fma.s1          fQBA = fQB, fNormX, fQA
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fsetc.s3 0x7F,0x01
-	nop.i 999
+      nop.m           0
+      fma.s1          fQ98 = fQ9, fNormX, fQ8
+      nop.i           0
 }
-
-{ .mlx
-	nop.m 999
-(p0)  movl r50 = 0x000000000103FF ;;
-}
-//    
-//    S0 user supplied status
-//    S2 user supplied status + WRE + TD  (Overflows) 
-//    S3 user supplied status + RZ + TD   (Underflows) 
-//    
-//    
-//    If (Safe) is true, then
-//        Compute result using user supplied status field.
-//        No overflow or underflow here, but perhaps inexact.
-//        Return
-//    Else
-//       Determine if overflow or underflow  was raised.
-//       Fetch +/- overflow threshold for IEEE single, double,
-//       double extended   
-//    
-
 { .mfi
-(p0)  setf.exp f60 = r50
-(p0)  fma.d.s3 f102 = f34, f36, f101 
-	nop.i 999
+      nop.m           0
+      fma.s1          fQ76= fQ7, fNormX, fQ6
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fsetc.s3 0x7F,0x40 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fQ54 = fQ5, fNormX, fQ4
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    For Safe, no need to check for over/under. 
-//    For expm1, handle errors like exp. 
-//
-(p0)  fsetc.s2 0x7F,0x42
-	nop.i 999;;
+      nop.m           0
+      fma.s1          fX6 = fX4, fXsq, f0
+      nop.i           0
 }
-
 { .mfi
-	nop.m 999
-(p0)  fma.d.s2 f100 = f34, f36, f101 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fQ32= fQ3, fNormX, fQ2
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fsetc.s2 0x7F,0x40 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fQDCBA = fQDC, fXsq, fQBA
+      nop.i           0
 }
-
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc   p12, p0 =  f102, 0x00F
-	nop.i 999
+      nop.m           0
+      fma.s1          fQ7654 = fQ76, fXsq, fQ54
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc   p11, p0 =  f102, 0x00F
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fQDCBA98 = fQDCBA, fXsq, fQ98
+      nop.i           0
 }
-
 { .mfi
-	nop.m 999
-(p7)  fcmp.ge.unc.s1 p10, p0 =  f100, f60
-	nop.i 999
+      nop.m           0
+      fma.s1          fQ765432 = fQ7654, fXsq, fQ32
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//    
-//    Create largest double exponent + 1.
-//    Create smallest double exponent - 1.
-//    
-(p0)  fcmp.ge.unc.s1 p8, p0 =  f100, f60
-	nop.i 999 ;;
-}
-//    
-//    fcmp:   resultS2 >= + overflow threshold  -> set (a) if true
-//    fcmp:   resultS2 <= - overflow threshold  -> set (b) if true
-//    fclass: resultS3 is denorm/unorm/0        -> set (d) if true
-//    
-
-{ .mib
-(p10) mov   r65 = 41
-	nop.i 999
-(p10) br.cond.sptk __libm_error_region ;;
-}
-
-{ .mib
-(p8)  mov   r65 = 14
-	nop.i 999
-(p8)  br.cond.sptk __libm_error_region ;;
-}
-//    
-//    Report that exp overflowed
-//    
-
-{ .mib
-(p12) mov   r65 = 42
-	nop.i 999
-(p12) br.cond.sptk __libm_error_region ;;
+      nop.m           0
+      fma.s1          fQDCBA98765432 = fQDCBA98, fX6, fQ765432
+      nop.i           0
 }
+;;
 
-{ .mib
-(p11) mov   r65 = 15
-	nop.i 999
-(p11) br.cond.sptk __libm_error_region ;;
+{ .mfb
+      nop.m           0
+      fma.d.s0        f8 = fQDCBA98765432, fXsq, fNormX
+      br.ret.sptk     b0                   // Exit small branch
 }
+;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-//    
-//    Report that exp underflowed
-//    
-(p0)  br.cond.sptk EXP_64_RETURN;;
-}
-EXP_64_SPECIAL: 
 
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p6,  p0 =  f8, 0x0c3 
-	nop.i 999
-}
+EXPM1_POSSIBLE_OVERFLOW:
 
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p13, p8 =  f8, 0x007 
-	nop.i 999 ;;
-}
+// Here if fMAX_DBL_NORM_ARG < x < fMIN_DBL_OFLOW_ARG
+// This cannot happen if input is a double, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-{ .mfi
-	nop.m 999
-(p7)  fclass.m.unc p14, p0 =  f8, 0x007 
-	nop.i 999
-}
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest double, then we have
+// overflow
 
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc p12, p9 =  f8, 0x021 
-	nop.i 999 ;;
+      mov             rGt_ln  = 0x103ff // Exponent for largest dbl + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc p11, p0 =  f8, 0x022 
-	nop.i 999
+      setf.exp        fGt_pln = rGt_ln  // Create largest double + 1 ulp
+      fma.d.s2        fWre_urm_f8 = fS, fP, fSm1  // Result with wre set
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc p10, p0 =  f8, 0x022 
-	nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//    
-//    Identify +/- 0, Inf, or -Inf 
-//    Generate the right kind of NaN.
-//    
-(p13) fadd.d.s0 f99 = f0, f1 
-	nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
+;;
 
-{ .mfi
-	nop.m 999
-(p14) mov f99 = f8 
-	nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    EXPM1_CERTAIN_OVERFLOW // Branch if overflow
 }
+;;
 
 { .mfb
-	nop.m 999
-(p6)  fadd.d.s0 f99 = f8, f1 
-//    
-//    exp(+/-0) = 1 
-//    expm1(+/-0) = +/-0 
-//    No exceptions raised
-//    
-(p6)  br.cond.sptk EXP_64_RETURN;;
+      nop.m           0
+      fma.d.s0        f8 = fS, fP, fSm1
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
+;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-(p14)  br.cond.sptk EXP_64_RETURN;;
+EXPM1_CERTAIN_OVERFLOW:
+{ .mmi
+      sub             rTmp = rExp_mask, r0, 1
+;;
+      setf.exp        fTmp = rTmp
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p11) mov f99 = f0 
-	nop.i 999 ;;
+      alloc           r32=ar.pfs,1,4,4,0
+      fmerge.s        FR_X = f8,f8
+      nop.i           0
 }
-
 { .mfb
-	nop.m 999
-(p10) fsub.d.s1 f99 = f0, f1 
-//    
-//    exp(-Inf) = 0 
-//    expm1(-Inf) = -1 
-//    No exceptions raised.
-//    
-(p10)  br.cond.sptk EXP_64_RETURN;;
+      mov             GR_Parameter_TAG = 41
+      fma.d.s0        FR_RESULT = fTmp, fTmp, f0    // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
+// Here if x unorm
+EXPM1_UNORM:
 { .mfb
-	nop.m 999
-(p12) fmpy.d.s1 f99 = f8, f1 
-//    
-//    exp(+Inf) = Inf 
-//    No exceptions raised.
-//    
-(p0)  br.cond.sptk EXP_64_RETURN;;
+      getf.exp        rSignexp_x = fNormX    // Must recompute if x unorm
+      fcmp.eq.s0      p6, p0 = f8, f0        // Set D flag
+      br.cond.sptk    EXPM1_COMMON
 }
+;;
 
-
-EXP_64_UNSUPPORTED: 
-
-{ .mfb
-       nop.m 999
-(p0)  fmpy.d.s0 f99 = f8, f0 
-      nop.b 0;;
+// here if result will be -1 and inexact, x <= -48.0
+EXPM1_CERTAIN_MINUS_ONE:
+{ .mmi
+      mov             rTmp = 1
+;;
+      setf.exp        fTmp = rTmp
+      nop.i           0
 }
+;;
 
-EXP_64_RETURN:
 { .mfb
-      nop.m 999
-(p0)  mov   f8     = f99
-(p0)  br.ret.sptk   b0
+      nop.m           0
+      fms.d.s0        FR_RESULT = fTmp, fTmp, f1 // Set I, rounded -1+eps result
+      br.ret.sptk     b0
 }
-.endp expm1
-ASM_SIZE_DIRECTIVE(expm1)
+;;
+
+GLOBAL_IEEE754_END(expm1)
 
-.proc __libm_error_region
-__libm_error_region:
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-// (1)
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
         nop.f 0
@@ -1716,38 +843,32 @@ __libm_error_region:
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp=-64,sp                           // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP=gp                       // Save gp
 };;
-
-// (2)
 { .mmi
         stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
-        add GR_Parameter_X = 16,sp            // Parameter 1 address
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0=b0                       // Save b0
 };;
-
 .body
-// (3)
 { .mib
-        stfd [GR_Parameter_X] = FR_X                    // STORE Parameter 1 on stack
+        stfd [GR_Parameter_X] = FR_X            // STORE Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
-        nop.b 0                                 
+	nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = FR_RESULT                   // STORE Parameter 3 on stack
+        stfd [GR_Parameter_Y] = FR_RESULT       // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#         // Call error handling function
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
-
-// (4)
 { .mmi
         ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
@@ -1760,9 +881,6 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-
+LOCAL_LIBM_END(__libm_error_region)
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_expm1f.S b/sysdeps/ia64/fpu/s_expm1f.S
index cc2c537ba2..8996977ddb 100644
--- a/sysdeps/ia64/fpu/s_expm1f.S
+++ b/sysdeps/ia64/fpu/s_expm1f.S
@@ -1,10 +1,10 @@
-.file "exp_m1f.s"
+.file "expf_m1.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1735 +20,651 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
-// HISTORY
-// 2/02/00  Initial Version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+
+// History
+//*********************************************************************
+// 02/02/00 Initial Version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 07/07/01 Improved speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 11/20/02 Improved speed, algorithm based on expf
+// 03/31/05 Reformatted delimiters between data tables
 //
-// ********************************************************************* 
-//
-// Function:   Combined expf(x) and expm1f(x), where
-//                        x 
-//             expf(x) = e , for single precision x values
-//                          x
-//             expm1f(x) = e  - 1  for single precision x values
-//
-// ********************************************************************* 
-//
-// Accuracy:       Within .7 ulps for 80-bit floating point values
-//                 Very accurate for single precision values
-//
-// ********************************************************************* 
-//
-// Resources Used:
-//
-//    Floating-Point Registers: f8  (Input and Return Value) 
-//                              f9,f32-f61, f99-f102 
-//
-//    General Purpose Registers: 
-//      r32-r61
-//      r62-r65 (Used to pass arguments to error handling routine)
-//                                     
-//    Predicate Registers:      p6-p15
-//
-// ********************************************************************* 
-//
-// IEEE Special Conditions:
-//
-//    Denormal  fault raised on denormal inputs  
-//    Overflow exceptions raised when appropriate for exp and expm1
-//    Underflow exceptions raised when appropriate for exp and expm1
-//    (Error Handling Routine called for overflow and Underflow)
-//    Inexact raised when appropriate by algorithm 
-//
-//    expf(inf) = inf
-//    expf(-inf) = +0
-//    expf(SNaN) = QNaN
-//    expf(QNaN) = QNaN
-//    expf(0) = 1
-//    expf(EM_special Values) = QNaN
-//    expf(inf) = inf
-//    expm1f(-inf) = -1 
-//    expm1f(SNaN) = QNaN
-//    expm1f(QNaN) = QNaN
-//    expm1f(0) = 0
-//    expm1f(EM_special Values) = QNaN
-//    
-// ********************************************************************* 
-//
-// Implementation and Algorithm Notes:
-//
-//  ker_exp_64( in_FR  : X,
-//            in_GR  : Flag,
-//            in_GR  : Expo_Range
-//            out_FR : Y_hi,
-//            out_FR : Y_lo,
-//            out_FR : scale,
-//            out_PR : Safe )
-//
-// On input, X is in register format and 
-// Flag  = 0 for exp,
-// Flag  = 1 for expm1,
-//
-// On output, provided X and X_cor are real numbers, then
-//
-//   scale*(Y_hi + Y_lo)  approximates  expf(X)       if Flag is 0
-//   scale*(Y_hi + Y_lo)  approximates  expf(X)-1     if Flag is 1
-//
-// The accuracy is sufficient for a highly accurate 64 sig.
-// bit implementation.  Safe is set if there is no danger of 
-// overflow/underflow when the result is composed from scale, 
-// Y_hi and Y_lo. Thus, we can have a fast return if Safe is set. 
-// Otherwise, one must prepare to handle the possible exception 
-// appropriately.  Note that SAFE not set (false) does not mean 
-// that overflow/underflow will occur; only the setting of SAFE
-// guarantees the opposite.
-//
-// **** High Level Overview **** 
-//
-// The method consists of three cases.
-// 
-// If           |X| < Tiny	use case exp_tiny;
-// else if	|X| < 2^(-6)	use case exp_small;
-// else		use case exp_regular;
-//
-// Case exp_tiny:
-//
-//   1 + X     can be used to approximate expf(X) or expf(X+X_cor);
-//   X + X^2/2 can be used to approximate expf(X) - 1
-//
-// Case exp_small:
-//
-//   Here, expf(X), expf(X+X_cor), and expf(X) - 1 can all be 
-//   appproximated by a relatively simple polynomial.
-//
-//   This polynomial resembles the truncated Taylor series
-//
-//	expf(w) = 1 + w + w^2/2! + w^3/3! + ... + w^n/n!
-//
-// Case exp_regular:
-//
-//   Here we use a table lookup method. The basic idea is that in
-//   order to compute expf(X), we accurately decompose X into
-//
-//   X = N * log(2)/(2^12)  + r,	|r| <= log(2)/2^13.
-//
-//   Hence
-//
-//   expf(X) = 2^( N / 2^12 ) * expf(r).
-//
-//   The value 2^( N / 2^12 ) is obtained by simple combinations
-//   of values calculated beforehand and stored in table; expf(r)
-//   is approximated by a short polynomial because |r| is small.
-//
-//   We elaborate this method in 4 steps.
-//
-//   Step 1: Reduction
-//
-//   The value 2^12/log(2) is stored as a double-extended number
-//   L_Inv.
-//
-//   N := round_to_nearest_integer( X * L_Inv )
-//
-//   The value log(2)/2^12 is stored as two numbers L_hi and L_lo so
-//   that r can be computed accurately via
-//
-//   r := (X - N*L_hi) - N*L_lo
-//
-//   We pick L_hi such that N*L_hi is representable in 64 sig. bits
-//   and thus the FMA   X - N*L_hi   is error free. So r is the 
-//   1 rounding error from an exact reduction with respect to 
-//   
-//   L_hi + L_lo.
-//
-//   In particular, L_hi has 30 significant bit and can be stored
-//   as a double-precision number; L_lo has 64 significant bits and
-//   stored as a double-extended number.
-//
-//   In the case Flag = 2, we further modify r by
-//
-//   r := r + X_cor.
-//
-//   Step 2: Approximation
-//
-//   expf(r) - 1 is approximated by a short polynomial of the form
-//   
-//   r + A_1 r^2 + A_2 r^3 + A_3 r^4 .
-//
-//   Step 3: Composition from Table Values 
-//
-//   The value 2^( N / 2^12 ) can be composed from a couple of tables
-//   of precalculated values. First, express N as three integers
-//   K, M_1, and M_2 as
-//
-//     N  =  K * 2^12  + M_1 * 2^6 + M_2
-//
-//   Where 0 <= M_1, M_2 < 2^6; and K can be positive or negative.
-//   When N is represented in 2's complement, M_2 is simply the 6
-//   lsb's, M_1 is the next 6, and K is simply N shifted right
-//   arithmetically (sign extended) by 12 bits.
-//
-//   Now, 2^( N / 2^12 ) is simply  
-//	
-//      2^K * 2^( M_1 / 2^6 ) * 2^( M_2 / 2^12 )
-//
-//   Clearly, 2^K needs no tabulation. The other two values are less
-//   trivial because if we store each accurately to more than working
-//   precision, than its product is too expensive to calculate. We
-//   use the following method.
-//
-//   Define two mathematical values, delta_1 and delta_2, implicitly
-//   such that
-//
-//     T_1 = expf( [M_1 log(2)/2^6]  -  delta_1 ) 
-//     T_2 = expf( [M_2 log(2)/2^12] -  delta_2 )
-//
-//   are representable as 24 significant bits. To illustrate the idea,
-//   we show how we define delta_1: 
-//
-//     T_1     := round_to_24_bits( expf( M_1 log(2)/2^6 ) )
-//     delta_1  = (M_1 log(2)/2^6) - log( T_1 )  
-//
-//   The last equality means mathematical equality. We then tabulate
-//
-//     W_1 := expf(delta_1) - 1
-//     W_2 := expf(delta_2) - 1
-//
-//   Both in double precision.
-//
-//   From the tabulated values T_1, T_2, W_1, W_2, we compose the values
-//   T and W via
-//
-//     T := T_1 * T_2			...exactly
-//     W := W_1 + (1 + W_1)*W_2	
-//
-//   W approximates expf( delta ) - 1  where delta = delta_1 + delta_2.
-//   The mathematical product of T and (W+1) is an accurate representation
-//   of 2^(M_1/2^6) * 2^(M_2/2^12).
-//
-//   Step 4. Reconstruction
-//
-//   Finally, we can reconstruct expf(X), expf(X) - 1. 
-//   Because
-//
-//	X = K * log(2) + (M_1*log(2)/2^6  - delta_1) 
-//		       + (M_2*log(2)/2^12 - delta_2)
-//		       + delta_1 + delta_2 + r 		...accurately
-//   We have
-//
-//	expf(X) ~=~ 2^K * ( T + T*[expf(delta_1+delta_2+r) - 1] )
-//	       ~=~ 2^K * ( T + T*[expf(delta + r) - 1]         )
-//	       ~=~ 2^K * ( T + T*[(expf(delta)-1)  
-//				 + expf(delta)*(expf(r)-1)]   )
-//             ~=~ 2^K * ( T + T*( W + (1+W)*poly(r) ) )
-//             ~=~ 2^K * ( Y_hi  +  Y_lo )
-//
-//   where Y_hi = T  and Y_lo = T*(W + (1+W)*poly(r))
-//
-//   For expf(X)-1, we have
-//
-//	expf(X)-1 ~=~ 2^K * ( Y_hi + Y_lo ) - 1
-//		 ~=~ 2^K * ( Y_hi + Y_lo - 2^(-K) )
-//
-//   and we combine Y_hi + Y_lo - 2^(-N)  into the form of two 
-//   numbers  Y_hi + Y_lo carefully.
-//
-//   **** Algorithm Details ****
-//
-//   A careful algorithm must be used to realize the mathematical ideas
-//   accurately. We describe each of the three cases. We assume SAFE
-//   is preset to be TRUE.
-//
-//   Case exp_tiny:
-//
-//   The important points are to ensure an accurate result under 
-//   different rounding directions and a correct setting of the SAFE 
-//   flag.
-//
-//   If Flag is 1, then
-//      SAFE  := False	...possibility of underflow
-//      Scale := 1.0
-//      Y_hi  := X
-//      Y_lo  := 2^(-17000)
-//   Else
-//      Scale := 1.0
-//      Y_hi  := 1.0
-//      Y_lo  := X	...for different rounding modes
-//   Endif
-//
-//   Case exp_small:
-//
-//   Here we compute a simple polynomial. To exploit parallelism, we split
-//   the polynomial into several portions.
-//
-//   Let r = X 
-//
-//   If Flag is not 1	...i.e. expf( argument )
-//
-//      rsq := r * r; 
-//      r4  := rsq*rsq
-//      poly_lo := P_3 + r*(P_4 + r*(P_5 + r*P_6))
-//      poly_hi := r + rsq*(P_1 + r*P_2)
-//      Y_lo    := poly_hi + r4 * poly_lo
-//      set lsb(Y_lo) to 1
-//      Y_hi    := 1.0
-//      Scale   := 1.0
-//
-//   Else			...i.e. expf( argument ) - 1
-//
-//      rsq := r * r
-//      r4  := rsq * rsq
-//      r6  := rsq * r4
-//      poly_lo := r6*(Q_5 + r*(Q_6 + r*Q_7))
-//      poly_hi := Q_1 + r*(Q_2 + r*(Q_3 + r*Q_4))
-//      Y_lo    := rsq*poly_hi +  poly_lo
-//      set lsb(Y_lo) to 1
-//      Y_hi    := X
-//      Scale   := 1.0
-//
-//   Endif
-//
-//  Case exp_regular:
-//
-//  The previous description contain enough information except the
-//  computation of poly and the final Y_hi and Y_lo in the case for
-//  expf(X)-1.
-//
-//  The computation of poly for Step 2:
-//
-//   rsq := r*r
-//   poly := r + rsq*(A_1 + r*(A_2 + r*A_3))
-//
-//  For the case expf(X) - 1, we need to incorporate 2^(-K) into
-//  Y_hi and Y_lo at the end of Step 4.
-//
-//   If K > 10 then
-//      Y_lo := Y_lo - 2^(-K)
-//   Else
-//      If K < -10 then
-//	 Y_lo := Y_hi + Y_lo
-//	 Y_hi := -2^(-K)
-//      Else
-//	 Y_hi := Y_hi - 2^(-K)
-//      End If
-//   End If
 //
+// API
+//*********************************************************************
+// float expm1f(float)
+//
+// Overview of operation
+//*********************************************************************
+// 1. Inputs of Nan, Inf, Zero, NatVal handled with special paths
+//
+// 2. |x| < 2^-40
+//    Result = x, computed by x + x*x to handle appropriate flags and rounding
+//
+// 3. 2^-40 <= |x| < 2^-2
+//    Result determined by 8th order Taylor series polynomial
+//    expm1f(x) = x + A2*x^2 + ... + A8*x^8
+//
+// 4. x < -24.0
+//    Here we know result is essentially -1 + eps, where eps only affects
+//    rounded result.  Set I.
+//
+// 5. x >= 88.7228 
+//    Result overflows.  Set I, O, and call error support
+//
+// 6. 2^-2 <= x < 88.7228  or  -24.0 <= x < -2^-2  
+//    This is the main path.  The algorithm is described below:
+
+// Take the input x. w is "how many log2/128 in x?"
+//  w = x * 64/log2
+//  NJ = int(w)
+//  x = NJ*log2/64 + R
+
+//  NJ = 64*n + j
+//  x = n*log2 + (log2/64)*j + R
+//
+//  So, exp(x) = 2^n * 2^(j/64)* exp(R)
+//
+//  T =  2^n * 2^(j/64)
+//       Construct 2^n
+//       Get 2^(j/64) table
+//           actually all the entries of 2^(j/64) table are stored in DP and
+//           with exponent bits set to 0 -> multiplication on 2^n can be
+//           performed by doing logical "or" operation with bits presenting 2^n
+
+//  exp(R) = 1 + (exp(R) - 1)
+//  P = exp(R) - 1 approximated by Taylor series of 3rd degree
+//      P = A3*R^3 + A2*R^2 + R, A3 = 1/6, A2 = 1/2
+//
+
+//  The final result is reconstructed as follows
+//  expm1f(x) = T*P + (T - 1.0)
+
+// Special values
+//*********************************************************************
+// expm1f(+0)    = +0.0
+// expm1f(-0)    = -0.0
+
+// expm1f(+qnan) = +qnan
+// expm1f(-qnan) = -qnan
+// expm1f(+snan) = +qnan
+// expm1f(-snan) = -qnan
+
+// expm1f(-inf)  = -1.0
+// expm1f(+inf)  = +inf
+
+// Overflow and Underflow
+//*********************************************************************
+// expm1f(x) = largest single normal when
+//     x = 88.7228 = 0x42b17217
+//
+// Underflow is handled as described in case 2 above.
+
+
+// Registers used
+//*********************************************************************
+// Floating Point registers used:
+// f8, input
+// f6,f7, f9 -> f15,  f32 -> f45
+
+// General registers used:
+// r3, r20 -> r38
+
+// Predicate registers used:
+// p9 -> p15
+
+// Assembly macros
+//*********************************************************************
+// integer registers used
+// scratch
+rNJ                   = r3
+
+rExp_half             = r20
+rSignexp_x            = r21
+rExp_x                = r22
+rExp_mask             = r23
+rExp_bias             = r24
+rTmp                  = r25
+rM1_lim               = r25
+rGt_ln                = r25
+rJ                    = r26
+rN                    = r27
+rTblAddr              = r28
+rLn2Div64             = r29
+rRightShifter         = r30
+r64DivLn2             = r31
+// stacked
+GR_SAVE_PFS           = r32
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_Parameter_X        = r35
+GR_Parameter_Y        = r36
+GR_Parameter_RESULT   = r37
+GR_Parameter_TAG      = r38
+
+// floating point registers used
+FR_X                  = f10
+FR_Y                  = f1
+FR_RESULT             = f8
+// scratch
+fRightShifter         = f6
+f64DivLn2             = f7
+fNormX                = f9
+fNint                 = f10
+fN                    = f11
+fR                    = f12
+fLn2Div64             = f13
+fA2                   = f14
+fA3                   = f15
+// stacked
+fP                    = f32
+fX3                   = f33
+fT                    = f34
+fMIN_SGL_OFLOW_ARG    = f35
+fMAX_SGL_NORM_ARG     = f36
+fMAX_SGL_MINUS_1_ARG  = f37
+fA4                   = f38
+fA43                  = f38
+fA432                 = f38
+fRSqr                 = f39
+fA5                   = f40
+fTmp                  = f41
+fGt_pln               = f41
+fXsq                  = f41
+fA7                   = f42
+fA6                   = f43
+fA65                  = f43
+fTm1                  = f44
+fA8                   = f45
+fA87                  = f45
+fA8765                = f45
+fA8765432             = f45
+fWre_urm_f8           = f45
+
+RODATA
+.align 16
+LOCAL_OBJECT_START(_expf_table)
+data8 0x3efa01a01a01a01a // A8 = 1/8!
+data8 0x3f2a01a01a01a01a // A7 = 1/7!
+data8 0x3f56c16c16c16c17 // A6 = 1/6!
+data8 0x3f81111111111111 // A5 = 1/5!
+data8 0x3fa5555555555555 // A4 = 1/4!
+data8 0x3fc5555555555555 // A3 = 1/3!
+//
+data4 0x42b17218         // Smallest sgl arg to overflow sgl result
+data4 0x42b17217         // Largest sgl arg to give sgl result
+//
+// 2^(j/64) table, j goes from 0 to 63
+data8 0x0000000000000000 // 2^(0/64)
+data8 0x00002C9A3E778061 // 2^(1/64)
+data8 0x000059B0D3158574 // 2^(2/64)
+data8 0x0000874518759BC8 // 2^(3/64)
+data8 0x0000B5586CF9890F // 2^(4/64)
+data8 0x0000E3EC32D3D1A2 // 2^(5/64)
+data8 0x00011301D0125B51 // 2^(6/64)
+data8 0x0001429AAEA92DE0 // 2^(7/64)
+data8 0x000172B83C7D517B // 2^(8/64)
+data8 0x0001A35BEB6FCB75 // 2^(9/64)
+data8 0x0001D4873168B9AA // 2^(10/64)
+data8 0x0002063B88628CD6 // 2^(11/64)
+data8 0x0002387A6E756238 // 2^(12/64)
+data8 0x00026B4565E27CDD // 2^(13/64)
+data8 0x00029E9DF51FDEE1 // 2^(14/64)
+data8 0x0002D285A6E4030B // 2^(15/64)
+data8 0x000306FE0A31B715 // 2^(16/64)
+data8 0x00033C08B26416FF // 2^(17/64)
+data8 0x000371A7373AA9CB // 2^(18/64)
+data8 0x0003A7DB34E59FF7 // 2^(19/64)
+data8 0x0003DEA64C123422 // 2^(20/64)
+data8 0x0004160A21F72E2A // 2^(21/64)
+data8 0x00044E086061892D // 2^(22/64)
+data8 0x000486A2B5C13CD0 // 2^(23/64)
+data8 0x0004BFDAD5362A27 // 2^(24/64)
+data8 0x0004F9B2769D2CA7 // 2^(25/64)
+data8 0x0005342B569D4F82 // 2^(26/64)
+data8 0x00056F4736B527DA // 2^(27/64)
+data8 0x0005AB07DD485429 // 2^(28/64)
+data8 0x0005E76F15AD2148 // 2^(29/64)
+data8 0x0006247EB03A5585 // 2^(30/64)
+data8 0x0006623882552225 // 2^(31/64)
+data8 0x0006A09E667F3BCD // 2^(32/64)
+data8 0x0006DFB23C651A2F // 2^(33/64)
+data8 0x00071F75E8EC5F74 // 2^(34/64)
+data8 0x00075FEB564267C9 // 2^(35/64)
+data8 0x0007A11473EB0187 // 2^(36/64)
+data8 0x0007E2F336CF4E62 // 2^(37/64)
+data8 0x00082589994CCE13 // 2^(38/64)
+data8 0x000868D99B4492ED // 2^(39/64)
+data8 0x0008ACE5422AA0DB // 2^(40/64)
+data8 0x0008F1AE99157736 // 2^(41/64)
+data8 0x00093737B0CDC5E5 // 2^(42/64)
+data8 0x00097D829FDE4E50 // 2^(43/64)
+data8 0x0009C49182A3F090 // 2^(44/64)
+data8 0x000A0C667B5DE565 // 2^(45/64)
+data8 0x000A5503B23E255D // 2^(46/64)
+data8 0x000A9E6B5579FDBF // 2^(47/64)
+data8 0x000AE89F995AD3AD // 2^(48/64)
+data8 0x000B33A2B84F15FB // 2^(49/64)
+data8 0x000B7F76F2FB5E47 // 2^(50/64)
+data8 0x000BCC1E904BC1D2 // 2^(51/64)
+data8 0x000C199BDD85529C // 2^(52/64)
+data8 0x000C67F12E57D14B // 2^(53/64)
+data8 0x000CB720DCEF9069 // 2^(54/64)
+data8 0x000D072D4A07897C // 2^(55/64)
+data8 0x000D5818DCFBA487 // 2^(56/64)
+data8 0x000DA9E603DB3285 // 2^(57/64)
+data8 0x000DFC97337B9B5F // 2^(58/64)
+data8 0x000E502EE78B3FF6 // 2^(59/64)
+data8 0x000EA4AFA2A490DA // 2^(60/64)
+data8 0x000EFA1BEE615A27 // 2^(61/64)
+data8 0x000F50765B6E4540 // 2^(62/64)
+data8 0x000FA7C1819E90D8 // 2^(63/64)
+LOCAL_OBJECT_END(_expf_table)
 
-#include "libm_support.h"
-
-
-GR_SAVE_B0                    = r60
-GR_SAVE_PFS                   = r59
-GR_SAVE_GP                    = r61 
-
-GR_Parameter_X                = r62
-GR_Parameter_Y                = r63
-GR_Parameter_RESULT           = r64
-GR_Parameter_TAG              = r65
-
-FR_X             = f9
-FR_Y             = f1
-FR_RESULT        = f99
-
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-
-.align 64 
-Constants_exp_64_Arg:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Arg,@object)
-data4 0x5C17F0BC,0xB8AA3B29,0x0000400B,0x00000000 
-data4 0x00000000,0xB17217F4,0x00003FF2,0x00000000
-data4 0xF278ECE6,0xF473DE6A,0x00003FD4,0x00000000
-// /* Inv_L, L_hi, L_lo */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Arg)
-
-.align 64 
-Constants_exp_64_Exponents:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Exponents,@object)
-data4 0x0000007E,0x00000000,0xFFFFFF83,0xFFFFFFFF
-data4 0x000003FE,0x00000000,0xFFFFFC03,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0xFFFFFFE2,0xFFFFFFFF,0xFFFFFFC4,0xFFFFFFFF
-data4 0xFFFFFFBA,0xFFFFFFFF,0xFFFFFFBA,0xFFFFFFFF
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Exponents)
-
-.align 64 
-Constants_exp_64_A:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_A,@object)
-data4 0xB1B736A0,0xAAAAAAAB,0x00003FFA,0x00000000
-data4 0x90CD6327,0xAAAAAAAB,0x00003FFC,0x00000000
-data4 0xFFFFFFFF,0xFFFFFFFF,0x00003FFD,0x00000000
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_A)
-
-.align 64 
-Constants_exp_64_P:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_P,@object)
-data4 0x43914A8A,0xD00D6C81,0x00003FF2,0x00000000
-data4 0x30304B30,0xB60BC4AC,0x00003FF5,0x00000000
-data4 0x7474C518,0x88888888,0x00003FF8,0x00000000
-data4 0x8DAE729D,0xAAAAAAAA,0x00003FFA,0x00000000
-data4 0xAAAAAF61,0xAAAAAAAA,0x00003FFC,0x00000000
-data4 0x000004C7,0x80000000,0x00003FFE,0x00000000 
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_P)
-
-.align 64 
-Constants_exp_64_Q:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Q,@object)
-data4 0xA49EF6CA,0xD00D56F7,0x00003FEF,0x00000000
-data4 0x1C63493D,0xD00D59AB,0x00003FF2,0x00000000
-data4 0xFB50CDD2,0xB60B60B5,0x00003FF5,0x00000000
-data4 0x7BA68DC8,0x88888888,0x00003FF8,0x00000000
-data4 0xAAAAAC8D,0xAAAAAAAA,0x00003FFA,0x00000000
-data4 0xAAAAACCA,0xAAAAAAAA,0x00003FFC,0x00000000
-data4 0x00000000,0x80000000,0x00003FFE,0x00000000 
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Q)
-
-.align 64 
-Constants_exp_64_T1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T1,@object)
-data4 0x3F800000,0x3F8164D2,0x3F82CD87,0x3F843A29 
-data4 0x3F85AAC3,0x3F871F62,0x3F88980F,0x3F8A14D5 
-data4 0x3F8B95C2,0x3F8D1ADF,0x3F8EA43A,0x3F9031DC
-data4 0x3F91C3D3,0x3F935A2B,0x3F94F4F0,0x3F96942D
-data4 0x3F9837F0,0x3F99E046,0x3F9B8D3A,0x3F9D3EDA
-data4 0x3F9EF532,0x3FA0B051,0x3FA27043,0x3FA43516
-data4 0x3FA5FED7,0x3FA7CD94,0x3FA9A15B,0x3FAB7A3A
-data4 0x3FAD583F,0x3FAF3B79,0x3FB123F6,0x3FB311C4
-data4 0x3FB504F3,0x3FB6FD92,0x3FB8FBAF,0x3FBAFF5B
-data4 0x3FBD08A4,0x3FBF179A,0x3FC12C4D,0x3FC346CD
-data4 0x3FC5672A,0x3FC78D75,0x3FC9B9BE,0x3FCBEC15
-data4 0x3FCE248C,0x3FD06334,0x3FD2A81E,0x3FD4F35B
-data4 0x3FD744FD,0x3FD99D16,0x3FDBFBB8,0x3FDE60F5
-data4 0x3FE0CCDF,0x3FE33F89,0x3FE5B907,0x3FE8396A
-data4 0x3FEAC0C7,0x3FED4F30,0x3FEFE4BA,0x3FF28177
-data4 0x3FF5257D,0x3FF7D0DF,0x3FFA83B3,0x3FFD3E0C
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T1)
-
-.align 64 
-Constants_exp_64_T2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T2,@object)
-data4 0x3F800000,0x3F80058C,0x3F800B18,0x3F8010A4 
-data4 0x3F801630,0x3F801BBD,0x3F80214A,0x3F8026D7 
-data4 0x3F802C64,0x3F8031F2,0x3F803780,0x3F803D0E 
-data4 0x3F80429C,0x3F80482B,0x3F804DB9,0x3F805349 
-data4 0x3F8058D8,0x3F805E67,0x3F8063F7,0x3F806987 
-data4 0x3F806F17,0x3F8074A8,0x3F807A39,0x3F807FCA 
-data4 0x3F80855B,0x3F808AEC,0x3F80907E,0x3F809610 
-data4 0x3F809BA2,0x3F80A135,0x3F80A6C7,0x3F80AC5A 
-data4 0x3F80B1ED,0x3F80B781,0x3F80BD14,0x3F80C2A8 
-data4 0x3F80C83C,0x3F80CDD1,0x3F80D365,0x3F80D8FA 
-data4 0x3F80DE8F,0x3F80E425,0x3F80E9BA,0x3F80EF50 
-data4 0x3F80F4E6,0x3F80FA7C,0x3F810013,0x3F8105AA 
-data4 0x3F810B41,0x3F8110D8,0x3F81166F,0x3F811C07 
-data4 0x3F81219F,0x3F812737,0x3F812CD0,0x3F813269 
-data4 0x3F813802,0x3F813D9B,0x3F814334,0x3F8148CE 
-data4 0x3F814E68,0x3F815402,0x3F81599C,0x3F815F37
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T2)
-
-.align 64 
-Constants_exp_64_W1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W1,@object)
-data4 0x00000000,0x00000000,0x171EC4B4,0xBE384454
-data4 0x4AA72766,0xBE694741,0xD42518F8,0xBE5D32B6
-data4 0x3A319149,0x3E68D96D,0x62415F36,0xBE68F4DA
-data4 0xC9C86A3B,0xBE6DDA2F,0xF49228FE,0x3E6B2E50
-data4 0x1188B886,0xBE49C0C2,0x1A4C2F1F,0x3E64BFC2
-data4 0x2CB98B54,0xBE6A2FBB,0x9A55D329,0x3E5DC5DE
-data4 0x39A7AACE,0x3E696490,0x5C66DBA5,0x3E54728B
-data4 0xBA1C7D7D,0xBE62B0DB,0x09F1AF5F,0x3E576E04
-data4 0x1A0DD6A1,0x3E612500,0x795FBDEF,0xBE66A419
-data4 0xE1BD41FC,0xBE5CDE8C,0xEA54964F,0xBE621376
-data4 0x476E76EE,0x3E6370BE,0x3427EB92,0x3E390D1A 
-data4 0x2BF82BF8,0x3E1336DE,0xD0F7BD9E,0xBE5FF1CB 
-data4 0x0CEB09DD,0xBE60A355,0x0980F30D,0xBE5CA37E 
-data4 0x4C082D25,0xBE5C541B,0x3B467D29,0xBE5BBECA 
-data4 0xB9D946C5,0xBE400D8A,0x07ED374A,0xBE5E2A08 
-data4 0x365C8B0A,0xBE66CB28,0xD3403BCA,0x3E3AAD5B 
-data4 0xC7EA21E0,0x3E526055,0xE72880D6,0xBE442C75 
-data4 0x85222A43,0x3E58B2BB,0x522C42BF,0xBE5AAB79 
-data4 0x469DC2BC,0xBE605CB4,0xA48C40DC,0xBE589FA7 
-data4 0x1AA42614,0xBE51C214,0xC37293F4,0xBE48D087 
-data4 0xA2D673E0,0x3E367A1C,0x114F7A38,0xBE51BEBB 
-data4 0x661A4B48,0xBE6348E5,0x1D3B9962,0xBDF52643  
-data4 0x35A78A53,0x3E3A3B5E,0x1CECD788,0xBE46C46C 
-data4 0x7857D689,0xBE60B7EC,0xD14F1AD7,0xBE594D3D 
-data4 0x4C9A8F60,0xBE4F9C30,0x02DFF9D2,0xBE521873 
-data4 0x55E6D68F,0xBE5E4C88,0x667F3DC4,0xBE62140F 
-data4 0x3BF88747,0xBE36961B,0xC96EC6AA,0x3E602861 
-data4 0xD57FD718,0xBE3B5151,0xFC4A627B,0x3E561CD0 
-data4 0xCA913FEA,0xBE3A5217,0x9A5D193A,0x3E40A3CC 
-data4 0x10A9C312,0xBE5AB713,0xC5F57719,0x3E4FDADB 
-data4 0xDBDF59D5,0x3E361428,0x61B4180D,0x3E5DB5DB 
-data4 0x7408D856,0xBE42AD5F,0x31B2B707,0x3E2A3148 
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W1)
-
-.align 64 
-Constants_exp_64_W2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W2,@object)
-data4 0x00000000,0x00000000,0x37A3D7A2,0xBE641F25 
-data4 0xAD028C40,0xBE68DD57,0xF212B1B6,0xBE5C77D8 
-data4 0x1BA5B070,0x3E57878F,0x2ECAE6FE,0xBE55A36A 
-data4 0x569DFA3B,0xBE620608,0xA6D300A3,0xBE53B50E 
-data4 0x223F8F2C,0x3E5B5EF2,0xD6DE0DF4,0xBE56A0D9 
-data4 0xEAE28F51,0xBE64EEF3,0x367EA80B,0xBE5E5AE2 
-data4 0x5FCBC02D,0x3E47CB1A,0x9BDAFEB7,0xBE656BA0 
-data4 0x805AFEE7,0x3E6E70C6,0xA3415EBA,0xBE6E0509 
-data4 0x49BFF529,0xBE56856B,0x00508651,0x3E66DD33 
-data4 0xC114BC13,0x3E51165F,0xC453290F,0x3E53333D 
-data4 0x05539FDA,0x3E6A072B,0x7C0A7696,0xBE47CD87 
-data4 0xEB05C6D9,0xBE668BF4,0x6AE86C93,0xBE67C3E3 
-data4 0xD0B3E84B,0xBE533904,0x556B53CE,0x3E63E8D9 
-data4 0x63A98DC8,0x3E212C89,0x032A7A22,0xBE33138F 
-data4 0xBC584008,0x3E530FA9,0xCCB93C97,0xBE6ADF82 
-data4 0x8370EA39,0x3E5F9113,0xFB6A05D8,0x3E5443A4 
-data4 0x181FEE7A,0x3E63DACD,0xF0F67DEC,0xBE62B29D 
-data4 0x3DDE6307,0x3E65C483,0xD40A24C1,0x3E5BF030  
-data4 0x14E437BE,0x3E658B8F,0xED98B6C7,0xBE631C29 
-data4 0x04CF7C71,0x3E6335D2,0xE954A79D,0x3E529EED 
-data4 0xF64A2FB8,0x3E5D9257,0x854ED06C,0xBE6BED1B 
-data4 0xD71405CB,0x3E5096F6,0xACB9FDF5,0xBE3D4893 
-data4 0x01B68349,0xBDFEB158,0xC6A463B9,0x3E628D35 
-data4 0xADE45917,0xBE559725,0x042FC476,0xBE68C29C 
-data4 0x01E511FA,0xBE67593B,0x398801ED,0xBE4A4313 
-data4 0xDA7C3300,0x3E699571,0x08062A9E,0x3E5349BE 
-data4 0x755BB28E,0x3E5229C4,0x77A1F80D,0x3E67E426 
-data4 0x6B69C352,0xBE52B33F,0x084DA57F,0xBE6B3550 
-data4 0xD1D09A20,0xBE6DB03F,0x2161B2C1,0xBE60CBC4 
-data4 0x78A2B771,0x3E56ED9C,0x9D0FA795,0xBE508E31 
-data4 0xFD1A54E9,0xBE59482A,0xB07FD23E,0xBE2A17CE 
-data4 0x17365712,0x3E68BF5C,0xB3785569,0x3E3956F9
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W2)
 
 .section .text
-.proc expm1f#
-.global expm1f#
-.align 64 
-
-expm1f: 
-#ifdef _LIBC
-.global __expm1f#
-__expm1f:
-#endif
-
+GLOBAL_IEEE754_ENTRY(expm1f)
 
-{ .mii
-      alloc r32 = ar.pfs,0,30,4,0
-(p0)  add r33 = 1, r0  
-(p0)  cmp.eq.unc  p7, p0 =  r0, r0 
-}
-;;
-
-//
-//    Set p7 true for expm1
-//    Set Flag = r33 = 1 for expm1
-//    These are really no longer necesary, but are a remnant
-//       when this file had multiple entry points.
-//       They should be carefully removed
-
-
-{ .mfi
-(p0)  add r32 = 0,r0  
-(p0)  fnorm.s1 f9 = f8 
-	  nop.i 0
-}
-
-{ .mfi
-	  nop.m 0
-//
-//    Set p7 false for exp
-//    Set Flag = r33 = 0 for exp
-//    
-(p0)  fclass.m.unc p6, p8 =  f8, 0x1E7 
-	  nop.i 0 ;;
+{ .mlx
+      getf.exp        rSignexp_x = f8      // Must recompute if x unorm
+      movl            r64DivLn2 = 0x40571547652B82FE // 64/ln(2)
 }
-
-{ .mfi
-	nop.m 999
-(p0)  fclass.nm.unc p9, p0 =  f8, 0x1FF 
-	 nop.i 0 
+{ .mlx
+      addl            rTblAddr = @ltoff(_expf_table),gp
+      movl            rRightShifter = 0x43E8000000000000 // DP Right Shifter
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  mov f36 = f1 
-	nop.i 999 ;;
-}
-
-//     
-//    Identify NatVals, NaNs, Infs, and Zeros. 
-//    Identify EM unsupporteds. 
-//    Save special input registers 
-//
-//    Create FR_X_cor      = 0.0 
-//           GR_Flag       = 0 
-//           GR_Expo_Range = 0 (r32) for single precision 
-//           FR_Scale      = 1.0
-//
-
-{ .mfb
-	nop.m 999
-(p0)  mov f32 = f0 
-(p6)  br.cond.spnt EXPF_64_SPECIAL ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p9)  br.cond.spnt EXPF_64_UNSUPPORTED ;; 
+      // point to the beginning of the table
+      ld8             rTblAddr = [rTblAddr]
+      fclass.m        p14, p0 = f8 , 0x22  // test for -INF
+      mov             rExp_mask = 0x1ffff   // Exponent mask
 }
-
-//     
-//    Branch out for special input values 
-//     
-
 { .mfi
-(p0)  cmp.ne.unc p12, p13 = 0x01, r33
-(p0)  fcmp.lt.unc.s0 p9,p0 =  f8, f0 
-(p0)  cmp.eq.unc  p15, p0 =  r0, r0 
-}
-
-//     
-//    Raise possible denormal operand exception 
-//    Normalize x 
-//     
-//    This function computes expf( x  + x_cor) 
-//    Input  FR 1: FR_X            
-//    Input  FR 2: FR_X_cor  
-//    Input  GR 1: GR_Flag  
-//    Input  GR 2: GR_Expo_Range  
-//    Output FR 3: FR_Y_hi  
-//    Output FR 4: FR_Y_lo  
-//    Output FR 5: FR_Scale  
-//    Output PR 1: PR_Safe  
-
-//
-//    Prepare to load constants
-//    Set Safe = True
-//
-
-{ .mmi
-(p0)  addl r34 = @ltoff(Constants_exp_64_Arg#),gp  
-(p0)  addl r40 = @ltoff(Constants_exp_64_W1#),gp 
-(p0)  addl r41 = @ltoff(Constants_exp_64_W2#),gp  
-};;
-
-{ .mmi
-      ld8 r34 = [r34]
-      ld8 r40 = [r40]
-(p0)  addl           r50   = @ltoff(Constants_exp_64_T1#),  gp
+      nop.m           0
+      fnorm.s1        fNormX = f8 // normalized x
+      nop.i           0
 }
 ;;
-{ .mmi
-      ld8 r41  = [r41]
-(p0)  ldfe f37 = [r34],16
-(p0)  addl           r51   = @ltoff(Constants_exp_64_T2#),  gp
-}
-;;
-//
-//    N = fcvt.fx(float_N)
-//    Set p14 if -6 > expo_X 
-//
-//
-//    Bias = 0x0FFFF
-//    expo_X = expo_X and Mask  
-//
 
-{ .mmi
-      ld8  r50 = [r50]
-(p0)  ldfe f40 = [r34],16 
-      nop.i 999
+{ .mfi
+      setf.d          f64DivLn2 = r64DivLn2 // load 64/ln(2) to FP reg
+      fclass.m        p9, p0 = f8 , 0x0b    // test for x unorm
+      mov             rExp_bias = 0xffff    // Exponent bias
 }
-;;
-
-{ .mlx
-      nop.m 999
-(p0)  movl r58 = 0x0FFFF 
-};;
-
-//
-//    Load W2_ptr
-//    Branch to SMALL is expo_X < -6
-//
-//
-//    float_N = X * L_Inv
-//    expo_X = exponent of X
-//    Mask = 0x1FFFF
-//
-
-{ .mmi
-      ld8  r51 = [r51]
-(p0)  ldfe f41 = [r34],16 
-//
-//    float_N = X * L_Inv
-//    expo_X = exponent of X
-//    Mask = 0x1FFFF
-//
-      nop.i 0
-};;
-
 { .mlx
-(p0)  addl r34   = @ltoff(Constants_exp_64_Exponents#),  gp
-(p0)  movl r39 = 0x1FFFF  
+      // load Right Shifter to FP reg
+      setf.d          fRightShifter = rRightShifter
+      movl            rLn2Div64 = 0x3F862E42FEFA39EF // DP ln(2)/64 in GR
 }
 ;;
 
-{ .mmi
-      ld8 r34 = [r34]
-(p0)  getf.exp r37 = f9 
-      nop.i 999
-}
-;;
-
-{ .mii
-      nop.m 999
-      nop.i 999 
-(p0)  and  r37 = r37, r39 ;;  
-}
-
-{ .mmi
-(p0)  sub r37 = r37, r58 ;;  
-(p0)  cmp.gt.unc  p14, p0 =  -6, r37 
-(p0)  cmp.lt.unc  p10, p0 =  14, r37 ;; 
-}
-
 { .mfi
-	nop.m 999
-//
-//    Load L_inv 
-//    Set p12 true for Flag = 0 (exp)
-//    Set p13 true for Flag = 1 (expm1)
-//
-(p0)  fmpy.s1 f38 = f9, f37 
-	nop.i 999 ;;
+      ldfpd           fA8, fA7 = [rTblAddr], 16
+      fcmp.eq.s1      p13, p0 = f0, f8      // test for x = 0.0
+      mov             rExp_half = 0xfffe
 }
-
 { .mfb
-	nop.m 999
-//
-//    Load L_hi
-//    expo_X = expo_X - Bias
-//    get W1_ptr      
-//
-(p0)  fcvt.fx.s1 f39 = f38
-(p14) br.cond.spnt EXPF_SMALL ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p10) br.cond.spnt EXPF_HUGE ;; 
-}
-
-{ .mmi
-(p0)  shladd r34 = r32,4,r34 
-(p0)  addl r35 = @ltoff(Constants_exp_64_A#),gp  
-      nop.i 999
+      setf.d          fLn2Div64 = rLn2Div64 // load ln(2)/64 to FP reg
+      nop.f           0
+(p9)  br.cond.spnt    EXPM1_UNORM // Branch if x unorm
 }
 ;;
 
-{ .mmi
-      ld8 r35 = [r35]
-      nop.m 999
-      nop.i 999
+EXPM1_COMMON:
+{ .mfb
+      ldfpd           fA6, fA5 = [rTblAddr], 16
+(p14) fms.s.s0        f8 = f0, f0, f1       // result if x = -inf
+(p14) br.ret.spnt     b0                    // exit here if x = -inf
 }
 ;;
 
-//
-//    Load T_1,T_2
-//
-
-{ .mmb
-(p0)  ldfe f51 = [r35],16 
-(p0)  ld8 r45 = [r34],8
-	nop.b 999 ;;
-}
-//    
-//    Set Safe = True  if k >= big_expo_neg  
-//    Set Safe = False if k < big_expo_neg  
-//    
-
-{ .mmb
-(p0)  ldfe f49 = [r35],16 
-(p0)  ld8 r48 = [r34],0
-	nop.b 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Branch to HUGE is expo_X > 14 
-//
-(p0)  fcvt.xf f38 = f39 
-	nop.i 999 ;;
-}
-
-{ .mfi
-(p0)  getf.sig r52 = f39 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mii
-	nop.m 999
-(p0)  extr.u r43 = r52, 6, 6 ;;  
-//
-//    r = r - float_N * L_lo
-//    K = extr(N_fix,12,52)
-//
-(p0)  shladd r40 = r43,3,r40 ;; 
-}
-
-{ .mfi
-(p0)  shladd r50 = r43,2,r50 
-(p0)  fnma.s1 f42 = f40, f38, f9 
-//
-//    float_N = float(N)
-//    N_fix = signficand N 
-//
-(p0)  extr.u r42 = r52, 0, 6  
-}
-
-{ .mmi
-(p0)  ldfd  f43 = [r40],0 ;; 
-(p0)  shladd r41 = r42,3,r41 
-(p0)  shladd r51 = r42,2,r51 
-}
-//
-//    W_1_p1 = 1 + W_1
-//
-
-{ .mmi
-(p0)  ldfs  f44 = [r50],0 ;; 
-(p0)  ldfd  f45 = [r41],0 
-//
-//    M_2 = extr(N_fix,0,6)
-//    M_1 = extr(N_fix,6,6)
-//    r = X - float_N * L_hi
-//
-(p0)  extr r44 = r52, 12, 52  
-}
-
-{ .mmi
-(p0)  ldfs  f46 = [r51],0 ;; 
-(p0)  sub r46 = r58, r44  
-(p0)  cmp.gt.unc  p8, p15 =  r44, r45 
-}
-//    
-//    W = W_1 + W_1_p1*W_2 
-//    Load  A_2 
-//    Bias_m_K = Bias - K
-//
-
-{ .mii
-(p0)  ldfe f40 = [r35],16 
-//
-//    load A_1
-//    poly = A_2 + r*A_3 
-//    rsq = r * r  
-//    neg_2_mK = exponent of Bias_m_k
-//
-(p0)  add r47 = r58, r44 ;;  
-//    
-//    Set Safe = True  if k <= big_expo_pos  
-//    Set Safe = False  if k >  big_expo_pos  
-//    Load A_3
-//    
-(p15) cmp.lt p8,p15 = r44,r48 ;;
-}
-
-{ .mmf
-(p0)  setf.exp f61 = r46 
-//    
-//    Bias_p + K = Bias + K
-//    T = T_1 * T_2
-//    
-(p0)  setf.exp f36 = r47 
-(p0)  fnma.s1 f42 = f41, f38, f42 ;; 
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Load W_1,W_2
-//    Load big_exp_pos, load big_exp_neg
-//
-(p0)  fadd.s1 f47 = f43, f1 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 f52 = f42, f51, f49 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fmpy.s1 f48 = f42, f42 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fmpy.s1 f53 = f44, f46 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 f54 = f45, f47, f43 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fneg f61 =  f61 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 f52 = f42, f52, f40 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fadd.s1 f55 = f54, f1 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-//
-//    W + Wp1 * poly     
-// 
-(p0)  mov f34 = f53 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    A_1 + r * poly 
-//    Scale = setf_expf(Bias_p_k) 
-//
-(p0)  fma.s1 f52 = f48, f52, f42 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    poly = r + rsq(A_1 + r*poly) 
-//    Wp1 = 1 + W
-//    neg_2_mK = -neg_2_mK
-//
-(p0)  fma.s1 f35 = f55, f52, f54
-	nop.i 999 ;;
-}
-
 { .mfb
-	nop.m 999
-(p0)  fmpy.s1 f35 = f35, f53 
-//   
-//    Y_hi = T
-//    Y_lo = T * (W + Wp1*poly)
-//
-(p12) br.cond.sptk EXPF_MAIN ;; 
+      ldfpd           fA4, fA3 = [rTblAddr], 16
+      fclass.m        p15, p0 = f8 , 0x1e1  // test for NaT,NaN,+Inf
+(p13) br.ret.spnt     b0                    // exit here if x =0.0, result is x
 }
-//
-//    Branch if expf(x)  
-//    Continue for expf(x-1)
-//
-
-{ .mii
-(p0)  cmp.lt.unc  p12, p13 =  10, r44 
-	nop.i 999 ;;
-//
-//    Set p12 if 10 < K, Else p13 
-//
-(p13) cmp.gt.unc  p13, p14 =  -10, r44 ;; 
-}
-//
-//    K > 10:  Y_lo = Y_lo + neg_2_mK
-//    K <=10:  Set p13 if -10 > K, Else set p14 
-//
+;;
 
 { .mfi
-(p13) cmp.eq  p15, p0 =  r0, r0 
-(p14) fadd.s1 f34 = f61, f34 
-	nop.i 999 ;;
+      // overflow thresholds
+      ldfps           fMIN_SGL_OFLOW_ARG, fMAX_SGL_NORM_ARG = [rTblAddr], 8
+      fma.s1          fXsq = fNormX, fNormX, f0      // x^2 for small path
+      and             rExp_x = rExp_mask, rSignexp_x // Biased exponent of x
 }
-
-{ .mfi
-	nop.m 999
-(p12) fadd.s1 f35 = f35, f61 
-	nop.i 999 ;;
+{ .mlx
+      nop.m           0
+      movl            rM1_lim = 0xc1c00000  // Minus -1 limit (-24.0), SP
 }
+;;
 
 { .mfi
-	nop.m 999
-(p13) fadd.s1 f35 = f35, f34 
-	nop.i 999
+      setf.exp        fA2 = rExp_half
+      // x*(64/ln(2)) + Right Shifter
+      fma.s1          fNint = fNormX, f64DivLn2, fRightShifter
+      sub             rExp_x = rExp_x, rExp_bias     // True exponent of x
 }
-
 { .mfb
-	nop.m 999
-//
-//    K <= 10 and K < -10, Set Safe = True
-//    K <= 10 and K < 10,   Y_lo = Y_hi + Y_lo 
-//    K <= 10 and K > =-10, Y_hi = Y_hi + neg_2_mk 
-// 
-(p13) mov f34 = f61 
-(p0)  br.cond.sptk EXPF_MAIN ;; 
-}
-EXPF_SMALL: 
-{ .mmi
-(p12)  addl           r35   = @ltoff(Constants_exp_64_P#), gp
-(p0)   addl           r34   = @ltoff(Constants_exp_64_Exponents#), gp
-      nop.i 999
-}
-;;
-
-{ .mmi
-(p12) ld8 r35 = [r35]
-      ld8 r34 = [r34]
-      nop.i 999
+      nop.m           0
+(p15) fma.s.s0        f8 = f8, f1, f0       // result if x = NaT,NaN,+Inf
+(p15) br.ret.spnt     b0                    // exit here if x = NaT,NaN,+Inf
 }
 ;;
 
-
-{ .mmi
-(p13)  addl           r35   = @ltoff(Constants_exp_64_Q#), gp
-       nop.m 999
-       nop.i 999
-}
-;;
-
-
-//
-//    Return
-//    K <= 10 and K < 10,   Y_hi = neg_2_mk
-//
-//    /*******************************************************/
-//    /*********** Branch EXP_SMALL  *************************/
-//    /*******************************************************/
-
 { .mfi
-(p13) ld8 r35 = [r35]
-(p0)  mov f42 = f9 
-(p0)  add r34 = 0x48,r34  
+      setf.s          fMAX_SGL_MINUS_1_ARG = rM1_lim // -1 threshold, -24.0
+      nop.f           0
+      cmp.gt          p7, p8 = -2, rExp_x      // Test |x| < 2^(-2)
 }
 ;;
 
-//
-//    Flag = 0
-//    r4 = rsq * rsq
-//
-
 { .mfi
-(p0)  ld8 r49 =[r34],0
-	nop.f 999
-	nop.i 999 ;;
+(p7)  cmp.gt.unc      p6, p7 = -40, rExp_x     // Test |x| < 2^(-40)
+      fma.s1          fA87 = fA8, fNormX, fA7  // Small path, A8*x+A7
+      nop.i           0
 }
-
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    Flag = 1
-//
-(p0)  cmp.lt.unc  p14, p0 =  r37, r49 ;; 
-}
-
 { .mfi
-	nop.m 999
-//
-//    r = X
-//
-(p0)  fmpy.s1 f48 = f42, f42 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fA65 = fA6, fNormX, fA5  // Small path, A6*x+A5
+      nop.i           0
 }
+;;
 
 { .mfb
-	nop.m 999
-//
-//    rsq = r * r
-//
-(p0)  fmpy.s1 f50 = f48, f48 
-//
-//    Is input very small?
-//
-(p14) br.cond.spnt EXPF_VERY_SMALL ;; 
-}
-//
-//    Flag_not1: Y_hi = 1.0
-//    Flag is 1: r6 = rsq * r4
-//
-
-{ .mfi
-(p12) ldfe f52 = [r35],16 
-(p12) mov f34 = f1 
-(p0)  add r53 = 0x1,r0 ;;  
-}
-
-{ .mfi
-(p13) ldfe f51 = [r35],16 
-//
-//    Flag_not_1: Y_lo = poly_hi + r4 * poly_lo
-//
-(p13) mov f34 = f9 
-	nop.i 999 ;;
-}
-
-{ .mmf
-(p12) ldfe f53 = [r35],16 
-//
-//    For Flag_not_1, Y_hi = X
-//    Scale = 1
-//    Create 0x000...01
-//
-(p0)  setf.sig f37 = r53 
-(p0)  mov f36 = f1 ;; 
-}
-
-{ .mmi
-(p13) ldfe f52 = [r35],16 ;; 
-(p12) ldfe f54 = [r35],16 
-	nop.i 999 ;;
-}
-
-{ .mfi
-(p13) ldfe f53 = [r35],16 
-(p13) fmpy.s1 f58 = f48, f50 
-	nop.i 999 ;;
-}
-//
-//    Flag_not1: poly_lo = P_5 + r*P_6
-//    Flag_1: poly_lo = Q_6 + r*Q_7
-//
-
-{ .mmi
-(p13) ldfe f54 = [r35],16 ;; 
-(p12) ldfe f55 = [r35],16 
-	nop.i 999 ;;
-}
-
-{ .mmi
-(p12) ldfe f56 = [r35],16 ;; 
-(p13) ldfe f55 = [r35],16 
-	nop.i 999 ;;
-}
-
-{ .mmi
-(p12) ldfe f57 = [r35],0 ;; 
-(p13) ldfe f56 = [r35],16 
-	nop.i 999 ;;
-}
-
-{ .mfi
-(p13) ldfe f57 = [r35],0 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    For  Flag_not_1, load p5,p6,p1,p2
-//    Else load p5,p6,p1,p2
-//
-(p12) fma.s1 f60 = f52, f42, f53 
-	nop.i 999 ;;
+      nop.m           0
+(p6)  fma.s.s0        f8 = f8, f8, f8          // If x < 2^-40, result=x+x*x
+(p6)  br.ret.spnt     b0                       // Exit if x < 2^-40
 }
+;;
 
 { .mfi
-	nop.m 999
-(p13) fma.s1 f60 = f51, f42, f52 
-	nop.i 999 ;;
+      nop.m           0
+      // check for overflow
+      fcmp.gt.s1      p15, p14 = fNormX, fMIN_SGL_OFLOW_ARG
+      nop.i           0
 }
-
 { .mfi
-	nop.m 999
-(p12) fma.s1 f60 = f60, f42, f54 
-	nop.i 999 ;;
+      nop.m           0
+      fms.s1          fN = fNint, f1, fRightShifter // n in FP register
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p12) fma.s1 f59 = f56, f42, f57 
-	nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s1          fA43 = fA4, fNormX, fA3   // Small path, A4*x+A3
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p13) fma.s1 f60 = f42, f60, f53 
-	nop.i 999 ;;
+      getf.sig        rNJ = fNint               // bits of n, j
+(p7)  fma.s1          fA8765 = fA87, fXsq, fA65 // Small path, A87*xsq+A65
+      nop.i           0
 }
-
-{ .mfi
-	nop.m 999
-(p12) fma.s1 f59 = f59, f48, f42 
-	nop.i 999 ;;
+{ .mfb
+      nop.m           0
+(p7)  fma.s1          fX3 = fXsq, fNormX, f0    // Small path, x^3
+      // branch out if overflow
+(p15) br.cond.spnt    EXPM1_CERTAIN_OVERFLOW
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Flag_1: poly_lo = Q_5 + r*(Q_6 + r*Q_7) 
-//    Flag_not1: poly_lo = P_4 + r*(P_5 + r*P_6)
-//    Flag_not1: poly_hi = (P_1 + r*P_2)
-//
-(p13) fmpy.s1 f60 = f60, f58 
-	nop.i 999 ;;
+      addl            rN = 0xffff-63, rNJ    // biased and shifted n
+      fnma.s1         fR = fLn2Div64, fN, fNormX // R = x - N*ln(2)/64
+      extr.u          rJ = rNJ , 0 , 6       // bits of j
 }
+;;
 
 { .mfi
-	nop.m 999
-(p12) fma.s1 f60 = f60, f42, f55 
-	nop.i 999 ;;
+      shladd          rJ = rJ, 3, rTblAddr   // address in the 2^(j/64) table
+      // check for certain -1
+      fcmp.le.s1      p13, p0 = fNormX, fMAX_SGL_MINUS_1_ARG
+      shr             rN = rN, 6             // biased n
 }
-
 { .mfi
-	nop.m 999
-//
-//    Flag_1: poly_lo = r6 *(Q_5 + ....)
-//    Flag_not1: poly_hi =  r + rsq *(P_1 + r*P_2)
-//
-(p12) fma.s1 f35 = f60, f50, f59 
-	nop.i 999
+      nop.m           0
+(p7)  fma.s1          fA432 = fA43, fNormX, fA2 // Small path, A43*x+A2
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p13) fma.s1 f59 = f54, f42, f55 
-	nop.i 999 ;;
+      ld8             rJ = [rJ]
+      nop.f           0
+      shl             rN = rN , 52           // 2^n bits in DP format
 }
+;;
 
-{ .mfi
-	nop.m 999
-//
-//    Flag_not1: Y_lo = rsq* poly_hi + poly_lo 
-//    Flag_1: poly_lo = rsq* poly_hi + poly_lo 
-//
-(p13) fma.s1 f59 = f59, f42, f56 
-	nop.i 999 ;;
+{ .mmi
+      or              rN = rN, rJ        // bits of 2^n * 2^(j/64) in DP format
+(p13) mov             rTmp = 1           // Make small value for -1 path
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Flag_not_1: (P_1 + r*P_2) 
-//
-(p13) fma.s1 f59 = f59, f42, f57 
-	nop.i 999 ;;
+      setf.d          fT = rN            // 2^n
+      // check for possible overflow (only happens if input higher precision)
+(p14) fcmp.gt.s1      p14, p0 = fNormX, fMAX_SGL_NORM_ARG
+      nop.i           0
 }
-
 { .mfi
-	nop.m 999
-//
-//    Flag_not_1: poly_hi = r + rsq * (P_1 + r*P_2) 
-//
-(p13) fma.s1 f35 = f59, f48, f60 
-	nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s1          fA8765432 = fA8765, fX3, fA432 // A8765*x^3+A432
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Create 0.000...01
-//
-(p0)  for f37 = f35, f37 
-	nop.i 999 ;;
+(p13) setf.exp        fTmp = rTmp        // Make small value for -1 path
+      fma.s1          fP = fA3, fR, fA2  // A3*R + A2
+      nop.i           0
 }
-
 { .mfb
-	nop.m 999
-//
-//    Set lsb of Y_lo to 1
-//
-(p0)  fmerge.se f35 = f35,f37 
-(p0)  br.cond.sptk EXPF_MAIN ;; 
-}
-EXPF_VERY_SMALL: 
-
-{ .mmi
-      nop.m 999
-(p13) addl r34 = @ltoff(Constants_exp_64_Exponents#),gp
-      nop.i 999;;
-}
-
-{ .mfi
-(p13) ld8  r34 = [r34];
-(p12) mov f35 = f9
-      nop.i 999 ;;
+      nop.m           0
+      fma.s1          fRSqr = fR, fR, f0 // R^2
+(p13) br.cond.spnt    EXPM1_CERTAIN_MINUS_ONE // Branch if x < -24.0
 }
+;;
 
 { .mfb
-	nop.m 999
-(p12) mov f34 = f1 
-(p12) br.cond.sptk EXPF_MAIN ;; 
-}
-
-{ .mlx
-(p13) add  r34 = 8,r34 
-(p13) movl r39 = 0x0FFFE ;; 
-}
-//
-//    Load big_exp_neg 
-//    Create 1/2's exponent
-//
-
-{ .mii
-(p13) setf.exp f56 = r39 
-(p13) shladd r34 = r32,4,r34 ;;  
-	nop.i 999
-}
-//
-//    Negative exponents are stored after positive
-//
-
-{ .mfi
-(p13) ld8 r45 = [r34],0
-//
-//    Y_hi = x
-//    Scale = 1
-//
-(p13) fmpy.s1 f35 = f9, f9 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Reset Safe if necessary 
-//    Create 1/2
-//
-(p13) mov f34 = f9 
-	nop.i 999 ;;
+      nop.m           0
+(p7)  fma.s.s0        f8 = fA8765432, fXsq, fNormX // Small path, 
+                                         // result=xsq*A8765432+x
+(p7)  br.ret.spnt     b0                 // Exit if 2^-40 <= |x| < 2^-2
 }
+;;
 
 { .mfi
-(p13) cmp.lt.unc  p0, p15 =  r37, r45 
-(p13) mov f36 = f1 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s1          fP = fP, fRSqr, fR // P = (A3*R + A2)*Rsqr + R
+      nop.i           0
 }
+;;
 
 { .mfb
-	nop.m 999
-//
-//    Y_lo = x * x
-//
-(p13) fmpy.s1 f35 = f35, f56 
-//
-//    Y_lo = x*x/2 
-//
-(p13) br.cond.sptk EXPF_MAIN ;; 
-}
-EXPF_HUGE: 
-
-{ .mfi
-	nop.m 999
-(p0)  fcmp.gt.unc.s1 p14, p0 =  f9, f0 
-	nop.i 999
-}
-
-{ .mlx
-	nop.m 999
-(p0)  movl r39 = 0x15DC0 ;; 
-}
-
-{ .mfi
-(p14) setf.exp f34 = r39 
-(p14) mov f35 = f1 
-(p14) cmp.eq  p0, p15 =  r0, r0 ;; 
+      nop.m           0
+      fms.s1          fTm1 = fT, f1, f1  // T - 1.0
+(p14) br.cond.spnt    EXPM1_POSSIBLE_OVERFLOW
 }
+;;
 
 { .mfb
-	nop.m 999
-(p14) mov f36 = f34 
-//
-//    If x > 0, Set Safe = False
-//    If x > 0, Y_hi = 2**(24,000)
-//    If x > 0, Y_lo = 1.0
-//    If x > 0, Scale = 2**(24,000)
-//
-(p14) br.cond.sptk EXPF_MAIN ;; 
-}
-
-{ .mlx
-	nop.m 999
-(p12) movl r39 = 0xA240 
-}
-
-{ .mlx
-	nop.m 999
-(p12) movl r38 = 0xA1DC ;; 
-}
-
-{ .mmb
-(p13) cmp.eq  p15, p14 =  r0, r0 
-(p12) setf.exp f34 = r39 
-	nop.b 999 ;;
-}
-
-{ .mlx
-(p12) setf.exp f35 = r38 
-(p13) movl r39 = 0xFF9C 
-}
-
-{ .mfi
-	nop.m 999
-(p13) fsub.s1 f34 = f0, f1
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p12) mov f36 = f34 
-(p12) cmp.eq  p0, p15 =  r0, r0 ;; 
-}
-
-{ .mfi
-(p13) setf.exp f35 = r39 
-(p13) mov f36 = f1 
-	nop.i 999 ;;
-}
-EXPF_MAIN: 
-
-{ .mfi
-(p0)  cmp.ne.unc p12, p0 = 0x01, r33
-(p0)  fmpy.s1 f101 = f36, f35 
-	nop.i 999 ;;
+      nop.m           0
+      fma.s.s0        f8 = fP, fT, fTm1
+      br.ret.sptk     b0                 // Result for main path
+                                         // minus_one_limit < x < -2^-2
+                                         // and +2^-2 <= x < overflow_limit
 }
+;;
 
+// Here if x unorm
+EXPM1_UNORM:
 { .mfb
-	nop.m 999
-(p0)  fma.s.s0 f99 = f34, f36, f101 
-(p15) br.cond.sptk EXPF_64_RETURN ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fsetc.s3 0x7F,0x01
-	nop.i 999
-}
-
-{ .mlx
-	nop.m 999
-(p0)  movl r50 = 0x0000000001007F ;;
-}
-//    
-//    S0 user supplied status
-//    S2 user supplied status + WRE + TD  (Overflows) 
-//    S3 user supplied status + RZ + TD   (Underflows) 
-//    
-//    
-//    If (Safe) is true, then
-//        Compute result using user supplied status field.
-//        No overflow or underflow here, but perhaps inexact.
-//        Return
-//    Else
-//       Determine if overflow or underflow  was raised.
-//       Fetch +/- overflow threshold for IEEE single, double,
-//       double extended   
-//    
-
-{ .mfi
-(p0)  setf.exp f60 = r50
-(p0)  fma.s.s3 f102 = f34, f36, f101 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fsetc.s3 0x7F,0x40 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    For Safe, no need to check for over/under. 
-//    For expm1, handle errors like exp. 
-//
-(p0)  fsetc.s2 0x7F,0x42
-	nop.i 999;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s.s2 f100 = f34, f36, f101 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fsetc.s2 0x7F,0x40 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p7)  fclass.m.unc   p12, p0 =  f102, 0x00F
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc   p11, p0 =  f102, 0x00F
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p7)  fcmp.ge.unc.s1 p10, p0 =  f100, f60
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-//    
-//    Create largest double exponent + 1.
-//    Create smallest double exponent - 1.
-//    
-(p0)  fcmp.ge.unc.s1 p8, p0 =  f100, f60
-	nop.i 999 ;;
+      getf.exp        rSignexp_x = fNormX // Must recompute if x unorm
+      fcmp.eq.s0      p6, p0 = f8, f0     // Set D flag
+      br.cond.sptk    EXPM1_COMMON
 }
-//    
-//    fcmp:   resultS2 >= + overflow threshold  -> set (a) if true
-//    fcmp:   resultS2 <= - overflow threshold  -> set (b) if true
-//    fclass: resultS3 is denorm/unorm/0        -> set (d) if true
-//    
-
-{ .mib
-(p10) mov   GR_Parameter_TAG = 43
-	nop.i 999
-(p10) br.cond.sptk __libm_error_region ;;
-}
-
-{ .mib
-(p8)  mov   GR_Parameter_TAG = 16
-	nop.i 999
-(p8)  br.cond.sptk __libm_error_region ;;
-}
-//    
-//    Report that exp overflowed
-//    
+;;
 
-{ .mib
-(p12) mov   GR_Parameter_TAG = 44
-	nop.i 999
-(p12) br.cond.sptk __libm_error_region ;;
+// here if result will be -1 and inexact, x <= -24.0
+EXPM1_CERTAIN_MINUS_ONE:
+{ .mfb
+      nop.m           0
+      fms.s.s0        f8 = fTmp, fTmp, f1  // Result -1, and Inexact set
+      br.ret.sptk     b0
 }
+;;
 
-{ .mib
-(p11) mov   GR_Parameter_TAG = 17
-	nop.i 999
-(p11) br.cond.sptk __libm_error_region ;;
-}
+EXPM1_POSSIBLE_OVERFLOW:
 
-{ .mib
-	nop.m 999
-	nop.i 999
-//    
-//    Report that exp underflowed
-//    
-(p0)  br.cond.sptk EXPF_64_RETURN ;;
-}
-EXPF_64_SPECIAL: 
+// Here if fMAX_SGL_NORM_ARG < x < fMIN_SGL_OFLOW_ARG
+// This cannot happen if input is a single, only if input higher precision.
+// Overflow is a possibility, not a certainty.
 
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p6,  p0 =  f8, 0x0c3 
-	nop.i 999
-}
+// Recompute result using status field 2 with user's rounding mode,
+// and wre set.  If result is larger than largest single, then we have
+// overflow
 
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc p13, p8 =  f8, 0x007 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p7)  fclass.m.unc p14, p0 =  f8, 0x007 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p12, p9 =  f8, 0x021 
-	nop.i 999 ;;
+      mov             rGt_ln  = 0x1007f // Exponent for largest sgl + 1 ulp
+      fsetc.s2        0x7F,0x42         // Get user's round mode, set wre
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc p11, p0 =  f8, 0x022 
-	nop.i 999
+      setf.exp        fGt_pln = rGt_ln  // Create largest single + 1 ulp
+      fma.s.s2        fWre_urm_f8 = fP, fT, fTm1  // Result with wre set
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc p10, p0 =  f8, 0x022 
-	nop.i 999 ;;
+      nop.m           0
+      fsetc.s2        0x7F,0x40                   // Turn off wre in sf2
+      nop.i           0
 }
+;;
 
 { .mfi
-	nop.m 999
-//    
-//    Identify +/- 0, Inf, or -Inf 
-//    Generate the right kind of NaN.
-//    
-(p13) fadd.s.s0 f99 = f0, f1 
-	nop.i 999 ;;
+      nop.m           0
+      fcmp.ge.s1      p6, p0 =  fWre_urm_f8, fGt_pln // Test for overflow
+      nop.i           0
 }
+;;
 
-{ .mfi
-	nop.m 999
-(p14) mov f99 = f8 
-	nop.i 999 ;;
+{ .mfb
+      nop.m           0
+      nop.f           0
+(p6)  br.cond.spnt    EXPM1_CERTAIN_OVERFLOW // Branch if overflow
 }
+;;
 
 { .mfb
-	nop.m 999
-(p6)  fadd.s.s0 f99 = f8, f1 
-//    
-//    expf(+/-0) = 1 
-//    expm1f(+/-0) = +/-0 
-//    No exceptions raised
-//    
-(p6)  br.cond.sptk EXPF_64_RETURN ;;
+      nop.m           0
+      fma.s.s0        f8 = fP, fT, fTm1
+      br.ret.sptk     b0                     // Exit if really no overflow
 }
+;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-(p14)  br.cond.sptk EXPF_64_RETURN ;;
+// here if overflow
+EXPM1_CERTAIN_OVERFLOW:
+{ .mmi
+      addl            rTmp = 0x1FFFE, r0;;
+      setf.exp        fTmp = rTmp
+      nop.i 999
 }
+;;
 
 { .mfi
-	nop.m 999
-(p11) mov f99 = f0 
-	nop.i 999 ;;
+      alloc           r32 = ar.pfs, 0, 3, 4, 0 // get some registers
+      fmerge.s        FR_X = fNormX,fNormX
+      nop.i           0
 }
-
-{ .mfb
-	nop.m 999
-(p10) fsub.s.s1 f99 = f0, f1 
-//    
-//    expf(-Inf) = 0 
-//    expm1f(-Inf) = -1 
-//    No exceptions raised.
-//    
-(p10)  br.cond.sptk EXPF_64_RETURN ;;
-}
-
 { .mfb
-	nop.m 999
-(p12) fmpy.s.s1 f99 = f8, f1 
-//    
-//    expf(+Inf) = Inf 
-//    No exceptions raised.
-//    
-(p0)  br.cond.sptk EXPF_64_RETURN ;; 
-}
-EXPF_64_UNSUPPORTED: 
-
-{ .mfb
-      nop.m 999
-(p0)  fmpy.s.s0 f99 = f8, f0 
-      nop.b 0;;
+      mov             GR_Parameter_TAG = 43
+      fma.s.s0        FR_RESULT = fTmp, fTmp, f0 // Set I,O and +INF result
+      br.cond.sptk    __libm_error_region
 }
+;;
 
-EXPF_64_RETURN:
-{ .mfb
-      nop.m 999
-(p0)  mov   f8     = f99
-(p0)  br.ret.sptk   b0
-}
-.endp expm1f
-ASM_SIZE_DIRECTIVE(expm1f)
+GLOBAL_IEEE754_END(expm1f)
 
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-		nop.f 0                   
+      add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+      nop.f 999
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+      add sp=-64,sp                           // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                       // Save gp
 };;
 { .mmi
-        stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+      stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
+      add GR_Parameter_X = 16,sp              // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+      mov GR_SAVE_B0=b0                       // Save b0
 };;
 .body
-{ .mib
-        stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+{ .mfi
+      stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+      nop.f 0
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
 }
 { .mib
-        stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
-        add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#   // Call error handling function
+      stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#   // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
-        add   GR_Parameter_RESULT = 48,sp
+      add   GR_Parameter_RESULT = 48,sp
+      nop.m 0
+      nop.i 0
 };;
+
 { .mmi
-        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+      ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+      add   sp = 64,sp                       // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
-};; 
+      mov   gp = GR_SAVE_GP                  // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+      br.ret.sptk     b0                     // Return
+};;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 
 .type   __libm_error_support#,@function
diff --git a/sysdeps/ia64/fpu/s_expm1l.S b/sysdeps/ia64/fpu/s_expm1l.S
index e53d3c8d7c..5f135faf67 100644
--- a/sysdeps/ia64/fpu/s_expm1l.S
+++ b/sysdeps/ia64/fpu/s_expm1l.S
@@ -1,10 +1,10 @@
-.file "exp_m1l.s"
+.file "expl_m1.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,15 +35,23 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial Version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 07/07/01 Improved speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+// 03/11/03 Improved accuracy and performance, corrected missing inexact flags
+// 04/17/03 Eliminated misplaced and unused data label
+// 12/15/03 Eliminated call to error support on expm1l underflow
 //
-// ********************************************************************* 
+//********************************************************************* 
 //
 // Function:   Combined expl(x) and expm1l(x), where
 //                        x 
@@ -51,20 +59,20 @@
 //                          x
 //             expm1l(x) = e  - 1  for double-extended precision x values
 //
-// ********************************************************************* 
+//********************************************************************* 
 //
 // Resources Used:
 //
 //    Floating-Point Registers: f8  (Input and Return Value) 
-//                              f9,f32-f61, f99-f102 
+//                              f9-f15,f32-f77 
 //
 //    General Purpose Registers: 
-//      r32-r61
-//      r62-r65 (Used to pass arguments to error handling routine)
+//      r14-r38
+//      r35-r38 (Used to pass arguments to error handling routine)
 //                                     
 //    Predicate Registers:      p6-p15
 //
-// ********************************************************************* 
+//********************************************************************* 
 //
 // IEEE Special Conditions:
 //
@@ -74,39 +82,37 @@
 //    (Error Handling Routine called for overflow and Underflow)
 //    Inexact raised when appropriate by algorithm 
 //
-//    expl(inf) = inf
-//    expl(-inf) = +0
-//    expl(SNaN) = QNaN
-//    expl(QNaN) = QNaN
-//    expl(0) = 1
-//    expl(EM_special Values) = QNaN
-//    expl(inf) = inf
-//    expm1l(-inf) = -1 
-//    expm1l(SNaN) = QNaN
-//    expm1l(QNaN) = QNaN
-//    expm1l(0) = 0
-//    expm1l(EM_special Values) = QNaN
+//    exp(inf) = inf
+//    exp(-inf) = +0
+//    exp(SNaN) = QNaN
+//    exp(QNaN) = QNaN
+//    exp(0) = 1
+//    exp(EM_special Values) = QNaN
+//    exp(inf) = inf
+//    expm1(-inf) = -1 
+//    expm1(SNaN) = QNaN
+//    expm1(QNaN) = QNaN
+//    expm1(0) = 0
+//    expm1(EM_special Values) = QNaN
 //    
-// ********************************************************************* 
+//********************************************************************* 
 //
 // Implementation and Algorithm Notes:
 //
 //  ker_exp_64( in_FR  : X,
-//            in_GR  : Flag,
-//            in_GR  : Expo_Range
 //            out_FR : Y_hi,
 //            out_FR : Y_lo,
 //            out_FR : scale,
 //            out_PR : Safe )
 //
-// On input, X is in register format and 
-// Flag  = 0 for exp,
-// Flag  = 1 for expm1,
+// On input, X is in register format
+// p6 for exp,
+// p7 for expm1,
 //
-// On output, provided X and X_cor are real numbers, then
+// On output, 
 //
-//   scale*(Y_hi + Y_lo)  approximates  expl(X)       if Flag is 0
-//   scale*(Y_hi + Y_lo)  approximates  expl(X)-1     if Flag is 1
+//   scale*(Y_hi + Y_lo)  approximates  exp(X)       if exp
+//   scale*(Y_hi + Y_lo)  approximates  exp(X)-1     if expm1
 //
 // The accuracy is sufficient for a highly accurate 64 sig.
 // bit implementation.  Safe is set if there is no danger of 
@@ -122,36 +128,36 @@
 // The method consists of three cases.
 // 
 // If           |X| < Tiny	use case exp_tiny;
-// else if	|X| < 2^(-6)	use case exp_small;
+// else if	|X| < 2^(-m)	use case exp_small; m=12 for exp, m=7 for expm1
 // else		use case exp_regular;
 //
 // Case exp_tiny:
 //
-//   1 + X     can be used to approximate expl(X) or expl(X+X_cor);
-//   X + X^2/2 can be used to approximate expl(X) - 1
+//   1 + X     can be used to approximate exp(X) 
+//   X + X^2/2 can be used to approximate exp(X) - 1
 //
 // Case exp_small:
 //
-//   Here, expl(X), expl(X+X_cor), and expl(X) - 1 can all be 
+//   Here, exp(X) and exp(X) - 1 can all be 
 //   appproximated by a relatively simple polynomial.
 //
 //   This polynomial resembles the truncated Taylor series
 //
-//	expl(w) = 1 + w + w^2/2! + w^3/3! + ... + w^n/n!
+//	exp(w) = 1 + w + w^2/2! + w^3/3! + ... + w^n/n!
 //
 // Case exp_regular:
 //
 //   Here we use a table lookup method. The basic idea is that in
-//   order to compute expl(X), we accurately decompose X into
+//   order to compute exp(X), we accurately decompose X into
 //
 //   X = N * log(2)/(2^12)  + r,	|r| <= log(2)/2^13.
 //
 //   Hence
 //
-//   expl(X) = 2^( N / 2^12 ) * expl(r).
+//   exp(X) = 2^( N / 2^12 ) * exp(r).
 //
 //   The value 2^( N / 2^12 ) is obtained by simple combinations
-//   of values calculated beforehand and stored in table; expl(r)
+//   of values calculated beforehand and stored in table; exp(r)
 //   is approximated by a short polynomial because |r| is small.
 //
 //   We elaborate this method in 4 steps.
@@ -178,13 +184,9 @@
 //   as a double-precision number; L_lo has 64 significant bits and
 //   stored as a double-extended number.
 //
-//   In the case Flag = 2, we further modify r by
-//
-//   r := r + X_cor.
-//
 //   Step 2: Approximation
 //
-//   expl(r) - 1 is approximated by a short polynomial of the form
+//   exp(r) - 1 is approximated by a short polynomial of the form
 //   
 //   r + A_1 r^2 + A_2 r^3 + A_3 r^4 .
 //
@@ -213,19 +215,19 @@
 //   Define two mathematical values, delta_1 and delta_2, implicitly
 //   such that
 //
-//     T_1 = expl( [M_1 log(2)/2^6]  -  delta_1 ) 
-//     T_2 = expl( [M_2 log(2)/2^12] -  delta_2 )
+//     T_1 = exp( [M_1 log(2)/2^6]  -  delta_1 ) 
+//     T_2 = exp( [M_2 log(2)/2^12] -  delta_2 )
 //
 //   are representable as 24 significant bits. To illustrate the idea,
 //   we show how we define delta_1: 
 //
-//     T_1     := round_to_24_bits( expl( M_1 log(2)/2^6 ) )
+//     T_1     := round_to_24_bits( exp( M_1 log(2)/2^6 ) )
 //     delta_1  = (M_1 log(2)/2^6) - log( T_1 )  
 //
 //   The last equality means mathematical equality. We then tabulate
 //
-//     W_1 := expl(delta_1) - 1
-//     W_2 := expl(delta_2) - 1
+//     W_1 := exp(delta_1) - 1
+//     W_2 := exp(delta_2) - 1
 //
 //   Both in double precision.
 //
@@ -235,13 +237,13 @@
 //     T := T_1 * T_2			...exactly
 //     W := W_1 + (1 + W_1)*W_2	
 //
-//   W approximates expl( delta ) - 1  where delta = delta_1 + delta_2.
+//   W approximates exp( delta ) - 1  where delta = delta_1 + delta_2.
 //   The mathematical product of T and (W+1) is an accurate representation
 //   of 2^(M_1/2^6) * 2^(M_2/2^12).
 //
 //   Step 4. Reconstruction
 //
-//   Finally, we can reconstruct expl(X), expl(X) - 1. 
+//   Finally, we can reconstruct exp(X), exp(X) - 1. 
 //   Because
 //
 //	X = K * log(2) + (M_1*log(2)/2^6  - delta_1) 
@@ -249,18 +251,18 @@
 //		       + delta_1 + delta_2 + r 		...accurately
 //   We have
 //
-//	expl(X) ~=~ 2^K * ( T + T*[expl(delta_1+delta_2+r) - 1] )
-//	       ~=~ 2^K * ( T + T*[expl(delta + r) - 1]         )
-//	       ~=~ 2^K * ( T + T*[(expl(delta)-1)  
-//				 + expl(delta)*(expl(r)-1)]   )
+//	exp(X) ~=~ 2^K * ( T + T*[exp(delta_1+delta_2+r) - 1] )
+//	       ~=~ 2^K * ( T + T*[exp(delta + r) - 1]         )
+//	       ~=~ 2^K * ( T + T*[(exp(delta)-1)  
+//				 + exp(delta)*(exp(r)-1)]   )
 //             ~=~ 2^K * ( T + T*( W + (1+W)*poly(r) ) )
 //             ~=~ 2^K * ( Y_hi  +  Y_lo )
 //
 //   where Y_hi = T  and Y_lo = T*(W + (1+W)*poly(r))
 //
-//   For expl(X)-1, we have
+//   For exp(X)-1, we have
 //
-//	expl(X)-1 ~=~ 2^K * ( Y_hi + Y_lo ) - 1
+//	exp(X)-1 ~=~ 2^K * ( Y_hi + Y_lo ) - 1
 //		 ~=~ 2^K * ( Y_hi + Y_lo - 2^(-K) )
 //
 //   and we combine Y_hi + Y_lo - 2^(-N)  into the form of two 
@@ -278,7 +280,7 @@
 //   different rounding directions and a correct setting of the SAFE 
 //   flag.
 //
-//   If Flag is 1, then
+//   If expm1 is 1, then
 //      SAFE  := False	...possibility of underflow
 //      Scale := 1.0
 //      Y_hi  := X
@@ -296,26 +298,25 @@
 //
 //   Let r = X 
 //
-//   If Flag is not 1	...i.e. expl( argument )
+//   If exp 	...i.e. exp( argument )
 //
 //      rsq := r * r; 
 //      r4  := rsq*rsq
 //      poly_lo := P_3 + r*(P_4 + r*(P_5 + r*P_6))
 //      poly_hi := r + rsq*(P_1 + r*P_2)
 //      Y_lo    := poly_hi + r4 * poly_lo
-//      set lsb(Y_lo) to 1
 //      Y_hi    := 1.0
 //      Scale   := 1.0
 //
-//   Else			...i.e. expl( argument ) - 1
+//   Else			...i.e. exp( argument ) - 1
 //
 //      rsq := r * r
 //      r4  := rsq * rsq
-//      r6  := rsq * r4
-//      poly_lo := r6*(Q_5 + r*(Q_6 + r*Q_7))
-//      poly_hi := Q_1 + r*(Q_2 + r*(Q_3 + r*Q_4))
-//      Y_lo    := rsq*poly_hi +  poly_lo
-//      set lsb(Y_lo) to 1
+//      poly_lo := Q_7 + r*(Q_8 + r*Q_9))
+//      poly_med:= Q_3 + r*Q_4 + rsq*(Q_5 + r*Q_6)
+//      poly_med:= poly_med + r4*poly_lo
+//      poly_hi := Q_1 + r*Q_2
+//      Y_lo    := rsq*(poly_hi +  rsq*poly_lo)
 //      Y_hi    := X
 //      Scale   := 1.0
 //
@@ -325,14 +326,14 @@
 //
 //  The previous description contain enough information except the
 //  computation of poly and the final Y_hi and Y_lo in the case for
-//  expl(X)-1.
+//  exp(X)-1.
 //
 //  The computation of poly for Step 2:
 //
 //   rsq := r*r
 //   poly := r + rsq*(A_1 + r*(A_2 + r*A_3))
 //
-//  For the case expl(X) - 1, we need to incorporate 2^(-K) into
+//  For the case exp(X) - 1, we need to incorporate 2^(-K) into
 //  Y_hi and Y_lo at the end of Step 4.
 //
 //   If K > 10 then
@@ -346,72 +347,197 @@
 //      End If
 //   End If
 //
+//=======================================================
+// General Purpose Registers
+//
+GR_ad_Arg           = r14
+GR_ad_A             = r15
+GR_sig_inv_ln2      = r15
+GR_rshf_2to51       = r16
+GR_ad_PQ            = r16
+GR_ad_Q             = r16
+GR_signexp_x        = r17
+GR_exp_x            = r17
+GR_small_exp        = r18
+GR_rshf             = r18
+GR_exp_mask         = r19
+GR_ad_W1            = r20
+GR_exp_2tom51       = r20
+GR_ad_W2            = r21
+GR_exp_underflow    = r21
+GR_M2               = r22
+GR_huge_exp         = r22
+GR_M1               = r23
+GR_huge_signif      = r23
+GR_K                = r24
+GR_one              = r24
+GR_minus_one        = r24
+GR_exp_bias         = r25
+GR_ad_Limits        = r26
+GR_N_fix            = r26
+GR_exp_2_mk         = r26
+GR_ad_P             = r27
+GR_exp_2_k          = r27
+GR_big_expo_neg     = r28
+GR_very_small_exp   = r29
+GR_exp_half         = r29
+GR_ad_T1            = r30
+GR_ad_T2            = r31
 
-#include "libm_support.h"
+GR_SAVE_PFS         = r32
+GR_SAVE_B0          = r33
+GR_SAVE_GP          = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Parameter_TAG    = r38 
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// Floating Point Registers
+//
+FR_norm_x           = f9
+FR_RSHF_2TO51       = f10
+FR_INV_LN2_2TO63    = f11
+FR_W_2TO51_RSH      = f12
+FR_2TOM51           = f13
+FR_RSHF             = f14
+FR_Y_hi             = f34
+FR_Y_lo             = f35
+FR_scale            = f36
+FR_tmp              = f37
+FR_float_N          = f38
+FR_N_signif         = f39
+FR_L_hi             = f40
+FR_L_lo             = f41
+FR_r                = f42
+FR_W1               = f43
+FR_T1               = f44
+FR_W2               = f45
+FR_T2               = f46
+FR_W1_p1            = f47
+FR_rsq              = f48
+FR_A2               = f49
+FR_r4               = f50
+FR_A3               = f51
+FR_poly             = f52
+FR_T                = f53
+FR_W                = f54
+FR_Wp1              = f55
+FR_p21              = f59
+FR_p210             = f59
+FR_p65              = f60
+FR_p654             = f60
+FR_p6543            = f60
+FR_2_mk             = f61
+FR_P4Q7             = f61
+FR_P4               = f61
+FR_Q7               = f61
+FR_P3Q6             = f62
+FR_P3               = f62
+FR_Q6               = f62
+FR_q65              = f62
+FR_q6543            = f62
+FR_P2Q5             = f63
+FR_P2               = f63
+FR_Q5               = f63
+FR_P1Q4             = f64
+FR_P1               = f64
+FR_Q4               = f64
+FR_q43              = f64
+FR_Q3               = f65
+FR_Q2               = f66
+FR_q21              = f66
+FR_Q1               = f67
+FR_A1               = f68
+FR_P6Q9             = f68
+FR_P6               = f68
+FR_Q9               = f68
+FR_P5Q8             = f69
+FR_P5               = f69
+FR_Q8               = f69
+FR_q987             = f69
+FR_q98              = f69
+FR_q9876543         = f69
+FR_min_oflow_x      = f70
+FR_huge_exp         = f70
+FR_zero_uflow_x     = f71
+FR_huge_signif      = f71
+FR_huge             = f72
+FR_small            = f72
+FR_half             = f73
+FR_T_scale          = f74
+FR_result_lo        = f75
+FR_W_T_scale        = f76
+FR_Wp1_T_scale      = f77
+FR_ftz              = f77
+FR_half_x           = f77
+//
 
-.align 64 
-Constants_exp_64_Arg:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Arg,@object)
-data4 0x5C17F0BC,0xB8AA3B29,0x0000400B,0x00000000 
-data4 0x00000000,0xB17217F4,0x00003FF2,0x00000000
-data4 0xF278ECE6,0xF473DE6A,0x00003FD4,0x00000000
-// /* Inv_L, L_hi, L_lo */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Arg)
+FR_X                = f9
+FR_Y                = f0
+FR_RESULT           = f15
 
-.align 64 
-Constants_exp_64_Exponents:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Exponents,@object)
-data4 0x0000007E,0x00000000,0xFFFFFF83,0xFFFFFFFF
-data4 0x000003FE,0x00000000,0xFFFFFC03,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0x00003FFE,0x00000000,0xFFFFC003,0xFFFFFFFF
-data4 0xFFFFFFE2,0xFFFFFFFF,0xFFFFFFC4,0xFFFFFFFF
-data4 0xFFFFFFBA,0xFFFFFFFF,0xFFFFFFBA,0xFFFFFFFF
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Exponents)
+// ************* DO NOT CHANGE ORDER OF THESE TABLES ********************
 
-.align 64 
-Constants_exp_64_A:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_A,@object)
-data4 0xB1B736A0,0xAAAAAAAB,0x00003FFA,0x00000000
-data4 0x90CD6327,0xAAAAAAAB,0x00003FFC,0x00000000
-data4 0xFFFFFFFF,0xFFFFFFFF,0x00003FFD,0x00000000
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_A)
+// double-extended 1/ln(2)
+// 3fff b8aa 3b29 5c17 f0bb be87fed0691d3e88
+// 3fff b8aa 3b29 5c17 f0bc 
+// For speed the significand will be loaded directly with a movl and setf.sig
+//   and the exponent will be bias+63 instead of bias+0.  Thus subsequent
+//   computations need to scale appropriately.
+// The constant 2^12/ln(2) is needed for the computation of N.  This is also 
+//   obtained by scaling the computations.
+//
+// Two shifting constants are loaded directly with movl and setf.d. 
+//   1. RSHF_2TO51 = 1.1000..00 * 2^(63-12) 
+//        This constant is added to x*1/ln2 to shift the integer part of
+//        x*2^12/ln2 into the rightmost bits of the significand.
+//        The result of this fma is N_signif.
+//   2. RSHF       = 1.1000..00 * 2^(63) 
+//        This constant is subtracted from N_signif * 2^(-51) to give
+//        the integer part of N, N_fix, as a floating-point number.
+//        The result of this fms is float_N.
 
+RODATA
 .align 64 
-Constants_exp_64_P:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_P,@object)
-data4 0x43914A8A,0xD00D6C81,0x00003FF2,0x00000000
-data4 0x30304B30,0xB60BC4AC,0x00003FF5,0x00000000
-data4 0x7474C518,0x88888888,0x00003FF8,0x00000000
-data4 0x8DAE729D,0xAAAAAAAA,0x00003FFA,0x00000000
-data4 0xAAAAAF61,0xAAAAAAAA,0x00003FFC,0x00000000
-data4 0x000004C7,0x80000000,0x00003FFE,0x00000000 
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_P)
+LOCAL_OBJECT_START(Constants_exp_64_Arg)
+//data8 0xB8AA3B295C17F0BC,0x0000400B // Inv_L = 2^12/log(2)
+data8 0xB17217F400000000,0x00003FF2 // L_hi = hi part log(2)/2^12
+data8 0xF473DE6AF278ECE6,0x00003FD4 // L_lo = lo part log(2)/2^12
+LOCAL_OBJECT_END(Constants_exp_64_Arg)
 
-.align 64 
-Constants_exp_64_Q:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_Q,@object)
-data4 0xA49EF6CA,0xD00D56F7,0x00003FEF,0x00000000
-data4 0x1C63493D,0xD00D59AB,0x00003FF2,0x00000000
-data4 0xFB50CDD2,0xB60B60B5,0x00003FF5,0x00000000
-data4 0x7BA68DC8,0x88888888,0x00003FF8,0x00000000
-data4 0xAAAAAC8D,0xAAAAAAAA,0x00003FFA,0x00000000
-data4 0xAAAAACCA,0xAAAAAAAA,0x00003FFC,0x00000000
-data4 0x00000000,0x80000000,0x00003FFE,0x00000000 
-// /* Reversed */
-ASM_SIZE_DIRECTIVE(Constants_exp_64_Q)
+LOCAL_OBJECT_START(Constants_exp_64_Limits)
+data8 0xb17217f7d1cf79ac,0x0000400c // Smallest long dbl oflow x
+data8 0xb220000000000000,0x0000c00c // Small long dbl uflow zero x
+LOCAL_OBJECT_END(Constants_exp_64_Limits)
 
-.align 64 
-Constants_exp_64_T1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T1,@object)
+LOCAL_OBJECT_START(Constants_exp_64_A)
+data8 0xAAAAAAABB1B736A0,0x00003FFA // A3
+data8 0xAAAAAAAB90CD6327,0x00003FFC // A2
+data8 0xFFFFFFFFFFFFFFFF,0x00003FFD // A1
+LOCAL_OBJECT_END(Constants_exp_64_A)
+
+LOCAL_OBJECT_START(Constants_exp_64_P)
+data8 0xD00D6C8143914A8A,0x00003FF2 // P6
+data8 0xB60BC4AC30304B30,0x00003FF5 // P5
+data8 0x888888887474C518,0x00003FF8 // P4
+data8 0xAAAAAAAA8DAE729D,0x00003FFA // P3
+data8 0xAAAAAAAAAAAAAF61,0x00003FFC // P2
+data8 0x80000000000004C7,0x00003FFE // P1
+LOCAL_OBJECT_END(Constants_exp_64_P)
+
+LOCAL_OBJECT_START(Constants_exp_64_Q)
+data8 0x93F2AC5F7471F32E, 0x00003FE9 // Q9
+data8 0xB8DA0F3550B3E764, 0x00003FEC // Q8
+data8 0xD00D00D0028E89C4, 0x00003FEF // Q7
+data8 0xD00D00DAEB8C4E91, 0x00003FF2 // Q6
+data8 0xB60B60B60B60B6F5, 0x00003FF5 // Q5
+data8 0x888888888886CC23, 0x00003FF8 // Q4
+data8 0xAAAAAAAAAAAAAAAB, 0x00003FFA // Q3
+data8 0xAAAAAAAAAAAAAAAB, 0x00003FFC // Q2
+data8 0x8000000000000000, 0x00003FFE // Q1
+LOCAL_OBJECT_END(Constants_exp_64_Q)
+
+LOCAL_OBJECT_START(Constants_exp_64_T1)
 data4 0x3F800000,0x3F8164D2,0x3F82CD87,0x3F843A29 
 data4 0x3F85AAC3,0x3F871F62,0x3F88980F,0x3F8A14D5 
 data4 0x3F8B95C2,0x3F8D1ADF,0x3F8EA43A,0x3F9031DC
@@ -428,11 +554,9 @@ data4 0x3FD744FD,0x3FD99D16,0x3FDBFBB8,0x3FDE60F5
 data4 0x3FE0CCDF,0x3FE33F89,0x3FE5B907,0x3FE8396A
 data4 0x3FEAC0C7,0x3FED4F30,0x3FEFE4BA,0x3FF28177
 data4 0x3FF5257D,0x3FF7D0DF,0x3FFA83B3,0x3FFD3E0C
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T1)
+LOCAL_OBJECT_END(Constants_exp_64_T1)
 
-.align 64 
-Constants_exp_64_T2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_T2,@object)
+LOCAL_OBJECT_START(Constants_exp_64_T2)
 data4 0x3F800000,0x3F80058C,0x3F800B18,0x3F8010A4 
 data4 0x3F801630,0x3F801BBD,0x3F80214A,0x3F8026D7 
 data4 0x3F802C64,0x3F8031F2,0x3F803780,0x3F803D0E 
@@ -449,1124 +573,812 @@ data4 0x3F810B41,0x3F8110D8,0x3F81166F,0x3F811C07
 data4 0x3F81219F,0x3F812737,0x3F812CD0,0x3F813269 
 data4 0x3F813802,0x3F813D9B,0x3F814334,0x3F8148CE 
 data4 0x3F814E68,0x3F815402,0x3F81599C,0x3F815F37
-ASM_SIZE_DIRECTIVE(Constants_exp_64_T2)
+LOCAL_OBJECT_END(Constants_exp_64_T2)
 
-.align 64 
-Constants_exp_64_W1:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W1,@object)
-data4 0x00000000,0x00000000,0x171EC4B4,0xBE384454
-data4 0x4AA72766,0xBE694741,0xD42518F8,0xBE5D32B6
-data4 0x3A319149,0x3E68D96D,0x62415F36,0xBE68F4DA
-data4 0xC9C86A3B,0xBE6DDA2F,0xF49228FE,0x3E6B2E50
-data4 0x1188B886,0xBE49C0C2,0x1A4C2F1F,0x3E64BFC2
-data4 0x2CB98B54,0xBE6A2FBB,0x9A55D329,0x3E5DC5DE
-data4 0x39A7AACE,0x3E696490,0x5C66DBA5,0x3E54728B
-data4 0xBA1C7D7D,0xBE62B0DB,0x09F1AF5F,0x3E576E04
-data4 0x1A0DD6A1,0x3E612500,0x795FBDEF,0xBE66A419
-data4 0xE1BD41FC,0xBE5CDE8C,0xEA54964F,0xBE621376
-data4 0x476E76EE,0x3E6370BE,0x3427EB92,0x3E390D1A 
-data4 0x2BF82BF8,0x3E1336DE,0xD0F7BD9E,0xBE5FF1CB 
-data4 0x0CEB09DD,0xBE60A355,0x0980F30D,0xBE5CA37E 
-data4 0x4C082D25,0xBE5C541B,0x3B467D29,0xBE5BBECA 
-data4 0xB9D946C5,0xBE400D8A,0x07ED374A,0xBE5E2A08 
-data4 0x365C8B0A,0xBE66CB28,0xD3403BCA,0x3E3AAD5B 
-data4 0xC7EA21E0,0x3E526055,0xE72880D6,0xBE442C75 
-data4 0x85222A43,0x3E58B2BB,0x522C42BF,0xBE5AAB79 
-data4 0x469DC2BC,0xBE605CB4,0xA48C40DC,0xBE589FA7 
-data4 0x1AA42614,0xBE51C214,0xC37293F4,0xBE48D087 
-data4 0xA2D673E0,0x3E367A1C,0x114F7A38,0xBE51BEBB 
-data4 0x661A4B48,0xBE6348E5,0x1D3B9962,0xBDF52643  
-data4 0x35A78A53,0x3E3A3B5E,0x1CECD788,0xBE46C46C 
-data4 0x7857D689,0xBE60B7EC,0xD14F1AD7,0xBE594D3D 
-data4 0x4C9A8F60,0xBE4F9C30,0x02DFF9D2,0xBE521873 
-data4 0x55E6D68F,0xBE5E4C88,0x667F3DC4,0xBE62140F 
-data4 0x3BF88747,0xBE36961B,0xC96EC6AA,0x3E602861 
-data4 0xD57FD718,0xBE3B5151,0xFC4A627B,0x3E561CD0 
-data4 0xCA913FEA,0xBE3A5217,0x9A5D193A,0x3E40A3CC 
-data4 0x10A9C312,0xBE5AB713,0xC5F57719,0x3E4FDADB 
-data4 0xDBDF59D5,0x3E361428,0x61B4180D,0x3E5DB5DB 
-data4 0x7408D856,0xBE42AD5F,0x31B2B707,0x3E2A3148 
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W1)
+LOCAL_OBJECT_START(Constants_exp_64_W1)
+data8 0x0000000000000000, 0xBE384454171EC4B4
+data8 0xBE6947414AA72766, 0xBE5D32B6D42518F8
+data8 0x3E68D96D3A319149, 0xBE68F4DA62415F36
+data8 0xBE6DDA2FC9C86A3B, 0x3E6B2E50F49228FE
+data8 0xBE49C0C21188B886, 0x3E64BFC21A4C2F1F
+data8 0xBE6A2FBB2CB98B54, 0x3E5DC5DE9A55D329
+data8 0x3E69649039A7AACE, 0x3E54728B5C66DBA5
+data8 0xBE62B0DBBA1C7D7D, 0x3E576E0409F1AF5F
+data8 0x3E6125001A0DD6A1, 0xBE66A419795FBDEF
+data8 0xBE5CDE8CE1BD41FC, 0xBE621376EA54964F
+data8 0x3E6370BE476E76EE, 0x3E390D1A3427EB92
+data8 0x3E1336DE2BF82BF8, 0xBE5FF1CBD0F7BD9E
+data8 0xBE60A3550CEB09DD, 0xBE5CA37E0980F30D
+data8 0xBE5C541B4C082D25, 0xBE5BBECA3B467D29
+data8 0xBE400D8AB9D946C5, 0xBE5E2A0807ED374A
+data8 0xBE66CB28365C8B0A, 0x3E3AAD5BD3403BCA
+data8 0x3E526055C7EA21E0, 0xBE442C75E72880D6
+data8 0x3E58B2BB85222A43, 0xBE5AAB79522C42BF
+data8 0xBE605CB4469DC2BC, 0xBE589FA7A48C40DC
+data8 0xBE51C2141AA42614, 0xBE48D087C37293F4
+data8 0x3E367A1CA2D673E0, 0xBE51BEBB114F7A38
+data8 0xBE6348E5661A4B48, 0xBDF526431D3B9962
+data8 0x3E3A3B5E35A78A53, 0xBE46C46C1CECD788
+data8 0xBE60B7EC7857D689, 0xBE594D3DD14F1AD7
+data8 0xBE4F9C304C9A8F60, 0xBE52187302DFF9D2
+data8 0xBE5E4C8855E6D68F, 0xBE62140F667F3DC4
+data8 0xBE36961B3BF88747, 0x3E602861C96EC6AA
+data8 0xBE3B5151D57FD718, 0x3E561CD0FC4A627B
+data8 0xBE3A5217CA913FEA, 0x3E40A3CC9A5D193A
+data8 0xBE5AB71310A9C312, 0x3E4FDADBC5F57719
+data8 0x3E361428DBDF59D5, 0x3E5DB5DB61B4180D
+data8 0xBE42AD5F7408D856, 0x3E2A314831B2B707
+LOCAL_OBJECT_END(Constants_exp_64_W1)
 
-.align 64 
-Constants_exp_64_W2:
-ASM_TYPE_DIRECTIVE(Constants_exp_64_W2,@object)
-data4 0x00000000,0x00000000,0x37A3D7A2,0xBE641F25 
-data4 0xAD028C40,0xBE68DD57,0xF212B1B6,0xBE5C77D8 
-data4 0x1BA5B070,0x3E57878F,0x2ECAE6FE,0xBE55A36A 
-data4 0x569DFA3B,0xBE620608,0xA6D300A3,0xBE53B50E 
-data4 0x223F8F2C,0x3E5B5EF2,0xD6DE0DF4,0xBE56A0D9 
-data4 0xEAE28F51,0xBE64EEF3,0x367EA80B,0xBE5E5AE2 
-data4 0x5FCBC02D,0x3E47CB1A,0x9BDAFEB7,0xBE656BA0 
-data4 0x805AFEE7,0x3E6E70C6,0xA3415EBA,0xBE6E0509 
-data4 0x49BFF529,0xBE56856B,0x00508651,0x3E66DD33 
-data4 0xC114BC13,0x3E51165F,0xC453290F,0x3E53333D 
-data4 0x05539FDA,0x3E6A072B,0x7C0A7696,0xBE47CD87 
-data4 0xEB05C6D9,0xBE668BF4,0x6AE86C93,0xBE67C3E3 
-data4 0xD0B3E84B,0xBE533904,0x556B53CE,0x3E63E8D9 
-data4 0x63A98DC8,0x3E212C89,0x032A7A22,0xBE33138F 
-data4 0xBC584008,0x3E530FA9,0xCCB93C97,0xBE6ADF82 
-data4 0x8370EA39,0x3E5F9113,0xFB6A05D8,0x3E5443A4 
-data4 0x181FEE7A,0x3E63DACD,0xF0F67DEC,0xBE62B29D 
-data4 0x3DDE6307,0x3E65C483,0xD40A24C1,0x3E5BF030  
-data4 0x14E437BE,0x3E658B8F,0xED98B6C7,0xBE631C29 
-data4 0x04CF7C71,0x3E6335D2,0xE954A79D,0x3E529EED 
-data4 0xF64A2FB8,0x3E5D9257,0x854ED06C,0xBE6BED1B 
-data4 0xD71405CB,0x3E5096F6,0xACB9FDF5,0xBE3D4893 
-data4 0x01B68349,0xBDFEB158,0xC6A463B9,0x3E628D35 
-data4 0xADE45917,0xBE559725,0x042FC476,0xBE68C29C 
-data4 0x01E511FA,0xBE67593B,0x398801ED,0xBE4A4313 
-data4 0xDA7C3300,0x3E699571,0x08062A9E,0x3E5349BE 
-data4 0x755BB28E,0x3E5229C4,0x77A1F80D,0x3E67E426 
-data4 0x6B69C352,0xBE52B33F,0x084DA57F,0xBE6B3550 
-data4 0xD1D09A20,0xBE6DB03F,0x2161B2C1,0xBE60CBC4 
-data4 0x78A2B771,0x3E56ED9C,0x9D0FA795,0xBE508E31 
-data4 0xFD1A54E9,0xBE59482A,0xB07FD23E,0xBE2A17CE 
-data4 0x17365712,0x3E68BF5C,0xB3785569,0x3E3956F9
-ASM_SIZE_DIRECTIVE(Constants_exp_64_W2)
-
-GR_SAVE_PFS         = r59
-GR_SAVE_B0          = r60
-GR_SAVE_GP          = r61
-GR_Parameter_X      = r62
-GR_Parameter_Y      = r63
-GR_Parameter_RESULT = r64
-GR_Parameter_TAG    = r65 
+LOCAL_OBJECT_START(Constants_exp_64_W2)
+data8 0x0000000000000000, 0xBE641F2537A3D7A2
+data8 0xBE68DD57AD028C40, 0xBE5C77D8F212B1B6
+data8 0x3E57878F1BA5B070, 0xBE55A36A2ECAE6FE
+data8 0xBE620608569DFA3B, 0xBE53B50EA6D300A3
+data8 0x3E5B5EF2223F8F2C, 0xBE56A0D9D6DE0DF4
+data8 0xBE64EEF3EAE28F51, 0xBE5E5AE2367EA80B
+data8 0x3E47CB1A5FCBC02D, 0xBE656BA09BDAFEB7
+data8 0x3E6E70C6805AFEE7, 0xBE6E0509A3415EBA
+data8 0xBE56856B49BFF529, 0x3E66DD3300508651
+data8 0x3E51165FC114BC13, 0x3E53333DC453290F
+data8 0x3E6A072B05539FDA, 0xBE47CD877C0A7696
+data8 0xBE668BF4EB05C6D9, 0xBE67C3E36AE86C93
+data8 0xBE533904D0B3E84B, 0x3E63E8D9556B53CE
+data8 0x3E212C8963A98DC8, 0xBE33138F032A7A22
+data8 0x3E530FA9BC584008, 0xBE6ADF82CCB93C97
+data8 0x3E5F91138370EA39, 0x3E5443A4FB6A05D8
+data8 0x3E63DACD181FEE7A, 0xBE62B29DF0F67DEC
+data8 0x3E65C4833DDE6307, 0x3E5BF030D40A24C1
+data8 0x3E658B8F14E437BE, 0xBE631C29ED98B6C7
+data8 0x3E6335D204CF7C71, 0x3E529EEDE954A79D
+data8 0x3E5D9257F64A2FB8, 0xBE6BED1B854ED06C
+data8 0x3E5096F6D71405CB, 0xBE3D4893ACB9FDF5
+data8 0xBDFEB15801B68349, 0x3E628D35C6A463B9
+data8 0xBE559725ADE45917, 0xBE68C29C042FC476
+data8 0xBE67593B01E511FA, 0xBE4A4313398801ED
+data8 0x3E699571DA7C3300, 0x3E5349BE08062A9E
+data8 0x3E5229C4755BB28E, 0x3E67E42677A1F80D
+data8 0xBE52B33F6B69C352, 0xBE6B3550084DA57F
+data8 0xBE6DB03FD1D09A20, 0xBE60CBC42161B2C1
+data8 0x3E56ED9C78A2B771, 0xBE508E319D0FA795
+data8 0xBE59482AFD1A54E9, 0xBE2A17CEB07FD23E
+data8 0x3E68BF5C17365712, 0x3E3956F9B3785569
+LOCAL_OBJECT_END(Constants_exp_64_W2)
 
-FR_X                = f9
-FR_Y                = f9
-FR_RESULT           = f99
 
 .section .text
-.proc expm1l#
-.global expm1l#
-.align 64 
-expm1l: 
-#ifdef _LIBC
-.global __expm1l#
-__expm1l:
-#endif
-{ .mii
-alloc r32 = ar.pfs,0,30,4,0
-(p0)  add r33 = 1, r0  
-(p0)  cmp.eq.unc  p7, p0 =  r0, r0 
-}
-{ .mbb
-	nop.m 999
-(p0)  br.cond.sptk exp_continue 
-	nop.b 999 ;;
-}
+
+GLOBAL_IEEE754_ENTRY(expm1l)
 
 //
-//    Set p7 true for expm1
-//    Set Flag = r33 = 1 for expm1
+//    Set p7 true for expm1, p6 false
 //    
 
-.endp expm1l
-ASM_SIZE_DIRECTIVE(expm1l)
-
-#ifdef _LIBC
-libm_hidden_def (__expm1l)
-#endif
-
-.section .text
-.proc expl#
-.global expl#
-.align 64 
-expl: 
-#ifdef _LIBC
-.global __ieee754_expl#
-__ieee754_expl:
-#endif
-{ .mii
-alloc r32 = ar.pfs,0,30,4,0
-(p0)  add r33 = r0, r0  
-(p0)  cmp.eq.unc  p0, p7 =  r0, r0 ;; 
+{ .mlx
+      getf.exp GR_signexp_x = f8  // Get sign and exponent of x, redo if unorm
+      movl GR_sig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
 }
-exp_continue: 
-{ .mfi
-(p0)  add r32 = 2,r0  
-(p0)  fnorm.s1 f9 = f8 
-      nop.i 0
+{ .mlx
+      addl GR_ad_Arg = @ltoff(Constants_exp_64_Arg#),gp  
+      movl GR_rshf_2to51 = 0x4718000000000000 // 1.10000 2^(63+51)
 }
+;;
+
 { .mfi
-(p0)  nop.m 0 
+      ld8  GR_ad_Arg = [GR_ad_Arg]       // Point to Arg table
+      fclass.m p8, p0 =  f8, 0x1E7       // Test x for natval, nan, inf, zero
+      cmp.eq  p7, p6 =  r0, r0 
+}
+{ .mfb
+      mov GR_exp_half = 0x0FFFE          // Exponent of 0.5, for very small path
+      fnorm.s1 FR_norm_x = f8            // Normalize x
+      br.cond.sptk exp_continue 
+}
+;;
+
+GLOBAL_IEEE754_END(expm1l)
+
+
+GLOBAL_IEEE754_ENTRY(expl)
 //
-//    Set p7 false for exp
-//    Set Flag = r33 = 0 for exp
+//    Set p7 false for exp, p6 true
 //    
-(p0)  fclass.m.unc p6, p8 =  f8, 0x1E7 
-      nop.i 0;;
+{ .mlx
+      getf.exp GR_signexp_x = f8  // Get sign and exponent of x, redo if unorm
+      movl GR_sig_inv_ln2 = 0xb8aa3b295c17f0bc  // significand of 1/ln2
+}
+{ .mlx
+      addl GR_ad_Arg = @ltoff(Constants_exp_64_Arg#),gp  
+      movl GR_rshf_2to51 = 0x4718000000000000 // 1.10000 2^(63+51)
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fclass.nm.unc p9, p0 =  f8, 0x1FF 
-      nop.i 0
+      ld8  GR_ad_Arg = [GR_ad_Arg]       // Point to Arg table
+      fclass.m p8, p0 =  f8, 0x1E7       // Test x for natval, nan, inf, zero
+      cmp.eq  p6, p7 =  r0, r0
 }
 { .mfi
-	nop.m 999
-(p0)  mov f36 = f1 
-	nop.i 999 ;;
+      mov GR_exp_half = 0x0FFFE          // Exponent of 0.5, for very small path
+      fnorm.s1 FR_norm_x = f8            // Normalize x
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
-//     
-//    Identify NatVals, NaNs, Infs, and Zeros. 
-//    Identify EM unsupporteds. 
-//    Save special input registers 
-(p0)  mov f32 = f0 
-//
-//    Create FR_X_cor      = 0.0 
-//           GR_Flag       = 0 
-//           GR_Expo_Range = 2 (r32) for double-extended precision 
-//           FR_Scale      = 1.0
-//
-(p6)  br.cond.spnt EXPL_64_SPECIAL ;; 
+;;
+
+exp_continue: 
+// Form two constants we need
+//  1/ln2 * 2^63  to compute  w = x * 1/ln2 * 128 
+//  1.1000..000 * 2^(63+63-12) to right shift int(N) into the significand
+
+{ .mfi
+      setf.sig  FR_INV_LN2_2TO63 = GR_sig_inv_ln2 // form 1/ln2 * 2^63
+      fclass.nm.unc p9, p0 =  f8, 0x1FF  // Test x for unsupported
+      mov GR_exp_2tom51 = 0xffff-51
+}
+{ .mlx
+      setf.d  FR_RSHF_2TO51 = GR_rshf_2to51 // Form const 1.1000 * 2^(63+51)
+      movl GR_rshf = 0x43e8000000000000  // 1.10000 2^63 for right shift
+}
+;;
+
+{ .mfi
+      setf.exp FR_half = GR_exp_half     // Form 0.5 for very small path
+      fma.s1 FR_scale = f1,f1,f0         // Scale = 1.0
+      mov GR_exp_bias = 0x0FFFF          // Set exponent bias
 }
 { .mib
-	nop.m 999
-	nop.i 999
-(p9)  br.cond.spnt EXPL_64_UNSUPPORTED ;; 
+      add GR_ad_Limits = 0x20, GR_ad_Arg // Point to Limits table
+      mov GR_exp_mask = 0x1FFFF          // Form exponent mask
+(p8)  br.cond.spnt EXP_64_SPECIAL        // Branch if natval, nan, inf, zero
 }
+;;
+
 { .mfi
-(p0)  cmp.ne.unc p12, p13 = 0x01, r33
-//     
-//    Branch out for special input values 
-//     
-(p0)  fcmp.lt.unc.s0 p9,p0 =  f8, f0 
-(p0)  cmp.eq.unc  p15, p0 =  r0, r0 
+      setf.exp FR_2TOM51 = GR_exp_2tom51 // Form 2^-51 for scaling float_N
+      nop.f 999
+      add GR_ad_A = 0x40, GR_ad_Arg      // Point to A table
 }
-{ .mmi
-	nop.m 999
-//     
-//    Raise possible denormal operand exception 
-//    Normalize x 
-//     
-//    This function computes expl( x  + x_cor) 
-//    Input  FR 1: FR_X            
-//    Input  FR 2: FR_X_cor  
-//    Input  GR 1: GR_Flag  
-//    Input  GR 2: GR_Expo_Range  
-//    Output FR 3: FR_Y_hi  
-//    Output FR 4: FR_Y_lo  
-//    Output FR 5: FR_Scale  
-//    Output PR 1: PR_Safe  
-(p0)  addl r34 = @ltoff(Constants_exp_64_Arg#),gp  
-(p0)  addl r40 = @ltoff(Constants_exp_64_W1#),gp 
-};;
-//
-//    Prepare to load constants
-//    Set Safe = True
-//
+{ .mib
+      setf.d  FR_RSHF = GR_rshf          // Form right shift const 1.1000 * 2^63
+      add GR_ad_T1 = 0x160, GR_ad_Arg    // Point to T1 table
+(p9)  br.cond.spnt EXP_64_UNSUPPORTED    // Branch if unsupported
+}
+;;
 
-{ .mmi
-      ld8  r34 = [r34]
-      ld8  r40 = [r40]
-(p0)  addl r41 = @ltoff(Constants_exp_64_W2#),gp  
+.pred.rel "mutex",p6,p7
+{ .mfi
+      ldfe FR_L_hi = [GR_ad_Arg],16      // Get L_hi
+      fcmp.eq.s0 p9,p0 =  f8, f0         // Dummy op to flag denormals
+(p6)  add GR_ad_PQ = 0x30, GR_ad_A       // Point to P table for exp
+}
+{ .mfi
+      ldfe FR_min_oflow_x = [GR_ad_Limits],16 // Get min x to cause overflow
+      fmpy.s1 FR_rsq = f8, f8            // rsq = x * x for small path
+(p7)  add GR_ad_PQ = 0x90, GR_ad_A       // Point to Q table for expm1
 };;
 
 { .mmi
-(p0)  ldfe f37 = [r34],16 
-(p0)  ld8 r41 = [r41] ;; 
+      ldfe FR_L_lo = [GR_ad_Arg],16      // Get L_lo
+      ldfe FR_zero_uflow_x = [GR_ad_Limits],16 // Get x for zero uflow result
+      add GR_ad_W1 = 0x200, GR_ad_T1     // Point to W1 table
 }
+;;
 
-//
-//    N = fcvt.fx(float_N)
-//    Set p14 if -6 > expo_X 
-//
-//
-//    Bias = 0x0FFFF
-//    expo_X = expo_X and Mask  
-//
-
-{ .mmi
-(p0)  ldfe f40 = [r34],16 
-      nop.m 999
-//
-//    Load L_lo
-//    Set p10 if 14 < expo_X 
-//
-(p0)  addl r50 = @ltoff(Constants_exp_64_T1#),gp 
+{ .mfi
+      ldfe FR_P6Q9 = [GR_ad_PQ],16       // P6(exp) or Q9(expm1) for small path
+      mov FR_r = FR_norm_x               // r = X for small path
+      mov GR_very_small_exp = -60        // Exponent of x for very small path
 }
-{ .mmi
-	nop.m 999
-	nop.m 999
-(p0)  addl r51 = @ltoff(Constants_exp_64_T2#),gp ;; 
+{ .mfi
+      add GR_ad_W2 = 0x400, GR_ad_T1     // Point to W2 table
+      nop.f 999
+(p7)  mov GR_small_exp = -7              // Exponent of x for small path expm1
 }
-//
-//    Load W2_ptr
-//    Branch to SMALL is expo_X < -6
-//
+;;
 
-{.mmi
-(p0)  ld8 r50 = [r50]  
-(p0)  ld8 r51 = [r51]  
-};;
+{ .mmi
+      ldfe FR_P5Q8 = [GR_ad_PQ],16       // P5(exp) or Q8(expm1) for small path
+      and  GR_exp_x = GR_signexp_x, GR_exp_mask
+(p6)  mov GR_small_exp = -12             // Exponent of x for small path exp
+}
+;;
 
-{ .mlx
-(p0)  ldfe f41 = [r34],16 
-//
-//    float_N = X * L_Inv
-//    expo_X = exponent of X
-//    Mask = 0x1FFFF
-//
-(p0)  movl r58 = 0x0FFFF 
+// N_signif = X * Inv_log2_by_2^12
+// By adding 1.10...0*2^63 we shift and get round_int(N_signif) in significand.
+// We actually add 1.10...0*2^51 to X * Inv_log2 to do the same thing.
+{ .mfi
+      ldfe FR_P4Q7 = [GR_ad_PQ],16       // P4(exp) or Q7(expm1) for small path
+      fma.s1 FR_N_signif = FR_norm_x, FR_INV_LN2_2TO63, FR_RSHF_2TO51
+      nop.i 999
 }
-{ .mlx
-	nop.m 999
-(p0)  movl r39 = 0x1FFFF ;; 
+{ .mfi
+      sub GR_exp_x = GR_exp_x, GR_exp_bias // Get exponent
+      fmpy.s1 FR_r4 = FR_rsq, FR_rsq     // Form r4 for small path
+      cmp.eq.unc  p15, p0 =  r0, r0      // Set Safe as default
 }
+;;
+
 { .mmi
-(p0)  getf.exp r37 = f9 
-	nop.m 999
-(p0)  addl r34 = @ltoff(Constants_exp_64_Exponents#),gp ;; 
+      ldfe FR_P3Q6 = [GR_ad_PQ],16       // P3(exp) or Q6(expm1) for small path
+      cmp.lt  p14, p0 =  GR_exp_x, GR_very_small_exp // Is |x| < 2^-60?
+      nop.i 999
 }
-{ .mii
-(p0)  ld8 r34 = [r34]  
-      nop.i 999 
-(p0)  and  r37 = r37, r39 ;;  
+;;
+
+{ .mfi
+      ldfe FR_P2Q5 = [GR_ad_PQ],16       // P2(exp) or Q5(expm1) for small path
+      fmpy.s1 FR_half_x = FR_half, FR_norm_x // 0.5 * x for very small path
+      cmp.lt  p13, p0 =  GR_exp_x, GR_small_exp // Is |x| < 2^-m?
 }
-{ .mmi
-(p0)  sub r37 = r37, r58 ;;  
-(p0)  cmp.gt.unc  p14, p0 =  -6, r37 
-(p0)  cmp.lt.unc  p10, p0 =  14, r37 ;; 
+{ .mib
+      nop.m 999
+      nop.i 999
+(p14) br.cond.spnt EXP_VERY_SMALL        // Branch if |x| < 2^-60
 }
+;;
+
 { .mfi
-(p0)  nop.m 0  
-//
-//    Load L_inv 
-//    Set p12 true for Flag = 0 (exp)
-//    Set p13 true for Flag = 1 (expm1)
-//
-(p0)  fmpy.s1 f38 = f9, f37 
-	nop.i 999 ;;
+      ldfe FR_A3 = [GR_ad_A],16          // Get A3 for normal path
+      fcmp.ge.s1 p10,p0 = FR_norm_x, FR_min_oflow_x // Will result overflow?
+      mov GR_big_expo_neg = -16381       // -0x3ffd
 }
 { .mfb
-	nop.m 999
-//
-//    Load L_hi
-//    expo_X = expo_X - Bias
-//    get W1_ptr      
-//
-(p0)  fcvt.fx.s1 f39 = f38
-(p14) br.cond.spnt EXPL_SMALL ;; 
+      ldfe FR_P1Q4 = [GR_ad_PQ],16       // P1(exp) or Q4(expm1) for small path
+      nop.f 999
+(p13) br.cond.spnt EXP_SMALL             // Branch if |x| < 2^-m
+                                         // m=12 for exp, m=7 for expm1
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p10) br.cond.spnt EXPL_HUGE ;; 
+;;
+
+// Now we are on the main path for |x| >= 2^-m, m=12 for exp, m=7 for expm1
+//
+// float_N = round_int(N_signif) 
+// The signficand of N_signif contains the rounded integer part of X * 2^12/ln2,
+// as a twos complement number in the lower bits (that is, it may be negative).
+// That twos complement number (called N) is put into GR_N.
+
+// Since N_signif is scaled by 2^51, it must be multiplied by 2^-51
+// before the shift constant 1.10000 * 2^63 is subtracted to yield float_N.
+// Thus, float_N contains the floating point version of N
+
+
+{ .mfi
+      ldfe FR_A2 = [GR_ad_A],16          // Get A2 for main path
+      fcmp.lt.s1 p11,p0 = FR_norm_x, FR_zero_uflow_x // Certain zero, uflow?
+      add GR_ad_T2 = 0x100, GR_ad_T1     // Point to T2 table
 }
-{ .mmi
-(p0)  shladd r34 = r32,4,r34 
+{ .mfi
       nop.m 999
-(p0)  addl r35 = @ltoff(Constants_exp_64_A#),gp ;; 
-}
-//
-//    Load T_1,T_2
-//
-{ .mmi
-   nop.m 999
-   ld8   r35 =[r35]
-   nop.i 99
-};;
-{ .mmb
-(p0)  ldfe f51 = [r35],16 
-(p0)  ld8 r45 = [r34],8
-	nop.b 999 ;;
+      fms.s1 FR_float_N = FR_N_signif, FR_2TOM51, FR_RSHF // Form float_N
+      nop.i 999
 }
-//    
-//    Set Safe = True  if k >= big_expo_neg  
-//    Set Safe = False if k < big_expo_neg  
-//    
-{ .mmb
-(p0)  ldfe f49 = [r35],16 
-(p0)  ld8 r48 = [r34],0
-	nop.b 999 ;;
+;;
+
+{ .mbb
+      getf.sig GR_N_fix = FR_N_signif    // Get N from significand
+(p10) br.cond.spnt  EXP_OVERFLOW         // Branch if result will overflow
+(p11) br.cond.spnt  EXP_CERTAIN_UNDERFLOW_ZERO // Branch if certain zero, uflow
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Branch to HUGE is expo_X > 14 
-//
-(p0)  fcvt.xf f38 = f39 
-	nop.i 999 ;;
+      ldfe FR_A1 = [GR_ad_A],16          // Get A1 for main path
+      fnma.s1 FR_r = FR_L_hi, FR_float_N, FR_norm_x  // r = -L_hi * float_N + x
+      extr.u GR_M1 = GR_N_fix, 6, 6      // Extract index M_1
 }
 { .mfi
-(p0)  getf.sig r52 = f39 
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mii
-	nop.m 999
-(p0)  extr.u r43 = r52, 6, 6 ;;  
-//
-//    r = r - float_N * L_lo
-//    K = extr(N_fix,12,52)
-//
-(p0)  shladd r40 = r43,3,r40 ;; 
+      and GR_M2 = 0x3f, GR_N_fix         // Extract index M_2
+      nop.f 999
+      nop.i 999
 }
+;;
+
+// N_fix is only correct up to 50 bits because of our right shift technique.
+// Actually in the normal path we will have restricted K to about 14 bits.
+// Somewhat arbitrarily we extract 32 bits.
 { .mfi
-(p0)  shladd r50 = r43,2,r50 
-(p0)  fnma.s1 f42 = f40, f38, f9 
-//
-//    float_N = float(N)
-//    N_fix = signficand N 
-//
-(p0)  extr.u r42 = r52, 0, 6  
+      shladd GR_ad_W1 = GR_M1,3,GR_ad_W1 // Point to W1
+      nop.f 999
+      extr GR_K = GR_N_fix, 12, 32       // Extract limited range K
 }
-{ .mmi
-(p0)  ldfd  f43 = [r40],0 ;; 
-(p0)  shladd r41 = r42,3,r41 
-(p0)  shladd r51 = r42,2,r51 
+{ .mfi
+      shladd GR_ad_T1 = GR_M1,2,GR_ad_T1 // Point to T1
+      nop.f 999
+      shladd GR_ad_T2 = GR_M2,2,GR_ad_T2 // Point to T2
 }
-//
-//    W_1_p1 = 1 + W_1
-//
+;;
+
 { .mmi
-(p0)  ldfs  f44 = [r50],0 ;; 
-(p0)  ldfd  f45 = [r41],0 
-//
-//    M_2 = extr(N_fix,0,6)
-//    M_1 = extr(N_fix,6,6)
-//    r = X - float_N * L_hi
-//
-(p0)  extr r44 = r52, 12, 52  
+      ldfs  FR_T1 = [GR_ad_T1],0         // Get T1
+      ldfd  FR_W1 = [GR_ad_W1],0         // Get W1
+      add GR_exp_2_k = GR_exp_bias, GR_K // Form exponent of 2^k
 }
+;;
+
 { .mmi
-(p0)  ldfs  f46 = [r51],0 ;; 
-(p0)  sub r46 = r58, r44  
-(p0)  cmp.gt.unc  p8, p15 =  r44, r45 
-}
-//    
-//    W = W_1 + W_1_p1*W_2 
-//    Load  A_2 
-//    Bias_m_K = Bias - K
-//
-{ .mii
-(p0)  ldfe f40 = [r35],16 
-//
-//    load A_1
-//    poly = A_2 + r*A_3 
-//    rsq = r * r  
-//    neg_2_mK = exponent of Bias_m_k
-//
-(p0)  add r47 = r58, r44 ;;  
-//    
-//    Set Safe = True  if k <= big_expo_pos  
-//    Set Safe = False  if k >  big_expo_pos  
-//    Load A_3
-//    
-(p15) cmp.lt p8,p15 = r44,r48 ;;
+      ldfs  FR_T2 = [GR_ad_T2],0         // Get T2
+      shladd GR_ad_W2 = GR_M2,3,GR_ad_W2 // Point to W2
+      sub GR_exp_2_mk = GR_exp_bias, GR_K // Form exponent of 2^-k
 }
+;;
+
 { .mmf
-(p0)  setf.exp f61 = r46 
-//    
-//    Bias_p + K = Bias + K
-//    T = T_1 * T_2
-//    
-(p0)  setf.exp f36 = r47 
-(p0)  fnma.s1 f42 = f41, f38, f42 ;; 
+      ldfd  FR_W2 = [GR_ad_W2],0         // Get W2
+      setf.exp FR_scale = GR_exp_2_k     // Set scale = 2^k
+      fnma.s1 FR_r = FR_L_lo, FR_float_N, FR_r // r = -L_lo * float_N + r
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Load W_1,W_2
-//    Load big_exp_pos, load big_exp_neg
-//
-(p0)  fadd.s1 f47 = f43, f1 
-	nop.i 999 ;;
+      setf.exp FR_2_mk = GR_exp_2_mk     // Form 2^-k
+      fma.s1 FR_poly = FR_r, FR_A3, FR_A2 // poly = r * A3 + A2
+      cmp.lt p8,p15 = GR_K,GR_big_expo_neg // Set Safe if K > big_expo_neg
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 f52 = f42, f51, f49 
-	nop.i 999
+      nop.m 999
+      fmpy.s1 FR_rsq = FR_r, FR_r         // rsq = r * r
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 f48 = f42, f42 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 FR_T = FR_T1, FR_T2         // T = T1 * T2
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 f53 = f44, f46 
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 FR_W1_p1 = FR_W1, f1        // W1_p1 = W1 + 1.0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fma.s1 f54 = f45, f47, f43 
-	nop.i 999
+(p7)  cmp.lt.unc  p8, p9 =  10, GR_K       // If expm1, set p8 if K > 10 
+      fma.s1 FR_poly = FR_r, FR_poly, FR_A1 // poly = r * poly + A1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fneg f61 =  f61 
-	nop.i 999 ;;
+(p7)  cmp.eq  p15, p0 =  r0, r0            // If expm1, set Safe flag
+      fma.s1 FR_T_scale = FR_T, FR_scale, f0 // T_scale = T * scale
+(p9)  cmp.gt.unc  p9, p10 =  -10, GR_K     // If expm1, set p9 if K < -10
+                                           // If expm1, set p10 if -10<=K<=10
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 f52 = f42, f52, f40 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_W = FR_W2, FR_W1_p1, FR_W1 // W = W2 * (W1+1.0) + W1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 f55 = f54, f1 
-	nop.i 999
+      nop.m 999
+      mov FR_Y_hi = FR_T                   // Assume Y_hi = T
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    W + Wp1 * poly     
-// 
-(p0)  mov f34 = f53 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_poly = FR_rsq, FR_poly, FR_r // poly = rsq * poly + r
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    A_1 + r * poly 
-//    Scale = setf_expl(Bias_p_k) 
-//
-(p0)  fma.s1 f52 = f48, f52, f42 
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1 FR_Wp1_T_scale = FR_W, FR_T_scale, FR_T_scale // (W+1)*T*scale
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    poly = r + rsq(A_1 + r*poly) 
-//    Wp1 = 1 + W
-//    neg_2_mK = -neg_2_mK
-//
-(p0)  fma.s1 f35 = f55, f52, f54
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p0)  fmpy.s1 f35 = f35, f53 
-//   
-//    Y_hi = T
-//    Y_lo = T * (W + Wp1*poly)
-//
-(p12) br.cond.sptk EXPL_MAIN ;; 
-}
-//
-//    Branch if expl(x)  
-//    Continue for expl(x-1)
-//
-{ .mii
-(p0)  cmp.lt.unc  p12, p13 =  10, r44 
-	nop.i 999 ;;
-//
-//    Set p12 if 10 < K, Else p13 
-//
-(p13) cmp.gt.unc  p13, p14 =  -10, r44 ;; 
+      nop.m 999
+      fma.s1 FR_W_T_scale = FR_W, FR_T_scale, f0 // W*T*scale
+      nop.i 999
 }
-//
-//    K > 10:  Y_lo = Y_lo + neg_2_mK
-//    K <=10:  Set p13 if -10 > K, Else set p14 
-//
+;;
+
 { .mfi
-(p13) cmp.eq  p15, p0 =  r0, r0 
-(p14) fadd.s1 f34 = f61, f34 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fsub.s1 FR_Y_hi = f0, FR_2_mk      // If expm1, if K < -10 set Y_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p12) fadd.s1 f35 = f35, f61 
-	nop.i 999 ;;
+      nop.m 999
+(p10) fsub.s1 FR_Y_hi = FR_T, FR_2_mk    // If expm1, if |K|<=10 set Y_hi
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13) fadd.s1 f35 = f35, f34 
-	nop.i 999
-}
-{ .mfb
-	nop.m 999
-//
-//    K <= 10 and K < -10, Set Safe = True
-//    K <= 10 and K < 10,   Y_lo = Y_hi + Y_lo 
-//    K <= 10 and K > =-10, Y_hi = Y_hi + neg_2_mk 
-// 
-(p13) mov f34 = f61 
-(p0)  br.cond.sptk EXPL_MAIN ;; 
-}
-EXPL_SMALL: 
-{ .mmi
       nop.m 999
-(p0)  addl r34 = @ltoff(Constants_exp_64_Exponents#),gp  
-(p12) addl r35 = @ltoff(Constants_exp_64_P#),gp ;; 
+      fma.s1 FR_result_lo = FR_Wp1_T_scale, FR_poly, FR_W_T_scale
+      nop.i 999
 }
-.pred.rel "mutex",p12,p13
-{ .mmi
-(p12) ld8  r35=[r35]      
-nop.m 999
-(p13) addl r35 = @ltoff(Constants_exp_64_Q#),gp 
-};;
-{ .mmi
-(p13) ld8  r35=[r35]      
-(p0) ld8  r34=[r34]      
-nop.i 999
-};;
+;;
+
+.pred.rel "mutex",p8,p9
+// If K > 10 adjust result_lo = result_lo - scale * 2^-k
+// If |K| <= 10 adjust result_lo = result_lo + scale * T
 { .mfi
-(p0)  add r34 = 0x48,r34  
-// 
-//    Return
-//    K <= 10 and K < 10,   Y_hi = neg_2_mk 
-// 
-//    /*******************************************************/
-//    /*********** Branch EXPL_SMALL  ************************/
-//    /*******************************************************/
-(p0)  mov f42 = f9 
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fnma.s1 FR_result_lo = FR_scale, FR_2_mk, FR_result_lo // If K > 10
+      nop.i 999
 }
-//
-//    Flag = 0
-//    r4 = rsq * rsq
-//
 { .mfi
-(p0)  ld8 r49 =[r34],0
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    Flag = 1
-//
-(p0)  cmp.lt.unc  p14, p0 =  r37, r49 ;; 
+      nop.m 999
+(p9)  fma.s1 FR_result_lo = FR_T_scale, f1, FR_result_lo // If |K| <= 10
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    r = X
-//
-(p0)  fmpy.s1 f48 = f42, f42 
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s0 FR_tmp = FR_A1, FR_A1         // Dummy op to set inexact
+      nop.i 999
 }
 { .mfb
-	nop.m 999
-//
-//    rsq = r * r
-//
-(p0)  fmpy.s1 f50 = f48, f48 
-//
-//    Is input very small?
-//
-(p14) br.cond.spnt EXPL_VERY_SMALL ;; 
-}
-//
-//    Flag_not1: Y_hi = 1.0
-//    Flag is 1: r6 = rsq * r4
-//
-{ .mfi
-(p12) ldfe f52 = [r35],16 
-(p12) mov f34 = f1 
-(p0)  add r53 = 0x1,r0 ;;  
-}
-{ .mfi
-(p13) ldfe f51 = [r35],16 
-//
-//    Flag_not_1: Y_lo = poly_hi + r4 * poly_lo
-//
-(p13) mov f34 = f9 
-	nop.i 999 ;;
-}
-{ .mmf
-(p12) ldfe f53 = [r35],16 
-//
-//    For Flag_not_1, Y_hi = X
-//    Scale = 1
-//    Create 0x000...01
-//
-(p0)  setf.sig f37 = r53 
-(p0)  mov f36 = f1 ;; 
-}
-{ .mmi
-(p13) ldfe f52 = [r35],16 ;; 
-(p12) ldfe f54 = [r35],16 
-	nop.i 999 ;;
-}
-{ .mfi
-(p13) ldfe f53 = [r35],16 
-(p13) fmpy.s1 f58 = f48, f50 
-	nop.i 999 ;;
-}
-//
-//    Flag_not1: poly_lo = P_5 + r*P_6
-//    Flag_1: poly_lo = Q_6 + r*Q_7
-//
-{ .mmi
-(p13) ldfe f54 = [r35],16 ;; 
-(p12) ldfe f55 = [r35],16 
-	nop.i 999 ;;
-}
-{ .mmi
-(p12) ldfe f56 = [r35],16 ;; 
-(p13) ldfe f55 = [r35],16 
-	nop.i 999 ;;
+      nop.m 999
+(p15) fma.s0 f8 = FR_Y_hi, FR_scale, FR_result_lo  // Safe result
+(p15) br.ret.sptk b0                        // Safe exit for normal path
 }
-{ .mmi
-(p12) ldfe f57 = [r35],0 ;; 
-(p13) ldfe f56 = [r35],16 
-	nop.i 999 ;;
+;;
+
+// Here if unsafe, will only be here for exp with K < big_expo_neg
+{ .mfb
+      nop.m 999
+      fma.s0 FR_RESULT = FR_Y_hi, FR_scale, FR_result_lo  // Prelim result
+      br.cond.sptk EXP_POSSIBLE_UNDERFLOW  // Branch to unsafe code
 }
+;;
+
+ 
+EXP_SMALL: 
+// Here if 2^-60 < |x| < 2^-m, m=12 for exp, m=7 for expm1
 { .mfi
-(p13) ldfe f57 = [r35],0 
-	nop.f 999
-	nop.i 999 ;;
+(p7)  ldfe FR_Q3 = [GR_ad_Q],16          // Get Q3 for small path, if expm1
+(p6)  fma.s1 FR_p65 = FR_P6, FR_r, FR_P5  // If exp, p65 = P6 * r + P5
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    For  Flag_not_1, load p5,p6,p1,p2
-//    Else load p5,p6,p1,p2
-//
-(p12) fma.s1 f60 = f52, f42, f53 
-	nop.i 999 ;;
+      mov GR_minus_one = -1
+(p7)  fma.s1 FR_q98 = FR_Q9, FR_r, FR_Q8  // If expm1, q98 = Q9 * r + Q8
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13) fma.s1 f60 = f51, f42, f52 
-	nop.i 999 ;;
+(p7)  ldfe FR_Q2 = [GR_ad_Q],16           // Get Q2 for small path, if expm1
+(p7)  fma.s1 FR_q65 = FR_Q6, FR_r, FR_Q5  // If expm1, q65 = Q6 * r + Q5
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p12) fma.s1 f60 = f60, f42, f54 
-	nop.i 999 ;;
+      setf.sig FR_tmp = GR_minus_one      // Create value to force inexact
+(p6)  fma.s1 FR_p21 = FR_P2, FR_r, FR_P1  // If exp, p21 = P2 * r + P1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p12) fma.s1 f59 = f56, f42, f57 
-	nop.i 999 ;;
+(p7)  ldfe FR_Q1 = [GR_ad_Q],16           // Get Q1 for small path, if expm1
+(p7)  fma.s1 FR_q43 = FR_Q4, FR_r, FR_Q3  // If expm1, q43 = Q4 * r + Q3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13) fma.s1 f60 = f42, f60, f53 
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fma.s1 FR_p654 = FR_p65, FR_r, FR_P4 // If exp, p654 = p65 * r + P4
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p12) fma.s1 f59 = f59, f48, f42 
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fma.s1 FR_q987 = FR_q98, FR_r, FR_Q7 // If expm1, q987 = q98 * r + Q7
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Flag_1: poly_lo = Q_5 + r*(Q_6 + r*Q_7) 
-//    Flag_not1: poly_lo = P_4 + r*(P_5 + r*P_6)
-//    Flag_not1: poly_hi = (P_1 + r*P_2)
-//
-(p13) fmpy.s1 f60 = f60, f58 
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fma.s1 FR_q21 = FR_Q2, FR_r, FR_Q1  // If expm1, q21 = Q2 * r + Q1
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p12) fma.s1 f60 = f60, f42, f55 
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fma.s1 FR_p210 = FR_p21, FR_rsq, FR_r // If exp, p210 = p21 * r + P0
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Flag_1: poly_lo = r6 *(Q_5 + ....)
-//    Flag_not1: poly_hi =  r + rsq *(P_1 + r*P_2)
-//
-(p12) fma.s1 f35 = f60, f50, f59 
-	nop.i 999
+      nop.m 999
+(p7)  fma.s1 FR_q6543 = FR_q65, FR_rsq, FR_q43 // If expm1, q6543 = q65*r2+q43
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13) fma.s1 f59 = f54, f42, f55 
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fma.s1 FR_p6543 = FR_p654, FR_r, FR_P3 // If exp, p6543 = p654 * r + P3
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Flag_not1: Y_lo = rsq* poly_hi + poly_lo 
-//    Flag_1: poly_lo = rsq* poly_hi + poly_lo 
-//
-(p13) fma.s1 f59 = f59, f42, f56 
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fma.s1 FR_q9876543 = FR_q987, FR_r4, FR_q6543 // If expm1, q9876543 = ...
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Flag_not_1: (P_1 + r*P_2) 
-//
-(p13) fma.s1 f59 = f59, f42, f57 
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fma.s1 FR_Y_lo = FR_p6543, FR_r4, FR_p210 // If exp, form Y_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Flag_not_1: poly_hi = r + rsq * (P_1 + r*P_2) 
-//
-(p13) fma.s1 f35 = f59, f48, f60 
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fma.s1 FR_Y_lo = FR_q9876543, FR_rsq, FR_q21 // If expm1, form Y_lo
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Create 0.000...01
-//
-(p0)  for f37 = f35, f37 
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-//
-//    Set lsb of Y_lo to 1
-//
-(p0)  fmerge.se f35 = f35,f37 
-(p0)  br.cond.sptk EXPL_MAIN ;; 
-}
-EXPL_VERY_SMALL: 
-{ .mmi
-	nop.m 999
-	nop.m 999
-(p13) addl r34 = @ltoff(Constants_exp_64_Exponents#),gp 
+      nop.m 999
+      fmpy.s0  FR_tmp = FR_tmp, FR_tmp   // Dummy op to set inexact
+      nop.i 999
 }
+;;
+
+.pred.rel "mutex",p6,p7
 { .mfi
-	nop.m 999
-(p12) mov f35 = f9 
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fma.s0 f8 = FR_Y_lo, f1, f1          // If exp, result = 1 + Y_lo
+      nop.i 999
 }
 { .mfb
-(p13) ld8 r34 = [r34] 
-(p12) mov f34 = f1 
-(p12) br.cond.sptk EXPL_MAIN ;; 
-}
-{ .mlx
-(p13) add  r34 = 8,r34 
-(p13) movl r39 = 0x0FFFE ;; 
-}
-//
-//    Load big_exp_neg 
-//    Create 1/2's exponent
-//
-{ .mii
-(p13) setf.exp f56 = r39 
-(p13) shladd r34 = r32,4,r34 ;;  
-	nop.i 999
+      nop.m 999
+(p7)  fma.s0 f8 = FR_Y_lo, FR_rsq, FR_norm_x // If expm1, result = Y_lo*r2+x
+      br.ret.sptk  b0                      // Exit for 2^-60 <= |x| < 2^-m
+                                           // m=12 for exp, m=7 for expm1
 }
+;;
+
+
+EXP_VERY_SMALL: 
 //
-//    Negative exponents are stored after positive
+// Here if 0 < |x| < 2^-60
+// If exp, result = 1.0 + x
+// If expm1, result = x +x*x/2, but have to check for possible underflow
 //
+
 { .mfi
-(p13) ld8 r45 = [r34],0
-//
-//    Y_hi = x
-//    Scale = 1
-//
-(p13) fmpy.s1 f35 = f9, f9 
-	nop.i 999 ;;
+(p7)  mov GR_exp_underflow = -16381        // Exponent for possible underflow
+(p6)  fadd.s0 f8 = f1, FR_norm_x           // If exp, result = 1+x
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Reset Safe if necessary 
-//    Create 1/2
-//
-(p13) mov f34 = f9 
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fmpy.s1 FR_result_lo = FR_half_x, FR_norm_x  // If expm1 result_lo = x*x/2
+      nop.i 999
 }
+;;
+
 { .mfi
-(p13) cmp.lt.unc  p0, p15 =  r37, r45 
-(p13) mov f36 = f1 
-	nop.i 999 ;;
+(p7)  cmp.lt.unc p0, p8 = GR_exp_x, GR_exp_underflow // Unsafe if expm1 x small
+(p7)  mov FR_Y_hi = FR_norm_x              // If expm1, Y_hi = x
+(p7)  cmp.lt p0, p15 = GR_exp_x, GR_exp_underflow // Unsafe if expm1 x small
 }
+;;
+
 { .mfb
-	nop.m 999
-//
-//    Y_lo = x * x
-//
-(p13) fmpy.s1 f35 = f35, f56 
-//
-//    Y_lo = x*x/2 
-//
-(p13) br.cond.sptk EXPL_MAIN ;; 
-}
-EXPL_HUGE: 
-{ .mfi
-	nop.m 999
-(p0)  fcmp.gt.unc.s1 p14, p0 =  f9, f0 
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl r39 = 0x15DC0 ;; 
-}
-{ .mfi
-(p14) setf.exp f34 = r39 
-(p14) mov f35 = f1 
-(p14) cmp.eq  p0, p15 =  r0, r0 ;; 
+      nop.m 999
+(p8)  fma.s0 f8 = FR_norm_x, f1, FR_result_lo // If expm1, result=x+x*x/2
+(p15) br.ret.sptk b0                       // If Safe, exit
 }
+;;
+
+// Here if expm1 and 0 < |x| < 2^-16381;  may be possible underflow
 { .mfb
-	nop.m 999
-(p14) mov f36 = f34 
-//
-//    If x > 0, Set Safe = False
-//    If x > 0, Y_hi = 2**(24,000)
-//    If x > 0, Y_lo = 1.0
-//    If x > 0, Scale = 2**(24,000)
-//
-(p14) br.cond.sptk EXPL_MAIN ;; 
-}
-{ .mlx
-	nop.m 999
-(p12) movl r39 = 0xA240 
-}
-{ .mlx
-	nop.m 999
-(p12) movl r38 = 0xA1DC ;; 
-}
-{ .mmb
-(p13) cmp.eq  p15, p14 =  r0, r0 
-(p12) setf.exp f34 = r39 
-	nop.b 999 ;;
-}
-{ .mlx
-(p12) setf.exp f35 = r38 
-(p13) movl r39 = 0xFF9C 
-}
-{ .mfi
-	nop.m 999
-(p13) fsub.s1 f34 = f0, f1
-	nop.i 999 ;;
+      nop.m 999
+      fma.s0 FR_RESULT = FR_Y_hi, FR_scale, FR_result_lo // Prelim result
+      br.cond.sptk EXP_POSSIBLE_UNDERFLOW  // Branch to unsafe code
 }
-{ .mfi
-	nop.m 999
-(p12) mov f36 = f34 
-(p12) cmp.eq  p0, p15 =  r0, r0 ;; 
+;;
+
+EXP_CERTAIN_UNDERFLOW_ZERO:
+// Here if x < zero_uflow_x
+// For exp, set result to tiny+0.0 and set I, U, and branch to error handling
+// For expm1, set result to tiny-1.0 and set I, and exit
+{ .mmi
+      alloc GR_SAVE_PFS = ar.pfs,0,3,4,0
+      nop.m 999
+      mov GR_one = 1
 }
-{ .mfi
-(p13) setf.exp f35 = r39 
-(p13) mov f36 = f1 
-	nop.i 999 ;;
+;;
+
+{ .mmi
+      setf.exp FR_small = GR_one               // Form small value
+      nop.m 999
+(p6)  mov GR_Parameter_TAG = 13                // Error tag for exp underflow
 }
-EXPL_MAIN: 
+;;
+
 { .mfi
-(p0)  cmp.ne.unc p12, p0 = 0x01, r33
-(p0)  fmpy.s1 f101 = f36, f35 
-	nop.i 999 ;;
+      nop.m 999
+      fmerge.s FR_X = f8,f8                    // Save x for error call
+      nop.i 999
 }
+;;
+
+.pred.rel "mutex",p6,p7
 { .mfb
-	nop.m 999
-(p0)  fma.s0 f99 = f34, f36, f101 
-(p15) br.cond.sptk EXPL_64_RETURN ;;
-}
-{ .mfi
-	nop.m 999
-(p0)  fsetc.s3 0x7F,0x01
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl r50 = 0x00000000013FFF ;;
+      nop.m 999
+(p6)  fma.s0 FR_RESULT = FR_small, FR_small, f0 // If exp, set I,U, tiny result
+(p6)  br.cond.sptk __libm_error_region          // If exp, go to error handling
 }
-//    
-//    S0 user supplied status
-//    S2 user supplied status + WRE + TD  (Overflows) 
-//    S3 user supplied status + RZ + TD   (Underflows) 
-//    
-//    
-//    If (Safe) is true, then
-//        Compute result using user supplied status field.
-//        No overflow or underflow here, but perhaps inexact.
-//        Return
-//    Else
-//       Determine if overflow or underflow  was raised.
-//       Fetch +/- overflow threshold for IEEE single, double,
-//       double extended   
-//    
-{ .mfi
-(p0)  setf.exp f60 = r50
-(p0)  fma.s3 f102 = f34, f36, f101 
-	nop.i 999
+{ .mfb
+      nop.m 999
+(p7)  fms.s0 f8 = FR_small, FR_small, f1        // If expm1, set I, result -1.0
+(p7)  br.ret.sptk  b0                           // If expm1, exit
+}
+;;
+     
+  
+EXP_OVERFLOW:
+// Here if x >= min_oflow_x
+{ .mmi
+      alloc GR_SAVE_PFS = ar.pfs,0,3,4,0
+      mov GR_huge_exp = 0x1fffe
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fsetc.s3 0x7F,0x40 
-	nop.i 999 ;;
+      mov GR_huge_signif = -0x1
+      nop.f 999
+(p6)  mov GR_Parameter_TAG = 12                // Error tag for exp overflow
 }
-{ .mfi
-	nop.m 999
-//
-//    For Safe, no need to check for over/under. 
-//    For expm1, handle errors like exp. 
-//
-(p0)  fsetc.s2 0x7F,0x42
-	nop.i 999;;
+;;
+
+{ .mmf
+      setf.exp FR_huge_exp = GR_huge_exp       // Create huge value
+      setf.sig FR_huge_signif = GR_huge_signif // Create huge value
+      fmerge.s FR_X = f8,f8                    // Save x for error call
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fma.s2 f100 = f34, f36, f101 
-	nop.i 999 ;;
+      nop.m 999
+      fmerge.se FR_huge = FR_huge_exp, FR_huge_signif
+(p7)  mov GR_Parameter_TAG = 39                // Error tag for expm1 overflow
 }
-{ .mfi
-	nop.m 999
-(p0)  fsetc.s2 0x7F,0x40 
-	nop.i 999 ;;
+;;
+
+{ .mfb
+      nop.m 999
+      fma.s0 FR_RESULT = FR_huge, FR_huge, FR_huge // Force I, O, and Inf
+      br.cond.sptk __libm_error_region         // Branch to error handling
 }
+;;
+
+
+
+EXP_POSSIBLE_UNDERFLOW:
+// Here if exp and zero_uflow_x < x < about -11356 [where k < -16381]
+// Here if expm1 and |x| < 2^-16381
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc   p12, p0 =  f102, 0x00F
-	nop.i 999
+      alloc GR_SAVE_PFS = ar.pfs,0,3,4,0
+      fsetc.s2 0x7F,0x41                   // Set FTZ and disable traps
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc   p11, p0 =  f102, 0x00F
-	nop.i 999 ;;
+      nop.m 999
+      fma.s2 FR_ftz = FR_Y_hi, FR_scale, FR_result_lo   // Result with FTZ
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p7)  fcmp.ge.unc.s1 p10, p0 =  f100, f60
-	nop.i 999
+      nop.m 999
+      fsetc.s2 0x7F,0x40                   // Disable traps (set s2 default)
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//    
-//    Create largest double exponent + 1.
-//    Create smallest double exponent - 1.
-//    
-(p0)  fcmp.ge.unc.s1 p8, p0 =  f100, f60
-	nop.i 999 ;;
-}
-//    
-//    fcmp:   resultS2 >= + overflow threshold  -> set (a) if true
-//    fcmp:   resultS2 <= - overflow threshold  -> set (b) if true
-//    fclass: resultS3 is denorm/unorm/0        -> set (d) if true
-//    
-{ .mib
-(p10) mov   GR_Parameter_TAG = 39
-	nop.i 999
-(p10) br.cond.sptk __libm_error_region ;;
-}
-{ .mib
-(p8)  mov   GR_Parameter_TAG = 12
-	nop.i 999
-(p8)  br.cond.sptk __libm_error_region ;;
-}
-//    
-//    Report that exp overflowed
-//    
-{ .mib
-(p12) mov   GR_Parameter_TAG = 40
-	nop.i 999
-(p12) br.cond.sptk __libm_error_region ;;
-}
-{ .mib
-(p11) mov   GR_Parameter_TAG = 13
-	nop.i 999
-(p11) br.cond.sptk __libm_error_region ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-//    
-//    Report that exp underflowed
-//    
-(p0)  br.cond.sptk EXPL_64_RETURN ;;
+      nop.m 999
+(p6)  fclass.m.unc p11, p0 = FR_ftz, 0x00F // If exp, FTZ result denorm or zero?
+      nop.i 999
 }
-EXPL_64_SPECIAL: 
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p6,  p0 =  f8, 0x0c3 
-	nop.i 999
+;;
+
+{ .mfb
+(p11) mov   GR_Parameter_TAG = 13             // exp underflow
+      fmerge.s FR_X = f8,f8                   // Save x for error call
+(p11) br.cond.spnt __libm_error_region        // Branch on exp underflow
 }
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p13, p8 =  f8, 0x007 
-	nop.i 999 ;;
+;;
+
+{ .mfb
+      nop.m 999
+      mov   f8     = FR_RESULT                // Was safe after all
+      br.ret.sptk   b0
 }
+;;
+
+
+EXP_64_SPECIAL: 
+// Here if x natval, nan, inf, zero
+// If x natval, +inf, or if expm1 and x zero, just return x.
+// The other cases must be tested for, and results set.
+// These cases do not generate exceptions.
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc p14, p0 =  f8, 0x007 
-	nop.i 999
+      nop.m 999
+      fclass.m p8, p0 =  f8, 0x0c3            // Is x nan?
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc p12, p9 =  f8, 0x021 
-	nop.i 999 ;;
+      nop.m 999
+(p6)  fclass.m.unc p13, p0 =  f8, 0x007       // If exp, is x zero?
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fclass.m.unc p11, p0 =  f8, 0x022 
-	nop.i 999
+      nop.m 999
+(p6)  fclass.m.unc p11, p0 =  f8, 0x022       // If exp, is x -inf?
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p7)  fclass.m.unc p10, p0 =  f8, 0x022 
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fadd.s0 f8 = f8, f1                     // If x nan, result quietized x
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//    
-//    Identify +/- 0, Inf, or -Inf 
-//    Generate the right kind of NaN.
-//    
-(p13) fadd.s0 f99 = f0, f1 
-	nop.i 999 ;;
+      nop.m 999
+(p7)  fclass.m.unc p10, p0 =  f8, 0x022       // If expm1, is x -inf?
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p14) mov f99 = f8 
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p6)  fadd.s0 f99 = f8, f1 
-//    
-//    expl(+/-0) = 1 
-//    expm1l(+/-0) = +/-0 
-//    No exceptions raised
-//    
-(p6)  br.cond.sptk EXPL_64_RETURN ;; 
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p14) br.cond.sptk EXPL_64_RETURN ;; 
+      nop.m 999
+(p13) fadd.s0 f8 = f0, f1                     // If exp and x zero, result 1.0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11) mov f99 = f0 
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p10) fsub.s1 f99 = f0, f1 
-//    
-//    expl(-Inf) = 0 
-//    expm1l(-Inf) = -1 
-//    No exceptions raised.
-//    
-(p10) br.cond.sptk EXPL_64_RETURN ;; 
-}
-{ .mfb
-	nop.m 999
-(p12) fmpy.s1 f99 = f8, f1 
-//    
-//    expl(+Inf) = Inf 
-//    No exceptions raised.
-//    
-(p0)  br.cond.sptk EXPL_64_RETURN ;; 
+      nop.m 999
+(p11) mov f8 = f0                             // If exp and x -inf, result 0
+      nop.i 999
 }
-EXPL_64_UNSUPPORTED: 
+;;
+
 { .mfb
-	nop.m 999
-(p0)  fmpy.s0 f99 = f8, f0 
-(p0)  br.cond.sptk EXPL_64_RETURN ;; 
+      nop.m 999
+(p10) fsub.s1 f8 = f0, f1                     // If expm1, x -inf, result -1.0
+      br.ret.sptk b0                          // Exit special cases
 }
-EXPL_64_RETURN: 
+;;
+
+
+EXP_64_UNSUPPORTED: 
+// Here if x unsupported type
 { .mfb
       nop.m 999
-(p0)  mov   f8     = f99
-(p0)  br.ret.sptk   b0
+      fmpy.s0 f8 = f8, f0                     // Return nan
+      br.ret.sptk   b0
 }
-.endp
-ASM_SIZE_DIRECTIVE(expl) 
+;;
+
+GLOBAL_IEEE754_END(expl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -1598,9 +1410,9 @@ __libm_error_region:
         br.call.sptk b0=__libm_error_support#  // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 { .mmi
         ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
@@ -1613,8 +1425,7 @@ __libm_error_region:
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk     b0                     // Return
 };;
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region#)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_fabs.S b/sysdeps/ia64/fpu/s_fabs.S
index ea3908dbc3..3434389a3c 100644
--- a/sysdeps/ia64/fpu/s_fabs.S
+++ b/sysdeps/ia64/fpu/s_fabs.S
@@ -1,34 +1,82 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#undef ret
-
-ENTRY (__fabs)
-{
-	fabs fret0 = farg0
-	br.ret.sptk.many rp
-}	
-END (__fabs)
-
-strong_alias (__fabs, __fabsf)
-strong_alias (__fabs, __fabsl)
-
-weak_alias (__fabs, fabs)
-weak_alias (__fabsf, fabsf)
-weak_alias (__fabsl, fabsl)
+.file "fabs.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version 
+// 02/07/02 Added __libm_fabs entry point to test in case compiler inlines
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// double fabs  (double x)
+//
+// Overview of operation
+//==============================================================
+// returns absolute value of x 
+
+// floating-point registers used: 1
+// f8, input
+
+.section .text
+.global __libm_fabs#
+
+.proc __libm_fabs#
+__libm_fabs:
+.endp __libm_fabs#
+
+GLOBAL_IEEE754_ENTRY(fabs)
+
+// set invalid or denormal flags and take fault if
+// necessary
+
+{ .mfi
+      nop.m 999
+      fcmp.eq.unc.s0 p6,p7 = f8,f1             
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s       f8 = f0,f8                   
+      br.ret.sptk    b0 ;;                        
+}
+
+GLOBAL_IEEE754_END(fabs)
diff --git a/sysdeps/ia64/fpu/s_fabsf.S b/sysdeps/ia64/fpu/s_fabsf.S
index 7e5abde625..71bb6da882 100644
--- a/sysdeps/ia64/fpu/s_fabsf.S
+++ b/sysdeps/ia64/fpu/s_fabsf.S
@@ -1 +1,82 @@
-/* __fabsf is in s_fabs.S. */
+.file "fabsf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version 
+// 02/07/02 Added __libm_fabsf entry point to test in case compiler inlines
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// float fabsf  (float x)
+//
+// Overview of operation
+//==============================================================
+// returns absolute value of x 
+
+// floating-point registers used: 1
+// f8, input
+
+.section .text
+.global __libm_fabsf#
+
+.proc __libm_fabsf#
+__libm_fabsf:
+.endp __libm_fabsf#
+
+GLOBAL_IEEE754_ENTRY(fabsf)
+
+// set invalid or denormal flags and take fault if
+// necessary
+
+{ .mfi
+      nop.m 999
+      fcmp.eq.unc.s0 p6,p7 = f8,f1             
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s       f8 = f0,f8                   
+      br.ret.sptk    b0 ;;                        
+}
+
+GLOBAL_IEEE754_END(fabsf)
diff --git a/sysdeps/ia64/fpu/s_fabsl.S b/sysdeps/ia64/fpu/s_fabsl.S
index 3d7a41fe2b..a048949147 100644
--- a/sysdeps/ia64/fpu/s_fabsl.S
+++ b/sysdeps/ia64/fpu/s_fabsl.S
@@ -1 +1,82 @@
-/* __fabsl is in s_fabs.S. */
+.file "fabsl.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version 
+// 02/07/02 Added __libm_fabsl entry point to test in case compiler inlines
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// long double fabsl  (long double x)
+//
+// Overview of operation
+//==============================================================
+// returns absolute value of x 
+
+// floating-point registers used: 1
+// f8, input
+
+.section .text
+.global __libm_fabsl#
+
+.proc __libm_fabsl#
+__libm_fabsl:
+.endp __libm_fabsl#
+
+GLOBAL_IEEE754_ENTRY(fabsl)
+
+// set invalid or denormal flags and take fault if
+// necessary
+
+{ .mfi
+      nop.m 999
+      fcmp.eq.unc.s0 p6,p7 = f8,f1             
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s       f8 = f0,f8                   
+      br.ret.sptk    b0 ;;                        
+}
+
+GLOBAL_IEEE754_END(fabsl)
diff --git a/sysdeps/ia64/fpu/s_fdim.S b/sysdeps/ia64/fpu/s_fdim.S
new file mode 100644
index 0000000000..eff290c593
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fdim.S
@@ -0,0 +1,228 @@
+.file "fdim.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 06/08/01 Initial version
+// 08/23/01 Corrected error tag number
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance
+//
+// API
+//==============================================================
+// double fdim( double x, double y );
+// input  floating point f8, f9
+// output floating point f8
+//
+//
+// Overview of operation
+//==============================================================
+// fdim determines the positive difference between the arguments
+//   Result = x - y   if x > y
+//          = +0      if x <= y
+//
+// Error support is called if x-y overflows for x > y
+//
+
+// Registers used
+//==============================================================
+// General purpose registers: r14, r32 - r39
+
+rExpBig               = r14
+
+// r36-39 parameters for libm_error_support
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_SAVE_PFS           = r35
+
+GR_Parameter_X        = r36
+GR_Parameter_Y        = r37
+GR_Parameter_RESULT   = r38
+GR_Parameter_TAG      = r39
+
+// Floating-point registers: f8 - f12
+
+f_tmp_result          = f10
+fBig                  = f11
+fNormX                = f12
+
+// Predicate registers: p6 - p10
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(fdim)
+
+{ .mfi
+      mov             rExpBig = 0x103ff  // Exponent to indicate overflow
+      fcmp.le.s1      p6,p7 = f8, f9     // Is x <= y?
+      nop.i           0
+}
+{ .mfi
+      nop.m           0
+      fnorm.s1        fNormX = f8        // Save x
+      nop.i           0
+}
+;;
+
+{ .mfi
+      setf.exp        fBig = rExpBig     // Constant to test for overflow
+      fcmp.eq.s0      p8,p0 = f8, f9     // Dummy op to set Denormal or Invalid
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+      fclass.m        p9,p10 = f8, 0x1e3 // Test for x natval, nan, inf
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p6)  fmerge.s        f8 = f0, f0        // Result is +0 if x <= y
+      nop.i           0
+}
+{ .mfi
+      nop.m           0
+(p7)  fms.d.s0        f8 = f8, f1, f9    // Result is x - y if x > y
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p10) fclass.m        p9,p10 = f9, 0x1e3 // Test for y natval, nan, inf
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p10) fcmp.ge.s1      p8,p0 = f8, fBig   // Test result for overflow
+      nop.i           0
+}
+;;
+
+{ .mbb
+(p9)  cmp.ne          p8,p0 = r0,r0      // Clear p8 if x or y natval,nan,inf
+(p8)  br.cond.spnt    FDIM_OVERFLOW      // Branch if result overflows
+      br.ret.sptk     b0                 // Normal return
+}
+;;
+
+
+// Here if result will overflow
+FDIM_OVERFLOW:
+{ .mfi
+      alloc           r32=ar.pfs,2,2,4,0
+      fms.d.s0        f_tmp_result = f8,f1,f9 // Normalize result force overflow
+      nop.i           0
+}
+{ .mfb
+      mov             GR_Parameter_TAG = 196  // Error code
+      nop.f           0
+      br.cond.sptk    __libm_error_region     // Branch to error code
+}
+;;
+
+GLOBAL_LIBM_END(fdim)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+// Call error support to report possible range error
+.prologue
+
+{ .mfi
+        add   GR_Parameter_Y=-32,sp            // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+{ .mmi
+        stfd [GR_Parameter_Y] = f9,16          // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp             // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                      // Save b0
+};;
+
+.body
+{ .mib
+        stfd [GR_Parameter_X] = fNormX         // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+        nop.b 0
+}
+{ .mib
+        stfd [GR_Parameter_Y] = f_tmp_result   // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+
+{ .mmi
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
+};;
+
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_fdimf.S b/sysdeps/ia64/fpu/s_fdimf.S
new file mode 100644
index 0000000000..76d69d1cc9
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fdimf.S
@@ -0,0 +1,228 @@
+.file "fdimf.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 06/08/01 Initial version
+// 08/23/01 Corrected error tag number
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance; fixed parameters for call to error routine
+//
+// API
+//==============================================================
+// float fdimf( float x, float y );
+// input  floating point f8, f9
+// output floating point f8
+//
+//
+// Overview of operation
+//==============================================================
+// fdimf determines the positive difference between the arguments
+//   Result = x - y   if x > y
+//          = +0      if x <= y
+//
+// Error support is called if x-y overflows for x > y
+//
+
+// Registers used
+//==============================================================
+// General purpose registers: r14, r32 - r39
+
+rExpBig               = r14
+
+// r36-39 parameters for libm_error_support
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_SAVE_PFS           = r35
+
+GR_Parameter_X        = r36
+GR_Parameter_Y        = r37
+GR_Parameter_RESULT   = r38
+GR_Parameter_TAG      = r39
+
+// Floating-point registers: f8 - f12
+
+f_tmp_result          = f10
+fBig                  = f11
+fNormX                = f12
+
+// Predicate registers: p6 - p10
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(fdimf)
+
+{ .mfi
+      mov             rExpBig = 0x1007f  // Exponent to indicate overflow
+      fcmp.le.s1      p6,p7 = f8, f9     // Is x <= y?
+      nop.i           0
+}
+{ .mfi
+      nop.m           0
+      fnorm.s1        fNormX = f8        // Save x
+      nop.i           0
+}
+;;
+
+{ .mfi
+      setf.exp        fBig = rExpBig     // Constant to test for overflow
+      fcmp.eq.s0      p8,p0 = f8, f9     // Dummy op to set Denormal or Invalid
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+      fclass.m        p9,p10 = f8, 0x1e3 // Test for x natval, nan, inf
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p6)  fmerge.s        f8 = f0, f0        // Result is +0 if x <= y
+      nop.i           0
+}
+{ .mfi
+      nop.m           0
+(p7)  fms.s.s0        f8 = f8, f1, f9    // Result is x - y if x > y
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p10) fclass.m        p9,p10 = f9, 0x1e3 // Test for y natval, nan, inf
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p10) fcmp.ge.s1      p8,p0 = f8, fBig   // Test result for overflow
+      nop.i           0
+}
+;;
+
+{ .mbb
+(p9)  cmp.ne          p8,p0 = r0,r0      // Clear p8 if x or y natval,nan,inf
+(p8)  br.cond.spnt    FDIM_OVERFLOW      // Branch if result overflows
+      br.ret.sptk     b0                 // Normal return
+}
+;;
+
+
+// Here if result will overflow
+FDIM_OVERFLOW:
+{ .mfi
+      alloc           r32=ar.pfs,2,2,4,0
+      fms.s.s0        f_tmp_result = f8,f1,f9 // Normalize result force overflow
+      nop.i           0
+}
+{ .mfb
+      mov             GR_Parameter_TAG = 197  // Error code
+      nop.f           0
+      br.cond.sptk    __libm_error_region     // Branch to error code
+}
+;;
+
+GLOBAL_LIBM_END(fdimf)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+// Call error support to report possible range error
+.prologue
+
+{ .mfi
+        add   GR_Parameter_Y=-32,sp            // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+{ .mmi
+        stfs [GR_Parameter_Y] = f9,16          // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp             // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                      // Save b0
+};;
+
+.body
+{ .mib
+        stfs [GR_Parameter_X] = fNormX         // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+        nop.b 0
+}
+{ .mib
+        stfs [GR_Parameter_Y] = f_tmp_result   // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+
+{ .mmi
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
+};;
+
+{ .mmi
+        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_fdiml.S b/sysdeps/ia64/fpu/s_fdiml.S
new file mode 100644
index 0000000000..2227debdb3
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fdiml.S
@@ -0,0 +1,228 @@
+.file "fdiml.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 06/08/01 Initial version
+// 08/23/01 Corrected error tag number
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance; fixed parameters for call to error routine
+//
+// API
+//==============================================================
+// long double fdiml( long double x, long double y );
+// input  floating point f8, f9
+// output floating point f8
+//
+//
+// Overview of operation
+//==============================================================
+// fdiml determines the positive difference between the arguments
+//   Result = x - y   if x > y
+//          = +0      if x <= y
+//
+// Error support is called if x-y overflows for x > y
+//
+
+// Registers used
+//==============================================================
+// General purpose registers: r14, r32 - r39
+
+rExpBig               = r14
+
+// r36-39 parameters for libm_error_support
+GR_SAVE_B0            = r33
+GR_SAVE_GP            = r34
+GR_SAVE_PFS           = r35
+
+GR_Parameter_X        = r36
+GR_Parameter_Y        = r37
+GR_Parameter_RESULT   = r38
+GR_Parameter_TAG      = r39
+
+// Floating-point registers: f8 - f12
+
+f_tmp_result          = f10
+fBig                  = f11
+fNormX                = f12
+
+// Predicate registers: p6 - p10
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(fdiml)
+
+{ .mfi
+      mov             rExpBig = 0x13fff  // Exponent to indicate overflow
+      fcmp.le.s1      p6,p7 = f8, f9     // Is x <= y?
+      nop.i           0
+}
+{ .mfi
+      nop.m           0
+      fnorm.s1        fNormX = f8        // Save x
+      nop.i           0
+}
+;;
+
+{ .mfi
+      setf.exp        fBig = rExpBig     // Constant to test for overflow
+      fcmp.eq.s0      p8,p0 = f8, f9     // Dummy op to set Denormal or Invalid
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+      fclass.m        p9,p10 = f8, 0x1e3 // Test for x natval, nan, inf
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p6)  fmerge.s        f8 = f0, f0        // Result is +0 if x <= y
+      nop.i           0
+}
+{ .mfi
+      nop.m           0
+(p7)  fms.s0          f8 = f8, f1, f9    // Result is x - y if x > y
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p10) fclass.m        p9,p10 = f9, 0x1e3 // Test for y natval, nan, inf
+      nop.i           0
+}
+;;
+
+{ .mfi
+      nop.m           0
+(p10) fcmp.ge.s1      p8,p0 = f8, fBig   // Test result for overflow
+      nop.i           0
+}
+;;
+
+{ .mbb
+(p9)  cmp.ne          p8,p0 = r0,r0      // Clear p8 if x or y natval,nan,inf
+(p8)  br.cond.spnt    FDIM_OVERFLOW      // Branch if result overflows
+      br.ret.sptk     b0                 // Normal return
+}
+;;
+
+
+// Here if result will overflow
+FDIM_OVERFLOW:
+{ .mfi
+      alloc           r32=ar.pfs,2,2,4,0
+      fms.s0          f_tmp_result = f8,f1,f9 // Normalize result force overflow
+      nop.i           0
+}
+{ .mfb
+      mov             GR_Parameter_TAG = 195  // Error code
+      nop.f           0
+      br.cond.sptk    __libm_error_region     // Branch to error code
+}
+;;
+
+GLOBAL_LIBM_END(fdiml)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+// Call error support to report possible range error
+.prologue
+
+{ .mfi
+        add   GR_Parameter_Y=-32,sp            // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+{ .mmi
+        stfe [GR_Parameter_Y] = f9,16          // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp             // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                      // Save b0
+};;
+
+.body
+{ .mib
+        stfe [GR_Parameter_X] = fNormX         // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+        nop.b 0
+}
+{ .mib
+        stfe [GR_Parameter_Y] = f_tmp_result   // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+
+{ .mmi
+        add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
+};;
+
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_floor.S b/sysdeps/ia64/fpu/s_floor.S
index 438b0fa867..9ed9d6dcdb 100644
--- a/sysdeps/ia64/fpu/s_floor.S
+++ b/sysdeps/ia64/fpu/s_floor.S
@@ -1,10 +1,10 @@
 .file "floor.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,86 +20,68 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-.align 32
-.global floor#
-
-.section .text
-.proc  floor#
-.align 32
-
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 3/22/00: Updated to improve performance 
-// 6/13/00: Improved speed, fixed setting of inexact flag
-// 6/27/00: Eliminated incorrect invalid flag setting
-// 2/07/01: Corrected sign of zero result in round to -inf mode
+// 02/02/00 Initial version
+// 03/22/00 Updated to improve performance
+// 06/13/00 Improved speed, fixed setting of inexact flag
+// 06/27/00 Eliminated incorrect invalid flag setting
+// 02/07/01 Corrected sign of zero result in round to -inf mode
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance
+//==============================================================
 
 // API
 //==============================================================
 // double floor(double x)
+//==============================================================
 
-// general input registers:  
-
-floor_GR_FFFF      = r14
-floor_GR_signexp   = r15
-floor_GR_exponent  = r16
-floor_GR_expmask   = r17
-floor_GR_bigexp    = r18
-
-
-// predicate registers used: 
+// general input registers:
+// r14 - r18
 
-// p6  ==> Input is NaN, infinity, zero
-// p7  ==> Input is denormal
-// p8  ==> Input is <0
-// p9  ==> Input is >=0
-// p10 ==> Input is already an integer (bigger than largest integer)
-// p11 ==> Input is not a large integer
-// p12 ==> Input is a smaller integer
-// p13 ==> Input is not an even integer, so inexact must be set
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
 
+// floating-point registers:
+// f8 - f13
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
+fAdj       = f12
+fPreResult = f13
 
-FLOOR_NORM_f8      = f9                        
-FLOOR_FFFF         = f10 
-FLOOR_INEXACT      = f11 
-FLOOR_FLOAT_INT_f8 = f12
-FLOOR_INT_f8       = f13
-FLOOR_adj          = f14
+// predicate registers used:
+// p6 - p9
 
 // Overview of operation
 //==============================================================
-
 // double floor(double x)
-// Return an integer value (represented as a double) that is the largest 
+// Return an integer value (represented as a double) that is the largest
 // value not greater than x
 // This is x rounded toward -infinity to an integral value.
 // Inexact is set if x != floor(x)
-// **************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+//==============================================================
 
 // double_extended
 // if the exponent is > 1003e => 3F(true) = 63(decimal)
@@ -120,121 +102,115 @@ FLOOR_adj          = f14
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-#include "libm_support.h"
 
-floor:
-#ifdef _LIBC
-.global __floor
-__floor:
-#endif
+.section .text
+GLOBAL_IEEE754_ENTRY(floor)
 
 { .mfi
-      getf.exp floor_GR_signexp  = f8
-      fcvt.fx.trunc.s1     FLOOR_INT_f8  = f8
-      addl        floor_GR_bigexp = 0x10033, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10033, r0 // Set exponent at which is integer
 }
 { .mfi
-      addl        floor_GR_FFFF      = -1,r0
-      fcmp.lt.s1  p8,p9 = f8,f0
-      mov         floor_GR_expmask    = 0x1FFFF ;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.trunc.s1 fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// p7 ==> denorm
 { .mfi
-      setf.sig    FLOOR_FFFF  = floor_GR_FFFF
-      fclass.m    p7,p0 = f8, 0x0b
-      nop.i 999
+      nop.m            0
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test x < 0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-      fnorm.s1           FLOOR_NORM_f8  = f8
-      nop.i 999 ;;
+{ .mfb
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     FLOOR_UNORM           // Branch if x unorm
 }
+;;
 
-// p6 ==> NAN, INF, ZERO
-{ .mfb
-      nop.m 999
-      fclass.m      p6,p10 = f8, 0xe7
-(p7)  br.cond.spnt  L(FLOOR_DENORM) ;;
+FLOOR_COMMON:
+// Return here from FLOOR_UNORM
+{ .mfi
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e7     // Test x natval, nan, inf, 0
+      nop.i            0
 }
+;;
 
-L(FLOOR_COMMON):
 .pred.rel "mutex",p8,p9
-// Set adjustment to subtract from trunc(x) for result
-//   If x<0,  adjustment is -1.0
-//   If x>=0, adjustment is 0.0
 { .mfi
-      and      floor_GR_exponent = floor_GR_signexp, floor_GR_expmask
-(p8)  fnma.s1  FLOOR_adj = f1,f1,f0
-      nop.i 999
+      nop.m            0
+(p8)  fnma.s1          fAdj = f1, f1, f0     // If x < 0, adjustment is -1
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p9)  fadd.s1  FLOOR_adj = f0,f0
-      nop.i 999 ;;
+      nop.m            0
+(p9)  fma.s1           fAdj = f0, f0, f0     // If x > 0, adjustment is 0
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-      fcmp.eq.s0  p12,p0 = f8,f0 // Dummy op to set denormal and invalid flag
-      nop.i 999
+      nop.m            0
+      fcvt.xf          fPreResult = fXInt    // trunc(x)
+      nop.i            0
 }
-{ .mfi
-(p10) cmp.ge.unc    p10,p11 = floor_GR_exponent, floor_GR_bigexp
-(p6)  fnorm.d f8 = f8
-      nop.i 999 ;;
+{ .mfb
+      nop.m            0
+(p6)  fma.d.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf, 0
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf, 0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p11) fcvt.xf         FLOOR_FLOAT_INT_f8   = FLOOR_INT_f8
-      nop.i 999 ;;
+{ .mmi
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+;;
+      cmp.ge           p7,p6 = rExp, rBigexp  // Is |x| >= 2^52?
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p10) fnorm.d f8 = FLOOR_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fma.d.s0         f8 = fPreResult, f1, fAdj // Result if !int, |x| < 2^52
+      nop.i            0
 }
-
-
 { .mfi
-      nop.m 999
-(p11) fadd.d   f8 = FLOOR_FLOAT_INT_f8,FLOOR_adj
-      nop.i 999 ;;
+      nop.m            0
+(p7)  fma.d.s0         f8 = fNormX, f1, f0    // Result, if |x| >= 2^52
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p11) fcmp.eq.unc.s1  p12,p13  = FLOOR_FLOAT_INT_f8, FLOOR_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fcmp.eq.unc.s1   p8, p9 = fPreResult, fNormX // Is trunc(x) = x ?
+      nop.i            0
 }
+;;
 
-// Set inexact if result not equal to input
 { .mfi
-      nop.m 999
-(p13) fmpy.s0     FLOOR_INEXACT = FLOOR_FFFF,FLOOR_FFFF
-      nop.i 999
+      nop.m            0
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
 }
-// Set result to input if integer
 { .mfb
-      nop.m 999
-(p12) fnorm.d f8 = FLOOR_NORM_f8
-      br.ret.sptk    b0 ;;
+      nop.m            0
+(p8)  fma.d.s0         f8 = fNormX, f1, f0    // If x int, result normalized x
+      br.ret.sptk      b0                     // Exit main path, 0 < |x| < 2^52
 }
+;;
+
 
-// Here if input denorm
-L(FLOOR_DENORM):
+FLOOR_UNORM:
+// Here if x unorm
 { .mfb
-      getf.exp floor_GR_signexp  = FLOOR_NORM_f8
-      fcvt.fx.trunc.s1     FLOOR_INT_f8  = FLOOR_NORM_f8
-      br.cond.sptk  L(FLOOR_COMMON) ;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     FLOOR_COMMON           // Return to main path
 }
+;;
 
-.endp floor
-ASM_SIZE_DIRECTIVE(floor)
+GLOBAL_IEEE754_END(floor)
diff --git a/sysdeps/ia64/fpu/s_floorf.S b/sysdeps/ia64/fpu/s_floorf.S
index 15b2bbd31d..a3f2095931 100644
--- a/sysdeps/ia64/fpu/s_floorf.S
+++ b/sysdeps/ia64/fpu/s_floorf.S
@@ -1,10 +1,10 @@
 .file "floorf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,85 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-.align 32
-.global floorf#
-
-.section .text
-.proc  floorf#
-.align 32
-
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 6/13/00: Improved speed
-// 6/27/00: Eliminated incorrect invalid flag setting
-// 2/07/01: Corrected sign of zero result in round to -inf mode
+// 02/02/00 Initial version
+// 06/13/00 Improved speed
+// 06/27/00 Eliminated incorrect invalid flag setting
+// 02/07/01 Corrected sign of zero result in round to -inf mode
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance
+//==============================================================
 
 // API
 //==============================================================
 // float floorf(float x)
+//==============================================================
 
-// general input registers:  
-
-floor_GR_FFFF      = r14
-floor_GR_signexp   = r15
-floor_GR_exponent  = r16
-floor_GR_expmask   = r17
-floor_GR_bigexp    = r18
-
-
-// predicate registers used: 
+// general input registers:
+// r14 - r18
 
-// p6  ==> Input is NaN, infinity, zero
-// p7  ==> Input is denormal
-// p8  ==> Input is <0
-// p9  ==> Input is >=0
-// p10 ==> Input is already an integer (bigger than largest integer)
-// p11 ==> Input is not a large integer
-// p12 ==> Input is a smaller integer
-// p13 ==> Input is not an even integer, so inexact must be set
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
 
+// floating-point registers:
+// f8 - f13
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
+fAdj       = f12
+fPreResult = f13
 
-FLOOR_NORM_f8      = f9                        
-FLOOR_FFFF         = f10 
-FLOOR_INEXACT      = f11 
-FLOOR_FLOAT_INT_f8 = f12
-FLOOR_INT_f8       = f13
-FLOOR_adj          = f14
+// predicate registers used:
+// p6 - p9
 
 // Overview of operation
 //==============================================================
-
 // float floorf(float x)
-// Return an integer value (represented as a float) that is the largest 
+// Return an integer value (represented as a float) that is the largest
 // value not greater than x
 // This is x rounded toward -infinity to an integral value.
 // Inexact is set if x != floorf(x)
-// **************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+//==============================================================
 
 // double_extended
 // if the exponent is > 1003e => 3F(true) = 63(decimal)
@@ -119,119 +101,115 @@ FLOOR_adj          = f14
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-#include "libm_support.h"
 
-floorf:
-#ifdef _LIBC
-.global __floorf
-__floorf:
-#endif
+.section .text
+GLOBAL_IEEE754_ENTRY(floorf)
 
 { .mfi
-      getf.exp floor_GR_signexp  = f8
-      fcvt.fx.trunc.s1     FLOOR_INT_f8  = f8
-      addl        floor_GR_bigexp = 0x10016, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10016, r0 // Set exponent at which is integer
 }
 { .mfi
-      addl        floor_GR_FFFF      = -1,r0
-      fcmp.lt.s1  p8,p9 = f8,f0
-      mov         floor_GR_expmask    = 0x1FFFF ;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.trunc.s1 fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// p7 ==> denorm
 { .mfi
-      setf.sig    FLOOR_FFFF  = floor_GR_FFFF
-      fclass.m    p7,p0 = f8, 0x0b
-      nop.i 999
+      nop.m            0
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test x < 0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-      fnorm.s1           FLOOR_NORM_f8  = f8
-      nop.i 999 ;;
+{ .mfb
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     FLOOR_UNORM           // Branch if x unorm
 }
+;;
 
-// p6 ==> NAN, INF, ZERO
-{ .mfb
-      nop.m 999
-      fclass.m      p6,p10 = f8, 0xe7
-(p7)  br.cond.spnt  L(FLOOR_DENORM) ;;
+FLOOR_COMMON:
+// Return here from FLOOR_UNORM
+{ .mfi
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e7     // Test x natval, nan, inf, 0
+      nop.i            0
 }
+;;
 
-L(FLOOR_COMMON):
 .pred.rel "mutex",p8,p9
-// Set adjustment to subtract from trunc(x) for result
-//   If x<0,  adjustment is -1.0
-//   If x>=0, adjustment is 0.0
 { .mfi
-      and      floor_GR_exponent = floor_GR_signexp, floor_GR_expmask
-(p8)  fnma.s1  FLOOR_adj = f1,f1,f0
-      nop.i 999
+      nop.m            0
+(p8)  fnma.s1          fAdj = f1, f1, f0     // If x < 0, adjustment is -1
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p9)  fadd.s1  FLOOR_adj = f0,f0
-      nop.i 999 ;;
+      nop.m            0
+(p9)  fma.s1           fAdj = f0, f0, f0     // If x > 0, adjustment is 0
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-      fcmp.eq.s0  p12,p0 = f8,f0 // Dummy op to set denormal and invalid flag
-      nop.i 999
+      nop.m            0
+      fcvt.xf          fPreResult = fXInt    // trunc(x)
+      nop.i            0
 }
-{ .mfi
-(p10) cmp.ge.unc    p10,p11 = floor_GR_exponent, floor_GR_bigexp
-(p6)  fnorm.s f8 = f8
-      nop.i 999 ;;
+{ .mfb
+      nop.m            0
+(p6)  fma.s.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf, 0
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf, 0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p11) fcvt.xf         FLOOR_FLOAT_INT_f8   = FLOOR_INT_f8
-      nop.i 999 ;;
+{ .mmi
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+;;
+      cmp.ge           p7,p6 = rExp, rBigexp  // Is |x| >= 2^23?
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p10) fnorm.s f8 = FLOOR_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fma.s.s0         f8 = fPreResult, f1, fAdj // Result if !int, |x| < 2^23
+      nop.i            0
 }
-
 { .mfi
-      nop.m 999
-(p11) fadd.s   f8 = FLOOR_FLOAT_INT_f8,FLOOR_adj
-      nop.i 999 ;;
+      nop.m            0
+(p7)  fma.s.s0         f8 = fNormX, f1, f0    // Result, if |x| >= 2^23
+      nop.i            0
 }
+;;
+
 { .mfi
-      nop.m 999
-(p11) fcmp.eq.unc.s1  p12,p13  = FLOOR_FLOAT_INT_f8, FLOOR_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fcmp.eq.unc.s1   p8, p9 = fPreResult, fNormX // Is trunc(x) = x ?
+      nop.i            0
 }
+;;
 
-// Set inexact if result not equal to input
 { .mfi
-      nop.m 999
-(p13) fmpy.s0     FLOOR_INEXACT = FLOOR_FFFF,FLOOR_FFFF
-      nop.i 999
+      nop.m            0
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
 }
-// Set result to input if integer
 { .mfb
-      nop.m 999
-(p12) fnorm.s f8 = FLOOR_NORM_f8
-      br.ret.sptk    b0 ;;
+      nop.m            0
+(p8)  fma.s.s0         f8 = fNormX, f1, f0    // If x int, result normalized x
+      br.ret.sptk      b0                     // Exit main path, 0 < |x| < 2^23
 }
+;;
+
 
-// Here if input denorm
-L(FLOOR_DENORM):
+FLOOR_UNORM:
+// Here if x unorm
 { .mfb
-      getf.exp floor_GR_signexp  = FLOOR_NORM_f8
-      fcvt.fx.trunc.s1     FLOOR_INT_f8  = FLOOR_NORM_f8
-      br.cond.sptk  L(FLOOR_COMMON) ;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     FLOOR_COMMON           // Return to main path
 }
+;;
 
-.endp floorf
-ASM_SIZE_DIRECTIVE(floorf)
+GLOBAL_IEEE754_END(floorf)
diff --git a/sysdeps/ia64/fpu/s_floorl.S b/sysdeps/ia64/fpu/s_floorl.S
index 294578e1a7..345c4f30dd 100644
--- a/sysdeps/ia64/fpu/s_floorl.S
+++ b/sysdeps/ia64/fpu/s_floorl.S
@@ -1,10 +1,10 @@
 .file "floorl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,85 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-.align 32
-.global floorl#
-
-.section .text
-.proc  floorl#
-.align 32
-
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 6/13/00: Improved speed
-// 6/27/00: Eliminated incorrect invalid flag setting
-// 2/07/01: Corrected sign of zero result in round to -inf mode
+// 02/02/00 Initial version
+// 06/13/00 Improved speed
+// 06/27/00 Eliminated incorrect invalid flag setting
+// 02/07/01 Corrected sign of zero result in round to -inf mode
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/28/03 Improved performance
+//==============================================================
 
 // API
 //==============================================================
 // long double floorl(long double x)
+//==============================================================
 
-// general input registers:  
-
-floor_GR_FFFF      = r14
-floor_GR_signexp   = r15
-floor_GR_exponent  = r16
-floor_GR_expmask   = r17
-floor_GR_bigexp    = r18
-
-
-// predicate registers used: 
+// general input registers:
+// r14 - r18
 
-// p6  ==> Input is NaN, infinity, zero
-// p7  ==> Input is denormal
-// p8  ==> Input is <0
-// p9  ==> Input is >=0
-// p10 ==> Input is already an integer (bigger than largest integer)
-// p11 ==> Input is not a large integer
-// p12 ==> Input is a smaller integer
-// p13 ==> Input is not an even integer, so inexact must be set
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
 
+// floating-point registers:
+// f8 - f13
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
+fAdj       = f12
+fPreResult = f13
 
-FLOOR_NORM_f8      = f9                        
-FLOOR_FFFF         = f10 
-FLOOR_INEXACT      = f11 
-FLOOR_FLOAT_INT_f8 = f12
-FLOOR_INT_f8       = f13
-FLOOR_adj          = f14
+// predicate registers used:
+// p6 - p9
 
 // Overview of operation
 //==============================================================
-
 // long double floorl(long double x)
-// Return an integer value (represented as a long double) that is the largest 
+// Return an integer value (represented as a long double) that is the largest
 // value not greater than x
 // This is x rounded toward -infinity to an integral value.
 // Inexact is set if x != floorl(x)
-// **************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+//==============================================================
 
 // double_extended
 // if the exponent is > 1003e => 3F(true) = 63(decimal)
@@ -119,119 +101,115 @@ FLOOR_adj          = f14
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-#include "libm_support.h"
 
-floorl:
-#ifdef _LIBC
-.global __floorl
-__floorl:
-#endif
+.section .text
+GLOBAL_IEEE754_ENTRY(floorl)
 
 { .mfi
-      getf.exp floor_GR_signexp  = f8
-      fcvt.fx.trunc.s1     FLOOR_INT_f8  = f8
-      addl        floor_GR_bigexp = 0x1003e, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x1003e, r0 // Set exponent at which is integer
 }
 { .mfi
-      addl        floor_GR_FFFF      = -1,r0
-      fcmp.lt.s1  p8,p9 = f8,f0
-      mov         floor_GR_expmask    = 0x1FFFF ;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.trunc.s1 fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// p7 ==> denorm
 { .mfi
-      setf.sig    FLOOR_FFFF  = floor_GR_FFFF
-      fclass.m    p7,p0 = f8, 0x0b
-      nop.i 999
+      nop.m            0
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test x < 0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-      fnorm.s1           FLOOR_NORM_f8  = f8
-      nop.i 999 ;;
+{ .mfb
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     FLOOR_UNORM           // Branch if x unorm
 }
+;;
 
-// p6 ==> NAN, INF, ZERO
-{ .mfb
-      nop.m 999
-      fclass.m      p6,p10 = f8, 0xe7
-(p7)  br.cond.spnt  L(FLOOR_DENORM) ;;
+FLOOR_COMMON:
+// Return here from FLOOR_UNORM
+{ .mfi
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e7     // Test x natval, nan, inf, 0
+      nop.i            0
 }
+;;
 
-L(FLOOR_COMMON):
 .pred.rel "mutex",p8,p9
-// Set adjustment to subtract from trunc(x) for result
-//   If x<0,  adjustment is -1.0
-//   If x>=0, adjustment is 0.0
 { .mfi
-      and      floor_GR_exponent = floor_GR_signexp, floor_GR_expmask
-(p8)  fnma.s1  FLOOR_adj = f1,f1,f0
-      nop.i 999
+      nop.m            0
+(p8)  fnma.s1          fAdj = f1, f1, f0     // If x < 0, adjustment is -1
+      nop.i            0
 }
 { .mfi
-      nop.m 999
-(p9)  fadd.s1  FLOOR_adj = f0,f0
-      nop.i 999 ;;
+      nop.m            0
+(p9)  fma.s1           fAdj = f0, f0, f0     // If x > 0, adjustment is 0
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-      fcmp.eq.s0  p12,p0 = f8,f0 // Dummy op to set denormal and invalid flag
-      nop.i 999
+      nop.m            0
+      fcvt.xf          fPreResult = fXInt    // trunc(x)
+      nop.i            0
 }
-{ .mfi
-(p10) cmp.ge.unc    p10,p11 = floor_GR_exponent, floor_GR_bigexp
-(p6)  fnorm   f8 = f8
-      nop.i 999 ;;
+{ .mfb
+      nop.m            0
+(p6)  fma.s0           f8 = f8, f1, f0       // Result if x natval, nan, inf, 0
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf, 0
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p11) fcvt.xf         FLOOR_FLOAT_INT_f8   = FLOOR_INT_f8
-      nop.i 999 ;;
+{ .mmi
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+;;
+      cmp.ge           p7,p6 = rExp, rBigexp  // Is |x| >= 2^63?
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p10) fnorm   f8 = FLOOR_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fma.s0           f8 = fPreResult, f1, fAdj // Result if !int, |x| < 2^63
+      nop.i            0
 }
-
 { .mfi
-      nop.m 999
-(p11) fadd     f8 = FLOOR_FLOAT_INT_f8,FLOOR_adj
-      nop.i 999 ;;
+      nop.m            0
+(p7)  fma.s0           f8 = fNormX, f1, f0    // Result, if |x| >= 2^63
+      nop.i            0
 }
+;;
+
 { .mfi
-      nop.m 999
-(p11) fcmp.eq.unc.s1  p12,p13  = FLOOR_FLOAT_INT_f8, FLOOR_NORM_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fcmp.eq.unc.s1   p8, p9 = fPreResult, fNormX // Is trunc(x) = x ?
+      nop.i            0
 }
+;;
 
-// Set inexact if result not equal to input
 { .mfi
-      nop.m 999
-(p13) fmpy.s0     FLOOR_INEXACT = FLOOR_FFFF,FLOOR_FFFF
-      nop.i 999
+      nop.m            0
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
 }
-// Set result to input if integer
 { .mfb
-      nop.m 999
-(p12) fnorm   f8 = FLOOR_NORM_f8
-      br.ret.sptk    b0 ;;
+      nop.m            0
+(p8)  fma.s0           f8 = fNormX, f1, f0    // If x int, result normalized x
+      br.ret.sptk      b0                     // Exit main path, 0 < |x| < 2^63
 }
+;;
+
 
-// Here if input denorm
-L(FLOOR_DENORM):
+FLOOR_UNORM:
+// Here if x unorm
 { .mfb
-      getf.exp floor_GR_signexp  = FLOOR_NORM_f8
-      fcvt.fx.trunc.s1     FLOOR_INT_f8  = FLOOR_NORM_f8
-      br.cond.sptk  L(FLOOR_COMMON) ;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     FLOOR_COMMON           // Return to main path
 }
+;;
 
-.endp floorl
-ASM_SIZE_DIRECTIVE(floorl)
+GLOBAL_IEEE754_END(floorl)
diff --git a/sysdeps/ia64/fpu/s_fma.S b/sysdeps/ia64/fpu/s_fma.S
new file mode 100644
index 0000000000..7798790d50
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fma.S
@@ -0,0 +1,71 @@
+.file "fma.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 06/07/01 Initial version 
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// double fma  (double x, double y, double z)
+//
+// Overview of operation
+//==============================================================
+// returns x * y + z with one rounding error
+
+// All the special cases are handled by the fma instruction itself
+
+// floating-point registers used: 3
+// f8,  input x, output
+// f9,  input y
+// f10, input z
+
+.section .text
+GLOBAL_LIBM_ENTRY(fma)
+
+{ .mfb
+      nop.m 999
+      fma.d.s0  f8 = f8, f9, f10  // Result = x * y + z
+      br.ret.sptk    b0           
+}
+;;
+
+GLOBAL_LIBM_END(fma)
diff --git a/sysdeps/ia64/fpu/s_fmaf.S b/sysdeps/ia64/fpu/s_fmaf.S
new file mode 100644
index 0000000000..db112b2a6c
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fmaf.S
@@ -0,0 +1,71 @@
+.file "fmaf.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 06/07/01 Initial version 
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// float fmaf  (float x, float y, float z)
+//
+// Overview of operation
+//==============================================================
+// returns x * y + z with one rounding error
+
+// All the special cases are handled by the fma instruction itself
+
+// floating-point registers used: 3
+// f8,  input x, output
+// f9,  input y
+// f10, input z
+
+.section .text
+GLOBAL_LIBM_ENTRY(fmaf)
+
+{ .mfb
+      nop.m 999
+      fma.s.s0  f8 = f8, f9, f10  // Result = x * y + z
+      br.ret.sptk    b0           
+}
+;;
+
+GLOBAL_LIBM_END(fmaf)
diff --git a/sysdeps/ia64/fpu/s_fmal.S b/sysdeps/ia64/fpu/s_fmal.S
new file mode 100644
index 0000000000..2bdef0b3ed
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fmal.S
@@ -0,0 +1,71 @@
+.file "fmal.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 06/07/01 Initial version 
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// long double fmal  (long double x, long double y, long double z)
+//
+// Overview of operation
+//==============================================================
+// returns x * y + z with one rounding error
+
+// All the special cases are handled by the fma instruction itself
+
+// floating-point registers used: 3
+// f8,  input x, output
+// f9,  input y
+// f10, input z
+
+.section .text
+GLOBAL_LIBM_ENTRY(fmal)
+
+{ .mfb
+      nop.m 999
+      fma.s0  f8 = f8, f9, f10  // Result = x * y + z
+      br.ret.sptk    b0           
+}
+;;
+
+GLOBAL_LIBM_END(fmal)
diff --git a/sysdeps/ia64/fpu/s_fmax.S b/sysdeps/ia64/fpu/s_fmax.S
new file mode 100644
index 0000000000..6fd38dfe9d
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fmax.S
@@ -0,0 +1,114 @@
+.file "fmax.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 05/31/01 Initial version 
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// double fmax  (double x, double y)
+//
+// Overview of operation
+//==============================================================
+// returns the algebraic maximum of 2 input values
+// 
+// Special cases:
+//    fmax(x, nan) returns x if x is numeric  // Must special case this one
+//    fmax(nan, y) returns y if y is numeric
+//    fmax(nan1, nan2) returns quietized nan2
+//    fmax(+0,+0) returns +0
+//    fmax(-0,+0) returns +0
+//    fmax(-0,-0) returns -0
+//    fmax(+0,-0) returns +0                  // Must special case this one
+//  
+// SNaN causes invalid to be set
+
+// floating-point registers used: 2
+// f8,  input x, output
+// f9,  input y
+
+.section .text
+GLOBAL_LIBM_ENTRY(fmax)
+
+{ .mfi
+      nop.m 999
+      fcmp.unord.s0 p6,p7 = f8, f9 // Is x or y a nan? Raise invalid or denormal
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p7)  fclass.m.unc  p8,p9 = f9, 0x06 // If no nan, is y=-0?
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p6)  fclass.m.unc  p10,p0 = f8, 0xc3 // Is x nan?
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fmax.s0  f8 = f8, f9    // Normal case, no nan and y not -0
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fmax.s0  f8 = f9, f8    // No nan and y -0
+      nop.i 999
+}
+;;
+
+{ .mfb
+      nop.m 999
+(p10) fmerge.s  f8 = f9, f9   // If x nan, return y, else do nothing (returns x)
+      br.ret.sptk    b0           
+}
+;;
+
+GLOBAL_LIBM_END(fmax)
diff --git a/sysdeps/ia64/fpu/s_fmaxf.S b/sysdeps/ia64/fpu/s_fmaxf.S
new file mode 100644
index 0000000000..cac283c66a
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fmaxf.S
@@ -0,0 +1,114 @@
+.file "fmaxf.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 05/31/01 Initial version 
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// float fmaxf  (float x, float y)
+//
+// Overview of operation
+//==============================================================
+// returns the algebraic maximum of 2 input values
+// 
+// Special cases:
+//    fmaxf(x, nan) returns x if x is numeric  // Must special case this one
+//    fmaxf(nan, y) returns y if y is numeric
+//    fmaxf(nan1, nan2) returns quietized nan2
+//    fmaxf(+0,+0) returns +0
+//    fmaxf(-0,+0) returns +0
+//    fmaxf(-0,-0) returns -0
+//    fmaxf(+0,-0) returns +0                  // Must special case this one
+//  
+// SNaN causes invalid to be set
+
+// floating-point registers used: 2
+// f8,  input x, output
+// f9,  input y
+
+.section .text
+GLOBAL_LIBM_ENTRY(fmaxf)
+
+{ .mfi
+      nop.m 999
+      fcmp.unord.s0 p6,p7 = f8, f9 // Is x or y a nan? Raise invalid or denormal
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p7)  fclass.m.unc  p8,p9 = f9, 0x06 // If no nan, is y=-0?
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p6)  fclass.m.unc  p10,p0 = f8, 0xc3 // Is x nan?
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fmax.s0  f8 = f8, f9    // Normal case, no nan and y not -0
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fmax.s0  f8 = f9, f8    // No nan and y -0
+      nop.i 999
+}
+;;
+
+{ .mfb
+      nop.m 999
+(p10) fmerge.s  f8 = f9, f9   // If x nan, return y, else do nothing (returns x)
+      br.ret.sptk    b0           
+}
+;;
+
+GLOBAL_LIBM_END(fmaxf)
diff --git a/sysdeps/ia64/fpu/s_fmaxl.S b/sysdeps/ia64/fpu/s_fmaxl.S
new file mode 100644
index 0000000000..fb8861dcdf
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_fmaxl.S
@@ -0,0 +1,114 @@
+.file "fmaxl.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 05/31/01 Initial version 
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// long double fmaxl  (long double x, long double y)
+//
+// Overview of operation
+//==============================================================
+// returns the algebraic maximum of 2 input values
+// 
+// Special cases:
+//    fmaxl(x, nan) returns x if x is numeric  // Must special case this one
+//    fmaxl(nan, y) returns y if y is numeric
+//    fmaxl(nan1, nan2) returns quietized nan2
+//    fmaxl(+0,+0) returns +0
+//    fmaxl(-0,+0) returns +0
+//    fmaxl(-0,-0) returns -0
+//    fmaxl(+0,-0) returns +0                  // Must special case this one
+//  
+// SNaN causes invalid to be set
+
+// floating-point registers used: 2
+// f8,  input x, output
+// f9,  input y
+
+.section .text
+GLOBAL_LIBM_ENTRY(fmaxl)
+
+{ .mfi
+      nop.m 999
+      fcmp.unord.s0 p6,p7 = f8, f9 // Is x or y a nan? Raise invalid or denormal
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p7)  fclass.m.unc  p8,p9 = f9, 0x06 // If no nan, is y=-0?
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p6)  fclass.m.unc  p10,p0 = f8, 0xc3 // Is x nan?
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p9)  fmax.s0  f8 = f8, f9    // Normal case, no nan and y not -0
+      nop.i 999
+}
+;;
+
+{ .mfi
+      nop.m 999
+(p8)  fmax.s0  f8 = f9, f8    // No nan and y -0
+      nop.i 999
+}
+;;
+
+{ .mfb
+      nop.m 999
+(p10) fmerge.s  f8 = f9, f9   // If x nan, return y, else do nothing (returns x)
+      br.ret.sptk    b0           
+}
+;;
+
+GLOBAL_LIBM_END(fmaxl)
diff --git a/sysdeps/ia64/fpu/s_frexp.c b/sysdeps/ia64/fpu/s_frexp.c
index 98349bca47..7d90213d63 100644
--- a/sysdeps/ia64/fpu/s_frexp.c
+++ b/sysdeps/ia64/fpu/s_frexp.c
@@ -1,9 +1,10 @@
-//
-// Copyright (C) 2000, 2001, Intel Corporation
+/* file: frexp.c */
+
+
+// Copyright (c) 2000-2002, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -19,14 +20,15 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
+
 //
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
@@ -34,22 +36,30 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
 //
+// History
+//=====================================================================
+//  2/02/00  Initial version
+//  1/23/02  Calls kernel with parameter to specify 32- or 64-bit int
 //
+//=====================================================================
 
 #include "libm_support.h"
 
+double __libm_frexp(double, int*, int);
+
 double frexp(double x, int *y)
 {
 
-#ifdef SIZE_INT_64
-   return( __libm_frexp_8(x, y) );
+#ifdef SIZE_INT_64 
+   return( __libm_frexp(x, y, 1) );
 
 #else
 
-#ifdef SIZE_INT_32
-   return( _GI___libm_frexp_4(x, y) );
+#ifdef SIZE_INT_32 
+   return( __libm_frexp(x, y, 0) );
 #endif
 
 #endif
diff --git a/sysdeps/ia64/fpu/s_frexpf.c b/sysdeps/ia64/fpu/s_frexpf.c
index f666304147..920f09d4a4 100644
--- a/sysdeps/ia64/fpu/s_frexpf.c
+++ b/sysdeps/ia64/fpu/s_frexpf.c
@@ -1,9 +1,10 @@
-//
-// Copyright (C) 2000, 2001, Intel Corporation
+/* file: frexpf.c */
+
+
+// Copyright (c) 2000-2002, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -19,14 +20,15 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
+
 //
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
@@ -34,22 +36,30 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
 //
+// History
+//=====================================================================
+//  2/02/00  Initial version
+//  1/23/02  Calls kernel with parameter to specify 32- or 64-bit int
 //
+//=====================================================================
 
 #include "libm_support.h"
 
+float __libm_frexpf(float, int*, int);
+
 float frexpf(float x, int *y)
 {
 
-#ifdef SIZE_INT_64
-   return( __libm_frexp_8f(x, y) );
+#ifdef SIZE_INT_64 
+   return( __libm_frexpf(x, y, 1) );
 
 #else
 
-#ifdef SIZE_INT_32
-   return( _GI___libm_frexp_4f(x, y) );
+#ifdef SIZE_INT_32 
+   return( __libm_frexpf(x, y, 0) );
 #endif
 
 #endif
diff --git a/sysdeps/ia64/fpu/s_frexpl.c b/sysdeps/ia64/fpu/s_frexpl.c
index 3edc971e3f..968cc3269c 100644
--- a/sysdeps/ia64/fpu/s_frexpl.c
+++ b/sysdeps/ia64/fpu/s_frexpl.c
@@ -1,9 +1,10 @@
-//
-// Copyright (C) 2000, 2001, Intel Corporation
+/* file: frexpl.c */
+
+
+// Copyright (c) 2000-2002, Intel Corporation
 // All rights reserved.
 //
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -19,14 +20,15 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
+
 //
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
@@ -34,22 +36,30 @@
 //
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
 //
+// History
+//=====================================================================
+//  2/02/00  Initial version
+//  1/23/02  Calls kernel with parameter to specify 32- or 64-bit int
 //
+//=====================================================================
 
 #include "libm_support.h"
 
+long double __libm_frexpl(long double, int*, int);
+
 long double frexpl(long double x, int *y)
 {
 
-#ifdef SIZE_INT_64
-   return( __libm_frexp_8l(x, y) );
+#ifdef SIZE_INT_64 
+   return( __libm_frexpl(x, y, 1) );
 
 #else
 
-#ifdef SIZE_INT_32
-   return( _GI___libm_frexp_4l(x, y) );
+#ifdef SIZE_INT_32 
+   return( __libm_frexpl(x, y, 0) );
 #endif
 
 #endif
diff --git a/sysdeps/ia64/fpu/s_ilogb.S b/sysdeps/ia64/fpu/s_ilogb.S
index 61975dd941..0102370cd6 100644
--- a/sysdeps/ia64/fpu/s_ilogb.S
+++ b/sysdeps/ia64/fpu/s_ilogb.S
@@ -1,10 +1,10 @@
 .file "ilogb.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,234 +20,249 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/03/00  Initial version
-// 5/26/00  Fix bug when x a double-extended denormal; 
+// 02/03/00 Initial version
+// 05/26/00 Fix bug when x a double-extended denormal;
 //          if x=0 call error routine, per C9X
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 1/20/01  Fixed result for x=0, corrected error tag value.
-
-.align 32
-.global ilogb#
-
-.section .text
-.proc  ilogb#
-.align 32
-
+// 01/20/01 Fixed result for x=0, corrected error tag value.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
+//
 // API
 //==============================================================
-// int = ilogb(double)
-
+// int ilogb( double x );
+//
 // Overview of operation
 //==============================================================
-// ilogb computes log2(x) as an int
+// The ilogb function extracts the exponent of x as an integer
 // and returns it in r8
-
-// ilogb is similar to logb but differs in the  following ways:
+//
+// ilogb is similar to logb but differs in the following ways:
 //         +-inf
 //            ilogb: returns INT_MAX
 //             logb: returns +inf
-//         Nan  returns FP_ILOGBNAN (which is either INT_MAX or INT_MIN)
+//         Nan  returns FP_LOGBNAN (which is either INT_MAX or INT_MIN)
 //            ilogb: returns INT_MAX (7fffffff)
-//             logb: returns QNAN (quieted SNAN)
+//             logb: returns QNAN (quietized SNAN)
 //         0    returns FP_ILOGB0 (which is either INT_MIN or -INT_MAX)
-//            ilogb: returns INT_MIN (80000000)
-//             logb: returns -inf
-
+//            ilogb: returns -INT_MAX (80000001)
+//             logb: returns -inf, raises the divide-by-zero exception,
+//                   and calls libm_error_support to set domain error
+//
 // Registers used
 //==============================================================
+// general registers used:
+// r26 -> r39
+// r36 -> r39 used as parameters to error path
+//
+// predicate registers used:
+// p6 -> p10
+// floating-point registers used:
+// f9, f10, f11
+// f8, input
 
-// general local registers: 
-// ar.pfs r32
-// r33 -> r37
-// r38 -> r41 used as parameters to error path
-
-// predicate registers used: 
-// p6 - x nan, inf
-// p7 - x 0
-// p8 - x norm, unorm
-// p9 - x unorm
-
-// floating-point registers used: 
-// f8 - f10
-
-#include "libm_support.h"
+rExpBias            = r26
+rExpMask            = r27
+rSignexp_x          = r28
+rExp_x              = r29
+rIntMax             = r30
+rExp_2to64          = r31
 
 GR_SAVE_PFS         = r32
+rTrialResult        = r33
 GR_SAVE_B0          = r34
 GR_SAVE_GP          = r35
-GR_Parameter_X      = r38
-GR_Parameter_Y      = r39
-GR_Parameter_RESULT = r40
-GR_Parameter_TAG    = r41
 
-FR_X                = f8
-FR_Y                = f0
-FR_RESULT           = f0
+GR_Parameter_X      = r36
+GR_Parameter_Y      = r37
+GR_Parameter_RESULT = r38
+GR_Parameter_TAG    = r39
 
+fTmp                = f9
+fNorm_x             = f10
+f2to64              = f11
 
-ilogb: 
+.section .text
+GLOBAL_LIBM_ENTRY(ilogb)
 
-// Form signexp of 2^64 in case need to scale denormal
-{ .mmf
-      alloc          r32=ar.pfs,1,5,4,0
-(p0)  mov      r37 = 0x1003f
-(p0)  fnorm    f9 = f8 ;;
+// X NORMAL
+// TrueExp_x = exp(f8) - 0xffff
+// r8 = TrueExp_x
+{ .mfi
+      getf.exp        rSignexp_x = f8
+      fclass.m        p8,p0 = f8, 0x0b   // Test for x unorm
+      mov             rExpBias = 0xffff  // Exponent bias
 }
-
-// Form 2^64 in case need to scale denormal
 { .mfi
-(p0)  setf.exp f10 = r37
-(p0)  fclass.m.unc p7, p8 = f8, 0xe3        
-(p0)  mov      r34 = 0xffff ;;
+      nop.m           0
+      fnorm.s1        fNorm_x = f8
+      mov             rExpMask = 0x1ffff // Exponent mask
 }
+;;
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-// X ZERO, returns INT_MIN
-// X INF or NAN, returns INT_MAX
+// Form signexp of 2^64 in case need to scale denormal
+{ .mfb
+      mov             rExp_2to64 = 0x1003f
+      fclass.m        p6,p9 = f8, 0x1e3  // Test x natval, nan, inf
+(p8)  br.cond.spnt    ILOGB_DENORM       // Branch if x unorm
+}
+;;
 
+ILOGB_COMMON:
+// Return here from ILOGB_DENORM
 { .mfi
-(p0)  mov      r35 = 0x1ffff
-(p8)    fclass.m.unc p6, p8 = f8, 0x07
-	nop.i 999 ;;
+      and             rExp_x = rSignexp_x, rExpMask // Get biased exponent
+      fclass.m        p7,p10 = f8, 0x07   // Test x zero
+      nop.i           0
 }
 { .mlx
-	nop.m 999
-(p7)    movl r8 = 0x000000007fffffff ;;       
+      nop.m           0
+      movl            rIntMax = 0x000000007fffffff // Form INT_MAX
 }
+;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-(p6)    br.cond.spnt  L(ILOGB_ZERO) ;;
+.pred.rel "mutex",p6,p9
+{ .mfi
+(p9)  sub             r8 = rExp_x, rExpBias // Get true exponent for normal path
+(p6)  fma.s0          fTmp = f8, f8, f0     // Dummy to set Invalid flag
+(p6)  mov             r8 = rIntMax          // If nan, inf, return INT_MAX
 }
+{ .mbb
+      nop.m           0
+(p7)  br.cond.spnt    ILOGB_ZERO            // Branch if x zero
+(p10) br.ret.sptk     b0                    // Exit if x not zero
+}
+;;
+
 
-// Test for denormal
+ILOGB_DENORM:
+// Form 2^64 in case need to scale denormal
+// Check to see if double-extended denormal
 { .mfi
-	nop.m 999
-(p8)    fclass.m.unc p9, p0 = f9, 0x0b        
-	nop.i 999 ;;
+      setf.exp        f2to64 = rExp_2to64
+      fclass.m        p8,p0 = fNorm_x, 0x0b
+      nop.i           0
 }
+;;
 
-L(ILOGB_COMMON):
-// X NORMAL returns true exponent
-{ .mmi
-	nop.m 999 
-(p8)    getf.exp r33 = f9
-	nop.i 999 ;;
+{ .mfi
+      nop.m           0
+      fcmp.eq.s0      p7,p0 = f8, f0           // Dummy op to set denormal flag
+      nop.i           0
 }
+;;
 
-// If denormal add 64 to exponent bias for scaling
-{ .mfb
-(p9)    add     r34 = 64, r34   
-	nop.f 999 
-(p9)    br.cond.spnt  L(ILOGB_DENORM) ;;
+// If double-extended denormal add 64 to exponent bias for scaling
+// If double-extended denormal form x * 2^64 which is normal
+{ .mfi
+(p8)  add             rExpBias = 64, rExpBias
+(p8)  fmpy.s1         fNorm_x = fNorm_x, f2to64
+      nop.i           0
 }
+;;
 
-{ .mmi
-(p8)    and      r36 = r35, r33
-	nop.m 999
-	nop.i 999 ;;
+// Logic is the same as normal path but use normalized input
+{ .mib
+      getf.exp        rSignexp_x = fNorm_x
+      nop.i           0
+      br.cond.sptk    ILOGB_COMMON             // Return to main path
 }
+;;
 
+ILOGB_ZERO:
+// Here if x zero
+// Return INT_MIN, call error support
+
+{ .mlx
+      alloc           r32=ar.pfs,1,3,4,0
+      movl            rTrialResult = 0x0000000080000000
+}
 { .mib
-(p8)    sub r8 = r36, r34                  
-	nop.i 999
-(p0)    br.ret.sptk    b0 ;;                     
+      mov             GR_Parameter_TAG = 157  // Error code
+      nop.i           0
+      br.cond.sptk    __libm_error_region     // Call error support
 }
+;;
 
-L(ILOGB_DENORM):
-// Here if x denormal
-// Form x * 2^64 which is normal
-// Return to common code
-{ .mfb
-        cmp.eq p8,p9 = r0,r0
-        fmpy f9 = f9, f10
-        br.cond.sptk  L(ILOGB_COMMON) ;;
-}
+GLOBAL_LIBM_END(ilogb)
 
-// X ZERO
-// return INT_MIN, call error support
-L(ILOGB_ZERO): 
-{.mlx
-      mov            GR_Parameter_TAG = 157
-(p6)  movl r33 = 0x0000000080000000 ;;
-};;
-.endp ilogb
-ASM_SIZE_DIRECTIVE(ilogb)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
+
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp           // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs               // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
+        add sp=-64,sp                         // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+        mov GR_SAVE_GP=gp                     // Save gp
 };;
+
 { .mmi
-        stfd [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+        stfd [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X    = 16,sp         // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+        mov GR_SAVE_B0=b0                     // Save b0
 };;
+
 .body
 { .mib
-        stfd [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfd [GR_Parameter_X] = f8            // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        stfd [GR_Parameter_Y] = f9            // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#  // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
+
 { .mmi
-        mov   r8 = r33                         // Store result
+        mov   r8 = rTrialResult
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
+
 { .mib
         mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        br.ret.sptk   b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_ilogbf.S b/sysdeps/ia64/fpu/s_ilogbf.S
index ffa6d3b672..9e971bc634 100644
--- a/sysdeps/ia64/fpu/s_ilogbf.S
+++ b/sysdeps/ia64/fpu/s_ilogbf.S
@@ -1,10 +1,10 @@
 .file "ilogbf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,234 +20,249 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/03/00  Initial version
-// 5/26/00  Fix bug when x a double-extended denormal; 
+// 02/03/00 Initial version
+// 05/26/00 Fix bug when x a double-extended denormal;
 //          if x=0 call error routine, per C9X
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 1/20/01  Fixed result for x=0
-
-.align 32
-.global ilogbf#
-
-.section .text
-.proc  ilogbf#
-.align 32
-
+// 01/20/01 Fixed result for x=0
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
+//
 // API
 //==============================================================
-// int = ilogbf(float)
-
+// int ilogbf( float x );
+//
 // Overview of operation
 //==============================================================
-// ilogbf computes log2(x) as an int
+// The ilogbf function extracts the exponent of x as an integer
 // and returns it in r8
-
-// ilogbf is similar to logbf but differs in the  following ways:
+//
+// ilogbf is similar to logbf but differs in the following ways:
 //         +-inf
 //            ilogbf: returns INT_MAX
 //             logbf: returns +inf
-//         Nan  returns FP_ILOGBNAN (which is either INT_MAX or INT_MIN)
+//         Nan  returns FP_LOGBNAN (which is either INT_MAX or INT_MIN)
 //            ilogbf: returns INT_MAX (7fffffff)
-//             logbf: returns QNAN (quieted SNAN)
+//             logbf: returns QNAN (quietized SNAN)
 //         0    returns FP_ILOGB0 (which is either INT_MIN or -INT_MAX)
-//            ilogbf: returns INT_MIN (80000000)
-//             logbf: returns -inf
-
+//            ilogbf: returns -INT_MAX (80000001)
+//             logbf: returns -inf, raises the divide-by-zero exception,
+//                   and calls libm_error_support to set domain error
+//
 // Registers used
 //==============================================================
+// general registers used:
+// r26 -> r39
+// r36 -> r39 used as parameters to error path
+//
+// predicate registers used:
+// p6 -> p10
+// floating-point registers used:
+// f9, f10, f11
+// f8, input
 
-// general local registers: 
-// ar.pfs r32
-// r33 -> r37 
-// r38 -> r41 used as parameters to error path
-
-// predicate registers used: 
-// p6 - x nan, inf
-// p7 - x 0
-// p8 - x norm, unorm
-// p9 - x unorm
-
-// floating-point registers used: 
-// f8 - f10
-
-#include "libm_support.h"
+rExpBias            = r26
+rExpMask            = r27
+rSignexp_x          = r28
+rExp_x              = r29
+rIntMax             = r30
+rExp_2to64          = r31
 
 GR_SAVE_PFS         = r32
+rTrialResult        = r33
 GR_SAVE_B0          = r34
 GR_SAVE_GP          = r35
-GR_Parameter_X      = r38
-GR_Parameter_Y      = r39
-GR_Parameter_RESULT = r40
-GR_Parameter_TAG    = r41
 
-FR_X                = f8
-FR_Y                = f0
-FR_RESULT           = f0
+GR_Parameter_X      = r36
+GR_Parameter_Y      = r37
+GR_Parameter_RESULT = r38
+GR_Parameter_TAG    = r39
 
+fTmp                = f9
+fNorm_x             = f10
+f2to64              = f11
 
-ilogbf: 
+.section .text
+GLOBAL_LIBM_ENTRY(ilogbf)
 
-// Form signexp of 2^64 in case need to scale denormal
-{ .mmf
-      alloc          r32=ar.pfs,1,5,4,0
-(p0)  mov      r37 = 0x1003f
-(p0)  fnorm    f9 = f8 ;;
+// X NORMAL
+// TrueExp_x = exp(f8) - 0xffff
+// r8 = TrueExp_x
+{ .mfi
+      getf.exp        rSignexp_x = f8
+      fclass.m        p8,p0 = f8, 0x0b   // Test for x unorm
+      mov             rExpBias = 0xffff  // Exponent bias
 }
-
-// Form 2^64 in case need to scale denormal
 { .mfi
-(p0)  setf.exp f10 = r37
-(p0)  fclass.m.unc p7, p8 = f8, 0xe3        
-(p0)  mov      r34 = 0xffff ;;
+      nop.m           0
+      fnorm.s1        fNorm_x = f8
+      mov             rExpMask = 0x1ffff // Exponent mask
 }
+;;
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-// X ZERO, returns INT_MIN
-// X INF or NAN, returns INT_MAX
+// Form signexp of 2^64 in case need to scale denormal
+{ .mfb
+      mov             rExp_2to64 = 0x1003f
+      fclass.m        p6,p9 = f8, 0x1e3  // Test x natval, nan, inf
+(p8)  br.cond.spnt    ILOGB_DENORM       // Branch if x unorm
+}
+;;
 
+ILOGB_COMMON:
+// Return here from ILOGB_DENORM
 { .mfi
-(p0)  mov      r35 = 0x1ffff
-(p8)    fclass.m.unc p6, p8 = f8, 0x07
-	nop.i 999 ;;
+      and             rExp_x = rSignexp_x, rExpMask // Get biased exponent
+      fclass.m        p7,p10 = f8, 0x07   // Test x zero
+      nop.i           0
 }
 { .mlx
-	nop.m 999
-(p7)    movl r8 = 0x000000007fffffff ;;       
+      nop.m           0
+      movl            rIntMax = 0x000000007fffffff // Form INT_MAX
 }
+;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-(p6)    br.cond.spnt  L(ILOGB_ZERO) ;;
+.pred.rel "mutex",p6,p9
+{ .mfi
+(p9)  sub             r8 = rExp_x, rExpBias // Get true exponent for normal path
+(p6)  fma.s0          fTmp = f8, f8, f0     // Dummy to set Invalid flag
+(p6)  mov             r8 = rIntMax          // If nan, inf, return INT_MAX
 }
+{ .mbb
+      nop.m           0
+(p7)  br.cond.spnt    ILOGB_ZERO            // Branch if x zero
+(p10) br.ret.sptk     b0                    // Exit if x not zero
+}
+;;
+
 
-// Test for denormal
+ILOGB_DENORM:
+// Form 2^64 in case need to scale denormal
+// Check to see if double-extended denormal
 { .mfi
-	nop.m 999
-(p8)    fclass.m.unc p9, p0 = f9, 0x0b        
-	nop.i 999 ;;
+      setf.exp        f2to64 = rExp_2to64
+      fclass.m        p8,p0 = fNorm_x, 0x0b
+      nop.i           0
 }
+;;
 
-L(ILOGB_COMMON):
-// X NORMAL returns true exponent
-{ .mmi
-	nop.m 999 
-(p8)    getf.exp r33 = f9
-	nop.i 999 ;;
+{ .mfi
+      nop.m           0
+      fcmp.eq.s0      p7,p0 = f8, f0           // Dummy op to set denormal flag
+      nop.i           0
 }
+;;
 
-// If denormal add 64 to exponent bias for scaling
-{ .mfb
-(p9)    add     r34 = 64, r34   
-	nop.f 999 
-(p9)    br.cond.spnt  L(ILOGB_DENORM) ;;
+// If double-extended denormal add 64 to exponent bias for scaling
+// If double-extended denormal form x * 2^64 which is normal
+{ .mfi
+(p8)  add             rExpBias = 64, rExpBias
+(p8)  fmpy.s1         fNorm_x = fNorm_x, f2to64
+      nop.i           0
 }
+;;
 
-{ .mmi
-(p8)    and      r36 = r35, r33
-	nop.m 999
-	nop.i 999 ;;
+// Logic is the same as normal path but use normalized input
+{ .mib
+      getf.exp        rSignexp_x = fNorm_x
+      nop.i           0
+      br.cond.sptk    ILOGB_COMMON             // Return to main path
 }
+;;
 
+ILOGB_ZERO:
+// Here if x zero
+// Return INT_MIN, call error support
+
+{ .mlx
+      alloc           r32=ar.pfs,1,3,4,0
+      movl            rTrialResult = 0x0000000080000000
+}
 { .mib
-(p8)    sub r8 = r36, r34                  
-	nop.i 999
-(p0)    br.ret.sptk    b0 ;;                     
+      mov             GR_Parameter_TAG = 158  // Error code
+      nop.i           0
+      br.cond.sptk    __libm_error_region     // Call error support
 }
+;;
 
-L(ILOGB_DENORM):
-// Here if x denormal
-// Form x * 2^64 which is normal
-// Return to common code
-{ .mfb
-        cmp.eq p8,p9 = r0,r0
-        fmpy f9 = f9, f10
-        br.cond.sptk  L(ILOGB_COMMON) ;;
-}
+GLOBAL_LIBM_END(ilogbf)
 
-// X ZERO
-// return INT_MIN, call error support
-L(ILOGB_ZERO): 
-{.mlx
-      mov            GR_Parameter_TAG = 158
-(p6)  movl r33 = 0x0000000080000000 ;;
-};;
-.endp ilogbf
-ASM_SIZE_DIRECTIVE(ilogbf)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
+
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp           // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs               // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
+        add sp=-64,sp                         // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+        mov GR_SAVE_GP=gp                     // Save gp
 };;
+
 { .mmi
-        stfs [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+        stfs [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X    = 16,sp         // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+        mov GR_SAVE_B0=b0                     // Save b0
 };;
+
 .body
 { .mib
-        stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfs [GR_Parameter_X] = f8            // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfs [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        stfs [GR_Parameter_Y] = f9            // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#  // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
+
 { .mmi
-        mov   r8 = r33                         // Store result
+        mov   r8 = rTrialResult
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
+
 { .mib
         mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        br.ret.sptk   b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_ilogbl.S b/sysdeps/ia64/fpu/s_ilogbl.S
index 240da060bf..8a6c9dc710 100644
--- a/sysdeps/ia64/fpu/s_ilogbl.S
+++ b/sysdeps/ia64/fpu/s_ilogbl.S
@@ -1,10 +1,10 @@
 .file "ilogbl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,234 +20,249 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/03/00  Initial version
-// 5/26/00  Fix bug when x a double-extended denormal; 
+// 02/03/00 Initial version
+// 05/26/00 Fix bug when x a double-extended denormal;
 //          if x=0 call error routine, per C9X
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
-// 1/20/01  Fixed result for x=0
-
-.align 32
-.global ilogbl#
-
-.section .text
-.proc  ilogbl#
-.align 32
-
+// 01/20/01 Fixed result for x=0
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
+//
 // API
 //==============================================================
-// int = ilogbl(double_extended)
-
+// int ilogbl( long double x );
+//
 // Overview of operation
 //==============================================================
-// ilogbl computes log2(x) as an int
+// The ilogbl function extracts the exponent of x as an integer
 // and returns it in r8
-
-// ilogbl is similar to logbl but differs in the  following ways:
+//
+// ilogbl is similar to logbl but differs in the following ways:
 //         +-inf
 //            ilogbl: returns INT_MAX
 //             logbl: returns +inf
-//         Nan  returns FP_ILOGBNAN (which is either INT_MAX or INT_MIN)
+//         Nan  returns FP_LOGBNAN (which is either INT_MAX or INT_MIN)
 //            ilogbl: returns INT_MAX (7fffffff)
-//             logbl: returns QNAN (quieted SNAN)
+//             logbl: returns QNAN (quietized SNAN)
 //         0    returns FP_ILOGB0 (which is either INT_MIN or -INT_MAX)
-//            ilogbl: returns INT_MIN (80000000)
-//             logbl: returns -inf
-
+//            ilogbl: returns -INT_MAX (80000001)
+//             logbl: returns -inf, raises the divide-by-zero exception,
+//                   and calls libm_error_support to set domain error
+//
 // Registers used
 //==============================================================
+// general registers used:
+// r26 -> r39
+// r36 -> r39 used as parameters to error path
+//
+// predicate registers used:
+// p6 -> p10
+// floating-point registers used:
+// f9, f10, f11
+// f8, input
 
-// general local registers: 
-// ar.pfs r32
-// r33 -> r37
-// r38 -> r41 used as parameters to error path
-
-// predicate registers used: 
-// p6 - x nan, inf
-// p7 - x 0
-// p8 - x norm, unorm
-// p9 - x unorm
-
-// floating-point registers used: 
-// f8 - f10
-
-#include "libm_support.h"
+rExpBias            = r26
+rExpMask            = r27
+rSignexp_x          = r28
+rExp_x              = r29
+rIntMax             = r30
+rExp_2to64          = r31
 
 GR_SAVE_PFS         = r32
+rTrialResult        = r33
 GR_SAVE_B0          = r34
 GR_SAVE_GP          = r35
-GR_Parameter_X      = r38
-GR_Parameter_Y      = r39
-GR_Parameter_RESULT = r40
-GR_Parameter_TAG    = r41
 
-FR_X                = f8
-FR_Y                = f0
-FR_RESULT           = f0
+GR_Parameter_X      = r36
+GR_Parameter_Y      = r37
+GR_Parameter_RESULT = r38
+GR_Parameter_TAG    = r39
 
+fTmp                = f9
+fNorm_x             = f10
+f2to64              = f11
 
-ilogbl: 
+.section .text
+GLOBAL_LIBM_ENTRY(ilogbl)
 
-// Form signexp of 2^64 in case need to scale denormal
-{ .mmf
-      alloc          r32=ar.pfs,1,5,4,0
-(p0)  mov      r37 = 0x1003f
-(p0)  fnorm    f9 = f8 ;;
+// X NORMAL
+// TrueExp_x = exp(f8) - 0xffff
+// r8 = TrueExp_x
+{ .mfi
+      getf.exp        rSignexp_x = f8
+      fclass.m        p8,p0 = f8, 0x0b   // Test for x unorm
+      mov             rExpBias = 0xffff  // Exponent bias
 }
-
-// Form 2^64 in case need to scale denormal
 { .mfi
-(p0)  setf.exp f10 = r37
-(p0)  fclass.m.unc p7, p8 = f8, 0xe3        
-(p0)  mov      r34 = 0xffff ;;
+      nop.m           0
+      fnorm.s1        fNorm_x = f8
+      mov             rExpMask = 0x1ffff // Exponent mask
 }
+;;
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-// X ZERO, returns INT_MIN
-// X INF or NAN, returns INT_MAX
+// Form signexp of 2^64 in case need to scale denormal
+{ .mfb
+      mov             rExp_2to64 = 0x1003f
+      fclass.m        p6,p9 = f8, 0x1e3  // Test x natval, nan, inf
+(p8)  br.cond.spnt    ILOGB_DENORM       // Branch if x unorm
+}
+;;
 
+ILOGB_COMMON:
+// Return here from ILOGB_DENORM
 { .mfi
-(p0)  mov      r35 = 0x1ffff
-(p8)    fclass.m.unc p6, p8 = f8, 0x07
-	nop.i 999 ;;
+      and             rExp_x = rSignexp_x, rExpMask // Get biased exponent
+      fclass.m        p7,p10 = f8, 0x07   // Test x zero
+      nop.i           0
 }
 { .mlx
-	nop.m 999
-(p7)    movl r8 = 0x000000007fffffff ;;       
+      nop.m           0
+      movl            rIntMax = 0x000000007fffffff // Form INT_MAX
 }
+;;
 
-{ .mib
-	nop.m 999
-	nop.i 999
-(p6)    br.cond.spnt  L(ILOGB_ZERO) ;;
+.pred.rel "mutex",p6,p9
+{ .mfi
+(p9)  sub             r8 = rExp_x, rExpBias // Get true exponent for normal path
+(p6)  fma.s0          fTmp = f8, f8, f0     // Dummy to set Invalid flag
+(p6)  mov             r8 = rIntMax          // If nan, inf, return INT_MAX
 }
+{ .mbb
+      nop.m           0
+(p7)  br.cond.spnt    ILOGB_ZERO            // Branch if x zero
+(p10) br.ret.sptk     b0                    // Exit if x not zero
+}
+;;
+
 
-// Test for denormal
+ILOGB_DENORM:
+// Form 2^64 in case need to scale denormal
+// Check to see if double-extended denormal
 { .mfi
-	nop.m 999
-(p8)    fclass.m.unc p9, p0 = f9, 0x0b        
-	nop.i 999 ;;
+      setf.exp        f2to64 = rExp_2to64
+      fclass.m        p8,p0 = fNorm_x, 0x0b
+      nop.i           0
 }
+;;
 
-L(ILOGB_COMMON):
-// X NORMAL returns true exponent
-{ .mmi
-	nop.m 999 
-(p8)    getf.exp r33 = f9
-	nop.i 999 ;;
+{ .mfi
+      nop.m           0
+      fcmp.eq.s0      p7,p0 = f8, f0           // Dummy op to set denormal flag
+      nop.i           0
 }
+;;
 
-// If denormal add 64 to exponent bias for scaling
-{ .mfb
-(p9)    add     r34 = 64, r34   
-	nop.f 999 
-(p9)    br.cond.spnt  L(ILOGB_DENORM) ;;
+// If double-extended denormal add 64 to exponent bias for scaling
+// If double-extended denormal form x * 2^64 which is normal
+{ .mfi
+(p8)  add             rExpBias = 64, rExpBias
+(p8)  fmpy.s1         fNorm_x = fNorm_x, f2to64
+      nop.i           0
 }
+;;
 
-{ .mmi
-(p8)    and      r36 = r35, r33
-	nop.m 999
-	nop.i 999 ;;
+// Logic is the same as normal path but use normalized input
+{ .mib
+      getf.exp        rSignexp_x = fNorm_x
+      nop.i           0
+      br.cond.sptk    ILOGB_COMMON             // Return to main path
 }
+;;
 
+ILOGB_ZERO:
+// Here if x zero
+// Return INT_MIN, call error support
+
+{ .mlx
+      alloc           r32=ar.pfs,1,3,4,0
+      movl            rTrialResult = 0x0000000080000000
+}
 { .mib
-(p8)    sub r8 = r36, r34                  
-	nop.i 999
-(p0)    br.ret.sptk    b0 ;;                     
+      mov             GR_Parameter_TAG = 156  // Error code
+      nop.i           0
+      br.cond.sptk    __libm_error_region     // Call error support
 }
+;;
 
-L(ILOGB_DENORM):
-// Here if x denormal
-// Form x * 2^64 which is normal
-// Return to common code
-{ .mfb
-        cmp.eq p8,p9 = r0,r0
-        fmpy f9 = f9, f10
-        br.cond.sptk  L(ILOGB_COMMON) ;;
-}
+GLOBAL_LIBM_END(ilogbl)
 
-// X ZERO
-// return INT_MIN, call error support
-L(ILOGB_ZERO): 
-{.mlx
-      mov            GR_Parameter_TAG = 156
-(p6)  movl r33 = 0x0000000080000000 ;;
-};;
-.endp ilogbl
-ASM_SIZE_DIRECTIVE(ilogbl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
+
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp           // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs               // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
+        add sp=-64,sp                         // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+        mov GR_SAVE_GP=gp                     // Save gp
 };;
+
 { .mmi
-        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+        stfe [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X    = 16,sp         // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+        mov GR_SAVE_B0=b0                     // Save b0
 };;
+
 .body
 { .mib
-        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfe [GR_Parameter_X] = f8            // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        stfe [GR_Parameter_Y] = f9            // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#  // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
+
 { .mmi
-        mov   r8 = r33                         // Store result
+        mov   r8 = rTrialResult
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
+
 { .mib
         mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        br.ret.sptk   b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_ldexp.S b/sysdeps/ia64/fpu/s_ldexp.S
deleted file mode 100644
index 4dcd671c9f..0000000000
--- a/sysdeps/ia64/fpu/s_ldexp.S
+++ /dev/null
@@ -1,380 +0,0 @@
-.file "ldexp.s"
-
-// Copyright (C) 2000, 2001, Intel Corporation
-// All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * The name of Intel Corporation may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
-//
-// History
-//==============================================================
-// 2/02/00  Initial version
-// 1/26/01  ldex pcompletely reworked and now standalone version 
-//
-// API
-//==============================================================
-// double = ldexp  (double x, int n) 
-// input  floating point f8 and int n (r33) 
-// output floating point f8
-//
-// Returns x* 2**n using an fma and detects overflow
-// and underflow.   
-//
-//
-
-#include "libm_support.h"
-
-FR_Big         = f6
-FR_NBig        = f7
-FR_Floating_X  = f8
-FR_Result      = f8
-FR_Result2     = f9
-FR_Result3     = f11
-FR_Norm_X      = f12
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-
-GR_N_Biased    = r15
-GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
-GR_Bias        = r20
-GR_N_as_int    = r21
-
-GR_SAVE_B0          = r32
-GR_SAVE_GP          = r33
-GR_SAVE_PFS         = r34
-GR_Parameter_X      = r35
-GR_Parameter_Y      = r36
-GR_Parameter_RESULT = r37
-GR_Tag              = r38
-
-.align 32
-.global ldexp
-
-.section .text
-.proc  ldexp
-.align 32
-
-ldexp: 
-
-//
-//   Is x NAN, INF, ZERO, +-?
-//   Build the exponent Bias
-//
-{    .mfi
-     alloc         r32=ar.pfs,1,2,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl          GR_Bias = 0x0FFFF,r0
-}
-
-//
-//   Sign extend input
-//   Is N zero?
-//   Normalize x
-//
-{    .mfi
-     cmp.eq.unc    p6,p0 = r33,r0  
-     fnorm.s1      FR_Norm_X  =   FR_Floating_X 
-     sxt4          GR_N_as_int = r33
-}
-;;
-
-//
-//   Normalize x
-//   Branch and return special values.
-//   Create -35000
-//   Create 35000
-//
-{    .mfi
-     addl          GR_Big = 35000,r0
-     nop.f 0
-     add           GR_N_Biased = GR_Bias,GR_N_as_int
-}
-{    .mfb
-     addl          GR_NBig = -35000,r0
-(p7) fma.d.s0      FR_Result = FR_Floating_X,f1, f0 
-(p7) br.ret.spnt   b0  
-};;
-
-//
-//   Build the exponent Bias
-//   Return x when N = 0
-//
-{    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.f 0
-     addl          GR_Scratch1  = 0x063BF,r0 
-}
-{    .mfb
-     addl          GR_Scratch  = 0x019C3F,r0 
-(p6) fma.d.s0      FR_Result = FR_Floating_X,f1, f0 
-(p6) br.ret.spnt   b0  
-};;
-
-//
-//   Create 2*big
-//   Create 2**-big 
-//   Is N > 35000     
-//   Is N < -35000     
-//   Raise Denormal operand flag with compare
-//   Main path, create 2**N
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.f 0
-     cmp.ge.unc    p6, p0 = GR_N_as_int, GR_Big
-}
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch                  
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     cmp.le.unc    p8, p0 = GR_N_as_int, GR_NBig
-};;
-
-//
-//   Adjust 2**N if N was very small or very large
-//
-{    .mfi
-     nop.m 0
-(p6) fma.s1        FR_Two_N = FR_Big,f1,f0
-     nop.i 0
-}
-{ .mlx
-     nop.m 999
-(p0) movl          GR_Scratch = 0x00000000000303FF 
-};;
-
-
-{    .mfi
-     nop.m 0
-(p8) fma.s1        FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
-}
-{    .mlx
-     nop.m 999
-(p0) movl          GR_Scratch1= 0x00000000000103FF 
-};;
-
-//   Set up necessary status fields 
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflows)
-//   S3 user supplied status + FZ + TD   (Underflows)
-//
-{    .mfi
-     nop.m 999
-(p0) fsetc.s3      0x7F,0x41
-     nop.i 999
-}
-{    .mfi
-     nop.m 999
-(p0) fsetc.s2      0x7F,0x42
-     nop.i 999
-};;
-
-//
-//   Do final operation
-//
-{    .mfi
-     setf.exp     FR_NBig = GR_Scratch
-     fma.d.s0     FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-}
-{    .mfi
-     nop.m                           999
-     fma.d.s3     FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
-{    .mfi
-     setf.exp     FR_Big = GR_Scratch1
-     fma.d.s2     FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i                           999
-};;
-
-//
-//   Check for overflow or underflow.
-//   Restore s3
-//   Restore s2
-//
-{    .mfi
-     nop.m 0
-     fsetc.s3     0x7F,0x40
-     nop.i 999 
-}
-{    .mfi
-     nop.m 0
-     fsetc.s2     0x7F,0x40
-     nop.i 999
-};;
-
-//
-//   Is the result zero?
-//
-{    .mfi
-     nop.m 999
-     fclass.m.unc p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
-{    .mfi
-     addl           GR_Tag = 146, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
-
-//
-//   Detect masked underflow - Tiny + Inexact Only
-//
-{    .mfi
-     nop.m 999
-(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
-
-//
-//   Is result bigger the allowed range?
-//   Branch out for underflow
-//
-{    .mfb
-(p6) addl            GR_Tag = 147, r0
-(p8) fcmp.le.unc.s1  p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt    L(LDEXP_UNDERFLOW) 
-};;
-
-//
-//   Branch out for overflow
-//
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt    L(LDEXP_OVERFLOW) 
-(p9) br.cond.spnt    L(LDEXP_OVERFLOW) 
-};;
-
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
-}
-
-.endp ldexp
-ASM_SIZE_DIRECTIVE(ldexp)
-.proc __libm_error_region
-__libm_error_region:
-
-L(LDEXP_OVERFLOW): 
-L(LDEXP_UNDERFLOW): 
-
-//
-// Get stack address of N
-//
-.prologue
-{ .mfi
-    add   GR_Parameter_Y=-32,sp         
-    nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
-}
-//
-// Adjust sp 
-//
-{ .mfi
-.fframe 64
-   add sp=-64,sp                         
-   nop.f 0
-   mov GR_SAVE_GP=gp       
-};;
-
-//
-//  Store N on stack in correct position 
-//  Locate the address of x on stack
-//
-{ .mmi
-   st8 [GR_Parameter_Y] =  GR_N_as_int,16       
-   add GR_Parameter_X = 16,sp          
-.save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
-};;
-
-//
-// Store x on the stack.
-// Get address for result on stack.
-//
-.body
-{ .mib
-   stfd [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
-   nop.b 0
-}
-{ .mib
-   stfd [GR_Parameter_Y] = FR_Result                 
-   add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
-};;
-
-//
-//  Get location of result on stack
-//
-{ .mmi
-   nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
-};;
-
-//
-//  Get the new result 
-//
-{ .mmi
-   ldfd  FR_Result = [GR_Parameter_RESULT]      
-.restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
-};;
-
-//
-//  Restore gp, ar.pfs and return
-//
-{ .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
-};;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.type   __libm_error_support#,@function
-.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_ldexp.c b/sysdeps/ia64/fpu/s_ldexp.c
new file mode 100644
index 0000000000..a0bc14c295
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_ldexp.c
@@ -0,0 +1,61 @@
+/* file: ldexp.c */
+
+
+// Copyright (c) 2000, 2001, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+#include "libm_support.h"
+
+double __libm_ldexp(double, int, int);
+
+
+double ldexp(double x, int n)
+{
+
+#ifdef SIZE_INT_64 
+   return __libm_ldexp(x,n,1);  
+#else
+
+#ifdef SIZE_INT_32 
+   return __libm_ldexp(x,n,0);
+#endif
+
+#endif
+
+}
diff --git a/sysdeps/ia64/fpu/s_ldexpf.S b/sysdeps/ia64/fpu/s_ldexpf.S
deleted file mode 100644
index 36f0111fe1..0000000000
--- a/sysdeps/ia64/fpu/s_ldexpf.S
+++ /dev/null
@@ -1,379 +0,0 @@
-//.file "ldexpf.s"
-
-// Copyright (C) 2000, 2001, Intel Corporation
-// All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * The name of Intel Corporation may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
-//
-// History
-//==============================================================
-// 2/02/00  Initial version
-// 1/26/01  ldexpf completely reworked and now standalone version 
-//
-// API
-//==============================================================
-// float = ldexpf  (float x, int n) 
-// input  floating point f8 and int n (r33) 
-// output floating point f8
-//
-// Returns x* 2**n using an fma and detects overflow
-// and underflow.   
-//
-//
-
-#include "libm_support.h"
-
-FR_Big         = f6
-FR_NBig        = f7
-FR_Floating_X  = f8
-FR_Result      = f8
-FR_Result2     = f9
-FR_Result3     = f11
-FR_Norm_X      = f12
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-
-GR_N_Biased    = r15
-GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
-GR_Bias        = r20
-GR_N_as_int    = r21
-
-GR_SAVE_B0          = r32
-GR_SAVE_GP          = r33
-GR_SAVE_PFS         = r34
-GR_Parameter_X      = r35
-GR_Parameter_Y      = r36
-GR_Parameter_RESULT = r37
-GR_Tag              = r38
-
-.align 32
-.global ldexpf
-
-.section .text
-.proc  ldexpf
-.align 32
-
-ldexpf: 
-
-//
-//   Is x NAN, INF, ZERO, +-?
-//   Build the exponent Bias
-//
-{    .mfi
-     alloc         r32=ar.pfs,1,2,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl          GR_Bias = 0x0FFFF,r0
-}
-
-//
-//   Sign extend input
-//   Is N zero?
-//   Normalize x
-//
-{    .mfi
-     cmp.eq.unc    p6,p0 = r33,r0  
-     fnorm.s1      FR_Norm_X  =   FR_Floating_X 
-     sxt4          GR_N_as_int = r33
-}
-;;
-
-//
-//   Normalize x
-//   Branch and return special values.
-//   Create -35000
-//   Create 35000
-//
-{    .mfi
-     addl          GR_Big = 35000,r0
-     nop.f         0
-     add           GR_N_Biased = GR_Bias,GR_N_as_int
-}
-{    .mfb
-     addl          GR_NBig = -35000,r0
-(p7) fma.s.s0      FR_Result = FR_Floating_X,f1, f0 
-(p7) br.ret.spnt   b0  
-};;
-
-//
-//   Build the exponent Bias
-//   Return x when N = 0
-//
-{    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.f         0
-     addl          GR_Scratch1  = 0x063BF,r0 
-}
-{    .mfb
-     addl          GR_Scratch  = 0x019C3F,r0 
-(p6) fma.s.s0      FR_Result = FR_Floating_X,f1, f0 
-(p6) br.ret.spnt   b0  
-};;
-
-//
-//   Create 2*big
-//   Create 2**-big 
-//   Is N > 35000     
-//   Is N < -35000     
-//   Raise Denormal operand flag with compare
-//   Main path, create 2**N
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.f         0
-     cmp.ge.unc    p6, p0 = GR_N_as_int, GR_Big
-}
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch                  
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     cmp.le.unc    p8, p0 = GR_N_as_int, GR_NBig
-};;
-
-//
-//   Adjust 2**N if N was very small or very large
-//
-{    .mfi
-     nop.m 0
-(p6) fma.s1        FR_Two_N = FR_Big,f1,f0
-     nop.i 0
-}
-{ .mlx
-     nop.m 999
-(p0) movl          GR_Scratch = 0x000000000003007F 
-};;
-
-
-{    .mfi
-     nop.m 0
-(p8) fma.s1        FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
-}
-{    .mlx
-     nop.m 999
-(p0) movl          GR_Scratch1= 0x000000000001007F 
-};;
-
-//   Set up necessary status fields 
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflows)
-//   S3 user supplied status + FZ + TD   (Underflows)
-//
-{    .mfi
-     nop.m 999
-(p0) fsetc.s3      0x7F,0x41
-     nop.i 999
-}
-{    .mfi
-     nop.m 999
-(p0) fsetc.s2      0x7F,0x42
-     nop.i 999
-};;
-
-//
-//   Do final operation
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch
-     fma.s.s0      FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-}
-{    .mfi
-     nop.m         999
-     fma.s.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch1
-     fma.s.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-
-//   Check for overflow or underflow.
-//   Restore s3
-//   Restore s2
-//
-{    .mfi
-     nop.m 0
-     fsetc.s3      0x7F,0x40
-     nop.i 999 
-}
-{    .mfi
-     nop.m 0
-     fsetc.s2      0x7F,0x40
-     nop.i 999
-};;
-
-//
-//   Is the result zero?
-//
-{    .mfi
-     nop.m 999
-     fclass.m.unc  p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
-{    .mfi
-     addl          GR_Tag = 148, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
-
-//
-//   Detect masked underflow - Tiny + Inexact Only
-//
-{    .mfi
-     nop.m 999
-(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
-
-//
-//   Is result bigger the allowed range?
-//   Branch out for underflow
-//
-{    .mfb
-(p6) addl           GR_Tag = 149, r0
-(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt   L(ldexpf_UNDERFLOW) 
-};;
-
-//
-//   Branch out for overflow
-//
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt   L(ldexpf_OVERFLOW) 
-(p9) br.cond.spnt   L(ldexpf_OVERFLOW) 
-};;
-
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
-}
-
-.endp ldexpf
-ASM_SIZE_DIRECTIVE(ldexpf)
-.proc __libm_error_region
-__libm_error_region:
-
-L(ldexpf_OVERFLOW): 
-L(ldexpf_UNDERFLOW): 
-
-//
-// Get stack address of N
-//
-.prologue
-{ .mfi
-    add   GR_Parameter_Y=-32,sp         
-    nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
-}
-//
-// Adjust sp 
-//
-{ .mfi
-.fframe 64
-   add sp=-64,sp                         
-   nop.f 0
-   mov GR_SAVE_GP=gp       
-};;
-
-//
-//  Store N on stack in correct position 
-//  Locate the address of x on stack
-//
-{ .mmi
-   st8 [GR_Parameter_Y] =  GR_N_as_int,16       
-   add GR_Parameter_X = 16,sp          
-.save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
-};;
-
-//
-// Store x on the stack.
-// Get address for result on stack.
-//
-.body
-{ .mib
-   stfs [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
-   nop.b 0
-}
-{ .mib
-   stfs [GR_Parameter_Y] = FR_Result                 
-   add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
-};;
-
-//
-//  Get location of result on stack
-//
-{ .mmi
-   nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
-};;
-
-//
-//  Get the new result 
-//
-{ .mmi
-   ldfs  FR_Result = [GR_Parameter_RESULT]      
-.restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
-};;
-
-//
-//  Restore gp, ar.pfs and return
-//
-{ .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
-};;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.type   __libm_error_support#,@function
-.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_ldexpf.c b/sysdeps/ia64/fpu/s_ldexpf.c
new file mode 100644
index 0000000000..ad083fa1c5
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_ldexpf.c
@@ -0,0 +1,61 @@
+/* file: ldexpf.c */
+
+
+// Copyright (c) 2000, 2001, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+#include "libm_support.h"
+
+float __libm_ldexpf(float, int, int);
+
+
+float ldexpf(float x, int n)
+{
+
+#ifdef SIZE_INT_64 
+   return __libm_ldexpf(x,n,1);  
+#else
+
+#ifdef SIZE_INT_32 
+   return __libm_ldexpf(x,n,0);
+#endif
+
+#endif
+
+}
diff --git a/sysdeps/ia64/fpu/s_ldexpl.S b/sysdeps/ia64/fpu/s_ldexpl.S
deleted file mode 100644
index fb5d3fd452..0000000000
--- a/sysdeps/ia64/fpu/s_ldexpl.S
+++ /dev/null
@@ -1,379 +0,0 @@
-//.file "ldexpl.s"
-
-// Copyright (C) 2000, 2001, Intel Corporation
-// All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * The name of Intel Corporation may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
-//
-// History
-//==============================================================
-// 2/02/00  Initial version
-// 1/26/01  ldexpl completely reworked and now standalone version 
-//
-// API
-//==============================================================
-// double-extended = ldexpl  (double-extended x, int n) 
-// input  floating point f8 and int n (r34) 
-// output floating point f8
-//
-// Returns x* 2**n using an fma and detects overflow
-// and underflow.   
-//
-//
-
-#include "libm_support.h"
-
-FR_Big         = f6
-FR_NBig        = f7
-FR_Floating_X  = f8
-FR_Result      = f8
-FR_Result2     = f9
-FR_Result3     = f11
-FR_Norm_X      = f12
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-
-GR_N_Biased    = r15
-GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
-GR_Bias        = r20
-GR_N_as_int    = r21
-
-GR_SAVE_B0          = r32
-GR_SAVE_GP          = r33
-GR_SAVE_PFS         = r34
-GR_Parameter_X      = r35
-GR_Parameter_Y      = r36
-GR_Parameter_RESULT = r37
-GR_Tag              = r38
-
-.align 32
-.global ldexpl
-
-.section .text
-.proc  ldexpl
-.align 32
-
-ldexpl: 
-
-//
-//   Is x NAN, INF, ZERO, +-?
-//   Build the exponent Bias
-//
-{    .mfi
-     alloc         r32=ar.pfs,2,1,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl          GR_Bias = 0x0FFFF,r0
-}
-
-//
-//   Sign extend input
-//   Is N zero?
-//   Normalize x
-//
-{    .mfi
-     cmp.eq.unc    p6,p0 = r34,r0  
-     fnorm.s1      FR_Norm_X  =   FR_Floating_X 
-     sxt4          GR_N_as_int = r34
-}
-;;
-
-//
-//   Normalize x
-//   Branch and return special values.
-//   Create -35000
-//   Create 35000
-//
-{    .mfi
-     addl          GR_Big = 35000,r0
-     nop.f         0
-     add           GR_N_Biased = GR_Bias,GR_N_as_int
-}
-{    .mfb
-     addl          GR_NBig = -35000,r0
-(p7) fma.s0      FR_Result = FR_Floating_X,f1, f0 
-(p7) br.ret.spnt   b0  
-};;
-
-//
-//   Build the exponent Bias
-//   Return x when N = 0
-//
-{    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.f         0
-     addl          GR_Scratch1  = 0x063BF,r0 
-}
-{    .mfb
-     addl          GR_Scratch  = 0x019C3F,r0 
-(p6) fma.s0      FR_Result = FR_Floating_X,f1, f0 
-(p6) br.ret.spnt   b0  
-};;
-
-//
-//   Create 2*big
-//   Create 2**-big 
-//   Is N > 35000     
-//   Is N < -35000     
-//   Raise Denormal operand flag with compare
-//   Main path, create 2**N
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.f         0
-     cmp.ge.unc    p6, p0 = GR_N_as_int, GR_Big
-}
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch                  
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     cmp.le.unc    p8, p0 = GR_N_as_int, GR_NBig
-};;
-
-//
-//   Adjust 2**N if N was very small or very large
-//
-{    .mfi
-     nop.m 0
-(p6) fma.s1        FR_Two_N = FR_Big,f1,f0
-     nop.i 0
-}
-{ .mlx
-     nop.m 999
-(p0) movl          GR_Scratch = 0x0000000000033FFF 
-};;
-
-
-{    .mfi
-     nop.m 0
-(p8) fma.s1        FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
-}
-{    .mlx
-     nop.m 999
-(p0) movl          GR_Scratch1= 0x0000000000013FFF 
-};;
-
-//   Set up necessary status fields 
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflows)
-//   S3 user supplied status + FZ + TD   (Underflows)
-//
-{    .mfi
-     nop.m 999
-(p0) fsetc.s3      0x7F,0x41
-     nop.i 999
-}
-{    .mfi
-     nop.m 999
-(p0) fsetc.s2      0x7F,0x42
-     nop.i 999
-};;
-
-//
-//   Do final operation
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch
-     fma.s0      FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-}
-{    .mfi
-     nop.m         999
-     fma.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch1
-     fma.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-
-//   Check for overflow or underflow.
-//   Restore s3
-//   Restore s2
-//
-{    .mfi
-     nop.m 0
-     fsetc.s3      0x7F,0x40
-     nop.i 999 
-}
-{    .mfi
-     nop.m 0
-     fsetc.s2      0x7F,0x40
-     nop.i 999
-};;
-
-//
-//   Is the result zero?
-//
-{    .mfi
-     nop.m 999
-     fclass.m.unc  p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
-{    .mfi
-     addl          GR_Tag = 144, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
-
-//
-//   Detect masked underflow - Tiny + Inexact Only
-//
-{    .mfi
-     nop.m 999
-(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
-
-//
-//   Is result bigger the allowed range?
-//   Branch out for underflow
-//
-{    .mfb
-(p6) addl           GR_Tag = 145, r0
-(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt   L(ldexpl_UNDERFLOW) 
-};;
-
-//
-//   Branch out for overflow
-//
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt   L(ldexpl_OVERFLOW) 
-(p9) br.cond.spnt   L(ldexpl_OVERFLOW) 
-};;
-
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
-}
-
-.endp ldexpl
-ASM_SIZE_DIRECTIVE(ldexpl)
-.proc __libm_error_region
-__libm_error_region:
-
-L(ldexpl_OVERFLOW): 
-L(ldexpl_UNDERFLOW): 
-
-//
-// Get stack address of N
-//
-.prologue
-{ .mfi
-    add   GR_Parameter_Y=-32,sp         
-    nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
-}
-//
-// Adjust sp 
-//
-{ .mfi
-.fframe 64
-   add sp=-64,sp                         
-   nop.f 0
-   mov GR_SAVE_GP=gp       
-};;
-
-//
-//  Store N on stack in correct position 
-//  Locate the address of x on stack
-//
-{ .mmi
-   st8 [GR_Parameter_Y] =  GR_N_as_int,16       
-   add GR_Parameter_X = 16,sp          
-.save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
-};;
-
-//
-// Store x on the stack.
-// Get address for result on stack.
-//
-.body
-{ .mib
-   stfe [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
-   nop.b 0
-}
-{ .mib
-   stfe [GR_Parameter_Y] = FR_Result                 
-   add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
-};;
-
-//
-//  Get location of result on stack
-//
-{ .mmi
-   nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
-};;
-
-//
-//  Get the new result 
-//
-{ .mmi
-   ldfe  FR_Result = [GR_Parameter_RESULT]      
-.restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
-};;
-
-//
-//  Restore gp, ar.pfs and return
-//
-{ .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
-};;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.type   __libm_error_support#,@function
-.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_ldexpl.c b/sysdeps/ia64/fpu/s_ldexpl.c
new file mode 100644
index 0000000000..61dfd21f13
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_ldexpl.c
@@ -0,0 +1,61 @@
+/* file: ldexpl.c */
+
+
+// Copyright (c) 2000, 2001, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+#include "libm_support.h"
+
+long double __libm_ldexpl(long double, int, int);
+
+
+long double ldexpl(long double x, int n)
+{
+
+#ifdef SIZE_INT_64 
+   return __libm_ldexpl(x,n,1);  
+#else
+
+#ifdef SIZE_INT_32 
+   return __libm_ldexpl(x,n,0);
+#endif
+
+#endif
+
+}
diff --git a/sysdeps/ia64/fpu/s_libm_ldexp.S b/sysdeps/ia64/fpu/s_libm_ldexp.S
new file mode 100644
index 0000000000..2aaf2c35fd
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_libm_ldexp.S
@@ -0,0 +1,452 @@
+.file "libm_ldexp.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 01/26/01 ldexp completely reworked and now standalone version
+// 01/04/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/04/03 Improved performance
+//
+// API
+//==============================================================
+// double __libm_ldexp  (double x, int n, int int_type)
+// input  floating point f8 and int n (r33), int int_type (r34)
+// output floating point f8
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// Returns x* 2**n using an fma and detects overflow
+// and underflow.
+//
+//
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x103fe                 -> Certain overflow
+//   exp_Result = 0x103fe                 -> Possible overflow
+//   0x0fc01 <= exp_Result < 0x103fe      -> No over/underflow (main path)
+//   0x0fc01 - 52 <= exp_Result < 0x0fc01 -> Possible underflow
+//   exp_Result < 0x0fc01 - 52            -> Certain underflow
+
+FR_Big         = f6
+FR_NBig        = f7
+FR_Floating_X  = f8
+FR_Result      = f8
+FR_Result2     = f9
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
+
+GR_neg_ov_limit= r14
+GR_N_Biased    = r15
+GR_Big         = r16
+GR_NBig        = r17
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_Bias        = r20
+GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+
+GR_SAVE_B0          = r32
+GR_SAVE_GP          = r33
+GR_SAVE_PFS         = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Tag              = r38
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_ldexp)
+
+//
+//   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
+//
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+//
+//   Normalize x
+//   Is integer type 32 bits?
+//
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+     cmp.eq        p8,p9 = r34,r0
+}
+;;
+
+//   Sign extend N if int is 32 bits
+{    .mfi
+(p9) mov           GR_N_as_int = r33     // Copy N if int is 64 bits
+     fclass.m      p9,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+(p8) sxt4          GR_N_as_int = r33     // Sign extend N if int is 32 bits
+}
+{ .mfi
+     mov           GR_NBig = -35000    // If N this small then certain underflow
+     nop.f         0
+     mov           GR_max_exp = 0x103fe      // Exponent of maximum double
+}
+;;
+
+//   Create biased exponent for 2**N
+{    .mfi
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.ge        p7, p0 = GR_N_as_int, GR_Big  // Certain overflow?
+}
+{    .mib
+     cmp.le        p8, p0 = GR_N_as_int, GR_NBig // Certain underflow?
+     mov           GR_min_exp = 0x0fc01      // Exponent of minimum double
+(p9) br.cond.spnt  LDEXP_UNORM               // Branch if x=unorm
+}
+;;
+
+LDEXP_COMMON:
+// Main path continues.  Also return here from x=unorm path.
+//   Create 2**N
+.pred.rel "mutex",p7,p8
+{    .mfi
+     setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+(p7) mov           GR_N_as_int = GR_Big      // Limit max N
+}
+{    .mfi
+(p8) mov           GR_N_as_int = GR_NBig     // Limit min N
+     nop.f         0
+(p8) cmp.eq        p7,p0 = r0,r0             // Set p7 if |N| big
+}
+;;
+
+//
+//   Create biased exponent for 2**N for N big
+//   Is N zero?
+//
+{    .mfi
+(p7) add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.eq.or     p6,p0 = r33,r0
+}
+{    .mfi
+     mov           GR_pos_ov_limit = 0x103ff // Exponent for positive overflow
+     nop.f         0
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+}
+;;
+
+//
+//   Create 2**N for N big
+//   Return x when N = 0 or X = Nan, Inf, Zero
+//
+{    .mfi
+(p7) setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+     mov           GR_min_den_exp = 0x0fc01 - 52 // Exponent of min denorm dble
+}
+{    .mfb
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X
+(p6) fma.d.s0      FR_Result = FR_Floating_X, f1, f0
+(p6) br.ret.spnt   b0
+}
+;;
+
+//
+//   Raise Denormal operand flag with compare
+//   Compute biased result exponent
+//
+{    .mfi
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
+     mov           GR_neg_ov_limit = 0x303ff // Exponent for negative overflow
+}
+;;
+
+//
+//   Do final operation
+//
+{    .mfi
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fma.d.s0      FR_Result = FR_Two_N,FR_Norm_X,f0
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
+}
+{    .mfb
+     nop.m         0
+     nop.f         0
+(p9) br.cond.spnt  LDEXP_UNDERFLOW           // Branch if certain underflow
+}
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  LDEXP_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  LDEXP_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  LDEXP_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
+
+// Here if possible underflow.
+// Resulting exponent: 0x0fc01-52 <= exp_Result < 0x0fc01
+LDEXP_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x103fe = exp_Result
+LDEXP_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
+//
+//   S0 user supplied status
+//   S2 user supplied status + WRE + TD  (Overflows)
+//   S3 user supplied status + FZ + TD   (Underflows)
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x41
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
+
+//
+//   Do final operation with s2 and s3
+//
+{    .mfi
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.d.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+{    .mfi
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.d.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
+
+//   Check for overflow or underflow.
+//   Restore s3
+//   Restore s2
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
+
+//
+//   Is the result zero?
+//
+{    .mfi
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
+
+//
+//   Detect masked underflow - Tiny + Inexact Only
+//
+{    .mfi
+     nop.m         0
+(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
+     nop.i         0
+}
+;;
+
+//
+//   Is result bigger the allowed range?
+//   Branch out for underflow
+//
+{    .mfb
+     nop.m          0
+(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
+(p6) br.cond.spnt   LDEXP_UNDERFLOW
+}
+;;
+
+//
+//   Branch out for overflow
+//
+{ .bbb
+(p7) br.cond.spnt   LDEXP_OVERFLOW
+(p9) br.cond.spnt   LDEXP_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
+
+// Here if result overflows
+LDEXP_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 146, r0    // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
+}
+;;
+
+// Here if result underflows
+LDEXP_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 147, r0    // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
+
+// Here if x=unorm
+LDEXP_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  LDEXP_COMMON            // Return to main path
+}
+;;
+
+
+GLOBAL_LIBM_END(__libm_ldexp)
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+//
+// Get stack address of N
+//
+.prologue
+{ .mfi
+    add   GR_Parameter_Y=-32,sp
+    nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+    mov  GR_SAVE_PFS=ar.pfs
+}
+//
+// Adjust sp
+//
+{ .mfi
+.fframe 64
+   add sp=-64,sp
+   nop.f 0
+   mov GR_SAVE_GP=gp
+};;
+
+//
+//  Store N on stack in correct position
+//  Locate the address of x on stack
+//
+{ .mmi
+   st8 [GR_Parameter_Y] =  GR_N_as_int,16
+   add GR_Parameter_X = 16,sp
+.save   b0, GR_SAVE_B0
+   mov GR_SAVE_B0=b0
+};;
+
+//
+// Store x on the stack.
+// Get address for result on stack.
+//
+.body
+{ .mib
+   stfd [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+   nop.b 0
+}
+{ .mib
+   stfd [GR_Parameter_Y] = FR_Result
+   add   GR_Parameter_Y = -16,GR_Parameter_Y
+   br.call.sptk b0=__libm_error_support#
+};;
+
+//
+//  Get location of result on stack
+//
+{ .mmi
+   add   GR_Parameter_RESULT = 48,sp
+   nop.m 0
+   nop.i 0
+};;
+
+//
+//  Get the new result
+//
+{ .mmi
+   ldfd  FR_Result = [GR_Parameter_RESULT]
+.restore sp
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
+};;
+
+//
+//  Restore gp, ar.pfs and return
+//
+{ .mib
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_libm_ldexpf.S b/sysdeps/ia64/fpu/s_libm_ldexpf.S
new file mode 100644
index 0000000000..1326a14c2d
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_libm_ldexpf.S
@@ -0,0 +1,452 @@
+.file "libm_ldexpf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 01/26/01 ldexpf completely reworked and now standalone version
+// 01/04/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/04/03 Improved performance
+//
+// API
+//==============================================================
+// float __libm_ldexpf  (float x, int n, int int_type)
+// input  floating point f8 and int n (r33), int int_type (r34)
+// output floating point f8
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// Returns x* 2**n using an fma and detects overflow
+// and underflow.
+//
+//
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x1007e                 -> Certain overflow
+//   exp_Result = 0x1007e                 -> Possible overflow
+//   0x0ff81 <= exp_Result < 0x1007e      -> No over/underflow (main path)
+//   0x0ff81 - 23 <= exp_Result < 0x0ff81 -> Possible underflow
+//   exp_Result < 0x0ff81 - 23            -> Certain underflow
+
+FR_Big         = f6
+FR_NBig        = f7
+FR_Floating_X  = f8
+FR_Result      = f8
+FR_Result2     = f9
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
+
+GR_neg_ov_limit= r14
+GR_N_Biased    = r15
+GR_Big         = r16
+GR_NBig        = r17
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_Bias        = r20
+GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+
+GR_SAVE_B0          = r32
+GR_SAVE_GP          = r33
+GR_SAVE_PFS         = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Tag              = r38
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_ldexpf)
+
+//
+//   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
+//
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+//
+//   Normalize x
+//   Is integer type 32 bits?
+//
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+     cmp.eq        p8,p9 = r34,r0
+}
+;;
+
+//   Sign extend N if int is 32 bits
+{    .mfi
+(p9) mov           GR_N_as_int = r33     // Copy N if int is 64 bits
+     fclass.m      p9,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+(p8) sxt4          GR_N_as_int = r33     // Sign extend N if int is 32 bits
+}
+{ .mfi
+     mov           GR_NBig = -35000    // If N this small then certain underflow
+     nop.f         0
+     mov           GR_max_exp = 0x1007e      // Exponent of maximum float
+}
+;;
+
+//   Create biased exponent for 2**N
+{    .mfi
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.ge        p7, p0 = GR_N_as_int, GR_Big  // Certain overflow?
+}
+{    .mib
+     cmp.le        p8, p0 = GR_N_as_int, GR_NBig // Certain underflow?
+     mov           GR_min_exp = 0x0ff81      // Exponent of minimum float
+(p9) br.cond.spnt  LDEXPF_UNORM              // Branch if x=unorm
+}
+;;
+
+LDEXPF_COMMON:
+// Main path continues.  Also return here from x=unorm path.
+//   Create 2**N
+.pred.rel "mutex",p7,p8
+{    .mfi
+     setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+(p7) mov           GR_N_as_int = GR_Big      // Limit max N
+}
+{    .mfi
+(p8) mov           GR_N_as_int = GR_NBig     // Limit min N
+     nop.f         0
+(p8) cmp.eq        p7,p0 = r0,r0             // Set p7 if |N| big
+}
+;;
+
+//
+//   Create biased exponent for 2**N for N big
+//   Is N zero?
+//
+{    .mfi
+(p7) add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.eq.or     p6,p0 = r33,r0
+}
+{    .mfi
+     mov           GR_pos_ov_limit = 0x1007f // Exponent for positive overflow
+     nop.f         0
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+}
+;;
+
+//
+//   Create 2**N for N big
+//   Return x when N = 0 or X = Nan, Inf, Zero
+//
+{    .mfi
+(p7) setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+     mov           GR_min_den_exp = 0x0ff81 - 23 // Exponent of min denorm float
+}
+{    .mfb
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X
+(p6) fma.s.s0      FR_Result = FR_Floating_X, f1, f0
+(p6) br.ret.spnt   b0
+}
+;;
+
+//
+//   Raise Denormal operand flag with compare
+//   Compute biased result exponent
+//
+{    .mfi
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
+     mov           GR_neg_ov_limit = 0x3007f // Exponent for negative overflow
+}
+;;
+
+//
+//   Do final operation
+//
+{    .mfi
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fma.s.s0      FR_Result = FR_Two_N,FR_Norm_X,f0
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
+}
+{    .mfb
+     nop.m         0
+     nop.f         0
+(p9) br.cond.spnt  LDEXPF_UNDERFLOW           // Branch if certain underflow
+}
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  LDEXPF_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  LDEXPF_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  LDEXPF_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
+
+// Here if possible underflow.
+// Resulting exponent: 0x0ff81-23 <= exp_Result < 0x0ff81
+LDEXPF_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x1007e = exp_Result
+LDEXPF_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
+//
+//   S0 user supplied status
+//   S2 user supplied status + WRE + TD  (Overflows)
+//   S3 user supplied status + FZ + TD   (Underflows)
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x41
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
+
+//
+//   Do final operation with s2 and s3
+//
+{    .mfi
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.s.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+{    .mfi
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.s.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
+
+//   Check for overflow or underflow.
+//   Restore s3
+//   Restore s2
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
+
+//
+//   Is the result zero?
+//
+{    .mfi
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
+
+//
+//   Detect masked underflow - Tiny + Inexact Only
+//
+{    .mfi
+     nop.m         0
+(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
+     nop.i         0
+}
+;;
+
+//
+//   Is result bigger the allowed range?
+//   Branch out for underflow
+//
+{    .mfb
+     nop.m          0
+(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
+(p6) br.cond.spnt   LDEXPF_UNDERFLOW
+}
+;;
+
+//
+//   Branch out for overflow
+//
+{ .bbb
+(p7) br.cond.spnt   LDEXPF_OVERFLOW
+(p9) br.cond.spnt   LDEXPF_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
+
+// Here if result overflows
+LDEXPF_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 148, r0    // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
+}
+;;
+
+// Here if result underflows
+LDEXPF_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 149, r0    // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
+
+// Here if x=unorm
+LDEXPF_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  LDEXPF_COMMON            // Return to main path
+}
+;;
+
+
+GLOBAL_LIBM_END(__libm_ldexpf)
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+//
+// Get stack address of N
+//
+.prologue
+{ .mfi
+    add   GR_Parameter_Y=-32,sp
+    nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+    mov  GR_SAVE_PFS=ar.pfs
+}
+//
+// Adjust sp
+//
+{ .mfi
+.fframe 64
+   add sp=-64,sp
+   nop.f 0
+   mov GR_SAVE_GP=gp
+};;
+
+//
+//  Store N on stack in correct position
+//  Locate the address of x on stack
+//
+{ .mmi
+   st8 [GR_Parameter_Y] =  GR_N_as_int,16
+   add GR_Parameter_X = 16,sp
+.save   b0, GR_SAVE_B0
+   mov GR_SAVE_B0=b0
+};;
+
+//
+// Store x on the stack.
+// Get address for result on stack.
+//
+.body
+{ .mib
+   stfs [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+   nop.b 0
+}
+{ .mib
+   stfs [GR_Parameter_Y] = FR_Result
+   add   GR_Parameter_Y = -16,GR_Parameter_Y
+   br.call.sptk b0=__libm_error_support#
+};;
+
+//
+//  Get location of result on stack
+//
+{ .mmi
+   add   GR_Parameter_RESULT = 48,sp
+   nop.m 0
+   nop.i 0
+};;
+
+//
+//  Get the new result
+//
+{ .mmi
+   ldfs  FR_Result = [GR_Parameter_RESULT]
+.restore sp
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
+};;
+
+//
+//  Restore gp, ar.pfs and return
+//
+{ .mib
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_libm_ldexpl.S b/sysdeps/ia64/fpu/s_libm_ldexpl.S
new file mode 100644
index 0000000000..fffda9e55a
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_libm_ldexpl.S
@@ -0,0 +1,452 @@
+.file "libm_ldexpl.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 01/26/01 ldexpl completely reworked and now standalone version
+// 01/04/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/04/03 Improved performance
+//
+// API
+//==============================================================
+// long double __libm_ldexpl  (long double x, int n, int int_type)
+// input  floating point f8 and int n (r34), int int_type (r35)
+// output floating point f8
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// Returns x* 2**n using an fma and detects overflow
+// and underflow.
+//
+//
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x13ffe                 -> Certain overflow
+//   exp_Result = 0x13ffe                 -> Possible overflow
+//   0x0c001 <= exp_Result < 0x13ffe      -> No over/underflow (main path)
+//   0x0c001 - 63 <= exp_Result < 0x0c001 -> Possible underflow
+//   exp_Result < 0x0c001 - 63            -> Certain underflow
+
+FR_Big         = f6
+FR_NBig        = f7
+FR_Floating_X  = f8
+FR_Result      = f8
+FR_Result2     = f9
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
+
+GR_neg_ov_limit= r14
+GR_N_Biased    = r15
+GR_Big         = r16
+GR_NBig        = r17
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_Bias        = r20
+GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+
+GR_SAVE_B0          = r32
+GR_SAVE_GP          = r33
+GR_SAVE_PFS         = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Tag              = r38
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_ldexpl)
+
+//
+//   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
+//
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+//
+//   Normalize x
+//   Is integer type 32 bits?
+//
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+     cmp.eq        p8,p9 = r35,r0
+}
+;;
+
+//   Sign extend N if int is 32 bits
+{    .mfi
+(p9) mov           GR_N_as_int = r34     // Copy N if int is 64 bits
+     fclass.m      p9,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+(p8) sxt4          GR_N_as_int = r34     // Sign extend N if int is 32 bits
+}
+{ .mfi
+     mov           GR_NBig = -35000    // If N this small then certain underflow
+     nop.f         0
+     mov           GR_max_exp = 0x13ffe      // Exponent of maximum long double
+}
+;;
+
+//   Create biased exponent for 2**N
+{    .mfi
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.ge        p7, p0 = GR_N_as_int, GR_Big  // Certain overflow?
+}
+{    .mib
+     cmp.le        p8, p0 = GR_N_as_int, GR_NBig // Certain underflow?
+     mov           GR_min_exp = 0x0c001      // Exponent of minimum long double
+(p9) br.cond.spnt  LDEXPL_UNORM              // Branch if x=unorm
+}
+;;
+
+LDEXPL_COMMON:
+// Main path continues.  Also return here from x=unorm path.
+//   Create 2**N
+.pred.rel "mutex",p7,p8
+{    .mfi
+     setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+(p7) mov           GR_N_as_int = GR_Big      // Limit max N
+}
+{    .mfi
+(p8) mov           GR_N_as_int = GR_NBig     // Limit min N
+     nop.f         0
+(p8) cmp.eq        p7,p0 = r0,r0             // Set p7 if |N| big
+}
+;;
+
+//
+//   Create biased exponent for 2**N for N big
+//   Is N zero?
+//
+{    .mfi
+(p7) add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.eq.or     p6,p0 = r34,r0
+}
+{    .mfi
+     mov           GR_pos_ov_limit = 0x13fff // Exponent for positive overflow
+     nop.f         0
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+}
+;;
+
+//
+//   Create 2**N for N big
+//   Return x when N = 0 or X = Nan, Inf, Zero
+//
+{    .mfi
+(p7) setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+     mov           GR_min_den_exp = 0x0c001 - 63 // Exp of min denorm long dble
+}
+{    .mfb
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X
+(p6) fma.s0        FR_Result = FR_Floating_X, f1, f0
+(p6) br.ret.spnt   b0
+}
+;;
+
+//
+//   Raise Denormal operand flag with compare
+//   Compute biased result exponent
+//
+{    .mfi
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
+     mov           GR_neg_ov_limit = 0x33fff // Exponent for negative overflow
+}
+;;
+
+//
+//   Do final operation
+//
+{    .mfi
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fma.s0        FR_Result = FR_Two_N,FR_Norm_X,f0
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
+}
+{    .mfb
+     nop.m         0
+     nop.f         0
+(p9) br.cond.spnt  LDEXPL_UNDERFLOW           // Branch if certain underflow
+}
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  LDEXPL_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  LDEXPL_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  LDEXPL_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
+
+// Here if possible underflow.
+// Resulting exponent: 0x0c001-63 <= exp_Result < 0x0c001
+LDEXPL_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x13ffe = exp_Result
+LDEXPL_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
+//
+//   S0 user supplied status
+//   S2 user supplied status + WRE + TD  (Overflows)
+//   S3 user supplied status + FZ + TD   (Underflows)
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x41
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
+
+//
+//   Do final operation with s2 and s3
+//
+{    .mfi
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.s3        FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+{    .mfi
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.s2        FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
+
+//   Check for overflow or underflow.
+//   Restore s3
+//   Restore s2
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
+
+//
+//   Is the result zero?
+//
+{    .mfi
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
+
+//
+//   Detect masked underflow - Tiny + Inexact Only
+//
+{    .mfi
+     nop.m         0
+(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
+     nop.i         0
+}
+;;
+
+//
+//   Is result bigger the allowed range?
+//   Branch out for underflow
+//
+{    .mfb
+     nop.m          0
+(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
+(p6) br.cond.spnt   LDEXPL_UNDERFLOW
+}
+;;
+
+//
+//   Branch out for overflow
+//
+{ .bbb
+(p7) br.cond.spnt   LDEXPL_OVERFLOW
+(p9) br.cond.spnt   LDEXPL_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
+
+// Here if result overflows
+LDEXPL_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 144, r0    // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
+}
+;;
+
+// Here if result underflows
+LDEXPL_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 145, r0    // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
+
+// Here if x=unorm
+LDEXPL_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  LDEXPL_COMMON            // Return to main path
+}
+;;
+
+
+GLOBAL_LIBM_END(__libm_ldexpl)
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+//
+// Get stack address of N
+//
+.prologue
+{ .mfi
+    add   GR_Parameter_Y=-32,sp
+    nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+    mov  GR_SAVE_PFS=ar.pfs
+}
+//
+// Adjust sp
+//
+{ .mfi
+.fframe 64
+   add sp=-64,sp
+   nop.f 0
+   mov GR_SAVE_GP=gp
+};;
+
+//
+//  Store N on stack in correct position
+//  Locate the address of x on stack
+//
+{ .mmi
+   st8 [GR_Parameter_Y] =  GR_N_as_int,16
+   add GR_Parameter_X = 16,sp
+.save   b0, GR_SAVE_B0
+   mov GR_SAVE_B0=b0
+};;
+
+//
+// Store x on the stack.
+// Get address for result on stack.
+//
+.body
+{ .mib
+   stfe [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+   nop.b 0
+}
+{ .mib
+   stfe [GR_Parameter_Y] = FR_Result
+   add   GR_Parameter_Y = -16,GR_Parameter_Y
+   br.call.sptk b0=__libm_error_support#
+};;
+
+//
+//  Get location of result on stack
+//
+{ .mmi
+   add   GR_Parameter_RESULT = 48,sp
+   nop.m 0
+   nop.i 0
+};;
+
+//
+//  Get the new result
+//
+{ .mmi
+   ldfe  FR_Result = [GR_Parameter_RESULT]
+.restore sp
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
+};;
+
+//
+//  Restore gp, ar.pfs and return
+//
+{ .mib
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_libm_scalbn.S b/sysdeps/ia64/fpu/s_libm_scalbn.S
new file mode 100644
index 0000000000..eaccb7de7a
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_libm_scalbn.S
@@ -0,0 +1,452 @@
+.file "libm_scalbn.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 01/26/01 Scalbn completely reworked and now standalone version
+// 01/04/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/04/03 Improved performance
+//
+// API
+//==============================================================
+// double __libm_scalbn  (double x, int n, int int_type)
+// input  floating point f8 and int n (r33), int int_type (r34)
+// output floating point f8
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// Returns x* 2**n using an fma and detects overflow
+// and underflow.
+//
+//
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x103fe                 -> Certain overflow
+//   exp_Result = 0x103fe                 -> Possible overflow
+//   0x0fc01 <= exp_Result < 0x103fe      -> No over/underflow (main path)
+//   0x0fc01 - 52 <= exp_Result < 0x0fc01 -> Possible underflow
+//   exp_Result < 0x0fc01 - 52            -> Certain underflow
+
+FR_Big         = f6
+FR_NBig        = f7
+FR_Floating_X  = f8
+FR_Result      = f8
+FR_Result2     = f9
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
+
+GR_neg_ov_limit= r14
+GR_N_Biased    = r15
+GR_Big         = r16
+GR_NBig        = r17
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_Bias        = r20
+GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+
+GR_SAVE_B0          = r32
+GR_SAVE_GP          = r33
+GR_SAVE_PFS         = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Tag              = r38
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_scalbn)
+
+//
+//   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
+//
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+//
+//   Normalize x
+//   Is integer type 32 bits?
+//
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+     cmp.eq        p8,p9 = r34,r0
+}
+;;
+
+//   Sign extend N if int is 32 bits
+{    .mfi
+(p9) mov           GR_N_as_int = r33     // Copy N if int is 64 bits
+     fclass.m      p9,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+(p8) sxt4          GR_N_as_int = r33     // Sign extend N if int is 32 bits
+}
+{ .mfi
+     mov           GR_NBig = -35000    // If N this small then certain underflow
+     nop.f         0
+     mov           GR_max_exp = 0x103fe      // Exponent of maximum double
+}
+;;
+
+//   Create biased exponent for 2**N
+{    .mfi
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.ge        p7, p0 = GR_N_as_int, GR_Big  // Certain overflow?
+}
+{    .mib
+     cmp.le        p8, p0 = GR_N_as_int, GR_NBig // Certain underflow?
+     mov           GR_min_exp = 0x0fc01      // Exponent of minimum double
+(p9) br.cond.spnt  SCALBN_UNORM              // Branch if x=unorm
+}
+;;
+
+SCALBN_COMMON:
+// Main path continues.  Also return here from x=unorm path.
+//   Create 2**N
+.pred.rel "mutex",p7,p8
+{    .mfi
+     setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+(p7) mov           GR_N_as_int = GR_Big      // Limit max N
+}
+{    .mfi
+(p8) mov           GR_N_as_int = GR_NBig     // Limit min N
+     nop.f         0
+(p8) cmp.eq        p7,p0 = r0,r0             // Set p7 if |N| big
+}
+;;
+
+//
+//   Create biased exponent for 2**N for N big
+//   Is N zero?
+//
+{    .mfi
+(p7) add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.eq.or     p6,p0 = r33,r0
+}
+{    .mfi
+     mov           GR_pos_ov_limit = 0x103ff // Exponent for positive overflow
+     nop.f         0
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+}
+;;
+
+//
+//   Create 2**N for N big
+//   Return x when N = 0 or X = Nan, Inf, Zero
+//
+{    .mfi
+(p7) setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+     mov           GR_min_den_exp = 0x0fc01 - 52 // Exponent of min denorm dble
+}
+{    .mfb
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X
+(p6) fma.d.s0      FR_Result = FR_Floating_X, f1, f0
+(p6) br.ret.spnt   b0
+}
+;;
+
+//
+//   Raise Denormal operand flag with compare
+//   Compute biased result exponent
+//
+{    .mfi
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
+     mov           GR_neg_ov_limit = 0x303ff // Exponent for negative overflow
+}
+;;
+
+//
+//   Do final operation
+//
+{    .mfi
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fma.d.s0      FR_Result = FR_Two_N,FR_Norm_X,f0
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
+}
+{    .mfb
+     nop.m         0
+     nop.f         0
+(p9) br.cond.spnt  SCALBN_UNDERFLOW           // Branch if certain underflow
+}
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  SCALBN_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  SCALBN_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  SCALBN_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
+
+// Here if possible underflow.
+// Resulting exponent: 0x0fc01-52 <= exp_Result < 0x0fc01
+SCALBN_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x103fe = exp_Result
+SCALBN_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
+//
+//   S0 user supplied status
+//   S2 user supplied status + WRE + TD  (Overflows)
+//   S3 user supplied status + FZ + TD   (Underflows)
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x41
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
+
+//
+//   Do final operation with s2 and s3
+//
+{    .mfi
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.d.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+{    .mfi
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.d.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
+
+//   Check for overflow or underflow.
+//   Restore s3
+//   Restore s2
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
+
+//
+//   Is the result zero?
+//
+{    .mfi
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
+
+//
+//   Detect masked underflow - Tiny + Inexact Only
+//
+{    .mfi
+     nop.m         0
+(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
+     nop.i         0
+}
+;;
+
+//
+//   Is result bigger the allowed range?
+//   Branch out for underflow
+//
+{    .mfb
+     nop.m          0
+(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
+(p6) br.cond.spnt   SCALBN_UNDERFLOW
+}
+;;
+
+//
+//   Branch out for overflow
+//
+{ .bbb
+(p7) br.cond.spnt   SCALBN_OVERFLOW
+(p9) br.cond.spnt   SCALBN_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
+
+// Here if result overflows
+SCALBN_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 176, r0    // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
+}
+;;
+
+// Here if result underflows
+SCALBN_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 177, r0    // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
+
+// Here if x=unorm
+SCALBN_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  SCALBN_COMMON            // Return to main path
+}
+;;
+
+
+GLOBAL_LIBM_END(__libm_scalbn)
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+//
+// Get stack address of N
+//
+.prologue
+{ .mfi
+    add   GR_Parameter_Y=-32,sp
+    nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+    mov  GR_SAVE_PFS=ar.pfs
+}
+//
+// Adjust sp
+//
+{ .mfi
+.fframe 64
+   add sp=-64,sp
+   nop.f 0
+   mov GR_SAVE_GP=gp
+};;
+
+//
+//  Store N on stack in correct position
+//  Locate the address of x on stack
+//
+{ .mmi
+   st8 [GR_Parameter_Y] =  GR_N_as_int,16
+   add GR_Parameter_X = 16,sp
+.save   b0, GR_SAVE_B0
+   mov GR_SAVE_B0=b0
+};;
+
+//
+// Store x on the stack.
+// Get address for result on stack.
+//
+.body
+{ .mib
+   stfd [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+   nop.b 0
+}
+{ .mib
+   stfd [GR_Parameter_Y] = FR_Result
+   add   GR_Parameter_Y = -16,GR_Parameter_Y
+   br.call.sptk b0=__libm_error_support#
+};;
+
+//
+//  Get location of result on stack
+//
+{ .mmi
+   add   GR_Parameter_RESULT = 48,sp
+   nop.m 0
+   nop.i 0
+};;
+
+//
+//  Get the new result
+//
+{ .mmi
+   ldfd  FR_Result = [GR_Parameter_RESULT]
+.restore sp
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
+};;
+
+//
+//  Restore gp, ar.pfs and return
+//
+{ .mib
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_libm_scalbnf.S b/sysdeps/ia64/fpu/s_libm_scalbnf.S
new file mode 100644
index 0000000000..e00997aba7
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_libm_scalbnf.S
@@ -0,0 +1,452 @@
+.file "libm_scalbnf.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 01/26/01 Scalbnf completely reworked and now standalone version
+// 01/04/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/04/03 Improved performance
+//
+// API
+//==============================================================
+// float __libm_scalbnf  (float x, int n, int int_type)
+// input  floating point f8 and int n (r33), int int_type (r34)
+// output floating point f8
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// Returns x* 2**n using an fma and detects overflow
+// and underflow.
+//
+//
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x1007e                 -> Certain overflow
+//   exp_Result = 0x1007e                 -> Possible overflow
+//   0x0ff81 <= exp_Result < 0x1007e      -> No over/underflow (main path)
+//   0x0ff81 - 23 <= exp_Result < 0x0ff81 -> Possible underflow
+//   exp_Result < 0x0ff81 - 23            -> Certain underflow
+
+FR_Big         = f6
+FR_NBig        = f7
+FR_Floating_X  = f8
+FR_Result      = f8
+FR_Result2     = f9
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
+
+GR_neg_ov_limit= r14
+GR_N_Biased    = r15
+GR_Big         = r16
+GR_NBig        = r17
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_Bias        = r20
+GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+
+GR_SAVE_B0          = r32
+GR_SAVE_GP          = r33
+GR_SAVE_PFS         = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Tag              = r38
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_scalbnf)
+
+//
+//   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
+//
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+//
+//   Normalize x
+//   Is integer type 32 bits?
+//
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+     cmp.eq        p8,p9 = r34,r0
+}
+;;
+
+//   Sign extend N if int is 32 bits
+{    .mfi
+(p9) mov           GR_N_as_int = r33     // Copy N if int is 64 bits
+     fclass.m      p9,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+(p8) sxt4          GR_N_as_int = r33     // Sign extend N if int is 32 bits
+}
+{ .mfi
+     mov           GR_NBig = -35000    // If N this small then certain underflow
+     nop.f         0
+     mov           GR_max_exp = 0x1007e      // Exponent of maximum float
+}
+;;
+
+//   Create biased exponent for 2**N
+{    .mfi
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.ge        p7, p0 = GR_N_as_int, GR_Big  // Certain overflow?
+}
+{    .mib
+     cmp.le        p8, p0 = GR_N_as_int, GR_NBig // Certain underflow?
+     mov           GR_min_exp = 0x0ff81      // Exponent of minimum float
+(p9) br.cond.spnt  SCALBNF_UNORM              // Branch if x=unorm
+}
+;;
+
+SCALBNF_COMMON:
+// Main path continues.  Also return here from x=unorm path.
+//   Create 2**N
+.pred.rel "mutex",p7,p8
+{    .mfi
+     setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+(p7) mov           GR_N_as_int = GR_Big      // Limit max N
+}
+{    .mfi
+(p8) mov           GR_N_as_int = GR_NBig     // Limit min N
+     nop.f         0
+(p8) cmp.eq        p7,p0 = r0,r0             // Set p7 if |N| big
+}
+;;
+
+//
+//   Create biased exponent for 2**N for N big
+//   Is N zero?
+//
+{    .mfi
+(p7) add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.eq.or     p6,p0 = r33,r0
+}
+{    .mfi
+     mov           GR_pos_ov_limit = 0x1007f // Exponent for positive overflow
+     nop.f         0
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+}
+;;
+
+//
+//   Create 2**N for N big
+//   Return x when N = 0 or X = Nan, Inf, Zero
+//
+{    .mfi
+(p7) setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+     mov           GR_min_den_exp = 0x0ff81 - 23 // Exponent of min denorm float
+}
+{    .mfb
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X
+(p6) fma.s.s0      FR_Result = FR_Floating_X, f1, f0
+(p6) br.ret.spnt   b0
+}
+;;
+
+//
+//   Raise Denormal operand flag with compare
+//   Compute biased result exponent
+//
+{    .mfi
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
+     mov           GR_neg_ov_limit = 0x3007f // Exponent for negative overflow
+}
+;;
+
+//
+//   Do final operation
+//
+{    .mfi
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fma.s.s0      FR_Result = FR_Two_N,FR_Norm_X,f0
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
+}
+{    .mfb
+     nop.m         0
+     nop.f         0
+(p9) br.cond.spnt  SCALBNF_UNDERFLOW           // Branch if certain underflow
+}
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  SCALBNF_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  SCALBNF_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  SCALBNF_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
+
+// Here if possible underflow.
+// Resulting exponent: 0x0ff81-23 <= exp_Result < 0x0ff81
+SCALBNF_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x1007e = exp_Result
+SCALBNF_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
+//
+//   S0 user supplied status
+//   S2 user supplied status + WRE + TD  (Overflows)
+//   S3 user supplied status + FZ + TD   (Underflows)
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x41
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
+
+//
+//   Do final operation with s2 and s3
+//
+{    .mfi
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.s.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+{    .mfi
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.s.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
+
+//   Check for overflow or underflow.
+//   Restore s3
+//   Restore s2
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
+
+//
+//   Is the result zero?
+//
+{    .mfi
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
+
+//
+//   Detect masked underflow - Tiny + Inexact Only
+//
+{    .mfi
+     nop.m         0
+(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
+     nop.i         0
+}
+;;
+
+//
+//   Is result bigger the allowed range?
+//   Branch out for underflow
+//
+{    .mfb
+     nop.m          0
+(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
+(p6) br.cond.spnt   SCALBNF_UNDERFLOW
+}
+;;
+
+//
+//   Branch out for overflow
+//
+{ .bbb
+(p7) br.cond.spnt   SCALBNF_OVERFLOW
+(p9) br.cond.spnt   SCALBNF_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
+
+// Here if result overflows
+SCALBNF_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 178, r0    // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
+}
+;;
+
+// Here if result underflows
+SCALBNF_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 179, r0    // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
+
+// Here if x=unorm
+SCALBNF_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  SCALBNF_COMMON            // Return to main path
+}
+;;
+
+
+GLOBAL_LIBM_END(__libm_scalbnf)
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+//
+// Get stack address of N
+//
+.prologue
+{ .mfi
+    add   GR_Parameter_Y=-32,sp
+    nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+    mov  GR_SAVE_PFS=ar.pfs
+}
+//
+// Adjust sp
+//
+{ .mfi
+.fframe 64
+   add sp=-64,sp
+   nop.f 0
+   mov GR_SAVE_GP=gp
+};;
+
+//
+//  Store N on stack in correct position
+//  Locate the address of x on stack
+//
+{ .mmi
+   st8 [GR_Parameter_Y] =  GR_N_as_int,16
+   add GR_Parameter_X = 16,sp
+.save   b0, GR_SAVE_B0
+   mov GR_SAVE_B0=b0
+};;
+
+//
+// Store x on the stack.
+// Get address for result on stack.
+//
+.body
+{ .mib
+   stfs [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+   nop.b 0
+}
+{ .mib
+   stfs [GR_Parameter_Y] = FR_Result
+   add   GR_Parameter_Y = -16,GR_Parameter_Y
+   br.call.sptk b0=__libm_error_support#
+};;
+
+//
+//  Get location of result on stack
+//
+{ .mmi
+   add   GR_Parameter_RESULT = 48,sp
+   nop.m 0
+   nop.i 0
+};;
+
+//
+//  Get the new result
+//
+{ .mmi
+   ldfs  FR_Result = [GR_Parameter_RESULT]
+.restore sp
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
+};;
+
+//
+//  Restore gp, ar.pfs and return
+//
+{ .mib
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_libm_scalbnl.S b/sysdeps/ia64/fpu/s_libm_scalbnl.S
new file mode 100644
index 0000000000..1edf9a05d3
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_libm_scalbnl.S
@@ -0,0 +1,452 @@
+.file "libm_scalbnl.s"
+
+
+// Copyright (c) 2000 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version
+// 01/26/01 Scalbnl completely reworked and now standalone version
+// 01/04/02 Added handling for int 32 or 64 bits
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 08/04/03 Improved performance
+//
+// API
+//==============================================================
+// long double __libm_scalbnl  (long double x, int n, int int_type)
+// input  floating point f8 and int n (r34), int int_type (r35)
+// output floating point f8
+//
+// int_type = 0 if int is 32 bits
+// int_type = 1 if int is 64 bits
+//
+// Returns x* 2**n using an fma and detects overflow
+// and underflow.
+//
+//
+// Strategy:
+//  Compute biased exponent of result exp_Result = N + exp_X
+//  Break into ranges:
+//   exp_Result > 0x13ffe                 -> Certain overflow
+//   exp_Result = 0x13ffe                 -> Possible overflow
+//   0x0c001 <= exp_Result < 0x13ffe      -> No over/underflow (main path)
+//   0x0c001 - 63 <= exp_Result < 0x0c001 -> Possible underflow
+//   exp_Result < 0x0c001 - 63            -> Certain underflow
+
+FR_Big         = f6
+FR_NBig        = f7
+FR_Floating_X  = f8
+FR_Result      = f8
+FR_Result2     = f9
+FR_Result3     = f10
+FR_Norm_X      = f11
+FR_Two_N       = f12
+
+GR_neg_ov_limit= r14
+GR_N_Biased    = r15
+GR_Big         = r16
+GR_NBig        = r17
+GR_exp_Result  = r18
+GR_pos_ov_limit= r19
+GR_Bias        = r20
+GR_N_as_int    = r21
+GR_signexp_X   = r22
+GR_exp_X       = r23
+GR_exp_mask    = r24
+GR_max_exp     = r25
+GR_min_exp     = r26
+GR_min_den_exp = r27
+
+GR_SAVE_B0          = r32
+GR_SAVE_GP          = r33
+GR_SAVE_PFS         = r34
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Tag              = r38
+
+.section .text
+GLOBAL_LIBM_ENTRY(__libm_scalbnl)
+
+//
+//   Is x NAN, INF, ZERO, +-?
+//   Build the exponent Bias
+//
+{    .mfi
+     getf.exp      GR_signexp_X = FR_Floating_X // Get signexp of x
+     fclass.m      p6,p0 = FR_Floating_X, 0xe7  // @snan | @qnan | @inf | @zero
+     mov           GR_Bias = 0x0ffff
+}
+//
+//   Normalize x
+//   Is integer type 32 bits?
+//
+{    .mfi
+     mov           GR_Big = 35000      // If N this big then certain overflow
+     fnorm.s1      FR_Norm_X = FR_Floating_X
+     cmp.eq        p8,p9 = r35,r0
+}
+;;
+
+//   Sign extend N if int is 32 bits
+{    .mfi
+(p9) mov           GR_N_as_int = r34     // Copy N if int is 64 bits
+     fclass.m      p9,p0 = FR_Floating_X, 0x0b // Test for x=unorm
+(p8) sxt4          GR_N_as_int = r34     // Sign extend N if int is 32 bits
+}
+{ .mfi
+     mov           GR_NBig = -35000    // If N this small then certain underflow
+     nop.f         0
+     mov           GR_max_exp = 0x13ffe      // Exponent of maximum long double
+}
+;;
+
+//   Create biased exponent for 2**N
+{    .mfi
+     add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.ge        p7, p0 = GR_N_as_int, GR_Big  // Certain overflow?
+}
+{    .mib
+     cmp.le        p8, p0 = GR_N_as_int, GR_NBig // Certain underflow?
+     mov           GR_min_exp = 0x0c001      // Exponent of minimum long double
+(p9) br.cond.spnt  SCALBNL_UNORM              // Branch if x=unorm
+}
+;;
+
+SCALBNL_COMMON:
+// Main path continues.  Also return here from x=unorm path.
+//   Create 2**N
+.pred.rel "mutex",p7,p8
+{    .mfi
+     setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+(p7) mov           GR_N_as_int = GR_Big      // Limit max N
+}
+{    .mfi
+(p8) mov           GR_N_as_int = GR_NBig     // Limit min N
+     nop.f         0
+(p8) cmp.eq        p7,p0 = r0,r0             // Set p7 if |N| big
+}
+;;
+
+//
+//   Create biased exponent for 2**N for N big
+//   Is N zero?
+//
+{    .mfi
+(p7) add           GR_N_Biased = GR_Bias,GR_N_as_int
+     nop.f         0
+     cmp.eq.or     p6,p0 = r34,r0
+}
+{    .mfi
+     mov           GR_pos_ov_limit = 0x13fff // Exponent for positive overflow
+     nop.f         0
+     mov           GR_exp_mask = 0x1ffff     // Exponent mask
+}
+;;
+
+//
+//   Create 2**N for N big
+//   Return x when N = 0 or X = Nan, Inf, Zero
+//
+{    .mfi
+(p7) setf.exp      FR_Two_N = GR_N_Biased
+     nop.f         0
+     mov           GR_min_den_exp = 0x0c001 - 63 // Exp of min denorm long dble
+}
+{    .mfb
+     and           GR_exp_X = GR_exp_mask, GR_signexp_X
+(p6) fma.s0        FR_Result = FR_Floating_X, f1, f0
+(p6) br.ret.spnt   b0
+}
+;;
+
+//
+//   Raise Denormal operand flag with compare
+//   Compute biased result exponent
+//
+{    .mfi
+     add           GR_exp_Result = GR_exp_X, GR_N_as_int
+     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
+     mov           GR_neg_ov_limit = 0x33fff // Exponent for negative overflow
+}
+;;
+
+//
+//   Do final operation
+//
+{    .mfi
+     cmp.lt        p7,p6 = GR_exp_Result, GR_max_exp  // Test no overflow
+     fma.s0        FR_Result = FR_Two_N,FR_Norm_X,f0
+     cmp.lt        p9,p0 = GR_exp_Result, GR_min_den_exp // Test sure underflow
+}
+{    .mfb
+     nop.m         0
+     nop.f         0
+(p9) br.cond.spnt  SCALBNL_UNDERFLOW           // Branch if certain underflow
+}
+;;
+
+{    .mib
+(p6) cmp.gt.unc    p6,p8 = GR_exp_Result, GR_max_exp  // Test sure overflow
+(p7) cmp.ge.unc    p7,p9 = GR_exp_Result, GR_min_exp  // Test no over/underflow
+(p7) br.ret.sptk   b0                         // Return from main path
+}
+;;
+
+{    .bbb
+(p6) br.cond.spnt  SCALBNL_OVERFLOW            // Branch if certain overflow
+(p8) br.cond.spnt  SCALBNL_POSSIBLE_OVERFLOW   // Branch if possible overflow
+(p9) br.cond.spnt  SCALBNL_POSSIBLE_UNDERFLOW  // Branch if possible underflow
+}
+;;
+
+// Here if possible underflow.
+// Resulting exponent: 0x0c001-63 <= exp_Result < 0x0c001
+SCALBNL_POSSIBLE_UNDERFLOW:
+//
+// Here if possible overflow.
+// Resulting exponent: 0x13ffe = exp_Result
+SCALBNL_POSSIBLE_OVERFLOW:
+
+//   Set up necessary status fields
+//
+//   S0 user supplied status
+//   S2 user supplied status + WRE + TD  (Overflows)
+//   S3 user supplied status + FZ + TD   (Underflows)
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x41
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x42
+     nop.i         0
+}
+;;
+
+//
+//   Do final operation with s2 and s3
+//
+{    .mfi
+     setf.exp      FR_NBig = GR_neg_ov_limit
+     fma.s3        FR_Result3 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+{    .mfi
+     setf.exp      FR_Big = GR_pos_ov_limit
+     fma.s2        FR_Result2 = FR_Two_N,FR_Norm_X,f0
+     nop.i         0
+}
+;;
+
+//   Check for overflow or underflow.
+//   Restore s3
+//   Restore s2
+//
+{    .mfi
+     nop.m         0
+     fsetc.s3      0x7F,0x40
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fsetc.s2      0x7F,0x40
+     nop.i         0
+}
+;;
+
+//
+//   Is the result zero?
+//
+{    .mfi
+     nop.m         0
+     fclass.m      p6, p0 =  FR_Result3, 0x007
+     nop.i         0
+}
+{    .mfi
+     nop.m         0
+     fcmp.ge.s1    p7, p8 = FR_Result2 , FR_Big
+     nop.i         0
+}
+;;
+
+//
+//   Detect masked underflow - Tiny + Inexact Only
+//
+{    .mfi
+     nop.m         0
+(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
+     nop.i         0
+}
+;;
+
+//
+//   Is result bigger the allowed range?
+//   Branch out for underflow
+//
+{    .mfb
+     nop.m          0
+(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
+(p6) br.cond.spnt   SCALBNL_UNDERFLOW
+}
+;;
+
+//
+//   Branch out for overflow
+//
+{ .bbb
+(p7) br.cond.spnt   SCALBNL_OVERFLOW
+(p9) br.cond.spnt   SCALBNL_OVERFLOW
+     br.ret.sptk    b0             //   Return from main path.
+}
+;;
+
+// Here if result overflows
+SCALBNL_OVERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 174, r0    // Set error tag for overflow
+     br.cond.sptk  __libm_error_region // Call error support for overflow
+}
+;;
+
+// Here if result underflows
+SCALBNL_UNDERFLOW:
+{ .mib
+     alloc         r32=ar.pfs,3,0,4,0
+     addl          GR_Tag = 175, r0    // Set error tag for underflow
+     br.cond.sptk  __libm_error_region // Call error support for underflow
+}
+;;
+
+// Here if x=unorm
+SCALBNL_UNORM:
+{ .mib
+     getf.exp      GR_signexp_X = FR_Norm_X // Get signexp of normalized x
+     nop.i         0
+     br.cond.sptk  SCALBNL_COMMON            // Return to main path
+}
+;;
+
+
+GLOBAL_LIBM_END(__libm_scalbnl)
+LOCAL_LIBM_ENTRY(__libm_error_region)
+
+//
+// Get stack address of N
+//
+.prologue
+{ .mfi
+    add   GR_Parameter_Y=-32,sp
+    nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+    mov  GR_SAVE_PFS=ar.pfs
+}
+//
+// Adjust sp
+//
+{ .mfi
+.fframe 64
+   add sp=-64,sp
+   nop.f 0
+   mov GR_SAVE_GP=gp
+};;
+
+//
+//  Store N on stack in correct position
+//  Locate the address of x on stack
+//
+{ .mmi
+   st8 [GR_Parameter_Y] =  GR_N_as_int,16
+   add GR_Parameter_X = 16,sp
+.save   b0, GR_SAVE_B0
+   mov GR_SAVE_B0=b0
+};;
+
+//
+// Store x on the stack.
+// Get address for result on stack.
+//
+.body
+{ .mib
+   stfe [GR_Parameter_X] = FR_Norm_X
+   add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+   nop.b 0
+}
+{ .mib
+   stfe [GR_Parameter_Y] = FR_Result
+   add   GR_Parameter_Y = -16,GR_Parameter_Y
+   br.call.sptk b0=__libm_error_support#
+};;
+
+//
+//  Get location of result on stack
+//
+{ .mmi
+   add   GR_Parameter_RESULT = 48,sp
+   nop.m 0
+   nop.i 0
+};;
+
+//
+//  Get the new result
+//
+{ .mmi
+   ldfe  FR_Result = [GR_Parameter_RESULT]
+.restore sp
+   add   sp = 64,sp
+   mov   b0 = GR_SAVE_B0
+};;
+
+//
+//  Restore gp, ar.pfs and return
+//
+{ .mib
+   mov   gp = GR_SAVE_GP
+   mov   ar.pfs = GR_SAVE_PFS
+   br.ret.sptk     b0
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_log1p.S b/sysdeps/ia64/fpu/s_log1p.S
index 0d96c14a55..e1e6dcc80b 100644
--- a/sysdeps/ia64/fpu/s_log1p.S
+++ b/sysdeps/ia64/fpu/s_log1p.S
@@ -1,10 +1,10 @@
-.file "log1p.s" 
+.file "log1p.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1608 +20,1084 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 06/29/01 Improved speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 10/02/02 Improved performance by basing on log algorithm
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/18/03 Eliminate possible WAW dependency warning
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// double log1p(double)
 //
-// *********************************************************************
-//
-// Function:   log1p(x) = ln(x+1), for double precision x values
-//
-// *********************************************************************
-//
-// Accuracy:   Very accurate for double precision values
-//
-// *********************************************************************
-//
-// Resources Used:
-//
-//    Floating-Point Registers: f8 (Input and Return Value)
-//                              f9,f33-f55,f99 
-//
-//    General Purpose Registers:
-//      r32-r53
-//      r54-r57 (Used to pass arguments to error handling routine)
-//
-//    Predicate Registers:      p6-p15
-//
-// *********************************************************************
-//
-// IEEE Special Conditions:
-//
-//    Denormal  fault raised on denormal inputs
-//    Overflow exceptions cannot occur  
-//    Underflow exceptions raised when appropriate for log1p 
-//    (Error Handling Routine called for underflow)
-//    Inexact raised when appropriate by algorithm
-//
-//    log1p(inf) = inf
-//    log1p(-inf) = QNaN 
-//    log1p(+/-0) = +/-0 
-//    log1p(-1) =  -inf 
-//    log1p(SNaN) = QNaN
-//    log1p(QNaN) = QNaN
-//    log1p(EM_special Values) = QNaN
-//
-// *********************************************************************
-//
-// Computation is based on the following kernel.
-//
-// ker_log_64( in_FR    :  X,
-// 	    in_FR    :  E,
-// 	    in_FR    :  Em1,
-// 	    in_GR    :  Expo_Range,
-// 	    out_FR   :  Y_hi,
-// 	    out_FR   :  Y_lo,
-// 	    out_FR   :  Scale,
-// 	    out_PR   :  Safe  )
-// 
-// Overview
-//
-// The method consists of three cases.
-//
-// If	|X+Em1| < 2^(-80)	use case log1p_small;
-// elseif	|X+Em1| < 2^(-7)	use case log_near1;
-// else				use case log_regular;
-//
-// Case log1p_small:
-//
-// log( 1 + (X+Em1) ) can be approximated by (X+Em1).
-//
-// Case log_near1:
-//
-//   log( 1 + (X+Em1) ) can be approximated by a simple polynomial
-//   in W = X+Em1. This polynomial resembles the truncated Taylor
-//   series W - W^/2 + W^3/3 - ...
-// 
-// Case log_regular:
-//
-//   Here we use a table lookup method. The basic idea is that in
-//   order to compute log(Arg) for an argument Arg in [1,2), we 
-//   construct a value G such that G*Arg is close to 1 and that
-//   log(1/G) is obtainable easily from a table of values calculated
-//   beforehand. Thus
-//
-//	log(Arg) = log(1/G) + log(G*Arg)
-//		 = log(1/G) + log(1 + (G*Arg - 1))
-//
-//   Because |G*Arg - 1| is small, the second term on the right hand
-//   side can be approximated by a short polynomial. We elaborate
-//   this method in four steps.
-//
-//   Step 0: Initialization
-//
-//   We need to calculate log( E + X ). Obtain N, S_hi, S_lo such that
-//
-//	E + X = 2^N * ( S_hi + S_lo )	exactly
-//
-//   where S_hi in [1,2) and S_lo is a correction to S_hi in the sense
-//   that |S_lo| <= ulp(S_hi).
-//
-//   Step 1: Argument Reduction
-//
-//   Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
-//
-//	G := G_1 * G_2 * G_3
-//	r := (G * S_hi - 1)  + G * S_lo
-//
-//   These G_j's have the property that the product is exactly 
-//   representable and that |r| < 2^(-12) as a result.
-//
-//   Step 2: Approximation
-//
-//
-//   log(1 + r) is approximated by a short polynomial poly(r).
-//
-//   Step 3: Reconstruction
-//
-//
-//   Finally, log( E + X ) is given by
-//
-//   log( E + X )   =   log( 2^N * (S_hi + S_lo) )
-//                 ~=~  N*log(2) + log(1/G) + log(1 + r)
-//                 ~=~  N*log(2) + log(1/G) + poly(r).
-//
-// **** Algorithm ****
-//
-// Case log1p_small:
-//
-// Although log(1 + (X+Em1)) is basically X+Em1, we would like to 
-// preserve the inexactness nature as well as consistent behavior
-// under different rounding modes. Note that this case can only be
-// taken if E is set to be 1.0. In this case, Em1 is zero, and that
-// X can be very tiny and thus the final result can possibly underflow.
-// Thus, we compare X against a threshold that is dependent on the
-// input Expo_Range. If |X| is smaller than this threshold, we set
-// SAFE to be FALSE. 
-//
-// The result is returned as Y_hi, Y_lo, and in the case of SAFE 
-// is FALSE, an additional value Scale is also returned. 
-//
-//	W    := X + Em1
-//      Threshold := Threshold_Table( Expo_Range )
-//      Tiny      := Tiny_Table( Expo_Range )
-//
-//      If ( |W| > Threshold ) then
-//         Y_hi  := W
-//         Y_lo  := -W*W
-//      Else
-//         Y_hi  := W
-//         Y_lo  := -Tiny
-//         Scale := 2^(-100)
-//         Safe  := FALSE
-//      EndIf
-//
-//
-// One may think that Y_lo should be -W*W/2; however, it does not matter
-// as Y_lo will be rounded off completely except for the correct effect in 
-// directed rounding. Clearly -W*W is simplier to compute. Moreover,
-// because of the difference in exponent value, Y_hi + Y_lo or 
-// Y_hi + Scale*Y_lo is always inexact.
-//
-// Case log_near1:
-//
-// Here we compute a simple polynomial. To exploit parallelism, we split
-// the polynomial into two portions.
-// 
-// 	W := X + Em1
-// 	Wsq := W * W
-// 	W4  := Wsq*Wsq
-// 	W6  := W4*Wsq
-// 	Y_hi := W + Wsq*(P_1 + W*(P_2 + W*(P_3 + W*P_4))
-// 	Y_lo := W6*(P_5 + W*(P_6 + W*(P_7 + W*P_8)))
-//      set lsb(Y_lo) to be 1
-//
-// Case log_regular:
-//
-// We present the algorithm in four steps.
-//
-//   Step 0. Initialization
-//   ----------------------
-//
-//   Z := X + E
-//   N := unbaised exponent of Z
-//   S_hi := 2^(-N) * Z
-//   S_lo := 2^(-N) * { (max(X,E)-Z) + min(X,E) }
-//
-//   Note that S_lo is always 0 for the case E = 0.
-//
-//   Step 1. Argument Reduction
-//   --------------------------
-//
-//   Let
-//
-//	Z = 2^N * S_hi = 2^N * 1.d_1 d_2 d_3 ... d_63
-//
-//   We obtain G_1, G_2, G_3 by the following steps.
-//
-//
-//	Define		X_0 := 1.d_1 d_2 ... d_14. This is extracted
-//			from S_hi.
+// log1p(x) = log(x+1)
 //
-//	Define		A_1 := 1.d_1 d_2 d_3 d_4. This is X_0 truncated
-//			to lsb = 2^(-4).
+// Overview of operation
+//==============================================================
+// Background
+// ----------
 //
-//	Define		index_1 := [ d_1 d_2 d_3 d_4 ].
+// This algorithm is based on fact that
+// log1p(x) = log(1+x) and
+// log(a b) = log(a) + log(b).
+// In our case we have 1+x = 2^N f, where 1 <= f < 2.
+// So
+//   log(1+x) = log(2^N f) = log(2^N) + log(f) = n*log(2) + log(f)
 //
-//	Fetch 		Z_1 := (1/A_1) rounded UP in fixed point with
-//	fixed point	lsb = 2^(-15).
-//			Z_1 looks like z_0.z_1 z_2 ... z_15
-//		        Note that the fetching is done using index_1.
-//			A_1 is actually not needed in the implementation
-//			and is used here only to explain how is the value
-//			Z_1 defined.
+// To calculate log(f) we do following
+//   log(f) = log(f * frcpa(f) / frcpa(f)) =
+//          = log(f * frcpa(f)) + log(1/frcpa(f))
 //
-//	Fetch		G_1 := (1/A_1) truncated to 21 sig. bits.
-//	floating pt.	Again, fetching is done using index_1. A_1
-//			explains how G_1 is defined.
+// According to definition of IA-64's frcpa instruction it's a
+// floating point that approximates 1/f using a lookup on the
+// top of 8 bits of the input number's + 1 significand with relative
+// error < 2^(-8.886). So we have following
 //
-//	Calculate	X_1 := X_0 * Z_1 truncated to lsb = 2^(-14)
-//			     = 1.0 0 0 0 d_5 ... d_14
-//			This is accomplised by integer multiplication.
-//			It is proved that X_1 indeed always begin
-//			with 1.0000 in fixed point.
+// |(1/f - frcpa(f)) / (1/f))| = |1 - f*frcpa(f)| < 1/256
 //
+// and
 //
-//	Define		A_2 := 1.0 0 0 0 d_5 d_6 d_7 d_8. This is X_1 
-//			truncated to lsb = 2^(-8). Similar to A_1,
-//			A_2 is not needed in actual implementation. It
-//			helps explain how some of the values are defined.
+// log(f) = log(f * frcpa(f)) + log(1/frcpa(f)) =
+//        = log(1 + r) + T
 //
-//	Define		index_2 := [ d_5 d_6 d_7 d_8 ].
+// The first value can be computed by polynomial P(r) approximating
+// log(1 + r) on |r| < 1/256 and the second is precomputed tabular
+// value defined by top 8 bit of f.
 //
-//	Fetch 		Z_2 := (1/A_2) rounded UP in fixed point with
-//	fixed point	lsb = 2^(-15). Fetch done using index_2.
-//			Z_2 looks like z_0.z_1 z_2 ... z_15
+// Finally we have that  log(1+x) ~ (N*log(2) + T) + P(r)
 //
-//	Fetch		G_2 := (1/A_2) truncated to 21 sig. bits.
-//	floating pt.
+// Note that if input argument is close to 0.0 (in our case it means
+// that |x| < 1/256) we can use just polynomial approximation
+// because 1+x = 2^0 * f = f = 1 + r and
+// log(1+x) = log(1 + r) ~ P(r)
 //
-//	Calculate	X_2 := X_1 * Z_2 truncated to lsb = 2^(-14)
-//			     = 1.0 0 0 0 0 0 0 0 d_9 d_10 ... d_14
-//			This is accomplised by integer multiplication.
-//			It is proved that X_2 indeed always begin
-//			with 1.00000000 in fixed point.
 //
+// Implementation
+// --------------
 //
-//	Define		A_3 := 1.0 0 0 0 0 0 0 0 d_9 d_10 d_11 d_12 d_13 1.
-//			This is 2^(-14) + X_2 truncated to lsb = 2^(-13).
+// 1. |x| >= 2^(-8), and x > -1
+//   InvX = frcpa(x+1)
+//   r = InvX*(x+1) - 1
+//   P(r) = r*((r*A3 - A2) + r^4*((A4 + r*A5) + r^2*(A6 + r*A7)),
+//   all coefficients are calcutated in quad and rounded to double
+//   precision. A7,A6,A5,A4 are stored in memory whereas A3 and A2
+//   created with setf.
 //
-//	Define		index_3 := [ d_9 d_10 d_11 d_12 d_13 ].
+//   N = float(n) where n is true unbiased exponent of x
 //
-//	Fetch		G_3 := (1/A_3) truncated to 21 sig. bits.
-//	floating pt.	Fetch is done using index_3.
+//   T is tabular value of log(1/frcpa(x)) calculated in quad precision
+//   and represented by two floating-point numbers 64-bit Thi and 32-bit Tlo.
+//   To load Thi,Tlo we get bits from 55 to 62 of register format significand
+//   as index and calculate two addresses
+//     ad_Thi = Thi_table_base_addr + 8 * index
+//     ad_Tlo = Tlo_table_base_addr + 4 * index
 //
-//	Compute		G := G_1 * G_2 * G_3. 
+//   L1 (log(2)) is calculated in quad
+//   precision and represented by two floating-point 64-bit numbers L1hi,L1lo
+//   stored in memory.
 //
-//	This is done exactly since each of G_j only has 21 sig. bits.
+//   And final result = ((L1hi*N + Thi) + (N*L1lo + Tlo)) + P(r)
 //
-//	Compute   
 //
-//		r := (G*S_hi - 1) + G*S_lo   using 2 FMA operations.
+// 2. 2^(-80) <= |x| < 2^(-8)
+//   r = x
+//   P(r) = r*((r*A3 - A2) + r^4*((A4 + r*A5) + r^2*(A6 + r*A7)),
+//   A7,A6,A5,A4,A3,A2 are the same as in case |x| >= 1/256
 //
-//	thus, r approximates G*(S_hi+S_lo) - 1 to within a couple of 
-//	rounding errors.
+//   And final results
+//     log(1+x)   = P(r)
 //
+// 3. 0 < |x| < 2^(-80)
+//   Although log1p(x) is basically x, we would like to preserve the inexactness
+//   nature as well as consistent behavior under different rounding modes.
+//   We can do this by computing the result as
 //
-//  Step 2. Approximation
-//  ---------------------
+//     log1p(x) = x - x*x
 //
-//   This step computes an approximation to log( 1 + r ) where r is the
-//   reduced argument just obtained. It is proved that |r| <= 1.9*2^(-13);
-//   thus log(1+r) can be approximated by a short polynomial:
 //
-//	log(1+r) ~=~ poly = r + Q1 r^2 + ... + Q4 r^5
+//    Note: NaT, any NaNs, +/-INF, +/-0, negatives and unnormalized numbers are
+//          filtered and processed on special branches.
 //
+
 //
-//  Step 3. Reconstruction
-//  ----------------------
+// Special values
+//==============================================================
 //
-//   This step computes the desired result of log(X+E):
+// log1p(-1)    = -inf            // Call error support
 //
-//	log(X+E)  =   log( 2^N * (S_hi + S_lo) )
-//		  =   N*log(2) + log( S_hi + S_lo )
-//		  =   N*log(2) + log(1/G) +
-//		      log(1 + C*(S_hi+S_lo) - 1 )
+// log1p(+qnan) = +qnan
+// log1p(-qnan) = -qnan
+// log1p(+snan) = +qnan
+// log1p(-snan) = -qnan
 //
-//   log(2), log(1/G_j) are stored as pairs of (single,double) numbers:
-//   log2_hi, log2_lo, log1byGj_hi, log1byGj_lo. The high parts are
-//   single-precision numbers and the low parts are double precision
-//   numbers. These have the property that
+// log1p(x),x<-1= QNAN Indefinite // Call error support
+// log1p(-inf)  = QNAN Indefinite
+// log1p(+inf)  = +inf
+// log1p(+/-0)  = +/-0
 //
-//	N*log2_hi + SUM ( log1byGj_hi )
 //
-//   is computable exactly in double-extended precision (64 sig. bits).
-//   Finally
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f7 -> f15,  f32 -> f40
 //
-//	Y_hi := N*log2_hi + SUM ( log1byGj_hi )
-//	Y_lo := poly_hi + [ poly_lo + 
-//	        ( SUM ( log1byGj_lo ) + N*log2_lo ) ]
-//      set lsb(Y_lo) to be 1
+// General registers used:
+// r8  -> r11
+// r14 -> r20
 //
+// Predicate registers used:
+// p6 -> p12
 
-#include "libm_support.h"
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// Assembly macros
+//==============================================================
+GR_TAG                 = r8
+GR_ad_1                = r8
+GR_ad_2                = r9
+GR_Exp                 = r10
+GR_N                   = r11
 
-// P_7, P_6, P_5, P_4, P_3, P_2, and P_1 
+GR_signexp_x           = r14
+GR_exp_mask            = r15
+GR_exp_bias            = r16
+GR_05                  = r17
+GR_A3                  = r18
+GR_Sig                 = r19
+GR_Ind                 = r19
+GR_exp_x               = r20
 
-.align 64
-Constants_P:
-ASM_TYPE_DIRECTIVE(Constants_P,@object)
-data4  0xEFD62B15,0xE3936754,0x00003FFB,0x00000000
-data4  0xA5E56381,0x8003B271,0x0000BFFC,0x00000000
-data4  0x73282DB0,0x9249248C,0x00003FFC,0x00000000
-data4  0x47305052,0xAAAAAA9F,0x0000BFFC,0x00000000
-data4  0xCCD17FC9,0xCCCCCCCC,0x00003FFC,0x00000000
-data4  0x00067ED5,0x80000000,0x0000BFFD,0x00000000
-data4  0xAAAAAAAA,0xAAAAAAAA,0x00003FFD,0x00000000
-data4  0xFFFFFFFE,0xFFFFFFFF,0x0000BFFD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_P)
- 
-// log2_hi, log2_lo, Q_4, Q_3, Q_2, and Q_1 
 
-.align 64
-Constants_Q:
-ASM_TYPE_DIRECTIVE(Constants_Q,@object)
-data4  0x00000000,0xB1721800,0x00003FFE,0x00000000 
-data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
-data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000
-data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000
-data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000
-data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_Q)
- 
-// Z1 - 16 bit fixed, G1 and H1 - IEEE single 
- 
-.align 64
-Constants_Z_G_H_h1:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h1,@object)
-data4  0x00008000,0x3F800000,0x00000000,0x00000000,0x00000000,0x00000000
-data4  0x00007879,0x3F70F0F0,0x3D785196,0x00000000,0x617D741C,0x3DA163A6
-data4  0x000071C8,0x3F638E38,0x3DF13843,0x00000000,0xCBD3D5BB,0x3E2C55E6
-data4  0x00006BCB,0x3F579430,0x3E2FF9A0,0x00000000,0xD86EA5E7,0xBE3EB0BF
-data4  0x00006667,0x3F4CCCC8,0x3E647FD6,0x00000000,0x86B12760,0x3E2E6A8C
-data4  0x00006187,0x3F430C30,0x3E8B3AE7,0x00000000,0x5C0739BA,0x3E47574C
-data4  0x00005D18,0x3F3A2E88,0x3EA30C68,0x00000000,0x13E8AF2F,0x3E20E30F
-data4  0x0000590C,0x3F321640,0x3EB9CEC8,0x00000000,0xF2C630BD,0xBE42885B
-data4  0x00005556,0x3F2AAAA8,0x3ECF9927,0x00000000,0x97E577C6,0x3E497F34
-data4  0x000051EC,0x3F23D708,0x3EE47FC5,0x00000000,0xA6B0A5AB,0x3E3E6A6E
-data4  0x00004EC5,0x3F1D89D8,0x3EF8947D,0x00000000,0xD328D9BE,0xBDF43E3C
-data4  0x00004BDB,0x3F17B420,0x3F05F3A1,0x00000000,0x0ADB090A,0x3E4094C3
-data4  0x00004925,0x3F124920,0x3F0F4303,0x00000000,0xFC1FE510,0xBE28FBB2
-data4  0x0000469F,0x3F0D3DC8,0x3F183EBF,0x00000000,0x10FDE3FA,0x3E3A7895
-data4  0x00004445,0x3F088888,0x3F20EC80,0x00000000,0x7CC8C98F,0x3E508CE5
-data4  0x00004211,0x3F042108,0x3F29516A,0x00000000,0xA223106C,0xBE534874
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h1)
- 
-// Z2 - 16 bit fixed, G2 and H2 - IEEE single 
+GR_SAVE_B0             = r33
+GR_SAVE_PFS            = r34
+GR_SAVE_GP             = r35
+GR_SAVE_SP             = r36
 
-.align 64 
-Constants_Z_G_H_h2:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h2,@object)
-data4  0x00008000,0x3F800000,0x00000000,0x00000000,0x00000000,0x00000000
-data4  0x00007F81,0x3F7F00F8,0x3B7F875D,0x00000000,0x22C42273,0x3DB5A116
-data4  0x00007F02,0x3F7E03F8,0x3BFF015B,0x00000000,0x21F86ED3,0x3DE620CF
-data4  0x00007E85,0x3F7D08E0,0x3C3EE393,0x00000000,0x484F34ED,0xBDAFA07E
-data4  0x00007E08,0x3F7C0FC0,0x3C7E0586,0x00000000,0x3860BCF6,0xBDFE07F0
-data4  0x00007D8D,0x3F7B1880,0x3C9E75D2,0x00000000,0xA78093D6,0x3DEA370F
-data4  0x00007D12,0x3F7A2328,0x3CBDC97A,0x00000000,0x72A753D0,0x3DFF5791
-data4  0x00007C98,0x3F792FB0,0x3CDCFE47,0x00000000,0xA7EF896B,0x3DFEBE6C
-data4  0x00007C20,0x3F783E08,0x3CFC15D0,0x00000000,0x409ECB43,0x3E0CF156
-data4  0x00007BA8,0x3F774E38,0x3D0D874D,0x00000000,0xFFEF71DF,0xBE0B6F97
-data4  0x00007B31,0x3F766038,0x3D1CF49B,0x00000000,0x5D59EEE8,0xBE080483
-data4  0x00007ABB,0x3F757400,0x3D2C531D,0x00000000,0xA9192A74,0x3E1F91E9
-data4  0x00007A45,0x3F748988,0x3D3BA322,0x00000000,0xBF72A8CD,0xBE139A06
-data4  0x000079D1,0x3F73A0D0,0x3D4AE46F,0x00000000,0xF8FBA6CF,0x3E1D9202
-data4  0x0000795D,0x3F72B9D0,0x3D5A1756,0x00000000,0xBA796223,0xBE1DCCC4
-data4  0x000078EB,0x3F71D488,0x3D693B9D,0x00000000,0xB6B7C239,0xBE049391
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h2)
- 
-// G3 and H3 - IEEE single and h3 -IEEE double 
+GR_Parameter_X         = r37
+GR_Parameter_Y         = r38
+GR_Parameter_RESULT    = r39
+GR_Parameter_TAG       = r40
 
-.align 64 
-Constants_Z_G_H_h3:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h3,@object)
-data4  0x3F7FFC00,0x38800100,0x562224CD,0x3D355595
-data4  0x3F7FF400,0x39400480,0x06136FF6,0x3D8200A2
-data4  0x3F7FEC00,0x39A00640,0xE8DE9AF0,0x3DA4D68D
-data4  0x3F7FE400,0x39E00C41,0xB10238DC,0xBD8B4291
-data4  0x3F7FDC00,0x3A100A21,0x3B1952CA,0xBD89CCB8
-data4  0x3F7FD400,0x3A300F22,0x1DC46826,0xBDB10707
-data4  0x3F7FCC08,0x3A4FF51C,0xF43307DB,0x3DB6FCB9
-data4  0x3F7FC408,0x3A6FFC1D,0x62DC7872,0xBD9B7C47
-data4  0x3F7FBC10,0x3A87F20B,0x3F89154A,0xBDC3725E
-data4  0x3F7FB410,0x3A97F68B,0x62B9D392,0xBD93519D
-data4  0x3F7FAC18,0x3AA7EB86,0x0F21BD9D,0x3DC18441
-data4  0x3F7FA420,0x3AB7E101,0x2245E0A6,0xBDA64B95
-data4  0x3F7F9C20,0x3AC7E701,0xAABB34B8,0x3DB4B0EC
-data4  0x3F7F9428,0x3AD7DD7B,0x6DC40A7E,0x3D992337
-data4  0x3F7F8C30,0x3AE7D474,0x4F2083D3,0x3DC6E17B
-data4  0x3F7F8438,0x3AF7CBED,0x811D4394,0x3DAE314B
-data4  0x3F7F7C40,0x3B03E1F3,0xB08F2DB1,0xBDD46F21
-data4  0x3F7F7448,0x3B0BDE2F,0x6D34522B,0xBDDC30A4
-data4  0x3F7F6C50,0x3B13DAAA,0xB1F473DB,0x3DCB0070
-data4  0x3F7F6458,0x3B1BD766,0x6AD282FD,0xBDD65DDC
-data4  0x3F7F5C68,0x3B23CC5C,0xF153761A,0xBDCDAB83
-data4  0x3F7F5470,0x3B2BC997,0x341D0F8F,0xBDDADA40
-data4  0x3F7F4C78,0x3B33C711,0xEBC394E8,0x3DCD1BD7
-data4  0x3F7F4488,0x3B3BBCC6,0x52E3E695,0xBDC3532B
-data4  0x3F7F3C90,0x3B43BAC0,0xE846B3DE,0xBDA3961E
-data4  0x3F7F34A0,0x3B4BB0F4,0x785778D4,0xBDDADF06
-data4  0x3F7F2CA8,0x3B53AF6D,0xE55CE212,0x3DCC3ED1
-data4  0x3F7F24B8,0x3B5BA620,0x9E382C15,0xBDBA3103
-data4  0x3F7F1CC8,0x3B639D12,0x5C5AF197,0x3D635A0B
-data4  0x3F7F14D8,0x3B6B9444,0x71D34EFC,0xBDDCCB19
-data4  0x3F7F0CE0,0x3B7393BC,0x52CD7ADA,0x3DC74502
-data4  0x3F7F04F0,0x3B7B8B6D,0x7D7F2A42,0xBDB68F17
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h3)
- 
-// 
-//  Exponent Thresholds and Tiny Thresholds
-//  for 8, 11, 15, and 17 bit exponents
-// 
-//  Expo_Range             Value
-// 
-//  0 (8  bits)            2^(-126)
-//  1 (11 bits)            2^(-1022)
-//  2 (15 bits)            2^(-16382)
-//  3 (17 bits)            2^(-16382)
-// 
-//  Tiny_Table
-//  ----------
-//  Expo_Range             Value
-// 
-//  0 (8  bits)            2^(-16382)
-//  1 (11 bits)            2^(-16382)
-//  2 (15 bits)            2^(-16382)
-//  3 (17 bits)            2^(-16382)
-// 
 
-.align 64 
-Constants_Threshold:
-ASM_TYPE_DIRECTIVE(Constants_Threshold,@object)
-data4  0x00000000,0x80000000,0x00003F81,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00003C01,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_Threshold)
 
-.align 64
-Constants_1_by_LN10:
-ASM_TYPE_DIRECTIVE(Constants_1_by_LN10,@object)
-data4  0x37287195,0xDE5BD8A9,0x00003FFD,0x00000000
-data4  0xACCF70C8,0xD56EAABE,0x00003FBD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_1_by_LN10)
+FR_NormX               = f7
+FR_RcpX                = f9
+FR_r                   = f10
+FR_r2                  = f11
+FR_r4                  = f12
+FR_N                   = f13
+FR_Ln2hi               = f14
+FR_Ln2lo               = f15
 
-FR_Input_X = f8 
-FR_Neg_One = f9
-FR_E       = f33
-FR_Em1     = f34
-FR_Y_hi    = f34  
-// Shared with Em1
-FR_Y_lo    = f35
-FR_Scale   = f36
-FR_X_Prime = f37 
-FR_Z       = f38 
-FR_S_hi    = f38  
-// Shared with Z  
-FR_W       = f39
-FR_G       = f40
-FR_wsq     = f40 
-// Shared with G 
-FR_H       = f41
-FR_w4      = f41
-// Shared with H  
-FR_h       = f42
-FR_w6      = f42  
-// Shared with h     
-FR_G_tmp   = f43
-FR_poly_lo = f43
-// Shared with G_tmp 
-FR_P8      = f43  
-// Shared with G_tmp 
-FR_H_tmp   = f44
-FR_poly_hi = f44
-  // Shared with H_tmp
-FR_P7      = f44  
-// Shared with H_tmp
-FR_h_tmp   = f45 
-FR_rsq     = f45  
-// Shared with h_tmp
-FR_P6      = f45
-// Shared with h_tmp
-FR_abs_W   = f46
-FR_r       = f46  
-// Shared with abs_W  
-FR_AA      = f47 
-FR_log2_hi = f47  
-// Shared with AA  
-FR_BB          = f48
-FR_log2_lo     = f48  
-// Shared with BB  
-FR_S_lo        = f49 
-FR_two_negN    = f50  
-FR_float_N     = f51 
-FR_Q4          = f52 
-FR_dummy       = f52  
-// Shared with Q4
-FR_P4          = f52  
-// Shared with Q4
-FR_Threshold    = f52
-// Shared with Q4
-FR_Q3          = f53  
-FR_P3          = f53  
-// Shared with Q3
-FR_Tiny        = f53  
-// Shared with Q3
-FR_Q2          = f54 
-FR_P2          = f54  
-// Shared with Q2
-FR_1LN10_hi     = f54 
-// Shared with Q2
-FR_Q1           = f55 
-FR_P1           = f55 
-// Shared with Q1 
-FR_1LN10_lo     = f55 
-// Shared with Q1 
-FR_P5           = f98 
-FR_SCALE        = f98 
-FR_Output_X_tmp = f99 
+FR_A7                  = f32
+FR_A6                  = f33
+FR_A5                  = f34
+FR_A4                  = f35
+FR_A3                  = f36
+FR_A2                  = f37
 
-GR_Expo_Range   = r32
-GR_Table_Base   = r34
-GR_Table_Base1  = r35
-GR_Table_ptr    = r36 
-GR_Index2       = r37 
-GR_signif       = r38 
-GR_X_0          = r39 
-GR_X_1          = r40 
-GR_X_2          = r41 
-GR_Z_1          = r42 
-GR_Z_2          = r43 
-GR_N            = r44 
-GR_Bias         = r45 
-GR_M            = r46 
-GR_ScaleN       = r47  
-GR_Index3       = r48 
-GR_Perturb      = r49 
-GR_Table_Scale  = r50 
+FR_Thi                 = f38
+FR_NxLn2hipThi         = f38
+FR_NxLn2pT             = f38
+FR_Tlo                 = f39
+FR_NxLn2lopTlo         = f39
 
+FR_Xp1                 = f40
 
-GR_SAVE_PFS     = r51
-GR_SAVE_B0      = r52
-GR_SAVE_GP      = r53
 
-GR_Parameter_X       = r54
-GR_Parameter_Y       = r55
-GR_Parameter_RESULT  = r56
+FR_Y                   = f1
+FR_X                   = f10
+FR_RESULT              = f8
 
-GR_Parameter_TAG = r57 
 
+// Data
+//==============================================================
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(log_data)
+// coefficients of polynomial approximation
+data8 0x3FC2494104381A8E // A7
+data8 0xBFC5556D556BBB69 // A6
+data8 0x3FC999999988B5E9 // A5
+data8 0xBFCFFFFFFFF6FFF5 // A4
+//
+// hi parts of ln(1/frcpa(1+i/256)), i=0...255
+data8 0x3F60040155D5889D // 0
+data8 0x3F78121214586B54 // 1
+data8 0x3F841929F96832EF // 2
+data8 0x3F8C317384C75F06 // 3
+data8 0x3F91A6B91AC73386 // 4
+data8 0x3F95BA9A5D9AC039 // 5
+data8 0x3F99D2A8074325F3 // 6
+data8 0x3F9D6B2725979802 // 7
+data8 0x3FA0C58FA19DFAA9 // 8
+data8 0x3FA2954C78CBCE1A // 9
+data8 0x3FA4A94D2DA96C56 // 10
+data8 0x3FA67C94F2D4BB58 // 11
+data8 0x3FA85188B630F068 // 12
+data8 0x3FAA6B8ABE73AF4C // 13
+data8 0x3FAC441E06F72A9E // 14
+data8 0x3FAE1E6713606D06 // 15
+data8 0x3FAFFA6911AB9300 // 16
+data8 0x3FB0EC139C5DA600 // 17
+data8 0x3FB1DBD2643D190B // 18
+data8 0x3FB2CC7284FE5F1C // 19
+data8 0x3FB3BDF5A7D1EE64 // 20
+data8 0x3FB4B05D7AA012E0 // 21
+data8 0x3FB580DB7CEB5701 // 22
+data8 0x3FB674F089365A79 // 23
+data8 0x3FB769EF2C6B568D // 24
+data8 0x3FB85FD927506A47 // 25
+data8 0x3FB9335E5D594988 // 26
+data8 0x3FBA2B0220C8E5F4 // 27
+data8 0x3FBB0004AC1A86AB // 28
+data8 0x3FBBF968769FCA10 // 29
+data8 0x3FBCCFEDBFEE13A8 // 30
+data8 0x3FBDA727638446A2 // 31
+data8 0x3FBEA3257FE10F79 // 32
+data8 0x3FBF7BE9FEDBFDE5 // 33
+data8 0x3FC02AB352FF25F3 // 34
+data8 0x3FC097CE579D204C // 35
+data8 0x3FC1178E8227E47B // 36
+data8 0x3FC185747DBECF33 // 37
+data8 0x3FC1F3B925F25D41 // 38
+data8 0x3FC2625D1E6DDF56 // 39
+data8 0x3FC2D1610C868139 // 40
+data8 0x3FC340C59741142E // 41
+data8 0x3FC3B08B6757F2A9 // 42
+data8 0x3FC40DFB08378003 // 43
+data8 0x3FC47E74E8CA5F7C // 44
+data8 0x3FC4EF51F6466DE4 // 45
+data8 0x3FC56092E02BA516 // 46
+data8 0x3FC5D23857CD74D4 // 47
+data8 0x3FC6313A37335D76 // 48
+data8 0x3FC6A399DABBD383 // 49
+data8 0x3FC70337DD3CE41A // 50
+data8 0x3FC77654128F6127 // 51
+data8 0x3FC7E9D82A0B022D // 52
+data8 0x3FC84A6B759F512E // 53
+data8 0x3FC8AB47D5F5A30F // 54
+data8 0x3FC91FE49096581B // 55
+data8 0x3FC981634011AA75 // 56
+data8 0x3FC9F6C407089664 // 57
+data8 0x3FCA58E729348F43 // 58
+data8 0x3FCABB55C31693AC // 59
+data8 0x3FCB1E104919EFD0 // 60
+data8 0x3FCB94EE93E367CA // 61
+data8 0x3FCBF851C067555E // 62
+data8 0x3FCC5C0254BF23A5 // 63
+data8 0x3FCCC000C9DB3C52 // 64
+data8 0x3FCD244D99C85673 // 65
+data8 0x3FCD88E93FB2F450 // 66
+data8 0x3FCDEDD437EAEF00 // 67
+data8 0x3FCE530EFFE71012 // 68
+data8 0x3FCEB89A1648B971 // 69
+data8 0x3FCF1E75FADF9BDE // 70
+data8 0x3FCF84A32EAD7C35 // 71
+data8 0x3FCFEB2233EA07CD // 72
+data8 0x3FD028F9C7035C1C // 73
+data8 0x3FD05C8BE0D9635A // 74
+data8 0x3FD085EB8F8AE797 // 75
+data8 0x3FD0B9C8E32D1911 // 76
+data8 0x3FD0EDD060B78080 // 77
+data8 0x3FD122024CF0063F // 78
+data8 0x3FD14BE2927AECD4 // 79
+data8 0x3FD180618EF18ADF // 80
+data8 0x3FD1B50BBE2FC63B // 81
+data8 0x3FD1DF4CC7CF242D // 82
+data8 0x3FD214456D0EB8D4 // 83
+data8 0x3FD23EC5991EBA49 // 84
+data8 0x3FD2740D9F870AFB // 85
+data8 0x3FD29ECDABCDFA03 // 86
+data8 0x3FD2D46602ADCCEE // 87
+data8 0x3FD2FF66B04EA9D4 // 88
+data8 0x3FD335504B355A37 // 89
+data8 0x3FD360925EC44F5C // 90
+data8 0x3FD38BF1C3337E74 // 91
+data8 0x3FD3C25277333183 // 92
+data8 0x3FD3EDF463C1683E // 93
+data8 0x3FD419B423D5E8C7 // 94
+data8 0x3FD44591E0539F48 // 95
+data8 0x3FD47C9175B6F0AD // 96
+data8 0x3FD4A8B341552B09 // 97
+data8 0x3FD4D4F39089019F // 98
+data8 0x3FD501528DA1F967 // 99
+data8 0x3FD52DD06347D4F6 // 100
+data8 0x3FD55A6D3C7B8A89 // 101
+data8 0x3FD5925D2B112A59 // 102
+data8 0x3FD5BF406B543DB1 // 103
+data8 0x3FD5EC433D5C35AD // 104
+data8 0x3FD61965CDB02C1E // 105
+data8 0x3FD646A84935B2A1 // 106
+data8 0x3FD6740ADD31DE94 // 107
+data8 0x3FD6A18DB74A58C5 // 108
+data8 0x3FD6CF31058670EC // 109
+data8 0x3FD6F180E852F0B9 // 110
+data8 0x3FD71F5D71B894EF // 111
+data8 0x3FD74D5AEFD66D5C // 112
+data8 0x3FD77B79922BD37D // 113
+data8 0x3FD7A9B9889F19E2 // 114
+data8 0x3FD7D81B037EB6A6 // 115
+data8 0x3FD8069E33827230 // 116
+data8 0x3FD82996D3EF8BCA // 117
+data8 0x3FD85855776DCBFA // 118
+data8 0x3FD8873658327CCE // 119
+data8 0x3FD8AA75973AB8CE // 120
+data8 0x3FD8D992DC8824E4 // 121
+data8 0x3FD908D2EA7D9511 // 122
+data8 0x3FD92C59E79C0E56 // 123
+data8 0x3FD95BD750EE3ED2 // 124
+data8 0x3FD98B7811A3EE5B // 125
+data8 0x3FD9AF47F33D406B // 126
+data8 0x3FD9DF270C1914A7 // 127
+data8 0x3FDA0325ED14FDA4 // 128
+data8 0x3FDA33440224FA78 // 129
+data8 0x3FDA57725E80C382 // 130
+data8 0x3FDA87D0165DD199 // 131
+data8 0x3FDAAC2E6C03F895 // 132
+data8 0x3FDADCCC6FDF6A81 // 133
+data8 0x3FDB015B3EB1E790 // 134
+data8 0x3FDB323A3A635948 // 135
+data8 0x3FDB56FA04462909 // 136
+data8 0x3FDB881AA659BC93 // 137
+data8 0x3FDBAD0BEF3DB164 // 138
+data8 0x3FDBD21297781C2F // 139
+data8 0x3FDC039236F08818 // 140
+data8 0x3FDC28CB1E4D32FC // 141
+data8 0x3FDC4E19B84723C1 // 142
+data8 0x3FDC7FF9C74554C9 // 143
+data8 0x3FDCA57B64E9DB05 // 144
+data8 0x3FDCCB130A5CEBAF // 145
+data8 0x3FDCF0C0D18F326F // 146
+data8 0x3FDD232075B5A201 // 147
+data8 0x3FDD490246DEFA6B // 148
+data8 0x3FDD6EFA918D25CD // 149
+data8 0x3FDD9509707AE52F // 150
+data8 0x3FDDBB2EFE92C554 // 151
+data8 0x3FDDEE2F3445E4AE // 152
+data8 0x3FDE148A1A2726CD // 153
+data8 0x3FDE3AFC0A49FF3F // 154
+data8 0x3FDE6185206D516D // 155
+data8 0x3FDE882578823D51 // 156
+data8 0x3FDEAEDD2EAC990C // 157
+data8 0x3FDED5AC5F436BE2 // 158
+data8 0x3FDEFC9326D16AB8 // 159
+data8 0x3FDF2391A21575FF // 160
+data8 0x3FDF4AA7EE03192C // 161
+data8 0x3FDF71D627C30BB0 // 162
+data8 0x3FDF991C6CB3B379 // 163
+data8 0x3FDFC07ADA69A90F // 164
+data8 0x3FDFE7F18EB03D3E // 165
+data8 0x3FE007C053C5002E // 166
+data8 0x3FE01B942198A5A0 // 167
+data8 0x3FE02F74400C64EA // 168
+data8 0x3FE04360BE7603AC // 169
+data8 0x3FE05759AC47FE33 // 170
+data8 0x3FE06B5F1911CF51 // 171
+data8 0x3FE078BF0533C568 // 172
+data8 0x3FE08CD9687E7B0E // 173
+data8 0x3FE0A10074CF9019 // 174
+data8 0x3FE0B5343A234476 // 175
+data8 0x3FE0C974C89431CD // 176
+data8 0x3FE0DDC2305B9886 // 177
+data8 0x3FE0EB524BAFC918 // 178
+data8 0x3FE0FFB54213A475 // 179
+data8 0x3FE114253DA97D9F // 180
+data8 0x3FE128A24F1D9AFF // 181
+data8 0x3FE1365252BF0864 // 182
+data8 0x3FE14AE558B4A92D // 183
+data8 0x3FE15F85A19C765B // 184
+data8 0x3FE16D4D38C119FA // 185
+data8 0x3FE18203C20DD133 // 186
+data8 0x3FE196C7BC4B1F3A // 187
+data8 0x3FE1A4A738B7A33C // 188
+data8 0x3FE1B981C0C9653C // 189
+data8 0x3FE1CE69E8BB106A // 190
+data8 0x3FE1DC619DE06944 // 191
+data8 0x3FE1F160A2AD0DA3 // 192
+data8 0x3FE2066D7740737E // 193
+data8 0x3FE2147DBA47A393 // 194
+data8 0x3FE229A1BC5EBAC3 // 195
+data8 0x3FE237C1841A502E // 196
+data8 0x3FE24CFCE6F80D9A // 197
+data8 0x3FE25B2C55CD5762 // 198
+data8 0x3FE2707F4D5F7C40 // 199
+data8 0x3FE285E0842CA383 // 200
+data8 0x3FE294294708B773 // 201
+data8 0x3FE2A9A2670AFF0C // 202
+data8 0x3FE2B7FB2C8D1CC0 // 203
+data8 0x3FE2C65A6395F5F5 // 204
+data8 0x3FE2DBF557B0DF42 // 205
+data8 0x3FE2EA64C3F97654 // 206
+data8 0x3FE3001823684D73 // 207
+data8 0x3FE30E97E9A8B5CC // 208
+data8 0x3FE32463EBDD34E9 // 209
+data8 0x3FE332F4314AD795 // 210
+data8 0x3FE348D90E7464CF // 211
+data8 0x3FE35779F8C43D6D // 212
+data8 0x3FE36621961A6A99 // 213
+data8 0x3FE37C299F3C366A // 214
+data8 0x3FE38AE2171976E7 // 215
+data8 0x3FE399A157A603E7 // 216
+data8 0x3FE3AFCCFE77B9D1 // 217
+data8 0x3FE3BE9D503533B5 // 218
+data8 0x3FE3CD7480B4A8A2 // 219
+data8 0x3FE3E3C43918F76C // 220
+data8 0x3FE3F2ACB27ED6C6 // 221
+data8 0x3FE4019C2125CA93 // 222
+data8 0x3FE4181061389722 // 223
+data8 0x3FE42711518DF545 // 224
+data8 0x3FE436194E12B6BF // 225
+data8 0x3FE445285D68EA69 // 226
+data8 0x3FE45BCC464C893A // 227
+data8 0x3FE46AED21F117FC // 228
+data8 0x3FE47A1527E8A2D3 // 229
+data8 0x3FE489445EFFFCCB // 230
+data8 0x3FE4A018BCB69835 // 231
+data8 0x3FE4AF5A0C9D65D7 // 232
+data8 0x3FE4BEA2A5BDBE87 // 233
+data8 0x3FE4CDF28F10AC46 // 234
+data8 0x3FE4DD49CF994058 // 235
+data8 0x3FE4ECA86E64A683 // 236
+data8 0x3FE503C43CD8EB68 // 237
+data8 0x3FE513356667FC57 // 238
+data8 0x3FE522AE0738A3D7 // 239
+data8 0x3FE5322E26867857 // 240
+data8 0x3FE541B5CB979809 // 241
+data8 0x3FE55144FDBCBD62 // 242
+data8 0x3FE560DBC45153C6 // 243
+data8 0x3FE5707A26BB8C66 // 244
+data8 0x3FE587F60ED5B8FF // 245
+data8 0x3FE597A7977C8F31 // 246
+data8 0x3FE5A760D634BB8A // 247
+data8 0x3FE5B721D295F10E // 248
+data8 0x3FE5C6EA94431EF9 // 249
+data8 0x3FE5D6BB22EA86F5 // 250
+data8 0x3FE5E6938645D38F // 251
+data8 0x3FE5F673C61A2ED1 // 252
+data8 0x3FE6065BEA385926 // 253
+data8 0x3FE6164BFA7CC06B // 254
+data8 0x3FE62643FECF9742 // 255
+//
+// two parts of ln(2)
+data8 0x3FE62E42FEF00000,0x3DD473DE6AF278ED
+//
+// lo parts of ln(1/frcpa(1+i/256)), i=0...255
+data4 0x20E70672 // 0
+data4 0x1F60A5D0 // 1
+data4 0x218EABA0 // 2
+data4 0x21403104 // 3
+data4 0x20E9B54E // 4
+data4 0x21EE1382 // 5
+data4 0x226014E3 // 6
+data4 0x2095E5C9 // 7
+data4 0x228BA9D4 // 8
+data4 0x22932B86 // 9
+data4 0x22608A57 // 10
+data4 0x220209F3 // 11
+data4 0x212882CC // 12
+data4 0x220D46E2 // 13
+data4 0x21FA4C28 // 14
+data4 0x229E5BD9 // 15
+data4 0x228C9838 // 16
+data4 0x2311F954 // 17
+data4 0x221365DF // 18
+data4 0x22BD0CB3 // 19
+data4 0x223D4BB7 // 20
+data4 0x22A71BBE // 21
+data4 0x237DB2FA // 22
+data4 0x23194C9D // 23
+data4 0x22EC639E // 24
+data4 0x2367E669 // 25
+data4 0x232E1D5F // 26
+data4 0x234A639B // 27
+data4 0x2365C0E0 // 28
+data4 0x234646C1 // 29
+data4 0x220CBF9C // 30
+data4 0x22A00FD4 // 31
+data4 0x2306A3F2 // 32
+data4 0x23745A9B // 33
+data4 0x2398D756 // 34
+data4 0x23DD0B6A // 35
+data4 0x23DE338B // 36
+data4 0x23A222DF // 37
+data4 0x223164F8 // 38
+data4 0x23B4E87B // 39
+data4 0x23D6CCB8 // 40
+data4 0x220C2099 // 41
+data4 0x21B86B67 // 42
+data4 0x236D14F1 // 43
+data4 0x225A923F // 44
+data4 0x22748723 // 45
+data4 0x22200D13 // 46
+data4 0x23C296EA // 47
+data4 0x2302AC38 // 48
+data4 0x234B1996 // 49
+data4 0x2385E298 // 50
+data4 0x23175BE5 // 51
+data4 0x2193F482 // 52
+data4 0x23BFEA90 // 53
+data4 0x23D70A0C // 54
+data4 0x231CF30A // 55
+data4 0x235D9E90 // 56
+data4 0x221AD0CB // 57
+data4 0x22FAA08B // 58
+data4 0x23D29A87 // 59
+data4 0x20C4B2FE // 60
+data4 0x2381B8B7 // 61
+data4 0x23F8D9FC // 62
+data4 0x23EAAE7B // 63
+data4 0x2329E8AA // 64
+data4 0x23EC0322 // 65
+data4 0x2357FDCB // 66
+data4 0x2392A9AD // 67
+data4 0x22113B02 // 68
+data4 0x22DEE901 // 69
+data4 0x236A6D14 // 70
+data4 0x2371D33E // 71
+data4 0x2146F005 // 72
+data4 0x23230B06 // 73
+data4 0x22F1C77D // 74
+data4 0x23A89FA3 // 75
+data4 0x231D1241 // 76
+data4 0x244DA96C // 77
+data4 0x23ECBB7D // 78
+data4 0x223E42B4 // 79
+data4 0x23801BC9 // 80
+data4 0x23573263 // 81
+data4 0x227C1158 // 82
+data4 0x237BD749 // 83
+data4 0x21DDBAE9 // 84
+data4 0x23401735 // 85
+data4 0x241D9DEE // 86
+data4 0x23BC88CB // 87
+data4 0x2396D5F1 // 88
+data4 0x23FC89CF // 89
+data4 0x2414F9A2 // 90
+data4 0x2474A0F5 // 91
+data4 0x24354B60 // 92
+data4 0x23C1EB40 // 93
+data4 0x2306DD92 // 94
+data4 0x24353B6B // 95
+data4 0x23CD1701 // 96
+data4 0x237C7A1C // 97
+data4 0x245793AA // 98
+data4 0x24563695 // 99
+data4 0x23C51467 // 100
+data4 0x24476B68 // 101
+data4 0x212585A9 // 102
+data4 0x247B8293 // 103
+data4 0x2446848A // 104
+data4 0x246A53F8 // 105
+data4 0x246E496D // 106
+data4 0x23ED1D36 // 107
+data4 0x2314C258 // 108
+data4 0x233244A7 // 109
+data4 0x245B7AF0 // 110
+data4 0x24247130 // 111
+data4 0x22D67B38 // 112
+data4 0x2449F620 // 113
+data4 0x23BBC8B8 // 114
+data4 0x237D3BA0 // 115
+data4 0x245E8F13 // 116
+data4 0x2435573F // 117
+data4 0x242DE666 // 118
+data4 0x2463BC10 // 119
+data4 0x2466587D // 120
+data4 0x2408144B // 121
+data4 0x2405F0E5 // 122
+data4 0x22381CFF // 123
+data4 0x24154F9B // 124
+data4 0x23A4E96E // 125
+data4 0x24052967 // 126
+data4 0x2406963F // 127
+data4 0x23F7D3CB // 128
+data4 0x2448AFF4 // 129
+data4 0x24657A21 // 130
+data4 0x22FBC230 // 131
+data4 0x243C8DEA // 132
+data4 0x225DC4B7 // 133
+data4 0x23496EBF // 134
+data4 0x237C2B2B // 135
+data4 0x23A4A5B1 // 136
+data4 0x2394E9D1 // 137
+data4 0x244BC950 // 138
+data4 0x23C7448F // 139
+data4 0x2404A1AD // 140
+data4 0x246511D5 // 141
+data4 0x24246526 // 142
+data4 0x23111F57 // 143
+data4 0x22868951 // 144
+data4 0x243EB77F // 145
+data4 0x239F3DFF // 146
+data4 0x23089666 // 147
+data4 0x23EBFA6A // 148
+data4 0x23C51312 // 149
+data4 0x23E1DD5E // 150
+data4 0x232C0944 // 151
+data4 0x246A741F // 152
+data4 0x2414DF8D // 153
+data4 0x247B5546 // 154
+data4 0x2415C980 // 155
+data4 0x24324ABD // 156
+data4 0x234EB5E5 // 157
+data4 0x2465E43E // 158
+data4 0x242840D1 // 159
+data4 0x24444057 // 160
+data4 0x245E56F0 // 161
+data4 0x21AE30F8 // 162
+data4 0x23FB3283 // 163
+data4 0x247A4D07 // 164
+data4 0x22AE314D // 165
+data4 0x246B7727 // 166
+data4 0x24EAD526 // 167
+data4 0x24B41DC9 // 168
+data4 0x24EE8062 // 169
+data4 0x24A0C7C4 // 170
+data4 0x24E8DA67 // 171
+data4 0x231120F7 // 172
+data4 0x24401FFB // 173
+data4 0x2412DD09 // 174
+data4 0x248C131A // 175
+data4 0x24C0A7CE // 176
+data4 0x243DD4C8 // 177
+data4 0x24457FEB // 178
+data4 0x24DEEFBB // 179
+data4 0x243C70AE // 180
+data4 0x23E7A6FA // 181
+data4 0x24C2D311 // 182
+data4 0x23026255 // 183
+data4 0x2437C9B9 // 184
+data4 0x246BA847 // 185
+data4 0x2420B448 // 186
+data4 0x24C4CF5A // 187
+data4 0x242C4981 // 188
+data4 0x24DE1525 // 189
+data4 0x24F5CC33 // 190
+data4 0x235A85DA // 191
+data4 0x24A0B64F // 192
+data4 0x244BA0A4 // 193
+data4 0x24AAF30A // 194
+data4 0x244C86F9 // 195
+data4 0x246D5B82 // 196
+data4 0x24529347 // 197
+data4 0x240DD008 // 198
+data4 0x24E98790 // 199
+data4 0x2489B0CE // 200
+data4 0x22BC29AC // 201
+data4 0x23F37C7A // 202
+data4 0x24987FE8 // 203
+data4 0x22AFE20B // 204
+data4 0x24C8D7C2 // 205
+data4 0x24B28B7D // 206
+data4 0x23B6B271 // 207
+data4 0x24C77CB6 // 208
+data4 0x24EF1DCA // 209
+data4 0x24A4F0AC // 210
+data4 0x24CF113E // 211
+data4 0x2496BBAB // 212
+data4 0x23C7CC8A // 213
+data4 0x23AE3961 // 214
+data4 0x2410A895 // 215
+data4 0x23CE3114 // 216
+data4 0x2308247D // 217
+data4 0x240045E9 // 218
+data4 0x24974F60 // 219
+data4 0x242CB39F // 220
+data4 0x24AB8D69 // 221
+data4 0x23436788 // 222
+data4 0x24305E9E // 223
+data4 0x243E71A9 // 224
+data4 0x23C2A6B3 // 225
+data4 0x23FFE6CF // 226
+data4 0x2322D801 // 227
+data4 0x24515F21 // 228
+data4 0x2412A0D6 // 229
+data4 0x24E60D44 // 230
+data4 0x240D9251 // 231
+data4 0x247076E2 // 232
+data4 0x229B101B // 233
+data4 0x247B12DE // 234
+data4 0x244B9127 // 235
+data4 0x2499EC42 // 236
+data4 0x21FC3963 // 237
+data4 0x23E53266 // 238
+data4 0x24CE102D // 239
+data4 0x23CC45D2 // 240
+data4 0x2333171D // 241
+data4 0x246B3533 // 242
+data4 0x24931129 // 243
+data4 0x24405FFA // 244
+data4 0x24CF464D // 245
+data4 0x237095CD // 246
+data4 0x24F86CBD // 247
+data4 0x24E2D84B // 248
+data4 0x21ACBB44 // 249
+data4 0x24F43A8C // 250
+data4 0x249DB931 // 251
+data4 0x24A385EF // 252
+data4 0x238B1279 // 253
+data4 0x2436213E // 254
+data4 0x24F18A3B // 255
+LOCAL_OBJECT_END(log_data)
+
+
+// Code
+//==============================================================
 
 .section .text
-.proc log1p#
-.global log1p#
-.align 64 
-log1p:
-#ifdef _LIBC
-.global __log1p
-__log1p:
-#endif
-
-{ .mfi
-alloc r32 = ar.pfs,0,22,4,0
-(p0)  fsub.s1 FR_Neg_One = f0,f1 
-(p0)  cmp.eq.unc  p7, p0 = r0, r0 
-}
-
-{ .mfi
-(p0)  cmp.ne.unc  p14, p0 = r0, r0 
-(p0)  fnorm.s1 FR_X_Prime = FR_Input_X 
-(p0)  cmp.eq.unc  p15, p0 = r0, r0 ;; 
-}
-
+GLOBAL_IEEE754_ENTRY(log1p)
 { .mfi
-      nop.m 999
-(p0)  fclass.m.unc p6, p0 =  FR_Input_X, 0x1E3 
-      nop.i 999
+      getf.exp      GR_signexp_x = f8 // if x is unorm then must recompute
+      fadd.s1       FR_Xp1 = f8, f1       // Form 1+x
+      mov           GR_05 = 0xfffe
 }
-;;
-
-{ .mfi
-	nop.m 999
-(p0)  fclass.nm.unc p10, p0 =  FR_Input_X, 0x1FF 
-      nop.i 999
+{ .mlx
+      addl          GR_ad_1 = @ltoff(log_data),gp
+      movl          GR_A3 = 0x3fd5555555555557 // double precision memory
+                                               // representation of A3
 }
 ;;
 
 { .mfi
-	nop.m 999
-(p0)  fcmp.eq.unc.s1 p9, p0 =  FR_Input_X, f0 
-      nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fadd FR_Em1 = f0,f0 
-	nop.i 999 ;;
+      ld8           GR_ad_1 = [GR_ad_1]
+      fclass.m      p8,p0 = f8,0xb // Is x unorm?
+      mov           GR_exp_mask = 0x1ffff
 }
-
-{ .mfi
-	nop.m 999
-(p0)  fadd FR_E = f0,f1 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fcmp.eq.unc.s1 p8, p0 =  FR_Input_X, FR_Neg_One 
-	nop.i 999
-}
-
 { .mfi
-	nop.m 999
-(p0)  fcmp.lt.unc.s1 p13, p0 =  FR_Input_X, FR_Neg_One 
-	nop.i 999
+      nop.m         0
+      fnorm.s1      FR_NormX = f8              // Normalize x
+      mov           GR_exp_bias = 0xffff
 }
-
-
-L(LOG_BEGIN): 
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_Z = FR_X_Prime, FR_E 
-	nop.i 999
+      setf.exp      FR_A2 = GR_05 // create A2 = 0.5
+      fclass.m      p9,p0 = f8,0x1E1 // is x NaN, NaT or +Inf?
+      nop.i         0
 }
-
-{ .mlx
-	nop.m 999
-(p0)  movl GR_Table_Scale = 0x0000000000000018 ;; 
-}
-
-{ .mmi
-	nop.m 999
-//     
-//    Create E = 1 and Em1 = 0 
-//    Check for X == 0, meaning log(1+0)
-//    Check for X < -1, meaning log(negative)
-//    Check for X == -1, meaning log(0)
-//    Normalize x 
-//    Identify NatVals, NaNs, Infs. 
-//    Identify EM unsupporteds. 
-//    Identify Negative values - us S1 so as
-//    not to raise denormal operand exception 
-//    Set p15 to true for log1p
-//    Set p14 to false for log1p
-//    Set p7 true for log and log1p
-//    
-(p0)  addl GR_Table_Base = @ltoff(Constants_Z_G_H_h1#),gp
-      nop.i  999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fmax.s1 FR_AA = FR_X_Prime, FR_E 
-	nop.i 999 ;;
+{ .mib
+      setf.d        FR_A3 = GR_A3 // create A3
+      add           GR_ad_2 = 16,GR_ad_1 // address of A5,A4
+(p8)  br.cond.spnt  log1p_unorm          // Branch if x=unorm
 }
+;;
 
+log1p_common:
 { .mfi
-      ld8    GR_Table_Base = [GR_Table_Base]
-(p0)  fmin.s1 FR_BB = FR_X_Prime, FR_E 
-	nop.i 999
+      nop.m         0
+      frcpa.s1      FR_RcpX,p0 = f1,FR_Xp1
+      nop.i         0
 }
-
 { .mfb
-	nop.m 999
-(p0)  fadd.s1 FR_W = FR_X_Prime, FR_Em1 
-//     
-//    Begin load of constants base
-//    FR_Z = Z = |x| + E 
-//    FR_W = W = |x| + Em1
-//    AA = fmax(|x|,E)
-//    BB = fmin(|x|,E)
-//
-(p6)  br.cond.spnt L(LOG_64_special) ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p10) br.cond.spnt L(LOG_64_unsupported) ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p13) br.cond.spnt L(LOG_64_negative) ;; 
-}
-
-{ .mib
-(p0)  getf.sig GR_signif = FR_Z 
-	nop.i 999
-(p9)  br.cond.spnt L(LOG_64_one) ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p8)  br.cond.spnt L(LOG_64_zero) ;; 
+      nop.m         0
+(p9)  fma.d.s0      f8 = f8,f1,f0 // set V-flag
+(p9)  br.ret.spnt   b0 // exit for NaN, NaT and +Inf
 }
+;;
 
 { .mfi
-(p0)  getf.exp GR_N =  FR_Z 
-//   
-//    Raise possible denormal operand exception 
-//    Create Bias
-// 
-//    This function computes ln( x + e ) 
-//    Input  FR 1: FR_X   = FR_Input_X          
-//    Input  FR 2: FR_E   = FR_E
-//    Input  FR 3: FR_Em1 = FR_Em1 
-//    Input  GR 1: GR_Expo_Range = GR_Expo_Range = 1
-//    Output FR 4: FR_Y_hi  
-//    Output FR 5: FR_Y_lo  
-//    Output FR 6: FR_Scale  
-//    Output PR 7: PR_Safe  
-//
-(p0)  fsub.s1 FR_S_lo = FR_AA, FR_Z 
-//
-//    signif = getf.sig(Z)
-//    abs_W = fabs(w)
-//
-(p0)  extr.u GR_Table_ptr = GR_signif, 59, 4 ;; 
+      getf.exp      GR_Exp = FR_Xp1            // signexp of x+1
+      fclass.m      p10,p0 = FR_Xp1,0x3A // is 1+x < 0?
+      and           GR_exp_x = GR_exp_mask, GR_signexp_x // biased exponent of x
 }
-
 { .mfi
-	nop.m 999
-(p0)  fmerge.se FR_S_hi =  f1,FR_Z 
-(p0)  extr.u GR_X_0 = GR_signif, 49, 15  
-}
-
-{ .mmi
-      nop.m 999
-(p0)  addl GR_Table_Base1 = @ltoff(Constants_Z_G_H_h2#),gp  
-      nop.i 999
+      ldfpd         FR_A7,FR_A6 = [GR_ad_1]
+      nop.f         0
+      nop.i         0
 }
 ;;
 
-{ .mlx
-      ld8    GR_Table_Base1 = [GR_Table_Base1]
-(p0)  movl GR_Bias = 0x000000000000FFFF ;; 
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fabs FR_abs_W =  FR_W 
-(p0)  pmpyshr2.u GR_Table_ptr = GR_Table_ptr,GR_Table_Scale,0 
-}
-
 { .mfi
-	nop.m 999
-//    
-//    Branch out for special input values 
-//    
-(p0)  fcmp.lt.unc.s0 p8, p0 =  FR_Input_X, f0 
-	nop.i 999 ;;
+      getf.sig      GR_Sig = FR_Xp1 // get significand to calculate index
+                                    // for Thi,Tlo if |x| >= 2^-8
+      fcmp.eq.s1    p12,p0 = f8,f0     // is x equal to 0?
+      sub           GR_exp_x = GR_exp_x, GR_exp_bias // true exponent of x
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    X_0 = extr.u(signif,49,15)
-//    Index1 = extr.u(signif,59,4)
-//
-(p0)  fadd.s1 FR_S_lo = FR_S_lo, FR_BB 
-	nop.i 999 ;;
-}
-
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    Offset_to_Z1 = 24 * Index1
-//    For performance, don't use result
-//    for 3 or 4 cycles.
-//
-(p0)  add GR_Table_ptr = GR_Table_ptr, GR_Table_Base ;; 
+      sub           GR_N = GR_Exp,GR_exp_bias // true exponent of x+1
+      fcmp.eq.s1    p11,p0 = FR_Xp1,f0     // is x = -1?
+      cmp.gt        p6,p7 = -8, GR_exp_x  // Is |x| < 2^-8
 }
-//
-//    Add Base to Offset for Z1
-//    Create Bias
-
-{ .mmi
-(p0)  ld4 GR_Z_1 = [GR_Table_ptr],4 ;; 
-(p0)  ldfs  FR_G = [GR_Table_ptr],4 
-	nop.i 999 ;;
-}
-
-{ .mmi
-(p0)  ldfs  FR_H = [GR_Table_ptr],8 ;; 
-(p0)  ldfd  FR_h = [GR_Table_ptr],0 
-(p0)  pmpyshr2.u GR_X_1 = GR_X_0,GR_Z_1,15 
+{ .mfb
+      ldfpd         FR_A5,FR_A4 = [GR_ad_2],16
+      nop.f         0
+(p10) br.cond.spnt  log1p_lt_minus_1   // jump if x < -1
 }
-//
-//    Load Z_1 
-//    Get Base of Table2 
-//
+;;
 
+// p6 is true if |x| < 1/256
+// p7 is true if |x| >= 1/256
+.pred.rel "mutex",p6,p7
 { .mfi
-(p0)  getf.exp GR_M = FR_abs_W 
-	nop.f 999
-	nop.i 999 ;;
+(p7)  add           GR_ad_1 = 0x820,GR_ad_1 // address of log(2) parts
+(p6)  fms.s1        FR_r = f8,f1,f0 // range reduction for |x|<1/256
+(p6)  cmp.gt.unc    p10,p0 = -80, GR_exp_x  // Is |x| < 2^-80
 }
-
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    M = getf.exp(abs_W)
-//    S_lo = AA - Z
-//    X_1 = pmpyshr2(X_0,Z_1,15)
-//
-(p0)  sub GR_M = GR_M, GR_Bias ;; 
-}
-//     
-//    M = M - Bias
-//    Load G1
-//    N = getf.exp(Z)
-//
-
-{ .mii
-(p0)  cmp.gt.unc  p11, p0 =  -80, GR_M 
-(p0)  cmp.gt.unc  p12, p0 =  -7, GR_M ;; 
-(p0)  extr.u GR_Index2 = GR_X_1, 6, 4 ;; 
-}
-
-{ .mib
-	nop.m 999
-//
-//    if -80 > M, set p11
-//    Index2 = extr.u(X_1,6,4)
-//    if -7  > M, set p12
-//    Load H1
-//
-(p0)  pmpyshr2.u GR_Index2 = GR_Index2,GR_Table_Scale,0 
-(p11) br.cond.spnt L(log1p_small) ;; 
+{ .mfb
+(p7)  setf.sig      FR_N = GR_N // copy unbiased exponent of x to the
+                                // significand field of FR_N
+(p7)  fms.s1        FR_r = FR_RcpX,FR_Xp1,f1 // range reduction for |x|>=1/256
+(p12) br.ret.spnt   b0 // exit for x=0, return x
 }
+;;
 
 { .mib
-      nop.m 999
-	nop.i 999
-(p12) br.cond.spnt L(log1p_near) ;; 
-}
-
-{ .mii
-(p0)  sub GR_N = GR_N, GR_Bias 
-//
-//    poly_lo = r * poly_lo 
-//
-(p0)  add GR_Perturb = 0x1, r0 ;; 
-(p0)  sub GR_ScaleN = GR_Bias, GR_N  
-}
-
-{ .mii
-(p0)  setf.sig FR_float_N = GR_N 
-	nop.i 999 ;;
-//
-//    Prepare Index2 - pmpyshr2.u(X_1,Z_2,15)
-//    Load h1
-//    S_lo = S_lo + BB 
-//    Branch for -80 > M
-//   
-(p0)  add GR_Index2 = GR_Index2, GR_Table_Base1
-}
-
-{ .mmi
-(p0)  setf.exp FR_two_negN = GR_ScaleN 
-      nop.m 999
-(p0)  addl GR_Table_Base = @ltoff(Constants_Z_G_H_h3#),gp  
-};;
-
-//
-//    Index2 points to Z2
-//    Branch for -7 > M
-//
-
-{ .mmb
-(p0)  ld4 GR_Z_2 = [GR_Index2],4 
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.b 999 ;;
-}
-(p0)  nop.i 999
-//
-//    Load Z_2
-//    N = N - Bias
-//    Tablebase points to Table3
-//
-
-{ .mmi
-(p0)  ldfs  FR_G_tmp = [GR_Index2],4 ;; 
-//
-//    Load G_2
-//    pmpyshr2  X_2= (X_1,Z_2,15)
-//    float_N = setf.sig(N)
-//    ScaleN = Bias - N
-//
-(p0)  ldfs  FR_H_tmp = [GR_Index2],8 
-	nop.i 999 ;;
-}
-//
-//    Load H_2
-//    two_negN = setf.exp(scaleN)
-//    G = G_1 * G_2
-//
-
-{ .mfi
-(p0)  ldfd  FR_h_tmp = [GR_Index2],0 
-	nop.f 999
-(p0)  pmpyshr2.u GR_X_2 = GR_X_1,GR_Z_2,15 ;; 
-}
-
-{ .mii
-	nop.m 999
-(p0)  extr.u GR_Index3 = GR_X_2, 1, 5 ;; 
-//
-//    Load h_2
-//    H = H_1 + H_2 
-//    h = h_1 + h_2 
-//    Index3 = extr.u(X_2,1,5)
-//
-(p0)  shladd GR_Index3 = GR_Index3,4,GR_Table_Base 
-}
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-//
-//    float_N = fcvt.xf(float_N)
-//    load G3
-//
-(p0)  addl GR_Table_Base = @ltoff(Constants_Q#),gp ;; 
-}
-
-{ .mfi
-ld8    GR_Table_Base = [GR_Table_Base]
-nop.f 999
-nop.i 999
-} ;;
-
-{ .mfi
-(p0)  ldfe FR_log2_hi = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_S_lo = FR_S_lo, FR_two_negN 
-	nop.i 999 ;;
-}
-
-{ .mmf
-	nop.m 999
-//
-//    G = G3 * G
-//    Load h3
-//    Load log2_hi
-//    H = H + H3
-//
-(p0)  ldfe FR_log2_lo = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_G = FR_G, FR_G_tmp ;; 
-}
-
-{ .mmf
-(p0)  ldfs  FR_G_tmp = [GR_Index3],4 
-//
-//    h = h + h3
-//    r = G * S_hi + 1 
-//    Load log2_lo
-//
-(p0)  ldfe FR_Q4 = [GR_Table_Base],16 
-(p0)  fadd.s1 FR_h = FR_h, FR_h_tmp ;; 
-}
-
-{ .mfi
-(p0)  ldfe FR_Q3 = [GR_Table_Base],16 
-(p0)  fadd.s1 FR_H = FR_H, FR_H_tmp 
-	nop.i 999 ;;
+(p7)  ldfpd         FR_Ln2hi,FR_Ln2lo = [GR_ad_1],16
+(p7)  extr.u        GR_Ind = GR_Sig,55,8 // get bits from 55 to 62 as index
+(p11) br.cond.spnt  log1p_eq_minus_1 // jump if x = -1
 }
+;;
 
 { .mmf
-(p0)  ldfs  FR_H_tmp = [GR_Index3],4 
-(p0)  ldfe FR_Q2 = [GR_Table_Base],16 
-//
-//    Comput Index for Table3
-//    S_lo = S_lo * two_negN
-//
-(p0)  fcvt.xf FR_float_N = FR_float_N ;; 
+(p7)  shladd        GR_ad_2 = GR_Ind,3,GR_ad_2 // address of Thi
+(p7)  shladd        GR_ad_1 = GR_Ind,2,GR_ad_1 // address of Tlo
+(p10) fnma.d.s0     f8 = f8,f8,f8   // If |x| very small, result=x-x*x
 }
-//
-//    If S_lo == 0, set p8 false
-//    Load H3
-//    Load ptr to table of polynomial coeff.
-//
+;;
 
-{ .mmf
-(p0)  ldfd  FR_h_tmp = [GR_Index3],0 
-(p0)  ldfe FR_Q1 = [GR_Table_Base],0 
-(p0)  fcmp.eq.unc.s1 p0, p8 =  FR_S_lo, f0 ;; 
+{ .mmb
+(p7)  ldfd          FR_Thi = [GR_ad_2]
+(p7)  ldfs          FR_Tlo = [GR_ad_1]
+(p10) br.ret.spnt   b0                   // Exit if |x| < 2^(-80)
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 FR_G = FR_G, FR_G_tmp 
-	nop.i 999 ;;
+      nop.m         0
+      fma.s1        FR_r2 = FR_r,FR_r,f0 // r^2
+      nop.i         0
 }
-
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_H = FR_H, FR_H_tmp 
-	nop.i 999 ;;
+      nop.m         0
+      fms.s1        FR_A2 = FR_A3,FR_r,FR_A2 // A3*r+A2
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fms.s1 FR_r = FR_G, FR_S_hi, f1 
-	nop.i 999
+      nop.m         0
+      fma.s1        FR_A6 = FR_A7,FR_r,FR_A6 // A7*r+A6
+      nop.i         0
 }
-
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_h = FR_h, FR_h_tmp 
-	nop.i 999 ;;
+      nop.m         0
+      fma.s1        FR_A4 = FR_A5,FR_r,FR_A4 // A5*r+A4
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_float_N, FR_log2_hi, FR_H 
-	nop.i 999 ;;
+      nop.m         0
+(p7)  fcvt.xf       FR_N = FR_N
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    Load Q4 
-//    Load Q3 
-//    Load Q2 
-//    Load Q1 
-//
-(p8) fma.s1 FR_r = FR_G, FR_S_lo, FR_r 
-	nop.i 999
+      nop.m         0
+      fma.s1        FR_r4 = FR_r2,FR_r2,f0 // r^4
+      nop.i         0
 }
-
 { .mfi
-	nop.m 999
-//
-//    poly_lo = r * Q4 + Q3
-//    rsq = r* r
-//
-(p0)  fma.s1 FR_h = FR_float_N, FR_log2_lo, FR_h 
-	nop.i 999 ;;
+      nop.m         0
+      // (A3*r+A2)*r^2+r
+      fma.s1        FR_A2 = FR_A2,FR_r2,FR_r
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    If (S_lo!=0) r = s_lo * G + r
-//
-(p0)  fma.s1 FR_poly_lo = FR_r, FR_Q4, FR_Q3 
-	nop.i 999
+      nop.m         0
+      // (A7*r+A6)*r^2+(A5*r+A4)
+      fma.s1        FR_A4 = FR_A6,FR_r2,FR_A4
+      nop.i         0
 }
-//
-//    Create a 0x00000....01
-//    poly_lo = poly_lo * rsq + h
-//
+;;
 
 { .mfi
-(p0)  setf.sig FR_dummy = GR_Perturb 
-(p0)  fmpy.s1 FR_rsq = FR_r, FR_r 
-	nop.i 999 ;;
+      nop.m         0
+      // N*Ln2hi+Thi
+(p7)  fma.s1        FR_NxLn2hipThi = FR_N,FR_Ln2hi,FR_Thi
+      nop.i         0
 }
-
 { .mfi
-	nop.m 999
-//
-//    h = N * log2_lo + h 
-//    Y_hi = n * log2_hi + H 
-//
-(p0)  fma.s1 FR_poly_lo = FR_poly_lo, FR_r, FR_Q2 
-	nop.i 999
+      nop.m         0
+      // N*Ln2lo+Tlo
+(p7)  fma.s1        FR_NxLn2lopTlo = FR_N,FR_Ln2lo,FR_Tlo
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_poly_hi = FR_Q1, FR_rsq, FR_r 
-	nop.i 999 ;;
+      nop.m         0
+(p7)  fma.s1        f8 = FR_A4,FR_r4,FR_A2 // P(r) if |x| >= 1/256
+      nop.i         0
 }
-
 { .mfi
-	nop.m 999
-//
-//    poly_lo = r * poly_o + Q2 
-//    poly_hi = Q1 * rsq + r 
-//
-(p0)  fmpy.s1 FR_poly_lo = FR_poly_lo, FR_r 
-	nop.i 999 ;;
+      nop.m         0
+      // (N*Ln2hi+Thi) + (N*Ln2lo+Tlo)
+(p7)  fma.s1        FR_NxLn2pT = FR_NxLn2hipThi,f1,FR_NxLn2lopTlo
+      nop.i         0
 }
+;;
 
+.pred.rel "mutex",p6,p7
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_poly_lo = FR_poly_lo, FR_rsq, FR_h 
-	nop.i 999 ;;
+      nop.m         0
+(p6)  fma.d.s0      f8 = FR_A4,FR_r4,FR_A2 // result if 2^(-80) <= |x| < 1/256
+      nop.i         0
 }
-
 { .mfb
-	nop.m 999
-(p0)  fadd.s1 FR_Y_lo = FR_poly_hi, FR_poly_lo 
-//
-//    Create the FR for a binary "or"
-//    Y_lo = poly_hi + poly_lo
-//
-// (p0)  for FR_dummy = FR_Y_lo,FR_dummy ;;
-//
-//    Turn the lsb of Y_lo ON
-//
-// (p0)  fmerge.se FR_Y_lo =  FR_Y_lo,FR_dummy ;;
-//
-//    Merge the new lsb into Y_lo, for alone doesn't
-//
-(p0)  br.cond.sptk L(LOG_main) ;; 
-}
-
-
-L(log1p_near): 
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-//    /*******************************************************/
-//    /*********** Branch log1p_near  ************************/
-//    /*******************************************************/
-(p0)  addl GR_Table_Base = @ltoff(Constants_P#),gp ;; 
-}
-//
-//    Load base address of poly. coeff.
-//
-{.mmi
-      nop.m 999
-      ld8    GR_Table_Base = [GR_Table_Base]
-      nop.i 999
-};;
-
-{ .mmb
-(p0)  add GR_Table_ptr = 0x40,GR_Table_Base  
-//
-//    Address tables with separate pointers 
-//
-(p0)  ldfe FR_P8 = [GR_Table_Base],16 
-	nop.b 999 ;;
-}
-
-{ .mmb
-(p0)  ldfe FR_P4 = [GR_Table_ptr],16 
-//
-//    Load P4
-//    Load P8
-//
-(p0)  ldfe FR_P7 = [GR_Table_Base],16 
-	nop.b 999 ;;
-}
-
-{ .mmf
-(p0)  ldfe FR_P3 = [GR_Table_ptr],16 
-//
-//    Load P3
-//    Load P7
-//
-(p0)  ldfe FR_P6 = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_wsq = FR_W, FR_W ;; 
-}
-
-{ .mfi
-(p0)  ldfe FR_P2 = [GR_Table_ptr],16 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_P4, FR_P3 
-	nop.i 999
-}
-//
-//    Load P2
-//    Load P6
-//    Wsq = w * w
-//    Y_hi = p4 * w + p3
-//
-
-{ .mfi
-(p0)  ldfe FR_P5 = [GR_Table_Base],16 
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_P8, FR_P7 
-	nop.i 999 ;;
-}
-
-{ .mfi
-(p0)  ldfe FR_P1 = [GR_Table_ptr],16 
-//
-//    Load P1
-//    Load P5
-//    Y_lo = p8 * w + P7
-//
-(p0)  fmpy.s1 FR_w4 = FR_wsq, FR_wsq 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_Y_hi, FR_P2 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_Y_lo, FR_P6 
-(p0)  add GR_Perturb = 0x1, r0 ;; 
-}
-
-{ .mfi
-	nop.m 999
-//
-//    w4 = w2 * w2 
-//    Y_hi = y_hi * w + p2 
-//    Y_lo = y_lo * w + p6 
-//    Create perturbation bit
-//
-(p0)  fmpy.s1 FR_w6 = FR_w4, FR_wsq 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_Y_hi, FR_P1 
-	nop.i 999
-}
-//
-//    Y_hi = y_hi * w + p1 
-//    w6 = w4 * w2 
-//
-
-{ .mfi
-(p0)  setf.sig FR_Q4 = GR_Perturb 
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_Y_lo, FR_P5 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_wsq,FR_Y_hi, FR_W 
-	nop.i 999
+      nop.m         0
+(p7)  fma.d.s0      f8 = f8,f1,FR_NxLn2pT  // result if |x| >= 1/256
+      br.ret.sptk   b0                     // Exit if |x| >= 2^(-80)
 }
+;;
 
+.align 32
+log1p_unorm:
+// Here if x=unorm
 { .mfb
-	nop.m 999
-//
-//    Y_hi = y_hi * wsq + w 
-//    Y_lo = y_lo * w + p5 
-//
-(p0)  fmpy.s1 FR_Y_lo = FR_w6, FR_Y_lo 
-//
-//    Y_lo = y_lo * w6  
-//
-// (p0)  for FR_dummy = FR_Y_lo,FR_dummy ;;
-//
-//    Set lsb on: Taken out to improve performance 
-//
-// (p0)  fmerge.se FR_Y_lo =  FR_Y_lo,FR_dummy ;;
-//
-//    Make sure it's on in Y_lo also.  Taken out to improve
-//    performance
-//
-(p0)  br.cond.sptk L(LOG_main) ;; 
-}
-
-
-L(log1p_small): 
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-//  /*******************************************************/
-//  /*********** Branch log1p_small  ***********************/
-//  /*******************************************************/
-(p0)  addl GR_Table_Base = @ltoff(Constants_Threshold#),gp 
-}
-
-{ .mfi
-	nop.m 999
-(p0)  mov FR_Em1 = FR_W 
-(p0)  cmp.eq.unc  p7, p0 = r0, r0 ;; 
-}
-
-{ .mlx
-      ld8    GR_Table_Base = [GR_Table_Base]
-(p0)  movl GR_Expo_Range = 0x0000000000000002 ;; 
-}
-//
-//    Set Safe to true
-//    Set Expo_Range = 0 for single
-//    Set Expo_Range = 2 for double 
-//    Set Expo_Range = 4 for double-extended 
-//
-
-{ .mmi
-(p0)  shladd GR_Table_Base = GR_Expo_Range,4,GR_Table_Base ;; 
-(p0)  ldfe FR_Threshold = [GR_Table_Base],16 
-	nop.i 999
-}
-
-{ .mlx
-	nop.m 999
-(p0)  movl GR_Bias = 0x000000000000FF9B ;; 
-}
-
-{ .mfi
-(p0)  ldfe FR_Tiny = [GR_Table_Base],0 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fcmp.gt.unc.s1 p13, p12 =  FR_abs_W, FR_Threshold 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p13) fnmpy.s1 FR_Y_lo = FR_W, FR_W 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p13) fadd FR_SCALE = f0, f1 
-	nop.i 999 ;;
+      getf.exp      GR_signexp_x = FR_NormX // recompute biased exponent
+      nop.f         0
+      br.cond.sptk  log1p_common
 }
+;;
 
+.align 32
+log1p_eq_minus_1:
+// Here if x=-1
 { .mfi
-	nop.m 999
-(p12) fsub.s1 FR_Y_lo = f0, FR_Tiny 
-(p12) cmp.ne.unc  p7, p0 = r0, r0 
+      nop.m         0
+      fmerge.s      FR_X = f8,f8 // keep input argument for subsequent
+                                 // call of __libm_error_support#
+      nop.i         0
 }
+;;
 
 { .mfi
-(p12) setf.exp FR_SCALE = GR_Bias 
-	nop.f 999
-	nop.i 999 ;;
+      mov           GR_TAG = 140  // set libm error in case of log1p(-1).
+      frcpa.s0      f8,p0 = f8,f0 // log1p(-1) should be equal to -INF.
+                                      // We can get it using frcpa because it
+                                      // sets result to the IEEE-754 mandated
+                                      // quotient of f8/f0.
+      nop.i         0
 }
-
-//
-//    Set p7 to SAFE = FALSE
-//    Set Scale = 2^-100 
-//
-{ .mfb
-	nop.m 999
-(p0)  fma.d.s0 FR_Input_X = FR_Y_lo,FR_SCALE,FR_Y_hi
-(p0)  br.ret.sptk   b0
-}
-;;
-
-L(LOG_64_one): 
-
-{ .mfb
-	nop.m 999
-(p0)  fmpy.d.s0 FR_Input_X = FR_Input_X, f0 
-(p0)  br.ret.sptk   b0
+{ .mib
+      nop.m         0
+      nop.i         0
+      br.cond.sptk  log_libm_err
 }
 ;;
 
-//    
-//    Raise divide by zero for +/-0 input.
-//    
-L(LOG_64_zero): 
-
+.align 32
+log1p_lt_minus_1:
+// Here if x < -1
 { .mfi
-(p0)  mov   GR_Parameter_TAG = 140
-//
-//    If we have log1p(0), return -Inf.
-//  
-(p0)  fsub.s0 FR_Output_X_tmp = f0, f1 
-      nop.i 999 ;;
-}
-{ .mfb
-      nop.m 999
-(p0)  frcpa.s0 FR_Output_X_tmp, p8 =  FR_Output_X_tmp, f0 
-(p0)  br.cond.sptk L(LOG_ERROR_Support) ;; 
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      nop.i         0
 }
-
-L(LOG_64_special): 
+;;
 
 { .mfi
-      nop.m 999
-//    
-//    Return -Inf or value from handler.
-//    
-(p0)  fclass.m.unc p7, p0 =  FR_Input_X, 0x1E1 
-      nop.i 999 ;;
-}
-{ .mfb
-      nop.m 999
-//     
-//    Check for Natval, QNan, SNaN, +Inf   
-//    
-(p7)  fmpy.d.s0  f8 =  FR_Input_X, f1 
-//     
-//    For SNaN raise invalid and return QNaN.
-//    For QNaN raise invalid and return QNaN.
-//    For +Inf return +Inf.
-//    
-(p7)  br.ret.sptk   b0
+      mov           GR_TAG = 141  // set libm error in case of x < -1.
+      frcpa.s0      f8,p0 = f0,f0 // log1p(x) x < -1 should be equal to NaN.
+                                  // We can get it using frcpa because it
+                                  // sets result to the IEEE-754 mandated
+                                  // quotient of f0/f0 i.e. NaN.
+      nop.i         0
 }
 ;;
 
-//    
-//    For -Inf raise invalid and return QNaN.
-//    
-
-{ .mfb
-(p0)  mov   GR_Parameter_TAG = 141 
-(p0)  fmpy.d.s0  FR_Output_X_tmp =  FR_Input_X, f0 
-(p0)  br.cond.sptk L(LOG_ERROR_Support) ;; 
-}
-
-//     
-//    Report that log1p(-Inf) computed
-//     
-
-L(LOG_64_unsupported): 
-
-//    
-//    Return generated NaN or other value .
-//    
-
-{ .mfb
-      nop.m 999
-(p0)  fmpy.d.s0 FR_Input_X = FR_Input_X, f0 
-(p0)  br.ret.sptk   b0 ;;
+.align 32
+log_libm_err:
+{ .mmi
+      alloc         r32 = ar.pfs,1,4,4,0
+      mov           GR_Parameter_TAG = GR_TAG
+      nop.i         0
 }
+;;
 
-L(LOG_64_negative): 
-
-{ .mfi
-      nop.m 999
-//     
-//    Deal with x < 0 in a special way 
-//    
-(p0)  frcpa.s0 FR_Output_X_tmp, p8 =  f0, f0 
-//     
-//    Deal with x < 0 in a special way - raise
-//    invalid and produce QNaN indefinite.
-//    
-(p0)  mov   GR_Parameter_TAG = 141
-}
+GLOBAL_IEEE754_END(log1p)
 
-.endp log1p#
-ASM_SIZE_DIRECTIVE(log1p)
 
-.proc __libm_error_region
-__libm_error_region:
-L(LOG_ERROR_Support): 
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y = -32,sp         // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS = ar.pfs             // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp = -64,sp                       // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP = gp                   // Save gp
 };;
-
-
-// (2)
 { .mmi
-        stfd [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
+        stfd [GR_Parameter_Y] = FR_Y,16       // STORE Parameter 2 on stack
         add GR_Parameter_X = 16,sp            // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0 = b0                   // Save b0
 };;
-
 .body
-// (3)
 { .mib
-        stfd [GR_Parameter_X] =FR_Input_X               // STORE Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
-        nop.b 0                                      
+        stfd [GR_Parameter_X] = FR_X          // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfd [GR_Parameter_Y] = FR_Output_X_tmp         // STORE Parameter 3 on stack
+        stfd [GR_Parameter_Y] = FR_RESULT     // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#           // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
-
-// (4)
 { .mmi
-        ldfd  FR_Input_X = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfd  f8 = [GR_Parameter_RESULT]      // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                      // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                 // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk   b0 
+        mov   gp = GR_SAVE_GP                 // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS            // Restore ar.pfs
+        br.ret.sptk     b0                    // Return
 };;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.proc __libm_LOG_main 
-__libm_LOG_main:
-L(LOG_main): 
-
-//
-//    kernel_log_64 computes ln(X + E)
-//
-
-{ .mfi
-	nop.m 999
-(p7)  fadd.d.s0 FR_Input_X = FR_Y_lo,FR_Y_hi
-        nop.i 999
-}
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-(p14) addl GR_Table_Base = @ltoff(Constants_1_by_LN10#),gp ;; 
-}
-
-{ .mmi
-      nop.m 999
-(p14) ld8    GR_Table_Base = [GR_Table_Base]
-      nop.i 999
-};;
-
-{ .mmi
-(p14) ldfe FR_1LN10_hi = [GR_Table_Base],16 ;; 
-(p14) ldfe FR_1LN10_lo = [GR_Table_Base]
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p14) fmpy.s1 FR_Output_X_tmp = FR_Y_lo,FR_1LN10_hi
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p14) fma.s1  FR_Output_X_tmp = FR_Y_hi,FR_1LN10_lo,FR_Output_X_tmp
-	nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-(p14) fma.d.s0 FR_Input_X = FR_Y_hi,FR_1LN10_hi,FR_Output_X_tmp
-(p0)  br.ret.sptk   b0 ;; 
-}
-.endp __libm_LOG_main
-ASM_SIZE_DIRECTIVE(__libm_LOG_main)
-
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_log1pf.S b/sysdeps/ia64/fpu/s_log1pf.S
index 8aff9b895a..77e79c39df 100644
--- a/sysdeps/ia64/fpu/s_log1pf.S
+++ b/sysdeps/ia64/fpu/s_log1pf.S
@@ -1,10 +1,10 @@
-.file "log1pf.s" 
+.file "log1pf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,1610 +20,770 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 06/29/01 Improved speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 10/02/02 Improved performance by basing on log algorithm
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/18/03 Eliminate possible WAW dependency warning
+// 12/16/03 Fixed parameter passing to/from error handling routine
+//
+// API
+//==============================================================
+// float log1pf(float)
 //
-// *********************************************************************
-//
-// Function:   log1pf(x) = ln(x+1), for single precision values
-//
-// *********************************************************************
-//
-// Accuracy:   Very accurate for single precision values
-//
-// *********************************************************************
-//
-// Resources Used:
-//
-//    Floating-Point Registers: f8 (Input and Return Value)
-//                              f9,f33-f55,f99 
-//
-//    General Purpose Registers:
-//      r32-r53
-//      r54-r57 (Used to pass arguments to error handling routine)
-//
-//    Predicate Registers:      p6-p15
-//
-// *********************************************************************
-//
-// IEEE Special Conditions:
-//
-//    Denormal  fault raised on denormal inputs
-//    Overflow exceptions cannot occur  
-//    Underflow exceptions raised when appropriate for log1pf 
-//    (Error Handling Routine called for underflow)
-//    Inexact raised when appropriate by algorithm
-//
-//    log1pf(inf) = inf
-//    log1pf(-inf) = QNaN 
-//    log1pf(+/-0) = +/-0 
-//    log1pf(-1) =  -inf 
-//    log1pf(SNaN) = QNaN
-//    log1pf(QNaN) = QNaN
-//    log1pf(EM_special Values) = QNaN
-//
-// *********************************************************************
-//
-// Computation is based on the following kernel.
-//
-// ker_log_64( in_FR    :  X,
-// 	    in_FR    :  E,
-// 	    in_FR    :  Em1,
-// 	    in_GR    :  Expo_Range,
-// 	    out_FR   :  Y_hi,
-// 	    out_FR   :  Y_lo,
-// 	    out_FR   :  Scale,
-// 	    out_PR   :  Safe  )
-// 
-// Overview
-//
-// The method consists of three cases.
-//
-// If	|X+Em1| < 2^(-80)	use case log1pf_small;
-// elseif	|X+Em1| < 2^(-7)	use case log_near1;
-// else				use case log_regular;
-//
-// Case log1pf_small:
-//
-// log( 1 + (X+Em1) ) can be approximated by (X+Em1).
-//
-// Case log_near1:
-//
-//   log( 1 + (X+Em1) ) can be approximated by a simple polynomial
-//   in W = X+Em1. This polynomial resembles the truncated Taylor
-//   series W - W^/2 + W^3/3 - ...
-// 
-// Case log_regular:
-//
-//   Here we use a table lookup method. The basic idea is that in
-//   order to compute log(Arg) for an argument Arg in [1,2), we 
-//   construct a value G such that G*Arg is close to 1 and that
-//   log(1/G) is obtainable easily from a table of values calculated
-//   beforehand. Thus
-//
-//	log(Arg) = log(1/G) + log(G*Arg)
-//		 = log(1/G) + log(1 + (G*Arg - 1))
-//
-//   Because |G*Arg - 1| is small, the second term on the right hand
-//   side can be approximated by a short polynomial. We elaborate
-//   this method in four steps.
-//
-//   Step 0: Initialization
-//
-//   We need to calculate log( E + X ). Obtain N, S_hi, S_lo such that
-//
-//	E + X = 2^N * ( S_hi + S_lo )	exactly
-//
-//   where S_hi in [1,2) and S_lo is a correction to S_hi in the sense
-//   that |S_lo| <= ulp(S_hi).
-//
-//   Step 1: Argument Reduction
-//
-//   Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
-//
-//	G := G_1 * G_2 * G_3
-//	r := (G * S_hi - 1)  + G * S_lo
-//
-//   These G_j's have the property that the product is exactly 
-//   representable and that |r| < 2^(-12) as a result.
-//
-//   Step 2: Approximation
-//
-//
-//   log(1 + r) is approximated by a short polynomial poly(r).
-//
-//   Step 3: Reconstruction
-//
-//
-//   Finally, log( E + X ) is given by
-//
-//   log( E + X )   =   log( 2^N * (S_hi + S_lo) )
-//                 ~=~  N*log(2) + log(1/G) + log(1 + r)
-//                 ~=~  N*log(2) + log(1/G) + poly(r).
-//
-// **** Algorithm ****
-//
-// Case log1pf_small:
-//
-// Although log(1 + (X+Em1)) is basically X+Em1, we would like to 
-// preserve the inexactness nature as well as consistent behavior
-// under different rounding modes. Note that this case can only be
-// taken if E is set to be 1.0. In this case, Em1 is zero, and that
-// X can be very tiny and thus the final result can possibly underflow.
-// Thus, we compare X against a threshold that is dependent on the
-// input Expo_Range. If |X| is smaller than this threshold, we set
-// SAFE to be FALSE. 
-//
-// The result is returned as Y_hi, Y_lo, and in the case of SAFE 
-// is FALSE, an additional value Scale is also returned. 
-//
-//	W    := X + Em1
-//      Threshold := Threshold_Table( Expo_Range )
-//      Tiny      := Tiny_Table( Expo_Range )
-//
-//      If ( |W| > Threshold ) then
-//         Y_hi  := W
-//         Y_lo  := -W*W
-//      Else
-//         Y_hi  := W
-//         Y_lo  := -Tiny
-//         Scale := 2^(-100)
-//         Safe  := FALSE
-//      EndIf
-//
-//
-// One may think that Y_lo should be -W*W/2; however, it does not matter
-// as Y_lo will be rounded off completely except for the correct effect in 
-// directed rounding. Clearly -W*W is simplier to compute. Moreover,
-// because of the difference in exponent value, Y_hi + Y_lo or 
-// Y_hi + Scale*Y_lo is always inexact.
-//
-// Case log_near1:
-//
-// Here we compute a simple polynomial. To exploit parallelism, we split
-// the polynomial into two portions.
-// 
-// 	W := X + Em1
-// 	Wsq := W * W
-// 	W4  := Wsq*Wsq
-// 	W6  := W4*Wsq
-// 	Y_hi := W + Wsq*(P_1 + W*(P_2 + W*(P_3 + W*P_4))
-// 	Y_lo := W6*(P_5 + W*(P_6 + W*(P_7 + W*P_8)))
-//      set lsb(Y_lo) to be 1
-//
-// Case log_regular:
-//
-// We present the algorithm in four steps.
-//
-//   Step 0. Initialization
-//   ----------------------
-//
-//   Z := X + E
-//   N := unbaised exponent of Z
-//   S_hi := 2^(-N) * Z
-//   S_lo := 2^(-N) * { (max(X,E)-Z) + min(X,E) }
-//
-//   Note that S_lo is always 0 for the case E = 0.
-//
-//   Step 1. Argument Reduction
-//   --------------------------
-//
-//   Let
-//
-//	Z = 2^N * S_hi = 2^N * 1.d_1 d_2 d_3 ... d_63
-//
-//   We obtain G_1, G_2, G_3 by the following steps.
-//
-//
-//	Define		X_0 := 1.d_1 d_2 ... d_14. This is extracted
-//			from S_hi.
+// log1p(x) = log(x+1)
 //
-//	Define		A_1 := 1.d_1 d_2 d_3 d_4. This is X_0 truncated
-//			to lsb = 2^(-4).
+// Overview of operation
+//==============================================================
+// Background
+// ----------
 //
-//	Define		index_1 := [ d_1 d_2 d_3 d_4 ].
+// This algorithm is based on fact that
+// log1p(x) = log(1+x) and
+// log(a b) = log(a) + log(b).
+// In our case we have 1+x = 2^N f, where 1 <= f < 2.
+// So
+//   log(1+x) = log(2^N f) = log(2^N) + log(f) = n*log(2) + log(f)
 //
-//	Fetch 		Z_1 := (1/A_1) rounded UP in fixed point with
-//	fixed point	lsb = 2^(-15).
-//			Z_1 looks like z_0.z_1 z_2 ... z_15
-//		        Note that the fetching is done using index_1.
-//			A_1 is actually not needed in the implementation
-//			and is used here only to explain how is the value
-//			Z_1 defined.
+// To calculate log(f) we do following
+//   log(f) = log(f * frcpa(f) / frcpa(f)) =
+//          = log(f * frcpa(f)) + log(1/frcpa(f))
 //
-//	Fetch		G_1 := (1/A_1) truncated to 21 sig. bits.
-//	floating pt.	Again, fetching is done using index_1. A_1
-//			explains how G_1 is defined.
+// According to definition of IA-64's frcpa instruction it's a
+// floating point that approximates 1/f using a lookup on the
+// top of 8 bits of the input number's + 1 significand with relative
+// error < 2^(-8.886). So we have following
 //
-//	Calculate	X_1 := X_0 * Z_1 truncated to lsb = 2^(-14)
-//			     = 1.0 0 0 0 d_5 ... d_14
-//			This is accomplised by integer multiplication.
-//			It is proved that X_1 indeed always begin
-//			with 1.0000 in fixed point.
+// |(1/f - frcpa(f)) / (1/f))| = |1 - f*frcpa(f)| < 1/256
 //
+// and
 //
-//	Define		A_2 := 1.0 0 0 0 d_5 d_6 d_7 d_8. This is X_1 
-//			truncated to lsb = 2^(-8). Similar to A_1,
-//			A_2 is not needed in actual implementation. It
-//			helps explain how some of the values are defined.
+// log(f) = log(f * frcpa(f)) + log(1/frcpa(f)) =
+//        = log(1 + r) + T
 //
-//	Define		index_2 := [ d_5 d_6 d_7 d_8 ].
+// The first value can be computed by polynomial P(r) approximating
+// log(1 + r) on |r| < 1/256 and the second is precomputed tabular
+// value defined by top 8 bit of f.
 //
-//	Fetch 		Z_2 := (1/A_2) rounded UP in fixed point with
-//	fixed point	lsb = 2^(-15). Fetch done using index_2.
-//			Z_2 looks like z_0.z_1 z_2 ... z_15
+// Finally we have that  log(1+x) ~ (N*log(2) + T) + P(r)
 //
-//	Fetch		G_2 := (1/A_2) truncated to 21 sig. bits.
-//	floating pt.
+// Note that if input argument is close to 0.0 (in our case it means
+// that |x| < 1/256) we can use just polynomial approximation
+// because 1+x = 2^0 * f = f = 1 + r and
+// log(1+x) = log(1 + r) ~ P(r)
 //
-//	Calculate	X_2 := X_1 * Z_2 truncated to lsb = 2^(-14)
-//			     = 1.0 0 0 0 0 0 0 0 d_9 d_10 ... d_14
-//			This is accomplised by integer multiplication.
-//			It is proved that X_2 indeed always begin
-//			with 1.00000000 in fixed point.
 //
+// Implementation
+// --------------
 //
-//	Define		A_3 := 1.0 0 0 0 0 0 0 0 d_9 d_10 d_11 d_12 d_13 1.
-//			This is 2^(-14) + X_2 truncated to lsb = 2^(-13).
+// 1. |x| >= 2^(-8), and x > -1
+//   InvX = frcpa(x+1)
+//   r = InvX*(x+1) - 1
+//   P(r) = r*((1 - A2*4) + r^2*(A3 - A4*r)) = r*P2(r),
+//   A4,A3,A2 are created with setf instruction.
+//   We use Taylor series and so A4 = 1/4, A3 = 1/3,
+//   A2 = 1/2 rounded to double.
 //
-//	Define		index_3 := [ d_9 d_10 d_11 d_12 d_13 ].
+//   N = float(n) where n is true unbiased exponent of x
 //
-//	Fetch		G_3 := (1/A_3) truncated to 21 sig. bits.
-//	floating pt.	Fetch is done using index_3.
+//   T is tabular value of log(1/frcpa(x)) calculated in quad precision
+//   and rounded to double.  To load T we get bits from 55 to 62 of register
+//   format significand as index and calculate address
+//     ad_T = table_base_addr + 8 * index
 //
-//	Compute		G := G_1 * G_2 * G_3. 
+//   L1 (log(2)) is calculated in quad precision and rounded to double;
+//   it's created with setf
 //
-//	This is done exactly since each of G_j only has 21 sig. bits.
+//   And final result = P2(r)*r + (T + N*L1)
 //
-//	Compute   
 //
-//		r := (G*S_hi - 1) + G*S_lo   using 2 FMA operations.
+// 2. 2^(-40) <= |x| < 2^(-8)
+//   r = x
+//   P(r) = r*((1 - A2*4) + r^2*(A3 - A4*r)) = r*P2(r),
+//   A4,A3,A2 are the same as in case |x| >= 1/256
 //
-//	thus, r approximates G*(S_hi+S_lo) - 1 to within a couple of 
-//	rounding errors.
+//   And final result = P2(r)*r
 //
+// 3. 0 < |x| < 2^(-40)
+//   Although log1p(x) is basically x, we would like to preserve the inexactness
+//   nature as well as consistent behavior under different rounding modes.
+//   We can do this by computing the result as
 //
-//  Step 2. Approximation
-//  ---------------------
+//     log1p(x) = x - x*x
 //
-//   This step computes an approximation to log( 1 + r ) where r is the
-//   reduced argument just obtained. It is proved that |r| <= 1.9*2^(-13);
-//   thus log(1+r) can be approximated by a short polynomial:
 //
-//	log(1+r) ~=~ poly = r + Q1 r^2 + ... + Q4 r^5
+//    Note: NaT, any NaNs, +/-INF, +/-0, negatives and unnormalized numbers are
+//          filtered and processed on special branches.
 //
+
 //
-//  Step 3. Reconstruction
-//  ----------------------
+// Special values
+//==============================================================
 //
-//   This step computes the desired result of log(X+E):
+// log1p(-1)    = -inf            // Call error support
 //
-//	log(X+E)  =   log( 2^N * (S_hi + S_lo) )
-//		  =   N*log(2) + log( S_hi + S_lo )
-//		  =   N*log(2) + log(1/G) +
-//		      log(1 + C*(S_hi+S_lo) - 1 )
+// log1p(+qnan) = +qnan
+// log1p(-qnan) = -qnan
+// log1p(+snan) = +qnan
+// log1p(-snan) = -qnan
 //
-//   log(2), log(1/G_j) are stored as pairs of (single,double) numbers:
-//   log2_hi, log2_lo, log1byGj_hi, log1byGj_lo. The high parts are
-//   single-precision numbers and the low parts are double precision
-//   numbers. These have the property that
+// log1p(x),x<-1= QNAN Indefinite // Call error support
+// log1p(-inf)  = QNAN Indefinite
+// log1p(+inf)  = +inf
+// log1p(+/-0)  = +/-0
 //
-//	N*log2_hi + SUM ( log1byGj_hi )
 //
-//   is computable exactly in double-extended precision (64 sig. bits).
-//   Finally
+// Registers used
+//==============================================================
+// Floating Point registers used:
+// f8, input
+// f7 -> f15,  f32 -> f36
 //
-//	Y_hi := N*log2_hi + SUM ( log1byGj_hi )
-//	Y_lo := poly_hi + [ poly_lo + 
-//	        ( SUM ( log1byGj_lo ) + N*log2_lo ) ]
-//      set lsb(Y_lo) to be 1
+// General registers used:
+// r8  -> r11
+// r14 -> r22
 //
+// Predicate registers used:
+// p6 -> p12
 
-#include "libm_support.h"
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// Assembly macros
+//==============================================================
+GR_TAG                 = r8
+GR_ad_T                = r9
+GR_Exp                 = r10
+GR_N                   = r11
 
-// P_7, P_6, P_5, P_4, P_3, P_2, and P_1 
+GR_signexp_x           = r14
+GR_exp_mask            = r15
+GR_exp_bias            = r16
+GR_05                  = r17
+GR_A3                  = r18
+GR_Sig                 = r19
+GR_Ind                 = r19
+GR_exp_x               = r20
+GR_Ln2                 = r21
+GR_025                 = r22
 
-.align 64
-Constants_P:
-ASM_TYPE_DIRECTIVE(Constants_P,@object)
-data4  0xEFD62B15,0xE3936754,0x00003FFB,0x00000000
-data4  0xA5E56381,0x8003B271,0x0000BFFC,0x00000000
-data4  0x73282DB0,0x9249248C,0x00003FFC,0x00000000
-data4  0x47305052,0xAAAAAA9F,0x0000BFFC,0x00000000
-data4  0xCCD17FC9,0xCCCCCCCC,0x00003FFC,0x00000000
-data4  0x00067ED5,0x80000000,0x0000BFFD,0x00000000
-data4  0xAAAAAAAA,0xAAAAAAAA,0x00003FFD,0x00000000
-data4  0xFFFFFFFE,0xFFFFFFFF,0x0000BFFD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_P)
- 
-// log2_hi, log2_lo, Q_4, Q_3, Q_2, and Q_1 
 
-.align 64
-Constants_Q:
-ASM_TYPE_DIRECTIVE(Constants_Q,@object)
-data4  0x00000000,0xB1721800,0x00003FFE,0x00000000 
-data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
-data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000
-data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000
-data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000
-data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_Q)
- 
-// Z1 - 16 bit fixed, G1 and H1 - IEEE single 
- 
-.align 64
-Constants_Z_G_H_h1:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h1,@object)
-data4  0x00008000,0x3F800000,0x00000000,0x00000000,0x00000000,0x00000000
-data4  0x00007879,0x3F70F0F0,0x3D785196,0x00000000,0x617D741C,0x3DA163A6
-data4  0x000071C8,0x3F638E38,0x3DF13843,0x00000000,0xCBD3D5BB,0x3E2C55E6
-data4  0x00006BCB,0x3F579430,0x3E2FF9A0,0x00000000,0xD86EA5E7,0xBE3EB0BF
-data4  0x00006667,0x3F4CCCC8,0x3E647FD6,0x00000000,0x86B12760,0x3E2E6A8C
-data4  0x00006187,0x3F430C30,0x3E8B3AE7,0x00000000,0x5C0739BA,0x3E47574C
-data4  0x00005D18,0x3F3A2E88,0x3EA30C68,0x00000000,0x13E8AF2F,0x3E20E30F
-data4  0x0000590C,0x3F321640,0x3EB9CEC8,0x00000000,0xF2C630BD,0xBE42885B
-data4  0x00005556,0x3F2AAAA8,0x3ECF9927,0x00000000,0x97E577C6,0x3E497F34
-data4  0x000051EC,0x3F23D708,0x3EE47FC5,0x00000000,0xA6B0A5AB,0x3E3E6A6E
-data4  0x00004EC5,0x3F1D89D8,0x3EF8947D,0x00000000,0xD328D9BE,0xBDF43E3C
-data4  0x00004BDB,0x3F17B420,0x3F05F3A1,0x00000000,0x0ADB090A,0x3E4094C3
-data4  0x00004925,0x3F124920,0x3F0F4303,0x00000000,0xFC1FE510,0xBE28FBB2
-data4  0x0000469F,0x3F0D3DC8,0x3F183EBF,0x00000000,0x10FDE3FA,0x3E3A7895
-data4  0x00004445,0x3F088888,0x3F20EC80,0x00000000,0x7CC8C98F,0x3E508CE5
-data4  0x00004211,0x3F042108,0x3F29516A,0x00000000,0xA223106C,0xBE534874
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h1)
- 
-// Z2 - 16 bit fixed, G2 and H2 - IEEE single 
+GR_SAVE_B0             = r33
+GR_SAVE_PFS            = r34
+GR_SAVE_GP             = r35
+GR_SAVE_SP             = r36
 
-.align 64 
-Constants_Z_G_H_h2:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h2,@object)
-data4  0x00008000,0x3F800000,0x00000000,0x00000000,0x00000000,0x00000000
-data4  0x00007F81,0x3F7F00F8,0x3B7F875D,0x00000000,0x22C42273,0x3DB5A116
-data4  0x00007F02,0x3F7E03F8,0x3BFF015B,0x00000000,0x21F86ED3,0x3DE620CF
-data4  0x00007E85,0x3F7D08E0,0x3C3EE393,0x00000000,0x484F34ED,0xBDAFA07E
-data4  0x00007E08,0x3F7C0FC0,0x3C7E0586,0x00000000,0x3860BCF6,0xBDFE07F0
-data4  0x00007D8D,0x3F7B1880,0x3C9E75D2,0x00000000,0xA78093D6,0x3DEA370F
-data4  0x00007D12,0x3F7A2328,0x3CBDC97A,0x00000000,0x72A753D0,0x3DFF5791
-data4  0x00007C98,0x3F792FB0,0x3CDCFE47,0x00000000,0xA7EF896B,0x3DFEBE6C
-data4  0x00007C20,0x3F783E08,0x3CFC15D0,0x00000000,0x409ECB43,0x3E0CF156
-data4  0x00007BA8,0x3F774E38,0x3D0D874D,0x00000000,0xFFEF71DF,0xBE0B6F97
-data4  0x00007B31,0x3F766038,0x3D1CF49B,0x00000000,0x5D59EEE8,0xBE080483
-data4  0x00007ABB,0x3F757400,0x3D2C531D,0x00000000,0xA9192A74,0x3E1F91E9
-data4  0x00007A45,0x3F748988,0x3D3BA322,0x00000000,0xBF72A8CD,0xBE139A06
-data4  0x000079D1,0x3F73A0D0,0x3D4AE46F,0x00000000,0xF8FBA6CF,0x3E1D9202
-data4  0x0000795D,0x3F72B9D0,0x3D5A1756,0x00000000,0xBA796223,0xBE1DCCC4
-data4  0x000078EB,0x3F71D488,0x3D693B9D,0x00000000,0xB6B7C239,0xBE049391
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h2)
- 
-// G3 and H3 - IEEE single and h3 -IEEE double 
+GR_Parameter_X         = r37
+GR_Parameter_Y         = r38
+GR_Parameter_RESULT    = r39
+GR_Parameter_TAG       = r40
 
-.align 64 
-Constants_Z_G_H_h3:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h3,@object)
-data4  0x3F7FFC00,0x38800100,0x562224CD,0x3D355595
-data4  0x3F7FF400,0x39400480,0x06136FF6,0x3D8200A2
-data4  0x3F7FEC00,0x39A00640,0xE8DE9AF0,0x3DA4D68D
-data4  0x3F7FE400,0x39E00C41,0xB10238DC,0xBD8B4291
-data4  0x3F7FDC00,0x3A100A21,0x3B1952CA,0xBD89CCB8
-data4  0x3F7FD400,0x3A300F22,0x1DC46826,0xBDB10707
-data4  0x3F7FCC08,0x3A4FF51C,0xF43307DB,0x3DB6FCB9
-data4  0x3F7FC408,0x3A6FFC1D,0x62DC7872,0xBD9B7C47
-data4  0x3F7FBC10,0x3A87F20B,0x3F89154A,0xBDC3725E
-data4  0x3F7FB410,0x3A97F68B,0x62B9D392,0xBD93519D
-data4  0x3F7FAC18,0x3AA7EB86,0x0F21BD9D,0x3DC18441
-data4  0x3F7FA420,0x3AB7E101,0x2245E0A6,0xBDA64B95
-data4  0x3F7F9C20,0x3AC7E701,0xAABB34B8,0x3DB4B0EC
-data4  0x3F7F9428,0x3AD7DD7B,0x6DC40A7E,0x3D992337
-data4  0x3F7F8C30,0x3AE7D474,0x4F2083D3,0x3DC6E17B
-data4  0x3F7F8438,0x3AF7CBED,0x811D4394,0x3DAE314B
-data4  0x3F7F7C40,0x3B03E1F3,0xB08F2DB1,0xBDD46F21
-data4  0x3F7F7448,0x3B0BDE2F,0x6D34522B,0xBDDC30A4
-data4  0x3F7F6C50,0x3B13DAAA,0xB1F473DB,0x3DCB0070
-data4  0x3F7F6458,0x3B1BD766,0x6AD282FD,0xBDD65DDC
-data4  0x3F7F5C68,0x3B23CC5C,0xF153761A,0xBDCDAB83
-data4  0x3F7F5470,0x3B2BC997,0x341D0F8F,0xBDDADA40
-data4  0x3F7F4C78,0x3B33C711,0xEBC394E8,0x3DCD1BD7
-data4  0x3F7F4488,0x3B3BBCC6,0x52E3E695,0xBDC3532B
-data4  0x3F7F3C90,0x3B43BAC0,0xE846B3DE,0xBDA3961E
-data4  0x3F7F34A0,0x3B4BB0F4,0x785778D4,0xBDDADF06
-data4  0x3F7F2CA8,0x3B53AF6D,0xE55CE212,0x3DCC3ED1
-data4  0x3F7F24B8,0x3B5BA620,0x9E382C15,0xBDBA3103
-data4  0x3F7F1CC8,0x3B639D12,0x5C5AF197,0x3D635A0B
-data4  0x3F7F14D8,0x3B6B9444,0x71D34EFC,0xBDDCCB19
-data4  0x3F7F0CE0,0x3B7393BC,0x52CD7ADA,0x3DC74502
-data4  0x3F7F04F0,0x3B7B8B6D,0x7D7F2A42,0xBDB68F17
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h3)
- 
-// 
-//  Exponent Thresholds and Tiny Thresholds
-//  for 8, 11, 15, and 17 bit exponents
-// 
-//  Expo_Range             Value
-// 
-//  0 (8  bits)            2^(-126)
-//  1 (11 bits)            2^(-1022)
-//  2 (15 bits)            2^(-16382)
-//  3 (17 bits)            2^(-16382)
-// 
-//  Tiny_Table
-//  ----------
-//  Expo_Range             Value
-// 
-//  0 (8  bits)            2^(-16382)
-//  1 (11 bits)            2^(-16382)
-//  2 (15 bits)            2^(-16382)
-//  3 (17 bits)            2^(-16382)
-// 
 
-.align 64 
-Constants_Threshold:
-ASM_TYPE_DIRECTIVE(Constants_Threshold,@object)
-data4  0x00000000,0x80000000,0x00003F81,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00003C01,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_Threshold)
 
-.align 64
-Constants_1_by_LN10:
-ASM_TYPE_DIRECTIVE(Constants_1_by_LN10,@object)
-data4  0x37287195,0xDE5BD8A9,0x00003FFD,0x00000000
-data4  0xACCF70C8,0xD56EAABE,0x00003FBD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_1_by_LN10)
+FR_NormX               = f7
+FR_RcpX                = f9
+FR_r                   = f10
+FR_r2                  = f11
+FR_r4                  = f12
+FR_N                   = f13
+FR_Ln2                 = f14
+FR_Xp1                 = f15
 
-FR_Input_X = f8 
-FR_Neg_One = f9
-FR_E       = f33
-FR_Em1     = f34
-FR_Y_hi    = f34  
-// Shared with Em1
-FR_Y_lo    = f35
-FR_Scale   = f36
-FR_X_Prime = f37 
-FR_Z       = f38 
-FR_S_hi    = f38  
-// Shared with Z  
-FR_W       = f39
-FR_G       = f40
-FR_wsq     = f40 
-// Shared with G 
-FR_H       = f41
-FR_w4      = f41
-// Shared with H  
-FR_h       = f42
-FR_w6      = f42  
-// Shared with h     
-FR_G_tmp   = f43
-FR_poly_lo = f43
-// Shared with G_tmp 
-FR_P8      = f43  
-// Shared with G_tmp 
-FR_H_tmp   = f44
-FR_poly_hi = f44
-  // Shared with H_tmp
-FR_P7      = f44  
-// Shared with H_tmp
-FR_h_tmp   = f45 
-FR_rsq     = f45  
-// Shared with h_tmp
-FR_P6      = f45
-// Shared with h_tmp
-FR_abs_W   = f46
-FR_r       = f46  
-// Shared with abs_W  
-FR_AA      = f47 
-FR_log2_hi = f47  
-// Shared with AA  
-FR_BB          = f48
-FR_log2_lo     = f48  
-// Shared with BB  
-FR_S_lo        = f49 
-FR_two_negN    = f50  
-FR_float_N     = f51 
-FR_Q4          = f52 
-FR_dummy       = f52  
-// Shared with Q4
-FR_P4          = f52  
-// Shared with Q4
-FR_Threshold    = f52
-// Shared with Q4
-FR_Q3          = f53  
-FR_P3          = f53  
-// Shared with Q3
-FR_Tiny        = f53  
-// Shared with Q3
-FR_Q2          = f54 
-FR_P2          = f54  
-// Shared with Q2
-FR_1LN10_hi     = f54 
-// Shared with Q2
-FR_Q1           = f55 
-FR_P1           = f55 
-// Shared with Q1 
-FR_1LN10_lo     = f55 
-// Shared with Q1 
-FR_P5           = f98 
-FR_SCALE        = f98 
-FR_Output_X_tmp = f99 
+FR_A4                  = f33
+FR_A3                  = f34
+FR_A2                  = f35
 
-GR_Expo_Range   = r32
-GR_Table_Base   = r34
-GR_Table_Base1  = r35
-GR_Table_ptr    = r36 
-GR_Index2       = r37 
-GR_signif       = r38 
-GR_X_0          = r39 
-GR_X_1          = r40 
-GR_X_2          = r41 
-GR_Z_1          = r42 
-GR_Z_2          = r43 
-GR_N            = r44 
-GR_Bias         = r45 
-GR_M            = r46 
-GR_ScaleN       = r47  
-GR_Index3       = r48 
-GR_Perturb      = r49 
-GR_Table_Scale  = r50 
+FR_T                   = f36
+FR_NxLn2pT             = f36
 
 
-GR_SAVE_PFS     = r51
-GR_SAVE_B0      = r52
-GR_SAVE_GP      = r53
 
-GR_Parameter_X       = r54
-GR_Parameter_Y       = r55
-GR_Parameter_RESULT  = r56
+FR_Y                   = f1
+FR_X                   = f10
+FR_RESULT              = f8
 
-GR_Parameter_TAG = r57 
 
+// Data
+//==============================================================
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(log_data)
+// ln(1/frcpa(1+i/256)), i=0...255
+data8 0x3F60040155D5889E // 0
+data8 0x3F78121214586B54 // 1
+data8 0x3F841929F96832F0 // 2
+data8 0x3F8C317384C75F06 // 3
+data8 0x3F91A6B91AC73386 // 4
+data8 0x3F95BA9A5D9AC039 // 5
+data8 0x3F99D2A8074325F4 // 6
+data8 0x3F9D6B2725979802 // 7
+data8 0x3FA0C58FA19DFAAA // 8
+data8 0x3FA2954C78CBCE1B // 9
+data8 0x3FA4A94D2DA96C56 // 10
+data8 0x3FA67C94F2D4BB58 // 11
+data8 0x3FA85188B630F068 // 12
+data8 0x3FAA6B8ABE73AF4C // 13
+data8 0x3FAC441E06F72A9E // 14
+data8 0x3FAE1E6713606D07 // 15
+data8 0x3FAFFA6911AB9301 // 16
+data8 0x3FB0EC139C5DA601 // 17
+data8 0x3FB1DBD2643D190B // 18
+data8 0x3FB2CC7284FE5F1C // 19
+data8 0x3FB3BDF5A7D1EE64 // 20
+data8 0x3FB4B05D7AA012E0 // 21
+data8 0x3FB580DB7CEB5702 // 22
+data8 0x3FB674F089365A7A // 23
+data8 0x3FB769EF2C6B568D // 24
+data8 0x3FB85FD927506A48 // 25
+data8 0x3FB9335E5D594989 // 26
+data8 0x3FBA2B0220C8E5F5 // 27
+data8 0x3FBB0004AC1A86AC // 28
+data8 0x3FBBF968769FCA11 // 29
+data8 0x3FBCCFEDBFEE13A8 // 30
+data8 0x3FBDA727638446A2 // 31
+data8 0x3FBEA3257FE10F7A // 32
+data8 0x3FBF7BE9FEDBFDE6 // 33
+data8 0x3FC02AB352FF25F4 // 34
+data8 0x3FC097CE579D204D // 35
+data8 0x3FC1178E8227E47C // 36
+data8 0x3FC185747DBECF34 // 37
+data8 0x3FC1F3B925F25D41 // 38
+data8 0x3FC2625D1E6DDF57 // 39
+data8 0x3FC2D1610C86813A // 40
+data8 0x3FC340C59741142E // 41
+data8 0x3FC3B08B6757F2A9 // 42
+data8 0x3FC40DFB08378003 // 43
+data8 0x3FC47E74E8CA5F7C // 44
+data8 0x3FC4EF51F6466DE4 // 45
+data8 0x3FC56092E02BA516 // 46
+data8 0x3FC5D23857CD74D5 // 47
+data8 0x3FC6313A37335D76 // 48
+data8 0x3FC6A399DABBD383 // 49
+data8 0x3FC70337DD3CE41B // 50
+data8 0x3FC77654128F6127 // 51
+data8 0x3FC7E9D82A0B022D // 52
+data8 0x3FC84A6B759F512F // 53
+data8 0x3FC8AB47D5F5A310 // 54
+data8 0x3FC91FE49096581B // 55
+data8 0x3FC981634011AA75 // 56
+data8 0x3FC9F6C407089664 // 57
+data8 0x3FCA58E729348F43 // 58
+data8 0x3FCABB55C31693AD // 59
+data8 0x3FCB1E104919EFD0 // 60
+data8 0x3FCB94EE93E367CB // 61
+data8 0x3FCBF851C067555F // 62
+data8 0x3FCC5C0254BF23A6 // 63
+data8 0x3FCCC000C9DB3C52 // 64
+data8 0x3FCD244D99C85674 // 65
+data8 0x3FCD88E93FB2F450 // 66
+data8 0x3FCDEDD437EAEF01 // 67
+data8 0x3FCE530EFFE71012 // 68
+data8 0x3FCEB89A1648B971 // 69
+data8 0x3FCF1E75FADF9BDE // 70
+data8 0x3FCF84A32EAD7C35 // 71
+data8 0x3FCFEB2233EA07CD // 72
+data8 0x3FD028F9C7035C1C // 73
+data8 0x3FD05C8BE0D9635A // 74
+data8 0x3FD085EB8F8AE797 // 75
+data8 0x3FD0B9C8E32D1911 // 76
+data8 0x3FD0EDD060B78081 // 77
+data8 0x3FD122024CF0063F // 78
+data8 0x3FD14BE2927AECD4 // 79
+data8 0x3FD180618EF18ADF // 80
+data8 0x3FD1B50BBE2FC63B // 81
+data8 0x3FD1DF4CC7CF242D // 82
+data8 0x3FD214456D0EB8D4 // 83
+data8 0x3FD23EC5991EBA49 // 84
+data8 0x3FD2740D9F870AFB // 85
+data8 0x3FD29ECDABCDFA04 // 86
+data8 0x3FD2D46602ADCCEE // 87
+data8 0x3FD2FF66B04EA9D4 // 88
+data8 0x3FD335504B355A37 // 89
+data8 0x3FD360925EC44F5D // 90
+data8 0x3FD38BF1C3337E75 // 91
+data8 0x3FD3C25277333184 // 92
+data8 0x3FD3EDF463C1683E // 93
+data8 0x3FD419B423D5E8C7 // 94
+data8 0x3FD44591E0539F49 // 95
+data8 0x3FD47C9175B6F0AD // 96
+data8 0x3FD4A8B341552B09 // 97
+data8 0x3FD4D4F3908901A0 // 98
+data8 0x3FD501528DA1F968 // 99
+data8 0x3FD52DD06347D4F6 // 100
+data8 0x3FD55A6D3C7B8A8A // 101
+data8 0x3FD5925D2B112A59 // 102
+data8 0x3FD5BF406B543DB2 // 103
+data8 0x3FD5EC433D5C35AE // 104
+data8 0x3FD61965CDB02C1F // 105
+data8 0x3FD646A84935B2A2 // 106
+data8 0x3FD6740ADD31DE94 // 107
+data8 0x3FD6A18DB74A58C5 // 108
+data8 0x3FD6CF31058670EC // 109
+data8 0x3FD6F180E852F0BA // 110
+data8 0x3FD71F5D71B894F0 // 111
+data8 0x3FD74D5AEFD66D5C // 112
+data8 0x3FD77B79922BD37E // 113
+data8 0x3FD7A9B9889F19E2 // 114
+data8 0x3FD7D81B037EB6A6 // 115
+data8 0x3FD8069E33827231 // 116
+data8 0x3FD82996D3EF8BCB // 117
+data8 0x3FD85855776DCBFB // 118
+data8 0x3FD8873658327CCF // 119
+data8 0x3FD8AA75973AB8CF // 120
+data8 0x3FD8D992DC8824E5 // 121
+data8 0x3FD908D2EA7D9512 // 122
+data8 0x3FD92C59E79C0E56 // 123
+data8 0x3FD95BD750EE3ED3 // 124
+data8 0x3FD98B7811A3EE5B // 125
+data8 0x3FD9AF47F33D406C // 126
+data8 0x3FD9DF270C1914A8 // 127
+data8 0x3FDA0325ED14FDA4 // 128
+data8 0x3FDA33440224FA79 // 129
+data8 0x3FDA57725E80C383 // 130
+data8 0x3FDA87D0165DD199 // 131
+data8 0x3FDAAC2E6C03F896 // 132
+data8 0x3FDADCCC6FDF6A81 // 133
+data8 0x3FDB015B3EB1E790 // 134
+data8 0x3FDB323A3A635948 // 135
+data8 0x3FDB56FA04462909 // 136
+data8 0x3FDB881AA659BC93 // 137
+data8 0x3FDBAD0BEF3DB165 // 138
+data8 0x3FDBD21297781C2F // 139
+data8 0x3FDC039236F08819 // 140
+data8 0x3FDC28CB1E4D32FD // 141
+data8 0x3FDC4E19B84723C2 // 142
+data8 0x3FDC7FF9C74554C9 // 143
+data8 0x3FDCA57B64E9DB05 // 144
+data8 0x3FDCCB130A5CEBB0 // 145
+data8 0x3FDCF0C0D18F326F // 146
+data8 0x3FDD232075B5A201 // 147
+data8 0x3FDD490246DEFA6B // 148
+data8 0x3FDD6EFA918D25CD // 149
+data8 0x3FDD9509707AE52F // 150
+data8 0x3FDDBB2EFE92C554 // 151
+data8 0x3FDDEE2F3445E4AF // 152
+data8 0x3FDE148A1A2726CE // 153
+data8 0x3FDE3AFC0A49FF40 // 154
+data8 0x3FDE6185206D516E // 155
+data8 0x3FDE882578823D52 // 156
+data8 0x3FDEAEDD2EAC990C // 157
+data8 0x3FDED5AC5F436BE3 // 158
+data8 0x3FDEFC9326D16AB9 // 159
+data8 0x3FDF2391A2157600 // 160
+data8 0x3FDF4AA7EE03192D // 161
+data8 0x3FDF71D627C30BB0 // 162
+data8 0x3FDF991C6CB3B379 // 163
+data8 0x3FDFC07ADA69A910 // 164
+data8 0x3FDFE7F18EB03D3E // 165
+data8 0x3FE007C053C5002E // 166
+data8 0x3FE01B942198A5A1 // 167
+data8 0x3FE02F74400C64EB // 168
+data8 0x3FE04360BE7603AD // 169
+data8 0x3FE05759AC47FE34 // 170
+data8 0x3FE06B5F1911CF52 // 171
+data8 0x3FE078BF0533C568 // 172
+data8 0x3FE08CD9687E7B0E // 173
+data8 0x3FE0A10074CF9019 // 174
+data8 0x3FE0B5343A234477 // 175
+data8 0x3FE0C974C89431CE // 176
+data8 0x3FE0DDC2305B9886 // 177
+data8 0x3FE0EB524BAFC918 // 178
+data8 0x3FE0FFB54213A476 // 179
+data8 0x3FE114253DA97D9F // 180
+data8 0x3FE128A24F1D9AFF // 181
+data8 0x3FE1365252BF0865 // 182
+data8 0x3FE14AE558B4A92D // 183
+data8 0x3FE15F85A19C765B // 184
+data8 0x3FE16D4D38C119FA // 185
+data8 0x3FE18203C20DD133 // 186
+data8 0x3FE196C7BC4B1F3B // 187
+data8 0x3FE1A4A738B7A33C // 188
+data8 0x3FE1B981C0C9653D // 189
+data8 0x3FE1CE69E8BB106B // 190
+data8 0x3FE1DC619DE06944 // 191
+data8 0x3FE1F160A2AD0DA4 // 192
+data8 0x3FE2066D7740737E // 193
+data8 0x3FE2147DBA47A394 // 194
+data8 0x3FE229A1BC5EBAC3 // 195
+data8 0x3FE237C1841A502E // 196
+data8 0x3FE24CFCE6F80D9A // 197
+data8 0x3FE25B2C55CD5762 // 198
+data8 0x3FE2707F4D5F7C41 // 199
+data8 0x3FE285E0842CA384 // 200
+data8 0x3FE294294708B773 // 201
+data8 0x3FE2A9A2670AFF0C // 202
+data8 0x3FE2B7FB2C8D1CC1 // 203
+data8 0x3FE2C65A6395F5F5 // 204
+data8 0x3FE2DBF557B0DF43 // 205
+data8 0x3FE2EA64C3F97655 // 206
+data8 0x3FE3001823684D73 // 207
+data8 0x3FE30E97E9A8B5CD // 208
+data8 0x3FE32463EBDD34EA // 209
+data8 0x3FE332F4314AD796 // 210
+data8 0x3FE348D90E7464D0 // 211
+data8 0x3FE35779F8C43D6E // 212
+data8 0x3FE36621961A6A99 // 213
+data8 0x3FE37C299F3C366A // 214
+data8 0x3FE38AE2171976E7 // 215
+data8 0x3FE399A157A603E7 // 216
+data8 0x3FE3AFCCFE77B9D1 // 217
+data8 0x3FE3BE9D503533B5 // 218
+data8 0x3FE3CD7480B4A8A3 // 219
+data8 0x3FE3E3C43918F76C // 220
+data8 0x3FE3F2ACB27ED6C7 // 221
+data8 0x3FE4019C2125CA93 // 222
+data8 0x3FE4181061389722 // 223
+data8 0x3FE42711518DF545 // 224
+data8 0x3FE436194E12B6BF // 225
+data8 0x3FE445285D68EA69 // 226
+data8 0x3FE45BCC464C893A // 227
+data8 0x3FE46AED21F117FC // 228
+data8 0x3FE47A1527E8A2D3 // 229
+data8 0x3FE489445EFFFCCC // 230
+data8 0x3FE4A018BCB69835 // 231
+data8 0x3FE4AF5A0C9D65D7 // 232
+data8 0x3FE4BEA2A5BDBE87 // 233
+data8 0x3FE4CDF28F10AC46 // 234
+data8 0x3FE4DD49CF994058 // 235
+data8 0x3FE4ECA86E64A684 // 236
+data8 0x3FE503C43CD8EB68 // 237
+data8 0x3FE513356667FC57 // 238
+data8 0x3FE522AE0738A3D8 // 239
+data8 0x3FE5322E26867857 // 240
+data8 0x3FE541B5CB979809 // 241
+data8 0x3FE55144FDBCBD62 // 242
+data8 0x3FE560DBC45153C7 // 243
+data8 0x3FE5707A26BB8C66 // 244
+data8 0x3FE587F60ED5B900 // 245
+data8 0x3FE597A7977C8F31 // 246
+data8 0x3FE5A760D634BB8B // 247
+data8 0x3FE5B721D295F10F // 248
+data8 0x3FE5C6EA94431EF9 // 249
+data8 0x3FE5D6BB22EA86F6 // 250
+data8 0x3FE5E6938645D390 // 251
+data8 0x3FE5F673C61A2ED2 // 252
+data8 0x3FE6065BEA385926 // 253
+data8 0x3FE6164BFA7CC06B // 254
+data8 0x3FE62643FECF9743 // 255
+LOCAL_OBJECT_END(log_data)
+
+
+// Code
+//==============================================================
 
 .section .text
-.proc log1pf#
-.global log1pf#
-.align 64 
-log1pf:
-#ifdef _LIBC
-.global __log1pf
-__log1pf:
-#endif
-
-{ .mfi
-alloc r32 = ar.pfs,0,22,4,0
-(p0)  fsub.s1 FR_Neg_One = f0,f1 
-(p0)  cmp.eq.unc  p7, p0 = r0, r0 
-}
-
+GLOBAL_IEEE754_ENTRY(log1pf)
 { .mfi
-(p0)  cmp.ne.unc  p14, p0 = r0, r0 
-(p0)  fnorm.s1 FR_X_Prime = FR_Input_X 
-(p0)  cmp.eq.unc  p15, p0 = r0, r0 ;; 
+      getf.exp      GR_signexp_x = f8 // if x is unorm then must recompute
+      fadd.s1       FR_Xp1 = f8, f1       // Form 1+x
+      mov           GR_05 = 0xfffe
 }
-
-{ .mfi
-      nop.m 999
-(p0)  fclass.m.unc p6, p0 =  FR_Input_X, 0x1E3 
-      nop.i 999
+{ .mlx
+      addl          GR_ad_T = @ltoff(log_data),gp
+      movl          GR_A3 = 0x3fd5555555555555 // double precision memory
+                                               // representation of A3
 }
 ;;
 
 { .mfi
-	nop.m 999
-(p0)  fclass.nm.unc p10, p0 =  FR_Input_X, 0x1FF 
-      nop.i 999
+      ld8           GR_ad_T = [GR_ad_T]
+      fclass.m      p8,p0 = f8,0xb // Is x unorm?
+      mov           GR_exp_mask = 0x1ffff
 }
-;;
-
 { .mfi
-	nop.m 999
-(p0)  fcmp.eq.unc.s1 p9, p0 =  FR_Input_X, f0 
-      nop.i 999
+      mov           GR_025 = 0xfffd            // Exponent of 0.25
+      fnorm.s1      FR_NormX = f8              // Normalize x
+      mov           GR_exp_bias = 0xffff
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fadd FR_Em1 = f0,f0 
-	nop.i 999 ;;
+      setf.exp      FR_A2 = GR_05 // create A2 = 0.5
+      fclass.m      p9,p0 = f8,0x1E1 // is x NaN, NaT or +Inf?
+      nop.i         0
 }
-
-{ .mfi
-	nop.m 999
-(p0)  fadd FR_E = f0,f1 
-	nop.i 999 ;;
+{ .mib
+      setf.d        FR_A3 = GR_A3 // create A3
+      nop.i         0
+(p8)  br.cond.spnt  log1p_unorm          // Branch if x=unorm
 }
+;;
 
+log1p_common:
 { .mfi
-	nop.m 999
-(p0)  fcmp.eq.unc.s1 p8, p0 =  FR_Input_X, FR_Neg_One 
-	nop.i 999
+      setf.exp      FR_A4 = GR_025 // create A4 = 0.25
+      frcpa.s1      FR_RcpX,p0 = f1,FR_Xp1
+      nop.i         0
 }
-
-{ .mfi
-	nop.m 999
-(p0)  fcmp.lt.unc.s1 p13, p0 =  FR_Input_X, FR_Neg_One 
-	nop.i 999
+{ .mfb
+      nop.m         0
+(p9)  fma.s.s0      f8 = f8,f1,f0 // set V-flag
+(p9)  br.ret.spnt   b0 // exit for NaN, NaT and +Inf
 }
-
-
-L(LOG_BEGIN): 
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_Z = FR_X_Prime, FR_E 
-	nop.i 999
+      getf.exp      GR_Exp = FR_Xp1            // signexp of x+1
+      fclass.m      p10,p0 = FR_Xp1,0x3A // is 1+x < 0?
+      and           GR_exp_x = GR_exp_mask, GR_signexp_x // biased exponent of x
 }
-
 { .mlx
-	nop.m 999
-(p0)  movl GR_Table_Scale = 0x0000000000000018 ;; 
-}
-
-{ .mmi
-	nop.m 999
-//     
-//    Create E = 1 and Em1 = 0 
-//    Check for X == 0, meaning log(1+0)
-//    Check for X < -1, meaning log(negative)
-//    Check for X == -1, meaning log(0)
-//    Normalize x 
-//    Identify NatVals, NaNs, Infs. 
-//    Identify EM unsupporteds. 
-//    Identify Negative values - us S1 so as
-//    not to raise denormal operand exception 
-//    Set p15 to true for log1pf
-//    Set p14 to false for log1pf
-//    Set p7 true for log and log1pf
-//    
-(p0)  addl GR_Table_Base = @ltoff(Constants_Z_G_H_h1#),gp
-      nop.i  999
+      nop.m         0
+      movl          GR_Ln2 = 0x3FE62E42FEFA39EF // double precision memory
+                                                // representation of log(2)
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fmax.s1 FR_AA = FR_X_Prime, FR_E 
-	nop.i 999 ;;
+      getf.sig      GR_Sig = FR_Xp1 // get significand to calculate index
+                                    // for T if |x| >= 2^-8
+      fcmp.eq.s1    p12,p0 = f8,f0     // is x equal to 0?
+      sub           GR_exp_x = GR_exp_x, GR_exp_bias // true exponent of x
 }
+;;
 
 { .mfi
-      ld8    GR_Table_Base = [GR_Table_Base]
-(p0)  fmin.s1 FR_BB = FR_X_Prime, FR_E 
-	nop.i 999
+      sub           GR_N = GR_Exp,GR_exp_bias // true exponent of x+1
+      fcmp.eq.s1    p11,p0 = FR_Xp1,f0     // is x = -1?
+      cmp.gt        p6,p7 = -8, GR_exp_x  // Is |x| < 2^-8
 }
-
 { .mfb
-	nop.m 999
-(p0)  fadd.s1 FR_W = FR_X_Prime, FR_Em1 
-//     
-//    Begin load of constants base
-//    FR_Z = Z = |x| + E 
-//    FR_W = W = |x| + Em1
-//    AA = fmax(|x|,E)
-//    BB = fmin(|x|,E)
-//
-(p6)  br.cond.spnt L(LOG_64_special) ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p10) br.cond.spnt L(LOG_64_unsupported) ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p13) br.cond.spnt L(LOG_64_negative) ;; 
-}
-
-{ .mib
-(p0)  getf.sig GR_signif = FR_Z 
-	nop.i 999
-(p9)  br.cond.spnt L(LOG_64_one) ;; 
-}
-
-{ .mib
-	nop.m 999
-	nop.i 999
-(p8)  br.cond.spnt L(LOG_64_zero) ;; 
-}
-
-{ .mfi
-(p0)  getf.exp GR_N =  FR_Z 
-//   
-//    Raise possible denormal operand exception 
-//    Create Bias
-// 
-//    This function computes ln( x + e ) 
-//    Input  FR 1: FR_X   = FR_Input_X          
-//    Input  FR 2: FR_E   = FR_E
-//    Input  FR 3: FR_Em1 = FR_Em1 
-//    Input  GR 1: GR_Expo_Range = GR_Expo_Range = 1
-//    Output FR 4: FR_Y_hi  
-//    Output FR 5: FR_Y_lo  
-//    Output FR 6: FR_Scale  
-//    Output PR 7: PR_Safe  
-//
-(p0)  fsub.s1 FR_S_lo = FR_AA, FR_Z 
-//
-//    signif = getf.sig(Z)
-//    abs_W = fabs(w)
-//
-(p0)  extr.u GR_Table_ptr = GR_signif, 59, 4 ;; 
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fmerge.se FR_S_hi =  f1,FR_Z 
-(p0)  extr.u GR_X_0 = GR_signif, 49, 15  
-}
-
-{ .mmi
-      nop.m 999
-(p0)  addl GR_Table_Base1 = @ltoff(Constants_Z_G_H_h2#),gp  
-      nop.i 999
+      nop.m         0
+      nop.f         0
+(p10) br.cond.spnt  log1p_lt_minus_1   // jump if x < -1
 }
 ;;
 
-{ .mlx
-      ld8    GR_Table_Base1 = [GR_Table_Base1]
-(p0)  movl GR_Bias = 0x000000000000FFFF ;; 
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fabs FR_abs_W =  FR_W 
-(p0)  pmpyshr2.u GR_Table_ptr = GR_Table_ptr,GR_Table_Scale,0 
-}
-
-{ .mfi
-	nop.m 999
-//    
-//    Branch out for special input values 
-//    
-(p0)  fcmp.lt.unc.s0 p8, p0 =  FR_Input_X, f0 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    X_0 = extr.u(signif,49,15)
-//    Index1 = extr.u(signif,59,4)
-//
-(p0)  fadd.s1 FR_S_lo = FR_S_lo, FR_BB 
-	nop.i 999 ;;
-}
-
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    Offset_to_Z1 = 24 * Index1
-//    For performance, don't use result
-//    for 3 or 4 cycles.
-//
-(p0)  add GR_Table_ptr = GR_Table_ptr, GR_Table_Base ;; 
-}
-//
-//    Add Base to Offset for Z1
-//    Create Bias
-
-{ .mmi
-(p0)  ld4 GR_Z_1 = [GR_Table_ptr],4 ;; 
-(p0)  ldfs  FR_G = [GR_Table_ptr],4 
-	nop.i 999 ;;
-}
-
-{ .mmi
-(p0)  ldfs  FR_H = [GR_Table_ptr],8 ;; 
-(p0)  ldfd  FR_h = [GR_Table_ptr],0 
-(p0)  pmpyshr2.u GR_X_1 = GR_X_0,GR_Z_1,15 
-}
-//
-//    Load Z_1 
-//    Get Base of Table2 
-//
-
+// p6 is true if |x| < 1/256
+// p7 is true if |x| >= 1/256
+.pred.rel "mutex",p6,p7
 { .mfi
-(p0)  getf.exp GR_M = FR_abs_W 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    M = getf.exp(abs_W)
-//    S_lo = AA - Z
-//    X_1 = pmpyshr2(X_0,Z_1,15)
-//
-(p0)  sub GR_M = GR_M, GR_Bias ;; 
+      nop.m         0
+(p6)  fms.s1        FR_r = f8,f1,f0 // range reduction for |x|<1/256
+(p6)  cmp.gt.unc    p10,p0 = -40, GR_exp_x  // Is |x| < 2^-40
 }
-//     
-//    M = M - Bias
-//    Load G1
-//    N = getf.exp(Z)
-//
-
-{ .mii
-(p0)  cmp.gt.unc  p11, p0 =  -80, GR_M 
-(p0)  cmp.gt.unc  p12, p0 =  -7, GR_M ;; 
-(p0)  extr.u GR_Index2 = GR_X_1, 6, 4 ;; 
-}
-
-{ .mib
-	nop.m 999
-//
-//    if -80 > M, set p11
-//    Index2 = extr.u(X_1,6,4)
-//    if -7  > M, set p12
-//    Load H1
-//
-(p0)  pmpyshr2.u GR_Index2 = GR_Index2,GR_Table_Scale,0 
-(p11) br.cond.spnt L(log1pf_small) ;; 
+{ .mfb
+(p7)  setf.sig      FR_N = GR_N // copy unbiased exponent of x to the
+                                // significand field of FR_N
+(p7)  fms.s1        FR_r = FR_RcpX,FR_Xp1,f1 // range reduction for |x|>=1/256
+(p12) br.ret.spnt   b0 // exit for x=0, return x
 }
+;;
 
 { .mib
-      nop.m 999
-	nop.i 999
-(p12) br.cond.spnt L(log1pf_near) ;; 
-}
-
-{ .mii
-(p0)  sub GR_N = GR_N, GR_Bias 
-//
-//    poly_lo = r * poly_lo 
-//
-(p0)  add GR_Perturb = 0x1, r0 ;; 
-(p0)  sub GR_ScaleN = GR_Bias, GR_N  
-}
-
-{ .mii
-(p0)  setf.sig FR_float_N = GR_N 
-	nop.i 999 ;;
-//
-//    Prepare Index2 - pmpyshr2.u(X_1,Z_2,15)
-//    Load h1
-//    S_lo = S_lo + BB 
-//    Branch for -80 > M
-//   
-(p0)  add GR_Index2 = GR_Index2, GR_Table_Base1
-}
-
-{ .mmi
-(p0)  setf.exp FR_two_negN = GR_ScaleN 
-      nop.m 999
-(p0)  addl GR_Table_Base = @ltoff(Constants_Z_G_H_h3#),gp  
-};;
-
-//
-//    Index2 points to Z2
-//    Branch for -7 > M
-//
-
-{ .mmb
-(p0)  ld4 GR_Z_2 = [GR_Index2],4 
-      ld8 GR_Table_Base = [GR_Table_Base]
-      nop.b 999 ;;
-}
-(p0)  nop.i 999
-//
-//    Load Z_2
-//    N = N - Bias
-//    Tablebase points to Table3
-//
-
-{ .mmi
-(p0)  ldfs  FR_G_tmp = [GR_Index2],4 ;; 
-//
-//    Load G_2
-//    pmpyshr2  X_2= (X_1,Z_2,15)
-//    float_N = setf.sig(N)
-//    ScaleN = Bias - N
-//
-(p0)  ldfs  FR_H_tmp = [GR_Index2],8 
-	nop.i 999 ;;
-}
-//
-//    Load H_2
-//    two_negN = setf.exp(scaleN)
-//    G = G_1 * G_2
-//
-
-{ .mfi
-(p0)  ldfd  FR_h_tmp = [GR_Index2],0 
-	nop.f 999
-(p0)  pmpyshr2.u GR_X_2 = GR_X_1,GR_Z_2,15 ;; 
-}
-
-{ .mii
-	nop.m 999
-(p0)  extr.u GR_Index3 = GR_X_2, 1, 5 ;; 
-//
-//    Load h_2
-//    H = H_1 + H_2 
-//    h = h_1 + h_2 
-//    Index3 = extr.u(X_2,1,5)
-//
-(p0)  shladd GR_Index3 = GR_Index3,4,GR_Table_Base 
-}
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-//
-//    float_N = fcvt.xf(float_N)
-//    load G3
-//
-(p0)  addl GR_Table_Base = @ltoff(Constants_Q#),gp ;; 
-}
-
-{ .mfi
-ld8    GR_Table_Base = [GR_Table_Base]
-nop.f 999
-nop.i 999
-} ;;
-
-{ .mfi
-(p0)  ldfe FR_log2_hi = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_S_lo = FR_S_lo, FR_two_negN 
-	nop.i 999 ;;
-}
-
-{ .mmf
-	nop.m 999
-//
-//    G = G3 * G
-//    Load h3
-//    Load log2_hi
-//    H = H + H3
-//
-(p0)  ldfe FR_log2_lo = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_G = FR_G, FR_G_tmp ;; 
-}
-
-{ .mmf
-(p0)  ldfs  FR_G_tmp = [GR_Index3],4 
-//
-//    h = h + h3
-//    r = G * S_hi + 1 
-//    Load log2_lo
-//
-(p0)  ldfe FR_Q4 = [GR_Table_Base],16 
-(p0)  fadd.s1 FR_h = FR_h, FR_h_tmp ;; 
-}
-
-{ .mfi
-(p0)  ldfe FR_Q3 = [GR_Table_Base],16 
-(p0)  fadd.s1 FR_H = FR_H, FR_H_tmp 
-	nop.i 999 ;;
-}
-
-{ .mmf
-(p0)  ldfs  FR_H_tmp = [GR_Index3],4 
-(p0)  ldfe FR_Q2 = [GR_Table_Base],16 
-//
-//    Comput Index for Table3
-//    S_lo = S_lo * two_negN
-//
-(p0)  fcvt.xf FR_float_N = FR_float_N ;; 
+      setf.d        FR_Ln2 = GR_Ln2 // create log(2)
+(p7)  extr.u        GR_Ind = GR_Sig,55,8 // get bits from 55 to 62 as index
+(p11) br.cond.spnt  log1p_eq_minus_1 // jump if x = -1
 }
-//
-//    If S_lo == 0, set p8 false
-//    Load H3
-//    Load ptr to table of polynomial coeff.
-//
+;;
 
 { .mmf
-(p0)  ldfd  FR_h_tmp = [GR_Index3],0 
-(p0)  ldfe FR_Q1 = [GR_Table_Base],0 
-(p0)  fcmp.eq.unc.s1 p0, p8 =  FR_S_lo, f0 ;; 
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fmpy.s1 FR_G = FR_G, FR_G_tmp 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_H = FR_H, FR_H_tmp 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fms.s1 FR_r = FR_G, FR_S_hi, f1 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_h = FR_h, FR_h_tmp 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_float_N, FR_log2_hi, FR_H 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    Load Q4 
-//    Load Q3 
-//    Load Q2 
-//    Load Q1 
-//
-(p8) fma.s1 FR_r = FR_G, FR_S_lo, FR_r 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-//
-//    poly_lo = r * Q4 + Q3
-//    rsq = r* r
-//
-(p0)  fma.s1 FR_h = FR_float_N, FR_log2_lo, FR_h 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    If (S_lo!=0) r = s_lo * G + r
-//
-(p0)  fma.s1 FR_poly_lo = FR_r, FR_Q4, FR_Q3 
-	nop.i 999
-}
-//
-//    Create a 0x00000....01
-//    poly_lo = poly_lo * rsq + h
-//
-
-{ .mfi
-(p0)  setf.sig FR_dummy = GR_Perturb 
-(p0)  fmpy.s1 FR_rsq = FR_r, FR_r 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    h = N * log2_lo + h 
-//    Y_hi = n * log2_hi + H 
-//
-(p0)  fma.s1 FR_poly_lo = FR_poly_lo, FR_r, FR_Q2 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_poly_hi = FR_Q1, FR_rsq, FR_r 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-//
-//    poly_lo = r * poly_o + Q2 
-//    poly_hi = Q1 * rsq + r 
-//
-(p0)  fmpy.s1 FR_poly_lo = FR_poly_lo, FR_r 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_poly_lo = FR_poly_lo, FR_rsq, FR_h 
-	nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-(p0)  fadd.s1 FR_Y_lo = FR_poly_hi, FR_poly_lo 
-//
-//    Create the FR for a binary "or"
-//    Y_lo = poly_hi + poly_lo
-//
-// (p0)  for FR_dummy = FR_Y_lo,FR_dummy ;;
-//
-//    Turn the lsb of Y_lo ON
-//
-// (p0)  fmerge.se FR_Y_lo =  FR_Y_lo,FR_dummy ;;
-//
-//    Merge the new lsb into Y_lo, for alone doesn't
-//
-(p0)  br.cond.sptk L(LOG_main) ;; 
-}
-
-
-L(log1pf_near): 
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-//    /*******************************************************/
-//    /*********** Branch log1pf_near  ************************/
-//    /*******************************************************/
-(p0)  addl GR_Table_Base = @ltoff(Constants_P#),gp ;; 
-}
-//
-//    Load base address of poly. coeff.
-//
-{.mmi
-      nop.m 999
-      ld8    GR_Table_Base = [GR_Table_Base]
-      nop.i 999
-};;
-
-{ .mmb
-(p0)  add GR_Table_ptr = 0x40,GR_Table_Base  
-//
-//    Address tables with separate pointers 
-//
-(p0)  ldfe FR_P8 = [GR_Table_Base],16 
-	nop.b 999 ;;
+(p7)  shladd        GR_ad_T = GR_Ind,3,GR_ad_T // address of T
+      nop.m         0
+(p10) fnma.s.s0     f8 = f8,f8,f8   // If |x| very small, result=x-x*x
 }
+;;
 
 { .mmb
-(p0)  ldfe FR_P4 = [GR_Table_ptr],16 
-//
-//    Load P4
-//    Load P8
-//
-(p0)  ldfe FR_P7 = [GR_Table_Base],16 
-	nop.b 999 ;;
-}
-
-{ .mmf
-(p0)  ldfe FR_P3 = [GR_Table_ptr],16 
-//
-//    Load P3
-//    Load P7
-//
-(p0)  ldfe FR_P6 = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_wsq = FR_W, FR_W ;; 
-}
-
-{ .mfi
-(p0)  ldfe FR_P2 = [GR_Table_ptr],16 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_P4, FR_P3 
-	nop.i 999
-}
-//
-//    Load P2
-//    Load P6
-//    Wsq = w * w
-//    Y_hi = p4 * w + p3
-//
-
-{ .mfi
-(p0)  ldfe FR_P5 = [GR_Table_Base],16 
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_P8, FR_P7 
-	nop.i 999 ;;
+(p7)  ldfd          FR_T = [GR_ad_T]
+      nop.m         0
+(p10) br.ret.spnt   b0              // Exit if |x| < 2^-40
 }
+;;
 
 { .mfi
-(p0)  ldfe FR_P1 = [GR_Table_ptr],16 
-//
-//    Load P1
-//    Load P5
-//    Y_lo = p8 * w + P7
-//
-(p0)  fmpy.s1 FR_w4 = FR_wsq, FR_wsq 
-	nop.i 999 ;;
+      nop.m         0
+      fma.s1        FR_r2 = FR_r,FR_r,f0 // r^2
+      nop.i         0
 }
-
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_Y_hi, FR_P2 
-	nop.i 999
+      nop.m         0
+      fnma.s1       FR_A2 = FR_A2,FR_r,f1      // 1.0 - A2*r
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_Y_lo, FR_P6 
-(p0)  add GR_Perturb = 0x1, r0 ;; 
+      nop.m         0
+      fnma.s1       FR_A3 = FR_A4,FR_r,FR_A3 // A3 - A4*r
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-//
-//    w4 = w2 * w2 
-//    Y_hi = y_hi * w + p2 
-//    Y_lo = y_lo * w + p6 
-//    Create perturbation bit
-//
-(p0)  fmpy.s1 FR_w6 = FR_w4, FR_wsq 
-	nop.i 999 ;;
+      nop.m         0
+(p7)  fcvt.xf       FR_N = FR_N
+      nop.i         0
 }
+;;
 
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_Y_hi, FR_P1 
-	nop.i 999
+      nop.m         0
+      // (A3*r+A2)*r^2+r
+      fma.s1        FR_A2 = FR_A3,FR_r2,FR_A2 // (A4*r+A3)*r^2+(A2*r+1)
+      nop.i         0
 }
-//
-//    Y_hi = y_hi * w + p1 
-//    w6 = w4 * w2 
-//
+;;
 
 { .mfi
-(p0)  setf.sig FR_Q4 = GR_Perturb 
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_Y_lo, FR_P5 
-	nop.i 999 ;;
+      nop.m         0
+      // N*Ln2hi+T
+(p7)  fma.s1        FR_NxLn2pT = FR_N,FR_Ln2,FR_T
+      nop.i         0
 }
+;;
 
+.pred.rel "mutex",p6,p7
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_wsq,FR_Y_hi, FR_W 
-	nop.i 999
+      nop.m         0
+(p6)  fma.s.s0      f8 = FR_A2,FR_r,f0 // result if 2^(-40) <= |x| < 1/256
+      nop.i         0
 }
-
 { .mfb
-	nop.m 999
-//
-//    Y_hi = y_hi * wsq + w 
-//    Y_lo = y_lo * w + p5 
-//
-(p0)  fmpy.s1 FR_Y_lo = FR_w6, FR_Y_lo 
-//
-//    Y_lo = y_lo * w6  
-//
-// (p0)  for FR_dummy = FR_Y_lo,FR_dummy ;;
-//
-//    Set lsb on: Taken out to improve performance 
-//
-// (p0)  fmerge.se FR_Y_lo =  FR_Y_lo,FR_dummy ;;
-//
-//    Make sure it's on in Y_lo also.  Taken out to improve
-//    performance
-//
-(p0)  br.cond.sptk L(LOG_main) ;; 
-}
-
-
-L(log1pf_small): 
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-//  /*******************************************************/
-//  /*********** Branch log1pf_small  ***********************/
-//  /*******************************************************/
-(p0)  addl GR_Table_Base = @ltoff(Constants_Threshold#),gp 
-}
-
-{ .mfi
-	nop.m 999
-(p0)  mov FR_Em1 = FR_W 
-(p0)  cmp.eq.unc  p7, p0 = r0, r0 ;; 
-}
-
-{ .mlx
-      ld8    GR_Table_Base = [GR_Table_Base]
-(p0)  movl GR_Expo_Range = 0x0000000000000002 ;; 
-}
-//
-//    Set Safe to true
-//    Set Expo_Range = 0 for single
-//    Set Expo_Range = 2 for double 
-//    Set Expo_Range = 4 for double-extended 
-//
-
-{ .mmi
-(p0)  shladd GR_Table_Base = GR_Expo_Range,4,GR_Table_Base ;; 
-(p0)  ldfe FR_Threshold = [GR_Table_Base],16 
-	nop.i 999
-}
-
-{ .mlx
-	nop.m 999
-(p0)  movl GR_Bias = 0x000000000000FF9B ;; 
-}
-
-{ .mfi
-(p0)  ldfe FR_Tiny = [GR_Table_Base],0 
-	nop.f 999
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p0)  fcmp.gt.unc.s1 p13, p12 =  FR_abs_W, FR_Threshold 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p13) fnmpy.s1 FR_Y_lo = FR_W, FR_W 
-	nop.i 999
-}
-
-{ .mfi
-	nop.m 999
-(p13) fadd FR_SCALE = f0, f1 
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p12) fsub.s1 FR_Y_lo = f0, FR_Tiny 
-(p12) cmp.ne.unc  p7, p0 = r0, r0 
-}
-
-{ .mfi
-(p12) setf.exp FR_SCALE = GR_Bias 
-	nop.f 999
-	nop.i 999 ;;
+      nop.m         0
+(p7)  fma.s.s0      f8 = FR_A2,FR_r,FR_NxLn2pT  // result if |x| >= 1/256
+      br.ret.sptk   b0                          // Exit if |x| >= 2^(-40)
 }
+;;
 
-//
-//    Set p7 to SAFE = FALSE
-//    Set Scale = 2^-100 
-//
+.align 32
+log1p_unorm:
+// Here if x=unorm
 { .mfb
-	nop.m 999
-(p0)  fma.s.s0 FR_Input_X = FR_Y_lo,FR_SCALE,FR_Y_hi
-(p0)  br.ret.sptk   b0
+      getf.exp      GR_signexp_x = FR_NormX // recompute biased exponent
+      nop.f         0
+      br.cond.sptk  log1p_common
 }
 ;;
 
-L(LOG_64_one): 
-
-{ .mfb
-	nop.m 999
-(p0)  fmpy.s.s0 FR_Input_X = FR_Input_X, f0 
-(p0)  br.ret.sptk   b0
+.align 32
+log1p_eq_minus_1:
+// Here if x=-1
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_X = f8,f8 // keep input argument for subsequent
+                                 // call of __libm_error_support#
+      nop.i         0
 }
 ;;
-//    
-//    Raise divide by zero for +/-0 input.
-//    
-
-L(LOG_64_zero): 
 
 { .mfi
-(p0)  mov   GR_Parameter_TAG = 142 
-//
-//    If we have log1pf(0), return -Inf.
-//  
-(p0)  fsub.s0 FR_Output_X_tmp = f0, f1 
-      nop.i 999 ;;
+      mov           GR_TAG = 142  // set libm error in case of log1p(-1).
+      frcpa.s0      f8,p0 = f8,f0 // log1p(-1) should be equal to -INF.
+                                      // We can get it using frcpa because it
+                                      // sets result to the IEEE-754 mandated
+                                      // quotient of f8/f0.
+      nop.i         0
 }
-{ .mfb
-      nop.m 999
-(p0)  frcpa.s0 FR_Output_X_tmp, p8 =  FR_Output_X_tmp, f0 
-(p0)  br.cond.sptk L(LOG_ERROR_Support) ;; 
+{ .mib
+      nop.m         0
+      nop.i         0
+      br.cond.sptk  log_libm_err
 }
+;;
 
-L(LOG_64_special): 
-
+.align 32
+log1p_lt_minus_1:
+// Here if x < -1
 { .mfi
-      nop.m 999
-//    
-//    Return -Inf or value from handler.
-//    
-(p0)  fclass.m.unc p7, p0 =  FR_Input_X, 0x1E1 
-      nop.i 999 ;;
-}
-
-{ .mfb
-      nop.m 999
-//     
-//    Check for Natval, QNan, SNaN, +Inf   
-//    
-(p7)  fmpy.s.s0  f8 =  FR_Input_X, f1 
-//     
-//    For SNaN raise invalid and return QNaN.
-//    For QNaN raise invalid and return QNaN.
-//    For +Inf return +Inf.
-//    
-(p7)  br.ret.sptk   b0
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      nop.i         0
 }
 ;;
 
-//    
-//    For -Inf raise invalid and return QNaN.
-//    
-
-{ .mfb
-(p0)  mov   GR_Parameter_TAG = 143 
-(p0)  fmpy.s.s0  FR_Output_X_tmp =  FR_Input_X, f0 
-(p0)  br.cond.sptk L(LOG_ERROR_Support) ;; 
+{ .mfi
+      mov           GR_TAG = 143  // set libm error in case of x < -1.
+      frcpa.s0      f8,p0 = f0,f0 // log1p(x) x < -1 should be equal to NaN.
+                                  // We can get it using frcpa because it
+                                  // sets result to the IEEE-754 mandated
+                                  // quotient of f0/f0 i.e. NaN.
+      nop.i         0
 }
+;;
 
-//
-//    Report that log1pf(-Inf) computed
-//     
-
-L(LOG_64_unsupported): 
-
-//    
-//    Return generated NaN or other value .
-//    
-
-{ .mfb
-      nop.m 999
-(p0)  fmpy.s.s0 FR_Input_X = FR_Input_X, f0 
-(p0)  br.ret.sptk   b0 ;;
+.align 32
+log_libm_err:
+{ .mmi
+      alloc         r32 = ar.pfs,1,4,4,0
+      mov           GR_Parameter_TAG = GR_TAG
+      nop.i         0
 }
+;;
 
-L(LOG_64_negative): 
-
-{ .mfi
-      nop.m 999
-//     
-//    Deal with x < 0 in a special way 
-//    
-(p0)  frcpa.s0 FR_Output_X_tmp, p8 =  f0, f0 
-//     
-//    Deal with x < 0 in a special way - raise
-//    invalid and produce QNaN indefinite.
-//    
-(p0)  mov   GR_Parameter_TAG = 143;;
-}
+GLOBAL_IEEE754_END(log1pf)
 
-.endp log1pf#
-ASM_SIZE_DIRECTIVE(log1pf)
 
-.proc __libm_error_region
-__libm_error_region:
-L(LOG_ERROR_Support): 
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
-
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y = -32,sp         // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS = ar.pfs             // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp = -64,sp                       // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP = gp                   // Save gp
 };;
-
-
-// (2)
 { .mmi
-        stfs [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
+        stfs [GR_Parameter_Y] = FR_Y,16       // STORE Parameter 2 on stack
         add GR_Parameter_X = 16,sp            // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                     // Save b0
+        mov GR_SAVE_B0 = b0                   // Save b0
 };;
-
 .body
-// (3)
 { .mib
-        stfs [GR_Parameter_X] =FR_Input_X               // STORE Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
-        nop.b 0                                      
+        stfs [GR_Parameter_X] = FR_X          // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfs [GR_Parameter_Y] = FR_Output_X_tmp         // STORE Parameter 3 on stack
+        stfs [GR_Parameter_Y] = FR_RESULT     // STORE Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#           // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
-
-// (4)
 { .mmi
-        ldfs  FR_Input_X = [GR_Parameter_RESULT]       // Get return result off stack
+        ldfs  f8 = [GR_Parameter_RESULT]      // Get return result off stack
 .restore sp
-        add   sp = 64,sp                       // Restore stack pointer
-        mov   b0 = GR_SAVE_B0                  // Restore return address
+        add   sp = 64,sp                      // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                 // Restore return address
 };;
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp
-        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk   b0 
+        mov   gp = GR_SAVE_GP                 // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS            // Restore ar.pfs
+        br.ret.sptk     b0                    // Return
 };;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-
-.proc __libm_LOG_main 
-__libm_LOG_main:
-L(LOG_main): 
-
-//
-//    kernel_log_64 computes ln(X + E)
-//
-
-{ .mfi
-	nop.m 999
-(p7)  fadd.s.s0 FR_Input_X = FR_Y_lo,FR_Y_hi
-        nop.i 999
-}
-
-{ .mmi
-	nop.m 999
-	nop.m 999
-(p14) addl GR_Table_Base = @ltoff(Constants_1_by_LN10#),gp ;; 
-}
-
-{ .mmi
-      nop.m 999
-(p14) ld8    GR_Table_Base = [GR_Table_Base]
-      nop.i 999
-};;
-
-{ .mmi
-(p14) ldfe FR_1LN10_hi = [GR_Table_Base],16 ;; 
-(p14) ldfe FR_1LN10_lo = [GR_Table_Base]
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p14) fmpy.s1 FR_Output_X_tmp = FR_Y_lo,FR_1LN10_hi
-	nop.i 999 ;;
-}
-
-{ .mfi
-	nop.m 999
-(p14) fma.s1  FR_Output_X_tmp = FR_Y_hi,FR_1LN10_lo,FR_Output_X_tmp
-	nop.i 999 ;;
-}
-
-{ .mfb
-	nop.m 999
-(p14) fma.s.s0 FR_Input_X = FR_Y_hi,FR_1LN10_hi,FR_Output_X_tmp
-(p0)  br.ret.sptk   b0 ;; 
-}
-.endp __libm_LOG_main
-ASM_SIZE_DIRECTIVE(__libm_LOG_main)
-
+LOCAL_LIBM_END(__libm_error_region)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_log1pl.S b/sysdeps/ia64/fpu/s_log1pl.S
index 7cd3f7834c..9654265004 100644
--- a/sysdeps/ia64/fpu/s_log1pl.S
+++ b/sysdeps/ia64/fpu/s_log1pl.S
@@ -1,10 +1,10 @@
 .file "log1pl.s" 
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,55 +35,49 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // History: 
-// 2/02/00  hand-optimized
-// 4/04/00  Unwind support added
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/21/01 Removed logl and log10l, putting them in a separate file
+// 06/29/01 Improved speed of all paths
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
 //
-// *********************************************************************
+//*********************************************************************
 //
-// *********************************************************************
+//*********************************************************************
 //
-// Function:   Combined logl(x), log1pl(x), and log10l(x) where
-//             logl(x)   = ln(x), for double-extended precision x values
-//             log1pl(x) = ln(x+1), for double-extended precision x values
-//             log10l(x) = log (x), for double-extended precision x values
-//                           10
+// Function:   log1pl(x) = ln(x+1), for double-extended precision x values
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
 //    Floating-Point Registers: f8 (Input and Return Value)
-//                              f9,f33-f55,f99 
+//                              f34-f82
 //
 //    General Purpose Registers:
-//      r32-r53
-//      r54-r57 (Used to pass arguments to error handling routine)
+//      r32-r56
+//      r53-r56 (Used to pass arguments to error handling routine)
 //
-//    Predicate Registers:      p6-p15
+//    Predicate Registers:      p6-p13
 //
-// *********************************************************************
+//*********************************************************************
 //
 // IEEE Special Conditions:
 //
-//    Denormal  fault raised on denormal inputs
+//    Denormal fault raised on denormal inputs
 //    Overflow exceptions cannot occur  
 //    Underflow exceptions raised when appropriate for log1p 
-//    (Error Handling Routine called for underflow)
 //    Inexact raised when appropriate by algorithm
 //
-//    logl(inf) = inf
-//    logl(-inf) = QNaN 
-//    logl(+/-0) = -inf 
-//    logl(SNaN) = QNaN
-//    logl(QNaN) = QNaN
-//    logl(EM_special Values) = QNaN
 //    log1pl(inf) = inf
 //    log1pl(-inf) = QNaN 
 //    log1pl(+/-0) = +/-0 
@@ -91,54 +85,37 @@
 //    log1pl(SNaN) = QNaN
 //    log1pl(QNaN) = QNaN
 //    log1pl(EM_special Values) = QNaN
-//    log10l(inf) = inf
-//    log10l(-inf) = QNaN 
-//    log10l(+/-0) = -inf 
-//    log10l(SNaN) = QNaN
-//    log10l(QNaN) = QNaN
-//    log10l(EM_special Values) = QNaN
-//
-// *********************************************************************
-//
-// Computation is based on the following kernel.
-//
-// ker_log_64( in_FR    :  X,
-// 	    in_FR    :  E,
-// 	    in_FR    :  Em1,
-// 	    in_GR    :  Expo_Range,
-// 	    out_FR   :  Y_hi,
-// 	    out_FR   :  Y_lo,
-// 	    out_FR   :  Scale,
-// 	    out_PR   :  Safe  )
-// 
+//
+//*********************************************************************
+//
 // Overview
 //
 // The method consists of three cases.
 //
-// If	|X+Em1| < 2^(-80)	use case log1pl_small;
-// elseif	|X+Em1| < 2^(-7)	use case log_near1;
-// else				use case log_regular;
+// If      |X| < 2^(-80)	use case log1p_small;
+// else    |X| < 2^(-7)	        use case log_near1;
+// else      			use case log_regular;
 //
-// Case log1pl_small:
+// Case log1p_small:
 //
-// logl( 1 + (X+Em1) ) can be approximated by (X+Em1).
+//   log1pl( X ) = logl( X+1 ) can be approximated by X
 //
 // Case log_near1:
 //
-//   logl( 1 + (X+Em1) ) can be approximated by a simple polynomial
-//   in W = X+Em1. This polynomial resembles the truncated Taylor
+//   log1pl( X ) = log( X+1 ) can be approximated by a simple polynomial
+//   in W = X. This polynomial resembles the truncated Taylor
 //   series W - W^/2 + W^3/3 - ...
 // 
 // Case log_regular:
 //
 //   Here we use a table lookup method. The basic idea is that in
-//   order to compute logl(Arg) for an argument Arg in [1,2), we 
-//   construct a value G such that G*Arg is close to 1 and that
+//   order to compute logl(Arg) = log1pl (Arg-1) for an argument Arg in [1,2), 
+//   we construct a value G such that G*Arg is close to 1 and that
 //   logl(1/G) is obtainable easily from a table of values calculated
 //   beforehand. Thus
 //
-//	logl(Arg) = logl(1/G) + logl(G*Arg)
-//		 = logl(1/G) + logl(1 + (G*Arg - 1))
+//      logl(Arg) = logl(1/G) + logl(G*Arg)
+//      	 = logl(1/G) + logl(1 + (G*Arg - 1))
 //
 //   Because |G*Arg - 1| is small, the second term on the right hand
 //   side can be approximated by a short polynomial. We elaborate
@@ -146,9 +123,9 @@
 //
 //   Step 0: Initialization
 //
-//   We need to calculate logl( E + X ). Obtain N, S_hi, S_lo such that
+//   We need to calculate logl( X+1 ). Obtain N, S_hi such that
 //
-//	E + X = 2^N * ( S_hi + S_lo )	exactly
+//      X+1 = 2^N * ( S_hi + S_lo )   exactly
 //
 //   where S_hi in [1,2) and S_lo is a correction to S_hi in the sense
 //   that |S_lo| <= ulp(S_hi).
@@ -157,8 +134,8 @@
 //
 //   Based on S_hi, obtain G_1, G_2, G_3 from a table and calculate
 //
-//	G := G_1 * G_2 * G_3
-//	r := (G * S_hi - 1)  + G * S_lo
+//      G := G_1 * G_2 * G_3
+//      r := (G * S_hi - 1) + G * S_lo
 //
 //   These G_j's have the property that the product is exactly 
 //   representable and that |r| < 2^(-12) as a result.
@@ -171,61 +148,34 @@
 //   Step 3: Reconstruction
 //
 //
-//   Finally, logl( E + X ) is given by
+//   Finally, log1pl( X ) = logl( X+1 ) is given by
 //
-//   logl( E + X )   =   logl( 2^N * (S_hi + S_lo) )
+//   logl( X+1 )   =   logl( 2^N * (S_hi + S_lo) )
 //                 ~=~  N*logl(2) + logl(1/G) + logl(1 + r)
 //                 ~=~  N*logl(2) + logl(1/G) + poly(r).
 //
 // **** Algorithm ****
 //
-// Case log1pl_small:
-//
-// Although logl(1 + (X+Em1)) is basically X+Em1, we would like to 
-// preserve the inexactness nature as well as consistent behavior
-// under different rounding modes. Note that this case can only be
-// taken if E is set to be 1.0. In this case, Em1 is zero, and that
-// X can be very tiny and thus the final result can possibly underflow.
-// Thus, we compare X against a threshold that is dependent on the
-// input Expo_Range. If |X| is smaller than this threshold, we set
-// SAFE to be FALSE. 
-//
-// The result is returned as Y_hi, Y_lo, and in the case of SAFE 
-// is FALSE, an additional value Scale is also returned. 
-//
-//	W    := X + Em1
-//      Threshold := Threshold_Table( Expo_Range )
-//      Tiny      := Tiny_Table( Expo_Range )
-//
-//      If ( |W| > Threshold ) then
-//         Y_hi  := W
-//         Y_lo  := -W*W
-//      Else
-//         Y_hi  := W
-//         Y_lo  := -Tiny
-//         Scale := 2^(-100)
-//         Safe  := FALSE
-//      EndIf
-//
-//
-// One may think that Y_lo should be -W*W/2; however, it does not matter
-// as Y_lo will be rounded off completely except for the correct effect in 
-// directed rounding. Clearly -W*W is simplier to compute. Moreover,
-// because of the difference in exponent value, Y_hi + Y_lo or 
-// Y_hi + Scale*Y_lo is always inexact.
+// Case log1p_small:
+//
+// Although log1pl(X) is basically X, we would like to preserve the inexactness
+// nature as well as consistent behavior under different rounding modes.
+// We can do this by computing the result as 
+//    
+//     log1pl(X) = X - X*X
+//
 //
 // Case log_near1:
 //
 // Here we compute a simple polynomial. To exploit parallelism, we split
 // the polynomial into two portions.
 // 
-// 	W := X + Em1
-// 	Wsq := W * W
-// 	W4  := Wsq*Wsq
-// 	W6  := W4*Wsq
-// 	Y_hi := W + Wsq*(P_1 + W*(P_2 + W*(P_3 + W*P_4))
-// 	Y_lo := W6*(P_5 + W*(P_6 + W*(P_7 + W*P_8)))
-//      set lsb(Y_lo) to be 1
+//       W := X
+//       Wsq := W * W
+//       W4  := Wsq*Wsq
+//       W6  := W4*Wsq
+//       Y_hi := W + Wsq*(P_1 + W*(P_2 + W*(P_3 + W*P_4))
+//       Y_lo := W6*(P_5 + W*(P_6 + W*(P_7 + W*P_8)))
 //
 // Case log_regular:
 //
@@ -234,89 +184,87 @@
 //   Step 0. Initialization
 //   ----------------------
 //
-//   Z := X + E
+//   Z := X + 1
 //   N := unbaised exponent of Z
 //   S_hi := 2^(-N) * Z
-//   S_lo := 2^(-N) * { (max(X,E)-Z) + min(X,E) }
-//
-//   Note that S_lo is always 0 for the case E = 0.
+//   S_lo := 2^(-N) * { (max(X,1)-Z) + min(X,1) }
 //
 //   Step 1. Argument Reduction
 //   --------------------------
 //
 //   Let
 //
-//	Z = 2^N * S_hi = 2^N * 1.d_1 d_2 d_3 ... d_63
+//      Z = 2^N * S_hi = 2^N * 1.d_1 d_2 d_3 ... d_63
 //
 //   We obtain G_1, G_2, G_3 by the following steps.
 //
 //
-//	Define		X_0 := 1.d_1 d_2 ... d_14. This is extracted
-//			from S_hi.
+//      Define		X_0 := 1.d_1 d_2 ... d_14. This is extracted
+//      		from S_hi.
 //
-//	Define		A_1 := 1.d_1 d_2 d_3 d_4. This is X_0 truncated
-//			to lsb = 2^(-4).
+//      Define		A_1 := 1.d_1 d_2 d_3 d_4. This is X_0 truncated
+//      		to lsb = 2^(-4).
 //
-//	Define		index_1 := [ d_1 d_2 d_3 d_4 ].
+//      Define		index_1 := [ d_1 d_2 d_3 d_4 ].
 //
-//	Fetch 		Z_1 := (1/A_1) rounded UP in fixed point with
-//	fixed point	lsb = 2^(-15).
-//			Z_1 looks like z_0.z_1 z_2 ... z_15
-//		        Note that the fetching is done using index_1.
-//			A_1 is actually not needed in the implementation
-//			and is used here only to explain how is the value
-//			Z_1 defined.
+//      Fetch 		Z_1 := (1/A_1) rounded UP in fixed point with
+//      fixed point	lsb = 2^(-15).
+//      		Z_1 looks like z_0.z_1 z_2 ... z_15
+//      	        Note that the fetching is done using index_1.
+//      		A_1 is actually not needed in the implementation
+//      		and is used here only to explain how is the value
+//      		Z_1 defined.
 //
-//	Fetch		G_1 := (1/A_1) truncated to 21 sig. bits.
-//	floating pt.	Again, fetching is done using index_1. A_1
-//			explains how G_1 is defined.
+//      Fetch		G_1 := (1/A_1) truncated to 21 sig. bits.
+//      floating pt.	Again, fetching is done using index_1. A_1
+//      		explains how G_1 is defined.
 //
-//	Calculate	X_1 := X_0 * Z_1 truncated to lsb = 2^(-14)
-//			     = 1.0 0 0 0 d_5 ... d_14
-//			This is accomplised by integer multiplication.
-//			It is proved that X_1 indeed always begin
-//			with 1.0000 in fixed point.
+//      Calculate	X_1 := X_0 * Z_1 truncated to lsb = 2^(-14)
+//      		     = 1.0 0 0 0 d_5 ... d_14
+//      		This is accomplised by integer multiplication.
+//      		It is proved that X_1 indeed always begin
+//      		with 1.0000 in fixed point.
 //
 //
-//	Define		A_2 := 1.0 0 0 0 d_5 d_6 d_7 d_8. This is X_1 
-//			truncated to lsb = 2^(-8). Similar to A_1,
-//			A_2 is not needed in actual implementation. It
-//			helps explain how some of the values are defined.
+//      Define		A_2 := 1.0 0 0 0 d_5 d_6 d_7 d_8. This is X_1 
+//      		truncated to lsb = 2^(-8). Similar to A_1,
+//      		A_2 is not needed in actual implementation. It
+//      		helps explain how some of the values are defined.
 //
-//	Define		index_2 := [ d_5 d_6 d_7 d_8 ].
+//      Define		index_2 := [ d_5 d_6 d_7 d_8 ].
 //
-//	Fetch 		Z_2 := (1/A_2) rounded UP in fixed point with
-//	fixed point	lsb = 2^(-15). Fetch done using index_2.
-//			Z_2 looks like z_0.z_1 z_2 ... z_15
+//      Fetch 		Z_2 := (1/A_2) rounded UP in fixed point with
+//      fixed point	lsb = 2^(-15). Fetch done using index_2.
+//      		Z_2 looks like z_0.z_1 z_2 ... z_15
 //
-//	Fetch		G_2 := (1/A_2) truncated to 21 sig. bits.
-//	floating pt.
+//      Fetch		G_2 := (1/A_2) truncated to 21 sig. bits.
+//      floating pt.
 //
-//	Calculate	X_2 := X_1 * Z_2 truncated to lsb = 2^(-14)
-//			     = 1.0 0 0 0 0 0 0 0 d_9 d_10 ... d_14
-//			This is accomplised by integer multiplication.
-//			It is proved that X_2 indeed always begin
-//			with 1.00000000 in fixed point.
+//      Calculate	X_2 := X_1 * Z_2 truncated to lsb = 2^(-14)
+//      		     = 1.0 0 0 0 0 0 0 0 d_9 d_10 ... d_14
+//      		This is accomplised by integer multiplication.
+//      		It is proved that X_2 indeed always begin
+//      		with 1.00000000 in fixed point.
 //
 //
-//	Define		A_3 := 1.0 0 0 0 0 0 0 0 d_9 d_10 d_11 d_12 d_13 1.
-//			This is 2^(-14) + X_2 truncated to lsb = 2^(-13).
+//      Define		A_3 := 1.0 0 0 0 0 0 0 0 d_9 d_10 d_11 d_12 d_13 1.
+//      		This is 2^(-14) + X_2 truncated to lsb = 2^(-13).
 //
-//	Define		index_3 := [ d_9 d_10 d_11 d_12 d_13 ].
+//      Define		index_3 := [ d_9 d_10 d_11 d_12 d_13 ].
 //
-//	Fetch		G_3 := (1/A_3) truncated to 21 sig. bits.
-//	floating pt.	Fetch is done using index_3.
+//      Fetch		G_3 := (1/A_3) truncated to 21 sig. bits.
+//      floating pt.	Fetch is done using index_3.
 //
-//	Compute		G := G_1 * G_2 * G_3. 
+//      Compute		G := G_1 * G_2 * G_3. 
 //
-//	This is done exactly since each of G_j only has 21 sig. bits.
+//      This is done exactly since each of G_j only has 21 sig. bits.
 //
-//	Compute   
+//      Compute   
 //
-//		r := (G*S_hi - 1) + G*S_lo   using 2 FMA operations.
+//      	r := (G*S_hi - 1) + G*S_lo using 2 FMA operations.
 //
-//	thus, r approximates G*(S_hi+S_lo) - 1 to within a couple of 
-//	rounding errors.
+//      Thus r approximates G*(S_hi + S_lo) - 1 to within a couple of
+//      rounding errors.
 //
 //
 //  Step 2. Approximation
@@ -326,1258 +274,879 @@
 //   reduced argument just obtained. It is proved that |r| <= 1.9*2^(-13);
 //   thus logl(1+r) can be approximated by a short polynomial:
 //
-//	logl(1+r) ~=~ poly = r + Q1 r^2 + ... + Q4 r^5
+//      logl(1+r) ~=~ poly = r + Q1 r^2 + ... + Q4 r^5
 //
 //
 //  Step 3. Reconstruction
 //  ----------------------
 //
-//   This step computes the desired result of logl(X+E):
+//   This step computes the desired result of logl(X+1):
 //
-//	logl(X+E)  =   logl( 2^N * (S_hi + S_lo) )
-//		  =   N*logl(2) + logl( S_hi + S_lo )
-//		  =   N*logl(2) + logl(1/G) +
-//		      logl(1 + C*(S_hi+S_lo) - 1 )
+//      logl(X+1) =   logl( 2^N * (S_hi + S_lo) )
+//      	  =   N*logl(2) + logl( S_hi + S_lo) )
+//      	  =   N*logl(2) + logl(1/G) +
+//      	      logl(1 + G * ( S_hi + S_lo ) - 1 )
 //
 //   logl(2), logl(1/G_j) are stored as pairs of (single,double) numbers:
 //   log2_hi, log2_lo, log1byGj_hi, log1byGj_lo. The high parts are
 //   single-precision numbers and the low parts are double precision
 //   numbers. These have the property that
 //
-//	N*log2_hi + SUM ( log1byGj_hi )
+//      N*log2_hi + SUM ( log1byGj_hi )
 //
 //   is computable exactly in double-extended precision (64 sig. bits).
 //   Finally
 //
-//	Y_hi := N*log2_hi + SUM ( log1byGj_hi )
-//	Y_lo := poly_hi + [ poly_lo + 
-//	        ( SUM ( log1byGj_lo ) + N*log2_lo ) ]
-//      set lsb(Y_lo) to be 1
+//      Y_hi := N*log2_hi + SUM ( log1byGj_hi )
+//      Y_lo := poly_hi + [ poly_lo + 
+//              ( SUM ( log1byGj_lo ) + N*log2_lo ) ]
 //
 
-#include "libm_support.h"
+RODATA
+.align 64
 
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// ************* DO NOT CHANGE THE ORDER OF THESE TABLES *************
 
-// P_7, P_6, P_5, P_4, P_3, P_2, and P_1 
+// P_8, P_7, P_6, P_5, P_4, P_3, P_2, and P_1 
+
+LOCAL_OBJECT_START(Constants_P)
+//data4  0xEFD62B15,0xE3936754,0x00003FFB,0x00000000
+//data4  0xA5E56381,0x8003B271,0x0000BFFC,0x00000000
+//data4  0x73282DB0,0x9249248C,0x00003FFC,0x00000000
+//data4  0x47305052,0xAAAAAA9F,0x0000BFFC,0x00000000
+//data4  0xCCD17FC9,0xCCCCCCCC,0x00003FFC,0x00000000
+//data4  0x00067ED5,0x80000000,0x0000BFFD,0x00000000
+//data4  0xAAAAAAAA,0xAAAAAAAA,0x00003FFD,0x00000000
+//data4  0xFFFFFFFE,0xFFFFFFFF,0x0000BFFD,0x00000000
+data8  0xE3936754EFD62B15,0x00003FFB
+data8  0x8003B271A5E56381,0x0000BFFC
+data8  0x9249248C73282DB0,0x00003FFC
+data8  0xAAAAAA9F47305052,0x0000BFFC
+data8  0xCCCCCCCCCCD17FC9,0x00003FFC
+data8  0x8000000000067ED5,0x0000BFFD
+data8  0xAAAAAAAAAAAAAAAA,0x00003FFD
+data8  0xFFFFFFFFFFFFFFFE,0x0000BFFD
+LOCAL_OBJECT_END(Constants_P)
 
-.align 64
-Constants_P:
-ASM_TYPE_DIRECTIVE(Constants_P,@object)
-data4  0xEFD62B15,0xE3936754,0x00003FFB,0x00000000
-data4  0xA5E56381,0x8003B271,0x0000BFFC,0x00000000
-data4  0x73282DB0,0x9249248C,0x00003FFC,0x00000000
-data4  0x47305052,0xAAAAAA9F,0x0000BFFC,0x00000000
-data4  0xCCD17FC9,0xCCCCCCCC,0x00003FFC,0x00000000
-data4  0x00067ED5,0x80000000,0x0000BFFD,0x00000000
-data4  0xAAAAAAAA,0xAAAAAAAA,0x00003FFD,0x00000000
-data4  0xFFFFFFFE,0xFFFFFFFF,0x0000BFFD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_P)
- 
 // log2_hi, log2_lo, Q_4, Q_3, Q_2, and Q_1 
 
-.align 64
-Constants_Q:
-ASM_TYPE_DIRECTIVE(Constants_Q,@object)
-data4  0x00000000,0xB1721800,0x00003FFE,0x00000000 
-data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
-data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000
-data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000
-data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000
-data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_Q)
- 
-// Z1 - 16 bit fixed, G1 and H1 - IEEE single 
- 
-.align 64
-Constants_Z_G_H_h1:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h1,@object)
-data4  0x00008000,0x3F800000,0x00000000,0x00000000,0x00000000,0x00000000
-data4  0x00007879,0x3F70F0F0,0x3D785196,0x00000000,0x617D741C,0x3DA163A6
-data4  0x000071C8,0x3F638E38,0x3DF13843,0x00000000,0xCBD3D5BB,0x3E2C55E6
-data4  0x00006BCB,0x3F579430,0x3E2FF9A0,0x00000000,0xD86EA5E7,0xBE3EB0BF
-data4  0x00006667,0x3F4CCCC8,0x3E647FD6,0x00000000,0x86B12760,0x3E2E6A8C
-data4  0x00006187,0x3F430C30,0x3E8B3AE7,0x00000000,0x5C0739BA,0x3E47574C
-data4  0x00005D18,0x3F3A2E88,0x3EA30C68,0x00000000,0x13E8AF2F,0x3E20E30F
-data4  0x0000590C,0x3F321640,0x3EB9CEC8,0x00000000,0xF2C630BD,0xBE42885B
-data4  0x00005556,0x3F2AAAA8,0x3ECF9927,0x00000000,0x97E577C6,0x3E497F34
-data4  0x000051EC,0x3F23D708,0x3EE47FC5,0x00000000,0xA6B0A5AB,0x3E3E6A6E
-data4  0x00004EC5,0x3F1D89D8,0x3EF8947D,0x00000000,0xD328D9BE,0xBDF43E3C
-data4  0x00004BDB,0x3F17B420,0x3F05F3A1,0x00000000,0x0ADB090A,0x3E4094C3
-data4  0x00004925,0x3F124920,0x3F0F4303,0x00000000,0xFC1FE510,0xBE28FBB2
-data4  0x0000469F,0x3F0D3DC8,0x3F183EBF,0x00000000,0x10FDE3FA,0x3E3A7895
-data4  0x00004445,0x3F088888,0x3F20EC80,0x00000000,0x7CC8C98F,0x3E508CE5
-data4  0x00004211,0x3F042108,0x3F29516A,0x00000000,0xA223106C,0xBE534874
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h1)
- 
-// Z2 - 16 bit fixed, G2 and H2 - IEEE single 
-
-.align 64 
-Constants_Z_G_H_h2:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h2,@object)
-data4  0x00008000,0x3F800000,0x00000000,0x00000000,0x00000000,0x00000000
-data4  0x00007F81,0x3F7F00F8,0x3B7F875D,0x00000000,0x22C42273,0x3DB5A116
-data4  0x00007F02,0x3F7E03F8,0x3BFF015B,0x00000000,0x21F86ED3,0x3DE620CF
-data4  0x00007E85,0x3F7D08E0,0x3C3EE393,0x00000000,0x484F34ED,0xBDAFA07E
-data4  0x00007E08,0x3F7C0FC0,0x3C7E0586,0x00000000,0x3860BCF6,0xBDFE07F0
-data4  0x00007D8D,0x3F7B1880,0x3C9E75D2,0x00000000,0xA78093D6,0x3DEA370F
-data4  0x00007D12,0x3F7A2328,0x3CBDC97A,0x00000000,0x72A753D0,0x3DFF5791
-data4  0x00007C98,0x3F792FB0,0x3CDCFE47,0x00000000,0xA7EF896B,0x3DFEBE6C
-data4  0x00007C20,0x3F783E08,0x3CFC15D0,0x00000000,0x409ECB43,0x3E0CF156
-data4  0x00007BA8,0x3F774E38,0x3D0D874D,0x00000000,0xFFEF71DF,0xBE0B6F97
-data4  0x00007B31,0x3F766038,0x3D1CF49B,0x00000000,0x5D59EEE8,0xBE080483
-data4  0x00007ABB,0x3F757400,0x3D2C531D,0x00000000,0xA9192A74,0x3E1F91E9
-data4  0x00007A45,0x3F748988,0x3D3BA322,0x00000000,0xBF72A8CD,0xBE139A06
-data4  0x000079D1,0x3F73A0D0,0x3D4AE46F,0x00000000,0xF8FBA6CF,0x3E1D9202
-data4  0x0000795D,0x3F72B9D0,0x3D5A1756,0x00000000,0xBA796223,0xBE1DCCC4
-data4  0x000078EB,0x3F71D488,0x3D693B9D,0x00000000,0xB6B7C239,0xBE049391
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h2)
- 
-// G3 and H3 - IEEE single and h3 -IEEE double 
-
-.align 64 
-Constants_Z_G_H_h3:
-ASM_TYPE_DIRECTIVE(Constants_Z_G_H_h3,@object)
-data4  0x3F7FFC00,0x38800100,0x562224CD,0x3D355595
-data4  0x3F7FF400,0x39400480,0x06136FF6,0x3D8200A2
-data4  0x3F7FEC00,0x39A00640,0xE8DE9AF0,0x3DA4D68D
-data4  0x3F7FE400,0x39E00C41,0xB10238DC,0xBD8B4291
-data4  0x3F7FDC00,0x3A100A21,0x3B1952CA,0xBD89CCB8
-data4  0x3F7FD400,0x3A300F22,0x1DC46826,0xBDB10707
-data4  0x3F7FCC08,0x3A4FF51C,0xF43307DB,0x3DB6FCB9
-data4  0x3F7FC408,0x3A6FFC1D,0x62DC7872,0xBD9B7C47
-data4  0x3F7FBC10,0x3A87F20B,0x3F89154A,0xBDC3725E
-data4  0x3F7FB410,0x3A97F68B,0x62B9D392,0xBD93519D
-data4  0x3F7FAC18,0x3AA7EB86,0x0F21BD9D,0x3DC18441
-data4  0x3F7FA420,0x3AB7E101,0x2245E0A6,0xBDA64B95
-data4  0x3F7F9C20,0x3AC7E701,0xAABB34B8,0x3DB4B0EC
-data4  0x3F7F9428,0x3AD7DD7B,0x6DC40A7E,0x3D992337
-data4  0x3F7F8C30,0x3AE7D474,0x4F2083D3,0x3DC6E17B
-data4  0x3F7F8438,0x3AF7CBED,0x811D4394,0x3DAE314B
-data4  0x3F7F7C40,0x3B03E1F3,0xB08F2DB1,0xBDD46F21
-data4  0x3F7F7448,0x3B0BDE2F,0x6D34522B,0xBDDC30A4
-data4  0x3F7F6C50,0x3B13DAAA,0xB1F473DB,0x3DCB0070
-data4  0x3F7F6458,0x3B1BD766,0x6AD282FD,0xBDD65DDC
-data4  0x3F7F5C68,0x3B23CC5C,0xF153761A,0xBDCDAB83
-data4  0x3F7F5470,0x3B2BC997,0x341D0F8F,0xBDDADA40
-data4  0x3F7F4C78,0x3B33C711,0xEBC394E8,0x3DCD1BD7
-data4  0x3F7F4488,0x3B3BBCC6,0x52E3E695,0xBDC3532B
-data4  0x3F7F3C90,0x3B43BAC0,0xE846B3DE,0xBDA3961E
-data4  0x3F7F34A0,0x3B4BB0F4,0x785778D4,0xBDDADF06
-data4  0x3F7F2CA8,0x3B53AF6D,0xE55CE212,0x3DCC3ED1
-data4  0x3F7F24B8,0x3B5BA620,0x9E382C15,0xBDBA3103
-data4  0x3F7F1CC8,0x3B639D12,0x5C5AF197,0x3D635A0B
-data4  0x3F7F14D8,0x3B6B9444,0x71D34EFC,0xBDDCCB19
-data4  0x3F7F0CE0,0x3B7393BC,0x52CD7ADA,0x3DC74502
-data4  0x3F7F04F0,0x3B7B8B6D,0x7D7F2A42,0xBDB68F17
-ASM_SIZE_DIRECTIVE(Constants_Z_G_H_h3)
+LOCAL_OBJECT_START(Constants_Q)
+//data4  0x00000000,0xB1721800,0x00003FFE,0x00000000 
+//data4  0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
+//data4  0x328833CB,0xCCCCCAF2,0x00003FFC,0x00000000
+//data4  0xA9D4BAFB,0x80000077,0x0000BFFD,0x00000000
+//data4  0xAAABE3D2,0xAAAAAAAA,0x00003FFD,0x00000000
+//data4  0xFFFFDAB7,0xFFFFFFFF,0x0000BFFD,0x00000000 
+data8  0xB172180000000000,0x00003FFE
+data8  0x82E308654361C4C6,0x0000BFE2
+data8  0xCCCCCAF2328833CB,0x00003FFC
+data8  0x80000077A9D4BAFB,0x0000BFFD
+data8  0xAAAAAAAAAAABE3D2,0x00003FFD
+data8  0xFFFFFFFFFFFFDAB7,0x0000BFFD
+LOCAL_OBJECT_END(Constants_Q)
+
+// 1/ln10_hi, 1/ln10_lo
+
+LOCAL_OBJECT_START(Constants_1_by_LN10)
+//data4  0x37287195,0xDE5BD8A9,0x00003FFD,0x00000000
+//data4  0xACCF70C8,0xD56EAABE,0x00003FBB,0x00000000
+data8  0xDE5BD8A937287195,0x00003FFD
+data8  0xD56EAABEACCF70C8,0x00003FBB
+LOCAL_OBJECT_END(Constants_1_by_LN10)
+
+
+// Z1 - 16 bit fixed
  
-// 
-//  Exponent Thresholds and Tiny Thresholds
-//  for 8, 11, 15, and 17 bit exponents
-// 
-//  Expo_Range             Value
-// 
-//  0 (8  bits)            2^(-126)
-//  1 (11 bits)            2^(-1022)
-//  2 (15 bits)            2^(-16382)
-//  3 (17 bits)            2^(-16382)
-// 
-//  Tiny_Table
-//  ----------
-//  Expo_Range             Value
-// 
-//  0 (8  bits)            2^(-16382)
-//  1 (11 bits)            2^(-16382)
-//  2 (15 bits)            2^(-16382)
-//  3 (17 bits)            2^(-16382)
-// 
+LOCAL_OBJECT_START(Constants_Z_1)
+data4  0x00008000
+data4  0x00007879
+data4  0x000071C8
+data4  0x00006BCB
+data4  0x00006667
+data4  0x00006187
+data4  0x00005D18
+data4  0x0000590C
+data4  0x00005556
+data4  0x000051EC
+data4  0x00004EC5
+data4  0x00004BDB
+data4  0x00004925
+data4  0x0000469F
+data4  0x00004445
+data4  0x00004211
+LOCAL_OBJECT_END(Constants_Z_1)
 
-.align 64 
-Constants_Threshold:
-ASM_TYPE_DIRECTIVE(Constants_Threshold,@object)
-data4  0x00000000,0x80000000,0x00003F81,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00003C01,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-data4  0x00000000,0x80000000,0x00000001,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_Threshold)
+// G1 and H1 - IEEE single and h1 - IEEE double
 
-.align 64
-Constants_1_by_LN10:
-ASM_TYPE_DIRECTIVE(Constants_1_by_LN10,@object)
-data4  0x37287195,0xDE5BD8A9,0x00003FFD,0x00000000
-data4  0xACCF70C8,0xD56EAABE,0x00003FBB,0x00000000
-ASM_SIZE_DIRECTIVE(Constants_1_by_LN10)
-
-FR_Input_X = f8 
-FR_Neg_One = f9
-FR_E       = f33
-FR_Em1     = f34
-FR_Y_hi    = f34  
-// Shared with Em1
-FR_Y_lo    = f35
-FR_Scale   = f36
-FR_X_Prime = f37 
-FR_Z       = f38 
-FR_S_hi    = f38  
-// Shared with Z  
-FR_W       = f39
-FR_G       = f40
-FR_wsq     = f40 
-// Shared with G 
-FR_H       = f41
-FR_w4      = f41
-// Shared with H  
-FR_h       = f42
-FR_w6      = f42  
-// Shared with h     
-FR_G_tmp   = f43
-FR_poly_lo = f43
-// Shared with G_tmp 
-FR_P8      = f43  
-// Shared with G_tmp 
-FR_H_tmp   = f44
-FR_poly_hi = f44
-  // Shared with H_tmp
-FR_P7      = f44  
-// Shared with H_tmp
-FR_h_tmp   = f45 
-FR_rsq     = f45  
-// Shared with h_tmp
-FR_P6      = f45
-// Shared with h_tmp
-FR_abs_W   = f46
-FR_r       = f46  
-// Shared with abs_W  
-FR_AA      = f47 
-FR_log2_hi = f47  
-// Shared with AA  
-FR_BB          = f48
-FR_log2_lo     = f48  
-// Shared with BB  
-FR_S_lo        = f49 
-FR_two_negN    = f50  
-FR_float_N     = f51 
-FR_Q4          = f52 
-FR_dummy       = f52  
-// Shared with Q4
-FR_P4          = f52  
-// Shared with Q4
-FR_Threshold    = f52
-// Shared with Q4
-FR_Q3          = f53  
-FR_P3          = f53  
-// Shared with Q3
-FR_Tiny        = f53  
-// Shared with Q3
-FR_Q2          = f54 
-FR_P2          = f54  
-// Shared with Q2
-FR_1LN10_hi     = f54 
-// Shared with Q2
-FR_Q1           = f55 
-FR_P1           = f55 
-// Shared with Q1 
-FR_1LN10_lo     = f55 
-// Shared with Q1 
-FR_P5           = f98 
-FR_SCALE        = f98 
-FR_Output_X_tmp = f99 
-
-GR_Expo_Range   = r32
-GR_Table_Base   = r34
-GR_Table_Base1  = r35
-GR_Table_ptr    = r36 
-GR_Index2       = r37 
-GR_signif       = r38 
-GR_X_0          = r39 
-GR_X_1          = r40 
-GR_X_2          = r41 
-GR_Z_1          = r42 
-GR_Z_2          = r43 
-GR_N            = r44 
-GR_Bias         = r45 
-GR_M            = r46 
-GR_ScaleN       = r47  
-GR_Index3       = r48 
-GR_Perturb      = r49 
-GR_Table_Scale  = r50 
+LOCAL_OBJECT_START(Constants_G_H_h1)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F70F0F0,0x3D785196
+data8  0x3DA163A6617D741C
+data4  0x3F638E38,0x3DF13843
+data8  0x3E2C55E6CBD3D5BB
+data4  0x3F579430,0x3E2FF9A0
+data8  0xBE3EB0BFD86EA5E7
+data4  0x3F4CCCC8,0x3E647FD6
+data8  0x3E2E6A8C86B12760
+data4  0x3F430C30,0x3E8B3AE7
+data8  0x3E47574C5C0739BA
+data4  0x3F3A2E88,0x3EA30C68
+data8  0x3E20E30F13E8AF2F
+data4  0x3F321640,0x3EB9CEC8
+data8  0xBE42885BF2C630BD
+data4  0x3F2AAAA8,0x3ECF9927
+data8  0x3E497F3497E577C6
+data4  0x3F23D708,0x3EE47FC5
+data8  0x3E3E6A6EA6B0A5AB
+data4  0x3F1D89D8,0x3EF8947D
+data8  0xBDF43E3CD328D9BE
+data4  0x3F17B420,0x3F05F3A1
+data8  0x3E4094C30ADB090A
+data4  0x3F124920,0x3F0F4303
+data8  0xBE28FBB2FC1FE510
+data4  0x3F0D3DC8,0x3F183EBF
+data8  0x3E3A789510FDE3FA
+data4  0x3F088888,0x3F20EC80
+data8  0x3E508CE57CC8C98F
+data4  0x3F042108,0x3F29516A
+data8  0xBE534874A223106C
+LOCAL_OBJECT_END(Constants_G_H_h1)
 
-//
-// Added for unwind support
-//
+// Z2 - 16 bit fixed
+
+LOCAL_OBJECT_START(Constants_Z_2)
+data4  0x00008000
+data4  0x00007F81
+data4  0x00007F02
+data4  0x00007E85
+data4  0x00007E08
+data4  0x00007D8D
+data4  0x00007D12
+data4  0x00007C98
+data4  0x00007C20
+data4  0x00007BA8
+data4  0x00007B31
+data4  0x00007ABB
+data4  0x00007A45
+data4  0x000079D1
+data4  0x0000795D
+data4  0x000078EB
+LOCAL_OBJECT_END(Constants_Z_2)
+
+// G2 and H2 - IEEE single and h2 - IEEE double
+
+LOCAL_OBJECT_START(Constants_G_H_h2)
+data4  0x3F800000,0x00000000
+data8  0x0000000000000000
+data4  0x3F7F00F8,0x3B7F875D
+data8  0x3DB5A11622C42273
+data4  0x3F7E03F8,0x3BFF015B
+data8  0x3DE620CF21F86ED3
+data4  0x3F7D08E0,0x3C3EE393
+data8  0xBDAFA07E484F34ED
+data4  0x3F7C0FC0,0x3C7E0586
+data8  0xBDFE07F03860BCF6
+data4  0x3F7B1880,0x3C9E75D2
+data8  0x3DEA370FA78093D6
+data4  0x3F7A2328,0x3CBDC97A
+data8  0x3DFF579172A753D0
+data4  0x3F792FB0,0x3CDCFE47
+data8  0x3DFEBE6CA7EF896B
+data4  0x3F783E08,0x3CFC15D0
+data8  0x3E0CF156409ECB43
+data4  0x3F774E38,0x3D0D874D
+data8  0xBE0B6F97FFEF71DF
+data4  0x3F766038,0x3D1CF49B
+data8  0xBE0804835D59EEE8
+data4  0x3F757400,0x3D2C531D
+data8  0x3E1F91E9A9192A74
+data4  0x3F748988,0x3D3BA322
+data8  0xBE139A06BF72A8CD
+data4  0x3F73A0D0,0x3D4AE46F
+data8  0x3E1D9202F8FBA6CF
+data4  0x3F72B9D0,0x3D5A1756
+data8  0xBE1DCCC4BA796223
+data4  0x3F71D488,0x3D693B9D
+data8  0xBE049391B6B7C239
+LOCAL_OBJECT_END(Constants_G_H_h2)
+
+// G3 and H3 - IEEE single and h3 - IEEE double 
+
+LOCAL_OBJECT_START(Constants_G_H_h3)
+data4  0x3F7FFC00,0x38800100
+data8  0x3D355595562224CD
+data4  0x3F7FF400,0x39400480
+data8  0x3D8200A206136FF6
+data4  0x3F7FEC00,0x39A00640
+data8  0x3DA4D68DE8DE9AF0
+data4  0x3F7FE400,0x39E00C41
+data8  0xBD8B4291B10238DC
+data4  0x3F7FDC00,0x3A100A21
+data8  0xBD89CCB83B1952CA
+data4  0x3F7FD400,0x3A300F22
+data8  0xBDB107071DC46826
+data4  0x3F7FCC08,0x3A4FF51C
+data8  0x3DB6FCB9F43307DB
+data4  0x3F7FC408,0x3A6FFC1D
+data8  0xBD9B7C4762DC7872
+data4  0x3F7FBC10,0x3A87F20B
+data8  0xBDC3725E3F89154A
+data4  0x3F7FB410,0x3A97F68B
+data8  0xBD93519D62B9D392
+data4  0x3F7FAC18,0x3AA7EB86
+data8  0x3DC184410F21BD9D
+data4  0x3F7FA420,0x3AB7E101
+data8  0xBDA64B952245E0A6
+data4  0x3F7F9C20,0x3AC7E701
+data8  0x3DB4B0ECAABB34B8
+data4  0x3F7F9428,0x3AD7DD7B
+data8  0x3D9923376DC40A7E
+data4  0x3F7F8C30,0x3AE7D474
+data8  0x3DC6E17B4F2083D3
+data4  0x3F7F8438,0x3AF7CBED
+data8  0x3DAE314B811D4394
+data4  0x3F7F7C40,0x3B03E1F3
+data8  0xBDD46F21B08F2DB1
+data4  0x3F7F7448,0x3B0BDE2F
+data8  0xBDDC30A46D34522B
+data4  0x3F7F6C50,0x3B13DAAA
+data8  0x3DCB0070B1F473DB
+data4  0x3F7F6458,0x3B1BD766
+data8  0xBDD65DDC6AD282FD
+data4  0x3F7F5C68,0x3B23CC5C
+data8  0xBDCDAB83F153761A
+data4  0x3F7F5470,0x3B2BC997
+data8  0xBDDADA40341D0F8F
+data4  0x3F7F4C78,0x3B33C711
+data8  0x3DCD1BD7EBC394E8
+data4  0x3F7F4488,0x3B3BBCC6
+data8  0xBDC3532B52E3E695
+data4  0x3F7F3C90,0x3B43BAC0
+data8  0xBDA3961EE846B3DE
+data4  0x3F7F34A0,0x3B4BB0F4
+data8  0xBDDADF06785778D4
+data4  0x3F7F2CA8,0x3B53AF6D
+data8  0x3DCC3ED1E55CE212
+data4  0x3F7F24B8,0x3B5BA620
+data8  0xBDBA31039E382C15
+data4  0x3F7F1CC8,0x3B639D12
+data8  0x3D635A0B5C5AF197
+data4  0x3F7F14D8,0x3B6B9444
+data8  0xBDDCCB1971D34EFC
+data4  0x3F7F0CE0,0x3B7393BC
+data8  0x3DC7450252CD7ADA
+data4  0x3F7F04F0,0x3B7B8B6D
+data8  0xBDB68F177D7F2A42
+LOCAL_OBJECT_END(Constants_G_H_h3)
 
-GR_SAVE_PFS         = r51
-GR_SAVE_B0          = r52
-GR_SAVE_GP          = r53
-GR_Parameter_X      = r54
-GR_Parameter_Y      = r55
-GR_Parameter_RESULT = r56
-GR_Parameter_TAG    = r57
+
+// Floating Point Registers
+
+FR_Input_X      = f8 
+
+FR_Y_hi         = f34  
+FR_Y_lo         = f35
+
+FR_Scale        = f36
+FR_X_Prime      = f37 
+FR_S_hi         = f38  
+FR_W            = f39
+FR_G            = f40
+
+FR_H            = f41
+FR_wsq          = f42 
+FR_w4           = f43
+FR_h            = f44
+FR_w6           = f45  
+
+FR_G2           = f46
+FR_H2           = f47
+FR_poly_lo      = f48
+FR_P8           = f49  
+FR_poly_hi      = f50
+
+FR_P7           = f51  
+FR_h2           = f52 
+FR_rsq          = f53  
+FR_P6           = f54
+FR_r            = f55  
+
+FR_log2_hi      = f56  
+FR_log2_lo      = f57  
+FR_p87          = f58  
+FR_p876         = f58  
+FR_p8765        = f58  
+FR_float_N      = f59 
+FR_Q4           = f60 
+
+FR_p43          = f61  
+FR_p432         = f61  
+FR_p4321        = f61  
+FR_P4           = f62  
+FR_G3           = f63  
+FR_H3           = f64  
+FR_h3           = f65  
+
+FR_Q3           = f66  
+FR_P3           = f67  
+FR_Q2           = f68 
+FR_P2           = f69  
+FR_1LN10_hi     = f70 
+
+FR_Q1           = f71 
+FR_P1           = f72 
+FR_1LN10_lo     = f73 
+FR_P5           = f74 
+FR_rcub         = f75 
+
+FR_Output_X_tmp = f76 
+FR_Neg_One      = f77 
+FR_Z            = f78 
+FR_AA           = f79 
+FR_BB           = f80 
+FR_S_lo         = f81 
+FR_2_to_minus_N = f82 
 
 FR_X                = f8
 FR_Y                = f0
-FR_RESULT           = f99
+FR_RESULT           = f76
 
-.section .text
-.proc logl#
-.global logl#
-.align 64 
-logl:
-#ifdef _LIBC
-.global __ieee754_logl
-__ieee754_logl:
-#endif 
-{ .mfi
-alloc r32 = ar.pfs,0,22,4,0
-(p0)  fnorm.s1 FR_X_Prime = FR_Input_X 
-(p0)  cmp.eq.unc  p7, p0 = r0, r0 
-}
-{ .mfi
-(p0)  cmp.ne.unc  p14, p0 = r0, r0 
-(p0)  fclass.m.unc p6, p0 =  FR_Input_X, 0x1E3 
-(p0)  cmp.ne.unc  p15, p0 = r0, r0 ;; 
-}
-{ .mfi
- nop.m 0
-(p0)  fclass.nm.unc p10, p0 =  FR_Input_X, 0x1FF 
- nop.i 0
-}
-{ .mfi
-nop.m 999
-(p0)  fcmp.eq.unc.s1 p8, p0 =  FR_Input_X, f0 
- nop.i 0
-}
-{ .mfi
-	nop.m 999
-(p0)  fcmp.lt.unc.s1 p13, p0 =  FR_Input_X, f0 
- nop.i 0
-}
-{ .mfi
-	nop.m 999
-(p0)  fcmp.eq.unc.s1 p9, p0 =  FR_Input_X, f1 
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)  fsub.s1 FR_Em1 = f0,f1 
-	nop.i 999
-}
-{ .mfb
-	nop.m 999
-(p0)  fadd FR_E = f0,f0 
-//     
-//    Create E = 0 and Em1 = -1 
-//    Check for X == 1, meaning logl(1)
-//    Check for X < 0, meaning logl(negative)
-//    Check for X == 0, meaning logl(0)
-//    Identify NatVals, NaNs, Infs. 
-//    Identify EM unsupporteds. 
-//    Identify Negative values - us S1 so as
-//    not to raise denormal operand exception 
-//    Set p15 to false for log
-//    Set p14 to false for log
-//    Set p7 true for log and log1p
-//    
-(p0)  br.cond.sptk L(LOGL_BEGIN) ;; 
-}
 
-.endp logl
-ASM_SIZE_DIRECTIVE(logl)
+// General Purpose Registers
 
-.section .text
-.proc log10l#
-.global log10l#
-.align 64 
-log10l:
-#ifdef _LIBC
-.global __ieee754_log10l
-__ieee754_log10l:
-#endif
-{ .mfi
-alloc r32 = ar.pfs,0,22,4,0
-(p0)  fadd FR_E = f0,f0 
-      nop.i 0
-}
-{ .mfi
-      nop.m 0
-(p0)  fsub.s1 FR_Em1 = f0,f1 
-      nop.i 0
-}
-{ .mfi
-(p0)  cmp.ne.unc  p15, p0 = r0, r0 
-(p0)  fcmp.eq.unc.s1 p9, p0 =  FR_Input_X, f1 
-      nop.i 0
-}
-{ .mfi
-(p0)  cmp.eq.unc  p14, p0 = r0, r0 
-(p0)  fcmp.lt.unc.s1 p13, p0 =  FR_Input_X, f0 
-(p0)  cmp.ne.unc  p7, p0 = r0, r0 ;; 
-}
-{ .mfi
-	nop.m 999
-(p0)  fcmp.eq.unc.s1 p8, p0 =  FR_Input_X, f0 
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p0)  fclass.nm.unc p10, p0 =  FR_Input_X, 0x1FF 
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)  fclass.m.unc p6, p0 =  FR_Input_X, 0x1E3 
-	nop.i 999
-}
-{ .mfb
-	nop.m 999
-(p0)  fnorm.s1 FR_X_Prime = FR_Input_X 
-//     
-//    Create E = 0 and Em1 = -1 
-//    Check for X == 1, meaning logl(1)
-//    Check for X < 0, meaning logl(negative)
-//    Check for X == 0, meaning logl(0)
-//    Identify NatVals, NaNs, Infs. 
-//    Identify EM unsupporteds. 
-//    Identify Negative values - us S1 so as
-//    Identify Negative values - us S1 so as
-//    not to raise denormal operand exception 
-//    Set p15 to false for log10
-//    Set p14 to true for log10
-//    Set p7 to false for log10
-//    
-(p0)  br.cond.sptk L(LOGL_BEGIN) ;; 
-}
+GR_ad_p         = r33
+GR_Index1       = r34 
+GR_Index2       = r35 
+GR_signif       = r36 
+GR_X_0          = r37 
+GR_X_1          = r38 
+GR_X_2          = r39 
+GR_minus_N      = r39
+GR_Z_1          = r40 
+GR_Z_2          = r41 
+GR_N            = r42 
+GR_Bias         = r43 
+GR_M            = r44 
+GR_Index3       = r45 
+GR_exp_2tom80   = r45 
+GR_ad_p2        = r46
+GR_exp_mask     = r47 
+GR_exp_2tom7    = r48 
+GR_ad_ln10      = r49 
+GR_ad_tbl_1     = r50
+GR_ad_tbl_2     = r51
+GR_ad_tbl_3     = r52
+GR_ad_q         = r53
+GR_ad_z_1       = r54
+GR_ad_z_2       = r55
+GR_ad_z_3       = r56
+GR_minus_N      = r39
+
+//
+// Added for unwind support
+//
 
-.endp log10l
-ASM_SIZE_DIRECTIVE(log10l)
+GR_SAVE_PFS         = r50
+GR_SAVE_B0          = r51
+GR_SAVE_GP          = r52
+GR_Parameter_X      = r53
+GR_Parameter_Y      = r54
+GR_Parameter_RESULT = r55
+GR_Parameter_TAG    = r56
 
 .section .text
-.proc log1pl#
-.global log1pl#
-.align 64 
-log1pl:
-#ifdef _LIBC
-.global __log1pl
-__log1pl:
-#endif
+GLOBAL_IEEE754_ENTRY(log1pl)
 { .mfi
-alloc r32 = ar.pfs,0,22,4,0
-(p0)  fsub.s1 FR_Neg_One = f0,f1 
-(p0)  cmp.eq.unc  p7, p0 = r0, r0 
-}
-{ .mfi
-(p0)  cmp.ne.unc  p14, p0 = r0, r0 
-(p0)  fnorm.s1 FR_X_Prime = FR_Input_X 
-(p0)  cmp.eq.unc  p15, p0 = r0, r0 ;; 
+      alloc r32 = ar.pfs,0,21,4,0
+      fclass.m p6, p0 =  FR_Input_X, 0x1E3  // Test for natval, nan, inf
+      nop.i 999
 }
 { .mfi
-      nop.m 0
-(p0)  fclass.m.unc p6, p0 =  FR_Input_X, 0x1E3 
-      nop.i 0
+      addl GR_ad_z_1 = @ltoff(Constants_Z_1#),gp
+      fma.s1 FR_Z = FR_Input_X, f1, f1      // x+1
+      nop.i 999
 }
+;;
+
 { .mfi
       nop.m 999
-(p0)  fclass.nm.unc p10, p0 =  FR_Input_X, 0x1FF 
-      nop.i 0
+      fmerge.ns FR_Neg_One = f1, f1         // Form -1.0
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p0)  fcmp.eq.unc.s1 p9, p0 =  FR_Input_X, f0 
-      nop.i 0 
+      fnorm.s1 FR_X_Prime = FR_Input_X      // Normalize x
+      nop.i 999
 }
+;;
+
 { .mfi
-      nop.m 999
-(p0)  fadd FR_Em1 = f0,f0 
-      nop.i 999 ;;
+      ld8    GR_ad_z_1 = [GR_ad_z_1]          // Get pointer to Constants_Z_1
+      nop.f 999
+      mov GR_exp_2tom7 = 0x0fff8              // Exponent of 2^-7
 }
-{ .mfi
-	nop.m 999
-(p0)  fadd FR_E = f0,f1 
-	nop.i 999 ;;
+;;
+
+{ .mfb
+      getf.sig GR_signif = FR_Z               // Get significand of x+1
+      fcmp.eq.s1 p9, p0 =  FR_Input_X, f0     // Test for x=0
+(p6)  br.cond.spnt LOG1P_special              // Branch for nan, inf, natval
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fcmp.eq.unc.s1 p8, p0 =  FR_Input_X, FR_Neg_One 
-	nop.i 999
+      add   GR_ad_tbl_1 = 0x040, GR_ad_z_1    // Point to Constants_G_H_h1
+      fcmp.lt.s1 p13, p0 =  FR_X_Prime, FR_Neg_One // Test for x<-1
+      add   GR_ad_p = -0x100, GR_ad_z_1       // Point to Constants_P
 }
 { .mfi
-	nop.m 999
-(p0)  fcmp.lt.unc.s1 p13, p0 =  FR_Input_X, FR_Neg_One 
-	nop.i 999
+      add   GR_ad_z_2 = 0x140, GR_ad_z_1      // Point to Constants_Z_2
+      nop.f 999
+      add   GR_ad_tbl_2 = 0x180, GR_ad_z_1    // Point to Constants_G_H_h2
 }
-L(LOGL_BEGIN): 
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_Z = FR_X_Prime, FR_E 
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl GR_Table_Scale = 0x0000000000000018 ;; 
+      add   GR_ad_q = 0x080, GR_ad_p          // Point to Constants_Q
+      fcmp.eq.s1 p8, p0 =  FR_X_Prime, FR_Neg_One // Test for x=-1
+      extr.u GR_Index1 = GR_signif, 59, 4     // Get high 4 bits of signif
 }
-{ .mmi
-	nop.m 999
-	nop.m 999
-//     
-//    Create E = 1 and Em1 = 0 
-//    Check for X == 0, meaning logl(1+0)
-//    Check for X < -1, meaning logl(negative)
-//    Check for X == -1, meaning logl(0)
-//    Normalize x 
-//    Identify NatVals, NaNs, Infs. 
-//    Identify EM unsupporteds. 
-//    Identify Negative values - us S1 so as
-//    not to raise denormal operand exception 
-//    Set p15 to true for log1p
-//    Set p14 to false for log1p
-//    Set p7 true for log and log1p
-//    
-(p0)  addl GR_Table_Base = @ltoff(Constants_Z_G_H_h1#),gp
+{ .mfb
+      add   GR_ad_tbl_3 = 0x280, GR_ad_z_1    // Point to Constants_G_H_h3
+      nop.f 999
+(p9)  br.ret.spnt  b0                         // Exit if x=0, return input
 }
+;;
+
 { .mfi
-      nop.m 999
-(p0)  fmax.s1 FR_AA = FR_X_Prime, FR_E 
-      nop.i 999 ;;
+      shladd GR_ad_z_1 = GR_Index1, 2, GR_ad_z_1  // Point to Z_1
+      fclass.nm p10, p0 =  FR_Input_X, 0x1FF  // Test for unsupported
+      extr.u GR_X_0 = GR_signif, 49, 15       // Get high 15 bits of significand
 }
 { .mfi
-      ld8    GR_Table_Base = [GR_Table_Base]
-(p0)  fmin.s1 FR_BB = FR_X_Prime, FR_E 
-      nop.i 999
-}
-{ .mfb
-      nop.m 999
-(p0)  fadd.s1 FR_W = FR_X_Prime, FR_Em1 
-//     
-//    Begin load of constants base
-//    FR_Z = Z = |x| + E 
-//    FR_W = W = |x| + Em1
-//    AA = fmax(|x|,E)
-//    BB = fmin(|x|,E)
-//
-(p6)  br.cond.spnt L(LOGL_64_special) ;; 
+      ldfe FR_P8 = [GR_ad_p],16               // Load P_8 for near1 path
+      fsub.s1 FR_W = FR_X_Prime, f0           // W = x
+      add   GR_ad_ln10 = 0x060, GR_ad_q       // Point to Constants_1_by_LN10
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p10) br.cond.spnt L(LOGL_64_unsupported) ;; 
+;;
+
+{ .mfi
+      ld4 GR_Z_1 = [GR_ad_z_1]                // Load Z_1
+      fmax.s1  FR_AA = FR_X_Prime, f1         // For S_lo, form AA = max(X,1.0)
+      mov GR_exp_mask = 0x1FFFF               // Create exponent mask
 }
 { .mib
-	nop.m 999
-	nop.i 999
-(p13) br.cond.spnt L(LOGL_64_negative) ;; 
+      shladd GR_ad_tbl_1 = GR_Index1, 4, GR_ad_tbl_1  // Point to G_1
+      mov GR_Bias = 0x0FFFF                   // Create exponent bias
+(p13) br.cond.spnt LOG1P_LT_Minus_1           // Branch if x<-1
 }
-{ .mib
-(p0)  getf.sig GR_signif = FR_Z 
-	nop.i 999
-(p9)  br.cond.spnt L(LOGL_64_one) ;; 
+;;
+
+{ .mfb
+      ldfps  FR_G, FR_H = [GR_ad_tbl_1],8     // Load G_1, H_1
+      fmerge.se FR_S_hi =  f1,FR_Z            // Form |x+1|
+(p8)  br.cond.spnt LOG1P_EQ_Minus_1           // Branch if x=-1
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-(p8)  br.cond.spnt L(LOGL_64_zero) ;; 
+;;
+
+{ .mmb
+      getf.exp GR_N =  FR_Z                   // Get N = exponent of x+1
+      ldfd  FR_h = [GR_ad_tbl_1]              // Load h_1
+(p10) br.cond.spnt LOG1P_unsupported          // Branch for unsupported type
 }
+;;
+
 { .mfi
-(p0)  getf.exp GR_N =  FR_Z 
-//   
-//    Raise possible denormal operand exception 
-//    Create Bias
-// 
-//    This function computes ln( x + e ) 
-//    Input  FR 1: FR_X   = FR_Input_X          
-//    Input  FR 2: FR_E   = FR_E
-//    Input  FR 3: FR_Em1 = FR_Em1 
-//    Input  GR 1: GR_Expo_Range = GR_Expo_Range = 1
-//    Output FR 4: FR_Y_hi  
-//    Output FR 5: FR_Y_lo  
-//    Output FR 6: FR_Scale  
-//    Output PR 7: PR_Safe  
-//
-(p0)  fsub.s1 FR_S_lo = FR_AA, FR_Z 
+      ldfe FR_log2_hi = [GR_ad_q],16          // Load log2_hi
+      fcmp.eq.s0 p8, p0 =  FR_Input_X, f0     // Dummy op to flag denormals
+      pmpyshr2.u GR_X_1 = GR_X_0,GR_Z_1,15    // Get bits 30-15 of X_0 * Z_1
+}
+;;
+
 //
-//    signif = getf.sig(Z)
-//    abs_W = fabs(w)
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
 //
-(p0)  extr.u GR_Table_ptr = GR_signif, 59, 4 ;; 
-}
-{ .mfi
-	nop.m 999
-(p0)  fmerge.se FR_S_hi =  f1,FR_Z 
-(p0)  extr.u GR_X_0 = GR_signif, 49, 15  
-}
 { .mmi
-       nop.m 999
-       nop.m 999
-(p0)  addl GR_Table_Base1 = @ltoff(Constants_Z_G_H_h2#),gp ;; 
-}
-{ .mlx
-      ld8    GR_Table_Base1 = [GR_Table_Base1]
-(p0)  movl GR_Bias = 0x000000000000FFFF ;; 
-}
-{ .mfi
-	nop.m 999
-(p0)  fabs FR_abs_W =  FR_W 
-(p0)  pmpyshr2.u GR_Table_ptr = GR_Table_ptr,GR_Table_Scale,0 
-}
-{ .mfi
-	nop.m 999
-//    
-//    Branch out for special input values 
-//    
-(p0)  fcmp.lt.unc.s0 p8, p0 =  FR_Input_X, f0 
-	nop.i 999 ;;
+      ldfe FR_log2_lo = [GR_ad_q],16          // Load log2_lo
+      sub GR_N = GR_N, GR_Bias 
+      mov GR_exp_2tom80 = 0x0ffaf             // Exponent of 2^-80
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    X_0 = extr.u(signif,49,15)
-//    Index1 = extr.u(signif,59,4)
-//
-(p0)  fadd.s1 FR_S_lo = FR_S_lo, FR_BB 
-	nop.i 999 ;;
+      ldfe FR_Q4 = [GR_ad_q],16               // Load Q4
+      fms.s1  FR_S_lo = FR_AA, f1, FR_Z       // Form S_lo = AA - Z 
+      sub GR_minus_N = GR_Bias, GR_N          // Form exponent of 2^(-N)
 }
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    Offset_to_Z1 = 24 * Index1
-//    For performance, don't use result
-//    for 3 or 4 cycles.
-//
-(p0)  add GR_Table_ptr = GR_Table_ptr, GR_Table_Base ;; 
+;;
+
+{ .mmf
+      ldfe FR_Q3 = [GR_ad_q],16               // Load Q3
+      setf.sig FR_float_N = GR_N   // Put integer N into rightmost significand
+      fmin.s1  FR_BB = FR_X_Prime, f1         // For S_lo, form BB = min(X,1.0)
 }
-//
-//    Add Base to Offset for Z1
-//    Create Bias
+;;
+
 { .mmi
-(p0)  ld4 GR_Z_1 = [GR_Table_ptr],4 ;; 
-(p0)  ldfs  FR_G = [GR_Table_ptr],4 
-	nop.i 999 ;;
+      getf.exp GR_M = FR_W                    // Get signexp of w = x
+      ldfe FR_Q2 = [GR_ad_q],16               // Load Q2
+      extr.u GR_Index2 = GR_X_1, 6, 4         // Extract bits 6-9 of X_1 
 }
+;;
+
 { .mmi
-(p0)  ldfs  FR_H = [GR_Table_ptr],8 ;; 
-(p0)  ldfd  FR_h = [GR_Table_ptr],0 
-(p0)  pmpyshr2.u GR_X_1 = GR_X_0,GR_Z_1,15 
-}
-//
-//    Load Z_1 
-//    Get Base of Table2 
-//
-{ .mfi
-(p0)  getf.exp GR_M = FR_abs_W 
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mii
-	nop.m 999
-	nop.i 999 ;;
-//
-//    M = getf.exp(abs_W)
-//    S_lo = AA - Z
-//    X_1 = pmpyshr2(X_0,Z_1,15)
-//
-(p0)  sub GR_M = GR_M, GR_Bias ;; 
-}
-//     
-//    M = M - Bias
-//    Load G1
-//    N = getf.exp(Z)
-//
-{ .mii
-(p0)  cmp.gt.unc  p11, p0 =  -80, GR_M 
-(p0)  cmp.gt.unc  p12, p0 =  -7, GR_M ;; 
-(p0)  extr.u GR_Index2 = GR_X_1, 6, 4 ;; 
-}
-{ .mib
-	nop.m 999
-//
-//    if -80 > M, set p11
-//    Index2 = extr.u(X_1,6,4)
-//    if -7  > M, set p12
-//    Load H1
-//
-(p0)  pmpyshr2.u GR_Index2 = GR_Index2,GR_Table_Scale,0 
-(p11) br.cond.spnt L(log1pl_small) ;; 
-}
-{ .mib
-      nop.m 999
-	nop.i 999
-(p12) br.cond.spnt L(log1pl_near) ;; 
-}
-{ .mii
-(p0)  sub GR_N = GR_N, GR_Bias 
-//
-//    poly_lo = r * poly_lo 
-//
-(p0)  add GR_Perturb = 0x1, r0 ;; 
-(p0)  sub GR_ScaleN = GR_Bias, GR_N  
-}
-{ .mii
-(p0)  setf.sig FR_float_N = GR_N 
-	nop.i 999 ;;
-//
-//    Prepare Index2 - pmpyshr2.u(X_1,Z_2,15)
-//    Load h1
-//    S_lo = S_lo + BB 
-//    Branch for -80 > M
-//   
-(p0)  add GR_Index2 = GR_Index2, GR_Table_Base1
+      ldfe FR_Q1 = [GR_ad_q]                  // Load Q1
+      shladd GR_ad_z_2 = GR_Index2, 2, GR_ad_z_2  // Point to Z_2
+      add GR_ad_p2  = 0x30,GR_ad_p            // Point to P_4
 }
+;;
+
 { .mmi
-(p0)  setf.exp FR_two_negN = GR_ScaleN 
-      nop.m 999
-(p0)  addl GR_Table_Base = @ltoff(Constants_Z_G_H_h3#),gp ;; 
+      ld4 GR_Z_2 = [GR_ad_z_2]                // Load Z_2
+      shladd GR_ad_tbl_2 = GR_Index2, 4, GR_ad_tbl_2  // Point to G_2
+      and GR_M = GR_exp_mask, GR_M            // Get exponent of w = x
 }
-//
-//    Index2 points to Z2
-//    Branch for -7 > M
-//
-{ .mmb
-(p0)  ld4 GR_Z_2 = [GR_Index2],4 
-(p0)  ld8 GR_Table_Base = [GR_Table_Base] 
-	nop.b 999 ;;
-}
-(p0)  nop.i 999
-//
-//    Load Z_2
-//    N = N - Bias
-//    Tablebase points to Table3
-//
+;;
+
 { .mmi
-(p0)  ldfs  FR_G_tmp = [GR_Index2],4 ;; 
-//
-//    Load G_2
-//    pmpyshr2  X_2= (X_1,Z_2,15)
-//    float_N = setf.sig(N)
-//    ScaleN = Bias - N
-//
-(p0)  ldfs  FR_H_tmp = [GR_Index2],8 
-	nop.i 999 ;;
+      ldfps  FR_G2, FR_H2 = [GR_ad_tbl_2],8   // Load G_2, H_2
+      cmp.lt  p8, p9 =  GR_M, GR_exp_2tom7    // Test |x| < 2^-7
+      cmp.lt  p7, p0 =  GR_M, GR_exp_2tom80   // Test |x| < 2^-80
 }
-//
-//    Load H_2
-//    two_negN = setf.exp(scaleN)
-//    G = G_1 * G_2
-//
+;;
+
+// Small path is separate code
+//  p7 is for the small path: |x| < 2^-80
+// near1 and regular paths are merged.
+//  p8 is for the near1 path: |x| < 2^-7
+//  p9 is for regular path:   |x| >= 2^-7
+
 { .mfi
-(p0)  ldfd  FR_h_tmp = [GR_Index2],0 
-	nop.f 999
-(p0)  pmpyshr2.u GR_X_2 = GR_X_1,GR_Z_2,15 ;; 
+      ldfd  FR_h2 = [GR_ad_tbl_2]             // Load h_2
+      nop.f 999
+      nop.i 999
 }
-{ .mii
-	nop.m 999
-(p0)  extr.u GR_Index3 = GR_X_2, 1, 5 ;; 
-//
-//    Load h_2
-//    H = H_1 + H_2 
-//    h = h_1 + h_2 
-//    Index3 = extr.u(X_2,1,5)
-//
-(p0)  shladd GR_Index3 = GR_Index3,4,GR_Table_Base 
+{ .mfb
+(p9)  setf.exp FR_2_to_minus_N = GR_minus_N   // Form 2^(-N)
+(p7)  fnma.s0  f8 = FR_X_Prime, FR_X_Prime, FR_X_Prime // Result x - x*x
+(p7)  br.ret.spnt  b0                         // Branch if |x| < 2^-80
 }
+;;
+
 { .mmi
-	nop.m 999
-	nop.m 999
-//
-//    float_N = fcvt.xf(float_N)
-//    load G3
-//
-(p0)  addl GR_Table_Base = @ltoff(Constants_Q#),gp ;; 
+(p8)  ldfe FR_P7 = [GR_ad_p],16               // Load P_7 for near1 path
+(p8)  ldfe FR_P4 = [GR_ad_p2],16              // Load P_4 for near1 path
+(p9)  pmpyshr2.u GR_X_2 = GR_X_1,GR_Z_2,15    // Get bits 30-15 of X_1 * Z_2
 }
-{ .mmi
-      nop.m 999
-      ld8    GR_Table_Base = [GR_Table_Base]
-      nop.i 999
-};;
+;;
 
-{ .mfi
-(p0)  ldfe FR_log2_hi = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_S_lo = FR_S_lo, FR_two_negN 
-	nop.i 999 ;;
-}
-{ .mmf
-	nop.m 999
 //
-//    G = G3 * G
-//    Load h3
-//    Load log2_hi
-//    H = H + H3
+//    For performance, don't use result of pmpyshr2.u for 4 cycles.
 //
-(p0)  ldfe FR_log2_lo = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_G = FR_G, FR_G_tmp ;; 
-}
 { .mmf
-(p0)  ldfs  FR_G_tmp = [GR_Index3],4 
-//
-//    h = h + h3
-//    r = G * S_hi + 1 
-//    Load log2_lo
-//
-(p0)  ldfe FR_Q4 = [GR_Table_Base],16 
-(p0)  fadd.s1 FR_h = FR_h, FR_h_tmp ;; 
-}
-{ .mfi
-(p0)  ldfe FR_Q3 = [GR_Table_Base],16 
-(p0)  fadd.s1 FR_H = FR_H, FR_H_tmp 
-	nop.i 999 ;;
+(p8)  ldfe FR_P6 = [GR_ad_p],16               // Load P_6 for near1 path
+(p8)  ldfe FR_P3 = [GR_ad_p2],16              // Load P_3 for near1 path
+(p9)  fma.s1  FR_S_lo = FR_S_lo, f1, FR_BB    // S_lo = S_lo + BB
 }
+;;
+
 { .mmf
-(p0)  ldfs  FR_H_tmp = [GR_Index3],4 
-(p0)  ldfe FR_Q2 = [GR_Table_Base],16 
-//
-//    Comput Index for Table3
-//    S_lo = S_lo * two_negN
-//
-(p0)  fcvt.xf FR_float_N = FR_float_N ;; 
+(p8)  ldfe FR_P5 = [GR_ad_p],16               // Load P_5 for near1 path
+(p8)  ldfe FR_P2 = [GR_ad_p2],16              // Load P_2 for near1 path
+(p8)  fmpy.s1 FR_wsq = FR_W, FR_W             // wsq = w * w for near1 path
 }
-//
-//    If S_lo == 0, set p8 false
-//    Load H3
-//    Load ptr to table of polynomial coeff.
-//
-{ .mmf
-(p0)  ldfd  FR_h_tmp = [GR_Index3],0 
-(p0)  ldfe FR_Q1 = [GR_Table_Base],0 
-(p0)  fcmp.eq.unc.s1 p0, p8 =  FR_S_lo, f0 ;; 
+;;
+
+{ .mmi
+(p8)  ldfe FR_P1 = [GR_ad_p2],16 ;;           // Load P_1 for near1 path
+      nop.m 999
+(p9)  extr.u GR_Index3 = GR_X_2, 1, 5         // Extract bits 1-5 of X_2
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 FR_G = FR_G, FR_G_tmp 
-	nop.i 999 ;;
+(p9)  shladd GR_ad_tbl_3 = GR_Index3, 4, GR_ad_tbl_3  // Point to G_3
+(p9)  fcvt.xf FR_float_N = FR_float_N
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_H = FR_H, FR_H_tmp 
-	nop.i 999 ;;
+(p9)  ldfps  FR_G3, FR_H3 = [GR_ad_tbl_3],8   // Load G_3, H_3
+      nop.f 999
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fms.s1 FR_r = FR_G, FR_S_hi, f1 
-	nop.i 999
+(p9)  ldfd  FR_h3 = [GR_ad_tbl_3]             // Load h_3
+(p9)  fmpy.s1 FR_G = FR_G, FR_G2              // G = G_1 * G_2
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fadd.s1 FR_h = FR_h, FR_h_tmp 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fadd.s1 FR_H = FR_H, FR_H2              // H = H_1 + H_2
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_float_N, FR_log2_hi, FR_H 
-	nop.i 999 ;;
+;;
+
+{ .mmf
+      nop.m 999
+      nop.m 999
+(p9)  fadd.s1 FR_h = FR_h, FR_h2              // h = h_1 + h_2
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    Load Q4 
-//    Load Q3 
-//    Load Q2 
-//    Load Q1 
-//
-(p8) fma.s1 FR_r = FR_G, FR_S_lo, FR_r 
-	nop.i 999
+      nop.m 999
+(p8)  fmpy.s1 FR_w4 = FR_wsq, FR_wsq          // w4 = w^4 for near1 path
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    poly_lo = r * Q4 + Q3
-//    rsq = r* r
-//
-(p0)  fma.s1 FR_h = FR_float_N, FR_log2_lo, FR_h 
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fma.s1 FR_p87 = FR_W, FR_P8, FR_P7      // p87 = w * P8 + P7
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    If (S_lo!=0) r = s_lo * G + r
-//
-(p0)  fma.s1 FR_poly_lo = FR_r, FR_Q4, FR_Q3 
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1  FR_S_lo = FR_S_lo, FR_2_to_minus_N, f0 // S_lo = S_lo * 2^(-N)
+      nop.i 999
 }
-//
-//    Create a 0x00000....01
-//    poly_lo = poly_lo * rsq + h
-//
 { .mfi
-(p0)  setf.sig FR_dummy = GR_Perturb 
-(p0)  fmpy.s1 FR_rsq = FR_r, FR_r 
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fma.s1 FR_p43 = FR_W, FR_P4, FR_P3      // p43 = w * P4 + P3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    h = N * log2_lo + h 
-//    Y_hi = n * log2_hi + H 
-//
-(p0)  fma.s1 FR_poly_lo = FR_poly_lo, FR_r, FR_Q2 
-	nop.i 999
+      nop.m 999
+(p9)  fmpy.s1 FR_G = FR_G, FR_G3              // G = (G_1 * G_2) * G_3
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_poly_hi = FR_Q1, FR_rsq, FR_r 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fadd.s1 FR_H = FR_H, FR_H3              // H = (H_1 + H_2) + H_3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    poly_lo = r * poly_o + Q2 
-//    poly_hi = Q1 * rsq + r 
-//
-(p0)  fmpy.s1 FR_poly_lo = FR_poly_lo, FR_r 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fadd.s1 FR_h = FR_h, FR_h3              // h = (h_1 + h_2) + h_3
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_poly_lo = FR_poly_lo, FR_rsq, FR_h 
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p0)  fadd.s1 FR_Y_lo = FR_poly_hi, FR_poly_lo 
-//
-//    Create the FR for a binary "or"
-//    Y_lo = poly_hi + poly_lo
-//
-// (p0)  for FR_dummy = FR_Y_lo,FR_dummy ;;
-//
-//    Turn the lsb of Y_lo ON
-//
-// (p0)  fmerge.se FR_Y_lo =  FR_Y_lo,FR_dummy ;;
-//
-//    Merge the new lsb into Y_lo, for alone doesn't
-//
-(p0)  br.cond.sptk LOGL_main ;; 
-}
-L(log1pl_near): 
-{ .mmi
-	nop.m 999
-	nop.m 999
-//    /*******************************************************/
-//    /*********** Branch log1pl_near  ************************/
-//    /*******************************************************/
-(p0)  addl GR_Table_Base = @ltoff(Constants_P#),gp ;; 
-}
-{ .mmi
       nop.m 999
-      ld8    GR_Table_Base = [GR_Table_Base]
+(p8)  fmpy.s1 FR_w6 = FR_w4, FR_wsq           // w6 = w^6 for near1 path
       nop.i 999
-};;
-//
-//    Load base address of poly. coeff.
-//
-{ .mmb
-(p0)  add GR_Table_ptr = 0x40,GR_Table_Base  
-//
-//    Address tables with separate pointers 
-//
-(p0)  ldfe FR_P8 = [GR_Table_Base],16 
-	nop.b 999 ;;
-}
-{ .mmb
-(p0)  ldfe FR_P4 = [GR_Table_ptr],16 
-//
-//    Load P4
-//    Load P8
-//
-(p0)  ldfe FR_P7 = [GR_Table_Base],16 
-	nop.b 999 ;;
-}
-{ .mmf
-(p0)  ldfe FR_P3 = [GR_Table_ptr],16 
-//
-//    Load P3
-//    Load P7
-//
-(p0)  ldfe FR_P6 = [GR_Table_Base],16 
-(p0)  fmpy.s1 FR_wsq = FR_W, FR_W ;; 
 }
+;;
+
 { .mfi
-(p0)  ldfe FR_P2 = [GR_Table_ptr],16 
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fma.s1 FR_p432 = FR_W, FR_p43, FR_P2    // p432 = w * p43 + P2
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_P4, FR_P3 
-	nop.i 999
+      nop.m 999
+(p8)  fma.s1 FR_p876 = FR_W, FR_p87, FR_P6    // p876 = w * p87 + P6
+      nop.i 999
 }
-//
-//    Load P2
-//    Load P6
-//    Wsq = w * w
-//    Y_hi = p4 * w + p3
-//
+;;
+
 { .mfi
-(p0)  ldfe FR_P5 = [GR_Table_Base],16 
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_P8, FR_P7 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fms.s1 FR_r = FR_G, FR_S_hi, f1         // r = G * S_hi - 1
+      nop.i 999
 }
 { .mfi
-(p0)  ldfe FR_P1 = [GR_Table_ptr],16 
-//
-//    Load P1
-//    Load P5
-//    Y_lo = p8 * w + P7
-//
-(p0)  fmpy.s1 FR_w4 = FR_wsq, FR_wsq 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_Y_hi = FR_float_N, FR_log2_hi, FR_H // Y_hi = N * log2_hi + H
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_Y_hi, FR_P2 
-	nop.i 999
+      nop.m 999
+(p9)  fma.s1 FR_h = FR_float_N, FR_log2_lo, FR_h  // h = N * log2_lo + h
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_Y_lo, FR_P6 
-(p0)  add GR_Perturb = 0x1, r0 ;; 
+      nop.m 999
+(p9)  fma.s1 FR_r = FR_G, FR_S_lo, FR_r        // r = G * S_lo + (G * S_hi - 1)
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//    w4 = w2 * w2 
-//    Y_hi = y_hi * w + p2 
-//    Y_lo = y_lo * w + p6 
-//    Create perturbation bit
-//
-(p0)  fmpy.s1 FR_w6 = FR_w4, FR_wsq 
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fma.s1 FR_p4321 = FR_W, FR_p432, FR_P1      // p4321 = w * p432 + P1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W, FR_Y_hi, FR_P1 
-	nop.i 999
+      nop.m 999
+(p8)  fma.s1 FR_p8765 = FR_W, FR_p876, FR_P5      // p8765 = w * p876 + P5
+      nop.i 999
 }
-//
-//    Y_hi = y_hi * w + p1 
-//    w6 = w4 * w2 
-//
+;;
+
 { .mfi
-(p0)  setf.sig FR_Q4 = GR_Perturb 
-(p0)  fma.s1 FR_Y_lo = FR_W, FR_Y_lo, FR_P5 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_r, FR_Q4, FR_Q3      // poly_lo = r * Q4 + Q3
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_dummy = FR_wsq,FR_Y_hi, f0 
-	nop.i 999
+      nop.m 999
+(p9)  fmpy.s1 FR_rsq = FR_r, FR_r                 // rsq = r * r
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)  fma.s1 FR_Y_hi = FR_W,f1,f0 
-	nop.i 999
-};;
-{ .mfb
-	nop.m 999
-//
-//    Y_hi = w 
-//    Y_lo = y_lo * w + p5 
-//
-(p0)  fma.s1 FR_Y_lo = FR_w6, FR_Y_lo,FR_dummy 
-//
-//    Y_lo = y_lo * w6   + y_high order part. 
-//
-//    performance
-//
-(p0)  br.cond.sptk LOGL_main ;; 
-}
-L(log1pl_small): 
-{ .mmi
-	nop.m 999
-//  /*******************************************************/
-//  /*********** Branch log1pl_small  ***********************/
-//  /*******************************************************/
-(p0)  addl GR_Table_Base = @ltoff(Constants_Threshold#),gp
+      nop.m 999
+(p8)  fma.s1 FR_Y_lo = FR_wsq, FR_p4321, f0       // Y_lo = wsq * p4321
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p0)  mov FR_Em1 = FR_W 
-(p0)  cmp.eq.unc  p7, p0 = r0, r0 ;; 
-}
-{ .mlx
-      ld8    GR_Table_Base = [GR_Table_Base]
-(p0)  movl GR_Expo_Range = 0x0000000000000004 ;; 
-}
-//
-//    Set Safe to true
-//    Set Expo_Range = 0 for single
-//    Set Expo_Range = 2 for double 
-//    Set Expo_Range = 4 for double-extended 
-//
-{ .mmi
-(p0)  shladd GR_Table_Base = GR_Expo_Range,4,GR_Table_Base ;; 
-(p0)  ldfe FR_Threshold = [GR_Table_Base],16 
-	nop.i 999
-}
-{ .mlx
-	nop.m 999
-(p0)  movl GR_Bias = 0x000000000000FF9B ;; 
+(p8)  fma.s1 FR_Y_hi = FR_W, f1, f0               // Y_hi = w for near1 path
+      nop.i 999
 }
+;;
+
 { .mfi
-(p0)  ldfe FR_Tiny = [GR_Table_Base],0 
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_poly_lo, FR_r, FR_Q2 // poly_lo = poly_lo * r + Q2
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fcmp.gt.unc.s1 p13, p12 =  FR_abs_W, FR_Threshold 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_rcub = FR_rsq, FR_r, f0           // rcub = r^3
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13) fnmpy.s1 FR_Y_lo = FR_W, FR_W 
-	nop.i 999
+      nop.m 999
+(p8)  fma.s1 FR_Y_lo = FR_w6, FR_p8765,FR_Y_lo // Y_lo = w6 * p8765 + w2 * p4321
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p13) fadd FR_SCALE = f0, f1 
-	nop.i 999 ;;
+      nop.m 999
+(p9)  fma.s1 FR_poly_hi = FR_Q1, FR_rsq, FR_r     // poly_hi = Q1 * rsq + r
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p12) fsub.s1 FR_Y_lo = f0, FR_Tiny 
-(p12) cmp.ne.unc  p7, p0 = r0, r0 
+      nop.m 999
+(p9)  fma.s1 FR_poly_lo = FR_poly_lo, FR_rcub, FR_h // poly_lo = poly_lo*r^3 + h
+      nop.i 999
 }
+;;
+
 { .mfi
-(p12) setf.exp FR_SCALE = GR_Bias 
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-//
-//    Set p7 to SAFE = FALSE
-//    Set Scale = 2^-100 
-//
-(p0)  fma.s0 f8 = FR_Y_lo,FR_SCALE,FR_Y_hi
-(p0)  br.ret.sptk   b0 ;; 
+      nop.m 999
+(p9)  fadd.s1 FR_Y_lo = FR_poly_hi, FR_poly_lo    // Y_lo = poly_hi + poly_lo 
+      nop.i 999
 }
-L(LOGL_64_one): 
+;;
+
+// Remainder of code is common for near1 and regular paths
 { .mfb
-	nop.m 999
-(p0)  fmpy.s0 f8 = FR_Input_X, f0 
-(p0)  br.ret.sptk   b0 ;; 
+      nop.m 999
+      fadd.s0  f8 = FR_Y_lo,FR_Y_hi               // Result=Y_lo+Y_hi
+      br.ret.sptk   b0                       // Common exit for 2^-80 < x < inf
 }
-//    
-//    Raise divide by zero for +/-0 input.
-//    
-L(LOGL_64_zero): 
-{ .mfi
-(p0)  mov   GR_Parameter_TAG = 0
+;;
+
+
+// Here if x=-1
+LOG1P_EQ_Minus_1: 
 //
-//    If we have logl(1), log10l(1) or log1pl(0), return 0.
+//    If x=-1 raise divide by zero and return -inf
 //  
-(p0)  fsub.s0 FR_Output_X_tmp = f0, f1 
-	nop.i 999 ;;
-}
-{ .mii
-(p14) mov   GR_Parameter_TAG = 6 
-	nop.i 999 ;;
-(p15) mov   GR_Parameter_TAG = 138 ;; 
-}
-{ .mfb
-	nop.m 999
-(p0)  frcpa.s0 FR_Output_X_tmp, p8 =  FR_Output_X_tmp, f0 
-(p0)  br.cond.sptk __libm_error_region ;; 
+{ .mfi
+      mov   GR_Parameter_TAG = 138
+      fsub.s1 FR_Output_X_tmp = f0, f1 
+      nop.i 999
 }
+;;
+
 { .mfb
-	nop.m 999
-//     
-//    Report that logl(0) computed
-//     { .mfb
-(p0)  mov   FR_Input_X     = FR_Output_X_tmp
-(p0)  br.ret.sptk   b0 ;;
+      nop.m 999
+      frcpa.s0 FR_Output_X_tmp, p8 =  FR_Output_X_tmp, f0 
+      br.cond.sptk __libm_error_region
 }
+;;
 
-L(LOGL_64_special): 
+LOG1P_special: 
 { .mfi
-	nop.m 999
-//    
-//    Return -Inf or value from handler.
-//    
-(p0)  fclass.m.unc p7, p0 =  FR_Input_X, 0x1E1 
-	nop.i 999 ;;
+      nop.m 999
+      fclass.m.unc p8, p0 =  FR_Input_X, 0x1E1  // Test for natval, nan, +inf
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
-//     
-//    Check for Natval, QNan, SNaN, +Inf   
-//    
-(p7)  fmpy.s0 f8 =  FR_Input_X, f1 
+;;
+
 //     
 //    For SNaN raise invalid and return QNaN.
 //    For QNaN raise invalid and return QNaN.
 //    For +Inf return +Inf.
 //    
-(p7)  br.ret.sptk   b0 ;;
+{ .mfb
+      nop.m 999
+(p8)  fmpy.s0 f8 =  FR_Input_X, f1 
+(p8)  br.ret.sptk   b0                          // Return for natval, nan, +inf
 }
+;;
+
 //    
 //    For -Inf raise invalid and return QNaN.
 //    
-{ .mii
-(p0)  mov   GR_Parameter_TAG = 1
-	nop.i 999 ;;
-(p14) mov   GR_Parameter_TAG = 7 ;;
-}
-{ .mfi
-(p15) mov   GR_Parameter_TAG = 139 
-	nop.f 999
-	nop.i 999 ;;
-}
 { .mfb
-	nop.m 999
-(p0)  fmpy.s0 FR_Output_X_tmp =  FR_Input_X, f0 
-(p0)  br.cond.sptk __libm_error_region ;; 
+      mov   GR_Parameter_TAG = 139
+      fmpy.s0 FR_Output_X_tmp =  FR_Input_X, f0 
+      br.cond.sptk __libm_error_region
 }
-//     
-//    Report that logl(-Inf) computed
-//    Report that log10l(-Inf) computed
-//    Report that log1p(-Inf) computed
-//     
-{ .mfb
-      nop.m 0
-(p0)  mov   FR_Input_X     = FR_Output_X_tmp
-(p0)  br.ret.sptk   b0 ;;
-}
-L(LOGL_64_unsupported): 
-{ .mfb
-	nop.m 999
+;;
+
+
+LOG1P_unsupported: 
 //    
-//    Return generated NaN or other value .
+//    Return generated NaN or other value.
 //    
-(p0)  fmpy.s0 f8 = FR_Input_X, f0 
-(p0)  br.ret.sptk   b0 ;;
+{ .mfb
+      nop.m 999
+      fmpy.s0 f8 = FR_Input_X, f0 
+      br.ret.sptk   b0
 }
-L(LOGL_64_negative): 
-{ .mfi
-	nop.m 999
-//     
-//    Deal with x < 0 in a special way 
-//    
-(p0)  frcpa.s0 FR_Output_X_tmp, p8 =  f0, f0 
+;;
+
+// Here if -inf < x < -1
+LOG1P_LT_Minus_1: 
 //     
-//    Deal with x < 0 in a special way - raise
+//    Deal with x < -1 in a special way - raise
 //    invalid and produce QNaN indefinite.
 //    
-(p0)  mov   GR_Parameter_TAG = 1 ;; 
-}
-{ .mii
-(p14) mov   GR_Parameter_TAG = 7
-	nop.i 999 ;;
-(p15) mov   GR_Parameter_TAG = 139
+{ .mfb
+      mov   GR_Parameter_TAG = 139
+      frcpa.s0 FR_Output_X_tmp, p8 =  f0, f0
+      br.cond.sptk __libm_error_region
 }
-.endp log1pl
-ASM_SIZE_DIRECTIVE(log1pl) 
+;;
+
 
-.proc __libm_error_region
-__libm_error_region:
+GLOBAL_IEEE754_END(log1pl)
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 { .mfi
         add   GR_Parameter_Y=-32,sp             // Parameter 2 value
@@ -1609,8 +1178,8 @@ __libm_error_region:
         br.call.sptk b0=__libm_error_support#  // Call error handling function
 };;
 { .mmi
-        nop.m 0
-        nop.m 0
+        nop.m 999
+        nop.m 999
         add   GR_Parameter_RESULT = 48,sp
 };;
 { .mmi
@@ -1625,52 +1194,7 @@ __libm_error_region:
         br.ret.sptk     b0                     // Return
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.proc LOGL_main 
-LOGL_main: 
-{ .mfi
-	nop.m 999
-//
-//    kernel_log_64 computes ln(X + E)
-//
-(p7)  fadd.s0 FR_Input_X = FR_Y_lo,FR_Y_hi
-      nop.i 0
-}
-{ .mmi
-      nop.m 999
-      nop.m 999
-(p14) addl GR_Table_Base = @ltoff(Constants_1_by_LN10#),gp ;; 
-}
-{ .mmi
-      nop.m 999
-(p14) ld8    GR_Table_Base = [GR_Table_Base]
-      nop.i 999
-};;
-
-{ .mmi
-(p14) ldfe FR_1LN10_hi = [GR_Table_Base],16 ;; 
-(p14) ldfe FR_1LN10_lo = [GR_Table_Base]
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p14) fmpy.s1 FR_Output_X_tmp = FR_Y_lo,FR_1LN10_hi
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p14) fma.s1  FR_Output_X_tmp = FR_Y_hi,FR_1LN10_lo,FR_Output_X_tmp
-	nop.i 999 ;;
-}
-{ .mfb
-	nop.m 999
-(p14) fma.s0 FR_Input_X = FR_Y_hi,FR_1LN10_hi,FR_Output_X_tmp
-(p0)  br.ret.sptk   b0 ;; 
-}
-.endp LOGL_main
-ASM_SIZE_DIRECTIVE(LOGL_main) 
+LOCAL_LIBM_END(__libm_error_region#)
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_logb.S b/sysdeps/ia64/fpu/s_logb.S
index 76c4fe778e..7ee898712b 100644
--- a/sysdeps/ia64/fpu/s_logb.S
+++ b/sysdeps/ia64/fpu/s_logb.S
@@ -1,10 +1,10 @@
 .file "logb.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,41 +20,43 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 2/16/00  Modified to conform to C9X 
-// 3/16/00  Improved speed
-// 4/04/00  Unwind support added
-// 5/30/00  Fixed bug when x double-extended denormal
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 02/16/00 Modified to conform to C9X
+// 03/16/00 Improved speed
+// 04/04/00 Unwind support added
+// 05/30/00 Fixed bug when x double-extended denormal
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
 //
 // API
 //==============================================================
-// double logb( double x);
+// double logb( double x );
 //
 // Overview of operation
 //==============================================================
-// The logb function extracts the exponent of x as an integer in 
-// floating-point format. 
+// The logb function extracts the exponent of x as an integer in
+// floating-point format.
 // logb computes log2 of x as a double
 //
 // logb is similar to ilogb but differs in the  following ways:
@@ -71,217 +73,169 @@
 //
 // Registers used
 //==============================================================
-// general registers used: 
-// ar.pfs r32 
-// r33 -> r37
-// r38 -> r41 used as parameters to error path
+// general registers used:
+// r26 -> r38
+// r35 -> r38 used as parameters to error path
 //
-// predicate registers used: 
+// predicate registers used:
 // p6, p7, p8
-// floating-point registers used: 
+// floating-point registers used:
 // f9, f10, f11
 // f8, input
 
-#include "libm_support.h"
+rExpBias            = r26
+rExpMask            = r27
+rSignexp_x          = r28
+rExp_x              = r29
+rTrueExp_x          = r30
+rExp_2to64          = r31
 
-GR_SAVE_B0          = r34
-GR_SAVE_GP          = r35
 GR_SAVE_PFS         = r32
+GR_SAVE_B0          = r33
+GR_SAVE_GP          = r34
 
-GR_Parameter_X      = r38
-GR_Parameter_Y      = r39
-GR_Parameter_RESULT = r40
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Parameter_TAG    = r38
 
-.align 32
-.global logb#
+fExp_in_signif      = f9
+fNorm_x             = f10
+fFloat_Exp          = f10
+f2to64              = f11
 
 .section .text
-.proc  logb#
-.align 32
+GLOBAL_LIBM_ENTRY(logb)
 
-
-logb: 
-
-// qnan snan inf norm     unorm 0 -+
-// 0    0    0   0        1     0 11
-// 0                      b
-{ .mfi
-      alloc          r32=ar.pfs,1,5,4,0
-(p0)  fclass.m.unc  p8,p0 = f8, 0x0b
-      nop.i 999
-}
 // X NORMAL
-// r37 = exp(f8) - - 0xffff
-// sig(f8) = r37
+// TrueExp_x = exp(f8) - 0xffff
+// sig = TrueExp_x
 // f8 = convert_to_fp (sig))
 { .mfi
-(p0)  getf.exp      r35 = f8
-(p0)  fnorm         f10=f8
-      nop.i 999 ;;
+      getf.exp        rSignexp_x = f8
+      fclass.m        p8,p0 = f8, 0x0b   // Test for x unorm
+      mov             rExpBias = 0xffff  // Exponent bias
 }
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-{ .mmf
-(p0)  mov      r33 = 0xffff
-(p0)  mov      r34 = 0x1ffff
-(p0)  fclass.m.unc  p6,p0 = f8, 0xe3 ;;
+{ .mfi
+      nop.m           0
+      fnorm.s1        fNorm_x = f8
+      mov             rExpMask = 0x1ffff // Exponent mask
 }
+;;
 
+// Form signexp of 2^64 in case need to scale denormal
 { .mfb
-(p0)  and           r36 = r35, r34
-(p0)  fclass.m.unc  p7,p0 = f8, 0x07
-(p8)  br.cond.spnt  L(LOGB_DENORM) ;;
+      mov             rExp_2to64 = 0x1003f
+      fclass.m        p6,p0 = f8, 0x1e3  // Test x natval, nan, inf
+(p8)  br.cond.spnt    LOGB_DENORM        // Branch if x unorm
 }
+;;
 
-{ .mib
-(p0)  sub           r37 = r36, r33
-      nop.i 999
-(p6)  br.cond.spnt  L(LOGB_NAN_INF) ;;
+LOGB_COMMON:
+// Return here from LOGB_DENORM
+{ .mfi
+      and             rExp_x = rSignexp_x, rExpMask // Get biased exponent
+      fclass.m        p7,p0 = f8, 0x07   // Test x zero
+      nop.i           0
 }
+;;
 
-{ .mib
-(p0)  setf.sig      f9  = r37
-      nop.i 999
-(p7)  br.cond.spnt  L(LOGB_ZERO) ;;
+// X NAN or INFINITY, return f8 * f8
+{ .mfb
+      sub             rTrueExp_x = rExp_x, rExpBias // Get true exponent
+(p6)  fma.d.s0        f8= f8,f8,f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt     b0                 // Exit if x natval, nan, inf
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fcvt.xf       f10 = f9
-      nop.i 999 ;;
+{ .mib
+      setf.sig        fExp_in_signif = rTrueExp_x // Exponent as integer in fp
+      nop.i 999
+(p7)  br.cond.spnt    LOGB_ZERO
 }
+;;
 
+// Result can be represented in less than 24 bits, so no precision completer
+// is needed.
 { .mfb
-      nop.m 999
-(p0)  fnorm.d       f8 = f10
-(p0)  br.ret.sptk    b0 ;;
+      nop.m           0
+      fcvt.xf         f8 = fExp_in_signif
+      br.ret.sptk     b0                 // Exit main path, 0 < |x| < inf
 }
+;;
 
-L(LOGB_DENORM):
-// Form signexp of 2^64 in case need to scale denormal
+LOGB_DENORM:
+// Form 2^64 in case need to scale denormal
 // Check to see if double-extended denormal
 { .mfi
-(p0)  mov r38 = 0x1003f
-(p0)  fclass.m.unc  p8,p0 = f10, 0x0b
-      nop.i 999 ;;
+      setf.exp        f2to64 = rExp_2to64
+      fclass.m        p8,p0 = fNorm_x, 0x0b
+      nop.i           0
 }
+;;
 
-// Form 2^64 in case need to scale denormal
 { .mfi
-(p0)  setf.exp f11 = r38
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s0      p7,p0 = f8, f0           // Dummy op to set denormal flag
+      nop.i           0
 }
+;;
 
 // If double-extended denormal add 64 to exponent bias for scaling
 // If double-extended denormal form x * 2^64 which is normal
 { .mfi
-(p8)  add r33 = 64, r33
-(p8)  fmpy f10 = f10, f11    
-      nop.i 999 ;;
+(p8)  add             rExpBias = 64, rExpBias
+(p8)  fmpy.s1         fNorm_x = fNorm_x, f2to64
+      nop.i           0
 }
+;;
 
 // Logic is the same as normal path but use normalized input
-{ .mmi
-(p0)  getf.exp      r35 = f10 ;;
-      nop.m 999
-      nop.i 999 ;;
-}
-
-{ .mmi
-(p0)  and           r36 = r35, r34 ;;
-(p0)  sub           r37 = r36, r33
-      nop.i 999 ;;
-}
-
-{ .mmi
-(p0)  setf.sig      f9  = r37
-      nop.m 999
-      nop.i 999 ;;
+{ .mib
+      getf.exp        rSignexp_x = fNorm_x
+      nop.i           0
+      br.cond.sptk    LOGB_COMMON              // Return to main path
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fcvt.xf       f10 = f9
-      nop.i 999 ;;
-}
+LOGB_ZERO:
+// Here if x zero
+// f10  = -|f8|
+// f9  = 1.0/f10 = -1.0/|f8| = -inf
 
-{ .mfb
-      nop.m 999
-(p0)  fnorm.d       f8 = f10
-(p0)  br.ret.sptk    b0 ;;
+{ .mmf
+      alloc           r32=ar.pfs,1,2,4,0
+      mov             GR_Parameter_TAG = 151  // Error code
+      fmerge.ns       f10 = f0,f8
 }
+;;
 
-L(LOGB_NAN_INF): 
-
-// X NAN or INFINITY, return f8 * f8
 { .mfb
-      nop.m 999
-(p0)  fma.d      f8= f8,f8,f0
-(p0)  br.ret.sptk   b0 ;;
+      nop.m           0
+      frcpa.s0        f9,p6 = f1,f10          // Produce -inf, Z flag
+      br.cond.sptk    __libm_error_region     // Call error support
 }
+;;
 
-.endp logb#
-ASM_SIZE_DIRECTIVE(logb)
-
-// Stack operations when calling error support.
-//       (1)               (2)                          (3) (call)              (4)
-//   sp   -> +          psp -> +                     psp -> +                   sp -> +
-//           |                 |                            |                         |
-//           |                 | <- GR_Y               R3 ->| <- GR_RESULT            | -> f8
-//           |                 |                            |                         |
-//           | <-GR_Y      Y2->|                       Y2 ->| <- GR_Y                 |
-//           |                 |                            |                         |
-//           |                 | <- GR_X               X1 ->|                         |
-//           |                 |                            |                         |
-//  sp-64 -> +          sp ->  +                     sp ->  +                         +
-//    save ar.pfs          save b0                                               restore gp
-//    save gp                                                                    restore ar.pfs
-
+GLOBAL_LIBM_END(logb)
 
 
-.proc __libm_error_region
-__libm_error_region:
-L(LOGB_ZERO): 
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 
-// f9  = |f8|
-// f10 = -f9 = -|f8|
-// f9  = 1.0/f10 = -1.0/-|f8|
-
-{ .mfi 
-      mov           r41 = 151      // Error code
-(p0)  fmerge.s      f9 = f0,f8
-      nop.i 999
-}
-;;
-
-
-{ .mfi
-      nop.m 999
-      fmerge.ns     f10 = f0,f9
-      nop.i 999
-}
-;;
-
-// (1)
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-        frcpa         f9,p6 = f1,f10
+        add   GR_Parameter_Y=-32,sp           // Parameter 2 value
+        nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs               // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                          // Create new stack
+        add sp=-64,sp                         // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                      // Save gp
+        mov GR_SAVE_GP=gp                     // Save gp
 };;
 
-
-// (2)
 { .mmi
         stfd [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
         add GR_Parameter_X    = 16,sp         // Parameter 1 address
@@ -290,38 +244,38 @@ L(LOGB_ZERO):
 };;
 
 .body
-// (3)
 { .mib
         stfd [GR_Parameter_X] = f8            // STORE Parameter 1 on stack
         add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
-        nop.b 0                                         
+        nop.b 0
 }
 { .mib
         stfd [GR_Parameter_Y] = f9            // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
         br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
 
-// (4)
 { .mmi
         ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
+
 { .mib
         mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
         br.ret.sptk   b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_logbf.S b/sysdeps/ia64/fpu/s_logbf.S
index f2f671f892..eefa270db9 100644
--- a/sysdeps/ia64/fpu/s_logbf.S
+++ b/sysdeps/ia64/fpu/s_logbf.S
@@ -1,10 +1,10 @@
 .file "logbf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,44 +20,46 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 2/16/00  Modified to conform to C9X 
-// 3/16/00  Improved speed
-// 4/04/00  Unwind support added
-// 5/30/00  Fixed bug when x double-extended denormal
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 02/16/00 Modified to conform to C9X
+// 03/16/00 Improved speed
+// 04/04/00 Unwind support added
+// 05/30/00 Fixed bug when x double-extended denormal
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
 //
 // API
 //==============================================================
-// float logbf( float x);
+// float logbf( float x );
 //
 // Overview of operation
 //==============================================================
-// The logbf function extracts the exponent of x as an integer in 
-// floating-point format. 
+// The logbf function extracts the exponent of x as an integer in
+// floating-point format.
 // logbf computes log2 of x as a float
-
-// logbf is similar to ilogbf but differs in the  following ways:
+//
+// logbf is similar to ilogbf but differs in the following ways:
 //         +-inf
 //            ilogbf: returns INT_MAX
 //             logbf: returns +inf
@@ -71,243 +73,208 @@
 //
 // Registers used
 //==============================================================
-// general registers used: 
-// ar.pfs r32 
-// r33 -> r37
-// r38 -> r41 used as parameters to error path
+// general registers used:
+// r26 -> r38
+// r35 -> r38 used as parameters to error path
 //
-// predicate registers used: 
+// predicate registers used:
 // p6, p7, p8
-//
-// floating-point registers used: 
+// floating-point registers used:
 // f9, f10, f11
 // f8, input
 
-#include "libm_support.h"
-
-GR_SAVE_B0                    = r34
-// r40 is address of table of coefficients
-GR_SAVE_PFS                   = r32
-GR_SAVE_GP                    = r35 
+rExpBias            = r26
+rExpMask            = r27
+rSignexp_x          = r28
+rExp_x              = r29
+rTrueExp_x          = r30
+rExp_2to64          = r31
 
-GR_Parameter_X                = r38
-GR_Parameter_Y                = r39
-GR_Parameter_RESULT           = r40
-GR_Parameter_TAG              = r41
+GR_SAVE_PFS         = r32
+GR_SAVE_B0          = r33
+GR_SAVE_GP          = r34
 
-FR_X             = f8
-FR_Y             = f0
-FR_RESULT        = f10
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Parameter_TAG    = r38
 
-
-.align 32
-.global logbf#
+fExp_in_signif      = f9
+fNorm_x             = f10
+fFloat_Exp          = f10
+f2to64              = f11
 
 .section .text
-.proc  logbf#
-.align 32
-
+GLOBAL_LIBM_ENTRY(logbf)
 
-logbf: 
-
-// qnan snan inf norm     unorm 0 -+
-// 0    0    0   0        1     0 11
-// 0                      b
-{ .mfi
-      alloc          r32=ar.pfs,1,5,4,0
-(p0)  fclass.m.unc  p8,p0 = f8, 0x0b
-      nop.i 999
-}
 // X NORMAL
-// r37 = exp(f8) - - 0xffff
-// sig(f8) = r37
+// TrueExp_x = exp(f8) - 0xffff
+// sig = TrueExp_x
 // f8 = convert_to_fp (sig))
 { .mfi
-(p0)  getf.exp      r35 = f8
-(p0)  fnorm         f10=f8
-      nop.i 999 ;;
+      getf.exp        rSignexp_x = f8
+      fclass.m        p8,p0 = f8, 0x0b   // Test for x unorm
+      mov             rExpBias = 0xffff  // Exponent bias
 }
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-{ .mmf
-(p0)  mov      r33 = 0xffff
-(p0)  mov      r34 = 0x1ffff
-(p0)  fclass.m.unc  p6,p0 = f8, 0xe3 ;;
+{ .mfi
+      nop.m           0
+      fnorm.s1        fNorm_x = f8
+      mov             rExpMask = 0x1ffff // Exponent mask
 }
+;;
 
+// Form signexp of 2^64 in case need to scale denormal
 { .mfb
-(p0)  and           r36 = r35, r34
-(p0)  fclass.m.unc  p7,p0 = f8, 0x07
-(p8)  br.cond.spnt  L(LOGB_DENORM) ;;
+      mov             rExp_2to64 = 0x1003f
+      fclass.m        p6,p0 = f8, 0x1e3  // Test x natval, nan, inf
+(p8)  br.cond.spnt    LOGB_DENORM        // Branch if x unorm
 }
+;;
 
-{ .mib
-(p0)  sub           r37 = r36, r33
-      nop.i 999
-(p6)  br.cond.spnt  L(LOGB_NAN_INF) ;;
+LOGB_COMMON:
+// Return here from LOGB_DENORM
+{ .mfi
+      and             rExp_x = rSignexp_x, rExpMask // Get biased exponent
+      fclass.m        p7,p0 = f8, 0x07   // Test x zero
+      nop.i           0
 }
+;;
 
-{ .mib
-(p0)  setf.sig      f9  = r37
-      nop.i 999
-(p7)  br.cond.spnt  L(LOGB_ZERO) ;;
+// X NAN or INFINITY, return f8 * f8
+{ .mfb
+      sub             rTrueExp_x = rExp_x, rExpBias // Get true exponent
+(p6)  fma.s.s0        f8= f8,f8,f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt     b0                 // Exit if x natval, nan, inf
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fcvt.xf       f10 = f9
-      nop.i 999 ;;
+{ .mib
+      setf.sig        fExp_in_signif = rTrueExp_x // Exponent as integer in fp
+      nop.i 999
+(p7)  br.cond.spnt    LOGB_ZERO
 }
+;;
 
+// Result can be represented in less than 24 bits, so no precision completer
+// is needed.
 { .mfb
-      nop.m 999
-(p0)  fnorm.s       f8 = f10
-(p0)  br.ret.sptk    b0 ;;
+      nop.m           0
+      fcvt.xf         f8 = fExp_in_signif
+      br.ret.sptk     b0                 // Exit main path, 0 < |x| < inf
 }
+;;
 
-L(LOGB_DENORM):
-// Form signexp of 2^64 in case need to scale denormal
+LOGB_DENORM:
+// Form 2^64 in case need to scale denormal
 // Check to see if double-extended denormal
 { .mfi
-(p0)  mov r38 = 0x1003f
-(p0)  fclass.m.unc  p8,p0 = f10, 0x0b
-      nop.i 999 ;;
+      setf.exp        f2to64 = rExp_2to64
+      fclass.m        p8,p0 = fNorm_x, 0x0b
+      nop.i           0
 }
+;;
 
-// Form 2^64 in case need to scale denormal
 { .mfi
-(p0)  setf.exp f11 = r38
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s0      p7,p0 = f8, f0           // Dummy op to set denormal flag
+      nop.i           0
 }
+;;
 
 // If double-extended denormal add 64 to exponent bias for scaling
 // If double-extended denormal form x * 2^64 which is normal
 { .mfi
-(p8)  add r33 = 64, r33
-(p8)  fmpy f10 = f10, f11    
-      nop.i 999 ;;
+(p8)  add             rExpBias = 64, rExpBias
+(p8)  fmpy.s1         fNorm_x = fNorm_x, f2to64
+      nop.i           0
 }
+;;
 
 // Logic is the same as normal path but use normalized input
-{ .mmi
-(p0)  getf.exp      r35 = f10 ;;
-      nop.m 999
-      nop.i 999 ;;
-}
-
-{ .mmi
-(p0)  and           r36 = r35, r34 ;;
-(p0)  sub           r37 = r36, r33
-      nop.i 999 ;;
-}
-
-{ .mmi
-(p0)  setf.sig      f9  = r37
-      nop.m 999
-      nop.i 999 ;;
+{ .mib
+      getf.exp        rSignexp_x = fNorm_x
+      nop.i           0
+      br.cond.sptk    LOGB_COMMON              // Return to main path
 }
+;;
 
-{ .mfi
-      nop.m 999
-(p0)  fcvt.xf       f10 = f9
-      nop.i 999 ;;
-}
+LOGB_ZERO:
+// Here if x zero
+// f10  = -|f8|
+// f9  = 1.0/f10 = -1.0/|f8| = -inf
 
-{ .mfb
-      nop.m 999
-(p0)  fnorm.s       f8 = f10
-(p0)  br.ret.sptk    b0 ;;
+{ .mmf
+      alloc           r32=ar.pfs,1,2,4,0
+      mov             GR_Parameter_TAG = 152  // Error code
+      fmerge.ns       f10 = f0,f8
 }
+;;
 
-L(LOGB_NAN_INF): 
-
-// X NAN or INFINITY, return f8 * f8
 { .mfb
-      nop.m 999
-(p0)  fma.s      f8= f8,f8,f0
-(p0)  br.ret.sptk   b0 ;;
+      nop.m           0
+      frcpa.s0        f9,p6 = f1,f10          // Produce -inf, Z flag
+      br.cond.sptk    __libm_error_region     // Call error support
 }
+;;
 
-L(LOGB_ZERO): 
+GLOBAL_LIBM_END(logbf)
 
-// X ZERO
-// return -1.0/fabs(f8)=-inf, set divide-by-zero flag, call error support
-{ .mfi
-      nop.m 999
-(p0)  fmerge.s      f9 = f0,f8
-      nop.i 999 ;;
-}
 
-{ .mfi
-      nop.m 999
-(p0)  fmerge.ns     f10 = f0,f9
-      nop.i 999 ;;
-}
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
 
 { .mfi
-      nop.m 999
-(p0)  frcpa         f10,p6 = f1,f10
-      nop.i 999 ;;
-}
-
-.endp logbf
-ASM_SIZE_DIRECTIVE(logbf)
-
-
-.proc __libm_error_region
-__libm_error_region:
-.prologue
-{ .mii
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
-(p0)    mov   GR_Parameter_TAG = 152                   
+        add   GR_Parameter_Y=-32,sp           // Parameter 2 value
+        nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs               // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
+        add sp=-64,sp                         // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+        mov GR_SAVE_GP=gp                     // Save gp
 };;
+
 { .mmi
-        stfs [GR_Parameter_Y] = FR_Y,16         // Store Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+        stfs [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X    = 16,sp         // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+        mov GR_SAVE_B0=b0                     // Save b0
 };;
+
 .body
 { .mib
-        stfs [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfs [GR_Parameter_X] = f8            // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfs [GR_Parameter_Y] = FR_RESULT       // Store Parameter 3 on stack
+        stfs [GR_Parameter_Y] = f9            // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#   // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
+
 { .mmi
         ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
+
 { .mib
-        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
-};; 
+        br.ret.sptk   b0
+};;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
 
 
 .type   __libm_error_support#,@function
diff --git a/sysdeps/ia64/fpu/s_logbl.S b/sysdeps/ia64/fpu/s_logbl.S
index 38b131f3aa..e312c1b438 100644
--- a/sysdeps/ia64/fpu/s_logbl.S
+++ b/sysdeps/ia64/fpu/s_logbl.S
@@ -1,10 +1,10 @@
 .file "logbl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,44 +20,46 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00  Initial version
-// 2/16/00  Modified to conform to C9X 
-// 3/16/00  Improved speed
-// 4/04/00  Unwind support added
-// 5/30/00  Fixed bug when x double-extended denormal
-// 8/15/00  Bundle added after call to __libm_error_support to properly
+// 02/02/00 Initial version
+// 02/16/00 Modified to conform to C9X
+// 03/16/00 Improved speed
+// 04/04/00 Unwind support added
+// 05/30/00 Fixed bug when x double-extended denormal
+// 08/15/00 Bundle added after call to __libm_error_support to properly
 //          set [the previously overwritten] GR_Parameter_RESULT.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
 //
 // API
 //==============================================================
-// long double logbl( long double x);
+// long double logbl( long double x );
 //
 // Overview of operation
 //==============================================================
-// The logbl function extracts the exponent of x as an integer in 
-// floating-point format. 
+// The logbl function extracts the exponent of x as an integer in
+// floating-point format.
 // logbl computes log2 of x as a long double
 //
-// logbl is similar to ilogbl but differs in the  following ways:
+// logbl is similar to ilogbl but differs in the following ways:
 //         +-inf
 //            ilogbl: returns INT_MAX
 //             logbl: returns +inf
@@ -71,229 +73,209 @@
 //
 // Registers used
 //==============================================================
-// general registers used: 
-// ar.pfs r32 
-// r33 -> r37
-// r38 -> r41 used as parameters to error path
+// general registers used:
+// r26 -> r38
+// r35 -> r38 used as parameters to error path
 //
-// predicate registers used: 
+// predicate registers used:
 // p6, p7, p8
-//
-// floating-point registers used: 
+// floating-point registers used:
 // f9, f10, f11
 // f8, input
 
-#include "libm_support.h"
+rExpBias            = r26
+rExpMask            = r27
+rSignexp_x          = r28
+rExp_x              = r29
+rTrueExp_x          = r30
+rExp_2to64          = r31
 
 GR_SAVE_PFS         = r32
-GR_SAVE_B0          = r34
-GR_SAVE_GP          = r35
-GR_Parameter_X      = r38
-GR_Parameter_Y      = r39
-GR_Parameter_RESULT = r40
-GR_Parameter_TAG    = r41
+GR_SAVE_B0          = r33
+GR_SAVE_GP          = r34
 
-FR_X                = f8
-FR_Y                = f0
-FR_RESULT           = f10
+GR_Parameter_X      = r35
+GR_Parameter_Y      = r36
+GR_Parameter_RESULT = r37
+GR_Parameter_TAG    = r38
 
-.align 32
-.global logbl#
+fExp_in_signif      = f9
+fNorm_x             = f10
+fFloat_Exp          = f10
+f2to64              = f11
 
 .section .text
-.proc  logbl#
-.align 32
-
+GLOBAL_LIBM_ENTRY(logbl)
 
-logbl: 
-
-// qnan snan inf norm     unorm 0 -+
-// 0    0    0   0        1     0 11
-// 0                      b
-{ .mfi
-      alloc          r32=ar.pfs,1,5,4,0
-(p0)  fclass.m.unc  p8,p0 = f8, 0x0b
-      nop.i 999
-}
 // X NORMAL
-// r37 = exp(f8) - - 0xffff
-// sig(f8) = r37
+// TrueExp_x = exp(f8) - 0xffff
+// sig = TrueExp_x
 // f8 = convert_to_fp (sig))
 { .mfi
-(p0)  getf.exp      r35 = f8
-(p0)  fnorm         f10=f8
-      nop.i 999 ;;
+      getf.exp        rSignexp_x = f8
+      fclass.m        p8,p0 = f8, 0x0b   // Test for x unorm
+      mov             rExpBias = 0xffff  // Exponent bias
 }
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     0 11
-// e                      3
-{ .mmf
-(p0)  mov      r33 = 0xffff
-(p0)  mov      r34 = 0x1ffff
-(p0)  fclass.m.unc  p6,p0 = f8, 0xe3 ;;
+{ .mfi
+      nop.m           0
+      fnorm.s1        fNorm_x = f8
+      mov             rExpMask = 0x1ffff // Exponent mask
 }
+;;
 
+// Form signexp of 2^64 in case need to scale denormal
 { .mfb
-(p0)  and           r36 = r35, r34
-(p0)  fclass.m.unc  p7,p0 = f8, 0x07
-(p8)  br.cond.spnt  L(LOGB_DENORM) ;;
+      mov             rExp_2to64 = 0x1003f
+      fclass.m        p6,p0 = f8, 0x1e3  // Test x natval, nan, inf
+(p8)  br.cond.spnt    LOGB_DENORM        // Branch if x unorm
 }
+;;
 
-{ .mib
-(p0)  sub           r37 = r36, r33
-      nop.i 999
-(p6)  br.cond.spnt  L(LOGB_NAN_INF) ;;
+LOGB_COMMON:
+// Return here from LOGB_DENORM
+{ .mfi
+      and             rExp_x = rSignexp_x, rExpMask // Get biased exponent
+      fclass.m        p7,p0 = f8, 0x07   // Test x zero
+      nop.i           0
 }
+;;
+
+// X NAN or INFINITY, return f8 * f8
+{ .mfb
+      sub             rTrueExp_x = rExp_x, rExpBias // Get true exponent
+(p6)  fma.s0          f8= f8,f8,f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt     b0                 // Exit if x natval, nan, inf
+}
+;;
 
 { .mib
-(p0)  setf.sig      f9  = r37
+      setf.sig        fExp_in_signif = rTrueExp_x // Exponent as integer in fp
       nop.i 999
-(p7)  br.cond.spnt  L(LOGB_ZERO) ;;
-}
-{ .mfi
-      nop.m 999
-(p0)  fcvt.xf       f10 = f9
-      nop.i 999 ;;
+(p7)  br.cond.spnt    LOGB_ZERO
 }
+;;
 
+// Result can be represented in less than 24 bits, so no precision completer
+// is needed.
 { .mfb
-      nop.m 999
-(p0)  fnorm       f8 = f10
-(p0)  br.ret.sptk    b0 ;;
+      nop.m           0
+      fcvt.xf         f8 = fExp_in_signif
+      br.ret.sptk     b0                 // Exit main path, 0 < |x| < inf
 }
+;;
 
-L(LOGB_DENORM):
-// Form signexp of 2^64 in case need to scale denormal
+LOGB_DENORM:
+// Form 2^64 in case need to scale denormal
 // Check to see if double-extended denormal
 { .mfi
-(p0)  mov r38 = 0x1003f
-(p0)  fclass.m.unc  p8,p0 = f10, 0x0b
-      nop.i 999 ;;
+      setf.exp        f2to64 = rExp_2to64
+      fclass.m        p8,p0 = fNorm_x, 0x0b
+      nop.i           0
 }
+;;
 
-// Form 2^64 in case need to scale denormal
 { .mfi
-(p0)  setf.exp f11 = r38
-      nop.f 999
-      nop.i 999 ;;
+      nop.m           0
+      fcmp.eq.s0      p7,p0 = f8, f0           // Dummy op to set denormal flag
+      nop.i           0
 }
+;;
 
 // If double-extended denormal add 64 to exponent bias for scaling
 // If double-extended denormal form x * 2^64 which is normal
 { .mfi
-(p8)  add r33 = 64, r33
-(p8)  fmpy f10 = f10, f11    
-      nop.i 999 ;;
+(p8)  add             rExpBias = 64, rExpBias
+(p8)  fmpy.s1         fNorm_x = fNorm_x, f2to64
+      nop.i           0
 }
+;;
 
 // Logic is the same as normal path but use normalized input
-{ .mmi
-(p0)  getf.exp      r35 = f10 ;;
-      nop.m 999
-      nop.i 999 ;;
+{ .mib
+      getf.exp        rSignexp_x = fNorm_x
+      nop.i           0
+      br.cond.sptk    LOGB_COMMON              // Return to main path
 }
+;;
 
-{ .mmi
-(p0)  and           r36 = r35, r34 ;;
-(p0)  sub           r37 = r36, r33
-      nop.i 999 ;;
-}
+LOGB_ZERO:
+// Here if x zero
+// f10  = -|f8|
+// f9  = 1.0/f10 = -1.0/|f8| = -inf
 
-{ .mmi
-(p0)  setf.sig      f9  = r37
-      nop.m 999
-      nop.i 999 ;;
-}
-
-{ .mfi
-      nop.m 999
-(p0)  fcvt.xf       f10 = f9
-      nop.i 999 ;;
+{ .mmf
+      alloc           r32=ar.pfs,1,2,4,0
+      mov             GR_Parameter_TAG = 150  // Error code
+      fmerge.ns       f10 = f0,f8
 }
+;;
 
 { .mfb
-      nop.m 999
-(p0)  fnorm       f8 = f10
-(p0)  br.ret.sptk    b0 ;;
+      nop.m           0
+      frcpa.s0        f9,p6 = f1,f10          // Produce -inf, Z flag
+      br.cond.sptk    __libm_error_region     // Call error support
 }
+;;
 
-L(LOGB_NAN_INF): 
-
-// X NAN or INFINITY, return f8 * f8
-{ .mfb
-      nop.m 999
-(p0)  fma        f8= f8,f8,f0
-(p0)  br.ret.sptk   b0 ;;
-}
+GLOBAL_LIBM_END(logbl)
 
-L(LOGB_ZERO): 
-{.mfi
-      nop.m 0
-(p0)  frcpa.s0       f10,p6 = f1,f0
-      nop.i 0
-};;
-{.mfi
-      mov            GR_Parameter_TAG = 150
-(p0)  fms.s1         f10 = f0,f0,f10
-      nop.i 0
-};;
-// X ZERO
-// return -1.0/fabs(f8)=-inf, set divide-by-zero flag, call error support
-.endp logbl
-ASM_SIZE_DIRECTIVE(logbl)
 
-.proc __libm_error_region
-__libm_error_region:
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
+
 { .mfi
-        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        add   GR_Parameter_Y=-32,sp           // Parameter 2 value
         nop.f 0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+        mov  GR_SAVE_PFS=ar.pfs               // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
+        add sp=-64,sp                         // Create new stack
         nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+        mov GR_SAVE_GP=gp                     // Save gp
 };;
+
 { .mmi
-        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
-        add GR_Parameter_X = 16,sp              // Parameter 1 address
+        stfe [GR_Parameter_Y] = f0,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X    = 16,sp         // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+        mov GR_SAVE_B0=b0                     // Save b0
 };;
+
 .body
 { .mib
-        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
-        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
-        nop.b 0                                 // Parameter 3 address
+        stfe [GR_Parameter_X] = f8            // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y    // Parameter 3 address
+        nop.b 0
 }
 { .mib
-        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        stfe [GR_Parameter_Y] = f9            // Store Parameter 3 on stack
         add   GR_Parameter_Y = -16,GR_Parameter_Y
-        br.call.sptk b0=__libm_error_support#  // Call error handling function
+        br.call.sptk b0=__libm_error_support# // Call error handling function
 };;
+
 { .mmi
-        nop.m 0
-        nop.m 0
         add   GR_Parameter_RESULT = 48,sp
+        nop.m 0
+        nop.i 0
 };;
+
 { .mmi
         ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
 .restore sp
         add   sp = 64,sp                       // Restore stack pointer
         mov   b0 = GR_SAVE_B0                  // Restore return address
 };;
+
 { .mib
         mov   gp = GR_SAVE_GP                  // Restore gp
         mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
-        br.ret.sptk     b0                     // Return
+        br.ret.sptk   b0
 };;
 
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
+LOCAL_LIBM_END(__libm_error_region)
+
 
 .type   __libm_error_support#,@function
 .global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_modf.S b/sysdeps/ia64/fpu/s_modf.S
index e8e672adfe..2008bbfc5c 100644
--- a/sysdeps/ia64/fpu/s_modf.S
+++ b/sysdeps/ia64/fpu/s_modf.S
@@ -1,10 +1,10 @@
 .file "modf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,14 +35,16 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 4/04/00: Improved speed, corrected result for NaN input
+// 02/02/00 Initial version
+// 04/04/00 Improved speed, corrected result for NaN input
 // 12/22/00 Fixed so inexact flag is never set, and invalid is not set for 
 //            qnans nor for inputs larger than 2^63.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
@@ -97,8 +99,6 @@
 //    p13 --------------------------------------------------->|
 //
 
-#include "libm_support.h"
-
 // floating-point registers used: 
 MODF_NORM_F8               = f9
 MODF_FRACTION_PART         = f10
@@ -115,23 +115,17 @@ modf_exp        = r18
 // r33 = iptr
      
 
-.align 32
-.global modf#
-
 .section .text
-.proc  modf#
-.align 32
-
+GLOBAL_LIBM_ENTRY(modf)
 
 // Main path is p9, p11, p8 FALSE and p12 TRUE
 
 // Assume input is normalized and get signexp
 // Normalize input just in case
 // Form exponent bias 
-modf: 
 { .mfi
       getf.exp  modf_signexp = f8
-      fnorm          MODF_NORM_F8  = f8
+      fnorm.s0          MODF_NORM_F8  = f8
       addl           modf_GR_FFFF  = 0xffff, r0
 }
 // Get integer part of input
@@ -176,10 +170,10 @@ modf:
 { .mfb
 (p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
 (p6)  fclass.m.unc p6,p7 = f8, 0x23
-(p8)  br.cond.spnt L(MODF_DENORM) ;;
+(p8)  br.cond.spnt MODF_DENORM ;;
 }
 
-L(MODF_COMMON):
+MODF_COMMON:
 // For HUGE set fraction to signed 0
 { .mfi
       nop.m 999
@@ -189,7 +183,7 @@ L(MODF_COMMON):
 // For HUGE set integer part to normalized input
 { .mfi
       nop.m 999
-(p9)  fnorm.d MODF_INTEGER_PART = MODF_NORM_F8
+(p9)  fnorm.d.s0 MODF_INTEGER_PART = MODF_NORM_F8
       nop.i 999 ;;
 }
 
@@ -201,7 +195,7 @@ L(MODF_COMMON):
 }
 { .mfi
       nop.m 999
-(p11) fnorm.d f8 = MODF_NORM_F8
+(p11) fnorm.d.s0 f8 = MODF_NORM_F8
       nop.i 999 ;;
 }
 
@@ -242,7 +236,7 @@ L(MODF_COMMON):
 // For NORMAL test if fraction part is zero; if so append correct sign
 { .mfi
       nop.m 999
-(p12) fcmp.eq.unc p7,p0 = MODF_NORM_F8, MODF_INTEGER_PART
+(p12) fcmp.eq.unc.s0 p7,p0 = MODF_NORM_F8, MODF_INTEGER_PART
       nop.i 999 ;;
 }
 
@@ -259,7 +253,7 @@ L(MODF_COMMON):
       br.ret.sptk    b0 ;;
 }
 
-L(MODF_DENORM):
+MODF_DENORM:
 // If x unorm get signexp from normalized input
 // If x unorm get integer part from normalized input
 { .mfi
@@ -278,8 +272,7 @@ L(MODF_DENORM):
 { .mfb
 (p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
       nop.f 999
-      br.cond.spnt L(MODF_COMMON) ;;
+      br.cond.spnt MODF_COMMON ;;
 }
 
-.endp modf
-ASM_SIZE_DIRECTIVE(modf)
+GLOBAL_LIBM_END(modf)
diff --git a/sysdeps/ia64/fpu/s_modff.S b/sysdeps/ia64/fpu/s_modff.S
index 6aa43c884d..edc1120971 100644
--- a/sysdeps/ia64/fpu/s_modff.S
+++ b/sysdeps/ia64/fpu/s_modff.S
@@ -1,10 +1,10 @@
 .file "modff.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,14 +35,16 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 4/04/00: Improved speed, corrected result for NaN input
+// 02/02/00 Initial version
+// 04/04/00 Improved speed, corrected result for NaN input
 // 12/22/00 Fixed so inexact flag is never set, and invalid is not set for 
 //            qnans nor for inputs larger than 2^63.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
@@ -97,8 +99,6 @@
 //    p13 --------------------------------------------------->|
 //
 
-#include "libm_support.h"
-
 // floating-point registers used: 
 MODF_NORM_F8               = f9
 MODF_FRACTION_PART         = f10
@@ -115,23 +115,17 @@ modf_exp        = r18
 // r33 = iptr
      
 
-.align 32
-.global modff#
-
 .section .text
-.proc  modff#
-.align 32
-
+GLOBAL_LIBM_ENTRY(modff)
 
 // Main path is p9, p11, p8 FALSE and p12 TRUE
 
 // Assume input is normalized and get signexp
 // Normalize input just in case
 // Form exponent bias 
-modff: 
 { .mfi
       getf.exp  modf_signexp = f8
-      fnorm          MODF_NORM_F8  = f8
+      fnorm.s0          MODF_NORM_F8  = f8
       addl           modf_GR_FFFF  = 0xffff, r0
 }
 // Get integer part of input
@@ -176,10 +170,10 @@ modff:
 { .mfb
 (p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
 (p6)  fclass.m.unc p6,p7 = f8, 0x23
-(p8)  br.cond.spnt L(MODF_DENORM) ;;
+(p8)  br.cond.spnt MODF_DENORM ;;
 }
 
-L(MODF_COMMON):
+MODF_COMMON:
 // For HUGE set fraction to signed 0
 { .mfi
       nop.m 999
@@ -189,7 +183,7 @@ L(MODF_COMMON):
 // For HUGE set integer part to normalized input
 { .mfi
       nop.m 999
-(p9)  fnorm.s MODF_INTEGER_PART = MODF_NORM_F8
+(p9)  fnorm.s.s0 MODF_INTEGER_PART = MODF_NORM_F8
       nop.i 999 ;;
 }
 
@@ -201,7 +195,7 @@ L(MODF_COMMON):
 }
 { .mfi
       nop.m 999
-(p11) fnorm.s f8 = MODF_NORM_F8
+(p11) fnorm.s.s0 f8 = MODF_NORM_F8
       nop.i 999 ;;
 }
 
@@ -242,7 +236,7 @@ L(MODF_COMMON):
 // For NORMAL test if fraction part is zero; if so append correct sign
 { .mfi
       nop.m 999
-(p12) fcmp.eq.unc p7,p0 = MODF_NORM_F8, MODF_INTEGER_PART
+(p12) fcmp.eq.unc.s0 p7,p0 = MODF_NORM_F8, MODF_INTEGER_PART
       nop.i 999 ;;
 }
 
@@ -259,7 +253,7 @@ L(MODF_COMMON):
       br.ret.sptk    b0 ;;
 }
 
-L(MODF_DENORM):
+MODF_DENORM:
 // If x unorm get signexp from normalized input
 // If x unorm get integer part from normalized input
 { .mfi
@@ -278,8 +272,7 @@ L(MODF_DENORM):
 { .mfb
 (p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
       nop.f 999
-      br.cond.spnt L(MODF_COMMON) ;;
+      br.cond.spnt MODF_COMMON ;;
 }
 
-.endp modff
-ASM_SIZE_DIRECTIVE(modff)
+GLOBAL_LIBM_END(modff)
diff --git a/sysdeps/ia64/fpu/s_modfl.S b/sysdeps/ia64/fpu/s_modfl.S
index b5eb509adf..eaf410cb6c 100644
--- a/sysdeps/ia64/fpu/s_modfl.S
+++ b/sysdeps/ia64/fpu/s_modfl.S
@@ -1,10 +1,10 @@
 .file "modfl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,15 +35,17 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 4/04/00: Improved speed, corrected result for NaN input
-// 5/30/00  Fixed bug for exponent 0x1003e
+// 02/02/00 Initial version
+// 04/04/00 Improved speed, corrected result for NaN input
+// 05/30/00 Fixed bug for exponent 0x1003e
 // 12/22/00 Fixed so inexact flag is never set, and invalid is not set for 
 //            qnans nor for inputs larger than 2^63.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
@@ -92,8 +94,6 @@
 //    p13 --------------------------------------------------->|
 //
 
-#include "libm_support.h"
-
 // floating-point registers used: 
 MODF_NORM_F8               = f9
 MODF_FRACTION_PART         = f10
@@ -110,23 +110,17 @@ modf_exp        = r18
 // r34 = iptr
      
 
-.align 32
-.global modfl#
-
 .section .text
-.proc  modfl#
-.align 32
-
+GLOBAL_LIBM_ENTRY(modfl)
 
 // Main path is p9, p11, p8 FALSE and p12 TRUE
 
 // Assume input is normalized and get signexp
 // Normalize input just in case
 // Form exponent bias 
-modfl: 
 { .mfi
       getf.exp  modf_signexp = f8
-      fnorm          MODF_NORM_F8  = f8
+      fnorm.s0          MODF_NORM_F8  = f8
       addl           modf_GR_FFFF  = 0xffff, r0
 }
 // Get integer part of input
@@ -171,10 +165,10 @@ modfl:
 { .mfb
 (p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
 (p6)  fclass.m.unc p6,p7 = f8, 0x23
-(p8)  br.cond.spnt L(MODF_DENORM) ;;
+(p8)  br.cond.spnt MODF_DENORM ;;
 }
 
-L(MODF_COMMON):
+MODF_COMMON:
 // For HUGE set fraction to signed 0
 { .mfi
       nop.m 999
@@ -184,7 +178,7 @@ L(MODF_COMMON):
 // For HUGE set integer part to normalized input
 { .mfi
       nop.m 999
-(p9)  fnorm MODF_INTEGER_PART = MODF_NORM_F8
+(p9)  fnorm.s0 MODF_INTEGER_PART = MODF_NORM_F8
       nop.i 999 ;;
 }
 
@@ -196,7 +190,7 @@ L(MODF_COMMON):
 }
 { .mfi
       nop.m 999
-(p11) fnorm   f8 = MODF_NORM_F8
+(p11) fnorm.s0   f8 = MODF_NORM_F8
       nop.i 999 ;;
 }
 
@@ -237,7 +231,7 @@ L(MODF_COMMON):
 // For NORMAL test if fraction part is zero; if so append correct sign
 { .mfi
       nop.m 999
-(p12) fcmp.eq.unc p7,p0 = MODF_NORM_F8, MODF_INTEGER_PART
+(p12) fcmp.eq.unc.s0 p7,p0 = MODF_NORM_F8, MODF_INTEGER_PART
       nop.i 999 ;;
 }
 
@@ -254,7 +248,7 @@ L(MODF_COMMON):
       br.ret.sptk    b0 ;;
 }
 
-L(MODF_DENORM):
+MODF_DENORM:
 // If x unorm get signexp from normalized input
 // If x unorm get integer part from normalized input
 { .mfi
@@ -273,8 +267,7 @@ L(MODF_DENORM):
 { .mfb
 (p10) cmp.ge.unc p9,p12  = modf_exp, modf_GR_no_frac
       nop.f 999
-      br.cond.spnt L(MODF_COMMON) ;;
+      br.cond.spnt MODF_COMMON ;;
 }
 
-.endp modfl
-ASM_SIZE_DIRECTIVE(modfl)
+GLOBAL_LIBM_END(modfl)
diff --git a/sysdeps/ia64/fpu/s_nearbyint.S b/sysdeps/ia64/fpu/s_nearbyint.S
index 6ee01ea260..ec1ff22dbc 100644
--- a/sysdeps/ia64/fpu/s_nearbyint.S
+++ b/sysdeps/ia64/fpu/s_nearbyint.S
@@ -1,11 +1,10 @@
 .file "nearbyint.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 10/19/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Tom Rowan, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,72 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 10/19/2000: Created
-// 2/08/01  Corrected behavior for all rounding modes.
+// 10/19/00 Created
+// 02/08/01 Corrected behavior for all rounding modes.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 07/25/03 Improved performance
 //==============================================================
-//
+
 // API
 //==============================================================
 // double nearbyint(double x)
+//==============================================================
 
-#include "libm_support.h"
-
-//
-// general registers used:  
-//
-
-nearbyint_GR_signexp   = r14
-nearbyint_GR_exponent  = r15
-nearbyint_GR_17ones    = r16
-nearbyint_GR_10033     = r17
-nearbyint_GR_fpsr      = r18
-nearbyint_GR_rcs0      = r19
-nearbyint_GR_rcs0_mask = r20
+// general input registers:
+// r14 - r21
 
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rFpsr      = r19
+rRcs0      = r20
+rRcs0Mask  = r21
 
-// predicate registers used: 
-// p6-11
+// floating-point registers:
+// f8 - f10
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
 
-NEARBYINT_NORM_f8      = f9                        
-NEARBYINT_FLOAT_INT_f8 = f10
-NEARBYINT_INT_f8       = f11
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // double nearbyint(double x)
-// Return an integer value (represented as a double) that is x rounded to integer in current
-// rounding mode 
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+// Return an integer value (represented as a double) that is x
+// rounded to integer in current rounding mode
+// Inexact is not set, otherwise result identical with rint.
+//==============================================================
 
 // double_extended
-// if the exponent is >= 1003e => 3F(true) = 63(decimal)
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
 // we have a significand of 64 bits 1.63-bits.
 // If we multiply by 2^63, we no longer have a fractional part
 // So input is an integer value already.
@@ -99,136 +93,125 @@ NEARBYINT_INT_f8       = f11
 // So input is an integer value already.
 
 // single
-// if the exponent is >= 10016 => 17(true) = 23(decimal)
-// we have a significand of 53 bits 1.52-bits. (implicit 1)
-// If we multiply by 2^52, we no longer have a fractional part
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-
-.align 32
-.global nearbyint#
-
 .section .text
-.proc  nearbyint#
-.align 32
-
-
-nearbyint: 
+GLOBAL_LIBM_ENTRY(nearbyint)
 
 { .mfi
-      mov nearbyint_GR_fpsr = ar40    // Read the fpsr--need to check rc.s0
-      fcvt.fx.s1     NEARBYINT_INT_f8  = f8
-      addl            nearbyint_GR_10033 = 0x10033, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10033, r0 // Set exponent at which is integer
 }
 { .mfi
-      nop.m 999
-      fnorm.s1        NEARBYINT_NORM_f8  = f8
-      mov         nearbyint_GR_17ones    = 0x1FFFF
-;;
+      nop.m            0
+      fcvt.fx.s1       fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
 { .mfi
-      nop.m 999
-      fclass.m.unc  p6,p0 = f8, 0xe7
-      mov         nearbyint_GR_rcs0_mask  = 0x0c00
-;;
+      mov              rFpsr = ar40          // Read fpsr -- check rc.s0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+      nop.i            0
 }
-
 { .mfb
-	nop.m 999
-(p6)  fnorm.d f8 = f8
-(p6)  br.ret.spnt   b0    // Exit if x nan, inf, zero
+      nop.m            0
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     RINT_UNORM            // Branch if x unorm
+}
 ;;
+
+
+RINT_COMMON:
+// Return here from RINT_UNORM
+{ .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.d.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.xf         NEARBYINT_FLOAT_INT_f8   = NEARBYINT_INT_f8
-	nop.i 999
-;;
+      mov              rRcs0Mask = 0x0c00     // Mask for rc.s0
+      fcvt.xf          f8 = fXInt             // Result assume |x| < 2^52
+      cmp.ge           p7,p8 = rExp, rBigexp  // Is |x| >= 2^52?
 }
+;;
 
+// We must correct result if |x| >= 2^52
 { .mfi
-      getf.exp nearbyint_GR_signexp  = NEARBYINT_NORM_f8
-      fcmp.eq.s0  p8,p0 = f8,f0      // Dummy op to set denormal
-        nop.i 999
-;;
+      nop.m            0
+(p7)  fma.d.s0         f8 = fNormX, f1, f0    // If |x| >= 2^52, result x
+      nop.i            0
 }
-
-
-{ .mii
-	nop.m 999
-	nop.i 999 
-      and nearbyint_GR_exponent = nearbyint_GR_signexp, nearbyint_GR_17ones
 ;;
-}
 
-{ .mmi
-      cmp.ge.unc      p7,p6 = nearbyint_GR_exponent, nearbyint_GR_10033
-      and nearbyint_GR_rcs0 = nearbyint_GR_rcs0_mask, nearbyint_GR_fpsr
-	nop.i 999
-;;
+{ .mfi
+      nop.m            0
+(p8)  fmerge.s         f8 = fNormX, f8        // Make sign nearbyint(x) = sign x
+      nop.i            0
 }
-
-// Check to see if s0 rounding mode is round to nearest.  If not then set s2
-// rounding mode to that of s0 and repeat conversions.
-L(NEARBYINT_COMMON):
-{ .mfb
-      cmp.ne   p11,p0 = nearbyint_GR_rcs0, r0
-(p6) fclass.m.unc   p9,p10  = NEARBYINT_FLOAT_INT_f8, 0x07  // Test for result=0
-(p11) br.cond.spnt L(NEARBYINT_NOT_ROUND_NEAREST)  // Branch if not round to nearest
 ;;
-}
 
 { .mfi
-	nop.m 999
-(p7) fnorm.d.s0   f8 = f8
-	nop.i 999
-;;
+(p8)  and              rRcs0 = rFpsr, rRcs0Mask // Get rounding mode for sf0
+      nop.f            0
+      nop.i            0
 }
+;;
 
-// If result is zero, merge sign of input
-{ .mfi
-     nop.m 999
-(p9) fmerge.s f8 = f8, NEARBYINT_FLOAT_INT_f8
-     nop.i 999
+// If |x| < 2^52 we must test for other rounding modes
+{ .mbb
+(p8)  cmp.ne.unc       p10,p0 = rRcs0, r0     // Test for other rounding modes
+(p10) br.cond.spnt     RINT_NOT_ROUND_NEAREST // Branch if not round nearest
+      br.ret.sptk      b0                     // Exit main path if round nearest
 }
+;;
+
+
+RINT_UNORM:
+// Here if x unorm
 { .mfb
-      nop.m 999
-(p10) fnorm.d f8 = NEARBYINT_FLOAT_INT_f8
-     br.ret.sptk    b0
-;;                             
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     RINT_COMMON            // Return to main path
 }
+;;
 
-
-L(NEARBYINT_NOT_ROUND_NEAREST):
-// Set rounding mode of s2 to that of s0
+RINT_NOT_ROUND_NEAREST:
+// Here if not round to nearest, and |x| < 2^52
+// Set rounding mode of s2 to that of s0, and repeat the conversion using s2
 { .mfi
-      mov nearbyint_GR_rcs0 = r0       // Clear so we don't come back here
-      fsetc.s2     0x7f, 0x40
-	nop.i 999
-;;
+      nop.m            0
+      fsetc.s2         0x7f, 0x40
+      nop.i            0
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.fx.s2     NEARBYINT_INT_f8  = f8
-	nop.i 999
+      nop.m            0
+      fcvt.fx.s2       fXInt  = fNormX        // Convert to int in significand
+      nop.i            0
+}
 ;;
+
+{ .mfi
+      nop.m            0
+      fcvt.xf          f8 = fXInt             // Expected result
+      nop.i            0
 }
+;;
 
+// Be sure sign of result = sign of input.  Fixes cases where result is 0.
 { .mfb
-	nop.m 999
-      fcvt.xf         NEARBYINT_FLOAT_INT_f8   = NEARBYINT_INT_f8
-      br.cond.sptk  L(NEARBYINT_COMMON)
-;;
+      nop.m            0
+      fmerge.s         f8 = fNormX, f8
+      br.ret.sptk      b0                     // Exit main path
 }
+;;
 
-
-.endp nearbyint
-ASM_SIZE_DIRECTIVE(nearbyint)
+GLOBAL_LIBM_END(nearbyint)
diff --git a/sysdeps/ia64/fpu/s_nearbyintf.S b/sysdeps/ia64/fpu/s_nearbyintf.S
index 7050ddc52c..aac7b5c126 100644
--- a/sysdeps/ia64/fpu/s_nearbyintf.S
+++ b/sysdeps/ia64/fpu/s_nearbyintf.S
@@ -1,11 +1,10 @@
 .file "nearbyintf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 10/19/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Tom Rowan, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,72 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 10/19/2000: Created
-// 2/08/01  Corrected behavior for all rounding modes.
+// 10/19/00 Created
+// 02/08/01 Corrected behavior for all rounding modes.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 07/25/03 Improved performance
 //==============================================================
-//
+
 // API
 //==============================================================
 // float nearbyintf(float x)
+//==============================================================
 
-#include "libm_support.h"
-
-//
-// general registers used:  
-//
-
-nearbyint_GR_signexp   = r14
-nearbyint_GR_exponent  = r15
-nearbyint_GR_17ones    = r16
-nearbyint_GR_10033     = r17
-nearbyint_GR_fpsr      = r18
-nearbyint_GR_rcs0      = r19
-nearbyint_GR_rcs0_mask = r20
+// general input registers:
+// r14 - r21
 
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rFpsr      = r19
+rRcs0      = r20
+rRcs0Mask  = r21
 
-// predicate registers used: 
-// p6-11
+// floating-point registers:
+// f8 - f10
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
 
-NEARBYINT_NORM_f8      = f9                        
-NEARBYINT_FLOAT_INT_f8 = f10
-NEARBYINT_INT_f8       = f11
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // float nearbyintf(float x)
-// Return an integer value (represented as a float) that is x rounded to integer in current
-// rounding mode 
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+// Return an integer value (represented as a float) that is x
+// rounded to integer in current rounding mode
+// Inexact is not set, otherwise result identical with rint.
+//==============================================================
 
 // double_extended
-// if the exponent is >= 1003e => 3F(true) = 63(decimal)
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
 // we have a significand of 64 bits 1.63-bits.
 // If we multiply by 2^63, we no longer have a fractional part
 // So input is an integer value already.
@@ -99,136 +93,125 @@ NEARBYINT_INT_f8       = f11
 // So input is an integer value already.
 
 // single
-// if the exponent is >= 10016 => 17(true) = 23(decimal)
-// we have a significand of 53 bits 1.52-bits. (implicit 1)
-// If we multiply by 2^52, we no longer have a fractional part
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-
-.align 32
-.global nearbyintf#
-
 .section .text
-.proc  nearbyintf#
-.align 32
-
-
-nearbyintf: 
+GLOBAL_LIBM_ENTRY(nearbyintf)
 
 { .mfi
-      mov nearbyint_GR_fpsr = ar40           // Read the fpsr--need to check rc.s0
-      fcvt.fx.s1     NEARBYINT_INT_f8  = f8
-      addl            nearbyint_GR_10033 = 0x10016, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10016, r0 // Set exponent at which is integer
 }
 { .mfi
-      nop.m 999
-      fnorm.s1        NEARBYINT_NORM_f8  = f8
-      mov         nearbyint_GR_17ones    = 0x1FFFF
-;;
+      nop.m            0
+      fcvt.fx.s1       fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
 { .mfi
-      nop.m 999
-      fclass.m.unc  p6,p0 = f8, 0xe7
-      mov         nearbyint_GR_rcs0_mask  = 0x0c00
-;;
+      mov              rFpsr = ar40          // Read fpsr -- check rc.s0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+      nop.i            0
 }
-
 { .mfb
-	nop.m 999
-(p6)  fnorm.s f8 = f8
-(p6)  br.ret.spnt   b0    // Exit if x nan, inf, zero
+      nop.m            0
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     RINT_UNORM            // Branch if x unorm
+}
 ;;
+
+
+RINT_COMMON:
+// Return here from RINT_UNORM
+{ .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.s.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.xf         NEARBYINT_FLOAT_INT_f8   = NEARBYINT_INT_f8
-	nop.i 999
-;;
+      mov              rRcs0Mask = 0x0c00     // Mask for rc.s0
+      fcvt.xf          f8 = fXInt             // Result assume |x| < 2^23
+      cmp.ge           p7,p8 = rExp, rBigexp  // Is |x| >= 2^23?
 }
+;;
 
+// We must correct result if |x| >= 2^23
 { .mfi
-      getf.exp nearbyint_GR_signexp  = NEARBYINT_NORM_f8
-      fcmp.eq.s0  p8,p0 = f8,f0      // Dummy op to set denormal
-        nop.i 999
-;;
+      nop.m            0
+(p7)  fma.s.s0         f8 = fNormX, f1, f0    // If |x| >= 2^23, result x
+      nop.i            0
 }
-
-
-{ .mii
-	nop.m 999
-	nop.i 999 
-      and      nearbyint_GR_exponent = nearbyint_GR_signexp, nearbyint_GR_17ones
 ;;
+
+{ .mfi
+      nop.m            0
+(p8)  fmerge.s         f8 = fNormX, f8        // Make sign nearbyintf(x)= sign x
+      nop.i            0
 }
+;;
 
-{ .mmi
-      cmp.ge.unc      p7,p6 = nearbyint_GR_exponent, nearbyint_GR_10033
-      and nearbyint_GR_rcs0 = nearbyint_GR_rcs0_mask, nearbyint_GR_fpsr
-	nop.i 999
+{ .mfi
+(p8)  and              rRcs0 = rFpsr, rRcs0Mask // Get rounding mode for sf0
+      nop.f            0
+      nop.i            0
+}
 ;;
+
+// If |x| < 2^23 we must test for other rounding modes
+{ .mbb
+(p8)  cmp.ne.unc       p10,p0 = rRcs0, r0     // Test for other rounding modes
+(p10) br.cond.spnt     RINT_NOT_ROUND_NEAREST // Branch if not round nearest
+      br.ret.sptk      b0                     // Exit main path if round nearest
 }
+;;
 
-// Check to see if s0 rounding mode is round to nearest.  If not then set s2
-// rounding mode to that of s0 and repeat conversions.
-L(NEARBYINT_COMMON):
+
+RINT_UNORM:
+// Here if x unorm
 { .mfb
-      cmp.ne   p11,p0 = nearbyint_GR_rcs0, r0
-(p6) fclass.m.unc   p9,p10  = NEARBYINT_FLOAT_INT_f8, 0x07  // Test for result=0
-(p11) br.cond.spnt L(NEARBYINT_NOT_ROUND_NEAREST)  // Branch if not round to nearest
-;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     RINT_COMMON            // Return to main path
 }
-
-{ .mfi
-	nop.m 999
-(p7) fnorm.s.s0   f8 = f8
-	nop.i 999
 ;;
-}
 
-// If result is zero, merge sign of input
+RINT_NOT_ROUND_NEAREST:
+// Here if not round to nearest, and |x| < 2^23
+// Set rounding mode of s2 to that of s0, and repeat the conversion using s2
 { .mfi
-     nop.m 999
-(p9) fmerge.s f8 = f8, NEARBYINT_FLOAT_INT_f8
-     nop.i 999
+      nop.m            0
+      fsetc.s2         0x7f, 0x40
+      nop.i            0
 }
-{ .mfb
-      nop.m 999
-(p10) fnorm.s f8 = NEARBYINT_FLOAT_INT_f8
-     br.ret.sptk    b0
 ;;
-}
-
 
-L(NEARBYINT_NOT_ROUND_NEAREST):
-// Set rounding mode of s2 to that of s0
 { .mfi
-      mov nearbyint_GR_rcs0 = r0       // Clear so we don't come back here
-      fsetc.s2     0x7f, 0x40
-	nop.i 999
-;;
+      nop.m            0
+      fcvt.fx.s2       fXInt  = fNormX        // Convert to int in significand
+      nop.i            0
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.fx.s2     NEARBYINT_INT_f8  = f8
-	nop.i 999
-;;
+      nop.m            0
+      fcvt.xf          f8 = fXInt             // Expected result
+      nop.i            0
 }
+;;
 
+// Be sure sign of result = sign of input.  Fixes cases where result is 0.
 { .mfb
-	nop.m 999
-      fcvt.xf         NEARBYINT_FLOAT_INT_f8   = NEARBYINT_INT_f8
-      br.cond.sptk  L(NEARBYINT_COMMON)
-;;
+      nop.m            0
+      fmerge.s         f8 = fNormX, f8
+      br.ret.sptk      b0                     // Exit main path
 }
+;;
 
-
-.endp nearbyintf
-ASM_SIZE_DIRECTIVE(nearbyintf)
+GLOBAL_LIBM_END(nearbyintf)
diff --git a/sysdeps/ia64/fpu/s_nearbyintl.S b/sysdeps/ia64/fpu/s_nearbyintl.S
index 95ba6ab260..ee6159c67c 100644
--- a/sysdeps/ia64/fpu/s_nearbyintl.S
+++ b/sysdeps/ia64/fpu/s_nearbyintl.S
@@ -1,11 +1,10 @@
 .file "nearbyintl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 10/19/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Tom Rowan, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,73 +20,67 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 10/19/2000: Created
-// 2/08/01  Corrected behavior for all rounding modes.
+// 10/19/00 Created
+// 02/08/01 Corrected behavior for all rounding modes.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 07/25/03 Improved performance
 //==============================================================
-//
+
 // API
 //==============================================================
 // long double nearbyintl(long double x)
+//==============================================================
 
-#include "libm_support.h"
-
-//
-// general registers used:  
-//
-
-nearbyint_GR_signexp   = r14
-nearbyint_GR_exponent  = r15
-nearbyint_GR_17ones    = r16
-nearbyint_GR_10033     = r17
-nearbyint_GR_fpsr      = r18
-nearbyint_GR_rcs0      = r19
-nearbyint_GR_rcs0_mask = r20
+// general input registers:
+// r14 - r21
 
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rFpsr      = r19
+rRcs0      = r20
+rRcs0Mask  = r21
 
-// predicate registers used: 
-// p6-11
+// floating-point registers:
+// f8 - f10
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
 
-NEARBYINT_NORM_f8      = f9                        
-NEARBYINT_FLOAT_INT_f8 = f10
-NEARBYINT_INT_f8       = f11
-NEARBYINT_SIGNED_FLOAT_INT_f8 = f12
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // long double nearbyintl(long double x)
-// Return an integer value (represented as a long double) that is 
-// x rounded to integer in current rounding mode 
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+// Return an integer value (represented as a long double) that is x
+// rounded to integer in current rounding mode
+// Inexact is not set, otherwise result identical with rint.
+//==============================================================
 
 // double_extended
-// if the exponent is >= 1003e => 3F(true) = 63(decimal)
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
 // we have a significand of 64 bits 1.63-bits.
 // If we multiply by 2^63, we no longer have a fractional part
 // So input is an integer value already.
@@ -100,132 +93,125 @@ NEARBYINT_SIGNED_FLOAT_INT_f8 = f12
 // So input is an integer value already.
 
 // single
-// if the exponent is >= 10016 => 17(true) = 23(decimal)
-// we have a significand of 53 bits 1.52-bits. (implicit 1)
-// If we multiply by 2^52, we no longer have a fractional part
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-
-.align 32
-.global nearbyintl#
-
 .section .text
-.proc  nearbyintl#
-.align 32
-
-
-nearbyintl: 
+GLOBAL_LIBM_ENTRY(nearbyintl)
 
 { .mfi
-      mov nearbyint_GR_fpsr = ar40           // Read the fpsr--need to check rc.s0
-      fcvt.fx.s1     NEARBYINT_INT_f8  = f8
-      addl            nearbyint_GR_10033 = 0x1003e, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x1003e, r0 // Set exponent at which is integer
 }
 { .mfi
-      nop.m 999
-      fnorm.s1        NEARBYINT_NORM_f8  = f8
-      mov         nearbyint_GR_17ones    = 0x1FFFF
-;;
+      nop.m            0
+      fcvt.fx.s1       fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
 { .mfi
-      nop.m 999
-      fclass.m.unc  p6,p0 = f8, 0xe7
-      mov         nearbyint_GR_rcs0_mask  = 0x0c00
-;;
+      mov              rFpsr = ar40          // Read fpsr -- check rc.s0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+      nop.i            0
 }
-
 { .mfb
-	nop.m 999
-(p6)  fnorm f8 = f8
-(p6)  br.ret.spnt   b0    // Exit if x nan, inf, zero
+      nop.m            0
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     RINT_UNORM            // Branch if x unorm
+}
 ;;
+
+
+RINT_COMMON:
+// Return here from RINT_UNORM
+{ .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.s0           f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.xf         NEARBYINT_FLOAT_INT_f8   = NEARBYINT_INT_f8
-	nop.i 999
-;;
+      mov              rRcs0Mask = 0x0c00     // Mask for rc.s0
+      fcvt.xf          f8 = fXInt             // Result assume |x| < 2^63
+      cmp.ge           p7,p8 = rExp, rBigexp  // Is |x| >= 2^63?
 }
+;;
 
+// We must correct result if |x| >= 2^63
 { .mfi
-      getf.exp nearbyint_GR_signexp  = NEARBYINT_NORM_f8
-      fcmp.eq.s0  p8,p0 = f8,f0      // Dummy op to set denormal
-        nop.i 999
-;;
+      nop.m            0
+(p7)  fma.s0           f8 = fNormX, f1, f0    // If |x| >= 2^63, result x
+      nop.i            0
 }
-
-
-{ .mii
-	nop.m 999
-	nop.i 999 
-      and      nearbyint_GR_exponent = nearbyint_GR_signexp, nearbyint_GR_17ones
 ;;
-}
 
-{ .mmi
-      cmp.ge.unc      p7,p6 = nearbyint_GR_exponent, nearbyint_GR_10033
-      and nearbyint_GR_rcs0 = nearbyint_GR_rcs0_mask, nearbyint_GR_fpsr
-	nop.i 999
-;;
+{ .mfi
+      nop.m            0
+(p8)  fmerge.s         f8 = fNormX, f8        // Make sign nearbyintl(x)= sign x
+      nop.i            0
 }
-
-// Check to see if s0 rounding mode is round to nearest.  If not then set s2
-// rounding mode to that of s0 and repeat conversions.
-// Must merge the original sign for cases where the result is zero or the input
-// is the largest that still has a fraction (0x1007dfffffffffff)
-L(NEARBYINT_COMMON):
-{ .mfb
-      cmp.ne   p11,p0 = nearbyint_GR_rcs0, r0
-(p6) fmerge.s  NEARBYINT_SIGNED_FLOAT_INT_f8 = f8, NEARBYINT_FLOAT_INT_f8
-(p11) br.cond.spnt L(NEARBYINT_NOT_ROUND_NEAREST)  // Branch if not round to nearest
 ;;
-}
 
 { .mfi
-	nop.m 999
-(p7) fnorm.s0   f8 = f8
-	nop.i 999
+(p8)  and              rRcs0 = rFpsr, rRcs0Mask // Get rounding mode for sf0
+      nop.f            0
+      nop.i            0
+}
 ;;
+
+// If |x| < 2^63 we must test for other rounding modes
+{ .mbb
+(p8)  cmp.ne.unc       p10,p0 = rRcs0, r0     // Test for other rounding modes
+(p10) br.cond.spnt     RINT_NOT_ROUND_NEAREST // Branch if not round nearest
+      br.ret.sptk      b0                     // Exit main path if round nearest
 }
+;;
 
+
+RINT_UNORM:
+// Here if x unorm
 { .mfb
-      nop.m 999
-(p6) fnorm f8 = NEARBYINT_SIGNED_FLOAT_INT_f8
-     br.ret.sptk    b0
-;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     RINT_COMMON            // Return to main path
 }
+;;
 
-
-L(NEARBYINT_NOT_ROUND_NEAREST):
-// Set rounding mode of s2 to that of s0
+RINT_NOT_ROUND_NEAREST:
+// Here if not round to nearest, and |x| < 2^63
+// Set rounding mode of s2 to that of s0, and repeat the conversion using s2
 { .mfi
-      mov nearbyint_GR_rcs0 = r0       // Clear so we don't come back here
-      fsetc.s2     0x7f, 0x40
-	nop.i 999
-;;
+      nop.m            0
+      fsetc.s2         0x7f, 0x40
+      nop.i            0
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.fx.s2     NEARBYINT_INT_f8  = f8
-	nop.i 999
+      nop.m            0
+      fcvt.fx.s2       fXInt  = fNormX        // Convert to int in significand
+      nop.i            0
+}
 ;;
+
+{ .mfi
+      nop.m            0
+      fcvt.xf          f8 = fXInt             // Expected result
+      nop.i            0
 }
+;;
 
+// Be sure sign of result = sign of input.  Fixes cases where result is 0.
 { .mfb
-	nop.m 999
-      fcvt.xf         NEARBYINT_FLOAT_INT_f8   = NEARBYINT_INT_f8
-      br.cond.sptk  L(NEARBYINT_COMMON)
-;;
+      nop.m            0
+      fmerge.s         f8 = fNormX, f8
+      br.ret.sptk      b0                     // Exit main path
 }
+;;
 
-
-.endp nearbyintl
-ASM_SIZE_DIRECTIVE(nearbyintl)
+GLOBAL_LIBM_END(nearbyintl)
diff --git a/sysdeps/ia64/fpu/s_nextafter.S b/sysdeps/ia64/fpu/s_nextafter.S
new file mode 100644
index 0000000000..6635a31df6
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_nextafter.S
@@ -0,0 +1,498 @@
+.file "nextafter.s"
+
+
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version 
+// 03/03/00 Modified to conform to C9X, and improve speed of main path
+// 03/14/00 Fixed case where x is a power of 2, and x > y, improved speed
+// 04/04/00 Unwind support added
+// 05/12/00 Fixed erroneous denormal flag setting for exponent change cases 1,3
+// 08/15/00 Bundle added after call to __libm_error_support to properly
+//          set [the previously overwritten] GR_Parameter_RESULT.
+// 09/09/00 Updated fcmp so that qnans do not raise invalid
+// 12/15/00 Corrected behavior when both args are zero to conform to C99, and
+//          fixed flag settings for several cases
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 12/14/04 Added error handling on underflow.
+//
+// API
+//==============================================================
+// double nextafter( double x, double y );
+// input  floating point f8, f9
+// output floating point f8
+//
+// Registers used
+//==============================================================
+GR_max_pexp     = r14
+GR_min_pexp     = r15
+GR_exp          = r16
+GR_sig          = r17
+GR_lnorm_sig    = r18
+GR_sign_mask    = r19
+GR_exp_mask     = r20
+GR_sden_sig     = r21
+GR_new_sig      = r22
+GR_new_exp      = r23
+GR_lden_sig     = r24
+GR_snorm_sig    = r25
+GR_exp1         = r26
+GR_x_exp        = r27
+GR_min_den_rexp = r28
+// r36-39 parameters for libm_error_support
+
+GR_SAVE_B0                = r34
+GR_SAVE_GP                = r35
+GR_SAVE_PFS               = r32
+
+GR_Parameter_X            = r36
+GR_Parameter_Y            = r37
+GR_Parameter_RESULT       = r38
+GR_Parameter_TAG          = r39
+
+FR_lnorm_sig       = f10
+FR_lnorm_exp       = f11
+FR_lnorm           = f12
+FR_sden_sig        = f13
+FR_sden_exp        = f14
+FR_sden            = f15
+FR_save_f8         = f33
+FR_new_exp         = f34
+FR_new_sig         = f35
+FR_lden_sig        = f36
+FR_snorm_sig       = f37
+FR_exp1            = f38
+FR_tmp             = f39
+
+//
+// Overview of operation
+//==============================================================
+// nextafter determines the next representable value 
+// after x in the direction of y. 
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(nextafter)
+
+// Extract signexp from x
+// Is x < y ?  p10 if yes, p11 if no
+// Form smallest denormal significand = ulp size
+{ .mfi
+      getf.exp GR_exp      = f8
+      fcmp.lt.s1 p10,p11 = f8, f9                
+      addl GR_sden_sig = 0x800, r0
+}
+// Form largest normal significand 0xfffffffffffff800
+// Form smallest normal exponent
+{ .mfi
+      addl GR_lnorm_sig = -0x800,r0
+      nop.f 999
+      addl GR_min_pexp = 0x0fc01, r0 ;;
+}
+// Extract significand from x
+// Is x=y?
+// Form largest normal exponent
+{ .mfi
+      getf.sig GR_sig      = f8
+      fcmp.eq.s0 p6,p0 = f8, f9                
+      addl GR_max_pexp = 0x103fe, r0
+}
+// Move largest normal significand to fp reg for special cases
+{ .mfi
+      setf.sig FR_lnorm_sig = GR_lnorm_sig
+      nop.f 999
+      addl GR_sign_mask = 0x20000, r0 ;;
+}
+
+// Move smallest denormal significand and signexp to fp regs
+// Is x=nan?
+// Set p12 and p13 based on whether significand increases or decreases
+// It increases (p12 set) if x<y and x>=0 or if x>y and x<0
+// It decreases (p13 set) if x<y and x<0  or if x>y and x>=0
+{ .mfi
+      setf.sig FR_sden_sig = GR_sden_sig
+      fclass.m  p8,p0 = f8, 0xc3           
+(p10) cmp.lt p12,p13 = GR_exp, GR_sign_mask
+}
+{ .mfi
+      setf.exp FR_sden_exp = GR_min_pexp
+(p11) cmp.ge p12,p13 = GR_exp, GR_sign_mask ;;
+}
+
+.pred.rel "mutex",p12,p13
+
+// Form expected new significand, adding or subtracting 1 ulp increment
+// If x=y set result to y
+// Form smallest normal significand and largest denormal significand
+{ .mfi
+(p12) add GR_new_sig = GR_sig, GR_sden_sig
+(p6)  fmerge.s f8=f9,f9
+      dep.z GR_snorm_sig = 1,63,1 // 0x8000000000000000
+}
+{ .mlx
+(p13) sub GR_new_sig = GR_sig, GR_sden_sig
+      movl GR_lden_sig = 0x7ffffffffffff800 ;;
+}
+
+// Move expected result significand and signexp to fp regs
+// Is y=nan?
+// Form new exponent in case result exponent needs incrementing or decrementing
+{ .mfi
+      setf.exp FR_new_exp = GR_exp
+      fclass.m  p9,p0 = f9, 0xc3           
+(p12) add GR_exp1 = 1, GR_exp
+}
+{ .mib
+      setf.sig FR_new_sig = GR_new_sig
+(p13) add GR_exp1 = -1, GR_exp
+(p6)  br.ret.spnt    b0 ;;             // Exit if x=y
+}
+
+// Move largest normal signexp to fp reg for special cases
+// Is x=zero?
+{ .mfi
+      setf.exp FR_lnorm_exp = GR_max_pexp
+      fclass.m  p7,p0 = f8, 0x7
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+(p8)  fma.s0 f8 = f8,f1,f9                     
+(p8)  br.ret.spnt    b0 ;;             // Exit if x=nan
+}
+
+// Move exp+-1 and smallest normal significand to fp regs for special cases
+// Is x=inf?
+{ .mfi
+      setf.exp FR_exp1 = GR_exp1
+      fclass.m  p6,p0 = f8, 0x23           
+      addl GR_exp_mask = 0x1ffff, r0
+}
+{ .mfb
+      setf.sig FR_snorm_sig = GR_snorm_sig
+(p9)  fma.s0 f8 = f8,f1,f9                     
+(p9)  br.ret.spnt    b0 ;;             // Exit if y=nan
+}
+
+// Move largest denormal significand to fp regs for special cases
+// Save x
+{ .mfb
+      setf.sig FR_lden_sig = GR_lden_sig
+      mov FR_save_f8 = f8
+(p7)  br.cond.spnt NEXT_ZERO ;;   // Exit if x=0   
+}
+
+// Mask off the sign to get x_exp
+{ .mfb
+      and GR_x_exp = GR_exp_mask, GR_exp
+      nop.f 999
+(p6)  br.cond.spnt NEXT_INF ;;   // Exit if x=inf   
+}
+
+// Check 6 special cases when significand rolls over:
+//  1 sig size incr, x_sig=max_sig, x_exp < max_exp
+//     Set p6, result is sig=min_sig, exp++
+//  2 sig size incr, x_sig=max_sig, x_exp >= max_exp
+//     Set p7, result is inf, signal overflow
+//  3 sig size decr, x_sig=min_sig, x_exp > min_exp
+//     Set p8, result is sig=max_sig, exp--
+//  4 sig size decr, x_sig=min_sig, x_exp = min_exp
+//     Set p9, result is sig=max_den_sig, exp same, signal underflow and inexact
+//  5 sig size decr, x_sig=min_den_sig, x_exp = min_exp
+//     Set p10, result is zero, sign of x, signal underflow and inexact
+//  6 sig size decr, x_sig=min_sig, x_exp < min_exp 
+//     Set p14, result is zero, sign of x, signal underflow and inexact
+//
+// Form exponent of smallest double denormal (if normalized register format)
+{ .mmi
+      adds GR_min_den_rexp = -52, GR_min_pexp
+(p12) cmp.eq.unc p6,p0 = GR_new_sig, r0
+(p13) cmp.eq.unc p8,p10 = GR_new_sig, GR_lden_sig ;;
+}
+
+{ .mmi
+(p6)  cmp.lt.unc p6,p7 = GR_x_exp, GR_max_pexp
+(p8)  cmp.gt.unc p8,p9 = GR_x_exp, GR_min_pexp
+(p10) cmp.eq.unc p10,p0 = GR_new_sig, r0 ;;
+}
+
+// Create small normal in case need to generate underflow flag
+{ .mfi
+(p10) cmp.le.unc p10,p0 = GR_x_exp, GR_min_pexp
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+(p9)  cmp.gt.unc p9,p14 = GR_x_exp, GR_min_den_rexp
+}
+// Branch if cases 1, 2, 3
+{ .bbb
+(p6)  br.cond.spnt NEXT_EXPUP
+(p7)  br.cond.spnt NEXT_OVERFLOW
+(p8)  br.cond.spnt NEXT_EXPDOWN ;;
+}
+
+// Branch if cases 4, 5, 6
+{ .bbb
+(p9)  br.cond.spnt NEXT_NORM_TO_DENORM
+(p10) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO
+(p14) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO ;;
+}
+
+// Here if no special cases
+// Set p6 if result will be a denormal, so can force underflow flag
+//    Case 1:  x_exp=min_exp, x_sig=unnormalized
+//    Case 2:  x_exp<min_exp
+{ .mfi
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_new_exp, FR_new_sig
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+      nop.f 999
+(p7)  tbit.z p6,p0 = GR_new_sig, 63 ;;
+}
+
+NEXT_COMMON_FINISH:
+// Force underflow and inexact if denormal result
+{ .mfi
+      nop.m 999
+(p6)  fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+      fnorm.d.s0 f8 = f8 // Final normalization to result precision
+(p6)  br.cond.spnt NEXT_UNDERFLOW ;;
+}
+
+{ .mfb
+      nop.m 999
+      nop.f 999
+      br.ret.sptk b0;;
+}
+
+//Special cases
+NEXT_EXPUP:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_snorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_EXPDOWN:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_lnorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_NORM_TO_DENORM:
+{ .mfi
+      nop.m 999
+      fmerge.se f8 = FR_new_exp, FR_lden_sig
+      nop.i 999
+}
+// Force underflow and inexact if denormal result
+{ .mfb
+      nop.m 999
+      fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW_TO_ZERO:
+{ .mfb
+      cmp.eq p6,p0 = r0,r0
+      fmerge.s f8 = FR_save_f8,f0
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_INF: 
+// Here if f8 is +- infinity
+// INF
+// if f8 is +inf, no matter what y is return  largest double
+// if f8 is -inf, no matter what y is return -largest double
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s f8 = f8,FR_lnorm                
+      br.ret.sptk    b0 ;;                        
+}
+
+NEXT_ZERO: 
+
+// Here if f8 is +- zero
+// ZERO
+// if f8 is zero and y is +, return + smallest double denormal 
+// if f8 is zero and y is -, return - smallest double denormal 
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_sden = FR_sden_exp,FR_sden_sig
+      nop.i 999 ;;
+}
+
+// Create small normal to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Add correct sign from direction arg
+{ .mfi
+      nop.m 999
+      fmerge.s f8 = f9,FR_sden                
+      nop.i 999 ;;
+}
+
+// Force underflow and inexact flags
+{ .mfb
+      nop.m 999
+      fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW: 
+// Here if result is a denorm, or input is finite and result is zero
+// Call error support to report possible range error
+{ .mib
+      alloc          r32=ar.pfs,2,2,4,0
+      mov           GR_Parameter_TAG = 268      // Error code
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+NEXT_OVERFLOW: 
+// Here if input is finite, but result will be infinite
+// Use frcpa to generate infinity of correct sign
+// Call error support to report possible range error
+{ .mfi
+      alloc          r32=ar.pfs,2,2,4,0
+      frcpa.s1 f8,p6 = FR_save_f8, f0
+      nop.i 999 ;;
+}
+
+// Create largest double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Force overflow and inexact flags to be set
+{ .mfb
+      mov           GR_Parameter_TAG = 154      // Error code
+      fma.d.s0 FR_tmp = FR_lnorm,FR_lnorm,f0
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+GLOBAL_LIBM_END(nextafter)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+// (1)
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+
+// (2)
+{ .mmi
+        stfd [GR_Parameter_Y] = f9,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+// (3)
+{ .mib
+        stfd [GR_Parameter_X] = FR_save_f8              // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y           // Parameter 3 address
+        nop.b 0                                
+}
+{ .mib
+        stfd [GR_Parameter_Y] = f8              // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_nextafterf.S b/sysdeps/ia64/fpu/s_nextafterf.S
new file mode 100644
index 0000000000..0c269eca9e
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_nextafterf.S
@@ -0,0 +1,504 @@
+.file "nextafterf.s"
+
+
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version 
+// 03/03/00 Modified to conform to C9X, and improve speed of main path
+// 03/14/00 Fixed case where x is a power of 2, and x > y, improved speed
+// 04/04/00 Unwind support added
+// 05/12/00 Fixed erroneous denormal flag setting for exponent change cases 1,3
+// 08/15/00 Bundle added after call to __libm_error_support to properly
+//          set [the previously overwritten] GR_Parameter_RESULT.
+// 09/09/00 Updated fcmp so that qnans do not raise invalid
+// 12/15/00 Corrected behavior when both args are zero to conform to C99, and
+//          fixed flag settings for several cases
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 12/14/04 Added error handling on underflow.
+//
+// API
+//==============================================================
+// float nextafterf( float x, float y );
+// input  floating point f8, f9
+// output floating point f8
+//
+// Registers used
+//==============================================================
+GR_max_pexp     = r14
+GR_min_pexp     = r15
+GR_exp          = r16
+GR_sig          = r17
+GR_lnorm_sig    = r18
+GR_sign_mask    = r19
+GR_exp_mask     = r20
+GR_sden_sig     = r21
+GR_new_sig      = r22
+GR_new_exp      = r23
+GR_lden_sig     = r24
+GR_snorm_sig    = r25
+GR_exp1         = r26
+GR_x_exp        = r27
+GR_min_den_rexp = r28
+// r36-39 parameters for libm_error_support
+
+GR_SAVE_B0                = r34
+GR_SAVE_GP                = r35
+GR_SAVE_PFS               = r32
+
+GR_Parameter_X            = r36
+GR_Parameter_Y            = r37
+GR_Parameter_RESULT       = r38
+GR_Parameter_TAG          = r39
+
+FR_lnorm_sig       = f10
+FR_lnorm_exp       = f11
+FR_lnorm           = f12
+FR_sden_sig        = f13
+FR_sden_exp        = f14
+FR_sden            = f15
+FR_save_f8         = f33
+FR_new_exp         = f34
+FR_new_sig         = f35
+FR_lden_sig        = f36
+FR_snorm_sig       = f37
+FR_exp1            = f38
+FR_tmp             = f39
+
+//
+// Overview of operation
+//==============================================================
+// nextafterf determines the next representable value 
+// after x in the direction of y. 
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(nextafterf)
+
+// Extract signexp from x
+// Form smallest denormal significand = ulp size
+{ .mlx
+      getf.exp GR_exp      = f8
+      movl GR_sden_sig = 0x0000010000000000
+}
+// Form largest normal exponent
+// Is x < y ?  p10 if yes, p11 if no
+// Form smallest normal exponent
+{ .mfi
+      addl GR_max_pexp = 0x1007e, r0
+      fcmp.lt.s1 p10,p11 = f8, f9
+      addl GR_min_pexp = 0x0ff81, r0 ;;
+}
+
+// Is x=y?
+{ .mfi
+      getf.sig GR_sig      = f8
+      fcmp.eq.s0 p6,p0 = f8, f9
+      nop.i 0
+}
+// Extract significand from x
+// Form largest normal significand
+{ .mlx
+      nop.m 0 
+      movl GR_lnorm_sig = 0xffffff0000000000 ;;
+}
+
+// Move largest normal significand to fp reg for special cases
+{ .mfi
+      setf.sig FR_lnorm_sig = GR_lnorm_sig
+      nop.f 0 
+      addl GR_sign_mask = 0x20000, r0 ;;
+}
+
+// Move smallest denormal significand and signexp to fp regs
+// Is x=nan?
+// Set p12 and p13 based on whether significand increases or decreases
+// It increases (p12 set) if x<y and x>=0 or if x>y and x<0
+// It decreases (p13 set) if x<y and x<0  or if x>y and x>=0
+{ .mfi
+      setf.sig FR_sden_sig = GR_sden_sig
+      fclass.m  p8,p0 = f8, 0xc3           
+(p10) cmp.lt p12,p13 = GR_exp, GR_sign_mask
+}
+{ .mfi
+      setf.exp FR_sden_exp = GR_min_pexp
+      nop.f 999
+(p11) cmp.ge p12,p13 = GR_exp, GR_sign_mask ;;
+}
+
+.pred.rel "mutex",p12,p13
+
+// Form expected new significand, adding or subtracting 1 ulp increment
+// If x=y set result to y
+// Form smallest normal significand and largest denormal significand
+{ .mfi
+(p12) add GR_new_sig = GR_sig, GR_sden_sig
+(p6)  fmerge.s f8=f9,f9
+      dep.z GR_snorm_sig = 1,63,1 // 0x8000000000000000
+}
+{ .mlx
+(p13) sub GR_new_sig = GR_sig, GR_sden_sig
+      movl GR_lden_sig = 0x7fffff0000000000 ;;
+}
+
+// Move expected result significand and signexp to fp regs
+// Is y=nan?
+// Form new exponent in case result exponent needs incrementing or decrementing
+{ .mfi
+      setf.exp FR_new_exp = GR_exp
+      fclass.m  p9,p0 = f9, 0xc3           
+(p12) add GR_exp1 = 1, GR_exp
+}
+{ .mib
+      setf.sig FR_new_sig = GR_new_sig
+(p13) add GR_exp1 = -1, GR_exp
+(p6)  br.ret.spnt    b0 ;;             // Exit if x=y
+}
+
+// Move largest normal signexp to fp reg for special cases
+// Is x=zero?
+{ .mfi
+      setf.exp FR_lnorm_exp = GR_max_pexp
+      fclass.m  p7,p0 = f8, 0x7
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+(p8)  fma.s0 f8 = f8,f1,f9                     
+(p8)  br.ret.spnt    b0 ;;             // Exit if x=nan
+}
+
+// Move exp+-1 and smallest normal significand to fp regs for special cases
+// Is x=inf?
+{ .mfi
+      setf.exp FR_exp1 = GR_exp1
+      fclass.m  p6,p0 = f8, 0x23           
+      addl GR_exp_mask = 0x1ffff, r0
+}
+{ .mfb
+      setf.sig FR_snorm_sig = GR_snorm_sig
+(p9)  fma.s0 f8 = f8,f1,f9                     
+(p9)  br.ret.spnt    b0 ;;             // Exit if y=nan
+}
+
+// Move largest denormal significand to fp regs for special cases
+// Save x
+{ .mfb
+      setf.sig FR_lden_sig = GR_lden_sig
+      mov FR_save_f8 = f8
+(p7)  br.cond.spnt NEXT_ZERO ;;   // Exit if x=0   
+}
+
+// Mask off the sign to get x_exp
+{ .mfb
+      and GR_x_exp = GR_exp_mask, GR_exp
+      nop.f 999
+(p6)  br.cond.spnt NEXT_INF ;;   // Exit if x=inf   
+}
+
+// Check 6 special cases when significand rolls over:
+//  1 sig size incr, x_sig=max_sig, x_exp < max_exp
+//     Set p6, result is sig=min_sig, exp++
+//  2 sig size incr, x_sig=max_sig, x_exp >= max_exp
+//     Set p7, result is inf, signal overflow
+//  3 sig size decr, x_sig=min_sig, x_exp > min_exp
+//     Set p8, result is sig=max_sig, exp--
+//  4 sig size decr, x_sig=min_sig, x_exp = min_exp
+//     Set p9, result is sig=max_den_sig, exp same, signal underflow and inexact
+//  5 sig size decr, x_sig=min_den_sig, x_exp = min_exp
+//     Set p10, result is zero, sign of x, signal underflow and inexact
+//  6 sig size decr, x_sig=min_sig, x_exp < min_exp 
+//     Set p14, result is zero, sign of x, signal underflow and inexact
+//
+// Form exponent of smallest float denormal (if normalized register format)
+{ .mmi
+      adds GR_min_den_rexp = -23, GR_min_pexp
+(p12) cmp.eq.unc p6,p0 = GR_new_sig, r0
+(p13) cmp.eq.unc p8,p10 = GR_new_sig, GR_lden_sig ;;
+}
+
+{ .mmi
+(p6)  cmp.lt.unc p6,p7 = GR_x_exp, GR_max_pexp
+(p8)  cmp.gt.unc p8,p9 = GR_x_exp, GR_min_pexp
+(p10) cmp.eq.unc p10,p0 = GR_new_sig, r0 ;;
+}
+
+// Create small normal in case need to generate underflow flag
+{ .mfi
+(p10) cmp.le.unc p10,p0 = GR_x_exp, GR_min_pexp
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+(p9)  cmp.gt.unc p9,p14 = GR_x_exp, GR_min_den_rexp
+}
+// Branch if cases 1, 2, 3
+{ .bbb
+(p6)  br.cond.spnt NEXT_EXPUP
+(p7)  br.cond.spnt NEXT_OVERFLOW
+(p8)  br.cond.spnt NEXT_EXPDOWN ;;
+}
+
+// Branch if cases 4, 5, 6
+{ .bbb
+(p9)  br.cond.spnt NEXT_NORM_TO_DENORM
+(p10) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO
+(p14) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO ;;
+}
+
+// Here if no special cases
+// Set p6 if result will be a denormal, so can force underflow flag
+//    Case 1:  x_exp=min_exp, x_sig=unnormalized
+//    Case 2:  x_exp<min_exp
+{ .mfi
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_new_exp, FR_new_sig
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+      nop.f 999
+(p7)  tbit.z p6,p0 = GR_new_sig, 63 ;;
+}
+
+NEXT_COMMON_FINISH:
+// Force underflow and inexact if denormal result
+{ .mfi
+      nop.m 999
+(p6)  fma.s.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+      fnorm.s.s0 f8 = f8 // Final normalization to result precision
+(p6)  br.cond.spnt NEXT_UNDERFLOW ;;
+}
+
+{ .mfb
+      nop.m 999
+      nop.f 999
+      br.ret.sptk b0;;
+}
+
+//Special cases
+NEXT_EXPUP:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_snorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_EXPDOWN:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_lnorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_NORM_TO_DENORM:
+{ .mfi
+      nop.m 999
+      fmerge.se f8 = FR_new_exp, FR_lden_sig
+      nop.i 999
+}
+// Force underflow and inexact
+{ .mfb
+      nop.m 999
+      fma.s.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW_TO_ZERO:
+{ .mfb
+      cmp.eq p6,p0 = r0,r0
+      fmerge.s f8 = FR_save_f8,f0
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_INF: 
+// Here if f8 is +- infinity
+// INF
+// if f8 is +inf, no matter what y is return  largest float
+// if f8 is -inf, no matter what y is return -largest float
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s f8 = f8,FR_lnorm                
+      br.ret.sptk    b0 ;;                        
+}
+
+NEXT_ZERO: 
+
+// Here if f8 is +- zero
+// ZERO
+// if f8 is zero and y is +, return + smallest float denormal 
+// if f8 is zero and y is -, return - smallest float denormal 
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_sden = FR_sden_exp,FR_sden_sig
+      nop.i 999 ;;
+}
+
+// Create small normal to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Add correct sign from direction arg
+{ .mfi
+      nop.m 999
+      fmerge.s f8 = f9,FR_sden                
+      nop.i 999 ;;
+}
+
+// Force underflow and inexact flags
+{ .mfb
+      nop.m 999
+      fma.s.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW: 
+// Here if result is a denorm, or input is finite and result is zero
+// Call error support to report possible range error
+{ .mib
+      alloc          r32=ar.pfs,2,2,4,0
+      mov           GR_Parameter_TAG = 269      // Error code
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+NEXT_OVERFLOW: 
+// Here if input is finite, but result will be infinite
+// Use frcpa to generate infinity of correct sign
+// Call error support to report possible range error
+{ .mfi
+      alloc          r32=ar.pfs,2,2,4,0
+      frcpa.s1 f8,p6 = FR_save_f8, f0
+      nop.i 999 ;;
+}
+
+// Create largest double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Force overflow and inexact flags to be set
+{ .mfb
+      mov           GR_Parameter_TAG = 155      // Error code
+      fma.s.s0 FR_tmp = FR_lnorm,FR_lnorm,f0
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+GLOBAL_LIBM_END(nextafterf)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+// (1)
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+
+// (2)
+{ .mmi
+        stfs [GR_Parameter_Y] = f9,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+// (3)
+{ .mib
+        stfs [GR_Parameter_X] = FR_save_f8              // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y           // Parameter 3 address
+        nop.b 0                                
+}
+{ .mib
+        stfs [GR_Parameter_Y] = f8              // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_nextafterl.S b/sysdeps/ia64/fpu/s_nextafterl.S
new file mode 100644
index 0000000000..20c927b1cc
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_nextafterl.S
@@ -0,0 +1,503 @@
+.file "nextafterl.s"
+
+
+// Copyright (c) 2000 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 02/02/00 Initial version 
+// 03/03/00 Modified to conform to C9X, and improve speed of main path
+// 03/14/00 Fixed case where x is a power of 2, and x > y, improved speed
+// 04/04/00 Unwind support added
+// 05/12/00 Fixed erroneous denormal flag setting for exponent change cases 1,3
+// 08/15/00 Bundle added after call to __libm_error_support to properly
+//          set [the previously overwritten] GR_Parameter_RESULT.
+// 09/09/00 Updated fcmp so that qnans do not raise invalid.
+// 12/15/00 Fixed case of smallest long double normal to largest denormal,
+//          now adhere to C99 for two zero args, and fixed flag settings 
+//          for several cases
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 12/14/04 Added error handling on underflow.
+//
+// API
+//==============================================================
+// long double nextafterl( long double x, long double y );
+// input  floating point f8, f9
+// output floating point f8
+//
+// Registers used
+//==============================================================
+GR_max_pexp     = r14
+GR_min_pexp     = r15
+GR_exp          = r16
+GR_sig          = r17
+GR_lnorm_sig    = r18
+GR_sign_mask    = r19
+GR_exp_mask     = r20
+GR_sden_sig     = r21
+GR_new_sig      = r22
+GR_new_exp      = r23
+GR_lden_sig     = r24
+GR_snorm_sig    = r25
+GR_exp1         = r26
+GR_x_exp        = r27
+// r36-39 parameters for libm_error_support
+
+GR_SAVE_B0                = r34
+GR_SAVE_GP                = r35
+GR_SAVE_PFS               = r32
+
+GR_Parameter_X            = r36
+GR_Parameter_Y            = r37
+GR_Parameter_RESULT       = r38
+GR_Parameter_TAG          = r39
+
+FR_lnorm_sig       = f10
+FR_lnorm_exp       = f11
+FR_lnorm           = f12
+FR_sden_sig        = f13
+FR_den_exp         = f14
+FR_sden            = f15
+FR_snorm_exp       = f32
+FR_save_f8         = f33
+FR_new_exp         = f34
+FR_new_sig         = f35
+FR_lden_sig        = f36
+FR_snorm_sig       = f37
+FR_exp1            = f38
+FR_tmp             = f39
+
+//
+// Overview of operation
+//==============================================================
+// nextafterl determines the next representable value 
+// after x in the direction of y. 
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(nextafterl)
+
+// Extract signexp from x
+// Is x < y ?  p10 if yes, p11 if no
+// Form smallest denormal significand = ulp size
+{ .mfi
+      getf.exp GR_exp      = f8
+      fcmp.lt.s1 p10,p11 = f8, f9                
+      addl GR_sden_sig = 0x1, r0
+}
+// Form largest normal significand 0xffffffffffffffff
+// Form smallest normal exponent
+{ .mfi
+      addl GR_lnorm_sig = -0x1,r0
+      nop.f 999
+      addl GR_min_pexp = 0x0c001, r0 ;;
+}
+
+// Extract significand from x
+// Is x=y?   This fcmp also sets Invalid and Denormal if required
+// Form largest normal exponent
+{ .mfi
+      getf.sig GR_sig      = f8
+      fcmp.eq.s0 p6,p0 = f8, f9
+      addl GR_max_pexp = 0x13ffe, r0
+}
+// Move largest normal significand to fp reg for special cases
+{ .mfi
+      setf.sig FR_lnorm_sig = GR_lnorm_sig
+      nop.f 999
+      addl GR_sign_mask = 0x20000, r0 ;;
+}
+
+// Move smallest denormal significand and exp to fp regs
+// Is x=nan?
+// Set p12 and p13 based on whether significand increases or decreases
+// It increases (p12 set) if x<y and x>=0 or if x>y and x<0
+// It decreases (p13 set) if x<y and x<0  or if x>y and x>=0
+{ .mfi
+      setf.sig FR_sden_sig = GR_sden_sig
+      fclass.m  p8,p0 = f8, 0xc3           
+(p10) cmp.lt p12,p13 = GR_exp, GR_sign_mask
+}
+// Move smallest normal exp to fp regs
+{ .mfi
+      setf.exp FR_snorm_exp = GR_min_pexp
+      nop.f 999
+(p11) cmp.ge p12,p13 = GR_exp, GR_sign_mask ;;
+}
+
+.pred.rel "mutex",p12,p13
+
+// Form expected new significand, adding or subtracting 1 ulp increment
+// If x=y set result to y
+// Form smallest normal significand and largest denormal significand
+{ .mfi
+(p12) add GR_new_sig = GR_sig, GR_sden_sig
+(p6)  fmerge.s f8=f9,f9
+      dep.z GR_snorm_sig = 1,63,1 // 0x8000000000000000
+}
+{ .mlx
+(p13) sub GR_new_sig = GR_sig, GR_sden_sig
+      movl GR_lden_sig = 0x7fffffffffffffff ;;
+}
+
+// Move expected result significand and signexp to fp regs
+// Is y=nan?
+// Form new exponent in case result exponent needs incrementing or decrementing
+{ .mfi
+      setf.exp FR_new_exp = GR_exp
+      fclass.m  p9,p0 = f9, 0xc3           
+(p12) add GR_exp1 = 1, GR_exp
+}
+{ .mib
+      setf.sig FR_new_sig = GR_new_sig
+(p13) add GR_exp1 = -1, GR_exp
+(p6)  br.ret.spnt    b0 ;;             // Exit if x=y
+}
+
+// Move largest normal signexp to fp reg for special cases
+// Is x=zero?
+{ .mfi
+      setf.exp FR_lnorm_exp = GR_max_pexp
+      fclass.m  p7,p0 = f8, 0x7
+      nop.i 999
+}
+{ .mfb
+      setf.exp FR_den_exp = GR_min_pexp
+(p8)  fma.s0 f8 = f8,f1,f9                     
+(p8)  br.ret.spnt    b0 ;;             // Exit if x=nan
+}
+
+// Move exp+-1 and smallest normal significand to fp regs for special cases
+// Is x=inf?
+{ .mfi
+      setf.exp FR_exp1 = GR_exp1
+      fclass.m  p6,p0 = f8, 0x23           
+      addl GR_exp_mask = 0x1ffff, r0
+}
+{ .mfb
+      setf.sig FR_snorm_sig = GR_snorm_sig
+(p9)  fma.s0 f8 = f8,f1,f9                     
+(p9)  br.ret.spnt    b0 ;;             // Exit if y=nan
+}
+
+// Move largest denormal significand to fp regs for special cases
+// Save x
+{ .mfb
+      setf.sig FR_lden_sig = GR_lden_sig
+      mov FR_save_f8 = f8
+(p7)  br.cond.spnt NEXT_ZERO ;;   // Exit if x=0   
+}
+
+// Mask off the sign to get x_exp
+{ .mfb
+      and GR_x_exp = GR_exp_mask, GR_exp
+      nop.f 999
+(p6)  br.cond.spnt NEXT_INF ;;   // Exit if x=inf   
+}
+
+// Check 5 special cases when significand rolls over:
+//  1 sig size incr, x_sig=max_sig, x_exp < max_exp
+//     Set p6, result is sig=min_sig, exp++
+//  2 sig size incr, x_sig=max_sig, x_exp >= max_exp
+//     Set p7, result is inf, signal overflow
+//  3 sig size decr, x_sig=min_sig, x_exp > min_exp
+//     Set p8, result is sig=max_sig, exp--
+//  4 sig size decr, x_sig=min_sig, x_exp = min_exp
+//     Set p9, result is sig=max_den_sig, exp same, signal underflow and inexact
+//  5 sig size decr, x_sig=min_den_sig, x_exp = min_exp
+//     Set p10, result is zero, sign of x, signal underflow and inexact
+//
+{ .mmi
+(p12) cmp.eq.unc p6,p0 = GR_new_sig, r0
+(p13) cmp.eq.unc p9,p10 = GR_new_sig, GR_lden_sig
+      nop.i 999
+;;
+}
+
+{ .mmi
+(p6)  cmp.lt.unc p6,p7 = GR_x_exp, GR_max_pexp
+(p10) cmp.eq.unc p10,p0 = GR_new_sig, r0
+(p9)  cmp.le.unc p9,p8 = GR_x_exp, GR_min_pexp 
+;;
+}
+
+// Create small normal in case need to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_snorm_exp, FR_lnorm_sig
+      nop.i 999
+}
+// Branch if cases 1, 2, 3
+{ .bbb
+(p6)  br.cond.spnt NEXT_EXPUP
+(p7)  br.cond.spnt NEXT_OVERFLOW
+(p8)  br.cond.spnt NEXT_EXPDOWN ;;
+}
+
+// Branch if cases 4, 5
+{ .mbb
+      nop.m 999
+(p9)  br.cond.spnt NEXT_NORM_TO_DENORM
+(p10) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO
+;;
+}
+
+// Here if no special cases
+// Set p6 if result will be a denormal, so can force underflow flag
+//    Case 1:  x_exp=min_exp, x_sig=unnormalized
+//    Case 2:  x_exp<min_exp
+{ .mfi
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_new_exp, FR_new_sig
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+      nop.f 999
+(p6)  tbit.z p6,p0 = GR_new_sig, 63 ;;
+}
+
+NEXT_COMMON_FINISH:
+// Force underflow and inexact if denormal result
+{ .mfi
+      nop.m 999
+(p6)  fma.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+      fnorm.s0 f8 = f8 // Final normalization to result precision
+(p6)  br.cond.spnt NEXT_UNDERFLOW ;;
+}
+
+{ .mfb
+      nop.m 999
+      nop.f 999
+      br.ret.sptk b0;;
+}
+
+//Special cases
+NEXT_EXPUP:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_snorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_EXPDOWN:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_lnorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_NORM_TO_DENORM:
+{ .mfi
+      nop.m 999
+      fmerge.se f8 = FR_exp1, FR_lden_sig
+      nop.i 999
+}
+// Force underflow and inexact
+{ .mfb
+      nop.m 999
+      fma.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW_TO_ZERO:
+{ .mfb
+      cmp.eq p6,p0 = r0,r0
+      fmerge.s f8 = FR_save_f8,f0
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_INF: 
+// Here if f8 is +- infinity
+// INF
+// if f8 is +inf, no matter what y is return  largest long double
+// if f8 is -inf, no matter what y is return -largest long double
+
+// Create largest long double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s f8 = f8,FR_lnorm                
+      br.ret.sptk    b0 ;;                        
+}
+
+NEXT_ZERO: 
+
+// Here if f8 is +- zero
+// ZERO
+// if f8 is zero and y is +, return + smallest long double denormal 
+// if f8 is zero and y is -, return - smallest long double denormal 
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_sden = f0,FR_sden_sig
+      nop.i 999 ;;
+}
+
+// Create small normal to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_snorm_exp, FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Add correct sign from direction arg
+{ .mfi
+      nop.m 999
+      fmerge.s f8 = f9,FR_sden                
+      nop.i 999 ;;
+}
+
+// Force underflow and inexact flags
+{ .mfb
+      nop.m 999
+      fma.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW: 
+// Here if result is a denorm, or input is finite and result is zero
+// Call error support to report possible range error
+{ .mib
+      alloc          r32=ar.pfs,2,2,4,0
+      mov           GR_Parameter_TAG = 267      // Error code
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+NEXT_OVERFLOW: 
+// Here if input is finite, but result will be infinite
+// Use frcpa to generate infinity of correct sign
+// Call error support to report possible range error
+{ .mfi
+      alloc          r32=ar.pfs,2,2,4,0
+      frcpa.s1 f8,p6 = FR_save_f8, f0
+      nop.i 999 ;;
+}
+
+// Create largest double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Force overflow and inexact flags to be set
+{ .mfb
+      mov           GR_Parameter_TAG = 153      // Error code
+      fma.s0 FR_tmp = FR_lnorm,FR_lnorm,f0
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+GLOBAL_LIBM_END(nextafterl)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+// (1)
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+
+// (2)
+{ .mmi
+        stfe [GR_Parameter_Y] = f9,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+// (3)
+{ .mib
+        stfe [GR_Parameter_X] = FR_save_f8              // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y           // Parameter 3 address
+        nop.b 0                                
+}
+{ .mib
+        stfe [GR_Parameter_Y] = f8              // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_nextafterl.c b/sysdeps/ia64/fpu/s_nextafterl.c
deleted file mode 100644
index f59f16848f..0000000000
--- a/sysdeps/ia64/fpu/s_nextafterl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/i386/fpu/s_nextafterl.c>
diff --git a/sysdeps/ia64/fpu/s_nexttoward.S b/sysdeps/ia64/fpu/s_nexttoward.S
new file mode 100644
index 0000000000..741fea02b0
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_nexttoward.S
@@ -0,0 +1,490 @@
+.file "nexttoward.s"
+
+
+// Copyright (c) 2001 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/15/01 Initial version 
+// 08/23/01 Corrected error tag number
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 12/14/04 Added error handling on underflow.
+//
+// API
+//==============================================================
+// double nexttoward( double x, long double y );
+// input  floating point f8, f9
+// output floating point f8
+//
+// Registers used
+//==============================================================
+GR_max_pexp     = r14
+GR_min_pexp     = r15
+GR_exp          = r16
+GR_sig          = r17
+GR_lnorm_sig    = r18
+GR_sign_mask    = r19
+GR_exp_mask     = r20
+GR_sden_sig     = r21
+GR_new_sig      = r22
+GR_new_exp      = r23
+GR_lden_sig     = r24
+GR_snorm_sig    = r25
+GR_exp1         = r26
+GR_x_exp        = r27
+GR_min_den_rexp = r28
+// r36-39 parameters for libm_error_support
+
+GR_SAVE_B0                = r34
+GR_SAVE_GP                = r35
+GR_SAVE_PFS               = r32
+
+GR_Parameter_X            = r36
+GR_Parameter_Y            = r37
+GR_Parameter_RESULT       = r38
+GR_Parameter_TAG          = r39
+
+FR_lnorm_sig       = f10
+FR_lnorm_exp       = f11
+FR_lnorm           = f12
+FR_sden_sig        = f13
+FR_sden_exp        = f14
+FR_sden            = f15
+FR_save_f8         = f33
+FR_new_exp         = f34
+FR_new_sig         = f35
+FR_lden_sig        = f36
+FR_snorm_sig       = f37
+FR_exp1            = f38
+FR_tmp             = f39
+
+//
+// Overview of operation
+//==============================================================
+// nexttoward determines the next representable value 
+// after x in the direction of y. 
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(nexttoward)
+
+// Extract signexp from x
+// Is x < y ?  p10 if yes, p11 if no
+// Form smallest denormal significand = ulp size
+{ .mfi
+      getf.exp GR_exp      = f8
+      fcmp.lt.s1 p10,p11 = f8, f9                
+      addl GR_sden_sig = 0x800, r0
+}
+// Form largest normal significand 0xfffffffffffff800
+// Form smallest normal exponent
+{ .mfi
+      addl GR_lnorm_sig = -0x800,r0
+      nop.f 999
+      addl GR_min_pexp = 0x0fc01, r0 ;;
+}
+// Extract significand from x
+// Is x=y?
+// Form largest normal exponent
+{ .mfi
+      getf.sig GR_sig      = f8
+      fcmp.eq.s0 p6,p0 = f8, f9                
+      addl GR_max_pexp = 0x103fe, r0
+}
+// Move largest normal significand to fp reg for special cases
+{ .mfi
+      setf.sig FR_lnorm_sig = GR_lnorm_sig
+      nop.f 999
+      addl GR_sign_mask = 0x20000, r0 ;;
+}
+
+// Move smallest denormal significand and signexp to fp regs
+// Is x=nan?
+// Set p12 and p13 based on whether significand increases or decreases
+// It increases (p12 set) if x<y and x>=0 or if x>y and x<0
+// It decreases (p13 set) if x<y and x<0  or if x>y and x>=0
+{ .mfi
+      setf.sig FR_sden_sig = GR_sden_sig
+      fclass.m  p8,p0 = f8, 0xc3           
+(p10) cmp.lt p12,p13 = GR_exp, GR_sign_mask
+}
+{ .mfi
+      setf.exp FR_sden_exp = GR_min_pexp
+(p11) cmp.ge p12,p13 = GR_exp, GR_sign_mask ;;
+}
+
+.pred.rel "mutex",p12,p13
+
+// Form expected new significand, adding or subtracting 1 ulp increment
+// If x=y set result to y
+// Form smallest normal significand and largest denormal significand
+{ .mfi
+(p12) add GR_new_sig = GR_sig, GR_sden_sig
+(p6)  fnorm.d.s0 f8=f9  //Normalise
+      dep.z GR_snorm_sig = 1,63,1 // 0x8000000000000000
+}
+{ .mlx
+(p13) sub GR_new_sig = GR_sig, GR_sden_sig
+      movl GR_lden_sig = 0x7ffffffffffff800 ;;
+}
+
+// Move expected result significand and signexp to fp regs
+// Is y=nan?
+// Form new exponent in case result exponent needs incrementing or decrementing
+{ .mfi
+      setf.exp FR_new_exp = GR_exp
+      fclass.m  p9,p0 = f9, 0xc3           
+(p12) add GR_exp1 = 1, GR_exp
+}
+{ .mib
+      setf.sig FR_new_sig = GR_new_sig
+(p13) add GR_exp1 = -1, GR_exp
+(p6)  br.ret.spnt    b0 ;;             // Exit if x=y
+}
+
+// Move largest normal signexp to fp reg for special cases
+// Is x=zero?
+{ .mfi
+      setf.exp FR_lnorm_exp = GR_max_pexp
+      fclass.m  p7,p0 = f8, 0x7
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+(p8)  fma.s0 f8 = f8,f1,f9                     
+(p8)  br.ret.spnt    b0 ;;             // Exit if x=nan
+}
+
+// Move exp+-1 and smallest normal significand to fp regs for special cases
+// Is x=inf?
+{ .mfi
+      setf.exp FR_exp1 = GR_exp1
+      fclass.m  p6,p0 = f8, 0x23           
+      addl GR_exp_mask = 0x1ffff, r0
+}
+{ .mfb
+      setf.sig FR_snorm_sig = GR_snorm_sig
+(p9)  fma.s0 f8 = f8,f1,f9                     
+(p9)  br.ret.spnt    b0 ;;             // Exit if y=nan
+}
+
+// Move largest denormal significand to fp regs for special cases
+// Save x
+{ .mfb
+      setf.sig FR_lden_sig = GR_lden_sig
+      mov FR_save_f8 = f8
+(p7)  br.cond.spnt NEXT_ZERO ;;   // Exit if x=0   
+}
+
+// Mask off the sign to get x_exp
+{ .mfb
+      and GR_x_exp = GR_exp_mask, GR_exp
+      nop.f 999
+(p6)  br.cond.spnt NEXT_INF ;;   // Exit if x=inf   
+}
+
+// Check 6 special cases when significand rolls over:
+//  1 sig size incr, x_sig=max_sig, x_exp < max_exp
+//     Set p6, result is sig=min_sig, exp++
+//  2 sig size incr, x_sig=max_sig, x_exp >= max_exp
+//     Set p7, result is inf, signal overflow
+//  3 sig size decr, x_sig=min_sig, x_exp > min_exp
+//     Set p8, result is sig=max_sig, exp--
+//  4 sig size decr, x_sig=min_sig, x_exp = min_exp
+//     Set p9, result is sig=max_den_sig, exp same, signal underflow and inexact
+//  5 sig size decr, x_sig=min_den_sig, x_exp = min_exp
+//     Set p10, result is zero, sign of x, signal underflow and inexact
+//  6 sig size decr, x_sig=min_sig, x_exp < min_exp 
+//     Set p14, result is zero, sign of x, signal underflow and inexact
+//
+// Form exponent of smallest double denormal (if normalized register format)
+{ .mmi
+      adds GR_min_den_rexp = -52, GR_min_pexp
+(p12) cmp.eq.unc p6,p0 = GR_new_sig, r0
+(p13) cmp.eq.unc p8,p10 = GR_new_sig, GR_lden_sig ;;
+}
+
+{ .mmi
+(p6)  cmp.lt.unc p6,p7 = GR_x_exp, GR_max_pexp
+(p8)  cmp.gt.unc p8,p9 = GR_x_exp, GR_min_pexp
+(p10) cmp.eq.unc p10,p0 = GR_new_sig, r0 ;;
+}
+
+// Create small normal in case need to generate underflow flag
+{ .mfi
+(p10) cmp.le.unc p10,p0 = GR_x_exp, GR_min_pexp
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+(p9)  cmp.gt.unc p9,p14 = GR_x_exp, GR_min_den_rexp
+}
+// Branch if cases 1, 2, 3
+{ .bbb
+(p6)  br.cond.spnt NEXT_EXPUP
+(p7)  br.cond.spnt NEXT_OVERFLOW
+(p8)  br.cond.spnt NEXT_EXPDOWN ;;
+}
+
+// Branch if cases 4, 5, 6
+{ .bbb
+(p9)  br.cond.spnt NEXT_NORM_TO_DENORM
+(p10) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO
+(p14) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO ;;
+}
+
+// Here if no special cases
+// Set p6 if result will be a denormal, so can force underflow flag
+//    Case 1:  x_exp=min_exp, x_sig=unnormalized
+//    Case 2:  x_exp<min_exp
+{ .mfi
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_new_exp, FR_new_sig
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+      nop.f 999
+(p7)  tbit.z p6,p0 = GR_new_sig, 63 ;;
+}
+
+NEXT_COMMON_FINISH:
+// Force underflow and inexact if denormal result
+{ .mfi
+      nop.m 999
+(p6)  fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+      fnorm.d.s0 f8 = f8 // Final normalization to result precision
+(p6)  br.cond.spnt NEXT_UNDERFLOW ;;
+}
+
+{ .mfb
+      nop.m 999
+      nop.f 999
+      br.ret.sptk b0;;
+}
+
+//Special cases
+NEXT_EXPUP:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_snorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_EXPDOWN:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_lnorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_NORM_TO_DENORM:
+{ .mfi
+      nop.m 999
+      fmerge.se f8 = FR_new_exp, FR_lden_sig
+      nop.i 999
+}
+// Force underflow and inexact if denormal result
+{ .mfb
+      nop.m 999
+      fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW_TO_ZERO:
+{ .mfb
+      cmp.eq p6,p0 = r0,r0
+      fmerge.s f8 = FR_save_f8,f0
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_INF: 
+// Here if f8 is +- infinity
+// INF
+// if f8 is +inf, no matter what y is return  largest double
+// if f8 is -inf, no matter what y is return -largest double
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s f8 = f8,FR_lnorm                
+      br.ret.sptk    b0 ;;                        
+}
+
+NEXT_ZERO: 
+
+// Here if f8 is +- zero
+// ZERO
+// if f8 is zero and y is +, return + smallest double denormal 
+// if f8 is zero and y is -, return - smallest double denormal 
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_sden = FR_sden_exp,FR_sden_sig
+      nop.i 999 ;;
+}
+
+// Create small normal to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Add correct sign from direction arg
+{ .mfi
+      nop.m 999
+      fmerge.s f8 = f9,FR_sden                
+      nop.i 999 ;;
+}
+
+// Force underflow and inexact flags
+{ .mfb
+      nop.m 999
+      fma.d.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW: 
+// Here if result is a denorm, or input is finite and result is zero
+// Call error support to report possible range error
+{ .mib
+      alloc          r32=ar.pfs,2,2,4,0
+      mov           GR_Parameter_TAG = 271      // Error code
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+NEXT_OVERFLOW: 
+// Here if input is finite, but result will be infinite
+// Use frcpa to generate infinity of correct sign
+// Call error support to report possible range error
+{ .mfi
+      alloc          r32=ar.pfs,2,2,4,0
+      frcpa.s1 f8,p6 = FR_save_f8, f0
+      nop.i 999 ;;
+}
+
+// Create largest double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Force overflow and inexact flags to be set
+{ .mfb
+      mov           GR_Parameter_TAG = 199      // Error code
+      fma.d.s0 FR_tmp = FR_lnorm,FR_lnorm,f0
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+GLOBAL_LIBM_END(nexttoward)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+// (1)
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+
+// (2)
+{ .mmi
+        stfd [GR_Parameter_Y] = f9,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+// (3)
+{ .mib
+        stfd [GR_Parameter_X] = FR_save_f8              // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y           // Parameter 3 address
+        nop.b 0                                
+}
+{ .mib
+        stfd [GR_Parameter_Y] = f8              // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_nexttoward.c b/sysdeps/ia64/fpu/s_nexttoward.c
deleted file mode 100644
index aee2bb5895..0000000000
--- a/sysdeps/ia64/fpu/s_nexttoward.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/i386/fpu/s_nexttoward.c>
diff --git a/sysdeps/ia64/fpu/s_nexttowardf.S b/sysdeps/ia64/fpu/s_nexttowardf.S
new file mode 100644
index 0000000000..b8b976271a
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_nexttowardf.S
@@ -0,0 +1,496 @@
+.file "nexttowardf.s"
+
+
+// Copyright (c) 2001 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/15/01 Initial version 
+// 08/23/01 Corrected error tag number
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 12/14/04 Added error handling on underflow.
+//
+// API
+//==============================================================
+// float nexttowardf( float x, long double y );
+// input  floating point f8, f9
+// output floating point f8
+//
+// Registers used
+//==============================================================
+GR_max_pexp     = r14
+GR_min_pexp     = r15
+GR_exp          = r16
+GR_sig          = r17
+GR_lnorm_sig    = r18
+GR_sign_mask    = r19
+GR_exp_mask     = r20
+GR_sden_sig     = r21
+GR_new_sig      = r22
+GR_new_exp      = r23
+GR_lden_sig     = r24
+GR_snorm_sig    = r25
+GR_exp1         = r26
+GR_x_exp        = r27
+GR_min_den_rexp = r28
+// r36-39 parameters for libm_error_support
+
+GR_SAVE_B0                = r34
+GR_SAVE_GP                = r35
+GR_SAVE_PFS               = r32
+
+GR_Parameter_X            = r36
+GR_Parameter_Y            = r37
+GR_Parameter_RESULT       = r38
+GR_Parameter_TAG          = r39
+
+FR_lnorm_sig       = f10
+FR_lnorm_exp       = f11
+FR_lnorm           = f12
+FR_sden_sig        = f13
+FR_sden_exp        = f14
+FR_sden            = f15
+FR_save_f8         = f33
+FR_new_exp         = f34
+FR_new_sig         = f35
+FR_lden_sig        = f36
+FR_snorm_sig       = f37
+FR_exp1            = f38
+FR_tmp             = f39
+
+//
+// Overview of operation
+//==============================================================
+// nexttowardf determines the next representable value 
+// after x in the direction of y. 
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(nexttowardf)
+
+// Extract signexp from x
+// Form smallest denormal significand = ulp size
+{ .mlx
+      getf.exp GR_exp      = f8
+      movl GR_sden_sig = 0x0000010000000000
+}
+// Form largest normal exponent
+// Is x < y ?  p10 if yes, p11 if no
+// Form smallest normal exponent
+{ .mfi
+      addl GR_max_pexp = 0x1007e, r0
+      fcmp.lt.s1 p10,p11 = f8, f9
+      addl GR_min_pexp = 0x0ff81, r0 ;;
+}
+
+// Is x=y?
+{ .mfi
+      getf.sig GR_sig      = f8
+      fcmp.eq.s0 p6,p0 = f8, f9
+      nop.i 0
+}
+// Extract significand from x
+// Form largest normal significand
+{ .mlx
+      nop.m 0 
+      movl GR_lnorm_sig = 0xffffff0000000000 ;;
+}
+
+// Move largest normal significand to fp reg for special cases
+{ .mfi
+      setf.sig FR_lnorm_sig = GR_lnorm_sig
+      nop.f 0 
+      addl GR_sign_mask = 0x20000, r0 ;;
+}
+
+// Move smallest denormal significand and signexp to fp regs
+// Is x=nan?
+// Set p12 and p13 based on whether significand increases or decreases
+// It increases (p12 set) if x<y and x>=0 or if x>y and x<0
+// It decreases (p13 set) if x<y and x<0  or if x>y and x>=0
+{ .mfi
+      setf.sig FR_sden_sig = GR_sden_sig
+      fclass.m  p8,p0 = f8, 0xc3           
+(p10) cmp.lt p12,p13 = GR_exp, GR_sign_mask
+}
+{ .mfi
+      setf.exp FR_sden_exp = GR_min_pexp
+      nop.f 999
+(p11) cmp.ge p12,p13 = GR_exp, GR_sign_mask ;;
+}
+
+.pred.rel "mutex",p12,p13
+
+// Form expected new significand, adding or subtracting 1 ulp increment
+// If x=y set result to y
+// Form smallest normal significand and largest denormal significand
+{ .mfi
+(p12) add GR_new_sig = GR_sig, GR_sden_sig
+(p6)  fnorm.s.s0 f8=f9   //Normalise
+      dep.z GR_snorm_sig = 1,63,1 // 0x8000000000000000
+}
+{ .mlx
+(p13) sub GR_new_sig = GR_sig, GR_sden_sig
+      movl GR_lden_sig = 0x7fffff0000000000 ;;
+}
+
+// Move expected result significand and signexp to fp regs
+// Is y=nan?
+// Form new exponent in case result exponent needs incrementing or decrementing
+{ .mfi
+      setf.exp FR_new_exp = GR_exp
+      fclass.m  p9,p0 = f9, 0xc3           
+(p12) add GR_exp1 = 1, GR_exp
+}
+{ .mib
+      setf.sig FR_new_sig = GR_new_sig
+(p13) add GR_exp1 = -1, GR_exp
+(p6)  br.ret.spnt    b0 ;;             // Exit if x=y
+}
+
+// Move largest normal signexp to fp reg for special cases
+// Is x=zero?
+{ .mfi
+      setf.exp FR_lnorm_exp = GR_max_pexp
+      fclass.m  p7,p0 = f8, 0x7
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+(p8)  fma.s0 f8 = f8,f1,f9                     
+(p8)  br.ret.spnt    b0 ;;             // Exit if x=nan
+}
+
+// Move exp+-1 and smallest normal significand to fp regs for special cases
+// Is x=inf?
+{ .mfi
+      setf.exp FR_exp1 = GR_exp1
+      fclass.m  p6,p0 = f8, 0x23           
+      addl GR_exp_mask = 0x1ffff, r0
+}
+{ .mfb
+      setf.sig FR_snorm_sig = GR_snorm_sig
+(p9)  fma.s0 f8 = f8,f1,f9                     
+(p9)  br.ret.spnt    b0 ;;             // Exit if y=nan
+}
+
+// Move largest denormal significand to fp regs for special cases
+// Save x
+{ .mfb
+      setf.sig FR_lden_sig = GR_lden_sig
+      mov FR_save_f8 = f8
+(p7)  br.cond.spnt NEXT_ZERO ;;   // Exit if x=0   
+}
+
+// Mask off the sign to get x_exp
+{ .mfb
+      and GR_x_exp = GR_exp_mask, GR_exp
+      nop.f 999
+(p6)  br.cond.spnt NEXT_INF ;;   // Exit if x=inf   
+}
+
+// Check 6 special cases when significand rolls over:
+//  1 sig size incr, x_sig=max_sig, x_exp < max_exp
+//     Set p6, result is sig=min_sig, exp++
+//  2 sig size incr, x_sig=max_sig, x_exp >= max_exp
+//     Set p7, result is inf, signal overflow
+//  3 sig size decr, x_sig=min_sig, x_exp > min_exp
+//     Set p8, result is sig=max_sig, exp--
+//  4 sig size decr, x_sig=min_sig, x_exp = min_exp
+//     Set p9, result is sig=max_den_sig, exp same, signal underflow and inexact
+//  5 sig size decr, x_sig=min_den_sig, x_exp = min_exp
+//     Set p10, result is zero, sign of x, signal underflow and inexact
+//  6 sig size decr, x_sig=min_sig, x_exp < min_exp 
+//     Set p14, result is zero, sign of x, signal underflow and inexact
+//
+// Form exponent of smallest float denormal (if normalized register format)
+{ .mmi
+      adds GR_min_den_rexp = -23, GR_min_pexp
+(p12) cmp.eq.unc p6,p0 = GR_new_sig, r0
+(p13) cmp.eq.unc p8,p10 = GR_new_sig, GR_lden_sig ;;
+}
+
+{ .mmi
+(p6)  cmp.lt.unc p6,p7 = GR_x_exp, GR_max_pexp
+(p8)  cmp.gt.unc p8,p9 = GR_x_exp, GR_min_pexp
+(p10) cmp.eq.unc p10,p0 = GR_new_sig, r0 ;;
+}
+
+// Create small normal in case need to generate underflow flag
+{ .mfi
+(p10) cmp.le.unc p10,p0 = GR_x_exp, GR_min_pexp
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+(p9)  cmp.gt.unc p9,p14 = GR_x_exp, GR_min_den_rexp
+}
+// Branch if cases 1, 2, 3
+{ .bbb
+(p6)  br.cond.spnt NEXT_EXPUP
+(p7)  br.cond.spnt NEXT_OVERFLOW
+(p8)  br.cond.spnt NEXT_EXPDOWN ;;
+}
+
+// Branch if cases 4, 5, 6
+{ .bbb
+(p9)  br.cond.spnt NEXT_NORM_TO_DENORM
+(p10) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO
+(p14) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO ;;
+}
+
+// Here if no special cases
+// Set p6 if result will be a denormal, so can force underflow flag
+//    Case 1:  x_exp=min_exp, x_sig=unnormalized
+//    Case 2:  x_exp<min_exp
+{ .mfi
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_new_exp, FR_new_sig
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+      nop.f 999
+(p7)  tbit.z p6,p0 = GR_new_sig, 63 ;;
+}
+
+NEXT_COMMON_FINISH:
+// Force underflow and inexact if denormal result
+{ .mfi
+      nop.m 999
+(p6)  fma.s.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+      fnorm.s.s0 f8 = f8 // Final normalization to result precision
+(p6)  br.cond.spnt NEXT_UNDERFLOW ;;
+}
+
+{ .mfb
+      nop.m 999
+      nop.f 999
+      br.ret.sptk b0;;
+}
+
+//Special cases
+NEXT_EXPUP:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_snorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_EXPDOWN:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_lnorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_NORM_TO_DENORM:
+{ .mfi
+      nop.m 999
+      fmerge.se f8 = FR_new_exp, FR_lden_sig
+      nop.i 999
+}
+// Force underflow and inexact
+{ .mfb
+      nop.m 999
+      fma.s.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW_TO_ZERO:
+{ .mfb
+      cmp.eq p6,p0 = r0,r0
+      fmerge.s f8 = FR_save_f8,f0
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_INF: 
+// Here if f8 is +- infinity
+// INF
+// if f8 is +inf, no matter what y is return  largest float
+// if f8 is -inf, no matter what y is return -largest float
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s f8 = f8,FR_lnorm                
+      br.ret.sptk    b0 ;;                        
+}
+
+NEXT_ZERO: 
+
+// Here if f8 is +- zero
+// ZERO
+// if f8 is zero and y is +, return + smallest float denormal 
+// if f8 is zero and y is -, return - smallest float denormal 
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_sden = FR_sden_exp,FR_sden_sig
+      nop.i 999 ;;
+}
+
+// Create small normal to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_sden_exp, FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Add correct sign from direction arg
+{ .mfi
+      nop.m 999
+      fmerge.s f8 = f9,FR_sden                
+      nop.i 999 ;;
+}
+
+// Force underflow and inexact flags
+{ .mfb
+      nop.m 999
+      fma.s.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW: 
+// Here if result is a denorm, or input is finite and result is zero
+// Call error support to report possible range error
+{ .mib
+      alloc          r32=ar.pfs,2,2,4,0
+      mov           GR_Parameter_TAG = 272      // Error code
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+NEXT_OVERFLOW: 
+// Here if input is finite, but result will be infinite
+// Use frcpa to generate infinity of correct sign
+// Call error support to report possible range error
+{ .mfi
+      alloc          r32=ar.pfs,2,2,4,0
+      frcpa.s1 f8,p6 = FR_save_f8, f0
+      nop.i 999 ;;
+}
+
+// Create largest double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Force overflow and inexact flags to be set
+{ .mfb
+      mov           GR_Parameter_TAG = 200      // Error code
+      fma.s.s0 FR_tmp = FR_lnorm,FR_lnorm,f0
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+GLOBAL_LIBM_END(nexttowardf)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+// (1)
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+
+// (2)
+{ .mmi
+        stfs [GR_Parameter_Y] = f9,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+// (3)
+{ .mib
+        stfs [GR_Parameter_X] = FR_save_f8              // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y           // Parameter 3 address
+        nop.b 0                                
+}
+{ .mib
+        stfs [GR_Parameter_Y] = f8              // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_nexttowardf.c b/sysdeps/ia64/fpu/s_nexttowardf.c
deleted file mode 100644
index 55e95f6916..0000000000
--- a/sysdeps/ia64/fpu/s_nexttowardf.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/i386/fpu/s_nexttowardf.c>
diff --git a/sysdeps/ia64/fpu/s_nexttowardl.S b/sysdeps/ia64/fpu/s_nexttowardl.S
new file mode 100644
index 0000000000..fa2db125a8
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_nexttowardl.S
@@ -0,0 +1,494 @@
+.file "nexttowardl.s"
+
+
+// Copyright (c) 2001 - 2004, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 08/15/01 Initial version 
+// 08/23/01 Corrected error tag number
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 12/14/04 Added error handling on underflow.
+//
+// API
+//==============================================================
+// long double nexttowardl( long double x, long double y );
+// input  floating point f8, f9
+// output floating point f8
+//
+// Registers used
+//==============================================================
+GR_max_pexp     = r14
+GR_min_pexp     = r15
+GR_exp          = r16
+GR_sig          = r17
+GR_lnorm_sig    = r18
+GR_sign_mask    = r19
+GR_exp_mask     = r20
+GR_sden_sig     = r21
+GR_new_sig      = r22
+GR_new_exp      = r23
+GR_lden_sig     = r24
+GR_snorm_sig    = r25
+GR_exp1         = r26
+GR_x_exp        = r27
+// r36-39 parameters for libm_error_support
+
+GR_SAVE_B0                = r34
+GR_SAVE_GP                = r35
+GR_SAVE_PFS               = r32
+
+GR_Parameter_X            = r36
+GR_Parameter_Y            = r37
+GR_Parameter_RESULT       = r38
+GR_Parameter_TAG          = r39
+
+FR_lnorm_sig       = f10
+FR_lnorm_exp       = f11
+FR_lnorm           = f12
+FR_sden_sig        = f13
+FR_den_exp         = f14
+FR_sden            = f15
+FR_snorm_exp       = f32
+FR_save_f8         = f33
+FR_new_exp         = f34
+FR_new_sig         = f35
+FR_lden_sig        = f36
+FR_snorm_sig       = f37
+FR_exp1            = f38
+FR_tmp             = f39
+
+//
+// Overview of operation
+//==============================================================
+// nexttowardl determines the next representable value 
+// after x in the direction of y. 
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(nexttowardl)
+
+// Extract signexp from x
+// Is x < y ?  p10 if yes, p11 if no
+// Form smallest denormal significand = ulp size
+{ .mfi
+      getf.exp GR_exp      = f8
+      fcmp.lt.s1 p10,p11 = f8, f9                
+      addl GR_sden_sig = 0x1, r0
+}
+// Form largest normal significand 0xffffffffffffffff
+// Form smallest normal exponent
+{ .mfi
+      addl GR_lnorm_sig = -0x1,r0
+      nop.f 999
+      addl GR_min_pexp = 0x0c001, r0 ;;
+}
+
+// Extract significand from x
+// Is x=y?   This fcmp also sets Invalid and Denormal if required
+// Form largest normal exponent
+{ .mfi
+      getf.sig GR_sig      = f8
+      fcmp.eq.s0 p6,p0 = f8, f9
+      addl GR_max_pexp = 0x13ffe, r0
+}
+// Move largest normal significand to fp reg for special cases
+{ .mfi
+      setf.sig FR_lnorm_sig = GR_lnorm_sig
+      nop.f 999
+      addl GR_sign_mask = 0x20000, r0 ;;
+}
+
+// Move smallest denormal significand and exp to fp regs
+// Is x=nan?
+// Set p12 and p13 based on whether significand increases or decreases
+// It increases (p12 set) if x<y and x>=0 or if x>y and x<0
+// It decreases (p13 set) if x<y and x<0  or if x>y and x>=0
+{ .mfi
+      setf.sig FR_sden_sig = GR_sden_sig
+      fclass.m  p8,p0 = f8, 0xc3           
+(p10) cmp.lt p12,p13 = GR_exp, GR_sign_mask
+}
+// Move smallest normal exp to fp regs
+{ .mfi
+      setf.exp FR_snorm_exp = GR_min_pexp
+      nop.f 999
+(p11) cmp.ge p12,p13 = GR_exp, GR_sign_mask ;;
+}
+
+.pred.rel "mutex",p12,p13
+
+// Form expected new significand, adding or subtracting 1 ulp increment
+// If x=y set result to y
+// Form smallest normal significand and largest denormal significand
+{ .mfi
+(p12) add GR_new_sig = GR_sig, GR_sden_sig
+(p6)  fmerge.s f8=f9,f9
+      dep.z GR_snorm_sig = 1,63,1 // 0x8000000000000000
+}
+{ .mlx
+(p13) sub GR_new_sig = GR_sig, GR_sden_sig
+      movl GR_lden_sig = 0x7fffffffffffffff ;;
+}
+
+// Move expected result significand and signexp to fp regs
+// Is y=nan?
+// Form new exponent in case result exponent needs incrementing or decrementing
+{ .mfi
+      setf.exp FR_new_exp = GR_exp
+      fclass.m  p9,p0 = f9, 0xc3           
+(p12) add GR_exp1 = 1, GR_exp
+}
+{ .mib
+      setf.sig FR_new_sig = GR_new_sig
+(p13) add GR_exp1 = -1, GR_exp
+(p6)  br.ret.spnt    b0 ;;             // Exit if x=y
+}
+
+// Move largest normal signexp to fp reg for special cases
+// Is x=zero?
+{ .mfi
+      setf.exp FR_lnorm_exp = GR_max_pexp
+      fclass.m  p7,p0 = f8, 0x7
+      nop.i 999
+}
+{ .mfb
+      setf.exp FR_den_exp = GR_min_pexp
+(p8)  fma.s0 f8 = f8,f1,f9                     
+(p8)  br.ret.spnt    b0 ;;             // Exit if x=nan
+}
+
+// Move exp+-1 and smallest normal significand to fp regs for special cases
+// Is x=inf?
+{ .mfi
+      setf.exp FR_exp1 = GR_exp1
+      fclass.m  p6,p0 = f8, 0x23           
+      addl GR_exp_mask = 0x1ffff, r0
+}
+{ .mfb
+      setf.sig FR_snorm_sig = GR_snorm_sig
+(p9)  fma.s0 f8 = f8,f1,f9                     
+(p9)  br.ret.spnt    b0 ;;             // Exit if y=nan
+}
+
+// Move largest denormal significand to fp regs for special cases
+// Save x
+{ .mfb
+      setf.sig FR_lden_sig = GR_lden_sig
+      mov FR_save_f8 = f8
+(p7)  br.cond.spnt NEXT_ZERO ;;   // Exit if x=0   
+}
+
+// Mask off the sign to get x_exp
+{ .mfb
+      and GR_x_exp = GR_exp_mask, GR_exp
+      nop.f 999
+(p6)  br.cond.spnt NEXT_INF ;;   // Exit if x=inf   
+}
+
+// Check 5 special cases when significand rolls over:
+//  1 sig size incr, x_sig=max_sig, x_exp < max_exp
+//     Set p6, result is sig=min_sig, exp++
+//  2 sig size incr, x_sig=max_sig, x_exp >= max_exp
+//     Set p7, result is inf, signal overflow
+//  3 sig size decr, x_sig=min_sig, x_exp > min_exp
+//     Set p8, result is sig=max_sig, exp--
+//  4 sig size decr, x_sig=min_sig, x_exp = min_exp
+//     Set p9, result is sig=max_den_sig, exp same, signal underflow and inexact
+//  5 sig size decr, x_sig=min_den_sig, x_exp = min_exp
+//     Set p10, result is zero, sign of x, signal underflow and inexact
+//
+{ .mmi
+(p12) cmp.eq.unc p6,p0 = GR_new_sig, r0
+(p13) cmp.eq.unc p9,p10 = GR_new_sig, GR_lden_sig
+      nop.i 999
+;;
+}
+
+{ .mmi
+(p6)  cmp.lt.unc p6,p7 = GR_x_exp, GR_max_pexp
+(p10) cmp.eq.unc p10,p0 = GR_new_sig, r0
+(p9)  cmp.le.unc p9,p8 = GR_x_exp, GR_min_pexp 
+;;
+}
+
+// Create small normal in case need to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_snorm_exp, FR_lnorm_sig
+      nop.i 999
+}
+// Branch if cases 1, 2, 3
+{ .bbb
+(p6)  br.cond.spnt NEXT_EXPUP
+(p7)  br.cond.spnt NEXT_OVERFLOW
+(p8)  br.cond.spnt NEXT_EXPDOWN ;;
+}
+
+// Branch if cases 4, 5
+{ .mbb
+      nop.m 999
+(p9)  br.cond.spnt NEXT_NORM_TO_DENORM
+(p10) br.cond.spnt NEXT_UNDERFLOW_TO_ZERO
+;;
+}
+
+// Here if no special cases
+// Set p6 if result will be a denormal, so can force underflow flag
+//    Case 1:  x_exp=min_exp, x_sig=unnormalized
+//    Case 2:  x_exp<min_exp
+{ .mfi
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_new_exp, FR_new_sig
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+      nop.f 999
+(p6)  tbit.z p6,p0 = GR_new_sig, 63 ;;
+}
+
+NEXT_COMMON_FINISH:
+// Force underflow and inexact if denormal result
+{ .mfi
+      nop.m 999
+(p6)  fma.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+      fnorm.s0 f8 = f8 // Final normalization to result precision
+(p6)  br.cond.spnt NEXT_UNDERFLOW ;;
+}
+
+{ .mfb
+      nop.m 999
+      nop.f 999
+      br.ret.sptk b0;;
+}
+
+//Special cases
+NEXT_EXPUP:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_snorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_EXPDOWN:
+{ .mfb
+      cmp.lt p6,p7 = GR_x_exp, GR_min_pexp
+      fmerge.se f8 = FR_exp1, FR_lnorm_sig
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_NORM_TO_DENORM:
+{ .mfi
+      nop.m 999
+      fmerge.se f8 = FR_exp1, FR_lden_sig
+      nop.i 999
+}
+// Force underflow and inexact
+{ .mfb
+      nop.m 999
+      fma.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW_TO_ZERO:
+{ .mfb
+      cmp.eq p6,p0 = r0,r0
+      fmerge.s f8 = FR_save_f8,f0
+      br.cond.sptk NEXT_COMMON_FINISH ;;
+}
+
+NEXT_INF: 
+// Here if f8 is +- infinity
+// INF
+// if f8 is +inf, no matter what y is return  largest long double
+// if f8 is -inf, no matter what y is return -largest long double
+
+// Create largest long double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+{ .mfb
+      nop.m 999
+      fmerge.s f8 = f8,FR_lnorm                
+      br.ret.sptk    b0 ;;                        
+}
+
+NEXT_ZERO: 
+
+// Here if f8 is +- zero
+// ZERO
+// if f8 is zero and y is +, return + smallest long double denormal 
+// if f8 is zero and y is -, return - smallest long double denormal 
+
+{ .mfi
+      nop.m 999
+      fmerge.se FR_sden = f0,FR_sden_sig
+      nop.i 999 ;;
+}
+
+// Create small normal to generate underflow flag
+{ .mfi
+      nop.m 999
+      fmerge.se FR_tmp = FR_snorm_exp, FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Add correct sign from direction arg
+{ .mfi
+      nop.m 999
+      fmerge.s f8 = f9,FR_sden                
+      nop.i 999 ;;
+}
+
+// Force underflow and inexact flags
+{ .mfb
+      nop.m 999
+      fma.s0 FR_tmp = FR_tmp,FR_tmp,f0
+      br.cond.sptk NEXT_UNDERFLOW ;;
+}
+
+NEXT_UNDERFLOW: 
+// Here if result is a denorm, or input is finite and result is zero
+// Call error support to report possible range error
+{ .mib
+      alloc          r32=ar.pfs,2,2,4,0
+      mov           GR_Parameter_TAG = 270      // Error code
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+NEXT_OVERFLOW: 
+// Here if input is finite, but result will be infinite
+// Use frcpa to generate infinity of correct sign
+// Call error support to report possible range error
+{ .mfi
+      alloc          r32=ar.pfs,2,2,4,0
+      frcpa.s1 f8,p6 = FR_save_f8, f0
+      nop.i 999 ;;
+}
+
+// Create largest double
+{ .mfi
+      nop.m 999
+      fmerge.se FR_lnorm = FR_lnorm_exp,FR_lnorm_sig
+      nop.i 999 ;;
+}
+
+// Force overflow and inexact flags to be set
+{ .mfb
+      mov           GR_Parameter_TAG = 198      // Error code
+      fma.s0 FR_tmp = FR_lnorm,FR_lnorm,f0
+      br.cond.sptk  __libm_error_region    // Branch to error call
+}
+;;
+
+GLOBAL_LIBM_END(nexttowardl)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+// (1)
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                          // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                      // Save gp
+};;
+
+
+// (2)
+{ .mmi
+        stfe [GR_Parameter_Y] = f9,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp            // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                     // Save b0
+};;
+
+.body
+// (3)
+{ .mib
+        stfe [GR_Parameter_X] = FR_save_f8              // STORE Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y           // Parameter 3 address
+        nop.b 0                                
+}
+{ .mib
+        stfe [GR_Parameter_Y] = f8              // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#   // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/s_rint.S b/sysdeps/ia64/fpu/s_rint.S
index d04f06a31f..1735d9b498 100644
--- a/sysdeps/ia64/fpu/s_rint.S
+++ b/sysdeps/ia64/fpu/s_rint.S
@@ -1,10 +1,10 @@
 .file "rint.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,74 +20,68 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 2/08/01  Corrected behavior for all rounding modes.
-//
+// 02/02/00 Initial version
+// 02/08/01 Corrected behavior for all rounding modes.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
+//==============================================================
+
 // API
 //==============================================================
 // double rint(double x)
+//==============================================================
 
-#include "libm_support.h"
-
-//
-// general registers used:  
-//
-rint_GR_FFFF      = r14
-rint_GR_signexp   = r15
-rint_GR_exponent  = r16
-rint_GR_17ones    = r17
-rint_GR_10033     = r18
-rint_GR_fpsr      = r19
-rint_GR_rcs0      = r20
-rint_GR_rcs0_mask = r21
+// general input registers:
+// r14 - r21
 
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
+rFpsr      = r19
+rRcs0      = r20
+rRcs0Mask  = r21
 
-// predicate registers used: 
-// p6-11
+// floating-point registers:
+// f8 - f11
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
 
-RINT_NORM_f8      = f9                        
-RINT_FFFF         = f10 
-RINT_INEXACT      = f11 
-RINT_FLOAT_INT_f8 = f12
-RINT_INT_f8       = f13
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // double rint(double x)
-// Return an integer value (represented as a double) that is x rounded to integer in current
-// rounding mode 
+// Return an integer value (represented as a double) that is x
+// rounded to integer in current rounding mode
 // Inexact is set if x != rint(x)
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+//==============================================================
 
 // double_extended
-// if the exponent is >= 1003e => 3F(true) = 63(decimal)
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
 // we have a significand of 64 bits 1.63-bits.
 // If we multiply by 2^63, we no longer have a fractional part
 // So input is an integer value already.
@@ -100,155 +94,136 @@ RINT_INT_f8       = f13
 // So input is an integer value already.
 
 // single
-// if the exponent is >= 10016 => 17(true) = 23(decimal)
-// we have a significand of 53 bits 1.52-bits. (implicit 1)
-// If we multiply by 2^52, we no longer have a fractional part
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-
-.align 32
-.global rint#
-
 .section .text
-.proc  rint#
-.align 32
-
-
-rint: 
-#ifdef _LIBC
-.global __rint
-.type __rint,@function
-__rint:
-#endif
+GLOBAL_IEEE754_ENTRY(rint)
 
 { .mfi
-      mov rint_GR_fpsr = ar40           // Read the fpsr--need to check rc.s0
-      fcvt.fx.s1     RINT_INT_f8  = f8
-      addl            rint_GR_10033 = 0x10033, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10033, r0 // Set exponent at which is integer
 }
 { .mfi
-      mov        rint_GR_FFFF      = -1
-      fnorm.s1        RINT_NORM_f8  = f8
-      mov         rint_GR_17ones    = 0x1FFFF
-;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.s1       fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
 { .mfi
-      setf.sig    RINT_FFFF  = rint_GR_FFFF
-      fclass.m.unc  p6,p0 = f8, 0xe7
-      mov         rint_GR_rcs0_mask  = 0x0c00
-;;
+      mov              rFpsr = ar40          // Read fpsr -- check rc.s0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+      nop.i            0
 }
-
 { .mfb
-	nop.m 999
-(p6)  fnorm.d f8 = f8
-(p6)  br.ret.spnt   b0    // Exit if x nan, inf, zero
-;;
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     RINT_UNORM            // Branch if x unorm
 }
-
-{ .mfi
-	nop.m 999
-      fcvt.xf         RINT_FLOAT_INT_f8   = RINT_INT_f8
-	nop.i 999
 ;;
+
+
+RINT_COMMON:
+// Return here from RINT_UNORM
+{ .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.d.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
 }
+;;
 
 { .mfi
-      getf.exp rint_GR_signexp  = RINT_NORM_f8
-      fcmp.eq.s0  p8,p0 = f8,f0      // Dummy op to set denormal
-        nop.i 999
-;;
+      mov              rRcs0Mask = 0x0c00     // Mask for rc.s0
+      fcvt.xf          f8 = fXInt             // Result assume |x| < 2^52
+      cmp.ge           p7,p8 = rExp, rBigexp  // Is |x| >= 2^52?
 }
-
-
-{ .mii
-	nop.m 999
-	nop.i 999 
-      and      rint_GR_exponent = rint_GR_signexp, rint_GR_17ones
 ;;
-}
 
-{ .mmi
-      cmp.ge.unc      p7,p6 = rint_GR_exponent, rint_GR_10033
-      and rint_GR_rcs0 = rint_GR_rcs0_mask, rint_GR_fpsr
-	nop.i 999
-;;
+// We must correct result if |x| >= 2^52
+{ .mfi
+      nop.m            0
+(p7)  fma.d.s0         f8 = fNormX, f1, f0    // If |x| >= 2^52, result x
+      nop.i            0
 }
-
-// Check to see if s0 rounding mode is round to nearest.  If not then set s2
-// rounding mode to that of s0 and repeat conversions.
-L(RINT_COMMON):
-{ .mfb
-      cmp.ne   p11,p0 = rint_GR_rcs0, r0
-(p6) fclass.m.unc   p9,p10  = RINT_FLOAT_INT_f8, 0x07  // Test for result=0
-(p11) br.cond.spnt L(RINT_NOT_ROUND_NEAREST)  // Branch if not round to nearest
 ;;
-}
 
 { .mfi
-	nop.m 999
-(p6) fcmp.eq.unc.s1  p0,p8  = RINT_FLOAT_INT_f8, RINT_NORM_f8
-	nop.i 999
+      nop.m            0
+      fcmp.eq.unc.s1   p0, p9 = f8, fNormX    // Is result = x ?
+      nop.i            0
 }
 { .mfi
-	nop.m 999
-(p7) fnorm.d.s0   f8 = f8
-	nop.i 999
-;;
+      nop.m            0
+(p8)  fmerge.s         f8 = fNormX, f8        // Make sure sign rint(x) = sign x
+      nop.i            0
 }
+;;
 
-// If result is zero, merge sign of input
 { .mfi
-     nop.m 999
-(p9) fmerge.s f8 = f8, RINT_FLOAT_INT_f8
-     nop.i 999
+(p8)  and              rRcs0 = rFpsr, rRcs0Mask // Get rounding mode for sf0
+      nop.f            0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-(p10) fnorm.d f8 = RINT_FLOAT_INT_f8
-     nop.i 999
 ;;
+
+// If |x| < 2^52 we must test for other rounding modes
+{ .mfi
+(p8)  cmp.ne.unc       p10,p0 = rRcs0, r0     // Test for other rounding modes
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
+}
+{ .mbb
+      nop.m            0
+(p10) br.cond.spnt     RINT_NOT_ROUND_NEAREST // Branch if not round nearest
+      br.ret.sptk      b0                     // Exit main path if round nearest
 }
+;;
+
 
+
+RINT_UNORM:
+// Here if x unorm
 { .mfb
-     nop.m 999
-(p8) fmpy.s0     RINT_INEXACT = RINT_FFFF,RINT_FFFF  // Dummy to set inexact
-     br.ret.sptk    b0
-;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     RINT_COMMON            // Return to main path
 }
+;;
 
-L(RINT_NOT_ROUND_NEAREST):
-// Set rounding mode of s2 to that of s0
+RINT_NOT_ROUND_NEAREST:
+// Here if not round to nearest, and |x| < 2^52
+// Set rounding mode of s2 to that of s0, and repeat the conversion using s2
 { .mfi
-      mov rint_GR_rcs0 = r0       // Clear so we don't come back here
-      fsetc.s2     0x7f, 0x40
-	nop.i 999
-;;
+      nop.m            0
+      fsetc.s2         0x7f, 0x40
+      nop.i            0
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.fx.s2     RINT_INT_f8  = f8
-	nop.i 999
+      nop.m            0
+      fcvt.fx.s2       fXInt  = fNormX        // Convert to int in significand
+      nop.i            0
+}
 ;;
+
+{ .mfi
+      nop.m            0
+      fcvt.xf          f8 = fXInt             // Expected result
+      nop.i            0
 }
+;;
 
+// Be sure sign of result = sign of input.  Fixes cases where result is 0.
 { .mfb
-	nop.m 999
-      fcvt.xf         RINT_FLOAT_INT_f8   = RINT_INT_f8
-      br.cond.sptk  L(RINT_COMMON)
-;;
+      nop.m            0
+      fmerge.s         f8 = fNormX, f8
+      br.ret.sptk      b0                     // Exit main path
 }
+;;
 
-
-.endp rint
-ASM_SIZE_DIRECTIVE(rint)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__rint)
-#endif
+GLOBAL_IEEE754_END(rint)
diff --git a/sysdeps/ia64/fpu/s_rintf.S b/sysdeps/ia64/fpu/s_rintf.S
index 73cb98a048..05d6b411f2 100644
--- a/sysdeps/ia64/fpu/s_rintf.S
+++ b/sysdeps/ia64/fpu/s_rintf.S
@@ -1,10 +1,10 @@
 .file "rintf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,74 +20,68 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 2/08/01  Corrected behavior for all rounding modes.
-//
+// 02/02/00 Initial version
+// 02/08/01 Corrected behavior for all rounding modes.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
+//==============================================================
+
 // API
 //==============================================================
 // float rintf(float x)
+//==============================================================
 
-#include "libm_support.h"
-
-//
-// general registers used:  
-//
-rint_GR_FFFF      = r14
-rint_GR_signexp   = r15
-rint_GR_exponent  = r16
-rint_GR_17ones    = r17
-rint_GR_10033     = r18
-rint_GR_fpsr      = r19
-rint_GR_rcs0      = r20
-rint_GR_rcs0_mask = r21
+// general input registers:
+// r14 - r21
 
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
+rFpsr      = r19
+rRcs0      = r20
+rRcs0Mask  = r21
 
-// predicate registers used: 
-// p6-11
+// floating-point registers:
+// f8 - f11
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
 
-RINT_NORM_f8      = f9                        
-RINT_FFFF         = f10 
-RINT_INEXACT      = f11 
-RINT_FLOAT_INT_f8 = f12
-RINT_INT_f8       = f13
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // float rintf(float x)
-// Return an integer value (represented as a float) that is x rounded to integer in current
-// rounding mode 
-// Inexact is set if x != rintf(x)
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+// Return an integer value (represented as a float) that is x
+// rounded to integer in current rounding mode
+// Inexact is set if x != rint(x)
+//==============================================================
 
 // double_extended
-// if the exponent is >= 1003e => 3F(true) = 63(decimal)
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
 // we have a significand of 64 bits 1.63-bits.
 // If we multiply by 2^63, we no longer have a fractional part
 // So input is an integer value already.
@@ -100,155 +94,136 @@ RINT_INT_f8       = f13
 // So input is an integer value already.
 
 // single
-// if the exponent is >= 10016 => 17(true) = 23(decimal)
-// we have a significand of 53 bits 1.52-bits. (implicit 1)
-// If we multiply by 2^52, we no longer have a fractional part
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-
-.align 32
-.global rintf#
-
 .section .text
-.proc  rintf#
-.align 32
-
-
-rintf:
-#ifdef _LIBC
-.global __rintf
-.type __rintf,@function
-__rintf:
-#endif
+GLOBAL_IEEE754_ENTRY(rintf)
 
 { .mfi
-      mov rint_GR_fpsr = ar40           // Read the fpsr--need to check rc.s0
-      fcvt.fx.s1     RINT_INT_f8  = f8
-      addl            rint_GR_10033 = 0x10016, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x10016, r0 // Set exponent at which is integer
 }
 { .mfi
-      mov        rint_GR_FFFF      = -1
-      fnorm.s1        RINT_NORM_f8  = f8
-      mov         rint_GR_17ones    = 0x1FFFF
-;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.s1       fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
 { .mfi
-      setf.sig    RINT_FFFF  = rint_GR_FFFF
-      fclass.m.unc  p6,p0 = f8, 0xe7
-      mov         rint_GR_rcs0_mask  = 0x0c00
-;;
+      mov              rFpsr = ar40          // Read fpsr -- check rc.s0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+      nop.i            0
 }
-
 { .mfb
-	nop.m 999
-(p6)  fnorm.s f8 = f8
-(p6)  br.ret.spnt   b0    // Exit if x nan, inf, zero
-;;
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     RINT_UNORM            // Branch if x unorm
 }
-
-{ .mfi
-	nop.m 999
-      fcvt.xf         RINT_FLOAT_INT_f8   = RINT_INT_f8
-	nop.i 999
 ;;
+
+
+RINT_COMMON:
+// Return here from RINT_UNORM
+{ .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.s.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
 }
+;;
 
 { .mfi
-      getf.exp rint_GR_signexp  = RINT_NORM_f8
-      fcmp.eq.s0  p8,p0 = f8,f0      // Dummy op to set denormal
-        nop.i 999
-;;
+      mov              rRcs0Mask = 0x0c00     // Mask for rc.s0
+      fcvt.xf          f8 = fXInt             // Result assume |x| < 2^23
+      cmp.ge           p7,p8 = rExp, rBigexp  // Is |x| >= 2^23?
 }
-
-
-{ .mii
-	nop.m 999
-	nop.i 999 
-      and      rint_GR_exponent = rint_GR_signexp, rint_GR_17ones
 ;;
-}
 
-{ .mmi
-      cmp.ge.unc      p7,p6 = rint_GR_exponent, rint_GR_10033
-      and rint_GR_rcs0 = rint_GR_rcs0_mask, rint_GR_fpsr
-	nop.i 999
-;;
+// We must correct result if |x| >= 2^23
+{ .mfi
+      nop.m            0
+(p7)  fma.s.s0         f8 = fNormX, f1, f0    // If |x| >= 2^23, result x
+      nop.i            0
 }
-
-// Check to see if s0 rounding mode is round to nearest.  If not then set s2
-// rounding mode to that of s0 and repeat conversions.
-L(RINT_COMMON):
-{ .mfb
-      cmp.ne   p11,p0 = rint_GR_rcs0, r0
-(p6) fclass.m.unc   p9,p10  = RINT_FLOAT_INT_f8, 0x07  // Test for result=0
-(p11) br.cond.spnt L(RINT_NOT_ROUND_NEAREST)  // Branch if not round to nearest
 ;;
-}
 
 { .mfi
-	nop.m 999
-(p6) fcmp.eq.unc.s1  p0,p8  = RINT_FLOAT_INT_f8, RINT_NORM_f8
-	nop.i 999
+      nop.m            0
+      fcmp.eq.unc.s1   p0, p9 = f8, fNormX    // Is result = x ?
+      nop.i            0
 }
 { .mfi
-	nop.m 999
-(p7) fnorm.s.s0   f8 = f8
-	nop.i 999
-;;
+      nop.m            0
+(p8)  fmerge.s         f8 = fNormX, f8        // Make sure sign rint(x) = sign x
+      nop.i            0
 }
+;;
 
-// If result is zero, merge sign of input
 { .mfi
-     nop.m 999
-(p9) fmerge.s f8 = f8, RINT_FLOAT_INT_f8
-     nop.i 999
+(p8)  and              rRcs0 = rFpsr, rRcs0Mask // Get rounding mode for sf0
+      nop.f            0
+      nop.i            0
 }
-{ .mfi
-      nop.m 999
-(p10) fnorm.s f8 = RINT_FLOAT_INT_f8
-     nop.i 999
 ;;
+
+// If |x| < 2^23 we must test for other rounding modes
+{ .mfi
+(p8)  cmp.ne.unc       p10,p0 = rRcs0, r0     // Test for other rounding modes
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
+}
+{ .mbb
+      nop.m            0
+(p10) br.cond.spnt     RINT_NOT_ROUND_NEAREST // Branch if not round nearest
+      br.ret.sptk      b0                     // Exit main path if round nearest
 }
+;;
+
 
+
+RINT_UNORM:
+// Here if x unorm
 { .mfb
-     nop.m 999
-(p8) fmpy.s0     RINT_INEXACT = RINT_FFFF,RINT_FFFF  // Dummy to set inexact
-     br.ret.sptk    b0
-;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     RINT_COMMON            // Return to main path
 }
+;;
 
-L(RINT_NOT_ROUND_NEAREST):
-// Set rounding mode of s2 to that of s0
+RINT_NOT_ROUND_NEAREST:
+// Here if not round to nearest, and |x| < 2^23
+// Set rounding mode of s2 to that of s0, and repeat the conversion using s2
 { .mfi
-      mov rint_GR_rcs0 = r0       // Clear so we don't come back here
-      fsetc.s2     0x7f, 0x40
-	nop.i 999
-;;
+      nop.m            0
+      fsetc.s2         0x7f, 0x40
+      nop.i            0
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.fx.s2     RINT_INT_f8  = f8
-	nop.i 999
+      nop.m            0
+      fcvt.fx.s2       fXInt  = fNormX        // Convert to int in significand
+      nop.i            0
+}
 ;;
+
+{ .mfi
+      nop.m            0
+      fcvt.xf          f8 = fXInt             // Expected result
+      nop.i            0
 }
+;;
 
+// Be sure sign of result = sign of input.  Fixes cases where result is 0.
 { .mfb
-	nop.m 999
-      fcvt.xf         RINT_FLOAT_INT_f8   = RINT_INT_f8
-      br.cond.sptk  L(RINT_COMMON)
-;;
+      nop.m            0
+      fmerge.s         f8 = fNormX, f8
+      br.ret.sptk      b0                     // Exit main path
 }
+;;
 
-
-.endp rintf
-ASM_SIZE_DIRECTIVE(rintf)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__rintf)
-#endif
+GLOBAL_IEEE754_END(rintf)
diff --git a/sysdeps/ia64/fpu/s_rintl.S b/sysdeps/ia64/fpu/s_rintl.S
index 857e8d5208..b5402149ec 100644
--- a/sysdeps/ia64/fpu/s_rintl.S
+++ b/sysdeps/ia64/fpu/s_rintl.S
@@ -1,10 +1,10 @@
 .file "rintl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,76 +20,68 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 5/24/00  Fixed case of 2^63 - 1 + 0.5 (0x1007dffffffffffffffff)
-// 2/08/01  Corrected behavior for all rounding modes.
-//
+// 02/02/00 Initial version
+// 02/08/01 Corrected behavior for all rounding modes.
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance
+//==============================================================
+
 // API
 //==============================================================
 // long double rintl(long double x)
+//==============================================================
 
-#include "libm_support.h"
-
-//
-// general registers used:  
-//
-rint_GR_FFFF      = r14
-rint_GR_signexp   = r15
-rint_GR_exponent  = r16
-rint_GR_17ones    = r17
-rint_GR_10033     = r18
-rint_GR_fpsr      = r19
-rint_GR_rcs0      = r20
-rint_GR_rcs0_mask = r21
+// general input registers:
+// r14 - r21
 
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rM1        = r18
+rFpsr      = r19
+rRcs0      = r20
+rRcs0Mask  = r21
 
-// predicate registers used: 
-// p6-11
+// floating-point registers:
+// f8 - f11
 
-// floating-point registers used: 
+fXInt      = f9
+fNormX     = f10
+fTmp       = f11
 
-RINT_NORM_f8      = f9                        
-RINT_FFFF         = f10 
-RINT_INEXACT      = f11 
-RINT_FLOAT_INT_f8 = f12
-RINT_INT_f8       = f13
-RINT_SIGNED_FLOAT_INT_f8 = f14
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // long double rintl(long double x)
-// Return an integer value (represented as a long double) that is x rounded to integer in current
-// rounding mode 
-// Inexact is set if x != rintl(x)
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
-
-// Is the input an integer value already?
+// Return an integer value (represented as a long double) that is x
+// rounded to integer in current rounding mode
+// Inexact is set if x != rint(x)
+//==============================================================
 
 // double_extended
-// if the exponent is >= 1003e => 3F(true) = 63(decimal)
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
 // we have a significand of 64 bits 1.63-bits.
 // If we multiply by 2^63, we no longer have a fractional part
 // So input is an integer value already.
@@ -102,151 +94,136 @@ RINT_SIGNED_FLOAT_INT_f8 = f14
 // So input is an integer value already.
 
 // single
-// if the exponent is >= 10016 => 17(true) = 23(decimal)
-// we have a significand of 53 bits 1.52-bits. (implicit 1)
-// If we multiply by 2^52, we no longer have a fractional part
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-// If x is NAN, ZERO, or INFINITY, then  return
-
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
-
-
-.align 32
-.global rintl#
-
 .section .text
-.proc  rintl#
-.align 32
-
-
-rintl: 
-#ifdef _LIBC
-.global __rintl
-.type __rintl,@function
-__rintl:
-#endif
+GLOBAL_IEEE754_ENTRY(rintl)
 
 { .mfi
-      mov rint_GR_fpsr = ar40           // Read the fpsr--need to check rc.s0
-      fcvt.fx.s1     RINT_INT_f8  = f8
-      addl            rint_GR_10033 = 0x1003e, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      addl             rBigexp = 0x1003e, r0 // Set exponent at which is integer
 }
 { .mfi
-      mov        rint_GR_FFFF      = -1
-      fnorm.s1        RINT_NORM_f8  = f8
-      mov         rint_GR_17ones    = 0x1FFFF
-;;
+      mov              rM1 = -1              // Set all ones
+      fcvt.fx.s1       fXInt  = f8           // Convert to int in significand
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
 { .mfi
-      setf.sig    RINT_FFFF  = rint_GR_FFFF
-      fclass.m.unc  p6,p0 = f8, 0xe7
-      mov         rint_GR_rcs0_mask  = 0x0c00
-;;
+      mov              rFpsr = ar40          // Read fpsr -- check rc.s0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+      nop.i            0
 }
-
 { .mfb
-	nop.m 999
-(p6)  fnorm f8 = f8
-(p6)  br.ret.spnt   b0    // Exit if x nan, inf, zero
-;;
+      setf.sig         fTmp = rM1            // Make const for setting inexact
+      fnorm.s1         fNormX  = f8          // Normalize input
+(p7)  br.cond.spnt     RINT_UNORM            // Branch if x unorm
 }
-
-{ .mfi
-	nop.m 999
-      fcvt.xf         RINT_FLOAT_INT_f8   = RINT_INT_f8
-	nop.i 999
 ;;
+
+
+RINT_COMMON:
+// Return here from RINT_UNORM
+{ .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.s0           f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
 }
+;;
 
 { .mfi
-      getf.exp rint_GR_signexp  = RINT_NORM_f8
-      fcmp.eq.s0  p8,p0 = f8,f0      // Dummy op to set denormal
-        nop.i 999
-;;
+      mov              rRcs0Mask = 0x0c00     // Mask for rc.s0
+      fcvt.xf          f8 = fXInt             // Result assume |x| < 2^63
+      cmp.ge           p7,p8 = rExp, rBigexp  // Is |x| >= 2^63?
 }
-
-
-{ .mii
-	nop.m 999
-	nop.i 999 
-      and      rint_GR_exponent = rint_GR_signexp, rint_GR_17ones
 ;;
-}
 
-{ .mmi
-      cmp.ge.unc      p7,p6 = rint_GR_exponent, rint_GR_10033
-      and rint_GR_rcs0 = rint_GR_rcs0_mask, rint_GR_fpsr
-	nop.i 999
-;;
+// We must correct result if |x| >= 2^63
+{ .mfi
+      nop.m            0
+(p7)  fma.s0           f8 = fNormX, f1, f0    // If |x| >= 2^63, result x
+      nop.i            0
 }
-
-// Check to see if s0 rounding mode is round to nearest.  If not then set s2
-// rounding mode to that of s0 and repeat conversions.
-// Must merge the original sign for cases where the result is zero or the input
-// is the largest that still has a fraction (0x1007dfffffffffff)
-L(RINT_COMMON):
-{ .mfb
-      cmp.ne   p11,p0 = rint_GR_rcs0, r0
-(p6) fmerge.s  RINT_SIGNED_FLOAT_INT_f8 = f8, RINT_FLOAT_INT_f8
-(p11) br.cond.spnt L(RINT_NOT_ROUND_NEAREST)  // Branch if not round to nearest
 ;;
-}
 
 { .mfi
-	nop.m 999
-(p6) fcmp.eq.unc.s1  p0,p8  = RINT_FLOAT_INT_f8, RINT_NORM_f8
-	nop.i 999
+      nop.m            0
+      fcmp.eq.unc.s1   p0, p9 = f8, fNormX    // Is result = x ?
+      nop.i            0
 }
 { .mfi
-	nop.m 999
-(p7) fnorm.s0   f8 = f8
-	nop.i 999
-;;
+      nop.m            0
+(p8)  fmerge.s         f8 = fNormX, f8        // Make sure sign rint(x) = sign x
+      nop.i            0
 }
+;;
 
 { .mfi
-      nop.m 999
-(p6) fnorm f8 = RINT_SIGNED_FLOAT_INT_f8
-     nop.i 999
+(p8)  and              rRcs0 = rFpsr, rRcs0Mask // Get rounding mode for sf0
+      nop.f            0
+      nop.i            0
+}
 ;;
+
+// If |x| < 2^63 we must test for other rounding modes
+{ .mfi
+(p8)  cmp.ne.unc       p10,p0 = rRcs0, r0     // Test for other rounding modes
+(p9)  fmpy.s0          fTmp = fTmp, fTmp      // Dummy to set inexact
+      nop.i            0
+}
+{ .mbb
+      nop.m            0
+(p10) br.cond.spnt     RINT_NOT_ROUND_NEAREST // Branch if not round nearest
+      br.ret.sptk      b0                     // Exit main path if round nearest
 }
+;;
+
 
+
+RINT_UNORM:
+// Here if x unorm
 { .mfb
-     nop.m 999
-(p8) fmpy.s0     RINT_INEXACT = RINT_FFFF,RINT_FFFF  // Dummy to set inexact
-     br.ret.sptk    b0
-;;
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     RINT_COMMON            // Return to main path
 }
+;;
 
-L(RINT_NOT_ROUND_NEAREST):
-// Set rounding mode of s2 to that of s0
+RINT_NOT_ROUND_NEAREST:
+// Here if not round to nearest, and |x| < 2^63
+// Set rounding mode of s2 to that of s0, and repeat the conversion using s2
 { .mfi
-      mov rint_GR_rcs0 = r0       // Clear so we don't come back here
-      fsetc.s2     0x7f, 0x40
-	nop.i 999
-;;
+      nop.m            0
+      fsetc.s2         0x7f, 0x40
+      nop.i            0
 }
+;;
 
 { .mfi
-	nop.m 999
-      fcvt.fx.s2     RINT_INT_f8  = f8
-	nop.i 999
+      nop.m            0
+      fcvt.fx.s2       fXInt  = fNormX        // Convert to int in significand
+      nop.i            0
+}
 ;;
+
+{ .mfi
+      nop.m            0
+      fcvt.xf          f8 = fXInt             // Expected result
+      nop.i            0
 }
+;;
 
+// Be sure sign of result = sign of input.  Fixes cases where result is 0.
 { .mfb
-	nop.m 999
-      fcvt.xf         RINT_FLOAT_INT_f8   = RINT_INT_f8
-      br.cond.sptk  L(RINT_COMMON)
-;;
+      nop.m            0
+      fmerge.s         f8 = fNormX, f8
+      br.ret.sptk      b0                     // Exit main path
 }
+;;
 
-
-.endp rintl
-ASM_SIZE_DIRECTIVE(rintl)
-#ifdef _LIBC
-ASM_SIZE_DIRECTIVE(__rintl)
-#endif
+GLOBAL_IEEE754_END(rintl)
diff --git a/sysdeps/ia64/fpu/s_round.S b/sysdeps/ia64/fpu/s_round.S
index b08ede1740..ed5ffae205 100644
--- a/sysdeps/ia64/fpu/s_round.S
+++ b/sysdeps/ia64/fpu/s_round.S
@@ -1,11 +1,10 @@
 .file "round.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 10/25/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Tom Rowan, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,229 +20,214 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 10/25/2000: Created
+// 10/25/00 Initial version
+// 06/14/01 Changed cmp to an equivalent form
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance and reduced code size
+// 04/18/03 Eliminate possible WAW dependency warning
+// 09/03/03 Improved performance
 //==============================================================
-//
+
 // API
 //==============================================================
 // double round(double x)
-//
+//==============================================================
 
-#include "libm_support.h"
+// general input registers:
+// r14 - r18
 
-// general input registers:  
-//
-round_GR_half      = r14
-round_GR_big       = r15
-round_GR_expmask   = r16
-round_GR_signexp   = r17
-round_GR_exp       = r18
-round_GR_expdiff   = r19
-
-// predicate registers used: 
-// p6 - p10
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rExpHalf   = r18
 
-// floating-point registers used: 
+// floating-point registers:
+// f8 - f13
 
-ROUND_NORM_f8        = f9                        
-ROUND_TRUNC_f8       = f10
-ROUND_RINT_f8        = f11
-ROUND_FLOAT_TRUNC_f8 = f12
-ROUND_FLOAT_RINT_f8  = f13
-ROUND_REMAINDER      = f14
-ROUND_HALF           = f15
+fXtruncInt = f9
+fNormX     = f10
+fHalf      = f11
+fInc       = f12
+fRem       = f13
+
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // double round(double x)
-// Return an integer value (represented as a double) that is x 
-// rounded to nearest integer, halfway cases rounded away from 
-// zero. 
+// Return an integer value (represented as a double) that is x
+// rounded to nearest integer, halfway cases rounded away from
+// zero.
 //  if x>0   result = trunc(x+0.5)
 //  if x<0   result = trunc(x-0.5)
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
+//
+//==============================================================
 
-// If x is NAN, ZERO, INFINITY, or >= 2^52 then return
+// double_extended
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
+// we have a significand of 64 bits 1.63-bits.
+// If we multiply by 2^63, we no longer have a fractional part
+// So input is an integer value already.
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
+// double
+// if the exponent is >= 10033 => 34(true) = 52(decimal)
+// 34 + 3ff = 433
+// we have a significand of 53 bits 1.52-bits. (implicit 1)
+// If we multiply by 2^52, we no longer have a fractional part
+// So input is an integer value already.
 
+// single
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
+// So input is an integer value already.
 
-.align 32
-.global round#
 
 .section .text
-.proc  round#
-.align 32
-
+GLOBAL_LIBM_ENTRY(round)
 
-round: 
-	
-// Get exponent for +0.5
-// Truncate x to integer
 { .mfi
-      addl           round_GR_half  = 0x0fffe, r0
-      fcvt.fx.trunc.s1     ROUND_TRUNC_f8 = f8
-      nop.i 999
-}
-	
-// Get signexp of x
-// Normalize input
-// Form exponent mask
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fcvt.fx.trunc.s1 fXtruncInt  = f8      // Convert to int in significand
+      addl             rBigexp = 0x10033, r0 // Set exponent at which is integer
+}
 { .mfi
-      getf.exp  round_GR_signexp = f8
-      fnorm     ROUND_NORM_f8 = f8                        
-      addl      round_GR_expmask  = 0x1ffff, r0 ;;
+      mov              rExpHalf    = 0x0FFFE // Form sign and exponent of 0.5
+      fnorm.s1         fNormX  = f8          // Normalize input
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// Form +0.5
-// Round x to integer
 { .mfi
-      setf.exp    ROUND_HALF  = round_GR_half                      
-      fcvt.fx.s1  ROUND_RINT_f8 = f8
-      nop.i 999 ;;
+      setf.exp         fHalf = rExpHalf      // Form 0.5
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      nop.i            0
 }
-// Get exp of x
-// Test for NAN, INF, ZERO
-// Get exponent at which input has no fractional part
-{ .mfi
-      and         round_GR_exp = round_GR_expmask, round_GR_signexp
-      fclass.m    p8,p9 = f8,0xe7
-      addl        round_GR_big  = 0x10033, r0 ;;
+;;
+
+{ .mfb
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+(p7)  br.cond.spnt     ROUND_UNORM           // Branch if x unorm
 }
+;;
 
-// Get exp-bigexp
-// If exp is so big there is no fractional part, then turn on p8, off p9
-{ .mmi
-      sub    round_GR_expdiff = round_GR_exp, round_GR_big ;;
-#ifdef _LIBC
-(p9)  cmp.lt.or.andcm  p8,p9 = r0, round_GR_expdiff
-#else
-(p9)  cmp.ge.or.andcm  p8,p9 = round_GR_expdiff, r0
-#endif
-      nop.i 999 ;;
-}
-     
-// Set p6 if x<0, else set p7
-{ .mfi
-      nop.m 999
-(p9)  fcmp.lt.unc  p6,p7 = f8,f0
-      nop.i 999
+ROUND_COMMON:
+// Return here from ROUND_UNORM
+{ .mfb
+      nop.m            0
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test if x < 0
+(p6)  br.cond.spnt     ROUND_SPECIAL         // Exit if x natval, nan, inf
 }
-	
-// If NAN, INF, ZERO, or no fractional part, result is just normalized input
+;;
+
 { .mfi
-      nop.m 999
-(p8)  fnorm.d.s0  f8 = f8
-      nop.i 999 ;;
+      nop.m            0
+      fcvt.xf          f8 = fXtruncInt        // Pre-Result if 0.5 <= |x| < 2^52
+      nop.i            0
 }
+;;
 
-// Float the truncated integer
 { .mfi
-      nop.m 999
-(p9)  fcvt.xf     ROUND_FLOAT_TRUNC_f8 = ROUND_TRUNC_f8
-      nop.i 999 ;;
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+      fmerge.s         fInc = fNormX, f1      // Form increment if |rem| >= 0.5
+      nop.i            0
 }
+;;
 
-// Float the rounded integer to get preliminary result
-{ .mfi
-      nop.m 999
-(p9)  fcvt.xf     ROUND_FLOAT_RINT_f8 = ROUND_RINT_f8
-      nop.i 999 ;;
-}
-
-// If x<0 and the difference of the truncated input minus the input is 0.5
-//    then result = truncated input - 1.0
-// Else if x>0 and the difference of the input minus truncated input is 0.5
-//    then result = truncated input + 1.0
-// Else 
-//    result = rounded input
-// Endif
-{ .mfi
-      nop.m 999
-(p6)  fsub.s1   ROUND_REMAINDER = ROUND_FLOAT_TRUNC_f8, ROUND_NORM_f8 
-      nop.i 999
+{ .mmi
+      cmp.lt           p6,p0 = rExp, rExpHalf // Is |x| < 0.5?
+      cmp.ge           p7,p0 = rExp, rBigexp  // Is |x| >= 2^52?
+      cmp.lt           p10,p0 = rExp, rExpHalf // Is |x| < 0.5? 
 }
-	
+;;
+
+// We must correct result if |x| < 0.5, or |x| >= 2^52
+.pred.rel "mutex",p6,p7
 { .mfi
-      nop.m 999
-(p7)  fsub.s1   ROUND_REMAINDER = ROUND_NORM_f8, ROUND_FLOAT_TRUNC_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fmerge.s         f8 = fNormX, f0        // If |x| < 0.5, result sgn(x)*0
+      nop.i            0
 }
+{ .mfb
+(p7)  cmp.eq           p10,p0 = r0, r0        // Also turn on p10 if |x| >= 2^52
+(p7)  fma.d.s0         f8 = fNormX, f1, f0    // If |x| >= 2^52, result x
+(p10) br.ret.spnt      b0                     // Exit |x| < 0.5 or |x| >= 2^52
+}
+;;
 
-// Assume preliminary result is rounded integer
+// Here if 0.5 <= |x| < 2^52
 { .mfi
-      nop.m 999
-(p9)  fnorm.d.s0  f8 = ROUND_FLOAT_RINT_f8
-      nop.i 999 
+      nop.m            0
+(p9)  fms.s1           fRem = fNormX, f1, f8  // Get remainder = x - trunc(x)
+      nop.i            0
 }
-
-// If x<0, test if result=0
 { .mfi
-      nop.m 999
-(p6)  fcmp.eq.unc  p10,p0 = ROUND_FLOAT_RINT_f8,f0
-      nop.i 999 ;;
+      nop.m            0
+(p8)  fms.s1           fRem = f8, f1, fNormX  // Get remainder = trunc(x) - x
+      nop.i            0
 }
+;;
 
-// If x<0 and result=0, set result=-0
 { .mfi
-      nop.m 999
-(p10) fmerge.ns  f8 = f1,f8
-      nop.i 999
+      nop.m            0
+      fcmp.ge.s1       p9,p0 = fRem, fHalf    // Test |rem| >= 0.5
+      nop.i            0
 }
-	
-// If x<0, test if remainder=0.5
-{ .mfi
-      nop.m 999
-(p6)  fcmp.eq.unc  p6,p0 = ROUND_REMAINDER, ROUND_HALF
-      nop.i 999 ;; 
+;;
+
+// If x < 0 and remainder <= -0.5, then subtract 1 from result
+// If x > 0 and remainder >= +0.5, then add 1 to result
+{ .mfb
+      nop.m            0
+(p9)  fma.d.s0         f8 = f8, f1, fInc
+      br.ret.sptk      b0
 }
-	
-// If x>0, test if remainder=0.5
-{ .mfi
-      nop.m 999
-(p7)  fcmp.eq.unc  p7,p0 = ROUND_REMAINDER, ROUND_HALF
-      nop.i 999 ;;
+;;
+
+
+ROUND_SPECIAL:
+// Here if x natval, nan, inf
+{ .mfb
+      nop.m            0
+      fma.d.s0         f8 = f8, f1, f0
+      br.ret.sptk      b0
 }
+;;
 
-// If x<0 and remainder=0.5, result=truncated-1.0
-// If x>0 and remainder=0.5, result=truncated+1.0
-// Exit
-.pred.rel "mutex",p6,p7
+ROUND_UNORM:
+// Here if x unorm
 { .mfi
-      nop.m 999
-(p6)  fsub.d.s0  f8 = ROUND_FLOAT_TRUNC_f8,f1
-      nop.i 999 
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      nop.i            0
 }
-	
 { .mfb
-      nop.m 999
-(p7)  fadd.d.s0  f8 = ROUND_FLOAT_TRUNC_f8,f1
-      br.ret.sptk  b0 ;;
+      nop.m            0
+      fcvt.fx.trunc.s1 fXtruncInt  = fNormX   // Convert to int in significand
+      br.cond.sptk     ROUND_COMMON           // Return to main path
 }
+;;
 
-.endp round
-ASM_SIZE_DIRECTIVE(round)
+GLOBAL_LIBM_END(round)
diff --git a/sysdeps/ia64/fpu/s_roundf.S b/sysdeps/ia64/fpu/s_roundf.S
index 42ee60b218..7cec860aa1 100644
--- a/sysdeps/ia64/fpu/s_roundf.S
+++ b/sysdeps/ia64/fpu/s_roundf.S
@@ -1,11 +1,10 @@
 .file "roundf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 10/25/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Tom Rowan, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,229 +20,214 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 10/25/2000: Created
+// 10/25/00 Initial version
+// 06/14/01 Changed cmp to an equivalent form
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance and reduced code size
+// 04/18/03 Eliminate possible WAW dependency warning
+// 09/03/03 Improved performance
 //==============================================================
-//
+
 // API
 //==============================================================
 // float roundf(float x)
-//
+//==============================================================
 
-#include "libm_support.h"
+// general input registers:
+// r14 - r18
 
-// general input registers:  
-//
-roundf_GR_half      = r14
-roundf_GR_big       = r15
-roundf_GR_expmask   = r16
-roundf_GR_signexp   = r17
-roundf_GR_exp       = r18
-roundf_GR_expdiff   = r19
-
-// predicate registers used: 
-// p6 - p10
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rExpHalf   = r18
 
-// floating-point registers used: 
+// floating-point registers:
+// f8 - f13
 
-ROUNDF_NORM_f8        = f9                        
-ROUNDF_TRUNC_f8       = f10
-ROUNDF_RINT_f8        = f11
-ROUNDF_FLOAT_TRUNC_f8 = f12
-ROUNDF_FLOAT_RINT_f8  = f13
-ROUNDF_REMAINDER      = f14
-ROUNDF_HALF           = f15
+fXtruncInt = f9
+fNormX     = f10
+fHalf      = f11
+fInc       = f12
+fRem       = f13
+
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // float roundf(float x)
-// Return an integer value (represented as a float) that is x 
-// rounded to nearest integer, halfway cases rounded away from 
-// zero. 
+// Return an integer value (represented as a float) that is x
+// rounded to nearest integer, halfway cases rounded away from
+// zero.
 //  if x>0   result = trunc(x+0.5)
 //  if x<0   result = trunc(x-0.5)
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
+//
+//==============================================================
 
-// If x is NAN, ZERO, INFINITY, or >= 2^23 then return
+// double_extended
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
+// we have a significand of 64 bits 1.63-bits.
+// If we multiply by 2^63, we no longer have a fractional part
+// So input is an integer value already.
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
+// double
+// if the exponent is >= 10033 => 34(true) = 52(decimal)
+// 34 + 3ff = 433
+// we have a significand of 53 bits 1.52-bits. (implicit 1)
+// If we multiply by 2^52, we no longer have a fractional part
+// So input is an integer value already.
 
+// single
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
+// So input is an integer value already.
 
-.align 32
-.global roundf#
 
 .section .text
-.proc  roundf#
-.align 32
-
+GLOBAL_LIBM_ENTRY(roundf)
 
-roundf: 
-	
-// Get exponent for +0.5
-// Truncate x to integer
 { .mfi
-      addl           roundf_GR_half  = 0x0fffe, r0
-      fcvt.fx.trunc.s1     ROUNDF_TRUNC_f8 = f8
-      nop.i 999
-}
-	
-// Get signexp of x
-// Normalize input
-// Form exponent mask
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fcvt.fx.trunc.s1 fXtruncInt  = f8      // Convert to int in significand
+      addl             rBigexp = 0x10016, r0 // Set exponent at which is integer
+}
 { .mfi
-      getf.exp  roundf_GR_signexp = f8
-      fnorm     ROUNDF_NORM_f8 = f8                        
-      addl      roundf_GR_expmask  = 0x1ffff, r0 ;;
+      mov              rExpHalf    = 0x0FFFE // Form sign and exponent of 0.5
+      fnorm.s1         fNormX  = f8          // Normalize input
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// Form +0.5
-// Round x to integer
 { .mfi
-      setf.exp    ROUNDF_HALF  = roundf_GR_half                      
-      fcvt.fx.s1  ROUNDF_RINT_f8 = f8
-      nop.i 999 ;;
+      setf.exp         fHalf = rExpHalf      // Form 0.5
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      nop.i            0
 }
-// Get exp of x
-// Test for NAN, INF, ZERO
-// Get exponent at which input has no fractional part
-{ .mfi
-      and         roundf_GR_exp = roundf_GR_expmask, roundf_GR_signexp
-      fclass.m    p8,p9 = f8,0xe7
-      addl        roundf_GR_big  = 0x10016, r0 ;;
+;;
+
+{ .mfb
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+(p7)  br.cond.spnt     ROUND_UNORM           // Branch if x unorm
 }
+;;
 
-// Get exp-bigexp
-// If exp is so big there is no fractional part, then turn on p8, off p9
-{ .mmi
-      sub    roundf_GR_expdiff = roundf_GR_exp, roundf_GR_big ;;
-#ifdef _LIBC
-(p9)  cmp.lt.or.andcm  p8,p9 = r0, roundf_GR_expdiff
-#else
-(p9)  cmp.ge.or.andcm  p8,p9 = roundf_GR_expdiff, r0
-#endif
-      nop.i 999 ;;
-}
-     
-// Set p6 if x<0, else set p7
-{ .mfi
-      nop.m 999
-(p9)  fcmp.lt.unc  p6,p7 = f8,f0
-      nop.i 999
+ROUND_COMMON:
+// Return here from ROUND_UNORM
+{ .mfb
+      nop.m            0
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test if x < 0
+(p6)  br.cond.spnt     ROUND_SPECIAL         // Exit if x natval, nan, inf
 }
-	
-// If NAN, INF, ZERO, or no fractional part, result is just normalized input
+;;
+
 { .mfi
-      nop.m 999
-(p8)  fnorm.s.s0  f8 = f8
-      nop.i 999 ;;
+      nop.m            0
+      fcvt.xf          f8 = fXtruncInt        // Pre-Result if 0.5 <= |x| < 2^23
+      nop.i            0
 }
+;;
 
-// Float the truncated integer
 { .mfi
-      nop.m 999
-(p9)  fcvt.xf     ROUNDF_FLOAT_TRUNC_f8 = ROUNDF_TRUNC_f8
-      nop.i 999 ;;
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+      fmerge.s         fInc = fNormX, f1      // Form increment if |rem| >= 0.5
+      nop.i            0
 }
+;;
 
-// Float the rounded integer to get preliminary result
-{ .mfi
-      nop.m 999
-(p9)  fcvt.xf     ROUNDF_FLOAT_RINT_f8 = ROUNDF_RINT_f8
-      nop.i 999 ;;
-}
-
-// If x<0 and the difference of the truncated input minus the input is 0.5
-//    then result = truncated input - 1.0
-// Else if x>0 and the difference of the input minus truncated input is 0.5
-//    then result = truncated input + 1.0
-// Else 
-//    result = rounded input
-// Endif
-{ .mfi
-      nop.m 999
-(p6)  fsub.s1   ROUNDF_REMAINDER = ROUNDF_FLOAT_TRUNC_f8, ROUNDF_NORM_f8 
-      nop.i 999
+{ .mmi
+      cmp.lt           p6,p0 = rExp, rExpHalf // Is |x| < 0.5?
+      cmp.ge           p7,p0 = rExp, rBigexp  // Is |x| >= 2^23?
+      cmp.lt           p10,p0 = rExp, rExpHalf // Is |x| < 0.5? 
 }
-	
+;;
+
+// We must correct result if |x| < 0.5, or |x| >= 2^23
+.pred.rel "mutex",p6,p7
 { .mfi
-      nop.m 999
-(p7)  fsub.s1   ROUNDF_REMAINDER = ROUNDF_NORM_f8, ROUNDF_FLOAT_TRUNC_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fmerge.s         f8 = fNormX, f0        // If |x| < 0.5, result sgn(x)*0
+      nop.i            0
 }
+{ .mfb
+(p7)  cmp.eq           p10,p0 = r0, r0        // Also turn on p10 if |x| >= 2^23
+(p7)  fma.s.s0         f8 = fNormX, f1, f0    // If |x| >= 2^23, result x
+(p10) br.ret.spnt      b0                     // Exit |x| < 0.5 or |x| >= 2^23
+}
+;;
 
-// Assume preliminary result is rounded integer
+// Here if 0.5 <= |x| < 2^23
 { .mfi
-      nop.m 999
-(p9)  fnorm.s.s0  f8 = ROUNDF_FLOAT_RINT_f8
-      nop.i 999
+      nop.m            0
+(p9)  fms.s1           fRem = fNormX, f1, f8  // Get remainder = x - trunc(x)
+      nop.i            0
 }
-
-// If x<0, test if result=0
 { .mfi
-      nop.m 999
-(p6)  fcmp.eq.unc  p10,p0 = ROUNDF_FLOAT_RINT_f8,f0
-      nop.i 999 ;;
+      nop.m            0
+(p8)  fms.s1           fRem = f8, f1, fNormX  // Get remainder = trunc(x) - x
+      nop.i            0
 }
+;;
 
-// If x<0 and result=0, set result=-0
 { .mfi
-      nop.m 999
-(p10) fmerge.ns  f8 = f1,f8
-      nop.i 999
+      nop.m            0
+      fcmp.ge.s1       p9,p0 = fRem, fHalf    // Test |rem| >= 0.5
+      nop.i            0
 }
-	
-// If x<0, test if remainder=0.5
-{ .mfi
-      nop.m 999
-(p6)  fcmp.eq.unc  p6,p0 = ROUNDF_REMAINDER, ROUNDF_HALF
-      nop.i 999 ;;
+;;
+
+// If x < 0 and remainder <= -0.5, then subtract 1 from result
+// If x > 0 and remainder >= +0.5, then add 1 to result
+{ .mfb
+      nop.m            0
+(p9)  fma.s.s0         f8 = f8, f1, fInc
+      br.ret.sptk      b0
 }
-	
-// If x>0, test if remainder=0.5
-{ .mfi
-      nop.m 999
-(p7)  fcmp.eq.unc  p7,p0 = ROUNDF_REMAINDER, ROUNDF_HALF
-      nop.i 999 ;;
+;;
+
+
+ROUND_SPECIAL:
+// Here if x natval, nan, inf
+{ .mfb
+      nop.m            0
+      fma.s.s0         f8 = f8, f1, f0
+      br.ret.sptk      b0
 }
+;;
 
-// If x<0 and remainder=0.5, result=truncated-1.0
-// If x>0 and remainder=0.5, result=truncated+1.0
-// Exit
-.pred.rel "mutex",p6,p7
+ROUND_UNORM:
+// Here if x unorm
 { .mfi
-      nop.m 999
-(p6)  fsub.s.s0  f8 = ROUNDF_FLOAT_TRUNC_f8,f1
-      nop.i 999 
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      nop.i            0
 }
-	
 { .mfb
-      nop.m 999
-(p7)  fadd.s.s0  f8 = ROUNDF_FLOAT_TRUNC_f8,f1
-      br.ret.sptk  b0 ;;
+      nop.m            0
+      fcvt.fx.trunc.s1 fXtruncInt  = fNormX   // Convert to int in significand
+      br.cond.sptk     ROUND_COMMON           // Return to main path
 }
+;;
 
-.endp roundf
-ASM_SIZE_DIRECTIVE(roundf)
+GLOBAL_LIBM_END(roundf)
diff --git a/sysdeps/ia64/fpu/s_roundl.S b/sysdeps/ia64/fpu/s_roundl.S
index b30f590917..da6cbfe228 100644
--- a/sysdeps/ia64/fpu/s_roundl.S
+++ b/sysdeps/ia64/fpu/s_roundl.S
@@ -1,11 +1,10 @@
 .file "roundl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 10/25/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Tom Rowan, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,229 +20,214 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 10/25/2000: Created
+// 10/25/00 Initial version
+// 06/14/01 Changed cmp to an equivalent form
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance and reduced code size
+// 04/18/03 Eliminate possible WAW dependency warning
+// 09/03/03 Improved performance
 //==============================================================
-//
+
 // API
 //==============================================================
 // long double roundl(long double x)
-//
+//==============================================================
 
-#include "libm_support.h"
+// general input registers:
+// r14 - r18
 
-// general input registers:  
-//
-roundl_GR_half      = r14
-roundl_GR_big       = r15
-roundl_GR_expmask   = r16
-roundl_GR_signexp   = r17
-roundl_GR_exp       = r18
-roundl_GR_expdiff   = r19
-
-// predicate registers used: 
-// p6 - p10
+rSignexp   = r14
+rExp       = r15
+rExpMask   = r16
+rBigexp    = r17
+rExpHalf   = r18
 
-// floating-point registers used: 
+// floating-point registers:
+// f8 - f13
 
-ROUNDL_NORM_f8        = f9                        
-ROUNDL_TRUNC_f8       = f10
-ROUNDL_RINT_f8        = f11
-ROUNDL_FLOAT_TRUNC_f8 = f12
-ROUNDL_FLOAT_RINT_f8  = f13
-ROUNDL_REMAINDER      = f14
-ROUNDL_HALF           = f15
+fXtruncInt = f9
+fNormX     = f10
+fHalf      = f11
+fInc       = f12
+fRem       = f13
+
+// predicate registers used:
+// p6 - p10
 
 // Overview of operation
 //==============================================================
-
 // long double roundl(long double x)
-// Return an integer value (represented as a long double) that is x 
-// rounded to nearest integer, halfway cases rounded away from 
-// zero. 
+// Return an integer value (represented as a long double) that is x
+// rounded to nearest integer, halfway cases rounded away from
+// zero.
 //  if x>0   result = trunc(x+0.5)
 //  if x<0   result = trunc(x-0.5)
-// *******************************************************************************
-
-// Set denormal flag for denormal input and
-// and take denormal fault if necessary.
+//
+//==============================================================
 
-// If x is NAN, ZERO, INFINITY, or >= 2^63 then return
+// double_extended
+// if the exponent is > 1003e => 3F(true) = 63(decimal)
+// we have a significand of 64 bits 1.63-bits.
+// If we multiply by 2^63, we no longer have a fractional part
+// So input is an integer value already.
 
-// qnan snan inf norm     unorm 0 -+
-// 1    1    1   0        0     1 11     0xe7
+// double
+// if the exponent is >= 10033 => 34(true) = 52(decimal)
+// 34 + 3ff = 433
+// we have a significand of 53 bits 1.52-bits. (implicit 1)
+// If we multiply by 2^52, we no longer have a fractional part
+// So input is an integer value already.
 
+// single
+// if the exponent is > 10016 => 17(true) = 23(decimal)
+// we have a significand of 24 bits 1.23-bits. (implicit 1)
+// If we multiply by 2^23, we no longer have a fractional part
+// So input is an integer value already.
 
-.align 32
-.global roundl#
 
 .section .text
-.proc  roundl#
-.align 32
-
+GLOBAL_LIBM_ENTRY(roundl)
 
-roundl: 
-	
-// Get exponent for +0.5
-// Truncate x to integer
 { .mfi
-      addl           roundl_GR_half  = 0x0fffe, r0
-      fcvt.fx.trunc.s1     ROUNDL_TRUNC_f8 = f8
-      nop.i 999
-}
-	
-// Get signexp of x
-// Normalize input
-// Form exponent mask
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fcvt.fx.trunc.s1 fXtruncInt  = f8      // Convert to int in significand
+      addl             rBigexp = 0x1003e, r0 // Set exponent at which is integer
+}
 { .mfi
-      getf.exp  roundl_GR_signexp = f8
-      fnorm     ROUNDL_NORM_f8 = f8                        
-      addl      roundl_GR_expmask  = 0x1ffff, r0 ;;
+      mov              rExpHalf    = 0x0FFFE // Form sign and exponent of 0.5
+      fnorm.s1         fNormX  = f8          // Normalize input
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
 }
+;;
 
-// Form +0.5
-// Round x to integer
 { .mfi
-      setf.exp    ROUNDL_HALF  = roundl_GR_half                      
-      fcvt.fx.s1  ROUNDL_RINT_f8 = f8
-      nop.i 999 ;;
+      setf.exp         fHalf = rExpHalf      // Form 0.5
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
+      nop.i            0
 }
-// Get exp of x
-// Test for NAN, INF, ZERO
-// Get exponent at which input has no fractional part
-{ .mfi
-      and         roundl_GR_exp = roundl_GR_expmask, roundl_GR_signexp
-      fclass.m    p8,p9 = f8,0xe7
-      addl        roundl_GR_big  = 0x1003e, r0 ;;
+;;
+
+{ .mfb
+      nop.m            0
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+(p7)  br.cond.spnt     ROUND_UNORM           // Branch if x unorm
 }
+;;
 
-// Get exp-bigexp
-// If exp is so big there is no fractional part, then turn on p8, off p9
-{ .mmi
-      sub    roundl_GR_expdiff = roundl_GR_exp, roundl_GR_big ;;
-#ifdef _LIBC
-(p9)  cmp.lt.or.andcm  p8,p9 = r0, roundl_GR_expdiff
-#else
-(p9)  cmp.ge.or.andcm  p8,p9 = roundl_GR_expdiff, r0
-#endif
-      nop.i 999 ;;
-}
-     
-// Set p6 if x<0, else set p7
-{ .mfi
-      nop.m 999
-(p9)  fcmp.lt.unc  p6,p7 = f8,f0
-      nop.i 999
+ROUND_COMMON:
+// Return here from ROUND_UNORM
+{ .mfb
+      nop.m            0
+      fcmp.lt.s1       p8,p9 = f8, f0        // Test if x < 0
+(p6)  br.cond.spnt     ROUND_SPECIAL         // Exit if x natval, nan, inf
 }
-	
-// If NAN, INF, ZERO, or no fractional part, result is just normalized input
+;;
+
 { .mfi
-      nop.m 999
-(p8)  fnorm.s0  f8 = f8
-      nop.i 999 ;;
+      nop.m            0
+      fcvt.xf          f8 = fXtruncInt        // Pre-Result if 0.5 <= |x| < 2^63
+      nop.i            0
 }
+;;
 
-// Float the truncated integer
 { .mfi
-      nop.m 999
-(p9)  fcvt.xf     ROUNDL_FLOAT_TRUNC_f8 = ROUNDL_TRUNC_f8
-      nop.i 999 ;;
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+      fmerge.s         fInc = fNormX, f1      // Form increment if |rem| >= 0.5
+      nop.i            0
 }
+;;
 
-// Float the rounded integer to get preliminary result
-{ .mfi
-      nop.m 999
-(p9)  fcvt.xf     ROUNDL_FLOAT_RINT_f8 = ROUNDL_RINT_f8
-      nop.i 999 ;;
-}
-
-// If x<0 and the difference of the truncated input minus the input is 0.5
-//    then result = truncated input - 1.0
-// Else if x>0 and the difference of the input minus truncated input is 0.5
-//    then result = truncated input + 1.0
-// Else 
-//    result = rounded input
-// Endif
-{ .mfi
-      nop.m 999
-(p6)  fsub.s1   ROUNDL_REMAINDER = ROUNDL_FLOAT_TRUNC_f8, ROUNDL_NORM_f8 
-      nop.i 999
+{ .mmi
+      cmp.lt           p6,p0 = rExp, rExpHalf // Is |x| < 0.5?
+      cmp.ge           p7,p0 = rExp, rBigexp  // Is |x| >= 2^63?
+      cmp.lt           p10,p0 = rExp, rExpHalf // Is |x| < 0.5? 
 }
-	
+;;
+
+// We must correct result if |x| < 0.5, or |x| >= 2^63
+.pred.rel "mutex",p6,p7
 { .mfi
-      nop.m 999
-(p7)  fsub.s1   ROUNDL_REMAINDER = ROUNDL_NORM_f8, ROUNDL_FLOAT_TRUNC_f8
-      nop.i 999 ;;
+      nop.m            0
+(p6)  fmerge.s         f8 = fNormX, f0        // If |x| < 0.5, result sgn(x)*0
+      nop.i            0
 }
+{ .mfb
+(p7)  cmp.eq           p10,p0 = r0, r0        // Also turn on p10 if |x| >= 2^63
+(p7)  fma.s0           f8 = fNormX, f1, f0    // If |x| >= 2^63, result x
+(p10) br.ret.spnt      b0                     // Exit |x| < 0.5 or |x| >= 2^63
+}
+;;
 
-// Assume preliminary result is rounded integer
+// Here if 0.5 <= |x| < 2^63
 { .mfi
-      nop.m 999
-(p9)  fnorm.s0  f8 = ROUNDL_FLOAT_RINT_f8
-      nop.i 999
+      nop.m            0
+(p9)  fms.s1           fRem = fNormX, f1, f8  // Get remainder = x - trunc(x)
+      nop.i            0
 }
-
-// If x<0, test if result=0
 { .mfi
-      nop.m 999
-(p6)  fcmp.eq.unc  p10,p0 = ROUNDL_FLOAT_RINT_f8,f0
-      nop.i 999 ;;
+      nop.m            0
+(p8)  fms.s1           fRem = f8, f1, fNormX  // Get remainder = trunc(x) - x
+      nop.i            0
 }
+;;
 
-// If x<0 and result=0, set result=-0
 { .mfi
-      nop.m 999
-(p10) fmerge.ns  f8 = f1,f8
-      nop.i 999
+      nop.m            0
+      fcmp.ge.s1       p9,p0 = fRem, fHalf    // Test |rem| >= 0.5
+      nop.i            0
 }
-	
-// If x<0, test if remainder=0.5
-{ .mfi
-      nop.m 999
-(p6)  fcmp.eq.unc  p6,p0 = ROUNDL_REMAINDER, ROUNDL_HALF
-      nop.i 999 ;;
+;;
+
+// If x < 0 and remainder <= -0.5, then subtract 1 from result
+// If x > 0 and remainder >= +0.5, then add 1 to result
+{ .mfb
+      nop.m            0
+(p9)  fma.s0           f8 = f8, f1, fInc
+      br.ret.sptk      b0
 }
-	
-// If x>0, test if remainder=0.5
-{ .mfi
-      nop.m 999
-(p7)  fcmp.eq.unc  p7,p0 = ROUNDL_REMAINDER, ROUNDL_HALF
-      nop.i 999 ;;
+;;
+
+
+ROUND_SPECIAL:
+// Here if x natval, nan, inf
+{ .mfb
+      nop.m            0
+      fma.s0           f8 = f8, f1, f0
+      br.ret.sptk      b0
 }
+;;
 
-// If x<0 and remainder=0.5, result=truncated-1.0
-// If x>0 and remainder=0.5, result=truncated+1.0
-// Exit
-.pred.rel "mutex",p6,p7
+ROUND_UNORM:
+// Here if x unorm
 { .mfi
-      nop.m 999
-(p6)  fsub.s0  f8 = ROUNDL_FLOAT_TRUNC_f8,f1
-      nop.i 999 
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      nop.i            0
 }
-	
 { .mfb
-      nop.m 999
-(p7)  fadd.s0  f8 = ROUNDL_FLOAT_TRUNC_f8,f1
-      br.ret.sptk  b0 ;;
+      nop.m            0
+      fcvt.fx.trunc.s1 fXtruncInt  = fNormX   // Convert to int in significand
+      br.cond.sptk     ROUND_COMMON           // Return to main path
 }
+;;
 
-.endp roundl
-ASM_SIZE_DIRECTIVE(roundl)
+GLOBAL_LIBM_END(roundl)
diff --git a/sysdeps/ia64/fpu/s_scalblnf.c b/sysdeps/ia64/fpu/s_scalblnf.c
new file mode 100644
index 0000000000..2fa51ba11b
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_scalblnf.c
@@ -0,0 +1,61 @@
+/* file: scalblnf.c */
+
+
+// Copyright (c) 2000, 2001, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+#include "libm_support.h"
+
+float __libm_scalblnf(float, long int, int);
+
+
+float scalblnf(float x, long int n)
+{
+
+#ifdef SIZE_LONG_INT_64 
+   return __libm_scalblnf(x,n,1);  
+#else
+
+#ifdef SIZE_LONG_INT_32 
+   return __libm_scalblnf(x,n,0);
+#endif
+
+#endif
+
+}
diff --git a/sysdeps/ia64/fpu/s_scalbn.S b/sysdeps/ia64/fpu/s_scalbn.S
deleted file mode 100644
index 50d14b4e30..0000000000
--- a/sysdeps/ia64/fpu/s_scalbn.S
+++ /dev/null
@@ -1,379 +0,0 @@
-.file "scalbn.s"
-
-// Copyright (C) 2000, 2001, Intel Corporation
-// All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * The name of Intel Corporation may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
-//
-// History
-//==============================================================
-// 2/02/00  Initial version
-// 1/26/01  Scalbn completely reworked and now standalone version 
-//
-// API
-//==============================================================
-// double = scalbn  (double x, int n) 
-// input  floating point f8 and int n (r33) 
-// output floating point f8
-//
-// Returns x* 2**n using an fma and detects overflow
-// and underflow.   
-//
-//
-
-#include "libm_support.h"
-
-FR_Big         = f6
-FR_NBig        = f7
-FR_Floating_X  = f8
-FR_Result      = f8
-FR_Result2     = f9
-FR_Result3     = f11
-FR_Norm_X      = f12
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-
-GR_N_Biased    = r15
-GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
-GR_Bias        = r20
-GR_N_as_int    = r21
-
-GR_SAVE_B0          = r32
-GR_SAVE_GP          = r33
-GR_SAVE_PFS         = r34
-GR_Parameter_X      = r35
-GR_Parameter_Y      = r36
-GR_Parameter_RESULT = r37
-GR_Tag              = r38
-
-.align 32
-.global scalbn
-
-.section .text
-.proc  scalbn
-.align 32
-
-scalbn: 
-
-//
-//   Is x NAN, INF, ZERO, +-?
-//   Build the exponent Bias
-//
-{    .mfi
-     alloc         r32=ar.pfs,1,2,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl          GR_Bias = 0x0FFFF,r0
-}
-
-//
-//   Sign extend input
-//   Is N zero?
-//   Normalize x
-//
-{    .mfi
-     cmp.eq.unc    p6,p0 = r33,r0  
-     fnorm.s1      FR_Norm_X  =   FR_Floating_X 
-     sxt4          GR_N_as_int = r33
-}
-;;
-
-//
-//   Normalize x
-//   Branch and return special values.
-//   Create -35000
-//   Create 35000
-//
-{    .mfi
-     addl          GR_Big = 35000,r0
-     nop.f         0
-     add           GR_N_Biased = GR_Bias,GR_N_as_int
-}
-{    .mfb
-     addl          GR_NBig = -35000,r0
-(p7) fma.d.s0      FR_Result = FR_Floating_X,f1, f0 
-(p7) br.ret.spnt   b0  
-};;
-
-//
-//   Build the exponent Bias
-//   Return x when N = 0
-//
-{    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.f         0
-     addl          GR_Scratch1  = 0x063BF,r0 
-}
-{    .mfb
-     addl          GR_Scratch  = 0x019C3F,r0 
-(p6) fma.d.s0      FR_Result = FR_Floating_X,f1, f0 
-(p6) br.ret.spnt   b0  
-};;
-
-//
-//   Create 2*big
-//   Create 2**-big 
-//   Is N > 35000     
-//   Is N < -35000     
-//   Raise Denormal operand flag with compare
-//   Main path, create 2**N
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.f         0
-     cmp.ge.unc    p6, p0 = GR_N_as_int, GR_Big
-}
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch                  
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     cmp.le.unc    p8, p0 = GR_N_as_int, GR_NBig
-};;
-
-//
-//   Adjust 2**N if N was very small or very large
-//
-{    .mfi
-     nop.m 0
-(p6) fma.s1        FR_Two_N = FR_Big,f1,f0
-     nop.i 0
-}
-{ .mlx
-     nop.m 999
-(p0) movl          GR_Scratch = 0x00000000000303FF 
-};;
-
-
-{    .mfi
-     nop.m 0
-(p8) fma.s1        FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
-}
-{    .mlx
-     nop.m 999
-(p0) movl          GR_Scratch1= 0x00000000000103FF 
-};;
-
-//   Set up necessary status fields 
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflows)
-//   S3 user supplied status + FZ + TD   (Underflows)
-//
-{    .mfi
-     nop.m 999
-(p0) fsetc.s3      0x7F,0x41
-     nop.i 999
-}
-{    .mfi
-     nop.m 999
-(p0) fsetc.s2      0x7F,0x42
-     nop.i 999
-};;
-
-//
-//   Do final operation
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch
-     fma.d.s0      FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-}
-{    .mfi
-     nop.m         999
-     fma.d.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch1
-     fma.d.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-
-//   Check for overflow or underflow.
-//   Restore s3
-//   Restore s2
-//
-{    .mfi
-     nop.m 0
-     fsetc.s3      0x7F,0x40
-     nop.i 999 
-}
-{    .mfi
-     nop.m 0
-     fsetc.s2      0x7F,0x40
-     nop.i 999
-};;
-
-//
-//   Is the result zero?
-//
-{    .mfi
-     nop.m 999
-     fclass.m.unc  p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
-{    .mfi
-     addl          GR_Tag = 176, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
-
-//
-//   Detect masked underflow - Tiny + Inexact Only
-//
-{    .mfi
-     nop.m 999
-(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
-
-//
-//   Is result bigger the allowed range?
-//   Branch out for underflow
-//
-{    .mfb
-(p6) addl           GR_Tag = 177, r0
-(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt   L(SCALBN_UNDERFLOW) 
-};;
-
-//
-//   Branch out for overflow
-//
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt   L(SCALBN_OVERFLOW) 
-(p9) br.cond.spnt   L(SCALBN_OVERFLOW) 
-};;
-
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
-}
-
-.endp scalbn
-ASM_SIZE_DIRECTIVE(scalbn)
-.proc __libm_error_region
-__libm_error_region:
-
-L(SCALBN_OVERFLOW): 
-L(SCALBN_UNDERFLOW): 
-
-//
-// Get stack address of N
-//
-.prologue
-{ .mfi
-    add   GR_Parameter_Y=-32,sp         
-    nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
-}
-//
-// Adjust sp 
-//
-{ .mfi
-.fframe 64
-   add sp=-64,sp                         
-   nop.f 0
-   mov GR_SAVE_GP=gp       
-};;
-
-//
-//  Store N on stack in correct position 
-//  Locate the address of x on stack
-//
-{ .mmi
-   st8 [GR_Parameter_Y] =  GR_N_as_int,16       
-   add GR_Parameter_X = 16,sp          
-.save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
-};;
-
-//
-// Store x on the stack.
-// Get address for result on stack.
-//
-.body
-{ .mib
-   stfd [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
-   nop.b 0
-}
-{ .mib
-   stfd [GR_Parameter_Y] = FR_Result                 
-   add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
-};;
-
-//
-//  Get location of result on stack
-//
-{ .mmi
-   nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
-};;
-
-//
-//  Get the new result 
-//
-{ .mmi
-   ldfd  FR_Result = [GR_Parameter_RESULT]      
-.restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
-};;
-
-//
-//  Restore gp, ar.pfs and return
-//
-{ .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
-};;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(scalbn)
-
-.type   __libm_error_support#,@function
-.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_scalbn.c b/sysdeps/ia64/fpu/s_scalbn.c
new file mode 100644
index 0000000000..1f57141310
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_scalbn.c
@@ -0,0 +1,61 @@
+/* file: scalbn.c */
+
+
+// Copyright (c) 2000, 2001, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+#include "libm_support.h"
+
+double __libm_scalbn(double, int, int);
+
+
+double scalbn(double x, int n)
+{
+
+#ifdef SIZE_INT_64 
+   return __libm_scalbn(x,n,1);  
+#else
+
+#ifdef SIZE_INT_32 
+   return __libm_scalbn(x,n,0);
+#endif
+
+#endif
+
+}
diff --git a/sysdeps/ia64/fpu/s_scalbnf.S b/sysdeps/ia64/fpu/s_scalbnf.S
deleted file mode 100644
index ff7d1ca637..0000000000
--- a/sysdeps/ia64/fpu/s_scalbnf.S
+++ /dev/null
@@ -1,379 +0,0 @@
-//.file "scalbnf.s"
-
-// Copyright (C) 2000, 2001, Intel Corporation
-// All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * The name of Intel Corporation may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
-//
-// History
-//==============================================================
-// 2/02/00  Initial version
-// 1/26/01  scalbnf completely reworked and now standalone version 
-//
-// API
-//==============================================================
-// float = scalbnf  (float x, int n) 
-// input  floating point f8 and int n (r33) 
-// output floating point f8
-//
-// Returns x* 2**n using an fma and detects overflow
-// and underflow.   
-//
-//
-
-#include "libm_support.h"
-
-FR_Big         = f6
-FR_NBig        = f7
-FR_Floating_X  = f8
-FR_Result      = f8
-FR_Result2     = f9
-FR_Result3     = f11
-FR_Norm_X      = f12
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-
-GR_N_Biased    = r15
-GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
-GR_Bias        = r20
-GR_N_as_int    = r21
-
-GR_SAVE_B0          = r32
-GR_SAVE_GP          = r33
-GR_SAVE_PFS         = r34
-GR_Parameter_X      = r35
-GR_Parameter_Y      = r36
-GR_Parameter_RESULT = r37
-GR_Tag              = r38
-
-.align 32
-.global scalbnf
-
-.section .text
-.proc  scalbnf
-.align 32
-
-scalbnf: 
-
-//
-//   Is x NAN, INF, ZERO, +-?
-//   Build the exponent Bias
-//
-{    .mfi
-     alloc         r32=ar.pfs,1,2,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl          GR_Bias = 0x0FFFF,r0
-}
-
-//
-//   Sign extend input
-//   Is N zero?
-//   Normalize x
-//
-{    .mfi
-     cmp.eq.unc    p6,p0 = r33,r0  
-     fnorm.s1      FR_Norm_X  =   FR_Floating_X 
-     sxt4          GR_N_as_int = r33
-}
-;;
-
-//
-//   Normalize x
-//   Branch and return special values.
-//   Create -35000
-//   Create 35000
-//
-{    .mfi
-     addl          GR_Big = 35000,r0
-     nop.f         0
-     add           GR_N_Biased = GR_Bias,GR_N_as_int
-}
-{    .mfb
-     addl          GR_NBig = -35000,r0
-(p7) fma.s.s0      FR_Result = FR_Floating_X,f1, f0 
-(p7) br.ret.spnt   b0  
-};;
-
-//
-//   Build the exponent Bias
-//   Return x when N = 0
-//
-{    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.f         0
-     addl          GR_Scratch1  = 0x063BF,r0 
-}
-{    .mfb
-     addl          GR_Scratch  = 0x019C3F,r0 
-(p6) fma.s.s0      FR_Result = FR_Floating_X,f1, f0 
-(p6) br.ret.spnt   b0  
-};;
-
-//
-//   Create 2*big
-//   Create 2**-big 
-//   Is N > 35000     
-//   Is N < -35000     
-//   Raise Denormal operand flag with compare
-//   Main path, create 2**N
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.f         0
-     cmp.ge.unc    p6, p0 = GR_N_as_int, GR_Big
-}
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch                  
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     cmp.le.unc    p8, p0 = GR_N_as_int, GR_NBig
-};;
-
-//
-//   Adjust 2**N if N was very small or very large
-//
-{    .mfi
-     nop.m 0
-(p6) fma.s1        FR_Two_N = FR_Big,f1,f0
-     nop.i 0
-}
-{ .mlx
-     nop.m 999
-(p0) movl          GR_Scratch = 0x000000000003007F 
-};;
-
-
-{    .mfi
-     nop.m 0
-(p8) fma.s1        FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
-}
-{    .mlx
-     nop.m 999
-(p0) movl          GR_Scratch1= 0x000000000001007F 
-};;
-
-//   Set up necessary status fields 
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflows)
-//   S3 user supplied status + FZ + TD   (Underflows)
-//
-{    .mfi
-     nop.m 999
-(p0) fsetc.s3      0x7F,0x41
-     nop.i 999
-}
-{    .mfi
-     nop.m 999
-(p0) fsetc.s2      0x7F,0x42
-     nop.i 999
-};;
-
-//
-//   Do final operation
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch
-     fma.s.s0      FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-}
-{    .mfi
-     nop.m         999
-     fma.s.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch1
-     fma.s.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-
-//   Check for overflow or underflow.
-//   Restore s3
-//   Restore s2
-//
-{    .mfi
-     nop.m 0
-     fsetc.s3      0x7F,0x40
-     nop.i 999 
-}
-{    .mfi
-     nop.m 0
-     fsetc.s2      0x7F,0x40
-     nop.i 999
-};;
-
-//
-//   Is the result zero?
-//
-{    .mfi
-     nop.m 999
-     fclass.m.unc  p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
-{    .mfi
-     addl          GR_Tag = 178, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
-
-//
-//   Detect masked underflow - Tiny + Inexact Only
-//
-{    .mfi
-     nop.m 999
-(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
-
-//
-//   Is result bigger the allowed range?
-//   Branch out for underflow
-//
-{    .mfb
-(p6) addl           GR_Tag = 179, r0
-(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt   L(scalbnf_UNDERFLOW) 
-};;
-
-//
-//   Branch out for overflow
-//
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt   L(scalbnf_OVERFLOW) 
-(p9) br.cond.spnt   L(scalbnf_OVERFLOW) 
-};;
-
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
-}
-
-.endp scalbnf
-ASM_SIZE_DIRECTIVE(scalbnf)
-.proc __libm_error_region
-__libm_error_region:
-
-L(scalbnf_OVERFLOW): 
-L(scalbnf_UNDERFLOW): 
-
-//
-// Get stack address of N
-//
-.prologue
-{ .mfi
-    add   GR_Parameter_Y=-32,sp         
-    nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
-}
-//
-// Adjust sp 
-//
-{ .mfi
-.fframe 64
-   add sp=-64,sp                         
-   nop.f 0
-   mov GR_SAVE_GP=gp       
-};;
-
-//
-//  Store N on stack in correct position 
-//  Locate the address of x on stack
-//
-{ .mmi
-   st8 [GR_Parameter_Y] =  GR_N_as_int,16       
-   add GR_Parameter_X = 16,sp          
-.save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
-};;
-
-//
-// Store x on the stack.
-// Get address for result on stack.
-//
-.body
-{ .mib
-   stfs [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
-   nop.b 0
-}
-{ .mib
-   stfs [GR_Parameter_Y] = FR_Result                 
-   add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
-};;
-
-//
-//  Get location of result on stack
-//
-{ .mmi
-   nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
-};;
-
-//
-//  Get the new result 
-//
-{ .mmi
-   ldfs  FR_Result = [GR_Parameter_RESULT]      
-.restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
-};;
-
-//
-//  Restore gp, ar.pfs and return
-//
-{ .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
-};;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.type   __libm_error_support#,@function
-.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_scalbnf.c b/sysdeps/ia64/fpu/s_scalbnf.c
new file mode 100644
index 0000000000..97c06da08a
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_scalbnf.c
@@ -0,0 +1,61 @@
+/* file: scalbnf.c */
+
+
+// Copyright (c) 2000, 2001, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+#include "libm_support.h"
+
+float __libm_scalbnf(float, int, int);
+
+
+float scalbnf(float x, int n)
+{
+
+#ifdef SIZE_INT_64 
+   return __libm_scalbnf(x,n,1);  
+#else
+
+#ifdef SIZE_INT_32 
+   return __libm_scalbnf(x,n,0);
+#endif
+
+#endif
+
+}
diff --git a/sysdeps/ia64/fpu/s_scalbnl.S b/sysdeps/ia64/fpu/s_scalbnl.S
deleted file mode 100644
index 9e54a2ec0a..0000000000
--- a/sysdeps/ia64/fpu/s_scalbnl.S
+++ /dev/null
@@ -1,379 +0,0 @@
-//.file "scalbnl.s"
-
-// Copyright (C) 2000, 2001, Intel Corporation
-// All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// * Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// * The name of Intel Corporation may not be used to endorse or promote
-// products derived from this software without specific prior written
-// permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
-// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
-// Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
-//
-// History
-//==============================================================
-// 2/02/00  Initial version
-// 1/26/01  scalbnl completely reworked and now standalone version 
-//
-// API
-//==============================================================
-// double-extended = scalbnl  (double-extended x, int n) 
-// input  floating point f8 and int n (r34) 
-// output floating point f8
-//
-// Returns x* 2**n using an fma and detects overflow
-// and underflow.   
-//
-//
-
-#include "libm_support.h"
-
-FR_Big         = f6
-FR_NBig        = f7
-FR_Floating_X  = f8
-FR_Result      = f8
-FR_Result2     = f9
-FR_Result3     = f11
-FR_Norm_X      = f12
-FR_Two_N       = f14
-FR_Two_to_Big  = f15
-
-GR_N_Biased    = r15
-GR_Big         = r16
-GR_NBig        = r17
-GR_Scratch     = r18
-GR_Scratch1    = r19
-GR_Bias        = r20
-GR_N_as_int    = r21
-
-GR_SAVE_B0          = r32
-GR_SAVE_GP          = r33
-GR_SAVE_PFS         = r34
-GR_Parameter_X      = r35
-GR_Parameter_Y      = r36
-GR_Parameter_RESULT = r37
-GR_Tag              = r38
-
-.align 32
-.global scalbnl
-
-.section .text
-.proc  scalbnl
-.align 32
-
-scalbnl: 
-
-//
-//   Is x NAN, INF, ZERO, +-?
-//   Build the exponent Bias
-//
-{    .mfi
-     alloc         r32=ar.pfs,2,1,4,0
-     fclass.m.unc  p7,p0 = FR_Floating_X, 0xe7 //@snan | @qnan | @inf | @zero
-     addl          GR_Bias = 0x0FFFF,r0
-}
-
-//
-//   Sign extend input
-//   Is N zero?
-//   Normalize x
-//
-{    .mfi
-     cmp.eq.unc    p6,p0 = r34,r0  
-     fnorm.s1      FR_Norm_X  =   FR_Floating_X 
-     sxt4          GR_N_as_int = r34
-}
-;;
-
-//
-//   Normalize x
-//   Branch and return special values.
-//   Create -35000
-//   Create 35000
-//
-{    .mfi
-     addl          GR_Big = 35000,r0
-     nop.f         0
-     add           GR_N_Biased = GR_Bias,GR_N_as_int
-}
-{    .mfb
-     addl          GR_NBig = -35000,r0
-(p7) fma.s0        FR_Result = FR_Floating_X,f1, f0 
-(p7) br.ret.spnt   b0  
-};;
-
-//
-//   Build the exponent Bias
-//   Return x when N = 0
-//
-{    .mfi
-     setf.exp      FR_Two_N = GR_N_Biased                   
-     nop.f         0
-     addl          GR_Scratch1  = 0x063BF,r0 
-}
-{    .mfb
-     addl          GR_Scratch  = 0x019C3F,r0 
-(p6) fma.s0        FR_Result = FR_Floating_X,f1, f0 
-(p6) br.ret.spnt   b0  
-};;
-
-//
-//   Create 2*big
-//   Create 2**-big 
-//   Is N > 35000     
-//   Is N < -35000     
-//   Raise Denormal operand flag with compare
-//   Main path, create 2**N
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch1                  
-     nop.f         0
-     cmp.ge.unc    p6, p0 = GR_N_as_int, GR_Big
-}
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch                  
-     fcmp.ge.s0    p0,p11 = FR_Floating_X,f0
-     cmp.le.unc    p8, p0 = GR_N_as_int, GR_NBig
-};;
-
-//
-//   Adjust 2**N if N was very small or very large
-//
-{    .mfi
-     nop.m 0
-(p6) fma.s1        FR_Two_N = FR_Big,f1,f0
-     nop.i 0
-}
-{ .mlx
-     nop.m 999
-(p0) movl          GR_Scratch = 0x0000000000033FFF 
-};;
-
-
-{    .mfi
-     nop.m 0
-(p8) fma.s1        FR_Two_N = FR_NBig,f1,f0
-     nop.i 0
-}
-{    .mlx
-     nop.m 999
-(p0) movl          GR_Scratch1= 0x0000000000013FFF 
-};;
-
-//   Set up necessary status fields 
-//
-//   S0 user supplied status
-//   S2 user supplied status + WRE + TD  (Overflows)
-//   S3 user supplied status + FZ + TD   (Underflows)
-//
-{    .mfi
-     nop.m 999
-(p0) fsetc.s3      0x7F,0x41
-     nop.i 999
-}
-{    .mfi
-     nop.m 999
-(p0) fsetc.s2      0x7F,0x42
-     nop.i 999
-};;
-
-//
-//   Do final operation
-//
-{    .mfi
-     setf.exp      FR_NBig = GR_Scratch
-     fma.s0      FR_Result = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-}
-{    .mfi
-     nop.m         999
-     fma.s3      FR_Result3 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-{    .mfi
-     setf.exp      FR_Big = GR_Scratch1
-     fma.s2      FR_Result2 = FR_Two_N,FR_Norm_X,f0 
-     nop.i         999
-};;
-
-//   Check for overflow or underflow.
-//   Restore s3
-//   Restore s2
-//
-{    .mfi
-     nop.m 0
-     fsetc.s3      0x7F,0x40
-     nop.i 999 
-}
-{    .mfi
-     nop.m 0
-     fsetc.s2      0x7F,0x40
-     nop.i 999
-};;
-
-//
-//   Is the result zero?
-//
-{    .mfi
-     nop.m 999
-     fclass.m.unc  p6, p0 =  FR_Result3, 0x007
-     nop.i 999 
-} 
-{    .mfi
-     addl          GR_Tag = 174, r0
-     fcmp.ge.unc.s1 p7, p8 = FR_Result2 , FR_Big
-     nop.i 0
-};;
-
-//
-//   Detect masked underflow - Tiny + Inexact Only
-//
-{    .mfi
-     nop.m 999
-(p6) fcmp.neq.unc.s1 p6, p0 = FR_Result , FR_Result2
-     nop.i 999 
-};; 
-
-//
-//   Is result bigger the allowed range?
-//   Branch out for underflow
-//
-{    .mfb
-(p6) addl           GR_Tag = 175, r0
-(p8) fcmp.le.unc.s1 p9, p10 = FR_Result2 , FR_NBig
-(p6) br.cond.spnt   L(scalbnl_UNDERFLOW) 
-};;
-
-//
-//   Branch out for overflow
-//
-{ .mbb
-     nop.m 0
-(p7) br.cond.spnt   L(scalbnl_OVERFLOW) 
-(p9) br.cond.spnt   L(scalbnl_OVERFLOW) 
-};;
-
-//
-//   Return from main path.
-//
-{    .mfb
-     nop.m 999
-     nop.f 0
-     br.ret.sptk     b0;;                   
-}
-
-.endp scalbnl
-ASM_SIZE_DIRECTIVE(scalbnl)
-.proc __libm_error_region
-__libm_error_region:
-
-L(scalbnl_OVERFLOW): 
-L(scalbnl_UNDERFLOW): 
-
-//
-// Get stack address of N
-//
-.prologue
-{ .mfi
-    add   GR_Parameter_Y=-32,sp         
-    nop.f 0
-.save   ar.pfs,GR_SAVE_PFS
-    mov  GR_SAVE_PFS=ar.pfs              
-}
-//
-// Adjust sp 
-//
-{ .mfi
-.fframe 64
-   add sp=-64,sp                         
-   nop.f 0
-   mov GR_SAVE_GP=gp       
-};;
-
-//
-//  Store N on stack in correct position 
-//  Locate the address of x on stack
-//
-{ .mmi
-   st8 [GR_Parameter_Y] =  GR_N_as_int,16       
-   add GR_Parameter_X = 16,sp          
-.save   b0, GR_SAVE_B0
-   mov GR_SAVE_B0=b0                  
-};;
-
-//
-// Store x on the stack.
-// Get address for result on stack.
-//
-.body
-{ .mib
-   stfe [GR_Parameter_X] = FR_Norm_X 
-   add   GR_Parameter_RESULT = 0,GR_Parameter_Y   
-   nop.b 0
-}
-{ .mib
-   stfe [GR_Parameter_Y] = FR_Result                 
-   add   GR_Parameter_Y = -16,GR_Parameter_Y
-   br.call.sptk b0=__libm_error_support#   
-};;
-
-//
-//  Get location of result on stack
-//
-{ .mmi
-   nop.m 0
-   nop.m 0
-   add   GR_Parameter_RESULT = 48,sp    
-};;
-
-//
-//  Get the new result 
-//
-{ .mmi
-   ldfe  FR_Result = [GR_Parameter_RESULT]      
-.restore sp
-   add   sp = 64,sp                       
-   mov   b0 = GR_SAVE_B0                  
-};;
-
-//
-//  Restore gp, ar.pfs and return
-//
-{ .mib
-   mov   gp = GR_SAVE_GP                  
-   mov   ar.pfs = GR_SAVE_PFS             
-   br.ret.sptk     b0                  
-};;
-
-.endp __libm_error_region
-ASM_SIZE_DIRECTIVE(__libm_error_region)
-
-.type   __libm_error_support#,@function
-.global __libm_error_support#
diff --git a/sysdeps/ia64/fpu/s_scalbnl.c b/sysdeps/ia64/fpu/s_scalbnl.c
new file mode 100644
index 0000000000..d7a81dfc55
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_scalbnl.c
@@ -0,0 +1,61 @@
+/* file: scalbnl.c */
+
+
+// Copyright (c) 2000, 2001, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+#include "libm_support.h"
+
+long double __libm_scalbnl(long double, int, int);
+
+
+long double scalbnl(long double x, int n)
+{
+
+#ifdef SIZE_INT_64 
+   return __libm_scalbnl(x,n,1);  
+#else
+
+#ifdef SIZE_INT_32 
+   return __libm_scalbnl(x,n,0);
+#endif
+
+#endif
+
+}
diff --git a/sysdeps/ia64/fpu/s_significand.S b/sysdeps/ia64/fpu/s_significand.S
index 84141daf4d..720e043e5c 100644
--- a/sysdeps/ia64/fpu/s_significand.S
+++ b/sysdeps/ia64/fpu/s_significand.S
@@ -1,10 +1,10 @@
 .file "significand.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,13 +35,15 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 4/04/00  Unwind support added
-// 5/31/00: Fixed bug when x a double-extended denormal
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
+// 05/31/00 Fixed bug when x a double-extended denormal
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
@@ -56,18 +58,10 @@
 // p6, p7
 //
 // floating-point registers used:  
-// f8, f9, f10
-
-#include "libm_support.h"
-
-.align 32
-.global significand#
+// f8, f9, f10 
 
 .section .text
-.proc  significand#
-.align 32
-
-significand: 
+GLOBAL_LIBM_ENTRY(significand)
 
 // qnan snan inf norm     unorm 0 -+
 // 1    1    1   0        0     1 11
@@ -75,19 +69,19 @@ significand:
 // f10 gets f8(sign) with f1(exp,significand)
 { .mfi
       nop.m 999
-(p0)  fmerge.s       f10 = f8,f1               
+      fmerge.s       f10 = f8,f1               
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p0)  fnorm          f9  = f8                  
+      fnorm.s0          f9  = f8                  
       nop.i 999 ;;
 }
 
 // Test for denormal input
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p7,p0 = f8, 0x0b
+      fclass.m.unc   p7,p0 = f8, 0x0b
       nop.i 999 ;;
 }
 
@@ -97,14 +91,14 @@ significand:
 //               return sign(f8) exp(f8) significand(f8), normalized.
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p0,p6 = f8, 0xe7          
+      fclass.m.unc   p0,p6 = f8, 0xe7          
       nop.i 999 ;;
 }
 
 { .mmb
       nop.m 999
       nop.m 999
-(p7)  br.cond.spnt L(SIGNIFICAND_DENORM) ;; // Branch if x denormal
+(p7)  br.cond.spnt SIGNIFICAND_DENORM ;; // Branch if x denormal
 }
 
 { .mfi
@@ -115,29 +109,29 @@ significand:
 
 { .mfb
       nop.m 999
-(p0)  fnorm.d        f8 = f8                   
-(p0)  br.ret.sptk    b0 ;;
+      fnorm.d.s0        f8 = f8                   
+      br.ret.sptk    b0 ;;
 }
 
-L(SIGNIFICAND_DENORM):
+SIGNIFICAND_DENORM:
 // Here if x denorm
 { .mfi
       nop.m 999
-(p0)  fmerge.se      f8 = f10,f9
+      fmerge.se      f8 = f10,f9
       nop.i 999 ;;
 }
 
 // Check if fnorm(x) still denormal, means x double-extended denormal
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p7,p0 = f9, 0x0b
+      fclass.m.unc   p7,p0 = f9, 0x0b
       nop.i 999 ;;
 }
 
 // This will be the final result unless x double-extended denormal
 { .mfi
       nop.m 999
-(p0)  fnorm.d        f8 = f8
+      fnorm.d.s0        f8 = f8
       nop.i 999 ;;
 }
 
@@ -152,9 +146,8 @@ L(SIGNIFICAND_DENORM):
 // Final normalization if x double-extended denorm
 { .mfb
       nop.m 999
-(p7)  fnorm.d        f8 = f8
-(p0)  br.ret.sptk    b0 ;;
+(p7)  fnorm.d.s0        f8 = f8
+      br.ret.sptk    b0 ;;
 }
 
-.endp significand
-ASM_SIZE_DIRECTIVE(significand)
+GLOBAL_LIBM_END(significand)
diff --git a/sysdeps/ia64/fpu/s_significandf.S b/sysdeps/ia64/fpu/s_significandf.S
index d8cdc159f6..5c8299b944 100644
--- a/sysdeps/ia64/fpu/s_significandf.S
+++ b/sysdeps/ia64/fpu/s_significandf.S
@@ -1,10 +1,10 @@
 .file "significandf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,13 +35,15 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 2/03/00: Modified to improve speed
-// 5/31/00: Fixed bug when x a double-extended denormal
+// 02/02/00 Initial version
+// 02/03/00 Modified to improve speed
+// 05/31/00 Fixed bug when x a double-extended denormal
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
@@ -55,18 +57,10 @@
 // p6, p7
 //
 // floating-point registers used:  
-// f8, f9, f10
-
-#include "libm_support.h"
-
-.align 32
-.global significandf#
+// f8, f9, f10 
 
 .section .text
-.proc  significandf#
-.align 32
-
-significandf: 
+GLOBAL_LIBM_ENTRY(significandf)
 
 // qnan snan inf norm     unorm 0 -+
 // 1    1    1   0        0     1 11
@@ -74,19 +68,19 @@ significandf:
 // f10 gets f8(sign) with f1(exp,significand)
 { .mfi
       nop.m 999
-(p0)  fmerge.s       f10 = f8,f1               
+      fmerge.s       f10 = f8,f1               
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p0)  fnorm          f9  = f8                  
+      fnorm.s0          f9  = f8                  
       nop.i 999 ;;
 }
 
 // Test for denormal input
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p7,p0 = f8, 0x0b
+      fclass.m.unc   p7,p0 = f8, 0x0b
       nop.i 999 ;;
 }
 
@@ -96,14 +90,14 @@ significandf:
 //               return sign(f8) exp(f8) significand(f8), normalized.
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p0,p6 = f8, 0xe7          
+      fclass.m.unc   p0,p6 = f8, 0xe7          
       nop.i 999 ;;
 }
 
 { .mmb
       nop.m 999
       nop.m 999
-(p7)  br.cond.spnt L(SIGNIFICAND_DENORM) ;; // Branch if x denormal
+(p7)  br.cond.spnt SIGNIFICAND_DENORM ;; // Branch if x denormal
 }
 
 { .mfi
@@ -114,29 +108,29 @@ significandf:
 
 { .mfb
       nop.m 999
-(p0)  fnorm.s        f8 = f8
-(p0)  br.ret.sptk    b0 ;;
+      fnorm.s.s0        f8 = f8
+      br.ret.sptk    b0 ;;
 }
 
-L(SIGNIFICAND_DENORM):
+SIGNIFICAND_DENORM:
 // Here if x denorm
 { .mfi
       nop.m 999
-(p0)  fmerge.se      f8 = f10,f9
+      fmerge.se      f8 = f10,f9
       nop.i 999 ;;
 }
 
 // Check if fnorm(x) still denormal, means x double-extended denormal
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p7,p0 = f9, 0x0b
+      fclass.m.unc   p7,p0 = f9, 0x0b
       nop.i 999 ;;
 }
 
 // This will be the final result unless x double-extended denormal
 { .mfi
       nop.m 999
-(p0)  fnorm.s        f8 = f8
+      fnorm.s.s0        f8 = f8
       nop.i 999 ;;
 }
 
@@ -151,9 +145,8 @@ L(SIGNIFICAND_DENORM):
 // Final normalization if x double-extended denorm
 { .mfb
       nop.m 999
-(p7)  fnorm.s        f8 = f8
-(p0)  br.ret.sptk    b0 ;;
+(p7)  fnorm.s.s0        f8 = f8
+      br.ret.sptk    b0 ;;
 }
 
-.endp significandf
-ASM_SIZE_DIRECTIVE(significandf)
+GLOBAL_LIBM_END(significandf)
diff --git a/sysdeps/ia64/fpu/s_significandl.S b/sysdeps/ia64/fpu/s_significandl.S
index 268d3567d0..f62df4310c 100644
--- a/sysdeps/ia64/fpu/s_significandl.S
+++ b/sysdeps/ia64/fpu/s_significandl.S
@@ -1,10 +1,10 @@
 .file "significandl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,13 +35,15 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 2/03/00: Modified to improve speed
-// 5/31/00: Fixed bug when x a double-extended denormal
+// 02/02/00 Initial version
+// 02/03/00 Modified to improve speed
+// 05/31/00 Fixed bug when x a double-extended denormal
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
@@ -56,18 +58,10 @@
 // p6, p7
 //
 // floating-point registers used:  
-// f8, f9, f10
-
-#include "libm_support.h"
-
-.align 32
-.global significandl#
+// f8, f9, f10 
 
 .section .text
-.proc  significandl#
-.align 32
-
-significandl: 
+GLOBAL_LIBM_ENTRY(significandl)
 
 // qnan snan inf norm     unorm 0 -+
 // 1    1    1   0        0     1 11
@@ -75,19 +69,19 @@ significandl:
 // f10 gets f8(sign) with f1(exp,significand)
 { .mfi
       nop.m 999
-(p0)  fmerge.s       f10 = f8,f1               
+      fmerge.s       f10 = f8,f1               
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p0)  fnorm          f9  = f8                  
+      fnorm.s0          f9  = f8                  
       nop.i 999 ;;
 }
 
 // Test for denormal input
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p7,p0 = f8, 0x0b
+      fclass.m.unc   p7,p0 = f8, 0x0b
       nop.i 999 ;;
 }
           
@@ -97,14 +91,14 @@ significandl:
 //               return sign(f8) exp(f8) significand(f8), normalized.
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p0,p6 = f8, 0xe7          
+      fclass.m.unc   p0,p6 = f8, 0xe7          
       nop.i 999 ;;
 }
 
 { .mmb
       nop.m 999
       nop.m 999
-(p7)  br.cond.spnt L(SIGNIFICAND_DENORM) ;; // Branch if x denormal
+(p7)  br.cond.spnt SIGNIFICAND_DENORM ;; // Branch if x denormal
 }
 
 { .mfi
@@ -115,29 +109,29 @@ significandl:
 
 { .mfb
       nop.m 999
-(p0)  fnorm          f8 = f8
-(p0)  br.ret.sptk    b0 ;;
+      fnorm.s0          f8 = f8
+      br.ret.sptk    b0 ;;
 }
 
-L(SIGNIFICAND_DENORM):
+SIGNIFICAND_DENORM:
 // Here if x denorm
 { .mfi
       nop.m 999
-(p0)  fmerge.se      f8 = f10,f9
+      fmerge.se      f8 = f10,f9
       nop.i 999 ;;
 }
 
 // Check if fnorm(x) still denormal, means x double-extended denormal
 { .mfi
       nop.m 999
-(p0)  fclass.m.unc   p7,p0 = f9, 0x0b
+      fclass.m.unc   p7,p0 = f9, 0x0b
       nop.i 999 ;;
 }
 
 // This will be the final result unless x double-extended denormal
 { .mfi
       nop.m 999
-(p0)  fnorm          f8 = f8                   
+      fnorm.s0          f8 = f8                   
       nop.i 999 ;;
 }
 
@@ -152,9 +146,8 @@ L(SIGNIFICAND_DENORM):
 // Final normalization if x double-extended denorm
 { .mfb
       nop.m 999
-(p7)  fnorm          f8 = f8                   
-(p0)  br.ret.sptk    b0 ;;
+(p7)  fnorm.s0          f8 = f8                   
+      br.ret.sptk    b0 ;;
 }
 
-.endp significandl
-ASM_SIZE_DIRECTIVE(significandl)
+GLOBAL_LIBM_END(significandl)
diff --git a/sysdeps/ia64/fpu/s_sincos.c b/sysdeps/ia64/fpu/s_sincos.c
index 1ddbc2122a..41254ae60a 100644
--- a/sysdeps/ia64/fpu/s_sincos.c
+++ b/sysdeps/ia64/fpu/s_sincos.c
@@ -1,9 +1 @@
-#include <math.h>
-
-void
-__sincos (double x, double *s, double *c)
-{
-  *s = sin (x);
-  *c = cos (x);
-}
-weak_alias (__sincos, sincos)
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/s_sincosf.c b/sysdeps/ia64/fpu/s_sincosf.c
index efd0fe3038..41254ae60a 100644
--- a/sysdeps/ia64/fpu/s_sincosf.c
+++ b/sysdeps/ia64/fpu/s_sincosf.c
@@ -1,9 +1 @@
-#include <math.h>
-
-void
-__sincosf (float x, float *s, float *c)
-{
-  *s = sinf (x);
-  *c = cosf (x);
-}
-weak_alias (__sincosf, sincosf)
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/s_sincosl.c b/sysdeps/ia64/fpu/s_sincosl.c
index a835b772e2..41254ae60a 100644
--- a/sysdeps/ia64/fpu/s_sincosl.c
+++ b/sysdeps/ia64/fpu/s_sincosl.c
@@ -1,9 +1 @@
-#include <math.h>
-
-void
-__sincosl (long double x, long double *s, long double *c)
-{
-  *s = sinl (x);
-  *c = cosl (x);
-}
-weak_alias (__sincosl, sincosl)
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/s_tan.S b/sysdeps/ia64/fpu/s_tan.S
index 3a497fcf4c..a2f80c8858 100644
--- a/sysdeps/ia64/fpu/s_tan.S
+++ b/sysdeps/ia64/fpu/s_tan.S
@@ -1,10 +1,10 @@
-.file "tan.s"
+.file "tancot.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,20 +32,24 @@
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+//
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 4/04/00  Unwind support added
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
 // 12/27/00 Improved speed
+// 02/21/01 Updated to call tanl
+// 05/30/02 Added cot
+// 02/10/03 Reordered header: .section, .global, .proc, .align
 //
 // API
 //==============================================================
-// double tan( double x);
+// double tan(double x);
+// double cot(double x);
 //
 // Overview of operation
 //==============================================================
@@ -61,11 +65,14 @@
 //     Nfloat = round_int(tan_W)
 //
 //     tan_r  = x - Nfloat * (pi/2)_hi
-//     tan_r  = tan_r - Nfloat * (pi/2)_lo
+//  a) tan_r  = tan_r - Nfloat * (pi/2)_lo (for tan)
+//  b) tan_r  = Nfloat * (pi/2)_lo - tan_r (for cot)
 //
 // We have two paths: p8, when Nfloat is even and p9. when Nfloat is odd.
-// p8: tan(X) =  tan(r)
-// p9: tan(X) = -cot(r)
+//  a) for tan:  p8: tan(X) =  tan(r)
+//               p9: tan(X) = -cot(r)
+//  b) for cot:  p9: cot(X) =  cot(r)
+//               p8: cot(X) = -tan(r)
 //
 // Each is evaluated as a series. The p9 path requires 1/r.
 //
@@ -75,19 +82,16 @@
 // Registers used
 //==============================================================
 //
-// predicate registers used:  
-// p6-10
+// predicate registers used:
+// p6-12
 //
-// floating-point registers used:  
-// f10-15, f32-105
+// floating-point registers used:
+// f10-15, f32-106
 // f8, input
 //
 // general registers used
-// r14-18, r32-43
+// r14-26, r32-39
 //
-
-#include "libm_support.h"
-
 // Assembly macros
 //==============================================================
 TAN_INV_PI_BY_2_2TO64        = f10
@@ -105,28 +109,28 @@ tan_Pi_by_2_lo               = f34
 tan_P0                       = f35
 tan_P1                       = f36
 tan_P2                       = f37
-tan_P3                       = f38 
-tan_P4                       = f39 
-tan_P5                       = f40 
+tan_P3                       = f38
+tan_P4                       = f39
+tan_P5                       = f40
 tan_P6                       = f41
 tan_P7                       = f42
-tan_P8                       = f43 
-tan_P9                       = f44 
-tan_P10                      = f45 
+tan_P8                       = f43
+tan_P9                       = f44
+tan_P10                      = f45
 tan_P11                      = f46
-tan_P12                      = f47 
+tan_P12                      = f47
 tan_P13                      = f48
 tan_P14                      = f49
 tan_P15                      = f50
 
-tan_Q0                       = f51 
-tan_Q1                       = f52 
-tan_Q2                       = f53 
-tan_Q3                       = f54 
-tan_Q4                       = f55 
-tan_Q5                       = f56 
-tan_Q6                       = f57 
-tan_Q7                       = f58 
+tan_Q0                       = f51
+tan_Q1                       = f52
+tan_Q2                       = f53
+tan_Q3                       = f54
+tan_Q4                       = f55
+tan_Q5                       = f56
+tan_Q6                       = f57
+tan_Q7                       = f58
 tan_Q8                       = f59
 tan_Q9                       = f60
 tan_Q10                      = f61
@@ -153,19 +157,19 @@ tan_v10                      = f79
 tan_v2                       = f80
 tan_v9                       = f81
 tan_v1                       = f82
-tan_int_Nfloat               = f83 
-tan_Nfloat                   = f84 
+tan_int_Nfloat               = f83
+tan_Nfloat                   = f84
 
-tan_NORM_f8                  = f85 
+tan_NORM_f8                  = f85
 tan_W                        = f86
 
 tan_y0                       = f87
-tan_d                        = f88 
-tan_y1                       = f89 
-tan_dsq                      = f90 
-tan_y2                       = f91 
-tan_d4                       = f92 
-tan_inv_r                    = f93 
+tan_d                        = f88
+tan_y1                       = f89
+tan_dsq                      = f90
+tan_y2                       = f91
+tan_d4                       = f92
+tan_inv_r                    = f93
 
 tan_z1                       = f94
 tan_z2                       = f95
@@ -180,6 +184,7 @@ tan_z10                      = f103
 tan_z11                      = f104
 tan_z12                      = f105
 
+arg_copy                     = f106
 
 /////////////////////////////////////////////////////////////
 
@@ -188,37 +193,33 @@ tan_GR_rshf_2to64            = r15
 tan_GR_exp_2tom64            = r16
 tan_GR_n                     = r17
 tan_GR_rshf                  = r18
-
-tan_AD                       = r33
-tan_GR_10009                 = r34 
-tan_GR_17_ones               = r35 
-tan_GR_N_odd_even            = r36 
-tan_GR_N                     = r37 
-tan_signexp                  = r38
-tan_exp                      = r39
-tan_ADQ                      = r40
-
-GR_SAVE_PFS                  = r41 
-GR_SAVE_B0                   = r42       
-GR_SAVE_GP                   = r43      
-
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+tan_AD                       = r19
+tan_GR_10009                 = r20
+tan_GR_17_ones               = r21
+tan_GR_N_odd_even            = r22
+tan_GR_N                     = r23
+tan_signexp                  = r24
+tan_exp                      = r25
+tan_ADQ                      = r26
+
+GR_SAVE_B0                   = r33
+GR_SAVE_PFS                  = r34
+GR_SAVE_GP                   = r35
+GR_Parameter_X               = r36
+GR_Parameter_Y               = r37
+GR_Parameter_RESULT          = r38
+GR_Parameter_Tag             = r39
+
+
+RODATA
 
 .align 16
 
-double_tan_constants:
-ASM_TYPE_DIRECTIVE(double_tan_constants,@object)
-//   data8 0xA2F9836E4E44152A, 0x00003FFE // 2/pi
+LOCAL_OBJECT_START(double_tan_constants)
    data8 0xC90FDAA22168C234, 0x00003FFF // pi/2 hi
-
-   data8 0xBEEA54580DDEA0E1 // P14 
+   data8 0xBEEA54580DDEA0E1 // P14
    data8 0x3ED3021ACE749A59 // P15
-   data8 0xBEF312BD91DC8DA1 // P12 
+   data8 0xBEF312BD91DC8DA1 // P12
    data8 0x3EFAE9AFC14C5119 // P13
    data8 0x3F2F342BF411E769 // P8
    data8 0x3F1A60FC9F3B0227 // P9
@@ -232,10 +233,9 @@ ASM_TYPE_DIRECTIVE(double_tan_constants,@object)
    data8 0x3FC11111111111C2 // P1
    data8 0x3FABA1BA1BA0E850 // P2
    data8 0x3F9664F4886725A7 // P3
-ASM_SIZE_DIRECTIVE(double_tan_constants)
+LOCAL_OBJECT_END(double_tan_constants)
 
-double_Q_tan_constants:
-ASM_TYPE_DIRECTIVE(double_Q_tan_constants,@object)
+LOCAL_OBJECT_START(double_Q_tan_constants)
    data8 0xC4C6628B80DC1CD1, 0x00003FBF // pi/2 lo
    data8 0x3E223A73BA576E48 // Q8
    data8 0x3DF54AD8D1F2CA43 // Q9
@@ -248,35 +248,19 @@ ASM_TYPE_DIRECTIVE(double_Q_tan_constants,@object)
    data8 0x3F61566ABBFFB489 // Q2
    data8 0x3F2BBD77945C1733 // Q3
    data8 0x3D927FB33E2B0E04 // Q10
-ASM_SIZE_DIRECTIVE(double_Q_tan_constants)
+LOCAL_OBJECT_END(double_Q_tan_constants)
 
 
-   
-.align 32
-.global tan#
-#ifdef _LIBC
-.global __tan#
-#endif
+.section .text
 
 ////////////////////////////////////////////////////////
 
-
-
-.section .text
-.proc  tan#
-#ifdef _LIBC
-.proc  __tan#
-#endif
-.align 32
-tan: 
-#ifdef _LIBC
-__tan: 
-#endif
+LOCAL_LIBM_ENTRY(cot)
 // The initial fnorm will take any unmasked faults and
 // normalize any single/double unorms
 
 { .mlx
-      alloc          r32=ar.pfs,1,11,0,0               
+      cmp.eq    p12, p11 = r0, r0 // set p12=1, p11=0 for cot
       movl tan_GR_sig_inv_pi_by_2 = 0xA2F9836E4E44152A // significand of 2/pi
 }
 { .mlx
@@ -285,18 +269,48 @@ __tan:
 }
 ;;
 
-{ .mfi
-      ld8 tan_AD = [tan_AD]
-      fnorm     tan_NORM_f8  = f8                      
+{ .mlx
       mov tan_GR_exp_2tom64 = 0xffff-64 // exponent of scaling factor 2^-64
+      movl tan_GR_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift
 }
+{ .mfb
+      ld8 tan_AD = [tan_AD]
+      fnorm.s0  tan_NORM_f8  = f8
+      br.cond.sptk COMMON_PATH
+}
+;;
+
+LOCAL_LIBM_END(cot)
+
+
+GLOBAL_IEEE754_ENTRY(tan)
+// The initial fnorm will take any unmasked faults and
+// normalize any single/double unorms
+
 { .mlx
-      nop.m 999
+      cmp.eq    p11, p12 = r0, r0 // set p11=1, p12=0 for tan
+      movl tan_GR_sig_inv_pi_by_2 = 0xA2F9836E4E44152A // significand of 2/pi
+}
+{ .mlx
+      addl           tan_AD   = @ltoff(double_tan_constants), gp
+      movl tan_GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+63+1)
+}
+;;
+
+{ .mlx
+      mov tan_GR_exp_2tom64 = 0xffff-64 // exponent of scaling factor 2^-64
       movl tan_GR_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift
 }
+{ .mfi
+      ld8 tan_AD = [tan_AD]
+      fnorm.s0  tan_NORM_f8  = f8
+      nop.i     0
+}
 ;;
 
 
+// Common path for both tan and cot
+COMMON_PATH:
 // Form two constants we need
 //   2/pi * 2^1 * 2^63, scaled by 2^64 since we just loaded the significand
 //   1.1000...000 * 2^(63+63+1) to right shift int(W) into the significand
@@ -313,7 +327,7 @@ __tan:
 { .mmf
       setf.exp TAN_2TOM64 = tan_GR_exp_2tom64
       adds tan_ADQ = double_Q_tan_constants - double_tan_constants, tan_AD
-      fclass.m.unc  p6,p0 = f8, 0x07  // Test for x=0
+(p11) fclass.m.unc  p6,p0 = f8, 0x07  // Test for x=0 (tan)
 }
 ;;
 
@@ -323,79 +337,79 @@ __tan:
 //   1.1000...000 * 2^63, the right shift constant
 { .mmf
       setf.d TAN_RSHF = tan_GR_rshf
-      ldfe      tan_Pi_by_2_hi = [tan_AD],16 
+      ldfe      tan_Pi_by_2_hi = [tan_AD],16
       fclass.m.unc  p7,p0 = f8, 0x23  // Test for x=inf
 }
 ;;
 
 { .mfb
-      ldfe      tan_Pi_by_2_lo = [tan_ADQ],16           
+      ldfe      tan_Pi_by_2_lo = [tan_ADQ],16
       fclass.m.unc  p8,p0 = f8, 0xc3  // Test for x=nan
-(p6)  br.ret.spnt    b0    ;;         // Exit for x=0
+(p6)  br.ret.spnt    b0    ;;         // Exit for x=0 (tan only)
 }
 
 { .mfi
-      ldfpd     tan_P14,tan_P15 = [tan_AD],16                         
+      ldfpd     tan_P14,tan_P15 = [tan_AD],16
 (p7)  frcpa.s0  f8,p9=f0,f0           // Set qnan indef if x=inf
       mov       tan_GR_10009 = 0x10009
 }
 { .mib
-      ldfpd      tan_Q8,tan_Q9  = [tan_ADQ],16                        
+      ldfpd      tan_Q8,tan_Q9  = [tan_ADQ],16
       nop.i 999
 (p7)  br.ret.spnt    b0    ;;         // Exit for x=inf
 }
 
 { .mfi
-      ldfpd      tan_P12,tan_P13 = [tan_AD],16                         
-(p8)  fma.d f8=f8,f1,f8               // Set qnan if x=nan
+      ldfpd      tan_P12,tan_P13 = [tan_AD],16
+(p12) fclass.m.unc  p6,p0 = f8, 0x07  // Test for x=0 (cot)
       nop.i 999
 }
-{ .mib
-      ldfpd      tan_Q4,tan_Q5  = [tan_ADQ],16                        
-      nop.i 999
+{ .mfb
+      ldfpd      tan_Q4,tan_Q5  = [tan_ADQ],16
+(p8)  fma.d.s0   f8=f8,f1,f8          // Set qnan if x=nan
 (p8)  br.ret.spnt    b0    ;;         // Exit for x=nan
 }
 
-{ .mmi
-      getf.exp  tan_signexp    = tan_NORM_f8                 
-      ldfpd      tan_P8,tan_P9  = [tan_AD],16                         
-      nop.i 999 ;;
+{ .mmf
+      getf.exp  tan_signexp    = tan_NORM_f8
+      ldfpd     tan_P8,tan_P9  = [tan_AD],16
+      fmerge.s  arg_copy       = f8, f8 ;; // Save input for error call
 }
 
-// Multiply x by scaled 2/pi and add large const to shift integer part of W to 
+// Multiply x by scaled 2/pi and add large const to shift integer part of W to
 //   rightmost bits of significand
-{ .mfi
+{ .mmf
+      alloc      r32=ar.pfs,0,4,4,0
       ldfpd      tan_Q6,tan_Q7  = [tan_ADQ],16
       fma.s1 TAN_W_2TO64_RSH = tan_NORM_f8,TAN_INV_PI_BY_2_2TO64,TAN_RSHF_2TO64
-      nop.i 999 ;;
-}
+};;
 
-{ .mmi
-      ldfpd      tan_P10,tan_P11 = [tan_AD],16                         
-      nop.m 999
-      and       tan_exp = tan_GR_17_ones, tan_signexp         ;;
+{ .mmf
+      ldfpd      tan_P10,tan_P11 = [tan_AD],16
+      and       tan_exp = tan_GR_17_ones, tan_signexp
+(p6)  frcpa.s0  f8, p0 = f1, f8 ;;        // cot(+-0) = +-Inf
 }
 
 
 // p7 is true if we must call DBX TAN
 // p7 is true if f8 exp is > 0x10009 (which includes all ones
 //    NAN or inf)
-{ .mmi
-      ldfpd      tan_Q0,tan_Q1  = [tan_ADQ],16                         
-      cmp.ge.unc  p7,p0 = tan_exp,tan_GR_10009               
-      nop.i 999 ;;
+{ .mmb
+      ldfpd      tan_Q0,tan_Q1  = [tan_ADQ],16
+      cmp.ge.unc  p7,p0 = tan_exp,tan_GR_10009
+(p7)  br.cond.spnt   TAN_DBX ;;
 }
 
 
 { .mmb
-      ldfpd      tan_P4,tan_P5  = [tan_AD],16                         
-      nop.m 999
-(p7)  br.cond.spnt   L(TAN_DBX) ;;                                  
+      ldfpd      tan_P4,tan_P5  = [tan_AD],16
+(p6)  mov GR_Parameter_Tag = 226          // (cot)
+(p6)  br.cond.spnt __libm_error_region ;; // call error support if cot(+-0)
 }
 
 
 { .mmi
-      ldfpd      tan_Q2,tan_Q3  = [tan_ADQ],16                         
+      ldfpd      tan_Q2,tan_Q3  = [tan_ADQ],16
       nop.m 999
       nop.i 999 ;;
 }
@@ -404,8 +418,8 @@ __tan:
 
 // TAN_NFLOAT = Round_Int_Nearest(tan_W)
 { .mfi
-      ldfpd      tan_P6,tan_P7  = [tan_AD],16                         
-      fms.s1 TAN_NFLOAT = TAN_W_2TO64_RSH,TAN_2TOM64,TAN_RSHF      
+      ldfpd      tan_P6,tan_P7  = [tan_AD],16
+      fms.s1 TAN_NFLOAT = TAN_W_2TO64_RSH,TAN_2TOM64,TAN_RSHF
       nop.i 999 ;;
 }
 
@@ -418,22 +432,22 @@ __tan:
 
 
 { .mfi
-      ldfpd      tan_P0,tan_P1  = [tan_AD],16                         
+      ldfpd      tan_P0,tan_P1  = [tan_AD],16
       nop.f 999
       nop.i 999 ;;
 }
 
 
-{ .mfi
+{ .mmi
       getf.sig    tan_GR_n = TAN_W_2TO64_RSH
-      nop.f 999
+      ldfpd      tan_P2,tan_P3  = [tan_AD]
       nop.i 999 ;;
 }
 
 // tan_r          = -tan_Nfloat * tan_Pi_by_2_hi + x
 { .mfi
-      ldfpd      tan_P2,tan_P3  = [tan_AD]
-      fnma.s1  tan_r      = TAN_NFLOAT, tan_Pi_by_2_hi,  tan_NORM_f8         
+(p12) add        tan_GR_n = 0x1, tan_GR_n // N = N + 1 (for cot)
+      fnma.s1  tan_r      = TAN_NFLOAT, tan_Pi_by_2_hi,  tan_NORM_f8
       nop.i 999 ;;
 }
 
@@ -441,42 +455,49 @@ __tan:
 // p8 ==> even
 // p9 ==> odd
 { .mmi
-      and         tan_GR_N_odd_even = 0x1, tan_GR_n ;;          
+      and         tan_GR_N_odd_even = 0x1, tan_GR_n ;;
       nop.m 999
       cmp.eq.unc  p8,p9          = tan_GR_N_odd_even, r0      ;;
 }
 
 
-// tan_r          = tan_r -tan_Nfloat * tan_Pi_by_2_lo 
+.pred.rel "mutex", p11, p12
+// tan_r          = tan_r -tan_Nfloat * tan_Pi_by_2_lo (tan)
 { .mfi
       nop.m 999
-      fnma.s1  tan_r      = TAN_NFLOAT, tan_Pi_by_2_lo,  tan_r      
+(p11) fnma.s1  tan_r      = TAN_NFLOAT, tan_Pi_by_2_lo,  tan_r
+      nop.i 999
+}
+// tan_r          = -(tan_r -tan_Nfloat * tan_Pi_by_2_lo) (cot)
+{ .mfi
+      nop.m 999
+(p12) fms.s1   tan_r      = TAN_NFLOAT, tan_Pi_by_2_lo,  tan_r
       nop.i 999 ;;
 }
 
 
 { .mfi
       nop.m 999
-      fma.s1   tan_rsq    = tan_r, tan_r,   f0                      
+      fma.s1   tan_rsq    = tan_r, tan_r,   f0
       nop.i 999 ;;
 }
 
 
 { .mfi
       nop.m 999
-(p9)  frcpa.s1   tan_y0, p10 = f1,tan_r                  
+(p9)  frcpa.s1   tan_y0, p0 = f1,tan_r
       nop.i 999  ;;
 }
 
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v18 = tan_rsq, tan_P15, tan_P14        
+(p8)  fma.s1  tan_v18 = tan_rsq, tan_P15, tan_P14
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v4  = tan_rsq, tan_P1, tan_P0          
+(p8)  fma.s1  tan_v4  = tan_rsq, tan_P1, tan_P0
       nop.i 999  ;;
 }
 
@@ -484,12 +505,12 @@ __tan:
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v16 = tan_rsq, tan_P13, tan_P12        
-      nop.i 999 
+(p8)  fma.s1  tan_v16 = tan_rsq, tan_P13, tan_P12
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v17 = tan_rsq, tan_rsq, f0             
+(p8)  fma.s1  tan_v17 = tan_rsq, tan_rsq, f0
       nop.i 999 ;;
 }
 
@@ -497,12 +518,12 @@ __tan:
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v12 = tan_rsq, tan_P9, tan_P8          
-      nop.i 999 
+(p8)  fma.s1  tan_v12 = tan_rsq, tan_P9, tan_P8
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v13 = tan_rsq, tan_P11, tan_P10        
+(p8)  fma.s1  tan_v13 = tan_rsq, tan_P11, tan_P10
       nop.i 999 ;;
 }
 
@@ -510,12 +531,12 @@ __tan:
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v7  = tan_rsq, tan_P5, tan_P4          
-      nop.i 999 
+(p8)  fma.s1  tan_v7  = tan_rsq, tan_P5, tan_P4
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v8  = tan_rsq, tan_P7, tan_P6          
+(p8)  fma.s1  tan_v8  = tan_rsq, tan_P7, tan_P6
       nop.i 999 ;;
 }
 
@@ -523,12 +544,12 @@ __tan:
 
 { .mfi
       nop.m 999
-(p9)  fnma.s1    tan_d   = tan_r, tan_y0, f1   
-      nop.i 999 
+(p9)  fnma.s1    tan_d   = tan_r, tan_y0, f1
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v5  = tan_rsq, tan_P3, tan_P2          
+(p8)  fma.s1  tan_v5  = tan_rsq, tan_P3, tan_P2
       nop.i 999 ;;
 }
 
@@ -536,36 +557,36 @@ __tan:
 
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z11 = tan_rsq, tan_Q9, tan_Q8         
+(p9)  fma.s1  tan_z11 = tan_rsq, tan_Q9, tan_Q8
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z12 = tan_rsq, tan_rsq, f0            
+(p9)  fma.s1  tan_z12 = tan_rsq, tan_rsq, f0
       nop.i 999 ;;
 }
 
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v15 = tan_v17, tan_v18, tan_v16        
-      nop.i 999 
+(p8)  fma.s1  tan_v15 = tan_v17, tan_v18, tan_v16
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z7 = tan_rsq, tan_Q5, tan_Q4          
+(p9)  fma.s1  tan_z7 = tan_rsq, tan_Q5, tan_Q4
       nop.i 999 ;;
 }
 
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v11 = tan_v17, tan_v13, tan_v12        
+(p8)  fma.s1  tan_v11 = tan_v17, tan_v13, tan_v12
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z8 = tan_rsq, tan_Q7, tan_Q6          
+(p9)  fma.s1  tan_z8 = tan_rsq, tan_Q7, tan_Q6
       nop.i 999 ;;
 }
 
@@ -573,13 +594,13 @@ __tan:
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v14 = tan_v17, tan_v17, f0             
-      nop.i 999 
+(p8)  fma.s1  tan_v14 = tan_v17, tan_v17, f0
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z3 = tan_rsq, tan_Q1, tan_Q0          
-      nop.i 999 ;; 
+(p9)  fma.s1  tan_z3 = tan_rsq, tan_Q1, tan_Q0
+      nop.i 999 ;;
 }
 
 
@@ -587,12 +608,12 @@ __tan:
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v3 = tan_v17, tan_v5, tan_v4           
+(p8)  fma.s1  tan_v3 = tan_v17, tan_v5, tan_v4
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v6 = tan_v17, tan_v8, tan_v7           
+(p8)  fma.s1  tan_v6 = tan_v17, tan_v8, tan_v7
       nop.i 999 ;;
 }
 
@@ -600,89 +621,89 @@ __tan:
 
 { .mfi
       nop.m 999
-(p9)  fma.s1     tan_y1  = tan_y0, tan_d, tan_y0    
-      nop.i 999 
+(p9)  fma.s1     tan_y1  = tan_y0, tan_d, tan_y0
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1     tan_dsq = tan_d, tan_d, f0        
-      nop.i 999 ;; 
+(p9)  fma.s1     tan_dsq = tan_d, tan_d, f0
+      nop.i 999 ;;
 }
 
 
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z10 = tan_z12, tan_Q10, tan_z11       
-      nop.i 999 
+(p9)  fma.s1  tan_z10 = tan_z12, tan_Q10, tan_z11
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z9  = tan_z12, tan_z12,f0             
+(p9)  fma.s1  tan_z9  = tan_z12, tan_z12,f0
       nop.i 999 ;;
 }
 
 
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z4 = tan_rsq, tan_Q3, tan_Q2          
-      nop.i 999 
+(p9)  fma.s1  tan_z4 = tan_rsq, tan_Q3, tan_Q2
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z6  = tan_z12, tan_z8, tan_z7         
-      nop.i 999 ;; 
+(p9)  fma.s1  tan_z6  = tan_z12, tan_z8, tan_z7
+      nop.i 999 ;;
 }
 
 
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v10 = tan_v14, tan_v15, tan_v11        
-      nop.i 999 ;; 
+(p8)  fma.s1  tan_v10 = tan_v14, tan_v15, tan_v11
+      nop.i 999 ;;
 }
 
 
 
 { .mfi
       nop.m 999
-(p9)  fma.s1     tan_y2  = tan_y1, tan_d, tan_y0         
-      nop.i 999 
+(p9)  fma.s1     tan_y2  = tan_y1, tan_d, tan_y0
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1     tan_d4  = tan_dsq, tan_dsq, tan_d       
+(p9)  fma.s1     tan_d4  = tan_dsq, tan_dsq, tan_d
       nop.i 999  ;;
 }
 
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v2 = tan_v14, tan_v6, tan_v3           
+(p8)  fma.s1  tan_v2 = tan_v14, tan_v6, tan_v3
       nop.i 999
 }
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v9 = tan_v14, tan_v14, f0              
+(p8)  fma.s1  tan_v9 = tan_v14, tan_v14, f0
       nop.i 999 ;;
 }
 
 
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z2  = tan_z12, tan_z4, tan_z3         
-      nop.i 999 
+(p9)  fma.s1  tan_z2  = tan_z12, tan_z4, tan_z3
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z5  = tan_z9, tan_z10, tan_z6         
+(p9)  fma.s1  tan_z5  = tan_z9, tan_z10, tan_z6
       nop.i 999  ;;
 }
 
 
 { .mfi
       nop.m 999
-(p9)  fma.s1     tan_inv_r = tan_d4, tan_y2, tan_y0      
-      nop.i 999 
+(p9)  fma.s1     tan_inv_r = tan_d4, tan_y2, tan_y0
+      nop.i 999
 }
 { .mfi
       nop.m 999
@@ -694,12 +715,12 @@ __tan:
 
 { .mfi
       nop.m 999
-(p8)  fma.s1  tan_v1 = tan_v9, tan_v10, tan_v2           
-      nop.i 999 
+(p8)  fma.s1  tan_v1 = tan_v9, tan_v10, tan_v2
+      nop.i 999
 }
 { .mfi
       nop.m 999
-(p9)  fma.s1  tan_z1  = tan_z9, tan_z5, tan_z2          
+(p9)  fma.s1  tan_z1  = tan_z9, tan_z5, tan_z2
       nop.i 999   ;;
 }
 
@@ -707,64 +728,151 @@ __tan:
 
 { .mfi
       nop.m 999
-(p8)  fma.d.s0  f8  = tan_v1, tan_rcube, tan_r             
-      nop.i 999  
+(p8)  fma.d.s0  f8  = tan_v1, tan_rcube, tan_r
+      nop.i 999
 }
 { .mfb
       nop.m 999
-(p9)  fms.d.s0  f8  = tan_r, tan_z1, tan_inv_r        
-      br.ret.sptk    b0 ;;    
+(p9)  fms.d.s0  f8  = tan_r, tan_z1, tan_inv_r
+      br.ret.sptk    b0 ;;
 }
-.endp tan#
-ASM_SIZE_DIRECTIVE(tan)
+GLOBAL_IEEE754_END(tan)
 
 
-.proc __libm_callout
-__libm_callout:
-L(TAN_DBX): 
+LOCAL_LIBM_ENTRY(__libm_callout)
+TAN_DBX:
 .prologue
 
 { .mfi
-        nop.m 0
-     fmerge.s f9 = f0,f0 
-.save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs
+      nop.m 0
+      fmerge.s f9 = f0,f0
+.save ar.pfs,GR_SAVE_PFS
+      mov  GR_SAVE_PFS=ar.pfs
 }
 ;;
 
 { .mfi
-        mov GR_SAVE_GP=gp
-        nop.f 0
-.save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0
+      mov GR_SAVE_GP=gp
+      nop.f 0
+.save b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0
 }
 
 .body
-{ .mfb
+{ .mmb
       nop.m 999
-      nop.f 999
-       br.call.sptk.many  b0=__libm_tan# ;;
+      nop.m 999
+(p11) br.cond.sptk.many  call_tanl ;;
 }
 
+// Here if we should call cotl
+{ .mmb
+      nop.m 999
+      nop.m 999
+      br.call.sptk.many  b0=__libm_cotl# ;;
+}
 
 { .mfi
-       mov gp        = GR_SAVE_GP
-      fnorm.d     f8 = f8
-       mov b0        = GR_SAVE_B0 
+      mov gp        = GR_SAVE_GP
+      fnorm.d.s0 f8 = f8
+      mov b0        = GR_SAVE_B0
 }
 ;;
 
+{ .mib
+      nop.m 999
+      mov ar.pfs    = GR_SAVE_PFS
+      br.ret.sptk     b0
+;;
+}
+
+// Here if we should call tanl
+call_tanl:
+{ .mmb
+      nop.m 999
+      nop.m 999
+      br.call.sptk.many  b0=__libm_tanl# ;;
+}
+
+{ .mfi
+      mov gp        = GR_SAVE_GP
+      fnorm.d.s0 f8 = f8
+      mov b0        = GR_SAVE_B0
+}
+;;
 
 { .mib
-         nop.m 999
+      nop.m 999
       mov ar.pfs    = GR_SAVE_PFS
       br.ret.sptk     b0
 ;;
 }
 
+LOCAL_LIBM_END(__libm_callout)
+
+.type __libm_tanl#,@function
+.global __libm_tanl#
+.type __libm_cotl#,@function
+.global __libm_cotl#
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+
+// (1)
+{ .mfi
+      add           GR_Parameter_Y=-32,sp        // Parameter 2 value
+      nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+      mov           GR_SAVE_PFS=ar.pfs           // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+      add sp=-64,sp                              // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                          // Save gp
+};;
+
+// (2)
+{ .mmi
+      stfd [GR_Parameter_Y] = f1,16              // STORE Parameter 2 on stack
+      add GR_Parameter_X = 16,sp                 // Parameter 1 address
+.save   b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0                          // Save b0
+};;
+
+.body
+// (3)
+{ .mib
+      stfd [GR_Parameter_X] = arg_copy           // STORE Parameter 1 on stack
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+      nop.b 0
+}
+{ .mib
+      stfd [GR_Parameter_Y] = f8                 // STORE Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#      // Call error handling function
+};;
+{ .mmi
+      nop.m 0
+      nop.m 0
+      add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+      ldfd  f8 = [GR_Parameter_RESULT]           // Get return result off stack
+.restore sp
+      add   sp = 64,sp                           // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                      // Restore return address
+};;
+{ .mib
+      mov   gp = GR_SAVE_GP                      // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS                 // Restore ar.pfs
+      br.ret.sptk     b0                         // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
 
-.endp  __libm_callout
-ASM_SIZE_DIRECTIVE(__libm_callout)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
 
-.type __libm_tan#,@function
-.global __libm_tan#
diff --git a/sysdeps/ia64/fpu/s_tanf.S b/sysdeps/ia64/fpu/s_tanf.S
index a84009e2fe..193d7568a5 100644
--- a/sysdeps/ia64/fpu/s_tanf.S
+++ b/sysdeps/ia64/fpu/s_tanf.S
@@ -1,10 +1,10 @@
-.file "tanf.s"
+.file "tancotf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2005, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -32,739 +32,661 @@
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+//
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
 // History
 //==============================================================
-// 2/02/00: Initial version
-// 4/04/00  Unwind support added
+// 02/02/00 Initial version
+// 04/04/00 Unwind support added
 // 12/27/00 Improved speed
+// 02/21/01 Updated to call tanl
+// 05/30/02 Improved speed, added cotf.
+// 11/25/02 Added explicit completer on fnorm
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 04/17/03 Eliminated redundant stop bits
+// 03/31/05 Reformatted delimiters between data tables
 //
-// API
+// APIs
 //==============================================================
-// float tan( float x);
+// float tanf(float)
+// float cotf(float)
 //
-// Overview of operation
+// Algorithm Description for tanf
 //==============================================================
-// If the input value in radians is |x| >= 1.xxxxx 2^10 call the
-// older slower version.
+// The tanf function computes the principle value of the tangent of x,
+// where x is radian argument.
 //
-// The new algorithm is used when |x| <= 1.xxxxx 2^9.
+// There are 5 paths:
+// 1. x = +/-0.0
+//    Return tanf(x) = +/-0.0
 //
-// Represent the input X as Nfloat * pi/2 + r
-//    where r can be negative and |r| <= pi/4
+// 2. x = [S,Q]NaN
+//    Return tanf(x) = QNaN
 //
-//     tan_W  = x * 2/pi
-//     Nfloat = round_int(tan_W)
+// 3. x = +/-Inf
+//    Return tanf(x) = QNaN
 //
-//     tan_r  = x - Nfloat * (pi/2)_hi
-//     tan_r  = tan_r - Nfloat * (pi/2)_lo
+// 4. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is even, |r|<Pi/4
+//    Return tanf(x) = P19(r) = A1*r + A3*r^3 + A5*r^5 + ... + A19*r^19 =
+//    = r*(A1 + A3*t + A5*t^2 + ... + A19*t^9) = r*P9(t), where t = r^2
 //
-// We have two paths: p8, when Nfloat is even and p9. when Nfloat is odd.
-// p8: tan(X) =  tan(r)
-// p9: tan(X) = -cot(r)
+// 5. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is odd, |r|<Pi/4
+//    Return tanf(x) = -1/r + P11(r) = -1/r + B1*r + B3*r^3 + ... + B11*r^11 =
+//    = -1/r + r*(B1 + B3*t + B5*t^2 + ... + B11*t^5) = -1/r + r*P11(t),
+//    where t = r^2
 //
-// Each is evaluated as a series. The p9 path requires 1/r.
+// Algorithm Description for cotf
+//==============================================================
+// The cotf function computes the principle value of the cotangent of x,
+// where x is radian argument.
 //
-// The coefficients used in the series are stored in a table as
-// are the pi constants.
+// There are 5 paths:
+// 1. x = +/-0.0
+//    Return cotf(x) = +/-Inf and error handling is called
 //
-// Registers used
-//==============================================================
+// 2. x = [S,Q]NaN
+//    Return cotf(x) = QNaN
 //
-// predicate registers used:  
-// p6-10
+// 3. x = +/-Inf
+//    Return cotf(x) = QNaN
 //
-// floating-point registers used:  
-// f10-15, f32-105
+// 4. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is odd, |r|<Pi/4
+//    Return cotf(x) = P19(-r) = A1*(-r) + A3*(-r^3) + ... + A19*(-r^19) =
+//    = -r*(A1 + A3*t + A5*t^2 + ... + A19*t^9) = -r*P9(t), where t = r^2
+//
+// 5. x = r + (Pi/2)*N, N = RoundInt(x*(2/Pi)), N is even, |r|<Pi/4
+//    Return cotf(x) = 1/r + P11(-r) = 1/r + B1*(-r) + ... + B11*(-r^11) =
+//    = 1/r - r*(B1 + B3*t + B5*t^2 + ... + B11*t^5) = 1/r - r*P11(t),
+//    where t = r^2
+//
+//    We set p10 and clear p11 if computing tanf, vice versa for cotf.
+//
+//
+// Registers used
+//==============================================================
+// Floating Point registers used:
 // f8, input
+// f32 -> f80
 //
-// general registers used
-// r14-18, r32-43
+// General registers used:
+// r14 -> r23, r32 -> r39
+//
+// Predicate registers used:
+// p6 -> p13
 //
-
-#include "libm_support.h"
-
 // Assembly macros
 //==============================================================
-TAN_INV_PI_BY_2_2TO64        = f10
-TAN_RSHF_2TO64               = f11
-TAN_2TOM64                   = f12
-TAN_RSHF                     = f13
-TAN_W_2TO64_RSH              = f14
-TAN_NFLOAT                   = f15
-
-tan_Inv_Pi_by_2              = f32
-tan_Pi_by_2_hi               = f33
-tan_Pi_by_2_lo               = f34
-
-
-tan_P0                       = f35
-tan_P1                       = f36
-tan_P2                       = f37
-tan_P3                       = f38 
-tan_P4                       = f39 
-tan_P5                       = f40 
-tan_P6                       = f41
-tan_P7                       = f42
-tan_P8                       = f43 
-tan_P9                       = f44 
-tan_P10                      = f45 
-tan_P11                      = f46
-tan_P12                      = f47 
-tan_P13                      = f48
-tan_P14                      = f49
-tan_P15                      = f50
-
-tan_Q0                       = f51 
-tan_Q1                       = f52 
-tan_Q2                       = f53 
-tan_Q3                       = f54 
-tan_Q4                       = f55 
-tan_Q5                       = f56 
-tan_Q6                       = f57 
-tan_Q7                       = f58 
-tan_Q8                       = f59
-tan_Q9                       = f60
-tan_Q10                      = f61
-
-tan_r                        = f62
-tan_rsq                      = f63
-tan_rcube                    = f64
-
-tan_v18                      = f65
-tan_v16                      = f66
-tan_v17                      = f67
-tan_v12                      = f68
-tan_v13                      = f69
-tan_v7                       = f70
-tan_v8                       = f71
-tan_v4                       = f72
-tan_v5                       = f73
-tan_v15                      = f74
-tan_v11                      = f75
-tan_v14                      = f76
-tan_v3                       = f77
-tan_v6                       = f78
-tan_v10                      = f79
-tan_v2                       = f80
-tan_v9                       = f81
-tan_v1                       = f82
-tan_int_Nfloat               = f83 
-tan_Nfloat                   = f84 
-
-tan_NORM_f8                  = f85 
-tan_W                        = f86
-
-tan_y0                       = f87
-tan_d                        = f88 
-tan_y1                       = f89 
-tan_dsq                      = f90 
-tan_y2                       = f91 
-tan_d4                       = f92 
-tan_inv_r                    = f93 
-
-tan_z1                       = f94
-tan_z2                       = f95
-tan_z3                       = f96
-tan_z4                       = f97
-tan_z5                       = f98
-tan_z6                       = f99
-tan_z7                       = f100
-tan_z8                       = f101
-tan_z9                       = f102
-tan_z10                      = f103
-tan_z11                      = f104
-tan_z12                      = f105
-
-
-/////////////////////////////////////////////////////////////
-
-tan_GR_sig_inv_pi_by_2       = r14
-tan_GR_rshf_2to64            = r15
-tan_GR_exp_2tom64            = r16
-tan_GR_n                     = r17
-tan_GR_rshf                  = r18
-
-tan_AD                       = r33
-tan_GR_10009                 = r34 
-tan_GR_17_ones               = r35 
-tan_GR_N_odd_even            = r36 
-tan_GR_N                     = r37 
-tan_signexp                  = r38
-tan_exp                      = r39
-tan_ADQ                      = r40
-
-GR_SAVE_PFS                  = r41 
-GR_SAVE_B0                   = r42       
-GR_SAVE_GP                   = r43      
-
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
+// integer registers
+rExp                        = r14
+rSignMask                   = r15
+rRshf                       = r16
+rScFctrExp                  = r17
+rIntN                       = r18
+rSigRcpPiby2                = r19
+rScRshf                     = r20
+rCoeffA                     = r21
+rCoeffB                     = r22
+rExpCut                     = r23
+
+GR_SAVE_B0                  = r33
+GR_SAVE_PFS                 = r34
+GR_SAVE_GP                  = r35
+GR_Parameter_X              = r36
+GR_Parameter_Y              = r37
+GR_Parameter_RESULT         = r38
+GR_Parameter_Tag            = r39
+
+//==============================================================
+// floating point registers
+fScRcpPiby2                 = f32
+fScRshf                     = f33
+fNormArg                    = f34
+fScFctr                     = f35
+fRshf                       = f36
+fShiftedN                   = f37
+fN                          = f38
+fR                          = f39
+fA01                        = f40
+fA03                        = f41
+fA05                        = f42
+fA07                        = f43
+fA09                        = f44
+fA11                        = f45
+fA13                        = f46
+fA15                        = f47
+fA17                        = f48
+fA19                        = f49
+fB01                        = f50
+fB03                        = f51
+fB05                        = f52
+fB07                        = f53
+fB09                        = f54
+fB11                        = f55
+fA03_01                     = f56
+fA07_05                     = f57
+fA11_09                     = f58
+fA15_13                     = f59
+fA19_17                     = f60
+fA11_05                     = f61
+fA19_13                     = f62
+fA19_05                     = f63
+fRbyA03_01                  = f64
+fB03_01                     = f65
+fB07_05                     = f66
+fB11_09                     = f67
+fB11_05                     = f68
+fRbyB03_01                  = f69
+fRbyB11_01                  = f70
+fRp2                        = f71
+fRp4                        = f72
+fRp8                        = f73
+fRp5                        = f74
+fY0                         = f75
+fY1                         = f76
+fD                          = f77
+fDp2                        = f78
+fInvR                       = f79
+fPiby2                      = f80
+//==============================================================
 
-.align 16
 
-double_tan_constants:
-ASM_TYPE_DIRECTIVE(double_tan_constants,@object)
-//   data8 0xA2F9836E4E44152A, 0x00003FFE // 2/pi
-   data8 0xC90FDAA22168C234, 0x00003FFF // pi/2 hi
-
-   data8 0xBEEA54580DDEA0E1 // P14 
-   data8 0x3ED3021ACE749A59 // P15
-   data8 0xBEF312BD91DC8DA1 // P12 
-   data8 0x3EFAE9AFC14C5119 // P13
-   data8 0x3F2F342BF411E769 // P8
-   data8 0x3F1A60FC9F3B0227 // P9
-   data8 0x3EFF246E78E5E45B // P10
-   data8 0x3F01D9D2E782875C // P11
-   data8 0x3F8226E34C4499B6 // P4
-   data8 0x3F6D6D3F12C236AC // P5
-   data8 0x3F57DA1146DCFD8B // P6
-   data8 0x3F43576410FE3D75 // P7
-   data8 0x3FD5555555555555 // P0
-   data8 0x3FC11111111111C2 // P1
-   data8 0x3FABA1BA1BA0E850 // P2
-   data8 0x3F9664F4886725A7 // P3
-ASM_SIZE_DIRECTIVE(double_tan_constants)
-
-double_Q_tan_constants:
-ASM_TYPE_DIRECTIVE(double_Q_tan_constants,@object)
-   data8 0xC4C6628B80DC1CD1, 0x00003FBF // pi/2 lo
-   data8 0x3E223A73BA576E48 // Q8
-   data8 0x3DF54AD8D1F2CA43 // Q9
-   data8 0x3EF66A8EE529A6AA // Q4
-   data8 0x3EC2281050410EE6 // Q5
-   data8 0x3E8D6BB992CC3CF5 // Q6
-   data8 0x3E57F88DE34832E4 // Q7
-   data8 0x3FD5555555555555 // Q0
-   data8 0x3F96C16C16C16DB8 // Q1
-   data8 0x3F61566ABBFFB489 // Q2
-   data8 0x3F2BBD77945C1733 // Q3
-   data8 0x3D927FB33E2B0E04 // Q10
-ASM_SIZE_DIRECTIVE(double_Q_tan_constants)
-
-
-   
-.align 32
-.global tanf#
-#ifdef _LIBC
-.global __tanf#
-#endif
-
-////////////////////////////////////////////////////////
+RODATA
+.align 16
 
+LOCAL_OBJECT_START(coeff_A)
+data8 0x3FF0000000000000 // A1  = 1.00000000000000000000e+00
+data8 0x3FD5555556BCE758 // A3  = 3.33333334641442641606e-01
+data8 0x3FC111105C2DAE48 // A5  = 1.33333249100689099175e-01
+data8 0x3FABA1F876341060 // A7  = 5.39701122561673229739e-02
+data8 0x3F965FB86D12A38D // A9  = 2.18495194027670719750e-02
+data8 0x3F8265F62415F9D6 // A11 = 8.98353860497717439465e-03
+data8 0x3F69E3AE64CCF58D // A13 = 3.16032468108912746342e-03
+data8 0x3F63920D09D0E6F6 // A15 = 2.38897844840557235331e-03
+LOCAL_OBJECT_END(coeff_A)
+
+LOCAL_OBJECT_START(coeff_B)
+data8 0xC90FDAA22168C235, 0x3FFF // pi/2
+data8 0x3FD55555555358DB // B1  = 3.33333333326107426583e-01
+data8 0x3F96C16C252F643F // B3  = 2.22222230621336129239e-02
+data8 0x3F61566243AB3C60 // B5  = 2.11638633968606896785e-03
+data8 0x3F2BC1169BD4438B // B7  = 2.11748132564551094391e-04
+data8 0x3EF611B4CEA056A1 // B9  = 2.10467959860990200942e-05
+data8 0x3EC600F9E32194BF // B11 = 2.62305891234274186608e-06
+data8 0xBF42BA7BCC177616 // A17 =-5.71546981685324877205e-04
+data8 0x3F4F2614BC6D3BB8 // A19 = 9.50584530849832782542e-04
+LOCAL_OBJECT_END(coeff_B)
 
 
 .section .text
-.proc  tanf#
-#ifdef _LIBC
-.proc  __tanf#
-#endif
-.align 32
-tanf:
-#ifdef _LIBC
-__tanf:
-#endif
-// The initial fnorm will take any unmasked faults and
-// normalize any single/double unorms
+
+LOCAL_LIBM_ENTRY(cotf)
 
 { .mlx
-      alloc          r32=ar.pfs,1,11,0,0               
-      movl tan_GR_sig_inv_pi_by_2 = 0xA2F9836E4E44152A // significand of 2/pi
+      getf.exp  rExp        = f8                    // ***** Get 2ˆ17 * s + E
+      movl      rSigRcpPiby2= 0xA2F9836E4E44152A    // significand of 2/Pi
 }
 { .mlx
-      addl           tan_AD   = @ltoff(double_tan_constants), gp
-      movl tan_GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+63+1)
+      addl      rCoeffA     = @ltoff(coeff_A), gp
+      movl      rScRshf     = 0x47e8000000000000    // 1.5*2^(63+63+1)
 }
 ;;
 
 { .mfi
-      ld8 tan_AD = [tan_AD]
-      fnorm     tan_NORM_f8  = f8                      
-      mov tan_GR_exp_2tom64 = 0xffff-64 // exponent of scaling factor 2^-64
+      alloc     r32         = ar.pfs, 0, 4, 4, 0
+      fclass.m  p9, p0      = f8, 0xc3              // Test for x=nan
+      cmp.eq    p11, p10    = r0, r0                // if p11=1 we compute cotf
 }
-{ .mlx
-      nop.m 999
-      movl tan_GR_rshf = 0x43e8000000000000 // 1.1000 2^63 for right shift
+{ .mib
+      ld8       rCoeffA     = [rCoeffA]
+      mov       rExpCut     = 0x10009               // cutoff for exponent
+      br.cond.sptk Common_Path
 }
 ;;
 
+LOCAL_LIBM_END(cotf)
 
-// Form two constants we need
-//   2/pi * 2^1 * 2^63, scaled by 2^64 since we just loaded the significand
-//   1.1000...000 * 2^(63+63+1) to right shift int(W) into the significand
-{ .mmi
-      setf.sig TAN_INV_PI_BY_2_2TO64 = tan_GR_sig_inv_pi_by_2
-      setf.d TAN_RSHF_2TO64 = tan_GR_rshf_2to64
-      mov       tan_GR_17_ones     = 0x1ffff             ;;
-}
 
+GLOBAL_IEEE754_ENTRY(tanf)
 
-// Form another constant
-//   2^-64 for scaling Nfloat
-//   1.1000...000 * 2^63, the right shift constant
-{ .mmf
-      setf.exp TAN_2TOM64 = tan_GR_exp_2tom64
-      adds tan_ADQ = double_Q_tan_constants - double_tan_constants, tan_AD
-      fclass.m.unc  p6,p0 = f8, 0x07  // Test for x=0
+{ .mlx
+      getf.exp  rExp        = f8                    // ***** Get 2ˆ17 * s + E
+      movl      rSigRcpPiby2= 0xA2F9836E4E44152A    // significand of 2/Pi
 }
-;;
-
-
-// Form another constant
-//   2^-64 for scaling Nfloat
-//   1.1000...000 * 2^63, the right shift constant
-{ .mmf
-      setf.d TAN_RSHF = tan_GR_rshf
-      ldfe      tan_Pi_by_2_hi = [tan_AD],16 
-      fclass.m.unc  p7,p0 = f8, 0x23  // Test for x=inf
+{ .mlx
+      addl      rCoeffA     = @ltoff(coeff_A), gp
+      movl      rScRshf     = 0x47e8000000000000    // 1.5*2^(63+63+1)
 }
 ;;
 
-{ .mfb
-      ldfe      tan_Pi_by_2_lo = [tan_ADQ],16           
-      fclass.m.unc  p8,p0 = f8, 0xc3  // Test for x=nan
-(p6)  br.ret.spnt    b0    ;;         // Exit for x=0
-}
-
 { .mfi
-      ldfpd     tan_P14,tan_P15 = [tan_AD],16                         
-(p7)  frcpa.s0  f8,p9=f0,f0           // Set qnan indef if x=inf
-      mov       tan_GR_10009 = 0x10009
+      alloc     r32         = ar.pfs, 0, 4, 4, 0
+      fclass.m  p9, p0      = f8, 0xc3              // Test for x=nan
+      cmp.eq    p10, p11    = r0, r0                // if p10=1 we compute tandf
 }
 { .mib
-      ldfpd      tan_Q8,tan_Q9  = [tan_ADQ],16                        
-      nop.i 999
-(p7)  br.ret.spnt    b0    ;;         // Exit for x=inf
+      ld8       rCoeffA     = [rCoeffA]
+      mov       rExpCut     = 0x10009               // cutoff for exponent
+      nop.b     0
 }
+;;
 
+// Below is common path for both tandf and cotdf
+Common_Path:
 { .mfi
-      ldfpd      tan_P12,tan_P13 = [tan_AD],16                         
-(p8)  fma.s f8=f8,f1,f8               // Set qnan if x=nan
-      nop.i 999
+      setf.sig  fScRcpPiby2 = rSigRcpPiby2          // 2^(63+1)*(2/Pi)
+      fclass.m  p8, p0      = f8, 0x23              // Test for x=inf
+      mov       rSignMask   = 0x1ffff               // mask for sign bit
 }
-{ .mib
-      ldfpd      tan_Q4,tan_Q5  = [tan_ADQ],16                        
-      nop.i 999
-(p8)  br.ret.spnt    b0    ;;         // Exit for x=nan
+{ .mlx
+      setf.d    fScRshf     = rScRshf               // 1.5*2^(63+63+1)
+      movl      rRshf       = 0x43e8000000000000    // 1.5 2^63 for right shift
 }
+;;
 
-{ .mmi
-      getf.exp  tan_signexp    = tan_NORM_f8                 
-      ldfpd      tan_P8,tan_P9  = [tan_AD],16                         
-      nop.i 999 ;;
+{ .mfi
+      and       rSignMask   = rSignMask, rExp       // clear sign bit
+(p10) fclass.m.unc p7, p0   = f8, 0x07              // Test for x=0 (for tanf)
+      mov       rScFctrExp  = 0xffff-64             // exp of scaling factor
+}
+{ .mfb
+      adds      rCoeffB     = coeff_B - coeff_A, rCoeffA
+(p9)  fma.s.s0  f8          = f8, f1, f8            // Set qnan if x=nan
+(p9)  br.ret.spnt b0                                // Exit for x=nan
 }
+;;
 
-// Multiply x by scaled 2/pi and add large const to shift integer part of W to 
-//   rightmost bits of significand
 { .mfi
-      ldfpd      tan_Q6,tan_Q7  = [tan_ADQ],16
-      fma.s1 TAN_W_2TO64_RSH = tan_NORM_f8,TAN_INV_PI_BY_2_2TO64,TAN_RSHF_2TO64
-      nop.i 999 ;;
+      cmp.ge    p6, p0      = rSignMask, rExpCut    // p6 = (E => 0x10009)
+(p8)  frcpa.s0  f8, p0      = f0, f0                // Set qnan indef if x=inf
+      mov GR_Parameter_Tag  = 227                   // (cotf)
 }
-
-{ .mmi
-      ldfpd      tan_P10,tan_P11 = [tan_AD],16                         
-      nop.m 999
-      and       tan_exp = tan_GR_17_ones, tan_signexp         ;;
+{ .mbb
+      ldfe      fPiby2      = [rCoeffB], 16
+(p8)  br.ret.spnt b0                                // Exit for x=inf
+(p6)  br.cond.spnt Huge_Argument                    // Branch if |x|>=2^10
 }
+;;
 
+{ .mfi
+      nop.m     0
+(p11) fclass.m.unc p6, p0   = f8, 0x07              // Test for x=0 (for cotf)
+      nop.i     0
+}
+{ .mfb
+      nop.m     0
+      fnorm.s0  fNormArg    = f8
+(p7)  br.ret.spnt b0                                // Exit for x=0 (for tanf)
+}
+;;
 
-// p7 is true if we must call DBX TAN
-// p7 is true if f8 exp is > 0x10009 (which includes all ones
-//    NAN or inf)
-{ .mmi
-      ldfpd      tan_Q0,tan_Q1  = [tan_ADQ],16                         
-      cmp.ge.unc  p7,p0 = tan_exp,tan_GR_10009               
-      nop.i 999 ;;
+{ .mmf
+      ldfpd     fA01, fA03  = [rCoeffA], 16
+      ldfpd     fB01, fB03  = [rCoeffB], 16
+      fmerge.s  f10         = f8, f8                // Save input for error call
 }
+;;
 
+{ .mmf
+      setf.exp  fScFctr     = rScFctrExp            // get as real
+      setf.d    fRshf       = rRshf                 // get right shifter as real
+(p6)  frcpa.s0  f8, p0      = f1, f8                // cotf(+-0) = +-Inf
+}
+;;
 
 { .mmb
-      ldfpd      tan_P4,tan_P5  = [tan_AD],16                         
-      nop.m 999
-(p7)  br.cond.spnt   L(TAN_DBX) ;;                                  
+      ldfpd     fA05, fA07  = [rCoeffA], 16
+      ldfpd     fB05, fB07  = [rCoeffB], 16
+(p6)  br.cond.spnt __libm_error_region    // call error support if cotf(+-0)
 }
-
+;;
 
 { .mmi
-      ldfpd      tan_Q2,tan_Q3  = [tan_ADQ],16                         
-      nop.m 999
-      nop.i 999 ;;
+      ldfpd     fA09, fA11  = [rCoeffA], 16
+      ldfpd     fB09, fB11  = [rCoeffB], 16
+      nop.i     0
 }
-
-
-
-// TAN_NFLOAT = Round_Int_Nearest(tan_W)
-{ .mfi
-      ldfpd      tan_P6,tan_P7  = [tan_AD],16                         
-      fms.s1 TAN_NFLOAT = TAN_W_2TO64_RSH,TAN_2TOM64,TAN_RSHF      
-      nop.i 999 ;;
-}
-
+;;
 
 { .mfi
-      ldfd      tan_Q10 = [tan_ADQ]
-      nop.f 999
-      nop.i 999 ;;
+      nop.m     0
+      fma.s1    fShiftedN = fNormArg,fScRcpPiby2,fScRshf // x*2^70*(2/Pi)+ScRshf
+      nop.i     0
 }
-
+;;
 
 { .mfi
-      ldfpd      tan_P0,tan_P1  = [tan_AD],16                         
-      nop.f 999
-      nop.i 999 ;;
+      nop.m     0
+      fms.s1    fN          = fShiftedN, fScFctr, fRshf // N = Y*2^(-70) - Rshf
+      nop.i     0
 }
+;;
 
-
+.pred.rel "mutex", p10, p11
 { .mfi
-      getf.sig    tan_GR_n = TAN_W_2TO64_RSH
-      nop.f 999
-      nop.i 999 ;;
+      getf.sig  rIntN       = fShiftedN             // get N as integer
+(p10) fnma.s1   fR          = fN, fPiby2, fNormArg  // R = x - (Pi/2)*N (tanf)
+      nop.i     0
 }
-
-// tan_r          = -tan_Nfloat * tan_Pi_by_2_hi + x
 { .mfi
-      ldfpd      tan_P2,tan_P3  = [tan_AD]
-      fnma.s1  tan_r      = TAN_NFLOAT, tan_Pi_by_2_hi,  tan_NORM_f8         
-      nop.i 999 ;;
+      nop.m     0
+(p11) fms.s1    fR          = fN, fPiby2, fNormArg  // R = (Pi/2)*N - x (cotf)
+      nop.i     0
 }
+;;
 
-
-// p8 ==> even
-// p9 ==> odd
 { .mmi
-      and         tan_GR_N_odd_even = 0x1, tan_GR_n ;;          
-      nop.m 999
-      cmp.eq.unc  p8,p9          = tan_GR_N_odd_even, r0      ;;
-}
-
-
-// tan_r          = tan_r -tan_Nfloat * tan_Pi_by_2_lo 
-{ .mfi
-      nop.m 999
-      fnma.s1  tan_r      = TAN_NFLOAT, tan_Pi_by_2_lo,  tan_r      
-      nop.i 999 ;;
+      ldfpd     fA13, fA15  = [rCoeffA], 16
+      ldfpd     fA17, fA19  = [rCoeffB], 16
+      nop.i     0
 }
+;;
 
-
+Return_From_Huges:
 { .mfi
-      nop.m 999
-      fma.s1   tan_rsq    = tan_r, tan_r,   f0                      
-      nop.i 999 ;;
+      nop.m     0
+      fma.s1    fRp2        = fR, fR, f0            // R^2
+(p11) add       rIntN       = 0x1, rIntN            // N = N + 1 (cotf)
 }
-
+;;
 
 { .mfi
-      nop.m 999
-(p9)  frcpa.s1   tan_y0, p10 = f1,tan_r                  
-      nop.i 999  ;;
+      nop.m     0
+      frcpa.s1  fY0, p0     = f1, fR                // Y0 ~ 1/R
+      tbit.z    p8, p9      = rIntN, 0              // p8=1 if N is even
 }
+;;
 
-
+// Below are mixed polynomial calculations (mixed for even and odd N)
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v18 = tan_rsq, tan_P15, tan_P14        
-      nop.i 999
+      nop.m     0
+(p9)  fma.s1    fB03_01     = fRp2, fB03, fB01      // R^2*B3 + B1
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v4  = tan_rsq, tan_P1, tan_P0          
-      nop.i 999  ;;
+      nop.m     0
+      fma.s1    fRp4        = fRp2, fRp2, f0        // R^4
+      nop.i     0
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v16 = tan_rsq, tan_P13, tan_P12        
-      nop.i 999 
+      nop.m     0
+(p8)  fma.s1    fA15_13     = fRp2, fA15, fA13      // R^2*A15 + A13
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v17 = tan_rsq, tan_rsq, f0             
-      nop.i 999 ;;
+      nop.m     0
+(p8)  fma.s1    fA19_17     = fRp2, fA19, fA17      // R^2*A19 + A17
+      nop.i     0
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v12 = tan_rsq, tan_P9, tan_P8          
-      nop.i 999 
+      nop.m     0
+(p8)  fma.s1    fA07_05     = fRp2, fA07, fA05      // R^2*A7 + A5
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v13 = tan_rsq, tan_P11, tan_P10        
-      nop.i 999 ;;
+      nop.m     0
+(p8)  fma.s1    fA11_09     = fRp2, fA11, fA09      // R^2*A11 + A9
+      nop.i     0
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v7  = tan_rsq, tan_P5, tan_P4          
-      nop.i 999 
+      nop.m     0
+(p9)  fma.s1    fB07_05     = fRp2, fB07, fB05      // R^2*B7 + B5
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v8  = tan_rsq, tan_P7, tan_P6          
-      nop.i 999 ;;
+      nop.m     0
+(p9)  fma.s1    fB11_09     = fRp2, fB11, fB09      // R^2*B11 + B9
+      nop.i     0
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p9)  fnma.s1    tan_d   = tan_r, tan_y0, f1   
-      nop.i 999 
+      nop.m     0
+(p9)  fnma.s1   fD          = fR, fY0, f1           // D = 1 - R*Y0
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v5  = tan_rsq, tan_P3, tan_P2          
-      nop.i 999 ;;
+      nop.m     0
+(p8)  fma.s1    fA03_01     = fRp2, fA03, fA01      // R^2*A3 + A1
+      nop.i     0
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z11 = tan_rsq, tan_Q9, tan_Q8         
-      nop.i 999
+      nop.m     0
+      fma.s1    fRp8        = fRp4, fRp4, f0        // R^8
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z12 = tan_rsq, tan_rsq, f0            
-      nop.i 999 ;;
+      nop.m     0
+      fma.s1    fRp5        = fR, fRp4, f0          // R^5
+      nop.i     0
 }
-
+;;
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v15 = tan_v17, tan_v18, tan_v16        
-      nop.i 999 
+      nop.m     0
+(p8)  fma.s1    fA11_05     = fRp4, fA11_09, fA07_05 // R^4*(R^2*A11 + A9) + ...
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z7 = tan_rsq, tan_Q5, tan_Q4          
-      nop.i 999 ;;
+      nop.m     0
+(p8)  fma.s1    fA19_13     = fRp4, fA19_17, fA15_13 // R^4*(R^2*A19 + A17) + ..
+      nop.i     0
 }
-
+;;
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v11 = tan_v17, tan_v13, tan_v12        
-      nop.i 999
+      nop.m     0
+(p9)  fma.s1    fB11_05     = fRp4, fB11_09, fB07_05 // R^4*(R^2*B11 + B9) + ...
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z8 = tan_rsq, tan_Q7, tan_Q6          
-      nop.i 999 ;;
+      nop.m     0
+(p9)  fma.s1    fRbyB03_01  = fR, fB03_01, f0       // R*(R^2*B3 + B1)
+      nop.i     0
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v14 = tan_v17, tan_v17, f0             
-      nop.i 999 
+      nop.m     0
+(p9)  fma.s1    fY1         = fY0, fD, fY0          // Y1 = Y0*D + Y0
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z3 = tan_rsq, tan_Q1, tan_Q0          
-      nop.i 999 ;; 
+      nop.m     0
+(p9)  fma.s1    fDp2        = fD, fD, f0            // D^2
+      nop.i     0
 }
-
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v3 = tan_v17, tan_v5, tan_v4           
-      nop.i 999
+      nop.m     0
+   // R^8*(R^6*A19 + R^4*A17 + R^2*A15 + A13) + R^6*A11 + R^4*A9 + R^2*A7 + A5
+(p8)  fma.d.s1  fA19_05     = fRp8, fA19_13, fA11_05
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v6 = tan_v17, tan_v8, tan_v7           
-      nop.i 999 ;;
+      nop.m     0
+(p8)  fma.d.s1  fRbyA03_01  = fR, fA03_01, f0       // R*(R^2*A3 + A1)
+      nop.i     0
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p9)  fma.s1     tan_y1  = tan_y0, tan_d, tan_y0    
-      nop.i 999 
+      nop.m     0
+(p9)  fma.d.s1  fInvR       = fY1, fDp2, fY1        // 1/R = Y1*D^2 + Y1
+      nop.i     0
 }
 { .mfi
-      nop.m 999
-(p9)  fma.s1     tan_dsq = tan_d, tan_d, f0        
-      nop.i 999 ;; 
+      nop.m     0
+   // R^5*(R^6*B11 + R^4*B9 + R^2*B7 + B5) + R^3*B3 + R*B1
+(p9)  fma.d.s1  fRbyB11_01  = fRp5, fB11_05, fRbyB03_01
+      nop.i     0
 }
+;;
 
-
+.pred.rel "mutex", p8, p9
 { .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z10 = tan_z12, tan_Q10, tan_z11       
-      nop.i 999 
+      nop.m     0
+   // Result = R^5*(R^14*A19 + R^12*A17 + R^10*A15 + ...) + R^3*A3 + R*A1
+(p8)  fma.s.s0  f8          = fRp5, fA19_05, fRbyA03_01
+      nop.i 0
 }
-{ .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z9  = tan_z12, tan_z12,f0             
-      nop.i 999 ;;
+{ .mfb
+      nop.m     0
+   // Result = -1/R + R^11*B11 + R^9*B9 + R^7*B7 + R^5*B5 + R^3*B3 + R*B1
+(p9)  fnma.s.s0 f8          = f1, fInvR, fRbyB11_01
+      br.ret.sptk b0                                // exit for main path
 }
+;;
 
-
-{ .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z4 = tan_rsq, tan_Q3, tan_Q2          
-      nop.i 999 
-}
-{ .mfi
-      nop.m 999
-(p9)  fma.s1  tan_z6  = tan_z12, tan_z8, tan_z7         
-      nop.i 999 ;; 
-}
+GLOBAL_IEEE754_END(tanf)
 
 
+LOCAL_LIBM_ENTRY(__libm_callout)
+Huge_Argument:
+.prologue
 
 { .mfi
-      nop.m 999
-(p8)  fma.s1  tan_v10 = tan_v14, tan_v15, tan_v11        
-      nop.i 999 ;; 
+      nop.m 0
+      fmerge.s f9 = f0,f0
+.save ar.pfs,GR_SAVE_PFS
+      mov  GR_SAVE_PFS=ar.pfs
 }
-
-
+;;
 
 { .mfi
-      nop.m 999
-(p9)  fma.s1     tan_y2  = tan_y1, tan_d, tan_y0         
-      nop.i 999 
-}
-{ .mfi
-      nop.m 999
-(p9)  fma.s1     tan_d4  = tan_dsq, tan_dsq, tan_d       
-      nop.i 999  ;;
+      mov GR_SAVE_GP=gp
+      nop.f 0
+.save b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0
 }
 
-
-{ .mfi
+.body
+{ .mmb
       nop.m 999
-(p8)  fma.s1  tan_v2 = tan_v14, tan_v6, tan_v3           
-      nop.i 999
-}
-{ .mfi
       nop.m 999
-(p8)  fma.s1  tan_v9 = tan_v14, tan_v14, f0              
-      nop.i 999 ;;
+(p10) br.cond.sptk.many  call_tanl ;;
 }
 
-
-{ .mfi
+// Here if we should call cotl (p10=0, p11=1)
+{ .mmb
       nop.m 999
-(p9)  fma.s1  tan_z2  = tan_z12, tan_z4, tan_z3         
-      nop.i 999 
-}
-{ .mfi
       nop.m 999
-(p9)  fma.s1  tan_z5  = tan_z9, tan_z10, tan_z6         
-      nop.i 999  ;;
+      br.call.sptk.many  b0=__libm_cotl# ;;
 }
 
-
 { .mfi
-      nop.m 999
-(p9)  fma.s1     tan_inv_r = tan_d4, tan_y2, tan_y0      
-      nop.i 999 
+      mov gp        = GR_SAVE_GP
+      fnorm.s.s0 f8 = f8
+      mov b0        = GR_SAVE_B0
 }
-{ .mfi
+;;
+
+{ .mib
       nop.m 999
-(p8)  fma.s1   tan_rcube  = tan_rsq, tan_r,   f0
-      nop.i 999  ;;
+      mov ar.pfs    = GR_SAVE_PFS
+      br.ret.sptk     b0
+;;
 }
 
-
-
-{ .mfi
+// Here if we should call tanl (p10=1, p11=0)
+call_tanl:
+{ .mmb
       nop.m 999
-(p8)  fma.s1  tan_v1 = tan_v9, tan_v10, tan_v2           
-      nop.i 999 
-}
-{ .mfi
       nop.m 999
-(p9)  fma.s1  tan_z1  = tan_z9, tan_z5, tan_z2          
-      nop.i 999   ;;
+      br.call.sptk.many  b0=__libm_tanl# ;;
 }
 
-
-
 { .mfi
-      nop.m 999
-(p8)  fma.s.s0  f8  = tan_v1, tan_rcube, tan_r             
-      nop.i 999  
+      mov gp        = GR_SAVE_GP
+      fnorm.s.s0 f8 = f8
+      mov b0        = GR_SAVE_B0
 }
-{ .mfb
+;;
+
+{ .mib
       nop.m 999
-(p9)  fms.s.s0  f8  = tan_r, tan_z1, tan_inv_r        
-      br.ret.sptk    b0 ;;    
+      mov ar.pfs    = GR_SAVE_PFS
+      br.ret.sptk     b0
+;;
 }
-.endp tanf#
-ASM_SIZE_DIRECTIVE(tanf#)
+
+LOCAL_LIBM_END(__libm_callout)
+
+.type __libm_tanl#,@function
+.global __libm_tanl#
+.type __libm_cotl#,@function
+.global __libm_cotl#
 
 
-.proc __libm_callout
-__libm_callout:
-L(TAN_DBX): 
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
 
+// (1)
 { .mfi
-        nop.m 0
-     fmerge.s f9 = f0,f0 
+      add           GR_Parameter_Y=-32,sp        // Parameter 2 value
+      nop.f         0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs
+      mov           GR_SAVE_PFS=ar.pfs           // Save ar.pfs
 }
-;;
-
 { .mfi
-        mov GR_SAVE_GP=gp
-        nop.f 0
+.fframe 64
+      add sp=-64,sp                              // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                          // Save gp
+};;
+
+// (2)
+{ .mmi
+      stfs [GR_Parameter_Y] = f1,16              // STORE Parameter 2 on stack
+      add GR_Parameter_X = 16,sp                 // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0
-}
+      mov GR_SAVE_B0=b0                          // Save b0
+};;
 
 .body
-{ .mfb
-      nop.m 999
-      nop.f 999
-       br.call.sptk.many  b0=__libm_tan# ;;
-}
-
-
-{ .mfi
-       mov gp        = GR_SAVE_GP
-      fnorm.s     f8 = f8
-       mov b0        = GR_SAVE_B0 
+// (3)
+{ .mib
+      stfs [GR_Parameter_X] = f10                // STORE Parameter 1 on stack
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+      nop.b 0
 }
-;;
-
+{ .mib
+      stfs [GR_Parameter_Y] = f8                 // STORE Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#      // Call error handling function
+};;
+{ .mmi
+      nop.m 0
+      nop.m 0
+      add   GR_Parameter_RESULT = 48,sp
+};;
 
+// (4)
+{ .mmi
+      ldfs  f8 = [GR_Parameter_RESULT]           // Get return result off stack
+.restore sp
+      add   sp = 64,sp                           // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                      // Restore return address
+};;
 { .mib
-         nop.m 999
-      mov ar.pfs    = GR_SAVE_PFS
-      br.ret.sptk     b0
-;;
-}
+      mov   gp = GR_SAVE_GP                      // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS                 // Restore ar.pfs
+      br.ret.sptk     b0                         // Return
+};;
 
+LOCAL_LIBM_END(__libm_error_region)
 
-.endp  __libm_callout
-ASM_SIZE_DIRECTIVE(__libm_callout)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
 
-.type __libm_tan#,@function
-.global __libm_tan#
diff --git a/sysdeps/ia64/fpu/s_tanh.S b/sysdeps/ia64/fpu/s_tanh.S
new file mode 100644
index 0000000000..9adbc9c461
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_tanh.S
@@ -0,0 +1,986 @@
+.file "tanh.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================================
+// 05/30/01  Initial version
+// 12/04/01  Rewritten version with erf-like algorithm.
+//           Performance improved.
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 08/14/02  Changed mli templates to mlx
+// 02/10/03  Reordered header: .section, .global, .proc, .align
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+//==============================================================================
+// double tanh(double)
+//
+// Overview of operation
+//==============================================================================
+//
+// Algorithm description
+// ---------------------
+//
+// There are 4 paths:
+//
+// 1. Special path: x = 0, Inf, NaNs, denormals
+//    Return tanh(x) = +/-0.0 for zeros
+//    Return tanh(x) = QNaN for NaNs
+//    Return tanh(x) = sign(x)*1.0 for Inf
+//    Return tanh(x) = x + x^2   for - denormals
+//    Return tanh(x) = x - x^2   for + denormals
+//
+// 2. Near zero path: 0.0 < |x| < 0.25
+//    Return tanh(x) = x + x^3*A3 + ... + x^19*A19
+//
+// 3. Main path: 0.25 <= |x| < 19.0625
+//    For several ranges of 0.25 <= |x| < 19.0625
+//    Return tanh(x) = sign(x)*(A0 + y*A1 + y^2*A2 + 
+//                                       + y^3*A3 + ... + y^19*A19)
+//    where y = (|x|/a) - b
+//    
+//    For each range there is particular set of coefficients.
+//    Below is the list of ranges:
+//    1/4  <= |x| < 1/2     a = 0.25, b = 1.0
+//    1/2  <= |x| < 1.0     a = 0.5,  b = 1.0
+//    1.0  <= |x| < 2.0     a = 1.0,  b = 1.0
+//    2.0  <= |x| < 3.25    a = 2.0,  b = 1.0
+//    3.25 <= |x| < 4.0     a = 2.0,  b = 2.0
+//    4.0  <= |x| < 6.5     a = 4.0,  b = 1.0
+//    6.5  <= |x| < 8.0     a = 4.0,  b = 2.0
+//    8.0  <= |x| < 13.0    a = 8.0,  b = 1.0
+//    13.0 <= |x| < 16.0    a = 8.0,  b = 2.0
+//    16.0 <= |x| < 19.0625 a = 16.0, b = 1.0
+//    ( [3.25;4.0], [6.5;8.0], [13.0;16.0] subranges separated 
+//                               for monotonicity issues resolve )
+//
+// 4. Saturation path: 19.0625 <= |x| < +INF 
+//    Return tanh(x) = sign(x)*(1.0 - tiny_value)
+//    (tiny_value ~ 2^(-63))
+//
+// Registers used
+//==============================================================================
+// Floating Point registers used: 
+// f8 = input, output
+// f32 -> f64
+//
+// General registers used:  
+// r32 -> r51, r2, r3
+//
+// Predicate registers used:
+// p6, p8, p10, p11, p12, p14, p15
+// p6           arg is zero, denormal or special IEEE
+// p8           to filter out case when signd(x) > 1.625 
+// p10          to filter out case when |x| < 0.25
+// p11          to filter out case when signd(x) <= 1.625 
+// p12          to filter out case when |x| >= 19.0625
+// p14          set to 1 for positive x
+// p15          set to 1 for negative x
+
+// Assembly macros
+//==============================================================================
+rDataPtr           = r2
+rDataPtr1          = r3
+
+rBias              = r33
+rCoeffAddr3        = r34
+rThreeAndQ         = r35
+rCoeffAddr2        = r36
+rMask              = r37
+rArg               = r38
+rSignBit           = r39
+rAbsArg            = r40
+rSaturation        = r41
+rIndex             = r42
+rCoeffAddr1        = r43
+rCoeffAddr4        = r44
+rShiftedArg        = r45
+rShiftedArgMasked  = r46
+rBiasedExpOf4      = r47
+rShiftedAbsArg     = r48
+rArgSgnd           = r49
+r1625Sgnd          = r50
+rTwo               = r51
+
+//==============================================================================
+fA0                = f32
+fA1                = f33
+fA2                = f34
+fA3                = f35
+fA4                = f36
+fA5                = f37
+fA6                = f38
+fA7                = f39
+fA8                = f40
+fA9                = f41
+fA10               = f42
+fA11               = f43
+fA12               = f44
+fA13               = f45
+fA14               = f46
+fA15               = f47
+fA16               = f48
+fA17               = f49
+fA18               = f50
+fA19               = f51
+fArgSqr            = f52
+fArgAbsNorm        = f53
+fSignumX           = f54
+fRes               = f55
+fThreeAndQ         = f56
+fArgAbs            = f57
+fTSqr              = f58
+fTQuadr            = f59
+fTDeg3             = f60
+fTDeg7             = f61
+fArgAbsNormSgn     = f62                          
+fTQuadrSgn         = f63
+fTwo               = f64
+
+// Data tables
+//==============================================================================
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(tanh_data)
+// CAUTION: The order of these table coefficients shouldn't be changed!
+
+// Main path coefficients:
+// Coefficients ##0..15 ("main" coefficient tables)
+// Polynomial coefficients for the tanh(x), 0.25 <= |x| < 0.5 
+data8 0xE9D218BC9A3FB55A, 0x00003FC7 //A19
+data8 0xC8C0D38687F36EBA, 0x00003FCE //A18
+data8 0xA2663E519FAC8A43, 0x0000BFD2 //A17
+data8 0xD913F0490674B0DF, 0x00003FD3 //A16
+data8 0xF75D84789DE0AE52, 0x00003FD6 //A15
+data8 0xACB3C40EEF3A06F0, 0x0000BFD9 //A14
+data8 0xEBD7F5DC02CFD5BA, 0x0000BFDB //A13
+data8 0x8B52CDF66D709E2A, 0x00003FDF //A12
+data8 0x9EC21F28E05C4A3E, 0x00003FE0 //A11
+data8 0xC412B44D0176F3ED, 0x0000BFE4 //A10
+data8 0x97BF35A34DD1EA4C, 0x0000BFE0 //A9
+data8 0xF89F5B39E3A3AA36, 0x00003FE9 //A8
+data8 0xF2BA654BCEEBA433, 0x0000BFEA //A7
+data8 0x8E1C15876AA589AD, 0x0000BFEF //A6
+data8 0x942226246A8C2A86, 0x00003FF1 //A5
+data8 0x8F06D9FF7DB47261, 0x00003FF4 //A4
+//
+// Polynomial coefficients for the tanh(x), 0.5 <= |x| < 1.0 
+data8 0xC4A7B8FB672A8520, 0x00003FDC //A19
+data8 0xA20724B847E13499, 0x0000BFE0 //A18
+data8 0xE17DB53F02E4D340, 0x00003FE2 //A17
+data8 0x90264A1012F4CA6F, 0x0000BFE4 //A16
+data8 0xEBEC9F776F0BF415, 0x0000BFE0 //A15
+data8 0x89AF912B305B45A4, 0x00003FE7 //A14
+data8 0xB4A960B81F5EC36A, 0x0000BFE7 //A13
+data8 0x969A4E95B2DA86B5, 0x0000BFEA //A12
+data8 0x8A3FC0EC082305CB, 0x00003FEC //A11
+data8 0x83D7795BCBE24373, 0x00003FEC //A10
+data8 0xDCBF42AEB82932EC, 0x0000BFEF //A9
+data8 0x83318E61ECAFD804, 0x00003FF0 //A8
+data8 0xEA4DE5746975A914, 0x00003FF2 //A7
+data8 0xCE63E8FA6B96480B, 0x0000BFF4 //A6
+data8 0xDF017BE0D4FE45D8, 0x0000BFF4 //A5
+data8 0xA8A0C6E2226DF3CD, 0x00003FF8 //A4
+//
+// Polynomial coefficients for the tanh(x), 1.0 <= |x| < 2.0 
+data8 0x8E89D2EBFDAA160B, 0x00003FE9 //A19
+data8 0xDD9226310A272046, 0x0000BFEC //A18
+data8 0xA038042D28B0D665, 0x00003FEF //A17
+data8 0x8C04796F03516306, 0x0000BFF1 //A16
+data8 0x9CD6A9CB4E90A2FD, 0x00003FF2 //A15
+data8 0xC8980E166F5A84FD, 0x0000BFF2 //A14
+data8 0x9ADFE65F56B7BCFD, 0x00003FED //A13
+data8 0x8B11FDFB5D0A7B96, 0x00003FF4 //A12
+data8 0x8209A125E829CBFA, 0x0000BFF5 //A11
+data8 0xCF38AAC17B85BD76, 0x00003FF1 //A10
+data8 0xD5C2E248D8AB99AB, 0x00003FF6 //A9
+data8 0xE12BE2785727F2D6, 0x0000BFF7 //A8
+data8 0x9FC9EF90F87BF1E2, 0x00003FF6 //A7
+data8 0x9B02FE0DAF42C08F, 0x00003FF9 //A6
+data8 0xBDACE06F531D9491, 0x0000BFFA //A5
+data8 0xE3048AD1DB2F648C, 0x00003FF9 //A4
+//
+// Polynomial coefficients for the tanh(x), 2.0 <= |x| < 3.25 
+data8 0x856EC3B0330A385A, 0x00003FEB //A19
+data8 0xC641D69DAE2D429C, 0x0000BFF2 //A18
+data8 0xC683EB0BE1343FFF, 0x00003FF5 //A17
+data8 0xC358954224E4E823, 0x0000BFF7 //A16
+data8 0xF813A8D6D396BC5F, 0x00003FF8 //A15
+data8 0xE0ECDFED078D37D6, 0x0000BFF9 //A14
+data8 0x950E4E619855E316, 0x00003FFA //A13
+data8 0x8453B8F93370FB58, 0x0000BFFA //A12
+data8 0xFDBA28430AEC95BA, 0x00003FF7 //A11
+data8 0x9371AAC1FDB1E664, 0x00003FFA //A10
+data8 0xAC972DA97782D88A, 0x0000BFFB //A9
+data8 0xE18F47B10B9CE1BC, 0x00003FFB //A8
+data8 0xAB7C81230BF13BC6, 0x0000BFFB //A7
+data8 0xA6CAAD4A3E31A7D5, 0x0000BFF8 //A6
+data8 0x9CABD76D1D5C3878, 0x00003FFC //A5
+data8 0x92906D077941CAA9, 0x0000BFFD //A4
+//
+// Polynomial coefficients for the tanh(x), 4.0 <= |x| < 6.5 
+data8 0x9232D19F71709AC9, 0x0000BFF5 //A19
+data8 0x819E31323F5DD3F8, 0x00003FF8 //A18
+data8 0xDA8E1CDB8D23DC29, 0x0000BFF9 //A17
+data8 0xE97C7CD8FC0486D8, 0x00003FFA //A16
+data8 0xB0C4AD234D88C9F2, 0x0000BFFB //A15
+data8 0xC5989BFB28FDE267, 0x00003FFB //A14
+data8 0x9B26520EC4EFEE8E, 0x0000BFFB //A13
+data8 0xC4B6F758AD21E574, 0x00003FF9 //A12
+data8 0xCC36E3FFA10D2CFF, 0x00003FFA //A11
+data8 0x8738696FB06A5CED, 0x0000BFFC //A10
+data8 0xD31981825BF39228, 0x00003FFC //A9
+data8 0x82C58FB9BEE43992, 0x0000BFFD //A8
+data8 0x88D5AAE49164B6F3, 0x00003FFD //A7
+data8 0xF4CA0B968AF2DDE2, 0x0000BFFC //A6
+data8 0xB99874B482BD17EE, 0x00003FFC //A5
+data8 0xE93FB2F99431DC1D, 0x0000BFFB //A4
+//
+// Polynomial coefficients for the tanh(x), 8.0 <= |x| < 13.0 
+data8 0xAAA9EB7EADA85CEC, 0x00003FF5 //A19
+data8 0x980C80EE05A6BE78, 0x0000BFF8 //A18
+data8 0x818DA9F5396390A5, 0x00003FFA //A17
+data8 0x8D8CC21E23D8A6A2, 0x0000BFFB //A16
+data8 0xE0EC19E55A886765, 0x00003FFB //A15
+data8 0x8C11197A7E6244C5, 0x0000BFFC //A14
+data8 0x901D2BF203C2F7F3, 0x00003FFC //A13
+data8 0xFEACAEE66EE803E5, 0x0000BFFB //A12
+data8 0xC684E4925E318C3F, 0x00003FFB //A11
+data8 0x8A9D8A970565F28D, 0x0000BFFB //A10
+data8 0xAE34C61DE5CEA4D4, 0x00003FFA //A9
+data8 0xC44C5714BD6208A0, 0x0000BFF9 //A8
+data8 0xC4612F7D6C8BDB79, 0x00003FF8 //A7
+data8 0xABD91DCE40D5EECB, 0x0000BFF7 //A6
+data8 0x80E375C1B847B72F, 0x00003FF6 //A5
+data8 0xA11C7DD978CF700A, 0x0000BFF4 //A4
+//
+// Polynomial coefficients for the tanh(x), 16.0 <= |x| < 19.0625 
+data8 0xE29D17C510F86F6B, 0x00003FF3 //A19
+data8 0x88FE52EB39A3A98C, 0x0000BFF5 //A18
+data8 0xA406547E50360693, 0x00003FF5 //A17
+data8 0x83E6260B71C6D7DE, 0x0000BFF5 //A16
+data8 0xA36AB5B0CBC97B85, 0x00003FF4 //A15
+data8 0xA94931E0B7BA6C14, 0x0000BFF3 //A14
+data8 0x9A4596DAF350AD63, 0x00003FF2 //A13
+data8 0xFE47643F375AECA5, 0x0000BFF0 //A12
+data8 0xBF8433C5ABEE63B1, 0x00003FEF //A11
+data8 0x83CEE05D7AE90A0A, 0x0000BFEE //A10
+data8 0xA4CC45480BCEB02D, 0x00003FEC //A9
+data8 0xB967CBDCBC16CB10, 0x0000BFEA //A8
+data8 0xB9681B214EDC098D, 0x00003FE8 //A7
+data8 0xA23B20D87B80DFA8, 0x0000BFE6 //A6
+data8 0xF358B2C46F10CBAF, 0x00003FE3 //A5
+data8 0x98176FD06229A385, 0x0000BFE1 //A4
+//
+// Binary subranges
+// Polynomial coefficients for the tanh(x), 3.25 <= |x| < 4.0 
+data8 0xEF2EE841288F6706, 0x00003FE9 //A19
+data8 0xE65D5B74B85F82A6, 0x00003FEB //A18
+data8 0xE495FC21E42A79FF, 0x00003FEA //A17
+data8 0xF99B267A913CF3E5, 0x00003FEC //A16
+data8 0xFE3D700F4A0A0FDE, 0x0000BFEC //A15
+data8 0x8F91BB4EE4E4EA52, 0x00003FEE //A14
+data8 0xBCA9F41A5C6EF8BA, 0x0000BFEE //A13
+data8 0xF93E00884027A9CF, 0x00003FED //A12
+data8 0xC4D4036A61BABC2F, 0x00003FEF //A11
+data8 0x86CC2AD1AD47C7D5, 0x0000BFF2 //A10
+data8 0xD3065DEF4CE9AD32, 0x00003FF3 //A9
+data8 0x82C44125F568D54E, 0x0000BFF5 //A8
+data8 0x88D588729BAF14CA, 0x00003FF6 //A7
+data8 0xF4CA0661307243C7, 0x0000BFF6 //A6
+data8 0xB998746D57061F74, 0x00003FF7 //A5
+data8 0xE93FB2F482327C19, 0x0000BFF7 //A4
+//
+// Polynomial coefficients for the tanh(x), 6.5 <= |x| < 8.0 
+data8 0xEB189B71ADC40BE2, 0x00003FEA //A19
+data8 0xA60B46F9FF6DC2DF, 0x00003FEA //A18
+data8 0xBB061CDD9F368B9D, 0x00003FEC //A17
+data8 0x841E08BDF5429991, 0x0000BFEC //A16
+data8 0xDD33990B433F25BE, 0x00003FED //A15
+data8 0xBA5DE6B870F0A2BB, 0x0000BFEE //A14
+data8 0xA71D489AAA6DACF0, 0x00003FEF //A13
+data8 0x874CCB2B8F3FBC0E, 0x0000BFF0 //A12
+data8 0xCB1D2E9754EA534A, 0x00003FF0 //A11
+data8 0x8BA5ABB53BA6ABCF, 0x0000BFF1 //A10
+data8 0xAE91FD1C2391A32B, 0x00003FF1 //A9
+data8 0xC465A74B798E5761, 0x0000BFF1 //A8
+data8 0xC4666152397D15C1, 0x00003FF1 //A7
+data8 0xABD9E63CA575B950, 0x0000BFF1 //A6
+data8 0x80E38B18E8D0F460, 0x00003FF1 //A5
+data8 0xA11C80E20AAFDD3C, 0x0000BFF0 //A4
+//
+// Polynomial coefficients for the tanh(x), 13.0 <= |x| < 16.0 
+data8 0xBECD0AF7E22E5594, 0x00003FE9 //A19
+data8 0xE2834E2D68C1128C, 0x00003FEA //A18
+data8 0x97B117611B317379, 0x00003FEB //A17
+data8 0xEE91A0D39A772F6B, 0x00003FEA //A16
+data8 0x92F6EC377DCADA4F, 0x00003FEA //A15
+data8 0xD8FCCD6A3277FAB7, 0x00003FE8 //A14
+data8 0xC15AB9CB0C3DCFE0, 0x00003FE7 //A13
+data8 0xC3C659704A7147CD, 0x00003FE2 //A12
+data8 0xFA17F09D27C97912, 0x00003FE4 //A11
+data8 0xF664147182B94788, 0x0000BFE3 //A10
+data8 0xA6C89FA741464DA1, 0x00003FE3 //A9
+data8 0xB90FE464A825EFA8, 0x0000BFE2 //A8
+data8 0xB973AE0FD86EC024, 0x00003FE1 //A7
+data8 0xA23A087F96846951, 0x0000BFE0 //A6
+data8 0xF358D8A7FC012D5D, 0x00003FDE //A5
+data8 0x98176E2309B7C73A, 0x0000BFDD //A4
+//
+// Coefficients ##16..19 ("tail" coefficient tables)
+// Polynomial coefficients for the tanh(x), 0.25 <= |x| < 0.5 
+data8 0x838F209ABB9BA7B3, 0x0000BFF7 //A3
+data8 0xEBC0AC78DA4FC500, 0x0000BFF8 //A2
+data8 0xF0A4D02960B60E69, 0x00003FFC //A1
+data8 0xFACBF534D0E42F8A, 0x00003FFC //A0
+//
+// Polynomial coefficients for the tanh(x), 0.5 <= |x| < 1.0 
+data8 0xC0ECBDC0A0D133A6, 0x0000BFF8 //A3
+data8 0xBA13A076BF8E812F, 0x0000BFFB //A2
+data8 0xC954A37D1A1CA070, 0x00003FFD //A1
+data8 0xEC9A9EBAB4579B29, 0x00003FFD //A0
+//
+// Polynomial coefficients for the tanh(x), 1.0 <= |x| < 2.0 
+data8 0xD42E9175A6EA1397, 0x00003FFB //A3
+data8 0xA3C361378A55CF56, 0x0000BFFD //A2
+data8 0xD706E07CC8622983, 0x00003FFD //A1
+data8 0xC2F7D5A8A79CA2AC, 0x00003FFE //A0
+//
+// Polynomial coefficients for the tanh(x), 2.0 <= |x| < 3.25
+data8 0xAC7A7F8776817C7E, 0x00003FFD //A3
+data8 0x8B7CE95E69FCFE9A, 0x0000BFFD //A2
+data8 0x90B161317028D995, 0x00003FFC //A1
+data8 0xF6CA82F0DE1E9E9A, 0x00003FFE //A0
+//
+// Polynomial coefficients for the tanh(x), 4.0 <= |x| < 6.5
+data8 0xE9E072407BC22DC6, 0x00003FFA //A3
+data8 0xAFA4A913D8E6BB4A, 0x0000BFF9 //A2
+data8 0xAFC2D6A885BAA875, 0x00003FF7 //A1
+data8 0xFFD40B84505A10B2, 0x00003FFE //A0
+//
+// Polynomial coefficients for the tanh(x), 8.0 <= |x| < 13.0
+data8 0xA11C8A1FED168CD5, 0x00003FF2 //A3
+data8 0xF1AAD6B02063A5F5, 0x0000BFEF //A2
+data8 0xF1AADA46AD341C34, 0x00003FEC //A1
+data8 0xFFFFFC39548FC34B, 0x00003FFE //A0
+//
+// Polynomial coefficients for the tanh(x), 16.0 <= |x| < 19.0625
+data8 0x98176FD1F0950C16, 0x00003FDE //A3
+data8 0xE42327BB09C8B2A5, 0x0000BFDA //A2
+data8 0xE42327BB0B154F13, 0x00003FD6 //A1
+data8 0xFFFFFFFFFFF8DEE7, 0x00003FFE //A0
+//
+// Binary subranges
+// Polynomial coefficients for the tanh(x), 3.25 <= |x| < 4.0
+data8 0xE9E072404329293B, 0x00003FF7 //A3
+data8 0xAFA4A913D798300B, 0x0000BFF7 //A2
+data8 0xAFC2D6A885B48567, 0x00003FF6 //A1
+data8 0xFFD40B84505A10B4, 0x00003FFE //A0
+//
+// Polynomial coefficients for the tanh(x), 6.5 <= |x| < 8.0
+data8 0xA11C8A63815F7A28, 0x00003FEF //A3
+data8 0xF1AAD6B65B0EBF53, 0x0000BFED //A2
+data8 0xF1AADA46E799831F, 0x00003FEB //A1
+data8 0xFFFFFC39548FC348, 0x00003FFE //A0
+//
+// Polynomial coefficients for the tanh(x), 13.0 <= |x| < 16.0
+data8 0x98176FE982140A59, 0x00003FDB //A3
+data8 0xE42327B9B0D7202F, 0x0000BFD8 //A2
+data8 0xE42327BB13076BD6, 0x00003FD5 //A1
+data8 0xFFFFFFFFFFF8DEE7, 0x00003FFE //A0
+//
+// Polynomial coefficients for the tanh(x), 0.0 <= |x| < 0.25 
+// ('tanh_near_zero' path)
+data8 0xBF2BA5D26E479D0C //A9
+data8 0x3F4336D96F81EE26 //A8
+data8 0xBF8226E34AE197B0 //A5
+data8 0x3F9664F488148657 //A4
+data8 0xAAAAAAAAAAAAAA99, 0x0000BFFD //A1
+data8 0xBF57D91925BB5EE2 //A7
+data8 0x3F6D6D36C3D5B7A1 //A6
+data8 0xBFABA1BA1BA19D32 //A3
+data8 0x3FC1111111111108 //A2
+//
+// 1.0 - 2^(-63)
+// ('tanh_saturation' path)
+data8 0xFFFFFFFFFFFFFFFF, 0x00003FFE 
+LOCAL_OBJECT_END(tanh_data)
+
+// CAUTION: The order of table coefficients shouldn't be changed!
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(tanh)
+{ .mfi
+      alloc          r32         = ar.pfs, 0, 20, 0, 0
+      fmerge.se      fArgAbsNorm = f1, f8         // normalized x
+      adds           rSignBit    = 0x1, r0        // Bit for sign removing
+}
+{ .mfi
+      addl           rDataPtr    = @ltoff(tanh_data), gp // Data pointer
+      fma.s1         fTwo        = f1, f1, f1            // 2.0 construct
+      addl           rArgSgnd    = 0xfff, r0             // mask for exponent
+};;
+
+{ .mfi
+      getf.d         rArg        = f8       // x in GR 
+      fclass.m       p6,p0       = f8, 0xEF // Filter 0, denormals and specials 
+                            // 0xEF = @qnan|@snan|@pos|@neg|@zero|@unorm|@inf
+      shl            rArgSgnd    = rArgSgnd, 52  // mask for exponent
+}
+{ .mlx
+      ld8            rDataPtr    = [rDataPtr]        // Real data pointer
+      movl           r1625Sgnd   = 0xA000000000000   // 1.625 signd
+      // 1.625 significand used to filter values greater than 3.25, 6.5, 13.0
+      // to enter binary subranges
+};;
+
+{ .mfi
+      addl           rBias       = 0x3FD00, r0       // bias of 0.25 << 8
+      fma.s1         fArgSqr     = f8, f8, f0        // x^2
+      shl            rSignBit    = rSignBit, 63      // mask for sign bit
+}
+{ .mlx
+      addl           rMask       = 0x7FF00, r0          // Mask for index bits
+      movl           rTwo        = 0x4000000000000000   // 2.0
+};;
+
+{ .mfi
+      andcm          rArgSgnd    = rArg, rArgSgnd // Remove exponent
+      nop.f          0
+      shr.u          rShiftedArg = rArg, 44 // Select only necessary bits of arg
+}
+{ .mfb
+      andcm          rAbsArg     = rArg, rSignBit     // Remove sign
+      nop.f          0
+(p6)  br.cond.spnt   _tanh_spec    // Branch to zero, denorm & specs
+};;
+   
+{ .mfi
+      and            rShiftedArgMasked = rShiftedArg, rMask // bias of x << 8
+      fmerge.s       fArgAbs     = f1, f8                   // |x|
+      shr            rShiftedAbsArg    = rAbsArg, 44 // Select only necessary 
+                                                     // bits of absolute arg
+}
+{ .mfi
+      cmp.gt         p8, p11     = rArgSgnd, r1625Sgnd // p8 = 1 if
+      // signd(x) > 1.625 - to filter values greater than 3.25, 6.5, 13.0
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      sub            rIndex      = rShiftedArgMasked, rBias // index << 8
+      nop.f          0 
+      cmp.lt         p10, p0     = rShiftedArgMasked, rBias // p10=1 if |x|<0.25
+}
+{ .mfb
+(p8)  cmp.gt         p8, p11     = rAbsArg, rTwo // If arg is greater than 2.0?
+                                       // (then we should use binary subranges)
+      nop.f          0 
+(p10) br.cond.spnt   tanh_near_zero    // branch out if |x| < 0.25
+};;
+
+.pred.rel "mutex",p8,p11
+{ .mfi
+(p8)  add            rIndex      = 0x400, rIndex // Make pointer to binary 
+                                                 // subranges
+(p11) fms.s1         fArgAbsNorm = fArgAbsNorm, f1, f1     // |x|/b - 1.0
+      addl           rSaturation = 0x40331, r0 // shifted bits of 19.0625
+}
+{ .mfi
+      nop.m          0 
+(p8)  fms.s1         fArgAbsNorm = fArgAbsNorm, f1, fTwo // |x|/b - 2.0
+       // this is only for binary subranges [3.25;4], [6.5;8], [13.0;16]
+      nop.i          0 
+}
+;;
+
+{ .mfi
+      add            rCoeffAddr1 = rDataPtr, rIndex// coeff. ##0,2,..14
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      adds           rCoeffAddr2 = 16, rCoeffAddr1 // Shifted pointer to coeffs
+      fmerge.s       fSignumX    = f8, f1          // signum(x)
+      nop.i          0
+} 
+{ .mfb
+      cmp.le         p12, p0     = rSaturation, rShiftedAbsArg // |x|>=19.0625?
+      nop.f          0
+(p12) br.cond.spnt   tanh_saturation          // branch out if x |x| >= 19.0625
+};;
+
+{.mfi
+      ldfe           fA19        = [rCoeffAddr1], 32 // Load A19
+      nop.f          0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA18        = [rCoeffAddr2], 32 // Load A18
+      nop.f          0
+      adds           rCoeffAddr3 = 0xA00, rDataPtr   // Pointer to "tail"
+                                                     // coefficients tables
+};;
+
+{.mfi
+      ldfe           fA17        = [rCoeffAddr1], 32 // Load A17
+      nop.f          0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA16        = [rCoeffAddr2], 32 // Load A16
+      nop.f          0
+      nop.i          0
+};;
+
+{.mfi
+      ldfe           fA15        = [rCoeffAddr1], 32 // Load A15
+      fma.s1         fTSqr       = fArgAbsNorm, fArgAbsNorm, f0 // x^2
+      shr.u          rIndex      = rIndex, 2 // Index for "tail" tables
+}
+{.mfi
+      ldfe           fA14        = [rCoeffAddr2], 32 // Load A14
+      nop.f          0
+      adds           rCoeffAddr4 = 16, r0            // Shifter pointer
+                                                     // to "tail" tables
+};;
+
+{.mfi
+      ldfe           fA13        = [rCoeffAddr1], 32   // Load A13
+      nop.f          0
+      add            rCoeffAddr3 = rCoeffAddr3, rIndex // "tail" coeffs to load
+                                                       // ##16..23
+}
+{.mfi
+      ldfe           fA12        = [rCoeffAddr2], 32 // Load A12
+      nop.f          0
+      cmp.lt         p15, p14    = rArg, r0          // Arg positive (p14) 
+                                                     // or negative (p15)?
+};;
+
+{.mfi
+      ldfe           fA11        = [rCoeffAddr1], 32        // Load A11
+      nop.f          0
+      add            rCoeffAddr4 = rCoeffAddr3, rCoeffAddr4 // shifted "tail" 
+                                                            // coeffs to load 
+}
+{.mfi
+      ldfe           fA10        = [rCoeffAddr2], 32 // Load A10
+      nop.f          0
+      nop.i          0
+};;
+
+{.mfi
+      ldfe           fA9         = [rCoeffAddr1], 32 // Load A9
+      nop.f          0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA8         = [rCoeffAddr2], 32 // Load A8
+      nop.f          0
+      nop.i          0
+};;
+
+{.mfi
+      ldfe           fA7         = [rCoeffAddr1], 32 // Load A7
+      nop.f          0
+      nop.i          0
+}
+{.mfi
+      ldfe           fA6         = [rCoeffAddr2], 32 // Load A6
+      nop.f          0
+      nop.i          0
+};;
+
+{.mfi
+      ldfe           fA5         = [rCoeffAddr1], 32 // Load A5
+      fma.s1         fTDeg3      = fArgAbsNorm, fTSqr, f0 // x^3
+      nop.i          0
+}
+{.mfi
+      ldfe           fA4         = [rCoeffAddr2], 32 // Load A4
+      fma.s1         fTQuadr     = fTSqr, fTSqr, f0  // x^4
+      nop.i          0
+};;
+
+// Path #3 Polynomial Pol19(y) computation; y = fArgAbsNorm
+{.mfi
+      ldfe           fA3         = [rCoeffAddr3], 32            // Load A3
+      fma.s1         fArgAbsNormSgn = fArgAbsNorm, fSignumX, f0 // sign(x)*x
+      nop.i          0
+}
+{.mfi
+      ldfe           fA2         = [rCoeffAddr4], 32            // Load A2
+      nop.f          0
+      nop.i          0
+};;
+
+{.mfi
+      ldfe           fA1         = [rCoeffAddr3], 32       // Load A1
+      fma.s1         fRes        = fA19, fArgAbsNorm, fA18 // Polynomial
+      nop.i          0
+}
+{.mfi
+      ldfe           fA0         = [rCoeffAddr4], 32       // Load A0
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA17        = fA17, fArgAbsNorm, fA16  // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA15, fArgAbsNorm, fA14  // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTDeg7      = fTDeg3, fTQuadr, f0     // Polynomial
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA13        = fA13, fArgAbsNorm, fA12 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA11        = fA11, fArgAbsNorm, fA10 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA9         = fA9, fArgAbsNorm, fA8   // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes        = fRes, fTSqr, fA17       // Polynomial
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA7         = fA7, fArgAbsNorm, fA6 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA5         = fA5, fArgAbsNorm, f0  // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA15, fTSqr, fA13     // Polynomial  
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA4         = fA4, fArgAbsNorm, fA3 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA2         = fA2, fArgAbsNorm, fA1 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA11        = fA11, fTSqr, fA9 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fA7         = fA7, fTSqr, fA5  // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fRes        = fRes, fTQuadr, fA15 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fA4         = fA4, fTSqr, fA2     // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes        = fRes, fTQuadr, fA11 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0                                       
+      fma.s1         fA4         = fA7, fTDeg3, fA4    // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes        = fRes,  fTDeg7, fA4  // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      // result for negative argument
+(p15) fms.d.s0       f8          = fRes, fArgAbsNormSgn, fA0 // Polynomial
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+      // result for positive argument
+(p14) fma.d.s0       f8          = fRes, fArgAbsNormSgn, fA0 // Polynomial
+      br.ret.sptk    b0
+};;
+
+
+// |x| < 0.25 Path /////////////////////////////////////////////////////////////
+.align 32
+tanh_near_zero:
+{ .mfi
+      adds           rCoeffAddr1 = 0xC80, rDataPtr      // address of A9
+      fma.s0         fTSqr       = fArgSqr, fArgSqr, f0 // x^4 
+      nop.i          0
+}
+{ .mfi
+      adds           rCoeffAddr2 = 0xCB0, rDataPtr      // address of A7
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      ldfpd          fA9, fA8    = [rCoeffAddr1], 16 // Load A9, A8
+      nop.f          0
+      nop.i          0
+}
+{ .mfi
+      ldfpd          fA7, fA6    = [rCoeffAddr2], 16 // Load A7, A6
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      ldfpd          fA5, fA4    = [rCoeffAddr1], 16 // Load A5, A4
+      nop.f          0
+      nop.i          0
+}
+{ .mfi
+      ldfpd          fA3, fA2    = [rCoeffAddr2], 16 // Load A3, A2
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA1         = [rCoeffAddr1] // Load A1
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTQuadr     = fTSqr, fTSqr, f0 // x^4
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes        = fA9, fArgSqr, fA8 // Polynomial
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA7         = fA7, fArgSqr, fA6 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA3         = fA3, fArgSqr, fA2 // Polynomial
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA5         = fA5, fArgSqr, fA4 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA1         = fA1, fArgSqr, f0 // Polynomial
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fTQuadrSgn  = fTQuadr, f8, f0  // x^4 * x
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes        = fRes, fTSqr, fA7 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA1         = fA3, fTSqr, fA1 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes        = fRes, fTSqr, fA5 // Polynomial
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes        = fRes, fTQuadr, fA1 // Polynomial
+      nop.i          0
+};;
+
+{ .mfb
+      nop.m          0
+      fma.d.s0       f8          = fRes, f8, f8 // x+x*Polynomial
+      br.ret.sptk    b0                         // Exit for |x| < 0.25
+};;
+
+
+
+
+
+// 19.0625 <= |x| < +inf Saturation path ///////////////////////////////////////
+.align 32
+tanh_saturation:
+{ .mfi
+      adds           rDataPtr    = 0xCD0, rDataPtr  // address of A0
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA0         = [rDataPtr]       // Load  A0 = 2^(-63)
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfb
+      nop.m          0
+      fma.d.s0       f8          = fA0, fSignumX, f0 // sign(x)*(1.0-2^(-63))
+      br.ret.sptk    b0                       // Exit for 19.0625 <=|x|< +inf
+};;
+
+
+
+
+      
+//  0, denormals and special IEEE numbers path /////////////////////////////////
+_tanh_spec:
+
+{ .mfi 
+      cmp.lt         p15, p14    = rArg, r0 // Is arg negative (p15) 
+                                            // or positive p14)
+      fclass.m       p6,p0       = f8, 0x23 // To filter infinities
+                                          // 0x23 = @pos|@neg|@inf 
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fclass.m       p7,p0       = f8, 0xC7 // To filter NaNs & Zeros
+                                 // 0xC7 = @pos|@neg|@zero|@qnan|@snan
+      nop.i          0
+};;
+
+{ .mfb 
+      nop.m          0
+(p6)  fmerge.s       f8          = f8, f1     // +/-1 for INF args 
+(p6)  br.ret.spnt    b0                       // exit for x = INF
+};;
+
+{ .mfb 
+      nop.m          0
+(p7)  fma.d.s0       f8          = f8, f1, f8    // +/-0 for 0 args 
+                                                 // and NaNs for NaNs
+(p7)  br.ret.spnt    b0                          // exit for x = NaN or +/-0
+};;
+
+{ .mfi 
+      nop.m          0
+      fnorm.s0       f8          = f8            // Normalize arg
+      nop.i          0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m          0
+(p14) fnma.d.s0      f8          = f8, f8, f8  // res = r-r^2
+      nop.i          0
+}
+{ .mfb 
+      nop.m          0
+(p15) fma.d.s0       f8          = f8, f8, f8  // res = r+r^2
+      br.ret.sptk    b0          // 0, denormals, specials return
+};;
+
+GLOBAL_LIBM_END(tanh)
+
+
diff --git a/sysdeps/ia64/fpu/s_tanhf.S b/sysdeps/ia64/fpu/s_tanhf.S
new file mode 100644
index 0000000000..e4e91cfe63
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_tanhf.S
@@ -0,0 +1,581 @@
+.file "tanhf.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 05/30/01 Initial version
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 02/10/03 Reordered header: .section, .global, .proc, .align
+// 03/31/05 Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// float tanhf(float)
+//
+// Overview of operation
+//==============================================================
+// Background
+//
+//
+// There are 9 paths:
+// 1. x = +/-0.0
+//    Return tanhf(x) = +/-0.0
+//
+// 2. 0.0 < |x| < 0.3125
+//    Return tanhf(x) = x + x^3*Pol3(x^2),
+//    where Pol3(x^2) = C3*x^6 + C2*x^4 + C1*x^2 + C0
+//
+// 3. 0.3125 <= |x| < 8.0
+//    Return tanhf(x) = sign(x)*PolD(x)*PolC(|x|) + sign(x)*PolA(|x|),
+//    where sign(x)*PolD(x) = sign(x)*(|x|^7 + D2*x^6 + D1*|x|^5 + D0*x^4),
+//          PolC(|x|) = B0*x^4 + C3*|x|^3 + C2*|x|^2 + C1*|x| + C0,
+//          PolA(|x|) = A3|x|^3 + A2*x^2 + A1*|x| + A0
+//
+//    Actually range 0.3125<=|x|< 8.0 is split to 5 subranges.
+//    For each subrange there is particular set of coefficients.
+//    Below is the list of subranges:
+//    3.1 0.3125 <= |x| < 0.5
+//    3.2 0.5 <= |x| < 1.0
+//    3.3 1.0 <= |x| < 2.0
+//    3.4 2.0 <= |x| < 4.0
+//    3.5 4.0 <= |x| < 8.0
+//
+// 4. 8.0 <= |x| < 9.125
+//    Return tanhf(x) = sign(x)*(A3|x|^3 + A2*x^2 + A1*|x| + A0)
+//
+// 5. 9.125 <= |x| < +INF
+//    Return tanhf(x) = sign(x)*(1.0d - 2^(-52))
+//
+// 6. |x| = INF
+//    Return tanhf(x) = sign(x) * 1.0
+//
+// 7. x = [S,Q]NaN 
+//    Return tanhf(x) = QNaN
+//
+// 8. x is positive denormal
+//    Return tanhf(x) = x - x^2
+//
+// 9. x is negative denormal
+//    Return tanhf(x) = x + x^2
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8, input
+// f32 -> f59
+
+// General registers used:  
+// r32 -> r46, r2, r3
+
+// Predicate registers used:
+// p0, p6 -> p15
+
+// p6           to filter out case when x = [Q,S]NaN or +/-0
+// p7           to filter out case when x = denormal
+// p8           set if |x| >= 0.3125, used also to process denormal input
+// p9           to filter out case when |x| = inf
+// p10          to filter out case when |x| < 0.3125
+// p11          to filter out case when 0.3125 <= |x| < 9.125
+// p12          to filter out case when |x| >= 9.125
+// p13          to filter out case when 8.0 <= |x| < 9.125
+// p14          set to 1 for positive x
+// p15          set to 1 for negative x
+
+// Assembly macros
+//==============================================================
+rDataPtr           = r2
+rDataPtr1          = r3
+
+rBias              = r33
+rCoeffAddr3        = r34
+rNearSaturation    = r35
+rCoeffAddr1        = r36
+rCoeffAddr2        = r37
+rOffset2           = r38
+rBias2             = r39
+rMask              = r40
+rArg               = r41
+rBound             = r42
+rSignBit           = r43
+rAbsArg            = r44
+rDataPtr2          = r45
+rSaturation        = r46
+
+//==============================================================
+fA0                = f32
+fA1                = f33
+fA2                = f34
+fA3                = f35
+fC0                = f36
+fC1                = f37
+fC2                = f38
+fC3                = f39
+fD0                = f40
+fD1                = f41
+fD2                = f42
+fB0                = f43
+fArgSqr            = f44
+fAbsArg            = f45
+fSignumX           = f46
+fArg4              = f47
+fArg4Sgn           = f48
+fArg3              = f49
+fArg3Sgn           = f50
+fArg7Sgn           = f51
+fArg6Sgn           = f52
+fPolC              = f53
+fPolCTmp           = f54
+fPolA              = f55
+fPolATmp           = f56
+fPolD              = f57
+fPolDTmp           = f58
+fArgSqrSgn         = f59
+
+// Data tables
+//==============================================================
+
+RODATA
+
+.align 16
+
+LOCAL_OBJECT_START(tanhf_data)
+// Polynomial coefficients for the tanh(x), 0.3125 <= |x| < 0.5
+data8 0x3F9BEEDFDD177D7B // C0
+data8 0x3F970D10C7F32458 // C1
+data8 0x3F766D6B051F3A38 // C2
+data8 0xBF732F2001B23402 // C3
+data8 0xBF854BE1CE1ED499 // D0
+data8 0x4013C944F3999A16 // D1
+data8 0xC01106C6975222C0 // D2
+data8 0x3F783D5ACCF9EBE8 // B0
+// Polynomial coefficients for the tanh(x), 0.5 <= |x| < 1.0
+data8 0xBF5D631440786869 // C0
+data8 0xBF575D79A0D52069 // C1
+data8 0xBF7E2237B7EFC705 // C2
+data8 0x3F6A7ACBC273041F // C3
+data8 0xC040E32EA52D91EB // D0
+data8 0x403D19463E5DB4D7 // D1
+data8 0xC02216F61F759F39 // D2
+data8 0xBF55B4EA0B844BE7 // B0
+// Polynomial coefficients for the tanh(x), 1.0 <= |x| < 2.0
+data8 0x3F8637DBE5B3E690 // C0
+data8 0xBF7F7FEC158C07F5 // C1
+data8 0x3F711C586706838A // C2
+data8 0xBF50EF7EF605554E // C3
+data8 0xC054D45448354E25 // D0
+data8 0x404ADFEEA282E730 // D1
+data8 0xC028AEE456D59549 // D2
+data8 0x3F25232D1BED59A8 // B0
+// Polynomial coefficients for the tanh(x), 2.0 <= |x| < 4.0
+data8 0xBF52602285F2D06C // C0
+data8 0x3F2E57C298FFE1E0 // C1
+data8 0xBF15ED575DB3C811 // C2
+data8 0x3EE428878A08525C // C3
+data8 0xC0895A26849039C1 // D0
+data8 0x406E3C60BBFBB575 // D1
+data8 0xC03A06F62867C75A // D2
+data8 0xBEB114C70F1C723E // B0
+// Polynomial coefficients for the tanh(x), 4.0 <= |x| < 8.0
+data8 0x3EF4B22BD17039A3 // C0
+data8 0xBEB704ADC040C57F // C1
+data8 0x3E937A98288AFE1A // C2
+data8 0xBE4F33B2C9FFE7E7 // C3
+data8 0xC0BE48CFADE2431E // D0
+data8 0x4090E74249760FDD // D1
+data8 0xC04B6F537FCF2F1E // D2
+data8 0x3E0DCD879C91ADEA // B0
+// Polynomial coefficients for the tanh(x), -0.3125 < x < 0.3125 
+data8 0xBFD555551E8245B7 // A0
+data8 0x3FC110E63F52E689 // A1
+data8 0xBFAB8CD6A5B7BAFA // A2
+data8 0x3F945D467FCEB553 // A3
+// Polynomial coefficients for the tanh(x), 0.3125 <= |x| < 0.5
+data8 0xBE3DCC92FCAECBB6 // A0
+data8 0x3FF0000043B7D267 // A1
+data8 0xBED18BF28ACFC4B1 // A2
+data8 0xBFD554A56F82837E // A3
+// Polynomial coefficients for the tanh(x), 0.5 <= |x| < 1.0
+data8 0x3EFD6054758539F9 // A0
+data8 0x3FEFFBFC77198EBE // A1
+data8 0x3F700327CA98D237 // A2
+data8 0xBFD68955F5BB2FA1 // A3
+// Polynomial coefficients for the tanh(x), 1.0 <= |x| < 2.0
+data8 0xBF71A53F229DF01B // A0
+data8 0x3FF0AECFD730DE50 // A1
+data8 0xBFC882F88E5DF3BA // A2
+data8 0x3FC6EDF212CA2A8D // A3
+// Polynomial coefficients for the tanh(x), 2.0 <= |x| < 4.0
+data8 0xBFAF0B712E9EDA47 // A0
+data8 0x3FF1C208080BEA64 // A1
+data8 0x3FC3D29B20C8946E // A2
+data8 0xBFF04514ED900A6A // A3
+// Polynomial coefficients for the tanh(x), 4.0 <= |x| < 8.0
+data8 0xBFB1DEA49A831CBC // A0
+data8 0x3FFA729FC7085674 // A1
+data8 0xBFF2F44D923A8FA4 // A2
+data8 0x3FE092FC5712227E // A3
+// Polynomial coefficients for the tanh(x), 8.0 <= |x| <= 9.125 
+data8 0x3FEFFF5769EE3041 // A0
+data8 0x3EFBBF148D850891 // A1
+data8 0xBEC86BCEF0F5C2FE // A2
+data8 0x3E7CBA4F3A885A5C // A3
+//
+data8 0x3FEFFFFFFFFFFFFF // 1.0 - epsilon
+LOCAL_OBJECT_END(tanhf_data)
+
+.section .text
+GLOBAL_LIBM_ENTRY(tanhf)
+
+{ .mfi
+      alloc          r32 = ar.pfs, 1, 14, 0, 0
+      fmerge.s       fAbsArg = f1, f8             // |x|
+      addl           rMask = 0x806, r0
+}
+{ .mfi
+      addl           rDataPtr = @ltoff(tanhf_data), gp
+      fma.s1         fArgSqr = f8, f8, f0         // x^2
+      adds           rSignBit = 0x1, r0
+}
+;;
+
+{ .mfi
+      getf.s         rArg = f8                    // x in GR 
+      fclass.m       p7,p0 = f8, 0x0b             // is x denormal ?
+      // sign bit and 2 most bits in significand
+      shl            rMask = rMask, 20               
+}
+{ .mfi
+      ld8            rDataPtr = [rDataPtr]
+      nop.f          0
+      adds           rBias2 = 0x1F4, r0
+}
+;;
+
+{ .mfi
+      adds           rNearSaturation = 0x14, r0
+      fmerge.s       fSignumX = f8, f1            // signum(x)
+      shl            rSignBit = rSignBit, 31      // mask for sign bit
+}
+{ .mfi
+      adds           rBound = 0x3EA, r0
+      nop.f          0
+      addl           rSaturation = 0x4112, r0
+}
+;;
+
+{ .mfi
+      andcm          rOffset2 = rArg, rMask
+      fclass.m       p6,p0 = f8, 0xc7             // is x [S,Q]NaN or +/-0 ?
+      shl            rBound = rBound, 20          // 1.0f in GR
+}
+{ .mfb
+      andcm          rAbsArg = rArg, rSignBit     // |x| in GR
+      nop.f          0
+(p7)  br.cond.spnt   tanhf_denormal               // branch out if x is denormal
+}
+;;
+
+{ .mfi
+      adds           rCoeffAddr2 = 352, rDataPtr
+      fclass.m       p9,p0 = f8, 0x23            // is x +/- inf?
+      shr            rOffset2 = rOffset2, 21
+}
+{ .mfi
+      cmp.lt         p10, p8 = rAbsArg, rBound   // |x| < 0.3125? 
+      nop.f          0
+      adds           rCoeffAddr3 = 16, rDataPtr
+}
+;;
+
+{ .mfi
+(p8)  sub            rBias = rOffset2, rBias2
+      fma.s1         fArg4 = fArgSqr, fArgSqr, f0 // x^4
+      shl            rSaturation = rSaturation, 16
+}
+{ .mfb
+(p10) adds           rBias = 0x14, r0
+(p6)  fma.s.s0       f8 = f8,f1,f8                // NaN or +/-0
+(p6)  br.ret.spnt    b0                           // exit for x = NaN or +/-0
+}
+;;
+
+{ .mfi
+      shladd         rCoeffAddr1 = rBias, 4, rDataPtr
+      fma.s1         fArg3Sgn = fArgSqr, f8, f0  // sign(x)*|x|^3
+      // is |x| < 9.125? 
+      cmp.lt         p11, p12 = rAbsArg, rSaturation  
+}
+{ .mfi
+      shladd         rCoeffAddr3 = rBias, 4, rCoeffAddr3
+      fma.s1         fArg3 = fArgSqr, fAbsArg, f0 // |x|^3
+      shladd         rCoeffAddr2 = rBias, 3, rCoeffAddr2
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fC0, fC1 = [rCoeffAddr1]
+(p9)  fmerge.s       f8 = f8,f1                   // +/- inf
+(p12) adds           rDataPtr = 544, rDataPtr 
+}
+{ .mfb
+(p11) ldfpd          fC2, fC3 = [rCoeffAddr3], 16
+      nop.f          0
+(p9)  br.ret.spnt    b0                           // exit for x = +/- inf
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fA0, fA1 = [rCoeffAddr2], 16
+      nop.f          0
+(p8)  cmp.eq.unc     p13, p0 = rBias, rNearSaturation
+}
+{ .mfi
+      add            rCoeffAddr1 = 48, rCoeffAddr1
+      nop.f          0
+      nop.i          0
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fD0, fD1 = [rCoeffAddr3]
+      nop.f          0
+      nop.i          0
+}
+{ .mfb
+(p11) ldfpd          fD2, fB0 = [rCoeffAddr1]
+      // sign(x)*|x|^2
+      fma.s1         fArgSqrSgn = fArgSqr, fSignumX, f0
+(p10) br.cond.spnt   tanhf_near_zero
+}
+;;
+
+{ .mfi
+(p11) ldfpd          fA2, fA3 = [rCoeffAddr2], 16
+      fcmp.lt.s1     p15, p14 = f8,f0
+      nop.i          0
+}
+{ .mfb
+(p12) ldfd           fA0 = [rDataPtr]
+      fma.s1         fArg4Sgn = fArg4, fSignumX, f0 // sign(x)*|x|^4
+(p12) br.cond.spnt   tanhf_saturation
+}
+;;
+{ .mfi
+      nop.m          0
+      fma.s1         fArg7Sgn = fArg4, fArg3Sgn, f0  // sign(x)*|x|^7
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+      fma.s1         fArg6Sgn = fArg3, fArg3Sgn, f0  // sign(x)*|x|^6
+(p13) br.cond.spnt   tanhf_close_to_saturation      
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolC = fC3, fAbsArg, fC2    // C3*|x| + C2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fPolCTmp = fC1, fAbsArg, fC0 // C1*|x| + C0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolA = fA1, fAbsArg, fA0    // A1*|x| + A0
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolD = fD1, fAbsArg, fD0    // D1*|x| + D0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      // sign(x)*(|x|^7 + D2*x^6)
+      fma.s1         fPolDTmp = fArg6Sgn, fD2, fArg7Sgn
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolATmp = fA3, fAbsArg, fA2  // A3*|x| + A2 
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fB0 = fB0, fArg4, f0          // B0*x^4
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      // C3*|x|^3 + C2*x^2 + C1*|x| + C0
+      fma.s1         fPolC = fPolC, fArgSqr, fPolCTmp  
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      // PolD = sign(x)*(|x|^7 + D2*x^6 + D1*|x|^5 + D0*x^4)
+      fma.d.s1       fPolD = fPolD, fArg4Sgn, fPolDTmp  
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      // PolA = A3|x|^3 + A2*x^2 + A1*|x| + A0 
+      fma.d.s1       fPolA = fPolATmp, fArgSqr, fPolA 
+      nop.i          0
+}
+;;                 
+
+{ .mfi
+      nop.m          0
+      // PolC = B0*x^4 + C3*|x|^3 + C2*|x|^2 + C1*|x| + C0 
+      fma.d.s1       fPolC = fPolC, f1, fB0 
+      nop.i          0
+}
+;;     
+
+{ .mfi
+      nop.m          0
+(p14) fma.s.s0       f8 = fPolC, fPolD, fPolA     // for positive x
+      nop.i          0                           
+}
+{ .mfb
+      nop.m          0
+(p15) fms.s.s0       f8 = fPolC, fPolD, fPolA     // for negative x
+      br.ret.sptk    b0                           // Exit for 0.3125 <=|x|< 8.0
+};;
+
+
+// Here if |x| < 0.3125
+tanhf_near_zero:
+{ .mfi
+      nop.m          0
+      fma.s1         fPolC = fC3, fArgSqr, fC2    // C3*x^2 + C2
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fPolCTmp = fC1, fArgSqr, fC0  // C1*x^2 + C0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fPolC = fPolC, fArg4, fPolCTmp // C3*x^6 + C2*x^4 + C1*x^2 + C0
+      nop.i          0
+};;
+
+{ .mfb
+      nop.m          0
+      // x + x^3*(C3*x^6 + C2*x^4 + C1*x^2 + C0)
+      fma.s.s0       f8 = fPolC, fArg3Sgn, f8
+      br.ret.sptk    b0                           // Exit for |x| < 0.3125
+};;
+
+// Here if 9.125 <= |x| < +inf
+tanhf_saturation:
+{ .mfb
+      nop.m          0
+      fma.s.s0       f8 = fA0, fSignumX, f0       // sign(x)*(1.0d - 2^(-52))
+      // Exit for 9.125 <= |x| < +inf
+      br.ret.sptk    b0                           // Exit for 9.125 <=|x|< +inf
+}
+;;
+      
+// Here if  8.0 <= |x| < 9.125
+tanhf_close_to_saturation:
+{ .mfi
+      nop.m          0
+      fma.s1         fPolATmp = fA1, fAbsArg, fA0 // A1*|x| + A0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fPolA = fA3, fAbsArg, fA2    // A3*|x| + A2
+      nop.i          0
+}    
+;;
+
+.pred.rel "mutex", p14, p15
+{ .mfi
+      nop.m          0
+      // for positive x
+(p14) fma.s.s0       f8 = fPolA, fArgSqr, fPolATmp
+      nop.i          0                           
+}
+{ .mfb
+      nop.m          0
+      // for negative x
+(p15) fms.s.s0       f8 = fPolA, fArgSqrSgn, fPolATmp
+      br.ret.sptk    b0                           // Exit for 8.0 <=|x|< 9.125
+};;
+
+// Here if x is single precision denormal
+tanhf_denormal:
+{ .mfi
+      nop.m          0
+      fclass.m       p7,p8 = f8, 0x0a             // is x -denormal ?
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+(p7)  fma.s.s0       f8 = f8,f8,f8                // -denormal
+      nop.i          0
+}
+{ .mfb
+      nop.m          0
+(p8)  fnma.s.s0      f8 = f8,f8,f8                // +denormal
+      br.ret.sptk    b0                           // Exit for denormal
+}
+;;
+
+GLOBAL_LIBM_END(tanhf)
diff --git a/sysdeps/ia64/fpu/s_tanhl.S b/sysdeps/ia64/fpu/s_tanhl.S
new file mode 100644
index 0000000000..3435f4313e
--- /dev/null
+++ b/sysdeps/ia64/fpu/s_tanhl.S
@@ -0,0 +1,1348 @@
+.file "tanhl.s"
+
+
+// Copyright (c) 2001 - 2003, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 11/29/01  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 08/14/02  Changed mli templates to mlx
+// 02/10/03  Reordered header: .section, .global, .proc, .align
+//
+// API
+//==============================================================
+// long double tanhl(long double)
+//
+// Overview of operation
+//==============================================================
+//
+// Algorithm description
+// ---------------------
+//
+// There are 4 paths:
+//
+// 1. Special path: x = 0, Inf, NaNs, denormal
+//    Return tanhl(x) = +/-0.0 for zeros
+//    Return tanhl(x) = QNaN for NaNs
+//    Return tanhl(x) = sign(x)*1.0 for Inf
+//    Return tanhl(x) = x + x^2   for - denormals
+//    Return tanhl(x) = x - x^2   for + denormals
+//
+// 2. [0;1/8] path: 0.0 < |x| < 1/8
+//    Return tanhl(x) = x + x^3*A3 + ... + x^15*A15
+//
+// 3. Main path: 1/8 <= |x| < 22.8
+//    For several ranges of 1/8 <= |x| < 22.8
+//    Return tanhl(x) = sign(x)*((A0H+A0L) + y*(A1H+A1L) + y^2*(A2H+A2L) + 
+//                                       + y^3*A3 + y^4*A4 + ... + y^25*A25 )
+//    where y = (|x|/a) - b
+//
+//    For each range there is particular set of coefficients.
+//    Below is the list of ranges:
+//    1/8  <= |x| < 1/4     a = 0.125, b = 1.5
+//    1/4  <= |x| < 1/2     a = 0.25,  b = 1.5
+//    1/2  <= |x| < 1.0     a = 0.5,   b = 1.5
+//    1.0  <= |x| < 2.0     a = 1.0,   b = 1.5
+//    2.0  <= |x| < 3.25    a = 2.0,   b = 1.5
+//    3.25 <= |x| < 4.0     a = 2.0,   b = 2.0
+//    4.0  <= |x| < 6.5     a = 4.0,   b = 1.5
+//    6.5  <= |x| < 8.0     a = 4.0,   b = 2.0
+//    8.0  <= |x| < 13.0    a = 8.0,   b = 1.5
+//    13.0 <= |x| < 16.0    a = 8.0,   b = 2.0
+//    16.0 <= |x| < 22.8    a = 16.0,  b = 1.5
+//    ( [3.25;4.0], [6.5;8.0], [13.9;16.0] subranges separated 
+//                               for monotonicity issues resolve )
+//
+// 4. Saturation path: 22.8 <= |x| < +INF 
+//    Return tanhl(x) = sign(x)*(1.0 - tiny_value)
+//    (tiny_value ~ 1e-1233)
+//
+// Implementation notes
+// --------------------
+//
+// 1. Special path: x = 0, INF, NaNa, denormals
+//
+//    This branch is cut off by one fclass operation.
+//    Then zeros+nans, infinities and denormals processed separately.
+//    For denormals we use simple fma operaton x+x*x (- for +denorms)
+//
+// 2. [0;1/8] path: 0.0 < |x| < 1/8
+//
+//    Here we use simple polynimial computations, where last step
+//    is performed as x + x^3*A3+...
+//    The rest of polynomial is factorized using binary tree technique.
+//
+// 3. Main path: 1/8 <= |x| < 22.8
+//
+//    Multiprecision have to be performed only for first few
+//    polynomial iterations (up to 3-rd x degree)
+//    Here we use the same parallelisation way as above:
+//    Split whole polynomial to first, "multiprecision" part, and second, 
+//    so called "tail", native precision part.
+//
+//    1) Multiprecision part:  
+//    [v1=(A0H+A0L)+y*(A1H+A1L)] + [v2=y^2*((A2H+A2L)+y*A3)]
+//    v1 and v2 terms calculated in parallel
+//
+//    2) Tail part:
+//    v3 = x^4 * ( A4 + x*A5 + ... + x^21*A25 )
+//    v3 is splitted to 2 even parts (10 coefficient in each one).
+//    These 2 parts are also factorized using binary tree technique.
+//    
+//    So Multiprecision and Tail parts cost is almost the same
+//    and we have both results ready before final summation.
+//
+//    Some tricks were applied to maintain symmetry at direct
+//    rounding modes (to +/-inf). We had to set result sign
+//    not at the last operation but much more earlier and at
+//    several places.
+//
+// 4. Saturation path: 22.8 <= |x| < +INF 
+//
+//    We use formula sign(x)*(1.0 - tiny_value) instead of simple sign(x)*1.0
+//    just to meet IEEE requirements for different rounding modes in this case.
+//
+// Registers used
+//==============================================================
+// Floating Point registers used: 
+// f8 - input & output
+// f32 -> f92
+
+// General registers used:  
+// r2, r3, r32 -> r52 
+
+// Predicate registers used:
+// p0, p6 -> p11, p14, p15
+
+// p6  - arg is zero, denormal or special IEEE
+// p7  - arg is in [16;32] binary interval
+// p8  - arg is in one of subranges 
+//         [3.25;4.0], [6.5;8.0], [13.9;16.0]
+// p9  - arg < 1/8
+// p10  - arg is NOT in one of subranges 
+//         [3.25;4.0], [6.5;8.0], [13.9;16.0]
+// p11 - arg in saturation domain
+// p14 - arg is positive
+// p15 - arg is negative
+
+// Assembly macros
+//==============================================================
+rDataPtr           = r2
+rTailDataPtr       = r3
+
+rBias              = r33
+rSignBit           = r34
+rInterval          = r35
+
+rArgExp            = r36
+rArgSig            = r37
+r3p25Offset        = r38
+r2to4              = r39
+r1p25              = r40
+rOffset            = r41
+r1p5               = r42
+rSaturation        = r43
+r1625Sign          = r44
+rTiny              = r45
+rAddr1             = r46
+rAddr2             = r47
+rTailAddr1         = r48
+rTailAddr2         = r49
+rTailOffset        = r50
+rTailAddOffset     = r51
+rShiftedDataPtr    = r52
+
+//==============================================================
+fA0H               = f32
+fA0L               = f33
+fA1H               = f34
+fA1L               = f35
+fA2H               = f36
+fA2L               = f37
+fA3                = f38
+fA4                = f39
+fA5                = f40
+fA6                = f41
+fA7                = f42
+fA8                = f43
+fA9                = f44
+fA10               = f45
+fA11               = f46
+fA12               = f47
+fA13               = f48
+fA14               = f49
+fA15               = f50
+fA16               = f51
+fA17               = f52
+fA18               = f53
+fA19               = f54
+fA20               = f55 
+fA21               = f56 
+fA22               = f57 
+fA23               = f58
+fA24               = f59
+fA25               = f60
+
+fArgSqr            = f61
+fArgCube           = f62
+fArgFour           = f63
+fArgEight          = f64
+
+fArgAbsNorm        = f65
+fArgAbsNorm2       = f66
+fArgAbsNorm2L      = f67
+fArgAbsNorm3       = f68
+fArgAbsNorm4       = f69
+fArgAbsNorm11      = f70
+
+fRes               = f71
+fResH              = f72
+fResL              = f73
+fRes1H             = f74
+fRes1L             = f75
+fRes1Hd            = f76
+fRes2H             = f77
+fRes2L             = f78
+fRes3H             = f79
+fRes3L             = f80
+fRes4              = f81
+
+fTT                = f82 
+fTH                = f83
+fTL                = f84
+fTT2               = f85 
+fTH2               = f86
+fTL2               = f87
+
+f1p5               = f88
+f2p0               = f89
+fTiny              = f90
+fSignumX           = f91
+fArgAbsNorm4X      = f92
+
+// Data tables
+//==============================================================
+RODATA
+
+.align 16
+LOCAL_OBJECT_START(tanhl_data)
+
+////////// Main tables ///////////
+_0p125_to_0p25_data: // exp = 2^-3
+// Polynomial coefficients for the tanh(x), 1/8 <= |x| < 1/4 
+data8 0x93D27D6AE7E835F8, 0x0000BFF4 //A3 = -5.6389704216278164626050408239e-04
+data8 0xBF66E8668A78A8BC //A2H = -2.7963640930198357253955165902e-03
+data8 0xBBD5384EFD0E7A54 //A2L = -1.7974001252014762983581666453e-20
+data8 0x3FBEE69E31DB6156 //A1H = 1.2070645062647619716322822114e-01
+data8 0x3C43A0B4E24A3DCA //A1L = 2.1280460108882061756490131241e-18
+data8 0x3FC7B8FF903BF776 //A0H = 1.8533319990813951205765874874e-01
+data8 0x3C593F1A61986FD4 //A0L = 5.4744612262799573374268254539e-18
+data8 0xDB9E6735560AAE5A, 0x0000BFA3 //A25 = -3.4649731131719154051239475238e-28
+data8 0xF0DDE953E4327704, 0x00003FA4 //A24 = 7.6004173864565644629900702857e-28
+data8 0x8532AED11DEC5612, 0x00003FAB //A23 = 5.3798235684551098715428515761e-26
+data8 0xAEF72A34D88B0038, 0x0000BFAD //A22 = -2.8267199091484508912273222600e-25
+data8 0x9645EF1DCB759DDD, 0x0000BFB2 //A21 = -7.7689413112830095709522203109e-24
+data8 0xA5D12364E121F70F, 0x00003FB5 //A20 = 6.8580281614531622113161030550e-23
+data8 0x9CF166EA815AC705, 0x00003FB9 //A19 = 1.0385615003184753213024737634e-21
+data8 0x852B1D0252498752, 0x0000BFBD //A18 = -1.4099753997949827217635356478e-20
+data8 0x9270F5716D25EC9F, 0x0000BFC0 //A17 = -1.2404055949090177751123473821e-19
+data8 0xC216A9C4EEBDDDCA, 0x00003FC4 //A16 = 2.6303900460415782677749729120e-18
+data8 0xDCE944D89FF592F2, 0x00003FC6 //A15 = 1.1975620514752377092265425941e-17
+data8 0x83C8DDF213711381, 0x0000BFCC //A14 = -4.5721980583985311263109531319e-16
+LOCAL_OBJECT_END(tanhl_data)
+
+LOCAL_OBJECT_START(_0p25_to_0p5_data)
+// Polynomial coefficients for the tanh(x), 1/4 <= |x| < 1/2 
+data8 0xB6E27B747C47C8AD, 0x0000BFF6 //A3 = -2.7905990032063258105302045572e-03
+data8 0xBF93FD54E226F8F7 //A2H = -1.9521070769536099515084615064e-02
+data8 0xBC491BC884F6F18A //A2L = -2.7222721075104525371410300625e-18
+data8 0x3FCBE3FBB015A591 //A1H = 2.1789499376181400980279079249e-01
+data8 0x3C76AFC2D1AE35F7 //A1L = 1.9677459707672596091076696742e-17
+data8 0x3FD6EF53DE8C8FAF //A0H = 3.5835739835078589399230963863e-01
+data8 0x3C8E2A1C14355F9D //A0L = 5.2327050592919416045278607775e-17
+data8 0xF56D363AAE3BAD53, 0x00003FBB //A25 = 6.4963882412697389947564301120e-21
+data8 0xAD6348526CEEB897, 0x0000BFBD //A24 = -1.8358149767147407353343152624e-20
+data8 0x85D96A988565FD65, 0x0000BFC1 //A23 = -2.2674950494950919052759556703e-19
+data8 0xD52CAF6B1E4D9717, 0x00003FC3 //A22 = 1.4445269502644677106995571101e-18
+data8 0xBD7E1BE5CBEF7A01, 0x00003FC5 //A21 = 5.1362075721080004718090799595e-18
+data8 0xAE84A9B12ADD6948, 0x0000BFC9 //A20 = -7.5685210830925426342786733068e-17
+data8 0xEAC2D5FCF80E250C, 0x00003FC6 //A19 = 1.2726423522879522181100392135e-17
+data8 0xE0D2A8AC8C2EDB95, 0x00003FCE //A18 = 3.1200443098733419749016380203e-15
+data8 0xB22F0AB7B417F78E, 0x0000BFD0 //A17 = -9.8911854977385933809488291835e-15
+data8 0xE25A627BAEFFA7A4, 0x0000BFD3 //A16 = -1.0052095388666003876301743498e-13
+data8 0xC90F32EC4A17F908, 0x00003FD6 //A15 = 7.1430637679768183097897337145e-13
+data8 0x905F6F124AF956B1, 0x00003FD8 //A14 = 2.0516607231389483452611375485e-12
+LOCAL_OBJECT_END(_0p25_to_0p5_data)
+
+LOCAL_OBJECT_START(_0p5_to_1_data)
+// Polynomial coefficients for the tanh(x), 1/2 <= |x| < 1 
+data8 0xAB402BE491EE72A7, 0x00003FF7 //A3 = 5.2261556931080934657023772945e-03
+data8 0xBFB8403D3DDA87BE //A2H = -9.4730212784752659826992271519e-02
+data8 0xBC6FF7BC2AB71A8B //A2L = -1.3863786398568460929625760740e-17
+data8 0x3FD3173B1EFA6EF4 //A1H = 2.9829290414066567116435635398e-01
+data8 0x3C881E4DCABDE840 //A1L = 4.1838710466827119847963316219e-17
+data8 0x3FE45323E552F228 //A0H = 6.3514895238728730220145735075e-01
+data8 0x3C739D5832BF7BCF //A0L = 1.7012977006567066423682445459e-17
+data8 0xF153980BECD8AE12, 0x00003FD0 //A25 = 1.3396313991261493342597057700e-14
+data8 0xEC9ACCD245368129, 0x0000BFD3 //A24 = -1.0507358886349528807350792383e-13
+data8 0x8AE6498CA36D2D1A, 0x00003FD4 //A23 = 1.2336759149738309660361813001e-13
+data8 0x8DF02FBF5AC70E64, 0x00003FD7 //A22 = 1.0085317723615282268326194551e-12
+data8 0x9E15C7125DA204EE, 0x0000BFD9 //A21 = -4.4930478919612724261941857560e-12
+data8 0xA62C6F39BDDCEC1C, 0x00003FD7 //A20 = 1.1807342457875095150035780314e-12
+data8 0xDFD8D65D30F80F52, 0x00003FDC //A19 = 5.0896919887121116317817665996e-11
+data8 0xB795AFFD458F743E, 0x0000BFDE //A18 = -1.6696932710534097241291327756e-10
+data8 0xFEF30234CB01EC89, 0x0000BFDD //A17 = -1.1593749714588103589483091370e-10
+data8 0xA2F638356E13761E, 0x00003FE2 //A16 = 2.3714062288761887457674853605e-09
+data8 0xC429CC0D031E4FD5, 0x0000BFE3 //A15 = -5.7091025466377379046489586383e-09
+data8 0xC78363FF929EFF62, 0x0000BFE4 //A14 = -1.1613199289622686725595739572e-08
+LOCAL_OBJECT_END(_0p5_to_1_data)
+
+LOCAL_OBJECT_START(_1_to_2_data)
+// Polynomial coefficients for the tanh(x), 1 <= |x| < 2.0 
+data8 0xB3D8FB48A548D99A, 0x00003FFB //A3 = 8.7816203264683800892441646129e-02
+data8 0xBFC4EFBD8FB38E3B //A2H = -1.6356629864377389416141284073e-01
+data8 0xBC77687FD8087B23 //A2L = -2.0303377679446772162287121190e-17
+data8 0x3FC72165282C6F72 //A1H = 1.8070663892364852154415189034e-01
+data8 0x3C64E01F7A76D777 //A1L = 9.0532964466719018524360408402e-18
+data8 0x3FECF6F9786DF577 //A0H = 9.0514825364486639625027919465e-01
+data8 0x3C8834EDCE71A65B //A0L = 4.1992023813070331863928976191e-17
+data8 0xC3EEEB3EFA688094, 0x00003FE2 //A25 = 2.8512044383274095705865793485e-09
+data8 0x88461973672AEB12, 0x0000BFE1 //A24 = -9.9152258079470849685057375343e-10
+data8 0xFC2AF9950DC5027E, 0x0000BFE4 //A23 = -1.4678101918123116001692289670e-08
+data8 0x9C80CA742F89B7B5, 0x00003FE6 //A22 = 3.6438714992394138274843759814e-08
+data8 0xA0B3D7FAA606260A, 0x0000BFE6 //A21 = -3.7416469848124568887944709492e-08
+data8 0xDA5858432FBD9D9D, 0x0000BFE6 //A20 = -5.0837429421503142141842414978e-08
+data8 0xB0244D1E1AE9C1B0, 0x00003FE9 //A19 = 3.2808967255272595749004827841e-07
+data8 0xC8D3109ACF740738, 0x0000BFEA //A18 = -7.4812945767507614821609020680e-07
+data8 0xBB0F3440EEA55BBF, 0x00003FEA //A17 = 6.9685053481643125932497676583e-07
+data8 0xC13A8B08D8576C19, 0x00003FEB //A16 = 1.4396658837712390333960587173e-06
+data8 0xFF3A1163CC5522A1, 0x0000BFED //A15 = -7.6063522055104010298762276148e-06
+data8 0x8672AF27EB0823B7, 0x00003FEF //A14 = 1.6027448793338500004496520337e-05
+LOCAL_OBJECT_END(_1_to_2_data)
+
+LOCAL_OBJECT_START(_2_to_3p25_data)
+// Polynomial coefficients for the tanh(x), 2 <= |x| < 3.25 
+data8 0xD45657BEC559E366, 0x00003FFA //A3 = 5.1840155367548909799883161889e-02
+data8 0xBFA41B109CA6AB81 //A2H = -3.9268988726084870510835145296e-02
+data8 0xBC2C3D708A4E56C5 //A2L = -7.6544669252238280132415018518e-19
+data8 0x3F9434A517BBC5F4 //A1H = 1.9732074330880380874653212686e-02
+data8 0x3C3ED62DD9585229 //A1L = 1.6716574468135097509707871438e-18
+data8 0x3FEFD77D111A0AFF //A0H = 9.9505475368673035330147058630e-01
+data8 0x3C9C415E151C6CA5 //A0L = 9.8030409604070051319822874013e-17
+data8 0xB1596391D4534D52, 0x00003FEC //A25 = 2.6427086526487251988631279067e-06
+data8 0xC4DC44E243D1AF5F, 0x00003FEF //A24 = 2.3467591534149209236830008333e-05
+data8 0xAED5786023982BB8, 0x00003FF0 //A23 = 4.1683642395739762658623742687e-05
+data8 0xCF39926C9FBC6A10, 0x00003FF0 //A22 = 4.9406263949321793291856681624e-05
+data8 0xA255A72359928142, 0x00003FF0 //A21 = 3.8703580278108400672236161973e-05
+data8 0xA2E573B9FC332C0D, 0x00003FED //A20 = 4.8546879618263642155709302480e-06
+data8 0x82C7BD01830ACA93, 0x00003FF0 //A19 = 3.1180436075031301077175550468e-05
+data8 0xB38AF4C76E96444B, 0x0000BFF0 //A18 = -4.2806338675404452784440167120e-05
+data8 0xEC08FF0FB194464C, 0x00003FF0 //A17 = 5.6275163156181928637744511210e-05
+data8 0xB850825D9E235135, 0x0000BFF0 //A16 = -4.3943998628289568813056822585e-05
+data8 0xF98436E838763687, 0x0000BFEF //A15 = -2.9744680263523220185672219686e-05
+data8 0xE1851A2D00737A5D, 0x00003FF2 //A14 = 2.1507256570895163202182573369e-04
+LOCAL_OBJECT_END(_2_to_3p25_data)
+
+LOCAL_OBJECT_START(_4_to_6p5_data)
+// Polynomial coefficients for the tanh(x), 4 <= |x| < 6.5 
+data8 0x896FDBD321A0BE58, 0x00003FF5 //A3 = 1.0485606995331904734870550114e-03
+data8 0xBF39C522B95A37D6 //A2H = -3.9321992640217512306882730044e-04
+data8 0xBBA9B3EC39A45338 //A2L = -2.7213922673282819034134988241e-21
+data8 0x3F19C5377A48B5AD //A1H = 9.8306189621330793766869338146e-05
+data8 0x3BCAFCB1D08A891C //A1L = 1.1429476443042275163117526657e-20
+data8 0x3FEFFFE63ABE253B //A0H = 9.9998771165079547440512897083e-01
+data8 0x3C9BB74C4EE0D16F //A0L = 9.6159219890436197391279544561e-17
+data8 0x8D86121D469AFA7E, 0x0000BFEF //A25 = -1.6870941388985743600323604423e-05
+data8 0x9D3656A36593C5C4, 0x00003FEF //A24 = 1.8741161763079973068909254398e-05
+data8 0xDCD772D5BF9ADB96, 0x00003FF0 //A23 = 5.2652739523018349983563695656e-05
+data8 0xFF79ADCF0DCBCC2D, 0x00003FF1 //A22 = 1.2182012003034659966028035977e-04
+data8 0x84D24E394DEFD0D2, 0x00003FF1 //A21 = 6.3334229517535065590380468696e-05
+data8 0xA66B56BFD2782544, 0x00003FF1 //A20 = 7.9354902476954571736114945842e-05
+data8 0xFB15771FBF3155FE, 0x0000BFEE //A19 = -1.4965763624796745134798717707e-05
+data8 0xC774790126BE54C3, 0x00003FEF //A18 = 2.3776885435831770523136610539e-05
+data8 0x825A13DACB8C68CD, 0x00003FEF //A17 = 1.5539153272890695426189818556e-05
+data8 0xCFF96E6810AACE27, 0x0000BFF1 //A16 = -9.9169893703251156059893890295e-05
+data8 0x8A85D2061B865024, 0x00003FF3 //A15 = 2.6421115104625621420758344535e-04
+data8 0x922EC6F3CFE0496E, 0x0000BFF4 //A14 = -5.5764283474946207558456581668e-04
+LOCAL_OBJECT_END(_4_to_6p5_data)
+
+LOCAL_OBJECT_START(_8_to_13_data)
+// Polynomial coefficients for the tanh(x), 8 <= |x| < 13 
+data8 0xDD6050A898303460, 0x00003FE6 //A3 = 5.1543170295688189081352133793e-08
+data8 0xBE44C1078FDBADC0 //A2H = -9.6643444318955652627581125180e-09
+data8 0xBAF95FCAA6DBBA6F //A2L = -1.3118146684038113473094275420e-24
+data8 0x3E14C1078FE26748 //A1H = 1.2080430540780827633746315479e-09
+data8 0x3A88168082F37D95 //A1L = 9.7290246966246404028418245094e-27
+data8 0x3FEFFFFFFFF59F7C //A0H = 9.9999999992449728480892190419e-01
+data8 0x3C7C068EBC5C2EEB //A0L = 2.4308346546749583521003998922e-17
+data8 0x9DC155C77A6C46E5, 0x00003FF2 //A25 = 1.5044709695520252096006763473e-04
+data8 0xF2F9E09CA47F46E9, 0x00003FF3 //A24 = 4.6344010077547944693833282056e-04
+data8 0xCBFD67E704734BC8, 0x00003FF4 //A23 = 7.7815958662026429864083620142e-04
+data8 0xC18DC821CD67E621, 0x00003FF4 //A22 = 7.3834928521190855055818897104e-04
+data8 0x8AF72BCAB05A296E, 0x00003FF4 //A21 = 5.3011135848666430331904214879e-04
+data8 0xC2E73BE9B9AB4007, 0x00003FF2 //A20 = 1.8587423129049905806822275188e-04
+data8 0xE7E8C2058E2FF9F7, 0x00003FF1 //A19 = 1.1058292891321512917337425414e-04
+data8 0xC46309F52E429F97, 0x0000BFF0 //A18 = -4.6822278664829811025251866877e-05
+data8 0x81966C1E007E9BEB, 0x00003FF1 //A17 = 6.1792176836716291200611553354e-05
+data8 0x8CEDC4BEFCAB9A7E, 0x0000BFF1 //A16 = -6.7200080564674449915571760779e-05
+data8 0x8B64E9FA53210018, 0x00003FF1 //A15 = 6.6468331917938095774361868182e-05
+data8 0x82DEDAA539A3A3F1, 0x0000BFF1 //A14 = -6.2403928644276709411156885292e-05
+LOCAL_OBJECT_END(_8_to_13_data)
+
+LOCAL_OBJECT_START(_16_to_22p8_data)
+// Polynomial coefficients for the tanh(x), 16 <= |x| < 22.88 
+data8 0x992C00F33DDE804D, 0x00003FCE //A3 = 2.1256869805798788337547274131e-15
+data8 0x3C8D42EA28102760 //A2H = 5.0760412270332007485198379096e-17
+data8 0x391A747B43B072DD //A2L = 1.2737621993898125881520341053e-33
+data8 0x3C309BC5C3CB4D5F //A1H = 9.0034785192019775952205276560e-19
+data8 0x38A8EF3B5C9DCE71 //A1L = 9.3793162715476168397242934494e-36
+data8 0x3FF0000000000000 //A0H = 1.0000000000000000000000000000e+00
+data8 0x3BACC66AFD5CA22A //A0L = 3.0466790472070565954180861749e-21
+data8 0xF020FB351C2F37CB, 0x00003FF1 //A25 = 1.1450235038836625246604146870e-04
+data8 0xBE80596C51302A7B, 0x00003FF4 //A24 = 7.2670503421185030764546828414e-04
+data8 0x91343CF8577E0131, 0x00003FF6 //A23 = 2.2156380512949603402001207105e-03
+data8 0x8D029A8679641286, 0x00003FF7 //A22 = 4.3032888906494613055765544559e-03
+data8 0xC3713F64D8DC4BAB, 0x00003FF7 //A21 = 5.9644279041951657632420721490e-03
+data8 0xCD678C455A5D06C2, 0x00003FF7 //A20 = 6.2684473911812928601693994403e-03
+data8 0xA9E1C825BDCEEBCC, 0x00003FF7 //A19 = 5.1843859941826642445235686826e-03
+data8 0xE29C919AD93F6EB9, 0x00003FF6 //A18 = 3.4578185539872939928152204329e-03
+data8 0xF7E615A75994A607, 0x00003FF5 //A17 = 1.8913175041916131006881986311e-03
+data8 0xE102EFE0F7F2B2AD, 0x00003FF4 //A16 = 8.5835064987089641065525269712e-04
+data8 0xAAD62946DEE96996, 0x00003FF3 //A15 = 3.2584489313998677644253007210e-04
+data8 0xDA2470DE110B293E, 0x00003FF1 //A14 = 1.0401837693241806604296821650e-04
+LOCAL_OBJECT_END(_16_to_22p8_data)
+
+LOCAL_OBJECT_START(_3p25_to_4_data)
+// Polynomial coefficients for the tanh(x), 3.25 <= |x| < 4 
+data8 0xE9E07240432926E6, 0x00003FF7 //A3 = 7.1373517862636557382403555215e-03
+data8 0xBF75F495227AF306 //A2H = -5.3602052282115727338540622782e-03
+data8 0xBBBE92D355A6B716 //A2L = -6.4741983326810209847018826624e-21
+data8 0x3F65F85AD510B690 //A1H = 2.6819013660517934671823070403e-03
+data8 0x3C159A0B73E6EC01 //A1L = 2.9275813076637328121849573333e-19
+data8 0x3FEFFA81708A0B42 //A0H = 9.9932929973906703402519724477e-01
+data8 0x3C66857246C19DC6 //A0L = 9.7670460995685717424398031188e-18
+data8 0xE6B6B8365B1E4D6C, 0x00003FE3 //A25 = 6.7146538162212081470554423396e-09
+data8 0xE0453CEEF483A510, 0x00003FE2 //A24 = 3.2635647369924061614015292015e-09
+data8 0x9C7D83B56E92CF1A, 0x00003FE5 //A23 = 1.8217867585545497089756353348e-08
+data8 0xA94635C48ABA9EB4, 0x0000BFE4 //A22 = -9.8530586070049930796756799547e-09
+data8 0xB1B0C14443067646, 0x00003FE5 //A21 = 2.0685890807654992387562340307e-08
+data8 0x9C6E549781E293C3, 0x00003FDE //A20 = 1.4227314592865135171341122138e-10
+data8 0xB0CBFCE7C80F57A7, 0x0000BFE7 //A19 = -8.2327438416004542109809245219e-08
+data8 0xB151AB3876E896E1, 0x00003FE9 //A18 = 3.3028241036175815328309577940e-07
+data8 0xFCF3A5C1A5CB7EEE, 0x0000BFEA //A17 = -9.4231869277542043001280640966e-07
+data8 0x96A9016C7C95BEDA, 0x00003FEC //A16 = 2.2450115975007100522962781833e-06
+data8 0x9B9B0A3901DEC05B, 0x0000BFED //A15 = -4.6374089937147736266514566049e-06
+data8 0x8987DF26A6789CCF, 0x00003FEE //A14 = 8.1974714257536543772040700977e-06
+LOCAL_OBJECT_END(_3p25_to_4_data)
+
+LOCAL_OBJECT_START(_6p5_to_8_data)
+// Polynomial coefficients for the tanh(x), 6.5 <= |x| < 8.0 
+data8 0xA11C8A63815E5657, 0x00003FEF //A3 = 1.9205985861286093001394561449e-05
+data8 0xBEDE355AD6CB61D8 //A2H = -7.2022479400070228499307345427e-06
+data8 0xBB8E6B50B8468A63 //A2L = -8.0518953122203408718779840543e-22
+data8 0x3EBE355B48DCF330 //A1H = 1.8005623902549165889479948488e-06
+data8 0x3B5837550FFA98DA //A1L = 8.0124491698609178046195694087e-23
+data8 0x3FEFFFFF872A91F8 //A0H = 9.9999977492967584424832239165e-01
+data8 0x3C8A43B839B4EB63 //A0L = 4.5561696441306660142461355317e-17
+data8 0xB5BC1948966B8826, 0x0000BFE6 //A25 = -4.2313421330480692560677276010e-08
+data8 0x91D0BE367389BDFC, 0x0000BFE8 //A24 = -1.3580117599617083801153887619e-07
+data8 0xFFD950AF282AB36C, 0x0000BFE8 //A23 = -2.3827784451962439125197203287e-07
+data8 0x959B1770EBB8903A, 0x0000BFE9 //A22 = -2.7866256690165347051403663794e-07
+data8 0xCC78060D1C0CFF3C, 0x0000BFE8 //A21 = -1.9042644867126442102188429523e-07
+data8 0xF8919BAF2E87F31D, 0x0000BFE8 //A20 = -2.3149771783868910586746973299e-07
+data8 0xC5B6AC942A3F2440, 0x00003FE8 //A19 = 1.8413511183396213757149263639e-07
+data8 0xABF1A4703056450A, 0x0000BFEA //A18 = -6.4054099983863829656292958643e-07
+data8 0xBB543D8BDB670453, 0x00003FEB //A17 = 1.3957102903892251890348444989e-06
+data8 0xC9D6F37700C1D092, 0x0000BFEC //A16 = -3.0076451968978522605262647414e-06
+data8 0xCA6EF4BB64E49EC8, 0x00003FED //A15 = 6.0329860989478473738709576062e-06
+data8 0xBE25D0FD069D0A93, 0x0000BFEE //A14 = -1.1333687314965721384777951065e-05
+LOCAL_OBJECT_END(_6p5_to_8_data)
+
+LOCAL_OBJECT_START(_13_to_16_data)
+// Polynomial coefficients for the tanh(x), 13 <= |x| < 16 
+data8 0x98176FD2075BDBD5, 0x00003FDB //A3 = 1.7290807363028159200235264756e-11
+data8 0xBD8C8464F76162D1 //A2H = -3.2420263805679445515400340441e-12
+data8 0xBA2D56B508E0F1FD //A2L = -1.8515322669984580704502445180e-28
+data8 0x3D5C8464F761639C //A1H = 4.0525329757100331782338488690e-13
+data8 0x3A0A09D9E328E620 //A1L = 4.1081479300866418212862258651e-29
+data8 0x3FEFFFFFFFFFFF1B //A0H = 9.9999999999997457589273608392e-01
+data8 0x3C9B9B089E9BFD89 //A0L = 9.5776165728054091471814161399e-17
+data8 0xC5395B9EC765BDB7, 0x00003FE6 //A25 = 4.5919803498257974411526879804e-08
+data8 0x9A0F1FCB1DC24C3A, 0x00003FE8 //A24 = 1.4347869798460288751020493795e-07
+data8 0x8AA5C3459FAD0B28, 0x00003FE9 //A23 = 2.5825111356333853968900510087e-07
+data8 0x9578B747988CFF9D, 0x00003FE9 //A22 = 2.7841245127068220034870119246e-07
+data8 0x810DF1A589D9CAF1, 0x00003FE9 //A21 = 2.4038267971021370956311255310e-07
+data8 0x8A00D77B9416EB75, 0x00003FE8 //A20 = 1.2852557749068320312899366352e-07
+data8 0xB2436C4A1849C498, 0x00003FE7 //A19 = 8.3010350873515703893886683374e-08
+data8 0xEA6405B18356600B, 0x00003FE3 //A18 = 6.8216675390299296071261114202e-09
+data8 0xF7606C022194B7E8, 0x00003FE5 //A17 = 2.8798432098264655723769995993e-08
+data8 0xAF4B0C453FCAF34E, 0x0000BFE5 //A16 = -2.0406809167824936143455638336e-08
+data8 0xC324C1F10D5FA7CC, 0x00003FE5 //A15 = 2.2717703170390130238356558599e-08
+data8 0xB34A2E3A4D3B9C31, 0x0000BFE5 //A14 = -2.0872076027950789618606920471e-08
+LOCAL_OBJECT_END(_13_to_16_data)
+
+
+//////// "Tail" tables //////////
+LOCAL_OBJECT_START(_0p125_to_0p25_data_tail)
+// Polynomial coefficients for the erf(x), 1/8 <= |x| < 1/4 
+data8 0x9D7D206E97ADC83A, 0x0000BFCC //A13 = -5.4639895428711257047470806445e-16
+data8 0xA8972B666A845810, 0x00003FD3 //A12 = 7.4869224589947988668562043110e-14
+data8 0x9A5B31511C9F4698, 0x0000BFD4 //A11 = -1.3709586467430093373657009487e-13
+data8 0xCBB8047BCB274982, 0x0000BFDA //A10 = -1.1580074124926108509393610532e-11
+data8 0xF95EB849E5F9247C, 0x00003FDC //A9 = 5.6700173336564916962945623180e-11
+data8 0xE7893404C6A53386, 0x00003FE1 //A8 = 1.6846457582993065168777704528e-09
+data8 0xF2E5C7E2B5F55ECC, 0x0000BFE4 //A7 = -1.4138500046802141367543484859e-08
+data8 0xF43906FF53A002C0, 0x0000BFE8 //A6 = -2.2745017243678613107034288816e-07
+data8 0xC6175D5E47D1D259, 0x00003FEC //A5 = 2.9517899220726077077586632607e-06
+data8 0xE7C2AE92CB36769B, 0x00003FEF //A4 = 2.7628001723157068127646694830e-05
+LOCAL_OBJECT_END(_0p125_to_0p25_data_tail)
+
+LOCAL_OBJECT_START(_0p25_to_0p5_data_tail)
+// Polynomial coefficients for the tanh(x), 1/4 <= |x| < 1/2 
+data8 0x9E2972C008B9965E, 0x0000BFDC //A13 = -3.5961854154738002253192260213e-11
+data8 0xC3EABA3D219BEA8A, 0x00003FDB //A12 = 2.2273173303628274478819473067e-11
+data8 0xC50FB68D960D5CD9, 0x00003FE1 //A11 = 1.4338102430978399800743148719e-09
+data8 0xB3BB92499EF2D583, 0x0000BFE3 //A10 = -5.2309100551458044083112632491e-09
+data8 0xBD915BE632F1D04E, 0x0000BFE6 //A9 = -4.4137194873936112573773943707e-08
+data8 0xBC48C813FA819141, 0x00003FE9 //A8 = 3.5070684356359066908197915734e-07
+data8 0xD3E34EA031AC611B, 0x00003FEA //A7 = 7.8934400708919584259192272835e-07
+data8 0x8EAC489D859541CD, 0x0000BFEF //A6 = -1.7007944944124693133572815137e-05
+data8 0x98D4D7E5D1508B8A, 0x00003FEF //A5 = 1.8218924920302265989878708948e-05
+data8 0xAC262F3F8CF49C02, 0x00003FF4 //A4 = 6.5669692402266433496312492412e-04
+LOCAL_OBJECT_END(_0p25_to_0p5_data_tail)
+
+LOCAL_OBJECT_START(_0p5_to_1_data_tail)
+// Polynomial coefficients for the tanh(x), 1/2 <= |x| < 1 
+data8 0xDF67FB36FFA2A538, 0x00003FE7 //A13 = 1.0403160796697495720021114635e-07
+data8 0xB7FB80FB5AFA63A4, 0x0000BFE8 //A12 = -1.7134699677764282023124981753e-07
+data8 0xC87625A0BA7D6C5F, 0x0000BFEA //A11 = -7.4677732458471897291461679095e-07
+data8 0x90DA375DD9AF6D79, 0x00003FED //A10 = 4.3169381418023765618186668159e-06
+data8 0x82DFB03317B17316, 0x0000BFED //A9 = -3.9003426534601562552753368105e-06
+data8 0xAA582FD4F3438BB4, 0x0000BFF0 //A8 = -4.0613288845040776435400454867e-05
+data8 0xB1532D8CF763B21C, 0x00003FF2 //A7 = 1.6911021594787399557528570601e-04
+data8 0x82E12AEF7CAB76C6, 0x0000BFEF //A6 = -1.5602059530458172761585925044e-05
+data8 0x83256E3D0FBA5C93, 0x0000BFF6 //A5 = -2.0011324059500451791903108104e-03
+data8 0xCC4AB2EC0965499B, 0x00003FF7 //A4 = 6.2344907419841579664122448353e-03
+LOCAL_OBJECT_END(_0p5_to_1_data_tail)
+
+LOCAL_OBJECT_START(_1_to_2_data_tail)
+// Polynomial coefficients for the tanh(x), 1 <= |x| < 2.0 
+data8 0xCCAEE174EAC17F78, 0x0000BFEE //A13 = -1.2200065117856038355953618829e-05
+data8 0xA39DD0981D1A2776, 0x0000BFF0 //A12 = -3.9009204899026604074167603200e-05
+data8 0xB7104FA27FAF80D0, 0x00003FF2 //A11 = 1.7458316338540792661905876072e-04
+data8 0xB219A7274436A734, 0x0000BFF3 //A10 = -3.3969918595931391572998415468e-04
+data8 0xCCD9D03C0C73CECF, 0x00003FF2 //A9 = 1.9536097875337884986025498958e-04
+data8 0x85321EA40CFEEBEE, 0x00003FF5 //A8 = 1.0162031558369402750607778300e-03
+data8 0x81F272C08C308220, 0x0000BFF7 //A7 = -3.9656696618251138315464862909e-03
+data8 0xE8761C6BDEA9ED87, 0x00003FF7 //A6 = 7.0941580558970243020090656343e-03
+data8 0xAE4E9F3691F66877, 0x0000BFF6 //A5 = -2.6597155288710984120834711909e-03
+data8 0xCC8286B331BD8AAA, 0x0000BFF9 //A4 = -2.4964583478826523250880337777e-02
+LOCAL_OBJECT_END(_1_to_2_data_tail)
+
+LOCAL_OBJECT_START(_2_to_3p25_data_tail)
+// Polynomial coefficients for the tanh(x), 2 <= |x| < 3.25 
+data8 0x92E1711A3BD6408B, 0x0000BFF4 //A13 = -5.6030514548041036913731470443e-04
+data8 0x8B9BD885FF3E98C5, 0x00003FF5 //A12 = 1.0651304064581604055612602669e-03
+data8 0xD041356C7FA26A22, 0x0000BFF5 //A11 = -1.5888574328066952147023520244e-03
+data8 0xDFA210BE9BE6B7FD, 0x00003FF5 //A10 = 1.7061849060196387827639060629e-03
+data8 0x8ECC3606808028E9, 0x0000BFF4 //A9 = -5.4472999329435778312080340471e-04
+data8 0xD5C053B8EEBD10C8, 0x0000BFF6 //A8 = -3.2615856552479930645151033322e-03
+data8 0xB7BFD63AC5051539, 0x00003FF8 //A7 = 1.1215171059191957498023766643e-02
+data8 0xC367C59D7FA3ADA2, 0x0000BFF9 //A6 = -2.3853193251842394834616848995e-02
+data8 0x9FC9FB890BB053CF, 0x00003FFA //A5 = 3.9010984954739386625695104667e-02
+data8 0xD01D077B42E7ED76, 0x0000BFFA //A4 = -5.0808934425896607486919526567e-02
+LOCAL_OBJECT_END(_2_to_3p25_data_tail)
+
+LOCAL_OBJECT_START(_4_to_6p5_data_tail)
+// Polynomial coefficients for the tanh(x), 4 <= |x| < 6.5 
+data8 0x870CCE8C76C52C7E, 0x00003FF5 //A13 = 1.0303499350193060915603525934e-03
+data8 0xE1431E54AD2A738B, 0x0000BFF5 //A12 = -1.7186140560972621669872002486e-03
+data8 0xAB20056533E28734, 0x00003FF6 //A11 = 2.6111615345168277554841545330e-03
+data8 0xECCB91D64718B9BD, 0x0000BFF6 //A10 = -3.6132079169671860943878776041e-03
+data8 0x94771DA3B8C2EB4F, 0x00003FF7 //A9 = 4.5308012699419563988381317896e-03
+data8 0xA7497377E4946F2C, 0x0000BFF7 //A8 = -5.1051915941441437592654444804e-03
+data8 0xA76B2D6FCA088AE9, 0x00003FF7 //A7 = 5.1092120989582196669504468168e-03
+data8 0x928C8961F33C9560, 0x0000BFF7 //A6 = -4.4723196805537430568162704711e-03
+data8 0xDBDDDF6CDE9AB9BE, 0x00003FF6 //A5 = 3.3548994514326736175581084349e-03
+data8 0x896E211733AD9D40, 0x0000BFF6 //A4 = -2.0970183170010094667442967500e-03
+LOCAL_OBJECT_END(_4_to_6p5_data_tail)
+
+LOCAL_OBJECT_START(_8_to_13_data_tail)
+// Polynomial coefficients for the tanh(x), 8 <= |x| < 13 
+data8 0xE50C3476BED020AA, 0x00003FF0 //A13 = 5.4609221347524272615754239857e-05
+data8 0xBA16F5F4EDC0EABC, 0x0000BFF0 //A12 = -4.4367239594986428539386662937e-05
+data8 0x8B916C2F002C3D91, 0x00003FF0 //A11 = 3.3275617838067362533536610680e-05
+data8 0xBFE8031097CB4442, 0x0000BFEF //A10 = -2.2877013297722792747267224605e-05
+data8 0xEFE1FFD106B2DA41, 0x00003FEE //A9 = 1.4298129659899553350478452989e-05
+data8 0x86EF1FF403A6622E, 0x0000BFEE //A8 = -8.0426979849841642112688693288e-06
+data8 0x86EF200FD047306B, 0x00003FED //A7 = 4.0213490418736097707257704218e-06
+data8 0xEC22782377882553, 0x0000BFEB //A6 = -1.7593402092805559754997565942e-06
+data8 0xB119DA1DB7C47773, 0x00003FEA //A5 = 6.5975257917246601211360847253e-07
+data8 0xDD6050A7761D67BB, 0x0000BFE8 //A4 = -2.0617268111985310661707082242e-07
+LOCAL_OBJECT_END(_8_to_13_data_tail)
+
+LOCAL_OBJECT_START(_16_to_22p8_data_tail)
+// Polynomial coefficients for the tanh(x), 16 <= |x| < 22.88 
+data8 0xEAF4AF87336E81B1, 0x00003FEF //A13 = 2.8008914392791730186582989654e-05
+data8 0xD5B309EA768E2711, 0x00003FED //A12 = 6.3687375204024238267961143128e-06
+data8 0xA4048CA537113538, 0x00003FEB //A11 = 1.2220276227448617951538196845e-06
+data8 0xD3EC78BB3425377D, 0x00003FE8 //A10 = 1.9736934193679794194181457250e-07
+data8 0xE5763CD37440266E, 0x00003FE5 //A9 = 2.6712876934440631473215182284e-08
+data8 0xCECA765EEB4A265F, 0x00003FE2 //A8 = 3.0092031912460315516888139627e-09
+data8 0x99ABF588DF81A52E, 0x00003FDF //A7 = 2.7952722177649984066847682907e-10
+data8 0xB9C78918294A4685, 0x00003FDB //A6 = 2.1120676552098603524020495036e-11
+data8 0xB3A3C42AD539D50F, 0x00003FD7 //A5 = 1.2764169243389521270291967366e-12
+data8 0x86BC347939478174, 0x00003FD3 //A4 = 5.9834437707863962671883176163e-14
+LOCAL_OBJECT_END(_16_to_22p8_data_tail)
+
+LOCAL_OBJECT_START(_3p25_to_4_data_tail)
+// Polynomial coefficients for the tanh(x), 3.25 <= |x| < 4 
+data8 0xBE9A2BE19F21BA1C, 0x0000BFEE //A13 = -1.1360778336288065244475976873e-05
+data8 0xF84910F515BDB014, 0x00003FED //A12 = 7.3994819819577018481862729782e-06
+data8 0xC4C84FB788AA4007, 0x00003FEF //A11 = 2.3458298013663976251972482656e-05
+data8 0x86CC6243C170E5ED, 0x0000BFF2 //A10 = -1.2855374755847770638424932233e-04
+data8 0xD3065AC539ABABFF, 0x00003FF3 //A9 = 4.0249790677367806832685138089e-04
+data8 0x82C4413795EC381B, 0x0000BFF5 //A8 = -9.9767013652382759950854031514e-04
+data8 0x88D588720888899A, 0x00003FF6 //A7 = 2.0879228705174076794011525274e-03
+data8 0xF4CA066137741469, 0x0000BFF6 //A6 = -3.7351861548964870836350490741e-03
+data8 0xB998746D56E81737, 0x00003FF7 //A5 = 5.6639259807333999973200378964e-03
+data8 0xE93FB2F48233275B, 0x0000BFF7 //A4 = -7.1181892208343798194003322900e-03
+LOCAL_OBJECT_END(_3p25_to_4_data_tail)
+
+LOCAL_OBJECT_START(_6p5_to_8_data_tail)
+// Polynomial coefficients for the tanh(x), 6.5 <= |x| < 8.0 
+data8 0xA6881D7D21774BFD, 0x00003FEF //A13 = 1.9852125640303530752913966680e-05
+data8 0x875E983AA042E605, 0x0000BFF0 //A12 = -3.2274606306629334402383651599e-05
+data8 0xCB19E01E94FC133C, 0x00003FF0 //A11 = 4.8423069963831314927026982707e-05
+data8 0x8BA5E8D9E72D56B2, 0x0000BFF1 //A10 = -6.6589395655200734237190902534e-05
+data8 0xAE91F647ED4E46B2, 0x00003FF1 //A9 = 8.3241541003842930001632190258e-05
+data8 0xC465A7E0B22F884E, 0x0000BFF1 //A8 = -9.3649431639051891449916386619e-05
+data8 0xC4666148AA01A4D7, 0x00003FF1 //A7 = 9.3650780646160216748407869111e-05
+data8 0xABD9E63D181B0C6C, 0x0000BFF1 //A6 = -8.1945023256769295802996591839e-05
+data8 0x80E38B18E509387A, 0x00003FF1 //A5 = 6.1458988764532931141264026311e-05
+data8 0xA11C80E20ADA5A64, 0x0000BFF0 //A4 = -3.8411937140983728563216440713e-05
+LOCAL_OBJECT_END(_6p5_to_8_data_tail)
+
+LOCAL_OBJECT_START(_13_to_16_data_tail)
+// Polynomial coefficients for the tanh(x), 13 <= |x| < 16 
+data8 0x9D6CCDA4767CA6D9, 0x00003FE5 //A13 = 1.8326683535066775712253572575e-08
+data8 0xFFAF154F334BF403, 0x0000BFE4 //A12 = -1.4882762852665077172347508377e-08
+data8 0xBFC68FA7C61B6C17, 0x00003FE4 //A11 = 1.1162810813806544919835662888e-08
+data8 0x83D8439A6B19A015, 0x0000BFE4 //A10 = -7.6743763372603959795701788561e-09
+data8 0xA4CE5BE9DC6A2962, 0x00003FE3 //A9 = 4.7964885012772346158732715382e-09
+data8 0xB96826C0697253CA, 0x0000BFE2 //A8 = -2.6980246373950994097953903952e-09
+data8 0xB96826CADDC00E35, 0x00003FE1 //A7 = 1.3490123232313844006540534789e-09
+data8 0xA23B21F1155DF322, 0x0000BFE0 //A6 = -5.9019289132168830718664922372e-10
+data8 0xF358B2E9A50C349C, 0x00003FDE //A5 = 2.2132233424669131155945897524e-10
+data8 0x98176FD2074C1D77, 0x0000BFDD //A4 = -6.9163229452106125388824134881e-11
+LOCAL_OBJECT_END(_13_to_16_data_tail)
+
+LOCAL_OBJECT_START(_0_to_1o8_data)
+// Polynomial coefficients for the tanh(x), 0.0 <= |x| < 0.125 
+data8 0xBA0EC1879495150B, 0x0000BFF5 // A15 = -1.4195071451378679802688367813e-03
+data8 0xEB5A82898D1BCBA4, 0x00003FF6 // A13 = 3.5912102408030526706365632879e-03
+data8 0x91370DAFE0B64438, 0x0000BFF8 // A11 = -8.8632234251336964576640807982e-03
+data8 0xB327A435358F1200, 0x00003FF9 // A9 = 2.1869488447622383899199238857e-02
+data8 0xDD0DD0DD07A0775F, 0x0000BFFA // A7 = -5.3968253967902161405327069187e-02
+data8 0x888888888887C299, 0x00003FFC // A5 = 1.3333333333333264660338062012e-01
+data8 0xAAAAAAAAAAAAAA98, 0x0000BFFD // A3 = -3.3333333333333333282255458755e-01
+LOCAL_OBJECT_END(_0_to_1o8_data)
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(tanhl)
+
+{ .mfi
+      alloc          r32         = ar.pfs, 0, 21, 0, 0 
+      fmerge.se      fArgAbsNorm = f1, f8      // normalized x (1.0 <= x < 2.0)
+      addl           rSignBit    = 0x20000, r0 // Set sign bit for exponent
+}
+{ .mlx
+      addl           rDataPtr    = @ltoff(tanhl_data), gp // Get common data ptr
+      movl           r1p5        = 0x3FF8000000000000    // 1.5 in dbl repres.
+};;
+
+{ .mfi
+      getf.exp       rArgExp     = f8              // Get arg exponent
+      fclass.m       p6,p0       = f8, 0xEF // Filter 0, denormals and specials 
+                            // 0xEF = @qnan|@snan|@pos|@neg|@zero|@unorm|@inf
+      addl           rBias       = 0xfffc, r0 // Value to subtract from exp 
+                                            // to get actual interval number
+}
+{ .mfi
+      ld8            rDataPtr    = [rDataPtr]  // Get real common data pointer
+      fma.s1         fArgSqr     = f8, f8, f0  // x^2 (for [0;1/8] path)
+      addl           r2to4       = 0x10000, r0 // unbiased exponent 
+                                             // for [2;4] binary interval
+};;
+
+{ .mfi
+      getf.sig       rArgSig     = f8              // Get arg significand 
+      fcmp.lt.s1     p15, p14    = f8, f0          // Is arg negative/positive?
+      addl           rSaturation = 0xb70, r0       // First 12 bits of
+                                                   // saturation value signif.
+}
+{ .mfi
+      setf.d         f1p5        = r1p5            // 1.5 construction 
+      fma.s1         f2p0        = f1,f1,f1        // 2.0 construction
+      addl           r1625Sign   = 0xd01, r0       // First 12 bits of
+                                                   // 1.625 value signif.
+      // 1.625 significand used to filter values greater than 3.25, 6.5, 13.0
+};;
+
+{ .mfi
+      addl           rTailDataPtr = 0xB00, rDataPtr  // Pointer to "tail" data
+      fmerge.s       fSignumX = f8, f1            // signum(x)
+      andcm          rArgExp     = rArgExp, rSignBit // Remove sign of exp
+}
+{ .mfb
+      addl           rTiny       = 0xf000, r0 // Tiny value for saturation path
+      nop.f          0
+(p6)  br.cond.spnt   tanhl_spec               // Branch to zero, denorm & specs      
+};;
+
+{ .mfi
+      sub            rInterval   = rArgExp, rBias // Get actual interval number
+      nop.f          0
+      shr.u          rArgSig     = rArgSig, 52    // Leave only 12 bits of sign. 
+}
+{ .mfi
+      adds           rShiftedDataPtr = 0x10, rDataPtr // Second ptr to data
+      nop.f          0
+      cmp.ge         p8, p10     = rArgExp, r2to4  // If exp >= 2to4 interval?
+};;
+
+{ .mfi
+(p8)  cmp.le         p8, p10     = r1625Sign, rArgSig // If signd is greater 
+                            //  than 1.625? (arg is at one of binary subranges)
+      nop.f          0
+      shl            rOffset     = rInterval, 8 // Make offset from 
+                                              // interval number
+}
+{ .mfi
+      cmp.gt         p9, p0      = 0x0, rInterval // If interval is less than 0
+                                                // (means arg is in [0; 1/8])
+      nop.f          0
+      cmp.eq         p7, p0      = 0x7, rInterval // If arg is in [16;] interv.?
+};;
+
+{ .mfi
+(p8)  adds           rOffset     = 0x400, rOffset // Add additional offset 
+                            //  (arg is at one of binary subranges)
+      fma.s1         fArgCube    = fArgSqr, f8, f0  // x^3 (for [0;1/8] path)
+      shl            rTailOffset = rInterval, 7  // Make offset to "tail" data
+                                                 // from interval number
+}
+{ .mib
+      setf.exp       fTiny       = rTiny // Construct "tiny" value 
+                                       // for saturation path
+      cmp.ltu        p11, p0     = 0x7, rInterval // if arg > 32
+(p9)  br.cond.spnt   _0_to_1o8       
+};;
+
+{ .mfi
+      add            rAddr1      = rDataPtr, rOffset // Get address for 
+                                                   // interval data 
+      nop.f          0
+      shl            rTailAddOffset = rInterval, 5 // Offset to interval
+                                                   // "tail" data 
+}
+{ .mib
+      add            rAddr2      = rShiftedDataPtr, rOffset // Get second
+                                                 // address for interval data 
+(p7)  cmp.leu        p11, p0     = rSaturation, rArgSig // if arg is 
+                                                        // in [22.8;32] interval
+(p11) br.cond.spnt   _saturation // Branch to Saturation path
+};;
+
+{ .mmi
+      ldfe           fA3         = [rAddr1], 0x90 // Load A3
+      ldfpd          fA2H, fA2L  = [rAddr2], 16 // Load A2High, A2Low
+      add            rTailOffset = rTailOffset, rTailAddOffset // "Tail" offset
+};;
+
+{ .mmi
+      ldfe           fA20        = [rAddr1], 16 // Load A20
+      ldfpd          fA1H, fA1L  = [rAddr2], 16 // Load A1High, A1Low
+(p8)  adds           rTailOffset = 0x280, rTailOffset // Additional offset
+                                    //  (arg is at one of binary subranges)
+};;
+
+{ .mmi
+      ldfe           fA19        = [rAddr1], 16 // Load A19
+      ldfpd          fA0H, fA0L  = [rAddr2], 16 // Load A0High, A0Low
+      add            rTailAddr1  = rTailDataPtr, rTailOffset // First tail
+                                                           // data address
+};;
+
+.pred.rel "mutex",p8,p10
+{ .mfi
+      ldfe           fA18        = [rAddr1], 16 // Load A18
+(p8)  fms.s1         fArgAbsNorm = fArgAbsNorm, f1, f2p0 // Add 2.0 
+                            //  (arg is at one of binary subranges)
+      adds           rTailAddr2  = 0x10, rTailAddr1  // First tail
+                                                     // data address
+}
+{ .mfi
+      ldfe           fA25        = [rAddr2], 16 // Load A25 
+(p10) fms.s1         fArgAbsNorm = fArgAbsNorm, f1, f1p5  // Add 1.5 
+                                                // to normalized arg
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA17        = [rAddr1], 16 // Load A17
+      ldfe           fA24        = [rAddr2], 16 // Load A24
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA16        = [rAddr1], 16 // Load A16
+      ldfe           fA23        = [rAddr2], 16 // Load A23
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA15        = [rAddr1], 16 // Load A15
+      ldfe           fA22        = [rAddr2], 16 // Load A22
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA14        = [rAddr1], 16 // Load A14
+      ldfe           fA21        = [rAddr2], 16 // Load A21
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA13        = [rTailAddr1], 32              // Load A13
+      fms.s1         fArgAbsNorm2 = fArgAbsNorm, fArgAbsNorm, f0 // x^2
+      nop.i          0
+}
+{ .mfi
+      ldfe           fA12        = [rTailAddr2], 32 // Load A12
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA11        = [rTailAddr1], 32       // Load A11
+      fma.s1         fRes3H      = fA3, fArgAbsNorm, fA2H // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi
+      ldfe           fA10        = [rTailAddr2], 32     // Load A10
+      fma.s1         fTH         = fA3, fArgAbsNorm, f0 // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      ldfe           fA9         = [rTailAddr1], 32      // Load A9
+      fma.s1         fTT2        = fA1L, fArgAbsNorm, f0 // A1*x+A0
+      nop.i          0
+}
+{ .mfi
+      ldfe           fA8         = [rTailAddr2], 32 // Load A8
+      nop.f          0
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA7         = [rTailAddr1], 32 // Load A7
+      ldfe           fA6         = [rTailAddr2], 32 // Load A6
+      nop.i          0
+};;
+
+{ .mmi
+      ldfe           fA5         = [rTailAddr1], 32 // Load A5
+      ldfe           fA4         = [rTailAddr2], 32 // Load A4
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm2L = fArgAbsNorm, fArgAbsNorm, fArgAbsNorm2
+                                                  // Low part of x^2 (delta)
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm4  = fArgAbsNorm2, fArgAbsNorm2, f0 // x^4
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fRes3L      = fA2H, f1, fRes3H // // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm3 = fArgAbsNorm2, fArgAbsNorm, f0 // x^3
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fTH2        = fA1H, fArgAbsNorm, fTT2 // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA23        = fA24,  fArgAbsNorm, fA23 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA21        = fA22,  fArgAbsNorm, fA21 // Polynomial tail 
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA12        = fA13,  fArgAbsNorm, fA12 // Polynomial tail
+      nop.i          0
+}
+;;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes3L      = fRes3L, f1, fTH // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA19        = fA20,  fArgAbsNorm, fA19 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1H      = fTH2, f1, fA0H // A1*x+A0
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fTL2        = fA1H, fArgAbsNorm, fTH2 // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA8         = fA9,  fArgAbsNorm, fA8 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA10        = fA11,  fArgAbsNorm, fA10 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA16,  fArgAbsNorm, fA15 // Polynomial tail
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA17        = fA18,  fArgAbsNorm, fA17 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm11 = fArgAbsNorm4, fArgAbsNorm4, f0 // x^8
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA4         = fA5,  fArgAbsNorm, fA4 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes3L      = fRes3L, f1, fA2L // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA6         = fA7,  fArgAbsNorm, fA6 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTL2        = fTL2, f1, fTT2 // A1*x+A0
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fRes1L      = fA0H, f1, fRes1H // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA23        = fA25,  fArgAbsNorm2, fA23 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA12        = fA14,  fArgAbsNorm2, fA12 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA19        = fA21,  fArgAbsNorm2, fA19  // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA8         = fA10,  fArgAbsNorm2, fA8 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA17,  fArgAbsNorm2, fA15 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fArgAbsNorm11 = fArgAbsNorm11, fArgAbsNorm3, f0 // x^11
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTT         = fRes3L, fArgAbsNorm2, f0 // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA4         = fA6,  fArgAbsNorm2, fA4 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes1L, f1, fTH2 // A1*x+A0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fms.s1         fArgAbsNorm4X  = fArgAbsNorm4, fSignumX, f0 // x^4 * signum
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA19        = fA23,  fArgAbsNorm4, fA19 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA8         = fA12,  fArgAbsNorm4, fA8 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fTT         = fRes3H, fArgAbsNorm2L, fTT // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes1L, f1, fTL2 // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fA15        = fA19,  fArgAbsNorm4, fA15 // Polynomial tail
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+      fma.s1         fA4         = fA8,  fArgAbsNorm4, fA4 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes2H      = fRes3H, fArgAbsNorm2, fTT // (A3*x+A2)*x^2
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes1L      = fRes1L, f1, fA0L // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s1         fRes4       = fA15, fArgAbsNorm11, fA4 // Result of
+                                                    // polynomial tail
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fms.s1         fRes2L      = fRes3H, fArgAbsNorm2, fRes2H // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fResH       = fRes2H, f1, fRes1H // High result
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+(p14) fma.s1         fRes1L      = fRes4, fArgAbsNorm4X, fRes1L // A1*x+A0
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+(p15) fms.s1         fRes1L      = fRes4, fArgAbsNorm4X, fRes1L // A1*x+A0
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fRes2L      = fRes2L, f1, fTT // (A3*x+A2)*x^2
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fms.s1         fResL       = fRes1H, f1, fResH // Low result
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+      fma.s0         fRes1L      = fRes2L, fSignumX, fRes1L // Low result
+                 // .s0 - for symmetry issue resolving at +/-inf rounding mode
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fResL       = fResL, f1, fRes2H // Low result
+      nop.i          0
+};;
+
+{ .mfi
+      nop.m          0
+(p14) fma.s0         fResL       = fRes1L, f1, fResL // Low result
+                 // .s0 - for symmetry issue resolving at +/-inf rounding mode
+      nop.i          0
+}
+{ .mfi
+      nop.m          0
+(p15) fms.s0         fResL     = fRes1L, f1, fResL // Low result
+                 // .s0 - for symmetry issue resolving at +/-inf rounding mode
+      nop.i          0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m          0
+(p14) fma.s0         f8          = fResL, f1,  fResH// Add high and low results
+      nop.i          0
+}
+{ .mfb 
+      nop.m          0
+(p15) fms.s0         f8          = fResL, f1, fResH // Add high and low results
+      br.ret.sptk    b0      // Main path return
+};;
+
+//  satiration path ////////////////////////////////////////////////////////////
+_saturation:
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m          0
+(p14) fms.s0            f8          = f1, f1, fTiny // Saturation result r = 1-tiny
+      nop.i 0
+};;
+{ .mfb 
+      nop.m          0
+(p15) fnma.s0           f8          = f1, f1, fTiny // Saturation result r = tiny-1
+      br.ret.sptk    b0     // Saturation path return
+};;
+
+
+//  0, denormals and special IEEE numbers path /////////////////////////////////
+tanhl_spec:
+
+{ .mfi 
+      nop.m          0
+      fclass.m       p6,p0       = f8, 0x23 // To filter infinities
+                                          // 0x23 = @pos|@neg|@inf 
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fclass.m       p7,p0       = f8, 0xC7 // To filter NaNs & Zeros
+                                 // 0xC7 = @pos|@neg|@zero|@qnan|@snan
+      nop.i          0
+};;
+
+{ .mfb 
+      nop.m          0
+(p6)  fmerge.s       f8          = f8, f1     // +/-1 for INF args 
+(p6)  br.ret.spnt    b0                       // exit for x = INF
+};;
+
+{ .mfb 
+      nop.m          0
+(p7)  fma.s0         f8          = f8, f1, f8    // +/-0 for 0 args 
+                                                 // and NaNs for NaNs
+(p7)  br.ret.spnt    b0                          // exit for x = NaN or +/-0
+};;
+
+{ .mfi 
+      nop.m          0
+      fnorm.s0       f8          = f8            // Normalize arg
+      nop.i          0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m          0
+(p14) fnma.s0        f8          = f8, f8, f8  // res = r-r^2
+      nop.i          0
+}
+{ .mfb 
+      nop.m          0
+(p15) fma.s0         f8          = f8, f8, f8  // res = r+r^2
+      br.ret.sptk    b0          // 0, denormals, IEEE specials return
+};;
+
+
+//  0 < |x| < 1/8 path /////////////////////////////////////////////////////////
+_0_to_1o8:
+
+{ .mmi 
+      adds           rAddr1      = 0x11e0, rDataPtr // Ptr 1 to coeffs
+      adds           rAddr2      = 0x11f0, rDataPtr // Ptr 2 to coeffs
+      nop.i          0
+};;
+
+{ .mmi 
+      ldfe           fA15        = [rAddr1], 32 // Load A15
+      ldfe           fA13        = [rAddr2], 32 // Load A13
+      nop.i          0
+};;
+
+{ .mmi 
+      ldfe           fA11        = [rAddr1], 32 // Load A11
+      ldfe           fA9         = [rAddr2], 32 // Load A9
+      nop.i          0
+};;
+
+{ .mmi 
+      ldfe           fA7         = [rAddr1], 32 // Load A7
+      ldfe           fA5         = [rAddr2]  // Load A5
+      nop.i          0
+};;
+
+{ .mfi 
+      ldfe           fA3         = [rAddr1] // Load A3
+      fma.s1         fA11        = fA13, fArgSqr, fA11 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fArgFour    = fArgSqr, fArgSqr, f0 // a^4        
+      nop.i          0
+};;
+
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fA3         = fA5, fArgSqr, fA3 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fA7         = fA9, fArgSqr, fA7 // Polynomial tail
+      nop.i          0
+};;
+
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fA11        = fA15, fArgFour, fA11 // Polynomial tail
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fA3         = fA7, fArgFour, fA3 // Polynomial tail
+      nop.i          0
+}
+{ .mfi 
+      nop.m          0
+      fma.s1         fArgEight   = fArgFour, fArgFour, f0 // a^8
+      nop.i          0
+};;
+
+{ .mfi 
+      nop.m          0
+      fma.s1         fRes        = fA11, fArgEight, fA3 //Polynomial tail result
+      nop.i          0
+};;
+
+{ .mfb 
+      nop.m          0
+      fma.s0         f8          = fRes, fArgCube, f8 // (Polynomial tail)*x^3
+      br.ret.sptk    b0          // [0;1/8] interval return
+};;
+  
+GLOBAL_LIBM_END(tanhl)
+
+
+
+
diff --git a/sysdeps/ia64/fpu/s_tanl.S b/sysdeps/ia64/fpu/s_tanl.S
index e13e6c6cbd..607a271545 100644
--- a/sysdeps/ia64/fpu/s_tanl.S
+++ b/sysdeps/ia64/fpu/s_tanl.S
@@ -1,10 +1,10 @@
-.file "tanl.s"
+.file "tancotl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2004, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story,
-// and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -20,7 +20,7 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
+
 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -35,50 +35,78 @@
 // 
 // Intel Corporation is the author of this code, and requests that all
 // problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-// *********************************************************************
+//*********************************************************************
 //
 // History: 
 //
-// 2/02/2000 (hand-optimized)
-// 4/04/00  Unwind support added
+// 02/02/00 (hand-optimized)
+// 04/04/00 Unwind support added
 // 12/28/00 Fixed false invalid flags
+// 02/06/02 Improved speed
+// 05/07/02 Changed interface to __libm_pi_by_2_reduce
+// 05/30/02 Added cotl
+// 02/10/03 Reordered header: .section, .global, .proc, .align;
+//          used data8 for long double table values
+// 05/15/03 Reformatted data tables
+// 10/26/04 Avoided using r14-31 as scratch so not clobbered by dynamic loader
 //
-// *********************************************************************
+//*********************************************************************
 //
-// Function:   tanl(x) = tangent(x), for double-extended precision x values
+// Functions:   tanl(x) = tangent(x), for double-extended precision x values
+//              cotl(x) = cotangent(x), for double-extended precision x values
 //
-// *********************************************************************
+//*********************************************************************
 //
 // Resources Used:
 //
 //    Floating-Point Registers: f8 (Input and Return Value)
 //                              f9-f15
-//                              f32-f112
+//                              f32-f121
 //
 //    General Purpose Registers:
-//      r32-r48
-//      r49-r50 (Used to pass arguments to pi_by_2 reduce routine)
+//      r32-r70
 //
 //    Predicate Registers:      p6-p15
 //
-// *********************************************************************
+//*********************************************************************
 //
-// IEEE Special Conditions:
+// IEEE Special Conditions for tanl:
 //
 //    Denormal  fault raised on denormal inputs
 //    Overflow exceptions do not occur
-//    Underflow exceptions raised when appropriate for tan 
+//    Underflow exceptions raised when appropriate for tan
 //    (No specialized error handling for this routine)
 //    Inexact raised when appropriate by algorithm
 //
-//    tan(SNaN) = QNaN
-//    tan(QNaN) = QNaN
-//    tan(inf) = QNaN
-//    tan(+/-0) = +/-0
+//    tanl(SNaN) = QNaN
+//    tanl(QNaN) = QNaN
+//    tanl(inf) = QNaN
+//    tanl(+/-0) = +/-0
+//
+//*********************************************************************
+//
+// IEEE Special Conditions for cotl:
+//
+//    Denormal  fault raised on denormal inputs
+//    Overflow exceptions occur at zero and near zero
+//    Underflow exceptions do not occur
+//    Inexact raised when appropriate by algorithm
+//
+//    cotl(SNaN) = QNaN
+//    cotl(QNaN) = QNaN
+//    cotl(inf) = QNaN
+//    cotl(+/-0) = +/-Inf and error handling is called
+//
+//*********************************************************************
 //
-// *********************************************************************
+//    Below are mathematical and algorithmic descriptions for tanl.
+//    For cotl we use next identity cot(x) = -tan(x + Pi/2).
+//    So, to compute cot(x) we just need to increment N (N = N + 1)
+//    and invert sign of the computed result.
+//
+//*********************************************************************
 //
 // Mathematical Description
 //
@@ -106,13 +134,13 @@
 // -------
 //
 //      tan(r + c) = r + c + r^3/3          ...accurately
-//        -cot(r + c) = -1/(r+c) + r/3          ...accurately
+//     -cot(r + c) = -1/(r+c) + r/3          ...accurately
 //
 // Case 4:
 // -------
 //
 //      tan(r + c) = r + c + r^3/3 + 2r^5/15     ...accurately
-//        -cot(r + c) = -1/(r+c) + r/3 + r^3/45     ...accurately
+//     -cot(r + c) = -1/(r+c) + r/3 + r^3/45     ...accurately
 //
 //
 // The only cases left are Cases 1 and 3 of the argument reduction
@@ -143,13 +171,13 @@
 // Since Arg = N pi/4 + r + c accurately, we have
 //
 //      tan(Arg) =  tan(r+c)            for N even,
-//            = -cot(r+c)          otherwise.
+//               = -cot(r+c)            otherwise.
 //
 // Here for this case, both tan(r) and -cot(r) can be approximated
 // by simple polynomials:
 //
 //      tan(r) =    r + P1_1 r^3 + P1_2 r^5 + ... + P1_9 r^19
-//        -cot(r) = -1/r + Q1_1 r   + Q1_2 r^3 + ... + Q1_7 r^13
+//     -cot(r) = -1/r + Q1_1 r   + Q1_2 r^3 + ... + Q1_7 r^13
 //
 // accurately. Since |r| is relatively small, tan(r+c) and
 // -cot(r+c) can be accurately approximated by replacing r with
@@ -178,21 +206,21 @@
 // The required calculation is either
 //
 //      tan(r + c)  =  tan(r)  +  correction,  or
-//        -cot(r + c)  = -cot(r)  +  correction.
+//     -cot(r + c)  = -cot(r)  +  correction.
 //
 // Specifically,
 //
 //      tan(r + c) =  tan(r) + c tan'(r)  + O(c^2)
-//              =  tan(r) + c sec^2(r) + O(c^2)
-//              =  tan(r) + c SEC_sq     ...accurately
+//                 =  tan(r) + c sec^2(r) + O(c^2)
+//                 =  tan(r) + c SEC_sq     ...accurately
 //                as long as SEC_sq approximates sec^2(r)
 //                to, say, 5 bits or so.
 //
 // Similarly,
 //
-//        -cot(r + c) = -cot(r) - c cot'(r)  + O(c^2)
-//              = -cot(r) + c csc^2(r) + O(c^2)
-//              = -cot(r) + c CSC_sq     ...accurately
+//     -cot(r + c) = -cot(r) - c cot'(r)  + O(c^2)
+//                 = -cot(r) + c csc^2(r) + O(c^2)
+//                 = -cot(r) + c CSC_sq     ...accurately
 //                as long as CSC_sq approximates csc^2(r)
 //                to, say, 5 bits or so.
 //
@@ -208,14 +236,14 @@
 // where
 //
 //      B = 2^k * 1.b_1 b_2 ... b_5 1
-//         x = |r| - B
+//      x = |r| - B
 //
 // Now,
 //                   tan(B)  +   tan(x)
 //      tan( B + x ) =  ------------------------
 //                   1 -  tan(B)*tan(x)
 //
-//               /                         \ 
+//               /                         \
 //               |   tan(B)  +   tan(x)          |
 
 //      = tan(B) +  | ------------------------ - tan(B) |
@@ -248,7 +276,7 @@
 //      cot( B + x ) =  ------------------------
 //                   tan(B)  +  tan(x)
 //
-//               /                           \ 
+//               /                           \
 //               |   1 - tan(B)*tan(x)              |
 
 //      = cot(B) +  | ----------------------- - cot(B) |
@@ -273,7 +301,7 @@
 //      Arg = N * pi/2 +  r + c          ...accurately
 //
 //      tan(Arg) =  tan(r) + correction    if N is even;
-//            = -cot(r) + correction    otherwise.
+//               = -cot(r) + correction    otherwise.
 //
 // For Cases 2 and 4,
 //
@@ -292,8 +320,8 @@
 //      tan(Arg) =  r + P1_1 r^3 + P1_2 r^5 + ... + P1_9 r^19
 //                     + c*(1 + r^2)               N even
 //
-//                  = -1/(r+c) + Q1_1 r   + Q1_2 r^3 + ... + Q1_7 r^13
-//               + Q1_1*c                    N odd
+//               = -1/(r+c) + Q1_1 r   + Q1_2 r^3 + ... + Q1_7 r^13
+//                     + Q1_1*c                    N odd
 //
 //     Case normal_r: 2^(-2) <= |r| <= pi/4
 //
@@ -304,15 +332,15 @@
 //
 //      tan(Arg) = tan(r) + c*sec^2(r)
 //               = tan( sgn_r * (B+x) ) + c * sec^2(|r|)
-//                  = sgn_r * ( tan(B+x)  + sgn_r*c*sec^2(|r|) )
-//                  = sgn_r * ( tan(B+x)  + sgn_r*c*sec^2(B) )
+//               = sgn_r * ( tan(B+x)  + sgn_r*c*sec^2(|r|) )
+//               = sgn_r * ( tan(B+x)  + sgn_r*c*sec^2(B) )
 //
 // since B approximates |r| to 2^(-6) in relative accuracy.
 //
 //                 /            (1/[sin(B)*cos(B)]) * tan(x)
 //    tan(Arg) = sgn_r * | tan(B) + --------------------------------
 //                 \                     cot(B)  -  tan(x)
-//                                        \ 
+//                                        \
 //                       + CORR  |
 
 //                                     /
@@ -324,15 +352,15 @@
 //
 //      tan(Arg) = -cot(r) + c*csc^2(r)
 //               = -cot( sgn_r * (B+x) ) + c * csc^2(|r|)
-//                  = sgn_r * ( -cot(B+x)  + sgn_r*c*csc^2(|r|) )
-//                  = sgn_r * ( -cot(B+x)  + sgn_r*c*csc^2(B) )
+//               = sgn_r * ( -cot(B+x)  + sgn_r*c*csc^2(|r|) )
+//               = sgn_r * ( -cot(B+x)  + sgn_r*c*csc^2(B) )
 //
 // since B approximates |r| to 2^(-6) in relative accuracy.
 //
 //                 /            (1/[sin(B)*cos(B)]) * tan(x)
 //    tan(Arg) = sgn_r * | -cot(B) + --------------------------------
 //                 \                     tan(B)  +  tan(x)
-//                                        \ 
+//                                        \
 //                       + CORR  |
 
 //                                     /
@@ -356,8 +384,8 @@
 //    For N even,
 //
 //    rsq := r * r
-//    Result := c + r * rsq * P1_1
-//    Result := r + Result          ...in user-defined rounding
+//    Poly := c + r * rsq * P1_1
+//    Result := r + Poly          ...in user-defined rounding
 //
 //    For N odd,
 //    S_hi  := -frcpa(r)               ...8 bits
@@ -375,8 +403,8 @@
 //    For N even,
 //
 //    rsq := r * r
-//    Result := c + r * rsq * (P1_1 + rsq * P1_2)
-//    Result := r + Result          ...in user-defined rounding
+//    Poly := c + r * rsq * (P1_1 + rsq * P1_2)
+//    Result := r + Poly          ...in user-defined rounding
 //
 //    For N odd,
 //    S_hi  := -frcpa(r)               ...8 bits
@@ -414,8 +442,8 @@
 //      Poly2 := P1_4 + rsq*(P1_5 + rsq*(P1_6 + ... rsq*P1_9))
 //      CORR  := c * ( 1 + rsq )
 //      Poly  := Poly1 + r_to_the_8*Poly2
-//      Result := r*Poly + CORR
-//      Result := r + Result     ...in user-defined rounding
+//      Poly := r*Poly + CORR
+//      Result := r + Poly     ...in user-defined rounding
 //      ...note that Poly1 and r_to_the_8 can be computed in parallel
 //      ...with Poly2 (Poly1 is intentionally set to be much
 //      ...shorter than Poly2 so that r_to_the_8 and CORR can be hidden)
@@ -434,8 +462,8 @@
 //      rsq := r*r
 //      P   := Q1_1 + rsq*(Q1_2 + rsq*(Q1_3 + ... + rsq*Q1_7))
 //
-//      Result :=  r*P + S_lo
-//      Result :=  S_hi  +  Result      ...in user-defined rounding
+//      Poly :=  r*P + S_lo
+//      Result :=  S_hi  +  Poly      ...in user-defined rounding
 //
 //
 // Algorithm for the case of normal_r
@@ -454,7 +482,7 @@
 //           /           (1/[sin(B)*cos(B)]) * tan(x)
 //      sgn_r * | tan(B) + --------------------------------  +
 //           \                     cot(B)  -  tan(x)
-//                                \ 
+//                                \
 //                          CORR  |
 
 //                                /
@@ -463,7 +491,7 @@
 // calculated beforehand and stored in a table. Specifically,
 // the table values are
 //
-//      tan(B)                as  T_hi  +  T_lo;
+//      tan(B)             as  T_hi  +  T_lo;
 //      cot(B)             as  C_hi  +  C_lo;
 //      1/[sin(B)*cos(B)]  as  SC_inv
 //
@@ -559,7 +587,7 @@
 //           /             (1/[sin(B)*cos(B)]) * tan(x)
 //      sgn_r * | -cot(B) + --------------------------------  +
 //           \                     tan(B)  +  tan(x)
-//                                \ 
+//                                \
 //                          CORR  |
 
 //                                /
@@ -568,7 +596,7 @@
 // calculated beforehand and stored in a table. Specifically,
 // the table values are
 //
-//      tan(B)                as  T_hi  +  T_lo;
+//      tan(B)             as  T_hi  +  T_lo;
 //      cot(B)             as  C_hi  +  C_lo;
 //      1/[sin(B)*cos(B)]  as  SC_inv
 //
@@ -675,254 +703,382 @@
 //
 //
 
-#include "libm_support.h"
-
-#ifdef _LIBC
-.rodata
-#else
-.data
-#endif
-.align 128
-
-TANL_BASE_CONSTANTS:
-ASM_TYPE_DIRECTIVE(TANL_BASE_CONSTANTS,@object)
-data4    0x4B800000, 0xCB800000, 0x38800000, 0xB8800000 // two**24, -two**24
-                                                        // two**-14, -two**-14
-data4    0x4E44152A, 0xA2F9836E, 0x00003FFE, 0x00000000 // two_by_pi
-data4    0xCE81B9F1, 0xC84D32B0, 0x00004016, 0x00000000 // P_0
-data4    0x2168C235, 0xC90FDAA2, 0x00003FFF, 0x00000000 // P_1
-data4    0xFC8F8CBB, 0xECE675D1, 0x0000BFBD, 0x00000000 // P_2
-data4    0xACC19C60, 0xB7ED8FBB, 0x0000BF7C, 0x00000000 // P_3
-data4    0x5F000000, 0xDF000000, 0x00000000, 0x00000000 // two_to_63, -two_to_63
-data4    0x6EC6B45A, 0xA397E504, 0x00003FE7, 0x00000000 // Inv_P_0
-data4    0xDBD171A1, 0x8D848E89, 0x0000BFBF, 0x00000000 // d_1
-data4    0x18A66F8E, 0xD5394C36, 0x0000BF7C, 0x00000000 // d_2
-data4    0x2168C234, 0xC90FDAA2, 0x00003FFE, 0x00000000 // PI_BY_4
-data4    0x2168C234, 0xC90FDAA2, 0x0000BFFE, 0x00000000 // MPI_BY_4
-data4    0x3E800000, 0xBE800000, 0x00000000, 0x00000000 // two**-2, -two**-2
-data4    0x2F000000, 0xAF000000, 0x00000000, 0x00000000 // two**-33, -two**-33
-data4    0xAAAAAABD, 0xAAAAAAAA, 0x00003FFD, 0x00000000 // P1_1
-data4    0x88882E6A, 0x88888888, 0x00003FFC, 0x00000000 // P1_2
-data4    0x0F0177B6, 0xDD0DD0DD, 0x00003FFA, 0x00000000 // P1_3
-data4    0x646B8C6D, 0xB327A440, 0x00003FF9, 0x00000000 // P1_4
-data4    0x1D5F7D20, 0x91371B25, 0x00003FF8, 0x00000000 // P1_5
-data4    0x61C67914, 0xEB69A5F1, 0x00003FF6, 0x00000000 // P1_6
-data4    0x019318D2, 0xBEDD37BE, 0x00003FF5, 0x00000000 // P1_7
-data4    0x3C794015, 0x9979B146, 0x00003FF4, 0x00000000 // P1_8
-data4    0x8C6EB58A, 0x8EBD21A3, 0x00003FF3, 0x00000000 // P1_9
-data4    0xAAAAAAB4, 0xAAAAAAAA, 0x00003FFD, 0x00000000 // Q1_1
-data4    0x0B5FC93E, 0xB60B60B6, 0x00003FF9, 0x00000000 // Q1_2
-data4    0x0C9BBFBF, 0x8AB355E0, 0x00003FF6, 0x00000000 // Q1_3
-data4    0xCBEE3D4C, 0xDDEBBC89, 0x00003FF2, 0x00000000 // Q1_4
-data4    0x5F80BBB6, 0xB3548A68, 0x00003FEF, 0x00000000 // Q1_5
-data4    0x4CED5BF1, 0x91362560, 0x00003FEC, 0x00000000 // Q1_6
-data4    0x8EE92A83, 0xF189D95A, 0x00003FE8, 0x00000000 // Q1_7
-data4    0xAAAB362F, 0xAAAAAAAA, 0x00003FFD, 0x00000000 // P2_1
-data4    0xE97A6097, 0x88888886, 0x00003FFC, 0x00000000 // P2_2
-data4    0x25E716A1, 0xDD108EE0, 0x00003FFA, 0x00000000 // P2_3
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(TANL_BASE_CONSTANTS)
+
+tanl_table_1:
+data8    0xA2F9836E4E44152A, 0x00003FFE // two_by_pi
+data8    0xC84D32B0CE81B9F1, 0x00004016 // P_0
+data8    0xC90FDAA22168C235, 0x00003FFF // P_1
+data8    0xECE675D1FC8F8CBB, 0x0000BFBD // P_2
+data8    0xB7ED8FBBACC19C60, 0x0000BF7C // P_3
+LOCAL_OBJECT_END(TANL_BASE_CONSTANTS)
+
+LOCAL_OBJECT_START(tanl_table_2)
+data8    0xC90FDAA22168C234, 0x00003FFE // PI_BY_4
+data8    0xA397E5046EC6B45A, 0x00003FE7 // Inv_P_0
+data8    0x8D848E89DBD171A1, 0x0000BFBF // d_1
+data8    0xD5394C3618A66F8E, 0x0000BF7C // d_2
+data4    0x3E800000 // two**-2
+data4    0xBE800000 // -two**-2
+data4    0x00000000 // pad
+data4    0x00000000 // pad
+LOCAL_OBJECT_END(tanl_table_2)
+
+LOCAL_OBJECT_START(tanl_table_p1)
+data8    0xAAAAAAAAAAAAAABD, 0x00003FFD // P1_1
+data8    0x8888888888882E6A, 0x00003FFC // P1_2
+data8    0xDD0DD0DD0F0177B6, 0x00003FFA // P1_3
+data8    0xB327A440646B8C6D, 0x00003FF9 // P1_4
+data8    0x91371B251D5F7D20, 0x00003FF8 // P1_5
+data8    0xEB69A5F161C67914, 0x00003FF6 // P1_6
+data8    0xBEDD37BE019318D2, 0x00003FF5 // P1_7
+data8    0x9979B1463C794015, 0x00003FF4 // P1_8
+data8    0x8EBD21A38C6EB58A, 0x00003FF3 // P1_9
+LOCAL_OBJECT_END(tanl_table_p1)
+
+LOCAL_OBJECT_START(tanl_table_q1)
+data8    0xAAAAAAAAAAAAAAB4, 0x00003FFD // Q1_1
+data8    0xB60B60B60B5FC93E, 0x00003FF9 // Q1_2
+data8    0x8AB355E00C9BBFBF, 0x00003FF6 // Q1_3
+data8    0xDDEBBC89CBEE3D4C, 0x00003FF2 // Q1_4
+data8    0xB3548A685F80BBB6, 0x00003FEF // Q1_5
+data8    0x913625604CED5BF1, 0x00003FEC // Q1_6
+data8    0xF189D95A8EE92A83, 0x00003FE8 // Q1_7
+LOCAL_OBJECT_END(tanl_table_q1)
+
+LOCAL_OBJECT_START(tanl_table_p2)
+data8    0xAAAAAAAAAAAB362F, 0x00003FFD // P2_1
+data8    0x88888886E97A6097, 0x00003FFC // P2_2
+data8    0xDD108EE025E716A1, 0x00003FFA // P2_3
+LOCAL_OBJECT_END(tanl_table_p2)
+
+LOCAL_OBJECT_START(tanl_table_tm2)
 //
 //  Entries T_hi   double-precision memory format
 //  Index = 0,1,...,31  B = 2^(-2)*(1+Index/32+1/64)
 //  Entries T_lo  single-precision memory format
 //  Index = 0,1,...,31  B = 2^(-2)*(1+Index/32+1/64)
 //
-data4    0x62400794, 0x3FD09BC3, 0x23A05C32, 0x00000000
-data4    0xDFFBC074, 0x3FD124A9, 0x240078B2, 0x00000000
-data4    0x5BD4920F, 0x3FD1AE23, 0x23826B8E, 0x00000000
-data4    0x15E2701D, 0x3FD23835, 0x22D31154, 0x00000000
-data4    0x63739C2D, 0x3FD2C2E4, 0x2265C9E2, 0x00000000
-data4    0xAFEEA48B, 0x3FD34E36, 0x245C05EB, 0x00000000
-data4    0x7DBB35D1, 0x3FD3DA31, 0x24749F2D, 0x00000000
-data4    0x67321619, 0x3FD466DA, 0x2462CECE, 0x00000000
-data4    0x1F94A4D5, 0x3FD4F437, 0x246D0DF1, 0x00000000
-data4    0x740C3E6D, 0x3FD5824D, 0x240A85B5, 0x00000000
-data4    0x4CB1E73D, 0x3FD61123, 0x23F96E33, 0x00000000
-data4    0xAD9EA64B, 0x3FD6A0BE, 0x247C5393, 0x00000000
-data4    0xB804FD01, 0x3FD73125, 0x241F3B29, 0x00000000
-data4    0xAB53EE83, 0x3FD7C25E, 0x2479989B, 0x00000000
-data4    0xE6640EED, 0x3FD8546F, 0x23B343BC, 0x00000000
-data4    0xE8AF1892, 0x3FD8E75F, 0x241454D1, 0x00000000
-data4    0x53928BDA, 0x3FD97B35, 0x238613D9, 0x00000000
-data4    0xEB9DE4DE, 0x3FDA0FF6, 0x22859FA7, 0x00000000
-data4    0x99ECF92D, 0x3FDAA5AB, 0x237A6D06, 0x00000000
-data4    0x6D8F1796, 0x3FDB3C5A, 0x23952F6C, 0x00000000
-data4    0x9CFB8BE4, 0x3FDBD40A, 0x2280FC95, 0x00000000
-data4    0x87943100, 0x3FDC6CC3, 0x245D2EC0, 0x00000000
-data4    0xB736C500, 0x3FDD068C, 0x23C4AD7D, 0x00000000
-data4    0xE1DDBC31, 0x3FDDA16D, 0x23D076E6, 0x00000000
-data4    0xEB515A93, 0x3FDE3D6E, 0x244809A6, 0x00000000
-data4    0xE6E9E5F1, 0x3FDEDA97, 0x220856C8, 0x00000000
-data4    0x1963CE69, 0x3FDF78F1, 0x244BE993, 0x00000000
-data4    0x7D635BCE, 0x3FE00C41, 0x23D21799, 0x00000000
-data4    0x1C302CD3, 0x3FE05CAB, 0x248A1B1D, 0x00000000
-data4    0xDB6A1FA0, 0x3FE0ADB9, 0x23D53E33, 0x00000000
-data4    0x4A20BA81, 0x3FE0FF72, 0x24DB9ED5, 0x00000000
-data4    0x153FA6F5, 0x3FE151D9, 0x24E9E451, 0x00000000
+data8 0x3FD09BC362400794
+data4 0x23A05C32, 0x00000000
+data8 0x3FD124A9DFFBC074
+data4 0x240078B2, 0x00000000
+data8 0x3FD1AE235BD4920F
+data4 0x23826B8E, 0x00000000
+data8 0x3FD2383515E2701D
+data4 0x22D31154, 0x00000000
+data8 0x3FD2C2E463739C2D
+data4 0x2265C9E2, 0x00000000
+data8 0x3FD34E36AFEEA48B
+data4 0x245C05EB, 0x00000000
+data8 0x3FD3DA317DBB35D1
+data4 0x24749F2D, 0x00000000
+data8 0x3FD466DA67321619
+data4 0x2462CECE, 0x00000000
+data8 0x3FD4F4371F94A4D5
+data4 0x246D0DF1, 0x00000000
+data8 0x3FD5824D740C3E6D
+data4 0x240A85B5, 0x00000000
+data8 0x3FD611234CB1E73D
+data4 0x23F96E33, 0x00000000
+data8 0x3FD6A0BEAD9EA64B
+data4 0x247C5393, 0x00000000
+data8 0x3FD73125B804FD01
+data4 0x241F3B29, 0x00000000
+data8 0x3FD7C25EAB53EE83
+data4 0x2479989B, 0x00000000
+data8 0x3FD8546FE6640EED
+data4 0x23B343BC, 0x00000000
+data8 0x3FD8E75FE8AF1892
+data4 0x241454D1, 0x00000000
+data8 0x3FD97B3553928BDA
+data4 0x238613D9, 0x00000000
+data8 0x3FDA0FF6EB9DE4DE
+data4 0x22859FA7, 0x00000000
+data8 0x3FDAA5AB99ECF92D
+data4 0x237A6D06, 0x00000000
+data8 0x3FDB3C5A6D8F1796
+data4 0x23952F6C, 0x00000000
+data8 0x3FDBD40A9CFB8BE4
+data4 0x2280FC95, 0x00000000
+data8 0x3FDC6CC387943100
+data4 0x245D2EC0, 0x00000000
+data8 0x3FDD068CB736C500
+data4 0x23C4AD7D, 0x00000000
+data8 0x3FDDA16DE1DDBC31
+data4 0x23D076E6, 0x00000000
+data8 0x3FDE3D6EEB515A93
+data4 0x244809A6, 0x00000000
+data8 0x3FDEDA97E6E9E5F1
+data4 0x220856C8, 0x00000000
+data8 0x3FDF78F11963CE69
+data4 0x244BE993, 0x00000000
+data8 0x3FE00C417D635BCE
+data4 0x23D21799, 0x00000000
+data8 0x3FE05CAB1C302CD3
+data4 0x248A1B1D, 0x00000000
+data8 0x3FE0ADB9DB6A1FA0
+data4 0x23D53E33, 0x00000000
+data8 0x3FE0FF724A20BA81
+data4 0x24DB9ED5, 0x00000000
+data8 0x3FE151D9153FA6F5
+data4 0x24E9E451, 0x00000000
+LOCAL_OBJECT_END(tanl_table_tm2)
+
+LOCAL_OBJECT_START(tanl_table_tm1)
 //
 //  Entries T_hi   double-precision memory format
 //  Index = 0,1,...,19  B = 2^(-1)*(1+Index/32+1/64)
 //  Entries T_lo  single-precision memory format
 //  Index = 0,1,...,19  B = 2^(-1)*(1+Index/32+1/64)
 //
-data4    0xBA1BE39E, 0x3FE1CEC4, 0x24B60F9E, 0x00000000
-data4    0x5ABD9B2D, 0x3FE277E4, 0x248C2474, 0x00000000
-data4    0x0272B110, 0x3FE32418, 0x247B8311, 0x00000000
-data4    0x890E2DF0, 0x3FE3D38B, 0x24C55751, 0x00000000
-data4    0x46236871, 0x3FE4866D, 0x24E5BC34, 0x00000000
-data4    0x45E044B0, 0x3FE53CEE, 0x24001BA4, 0x00000000
-data4    0x82EC06E4, 0x3FE5F742, 0x24B973DC, 0x00000000
-data4    0x25DF43F9, 0x3FE6B5A1, 0x24895440, 0x00000000
-data4    0xCAFD348C, 0x3FE77844, 0x240021CA, 0x00000000
-data4    0xCEED6B92, 0x3FE83F6B, 0x24C45372, 0x00000000
-data4    0xA34F3665, 0x3FE90B58, 0x240DAD33, 0x00000000
-data4    0x2C1E56B4, 0x3FE9DC52, 0x24F846CE, 0x00000000
-data4    0x27041578, 0x3FEAB2A4, 0x2323FB6E, 0x00000000
-data4    0x9DD8C373, 0x3FEB8E9F, 0x24B3090B, 0x00000000
-data4    0x65C9AA7B, 0x3FEC709B, 0x2449F611, 0x00000000
-data4    0xACCF8435, 0x3FED58F4, 0x23616A7E, 0x00000000
-data4    0x97635082, 0x3FEE480F, 0x24C2FEAE, 0x00000000
-data4    0xF0ACC544, 0x3FEF3E57, 0x242CE964, 0x00000000
-data4    0xF7E06E4B, 0x3FF01E20, 0x2480D3EE, 0x00000000
-data4    0x8A798A69, 0x3FF0A125, 0x24DB8967, 0x00000000
+data8 0x3FE1CEC4BA1BE39E
+data4 0x24B60F9E, 0x00000000
+data8 0x3FE277E45ABD9B2D
+data4 0x248C2474, 0x00000000
+data8 0x3FE324180272B110
+data4 0x247B8311, 0x00000000
+data8 0x3FE3D38B890E2DF0
+data4 0x24C55751, 0x00000000
+data8 0x3FE4866D46236871
+data4 0x24E5BC34, 0x00000000
+data8 0x3FE53CEE45E044B0
+data4 0x24001BA4, 0x00000000
+data8 0x3FE5F74282EC06E4
+data4 0x24B973DC, 0x00000000
+data8 0x3FE6B5A125DF43F9
+data4 0x24895440, 0x00000000
+data8 0x3FE77844CAFD348C
+data4 0x240021CA, 0x00000000
+data8 0x3FE83F6BCEED6B92
+data4 0x24C45372, 0x00000000
+data8 0x3FE90B58A34F3665
+data4 0x240DAD33, 0x00000000
+data8 0x3FE9DC522C1E56B4
+data4 0x24F846CE, 0x00000000
+data8 0x3FEAB2A427041578
+data4 0x2323FB6E, 0x00000000
+data8 0x3FEB8E9F9DD8C373
+data4 0x24B3090B, 0x00000000
+data8 0x3FEC709B65C9AA7B
+data4 0x2449F611, 0x00000000
+data8 0x3FED58F4ACCF8435
+data4 0x23616A7E, 0x00000000
+data8 0x3FEE480F97635082
+data4 0x24C2FEAE, 0x00000000
+data8 0x3FEF3E57F0ACC544
+data4 0x242CE964, 0x00000000
+data8 0x3FF01E20F7E06E4B
+data4 0x2480D3EE, 0x00000000
+data8 0x3FF0A1258A798A69
+data4 0x24DB8967, 0x00000000
+LOCAL_OBJECT_END(tanl_table_tm1)
+
+LOCAL_OBJECT_START(tanl_table_cm2)
 //
 //  Entries C_hi   double-precision memory format
 //  Index = 0,1,...,31  B = 2^(-2)*(1+Index/32+1/64)
 //  Entries C_lo  single-precision memory format
 //  Index = 0,1,...,31  B = 2^(-2)*(1+Index/32+1/64)
 //
-data4    0xE63EFBD0, 0x400ED3E2, 0x259D94D4, 0x00000000
-data4    0xC515DAB5, 0x400DDDB4, 0x245F0537, 0x00000000
-data4    0xBE19A79F, 0x400CF57A, 0x25D4EA9F, 0x00000000
-data4    0xD15298ED, 0x400C1A06, 0x24AE40A0, 0x00000000
-data4    0x164B2708, 0x400B4A4C, 0x25A5AAB6, 0x00000000
-data4    0x5285B068, 0x400A855A, 0x25524F18, 0x00000000
-data4    0x3FFA549F, 0x4009CA5A, 0x24C999C0, 0x00000000
-data4    0x646AF623, 0x4009188A, 0x254FD801, 0x00000000
-data4    0x6084D0E7, 0x40086F3C, 0x2560F5FD, 0x00000000
-data4    0xA29A76EE, 0x4007CDD2, 0x255B9D19, 0x00000000
-data4    0x6C8ECA95, 0x400733BE, 0x25CB021B, 0x00000000
-data4    0x1F8DDC52, 0x4006A07E, 0x24AB4722, 0x00000000
-data4    0xC298AD58, 0x4006139B, 0x252764E2, 0x00000000
-data4    0xBAD7164B, 0x40058CAB, 0x24DAF5DB, 0x00000000
-data4    0xAE31A5D3, 0x40050B4B, 0x25EA20F4, 0x00000000
-data4    0x89F85A8A, 0x40048F21, 0x2583A3E8, 0x00000000
-data4    0xA862380D, 0x400417DA, 0x25DCC4CC, 0x00000000
-data4    0x1088FCFE, 0x4003A52B, 0x2430A492, 0x00000000
-data4    0xCD3527D5, 0x400336CC, 0x255F77CF, 0x00000000
-data4    0x5760766D, 0x4002CC7F, 0x25DA0BDA, 0x00000000
-data4    0x11CE02E3, 0x40026607, 0x256FF4A2, 0x00000000
-data4    0xD37BBE04, 0x4002032C, 0x25208AED, 0x00000000
-data4    0x7F050775, 0x4001A3BD, 0x24B72DD6, 0x00000000
-data4    0xA554848A, 0x40014789, 0x24AB4DAA, 0x00000000
-data4    0x323E81B7, 0x4000EE65, 0x2584C440, 0x00000000
-data4    0x21CF1293, 0x40009827, 0x25C9428D, 0x00000000
-data4    0x3D415EEB, 0x400044A9, 0x25DC8482, 0x00000000
-data4    0xBD72C577, 0x3FFFE78F, 0x257F5070, 0x00000000
-data4    0x75EFD28E, 0x3FFF4AC3, 0x23EBBF7A, 0x00000000
-data4    0x60B52DDE, 0x3FFEB2AF, 0x22EECA07, 0x00000000
-data4    0x35204180, 0x3FFE1F19, 0x24191079, 0x00000000
-data4    0x54F7E60A, 0x3FFD8FCA, 0x248D3058, 0x00000000
+data8 0x400ED3E2E63EFBD0
+data4 0x259D94D4, 0x00000000
+data8 0x400DDDB4C515DAB5
+data4 0x245F0537, 0x00000000
+data8 0x400CF57ABE19A79F
+data4 0x25D4EA9F, 0x00000000
+data8 0x400C1A06D15298ED
+data4 0x24AE40A0, 0x00000000
+data8 0x400B4A4C164B2708
+data4 0x25A5AAB6, 0x00000000
+data8 0x400A855A5285B068
+data4 0x25524F18, 0x00000000
+data8 0x4009CA5A3FFA549F
+data4 0x24C999C0, 0x00000000
+data8 0x4009188A646AF623
+data4 0x254FD801, 0x00000000
+data8 0x40086F3C6084D0E7
+data4 0x2560F5FD, 0x00000000
+data8 0x4007CDD2A29A76EE
+data4 0x255B9D19, 0x00000000
+data8 0x400733BE6C8ECA95
+data4 0x25CB021B, 0x00000000
+data8 0x4006A07E1F8DDC52
+data4 0x24AB4722, 0x00000000
+data8 0x4006139BC298AD58
+data4 0x252764E2, 0x00000000
+data8 0x40058CABBAD7164B
+data4 0x24DAF5DB, 0x00000000
+data8 0x40050B4BAE31A5D3
+data4 0x25EA20F4, 0x00000000
+data8 0x40048F2189F85A8A
+data4 0x2583A3E8, 0x00000000
+data8 0x400417DAA862380D
+data4 0x25DCC4CC, 0x00000000
+data8 0x4003A52B1088FCFE
+data4 0x2430A492, 0x00000000
+data8 0x400336CCCD3527D5
+data4 0x255F77CF, 0x00000000
+data8 0x4002CC7F5760766D
+data4 0x25DA0BDA, 0x00000000
+data8 0x4002660711CE02E3
+data4 0x256FF4A2, 0x00000000
+data8 0x4002032CD37BBE04
+data4 0x25208AED, 0x00000000
+data8 0x4001A3BD7F050775
+data4 0x24B72DD6, 0x00000000
+data8 0x40014789A554848A
+data4 0x24AB4DAA, 0x00000000
+data8 0x4000EE65323E81B7
+data4 0x2584C440, 0x00000000
+data8 0x4000982721CF1293
+data4 0x25C9428D, 0x00000000
+data8 0x400044A93D415EEB
+data4 0x25DC8482, 0x00000000
+data8 0x3FFFE78FBD72C577
+data4 0x257F5070, 0x00000000
+data8 0x3FFF4AC375EFD28E
+data4 0x23EBBF7A, 0x00000000
+data8 0x3FFEB2AF60B52DDE
+data4 0x22EECA07, 0x00000000
+data8 0x3FFE1F1935204180
+data4 0x24191079, 0x00000000
+data8 0x3FFD8FCA54F7E60A
+data4 0x248D3058, 0x00000000
+LOCAL_OBJECT_END(tanl_table_cm2)
+
+LOCAL_OBJECT_START(tanl_table_cm1)
 //
 //  Entries C_hi   double-precision memory format
 //  Index = 0,1,...,19  B = 2^(-1)*(1+Index/32+1/64)
 //  Entries C_lo  single-precision memory format
 //  Index = 0,1,...,19  B = 2^(-1)*(1+Index/32+1/64)
 //
-data4    0x79F6FADE, 0x3FFCC06A, 0x239C7886, 0x00000000
-data4    0x891662A6, 0x3FFBB91F, 0x250BD191, 0x00000000
-data4    0x529F155D, 0x3FFABFB6, 0x256CC3E6, 0x00000000
-data4    0x2E964AE9, 0x3FF9D300, 0x250843E3, 0x00000000
-data4    0x89DCB383, 0x3FF8F1EF, 0x2277C87E, 0x00000000
-data4    0x7C87DBD6, 0x3FF81B93, 0x256DA6CF, 0x00000000
-data4    0x1042EDE4, 0x3FF74F14, 0x2573D28A, 0x00000000
-data4    0x1784B360, 0x3FF68BAF, 0x242E489A, 0x00000000
-data4    0x7C923C4C, 0x3FF5D0B5, 0x2532D940, 0x00000000
-data4    0xF418EF20, 0x3FF51D88, 0x253C7DD6, 0x00000000
-data4    0x02F88DAE, 0x3FF4719A, 0x23DB59BF, 0x00000000
-data4    0x49DA0788, 0x3FF3CC66, 0x252B4756, 0x00000000
-data4    0x0B980DB8, 0x3FF32D77, 0x23FE585F, 0x00000000
-data4    0xE56C987A, 0x3FF2945F, 0x25378A63, 0x00000000
-data4    0xB16523F6, 0x3FF200BD, 0x247BB2E0, 0x00000000
-data4    0x8CE27778, 0x3FF17235, 0x24446538, 0x00000000
-data4    0xFDEFE692, 0x3FF0E873, 0x2514638F, 0x00000000
-data4    0x33154062, 0x3FF0632C, 0x24A7FC27, 0x00000000
-data4    0xB3EF115F, 0x3FEFC42E, 0x248FD0FE, 0x00000000
-data4    0x135D26F6, 0x3FEEC9E8, 0x2385C719, 0x00000000
+data8 0x3FFCC06A79F6FADE
+data4 0x239C7886, 0x00000000
+data8 0x3FFBB91F891662A6
+data4 0x250BD191, 0x00000000
+data8 0x3FFABFB6529F155D
+data4 0x256CC3E6, 0x00000000
+data8 0x3FF9D3002E964AE9
+data4 0x250843E3, 0x00000000
+data8 0x3FF8F1EF89DCB383
+data4 0x2277C87E, 0x00000000
+data8 0x3FF81B937C87DBD6
+data4 0x256DA6CF, 0x00000000
+data8 0x3FF74F141042EDE4
+data4 0x2573D28A, 0x00000000
+data8 0x3FF68BAF1784B360
+data4 0x242E489A, 0x00000000
+data8 0x3FF5D0B57C923C4C
+data4 0x2532D940, 0x00000000
+data8 0x3FF51D88F418EF20
+data4 0x253C7DD6, 0x00000000
+data8 0x3FF4719A02F88DAE
+data4 0x23DB59BF, 0x00000000
+data8 0x3FF3CC6649DA0788
+data4 0x252B4756, 0x00000000
+data8 0x3FF32D770B980DB8
+data4 0x23FE585F, 0x00000000
+data8 0x3FF2945FE56C987A
+data4 0x25378A63, 0x00000000
+data8 0x3FF200BDB16523F6
+data4 0x247BB2E0, 0x00000000
+data8 0x3FF172358CE27778
+data4 0x24446538, 0x00000000
+data8 0x3FF0E873FDEFE692
+data4 0x2514638F, 0x00000000
+data8 0x3FF0632C33154062
+data4 0x24A7FC27, 0x00000000
+data8 0x3FEFC42EB3EF115F
+data4 0x248FD0FE, 0x00000000
+data8 0x3FEEC9E8135D26F6
+data4 0x2385C719, 0x00000000
+LOCAL_OBJECT_END(tanl_table_cm1)
+
+LOCAL_OBJECT_START(tanl_table_scim2)
 //
 //  Entries SC_inv in Swapped IEEE format (extended)
 //  Index = 0,1,...,31  B = 2^(-2)*(1+Index/32+1/64)
 //
-data4    0x1BF30C9E, 0x839D6D4A, 0x00004001, 0x00000000
-data4    0x554B0EB0, 0x80092804, 0x00004001, 0x00000000
-data4    0xA1CF0DE9, 0xF959F94C, 0x00004000, 0x00000000
-data4    0x77378677, 0xF3086BA0, 0x00004000, 0x00000000
-data4    0xCCD4723C, 0xED154515, 0x00004000, 0x00000000
-data4    0x1C27CF25, 0xE7790944, 0x00004000, 0x00000000
-data4    0x8DDACB88, 0xE22D037D, 0x00004000, 0x00000000
-data4    0x89C73522, 0xDD2B2D8A, 0x00004000, 0x00000000
-data4    0xBB2C1171, 0xD86E1A23, 0x00004000, 0x00000000
-data4    0xDFF5E0F9, 0xD3F0E288, 0x00004000, 0x00000000
-data4    0x283BEBD5, 0xCFAF16B1, 0x00004000, 0x00000000
-data4    0x0D88DD53, 0xCBA4AFAA, 0x00004000, 0x00000000
-data4    0xCA67C43D, 0xC7CE03CC, 0x00004000, 0x00000000
-data4    0x0CA0DDB0, 0xC427BC82, 0x00004000, 0x00000000
-data4    0xF13D8CAB, 0xC0AECD57, 0x00004000, 0x00000000
-data4    0x71ECE6B1, 0xBD606C38, 0x00004000, 0x00000000
-data4    0xA44C4929, 0xBA3A0A96, 0x00004000, 0x00000000
-data4    0xE5CCCEC1, 0xB7394F6F, 0x00004000, 0x00000000
-data4    0x9637D8BC, 0xB45C1203, 0x00004000, 0x00000000
-data4    0x92CB051B, 0xB1A05528, 0x00004000, 0x00000000
-data4    0x6BA2FFD0, 0xAF04432B, 0x00004000, 0x00000000
-data4    0x7221235F, 0xAC862A23, 0x00004000, 0x00000000
-data4    0x5F00A9D1, 0xAA2478AF, 0x00004000, 0x00000000
-data4    0x81E082BF, 0xA7DDBB0C, 0x00004000, 0x00000000
-data4    0x45684FEE, 0xA5B0987D, 0x00004000, 0x00000000
-data4    0x627A8F53, 0xA39BD0F5, 0x00004000, 0x00000000
-data4    0x6EC5C8B0, 0xA19E3B03, 0x00004000, 0x00000000
-data4    0x91CD7C66, 0x9FB6C1F0, 0x00004000, 0x00000000
-data4    0x1FA3DF8A, 0x9DE46410, 0x00004000, 0x00000000
-data4    0xA8F6B888, 0x9C263139, 0x00004000, 0x00000000
-data4    0xC27B0450, 0x9A7B4968, 0x00004000, 0x00000000
-data4    0x5EE614EE, 0x98E2DB7E, 0x00004000, 0x00000000
+data8    0x839D6D4A1BF30C9E, 0x00004001
+data8    0x80092804554B0EB0, 0x00004001
+data8    0xF959F94CA1CF0DE9, 0x00004000
+data8    0xF3086BA077378677, 0x00004000
+data8    0xED154515CCD4723C, 0x00004000
+data8    0xE77909441C27CF25, 0x00004000
+data8    0xE22D037D8DDACB88, 0x00004000
+data8    0xDD2B2D8A89C73522, 0x00004000
+data8    0xD86E1A23BB2C1171, 0x00004000
+data8    0xD3F0E288DFF5E0F9, 0x00004000
+data8    0xCFAF16B1283BEBD5, 0x00004000
+data8    0xCBA4AFAA0D88DD53, 0x00004000
+data8    0xC7CE03CCCA67C43D, 0x00004000
+data8    0xC427BC820CA0DDB0, 0x00004000
+data8    0xC0AECD57F13D8CAB, 0x00004000
+data8    0xBD606C3871ECE6B1, 0x00004000
+data8    0xBA3A0A96A44C4929, 0x00004000
+data8    0xB7394F6FE5CCCEC1, 0x00004000
+data8    0xB45C12039637D8BC, 0x00004000
+data8    0xB1A0552892CB051B, 0x00004000
+data8    0xAF04432B6BA2FFD0, 0x00004000
+data8    0xAC862A237221235F, 0x00004000
+data8    0xAA2478AF5F00A9D1, 0x00004000
+data8    0xA7DDBB0C81E082BF, 0x00004000
+data8    0xA5B0987D45684FEE, 0x00004000
+data8    0xA39BD0F5627A8F53, 0x00004000
+data8    0xA19E3B036EC5C8B0, 0x00004000
+data8    0x9FB6C1F091CD7C66, 0x00004000
+data8    0x9DE464101FA3DF8A, 0x00004000
+data8    0x9C263139A8F6B888, 0x00004000
+data8    0x9A7B4968C27B0450, 0x00004000
+data8    0x98E2DB7E5EE614EE, 0x00004000
+LOCAL_OBJECT_END(tanl_table_scim2)
+
+LOCAL_OBJECT_START(tanl_table_scim1)
 //
 //  Entries SC_inv in Swapped IEEE format (extended)
 //  Index = 0,1,...,19  B = 2^(-1)*(1+Index/32+1/64)
 //
-data4    0x13B2B5BA, 0x969F335C, 0x00004000, 0x00000000
-data4    0xD4C0F548, 0x93D446D9, 0x00004000, 0x00000000
-data4    0x61B798AF, 0x9147094F, 0x00004000, 0x00000000
-data4    0x758787AC, 0x8EF317CC, 0x00004000, 0x00000000
-data4    0xB99EEFDB, 0x8CD498B3, 0x00004000, 0x00000000
-data4    0xDFF8BC37, 0x8AE82A7D, 0x00004000, 0x00000000
-data4    0xE3C55D42, 0x892AD546, 0x00004000, 0x00000000
-data4    0xD15573C1, 0x8799FEA9, 0x00004000, 0x00000000
-data4    0x435A4B4C, 0x86335F88, 0x00004000, 0x00000000
-data4    0x3E93A87B, 0x84F4FB6E, 0x00004000, 0x00000000
-data4    0x80A382FB, 0x83DD1952, 0x00004000, 0x00000000
-data4    0xA4CB8C9E, 0x82EA3D7F, 0x00004000, 0x00000000
-data4    0x6861D0A8, 0x821B247C, 0x00004000, 0x00000000
-data4    0x63E8D244, 0x816EBED1, 0x00004000, 0x00000000
-data4    0x27E4CFC6, 0x80E42D91, 0x00004000, 0x00000000
-data4    0x28E64AFD, 0x807ABF8D, 0x00004000, 0x00000000
-data4    0x863B4FD8, 0x8031EF26, 0x00004000, 0x00000000
-data4    0xAE8C11FD, 0x800960AD, 0x00004000, 0x00000000
-data4    0x5FDBEC21, 0x8000E147, 0x00004000, 0x00000000
-data4    0xA07791FA, 0x80186650, 0x00004000, 0x00000000
-ASM_SIZE_DIRECTIVE(TANL_BASE_CONSTANTS)
-
-Arg                 = f8   
+data8    0x969F335C13B2B5BA, 0x00004000
+data8    0x93D446D9D4C0F548, 0x00004000
+data8    0x9147094F61B798AF, 0x00004000
+data8    0x8EF317CC758787AC, 0x00004000
+data8    0x8CD498B3B99EEFDB, 0x00004000
+data8    0x8AE82A7DDFF8BC37, 0x00004000
+data8    0x892AD546E3C55D42, 0x00004000
+data8    0x8799FEA9D15573C1, 0x00004000
+data8    0x86335F88435A4B4C, 0x00004000
+data8    0x84F4FB6E3E93A87B, 0x00004000
+data8    0x83DD195280A382FB, 0x00004000
+data8    0x82EA3D7FA4CB8C9E, 0x00004000
+data8    0x821B247C6861D0A8, 0x00004000
+data8    0x816EBED163E8D244, 0x00004000
+data8    0x80E42D9127E4CFC6, 0x00004000
+data8    0x807ABF8D28E64AFD, 0x00004000
+data8    0x8031EF26863B4FD8, 0x00004000
+data8    0x800960ADAE8C11FD, 0x00004000
+data8    0x8000E1475FDBEC21, 0x00004000
+data8    0x80186650A07791FA, 0x00004000
+LOCAL_OBJECT_END(tanl_table_scim1)
+
+Arg                 = f8
+Save_Norm_Arg       = f8        // For input to reduction routine
 Result              = f8
-fp_tmp              = f9
+r                   = f8        // For output from reduction routine
+c                   = f9        // For output from reduction routine
 U_2                 = f10
-rsq                =  f11
+rsq                 = f11
 C_hi                = f12
 C_lo                = f13
 T_hi                = f14
 T_lo                = f15
 
-N_0                 = f32
 d_1                 = f33
-MPI_BY_4            = f34
+N_0                 = f34
 tail                = f35
 tanx                = f36
 Cx                  = f37
@@ -949,8 +1105,6 @@ P1_7                = f51
 P1_8                = f52
 P1_9                = f53
 
-TWO_TO_63           = f54
-NEGTWO_TO_63        = f55
 x                   = f56
 xsq                 = f57
 Tx                  = f58
@@ -966,12 +1120,10 @@ B                   = f67
 SC_inv              = f68
 Pos_r               = f69
 N_0_fix             = f70
-PI_BY_4             = f71
-NEGTWO_TO_NEG2      = f72
-TWO_TO_24           = f73
+d_2                 = f71
+PI_BY_4             = f72
 TWO_TO_NEG14        = f74
 TWO_TO_NEG33        = f75
-NEGTWO_TO_24        = f76
 NEGTWO_TO_NEG14     = f76
 NEGTWO_TO_NEG33     = f77
 two_by_PI           = f78
@@ -982,13 +1134,14 @@ P_2                 = f82
 P_3                 = f83
 s_val               = f84
 w                   = f85
-c                   = f86
-r                   = f87
+B_mask1             = f86
+B_mask2             = f87
+w2                  = f88
 A                   = f89
 a                   = f90
 t                   = f91
 U_1                 = f92
-d_2                 = f93
+NEGTWO_TO_NEG2      = f93
 TWO_TO_NEG2         = f94
 Q1_1                = f95
 Q1_2                = f96
@@ -1009,609 +1162,643 @@ V_hiabs             = f110
 V                   = f111
 Inv_P_0             = f112
 
+FR_inv_pi_2to63     = f113
+FR_rshf_2to64       = f114
+FR_2tom64           = f115
+FR_rshf             = f116
+Norm_Arg            = f117
+Abs_Arg             = f118
+TWO_TO_NEG65        = f119
+fp_tmp              = f120
+mOne                = f121
+
 GR_SAVE_B0     = r33
 GR_SAVE_GP     = r34
 GR_SAVE_PFS    = r35
-delta1         = r36
+table_base     = r36
 table_ptr1     = r37
 table_ptr2     = r38
-i_0            = r39
-i_1            = r40 
-N_fix_gr       = r41 
-N_inc          = r42 
-exp_Arg        = r43 
-exp_r          = r44 
-sig_r          = r45 
-lookup         = r46   
-table_offset   = r47 
-Create_B       = r48 
+table_ptr3     = r39
+lookup         = r40
+N_fix_gr       = r41
+GR_exp_2tom2   = r42
+GR_exp_2tom65  = r43
+exp_r          = r44
+sig_r          = r45
+bmask1         = r46
+table_offset   = r47
+bmask2         = r48
 gr_tmp         = r49
+cot_flag       = r50
+
+GR_sig_inv_pi  = r51
+GR_rshf_2to64  = r52
+GR_exp_2tom64  = r53
+GR_rshf        = r54
+GR_exp_2_to_63 = r55
+GR_exp_2_to_24 = r56
+GR_signexp_x   = r57
+GR_exp_x       = r58
+GR_exp_mask    = r59
+GR_exp_2tom14  = r60
+GR_exp_m2tom14 = r61
+GR_exp_2tom33  = r62
+GR_exp_m2tom33 = r63
+
+GR_SAVE_B0                  = r64
+GR_SAVE_PFS                 = r65
+GR_SAVE_GP                  = r66
+
+GR_Parameter_X              = r67
+GR_Parameter_Y              = r68
+GR_Parameter_RESULT         = r69
+GR_Parameter_Tag            = r70
+
 
 .section .text
-.global tanl
-.proc tanl
-tanl:
-#ifdef _LIBC
-.global __tanl
-.proc __tanl
-__tanl:
-#endif
-{ .mfi
-alloc r32 = ar.pfs, 0,17,2,0
-(p0)   fclass.m.unc  p6,p0 = Arg, 0x1E7
-      addl gr_tmp = -1,r0             
-}
-{ .mfi
-  nop.m 0
-(p0)   fclass.nm.unc  p7,p0 = Arg, 0x1FF
-  nop.i 0
+.global __libm_tanl#
+.global __libm_cotl#
+
+.proc __libm_cotl#
+__libm_cotl:
+.endp __libm_cotl#
+LOCAL_LIBM_ENTRY(cotl)
+
+{ .mlx
+      alloc r32 = ar.pfs, 0,35,4,0
+      movl GR_sig_inv_pi = 0xa2f9836e4e44152a // significand of 1/pi
+}
+{ .mlx
+      mov GR_exp_mask = 0x1ffff            // Exponent mask
+      movl GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+64)
+}
+;;
+
+//     Check for NatVals, Infs , NaNs, and Zeros
+{ .mfi
+      getf.exp GR_signexp_x = Arg          // Get sign and exponent of x
+      fclass.m  p6,p0 = Arg, 0x1E7         // Test for natval, nan, inf, zero
+      mov cot_flag = 0x1
+}
+{ .mfb
+      addl table_base = @ltoff(TANL_BASE_CONSTANTS), gp // Pointer to table ptr
+      fnorm.s1 Norm_Arg = Arg              // Normalize x
+      br.cond.sptk COMMON_PATH
 };;
 
+LOCAL_LIBM_END(cotl)
+
+
+.proc __libm_tanl#
+__libm_tanl:
+.endp __libm_tanl#
+GLOBAL_IEEE754_ENTRY(tanl)
+
+{ .mlx
+      alloc r32 = ar.pfs, 0,35,4,0
+      movl GR_sig_inv_pi = 0xa2f9836e4e44152a // significand of 1/pi
+}
+{ .mlx
+      mov GR_exp_mask = 0x1ffff            // Exponent mask
+      movl GR_rshf_2to64 = 0x47e8000000000000 // 1.1000 2^(63+64)
+}
+;;
+
+//     Check for NatVals, Infs , NaNs, and Zeros
 { .mfi
-(p0)  addl           table_ptr1   = @ltoff(TANL_BASE_CONSTANTS), gp
-	nop.f 999
+      getf.exp GR_signexp_x = Arg          // Get sign and exponent of x
+      fclass.m  p6,p0 = Arg, 0x1E7         // Test for natval, nan, inf, zero
+      mov cot_flag = 0x0
+}
+{ .mfi
+      addl table_base = @ltoff(TANL_BASE_CONSTANTS), gp // Pointer to table ptr
+      fnorm.s1 Norm_Arg = Arg              // Normalize x
       nop.i 0
+};;
+
+// Common path for both tanl and cotl
+COMMON_PATH:
+{ .mfi
+      setf.sig FR_inv_pi_2to63 = GR_sig_inv_pi // Form 1/pi * 2^63
+      fclass.m p9, p0 = Arg, 0x0b          // Test x denormal
+      mov GR_exp_2tom64 = 0xffff - 64      // Scaling constant to compute N
+}
+{ .mlx
+      setf.d FR_rshf_2to64 = GR_rshf_2to64 // Form const 1.1000 * 2^(63+64)
+      movl GR_rshf = 0x43e8000000000000    // Form const 1.1000 * 2^63
 }
 ;;
-{ .mmi
-(p0)  ld8 table_ptr1 = [table_ptr1]
-      setf.sig fp_tmp = gr_tmp   // Make a constant so fmpy produces inexact
-      nop.i 999
+
+// Check for everything - if false, then must be pseudo-zero or pseudo-nan.
+// Branch out to deal with special values.
+{ .mfi
+      addl gr_tmp = -1,r0
+      fclass.nm  p7,p0 = Arg, 0x1FF        // Test x unsupported
+      mov GR_exp_2_to_63 = 0xffff + 63     // Exponent of 2^63
+}
+{ .mfb
+      ld8 table_base = [table_base]        // Get pointer to constant table
+      fms.s1 mOne = f0, f0, f1
+(p6)  br.cond.spnt TANL_SPECIAL            // Branch if x natval, nan, inf, zero
 }
 ;;
 
-//
-//     Check for NatVals, Infs , NaNs, and Zeros 
-//     Check for everything - if false, then must be pseudo-zero
-//     or pseudo-nan.
-//     Local table pointer
-//
-{ .mbb
-(p0)   add table_ptr2 = 96, table_ptr1
-(p6)   br.cond.spnt L(TANL_SPECIAL) 
-(p7)   br.cond.spnt L(TANL_SPECIAL) ;;
+{ .mmb
+      setf.sig fp_tmp = gr_tmp   // Make a constant so fmpy produces inexact
+      mov GR_exp_2_to_24 = 0xffff + 24     // Exponent of 2^24
+(p9)  br.cond.spnt TANL_DENORMAL           // Branch if x denormal
 }
+;;
+
+TANL_COMMON:
+// Return to here if x denormal
 //
-//     Point to Inv_P_0
-//     Branch out to deal with unsupporteds and special values. 
-//
-{ .mmf
-(p0)   ldfs TWO_TO_24 = [table_ptr1],4
-(p0)   ldfs TWO_TO_63 = [table_ptr2],4
-//
-//     Load -2**24, load -2**63.
-//
-(p0)   fcmp.eq.s0 p0, p6 = Arg, f1 ;;
-}
+// Do fcmp to generate Denormal exception
+//  - can't do FNORM (will generate Underflow when U is unmasked!)
+// Branch out to deal with unsupporteds values.
 { .mfi
-(p0)   ldfs NEGTWO_TO_63 = [table_ptr2],12
-(p0)   fnorm.s1     Arg = Arg
-	nop.i 999
+      setf.exp FR_2tom64 = GR_exp_2tom64 // Form 2^-64 for scaling N_float
+      fcmp.eq.s0 p0, p6 = Arg, f1        // Dummy to flag denormals
+      add table_ptr1 = 0, table_base     // Point to tanl_table_1
 }
-//
-//     Load 2**24, Load 2**63.
-//
-{ .mmi
-(p0)   ldfs NEGTWO_TO_24 = [table_ptr1],12 ;;
-//
-//     Do fcmp to generate Denormal exception 
-//     - can't do FNORM (will generate Underflow when U is unmasked!)
-//     Normalize input argument.
-//
-(p0)   ldfe two_by_PI = [table_ptr1],16
-	nop.i 999
+{ .mib
+      setf.d FR_rshf = GR_rshf           // Form right shift const 1.1000 * 2^63
+      add table_ptr2 = 80, table_base    // Point to tanl_table_2
+(p7)  br.cond.spnt TANL_UNSUPPORTED      // Branch if x unsupported type
 }
-{ .mmi
-(p0)   ldfe Inv_P_0 = [table_ptr2],16 ;;
-(p0)   ldfe d_1 = [table_ptr2],16
-	nop.i 999
+;;
+
+{ .mfi
+      and GR_exp_x = GR_exp_mask, GR_signexp_x // Get exponent of x
+      fmpy.s1 Save_Norm_Arg = Norm_Arg, f1     // Save x if large arg reduction
+      dep.z bmask1 = 0x7c, 56, 8               // Form mask to get 5 msb of r
+                                               // bmask1 = 0x7c00000000000000
 }
+;;
+
 //
 //     Decide about the paths to take:
-//     PR_1 and PR_3 set if -2**24 < Arg < 2**24 - CASE 1 OR 2
-//     OTHERWISE - CASE 3 OR 4
-//     Load inverse of P_0 .
-//     Set PR_6 if Arg <= -2**63
-//     Are there any Infs, NaNs, or zeros?
+//     Set PR_6 if |Arg| >= 2**63
+//     Set PR_9 if |Arg| < 2**24 - CASE 1 OR 2
+//     OTHERWISE Set PR_8 - CASE 3 OR 4
 //
-{ .mmi
-(p0)   ldfe P_0 = [table_ptr1],16 ;;
-(p0)   ldfe d_2 = [table_ptr2],16
-	nop.i 999
+//     Branch out if the magnitude of the input argument is >= 2^63
+//     - do this branch before the next.
+{ .mfi
+      ldfe two_by_PI = [table_ptr1],16        // Load 2/pi
+      nop.f 999
+      dep.z bmask2 = 0x41, 57, 7              // Form mask to OR to produce B
+                                              // bmask2 = 0x8200000000000000
 }
-//
-//     Set PR_8 if Arg <= -2**24
-//     Set PR_6 if Arg >=  2**63
-//
-{ .mmi
-(p0)   ldfe P_1 = [table_ptr1],16 ;;
-(p0)   ldfe PI_BY_4 = [table_ptr2],16
-	nop.i 999
+{ .mib
+      ldfe PI_BY_4 = [table_ptr2],16          // Load pi/4
+      cmp.ge p6,p0 = GR_exp_x, GR_exp_2_to_63 // Is |x| >= 2^63
+(p6)  br.cond.spnt TANL_ARG_TOO_LARGE         // Branch if |x| >= 2^63
 }
-//
-//     Set PR_8 if Arg >= 2**24
-//
+;;
+
 { .mmi
-(p0)   ldfe P_2 = [table_ptr1],16 ;;
-(p0)   ldfe   MPI_BY_4 = [table_ptr2],16
-	nop.i 999
-}
-//
-//     Load  P_2 and PI_BY_4
-//
-{ .mfi
-(p0)   ldfe   P_3 = [table_ptr1],16
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)   fcmp.le.unc.s1 p6,p7 = Arg,NEGTWO_TO_63
-	nop.i 999
+      ldfe P_0 = [table_ptr1],16              // Load P_0
+      ldfe Inv_P_0 = [table_ptr2],16          // Load Inv_P_0
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p0)   fcmp.le.unc.s1 p8,p9 = Arg,NEGTWO_TO_24
-	nop.i 999 ;;
+      ldfe P_1 = [table_ptr1],16              // Load P_1
+      fmerge.s Abs_Arg = f0, Norm_Arg         // Get |x|
+      mov GR_exp_m2tom33 = 0x2ffff - 33       // Form signexp of -2^-33
 }
 { .mfi
-	nop.m 999
-(p7)   fcmp.ge.s1 p6,p0 = Arg,TWO_TO_63
-	nop.i 999
+      ldfe d_1 = [table_ptr2],16              // Load d_1 for 2^24 <= |x| < 2^63
+      nop.f 999
+      mov GR_exp_2tom33 = 0xffff - 33         // Form signexp of 2^-33
 }
-{ .mfi
-	nop.m 999
-(p9)   fcmp.ge.s1 p8,p0 = Arg,TWO_TO_24
-	nop.i 999 ;;
+;;
+
+{ .mmi
+      ldfe P_2 = [table_ptr1],16              // Load P_2
+      ldfe d_2 = [table_ptr2],16              // Load d_2 for 2^24 <= |x| < 2^63
+      cmp.ge p8,p0 = GR_exp_x, GR_exp_2_to_24 // Is |x| >= 2^24
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Load  P_3 and -PI_BY_4
-//
-(p6)   br.cond.spnt L(TANL_ARG_TOO_LARGE) ;;
+;;
+
+// Use special scaling to right shift so N=Arg * 2/pi is in rightmost bits
+// Branch to Cases 3 or 4 if Arg <= -2**24 or Arg >= 2**24
+{ .mfb
+      ldfe   P_3 = [table_ptr1],16            // Load P_3
+      fma.s1      N_fix = Norm_Arg, FR_inv_pi_2to63, FR_rshf_2to64
+(p8)  br.cond.spnt TANL_LARGER_ARG            // Branch if 2^24 <= |x| < 2^63
 }
-{ .mib
-	nop.m 999
-	nop.i 999
-//
-//     Load 2**(-2).
-//     Load -2**(-2).
-//     Branch out if we have a special argument.
-//     Branch out if the magnitude of the input argument is too large
-//     - do this branch before the next.
+;;
+
+// Here if 0 < |x| < 2^24
+//     ARGUMENT REDUCTION CODE - CASE 1 and 2
 //
-(p8)   br.cond.spnt L(TANL_LARGER_ARG) ;;
+{ .mmf
+      setf.exp TWO_TO_NEG33 = GR_exp_2tom33      // Form 2^-33
+      setf.exp NEGTWO_TO_NEG33 = GR_exp_m2tom33  // Form -2^-33
+      fmerge.s r = Norm_Arg,Norm_Arg          // Assume r=x, ok if |x| < pi/4
 }
+;;
+
 //
-//     Branch to Cases 3 or 4 if Arg <= -2**24 or Arg >= 2**24
+// If |Arg| < pi/4,  set PR_8, else  pi/4 <=|Arg| < 2^24 - set PR_9.
 //
+//     Case 2: Convert integer N_fix back to normalized floating-point value.
 { .mfi
-(p0)   ldfs TWO_TO_NEG2 = [table_ptr2],4
-//     ARGUMENT REDUCTION CODE - CASE 1 and 2
-//     Load 2**(-2).
-//     Load -2**(-2).
-(p0)   fmpy.s1 N = Arg,two_by_PI
-	nop.i 999 ;;
+      getf.sig sig_r = Norm_Arg               // Get sig_r if 1/4 <= |x| < pi/4
+      fcmp.lt.s1 p8,p9= Abs_Arg,PI_BY_4       // Test |x| < pi/4
+      mov GR_exp_2tom2 = 0xffff - 2           // Form signexp of 2^-2
 }
 { .mfi
-(p0)   ldfs NEGTWO_TO_NEG2 = [table_ptr2],12
-//
-//     N = Arg * 2/pi
-//
-(p0)   fcmp.lt.unc.s1 p8,p9= Arg,PI_BY_4
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-//
-//     if Arg < pi/4,  set PR_8.
-//
-(p8)   fcmp.gt.s1 p8,p9= Arg,MPI_BY_4
-	nop.i 999 ;;
+      ldfps TWO_TO_NEG2, NEGTWO_TO_NEG2 = [table_ptr2] // Load 2^-2, -2^-2
+      fms.s1 N = N_fix, FR_2tom64, FR_rshf    // Use scaling to get N floated
+      mov N_fix_gr = r0                       // Assume N=0, ok if |x| < pi/4
 }
+;;
+
 //
 //     Case 1: Is |r| < 2**(-2).
 //     Arg is the same as r in this case.
 //     r = Arg
 //     c = 0
 //
+//     Case 2: Place integer part of N in GP register.
 { .mfi
-(p8)   mov N_fix_gr = r0
-//
-//     if Arg > -pi/4, reset PR_8.
-//     Select the case when |Arg| < pi/4 - set PR[8] = true.
-//     Else Select the case when |Arg| >= pi/4 - set PR[9] = true.
-//
-(p0)   fcvt.fx.s1 N_fix = N
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-//
-//     Grab the integer part of N .
-//
-(p8)   mov r = Arg
-	nop.i 999
-}
-{ .mfi
-	nop.m 999
-(p8)   mov c = f0
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p8)   fcmp.lt.unc.s1 p10, p11 = Arg, TWO_TO_NEG2
-	nop.i 999 ;;
+(p9)  getf.sig N_fix_gr = N_fix
+      fmerge.s c = f0, f0                     // Assume c=0, ok if |x| < pi/4
+      cmp.lt p10, p0 = GR_exp_x, GR_exp_2tom2 // Test if |x| < 1/4
 }
+;;
+
 { .mfi
-	nop.m 999
-(p10)  fcmp.gt.s1 p10,p0 = Arg, NEGTWO_TO_NEG2
-	nop.i 999 ;;
+      setf.sig B_mask1 = bmask1               // Form mask to get 5 msb of r
+      nop.f 999
+      mov exp_r = GR_exp_x                    // Get exp_r if 1/4 <= |x| < pi/4
 }
-{ .mfi
-	nop.m 999
-//
-//     Case 2: Place integer part of N in GP register.
-//
-(p9)   fcvt.xf N = N_fix
-	nop.i 999 ;;
-}
-{ .mib
-(p9)   getf.sig N_fix_gr = N_fix
-	nop.i 999
-//
-//     Case 2: Convert integer N_fix back to normalized floating-point value.
-//
-(p10)  br.cond.spnt L(TANL_SMALL_R) ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p8)   br.cond.sptk L(TANL_NORMAL_R) ;;
+{ .mbb
+      setf.sig B_mask2 = bmask2               // Form mask to form B from r
+(p10) br.cond.spnt TANL_SMALL_R               // Branch if 0 < |x| < 1/4
+(p8)  br.cond.spnt TANL_NORMAL_R              // Branch if 1/4 <= |x| < pi/4
 }
+;;
+
+// Here if pi/4 <= |x| < 2^24
 //
 //     Case 1: PR_3 is only affected  when PR_1 is set.
 //
-{ .mmi
-(p9)   ldfs TWO_TO_NEG33 = [table_ptr2], 4 ;;
 //
-//     Case 2: Load 2**(-33).
+//     Case 2: w = N * P_2
+//     Case 2: s_val = -N * P_1  + Arg
 //
-(p9)   ldfs NEGTWO_TO_NEG33 = [table_ptr2], 4
-	nop.i 999 ;;
+
+{ .mfi
+      nop.m 999
+      fnma.s1 s_val = N, P_1, Norm_Arg
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//     Case 2: Load -2**(-33).
-//
-(p9)   fnma.s1 s_val = N, P_1, Arg
-	nop.i 999
+      nop.m 999
+      fmpy.s1 w = N, P_2                     // w = N * P_2 for |s| >= 2^-33
+      nop.i 999
 }
+;;
+
+//     Case 2_reduce: w = N * P_3 (change sign)
 { .mfi
-	nop.m 999
-(p9)   fmpy.s1 w = N, P_2
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 w2 = N, P_3                    // w = N * P_3 for |s| < 2^-33
+      nop.i 999
 }
+;;
+
+//     Case 1_reduce: r = s + w (change sign)
 { .mfi
-	nop.m 999
-//
-//     Case 2: w = N * P_2
-//     Case 2: s_val = -N * P_1  + Arg
-//
-(p0)   fcmp.lt.unc.s1 p9,p8 = s_val, TWO_TO_NEG33
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 r = s_val, w                   // r = s_val - w for |s| >= 2^-33
+      nop.i 999
 }
+;;
+
+//     Case 2_reduce: U_1 = N * P_2 + w
 { .mfi
-	nop.m 999
+      nop.m 999
+      fma.s1  U_1 = N, P_2, w2              // U_1 = N * P_2 + w for |s| < 2^-33
+      nop.i 999
+}
+;;
+
 //
 //     Decide between case_1 and case_2 reduce:
+//     Case 1_reduce:  |s| >= 2**(-33)
+//     Case 2_reduce:  |s| < 2**(-33)
 //
-(p9)   fcmp.gt.s1 p9, p8 = s_val, NEGTWO_TO_NEG33
-	nop.i 999 ;;
+{ .mfi
+      nop.m 999
+      fcmp.lt.s1 p9, p8 = s_val, TWO_TO_NEG33
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
-//     Case 1_reduce:  s <= -2**(-33) or s >= 2**(-33)
-//     Case 2_reduce: -2**(-33) < s < 2**(-33)
-//
-(p8)   fsub.s1 r = s_val, w
-	nop.i 999
+      nop.m 999
+(p9)  fcmp.gt.s1 p9, p8 = s_val, NEGTWO_TO_NEG33
+      nop.i 999
 }
+;;
+
+//     Case 1_reduce: c = s - r
 { .mfi
-	nop.m 999
-(p9)   fmpy.s1 w = N, P_3
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 c = s_val, r                     // c = s_val - r for |s| >= 2^-33
+      nop.i 999
 }
+;;
+
+//     Case 2_reduce: r is complete here - continue to calculate c .
+//     r = s - U_1
 { .mfi
-	nop.m 999
-(p9)   fma.s1  U_1 = N, P_2, w
-	nop.i 999
+      nop.m 999
+(p9)  fsub.s1 r = s_val, U_1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+(p9)  fms.s1 U_2 = N, P_2, U_1
+      nop.i 999
+}
+;;
+
 //
 //     Case 1_reduce: Is |r| < 2**(-2), if so set PR_10
-//     else set PR_11.
+//     else set PR_13.
 //
-(p8)   fsub.s1 c = s_val, r
-	nop.i 999 ;;
-}
+
 { .mfi
-	nop.m 999
-//
-//     Case 1_reduce: r = s + w (change sign)
-//     Case 2_reduce: w = N * P_3 (change sign)
-//
-(p8)   fcmp.lt.unc.s1 p10, p11 = r, TWO_TO_NEG2
-	nop.i 999 ;;
+      nop.m 999
+      fand B = B_mask1, r
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p10)  fcmp.gt.s1 p10, p11 = r, NEGTWO_TO_NEG2
-	nop.i 999 ;;
+      nop.m 999
+(p8)  fcmp.lt.unc.s1 p10, p13 = r, TWO_TO_NEG2
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p9)   fsub.s1 r = s_val, U_1
-	nop.i 999
+(p8)  getf.sig sig_r = r               // Get signif of r if |s| >= 2^-33
+      nop.f 999
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-//
+(p8)  getf.exp exp_r = r               // Extract signexp of r if |s| >= 2^-33
+(p10) fcmp.gt.s1 p10, p13 = r, NEGTWO_TO_NEG2
+      nop.i 999
+}
+;;
+
 //     Case 1_reduce: c is complete here.
+//     Case 1: Branch to SMALL_R or NORMAL_R.
 //     c = c + w (w has not been negated.)
-//     Case 2_reduce: r is complete here - continue to calculate c .
-//     r = s - U_1
-//
-(p9)   fms.s1 U_2 = N, P_2, U_1
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
+      nop.m 999
+(p8)  fsub.s1 c = c, w                         // c = c - w for |s| >= 2^-33
+      nop.i 999
+}
+{ .mbb
+      nop.m 999
+(p10) br.cond.spnt TANL_SMALL_R     // Branch if pi/4 < |x| < 2^24 and |r|<1/4
+(p13) br.cond.sptk TANL_NORMAL_R_A  // Branch if pi/4 < |x| < 2^24 and |r|>=1/4
+}
+;;
+
+
+// Here if pi/4 < |x| < 2^24 and |s| < 2^-33
 //
-//     Case 1_reduce: c = s - r
-//     Case 2_reduce: U_1 = N * P_2 + w
+//     Is i_1 = lsb of N_fix_gr even or odd?
+//     if i_1 == 0, set p11, else set p12.
 //
-(p8)   fsub.s1 c = c, w
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p9)   fsub.s1 s_val = s_val, r
-	nop.i 999
+      nop.m 999
+      fsub.s1 s_val = s_val, r
+      add N_fix_gr = N_fix_gr, cot_flag // N = N + 1 (for cotl)
 }
-{ .mfb
-	nop.m 999
+{ .mfi
+      nop.m 999
 //
 //     Case 2_reduce:
 //     U_2 = N * P_2 - U_1
 //     Not needed until later.
 //
-(p9)   fadd.s1 U_2 = U_2, w
+      fadd.s1 U_2 = U_2, w2
 //
 //     Case 2_reduce:
 //     s = s - r
 //     U_2 = U_2 + w
 //
-(p10)  br.cond.spnt L(TANL_SMALL_R) ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p11)  br.cond.sptk L(TANL_NORMAL_R) ;;
+      nop.i 999
 }
-{ .mii
-	nop.m 999
+;;
+
 //
 //     Case 2_reduce:
 //     c = c - U_2
 //     c is complete here
 //     Argument reduction ends here.
 //
-(p9)   extr.u i_1 = N_fix_gr, 0, 1 ;;
-(p9)   cmp.eq.unc p11, p12 = 0x0000,i_1 ;;
-}
-{ .mfi
-	nop.m 999
-//
-//     Is i_1  even or odd?
-//     if i_1 == 0, set p11, else set p12.
-//
-(p11)  fmpy.s1 rsq = r, r
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-(p12)  frcpa.s1 S_hi,p0 = f1, r
-	nop.i 999
+      nop.m 999
+      fmpy.s1 rsq = r, r
+      tbit.z p11, p12 = N_fix_gr, 0 ;;    // Set p11 if N even, p12 if odd
 }
 
-
-
-//
-//     Case 1: Branch to SMALL_R or NORMAL_R.
-//     Case 1 is done now.
-//
-
 { .mfi
-(p9)   addl           table_ptr1   = @ltoff(TANL_BASE_CONSTANTS), gp
-(p9)   fsub.s1 c = s_val, U_1
-       nop.i 999 ;;
+      nop.m 999
+(p12) frcpa.s1 S_hi,p0 = f1, r
+      nop.i 999
 }
-;;
-
-{ .mmi
-(p9)  ld8 table_ptr1 = [table_ptr1]
+{ .mfi
       nop.m 999
+      fsub.s1 c = s_val, U_1
       nop.i 999
 }
 ;;
 
-
 { .mmi
-(p9)   add table_ptr1 = 224, table_ptr1 ;;
-(p9)   ldfe P1_1 = [table_ptr1],144
-	nop.i 999 ;;
+      add table_ptr1 = 160, table_base ;;  // Point to tanl_table_p1
+      ldfe P1_1 = [table_ptr1],144
+      nop.i 999 ;;
 }
 //
-//     Get [i_1] -  lsb of N_fix_gr .
 //     Load P1_1 and point to Q1_1 .
 //
 { .mfi
-(p9)   ldfe Q1_1 = [table_ptr1] , 0
+      ldfe Q1_1 = [table_ptr1]
 //
 //     N even: rsq = r * Z
 //     N odd:  S_hi = frcpa(r)
 //
-(p12)  fmerge.ns S_hi = S_hi, S_hi
-	nop.i 999
+(p12) fmerge.ns S_hi = S_hi, S_hi
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     Case 2_reduce:
 //     c = s - U_1
 //
-(p9)   fsub.s1 c = c, U_2
-	nop.i 999 ;;
+(p9)  fsub.s1 c = c, U_2
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p12)  fma.s1  poly1 = S_hi, r, f1
-	nop.i 999 ;;
+      nop.m 999
+(p12) fma.s1  poly1 = S_hi, r, f1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N odd:  Change sign of S_hi
 //
-(p11)  fmpy.s1 rsq = rsq, P1_1
-	nop.i 999 ;;
+(p11) fmpy.s1 rsq = rsq, P1_1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p12)  fma.s1 S_hi = S_hi, poly1, S_hi
-	nop.i 999 ;;
+      nop.m 999
+(p12) fma.s1 S_hi = S_hi, poly1, S_hi
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N even: rsq = rsq * P1_1
 //     N odd:  poly1 =  1.0 +  S_hi * r    16 bits partial  account for necessary
 //
-(p11)  fma.s1 Result = r, rsq, c
-	nop.i 999 ;;
+(p11) fma.s1 Poly = r, rsq, c
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
-//     N even: Result = c  + r * rsq
+//     N even: Poly = c  + r * rsq
 //     N odd:  S_hi  = S_hi + S_hi*poly1  16 bits account for necessary
 //
-(p12)  fma.s1 poly1 = S_hi, r, f1
-	nop.i 999 ;;
+(p12) fma.s1 poly1 = S_hi, r, f1
+(p11) tbit.z.unc p14, p15 = cot_flag, 0 ;; // p14=1 for tanl; p15=1 for cotl
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
-//     N even: Result = Result + r
+//     N even: Result = Poly + r
 //     N odd:  poly1  = 1.0 + S_hi * r        32 bits partial
 //
-(p11)  fadd.s0 Result = r, Result
-	nop.i 999 ;;
+(p14) fadd.s0 Result = r, Poly             // for tanl
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p15) fms.s0 Result = r, mOne, Poly        // for cotl
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p12)  fma.s1  S_hi = S_hi, poly1, S_hi
-	nop.i 999 ;;
+      nop.m 999
+(p12) fma.s1  S_hi = S_hi, poly1, S_hi
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N even: Result1 = Result + r
 //     N odd:   S_hi  = S_hi * poly1 + S_hi   32 bits
 //
-(p12)  fma.s1 poly1 = S_hi, r, f1
-	nop.i 999 ;;
+(p12) fma.s1 poly1 = S_hi, r, f1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N odd:  poly1  =  S_hi * r + 1.0       64 bits partial
 //
-(p12)  fma.s1 S_hi = S_hi, poly1, S_hi
-	nop.i 999 ;;
+(p12) fma.s1 S_hi = S_hi, poly1, S_hi
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N odd:  poly1  =  S_hi * poly + 1.0    64 bits
 //
-(p12)  fma.s1 poly1 = S_hi, r, f1
-	nop.i 999 ;;
+(p12) fma.s1 poly1 = S_hi, r, f1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N odd:  poly1  =  S_hi * r + 1.0
 //
-(p12)  fma.s1 poly1 = S_hi, c, poly1
-	nop.i 999 ;;
+(p12) fma.s1 poly1 = S_hi, c, poly1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N odd:  poly1  =  S_hi * c + poly1
 //
-(p12)  fmpy.s1 S_lo = S_hi, poly1
-	nop.i 999 ;;
+(p12) fmpy.s1 S_lo = S_hi, poly1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N odd:  S_lo  =  S_hi *  poly1
 //
-(p12)  fma.s1 S_lo = Q1_1, r, S_lo
-	nop.i 999
+(p12) fma.s1 S_lo = Q1_1, r, S_lo
+(p12) tbit.z.unc p14, p15 = cot_flag, 0 // p14=1 for tanl; p15=1 for cotl
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //     N odd:  Result =  S_hi + S_lo
 //
-(p0)   fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
-	nop.i 999 ;;
+      fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
+      nop.i 999 ;;
 }
-{ .mfb
-	nop.m 999
+{ .mfi
+      nop.m 999
 //
 //     N odd:  S_lo  =  S_lo + Q1_1 * r
 //
-(p12)  fadd.s0 Result = S_hi, S_lo
-(p0)   br.ret.sptk b0 ;;
+(p14) fadd.s0 Result = S_hi, S_lo          // for tanl
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+(p15) fms.s0 Result = S_hi, mOne, S_lo     // for cotl
+      br.ret.sptk b0 ;;          // Exit for pi/4 <= |x| < 2^24 and |s| < 2^-33
 }
 
 
-L(TANL_LARGER_ARG): 
-
+TANL_LARGER_ARG:
+// Here if 2^24 <= |x| < 2^63
 //
 // ARGUMENT REDUCTION CODE - CASE 3 and 4
 //
 
-{ .mfi
-(p0)  addl           table_ptr1   = @ltoff(TANL_BASE_CONSTANTS), gp
-(p0)  fmpy.s1 N_0 = Arg, Inv_P_0 
-	nop.i 999
+{ .mmf
+      mov GR_exp_2tom14 = 0xffff - 14          // Form signexp of 2^-14
+      mov GR_exp_m2tom14 = 0x2ffff - 14        // Form signexp of -2^-14
+      fmpy.s1 N_0 = Norm_Arg, Inv_P_0
 }
 ;;
 
 { .mmi
-(p0)  ld8 table_ptr1 = [table_ptr1]
-      nop.m 999
+      setf.exp TWO_TO_NEG14 = GR_exp_2tom14    // Form 2^-14
+      setf.exp NEGTWO_TO_NEG14 = GR_exp_m2tom14// Form -2^-14
       nop.i 999
 }
 ;;
@@ -1622,661 +1809,605 @@ L(TANL_LARGER_ARG):
 //    N_0 = Arg * Inv_P_0
 //
 { .mmi
-(p0)  add table_ptr1 = 8, table_ptr1 ;;
-//
-//    Point to  2*-14
-//
-(p0)  ldfs TWO_TO_NEG14 = [table_ptr1], 4
-	nop.i 999 ;;
+      add table_ptr2 = 144, table_base ;;     // Point to 2^-2
+      ldfps TWO_TO_NEG2, NEGTWO_TO_NEG2 = [table_ptr2]
+      nop.i 999
 }
-//
-//    Load 2**(-14).
-//
-{ .mmi
-(p0)  ldfs NEGTWO_TO_NEG14 = [table_ptr1], 180 ;;
+;;
+
 //
 //    N_0_fix  = integer part of N_0 .
-//    Adjust table_ptr1 to beginning of table.
 //
-(p0)  ldfs TWO_TO_NEG2 = [table_ptr1], 4
-	nop.i 999 ;;
-}
 //
 //    Make N_0 the integer part.
 //
 { .mfi
-(p0)  ldfs NEGTWO_TO_NEG2 = [table_ptr1]
-//
-//    Load -2**(-14).
-//
-(p0)  fcvt.fx.s1 N_0_fix = N_0
-	nop.i 999 ;;
+      nop.m 999
+      fcvt.fx.s1 N_0_fix = N_0
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p0)  fcvt.xf N_0 = N_0_fix
-	nop.i 999 ;;
+      setf.sig B_mask1 = bmask1               // Form mask to get 5 msb of r
+      fcvt.xf N_0 = N_0_fix
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p0)  fnma.s1 ArgPrime = N_0, P_0, Arg
-	nop.i 999
+      setf.sig B_mask2 = bmask2               // Form mask to form B from r
+      fnma.s1 ArgPrime = N_0, P_0, Norm_Arg
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 w = N_0, d_1
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 w = N_0, d_1
+      nop.i 999 ;;
 }
-{ .mfi
-	nop.m 999
 //
 //    ArgPrime = -N_0 * P_0 + Arg
 //    w  = N_0 * d_1
 //
-(p0)  fmpy.s1 N = ArgPrime, two_by_PI
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
 //
 //    N = ArgPrime * 2/pi
 //
-(p0)  fcvt.fx.s1 N_fix = N
-	nop.i 999 ;;
-}
+//      fcvt.fx.s1 N_fix = N
+// Use special scaling to right shift so N=Arg * 2/pi is in rightmost bits
+// Branch to Cases 3 or 4 if Arg <= -2**24 or Arg >= 2**24
 { .mfi
-	nop.m 999
-//
-//    N_fix is the integer part.
-//
-(p0)  fcvt.xf N = N_fix
-	nop.i 999 ;;
+      nop.m 999
+      fma.s1      N_fix = ArgPrime, FR_inv_pi_2to63, FR_rshf_2to64
+
+      nop.i 999 ;;
 }
+//     Convert integer N_fix back to normalized floating-point value.
 { .mfi
-(p0)  getf.sig N_fix_gr = N_fix
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+      fms.s1 N = N_fix, FR_2tom64, FR_rshf    // Use scaling to get N floated
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
 //    N is the integer part of the reduced-reduced argument.
 //    Put the integer in a GP register.
 //
-(p0)  fnma.s1 s_val = N, P_1, ArgPrime
-	nop.i 999
-}
 { .mfi
-	nop.m 999
-(p0)  fnma.s1 w = N, P_2, w
-	nop.i 999 ;;
+      getf.sig N_fix_gr = N_fix
+      nop.f 999
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
 //    s_val = -N*P_1 + ArgPrime
 //    w = -N*P_2 + w
 //
-(p0)  fcmp.lt.unc.s1 p11, p10 = s_val, TWO_TO_NEG14
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p11) fcmp.gt.s1 p11, p10 = s_val, NEGTWO_TO_NEG14
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-//
-//    Case 3: r = s_val + w (Z complete)
-//    Case 4: U_hi = N_0 * d_1
-//
-(p10) fmpy.s1 V_hi = N, P_2
-	nop.i 999
+      nop.m 999
+      fnma.s1 s_val = N, P_1, ArgPrime
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p11) fmpy.s1 U_hi = N_0, d_1
-	nop.i 999 ;;
+      nop.m 999
+      fnma.s1 w = N, P_2, w
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
-//
-//    Case 3: r = s_val + w (Z complete)
+;;
+
+//    Case 4: V_hi = N * P_2
 //    Case 4: U_hi = N_0 * d_1
-//
-(p11) fmpy.s1 V_hi = N, P_2
-	nop.i 999
-}
 { .mfi
-	nop.m 999
-(p11) fmpy.s1 U_hi = N_0, d_1
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 V_hi = N, P_2               // V_hi = N * P_2 for |s| < 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Decide between case 3 and 4:
-//    Case 3:  s <= -2**(-14) or s >= 2**(-14)
-//    Case 4: -2**(-14) < s < 2**(-14)
-//
-(p10) fadd.s1 r = s_val, w
-	nop.i 999
+      nop.m 999
+      fmpy.s1 U_hi = N_0, d_1             // U_hi = N_0 * d_1 for |s| < 2^-14
+      nop.i 999
 }
+;;
+
+//    Case 3: r = s_val + w (Z complete)
+//    Case 4: w = N * P_3
 { .mfi
-	nop.m 999
-(p11) fmpy.s1 w = N, P_3
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 r = s_val, w                // r = s_val + w for |s| >= 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Case 4: We need abs of both U_hi and V_hi - dont
-//    worry about switched sign of V_hi .
-//
-(p11) fsub.s1 A = U_hi, V_hi
-	nop.i 999
+      nop.m 999
+      fmpy.s1 w2 = N, P_3                 // w = N * P_3 for |s| < 2^-14
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
-//
+;;
+
 //    Case 4: A =  U_hi + V_hi
 //    Note: Worry about switched sign of V_hi, so subtract instead of add.
-//
-(p11) fnma.s1 V_lo = N, P_2, V_hi
-	nop.i 999 ;;
+//    Case 4: V_lo = -N * P_2 - V_hi (U_hi is in place of V_hi in writeup)
+//    Note: the (-) is still missing for V_hi.
+{ .mfi
+      nop.m 999
+      fsub.s1 A = U_hi, V_hi           // A = U_hi - V_hi for |s| < 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p11) fms.s1 U_lo = N_0, d_1, U_hi
-	nop.i 999 ;;
+      nop.m 999
+      fnma.s1 V_lo = N, P_2, V_hi      // V_lo = V_hi - N * P_2 for |s| < 2^-14
+      nop.i 999
 }
+;;
+
+//    Decide between case 3 and 4:
+//    Case 3:  |s| >= 2**(-14)     Set p10
+//    Case 4:  |s| <  2**(-14)     Set p11
+//
+//    Case 4: U_lo = N_0 * d_1 - U_hi
 { .mfi
-	nop.m 999
-(p11) fabs V_hiabs = V_hi
-	nop.i 999
+      nop.m 999
+      fms.s1 U_lo = N_0, d_1, U_hi     // U_lo = N_0*d_1 - U_hi for |s| < 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Case 4: V_hi = N * P_2
-//            w = N * P_3
-//    Note the product does not include the (-) as in the writeup
-//    so (-) missing for V_hi and w .
-(p10) fadd.s1 r = s_val, w
-	nop.i 999 ;;
+      nop.m 999
+      fcmp.lt.s1 p11, p10 = s_val, TWO_TO_NEG14
+      nop.i 999
 }
+;;
+
+//    Case 4: We need abs of both U_hi and V_hi - dont
+//    worry about switched sign of V_hi.
 { .mfi
-	nop.m 999
-//
-//    Case 3: c = s_val - r
-//    Case 4: U_lo = N_0 * d_1 - U_hi
-//
-(p11) fabs U_hiabs = U_hi
-	nop.i 999
+      nop.m 999
+      fabs V_hiabs = V_hi              // |V_hi| for |s| < 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p11) fmpy.s1 w = N, P_3
-	nop.i 999 ;;
+      nop.m 999
+(p11) fcmp.gt.s1 p11, p10 = s_val, NEGTWO_TO_NEG14
+      nop.i 999
 }
+;;
+
+//    Case 3: c = s_val - r
 { .mfi
-	nop.m 999
-//
-//    Case 4: Set P_12 if U_hiabs >= V_hiabs
-//
-(p11) fadd.s1 C_hi = s_val, A
-	nop.i 999 ;;
+      nop.m 999
+      fabs U_hiabs = U_hi              // |U_hi| for |s| < 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+      fsub.s1 c = s_val, r             // c = s_val - r    for |s| >= 2^-14
+      nop.i 999
+}
+;;
+
+// For Case 3, |s| >= 2^-14, determine if |r| < 1/4
 //
 //    Case 4: C_hi = s_val + A
 //
-(p11) fadd.s1 t = U_lo, V_lo
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-//
-//    Case 3: Is |r| < 2**(-2), if so set PR_7
-//    else set PR_8.
-//    Case 3: If PR_7 is set, prepare to branch to Small_R.
-//    Case 3: If PR_8 is set, prepare to branch to Normal_R.
-//
-(p10) fsub.s1 c = s_val, r
-	nop.i 999 ;;
+      nop.m 999
+(p11) fadd.s1 C_hi = s_val, A              // C_hi = s_val + A for |s| < 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Case 3: c = (s - r) + w (c complete)
-//
-(p11) fcmp.ge.unc.s1 p12, p13 = U_hiabs, V_hiabs
-	nop.i 999
+      nop.m 999
+(p10) fcmp.lt.unc.s1 p14, p15 = r, TWO_TO_NEG2
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11) fms.s1 w = N_0, d_2, w
-	nop.i 999 ;;
+      getf.sig sig_r = r               // Get signif of r if |s| >= 2^-33
+      fand B = B_mask1, r
+      nop.i 999
 }
+;;
+
+//    Case 4: t = U_lo + V_lo
 { .mfi
-	nop.m 999
-//
-//    Case 4: V_hi = N * P_2
-//            w = N * P_3
-//    Note the product does not include the (-) as in the writeup
-//    so (-) missing for V_hi and w .
-//
-(p10) fcmp.lt.unc.s1 p14, p15 = r, TWO_TO_NEG2
-	nop.i 999 ;;
+      getf.exp exp_r = r               // Extract signexp of r if |s| >= 2^-33
+(p11) fadd.s1 t = U_lo, V_lo               // t = U_lo + V_lo for |s| < 2^-14
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p14) fcmp.gt.s1 p14, p15 = r, NEGTWO_TO_NEG2
-	nop.i 999 ;;
+      nop.i 999
 }
-{ .mfb
-	nop.m 999
+;;
+
+//    Case 3: c = (s - r) + w (c complete)
+{ .mfi
+      nop.m 999
+(p10) fadd.s1 c = c, w              // c = c + w for |s| >= 2^-14
+      nop.i 999
+}
+{ .mbb
+      nop.m 999
+(p14) br.cond.spnt TANL_SMALL_R     // Branch if 2^24 <= |x| < 2^63 and |r|< 1/4
+(p15) br.cond.sptk TANL_NORMAL_R_A  // Branch if 2^24 <= |x| < 2^63 and |r|>=1/4
+}
+;;
+
+
+// Here if 2^24 <= |x| < 2^63 and |s| < 2^-14  >>>>>>>  Case 4.
 //
-//    Case 4: V_lo = -N * P_2 - V_hi (U_hi is in place of V_hi in writeup)
-//    Note: the (-) is still missing for V_hi .
+//    Case 4: Set P_12 if U_hiabs >= V_hiabs
 //    Case 4: w = w + N_0 * d_2
 //    Note: the (-) is now incorporated in w .
-//
-(p10) fadd.s1 c = c, w
-//
-//    Case 4: t = U_lo + V_lo
-//    Note: remember V_lo should be (-), subtract instead of add. NO
-//
-(p14) br.cond.spnt L(TANL_SMALL_R) ;;
-}
-{ .mib
-	nop.m 999
-	nop.i 999
-(p15) br.cond.spnt L(TANL_NORMAL_R) ;;
-}
 { .mfi
-	nop.m 999
-//
-//    Case 3: Vector off when |r| < 2**(-2).  Recall that PR_3 will be true.
-//    The remaining stuff is for Case 4.
-//
-(p12) fsub.s1 a = U_hi, A
-(p11) extr.u i_1 = N_fix_gr, 0, 1 ;;
+      add table_ptr1 = 160, table_base           // Point to tanl_table_p1
+      fcmp.ge.unc.s1 p12, p13 = U_hiabs, V_hiabs
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-//
-//    Case 4: C_lo = s_val - C_hi
-//
-(p11) fadd.s1 t = t, w
-	nop.i 999
+      nop.m 999
+      fms.s1 w2 = N_0, d_2, w2
+      nop.i 999
 }
+;;
+
+//    Case 4: C_lo = s_val - C_hi
 { .mfi
-	nop.m 999
-(p13) fadd.s1 a = V_hi, A
-	nop.i 999 ;;
+      ldfe P1_1 = [table_ptr1], 16               // Load P1_1
+      fsub.s1 C_lo = s_val, C_hi
+      nop.i 999
 }
-
-
+;;
 
 //
 //    Case 4: a = U_hi - A
 //            a = V_hi - A (do an add to account for missing (-) on V_hi
 //
-
 { .mfi
-(p11)  addl           table_ptr1   = @ltoff(TANL_BASE_CONSTANTS), gp
-(p11) fsub.s1 C_lo = s_val, C_hi
-	nop.i 999
+      ldfe P1_2 = [table_ptr1], 128              // Load P1_2
+(p12) fsub.s1 a = U_hi, A
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
+(p13) fadd.s1 a = V_hi, A
+      nop.i 999
 }
 ;;
 
+//    Case 4: t = U_lo + V_lo  + w
+{ .mfi
+      ldfe Q1_1 = [table_ptr1], 16               // Load Q1_1
+      fadd.s1 t = t, w2
+      nop.i 999
+}
+;;
 
-
-//
 //    Case 4: a = (U_hi - A)  + V_hi
 //            a = (V_hi - A)  + U_hi
 //    In each case account for negative missing form V_hi .
 //
-
-
-{ .mmi
-(p11)  ld8 table_ptr1 = [table_ptr1]
+{ .mfi
+      ldfe Q1_2 = [table_ptr1], 16               // Load Q1_2
+(p12) fsub.s1 a = a, V_hi
+      nop.i 999
+}
+{ .mfi
       nop.m 999
+(p13) fsub.s1 a = U_hi, a
       nop.i 999
 }
 ;;
 
-
 //
 //    Case 4: C_lo = (s_val - C_hi) + A
 //
-{ .mmi
-(p11) add table_ptr1 = 224, table_ptr1 ;;
-(p11) ldfe P1_1 = [table_ptr1], 16
-	nop.i 999 ;;
-}
-{ .mfi
-(p11) ldfe P1_2 = [table_ptr1], 128
-//
-//    Case 4: w = U_lo + V_lo  + w
-//
-(p12) fsub.s1 a = a, V_hi
-	nop.i 999 ;;
-}
-//
-//    Case 4: r = C_hi + C_lo
-//
 { .mfi
-(p11) ldfe Q1_1 = [table_ptr1], 16
-(p11) fadd.s1 C_lo = C_lo, A
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 C_lo = C_lo, A
+      nop.i 999 ;;
 }
 //
-//    Case 4: c = C_hi - r
-//    Get [i_1] - lsb of N_fix_gr.
+//    Case 4: t = t + a
 //
 { .mfi
-(p11) ldfe Q1_2 = [table_ptr1], 16
-	nop.f 999
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 t = t, a
+      nop.i 999
 }
+;;
+
+//    Case 4: C_lo = C_lo + t
+//    Case 4: r = C_hi + C_lo
 { .mfi
-	nop.m 999
-(p13) fsub.s1 a = U_hi, a
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 C_lo = C_lo, t
+      nop.i 999
 }
+;;
+
 { .mfi
-	nop.m 999
-(p11) fadd.s1 t = t, a
-	nop.i 999 ;;
+      nop.m 999
+      fadd.s1 r = C_hi, C_lo
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
-//    Case 4: t = t + a
+//    Case 4: c = C_hi - r
 //
-(p11) fadd.s1 C_lo = C_lo, t
-	nop.i 999 ;;
-}
 { .mfi
-	nop.m 999
-//
-//    Case 4: C_lo = C_lo + t
-//
-(p11) fadd.s1 r = C_hi, C_lo
-	nop.i 999 ;;
+      nop.m 999
+      fsub.s1 c = C_hi, r
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p11) fsub.s1 c = C_hi, r
-	nop.i 999
+      nop.m 999
+      fmpy.s1 rsq = r, r
+      add N_fix_gr = N_fix_gr, cot_flag // N = N + 1 (for cotl)
 }
-{ .mfi
-	nop.m 999
-//
+;;
+
 //    Case 4: c = c + C_lo  finished.
-//    Is i_1  even or odd?
-//    if i_1 == 0, set PR_4, else set PR_5.
 //
-// r and c have been computed.
-// We known whether this is the sine or cosine routine.
-// Make sure ftz mode is set - should be automatic when using wre
-(p0)  fmpy.s1 rsq = r, r
-	nop.i 999 ;;
-}
+//    Is i_1 = lsb of N_fix_gr even or odd?
+//    if i_1 == 0, set PR_11, else set PR_12.
+//
 { .mfi
-	nop.m 999
-(p11) fadd.s1 c = c , C_lo
-(p11) cmp.eq.unc p11, p12 =  0x0000, i_1 ;;
+      nop.m 999
+      fadd.s1 c = c , C_lo
+      tbit.z p11, p12 =  N_fix_gr, 0
 }
+;;
+
+// r and c have been computed.
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) frcpa.s1 S_hi, p0 = f1, r
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd: Change sign of S_hi
 //
-(p11) fma.s1 Result = rsq, P1_2, P1_1
-	nop.i 999 ;;
+(p11) fma.s1 Poly = rsq, P1_2, P1_1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 P = rsq, Q1_2, Q1_1
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  Result  =  S_hi + S_lo      (User supplied rounding mode for C1)
 //
-(p0)   fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
-	nop.i 999 ;;
+       fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: rsq = r * r
 //    N odd:  S_hi = frcpa(r)
 //
 (p12) fmerge.ns S_hi = S_hi, S_hi
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: rsq = rsq * P1_2 + P1_1
 //    N odd:  poly1 =  1.0 +  S_hi * r    16 bits partial  account for necessary
 //
-(p11) fmpy.s1 Result = rsq, Result
-	nop.i 999 ;;
+(p11) fmpy.s1 Poly = rsq, Poly
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly1 = S_hi, r,f1
-	nop.i 999
+(p11) tbit.z.unc p14, p15 = cot_flag, 0 // p14=1 for tanl; p15=1 for cotl
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
-//    N even: Result =  Result * rsq
+//    N even: Poly =  Poly * rsq
 //    N odd:  S_hi  = S_hi + S_hi*poly1  16 bits account for necessary
 //
-(p11) fma.s1 Result = r, Result, c
-	nop.i 999 ;;
+(p11) fma.s1 Poly = r, Poly, c
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 S_hi = S_hi, poly1, S_hi
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:   S_hi  = S_hi * poly1 + S_hi   32 bits
 //
-(p11) fadd.s0 Result= r, Result
-	nop.i 999 ;;
+(p14) fadd.s0 Result = r, Poly          // for tanl
+      nop.i 999 ;;
+}
+
+.pred.rel "mutex",p15,p12
+{ .mfi
+      nop.m 999
+(p15) fms.s0 Result = r, mOne, Poly     // for cotl
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly1 =  S_hi, r, f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
-//    N even: Result = Result * r + c
+//    N even: Poly = Poly * r + c
 //    N odd:  poly1  = 1.0 + S_hi * r        32 bits partial
 //
 (p12) fma.s1 S_hi = S_hi, poly1, S_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly1 = S_hi, r, f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
-//    N even: Result1 = Result + r  (Rounding mode S0)
+//    N even: Result = Poly + r  (Rounding mode S0)
 //    N odd:  poly1  =  S_hi * r + 1.0       64 bits partial
 //
 (p12) fma.s1 S_hi = S_hi, poly1, S_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  poly1  =  S_hi * poly + S_hi    64 bits
 //
 (p12) fma.s1 poly1 = S_hi, r, f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  poly1  =  S_hi * r + 1.0
 //
 (p12) fma.s1 poly1 = S_hi, c, poly1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  poly1  =  S_hi * c + poly1
 //
 (p12) fmpy.s1 S_lo = S_hi, poly1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  S_lo  =  S_hi *  poly1
 //
 (p12) fma.s1 S_lo = P, r, S_lo
-	nop.i 999 ;;
+(p12) tbit.z.unc p14, p15 = cot_flag, 0 ;; // p14=1 for tanl; p15=1 for cotl
+}
+
+{ .mfi
+      nop.m 999
+(p14) fadd.s0 Result = S_hi, S_lo           // for tanl
+      nop.i 999
 }
 { .mfb
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  S_lo  =  S_lo + r * P
 //
-(p12) fadd.s0 Result = S_hi, S_lo
-(p0)   br.ret.sptk b0 ;;
+(p15) fms.s0 Result = S_hi, mOne, S_lo      // for cotl
+      br.ret.sptk b0 ;;      // Exit for 2^24 <= |x| < 2^63 and |s| < 2^-14
 }
 
 
-L(TANL_SMALL_R): 
-{ .mii
-	nop.m 999
-(p0)  extr.u i_1 = N_fix_gr, 0, 1 ;;
-(p0)  cmp.eq.unc p11, p12 = 0x0000, i_1
-}
+TANL_SMALL_R:
+// Here if |r| < 1/4
+// r and c have been computed.
+// *****************************************************************
+// *****************************************************************
+// *****************************************************************
+//    N odd:  S_hi = frcpa(r)
+//    Get [i_1] - lsb of N_fix_gr.  Set p11 if N even, p12 if N odd.
+//    N even: rsq = r * r
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 rsq = r, r
-	nop.i 999 ;;
+      add table_ptr1 = 160, table_base    // Point to tanl_table_p1
+      frcpa.s1 S_hi, p0 = f1, r           // S_hi for N odd
+      add N_fix_gr = N_fix_gr, cot_flag   // N = N + 1 (for cotl)
 }
 { .mfi
-(p0)  addl           table_ptr1   = @ltoff(TANL_BASE_CONSTANTS), gp
-(p12) frcpa.s1 S_hi, p0 = f1, r
-	nop.i 999
+      add table_ptr2 = 400, table_base    // Point to Q1_7
+      fmpy.s1 rsq = r, r
+      nop.i 999
 }
 ;;
 
-
 { .mmi
-(p0)  ld8 table_ptr1 = [table_ptr1]
-      nop.m 999
-      nop.i 999
+      ldfe P1_1 = [table_ptr1], 16
+;;
+      ldfe P1_2 = [table_ptr1], 16
+      tbit.z p11, p12 = N_fix_gr, 0
 }
 ;;
 
-// *****************************************************************
-// *****************************************************************
-// *****************************************************************
-
 
-{ .mmi
-(p0)  add table_ptr1 = 224, table_ptr1 ;;
-(p0)  ldfe P1_1 = [table_ptr1], 16
-	nop.i 999 ;;
-}
-//    r and c have been computed.
-//    We known whether this is the sine or cosine routine.
-//    Make sure ftz mode is set - should be automatic when using wre
-//    |r| < 2**(-2)
 { .mfi
-(p0)  ldfe P1_2 = [table_ptr1], 16
-(p11) fmpy.s1 r_to_the_8 = rsq, rsq
-	nop.i 999 ;;
+      ldfe P1_3 = [table_ptr1], 96
+      nop.f 999
+      nop.i 999
 }
-//
-//    Set table_ptr1 to beginning of constant table.
-//    Get [i_1] - lsb of N_fix_gr.
-//
+;;
+
 { .mfi
-(p0)  ldfe P1_3 = [table_ptr1], 96
-//
-//    N even: rsq = r * r
-//    N odd:  S_hi = frcpa(r)
-//
+(p11) ldfe P1_9 = [table_ptr1], -16
 (p12) fmerge.ns S_hi = S_hi, S_hi
-	nop.i 999 ;;
+      nop.i 999
 }
-//
-//    Is i_1  even or odd?
-//    if i_1 == 0, set PR_11.
-//    if i_1 != 0, set PR_12.
-//
 { .mfi
-(p11) ldfe P1_9 = [table_ptr1], -16
+      nop.m 999
+(p11) fmpy.s1 r_to_the_8 = rsq, rsq
+      nop.i 999
+}
+;;
+
 //
 //    N even: Poly2 = P1_7 + Poly2 * rsq
 //    N odd:  poly2 = Q1_5 + poly2 * rsq
 //
+{ .mfi
+(p11) ldfe P1_8 = [table_ptr1], -16
 (p11) fadd.s1 CORR = rsq, f1
-	nop.i 999 ;;
+      nop.i 999
 }
-{ .mmi
-(p11) ldfe P1_8 = [table_ptr1], -16 ;;
+;;
+
 //
 //    N even: Poly1 = P1_2 + P1_3 * rsq
-//    N odd:  poly1 =  1.0 +  S_hi * r     
+//    N odd:  poly1 =  1.0 +  S_hi * r
 //    16 bits partial  account for necessary (-1)
 //
+{ .mmi
 (p11) ldfe P1_7 = [table_ptr1], -16
-	nop.i 999 ;;
+;;
+(p11) ldfe P1_6 = [table_ptr1], -16
+      nop.i 999
 }
+;;
+
 //
 //    N even: Poly1 = P1_1 + Poly1 * rsq
 //    N odd:  S_hi  =  S_hi + S_hi * poly1)     16 bits account for necessary
 //
-{ .mfi
-(p11) ldfe P1_6 = [table_ptr1], -16
 //
 //    N even: Poly2 = P1_5 + Poly2 * rsq
 //    N odd:  poly2 = Q1_3 + poly2 * rsq
 //
+{ .mfi
+(p11) ldfe P1_5 = [table_ptr1], -16
 (p11) fmpy.s1 r_to_the_8 = r_to_the_8, r_to_the_8
-	nop.i 999 ;;
+      nop.i 999
 }
+{ .mfi
+      nop.m 999
+(p12) fma.s1 poly1 =  S_hi, r, f1
+      nop.i 999
+}
+;;
+
 //
 //    N even: Poly1 =  Poly1 * rsq
 //    N odd:  poly1  = 1.0 + S_hi * r         32 bits partial
 //
-{ .mfi
-(p11) ldfe P1_5 = [table_ptr1], -16
-(p12) fma.s1 poly1 =  S_hi, r, f1
-	nop.i 999 ;;
-}
 
 //
 //    N even: CORR =  CORR * c
@@ -2290,44 +2421,30 @@ L(TANL_SMALL_R):
 
 { .mmf
 (p11) ldfe P1_4 = [table_ptr1], -16
-(p0)  addl           table_ptr2   = @ltoff(TANL_BASE_CONSTANTS), gp
-(p11) fmpy.s1 CORR =  CORR, c
-}
-;;
-
-
-{ .mmi
-(p0)  ld8 table_ptr2 = [table_ptr2]
       nop.m 999
-      nop.i 999
+(p11) fmpy.s1 CORR =  CORR, c
 }
 ;;
 
-
-{ .mii
-(p0)  add table_ptr2 = 464, table_ptr2
-	nop.i 999 ;;
-	nop.i 999
-}
 { .mfi
-	nop.m 999
+      nop.m 999
 (p11) fma.s1 Poly1 = P1_3, rsq, P1_2
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-(p0)  ldfe Q1_7 = [table_ptr2], -16
+(p12) ldfe Q1_7 = [table_ptr2], -16
 (p12) fma.s1 S_hi = S_hi, poly1, S_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-(p0)  ldfe Q1_6 = [table_ptr2], -16
+(p12) ldfe Q1_6 = [table_ptr2], -16
 (p11) fma.s1 Poly2 = P1_9, rsq, P1_8
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mmi
-(p0)  ldfe Q1_5 = [table_ptr2], -16 ;;
+(p12) ldfe Q1_5 = [table_ptr2], -16 ;;
 (p12) ldfe Q1_4 = [table_ptr2], -16
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
 (p12) ldfe Q1_3 = [table_ptr2], -16
@@ -2336,735 +2453,796 @@ L(TANL_SMALL_R):
 //    N odd:  poly2 = Q1_6 + Q1_7 * rsq
 //
 (p11) fma.s1 Poly1 = Poly1, rsq, P1_1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
 (p12) ldfe Q1_2 = [table_ptr2], -16
 (p12) fma.s1 poly1 = S_hi, r, f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
 (p12) ldfe Q1_1 = [table_ptr2], -16
 (p11) fma.s1 Poly2 = Poly2, rsq, P1_7
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: CORR =  rsq + 1
 //    N even: r_to_the_8 =  rsq * rsq
 //
 (p11) fmpy.s1 Poly1 = Poly1, rsq
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 S_hi = S_hi, poly1, S_hi
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly2 = Q1_7, rsq, Q1_6
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p11) fma.s1 Poly2 = Poly2, rsq, P1_6
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly1 = S_hi, r, f1
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly2 = poly2, rsq, Q1_5
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p11) fma.s1 Poly2= Poly2, rsq, P1_5
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 S_hi =  S_hi, poly1, S_hi
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly2 = poly2, rsq, Q1_4
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: r_to_the_8 = r_to_the_8 * r_to_the_8
 //    N odd:  poly1  =  S_hi * r + 1.0       64 bits partial
 //
 (p11) fma.s1 Poly2 = Poly2, rsq, P1_4
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
-//    N even: Result = CORR + Poly * r
+//    N even: Poly = CORR + Poly * r
 //    N odd:  P = Q1_1 + poly2 * rsq
 //
 (p12) fma.s1 poly1 = S_hi, r, f1
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly2 = poly2, rsq, Q1_3
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: Poly2 = P1_4 + Poly2 * rsq
 //    N odd:  poly2 = Q1_2 + poly2 * rsq
 //
 (p11) fma.s1 Poly = Poly2, r_to_the_8, Poly1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly1 = S_hi, c, poly1
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 poly2 = poly2, rsq, Q1_2
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: Poly = Poly1 + Poly2 * r_to_the_8
 //    N odd:  S_hi =  S_hi * poly1 + S_hi    64 bits
 //
-(p11) fma.s1 Result = Poly, r, CORR
-	nop.i 999 ;;
+(p11) fma.s1 Poly = Poly, r, CORR
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
-//    N even: Result =  r + Result  (User supplied rounding mode)
+//    N even: Result =  r + Poly  (User supplied rounding mode)
 //    N odd:  poly1  =  S_hi * c + poly1
 //
 (p12) fmpy.s1 S_lo = S_hi, poly1
-	nop.i 999
+(p11) tbit.z.unc p14, p15 = cot_flag, 0 // p14=1 for tanl; p15=1 for cotl
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fma.s1 P = poly2, rsq, Q1_1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  poly1  =  S_hi * r + 1.0
 //
 //
 //    N odd:  S_lo  =  S_hi *  poly1
 //
-(p11) fadd.s0 Result = Result, r
-	nop.i 999 ;;
+(p14) fadd.s0 Result = Poly, r          // for tanl
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+(p15) fms.s0 Result = Poly, mOne, r     // for cotl
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
 //
 //    N odd:  S_lo  =  Q1_1 * c + S_lo
 //
 (p12) fma.s1 S_lo = Q1_1, c, S_lo
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)   fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd:  Result =  S_lo + r * P
 //
 (p12) fma.s1 Result = P, r, S_lo
-	nop.i 999 ;;
+(p12) tbit.z.unc p14, p15 = cot_flag, 0 ;; // p14=1 for tanl; p15=1 for cotl
 }
-{ .mfb
-	nop.m 999
+
 //
 //    N odd:  Result = Result + S_hi  (user supplied rounding mode)
 //
-(p12) fadd.s0 Result = Result, S_hi
-(p0)   br.ret.sptk b0 ;;
+{ .mfi
+      nop.m 999
+(p14) fadd.s0 Result = Result, S_hi         // for tanl
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+(p15) fms.s0 Result = Result, mOne, S_hi    // for cotl
+      br.ret.sptk b0 ;;              // Exit |r| < 1/4 path
 }
 
 
-L(TANL_NORMAL_R): 
-{ .mfi
-(p0)  getf.sig sig_r = r
+TANL_NORMAL_R:
+// Here if 1/4 <= |x| < pi/4  or  if |x| >= 2^63 and |r| >= 1/4
 // *******************************************************************
 // *******************************************************************
 // *******************************************************************
 //
 //    r and c have been computed.
-//    Make sure ftz mode is set - should be automatic when using wre
 //
-//
-//    Get [i_1] -  lsb of N_fix_gr alone.
-//
-(p0)  fmerge.s  Pos_r = f1, r
-(p0)  extr.u i_1 = N_fix_gr, 0, 1 ;;
-}
 { .mfi
-	nop.m 999
-(p0)  fmerge.s  sgn_r =  r, f1
-(p0)  cmp.eq.unc p11, p12 = 0x0000, i_1 ;;
-}
-{ .mfi
-	nop.m 999
-	nop.f 999
-(p0)  extr.u lookup = sig_r, 58, 5
-}
-{ .mlx
-	nop.m 999
-(p0)  movl Create_B = 0x8200000000000000 ;;
-}
-{ .mfi
-(p0)  addl           table_ptr1   = @ltoff(TANL_BASE_CONSTANTS), gp
-	nop.f 999
-(p0)  dep Create_B = lookup, Create_B, 58, 5
-}
-;;
-
-
-//
-//    Get [i_1] -  lsb of N_fix_gr alone.
-//    Pos_r = abs (r)
-//
-
-
-{ .mmi
-(p0)  ld8 table_ptr1 = [table_ptr1]
       nop.m 999
+      fand B = B_mask1, r
       nop.i 999
 }
 ;;
 
-
+TANL_NORMAL_R_A:
+// Enter here if pi/4 <= |x| < 2^63 and |r| >= 1/4
+//    Get the 5 bits or r for the lookup.   1.xxxxx ....
 { .mmi
-	nop.m 999
-(p0)  setf.sig B = Create_B
-//
-//    Set table_ptr1 and table_ptr2 to base address of
-//    constant table.
-//
-(p0)  add table_ptr1 = 480, table_ptr1 ;;
-}
-{ .mmb
-	nop.m 999
-//
-//    Is i_1 or i_0  == 0 ?
-//    Create the constant  1 00000 1000000000000000000000...
-//
-(p0)  ldfe P2_1 = [table_ptr1], 16
-	nop.b 999
+      add table_ptr1 = 416, table_base     // Point to tanl_table_p2
+      mov GR_exp_2tom65 = 0xffff - 65      // Scaling constant for B
+      extr.u lookup = sig_r, 58, 5
 }
+;;
+
 { .mmi
-	nop.m 999 ;;
-(p0)  getf.exp exp_r = Pos_r
-	nop.i 999
+      ldfe P2_1 = [table_ptr1], 16
+      setf.exp TWO_TO_NEG65 = GR_exp_2tom65  // 2^-65 for scaling B if exp_r=-2
+      add N_fix_gr = N_fix_gr, cot_flag      // N = N + 1 (for cotl)
 }
-//
-//    Get r's exponent
-//    Get r's significand
-//
-{ .mmi
-(p0)  ldfe P2_2 = [table_ptr1], 16 ;;
-//
-//    Get the 5 bits or r for the lookup.   1.xxxxx ....
-//    from sig_r.
-//    Grab  lsb of exp of B
-//
-(p0)  ldfe P2_3 = [table_ptr1], 16
-	nop.i 999 ;;
+;;
+
+.pred.rel "mutex",p11,p12
+//    B =  2^63 * 1.xxxxx 100...0
+{ .mfi
+      ldfe P2_2 = [table_ptr1], 16
+      for B = B_mask2, B
+      mov table_offset = 512               // Assume table offset is 512
 }
-{ .mii
-	nop.m 999
-(p0)  andcm table_offset = 0x0001, exp_r ;;
-(p0)  shl table_offset = table_offset, 9 ;;
+;;
+
+{ .mfi
+      ldfe P2_3 = [table_ptr1], 16
+      fmerge.s  Pos_r = f1, r
+      tbit.nz p8,p9 = exp_r, 0
 }
-{ .mii
-	nop.m 999
-//
-//    Deposit   0 00000 1000000000000000000000... on
-//              1 xxxxx yyyyyyyyyyyyyyyyyyyyyy...,
-//    getting rid of the ys.
+;;
+
 //    Is  B = 2** -2 or  B= 2** -1? If 2**-1, then
 //    we want an offset of 512 for table addressing.
-//
-(p0)  shladd table_offset = lookup, 4, table_offset ;;
-//
-//    B =  ........ 1xxxxx 1000000000000000000...
-//
-(p0)  add table_ptr1 = table_ptr1, table_offset ;;
-}
-{ .mmb
-	nop.m 999
-//
-//   B =  ........ 1xxxxx 1000000000000000000...
-//   Convert B so it has the same exponent as Pos_r
-//
-(p0)  ldfd T_hi = [table_ptr1], 8
-	nop.b 999 ;;
+{ .mii
+      add table_ptr2 = 1296, table_base     // Point to tanl_table_cm2
+(p9)  shladd table_offset = lookup, 4, table_offset
+(p8)  shladd table_offset = lookup, 4, r0
 }
+;;
 
+{ .mmi
+      add table_ptr1 = table_ptr1, table_offset  // Point to T_hi
+      add table_ptr2 = table_ptr2, table_offset  // Point to C_hi
+      add table_ptr3 = 2128, table_base     // Point to tanl_table_scim2
+}
+;;
 
+{ .mmi
+      ldfd T_hi = [table_ptr1], 8                // Load T_hi
+;;
+      ldfd C_hi = [table_ptr2], 8                // Load C_hi
+      add table_ptr3 = table_ptr3, table_offset  // Point to SC_inv
+}
+;;
 
 //
 //    x = |r| - B
-//    Load T_hi.
-//    Load C_hi.
 //
-
-{ .mmf
-(p0)  addl           table_ptr2   = @ltoff(TANL_BASE_CONSTANTS), gp
-(p0)  ldfs T_lo = [table_ptr1]
-(p0)  fmerge.se B = Pos_r, B
+//   Convert B so it has the same exponent as Pos_r before subtracting
+{ .mfi
+      ldfs T_lo = [table_ptr1]                   // Load T_lo
+(p9)  fnma.s1 x = B, FR_2tom64, Pos_r
+      nop.i 999
 }
-;;
-
-
-{ .mmi
-(p0)  ld8 table_ptr2 = [table_ptr2]
+{ .mfi
       nop.m 999
+(p8)  fnma.s1 x = B, TWO_TO_NEG65, Pos_r
       nop.i 999
 }
 ;;
 
-
-{ .mii
-(p0)  add table_ptr2 = 1360, table_ptr2
-	nop.i 999 ;;
-(p0)  add table_ptr2 = table_ptr2, table_offset ;;
+{ .mfi
+      ldfs C_lo = [table_ptr2]                   // Load C_lo
+      nop.f 999
+      nop.i 999
 }
+;;
+
 { .mfi
-(p0)  ldfd C_hi = [table_ptr2], 8
-(p0)  fsub.s1 x = Pos_r, B
-	nop.i 999 ;;
+      ldfe SC_inv = [table_ptr3]                 // Load SC_inv
+      fmerge.s  sgn_r = r, f1
+      tbit.z p11, p12 = N_fix_gr, 0              // p11 if N even, p12 if odd
+
 }
-{ .mii
-(p0)  ldfs C_lo = [table_ptr2],255
-	nop.i 999 ;;
+;;
+
 //
 //    xsq = x * x
 //    N even: Tx = T_hi * x
-//    Load T_lo.
-//    Load C_lo - increment pointer to get SC_inv 
-//    - cant get all the way, do an add later.
-//
-(p0)  add table_ptr2 = 569, table_ptr2 ;;
-}
 //
 //    N even: Tx1 = Tx + 1
 //    N odd:  Cx1 = 1 - Cx
 //
+
 { .mfi
-(p0)  ldfe SC_inv = [table_ptr2], 0
-	nop.f 999
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p0)  fmpy.s1 xsq = x, x
-	nop.i 999
+      nop.m 999
+      fmpy.s1 xsq = x, x
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p11) fmpy.s1 Tx = T_hi, x
-	nop.i 999 ;;
-}
-{ .mfi
-	nop.m 999
-(p12) fmpy.s1 Cx = C_hi, x
-	nop.i 999 ;;
+      nop.i 999
 }
-{ .mfi
-	nop.m 999
+;;
+
 //
 //    N odd: Cx = C_hi * x
 //
-(p0)  fma.s1 P = P2_3, xsq, P2_2
-	nop.i 999
-}
 { .mfi
-	nop.m 999
+      nop.m 999
+(p12) fmpy.s1 Cx = C_hi, x
+      nop.i 999
+}
+;;
 //
 //    N even and odd: P = P2_3 + P2_2 * xsq
 //
+{ .mfi
+      nop.m 999
+      fma.s1 P = P2_3, xsq, P2_2
+      nop.i 999
+}
+{ .mfi
+      nop.m 999
 (p11) fadd.s1 Tx1 = Tx, f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: D = C_hi - tanx
 //    N odd: D = T_hi + tanx
 //
 (p11) fmpy.s1 CORR = SC_inv, T_hi
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 Sx = SC_inv, x
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 Sx = SC_inv, x
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fmpy.s1 CORR = SC_inv, C_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fsub.s1 V_hi = f1, Cx
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p0)  fma.s1 P = P, xsq, P2_1
-	nop.i 999
+      nop.m 999
+      fma.s1 P = P, xsq, P2_1
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: P = P2_1 + P * xsq
 //
 (p11) fma.s1 V_hi = Tx, Tx1, f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: Result  = sgn_r * tail + T_hi (user rounding mode for C1)
 //    N odd:  Result  = sgn_r * tail + C_hi (user rounding mode for C1)
 //
-(p0)   fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
-	nop.i 999 ;;
+      fmpy.s0 fp_tmp = fp_tmp, fp_tmp  // Dummy mult to set inexact
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 CORR = CORR, c
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 CORR = CORR, c
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fnma.s1 V_hi = Cx,V_hi,f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: V_hi = Tx * Tx1 + 1
 //    N odd: Cx1 = 1 - Cx * Cx1
 //
-(p0)  fmpy.s1 P = P, xsq
-	nop.i 999
+      fmpy.s1 P = P, xsq
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: P = P * xsq
 //
 (p11) fmpy.s1 V_hi = V_hi, T_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: tail = P * tail + V_lo
 //
 (p11) fmpy.s1 T_hi = sgn_r, T_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
-(p0)  fmpy.s1 CORR = CORR, sgn_r
-	nop.i 999 ;;
+      nop.m 999
+      fmpy.s1 CORR = CORR, sgn_r
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fmpy.s1 V_hi = V_hi,C_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: V_hi = T_hi * V_hi
 //    N odd: V_hi  = C_hi * V_hi
 //
-(p0)  fma.s1 tanx = P, x, x
-	nop.i 999
+      fma.s1 tanx = P, x, x
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fnmpy.s1 C_hi = sgn_r, C_hi
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: V_lo = 1 - V_hi + C_hi
 //    N odd: V_lo = 1 - V_hi + T_hi
 //
 (p11) fadd.s1 CORR = CORR, T_lo
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fsub.s1 CORR = CORR, C_lo
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: tanx = x + x * P
 //    N even and odd: Sx = SC_inv * x
 //
 (p11) fsub.s1 D = C_hi, tanx
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fadd.s1 D = T_hi, tanx
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N odd: CORR = SC_inv * C_hi
 //    N even: CORR = SC_inv * T_hi
 //
-(p0)  fnma.s1 D = V_hi, D, f1
-	nop.i 999 ;;
+      fnma.s1 D = V_hi, D, f1
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: D = 1 - V_hi * D
 //    N even and odd: CORR = CORR * c
 //
-(p0)  fma.s1 V_hi = V_hi, D, V_hi
-	nop.i 999 ;;
+      fma.s1 V_hi = V_hi, D, V_hi
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: V_hi = V_hi + V_hi * D
 //    N even and odd: CORR = sgn_r * CORR
 //
 (p11) fnma.s1 V_lo = V_hi, C_hi, f1
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fnma.s1 V_lo = V_hi, T_hi, f1
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: CORR = COOR + T_lo
 //    N odd: CORR = CORR - C_lo
 //
 (p11) fma.s1 V_lo = tanx, V_hi, V_lo
-	nop.i 999
+      tbit.nz p15, p0 = cot_flag, 0       // p15=1 if we compute cotl
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fnma.s1 V_lo = tanx, V_hi, V_lo
-	nop.i 999 ;;
+      nop.i 999 ;;
+}
+
+{ .mfi
+      nop.m 999
+(p15) fms.s1 T_hi = f0, f0, T_hi        // to correct result's sign for cotl
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
+(p15) fms.s1 C_hi = f0, f0, C_hi        // to correct result's sign for cotl
+      nop.i 999
+};;
+
+{ .mfi
+      nop.m 999
+(p15) fms.s1 sgn_r = f0, f0, sgn_r      // to correct result's sign for cotl
+      nop.i 999
+};;
+
+{ .mfi
+      nop.m 999
 //
 //    N even: V_lo = V_lo + V_hi * tanx
 //    N odd: V_lo = V_lo - V_hi * tanx
 //
 (p11) fnma.s1 V_lo = C_lo, V_hi, V_lo
-	nop.i 999
+      nop.i 999
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 (p12) fnma.s1 V_lo = T_lo, V_hi, V_lo
-	nop.i 999 ;;
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N  even: V_lo = V_lo - V_hi * C_lo
 //    N  odd: V_lo = V_lo - V_hi * T_lo
 //
-(p0)  fmpy.s1 V_lo = V_hi, V_lo
-	nop.i 999 ;;
+      fmpy.s1 V_lo = V_hi, V_lo
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: V_lo = V_lo * V_hi
 //
-(p0)  fadd.s1 tail = V_hi, V_lo
-	nop.i 999 ;;
+      fadd.s1 tail = V_hi, V_lo
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: tail = V_hi + V_lo
 //
-(p0)  fma.s1 tail = tail, P, V_lo
-	nop.i 999 ;;
+      fma.s1 tail = tail, P, V_lo
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even: T_hi = sgn_r * T_hi
 //    N odd : C_hi = -sgn_r * C_hi
 //
-(p0)  fma.s1 tail = tail, Sx, CORR
-	nop.i 999 ;;
+      fma.s1 tail = tail, Sx, CORR
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even and odd: tail = Sx * tail + CORR
 //
-(p0)  fma.s1 tail = V_hi, Sx, tail
-	nop.i 999 ;;
+      fma.s1 tail = V_hi, Sx, tail
+      nop.i 999 ;;
 }
 { .mfi
-	nop.m 999
+      nop.m 999
 //
 //    N even an odd: tail = Sx * V_hi + tail
 //
 (p11) fma.s0 Result = sgn_r, tail, T_hi
-	nop.i 999
+      nop.i 999
 }
 { .mfb
-	nop.m 999
+      nop.m 999
 (p12) fma.s0 Result = sgn_r, tail, C_hi
-(p0)   br.ret.sptk b0 ;;
+      br.ret.sptk b0 ;;                 // Exit for 1/4 <= |r| < pi/4
 }
 
-L(TANL_SPECIAL):
+TANL_DENORMAL:
+// Here if x denormal
 { .mfb
-        nop.m 999
-(p0)   fmpy.s0 Arg = Arg, f0
-(p0)   br.ret.sptk b0 ;;
+      getf.exp GR_signexp_x = Norm_Arg          // Get sign and exponent of x
+      nop.f 999
+      br.cond.sptk TANL_COMMON                  // Return to common code
 }
+;;
+
+
+TANL_SPECIAL:
+TANL_UNSUPPORTED:
 //
 //     Code for NaNs, Unsupporteds, Infs, or +/- zero ?
 //     Invalid raised for Infs and SNaNs.
 //
 
-.endp  tanl
-ASM_SIZE_DIRECTIVE(tanl)
+{ .mfi
+      nop.m 999
+      fmerge.s  f10 = f8, f8            // Save input for error call
+      tbit.nz p6, p7 = cot_flag, 0      // p6=1 if we compute cotl
+}
+;;
 
-// *******************************************************************
-// *******************************************************************
-// *******************************************************************
-//
-//     Special Code to handle very large argument case.
-//     Call int pi_by_2_reduce(&x,&r,&c)
-//     for |arguments| >= 2**63
-//     (Arg or x) is in f8
-//     Address to save r and c as double
-// *******************************************************************
-// *******************************************************************
-// *******************************************************************
+{ .mfi
+      nop.m 999
+(p6)  fclass.m p6, p7 = f8, 0x7         // Test for zero (cotl only)
+      nop.i 999
+}
+;;
+
+.pred.rel "mutex", p6, p7
+{ .mfi
+(p6)  mov GR_Parameter_Tag = 225        // (cotl)
+(p6)  frcpa.s0  f8, p0 = f1, f8         // cotl(+-0) = +-Inf
+      nop.i 999
+}
+{ .mfb
+      nop.m 999
+(p7)  fmpy.s0 f8 = f8, f0
+(p7)  br.ret.sptk b0
+}
+;;
 
-.proc __libm_callout
-__libm_callout:
-L(TANL_ARG_TOO_LARGE): 
+GLOBAL_IEEE754_END(tanl)
+
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
 .prologue
+
+// (1)
 { .mfi
-        add   r50=-32,sp                        // Parameter: r address
-        nop.f 0
+      add           GR_Parameter_Y=-32,sp        // Parameter 2 value
+      nop.f         0
 .save   ar.pfs,GR_SAVE_PFS
-        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+      mov           GR_SAVE_PFS=ar.pfs           // Save ar.pfs
 }
 { .mfi
 .fframe 64
-        add sp=-64,sp                           // Create new stack
-        nop.f 0
-        mov GR_SAVE_GP=gp                       // Save gp
+      add sp=-64,sp                              // Create new stack
+      nop.f 0
+      mov GR_SAVE_GP=gp                          // Save gp
 };;
+
+// (2)
 { .mmi
-        stfe [r50] = f0,16                      // Clear Parameter r on stack
-        add  r49 = 16,sp                        // Parameter x address
+      stfe [GR_Parameter_Y] = f1,16              // STORE Parameter 2 on stack
+      add GR_Parameter_X = 16,sp                 // Parameter 1 address
 .save   b0, GR_SAVE_B0
-        mov GR_SAVE_B0=b0                       // Save b0
+      mov GR_SAVE_B0=b0                          // Save b0
 };;
+
 .body
+// (3)
 { .mib
-        stfe [r50] = f0,-16                     // Clear Parameter c on stack
-        nop.i 0
-        nop.b 0
+      stfe [GR_Parameter_X] = f10                // STORE Parameter 1 on stack
+      add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address
+      nop.b 0
 }
 { .mib
-        stfe [r49] = Arg                        // Store Parameter x on stack
-        nop.i 0
-(p0)    br.call.sptk b0=__libm_pi_by_2_reduce# ;;
+      stfe [GR_Parameter_Y] = f8                 // STORE Parameter 3 on stack
+      add   GR_Parameter_Y = -16,GR_Parameter_Y
+      br.call.sptk b0=__libm_error_support#      // Call error handling function
+};;
+{ .mmi
+      nop.m 0
+      nop.m 0
+      add   GR_Parameter_RESULT = 48,sp
+};;
+
+// (4)
+{ .mmi
+      ldfe  f8 = [GR_Parameter_RESULT]           // Get return result off stack
+.restore sp
+      add   sp = 64,sp                           // Restore stack pointer
+      mov   b0 = GR_SAVE_B0                      // Restore return address
 };;
+{ .mib
+      mov   gp = GR_SAVE_GP                      // Restore gp
+      mov   ar.pfs = GR_SAVE_PFS                 // Restore ar.pfs
+      br.ret.sptk     b0                         // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
+
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
 //
-//     Load 2^-2
+//     Special Code to handle very large argument case.
+//     Call int __libm_pi_by_2_reduce(x,r,c) for |arguments| >= 2**63
+//     The interface is custom:
+//       On input:
+//         (Arg or x) is in f8
+//       On output:
+//         r is in f8
+//         c is in f9
+//         N is in r8
+//     We know also that __libm_pi_by_2_reduce preserves f10-15, f71-127.  We
+//     use this to eliminate save/restore of key fp registers in this calling
+//     function.
 //
+// *******************************************************************
+// *******************************************************************
+// *******************************************************************
+
+LOCAL_LIBM_ENTRY(__libm_callout)
+TANL_ARG_TOO_LARGE:
+.prologue
+{ .mfi
+      add table_ptr2 = 144, table_base        // Point to 2^-2
+      nop.f 999
+.save   ar.pfs,GR_SAVE_PFS
+      mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+;;
+
+//     Load 2^-2, -2^-2
 { .mmi
-(p0)   ldfe  Arg =[r49],16   
+      ldfps  TWO_TO_NEG2, NEGTWO_TO_NEG2 = [table_ptr2]
+      setf.sig B_mask1 = bmask1               // Form mask to get 5 msb of r
+.save   b0, GR_SAVE_B0
+      mov GR_SAVE_B0=b0                       // Save b0
+};;
+
+.body
 //
-//     Call argument reduction
+//     Call argument reduction with x in f8
+//     Returns with N in r8, r in f8, c in f9
+//     Assumes f71-127 are preserved across the call
 //
-(p0)   ldfs  TWO_TO_NEG2 = [table_ptr2],4
-//     Get Arg off stack
-//     Get r off stack - hi order part
-//     Get c off stack - lo order part
-(p0)   mov   N_fix_gr = r8 ;;
-}
-{ .mmb
-(p0)   ldfe  r =[r50],16  
-(p0)   ldfs  NEGTWO_TO_NEG2 = [table_ptr2],4
-	nop.b 999 ;;
+{ .mib
+      setf.sig B_mask2 = bmask2               // Form mask to form B from r
+      mov GR_SAVE_GP=gp                       // Save gp
+      br.call.sptk b0=__libm_pi_by_2_reduce#
 }
+;;
+
+//
+//     Is |r| < 2**(-2)
+//
 { .mfi
-(p0)   ldfe  c =[r50],-32  
-	nop.f 999
-	nop.i 999 ;;
+      getf.sig sig_r = r                     // Extract significand of r
+      fcmp.lt.s1  p6, p0 = r, TWO_TO_NEG2
+      mov   gp = GR_SAVE_GP                  // Restore gp
 }
+;;
+
 { .mfi
-.restore sp
-       add   sp = 64,sp                       // Restore stack pointer
+      getf.exp exp_r = r                     // Extract signexp of r
+      nop.f 999
+      mov    b0 = GR_SAVE_B0                 // Restore return address
+}
+;;
+
 //
-//     Is |r| < 2**(-2)
+//     Get N_fix_gr
 //
-(p0)   fcmp.lt.unc.s1  p6, p0 = r, TWO_TO_NEG2 
-mov    b0 = GR_SAVE_B0                        // Restore return address
-};;
 { .mfi
-       mov   gp = GR_SAVE_GP                  // Restore gp
-(p6)   fcmp.gt.unc.s1  p6, p0 = r, NEGTWO_TO_NEG2 
-       mov   ar.pfs = GR_SAVE_PFS             // Restore gp
-};;
+      mov   N_fix_gr = r8
+(p6)  fcmp.gt.unc.s1  p6, p0 = r, NEGTWO_TO_NEG2
+      mov   ar.pfs = GR_SAVE_PFS             // Restore pfs
+}
+;;
+
 { .mbb
-	nop.m 999
-(p6)   br.cond.spnt L(TANL_SMALL_R)
-(p0)   br.cond.sptk L(TANL_NORMAL_R) ;;
+      nop.m 999
+(p6)  br.cond.spnt TANL_SMALL_R              // Branch if |r| < 1/4
+      br.cond.sptk TANL_NORMAL_R             // Branch if 1/4 <= |r| < pi/4
 }
+;;
 
-.endp __libm_callout
-ASM_SIZE_DIRECTIVE(__libm_callout)
+LOCAL_LIBM_END(__libm_callout)
 
 .type __libm_pi_by_2_reduce#,@function
 .global __libm_pi_by_2_reduce#
diff --git a/sysdeps/ia64/fpu/s_trunc.S b/sysdeps/ia64/fpu/s_trunc.S
index 0be91200e3..b9ad03b5a8 100644
--- a/sysdeps/ia64/fpu/s_trunc.S
+++ b/sysdeps/ia64/fpu/s_trunc.S
@@ -1,11 +1,10 @@
 .file "trunc.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 7/7/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,33 +20,28 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-.align 32
-.global trunc#
-
-.section .text
-.proc  trunc#
-.align 32
-
 // History
 //==============================================================
-// 7/7/00: Created 
+// 07/07/00 Created
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance and reduced code size
 //==============================================================
 
 // API
@@ -55,25 +49,28 @@
 // double trunc(double x)
 //==============================================================
 
-#include "libm_support.h"
+// general input registers:
+// r14 - r18
 
-// general input registers:  
-TRUNC_GR_FFFF      = r14
-TRUNC_GR_signexp   = r15
-TRUNC_GR_exponent  = r16
-TRUNC_GR_expmask   = r17
-TRUNC_GR_bigexp    = r18
+rExpBias   = r14
+rSignexp   = r15
+rExp       = r16
+rExpMask   = r17
+rBigexp    = r18
 
 // floating-point registers:
-// f8, f9, f11, f12
+// f8 - f10
+
+fXtruncInt = f9
+fNormX     = f10
 
-// predicate registers used: 
-// p6, p7, p8, p9, p10, p11
+// predicate registers used:
+// p6, p7
 
 // Overview of operation
 //==============================================================
 // double trunc(double x)
-// Return an integer value (represented as a double) less than or 
+// Return an integer value (represented as a double) less than or
 // equal to x in magnitude.
 // This is x rounded toward zero to an integral value.
 //==============================================================
@@ -97,105 +94,73 @@ TRUNC_GR_bigexp    = r18
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-trunc:
+.section .text
+GLOBAL_LIBM_ENTRY(trunc)
 
 { .mfi
-      getf.exp         TRUNC_GR_signexp  = f8
-      fcvt.fx.trunc.s1 f9  = f8
-      addl             TRUNC_GR_bigexp = 0x10033, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fcvt.fx.trunc.s1 fXtruncInt  = f8      // Convert to int in significand
+      addl             rBigexp = 0x10033, r0 // Set exponent at which is integer
 }
 { .mfi
-      mov              TRUNC_GR_FFFF    = 0x0FFFF
-      fnorm.d          f11  = f8
-      mov              TRUNC_GR_expmask    = 0x1FFFF 
-};;
-//    get the exponent of x
-//    convert x to integer in signficand of f9 
-//    Normalize x - this will raise invalid on SNaNs, the
-//    denormal operand flag - and possibly a spurious U flag
-//    get exponent only mask (will exclude sign bit)
+      mov              rExpBias    = 0x0FFFF // Form exponent bias
+      fnorm.s1         fNormX  = f8          // Normalize input
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
+}
+;;
 
 { .mfi
       nop.m            0
-      fclass.m         p7,p8 = f8, 0x0b  
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
       nop.i            0
 }
-{ .mfi
-      nop.m            0
-      fcmp.eq.unc.s1   p9,p0 = f8,f0
-      nop.i      0       
-};;
-//    fclass to set p7 if unnorm 
-{ .mmi
-      and              TRUNC_GR_exponent = TRUNC_GR_signexp, TRUNC_GR_expmask ;;
-(p8)  cmp.ge.unc       p10,p11 = TRUNC_GR_exponent, TRUNC_GR_bigexp
-(p8)  cmp.ne.unc       p6,p0 = TRUNC_GR_exponent, TRUNC_GR_signexp
-};;
-//    Get the exponent of x
-//    Test if exponent such that result already an integer
-//    Test if x < 0
-{ .mmi
-(p9)  cmp.eq.andcm     p10,p11 = r0, r0 
-(p6)  cmp.lt.unc       p6,p0 = TRUNC_GR_exponent, TRUNC_GR_FFFF
-      nop.i 0 
-};;
-//    If -1 < x < 0, set p6, turn off p10 and p11, and set result to -0.0
-{ .mfb
-(p6)  cmp.eq.andcm     p10,p11 = r0, r0 
-(p6)  fmerge.s         f8 = f8, f0
-      nop.b 0
-};;
-//    If not a unnorm, set p10 if x already is a big int, nan, or inf?
-//    If not a unnorm, set p10 if x already is a big int, nan, or inf?
-.pred.rel "mutex",p10,p11    
+;;
+
 { .mfb
       nop.m            0
-(p11) fcvt.xf          f8   = f9 
-      nop.b            0 
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+(p7)  br.cond.spnt     TRUNC_UNORM           // Branch if x unorm
 }
+;;
+
+TRUNC_COMMON:
+// Return here from TRUNC_UNORM
 { .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.d.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
+}
+;;
+
+{ .mfi
+      cmp.lt           p6,p0 = rExp, rExpBias // Is |x| < 1?
+      fcvt.xf          f8 = fXtruncInt        // Result, assume 1 <= |x| < 2^52
+      cmp.ge           p7,p0 = rExp, rBigexp  // Is |x| >= 2^52?
+}
+;;
+
+// We must correct result if |x| < 1, or |x| >= 2^52
+.pred.rel "mutex",p6,p7
+{ .mfi
       nop.m            0
-(p10) fma.d.s1         f8   = f11,f1,f0 
-(p8)  br.ret.sptk      b0 
-};;
-//    If not a unnorm and not an big int, nan,or +/-inf convert signficand
-//    back to f8.
-//    If not a unorm  and a big int, nan, or +/-inf, return fnorm'd x 
-//    If not a unorm, Return
-//    If unnorm, get the exponent again - perhaps it wasn't a denorm. 
-{ .mfb
-(p7)  getf.exp         TRUNC_GR_signexp  = f11
-(p7)  fcvt.fx.trunc.s1 f12   = f11 
-      nop.b 0
-};;
-{ .mfb
-      and              TRUNC_GR_exponent = TRUNC_GR_signexp, TRUNC_GR_expmask
-      fcmp.lt.unc.s1   p9,p0 = f8,f0
-      nop.b            0
-};;
-{ .mfb
-      cmp.ge.unc       p10,p11 = TRUNC_GR_exponent, TRUNC_GR_bigexp
-      nop.f            0
-      nop.b            0
-};;
-// If a unnorm, check to see if value is already a big int. 
+(p6)  fmerge.s         f8 = fNormX, f0        // If |x| < 1, result sgn(x)*0
+      nop.i            0
+}
 { .mfb
-      nop.m 0
-(p11) fcvt.xf          f8   = f12 
-      nop.b 0
+      nop.m            0
+(p7)  fma.d.s0         f8 = fNormX, f1, f0    // If |x| >= 2^52, result x
+      br.ret.sptk      b0                     // Exit main path
 }
-{ .mfi
-      nop.m 0
-(p10) fma.d.s1         f8   = f11,f1,f0 
-      nop.i 0
-};;
+;;
+
+
+TRUNC_UNORM:
+// Here if x unorm
 { .mfb
-      nop.m 0
-(p9)  fmerge.ns        f8   = f1,f8 
-      br.ret.sptk      b0 
-};;
-// If so return it. Otherwise, return (fcvt.xf(fcvt.fx.trunc(x)))
-// Make sure the result is negative if it should be - that is
-// negative(denormal) -> -0.
-.endp trunc
-ASM_SIZE_DIRECTIVE(trunc)
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     TRUNC_COMMON           // Return to main path
+}
+;;
+
+GLOBAL_LIBM_END(trunc)
diff --git a/sysdeps/ia64/fpu/s_truncf.S b/sysdeps/ia64/fpu/s_truncf.S
index 0ac4181209..ff40bc7101 100644
--- a/sysdeps/ia64/fpu/s_truncf.S
+++ b/sysdeps/ia64/fpu/s_truncf.S
@@ -1,11 +1,10 @@
 .file "truncf.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 7/7/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,33 +20,28 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-.align 32
-.global truncf#
-
-.section .text
-.proc  truncf#
-.align 32
-
 // History
 //==============================================================
-// 7/7/00: Created 
+// 07/07/00 Created
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance and reduced code size
 //==============================================================
 
 // API
@@ -55,25 +49,28 @@
 // float truncf(float x)
 //==============================================================
 
-#include "libm_support.h"
+// general input registers:
+// r14 - r18
 
-// general input registers:  
-TRUNC_GR_FFFF      = r14
-TRUNC_GR_signexp   = r15
-TRUNC_GR_exponent  = r16
-TRUNC_GR_expmask   = r17
-TRUNC_GR_bigexp    = r18
+rExpBias   = r14
+rSignexp   = r15
+rExp       = r16
+rExpMask   = r17
+rBigexp    = r18
 
 // floating-point registers:
-// f8, f9, f11, f12
+// f8 - f10
+
+fXtruncInt = f9
+fNormX     = f10
 
-// predicate registers used: 
-// p6, p7, p8, p9, p10, p11
+// predicate registers used:
+// p6, p7
 
 // Overview of operation
 //==============================================================
 // float truncf(float x)
-// Return an integer value (represented as a float) less than or 
+// Return an integer value (represented as a float) less than or
 // equal to x in magnitude.
 // This is x rounded toward zero to an integral value.
 //==============================================================
@@ -97,105 +94,73 @@ TRUNC_GR_bigexp    = r18
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-truncf:
+.section .text
+GLOBAL_LIBM_ENTRY(truncf)
 
 { .mfi
-      getf.exp         TRUNC_GR_signexp  = f8
-      fcvt.fx.trunc.s1 f9  = f8
-      addl             TRUNC_GR_bigexp = 0x10016, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fcvt.fx.trunc.s1 fXtruncInt  = f8      // Convert to int in significand
+      addl             rBigexp = 0x10016, r0 // Set exponent at which is integer
 }
 { .mfi
-      mov              TRUNC_GR_FFFF    = 0x0FFFF
-      fnorm.s          f11  = f8
-      mov              TRUNC_GR_expmask    = 0x1FFFF 
-};;
-//    get the exponent of x
-//    convert x to integer in signficand of f9 
-//    Normalize x - this will raise invalid on SNaNs, the
-//    denormal operand flag - and possibly a spurious U flag
-//    get exponent only mask (will exclude sign bit)
+      mov              rExpBias    = 0x0FFFF // Form exponent bias
+      fnorm.s1         fNormX  = f8          // Normalize input
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
+}
+;;
 
 { .mfi
       nop.m            0
-      fclass.m         p7,p8 = f8, 0x0b  
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
       nop.i            0
 }
-{ .mfi
-      nop.m            0
-      fcmp.eq.unc.s1   p9,p0 = f8,f0
-      nop.i      0       
-};;
-//    fclass to set p7 if unnorm 
-{ .mmi
-      and              TRUNC_GR_exponent = TRUNC_GR_signexp, TRUNC_GR_expmask ;;
-(p8)  cmp.ge.unc       p10,p11 = TRUNC_GR_exponent, TRUNC_GR_bigexp
-(p8)  cmp.ne.unc       p6,p0 = TRUNC_GR_exponent, TRUNC_GR_signexp
-};;
-//    Get the exponent of x
-//    Test if exponent such that result already an integer
-//    Test if x < 0
-{ .mmi
-(p9)  cmp.eq.andcm     p10,p11 = r0, r0 
-(p6)  cmp.lt.unc       p6,p0 = TRUNC_GR_exponent, TRUNC_GR_FFFF
-      nop.i 0 
-};;
-//    If -1 < x < 0, set p6, turn off p10 and p11, and set result to -0.0
-{ .mfb
-(p6)  cmp.eq.andcm     p10,p11 = r0, r0 
-(p6)  fmerge.s         f8 = f8, f0
-      nop.b 0
-};;
-//    If not a unnorm, set p10 if x already is a big int, nan, or inf?
-//    If not a unnorm, set p10 if x already is a big int, nan, or inf?
-.pred.rel "mutex",p10,p11    
+;;
+
 { .mfb
       nop.m            0
-(p11) fcvt.xf          f8   = f9 
-      nop.b            0 
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+(p7)  br.cond.spnt     TRUNC_UNORM           // Branch if x unorm
 }
+;;
+
+TRUNC_COMMON:
+// Return here from TRUNC_UNORM
 { .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.s.s0         f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
+}
+;;
+
+{ .mfi
+      cmp.lt           p6,p0 = rExp, rExpBias // Is |x| < 1?
+      fcvt.xf          f8 = fXtruncInt        // Result, assume 1 <= |x| < 2^23
+      cmp.ge           p7,p0 = rExp, rBigexp  // Is |x| >= 2^23?
+}
+;;
+
+// We must correct result if |x| < 1, or |x| >= 2^23
+.pred.rel "mutex",p6,p7
+{ .mfi
       nop.m            0
-(p10) fma.s.s1         f8   = f11,f1,f0 
-(p8)  br.ret.sptk      b0 
-};;
-//    If not a unnorm and not an big int, nan,or +/-inf convert signficand
-//    back to f8.
-//    If not a unorm  and a big int, nan, or +/-inf, return fnorm'd x 
-//    If not a unorm, Return
-//    If unnorm, get the exponent again - perhaps it wasn't a denorm. 
-{ .mfb
-(p7)  getf.exp         TRUNC_GR_signexp  = f11
-(p7)  fcvt.fx.trunc.s1 f12   = f11 
-      nop.b 0
-};;
-{ .mfb
-      and              TRUNC_GR_exponent = TRUNC_GR_signexp, TRUNC_GR_expmask
-      fcmp.lt.unc.s1   p9,p0 = f8,f0
-      nop.b            0
-};;
-{ .mfb
-      cmp.ge.unc       p10,p11 = TRUNC_GR_exponent, TRUNC_GR_bigexp
-      nop.f            0
-      nop.b            0
-};;
-// If a unnorm, check to see if value is already a big int. 
+(p6)  fmerge.s         f8 = fNormX, f0        // If |x| < 1, result sgn(x)*0
+      nop.i            0
+}
 { .mfb
-      nop.m 0
-(p11) fcvt.xf          f8   = f12 
-      nop.b 0
+      nop.m            0
+(p7)  fma.s.s0         f8 = fNormX, f1, f0    // If |x| >= 2^23, result x
+      br.ret.sptk      b0                     // Exit main path
 }
-{ .mfi
-      nop.m 0
-(p10) fma.s.s1         f8   = f11,f1,f0 
-      nop.i 0
-};;
+;;
+
+
+TRUNC_UNORM:
+// Here if x unorm
 { .mfb
-      nop.m 0
-(p9)  fmerge.ns        f8   = f1,f8 
-      br.ret.sptk      b0 
-};;
-// If so return it. Otherwise, return (fcvt.xf(fcvt.fx.trunc(x)))
-// Make sure the result is negative if it should be - that is
-// negative(denormal) -> -0.
-.endp truncf
-ASM_SIZE_DIRECTIVE(truncf)
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     TRUNC_COMMON           // Return to main path
+}
+;;
+
+GLOBAL_LIBM_END(truncf)
diff --git a/sysdeps/ia64/fpu/s_truncl.S b/sysdeps/ia64/fpu/s_truncl.S
index 91bf96ce90..1afa19ba2b 100644
--- a/sysdeps/ia64/fpu/s_truncl.S
+++ b/sysdeps/ia64/fpu/s_truncl.S
@@ -1,11 +1,10 @@
 .file "truncl.s"
 
-// Copyright (C) 2000, 2001, Intel Corporation
+
+// Copyright (c) 2000 - 2003, Intel Corporation
 // All rights reserved.
-// 
-// Contributed 7/7/2000 by John Harrison, Cristina Iordache, Ted Kubaska,
-// Bob Norin, Shane Story, and Ping Tak Peter Tang of the
-// Computational Software Lab, Intel Corporation.
+//
+// Contributed 2000 by the Intel Numerics Group, Intel Corporation
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
@@ -21,59 +20,57 @@
 // * The name of Intel Corporation may not be used to endorse or promote
 // products derived from this software without specific prior written
 // permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-// 
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
 // Intel Corporation is the author of this code, and requests that all
-// problem reports or change requests be submitted to it directly at 
-// http://developer.intel.com/opensource.
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
 //
-.align 32
-.global truncl#
-
-.section .text
-.proc  truncl#
-.align 32
-
 // History
 //==============================================================
-// 7/7/00: Created 
+// 07/07/00 Created
+// 05/20/02 Cleaned up namespace and sf0 syntax
+// 01/20/03 Improved performance and reduced code size
 //==============================================================
 
 // API
 //==============================================================
-// long double truncl(float x)
+// long double truncl(long double x)
 //==============================================================
 
-#include "libm_support.h"
+// general input registers:
+// r14 - r18
 
-// general input registers:  
-TRUNC_GR_FFFF      = r14
-TRUNC_GR_signexp   = r15
-TRUNC_GR_exponent  = r16
-TRUNC_GR_expmask   = r17
-TRUNC_GR_bigexp    = r18
+rExpBias   = r14
+rSignexp   = r15
+rExp       = r16
+rExpMask   = r17
+rBigexp    = r18
 
 // floating-point registers:
-// f8, f9, f11, f12
+// f8 - f10
 
-// predicate registers used: 
-// p6, p7, p8, p9, p10, p11
+fXtruncInt = f9
+fNormX     = f10
+
+// predicate registers used:
+// p6, p7
 
 // Overview of operation
 //==============================================================
 // long double truncl(long double x)
-// Return an integer value (represented as a long double) less than or 
+// Return an integer value (represented as a long double) less than or
 // equal to x in magnitude.
 // This is x rounded toward zero to an integral value.
 //==============================================================
@@ -97,105 +94,73 @@ TRUNC_GR_bigexp    = r18
 // If we multiply by 2^23, we no longer have a fractional part
 // So input is an integer value already.
 
-truncl:
+.section .text
+GLOBAL_LIBM_ENTRY(truncl)
 
 { .mfi
-      getf.exp         TRUNC_GR_signexp  = f8
-      fcvt.fx.trunc.s1 f9  = f8
-      addl             TRUNC_GR_bigexp = 0x1003e, r0
+      getf.exp         rSignexp  = f8        // Get signexp, recompute if unorm
+      fcvt.fx.trunc.s1 fXtruncInt  = f8      // Convert to int in significand
+      addl             rBigexp = 0x1003e, r0 // Set exponent at which is integer
 }
 { .mfi
-      mov              TRUNC_GR_FFFF    = 0x0FFFF
-      fnorm            f11  = f8
-      mov              TRUNC_GR_expmask    = 0x1FFFF 
-};;
-//    get the exponent of x
-//    convert x to integer in signficand of f9 
-//    Normalize x - this will raise invalid on SNaNs, the
-//    denormal operand flag - and possibly a spurious U flag
-//    get exponent only mask (will exclude sign bit)
+      mov              rExpBias    = 0x0FFFF // Form exponent bias
+      fnorm.s1         fNormX  = f8          // Normalize input
+      mov              rExpMask    = 0x1FFFF // Form exponent mask
+}
+;;
 
 { .mfi
       nop.m            0
-      fclass.m         p7,p8 = f8, 0x0b  
+      fclass.m         p7,p0 = f8, 0x0b      // Test x unorm
       nop.i            0
 }
-{ .mfi
-      nop.m            0
-      fcmp.eq.unc.s1   p9,p0 = f8,f0
-      nop.i      0       
-};;
-//    fclass to set p7 if unnorm 
-{ .mmi
-      and              TRUNC_GR_exponent = TRUNC_GR_signexp, TRUNC_GR_expmask ;;
-(p8)  cmp.ge.unc       p10,p11 = TRUNC_GR_exponent, TRUNC_GR_bigexp
-(p8)  cmp.ne.unc       p6,p0 = TRUNC_GR_exponent, TRUNC_GR_signexp
-};;
-//    Get the exponent of x
-//    Test if exponent such that result already an integer
-//    Test if x < 0
-{ .mmi
-(p9)  cmp.eq.andcm     p10,p11 = r0, r0 
-(p6)  cmp.lt.unc       p6,p0 = TRUNC_GR_exponent, TRUNC_GR_FFFF
-      nop.i 0 
-};;
-//    If -1 < x < 0, set p6, turn off p10 and p11, and set result to -0.0
-{ .mfb
-(p6)  cmp.eq.andcm     p10,p11 = r0, r0 
-(p6)  fmerge.s         f8 = f8, f0
-      nop.b 0
-};;
-//    If not a unnorm, set p10 if x already is a big int, nan, or inf?
-//    If not a unnorm, set p10 if x already is a big int, nan, or inf?
-.pred.rel "mutex",p10,p11    
+;;
+
 { .mfb
       nop.m            0
-(p11) fcvt.xf          f8   = f9 
-      nop.b            0 
+      fclass.m         p6,p0 = f8, 0x1e3     // Test x natval, nan, inf
+(p7)  br.cond.spnt     TRUNC_UNORM           // Branch if x unorm
 }
+;;
+
+TRUNC_COMMON:
+// Return here from TRUNC_UNORM
 { .mfb
+      and              rExp = rSignexp, rExpMask // Get biased exponent
+(p6)  fma.s0           f8 = f8, f1, f0       // Result if x natval, nan, inf
+(p6)  br.ret.spnt      b0                    // Exit if x natval, nan, inf
+}
+;;
+
+{ .mfi
+      cmp.lt           p6,p0 = rExp, rExpBias // Is |x| < 1?
+      fcvt.xf          f8 = fXtruncInt        // Result, assume 1 <= |x| < 2^63
+      cmp.ge           p7,p0 = rExp, rBigexp  // Is |x| >= 2^63?
+}
+;;
+
+// We must correct result if |x| < 1, or |x| >= 2^63
+.pred.rel "mutex",p6,p7
+{ .mfi
       nop.m            0
-(p10) fma.s1           f8   = f11,f1,f0 
-(p8)  br.ret.sptk      b0 
-};;
-//    If not a unnorm and not an big int, nan,or +/-inf convert signficand
-//    back to f8.
-//    If not a unorm  and a big int, nan, or +/-inf, return fnorm'd x 
-//    If not a unorm, Return
-//    If unnorm, get the exponent again - perhaps it wasn't a denorm. 
-{ .mfb
-(p7)  getf.exp         TRUNC_GR_signexp  = f11
-(p7)  fcvt.fx.trunc.s1 f12   = f11 
-      nop.b 0
-};;
-{ .mfb
-      and              TRUNC_GR_exponent = TRUNC_GR_signexp, TRUNC_GR_expmask
-      fcmp.lt.unc.s1   p9,p0 = f8,f0
-      nop.b            0
-};;
-{ .mfb
-      cmp.ge.unc       p10,p11 = TRUNC_GR_exponent, TRUNC_GR_bigexp
-      nop.f            0
-      nop.b            0
-};;
-// If a unnorm, check to see if value is already a big int. 
+(p6)  fmerge.s         f8 = fNormX, f0        // If |x| < 1, result sgn(x)*0
+      nop.i            0
+}
 { .mfb
-      nop.m 0
-(p11) fcvt.xf          f8   = f12 
-      nop.b 0
+      nop.m            0
+(p7)  fma.s0           f8 = fNormX, f1, f0    // If |x| >= 2^63, result x
+      br.ret.sptk      b0                     // Exit main path
 }
-{ .mfi
-      nop.m 0
-(p10) fma.s1           f8   = f11,f1,f0 
-      nop.i 0
-};;
+;;
+
+
+TRUNC_UNORM:
+// Here if x unorm
 { .mfb
-      nop.m 0
-(p9)  fmerge.ns        f8   = f1,f8 
-      br.ret.sptk      b0 
-};;
-// If so return it. Otherwise, return (fcvt.xf(fcvt.fx.trunc(x)))
-// Make sure the result is negative if it should be - that is
-// negative(denormal) -> -0.
-.endp truncl
-ASM_SIZE_DIRECTIVE(truncl)
+      getf.exp         rSignexp  = fNormX     // Get signexp, recompute if unorm
+      fcmp.eq.s0       p7,p0 = f8, f0         // Dummy op to set denormal flag
+      br.cond.sptk     TRUNC_COMMON           // Return to main path
+}
+;;
+
+GLOBAL_LIBM_END(truncl)
diff --git a/sysdeps/ia64/fpu/t_exp.c b/sysdeps/ia64/fpu/t_exp.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/t_exp.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_acosh.c b/sysdeps/ia64/fpu/w_acosh.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acosh.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_acoshf.c b/sysdeps/ia64/fpu/w_acoshf.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acoshf.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_acoshl.c b/sysdeps/ia64/fpu/w_acoshl.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_acoshl.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_atanh.c b/sysdeps/ia64/fpu/w_atanh.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atanh.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_atanhf.c b/sysdeps/ia64/fpu/w_atanhf.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atanhf.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_atanhl.c b/sysdeps/ia64/fpu/w_atanhl.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_atanhl.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_exp10.c b/sysdeps/ia64/fpu/w_exp10.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp10.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_exp10f.c b/sysdeps/ia64/fpu/w_exp10f.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp10f.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_exp10l.c b/sysdeps/ia64/fpu/w_exp10l.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp10l.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_exp2.c b/sysdeps/ia64/fpu/w_exp2.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp2.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_exp2f.c b/sysdeps/ia64/fpu/w_exp2f.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp2f.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_exp2l.c b/sysdeps/ia64/fpu/w_exp2l.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_exp2l.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_expl.c b/sysdeps/ia64/fpu/w_expl.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_expl.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_lgamma.c b/sysdeps/ia64/fpu/w_lgamma.c
new file mode 100644
index 0000000000..2006d3e806
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgamma.c
@@ -0,0 +1,80 @@
+/* file: lgamma.c */
+
+
+// Copyright (c) 2002 Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+// History
+//==============================================================
+// 02/04/02: Initial version
+// 02/22/02: Removed lgammaf/gammaf
+//
+/*
+//   FUNCTIONS:    double  lgamma(double x)
+//                 double  gamma(double x)
+//                 Natural logarithm of GAMMA function
+*/
+
+#include "libm_support.h"
+
+
+extern double __libm_lgamma(double /*x*/, int* /*signgam*/, int /*signgamsz*/);
+
+
+double __ieee754_lgamma(double x)
+{
+#ifdef __POSIX__
+    extern int    signgam;
+#else
+    int    signgam;
+#endif
+    return __libm_lgamma(x, &signgam, sizeof(signgam));
+}
+weak_alias (__ieee754_lgamma, lgamma)
+
+double __ieee754_gamma(double x)
+{
+#ifdef __POSIX__
+    extern int    signgam;
+#else
+    int    signgam;
+#endif
+    return __libm_lgamma(x, &signgam, sizeof(signgam));
+}
+weak_alias (__ieee754_gamma, gamma)
diff --git a/sysdeps/ia64/fpu/w_lgamma_r.c b/sysdeps/ia64/fpu/w_lgamma_r.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgamma_r.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_lgammaf.c b/sysdeps/ia64/fpu/w_lgammaf.c
new file mode 100644
index 0000000000..cd0b4f6666
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgammaf.c
@@ -0,0 +1,80 @@
+/* file: lgammaf.c */
+
+
+// Copyright (c) 2002 Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+// History
+//==============================================================
+// 02/04/02: Initial version
+// 02/22/02: Removed lgamma/gamma
+//
+/*
+//   FUNCTIONS:    float   lgammaf(float x)
+//                 float   gammaf(float x)
+//                 Natural logarithm of GAMMA function
+*/
+
+#include "libm_support.h"
+
+
+extern float  __libm_lgammaf(float /*x*/, int* /*signgam*/, int /*signgamsz*/);
+
+
+float __ieee754_lgammaf(float x)
+{
+#ifdef __POSIX__
+    extern int    signgam;
+#else
+    int    signgam;
+#endif
+    return __libm_lgammaf(x, &signgam, sizeof(signgam));
+}
+weak_alias (__ieee754_lgammaf, lgammaf)
+
+float __ieee754_gammaf(float x)
+{
+#ifdef __POSIX__
+    extern int    signgam;
+#else
+    int    signgam;
+#endif
+    return __libm_lgammaf(x, &signgam, sizeof(signgam));
+}
+weak_alias (__ieee754_gammaf, gammaf)
diff --git a/sysdeps/ia64/fpu/w_lgammaf_r.c b/sysdeps/ia64/fpu/w_lgammaf_r.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgammaf_r.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_lgammal.c b/sysdeps/ia64/fpu/w_lgammal.c
new file mode 100644
index 0000000000..e3885296eb
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgammal.c
@@ -0,0 +1,79 @@
+/* file: lgammal.c */
+
+
+// Copyright (c) 2002 Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//
+
+// History
+//==============================================================
+// 08/15/02: Initial version
+//
+/*
+//   FUNCTIONS:    long double  lgammal(long double x)
+//                 long double  gammal(long double x)
+//                 Natural logarithm of GAMMA function
+*/
+
+#include "libm_support.h"
+
+
+extern double __libm_lgammal(long double /*x*/, int* /*signgam*/, int /*signgamsz*/);
+
+
+long double __ieee754_lgammal(long double x)
+{
+#ifdef __POSIX__
+    extern int    signgam;
+#else
+    int    signgam;
+#endif
+    return __libm_lgammal(x, &signgam, sizeof(signgam));
+}
+weak_alias (__ieee754_lgammal, lgammal)
+
+long double __ieee754_gammal(long double x)
+{
+#ifdef __POSIX__
+    extern int    signgam;
+#else
+    int    signgam;
+#endif
+    return __libm_lgammal(x, &signgam, sizeof(signgam));
+}
+weak_alias (__ieee754_gammal, gammal)
diff --git a/sysdeps/ia64/fpu/w_lgammal_r.c b/sysdeps/ia64/fpu/w_lgammal_r.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_lgammal_r.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_log2.c b/sysdeps/ia64/fpu/w_log2.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log2.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_log2f.c b/sysdeps/ia64/fpu/w_log2f.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log2f.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_log2l.c b/sysdeps/ia64/fpu/w_log2l.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_log2l.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_sinh.c b/sysdeps/ia64/fpu/w_sinh.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sinh.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_sinhf.c b/sysdeps/ia64/fpu/w_sinhf.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sinhf.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_sinhl.c b/sysdeps/ia64/fpu/w_sinhl.c
new file mode 100644
index 0000000000..41254ae60a
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_sinhl.c
@@ -0,0 +1 @@
+/* Not needed. */
diff --git a/sysdeps/ia64/fpu/w_tgamma.S b/sysdeps/ia64/fpu/w_tgamma.S
new file mode 100644
index 0000000000..24f3d11840
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_tgamma.S
@@ -0,0 +1,1836 @@
+.file "tgamma.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT 
+// LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,
+// EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA,OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code,and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History: 
+// 10/12/01  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/10/03  Reordered header: .section, .global, .proc, .align
+// 04/04/03  Changed error codes for overflow and negative integers
+// 04/10/03  Changed code for overflow near zero handling
+// 03/31/05  Reformatted delimiters between data tables
+//
+//*********************************************************************
+//
+//*********************************************************************
+//
+// Function: tgamma(x) computes the principle value of the GAMMA
+// function of x.
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f8-f15
+//                              f33-f87
+//
+//    General Purpose Registers:
+//      r8-r11
+//      r14-r28
+//      r32-r36
+//      r37-r40 (Used to pass arguments to error handling routine)
+//
+//    Predicate Registers:      p6-p15
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    tgamma(+inf) = +inf
+//    tgamma(-inf) = QNaN 
+//    tgamma(+/-0) = +/-inf 
+//    tgamma(x<0, x - integer) = QNaN
+//    tgamma(SNaN) = QNaN
+//    tgamma(QNaN) = QNaN
+//
+//*********************************************************************
+//
+// Overview
+//
+// The method consists of three cases.
+// 
+// If       2 <= x < OVERFLOW_BOUNDARY      use case tgamma_regular;
+// else if    0 < x < 2                     use case tgamma_from_0_to_2;
+// else    if  -(i+1) <  x < -i, i = 0...184 use case tgamma_negatives;
+//
+// Case 2 <= x < OVERFLOW_BOUNDARY
+// -------------------------------
+//   Here we use algorithm based on the recursive formula
+//   GAMMA(x+1) = x*GAMMA(x). For that we subdivide interval
+//   [2; OVERFLOW_BOUNDARY] into intervals [16*n; 16*(n+1)] and
+//   approximate GAMMA(x) by polynomial of 22th degree on each
+//   [16*n; 16*n+1], recursive formula is used to expand GAMMA(x)
+//   to [16*n; 16*n+1]. In other words we need to find n, i and r
+//   such that x = 16 * n + i + r where n and i are integer numbers
+//   and r is fractional part of x. So GAMMA(x) = GAMMA(16*n+i+r) =
+//   = (x-1)*(x-2)*...*(x-i)*GAMMA(x-i) =
+//   = (x-1)*(x-2)*...*(x-i)*GAMMA(16*n+r) ~
+//   ~ (x-1)*(x-2)*...*(x-i)*P22n(r).
+//
+//   Step 1: Reduction
+//   -----------------
+//    N = [x] with truncate
+//    r = x - N, note 0 <= r < 1
+//
+//    n = N & ~0xF - index of table that contains coefficient of
+//                   polynomial approximation 
+//    i = N & 0xF  - is used in recursive formula
+//   
+//
+//   Step 2: Approximation
+//   ---------------------
+//    We use factorized minimax approximation polynomials
+//    P22n(r) = A22*(r^2+C01(n)*R+C00(n))*
+//              *(r^2+C11(n)*R+C10(n))*...*(r^2+CA1(n)*R+CA0(n))
+//
+//   Step 3: Recursion
+//   -----------------
+//    In case when i > 0 we need to multiply P22n(r) by product
+//    R(i)=(x-1)*(x-2)*...*(x-i). To reduce number of fp-instructions
+//    we can calculate R as follow:  
+//    R(i) = ((x-1)*(x-2))*((x-3)*(x-4))*...*((x-(i-1))*(x-i)) if i is
+//    even or R = ((x-1)*(x-2))*((x-3)*(x-4))*...*((x-(i-2))*(x-(i-1)))*
+//    *(i-1) if i is odd. In both cases we need to calculate
+//    R2(i) = (x^2-3*x+2)*(x^2-7*x+12)*...*(x^2+x+2*j*(2*j-1)) =
+//    = (x^2-3*x+2)*(x^2-7*x+12)*...*((x^2+x)+2*j*(2*(j-1)+(1-2*x))) =
+//    = (RA+2*(2-RB))*(RA+4*(4-RB))*...*(RA+2*j*(2*(j-1)+RB))
+//    where j = 1..[i/2], RA = x^2+x, RB = 1-2*x.
+//
+//   Step 4: Reconstruction
+//   ----------------------
+//    Reconstruction is just simple multiplication i.e.
+//    GAMMA(x) = P22n(r)*R(i)
+//
+// Case 0 < x < 2
+// --------------
+//    To calculate GAMMA(x) on this interval we do following
+//        if 1 <= x < 1.25   than  GAMMA(x) = P15(x-1)
+//        if 1.25 <= x < 1.5 than  GAMMA(x) = P15(x-x_min) where
+//        x_min is point of local minimum on [1; 2] interval.
+//        if 1.5  <= x < 2.0 than  GAMMA(x) = P15(x-1.5)
+//    and      
+//        if 0 < x < 1 than GAMMA(x) = GAMMA(x+1)/x
+//
+// Case -(i+1) <  x < -i, i = 0...184
+// ----------------------------------
+//    Here we use the fact that GAMMA(-x) = PI/(x*GAMMA(x)*sin(PI*x)) and
+//    so we need to calculate GAMMA(x), sin(PI*x)/PI. Calculation of
+//    GAMMA(x) is described above.
+//
+//   Step 1: Reduction
+//   -----------------
+//    Note that period of sin(PI*x) is 2 and range reduction for 
+//    sin(PI*x) is like to range reduction for GAMMA(x) 
+//    i.e r = x - [x] with exception of cases
+//    when r > 0.5 (in such cases r = 1 - (x - [x])).
+//
+//   Step 2: Approximation
+//   ---------------------
+//    To approximate sin(PI*x)/PI = sin(PI*(2*n+r))/PI = 
+//    = (-1)^n*sin(PI*r)/PI Taylor series is used.
+//    sin(PI*r)/PI ~ S21(r).
+//
+//   Step 3: Division
+//   ----------------
+//    To calculate 1/(x*GAMMA(x)*S21(r)) we use frcpa instruction
+//    with following Newton-Raphson interations.
+//  
+//
+//*********************************************************************
+
+GR_Sig                  = r8
+GR_TAG                  = r8
+GR_ad_Data              = r9
+GR_SigRqLin             = r10
+GR_iSig                 = r11
+GR_ExpOf1               = r11
+GR_ExpOf8               = r11
+
+
+GR_Sig2                 = r14
+GR_Addr_Mask1           = r15
+GR_Sign_Exp             = r16
+GR_Tbl_Offs             = r17
+GR_Addr_Mask2           = r18
+GR_ad_Co                = r19
+GR_Bit2                 = r19
+GR_ad_Ce                = r20
+GR_ad_Co7               = r21
+GR_NzOvfBound           = r21
+GR_ad_Ce7               = r22
+GR_Tbl_Ind              = r23
+GR_Tbl_16xInd           = r24
+GR_ExpOf025             = r24
+GR_ExpOf05              = r25
+GR_0x30033              = r26
+GR_10                   = r26
+GR_12                   = r27
+GR_185                  = r27
+GR_14                   = r28
+GR_2                    = r28
+GR_fpsr                 = r28
+
+GR_SAVE_B0              = r33
+GR_SAVE_PFS             = r34
+GR_SAVE_GP              = r35
+GR_SAVE_SP              = r36
+
+GR_Parameter_X          = r37
+GR_Parameter_Y          = r38
+GR_Parameter_RESULT     = r39
+GR_Parameter_TAG        = r40
+
+
+
+FR_X                    = f10
+FR_Y                    = f1 // tgamma is single argument function
+FR_RESULT               = f8
+
+FR_AbsX                 = f9
+FR_NormX                = f9
+FR_r02                  = f11
+FR_AbsXp1               = f12
+FR_X2pX                 = f13
+FR_1m2X                 = f14
+FR_Rq1                  = f14
+FR_Xt                   = f15
+
+FR_r                    = f33
+FR_OvfBound             = f34
+FR_Xmin                 = f35
+FR_2                    = f36
+FR_Rcp1                 = f36
+FR_Rcp3                 = f36
+FR_4                    = f37
+FR_5                    = f38
+FR_6                    = f39
+FR_8                    = f40
+FR_10                   = f41
+FR_12                   = f42
+FR_14                   = f43
+FR_GAMMA                = f43
+FR_05                   = f44
+
+FR_Rq2                  = f45
+FR_Rq3                  = f46
+FR_Rq4                  = f47
+FR_Rq5                  = f48
+FR_Rq6                  = f49
+FR_Rq7                  = f50
+FR_RqLin                = f51
+
+FR_InvAn                = f52
+
+FR_C01                  = f53
+FR_A15                  = f53
+FR_C11                  = f54
+FR_A14                  = f54
+FR_C21                  = f55
+FR_A13                  = f55
+FR_C31                  = f56
+FR_A12                  = f56
+FR_C41                  = f57
+FR_A11                  = f57
+FR_C51                  = f58
+FR_A10                  = f58
+FR_C61                  = f59
+FR_A9                   = f59
+FR_C71                  = f60
+FR_A8                   = f60
+FR_C81                  = f61
+FR_A7                   = f61
+FR_C91                  = f62
+FR_A6                   = f62
+FR_CA1                  = f63
+FR_A5                   = f63
+FR_C00                  = f64
+FR_A4                   = f64
+FR_rs2                  = f64
+FR_C10                  = f65
+FR_A3                   = f65
+FR_rs3                  = f65
+FR_C20                  = f66
+FR_A2                   = f66
+FR_rs4                  = f66
+FR_C30                  = f67
+FR_A1                   = f67
+FR_rs7                  = f67
+FR_C40                  = f68
+FR_A0                   = f68
+FR_rs8                  = f68
+FR_C50                  = f69
+FR_r2                   = f69
+FR_C60                  = f70
+FR_r3                   = f70
+FR_C70                  = f71
+FR_r4                   = f71
+FR_C80                  = f72
+FR_r7                   = f72
+FR_C90                  = f73
+FR_r8                   = f73
+FR_CA0                  = f74
+FR_An                   = f75
+
+FR_S21                  = f76
+FR_S19                  = f77
+FR_Rcp0                 = f77
+FR_Rcp2                 = f77
+FR_S17                  = f78
+FR_S15                  = f79
+FR_S13                  = f80
+FR_S11                  = f81
+FR_S9                   = f82
+FR_S7                   = f83
+FR_S5                   = f84
+FR_S3                   = f85
+
+FR_iXt                  = f86
+FR_rs                   = f87
+
+
+// Data tables
+//==============================================================
+RODATA
+.align 16
+
+LOCAL_OBJECT_START(tgamma_data)
+data8 0x406573FAE561F648 // overflow boundary (171.624376956302739927196)
+data8 0x3FDD8B618D5AF8FE // point of local minium (0.461632144968362356785)
+//
+//[2; 3]
+data8 0xEF0E85C9AE40ABE2,0x00004000 // C01
+data8 0xCA2049DDB4096DD8,0x00004000 // C11
+data8 0x99A203B4DC2D1A8C,0x00004000 // C21
+data8 0xBF5D9D9C0C295570,0x00003FFF // C31
+data8 0xE8DD037DEB833BAB,0x00003FFD // C41
+data8 0xB6AE39A2A36AA03A,0x0000BFFE // C51
+data8 0x804960DC2850277B,0x0000C000 // C61
+data8 0xD9F3973841C09F80,0x0000C000 // C71
+data8 0x9C198A676F8A2239,0x0000C001 // C81
+data8 0xC98B7DAE02BE3226,0x0000C001 // C91
+data8 0xE9CAF31AC69301BA,0x0000C001 // CA1
+data8 0xFBBDD58608A0D172,0x00004000 // C00
+data8 0xFDD0316D1E078301,0x00004000 // C10
+data8 0x8630B760468C15E4,0x00004001 // C20
+data8 0x93EDE20E47D9152E,0x00004001 // C30
+data8 0xA86F3A38C77D6B19,0x00004001 // C40
+//[16; 17]
+data8 0xF87F757F365EE813,0x00004000 // C01
+data8 0xECA84FBA92759DA4,0x00004000 // C11
+data8 0xD4E0A55E07A8E913,0x00004000 // C21
+data8 0xB0EB45E94C8A5F7B,0x00004000 // C31
+data8 0x8050D6B4F7C8617D,0x00004000 // C41
+data8 0x8471B111AA691E5A,0x00003FFF // C51
+data8 0xADAF462AF96585C9,0x0000BFFC // C61
+data8 0xD327C7A587A8C32B,0x0000BFFF // C71
+data8 0xDEF5192B4CF5E0F1,0x0000C000 // C81
+data8 0xBADD64BB205AEF02,0x0000C001 // C91
+data8 0x9330A24AA67D6860,0x0000C002 // CA1
+data8 0xF57EEAF36D8C47BE,0x00004000 // C00
+data8 0x807092E12A251B38,0x00004001 // C10
+data8 0x8C458F80DEE7ED1C,0x00004001 // C20
+data8 0x9F30C731DC77F1A6,0x00004001 // C30
+data8 0xBAC4E7E099C3A373,0x00004001 // C40
+//[32; 33]
+data8 0xC3059A415F142DEF,0x00004000 // C01
+data8 0xB9C1DAC24664587A,0x00004000 // C11
+data8 0xA7101D910992FFB2,0x00004000 // C21
+data8 0x8A9522B8E4AA0AB4,0x00004000 // C31
+data8 0xC76A271E4BA95DCC,0x00003FFF // C41
+data8 0xC5D6DE2A38DB7FF2,0x00003FFE // C51
+data8 0xDBA42086997818B2,0x0000BFFC // C61
+data8 0xB8EDDB1424C1C996,0x0000BFFF // C71
+data8 0xBF7372FB45524B5D,0x0000C000 // C81
+data8 0xA03DDE759131580A,0x0000C001 // C91
+data8 0xFDA6FC4022C1FFE3,0x0000C001 // CA1
+data8 0x9759ABF797B2533D,0x00004000 // C00
+data8 0x9FA160C6CF18CEC5,0x00004000 // C10
+data8 0xB0EFF1E3530E0FCD,0x00004000 // C20
+data8 0xCCD60D5C470165D1,0x00004000 // C30
+data8 0xF5E53F6307B0B1C1,0x00004000 // C40
+//[48; 49]
+data8 0xAABE577FBCE37F5E,0x00004000 // C01
+data8 0xA274CAEEB5DF7172,0x00004000 // C11
+data8 0x91B90B6646C1B924,0x00004000 // C21
+data8 0xF06718519CA256D9,0x00003FFF // C31
+data8 0xAA9EE181C0E30263,0x00003FFF // C41
+data8 0xA07BDB5325CB28D2,0x00003FFE // C51
+data8 0x86C8B873204F9219,0x0000BFFD // C61
+data8 0xB0192C5D3E4787D6,0x0000BFFF // C71
+data8 0xB1E0A6263D4C19EF,0x0000C000 // C81
+data8 0x93BA32A118EAC9AE,0x0000C001 // C91
+data8 0xE942A39CD9BEE887,0x0000C001 // CA1
+data8 0xE838B0957B0D3D0D,0x00003FFF // C00
+data8 0xF60E0F00074FCF34,0x00003FFF // C10
+data8 0x89869936AE00C2A5,0x00004000 // C20
+data8 0xA0FE4E8AA611207F,0x00004000 // C30
+data8 0xC3B1229CFF1DDAFE,0x00004000 // C40
+//[64; 65]
+data8 0x9C00DDF75CDC6183,0x00004000 // C01
+data8 0x9446AE9C0F6A833E,0x00004000 // C11
+data8 0x84ABC5083310B774,0x00004000 // C21
+data8 0xD9BA3A0977B1ED83,0x00003FFF // C31
+data8 0x989B18C99411D300,0x00003FFF // C41
+data8 0x886E66402318CE6F,0x00003FFE // C51
+data8 0x99028C2468F18F38,0x0000BFFD // C61
+data8 0xAB72D17DCD40CCE1,0x0000BFFF // C71
+data8 0xA9D9AC9BE42C2EF9,0x0000C000 // C81
+data8 0x8C11D983AA177AD2,0x0000C001 // C91
+data8 0xDC779E981C1F0F06,0x0000C001 // CA1
+data8 0xC1FD4AC85965E8D6,0x00003FFF // C00
+data8 0xCE3D2D909D389EC2,0x00003FFF // C10
+data8 0xE7F79980AD06F5D8,0x00003FFF // C20
+data8 0x88DD9F73C8680B5D,0x00004000 // C30
+data8 0xA7D6CB2CB2D46F9D,0x00004000 // C40
+//[80; 81]
+data8 0x91C7FF4E993430D0,0x00004000 // C01
+data8 0x8A6E7AB83E45A7E9,0x00004000 // C11
+data8 0xF72D6382E427BEA9,0x00003FFF // C21
+data8 0xC9E2E4F9B3B23ED6,0x00003FFF // C31
+data8 0x8BEFEF56AE05D775,0x00003FFF // C41
+data8 0xEE9666AB6A185560,0x00003FFD // C51
+data8 0xA6AFAF5CEFAEE04D,0x0000BFFD // C61
+data8 0xA877EAFEF1F9C880,0x0000BFFF // C71
+data8 0xA45BD433048ECA15,0x0000C000 // C81
+data8 0x86BD1636B774CC2E,0x0000C001 // C91
+data8 0xD3721BE006E10823,0x0000C001 // CA1
+data8 0xA97EFABA91854208,0x00003FFF // C00
+data8 0xB4AF0AEBB3F97737,0x00003FFF // C10
+data8 0xCC38241936851B0B,0x00003FFF // C20
+data8 0xF282A6261006EA84,0x00003FFF // C30
+data8 0x95B8E9DB1BD45BAF,0x00004000 // C40
+//[96; 97]
+data8 0x8A1FA3171B35A106,0x00004000 // C01
+data8 0x830D5B8843890F21,0x00004000 // C11
+data8 0xE98B0F1616677A23,0x00003FFF // C21
+data8 0xBDF8347F5F67D4EC,0x00003FFF // C31
+data8 0x825F15DE34EC055D,0x00003FFF // C41
+data8 0xD4846186B8AAC7BE,0x00003FFD // C51
+data8 0xB161093AB14919B1,0x0000BFFD // C61
+data8 0xA65758EEA4800EF4,0x0000BFFF // C71
+data8 0xA046B67536FA329C,0x0000C000 // C81
+data8 0x82BBEC1BCB9E9068,0x0000C001 // C91
+data8 0xCC9DE2B23BA91B0B,0x0000C001 // CA1
+data8 0x983B16148AF77F94,0x00003FFF // C00
+data8 0xA2A4D8EE90FEE5DD,0x00003FFF // C10
+data8 0xB89446FA37FF481C,0x00003FFF // C20
+data8 0xDC5572648485FB01,0x00003FFF // C30
+data8 0x88CD5D7DB976129A,0x00004000 // C40
+//[112; 113]
+data8 0x8417098FD62AC5E3,0x00004000 // C01
+data8 0xFA7896486B779CBB,0x00003FFF // C11
+data8 0xDEC98B14AF5EEBD1,0x00003FFF // C21
+data8 0xB48E153C6BF0B5A3,0x00003FFF // C31
+data8 0xF597B038BC957582,0x00003FFE // C41
+data8 0xBFC6F0884A415694,0x00003FFD // C51
+data8 0xBA075A1392BDB5E5,0x0000BFFD // C61
+data8 0xA4B79E01B44C7DB4,0x0000BFFF // C71
+data8 0x9D12FA7711BFAB0F,0x0000C000 // C81
+data8 0xFF24C47C8E108AB4,0x0000C000 // C91
+data8 0xC7325EC86562606A,0x0000C001 // CA1
+data8 0x8B47DCD9E1610938,0x00003FFF // C00
+data8 0x9518B111B70F88B8,0x00003FFF // C10
+data8 0xA9CC197206F68682,0x00003FFF // C20
+data8 0xCB98294CC0D7A6A6,0x00003FFF // C30
+data8 0xFE09493EA9165181,0x00003FFF // C40
+//[128; 129]
+data8 0xFE53D03442270D90,0x00003FFF // C01
+data8 0xF0F857BAEC1993E4,0x00003FFF // C11
+data8 0xD5FF6D70DBBC2FD3,0x00003FFF // C21
+data8 0xACDAA5F4988B1074,0x00003FFF // C31
+data8 0xE92E069F8AD75B54,0x00003FFE // C41
+data8 0xAEBB64645BD94234,0x00003FFD // C51
+data8 0xC13746249F39B43C,0x0000BFFD // C61
+data8 0xA36B74F5B6297A1F,0x0000BFFF // C71
+data8 0x9A77860DF180F6E5,0x0000C000 // C81
+data8 0xF9F8457D84410A0C,0x0000C000 // C91
+data8 0xC2BF44C649EB8597,0x0000C001 // CA1
+data8 0x81225E7489BCDC0E,0x00003FFF // C00
+data8 0x8A788A09CE0EED11,0x00003FFF // C10
+data8 0x9E2E6F86D1B1D89C,0x00003FFF // C20
+data8 0xBE6866B21CF6CCB5,0x00003FFF // C30
+data8 0xEE94426EC1486AAE,0x00003FFF // C40
+//[144; 145]
+data8 0xF6113E09732A6497,0x00003FFF // C01
+data8 0xE900D45931B04FC8,0x00003FFF // C11
+data8 0xCE9FD58F745EBA5D,0x00003FFF // C21
+data8 0xA663A9636C864C86,0x00003FFF // C31
+data8 0xDEBF5315896CE629,0x00003FFE // C41
+data8 0xA05FEA415EBD7737,0x00003FFD // C51
+data8 0xC750F112BD9C4031,0x0000BFFD // C61
+data8 0xA2593A35C51C6F6C,0x0000BFFF // C71
+data8 0x9848E1DA7FB40C8C,0x0000C000 // C81
+data8 0xF59FEE87A5759A4B,0x0000C000 // C91
+data8 0xBF00203909E45A1D,0x0000C001 // CA1
+data8 0xF1D8E157200127E5,0x00003FFE // C00
+data8 0x81DD5397CB08D487,0x00003FFF // C10
+data8 0x94C1DC271A8B766F,0x00003FFF // C20
+data8 0xB3AFAF9B5D6EDDCF,0x00003FFF // C30
+data8 0xE1FB4C57CA81BE1E,0x00003FFF // C40
+//[160; 161]
+data8 0xEEFFE5122AC72FFD,0x00003FFF // C01
+data8 0xE22F70BB52AD54B3,0x00003FFF // C11
+data8 0xC84FF021FE993EEA,0x00003FFF // C21
+data8 0xA0DA2208EB5B2752,0x00003FFF // C31
+data8 0xD5CDD2FCF8AD2DF5,0x00003FFE // C41
+data8 0x940BEC6DCD811A59,0x00003FFD // C51
+data8 0xCC954EF4FD4EBB81,0x0000BFFD // C61
+data8 0xA1712E29A8C04554,0x0000BFFF // C71
+data8 0x966B55DFB243521A,0x0000C000 // C81
+data8 0xF1E6A2B9CEDD0C4C,0x0000C000 // C91
+data8 0xBBC87BCC031012DB,0x0000C001 // CA1
+data8 0xE43974E6D2818583,0x00003FFE // C00
+data8 0xF5702A516B64C5B7,0x00003FFE // C10
+data8 0x8CEBCB1B32E19471,0x00003FFF // C20
+data8 0xAAC10F05BB77E0AF,0x00003FFF // C30
+data8 0xD776EFCAB205CC58,0x00003FFF // C40
+//[176; 177]
+data8 0xE8DA614119811E5D,0x00003FFF // C01
+data8 0xDC415E0288B223D8,0x00003FFF // C11
+data8 0xC2D2243E44EC970E,0x00003FFF // C21
+data8 0x9C086664B5307BEA,0x00003FFF // C31
+data8 0xCE03D7A08B461156,0x00003FFE // C41
+data8 0x894BE3BAAAB66ADC,0x00003FFD // C51
+data8 0xD131EDD71A702D4D,0x0000BFFD // C61
+data8 0xA0A907CDDBE10898,0x0000BFFF // C71
+data8 0x94CC3CD9C765C808,0x0000C000 // C81
+data8 0xEEA85F237815FC0D,0x0000C000 // C91
+data8 0xB8FA04B023E43F91,0x0000C001 // CA1
+data8 0xD8B2C7D9FCBD7EF9,0x00003FFE // C00
+data8 0xE9566E93AAE7E38F,0x00003FFE // C10
+data8 0x8646E78AABEF0255,0x00003FFF // C20
+data8 0xA32AEDB62E304345,0x00003FFF // C30
+data8 0xCE83E40280EE7DF0,0x00003FFF // C40
+//
+//[2; 3]
+data8 0xC44FB47E90584083,0x00004001 // C50
+data8 0xE863EE77E1C45981,0x00004001 // C60
+data8 0x8AC15BE238B9D70E,0x00004002 // C70
+data8 0xA5D94B6592350EF4,0x00004002 // C80
+data8 0xC379DB3E20A148B3,0x00004002 // C90
+data8 0xDACA49B73974F6C9,0x00004002 // CA0
+data8 0x810E496A1AFEC895,0x00003FE1 // An
+//[16; 17]
+data8 0xE17C0357AAF3F817,0x00004001 // C50
+data8 0x8BA8804750FBFBFE,0x00004002 // C60
+data8 0xB18EAB3CB64BEBEE,0x00004002 // C70
+data8 0xE90AB7015AF1C28F,0x00004002 // C80
+data8 0xA0AB97CE9E259196,0x00004003 // C90
+data8 0xF5E0E0A000C2D720,0x00004003 // CA0
+data8 0xD97F0F87EC791954,0x00004005 // An
+//[32; 33]
+data8 0x980C293F3696040D,0x00004001 // C50
+data8 0xC0DBFFBB948A9A4E,0x00004001 // C60
+data8 0xFAB54625E9A588A2,0x00004001 // C70
+data8 0xA7E08176D6050FBF,0x00004002 // C80
+data8 0xEBAAEC4952270A9F,0x00004002 // C90
+data8 0xB7479CDAD20550FE,0x00004003 // CA0
+data8 0xAACD45931C3FF634,0x00004054 // An
+//[48; 49]
+data8 0xF5180F0000419AD5,0x00004000 // C50
+data8 0x9D507D07BFBB2273,0x00004001 // C60
+data8 0xCEB53F7A13A383E3,0x00004001 // C70
+data8 0x8BAFEF9E0A49128F,0x00004002 // C80
+data8 0xC58EF912D39E228C,0x00004002 // C90
+data8 0x9A88118422BA208E,0x00004003 // CA0
+data8 0xBD6C0E2477EC12CB,0x000040AC // An
+//[64; 65]
+data8 0xD410AC48BF7748DA,0x00004000 // C50
+data8 0x89399B90AFEBD931,0x00004001 // C60
+data8 0xB596DF8F77EB8560,0x00004001 // C70
+data8 0xF6D9445A047FB4A6,0x00004001 // C80
+data8 0xAF52F0DD65221357,0x00004002 // C90
+data8 0x8989B45BFC881989,0x00004003 // CA0
+data8 0xB7FCAE86E6E10D5A,0x0000410B // An
+//[80; 81]
+data8 0xBE759740E3B5AA84,0x00004000 // C50
+data8 0xF8037B1B07D27609,0x00004000 // C60
+data8 0xA4F6F6C7F0977D4F,0x00004001 // C70
+data8 0xE131960233BF02C4,0x00004001 // C80
+data8 0xA06DF43D3922BBE2,0x00004002 // C90
+data8 0xFC266AB27255A360,0x00004002 // CA0
+data8 0xD9F4B012EDAFEF2F,0x0000416F // An
+//[96; 97]
+data8 0xAEFC84CDA8E1EAA6,0x00004000 // C50
+data8 0xE5009110DB5F3C8A,0x00004000 // C60
+data8 0x98F5F48738E7B232,0x00004001 // C70
+data8 0xD17EE64E21FFDC6B,0x00004001 // C80
+data8 0x9596F7A7E36145CC,0x00004002 // C90
+data8 0xEB64DBE50E125CAF,0x00004002 // CA0
+data8 0xA090530D79E32D2E,0x000041D8 // An
+//[112; 113]
+data8 0xA33AEA22A16B2655,0x00004000 // C50
+data8 0xD682B93BD7D7945C,0x00004000 // C60
+data8 0x8FC854C6E6E30CC3,0x00004001 // C70
+data8 0xC5754D828AFFDC7A,0x00004001 // C80
+data8 0x8D41216B397139C2,0x00004002 // C90
+data8 0xDE78D746848116E5,0x00004002 // CA0
+data8 0xB8A297A2DC0630DB,0x00004244 // An
+//[128; 129]
+data8 0x99EB00F11D95E292,0x00004000 // C50
+data8 0xCB005CB911EB779A,0x00004000 // C60
+data8 0x8879AA2FDFF3A37A,0x00004001 // C70
+data8 0xBBDA538AD40CAC2C,0x00004001 // C80
+data8 0x8696D849D311B9DE,0x00004002 // C90
+data8 0xD41E1C041481199F,0x00004002 // CA0
+data8 0xEBA1A43D34EE61EE,0x000042B3 // An
+//[144; 145]
+data8 0x924F822578AA9F3D,0x00004000 // C50
+data8 0xC193FAF9D3B36960,0x00004000 // C60
+data8 0x827AE3A6B68ED0CA,0x00004001 // C70
+data8 0xB3F52A27EED23F0B,0x00004001 // C80
+data8 0x811A079FB3C94D79,0x00004002 // C90
+data8 0xCB94415470B6F8D2,0x00004002 // CA0
+data8 0x80A0260DCB3EC9AC,0x00004326 // An
+//[160; 161]
+data8 0x8BF24091E88B331D,0x00004000 // C50
+data8 0xB9ADE01187E65201,0x00004000 // C60
+data8 0xFAE4508F6E7625FE,0x00004000 // C70
+data8 0xAD516668AD6D7367,0x00004001 // C80
+data8 0xF8F5FF171154F637,0x00004001 // C90
+data8 0xC461321268990C82,0x00004002 // CA0
+data8 0xC3B693F344B0E6FE,0x0000439A // An
+//
+//[176; 177]
+data8 0x868545EB42A258ED,0x00004000 // C50
+data8 0xB2EF04ACE8BA0E6E,0x00004000 // C60
+data8 0xF247D22C22E69230,0x00004000 // C70
+data8 0xA7A1AB93E3981A90,0x00004001 // C80
+data8 0xF10951733E2C697F,0x00004001 // C90
+data8 0xBE3359BFAD128322,0x00004002 // CA0
+data8 0x8000000000000000,0x00003fff
+//
+//[160; 161] for negatives
+data8 0xA76DBD55B2E32D71,0x00003C63 // 1/An
+//
+// sin(pi*x)/pi
+data8 0xBCBC4342112F52A2,0x00003FDE // S21
+data8 0xFAFCECB86536F655,0x0000BFE3 // S19
+data8 0x87E4C97F9CF09B92,0x00003FE9 // S17
+data8 0xEA124C68E704C5CB,0x0000BFED // S15
+data8 0x9BA38CFD59C8AA1D,0x00003FF2 // S13
+data8 0x99C0B552303D5B21,0x0000BFF6 // S11
+//
+//[176; 177] for negatives
+data8 0xBA5D5869211696FF,0x00003BEC // 1/An
+//
+// sin(pi*x)/pi
+data8 0xD63402E79A853175,0x00003FF9 // S9
+data8 0xC354723906DB36BA,0x0000BFFC // S7
+data8 0xCFCE5A015E236291,0x00003FFE // S5
+data8 0xD28D3312983E9918,0x0000BFFF // S3
+//
+//
+// [1.0;1.25]
+data8 0xA405530B067ECD3C,0x0000BFFC // A15
+data8 0xF5B5413F95E1C282,0x00003FFD // A14
+data8 0xC4DED71C782F76C8,0x0000BFFE // A13
+data8 0xECF7DDDFD27C9223,0x00003FFE // A12
+data8 0xFB73D31793068463,0x0000BFFE // A11
+data8 0xFF173B7E66FD1D61,0x00003FFE // A10
+data8 0xFFA5EF3959089E94,0x0000BFFE // A9
+data8 0xFF8153BD42E71A4F,0x00003FFE // A8
+data8 0xFEF9CAEE2CB5B533,0x0000BFFE // A7
+data8 0xFE3F02E5EDB6811E,0x00003FFE // A6
+data8 0xFB64074CED2658FB,0x0000BFFE // A5
+data8 0xFB52882A095B18A4,0x00003FFE // A4
+data8 0xE8508C7990A0DAC0,0x0000BFFE // A3
+data8 0xFD32C611D8A881D0,0x00003FFE // A2
+data8 0x93C467E37DB0C536,0x0000BFFE // A1
+data8 0x8000000000000000,0x00003FFF // A0
+//
+// [1.25;1.5]
+data8 0xD038092400619677,0x0000BFF7 // A15
+data8 0xEA6DE925E6EB8C8F,0x00003FF3 // A14
+data8 0xC53F83645D4597FC,0x0000BFF7 // A13
+data8 0xE366DB2FB27B7ECD,0x00003FF7 // A12
+data8 0xAC8FD5E11F6EEAD8,0x0000BFF8 // A11
+data8 0xFB14010FB3697785,0x00003FF8 // A10
+data8 0xB6F91CB5C371177B,0x0000BFF9 // A9
+data8 0x85A262C6F8FEEF71,0x00003FFA // A8
+data8 0xC038E6E3261568F9,0x0000BFFA // A7
+data8 0x8F4BDE8883232364,0x00003FFB // A6
+data8 0xBCFBBD5786537E9A,0x0000BFFB // A5
+data8 0xA4C08BAF0A559479,0x00003FFC // A4
+data8 0x85D74FA063E81476,0x0000BFFC // A3
+data8 0xDB629FB9BBDC1C4E,0x00003FFD // A2
+data8 0xF4F8FBC7C0C9D317,0x00003FC6 // A1
+data8 0xE2B6E4153A57746C,0x00003FFE // A0
+//
+// [1.25;1.5]
+data8 0x9533F9D3723B448C,0x0000BFF2 // A15
+data8 0xF1F75D3C561CBBAF,0x00003FF5 // A14
+data8 0xBA55A9A1FC883523,0x0000BFF8 // A13
+data8 0xB5D5E9E5104FA995,0x00003FFA // A12
+data8 0xFD84F35B70CD9AE2,0x0000BFFB // A11
+data8 0x87445235F4688CC5,0x00003FFD // A10
+data8 0xE7F236EBFB9F774E,0x0000BFFD // A9
+data8 0xA6605F2721F787CE,0x00003FFE // A8
+data8 0xCF579312AD7EAD72,0x0000BFFE // A7
+data8 0xE96254A2407A5EAC,0x00003FFE // A6
+data8 0xF41312A8572ED346,0x0000BFFE // A5
+data8 0xF9535027C1B1F795,0x00003FFE // A4
+data8 0xE7E82D0C613A8DE4,0x0000BFFE // A3
+data8 0xFD23CD9741B460B8,0x00003FFE // A2
+data8 0x93C30FD9781DBA88,0x0000BFFE // A1
+data8 0xFFFFF1781FDBEE84,0x00003FFE // A0
+LOCAL_OBJECT_END(tgamma_data)
+
+
+//==============================================================
+// Code
+//==============================================================
+
+.section .text
+GLOBAL_LIBM_ENTRY(tgamma)
+{ .mfi
+      getf.exp      GR_Sign_Exp = f8
+      fma.s1        FR_1m2X = f8,f1,f8 // 2x
+      addl          GR_ad_Data = @ltoff(tgamma_data), gp
+}
+{ .mfi
+      mov           GR_ExpOf8 = 0x10002 // 8
+      fcvt.fx.trunc.s1 FR_iXt = f8 // [x]
+      mov           GR_ExpOf05 = 0xFFFE // 0.5
+};;
+{ .mfi
+      getf.sig      GR_Sig = f8
+      fma.s1        FR_2 = f1,f1,f1 // 2
+      mov           GR_Addr_Mask1 = 0x780
+}
+{ .mlx
+      setf.exp      FR_8 = GR_ExpOf8
+      movl          GR_10 = 0x4024000000000000
+};;
+{ .mfi
+      ld8           GR_ad_Data = [GR_ad_Data]
+      fcmp.lt.s1    p14,p15 = f8,f0
+      tbit.z        p12,p13 = GR_Sign_Exp,0x10 // p13 if x >= 2
+}
+{ .mlx
+      and           GR_Bit2 = 4,GR_Sign_Exp
+      movl          GR_12 = 0x4028000000000000
+};;
+{ .mfi
+      setf.d        FR_10 = GR_10
+      fma.s1        FR_r02 = f8,f1,f0
+      extr.u        GR_Tbl_Offs = GR_Sig,58,6
+}
+{ .mfi
+(p12) mov           GR_Addr_Mask1 = r0
+      fma.s1        FR_NormX = f8,f1,f0
+      cmp.ne        p8,p0 = GR_Bit2,r0
+};;
+{ .mfi
+(p8)  shladd        GR_Tbl_Offs = GR_Tbl_Offs,4,r0
+      fclass.m      p10,p0 =  f8,0x1E7 // Test x for NaTVal, NaN, +/-0, +/-INF
+      tbit.nz       p11,p0 = GR_Sign_Exp,1
+}
+{ .mlx
+      add           GR_Addr_Mask2 = GR_Addr_Mask1,GR_Addr_Mask1
+      movl          GR_14 = 0x402C000000000000
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      setf.d        FR_12 = GR_12
+(p14) fma.s1        FR_1m2X = f1,f1,FR_1m2X // RB=1-2|x|
+      tbit.nz       p8,p9 = GR_Sign_Exp,0
+}
+{ .mfi
+      ldfpd         FR_OvfBound,FR_Xmin = [GR_ad_Data],16
+(p15) fms.s1        FR_1m2X = f1,f1,FR_1m2X // RB=1-2|x|
+(p11) shladd        GR_Tbl_Offs = GR_Tbl_Offs,2,r0
+};;
+.pred.rel "mutex",p9,p8
+{ .mfi
+      setf.d        FR_14 = GR_14
+      fma.s1        FR_4 = FR_2,FR_2,f0
+(p8)  and           GR_Tbl_Offs = GR_Tbl_Offs, GR_Addr_Mask1
+}
+{ .mfi
+      setf.exp      FR_05 = GR_ExpOf05
+      fma.s1        FR_6 = FR_2,FR_2,FR_2
+(p9)  and           GR_Tbl_Offs = GR_Tbl_Offs, GR_Addr_Mask2
+};;
+.pred.rel "mutex",p9,p8
+{ .mfi
+(p8)  shladd        GR_ad_Co = GR_Tbl_Offs,1,GR_ad_Data
+      fcvt.xf       FR_Xt = FR_iXt // [x]
+(p15) tbit.z.unc    p11,p0 = GR_Sign_Exp,0x10 // p11 if 0 < x < 2
+}
+{ .mfi
+(p9)  add           GR_ad_Co = GR_ad_Data,GR_Tbl_Offs
+      fma.s1        FR_5 = FR_2,FR_2,f1
+(p15) cmp.lt.unc    p7,p6 = GR_ExpOf05,GR_Sign_Exp // p7 if 0 < x < 1
+};;
+{ .mfi
+      add           GR_ad_Ce = 16,GR_ad_Co
+(p11) frcpa.s1      FR_Rcp0,p0 = f1,f8
+      sub           GR_Tbl_Offs = GR_ad_Co,GR_ad_Data
+}
+{ .mfb
+      ldfe          FR_C01 = [GR_ad_Co],32
+(p7)  fms.s1        FR_r02 = FR_r02,f1,f1 
+      // jump if x is NaTVal, NaN, +/-0, +/-INF
+(p10) br.cond.spnt  tgamma_spec
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      ldfe          FR_C11 = [GR_ad_Ce],32
+(p14) fms.s1        FR_X2pX = f8,f8,f8 // RA=x^2+|x|
+      shr           GR_Tbl_Ind = GR_Tbl_Offs,8
+}
+{ .mfb
+      ldfe          FR_C21 = [GR_ad_Co],32
+(p15) fma.s1        FR_X2pX = f8,f8,f8 // RA=x^2+x
+      // jump if 0 < x < 2
+(p11) br.cond.spnt  tgamma_from_0_to_2
+};;
+{ .mfi
+      ldfe          FR_C31 = [GR_ad_Ce],32
+      fma.s1        FR_Rq2 = FR_2,f1,FR_1m2X  // 2 + B
+      cmp.ltu       p7,p0=0xB,GR_Tbl_Ind
+}
+{ .mfb
+      ldfe          FR_C41 = [GR_ad_Co],32
+      fma.s1        FR_Rq3 = FR_2,FR_2,FR_1m2X  // 4 + B
+      // jump if GR_Tbl_Ind > 11, i.e |x| is more than 192
+(p7)  br.cond.spnt  tgamma_spec_res
+};;
+{ .mfi
+      ldfe          FR_C51 = [GR_ad_Ce],32
+      fma.s1        FR_Rq4 = FR_6,f1,FR_1m2X  // 6 + B
+      shr           GR_Tbl_Offs = GR_Tbl_Offs,1
+}
+{ .mfi
+      ldfe          FR_C61 = [GR_ad_Co],32
+      fma.s1        FR_Rq5 = FR_4,FR_2,FR_1m2X // 8 + B
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_C71 = [GR_ad_Ce],32
+(p14) fms.s1        FR_r = FR_Xt,f1,f8 // r = |x| - [|x|]
+      shr           GR_Tbl_16xInd = GR_Tbl_Offs,3
+}
+{ .mfi
+      ldfe          FR_C81 = [GR_ad_Co],32
+(p15) fms.s1        FR_r = f8,f1,FR_Xt // r = x - [x]
+      add           GR_ad_Data = 0xC00,GR_ad_Data
+};;
+{ .mfi
+      ldfe          FR_C91 = [GR_ad_Ce],32
+      fma.s1        FR_Rq6 = FR_5,FR_2,FR_1m2X  // 10 + B
+(p14) mov           GR_0x30033 = 0x30033
+}
+{ .mfi
+      ldfe          FR_CA1 = [GR_ad_Co],32
+      fma.s1        FR_Rq7 = FR_6,FR_2,FR_1m2X // 12 + B
+      sub           GR_Tbl_Offs = GR_Tbl_Offs,GR_Tbl_16xInd
+};;
+{ .mfi
+      ldfe          FR_C00 = [GR_ad_Ce],32
+      fma.s1        FR_Rq1 = FR_Rq1,FR_2,FR_X2pX // (x-1)*(x-2)
+(p13) cmp.eq.unc    p8,p0 = r0,GR_Tbl_16xInd // index is 0 i.e. arg from [2;16)
+}
+{ .mfi
+      ldfe          FR_C10 = [GR_ad_Co],32
+(p14) fms.s1        FR_AbsX = f0,f0,FR_NormX // absolute value of argument
+      add           GR_ad_Co7 = GR_ad_Data,GR_Tbl_Offs
+};;
+{ .mfi
+      ldfe          FR_C20 = [GR_ad_Ce],32
+      fma.s1        FR_Rq2 = FR_Rq2,FR_4,FR_X2pX // (x-3)*(x-4)
+      add           GR_ad_Ce7 = 16,GR_ad_Co7
+}
+{ .mfi
+      ldfe          FR_C30 = [GR_ad_Co],32
+      fma.s1        FR_Rq3 = FR_Rq3,FR_6,FR_X2pX // (x-5)*(x-6)
+      nop.i         0 
+};;
+{ .mfi
+      ldfe          FR_C40 = [GR_ad_Ce],32
+      fma.s1        FR_Rq4 = FR_Rq4,FR_8,FR_X2pX // (x-7)*(x-8)
+(p14) cmp.leu.unc   p7,p0 = GR_0x30033,GR_Sign_Exp
+}
+{ .mfb
+      ldfe          FR_C50 = [GR_ad_Co7],32
+      fma.s1        FR_Rq5 = FR_Rq5,FR_10,FR_X2pX // (x-9)*(x-10)
+      // jump if x is less or equal to -2^52, i.e. x is big negative integer
+(p7)  br.cond.spnt  tgamma_singularity
+};;
+{ .mfi
+      ldfe          FR_C60 = [GR_ad_Ce7],32
+      fma.s1        FR_C01 = FR_C01,f1,FR_r
+      add           GR_ad_Ce = 0x560,GR_ad_Data
+}
+{ .mfi
+      ldfe          FR_C70 = [GR_ad_Co7],32
+      fma.s1        FR_rs = f0,f0,FR_r // reduced arg for sin(pi*x)  
+      add           GR_ad_Co = 0x550,GR_ad_Data
+};;
+{ .mfi
+      ldfe          FR_C80 = [GR_ad_Ce7],32
+      fma.s1        FR_C11 = FR_C11,f1,FR_r
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_C90 = [GR_ad_Co7],32
+      fma.s1        FR_C21 = FR_C21,f1,FR_r
+      nop.i         0
+};;
+.pred.rel "mutex",p12,p13
+{ .mfi
+(p13) getf.sig      GR_iSig = FR_iXt
+      fcmp.lt.s1    p11,p0 = FR_05,FR_r
+      mov           GR_185 = 185
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Rq6 = FR_Rq6,FR_12,FR_X2pX // (x-11)*(x-12)
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_CA0 = [GR_ad_Ce7],32
+      fma.s1        FR_C31 = FR_C31,f1,FR_r
+(p12) mov           GR_iSig = 0
+}
+{ .mfi
+      ldfe          FR_An = [GR_ad_Co7],0x80
+      fma.s1        FR_C41 = FR_C41,f1,FR_r
+      nop.i         0
+};;
+{ .mfi
+(p14) getf.sig      GR_Sig = FR_r
+      fma.s1        FR_C51 = FR_C51,f1,FR_r
+(p14) sub           GR_iSig = r0,GR_iSig
+}
+{ .mfi
+      ldfe          FR_S21 = [GR_ad_Co],32
+      fma.s1        FR_C61 = FR_C61,f1,FR_r
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_S19 = [GR_ad_Ce],32
+      fma.s1        FR_C71 = FR_C71,f1,FR_r
+      and           GR_SigRqLin = 0xF,GR_iSig
+}
+{ .mfi
+      ldfe          FR_S17 = [GR_ad_Co],32
+      fma.s1        FR_C81 = FR_C81,f1,FR_r
+      mov           GR_2 = 2
+};;
+{ .mfi
+(p14) ldfe          FR_InvAn = [GR_ad_Co7]
+      fma.s1        FR_C91 = FR_C91,f1,FR_r
+      // if significand of r is 0 tnan argument is negative integer
+(p14) cmp.eq.unc    p12,p0 = r0,GR_Sig
+}
+{ .mfb
+(p8)  sub           GR_SigRqLin = GR_SigRqLin,GR_2 // subtract 2 if 2 <= x < 16
+      fma.s1        FR_CA1 = FR_CA1,f1,FR_r
+      // jump if x is negative integer such that -2^52 < x < -185
+(p12) br.cond.spnt  tgamma_singularity
+};;
+{ .mfi
+      setf.sig      FR_Xt = GR_SigRqLin
+(p11) fms.s1        FR_rs = f1,f1,FR_r
+(p14) cmp.ltu.unc   p7,p0 = GR_185,GR_iSig
+}
+{ .mfb
+      ldfe          FR_S15 = [GR_ad_Ce],32
+      fma.s1        FR_Rq7 = FR_Rq7,FR_14,FR_X2pX // (x-13)*(x-14)
+      // jump if x is noninteger such that -2^52 < x < -185
+(p7)  br.cond.spnt  tgamma_underflow
+};;
+{ .mfi
+      ldfe          FR_S13 = [GR_ad_Co],48
+      fma.s1        FR_C01 = FR_C01,FR_r,FR_C00
+      and           GR_Sig2 = 0xE,GR_SigRqLin
+}
+{ .mfi
+      ldfe          FR_S11 = [GR_ad_Ce],48
+      fma.s1        FR_C11 = FR_C11,FR_r,FR_C10
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_S9 = [GR_ad_Co],32
+      fma.s1        FR_C21 = FR_C21,FR_r,FR_C20
+      // should we mul by polynomial of recursion?
+      cmp.eq        p13,p12 = r0,GR_SigRqLin
+}
+{ .mfi
+      ldfe          FR_S7 = [GR_ad_Ce],32
+      fma.s1        FR_C31 = FR_C31,FR_r,FR_C30
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_S5 = [GR_ad_Co],32
+      fma.s1        FR_C41 = FR_C41,FR_r,FR_C40
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_S3 = [GR_ad_Ce],32
+      fma.s1        FR_C51 = FR_C51,FR_r,FR_C50
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C61 = FR_C61,FR_r,FR_C60
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C71 = FR_C71,FR_r,FR_C70
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C81 = FR_C81,FR_r,FR_C80
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C91 = FR_C91,FR_r,FR_C90
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_CA1 = FR_CA1,FR_r,FR_CA0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C01 = FR_C01,FR_C11,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C21 = FR_C21,FR_C31,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rs2 = FR_rs,FR_rs,f0
+(p12) cmp.lt.unc    p7,p0 = 2,GR_Sig2 // should mul by FR_Rq2?
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C41 = FR_C41,FR_C51,f0
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0
+(p7)  fma.s1        FR_Rq1 = FR_Rq1,FR_Rq2,f0
+(p12) cmp.lt.unc    p9,p0 = 6,GR_Sig2 // should mul by FR_Rq4?
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C61 = FR_C61,FR_C71,f0
+(p15) cmp.eq        p11,p0 = r0,r0
+}
+{ .mfi
+      nop.m         0
+(p9)  fma.s1        FR_Rq3 = FR_Rq3,FR_Rq4,f0
+(p12) cmp.lt.unc    p8,p0 = 10,GR_Sig2 // should mul by FR_Rq6?
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C81 = FR_C81,FR_C91,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p8)  fma.s1        FR_Rq5 = FR_Rq5,FR_Rq6,f0
+(p14) cmp.ltu       p0,p11 = 0x9,GR_Tbl_Ind
+};;
+{ .mfi
+      nop.m         0 
+      fcvt.xf       FR_RqLin = FR_Xt  
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p11) fma.s1        FR_CA1 = FR_CA1,FR_An,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S21 = FR_S21,FR_rs2,FR_S19
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S17 = FR_S17,FR_rs2,FR_S15
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C01 = FR_C01,FR_C21,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_rs4 = FR_rs2,FR_rs2,f0
+(p12) cmp.lt.unc    p8,p0 = 4,GR_Sig2 // should mul by FR_Rq3?
+};;
+{ .mfi
+      nop.m         0
+(p8)  fma.s1        FR_Rq1 = FR_Rq1,FR_Rq3,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S13 = FR_S13,FR_rs2,FR_S11
+(p12) cmp.lt.unc    p9,p0 = 12,GR_Sig2 // should mul by FR_Rq7?
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C41 = FR_C41,FR_C61,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0 
+(p9)  fma.s1        FR_Rq5 = FR_Rq5,FR_Rq7,f0
+      nop.i         0 
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C81 = FR_C81,FR_CA1,f0
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S9 = FR_S9,FR_rs2,FR_S7
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S5 = FR_S5,FR_rs2,FR_S3
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rs3 = FR_rs2,FR_rs,f0
+(p12) tbit.nz.unc   p6,p0 = GR_SigRqLin,0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rs8 = FR_rs4,FR_rs4,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S21 = FR_S21,FR_rs4,FR_S17
+      mov           GR_ExpOf1 = 0x2FFFF
+}
+{ .mfi
+      nop.m         0 
+(p6)  fms.s1        FR_RqLin = FR_AbsX,f1,FR_RqLin
+(p12) cmp.lt.unc    p8,p0 = 8,GR_Sig2 // should mul by FR_Rq5?
+};;
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_C01 = FR_C01,FR_C41,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p8)  fma.s1        FR_Rq1 = FR_Rq1,FR_Rq5,f0
+(p14) cmp.gtu.unc   p7,p0 = GR_Sign_Exp,GR_ExpOf1
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S13 = FR_S13,FR_rs4,FR_S9
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p7)  fma.s1        FR_C81 = FR_C81,FR_AbsX,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_AbsXp1 = f1,f1,FR_AbsX // |x|+1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fcmp.lt.unc.s1 p0,p10 = FR_AbsX,FR_OvfBound // x >= overflow_boundary 
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_rs7 = FR_rs4,FR_rs3,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S5 = FR_S5,FR_rs3,FR_rs
+      nop.i         0
+};;
+{ .mib
+(p14) cmp.lt        p13,p0 = r0,r0 // set p13 to 0 if x < 0
+(p12) cmp.eq.unc    p8,p9 = 1,GR_SigRqLin
+(p10) br.cond.spnt  tgamma_spec_res
+};;
+{ .mfi
+      getf.sig      GR_Sig = FR_iXt
+(p6)  fma.s1        FR_Rq1 = FR_Rq1,FR_RqLin,f0
+      // should we mul by polynomial of recursion?
+(p15) cmp.eq.unc    p0,p11 = r0,GR_SigRqLin
+}
+{ .mfb
+      nop.m         0 
+      fma.s1        FR_GAMMA = FR_C01,FR_C81,f0
+(p11) br.cond.spnt  tgamma_positives
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S21 = FR_S21,FR_rs8,FR_S13
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p13) fma.d.s0      f8 = FR_C01,FR_C81,f0
+(p13) br.ret.spnt   b0
+};;
+.pred.rel "mutex",p8,p9
+{ .mfi
+      nop.m         0 
+(p9)  fma.s1        FR_GAMMA = FR_GAMMA,FR_Rq1,f0
+      tbit.z        p6,p7 = GR_Sig,0 // p6 if sin<0, p7 if sin>0
+}
+{ .mfi
+      nop.m         0 
+(p8)  fma.s1        FR_GAMMA = FR_GAMMA,FR_RqLin,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_S21 = FR_S21,FR_rs7,FR_S5
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0 
+(p6)  fnma.s1       FR_GAMMA = FR_GAMMA,FR_S21,f0 
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0 
+(p7)  fma.s1        FR_GAMMA = FR_GAMMA,FR_S21,f0
+      mov           GR_Sig2 = 1
+};;
+{ .mfi
+      nop.m         0
+      frcpa.s1      FR_Rcp0,p0 = f1,FR_GAMMA
+      cmp.ltu       p13,p0 = GR_Sign_Exp,GR_ExpOf1
+};;
+// NR method: ineration #1
+{ .mfi
+(p13) getf.exp      GR_Sign_Exp = FR_AbsX
+      fnma.s1       FR_Rcp1 = FR_Rcp0,FR_GAMMA,f1 // t = 1 - r0*x
+(p13) shl           GR_Sig2 = GR_Sig2,63
+};;
+{ .mfi
+(p13) getf.sig      GR_Sig = FR_AbsX
+      nop.f         0
+(p13) mov           GR_NzOvfBound = 0xFBFF
+};;
+{ .mfi
+(p13) cmp.ltu.unc   p8,p0 = GR_Sign_Exp,GR_NzOvfBound // p8 <- overflow
+      nop.f         0
+(p13) cmp.eq.unc    p9,p0 = GR_Sign_Exp,GR_NzOvfBound
+};;
+{ .mfb
+      nop.m         0
+(p13) fma.d.s0      FR_X = f1,f1,f8 // set deno & inexact flags
+(p8)  br.cond.spnt  tgamma_ovf_near_0 //tgamma_neg_overflow
+};;
+{ .mib
+      nop.m         0
+(p9)  cmp.eq.unc    p8,p0 = GR_Sig,GR_Sig2
+(p8)  br.cond.spnt  tgamma_ovf_near_0_boundary //tgamma_neg_overflow
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Rcp1 = FR_Rcp0,FR_Rcp1,FR_Rcp0
+      nop.i         0 
+};;
+// NR method: ineration #2
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_Rcp2 = FR_Rcp1,FR_GAMMA,f1 // t = 1 - r1*x
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_Rcp2 = FR_Rcp1,FR_Rcp2,FR_Rcp1
+      nop.i         0
+};;
+// NR method: ineration #3
+{ .mfi
+      nop.m         0
+      fnma.s1       FR_Rcp3 = FR_Rcp2,FR_GAMMA,f1 // t = 1 - r2*x
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p13) fma.s1        FR_Rcp2 = FR_Rcp2,FR_AbsXp1,f0
+(p14) cmp.ltu       p10,p11 = 0x9,GR_Tbl_Ind
+};;
+.pred.rel "mutex",p10,p11
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_GAMMA = FR_Rcp2,FR_Rcp3,FR_Rcp2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p11) fma.d.s0      f8 = FR_Rcp2,FR_Rcp3,FR_Rcp2
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+(p10) fma.d.s0      f8 = FR_GAMMA,FR_InvAn,f0
+      br.ret.sptk   b0
+};;
+
+
+// here if x >= 3
+//--------------------------------------------------------------------
+.align 32
+tgamma_positives:
+.pred.rel "mutex",p8,p9
+{ .mfi
+      nop.m         0 
+(p9)  fma.d.s0      f8 = FR_GAMMA,FR_Rq1,f0
+      nop.i         0
+}
+{ .mfb
+      nop.m         0 
+(p8)  fma.d.s0      f8 = FR_GAMMA,FR_RqLin,f0
+      br.ret.sptk   b0
+};;
+
+// here if 0 < x < 1
+//--------------------------------------------------------------------
+.align 32
+tgamma_from_0_to_2:
+{ .mfi
+      getf.exp      GR_Sign_Exp = FR_r02
+      fms.s1        FR_r = FR_r02,f1,FR_Xmin
+      mov           GR_ExpOf025 = 0xFFFD
+}
+{ .mfi
+      add           GR_ad_Co = 0x1200,GR_ad_Data
+(p6)  fnma.s1       FR_Rcp1 = FR_Rcp0,FR_NormX,f1  // t = 1 - r0*x
+(p6)  mov           GR_Sig2 = 1
+};;
+{ .mfi
+(p6)  getf.sig      GR_Sig = FR_NormX
+      nop.f         0 
+(p6)  shl           GR_Sig2 = GR_Sig2,63
+}
+{ .mfi
+      add           GR_ad_Ce = 0x1210,GR_ad_Data
+      nop.f         0
+(p6)  mov           GR_NzOvfBound = 0xFBFF
+};;
+{ .mfi
+      cmp.eq        p8,p0 = GR_Sign_Exp,GR_ExpOf05 // r02 >= 1/2 
+      nop.f         0
+      cmp.eq        p9,p10 = GR_Sign_Exp,GR_ExpOf025 // r02 >= 1/4 
+}
+{ .mfi
+(p6)  cmp.ltu.unc   p11,p0 = GR_Sign_Exp,GR_NzOvfBound // p11 <- overflow
+      nop.f         0
+(p6)  cmp.eq.unc    p12,p0 = GR_Sign_Exp,GR_NzOvfBound
+};;
+.pred.rel "mutex",p8,p9
+{ .mfi
+(p8)  add           GR_ad_Co = 0x200,GR_ad_Co
+(p6)  fma.d.s0      FR_X = f1,f1,f8 // set deno & inexact flags
+(p9)  add           GR_ad_Co = 0x100,GR_ad_Co
+}
+{ .mib
+(p8)  add           GR_ad_Ce = 0x200,GR_ad_Ce
+(p9)  add           GR_ad_Ce = 0x100,GR_ad_Ce
+(p11) br.cond.spnt  tgamma_ovf_near_0 //tgamma_spec_res
+};;
+{ .mfi
+      ldfe          FR_A15 = [GR_ad_Co],32 
+      nop.f         0
+(p12) cmp.eq.unc    p13,p0 = GR_Sig,GR_Sig2
+}
+{ .mfb
+      ldfe          FR_A14 = [GR_ad_Ce],32 
+      nop.f         0
+(p13) br.cond.spnt  tgamma_ovf_near_0_boundary //tgamma_spec_res
+};;
+{ .mfi
+      ldfe          FR_A13 = [GR_ad_Co],32 
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A12 = [GR_ad_Ce],32 
+      nop.f         0
+      nop.i         0
+};;
+.pred.rel "mutex",p9,p10
+{ .mfi
+      ldfe          FR_A11 = [GR_ad_Co],32 
+(p10) fma.s1        FR_r2 = FR_r02,FR_r02,f0 
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A10 = [GR_ad_Ce],32 
+(p9)  fma.s1        FR_r2 = FR_r,FR_r,f0 
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_A9 = [GR_ad_Co],32 
+(p6)  fma.s1        FR_Rcp1 = FR_Rcp0,FR_Rcp1,FR_Rcp0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A8 = [GR_ad_Ce],32 
+(p10) fma.s1        FR_r = f0,f0,FR_r02
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_A7 = [GR_ad_Co],32 
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A6 = [GR_ad_Ce],32 
+      nop.f         0 
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_A5 = [GR_ad_Co],32 
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A4 = [GR_ad_Ce],32 
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_A3 = [GR_ad_Co],32 
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A2 = [GR_ad_Ce],32 
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      ldfe          FR_A1 = [GR_ad_Co],32 
+      fma.s1        FR_r4 = FR_r2,FR_r2,f0 
+      nop.i         0
+}
+{ .mfi
+      ldfe          FR_A0 = [GR_ad_Ce],32 
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p6)  fnma.s1       FR_Rcp2 = FR_Rcp1,FR_NormX,f1 // t = 1 - r1*x
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A15 = FR_A15,FR_r,FR_A14
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A11 = FR_A11,FR_r,FR_A10
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_r8 = FR_r4,FR_r4,f0 
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p6)  fma.s1        FR_Rcp2 = FR_Rcp1,FR_Rcp2,FR_Rcp1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r,FR_A6
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_r,FR_A2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A15 = FR_A15,FR_r,FR_A13
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A11 = FR_A11,FR_r,FR_A9
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p6)  fnma.s1       FR_Rcp3 = FR_Rcp2,FR_NormX,f1 // t = 1 - r1*x
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r,FR_A5
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_r,FR_A1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A15 = FR_A15,FR_r,FR_A12
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A11 = FR_A11,FR_r,FR_A8
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p6)  fma.s1        FR_Rcp3 = FR_Rcp2,FR_Rcp3,FR_Rcp2
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r,FR_A4
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_r,FR_A0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A15 = FR_A15,FR_r4,FR_A11
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r4,FR_A3
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0 
+(p6)  fma.s1        FR_A15 = FR_A15,FR_r8,FR_A7
+      nop.i         0
+}
+{ .mfi
+      nop.m         0 
+(p7)  fma.d.s0      f8 = FR_A15,FR_r8,FR_A7
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0 
+(p6)  fma.d.s0      f8 = FR_A15,FR_Rcp3,f0
+      br.ret.sptk   b0
+};;
+
+// overflow
+//--------------------------------------------------------------------
+.align 32
+tgamma_ovf_near_0_boundary:
+.pred.rel "mutex",p14,p15
+{ .mfi
+	  mov           GR_fpsr = ar.fpsr
+	  nop.f         0
+(p15) mov           r8 = 0x7ff
+}
+{ .mfi
+      nop.m         0
+      nop.f         0
+(p14) mov           r8 = 0xfff
+};;
+{ .mfi
+	  nop.m         0
+	  nop.f         0
+	  shl           r8 = r8,52 
+};;
+{ .mfi
+      sub           r8 = r8,r0,1
+      nop.f         0
+	  extr.u        GR_fpsr = GR_fpsr,10,2 // rounding mode
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      // set p8 to 0 in case of overflow and to 1 otherwise
+	  // for negative arg: 
+	  //    no overflow if rounding mode either Z or +Inf, i.e.
+	  //    GR_fpsr > 1
+(p14) cmp.lt        p8,p0 = 1,GR_fpsr
+      nop.f         0
+	  // for positive arg: 
+	  //    no overflow if rounding mode either Z or -Inf, i.e.
+	  //    (GR_fpsr & 1) == 0
+(p15) tbit.z        p0,p8 = GR_fpsr,0
+};;
+{ .mib
+(p8)  setf.d        f8 = r8 // set result to 0x7fefffffffffffff without
+                            // OVERFLOW flag raising
+      nop.i         0
+(p8)  br.ret.sptk   b0
+};;
+.align 32
+tgamma_ovf_near_0:
+{ .mfi
+      mov           r8 = 0x1FFFE
+      nop.f         0  
+      nop.i         0
+};;
+{ .mfi
+      setf.exp      f9 = r8
+      fmerge.s      FR_X = f8,f8
+      mov           GR_TAG = 258 // overflow
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      nop.m         0 
+(p15) fma.d.s0      f8 = f9,f9,f0 // Set I,O and +INF result
+      nop.i         0 
+}
+{ .mfb
+      nop.m         0 
+(p14) fnma.d.s0     f8 = f9,f9,f0 // Set I,O and -INF result
+      br.cond.sptk  tgamma_libm_err
+};;
+// overflow or absolute value of x is too big
+//--------------------------------------------------------------------
+.align 32
+tgamma_spec_res:
+{ .mfi
+      mov           GR_0x30033 = 0x30033
+(p14) fcmp.eq.unc.s1 p10,p11 = f8,FR_Xt
+(p15) mov           r8 = 0x1FFFE
+};;
+{ .mfi
+(p15) setf.exp      f9 = r8
+      nop.f         0
+      nop.i         0
+};;
+{ .mfb
+(p11) cmp.ltu.unc   p7,p8 = GR_0x30033,GR_Sign_Exp
+      nop.f         0 
+(p10) br.cond.spnt  tgamma_singularity
+};;
+.pred.rel "mutex",p7,p8
+{ .mbb
+      nop.m         0
+(p7)  br.cond.spnt  tgamma_singularity
+(p8)  br.cond.spnt  tgamma_underflow
+};;
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      mov           GR_TAG = 258 // overflow
+}
+{ .mfb
+      nop.m         0 
+(p15) fma.d.s0      f8 = f9,f9,f0 // Set I,O and +INF result
+      br.cond.sptk  tgamma_libm_err
+};;
+
+// x is negative integer or +/-0
+//--------------------------------------------------------------------
+.align 32
+tgamma_singularity:
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      mov           GR_TAG = 259 // negative
+}
+{ .mfb
+      nop.m         0
+      frcpa.s0      f8,p0 = f0,f0
+      br.cond.sptk  tgamma_libm_err
+};;
+// x is negative noninteger with big absolute value
+//--------------------------------------------------------------------
+.align 32
+tgamma_underflow:
+{ .mmi
+      getf.sig      GR_Sig = FR_iXt
+      mov           r11 = 0x00001
+      nop.i         0
+};;
+{ .mfi
+      setf.exp      f9 = r11
+      nop.f         0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      nop.f         0
+      tbit.z        p6,p7 = GR_Sig,0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fms.d.s0      f8 = f9,f9,f9
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p7)  fma.d.s0      f8 = f9,f9,f9
+      br.ret.sptk   b0
+};;
+
+//  x for natval, nan, +/-inf or +/-0
+//--------------------------------------------------------------------
+.align 32
+tgamma_spec:
+{ .mfi
+      nop.m         0
+      fclass.m      p6,p0 =  f8,0x1E1 // Test x for natval, nan, +inf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fclass.m      p7,p8 =  f8,0x7 // +/-0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p6)  fma.d.s0      f8 = f8,f1,f8
+(p6)  br.ret.spnt   b0
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+(p7)  mov           GR_TAG = 259 // negative
+(p7)  frcpa.s0      f8,p0 = f1,f8
+      nop.i         0 
+}
+{ .mib
+      nop.m         0
+      nop.i         0
+(p8)  br.cond.spnt  tgamma_singularity
+};;
+
+.align 32
+tgamma_libm_err:
+{ .mfi
+       alloc        r32 = ar.pfs,1,4,4,0
+       nop.f        0
+       mov          GR_Parameter_TAG = GR_TAG
+};;
+
+GLOBAL_LIBM_END(tgamma)
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfd [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                       // Save b0 
+};;
+.body
+{ .mib
+        stfd [GR_Parameter_X] = FR_X                  // STORE Parameter 1 on stack 
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address 
+        nop.b 0
+}
+{ .mib
+        stfd [GR_Parameter_Y] = FR_RESULT             // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support#         // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfd  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/w_tgammaf.S b/sysdeps/ia64/fpu/w_tgammaf.S
new file mode 100644
index 0000000000..dda0d0fe9d
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_tgammaf.S
@@ -0,0 +1,1331 @@
+.file "tgammaf.s"
+
+
+// Copyright (c) 2001 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2001 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING,BUT NOT 
+// LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,INCIDENTAL,SPECIAL,
+// EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA,OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY,WHETHER IN CONTRACT,STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code,and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+//*********************************************************************
+//
+// History: 
+// 11/30/01  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/10/03  Reordered header: .section, .global, .proc, .align
+// 04/04/03  Changed error codes for overflow and negative integers
+// 04/10/03  Changed code for overflow near zero handling
+// 12/16/03  Fixed parameter passing to/from error handling routine
+// 03/31/05  Reformatted delimiters between data tables
+//
+//*********************************************************************
+//
+//*********************************************************************
+//
+// Function: tgammaf(x) computes the principle value of the GAMMA
+// function of x.
+//
+//*********************************************************************
+//
+// Resources Used:
+//
+//    Floating-Point Registers: f8-f15
+//                              f33-f75
+//
+//    General Purpose Registers:
+//      r8-r11
+//      r14-r29
+//      r32-r36
+//      r37-r40 (Used to pass arguments to error handling routine)
+//
+//    Predicate Registers:      p6-p15
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    tgammaf(+inf) = +inf
+//    tgammaf(-inf) = QNaN 
+//    tgammaf(+/-0) = +/-inf 
+//    tgammaf(x<0, x - integer) = QNaN
+//    tgammaf(SNaN) = QNaN
+//    tgammaf(QNaN) = QNaN
+//
+//*********************************************************************
+//
+// Overview
+//
+// The method consists of three cases.
+// 
+// If       2 <= x < OVERFLOW_BOUNDARY   use case tgamma_regular;
+// else if  0 < x < 2                    use case tgamma_from_0_to_2;
+// else if  -(i+1) <  x < -i, i = 0...43 use case tgamma_negatives;
+//
+// Case 2 <= x < OVERFLOW_BOUNDARY
+// -------------------------------
+//   Here we use algorithm based on the recursive formula
+//   GAMMA(x+1) = x*GAMMA(x). For that we subdivide interval
+//   [2; OVERFLOW_BOUNDARY] into intervals [8*n; 8*(n+1)] and
+//   approximate GAMMA(x) by polynomial of 22th degree on each
+//   [8*n; 8*n+1], recursive formula is used to expand GAMMA(x)
+//   to [8*n; 8*n+1]. In other words we need to find n, i and r
+//   such that x = 8 * n + i + r where n and i are integer numbers
+//   and r is fractional part of x. So GAMMA(x) = GAMMA(8*n+i+r) =
+//   = (x-1)*(x-2)*...*(x-i)*GAMMA(x-i) =
+//   = (x-1)*(x-2)*...*(x-i)*GAMMA(8*n+r) ~
+//   ~ (x-1)*(x-2)*...*(x-i)*P12n(r).
+//
+//   Step 1: Reduction
+//   -----------------
+//    N = [x] with truncate
+//    r = x - N, note 0 <= r < 1
+//
+//    n = N & ~0xF - index of table that contains coefficient of
+//                   polynomial approximation 
+//    i = N & 0xF  - is used in recursive formula
+//   
+//
+//   Step 2: Approximation
+//   ---------------------
+//    We use factorized minimax approximation polynomials
+//    P12n(r) = A12*(r^2+C01(n)*r+C00(n))*
+//              *(r^2+C11(n)*r+C10(n))*...*(r^2+C51(n)*r+C50(n))
+//
+//   Step 3: Recursion
+//   -----------------
+//    In case when i > 0 we need to multiply P12n(r) by product
+//    R(i,x)=(x-1)*(x-2)*...*(x-i). To reduce number of fp-instructions
+//    we can calculate R as follow:  
+//    R(i,x) = ((x-1)*(x-2))*((x-3)*(x-4))*...*((x-(i-1))*(x-i)) if i is
+//    even or R = ((x-1)*(x-2))*((x-3)*(x-4))*...*((x-(i-2))*(x-(i-1)))*
+//    *(i-1) if i is odd. In both cases we need to calculate
+//    R2(i,x) = (x^2-3*x+2)*(x^2-7*x+12)*...*(x^2+x+2*j*(2*j-1)) =
+//    = ((x^2-x)+2*(1-x))*((x^2-x)+6*(2-x))*...*((x^2-x)+2*(2*j-1)*(j-x)) =
+//    = (RA+2*RB)*(RA+6*(1-RB))*...*(RA+2*(2*j-1)*(j-1+RB))
+//    where j = 1..[i/2], RA = x^2-x, RB = 1-x.
+//
+//   Step 4: Reconstruction
+//   ----------------------
+//    Reconstruction is just simple multiplication i.e.
+//    GAMMA(x) = P12n(r)*R(i,x)
+//
+// Case 0 < x < 2
+// --------------
+//    To calculate GAMMA(x) on this interval we do following
+//        if 1.0  <= x < 1.25  than  GAMMA(x) = P7(x-1)
+//        if 1.25 <= x < 1.5   than  GAMMA(x) = P7(x-x_min) where
+//              x_min is point of local minimum on [1; 2] interval.
+//        if 1.5  <= x < 1.75  than  GAMMA(x) = P7(x-1.5)
+//        if 1.75 <= x < 2.0   than  GAMMA(x) = P7(x-1.5)
+//    and      
+//        if 0 < x < 1 than GAMMA(x) = GAMMA(x+1)/x
+//
+// Case -(i+1) <  x < -i, i = 0...43
+// ----------------------------------
+//    Here we use the fact that GAMMA(-x) = PI/(x*GAMMA(x)*sin(PI*x)) and
+//    so we need to calculate GAMMA(x), sin(PI*x)/PI. Calculation of
+//    GAMMA(x) is described above.
+//
+//   Step 1: Reduction
+//   -----------------
+//    Note that period of sin(PI*x) is 2 and range reduction for 
+//    sin(PI*x) is like to range reduction for GAMMA(x) 
+//    i.e rs = x - round(x) and |rs| <= 0.5.
+//
+//   Step 2: Approximation
+//   ---------------------
+//    To approximate sin(PI*x)/PI = sin(PI*(2*n+rs))/PI = 
+//    = (-1)^n*sin(PI*rs)/PI Taylor series is used.
+//    sin(PI*rs)/PI ~ S17(rs).
+//
+//   Step 3: Division
+//   ----------------
+//    To calculate 1/x and 1/(GAMMA(x)*S12(rs)) we use frcpa
+//    instruction with following Newton-Raphson interations.
+//  
+//
+//*********************************************************************
+
+GR_ad_Data              = r8
+GR_TAG                  = r8
+GR_SignExp              = r9
+GR_Sig                  = r10
+GR_ArgNz                = r10
+GR_RqDeg                = r11
+
+GR_NanBound             = r14
+GR_ExpOf025             = r15
+GR_ExpOf05              = r16
+GR_ad_Co                = r17
+GR_ad_Ce                = r18
+GR_TblOffs              = r19
+GR_Arg                  = r20
+GR_Exp2Ind              = r21
+GR_TblOffsMask          = r21
+GR_Offs                 = r22
+GR_OvfNzBound           = r23
+GR_ZeroResBound         = r24
+GR_ad_SinO              = r25
+GR_ad_SinE              = r26
+GR_Correction           = r27
+GR_Tbl12Offs            = r28
+GR_NzBound              = r28
+GR_ExpOf1               = r29
+GR_fpsr                 = r29
+
+GR_SAVE_B0              = r33
+GR_SAVE_PFS             = r34
+GR_SAVE_GP              = r35
+GR_SAVE_SP              = r36
+
+GR_Parameter_X          = r37
+GR_Parameter_Y          = r38
+GR_Parameter_RESULT     = r39
+GR_Parameter_TAG        = r40
+
+
+FR_X                    = f10
+FR_Y                    = f1
+FR_RESULT               = f8
+
+FR_iXt                  = f11 
+FR_Xt                   = f12
+FR_r                    = f13
+FR_r2                   = f14
+FR_r4                   = f15
+
+FR_C01                  = f33
+FR_A7                   = f33
+FR_C11                  = f34
+FR_A6                   = f34
+FR_C21                  = f35
+FR_A5                   = f35
+FR_C31                  = f36
+FR_A4                   = f36
+FR_C41                  = f37
+FR_A3                   = f37
+FR_C51                  = f38
+FR_A2                   = f38
+
+FR_C00                  = f39
+FR_A1                   = f39
+FR_C10                  = f40
+FR_A0                   = f40
+FR_C20                  = f41
+FR_C30                  = f42
+FR_C40                  = f43
+FR_C50                  = f44
+FR_An                   = f45
+FR_OvfBound             = f46
+FR_InvAn                = f47
+
+FR_Multplr              = f48
+FR_NormX                = f49
+FR_X2mX                 = f50
+FR_1mX                  = f51
+FR_Rq0                  = f51
+FR_Rq1                  = f52
+FR_Rq2                  = f53
+FR_Rq3                  = f54
+
+FR_Rcp0                 = f55
+FR_Rcp1                 = f56
+FR_Rcp2                 = f57
+
+FR_InvNormX1            = f58
+FR_InvNormX2            = f59
+
+FR_rs                   = f60
+FR_rs2                  = f61
+
+FR_LocalMin             = f62
+FR_10                   = f63
+
+FR_05                   = f64
+
+FR_S32                  = f65
+FR_S31                  = f66
+FR_S01                  = f67
+FR_S11                  = f68
+FR_S21                  = f69
+FR_S00                  = f70
+FR_S10                  = f71
+FR_S20                  = f72
+
+FR_GAMMA                = f73
+FR_2                    = f74
+FR_6                    = f75
+
+
+
+
+// Data tables
+//==============================================================
+RODATA
+.align 16
+LOCAL_OBJECT_START(tgammaf_data)
+data8 0x3FDD8B618D5AF8FE // local minimum (0.461632144968362356785)
+data8 0x4024000000000000 // 10.0
+data8 0x3E90FC992FF39E13 // S32
+data8 0xBEC144B2760626E2 // S31
+//
+//[2; 8)
+data8 0x4009EFD1BA0CB3B4 // C01
+data8 0x3FFFB35378FF4822 // C11
+data8 0xC01032270413B896 // C41
+data8 0xC01F171A4C0D6827 // C51
+data8 0x40148F8E197396AC // C20
+data8 0x401C601959F1249C // C30
+data8 0x3EE21AD881741977 // An
+data8 0x4041852200000000 // overflow boundary (35.04010009765625)
+data8 0x3FD9CE68F695B198 // C21
+data8 0xBFF8C30AC900DA03 // C31
+data8 0x400E17D2F0535C02 // C00
+data8 0x4010689240F7FAC8 // C10
+data8 0x402563147DDCCF8D // C40
+data8 0x4033406D0480A21C // C50
+//
+//[8; 16)
+data8 0x4006222BAE0B793B // C01
+data8 0x4002452733473EDA // C11
+data8 0xC0010EF3326FDDB3 // C41
+data8 0xC01492B817F99C0F // C51
+data8 0x40099C905A249B75 // C20
+data8 0x4012B972AE0E533D // C30
+data8 0x3FE6F6DB91D0D4CC // An
+data8 0x4041852200000000 // overflow boundary
+data8 0x3FF545828F7B73C5 // C21
+data8 0xBFBBD210578764DF // C31
+data8 0x4000542098F53CFC // C00
+data8 0x40032C1309AD6C81 // C10
+data8 0x401D7331E19BD2E1 // C40
+data8 0x402A06807295EF57 // C50
+//
+//[16; 24)
+data8 0x4000131002867596 // C01
+data8 0x3FFAA362D5D1B6F2 // C11
+data8 0xBFFCB6985697DB6D // C41
+data8 0xC0115BEE3BFC3B3B // C51
+data8 0x3FFE62FF83456F73 // C20
+data8 0x4007E33478A114C4 // C30
+data8 0x41E9B2B73795ED57 // An
+data8 0x4041852200000000 // overflow boundary
+data8 0x3FEEB1F345BC2769 // C21
+data8 0xBFC3BBE6E7F3316F // C31
+data8 0x3FF14E07DA5E9983 // C00
+data8 0x3FF53B76BF81E2C0 // C10
+data8 0x4014051E0269A3DC // C40
+data8 0x40229D4227468EDB // C50
+//
+//[24; 32)
+data8 0x3FFAF7BD498384DE // C01
+data8 0x3FF62AD8B4D1C3D2 // C11
+data8 0xBFFABCADCD004C32 // C41
+data8 0xC00FADE97C097EC9 // C51
+data8 0x3FF6DA9ED737707E // C20
+data8 0x4002A29E9E0C782C // C30
+data8 0x44329D5B5167C6C3 // An
+data8 0x4041852200000000 // overflow boundary
+data8 0x3FE8943CBBB4B727 // C21
+data8 0xBFCB39D466E11756 // C31
+data8 0x3FE879AF3243D8C1 // C00
+data8 0x3FEEC7DEBB14CE1E // C10
+data8 0x401017B79BA80BCB // C40
+data8 0x401E941DC3C4DE80 // C50
+//
+//[32; 40)
+data8 0x3FF7ECB3A0E8FE5C // C01
+data8 0x3FF3815A8516316B // C11
+data8 0xBFF9ABD8FCC000C3 // C41
+data8 0xC00DD89969A4195B // C51
+data8 0x3FF2E43139CBF563 // C20
+data8 0x3FFF96DC3474A606 // C30
+data8 0x46AFF4CA9B0DDDF0 // An
+data8 0x4041852200000000 // overflow boundary
+data8 0x3FE4CE76DA1B5783 // C21
+data8 0xBFD0524DB460BC4E // C31
+data8 0x3FE35852DF14E200 // C00
+data8 0x3FE8C7610359F642 // C10
+data8 0x400BCF750EC16173 // C40
+data8 0x401AC14E02EA701C // C50
+//
+//[40; 48)
+data8 0x3FF5DCE4D8193097 // C01
+data8 0x3FF1B0D8C4974FFA // C11
+data8 0xBFF8FB450194CAEA // C41
+data8 0xC00C9658E030A6C4 // C51
+data8 0x3FF068851118AB46 // C20
+data8 0x3FFBF7C7BB46BF7D // C30
+data8 0x3FF0000000000000 // An
+data8 0x4041852200000000 // overflow boundary
+data8 0x3FE231DEB11D847A // C21
+data8 0xBFD251ECAFD7E935 // C31
+data8 0x3FE0368AE288F6BF // C00
+data8 0x3FE513AE4215A70C // C10
+data8 0x4008F960F7141B8B // C40
+data8 0x40183BA08134397B // C50
+//
+//[1.0; 1.25)
+data8 0xBFD9909648921868 // A7
+data8 0x3FE96FFEEEA8520F // A6
+data8 0xBFED0800D93449B8 // A3
+data8 0x3FEFA648D144911C // A2
+data8 0xBFEE3720F7720B4D // A5
+data8 0x3FEF4857A010CA3B // A4
+data8 0xBFE2788CCD545AA4 // A1
+data8 0x3FEFFFFFFFE9209E // A0
+//
+//[1.25; 1.5)
+data8 0xBFB421236426936C // A7
+data8 0x3FAF237514F36691 // A6
+data8 0xBFC0BADE710A10B9 // A3
+data8 0x3FDB6C5465BBEF1F // A2
+data8 0xBFB7E7F83A546EBE // A5
+data8 0x3FC496A01A545163 // A4
+data8 0xBDEE86A39D8452EB // A1
+data8 0x3FEC56DC82A39AA2 // A0
+//
+//[1.5; 1.75)
+data8 0xBF94730B51795867 // A7
+data8 0x3FBF4203E3816C7B // A6
+data8 0xBFE85B427DBD23E4 // A3
+data8 0x3FEE65557AB26771 // A2
+data8 0xBFD59D31BE3AB42A // A5
+data8 0x3FE3C90CC8F09147 // A4
+data8 0xBFE245971DF735B8 // A1
+data8 0x3FEFFC613AE7FBC8 // A0
+//
+//[1.75; 2.0)
+data8 0xBF7746A85137617E // A7
+data8 0x3FA96E37D09735F3 // A6
+data8 0xBFE3C24AC40AC0BB // A3
+data8 0x3FEC56A80A977CA5 // A2
+data8 0xBFC6F0E707560916 // A5
+data8 0x3FDB262D949175BE // A4
+data8 0xBFE1C1AEDFB25495 // A1
+data8 0x3FEFEE1E644B2022 // A0
+//
+// sin(pi*x)/pi
+data8 0xC026FB0D377656CC // S01
+data8 0x3FFFB15F95A22324 // S11
+data8 0x406CE58F4A41C6E7 // S10
+data8 0x404453786302C61E // S20
+data8 0xC023D59A47DBFCD3 // S21
+data8 0x405541D7ABECEFCA // S00
+//
+// 1/An for [40; 48)
+data8 0xCAA7576DE621FCD5, 0x3F68
+LOCAL_OBJECT_END(tgammaf_data)
+
+//==============================================================
+// Code
+//==============================================================
+
+.section .text
+GLOBAL_LIBM_ENTRY(tgammaf)
+{ .mfi
+      getf.exp      GR_SignExp = f8
+      fma.s1        FR_NormX = f8,f1,f0
+      addl          GR_ad_Data = @ltoff(tgammaf_data), gp
+}
+{ .mfi
+      mov           GR_ExpOf05 = 0xFFFE
+      fcvt.fx.trunc.s1 FR_iXt = f8 // [x]
+      mov           GR_Offs = 0 // 2 <= x < 8
+};;
+{ .mfi
+      getf.d        GR_Arg = f8
+      fcmp.lt.s1    p14,p15 = f8,f0
+      mov           GR_Tbl12Offs = 0
+}
+{ .mfi
+      setf.exp      FR_05 = GR_ExpOf05
+      fma.s1        FR_2 = f1,f1,f1 // 2
+      mov           GR_Correction = 0
+};;
+{ .mfi
+      ld8           GR_ad_Data = [GR_ad_Data]
+      fclass.m      p10,p0 = f8,0x1E7 // is x  NaTVal, NaN, +/-0 or +/-INF?
+      tbit.z        p12,p13 = GR_SignExp,16 // p13 if |x| >= 2
+}
+{ .mfi
+      mov           GR_ExpOf1 = 0xFFFF
+      fcvt.fx.s1    FR_rs = f8 // round(x)
+      and           GR_Exp2Ind = 7,GR_SignExp
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+(p15) cmp.eq.unc    p11,p0 = GR_ExpOf1,GR_SignExp // p11 if 1 <= x < 2
+(p14) fma.s1        FR_1mX = f1,f1,f8 // 1 - |x|
+      mov           GR_Sig = 0 // if |x| < 2
+}
+{ .mfi
+(p13) cmp.eq.unc    p7,p0 = 2,GR_Exp2Ind
+(p15) fms.s1        FR_1mX = f1,f1,f8 // 1 - |x|
+(p13) cmp.eq.unc    p8,p0 = 3,GR_Exp2Ind
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+(p7)  mov           GR_Offs = 0x7    // 8 <= |x| < 16
+      nop.f         0
+(p8)  tbit.z.unc    p0,p6 = GR_Arg,51
+}
+{ .mib
+(p13) cmp.lt.unc    p9,p0 = 3,GR_Exp2Ind
+(p8)  mov           GR_Offs = 0xE // 16 <= |x| < 32
+      // jump if x is NaTVal, NaN, +/-0 or +/-INF?
+(p10) br.cond.spnt  tgammaf_spec_args
+};;
+.pred.rel "mutex",p14,p15
+.pred.rel "mutex",p6,p9
+{ .mfi
+(p9)  mov           GR_Offs = 0x1C // 32 <= |x|
+(p14) fma.s1        FR_X2mX = FR_NormX,FR_NormX,FR_NormX // x^2-|x|
+(p9)  tbit.z.unc    p0,p8 = GR_Arg,50
+}
+{ .mfi
+      ldfpd         FR_LocalMin,FR_10 = [GR_ad_Data],16
+(p15) fms.s1        FR_X2mX = FR_NormX,FR_NormX,FR_NormX // x^2-|x|
+(p6)  add           GR_Offs = 0x7,GR_Offs // 24 <= x < 32
+};;
+.pred.rel "mutex",p8,p12
+{ .mfi
+      add           GR_ad_Ce = 0x50,GR_ad_Data
+(p15) fcmp.lt.unc.s1 p10,p0 = f8,f1 // p10 if 0 <= x < 1
+      mov           GR_OvfNzBound = 2
+}
+{ .mib
+      ldfpd         FR_S32,FR_S31 = [GR_ad_Data],16
+(p8)  add           GR_Offs = 0x7,GR_Offs // 40 <= |x|
+      // jump if 1 <= x < 2
+(p11) br.cond.spnt  tgammaf_from_1_to_2
+};;
+{ .mfi
+      shladd        GR_ad_Ce = GR_Offs,4,GR_ad_Ce
+      fcvt.xf       FR_Xt = FR_iXt // [x]
+(p13) cmp.eq.unc    p7,p0 = r0,GR_Offs // p7 if 2 <= |x| < 8
+}
+{ .mfi
+      shladd        GR_ad_Co = GR_Offs,4,GR_ad_Data
+      fma.s1        FR_6 = FR_2,FR_2,FR_2
+      mov           GR_ExpOf05 = 0x7FC
+};;
+{ .mfi
+(p13) getf.sig      GR_Sig = FR_iXt // if |x| >= 2
+      frcpa.s1      FR_Rcp0,p0 = f1,FR_NormX
+(p10) shr           GR_Arg = GR_Arg,51
+}
+{ .mib
+      ldfpd         FR_C01,FR_C11 = [GR_ad_Co],16
+(p7)  mov           GR_Correction = 2
+      // jump if 0 < x < 1
+(p10) br.cond.spnt  tgammaf_from_0_to_1
+};;
+{ .mfi
+      ldfpd         FR_C21,FR_C31 = [GR_ad_Ce],16
+      fma.s1        FR_Rq2 = f1,f1,FR_1mX // 2 - |x|
+(p14) sub           GR_Correction = r0,GR_Correction
+}
+{ .mfi
+      ldfpd         FR_C41,FR_C51 = [GR_ad_Co],16
+(p14) fcvt.xf       FR_rs = FR_rs
+(p14) add           GR_ad_SinO = 0x3A0,GR_ad_Data
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      ldfpd         FR_C00,FR_C10 = [GR_ad_Ce],16
+      nop.f         0
+(p14) sub           GR_Sig = GR_Correction,GR_Sig
+}
+{ .mfi
+      ldfpd         FR_C20,FR_C30 = [GR_ad_Co],16
+      fma.s1        FR_Rq1 = FR_1mX,FR_2,FR_X2mX // (x-1)*(x-2)
+(p15) sub           GR_Sig = GR_Sig,GR_Correction
+};;
+{ .mfi
+(p14) ldfpd         FR_S01,FR_S11 = [GR_ad_SinO],16
+      fma.s1        FR_Rq3 = FR_2,f1,FR_1mX // 3 - |x|
+      and           GR_RqDeg = 0x6,GR_Sig
+}
+{ .mfi
+      ldfpd         FR_C40,FR_C50 = [GR_ad_Ce],16
+(p14) fma.d.s0      FR_X = f0,f0,f8 // set deno flag
+      mov           GR_NanBound = 0x30016 // -2^23
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+(p14) add           GR_ad_SinE = 0x3C0,GR_ad_Data
+(p15) fms.s1        FR_r = FR_NormX,f1,FR_Xt // r = x - [x]
+      cmp.eq        p8,p0 = 2,GR_RqDeg
+}
+{ .mfi
+      ldfpd         FR_An,FR_OvfBound = [GR_ad_Co]
+(p14) fms.s1        FR_r = FR_Xt,f1,FR_NormX // r = |x - [x]|
+      cmp.eq        p9,p0 = 4,GR_RqDeg
+};;
+.pred.rel "mutex",p8,p9
+{ .mfi
+(p14) ldfpd         FR_S21,FR_S00 = [GR_ad_SinE],16
+(p8)  fma.s1        FR_Rq0 = FR_2,f1,FR_1mX // (3-x)
+      tbit.z        p0,p6 = GR_Sig,0
+}
+{ .mfi
+(p14) ldfpd         FR_S10,FR_S20 = [GR_ad_SinO],16
+(p9)  fma.s1        FR_Rq0 = FR_2,FR_2,FR_1mX // (5-x)
+      cmp.eq        p10,p0 = 6,GR_RqDeg
+};;
+{ .mfi
+(p14) getf.s        GR_Arg = f8
+(p14) fcmp.eq.unc.s1 p13,p0 = FR_NormX,FR_Xt
+(p14) mov           GR_ZeroResBound = 0xC22C // -43
+}
+{ .mfi
+(p14) ldfe          FR_InvAn = [GR_ad_SinE]
+(p10) fma.s1        FR_Rq0 = FR_6,f1,FR_1mX // (7-x)
+      cmp.eq        p7,p0 = r0,GR_RqDeg
+};;
+{ .mfi
+(p14) cmp.ge.unc    p11,p0 = GR_SignExp,GR_NanBound
+      fma.s1        FR_Rq2 = FR_Rq2,FR_6,FR_X2mX // (x-3)*(x-4)
+(p14) shl           GR_ZeroResBound = GR_ZeroResBound,16
+}
+{ .mfb
+(p14) mov           GR_OvfNzBound = 0x802
+(p14) fms.s1        FR_rs = FR_rs,f1,FR_NormX // rs = round(x) - x
+      // jump if  x < -2^23 i.e. x is negative integer
+(p11) br.cond.spnt  tgammaf_singularity
+};;
+{ .mfi
+      nop.m         0
+(p7)  fma.s1        FR_Rq1 = f0,f0,f1
+(p14) shl           GR_OvfNzBound = GR_OvfNzBound,20
+}
+{ .mfb
+      nop.m         0
+      fma.s1        FR_Rq3 = FR_Rq3,FR_10,FR_X2mX // (x-5)*(x-6)
+      // jump if x is negative integer such that -2^23 < x < 0
+(p13) br.cond.spnt  tgammaf_singularity
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C01 = FR_C01,f1,FR_r
+(p14) mov           GR_ExpOf05 = 0xFFFE
+}
+{ .mfi
+(p14) cmp.eq.unc    p7,p0 = GR_Arg,GR_OvfNzBound
+      fma.s1        FR_C11 = FR_C11,f1,FR_r
+(p14) cmp.ltu.unc   p11,p0 = GR_Arg,GR_OvfNzBound
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C21 = FR_C21,f1,FR_r
+(p14) cmp.ltu.unc   p9,p0 = GR_ZeroResBound,GR_Arg
+}
+{ .mfb
+      nop.m         0
+      fma.s1        FR_C31 = FR_C31,f1,FR_r
+      // jump if argument is close to 0 negative
+(p11) br.cond.spnt  tgammaf_overflow
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C41 = FR_C41,f1,FR_r
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+      fma.s1        FR_C51 = FR_C51,f1,FR_r
+      // jump if x is negative noninteger such that -2^23 < x < -43
+(p9)  br.cond.spnt  tgammaf_underflow
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_rs2 = FR_rs,FR_rs,f0
+      nop.i         0 
+}
+{ .mfb
+      nop.m         0
+(p14) fma.s1        FR_S01 = FR_rs,FR_rs,FR_S01
+      // jump if argument is 0x80200000
+(p7)  br.cond.spnt  tgammaf_overflow_near0_bound
+};;
+{ .mfi
+      nop.m         0 
+(p6)  fnma.s1       FR_Rq1 = FR_Rq1,FR_Rq0,f0
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0 
+(p10) fma.s1        FR_Rq2 = FR_Rq2,FR_Rq3,f0
+      and           GR_Sig = 0x7,GR_Sig
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C01 = FR_C01,FR_r,FR_C00
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C11 = FR_C11,FR_r,FR_C10
+      cmp.eq        p6,p7 = r0,GR_Sig // p6 if |x| from one of base intervals
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C21 = FR_C21,FR_r,FR_C20
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C31 = FR_C31,FR_r,FR_C30
+(p7)  cmp.lt.unc    p9,p0 = 2,GR_RqDeg
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S11 = FR_rs,FR_rs,FR_S11
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S21 = FR_rs,FR_rs,FR_S21
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C41 = FR_C41,FR_r,FR_C40
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S32 = FR_rs2,FR_S32,FR_S31
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0 
+(p9)  fma.s1        FR_Rq1 = FR_Rq1,FR_Rq2,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C51 = FR_C51,FR_r,FR_C50
+      nop.i         0 
+};;
+{ .mfi
+(p14) getf.exp      GR_SignExp = FR_rs
+      fma.s1        FR_C01 = FR_C01,FR_C11,f0
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S01 = FR_S01,FR_rs2,FR_S00
+      nop.i         0 
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C21 = FR_C21,FR_C31,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // NR-iteration
+(p14) fnma.s1       FR_InvNormX1 = FR_Rcp0,FR_NormX,f1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S11 = FR_S11,FR_rs2,FR_S10
+(p14) tbit.z.unc    p11,p12 = GR_SignExp,17 
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S21 = FR_S21,FR_rs2,FR_S20
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p15) fcmp.lt.unc.s1 p0,p13 = FR_NormX,FR_OvfBound
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S32 = FR_rs2,FR_S32,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C41 = FR_C41,FR_C51,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p7)  fma.s1        FR_An = FR_Rq1,FR_An,f0
+      nop.i         0 
+};;
+{ .mfb
+      nop.m         0
+      nop.f         0
+      // jump if x > 35.04010009765625
+(p13) br.cond.spnt  tgammaf_overflow
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+(p14) fma.s1        FR_InvNormX1 = FR_Rcp0,FR_InvNormX1,FR_Rcp0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S01 = FR_S01,FR_S11,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+(p14) fma.s1        FR_S21 = FR_S21,FR_S32,f0
+      nop.i         0
+};;
+{ .mfi
+(p14) getf.exp      GR_SignExp = FR_NormX
+      fma.s1        FR_C01 = FR_C01,FR_C21,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_C41 = FR_C41,FR_An,f0
+(p14) mov           GR_ExpOf1 = 0x2FFFF
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+(p14) fnma.s1       FR_InvNormX2 = FR_InvNormX1,FR_NormX,f1
+      nop.i         0
+};;
+.pred.rel "mutex",p11,p12
+{ .mfi
+      nop.m         0
+(p12) fnma.s1       FR_S01 = FR_S01,FR_S21,f0
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p11) fma.s1        FR_S01 = FR_S01,FR_S21,f0
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0 
+(p14) fma.s1        FR_GAMMA = FR_C01,FR_C41,f0
+(p14) tbit.z.unc    p6,p7 = GR_Sig,0
+}
+{ .mfb
+      nop.m         0
+(p15) fma.s.s0      f8 = FR_C01,FR_C41,f0
+(p15) br.ret.spnt   b0 // exit for positives
+};;
+.pred.rel "mutex",p11,p12
+{ .mfi
+      nop.m         0
+(p12) fms.s1        FR_S01 = FR_rs,FR_S01,FR_rs
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p11) fma.s1        FR_S01 = FR_rs,FR_S01,FR_rs
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+      fma.s1        FR_InvNormX2 = FR_InvNormX1,FR_InvNormX2,FR_InvNormX1
+      cmp.eq        p10,p0 = 0x23,GR_Offs
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fma.s1        FR_GAMMA = FR_S01,FR_GAMMA,f0
+      cmp.gtu       p8,p0 = GR_SignExp,GR_ExpOf1
+}
+{ .mfi
+      nop.m         0
+(p7)  fnma.s1       FR_GAMMA = FR_S01,FR_GAMMA,f0
+      cmp.eq        p9,p0 = GR_SignExp,GR_ExpOf1
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+      fnma.s1       FR_InvNormX1 = FR_InvNormX2,FR_NormX,f1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p10) fma.s1        FR_InvNormX2 = FR_InvNormX2,FR_InvAn,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      frcpa.s1      FR_Rcp0,p0 = f1,FR_GAMMA
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_Multplr = FR_NormX,f1,f1 // x - 1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+      fnma.s1       FR_Rcp1 = FR_Rcp0,FR_GAMMA,f1
+      nop.i         0
+};;
+.pred.rel "mutex",p8,p9
+{ .mfi
+      nop.m         0
+      // 1/x or 1/(An*x)
+(p8)  fma.s1        FR_Multplr = FR_InvNormX2,FR_InvNormX1,FR_InvNormX2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p9)  fma.s1        FR_Multplr = f1,f1,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+      fma.s1        FR_Rcp1 = FR_Rcp0,FR_Rcp1,FR_Rcp0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+      fnma.s1       FR_Rcp2 = FR_Rcp1,FR_GAMMA,f1
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      // NR-iteration
+      fma.s1        FR_Rcp1 = FR_Rcp1,FR_Multplr,f0
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0
+      fma.s.s0      f8 = FR_Rcp1,FR_Rcp2,FR_Rcp1
+      br.ret.sptk   b0
+};;
+
+// here if 0 < x < 1
+//--------------------------------------------------------------------
+.align 32
+tgammaf_from_0_to_1:
+{ .mfi
+      cmp.lt        p7,p0 = GR_Arg,GR_ExpOf05
+      // NR-iteration
+      fnma.s1       FR_Rcp1 = FR_Rcp0,FR_NormX,f1
+      cmp.eq        p8,p0 = GR_Arg,GR_ExpOf05
+}
+{ .mfi
+      cmp.gt        p9,p0 = GR_Arg,GR_ExpOf05
+      fma.s1        FR_r = f0,f0,FR_NormX // reduced arg for (0;1)
+      mov           GR_ExpOf025 = 0x7FA       
+};;
+{ .mfi
+      getf.s        GR_ArgNz = f8
+      fma.d.s0      FR_X = f0,f0,f8 // set deno flag
+      shl           GR_OvfNzBound = GR_OvfNzBound,20
+}
+{ .mfi
+(p8)  mov           GR_Tbl12Offs = 0x80 // 0.5 <= x < 0.75
+      nop.f         0
+(p7)  cmp.ge.unc    p6,p0 = GR_Arg,GR_ExpOf025
+};;
+.pred.rel "mutex",p6,p9
+{ .mfi
+(p9)  mov           GR_Tbl12Offs = 0xC0 // 0.75 <= x < 1
+      nop.f         0
+(p6)  mov           GR_Tbl12Offs = 0x40 // 0.25 <= x < 0.5
+}
+{ .mfi
+      add           GR_ad_Ce = 0x2C0,GR_ad_Data      
+      nop.f         0
+      add           GR_ad_Co = 0x2A0,GR_ad_Data
+};;
+{ .mfi
+      add           GR_ad_Co = GR_ad_Co,GR_Tbl12Offs
+      nop.f         0
+      cmp.lt        p12,p0 = GR_ArgNz,GR_OvfNzBound
+}
+{ .mib
+      add           GR_ad_Ce = GR_ad_Ce,GR_Tbl12Offs
+      cmp.eq        p7,p0 = GR_ArgNz,GR_OvfNzBound
+      // jump if argument is 0x00200000
+(p7)  br.cond.spnt  tgammaf_overflow_near0_bound
+};;
+{ .mmb
+      ldfpd         FR_A7,FR_A6 = [GR_ad_Co],16
+      ldfpd         FR_A5,FR_A4 = [GR_ad_Ce],16
+      // jump if argument is close to 0 positive
+(p12) br.cond.spnt  tgammaf_overflow      
+};;
+{ .mfi
+      ldfpd         FR_A3,FR_A2 = [GR_ad_Co],16
+      // NR-iteration
+      fma.s1        FR_Rcp1 = FR_Rcp0,FR_Rcp1,FR_Rcp0
+      nop.i         0
+}
+{ .mfb
+      ldfpd         FR_A1,FR_A0 = [GR_ad_Ce],16
+      nop.f         0
+      br.cond.sptk  tgamma_from_0_to_2 
+};;
+
+// here if 1 < x < 2
+//--------------------------------------------------------------------
+.align 32
+tgammaf_from_1_to_2:
+{ .mfi
+      add           GR_ad_Co = 0x2A0,GR_ad_Data
+      fms.s1        FR_r = f0,f0,FR_1mX
+      shr           GR_TblOffs = GR_Arg,47
+}
+{ .mfi
+      add           GR_ad_Ce = 0x2C0,GR_ad_Data
+      nop.f         0
+      mov           GR_TblOffsMask = 0x18
+};;
+{ .mfi
+      nop.m         0
+      nop.f         0
+      and           GR_TblOffs = GR_TblOffs,GR_TblOffsMask 
+};;
+{ .mfi
+      shladd        GR_ad_Co = GR_TblOffs,3,GR_ad_Co
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      shladd        GR_ad_Ce = GR_TblOffs,3,GR_ad_Ce
+      nop.f         0
+      cmp.eq        p6,p7 = 8,GR_TblOffs
+};;
+{ .mmi
+      ldfpd         FR_A7,FR_A6 = [GR_ad_Co],16
+      ldfpd         FR_A5,FR_A4 = [GR_ad_Ce],16
+      nop.i         0
+};;
+{ .mmi
+      ldfpd         FR_A3,FR_A2 = [GR_ad_Co],16
+      ldfpd         FR_A1,FR_A0 = [GR_ad_Ce],16
+      nop.i         0
+};;
+
+.align 32
+tgamma_from_0_to_2:
+{ .mfi
+      nop.m         0
+(p6)  fms.s1        FR_r = FR_r,f1,FR_LocalMin
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+(p10) fnma.s1       FR_Rcp2 = FR_Rcp1,FR_NormX,f1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fms.s1        FR_r2 = FR_r,FR_r,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r,FR_A6
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A5 = FR_A5,FR_r,FR_A4
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_r,FR_A2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A1 = FR_A1,FR_r,FR_A0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      // NR-iteration
+(p10) fma.s1        FR_Rcp2 = FR_Rcp1,FR_Rcp2,FR_Rcp1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A7 = FR_A7,FR_r2,FR_A5
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_r4 = FR_r2,FR_r2,f0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fma.s1        FR_A3 = FR_A3,FR_r2,FR_A1
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0 
+(p10) fma.s1        FR_GAMMA = FR_A7,FR_r4,FR_A3
+      nop.i         0
+}
+{ .mfi
+      nop.m         0 
+(p11) fma.s.s0      f8 = FR_A7,FR_r4,FR_A3
+      nop.i         0
+};;
+{ .mfb
+      nop.m         0 
+(p10) fma.s.s0      f8 = FR_GAMMA,FR_Rcp2,f0
+      br.ret.sptk   b0
+};;
+
+
+// overflow
+//--------------------------------------------------------------------
+.align 32
+tgammaf_overflow_near0_bound:
+.pred.rel "mutex",p14,p15
+{ .mfi
+	  mov           GR_fpsr = ar.fpsr
+	  nop.f         0
+(p15) mov           r8 = 0x7f8
+}
+{ .mfi
+      nop.m         0
+      nop.f         0
+(p14) mov           r8 = 0xff8
+};;
+{ .mfi
+	  nop.m         0
+	  nop.f         0
+	  shl           r8 = r8,20 
+};;
+{ .mfi
+      sub           r8 = r8,r0,1
+      nop.f         0
+	  extr.u        GR_fpsr = GR_fpsr,10,2 // rounding mode
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      // set p8 to 0 in case of overflow and to 1 otherwise
+	  // for negative arg: 
+	  //    no overflow if rounding mode either Z or +Inf, i.e.
+	  //    GR_fpsr > 1
+(p14) cmp.lt        p8,p0 = 1,GR_fpsr
+      nop.f         0
+	  // for positive arg: 
+	  //    no overflow if rounding mode either Z or -Inf, i.e.
+	  //    (GR_fpsr & 1) == 0
+(p15) tbit.z        p0,p8 = GR_fpsr,0
+};;
+{ .mib
+(p8)  setf.s        f8 = r8 // set result to 0x7f7fffff without
+                            // OVERFLOW flag raising
+      nop.i         0
+(p8)  br.ret.sptk   b0
+};;
+
+.align 32
+tgammaf_overflow:
+{ .mfi
+      nop.m         0
+      nop.f         0
+      mov           r8 = 0x1FFFE
+};;
+{ .mfi
+      setf.exp      f9 = r8
+      fmerge.s      FR_X = f8,f8
+      nop.i         0
+};;
+.pred.rel "mutex",p14,p15
+{ .mfi
+      nop.m         0
+(p14) fnma.s.s0     f8 = f9,f9,f0 // set I,O and -INF result
+      mov           GR_TAG = 261 // overflow
+}
+{ .mfb
+      nop.m         0 
+(p15) fma.s.s0      f8 = f9,f9,f0 // set I,O and +INF result
+      br.cond.sptk  tgammaf_libm_err
+};;
+
+// x is negative integer or +/-0
+//--------------------------------------------------------------------
+.align 32
+tgammaf_singularity:
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      mov           GR_TAG = 262 // negative
+}
+{ .mfb
+      nop.m         0
+      frcpa.s0      f8,p0 = f0,f0
+      br.cond.sptk  tgammaf_libm_err
+};;
+// x is negative noninteger with big absolute value
+//--------------------------------------------------------------------
+.align 32
+tgammaf_underflow:
+{ .mfi
+      mov           r8 = 0x00001
+      nop.f         0
+      tbit.z        p6,p7 = GR_Sig,0
+};;
+{ .mfi
+      setf.exp      f9 = r8
+      nop.f         0
+      nop.i         0
+};;
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fms.s.s0      f8 = f9,f9,f9
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p7)  fma.s.s0      f8 = f9,f9,f9
+      br.ret.sptk   b0
+};;
+
+//  x for natval, nan, +/-inf or +/-0
+//--------------------------------------------------------------------
+.align 32
+tgammaf_spec_args:
+{ .mfi
+      nop.m         0
+      fclass.m      p6,p0 =  f8,0x1E1 // Test x for natval, nan, +inf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fclass.m      p7,p8 =  f8,0x7 // +/-0
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fmerge.s      FR_X = f8,f8
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p6)  fma.s.s0      f8 = f8,f1,f8
+(p6)  br.ret.spnt   b0
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+(p7)  mov           GR_TAG = 262 // negative
+(p7)  frcpa.s0      f8,p0 = f1,f8
+      nop.i         0 
+}
+{ .mib
+      nop.m         0
+      nop.i         0
+(p8)  br.cond.spnt  tgammaf_singularity
+};;
+
+.align 32
+tgammaf_libm_err:
+{ .mfi
+      alloc        r32 = ar.pfs,1,4,4,0
+      nop.f        0
+      mov          GR_Parameter_TAG = GR_TAG
+};;
+
+GLOBAL_LIBM_END(tgammaf)
+
+LOCAL_LIBM_ENTRY(__libm_error_region)
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs 
+}
+{ .mfi
+.fframe 64 
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfs [GR_Parameter_Y] = FR_Y,16         // STORE Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0                      
+        mov GR_SAVE_B0=b0                       // Save b0 
+};;
+.body
+{ .mib
+        stfs [GR_Parameter_X] = FR_X           // STORE Parameter 1 on stack 
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y  // Parameter 3 address 
+        nop.b 0                                      
+}
+{ .mib
+        stfs [GR_Parameter_Y] = FR_RESULT      // STORE Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y  
+        br.call.sptk b0=__libm_error_support# // Call error handling function
+};;
+{ .mmi
+        nop.m 0
+        nop.m 0
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfs  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp 
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};; 
+
+LOCAL_LIBM_END(__libm_error_region)
+.type   __libm_error_support#,@function
+.global __libm_error_support#
+
diff --git a/sysdeps/ia64/fpu/w_tgammal.S b/sysdeps/ia64/fpu/w_tgammal.S
new file mode 100644
index 0000000000..f64e213266
--- /dev/null
+++ b/sysdeps/ia64/fpu/w_tgammal.S
@@ -0,0 +1,4487 @@
+.file "tgammal.s"
+
+
+// Copyright (c) 2002 - 2005, Intel Corporation
+// All rights reserved.
+//
+// Contributed 2002 by the Intel Numerics Group, Intel Corporation
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// * The name of Intel Corporation may not be used to endorse or promote
+// products derived from this software without specific prior written
+// permission.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS 
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
+// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+// 
+// Intel Corporation is the author of this code, and requests that all
+// problem reports or change requests be submitted to it directly at 
+// http://www.intel.com/software/products/opensource/libraries/num.htm.
+//
+// History
+//==============================================================
+// 01/16/02  Initial version
+// 05/20/02  Cleaned up namespace and sf0 syntax
+// 02/10/03  Reordered header: .section, .global, .proc, .align;
+//           used data8 for long double table values
+// 03/17/03  Moved tgammal_libm_err label into .proc region
+// 04/10/03  Changed error codes for overflow and negative integers
+// 03/31/05  Reformatted delimiters between data tables
+//
+// API
+//==============================================================
+// long double tgammal(long double)
+//
+// Resources Used:
+//
+//    Floating-Point Registers:  f8-f15
+//                               f32-f127
+//
+//    General Purpose Registers: r32-r67 
+//
+//    Predicate Registers:       p6-p15
+//
+//*********************************************************************
+//
+// IEEE Special Conditions:
+//
+//    tgammal(+inf) = +inf
+//    tgammal(-inf) = QNaN 
+//    tgammal(+/-0) = +/-inf 
+//    tgammal(x<0, x - integer) = QNaN
+//    tgammal(SNaN) = QNaN
+//    tgammal(QNaN) = QNaN
+//
+//*********************************************************************
+// Overview of operation
+//==============================================================
+//
+// Algorithm description
+// ---------------------
+//
+// There are 3 main paths in the implementation 
+// (and additional special values branches)
+//
+// 1) |X| >= 13 - Stirling formula computation
+//    a) Positive arguments:
+//       TGAMMAL(X) = exp((X-0.5)*ln(X) - X + C + S(Z)), 
+//       where C = 0.5*ln(2*Pi) , Z = 1/Z, S(Z) - Bernulli polynomial 
+//       (up to 'B18' term).
+//       Some of these calculation done in multiprecision. 
+//       Ln returns multiprecision result too 
+//       and exp also accepts and returns pair of values.
+//     
+//    b) Negative arguments
+//       TGAMMAL(-X) = PI/(X*TGAMMAL(X)*sin(PI*X)).
+//       (X*sin(PI*X))/PI calculated in parallel with TGAMMAL.
+//       Here we use polynomial of 9th degree with 2 multiprecision steps.
+//       Argument range reduction is: 
+//       N = [x] with round to nearest, r = x - N, -0.5 <= r < 0.5
+//       After ((X-0.5)*ln(X) - X + C + S(Z)) completed we just invert
+//       its result and compute exp with negative argument (1/exp(x)=exp(-x))
+//       Then we multiply exp result to PI/(X*sin(PI*X)).
+//
+// 2) 1 <= |X| < 13 - Polynomial part
+//    a) Positive arguments:
+//       All values are splitted to such intervals as:
+//       #0->[2;3], #1->[3,4], #2->[5,6]...
+//       For even intervals we just use polynomial computation with degree 20
+//       and first 6 multiprecision computations.
+//       Range reduction looks like
+//       N = [x] with truncate, r = x - N - 0.5, -0.5 <= r < 0.5
+//       For odd intervals we use reccurent formula: 
+//       TGAMMAL(X) = TGAMMA(X-1)*(X-1)
+//       [1;2] interval is splitted to 3 subranges: 
+//       [1;1.25], [1.25;1.75], [1.75;2] with the same polynomial forms
+//
+//    b) Negative arguments
+//       TGAMMAL(-X) = PI/(X*TGAMMAL(X)*sin(PI*X)).
+//       (X*sin(PI*X))/PI calculated in parallel with TGAMMAL.
+//       After multiplication by TGAMMAL(X) result we calculate reciprocal
+//       and get final result.
+//
+// 3) 0 < |X| < 1 - Near 0 part
+//    a) Here we use reccurent formula TGAMMAL(X) = TGAMMAL(X+1)/X
+//       TGAMMAL(X+1) calculated as shown above, 
+//       1/X result obtained in parallel. Then we just multiply these values.
+//       There is only additional separated subrange: [0;0.125] with specific
+//       polynomial constants set.
+//
+//    b) Negative arguments
+//       TGAMMAL(-X) = PI/(TGAMMAL(X+1)*sin(PI*X)).
+//       There is no need to compute 1/X.
+
+
+
+RODATA
+
+.align 16
+LOCAL_OBJECT_START(Constants_Tgammal_log_80_Q)
+// log2_hi, log2_lo, Q_6, Q_5, Q_4, Q_3, Q_2, Q_1 
+data4 0x00000000,0xB1721800,0x00003FFE,0x00000000
+data4 0x4361C4C6,0x82E30865,0x0000BFE2,0x00000000
+data4 0xA51BE0AF,0x92492453,0x00003FFC,0x00000000
+data4 0xA0CFD29F,0xAAAAAB73,0x0000BFFC,0x00000000
+data4 0xCCCE3872,0xCCCCCCCC,0x00003FFC,0x00000000
+data4 0xFFFFB4FB,0xFFFFFFFF,0x0000BFFC,0x00000000
+data4 0xAAAAAAAB,0xAAAAAAAA,0x00003FFD,0x00000000
+data4 0x00000000,0x80000000,0x0000BFFE,0x00000000 
+LOCAL_OBJECT_END(Constants_Tgammal_log_80_Q)
+
+.align 64
+LOCAL_OBJECT_START(Constants_Tgammal_log_80_Z_G_H_h1)
+// Z1 - 16 bit fixed, G1 and H1 IEEE single, h1 IEEE double   
+data4 0x00008000,0x3F800000,0x00000000,0x00000000
+data4 0x00000000,0x00000000,0x00000000,0x00000000 
+data4 0x00007879,0x3F70F0F0,0x3D785196,0x00000000
+data4 0xEBA0E0D1,0x8B1D330B,0x00003FDA,0x00000000
+data4 0x000071C8,0x3F638E38,0x3DF13843,0x00000000
+data4 0x9EADD553,0xE2AF365E,0x00003FE2,0x00000000
+data4 0x00006BCB,0x3F579430,0x3E2FF9A0,0x00000000
+data4 0x752F34A2,0xF585FEC3,0x0000BFE3,0x00000000  
+data4 0x00006667,0x3F4CCCC8,0x3E647FD6,0x00000000
+data4 0x893B03F3,0xF3546435,0x00003FE2,0x00000000  
+data4 0x00006187,0x3F430C30,0x3E8B3AE7,0x00000000 
+data4 0x39CDD2AC,0xBABA62E0,0x00003FE4,0x00000000 
+data4 0x00005D18,0x3F3A2E88,0x3EA30C68,0x00000000 
+data4 0x457978A1,0x8718789F,0x00003FE2,0x00000000
+data4 0x0000590C,0x3F321640,0x3EB9CEC8,0x00000000 
+data4 0x3185E56A,0x9442DF96,0x0000BFE4,0x00000000 
+data4 0x00005556,0x3F2AAAA8,0x3ECF9927,0x00000000 
+data4 0x2BBE2CBD,0xCBF9A4BF,0x00003FE4,0x00000000 
+data4 0x000051EC,0x3F23D708,0x3EE47FC5,0x00000000 
+data4 0x852D5935,0xF3537535,0x00003FE3,0x00000000 
+data4 0x00004EC5,0x3F1D89D8,0x3EF8947D,0x00000000 
+data4 0x46CDF32F,0xA1F1E699,0x0000BFDF,0x00000000 
+data4 0x00004BDB,0x3F17B420,0x3F05F3A1,0x00000000 
+data4 0xD8484CE3,0x84A61856,0x00003FE4,0x00000000 
+data4 0x00004925,0x3F124920,0x3F0F4303,0x00000000
+data4 0xFF28821B,0xC7DD97E0,0x0000BFE2,0x00000000    
+data4 0x0000469F,0x3F0D3DC8,0x3F183EBF,0x00000000 
+data4 0xEF1FD32F,0xD3C4A887,0x00003FE3,0x00000000  
+data4 0x00004445,0x3F088888,0x3F20EC80,0x00000000 
+data4 0x464C76DA,0x84672BE6,0x00003FE5,0x00000000 
+data4 0x00004211,0x3F042108,0x3F29516A,0x00000000
+data4 0x18835FB9,0x9A43A511,0x0000BFE5,0x00000000 
+LOCAL_OBJECT_END(Constants_Tgammal_log_80_Z_G_H_h1)
+
+.align 64
+LOCAL_OBJECT_START(Constants_Tgammal_log_80_Z_G_H_h2)
+// Z2 - 16 bit fixed, G2 and H2 IEEE single, h2 IEEE double
+data4 0x00008000,0x3F800000,0x00000000,0x00000000 
+data4 0x00000000,0x00000000,0x00000000,0x00000000 
+data4 0x00007F81,0x3F7F00F8,0x3B7F875D,0x00000000 
+data4 0x211398BF,0xAD08B116,0x00003FDB,0x00000000
+data4 0x00007F02,0x3F7E03F8,0x3BFF015B,0x00000000 
+data4 0xC376958E,0xB106790F,0x00003FDE,0x00000000 
+data4 0x00007E85,0x3F7D08E0,0x3C3EE393,0x00000000 
+data4 0x79A7679A,0xFD03F242,0x0000BFDA,0x00000000 
+data4 0x00007E08,0x3F7C0FC0,0x3C7E0586,0x00000000 
+data4 0x05E7AE08,0xF03F81C3,0x0000BFDF,0x00000000 
+data4 0x00007D8D,0x3F7B1880,0x3C9E75D2,0x00000000 
+data4 0x049EB22F,0xD1B87D3C,0x00003FDE,0x00000000
+data4 0x00007D12,0x3F7A2328,0x3CBDC97A,0x00000000 
+data4 0x3A9E81E0,0xFABC8B95,0x00003FDF,0x00000000 
+data4 0x00007C98,0x3F792FB0,0x3CDCFE47,0x00000000
+data4 0x7C4B5443,0xF5F3653F,0x00003FDF,0x00000000 
+data4 0x00007C20,0x3F783E08,0x3CFC15D0,0x00000000 
+data4 0xF65A1773,0xE78AB204,0x00003FE0,0x00000000  
+data4 0x00007BA8,0x3F774E38,0x3D0D874D,0x00000000 
+data4 0x7B8EF695,0xDB7CBFFF,0x0000BFE0,0x00000000 
+data4 0x00007B31,0x3F766038,0x3D1CF49B,0x00000000 
+data4 0xCF773FB3,0xC0241AEA,0x0000BFE0,0x00000000 
+data4 0x00007ABB,0x3F757400,0x3D2C531D,0x00000000 
+data4 0xC9539FDF,0xFC8F4D48,0x00003FE1,0x00000000  
+data4 0x00007A45,0x3F748988,0x3D3BA322,0x00000000 
+data4 0x954665C2,0x9CD035FB,0x0000BFE1,0x00000000  
+data4 0x000079D1,0x3F73A0D0,0x3D4AE46F,0x00000000 
+data4 0xDD367A30,0xEC9017C7,0x00003FE1,0x00000000 
+data4 0x0000795D,0x3F72B9D0,0x3D5A1756,0x00000000 
+data4 0xCB11189C,0xEE6625D3,0x0000BFE1,0x00000000 
+data4 0x000078EB,0x3F71D488,0x3D693B9D,0x00000000 
+data4 0xBE11C424,0xA49C8DB5,0x0000BFE0,0x00000000 
+LOCAL_OBJECT_END(Constants_Tgammal_log_80_Z_G_H_h2)
+
+.align 64
+LOCAL_OBJECT_START(Constants_Tgammal_log_80_h3_G_H)
+// h3 IEEE double extended, H3 and G3 IEEE single   
+data4 0x112666B0,0xAAACAAB1,0x00003FD3,0x3F7FFC00 
+data4 0x9B7FAD21,0x90051030,0x00003FD8,0x3F7FF400
+data4 0xF4D783C4,0xA6B46F46,0x00003FDA,0x3F7FEC00 
+data4 0x11C6DDCA,0xDA148D88,0x0000BFD8,0x3F7FE400 
+data4 0xCA964D95,0xCE65C1D8,0x0000BFD8,0x3F7FDC00
+data4 0x23412D13,0x883838EE,0x0000BFDB,0x3F7FD400 
+data4 0x983ED687,0xB7E5CFA1,0x00003FDB,0x3F7FCC08 
+data4 0xE3C3930B,0xDBE23B16,0x0000BFD9,0x3F7FC408 
+data4 0x48AA4DFC,0x9B92F1FC,0x0000BFDC,0x3F7FBC10 
+data4 0xCE9C8F7E,0x9A8CEB15,0x0000BFD9,0x3F7FB410 
+data4 0x0DECE74A,0x8C220879,0x00003FDC,0x3F7FAC18 
+data4 0x2F053150,0xB25CA912,0x0000BFDA,0x3F7FA420
+data4 0xD9A5BE20,0xA5876555,0x00003FDB,0x3F7F9C20 
+data4 0x2053F087,0xC919BB6E,0x00003FD9,0x3F7F9428 
+data4 0x041E9A77,0xB70BDA79,0x00003FDC,0x3F7F8C30 
+data4 0xEA1C9C30,0xF18A5C08,0x00003FDA,0x3F7F8438 
+data4 0x796D89E5,0xA3790D84,0x0000BFDD,0x3F7F7C40 
+data4 0xA2915A3A,0xE1852369,0x0000BFDD,0x3F7F7448 
+data4 0xA39ED868,0xD803858F,0x00003FDC,0x3F7F6C50 
+data4 0x9417EBB7,0xB2EEE356,0x0000BFDD,0x3F7F6458 
+data4 0x9BB0D07F,0xED5C1F8A,0x0000BFDC,0x3F7F5C68 
+data4 0xE87C740A,0xD6D201A0,0x0000BFDD,0x3F7F5470 
+data4 0x1CA74025,0xE8DEBF5E,0x00003FDC,0x3F7F4C78 
+data4 0x1F34A7EB,0x9A995A97,0x0000BFDC,0x3F7F4488
+data4 0x359EED97,0x9CB0F742,0x0000BFDA,0x3F7F3C90 
+data4 0xBBC6A1C8,0xD6F833C2,0x0000BFDD,0x3F7F34A0 
+data4 0xE71090EC,0xE1F68F2A,0x00003FDC,0x3F7F2CA8 
+data4 0xC160A74F,0xD1881CF1,0x0000BFDB,0x3F7F24B8 
+data4 0xD78CB5A4,0x9AD05AE2,0x00003FD6,0x3F7F1CC8 
+data4 0x9A77DC4B,0xE658CB8E,0x0000BFDD,0x3F7F14D8 
+data4 0x6BD6D312,0xBA281296,0x00003FDC,0x3F7F0CE0 
+data4 0xF95210D0,0xB478BBEB,0x0000BFDB,0x3F7F04F0 
+data4 0x38800100,0x39400480,0x39A00640,0x39E00C41 // H's start here 
+data4 0x3A100A21,0x3A300F22,0x3A4FF51C,0x3A6FFC1D 
+data4 0x3A87F20B,0x3A97F68B,0x3AA7EB86,0x3AB7E101
+data4 0x3AC7E701,0x3AD7DD7B,0x3AE7D474,0x3AF7CBED 
+data4 0x3B03E1F3,0x3B0BDE2F,0x3B13DAAA,0x3B1BD766 
+data4 0x3B23CC5C,0x3B2BC997,0x3B33C711,0x3B3BBCC6 
+data4 0x3B43BAC0,0x3B4BB0F4,0x3B53AF6D,0x3B5BA620 
+data4 0x3B639D12,0x3B6B9444,0x3B7393BC,0x3B7B8B6D 
+LOCAL_OBJECT_END(Constants_Tgammal_log_80_h3_G_H)
+
+.align 64 
+LOCAL_OBJECT_START(Constants_Tgammal_stirling)
+//0.5*ln(2*Pi)=9.1893853320467266954096885e-01 + 7.2239360881843238220057778e-17
+data8 0x3FED67F1C864BEB4, 0x3C94D252F2400510
+// Bernulli numbers 
+data8 0xAAAAAAAAAAAAAAAB, 0x00003FFB //B2 = 8.3333333333333333333333333333e-02
+data8 0xBF66C16C16C16C17 //B4 = -2.7777777777777777777777777778e-03
+data8 0x3F4A01A01A01A01A //B6 = 7.9365079365079365079365079365e-04
+data8 0xBF43813813813814 //B8 = -5.9523809523809523809523809524e-04
+data8 0x3F4B951E2B18FF23 //B10 = 8.4175084175084175084175084175e-04
+data8 0xBF5F6AB0D9993C7D //B12 = -1.9175269175269175269175269175e-03
+data8 0x3F7A41A41A41A41A //B14 = 6.4102564102564102564102564103e-03
+data8 0xBF9E4286CB0F5398 //B16 = -2.9550653594771241830065359477e-02
+data8 0x3FC6FE96381E0680 //B18 = 1.7964437236883057316493849002e-01
+data8 0x3FE0000000000000 // 0.5
+LOCAL_OBJECT_END(Constants_Tgammal_stirling)
+
+.align 64 
+LOCAL_OBJECT_START(Constants_Tgammal_sin)
+// Polynomial coefficients for the sin(Pi*x)/Pi, 0 <= |x| < 0.5 
+//A2 = 8.1174242528335360802316245099e-01 + 5.1302254650266899774269946201e-18
+data8 0x3FE9F9CB402BC46C, 0x3C57A8B3819B7CEC
+//A1 = -1.6449340668482264060656916627e+00 + -3.0210280454695477893051351574e-17
+data8 0xBFFA51A6625307D3, 0xBC816A402079D0EF
+data8 0xF3AEF1FFCCE6C813, 0x0000BFE3 //A9 = -7.0921197799923779127089910470e-09
+data8 0x87D54408E6D4BB9D, 0x00003FE9 //A8 = 2.5300880778252693946712766029e-07
+data8 0xEA12033DCE7B8ED9, 0x0000BFED //A7 = -6.9758403885461690048189307819e-06
+data8 0x9BA38C952A59D1A8, 0x00003FF2 //A6 = 1.4842878710882320255092707181e-04
+data8 0x99C0B55178FF0E38, 0x0000BFF6 //A5 = -2.3460810348048124421268761990e-03
+data8 0xD63402E798FEC896, 0x00003FF9 //A4 = 2.6147847817611456327417812320e-02
+data8 0xC354723906D95E92, 0x0000BFFC //A3 = -1.9075182412208257558294507774e-01
+LOCAL_OBJECT_END(Constants_Tgammal_sin)
+
+.align 64 
+LOCAL_OBJECT_START(Constants_Tgammal_exp_64_Arg)
+data4 0x00000000,0xB17217F4,0x00003FF2,0x00000000 // L_hi = hi part log(2)/2^12
+data4 0xF278ECE6,0xF473DE6A,0x00003FD4,0x00000000 // L_lo = lo part log(2)/2^12
+LOCAL_OBJECT_END(Constants_Tgammal_exp_64_Arg)
+
+LOCAL_OBJECT_START(Constants_Tgammal_exp_64_A)
+data4 0xB1B736A0,0xAAAAAAAB,0x00003FFA,0x00000000 // A3
+data4 0x90CD6327,0xAAAAAAAB,0x00003FFC,0x00000000 // A2
+data4 0xFFFFFFFF,0xFFFFFFFF,0x00003FFD,0x00000000 // A1
+LOCAL_OBJECT_END(Constants_Tgammal_exp_64_A)
+
+LOCAL_OBJECT_START(Constants_Tgammal_exp_64_T1)
+data4 0x3F800000,0x3F8164D2,0x3F82CD87,0x3F843A29 
+data4 0x3F85AAC3,0x3F871F62,0x3F88980F,0x3F8A14D5 
+data4 0x3F8B95C2,0x3F8D1ADF,0x3F8EA43A,0x3F9031DC
+data4 0x3F91C3D3,0x3F935A2B,0x3F94F4F0,0x3F96942D
+data4 0x3F9837F0,0x3F99E046,0x3F9B8D3A,0x3F9D3EDA
+data4 0x3F9EF532,0x3FA0B051,0x3FA27043,0x3FA43516
+data4 0x3FA5FED7,0x3FA7CD94,0x3FA9A15B,0x3FAB7A3A
+data4 0x3FAD583F,0x3FAF3B79,0x3FB123F6,0x3FB311C4
+data4 0x3FB504F3,0x3FB6FD92,0x3FB8FBAF,0x3FBAFF5B
+data4 0x3FBD08A4,0x3FBF179A,0x3FC12C4D,0x3FC346CD
+data4 0x3FC5672A,0x3FC78D75,0x3FC9B9BE,0x3FCBEC15
+data4 0x3FCE248C,0x3FD06334,0x3FD2A81E,0x3FD4F35B
+data4 0x3FD744FD,0x3FD99D16,0x3FDBFBB8,0x3FDE60F5
+data4 0x3FE0CCDF,0x3FE33F89,0x3FE5B907,0x3FE8396A
+data4 0x3FEAC0C7,0x3FED4F30,0x3FEFE4BA,0x3FF28177
+data4 0x3FF5257D,0x3FF7D0DF,0x3FFA83B3,0x3FFD3E0C
+LOCAL_OBJECT_END(Constants_Tgammal_exp_64_T1)
+
+LOCAL_OBJECT_START(Constants_Tgammal_exp_64_T2)
+data4 0x3F800000,0x3F80058C,0x3F800B18,0x3F8010A4 
+data4 0x3F801630,0x3F801BBD,0x3F80214A,0x3F8026D7 
+data4 0x3F802C64,0x3F8031F2,0x3F803780,0x3F803D0E 
+data4 0x3F80429C,0x3F80482B,0x3F804DB9,0x3F805349 
+data4 0x3F8058D8,0x3F805E67,0x3F8063F7,0x3F806987 
+data4 0x3F806F17,0x3F8074A8,0x3F807A39,0x3F807FCA 
+data4 0x3F80855B,0x3F808AEC,0x3F80907E,0x3F809610 
+data4 0x3F809BA2,0x3F80A135,0x3F80A6C7,0x3F80AC5A 
+data4 0x3F80B1ED,0x3F80B781,0x3F80BD14,0x3F80C2A8 
+data4 0x3F80C83C,0x3F80CDD1,0x3F80D365,0x3F80D8FA 
+data4 0x3F80DE8F,0x3F80E425,0x3F80E9BA,0x3F80EF50 
+data4 0x3F80F4E6,0x3F80FA7C,0x3F810013,0x3F8105AA 
+data4 0x3F810B41,0x3F8110D8,0x3F81166F,0x3F811C07 
+data4 0x3F81219F,0x3F812737,0x3F812CD0,0x3F813269 
+data4 0x3F813802,0x3F813D9B,0x3F814334,0x3F8148CE 
+data4 0x3F814E68,0x3F815402,0x3F81599C,0x3F815F37
+LOCAL_OBJECT_END(Constants_Tgammal_exp_64_T2)
+
+LOCAL_OBJECT_START(Constants_Tgammal_exp_64_W1)
+data8 0x0000000000000000, 0xBE384454171EC4B4
+data8 0xBE6947414AA72766, 0xBE5D32B6D42518F8
+data8 0x3E68D96D3A319149, 0xBE68F4DA62415F36
+data8 0xBE6DDA2FC9C86A3B, 0x3E6B2E50F49228FE
+data8 0xBE49C0C21188B886, 0x3E64BFC21A4C2F1F
+data8 0xBE6A2FBB2CB98B54, 0x3E5DC5DE9A55D329
+data8 0x3E69649039A7AACE, 0x3E54728B5C66DBA5
+data8 0xBE62B0DBBA1C7D7D, 0x3E576E0409F1AF5F
+data8 0x3E6125001A0DD6A1, 0xBE66A419795FBDEF
+data8 0xBE5CDE8CE1BD41FC, 0xBE621376EA54964F
+data8 0x3E6370BE476E76EE, 0x3E390D1A3427EB92
+data8 0x3E1336DE2BF82BF8, 0xBE5FF1CBD0F7BD9E
+data8 0xBE60A3550CEB09DD, 0xBE5CA37E0980F30D
+data8 0xBE5C541B4C082D25, 0xBE5BBECA3B467D29
+data8 0xBE400D8AB9D946C5, 0xBE5E2A0807ED374A
+data8 0xBE66CB28365C8B0A, 0x3E3AAD5BD3403BCA
+data8 0x3E526055C7EA21E0, 0xBE442C75E72880D6
+data8 0x3E58B2BB85222A43, 0xBE5AAB79522C42BF
+data8 0xBE605CB4469DC2BC, 0xBE589FA7A48C40DC
+data8 0xBE51C2141AA42614, 0xBE48D087C37293F4
+data8 0x3E367A1CA2D673E0, 0xBE51BEBB114F7A38
+data8 0xBE6348E5661A4B48, 0xBDF526431D3B9962
+data8 0x3E3A3B5E35A78A53, 0xBE46C46C1CECD788
+data8 0xBE60B7EC7857D689, 0xBE594D3DD14F1AD7
+data8 0xBE4F9C304C9A8F60, 0xBE52187302DFF9D2
+data8 0xBE5E4C8855E6D68F, 0xBE62140F667F3DC4
+data8 0xBE36961B3BF88747, 0x3E602861C96EC6AA
+data8 0xBE3B5151D57FD718, 0x3E561CD0FC4A627B
+data8 0xBE3A5217CA913FEA, 0x3E40A3CC9A5D193A
+data8 0xBE5AB71310A9C312, 0x3E4FDADBC5F57719
+data8 0x3E361428DBDF59D5, 0x3E5DB5DB61B4180D
+data8 0xBE42AD5F7408D856, 0x3E2A314831B2B707
+LOCAL_OBJECT_END(Constants_Tgammal_exp_64_W1)
+
+LOCAL_OBJECT_START(Constants_Tgammal_exp_64_W2)
+data8 0x0000000000000000, 0xBE641F2537A3D7A2
+data8 0xBE68DD57AD028C40, 0xBE5C77D8F212B1B6
+data8 0x3E57878F1BA5B070, 0xBE55A36A2ECAE6FE
+data8 0xBE620608569DFA3B, 0xBE53B50EA6D300A3
+data8 0x3E5B5EF2223F8F2C, 0xBE56A0D9D6DE0DF4
+data8 0xBE64EEF3EAE28F51, 0xBE5E5AE2367EA80B
+data8 0x3E47CB1A5FCBC02D, 0xBE656BA09BDAFEB7
+data8 0x3E6E70C6805AFEE7, 0xBE6E0509A3415EBA
+data8 0xBE56856B49BFF529, 0x3E66DD3300508651
+data8 0x3E51165FC114BC13, 0x3E53333DC453290F
+data8 0x3E6A072B05539FDA, 0xBE47CD877C0A7696
+data8 0xBE668BF4EB05C6D9, 0xBE67C3E36AE86C93
+data8 0xBE533904D0B3E84B, 0x3E63E8D9556B53CE
+data8 0x3E212C8963A98DC8, 0xBE33138F032A7A22
+data8 0x3E530FA9BC584008, 0xBE6ADF82CCB93C97
+data8 0x3E5F91138370EA39, 0x3E5443A4FB6A05D8
+data8 0x3E63DACD181FEE7A, 0xBE62B29DF0F67DEC
+data8 0x3E65C4833DDE6307, 0x3E5BF030D40A24C1
+data8 0x3E658B8F14E437BE, 0xBE631C29ED98B6C7
+data8 0x3E6335D204CF7C71, 0x3E529EEDE954A79D
+data8 0x3E5D9257F64A2FB8, 0xBE6BED1B854ED06C
+data8 0x3E5096F6D71405CB, 0xBE3D4893ACB9FDF5
+data8 0xBDFEB15801B68349, 0x3E628D35C6A463B9
+data8 0xBE559725ADE45917, 0xBE68C29C042FC476
+data8 0xBE67593B01E511FA, 0xBE4A4313398801ED
+data8 0x3E699571DA7C3300, 0x3E5349BE08062A9E
+data8 0x3E5229C4755BB28E, 0x3E67E42677A1F80D
+data8 0xBE52B33F6B69C352, 0xBE6B3550084DA57F
+data8 0xBE6DB03FD1D09A20, 0xBE60CBC42161B2C1
+data8 0x3E56ED9C78A2B771, 0xBE508E319D0FA795
+data8 0xBE59482AFD1A54E9, 0xBE2A17CEB07FD23E
+data8 0x3E68BF5C17365712, 0x3E3956F9B3785569
+LOCAL_OBJECT_END(Constants_Tgammal_exp_64_W2)
+
+
+
+LOCAL_OBJECT_START(Constants_Tgammal_poly)
+
+// Polynomial coefficients for the tgammal(x), 2 <= |x| < 3 
+//A5 = 2.8360780594841213109180699803e-02 + 2.2504152891014320704380000000e-19
+data8 0x3F9D0A9BC49353D2, 0x3C109AEA0F23CE2D
+//A4 = 1.0967323400216015538699565468e-01 + 9.9225166000430644587276000000e-18
+data8 0x3FBC138B89492C5B, 0x3C66E138506D5652
+//A3 = 2.5387124684114281691904579930e-01 + 2.2667777637607113205546600000e-17
+data8 0x3FD03F6D2FA4F4F8, 0x3C7A2258DA8CD8B1
+data8 0xC5866457328BC39B, 0x00003FE3 //A20 = 5.7487331964156762795056629138e-09
+data8 0xE93D9F1ACD59C929, 0x0000BFE4 //A19= -1.3576396100397317396956445658e-08
+data8 0xE33389C8F6CBA813, 0x00003FE5 //A18 = 2.6449714924964597501721434271e-08
+data8 0x8FE7B25B9CD26D2A, 0x0000BFE7 //A17= -6.7011017946055513660266853311e-08
+data8 0xB89F4721BFBC15B0, 0x00003FE8 //A16 = 1.7194280320370423615174419192e-07
+data8 0xE49CBDC1874EBABA, 0x0000BFE9 //A15= -4.2582353660153782928729466776e-07
+data8 0x913AF50A336129CA, 0x00003FEB //A14 = 1.0820500665257088283172211622e-06
+data8 0xABCF0F7313B3B332, 0x0000BFEC //A13= -2.5601510627710417669568115706e-06
+//A2 = 6.5455857798133676439533701341e-01 + 1.3292075193155190798867000000e-18
+data8 0x3FE4F224D4B7E01C, 0x3C3885014A2B8319
+//A1 = 9.3473452162608550164435428087e-01 + 3.2785154201417136611642400000e-17
+data8 0x3FEDE9585F1A7093, 0x3C82E63C1B5028BF
+//A0 = 1.3293403881791368004172682049e+00 + 2.2005689328949279282607500000e-16
+data8 0x3FF544FA6D47B38F, 0x3CAFB6AA9829E81F
+data8 0xF3668F799997C76D, 0x00003FED //A12 = 7.2539039479124273660331538367e-06
+data8 0xD6C6BBD54CDEAEB1, 0x0000BFEE //A11= -1.2801665282681088568639378920e-05
+data8 0x809E4763B06F6883, 0x00003FF1 //A10 = 6.1329973609906572700697893187e-05
+data8 0x8443B000F8F9A71A, 0x00003FED //A9 = 3.9417864189995544394564413428e-06
+data8 0xC5C7E6D62A6991D8, 0x00003FF4 //A8 = 7.5447412886334708803357581519e-04
+data8 0xD2AF690725C62D88, 0x00003FF5 //A7 = 1.6074004848394703022110823298e-03
+data8 0xAA44E635D4B7B682, 0x00003FF8 //A6 = 1.0392403425906843901680697839e-02
+//
+// Polynomial coefficients for the tgammal(x), 4 <= |x| < 5 
+//A5 = 1.1600674810589555185913468449e+00 + 3.0229979112715124660731000000e-17
+data8 0x3FF28FA2EB44D22E, 0x3C816D285234C815
+//A4 = 3.1374268565470946334983182169e+00 + 1.3694868953995008497659600000e-16
+data8 0x400919734073B1E1, 0x3CA3BC83CD7E9565
+//A3 = 7.0834593993741057360580271052e+00 + 3.3899702569039156457249800000e-16
+data8 0x401C5576617B6C1F, 0x3CB86D6431213296
+data8 0xA4A5FB49C094966B, 0x00003FDA //A20 = 9.3591760106637809309720130828e-12
+data8 0xA9260DA0F51D7ED8, 0x00003FDD //A19 = 7.6919898428091669411809372180e-11
+data8 0xA16441DFB14BD6E1, 0x00003FE0 //A18 = 5.8713933014370867331213494535e-10
+data8 0x95F098D9C2234849, 0x00003FE3 //A17 = 4.3638234584169302324461091035e-09
+data8 0x8581817400E5AD2B, 0x00003FE6 //A16 = 3.1084260332429955234755367839e-08
+data8 0xE272940E373EBE15, 0x00003FE8 //A15 = 2.1089573544273993580820317236e-07
+data8 0xB6B3391145D226FB, 0x00003FEB //A14 = 1.3612217421122787182942706259e-06
+data8 0x8B9428C4DF95FCD5, 0x00003FEE //A13 = 8.3195416382628990683949003789e-06
+//A2 = 1.2665135075272345943631080445e+01 + 9.8721896915973874255877000000e-16
+data8 0x4029548C95A76F38, 0x3CD1C8BE715B8E13
+//A1 = 1.6154969393303069580269948347e+01 + 9.6850518810678379641029000000e-16
+data8 0x403027AC12FC1E1E, 0x3CD172711C15501B
+//A0 = 1.1631728396567448058362970187e+01 + 8.7078125362814179268673000000e-16
+data8 0x40274371E7866C65, 0x3CCF5F8A1A5FACA0
+data8 0xC94A903114272C03, 0x00003FF0 //A12 = 4.7991576836334427243159066630e-05
+data8 0x8844262960E04BE6, 0x00003FF3 //A11 = 2.5990716419283017929486175141e-04
+data8 0xAC5418A76767678D, 0x00003FF5 //A10 = 1.3147621245497801180184809726e-03
+data8 0xCA231B6EFE959132, 0x00003FF7 //A9 = 6.1687358811367989146517222415e-03
+data8 0xDA38E39C13819D2A, 0x00003FF9 //A8 = 2.6638454961912040754759086920e-02
+data8 0xD696DF8D8389FE53, 0x00003FFB //A7 = 1.0477995539298934056097943975e-01
+data8 0xBDD5C153048BC435, 0x00003FFD //A6 = 3.7077144754791605130056406006e-01
+//
+// Polynomial coefficients for the tgammal(x), 6 <= |x| < 7 
+//A5 = 6.7169398121054200601065531373e+01 + 2.9481001527213915901489600000e-15
+data8 0x4050CAD76B377BA0, 0x3CEA8DDB2B2DE93E
+//A4 = 1.6115104376855398982115730178e+02 + 1.3422421925418824418257300000e-14
+data8 0x406424D559BDC687, 0x3D0E397FDB5B33DC
+//A3 = 3.1812194028053562533386866562e+02 + 3.9881709875858650942409600000e-14
+data8 0x4073E1F377A6CF73, 0x3D26738F63FE9C4C
+data8 0xD6E1B5FF90CAABD3, 0x00003FE1 //A20 = 1.5634700199277480081025480635e-09
+data8 0xD451987B925DD37E, 0x00003FE4 //A19 = 1.2358576813211397717382327174e-08
+data8 0xBFC151B67FA58E6B, 0x00003FE7 //A18 = 8.9292951435632759686382657901e-08
+data8 0xA9034C5E1D67572E, 0x00003FEA //A17 = 6.2962205718327848327368724720e-07
+data8 0x8E40F6EAA30A71EC, 0x00003FED //A16 = 4.2394926442967995119170095258e-06
+data8 0xE3C3541B03A1C350, 0x00003FEF //A15 = 2.7151465666109594512258841637e-05
+data8 0xACE2E58436B2DDCE, 0x00003FF2 //A14 = 1.6487723793339152877117376243e-04
+data8 0xF7EAF8D8D1CAA3D1, 0x00003FF4 //A13 = 9.4573158112768812533636022369e-04
+//A2 = 4.8664351544258869353143381886e+02 + 4.7424047995944376868895400000e-14
+data8 0x407E6A4BD6D9463B, 0x3D2AB2868D79E192
+//A1 = 5.1615277644992545447166776285e+02 + 3.0901956935588717379242200000e-14
+data8 0x40802138E2DC003B, 0x3D216570FB601AEA
+//A0 = 2.8788527781504433278314536437e+02 + 2.8213174117085164944959600000e-14
+data8 0x4071FE2A1911F7D6, 0x3D1FC3E4CF4DB5AF
+data8 0xA72B88E48D3D1BAB, 0x00003FF7 //A12 = 5.1016252919939028020562237471e-03
+data8 0xD2EFB1067DB4FFB2, 0x00003FF9 //A11 = 2.5749059441230515023024615917e-02
+data8 0xF788AF9522205C24, 0x00003FFB //A10 = 1.2086617635601742290221382521e-01
+data8 0x861A6CE06CB29EAF, 0x00003FFE //A9 = 5.2384071807018493367136112163e-01
+data8 0x84FBDE0947718B58, 0x00004000 //A8 = 2.0778727617851237754568261869e+00
+data8 0xEEC1371E265A2C3A, 0x00004001 //A7 = 7.4610858525146049022238037342e+00
+data8 0xBF514B9BE68ED59D, 0x00004003 //A6 = 2.3914694993947572859629197920e+01
+//
+// Polynomial coefficients for the tgammal(x), 8 <= |x| < 9 
+//A5 = 5.8487447114416836484451778233e+03 + 4.7365465221455983144182900000e-13
+data8 0x40B6D8BEA568B6FD, 0x3D60AA4D44C2589B
+//A4 = 1.2796464063087094473303295672e+04 + 1.2373341702514898266244200000e-12
+data8 0x40C8FE3B666B532D, 0x3D75C4752C5B4783
+//A3 = 2.2837606581322281272150576115e+04 + 2.6598064610627891398831000000e-13
+data8 0x40D64D66D23A7764, 0x3D52B77B3A10EA5C
+data8 0xB23418F75B0BE22A, 0x00003FE9 //A20 = 3.3192989594206801808678663868e-07
+data8 0xA984A7BC8B856ED2, 0x00003FEC //A19 = 2.5260177918662350066375115788e-06
+data8 0x921A49729416372C, 0x00003FEF //A18 = 1.7416797068239475136398213598e-05
+data8 0xF5BB9415CC399CA4, 0x00003FF1 //A17 = 1.1717449586392814601938207599e-04
+data8 0xC50B91A40B81F9DF, 0x00003FF4 //A16 = 7.5166775151159345732094429036e-04
+data8 0x96002572326DB203, 0x00003FF7 //A15 = 4.5776541559407384162139204300e-03
+data8 0xD81A1A595E4157BA, 0x00003FF9 //A14 = 2.6379634345126284099420760736e-02
+data8 0x92B700D0CFECADD8, 0x00003FFC //A13 = 1.4327622675407940907282658100e-01
+//A2 = 3.1237895525940199149772524834e+04 + 3.1280450505163186432331700000e-12
+data8 0x40DE8179504C0878, 0x3D8B83BB33FBB766
+//A1 = 2.9192841741344487672904506326e+04 + 7.9300780509779689630767000000e-13
+data8 0x40DC8235DF171691, 0x3D6BE6C780EE54DF
+//A0 = 1.4034407293483411194756627083e+04 + 1.4038139346291543309253700000e-12
+data8 0x40CB693422315F90, 0x3D78B23746113FCE
+data8 0xBAE50807548BC711, 0x00003FFE //A12 = 7.3005724123917935346868107005e-01
+data8 0xDE28B1F57E68CFB6, 0x00004000 //A11 = 3.4712338349724065462763671443e+00
+data8 0xF4DCA5A5FF901118, 0x00004002 //A10 = 1.5303868912154033908205911714e+01
+data8 0xF85AAA1AD5E84E5E, 0x00004004 //A9 = 6.2088539523416399361048051373e+01
+data8 0xE5AA8BB1BF02934D, 0x00004006 //A8 = 2.2966619406617480799195651466e+02
+data8 0xBF6CFEFD67F59845, 0x00004008 //A7 = 7.6570306334640770654588802417e+02
+data8 0x8DB5D2F001635C29, 0x0000400A //A6 = 2.2673639984182571062068713002e+03
+//
+// Polynomial coefficients for the tgammal(x), 10 <= |x| < 11 
+//A5 = 7.2546009516580589115619659424e+05 + 1.0343348865365065212891728822e-10
+data8 0x412623A830B99290, 0x3DDC6E7C157611C4
+//A4 = 1.4756292870840241666883230209e+06 + 8.1516565365333844166705674775e-11
+data8 0x4136842D497E56AF, 0x3DD66837E4C3F9EE
+//A3 = 2.4356116926500420086085796356e+06 + 3.5508860076560925641351069404e-10
+data8 0x4142950DD8A8C1AF, 0x3DF866C8E3DD0980
+data8 0xB7FD0D1EEAC38EB4, 0x00003FF1 //A20 = 8.7732544640091602721643775932e-05
+data8 0xA9345C64AC750AE9, 0x00003FF4 //A19 = 6.4546407626804942279126469603e-04
+data8 0x8BEABC81BE1E93C9, 0x00003FF7 //A18 = 4.2699261134524096128048819443e-03
+data8 0xE1CD281EDD7315F8, 0x00003FF9 //A17 = 2.7563646660310313164706189622e-02
+data8 0xAD8A5BA6D0FD9758, 0x00003FFC //A16 = 1.6947310643831556048460963841e-01
+data8 0xFCDDA464AD3F182E, 0x00003FFE //A15 = 9.8775699098518676937088606052e-01
+data8 0xAE0DCE2F7B60D1AE, 0x00004001 //A14 = 5.4391852309591064073782104822e+00
+data8 0xE1745D9ABEB8D1A7, 0x00004003 //A13 = 2.8181819161363002758615770457e+01
+//A2 = 3.0619656223573554307222366333e+06 + 1.0819940302945474471259520006e-10
+data8 0x41475C66CFA967E4, 0x3DDDBDDB2A27334B
+//A1 = 2.6099413018962685018777847290e+06 + 3.6851882860056025385268615240e-10
+data8 0x4143E98AA6A48974, 0x3DF9530D42589AB6
+//A0 = 1.1332783889487853739410638809e+06 + 1.9339350553312096248591829758e-10
+data8 0x41314ADE639225C9, 0x3DEA946DD6C2C8D3
+data8 0x88BCFAAE71812A1C, 0x00004006 //A12 = 1.3673820009490115307300592012e+02
+data8 0x9A770F5AB540A326, 0x00004008 //A11 = 6.1786031215382040427126476507e+02
+data8 0xA170C1D2C6B413FC, 0x0000400A //A10 = 2.5830473201524594051391525170e+03
+data8 0x9AE56061CB02EB55, 0x0000400C //A9 = 9.9133441230507404119297200255e+03
+data8 0x872390769650FBE2, 0x0000400E //A8 = 3.4595564309496661629764193479e+04
+data8 0xD3E5E8D6923910C1, 0x0000400F //A7 = 1.0849181904819284819615140521e+05
+data8 0x930D70602F50B754, 0x00004011 //A6 = 3.0116351174131169193070583741e+05
+//
+// Polynomial coefficients for the tgammal(x), 12 <= |x| < 13 
+//A5 = 1.2249876249976964294910430908e+08 + 6.0051348061679753770848000000e-09
+data8 0x419D34BB29FFC39D, 0x3E39CAB72E01818D
+//A4 = 2.3482765927605420351028442383e+08 + 1.1874729051592862323641700000e-08
+data8 0x41ABFE5F168D56FA, 0x3E4980338AA7B04B
+//A3 = 3.6407329688125067949295043945e+08 + 2.6657200942150363994658700000e-08
+data8 0x41B5B35150E199A5, 0x3E5C9F79C0EB5300
+data8 0xE89AE0F8D726329D, 0x00003FF9 //A20 = 2.8394164465429105626588451540e-02
+data8 0xCF90981F86E38013, 0x00003FFC //A19 = 2.0270002071785908652476845915e-01
+data8 0xA56C658079CA8C4A, 0x00003FFF //A18 = 1.2923704984019263122675412350e+00
+data8 0x80AEF96A67C5615A, 0x00004002 //A17 = 8.0427183300456238315262463506e+00
+data8 0xBE886D7529678931, 0x00004004 //A16 = 4.7633230047847868242503413461e+01
+data8 0x858EDBA4CE2F7508, 0x00004007 //A15 = 2.6711607799594541057655957154e+02
+data8 0xB0B0A3AF388274F0, 0x00004009 //A14 = 1.4135199810126975119809102782e+03
+data8 0xDBA87137988751EF, 0x0000400B //A13 = 7.0290552818218513870879313985e+03
+//A2 = 4.2828433593031734228134155273e+08 + 3.9760422293645854535247300000e-08
+data8 0x41B98719AFEE2947, 0x3E6558A17E0D3007
+//A1 = 3.4008253676084774732589721680e+08 + 1.2558352335001093116071000000e-09
+data8 0x41B4453F68C2C6EB, 0x3E159338C5BC7EC3
+//A0 = 1.3684336546556583046913146973e+08 + 2.6786516700381562934240300000e-08
+data8 0x41A05020CAEE5EA5, 0x3E5CC3058A858579
+data8 0xFF5E3940FB4BA576, 0x0000400D //A12 = 3.2687111823895439312116108631e+04
+data8 0x8A08C124C7F74B6C, 0x00004010 //A11 = 1.4134701786994123329786229006e+05
+data8 0x89D701953540BFFB, 0x00004012 //A10 = 5.6459209892773907605385652281e+05
+data8 0xFC46344B3116C3AD, 0x00004013 //A9 = 2.0666305367147234406757715163e+06
+data8 0xD183EBD7A400151F, 0x00004015 //A8 = 6.8653979211730981618367536737e+06
+data8 0x9C083A40742112F4, 0x00004017 //A7 = 2.0451444503543981795037456447e+07
+data8 0xCD3C475B1A8B6662, 0x00004018 //A6 = 5.3801245423495149598177886823e+07
+LOCAL_OBJECT_END(Constants_Tgammal_poly)
+
+
+LOCAL_OBJECT_START(Constants_Tgammal_poly_splitted)
+
+// Polynomial coefficients for the tgammal(x), 1 <= |x| < 1.25 
+//A5 = -9.8199506890310417350775651357e-01+ -3.2546247786122976510752200000e-17
+data8 0xBFEF6C80EC38B509, 0xBC82C2FA7A3DE3BD
+//A4 = 9.8172808683439960475425323239e-01 + 4.4847611775298520359811400000e-17
+data8 0x3FEF6A51055096B0, 0x3C89DA56DE95EFE4
+//A3 = -9.0747907608088618225394839101e-01 +-1.0244057366544064435443970000e-16
+data8 0xBFED0A118F324B62, 0xBC9D86C7B9EBCFFF
+data8 0xB8E3FDAA66CC738E, 0x00003FFB //A20 = 9.0278608095877488976217714815e-02
+data8 0xA76067AE1738699C, 0x0000BFFD //A19 =-3.2690738678103132837070881737e-01
+data8 0x9D66B13718408C44, 0x00003FFE //A18 = 6.1484820933424283818320582920e-01
+data8 0xD4AC67BBB4AE5599, 0x0000BFFE //A17 =-8.3075569470082063491389474937e-01
+data8 0xF1426ED1C1488DB3, 0x00003FFE //A16 = 9.4241993542644505594957058785e-01
+data8 0xFC12EB07AA6F4B6B, 0x0000BFFE //A15 =-9.8466366707947121954333549690e-01
+data8 0xFF2B32CFE5B0DDC8, 0x00003FFE //A14 = 9.9675290656677214804168895915e-01
+data8 0xFFD8E7E6FF3662EA, 0x0000BFFE //A13 =-9.9940347089360552383472582319e-01
+//A2 = 9.8905599532797250361682017683e-01 + 5.1760162410376024240867300000e-17
+data8 0x3FEFA658C23B1578, 0x3C8DD673A61F6FE7
+//A1 = -5.7721566490153275452712478000e-01+ -1.0607935612223465065923310000e-16
+data8 0xBFE2788CFC6FB618, 0xBC9E9346622D53B7
+//A0 = 9.9999999999999988897769753748e-01 + 1.1102230245372554544790880000e-16
+data8 0x3FEFFFFFFFFFFFFF, 0x3C9FFFFFFFF51E4E
+data8 0xFFF360DF628F0BC9, 0x00003FFE //A12 = 9.9980740979895815468216470840e-01
+data8 0xFFEF8F9A72B40480, 0x0000BFFE //A11 = -9.9974916001038145045939523470e-01
+data8 0xFFE037B8C7E39952, 0x00003FFE //A10 = 9.9951504002809911822597567307e-01
+data8 0xFFC01E08F348BED2, 0x0000BFFE //A9 = -9.9902522772325406705059517941e-01
+data8 0xFF83DAC83119B52C, 0x00003FFE //A8 = 9.9810569179053383842734164901e-01
+data8 0xFEF9F8AB891ABB24, 0x0000BFFE //A7 = -9.9600176036720260345608796766e-01
+data8 0xFE3F0537573C8235, 0x00003FFE //A6 = 9.9314911461918778676646301341e-01
+//
+// Polynomial coefficients for the tgammal(x), 1.25 <= |x| < 1.75 
+//A5 = -7.7523052299853054125655660300e-02+ -1.2693512521686721504433600000e-17
+data8 0xBFB3D88CFE50601B, 0xBC6D44ED60EE2170
+//A4 = 1.4464535904462152982041800442e-01 + 2.5426820829345729856648800000e-17
+data8 0x3FC283BD374EB2A9, 0x3C7D50AC436187C3
+//A3 = -1.0729480456477220873257039102e-01+ -6.2429894945456418196551000000e-18
+data8 0xBFBB77AC1CA2EBA5, 0xBC5CCA6BCC422D41
+data8 0xF732D2689F323283, 0x00003FF2 //A20 = 2.3574688251652899567587145422e-04
+data8 0xB6B00E23DE89D13A, 0x0000BFF3 //A19 =-3.4844916488842618776630058875e-04
+data8 0xE98396FE4A1B2799, 0x00003FF3 //A18 =4.4539265198744452020440735977e-04
+data8 0xAF8D235A640DB1A2, 0x0000BFF4 //A17 =-6.6967514303333563295261178346e-04
+data8 0x8513B736C918B261, 0x00003FF5 //A16 = 1.0152970456990865810615917715e-03
+data8 0xC790A1A2C78D8E17, 0x0000BFF5 //A15 =-1.5225598630329403515321688394e-03
+data8 0x959706CFA638CDE2, 0x00003FF6 //A14 = 2.2825614575133879623648932383e-03
+data8 0xE050A6021E129860, 0x0000BFF6 //A13 =-3.4227757733947066666295285936e-03
+//A2 = 4.1481345368830113695679528973e-01 + 3.1252439808354284892632100000e-17
+data8 0x3FDA8C4DBA620D56, 0x3C82040BCB483C76
+//A1 = 3.2338397448885010387886751460e-02 + 3.4437825798552300531443100000e-18
+data8 0x3FA08EA88EE561B1, 0x3C4FC366D6C64806
+//A0 = 8.8622692545275794095971377828e-01 + 7.2689375867553992399219000000e-17
+data8 0x3FEC5BF891B4EF6A, 0x3C94F3877D311C0C
+data8 0xA8275AADC09D16FC, 0x00003FF7 //A12 = 5.1316445128621071486146117136e-03
+data8 0xFBFE2CE9215267A2, 0x0000BFF7 //A11= -7.6902121820788373000579382408e-03
+data8 0xBCC8EEAB67ECD91D, 0x00003FF8 //A10 = 1.1522515369164312742737727262e-02
+data8 0x8D1614BB97E5E8C2, 0x0000BFF9 //A9 = -1.7222443097804730395560633583e-02
+data8 0xD3A963578BE291E3, 0x00003FF9 //A8 = 2.5837606456090186343624210891e-02
+data8 0x9BA7EAE64C42FDF7, 0x0000BFFA //A7 = -3.8001935555045161419575037512e-02
+data8 0xF0115BA1A77607E7, 0x00003FFA //A6 = 5.8610303817173477119764956736e-02
+//
+// Polynomial coefficients for the tgammal(x), 1.75 <= |x| < 2.0 
+//A5 = 2.6698206874501426502654943818e-04 + 3.4033756836921062797887300000e-20
+data8 0x3F317F3740FE2A68, 0x3BE417093234B06E
+//A4 = 7.4249010753513894345090307070e-02 + 3.9810018444482764697014200000e-18
+data8 0x3FB301FBB0F25A92, 0x3C525BEFFABB622F
+//A3 = -8.1576919247086265851720554565e-02+ -5.2716624487804746360745000000e-19
+data8 0xBFB4E239984650AC, 0xBC2372F1C4F276FF
+data8 0xFEF3AEE71038E9A3, 0x00003FEB //A20 = 1.8995395865421509009969188571e-06
+data8 0xA11CFA2672BF876A, 0x0000BFEB //A19 =-1.2003868221414015771269244270e-06
+data8 0xF8E107215DAE2164, 0x00003FEC //A18 = 3.7085863210303833432006027217e-06
+data8 0xBCDDD3FC011EF7D6, 0x00003FEC //A17 = 2.8143303971756051015245433043e-06
+data8 0x8683C4687FA22E68, 0x00003FEE //A16 = 8.0177018464360416764308252462e-06
+data8 0xFDA09E5D33E32968, 0x00003FEE //A15 = 1.5117372062443781157389064848e-05
+data8 0xFFB00D0CFF4089B4, 0x00003FEF //A14 = 3.0480348961227424242198174995e-05
+data8 0xFEF6C39566785085, 0x00003FF0 //A13 = 6.0788135974125244644334004947e-05
+//A2 = 4.1184033042643969357854416558e-01 + 1.2103396182129232634761000000e-18
+data8 0x3FDA5B978B96BEBF, 0x3C3653AAD0A139E4
+//A1 = -4.2278433509846713445057275749e-01+ -4.9429151528135657430413000000e-18
+data8 0xBFDB0EE6072093CE, 0xBC56CB907027554F
+//A0 = 1.0000000000000000000000000000e+00 + 1.0969171200000000000000000000e-31
+data8 0x3FF0000000000000, 0x3981CC6A5B20B4D5
+data8 0xFF2B7BA9A8D68C37, 0x00003FF1 //A12 = 1.2167446884801403650547161615e-04
+data8 0xFCA53468E3692EF1, 0x00003FF2 //A11 = 2.4094136329542400976250900707e-04
+data8 0x808D698A9C993615, 0x00003FF4 //A10 = 4.9038845704938303659791698883e-04
+data8 0xF10F8E3FB8BB4AFB, 0x00003FF4 //A9 = 9.1957383840999861214472423976e-04
+data8 0x89E224E42F93F005, 0x00003FF6 //A8 = 2.1039333407187324139473634747e-03
+data8 0xBAF374824937A323, 0x00003FF6 //A7 = 2.8526458211545152218493600470e-03
+data8 0xB6BF7564F52140C6, 0x00003FF8 //A6 = 1.1154045718131014476684982178e-02
+//
+// Polynomial coefficients for the tgammal(x), 0.0 <= |x| < 0.125 
+//A5 = -9.8199506890314514073736518185e-01+ -5.9363811993837985890950900000e-17
+data8 0xBFEF6C80EC38B67A, 0xBC911C46B447C81F
+//A4 = 9.8172808683440015986576554496e-01 + 2.7457414262802803699834200000e-17
+data8 0x3FEF6A51055096B5, 0x3C7FA7FF90ACAD1F
+//A3 = -9.0747907608088618225394839101e-01 + -1.0676255850934306734701780000e-16
+data8 0xBFED0A118F324B62, 0xBC9EC5AFB633438D
+data8 0x9217E83FA207CB80, 0x00003FFD //A20 = 2.8533864762086088781083621561e-01
+data8 0xA8DABFA52FDF03EC, 0x0000BFFE //A19= -6.5958783896337186303285832783e-01
+data8 0xE331ED293AF39F9B, 0x00003FFE //A18 = 8.8748056656454687449654731184e-01
+data8 0xF9163C5DDB52419D, 0x0000BFFE //A17= -9.7299554149078295602977718525e-01
+data8 0xFEC0A1C672CB9265, 0x00003FFE //A16 = 9.9512683005268190987854104489e-01
+data8 0xFFD2D65B8EA7B5F4, 0x0000BFFE //A15= -9.9931087241443958201592847861e-01
+data8 0xFFF93AA39EE53445, 0x00003FFE //A14 = 9.9989668364186884793382816496e-01
+data8 0xFFFB99A9A3F5F480, 0x0000BFFE //A13= -9.9993286506283835663204999212e-01
+//A2 = 9.8905599532797250361682017683e-01 + 5.1778575360788420716540100000e-17
+data8 0x3FEFA658C23B1578, 0x3C8DD92B45408D07
+//A1 = -5.7721566490153275452712478000e-01+ -1.0607938730998824663273110000e-16
+data8 0xBFE2788CFC6FB618, 0xBC9E9346F8FDE55B
+//A0 = 9.9999999999999988897769753748e-01 + 1.1102230246251564036631420000e-16
+data8 0x3FEFFFFFFFFFFFFF, 0x3C9FFFFFFFFFFFFF
+data8 0xFFF7FEBB545812C1, 0x00003FFE //A12 = 9.9987785409425126648628395084e-01
+data8 0xFFF00C02E943A3F2, 0x0000BFFE //A11= -9.9975657530855116454438747397e-01
+data8 0xFFE0420AADC53820, 0x00003FFE //A10 = 9.9951565514290485919027183699e-01
+data8 0xFFC01EB42EF27EEB, 0x0000BFFE //A9 = -9.9902526759155739377365522320e-01
+data8 0xFF83DAD0BF23FF12, 0x00003FFE //A8 = 9.9810569378236378800364235948e-01
+data8 0xFEF9F8ABDBCDB2F3, 0x0000BFFE //A7 = -9.9600176044241699109053158187e-01
+data8 0xFE3F05375988491D, 0x00003FFE //A6 = 9.9314911462127599008937257662e-01
+LOCAL_OBJECT_END(Constants_Tgammal_poly_splitted)
+
+.align 64
+LOCAL_OBJECT_START(Constants_Tgammal_common)
+// Positive overflow value
+data8 0x3FE0000000000000 // 0.5
+data8 0x3FF8000000000000 // 1.5
+data8 0x3FD0000000000000 // 0.25
+data8 0x0000000000000000 // 0
+data8 0xDB718C066B352E21, 0x00004009 // Positive overflow value
+LOCAL_OBJECT_END(Constants_Tgammal_common)
+
+
+
+//=======================================================
+// Lgamma registers
+
+// General Purpose Registers
+GR_l_Log_Table        = r33
+GR_l_Log_Table1       = r34
+GR_l_BIAS             = r34
+GR_l_Index1           = r35
+GR_l_Index2           = r36
+GR_l_signif_Z         = r37 
+GR_l_X_0              = r38
+GR_l_X_1              = r39
+GR_l_X_2              = r40
+GR_l_Z_1              = r41
+GR_l_Z_2              = r42
+GR_l_N                = r43
+GR_l_Index3           = r44
+GR_l_Stirling_Table   = r45
+GR_l_N_Unbiased       = r46
+
+// Floating Point Registers
+FR_l_logl_X            = f8
+
+FR_l_h_3              = f10
+FR_l_poly_hi          = f10
+FR_l_W                = f11
+FR_l_S                = f12
+FR_l_GS_hi            = f13
+FR_l_Y_lo             = f13
+FR_l_r_cor            = f14
+FR_l_G_1              = f15
+FR_l_G                = f15
+FR_l_H_1              = f32
+FR_l_H                = f32
+FR_l_h                = f33
+FR_l_h_1              = f33
+FR_l_N                = f33
+FR_l_G_2              = f34
+FR_l_H_2              = f35
+FR_l_h_2              = f36
+FR_l_G_3              = f37
+FR_l_log2_hi          = f38
+FR_l_GS_lo            = f39
+FR_l_H_3              = f40
+FR_l_float_N          = f41
+FR_l_Q_4              = f42
+FR_l_Q_3              = f43
+FR_l_Q_2              = f44
+FR_l_Q_1              = f45
+FR_l_Q_5              = f46
+FR_l_Q_6              = f47
+FR_l_log2_lo          = f48
+FR_l_r                = f49
+FR_l_poly_lo          = f50
+FR_l_poly             = f51
+FR_l_rsq              = f52
+FR_l_Y_lo_res         = f53
+
+FR_l_Y0               = f55  
+FR_l_Q0               = f56  
+FR_l_E0               = f57  
+FR_l_E2               = f58  
+FR_l_E1               = f59  
+FR_l_Y1               = f60  
+FR_l_E3               = f61  
+FR_l_Y2               = f62  
+
+FR_l_Z                = f63    
+FR_l_Z2               = f64    
+FR_l_Z4               = f65    
+FR_l_Z8               = f66    
+                               
+FR_l_CH               = f67    
+FR_l_CL               = f68    
+
+FR_l_B2               = f69  
+FR_l_B4               = f70  
+FR_l_B6               = f71  
+FR_l_B8               = f72  
+FR_l_B10              = f73  
+FR_l_B12              = f74  
+FR_l_B14              = f75  
+FR_l_B16              = f76  
+FR_l_B18              = f77  
+FR_l_Half             = f78  
+FR_l_SS               = f79
+FR_l_AbsX_m_Half      = f80
+FR_l_CXH              = f81
+FR_l_CXL              = f82
+FR_l_SSCXH            = f83
+FR_l_SSCXL            = f84
+FR_l_XYH              = f85
+FR_l_XYL              = f86
+FR_l_Temp             = f87
+
+FR_l_logl_YHi         = f88
+FR_l_logl_YLo         = f89
+
+FR_l_SignedXYH        = f123
+
+FR_l_AbsX             = f127
+
+
+
+//=======================================================
+// Negative part registers
+
+// General Purpose Registers
+GR_n_sin_Table        = r47
+GR_n_XN               = r48
+
+// Float point registers
+FR_n_IXNS             = f125
+FR_n_IXN              = f126
+
+FR_n_XNS              = f90
+FR_n_XS               = f91
+FR_n_XS2              = f92
+FR_n_XS2L             = f93
+FR_n_XS4              = f94
+FR_n_XS7              = f95
+FR_n_XS8              = f96
+FR_n_TT               = f97
+FR_n_TH               = f98
+FR_n_TL               = f99
+
+FR_n_A2H              = f100     
+FR_n_A2L              = f101     
+FR_n_A1H              = f102     
+FR_n_A1L              = f103     
+FR_n_A9               = f104     
+FR_n_A8               = f105     
+FR_n_A7               = f106     
+FR_n_A6               = f107     
+FR_n_A5               = f108     
+FR_n_A4               = f109     
+FR_n_A3               = f110     
+
+FR_n_PolyH            = f111
+FR_n_PolyL            = f112
+
+FR_n_Poly1H           = f113
+FR_n_SinxH            = f113 // the same as FR_n_Poly1H
+FR_n_Poly1L           = f114
+FR_n_SinxL            = f114 // the same as FR_n_Poly1L
+
+FR_n_Tail             = f115
+FR_n_NegOne           = f116
+
+FR_n_Y0               = f117
+
+FR_n_Q0               = f118   
+FR_n_E0               = f119   
+                               
+FR_n_E2               = f120   
+FR_n_E1               = f121   
+                               
+FR_n_Y1               = f55    
+FR_n_E3               = f56    
+                               
+FR_n_Y2               = f57    
+FR_n_R0               = f58    
+
+FR_n_E4               = f59
+FR_n_RcpResH          = f60
+
+FR_n_Y3               = f61
+FR_n_R1               = f62
+FR_n_Temp             = f63
+
+FR_n_RcpResL          = f64
+
+FR_n_ResH             = f65
+FR_n_ResL             = f66
+
+
+
+
+//=======================================================
+// Exp registers
+
+// General Purpose Registers
+GR_e_ad_Arg           = r33
+GR_e_ad_A             = r34
+GR_e_signexp_x        = r35
+GR_e_exp_x            = r35
+GR_e_exp_mask         = r36
+GR_e_ad_W1            = r37
+GR_e_ad_W2            = r38
+GR_e_M2               = r39
+GR_e_M1               = r40
+GR_e_K                = r41
+GR_e_exp_2_mk         = r42
+GR_e_exp_2_k          = r43
+GR_e_ad_T1            = r44
+GR_e_ad_T2            = r45
+GR_e_N_fix            = r46
+GR_e_one              = r47
+GR_e_exp_bias         = r48
+GR_e_sig_inv_ln2      = r49
+GR_e_rshf_2to51       = r50
+GR_e_exp_2tom51       = r51
+GR_e_rshf             = r52
+
+// Floating Point Registers
+FR_e_RSHF_2TO51       = f10
+FR_e_INV_LN2_2TO63    = f11
+FR_e_W_2TO51_RSH      = f12
+FR_e_2TOM51           = f13
+FR_e_RSHF             = f14
+FR_e_Y_hi             = f15
+FR_e_Y_lo             = f32
+FR_e_scale            = f33
+FR_e_float_N          = f34
+FR_e_N_signif         = f35
+FR_e_L_hi             = f36
+FR_e_L_lo             = f37
+FR_e_r                = f38
+FR_e_W1               = f39
+FR_e_T1               = f40
+FR_e_W2               = f41
+FR_e_T2               = f42
+FR_e_W1_p1            = f43
+FR_e_rsq              = f44
+FR_e_A2               = f45
+FR_e_r4               = f46
+FR_e_A3               = f47
+FR_e_poly             = f48
+FR_e_T                = f49
+FR_e_W                = f50
+FR_e_Wp1              = f51
+FR_e_r6               = f52
+FR_e_2_mk             = f53
+FR_e_A1               = f54
+FR_e_T_scale          = f55
+FR_e_result_lo        = f56
+FR_e_W_T_scale        = f57
+FR_e_Wp1_T_scale      = f58
+
+FR_e_expl_Input_X     = f123
+FR_e_expl_Input_Y     = f124
+FR_e_expl_Output_X    = f123
+FR_e_expl_Output_Y    = f124
+
+
+FR_e_expl_Input_AbsX  = f122
+
+
+
+//=======================================================
+// Common registers
+
+// General Purpose Registers
+GR_c_Table            = r53
+GR_c_NegUnderflow     = r54
+GR_c_NegSingularity   = r55
+GR_c_X                = r56
+GR_c_SignBit          = r57
+GR_c_13               = r58
+
+
+// Floating Point Registers
+FR_c_PosOverflow      = f123
+FR_c_XN               = f124
+
+
+//=======================================================
+// Polynomial part registers
+
+// General Purpose Registers
+GR_p_Table            = r59
+GR_p_XN               = r33
+GR_p_Table2           = r34
+GR_p_Int              = r35
+GR_p_Offset           = r36
+GR_p_Offset2          = r38
+GR_p_X_Sgnd           = GR_l_signif_Z // = r37
+GR_p_Exp              = r61
+GR_p_Bias             = r62
+GR_p_0p75             = r63
+
+// Floating Point Registers
+FR_p_AbsX             = FR_l_AbsX // = f127
+FR_p_IXN              = FR_n_IXN  // = f126
+FR_p_XN               = f32
+FR_p_0p5              = f33
+FR_p_1p5              = f34
+FR_p_AbsXM1           = f35
+FR_p_2                = f36
+
+FR_p_A20              = f37 
+FR_p_A19              = f38 
+FR_p_A18              = f39 
+FR_p_A17              = f40 
+FR_p_A16              = f41 
+FR_p_A15              = f42 
+FR_p_A14              = f43 
+FR_p_A13              = f44 
+FR_p_A12              = f45 
+FR_p_A11              = f46 
+FR_p_A10              = f47 
+FR_p_A9               = f48 
+FR_p_A8               = f49 
+FR_p_A7               = f50 
+FR_p_A6               = f51 
+FR_p_A5H              = f52 
+FR_p_A5L              = f53 
+FR_p_A4H              = f54 
+FR_p_A4L              = f55 
+FR_p_A3H              = f56 
+FR_p_A3L              = f57 
+FR_p_A2H              = f58 
+FR_p_A2L              = f59 
+FR_p_A1H              = f60 
+FR_p_A1L              = f61 
+FR_p_A0H              = f62 
+FR_p_A0L              = f63 
+
+FR_p_XR               = f64
+FR_p_XR2              = f65 
+FR_p_XR2L             = f52 
+
+FR_p_XR3              = f58 
+FR_p_XR3L             = f38 
+
+FR_p_XR4              = f42 
+FR_p_XR6              = f40 
+FR_p_XR8              = f37 
+
+FR_p_Poly5H           = f66 
+FR_p_Poly5L           = f67 
+FR_p_Poly4H           = f53 
+FR_p_Poly4L           = f44 
+FR_p_Poly3H           = f41 
+FR_p_Poly3L           = f47 
+FR_p_Poly2H           = f68 
+FR_p_Poly2L           = f54 
+FR_p_Poly1H           = f55 
+FR_p_Poly1L           = f46 
+FR_p_Poly0H           = f39 
+FR_p_Poly0L           = f43 
+                            
+FR_p_Temp5H           = f69 
+FR_p_Temp5L           = f70 
+FR_p_Temp4H           = f71 
+FR_p_Temp4L           = f60 
+FR_p_Temp2H           = f72 
+FR_p_Temp2L           = f73 
+FR_p_Temp1H           = f59 
+FR_p_Temp1L           = f61 
+FR_p_Temp0H           = f49 
+FR_p_Temp0L           = f48 
+FR_p_PolyTail         = f45 
+FR_p_OddPoly0H        = f56 
+FR_p_OddPoly0L        = f51 
+
+FR_p_0p25             = f73
+
+
+//=======================================================
+// Negative polynomial part registers
+// General Purpose Registers
+GR_r_sin_Table        = r47 
+GR_r_sin_Table2       = r60 
+
+// Floating Point Registers
+FR_r_IXNS             = FR_n_IXNS 
+FR_r_IXN              = FR_n_IXN 
+
+FR_r_AbsX             = FR_l_AbsX
+
+FR_r_A9               = f74  
+FR_r_A8               = f75  
+FR_r_A7               = f76  
+FR_r_A6               = f77  
+FR_r_A5               = f78  
+FR_r_A4               = f79  
+FR_r_A3               = f80  
+FR_r_A2H              = f81  
+FR_r_A2L              = f82  
+FR_r_A1H              = f83  
+FR_r_A1L              = f84  
+
+FR_r_XNS              = f85 
+FR_r_XS               = f86 
+FR_r_XS2              = f87 
+FR_r_XS2L             = f88 
+FR_r_XS4              = f89 
+FR_r_XS7              = f90 
+FR_r_XS8              = f91 
+
+FR_r_Tail             = f92
+
+FR_r_TT               = f93 
+FR_r_TH               = f94 
+FR_r_TL               = f95 
+
+FR_r_ResH             = f96
+FR_r_ResL             = f97
+
+FR_r_Res3H            = f98   
+FR_r_Res3L            = f99   
+                              
+FR_r_Res1H            = f100  
+FR_r_Res1L            = f101  
+
+
+
+FR_r_Y0               = f102  
+FR_r_Q0               = f103  
+FR_r_E0               = f104  
+FR_r_E2               = f105  
+FR_r_E1               = f106  
+FR_r_Y1               = f107  
+FR_r_E3               = f108  
+FR_r_Y2               = f109  
+FR_r_R0               = f110  
+FR_r_E4               = f111  
+FR_r_ZH               = f112  
+FR_r_Y3               = f113  
+FR_r_R1               = f114  
+FR_r_ZHN              = f115
+FR_r_ZL               = f115
+FR_r_NegOne           = f116
+
+FR_z_Y0               = f102 
+FR_z_Q0               = f103 
+FR_z_E0               = f104 
+FR_z_E2               = f105 
+FR_z_E1               = f106 
+FR_z_Y1               = f107 
+FR_z_E3               = f108 
+FR_z_Y2               = f109 
+FR_z_R0               = f110 
+FR_z_E4               = f111 
+FR_z_ZH               = f112 
+FR_z_Y3               = f113 
+FR_z_R1               = f114 
+FR_z_ZL               = f115 
+
+
+// General Purpose Registers
+GR_SAVE_PFS           = r32
+GR_DenOverflow        = r33
+GR_u_XN               = r34
+
+GR_SAVE_B0            = r35 
+GR_SAVE_GP            = r36 
+GR_SAVE_SP            = r37 
+
+// Floating Point Registers
+FR_u_IXN              = f34
+
+
+// ERROR HANDLER REGISTERS
+GR_Parameter_X        = r64
+GR_Parameter_Y        = r65
+GR_Parameter_RESULT   = r66
+GR_Parameter_TAG      = r67
+
+FR_RESULT             = f8
+FR_X                  = f32 
+FR_Y                  = f1
+
+
+.section .text
+GLOBAL_LIBM_ENTRY(tgammal)
+{ .mfi
+      alloc         r32            = ar.pfs,0,32,4,0
+      fabs          FR_l_AbsX      = f8 // Get absolute value of X
+      addl          GR_n_sin_Table = @ltoff(Constants_Tgammal_sin), gp 
+}
+{ .mfi 
+      addl          GR_l_Log_Table=@ltoff(Constants_Tgammal_log_80_Z_G_H_h1#),gp
+      nop.f         0
+      addl          GR_l_Stirling_Table = @ltoff(Constants_Tgammal_stirling), gp
+};;
+
+{ .mfi
+      getf.sig      GR_l_signif_Z  = f8 // Significand of X
+      fcvt.fx.s1    FR_n_IXNS      = f8 // Convert to fixed point
+      addl          GR_c_Table     = @ltoff(Constants_Tgammal_common), gp
+}
+{ .mfi
+      ld8           GR_l_Log_Table = [GR_l_Log_Table]
+      nop.f         0
+      addl          GR_p_Table     = @ltoff(Constants_Tgammal_poly), gp
+};;
+
+{ .mfi
+      ld8           GR_n_sin_Table = [GR_n_sin_Table] 
+      fclass.m      p6,p0          = f8,0x1EF // Check x for NaN, 0, INF, denorm
+                                              // NatVal.
+      addl          GR_c_NegSingularity = 0x1003E, r0
+}
+{ .mlx
+      ld8           GR_l_Stirling_Table = [GR_l_Stirling_Table]
+      movl          GR_c_13        = 0x402A000000000000 // 13.0
+};;
+
+{ .mfi
+      getf.d        GR_c_X         = f8 // Double prec. X to general register
+      frcpa.s1      FR_z_Y0,p0     = f1,f8 // y = frcpa(x) (for negatives)
+      extr.u        GR_l_Index1    = GR_l_signif_Z, 59, 4 // = High 4 bits of Z
+}
+{ .mlx
+      ld8           GR_c_Table     = [GR_c_Table]
+      movl          GR_c_SignBit   = 0x8000000000000000 // High bit (sign)
+};;
+
+{ .mfi
+      ld8           GR_p_Table     = [GR_p_Table] 
+      fcmp.lt.s1    p15, p14       = f8,f0 // p14 - positive arg, p15 - negative
+      shl           GR_l_Index1    = GR_l_Index1,5 // Adjust Index1 ptr (x32) 
+}
+{ .mfb
+      adds          GR_c_NegUnderflow = 1765, r0
+      nop.f         0
+(p6)  br.cond.spnt  tgammal_spec  // Spec. values processing branch ////////////
+                                  // (0s, INFs, NANs, NatVals, denormals) //////
+};;
+
+{ .mfi
+      ldfpd         FR_l_CH,FR_l_CL= [GR_l_Stirling_Table], 16 // Load CH, CL
+      fcvt.fx.trunc.s1 FR_n_IXN    = FR_l_AbsX // Abs arg to int by trunc
+      extr.u        GR_l_X_0       = GR_l_signif_Z, 49, 15  //  High 15 bit of Z
+}
+{ .mfi
+      add           GR_l_Index1    = GR_l_Index1,GR_l_Log_Table  // Add offset
+      fma.s1        FR_p_2         = f1, f1, f1 // 2.0
+      andcm         GR_c_X         = GR_c_X, GR_c_SignBit // Remove sign
+};;
+
+{ .mfi 
+      addl       GR_l_Log_Table = @ltoff(Constants_Tgammal_log_80_Z_G_H_h2#), gp
+      fcmp.lt.s1    p10, p0        = FR_l_AbsX, f1 // If |X|<1 then p10 = 1
+      nop.i         0
+}
+{ .mlx
+      ld2           GR_l_Z_1       = [GR_l_Index1],4 // load Z_1 from Index1
+      movl          GR_l_BIAS      = 0x000000000000FFFF // Bias for exponent
+};;
+
+{ .mfi 
+      ld8           GR_l_Log_Table = [GR_l_Log_Table]
+      frcpa.s1      FR_l_Y0, p0    = f1, FR_l_AbsX // y = frcpa(x)
+      nop.i         0
+}
+{ .mfi
+      ldfs          FR_l_G_1       = [GR_l_Index1],4  //  Load G_1 
+      fsub.s1       FR_l_W         = FR_l_AbsX, f1 // W = |X|-1
+      nop.i         0
+};;
+
+{ .mfi 
+      getf.exp      GR_l_N_Unbiased=  FR_l_AbsX // exponent of |X|
+      fmerge.se     FR_l_S         = f1, FR_l_AbsX //  S = merging of X and 1.0
+      cmp.gtu       p11, p0        = GR_c_13, GR_c_X // If 1 <= |X| < 13 
+                                                     // then p11 = 1
+}
+{ .mfb
+      ldfs          FR_l_H_1       = [GR_l_Index1],8 // Load H_1
+      fcvt.xf       FR_n_XNS       = FR_n_IXNS // Convert to FP repr. of int X
+(p10) br.cond.spnt  tgamma_lt_1    // Branch to |X| < 1 path ///////////////////
+};;
+
+{ .mfi 
+      ldfpd         FR_n_A2H, FR_n_A2L = [GR_n_sin_Table], 16 
+      nop.f         0
+      pmpyshr2.u    GR_l_X_1       = GR_l_X_0,GR_l_Z_1,15 // Adjust Index2 (x32)
+}
+{ .mfb 
+      ldfe          FR_l_B2        = [GR_l_Stirling_Table], 16 
+      nop.f         0
+(p11) br.cond.spnt  tgamma_lt_13 // Branch to 1 <= |X| < 13 path ///////////////
+};;
+
+{ .mfi 
+      ldfe          FR_l_h_1       = [GR_l_Index1],0 
+      nop.f         0
+      sub           GR_l_N         = GR_l_N_Unbiased, GR_l_BIAS  //  N - BIAS
+}
+{ .mib 
+      ldfpd         FR_l_B4,FR_l_B6= [GR_l_Stirling_Table], 16 // Load C
+(p15) cmp.geu.unc   p8,p0          = GR_l_N_Unbiased, GR_c_NegSingularity
+(p8)  br.cond.spnt  tgammal_singularity // Singularity for arg < to -2^63 //////
+};;
+
+{ .mmi 
+(p15) ldfpd         FR_n_A1H, FR_n_A1L = [GR_n_sin_Table], 16 
+      ldfpd         FR_l_B8, FR_l_B10  = [GR_l_Stirling_Table], 16
+      add           GR_c_Table         = 0x20, GR_c_Table 
+};;
+
+{ .mfi
+(p15) ldfe          FR_n_A9        = [GR_n_sin_Table], 16 
+      fma.s1        FR_l_Q0        = f1,FR_l_Y0,f0 // Q0 = Y0 
+      nop.i         0
+}
+{ .mfi 
+      ldfpd         FR_l_B12, FR_l_B14 = [GR_l_Stirling_Table], 16 
+      fnma.s1       FR_l_E0        = FR_l_Y0,FR_l_AbsX,f1 // e = 1-b*y 
+      nop.i         0
+};;
+
+{ .mfi 
+(p15) ldfe          FR_n_A8        = [GR_n_sin_Table], 16 
+      fcvt.xf       FR_c_XN        = FR_n_IXN // Convert to FP repr. of int X
+      extr.u        GR_l_Index2    = GR_l_X_1, 6, 4  // Extract Index2 
+}
+{ .mfi 
+      ldfpd         FR_l_B16, FR_l_B18 = [GR_l_Stirling_Table], 16
+      nop.f         0
+      nop.i         0
+};;
+
+{ .mfi 
+(p15) ldfe          FR_n_A7        = [GR_n_sin_Table], 16 
+      fms.s1        FR_l_CXH       = FR_l_CH, f1, FR_l_AbsX // CXH = CH+|X|
+      shl           GR_l_Index2    = GR_l_Index2,5
+}
+{ .mfi 
+      ldfd          FR_l_Half      = [GR_l_Stirling_Table] // Load 0.5
+      nop.f         0
+      nop.i         0
+};;
+
+{ .mfi 
+      add           GR_l_Index2    = GR_l_Index2, GR_l_Log_Table  // Add offset
+      nop.f         0
+      nop.i         0
+}
+{ .mfi 
+(p15) ldfe          FR_n_A6        = [GR_n_sin_Table], 16 
+(p15) fma.s1        FR_n_XS        = FR_l_AbsX , f1, FR_n_XNS // xs = x - int(x)
+      nop.i         0
+};;
+
+{ .mmi 
+      ld2           GR_l_Z_2       = [GR_l_Index2],4 
+      addl          GR_l_Log_Table = @ltoff(Constants_Tgammal_log_80_h3_G_H#),gp
+      nop.i         0
+};;
+
+{ .mfi 
+      ld8           GR_l_Log_Table = [GR_l_Log_Table]
+      fma.s1        FR_l_E2        = FR_l_E0,FR_l_E0,FR_l_E0 // e2 = e+e^2
+      nop.i         0
+}
+{ .mfi 
+      ldfs          FR_l_G_2       = [GR_l_Index2],4 
+      fma.s1        FR_l_E1        = FR_l_E0,FR_l_E0,f0 // e1 = e^2
+      nop.i         0
+};;
+
+{ .mmi 
+      ldfs          FR_l_H_2       = [GR_l_Index2],8  
+(p15) ldfe          FR_n_A5        = [GR_n_sin_Table], 16 
+      nop.i         0
+};;
+
+{ .mfi 
+      setf.sig      FR_l_float_N   = GR_l_N //    float_N = Make N a fp number
+      nop.f         0
+      pmpyshr2.u    GR_l_X_2       = GR_l_X_1,GR_l_Z_2,15  // X_2 = X_1 * Z_2 
+}
+{ .mfi 
+      ldfe          FR_l_h_2       = [GR_l_Index2],0 
+      fma.s1        FR_l_CXL       = FR_l_AbsX, f1, FR_l_CXH // CXL = |X|+CXH
+      add           GR_l_Log_Table1= 0x200, GR_l_Log_Table
+};;
+
+{ .mfi 
+(p15) ldfe          FR_n_A4        = [GR_n_sin_Table], 16 
+(p15) fcmp.eq.unc.s1 p9,p0         = FR_l_AbsX, FR_c_XN //if argument is integer
+                                                        // and negative
+      nop.i         0
+}
+{ .mfi 
+      ldfe          FR_c_PosOverflow = [GR_c_Table],16 //Load pos overflow value
+(p15) fma.s1        FR_n_XS2         = FR_n_XS, FR_n_XS, f0 // xs^2 = xs*xs
+      nop.i         0
+};;
+
+{ .mfi 
+(p15) ldfe          FR_n_A3        = [GR_n_sin_Table], 16 
+      nop.f         0 
+      nop.i         0
+};;
+
+{ .mfi 
+(p15) getf.sig      GR_n_XN        = FR_n_IXN // int(x) to general reg
+      fma.s1        FR_l_Y1        = FR_l_Y0,FR_l_E2,FR_l_Y0 // y1 = y+y*e2
+      nop.i         0 
+}
+{ .mfb 
+      nop.m         0 
+      fma.s1        FR_l_E3        = FR_l_E1,FR_l_E1,FR_l_E0 // e3 = e+e1^2
+(p9)  br.cond.spnt  tgammal_singularity // Singularity for integer /////////////
+                                        // and negative arguments //////////////
+};;
+
+{ .mfi 
+      nop.m         0
+      fms.s1        FR_l_AbsX_m_Half = FR_l_AbsX, f1, FR_l_Half // |x|-0.5
+      extr.u        GR_l_Index2      = GR_l_X_2, 1, 5   //  Get Index3
+};;
+
+{ .mfi 
+      shladd        GR_l_Log_Table1= GR_l_Index2, 2, GR_l_Log_Table1 
+      nop.f         0
+      shladd        GR_l_Index3    = GR_l_Index2,4, GR_l_Log_Table  // Index3
+}
+{ .mfb
+(p15) cmp.gtu.unc   p11, p0        = GR_n_XN, GR_c_NegUnderflow // X < -1765
+      fms.s1        FR_l_CXL       = FR_l_CH, f1, FR_l_CXL // CXL = CH - CXL
+(p11) br.cond.spnt tgammal_underflow // Singularity for negative argument //////
+                                     // at underflow domain (X < -1765) //////
+};;
+
+{ .mfi 
+      addl          GR_l_Log_Table = @ltoff(Constants_Tgammal_log_80_Q#), gp 
+(p15) fma.s1        FR_n_TT        = FR_n_A2L, FR_n_XS2, f0 // T=A2L*x^2
+      tbit.nz.unc   p13, p12       = GR_n_XN, 0x0 // whether [X] odd or even 
+}
+{ .mfi
+      nop.m         0
+(p15) fms.s1        FR_n_XS2L      = FR_n_XS, FR_n_XS, FR_n_XS2 // xs^2 Low part
+      nop.i         0
+};;
+
+{ .mfi 
+      ld8           GR_l_Log_Table = [GR_l_Log_Table] 
+(p15) fma.s1        FR_n_A7        = FR_n_A8,  FR_n_XS2, FR_n_A7 // poly tail
+      nop.i 0 
+}
+{ .mfi 
+      ldfe          FR_l_h_3       = [GR_l_Index3],12 
+(p15) fma.s1        FR_n_XS4       = FR_n_XS2, FR_n_XS2, f0 // xs^4 = xs^2*xs^2
+      nop.i 0 
+};;
+
+{ .mfi 
+      ldfs          FR_l_H_3       = [GR_l_Log_Table1], 0 
+      fma.s1        FR_l_Y2        = FR_l_Y1, FR_l_E3, FR_l_Y0 // y2 = y+y1*e3
+      nop.i         0 
+}
+{ .mfi 
+      ldfs          FR_l_G_3       = [GR_l_Index3], 0 
+      fnma.s1       FR_l_Z         = FR_l_AbsX,FR_l_Q0,f1 // r = a-b*q
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fmpy.s1       FR_l_G         = FR_l_G_1, FR_l_G_2 // G = G1 * G_2
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fadd.s1       FR_l_H         = FR_l_H_1, FR_l_H_2 // H = H_1 + H_2
+      nop.i         0
+};;
+
+{ .mfi 
+      ldfe          FR_l_log2_hi   = [GR_l_Log_Table],16 //  load log2_hi part
+      fadd.s1       FR_l_h         = FR_l_h_1, FR_l_h_2  //  h = h_1 + h_2 
+      nop.i         0
+}
+{ .mfi
+      nop.m         0 
+      fcvt.xf       FR_l_float_N   = FR_l_float_N // int(N)
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_l_log2_lo   = [GR_l_Log_Table],16 //  Load log2_lo part
+      fma.s1        FR_l_CXL       = FR_l_CXL, f1, FR_l_CL
+      nop.i 0 
+}
+{ .mfi
+      nop.m         0 
+(p15) fma.s1        FR_n_TT        = FR_n_A2H, FR_n_XS2L, FR_n_TT // T=A2H*x2L+T
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_l_Q_6       = [GR_l_Log_Table],16 
+(p15) fma.s1        FR_n_A3        = FR_n_A4,  FR_n_XS2, FR_n_A3 // poly tail
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0 
+(p15) fma.s1        FR_n_A5        = FR_n_A6,  FR_n_XS2, FR_n_A5 // poly tail
+      nop.i 0 
+};;
+
+{ .mfi 
+      ldfe          FR_l_Q_5       = [GR_l_Log_Table],16  
+(p15) fabs          FR_n_XS        = FR_n_XS // abs(xs)
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_l_Z         = FR_l_Z,FR_l_Y2,FR_l_Q0 // x_hi = q+r*y2
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_l_Q_4       = [GR_l_Log_Table],16 
+(p15) fma.s1        FR_n_A7        = FR_n_A9,  FR_n_XS4, FR_n_A7 // poly tail
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0 
+(p15) fma.s1        FR_n_XS7       = FR_n_XS4, FR_n_XS2, f0 // = x^4*x^2
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_l_Q_3       = [GR_l_Log_Table],16  
+      fneg          FR_n_NegOne    = f1 // -1.0
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0 
+(p15) fma.s1        FR_n_XS8       = FR_n_XS4, FR_n_XS4, f0 // xs^8 = xs^4*xs^4
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_l_Q_2       = [GR_l_Log_Table],16 
+      fadd.s1       FR_l_h         = FR_l_h, FR_l_h_3 //  h = h_1 + h_2 + h_3   
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0 
+(p15) fma.s1        FR_n_TH        = FR_n_A2H, FR_n_XS2, FR_n_TT // A2H*xs2+T
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_l_Q_1       = [GR_l_Log_Table],16 
+      fmpy.s1       FR_l_G         = FR_l_G, FR_l_G_3 // G = G_1 * G_2 * G_3 
+      nop.i         0 
+}
+{ .mfi
+      nop.m         0
+      fadd.s1       FR_l_H         = FR_l_H, FR_l_H_3 // H = H_1 + H_2 + H_3 
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_Z2        = FR_l_Z, FR_l_Z, f0 // Z^2
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fma.s1        FR_n_A3        = FR_n_A5,  FR_n_XS4, FR_n_A3 // poly tail
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p14) fcmp.gt.unc.s1 p7,p0         = FR_l_AbsX, FR_c_PosOverflow //X > 1755.5483
+              // (overflow domain, result cannot be represented by normal value)
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_XS7       = FR_n_XS7, FR_n_XS,  f0 // x^7 construction
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fms.s1        FR_n_TL        = FR_n_A2H, FR_n_XS2, FR_n_TH // A2H*xs2+TH
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fma.s1        FR_n_PolyH     = FR_n_TH, f1, FR_n_A1H // PolyH=TH+A1H
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fmpy.s1       FR_l_GS_hi     = FR_l_G, FR_l_S // GS_hi = G*S
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+      fms.s1        FR_l_r         = FR_l_G, FR_l_S, f1 // r = G*S -1
+(p7)  br.cond.spnt  tgammal_overflow // Overflow path for arg > 1755.5483 //////
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_B14       = FR_l_B16, FR_l_Z2, FR_l_B14// bernulli tail
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_Z4        = FR_l_Z2, FR_l_Z2, f0 // Z^4 = Z^2*Z^2
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_B2        = FR_l_B4, FR_l_Z2, FR_l_B2 // bernulli tail
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_l_B6        = FR_l_B8, FR_l_Z2, FR_l_B6 // bernulli tail
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_B10       = FR_l_B12, FR_l_Z2, FR_l_B10// bernulli tail
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fma.s1        FR_n_Tail      = FR_n_A7,  FR_n_XS8, FR_n_A3 // poly tail
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_TL        = FR_n_TL, f1, FR_n_TT // TL = TL+T
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fms.s1        FR_n_PolyL     = FR_n_A1H, f1, FR_n_PolyH // polyH+A1H
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_poly_lo   = FR_l_r, FR_l_Q_6, FR_l_Q_5 // Q_5+r*Q_6
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fsub.s1       FR_l_r_cor     = FR_l_GS_hi, f1 //     r_cor = GS_hi -1
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fms.s1        FR_l_GS_lo     = FR_l_G, FR_l_S, FR_l_GS_hi // G*S-GS_hi
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_l_poly      = FR_l_r, FR_l_Q_2, FR_l_Q_1 //poly=r*Q2+Q1
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fmpy.s1       FR_l_rsq       = FR_l_r, FR_l_r // rsq = r * r
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_l_G         = FR_l_float_N, FR_l_log2_hi, FR_l_H // Tbl =
+                                                        // float_N*log2_hi + H
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m 0 
+      fma.s1        FR_l_Y_lo      = FR_l_float_N, FR_l_log2_lo, FR_l_h // Y_lo=
+                                                       // float_N*log2_lo + h
+      nop.i 0 
+}
+{ .mfi
+      nop.m 0 
+      fma.s1        FR_l_B14       = FR_l_B18, FR_l_Z4, FR_l_B14 //bernulli tail
+      nop.i 0 
+};;
+
+{ .mfi 
+      nop.m 0 
+      fma.s1        FR_l_B2        = FR_l_B6, FR_l_Z4, FR_l_B2 //bernulli tail
+      nop.i 0 
+}
+{ .mfi
+      nop.m 0 
+      fma.s1        FR_l_Z8        = FR_l_Z4, FR_l_Z4, f0 //bernulli tail
+      nop.i 0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_poly_lo   = FR_l_r, FR_l_poly_lo, FR_l_Q_4 // poly_lo =
+                                                            // Q_4 + r * poly_lo
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fsub.s1       FR_l_r_cor     = FR_l_r_cor, FR_l_r // r_cor = r_cor - r
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_PolyL     = FR_n_PolyL, f1, FR_n_TH // polyL+TH
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fma.s1        FR_n_TT        = FR_n_TL, f1, FR_n_A1L // TL+A1L
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fadd.s1       FR_l_logl_YHi  = FR_l_G, FR_l_r // Y_hi = Tbl + r 
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_B10       = FR_l_B14, FR_l_Z4, FR_l_B10 //bernulli tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_poly_lo   = FR_l_r, FR_l_poly_lo, FR_l_Q_3 // poly_lo =
+                                                          // Q_3 + r * poly_lo
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fadd.s1       FR_l_r_cor     = FR_l_r_cor, FR_l_GS_lo // r_cor=r_cor+GS_lo
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_PolyL     = FR_n_PolyL, f1, FR_n_TT // polyL+TT
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fsub.s1       FR_l_Y_lo_res  = FR_l_G, FR_l_logl_YHi // Y_lo = Tbl - Y_hi 
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_l_XYH       = FR_l_logl_YHi, FR_l_AbsX_m_Half, f0 // XYH=
+                                          // YHi*|x-0.5|
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_SS        = FR_l_B10, FR_l_Z8, FR_l_B2 // bernulli tail
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fadd.s1       FR_l_r_cor     = FR_l_r_cor, FR_l_Y_lo // r_cor = r_cor+Y_lo
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_l_poly      = FR_l_rsq, FR_l_poly_lo, FR_l_poly //poly=
+                                                            // r^2*polyLo+poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_TT        = FR_n_PolyL, FR_n_XS2, f0 // T=polyL*xs^2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0
+      fadd.s1       FR_l_Y_lo      = FR_l_Y_lo_res, FR_l_r // Y_lo =  Y_lo + r
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fms.s1        FR_l_XYL       = FR_l_logl_YHi, FR_l_AbsX_m_Half, FR_l_XYH
+                                                      // XYL = YHi*|x-0.5|-XYH
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_SSCXH     = FR_l_SS, FR_l_Z, FR_l_CXH // SS*Z+CXH
+      nop.i         0
+}
+{ .mfi
+      mov           GR_e_exp_2tom51= 0xffff-51 // 2^-51
+(p15) fma.s1        FR_l_SignedXYH = FR_l_XYH, FR_n_NegOne, f0 // XYH = -XYH
+                                                            // for negatives
+      nop.i         0
+};;
+
+{ .mlx 
+      nop.m         0
+      movl          GR_e_rshf_2to51  = 0x4718000000000000   // 1.10000 2^(63+51)
+}
+{ .mlx
+      nop.m         0
+      movl          GR_e_sig_inv_ln2 = 0xb8aa3b295c17f0bc //significand of 1/ln2
+};;
+
+{ .mfi
+      nop.m         0
+      fma.s1        FR_l_poly      = FR_l_rsq, FR_l_poly, FR_l_r_cor // poly = 
+                                                        // rsq * poly + r_cor
+      nop.i         0 
+};;
+
+{ .mfi 
+      addl          GR_e_ad_Arg    = @ltoff(Constants_Tgammal_exp_64_Arg#),gp
+(p15) fma.s1        FR_n_TT        = FR_n_PolyH, FR_n_XS2L, FR_n_TT  
+      mov           GR_e_exp_mask  = 0x1FFFF          // Form exponent mask
+}
+{ .mlx
+      nop.m         0
+      movl          GR_e_rshf      = 0x43e8000000000000  // 1.10000 2^63 rshift
+};;
+
+
+{ .mmi 
+      setf.sig      FR_e_INV_LN2_2TO63 = GR_e_sig_inv_ln2 // form 1/ln2 * 2^63
+      setf.d        FR_e_RSHF_2TO51    = GR_e_rshf_2to51 //  1.1000 * 2^(63+51)
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fms.s1        FR_l_SSCXL     = FR_l_CXH, f1, FR_l_SSCXH // CXH+SS*CXH
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_e_expl_Input_AbsX = FR_l_XYH, f1, FR_l_SSCXH // HI EXP 
+      nop.i         0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m         0
+(p14) fma.s1        FR_e_expl_Input_X = FR_l_XYH, f1, FR_l_SSCXH // HI EXP
+      mov           GR_e_exp_bias     = 0x0FFFF  // Set exponent bias
+}
+{ .mfi
+      ld8           GR_e_ad_Arg       = [GR_e_ad_Arg] // Point to Arg table
+(p15) fms.s1        FR_e_expl_Input_X = FR_l_SignedXYH, f1, FR_l_SSCXH // HI EXP
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fadd.s1       FR_l_logl_YLo  = FR_l_Y_lo, FR_l_poly // YLo = YLo+poly
+      nop.i         0
+};;
+
+{ .mfi 
+      setf.exp      FR_e_2TOM51    = GR_e_exp_2tom51 //2^-51 for scaling float_N
+(p15) fma.s1        FR_n_TH        = FR_n_PolyH, FR_n_XS2, FR_n_TT // TH=
+                                                           // polyH*xs^2+T
+      nop.i         0
+}
+{ .mib
+      setf.d        FR_e_RSHF     = GR_e_rshf // Right shift const 1.1000*2^63
+      nop.i 0
+      nop.b 0
+};;
+
+{ .mfi 
+      add           GR_e_ad_A      = 0x20, GR_e_ad_Arg // Point to A table
+      nop.f         0
+      add           GR_e_ad_T1     = 0x50, GR_e_ad_Arg // Point to T1 table
+}
+{ .mfi
+      add           GR_e_ad_T2     = 0x150, GR_e_ad_Arg // Point to T2 table
+      nop.f         0
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_SSCXL     =   FR_l_SS, FR_l_Z,  FR_l_SSCXL
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fms.s1        FR_e_expl_Input_Y = FR_l_XYH, f1, FR_e_expl_Input_AbsX
+      nop.i         0
+};;
+
+{ .mfi 
+      ldfe          FR_e_L_hi      = [GR_e_ad_Arg],16 // Get L_hi
+      nop.f         0
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_XYL       = FR_l_logl_YLo, FR_l_AbsX_m_Half, FR_l_XYL
+                                                     // XYL = YLo*|x-0.5|+XYL
+      nop.i         0
+};;
+
+{ .mfi 
+      ldfe          FR_e_L_lo      = [GR_e_ad_Arg],16     // Get L_lo
+(p15) fms.s1        FR_n_TL        = FR_n_PolyH, FR_n_XS2, FR_n_TH // TL = 
+                                                          // = polyH*xs^2-TH
+      add           GR_e_ad_W1     = 0x100, GR_e_ad_T2   // Point to W1 table
+}
+{ .mfi
+      nop.m         0
+(p15) fma.s1        FR_n_Poly1H    = FR_n_TH, f1, f1 // poly1H = TH+1
+      add           GR_e_ad_W2     = 0x300, GR_e_ad_T2 // Point to W2 table
+};;
+
+{ .mmi 
+      getf.exp      GR_e_signexp_x = FR_e_expl_Input_X // Extract sign and exp
+      ldfe          FR_e_A3        = [GR_e_ad_A],16     // Get A3 
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_SSCXL     = FR_l_SSCXL, f1, FR_l_CXL
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_e_expl_Input_Y = FR_e_expl_Input_Y, f1, FR_l_SSCXH
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1  FR_e_N_signif=FR_e_expl_Input_X,FR_e_INV_LN2_2TO63,FR_e_RSHF_2TO51
+      and           GR_e_exp_x     = GR_e_signexp_x, GR_e_exp_mask
+};;
+
+{ .mmi 
+      sub           GR_e_exp_x     = GR_e_exp_x, GR_e_exp_bias // Get exponent
+      ldfe          FR_e_A2        = [GR_e_ad_A],16     // Get A2 for main path
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_PolyH     =    FR_n_Poly1H, FR_n_XS, f0//sin(Pi*x) poly
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fms.s1        FR_n_Poly1L    =    f1, f1, FR_n_Poly1H//sin(Pi*x) poly
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_TL        =    FR_n_TL, f1, FR_n_TT//sin(Pi*x) poly
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_l_Temp      =   FR_l_XYL, f1, FR_l_SSCXL // XYL+SS*CXL
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fma.s1        FR_e_expl_Input_Y = FR_e_expl_Input_Y, FR_n_NegOne, f0
+                     // Negate lo part of exp argument for negative input values
+      nop.i         0
+};;
+
+{ .mfi 
+      ldfe          FR_e_A1        = [GR_e_ad_A],16   // Get A1
+      nop.f         0
+      nop.i         0
+}
+{ .mfi
+      nop.m 0
+      fms.s1        FR_e_float_N   = FR_e_N_signif, FR_e_2TOM51, FR_e_RSHF 
+                                           // Get float N = signd*2^51-RSHIFTER
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_Poly1L    = FR_n_Poly1L, f1, FR_n_TH //sin(Pi*x) poly
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+(p15) fms.s1        FR_n_PolyL     = FR_n_Poly1H, FR_n_XS, FR_n_PolyH//sin(Pi*x)
+      nop.i         0
+};;
+
+{ .mfi 
+      getf.sig      GR_e_N_fix     = FR_e_N_signif // Get N from significand
+      nop.f         0
+      nop.i         0
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi 
+      nop.m 0
+(p14) fma.s1        FR_e_expl_Input_Y = FR_e_expl_Input_Y, f1, FR_l_Temp   
+      nop.i         0
+}
+{ .mfi 
+      nop.m 0
+(p15) fms.s1        FR_e_expl_Input_Y = FR_e_expl_Input_Y, f1, FR_l_Temp   
+      // arguments for exp computation
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fnma.s1       FR_e_r         = FR_e_L_hi, FR_e_float_N, FR_e_expl_Input_X
+                                                   // r = -L_hi * float_N + x
+      extr.u        GR_e_M1        = GR_e_N_fix, 6, 6   // Extract index M_1
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_Poly1L    =   FR_n_Poly1L, f1, FR_n_TL //sin(Pi*x) poly
+      nop.i         0
+};;
+
+
+{ .mmf 
+      nop.m         0
+      nop.m         0
+      fma.s1        FR_e_r         = FR_e_r, f1, FR_e_expl_Input_Y 
+                                                 // r =  r + FR_e_expl_Input_Y
+};;
+
+{ .mmi 
+      shladd        GR_e_ad_W1     = GR_e_M1,3,GR_e_ad_W1 // Point to W1
+      shladd        GR_e_ad_T1     = GR_e_M1,2,GR_e_ad_T1 // Point to T1
+      extr.u        GR_e_M2        = GR_e_N_fix, 0, 6      // Extract index M_2
+};;
+
+
+{ .mfi 
+      ldfs          FR_e_T1        = [GR_e_ad_T1],0         // Get T1
+      nop.f         0
+      extr          GR_e_K         = GR_e_N_fix, 12, 32 //Extract limit range K
+}
+{ .mfi
+      shladd        GR_e_ad_T2     = GR_e_M2,2,GR_e_ad_T2 // Point to T2
+(p15) fma.s1        FR_n_PolyL     = FR_n_Poly1L, FR_n_XS, FR_n_PolyL
+                                                              //sin(Pi*x) poly
+      shladd        GR_e_ad_W2     = GR_e_M2,3,GR_e_ad_W2 // Point to W2
+};;
+
+{ .mfi 
+      ldfs          FR_e_T2        = [GR_e_ad_T2],0         // Get T2
+      nop.f         0
+      add           GR_e_exp_2_k   = GR_e_exp_bias, GR_e_K // exp of 2^k
+}
+{ .mfi
+      ldfd          FR_e_W1        = [GR_e_ad_W1],0         // Get W1
+      nop.f         0
+      sub           GR_e_exp_2_mk  = GR_e_exp_bias, GR_e_K // exp of 2^-k
+};;
+
+{ .mmi 
+      ldfd          FR_e_W2        = [GR_e_ad_W2],0         // Get W2
+      nop.m 0
+      nop.i 0
+};;
+
+{ .mmf 
+      setf.exp      FR_e_scale     = GR_e_exp_2_k     // Set scale = 2^k
+      setf.exp      FR_e_2_mk      = GR_e_exp_2_mk     // Form 2^-k
+      fnma.s1       FR_e_r         = FR_e_L_lo, FR_e_float_N, FR_e_r 
+                                               // r = -L_lo * float_N + r
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_PolyL     = FR_n_Tail, FR_n_XS7, FR_n_PolyL 
+                                                               //sin(Pi*x) poly
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m 0
+      fma.s1        FR_e_poly      = FR_e_r, FR_e_A3, FR_e_A2 // poly=r*A3+A2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fmpy.s1       FR_e_rsq       = FR_e_r, FR_e_r // rsq = r * r
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m 0
+      fmpy.s1       FR_e_T         = FR_e_T1, FR_e_T2         // T = T1 * T2
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fadd.s1       FR_e_W1_p1     = FR_e_W1, f1        // W1_p1 = W1 + 1.0
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m 0
+(p15) fma.s1        FR_n_TT        = FR_n_PolyL, FR_l_AbsX, f0 //sin(Pi*x) poly
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_e_poly      = FR_e_r, FR_e_poly, FR_e_A1 
+                                                 // poly = r * poly + A1
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_e_T_scale   = FR_e_T, FR_e_scale, f0 // T_scale=T*scale
+      nop.i         0
+}
+{ .mfi
+      nop.m         0
+      fma.s1        FR_e_W         = FR_e_W2, FR_e_W1_p1, FR_e_W1 
+                                                     // W = W2 * (W1+1.0) + W1
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_SinxH     =    FR_n_PolyH, FR_l_AbsX, FR_n_TT 
+                                                              // sin(Pi*x) poly
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      mov           FR_e_Y_hi      = FR_e_T  // Assume Y_hi = T
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m 0
+      fma.s1        FR_e_poly      = FR_e_rsq, FR_e_poly, FR_e_r 
+                                                     // poly = rsq * poly + r
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m 0
+      fma.s1        FR_e_Wp1_T_scale = FR_e_W, FR_e_T_scale, FR_e_T_scale 
+                                                              // (W+1)*T*scale
+      nop.i 0
+}
+{ .mfi
+      nop.m 0
+      fma.s1        FR_e_W_T_scale = FR_e_W, FR_e_T_scale, f0 // W*T*scale
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m 0
+(p15) fms.s1        FR_n_SinxL     =   FR_n_PolyH, FR_l_AbsX, FR_n_SinxH
+                                                             // Low part of sin
+      nop.i 0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) frcpa.s1      FR_n_Y0, p0    = f1, FR_n_SinxH //  y = frcpa(b)
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_e_result_lo = FR_e_Wp1_T_scale, FR_e_poly, FR_e_W_T_scale
+                                                       // Low part of exp result
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_SinxL     = FR_n_SinxL, f1, FR_n_TT // sin low result
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+(p15) fma.s1        FR_n_Q0        = f1,FR_n_Y0,f0 // q = y
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+(p15) fnma.s1       FR_n_E0        = FR_n_Y0, FR_n_SinxH, f1 // e = 1-b*y 
+      nop.i         0
+};;
+
+
+{ .mfb 
+      nop.m         0
+(p14) fma.s0        f8             = FR_e_Y_hi, FR_e_scale, FR_e_result_lo
+(p14) br.ret.spnt   b0 // Exit for positive Stirling path //////////////////////
+};;
+
+{ .mfi 
+      nop.m 0
+      fma.s1        FR_e_expl_Output_X = FR_e_Y_hi, FR_e_scale, f0 // exp result
+      nop.i         0
+}
+{ .mfi
+      nop.m 0
+      fma.s1        FR_e_expl_Output_Y = FR_e_result_lo, f1, f0// exp lo result
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_E2        = FR_n_E0,FR_n_E0,FR_n_E0 //  e2 = e+e^2
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_E1        = FR_n_E0,FR_n_E0,f0 //  e1 = e^2
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_Y1        = FR_n_Y0,FR_n_E2,FR_n_Y0 //  y1 = y+y*e2
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_E3        = FR_n_E1,FR_n_E1,FR_n_E0 //  e3 = e+e1^2
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_Y2        = FR_n_Y1,FR_n_E3,FR_n_Y0 //  y2 = y+y1*e3
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fnma.s1       FR_n_R0        = FR_n_SinxH,FR_n_Q0,f1 //  r = a-b*q
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fnma.s1       FR_n_E4        = FR_n_SinxH,FR_n_Y2,f1 //  e4 = 1-b*y2
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_RcpResH   = FR_n_R0,FR_n_Y2,FR_n_Q0 //  x = q+r*y2
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_Y3        = FR_n_Y2,FR_n_E4,FR_n_Y2 //  y3 = y2+y2*e4
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fnma.s1       FR_n_R1        = FR_n_SinxH,FR_n_RcpResH,f1 //  r1 = a-b*x
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fnma.s1       FR_n_R1        = FR_n_SinxL,FR_n_RcpResH,FR_n_R1  
+                                                          // r1 = r1 - b_lo*X
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_RcpResL   = FR_n_R1,FR_n_Y3,f0 //  x_lo = r1*y3
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_Temp      = FR_n_RcpResH, FR_e_expl_Output_Y, f0
+                                              // Multiplying exp and sin result
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_Temp      = FR_n_RcpResL, FR_e_expl_Output_X, FR_n_Temp
+                                              // Multiplying exp and sin result
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_ResH      = FR_n_RcpResH, FR_e_expl_Output_X, FR_n_Temp
+                                              // Multiplying exp and sin result
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fms.s1        FR_n_ResL      = FR_n_RcpResH, FR_e_expl_Output_X, FR_n_ResH
+                                              // Multiplying exp and sin result
+      nop.i         0
+}
+{ .mfi 
+      nop.m         0
+(p12) fma.s1        FR_n_ResH      = FR_n_ResH, FR_n_NegOne, f0 // Negate
+      nop.i         0
+};;
+
+{ .mfi 
+      nop.m         0
+      fma.s1        FR_n_ResL  = FR_n_ResL, f1, FR_n_Temp
+                      // Multiplying exp and sin result - low result obtained
+      nop.i         0
+};;
+
+.pred.rel "mutex",p12,p13
+{ .mfi 
+      nop.m         0
+(p13) fma.s0        f8             = FR_n_ResH, f1, FR_n_ResL // For odd
+      nop.i         0
+}
+{ .mfb 
+      nop.m         0
+(p12) fms.s0        f8             = FR_n_ResH, f1, FR_n_ResL // For even
+      br.ret.sptk   b0 // Exit for negative Stirling path //////////////////////
+};;
+
+
+//////////// 1 <= |X| < 13 path ////////////////////////////////////////////////
+//------------------------------------------------------------------------------
+.align 64
+tgamma_lt_13:
+{ .mfi 
+      getf.sig      GR_p_XN        = FR_p_IXN // Get significand
+      fcvt.xf       FR_p_XN        = FR_p_IXN  // xn = [x]
+      add           GR_r_sin_Table2= 0x40, GR_r_sin_Table // Shifted table addr.
+} 
+{ .mfi
+      ldfpd         FR_p_0p5, FR_p_1p5 = [GR_c_Table], 16  // 0.5 & 1.5
+      fms.s1        FR_p_AbsXM1    = FR_p_AbsX, f1, f1 // X-1
+      add           GR_p_Table2    = 0xB0, GR_p_Table
+};; 
+
+{ .mfi 
+      add           GR_r_sin_Table = -16, GR_r_sin_Table // For compensation
+      fcvt.xf       FR_r_XNS       = FR_r_IXNS // Convert int repr to float
+      shr.u         GR_p_X_Sgnd    = GR_p_X_Sgnd, 59 // Get only 5 bit of signd
+};; 
+
+{ .mfi 
+      ldfpd         FR_r_A2H,FR_r_A2L = [GR_r_sin_Table], 16 // Load A2
+      nop.f         0
+      add           GR_p_Int       = -2, GR_p_XN // int = int - 2 
+} 
+{ .mfi
+      ldfe          FR_r_A6 = [GR_r_sin_Table2], 16 
+      nop.f         0
+      cmp.gtu       p11, p12 = 0x2, GR_p_XN // p11: x < 2 (splitted intervals),
+                                            // p12: x > 2 (base intervals)
+};; 
+
+{ .mfi 
+      ldfpd         FR_r_A1H, FR_r_A1L = [GR_r_sin_Table], 16 
+      nop.f         0
+      shr           GR_p_Int       = GR_p_Int, 1 // int/2
+} 
+{ .mfi
+      ldfe          FR_r_A5        = [GR_r_sin_Table2], 16 
+      nop.f         0
+(p11) cmp.gtu.unc   p10, p11       = 0x1C, GR_p_X_Sgnd // sgnd(x) < 0.75
+};; 
+
+{ .mfi 
+      ldfe          FR_r_A9        = [GR_r_sin_Table], 16 
+      nop.f         0
+      shl           GR_p_Offset    = GR_p_Int, 4 // offset = int*16
+} 
+{ .mfi
+      ldfe          FR_r_A4        = [GR_r_sin_Table2], 16 
+      nop.f         0
+(p10) cmp.gtu.unc   p9, p10        = 0x14, GR_p_X_Sgnd // sgnd(x) < 0.25
+};; 
+
+
+{ .mfi 
+      ldfe          FR_r_A8        = [GR_r_sin_Table], 16 
+      nop.f         0
+(p12) tbit.nz.unc   p13, p12       = GR_p_XN, 0x0 // p13: reccurent computations
+                                      // X is at [3;4], [5;6], [7;8]... interval
+} 
+{ .mfi
+      ldfe          FR_r_A3        = [GR_r_sin_Table2], 16 
+      nop.f         0
+      shladd        GR_p_Offset    = GR_p_Int, 2, GR_p_Offset // +int*4
+};; 
+
+.pred.rel "mutex",p9,p11
+{ .mfi 
+      add           GR_p_Offset    = GR_p_Int, GR_p_Offset 
+                                                    // +int, so offset = int*21
+(p9)  fms.s1        FR_p_XR        = FR_p_AbsX, f1, f1 // r = x-1
+      nop.i         0 
+} 
+{ .mfi
+      ldfe          FR_r_A7        = [GR_r_sin_Table], 16 
+(p11) fms.s1        FR_p_XR        = FR_p_2, f1, FR_p_AbsX 
+                                                    // r = 2-x for 1.75 < x < 2
+      nop.i         0 
+};; 
+
+.pred.rel "mutex",p9,p10
+.pred.rel "mutex",p10,p11
+.pred.rel "mutex",p9,p11
+{ .mfi 
+(p9)  add           GR_p_Offset    = 126, r0 // 1.0 < x < 1.25 table
+(p15) fcmp.eq.unc.s1 p7,p0         = FR_p_AbsX, FR_p_XN 
+                          // If arg is integer and negative - singularity branch
+      nop.i         0 
+}
+{ .mfi 
+(p10) add           GR_p_Offset    = 147, r0 // 1.25 < x < 1.75 table
+      nop.f         0
+(p11) add           GR_p_Offset    = 168, r0 // 1.75 < x < 2.0 table
+};; 
+
+{ .mmf 
+      shladd        GR_p_Table     = GR_p_Offset, 4, GR_p_Table 
+      shladd        GR_p_Table2    = GR_p_Offset, 4, GR_p_Table2
+      fma.s1        FR_r_XS        = FR_r_AbsX , f1, FR_r_XNS // xs = x - [x]
+};; 
+
+{ .mmb 
+      ldfpd         FR_p_A5H, FR_p_A5L = [GR_p_Table], 16 
+      ldfpd         FR_p_A2H, FR_p_A2L = [GR_p_Table2], 16 
+(p7)  br.cond.spnt  tgammal_singularity // Singularity for integer /////////////
+                                        // and negative argument ///////////////
+};;
+
+{ .mfi 
+      ldfpd         FR_p_A4H, FR_p_A4L = [GR_p_Table], 16 
+      fma.s1        FR_p_XN        = FR_p_XN, f1, FR_p_0p5 // xn = xn+0.5
+      nop.i         0 
+}
+{ .mfi 
+      ldfpd         FR_p_A1H, FR_p_A1L = [GR_p_Table2], 16 
+(p10) fms.s1        FR_p_XR        = FR_p_AbsX, f1, FR_p_1p5 // r = x - 1.5
+      nop.i         0 
+};;
+
+{ .mmi 
+      ldfpd         FR_p_A3H, FR_p_A3L = [GR_p_Table], 16 
+      ldfpd         FR_p_A0H, FR_p_A0L = [GR_p_Table2], 16 
+      nop.i         0
+};;
+
+{ .mmi 
+      ldfe         FR_p_A20        = [GR_p_Table], 16 
+      ldfe         FR_p_A12        = [GR_p_Table2], 16 
+      nop.i         0
+};;
+
+{ .mmf 
+      ldfe         FR_p_A19        = [GR_p_Table], 16 
+      ldfe         FR_p_A11        = [GR_p_Table2], 16 
+      fma.s1       FR_r_XS2        = FR_r_XS, FR_r_XS, f0 // xs2 = xs*xs
+};;
+
+{ .mmi 
+      ldfe          FR_p_A18       = [GR_p_Table], 16 
+      ldfe          FR_p_A10       = [GR_p_Table2], 16 
+      nop.i         0
+};;
+
+.pred.rel "mutex",p12,p13
+{ .mfi 
+      ldfe          FR_p_A17       = [GR_p_Table], 16 
+(p12) fms.s1        FR_p_XR        = FR_p_AbsX, f1, FR_p_XN // r = x - xn
+      nop.i         0 
+}
+{ .mfi 
+      ldfe          FR_p_A9        = [GR_p_Table2], 16
+(p13) fms.s1        FR_p_XR        = FR_p_AbsX, f1, FR_p_XN
+      nop.i         0 
+};;
+
+{ .mmi 
+      ldfe          FR_p_A16       = [GR_p_Table], 16 
+      ldfe          FR_p_A8        = [GR_p_Table2], 16 
+(p9)  cmp.eq        p12, p0        = r0, r0 // clear p12
+};;
+
+{ .mmi 
+      ldfe          FR_p_A15       = [GR_p_Table], 16 
+      ldfe          FR_p_A7        = [GR_p_Table2], 16 
+(p10) cmp.eq        p12, p0        = r0, r0 // clear p12
+};;
+
+{ .mfi 
+      ldfe          FR_p_A14       = [GR_p_Table], 16 
+      fma.s1        FR_r_TH        = FR_r_A2H, FR_r_XS2, f0 // sin for neg
+(p11) cmp.eq        p12, p0        = r0, r0 // clear p12
+}
+{ .mfi 
+      ldfe          FR_p_A6        = [GR_p_Table2], 16
+      fma.s1        FR_r_TL        = FR_r_A2L, FR_r_XS2, f0 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_p_A13       = [GR_p_Table], 16
+      fms.s1        FR_r_XS2L      = FR_r_XS, FR_r_XS, FR_r_XS2 // x2Lo part
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp5H    = FR_p_A5H, FR_p_XR, f0 // A5H*r
+                                                           // 'Low poly'
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR2       = FR_p_XR, FR_p_XR, f0 // r^2 = r*r
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fabs          FR_r_XS        = FR_r_XS // abs(xs)
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp2H    = FR_p_A2H, FR_p_XR, f0 // A2H*r
+                                                           // 'High poly'
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_TT        = FR_r_A2H, FR_r_XS2, FR_r_TH // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResH      = FR_r_TH, f1, FR_r_A1H // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_A2H, FR_r_XS2L, FR_r_TL // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp5L    = FR_p_A5H,FR_p_XR,FR_p_Temp5H //A5H*r delta
+                                                                  // 'Low poly'
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly5H    = FR_p_Temp5H, f1, FR_p_A4H // A5H*r+A4H
+                                                               // 'Low poly'
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp2L    = FR_p_A2H, FR_p_XR, FR_p_Temp2H//A2H*r delta
+                                                                   //'High poly'
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly2H    = FR_p_Temp2H, f1, FR_p_A1H // A2H*r+A1H
+                                                               //'High poly'
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR3       = FR_p_XR2, FR_p_XR,  f0 // r^3 = r^2*r
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_XR2L      = FR_p_XR, FR_p_XR, FR_p_XR2 // r^2 delta
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A18       = FR_p_A19, FR_p_XR, FR_p_A18 // Poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A14       = FR_p_A15, FR_p_XR, FR_p_A14 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR4       = FR_p_XR2, FR_p_XR2, f0 // r^4 = r^2*r^2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp5L    = FR_p_A5L, FR_p_XR, FR_p_Temp5L// Low part
+                                                                   // of A5*r+A4
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly5L    = FR_p_A4H, f1, FR_p_Poly5H // Low part
+                                                               // of A5*r+A4
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp4H    = FR_p_Poly5H, FR_p_XR, f0 // (A5H*r+A4H)*r
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp2L    = FR_p_A2L, FR_p_XR, FR_p_Temp2L // A2*r low
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly2L    = FR_p_A1H, f1, FR_p_Poly2H // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp1H    = FR_p_Poly2H, FR_p_XR, f0 // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_XR3L      = FR_p_XR2, FR_p_XR, FR_p_XR3 // x^3 delta
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A16       = FR_p_A17, FR_p_XR, FR_p_A16 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_ResL      = FR_r_A1H, f1, FR_r_ResH // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_TL, f1, FR_r_TT // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp5L    = FR_p_Temp5L, f1, FR_p_A4L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly5L    = FR_p_Poly5L, f1, FR_p_Temp5H // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp4L    = FR_p_Poly5H,FR_p_XR,FR_p_Temp4H //Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly4H    = FR_p_Temp4H, f1, FR_p_A3H // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp2L    = FR_p_Temp2L, f1, FR_p_A1L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly2L    = FR_p_Poly2L, f1, FR_p_Temp2H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp1L    = FR_p_Poly2H,FR_p_XR,FR_p_Temp1H //High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1H    = FR_p_Temp1H, f1, FR_p_A0H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A12       = FR_p_A13, FR_p_XR, FR_p_A12 // Poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR3L      = FR_p_XR2L, FR_p_XR, FR_p_XR3L // x^3 low
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly5L    = FR_p_Poly5L, f1, FR_p_Temp5L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A10       = FR_p_A11, FR_p_XR, FR_p_A10 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly4L    = FR_p_A3H, f1, FR_p_Poly4H // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A6        = FR_p_A7, FR_p_XR, FR_p_A6 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A8        = FR_p_A9, FR_p_XR, FR_p_A8 // Poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR6       = FR_p_XR4, FR_p_XR2, f0 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly2L    = FR_p_Poly2L, f1, FR_p_Temp2L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly1L    = FR_p_A0H, f1, FR_p_Poly1H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_ResL, f1, FR_r_TH // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TT        = FR_r_TL, f1, FR_r_A1L // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp4L    = FR_p_Poly5L,FR_p_XR,FR_p_Temp4L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A18       = FR_p_A20, FR_p_XR2, FR_p_A18 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly4L    = FR_p_Poly4L, f1, FR_p_Temp4H // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A14       = FR_p_A16, FR_p_XR2, FR_p_A14 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A6        = FR_p_A8, FR_p_XR2, FR_p_A6 // Poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A10       = FR_p_A12, FR_p_XR2, FR_p_A10 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp1L    = FR_p_Poly2L,FR_p_XR,FR_p_Temp1L //High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1L    = FR_p_Poly1L, f1, FR_p_Temp1H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_ResL, f1, FR_r_TT // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TH        = FR_r_ResH, FR_r_XS2, f0 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp4L    = FR_p_Temp4L, f1, FR_p_A3L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly3H    = FR_p_Poly4H, FR_p_XR3, f0 // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A14       = FR_p_A18, FR_p_XR4, FR_p_A14 // Poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR8       = FR_p_XR4, FR_p_XR4, f0 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_ResH, FR_r_XS2L, f0 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp1L    = FR_p_Temp1L, f1, FR_p_A0L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A6        = FR_p_A10, FR_p_XR4, FR_p_A6 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_TT        = FR_r_ResH, FR_r_XS2, FR_r_TH // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res3H     = FR_r_TH, f1, f1 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly4L    = FR_p_Poly4L, f1, FR_p_Temp4L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly3L    = FR_p_Poly4H, FR_p_XR3L, f0 // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly0H    = FR_p_Poly3H,f1,FR_p_Poly1H //Low & High add
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A7        = FR_r_A8,  FR_r_XS2, FR_r_A7 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_ResL, FR_r_XS2, FR_r_TL // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS4       = FR_r_XS2, FR_r_XS2, f0 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1L    = FR_p_Poly1L, f1, FR_p_Temp1L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_PolyTail  = FR_p_A14, FR_p_XR8, FR_p_A6 // Poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_Res3L     = f1, f1, FR_r_Res3H // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResH      = FR_r_Res3H, FR_r_XS, f0 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp0L    = FR_p_Poly4H,FR_p_XR3,FR_p_Poly3H //Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly3L    = FR_p_Poly4L,FR_p_XR3,FR_p_Poly3L //Low poly
+      nop.i         0 
+};;
+
+{ .mfi
+      nop.m         0 
+      fms.s1        FR_p_Poly0L    = FR_p_Poly1H,f1,FR_p_Poly0H //Low & High add
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+(p13) fma.s1        FR_p_OddPoly0H = FR_p_Poly0H, FR_p_AbsXM1, f0 
+                                 // Reccurent computations - multiplying by X-1
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_TL, f1, FR_r_TT // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A3        = FR_r_A4,  FR_r_XS2, FR_r_A3 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1L    = FR_p_PolyTail,FR_p_XR6,FR_p_Poly1L//High
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A5        = FR_r_A6, FR_r_XS2, FR_r_A5 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res3L     = FR_r_Res3L, f1, FR_r_TH // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_ResL      = FR_r_Res3H, FR_r_XS, FR_r_ResH//sin for neg
+      nop.i         0 
+};;
+
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_p_Poly3L    = FR_p_Poly3L, f1, FR_p_Temp0L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A7        = FR_r_A9, FR_r_XS4, FR_r_A7 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi
+      nop.m         0 
+      fma.s1        FR_p_Poly0L    = FR_p_Poly0L,f1,FR_p_Poly3H //Low & High add
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+(p13) fms.s1        FR_p_OddPoly0L = FR_p_Poly0H, FR_p_AbsXM1, FR_p_OddPoly0H
+                       // Reccurent computations - multiplying by X-1 (low part)
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A3        = FR_r_A5,  FR_r_XS4, FR_r_A3 // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS7       = FR_r_XS4, FR_r_XS2, f0 // xs^6
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res3L     = FR_r_Res3L, f1, FR_r_TL // sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS8       = FR_r_XS4, FR_r_XS4, f0 // sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp0H    = FR_p_Poly3L,f1,FR_p_Poly1L //Low & High add
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS7       = FR_r_XS7, FR_r_XS,  f0 // xs^7
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_Res3L, FR_r_XS, FR_r_ResL//sin for neg
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Tail      = FR_r_A7, FR_r_XS8, FR_r_A3 // sin tail res
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly0L    = FR_p_Poly0L,f1,FR_p_Temp0H //Low & High add
+      nop.i         0 
+};;
+
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_Tail,FR_r_XS7,FR_r_ResL //sin for neg
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+(p13) fma.s1        FR_p_OddPoly0L  = FR_p_Poly0L, FR_p_AbsXM1, FR_p_OddPoly0L
+                       // Reccurent computations - multiplying by X-1 (low part)
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TT        = FR_r_ResL, FR_r_AbsX, f0 // X*sin
+      nop.i         0 
+};;
+
+.pred.rel "mutex",p12,p13
+{ .mfi 
+      nop.m         0 
+(p12) fma.s0        f8             =   FR_p_Poly0H, f1, FR_p_Poly0L // Even
+      nop.i         0 
+}
+{ .mfb 
+      nop.m         0 
+(p13) fma.s0        f8             =   FR_p_OddPoly0H, f1, FR_p_OddPoly0L // Odd
+(p14) br.ret.spnt   b0  // Exit for 1 <= |X| < 13 path (positive arguments)/////
+};;
+
+{ .mfi 
+      nop.m         0 
+(p13) fma.s1        FR_p_Poly0H    = FR_p_OddPoly0H, f1, f0 
+                                                       // Reccurent computations
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+(p13) fma.s1        FR_p_Poly0L    = FR_p_OddPoly0L, f1, f0 
+                                                       // Reccurent computations
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res1H     = FR_r_ResH, FR_r_AbsX, FR_r_TT // X*sin
+(p11) cmp.eq        p13, p12       = r0, r0
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_Res1L     = FR_r_ResH,FR_r_AbsX,FR_r_Res1H// X*sin
+(p9)  cmp.eq        p13, p12       = r0, r0
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res1L     = FR_r_Res1L, f1, FR_r_TT // sin for neg
+(p10) cmp.eq        p13, p12       = r0, r0
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_p_Poly0L, FR_r_Res1H, f0 // mult by sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_p_Poly0H,FR_r_Res1L,FR_r_TL//mult by sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResH      = FR_p_Poly0H,FR_r_Res1H,FR_r_TL//mult by sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_ResL      = FR_p_Poly0H,FR_r_Res1H,FR_r_ResH//sin mult
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      frcpa.s1      FR_r_Y0,p0     = f1,FR_r_ResH //  y = frcpa(b)
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fneg          FR_r_NegOne    = f1 // Form -1.0
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_ResL, f1, FR_r_TL //Low result of mult
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Q0        = f1,FR_r_Y0,f0 //  q = a*y
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_E0        = FR_r_Y0,FR_r_ResH,f1 //  e = 1-b*y 
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_E2        = FR_r_E0,FR_r_E0,FR_r_E0 //  e2 = e+e^2
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_E1        = FR_r_E0,FR_r_E0,f0 //  e1 = e^2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Y1        = FR_r_Y0,FR_r_E2,FR_r_Y0 //  y1 = y+y*e2
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_E3        = FR_r_E1,FR_r_E1,FR_r_E0 //  e3 = e+e1^2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Y2        = FR_r_Y1,FR_r_E3,FR_r_Y0 //  y2 = y+y1*e3
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_R0        = FR_r_ResH,FR_r_Q0,f1 //  r = a-b*q
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_E4        = FR_r_ResH,FR_r_Y2,f1 //  e4 = 1-b*y2
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ZH        = FR_r_R0,FR_r_Y2,FR_r_Q0 //  x = q+r*y2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Y3        = FR_r_Y2,FR_r_E4,FR_r_Y2 //  y3 = y2+y2*e4
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_R1        = FR_r_ResH,FR_r_ZH,f1 //  r1 = a-b*x
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_R1        = FR_r_ResL,FR_r_ZH,FR_r_R1 // r1=r1-b_lo*X
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+(p12) fma.s1        FR_r_ZHN       = FR_r_ZH,FR_r_NegOne, f0 // Negate for evens
+      nop.i         0 
+};;
+
+.pred.rel "mutex",p13,p12
+{ .mfi 
+      nop.m         0 
+(p13) fma.s0        f8             = FR_r_R1,FR_r_Y3,FR_r_ZH // Final result
+      nop.i         0 
+}
+{ .mfb 
+      nop.m         0 
+(p12) fnma.s0       f8             = FR_r_R1,FR_r_Y3,FR_r_ZHN // Final result
+      br.ret.sptk   b0 // Exit for 1 <= |X| < 13 path (negative arguments)//////
+};;
+
+
+////////////  |X| < 1 path /////////////////////////////////////////////////////
+//------------------------------------------------------------------------------
+.align 64
+tgamma_lt_1:
+{ .mfi 
+      getf.exp      GR_p_Exp       = FR_p_AbsX // exp of abs X
+      fma.s1        FR_z_Q0        = f1,FR_z_Y0,f0 // q = a*y
+      add           GR_r_sin_Table2= 0x50, GR_r_sin_Table
+} 
+{ .mfi
+      ldfpd         FR_p_0p5, FR_p_1p5 = [GR_c_Table], 16 
+      fnma.s1       FR_z_E0        = FR_z_Y0,f8,f1 //  e = 1-b*y 
+      add           GR_p_Table2    = 0xB0, GR_p_Table
+};; 
+
+{ .mfi 
+      ldfd          FR_p_0p25      = [GR_c_Table]
+      fcvt.xf       FR_r_XNS       = FR_r_IXNS // Convert int repr to float
+      shr.u         GR_p_X_Sgnd    = GR_p_X_Sgnd, 60 
+                                       // Obtain only 4 bits of significand
+}
+{ .mfi 
+      nop.m        0
+      nop.f        0
+      add          GR_p_Bias           = 0xffff, r0 // Set bias
+};; 
+
+{ .mfi 
+      ldfpd        FR_r_A2H, FR_r_A2L  = [GR_r_sin_Table], 16 
+      nop.f        0
+      shl          GR_p_XN             = GR_p_Exp, 4
+                       // Shift exp to 4 bits left to set place for significand
+} 
+{ .mlx
+      ldfe         FR_r_A6         = [GR_r_sin_Table2], 16
+      movl         GR_p_0p75       = 0xfffec // 0.75
+};; 
+
+{ .mfi 
+      ldfpd        FR_r_A1H, FR_r_A1L = [GR_r_sin_Table], 16 
+      nop.f        0
+      or           GR_p_XN         = GR_p_XN, GR_p_X_Sgnd 
+                                 // Combine exp with 4 high bits of significand
+} 
+{ .mfi
+      ldfe         FR_r_A5         = [GR_r_sin_Table2], 16 
+      nop.f        0
+      sub          GR_p_Exp        = GR_p_Exp, GR_p_Bias // Unbiased exp
+};; 
+
+{ .mmi 
+      ldfe         FR_r_A9         = [GR_r_sin_Table], 16 
+      ldfe         FR_r_A4         = [GR_r_sin_Table2], 16 
+      cmp.gtu.unc  p10, p11        = GR_p_0p75, GR_p_XN // sgnd(x) < 0.75
+};; 
+
+{ .mfi 
+      ldfe          FR_r_A8        = [GR_r_sin_Table], 16 
+      fma.s1        FR_z_E2        = FR_z_E0,FR_z_E0,FR_z_E0 //  e2 = e+e^2
+(p10) cmp.gt.unc    p9, p10        = -2, GR_p_Exp //  x < 0.25
+} 
+{ .mfi
+      ldfe          FR_r_A3        = [GR_r_sin_Table2], 16 
+      fma.s1        FR_z_E1        = FR_z_E0,FR_z_E0,f0 // e1 = e^2
+(p11) add           GR_p_Offset    = 168, r0 // [0.75;1] interval
+};; 
+
+{ .mmi 
+(p10) add           GR_p_Offset    = 147, r0 // [0.25;0.75] interval
+      ldfe          FR_r_A7        = [GR_r_sin_Table], 16 
+(p9)  cmp.gt.unc    p8, p9         = -3, GR_p_Exp // x < 0.125
+};; 
+
+.pred.rel "mutex",p9,p8
+{ .mmi 
+(p9)  add           GR_p_Offset    = 126, r0 // [0.125;0.25] interval
+(p8)  add           GR_p_Offset    = 189, r0 // [0.;0.125] interval
+      nop.i         0 
+};; 
+
+{ .mmf 
+      shladd        GR_p_Table     = GR_p_Offset, 4, GR_p_Table //Make addresses
+      shladd        GR_p_Table2    = GR_p_Offset, 4, GR_p_Table2
+      fma.s1        FR_r_XS        = FR_r_AbsX , f1, FR_r_XNS // xs = |x|-[x]
+};; 
+
+.pred.rel "mutex",p8,p11
+{ .mfi 
+      ldfpd         FR_p_A5H, FR_p_A5L = [GR_p_Table], 16 
+(p11) fms.s1        FR_p_XR            = f1, f1, FR_p_AbsX // r = 1 - |x|
+                                                 // for [0.75;1] interval
+      nop.i         0 
+}
+{ .mfi 
+      ldfpd        FR_p_A2H, FR_p_A2L = [GR_p_Table2], 16 
+(p8)  fms.s1       FR_p_XR            = FR_p_AbsX, f1, f0 // r = |x|
+                                                      // for [0.;0.125] interval
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfpd         FR_p_A4H, FR_p_A4L = [GR_p_Table], 16 
+      fma.s1        FR_z_Y1        = FR_z_Y0,FR_z_E2,FR_z_Y0 // y1 = y+y*e2
+      nop.i         0 
+}
+{ .mfi 
+      ldfpd         FR_p_A1H, FR_p_A1L = [GR_p_Table2], 16 
+      fma.s1        FR_z_E3        = FR_z_E1,FR_z_E1,FR_z_E0 // e3 = e+e1^2
+      nop.i         0 
+};;
+
+.pred.rel "mutex",p9,p10
+{ .mfi 
+      ldfpd         FR_p_A3H, FR_p_A3L = [GR_p_Table], 16 
+(p9)  fms.s1        FR_p_XR        = FR_p_AbsX, f1, f0 // r = |x|
+                                                  // for [0.125;0.25] interval
+      nop.i         0 
+}
+{ .mfi 
+      ldfpd         FR_p_A0H, FR_p_A0L  = [GR_p_Table2], 16 
+(p10) fms.s1        FR_p_XR        = FR_p_AbsX, f1, FR_p_0p5 // r = |x| - 0.5
+                                                 // for [0.25;0.75] interval
+      nop.i         0 
+};;
+
+{ .mmi 
+      ldfe          FR_p_A20       = [GR_p_Table], 16 
+      ldfe          FR_p_A12       = [GR_p_Table2], 16 
+      nop.i         0
+};;
+
+{ .mfi 
+      ldfe          FR_p_A19       = [GR_p_Table], 16 
+      fma.s1        FR_r_XS2       = FR_r_XS, FR_r_XS, f0 // xs^2
+      nop.i         0 
+}
+{ .mfi 
+      ldfe          FR_p_A11       = [GR_p_Table2], 16 
+      nop.f         0
+      nop.i         0 
+};;
+
+{ .mmi 
+      ldfe          FR_p_A18       = [GR_p_Table], 16 
+      ldfe          FR_p_A10       = [GR_p_Table2], 16 
+      nop.i         0
+};;
+
+.pred.rel "mutex",p12,p13
+{ .mfi 
+      ldfe          FR_p_A17       = [GR_p_Table], 16 
+      fma.s1        FR_z_Y2        = FR_z_Y1,FR_z_E3,FR_z_Y0 // y2 = y+y1*e3
+      nop.i         0 
+}
+{ .mfi 
+      ldfe          FR_p_A9        = [GR_p_Table2], 16 
+      fnma.s1       FR_z_R0        = f8,FR_z_Q0,f1 //  r = a-b*q
+      nop.i         0 
+};;
+
+{ .mmi 
+      ldfe          FR_p_A16       = [GR_p_Table], 16 
+      ldfe          FR_p_A8        = [GR_p_Table2], 16 
+      nop.i         0 
+};;
+
+{ .mmi 
+      ldfe          FR_p_A15       = [GR_p_Table], 16 
+      ldfe          FR_p_A7        = [GR_p_Table2], 16 
+      nop.i         0
+};;
+
+{ .mfi 
+      ldfe          FR_p_A14       = [GR_p_Table], 16 
+      fma.s1        FR_r_TH        = FR_r_A2H, FR_r_XS2, f0 // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      ldfe          FR_p_A6        = [GR_p_Table2], 16 
+      fma.s1        FR_r_TL        =   FR_r_A2L, FR_r_XS2, f0 // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      ldfe          FR_p_A13       = [GR_p_Table], 16 
+      fms.s1        FR_r_XS2L      = FR_r_XS, FR_r_XS, FR_r_XS2 // xs^2 delta
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp5H     = FR_p_A5H, FR_p_XR, f0 // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR2       = FR_p_XR, FR_p_XR, f0 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fabs          FR_r_XS        = FR_r_XS // Absolute value of xs
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp2H    = FR_p_A2H, FR_p_XR, f0 // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_z_E4        = f8,FR_z_Y2,f1 //  e4 = 1-b*y2
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_z_ZH        = FR_z_R0,FR_z_Y2,FR_z_Q0 // 1/x = q+r*y2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_TT        = FR_r_A2H, FR_r_XS2, FR_r_TH // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResH      = FR_r_TH, f1, FR_r_A1H // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_A2H, FR_r_XS2L, FR_r_TL // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp5L    = FR_p_A5H, FR_p_XR, FR_p_Temp5H // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly5H    = FR_p_Temp5H, f1, FR_p_A4H // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp2L    = FR_p_A2H, FR_p_XR, FR_p_Temp2H // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly2H    = FR_p_Temp2H, f1, FR_p_A1H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR3       = FR_p_XR2, FR_p_XR,  f0 // r^3
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_XR2L      = FR_p_XR, FR_p_XR, FR_p_XR2 // r^2 delta
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A18       = FR_p_A19, FR_p_XR, FR_p_A18 // poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A14       = FR_p_A15, FR_p_XR, FR_p_A14 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR4       = FR_p_XR2, FR_p_XR2, f0 // poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_z_Y3        = FR_z_Y2,FR_z_E4,FR_z_Y2 //  y3 = y2+y2*e4
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp5L    = FR_p_A5L, FR_p_XR, FR_p_Temp5L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly5L    = FR_p_A4H, f1, FR_p_Poly5H // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp4H    = FR_p_Poly5H, FR_p_XR, f0 // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp2L    = FR_p_A2L, FR_p_XR, FR_p_Temp2L // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly2L    = FR_p_A1H, f1, FR_p_Poly2H // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp1H    = FR_p_Poly2H, FR_p_XR, f0 // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_XR3L      = FR_p_XR2, FR_p_XR, FR_p_XR3 // x^3 delta
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A16       = FR_p_A17, FR_p_XR, FR_p_A16 //poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_ResL      = FR_r_A1H, f1, FR_r_ResH // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_TL, f1, FR_r_TT // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp5L    = FR_p_Temp5L, f1, FR_p_A4L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly5L    = FR_p_Poly5L, f1, FR_p_Temp5H //Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp4L    = FR_p_Poly5H, FR_p_XR, FR_p_Temp4H//Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly4H    = FR_p_Temp4H, f1, FR_p_A3H // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp2L    = FR_p_Temp2L, f1, FR_p_A1L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly2L    = FR_p_Poly2L, f1, FR_p_Temp2H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp1L    = FR_p_Poly2H,FR_p_XR,FR_p_Temp1H //High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1H    = FR_p_Temp1H, f1, FR_p_A0H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A12       = FR_p_A13, FR_p_XR, FR_p_A12 // poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR3L      = FR_p_XR2L, FR_p_XR, FR_p_XR3L // x^3 low
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly5L    = FR_p_Poly5L, f1, FR_p_Temp5L //Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A10       = FR_p_A11, FR_p_XR, FR_p_A10 //poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly4L    = FR_p_A3H, f1, FR_p_Poly4H /// Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A6        = FR_p_A7, FR_p_XR, FR_p_A6 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A8        = FR_p_A9, FR_p_XR, FR_p_A8 // poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR6       = FR_p_XR4, FR_p_XR2, f0 // r^6
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly2L    = FR_p_Poly2L, f1, FR_p_Temp2L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly1L    = FR_p_A0H, f1, FR_p_Poly1H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_ResL, f1, FR_r_TH // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TT        = FR_r_TL, f1, FR_r_A1L // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp4L    = FR_p_Poly5L,FR_p_XR,FR_p_Temp4L //Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A18       = FR_p_A20, FR_p_XR2, FR_p_A18 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly4L    = FR_p_Poly4L, f1, FR_p_Temp4H // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A14       = FR_p_A16, FR_p_XR2, FR_p_A14 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A6        = FR_p_A8, FR_p_XR2, FR_p_A6 // poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A10       = FR_p_A12, FR_p_XR2, FR_p_A10 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp1L    = FR_p_Poly2L,FR_p_XR,FR_p_Temp1L //High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1L    = FR_p_Poly1L, f1, FR_p_Temp1H // High poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_ResL, f1, FR_r_TT // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TH        = FR_r_ResH, FR_r_XS2, f0 // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp4L    = FR_p_Temp4L, f1, FR_p_A3L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly3H    = FR_p_Poly4H, FR_p_XR3, f0 // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A14       = FR_p_A18, FR_p_XR4, FR_p_A14 // poly tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_XR8       = FR_p_XR4, FR_p_XR4, f0 // r^8
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_ResH, FR_r_XS2L, f0 // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_z_R1        = f8,FR_z_ZH,f1 //  r1 = a-b*x
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp1L    = FR_p_Temp1L, f1, FR_p_A0L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_A6        = FR_p_A10, FR_p_XR4, FR_p_A6 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_TT        = FR_r_ResH, FR_r_XS2, FR_r_TH // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res3H     = FR_r_TH, f1, f1 // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly4L    = FR_p_Poly4L, f1, FR_p_Temp4L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly3L    = FR_p_Poly4H, FR_p_XR3L, f0 // Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly0H    = FR_p_Poly3H, f1, FR_p_Poly1H // Result
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A7        = FR_r_A8, FR_r_XS2, FR_r_A7 // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_ResL, FR_r_XS2, FR_r_TL // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS4       = FR_r_XS2, FR_r_XS2, f0 // xs^4
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1L    = FR_p_Poly1L, f1, FR_p_Temp1L // High poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_PolyTail  = FR_p_A14, FR_p_XR8, FR_p_A6 // poly tail
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_Res3L     = f1, f1, FR_r_Res3H // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResH      = FR_r_Res3H, FR_r_XS, f0 // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Temp0L    = FR_p_Poly4H,FR_p_XR3,FR_p_Poly3H //Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly3L    = FR_p_Poly4L,FR_p_XR3,FR_p_Poly3L //Low poly
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_p_Poly0L    = FR_p_Poly1H, f1, FR_p_Poly0H // Result
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_z_ZL        = FR_z_R1,FR_z_Y3, f0 //  x_lo = r1*y3
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_r_TL, f1, FR_r_TT // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A3        = FR_r_A4, FR_r_XS2, FR_r_A3 /// neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly1L    = FR_p_PolyTail,FR_p_XR6,FR_p_Poly1L // High
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A5        = FR_r_A6, FR_r_XS2, FR_r_A5 // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res3L     = FR_r_Res3L, f1, FR_r_TH // neg sin
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_ResL      = FR_r_Res3H, FR_r_XS, FR_r_ResH // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly3L    = FR_p_Poly3L, f1, FR_p_Temp0L // Low poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A7        = FR_r_A9,  FR_r_XS4, FR_r_A7 // neg sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly0L    = FR_p_Poly0L, f1, FR_p_Poly3H // result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+(p14) fma.s1        f8             = FR_p_Poly0H, FR_z_ZH, f0 // z*poly
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp1L    = FR_p_Poly0H, FR_z_ZL, f0 // z*poly low
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_A3        = FR_r_A5, FR_r_XS4, FR_r_A3 // sin tail
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS7       = FR_r_XS4, FR_r_XS2, f0  // xs^6
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res3L     = FR_r_Res3L, f1, FR_r_TL // sin low
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS8       = FR_r_XS4, FR_r_XS4, f0 // xs^8
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Temp0H    = FR_p_Poly3L, f1, FR_p_Poly1L // result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+(p14) fms.s1        FR_p_Temp1H    = FR_p_Poly0H, FR_z_ZH, f8 // hi result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_XS7       = FR_r_XS7, FR_r_XS,  f0 // xs^7
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_Res3L, FR_r_XS, FR_r_ResL // lo result
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Tail      = FR_r_A7, FR_r_XS8, FR_r_A3 // tail result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_p_Poly0L    = FR_p_Poly0L, f1, FR_p_Temp0H // lo result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_Tail, FR_r_XS7, FR_r_ResL // lo result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+(p14) fma.s1        FR_p_Temp1L    = FR_p_Poly0L,FR_z_ZH,FR_p_Temp1L //hi result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TT        = FR_r_ResL, f1, f0 // for low result
+      nop.i         0 
+};;
+
+.pred.rel "mutex",p12,p13
+{ .mfi 
+      nop.m         0 
+(p14) fma.s1        FR_p_Temp1L    = FR_p_Temp1L, f1, FR_p_Temp1H // for lo res
+      nop.i         0 
+};;
+
+{ .mfi 
+(p10) cmp.eq        p13, p12       = r0, r0 // set p13, clear p12
+      fma.s1        FR_r_Res1H     = FR_r_ResH, f1, FR_r_TT // hi res
+      nop.i         0 
+};;
+
+{ .mfb 
+(p9)  cmp.eq        p13, p12       = r0, r0 // set p13, clear p12
+(p14) fma.s0        f8             =   f8, f1, FR_p_Temp1L // Final result
+(p14) br.ret.spnt   b0 // Exit for  0 < |X| < 1 path (positive arguments)///////
+};;
+
+{ .mfi 
+(p11) cmp.eq        p13, p12       = r0, r0 // set p13, clear p12
+      fms.s1        FR_r_Res1L     = FR_r_ResH, f1, FR_r_Res1H // Low sin result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Res1L     = FR_r_Res1L, f1, FR_r_TT // Low sin result
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_p_Poly0L,FR_r_Res1H,f0 //Low sin result
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_TL        = FR_p_Poly0H, FR_r_Res1L, FR_r_TL //Low sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResH      = FR_p_Poly0H, FR_r_Res1H, FR_r_TL //High sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fms.s1        FR_r_ResL      = FR_p_Poly0H,FR_r_Res1H,FR_r_ResH //Low res
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      frcpa.s1      FR_r_Y0,p0     = f1,FR_r_ResH //  y = frcpa(b)
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fneg          FR_r_NegOne    = f1 // Construct -1.0
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ResL      = FR_r_ResL, f1, FR_r_TL // low sin
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Q0        = f1,FR_r_Y0,f0 // q = a*y
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_E0        = FR_r_Y0,FR_r_ResH,f1 // e = 1-b*y 
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_E2        = FR_r_E0,FR_r_E0,FR_r_E0 // e2 = e+e^2
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_E1        = FR_r_E0,FR_r_E0,f0 // e1 = e^2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Y1        = FR_r_Y0,FR_r_E2,FR_r_Y0 //  y1 = y+y*e2
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_E3        = FR_r_E1,FR_r_E1,FR_r_E0 //  e3 = e+e1^2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Y2        = FR_r_Y1,FR_r_E3,FR_r_Y0 //  y2 = y+y1*e3
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_R0        = FR_r_ResH,FR_r_Q0,f1 //  r = a-b*q
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_E4        = FR_r_ResH,FR_r_Y2,f1 //  e4 = 1-b*y2
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ZH        = FR_r_R0,FR_r_Y2,FR_r_Q0 //  x = q+r*y2
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_Y3        = FR_r_Y2,FR_r_E4,FR_r_Y2 //  y3 = y2+y2*e4
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_R1        = FR_r_ResH,FR_r_ZH,f1 //  r1 = a-b*x
+      nop.i         0 
+};;
+
+{ .mfi 
+      nop.m         0 
+      fnma.s1       FR_r_R1        = FR_r_ResL,FR_r_ZH,FR_r_R1 // r1=r1 - b_lo*X
+      nop.i         0 
+}
+{ .mfi 
+      nop.m         0 
+      fma.s1        FR_r_ZHN       = FR_r_ZH,FR_r_NegOne, f0 // Negate
+      nop.i         0 
+};;
+
+.pred.rel "mutex",p13,p12
+{ .mfb 
+      nop.m         0 
+      fnma.s0       f8             = FR_r_R1,FR_r_Y3,FR_r_ZHN // Result for neg
+      br.ret.sptk   b0  // Exit for  0 < |X| < 1 path (negative arguments)//////
+};;
+
+
+
+
+//  SPECIALS (x for natval, nan, +/-inf or +/-0) ///////////////////////////////
+//------------------------------------------------------------------------------
+.align 32
+tgammal_spec:
+{ .mlx
+      nop.m         0 
+      movl          GR_DenOverflow = 0x2000000000000001
+}
+{ .mfi
+      nop.m         0
+      fclass.m      p9,p0          =  f8,0xB // +/-denormals
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fclass.m      p6,p0          =  f8,0x1E1 // Test x for natval, nan, +inf
+      nop.i         0
+};;
+{ .mfi
+      nop.m         0
+      fclass.m      p7,p8          = f8,0x7 // +/-0
+      nop.i         0
+}
+
+{ .mfi
+(p9)  cmp.ltu.unc   p10,p11        = GR_l_signif_Z, GR_DenOverflow  
+(p9)  fnorm.s0      f8 = f8
+      nop.i         0 
+};;
+
+{ .mfb
+      nop.m         0 
+(p9)  fcvt.fx.trunc.s1 FR_n_IXN    = FR_l_AbsX // Round by truncate
+(p11) br.cond.sptk  tgamma_lt_1 // Return to gamma ('good' denormal)////////////
+};;
+
+{ .mfb
+      nop.m         0 
+      nop.f         0 
+(p10) br.cond.spnt  tgammal_overflow // "Bad" denormal - overflow! /////////////
+};;
+
+{ .mfi
+      nop.m         0
+      mov           FR_X           = f8 // for error handler
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p6)  fma.s0        f8             = f8,f1,f8 // res = x + x
+(p6)  br.ret.spnt   b0 // Exit for NAN, INF and NatVals ////////////////////////
+};;
+.pred.rel "mutex",p7,p8
+{ .mfi
+(p7)  mov           GR_Parameter_TAG = 256   // negative
+(p7)  frcpa.s0      f8,p0            = f1,f8 // Raise V flag
+      nop.i         0 
+}
+{ .mfb
+      nop.m         0
+      nop.f         0 
+(p8)  br.cond.spnt  tgammal_singularity // Branch for +ZERO ////////////////////
+};;
+
+{ .mfb
+      nop.m         0 
+      nop.f         0 
+      br.cond.spnt  tgammal_libm_err // Branch for -ZERO ///////////////////////
+};;
+
+
+
+
+// SINGULARITY (x is negative integer or 0) ////////////////////////////////////
+//------------------------------------------------------------------------------
+.align 32
+tgammal_singularity:
+{ .mfi
+      nop.m         0
+      mov           FR_X             = f8  // For error handler
+      mov           GR_Parameter_TAG = 256 // negative
+}
+{ .mfb
+      nop.m         0
+      frcpa.s0      f8,p0 = f0,f0 // Raise V flag
+      br.cond.sptk  tgammal_libm_err // Call error handler /////////////////////
+                                     // with singularity error /////////////////
+};;
+
+
+
+
+// OVERFLOW (result is too big and cannot be represented by normal value) //////
+// ( X > 1755.54 and for denormals with abs value less than 0x2000000000000001 )
+//------------------------------------------------------------------------------
+.align 32
+tgammal_overflow:
+{ .mfi
+      addl          r8             = 0x1FFFE, r0 // Exp of INF
+      fcmp.lt.s1    p15,p14        = f8,f0 // p14 - pos arg, p15 - neg arg
+      nop.i         0 
+};;
+
+{ .mfi
+      setf.exp      f9               = r8
+      mov           FR_X             = f8 // For error handler
+      mov           GR_Parameter_TAG = 255 // overflow
+};;
+
+.pred.rel "mutex",p14,p15
+{ .mfi
+      nop.m         0 
+(p14) fma.s0        f8             = f9,f9,f0 // Set I,O and +INF result
+      nop.i         0 
+}
+{ .mfb
+      nop.m         0 
+(p15) fnma.s0       f8             = f9,f9,f0 // Set I,O and -INF result
+      br.cond.sptk  tgammal_libm_err // Call error handler /////////////////////
+                                     // with overflow error ////////////////////
+};;
+
+
+
+
+
+// UNDERFLOW (x is negative noninteger with big absolute value) ////////////////
+//------------------------------------------------------------------------------
+.align 32
+tgammal_underflow:
+{ .mfi
+      nop.m         0 
+      fcvt.fx.trunc.s1 FR_u_IXN    = f8 // Convert arg to int repres. in FR
+      nop.i         0 
+};;
+
+{ .mmi
+      getf.sig      GR_u_XN        = FR_u_IXN
+      mov           r11            = 0x00001
+      nop.i         0
+};;
+
+{ .mfi
+      setf.exp      f9             = r11
+      nop.f         0
+      nop.i         0
+};;
+
+{ .mfi
+      nop.m         0
+      nop.f         0
+      tbit.z        p6,p7          = GR_u_XN,0 // even or odd
+};;
+
+.pred.rel "mutex",p6,p7
+{ .mfi
+      nop.m         0
+(p6)  fms.s0        f8             = f9,f9,f9 // for negatives
+      nop.i         0
+}
+{ .mfb
+      nop.m         0
+(p7)  fma.s0        f8             = f9,f9,f9 // for positives
+      br.ret.sptk   b0 // Exit for underflow path //////////////////////////////
+};;
+
+
+GLOBAL_LIBM_END(tgammal)
+
+
+
+
+////////////////// Tgammal error handler ///////////////////////////////////////
+//------------------------------------------------------------------------------
+LOCAL_LIBM_ENTRY(__libm_error_region)
+tgammal_libm_err:
+.prologue
+{ .mfi
+        add   GR_Parameter_Y=-32,sp             // Parameter 2 value
+        nop.f 0
+.save   ar.pfs,GR_SAVE_PFS
+        mov  GR_SAVE_PFS=ar.pfs                 // Save ar.pfs
+}
+{ .mfi
+.fframe 64
+        add sp=-64,sp                           // Create new stack
+        nop.f 0
+        mov GR_SAVE_GP=gp                       // Save gp
+};;
+{ .mmi
+        stfe [GR_Parameter_Y] = FR_Y,16         // Save Parameter 2 on stack
+        add GR_Parameter_X = 16,sp              // Parameter 1 address
+.save   b0, GR_SAVE_B0
+        mov GR_SAVE_B0=b0                       // Save b0
+};;
+.body
+{ .mib
+        stfe [GR_Parameter_X] = FR_X            // Store Parameter 1 on stack
+        add   GR_Parameter_RESULT = 0,GR_Parameter_Y
+        nop.b 0                                 // Parameter 3 address
+}
+{ .mib
+        stfe [GR_Parameter_Y] = FR_RESULT      // Store Parameter 3 on stack
+        add   GR_Parameter_Y = -16,GR_Parameter_Y
+        br.call.sptk b0=__libm_error_support#  // Call error handling function
+};;
+{ .mmi
+        nop.m 999
+        nop.m 999
+        add   GR_Parameter_RESULT = 48,sp
+};;
+{ .mmi
+        ldfe  f8 = [GR_Parameter_RESULT]       // Get return result off stack
+.restore sp
+        add   sp = 64,sp                       // Restore stack pointer
+        mov   b0 = GR_SAVE_B0                  // Restore return address
+};;
+{ .mib
+        mov   gp = GR_SAVE_GP                  // Restore gp
+        mov   ar.pfs = GR_SAVE_PFS             // Restore ar.pfs
+        br.ret.sptk     b0                     // Return
+};;
+
+LOCAL_LIBM_END(__libm_error_region#)
+
+.type   __libm_error_support#,@function
+.global __libm_error_support#
diff --git a/sysdeps/ia64/ia64libgcc.S b/sysdeps/ia64/ia64libgcc.S
index 3f77b06a5a..e69de29bb2 100644
--- a/sysdeps/ia64/ia64libgcc.S
+++ b/sysdeps/ia64/ia64libgcc.S
@@ -1,350 +0,0 @@
-/* From the Intel IA-64 Optimization Guide, choose the minimum latency
-   alternative.  */
-
-#include <sysdep.h>
-#undef ret
-
-#include <shlib-compat.h>
-
-#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_2_6)
-
-/* __divtf3
-   Compute a 80-bit IEEE double-extended quotient.
-   farg0 holds the dividend.  farg1 holds the divisor.  */
-
-ENTRY(___divtf3)
-	cmp.eq p7, p0 = r0, r0
-	frcpa.s0 f10, p6 = farg0, farg1
-	;;
-(p6)	cmp.ne p7, p0 = r0, r0
-	.pred.rel.mutex p6, p7
-(p6)	fnma.s1 f11 = farg1, f10, f1
-(p6)	fma.s1 f12 = farg0, f10, f0
-	;;
-(p6)	fma.s1 f13 = f11, f11, f0
-(p6)	fma.s1 f14 = f11, f11, f11
-	;;
-(p6)	fma.s1 f11 = f13, f13, f11
-(p6)	fma.s1 f13 = f14, f10, f10
-	;;
-(p6)	fma.s1 f10 = f13, f11, f10
-(p6)	fnma.s1 f11 = farg1, f12, farg0
-	;;
-(p6)	fma.s1 f11 = f11, f10, f12
-(p6)	fnma.s1 f12 = farg1, f10, f1
-	;;
-(p6)	fma.s1 f10 = f12, f10, f10
-(p6)	fnma.s1 f12 = farg1, f11, farg0
-	;;
-(p6)	fma.s0 fret0 = f12, f10, f11
-(p7)	mov fret0 = f10
-	br.ret.sptk rp
-END(___divtf3)
-	.symver ___divtf3, __divtf3@GLIBC_2.2
-
-/* __divdf3
-   Compute a 64-bit IEEE double quotient.
-   farg0 holds the dividend.  farg1 holds the divisor.  */
-
-ENTRY(___divdf3)
-	cmp.eq p7, p0 = r0, r0
-	frcpa.s0 f10, p6 = farg0, farg1
-	;;
-(p6)	cmp.ne p7, p0 = r0, r0
-	.pred.rel.mutex p6, p7
-(p6)	fmpy.s1 f11 = farg0, f10
-(p6)	fnma.s1 f12 = farg1, f10, f1
-	;;
-(p6)	fma.s1 f11 = f12, f11, f11
-(p6)	fmpy.s1 f13 = f12, f12
-	;;
-(p6)	fma.s1 f10 = f12, f10, f10
-(p6)	fma.s1 f11 = f13, f11, f11
-	;;
-(p6)	fmpy.s1 f12 = f13, f13
-(p6)	fma.s1 f10 = f13, f10, f10
-	;;
-(p6)	fma.d.s1 f11 = f12, f11, f11
-(p6)	fma.s1 f10 = f12, f10, f10
-	;;
-(p6)	fnma.d.s1 f8 = farg1, f11, farg0
-	;;
-(p6)	fma.d fret0 = f8, f10, f11
-(p7)	mov fret0 = f10
-	br.ret.sptk rp
-	;;
-END(___divdf3)
-	.symver	___divdf3, __divdf3@GLIBC_2.2
-
-/* __divsf3
-   Compute a 32-bit IEEE float quotient.
-   farg0 holds the dividend.  farg1 holds the divisor.  */
-
-ENTRY(___divsf3)
-	cmp.eq p7, p0 = r0, r0
-	frcpa.s0 f10, p6 = farg0, farg1
-	;;
-(p6)	cmp.ne p7, p0 = r0, r0
-	.pred.rel.mutex p6, p7
-(p6)	fmpy.s1 f8 = farg0, f10
-(p6)	fnma.s1 f9 = farg1, f10, f1
-	;;
-(p6)	fma.s1 f8 = f9, f8, f8
-(p6)	fmpy.s1 f9 = f9, f9
-	;;
-(p6)	fma.s1 f8 = f9, f8, f8
-(p6)	fmpy.s1 f9 = f9, f9
-	;;
-(p6)	fma.d.s1 f10 = f9, f8, f8
-	;;
-(p6)	fnorm.s.s0 fret0 = f10
-(p7)	mov fret0 = f10
-	br.ret.sptk rp
-	;;
-END(___divsf3)
-	.symver	___divsf3, __divsf3@GLIBC_2.2
-
-/* __divdi3
-   Compute a 64-bit integer quotient.
-   in0 holds the dividend.  in1 holds the divisor.  */
-
-ENTRY(___divdi3)
-	.regstk 2,0,0,0
-	/* Transfer inputs to FP registers.  */
-	setf.sig f8 = in0
-	setf.sig f9 = in1
-	;;
-	/* Convert the inputs to FP, so that they won't be treated as
-	   unsigned.  */
-	fcvt.xf f8 = f8
-	fcvt.xf f9 = f9
-	;;
-	/* Compute the reciprocal approximation.  */
-	frcpa.s1 f10, p6 = f8, f9
-	;;
-	/* 3 Newton-Raphson iterations.  */
-(p6)	fnma.s1 f11 = f9, f10, f1
-(p6)	fmpy.s1 f12 = f8, f10
-	;;
-(p6)	fmpy.s1 f13 = f11, f11
-(p6)	fma.s1 f12 = f11, f12, f12
-	;;
-(p6)	fma.s1 f10 = f11, f10, f10
-(p6)	fma.s1 f11 = f13, f12, f12
-	;;
-(p6)	fma.s1 f10 = f13, f10, f10
-(p6)	fnma.s1 f12 = f9, f11, f8
-	;;
-(p6)	fma.s1 f10 = f12, f10, f11
-	;;
-	/* Round quotient to an integer.  */
-	fcvt.fx.trunc.s1 f10 = f10
-	;;
-	/* Transfer result to GP registers.  */
-	getf.sig ret0 = f10
-	br.ret.sptk rp
-	;;
-END(___divdi3)
-	.symver	___divdi3, __divdi3@GLIBC_2.2
-
-/* __moddi3
-   Compute a 64-bit integer modulus.
-   in0 holds the dividend (a).  in1 holds the divisor (b).  */
-
-ENTRY(___moddi3)
-	.regstk 2,0,0,0
-	/* Transfer inputs to FP registers.  */
-	setf.sig f14 = in0
-	setf.sig f9 = in1
-	;;
-	/* Convert the inputs to FP, so that they won't be treated as
-	   unsigned.  */
-	fcvt.xf f8 = f14
-	fcvt.xf f9 = f9
-	;;
-	/* Compute the reciprocal approximation.  */
-	frcpa.s1 f10, p6 = f8, f9
-	;;
-	/* 3 Newton-Raphson iterations.  */
-(p6)	fmpy.s1 f12 = f8, f10
-(p6)	fnma.s1 f11 = f9, f10, f1
-	;;
-(p6)	fma.s1 f12 = f11, f12, f12
-(p6)	fmpy.s1 f13 = f11, f11
-	;;
-(p6)	fma.s1 f10 = f11, f10, f10
-(p6)	fma.s1 f11 = f13, f12, f12
-	;;
-	sub in1 = r0, in1
-(p6)	fma.s1 f10 = f13, f10, f10
-(p6)	fnma.s1 f12 = f9, f11, f8
-	;;
-	setf.sig f9 = in1
-(p6)	fma.s1 f10 = f12, f10, f11
-	;;
-	fcvt.fx.trunc.s1 f10 = f10
-	;;
-	/* r = q * (-b) + a  */
-	xma.l f10 = f10, f9, f14
-	;;
-	/* Transfer result to GP registers.  */
-	getf.sig ret0 = f10
-	br.ret.sptk rp
-	;;
-END(___moddi3)
-	.symver ___moddi3, __moddi3@GLIBC_2.2
-
-/* __udivdi3
-   Compute a 64-bit unsigned integer quotient.
-   in0 holds the dividend.  in1 holds the divisor.  */
-
-ENTRY(___udivdi3)
-	.regstk 2,0,0,0
-	/* Transfer inputs to FP registers.  */
-	setf.sig f8 = in0
-	setf.sig f9 = in1
-	;;
-	/* Convert the inputs to FP, to avoid FP software-assist faults.  */
-	fcvt.xuf.s1 f8 = f8
-	fcvt.xuf.s1 f9 = f9
-	;;
-	/* Compute the reciprocal approximation.  */
-	frcpa.s1 f10, p6 = f8, f9
-	;;
-	/* 3 Newton-Raphson iterations.  */
-(p6)	fnma.s1 f11 = f9, f10, f1
-(p6)	fmpy.s1 f12 = f8, f10
-	;;
-(p6)	fmpy.s1 f13 = f11, f11
-(p6)	fma.s1 f12 = f11, f12, f12
-	;;
-(p6)	fma.s1 f10 = f11, f10, f10
-(p6)	fma.s1 f11 = f13, f12, f12
-	;;
-(p6)	fma.s1 f10 = f13, f10, f10
-(p6)	fnma.s1 f12 = f9, f11, f8
-	;;
-(p6)	fma.s1 f10 = f12, f10, f11
-	;;
-	/* Round quotient to an unsigned integer.  */
-	fcvt.fxu.trunc.s1 f10 = f10
-	;;
-	/* Transfer result to GP registers.  */
-	getf.sig ret0 = f10
-	br.ret.sptk rp
-	;;
-END(___udivdi3)
-	.symver	___udivdi3, __udivdi3@GLIBC_2.2
-
-/* __umoddi3
-   Compute a 64-bit unsigned integer modulus.
-   in0 holds the dividend (a).  in1 holds the divisor (b).  */
-
-ENTRY(___umoddi3)
-	.regstk 2,0,0,0
-	/* Transfer inputs to FP registers.  */
-	setf.sig f14 = in0
-	setf.sig f9 = in1
-	;;
-	/* Convert the inputs to FP, to avoid FP software assist faults.  */
-	fcvt.xuf.s1 f8 = f14
-	fcvt.xuf.s1 f9 = f9
-	;;
-	/* Compute the reciprocal approximation.  */
-	frcpa.s1 f10, p6 = f8, f9
-	;;
-	/* 3 Newton-Raphson iterations.  */
-(p6)	fmpy.s1 f12 = f8, f10
-(p6)	fnma.s1 f11 = f9, f10, f1
-	;;
-(p6)	fma.s1 f12 = f11, f12, f12
-(p6)	fmpy.s1 f13 = f11, f11
-	;;
-(p6)	fma.s1 f10 = f11, f10, f10
-(p6)	fma.s1 f11 = f13, f12, f12
-	;;
-	sub in1 = r0, in1
-(p6)	fma.s1 f10 = f13, f10, f10
-(p6)	fnma.s1 f12 = f9, f11, f8
-	;;
-	setf.sig f9 = in1
-(p6)	fma.s1 f10 = f12, f10, f11
-	;;
-	/* Round quotient to an unsigned integer.  */
-	fcvt.fxu.trunc.s1 f10 = f10
-	;;
-	/* r = q * (-b) + a  */
-	xma.l f10 = f10, f9, f14
-	;;
-	/* Transfer result to GP registers.  */
-	getf.sig ret0 = f10
-	br.ret.sptk rp
-	;;
-END(___umoddi3)
-	.symver	___umoddi3, __umoddi3@GLIBC_2.2
-
-/* __multi3
-   Compute a 128-bit multiply of 128-bit multiplicands.
-   in0/in1 holds one multiplicand (a), in2/in3 holds the other one (b).  */
-
-ENTRY(___multi3)
-	.regstk 4,0,0,0
-	setf.sig f6 = in1
-	movl r19 = 0xffffffff
-	setf.sig f7 = in2
-	;;
-	and r14 = r19, in0
-	;;
-	setf.sig f10 = r14
-	and r14 = r19, in2
-	xmpy.l f9 = f6, f7
-	;;
-	setf.sig f6 = r14
-	shr.u r14 = in0, 32
-	;;
-	setf.sig f7 = r14
-	shr.u r14 = in2, 32
-	;;
-	setf.sig f8 = r14
-	xmpy.l f11 = f10, f6
-	xmpy.l f6 = f7, f6
-	;;
-	getf.sig r16 = f11
-	xmpy.l f7 = f7, f8
-	;;
-	shr.u r14 = r16, 32
-	and r16 = r19, r16
-	getf.sig r17 = f6
-	setf.sig f6 = in0
-	;;
-	setf.sig f11 = r14
-	getf.sig r21 = f7
-	setf.sig f7 = in3
-	;;
-	xma.l f11 = f10, f8, f11
-	xma.l f6 = f6, f7, f9
-	;;
-	getf.sig r18 = f11
-	;;
-	add r18 = r18, r17
-	;;
-	and r15 = r19, r18
-	cmp.ltu p7, p6 = r18, r17
-	;;
-	getf.sig r22 = f6
-(p7)	adds r14 = 1, r19
-	;;
-(p7)	add r21 = r21, r14
-	shr.u r14 = r18, 32
-	shl r15 = r15, 32
-	;;
-	add r20 = r21, r14
-	;;
-	add ret0 = r15, r16
-	add ret1 = r22, r20
-	br.ret.sptk rp
-	;;
-END(___multi3)
-	.symver	___multi3, __multi3@GLIBC_2.2
-
-#endif
diff --git a/sysdeps/ia64/jmpbuf-unwind.h b/sysdeps/ia64/jmpbuf-unwind.h
new file mode 100644
index 0000000000..c53447223b
--- /dev/null
+++ b/sysdeps/ia64/jmpbuf-unwind.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <stdint.h>
+#include <unwind.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+   variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
+  ((void *) (_address) < (void *) (((long int *) _jmpbuf)[0]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  ({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj);	\
+     (_cfa < (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj)		\
+      || (_cfa == (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj)		\
+	  && (uintptr_t) _Unwind_GetBSP (_context) - (_adj)		\
+	     >= (uintptr_t)(((long *)(_jmpbuf))[17]) - (_adj)));	\
+  })
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t)(_address) - (_adj) < (uintptr_t)(((long *)_jmpbuf)[0]) - (_adj))
+
+/* We use a longjmp() which can cross from the alternate signal-stack
+   to the normal stack.  */
+extern void __libc_unwind_longjmp (sigjmp_buf env, int val)
+          __attribute__ ((noreturn));
+hidden_proto (__libc_unwind_longjmp)
diff --git a/sysdeps/ia64/ldbl2mpn.c b/sysdeps/ia64/ldbl2mpn.c
new file mode 100644
index 0000000000..641b789cd4
--- /dev/null
+++ b/sysdeps/ia64/ldbl2mpn.c
@@ -0,0 +1 @@
+#include "../i386/ldbl2mpn.c"
diff --git a/sysdeps/ia64/libc-tls.c b/sysdeps/ia64/libc-tls.c
index f1df4cd12e..2c0eeae86f 100644
--- a/sysdeps/ia64/libc-tls.c
+++ b/sysdeps/ia64/libc-tls.c
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  IA-64 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 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
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <sysdeps/generic/libc-tls.c>
+#include <csu/libc-tls.c>
 
 #if USE_TLS
 
@@ -30,8 +30,7 @@ void *
 __tls_get_addr (size_t m, size_t offset)
 {
   dtv_t *dtv = THREAD_DTV ();
-  return (char *) dtv[1].pointer + offset;
+  return (char *) dtv[1].pointer.val + offset;
 }
 
 #endif
-
diff --git a/sysdeps/ia64/libgcc-compat.c b/sysdeps/ia64/libgcc-compat.c
new file mode 100644
index 0000000000..0be489757f
--- /dev/null
+++ b/sysdeps/ia64/libgcc-compat.c
@@ -0,0 +1,84 @@
+/* pre-.hidden libgcc compatibility
+   Copyright (C) 2002 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+#include <stdint.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_2_6)
+
+typedef int int128_t __attribute__((__mode__(TI)));
+
+extern long double __divtf3 (long double, long double) attribute_hidden;
+long double INTUSE (__divtf3) (long double x, long double y)
+{
+  return __divtf3 (x, y);
+}
+symbol_version (INTUSE (__divtf3), __divtf3, GLIBC_2.2);
+
+extern double __divdf3 (double, double) attribute_hidden;
+double INTUSE (__divdf3) (double x, double y)
+{
+  return __divdf3 (x, y);
+}
+symbol_version (INTUSE (__divdf3), __divdf3, GLIBC_2.2);
+
+extern float __divsf3 (float, float) attribute_hidden;
+float INTUSE (__divsf3) (float x, float y)
+{
+  return __divsf3 (x, y);
+}
+symbol_version (INTUSE (__divsf3), __divsf3, GLIBC_2.2);
+
+extern int64_t __divdi3 (int64_t, int64_t) attribute_hidden;
+int64_t INTUSE (__divdi3) (int64_t x, int64_t y)
+{
+  return __divdi3 (x, y);
+}
+symbol_version (INTUSE (__divdi3), __divdi3, GLIBC_2.2);
+
+extern int64_t __moddi3 (int64_t, int64_t) attribute_hidden;
+int64_t INTUSE (__moddi3) (int64_t x, int64_t y)
+{
+  return __moddi3 (x, y);
+}
+symbol_version (INTUSE (__moddi3), __moddi3, GLIBC_2.2);
+
+extern uint64_t __udivdi3 (uint64_t, uint64_t) attribute_hidden;
+uint64_t INTUSE (__udivdi3) (uint64_t x, uint64_t y)
+{
+  return __udivdi3 (x, y);
+}
+symbol_version (INTUSE (__udivdi3), __udivdi3, GLIBC_2.2);
+
+extern uint64_t __umoddi3 (uint64_t, uint64_t) attribute_hidden;
+uint64_t INTUSE (__umoddi3) (uint64_t x, uint64_t y)
+{
+  return __umoddi3 (x, y);
+}
+symbol_version (INTUSE (__umoddi3), __umoddi3, GLIBC_2.2);
+
+extern int128_t __multi3 (int128_t, int128_t) attribute_hidden;
+int128_t INTUSE (__multi3) (int128_t x, int128_t y)
+{
+  return __multi3 (x, y);
+}
+symbol_version (INTUSE (__multi3), __multi3, GLIBC_2.2);
+
+#endif
diff --git a/sysdeps/ia64/memccpy.S b/sysdeps/ia64/memccpy.S
index 53c43c512b..dd638d43c8 100644
--- a/sysdeps/ia64/memccpy.S
+++ b/sysdeps/ia64/memccpy.S
@@ -1,6 +1,6 @@
 /* Optimized version of the memccpy() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000,2001,2003,2006 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -183,27 +183,64 @@ ENTRY(memccpy)
 	br.ret.sptk.many b0
 
 .recovery1:
-	adds	src = -(MEMLAT + 6 + 1) * 8, asrc
+#if MEMLAT != 6
+# error "MEMLAT must be 6!"
+#endif
+	adds	src = -8, asrc
 	mov	loopcnt = ar.lc
-	mov	tmp = ar.ec ;;
+	mov	tmp = ar.ec
+	;;
+(p[0])	adds	src = -8, src
+	;;
+(p[1])	adds	src = -8, src
 	sub	sh1 = (MEMLAT + 6 + 1), tmp
-	shr.u	sh2 = sh2, 3
-	;; 
+	;;
+(p[2])	adds	src = -8, src
+	;;
+(p[3])	adds	src = -8, src
 	shl	loopcnt = loopcnt, 3
-	sub	src = src, sh2
+	;;
+(p[4])	adds	src = -8, src
+	;;
+(p[5])	adds	src = -8, src
 	shl	sh1 = sh1, 3
+	;;
+(p[6])	adds	src = -8, src
+	;;
+(p[7])	adds	src = -8, src
 	shl	tmp = tmp, 3
 	;;
+(p[8])	adds	src = -8, src
+	;;
+(p[9])	adds	src = -8, src
+	shr.u	sh2 = sh2, 3
+	;;
+(p[10])	adds	src = -8, src
+	;;
+(p[11])	adds	src = -8, src
 	add	len = len, loopcnt
-	add	src = sh1, src ;;
+	;;
+	sub	src = src, sh2
+	;;
 	add	len = tmp, len
-.back1:
+	add	src = sh1, src
 	br.cond.sptk .cpyfew
 
 .recovery2:
-	add	tmp = -(MEMLAT + 3) * 8, src
+#if MEMLAT != 6
+# error "MEMLAT must be 6!"
+#endif
+	add	tmp = -8, src
 (p7)	br.cond.spnt .gotit
 	;;
+(p[0])	add	tmp = -8, tmp ;;
+(p[1])	add	tmp = -8, tmp ;;
+(p[2])	add	tmp = -8, tmp ;;
+(p[3])	add	tmp = -8, tmp ;;
+(p[4])	add	tmp = -8, tmp ;;
+(p[5])	add	tmp = -8, tmp ;;
+(p[6])	add	tmp = -8, tmp ;;
+(p[7])	add	tmp = -8, tmp ;;
 	ld8	r[MEMLAT+2] = [tmp] ;;
 	xor	pos0[1] = r[MEMLAT+2], charx8 ;;
 	czx1.r	pos0[1] = pos0[1] ;;
diff --git a/sysdeps/ia64/strchr.S b/sysdeps/ia64/strchr.S
index 258562796a..63db7ff7e5 100644
--- a/sysdeps/ia64/strchr.S
+++ b/sysdeps/ia64/strchr.S
@@ -108,5 +108,5 @@ ENTRY(strchr)
 	br.cond.sptk	.back
 END(strchr)
 
-weak_alias(strchr, index)
+weak_alias (strchr, index)
 libc_hidden_builtin_def (strchr)
diff --git a/sysdeps/ia64/strlen.S b/sysdeps/ia64/strlen.S
index a05b054ed8..518d86b0d2 100644
--- a/sysdeps/ia64/strlen.S
+++ b/sysdeps/ia64/strlen.S
@@ -1,6 +1,6 @@
 /* Optimized version of the standard strlen() function.
    This file is part of the GNU C Library.
-   Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
    Contributed by Dan Pop <Dan.Pop@cern.ch>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -73,7 +73,7 @@ ENTRY(strlen)
 	ld8	val1 = [str], 8;;
 	nop.b	0
 	nop.b 	0
-l2:	ld8.s	val2 = [str], 8		// don't bomb out here
+.l2:	ld8.s	val2 = [str], 8		// don't bomb out here
 	czx1.r	pos0 = val1	
 	;;
 	cmp.ne	p6, p0 = 8, pos0
@@ -81,7 +81,7 @@ l2:	ld8.s	val2 = [str], 8		// don't bomb out here
 	chk.s	val2, .recovery
 .back:
 	mov	val1 = val2	
-	br.cond.dptk l2
+	br.cond.dptk	.l2
 .foundit:
 	sub	tmp = str, origadd	// tmp = crt address - orig
 	add	len = len, pos0;;
diff --git a/sysdeps/ieee754/Dist b/sysdeps/ieee754/Dist
deleted file mode 100644
index 94cc5c9ac4..0000000000
--- a/sysdeps/ieee754/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-support.c
-ieee754.h
diff --git a/sysdeps/ieee754/bits/nan.h b/sysdeps/ieee754/bits/nan.h
index 4d4062cfcb..bae97f2165 100644
--- a/sysdeps/ieee754/bits/nan.h
+++ b/sysdeps/ieee754/bits/nan.h
@@ -1,5 +1,5 @@
 /* `NAN' constant for IEEE 754 machines.
-   Copyright (C) 1992, 1996, 1997, 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1992,1996,1997,1999,2004,2006 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
@@ -26,13 +26,13 @@
 
 #if __GNUC_PREREQ(3,3)
 
-# define NAN	(__builtin_nanf(""))
+# define NAN	(__builtin_nanf (""))
 
-#elif defined__GNUC__
+#elif defined __GNUC__
 
 # define NAN \
-  (__extension__                                                            \
-   ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })  \
+  (__extension__							      \
+   ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; })  \
     { __l: 0x7fc00000UL }).__d)
 
 #else
diff --git a/sysdeps/ieee754/dbl-64/Dist b/sysdeps/ieee754/dbl-64/Dist
deleted file mode 100644
index 4920caedcc..0000000000
--- a/sysdeps/ieee754/dbl-64/Dist
+++ /dev/null
@@ -1,33 +0,0 @@
-asincos.tbl
-atnat.h
-atnat2.h
-branred.h
-dla.h
-doasin.h
-dosincos.h
-MathLib.h
-mpa.h
-mpa2.h
-mpatan.h
-mpexp.h
-mplog.h
-mpsqrt.h
-mydefs.h
-powtwo.tbl
-root.tbl
-sincos.tbl
-sincos32.h
-t_exp2.h
-uasncs.h
-uatan.tbl
-uexp.h
-uexp.tbl
-ulog.h
-ulog.tbl
-upow.h
-upow.tbl
-urem.h
-uroot.h
-usncs.h
-utan.h
-utan.tbl
diff --git a/sysdeps/ieee754/dbl-64/e_exp2.c b/sysdeps/ieee754/dbl-64/e_exp2.c
index 397acd182c..ce6368be43 100644
--- a/sysdeps/ieee754/dbl-64/e_exp2.c
+++ b/sysdeps/ieee754/dbl-64/e_exp2.c
@@ -1,5 +1,5 @@
 /* Double-precision floating point 2^x.
-   Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
 
@@ -37,6 +37,11 @@
 
 #include "t_exp2.h"
 
+/* XXX I know the assembler generates a warning about incorrect section
+   attributes. But without the attribute here the compiler places the
+   constants in the .data section.  Ideally the constant is placed in
+   .rodata.cst8 so that it can be merged, but gcc sucks, it ICEs when
+   we try to force this section on it.  --drepper  */
 static const volatile double TWO1023 = 8.988465674311579539e+307;
 static const volatile double TWOM1000 = 9.3326361850321887899e-302;
 
diff --git a/sysdeps/ieee754/dbl-64/e_pow.c b/sysdeps/ieee754/dbl-64/e_pow.c
index d9bd8b479f..1e159f2c0b 100644
--- a/sysdeps/ieee754/dbl-64/e_pow.c
+++ b/sysdeps/ieee754/dbl-64/e_pow.c
@@ -106,20 +106,28 @@ double __ieee754_pow(double x, double y) {
     else
       return y < 0 ? 1.0/ABS(x) : 0.0;                               /* return 0 */
   }
+
+  qx = u.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
+  qy = v.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
+
+  if (qx >= 0x7ff00000 && (qx > 0x7ff00000 || u.i[LOW_HALF] != 0)) return NaNQ.x;
+  if (qy >= 0x7ff00000 && (qy > 0x7ff00000 || v.i[LOW_HALF] != 0))
+    return x == 1.0 ? 1.0 : NaNQ.x;
+
   /* if x<0 */
   if (u.i[HIGH_HALF] < 0) {
     k = checkint(y);
     if (k==0) {
-      if ((v.i[HIGH_HALF] & 0x7fffffff) == 0x7ff00000 && v.i[LOW_HALF] == 0) {
+      if (qy == 0x7ff00000) {
 	if (x == -1.0) return 1.0;
 	else if (x > -1.0) return v.i[HIGH_HALF] < 0 ? INF.x : 0.0;
 	else return v.i[HIGH_HALF] < 0 ? 0.0 : INF.x;
       }
-      else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0)
+      else if (qx == 0x7ff00000)
 	return y < 0 ? 0.0 : INF.x;
       return NaNQ.x;                              /* y not integer and x<0 */
     }
-    else if (u.i[HIGH_HALF] == 0xfff00000 && u.i[LOW_HALF] == 0)
+    else if (qx == 0x7ff00000)
       {
 	if (k < 0)
 	  return y < 0 ? nZERO.x : nINF.x;
@@ -129,14 +137,6 @@ double __ieee754_pow(double x, double y) {
     return (k==1)?__ieee754_pow(-x,y):-__ieee754_pow(-x,y); /* if y even or odd */
   }
   /* x>0 */
-  qx = u.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
-  qy = v.i[HIGH_HALF]&0x7fffffff;  /*   no sign   */
-
-  if (qx > 0x7ff00000 || (qx == 0x7ff00000 && u.i[LOW_HALF] != 0)) return NaNQ.x;
-                                                                 /*  if 0<x<2^-0x7fe */
-  if (qy > 0x7ff00000 || (qy == 0x7ff00000 && v.i[LOW_HALF] != 0))
-    return x == 1.0 ? 1.0 : NaNQ.x;
-                                                                 /*  if y<2^-0x7fe   */
 
   if (qx == 0x7ff00000)                              /* x= 2^-0x3ff */
     {if (y == 0) return NaNQ.x;
diff --git a/sysdeps/ieee754/dbl-64/halfulp.c b/sysdeps/ieee754/dbl-64/halfulp.c
index 9e1111b8db..478a4bacf6 100644
--- a/sysdeps/ieee754/dbl-64/halfulp.c
+++ b/sysdeps/ieee754/dbl-64/halfulp.c
@@ -1,7 +1,7 @@
 /*
  * IBM Accurate Mathematical Library
  * written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation
+ * Copyright (C) 2001, 2005 Free Software Foundation
  *
  * 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
@@ -42,7 +42,7 @@
 
 double __ieee754_sqrt(double x);
 
-int4 tab54[32] = {
+static const int4 tab54[32] = {
    262143, 11585, 1782, 511, 210, 107, 63, 42,
        30,    22,   17,  14,  12,  10,  9,  7,
         7,     6,    5,   5,   5,   4,  4,  4,
diff --git a/sysdeps/ieee754/dbl-64/s_llrint.c b/sysdeps/ieee754/dbl-64/s_llrint.c
index 893bd716b5..64c870eaaa 100644
--- a/sysdeps/ieee754/dbl-64/s_llrint.c
+++ b/sysdeps/ieee754/dbl-64/s_llrint.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -23,7 +23,7 @@
 
 #include "math_private.h"
 
-static const long double two52[2] =
+static const double two52[2] =
 {
   4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
  -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
@@ -48,19 +48,14 @@ __llrint (double x)
 
   if (j0 < 20)
     {
-      if (j0 < -1)
-	return 0;
-      else
-	{
-	  w = two52[sx] + x;
-	  t = w - two52[sx];
-	  EXTRACT_WORDS (i0, i1, t);
-	  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-	  i0 &= 0xfffff;
-	  i0 |= 0x100000;
+      w = two52[sx] + x;
+      t = w - two52[sx];
+      EXTRACT_WORDS (i0, i1, t);
+      j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+      i0 &= 0xfffff;
+      i0 |= 0x100000;
 
-	  result = i0 >> (20 - j0);
-	}
+      result = (j0 < 0 ? 0 : i0 >> (20 - j0));
     }
   else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
     {
diff --git a/sysdeps/ieee754/dbl-64/s_lrint.c b/sysdeps/ieee754/dbl-64/s_lrint.c
index 2da68d4dcd..1084ed6e2d 100644
--- a/sysdeps/ieee754/dbl-64/s_lrint.c
+++ b/sysdeps/ieee754/dbl-64/s_lrint.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -48,19 +48,14 @@ __lrint (double x)
 
   if (j0 < 20)
     {
-      if (j0 < -1)
-	return 0;
-      else
-	{
-	  w = two52[sx] + x;
-	  t = w - two52[sx];
-	  EXTRACT_WORDS (i0, i1, t);
-	  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
-	  i0 &= 0xfffff;
-	  i0 |= 0x100000;
+      w = two52[sx] + x;
+      t = w - two52[sx];
+      EXTRACT_WORDS (i0, i1, t);
+      j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+      i0 &= 0xfffff;
+      i0 |= 0x100000;
 
-	  result = i0 >> (20 - j0);
-	}
+      result = (j0 < 0 ? 0 : i0 >> (20 - j0));
     }
   else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
     {
diff --git a/sysdeps/ieee754/dbl-64/s_sincos.c b/sysdeps/ieee754/dbl-64/s_sincos.c
index f0542c500c..e946f9f976 100644
--- a/sysdeps/ieee754/dbl-64/s_sincos.c
+++ b/sysdeps/ieee754/dbl-64/s_sincos.c
@@ -1,5 +1,5 @@
 /* Compute sine and cosine of argument.
-   Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -40,8 +40,8 @@ __sincos (double x, double *sinx, double *cosx)
     }
   else
     {
-      *sinx = sin (x);
-      *cosx = cos (x);
+      *sinx = __sin (x);
+      *cosx = __cos (x);
     }
 }
 weak_alias (__sincos, sincos)
diff --git a/sysdeps/ieee754/flt-32/Dist b/sysdeps/ieee754/flt-32/Dist
deleted file mode 100644
index 045ac801f6..0000000000
--- a/sysdeps/ieee754/flt-32/Dist
+++ /dev/null
@@ -1 +0,0 @@
-t_exp2f.h
diff --git a/sysdeps/ieee754/flt-32/e_atan2f.c b/sysdeps/ieee754/flt-32/e_atan2f.c
index 8b3398c0a3..c0cafb16b8 100644
--- a/sysdeps/ieee754/flt-32/e_atan2f.c
+++ b/sysdeps/ieee754/flt-32/e_atan2f.c
@@ -30,7 +30,7 @@ zero  = 0.0,
 pi_o_4  = 7.8539818525e-01,  /* 0x3f490fdb */
 pi_o_2  = 1.5707963705e+00,  /* 0x3fc90fdb */
 pi      = 3.1415927410e+00,  /* 0x40490fdb */
-pi_lo   = -8.7422776573e-07; /* 0xb3bbbd2e */
+pi_lo   = -8.7422776573e-08; /* 0xb3bbbd2e */
 
 #ifdef __STDC__
 	float __ieee754_atan2f(float y, float x)
diff --git a/sysdeps/ieee754/flt-32/e_exp2f.c b/sysdeps/ieee754/flt-32/e_exp2f.c
index 752272db46..194222a0cd 100644
--- a/sysdeps/ieee754/flt-32/e_exp2f.c
+++ b/sysdeps/ieee754/flt-32/e_exp2f.c
@@ -1,5 +1,5 @@
 /* Single-precision floating point 2^x.
-   Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,2000,2001,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
 
diff --git a/sysdeps/ieee754/flt-32/e_expf.c b/sysdeps/ieee754/flt-32/e_expf.c
index 62448a9554..b9cd53c033 100644
--- a/sysdeps/ieee754/flt-32/e_expf.c
+++ b/sysdeps/ieee754/flt-32/e_expf.c
@@ -1,5 +1,5 @@
 /* Single-precision floating point e^x.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Geoffrey Keating <geoffk@ozemail.com.au>
 
diff --git a/sysdeps/ieee754/flt-32/e_hypotf.c b/sysdeps/ieee754/flt-32/e_hypotf.c
index d6b1520cb8..a8e1a52d2b 100644
--- a/sysdeps/ieee754/flt-32/e_hypotf.c
+++ b/sysdeps/ieee754/flt-32/e_hypotf.c
@@ -23,7 +23,7 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
 #ifdef __STDC__
 	float __ieee754_hypotf(float x, float y)
 #else
-	float __ieee754_hypot(x,y)
+	float __ieee754_hypotf(x,y)
 	float x, y;
 #endif
 {
@@ -47,20 +47,20 @@ static char rcsid[] = "$NetBSD: e_hypotf.c,v 1.5 1995/05/12 04:57:30 jtc Exp $";
 	       return w;
 	   }
 	   /* scale a and b by 2**-60 */
-	   ha -= 0x5d800000; hb -= 0x5d800000;	k += 60;
+	   ha -= 0x1e000000; hb -= 0x1e000000;	k += 60;
 	   SET_FLOAT_WORD(a,ha);
 	   SET_FLOAT_WORD(b,hb);
 	}
 	if(hb < 0x26800000) {	/* b < 2**-50 */
 	    if(hb <= 0x007fffff) {	/* subnormal b or 0 */
 	        if(hb==0) return a;
-		SET_FLOAT_WORD(t1,0x3f000000);	/* t1=2^126 */
+		SET_FLOAT_WORD(t1,0x7e800000);	/* t1=2^126 */
 		b *= t1;
 		a *= t1;
 		k -= 126;
 	    } else {		/* scale a and b by 2^60 */
-	        ha += 0x5d800000; 	/* a *= 2^60 */
-		hb += 0x5d800000;	/* b *= 2^60 */
+	        ha += 0x1e000000; 	/* a *= 2^60 */
+		hb += 0x1e000000;	/* b *= 2^60 */
 		k -= 60;
 		SET_FLOAT_WORD(a,ha);
 		SET_FLOAT_WORD(b,hb);
diff --git a/sysdeps/ieee754/flt-32/s_expm1f.c b/sysdeps/ieee754/flt-32/s_expm1f.c
index 375e334c38..1f032be25f 100644
--- a/sysdeps/ieee754/flt-32/s_expm1f.c
+++ b/sysdeps/ieee754/flt-32/s_expm1f.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -20,7 +20,8 @@ static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
-static const volatile float huge = 1.0e+30, tiny = 1.0e-30;
+static const volatile float huge = 1.0e+30;
+static const volatile float tiny = 1.0e-30;
 
 #ifdef __STDC__
 static const float
@@ -71,7 +72,7 @@ Q5  =  -2.0109921195e-07; /* 0xb457edbb */
 	}
 
     /* argument reduction */
-	if(hx > 0x3eb17218) {		/* if  |x| > 0.5 ln2 */ 
+	if(hx > 0x3eb17218) {		/* if  |x| > 0.5 ln2 */
 	    if(hx < 0x3F851592) {	/* and |x| < 1.5 ln2 */
 		if(xsb==0)
 		    {hi = x - ln2_hi; lo =  ln2_lo;  k =  1;}
@@ -85,10 +86,10 @@ Q5  =  -2.0109921195e-07; /* 0xb457edbb */
 	    }
 	    x  = hi - lo;
 	    c  = (hi-x)-lo;
-	} 
+	}
 	else if(hx < 0x33000000) {  	/* when |x|<2**-25, return x */
 	    t = huge+x;	/* return x with inexact flags when x!=0 */
-	    return x - (t-(huge+x));	
+	    return x - (t-(huge+x));
 	}
 	else k = 0;
 
diff --git a/sysdeps/ieee754/flt-32/s_llrintf.c b/sysdeps/ieee754/flt-32/s_llrintf.c
index 3b9a484a8d..7c6e4bcda4 100644
--- a/sysdeps/ieee754/flt-32/s_llrintf.c
+++ b/sysdeps/ieee754/flt-32/s_llrintf.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -23,7 +23,7 @@
 
 #include "math_private.h"
 
-static const double two23[2] =
+static const float two23[2] =
 {
   8.3886080000e+06, /* 0x4B000000 */
  -8.3886080000e+06, /* 0xCB000000 */
@@ -49,9 +49,7 @@ __llrintf (float x)
 
   if (j0 < (int32_t) (sizeof (long long int) * 8) - 1)
     {
-      if (j0 < -1)
-	return 0;
-      else if (j0 >= 23)
+      if (j0 >= 23)
 	result = (long long int) i0 << (j0 - 23);
       else
 	{
@@ -62,7 +60,7 @@ __llrintf (float x)
 	  i0 &= 0x7fffff;
 	  i0 |= 0x800000;
 
-	  result = i0 >> (23 - j0);
+	  result = (j0 < 0 ? 0 : i0 >> (23 - j0));
 	}
     }
   else
diff --git a/sysdeps/ieee754/flt-32/s_lrintf.c b/sysdeps/ieee754/flt-32/s_lrintf.c
index 2a156f7ce2..64486a4c3e 100644
--- a/sysdeps/ieee754/flt-32/s_lrintf.c
+++ b/sysdeps/ieee754/flt-32/s_lrintf.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -23,7 +23,7 @@
 
 #include "math_private.h"
 
-static const double two23[2] =
+static const float two23[2] =
 {
   8.3886080000e+06, /* 0x4B000000 */
  -8.3886080000e+06, /* 0xCB000000 */
@@ -49,9 +49,7 @@ __lrintf (float x)
 
   if (j0 < (int32_t) (sizeof (long int) * 8) - 1)
     {
-      if (j0 < -1)
-	return 0;
-      else if (j0 >= 23)
+      if (j0 >= 23)
 	result = (long int) i0 << (j0 - 23);
       else
 	{
@@ -62,7 +60,7 @@ __lrintf (float x)
 	  i0 &= 0x7fffff;
 	  i0 |= 0x800000;
 
-	  result = i0 >> (23 - j0);
+	  result = (j0 < 0 ? 0 : i0 >> (23 - j0));
 	}
     }
   else
diff --git a/sysdeps/ieee754/flt-32/s_nextafterf.c b/sysdeps/ieee754/flt-32/s_nextafterf.c
index e1568e24c9..600c14621f 100644
--- a/sysdeps/ieee754/flt-32/s_nextafterf.c
+++ b/sysdeps/ieee754/flt-32/s_nextafterf.c
@@ -18,7 +18,7 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp
 #endif
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
 #include <float.h>
 
 #ifdef __STDC__
@@ -40,9 +40,12 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp
 	   return x+y;
 	if(x==y) return y;		/* x=y, return y */
 	if(ix==0) {				/* x == 0 */
+	    float u;
 	    SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u*u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
 	    if(hx>hy) {				/* x > y, x -= ulp */
@@ -61,15 +64,12 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp
 	if(hy>=0x7f800000) {
 	  x = x+x;	/* overflow  */
 	  if (FLT_EVAL_METHOD != 0)
-	    asm ("" : "=m"(x) : "m"(x));
+	    asm ("" : "+m"(x));
 	  return x;	/* overflow  */
 	}
-	if(hy<0x00800000) {		/* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        SET_FLOAT_WORD(y,hx);
-		return y;
-	    }
+	if(hy<0x00800000) {
+	    float u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	SET_FLOAT_WORD(x,hx);
 	return x;
diff --git a/sysdeps/ieee754/ldbl-128/Dist b/sysdeps/ieee754/ldbl-128/Dist
deleted file mode 100644
index 4504060729..0000000000
--- a/sysdeps/ieee754/ldbl-128/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-ieee754.h
-t_expl.h
diff --git a/sysdeps/ieee754/ldbl-128/e_powl.c b/sysdeps/ieee754/ldbl-128/e_powl.c
index 18bf237e65..ba7e27b7d7 100644
--- a/sysdeps/ieee754/ldbl-128/e_powl.c
+++ b/sysdeps/ieee754/ldbl-128/e_powl.c
@@ -220,7 +220,7 @@ __ieee754_powl (x, y)
 	{
 	  if (((ix - 0x3fff0000) | p.parts32.w1 | p.parts32.w2 | p.parts32.w3)
 	      == 0)
-	    return y - y;	/* inf**+-1 is NaN */
+	    return y - y;	/* +-1**inf is NaN */
 	  else if (ix >= 0x3fff0000)	/* (|x|>1)**+-inf = inf,0 */
 	    return (hy >= 0) ? y : zero;
 	  else			/* (|x|<1)**-,+inf = inf,0 */
diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c
index 0cb6b293e0..361a9baa05 100644
--- a/sysdeps/ieee754/ldbl-128/printf_fphex.c
+++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c
@@ -1,6 +1,6 @@
 /* Print floating point number in hexadecimal notation according to
    ISO C99.
-   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2005 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
@@ -103,4 +103,4 @@ do {									      \
 	}								      \
 } while (0)
 
-#include <sysdeps/generic/printf_fphex.c>
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c
index d6899e8500..5804f57d11 100644
--- a/sysdeps/ieee754/ldbl-128/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
    		  Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -48,16 +48,16 @@ __llrintl (long double x)
 
   if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
     {
-      if (j0 < -1)
-	return 0;
       w = two112[sx] + x;
       t = w - two112[sx];
-      GET_LDOUBLE_WORDS64 (i0, i1, x);
+      GET_LDOUBLE_WORDS64 (i0, i1, t);
       j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
       i0 &= 0x0000ffffffffffffLL;
       i0 |= 0x0001000000000000LL;
 
-      if (j0 <= 48)
+      if (j0 < 0)
+	result = 0;
+      else if (j0 <= 48)
 	result = i0 >> (48 - j0);
       else
 	result = ((long long int) i0 << (j0 - 48)) | (i1 >> (112 - j0));
diff --git a/sysdeps/ieee754/ldbl-128/s_lrintl.c b/sysdeps/ieee754/ldbl-128/s_lrintl.c
index 66f9a429fc..ead24e99f0 100644
--- a/sysdeps/ieee754/ldbl-128/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_lrintl.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
    		  Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -48,19 +48,14 @@ __lrintl (long double x)
 
   if (j0 < 48)
     {
-      if (j0 < -1)
-	return 0;
-      else
-	{
-	  w = two112[sx] + x;
-	  t = w - two112[sx];
-	  GET_LDOUBLE_WORDS64 (i0, i1, x);
-	  j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
-	  i0 &= 0x0000ffffffffffffLL;
-	  i0 |= 0x0001000000000000LL;
+      w = two112[sx] + x;
+      t = w - two112[sx];
+      GET_LDOUBLE_WORDS64 (i0, i1, t);
+      j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
+      i0 &= 0x0000ffffffffffffLL;
+      i0 |= 0x0001000000000000LL;
 
-	  result = i0 >> (48 - j0);
-	}
+      result = (j0 < 0 ? 0 : i0 >> (48 - j0));
     }
   else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
     {
@@ -70,7 +65,7 @@ __lrintl (long double x)
 	{
 	  w = two112[sx] + x;
 	  t = w - two112[sx];
-	  GET_LDOUBLE_WORDS64 (i0, i1, x);
+	  GET_LDOUBLE_WORDS64 (i0, i1, t);
 	  j0 = ((i0 >> 48) & 0x7fff) - 0x3fff;
 	  i0 &= 0x0000ffffffffffffLL;
 	  i0 |= 0x0001000000000000LL;
diff --git a/sysdeps/ieee754/ldbl-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-128/s_nextafterl.c
index d3df668178..7bc869a518 100644
--- a/sysdeps/ieee754/ldbl-128/s_nextafterl.c
+++ b/sysdeps/ieee754/ldbl-128/s_nextafterl.c
@@ -25,7 +25,7 @@ static char rcsid[] = "$NetBSD: $";
  */
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
 
 #ifdef __STDC__
 	long double __nextafterl(long double x, long double y)
@@ -47,9 +47,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if(x==y) return y;		/* x=y, return y */
 	if((ix|lx)==0) {			/* x == 0 */
+	    long double u;
 	    SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {			/* x > 0 */
 	    if(hx>hy||((hx==hy)&&(lx>ly))) {	/* x > y, x -= ulp */
@@ -70,12 +73,9 @@ static char rcsid[] = "$NetBSD: $";
 	}
 	hy = hx&0x7fff000000000000LL;
 	if(hy==0x7fff000000000000LL) return x+x;/* overflow  */
-	if(hy==0) {				/* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        SET_LDOUBLE_WORDS64(y,hx,lx);
-		return y;
-	    }
+	if(hy==0) {
+	    long double u = x*x;		/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	SET_LDOUBLE_WORDS64(x,hx,lx);
 	return x;
diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
index 553e401973..178505c58f 100644
--- a/sysdeps/ieee754/ldbl-128/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c
@@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $";
  */
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
 #include <float.h>
 
 #ifdef __STDC__
@@ -53,10 +53,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if((long double) x==y) return y;	/* x=y, return y */
 	if((ix|lx)==0) {			/* x == 0 */
-	    double x2;
+	    double u;
 	    INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
-	    x2 = x*x;
-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
 	    if (hy<0||(ix>>20)>(iy>>48)-0x3c00
@@ -87,16 +89,13 @@ static char rcsid[] = "$NetBSD: $";
 	if(hy>=0x7ff00000) {
 	  x = x+x;	/* overflow  */
 	  if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
-	    /* Force conversion to float.  */
-	    asm ("" : "=m"(x) : "m"(x));
+	    /* Force conversion to double.  */
+	    asm ("" : "+m"(x));
 	  return x;
 	}
-	if(hy<0x00100000) {		/* underflow */
-	    double x2 = x*x;
-	    if(x2!=x) {		/* raise underflow flag */
-	        INSERT_WORDS(x2,hx,lx);
-		return x2;
-	    }
+	if(hy<0x00100000) {
+	    double u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	INSERT_WORDS(x,hx,lx);
 	return x;
diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile
new file mode 100644
index 0000000000..8e1e2e6ae5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/Makefile
@@ -0,0 +1,5 @@
+# The`long double' type is a distinct type we support if
+# -mlong-double-128 option is used (or when it becomes a default
+# when -mlong-double-64 is not used).
+long-double-fcts = yes
+sysdep-CFLAGS += -mlong-double-128
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
new file mode 100644
index 0000000000..00576c76c8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
@@ -0,0 +1,69 @@
+/* @(#)e_acosh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $";
+#endif
+
+/* __ieee754_acosh(x)
+ * Method :
+ *	Based on
+ *		acosh(x) = log [ x + sqrt(x*x-1) ]
+ *	we have
+ *		acosh(x) := log(x)+ln2,	if x is large; else
+ *		acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else
+ *		acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1.
+ *
+ * Special cases:
+ *	acosh(x) is NaN with signal if x<1.
+ *	acosh(NaN) is NaN without signal.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+one	= 1.0L,
+ln2	= 6.93147180559945286227e-01L;  /* 0x3FE62E42, 0xFEFA39EF */
+
+#ifdef __STDC__
+	long double __ieee754_acoshl(long double x)
+#else
+	long double __ieee754_acoshl(x)
+	long double x;
+#endif
+{
+	long double t;
+	int64_t hx;
+	u_int64_t lx;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	if(hx<0x3ff0000000000000LL) {		/* x < 1 */
+	    return (x-x)/(x-x);
+	} else if(hx >=0x41b0000000000000LL) {	/* x > 2**28 */
+	    if(hx >=0x7ff0000000000000LL) {	/* x is inf of NaN */
+	        return x+x;
+	    } else
+		return __ieee754_logl(x)+ln2;	/* acosh(huge)=log(2x) */
+	} else if (((hx-0x3ff0000000000000LL)|(lx&0x7fffffffffffffffLL))==0) {
+	    return 0.0;			/* acosh(1) = 0 */
+	} else if (hx > 0x4000000000000000LL) {	/* 2**28 > x > 2 */
+	    t=x*x;
+	    return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one)));
+	} else {			/* 1<x<2 */
+	    t = x-one;
+	    return __log1p(t+__sqrtl(2.0*t+t*t));
+	}
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
new file mode 100644
index 0000000000..8823fd69b4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
@@ -0,0 +1,328 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+   Long double expansions are
+   Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+   and are incorporated herein by permission of the author.  The author
+   reserves the right to distribute this material elsewhere under different
+   copying permissions.  These modifications are distributed here under
+   the following terms:
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* __ieee754_acosl(x)
+ * Method :
+ *      acos(x)  = pi/2 - asin(x)
+ *      acos(-x) = pi/2 + asin(x)
+ * For |x| <= 0.375
+ *      acos(x) = pi/2 - asin(x)
+ * Between .375 and .5 the approximation is
+ *      acos(0.4375 + x) = acos(0.4375) + x P(x) / Q(x)
+ * Between .5 and .625 the approximation is
+ *      acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
+ * For x > 0.625,
+ *      acos(x) = 2 asin(sqrt((1-x)/2))
+ *      computed with an extended precision square root in the leading term.
+ * For x < -0.625
+ *      acos(x) = pi - 2 asin(sqrt((1-|x|)/2))
+ *
+ * Special cases:
+ *      if x is NaN, return x itself;
+ *      if |x|>1, return NaN with invalid signal.
+ *
+ * Functions needed: __ieee754_sqrtl.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  one = 1.0L,
+  pio2_hi = 1.5707963267948966192313216916397514420986L,
+  pio2_lo = 4.3359050650618905123985220130216759843812E-35L,
+
+  /* acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x)
+     -0.0625 <= x <= 0.0625
+     peak relative error 3.3e-35  */
+
+  rS0 =  5.619049346208901520945464704848780243887E0L,
+  rS1 = -4.460504162777731472539175700169871920352E1L,
+  rS2 =  1.317669505315409261479577040530751477488E2L,
+  rS3 = -1.626532582423661989632442410808596009227E2L,
+  rS4 =  3.144806644195158614904369445440583873264E1L,
+  rS5 =  9.806674443470740708765165604769099559553E1L,
+  rS6 = -5.708468492052010816555762842394927806920E1L,
+  rS7 = -1.396540499232262112248553357962639431922E1L,
+  rS8 =  1.126243289311910363001762058295832610344E1L,
+  rS9 =  4.956179821329901954211277873774472383512E-1L,
+  rS10 = -3.313227657082367169241333738391762525780E-1L,
+
+  sS0 = -4.645814742084009935700221277307007679325E0L,
+  sS1 =  3.879074822457694323970438316317961918430E1L,
+  sS2 = -1.221986588013474694623973554726201001066E2L,
+  sS3 =  1.658821150347718105012079876756201905822E2L,
+  sS4 = -4.804379630977558197953176474426239748977E1L,
+  sS5 = -1.004296417397316948114344573811562952793E2L,
+  sS6 =  7.530281592861320234941101403870010111138E1L,
+  sS7 =  1.270735595411673647119592092304357226607E1L,
+  sS8 = -1.815144839646376500705105967064792930282E1L,
+  sS9 = -7.821597334910963922204235247786840828217E-2L,
+  /* 1.000000000000000000000000000000000000000E0 */
+
+  acosr5625 = 9.7338991014954640492751132535550279812151E-1L,
+  pimacosr5625 = 2.1682027434402468335351320579240000860757E0L,
+
+  /* acos(0.4375 + x) = acos(0.4375) + x rS(x) / sS(x)
+     -0.0625 <= x <= 0.0625
+     peak relative error 2.1e-35  */
+
+  P0 =  2.177690192235413635229046633751390484892E0L,
+  P1 = -2.848698225706605746657192566166142909573E1L,
+  P2 =  1.040076477655245590871244795403659880304E2L,
+  P3 = -1.400087608918906358323551402881238180553E2L,
+  P4 =  2.221047917671449176051896400503615543757E1L,
+  P5 =  9.643714856395587663736110523917499638702E1L,
+  P6 = -5.158406639829833829027457284942389079196E1L,
+  P7 = -1.578651828337585944715290382181219741813E1L,
+  P8 =  1.093632715903802870546857764647931045906E1L,
+  P9 =  5.448925479898460003048760932274085300103E-1L,
+  P10 = -3.315886001095605268470690485170092986337E-1L,
+  Q0 = -1.958219113487162405143608843774587557016E0L,
+  Q1 =  2.614577866876185080678907676023269360520E1L,
+  Q2 = -9.990858606464150981009763389881793660938E1L,
+  Q3 =  1.443958741356995763628660823395334281596E2L,
+  Q4 = -3.206441012484232867657763518369723873129E1L,
+  Q5 = -1.048560885341833443564920145642588991492E2L,
+  Q6 =  6.745883931909770880159915641984874746358E1L,
+  Q7 =  1.806809656342804436118449982647641392951E1L,
+  Q8 = -1.770150690652438294290020775359580915464E1L,
+  Q9 = -5.659156469628629327045433069052560211164E-1L,
+  /* 1.000000000000000000000000000000000000000E0 */
+
+  acosr4375 = 1.1179797320499710475919903296900511518755E0L,
+  pimacosr4375 = 2.0236129215398221908706530535894517323217E0L,
+
+  /* asin(x) = x + x^3 pS(x^2) / qS(x^2)
+     0 <= x <= 0.5
+     peak relative error 1.9e-35  */
+  pS0 = -8.358099012470680544198472400254596543711E2L,
+  pS1 =  3.674973957689619490312782828051860366493E3L,
+  pS2 = -6.730729094812979665807581609853656623219E3L,
+  pS3 =  6.643843795209060298375552684423454077633E3L,
+  pS4 = -3.817341990928606692235481812252049415993E3L,
+  pS5 =  1.284635388402653715636722822195716476156E3L,
+  pS6 = -2.410736125231549204856567737329112037867E2L,
+  pS7 =  2.219191969382402856557594215833622156220E1L,
+  pS8 = -7.249056260830627156600112195061001036533E-1L,
+  pS9 =  1.055923570937755300061509030361395604448E-3L,
+
+  qS0 = -5.014859407482408326519083440151745519205E3L,
+  qS1 =  2.430653047950480068881028451580393430537E4L,
+  qS2 = -4.997904737193653607449250593976069726962E4L,
+  qS3 =  5.675712336110456923807959930107347511086E4L,
+  qS4 = -3.881523118339661268482937768522572588022E4L,
+  qS5 =  1.634202194895541569749717032234510811216E4L,
+  qS6 = -4.151452662440709301601820849901296953752E3L,
+  qS7 =  5.956050864057192019085175976175695342168E2L,
+  qS8 = -4.175375777334867025769346564600396877176E1L;
+  /* 1.000000000000000000000000000000000000000E0 */
+
+#ifdef __STDC__
+long double
+__ieee754_acosl (long double x)
+#else
+long double
+__ieee754_acosl (x)
+     long double x;
+#endif
+{
+  long double z, r, w, p, q, s, t, f2;
+  int32_t ix, sign;
+  ieee854_long_double_shape_type u;
+
+  u.value = x;
+  sign = u.parts32.w0;
+  ix = sign & 0x7fffffff;
+  u.parts32.w0 = ix;		/* |x| */
+  if (ix >= 0x3ff00000)		/* |x| >= 1 */
+    {
+      if (ix == 0x3ff00000
+	  && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+	{			/* |x| == 1 */
+	  if ((sign & 0x80000000) == 0)
+	    return 0.0;		/* acos(1) = 0  */
+	  else
+	    return (2.0 * pio2_hi) + (2.0 * pio2_lo);	/* acos(-1)= pi */
+	}
+      return (x - x) / (x - x);	/* acos(|x| > 1) is NaN */
+    }
+  else if (ix < 0x3fe00000)	/* |x| < 0.5 */
+    {
+      if (ix < 0x3c600000)	/* |x| < 2**-57 */
+	return pio2_hi + pio2_lo;
+      if (ix < 0x3fde0000)	/* |x| < .4375 */
+	{
+	  /* Arcsine of x.  */
+	  z = x * x;
+	  p = (((((((((pS9 * z
+		       + pS8) * z
+		      + pS7) * z
+		     + pS6) * z
+		    + pS5) * z
+		   + pS4) * z
+		  + pS3) * z
+		 + pS2) * z
+		+ pS1) * z
+	       + pS0) * z;
+	  q = (((((((( z
+		       + qS8) * z
+		     + qS7) * z
+		    + qS6) * z
+		   + qS5) * z
+		  + qS4) * z
+		 + qS3) * z
+		+ qS2) * z
+	       + qS1) * z
+	    + qS0;
+	  r = x + x * p / q;
+	  z = pio2_hi - (r - pio2_lo);
+	  return z;
+	}
+      /* .4375 <= |x| < .5 */
+      t = u.value - 0.4375L;
+      p = ((((((((((P10 * t
+		    + P9) * t
+		   + P8) * t
+		  + P7) * t
+		 + P6) * t
+		+ P5) * t
+	       + P4) * t
+	      + P3) * t
+	     + P2) * t
+	    + P1) * t
+	   + P0) * t;
+
+      q = (((((((((t
+		   + Q9) * t
+		  + Q8) * t
+		 + Q7) * t
+		+ Q6) * t
+	       + Q5) * t
+	      + Q4) * t
+	     + Q3) * t
+	    + Q2) * t
+	   + Q1) * t
+	+ Q0;
+      r = p / q;
+      if (sign & 0x80000000)
+	r = pimacosr4375 - r;
+      else
+	r = acosr4375 + r;
+      return r;
+    }
+  else if (ix < 0x3fe40000)	/* |x| < 0.625 */
+    {
+      t = u.value - 0.5625L;
+      p = ((((((((((rS10 * t
+		    + rS9) * t
+		   + rS8) * t
+		  + rS7) * t
+		 + rS6) * t
+		+ rS5) * t
+	       + rS4) * t
+	      + rS3) * t
+	     + rS2) * t
+	    + rS1) * t
+	   + rS0) * t;
+
+      q = (((((((((t
+		   + sS9) * t
+		  + sS8) * t
+		 + sS7) * t
+		+ sS6) * t
+	       + sS5) * t
+	      + sS4) * t
+	     + sS3) * t
+	    + sS2) * t
+	   + sS1) * t
+	+ sS0;
+      if (sign & 0x80000000)
+	r = pimacosr5625 - p / q;
+      else
+	r = acosr5625 + p / q;
+      return r;
+    }
+  else
+    {				/* |x| >= .625 */
+      z = (one - u.value) * 0.5;
+      s = __ieee754_sqrtl (z);
+      /* Compute an extended precision square root from
+	 the Newton iteration  s -> 0.5 * (s + z / s).
+         The change w from s to the improved value is
+	    w = 0.5 * (s + z / s) - s  = (s^2 + z)/2s - s = (z - s^2)/2s.
+          Express s = f1 + f2 where f1 * f1 is exactly representable.
+	  w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
+          s + w has extended precision.  */
+      u.value = s;
+      u.parts32.w2 = 0;
+      u.parts32.w3 = 0;
+      f2 = s - u.value;
+      w = z - u.value * u.value;
+      w = w - 2.0 * u.value * f2;
+      w = w - f2 * f2;
+      w = w / (2.0 * s);
+      /* Arcsine of s.  */
+      p = (((((((((pS9 * z
+		   + pS8) * z
+		  + pS7) * z
+		 + pS6) * z
+		+ pS5) * z
+	       + pS4) * z
+	      + pS3) * z
+	     + pS2) * z
+	    + pS1) * z
+	   + pS0) * z;
+      q = (((((((( z
+		   + qS8) * z
+		 + qS7) * z
+		+ qS6) * z
+	       + qS5) * z
+	      + qS4) * z
+	     + qS3) * z
+	    + qS2) * z
+	   + qS1) * z
+	+ qS0;
+      r = s + (w + s * p / q);
+
+      if (sign & 0x80000000)
+	w = pio2_hi + (pio2_lo - r);
+      else
+	w = r;
+      return 2.0 * w;
+    }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
new file mode 100644
index 0000000000..3696694f78
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c
@@ -0,0 +1,265 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+  Long double expansions are
+  Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+  and are incorporated herein by permission of the author.  The author 
+  reserves the right to distribute this material elsewhere under different 
+  copying permissions.  These modifications are distributed here under the 
+  following terms:
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* __ieee754_asin(x)
+ * Method :
+ *	Since  asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...
+ *	we approximate asin(x) on [0,0.5] by
+ *		asin(x) = x + x*x^2*R(x^2)
+ *      Between .5 and .625 the approximation is
+ *              asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
+ *	For x in [0.625,1]
+ *		asin(x) = pi/2-2*asin(sqrt((1-x)/2))
+ *	Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;
+ *	then for x>0.98
+ *		asin(x) = pi/2 - 2*(s+s*z*R(z))
+ *			= pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)
+ *	For x<=0.98, let pio4_hi = pio2_hi/2, then
+ *		f = hi part of s;
+ *		c = sqrt(z) - f = (z-f*f)/(s+f) 	...f+c=sqrt(z)
+ *	and
+ *		asin(x) = pi/2 - 2*(s+s*z*R(z))
+ *			= pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)
+ *			= pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))
+ *
+ * Special cases:
+ *	if x is NaN, return x itself;
+ *	if |x|>1, return NaN with invalid signal.
+ *
+ */
+
+
+#include "math.h"
+#include "math_private.h"
+long double sqrtl (long double);
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  one = 1.0L,
+  huge = 1.0e+300L,
+  pio2_hi = 1.5707963267948966192313216916397514420986L,
+  pio2_lo = 4.3359050650618905123985220130216759843812E-35L,
+  pio4_hi = 7.8539816339744830961566084581987569936977E-1L,
+
+	/* coefficient for R(x^2) */
+
+  /* asin(x) = x + x^3 pS(x^2) / qS(x^2)
+     0 <= x <= 0.5
+     peak relative error 1.9e-35  */
+  pS0 = -8.358099012470680544198472400254596543711E2L,
+  pS1 =  3.674973957689619490312782828051860366493E3L,
+  pS2 = -6.730729094812979665807581609853656623219E3L,
+  pS3 =  6.643843795209060298375552684423454077633E3L,
+  pS4 = -3.817341990928606692235481812252049415993E3L,
+  pS5 =  1.284635388402653715636722822195716476156E3L,
+  pS6 = -2.410736125231549204856567737329112037867E2L,
+  pS7 =  2.219191969382402856557594215833622156220E1L,
+  pS8 = -7.249056260830627156600112195061001036533E-1L,
+  pS9 =  1.055923570937755300061509030361395604448E-3L,
+
+  qS0 = -5.014859407482408326519083440151745519205E3L,
+  qS1 =  2.430653047950480068881028451580393430537E4L,
+  qS2 = -4.997904737193653607449250593976069726962E4L,
+  qS3 =  5.675712336110456923807959930107347511086E4L,
+  qS4 = -3.881523118339661268482937768522572588022E4L,
+  qS5 =  1.634202194895541569749717032234510811216E4L,
+  qS6 = -4.151452662440709301601820849901296953752E3L,
+  qS7 =  5.956050864057192019085175976175695342168E2L,
+  qS8 = -4.175375777334867025769346564600396877176E1L,
+  /* 1.000000000000000000000000000000000000000E0 */
+
+  /* asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x)
+     -0.0625 <= x <= 0.0625
+     peak relative error 3.3e-35  */
+  rS0 = -5.619049346208901520945464704848780243887E0L,
+  rS1 =  4.460504162777731472539175700169871920352E1L,
+  rS2 = -1.317669505315409261479577040530751477488E2L,
+  rS3 =  1.626532582423661989632442410808596009227E2L,
+  rS4 = -3.144806644195158614904369445440583873264E1L,
+  rS5 = -9.806674443470740708765165604769099559553E1L,
+  rS6 =  5.708468492052010816555762842394927806920E1L,
+  rS7 =  1.396540499232262112248553357962639431922E1L,
+  rS8 = -1.126243289311910363001762058295832610344E1L,
+  rS9 = -4.956179821329901954211277873774472383512E-1L,
+  rS10 =  3.313227657082367169241333738391762525780E-1L,
+
+  sS0 = -4.645814742084009935700221277307007679325E0L,
+  sS1 =  3.879074822457694323970438316317961918430E1L,
+  sS2 = -1.221986588013474694623973554726201001066E2L,
+  sS3 =  1.658821150347718105012079876756201905822E2L,
+  sS4 = -4.804379630977558197953176474426239748977E1L,
+  sS5 = -1.004296417397316948114344573811562952793E2L,
+  sS6 =  7.530281592861320234941101403870010111138E1L,
+  sS7 =  1.270735595411673647119592092304357226607E1L,
+  sS8 = -1.815144839646376500705105967064792930282E1L,
+  sS9 = -7.821597334910963922204235247786840828217E-2L,
+  /*  1.000000000000000000000000000000000000000E0 */
+
+ asinr5625 =  5.9740641664535021430381036628424864397707E-1L;
+
+
+
+#ifdef __STDC__
+long double
+__ieee754_asinl (long double x)
+#else
+double
+__ieee754_asinl (x)
+     long double x;
+#endif
+{
+  long double t, w, p, q, c, r, s;
+  int32_t ix, sign, flag;
+  ieee854_long_double_shape_type u;
+
+  flag = 0;
+  u.value = x;
+  sign = u.parts32.w0;
+  ix = sign & 0x7fffffff;
+  u.parts32.w0 = ix;    /* |x| */
+  if (ix >= 0x3ff00000)	/* |x|>= 1 */
+    {
+      if (ix == 0x3ff00000
+	  && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+	/* asin(1)=+-pi/2 with inexact */
+	return x * pio2_hi + x * pio2_lo;
+      return (x - x) / (x - x);	/* asin(|x|>1) is NaN */
+    }
+  else if (ix < 0x3fe00000) /* |x| < 0.5 */
+    {
+      if (ix < 0x3c600000) /* |x| < 2**-57 */
+	{
+	  if (huge + x > one)
+	    return x;		/* return x with inexact if x!=0 */
+	}
+      else
+	{
+	  t = x * x;
+	  /* Mark to use pS, qS later on.  */
+	  flag = 1;
+	}
+    }
+  else if (ix < 0x3fe40000) /* 0.625 */
+    {
+      t = u.value - 0.5625;
+      p = ((((((((((rS10 * t
+		    + rS9) * t
+		   + rS8) * t
+		  + rS7) * t
+		 + rS6) * t
+		+ rS5) * t
+	       + rS4) * t
+	      + rS3) * t
+	     + rS2) * t
+	    + rS1) * t
+	   + rS0) * t;
+
+      q = ((((((((( t
+		    + sS9) * t
+		  + sS8) * t
+		 + sS7) * t
+		+ sS6) * t
+	       + sS5) * t
+	      + sS4) * t
+	     + sS3) * t
+	    + sS2) * t
+	   + sS1) * t
+	+ sS0;
+      t = asinr5625 + p / q;
+      if ((sign & 0x80000000) == 0)
+	return t;
+      else
+	return -t;
+    }
+  else
+    {
+      /* 1 > |x| >= 0.625 */
+      w = one - u.value;
+      t = w * 0.5;
+    }
+
+  p = (((((((((pS9 * t
+	       + pS8) * t
+	      + pS7) * t
+	     + pS6) * t
+	    + pS5) * t
+	   + pS4) * t
+	  + pS3) * t
+	 + pS2) * t
+	+ pS1) * t
+       + pS0) * t;
+
+  q = (((((((( t
+	      + qS8) * t
+	     + qS7) * t
+	    + qS6) * t
+	   + qS5) * t
+	  + qS4) * t
+	 + qS3) * t
+	+ qS2) * t
+       + qS1) * t
+    + qS0;
+
+  if (flag) /* 2^-57 < |x| < 0.5 */
+    {
+      w = p / q;
+      return x + x * w;
+    }
+
+  s = __ieee754_sqrtl (t);
+  if (ix >= 0x3fef3333) /* |x| > 0.975 */
+    {
+      w = p / q;
+      t = pio2_hi - (2.0 * (s + s * w) - pio2_lo);
+    }
+  else
+    {
+      u.value = s;
+      u.parts32.w3 = 0;
+      u.parts32.w2 = 0;
+      w = u.value;
+      c = (t - w * w) / (s + w);
+      r = p / q;
+      p = 2.0 * s * r - (pio2_lo - 2.0 * c);
+      q = pio4_hi - 2.0 * w;
+      t = pio4_hi - (p - q);
+    }
+
+  if ((sign & 0x80000000) == 0)
+    return t;
+  else
+    return -t;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
new file mode 100644
index 0000000000..a4bb53df04
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c
@@ -0,0 +1,124 @@
+/* e_atan2l.c -- long double version of e_atan2.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_atan2l(y,x)
+ * Method :
+ *	1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x).
+ *	2. Reduce x to positive by (if x and y are unexceptional):
+ *		ARG (x+iy) = arctan(y/x)   	   ... if x > 0,
+ *		ARG (x+iy) = pi - arctan[y/(-x)]   ... if x < 0,
+ *
+ * Special cases:
+ *
+ *	ATAN2((anything), NaN ) is NaN;
+ *	ATAN2(NAN , (anything) ) is NaN;
+ *	ATAN2(+-0, +(anything but NaN)) is +-0  ;
+ *	ATAN2(+-0, -(anything but NaN)) is +-pi ;
+ *	ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;
+ *	ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;
+ *	ATAN2(+-(anything but INF and NaN), -INF) is +-pi;
+ *	ATAN2(+-INF,+INF ) is +-pi/4 ;
+ *	ATAN2(+-INF,-INF ) is +-3pi/4;
+ *	ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;
+ *
+ * Constants:
+ * The hexadecimal values are the intended ones for the following
+ * constants. The decimal values may be used, provided that the
+ * compiler will convert from decimal to binary accurately enough
+ * to produce the hexadecimal values shown.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+tiny  = 1.0e-300L,
+zero  = 0.0,
+pi_o_4  = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */
+pi_o_2  = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898cc51701b8 */
+pi      = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */
+pi_lo   = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */
+
+#ifdef __STDC__
+	long double __ieee754_atan2l(long double y, long double x)
+#else
+	long double __ieee754_atan2l(y,x)
+	long double  y,x;
+#endif
+{
+	long double z;
+	int64_t k,m,hx,hy,ix,iy;
+	u_int64_t lx,ly;
+
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	ix = hx&0x7fffffffffffffffLL;
+	GET_LDOUBLE_WORDS64(hy,ly,y);
+	iy = hy&0x7fffffffffffffffLL;
+	if(((ix)>0x7ff0000000000000LL)||
+	   ((iy)>0x7ff0000000000000LL))	/* x or y is NaN */
+	   return x+y;
+	if(((hx-0x3ff0000000000000LL))==0) return __atanl(y);   /* x=1.0L */
+	m = ((hy>>63)&1)|((hx>>62)&2);	/* 2*sign(x)+sign(y) */
+
+    /* when y = 0 */
+	if((iy|(ly&0x7fffffffffffffffLL))==0) {
+	    switch(m) {
+		case 0:
+		case 1: return y; 	/* atan(+-0,+anything)=+-0 */
+		case 2: return  pi+tiny;/* atan(+0,-anything) = pi */
+		case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
+	    }
+	}
+    /* when x = 0 */
+	if((ix|(lx&0x7fffffffffffffff))==0) return (hy<0)?  -pi_o_2-tiny: pi_o_2+tiny;
+
+    /* when x is INF */
+	if(ix==0x7ff0000000000000LL) {
+	    if(iy==0x7ff0000000000000LL) {
+		switch(m) {
+		    case 0: return  pi_o_4+tiny;/* atan(+INF,+INF) */
+		    case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
+		    case 2: return  3.0L*pi_o_4+tiny;/*atan(+INF,-INF)*/
+		    case 3: return -3.0L*pi_o_4-tiny;/*atan(-INF,-INF)*/
+		}
+	    } else {
+		switch(m) {
+		    case 0: return  zero  ;	/* atan(+...,+INF) */
+		    case 1: return -zero  ;	/* atan(-...,+INF) */
+		    case 2: return  pi+tiny  ;	/* atan(+...,-INF) */
+		    case 3: return -pi-tiny  ;	/* atan(-...,-INF) */
+		}
+	    }
+	}
+    /* when y is INF */
+	if(iy==0x7ff0000000000000LL) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
+
+    /* compute y/x */
+	k = (iy-ix)>>52;
+	if(k > 120) z=pi_o_2+0.5L*pi_lo; 	/* |y/x| >  2**120 */
+	else if(hx<0&&k<-120) z=0.0L; 		/* |y|/x < -2**120 */
+	else z=__atanl(fabsl(y/x));		/* safe to do y/x */
+	switch (m) {
+	    case 0: return       z  ;	/* atan(+,+) */
+	    case 1: return      -z  ;	/* atan(-,+) */
+	    case 2: return  pi-(z-pi_lo);/* atan(+,-) */
+	    default: /* case 3 */
+	    	    return  (z-pi_lo)-pi;/* atan(-,-) */
+	}
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
new file mode 100644
index 0000000000..a801bd6f74
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c
@@ -0,0 +1,79 @@
+/* @(#)e_atanh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
+#endif
+
+/* __ieee754_atanh(x)
+ * Method :
+ *    1.Reduced x to positive by atanh(-x) = -atanh(x)
+ *    2.For x>=0.5
+ *                  1              2x                          x
+ *	atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
+ *                  2             1 - x                      1 - x
+ *
+ * 	For x<0.5
+ *	atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
+ *
+ * Special cases:
+ *	atanh(x) is NaN if |x| > 1 with signal;
+ *	atanh(NaN) is that NaN with no signal;
+ *	atanh(+-1) is +-INF with signal.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double one = 1.0L, huge = 1e300L;
+#else
+static long double one = 1.0L, huge = 1e300L;
+#endif
+
+#ifdef __STDC__
+static const long double zero = 0.0L;
+#else
+static long double zero = 0.0L;
+#endif
+
+#ifdef __STDC__
+	long double __ieee754_atanhl(long double x)
+#else
+	long double __ieee754_atanhl(x)
+	long double x;
+#endif
+{
+	long double t;
+	int64_t hx,ix;
+	u_int64_t lx;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	ix = hx&0x7fffffffffffffffLL;
+	if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */
+	    if (ix > 0x3ff0000000000000LL)
+	    	return (x-x)/(x-x);
+	    t = fabsl (x);
+	    if (t > one)
+		return (x-x)/(x-x);
+	    if (t == one)
+		return x/zero;
+	}
+	if(ix<0x3e20000000000000LL&&(huge+x)>zero) return x;	/* x<2**-29 */
+	x = fabsl (x);
+	if(ix<0x3fe0000000000000LL) {		/* x < 0.5 */
+	    t = x+x;
+	    t = 0.5*__log1pl(t+t*x/(one-x));
+	} else
+	    t = 0.5*__log1pl((x+x)/(one-x));
+	if(hx>=0) return t; else return -t;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
new file mode 100644
index 0000000000..73cb47892f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
@@ -0,0 +1,90 @@
+/* @(#)e_cosh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_cosh.c,v 1.7 1995/05/10 20:44:58 jtc Exp $";
+#endif
+
+/* __ieee754_cosh(x)
+ * Method :
+ * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2
+ *	1. Replace x by |x| (cosh(x) = cosh(-x)).
+ *	2.
+ *		                                        [ exp(x) - 1 ]^2
+ *	    0        <= x <= ln2/2  :  cosh(x) := 1 + -------------------
+ *			       			           2*exp(x)
+ *
+ *		                                  exp(x) +  1/exp(x)
+ *	    ln2/2    <= x <= 22     :  cosh(x) := -------------------
+ *			       			          2
+ *	    22       <= x <= lnovft :  cosh(x) := exp(x)/2
+ *	    lnovft   <= x <= ln2ovft:  cosh(x) := exp(x/2)/2 * exp(x/2)
+ *	    ln2ovft  <  x	    :  cosh(x) := huge*huge (overflow)
+ *
+ * Special cases:
+ *	cosh(x) is |x| if x is +INF, -INF, or NaN.
+ *	only cosh(0)=1 is exact for finite x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double one = 1.0L, half=0.5L, huge = 1.0e300L;
+#else
+static long double one = 1.0L, half=0.5L, huge = 1.0e300L;
+#endif
+
+#ifdef __STDC__
+	long double __ieee754_coshl(long double x)
+#else
+	long double __ieee754_coshl(x)
+	long double x;
+#endif
+{
+	long double t,w;
+	int64_t ix;
+
+    /* High word of |x|. */
+	GET_LDOUBLE_MSW64(ix,x);
+	ix &= 0x7fffffffffffffffLL;
+
+    /* x is INF or NaN */
+	if(ix>=0x7ff0000000000000LL) return x*x;
+
+    /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
+	if(ix<0x3fd62e42fefa39efLL) {
+	    t = __expm1l(fabsl(x));
+	    w = one+t;
+	    if (ix<0x3c80000000000000LL) return w;	/* cosh(tiny) = 1 */
+	    return one+(t*t)/(w+w);
+	}
+
+    /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
+	if (ix < 0x4036000000000000LL) {
+		t = __ieee754_expl(fabsl(x));
+		return half*t+half/t;
+	}
+
+    /* |x| in [22, log(maxdouble)] return half*exp(|x|) */
+	if (ix < 0x40862e42fefa39efLL)  return half*__ieee754_expl(fabsl(x));
+
+    /* |x| in [log(maxdouble), overflowthresold] */
+        if (ix < 0x408633ce8fb9f87dLL) {
+	    w = __ieee754_expl(half*fabsl(x));
+	    t = half*w;
+	    return t*w;
+	}
+
+    /* |x| > overflowthresold, cosh(x) overflow */
+	return huge*huge;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
new file mode 100644
index 0000000000..3c4088f75f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_expl.c
@@ -0,0 +1,257 @@
+/* Quad-precision floating point e^x.
+   Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+   Partly based on double-precision code
+   by Geoffrey Keating <geoffk@ozemail.com.au>
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* The basic design here is from
+   Abraham Ziv, "Fast Evaluation of Elementary Mathematical Functions with
+   Correctly Rounded Last Bit", ACM Trans. Math. Soft., 17 (3), September 1991,
+   pp. 410-423.
+
+   We work with number pairs where the first number is the high part and
+   the second one is the low part. Arithmetic with the high part numbers must
+   be exact, without any roundoff errors.
+
+   The input value, X, is written as
+   X = n * ln(2)_0 + arg1[t1]_0 + arg2[t2]_0 + x
+       - n * ln(2)_1 + arg1[t1]_1 + arg2[t2]_1 + xl
+
+   where:
+   - n is an integer, 16384 >= n >= -16495;
+   - ln(2)_0 is the first 93 bits of ln(2), and |ln(2)_0-ln(2)-ln(2)_1| < 2^-205
+   - t1 is an integer, 89 >= t1 >= -89
+   - t2 is an integer, 65 >= t2 >= -65
+   - |arg1[t1]-t1/256.0| < 2^-53
+   - |arg2[t2]-t2/32768.0| < 2^-53
+   - x + xl is whatever is left, |x + xl| < 2^-16 + 2^-53
+
+   Then e^x is approximated as
+
+   e^x = 2^n_1 ( 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1)
+	       + 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1)
+		 * p (x + xl + n * ln(2)_1))
+   where:
+   - p(x) is a polynomial approximating e(x)-1
+   - e^(arg1[t1]_0 + arg1[t1]_1) is obtained from a table
+   - e^(arg2[t2]_0 + arg2[t2]_1) likewise
+   - n_1 + n_0 = n, so that |n_0| < -LDBL_MIN_EXP-1.
+
+   If it happens that n_1 == 0 (this is the usual case), that multiplication
+   is omitted.
+   */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <float.h>
+#include <ieee754.h>
+#include <math.h>
+#include <fenv.h>
+#include <inttypes.h>
+#include <math_private.h>
+#include <sysdeps/ieee754/ldbl-128/t_expl.h>
+
+static const long double C[] = {
+/* Smallest integer x for which e^x overflows.  */
+#define himark C[0]
+ 709.08956571282405153382846025171462914L,
+
+/* Largest integer x for which e^x underflows.  */
+#define lomark C[1]
+-709.08956571282405153382846025171462914L,
+
+/* 3x2^96 */
+#define THREEp96 C[2]
+ 59421121885698253195157962752.0L,
+
+/* 3x2^103 */
+#define THREEp103 C[3]
+ 30423614405477505635920876929024.0L,
+
+/* 3x2^111 */
+#define THREEp111 C[4]
+ 7788445287802241442795744493830144.0L,
+
+/* 1/ln(2) */
+#define M_1_LN2 C[5]
+ 1.44269504088896340735992468100189204L,
+
+/* first 93 bits of ln(2) */
+#define M_LN2_0 C[6]
+ 0.693147180559945309417232121457981864L,
+
+/* ln2_0 - ln(2) */
+#define M_LN2_1 C[7]
+-1.94704509238074995158795957333327386E-31L,
+
+/* very small number */
+#define TINY C[8]
+ 1.0e-308L,
+
+/* 2^16383 */
+#define TWO1023 C[9]
+ 8.988465674311579538646525953945123668E+307L,
+
+/* 256 */
+#define TWO8 C[10]
+ 256.0L,
+
+/* 32768 */
+#define TWO15 C[11]
+ 32768.0L,
+
+/* Chebyshev polynom coeficients for (exp(x)-1)/x */
+#define P1 C[12]
+#define P2 C[13]
+#define P3 C[14]
+#define P4 C[15]
+#define P5 C[16]
+#define P6 C[17]
+ 0.5L,
+ 1.66666666666666666666666666666666683E-01L,
+ 4.16666666666666666666654902320001674E-02L,
+ 8.33333333333333333333314659767198461E-03L,
+ 1.38888888889899438565058018857254025E-03L,
+ 1.98412698413981650382436541785404286E-04L,
+};
+
+long double
+__ieee754_expl (long double x)
+{
+  /* Check for usual case.  */
+  if (isless (x, himark) && isgreater (x, lomark))
+    {
+      int tval1, tval2, unsafe, n_i, exponent2;
+      long double x22, n, result, xl;
+      union ibm_extended_long_double ex2_u, scale_u;
+      fenv_t oldenv;
+
+      feholdexcept (&oldenv);
+#ifdef FE_TONEAREST
+      fesetround (FE_TONEAREST);
+#endif
+
+      n = roundl(x*M_1_LN2);
+      x = x-n*M_LN2_0;
+      xl = n*M_LN2_1;
+
+      tval1 = roundl(x*TWO8);
+      x -= __expl_table[T_EXPL_ARG1+2*tval1];
+      xl -= __expl_table[T_EXPL_ARG1+2*tval1+1];
+
+      tval2 = roundl(x*TWO15);
+      x -= __expl_table[T_EXPL_ARG2+2*tval2];
+      xl -= __expl_table[T_EXPL_ARG2+2*tval2+1];
+
+      x = x + xl;
+
+      /* Compute ex2 = 2^n_0 e^(argtable[tval1]) e^(argtable[tval2]).  */
+      ex2_u.d = __expl_table[T_EXPL_RES1 + tval1]
+		* __expl_table[T_EXPL_RES2 + tval2];
+      n_i = (int)n;
+      /* 'unsafe' is 1 iff n_1 != 0.  */
+      unsafe = fabsl(n_i) >= -LDBL_MIN_EXP - 1;
+      ex2_u.ieee.exponent += n_i >> unsafe;
+      /* Fortunately, there are no subnormal lowpart doubles in
+	 __expl_table, only normal values and zeros.
+	 But after scaling it can be subnormal.  */
+      exponent2 = ex2_u.ieee.exponent2 + (n_i >> unsafe);
+      if (ex2_u.ieee.exponent2 == 0)
+	/* assert ((ex2_u.ieee.mantissa2|ex2_u.ieee.mantissa3) == 0) */;
+      else if (exponent2 > 0)
+	ex2_u.ieee.exponent2 = exponent2;
+      else if (exponent2 <= -54)
+	{
+	  ex2_u.ieee.exponent2 = 0;
+	  ex2_u.ieee.mantissa2 = 0;
+	  ex2_u.ieee.mantissa3 = 0;
+	}
+      else
+	{
+	  static const double
+	    two54 = 1.80143985094819840000e+16, /* 4350000000000000 */
+	    twom54 = 5.55111512312578270212e-17; /* 3C90000000000000 */
+	  ex2_u.dd[1] *= two54;
+	  ex2_u.ieee.exponent2 += n_i >> unsafe;
+	  ex2_u.dd[1] *= twom54;
+	}
+
+      /* Compute scale = 2^n_1.  */
+      scale_u.d = 1.0L;
+      scale_u.ieee.exponent += n_i - (n_i >> unsafe);
+
+      /* Approximate e^x2 - 1, using a seventh-degree polynomial,
+	 with maximum error in [-2^-16-2^-53,2^-16+2^-53]
+	 less than 4.8e-39.  */
+      x22 = x + x*x*(P1+x*(P2+x*(P3+x*(P4+x*(P5+x*P6)))));
+
+      /* Return result.  */
+      fesetenv (&oldenv);
+
+      result = x22 * ex2_u.d + ex2_u.d;
+
+      /* Now we can test whether the result is ultimate or if we are unsure.
+	 In the later case we should probably call a mpn based routine to give
+	 the ultimate result.
+	 Empirically, this routine is already ultimate in about 99.9986% of
+	 cases, the test below for the round to nearest case will be false
+	 in ~ 99.9963% of cases.
+	 Without proc2 routine maximum error which has been seen is
+	 0.5000262 ulp.
+
+	  union ieee854_long_double ex3_u;
+
+	  #ifdef FE_TONEAREST
+	    fesetround (FE_TONEAREST);
+	  #endif
+	  ex3_u.d = (result - ex2_u.d) - x22 * ex2_u.d;
+	  ex2_u.d = result;
+	  ex3_u.ieee.exponent += LDBL_MANT_DIG + 15 + IEEE854_LONG_DOUBLE_BIAS
+	  			 - ex2_u.ieee.exponent;
+	  n_i = abs (ex3_u.d);
+	  n_i = (n_i + 1) / 2;
+	  fesetenv (&oldenv);
+	  #ifdef FE_TONEAREST
+	  if (fegetround () == FE_TONEAREST)
+	    n_i -= 0x4000;
+	  #endif
+	  if (!n_i) {
+	    return __ieee754_expl_proc2 (origx);
+	  }
+       */
+      if (!unsafe)
+	return result;
+      else
+	return result * scale_u.d;
+    }
+  /* Exceptional cases:  */
+  else if (isless (x, himark))
+    {
+      if (__isinfl (x))
+	/* e^-inf == 0, with no error.  */
+	return 0;
+      else
+	/* Underflow */
+	return TINY * TINY;
+    }
+  else
+    /* Return x, if x is a NaN or Inf; or overflow, otherwise.  */
+    return TWO1023*x;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
new file mode 100644
index 0000000000..e99b0bac34
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@@ -0,0 +1,145 @@
+/* e_fmodl.c -- long double version of e_fmod.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * __ieee754_fmodl(x,y)
+ * Return x mod y in exact arithmetic
+ * Method: shift and subtract
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <ieee754.h>
+
+#ifdef __STDC__
+static const long double one = 1.0, Zero[] = {0.0, -0.0,};
+#else
+static long double one = 1.0, Zero[] = {0.0, -0.0,};
+#endif
+
+#ifdef __STDC__
+	long double __ieee754_fmodl(long double x, long double y)
+#else
+	long double __ieee754_fmodl(x,y)
+	long double x,y;
+#endif
+{
+	int64_t n,hx,hy,hz,ix,iy,sx,i;
+	u_int64_t lx,ly,lz;
+	int temp;
+
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	GET_LDOUBLE_WORDS64(hy,ly,y);
+	sx = hx&0x8000000000000000ULL;		/* sign of x */
+	hx ^=sx;				/* |x| */
+	hy &= 0x7fffffffffffffffLL;		/* |y| */
+
+    /* purge off exception values */
+	if((hy|(ly&0x7fffffffffffffff))==0||(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
+	  (hy>0x7ff0000000000000LL))	/* or y is NaN */
+	    return (x*y)/(x*y);
+	if(hx<=hy) {
+	    if((hx<hy)||(lx<ly)) return x;	/* |x|<|y| return x */
+	    if(lx==ly)
+		return Zero[(u_int64_t)sx>>63];	/* |x|=|y| return x*0*/
+	}
+
+    /* determine ix = ilogb(x) */
+	if(hx<0x0010000000000000LL) {	/* subnormal x */
+	    if(hx==0) {
+		for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
+	    } else {
+		for (ix = -1022, i=hx<<19; i>0; i<<=1) ix -=1;
+	    }
+	} else ix = (hx>>52)-0x3ff;
+
+    /* determine iy = ilogb(y) */
+	if(hy<0x0010000000000000LL) {	/* subnormal y */
+	    if(hy==0) {
+		for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
+	    } else {
+		for (iy = -1022, i=hy<<19; i>0; i<<=1) iy -=1;
+	    }
+	} else iy = (hy>>52)-0x3ff;
+
+    /* Make the IBM extended format 105 bit mantissa look like the ieee854 112
+       bit mantissa so the following operatations will give the correct
+       result.  */
+        ldbl_extract_mantissa(&hx, &lx, &temp, x);
+        ldbl_extract_mantissa(&hy, &ly, &temp, y);
+
+    /* set up {hx,lx}, {hy,ly} and align y to x */
+	if(ix >= -1022)
+	    hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx);
+	else {		/* subnormal x, shift x to normal */
+	    n = -1022-ix;
+	    if(n<=63) {
+	        hx = (hx<<n)|(lx>>(64-n));
+	        lx <<= n;
+	    } else {
+		hx = lx<<(n-64);
+		lx = 0;
+	    }
+	}
+	if(iy >= -1022)
+	    hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy);
+	else {		/* subnormal y, shift y to normal */
+	    n = -1022-iy;
+	    if(n<=63) {
+	        hy = (hy<<n)|(ly>>(64-n));
+	        ly <<= n;
+	    } else {
+		hy = ly<<(n-64);
+		ly = 0;
+	    }
+	}
+
+    /* fix point fmod */
+	n = ix - iy;
+	while(n--) {
+	    hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+	    if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;}
+	    else {
+	    	if((hz|(lz&0x7fffffffffffffff))==0) 		/* return sign(x)*0 */
+		    return Zero[(u_int64_t)sx>>63];
+	    	hx = hz+hz+(lz>>63); lx = lz+lz;
+	    }
+	}
+	hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
+	if(hz>=0) {hx=hz;lx=lz;}
+
+    /* convert back to floating value and restore the sign */
+	if((hx|(lx&0x7fffffffffffffff))==0) 			/* return sign(x)*0 */
+	    return Zero[(u_int64_t)sx>>63];
+	while(hx<0x0001000000000000LL) {	/* normalize x */
+	    hx = hx+hx+(lx>>63); lx = lx+lx;
+	    iy -= 1;
+	}
+	if(iy>= -1022) {	/* normalize output */
+	    x = ldbl_insert_mantissa((sx>>63), iy, hx, lx);
+	} else {		/* subnormal output */
+	    n = -1022 - iy;
+	    if(n<=48) {
+		lx = (lx>>n)|((u_int64_t)hx<<(64-n));
+		hx >>= n;
+	    } else if (n<=63) {
+		lx = (hx<<(64-n))|(lx>>n); hx = sx;
+	    } else {
+		lx = hx>>(n-64); hx = sx;
+	    }
+	    x = ldbl_insert_mantissa((sx>>63), iy, hx, lx);
+	    x *= one;		/* create necessary signal */
+	}
+	return x;		/* exact output */
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
new file mode 100644
index 0000000000..03bcb2129a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c
@@ -0,0 +1,58 @@
+/* Implementation of gamma function according to ISO C.
+   Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+   		  Jakub Jelinek <jj@ultra.linux.cz, 1999.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <math_private.h>
+
+
+long double
+__ieee754_gammal_r (long double x, int *signgamp)
+{
+  /* We don't have a real gamma implementation now.  We'll use lgamma
+     and the exp function.  But due to the required boundary
+     conditions we must check some values separately.  */
+  int64_t hx;
+  u_int64_t lx;
+
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+
+  if (((hx | lx) & 0x7fffffffffffffffLL) == 0)
+    {
+      /* Return value for x == 0 is Inf with divide by zero exception.  */
+      *signgamp = 0;
+      return 1.0 / x;
+    }
+  if (hx < 0 && (u_int64_t) hx < 0xfff0000000000000ULL && __rintl (x) == x)
+    {
+      /* Return value for integer x < 0 is NaN with invalid exception.  */
+      *signgamp = 0;
+      return (x - x) / (x - x);
+    }
+  if (hx == 0xfff0000000000000ULL)
+    {
+      /* x == -Inf.  According to ISO this is NaN.  */
+      *signgamp = 0;
+      return x - x;
+    }
+
+  /* XXX FIXME.  */
+  return __ieee754_expl (__ieee754_lgammal_r (x, signgamp));
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
new file mode 100644
index 0000000000..4330f28b93
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
@@ -0,0 +1,131 @@
+/* @(#)e_hypotl.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_hypotl.c,v 1.9 1995/05/12 04:57:27 jtc Exp $";
+#endif
+
+/* __ieee754_hypotl(x,y)
+ *
+ * Method :
+ *	If (assume round-to-nearest) z=x*x+y*y
+ *	has error less than sqrtl(2)/2 ulp, than
+ *	sqrtl(z) has error less than 1 ulp (exercise).
+ *
+ *	So, compute sqrtl(x*x+y*y) with some care as
+ *	follows to get the error below 1 ulp:
+ *
+ *	Assume x>y>0;
+ *	(if possible, set rounding to round-to-nearest)
+ *	1. if x > 2y  use
+ *		x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y
+ *	where x1 = x with lower 53 bits cleared, x2 = x-x1; else
+ *	2. if x <= 2y use
+ *		t1*y1+((x-y)*(x-y)+(t1*y2+t2*y))
+ *	where t1 = 2x with lower 53 bits cleared, t2 = 2x-t1,
+ *	y1= y with lower 53 bits chopped, y2 = y-y1.
+ *
+ *	NOTE: scaling may be necessary if some argument is too
+ *	      large or too tiny
+ *
+ * Special cases:
+ *	hypotl(x,y) is INF if x or y is +INF or -INF; else
+ *	hypotl(x,y) is NAN if x or y is NAN.
+ *
+ * Accuracy:
+ * 	hypotl(x,y) returns sqrtl(x^2+y^2) with error less
+ * 	than 1 ulps (units in the last place)
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double two600 = 0x1.0p+600L;
+static const long double two1022 = 0x1.0p+1022L;
+
+#ifdef __STDC__
+	long double __ieee754_hypotl(long double x, long double y)
+#else
+	long double __ieee754_hypotl(x,y)
+	long double x, y;
+#endif
+{
+	long double a,b,t1,t2,y1,y2,w,kld;
+	int64_t j,k,ha,hb;
+
+	GET_LDOUBLE_MSW64(ha,x);
+	ha &= 0x7fffffffffffffffLL;
+	GET_LDOUBLE_MSW64(hb,y);
+	hb &= 0x7fffffffffffffffLL;
+	if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
+	a = fabsl(a);	/* a <- |a| */
+	b = fabsl(b);	/* b <- |b| */
+	if((ha-hb)>0x3c0000000000000LL) {return a+b;} /* x/y > 2**60 */
+	k=0;
+	kld = 1.0L;
+	if(ha > 0x5f30000000000000LL) {	/* a>2**500 */
+	   if(ha >= 0x7ff0000000000000LL) {	/* Inf or NaN */
+	       u_int64_t low;
+	       w = a+b;			/* for sNaN */
+	       GET_LDOUBLE_LSW64(low,a);
+	       if(((ha&0xfffffffffffffLL)|(low&0x7fffffffffffffffLL))==0)
+		 w = a;
+	       GET_LDOUBLE_LSW64(low,b);
+	       if(((hb^0x7ff0000000000000LL)|(low&0x7fffffffffffffffLL))==0)
+		 w = b;
+	       return w;
+	   }
+	   /* scale a and b by 2**-600 */
+	   ha -= 0x2580000000000000LL; hb -= 0x2580000000000000LL; k += 600;
+	   a /= two600;
+	   b /= two600;
+	   k += 600;
+	   kld = two600;
+	}
+	if(hb < 0x20b0000000000000LL) {	/* b < 2**-500 */
+	    if(hb <= 0x000fffffffffffffLL) {	/* subnormal b or 0 */
+	        u_int64_t low;
+		GET_LDOUBLE_LSW64(low,b);
+		if((hb|(low&0x7fffffffffffffffLL))==0) return a;
+		t1=two1022;	/* t1=2^1022 */
+		b *= t1;
+		a *= t1;
+		k -= 1022;
+		kld = kld / two1022;
+	    } else {		/* scale a and b by 2^600 */
+	        ha += 0x2580000000000000LL; 	/* a *= 2^600 */
+		hb += 0x2580000000000000LL;	/* b *= 2^600 */
+		k -= 600;
+		a *= two600;
+		b *= two600;
+		kld = kld / two600;
+	    }
+	}
+    /* medium size a and b */
+	w = a-b;
+	if (w>b) {
+	    SET_LDOUBLE_WORDS64(t1,ha,0);
+	    t2 = a-t1;
+	    w  = __ieee754_sqrtl(t1*t1-(b*(-b)-t2*(a+t1)));
+	} else {
+	    a  = a+a;
+	    SET_LDOUBLE_WORDS64(y1,hb,0);
+	    y2 = b - y1;
+	    SET_LDOUBLE_WORDS64(t1,ha+0x0010000000000000LL,0);
+	    t2 = a - t1;
+	    w  = __ieee754_sqrtl(t1*y1-(w*(-w)-(t1*y2+t2*b)));
+	}
+	if(k!=0)
+	    return w*kld;
+	else
+	    return w;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j0l.c b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c
new file mode 100644
index 0000000000..39a238aa9b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c
@@ -0,0 +1,3 @@
+/* Looks like we can use ieee854 e_j0l.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_j0l.c>
+
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
new file mode 100644
index 0000000000..c86e24f7c0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c
@@ -0,0 +1,2 @@
+/* Looks like we can use ieee854 e_j1l.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_j1l.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
new file mode 100644
index 0000000000..0eea745676
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
@@ -0,0 +1,402 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Modifications for 128-bit long double are
+   Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+   and are incorporated herein by permission of the author.  The author
+   reserves the right to distribute this material elsewhere under different
+   copying permissions.  These modifications are distributed here under
+   the following terms:
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/*
+ * __ieee754_jn(n, x), __ieee754_yn(n, x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ *	For n=0, j0(x) is called,
+ *	for n=1, j1(x) is called,
+ *	for n<x, forward recursion us used starting
+ *	from values of j0(x) and j1(x).
+ *	for n>x, a continued fraction approximation to
+ *	j(n,x)/j(n-1,x) is evaluated and then backward
+ *	recursion is used starting from a supposed value
+ *	for j(n,x). The resulting value of j(0,x) is
+ *	compared with the actual value to correct the
+ *	supposed value of j(n,x).
+ *
+ *	yn(n,x) is similar in all respects, except
+ *	that forward recursion is used for all
+ *	values of n>1.
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  invsqrtpi = 5.6418958354775628694807945156077258584405E-1L,
+  two = 2.0e0L,
+  one = 1.0e0L,
+  zero = 0.0L;
+
+
+#ifdef __STDC__
+long double
+__ieee754_jnl (int n, long double x)
+#else
+long double
+__ieee754_jnl (n, x)
+     int n;
+     long double x;
+#endif
+{
+  u_int32_t se;
+  int32_t i, ix, sgn;
+  long double a, b, temp, di;
+  long double z, w;
+  ieee854_long_double_shape_type u;
+
+
+  /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
+   * Thus, J(-n,x) = J(n,-x)
+   */
+
+  u.value = x;
+  se = u.parts32.w0;
+  ix = se & 0x7fffffff;
+
+  /* if J(n,NaN) is NaN */
+  if (ix >= 0x7ff00000)
+    {
+      if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
+	  | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
+	return x + x;
+    }
+
+  if (n < 0)
+    {
+      n = -n;
+      x = -x;
+      se ^= 0x80000000;
+    }
+  if (n == 0)
+    return (__ieee754_j0l (x));
+  if (n == 1)
+    return (__ieee754_j1l (x));
+  sgn = (n & 1) & (se >> 31);	/* even n -- 0, odd n -- sign(x) */
+  x = fabsl (x);
+
+  if (x == 0.0L || ix >= 0x7ff00000)	/* if x is 0 or inf */
+    b = zero;
+  else if ((long double) n <= x)
+    {
+      /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
+      if (ix >= 0x52d00000)
+	{			/* x > 2**302 */
+
+	  /* ??? Could use an expansion for large x here.  */
+
+	  /* (x >> n**2)
+	   *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+	   *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+	   *      Let s=sin(x), c=cos(x),
+	   *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
+	   *
+	   *             n    sin(xn)*sqt2    cos(xn)*sqt2
+	   *          ----------------------------------
+	   *             0     s-c             c+s
+	   *             1    -s-c            -c+s
+	   *             2    -s+c            -c-s
+	   *             3     s+c             c-s
+	   */
+	  long double s;
+	  long double c;
+	  __sincosl (x, &s, &c);
+	  switch (n & 3)
+	    {
+	    case 0:
+	      temp = c + s;
+	      break;
+	    case 1:
+	      temp = -c + s;
+	      break;
+	    case 2:
+	      temp = -c - s;
+	      break;
+	    case 3:
+	      temp = c - s;
+	      break;
+	    }
+	  b = invsqrtpi * temp / __ieee754_sqrtl (x);
+	}
+      else
+	{
+	  a = __ieee754_j0l (x);
+	  b = __ieee754_j1l (x);
+	  for (i = 1; i < n; i++)
+	    {
+	      temp = b;
+	      b = b * ((long double) (i + i) / x) - a;	/* avoid underflow */
+	      a = temp;
+	    }
+	}
+    }
+  else
+    {
+      if (ix < 0x3e100000)
+	{			/* x < 2**-29 */
+	  /* x is tiny, return the first Taylor expansion of J(n,x)
+	   * J(n,x) = 1/n!*(x/2)^n  - ...
+	   */
+	  if (n >= 33)		/* underflow, result < 10^-300 */
+	    b = zero;
+	  else
+	    {
+	      temp = x * 0.5;
+	      b = temp;
+	      for (a = one, i = 2; i <= n; i++)
+		{
+		  a *= (long double) i;	/* a = n! */
+		  b *= temp;	/* b = (x/2)^n */
+		}
+	      b = b / a;
+	    }
+	}
+      else
+	{
+	  /* use backward recurrence */
+	  /*                      x      x^2      x^2
+	   *  J(n,x)/J(n-1,x) =  ----   ------   ------   .....
+	   *                      2n  - 2(n+1) - 2(n+2)
+	   *
+	   *                      1      1        1
+	   *  (for large x)   =  ----  ------   ------   .....
+	   *                      2n   2(n+1)   2(n+2)
+	   *                      -- - ------ - ------ -
+	   *                       x     x         x
+	   *
+	   * Let w = 2n/x and h=2/x, then the above quotient
+	   * is equal to the continued fraction:
+	   *                  1
+	   *      = -----------------------
+	   *                     1
+	   *         w - -----------------
+	   *                        1
+	   *              w+h - ---------
+	   *                     w+2h - ...
+	   *
+	   * To determine how many terms needed, let
+	   * Q(0) = w, Q(1) = w(w+h) - 1,
+	   * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
+	   * When Q(k) > 1e4      good for single
+	   * When Q(k) > 1e9      good for double
+	   * When Q(k) > 1e17     good for quadruple
+	   */
+	  /* determine k */
+	  long double t, v;
+	  long double q0, q1, h, tmp;
+	  int32_t k, m;
+	  w = (n + n) / (long double) x;
+	  h = 2.0L / (long double) x;
+	  q0 = w;
+	  z = w + h;
+	  q1 = w * z - 1.0L;
+	  k = 1;
+	  while (q1 < 1.0e17L)
+	    {
+	      k += 1;
+	      z += h;
+	      tmp = z * q1 - q0;
+	      q0 = q1;
+	      q1 = tmp;
+	    }
+	  m = n + n;
+	  for (t = zero, i = 2 * (n + k); i >= m; i -= 2)
+	    t = one / (i / x - t);
+	  a = t;
+	  b = one;
+	  /*  estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
+	   *  Hence, if n*(log(2n/x)) > ...
+	   *  single 8.8722839355e+01
+	   *  double 7.09782712893383973096e+02
+	   *  long double 1.1356523406294143949491931077970765006170e+04
+	   *  then recurrent value may overflow and the result is
+	   *  likely underflow to zero
+	   */
+	  tmp = n;
+	  v = two / x;
+	  tmp = tmp * __ieee754_logl (fabsl (v * tmp));
+
+	  if (tmp < 1.1356523406294143949491931077970765006170e+04L)
+	    {
+	      for (i = n - 1, di = (long double) (i + i); i > 0; i--)
+		{
+		  temp = b;
+		  b *= di;
+		  b = b / x - a;
+		  a = temp;
+		  di -= two;
+		}
+	    }
+	  else
+	    {
+	      for (i = n - 1, di = (long double) (i + i); i > 0; i--)
+		{
+		  temp = b;
+		  b *= di;
+		  b = b / x - a;
+		  a = temp;
+		  di -= two;
+		  /* scale b to avoid spurious overflow */
+		  if (b > 1e100L)
+		    {
+		      a /= b;
+		      t /= b;
+		      b = one;
+		    }
+		}
+	    }
+	  b = (t * __ieee754_j0l (x) / b);
+	}
+    }
+  if (sgn == 1)
+    return -b;
+  else
+    return b;
+}
+
+#ifdef __STDC__
+long double
+__ieee754_ynl (int n, long double x)
+#else
+long double
+__ieee754_ynl (n, x)
+     int n;
+     long double x;
+#endif
+{
+  u_int32_t se;
+  int32_t i, ix;
+  int32_t sign;
+  long double a, b, temp;
+  ieee854_long_double_shape_type u;
+
+  u.value = x;
+  se = u.parts32.w0;
+  ix = se & 0x7fffffff;
+
+  /* if Y(n,NaN) is NaN */
+  if (ix >= 0x7ff00000)
+    {
+      if ((u.parts32.w0 & 0xfffff) | u.parts32.w1
+	  | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3)
+	return x + x;
+    }
+  if (x <= 0.0L)
+    {
+      if (x == 0.0L)
+	return -HUGE_VALL + x;
+      if (se & 0x80000000)
+	return zero / (zero * x);
+    }
+  sign = 1;
+  if (n < 0)
+    {
+      n = -n;
+      sign = 1 - ((n & 1) << 1);
+    }
+  if (n == 0)
+    return (__ieee754_y0l (x));
+  if (n == 1)
+    return (sign * __ieee754_y1l (x));
+  if (ix >= 0x7ff00000)
+    return zero;
+  if (ix >= 0x52D00000)
+    {				/* x > 2**302 */
+
+      /* ??? See comment above on the possible futility of this.  */
+
+      /* (x >> n**2)
+       *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+       *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
+       *      Let s=sin(x), c=cos(x),
+       *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
+       *
+       *             n    sin(xn)*sqt2    cos(xn)*sqt2
+       *          ----------------------------------
+       *             0     s-c             c+s
+       *             1    -s-c            -c+s
+       *             2    -s+c            -c-s
+       *             3     s+c             c-s
+       */
+      long double s;
+      long double c;
+      __sincosl (x, &s, &c);
+      switch (n & 3)
+	{
+	case 0:
+	  temp = s - c;
+	  break;
+	case 1:
+	  temp = -s - c;
+	  break;
+	case 2:
+	  temp = -s + c;
+	  break;
+	case 3:
+	  temp = s + c;
+	  break;
+	}
+      b = invsqrtpi * temp / __ieee754_sqrtl (x);
+    }
+  else
+    {
+      a = __ieee754_y0l (x);
+      b = __ieee754_y1l (x);
+      /* quit if b is -inf */
+      u.value = b;
+      se = u.parts32.w0 & 0xfff00000;
+      for (i = 1; i < n && se != 0xfff00000; i++)
+	{
+	  temp = b;
+	  b = ((long double) (i + i) / x) * b - a;
+	  u.value = b;
+	  se = u.parts32.w0 & 0xfff00000;
+	  a = temp;
+	}
+    }
+  if (sign > 0)
+    return b;
+  else
+    return -b;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
new file mode 100644
index 0000000000..9bcaaf765a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c
@@ -0,0 +1,3 @@
+/* Looks like we can use ieee854 e_lgammal_r.c as is for IBM extended format. */
+#include <sysdeps/ieee754/ldbl-128/e_lgammal_r.c>
+
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
new file mode 100644
index 0000000000..27e2c71b8d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c
@@ -0,0 +1,258 @@
+/*							log10l.c
+ *
+ *	Common logarithm, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log10l();
+ *
+ * y = log10l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base 10 logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts.  If the exponent is between -1 and +1, the logarithm
+ * of the fraction is approximated by
+ *
+ *     log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting  z = 2(x-1)/x+1),
+ *
+ *     log(x) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ *                      Relative error:
+ * arithmetic   domain     # trials      peak         rms
+ *    IEEE      0.5, 2.0     30000      2.3e-34     4.9e-35
+ *    IEEE     exp(+-10000)  30000      1.0e-34     4.1e-35
+ *
+ * In the tests over the interval exp(+-10000), the logarithms
+ * of the random arguments were uniformly distributed over
+ * [-10000, +10000].
+ *
+ */
+
+/*
+   Cephes Math Library Release 2.2:  January, 1991
+   Copyright 1984, 1991 by Stephen L. Moshier
+   Adapted for glibc November, 2001
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double P[13] =
+{
+  1.313572404063446165910279910527789794488E4L,
+  7.771154681358524243729929227226708890930E4L,
+  2.014652742082537582487669938141683759923E5L,
+  3.007007295140399532324943111654767187848E5L,
+  2.854829159639697837788887080758954924001E5L,
+  1.797628303815655343403735250238293741397E5L,
+  7.594356839258970405033155585486712125861E4L,
+  2.128857716871515081352991964243375186031E4L,
+  3.824952356185897735160588078446136783779E3L,
+  4.114517881637811823002128927449878962058E2L,
+  2.321125933898420063925789532045674660756E1L,
+  4.998469661968096229986658302195402690910E-1L,
+  1.538612243596254322971797716843006400388E-6L
+};
+static const long double Q[12] =
+{
+  3.940717212190338497730839731583397586124E4L,
+  2.626900195321832660448791748036714883242E5L,
+  7.777690340007566932935753241556479363645E5L,
+  1.347518538384329112529391120390701166528E6L,
+  1.514882452993549494932585972882995548426E6L,
+  1.158019977462989115839826904108208787040E6L,
+  6.132189329546557743179177159925690841200E5L,
+  2.248234257620569139969141618556349415120E5L,
+  5.605842085972455027590989944010492125825E4L,
+  9.147150349299596453976674231612674085381E3L,
+  9.104928120962988414618126155557301584078E2L,
+  4.839208193348159620282142911143429644326E1L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double R[6] =
+{
+  1.418134209872192732479751274970992665513E5L,
+ -8.977257995689735303686582344659576526998E4L,
+  2.048819892795278657810231591630928516206E4L,
+ -2.024301798136027039250415126250455056397E3L,
+  8.057002716646055371965756206836056074715E1L,
+ -8.828896441624934385266096344596648080902E-1L
+};
+static const long double S[6] =
+{
+  1.701761051846631278975701529965589676574E6L,
+ -1.332535117259762928288745111081235577029E6L,
+  4.001557694070773974936904547424676279307E5L,
+ -5.748542087379434595104154610899551484314E4L,
+  3.998526750980007367835804959888064681098E3L,
+ -1.186359407982897997337150403816839480438E2L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+static const long double
+/* log10(2) */
+L102A = 0.3125L,
+L102B = -1.14700043360188047862611052755069732318101185E-2L,
+/* log10(e) */
+L10EA = 0.5L,
+L10EB = -6.570551809674817234887108108339491770560299E-2L,
+/* sqrt(2)/2 */
+SQRTH = 7.071067811865475244008443621048490392848359E-1L;
+
+
+
+/* Evaluate P[n] x^n  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+  long double y;
+
+  p += n;
+  y = *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+/* Evaluate x^n+1  +  P[n] x^(n)  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+  long double y;
+
+  p += n;
+  y = x + *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+
+long double
+__ieee754_log10l (x)
+     long double x;
+{
+  long double z;
+  long double y;
+  int e;
+  int64_t hx, lx;
+
+/* Test for domain */
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+  if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+    return (-1.0L / (x - x));
+  if (hx < 0)
+    return (x - x) / (x - x);
+  if (hx >= 0x7ff0000000000000LL)
+    return (x + x);
+
+/* separate mantissa from exponent */
+
+/* Note, frexp is used so that denormal numbers
+ * will be handled properly.
+ */
+  x = __frexpl (x, &e);
+
+
+/* logarithm using log(x) = z + z**3 P(z)/Q(z),
+ * where z = 2(x-1)/x+1)
+ */
+  if ((e > 2) || (e < -2))
+    {
+      if (x < SQRTH)
+	{			/* 2( 2x-1 )/( 2x+1 ) */
+	  e -= 1;
+	  z = x - 0.5L;
+	  y = 0.5L * z + 0.5L;
+	}
+      else
+	{			/*  2 (x-1)/(x+1)   */
+	  z = x - 0.5L;
+	  z -= 0.5L;
+	  y = 0.5L * x + 0.5L;
+	}
+      x = z / y;
+      z = x * x;
+      y = x * (z * neval (z, R, 5) / deval (z, S, 5));
+      goto done;
+    }
+
+
+/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
+
+  if (x < SQRTH)
+    {
+      e -= 1;
+      x = 2.0 * x - 1.0L;	/*  2x - 1  */
+    }
+  else
+    {
+      x = x - 1.0L;
+    }
+  z = x * x;
+  y = x * (z * neval (x, P, 12) / deval (x, Q, 11));
+  y = y - 0.5 * z;
+
+done:
+
+  /* Multiply log of fraction by log10(e)
+   * and base 2 exponent by log10(2).
+   */
+  z = y * L10EB;
+  z += x * L10EB;
+  z += e * L102B;
+  z += y * L10EA;
+  z += x * L10EA;
+  z += e * L102A;
+  return (z);
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
new file mode 100644
index 0000000000..fe8a8e1d6c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
@@ -0,0 +1,250 @@
+/*                                                      log2l.c
+ *      Base 2 logarithm, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log2l();
+ *
+ * y = log2l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base 2 logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts.  If the exponent is between -1 and +1, the (natural)
+ * logarithm of the fraction is approximated by
+ *
+ *     log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting  z = 2(x-1)/x+1),
+ *
+ *     log(x) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ *                      Relative error:
+ * arithmetic   domain     # trials      peak         rms
+ *    IEEE      0.5, 2.0     100,000    2.6e-34     4.9e-35
+ *    IEEE     exp(+-10000)  100,000    9.6e-35     4.0e-35
+ *
+ * In the tests over the interval exp(+-10000), the logarithms
+ * of the random arguments were uniformly distributed over
+ * [-10000, +10000].
+ *
+ */
+
+/*
+   Cephes Math Library Release 2.2:  January, 1991
+   Copyright 1984, 1991 by Stephen L. Moshier
+   Adapted for glibc November, 2001
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double P[13] =
+{
+  1.313572404063446165910279910527789794488E4L,
+  7.771154681358524243729929227226708890930E4L,
+  2.014652742082537582487669938141683759923E5L,
+  3.007007295140399532324943111654767187848E5L,
+  2.854829159639697837788887080758954924001E5L,
+  1.797628303815655343403735250238293741397E5L,
+  7.594356839258970405033155585486712125861E4L,
+  2.128857716871515081352991964243375186031E4L,
+  3.824952356185897735160588078446136783779E3L,
+  4.114517881637811823002128927449878962058E2L,
+  2.321125933898420063925789532045674660756E1L,
+  4.998469661968096229986658302195402690910E-1L,
+  1.538612243596254322971797716843006400388E-6L
+};
+static const long double Q[12] =
+{
+  3.940717212190338497730839731583397586124E4L,
+  2.626900195321832660448791748036714883242E5L,
+  7.777690340007566932935753241556479363645E5L,
+  1.347518538384329112529391120390701166528E6L,
+  1.514882452993549494932585972882995548426E6L,
+  1.158019977462989115839826904108208787040E6L,
+  6.132189329546557743179177159925690841200E5L,
+  2.248234257620569139969141618556349415120E5L,
+  5.605842085972455027590989944010492125825E4L,
+  9.147150349299596453976674231612674085381E3L,
+  9.104928120962988414618126155557301584078E2L,
+  4.839208193348159620282142911143429644326E1L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double R[6] =
+{
+  1.418134209872192732479751274970992665513E5L,
+ -8.977257995689735303686582344659576526998E4L,
+  2.048819892795278657810231591630928516206E4L,
+ -2.024301798136027039250415126250455056397E3L,
+  8.057002716646055371965756206836056074715E1L,
+ -8.828896441624934385266096344596648080902E-1L
+};
+static const long double S[6] =
+{
+  1.701761051846631278975701529965589676574E6L,
+ -1.332535117259762928288745111081235577029E6L,
+  4.001557694070773974936904547424676279307E5L,
+ -5.748542087379434595104154610899551484314E4L,
+  3.998526750980007367835804959888064681098E3L,
+ -1.186359407982897997337150403816839480438E2L
+/* 1.000000000000000000000000000000000000000E0L, */
+};
+
+static const long double
+/* log2(e) - 1 */
+LOG2EA = 4.4269504088896340735992468100189213742664595E-1L,
+/* sqrt(2)/2 */
+SQRTH = 7.071067811865475244008443621048490392848359E-1L;
+
+
+/* Evaluate P[n] x^n  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+  long double y;
+
+  p += n;
+  y = *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+/* Evaluate x^n+1  +  P[n] x^(n)  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+  long double y;
+
+  p += n;
+  y = x + *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+
+long double
+__ieee754_log2l (x)
+     long double x;
+{
+  long double z;
+  long double y;
+  int e;
+  int64_t hx, lx;
+
+/* Test for domain */
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+  if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
+    return (-1.0L / (x - x));
+  if (hx < 0)
+    return (x - x) / (x - x);
+  if (hx >= 0x7ff0000000000000LL)
+    return (x + x);
+
+/* separate mantissa from exponent */
+
+/* Note, frexp is used so that denormal numbers
+ * will be handled properly.
+ */
+  x = __frexpl (x, &e);
+
+
+/* logarithm using log(x) = z + z**3 P(z)/Q(z),
+ * where z = 2(x-1)/x+1)
+ */
+  if ((e > 2) || (e < -2))
+    {
+      if (x < SQRTH)
+	{			/* 2( 2x-1 )/( 2x+1 ) */
+	  e -= 1;
+	  z = x - 0.5L;
+	  y = 0.5L * z + 0.5L;
+	}
+      else
+	{			/*  2 (x-1)/(x+1)   */
+	  z = x - 0.5L;
+	  z -= 0.5L;
+	  y = 0.5L * x + 0.5L;
+	}
+      x = z / y;
+      z = x * x;
+      y = x * (z * neval (z, R, 5) / deval (z, S, 5));
+      goto done;
+    }
+
+
+/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
+
+  if (x < SQRTH)
+    {
+      e -= 1;
+      x = 2.0 * x - 1.0L;	/*  2x - 1  */
+    }
+  else
+    {
+      x = x - 1.0L;
+    }
+  z = x * x;
+  y = x * (z * neval (x, P, 12) / deval (x, Q, 11));
+  y = y - 0.5 * z;
+
+done:
+
+/* Multiply log of fraction by log2(e)
+ * and base 2 exponent by 1
+ */
+  z = y * LOG2EA;
+  z += x * LOG2EA;
+  z += y;
+  z += x;
+  z += e;
+  return (z);
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
new file mode 100644
index 0000000000..aa5fc3740f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_logl.c
@@ -0,0 +1,281 @@
+/*							logll.c
+ *
+ * Natural logarithm for 128-bit long double precision.
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, logl();
+ *
+ * y = logl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base e (2.718...) logarithm of x.
+ *
+ * The argument is separated into its exponent and fractional
+ * parts.  Use of a lookup table increases the speed of the routine.
+ * The program uses logarithms tabulated at intervals of 1/128 to
+ * cover the domain from approximately 0.7 to 1.4.
+ *
+ * On the interval [-1/128, +1/128] the logarithm of 1+x is approximated by
+ *     log(1+x) = x - 0.5 x^2 + x^3 P(x) .
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ *                      Relative error:
+ * arithmetic   domain     # trials      peak         rms
+ *    IEEE   0.875, 1.125   100000      1.2e-34    4.1e-35
+ *    IEEE   0.125, 8       100000      1.2e-34    4.1e-35
+ *
+ *
+ * WARNING:
+ *
+ * This program uses integer operations on bit fields of floating-point
+ * numbers.  It does not work with data structures other than the
+ * structure assumed.
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+#include "math_private.h"
+
+/* log(1+x) = x - .5 x^2 + x^3 l(x)
+   -.0078125 <= x <= +.0078125
+   peak relative error 1.2e-37 */
+static const long double
+l3 =   3.333333333333333333333333333333336096926E-1L,
+l4 =  -2.499999999999999999999999999486853077002E-1L,
+l5 =   1.999999999999999999999999998515277861905E-1L,
+l6 =  -1.666666666666666666666798448356171665678E-1L,
+l7 =   1.428571428571428571428808945895490721564E-1L,
+l8 =  -1.249999999999999987884655626377588149000E-1L,
+l9 =   1.111111111111111093947834982832456459186E-1L,
+l10 = -1.000000000000532974938900317952530453248E-1L,
+l11 =  9.090909090915566247008015301349979892689E-2L,
+l12 = -8.333333211818065121250921925397567745734E-2L,
+l13 =  7.692307559897661630807048686258659316091E-2L,
+l14 = -7.144242754190814657241902218399056829264E-2L,
+l15 =  6.668057591071739754844678883223432347481E-2L;
+
+/* Lookup table of ln(t) - (t-1)
+    t = 0.5 + (k+26)/128)
+    k = 0, ..., 91   */
+static const long double logtbl[92] = {
+-5.5345593589352099112142921677820359632418E-2L,
+-5.2108257402767124761784665198737642086148E-2L,
+-4.8991686870576856279407775480686721935120E-2L,
+-4.5993270766361228596215288742353061431071E-2L,
+-4.3110481649613269682442058976885699556950E-2L,
+-4.0340872319076331310838085093194799765520E-2L,
+-3.7682072451780927439219005993827431503510E-2L,
+-3.5131785416234343803903228503274262719586E-2L,
+-3.2687785249045246292687241862699949178831E-2L,
+-3.0347913785027239068190798397055267411813E-2L,
+-2.8110077931525797884641940838507561326298E-2L,
+-2.5972247078357715036426583294246819637618E-2L,
+-2.3932450635346084858612873953407168217307E-2L,
+-2.1988775689981395152022535153795155900240E-2L,
+-2.0139364778244501615441044267387667496733E-2L,
+-1.8382413762093794819267536615342902718324E-2L,
+-1.6716169807550022358923589720001638093023E-2L,
+-1.5138929457710992616226033183958974965355E-2L,
+-1.3649036795397472900424896523305726435029E-2L,
+-1.2244881690473465543308397998034325468152E-2L,
+-1.0924898127200937840689817557742469105693E-2L,
+-9.6875626072830301572839422532631079809328E-3L,
+-8.5313926245226231463436209313499745894157E-3L,
+-7.4549452072765973384933565912143044991706E-3L,
+-6.4568155251217050991200599386801665681310E-3L,
+-5.5356355563671005131126851708522185605193E-3L,
+-4.6900728132525199028885749289712348829878E-3L,
+-3.9188291218610470766469347968659624282519E-3L,
+-3.2206394539524058873423550293617843896540E-3L,
+-2.5942708080877805657374888909297113032132E-3L,
+-2.0385211375711716729239156839929281289086E-3L,
+-1.5522183228760777967376942769773768850872E-3L,
+-1.1342191863606077520036253234446621373191E-3L,
+-7.8340854719967065861624024730268350459991E-4L,
+-4.9869831458030115699628274852562992756174E-4L,
+-2.7902661731604211834685052867305795169688E-4L,
+-1.2335696813916860754951146082826952093496E-4L,
+-3.0677461025892873184042490943581654591817E-5L,
+#define ZERO logtbl[38]
+ 0.0000000000000000000000000000000000000000E0L,
+-3.0359557945051052537099938863236321874198E-5L,
+-1.2081346403474584914595395755316412213151E-4L,
+-2.7044071846562177120083903771008342059094E-4L,
+-4.7834133324631162897179240322783590830326E-4L,
+-7.4363569786340080624467487620270965403695E-4L,
+-1.0654639687057968333207323853366578860679E-3L,
+-1.4429854811877171341298062134712230604279E-3L,
+-1.8753781835651574193938679595797367137975E-3L,
+-2.3618380914922506054347222273705859653658E-3L,
+-2.9015787624124743013946600163375853631299E-3L,
+-3.4938307889254087318399313316921940859043E-3L,
+-4.1378413103128673800485306215154712148146E-3L,
+-4.8328735414488877044289435125365629849599E-3L,
+-5.5782063183564351739381962360253116934243E-3L,
+-6.3731336597098858051938306767880719015261E-3L,
+-7.2169643436165454612058905294782949315193E-3L,
+-8.1090214990427641365934846191367315083867E-3L,
+-9.0486422112807274112838713105168375482480E-3L,
+-1.0035177140880864314674126398350812606841E-2L,
+-1.1067990155502102718064936259435676477423E-2L,
+-1.2146457974158024928196575103115488672416E-2L,
+-1.3269969823361415906628825374158424754308E-2L,
+-1.4437927104692837124388550722759686270765E-2L,
+-1.5649743073340777659901053944852735064621E-2L,
+-1.6904842527181702880599758489058031645317E-2L,
+-1.8202661505988007336096407340750378994209E-2L,
+-1.9542647000370545390701192438691126552961E-2L,
+-2.0924256670080119637427928803038530924742E-2L,
+-2.2346958571309108496179613803760727786257E-2L,
+-2.3810230892650362330447187267648486279460E-2L,
+-2.5313561699385640380910474255652501521033E-2L,
+-2.6856448685790244233704909690165496625399E-2L,
+-2.8438398935154170008519274953860128449036E-2L,
+-3.0058928687233090922411781058956589863039E-2L,
+-3.1717563112854831855692484086486099896614E-2L,
+-3.3413836095418743219397234253475252001090E-2L,
+-3.5147290019036555862676702093393332533702E-2L,
+-3.6917475563073933027920505457688955423688E-2L,
+-3.8723951502862058660874073462456610731178E-2L,
+-4.0566284516358241168330505467000838017425E-2L,
+-4.2444048996543693813649967076598766917965E-2L,
+-4.4356826869355401653098777649745233339196E-2L,
+-4.6304207416957323121106944474331029996141E-2L,
+-4.8285787106164123613318093945035804818364E-2L,
+-5.0301169421838218987124461766244507342648E-2L,
+-5.2349964705088137924875459464622098310997E-2L,
+-5.4431789996103111613753440311680967840214E-2L,
+-5.6546268881465384189752786409400404404794E-2L,
+-5.8693031345788023909329239565012647817664E-2L,
+-6.0871713627532018185577188079210189048340E-2L,
+-6.3081958078862169742820420185833800925568E-2L,
+-6.5323413029406789694910800219643791556918E-2L,
+-6.7595732653791419081537811574227049288168E-2L
+};
+
+/* ln(2) = ln2a + ln2b with extended precision. */
+static const long double
+  ln2a = 6.93145751953125e-1L,
+  ln2b = 1.4286068203094172321214581765680755001344E-6L;
+
+long double
+__ieee754_logl(long double x)
+{
+  long double z, y, w;
+  ieee854_long_double_shape_type u, t;
+  unsigned int m;
+  int k, e;
+
+  u.value = x;
+  m = u.parts32.w0;
+
+  /* Check for IEEE special cases.  */
+  k = m & 0x7fffffff;
+  /* log(0) = -infinity. */
+  if ((k | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+    {
+      return -0.5L / ZERO;
+    }
+  /* log ( x < 0 ) = NaN */
+  if (m & 0x80000000)
+    {
+      return (x - x) / ZERO;
+    }
+  /* log (infinity or NaN) */
+  if (k >= 0x7ff00000)
+    {
+      return x + x;
+    }
+
+  /* On this interval the table is not used due to cancellation error.  */
+  if ((x <= 1.0078125L) && (x >= 0.9921875L))
+    {
+      z = x - 1.0L;
+      k = 64;
+      t.value  = 1.0L;
+      e = 0;
+    }
+  else
+    {
+      /* Extract exponent and reduce domain to 0.703125 <= u < 1.40625  */
+      unsigned int w0;
+      e = (int) (m >> 20) - (int) 0x3fe;
+      m &= 0xfffff;
+      w0 = m | 0x3fe00000;
+      m |= 0x100000;
+      /* Find lookup table index k from high order bits of the significand. */
+      if (m < 0x168000)
+	{
+	  k = (m - 0xff000) >> 13;
+	  /* t is the argument 0.5 + (k+26)/128
+	     of the nearest item to u in the lookup table.  */
+	  t.parts32.w0 = 0x3ff00000 + (k << 13);
+	  t.parts32.w1 = 0;
+	  t.parts32.w2 = 0;
+	  t.parts32.w3 = 0;
+	  w0 += 0x100000;
+	  e -= 1;
+	  k += 64;
+	}
+      else
+	{
+	  k = (m - 0xfe000) >> 14;
+	  t.parts32.w0 = 0x3fe00000 + (k << 14);
+	  t.parts32.w1 = 0;
+	  t.parts32.w2 = 0;
+	  t.parts32.w3 = 0;
+	}
+      u.value = __scalbnl (u.value, ((int) ((w0 - u.parts32.w0) * 2)) >> 21);
+      /* log(u) = log( t u/t ) = log(t) + log(u/t)
+	 log(t) is tabulated in the lookup table.
+	 Express log(u/t) = log(1+z),  where z = u/t - 1 = (u-t)/t.
+         cf. Cody & Waite. */
+      z = (u.value - t.value) / t.value;
+    }
+  /* Series expansion of log(1+z).  */
+  w = z * z;
+  y = ((((((((((((l15 * z
+		  + l14) * z
+		 + l13) * z
+		+ l12) * z
+	       + l11) * z
+	      + l10) * z
+	     + l9) * z
+	    + l8) * z
+	   + l7) * z
+	  + l6) * z
+	 + l5) * z
+	+ l4) * z
+       + l3) * z * w;
+  y -= 0.5 * w;
+  y += e * ln2b;  /* Base 2 exponent offset times ln(2).  */
+  y += z;
+  y += logtbl[k-26]; /* log(t) - (t-1) */
+  y += (t.value - 1.0L);
+  y += e * ln2a;
+  return y;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
new file mode 100644
index 0000000000..feeaa8ce21
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_powl.c
@@ -0,0 +1,441 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Expansions and modifications for 128-bit long double are
+   Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+   and are incorporated herein by permission of the author.  The author
+   reserves the right to distribute this material elsewhere under different
+   copying permissions.  These modifications are distributed here under
+   the following terms:
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* __ieee754_powl(x,y) return x**y
+ *
+ *		      n
+ * Method:  Let x =  2   * (1+f)
+ *	1. Compute and return log2(x) in two pieces:
+ *		log2(x) = w1 + w2,
+ *	   where w1 has 113-53 = 60 bit trailing zeros.
+ *	2. Perform y*log2(x) = n+y' by simulating muti-precision
+ *	   arithmetic, where |y'|<=0.5.
+ *	3. Return x**y = 2**n*exp(y'*log2)
+ *
+ * Special cases:
+ *	1.  (anything) ** 0  is 1
+ *	2.  (anything) ** 1  is itself
+ *	3.  (anything) ** NAN is NAN
+ *	4.  NAN ** (anything except 0) is NAN
+ *	5.  +-(|x| > 1) **  +INF is +INF
+ *	6.  +-(|x| > 1) **  -INF is +0
+ *	7.  +-(|x| < 1) **  +INF is +0
+ *	8.  +-(|x| < 1) **  -INF is +INF
+ *	9.  +-1         ** +-INF is NAN
+ *	10. +0 ** (+anything except 0, NAN)               is +0
+ *	11. -0 ** (+anything except 0, NAN, odd integer)  is +0
+ *	12. +0 ** (-anything except 0, NAN)               is +INF
+ *	13. -0 ** (-anything except 0, NAN, odd integer)  is +INF
+ *	14. -0 ** (odd integer) = -( +0 ** (odd integer) )
+ *	15. +INF ** (+anything except 0,NAN) is +INF
+ *	16. +INF ** (-anything except 0,NAN) is +0
+ *	17. -INF ** (anything)  = -0 ** (-anything)
+ *	18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)
+ *	19. (-anything except 0 and inf) ** (non-integer) is NAN
+ *
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double bp[] = {
+  1.0L,
+  1.5L,
+};
+
+/* log_2(1.5) */
+static const long double dp_h[] = {
+  0.0,
+  5.8496250072115607565592654282227158546448E-1L
+};
+
+/* Low part of log_2(1.5) */
+static const long double dp_l[] = {
+  0.0,
+  1.0579781240112554492329533686862998106046E-16L
+};
+
+static const long double zero = 0.0L,
+  one = 1.0L,
+  two = 2.0L,
+  two113 = 1.0384593717069655257060992658440192E34L,
+  huge = 1.0e3000L,
+  tiny = 1.0e-3000L;
+
+/* 3/2 log x = 3 z + z^3 + z^3 (z^2 R(z^2))
+   z = (x-1)/(x+1)
+   1 <= x <= 1.25
+   Peak relative error 2.3e-37 */
+static const long double LN[] =
+{
+ -3.0779177200290054398792536829702930623200E1L,
+  6.5135778082209159921251824580292116201640E1L,
+ -4.6312921812152436921591152809994014413540E1L,
+  1.2510208195629420304615674658258363295208E1L,
+ -9.9266909031921425609179910128531667336670E-1L
+};
+static const long double LD[] =
+{
+ -5.129862866715009066465422805058933131960E1L,
+  1.452015077564081884387441590064272782044E2L,
+ -1.524043275549860505277434040464085593165E2L,
+  7.236063513651544224319663428634139768808E1L,
+ -1.494198912340228235853027849917095580053E1L
+  /* 1.0E0 */
+};
+
+/* exp(x) = 1 + x - x / (1 - 2 / (x - x^2 R(x^2)))
+   0 <= x <= 0.5
+   Peak relative error 5.7e-38  */
+static const long double PN[] =
+{
+  5.081801691915377692446852383385968225675E8L,
+  9.360895299872484512023336636427675327355E6L,
+  4.213701282274196030811629773097579432957E4L,
+  5.201006511142748908655720086041570288182E1L,
+  9.088368420359444263703202925095675982530E-3L,
+};
+static const long double PD[] =
+{
+  3.049081015149226615468111430031590411682E9L,
+  1.069833887183886839966085436512368982758E8L,
+  8.259257717868875207333991924545445705394E5L,
+  1.872583833284143212651746812884298360922E3L,
+  /* 1.0E0 */
+};
+
+static const long double
+  /* ln 2 */
+  lg2 = 6.9314718055994530941723212145817656807550E-1L,
+  lg2_h = 6.9314718055994528622676398299518041312695E-1L,
+  lg2_l = 2.3190468138462996154948554638754786504121E-17L,
+  ovt = 8.0085662595372944372e-0017L,
+  /* 2/(3*log(2)) */
+  cp = 9.6179669392597560490661645400126142495110E-1L,
+  cp_h = 9.6179669392597555432899980587535537779331E-1L,
+  cp_l = 5.0577616648125906047157785230014751039424E-17L;
+
+#ifdef __STDC__
+long double
+__ieee754_powl (long double x, long double y)
+#else
+long double
+__ieee754_powl (x, y)
+     long double x, y;
+#endif
+{
+  long double z, ax, z_h, z_l, p_h, p_l;
+  long double y1, t1, t2, r, s, t, u, v, w;
+  long double s2, s_h, s_l, t_h, t_l;
+  int32_t i, j, k, yisint, n;
+  u_int32_t ix, iy;
+  int32_t hx, hy;
+  ieee854_long_double_shape_type o, p, q;
+
+  p.value = x;
+  hx = p.parts32.w0;
+  ix = hx & 0x7fffffff;
+
+  q.value = y;
+  hy = q.parts32.w0;
+  iy = hy & 0x7fffffff;
+
+
+  /* y==zero: x**0 = 1 */
+  if ((iy | q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+    return one;
+
+  /* 1.0**y = 1; -1.0**+-Inf = 1 */
+  if (x == one)
+    return one;
+  if (x == -1.0L && iy == 0x7ff00000
+      && (q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+    return one;
+
+  /* +-NaN return x+y */
+  if ((ix > 0x7ff00000)
+      || ((ix == 0x7ff00000)
+	  && ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) != 0))
+      || (iy > 0x7ff00000)
+      || ((iy == 0x7ff00000)
+	  && ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) != 0)))
+    return x + y;
+
+  /* determine if y is an odd int when x < 0
+   * yisint = 0       ... y is not an integer
+   * yisint = 1       ... y is an odd int
+   * yisint = 2       ... y is an even int
+   */
+  yisint = 0;
+  if (hx < 0)
+    {
+      if ((q.parts32.w2 & 0x7fffffff) >= 0x43400000)	/* Low part >= 2^53 */
+	yisint = 2;		/* even integer y */
+      else if (iy >= 0x3ff00000)	/* 1.0 */
+	{
+	  if (__floorl (y) == y)
+	    {
+	      z = 0.5 * y;
+	      if (__floorl (z) == z)
+		yisint = 2;
+	      else
+		yisint = 1;
+	    }
+	}
+    }
+
+  /* special value of y */
+  if ((q.parts32.w1 | (q.parts32.w2 & 0x7fffffff) | q.parts32.w3) == 0)
+    {
+      if (iy == 0x7ff00000 && q.parts32.w1 == 0)	/* y is +-inf */
+	{
+	  if (((ix - 0x3ff00000) | p.parts32.w1
+	       | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
+	    return y - y;	/* inf**+-1 is NaN */
+	  else if (ix > 0x3ff00000 || fabsl (x) > 1.0L)
+	    /* (|x|>1)**+-inf = inf,0 */
+	    return (hy >= 0) ? y : zero;
+	  else
+	    /* (|x|<1)**-,+inf = inf,0 */
+	    return (hy < 0) ? -y : zero;
+	}
+      if (iy == 0x3ff00000)
+	{			/* y is  +-1 */
+	  if (hy < 0)
+	    return one / x;
+	  else
+	    return x;
+	}
+      if (hy == 0x40000000)
+	return x * x;		/* y is  2 */
+      if (hy == 0x3fe00000)
+	{			/* y is  0.5 */
+	  if (hx >= 0)		/* x >= +0 */
+	    return __ieee754_sqrtl (x);
+	}
+    }
+
+  ax = fabsl (x);
+  /* special value of x */
+  if ((p.parts32.w1 | (p.parts32.w2 & 0x7fffffff) | p.parts32.w3) == 0)
+    {
+      if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000)
+	{
+	  z = ax;		/*x is +-0,+-inf,+-1 */
+	  if (hy < 0)
+	    z = one / z;	/* z = (1/|x|) */
+	  if (hx < 0)
+	    {
+	      if (((ix - 0x3ff00000) | yisint) == 0)
+		{
+		  z = (z - z) / (z - z);	/* (-1)**non-int is NaN */
+		}
+	      else if (yisint == 1)
+		z = -z;		/* (x<0)**odd = -(|x|**odd) */
+	    }
+	  return z;
+	}
+    }
+
+  /* (x<0)**(non-int) is NaN */
+  if (((((u_int32_t) hx >> 31) - 1) | yisint) == 0)
+    return (x - x) / (x - x);
+
+  /* |y| is huge.
+     2^-16495 = 1/2 of smallest representable value.
+     If (1 - 1/131072)^y underflows, y > 1.4986e9 */
+  if (iy > 0x41d654b0)
+    {
+      /* if (1 - 2^-113)^y underflows, y > 1.1873e38 */
+      if (iy > 0x47d654b0)
+	{
+	  if (ix <= 0x3fefffff)
+	    return (hy < 0) ? huge * huge : tiny * tiny;
+	  if (ix >= 0x3ff00000)
+	    return (hy > 0) ? huge * huge : tiny * tiny;
+	}
+      /* over/underflow if x is not close to one */
+      if (ix < 0x3fefffff)
+	return (hy < 0) ? huge * huge : tiny * tiny;
+      if (ix > 0x3ff00000)
+	return (hy > 0) ? huge * huge : tiny * tiny;
+    }
+
+  n = 0;
+  /* take care subnormal number */
+  if (ix < 0x00100000)
+    {
+      ax *= two113;
+      n -= 113;
+      o.value = ax;
+      ix = o.parts32.w0;
+    }
+  n += ((ix) >> 20) - 0x3ff;
+  j = ix & 0x000fffff;
+  /* determine interval */
+  ix = j | 0x3ff00000;		/* normalize ix */
+  if (j <= 0x39880)
+    k = 0;			/* |x|<sqrt(3/2) */
+  else if (j < 0xbb670)
+    k = 1;			/* |x|<sqrt(3)   */
+  else
+    {
+      k = 0;
+      n += 1;
+      ix -= 0x00100000;
+    }
+
+  o.value = ax;
+  o.value = __scalbnl (o.value, ((int) ((ix - o.parts32.w0) * 2)) >> 21);
+  ax = o.value;
+
+  /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
+  u = ax - bp[k];		/* bp[0]=1.0, bp[1]=1.5 */
+  v = one / (ax + bp[k]);
+  s = u * v;
+  s_h = s;
+
+  o.value = s_h;
+  o.parts32.w3 = 0;
+  o.parts32.w2 &= 0xffff8000;
+  s_h = o.value;
+  /* t_h=ax+bp[k] High */
+  t_h = ax + bp[k];
+  o.value = t_h;
+  o.parts32.w3 = 0;
+  o.parts32.w2 &= 0xffff8000;
+  t_h = o.value;
+  t_l = ax - (t_h - bp[k]);
+  s_l = v * ((u - s_h * t_h) - s_h * t_l);
+  /* compute log(ax) */
+  s2 = s * s;
+  u = LN[0] + s2 * (LN[1] + s2 * (LN[2] + s2 * (LN[3] + s2 * LN[4])));
+  v = LD[0] + s2 * (LD[1] + s2 * (LD[2] + s2 * (LD[3] + s2 * (LD[4] + s2))));
+  r = s2 * s2 * u / v;
+  r += s_l * (s_h + s);
+  s2 = s_h * s_h;
+  t_h = 3.0 + s2 + r;
+  o.value = t_h;
+  o.parts32.w3 = 0;
+  o.parts32.w2 &= 0xffff8000;
+  t_h = o.value;
+  t_l = r - ((t_h - 3.0) - s2);
+  /* u+v = s*(1+...) */
+  u = s_h * t_h;
+  v = s_l * t_h + t_l * s;
+  /* 2/(3log2)*(s+...) */
+  p_h = u + v;
+  o.value = p_h;
+  o.parts32.w3 = 0;
+  o.parts32.w2 &= 0xffff8000;
+  p_h = o.value;
+  p_l = v - (p_h - u);
+  z_h = cp_h * p_h;		/* cp_h+cp_l = 2/(3*log2) */
+  z_l = cp_l * p_h + p_l * cp + dp_l[k];
+  /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
+  t = (long double) n;
+  t1 = (((z_h + z_l) + dp_h[k]) + t);
+  o.value = t1;
+  o.parts32.w3 = 0;
+  o.parts32.w2 &= 0xffff8000;
+  t1 = o.value;
+  t2 = z_l - (((t1 - t) - dp_h[k]) - z_h);
+
+  /* s (sign of result -ve**odd) = -1 else = 1 */
+  s = one;
+  if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
+    s = -one;			/* (-ve)**(odd int) */
+
+  /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
+  y1 = y;
+  o.value = y1;
+  o.parts32.w3 = 0;
+  o.parts32.w2 &= 0xffff8000;
+  y1 = o.value;
+  p_l = (y - y1) * t1 + y * t2;
+  p_h = y1 * t1;
+  z = p_l + p_h;
+  o.value = z;
+  j = o.parts32.w0;
+  if (j >= 0x40d00000) /* z >= 16384 */
+    {
+      /* if z > 16384 */
+      if (((j - 0x40d00000) | o.parts32.w1
+        | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+	return s * huge * huge;	/* overflow */
+      else
+	{
+	  if (p_l + ovt > z - p_h)
+	    return s * huge * huge;	/* overflow */
+	}
+    }
+  else if ((j & 0x7fffffff) >= 0x40d01b90)	/* z <= -16495 */
+    {
+      /* z < -16495 */
+      if (((j - 0xc0d01bc0) | o.parts32.w1
+         | (o.parts32.w2 & 0x7fffffff) | o.parts32.w3) != 0)
+	return s * tiny * tiny;	/* underflow */
+      else
+	{
+	  if (p_l <= z - p_h)
+	    return s * tiny * tiny;	/* underflow */
+	}
+    }
+  /* compute 2**(p_h+p_l) */
+  i = j & 0x7fffffff;
+  k = (i >> 20) - 0x3ff;
+  n = 0;
+  if (i > 0x3fe00000)
+    {				/* if |z| > 0.5, set n = [z+0.5] */
+      n = __floorl (z + 0.5L);
+      t = n;
+      p_h -= t;
+    }
+  t = p_l + p_h;
+  o.value = t;
+  o.parts32.w3 = 0;
+  o.parts32.w2 &= 0xffff8000;
+  t = o.value;
+  u = t * lg2_h;
+  v = (p_l - (t - p_h)) * lg2 + t * lg2_l;
+  z = u + v;
+  w = v - (z - u);
+  /*  exp(z) */
+  t = z * z;
+  u = PN[0] + t * (PN[1] + t * (PN[2] + t * (PN[3] + t * PN[4])));
+  v = PD[0] + t * (PD[1] + t * (PD[2] + t * (PD[3] + t)));
+  t1 = z - t * u / v;
+  r = (z * t1) / (t1 - two) - (w + z * w);
+  z = one - (r - z);
+  z = __scalbnl (z, n);
+  return s * z;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
new file mode 100644
index 0000000000..8b1c976f3b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
@@ -0,0 +1,278 @@
+/* Quad-precision floating point argument reduction.
+   Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "math.h"
+#include "math_private.h"
+#include <ieee754.h>
+
+/*
+ * Table of constants for 2/pi, 5628 hexadecimal digits of 2/pi
+ */
+static const int32_t two_over_pi[] = {
+0xa2f983, 0x6e4e44, 0x1529fc, 0x2757d1, 0xf534dd, 0xc0db62,
+0x95993c, 0x439041, 0xfe5163, 0xabdebb, 0xc561b7, 0x246e3a,
+0x424dd2, 0xe00649, 0x2eea09, 0xd1921c, 0xfe1deb, 0x1cb129,
+0xa73ee8, 0x8235f5, 0x2ebb44, 0x84e99c, 0x7026b4, 0x5f7e41,
+0x3991d6, 0x398353, 0x39f49c, 0x845f8b, 0xbdf928, 0x3b1ff8,
+0x97ffde, 0x05980f, 0xef2f11, 0x8b5a0a, 0x6d1f6d, 0x367ecf,
+0x27cb09, 0xb74f46, 0x3f669e, 0x5fea2d, 0x7527ba, 0xc7ebe5,
+0xf17b3d, 0x0739f7, 0x8a5292, 0xea6bfb, 0x5fb11f, 0x8d5d08,
+0x560330, 0x46fc7b, 0x6babf0, 0xcfbc20, 0x9af436, 0x1da9e3,
+0x91615e, 0xe61b08, 0x659985, 0x5f14a0, 0x68408d, 0xffd880,
+0x4d7327, 0x310606, 0x1556ca, 0x73a8c9, 0x60e27b, 0xc08c6b,
+0x47c419, 0xc367cd, 0xdce809, 0x2a8359, 0xc4768b, 0x961ca6,
+0xddaf44, 0xd15719, 0x053ea5, 0xff0705, 0x3f7e33, 0xe832c2,
+0xde4f98, 0x327dbb, 0xc33d26, 0xef6b1e, 0x5ef89f, 0x3a1f35,
+0xcaf27f, 0x1d87f1, 0x21907c, 0x7c246a, 0xfa6ed5, 0x772d30,
+0x433b15, 0xc614b5, 0x9d19c3, 0xc2c4ad, 0x414d2c, 0x5d000c,
+0x467d86, 0x2d71e3, 0x9ac69b, 0x006233, 0x7cd2b4, 0x97a7b4,
+0xd55537, 0xf63ed7, 0x1810a3, 0xfc764d, 0x2a9d64, 0xabd770,
+0xf87c63, 0x57b07a, 0xe71517, 0x5649c0, 0xd9d63b, 0x3884a7,
+0xcb2324, 0x778ad6, 0x23545a, 0xb91f00, 0x1b0af1, 0xdfce19,
+0xff319f, 0x6a1e66, 0x615799, 0x47fbac, 0xd87f7e, 0xb76522,
+0x89e832, 0x60bfe6, 0xcdc4ef, 0x09366c, 0xd43f5d, 0xd7de16,
+0xde3b58, 0x929bde, 0x2822d2, 0xe88628, 0x4d58e2, 0x32cac6,
+0x16e308, 0xcb7de0, 0x50c017, 0xa71df3, 0x5be018, 0x34132e,
+0x621283, 0x014883, 0x5b8ef5, 0x7fb0ad, 0xf2e91e, 0x434a48,
+0xd36710, 0xd8ddaa, 0x425fae, 0xce616a, 0xa4280a, 0xb499d3,
+0xf2a606, 0x7f775c, 0x83c2a3, 0x883c61, 0x78738a, 0x5a8caf,
+0xbdd76f, 0x63a62d, 0xcbbff4, 0xef818d, 0x67c126, 0x45ca55,
+0x36d9ca, 0xd2a828, 0x8d61c2, 0x77c912, 0x142604, 0x9b4612,
+0xc459c4, 0x44c5c8, 0x91b24d, 0xf31700, 0xad43d4, 0xe54929,
+0x10d5fd, 0xfcbe00, 0xcc941e, 0xeece70, 0xf53e13, 0x80f1ec,
+0xc3e7b3, 0x28f8c7, 0x940593, 0x3e71c1, 0xb3092e, 0xf3450b,
+0x9c1288, 0x7b20ab, 0x9fb52e, 0xc29247, 0x2f327b, 0x6d550c,
+0x90a772, 0x1fe76b, 0x96cb31, 0x4a1679, 0xe27941, 0x89dff4,
+0x9794e8, 0x84e6e2, 0x973199, 0x6bed88, 0x365f5f, 0x0efdbb,
+0xb49a48, 0x6ca467, 0x427271, 0x325d8d, 0xb8159f, 0x09e5bc,
+0x25318d, 0x3974f7, 0x1c0530, 0x010c0d, 0x68084b, 0x58ee2c,
+0x90aa47, 0x02e774, 0x24d6bd, 0xa67df7, 0x72486e, 0xef169f,
+0xa6948e, 0xf691b4, 0x5153d1, 0xf20acf, 0x339820, 0x7e4bf5,
+0x6863b2, 0x5f3edd, 0x035d40, 0x7f8985, 0x295255, 0xc06437,
+0x10d86d, 0x324832, 0x754c5b, 0xd4714e, 0x6e5445, 0xc1090b,
+0x69f52a, 0xd56614, 0x9d0727, 0x50045d, 0xdb3bb4, 0xc576ea,
+0x17f987, 0x7d6b49, 0xba271d, 0x296996, 0xacccc6, 0x5414ad,
+0x6ae290, 0x89d988, 0x50722c, 0xbea404, 0x940777, 0x7030f3,
+0x27fc00, 0xa871ea, 0x49c266, 0x3de064, 0x83dd97, 0x973fa3,
+0xfd9443, 0x8c860d, 0xde4131, 0x9d3992, 0x8c70dd, 0xe7b717,
+0x3bdf08, 0x2b3715, 0xa0805c, 0x93805a, 0x921110, 0xd8e80f,
+0xaf806c, 0x4bffdb, 0x0f9038, 0x761859, 0x15a562, 0xbbcb61,
+0xb989c7, 0xbd4010, 0x04f2d2, 0x277549, 0xf6b6eb, 0xbb22db,
+0xaa140a, 0x2f2689, 0x768364, 0x333b09, 0x1a940e, 0xaa3a51,
+0xc2a31d, 0xaeedaf, 0x12265c, 0x4dc26d, 0x9c7a2d, 0x9756c0,
+0x833f03, 0xf6f009, 0x8c402b, 0x99316d, 0x07b439, 0x15200c,
+0x5bc3d8, 0xc492f5, 0x4badc6, 0xa5ca4e, 0xcd37a7, 0x36a9e6,
+0x9492ab, 0x6842dd, 0xde6319, 0xef8c76, 0x528b68, 0x37dbfc,
+0xaba1ae, 0x3115df, 0xa1ae00, 0xdafb0c, 0x664d64, 0xb705ed,
+0x306529, 0xbf5657, 0x3aff47, 0xb9f96a, 0xf3be75, 0xdf9328,
+0x3080ab, 0xf68c66, 0x15cb04, 0x0622fa, 0x1de4d9, 0xa4b33d,
+0x8f1b57, 0x09cd36, 0xe9424e, 0xa4be13, 0xb52333, 0x1aaaf0,
+0xa8654f, 0xa5c1d2, 0x0f3f0b, 0xcd785b, 0x76f923, 0x048b7b,
+0x721789, 0x53a6c6, 0xe26e6f, 0x00ebef, 0x584a9b, 0xb7dac4,
+0xba66aa, 0xcfcf76, 0x1d02d1, 0x2df1b1, 0xc1998c, 0x77adc3,
+0xda4886, 0xa05df7, 0xf480c6, 0x2ff0ac, 0x9aecdd, 0xbc5c3f,
+0x6dded0, 0x1fc790, 0xb6db2a, 0x3a25a3, 0x9aaf00, 0x9353ad,
+0x0457b6, 0xb42d29, 0x7e804b, 0xa707da, 0x0eaa76, 0xa1597b,
+0x2a1216, 0x2db7dc, 0xfde5fa, 0xfedb89, 0xfdbe89, 0x6c76e4,
+0xfca906, 0x70803e, 0x156e85, 0xff87fd, 0x073e28, 0x336761,
+0x86182a, 0xeabd4d, 0xafe7b3, 0x6e6d8f, 0x396795, 0x5bbf31,
+0x48d784, 0x16df30, 0x432dc7, 0x356125, 0xce70c9, 0xb8cb30,
+0xfd6cbf, 0xa200a4, 0xe46c05, 0xa0dd5a, 0x476f21, 0xd21262,
+0x845cb9, 0x496170, 0xe0566b, 0x015299, 0x375550, 0xb7d51e,
+0xc4f133, 0x5f6e13, 0xe4305d, 0xa92e85, 0xc3b21d, 0x3632a1,
+0xa4b708, 0xd4b1ea, 0x21f716, 0xe4698f, 0x77ff27, 0x80030c,
+0x2d408d, 0xa0cd4f, 0x99a520, 0xd3a2b3, 0x0a5d2f, 0x42f9b4,
+0xcbda11, 0xd0be7d, 0xc1db9b, 0xbd17ab, 0x81a2ca, 0x5c6a08,
+0x17552e, 0x550027, 0xf0147f, 0x8607e1, 0x640b14, 0x8d4196,
+0xdebe87, 0x2afdda, 0xb6256b, 0x34897b, 0xfef305, 0x9ebfb9,
+0x4f6a68, 0xa82a4a, 0x5ac44f, 0xbcf82d, 0x985ad7, 0x95c7f4,
+0x8d4d0d, 0xa63a20, 0x5f57a4, 0xb13f14, 0x953880, 0x0120cc,
+0x86dd71, 0xb6dec9, 0xf560bf, 0x11654d, 0x6b0701, 0xacb08c,
+0xd0c0b2, 0x485551, 0x0efb1e, 0xc37295, 0x3b06a3, 0x3540c0,
+0x7bdc06, 0xcc45e0, 0xfa294e, 0xc8cad6, 0x41f3e8, 0xde647c,
+0xd8649b, 0x31bed9, 0xc397a4, 0xd45877, 0xc5e369, 0x13daf0,
+0x3c3aba, 0x461846, 0x5f7555, 0xf5bdd2, 0xc6926e, 0x5d2eac,
+0xed440e, 0x423e1c, 0x87c461, 0xe9fd29, 0xf3d6e7, 0xca7c22,
+0x35916f, 0xc5e008, 0x8dd7ff, 0xe26a6e, 0xc6fdb0, 0xc10893,
+0x745d7c, 0xb2ad6b, 0x9d6ecd, 0x7b723e, 0x6a11c6, 0xa9cff7,
+0xdf7329, 0xbac9b5, 0x5100b7, 0x0db2e2, 0x24ba74, 0x607de5,
+0x8ad874, 0x2c150d, 0x0c1881, 0x94667e, 0x162901, 0x767a9f,
+0xbefdfd, 0xef4556, 0x367ed9, 0x13d9ec, 0xb9ba8b, 0xfc97c4,
+0x27a831, 0xc36ef1, 0x36c594, 0x56a8d8, 0xb5a8b4, 0x0ecccf,
+0x2d8912, 0x34576f, 0x89562c, 0xe3ce99, 0xb920d6, 0xaa5e6b,
+0x9c2a3e, 0xcc5f11, 0x4a0bfd, 0xfbf4e1, 0x6d3b8e, 0x2c86e2,
+0x84d4e9, 0xa9b4fc, 0xd1eeef, 0xc9352e, 0x61392f, 0x442138,
+0xc8d91b, 0x0afc81, 0x6a4afb, 0xd81c2f, 0x84b453, 0x8c994e,
+0xcc2254, 0xdc552a, 0xd6c6c0, 0x96190b, 0xb8701a, 0x649569,
+0x605a26, 0xee523f, 0x0f117f, 0x11b5f4, 0xf5cbfc, 0x2dbc34,
+0xeebc34, 0xcc5de8, 0x605edd, 0x9b8e67, 0xef3392, 0xb817c9,
+0x9b5861, 0xbc57e1, 0xc68351, 0x103ed8, 0x4871dd, 0xdd1c2d,
+0xa118af, 0x462c21, 0xd7f359, 0x987ad9, 0xc0549e, 0xfa864f,
+0xfc0656, 0xae79e5, 0x362289, 0x22ad38, 0xdc9367, 0xaae855,
+0x382682, 0x9be7ca, 0xa40d51, 0xb13399, 0x0ed7a9, 0x480569,
+0xf0b265, 0xa7887f, 0x974c88, 0x36d1f9, 0xb39221, 0x4a827b,
+0x21cf98, 0xdc9f40, 0x5547dc, 0x3a74e1, 0x42eb67, 0xdf9dfe,
+0x5fd45e, 0xa4677b, 0x7aacba, 0xa2f655, 0x23882b, 0x55ba41,
+0x086e59, 0x862a21, 0x834739, 0xe6e389, 0xd49ee5, 0x40fb49,
+0xe956ff, 0xca0f1c, 0x8a59c5, 0x2bfa94, 0xc5c1d3, 0xcfc50f,
+0xae5adb, 0x86c547, 0x624385, 0x3b8621, 0x94792c, 0x876110,
+0x7b4c2a, 0x1a2c80, 0x12bf43, 0x902688, 0x893c78, 0xe4c4a8,
+0x7bdbe5, 0xc23ac4, 0xeaf426, 0x8a67f7, 0xbf920d, 0x2ba365,
+0xb1933d, 0x0b7cbd, 0xdc51a4, 0x63dd27, 0xdde169, 0x19949a,
+0x9529a8, 0x28ce68, 0xb4ed09, 0x209f44, 0xca984e, 0x638270,
+0x237c7e, 0x32b90f, 0x8ef5a7, 0xe75614, 0x08f121, 0x2a9db5,
+0x4d7e6f, 0x5119a5, 0xabf9b5, 0xd6df82, 0x61dd96, 0x023616,
+0x9f3ac4, 0xa1a283, 0x6ded72, 0x7a8d39, 0xa9b882, 0x5c326b,
+0x5b2746, 0xed3400, 0x7700d2, 0x55f4fc, 0x4d5901, 0x8071e0,
+0xe13f89, 0xb295f3, 0x64a8f1, 0xaea74b, 0x38fc4c, 0xeab2bb,
+0x47270b, 0xabc3a7, 0x34ba60, 0x52dd34, 0xf8563a, 0xeb7e8a,
+0x31bb36, 0x5895b7, 0x47f7a9, 0x94c3aa, 0xd39225, 0x1e7f3e,
+0xd8974e, 0xbba94f, 0xd8ae01, 0xe661b4, 0x393d8e, 0xa523aa,
+0x33068e, 0x1633b5, 0x3bb188, 0x1d3a9d, 0x4013d0, 0xcc1be5,
+0xf862e7, 0x3bf28f, 0x39b5bf, 0x0bc235, 0x22747e, 0xa247c0,
+0xd52d1f, 0x19add3, 0x9094df, 0x9311d0, 0xb42b25, 0x496db2,
+0xe264b2, 0x5ef135, 0x3bc6a4, 0x1a4ad0, 0xaac92e, 0x64e886,
+0x573091, 0x982cfb, 0x311b1a, 0x08728b, 0xbdcee1, 0x60e142,
+0xeb641d, 0xd0bba3, 0xe559d4, 0x597b8c, 0x2a4483, 0xf332ba,
+0xf84867, 0x2c8d1b, 0x2fa9b0, 0x50f3dd, 0xf9f573, 0xdb61b4,
+0xfe233e, 0x6c41a6, 0xeea318, 0x775a26, 0xbc5e5c, 0xcea708,
+0x94dc57, 0xe20196, 0xf1e839, 0xbe4851, 0x5d2d2f, 0x4e9555,
+0xd96ec2, 0xe7d755, 0x6304e0, 0xc02e0e, 0xfc40a0, 0xbbf9b3,
+0x7125a7, 0x222dfb, 0xf619d8, 0x838c1c, 0x6619e6, 0xb20d55,
+0xbb5137, 0x79e809, 0xaf9149, 0x0d73de, 0x0b0da5, 0xce7f58,
+0xac1934, 0x724667, 0x7a1a13, 0x9e26bc, 0x4555e7, 0x585cb5,
+0x711d14, 0x486991, 0x480d60, 0x56adab, 0xd62f64, 0x96ee0c,
+0x212ff3, 0x5d6d88, 0xa67684, 0x95651e, 0xab9e0a, 0x4ddefe,
+0x571010, 0x836a39, 0xf8ea31, 0x9e381d, 0xeac8b1, 0xcac96b,
+0x37f21e, 0xd505e9, 0x984743, 0x9fc56c, 0x0331b7, 0x3b8bf8,
+0x86e56a, 0x8dc343, 0x6230e7, 0x93cfd5, 0x6a8f2d, 0x733005,
+0x1af021, 0xa09fcb, 0x7415a1, 0xd56b23, 0x6ff725, 0x2f4bc7,
+0xb8a591, 0x7fac59, 0x5c55de, 0x212c38, 0xb13296, 0x5cff50,
+0x366262, 0xfa7b16, 0xf4d9a6, 0x2acfe7, 0xf07403, 0xd4d604,
+0x6fd916, 0x31b1bf, 0xcbb450, 0x5bd7c8, 0x0ce194, 0x6bd643,
+0x4fd91c, 0xdf4543, 0x5f3453, 0xe2b5aa, 0xc9aec8, 0x131485,
+0xf9d2bf, 0xbadb9e, 0x76f5b9, 0xaf15cf, 0xca3182, 0x14b56d,
+0xe9fe4d, 0x50fc35, 0xf5aed5, 0xa2d0c1, 0xc96057, 0x192eb6,
+0xe91d92, 0x07d144, 0xaea3c6, 0x343566, 0x26d5b4, 0x3161e2,
+0x37f1a2, 0x209eff, 0x958e23, 0x493798, 0x35f4a6, 0x4bdc02,
+0xc2be13, 0xbe80a0, 0x0b72a3, 0x115c5f, 0x1e1bd1, 0x0db4d3,
+0x869e85, 0x96976b, 0x2ac91f, 0x8a26c2, 0x3070f0, 0x041412,
+0xfc9fa5, 0xf72a38, 0x9c6878, 0xe2aa76, 0x50cfe1, 0x559274,
+0x934e38, 0x0a92f7, 0x5533f0, 0xa63db4, 0x399971, 0xe2b755,
+0xa98a7c, 0x008f19, 0xac54d2, 0x2ea0b4, 0xf5f3e0, 0x60c849,
+0xffd269, 0xae52ce, 0x7a5fdd, 0xe9ce06, 0xfb0ae8, 0xa50cce,
+0xea9d3e, 0x3766dd, 0xb834f5, 0x0da090, 0x846f88, 0x4ae3d5,
+0x099a03, 0x2eae2d, 0xfcb40a, 0xfb9b33, 0xe281dd, 0x1b16ba,
+0xd8c0af, 0xd96b97, 0xb52dc9, 0x9c277f, 0x5951d5, 0x21ccd6,
+0xb6496b, 0x584562, 0xb3baf2, 0xa1a5c4, 0x7ca2cf, 0xa9b93d,
+0x7b7b89, 0x483d38,
+};
+
+static const long double c[] = {
+/* 93 bits of pi/2 */
+#define PI_2_1 c[0]
+ 1.57079632679489661923132169155131424e+00L, /* 3fff921fb54442d18469898cc5100000 */
+
+/* pi/2 - PI_2_1 */
+#define PI_2_1t c[1]
+ 8.84372056613570112025531863263659260e-29L, /* 3fa1c06e0e68948127044533e63a0106 */
+};
+
+int32_t __ieee754_rem_pio2l(long double x, long double *y)
+{
+  long double z, w, t;
+  double tx[8];
+  int exp;
+  int64_t n, ix, hx, ixd;
+  u_int64_t lx, lxd;
+
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+  ix = hx & 0x7fffffffffffffffLL;
+  if (ix <= 0x3fe921fb54442d10LL)	/* x in <-pi/4, pi/4> */
+    {
+      y[0] = x;
+      y[1] = 0;
+      return 0;
+    }
+
+  if (ix < 0x4002d97c7f3321d0LL)	/* |x| in <pi/4, 3pi/4) */
+    {
+      if (hx > 0)
+	{
+	  /* 113 + 93 bit PI is ok */
+	  z = x - PI_2_1;
+	  y[0] = z - PI_2_1t;
+	  y[1] = (z - y[0]) - PI_2_1t;
+	  return 1;
+	}
+      else
+        {
+	  /* 113 + 93 bit PI is ok */
+	  z = x + PI_2_1;
+	  y[0] = z + PI_2_1t;
+	  y[1] = (z - y[0]) + PI_2_1t;
+	  return -1;
+	}
+    }
+
+  if (ix >= 0x7ff0000000000000LL)	/* x is +=oo or NaN */
+    {
+      y[0] = x - x;
+      y[1] = y[0];
+      return 0;
+    }
+
+  /* Handle large arguments.
+     We split the 113 bits of the mantissa into 5 24bit integers
+     stored in a double array.  */
+  /* Make the IBM extended format 105 bit mantissa look like the ieee854 112
+     bit mantissa so the next operatation will give the correct result.  */
+  ldbl_extract_mantissa (&ixd, &lxd, &exp, x);
+  exp = exp - 23;
+  /* This is faster than doing this in floating point, because we
+     have to convert it to integers anyway and like this we can keep
+     both integer and floating point units busy.  */
+  tx [0] = (double)(((ixd >> 25) & 0x7fffff) | 0x800000);
+  tx [1] = (double)((ixd >> 1) & 0xffffff);
+  tx [2] = (double)(((ixd << 23) | (lxd >> 41)) & 0xffffff);
+  tx [3] = (double)((lxd >> 17) & 0xffffff);
+  tx [4] = (double)((lxd << 7) & 0xffffff);
+
+  n = __kernel_rem_pio2 (tx, tx + 5, exp, ((lxd << 7) & 0xffffff) ? 5 : 4,
+			 3, two_over_pi);
+
+  /* The result is now stored in 3 double values, we need to convert it into
+     two long double values.  */
+  t = (long double) tx [6] + (long double) tx [7];
+  w = (long double) tx [5];
+
+  if (hx >= 0)
+    {
+      y[0] = w + t;
+      y[1] = t - (y[0] - w);
+      return n;
+    }
+  else
+    {
+      y[0] = -(w + t);
+      y[1] = -t - (y[0] + w);
+      return -n;
+    }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
new file mode 100644
index 0000000000..b7fa68f32a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
@@ -0,0 +1,78 @@
+/* e_fmodl.c -- long double version of e_fmod.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* __ieee754_remainderl(x,p)
+ * Return :
+ * 	returns  x REM p  =  x - [x/p]*p as if in infinite
+ * 	precise arithmetic, where [x/p] is the (infinite bit)
+ *	integer nearest x/p (in half way case choose the even one).
+ * Method :
+ *	Based on fmodl() return x-[x/p]chopped*p exactlp.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double zero = 0.0L;
+#else
+static long double zero = 0.0L;
+#endif
+
+
+#ifdef __STDC__
+	long double __ieee754_remainderl(long double x, long double p)
+#else
+	long double __ieee754_remainderl(x,p)
+	long double x,p;
+#endif
+{
+	int64_t hx,hp;
+	u_int64_t sx,lx,lp;
+	long double p_half;
+
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	GET_LDOUBLE_WORDS64(hp,lp,p);
+	sx = hx&0x8000000000000000ULL;
+	hp &= 0x7fffffffffffffffLL;
+	hx &= 0x7fffffffffffffffLL;
+
+    /* purge off exception values */
+	if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); 	/* p = 0 */
+	if((hx>=0x7ff0000000000000LL)||			/* x not finite */
+	  ((hp>=0x7ff0000000000000LL)&&			/* p is NaN */
+	  (((hp-0x7ff0000000000000LL)|lp)!=0)))
+	    return (x*p)/(x*p);
+
+
+	if (hp<=0x7fdfffffffffffffLL) x = __ieee754_fmodl(x,p+p);	/* now x < 2p */
+	if (((hx-hp)|(lx-lp))==0) return zero*x;
+	x  = fabsl(x);
+	p  = fabsl(p);
+	if (hp<0x0020000000000000LL) {
+	    if(x+x>p) {
+		x-=p;
+		if(x+x>=p) x -= p;
+	    }
+	} else {
+	    p_half = 0.5L*p;
+	    if(x>p_half) {
+		x-=p;
+		if(x>=p_half) x -= p;
+	    }
+	}
+	GET_LDOUBLE_MSW64(hx,x);
+	SET_LDOUBLE_MSW64(x,hx^sx);
+	return x;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
new file mode 100644
index 0000000000..38ae71d4b7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c
@@ -0,0 +1,84 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
+#endif
+
+/* __ieee754_sinh(x)
+ * Method :
+ * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
+ *	1. Replace x by |x| (sinh(-x) = -sinh(x)).
+ *	2.
+ *		                                    E + E/(E+1)
+ *	    0        <= x <= 22     :  sinh(x) := --------------, E=expm1(x)
+ *			       			        2
+ *
+ *	    22       <= x <= lnovft :  sinh(x) := exp(x)/2
+ *	    lnovft   <= x <= ln2ovft:  sinh(x) := exp(x/2)/2 * exp(x/2)
+ *	    ln2ovft  <  x	    :  sinh(x) := x*shuge (overflow)
+ *
+ * Special cases:
+ *	sinh(x) is |x| if x is +INF, -INF, or NaN.
+ *	only sinh(0)=0 is exact for finite x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+static const long double one = 1.0, shuge = 1.0e307;
+#else
+static long double one = 1.0, shuge = 1.0e307;
+#endif
+
+#ifdef __STDC__
+	long double __ieee754_sinhl(long double x)
+#else
+	long double __ieee754_sinhl(x)
+	long double x;
+#endif
+{
+	long double t,w,h;
+	int64_t ix,jx;
+
+    /* High word of |x|. */
+	GET_LDOUBLE_MSW64(jx,x);
+	ix = jx&0x7fffffffffffffffLL;
+
+    /* x is INF or NaN */
+	if(ix>=0x7ff0000000000000LL) return x+x;
+
+	h = 0.5;
+	if (jx<0) h = -h;
+    /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
+	if (ix < 0x4036000000000000LL) {	/* |x|<22 */
+	    if (ix<0x3e20000000000000LL) 	/* |x|<2**-29 */
+		if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */
+	    t = __expm1l(fabsl(x));
+	    if(ix<0x3ff0000000000000LL) return h*(2.0*t-t*t/(t+one));
+	    return h*(t+t/(t+one));
+	}
+
+    /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */
+	if (ix < 0x40862e42fefa39efLL)  return h*__ieee754_expl(fabsl(x));
+
+    /* |x| in [log(maxdouble), overflowthresold] */
+	if (ix <= 0x408633ce8fb9f87dLL) {
+	    w = __ieee754_expl(0.5*fabsl(x));
+	    t = h*w;
+	    return t*w;
+	}
+
+    /* |x| > overflowthresold, sinh(x) overflow */
+	return x*shuge;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
new file mode 100644
index 0000000000..1f533cae42
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c
@@ -0,0 +1,109 @@
+/*
+ * IBM Accurate Mathematical Library
+ * written by International Business Machines Corp.
+ * Copyright (C) 2001, 2004, 2006 Free Software Foundation
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+/*********************************************************************/
+/* MODULE_NAME: uroot.c                                              */
+/*                                                                   */
+/* FUNCTION:    usqrt                                                */
+/*                                                                   */
+/* FILES NEEDED: dla.h endian.h mydefs.h uroot.h                     */
+/*               uroot.tbl                                           */
+/*                                                                   */
+/* An ultimate sqrt routine. Given an IEEE double machine number x   */
+/* it computes the correctly rounded (to nearest) value of square    */
+/* root of x.                                                        */
+/* Assumption: Machine arithmetic operations are performed in        */
+/* round to nearest mode of IEEE 754 standard.                       */
+/*                                                                   */
+/*********************************************************************/
+
+#include <math_private.h>
+
+typedef unsigned int int4;
+typedef union {int4 i[4]; long double x; double d[2]; } mynumber;
+
+static const  mynumber
+  t512 = {{0x5ff00000, 0x00000000, 0x00000000, 0x00000000 }},  /* 2^512  */
+  tm256 = {{0x2ff00000, 0x00000000, 0x00000000, 0x00000000 }};  /* 2^-256 */
+static const double
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+/*********************************************************************/
+/* An ultimate sqrt routine. Given an IEEE double machine number x   */
+/* it computes the correctly rounded (to nearest) value of square    */
+/* root of x.                                                        */
+/*********************************************************************/
+long double __ieee754_sqrtl(long double x) 
+{
+  static const long double big = 134217728.0, big1 = 134217729.0;
+  long double t,s,i;
+  mynumber a,c;
+  int4 k, l, m;
+  int n;
+  double d;
+
+  a.x=x;
+  k=a.i[0] & 0x7fffffff;
+  /*----------------- 2^-1022  <= | x |< 2^1024  -----------------*/
+  if (k>0x000fffff && k<0x7ff00000) {
+    if (x < 0) return (big1-big1)/(big-big);
+    l = (k&0x001fffff)|0x3fe00000;
+    if (((a.i[2] & 0x7fffffff) | a.i[3]) != 0) {
+      n = (int) ((l - k) * 2) >> 21;
+      m = (a.i[2] >> 20) & 0x7ff;
+      if (m == 0) {
+	a.d[1] *= two54;
+	m = ((a.i[2] >> 20) & 0x7ff) - 54;
+      }
+      m += n;
+      if (m > 0)
+	a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+      else if (m <= -54) {
+	a.i[2] &= 0x80000000;
+	a.i[3] = 0;
+      } else {
+	m += 54;
+	a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+	a.d[1] *= twom54;
+      }
+    }
+    a.i[0] = l;
+    s = a.x;
+    d = __ieee754_sqrt (a.d[0]);
+    c.i[0] = 0x20000000+((k&0x7fe00000)>>1);
+    c.i[1] = 0;
+    c.i[2] = 0;
+    c.i[3] = 0;
+    i = d;
+    t = 0.5L * (i + s / i);
+    i = 0.5L * (t + s / t);
+    return c.x * i;
+  }
+  else {
+    if (k>=0x7ff00000) {
+      if (a.i[0] == 0xfff00000 && a.i[1] == 0)
+	return (big1-big1)/(big-big); /* sqrt (-Inf) = NaN.  */
+      return x; /* sqrt (NaN) = NaN, sqrt (+Inf) = +Inf.  */
+    }
+    if (x == 0) return x;
+    if (x < 0) return (big1-big1)/(big-big);
+    return tm256.x*__ieee754_sqrtl(x*t512.x);
+  }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
new file mode 100644
index 0000000000..94a2091c84
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/ieee754.h
@@ -0,0 +1,210 @@
+/* Copyright (C) 1992, 1995, 1996, 1999, 2004, 2006
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _IEEE754_H
+
+#define _IEEE754_H 1
+#include <features.h>
+
+#include <endian.h>
+
+__BEGIN_DECLS
+
+union ieee754_float
+  {
+    float f;
+
+    /* This is the IEEE 754 single-precision format.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:8;
+	unsigned int mantissa:23;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int mantissa:23;
+	unsigned int exponent:8;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee;
+
+    /* This format makes it easier to see if a NaN is a signalling NaN.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:8;
+	unsigned int quiet_nan:1;
+	unsigned int mantissa:22;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int mantissa:22;
+	unsigned int quiet_nan:1;
+	unsigned int exponent:8;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee_nan;
+  };
+
+#define IEEE754_FLOAT_BIAS	0x7f /* Added to exponent.  */
+
+
+union ieee754_double
+  {
+    double d;
+
+    /* This is the IEEE 754 double-precision format.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:11;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:20;
+	unsigned int mantissa1:32;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:20;
+	unsigned int exponent:11;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee;
+
+    /* This format makes it easier to see if a NaN is a signalling NaN.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:11;
+	unsigned int quiet_nan:1;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:19;
+	unsigned int mantissa1:32;
+#else
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:19;
+	unsigned int quiet_nan:1;
+	unsigned int exponent:11;
+	unsigned int negative:1;
+#endif
+      } ieee_nan;
+  };
+
+#define IEEE754_DOUBLE_BIAS	0x3ff /* Added to exponent.  */
+
+
+union ieee854_long_double
+  {
+    long double d;
+
+    /* This is the IEEE 854 quad-precision format.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:15;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:16;
+	unsigned int mantissa1:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa3:32;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa3:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:16;
+	unsigned int exponent:15;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee;
+
+    /* This format makes it easier to see if a NaN is a signalling NaN.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:15;
+	unsigned int quiet_nan:1;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:15;
+	unsigned int mantissa1:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa3:32;
+#else
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa3:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:15;
+	unsigned int quiet_nan:1;
+	unsigned int exponent:15;
+	unsigned int negative:1;
+#endif
+      } ieee_nan;
+  };
+
+#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent.  */
+
+
+/* IBM extended format for long double.
+
+   Each long double is made up of two IEEE doubles.  The value of the
+   long double is the sum of the values of the two parts.  The most
+   significant part is required to be the value of the long double
+   rounded to the nearest double, as specified by IEEE.  For Inf
+   values, the least significant part is required to be one of +0.0 or
+   -0.0.  No other requirements are made; so, for example, 1.0 may be
+   represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a
+   NaN is don't-care.  */
+
+union ibm_extended_long_double
+  {
+    long double d;
+    double dd[2];
+
+    /* This is the IBM extended format long double.  */
+    struct
+      { /* Big endian.  There is no other.  */
+
+	unsigned int negative:1;
+	unsigned int exponent:11;
+	/* Together Mantissa0-3 comprise the mantissa.  */
+	unsigned int mantissa0:20;
+	unsigned int mantissa1:32;
+
+	unsigned int negative2:1;
+	unsigned int exponent2:11;
+	/* There is an implied 1 here?  */
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa2:20;
+	unsigned int mantissa3:32;
+      } ieee;
+   };
+
+#define IBM_EXTENDED_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent.  */
+
+__END_DECLS
+
+#endif /* ieee754.h */
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_cosl.c b/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
new file mode 100644
index 0000000000..b442582b3f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
@@ -0,0 +1,146 @@
+/* Quad-precision floating point cosine on <-pi/4,pi/4>.
+   Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+   x in <0,1/256>  */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 )
+   x in <0,0.1484375>  */
+#define COS1 c[6]
+#define COS2 c[7]
+#define COS3 c[8]
+#define COS4 c[9]
+#define COS5 c[10]
+#define COS6 c[11]
+#define COS7 c[12]
+#define COS8 c[13]
+-4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */
+ 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */
+-1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */
+ 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */
+-2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */
+ 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */
+-1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */
+ 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+   x in <0,1/256>  */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+long double
+__kernel_cosl(long double x, long double y)
+{
+  long double h, l, z, sin_l, cos_l_m1;
+  int64_t ix;
+  u_int32_t tix, hix, index;
+  GET_LDOUBLE_MSW64 (ix, x);
+  tix = ((u_int64_t)ix) >> 32;
+  tix &= ~0x80000000;			/* tix = |x|'s high 32 bits */
+  if (tix < 0x3fc30000)			/* |x| < 0.1484375 */
+    {
+      /* Argument is small enough to approximate it by a Chebyshev
+	 polynomial of degree 16.  */
+      if (tix < 0x3c600000)		/* |x| < 2^-57 */
+	if (!((int)x)) return ONE;	/* generate inexact */
+      z = x * x;
+      return ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+
+		    z*(COS5+z*(COS6+z*(COS7+z*COS8))))))));
+    }
+  else
+    {
+      /* So that we don't have to use too large polynomial,  we find
+	 l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
+	 possible values for h.  We look up cosl(h) and sinl(h) in
+	 pre-computed tables,  compute cosl(l) and sinl(l) using a
+	 Chebyshev polynomial of degree 10(11) and compute
+	 cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l).  */
+      int six = tix;
+      tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000;
+      index = 0x3ffe - (tix >> 16);
+      hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+      x = fabsl (x);
+      switch (index)
+	{
+	case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
+	case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break;
+	default:
+	case 2: index = (hix - 0x3ffc3000) >> 10; break;
+	}
+      hix = (hix << 4) & 0x3fffffff;
+/*
+    The following should work for double but generates the wrong index.
+    For now the code above converts double to ieee extended to compute
+    the index back to double for the h value.
+    
+      index = 0x3fe - (tix >> 20);
+      hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+      x = fabsl (x);
+      switch (index)
+	{
+	case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+	case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+	default:
+	case 2: index = (hix - 0x3fc30000) >> 14; break;
+	}
+*/
+      SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+      l = y - (h - x);
+      z = l * l;
+      sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+      cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+      return __sincosl_table [index + SINCOSL_COS_HI]
+	     + (__sincosl_table [index + SINCOSL_COS_LO]
+		- (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l
+		   - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1));
+    }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
new file mode 100644
index 0000000000..cd2ce7ad1d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c
@@ -0,0 +1,182 @@
+/* Quad-precision floating point sine and cosine on <-pi/4,pi/4>.
+   Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+   x in <0,1/256>  */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 )
+   x in <0,0.1484375>  */
+#define COS1 c[6]
+#define COS2 c[7]
+#define COS3 c[8]
+#define COS4 c[9]
+#define COS5 c[10]
+#define COS6 c[11]
+#define COS7 c[12]
+#define COS8 c[13]
+-4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */
+ 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */
+-1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */
+ 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */
+-2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */
+ 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */
+-1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */
+ 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+   x in <0,1/256>  */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+
+/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 )
+   x in <0,0.1484375>  */
+#define SIN1 c[19]
+#define SIN2 c[20]
+#define SIN3 c[21]
+#define SIN4 c[22]
+#define SIN5 c[23]
+#define SIN6 c[24]
+#define SIN7 c[25]
+#define SIN8 c[26]
+-1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */
+ 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */
+-1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */
+ 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */
+-2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */
+ 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */
+-7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */
+ 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+void
+__kernel_sincosl(long double x, long double y, long double *sinx, long double *cosx, int iy)
+{
+  long double h, l, z, sin_l, cos_l_m1;
+  int64_t ix;
+  u_int32_t tix, hix, index;
+  GET_LDOUBLE_MSW64 (ix, x);
+  tix = ((u_int64_t)ix) >> 32;
+  tix &= ~0x80000000;			/* tix = |x|'s high 32 bits */
+  if (tix < 0x3fc30000)			/* |x| < 0.1484375 */
+    {
+      /* Argument is small enough to approximate it by a Chebyshev
+	 polynomial of degree 16(17).  */
+      if (tix < 0x3c600000)		/* |x| < 2^-57 */
+	if (!((int)x))			/* generate inexact */
+	  {
+	    *sinx = x;
+	    *cosx = ONE;
+	    return;
+	  }
+      z = x * x;
+      *sinx = x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+
+			z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8)))))))));
+      *cosx = ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+
+		     z*(COS5+z*(COS6+z*(COS7+z*COS8))))))));
+    }
+  else
+    {
+      /* So that we don't have to use too large polynomial,  we find
+	 l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
+	 possible values for h.  We look up cosl(h) and sinl(h) in
+	 pre-computed tables,  compute cosl(l) and sinl(l) using a
+	 Chebyshev polynomial of degree 10(11) and compute
+	 sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l) and
+	 cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l).  */
+      int six = tix;
+      tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000;
+      index = 0x3ffe - (tix >> 16);
+      hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+      x = fabsl (x);
+      switch (index)
+	{
+	case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
+	case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break;
+	default:
+	case 2: index = (hix - 0x3ffc3000) >> 10; break;
+	}
+      hix = (hix << 4) & 0x3fffffff;
+/*
+    The following should work for double but generates the wrong index.
+    For now the code above converts double to ieee extended to compute
+    the index back to double for the h value. 
+    
+
+      index = 0x3fe - (tix >> 20);
+      hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
+      x = fabsl (x);
+      switch (index)
+	{
+	case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+	case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+	default:
+	case 2: index = (hix - 0x3fc30000) >> 14; break;
+	}
+*/
+      SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+      if (iy)
+	l = y - (h - x);
+      else
+	l = x - h;
+      z = l * l;
+      sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+      cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+      z = __sincosl_table [index + SINCOSL_SIN_HI]
+	  + (__sincosl_table [index + SINCOSL_SIN_LO]
+	     + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1)
+	     + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l));
+      *sinx = (ix < 0) ? -z : z;
+      *cosx = __sincosl_table [index + SINCOSL_COS_HI]
+	      + (__sincosl_table [index + SINCOSL_COS_LO]
+		 - (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l
+		    - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1));
+    }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sinl.c b/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
new file mode 100644
index 0000000000..24cb551b6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
@@ -0,0 +1,150 @@
+/* Quad-precision floating point sine on <-pi/4,pi/4>.
+   Copyright (C) 1999,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "math.h"
+#include "math_private.h"
+
+static const long double c[] = {
+#define ONE c[0]
+ 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */
+
+/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 )
+   x in <0,1/256>  */
+#define SCOS1 c[1]
+#define SCOS2 c[2]
+#define SCOS3 c[3]
+#define SCOS4 c[4]
+#define SCOS5 c[5]
+-5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */
+ 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */
+-1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */
+ 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */
+-2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */
+
+/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 )
+   x in <0,0.1484375>  */
+#define SIN1 c[6]
+#define SIN2 c[7]
+#define SIN3 c[8]
+#define SIN4 c[9]
+#define SIN5 c[10]
+#define SIN6 c[11]
+#define SIN7 c[12]
+#define SIN8 c[13]
+-1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */
+ 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */
+-1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */
+ 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */
+-2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */
+ 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */
+-7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */
+ 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */
+
+/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 )
+   x in <0,1/256>  */
+#define SSIN1 c[14]
+#define SSIN2 c[15]
+#define SSIN3 c[16]
+#define SSIN4 c[17]
+#define SSIN5 c[18]
+-1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */
+ 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */
+-1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */
+ 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */
+-2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */
+};
+
+#define SINCOSL_COS_HI 0
+#define SINCOSL_COS_LO 1
+#define SINCOSL_SIN_HI 2
+#define SINCOSL_SIN_LO 3
+extern const long double __sincosl_table[];
+
+long double
+__kernel_sinl(long double x, long double y, int iy)
+{
+  long double h, l, z, sin_l, cos_l_m1;
+  int64_t ix;
+  u_int32_t tix, hix, index;
+  GET_LDOUBLE_MSW64 (ix, x);
+  tix = ((u_int64_t)ix) >> 32;
+  tix &= ~0x80000000;			/* tix = |x|'s high 32 bits */
+  if (tix < 0x3fc30000)			/* |x| < 0.1484375 */
+    {
+      /* Argument is small enough to approximate it by a Chebyshev
+	 polynomial of degree 17.  */
+      if (tix < 0x3c600000)		/* |x| < 2^-57 */
+	if (!((int)x)) return x;	/* generate inexact */
+      z = x * x;
+      return x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+
+		       z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8)))))))));
+    }
+  else
+    {
+      /* So that we don't have to use too large polynomial,  we find
+	 l and h such that x = l + h,  where fabsl(l) <= 1.0/256 with 83
+	 possible values for h.  We look up cosl(h) and sinl(h) in
+	 pre-computed tables,  compute cosl(l) and sinl(l) using a
+	 Chebyshev polynomial of degree 10(11) and compute
+	 sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l).  */
+      int six = tix;
+      tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000;
+      index = 0x3ffe - (tix >> 16);
+      hix = (tix + (0x200 << index)) & (0xfffffc00 << index);
+      x = fabsl (x);
+      switch (index)
+	{
+	case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break;
+	case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break;
+	default:
+	case 2: index = (hix - 0x3ffc3000) >> 10; break;
+	}
+      hix = (hix << 4) & 0x3fffffff;
+/*
+    The following should work for double but generates the wrong index.
+    For now the code above converts double to ieee extended to compute
+    the index back to double for the h value. 
+    
+      index = 0x3fe - (tix >> 20);
+      hix = (tix + (0x2000 << index)) & (0xffffc000 << index);
+      x = fabsl (x);
+      switch (index)
+	{
+	case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break;
+	case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break;
+	default:
+	case 2: index = (hix - 0x3fc30000) >> 14; break;
+	}
+*/
+      SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+      if (iy)
+	l = y - (h - x);
+      else
+	l = x - h;
+      z = l * l;
+      sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5)))));
+      cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5))));
+      z = __sincosl_table [index + SINCOSL_SIN_HI]
+	  + (__sincosl_table [index + SINCOSL_SIN_LO]
+	     + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1)
+	     + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l));
+      return (ix < 0) ? -z : z;
+    }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
new file mode 100644
index 0000000000..6c45b2fc45
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -0,0 +1,164 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+  Long double expansions are
+  Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+  and are incorporated herein by permission of the author.  The author
+  reserves the right to distribute this material elsewhere under different
+  copying permissions.  These modifications are distributed here under
+  the following terms:
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* __kernel_tanl( x, y, k )
+ * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
+ * Input x is assumed to be bounded by ~pi/4 in magnitude.
+ * Input y is the tail of x.
+ * Input k indicates whether tan (if k=1) or
+ * -1/tan (if k= -1) is returned.
+ *
+ * Algorithm
+ *	1. Since tan(-x) = -tan(x), we need only to consider positive x.
+ *	2. if x < 2^-57, return x with inexact if x!=0.
+ *	3. tan(x) is approximated by a rational form x + x^3 / 3 + x^5 R(x^2)
+ *          on [0,0.67433].
+ *
+ *	   Note: tan(x+y) = tan(x) + tan'(x)*y
+ *		          ~ tan(x) + (1+x*x)*y
+ *	   Therefore, for better accuracy in computing tan(x+y), let
+ *		r = x^3 * R(x^2)
+ *	   then
+ *		tan(x+y) = x + (x^3 / 3 + (x^2 *(r+y)+y))
+ *
+ *      4. For x in [0.67433,pi/4],  let y = pi/4 - x, then
+ *		tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))
+ *		       = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
+ */
+
+#include "math.h"
+#include "math_private.h"
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+  one = 1.0L,
+  pio4hi = 7.8539816339744830961566084581987569936977E-1L,
+  pio4lo = 2.1679525325309452561992610065108379921906E-35L,
+
+  /* tan x = x + x^3 / 3 + x^5 T(x^2)/U(x^2)
+     0 <= x <= 0.6743316650390625
+     Peak relative error 8.0e-36  */
+ TH =  3.333333333333333333333333333333333333333E-1L,
+ T0 = -1.813014711743583437742363284336855889393E7L,
+ T1 =  1.320767960008972224312740075083259247618E6L,
+ T2 = -2.626775478255838182468651821863299023956E4L,
+ T3 =  1.764573356488504935415411383687150199315E2L,
+ T4 = -3.333267763822178690794678978979803526092E-1L,
+
+ U0 = -1.359761033807687578306772463253710042010E8L,
+ U1 =  6.494370630656893175666729313065113194784E7L,
+ U2 = -4.180787672237927475505536849168729386782E6L,
+ U3 =  8.031643765106170040139966622980914621521E4L,
+ U4 = -5.323131271912475695157127875560667378597E2L;
+  /* 1.000000000000000000000000000000000000000E0 */
+
+
+#ifdef __STDC__
+long double
+__kernel_tanl (long double x, long double y, int iy)
+#else
+long double
+__kernel_tanl (x, y, iy)
+     long double x, y;
+     int iy;
+#endif
+{
+  long double z, r, v, w, s;
+  int32_t ix, sign;
+  ieee854_long_double_shape_type u, u1;
+
+  u.value = x;
+  ix = u.parts32.w0 & 0x7fffffff;
+  if (ix < 0x3c600000)		/* x < 2**-57 */
+    {
+      if ((int) x == 0)
+	{			/* generate inexact */
+	  if ((ix | u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3
+	       | (iy + 1)) == 0)
+	    return one / fabs (x);
+	  else
+	    return (iy == 1) ? x : -one / x;
+	}
+    }
+  if (ix >= 0x3fe59420) /* |x| >= 0.6743316650390625 */
+    {
+      if ((u.parts32.w0 & 0x80000000) != 0)
+	{
+	  x = -x;
+	  y = -y;
+	  sign = -1;
+	}
+      else
+	sign = 1;
+      z = pio4hi - x;
+      w = pio4lo - y;
+      x = z + w;
+      y = 0.0;
+    }
+  z = x * x;
+  r = T0 + z * (T1 + z * (T2 + z * (T3 + z * T4)));
+  v = U0 + z * (U1 + z * (U2 + z * (U3 + z * (U4 + z))));
+  r = r / v;
+
+  s = z * x;
+  r = y + z * (s * r + y);
+  r += TH * s;
+  w = x + r;
+  if (ix >= 0x3fe59420)
+    {
+      v = (long double) iy;
+      w = (v - 2.0 * (x - (w * w / (w + v) - r)));
+      if (sign < 0)
+	w = -w;
+      return w;
+    }
+  if (iy == 1)
+    return w;
+  else
+    {				/* if allow error up to 2 ulp,
+				   simply return -1.0/(x+r) here */
+      /*  compute -1.0/(x+r) accurately */
+      u1.value = w;
+      u1.parts32.w2 = 0;
+      u1.parts32.w3 = 0;
+      v = r - (u1.value - x);		/* u1+v = r+x */
+      z = -1.0 / w;
+      u.value = z;
+      u.parts32.w2 = 0;
+      u.parts32.w3 = 0;
+      s = 1.0 + u.value * u1.value;
+      return u.value + z * (s + u.value * v);
+    }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
new file mode 100644
index 0000000000..18a2e671ad
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
@@ -0,0 +1,175 @@
+/* Copyright (C) 1995,1996,1997,1998,1999,2002,2003,2006
+	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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+#include <ieee754.h>
+#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+
+/* Convert a `long double' in IBM extended format to a multi-precision
+   integer representing the significand scaled up by its number of
+   bits (106 for long double) and an integral power of two (MPN
+   frexpl). */
+
+mp_size_t
+__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
+			   int *expt, int *is_neg,
+			   long double value)
+{
+  union ibm_extended_long_double u;
+  unsigned long long hi, lo;
+  int ediff;
+  u.d = value;
+
+  *is_neg = u.ieee.negative;
+  *expt = (int) u.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+  lo = ((long long) u.ieee.mantissa2 << 32) | u.ieee.mantissa3;
+  hi = ((long long) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
+  /* If the lower double is not a denomal or zero then set the hidden
+     53rd bit.  */
+  if (u.ieee.exponent2 > 0)
+    {
+      lo |= 1LL << 52;
+
+      /* The lower double is normalized separately from the upper.  We may
+	 need to adjust the lower manitissa to reflect this.  */
+      ediff = u.ieee.exponent - u.ieee.exponent2;
+      if (ediff > 53)
+	lo = lo >> (ediff-53);
+    }
+  /* The high double may be rounded and the low double reflects the
+     difference between the long double and the rounded high double
+     value.  This is indicated by a differnce between the signs of the
+     high and low doubles.  */
+  if ((u.ieee.negative != u.ieee.negative2)
+      && ((u.ieee.exponent2 != 0) && (lo != 0L)))
+    {
+      lo = (1ULL << 53) - lo;
+      if (hi == 0LL)
+	{
+	  /* we have a borrow from the hidden bit, so shift left 1.  */
+	  hi = 0x0ffffffffffffeLL | (lo >> 51);
+	  lo = 0x1fffffffffffffLL & (lo << 1);
+	  (*expt)--;
+	}
+      else
+	hi--;
+    }
+#if BITS_PER_MP_LIMB == 32
+  /* Combine the mantissas to be contiguous.  */
+  res_ptr[0] = lo;
+  res_ptr[1] = (hi << (53 - 32)) | (lo >> 32);
+  res_ptr[2] = hi >> 11;
+  res_ptr[3] = hi >> (32 + 11);
+  #define N 4
+#elif BITS_PER_MP_LIMB == 64
+  /* Combine the two mantissas to be contiguous.  */
+  res_ptr[0] = (hi << 53) | lo;
+  res_ptr[1] = hi >> 11;
+  #define N 2
+#else
+  #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+/* The format does not fill the last limb.  There are some zeros.  */
+#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
+			   - (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))
+
+  if (u.ieee.exponent == 0)
+    {
+      /* A biased exponent of zero is a special case.
+	 Either it is a zero or it is a denormal number.  */
+      if (res_ptr[0] == 0 && res_ptr[1] == 0
+	  && res_ptr[N - 2] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=4.  */
+	/* It's zero.  */
+	*expt = 0;
+      else
+	{
+	  /* It is a denormal number, meaning it has no implicit leading
+  	     one bit, and its exponent is in fact the format minimum.  */
+	  int cnt;
+
+#if N == 2
+	  if (res_ptr[N - 1] != 0)
+	    {
+	      count_leading_zeros (cnt, res_ptr[N - 1]);
+	      cnt -= NUM_LEADING_ZEROS;
+	      res_ptr[N - 1] = res_ptr[N - 1] << cnt
+			       | (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
+	      res_ptr[0] <<= cnt;
+	      *expt = LDBL_MIN_EXP - 1 - cnt;
+	    }
+	  else
+	    {
+	      count_leading_zeros (cnt, res_ptr[0]);
+	      if (cnt >= NUM_LEADING_ZEROS)
+		{
+		  res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS);
+		  res_ptr[0] = 0;
+		}
+	      else
+		{
+		  res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt);
+		  res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt);
+		}
+	      *expt = LDBL_MIN_EXP - 1
+		- (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt;
+	    }
+#else
+	  int j, k, l;
+
+	  for (j = N - 1; j > 0; j--)
+	    if (res_ptr[j] != 0)
+	      break;
+
+	  count_leading_zeros (cnt, res_ptr[j]);
+	  cnt -= NUM_LEADING_ZEROS;
+	  l = N - 1 - j;
+	  if (cnt < 0)
+	    {
+	      cnt += BITS_PER_MP_LIMB;
+	      l--;
+	    }
+	  if (!cnt)
+	    for (k = N - 1; k >= l; k--)
+	      res_ptr[k] = res_ptr[k-l];
+	  else
+	    {
+	      for (k = N - 1; k > l; k--)
+		res_ptr[k] = res_ptr[k-l] << cnt
+			     | res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt);
+	      res_ptr[k--] = res_ptr[0] << cnt;
+	    }
+
+	  for (; k >= 0; k--)
+	    res_ptr[k] = 0;
+	  *expt = LDBL_MIN_EXP - 1 - l * BITS_PER_MP_LIMB - cnt;
+#endif
+	}
+    }
+  else
+    /* Add the implicit leading one bit for a normalized number.  */
+    res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1
+					- ((N - 1) * BITS_PER_MP_LIMB));
+
+  return N;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
new file mode 100644
index 0000000000..d055d6597e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
@@ -0,0 +1,181 @@
+#ifndef _MATH_PRIVATE_H_
+#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
+#endif
+
+#include <sysdeps/ieee754/ldbl-128/math_ldbl.h>
+#include <ieee754.h>
+  
+static inline void
+ldbl_extract_mantissa (int64_t *hi64, u_int64_t *lo64, int *exp, long double x)
+{
+  /* We have 105 bits of mantissa plus one implicit digit.  Since
+     106 bits are representable we use the first implicit digit for
+     the number before the decimal point and the second implicit bit
+     as bit 53 of the mantissa.  */
+  unsigned long long hi, lo;
+  int ediff;
+  union ibm_extended_long_double eldbl;
+  eldbl.d = x;
+  *exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+  lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
+  hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
+  /* If the lower double is not a denomal or zero then set the hidden
+     53rd bit.  */
+  if (eldbl.ieee.exponent2 > 0x001)
+    {
+      lo |= (1ULL << 52);
+      lo = lo << 7; /* pre-shift lo to match ieee854.  */
+      /* The lower double is normalized separately from the upper.  We
+	 may need to adjust the lower manitissa to reflect this.  */
+      ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
+      if (ediff > 53)
+	lo = lo >> (ediff-53);
+    }
+  hi |= (1ULL << 52);
+  
+  if ((eldbl.ieee.negative != eldbl.ieee.negative2)
+      && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
+    {
+      hi--;
+      lo = (1ULL << 60) - lo;
+      if (hi < (1ULL << 52))
+	{
+	  /* we have a borrow from the hidden bit, so shift left 1.  */
+	  hi = (hi << 1) | (lo >> 59);
+	  lo = 0xfffffffffffffffLL & (lo << 1);
+	  *exp = *exp - 1;
+	}
+    }
+  *lo64 = (hi << 60) | lo;
+  *hi64 = hi >> 4;
+}
+
+static inline long double
+ldbl_insert_mantissa (int sign, int exp, int64_t hi64, u_int64_t lo64)
+{
+  union ibm_extended_long_double u;
+  unsigned long hidden2, lzcount;
+  unsigned long long hi, lo;
+
+  u.ieee.negative = sign;
+  u.ieee.negative2 = sign;
+  u.ieee.exponent = exp + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+  u.ieee.exponent2 = exp-53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+  /* Expect 113 bits (112 bits + hidden) right justified in two longs.
+     The low order 53 bits (52 + hidden) go into the lower double */ 
+  lo = (lo64 >> 7)& ((1ULL << 53) - 1);
+  hidden2 = (lo64 >> 59) &  1ULL;
+  /* The high order 53 bits (52 + hidden) go into the upper double */
+  hi = (lo64 >> 60) & ((1ULL << 11) - 1);
+  hi |= (hi64 << 4);
+
+  if (lo != 0LL)
+    {
+      /* hidden2 bit of low double controls rounding of the high double.
+	 If hidden2 is '1' then round up hi and adjust lo (2nd mantissa)
+	 plus change the sign of the low double to compensate.  */
+      if (hidden2)
+	{
+	  hi++;
+	  u.ieee.negative2 = !sign;
+	  lo = (1ULL << 53) - lo;
+	}
+      /* The hidden bit of the lo mantissa is zero so we need to
+	 normalize the it for the low double.  Shift it left until the
+	 hidden bit is '1' then adjust the 2nd exponent accordingly.  */ 
+
+      if (sizeof (lo) == sizeof (long))
+	lzcount = __builtin_clzl (lo);
+      else if ((lo >> 32) != 0)
+	lzcount = __builtin_clzl ((long) (lo >> 32));
+      else
+	lzcount = __builtin_clzl ((long) lo) + 32;
+      lzcount = lzcount - 11;
+      if (lzcount > 0)
+	{
+	  int expnt2 = u.ieee.exponent2 - lzcount;
+	  if (expnt2 >= 1)
+	    {
+	      /* Not denormal.  Normalize and set low exponent.  */
+	      lo = lo << lzcount;
+	      u.ieee.exponent2 = expnt2;
+	    }
+	  else
+	    {
+	      /* Is denormal.  */
+	      lo = lo << (lzcount + expnt2);
+	      u.ieee.exponent2 = 0;
+	    }
+	}
+    }
+  else
+    {
+      u.ieee.negative2 = 0;
+      u.ieee.exponent2 = 0;
+    }
+
+  u.ieee.mantissa3 = lo & ((1ULL << 32) - 1);
+  u.ieee.mantissa2 = (lo >> 32) & ((1ULL << 20) - 1);
+  u.ieee.mantissa1 = hi & ((1ULL << 32) - 1);
+  u.ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1);
+  return u.d;
+}
+  
+/* Handy utility functions to pack/unpack/cononicalize and find the nearbyint
+   of long double implemented as double double.  */
+static inline long double
+ldbl_pack (double a, double aa)
+{
+  union ibm_extended_long_double u;
+  u.dd[0] = a;
+  u.dd[1] = aa;
+  return u.d;
+}
+
+static inline void
+ldbl_unpack (long double l, double *a, double *aa)
+{
+  union ibm_extended_long_double u;
+  u.d = l;
+  *a = u.dd[0];
+  *aa = u.dd[1];
+}
+
+
+/* Convert a finite long double to canonical form.
+   Does not handle +/-Inf properly.  */
+static inline void
+ldbl_canonicalize (double *a, double *aa)
+{
+  double xh, xl;
+
+  xh = *a + *aa;
+  xl = (*a - xh) + *aa;
+  *a = xh;
+  *aa = xl;
+}
+
+/* Simple inline nearbyint (double) function .
+   Only works in the default rounding mode
+   but is useful in long double rounding functions.  */
+static inline double
+ldbl_nearbyint (double a)
+{
+  double two52 = 0x10000000000000LL;
+
+  if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
+    {
+      if (__builtin_expect ((a > 0.0), 1))
+	{
+	  a += two52;
+	  a -= two52;
+	}
+      else if (__builtin_expect ((a < 0.0), 1))
+	{
+	  a = two52 - a;
+	  a = -(a - two52);
+	}
+    }
+  return a;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
new file mode 100644
index 0000000000..21d1e62dab
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
@@ -0,0 +1,152 @@
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2006, 2007
+	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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include <ieee754.h>
+#include <float.h>
+#include <math.h>
+
+/* Convert a multi-precision integer of the needed number of bits (106
+   for long double) and an integral power of two to a `long double' in
+   IBM extended format.  */
+
+long double
+__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign)
+{
+  union ibm_extended_long_double u;
+  unsigned long lzcount;
+  unsigned long long hi, lo;
+  int exponent2;
+
+  u.ieee.negative = sign;
+  u.ieee.negative2 = sign;
+  u.ieee.exponent = expt + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+  u.ieee.exponent2 = 0;
+  exponent2 = expt - 53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+#if BITS_PER_MP_LIMB == 32
+  /* The low order 53 bits (52 + hidden) go into the lower double */
+  lo = frac_ptr[0];
+  lo |= (frac_ptr[1] & ((1LL << (53 - 32)) - 1)) << 32;
+  /* The high order 53 bits (52 + hidden) go into the upper double */
+  hi = (frac_ptr[1] >> (53 - 32)) & ((1 << 11) - 1);
+  hi |= ((unsigned long long) frac_ptr[2]) << 11;
+  hi |= ((unsigned long long) frac_ptr[3]) << (32 + 11);
+#elif BITS_PER_MP_LIMB == 64
+  /* The low order 53 bits (52 + hidden) go into the lower double */
+  lo = frac_ptr[0] & (((mp_limb_t) 1 << 53) - 1);
+  /* The high order 53 bits (52 + hidden) go into the upper double */
+  hi = (frac_ptr[0] >> 53) & (((mp_limb_t) 1 << 11) - 1);
+  hi |= (frac_ptr[1] << 11);
+#else
+  #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+
+  if ((hi & (1LL << 52)) == 0 && (hi | lo) != 0)
+    {
+      /* denormal number  */
+      unsigned long long val = hi ? hi : lo;
+
+      if (sizeof (val) == sizeof (long))
+	lzcount = __builtin_clzl (val);
+      else if ((val >> 32) != 0)
+	lzcount = __builtin_clzl ((long) (val >> 32));
+      else
+	lzcount = __builtin_clzl ((long) val) + 32;
+      if (hi)
+	lzcount = lzcount - 11;
+      else
+	lzcount = lzcount + 42;
+
+      if (lzcount > u.ieee.exponent)
+	{
+	  lzcount = u.ieee.exponent;
+	  u.ieee.exponent = 0;
+	  exponent2 -= lzcount;
+	}
+      else
+	{
+	  u.ieee.exponent -= (lzcount - 1);
+	  exponent2 -= (lzcount - 1);
+	}
+
+      if (lzcount <= 53)
+	{
+	  hi = (hi << lzcount) | (lo >> (53 - lzcount));
+	  lo = (lo << lzcount) & ((1LL << 53) - 1);
+	}
+      else
+	{
+	  hi = lo << (lzcount - 53);
+	  lo = 0;
+	}
+    }
+
+  if (lo != 0L)
+    {
+      /* hidden2 bit of low double controls rounding of the high double.
+	 If hidden2 is '1' and either the explicit mantissa is non-zero
+	 or hi is odd, then round up hi and adjust lo (2nd mantissa)
+	 plus change the sign of the low double to compensate.  */
+      if ((lo & (1LL << 52)) != 0
+	  && ((hi & 1) != 0 || (lo & ((1LL << 52) - 1))))
+	{
+	  hi++;
+	  if ((hi & ((1LL << 52) - 1)) == 0)
+	    {
+	      if ((hi & (1LL << 53)) != 0)
+		hi -= 1LL << 52;
+	      u.ieee.exponent++;
+	    }
+	  u.ieee.negative2 = !sign;
+	  lo = (1LL << 53) - lo;
+	}
+
+      /* The hidden bit of the lo mantissa is zero so we need to normalize
+	 it for the low double.  Shift it left until the hidden bit is '1'
+	 then adjust the 2nd exponent accordingly.  */
+
+      if (sizeof (lo) == sizeof (long))
+	lzcount = __builtin_clzl (lo);
+      else if ((lo >> 32) != 0)
+	lzcount = __builtin_clzl ((long) (lo >> 32));
+      else
+	lzcount = __builtin_clzl ((long) lo) + 32;
+      lzcount = lzcount - 11;
+      if (lzcount > 0)
+	{
+	  lo = lo << lzcount;
+	  exponent2 = exponent2 - lzcount;
+	}
+      if (exponent2 > 0)
+	u.ieee.exponent2 = exponent2;
+      else
+	lo >>= 1 - exponent2;
+    }
+  else
+    u.ieee.negative2 = 0;
+
+  u.ieee.mantissa3 = lo & 0xffffffffLL;
+  u.ieee.mantissa2 = (lo >> 32) & 0xfffff;
+  u.ieee.mantissa1 = hi & 0xffffffffLL;
+  u.ieee.mantissa0 = (hi >> 32) & ((1LL << (LDBL_MANT_DIG - 86)) - 1);
+
+  return u.d;
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
new file mode 100644
index 0000000000..b2ad25e31f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
@@ -0,0 +1,141 @@
+/* Print floating point number in hexadecimal notation according to ISO C99.
+   Copyright (C) 1997,1998,1999,2000,2001,2002,2004,2006,2007
+	Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define PRINT_FPHEX_LONG_DOUBLE \
+do {									      \
+      /* We have 105 bits of mantissa plus one implicit digit.  Since	      \
+	 106 bits are representable without rest using hexadecimal	      \
+	 digits we use only the implicit digits for the number before	      \
+	 the decimal point.  */						      \
+      unsigned long long int num0, num1;				      \
+      unsigned long long hi, lo;					      \
+      int ediff;							      \
+      union ibm_extended_long_double eldbl;				      \
+      eldbl.d = fpnum.ldbl.d;						      \
+									      \
+      assert (sizeof (long double) == 16);				      \
+									      \
+      lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;    \
+      hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;    \
+      lo <<= 7; /* pre-shift lo to match ieee854.  */			      \
+      /* If the lower double is not a denomal or zero then set the hidden     \
+	 53rd bit.  */							      \
+      if (eldbl.ieee.exponent2 != 0)					      \
+	lo |= (1ULL << (52 + 7));					      \
+      else								      \
+	lo <<= 1;							      \
+      /* The lower double is normalized separately from the upper.  We	      \
+	 may need to adjust the lower manitissa to reflect this.  */	      \
+      ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;		      \
+      if (ediff > 53 + 63)						      \
+	lo = 0;								      \
+      else if (ediff > 53)						      \
+	lo = lo >> (ediff - 53);					      \
+      else if (eldbl.ieee.exponent2 == 0 && ediff < 53)			      \
+	lo = lo << (53 - ediff);					      \
+      if (eldbl.ieee.negative != eldbl.ieee.negative2			      \
+	  && (eldbl.ieee.exponent2 != 0 || lo != 0L))			      \
+	{								      \
+	  lo = (1ULL << 60) - lo;					      \
+	  if (hi == 0L)							      \
+	    {								      \
+	      /* we have a borrow from the hidden bit, so shift left 1.  */   \
+	      hi = 0xffffffffffffeLL | (lo >> 59);			      \
+	      lo = 0xfffffffffffffffLL & (lo << 1);			      \
+	      eldbl.ieee.exponent--;					      \
+	    }								      \
+	  else								      \
+	    hi--;							      \
+        }								      \
+      num1 = (hi << 60) | lo;						      \
+      num0 = hi >> 4;							      \
+									      \
+      zero_mantissa = (num0|num1) == 0;					      \
+									      \
+      if (sizeof (unsigned long int) > 6)				      \
+	{								      \
+	  numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16,	      \
+			       info->spec == 'A');			      \
+	  wnumstr = _itowa_word (num1,					      \
+				 wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),\
+				 16, info->spec == 'A');		      \
+	}								      \
+      else								      \
+	{								      \
+	  numstr = _itoa (num1, numbuf + sizeof numbuf, 16,		      \
+			  info->spec == 'A');				      \
+	  wnumstr = _itowa (num1,					      \
+			    wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),    \
+			    16, info->spec == 'A');			      \
+	}								      \
+									      \
+      while (numstr > numbuf + (sizeof numbuf - 64 / 4))		      \
+	{								      \
+	  *--numstr = '0';						      \
+	  *--wnumstr = L'0';						      \
+	}								      \
+									      \
+      if (sizeof (unsigned long int) > 6)				      \
+	{								      \
+	  numstr = _itoa_word (num0, numstr, 16, info->spec == 'A');	      \
+	  wnumstr = _itowa_word (num0, wnumstr, 16, info->spec == 'A');	      \
+	}								      \
+      else								      \
+	{								      \
+	  numstr = _itoa (num0, numstr, 16, info->spec == 'A');		      \
+	  wnumstr = _itowa (num0, wnumstr, 16, info->spec == 'A');	      \
+	}								      \
+									      \
+      /* Fill with zeroes.  */						      \
+      while (numstr > numbuf + (sizeof numbuf - 112 / 4))		      \
+	{								      \
+	  *--numstr = '0';						      \
+	  *--wnumstr = L'0';						      \
+	}								      \
+									      \
+      leading = eldbl.ieee.exponent == 0 ? '0' : '1';			      \
+									      \
+      exponent = eldbl.ieee.exponent;					      \
+									      \
+      if (exponent == 0)						      \
+	{								      \
+	  if (zero_mantissa)						      \
+	    expnegative = 0;						      \
+	  else								      \
+	    {								      \
+	      /* This is a denormalized number.  */			      \
+	      expnegative = 1;						      \
+	      exponent = IBM_EXTENDED_LONG_DOUBLE_BIAS - 1;		      \
+	    }								      \
+	}								      \
+      else if (exponent >= IBM_EXTENDED_LONG_DOUBLE_BIAS)		      \
+	{								      \
+	  expnegative = 0;						      \
+	  exponent -= IBM_EXTENDED_LONG_DOUBLE_BIAS;			      \
+	}								      \
+      else								      \
+	{								      \
+	  expnegative = 1;						      \
+	  exponent = -(exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS);	      \
+	}								      \
+} while (0)
+
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c b/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
new file mode 100644
index 0000000000..d1b63bb909
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
@@ -0,0 +1,67 @@
+/* @(#)s_asinh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $";
+#endif
+
+/* asinh(x)
+ * Method :
+ *	Based on
+ *		asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
+ *	we have
+ *	asinh(x) := x  if  1+x*x=1,
+ *		 := sign(x)*(log(x)+ln2)) for large |x|, else
+ *		 := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
+ *		 := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+one =  1.00000000000000000000e+00L, /* 0x3ff0000000000000, 0 */
+ln2 =  0.6931471805599453094172321214581766L, /* 0x3fe62e42fefa39ef, 0x3c7abc9e3b398040 */
+huge=  1.00000000000000000000e+300L;
+
+#ifdef __STDC__
+	long double __asinhl(long double x)
+#else
+	long double __asinhl(x)
+	long double x;
+#endif
+{
+	long double t,w;
+	int64_t hx,ix;
+	GET_LDOUBLE_MSW64(hx,x);
+	ix = hx&0x7fffffffffffffffLL;
+	if(ix>=0x7ff0000000000000LL) return x+x;	/* x is inf or NaN */
+	if(ix< 0x3e20000000000000LL) {	/* |x|<2**-29 */
+	    if(huge+x>one) return x;	/* return x inexact except 0 */
+	}
+	if(ix>0x41b0000000000000LL) {	/* |x| > 2**28 */
+	    w = __ieee754_logl(fabs(x))+ln2;
+	} else if (ix>0x4000000000000000LL) {	/* 2**28 > |x| > 2.0 */
+	    t = fabs(x);
+	    w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t));
+	} else {		/* 2.0 > |x| > 2**-29 */
+	    t = x*x;
+	    w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t)));
+	}
+	if(hx>0) return w; else return -w;
+}
+long_double_symbol (libm, __asinhl, asinhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
new file mode 100644
index 0000000000..b6195f10be
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -0,0 +1,234 @@
+/*							s_atanl.c
+ *
+ *	Inverse circular tangent for 128-bit long double precision
+ *      (arctangent)
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, atanl();
+ *
+ * y = atanl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns radian angle between -pi/2 and +pi/2 whose tangent is x.
+ *
+ * The function uses a rational approximation of the form
+ * t + t^3 P(t^2)/Q(t^2), optimized for |t| < 0.09375.
+ *
+ * The argument is reduced using the identity
+ *    arctan x - arctan u  =  arctan ((x-u)/(1 + ux))
+ * and an 83-entry lookup table for arctan u, with u = 0, 1/8, ..., 10.25.
+ * Use of the table improves the execution speed of the routine.
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ *                      Relative error:
+ * arithmetic   domain     # trials      peak         rms
+ *    IEEE      -19, 19       4e5       1.7e-34     5.4e-35
+ *
+ *
+ * WARNING:
+ *
+ * This program uses integer operations on bit fields of floating-point
+ * numbers.  It does not work with data structures other than the
+ * structure assumed.
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* arctan(k/8), k = 0, ..., 82 */
+static const long double atantbl[84] = {
+  0.0000000000000000000000000000000000000000E0L,
+  1.2435499454676143503135484916387102557317E-1L, /* arctan(0.125)  */
+  2.4497866312686415417208248121127581091414E-1L,
+  3.5877067027057222039592006392646049977698E-1L,
+  4.6364760900080611621425623146121440202854E-1L,
+  5.5859931534356243597150821640166127034645E-1L,
+  6.4350110879328438680280922871732263804151E-1L,
+  7.1882999962162450541701415152590465395142E-1L,
+  7.8539816339744830961566084581987572104929E-1L,
+  8.4415398611317100251784414827164750652594E-1L,
+  8.9605538457134395617480071802993782702458E-1L,
+  9.4200004037946366473793717053459358607166E-1L,
+  9.8279372324732906798571061101466601449688E-1L,
+  1.0191413442663497346383429170230636487744E0L,
+  1.0516502125483736674598673120862998296302E0L,
+  1.0808390005411683108871567292171998202703E0L,
+  1.1071487177940905030170654601785370400700E0L,
+  1.1309537439791604464709335155363278047493E0L,
+  1.1525719972156675180401498626127513797495E0L,
+  1.1722738811284763866005949441337046149712E0L,
+  1.1902899496825317329277337748293183376012E0L,
+  1.2068173702852525303955115800565576303133E0L,
+  1.2220253232109896370417417439225704908830E0L,
+  1.2360594894780819419094519711090786987027E0L,
+  1.2490457723982544258299170772810901230778E0L,
+  1.2610933822524404193139408812473357720101E0L,
+  1.2722973952087173412961937498224804940684E0L,
+  1.2827408797442707473628852511364955306249E0L,
+  1.2924966677897852679030914214070816845853E0L,
+  1.3016288340091961438047858503666855921414E0L,
+  1.3101939350475556342564376891719053122733E0L,
+  1.3182420510168370498593302023271362531155E0L,
+  1.3258176636680324650592392104284756311844E0L,
+  1.3329603993374458675538498697331558093700E0L,
+  1.3397056595989995393283037525895557411039E0L,
+  1.3460851583802539310489409282517796256512E0L,
+  1.3521273809209546571891479413898128509842E0L,
+  1.3578579772154994751124898859640585287459E0L,
+  1.3633001003596939542892985278250991189943E0L,
+  1.3684746984165928776366381936948529556191E0L,
+  1.3734007669450158608612719264449611486510E0L,
+  1.3780955681325110444536609641291551522494E0L,
+  1.3825748214901258580599674177685685125566E0L,
+  1.3868528702577214543289381097042486034883E0L,
+  1.3909428270024183486427686943836432060856E0L,
+  1.3948567013423687823948122092044222644895E0L,
+  1.3986055122719575950126700816114282335732E0L,
+  1.4021993871854670105330304794336492676944E0L,
+  1.4056476493802697809521934019958079881002E0L,
+  1.4089588955564736949699075250792569287156E0L,
+  1.4121410646084952153676136718584891599630E0L,
+  1.4152014988178669079462550975833894394929E0L,
+  1.4181469983996314594038603039700989523716E0L,
+  1.4209838702219992566633046424614466661176E0L,
+  1.4237179714064941189018190466107297503086E0L,
+  1.4263547484202526397918060597281265695725E0L,
+  1.4288992721907326964184700745371983590908E0L,
+  1.4313562697035588982240194668401779312122E0L,
+  1.4337301524847089866404719096698873648610E0L,
+  1.4360250423171655234964275337155008780675E0L,
+  1.4382447944982225979614042479354815855386E0L,
+  1.4403930189057632173997301031392126865694E0L,
+  1.4424730991091018200252920599377292525125E0L,
+  1.4444882097316563655148453598508037025938E0L,
+  1.4464413322481351841999668424758804165254E0L,
+  1.4483352693775551917970437843145232637695E0L,
+  1.4501726582147939000905940595923466567576E0L,
+  1.4519559822271314199339700039142990228105E0L,
+  1.4536875822280323362423034480994649820285E0L,
+  1.4553696664279718992423082296859928222270E0L,
+  1.4570043196511885530074841089245667532358E0L,
+  1.4585935117976422128825857356750737658039E0L,
+  1.4601391056210009726721818194296893361233E0L,
+  1.4616428638860188872060496086383008594310E0L,
+  1.4631064559620759326975975316301202111560E0L,
+  1.4645314639038178118428450961503371619177E0L,
+  1.4659193880646627234129855241049975398470E0L,
+  1.4672716522843522691530527207287398276197E0L,
+  1.4685896086876430842559640450619880951144E0L,
+  1.4698745421276027686510391411132998919794E0L,
+  1.4711276743037345918528755717617308518553E0L,
+  1.4723501675822635384916444186631899205983E0L,
+  1.4735431285433308455179928682541563973416E0L, /* arctan(10.25) */
+  1.5707963267948966192313216916397514420986E0L  /* pi/2 */
+};
+
+
+/* arctan t = t + t^3 p(t^2) / q(t^2)
+   |t| <= 0.09375
+   peak relative error 5.3e-37 */
+
+static const long double
+  p0 = -4.283708356338736809269381409828726405572E1L,
+  p1 = -8.636132499244548540964557273544599863825E1L,
+  p2 = -5.713554848244551350855604111031839613216E1L,
+  p3 = -1.371405711877433266573835355036413750118E1L,
+  p4 = -8.638214309119210906997318946650189640184E-1L,
+  q0 = 1.285112506901621042780814422948906537959E2L,
+  q1 = 3.361907253914337187957855834229672347089E2L,
+  q2 = 3.180448303864130128268191635189365331680E2L,
+  q3 = 1.307244136980865800160844625025280344686E2L,
+  q4 = 2.173623741810414221251136181221172551416E1L;
+  /* q5 = 1.000000000000000000000000000000000000000E0 */
+
+
+long double
+__atanl (long double x)
+{
+  int k, sign;
+  long double t, u, p, q;
+  ieee854_long_double_shape_type s;
+
+  s.value = x;
+  k = s.parts32.w0;
+  if (k & 0x80000000)
+    sign = 1;
+  else
+    sign = 0;
+
+  /* Check for IEEE special cases.  */
+  k &= 0x7fffffff;
+  if (k >= 0x7ff00000)
+    {
+      /* NaN. */
+      if ((k & 0xfffff) | s.parts32.w1 )
+	return (x + x);
+
+      /* Infinity. */
+      if (sign)
+	return -atantbl[83];
+      else
+	return atantbl[83];
+    }
+
+  if (sign)
+      x = -x;
+
+  if (k >= 0x40248000) /* 10.25 */
+    {
+      k = 83;
+      t = -1.0/x;
+    }
+  else
+    {
+      /* Index of nearest table element.
+	 Roundoff to integer is asymmetrical to avoid cancellation when t < 0
+         (cf. fdlibm). */
+      k = 8.0 * x + 0.25;
+      u = 0.125 * k;
+      /* Small arctan argument.  */
+      t = (x - u) / (1.0 + x * u);
+    }
+
+  /* Arctan of small argument t.  */
+  u = t * t;
+  p =     ((((p4 * u) + p3) * u + p2) * u + p1) * u + p0;
+  q = ((((u + q4) * u + q3) * u + q2) * u + q1) * u + q0;
+  u = t * u * p / q  +  t;
+
+  /* arctan x = arctan u  +  arctan t */
+  u = atantbl[k] + u;
+  if (sign)
+    return (-u);
+  else
+    return u;
+}
+
+long_double_symbol (libm, __atanl, atanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c
new file mode 100644
index 0000000000..010a671dce
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c
@@ -0,0 +1,6 @@
+/* Looks like we can use ieee854 s_cbrtl.c as is for IBM extended format. */
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cbrtl.c>
+long_double_symbol (libm, __cbrtl, cbrtl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ceill.c b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
new file mode 100644
index 0000000000..035e4f52ce
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
@@ -0,0 +1,91 @@
+/* Ceil (round to +inf) long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__ceill (long double x)
+#else
+long double
+__ceill (x)
+     long double x;
+#endif
+{
+  double xh, xl, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Return Inf, Nan, +/-0 unchanged.  */
+  if (__builtin_expect (xh != 0.0
+			&& __builtin_isless (__builtin_fabs (xh),
+					     __builtin_inf ()), 1))
+    {
+      double orig_xh;
+      int save_round = fegetround ();
+
+      /* Long double arithmetic, including the canonicalisation below,
+	 only works in round-to-nearest mode.  */
+      fesetround (FE_TONEAREST);
+
+      /* Convert the high double to integer.  */
+      orig_xh = xh;
+      hi = ldbl_nearbyint (xh);
+
+      /* Subtract integral high part from the value.  */
+      xh -= hi;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Now convert the low double, adjusted for any remainder from the
+         high double.  */
+      lo = ldbl_nearbyint (xh);
+
+      /* Adjust the result when the remainder is non-zero.  nearbyint
+         rounds values to the nearest integer, and values halfway
+         between integers to the nearest even integer.  ceill must
+         round towards +Inf.  */
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+	lo += 1.0;
+
+      /* Ensure the final value is canonical.  In certain cases,
+         rounding causes hi,lo calculated so far to be non-canonical.  */
+      xh = hi;
+      xl = lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Ensure we return -0 rather than +0 when appropriate.  */
+      if (orig_xh < 0.0)
+	xh = -__builtin_fabs (xh);
+
+      fesetround (save_round);
+    }
+
+  return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __ceill, ceill);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c b/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
new file mode 100644
index 0000000000..7e7b44168d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
@@ -0,0 +1,45 @@
+/* s_copysignl.c -- long double version of s_copysign.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * copysignl(long double x, long double y)
+ * copysignl(x,y) returns a value with the magnitude of x and
+ * with the sign bit of y.
+ */
+
+#include "math.h"
+#include "math_private.h"
+
+#ifdef __STDC__
+	long double __copysignl(long double x, long double y)
+#else
+	long double __copysignl(x,y)
+	long double x,y;
+#endif
+{
+  if (y < 0.0)
+    {
+      if (x >= 0.0)
+	x = -x;
+    }
+  else if (x < 0.0)
+    x = -x;
+  return x;
+}
+weak_alias (__copysignl, copysignl)
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cosl.c b/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
new file mode 100644
index 0000000000..59a8196706
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
@@ -0,0 +1,88 @@
+/* s_cosl.c -- long double version of s_cos.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* cosl(x)
+ * Return cosine function of x.
+ *
+ * kernel function:
+ *	__kernel_sinl		... sine function on [-pi/4,pi/4]
+ *	__kernel_cosl		... cosine function on [-pi/4,pi/4]
+ *	__ieee754_rem_pio2l	... argument reduction routine
+ *
+ * Method.
+ *      Let S,C and T denote the sin, cos and tan respectively on
+ *	[-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ *	in [-pi/4 , +pi/4], and let n = k mod 4.
+ *	We have
+ *
+ *          n        sin(x)      cos(x)        tan(x)
+ *     ----------------------------------------------------------
+ *	    0	       S	   C		 T
+ *	    1	       C	  -S		-1/T
+ *	    2	      -S	  -C		 T
+ *	    3	      -C	   S		-1/T
+ *     ----------------------------------------------------------
+ *
+ * Special cases:
+ *      Let trig be any of sin, cos, or tan.
+ *      trig(+-INF)  is NaN, with signals;
+ *      trig(NaN)    is that NaN;
+ *
+ * Accuracy:
+ *	TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+	long double __cosl(long double x)
+#else
+	long double __cosl(x)
+	long double x;
+#endif
+{
+	long double y[2],z=0.0L;
+	int64_t n, ix;
+
+    /* High word of x. */
+	GET_LDOUBLE_MSW64(ix,x);
+
+    /* |x| ~< pi/4 */
+	ix &= 0x7fffffffffffffffLL;
+	if(ix <= 0x3fe921fb54442d18LL)
+	  return __kernel_cosl(x,z);
+
+    /* cos(Inf or NaN) is NaN */
+	else if (ix>=0x7ff0000000000000LL)
+	    return x-x;
+
+    /* argument reduction needed */
+	else {
+	    n = __ieee754_rem_pio2l(x,y);
+	    switch(n&3) {
+		case 0:
+		    return  __kernel_cosl(y[0],y[1]);
+		case 1:
+		    return -__kernel_sinl(y[0],y[1],1);
+		case 2:
+		    return -__kernel_cosl(y[0],y[1]);
+		default:
+		    return  __kernel_sinl(y[0],y[1],1);
+	    }
+	}
+}
+long_double_symbol (libm, __cosl, cosl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c b/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c
new file mode 100644
index 0000000000..2167db3d91
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c
@@ -0,0 +1,54 @@
+/* Compute projection of complex long double value to Riemann sphere.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+__complex__ long double
+__cprojl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (isnan (__real__ x) && isnan (__imag__ x))
+    return x;
+  else if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      __real__ res = INFINITY;
+      __imag__ res = __copysignl (0.0, __imag__ x);
+    }
+  else
+    {
+      long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x
+			 + 1.0);
+
+      __real__ res = (2.0 * __real__ x) / den;
+      __imag__ res = (2.0 * __imag__ x) / den;
+      /* __gcc_qmul does not respect -0.0 so we need the following fixup.  */
+       if (__real__ x == 0.0)
+         __real__ res = __real__ x;
+
+       if (__imag__ x == 0.0)
+         __imag__ res = __imag__ x;
+    }
+
+  return res;
+}
+long_double_symbol (libm, __cprojl, cprojl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c b/sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c
new file mode 100644
index 0000000000..7d619039ca
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c
@@ -0,0 +1,87 @@
+/* Complex hyperbole tangent for long double.  IBM extended format version.
+   Copyright (C) 1997,2005,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanhl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinfl (__real__ x))
+	{
+	  __real__ res = __copysignl (1.0, __real__ x);
+	  __imag__ res = __copysignl (0.0, __imag__ x);
+	}
+      else if (__imag__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+	  if (__isinfl (__imag__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      long double sin2ix, cos2ix;
+      long double den;
+
+      __sincosl (2.0 * __imag__ x, &sin2ix, &cos2ix);
+
+      den = (__ieee754_coshl (2.0 * __real__ x) + cos2ix);
+
+      if (den == 0.0L)
+	{
+	  __complex__ long double ez = __cexpl (x);
+	  __complex__ long double emz = __cexpl (-x);
+
+	  res = (ez - emz) / (ez + emz);
+	}
+      else
+	{
+	  __real__ res = __ieee754_sinhl (2.0 * __real__ x) / den;
+	  __imag__ res = sin2ix / den;
+	}
+      /* __gcc_qmul does not respect -0.0 so we need the following fixup.  */
+      if ((__real__ res == 0.0) && (__real__ x == 0.0))
+        __real__ res = __real__ x;
+
+      if ((__real__ res == 0.0) && (__imag__ x == 0.0))
+        __imag__ res = __imag__ x;
+    }
+
+  return res;
+}
+long_double_symbol (libm, __ctanhl, ctanhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ctanl.c b/sysdeps/ieee754/ldbl-128ibm/s_ctanl.c
new file mode 100644
index 0000000000..00d2aa6b6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ctanl.c
@@ -0,0 +1,88 @@
+/* Complex tangent function for long double.  IBM extended format version.
+   Copyright (C) 1997,2005,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+#include "math_private.h"
+
+
+__complex__ long double
+__ctanl (__complex__ long double x)
+{
+  __complex__ long double res;
+
+  if (!isfinite (__real__ x) || !isfinite (__imag__ x))
+    {
+      if (__isinfl (__imag__ x))
+	{
+	  __real__ res = __copysignl (0.0, __real__ x);
+	  __imag__ res = __copysignl (1.0, __imag__ x);
+	}
+      else if (__real__ x == 0.0)
+	{
+	  res = x;
+	}
+      else
+	{
+	  __real__ res = __nanl ("");
+	  __imag__ res = __nanl ("");
+
+#ifdef FE_INVALID
+	  if (__isinfl (__real__ x))
+	    feraiseexcept (FE_INVALID);
+#endif
+	}
+    }
+  else
+    {
+      long double sin2rx, cos2rx;
+      long double den;
+
+      __sincosl (2.0 * __real__ x, &sin2rx, &cos2rx);
+
+      den = cos2rx + __ieee754_coshl (2.0 * __imag__ x);
+
+
+      if (den == 0.0)
+	{
+	  __complex__ long double ez = __cexpl (1.0i * x);
+	  __complex__ long double emz = __cexpl (-1.0i * x);
+
+	  res = (ez - emz) / (ez + emz) * -1.0i;
+	}
+      else
+	{
+	  __real__ res = sin2rx / den;
+	  __imag__ res = __ieee754_sinhl (2.0 * __imag__ x) / den;
+	}
+      /* __gcc_qmul does not respect -0.0 so we need the following fixup.  */
+      if ((__real__ res == 0.0) && (__real__ x == 0.0))
+        __real__ res = __real__ x;
+
+      if ((__real__ res == 0.0) && (__imag__ x == 0.0))
+        __imag__ res = __imag__ x;
+    }
+
+  return res;
+}
+long_double_symbol (libm, __ctanl, ctanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
new file mode 100644
index 0000000000..02b450efce
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
@@ -0,0 +1,958 @@
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* Modifications and expansions for 128-bit long double are
+   Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+   and are incorporated herein by permission of the author.  The author
+   reserves the right to distribute this material elsewhere under different
+   copying permissions.  These modifications are distributed here under
+   the following terms:
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+/* double erf(double x)
+ * double erfc(double x)
+ *			     x
+ *		      2      |\
+ *     erf(x)  =  ---------  | exp(-t*t)dt
+ *		   sqrt(pi) \|
+ *			     0
+ *
+ *     erfc(x) =  1-erf(x)
+ *  Note that
+ *		erf(-x) = -erf(x)
+ *		erfc(-x) = 2 - erfc(x)
+ *
+ * Method:
+ *	1.  erf(x)  = x + x*R(x^2) for |x| in [0, 7/8]
+ *	   Remark. The formula is derived by noting
+ *          erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)
+ *	   and that
+ *          2/sqrt(pi) = 1.128379167095512573896158903121545171688
+ *	   is close to one.
+ *
+ *      1a. erf(x)  = 1 - erfc(x), for |x| > 1.0
+ *          erfc(x) = 1 - erf(x)  if |x| < 1/4
+ *
+ *      2. For |x| in [7/8, 1], let s = |x| - 1, and
+ *         c = 0.84506291151 rounded to single (24 bits)
+ *	erf(s + c)  = sign(x) * (c  + P1(s)/Q1(s))
+ *	   Remark: here we use the taylor series expansion at x=1.
+ *		erf(1+s) = erf(1) + s*Poly(s)
+ *			 = 0.845.. + P1(s)/Q1(s)
+ *	   Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]
+ *
+ *      3. For x in [1/4, 5/4],
+ *	erfc(s + const)  = erfc(const)  + s P1(s)/Q1(s)
+ *              for const = 1/4, 3/8, ..., 9/8
+ *              and 0 <= s <= 1/8 .
+ *
+ *      4. For x in [5/4, 107],
+ *	erfc(x) = (1/x)*exp(-x*x-0.5625 + R(z))
+ *              z=1/x^2
+ *         The interval is partitioned into several segments
+ *         of width 1/8 in 1/x.
+ *
+ *      Note1:
+ *	   To compute exp(-x*x-0.5625+R/S), let s be a single
+ *	   precision number and s := x; then
+ *		-x*x = -s*s + (s-x)*(s+x)
+ *	        exp(-x*x-0.5626+R/S) =
+ *			exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);
+ *      Note2:
+ *	   Here 4 and 5 make use of the asymptotic series
+ *			  exp(-x*x)
+ *		erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )
+ *			  x*sqrt(pi)
+ *
+ *      5. For inf > x >= 107
+ *	erf(x)  = sign(x) *(1 - tiny)  (raise inexact)
+ *	erfc(x) = tiny*tiny (raise underflow) if x > 0
+ *			= 2 - tiny if x<0
+ *
+ *      7. Special case:
+ *	erf(0)  = 0, erf(inf)  = 1, erf(-inf) = -1,
+ *	erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2,
+ *		erfc/erf(NaN) is NaN
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* Evaluate P[n] x^n  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static long double
+neval (long double x, const long double *p, int n)
+{
+  long double y;
+
+  p += n;
+  y = *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+/* Evaluate x^n+1  +  P[n] x^(n)  +  P[n-1] x^(n-1)  +  ...  +  P[0] */
+
+static long double
+deval (long double x, const long double *p, int n)
+{
+  long double y;
+
+  p += n;
+  y = x + *p--;
+  do
+    {
+      y = y * x + *p--;
+    }
+  while (--n > 0);
+  return y;
+}
+
+
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+tiny = 1e-300L,
+  half = 0.5L,
+  one = 1.0L,
+  two = 2.0L,
+  /* 2/sqrt(pi) - 1 */
+  efx = 1.2837916709551257389615890312154517168810E-1L,
+  /* 8 * (2/sqrt(pi) - 1) */
+  efx8 = 1.0270333367641005911692712249723613735048E0L;
+
+
+/* erf(x)  = x  + x R(x^2)
+   0 <= x <= 7/8
+   Peak relative error 1.8e-35  */
+#define NTN1 8
+static const long double TN1[NTN1 + 1] =
+{
+ -3.858252324254637124543172907442106422373E10L,
+  9.580319248590464682316366876952214879858E10L,
+  1.302170519734879977595901236693040544854E10L,
+  2.922956950426397417800321486727032845006E9L,
+  1.764317520783319397868923218385468729799E8L,
+  1.573436014601118630105796794840834145120E7L,
+  4.028077380105721388745632295157816229289E5L,
+  1.644056806467289066852135096352853491530E4L,
+  3.390868480059991640235675479463287886081E1L
+};
+#define NTD1 8
+static const long double TD1[NTD1 + 1] =
+{
+  -3.005357030696532927149885530689529032152E11L,
+  -1.342602283126282827411658673839982164042E11L,
+  -2.777153893355340961288511024443668743399E10L,
+  -3.483826391033531996955620074072768276974E9L,
+  -2.906321047071299585682722511260895227921E8L,
+  -1.653347985722154162439387878512427542691E7L,
+  -6.245520581562848778466500301865173123136E5L,
+  -1.402124304177498828590239373389110545142E4L,
+  -1.209368072473510674493129989468348633579E2L
+/* 1.0E0 */
+};
+
+
+/* erf(z+1)  = erf_const + P(z)/Q(z)
+   -.125 <= z <= 0
+   Peak relative error 7.3e-36  */
+static const long double erf_const = 0.845062911510467529296875L;
+#define NTN2 8
+static const long double TN2[NTN2 + 1] =
+{
+ -4.088889697077485301010486931817357000235E1L,
+  7.157046430681808553842307502826960051036E3L,
+ -2.191561912574409865550015485451373731780E3L,
+  2.180174916555316874988981177654057337219E3L,
+  2.848578658049670668231333682379720943455E2L,
+  1.630362490952512836762810462174798925274E2L,
+  6.317712353961866974143739396865293596895E0L,
+  2.450441034183492434655586496522857578066E1L,
+  5.127662277706787664956025545897050896203E-1L
+};
+#define NTD2 8
+static const long double TD2[NTD2 + 1] =
+{
+  1.731026445926834008273768924015161048885E4L,
+  1.209682239007990370796112604286048173750E4L,
+  1.160950290217993641320602282462976163857E4L,
+  5.394294645127126577825507169061355698157E3L,
+  2.791239340533632669442158497532521776093E3L,
+  8.989365571337319032943005387378993827684E2L,
+  2.974016493766349409725385710897298069677E2L,
+  6.148192754590376378740261072533527271947E1L,
+  1.178502892490738445655468927408440847480E1L
+ /* 1.0E0 */
+};
+
+
+/* erfc(x + 0.25) = erfc(0.25) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 1.4e-35  */
+#define NRNr13 8
+static const long double RNr13[NRNr13 + 1] =
+{
+ -2.353707097641280550282633036456457014829E3L,
+  3.871159656228743599994116143079870279866E2L,
+ -3.888105134258266192210485617504098426679E2L,
+ -2.129998539120061668038806696199343094971E1L,
+ -8.125462263594034672468446317145384108734E1L,
+  8.151549093983505810118308635926270319660E0L,
+ -5.033362032729207310462422357772568553670E0L,
+ -4.253956621135136090295893547735851168471E-2L,
+ -8.098602878463854789780108161581050357814E-2L
+};
+#define NRDr13 7
+static const long double RDr13[NRDr13 + 1] =
+{
+  2.220448796306693503549505450626652881752E3L,
+  1.899133258779578688791041599040951431383E2L,
+  1.061906712284961110196427571557149268454E3L,
+  7.497086072306967965180978101974566760042E1L,
+  2.146796115662672795876463568170441327274E2L,
+  1.120156008362573736664338015952284925592E1L,
+  2.211014952075052616409845051695042741074E1L,
+  6.469655675326150785692908453094054988938E-1L
+ /* 1.0E0 */
+};
+/* erfc(0.25) = C13a + C13b to extra precision.  */
+static const long double C13a = 0.723663330078125L;
+static const long double C13b = 1.0279753638067014931732235184287934646022E-5L;
+
+
+/* erfc(x + 0.375) = erfc(0.375) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 1.2e-35  */
+#define NRNr14 8
+static const long double RNr14[NRNr14 + 1] =
+{
+ -2.446164016404426277577283038988918202456E3L,
+  6.718753324496563913392217011618096698140E2L,
+ -4.581631138049836157425391886957389240794E2L,
+ -2.382844088987092233033215402335026078208E1L,
+ -7.119237852400600507927038680970936336458E1L,
+  1.313609646108420136332418282286454287146E1L,
+ -6.188608702082264389155862490056401365834E0L,
+ -2.787116601106678287277373011101132659279E-2L,
+ -2.230395570574153963203348263549700967918E-2L
+};
+#define NRDr14 7
+static const long double RDr14[NRDr14 + 1] =
+{
+  2.495187439241869732696223349840963702875E3L,
+  2.503549449872925580011284635695738412162E2L,
+  1.159033560988895481698051531263861842461E3L,
+  9.493751466542304491261487998684383688622E1L,
+  2.276214929562354328261422263078480321204E2L,
+  1.367697521219069280358984081407807931847E1L,
+  2.276988395995528495055594829206582732682E1L,
+  7.647745753648996559837591812375456641163E-1L
+ /* 1.0E0 */
+};
+/* erfc(0.375) = C14a + C14b to extra precision.  */
+static const long double C14a = 0.5958709716796875L;
+static const long double C14b = 1.2118885490201676174914080878232469565953E-5L;
+
+/* erfc(x + 0.5) = erfc(0.5) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 4.7e-36  */
+#define NRNr15 8
+static const long double RNr15[NRNr15 + 1] =
+{
+ -2.624212418011181487924855581955853461925E3L,
+  8.473828904647825181073831556439301342756E2L,
+ -5.286207458628380765099405359607331669027E2L,
+ -3.895781234155315729088407259045269652318E1L,
+ -6.200857908065163618041240848728398496256E1L,
+  1.469324610346924001393137895116129204737E1L,
+ -6.961356525370658572800674953305625578903E0L,
+  5.145724386641163809595512876629030548495E-3L,
+  1.990253655948179713415957791776180406812E-2L
+};
+#define NRDr15 7
+static const long double RDr15[NRDr15 + 1] =
+{
+  2.986190760847974943034021764693341524962E3L,
+  5.288262758961073066335410218650047725985E2L,
+  1.363649178071006978355113026427856008978E3L,
+  1.921707975649915894241864988942255320833E2L,
+  2.588651100651029023069013885900085533226E2L,
+  2.628752920321455606558942309396855629459E1L,
+  2.455649035885114308978333741080991380610E1L,
+  1.378826653595128464383127836412100939126E0L
+  /* 1.0E0 */
+};
+/* erfc(0.5) = C15a + C15b to extra precision.  */
+static const long double C15a = 0.4794921875L;
+static const long double C15b = 7.9346869534623172533461080354712635484242E-6L;
+
+/* erfc(x + 0.625) = erfc(0.625) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 5.1e-36  */
+#define NRNr16 8
+static const long double RNr16[NRNr16 + 1] =
+{
+ -2.347887943200680563784690094002722906820E3L,
+  8.008590660692105004780722726421020136482E2L,
+ -5.257363310384119728760181252132311447963E2L,
+ -4.471737717857801230450290232600243795637E1L,
+ -4.849540386452573306708795324759300320304E1L,
+  1.140885264677134679275986782978655952843E1L,
+ -6.731591085460269447926746876983786152300E0L,
+  1.370831653033047440345050025876085121231E-1L,
+  2.022958279982138755020825717073966576670E-2L,
+};
+#define NRDr16 7
+static const long double RDr16[NRDr16 + 1] =
+{
+  3.075166170024837215399323264868308087281E3L,
+  8.730468942160798031608053127270430036627E2L,
+  1.458472799166340479742581949088453244767E3L,
+  3.230423687568019709453130785873540386217E2L,
+  2.804009872719893612081109617983169474655E2L,
+  4.465334221323222943418085830026979293091E1L,
+  2.612723259683205928103787842214809134746E1L,
+  2.341526751185244109722204018543276124997E0L,
+  /* 1.0E0 */
+};
+/* erfc(0.625) = C16a + C16b to extra precision.  */
+static const long double C16a = 0.3767547607421875L;
+static const long double C16b = 4.3570693945275513594941232097252997287766E-6L;
+
+/* erfc(x + 0.75) = erfc(0.75) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 1.7e-35  */
+#define NRNr17 8
+static const long double RNr17[NRNr17 + 1] =
+{
+  -1.767068734220277728233364375724380366826E3L,
+  6.693746645665242832426891888805363898707E2L,
+  -4.746224241837275958126060307406616817753E2L,
+  -2.274160637728782675145666064841883803196E1L,
+  -3.541232266140939050094370552538987982637E1L,
+  6.988950514747052676394491563585179503865E0L,
+  -5.807687216836540830881352383529281215100E0L,
+  3.631915988567346438830283503729569443642E-1L,
+  -1.488945487149634820537348176770282391202E-2L
+};
+#define NRDr17 7
+static const long double RDr17[NRDr17 + 1] =
+{
+  2.748457523498150741964464942246913394647E3L,
+  1.020213390713477686776037331757871252652E3L,
+  1.388857635935432621972601695296561952738E3L,
+  3.903363681143817750895999579637315491087E2L,
+  2.784568344378139499217928969529219886578E2L,
+  5.555800830216764702779238020065345401144E1L,
+  2.646215470959050279430447295801291168941E1L,
+  2.984905282103517497081766758550112011265E0L,
+  /* 1.0E0 */
+};
+/* erfc(0.75) = C17a + C17b to extra precision.  */
+static const long double C17a = 0.2888336181640625L;
+static const long double C17b = 1.0748182422368401062165408589222625794046E-5L;
+
+
+/* erfc(x + 0.875) = erfc(0.875) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 2.2e-35  */
+#define NRNr18 8
+static const long double RNr18[NRNr18 + 1] =
+{
+ -1.342044899087593397419622771847219619588E3L,
+  6.127221294229172997509252330961641850598E2L,
+ -4.519821356522291185621206350470820610727E2L,
+  1.223275177825128732497510264197915160235E1L,
+ -2.730789571382971355625020710543532867692E1L,
+  4.045181204921538886880171727755445395862E0L,
+ -4.925146477876592723401384464691452700539E0L,
+  5.933878036611279244654299924101068088582E-1L,
+ -5.557645435858916025452563379795159124753E-2L
+};
+#define NRDr18 7
+static const long double RDr18[NRDr18 + 1] =
+{
+  2.557518000661700588758505116291983092951E3L,
+  1.070171433382888994954602511991940418588E3L,
+  1.344842834423493081054489613250688918709E3L,
+  4.161144478449381901208660598266288188426E2L,
+  2.763670252219855198052378138756906980422E2L,
+  5.998153487868943708236273854747564557632E1L,
+  2.657695108438628847733050476209037025318E1L,
+  3.252140524394421868923289114410336976512E0L,
+  /* 1.0E0 */
+};
+/* erfc(0.875) = C18a + C18b to extra precision.  */
+static const long double C18a = 0.215911865234375L;
+static const long double C18b = 1.3073705765341685464282101150637224028267E-5L;
+
+/* erfc(x + 1.0) = erfc(1.0) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 1.6e-35  */
+#define NRNr19 8
+static const long double RNr19[NRNr19 + 1] =
+{
+ -1.139180936454157193495882956565663294826E3L,
+  6.134903129086899737514712477207945973616E2L,
+ -4.628909024715329562325555164720732868263E2L,
+  4.165702387210732352564932347500364010833E1L,
+ -2.286979913515229747204101330405771801610E1L,
+  1.870695256449872743066783202326943667722E0L,
+ -4.177486601273105752879868187237000032364E0L,
+  7.533980372789646140112424811291782526263E-1L,
+ -8.629945436917752003058064731308767664446E-2L
+};
+#define NRDr19 7
+static const long double RDr19[NRDr19 + 1] =
+{
+  2.744303447981132701432716278363418643778E3L,
+  1.266396359526187065222528050591302171471E3L,
+  1.466739461422073351497972255511919814273E3L,
+  4.868710570759693955597496520298058147162E2L,
+  2.993694301559756046478189634131722579643E2L,
+  6.868976819510254139741559102693828237440E1L,
+  2.801505816247677193480190483913753613630E1L,
+  3.604439909194350263552750347742663954481E0L,
+  /* 1.0E0 */
+};
+/* erfc(1.0) = C19a + C19b to extra precision.  */
+static const long double C19a = 0.15728759765625L;
+static const long double C19b = 1.1609394035130658779364917390740703933002E-5L;
+
+/* erfc(x + 1.125) = erfc(1.125) + x R(x)
+   0 <= x < 0.125
+   Peak relative error 3.6e-36  */
+#define NRNr20 8
+static const long double RNr20[NRNr20 + 1] =
+{
+ -9.652706916457973956366721379612508047640E2L,
+  5.577066396050932776683469951773643880634E2L,
+ -4.406335508848496713572223098693575485978E2L,
+  5.202893466490242733570232680736966655434E1L,
+ -1.931311847665757913322495948705563937159E1L,
+ -9.364318268748287664267341457164918090611E-2L,
+ -3.306390351286352764891355375882586201069E0L,
+  7.573806045289044647727613003096916516475E-1L,
+ -9.611744011489092894027478899545635991213E-2L
+};
+#define NRDr20 7
+static const long double RDr20[NRDr20 + 1] =
+{
+  3.032829629520142564106649167182428189014E3L,
+  1.659648470721967719961167083684972196891E3L,
+  1.703545128657284619402511356932569292535E3L,
+  6.393465677731598872500200253155257708763E2L,
+  3.489131397281030947405287112726059221934E2L,
+  8.848641738570783406484348434387611713070E1L,
+  3.132269062552392974833215844236160958502E1L,
+  4.430131663290563523933419966185230513168E0L
+ /* 1.0E0 */
+};
+/* erfc(1.125) = C20a + C20b to extra precision.  */
+static const long double C20a = 0.111602783203125L;
+static const long double C20b = 8.9850951672359304215530728365232161564636E-6L;
+
+/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2))
+   7/8 <= 1/x < 1
+   Peak relative error 1.4e-35  */
+#define NRNr8 9
+static const long double RNr8[NRNr8 + 1] =
+{
+  3.587451489255356250759834295199296936784E1L,
+  5.406249749087340431871378009874875889602E2L,
+  2.931301290625250886238822286506381194157E3L,
+  7.359254185241795584113047248898753470923E3L,
+  9.201031849810636104112101947312492532314E3L,
+  5.749697096193191467751650366613289284777E3L,
+  1.710415234419860825710780802678697889231E3L,
+  2.150753982543378580859546706243022719599E2L,
+  8.740953582272147335100537849981160931197E0L,
+  4.876422978828717219629814794707963640913E-2L
+};
+#define NRDr8 8
+static const long double RDr8[NRDr8 + 1] =
+{
+  6.358593134096908350929496535931630140282E1L,
+  9.900253816552450073757174323424051765523E2L,
+  5.642928777856801020545245437089490805186E3L,
+  1.524195375199570868195152698617273739609E4L,
+  2.113829644500006749947332935305800887345E4L,
+  1.526438562626465706267943737310282977138E4L,
+  5.561370922149241457131421914140039411782E3L,
+  9.394035530179705051609070428036834496942E2L,
+  6.147019596150394577984175188032707343615E1L
+  /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2))
+   0.75 <= 1/x <= 0.875
+   Peak relative error 2.0e-36  */
+#define NRNr7 9
+static const long double RNr7[NRNr7 + 1] =
+{
+ 1.686222193385987690785945787708644476545E1L,
+ 1.178224543567604215602418571310612066594E3L,
+ 1.764550584290149466653899886088166091093E4L,
+ 1.073758321890334822002849369898232811561E5L,
+ 3.132840749205943137619839114451290324371E5L,
+ 4.607864939974100224615527007793867585915E5L,
+ 3.389781820105852303125270837910972384510E5L,
+ 1.174042187110565202875011358512564753399E5L,
+ 1.660013606011167144046604892622504338313E4L,
+ 6.700393957480661937695573729183733234400E2L
+};
+#define NRDr7 9
+static const long double RDr7[NRDr7 + 1] =
+{
+-1.709305024718358874701575813642933561169E3L,
+-3.280033887481333199580464617020514788369E4L,
+-2.345284228022521885093072363418750835214E5L,
+-8.086758123097763971926711729242327554917E5L,
+-1.456900414510108718402423999575992450138E6L,
+-1.391654264881255068392389037292702041855E6L,
+-6.842360801869939983674527468509852583855E5L,
+-1.597430214446573566179675395199807533371E5L,
+-1.488876130609876681421645314851760773480E4L,
+-3.511762950935060301403599443436465645703E2L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+   5/8 <= 1/x < 3/4
+   Peak relative error 1.9e-35  */
+#define NRNr6 9
+static const long double RNr6[NRNr6 + 1] =
+{
+ 1.642076876176834390623842732352935761108E0L,
+ 1.207150003611117689000664385596211076662E2L,
+ 2.119260779316389904742873816462800103939E3L,
+ 1.562942227734663441801452930916044224174E4L,
+ 5.656779189549710079988084081145693580479E4L,
+ 1.052166241021481691922831746350942786299E5L,
+ 9.949798524786000595621602790068349165758E4L,
+ 4.491790734080265043407035220188849562856E4L,
+ 8.377074098301530326270432059434791287601E3L,
+ 4.506934806567986810091824791963991057083E2L
+};
+#define NRDr6 9
+static const long double RDr6[NRDr6 + 1] =
+{
+-1.664557643928263091879301304019826629067E2L,
+-3.800035902507656624590531122291160668452E3L,
+-3.277028191591734928360050685359277076056E4L,
+-1.381359471502885446400589109566587443987E5L,
+-3.082204287382581873532528989283748656546E5L,
+-3.691071488256738343008271448234631037095E5L,
+-2.300482443038349815750714219117566715043E5L,
+-6.873955300927636236692803579555752171530E4L,
+-8.262158817978334142081581542749986845399E3L,
+-2.517122254384430859629423488157361983661E2L
+ /* 1.00 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+   1/2 <= 1/x < 5/8
+   Peak relative error 4.6e-36  */
+#define NRNr5 10
+static const long double RNr5[NRNr5 + 1] =
+{
+-3.332258927455285458355550878136506961608E-3L,
+-2.697100758900280402659586595884478660721E-1L,
+-6.083328551139621521416618424949137195536E0L,
+-6.119863528983308012970821226810162441263E1L,
+-3.176535282475593173248810678636522589861E2L,
+-8.933395175080560925809992467187963260693E2L,
+-1.360019508488475978060917477620199499560E3L,
+-1.075075579828188621541398761300910213280E3L,
+-4.017346561586014822824459436695197089916E2L,
+-5.857581368145266249509589726077645791341E1L,
+-2.077715925587834606379119585995758954399E0L
+};
+#define NRDr5 9
+static const long double RDr5[NRDr5 + 1] =
+{
+ 3.377879570417399341550710467744693125385E-1L,
+ 1.021963322742390735430008860602594456187E1L,
+ 1.200847646592942095192766255154827011939E2L,
+ 7.118915528142927104078182863387116942836E2L,
+ 2.318159380062066469386544552429625026238E3L,
+ 4.238729853534009221025582008928765281620E3L,
+ 4.279114907284825886266493994833515580782E3L,
+ 2.257277186663261531053293222591851737504E3L,
+ 5.570475501285054293371908382916063822957E2L,
+ 5.142189243856288981145786492585432443560E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+   3/8 <= 1/x < 1/2
+   Peak relative error 2.0e-36  */
+#define NRNr4 10
+static const long double RNr4[NRNr4 + 1] =
+{
+ 3.258530712024527835089319075288494524465E-3L,
+ 2.987056016877277929720231688689431056567E-1L,
+ 8.738729089340199750734409156830371528862E0L,
+ 1.207211160148647782396337792426311125923E2L,
+ 8.997558632489032902250523945248208224445E2L,
+ 3.798025197699757225978410230530640879762E3L,
+ 9.113203668683080975637043118209210146846E3L,
+ 1.203285891339933238608683715194034900149E4L,
+ 8.100647057919140328536743641735339740855E3L,
+ 2.383888249907144945837976899822927411769E3L,
+ 2.127493573166454249221983582495245662319E2L
+};
+#define NRDr4 10
+static const long double RDr4[NRDr4 + 1] =
+{
+-3.303141981514540274165450687270180479586E-1L,
+-1.353768629363605300707949368917687066724E1L,
+-2.206127630303621521950193783894598987033E2L,
+-1.861800338758066696514480386180875607204E3L,
+-8.889048775872605708249140016201753255599E3L,
+-2.465888106627948210478692168261494857089E4L,
+-3.934642211710774494879042116768390014289E4L,
+-3.455077258242252974937480623730228841003E4L,
+-1.524083977439690284820586063729912653196E4L,
+-2.810541887397984804237552337349093953857E3L,
+-1.343929553541159933824901621702567066156E2L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+   1/4 <= 1/x < 3/8
+   Peak relative error 8.4e-37  */
+#define NRNr3 11
+static const long double RNr3[NRNr3 + 1] =
+{
+-1.952401126551202208698629992497306292987E-6L,
+-2.130881743066372952515162564941682716125E-4L,
+-8.376493958090190943737529486107282224387E-3L,
+-1.650592646560987700661598877522831234791E-1L,
+-1.839290818933317338111364667708678163199E0L,
+-1.216278715570882422410442318517814388470E1L,
+-4.818759344462360427612133632533779091386E1L,
+-1.120994661297476876804405329172164436784E2L,
+-1.452850765662319264191141091859300126931E2L,
+-9.485207851128957108648038238656777241333E1L,
+-2.563663855025796641216191848818620020073E1L,
+-1.787995944187565676837847610706317833247E0L
+};
+#define NRDr3 10
+static const long double RDr3[NRDr3 + 1] =
+{
+ 1.979130686770349481460559711878399476903E-4L,
+ 1.156941716128488266238105813374635099057E-2L,
+ 2.752657634309886336431266395637285974292E-1L,
+ 3.482245457248318787349778336603569327521E0L,
+ 2.569347069372696358578399521203959253162E1L,
+ 1.142279000180457419740314694631879921561E2L,
+ 3.056503977190564294341422623108332700840E2L,
+ 4.780844020923794821656358157128719184422E2L,
+ 4.105972727212554277496256802312730410518E2L,
+ 1.724072188063746970865027817017067646246E2L,
+ 2.815939183464818198705278118326590370435E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+   1/8 <= 1/x < 1/4
+   Peak relative error 1.5e-36  */
+#define NRNr2 11
+static const long double RNr2[NRNr2 + 1] =
+{
+-2.638914383420287212401687401284326363787E-8L,
+-3.479198370260633977258201271399116766619E-6L,
+-1.783985295335697686382487087502222519983E-4L,
+-4.777876933122576014266349277217559356276E-3L,
+-7.450634738987325004070761301045014986520E-2L,
+-7.068318854874733315971973707247467326619E-1L,
+-4.113919921935944795764071670806867038732E0L,
+-1.440447573226906222417767283691888875082E1L,
+-2.883484031530718428417168042141288943905E1L,
+-2.990886974328476387277797361464279931446E1L,
+-1.325283914915104866248279787536128997331E1L,
+-1.572436106228070195510230310658206154374E0L
+};
+#define NRDr2 10
+static const long double RDr2[NRDr2 + 1] =
+{
+ 2.675042728136731923554119302571867799673E-6L,
+ 2.170997868451812708585443282998329996268E-4L,
+ 7.249969752687540289422684951196241427445E-3L,
+ 1.302040375859768674620410563307838448508E-1L,
+ 1.380202483082910888897654537144485285549E0L,
+ 8.926594113174165352623847870299170069350E0L,
+ 3.521089584782616472372909095331572607185E1L,
+ 8.233547427533181375185259050330809105570E1L,
+ 1.072971579885803033079469639073292840135E2L,
+ 6.943803113337964469736022094105143158033E1L,
+ 1.775695341031607738233608307835017282662E1L
+ /* 1.0E0 */
+};
+
+/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2))
+   1/128 <= 1/x < 1/8
+   Peak relative error 2.2e-36  */
+#define NRNr1 9
+static const long double RNr1[NRNr1 + 1] =
+{
+-4.250780883202361946697751475473042685782E-8L,
+-5.375777053288612282487696975623206383019E-6L,
+-2.573645949220896816208565944117382460452E-4L,
+-6.199032928113542080263152610799113086319E-3L,
+-8.262721198693404060380104048479916247786E-2L,
+-6.242615227257324746371284637695778043982E-1L,
+-2.609874739199595400225113299437099626386E0L,
+-5.581967563336676737146358534602770006970E0L,
+-5.124398923356022609707490956634280573882E0L,
+-1.290865243944292370661544030414667556649E0L
+};
+#define NRDr1 8
+static const long double RDr1[NRDr1 + 1] =
+{
+ 4.308976661749509034845251315983612976224E-6L,
+ 3.265390126432780184125233455960049294580E-4L,
+ 9.811328839187040701901866531796570418691E-3L,
+ 1.511222515036021033410078631914783519649E-1L,
+ 1.289264341917429958858379585970225092274E0L,
+ 6.147640356182230769548007536914983522270E0L,
+ 1.573966871337739784518246317003956180750E1L,
+ 1.955534123435095067199574045529218238263E1L,
+ 9.472613121363135472247929109615785855865E0L
+  /* 1.0E0 */
+};
+
+
+#ifdef __STDC__
+long double
+__erfl (long double x)
+#else
+double
+__erfl (x)
+     long double x;
+#endif
+{
+  long double a, y, z;
+  int32_t i, ix, sign;
+  ieee854_long_double_shape_type u;
+
+  u.value = x;
+  sign = u.parts32.w0;
+  ix = sign & 0x7fffffff;
+
+  if (ix >= 0x7ff00000)
+    {				/* erf(nan)=nan */
+      i = ((sign & 0xfff00000) >> 31) << 1;
+      return (long double) (1 - i) + one / x;	/* erf(+-inf)=+-1 */
+    }
+
+  if (ix >= 0x3ff00000) /* |x| >= 1.0 */
+    {
+      y = __erfcl (x);
+      return (one - y);
+      /*    return (one - __erfcl (x)); */
+    }
+  u.parts32.w0 = ix;
+  a = u.value;
+  z = x * x;
+  if (ix < 0x3fec0000)  /* a < 0.875 */
+    {
+      if (ix < 0x3c600000) /* |x|<2**-57 */
+	{
+	  if (ix < 0x00800000)
+	    {
+	      /* erf (-0) = -0.  Unfortunately, for IBM extended double
+		 0.125 * (8.0 * x + efx8 * x) for x = -0 evaluates to 0.  */
+	      if (x == 0)
+		return x;
+	      return 0.125 * (8.0 * x + efx8 * x);	/*avoid underflow */
+	    }
+	  return x + efx * x;
+	}
+      y = a + a * neval (z, TN1, NTN1) / deval (z, TD1, NTD1);
+    }
+  else
+    {
+      a = a - one;
+      y = erf_const + neval (a, TN2, NTN2) / deval (a, TD2, NTD2);
+    }
+
+  if (sign & 0x80000000) /* x < 0 */
+    y = -y;
+  return( y );
+}
+
+long_double_symbol (libm, __erfl, erfl);
+#ifdef __STDC__
+     long double
+     __erfcl (long double x)
+#else
+     long double
+     __erfcl (x)
+     double
+       x;
+#endif
+{
+  long double y, z, p, r;
+  int32_t i, ix, sign;
+  ieee854_long_double_shape_type u;
+
+  u.value = x;
+  sign = u.parts32.w0;
+  ix = sign & 0x7fffffff;
+  u.parts32.w0 = ix;
+
+  if (ix >= 0x7ff00000)
+    {				/* erfc(nan)=nan */
+      /* erfc(+-inf)=0,2 */
+      return (long double) (((u_int32_t) sign >> 31) << 1) + one / x;
+    }
+
+  if (ix < 0x3fd00000) /* |x| <1/4 */
+    {
+      if (ix < 0x38d00000) /* |x|<2**-114 */
+	return one - x;
+      return one - __erfl (x);
+    }
+  if (ix < 0x3ff40000) /* 1.25 */
+    {
+      x = u.value;
+      i = 8.0 * x;
+      switch (i)
+	{
+	case 2:
+	  z = x - 0.25L;
+	  y = C13b + z * neval (z, RNr13, NRNr13) / deval (z, RDr13, NRDr13);
+	  y += C13a;
+	  break;
+	case 3:
+	  z = x - 0.375L;
+	  y = C14b + z * neval (z, RNr14, NRNr14) / deval (z, RDr14, NRDr14);
+	  y += C14a;
+	  break;
+	case 4:
+	  z = x - 0.5L;
+	  y = C15b + z * neval (z, RNr15, NRNr15) / deval (z, RDr15, NRDr15);
+	  y += C15a;
+	  break;
+	case 5:
+	  z = x - 0.625L;
+	  y = C16b + z * neval (z, RNr16, NRNr16) / deval (z, RDr16, NRDr16);
+	  y += C16a;
+	  break;
+	case 6:
+	  z = x - 0.75L;
+	  y = C17b + z * neval (z, RNr17, NRNr17) / deval (z, RDr17, NRDr17);
+	  y += C17a;
+	  break;
+	case 7:
+	  z = x - 0.875L;
+	  y = C18b + z * neval (z, RNr18, NRNr18) / deval (z, RDr18, NRDr18);
+	  y += C18a;
+	  break;
+	case 8:
+	  z = x - 1.0L;
+	  y = C19b + z * neval (z, RNr19, NRNr19) / deval (z, RDr19, NRDr19);
+	  y += C19a;
+	  break;
+	case 9:
+	  z = x - 1.125L;
+	  y = C20b + z * neval (z, RNr20, NRNr20) / deval (z, RDr20, NRDr20);
+	  y += C20a;
+	  break;
+	}
+      if (sign & 0x80000000)
+	y = 2.0L - y;
+      return y;
+    }
+  /* 1.25 < |x| < 107 */
+  if (ix < 0x405ac000)
+    {
+      /* x < -9 */
+      if ((ix >= 0x40220000) && (sign & 0x80000000))
+	return two - tiny;
+
+      x = fabsl (x);
+      z = one / (x * x);
+      i = 8.0 / x;
+      switch (i)
+	{
+	default:
+	case 0:
+	  p = neval (z, RNr1, NRNr1) / deval (z, RDr1, NRDr1);
+	  break;
+	case 1:
+	  p = neval (z, RNr2, NRNr2) / deval (z, RDr2, NRDr2);
+	  break;
+	case 2:
+	  p = neval (z, RNr3, NRNr3) / deval (z, RDr3, NRDr3);
+	  break;
+	case 3:
+	  p = neval (z, RNr4, NRNr4) / deval (z, RDr4, NRDr4);
+	  break;
+	case 4:
+	  p = neval (z, RNr5, NRNr5) / deval (z, RDr5, NRDr5);
+	  break;
+	case 5:
+	  p = neval (z, RNr6, NRNr6) / deval (z, RDr6, NRDr6);
+	  break;
+	case 6:
+	  p = neval (z, RNr7, NRNr7) / deval (z, RDr7, NRDr7);
+	  break;
+	case 7:
+	  p = neval (z, RNr8, NRNr8) / deval (z, RDr8, NRDr8);
+	  break;
+	}
+      u.value = x;
+      u.parts32.w3 = 0;
+      u.parts32.w2 &= 0xffffe000;
+      z = u.value;
+      r = __ieee754_expl (-z * z - 0.5625) *
+	__ieee754_expl ((z - x) * (z + x) + p);
+      if ((sign & 0x80000000) == 0)
+	return r / x;
+      else
+	return two - r / x;
+    }
+  else
+    {
+      if ((sign & 0x80000000) == 0)
+	return tiny * tiny;
+      else
+	return two - tiny;
+    }
+}
+
+long_double_symbol (libm, __erfcl, erfcl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c b/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
new file mode 100644
index 0000000000..4908d4e4f3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c
@@ -0,0 +1,160 @@
+/*							expm1l.c
+ *
+ *	Exponential function, minus 1
+ *      128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, expm1l();
+ *
+ * y = expm1l( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns e (2.71828...) raised to the x power, minus one.
+ *
+ * Range reduction is accomplished by separating the argument
+ * into an integer k and fraction f such that
+ *
+ *     x    k  f
+ *    e  = 2  e.
+ *
+ * An expansion x + .5 x^2 + x^3 R(x) approximates exp(f) - 1
+ * in the basic range [-0.5 ln 2, 0.5 ln 2].
+ *
+ *
+ * ACCURACY:
+ *
+ *                      Relative error:
+ * arithmetic   domain     # trials      peak         rms
+ *    IEEE    -79,+MAXLOG    100,000     1.7e-34     4.5e-35
+ *
+ */
+
+/* Copyright 2001 by Stephen L. Moshier
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x)
+   -.5 ln 2  <  x  <  .5 ln 2
+   Theoretical peak relative error = 8.1e-36  */
+
+static const long double
+  P0 = 2.943520915569954073888921213330863757240E8L,
+  P1 = -5.722847283900608941516165725053359168840E7L,
+  P2 = 8.944630806357575461578107295909719817253E6L,
+  P3 = -7.212432713558031519943281748462837065308E5L,
+  P4 = 4.578962475841642634225390068461943438441E4L,
+  P5 = -1.716772506388927649032068540558788106762E3L,
+  P6 = 4.401308817383362136048032038528753151144E1L,
+  P7 = -4.888737542888633647784737721812546636240E-1L,
+  Q0 = 1.766112549341972444333352727998584753865E9L,
+  Q1 = -7.848989743695296475743081255027098295771E8L,
+  Q2 = 1.615869009634292424463780387327037251069E8L,
+  Q3 = -2.019684072836541751428967854947019415698E7L,
+  Q4 = 1.682912729190313538934190635536631941751E6L,
+  Q5 = -9.615511549171441430850103489315371768998E4L,
+  Q6 = 3.697714952261803935521187272204485251835E3L,
+  Q7 = -8.802340681794263968892934703309274564037E1L,
+  /* Q8 = 1.000000000000000000000000000000000000000E0 */
+/* C1 + C2 = ln 2 */
+
+  C1 = 6.93145751953125E-1L,
+  C2 = 1.428606820309417232121458176568075500134E-6L,
+/* ln (2^16384 * (1 - 2^-113)) */
+  maxlog = 1.1356523406294143949491931077970764891253E4L,
+/* ln 2^-114 */
+  minarg = -7.9018778583833765273564461846232128760607E1L, big = 2e307L;
+
+
+long double
+__expm1l (long double x)
+{
+  long double px, qx, xx;
+  int32_t ix, sign;
+  ieee854_long_double_shape_type u;
+  int k;
+
+  /* Detect infinity and NaN.  */
+  u.value = x;
+  ix = u.parts32.w0;
+  sign = ix & 0x80000000;
+  ix &= 0x7fffffff;
+  if (ix >= 0x7ff00000)
+    {
+      /* Infinity. */
+      if (((ix & 0xfffff) | u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+	{
+	  if (sign)
+	    return -1.0L;
+	  else
+	    return x;
+	}
+      /* NaN. No invalid exception. */
+      return x;
+    }
+
+  /* expm1(+- 0) = +- 0.  */
+  if ((ix == 0) && (u.parts32.w1 | (u.parts32.w2&0x7fffffff) | u.parts32.w3) == 0)
+    return x;
+
+  /* Overflow.  */
+  if (x > maxlog)
+    return (big * big);
+
+  /* Minimum value.  */
+  if (x < minarg)
+    return (4.0/big - 1.0L);
+
+  /* Express x = ln 2 (k + remainder), remainder not exceeding 1/2. */
+  xx = C1 + C2;			/* ln 2. */
+  px = __floorl (0.5 + x / xx);
+  k = px;
+  /* remainder times ln 2 */
+  x -= px * C1;
+  x -= px * C2;
+
+  /* Approximate exp(remainder ln 2).  */
+  px = (((((((P7 * x
+	      + P6) * x
+	     + P5) * x + P4) * x + P3) * x + P2) * x + P1) * x + P0) * x;
+
+  qx = (((((((x
+	      + Q7) * x
+	     + Q6) * x + Q5) * x + Q4) * x + Q3) * x + Q2) * x + Q1) * x + Q0;
+
+  xx = x * x;
+  qx = x + (0.5 * xx + xx * px / qx);
+
+  /* exp(x) = exp(k ln 2) exp(remainder ln 2) = 2^k exp(remainder ln 2).
+
+  We have qx = exp(remainder ln 2) - 1, so
+  exp(x) - 1 = 2^k (qx + 1) - 1
+             = 2^k qx + 2^k - 1.  */
+
+  px = ldexpl (1.0L, k);
+  x = px * qx + (px - 1.0);
+  return x;
+}
+libm_hidden_def (__expm1l)
+long_double_symbol (libm, __expm1l, expm1l);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
new file mode 100644
index 0000000000..62663125ee
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
@@ -0,0 +1,43 @@
+/* s_fabsl.c -- long double version of s_fabs.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+
+/*
+ * fabsl(x) returns the absolute value of x.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+	long double __fabsl(long double x)
+#else
+	long double __fabsl(x)
+	long double x;
+#endif
+{
+	u_int64_t hx, lx;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	lx = lx ^ ( hx & 0x8000000000000000LL );
+	hx = hx & 0x7fffffffffffffffLL;
+	SET_LDOUBLE_WORDS64(hx,lx,x);
+        return x;
+}
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_finitel.c b/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
new file mode 100644
index 0000000000..49f2c92385
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
@@ -0,0 +1,45 @@
+/* s_finitel.c -- long double version of s_finite.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * finitel(x) returns 1 is x is finite, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___finitel (long double x)
+{
+	int64_t hx;
+	GET_LDOUBLE_MSW64(hx,x);
+	return (int)((u_int64_t)((hx&0x7fffffffffffffffLL)
+				 -0x7ff0000000000000LL)>>63);
+}
+hidden_ver (___finitel, __finitel)
+weak_alias (___finitel, ____finitel)
+#ifdef IS_IN_libm
+long_double_symbol (libm, ____finitel, finitel);
+long_double_symbol (libm, ___finitel, __finitel);
+#else
+long_double_symbol (libc, ____finitel, finitel);
+long_double_symbol (libc, ___finitel, __finitel);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_floorl.c b/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
new file mode 100644
index 0000000000..4c4ae9b035
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
@@ -0,0 +1,85 @@
+/* Round to int long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__floorl (long double x)
+#else
+long double
+__floorl (x)
+     long double x;
+#endif
+{
+  double xh, xl, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Return Inf, Nan, +/-0 unchanged.  */
+  if (__builtin_expect (xh != 0.0
+			&& __builtin_isless (__builtin_fabs (xh),
+					     __builtin_inf ()), 1))
+    {
+      int save_round = fegetround ();
+
+      /* Long double arithmetic, including the canonicalisation below,
+	 only works in round-to-nearest mode.  */
+      fesetround (FE_TONEAREST);
+
+      /* Convert the high double to integer.  */
+      hi = ldbl_nearbyint (xh);
+
+      /* Subtract integral high part from the value.  */
+      xh -= hi;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Now convert the low double, adjusted for any remainder from the
+         high double.  */
+      lo = ldbl_nearbyint (xh);
+
+      /* Adjust the result when the remainder is non-zero.  nearbyint
+         rounds values to the nearest integer, and values halfway
+         between integers to the nearest even integer.  floorl must
+         round towards -Inf.  */
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+	lo += -1.0;
+
+      /* Ensure the final value is canonical.  In certain cases,
+         rounding causes hi,lo calculated so far to be non-canonical.  */
+      xh = hi;
+      xl = lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      fesetround (save_round);
+    }
+
+  return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __floorl, floorl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c b/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
new file mode 100644
index 0000000000..6999abc250
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c
@@ -0,0 +1,95 @@
+/* Return classification value corresponding to argument.
+   Copyright (C) 1997,1999,2002,2004,2006,2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+   		  Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+  /*
+   *		hx                  lx
+   * +NaN	7ffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+   * -NaN	fffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+   * +Inf	7ff0 0000 0000 0000 xxxx xxxx xxxx xxxx
+   * -Inf	fff0 0000 0000 0000 xxxx xxxx xxxx xxxx
+   * +0		0000 0000 0000 0000 xxxx xxxx xxxx xxxx
+   * -0		8000 0000 0000 0000 xxxx xxxx xxxx xxxx
+   * +normal	0360 0000 0000 0000 0000 0000 0000 0000 (smallest)
+   * -normal	8360 0000 0000 0000 0000 0000 0000 0000 (smallest)
+   * +normal	7fef ffff ffff ffff 7c8f ffff ffff fffe (largest)
+   * +normal	ffef ffff ffff ffff fc8f ffff ffff fffe (largest)
+   * +denorm	0360 0000 0000 0000 8000 0000 0000 0001 (largest)
+   * -denorm	8360 0000 0000 0000 0000 0000 0000 0001 (largest)
+   * +denorm	000n nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+   * -denorm	800n nnnn nnnn nnnn xxxx xxxx xxxx xxxx
+   */
+
+int
+___fpclassifyl (long double x)
+{
+  u_int64_t hx, lx;
+  int retval = FP_NORMAL;
+
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+  if ((hx & 0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) {
+      /* +/-NaN or +/-Inf */
+      if (hx & 0x000fffffffffffffULL) {
+	  /* +/-NaN */
+	  retval = FP_NAN;
+      } else {
+	  retval = FP_INFINITE;
+      }
+  } else {
+      /* +/-zero or +/- normal or +/- denormal */
+      if (hx & 0x7fffffffffffffffULL) {
+	  /* +/- normal or +/- denormal */
+	  if ((hx & 0x7ff0000000000000ULL) > 0x0360000000000000ULL) {
+	      /* +/- normal */
+	      retval = FP_NORMAL;
+	  } else {
+	      if ((hx & 0x7ff0000000000000ULL) == 0x0360000000000000ULL) {
+		  if ((lx & 0x7fffffffffffffff)	/* lower is non-zero */
+		  && ((lx^hx) & 0x8000000000000000ULL)) { /* and sign differs */
+		      /* +/- denormal */
+		      retval = FP_SUBNORMAL;
+		  } else {
+		      /* +/- normal */
+		      retval = FP_NORMAL;
+		  }
+	      } else {
+		  /* +/- denormal */
+		  retval = FP_SUBNORMAL;
+	      }
+	  }
+      } else {
+	  /* +/- zero */
+	  retval = FP_ZERO;
+      }
+  }
+
+  return retval;
+}
+long_double_symbol (libm, ___fpclassifyl, __fpclassifyl);
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+libm_hidden_ver (___fpclassifyl, __fpclassifyl)
+#else
+libm_hidden_def (__fpclassifyl)
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c b/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
new file mode 100644
index 0000000000..fab566da3b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
@@ -0,0 +1,92 @@
+/* s_frexpl.c -- long double version of s_frexp.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * for non-zero x
+ *	x = frexpl(arg,&exp);
+ * return a long double fp quantity x such that 0.5 <= |x| <1.0
+ * and the corresponding binary exponent "exp". That is
+ *	arg = x*2^exp.
+ * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg
+ * with *exp=0.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+two107 = 162259276829213363391578010288128.0; /* 0x4670000000000000, 0 */
+
+#ifdef __STDC__
+	long double __frexpl(long double x, int *eptr)
+#else
+	long double __frexpl(x, eptr)
+	long double x; int *eptr;
+#endif
+{
+	u_int64_t hx, lx, ix, ixl;
+	int64_t explo;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	ixl = 0x7fffffffffffffffULL&lx;
+	ix =  0x7fffffffffffffffULL&hx;
+	*eptr = 0;
+	if(ix>=0x7ff0000000000000ULL||((ix|ixl)==0)) return x;	/* 0,inf,nan */
+	if (ix<0x0010000000000000ULL) {		/* subnormal */
+	    x *= two107;
+	    GET_LDOUBLE_MSW64(hx,x);
+	    ix = hx&0x7fffffffffffffffULL;
+	    *eptr = -107;
+	}
+	*eptr += (ix>>52)-1022;
+
+	if (ixl != 0ULL) {
+	  explo = (ixl>>52) - (ix>>52) + 0x3fe;
+	  if ((ixl&0x7ff0000000000000ULL) == 0LL) {
+	    /* the lower double is a denomal so we need to correct its
+	       mantissa and perhaps its exponent.  */
+	    int cnt;
+
+	    if (sizeof (ixl) == sizeof (long))
+	      cnt = __builtin_clzl (ixl);
+	    else if ((ixl >> 32) != 0)
+	      cnt = __builtin_clzl ((long) (ixl >> 32));
+	    else
+	      cnt = __builtin_clzl ((long) ixl) + 32;
+	    cnt = cnt - 12;
+	    lx = (lx&0x8000000000000000ULL) | ((explo-cnt)<<52)
+	       | ((ixl<<(cnt+1))&0x000fffffffffffffULL);
+	  } else
+	    lx = (lx&0x800fffffffffffffULL) | (explo<<52);
+	} else
+	  lx = 0ULL;
+
+	hx = (hx&0x800fffffffffffffULL) | 0x3fe0000000000000ULL;
+	SET_LDOUBLE_WORDS64(x,hx,lx);
+	return x;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __frexpl, frexpl);
+#else
+long_double_symbol (libc, __frexpl, frexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c b/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c
new file mode 100644
index 0000000000..428854d770
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ilogbl.c
@@ -0,0 +1,63 @@
+/* s_ilogbl.c -- long double version of s_ilogb.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* ilogbl(long double x)
+ * return the binary exponent of non-zero x
+ * ilogbl(0) = FP_ILOGB0
+ * ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
+ * ilogbl(+-Inf) = INT_MAX (no signal is raised)
+ */
+
+#include <limits.h>
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+	int __ilogbl(long double x)
+#else
+	int __ilogbl(x)
+	long double x;
+#endif
+{
+	int64_t hx,lx;
+	int ix;
+
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	hx &= 0x7fffffffffffffffLL;
+	if(hx <= 0x0010000000000000LL) {
+	    if((hx|(lx&0x7fffffffffffffffLL))==0)
+		return FP_ILOGB0;	/* ilogbl(0) = FP_ILOGB0 */
+	    else			/* subnormal x */
+		if(hx==0) {
+		    for (ix = -1043; lx>0; lx<<=1) ix -=1;
+		} else {
+		    for (ix = -1022, hx<<=11; hx>0; hx<<=1) ix -=1;
+		}
+	    return ix;
+	}
+	else if (hx<0x7ff0000000000000LL) return (hx>>52)-0x3ff;
+	else if (FP_ILOGBNAN != INT_MAX) {
+	    /* ISO C99 requires ilogbl(+-Inf) == INT_MAX.  */
+	    if (((hx^0x7ff0000000000000LL)|lx) == 0)
+		return INT_MAX;
+	}
+	return FP_ILOGBNAN;
+}
+long_double_symbol (libm, __ilogbl, ilogbl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c b/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
new file mode 100644
index 0000000000..717b57466d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c
@@ -0,0 +1,35 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Change for long double by Jakub Jelinek <jj@ultra.linux.cz>
+ * Public domain.
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___isinfl (long double x)
+{
+	int64_t hx,lx;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	lx = (lx & 0x7fffffffffffffffLL);
+	lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL;
+	lx |= -lx;
+	return ~(lx >> 63) & (hx >> 62);
+}
+hidden_ver (___isinfl, __isinfl)
+#ifndef IS_IN_libm
+weak_alias (___isinfl, ____isinfl)
+long_double_symbol (libc, ___isinfl, isinfl);
+long_double_symbol (libc, ____isinfl, __isinfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c b/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
new file mode 100644
index 0000000000..ae5ba8e1ff
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
@@ -0,0 +1,43 @@
+/* s_isnanl.c -- long double version of s_isnan.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * isnanl(x) returns 1 is x is nan, else 0;
+ * no branching!
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___isnanl (long double x)
+{
+	int64_t hx,lx;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	hx &= 0x7fffffffffffffffLL;
+	hx = 0x7ff0000000000000LL - hx;
+	return (int)((u_int64_t)hx>>63);
+}
+hidden_ver (___isnanl, __isnanl)
+#ifndef IS_IN_libm
+weak_alias (___isnanl, ____isnanl)
+long_double_symbol (libc, ___isnanl, isnanl);
+long_double_symbol (libc, ____isnanl, __isnanl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
new file mode 100644
index 0000000000..3718250b6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c
@@ -0,0 +1,147 @@
+/* Round to long long int long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long long
+__llrintl (long double x)
+#else
+long long
+__llrintl (x)
+     long double x;
+#endif
+{
+  double xh, xl;
+  long long res, hi, lo;
+  int save_round;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Limit the range of values handled by the conversion to long long.
+     We do this because we aren't sure whether that conversion properly
+     raises FE_INVALID.  */
+  if (__builtin_expect
+      ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1)
+#if !defined (FE_INVALID)
+      || 1
+#endif
+    )
+    {
+      save_round = fegetround ();
+
+      if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+	{
+	  /* When XH is 9223372036854775808.0, converting to long long will
+	     overflow, resulting in an invalid operation.  However, XL might
+	     be negative and of sufficient magnitude that the overall long
+	     double is in fact in range.  Avoid raising an exception.  In any
+	     case we need to convert this value specially, because
+	     the converted value is not exactly represented as a double
+	     thus subtracting HI from XH suffers rounding error.  */
+	  hi = __LONG_LONG_MAX__;
+	  xh = 1.0;
+	}
+      else
+	{
+	  hi = (long long) xh;
+	  xh -= hi;
+	}
+      ldbl_canonicalize (&xh, &xl);
+
+      lo = (long long) xh;
+
+      /* Peg at max/min values, assuming that the above conversions do so.
+         Strictly speaking, we can return anything for values that overflow,
+         but this is more useful.  */
+      res = hi + lo;
+
+      /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
+      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      hi = res;
+      switch (save_round)
+	{
+	case FE_TONEAREST:
+	  if (fabs (xh) < 0.5
+	      || (fabs (xh) == 0.5
+		  && ((xh > 0.0 && xl < 0.0)
+		      || (xh < 0.0 && xl > 0.0)
+		      || (xl == 0.0 && (res & 1) == 0))))
+	    return res;
+
+	  if (xh < 0.0)
+	    res -= 1;
+	  else
+	    res += 1;
+	  break;
+
+	case FE_TOWARDZERO:
+	  if (res > 0 && (xh < 0.0 || (xh == 0.0 && xl < 0.0)))
+	    res -= 1;
+	  else if (res < 0 && (xh > 0.0 || (xh == 0.0 && xl > 0.0)))
+	    res += 1;
+	  return res;
+	  break;
+
+	case FE_UPWARD:
+	  if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+	    res += 1;
+	  break;
+
+	case FE_DOWNWARD:
+	  if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+	    res -= 1;
+	  break;
+	}
+
+      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      return res;
+    }
+  else
+    {
+      if (xh > 0.0)
+	hi = __LONG_LONG_MAX__;
+      else if (xh < 0.0)
+	hi = -__LONG_LONG_MAX__ - 1;
+      else
+	/* Nan */
+	hi = 0;
+    }
+
+overflow:
+#ifdef FE_INVALID
+  feraiseexcept (FE_INVALID);
+#endif
+  return hi;
+}
+
+long_double_symbol (libm, __llrintl, llrintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
new file mode 100644
index 0000000000..9e25024f96
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c
@@ -0,0 +1,127 @@
+/* Round to long long int long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+#ifdef __STDC__
+long long
+__llroundl (long double x)
+#else
+long long
+__llroundl (x)
+     long double x;
+#endif
+{
+  double xh, xl;
+  long long res, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Limit the range of values handled by the conversion to long long.
+     We do this because we aren't sure whether that conversion properly
+     raises FE_INVALID.  */
+  if (__builtin_expect
+      ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1)
+#if !defined (FE_INVALID)
+      || 1
+#endif
+    )
+    {
+      if (__builtin_expect ((xh == -(double) (-__LONG_LONG_MAX__ - 1)), 0))
+	{
+	  /* When XH is 9223372036854775808.0, converting to long long will
+	     overflow, resulting in an invalid operation.  However, XL might
+	     be negative and of sufficient magnitude that the overall long
+	     double is in fact in range.  Avoid raising an exception.  In any
+	     case we need to convert this value specially, because
+	     the converted value is not exactly represented as a double
+	     thus subtracting HI from XH suffers rounding error.  */
+	  hi = __LONG_LONG_MAX__;
+	  xh = 1.0;
+	}
+      else
+	{
+	  hi = (long long) xh;
+	  xh -= hi;
+	}
+      ldbl_canonicalize (&xh, &xl);
+
+      lo = (long long) xh;
+
+      /* Peg at max/min values, assuming that the above conversions do so.
+         Strictly speaking, we can return anything for values that overflow,
+         but this is more useful.  */
+      res = hi + lo;
+
+      /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
+      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      hi = res;
+      if (xh > 0.5)
+	{
+	  res += 1;
+	}
+      else if (xh == 0.5)
+	{
+	  if (xl > 0.0 || (xl == 0.0 && res >= 0))
+	    res += 1;
+	}
+      else if (-xh > 0.5)
+	{
+	  res -= 1;
+	}
+      else if (-xh == 0.5)
+	{
+	  if (xl < 0.0 || (xl == 0.0 && res <= 0))
+	    res -= 1;
+	}
+
+      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      return res;
+    }
+  else
+    {
+      if (xh > 0.0)
+	hi = __LONG_LONG_MAX__;
+      else if (xh < 0.0)
+	hi = -__LONG_LONG_MAX__ - 1;
+      else
+	/* Nan */
+	hi = 0;
+    }
+
+overflow:
+#ifdef FE_INVALID
+  feraiseexcept (FE_INVALID);
+#endif
+  return hi;
+}
+
+long_double_symbol (libm, __llroundl, llroundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
new file mode 100644
index 0000000000..f1863fb688
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c
@@ -0,0 +1,257 @@
+/*							log1pl.c
+ *
+ *      Relative error logarithm
+ *	Natural logarithm of 1+x, 128-bit long double precision
+ *
+ *
+ *
+ * SYNOPSIS:
+ *
+ * long double x, y, log1pl();
+ *
+ * y = log1pl( x );
+ *
+ *
+ *
+ * DESCRIPTION:
+ *
+ * Returns the base e (2.718...) logarithm of 1+x.
+ *
+ * The argument 1+x is separated into its exponent and fractional
+ * parts.  If the exponent is between -1 and +1, the logarithm
+ * of the fraction is approximated by
+ *
+ *     log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
+ *
+ * Otherwise, setting  z = 2(w-1)/(w+1),
+ *
+ *     log(w) = z + z^3 P(z)/Q(z).
+ *
+ *
+ *
+ * ACCURACY:
+ *
+ *                      Relative error:
+ * arithmetic   domain     # trials      peak         rms
+ *    IEEE      -1, 8       100000      1.9e-34     4.3e-35
+ */
+
+/* Copyright 2001 by Stephen L. Moshier
+
+    This 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.
+
+    This 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 this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA */
+
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+/* Coefficients for log(1+x) = x - x^2 / 2 + x^3 P(x)/Q(x)
+ * 1/sqrt(2) <= 1+x < sqrt(2)
+ * Theoretical peak relative error = 5.3e-37,
+ * relative peak error spread = 2.3e-14
+ */
+static const long double
+  P12 = 1.538612243596254322971797716843006400388E-6L,
+  P11 = 4.998469661968096229986658302195402690910E-1L,
+  P10 = 2.321125933898420063925789532045674660756E1L,
+  P9 = 4.114517881637811823002128927449878962058E2L,
+  P8 = 3.824952356185897735160588078446136783779E3L,
+  P7 = 2.128857716871515081352991964243375186031E4L,
+  P6 = 7.594356839258970405033155585486712125861E4L,
+  P5 = 1.797628303815655343403735250238293741397E5L,
+  P4 = 2.854829159639697837788887080758954924001E5L,
+  P3 = 3.007007295140399532324943111654767187848E5L,
+  P2 = 2.014652742082537582487669938141683759923E5L,
+  P1 = 7.771154681358524243729929227226708890930E4L,
+  P0 = 1.313572404063446165910279910527789794488E4L,
+  /* Q12 = 1.000000000000000000000000000000000000000E0L, */
+  Q11 = 4.839208193348159620282142911143429644326E1L,
+  Q10 = 9.104928120962988414618126155557301584078E2L,
+  Q9 = 9.147150349299596453976674231612674085381E3L,
+  Q8 = 5.605842085972455027590989944010492125825E4L,
+  Q7 = 2.248234257620569139969141618556349415120E5L,
+  Q6 = 6.132189329546557743179177159925690841200E5L,
+  Q5 = 1.158019977462989115839826904108208787040E6L,
+  Q4 = 1.514882452993549494932585972882995548426E6L,
+  Q3 = 1.347518538384329112529391120390701166528E6L,
+  Q2 = 7.777690340007566932935753241556479363645E5L,
+  Q1 = 2.626900195321832660448791748036714883242E5L,
+  Q0 = 3.940717212190338497730839731583397586124E4L;
+
+/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
+ * where z = 2(x-1)/(x+1)
+ * 1/sqrt(2) <= x < sqrt(2)
+ * Theoretical peak relative error = 1.1e-35,
+ * relative peak error spread 1.1e-9
+ */
+static const long double
+  R5 = -8.828896441624934385266096344596648080902E-1L,
+  R4 = 8.057002716646055371965756206836056074715E1L,
+  R3 = -2.024301798136027039250415126250455056397E3L,
+  R2 = 2.048819892795278657810231591630928516206E4L,
+  R1 = -8.977257995689735303686582344659576526998E4L,
+  R0 = 1.418134209872192732479751274970992665513E5L,
+  /* S6 = 1.000000000000000000000000000000000000000E0L, */
+  S5 = -1.186359407982897997337150403816839480438E2L,
+  S4 = 3.998526750980007367835804959888064681098E3L,
+  S3 = -5.748542087379434595104154610899551484314E4L,
+  S2 = 4.001557694070773974936904547424676279307E5L,
+  S1 = -1.332535117259762928288745111081235577029E6L,
+  S0 = 1.701761051846631278975701529965589676574E6L;
+
+/* C1 + C2 = ln 2 */
+static const long double C1 = 6.93145751953125E-1L;
+static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
+
+static const long double sqrth = 0.7071067811865475244008443621048490392848L;
+/* ln (2^16384 * (1 - 2^-113)) */
+static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
+static const long double big = 2e300L;
+static const long double zero = 0.0L;
+
+#if 1
+/* Make sure these are prototyped.  */
+long double frexpl (long double, int *);
+long double ldexpl (long double, int);
+#endif
+
+
+long double
+__log1pl (long double xm1)
+{
+  long double x, y, z, r, s;
+  ieee854_long_double_shape_type u;
+  int32_t hx;
+  int e;
+
+  /* Test for NaN or infinity input. */
+  u.value = xm1;
+  hx = u.parts32.w0;
+  if (hx >= 0x7ff00000)
+    return xm1;
+
+  /* log1p(+- 0) = +- 0.  */
+  if (((hx & 0x7fffffff) == 0)
+      && (u.parts32.w1 | (u.parts32.w2 & 0x7fffffff) | u.parts32.w3) == 0)
+    return xm1;
+
+  x = xm1 + 1.0L;
+
+  /* log1p(-1) = -inf */
+  if (x <= 0.0L)
+    {
+      if (x == 0.0L)
+	return (-1.0L / (x - x));
+      else
+	return (zero / (x - x));
+    }
+
+  /* Separate mantissa from exponent.  */
+
+  /* Use frexp used so that denormal numbers will be handled properly.  */
+  x = frexpl (x, &e);
+
+  /* Logarithm using log(x) = z + z^3 P(z^2)/Q(z^2),
+     where z = 2(x-1)/x+1).  */
+  if ((e > 2) || (e < -2))
+    {
+      if (x < sqrth)
+	{			/* 2( 2x-1 )/( 2x+1 ) */
+	  e -= 1;
+	  z = x - 0.5L;
+	  y = 0.5L * z + 0.5L;
+	}
+      else
+	{			/*  2 (x-1)/(x+1)   */
+	  z = x - 0.5L;
+	  z -= 0.5L;
+	  y = 0.5L * x + 0.5L;
+	}
+      x = z / y;
+      z = x * x;
+      r = ((((R5 * z
+	      + R4) * z
+	     + R3) * z
+	    + R2) * z
+	   + R1) * z
+	+ R0;
+      s = (((((z
+	       + S5) * z
+	      + S4) * z
+	     + S3) * z
+	    + S2) * z
+	   + S1) * z
+	+ S0;
+      z = x * (z * r / s);
+      z = z + e * C2;
+      z = z + x;
+      z = z + e * C1;
+      return (z);
+    }
+
+
+  /* Logarithm using log(1+x) = x - .5x^2 + x^3 P(x)/Q(x). */
+
+  if (x < sqrth)
+    {
+      e -= 1;
+      if (e != 0)
+	x = 2.0L * x - 1.0L;	/*  2x - 1  */
+      else
+	x = xm1;
+    }
+  else
+    {
+      if (e != 0)
+	x = x - 1.0L;
+      else
+	x = xm1;
+    }
+  z = x * x;
+  r = (((((((((((P12 * x
+		 + P11) * x
+		+ P10) * x
+	       + P9) * x
+	      + P8) * x
+	     + P7) * x
+	    + P6) * x
+	   + P5) * x
+	  + P4) * x
+	 + P3) * x
+	+ P2) * x
+       + P1) * x
+    + P0;
+  s = (((((((((((x
+		 + Q11) * x
+		+ Q10) * x
+	       + Q9) * x
+	      + Q8) * x
+	     + Q7) * x
+	    + Q6) * x
+	   + Q5) * x
+	  + Q4) * x
+	 + Q3) * x
+	+ Q2) * x
+       + Q1) * x
+    + Q0;
+  y = x * (z * r / s);
+  y = y + e * C2;
+  z = y - 0.5L * z;
+  z = z + x;
+  z = z + e * C1;
+  return (z);
+}
+
+long_double_symbol (libm, __log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
new file mode 100644
index 0000000000..0c61cdae25
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c
@@ -0,0 +1,47 @@
+/* s_logbl.c -- long double version of s_logb.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * long double logbl(x)
+ * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
+ * Use ilogb instead.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+	long double __logbl(long double x)
+#else
+	long double __logbl(x)
+	long double x;
+#endif
+{
+	int64_t lx,hx;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	hx &= 0x7fffffffffffffffLL;		/* high |x| */
+	if((hx|(lx&0x7fffffffffffffffLL))==0) return -1.0/fabs(x);
+	if(hx>=0x7ff0000000000000LL) return x*x;
+	if((hx>>=52)==0) 			/* IEEE 754 logb */
+		return -1022.0;
+	else
+		return (long double) (hx-0x3ff);
+}
+long_double_symbol (libm, __logbl, logbl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
new file mode 100644
index 0000000000..e28934842a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c
@@ -0,0 +1,162 @@
+/* Round to long int long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long
+__lrintl (long double x)
+#else
+long
+__lrintl (x)
+     long double x;
+#endif
+{
+  double xh, xl;
+  long res, hi, lo;
+  int save_round;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Limit the range of values handled by the conversion to long.
+     We do this because we aren't sure whether that conversion properly
+     raises FE_INVALID.  */
+  if (
+#if __LONG_MAX__ == 2147483647
+      __builtin_expect
+      ((__builtin_fabs (xh) <= (double) __LONG_MAX__ + 2), 1)
+#else
+      __builtin_expect
+      ((__builtin_fabs (xh) <= -(double) (-__LONG_MAX__ - 1)), 1)
+#endif
+#if !defined (FE_INVALID)
+      || 1
+#endif
+    )
+    {
+      save_round = fegetround ();
+
+#if __LONG_MAX__ == 2147483647
+      long long llhi = (long long) xh;
+      if (llhi != (long) llhi)
+	hi = llhi < 0 ? -__LONG_MAX__ - 1 : __LONG_MAX__;
+      else
+	hi = llhi;
+      xh -= hi;
+#else
+      if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+	{
+	  /* When XH is 9223372036854775808.0, converting to long long will
+	     overflow, resulting in an invalid operation.  However, XL might
+	     be negative and of sufficient magnitude that the overall long
+	     double is in fact in range.  Avoid raising an exception.  In any
+	     case we need to convert this value specially, because
+	     the converted value is not exactly represented as a double
+	     thus subtracting HI from XH suffers rounding error.  */
+	  hi = __LONG_MAX__;
+	  xh = 1.0;
+	}
+      else
+	{
+	  hi = (long) xh;
+	  xh -= hi;
+	}
+#endif
+      ldbl_canonicalize (&xh, &xl);
+
+      lo = (long) xh;
+
+      /* Peg at max/min values, assuming that the above conversions do so.
+         Strictly speaking, we can return anything for values that overflow,
+         but this is more useful.  */
+      res = hi + lo;
+
+      /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
+      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      hi = res;
+      switch (save_round)
+	{
+	case FE_TONEAREST:
+	  if (fabs (xh) < 0.5
+	      || (fabs (xh) == 0.5
+		  && ((xh > 0.0 && xl < 0.0)
+		      || (xh < 0.0 && xl > 0.0)
+		      || (xl == 0.0 && (res & 1) == 0))))
+	    return res;
+
+	  if (xh < 0.0)
+	    res -= 1;
+	  else
+	    res += 1;
+	  break;
+
+	case FE_TOWARDZERO:
+	  if (res > 0 && (xh < 0.0 || (xh == 0.0 && xl < 0.0)))
+	    res -= 1;
+	  else if (res < 0 && (xh > 0.0 || (xh == 0.0 && xl > 0.0)))
+	    res += 1;
+	  return res;
+	  break;
+
+	case FE_UPWARD:
+	  if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+	    res += 1;
+	  break;
+
+	case FE_DOWNWARD:
+	  if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+	    res -= 1;
+	  break;
+	}
+
+      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      return res;
+    }
+  else
+    {
+      if (xh > 0.0)
+	hi = __LONG_MAX__;
+      else if (xh < 0.0)
+	hi = -__LONG_MAX__ - 1;
+      else
+	/* Nan */
+	hi = 0;
+    }
+
+overflow:
+#ifdef FE_INVALID
+  feraiseexcept (FE_INVALID);
+#endif
+  return hi;
+}
+
+long_double_symbol (libm, __lrintl, lrintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
new file mode 100644
index 0000000000..a5251eece0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c
@@ -0,0 +1,142 @@
+/* Round to long int long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+#ifdef __STDC__
+long
+__lroundl (long double x)
+#else
+long
+__lroundl (x)
+     long double x;
+#endif
+{
+  double xh, xl;
+  long res, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Limit the range of values handled by the conversion to long.
+     We do this because we aren't sure whether that conversion properly
+     raises FE_INVALID.  */
+  if (
+#if __LONG_MAX__ == 2147483647
+      __builtin_expect
+      ((__builtin_fabs (xh) <= (double) __LONG_MAX__ + 2), 1)
+#else
+      __builtin_expect
+      ((__builtin_fabs (xh) <= -(double) (-__LONG_MAX__ - 1)), 1)
+#endif
+#if !defined (FE_INVALID)
+      || 1
+#endif
+    )
+    {
+#if __LONG_MAX__ == 2147483647
+      long long llhi = (long long) xh;
+      if (llhi != (long) llhi)
+	hi = llhi < 0 ? -__LONG_MAX__ - 1 : __LONG_MAX__;
+      else
+	hi = llhi;
+      xh -= hi;
+#else
+      if (__builtin_expect ((xh == -(double) (-__LONG_MAX__ - 1)), 0))
+	{
+	  /* When XH is 9223372036854775808.0, converting to long long will
+	     overflow, resulting in an invalid operation.  However, XL might
+	     be negative and of sufficient magnitude that the overall long
+	     double is in fact in range.  Avoid raising an exception.  In any
+	     case we need to convert this value specially, because
+	     the converted value is not exactly represented as a double
+	     thus subtracting HI from XH suffers rounding error.  */
+	  hi = __LONG_MAX__;
+	  xh = 1.0;
+	}
+      else
+	{
+	  hi = (long) xh;
+	  xh -= hi;
+	}
+#endif
+      ldbl_canonicalize (&xh, &xl);
+
+      lo = (long) xh;
+
+      /* Peg at max/min values, assuming that the above conversions do so.
+         Strictly speaking, we can return anything for values that overflow,
+         but this is more useful.  */
+      res = hi + lo;
+
+      /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi).  */
+      if (__builtin_expect (((~(hi ^ lo) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      hi = res;
+      if (xh > 0.5)
+	{
+	  res += 1;
+	}
+      else if (xh == 0.5)
+	{
+	  if (xl > 0.0 || (xl == 0.0 && res >= 0))
+	    res += 1;
+	}
+      else if (-xh > 0.5)
+	{
+	  res -= 1;
+	}
+      else if (-xh == 0.5)
+	{
+	  if (xl < 0.0 || (xl == 0.0 && res <= 0))
+	    res -= 1;
+	}
+
+      if (__builtin_expect (((~(hi ^ (res - hi)) & (res ^ hi)) < 0), 0))
+	goto overflow;
+
+      return res;
+    }
+  else
+    {
+      if (xh > 0.0)
+	hi = __LONG_MAX__;
+      else if (xh < 0.0)
+	hi = -__LONG_MAX__ - 1;
+      else
+	/* Nan */
+	hi = 0;
+    }
+
+overflow:
+#ifdef FE_INVALID
+  feraiseexcept (FE_INVALID);
+#endif
+  return hi;
+}
+
+long_double_symbol (libm, __lroundl, lroundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_modfl.c b/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
new file mode 100644
index 0000000000..f2e65f0c44
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_modfl.c
@@ -0,0 +1,94 @@
+/* s_modfl.c -- long double version of s_modf.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * modfl(long double x, long double *iptr)
+ * return fraction part of x, and return x's integral part in *iptr.
+ * Method:
+ *	Bit twiddling.
+ *
+ * Exception:
+ *	No exception.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double one = 1.0;
+#else
+static long double one = 1.0;
+#endif
+
+#ifdef __STDC__
+	long double __modfl(long double x, long double *iptr)
+#else
+	long double __modfl(x, iptr)
+	long double x,*iptr;
+#endif
+{
+	int64_t i0,i1,j0;
+	u_int64_t i;
+	GET_LDOUBLE_WORDS64(i0,i1,x);
+	i1 &= 0x000fffffffffffffLL;
+	j0 = ((i0>>52)&0x7ff)-0x3ff;	/* exponent of x */
+	if(j0<52) {			/* integer part in high x */
+	    if(j0<0) {			/* |x|<1 */
+		/* *iptr = +-0 */
+	        SET_LDOUBLE_WORDS64(*iptr,i0&0x8000000000000000ULL,0);
+		return x;
+	    } else {
+		i = (0x000fffffffffffffLL)>>j0;
+		if(((i0&i)|(i1&0x7fffffffffffffffLL))==0) {		/* x is integral */
+		    *iptr = x;
+		    /* return +-0 */
+		    SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+		    return x;
+		} else {
+		    SET_LDOUBLE_WORDS64(*iptr,i0&(~i),0);
+		    return x - *iptr;
+		}
+	    }
+	} else if (j0>103) {		/* no fraction part */
+	    *iptr = x*one;
+	    /* We must handle NaNs separately.  */
+	    if (j0 == 0x400 && ((i0 & 0x000fffffffffffffLL) | i1))
+	      return x*one;
+	    /* return +-0 */
+	    SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+	    return x;
+	} else {			/* fraction part in low x */
+	    i = -1ULL>>(j0-52);
+	    if((i1&i)==0) { 		/* x is integral */
+		*iptr = x;
+		/* return +-0 */
+		SET_LDOUBLE_WORDS64(x,i0&0x8000000000000000ULL,0);
+		return x;
+	    } else {
+		SET_LDOUBLE_WORDS64(*iptr,i0,i1&(~i));
+		return x - *iptr;
+	    }
+	}
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __modfl, modfl);
+#else
+long_double_symbol (libc, __modfl, modfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
new file mode 100644
index 0000000000..2561fda329
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
@@ -0,0 +1,125 @@
+/* Round to int long double floating-point values without raising inexact.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+   when it's coded in C.  */
+
+#include <math.h>
+#include <fenv.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__nearbyintl (long double x)
+#else
+long double
+__nearbyintl (x)
+     long double x;
+#endif
+{
+  fenv_t env;
+  static const long double TWO52 = 4503599627370496.0L;
+  union ibm_extended_long_double u;
+  u.d = x;
+
+  if (fabs (u.dd[0]) < TWO52)
+    {
+      double high = u.dd[0];
+      feholdexcept (&env);
+      if (high > 0.0)
+	{
+	  high += TWO52;
+	  high -= TWO52;
+          if (high == -0.0) high = 0.0;
+	}
+      else if (high < 0.0)
+	{
+	  high -= TWO52;
+	  high += TWO52;
+          if (high == 0.0) high = -0.0;
+	}
+      u.dd[0] = high;
+      u.dd[1] = 0.0;
+      fesetenv (&env);
+    }
+  else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
+    {
+      double high, low, tau;
+      /* In this case we have to round the low double and handle any
+         adjustment to the high double that may be caused by rounding
+         (up).  This is complicated by the fact that the high double
+         may already be rounded and the low double may have the
+         opposite sign to compensate.  */
+      feholdexcept (&env);
+      if (u.dd[0] > 0.0)
+	{
+	  if (u.dd[1] > 0.0)
+	    {
+	      /* If the high/low doubles are the same sign then simply
+	         round the low double.  */
+	      high = u.dd[0];
+	      low = u.dd[1];
+	    }
+	  else if (u.dd[1] < 0.0)
+	    {
+	      /* Else the high double is pre rounded and we need to
+	         adjust for that.  */
+	      
+	      tau = nextafter (u.dd[0], 0.0);
+	      tau = (u.dd[0] - tau) * 2.0;
+	      high = u.dd[0] - tau;
+	      low = u.dd[1] + tau;
+	    }
+	  low += TWO52;
+	  low -= TWO52;
+	}
+      else if (u.dd[0] < 0.0)
+	{
+	  if (u.dd[1] < 0.0)
+	    {
+	      /* If the high/low doubles are the same sign then simply
+	         round the low double.  */
+	      high = u.dd[0];
+	      low = u.dd[1];
+	    }
+	  else if (u.dd[1] > 0.0)
+	    {
+	      /* Else the high double is pre rounded and we need to
+	         adjust for that.  */
+	      tau = nextafter (u.dd[0], 0.0);
+	      tau = (u.dd[0] - tau) * 2.0;
+	      high = u.dd[0] - tau;
+	      low = u.dd[1] + tau;
+	    }
+	  low = TWO52 - low;
+	  low = -(low - TWO52);
+	}
+      u.dd[0] = high + low;
+      u.dd[1] = high - u.dd[0] + low;
+      fesetenv (&env);
+    }
+
+  return u.d;
+}
+
+long_double_symbol (libm, __nearbyintl, nearbyintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
new file mode 100644
index 0000000000..39d0e6a5e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
@@ -0,0 +1,119 @@
+/* s_nextafterl.c -- long double version of s_nextafter.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ *	nextafterl(x,y)
+ *	return the next machine floating-point number of x in the
+ *	direction toward y.
+ *   Special cases:
+ */
+
+#include <math.h>
+#include <math_private.h>
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+	long double __nextafterl(long double x, long double y)
+#else
+	long double __nextafterl(x,y)
+	long double x,y;
+#endif
+{
+	int64_t hx,hy,ihx,ihy,ilx;
+	u_int64_t lx,ly;
+
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	GET_LDOUBLE_WORDS64(hy,ly,y);
+	ihx = hx&0x7fffffffffffffffLL;		/* |hx| */
+	ilx = lx&0x7fffffffffffffffLL;		/* |lx| */
+	ihy = hy&0x7fffffffffffffffLL;		/* |hy| */
+
+	if((((ihx&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
+	    ((ihx&0x000fffffffffffffLL)!=0)) ||   /* x is nan */
+	   (((ihy&0x7ff0000000000000LL)==0x7ff0000000000000LL)&&
+	    ((ihy&0x000fffffffffffffLL)!=0)))     /* y is nan */
+	    return x+y; /* signal the nan */
+	if(x==y)
+	    return y;		/* x=y, return y */
+	if(ihx == 0 && ilx == 0) {			/* x == 0 */
+	    long double u;
+	    hy = (hy & 0x8000000000000000ULL) | 1;
+	    SET_LDOUBLE_WORDS64(x,hy,0ULL);/* return +-minsubnormal */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
+	}
+	
+	long double u;
+	if(x > y) {	/* x > y, x -= ulp */
+	    if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL))
+	      return x+x;	/* overflow, return -inf */
+	    if (hx >= 0x7ff0000000000000LL) {
+	      SET_LDOUBLE_WORDS64(u,0x7fefffffffffffffLL,0x7c8ffffffffffffeLL);
+	      return u;
+	    }
+	    if(ihx <= 0x0360000000000000LL) {  /* x <= LDBL_MIN */
+	      u = math_opt_barrier (x);
+	      x -= __LDBL_DENORM_MIN__;
+	      if (ihx < 0x0360000000000000LL
+		  || (hx > 0 && (int64_t) lx <= 0)
+		  || (hx < 0 && (int64_t) lx > 1)) {
+		u = u * u;
+		math_force_eval (u);		/* raise underflow flag */
+	      }
+	      return x;
+	    }
+	    if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
+	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
+	      u *= 0x1.0000000000000p-105L;
+	    } else
+	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
+	    return x - u;
+	} else {				/* x < y, x += ulp */
+	    if((hx==0x7fefffffffffffffLL)&&(lx==0x7c8ffffffffffffeLL))
+	      return x+x;	/* overflow, return +inf */
+	    if ((u_int64_t) hx >= 0xfff0000000000000ULL) {
+	      SET_LDOUBLE_WORDS64(u,0xffefffffffffffffLL,0xfc8ffffffffffffeLL);
+	      return u;
+	    }
+	    if(ihx <= 0x0360000000000000LL) {  /* x <= LDBL_MIN */
+	      u = math_opt_barrier (x);
+	      x += __LDBL_DENORM_MIN__;
+	      if (ihx < 0x0360000000000000LL
+		  || (hx > 0 && (int64_t) lx < 0 && lx != 0x8000000000000001LL)
+		  || (hx < 0 && (int64_t) lx >= 0)) {
+		u = u * u;
+		math_force_eval (u);		/* raise underflow flag */
+	      }
+	      if (x == 0.0L)	/* handle negative __LDBL_DENORM_MIN__ case */
+		x = -0.0L;
+	      return x;
+	    }
+	    if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
+	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL),0ULL);
+	      u *= 0x1.0000000000000p-105L;
+	    } else
+	      SET_LDOUBLE_WORDS64(u,(hx&0x7ff0000000000000LL)-0x0690000000000000LL,0ULL);
+	    return x + u;
+	}
+}
+strong_alias (__nextafterl, __nexttowardl)
+long_double_symbol (libm, __nextafterl, nextafterl);
+long_double_symbol (libm, __nexttowardl, nexttowardl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
new file mode 100644
index 0000000000..e2f6521f57
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c
@@ -0,0 +1,105 @@
+/* s_nexttoward.c
+ * Conversion from s_nextafter.c by Ulrich Drepper, Cygnus Support,
+ * drepper@cygnus.com and Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/* IEEE functions
+ *	nexttoward(x,y)
+ *	return the next machine floating-point number of x in the
+ *	direction toward y.
+ *   Special cases:
+ */
+
+#include "math.h"
+#include <math_private.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+
+#ifdef __STDC__
+	double __nexttoward(double x, long double y)
+#else
+	double __nexttoward(x,y)
+	double x;
+	long double y;
+#endif
+{
+	int32_t hx,ix;
+	int64_t hy,iy;
+	u_int32_t lx;
+	u_int64_t ly,uly;
+
+	EXTRACT_WORDS(hx,lx,x);
+	GET_LDOUBLE_WORDS64(hy,ly,y);
+	ix = hx&0x7fffffff;		/* |x| */
+	iy = hy&0x7fffffffffffffffLL;	/* |y| */
+	uly = ly&0x7fffffffffffffffLL;	/* |y| */
+
+	if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
+	   ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
+	   						    /* y is nan */
+	   return x+y;
+	if((long double) x==y) return y;	/* x=y, return y */
+	if((ix|lx)==0) {			/* x == 0 */
+	    double u;
+	    INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
+	}
+	if(hx>=0) {				/* x > 0 */
+	    if (hy<0||(ix>>20)>(iy>>52)
+		|| ((ix>>20)==(iy>>52)
+		    && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL)
+			|| (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL)
+			    )))) {	/* x > y, x -= ulp */
+		if(lx==0) hx -= 1;
+		lx -= 1;
+	    } else {				/* x < y, x += ulp */
+		lx += 1;
+		if(lx==0) hx += 1;
+	    }
+	} else {				/* x < 0 */
+	    if (hy>=0||(ix>>20)>(iy>>52)
+		|| ((ix>>20)==(iy>>52)
+		    && (((((int64_t)hx)<<32)|(lx))>(hy&0x000fffffffffffffLL)
+			|| (((((int64_t)hx)<<32)|(lx))==(hy&0x000fffffffffffffLL)
+			   )))) {	/* x < y, x -= ulp */
+		if(lx==0) hx -= 1;
+		lx -= 1;
+	    } else {				/* x > y, x += ulp */
+		lx += 1;
+		if(lx==0) hx += 1;
+	    }
+	}
+	hy = hx&0x7ff00000;
+	if(hy>=0x7ff00000) {
+	  x = x+x;	/* overflow  */
+	  if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
+	    /* Force conversion to double.  */
+	    asm ("" : "+m"(x));
+	  return x;
+	}
+	if(hy<0x00100000) {
+	    double u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
+	}
+	INSERT_WORDS(x,hx,lx);
+	return x;
+}
+long_double_symbol (libm, __nexttoward, nexttoward);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
new file mode 100644
index 0000000000..cf655fad16
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c
@@ -0,0 +1,89 @@
+/* s_nexttowardf.c -- float version of s_nextafter.c.
+ * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com
+ * and Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+#include "math.h"
+#include <math_private.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+
+#ifdef __STDC__
+	float __nexttowardf(float x, long double y)
+#else
+	float __nexttowardf(x,y)
+	float x;
+	long double y;
+#endif
+{
+	int32_t hx,ix;
+	int64_t hy,iy;
+	u_int64_t ly, uly;
+
+	GET_FLOAT_WORD(hx,x);
+	GET_LDOUBLE_WORDS64(hy,ly,y);
+	ix = hx&0x7fffffff;		/* |x| */
+	iy = hy&0x7fffffffffffffffLL;	/* |y| */
+	uly = ly&0x7fffffffffffffffLL;	/* |y| */
+
+	if((ix>0x7f800000) ||   /* x is nan */
+	   ((iy>=0x7ff0000000000000LL)&&((iy-0x7ff0000000000000LL)|uly)!=0))
+				/* y is nan */
+	   return x+y;
+	if((long double) x==y) return y;	/* x=y, return y */
+	if(ix==0) {				/* x == 0 */
+	    float u;
+	    SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
+	}
+	if(hx>=0) {				/* x > 0 */
+	    if(hy<0||(ix>>23)>(iy>>52)-0x380
+	       || ((ix>>23)==(iy>>52)-0x380
+		   && (ix&0x7fffff)>((hy>>29)&0x7fffff))) {/* x > y, x -= ulp */
+		hx -= 1;
+	    } else {				/* x < y, x += ulp */
+		hx += 1;
+	    }
+	} else {				/* x < 0 */
+	    if(hy>=0||(ix>>23)>(iy>>52)-0x380
+	       || ((ix>>23)==(iy>>52)-0x380
+		   && (ix&0x7fffff)>((hy>>29)&0x7fffff))) {/* x < y, x -= ulp */
+		hx -= 1;
+	    } else {				/* x > y, x += ulp */
+		hx += 1;
+	    }
+	}
+	hy = hx&0x7f800000;
+	if(hy>=0x7f800000) {
+	  x = x+x;	/* overflow  */
+	  if (FLT_EVAL_METHOD != 0)
+	    /* Force conversion to float.  */
+	    asm ("" : "+m"(x));
+	  return x;
+	}
+	if(hy<0x00800000) {		/* underflow */
+	    float u = x*x;
+	    math_force_eval (u);	/* raise underflow flag */
+	}
+	SET_FLOAT_WORD(x,hx);
+	return x;
+}
+long_double_symbol (libm, __nexttowardf, nexttowardf);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
new file mode 100644
index 0000000000..ca504a01a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c
@@ -0,0 +1,111 @@
+/* Compute remainder and a congruent to the quotient.
+   Copyright (C) 1997,1999,2002,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+		  Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+
+static const long double zero = 0.0;
+
+
+long double
+__remquol (long double x, long double y, int *quo)
+{
+  int64_t hx,hy;
+  u_int64_t sx,lx,ly,qs;
+  int cquo;
+
+  GET_LDOUBLE_WORDS64 (hx, lx, x);
+  GET_LDOUBLE_WORDS64 (hy, ly, y);
+  sx = hx & 0x8000000000000000ULL;
+  qs = sx ^ (hy & 0x8000000000000000ULL);
+  hy &= 0x7fffffffffffffffLL;
+  hx &= 0x7fffffffffffffffLL;
+
+  /* Purge off exception values.  */
+  if ((hy | (ly & 0x7fffffffffffffff)) == 0)
+    return (x * y) / (x * y); 			/* y = 0 */
+  if ((hx >= 0x7ff0000000000000LL)		/* x not finite */
+      || ((hy >= 0x7ff0000000000000LL)		/* y is NaN */
+	  && (((hy - 0x7ff0000000000000LL) | ly) != 0)))
+    return (x * y) / (x * y);
+
+  if (hy <= 0x7fbfffffffffffffLL)
+    x = __ieee754_fmodl (x, 8 * y);              /* now x < 8y */
+
+  if (((hx - hy) | (lx - ly)) == 0)
+    {
+      *quo = qs ? -1 : 1;
+      return zero * x;
+    }
+
+  x  = fabsl (x);
+  y  = fabsl (y);
+  cquo = 0;
+
+  if (x >= 4 * y)
+    {
+      x -= 4 * y;
+      cquo += 4;
+    }
+  if (x >= 2 * y)
+    {
+      x -= 2 * y;
+      cquo += 2;
+    }
+
+  if (hy < 0x0020000000000000LL)
+    {
+      if (x + x > y)
+	{
+	  x -= y;
+	  ++cquo;
+	  if (x + x >= y)
+	    {
+	      x -= y;
+	      ++cquo;
+	    }
+	}
+    }
+  else
+    {
+      long double y_half = 0.5L * y;
+      if (x > y_half)
+	{
+	  x -= y;
+	  ++cquo;
+	  if (x >= y_half)
+	    {
+	      x -= y;
+	      ++cquo;
+	    }
+	}
+    }
+
+  *quo = qs ? -cquo : cquo;
+
+  if (sx)
+    x = -x;
+  return x;
+}
+long_double_symbol (libm, __remquol, remquol);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
new file mode 100644
index 0000000000..1f4e33f91c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c
@@ -0,0 +1,119 @@
+/* Round to int long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+   when it's coded in C.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__rintl (long double x)
+#else
+long double
+__rintl (x)
+     long double x;
+#endif
+{
+  double xh, xl, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Return Inf, Nan, +/-0 unchanged.  */
+  if (__builtin_expect (xh != 0.0
+			&& __builtin_isless (__builtin_fabs (xh),
+					     __builtin_inf ()), 1))
+    {
+      double orig_xh;
+      int save_round = fegetround ();
+
+      /* Long double arithmetic, including the canonicalisation below,
+	 only works in round-to-nearest mode.  */
+      fesetround (FE_TONEAREST);
+
+      /* Convert the high double to integer.  */
+      orig_xh = xh;
+      hi = ldbl_nearbyint (xh);
+
+      /* Subtract integral high part from the value.  If the low double
+	 happens to be exactly 0.5 or -0.5, you might think that this
+	 subtraction could result in an incorrect conversion.  For
+	 instance, subtracting an odd number would cause this function
+	 to round in the wrong direction.  However, if we have a
+	 canonical long double with the low double 0.5 or -0.5, then the
+	 high double must be even.  */
+      xh -= hi;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Now convert the low double, adjusted for any remainder from the
+	 high double.  */
+      lo = ldbl_nearbyint (xh);
+
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      switch (save_round)
+	{
+	case FE_TONEAREST:
+	  if (xl > 0.0 && xh == 0.5)
+	    lo += 1.0;
+	  else if (xl < 0.0 && -xh == 0.5)
+	    lo -= 1.0;
+	  break;
+
+	case FE_TOWARDZERO:
+	  if (orig_xh < 0.0)
+	    goto do_up;
+	  /* Fall thru */
+
+	case FE_DOWNWARD:
+	  if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+	    lo -= 1.0;
+	  break;
+
+	case FE_UPWARD:
+	do_up:
+	  if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+	    lo += 1.0;
+	  break;
+	}
+
+      /* Ensure the final value is canonical.  In certain cases,
+         rounding causes hi,lo calculated so far to be non-canonical.  */
+      xh = hi;
+      xl = lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Ensure we return -0 rather than +0 when appropriate.  */
+      if (orig_xh < 0.0)
+	xh = -__builtin_fabs (xh);
+
+      fesetround (save_round);
+    }
+
+  return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __rintl, rintl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_roundl.c b/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
new file mode 100644
index 0000000000..0880e6ee22
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
@@ -0,0 +1,98 @@
+/* Round to int long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+   when it's coded in C.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__roundl (long double x)
+#else
+long double
+__roundl (x)
+     long double x;
+#endif
+{
+  double xh, xl, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Return Inf, Nan, +/-0 unchanged.  */
+  if (__builtin_expect (xh != 0.0
+			&& __builtin_isless (__builtin_fabs (xh),
+					     __builtin_inf ()), 1))
+    {
+      double orig_xh;
+      int save_round = fegetround ();
+
+      /* Long double arithmetic, including the canonicalisation below,
+	 only works in round-to-nearest mode.  */
+      fesetround (FE_TONEAREST);
+
+      /* Convert the high double to integer.  */
+      orig_xh = xh;
+      hi = ldbl_nearbyint (xh);
+
+      /* Subtract integral high part from the value.  */
+      xh -= hi;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Now convert the low double, adjusted for any remainder from the
+	 high double.  */
+      lo = ldbl_nearbyint (xh);
+
+      /* Adjust the result when the remainder is exactly 0.5.  nearbyint
+	 rounds values halfway between integers to the nearest even
+	 integer.  roundl must round away from zero.
+	 Also correct cases where nearbyint returns an incorrect value
+	 for LO.  */
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+      if (xh == 0.5)
+	{
+	  if (xl > 0.0 || (xl == 0.0 && orig_xh > 0.0))
+	    lo += 1.0;
+	}
+      else if (-xh == 0.5)
+	{
+	  if (xl < 0.0 || (xl == 0.0 && orig_xh < 0.0))
+	    lo -= 1.0;
+	}
+
+      /* Ensure the final value is canonical.  In certain cases,
+	 rounding causes hi,lo calculated so far to be non-canonical.  */
+      xh = hi;
+      xl = lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      fesetround (save_round);
+    }
+
+  return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __roundl, roundl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
new file mode 100644
index 0000000000..3a1ba07f2c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c
@@ -0,0 +1,105 @@
+/* s_scalblnl.c -- long double version of s_scalbln.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/* @(#)s_scalbln.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * scalblnl (long double x, long int n)
+ * scalblnl(x,n) returns x* 2**n  computed by  exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */
+huge   = 1.0E+300L,
+tiny   = 1.0E-300L;
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+#ifdef __STDC__
+	long double __scalblnl (long double x, long int n)
+#else
+	long double __scalblnl (x,n)
+	long double x; long int n;
+#endif
+{
+	int64_t k,l,hx,lx;
+	union { int64_t i; double d; } u;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	k = (hx>>52)&0x7ff;		/* extract exponent */
+	l = (lx>>52)&0x7ff;
+	if (k==0) {				/* 0 or subnormal x */
+	    if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
+	    u.i = hx;
+	    u.d *= two54;
+	    hx = u.i;
+	    k = ((hx>>52)&0x7ff) - 54;
+	}
+	else if (k==0x7ff) return x+x;		/* NaN or Inf */
+	k = k+n;
+	if (n> 50000 || k > 0x7fe)
+	  return huge*__copysignl(huge,x); /* overflow */
+	if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */
+	if (k > 0) {				/* normal result */
+	    hx = (hx&0x800fffffffffffffULL)|(k<<52);
+	    if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
+	    	SET_LDOUBLE_WORDS64(x,hx,lx);
+	    	return x;
+	    }
+	    if (l == 0) { /* low part subnormal */
+	    	u.i = lx;
+	    	u.d *= two54;
+	    	lx = u.i;
+	    	l = ((lx>>52)&0x7ff) - 54;
+	    }
+	    l = l + n;
+	    if (l > 0)
+		lx = (lx&0x800fffffffffffffULL)|(l<<52);
+	    else if (l <= -54)
+		lx = (lx&0x8000000000000000ULL);
+	    else {
+	    	l += 54;
+	    	u.i = (lx&0x800fffffffffffffULL)|(l<<52);
+	    	u.d *= twom54;
+	    	lx = u.i;
+	    }
+	    SET_LDOUBLE_WORDS64(x,hx,lx);
+	    return x;
+	}
+	if (k <= -54)
+	  return tiny*__copysignl(tiny,x); 	/*underflow*/
+	k += 54;				/* subnormal result */
+	lx &= 0x8000000000000000ULL;
+	SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
+	return x*twolm54;
+}
+long_double_symbol (libm, __scalblnl, scalblnl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
new file mode 100644
index 0000000000..50bd8cb0b6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c
@@ -0,0 +1,109 @@
+/* s_scalbnl.c -- long double version of s_scalbn.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/* @(#)s_scalbn.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: $";
+#endif
+
+/*
+ * scalbnl (long double x, int n)
+ * scalbnl(x,n) returns x* 2**n  computed by  exponent
+ * manipulation rather than by actually performing an
+ * exponentiation or a multiplication.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double
+#else
+static long double
+#endif
+twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */
+huge   = 1.0E+300L,
+tiny   = 1.0E-300L;
+#ifdef __STDC__
+static const double
+#else
+static double
+#endif
+two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */
+twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */
+
+#ifdef __STDC__
+	long double __scalbnl (long double x, int n)
+#else
+	long double __scalbnl (x,n)
+	long double x; int n;
+#endif
+{
+	int64_t k,l,hx,lx;
+	union { int64_t i; double d; } u;
+	GET_LDOUBLE_WORDS64(hx,lx,x);
+	k = (hx>>52)&0x7ff;		/* extract exponent */
+	l = (lx>>52)&0x7ff;
+	if (k==0) {				/* 0 or subnormal x */
+	    if (((hx|lx)&0x7fffffffffffffffULL)==0) return x; /* +-0 */
+	    u.i = hx;
+	    u.d *= two54;
+	    hx = u.i;
+	    k = ((hx>>52)&0x7ff) - 54;
+	}
+	else if (k==0x7ff) return x+x;		/* NaN or Inf */
+	k = k+n;
+	if (n> 50000 || k > 0x7fe)
+	  return huge*__copysignl(huge,x); /* overflow */
+	if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */
+	if (k > 0) {				/* normal result */
+	    hx = (hx&0x800fffffffffffffULL)|(k<<52);
+	    if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */
+	    	SET_LDOUBLE_WORDS64(x,hx,lx);
+	    	return x;
+	    }
+	    if (l == 0) { /* low part subnormal */
+	    	u.i = lx;
+	    	u.d *= two54;
+	    	lx = u.i;
+	    	l = ((lx>>52)&0x7ff) - 54;
+	    }
+	    l = l + n;
+	    if (l > 0)
+		lx = (lx&0x800fffffffffffffULL)|(l<<52);
+	    else if (l <= -54)
+		lx = (lx&0x8000000000000000ULL);
+	    else {
+	    	l += 54;
+	    	u.i = (lx&0x800fffffffffffffULL)|(l<<52);
+	    	u.d *= twom54;
+	    	lx = u.i;
+	    }
+	    SET_LDOUBLE_WORDS64(x,hx,lx);
+	    return x;
+	}
+	if (k <= -54)
+	  return tiny*__copysignl(tiny,x); 	/*underflow*/
+	k += 54;				/* subnormal result */
+	lx &= 0x8000000000000000ULL;
+	SET_LDOUBLE_WORDS64(x,(hx&0x800fffffffffffffULL)|(k<<52),lx);
+	return x*twolm54;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalbnl, scalbnl);
+#else
+long_double_symbol (libc, __scalbnl, scalbnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
new file mode 100644
index 0000000000..b4285461b2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c
@@ -0,0 +1,37 @@
+/* Return nonzero value if number is negative.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+int
+___signbitl (long double x)
+{
+  int64_t e;
+
+  GET_LDOUBLE_MSW64 (e, x);
+  return e < 0;
+}
+#ifdef IS_IN_libm
+long_double_symbol (libm, ___signbitl, __signbitl);
+#else
+long_double_symbol (libc, ___signbitl, __signbitl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
new file mode 100644
index 0000000000..1d3d7a4d0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c
@@ -0,0 +1,72 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997,1999,2004,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and
+		  Jakub Jelinek <jj@ultra.linux.cz>.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+void
+__sincosl (long double x, long double *sinx, long double *cosx)
+{
+  int64_t ix;
+
+  /* High word of x. */
+  GET_LDOUBLE_MSW64 (ix, x);
+
+  /* |x| ~< pi/4 */
+  ix &= 0x7fffffffffffffffLL;
+  if (ix <= 0x3fe921fb54442d10LL)
+    __kernel_sincosl (x, 0.0L, sinx, cosx, 0);
+  else if (ix >= 0x7ff0000000000000LL)
+    {
+      /* sin(Inf or NaN) is NaN */
+      *sinx = *cosx = x - x;
+    }
+  else
+    {
+      /* Argument reduction needed.  */
+      long double y[2];
+      int n;
+
+      n = __ieee754_rem_pio2l (x, y);
+      switch (n & 3)
+	{
+	case 0:
+	  __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
+	  break;
+	case 1:
+	  __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
+	  *cosx = -*cosx;
+	  break;
+	case 2:
+	  __kernel_sincosl (y[0], y[1], sinx, cosx, 1);
+	  *sinx = -*sinx;
+	  *cosx = -*cosx;
+	  break;
+	default:
+	  __kernel_sincosl (y[0], y[1], cosx, sinx, 1);
+	  *sinx = -*sinx;
+	  break;
+	}
+    }
+}
+long_double_symbol (libm, __sincosl, sincosl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sinl.c b/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
new file mode 100644
index 0000000000..8cc592c612
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
@@ -0,0 +1,84 @@
+/* s_sinl.c -- long double version of s_sin.c.
+ * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* sinl(x)
+ * Return sine function of x.
+ *
+ * kernel function:
+ *	__kernel_sinl		... sine function on [-pi/4,pi/4]
+ *	__kernel_cosl		... cose function on [-pi/4,pi/4]
+ *	__ieee754_rem_pio2l	... argument reduction routine
+ *
+ * Method.
+ *      Let S,C and T denote the sin, cos and tan respectively on
+ *	[-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ *	in [-pi/4 , +pi/4], and let n = k mod 4.
+ *	We have
+ *
+ *          n        sin(x)      cos(x)        tan(x)
+ *     ----------------------------------------------------------
+ *	    0	       S	   C		 T
+ *	    1	       C	  -S		-1/T
+ *	    2	      -S	  -C		 T
+ *	    3	      -C	   S		-1/T
+ *     ----------------------------------------------------------
+ *
+ * Special cases:
+ *      Let trig be any of sin, cos, or tan.
+ *      trig(+-INF)  is NaN, with signals;
+ *      trig(NaN)    is that NaN;
+ *
+ * Accuracy:
+ *	TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+	long double __sinl(long double x)
+#else
+	long double __sinl(x)
+	long double x;
+#endif
+{
+	long double y[2],z=0.0L;
+	int64_t n, ix;
+
+    /* High word of x. */
+	GET_LDOUBLE_MSW64(ix,x);
+
+    /* |x| ~< pi/4 */
+	ix &= 0x7fffffffffffffffLL;
+	if(ix <= 0x3fe921fb54442d10LL)
+	  return __kernel_sinl(x,z,0);
+
+    /* sin(Inf or NaN) is NaN */
+	else if (ix>=0x7ff0000000000000LL) return x-x;
+
+    /* argument reduction needed */
+	else {
+	    n = __ieee754_rem_pio2l(x,y);
+	    switch(n&3) {
+		case 0: return  __kernel_sinl(y[0],y[1],1);
+		case 1: return  __kernel_cosl(y[0],y[1]);
+		case 2: return -__kernel_sinl(y[0],y[1],1);
+		default:
+			return -__kernel_cosl(y[0],y[1]);
+	    }
+	}
+}
+long_double_symbol (libm, __sinl, sinl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
new file mode 100644
index 0000000000..851ca125f6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c
@@ -0,0 +1,90 @@
+/* @(#)s_tanh.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $";
+#endif
+
+/* Tanh(x)
+ * Return the Hyperbolic Tangent of x
+ *
+ * Method :
+ *				       x    -x
+ *				      e  - e
+ *	0. tanh(x) is defined to be -----------
+ *				       x    -x
+ *				      e  + e
+ *	1. reduce x to non-negative by tanh(-x) = -tanh(x).
+ *	2.  0      <= x <= 2**-57 : tanh(x) := x*(one+x)
+ *					        -t
+ *	    2**-57 <  x <=  1     : tanh(x) := -----; t = expm1(-2x)
+ *					       t + 2
+ *						     2
+ *	    1      <= x <=  22.0  : tanh(x) := 1-  ----- ; t=expm1(2x)
+ *						   t + 2
+ *	    22.0   <  x <= INF    : tanh(x) := 1.
+ *
+ * Special cases:
+ *	tanh(NaN) is NaN;
+ *	only tanh(0)=0 is exact for finite argument.
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+static const long double one=1.0L, two=2.0L, tiny = 1.0e-300L;
+#else
+static long double one=1.0L, two=2.0L, tiny = 1.0e-300L;
+#endif
+
+#ifdef __STDC__
+	long double __tanhl(long double x)
+#else
+	long double __tanhl(x)
+	long double x;
+#endif
+{
+	long double t,z;
+	int64_t jx,ix,lx;
+
+    /* High word of |x|. */
+	GET_LDOUBLE_WORDS64(jx,lx,x);
+	ix = jx&0x7fffffffffffffffLL;
+
+    /* x is INF or NaN */
+	if(ix>=0x7ff0000000000000LL) {
+	    if (jx>=0) return one/x+one;    /* tanh(+-inf)=+-1 */
+	    else       return one/x-one;    /* tanh(NaN) = NaN */
+	}
+
+    /* |x| < 22 */
+	if (ix < 0x4036000000000000LL) {		/* |x|<22 */
+	    if ((ix | (lx&0x7fffffffffffffffLL)) == 0)
+		return x;		/* x == +-0 */
+	    if (ix<0x3c60000000000000LL) 	/* |x|<2**-57 */
+		return x*(one+x);    	/* tanh(small) = small */
+	    if (ix>=0x3ff0000000000000LL) {	/* |x|>=1  */
+		t = __expm1l(two*fabsl(x));
+		z = one - two/(t+two);
+	    } else {
+	        t = __expm1l(-two*fabsl(x));
+	        z= -t/(t+two);
+	    }
+    /* |x| > 22, return +-1 */
+	} else {
+	    z = one - tiny;		/* raised inexact flag */
+	}
+	return (jx>=0)? z: -z;
+}
+long_double_symbol (libm, __tanhl, tanhl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
new file mode 100644
index 0000000000..ea5a7f0ffb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
@@ -0,0 +1,78 @@
+/* s_tanl.c -- long double version of s_tan.c.
+ * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
+ */
+
+/* @(#)s_tan.c 5.1 93/09/24 */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* tanl(x)
+ * Return tangent function of x.
+ *
+ * kernel function:
+ *	__kernel_tanl		... tangent function on [-pi/4,pi/4]
+ *	__ieee754_rem_pio2l	... argument reduction routine
+ *
+ * Method.
+ *      Let S,C and T denote the sin, cos and tan respectively on
+ *	[-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2
+ *	in [-pi/4 , +pi/4], and let n = k mod 4.
+ *	We have
+ *
+ *          n        sin(x)      cos(x)        tan(x)
+ *     ----------------------------------------------------------
+ *	    0	       S	   C		 T
+ *	    1	       C	  -S		-1/T
+ *	    2	      -S	  -C		 T
+ *	    3	      -C	   S		-1/T
+ *     ----------------------------------------------------------
+ *
+ * Special cases:
+ *      Let trig be any of sin, cos, or tan.
+ *      trig(+-INF)  is NaN, with signals;
+ *      trig(NaN)    is that NaN;
+ *
+ * Accuracy:
+ *	TRIG(x) returns trig(x) nearly rounded
+ */
+
+#include "math.h"
+#include "math_private.h"
+#include <math_ldbl_opt.h>
+
+#ifdef __STDC__
+	long double __tanl(long double x)
+#else
+	long double __tanl(x)
+	long double x;
+#endif
+{
+	long double y[2],z=0.0L;
+	int64_t n, ix;
+
+    /* High word of x. */
+	GET_LDOUBLE_MSW64(ix,x);
+
+    /* |x| ~< pi/4 */
+	ix &= 0x7fffffffffffffffLL;
+	if(ix <= 0x3fe921fb54442d10LL) return __kernel_tanl(x,z,1);
+
+    /* tanl(Inf or NaN) is NaN */
+	else if (ix>=0x7ff0000000000000LL) return x-x;		/* NaN */
+
+    /* argument reduction needed */
+	else {
+	    n = __ieee754_rem_pio2l(x,y);
+	    return __kernel_tanl(y[0],y[1],1-((n&1)<<1)); /*   1 -- n even
+							-1 -- n odd */
+	}
+}
+long_double_symbol (libm, __tanl, tanl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_truncl.c b/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
new file mode 100644
index 0000000000..d7bc47ee0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
@@ -0,0 +1,102 @@
+/* Truncate (toward zero) long double floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This has been coded in assembler because GCC makes such a mess of it
+   when it's coded in C.  */
+
+#include <math.h>
+#include <fenv_libc.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+#include <ieee754.h>
+
+
+#ifdef __STDC__
+long double
+__truncl (long double x)
+#else
+long double
+__truncl (x)
+     long double x;
+#endif
+{
+  double xh, xl, hi, lo;
+
+  ldbl_unpack (x, &xh, &xl);
+
+  /* Return Inf, Nan, +/-0 unchanged.  */
+  if (__builtin_expect (xh != 0.0
+			&& __builtin_isless (__builtin_fabs (xh),
+					     __builtin_inf ()), 1))
+    {
+      double orig_xh;
+      int save_round = fegetround ();
+
+      /* Long double arithmetic, including the canonicalisation below,
+	 only works in round-to-nearest mode.  */
+      fesetround (FE_TONEAREST);
+
+      /* Convert the high double to integer.  */
+      orig_xh = xh;
+      hi = ldbl_nearbyint (xh);
+
+      /* Subtract integral high part from the value.  */
+      xh -= hi;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Now convert the low double, adjusted for any remainder from the
+         high double.  */
+      lo = ldbl_nearbyint (xh);
+
+      /* Adjust the result when the remainder is non-zero.  nearbyint
+         rounds values to the nearest integer, and values halfway
+         between integers to the nearest even integer.  floorl must
+         round towards -Inf.  */
+      xh -= lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      if (orig_xh < 0.0)
+	{
+	  if (xh > 0.0 || (xh == 0.0 && xl > 0.0))
+	    lo += 1.0;
+	}
+      else
+	{
+	  if (xh < 0.0 || (xh == 0.0 && xl < 0.0))
+	    lo -= 1.0;
+	}
+
+      /* Ensure the final value is canonical.  In certain cases,
+         rounding causes hi,lo calculated so far to be non-canonical.  */
+      xh = hi;
+      xl = lo;
+      ldbl_canonicalize (&xh, &xl);
+
+      /* Ensure we return -0 rather than +0 when appropriate.  */
+      if (orig_xh < 0.0)
+	xh = -__builtin_fabs (xh);
+
+      fesetround (save_round);
+    }
+
+  return ldbl_pack (xh, xl);
+}
+
+long_double_symbol (libm, __truncl, truncl);
diff --git a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
new file mode 100644
index 0000000000..d558b00d4a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1999, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <xlocale.h>
+
+/* The actual implementation for all floating point sizes is in strtod.c.
+   These macros tell it to produce the `long double' version, `strtold'.  */
+
+#define FLOAT		long double
+#define FLT		LDBL
+#ifdef USE_WIDE_CHAR
+extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
+# define STRTOF		__new_wcstold_l
+# define __STRTOF	____new_wcstold_l
+# define ____STRTOF_INTERNAL ____wcstold_l_internal
+#else
+extern long double ____new_strtold_l (const char *, char **, __locale_t);
+# define STRTOF		__new_strtold_l
+# define __STRTOF	____new_strtold_l
+# define ____STRTOF_INTERNAL ____strtold_l_internal
+#endif
+#define MPN2FLOAT	__mpn_construct_long_double
+#define FLOAT_HUGE_VAL	HUGE_VALL
+# define SET_MANTISSA(flt, mant) \
+  do { union ibm_extended_long_double u;				      \
+       u.d = (flt);							      \
+       if ((mant & 0xfffffffffffffULL) == 0)				      \
+	 mant = 0x8000000000000ULL;					      \
+       u.ieee.mantissa0 = ((mant) >> 32) & 0xfffff;			      \
+       u.ieee.mantissa1 = (mant) & 0xffffffff;				      \
+       (flt) = u.d;							      \
+  } while (0)
+
+#include <strtod_l.c>
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <math_ldbl_opt.h>
+# ifdef USE_WIDE_CHAR
+long_double_symbol (libc, __new_wcstold_l, wcstold_l);
+long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
+# else
+long_double_symbol (libc, __new_strtold_l, strtold_l);
+long_double_symbol (libc, ____new_strtold_l, __strtold_l);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c
new file mode 100644
index 0000000000..4c92a0da20
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c
@@ -0,0 +1,694 @@
+/* Quad-precision floating point sine and cosine tables.
+   Copyright (C) 1999,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jj@ultra.linux.cz>
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* For 0.1484375 + n/128.0, n=0..82 this table contains
+   first 113 bits of cosine, then at least 113 additional
+   bits and the same for sine.
+   0.1484375+82.0/128.0 is the smallest number among above defined numbers
+   larger than pi/4.
+   Computed using gmp.
+ */
+
+const long double __sincosl_table[] = {
+
+/* x =  1.48437500000000000000000000000000000e-01L 3ffc3000000000000000000000000000 */
+/* cos(x) = 0.fd2f5320e1b790209b4dda2f98 f79caaa7b873aff1014b0fbc52 43766d03cb006bc837c4358 */
+ 0x0.fd2f5320e1b790209b4dda2f98p0L,
+ 0x0.f79caaa7b873aff1014b0fbc52p-104L,
+/* sin(x) = 0.25dc50bc95711d0d9787d108fd 438cf5959ee0bfb7a1e36e8b1a 112968f356657420e9cc9ea */
+ 0x0.25dc50bc95711d0d9787d108fdp0L,
+ 0x0.438cf5959ee0bfb7a1e36e8b1ap-104L,
+
+/* x = 1.56250000000000000000000000000000000e-01 3ffc4000000000000000000000000000 */
+/* cos(x) = 0.fce1a053e621438b6d60c76e8c 45bf0a9dc71aa16f922acc10e9 5144ec796a249813c9cb649 */
+ 0x0.fce1a053e621438b6d60c76e8cp0L,
+ 0x0.45bf0a9dc71aa16f922acc10e9p-104L,
+/* sin(x) = 0.27d66258bacd96a3eb335b365c 87d59438c5142bb56a489e9b8d b9d36234ffdebb6bdc22d8e */
+ 0x0.27d66258bacd96a3eb335b365cp0L,
+ 0x0.87d59438c5142bb56a489e9b8dp-104L,
+
+/* x = 1.64062500000000000000000000000000000e-01 3ffc5000000000000000000000000000 */
+/* cos(x) = 0.fc8ffa01ba6807417e05962b0d 9fdf1fddb0cc4c07d22e19e080 19bffa50a6c7acdb40307a3 */
+ 0x0.fc8ffa01ba6807417e05962b0dp0L,
+ 0x0.9fdf1fddb0cc4c07d22e19e080p-104L,
+/* sin(x) = 0.29cfd49b8be4f665276cab01cb f0426934906c3dd105473b226e 410b1450f62e53ff7c6cce1 */
+ 0x0.29cfd49b8be4f665276cab01cbp0L,
+ 0x0.f0426934906c3dd105473b226ep-104L,
+
+/* x = 1.71875000000000000000000000000000000e-01 3ffc6000000000000000000000000000 */
+/* cos(x) = 0.fc3a6170f767ac735d63d99a9d 439e1db5e59d3ef153a4265d58 55850ed82b536bf361b80e3 */
+ 0x0.fc3a6170f767ac735d63d99a9dp0L,
+ 0x0.439e1db5e59d3ef153a4265d58p-104L,
+/* sin(x) = 0.2bc89f9f424de5485de7ce03b2 514952b9faf5648c3244d4736f eb95dbb9da49f3b58a9253b */
+ 0x0.2bc89f9f424de5485de7ce03b2p0L,
+ 0x0.514952b9faf5648c3244d4736fp-104L,
+
+/* x = 1.79687500000000000000000000000000000e-01 3ffc7000000000000000000000000000 */
+/* cos(x) = 0.fbe0d7f7fef11e70aa43b8abf4 f6a457cea20c8f3f676b47781f 9821bbe9ce04b3c7b981c0b */
+ 0x0.fbe0d7f7fef11e70aa43b8abf4p0L,
+ 0x0.f6a457cea20c8f3f676b47781fp-104L,
+/* sin(x) = 0.2dc0bb80b49a97ffb34e8dd1f8 db9df7af47ed2dcf58b12c8e78 27e048cae929da02c04ecac */
+ 0x0.2dc0bb80b49a97ffb34e8dd1f8p0L,
+ 0x0.db9df7af47ed2dcf58b12c8e78p-104L,
+
+/* x = 1.87500000000000000000000000000000000e-01 3ffc8000000000000000000000000000 */
+/* cos(x) = 0.fb835efcf670dd2ce6fe792469 7eea13ea358867e9cdb3899b78 3f4f9f43aa5626e8b67b3bc */
+ 0x0.fb835efcf670dd2ce6fe792469p0L,
+ 0x0.7eea13ea358867e9cdb3899b78p-104L,
+/* sin(x) = 0.2fb8205f75e56a2b56a1c4792f 856258769af396e0189ef72c05 e4df59a6b00e4b44a6ea515 */
+ 0x0.2fb8205f75e56a2b56a1c4792fp0L,
+ 0x0.856258769af396e0189ef72c05p-104L,
+
+/* x = 1.95312500000000000000000000000000000e-01 3ffc9000000000000000000000000000 */
+/* cos(x) = 0.fb21f7f5c156696b00ac1fe28a c5fd76674a92b4df80d9c8a46c 684399005deccc41386257c */
+ 0x0.fb21f7f5c156696b00ac1fe28ap0L,
+ 0x0.c5fd76674a92b4df80d9c8a46cp-104L,
+/* sin(x) = 0.31aec65df552876f82ece9a235 6713246eba6799983d7011b0b3 698d6e1da919c15d57c30c1 */
+ 0x0.31aec65df552876f82ece9a235p0L,
+ 0x0.6713246eba6799983d7011b0b3p-104L,
+
+/* x = 2.03125000000000000000000000000000000e-01 3ffca000000000000000000000000000 */
+/* cos(x) = 0.fabca467fb3cb8f1d069f01d8e a33ade5bfd68296ecd1cc9f7b7 609bbcf3676e726c3301334 */
+ 0x0.fabca467fb3cb8f1d069f01d8ep0L,
+ 0x0.a33ade5bfd68296ecd1cc9f7b7p-104L,
+/* sin(x) = 0.33a4a5a19d86246710f602c44d f4fa513f4639ce938477aeeabb 82e8e0a7ed583a188879fd4 */
+ 0x0.33a4a5a19d86246710f602c44dp0L,
+ 0x0.f4fa513f4639ce938477aeeabbp-104L,
+
+/* x = 2.10937500000000000000000000000000000e-01 3ffcb000000000000000000000000000 */
+/* cos(x) = 0.fa5365e8f1d3ca27be1db5d76a e64d983d7470a4ab0f4ccf65a2 b8c67a380df949953a09bc1 */
+ 0x0.fa5365e8f1d3ca27be1db5d76ap0L,
+ 0x0.e64d983d7470a4ab0f4ccf65a2p-104L,
+/* sin(x) = 0.3599b652f40ec999df12a0a4c8 561de159c98d4e54555de518b9 7f48886f715d8df5f4f093e */
+ 0x0.3599b652f40ec999df12a0a4c8p0L,
+ 0x0.561de159c98d4e54555de518b9p-104L,
+
+/* x = 2.18750000000000000000000000000000000e-01 3ffcc000000000000000000000000000 */
+/* cos(x) = 0.f9e63e1d9e8b6f6f2e296bae5b 5ed9c11fd7fa2fe11e09fc7bde 901abed24b6365e72f7db4e */
+ 0x0.f9e63e1d9e8b6f6f2e296bae5bp0L,
+ 0x0.5ed9c11fd7fa2fe11e09fc7bdep-104L,
+/* sin(x) = 0.378df09db8c332ce0d2b53d865 582e4526ea336c768f68c32b49 6c6d11c1cd241bb9f1da523 */
+ 0x0.378df09db8c332ce0d2b53d865p0L,
+ 0x0.582e4526ea336c768f68c32b49p-104L,
+
+/* x = 2.26562500000000000000000000000000000e-01 3ffcd000000000000000000000000000 */
+/* cos(x) = 0.f9752eba9fff6b98842beadab0 54a932fb0f8d5b875ae63d6b22 88d09b148921aeb6e52f61b */
+ 0x0.f9752eba9fff6b98842beadab0p0L,
+ 0x0.54a932fb0f8d5b875ae63d6b22p-104L,
+/* sin(x) = 0.39814cb10513453cb97b21bc1c a6a337b150c21a675ab85503bc 09a436a10ab1473934e20c8 */
+ 0x0.39814cb10513453cb97b21bc1cp0L,
+ 0x0.a6a337b150c21a675ab85503bcp-104L,
+
+/* x = 2.34375000000000000000000000000000000e-01 3ffce000000000000000000000000000 */
+/* cos(x) = 0.f90039843324f9b940416c1984 b6cbed1fc733d97354d4265788 a86150493ce657cae032674 */
+ 0x0.f90039843324f9b940416c1984p0L,
+ 0x0.b6cbed1fc733d97354d4265788p-104L,
+/* sin(x) = 0.3b73c2bf6b4b9f668ef9499c81 f0d965087f1753fa64b086e58c b8470515c18c1412f8c2e02 */
+ 0x0.3b73c2bf6b4b9f668ef9499c81p0L,
+ 0x0.f0d965087f1753fa64b086e58cp-104L,
+
+/* x = 2.42187500000000000000000000000000000e-01 3ffcf000000000000000000000000000 */
+/* cos(x) = 0.f887604e2c39dbb20e4ec58250 59a789ffc95b275ad9954078ba 8a28d3fcfe9cc2c1d49697b */
+ 0x0.f887604e2c39dbb20e4ec58250p0L,
+ 0x0.59a789ffc95b275ad9954078bap-104L,
+/* sin(x) = 0.3d654aff15cb457a0fca854698 aba33039a8a40626609204472d 9d40309b626eccc6dff0ffa */
+ 0x0.3d654aff15cb457a0fca854698p0L,
+ 0x0.aba33039a8a40626609204472dp-104L,
+
+/* x = 2.50000000000000000000000000000000000e-01 3ffd0000000000000000000000000000 */
+/* cos(x) = 0.f80aa4fbef750ba783d33cb95f 94f8a41426dbe79edc4a023ef9 ec13c944551c0795b84fee1 */
+ 0x0.f80aa4fbef750ba783d33cb95fp0L,
+ 0x0.94f8a41426dbe79edc4a023ef9p-104L,
+/* sin(x) = 0.3f55dda9e62aed7513bd7b8e6a 3d1635dd5676648d7db525898d 7086af9330f03c7f285442a */
+ 0x0.3f55dda9e62aed7513bd7b8e6ap0L,
+ 0x0.3d1635dd5676648d7db525898dp-104L,
+
+/* x = 2.57812500000000000000000000000000000e-01 3ffd0800000000000000000000000000 */
+/* cos(x) = 0.f78a098069792daabc9ee42591 b7c5a68cb1ab822aeb446b3311 b4ba5371b8970e2c1547ad7 */
+ 0x0.f78a098069792daabc9ee42591p0L,
+ 0x0.b7c5a68cb1ab822aeb446b3311p-104L,
+/* sin(x) = 0.414572fd94556e6473d6202713 88dd47c0ba050cdb5270112e3e 370e8c4705ae006426fb5d5 */
+ 0x0.414572fd94556e6473d6202713p0L,
+ 0x0.88dd47c0ba050cdb5270112e3ep-104L,
+
+/* x = 2.65625000000000000000000000000000000e-01 3ffd1000000000000000000000000000 */
+/* cos(x) = 0.f7058fde0788dfc805b8fe8878 9e4f4253e3c50afe8b22f41159 620ab5940ff7df9557c0d1f */
+ 0x0.f7058fde0788dfc805b8fe8878p0L,
+ 0x0.9e4f4253e3c50afe8b22f41159p-104L,
+/* sin(x) = 0.4334033bcd90d6604f5f36c1d4 b84451a87150438275b77470b5 0e5b968fa7962b5ffb379b7 */
+ 0x0.4334033bcd90d6604f5f36c1d4p0L,
+ 0x0.b84451a87150438275b77470b5p-104L,
+
+/* x = 2.73437500000000000000000000000000000e-01 3ffd1800000000000000000000000000 */
+/* cos(x) = 0.f67d3a26af7d07aa4bd6d42af8 c0067fefb96d5b46c031eff536 27f215ea3242edc3f2e13eb */
+ 0x0.f67d3a26af7d07aa4bd6d42af8p0L,
+ 0x0.c0067fefb96d5b46c031eff536p-104L,
+/* sin(x) = 0.452186aa5377ab20bbf2524f52 e3a06a969f47166ab88cf88c11 1ad12c55941021ef3317a1a */
+ 0x0.452186aa5377ab20bbf2524f52p0L,
+ 0x0.e3a06a969f47166ab88cf88c11p-104L,
+
+/* x = 2.81250000000000000000000000000000000e-01 3ffd2000000000000000000000000000 */
+/* cos(x) = 0.f5f10a7bb77d3dfa0c1da8b578 42783280d01ce3c0f82bae3b9d 623c168d2e7c29977994451 */
+ 0x0.f5f10a7bb77d3dfa0c1da8b578p0L,
+ 0x0.42783280d01ce3c0f82bae3b9dp-104L,
+/* sin(x) = 0.470df5931ae1d946076fe0dcff 47fe31bb2ede618ebc607821f8 462b639e1f4298b5ae87fd3 */
+ 0x0.470df5931ae1d946076fe0dcffp0L,
+ 0x0.47fe31bb2ede618ebc607821f8p-104L,
+
+/* x = 2.89062500000000000000000000000000000e-01 3ffd2800000000000000000000000000 */
+/* cos(x) = 0.f561030ddd7a78960ea9f4a32c 6521554995667f5547bafee9ec 48b3155cdb0f7fd00509713 */
+ 0x0.f561030ddd7a78960ea9f4a32cp0L,
+ 0x0.6521554995667f5547bafee9ecp-104L,
+/* sin(x) = 0.48f948446abcd6b0f7fccb100e 7a1b26eccad880b0d24b59948c 7cdd49514d44b933e6985c2 */
+ 0x0.48f948446abcd6b0f7fccb100ep0L,
+ 0x0.7a1b26eccad880b0d24b59948cp-104L,
+
+/* x = 2.96875000000000000000000000000000000e-01 3ffd3000000000000000000000000000 */
+/* cos(x) = 0.f4cd261d3e6c15bb369c875863 0d2ac00b7ace2a51c0631bfeb3 9ed158ba924cc91e259c195 */
+ 0x0.f4cd261d3e6c15bb369c875863p0L,
+ 0x0.0d2ac00b7ace2a51c0631bfeb3p-104L,
+/* sin(x) = 0.4ae37710fad27c8aa9c4cf96c0 3519b9ce07dc08a1471775499f 05c29f86190aaebaeb9716e */
+ 0x0.4ae37710fad27c8aa9c4cf96c0p0L,
+ 0x0.3519b9ce07dc08a1471775499fp-104L,
+
+/* x = 3.04687500000000000000000000000000000e-01 3ffd3800000000000000000000000000 */
+/* cos(x) = 0.f43575f94d4f6b272f5fb76b14 d2a64ab52df1ee8ddf7c651034 e5b2889305a9ea9015d758a */
+ 0x0.f43575f94d4f6b272f5fb76b14p0L,
+ 0x0.d2a64ab52df1ee8ddf7c651034p-104L,
+/* sin(x) = 0.4ccc7a50127e1de0cb6b40c302 c651f7bded4f9e7702b0471ae0 288d091a37391950907202f */
+ 0x0.4ccc7a50127e1de0cb6b40c302p0L,
+ 0x0.c651f7bded4f9e7702b0471ae0p-104L,
+
+/* x = 3.12500000000000000000000000000000000e-01 3ffd4000000000000000000000000000 */
+/* cos(x) = 0.f399f500c9e9fd37ae9957263d ab8877102beb569f101ee44953 50868e5847d181d50d3cca2 */
+ 0x0.f399f500c9e9fd37ae9957263dp0L,
+ 0x0.ab8877102beb569f101ee44953p-104L,
+/* sin(x) = 0.4eb44a5da74f600207aaa090f0 734e288603ffadb3eb2542a469 77b105f8547128036dcf7f0 */
+ 0x0.4eb44a5da74f600207aaa090f0p0L,
+ 0x0.734e288603ffadb3eb2542a469p-104L,
+
+/* x = 3.20312500000000000000000000000000000e-01 3ffd4800000000000000000000000000 */
+/* cos(x) = 0.f2faa5a1b74e82fd61fa05f917 7380e8e69b7b15a945e8e5ae11 24bf3d12b0617e03af4fab5 */
+ 0x0.f2faa5a1b74e82fd61fa05f917p0L,
+ 0x0.7380e8e69b7b15a945e8e5ae11p-104L,
+/* sin(x) = 0.509adf9a7b9a5a0f638a8fa3a6 0a199418859f18b37169a644fd b986c21ecb00133853bc35b */
+ 0x0.509adf9a7b9a5a0f638a8fa3a6p0L,
+ 0x0.0a199418859f18b37169a644fdp-104L,
+
+/* x = 3.28125000000000000000000000000000000e-01 3ffd5000000000000000000000000000 */
+/* cos(x) = 0.f2578a595224dd2e6bfa2eb2f9 9cc674f5ea6f479eae2eb58018 6897ae3f893df1113ca06b8 */
+ 0x0.f2578a595224dd2e6bfa2eb2f9p0L,
+ 0x0.9cc674f5ea6f479eae2eb58018p-104L,
+/* sin(x) = 0.5280326c3cf481823ba6bb08ea c82c2093f2bce3c4eb4ee3dec7 df41c92c8a4226098616075 */
+ 0x0.5280326c3cf481823ba6bb08eap0L,
+ 0x0.c82c2093f2bce3c4eb4ee3dec7p-104L,
+
+/* x = 3.35937500000000000000000000000000000e-01 3ffd5800000000000000000000000000 */
+/* cos(x) = 0.f1b0a5b406b526d886c55feadc 8d0dcc8eb9ae2ac707051771b4 8e05b25b000009660bdb3e3 */
+ 0x0.f1b0a5b406b526d886c55feadcp0L,
+ 0x0.8d0dcc8eb9ae2ac707051771b4p-104L,
+/* sin(x) = 0.54643b3da29de9b357155eef0f 332fb3e66c83bf4dddd9491c5e b8e103ccd92d6175220ed51 */
+ 0x0.54643b3da29de9b357155eef0fp0L,
+ 0x0.332fb3e66c83bf4dddd9491c5ep-104L,
+
+/* x = 3.43750000000000000000000000000000000e-01 3ffd6000000000000000000000000000 */
+/* cos(x) = 0.f105fa4d66b607a67d44e04272 5204435142ac8ad54dfb0907a4 f6b56b06d98ee60f19e557a */
+ 0x0.f105fa4d66b607a67d44e04272p0L,
+ 0x0.5204435142ac8ad54dfb0907a4p-104L,
+/* sin(x) = 0.5646f27e8bd65cbe3a5d61ff06 572290ee826d9674a00246b05a e26753cdfc90d9ce81a7d02 */
+ 0x0.5646f27e8bd65cbe3a5d61ff06p0L,
+ 0x0.572290ee826d9674a00246b05ap-104L,
+
+/* x = 3.51562500000000000000000000000000000e-01 3ffd6800000000000000000000000000 */
+/* cos(x) = 0.f0578ad01ede707fa39c09dc6b 984afef74f3dc8d0efb0f4c5a6 b13771145b3e0446fe33887 */
+ 0x0.f0578ad01ede707fa39c09dc6bp0L,
+ 0x0.984afef74f3dc8d0efb0f4c5a6p-104L,
+/* sin(x) = 0.582850a41e1dd46c7f602ea244 cdbbbfcdfa8f3189be794dda42 7ce090b5f85164f1f80ac13 */
+ 0x0.582850a41e1dd46c7f602ea244p0L,
+ 0x0.cdbbbfcdfa8f3189be794dda42p-104L,
+
+/* x = 3.59375000000000000000000000000000000e-01 3ffd7000000000000000000000000000 */
+/* cos(x) = 0.efa559f5ec3aec3a4eb0331927 8a2d41fcf9189462261125fe61 47b078f1daa0b06750a1654 */
+ 0x0.efa559f5ec3aec3a4eb0331927p0L,
+ 0x0.8a2d41fcf9189462261125fe61p-104L,
+/* sin(x) = 0.5a084e28e35fda2776dfdbbb55 31d74ced2b5d17c0b1afc46475 29d50c295e36d8ceec126c1 */
+ 0x0.5a084e28e35fda2776dfdbbb55p0L,
+ 0x0.31d74ced2b5d17c0b1afc46475p-104L,
+
+/* x = 3.67187500000000000000000000000000000e-01 3ffd7800000000000000000000000000 */
+/* cos(x) = 0.eeef6a879146af0bf9b95ea2ea 0ac0d3e2e4d7e15d93f48cbd41 bf8e4fded40bef69e19eafa */
+ 0x0.eeef6a879146af0bf9b95ea2eap0L,
+ 0x0.0ac0d3e2e4d7e15d93f48cbd41p-104L,
+/* sin(x) = 0.5be6e38ce8095542bc14ee9da0 d36483e6734bcab2e07624188a f5653f114eeb46738fa899d */
+ 0x0.5be6e38ce8095542bc14ee9da0p0L,
+ 0x0.d36483e6734bcab2e07624188ap-104L,
+
+/* x = 3.75000000000000000000000000000000000e-01 3ffd8000000000000000000000000000 */
+/* cos(x) = 0.ee35bf5ccac89052cd91ddb734 d3a47e262e3b609db604e21705 3803be0091e76daf28a89b7 */
+ 0x0.ee35bf5ccac89052cd91ddb734p0L,
+ 0x0.d3a47e262e3b609db604e21705p-104L,
+/* sin(x) = 0.5dc40955d9084f48a94675a249 8de5d851320ff5528a6afb3f2e 24de240fce6cbed1ba0ccd6 */
+ 0x0.5dc40955d9084f48a94675a249p0L,
+ 0x0.8de5d851320ff5528a6afb3f2ep-104L,
+
+/* x = 3.82812500000000000000000000000000000e-01 3ffd8800000000000000000000000000 */
+/* cos(x) = 0.ed785b5c44741b4493c56bcb9d 338a151c6f6b85d8f8aca658b2 8572c162b199680eb9304da */
+ 0x0.ed785b5c44741b4493c56bcb9dp0L,
+ 0x0.338a151c6f6b85d8f8aca658b2p-104L,
+/* sin(x) = 0.5f9fb80f21b53649c432540a50 e22c53057ff42ae0fdf1307760 dc0093f99c8efeb2fbd7073 */
+ 0x0.5f9fb80f21b53649c432540a50p0L,
+ 0x0.e22c53057ff42ae0fdf1307760p-104L,
+
+/* x = 3.90625000000000000000000000000000000e-01 3ffd9000000000000000000000000000 */
+/* cos(x) = 0.ecb7417b8d4ee3fec37aba4073 aa48f1f14666006fb431d96713 03c8100d10190ec8179c41d */
+ 0x0.ecb7417b8d4ee3fec37aba4073p0L,
+ 0x0.aa48f1f14666006fb431d96713p-104L,
+/* sin(x) = 0.6179e84a09a5258a40e9b5face 03e525f8b5753cd0105d93fe62 98010c3458e84d75fe420e9 */
+ 0x0.6179e84a09a5258a40e9b5facep0L,
+ 0x0.03e525f8b5753cd0105d93fe62p-104L,
+
+/* x = 3.98437500000000000000000000000000000e-01 3ffd9800000000000000000000000000 */
+/* cos(x) = 0.ebf274bf0bda4f62447e56a093 626798d3013b5942b1abfd155a acc9dc5c6d0806a20d6b9c1 */
+ 0x0.ebf274bf0bda4f62447e56a093p0L,
+ 0x0.626798d3013b5942b1abfd155ap-104L,
+/* sin(x) = 0.6352929dd264bd44a02ea76632 5d8aa8bd9695fc8def3caefba5 b94c9a3c873f7b2d3776ead */
+ 0x0.6352929dd264bd44a02ea76632p0L,
+ 0x0.5d8aa8bd9695fc8def3caefba5p-104L,
+
+/* x = 4.06250000000000000000000000000000000e-01 3ffda000000000000000000000000000 */
+/* cos(x) = 0.eb29f839f201fd13b937968279 16a78f15c85230a4e8ea4b2155 8265a14367e1abb4c30695a */
+ 0x0.eb29f839f201fd13b937968279p0L,
+ 0x0.16a78f15c85230a4e8ea4b2155p-104L,
+/* sin(x) = 0.6529afa7d51b129631ec197c0a 840a11d7dc5368b0a47956feb2 85caa8371c4637ef17ef01b */
+ 0x0.6529afa7d51b129631ec197c0ap0L,
+ 0x0.840a11d7dc5368b0a47956feb2p-104L,
+
+/* x = 4.14062500000000000000000000000000000e-01 3ffda800000000000000000000000000 */
+/* cos(x) = 0.ea5dcf0e30cf03e6976ef0b1ec 26515fba47383855c3b4055a99 b5e86824b2cd1a691fdca7b */
+ 0x0.ea5dcf0e30cf03e6976ef0b1ecp0L,
+ 0x0.26515fba47383855c3b4055a99p-104L,
+/* sin(x) = 0.66ff380ba0144109e39a320b0a 3fa5fd65ea0585bcbf9b1a769a 9b0334576c658139e1a1cbe */
+ 0x0.66ff380ba0144109e39a320b0ap0L,
+ 0x0.3fa5fd65ea0585bcbf9b1a769ap-104L,
+
+/* x = 4.21875000000000000000000000000000000e-01 3ffdb000000000000000000000000000 */
+/* cos(x) = 0.e98dfc6c6be031e60dd3089cbd d18a75b1f6b2c1e97f79225202 f03dbea45b07a5ec4efc062 */
+ 0x0.e98dfc6c6be031e60dd3089cbdp0L,
+ 0x0.d18a75b1f6b2c1e97f79225202p-104L,
+/* sin(x) = 0.68d32473143327973bc712bcc4 ccddc47630d755850c0655243b 205934dc49ffed8eb76adcb */
+ 0x0.68d32473143327973bc712bcc4p0L,
+ 0x0.ccddc47630d755850c0655243bp-104L,
+
+/* x = 4.29687500000000000000000000000000000e-01 3ffdb800000000000000000000000000 */
+/* cos(x) = 0.e8ba8393eca7821aa563d83491 b6101189b3b101c3677f73d7ba d7c10f9ee02b7ab4009739a */
+ 0x0.e8ba8393eca7821aa563d83491p0L,
+ 0x0.b6101189b3b101c3677f73d7bap-104L,
+/* sin(x) = 0.6aa56d8e8249db4eb60a761fe3 f9e559be456b9e13349ca99b0b fb787f22b95db3b70179615 */
+ 0x0.6aa56d8e8249db4eb60a761fe3p0L,
+ 0x0.f9e559be456b9e13349ca99b0bp-104L,
+
+/* x = 4.37500000000000000000000000000000000e-01 3ffdc000000000000000000000000000 */
+/* cos(x) = 0.e7e367d2956cfb16b6aa11e541 9cd0057f5c132a6455bf064297 e6a76fe2b72bb630d6d50ff */
+ 0x0.e7e367d2956cfb16b6aa11e541p0L,
+ 0x0.9cd0057f5c132a6455bf064297p-104L,
+/* sin(x) = 0.6c760c14c8585a51dbd34660ae 6c52ac7036a0b40887a0b63724 f8b4414348c3063a637f457 */
+ 0x0.6c760c14c8585a51dbd34660aep0L,
+ 0x0.6c52ac7036a0b40887a0b63724p-104L,
+
+/* x = 4.45312500000000000000000000000000000e-01 3ffdc800000000000000000000000000 */
+/* cos(x) = 0.e708ac84d4172a3e2737662213 429e14021074d7e702e77d72a8 f1101a7e70410df8273e9aa */
+ 0x0.e708ac84d4172a3e2737662213p0L,
+ 0x0.429e14021074d7e702e77d72a8p-104L,
+/* sin(x) = 0.6e44f8c36eb10a1c752d093c00 f4d47ba446ac4c215d26b03164 42f168459e677d06e7249e3 */
+ 0x0.6e44f8c36eb10a1c752d093c00p0L,
+ 0x0.f4d47ba446ac4c215d26b03164p-104L,
+
+/* x = 4.53125000000000000000000000000000000e-01 3ffdd000000000000000000000000000 */
+/* cos(x) = 0.e62a551594b970a770b15d41d4 c0e483e47aca550111df6966f9 e7ac3a94ae49e6a71eb031e */
+ 0x0.e62a551594b970a770b15d41d4p0L,
+ 0x0.c0e483e47aca550111df6966f9p-104L,
+/* sin(x) = 0.70122c5ec5028c8cff33abf4fd 340ccc382e038379b09cf04f9a 52692b10b72586060cbb001 */
+ 0x0.70122c5ec5028c8cff33abf4fdp0L,
+ 0x0.340ccc382e038379b09cf04f9ap-104L,
+
+/* x = 4.60937500000000000000000000000000000e-01 3ffdd800000000000000000000000000 */
+/* cos(x) = 0.e54864fe33e8575cabf5bd0e5c f1b1a8bc7c0d5f61702450fa6b 6539735820dd2603ae355d5 */
+ 0x0.e54864fe33e8575cabf5bd0e5cp0L,
+ 0x0.f1b1a8bc7c0d5f61702450fa6bp-104L,
+/* sin(x) = 0.71dd9fb1ff4677853acb970a9f 6729c6e3aac247b1c57cea66c7 7413f1f98e8b9e98e49d851 */
+ 0x0.71dd9fb1ff4677853acb970a9fp0L,
+ 0x0.6729c6e3aac247b1c57cea66c7p-104L,
+
+/* x = 4.68750000000000000000000000000000000e-01 3ffde000000000000000000000000000 */
+/* cos(x) = 0.e462dfc670d421ab3d1a159012 28f146a0547011202bf5ab01f9 14431859aef577966bc4fa4 */
+ 0x0.e462dfc670d421ab3d1a159012p0L,
+ 0x0.28f146a0547011202bf5ab01f9p-104L,
+/* sin(x) = 0.73a74b8f52947b681baf6928eb 3fb021769bf4779bad0e3aa9b1 cdb75ec60aad9fc63ff19d5 */
+ 0x0.73a74b8f52947b681baf6928ebp0L,
+ 0x0.3fb021769bf4779bad0e3aa9b1p-104L,
+
+/* x = 4.76562500000000000000000000000000000e-01 3ffde800000000000000000000000000 */
+/* cos(x) = 0.e379c9045f29d517c4808aa497 c2057b2b3d109e76c0dc302d4d 0698b36e3f0bdbf33d8e952 */
+ 0x0.e379c9045f29d517c4808aa497p0L,
+ 0x0.c2057b2b3d109e76c0dc302d4dp-104L,
+/* sin(x) = 0.756f28d011d98528a44a75fc29 c779bd734ecdfb582fdb74b68a 4c4c4be54cfd0b2d3ad292f */
+ 0x0.756f28d011d98528a44a75fc29p0L,
+ 0x0.c779bd734ecdfb582fdb74b68ap-104L,
+
+/* x = 4.84375000000000000000000000000000000e-01 3ffdf000000000000000000000000000 */
+/* cos(x) = 0.e28d245c58baef72225e232abc 003c4366acd9eb4fc2808c2ab7 fe7676cf512ac7f945ae5fb */
+ 0x0.e28d245c58baef72225e232abcp0L,
+ 0x0.003c4366acd9eb4fc2808c2ab7p-104L,
+/* sin(x) = 0.77353054ca72690d4c6e171fd9 9e6b39fa8e1ede5f052fd29645 34c75340970a3a9cd3c5c32 */
+ 0x0.77353054ca72690d4c6e171fd9p0L,
+ 0x0.9e6b39fa8e1ede5f052fd29645p-104L,
+
+/* x = 4.92187500000000000000000000000000000e-01 3ffdf800000000000000000000000000 */
+/* cos(x) = 0.e19cf580eeec046aa1422fa748 07ecefb2a1911c94e7b5f20a00 f70022d940193691e5bd790 */
+ 0x0.e19cf580eeec046aa1422fa748p0L,
+ 0x0.07ecefb2a1911c94e7b5f20a00p-104L,
+/* sin(x) = 0.78f95b0560a9a3bd6df7bd981d c38c61224d08bc20631ea932e6 05e53b579e9e0767dfcbbcb */
+ 0x0.78f95b0560a9a3bd6df7bd981dp0L,
+ 0x0.c38c61224d08bc20631ea932e6p-104L,
+
+/* x = 5.00000000000000000000000000000000000e-01 3ffe0000000000000000000000000000 */
+/* cos(x) = 0.e0a94032dbea7cedbddd9da2fa fad98556566b3a89f43eabd723 50af3e8b19e801204d8fe2e */
+ 0x0.e0a94032dbea7cedbddd9da2fap0L,
+ 0x0.fad98556566b3a89f43eabd723p-104L,
+/* sin(x) = 0.7abba1d12c17bfa1d92f0d93f6 0ded9992f45b4fcaf13cd58b30 3693d2a0db47db35ae8a3a9 */
+ 0x0.7abba1d12c17bfa1d92f0d93f6p0L,
+ 0x0.0ded9992f45b4fcaf13cd58b30p-104L,
+
+/* x = 5.07812500000000000000000000000000000e-01 3ffe0400000000000000000000000000 */
+/* cos(x) = 0.dfb20840f3a9b36f7ae2c51534 2890b5ec583b8366cc2b55029e 95094d31112383f2553498b */
+ 0x0.dfb20840f3a9b36f7ae2c51534p0L,
+ 0x0.2890b5ec583b8366cc2b55029ep-104L,
+/* sin(x) = 0.7c7bfdaf13e5ed17212f8a7525 bfb113aba6c0741b5362bb8d59 282a850b63716bca0c910f0 */
+ 0x0.7c7bfdaf13e5ed17212f8a7525p0L,
+ 0x0.bfb113aba6c0741b5362bb8d59p-104L,
+
+/* x = 5.15625000000000000000000000000000000e-01 3ffe0800000000000000000000000000 */
+/* cos(x) = 0.deb7518814a7a931bbcc88c109 cd41c50bf8bb48f20ae8c36628 d1d3d57574f7dc58f27d91c */
+ 0x0.deb7518814a7a931bbcc88c109p0L,
+ 0x0.cd41c50bf8bb48f20ae8c36628p-104L,
+/* sin(x) = 0.7e3a679daaf25c676542bcb402 8d0964172961c921823a4ef0c3 a9070d886dbd073f6283699 */
+ 0x0.7e3a679daaf25c676542bcb402p0L,
+ 0x0.8d0964172961c921823a4ef0c3p-104L,
+
+/* x = 5.23437500000000000000000000000000000e-01 3ffe0c00000000000000000000000000 */
+/* cos(x) = 0.ddb91ff318799172bd2452d0a3 889f5169c64a0094bcf0b8aa7d cf0d7640a2eba68955a80be */
+ 0x0.ddb91ff318799172bd2452d0a3p0L,
+ 0x0.889f5169c64a0094bcf0b8aa7dp-104L,
+/* sin(x) = 0.7ff6d8a34bd5e8fa54c97482db 5159df1f24e8038419c0b448b9 eea8939b5d4dfcf40900257 */
+ 0x0.7ff6d8a34bd5e8fa54c97482dbp0L,
+ 0x0.5159df1f24e8038419c0b448b9p-104L,
+
+/* x = 5.31250000000000000000000000000000000e-01 3ffe1000000000000000000000000000 */
+/* cos(x) = 0.dcb7777ac420705168f31e3eb7 80ce9c939ecada62843b54522f 5407eb7f21e556059fcd734 */
+ 0x0.dcb7777ac420705168f31e3eb7p0L,
+ 0x0.80ce9c939ecada62843b54522fp-104L,
+/* sin(x) = 0.81b149ce34caa5a4e650f8d09f d4d6aa74206c32ca951a93074c 83b2d294d25dbb0f7fdfad2 */
+ 0x0.81b149ce34caa5a4e650f8d09fp0L,
+ 0x0.d4d6aa74206c32ca951a93074cp-104L,
+
+/* x = 5.39062500000000000000000000000000000e-01 3ffe1400000000000000000000000000 */
+/* cos(x) = 0.dbb25c25b8260c14f6e7bc98ec 991b70c65335198b0ab628bad2 0cc7b229d4dd62183cfa055 */
+ 0x0.dbb25c25b8260c14f6e7bc98ecp0L,
+ 0x0.991b70c65335198b0ab628bad2p-104L,
+/* sin(x) = 0.8369b434a372da7eb5c8a71fe3 6ce1e0b2b493f6f5cb2e38bcae c2a556b3678c401940d1c3c */
+ 0x0.8369b434a372da7eb5c8a71fe3p0L,
+ 0x0.6ce1e0b2b493f6f5cb2e38bcaep-104L,
+
+/* x = 5.46875000000000000000000000000000000e-01 3ffe1800000000000000000000000000 */
+/* cos(x) = 0.daa9d20860827063fde51c09e8 55e9932e1b17143e7244fd267a 899d41ae1f3bc6a0ec42e27 */
+ 0x0.daa9d20860827063fde51c09e8p0L,
+ 0x0.55e9932e1b17143e7244fd267ap-104L,
+/* sin(x) = 0.852010f4f0800521378bd8dd61 4753d080c2e9e0775ffc609947 b9132f5357404f464f06a58 */
+ 0x0.852010f4f0800521378bd8dd61p0L,
+ 0x0.4753d080c2e9e0775ffc609947p-104L,
+
+/* x = 5.54687500000000000000000000000000000e-01 3ffe1c00000000000000000000000000 */
+/* cos(x) = 0.d99ddd44e44a43d4d4a3a3ed95 204106fd54d78e8c7684545c0d a0b7c2c72be7a89b7c182ad */
+ 0x0.d99ddd44e44a43d4d4a3a3ed95p0L,
+ 0x0.204106fd54d78e8c7684545c0dp-104L,
+/* sin(x) = 0.86d45935ab396cb4e421e822de e54f3562dfcefeaa782184c234 01d231f5ad981a1cc195b18 */
+ 0x0.86d45935ab396cb4e421e822dep0L,
+ 0x0.e54f3562dfcefeaa782184c234p-104L,
+
+/* x = 5.62500000000000000000000000000000000e-01 3ffe2000000000000000000000000000 */
+/* cos(x) = 0.d88e820b1526311dd561efbc0c 1a9a5375eb26f65d246c5744b1 3ca26a7e0fd42556da843c8 */
+ 0x0.d88e820b1526311dd561efbc0cp0L,
+ 0x0.1a9a5375eb26f65d246c5744b1p-104L,
+/* sin(x) = 0.88868625b4e1dbb23133101330 22527200c143a5cb16637cb7da f8ade82459ff2e98511f40f */
+ 0x0.88868625b4e1dbb23133101330p0L,
+ 0x0.22527200c143a5cb16637cb7dap-104L,
+
+/* x = 5.70312500000000000000000000000000000e-01 3ffe2400000000000000000000000000 */
+/* cos(x) = 0.d77bc4985e93a607c9d868b906 bbc6bbe3a04258814acb035846 8b826fc91bd4d814827f65e */
+ 0x0.d77bc4985e93a607c9d868b906p0L,
+ 0x0.bbc6bbe3a04258814acb035846p-104L,
+/* sin(x) = 0.8a3690fc5bfc11bf9535e2739a 8512f448a41251514bbed7fc18 d530f9b4650fcbb2861b0aa */
+ 0x0.8a3690fc5bfc11bf9535e2739ap0L,
+ 0x0.8512f448a41251514bbed7fc18p-104L,
+
+/* x = 5.78125000000000000000000000000000000e-01 3ffe2800000000000000000000000000 */
+/* cos(x) = 0.d665a937b4ef2b1f6d51bad6d9 88a4419c1d7051faf31a9efa15 1d7631117efac03713f950a */
+ 0x0.d665a937b4ef2b1f6d51bad6d9p0L,
+ 0x0.88a4419c1d7051faf31a9efa15p-104L,
+/* sin(x) = 0.8be472f9776d809af2b8817124 3d63d66dfceeeb739cc894e023 fbc165a0e3f26ff729c5d57 */
+ 0x0.8be472f9776d809af2b8817124p0L,
+ 0x0.3d63d66dfceeeb739cc894e023p-104L,
+
+/* x = 5.85937500000000000000000000000000000e-01 3ffe2c00000000000000000000000000 */
+/* cos(x) = 0.d54c3441844897fc8f853f0655 f1ba695eba9fbfd7439dbb1171 d862d9d9146ca5136f825ac */
+ 0x0.d54c3441844897fc8f853f0655p0L,
+ 0x0.f1ba695eba9fbfd7439dbb1171p-104L,
+/* sin(x) = 0.8d902565817ee7839bce3cd128 060119492cd36d42d82ada30d7 f8bde91324808377ddbf5d4 */
+ 0x0.8d902565817ee7839bce3cd128p0L,
+ 0x0.060119492cd36d42d82ada30d7p-104L,
+
+/* x = 5.93750000000000000000000000000000000e-01 3ffe3000000000000000000000000000 */
+/* cos(x) = 0.d42f6a1b9f0168cdf031c2f63c 8d9304d86f8d34cb1d5fccb68c a0f2241427fc18d1fd5bbdf */
+ 0x0.d42f6a1b9f0168cdf031c2f63cp0L,
+ 0x0.8d9304d86f8d34cb1d5fccb68cp-104L,
+/* sin(x) = 0.8f39a191b2ba6122a3fa4f41d5 a3ffd421417d46f19a22230a14 f7fcc8fce5c75b4b28b29d1 */
+ 0x0.8f39a191b2ba6122a3fa4f41d5p0L,
+ 0x0.a3ffd421417d46f19a22230a14p-104L,
+
+/* x = 6.01562500000000000000000000000000000e-01 3ffe3400000000000000000000000000 */
+/* cos(x) = 0.d30f4f392c357ab0661c5fa8a7 d9b26627846fef214b1d19a223 79ff9eddba087cf410eb097 */
+ 0x0.d30f4f392c357ab0661c5fa8a7p0L,
+ 0x0.d9b26627846fef214b1d19a223p-104L,
+/* sin(x) = 0.90e0e0d81ca678796cc92c8ea8 c2815bc72ca78abe571bfa8576 aacc571e096a33237e0e830 */
+ 0x0.90e0e0d81ca678796cc92c8ea8p0L,
+ 0x0.c2815bc72ca78abe571bfa8576p-104L,
+
+/* x = 6.09375000000000000000000000000000000e-01 3ffe3800000000000000000000000000 */
+/* cos(x) = 0.d1ebe81a95ee752e48a26bcd32 d6e922d7eb44b8ad2232f69307 95e84b56317269b9dd1dfa6 */
+ 0x0.d1ebe81a95ee752e48a26bcd32p0L,
+ 0x0.d6e922d7eb44b8ad2232f69307p-104L,
+/* sin(x) = 0.9285dc9bc45dd9ea3d02457bcc e59c4175aab6ff7929a8d28719 5525fdace200dba032874fb */
+ 0x0.9285dc9bc45dd9ea3d02457bccp0L,
+ 0x0.e59c4175aab6ff7929a8d28719p-104L,
+
+/* x = 6.17187500000000000000000000000000000e-01 3ffe3c00000000000000000000000000 */
+/* cos(x) = 0.d0c5394d772228195e25736c03 574707de0af1ca344b13bd3914 bfe27518e9e426f5deff1e1 */
+ 0x0.d0c5394d772228195e25736c03p0L,
+ 0x0.574707de0af1ca344b13bd3914p-104L,
+/* sin(x) = 0.94288e48bd0335fc41c4cbd292 0497a8f5d1d8185c99fa0081f9 0c27e2a53ffdd208a0dbe69 */
+ 0x0.94288e48bd0335fc41c4cbd292p0L,
+ 0x0.0497a8f5d1d8185c99fa0081f9p-104L,
+
+/* x = 6.25000000000000000000000000000000000e-01 3ffe4000000000000000000000000000 */
+/* cos(x) = 0.cf9b476c897c25c5bfe750dd3f 308eaf7bcc1ed00179a256870f 4200445043dcdb1974b5878 */
+ 0x0.cf9b476c897c25c5bfe750dd3fp0L,
+ 0x0.308eaf7bcc1ed00179a256870fp-104L,
+/* sin(x) = 0.95c8ef544210ec0b91c49bd2aa 09e8515fa61a156ebb10f5f8c2 32a6445b61ebf3c2ec268f9 */
+ 0x0.95c8ef544210ec0b91c49bd2aap0L,
+ 0x0.09e8515fa61a156ebb10f5f8c2p-104L,
+
+/* x = 6.32812500000000000000000000000000000e-01 3ffe4400000000000000000000000000 */
+/* cos(x) = 0.ce6e171f92f2e27f32225327ec 440ddaefae248413efc0e58cee e1ae369aabe73f88c87ed1a */
+ 0x0.ce6e171f92f2e27f32225327ecp0L,
+ 0x0.440ddaefae248413efc0e58ceep-104L,
+/* sin(x) = 0.9766f93cd18413a6aafc1cfc6f c28abb6817bf94ce349901ae3f 48c3215d3eb60acc5f78903 */
+ 0x0.9766f93cd18413a6aafc1cfc6fp0L,
+ 0x0.c28abb6817bf94ce349901ae3fp-104L,
+
+/* x = 6.40625000000000000000000000000000000e-01 3ffe4800000000000000000000000000 */
+/* cos(x) = 0.cd3dad1b5328a2e459f993f4f5 108819faccbc4eeba9604e81c7 adad51cc8a2561631a06826 */
+ 0x0.cd3dad1b5328a2e459f993f4f5p0L,
+ 0x0.108819faccbc4eeba9604e81c7p-104L,
+/* sin(x) = 0.9902a58a45e27bed68412b426b 675ed503f54d14c8172e0d373f 42cadf04daf67319a7f94be */
+ 0x0.9902a58a45e27bed68412b426bp0L,
+ 0x0.675ed503f54d14c8172e0d373fp-104L,
+
+/* x = 6.48437500000000000000000000000000000e-01 3ffe4c00000000000000000000000000 */
+/* cos(x) = 0.cc0a0e21709883a3ff00911e11 a07ee3bd7ea2b04e081be99be0 264791170761ae64b8b744a */
+ 0x0.cc0a0e21709883a3ff00911e11p0L,
+ 0x0.a07ee3bd7ea2b04e081be99be0p-104L,
+/* sin(x) = 0.9a9bedcdf01b38d993f3d78207 81de292033ead73b89e28f3931 3dbe3a6e463f845b5fa8490 */
+ 0x0.9a9bedcdf01b38d993f3d78207p0L,
+ 0x0.81de292033ead73b89e28f3931p-104L,
+
+/* x = 6.56250000000000000000000000000000000e-01 3ffe5000000000000000000000000000 */
+/* cos(x) = 0.cad33f00658fe5e8204bbc0f3a 66a0e6a773f87987a780b243d7 be83b3db1448ca0e0e62787 */
+ 0x0.cad33f00658fe5e8204bbc0f3ap0L,
+ 0x0.66a0e6a773f87987a780b243d7p-104L,
+/* sin(x) = 0.9c32cba2b14156ef05256c4f85 7991ca6a547cd7ceb1ac8a8e62 a282bd7b9183648a462bd04 */
+ 0x0.9c32cba2b14156ef05256c4f85p0L,
+ 0x0.7991ca6a547cd7ceb1ac8a8e62p-104L,
+
+/* x = 6.64062500000000000000000000000000000e-01 3ffe5400000000000000000000000000 */
+/* cos(x) = 0.c99944936cf48c8911ff93fe64 b3ddb7981e414bdaf6aae12035 77de44878c62bc3bc9cf7b9 */
+ 0x0.c99944936cf48c8911ff93fe64p0L,
+ 0x0.b3ddb7981e414bdaf6aae12035p-104L,
+/* sin(x) = 0.9dc738ad14204e689ac582d0f8 5826590feece34886cfefe2e08 cf2bb8488d55424dc9d3525 */
+ 0x0.9dc738ad14204e689ac582d0f8p0L,
+ 0x0.5826590feece34886cfefe2e08p-104L,
+
+/* x = 6.71875000000000000000000000000000000e-01 3ffe5800000000000000000000000000 */
+/* cos(x) = 0.c85c23c26ed7b6f014ef546c47 929682122876bfbf157de0aff3 c4247d820c746e32cd4174f */
+ 0x0.c85c23c26ed7b6f014ef546c47p0L,
+ 0x0.929682122876bfbf157de0aff3p-104L,
+/* sin(x) = 0.9f592e9b66a9cf906a3c7aa3c1 0199849040c45ec3f0a7475973 11038101780c5f266059dbf */
+ 0x0.9f592e9b66a9cf906a3c7aa3c1p0L,
+ 0x0.0199849040c45ec3f0a7475973p-104L,
+
+/* x = 6.79687500000000000000000000000000000e-01 3ffe5c00000000000000000000000000 */
+/* cos(x) = 0.c71be181ecd6875ce2da5615a0 3cca207d9adcb9dfb0a1d6c40a 4f0056437f1a59ccddd06ee */
+ 0x0.c71be181ecd6875ce2da5615a0p0L,
+ 0x0.3cca207d9adcb9dfb0a1d6c40ap-104L,
+/* sin(x) = 0.a0e8a725d33c828c11fa50fd9e 9a15ffecfad43f3e534358076b 9b0f6865694842b1e8c67dc */
+ 0x0.a0e8a725d33c828c11fa50fd9ep0L,
+ 0x0.9a15ffecfad43f3e534358076bp-104L,
+
+/* x = 6.87500000000000000000000000000000000e-01 3ffe6000000000000000000000000000 */
+/* cos(x) = 0.c5d882d2ee48030c7c07d28e98 1e34804f82ed4cf93655d23653 89b716de6ad44676a1cc5da */
+ 0x0.c5d882d2ee48030c7c07d28e98p0L,
+ 0x0.1e34804f82ed4cf93655d23653p-104L,
+/* sin(x) = 0.a2759c0e79c35582527c32b55f 5405c182c66160cb1d9eb7bb0b 7cdf4ad66f317bda4332914 */
+ 0x0.a2759c0e79c35582527c32b55fp0L,
+ 0x0.5405c182c66160cb1d9eb7bb0bp-104L,
+
+/* x = 6.95312500000000000000000000000000000e-01 3ffe6400000000000000000000000000 */
+/* cos(x) = 0.c4920cc2ec38fb891b38827db0 8884fc66371ac4c2052ca8885b 981bbcfd3bb7b093ee31515 */
+ 0x0.c4920cc2ec38fb891b38827db0p0L,
+ 0x0.8884fc66371ac4c2052ca8885bp-104L,
+/* sin(x) = 0.a400072188acf49cd6b173825e 038346f105e1301afe642bcc36 4cea455e21e506e3e927ed8 */
+ 0x0.a400072188acf49cd6b173825ep0L,
+ 0x0.038346f105e1301afe642bcc36p-104L,
+
+/* x = 7.03125000000000000000000000000000000e-01 3ffe6800000000000000000000000000 */
+/* cos(x) = 0.c348846bbd3631338ffe2bfe9d d1381a35b4e9c0c51b4c13fe37 6bad1bf5caacc4542be0aa9 */
+ 0x0.c348846bbd3631338ffe2bfe9dp0L,
+ 0x0.d1381a35b4e9c0c51b4c13fe37p-104L,
+/* sin(x) = 0.a587e23555bb08086d02b9c662 cdd29316c3e9bd08d93793634a 21b1810cce73bdb97a99b9e */
+ 0x0.a587e23555bb08086d02b9c662p0L,
+ 0x0.cdd29316c3e9bd08d93793634ap-104L,
+
+/* x = 7.10937500000000000000000000000000000e-01 3ffe6c00000000000000000000000000 */
+/* cos(x) = 0.c1fbeef380e4ffdd5a613ec872 2f643ffe814ec2343e53adb549 627224fdc9f2a7b77d3d69f */
+ 0x0.c1fbeef380e4ffdd5a613ec872p0L,
+ 0x0.2f643ffe814ec2343e53adb549p-104L,
+/* sin(x) = 0.a70d272a76a8d4b6da0ec90712 bb748b96dabf88c3079246f3db 7eea6e58ead4ed0e2843303 */
+ 0x0.a70d272a76a8d4b6da0ec90712p0L,
+ 0x0.bb748b96dabf88c3079246f3dbp-104L,
+
+/* x = 7.18750000000000000000000000000000000e-01 3ffe7000000000000000000000000000 */
+/* cos(x) = 0.c0ac518c8b6ae710ba37a3eeb9 0cb15aebcb8bed4356fb507a48 a6e97de9aa6d9660116b436 */
+ 0x0.c0ac518c8b6ae710ba37a3eeb9p0L,
+ 0x0.0cb15aebcb8bed4356fb507a48p-104L,
+/* sin(x) = 0.a88fcfebd9a8dd47e2f3c76ef9 e2439920f7e7fbe735f8bcc985 491ec6f12a2d4214f8cfa99 */
+ 0x0.a88fcfebd9a8dd47e2f3c76ef9p0L,
+ 0x0.e2439920f7e7fbe735f8bcc985p-104L,
+
+/* x = 7.26562500000000000000000000000000000e-01 3ffe7400000000000000000000000000 */
+/* cos(x) = 0.bf59b17550a440687596929656 7cf3e3b4e483061877c02811c6 cae85fad5a6c3da58f49292 */
+ 0x0.bf59b17550a440687596929656p0L,
+ 0x0.7cf3e3b4e483061877c02811c6p-104L,
+/* sin(x) = 0.aa0fd66eddb921232c28520d39 11b8a03193b47f187f1471ac21 6fbcd5bb81029294d3a73f1 */
+ 0x0.aa0fd66eddb921232c28520d39p0L,
+ 0x0.11b8a03193b47f187f1471ac21p-104L,
+
+/* x = 7.34375000000000000000000000000000000e-01 3ffe7800000000000000000000000000 */
+/* cos(x) = 0.be0413f84f2a771c614946a88c bf4da1d75a5560243de8f2283f efa0ea4a48468a52d51d8b3 */
+ 0x0.be0413f84f2a771c614946a88cp0L,
+ 0x0.bf4da1d75a5560243de8f2283fp-104L,
+/* sin(x) = 0.ab8d34b36acd987210ed343ec6 5d7e3adc2e7109fce43d55c8d5 7dfdf55b9e01d2cc1f1b9ec */
+ 0x0.ab8d34b36acd987210ed343ec6p0L,
+ 0x0.5d7e3adc2e7109fce43d55c8d5p-104L,
+
+/* x = 7.42187500000000000000000000000000000e-01 3ffe7c00000000000000000000000000 */
+/* cos(x) = 0.bcab7e6bfb2a14a9b122c574a3 76bec98ab14808c64a4e731b34 047e217611013ac99c0f25d */
+ 0x0.bcab7e6bfb2a14a9b122c574a3p0L,
+ 0x0.76bec98ab14808c64a4e731b34p-104L,
+/* sin(x) = 0.ad07e4c409d08c4fa3a9057bb0 ac24b8636e74e76f51e09bd6b2 319707cbd9f5e254643897a */
+ 0x0.ad07e4c409d08c4fa3a9057bb0p0L,
+ 0x0.ac24b8636e74e76f51e09bd6b2p-104L,
+
+/* x = 7.50000000000000000000000000000000000e-01 3ffe8000000000000000000000000000 */
+/* cos(x) = 0.bb4ff632a908f73ec151839cb9 d993b4e0bfb8f20e7e44e6e4ae e845e35575c3106dbe6fd06 */
+ 0x0.bb4ff632a908f73ec151839cb9p0L,
+ 0x0.d993b4e0bfb8f20e7e44e6e4aep-104L,
+/* sin(x) = 0.ae7fe0b5fc786b2d966e1d6af1 40a488476747c2646425fc7533 f532cd044cb10a971a49a6a */
+ 0x0.ae7fe0b5fc786b2d966e1d6af1p0L,
+ 0x0.40a488476747c2646425fc7533p-104L,
+
+/* x = 7.57812500000000000000000000000000000e-01 3ffe8400000000000000000000000000 */
+/* cos(x) = 0.b9f180ba77dd0751628e135a95 08299012230f14becacdd14c3f 8862d122de5b56d55b53360 */
+ 0x0.b9f180ba77dd0751628e135a95p0L,
+ 0x0.08299012230f14becacdd14c3fp-104L,
+/* sin(x) = 0.aff522a954f2ba16d9defdc416 e33f5e9a5dfd5a6c228e0abc4d 521327ff6e2517a7b3851dd */
+ 0x0.aff522a954f2ba16d9defdc416p0L,
+ 0x0.e33f5e9a5dfd5a6c228e0abc4dp-104L,
+
+/* x = 7.65625000000000000000000000000000000e-01 3ffe8800000000000000000000000000 */
+/* cos(x) = 0.b890237d3bb3c284b614a05390 16bfa1053730bbdf940fa895e1 85f8e58884d3dda15e63371 */
+ 0x0.b890237d3bb3c284b614a05390p0L,
+ 0x0.16bfa1053730bbdf940fa895e1p-104L,
+/* sin(x) = 0.b167a4c90d63c4244cf5493b7c c23bd3c3c1225e078baa0c53d6 d400b926281f537a1a260e6 */
+ 0x0.b167a4c90d63c4244cf5493b7cp0L,
+ 0x0.c23bd3c3c1225e078baa0c53d6p-104L,
+
+/* x = 7.73437500000000000000000000000000000e-01 3ffe8c00000000000000000000000000 */
+/* cos(x) = 0.b72be40067aaf2c050dbdb7a14 c3d7d4f203f6b3f0224a4afe55 d6ec8e92b508fd5c5984b3b */
+ 0x0.b72be40067aaf2c050dbdb7a14p0L,
+ 0x0.c3d7d4f203f6b3f0224a4afe55p-104L,
+/* sin(x) = 0.b2d7614b1f3aaa24df2d6e20a7 7e1ca3e6d838c03e29c1bcb026 e6733324815fadc9eb89674 */
+ 0x0.b2d7614b1f3aaa24df2d6e20a7p0L,
+ 0x0.7e1ca3e6d838c03e29c1bcb026p-104L,
+
+/* x = 7.81250000000000000000000000000000000e-01 3ffe9000000000000000000000000000 */
+/* cos(x) = 0.b5c4c7d4f7dae915ac786ccf4b 1a498d3e73b6e5e74fe7519d9c 53ee6d6b90e881bddfc33e1 */
+ 0x0.b5c4c7d4f7dae915ac786ccf4bp0L,
+ 0x0.1a498d3e73b6e5e74fe7519d9cp-104L,
+/* sin(x) = 0.b44452709a5975290591376543 4a59d111f0433eb2b133f7d103 207e2aeb4aae111ddc385b3 */
+ 0x0.b44452709a5975290591376543p0L,
+ 0x0.4a59d111f0433eb2b133f7d103p-104L,
+
+/* x = 7.89062500000000000000000000000000000e-01 3ffe9400000000000000000000000000 */
+/* cos(x) = 0.b45ad4975b1294cadca4cf40ec 8f22a68cd14b175835239a37e6 3acb85e8e9505215df18140 */
+ 0x0.b45ad4975b1294cadca4cf40ecp0L,
+ 0x0.8f22a68cd14b175835239a37e6p-104L,
+/* sin(x) = 0.b5ae7285bc10cf515753847e8f 8b7a30e0a580d929d770103509 880680f7b8b0e8ad23b65d8 */
+ 0x0.b5ae7285bc10cf515753847e8fp0L,
+ 0x0.8b7a30e0a580d929d770103509p-104L
+};
diff --git a/sysdeps/ieee754/ldbl-128ibm/w_expl.c b/sysdeps/ieee754/ldbl-128ibm/w_expl.c
new file mode 100644
index 0000000000..a5e72b2170
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm/w_expl.c
@@ -0,0 +1,6 @@
+/* Looks like we can use ieee854 w_expl.c as is for IBM extended format. */
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/w_expl.c>
+long_double_symbol (libm, __expl, expl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_asinhl.c b/sysdeps/ieee754/ldbl-64-128/s_asinhl.c
new file mode 100644
index 0000000000..4e8a541263
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_asinhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_asinhl.c>
+long_double_symbol (libm, __asinhl, asinhl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_atanl.c b/sysdeps/ieee754/ldbl-64-128/s_atanl.c
new file mode 100644
index 0000000000..c23d14aade
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_atanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_atanl.c>
+long_double_symbol (libm, __atanl, atanl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c b/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c
new file mode 100644
index 0000000000..ace5645277
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_cbrtl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cbrtl.c>
+long_double_symbol (libm, __cbrtl, cbrtl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_ceill.c b/sysdeps/ieee754/ldbl-64-128/s_ceill.c
new file mode 100644
index 0000000000..a646494f14
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_ceill.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_ceill.c>
+long_double_symbol (libm, __ceill, ceill);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
new file mode 100644
index 0000000000..1319584a52
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_copysignl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl);
+#else
+long_double_symbol (libc, __copysignl, copysignl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_cosl.c b/sysdeps/ieee754/ldbl-64-128/s_cosl.c
new file mode 100644
index 0000000000..6a7e2e3162
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_cosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_cosl.c>
+long_double_symbol (libm, __cosl, cosl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_erfl.c b/sysdeps/ieee754/ldbl-64-128/s_erfl.c
new file mode 100644
index 0000000000..c5f9bb3ac4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_erfl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_erfl.c>
+long_double_symbol (libm, __erfl, erfl);
+long_double_symbol (libm, __erfcl, erfcl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_expm1l.c b/sysdeps/ieee754/ldbl-64-128/s_expm1l.c
new file mode 100644
index 0000000000..4fb186127f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_expm1l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_expm1l.c>
+long_double_symbol (libm, __expm1l, expm1l);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_fabsl.c b/sysdeps/ieee754/ldbl-64-128/s_fabsl.c
new file mode 100644
index 0000000000..93d81d98bc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_fabsl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_fabsl.c>
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_finitel.c b/sysdeps/ieee754/ldbl-64-128/s_finitel.c
new file mode 100644
index 0000000000..90717a1057
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_finitel.c
@@ -0,0 +1,17 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#undef hidden_def
+#define hidden_def(x)
+#define __finitel(arg) ___finitel(arg)
+#include <sysdeps/ieee754/ldbl-128/s_finitel.c>
+#undef __finitel
+hidden_ver (___finitel, __finitel)
+_weak_alias (___finitel, ____finitel)
+#ifdef IS_IN_libm
+long_double_symbol (libm, ____finitel, finitel);
+long_double_symbol (libm, ___finitel, __finitel);
+#else
+long_double_symbol (libc, ____finitel, finitel);
+long_double_symbol (libc, ___finitel, __finitel);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_floorl.c b/sysdeps/ieee754/ldbl-64-128/s_floorl.c
new file mode 100644
index 0000000000..953043035e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_floorl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_floorl.c>
+long_double_symbol (libm, __floorl, floorl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c b/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
new file mode 100644
index 0000000000..a10b6c3a1a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_fpclassifyl.c
@@ -0,0 +1,10 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __fpclassifyl ___fpclassifyl
+#undef libm_hidden_def
+#define libm_hidden_def(a)
+#include <sysdeps/ieee754/ldbl-128/s_fpclassifyl.c>
+#undef __fpclassifyl
+long_double_symbol (libm, ___fpclassifyl, __fpclassifyl);
+libm_hidden_ver (___fpclassifyl, __fpclassifyl)
diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
new file mode 100644
index 0000000000..685bbbab41
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_frexpl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __frexpl, frexpl);
+#else
+long_double_symbol (libc, __frexpl, frexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c b/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c
new file mode 100644
index 0000000000..bb88082405
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_ilogbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_ilogbl.c>
+long_double_symbol (libm, __ilogbl, ilogbl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_isinfl.c b/sysdeps/ieee754/ldbl-64-128/s_isinfl.c
new file mode 100644
index 0000000000..e046032b09
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_isinfl.c
@@ -0,0 +1,16 @@
+#include <math_ldbl_opt.h>
+#ifndef IS_IN_libm
+# undef weak_alias
+# define weak_alias(n,a)
+# undef hidden_def
+# define hidden_def(x)
+# define __isinfl(arg) ___isinfl(arg)
+#endif
+#include <sysdeps/ieee754/ldbl-128/s_isinfl.c>
+#ifndef IS_IN_libm
+# undef __isinfl
+hidden_ver (___isinfl, __isinfl)
+_weak_alias (___isinfl, ____isinfl)
+long_double_symbol (libc, ____isinfl, isinfl);
+long_double_symbol (libc, ___isinfl, __isinfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_isnanl.c b/sysdeps/ieee754/ldbl-64-128/s_isnanl.c
new file mode 100644
index 0000000000..3673463ae5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_isnanl.c
@@ -0,0 +1,16 @@
+#include <math_ldbl_opt.h>
+#ifndef IS_IN_libm
+# undef weak_alias
+# define weak_alias(n,a)
+# undef hidden_def
+# define hidden_def(x)
+# define __isnanl(arg) ___isnanl(arg)
+#endif
+#include <sysdeps/ieee754/ldbl-128/s_isnanl.c>
+#ifndef IS_IN_libm
+# undef __isnanl
+hidden_ver (___isnanl, __isnanl)
+_weak_alias (___isnanl, ____isnanl)
+long_double_symbol (libc, ____isnanl, isnanl);
+long_double_symbol (libc, ___isnanl, __isnanl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_llrintl.c b/sysdeps/ieee754/ldbl-64-128/s_llrintl.c
new file mode 100644
index 0000000000..1515f3abd7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_llrintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_llrintl.c>
+long_double_symbol (libm, __llrintl, llrintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_llroundl.c b/sysdeps/ieee754/ldbl-64-128/s_llroundl.c
new file mode 100644
index 0000000000..ca35dae491
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_llroundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_llroundl.c>
+long_double_symbol (libm, __llroundl, llroundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_log1pl.c b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c
new file mode 100644
index 0000000000..eebd63638a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_log1pl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_log1pl.c>
+long_double_symbol (libm, __log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_logbl.c b/sysdeps/ieee754/ldbl-64-128/s_logbl.c
new file mode 100644
index 0000000000..8ba8179feb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_logbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_logbl.c>
+long_double_symbol (libm, __logbl, logbl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_lrintl.c b/sysdeps/ieee754/ldbl-64-128/s_lrintl.c
new file mode 100644
index 0000000000..56e69c94f9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_lrintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_lrintl.c>
+long_double_symbol (libm, __lrintl, lrintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_lroundl.c b/sysdeps/ieee754/ldbl-64-128/s_lroundl.c
new file mode 100644
index 0000000000..d5429e2384
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_lroundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_lroundl.c>
+long_double_symbol (libm, __lroundl, lroundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
new file mode 100644
index 0000000000..c17d6690a8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_modfl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __modfl, modfl);
+#else
+long_double_symbol (libc, __modfl, modfl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c
new file mode 100644
index 0000000000..a6d0a313fd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nearbyintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nearbyintl.c>
+long_double_symbol (libm, __nearbyintl, nearbyintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c
new file mode 100644
index 0000000000..64c663eda3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nextafterl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nextafterl.c>
+long_double_symbol (libm, __nextafterl, nextafterl);
+long_double_symbol (libm, __nexttowardl, nexttowardl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c
new file mode 100644
index 0000000000..2968503d2e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nexttoward.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nexttoward.c>
+long_double_symbol (libm, __nexttoward, nexttoward);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c b/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c
new file mode 100644
index 0000000000..64b9c24465
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_nexttowardf.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_nexttowardf.c>
+long_double_symbol (libm, __nexttowardf, nexttowardf);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_remquol.c b/sysdeps/ieee754/ldbl-64-128/s_remquol.c
new file mode 100644
index 0000000000..16f0eb16a4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_remquol.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_remquol.c>
+long_double_symbol (libm, __remquol, remquol);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_rintl.c b/sysdeps/ieee754/ldbl-64-128/s_rintl.c
new file mode 100644
index 0000000000..19af9bbdcb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_rintl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_rintl.c>
+long_double_symbol (libm, __rintl, rintl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_roundl.c b/sysdeps/ieee754/ldbl-64-128/s_roundl.c
new file mode 100644
index 0000000000..3fa99d6f2a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_roundl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_roundl.c>
+long_double_symbol (libm, __roundl, roundl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c b/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c
new file mode 100644
index 0000000000..3143f18f6c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_scalblnl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_scalblnl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalblnl, scalblnl);
+#else
+long_double_symbol (libc, __scalblnl, scalblnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c b/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c
new file mode 100644
index 0000000000..78520e9648
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_scalbnl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_scalbnl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __scalbnl, scalbnl);
+#else
+long_double_symbol (libc, __scalbnl, scalbnl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_signbitl.c b/sysdeps/ieee754/ldbl-64-128/s_signbitl.c
new file mode 100644
index 0000000000..f66db2f651
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_signbitl.c
@@ -0,0 +1,11 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __signbitl(arg) ___signbitl(arg)
+#include <sysdeps/ieee754/ldbl-128/s_signbitl.c>
+#undef __signbitl
+#ifdef IS_IN_libm
+long_double_symbol (libm, ___signbitl, __signbitl);
+#else
+long_double_symbol (libc, ___signbitl, __signbitl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/s_sincosl.c b/sysdeps/ieee754/ldbl-64-128/s_sincosl.c
new file mode 100644
index 0000000000..ce0d4e2887
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_sincosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_sincosl.c>
+long_double_symbol (libm, __sincosl, sincosl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_sinl.c b/sysdeps/ieee754/ldbl-64-128/s_sinl.c
new file mode 100644
index 0000000000..ebc20affdb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_sinl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_sinl.c>
+long_double_symbol (libm, __sinl, sinl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_tanhl.c b/sysdeps/ieee754/ldbl-64-128/s_tanhl.c
new file mode 100644
index 0000000000..ede93930cd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_tanhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_tanhl.c>
+long_double_symbol (libm, __tanhl, tanhl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_tanl.c b/sysdeps/ieee754/ldbl-64-128/s_tanl.c
new file mode 100644
index 0000000000..6e635dfdc9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_tanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_tanl.c>
+long_double_symbol (libm, __tanl, tanl);
diff --git a/sysdeps/ieee754/ldbl-64-128/s_truncl.c b/sysdeps/ieee754/ldbl-64-128/s_truncl.c
new file mode 100644
index 0000000000..6311479d01
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/s_truncl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/s_truncl.c>
+long_double_symbol (libm, __truncl, truncl);
diff --git a/sysdeps/ieee754/ldbl-64-128/strtold_l.c b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
new file mode 100644
index 0000000000..ef8fe05759
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/strtold_l.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 1999, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <xlocale.h>
+
+/* The actual implementation for all floating point sizes is in strtod.c.
+   These macros tell it to produce the `long double' version, `strtold'.  */
+
+#define FLOAT		long double
+#define FLT		LDBL
+#ifdef USE_WIDE_CHAR
+extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t);
+# define STRTOF		__new_wcstold_l
+# define __STRTOF	____new_wcstold_l
+# define ____STRTOF_INTERNAL ____wcstold_l_internal
+#else
+extern long double ____new_strtold_l (const char *, char **, __locale_t);
+# define STRTOF		__new_strtold_l
+# define __STRTOF	____new_strtold_l
+# define ____STRTOF_INTERNAL ____strtold_l_internal
+#endif
+#define MPN2FLOAT	__mpn_construct_long_double
+#define FLOAT_HUGE_VAL	HUGE_VALL
+#define SET_MANTISSA(flt, mant) \
+  do { union ieee854_long_double u;					      \
+       u.d = (flt);							      \
+       u.ieee.mantissa0 = 0x8000;					      \
+       u.ieee.mantissa1 = 0;						      \
+       u.ieee.mantissa2 = ((mant) >> 32);	      			      \
+       u.ieee.mantissa3 = (mant) & 0xffffffff;				      \
+       (flt) = u.d;							      \
+  } while (0)
+
+#include <strtod_l.c>
+
+#ifdef __LONG_DOUBLE_MATH_OPTIONAL
+# include <math_ldbl_opt.h>
+# ifdef USE_WIDE_CHAR
+long_double_symbol (libc, __new_wcstold_l, wcstold_l);
+long_double_symbol (libc, ____new_wcstold_l, __wcstold_l);
+# else
+long_double_symbol (libc, __new_strtold_l, strtold_l);
+long_double_symbol (libc, ____new_strtold_l, __strtold_l);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-64-128/w_expl.c b/sysdeps/ieee754/ldbl-64-128/w_expl.c
new file mode 100644
index 0000000000..2a402b04c0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-64-128/w_expl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <sysdeps/ieee754/ldbl-128/w_expl.c>
+long_double_symbol (libm, __expl, expl);
diff --git a/sysdeps/ieee754/ldbl-96/printf_fphex.c b/sysdeps/ieee754/ldbl-96/printf_fphex.c
index 3c8183df2e..ba9f4c2960 100644
--- a/sysdeps/ieee754/ldbl-96/printf_fphex.c
+++ b/sysdeps/ieee754/ldbl-96/printf_fphex.c
@@ -1,5 +1,5 @@
 /* Print floating point number in hexadecimal notation according to ISO C99.
-   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2005 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
@@ -90,4 +90,4 @@ do {									      \
 	}								      \
 } while (0)
 
-#include <sysdeps/generic/printf_fphex.c>
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/ieee754/ldbl-96/s_erfl.c b/sysdeps/ieee754/ldbl-96/s_erfl.c
index e026f5a516..7406c3624c 100644
--- a/sysdeps/ieee754/ldbl-96/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-96/s_erfl.c
@@ -341,10 +341,6 @@ __erfl (x)
 }
 
 weak_alias (__erfl, erfl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erf, __erfl)
-weak_alias (__erf, erfl)
-#endif
 #ifdef __STDC__
      long double
      __erfcl (long double x)
@@ -456,7 +452,3 @@ weak_alias (__erf, erfl)
 }
 
 weak_alias (__erfcl, erfcl)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__erfc, __erfcl)
-weak_alias (__erfc, erfcl)
-#endif
diff --git a/sysdeps/ieee754/ldbl-96/s_llrintl.c b/sysdeps/ieee754/ldbl-96/s_llrintl.c
index e927a8af40..d6eedf1f33 100644
--- a/sysdeps/ieee754/ldbl-96/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_llrintl.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -47,9 +47,7 @@ __llrintl (long double x)
 
   if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
     {
-      if (j0 < -1)
-	return 0;
-      else if (j0 >= 63)
+      if (j0 >= 63)
 	result = (((long long int) i0 << 32) | i1) << (j0 - 63);
       else
 	{
@@ -58,7 +56,9 @@ __llrintl (long double x)
 	  GET_LDOUBLE_WORDS (se, i0, i1, t);
 	  j0 = (se & 0x7fff) - 0x3fff;
 
-	  if (j0 <= 31)
+	  if (j0 < 0)
+	    result = 0;
+	  else if (j0 <= 31)
 	    result = i0 >> (31 - j0);
 	  else
 	    result = ((long long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
diff --git a/sysdeps/ieee754/ldbl-96/s_lrintl.c b/sysdeps/ieee754/ldbl-96/s_lrintl.c
index 4212093989..621951d87b 100644
--- a/sysdeps/ieee754/ldbl-96/s_lrintl.c
+++ b/sysdeps/ieee754/ldbl-96/s_lrintl.c
@@ -1,6 +1,6 @@
 /* Round argument to nearest integral value according to current rounding
    direction.
-   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -47,17 +47,12 @@ __lrintl (long double x)
 
   if (j0 < 31)
     {
-      if (j0 < -1)
-	return 0;
-      else
-	{
-	  w = two63[sx] + x;
-	  t = w - two63[sx];
-	  GET_LDOUBLE_WORDS (se, i0, i1, t);
-	  j0 = (se & 0x7fff) - 0x3fff;
+      w = two63[sx] + x;
+      t = w - two63[sx];
+      GET_LDOUBLE_WORDS (se, i0, i1, t);
+      j0 = (se & 0x7fff) - 0x3fff;
 
-	  result = i0 >> (31 - j0);
-	}
+      result = (j0 < 0 ? 0 : i0 >> (31 - j0));
     }
   else if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
     {
diff --git a/sysdeps/ieee754/ldbl-96/s_nextafterl.c b/sysdeps/ieee754/ldbl-96/s_nextafterl.c
index 1798261b28..ed0877d6dd 100644
--- a/sysdeps/ieee754/ldbl-96/s_nextafterl.c
+++ b/sysdeps/ieee754/ldbl-96/s_nextafterl.c
@@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $";
  */
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
 
 #ifdef __STDC__
 	long double __nextafterl(long double x, long double y)
@@ -48,9 +48,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if(x==y) return y;		/* x=y, return y */
 	if((ix|hx|lx)==0) {			/* x == 0 */
+	    long double u;
 	    SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(esx<0x8000) {			/* x > 0 */
 	    if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
@@ -85,13 +88,10 @@ static char rcsid[] = "$NetBSD: $";
 	    }
 	}
 	esy = esx&0x7fff;
-	if(esy==0x7fff) return x+x;	/* overflow  */
-	if(esy==0) {			/* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        SET_LDOUBLE_WORDS(y,esx,hx,lx);
-		return y;
-	    }
+	if(esy==0x7fff) return x+x;		/* overflow  */
+	if(esy==0) {
+	    long double u = x*x;		/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	SET_LDOUBLE_WORDS(x,esx,hx,lx);
 	return x;
diff --git a/sysdeps/ieee754/ldbl-96/s_nexttoward.c b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
index 8b273af929..e30438482c 100644
--- a/sysdeps/ieee754/ldbl-96/s_nexttoward.c
+++ b/sysdeps/ieee754/ldbl-96/s_nexttoward.c
@@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $";
  */
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
 #include <float.h>
 
 #ifdef __STDC__
@@ -50,10 +50,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if((long double) x==y) return y;	/* x=y, return y */
 	if((ix|lx)==0) {			/* x == 0 */
-	    double x2;
+	    double u;
 	    INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */
-	    x2 = x*x;
-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
 	    if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00
@@ -84,22 +86,15 @@ static char rcsid[] = "$NetBSD: $";
 	if(hy>=0x7ff00000) {
 	  x = x+x;	/* overflow  */
 	  if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1)
-	    /* Force conversion to float.  */
-	    asm ("" : "=m"(x) : "m"(x));
+	    /* Force conversion to double.  */
+	    asm ("" : "+m"(x));
 	  return x;
 	}
-	if(hy<0x00100000) {		/* underflow */
-	    double x2 = x*x;
-	    if(x2!=x) {		/* raise underflow flag */
-	        INSERT_WORDS(x2,hx,lx);
-		return x2;
-	    }
+	if(hy<0x00100000) {
+	    double u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	INSERT_WORDS(x,hx,lx);
 	return x;
 }
 weak_alias (__nexttoward, nexttoward)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__nexttoward, __nexttowardl)
-weak_alias (__nexttoward, nexttowardl)
-#endif
diff --git a/sysdeps/ieee754/ldbl-96/s_nexttowardf.c b/sysdeps/ieee754/ldbl-96/s_nexttowardf.c
index a1c38b5d4c..6357975ffc 100644
--- a/sysdeps/ieee754/ldbl-96/s_nexttowardf.c
+++ b/sysdeps/ieee754/ldbl-96/s_nexttowardf.c
@@ -18,7 +18,8 @@ static char rcsid[] = "$NetBSD: $";
 #endif
 
 #include "math.h"
-#include "math_private.h"
+#include <math_private.h>
+#include <float.h>
 
 #ifdef __STDC__
 	float __nexttowardf(float x, long double y)
@@ -41,10 +42,12 @@ static char rcsid[] = "$NetBSD: $";
 	   return x+y;
 	if((long double) x==y) return y;	/* x=y, return y */
 	if(ix==0) {				/* x == 0 */
-	    float x2;
+	    float u;
 	    SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/
-	    x2 = x*x;
-	    if(x2==x) return x2; else return x;	/* raise underflow flag */
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
 	}
 	if(hx>=0) {				/* x > 0 */
 	    if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80
@@ -64,13 +67,16 @@ static char rcsid[] = "$NetBSD: $";
 	    }
 	}
 	hy = hx&0x7f800000;
-	if(hy>=0x7f800000) return x+x;	/* overflow  */
-	if(hy<0x00800000) {		/* underflow */
-	    float x2 = x*x;
-	    if(x2!=x) {		/* raise underflow flag */
-	        SET_FLOAT_WORD(x2,hx);
-		return x2;
-	    }
+	if(hy>=0x7f800000) {
+	  x = x+x;	/* overflow  */
+	  if (FLT_EVAL_METHOD != 0)
+	    /* Force conversion to float.  */
+	    asm ("" : "+m"(x));
+	  return x;
+	}
+	if(hy<0x00800000) {
+	    float u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
 	}
 	SET_FLOAT_WORD(x,hx);
 	return x;
diff --git a/sysdeps/ieee754/ldbl-96/strtold_l.c b/sysdeps/ieee754/ldbl-96/strtold_l.c
index 32bf18084b..52335c227f 100644
--- a/sysdeps/ieee754/ldbl-96/strtold_l.c
+++ b/sysdeps/ieee754/ldbl-96/strtold_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2004, 2005 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
@@ -42,4 +42,4 @@
        (flt) = u.d;							      \
   } while (0)
 
-#include <strtod_l.c>
+#include <stdlib/strtod_l.c>
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
new file mode 100644
index 0000000000..7f7bc3ce33
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -0,0 +1,43 @@
+# The`long double' type is a distinct type we support if
+# -mlong-double-128 option is used (or when it becomes a default
+# when -mlong-double-64 is not used).
+long-double-fcts = yes
+ifeq (,$(filter -mlong-double-128,$(sysdep-CFLAGS)))
+sysdep-CFLAGS += -mlong-double-128
+endif
+
+ifeq ($(subdir),math)
+libm-routines += s_nexttowardfd
+routines += math_ldbl_opt nldbl-compat
+
+extra-libs += libnldbl
+libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
+		 obstack_printf obstack_vprintf printf scanf snprintf \
+		 sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
+		 vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
+		 vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
+		 wprintf wscanf printf_fp printf_size \
+		 fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
+		 swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
+		 vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
+		 wprintf_chk \
+		 syslog syslog_chk vsyslog vsyslog_chk \
+		 strfmon strfmon_l \
+		 strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
+		 qecvt qfcvt qgcvt qecvt_r qfcvt_r \
+		 isinf isnan finite signbit scalb log2 lgamma_r ceil \
+		 significand acos asin atan atan2 cos sin tan cosh sinh \
+		 tanh acosh asinh atanh exp log log10 exp10 pow10 expm1 \
+		 log1p logb exp2 sqrt cbrt fabs floor j0 j1 y0 y1 erf erfc \
+		 lgamma tgamma gamma rint nearbyint round trunc \
+		 copysign fdim fmax fmin nextafter pow hypot fmod drem \
+		 remainder ldexp scalbn frexp modf scalbln fma nan sincos \
+		 jn yn ilogb remquo lrint lround llrint llround nexttowardf \
+		 nexttoward conj cacos cacosh casin catan catanh ccos ccosh \
+		 casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
+		 cabs carg cimag creal clog10
+libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
+libnldbl-inhibit-o = $(object-suffixes)
+libnldbl-static-only-routines = $(libnldbl-routines)
+
+endif
diff --git a/sysdeps/ieee754/ldbl-opt/Versions b/sysdeps/ieee754/ldbl-opt/Versions
new file mode 100644
index 0000000000..d22b18ec89
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/Versions
@@ -0,0 +1,87 @@
+%include <nldbl-abi.h>
+%ifndef NLDBL_VERSION
+% error "nldbl-abi.h must define NLDBL_VERSION"
+%endif
+
+libc {
+  NLDBL_VERSION {
+    # IEEE quad long double functions (older symver is for
+    # IEEE double long double).
+    ldexpl; copysignl; finitel; frexpl; isinfl; isnanl; modfl;
+    __isinfl; __isnanl; __finitel; __signbitl;
+    scalbnl;
+    qecvt; qfcvt; qgcvt; qecvt_r; qfcvt_r;
+
+    strtold; __strtold_internal; wcstold; __wcstold_internal;
+    __strtold_l; strtold_l; __wcstold_l; wcstold_l;
+
+    strfmon; __strfmon_l; strfmon_l;
+    __nldbl_strfmon; __nldbl___strfmon_l; __nldbl_strfmon_l;
+    __nldbl___vstrfmon; __nldbl___vstrfmon_l;
+
+    syslog; vsyslog;
+    __nldbl_syslog; __nldbl_vsyslog;
+    __nldbl___syslog_chk; __nldbl___vsyslog_chk;
+
+    # *printf* family, using IEEE quad long double
+    __asprintf; asprintf; dprintf; fprintf; fwprintf; _IO_fprintf;
+    _IO_printf; _IO_sprintf; _IO_vfprintf; _IO_vsprintf; obstack_printf;
+    obstack_vprintf; printf; __printf_fp; printf_size; snprintf; sprintf;
+    swprintf; vasprintf; vdprintf; vfprintf; vfwprintf; vprintf; vsnprintf;
+    __vsnprintf; vsprintf; vswprintf; vwprintf; wprintf;
+
+    # *printf* family, using IEEE double as long double
+    # The standard functions are __REDIRECTed to these if -mlong-double-64
+    __nldbl___asprintf; __nldbl_asprintf; __nldbl_dprintf; __nldbl_fprintf;
+    __nldbl_fwprintf; __nldbl__IO_fprintf; __nldbl__IO_printf;
+    __nldbl__IO_sprintf; __nldbl__IO_vfprintf; __nldbl__IO_vsprintf;
+    __nldbl_obstack_printf; __nldbl_obstack_vprintf; __nldbl_printf;
+    __nldbl___printf_fp; __nldbl_printf_size; __nldbl_snprintf;
+    __nldbl_sprintf; __nldbl_swprintf; __nldbl_vasprintf; __nldbl_vdprintf;
+    __nldbl_vfprintf; __nldbl_vfwprintf; __nldbl_vprintf; __nldbl_vsnprintf;
+    __nldbl___vsnprintf; __nldbl_vsprintf; __nldbl_vswprintf;
+    __nldbl_vwprintf; __nldbl_wprintf;
+
+    # *scanf family, using IEEE quad long double
+    _IO_sscanf; _IO_vfscanf; __vfscanf; __vsscanf; fscanf; fwscanf; scanf;
+    sscanf; swscanf; vfscanf; vfwscanf; vscanf; vsscanf; vswscanf; vwscanf;
+    wscanf;
+
+    # *scanf family, using IEEE double as long double
+    __nldbl__IO_sscanf; __nldbl__IO_vfscanf; __nldbl___vfscanf;
+    __nldbl___vsscanf; __nldbl_fscanf; __nldbl_fwscanf; __nldbl_scanf;
+    __nldbl_sscanf; __nldbl_swscanf; __nldbl_vfscanf; __nldbl_vfwscanf;
+    __nldbl_vscanf; __nldbl_vsscanf; __nldbl_vswscanf; __nldbl_vwscanf;
+    __nldbl_wscanf;
+
+    # checking versions, using IEEE quad long double
+    __sprintf_chk; __vsprintf_chk; __snprintf_chk; __vsnprintf_chk;
+    __printf_chk; __fprintf_chk; __vprintf_chk; __vfprintf_chk;
+
+    # checking versions, using IEEE double as long double
+    __nldbl___sprintf_chk; __nldbl___vsprintf_chk; __nldbl___snprintf_chk;
+    __nldbl___vsnprintf_chk; __nldbl___printf_chk; __nldbl___fprintf_chk;
+    __nldbl___vprintf_chk; __nldbl___vfprintf_chk;
+    __nldbl___swprintf_chk; __nldbl___vswprintf_chk; __nldbl___fwprintf_chk;
+    __nldbl___wprintf_chk; __nldbl___vfwprintf_chk; __nldbl___vwprintf_chk;
+  }
+}
+libm {
+  NLDBL_VERSION {
+    # IEEE quad long double functions (older symver is for
+    # IEEE double as long double).
+    cabsl; cargl; cimagl; conjl; creall; cacosl; cacoshl; casinl;
+    catanl; catanhl; ccosl; ccoshl; casinhl; cexpl; clogl; __clog10l;
+    clog10l; cpowl; cprojl; csinl; csinhl; csqrtl; ctanl; ctanhl;
+    fdiml; fmal; fmaxl; fminl; ldexpl; nanl; nextafterl; nexttowardl;
+    significandl; acosl; acoshl; asinl; atan2l; atanhl; coshl; dreml;
+    exp10l; pow10l; exp2l; fmodl; hypotl; j0l; y0l; j1l; y1l; jnl; ynl;
+    lgammal; gammal; lgammal_r; logl; log10l; log2l; powl; remainderl;
+    scalbl; sinhl; sqrtl; tgammal; asinhl; atanl; cbrtl; ceill; copysignl;
+    erfl; erfcl; expm1l; fabsl; finitel; floorl; frexpl; ilogbl;
+    llrintl; llroundl; log1pl; logbl; lrintl; lroundl; modfl;
+    nearbyintl; remquol; rintl; roundl; scalblnl; scalbnl; sinl; cosl;
+    sincosl; tanl; tanhl; truncl; expl; __finitel; __signbitl;
+    __fpclassifyl; nexttowardf; nexttoward; __nldbl_nexttowardf;
+  }
+}
diff --git a/sysdeps/ieee754/ldbl-opt/cabs.c b/sysdeps/ieee754/ldbl-opt/cabs.c
new file mode 100644
index 0000000000..a181de2fa8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cabs.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/cabs.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cabs, cabsl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cabsl.c b/sysdeps/ieee754/ldbl-opt/cabsl.c
new file mode 100644
index 0000000000..b861633544
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cabsl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cabsl.c>
+long_double_symbol (libm, __cabsl, cabsl);
diff --git a/sysdeps/ieee754/ldbl-opt/carg.c b/sysdeps/ieee754/ldbl-opt/carg.c
new file mode 100644
index 0000000000..2ed358113c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/carg.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/carg.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __carg, cargl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cargl.c b/sysdeps/ieee754/ldbl-opt/cargl.c
new file mode 100644
index 0000000000..952dc60664
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cargl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cargl.c>
+long_double_symbol (libm, __cargl, cargl);
diff --git a/sysdeps/ieee754/ldbl-opt/cimag.c b/sysdeps/ieee754/ldbl-opt/cimag.c
new file mode 100644
index 0000000000..f8052581b3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cimag.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/cimag.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cimag, cimagl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/cimagl.c b/sysdeps/ieee754/ldbl-opt/cimagl.c
new file mode 100644
index 0000000000..112365e3ae
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/cimagl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/cimagl.c>
+long_double_symbol (libm, __cimagl, cimagl);
diff --git a/sysdeps/ieee754/ldbl-opt/configure b/sysdeps/ieee754/ldbl-opt/configure
new file mode 100755
index 0000000000..dc81365318
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/configure
@@ -0,0 +1,69 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/ieee754/ldbl-opt/.
+
+
+echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mlong-double-128" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS supports -mlong-double-128... $ECHO_C" >&6
+if test "${libc_cv_mlong_double_128+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+#ifndef __LONG_DOUBLE_128__
+# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
+#endif
+long double foobar (long double x) { return x; }
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_mlong_double_128=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mlong_double_128=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128" >&5
+echo "${ECHO_T}$libc_cv_mlong_double_128" >&6
+if test "$libc_cv_mlong_double_128" = no; then
+  { { echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 support" >&5
+echo "$as_me: error: this configuration requires -mlong-double-128 support" >&2;}
+   { (exit 1); exit 1; }; }
+fi
diff --git a/sysdeps/ieee754/ldbl-opt/configure.in b/sysdeps/ieee754/ldbl-opt/configure.in
new file mode 100644
index 0000000000..a77fadd1c4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/configure.in
@@ -0,0 +1,19 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/ieee754/ldbl-opt/.
+
+AC_CACHE_CHECK(whether $CC $CFLAGS supports -mlong-double-128,
+	       libc_cv_mlong_double_128, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+AC_TRY_COMPILE(, [
+#ifndef __LONG_DOUBLE_128__
+# error "compiler did not predefine __LONG_DOUBLE_128__ as expected"
+#endif
+long double foobar (long double x) { return x; }],
+	       libc_cv_mlong_double_128=yes,
+	       libc_cv_mlong_double_128=no)
+CFLAGS="$save_CFLAGS"])
+if test "$libc_cv_mlong_double_128" = no; then
+  AC_MSG_ERROR([this configuration requires -mlong-double-128 support])
+fi
diff --git a/sysdeps/ieee754/ldbl-opt/conj.c b/sysdeps/ieee754/ldbl-opt/conj.c
new file mode 100644
index 0000000000..e4edade05e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/conj.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/conj.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __conj, conjl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/conjl.c b/sysdeps/ieee754/ldbl-opt/conjl.c
new file mode 100644
index 0000000000..c98e0ed1c3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/conjl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/conjl.c>
+long_double_symbol (libm, __conjl, conjl);
diff --git a/sysdeps/ieee754/ldbl-opt/creal.c b/sysdeps/ieee754/ldbl-opt/creal.c
new file mode 100644
index 0000000000..0d1c93e640
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/creal.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/creal.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __creal, creall, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/creall.c b/sysdeps/ieee754/ldbl-opt/creall.c
new file mode 100644
index 0000000000..68fedd4ccd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/creall.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/creall.c>
+long_double_symbol (libm, __creall, creall);
diff --git a/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c
new file mode 100644
index 0000000000..49c5c1249b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.c
@@ -0,0 +1,3 @@
+/* Set temporarily to non-zero if long double should be considered
+   the same as double.  */
+__thread int __no_long_double attribute_tls_model_ie attribute_hidden;
diff --git a/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
new file mode 100644
index 0000000000..692b0c53c7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h
@@ -0,0 +1,52 @@
+/* -mlong-double-64 compatibility mode macros.  */
+
+#include <nldbl-abi.h>
+#ifndef LONG_DOUBLE_COMPAT_VERSION
+# error "nldbl-abi.h must define LONG_DOUBLE_COMPAT_VERSION"
+#endif
+
+#include <shlib-compat.h>
+#define LONG_DOUBLE_COMPAT(lib, introduced) \
+  SHLIB_COMPAT(lib, introduced, LONG_DOUBLE_COMPAT_VERSION)
+#define long_double_symbol(lib, local, symbol) \
+  long_double_symbol_1 (lib, local, symbol, LONG_DOUBLE_COMPAT_VERSION)
+#if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
+# define ldbl_hidden_def(local, name) libc_hidden_ver (local, name)
+# define ldbl_strong_alias(name, aliasname) \
+  strong_alias (name, __GL_##name##_##aliasname) \
+  long_double_symbol (libc, __GL_##name##_##aliasname, aliasname);
+# define ldbl_weak_alias(name, aliasname) \
+  weak_alias (name, __GL_##name##_##aliasname) \
+  long_double_symbol (libc, __GL_##name##_##aliasname, aliasname);
+# define long_double_symbol_1(lib, local, symbol, version) \
+  versioned_symbol (lib, local, symbol, version)
+#elif defined HAVE_WEAK_SYMBOLS
+# define ldbl_hidden_def(local, name) libc_hidden_def (name)
+# define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+# define ldbl_weak_alias(name, aliasname) weak_alias (name, aliasname)
+# ifndef __ASSEMBLER__
+/* Note that weak_alias cannot be used - it is defined to nothing
+   in most of the C files.  */
+#  define long_double_symbol_1(lib, local, symbol, version) \
+  _weak_alias (local, symbol)
+# else
+#  define long_double_symbol_1(lib, local, symbol, version) \
+  weak_alias (local, symbol)
+# endif
+#else
+# define ldbl_hidden_def(local, name) libc_hidden_def (name)
+# define ldbl_strong_alias(name, aliasname) strong_alias (name, aliasname)
+# define ldbl_weak_alias(name, aliasname) strong_alias (name, aliasname)
+# define long_double_symbol_1(lib, local, symbol, version) \
+  strong_alias (local, symbol)
+#endif
+
+#ifndef __ASSEMBLER__
+# include <math.h>
+# include <math/math_private.h>
+
+/* Set temporarily to non-zero if long double should be considered
+   the same as double.  */
+extern __thread int __no_long_double attribute_tls_model_ie attribute_hidden;
+# define __ldbl_is_dbl __builtin_expect (__no_long_double, 0)
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-acos.c b/sysdeps/ieee754/ldbl-opt/nldbl-acos.c
new file mode 100644
index 0000000000..813a17e9d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-acos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+acosl (double x)
+{
+  return acos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c
new file mode 100644
index 0000000000..75508e30d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-acosh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+acoshl (double x)
+{
+  return acosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asin.c b/sysdeps/ieee754/ldbl-opt/nldbl-asin.c
new file mode 100644
index 0000000000..5bbe6cd992
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+asinl (double x)
+{
+  return asin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c
new file mode 100644
index 0000000000..512f68519b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asinh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+asinhl (double x)
+{
+  return asinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c
new file mode 100644
index 0000000000..4be216d610
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-asprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+__asprintf (char **string_ptr, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vasprintf (string_ptr, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+extern __typeof (__asprintf) asprintf attribute_hidden;
+weak_alias (__asprintf, asprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atan.c b/sysdeps/ieee754/ldbl-opt/nldbl-atan.c
new file mode 100644
index 0000000000..2849e48d03
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atanl (double x)
+{
+  return atan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c b/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c
new file mode 100644
index 0000000000..d4e5a91702
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atan2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atan2l (double x, double y)
+{
+  return atan2 (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c
new file mode 100644
index 0000000000..82b54ca6d4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-atanh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+atanhl (double x)
+{
+  return atanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c b/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c
new file mode 100644
index 0000000000..837822d2d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cabs.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cabsl (double _Complex x)
+{
+  return cabs (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c b/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c
new file mode 100644
index 0000000000..d935b511b4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cacos.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cacosl (double _Complex x)
+{
+  return cacos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c
new file mode 100644
index 0000000000..67f994b849
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cacosh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cacoshl (double _Complex x)
+{
+  return cacosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-carg.c b/sysdeps/ieee754/ldbl-opt/nldbl-carg.c
new file mode 100644
index 0000000000..bfff141c11
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-carg.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cargl (double _Complex x)
+{
+  return carg (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-casin.c b/sysdeps/ieee754/ldbl-opt/nldbl-casin.c
new file mode 100644
index 0000000000..310aa0ac21
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-casin.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+casinl (double _Complex x)
+{
+  return casin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c
new file mode 100644
index 0000000000..71b466ea22
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-casinh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+casinhl (double _Complex x)
+{
+  return casinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-catan.c b/sysdeps/ieee754/ldbl-opt/nldbl-catan.c
new file mode 100644
index 0000000000..ea5f528ee5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-catan.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+catanl (double _Complex x)
+{
+  return catan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c
new file mode 100644
index 0000000000..e6f58aa048
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-catanh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+catanhl (double _Complex x)
+{
+  return catanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c
new file mode 100644
index 0000000000..1c353a6e6b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cbrt.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+cbrtl (double x)
+{
+  return cbrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c b/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c
new file mode 100644
index 0000000000..0e1c2e70f3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ccos.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ccosl (double _Complex x)
+{
+  return ccos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c
new file mode 100644
index 0000000000..da2bf580af
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ccosh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ccoshl (double _Complex x)
+{
+  return ccosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c b/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c
new file mode 100644
index 0000000000..a8fc3d548a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ceil.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ceill (double x)
+{
+  return ceil (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c
new file mode 100644
index 0000000000..f1837afc28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cexp.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cexpl (double _Complex x)
+{
+  return cexp (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c b/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c
new file mode 100644
index 0000000000..fffbdd58ec
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cimag.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+cimagl (double _Complex x)
+{
+  return cimag (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-clog.c b/sysdeps/ieee754/ldbl-opt/nldbl-clog.c
new file mode 100644
index 0000000000..ecbae7ba91
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-clog.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+clogl (double _Complex x)
+{
+  return clog (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c b/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c
new file mode 100644
index 0000000000..193f40104a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-clog10.c
@@ -0,0 +1,11 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+clog10l (double _Complex x)
+{
+  return clog10 (x);
+}
+extern __typeof (clog10l) __clog10l attribute_hidden;
+weak_alias (clog10l, __clog10l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
new file mode 100644
index 0000000000..f82c5f60bb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -0,0 +1,852 @@
+/* *printf* family compatibility routines for IEEE double as long double
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <libioP.h>
+#include <wchar.h>
+#include <printf.h>
+#include <monetary.h>
+#include <locale/localeinfo.h>
+#include <sys/syslog.h>
+#include <bits/libc-lock.h>
+
+#include "nldbl-compat.h"
+
+libc_hidden_proto (__nldbl_vfprintf)
+libc_hidden_proto (__nldbl_vsscanf)
+libc_hidden_proto (__nldbl_vsprintf)
+libc_hidden_proto (__nldbl_vfscanf)
+libc_hidden_proto (__nldbl_vfwscanf)
+libc_hidden_proto (__nldbl_vdprintf)
+libc_hidden_proto (__nldbl_vswscanf)
+libc_hidden_proto (__nldbl_vfwprintf)
+libc_hidden_proto (__nldbl_vswprintf)
+libc_hidden_proto (__nldbl_vsnprintf)
+libc_hidden_proto (__nldbl_vasprintf)
+libc_hidden_proto (__nldbl_obstack_vprintf)
+libc_hidden_proto (__nldbl___vfwprintf_chk)
+libc_hidden_proto (__nldbl___vsnprintf_chk)
+libc_hidden_proto (__nldbl___vfprintf_chk)
+libc_hidden_proto (__nldbl___vsyslog_chk)
+libc_hidden_proto (__nldbl___vsprintf_chk)
+libc_hidden_proto (__nldbl___vswprintf_chk)
+libc_hidden_proto (__nldbl___vstrfmon)
+libc_hidden_proto (__nldbl___vstrfmon_l)
+
+static void
+__nldbl_cleanup (void *arg)
+{
+  __no_long_double = 0;
+}
+
+#define set_no_long_double() \
+  __libc_cleanup_push (__nldbl_cleanup, NULL); __no_long_double = 1
+#define clear_no_long_double() \
+  __no_long_double = 0; __libc_cleanup_pop (0)
+
+/* Compatibility with IEEE double as long double.
+   IEEE quad long double is used by default for most programs, so
+   we don't need to split this into one file per function for the
+   sake of statically linked programs.  */
+
+int
+attribute_compat_text_section
+__nldbl___asprintf (char **string_ptr, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vasprintf (string_ptr, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+weak_alias (__nldbl___asprintf, __nldbl_asprintf)
+
+int
+attribute_compat_text_section
+__nldbl_dprintf (int d, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vdprintf (d, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_fprintf (FILE *stream, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfprintf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwprintf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_printf (const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfprintf (stdout, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+strong_alias (__nldbl_printf, __nldbl__IO_printf)
+
+int
+attribute_compat_text_section
+__nldbl_sprintf (char *s, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vsprintf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+strong_alias (__nldbl_sprintf, __nldbl__IO_sprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vfprintf (FILE *s, const char *fmt, va_list ap)
+{
+  int done;
+  set_no_long_double ();
+  done = INTUSE(_IO_vfprintf) (s, fmt, ap);
+  clear_no_long_double ();
+  return done;
+}
+libc_hidden_def (__nldbl_vfprintf)
+strong_alias (__nldbl_vfprintf, __nldbl__IO_vfprintf)
+
+int
+attribute_compat_text_section
+__nldbl__IO_vsprintf (char *string, const char *fmt, va_list ap)
+{
+  int done;
+  __no_long_double = 1;
+  done = INTUSE(_IO_vsprintf) (string, fmt, ap);
+  __no_long_double = 0;
+  return done;
+}
+weak_alias (__nldbl__IO_vsprintf, __nldbl_vsprintf)
+libc_hidden_def (__nldbl_vsprintf)
+
+int
+attribute_compat_text_section
+__nldbl_obstack_vprintf (struct obstack *obstack, const char *fmt,
+			 va_list ap)
+{
+  int done;
+  __no_long_double = 1;
+  done = _IO_obstack_vprintf (obstack, fmt, ap);
+  __no_long_double = 0;
+  return done;
+}
+libc_hidden_def (__nldbl_obstack_vprintf)
+
+int
+attribute_compat_text_section
+__nldbl_obstack_printf (struct obstack *obstack, const char *fmt, ...)
+{
+  int result;
+  va_list ap;
+  va_start (ap, fmt);
+  result = __nldbl_obstack_vprintf (obstack, fmt, ap);
+  va_end (ap);
+  return result;
+}
+
+int
+attribute_compat_text_section weak_function
+__nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vswprintf (s, n, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vasprintf (char **result_ptr, const char *fmt, va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = _IO_vasprintf (result_ptr, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl_vasprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vdprintf (int d, const char *fmt, va_list arg)
+{
+  int res;
+  set_no_long_double ();
+  res = _IO_vdprintf (d, fmt, arg);
+  clear_no_long_double ();
+  return res;
+}
+libc_hidden_def (__nldbl_vdprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+  int res;
+  set_no_long_double ();
+  res = _IO_vfwprintf (s, fmt, ap);
+  clear_no_long_double ();
+  return res;
+}
+libc_hidden_def (__nldbl_vfwprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vprintf (const char *fmt, va_list ap)
+{
+  return __nldbl_vfprintf (stdout, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
+		   va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = _IO_vsnprintf (string, maxlen, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl_vsnprintf)
+weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
+		   va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = _IO_vswprintf (string, maxlen, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl_vswprintf)
+
+int
+attribute_compat_text_section
+__nldbl_vwprintf (const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vfwprintf (stdout, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_wprintf (const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwprintf (stdout, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl__IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap,
+		    int *errp)
+{
+  int res;
+  set_no_long_double ();
+  res = INTUSE(_IO_vfscanf) (s, fmt, ap, errp);
+  clear_no_long_double ();
+  return res;
+}
+
+int
+attribute_compat_text_section
+__nldbl___vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+  int res;
+  set_no_long_double ();
+  res = INTUSE(_IO_vfscanf) (s, fmt, ap, NULL);
+  clear_no_long_double ();
+  return res;
+}
+weak_alias (__nldbl___vfscanf, __nldbl_vfscanf)
+libc_hidden_def (__nldbl_vfscanf)
+
+int
+attribute_compat_text_section
+__nldbl_sscanf (const char *s, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vsscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+strong_alias (__nldbl_sscanf, __nldbl__IO_sscanf)
+
+int
+attribute_compat_text_section
+__nldbl___vsscanf (const char *string, const char *fmt, va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = _IO_vsscanf (string, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+weak_alias (__nldbl___vsscanf, __nldbl_vsscanf)
+libc_hidden_def (__nldbl_vsscanf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vscanf (const char *fmt, va_list ap)
+{
+  return __nldbl_vfscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_fscanf (FILE *stream, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfscanf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_scanf (const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfscanf (stdin, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+  int res;
+  set_no_long_double ();
+  res = _IO_vfwscanf (s, fmt, ap, NULL);
+  clear_no_long_double ();
+  return res;
+}
+libc_hidden_def (__nldbl_vfwscanf)
+
+int
+attribute_compat_text_section
+__nldbl_swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vswscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = vswscanf (string, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl_vswscanf)
+
+int
+attribute_compat_text_section weak_function
+__nldbl_vwscanf (const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vfwscanf (stdin, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl_fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwscanf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl_wscanf (const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwscanf (stdin, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___printf_chk (int flag, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
+			const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
+			const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+int
+attribute_compat_text_section
+__nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
+{
+  int res;
+  set_no_long_double ();
+  res = __vfprintf_chk (s, flag, fmt, ap);
+  clear_no_long_double ();
+  return res;
+}
+libc_hidden_def (__nldbl___vfprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
+{
+  int res;
+  set_no_long_double ();
+  res = __vfwprintf_chk (s, flag, fmt, ap);
+  clear_no_long_double ();
+  return res;
+}
+libc_hidden_def (__nldbl___vfwprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vprintf_chk (int flag, const char *fmt, va_list ap)
+{
+  return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
+			 const char *fmt, va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = __vsnprintf_chk (string, maxlen, flag, slen, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl___vsnprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
+			va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = __vsprintf_chk (string, flag, slen, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl___vsprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
+			 const wchar_t *fmt, va_list ap)
+{
+  int res;
+  __no_long_double = 1;
+  res = __vswprintf_chk (string, maxlen, flag, slen, fmt, ap);
+  __no_long_double = 0;
+  return res;
+}
+libc_hidden_def (__nldbl___vswprintf_chk)
+
+int
+attribute_compat_text_section
+__nldbl___vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
+}
+
+int
+attribute_compat_text_section
+__nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+
+extern __typeof (printf_size) __printf_size;
+
+int
+attribute_compat_text_section
+__nldbl_printf_size (FILE *fp, const struct printf_info *info,
+		     const void *const *args)
+{
+  struct printf_info info_no_ldbl = *info;
+
+  info_no_ldbl.is_long_double = 0;
+  return __printf_size (fp, &info_no_ldbl, args);
+}
+
+extern __typeof (__printf_fp) ___printf_fp;
+
+int
+attribute_compat_text_section
+__nldbl___printf_fp (FILE *fp, const struct printf_info *info,
+		     const void *const *args)
+{
+  struct printf_info info_no_ldbl = *info;
+
+  info_no_ldbl.is_long_double = 0;
+  return ___printf_fp (fp, &info_no_ldbl, args);
+}
+
+ssize_t
+attribute_compat_text_section
+__nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
+{
+  va_list ap;
+  ssize_t res;
+
+  va_start (ap, format);
+  res = __nldbl___vstrfmon (s, maxsize, format, ap);
+  va_end (ap);
+  return res;
+}
+
+ssize_t
+attribute_compat_text_section
+__nldbl___strfmon_l (char *s, size_t maxsize, __locale_t loc,
+		     const char *format, ...)
+{
+  va_list ap;
+  ssize_t res;
+
+  va_start (ap, format);
+  res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
+  va_end (ap);
+  return res;
+}
+weak_alias (__nldbl___strfmon_l, __nldbl_strfmon_l)
+
+ssize_t
+attribute_compat_text_section
+__nldbl___vstrfmon (char *s, size_t maxsize, const char *format, va_list ap)
+{
+  ssize_t res;
+  __no_long_double = 1;
+  res = __vstrfmon_l (s, maxsize, _NL_CURRENT_LOCALE, format, ap);
+  __no_long_double = 0;
+  va_end (ap);
+  return res;
+}
+libc_hidden_def (__nldbl___vstrfmon)
+
+ssize_t
+attribute_compat_text_section
+__nldbl___vstrfmon_l (char *s, size_t maxsize, __locale_t loc,
+		      const char *format, va_list ap)
+{
+  ssize_t res;
+  __no_long_double = 1;
+  res = __vstrfmon_l (s, maxsize, loc, format, ap);
+  __no_long_double = 0;
+  va_end (ap);
+  return res;
+}
+libc_hidden_def (__nldbl___vstrfmon_l)
+
+void
+attribute_compat_text_section
+__nldbl_syslog (int pri, const char *fmt, ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  __nldbl___vsyslog_chk (pri, -1, fmt, ap);
+  va_end (ap);
+}
+
+void
+attribute_compat_text_section
+__nldbl___syslog_chk (int pri, int flag, const char *fmt, ...)
+{
+  va_list ap;
+
+  va_start (ap, fmt);
+  __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+  va_end(ap);
+}
+
+void
+attribute_compat_text_section
+__nldbl___vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
+{
+  set_no_long_double ();
+  __vsyslog_chk (pri, flag, fmt, ap);
+  clear_no_long_double ();
+}
+libc_hidden_def (__nldbl___vsyslog_chk)
+
+void
+attribute_compat_text_section
+__nldbl_vsyslog (int pri, const char *fmt, va_list ap)
+{
+  __nldbl___vsyslog_chk (pri, -1, fmt, ap);
+}
+
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_sprintf, _IO_sprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vfprintf, _IO_vfprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vsprintf, _IO_vsprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_dprintf, dprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_fprintf, fprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_printf, printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_sprintf, sprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vfprintf, vfprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vprintf, vprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_fprintf, _IO_fprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vsnprintf, __vsnprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_asprintf, asprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_obstack_printf, obstack_printf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_obstack_vprintf, obstack_vprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_snprintf, snprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vasprintf, vasprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vdprintf, vdprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsnprintf, vsnprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsprintf, vsprintf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_sscanf, _IO_sscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl__IO_vfscanf, _IO_vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vfscanf, __vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___vsscanf, __vsscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_fscanf, fscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_scanf, scanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_sscanf, sscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vfscanf, vfscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vscanf, vscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsscanf, vsscanf, GLIBC_2_0);
+compat_symbol (libc, __nldbl___printf_fp, __printf_fp, GLIBC_2_0);
+compat_symbol (libc, __nldbl_strfmon, strfmon, GLIBC_2_0);
+compat_symbol (libc, __nldbl_syslog, syslog, GLIBC_2_0);
+compat_symbol (libc, __nldbl_vsyslog, vsyslog, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
+compat_symbol (libc, __nldbl___asprintf, __asprintf, GLIBC_2_1);
+compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
+compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
+compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_fwprintf, fwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vfwprintf, vfwprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vswprintf, vswprintf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_fwscanf, fwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_swscanf, swscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
+compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
+compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3_4)
+compat_symbol (libc, __nldbl___sprintf_chk, __sprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vsprintf_chk, __vsprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___snprintf_chk, __snprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vsnprintf_chk, __vsnprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___printf_chk, __printf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4);
+compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
new file mode 100644
index 0000000000..c0461000f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
@@ -0,0 +1,87 @@
+/* Prototypes for compatibility double == long double entry points.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@cygnus.com>, 2006.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef __NLDBL_COMPAT_H
+#define __NLDBL_COMPAT_H	1
+
+/* Avoid long double prototypes.  */
+#define __NO_LONG_DOUBLE_MATH	1
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <printf.h>
+#include <wchar.h>
+#include <math.h>
+#include <monetary.h>
+#include <sys/syslog.h>
+
+
+/* Declare the __nldbl_NAME function the wrappers call that's in libc.so.  */
+#define NLDBL_DECL(name) extern __typeof (name) __nldbl_##name
+
+NLDBL_DECL (_IO_vfscanf);
+NLDBL_DECL (vfscanf);
+NLDBL_DECL (vfwscanf);
+NLDBL_DECL (obstack_vprintf);
+NLDBL_DECL (vasprintf);
+NLDBL_DECL (dprintf);
+NLDBL_DECL (vdprintf);
+NLDBL_DECL (fprintf);
+NLDBL_DECL (vfprintf);
+NLDBL_DECL (vfwprintf);
+NLDBL_DECL (vsnprintf);
+NLDBL_DECL (vsprintf);
+NLDBL_DECL (vsscanf);
+NLDBL_DECL (vswprintf);
+NLDBL_DECL (vswscanf);
+NLDBL_DECL (__asprintf);
+NLDBL_DECL (asprintf);
+NLDBL_DECL (__printf_fp);
+NLDBL_DECL (printf_size);
+NLDBL_DECL (syslog);
+NLDBL_DECL (vsyslog);
+NLDBL_DECL (qecvt);
+NLDBL_DECL (qfcvt);
+NLDBL_DECL (qgcvt);
+NLDBL_DECL (__vstrfmon_l);
+
+/* This one does not exist in the normal interface, only
+   __nldbl___vstrfmon really exists.  */
+extern ssize_t __nldbl___vstrfmon (char *, size_t, const char *, va_list)
+  __THROW;
+
+/* These don't use __typeof because they were not declared by the headers,
+   since we don't compile with _FORTIFY_SOURCE.  */
+extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
+				   const char *__restrict, _G_va_list);
+extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
+				    const wchar_t *__restrict, __gnuc_va_list);
+extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
+				   const char *__restrict, _G_va_list) __THROW;
+extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
+				    const char *__restrict, _G_va_list)
+  __THROW;
+extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
+				    const wchar_t *__restrict, __gnuc_va_list)
+  __THROW;
+extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
+
+
+#endif /* __NLDBL_COMPAT_H */
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-conj.c b/sysdeps/ieee754/ldbl-opt/nldbl-conj.c
new file mode 100644
index 0000000000..8927ea9968
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-conj.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+conjl (double _Complex x)
+{
+  return conj (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c b/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c
new file mode 100644
index 0000000000..ef23badecc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-copysign.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+copysignl (double x, double y)
+{
+  return copysign (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cos.c b/sysdeps/ieee754/ldbl-opt/nldbl-cos.c
new file mode 100644
index 0000000000..08738af048
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+cosl (double x)
+{
+  return cos (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c b/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c
new file mode 100644
index 0000000000..0ab834ffd9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cosh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+coshl (double x)
+{
+  return cosh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c b/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c
new file mode 100644
index 0000000000..709e7d73b1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cpow.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cpowl (double _Complex x, double _Complex y)
+{
+  return cpow (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c b/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c
new file mode 100644
index 0000000000..6f88b88bf2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-cproj.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+cprojl (double _Complex x)
+{
+  return cproj (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-creal.c b/sysdeps/ieee754/ldbl-opt/nldbl-creal.c
new file mode 100644
index 0000000000..b02ce6e5e4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-creal.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double
+attribute_hidden
+creall (double _Complex x)
+{
+  return creal (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csin.c b/sysdeps/ieee754/ldbl-opt/nldbl-csin.c
new file mode 100644
index 0000000000..b2e2c9c8ef
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csin.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csinl (double _Complex x)
+{
+  return csin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c
new file mode 100644
index 0000000000..2bcba920e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csinh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csinhl (double _Complex x)
+{
+  return csinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c
new file mode 100644
index 0000000000..ae00a29885
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-csqrt.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+csqrtl (double _Complex x)
+{
+  return csqrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c b/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c
new file mode 100644
index 0000000000..422c5cce94
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ctan.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ctanl (double _Complex x)
+{
+  return ctan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c
new file mode 100644
index 0000000000..f3842ed26f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ctanh.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+#include <complex.h>
+
+double _Complex
+attribute_hidden
+ctanhl (double _Complex x)
+{
+  return ctanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c
new file mode 100644
index 0000000000..6e26db2a24
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-dprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+dprintf (int d, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vdprintf (d, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-drem.c b/sysdeps/ieee754/ldbl-opt/nldbl-drem.c
new file mode 100644
index 0000000000..1e08ce1d28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-drem.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+dreml (double x, double y)
+{
+  return drem (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-erf.c b/sysdeps/ieee754/ldbl-opt/nldbl-erf.c
new file mode 100644
index 0000000000..0032c1febc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-erf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+erfl (double x)
+{
+  return erf (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c b/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c
new file mode 100644
index 0000000000..21d09680aa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-erfc.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+erfcl (double x)
+{
+  return erfc (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp.c
new file mode 100644
index 0000000000..ad2c89b6d5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+expl (double x)
+{
+  return exp (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c
new file mode 100644
index 0000000000..2d0ead686b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+exp10l (double x)
+{
+  return exp10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c b/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c
new file mode 100644
index 0000000000..d5fce3970d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-exp2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+exp2l (double x)
+{
+  return exp2 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c b/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c
new file mode 100644
index 0000000000..be5c6e51c4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-expm1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+expm1l (double x)
+{
+  return expm1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c b/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c
new file mode 100644
index 0000000000..10729a6ec0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fabs.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fabsl (double x)
+{
+  return fabs (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c b/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c
new file mode 100644
index 0000000000..72896b63ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fdim.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fdiml (double x, double y)
+{
+  return fdim (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-finite.c b/sysdeps/ieee754/ldbl-opt/nldbl-finite.c
new file mode 100644
index 0000000000..000adfb8aa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-finite.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__finitel (double x)
+{
+  return __finite (x);
+}
+extern __typeof (__finitel) finitel attribute_hidden;
+weak_alias (__finitel, finitel)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-floor.c b/sysdeps/ieee754/ldbl-opt/nldbl-floor.c
new file mode 100644
index 0000000000..c7e9f834b6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-floor.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+floorl (double x)
+{
+  return floor (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fma.c b/sysdeps/ieee754/ldbl-opt/nldbl-fma.c
new file mode 100644
index 0000000000..9474483673
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmal (double x, double y, double z)
+{
+  return fma (x, y, z);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c
new file mode 100644
index 0000000000..f5a84776ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmax.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmaxl (double x, double y)
+{
+  return fmax (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c
new file mode 100644
index 0000000000..a353cf9484
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fminl (double x, double y)
+{
+  return fmin (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c
new file mode 100644
index 0000000000..aa692b9f36
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmod.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmodl (double x, double y)
+{
+  return fmod (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c
new file mode 100644
index 0000000000..9df4c4bc34
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+int
+fprintf (FILE *stream, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfprintf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+extern __typeof (fprintf) _IO_fprintf attribute_hidden;
+weak_alias (fprintf, _IO_fprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c
new file mode 100644
index 0000000000..43a7618183
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfprintf_chk (stream, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c
new file mode 100644
index 0000000000..0ec97e10e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-frexp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+frexpl (double x, int *exponent)
+{
+  return frexp (x, exponent);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
new file mode 100644
index 0000000000..1b768e306f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+fscanf (FILE *stream, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl__IO_vfscanf (stream, fmt, arg, NULL);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c
new file mode 100644
index 0000000000..18362af013
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+fwprintf (FILE *stream, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwprintf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c
new file mode 100644
index 0000000000..09731cf29d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfwprintf_chk (stream, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
new file mode 100644
index 0000000000..27fc1a7271
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fwscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+fwscanf (FILE *stream, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwscanf (stream, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c
new file mode 100644
index 0000000000..10dc640b92
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-gamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+gammal (double x)
+{
+  return gamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c b/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c
new file mode 100644
index 0000000000..2105f3eba8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-hypot.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+hypotl (double x, double y)
+{
+  return hypot (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c b/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c
new file mode 100644
index 0000000000..e840b2a447
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ilogb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+ilogbl (double x)
+{
+  return ilogb (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
new file mode 100644
index 0000000000..05581c0354
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+_IO_vfscanf (FILE *s, const char *fmt, _IO_va_list ap, int *errp)
+{
+  return __nldbl__IO_vfscanf (s, fmt, ap, errp);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c b/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c
new file mode 100644
index 0000000000..340d2418c0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-isinf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isinfl (double x)
+{
+  return __isinf (x);
+}
+extern __typeof (__isinfl) isinfl attribute_hidden;
+weak_alias (__isinfl, isinfl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c b/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c
new file mode 100644
index 0000000000..e5f0f1b394
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-isnan.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__isnanl (double x)
+{
+  return __isnan (x);
+}
+extern __typeof (__isnanl) isnanl attribute_hidden;
+weak_alias (__isnanl, isnanl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-j0.c b/sysdeps/ieee754/ldbl-opt/nldbl-j0.c
new file mode 100644
index 0000000000..9d59f0a015
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-j0.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+j0l (double x)
+{
+  return j0 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-j1.c b/sysdeps/ieee754/ldbl-opt/nldbl-j1.c
new file mode 100644
index 0000000000..dba7366861
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-j1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+j1l (double x)
+{
+  return j1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-jn.c b/sysdeps/ieee754/ldbl-opt/nldbl-jn.c
new file mode 100644
index 0000000000..3f19bbb1a8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-jn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+jnl (int n, double x)
+{
+  return jn (n, x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c b/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c
new file mode 100644
index 0000000000..360f8f0f6b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-ldexp.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ldexpl (double x, int exponent)
+{
+  return ldexp (x, exponent);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c
new file mode 100644
index 0000000000..0055212628
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+lgammal (double x)
+{
+  return lgamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c
new file mode 100644
index 0000000000..e1ab9a1d0a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lgamma_r.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+lgammal_r (double x, int *signgamp)
+{
+  return lgamma_r (x, signgamp);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c b/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c
new file mode 100644
index 0000000000..6dfce89d0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-llrint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long long int
+attribute_hidden
+llrintl (double x)
+{
+  return llrint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-llround.c b/sysdeps/ieee754/ldbl-opt/nldbl-llround.c
new file mode 100644
index 0000000000..0157a079f4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-llround.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long long int
+attribute_hidden
+llroundl (double x)
+{
+  return llround (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log.c b/sysdeps/ieee754/ldbl-opt/nldbl-log.c
new file mode 100644
index 0000000000..a5a1ae7cd7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+logl (double x)
+{
+  return log (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log10.c b/sysdeps/ieee754/ldbl-opt/nldbl-log10.c
new file mode 100644
index 0000000000..1477866dc6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log10l (double x)
+{
+  return log10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c b/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c
new file mode 100644
index 0000000000..455b25a9f4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log1p.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log1pl (double x)
+{
+  return log1p (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-log2.c b/sysdeps/ieee754/ldbl-opt/nldbl-log2.c
new file mode 100644
index 0000000000..8c1ae344e5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-log2.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+log2l (double x)
+{
+  return log2 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-logb.c b/sysdeps/ieee754/ldbl-opt/nldbl-logb.c
new file mode 100644
index 0000000000..d9ce8de075
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-logb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+logbl (double x)
+{
+  return logb (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c b/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c
new file mode 100644
index 0000000000..0acd3d4ae6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lrint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long int
+attribute_hidden
+lrintl (double x)
+{
+  return lrint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-lround.c b/sysdeps/ieee754/ldbl-opt/nldbl-lround.c
new file mode 100644
index 0000000000..aadb111f88
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-lround.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+long int
+attribute_hidden
+lroundl (double x)
+{
+  return lround (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-modf.c b/sysdeps/ieee754/ldbl-opt/nldbl-modf.c
new file mode 100644
index 0000000000..bcbe6bb435
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-modf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+modfl (double x, double *iptr)
+{
+  return modf (x, iptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nan.c b/sysdeps/ieee754/ldbl-opt/nldbl-nan.c
new file mode 100644
index 0000000000..8db157a0ea
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nanl (const char *tag)
+{
+  return nan (tag);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c b/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c
new file mode 100644
index 0000000000..fd4a24684d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nearbyint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nearbyintl (double x)
+{
+  return nearbyint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c b/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c
new file mode 100644
index 0000000000..b0bae43f49
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nextafter.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+nextafterl (double x, double y)
+{
+  return nextafter (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c b/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c
new file mode 100644
index 0000000000..acbd01a0cf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nexttoward.c
@@ -0,0 +1,14 @@
+#define nexttoward nexttoward_XXX
+#define nexttowardl nexttowardl_XXX
+#include "nldbl-compat.h"
+#undef nexttoward
+#undef nexttowardl
+
+double
+attribute_hidden
+nexttoward (double x, double y)
+{
+  return nextafter (x, y);
+}
+extern __typeof (nexttoward) nexttowardl attribute_hidden;
+strong_alias (nexttoward, nexttowardl)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c b/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c
new file mode 100644
index 0000000000..350b08d39e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-nexttowardf.c
@@ -0,0 +1,12 @@
+#define nexttowardf nexttowardf_XXX
+#include "nldbl-compat.h"
+#undef nexttowardf
+
+extern float __nldbl_nexttowardf (float x, double y);
+
+float
+attribute_hidden
+nexttowardf (float x, double y)
+{
+  return __nldbl_nexttowardf (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c
new file mode 100644
index 0000000000..4abff2dc0d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_printf.c
@@ -0,0 +1,13 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+obstack_printf (struct obstack *obstack, const char *fmt, ...)
+{
+  int result;
+  va_list ap;
+  va_start (ap, fmt);
+  result = __nldbl_obstack_vprintf (obstack, fmt, ap);
+  va_end (ap);
+  return result;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c
new file mode 100644
index 0000000000..228a50726b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+obstack_vprintf (struct obstack *obstack, const char *fmt, va_list ap)
+{
+  return __nldbl_obstack_vprintf (obstack, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-pow.c b/sysdeps/ieee754/ldbl-opt/nldbl-pow.c
new file mode 100644
index 0000000000..a5cc446555
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-pow.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+powl (double x, double y)
+{
+  return pow (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c b/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c
new file mode 100644
index 0000000000..20ebf8d1bb
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-pow10.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+pow10l (double x)
+{
+  return pow10 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf.c
new file mode 100644
index 0000000000..e4b0fbae0c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+printf (const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfprintf (stdout, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+extern __typeof (printf) _IO_printf attribute_hidden;
+strong_alias (printf, _IO_printf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c
new file mode 100644
index 0000000000..926db412f9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__printf_chk (int flag, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfprintf_chk (stdout, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c
new file mode 100644
index 0000000000..057dfe0b8a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_fp.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__printf_fp (FILE *fp, const struct printf_info *info,
+	     const void *const *args)
+{
+  return __nldbl___printf_fp (fp, info, args);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c b/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c
new file mode 100644
index 0000000000..d8b1fc9995
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-printf_size.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+printf_size (FILE *__restrict fp, const struct printf_info *info,
+	     const void *const *__restrict args)
+{
+  return __nldbl_printf_size (fp, info, args);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c
new file mode 100644
index 0000000000..9f0b0a66a9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt.c
@@ -0,0 +1,10 @@
+#define qecvt qecvt_XXX
+#include "nldbl-compat.h"
+#undef qecvt
+
+attribute_hidden
+char *
+qecvt (double val, int ndigit, int *__restrict decpt, int *__restrict sign)
+{
+  return ecvt (val, ndigit, decpt, sign);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c
new file mode 100644
index 0000000000..06f99146cc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qecvt_r.c
@@ -0,0 +1,11 @@
+#define qecvt_r qecvt_r_XXX
+#include "nldbl-compat.h"
+#undef qecvt_r
+
+int
+attribute_hidden
+qecvt_r (double val, int ndigit, int *__restrict decpt, int *__restrict sign,
+	 char *__restrict buf, size_t len)
+{
+  return ecvt_r (val, ndigit, decpt, sign, buf, len);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c
new file mode 100644
index 0000000000..37fa7f0467
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt.c
@@ -0,0 +1,10 @@
+#define qfcvt qfcvt_XXX
+#include "nldbl-compat.h"
+#undef qfcvt
+
+attribute_hidden
+char *
+qfcvt (double val, int ndigit, int *__restrict decpt, int *__restrict sign)
+{
+  return fcvt (val, ndigit, decpt, sign);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c
new file mode 100644
index 0000000000..03224fefa9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qfcvt_r.c
@@ -0,0 +1,11 @@
+#define qfcvt_r qfcvt_r_XXX
+#include "nldbl-compat.h"
+#undef qfcvt_r
+
+int
+attribute_hidden
+qfcvt_r (double val, int ndigit, int *__restrict decpt, int *__restrict sign,
+	 char *__restrict buf, size_t len)
+{
+  return fcvt_r (val, ndigit, decpt, sign, buf, len);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c b/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c
new file mode 100644
index 0000000000..b935d0962e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-qgcvt.c
@@ -0,0 +1,10 @@
+#define qgcvt qgcvt_XXX
+#include "nldbl-compat.h"
+#undef qgcvt
+
+attribute_hidden
+char *
+qgcvt (double val, int ndigit, char *buf)
+{
+  return gcvt (val, ndigit, buf);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c
new file mode 100644
index 0000000000..a8d5bafb5f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-remainder.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+remainderl (double x, double y)
+{
+  return remainder (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c b/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c
new file mode 100644
index 0000000000..592dadae8d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-remquo.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+remquol (double x, double y, int *quo)
+{
+  return remquo (x, y, quo);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-rint.c b/sysdeps/ieee754/ldbl-opt/nldbl-rint.c
new file mode 100644
index 0000000000..00f942f1a7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-rint.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+rintl (double x)
+{
+  return rint (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-round.c b/sysdeps/ieee754/ldbl-opt/nldbl-round.c
new file mode 100644
index 0000000000..be9bd5112e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-round.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+roundl (double x)
+{
+  return round (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c
new file mode 100644
index 0000000000..00d3e2e714
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalb.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalbl (double x, double n)
+{
+  return scalb (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c
new file mode 100644
index 0000000000..b5bd501250
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalbln.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalblnl (double x, long int n)
+{
+  return scalbln (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c b/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c
new file mode 100644
index 0000000000..b1914ebf49
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scalbn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+scalbnl (double x, int n)
+{
+  return scalbn (x, n);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
new file mode 100644
index 0000000000..bbab371cbe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+scanf (const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl__IO_vfscanf (stdin, fmt, arg, NULL);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c b/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c
new file mode 100644
index 0000000000..b62d0ed7fe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-signbit.c
@@ -0,0 +1,10 @@
+#define __signbitl __signbitl_XXX
+#include "nldbl-compat.h"
+#undef __signbitl
+
+int
+attribute_hidden
+__signbitl (double x)
+{
+  return __signbit (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-significand.c b/sysdeps/ieee754/ldbl-opt/nldbl-significand.c
new file mode 100644
index 0000000000..624381dde7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-significand.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+significandl (double x)
+{
+  return significand (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sin.c b/sysdeps/ieee754/ldbl-opt/nldbl-sin.c
new file mode 100644
index 0000000000..0e76e05e6b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sin.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sinl (double x)
+{
+  return sin (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c b/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c
new file mode 100644
index 0000000000..9f2ab2b9fc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sincos.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+sincosl (double x, double *sinx, double *cosx)
+{
+  sincos (x, sinx, cosx);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c b/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c
new file mode 100644
index 0000000000..99ea62e8dc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sinh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sinhl (double x)
+{
+  return sinh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c
new file mode 100644
index 0000000000..ef6fb96a2c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+snprintf (char *s, size_t maxlen, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vsnprintf (s, maxlen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c
new file mode 100644
index 0000000000..944d3de9db
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-snprintf_chk.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__snprintf_chk (char *s, size_t maxlen, int flag, size_t slen,
+		const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vsnprintf_chk (s, maxlen, flag, slen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c
new file mode 100644
index 0000000000..5d37a7e7f0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+sprintf (char *s, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vsprintf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+extern __typeof (sprintf) _IO_sprintf attribute_hidden;
+strong_alias (sprintf, _IO_sprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c
new file mode 100644
index 0000000000..349b7c5c22
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vsprintf_chk (s, flag, slen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c b/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c
new file mode 100644
index 0000000000..4ae65665de
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sqrt.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+sqrtl (double x)
+{
+  return sqrt (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
new file mode 100644
index 0000000000..a771d49996
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-sscanf.c
@@ -0,0 +1,17 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+sscanf (const char *s, const char *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vsscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
+extern __typeof (sscanf) _IO_sscanf attribute_hidden;
+strong_alias (sscanf, _IO_sscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c
new file mode 100644
index 0000000000..38f4071278
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon.c
@@ -0,0 +1,14 @@
+#include "nldbl-compat.h"
+
+ssize_t
+attribute_hidden
+strfmon (char *s, size_t maxsize, const char *format, ...)
+{
+  va_list ap;
+  ssize_t res;
+
+  va_start (ap, format);
+  res = __nldbl___vstrfmon (s, maxsize, format, ap);
+  va_end (ap);
+  return res;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
new file mode 100644
index 0000000000..0db0e8c42f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strfmon_l.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+ssize_t
+attribute_hidden
+__strfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, ...)
+{
+  va_list ap;
+  ssize_t res;
+
+  va_start (ap, format);
+  res = __nldbl___vstrfmon_l (s, maxsize, loc, format, ap);
+  va_end (ap);
+  return res;
+}
+extern __typeof (__strfmon_l) strfmon_l attribute_hidden;
+weak_alias (__strfmon_l, strfmon_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c
new file mode 100644
index 0000000000..99b907947b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtold.c
@@ -0,0 +1,10 @@
+#define strtold strtold_XXX
+#include "nldbl-compat.h"
+#undef strtold
+
+double
+attribute_hidden
+strtold (const char *nptr, char **endptr)
+{
+  return strtod (nptr, endptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
new file mode 100644
index 0000000000..422746379c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtold_l.c
@@ -0,0 +1,20 @@
+#define strtold_l strtold_l_XXX
+#define __strtold_l __strtold_l_XXX
+#define __strtod_l __strtod_l_XXX
+#include "nldbl-compat.h"
+#undef strtold_l
+#undef __strtold_l
+#undef __strtod_l
+
+extern double
+__strtod_l (__const char *__restrict __nptr, char **__restrict __endptr,
+	    __locale_t __loc);
+
+double
+attribute_hidden
+__strtold_l (const char *nptr, char **endptr, __locale_t loc)
+{
+  return __strtod_l (nptr, endptr, loc);
+}
+extern __typeof (__strtold_l) strtold_l attribute_hidden;
+weak_alias (__strtold_l, strtold_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c b/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c
new file mode 100644
index 0000000000..0bafabc6e4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-strtoldint.c
@@ -0,0 +1,10 @@
+#define __strtold_internal __strtold_internal_XXX
+#include "nldbl-compat.h"
+#undef __strtold_internal
+
+double
+attribute_hidden
+__strtold_internal (const char *nptr, char **endptr, int group)
+{
+  return __strtod_internal (nptr, endptr, group);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c
new file mode 100644
index 0000000000..7f4f7b04d3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vswprintf (s, n, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c
new file mode 100644
index 0000000000..0373f6ebc2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swprintf_chk.c
@@ -0,0 +1,16 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
+		const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vswprintf_chk (s, n, flag, slen, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
new file mode 100644
index 0000000000..dd058f47ab
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-swscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+swscanf (const wchar_t *s, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vswscanf (s, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c b/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c
new file mode 100644
index 0000000000..8687e9f540
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-syslog.c
@@ -0,0 +1,11 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+syslog (int pri, const char *fmt, ...)
+{
+  va_list ap;
+  va_start (ap, fmt);
+  __nldbl_vsyslog (pri, fmt, ap);
+  va_end (ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c
new file mode 100644
index 0000000000..31ea6a8b9d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-syslog_chk.c
@@ -0,0 +1,12 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+__syslog_chk (int pri, int flag, const char *fmt, ...)
+{
+  va_list ap;
+
+  va_start (ap, fmt);
+  __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+  va_end(ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tan.c b/sysdeps/ieee754/ldbl-opt/nldbl-tan.c
new file mode 100644
index 0000000000..1a27b6fbdd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tan.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tanl (double x)
+{
+  return tan (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c b/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c
new file mode 100644
index 0000000000..fc2fd32eb8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tanh.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tanhl (double x)
+{
+  return tanh (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c b/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c
new file mode 100644
index 0000000000..bbf613abe1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-tgamma.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+tgammal (double x)
+{
+  return tgamma (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c b/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c
new file mode 100644
index 0000000000..d0131e80a3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-trunc.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+truncl (double x)
+{
+  return trunc (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c
new file mode 100644
index 0000000000..52fa18ccee
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vasprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vasprintf (char **result_ptr, const char *fmt, va_list ap)
+{
+  return __nldbl_vasprintf (result_ptr, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c
new file mode 100644
index 0000000000..1acbd40625
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vdprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vdprintf (int d, const char *fmt, va_list arg)
+{
+  return __nldbl_vdprintf (d, fmt, arg);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c
new file mode 100644
index 0000000000..6ca8437b28
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vfprintf (FILE *s, const char *fmt, va_list ap)
+{
+  return __nldbl_vfprintf (s, fmt, ap);
+}
+extern __typeof (vfprintf) _IO_vfprintf attribute_hidden;
+strong_alias (vfprintf, _IO_vfprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c
new file mode 100644
index 0000000000..0f6820af63
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
+{
+  return __nldbl___vfprintf_chk (s, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
new file mode 100644
index 0000000000..f23465ee95
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfscanf (FILE *s, const char *fmt, va_list ap)
+{
+  return __nldbl__IO_vfscanf (s, fmt, ap, NULL);
+}
+extern __typeof (__vfscanf) vfscanf attribute_hidden;
+weak_alias (__vfscanf, vfscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c
new file mode 100644
index 0000000000..c3fe76a971
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vfwprintf (s, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c
new file mode 100644
index 0000000000..b3b69f0571
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___vfwprintf_chk (s, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
new file mode 100644
index 0000000000..be9febc9a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfwscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vfwscanf (s, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c
new file mode 100644
index 0000000000..ed0d27d9a0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vprintf (const char *fmt, va_list ap)
+{
+  return __nldbl_vfprintf (stdout, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c
new file mode 100644
index 0000000000..63b3e8f965
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vprintf_chk (int flag, const char *fmt, va_list ap)
+{
+  return __nldbl___vfprintf_chk (stdout, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
new file mode 100644
index 0000000000..e75907b905
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vscanf (const char *fmt, va_list ap)
+{
+  return __nldbl__IO_vfscanf (stdin, fmt, ap, NULL);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c
new file mode 100644
index 0000000000..5a9bcbcaee
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vsnprintf (char *string, size_t maxlen, const char *fmt, va_list ap)
+{
+  return __nldbl_vsnprintf (string, maxlen, fmt, ap);
+}
+extern __typeof (vsnprintf) __vsnprintf attribute_hidden;
+weak_alias (vsnprintf, __vsnprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c
new file mode 100644
index 0000000000..19380291a3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsnprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsnprintf_chk (char *string, size_t maxlen, int flag, size_t slen,
+		 const char *fmt, va_list ap)
+{
+  return __nldbl___vsnprintf_chk (string, maxlen, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c
new file mode 100644
index 0000000000..04406d0f6e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+_IO_vsprintf (char *string, const char *fmt, va_list ap)
+{
+  return __nldbl_vsprintf (string, fmt, ap);
+}
+extern __typeof (_IO_vsprintf) vsprintf attribute_hidden;
+weak_alias (_IO_vsprintf, vsprintf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c
new file mode 100644
index 0000000000..9df143fcef
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
+		va_list ap)
+{
+  return __nldbl___vsprintf_chk (string, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
new file mode 100644
index 0000000000..f5594c122c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsscanf.c
@@ -0,0 +1,10 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vsscanf (const char *string, const char *fmt, va_list ap)
+{
+  return __nldbl_vsscanf (string, fmt, ap);
+}
+extern __typeof (__vsscanf) vsscanf attribute_hidden;
+weak_alias (__vsscanf, vsscanf)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c
new file mode 100644
index 0000000000..ff3415a072
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vswprintf (string, maxlen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c
new file mode 100644
index 0000000000..0cd1f96bfe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswprintf_chk.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
+		 const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___vswprintf_chk (string, maxlen, flag, slen, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
new file mode 100644
index 0000000000..bd4bb5131b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vswscanf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vswscanf (const wchar_t *string, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vswscanf (string, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c
new file mode 100644
index 0000000000..eed1010eea
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+attribute_hidden
+void
+vsyslog (int pri, const char *fmt, va_list ap)
+{
+  __nldbl_vsyslog (pri, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c
new file mode 100644
index 0000000000..2221474f97
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vsyslog_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+void
+attribute_hidden
+__vsyslog_chk (int pri, int flag, const char *fmt, va_list ap)
+{
+  __nldbl___vsyslog_chk (pri, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c
new file mode 100644
index 0000000000..f46bdb3137
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+vwprintf (const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vfwprintf (stdout, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c
new file mode 100644
index 0000000000..f7e7185977
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwprintf_chk.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__vwprintf_chk (int flag, const wchar_t *fmt, va_list ap)
+{
+  return __nldbl___vfwprintf_chk (stdout, flag, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
new file mode 100644
index 0000000000..d39578ca4e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-vwscanf.c
@@ -0,0 +1,9 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+weak_function
+vwscanf (const wchar_t *fmt, va_list ap)
+{
+  return __nldbl_vfwscanf (stdin, fmt, ap);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c
new file mode 100644
index 0000000000..dbaffaa486
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold.c
@@ -0,0 +1,10 @@
+#define wcstold wcstold_XXX
+#include "nldbl-compat.h"
+#undef wcstold
+
+double
+attribute_hidden
+wcstold (const wchar_t *nptr, wchar_t **endptr)
+{
+  return wcstod (nptr, endptr);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
new file mode 100644
index 0000000000..e32d13a94b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstold_l.c
@@ -0,0 +1,14 @@
+#define wcstold_l wcstold_l_XXX
+#define __wcstold_l __wcstold_l_XXX
+#include "nldbl-compat.h"
+#undef wcstold_l
+#undef __wcstold_l
+
+double
+attribute_hidden
+__wcstold_l (const wchar_t *nptr, wchar_t **endptr, __locale_t loc)
+{
+  return __wcstod_l (nptr, endptr, loc);
+}
+extern __typeof (__wcstold_l) wcstold_l attribute_hidden;
+weak_alias (__wcstold_l, wcstold_l)
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c b/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c
new file mode 100644
index 0000000000..b638a399ad
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wcstoldint.c
@@ -0,0 +1,10 @@
+#define __wcstold_internal __wcstold_internal_XXX
+#include "nldbl-compat.h"
+#undef __wcstold_internal
+
+double
+attribute_hidden
+__wcstold_internal (const wchar_t *nptr, wchar_t **endptr, int group)
+{
+  return __wcstod_internal (nptr, endptr, group);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c
new file mode 100644
index 0000000000..2aa1a7475a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+wprintf (const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwprintf (stdout, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c
new file mode 100644
index 0000000000..39191e123b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wprintf_chk.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+__wprintf_chk (int flag, const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl___vfwprintf_chk (stdout, flag, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c
new file mode 100644
index 0000000000..4ee3fdc15f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-wscanf.c
@@ -0,0 +1,15 @@
+#include "nldbl-compat.h"
+
+int
+attribute_hidden
+wscanf (const wchar_t *fmt, ...)
+{
+  va_list arg;
+  int done;
+
+  va_start (arg, fmt);
+  done = __nldbl_vfwscanf (stdin, fmt, arg);
+  va_end (arg);
+
+  return done;
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-y0.c b/sysdeps/ieee754/ldbl-opt/nldbl-y0.c
new file mode 100644
index 0000000000..e35621f60f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-y0.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+y0l (double x)
+{
+  return y0 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-y1.c b/sysdeps/ieee754/ldbl-opt/nldbl-y1.c
new file mode 100644
index 0000000000..c47abcd3c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-y1.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+y1l (double x)
+{
+  return y1 (x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-yn.c b/sysdeps/ieee754/ldbl-opt/nldbl-yn.c
new file mode 100644
index 0000000000..7623d4513b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-yn.c
@@ -0,0 +1,8 @@
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+ynl (int n, double x)
+{
+  return yn (n, x);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/s_asinh.c b/sysdeps/ieee754/ldbl-opt/s_asinh.c
new file mode 100644
index 0000000000..e9bcfaea62
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_asinh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_asinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __asinh, asinhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_atan.c b/sysdeps/ieee754/ldbl-opt/s_atan.c
new file mode 100644
index 0000000000..5fbd5e62d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_atan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_atan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, atan, atanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacos.c b/sysdeps/ieee754/ldbl-opt/s_cacos.c
new file mode 100644
index 0000000000..db90a9ef18
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacos.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cacos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cacos, cacosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosh.c b/sysdeps/ieee754/ldbl-opt/s_cacosh.c
new file mode 100644
index 0000000000..e68049d46d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacosh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cacosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cacosh, cacoshl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacoshl.c b/sysdeps/ieee754/ldbl-opt/s_cacoshl.c
new file mode 100644
index 0000000000..ed4a299845
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacoshl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cacoshl.c>
+long_double_symbol (libm, __cacoshl, cacoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cacosl.c b/sysdeps/ieee754/ldbl-opt/s_cacosl.c
new file mode 100644
index 0000000000..9b840054e9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cacosl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cacosl.c>
+long_double_symbol (libm, __cacosl, cacosl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casin.c b/sysdeps/ieee754/ldbl-opt/s_casin.c
new file mode 100644
index 0000000000..04c47ca602
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casin.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_casin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __casin, casinl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinh.c b/sysdeps/ieee754/ldbl-opt/s_casinh.c
new file mode 100644
index 0000000000..19c4fa30f8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_casinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __casinh, casinhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinhl.c b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
new file mode 100644
index 0000000000..976fa8e5b0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_casinhl.c>
+long_double_symbol (libm, __casinhl, casinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinl.c b/sysdeps/ieee754/ldbl-opt/s_casinl.c
new file mode 100644
index 0000000000..7afb77cd4d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_casinl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_casinl.c>
+long_double_symbol (libm, __casinl, casinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_catan.c b/sysdeps/ieee754/ldbl-opt/s_catan.c
new file mode 100644
index 0000000000..19f61736d2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catan.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_catan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __catan, catanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanh.c b/sysdeps/ieee754/ldbl-opt/s_catanh.c
new file mode 100644
index 0000000000..cff7861444
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_catanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __catanh, catanhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanhl.c b/sysdeps/ieee754/ldbl-opt/s_catanhl.c
new file mode 100644
index 0000000000..e9562825e9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_catanhl.c>
+long_double_symbol (libm, __catanhl, catanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_catanl.c b/sysdeps/ieee754/ldbl-opt/s_catanl.c
new file mode 100644
index 0000000000..ee2fdf5d6c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_catanl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_catanl.c>
+long_double_symbol (libm, __catanl, catanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cbrt.c b/sysdeps/ieee754/ldbl-opt/s_cbrt.c
new file mode 100644
index 0000000000..cdc635771e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cbrt.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_cbrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __cbrt, cbrtl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccos.c b/sysdeps/ieee754/ldbl-opt/s_ccos.c
new file mode 100644
index 0000000000..2c43c7f392
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccos.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ccos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ccos, ccosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosh.c b/sysdeps/ieee754/ldbl-opt/s_ccosh.c
new file mode 100644
index 0000000000..3753cd56bc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccosh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ccosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ccosh, ccoshl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccoshl.c b/sysdeps/ieee754/ldbl-opt/s_ccoshl.c
new file mode 100644
index 0000000000..9f0c1e1a32
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccoshl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ccoshl.c>
+long_double_symbol (libm, __ccoshl, ccoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ccosl.c b/sysdeps/ieee754/ldbl-opt/s_ccosl.c
new file mode 100644
index 0000000000..e93e80538e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ccosl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ccosl.c>
+long_double_symbol (libm, __ccosl, ccosl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ceil.c b/sysdeps/ieee754/ldbl-opt/s_ceil.c
new file mode 100644
index 0000000000..6e4b70795d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ceil.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_ceil.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexp.c b/sysdeps/ieee754/ldbl-opt/s_cexp.c
new file mode 100644
index 0000000000..d983c96b7b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cexp.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cexp.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cexp, cexpl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cexpl.c b/sysdeps/ieee754/ldbl-opt/s_cexpl.c
new file mode 100644
index 0000000000..d5ae1fc0d0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cexpl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cexpl.c>
+long_double_symbol (libm, __cexpl, cexpl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog.c b/sysdeps/ieee754/ldbl-opt/s_clog.c
new file mode 100644
index 0000000000..3e0e90cf89
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_clog.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __clog, clogl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10.c b/sysdeps/ieee754/ldbl-opt/s_clog10.c
new file mode 100644
index 0000000000..ac3f4a3a71
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog10.c
@@ -0,0 +1,7 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_clog10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __clog10, __clog10l, GLIBC_2_1);
+compat_symbol (libm, clog10, clog10l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10l.c b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
new file mode 100644
index 0000000000..954f68095a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clog10l.c
@@ -0,0 +1,10 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#define __clog10l __clog10l_internal
+#include <math/s_clog10l.c>
+#undef __clog10l
+strong_alias (__clog10l_internal, __clog10l__internal)
+long_double_symbol (libm, __clog10l_internal, __clog10l);
+long_double_symbol (libm, __clog10l__internal, clog10l);
diff --git a/sysdeps/ieee754/ldbl-opt/s_clogl.c b/sysdeps/ieee754/ldbl-opt/s_clogl.c
new file mode 100644
index 0000000000..75126c8b89
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_clogl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_clogl.c>
+long_double_symbol (libm, __clogl, clogl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_copysign.c b/sysdeps/ieee754/ldbl-opt/s_copysign.c
new file mode 100644
index 0000000000..425e0eadbd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_copysign.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_copysign.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpow.c b/sysdeps/ieee754/ldbl-opt/s_cpow.c
new file mode 100644
index 0000000000..4801d7cdf9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cpow.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cpow.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cpow, cpowl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cpowl.c b/sysdeps/ieee754/ldbl-opt/s_cpowl.c
new file mode 100644
index 0000000000..61840e3381
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cpowl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cpowl.c>
+long_double_symbol (libm, __cpowl, cpowl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_cproj.c b/sysdeps/ieee754/ldbl-opt/s_cproj.c
new file mode 100644
index 0000000000..f298c3795a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cproj.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_cproj.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __cproj, cprojl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_cprojl.c b/sysdeps/ieee754/ldbl-opt/s_cprojl.c
new file mode 100644
index 0000000000..1cc058007e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_cprojl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_cprojl.c>
+long_double_symbol (libm, __cprojl, cprojl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csin.c b/sysdeps/ieee754/ldbl-opt/s_csin.c
new file mode 100644
index 0000000000..7017c95450
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csin.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csin, csinl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinh.c b/sysdeps/ieee754/ldbl-opt/s_csinh.c
new file mode 100644
index 0000000000..a1fa6671db
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csinh, csinhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinhl.c b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
new file mode 100644
index 0000000000..484d466ce8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csinhl.c>
+long_double_symbol (libm, __csinhl, csinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinl.c b/sysdeps/ieee754/ldbl-opt/s_csinl.c
new file mode 100644
index 0000000000..f71642e886
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csinl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csinl.c>
+long_double_symbol (libm, __csinl, csinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrt.c b/sysdeps/ieee754/ldbl-opt/s_csqrt.c
new file mode 100644
index 0000000000..2b6dcfe010
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csqrt.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_csqrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __csqrt, csqrtl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrtl.c b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
new file mode 100644
index 0000000000..045ff93e43
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_csqrtl.c>
+long_double_symbol (libm, __csqrtl, csqrtl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctan.c b/sysdeps/ieee754/ldbl-opt/s_ctan.c
new file mode 100644
index 0000000000..a6a21f9f23
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctan.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ctan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ctan, ctanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanh.c b/sysdeps/ieee754/ldbl-opt/s_ctanh.c
new file mode 100644
index 0000000000..fd4be129f8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanh.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#include <math/s_ctanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __ctanh, ctanhl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanhl.c b/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
new file mode 100644
index 0000000000..f159373b39
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanhl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ctanhl.c>
+long_double_symbol (libm, __ctanhl, ctanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_ctanl.c b/sysdeps/ieee754/ldbl-opt/s_ctanl.c
new file mode 100644
index 0000000000..0c2d94cf49
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ctanl.c
@@ -0,0 +1,6 @@
+#include <complex.h>
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ctanl.c>
+long_double_symbol (libm, __ctanl, ctanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_erf.c b/sysdeps/ieee754/ldbl-opt/s_erf.c
new file mode 100644
index 0000000000..76f1baa5ca
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_erf.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_erf.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __erf, erfl, GLIBC_2_0);
+compat_symbol (libm, __erfc, erfcl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_expm1.c b/sysdeps/ieee754/ldbl-opt/s_expm1.c
new file mode 100644
index 0000000000..ef9b5956db
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_expm1.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_expm1.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __expm1, expm1l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fabs.c b/sysdeps/ieee754/ldbl-opt/s_fabs.c
new file mode 100644
index 0000000000..e7c92187e9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fabs.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_fabs.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fdim.c b/sysdeps/ieee754/ldbl-opt/s_fdim.c
new file mode 100644
index 0000000000..02c95bfa81
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fdim.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fdim.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fdiml.c b/sysdeps/ieee754/ldbl-opt/s_fdiml.c
new file mode 100644
index 0000000000..06b760b7b4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fdiml.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fdiml.c>
+long_double_symbol (libm, __fdiml, fdiml);
diff --git a/sysdeps/ieee754/ldbl-opt/s_finite.c b/sysdeps/ieee754/ldbl-opt/s_finite.c
new file mode 100644
index 0000000000..897dbfd3b0
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_finite.c
@@ -0,0 +1,18 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_finite.c>
+weak_alias (__finite, ___finite)
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __finite, __finitel, GLIBC_2_1);
+# endif
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, ___finite, finitel, GLIBC_2_0);
+# endif
+#else
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libm, __finite, __finitel, GLIBC_2_0);
+# endif
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, ___finite, finitel, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_floor.c b/sysdeps/ieee754/ldbl-opt/s_floor.c
new file mode 100644
index 0000000000..7797944e9e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_floor.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_floor.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fma.c b/sysdeps/ieee754/ldbl-opt/s_fma.c
new file mode 100644
index 0000000000..2ee7214131
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fma.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fma, fmal, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmal.c b/sysdeps/ieee754/ldbl-opt/s_fmal.c
new file mode 100644
index 0000000000..bd12dabcbe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmal.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fmal.c>
+long_double_symbol (libm, __fmal, fmal);
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmax.c b/sysdeps/ieee754/ldbl-opt/s_fmax.c
new file mode 100644
index 0000000000..11e759121f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmax.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fmax.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmaxl.c b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
new file mode 100644
index 0000000000..98221b2cdc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fmaxl.c>
+long_double_symbol (libm, __fmaxl, fmaxl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmin.c b/sysdeps/ieee754/ldbl-opt/s_fmin.c
new file mode 100644
index 0000000000..c3fe44d9d9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmin.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_fmin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_fminl.c b/sysdeps/ieee754/ldbl-opt/s_fminl.c
new file mode 100644
index 0000000000..9bfdc7ad79
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fminl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_fminl.c>
+long_double_symbol (libm, __fminl, fminl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_frexp.c b/sysdeps/ieee754/ldbl-opt/s_frexp.c
new file mode 100644
index 0000000000..59ce352200
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_frexp.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_frexp.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __frexp, frexpl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __frexp, frexpl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ilogb.c b/sysdeps/ieee754/ldbl-opt/s_ilogb.c
new file mode 100644
index 0000000000..3a6ccbd09d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ilogb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_ilogb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ilogb, ilogbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_isinf.c b/sysdeps/ieee754/ldbl-opt/s_isinf.c
new file mode 100644
index 0000000000..401c8b1318
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_isinf.c
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_isinf.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
+compat_symbol (libc, isinf, isinfl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_isnan.c b/sysdeps/ieee754/ldbl-opt/s_isnan.c
new file mode 100644
index 0000000000..164b800b85
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_isnan.c
@@ -0,0 +1,8 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_isnan.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexp.c b/sysdeps/ieee754/ldbl-opt/s_ldexp.c
new file mode 100644
index 0000000000..f0f6519892
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexp.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <math/s_ldexp.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ldexp, ldexpl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __ldexp, ldexpl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
new file mode 100644
index 0000000000..d4636b9cc1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_ldexpl.c>
+#ifdef IS_IN_libm
+long_double_symbol (libm, __ldexpl, ldexpl);
+#else
+long_double_symbol (libc, __ldexpl, ldexpl);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_llrint.c b/sysdeps/ieee754/ldbl-opt/s_llrint.c
new file mode 100644
index 0000000000..e6311972e1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_llrint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_llrint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_llround.c b/sysdeps/ieee754/ldbl-opt/s_llround.c
new file mode 100644
index 0000000000..36c7e6edac
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_llround.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_llround.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llround, llroundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_log1p.c b/sysdeps/ieee754/ldbl-opt/s_log1p.c
new file mode 100644
index 0000000000..495fa32e35
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_log1p.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_log1p.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log1p, log1pl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_logb.c b/sysdeps/ieee754/ldbl-opt/s_logb.c
new file mode 100644
index 0000000000..4d7a6db275
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_logb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_logb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __logb, logbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_lrint.c b/sysdeps/ieee754/ldbl-opt/s_lrint.c
new file mode 100644
index 0000000000..b7af812846
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_lrint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_lrint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_lround.c b/sysdeps/ieee754/ldbl-opt/s_lround.c
new file mode 100644
index 0000000000..f3a27fa9c9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_lround.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_lround.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_modf.c b/sysdeps/ieee754/ldbl-opt/s_modf.c
new file mode 100644
index 0000000000..2263811e5e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_modf.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_modf.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __modf, modfl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __modf, modfl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nan.c b/sysdeps/ieee754/ldbl-opt/s_nan.c
new file mode 100644
index 0000000000..418aad2076
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_nan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nan, nanl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nanl.c b/sysdeps/ieee754/ldbl-opt/s_nanl.c
new file mode 100644
index 0000000000..9496e0b5ce
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nanl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_nanl.c>
+long_double_symbol (libm, __nanl, nanl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_nearbyint.c b/sysdeps/ieee754/ldbl-opt/s_nearbyint.c
new file mode 100644
index 0000000000..a8b7973acd
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nearbyint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_nearbyint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nextafter.c b/sysdeps/ieee754/ldbl-opt/s_nextafter.c
new file mode 100644
index 0000000000..78e2c0ff37
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nextafter.c
@@ -0,0 +1,12 @@
+#include <math_ldbl_opt.h>
+#include <math/s_nextafter.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __nextafter, nextafterl, GLIBC_2_0);
+#endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+strong_alias (__nextafter, __nexttowardd)
+strong_alias (__nextafter, __nexttowardld)
+#undef nexttoward
+compat_symbol (libm, __nexttowardd, nexttoward, GLIBC_2_1);
+compat_symbol (libm, __nexttowardld, nexttowardl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
new file mode 100644
index 0000000000..68027f26fa
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c
@@ -0,0 +1,85 @@
+/* Single precision version of nexttoward.c.
+   Conversion to IEEE single float by Jakub Jelinek, jj@ultra.linux.cz. */
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* IEEE functions
+ *	__nexttowardfd(x,y)
+ *	return the next machine floating-point number of x in the
+ *	direction toward y.
+ * This is for machines which use different binary type for double and
+ * long double conditionally, y is long double equal to double.
+ *   Special cases:
+ */
+
+#include <math.h>
+#include <math_private.h>
+#include <math_ldbl_opt.h>
+#include <float.h>
+
+float __nldbl_nexttowardf(float x, double y);
+
+float __nldbl_nexttowardf(float x, double y)
+{
+	int32_t hx,hy,ix,iy;
+	u_int32_t ly;
+
+	GET_FLOAT_WORD(hx,x);
+	EXTRACT_WORDS(hy,ly,y);
+	ix = hx&0x7fffffff;		/* |x| */
+	iy = hy&0x7fffffff;		/* |y| */
+
+	if((ix>0x7f800000) ||				   /* x is nan */
+	   ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0))    /* y is nan */
+	   return x+y;
+	if((double) x==y) return y;		/* x=y, return y */
+	if(ix==0) {				/* x == 0 */
+	    float u;
+	    SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/
+	    u = math_opt_barrier (x);
+	    u = u * u;
+	    math_force_eval (u);		/* raise underflow flag */
+	    return x;
+	}
+	if(hx>=0) {				/* x > 0 */
+	    if(hy<0||(ix>>23)>(iy>>20)-0x380
+	       || ((ix>>23)==(iy>>20)-0x380
+		   && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff)))	/* x > y, x -= ulp */
+		hx -= 1;
+	    else				/* x < y, x += ulp */
+		hx += 1;
+	} else {				/* x < 0 */
+	    if(hy>=0||(ix>>23)>(iy>>20)-0x380
+	       || ((ix>>23)==(iy>>20)-0x380
+		   && (ix&0x7fffff)>(((hy<<3)|(ly>>29))&0x7fffff)))	/* x < y, x -= ulp */
+		hx -= 1;
+	    else				/* x > y, x += ulp */
+		hx += 1;
+	}
+	hy = hx&0x7f800000;
+	if(hy>=0x7f800000) {
+	  x = x+x;	/* overflow  */
+	  if (FLT_EVAL_METHOD != 0)
+	    /* Force conversion to float.  */
+	    asm ("" : "+m"(x));
+	  return x;
+	}
+	if(hy<0x00800000) {
+	    float u = x*x;			/* underflow */
+	    math_force_eval (u);		/* raise underflow flag */
+	}
+	SET_FLOAT_WORD(x,hx);
+	return x;
+}
+
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __nldbl_nexttowardf, nexttowardf, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_remquo.c b/sysdeps/ieee754/ldbl-opt/s_remquo.c
new file mode 100644
index 0000000000..9f3d7ba368
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_remquo.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_remquo.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __remquo, remquol, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_rint.c b/sysdeps/ieee754/ldbl-opt/s_rint.c
new file mode 100644
index 0000000000..d9b156ea27
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_rint.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_rint.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_round.c b/sysdeps/ieee754/ldbl-opt/s_round.c
new file mode 100644
index 0000000000..edff2f017b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_round.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_round.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_scalbln.c b/sysdeps/ieee754/ldbl-opt/s_scalbln.c
new file mode 100644
index 0000000000..2398bba49a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_scalbln.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_scalbln.c>
+#ifdef IS_IN_libm
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __scalbln, scalblnl, GLIBC_2_1);
+#endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_1)
+compat_symbol (libc, __scalbln, scalblnl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_scalbn.c b/sysdeps/ieee754/ldbl-opt/s_scalbn.c
new file mode 100644
index 0000000000..094735ea53
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_scalbn.c
@@ -0,0 +1,9 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_scalbn.c>
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __scalbn, scalbnl, GLIBC_2_0);
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __scalbn, scalbnl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_significand.c b/sysdeps/ieee754/ldbl-opt/s_significand.c
new file mode 100644
index 0000000000..5287c09066
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_significand.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/s_significand.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __significand, significandl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_significandl.c b/sysdeps/ieee754/ldbl-opt/s_significandl.c
new file mode 100644
index 0000000000..9339b4780d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_significandl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/s_significandl.c>
+long_double_symbol (libm, __significandl, significandl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_sin.c b/sysdeps/ieee754/ldbl-opt/s_sin.c
new file mode 100644
index 0000000000..a11d5a33dc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_sin.c
@@ -0,0 +1,10 @@
+/* dbl-64/s_sin.c uses NAN and sincos identifiers internally.  */
+#define sincos sincos_disable
+#include <math_ldbl_opt.h>
+#undef NAN
+#undef sincos
+#include <sysdeps/ieee754/dbl-64/s_sin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sin, sinl, GLIBC_2_0);
+compat_symbol (libm, __cos, cosl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_sincos.c b/sysdeps/ieee754/ldbl-opt/s_sincos.c
new file mode 100644
index 0000000000..6d2a48f25b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_sincos.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_sincos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __sincos, sincosl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_tan.c b/sysdeps/ieee754/ldbl-opt/s_tan.c
new file mode 100644
index 0000000000..6b0fec0063
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_tan.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_tan.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, tan, tanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_tanh.c b/sysdeps/ieee754/ldbl-opt/s_tanh.c
new file mode 100644
index 0000000000..e763bbde77
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_tanh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_tanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __tanh, tanhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_trunc.c b/sysdeps/ieee754/ldbl-opt/s_trunc.c
new file mode 100644
index 0000000000..9d90a2bd73
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_trunc.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/s_trunc.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acos.c b/sysdeps/ieee754/ldbl-opt/w_acos.c
new file mode 100644
index 0000000000..2934041d4d
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acos.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_acos.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __acos, acosl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acosh.c b/sysdeps/ieee754/ldbl-opt/w_acosh.c
new file mode 100644
index 0000000000..7f7fa14e27
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acosh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_acosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __acosh, acoshl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_acoshl.c b/sysdeps/ieee754/ldbl-opt/w_acoshl.c
new file mode 100644
index 0000000000..6243c2ac80
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acoshl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_acoshl.c>
+long_double_symbol (libm, __acoshl, acoshl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_acosl.c b/sysdeps/ieee754/ldbl-opt/w_acosl.c
new file mode 100644
index 0000000000..8b6e890a53
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_acosl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_acosl.c>
+long_double_symbol (libm, __acosl, acosl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_asin.c b/sysdeps/ieee754/ldbl-opt/w_asin.c
new file mode 100644
index 0000000000..5e1d70ff65
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_asin.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_asin.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __asin, asinl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_asinl.c b/sysdeps/ieee754/ldbl-opt/w_asinl.c
new file mode 100644
index 0000000000..a58a224a38
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_asinl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_asinl.c>
+long_double_symbol (libm, __asinl, asinl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_atan2.c b/sysdeps/ieee754/ldbl-opt/w_atan2.c
new file mode 100644
index 0000000000..f1d1501bd2
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atan2.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_atan2.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __atan2, atan2l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atan2l.c b/sysdeps/ieee754/ldbl-opt/w_atan2l.c
new file mode 100644
index 0000000000..01431eff44
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atan2l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_atan2l.c>
+long_double_symbol (libm, __atan2l, atan2l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_atanh.c b/sysdeps/ieee754/ldbl-opt/w_atanh.c
new file mode 100644
index 0000000000..b4cab87c32
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atanh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_atanh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __atanh, atanhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_atanhl.c b/sysdeps/ieee754/ldbl-opt/w_atanhl.c
new file mode 100644
index 0000000000..0dbc114481
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_atanhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_atanhl.c>
+long_double_symbol (libm, __atanhl, atanhl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_cosh.c b/sysdeps/ieee754/ldbl-opt/w_cosh.c
new file mode 100644
index 0000000000..a6f56cf4c5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_cosh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_cosh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __cosh, coshl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_coshl.c b/sysdeps/ieee754/ldbl-opt/w_coshl.c
new file mode 100644
index 0000000000..8c7dccb7f3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_coshl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_coshl.c>
+long_double_symbol (libm, __coshl, coshl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_drem.c b/sysdeps/ieee754/ldbl-opt/w_drem.c
new file mode 100644
index 0000000000..788a5d29d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_drem.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_drem.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __drem, dreml, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_dreml.c b/sysdeps/ieee754/ldbl-opt/w_dreml.c
new file mode 100644
index 0000000000..d14d7e202c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_dreml.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_dreml.c>
+long_double_symbol (libm, __dreml, dreml);
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp.c b/sysdeps/ieee754/ldbl-opt/w_exp.c
new file mode 100644
index 0000000000..61fcfcc9df
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/ieee754/dbl-64/w_exp.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __exp, expl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp10.c b/sysdeps/ieee754/ldbl-opt/w_exp10.c
new file mode 100644
index 0000000000..990c48e61a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp10.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_exp10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __exp10, exp10l, GLIBC_2_1);
+compat_symbol (libm, __pow10, pow10l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_exp10l.c b/sysdeps/ieee754/ldbl-opt/w_exp10l.c
new file mode 100644
index 0000000000..e06dfb5014
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_exp10l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_exp10l.c>
+long_double_symbol (libm, __exp10l, exp10l);
+long_double_symbol (libm, __pow10l, pow10l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_fmod.c b/sysdeps/ieee754/ldbl-opt/w_fmod.c
new file mode 100644
index 0000000000..81ad5057f7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_fmod.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_fmod.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fmod, fmodl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_fmodl.c b/sysdeps/ieee754/ldbl-opt/w_fmodl.c
new file mode 100644
index 0000000000..2a534a304c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_fmodl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_fmodl.c>
+long_double_symbol (libm, __fmodl, fmodl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_hypot.c b/sysdeps/ieee754/ldbl-opt/w_hypot.c
new file mode 100644
index 0000000000..e1cf1ffcfe
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_hypot.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_hypot.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __hypot, hypotl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_hypotl.c b/sysdeps/ieee754/ldbl-opt/w_hypotl.c
new file mode 100644
index 0000000000..6c46bd4bde
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_hypotl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_hypotl.c>
+long_double_symbol (libm, __hypotl, hypotl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_j0.c b/sysdeps/ieee754/ldbl-opt/w_j0.c
new file mode 100644
index 0000000000..5c78aff085
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j0.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_j0.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, j0, j0l, GLIBC_2_0);
+compat_symbol (libm, y0, y0l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j0l.c b/sysdeps/ieee754/ldbl-opt/w_j0l.c
new file mode 100644
index 0000000000..767a1bcada
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j0l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_j0l.c>
+long_double_symbol (libm, __j0l, j0l);
+long_double_symbol (libm, __y0l, y0l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_j1.c b/sysdeps/ieee754/ldbl-opt/w_j1.c
new file mode 100644
index 0000000000..ed3dbc0361
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j1.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_j1.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, j1, j1l, GLIBC_2_0);
+compat_symbol (libm, y1, y1l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_j1l.c b/sysdeps/ieee754/ldbl-opt/w_j1l.c
new file mode 100644
index 0000000000..946c36467c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_j1l.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_j1l.c>
+long_double_symbol (libm, __j1l, j1l);
+long_double_symbol (libm, __y1l, y1l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_jn.c b/sysdeps/ieee754/ldbl-opt/w_jn.c
new file mode 100644
index 0000000000..7a7e0d434b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_jn.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_jn.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, jn, jnl, GLIBC_2_0);
+compat_symbol (libm, yn, ynl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_jnl.c b/sysdeps/ieee754/ldbl-opt/w_jnl.c
new file mode 100644
index 0000000000..5219543a97
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_jnl.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_jnl.c>
+long_double_symbol (libm, __jnl, jnl);
+long_double_symbol (libm, __ynl, ynl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgamma.c b/sysdeps/ieee754/ldbl-opt/w_lgamma.c
new file mode 100644
index 0000000000..ef801c5505
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgamma.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#include <math/w_lgamma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lgamma, lgammal, GLIBC_2_0);
+compat_symbol (libm, __gamma, gammal, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c b/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c
new file mode 100644
index 0000000000..eeab6a6b47
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgamma_r.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_lgamma_r.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __lgamma_r, lgammal_r, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgammal.c b/sysdeps/ieee754/ldbl-opt/w_lgammal.c
new file mode 100644
index 0000000000..9de7ec8f7f
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgammal.c
@@ -0,0 +1,6 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_lgammal.c>
+long_double_symbol (libm, __lgammal, lgammal);
+long_double_symbol (libm, __gammal, gammal);
diff --git a/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c b/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c
new file mode 100644
index 0000000000..25459758d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_lgammal_r.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_lgammal_r.c>
+long_double_symbol (libm, __lgammal_r, lgammal_r);
diff --git a/sysdeps/ieee754/ldbl-opt/w_log.c b/sysdeps/ieee754/ldbl-opt/w_log.c
new file mode 100644
index 0000000000..bde1e31db4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log, logl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log10.c b/sysdeps/ieee754/ldbl-opt/w_log10.c
new file mode 100644
index 0000000000..74e716821e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log10.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log10.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __log10, log10l, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log10l.c b/sysdeps/ieee754/ldbl-opt/w_log10l.c
new file mode 100644
index 0000000000..9c936e376a
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log10l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_log10l.c>
+long_double_symbol (libm, __log10l, log10l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_log2.c b/sysdeps/ieee754/ldbl-opt/w_log2.c
new file mode 100644
index 0000000000..9b9b45b21b
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log2.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_log2.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __log2, log2l, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_log2l.c b/sysdeps/ieee754/ldbl-opt/w_log2l.c
new file mode 100644
index 0000000000..c859682133
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_log2l.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_log2l.c>
+long_double_symbol (libm, __log2l, log2l);
diff --git a/sysdeps/ieee754/ldbl-opt/w_logl.c b/sysdeps/ieee754/ldbl-opt/w_logl.c
new file mode 100644
index 0000000000..c2354a02b9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_logl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_logl.c>
+long_double_symbol (libm, __logl, logl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_pow.c b/sysdeps/ieee754/ldbl-opt/w_pow.c
new file mode 100644
index 0000000000..2d98fb9be4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_pow.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_pow.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __pow, powl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_powl.c b/sysdeps/ieee754/ldbl-opt/w_powl.c
new file mode 100644
index 0000000000..85b8927648
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_powl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_powl.c>
+long_double_symbol (libm, __powl, powl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_remainder.c b/sysdeps/ieee754/ldbl-opt/w_remainder.c
new file mode 100644
index 0000000000..94d98930f4
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_remainder.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_remainder.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __remainder, remainderl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_remainderl.c b/sysdeps/ieee754/ldbl-opt/w_remainderl.c
new file mode 100644
index 0000000000..e450a25bbc
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_remainderl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_remainderl.c>
+long_double_symbol (libm, __remainderl, remainderl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalb.c b/sysdeps/ieee754/ldbl-opt/w_scalb.c
new file mode 100644
index 0000000000..e2ac601596
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_scalb.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_scalb.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __scalb, scalbl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_scalbl.c b/sysdeps/ieee754/ldbl-opt/w_scalbl.c
new file mode 100644
index 0000000000..f3d3901f86
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_scalbl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_scalbl.c>
+long_double_symbol (libm, __scalbl, scalbl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_sinh.c b/sysdeps/ieee754/ldbl-opt/w_sinh.c
new file mode 100644
index 0000000000..a5400b5eb1
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sinh.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_sinh.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sinh, sinhl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sinhl.c b/sysdeps/ieee754/ldbl-opt/w_sinhl.c
new file mode 100644
index 0000000000..b94f4ec845
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sinhl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_sinhl.c>
+long_double_symbol (libm, __sinhl, sinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_sqrt.c b/sysdeps/ieee754/ldbl-opt/w_sqrt.c
new file mode 100644
index 0000000000..ca2ba061e8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sqrt.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_sqrt.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_sqrtl.c b/sysdeps/ieee754/ldbl-opt/w_sqrtl.c
new file mode 100644
index 0000000000..609f5bf3d6
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_sqrtl.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_sqrtl.c>
+long_double_symbol (libm, __sqrtl, sqrtl);
diff --git a/sysdeps/ieee754/ldbl-opt/w_tgamma.c b/sysdeps/ieee754/ldbl-opt/w_tgamma.c
new file mode 100644
index 0000000000..cce9f348ed
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_tgamma.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <math/w_tgamma.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __tgamma, tgammal, GLIBC_2_1);
+#endif
diff --git a/sysdeps/ieee754/ldbl-opt/w_tgammal.c b/sysdeps/ieee754/ldbl-opt/w_tgammal.c
new file mode 100644
index 0000000000..c3c511db8c
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/w_tgammal.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#undef weak_alias
+#define weak_alias(n,a)
+#include <math/w_tgammal.c>
+long_double_symbol (libm, __tgammal, tgammal);
diff --git a/sysdeps/m68k/Implies b/sysdeps/m68k/Implies
deleted file mode 100644
index 5c778d4fbc..0000000000
--- a/sysdeps/m68k/Implies
+++ /dev/null
@@ -1,5 +0,0 @@
-wordsize-32
-# 68k uses IEEE 754 floating point.
-ieee754/ldbl-96
-ieee754/dbl-64
-ieee754/flt-32
diff --git a/sysdeps/m68k/Makefile b/sysdeps/m68k/Makefile
deleted file mode 100644
index fab6bd5837..0000000000
--- a/sysdeps/m68k/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 1993, 1994, 1996, 1997, 2003 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, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-# The mpn functions need this.  All existing 68k ports use MIT syntax.  If
-# a new port wants to use Motorola or Sony syntax, it can redefine this
-# variable.
-ifndef m68k-syntax-flag
-m68k-syntax-flag = -DMIT_SYNTAX
-endif
-
-asm-CPPFLAGS += $(m68k-syntax-flag)
-
-pic-ccflag = -fpic
-
-# Make sure setjmp.c is compiled with a frame pointer
-CFLAGS-setjmp.c := -fno-omit-frame-pointer
-
-# The 68k `long double' is a distinct type we support.
-long-double-fcts = yes
-
-ifeq ($(subdir),elf)
-CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
-endif
diff --git a/sysdeps/m68k/Versions b/sysdeps/m68k/Versions
deleted file mode 100644
index 2b020f8f58..0000000000
--- a/sysdeps/m68k/Versions
+++ /dev/null
@@ -1,6 +0,0 @@
-libc {
-  GLIBC_2.0 {
-    # Functions from libgcc.
-    __divdi3; __moddi3; __udivdi3; __umoddi3;
-  }
-}
diff --git a/sysdeps/m68k/__longjmp.c b/sysdeps/m68k/__longjmp.c
deleted file mode 100644
index 89ff5bab56..0000000000
--- a/sysdeps/m68k/__longjmp.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 97 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-#include <stdlib.h>
-
-/* Jump to the position specified by ENV, causing the
-   setjmp call there to return VAL, or 1 if VAL is 0.  */
-void
-__longjmp (__jmp_buf env, int val)
-{
-  /* This restores the FP and SP that setjmp's caller had,
-     and puts the return address into A0 and VAL into D0. */
-
-#if	defined(__HAVE_68881__) || defined(__HAVE_FPU__)
-  /* Restore the floating-point registers.  */
-  asm volatile("fmovem%.x %0, %/fp0-%/fp7" :
-	       /* No outputs.  */ : "g" (env[0].__fpregs[0]));
-#endif
-
-  /* Put VAL in D0.  */
-  asm volatile("move%.l %0, %/d0" : /* No outputs.  */ :
-	       "g" (val == 0 ? 1 : val) : "d0");
-
-  asm volatile(/* Restore the data and address registers.  */
-	       "movem%.l %0, %/d1-%/d7/%/a0-%/a7\n"
-	       /* Return to setjmp's caller.  */
-#ifdef __motorola__
-	       "jmp (%/a0)"
-#else
-	       "jmp %/a0@"
-#endif
-	       : /* No outputs.  */ : "g" (env[0].__dregs[0])
-	       /* We don't bother with the clobbers,
-		  because this code always jumps out anyway.  */
-	       );
-
-  /* Avoid `volatile function does return' warnings.  */
-  for (;;);
-}
diff --git a/sysdeps/m68k/abort-instr.h b/sysdeps/m68k/abort-instr.h
deleted file mode 100644
index b43c9efe1d..0000000000
--- a/sysdeps/m68k/abort-instr.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* An instruction which should crash any program is `illegal'.  */
-#define ABORT_INSTRUCTION asm ("illegal")
diff --git a/sysdeps/m68k/add_n.S b/sysdeps/m68k/add_n.S
deleted file mode 100644
index a9558491e8..0000000000
--- a/sysdeps/m68k/add_n.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* mc68020 __mpn_add_n -- Add two limb vectors of the same length > 0 and store
-   sum in a third limb vector.
-
-Copyright (C) 1992, 1994, 1996, 1998 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s1_ptr	(sp + 8)
-  s2_ptr	(sp + 16)
-  size		(sp + 12)
-*/
-
-#include "sysdep.h"
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__mpn_add_n)
-/* Save used registers on the stack.  */
-	movel	R(d2),MEM_PREDEC(sp)
-	movel	R(a2),MEM_PREDEC(sp)
-
-/* Copy the arguments to registers.  Better use movem?  */
-	movel	MEM_DISP(sp,12),R(a2)
-	movel	MEM_DISP(sp,16),R(a0)
-	movel	MEM_DISP(sp,20),R(a1)
-	movel	MEM_DISP(sp,24),R(d2)
-
-	eorw	#1,R(d2)
-	lsrl	#1,R(d2)
-	bcc	L(L1)
-	subql	#1,R(d2)	/* clears cy as side effect */
-
-L(Loop:)
-	movel	MEM_POSTINC(a0),R(d0)
-	movel	MEM_POSTINC(a1),R(d1)
-	addxl	R(d1),R(d0)
-	movel	R(d0),MEM_POSTINC(a2)
-L(L1:)	movel	MEM_POSTINC(a0),R(d0)
-	movel	MEM_POSTINC(a1),R(d1)
-	addxl	R(d1),R(d0)
-	movel	R(d0),MEM_POSTINC(a2)
-
-	dbf	R(d2),L(Loop)		/* loop until 16 lsb of %4 == -1 */
-	subxl	R(d0),R(d0)	/* d0 <= -cy; save cy as 0 or -1 in d0 */
-	subl	#0x10000,R(d2)
-	bcs	L(L2)
-	addl	R(d0),R(d0)	/* restore cy */
-	bra	L(Loop)
-
-L(L2:)
-	negl	R(d0)
-
-/* Restore used registers from stack frame.  */
-	movel	MEM_POSTINC(sp),R(a2)
-	movel	MEM_POSTINC(sp),R(d2)
-
-	rts
-END(__mpn_add_n)
diff --git a/sysdeps/m68k/asm-syntax.h b/sysdeps/m68k/asm-syntax.h
deleted file mode 100644
index 8e2a4ca2ca..0000000000
--- a/sysdeps/m68k/asm-syntax.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Definitions for 68k syntax variations.
-   Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.  Its master source is NOT part of
-   the C library, however.  The master source lives in the GNU MP 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef HAVE_ELF
-
-/* ELF uses byte-counts for .align, most others use log2 of count of bytes.  */
-#define ALIGNARG(log2) 1<<log2
-/* For ELF we need the `.type' directive to make shared libs work right.  */
-#define PROLOG(name) .type name,@function
-#define EPILOG(name) .size name,.-name
-/* For ELF we need to prefix register names and local labels.  */
-#ifdef __STDC__
-#define R_(r) %##r
-#define R(r) R_(r)
-#define L(label) .##label
-#else
-#define R(r) %/**/r
-#define L(label) ./**/label
-#endif
-
-#else
-
-#define ALIGNARG(log2) log2
-#define PROLOG(name) /* Nothing.  */
-#define EPILOG(name) /* Nothing.  */
-#define R(r) r
-#define L(label) label
-
-#endif
-
-#ifdef MIT_SYNTAX
-#define MEM(base)R(base)@
-#define MEM_DISP(base,displacement)R(base)@(displacement)
-#define MEM_INDX(base,idx,size_suffix)R(base)@(R(idx):size_suffix)
-#define MEM_INDX1(base,idx,size_suffix,scale)R(base)@(R(idx):size_suffix:scale)
-#define MEM_PREDEC(memory_base)R(memory_base)@-
-#define MEM_POSTINC(memory_base)R(memory_base)@+
-#define TEXT .text
-#define ALIGN .even
-#define GLOBL .globl
-/* Use variable sized opcodes.  */
-#define bcc jcc
-#define bcs jcs
-#define bls jls
-#define beq jeq
-#define bne jne
-#define bra jra
-#endif
-
-#ifdef MOTOROLA_SYNTAX
-#define MEM(base)(R(base))
-#define MEM_DISP(base,displacement)(displacement,R(base))
-#define MEM_PREDEC(memory_base)-(R(memory_base))
-#define MEM_POSTINC(memory_base)(R(memory_base))+
-#ifdef __STDC__
-#define MEM_INDX_(base,idx,size_suffix)(R(base),R(idx##.##size_suffix))
-#define MEM_INDX(base,idx,size_suffix)MEM_INDX_(base,idx,size_suffix)
-#define MEM_INDX1_(base,idx,size_suffix,scale)(R(base),R(idx##.##size_suffix*scale))
-#define MEM_INDX1(base,idx,size_suffix,scale)MEM_INDX1_(base,idx,size_suffix,scale)
-#else
-#define MEM_INDX(base,idx,size_suffix)(R(base),R(idx).size_suffix)
-#define MEM_INDX1(base,idx,size_suffix,scale)(R(base),R(idx).size_suffix*scale)
-#endif
-#define TEXT .text
-#define ALIGN .align ALIGNARG(2)
-#define GLOBL .globl
-#define bcc jbcc
-#define bcs jbcs
-#define bls jbls
-#define beq jbeq
-#define bne jbne
-#define bra jbra
-#define movel move.l
-#define moveml movem.l
-#define moveql moveq.l
-#define cmpl cmp.l
-#define orl or.l
-#define clrl clr.l
-#define eorw eor.w
-#define lsrl lsr.l
-#define lsll lsl.l
-#define roxrl roxr.l
-#define roxll roxl.l
-#define addl add.l
-#define addxl addx.l
-#define addql addq.l
-#define subl sub.l
-#define subxl subx.l
-#define subql subq.l
-#define negl neg.l
-#define mulul mulu.l
-#endif
diff --git a/sysdeps/m68k/bits/byteswap.h b/sysdeps/m68k/bits/byteswap.h
deleted file mode 100644
index 549d4452ef..0000000000
--- a/sysdeps/m68k/bits/byteswap.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Macros to swap the order of bytes in integer values.  m68k version.
-   Copyright (C) 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
-# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
-#endif
-
-#ifndef _BITS_BYTESWAP_H
-#define _BITS_BYTESWAP_H 1
-
-/* Swap bytes in 16 bit value.  We don't provide an assembler version
-   because GCC is smart enough to generate optimal assembler output, and
-   this allows for better cse.  */
-#define __bswap_16(x) \
-  ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
-
-/* Swap bytes in 32 bit value.  */
-#define __bswap_constant_32(x) \
-  ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \
-   (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
-
-#if defined __GNUC__ && __GNUC__ >= 2
-# define __bswap_32(x) \
-  __extension__							\
-  ({ unsigned int __bswap_32_v;					\
-     if (__builtin_constant_p (x))				\
-       __bswap_32_v = __bswap_constant_32 (x);			\
-     else							\
-       __asm__ __volatile__ ("ror%.w %#8, %0;"			\
-			     "swap %0;"				\
-			     "ror%.w %#8, %0"			\
-			     : "=d" (__bswap_32_v)		\
-			     : "0" ((unsigned int) (x)));	\
-     __bswap_32_v; })
-#else
-# define __bswap_32(x) __bswap_constant_32 (x)
-#endif
-
-#if defined __GNUC__ && __GNUC__ >= 2
-/* Swap bytes in 64 bit value.  */
-# define __bswap_64(x) \
-  __extension__								\
-  ({ union { unsigned long long int __ll;				\
-	     unsigned long int __l[2]; } __bswap_64_v, __bswap_64_r;	\
-     __bswap_64_v.__ll = (x);						\
-     __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]);		\
-     __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]);		\
-     __bswap_64_r.__ll; })
-#endif
-
-#endif /* _BITS_BYTESWAP_H */
diff --git a/sysdeps/m68k/bits/endian.h b/sysdeps/m68k/bits/endian.h
deleted file mode 100644
index bf4ecb60a4..0000000000
--- a/sysdeps/m68k/bits/endian.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* m68k is big-endian.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/sysdeps/m68k/bits/huge_vall.h b/sysdeps/m68k/bits/huge_vall.h
deleted file mode 100644
index 8b9630c6df..0000000000
--- a/sysdeps/m68k/bits/huge_vall.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* `HUGE_VALL' constant for m68k (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-#if __GNUC_PREREQ(3,3)
-# define HUGE_VALL	(__builtin_huge_vall ())
-#elif __GNUC_PREREQ(2,96)
-# define HUGE_VALL	(__extension__ 0x1.0p32767L)
-#elif defined__GNUC__
-
-# define HUGE_VALL					\
-  (__extension__					\
-   ((union { unsigned long __l[3]; long double __ld; })	\
-    { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
-
-#else /* not GCC */
-
-static union { unsigned char __c[12]; long double __ld; } __huge_vall =
-  { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
-# define HUGE_VALL	(__huge_vall.__ld)
-
-#endif /* GCC 2.95.  */
diff --git a/sysdeps/m68k/bits/setjmp.h b/sysdeps/m68k/bits/setjmp.h
deleted file mode 100644
index 2c2b3ee15a..0000000000
--- a/sysdeps/m68k/bits/setjmp.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Define the machine-dependent type `jmp_buf'.  m68k version.  */
-
-#ifndef _SETJMP_H
-# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-#endif
-
-typedef struct
-  {
-    /* There are eight 4-byte data registers, but D0 is not saved.  */
-    long int __dregs[7];
-
-    /* There are six 4-byte address registers, plus the FP and SP.  */
-    int *__aregs[6];
-    int *__fp;
-    int *__sp;
-
-#if defined __HAVE_68881__ || defined __HAVE_FPU__
-    /* There are eight floating point registers which
-       are saved in IEEE 96-bit extended format.  */
-    char __fpregs[8 * (96 / 8)];
-#endif
-
-  } __jmp_buf[1];
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)->__sp)
diff --git a/sysdeps/m68k/bsd-_setjmp.c b/sysdeps/m68k/bsd-_setjmp.c
deleted file mode 100644
index a6b404aebe..0000000000
--- a/sysdeps/m68k/bsd-_setjmp.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  m68k version.
-   Copyright (C) 1994, 1997, 2001, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define BSD__SETJMP
-#include <sysdeps/m68k/setjmp.c>
-libc_hidden_def (_setjmp)
diff --git a/sysdeps/m68k/bsd-setjmp.c b/sysdeps/m68k/bsd-setjmp.c
deleted file mode 100644
index 59b5acfeeb..0000000000
--- a/sysdeps/m68k/bsd-setjmp.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  m68k version.
-   Copyright (C) 1994, 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define BSD_SETJMP
-#include <sysdeps/m68k/setjmp.c>
diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h
deleted file mode 100644
index 146c5866a9..0000000000
--- a/sysdeps/m68k/dl-machine.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/* Machine-dependent ELF dynamic relocation inline functions.  m68k version.
-   Copyright (C) 1996-2001, 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef dl_machine_h
-#define dl_machine_h
-
-#define ELF_MACHINE_NAME "m68k"
-
-#include <sys/param.h>
-
-/* Return nonzero iff ELF header is compatible with the running host.  */
-static inline int
-elf_machine_matches_host (const Elf32_Ehdr *ehdr)
-{
-  return ehdr->e_machine == EM_68K;
-}
-
-
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-   first element of the GOT.  This must be inlined in a function which
-   uses global data.  */
-static inline Elf32_Addr
-elf_machine_dynamic (void)
-{
-  register Elf32_Addr *got asm ("%a5");
-  return *got;
-}
-
-
-/* Return the run-time load address of the shared object.  */
-static inline Elf32_Addr
-elf_machine_load_address (void)
-{
-  Elf32_Addr addr;
-  asm ("lea _dl_start(%%pc), %0\n\t"
-       "sub.l _dl_start@GOT.w(%%a5), %0"
-       : "=a" (addr));
-  return addr;
-}
-
-
-/* Set up the loaded object described by L so its unrelocated PLT
-   entries will jump to the on-demand fixup code in dl-runtime.c.  */
-
-static inline int __attribute__ ((always_inline))
-elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
-{
-  Elf32_Addr *got;
-  extern void _dl_runtime_resolve (Elf32_Word);
-  extern void _dl_runtime_profile (Elf32_Word);
-
-  if (l->l_info[DT_JMPREL] && lazy)
-    {
-      /* The GOT entries for functions in the PLT have not yet been
-	 filled in.  Their initial contents will arrange when called
-	 to push an offset into the .rela.plt section, push
-	 _GLOBAL_OFFSET_TABLE_[1], and then jump to
-	 _GLOBAL_OFFSET_TABLE_[2].  */
-      got = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
-      got[1] = (Elf32_Addr) l;	/* Identify this shared object.  */
-
-      /* The got[2] entry contains the address of a function which gets
-	 called to get the address of a so far unresolved function and
-	 jump to it.  The profiling extension of the dynamic linker allows
-	 to intercept the calls to collect information.  In this case we
-	 don't store the address in the GOT so that all future calls also
-	 end in this function.  */
-      if (profile)
-	{
-	  got[2] = (Elf32_Addr) &_dl_runtime_profile;
-
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
-	    {
-	      /* This is the object we are looking for.  Say that we really
-		 want profiling and the timers are started.  */
-	      GL(dl_profile_map) = l;
-	    }
-	}
-      else
-	/* This function will get called to fix up the GOT entry indicated by
-	   the offset on the stack, and then jump to the resolved address.  */
-	got[2] = (Elf32_Addr) &_dl_runtime_resolve;
-    }
-
-  return lazy;
-}
-
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
-"| Trampoline for " #fixup_name "\n\
-	.globl " #tramp_name "\n\
-	.type " #tramp_name ", @function\n\
-" #tramp_name ":\n\
-	| Save %a0 (struct return address) and %a1.\n\
-	move.l %a0, -(%sp)\n\
-	move.l %a1, -(%sp)\n\
-	| Call the real address resolver.\n\
-	jbsr " #fixup_name "\n\
-	| Restore register %a0 and %a1.\n\
-	move.l (%sp)+, %a1\n\
-	move.l (%sp)+, %a0\n\
-	| Pop parameters\n\
-	addq.l #8, %sp\n\
-	| Call real function.\n\
-	jmp (%d0)\n\
-	.size " #tramp_name ", . - " #tramp_name "\n"
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-asm (TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \
-     TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup));
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-asm (TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup) \
-     ".globl _dl_runtime_profile\n" \
-     ".set _dl_runtime_profile, _dl_runtime_resolve");
-#endif
-#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0, long int save_a1
-
-
-/* Mask identifying addresses reserved for the user program,
-   where the dynamic linker should not map anything.  */
-#define ELF_MACHINE_USER_ADDRESS_MASK	0x80000000UL
-
-/* Initial entry point code for the dynamic linker.
-   The C function `_dl_start' is the real entry point;
-   its return value is the user program's entry point.  */
-
-#define RTLD_START asm ("\
-	.text\n\
-	.globl _start\n\
-	.type _start,@function\n\
-_start:\n\
-	move.l %sp, -(%sp)\n\
-	jbsr _dl_start\n\
-	addq.l #4, %sp\n\
-	/* FALLTHRU */\n\
-\n\
-	.globl _dl_start_user\n\
-	.type _dl_start_user,@function\n\
-_dl_start_user:\n\
-	| Save the user entry point address in %a4.\n\
-	move.l %d0, %a4\n\
-	| See if we were run as a command with the executable file\n\
-	| name as an extra leading argument.\n\
-	move.l _dl_skip_args(%pc), %d0\n\
-	| Pop the original argument count\n\
-	move.l (%sp)+, %d1\n\
-	| Subtract _dl_skip_args from it.\n\
-	sub.l %d0, %d1\n\
-	| Adjust the stack pointer to skip _dl_skip_args words.\n\
-	lea (%sp, %d0*4), %sp\n\
-	| Push back the modified argument count.\n\
-	move.l %d1, -(%sp)\n\
-	# Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
-	pea 8(%sp, %d1*4)\n\
-	pea 8(%sp)\n\
-	move.l %d1, -(%sp)\n\
-	move.l _rtld_local(%pc), -(%sp)\n\
-	jbsr _dl_init_internal@PLTPC\n\
-	addq.l #8, %sp\n\
-	addq.l #8, %sp\n\
-	| Pass our finalizer function to the user in %a1.\n\
-	lea _dl_fini(%pc), %a1\n\
-	| Initialize %fp with the stack pointer.\n\
-	move.l %sp, %fp\n\
-	| Jump to the user's entry point.\n\
-	jmp (%a4)\n\
-	.size _dl_start_user, . - _dl_start_user\n\
-	.previous");
-
-/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
-   PLT entries should not be allowed to define the value.
-   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
-   of the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_type_class(type) \
-  ((((type) == R_68K_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
-   | (((type) == R_68K_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
-#define ELF_MACHINE_JMP_SLOT	R_68K_JMP_SLOT
-
-/* The m68k never uses Elf32_Rel relocations.  */
-#define ELF_MACHINE_NO_REL 1
-
-static inline Elf32_Addr
-elf_machine_fixup_plt (struct link_map *map, lookup_t t,
-		       const Elf32_Rela *reloc,
-		       Elf32_Addr *reloc_addr, Elf32_Addr value)
-{
-  return *reloc_addr = value;
-}
-
-/* Return the final value of a plt relocation.  On the m68k the JMP_SLOT
-   relocation ignores the addend.  */
-static inline Elf32_Addr
-elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
-		       Elf32_Addr value)
-{
-  return value;
-}
-
-#endif /* !dl_machine_h */
-
-#ifdef RESOLVE
-
-/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
-   MAP is the object containing the reloc.  */
-
-auto inline void __attribute__ ((unused, always_inline))
-elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
-		  const Elf32_Sym *sym, const struct r_found_version *version,
-		  void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-
-  if (__builtin_expect (r_type == R_68K_RELATIVE, 0))
-    *reloc_addr = map->l_addr + reloc->r_addend;
-  else
-    {
-      const Elf32_Sym *const refsym = sym;
-      Elf32_Addr value = RESOLVE (&sym, version, r_type);
-      if (sym)
-	value += sym->st_value;
-
-      switch (r_type)
-	{
-	case R_68K_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (sym->st_size > refsym->st_size
-	      || (sym->st_size < refsym->st_size && GLRO(dl_verbose)))
-	    {
-	      const char *strtab;
-
-	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
-%s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				rtld_progname ?: "<program name unknown>",
-				strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
-	case R_68K_GLOB_DAT:
-	case R_68K_JMP_SLOT:
-	  *reloc_addr = value;
-	  break;
-	case R_68K_8:
-	  *(char *) reloc_addr = value + reloc->r_addend;
-	  break;
-	case R_68K_16:
-	  *(short *) reloc_addr = value + reloc->r_addend;
-	  break;
-	case R_68K_32:
-	  *reloc_addr = value + reloc->r_addend;
-	  break;
-	case R_68K_PC8:
-	  *(char *) reloc_addr
-	    = value + reloc->r_addend - (Elf32_Addr) reloc_addr;
-	  break;
-	case R_68K_PC16:
-	  *(short *) reloc_addr
-	    = value + reloc->r_addend - (Elf32_Addr) reloc_addr;
-	  break;
-	case R_68K_PC32:
-	  *reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr;
-	  break;
-	case R_68K_NONE:		/* Alright, Wilbur.  */
-	  break;
-	default:
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
-	}
-    }
-}
-
-auto inline void __attribute__ ((unused, always_inline))
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
-			   void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  *reloc_addr = l_addr + reloc->r_addend;
-}
-
-auto inline void __attribute__ ((unused, always_inline))
-elf_machine_lazy_rel (struct link_map *map,
-		      Elf32_Addr l_addr, const Elf32_Rela *reloc)
-{
-  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
-  if (ELF32_R_TYPE (reloc->r_info) == R_68K_JMP_SLOT)
-    *reloc_addr += l_addr;
-  else
-    _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1);
-}
-
-#endif /* RESOLVE */
diff --git a/sysdeps/m68k/elf/start.S b/sysdeps/m68k/elf/start.S
deleted file mode 100644
index 8c89b37eca..0000000000
--- a/sysdeps/m68k/elf/start.S
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Startup code compliant to the ELF m68k ABI.
-   Copyright (C) 1996, 1997, 1998, 2001, 2002 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.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This is the canonical entry point, usually the first thing in the text
-   segment.  The SVR4/m68k ABI says that when the entry point runs,
-   most registers' values are unspecified, except for:
-
-   %a1		Contains a function pointer to be registered with `atexit'.
-		This is how the dynamic linker arranges to have DT_FINI
-		functions called for shared libraries that have been loaded
-		before this code runs.
-
-   %sp		The stack contains the arguments and environment:
-		0(%sp)			argc
-		4(%sp)			argv[0]
-		...
-		(4*argc)(%sp)		NULL
-		(4*(argc+1))(%sp)	envp[0]
-		...
-					NULL
-*/
-
-	.text
-	.globl _start
-	.type _start,@function
-_start:
-	/* Clear the frame pointer.  The ABI suggests this be done, to mark
-	   the outermost frame obviously.  */
-	sub.l %fp, %fp
-
-	/* Extract the arguments as encoded on the stack and set up the
-	   arguments for `main': argc, argv.  envp will be determined
-	   later in __libc_start_main.  */
-	move.l (%sp)+, %d0	/* Pop the argument count.  */
-	move.l %sp, %a0		/* The argument vector starts just at the
-				   current stack top.  */
-
-	/* Provide the highest stack address to the user code (for stacks
-	   which grow downward).  */
-	pea (%sp)
-
-	pea (%a1)		/* Push address of the shared library
-				   termination function.  */
-
-	/* Push the address of our own entry points to `.fini' and
-	   `.init'.  */
-	pea __libc_csu_fini
-	pea __libc_csu_init
-
-	pea (%a0)		/* Push second argument: argv.  */
-	move.l %d0, -(%sp)	/* Push first argument: argc.  */
-
-	pea main
-
-	/* Call the user's main function, and exit with its value.  But
-	   let the libc call main.  */
-	jbsr __libc_start_main
-
-	illegal			/* Crash if somehow `exit' does return.  */
-
-/* Define a symbol for the first piece of initialized data.  */
-	.data
-	.globl __data_start
-__data_start:
-	.long 0
-	.weak data_start
-	data_start = __data_start
diff --git a/sysdeps/m68k/ffs.c b/sysdeps/m68k/ffs.c
deleted file mode 100644
index 189936b94f..0000000000
--- a/sysdeps/m68k/ffs.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ffs -- find first set bit in a word, counted from least significant end.
-   For mc68020, mc68030, mc68040.
-   This file is part of the GNU C Library.
-   Copyright (C) 1991, 1992, 1997, 1998, 2004 Free Software Foundation, Inc.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define ffsl __something_else
-#include <string.h>
-
-#undef	ffs
-
-#if	defined (__GNUC__) && defined (__mc68020__)
-
-int
-__ffs (x)
-     int x;
-{
-  int cnt;
-
-  asm ("bfffo %1{#0:#0},%0" : "=d" (cnt) : "dm" (x & -x));
-
-  return 32 - cnt;
-}
-weak_alias (__ffs, ffs)
-libc_hidden_builtin_def (ffs)
-#undef ffsl
-weak_alias (__ffs, ffsl)
-
-#else
-
-#include <sysdeps/generic/ffs.c>
-
-#endif
diff --git a/sysdeps/m68k/fpu/Dist b/sysdeps/m68k/fpu/Dist
deleted file mode 100644
index e649e8d55e..0000000000
--- a/sysdeps/m68k/fpu/Dist
+++ /dev/null
@@ -1 +0,0 @@
-mathimpl.h
diff --git a/sysdeps/m68k/fpu/Makefile b/sysdeps/m68k/fpu/Makefile
deleted file mode 100644
index 42db6381d3..0000000000
--- a/sysdeps/m68k/fpu/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-ifeq	($(subdir),math)
-ifndef	math-twiddled
-
-# Avoid twiddling in generic/Makefile.
-math-twiddled := t
-
-endif
-
-bsdmath_dirs := $(bsdmath_dirs) mc68881
-
-endif
diff --git a/sysdeps/m68k/fpu/bits/fenv.h b/sysdeps/m68k/fpu/bits/fenv.h
deleted file mode 100644
index 7c0bcb6697..0000000000
--- a/sysdeps/m68k/fpu/bits/fenv.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-
-/* Define bits representing the exception.  We use the bit positions of
-   the appropriate bits in the FPSR Accrued Exception Byte.  */
-enum
-  {
-    FE_INEXACT = 1 << 3,
-#define FE_INEXACT	FE_INEXACT
-    FE_DIVBYZERO = 1 << 4,
-#define FE_DIVBYZERO	FE_DIVBYZERO
-    FE_UNDERFLOW = 1 << 5,
-#define FE_UNDERFLOW	FE_UNDERFLOW
-    FE_OVERFLOW = 1 << 6,
-#define FE_OVERFLOW	FE_OVERFLOW
-    FE_INVALID = 1 << 7
-#define FE_INVALID	FE_INVALID
-  };
-
-#define FE_ALL_EXCEPT \
-	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* The m68k FPU supports all of the four defined rounding modes.  We use
-   the bit positions in the FPCR Mode Control Byte as the values for the
-   appropriate macros.  */
-enum
-  {
-    FE_TONEAREST = 0,
-#define FE_TONEAREST	FE_TONEAREST
-    FE_TOWARDZERO = 1 << 4,
-#define FE_TOWARDZERO	FE_TOWARDZERO
-    FE_DOWNWARD = 2 << 4,
-#define FE_DOWNWARD	FE_DOWNWARD
-    FE_UPWARD = 3 << 4
-#define FE_UPWARD	FE_UPWARD
-  };
-
-
-/* Type representing exception flags.  */
-typedef unsigned int fexcept_t;
-
-
-/* Type representing floating-point environment.  This structure
-   corresponds to the layout of the block written by `fmovem'.  */
-typedef struct
-  {
-    unsigned int __control_register;
-    unsigned int __status_register;
-    unsigned int __instruction_address;
-  }
-fenv_t;
-
-/* If the default argument is used we use this value.  */
-#define FE_DFL_ENV	((__const fenv_t *) -1)
-
-#ifdef __USE_GNU
-/* Floating-point environment where none of the exceptions are masked.  */
-# define FE_NOMASK_ENV	((__const fenv_t *) -2)
-#endif
diff --git a/sysdeps/m68k/fpu/bits/mathdef.h b/sysdeps/m68k/fpu/bits/mathdef.h
deleted file mode 100644
index 65cf8d49f6..0000000000
--- a/sysdeps/m68k/fpu/bits/mathdef.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF	1
-
-/* The m68k FPUs evaluate all values in the 96 bit floating-point format
-   which is also available for the user as `long double'.  Therefore we
-   define: */
-typedef long double float_t;	/* `float' expressions are evaluated as
-				   `long double'.  */
-typedef long double double_t;	/* `double' expressions are evaluated as
-				   `long double'.  */
-
-/* The values returned by `ilogb' for 0 and NaN respectively.  */
-# define FP_ILOGB0	(-2147483647 - 1)
-# define FP_ILOGBNAN	(2147483647)
-
-#endif	/* ISO C99 */
diff --git a/sysdeps/m68k/fpu/bits/mathinline.h b/sysdeps/m68k/fpu/bits/mathinline.h
deleted file mode 100644
index acbac47aac..0000000000
--- a/sysdeps/m68k/fpu/bits/mathinline.h
+++ /dev/null
@@ -1,445 +0,0 @@
-/* Definitions of inline math functions implemented by the m68881/2.
-   Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004
-     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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef	__GNUC__
-
-#ifdef __USE_ISOC99
-/* GCC 3.1 and up have builtins that actually can be used.  */
-# if !__GNUC_PREREQ (3,1)
-/* ISO C99 defines some macros to perform unordered comparisons.  The
-   m68k FPU supports this with special opcodes and we should use them.
-   These must not be inline functions since we have to be able to handle
-   all floating-point types.  */
-#  undef isgreater
-#  undef isgreaterequal
-#  undef isless
-#  undef islessequal
-#  undef islessgreater
-#  undef isunordered
-#  define isgreater(x, y)					\
-   __extension__					\
-   ({ char __result;					\
-      __asm__ ("fcmp%.x %2,%1; fsogt %0"		\
-	       : "=dm" (__result) : "f" (x), "f" (y));	\
-      __result != 0; })
-
-#  define isgreaterequal(x, y)				\
-   __extension__					\
-   ({ char __result;					\
-      __asm__ ("fcmp%.x %2,%1; fsoge %0"		\
-	       : "=dm" (__result) : "f" (x), "f" (y));	\
-      __result != 0; })
-
-#  define isless(x, y)					\
-   __extension__					\
-   ({ char __result;					\
-      __asm__ ("fcmp%.x %2,%1; fsolt %0"		\
-	       : "=dm" (__result) : "f" (x), "f" (y));	\
-      __result != 0; })
-
-#  define islessequal(x, y)				\
-   __extension__					\
-   ({ char __result;					\
-      __asm__ ("fcmp%.x %2,%1; fsole %0"		\
-	       : "=dm" (__result) : "f" (x), "f" (y));	\
-      __result != 0; })
-
-#  define islessgreater(x, y)				\
-   __extension__					\
-   ({ char __result;					\
-      __asm__ ("fcmp%.x %2,%1; fsogl %0"		\
-	       : "=dm" (__result) : "f" (x), "f" (y));	\
-      __result != 0; })
-
-#  define isunordered(x, y)				\
-   __extension__					\
-   ({ char __result;					\
-      __asm__ ("fcmp%.x %2,%1; fsun %0"			\
-	       : "=dm" (__result) : "f" (x), "f" (y));	\
-      __result != 0; })
-# endif /* GCC 3.1 */
-#endif
-
-
-#if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \
-    || defined __LIBC_INTERNAL_MATH_INLINES
-
-#ifdef	__LIBC_INTERNAL_MATH_INLINES
-/* This is used when defining the functions themselves.  Define them with
-   __ names, and with `static inline' instead of `extern inline' so the
-   bodies will always be used, never an external function call.  */
-# define __m81_u(x)		__CONCAT(__,x)
-# define __m81_inline		static __inline
-#else
-# define __m81_u(x)		x
-# ifdef __cplusplus
-#  define __m81_inline		__inline
-# else
-#  define __m81_inline		extern __inline
-# endif
-# define __M81_MATH_INLINES	1
-#endif
-
-/* Define a const math function.  */
-#define __m81_defun(rettype, func, args)				      \
-  __m81_inline rettype __attribute__((__const__))			      \
-  __m81_u(func) args
-
-/* Define the three variants of a math function that has a direct
-   implementation in the m68k fpu.  FUNC is the name for C (which will be
-   suffixed with f and l for the float and long double version, resp).  OP
-   is the name of the fpu operation (without leading f).  */
-
-#if defined __USE_MISC || defined __USE_ISOC99
-# define __inline_mathop(func, op)			\
-  __inline_mathop1(double, func, op)			\
-  __inline_mathop1(float, __CONCAT(func,f), op)	\
-  __inline_mathop1(long double, __CONCAT(func,l), op)
-#else
-# define __inline_mathop(func, op)			\
-  __inline_mathop1(double, func, op)
-#endif
-
-#define __inline_mathop1(float_type,func, op)				      \
-  __m81_defun (float_type, func, (float_type __mathop_x))		      \
-  {									      \
-    float_type __result;						      \
-    __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
-    return __result;							      \
-  }
-
-__inline_mathop(__atan, atan)
-__inline_mathop(__cos, cos)
-__inline_mathop(__sin, sin)
-__inline_mathop(__tan, tan)
-__inline_mathop(__tanh, tanh)
-__inline_mathop(__fabs, abs)
-
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__inline_mathop(__rint, int)
-__inline_mathop(__expm1, etoxm1)
-__inline_mathop(__log1p, lognp1)
-#endif
-
-#ifdef __USE_MISC
-__inline_mathop(__significand, getman)
-#endif
-
-#ifdef __USE_ISOC99
-__inline_mathop(__trunc, intrz)
-#endif
-
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-
-__inline_mathop(atan, atan)
-__inline_mathop(cos, cos)
-__inline_mathop(sin, sin)
-__inline_mathop(tan, tan)
-__inline_mathop(tanh, tanh)
-
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__inline_mathop(rint, int)
-__inline_mathop(expm1, etoxm1)
-__inline_mathop(log1p, lognp1)
-# endif
-
-# ifdef __USE_MISC
-__inline_mathop(significand, getman)
-# endif
-
-# ifdef __USE_ISOC99
-__inline_mathop(trunc, intrz)
-# endif
-
-#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
-
-/* This macro contains the definition for the rest of the inline
-   functions, using FLOAT_TYPE as the domain type and S as the suffix
-   for the function names.  */
-
-#define __inline_functions(float_type, s)				  \
-__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x))	  \
-{									  \
-  float_type __result;							  \
-  unsigned long int __ctrl_reg;						  \
-  __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));		  \
-  /* Set rounding towards negative infinity.  */			  \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		  \
-		      : "dmi" ((__ctrl_reg & ~0x10) | 0x20));		  \
-  /* Convert X to an integer, using -Inf rounding.  */			  \
-  __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x));	  \
-  /* Restore the previous rounding mode.  */				  \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		  \
-		      : "dmi" (__ctrl_reg));				  \
-  return __result;							  \
-}									  \
-									  \
-__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x))	  	  \
-{									  \
-  float_type __result;							  \
-  unsigned long int __ctrl_reg;						  \
-  __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));		  \
-  /* Set rounding towards positive infinity.  */			  \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		  \
-		      : "dmi" (__ctrl_reg | 0x30));			  \
-  /* Convert X to an integer, using +Inf rounding.  */			  \
-  __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x));	  \
-  /* Restore the previous rounding mode.  */				  \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		  \
-		      : "dmi" (__ctrl_reg));				  \
-  return __result;							  \
-}
-
-__inline_functions(double,)
-#if defined __USE_MISC || defined __USE_ISOC99
-__inline_functions(float,f)
-__inline_functions(long double,l)
-#endif
-#undef __inline_functions
-
-#ifdef __USE_MISC
-
-# define __inline_functions(float_type, s)				  \
-__m81_defun (int, __CONCAT(__isinf,s), (float_type __value))	  	  \
-{									  \
-  /* There is no branch-condition for infinity,				  \
-     so we must extract and examine the condition codes manually.  */	  \
-  unsigned long int __fpsr;						  \
-  __asm("ftst%.x %1\n"							  \
-	"fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value));	  \
-  return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0;	  \
-}									  \
-									  \
-__m81_defun (int, __CONCAT(__finite,s), (float_type __value))	  	  \
-{									  \
-  /* There is no branch-condition for infinity, so we must extract and	  \
-     examine the condition codes manually.  */				  \
-  unsigned long int __fpsr;						  \
-  __asm ("ftst%.x %1\n"							  \
-	 "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value));	  \
-  return (__fpsr & (3 << 24)) == 0;					  \
-}									  \
-									  \
-__m81_defun (float_type, __CONCAT(__scalbn,s),				  \
-	     (float_type __x, int __n))					  \
-{									  \
-  float_type __result;							  \
-  __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x));  \
-  return __result;							  \
-}
-
-__inline_functions(double,)
-__inline_functions(float,f)
-__inline_functions(long double,l)
-# undef __inline_functions
-
-#endif /* Use misc.  */
-
-#if defined __USE_MISC || defined __USE_XOPEN
-
-# define __inline_functions(float_type, s)				  \
-__m81_defun (int, __CONCAT(__isnan,s), (float_type __value))	  	  \
-{									  \
-  char __result;							  \
-  __asm("ftst%.x %1\n"							  \
-	"fsun %0" : "=dm" (__result) : "f" (__value));			  \
-  return __result;							  \
-}
-
-__inline_functions(double,)
-# ifdef __USE_MISC
-__inline_functions(float,f)
-__inline_functions(long double,l)
-# endif
-# undef __inline_functions
-
-#endif
-
-#ifdef __USE_ISOC99
-
-# define __inline_functions(float_type, s)				  \
-__m81_defun (int, __CONCAT(__signbit,s), (float_type __value))	  	  \
-{									  \
-  /* There is no branch-condition for the sign bit, so we must extract	  \
-     and examine the condition codes manually.  */			  \
-  unsigned long int __fpsr;						  \
-  __asm ("ftst%.x %1\n"							  \
-	 "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value));	  \
-  return (__fpsr >> 27) & 1;						  \
-}									  \
-									  \
-  __m81_defun (float_type, __CONCAT(__scalbln,s),			  \
-	     (float_type __x, long int __n))				  \
-{									  \
-  return __CONCAT(__scalbn,s) (__x, __n);				  \
-}									  \
-									  \
-__m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x))	  \
-{									  \
-  float_type __result;							  \
-  unsigned long int __ctrl_reg;						  \
-  __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));		  \
-  /* Temporarily disable the inexact exception.  */			  \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		  \
-		      : "dmi" (__ctrl_reg & ~0x200));			  \
-  __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x));	  \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		  \
-		      : "dmi" (__ctrl_reg));				  \
-  return __result;							  \
-}									  \
-									  \
-__m81_defun (long int, __CONCAT(__lrint,s), (float_type __x))		  \
-{									  \
-  long int __result;							  \
-  __asm ("fmove%.l %1, %0" : "=dm" (__result) : "f" (__x));		  \
-  return __result;							  \
-}									  \
-									  \
-__m81_inline float_type							  \
-__m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y,		  \
-			   float_type __z)				  \
-{									  \
-  return (__x * __y) + __z;						  \
-}
-
-__inline_functions (double,)
-__inline_functions (float,f)
-__inline_functions (long double,l)
-# undef __inline_functions
-
-#endif /* Use ISO C9x */
-
-#ifdef __USE_GNU
-
-# define __inline_functions(float_type, s)				\
-__m81_inline void							\
-__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx,	\
-			      float_type *__cosx)			\
-{									\
-  __asm ("fsincos%.x %2,%1:%0"						\
-	 : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x));			\
-}
-
-__inline_functions (double,)
-__inline_functions (float,f)
-__inline_functions (long double,l)
-# undef __inline_functions
-
-#endif
-
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-
-/* Define inline versions of the user visible functions.  */
-
-/* Note that there must be no whitespace before the argument passed for
-   NAME, to make token pasting work correctly with -traditional.  */
-# define __inline_forward_c(rettype, name, args1, args2)	\
-extern __inline rettype __attribute__((__const__))		\
-  name args1							\
-{								\
-  return __CONCAT(__,name) args2;				\
-}
-
-# define __inline_forward(rettype, name, args1, args2)	\
-extern __inline rettype name args1			\
-{							\
-  return __CONCAT(__,name) args2;			\
-}
-
-__inline_forward_c(double,floor, (double __x), (__x))
-__inline_forward_c(double,ceil, (double __x), (__x))
-# ifdef __USE_MISC
-#  ifndef __USE_ISOC99 /* Conflict with macro of same name.  */
-__inline_forward_c(int,isinf, (double __value), (__value))
-#  endif
-__inline_forward_c(int,finite, (double __value), (__value))
-__inline_forward_c(double,scalbn, (double __x, int __n), (__x, __n))
-# endif
-# if defined __USE_MISC || defined __USE_XOPEN
-#  ifndef __USE_ISOC99 /* Conflict with macro of same name.  */
-__inline_forward_c(int,isnan, (double __value), (__value))
-#  endif
-# endif
-# ifdef __USE_ISOC99
-__inline_forward_c(double,scalbln, (double __x, long int __n), (__x, __n))
-__inline_forward_c(double,nearbyint, (double __value), (__value))
-__inline_forward_c(long int,lrint, (double __value), (__value))
-__inline_forward_c(double,fma, (double __x, double __y, double __z),
-		   (__x, __y, __z))
-# endif
-# ifdef __USE_GNU
-__inline_forward(void,sincos, (double __x, double *__sinx, double *__cosx),
-		 (__x, __sinx, __cosx))
-# endif
-
-# if defined __USE_MISC || defined __USE_ISOC99
-
-__inline_forward_c(float,floorf, (float __x), (__x))
-__inline_forward_c(float,ceilf, (float __x), (__x))
-#  ifdef __USE_MISC
-__inline_forward_c(int,isinff, (float __value), (__value))
-__inline_forward_c(int,finitef, (float __value), (__value))
-__inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n))
-__inline_forward_c(int,isnanf, (float __value), (__value))
-#  endif
-# ifdef __USE_ISOC99
-__inline_forward_c(float,scalblnf, (float __x, long int __n), (__x, __n))
-__inline_forward_c(float,nearbyintf, (float __value), (__value))
-__inline_forward_c(long int,lrintf, (float __value), (__value))
-__inline_forward_c(float,fmaf, (float __x, float __y, float __z),
-		   (__x, __y, __z))
-# endif
-# ifdef __USE_GNU
-__inline_forward(void,sincosf, (float __x, float *__sinx, float *__cosx),
-		 (__x, __sinx, __cosx))
-# endif
-
-__inline_forward_c(long double,floorl, (long double __x), (__x))
-__inline_forward_c(long double,ceill, (long double __x), (__x))
-# ifdef __USE_MISC
-__inline_forward_c(int,isinfl, (long double __value), (__value))
-__inline_forward_c(int,finitel, (long double __value), (__value))
-__inline_forward_c(long double,scalbnl, (long double __x, int __n), (__x, __n))
-__inline_forward_c(int,isnanl, (long double __value), (__value))
-# endif
-# ifdef __USE_ISOC99
-__inline_forward_c(long double,scalblnl, (long double __x, long int __n),
-		   (__x, __n))
-__inline_forward_c(long double,nearbyintl, (long double __value), (__value))
-__inline_forward_c(long int,lrintl, (long double __value), (__value))
-__inline_forward_c(long double,fmal,
-		   (long double __x, long double __y, long double __z),
-		   (__x, __y, __z))
-# endif
-# ifdef __USE_GNU
-__inline_forward(void,sincosl,
-		 (long double __x, long double *__sinx, long double *__cosx),
-		 (__x, __sinx, __cosx))
-# endif
-
-#endif /* Use misc or ISO C99 */
-
-#undef __inline_forward
-#undef __inline_forward_c
-
-#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
-
-#endif
-#endif	/* GCC.  */
diff --git a/sysdeps/m68k/fpu/branred.c b/sysdeps/m68k/fpu/branred.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/branred.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/doasin.c b/sysdeps/m68k/fpu/doasin.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/doasin.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/dosincos.c b/sysdeps/m68k/fpu/dosincos.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/dosincos.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/e_acos.c b/sysdeps/m68k/fpu/e_acos.c
deleted file mode 100644
index c9f6c6a162..0000000000
--- a/sysdeps/m68k/fpu/e_acos.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-#ifndef	FUNC
-#define	FUNC	__ieee754_acos
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-float_type
-FUNC (x)
-     float_type x;
-{
-  return __m81_u(FUNC)(x);
-}
diff --git a/sysdeps/m68k/fpu/e_acosf.c b/sysdeps/m68k/fpu/e_acosf.c
deleted file mode 100644
index 90665082d3..0000000000
--- a/sysdeps/m68k/fpu/e_acosf.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef	FUNC
-#define	FUNC	__ieee754_acosf
-#endif
-#define float_type float
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_acosl.c b/sysdeps/m68k/fpu/e_acosl.c
deleted file mode 100644
index e3dcd170f3..0000000000
--- a/sysdeps/m68k/fpu/e_acosl.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef FUNC
-#define FUNC __ieee754_acosl
-#endif
-#define float_type long double
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_asin.c b/sysdeps/m68k/fpu/e_asin.c
deleted file mode 100644
index b6176c708a..0000000000
--- a/sysdeps/m68k/fpu/e_asin.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_asin
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_asinf.c b/sysdeps/m68k/fpu/e_asinf.c
deleted file mode 100644
index 05fb82670b..0000000000
--- a/sysdeps/m68k/fpu/e_asinf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_asinf
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_asinl.c b/sysdeps/m68k/fpu/e_asinl.c
deleted file mode 100644
index 0dd89fb9da..0000000000
--- a/sysdeps/m68k/fpu/e_asinl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_asinl
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_atan2.c b/sysdeps/m68k/fpu/e_atan2.c
deleted file mode 100644
index 551b14db81..0000000000
--- a/sysdeps/m68k/fpu/e_atan2.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Copyright (C) 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-float_type
-s(__ieee754_atan2) (float_type y, float_type x)
-{
-  float_type pi, pi_2, z;
-  unsigned long y_cond, x_cond;
-
-  __asm ("fmovecr%.x %#0, %0" : "=f" (pi));
-  __asm ("fscale%.w %#-1, %0" : "=f" (pi_2) : "0" (pi));
-  y_cond = __m81_test (y);
-  x_cond = __m81_test (x);
-
-  if ((x_cond | y_cond) & __M81_COND_NAN)
-    z = x + y;
-  else if (y_cond & __M81_COND_ZERO)
-    {
-      if (x_cond & __M81_COND_NEG)
-	z = y_cond & __M81_COND_NEG ? -pi : pi;
-      else
-	z = y;
-    }
-  else if (x_cond & __M81_COND_INF)
-    {
-      if (y_cond & __M81_COND_INF)
-	{
-	  float_type pi_4;
-	  __asm ("fscale%.w %#-2, %0" : "=f" (pi_4) : "0" (pi));
-	  z = x_cond & __M81_COND_NEG ? 3 * pi_4 : pi_4;
-	}
-      else
-	z = x_cond & __M81_COND_NEG ? pi : 0;
-      if (y_cond & __M81_COND_NEG)
-	z = -z;
-    }
-  else if (y_cond & __M81_COND_INF)
-    z = y_cond & __M81_COND_NEG ? -pi_2 : pi_2;
-  else if (x_cond & __M81_COND_NEG)
-    {
-      if (y_cond & __M81_COND_NEG)
-	{
-	  if (-x > -y)
-	    z = -pi + m81(__atan) (y / x);
-	  else
-	    z = -pi_2 - m81(__atan) (x / y);
-	}
-      else
-	{
-	  if (-x > y)
-	    z = pi + m81(__atan) (y / x);
-	  else
-	    z = pi_2 - m81(__atan) (x / y);
-	}
-    }
-  else
-    {
-      if (y_cond & __M81_COND_NEG)
-	{
-	  if (x > -y)
-	    z = m81(__atan) (y / x);
-	  else
-	    z = -pi_2 - m81(__atan) (x / y);
-	}
-      else
-	{
-	  if (x > y)
-	    z = m81(__atan) (y / x);
-	  else
-	    z = pi_2 - m81(__atan) (x / y);
-	}
-    }
-  return z;
-}
diff --git a/sysdeps/m68k/fpu/e_atan2f.c b/sysdeps/m68k/fpu/e_atan2f.c
deleted file mode 100644
index a0c750a759..0000000000
--- a/sysdeps/m68k/fpu/e_atan2f.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <e_atan2.c>
diff --git a/sysdeps/m68k/fpu/e_atan2l.c b/sysdeps/m68k/fpu/e_atan2l.c
deleted file mode 100644
index 426ca94baa..0000000000
--- a/sysdeps/m68k/fpu/e_atan2l.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <e_atan2.c>
diff --git a/sysdeps/m68k/fpu/e_atanh.c b/sysdeps/m68k/fpu/e_atanh.c
deleted file mode 100644
index 11bf430686..0000000000
--- a/sysdeps/m68k/fpu/e_atanh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_atanh
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_atanhf.c b/sysdeps/m68k/fpu/e_atanhf.c
deleted file mode 100644
index 7a8f92ecf3..0000000000
--- a/sysdeps/m68k/fpu/e_atanhf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_atanhf
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_atanhl.c b/sysdeps/m68k/fpu/e_atanhl.c
deleted file mode 100644
index d8975d6782..0000000000
--- a/sysdeps/m68k/fpu/e_atanhl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_atanhl
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_cosh.c b/sysdeps/m68k/fpu/e_cosh.c
deleted file mode 100644
index 93d753c519..0000000000
--- a/sysdeps/m68k/fpu/e_cosh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_cosh
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_coshf.c b/sysdeps/m68k/fpu/e_coshf.c
deleted file mode 100644
index 433faf17b9..0000000000
--- a/sysdeps/m68k/fpu/e_coshf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_coshf
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_coshl.c b/sysdeps/m68k/fpu/e_coshl.c
deleted file mode 100644
index 39144fd202..0000000000
--- a/sysdeps/m68k/fpu/e_coshl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_coshl
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_exp.c b/sysdeps/m68k/fpu/e_exp.c
deleted file mode 100644
index 1e95ac474d..0000000000
--- a/sysdeps/m68k/fpu/e_exp.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_exp
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_exp10.c b/sysdeps/m68k/fpu/e_exp10.c
deleted file mode 100644
index a1dd224470..0000000000
--- a/sysdeps/m68k/fpu/e_exp10.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_exp10
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_exp10f.c b/sysdeps/m68k/fpu/e_exp10f.c
deleted file mode 100644
index 1b78bc3723..0000000000
--- a/sysdeps/m68k/fpu/e_exp10f.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_exp10f
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_exp10l.c b/sysdeps/m68k/fpu/e_exp10l.c
deleted file mode 100644
index 5e901999fa..0000000000
--- a/sysdeps/m68k/fpu/e_exp10l.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_exp10l
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_exp2.c b/sysdeps/m68k/fpu/e_exp2.c
deleted file mode 100644
index 24fac4fce6..0000000000
--- a/sysdeps/m68k/fpu/e_exp2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_exp2
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_exp2f.c b/sysdeps/m68k/fpu/e_exp2f.c
deleted file mode 100644
index 593842e4e5..0000000000
--- a/sysdeps/m68k/fpu/e_exp2f.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_exp2f
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_exp2l.c b/sysdeps/m68k/fpu/e_exp2l.c
deleted file mode 100644
index 0ab2a428c0..0000000000
--- a/sysdeps/m68k/fpu/e_exp2l.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_exp2l
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_expf.c b/sysdeps/m68k/fpu/e_expf.c
deleted file mode 100644
index 2aeaacfab9..0000000000
--- a/sysdeps/m68k/fpu/e_expf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_expf
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_expl.c b/sysdeps/m68k/fpu/e_expl.c
deleted file mode 100644
index 8805a1b83a..0000000000
--- a/sysdeps/m68k/fpu/e_expl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_expl
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_fmod.c b/sysdeps/m68k/fpu/e_fmod.c
deleted file mode 100644
index bd229ae4b0..0000000000
--- a/sysdeps/m68k/fpu/e_fmod.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-#ifndef FUNC
-#define FUNC __ieee754_fmod
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-float_type
-FUNC (x, y)
-     float_type x;
-     float_type y;
-{
-  return __m81_u(FUNC)(x, y);
-}
diff --git a/sysdeps/m68k/fpu/e_fmodf.c b/sysdeps/m68k/fpu/e_fmodf.c
deleted file mode 100644
index 88c350ce9e..0000000000
--- a/sysdeps/m68k/fpu/e_fmodf.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef FUNC
-#define FUNC __ieee754_fmodf
-#endif
-#define float_type float
-#include <e_fmod.c>
diff --git a/sysdeps/m68k/fpu/e_fmodl.c b/sysdeps/m68k/fpu/e_fmodl.c
deleted file mode 100644
index a46f19ea9d..0000000000
--- a/sysdeps/m68k/fpu/e_fmodl.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef FUNC
-#define FUNC __ieee754_fmodl
-#endif
-#define float_type long double
-#include <e_fmod.c>
diff --git a/sysdeps/m68k/fpu/e_log.c b/sysdeps/m68k/fpu/e_log.c
deleted file mode 100644
index 146dc0c784..0000000000
--- a/sysdeps/m68k/fpu/e_log.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_log
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_log10.c b/sysdeps/m68k/fpu/e_log10.c
deleted file mode 100644
index 06a9b87cb9..0000000000
--- a/sysdeps/m68k/fpu/e_log10.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_log10
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_log10f.c b/sysdeps/m68k/fpu/e_log10f.c
deleted file mode 100644
index 3896864ecb..0000000000
--- a/sysdeps/m68k/fpu/e_log10f.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_log10f
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_log10l.c b/sysdeps/m68k/fpu/e_log10l.c
deleted file mode 100644
index 6dcfc5a101..0000000000
--- a/sysdeps/m68k/fpu/e_log10l.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_log10l
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_log2.c b/sysdeps/m68k/fpu/e_log2.c
deleted file mode 100644
index 5528922b9c..0000000000
--- a/sysdeps/m68k/fpu/e_log2.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC    __ieee754_log2
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_log2f.c b/sysdeps/m68k/fpu/e_log2f.c
deleted file mode 100644
index 6b4907686d..0000000000
--- a/sysdeps/m68k/fpu/e_log2f.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC    __ieee754_log2f
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_log2l.c b/sysdeps/m68k/fpu/e_log2l.c
deleted file mode 100644
index 4c92a11acf..0000000000
--- a/sysdeps/m68k/fpu/e_log2l.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC    __ieee754_log2l
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_logf.c b/sysdeps/m68k/fpu/e_logf.c
deleted file mode 100644
index bc23217c38..0000000000
--- a/sysdeps/m68k/fpu/e_logf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_logf
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_logl.c b/sysdeps/m68k/fpu/e_logl.c
deleted file mode 100644
index 03b1830759..0000000000
--- a/sysdeps/m68k/fpu/e_logl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_logl
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_pow.c b/sysdeps/m68k/fpu/e_pow.c
deleted file mode 100644
index 0b6cee6f15..0000000000
--- a/sysdeps/m68k/fpu/e_pow.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (C) 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-float_type
-s(__ieee754_pow) (float_type x, float_type y)
-{
-  float_type z;
-  float_type ax;
-  unsigned long x_cond, y_cond;
-
-  y_cond = __m81_test (y);
-  if (y_cond & __M81_COND_ZERO)
-    return 1.0;
-  if (y_cond & __M81_COND_NAN)
-    return x == 1.0 ? x : x + y;
-
-  x_cond = __m81_test (x);
-  if (x_cond & __M81_COND_NAN)
-    return x + y;
-
-  if (y_cond & __M81_COND_INF)
-    {
-      ax = s(fabs) (x);
-      if (ax == 1.0)
-	return ax;
-      if (ax > 1.0)
-	return y_cond & __M81_COND_NEG ? 0 : y;
-      else
-	return y_cond & __M81_COND_NEG ? -y : 0;
-    }
-
-  if (s(fabs) (y) == 1.0)
-    return y_cond & __M81_COND_NEG ? 1 / x : x;
-
-  if (y == 2)
-    return x * x;
-  if (y == 0.5 && !(x_cond & __M81_COND_NEG))
-    return m81(__ieee754_sqrt) (x);
-
-  if (x == 10.0)
-    {
-      __asm ("ftentox%.x %1, %0" : "=f" (z) : "f" (y));
-      return z;
-    }
-  if (x == 2.0)
-    {
-      __asm ("ftwotox%.x %1, %0" : "=f" (z) : "f" (y));
-      return z;
-    }
-
-  ax = s(fabs) (x);
-  if (x_cond & (__M81_COND_INF | __M81_COND_ZERO) || ax == 1.0)
-    {
-      z = ax;
-      if (y_cond & __M81_COND_NEG)
-	z = 1 / z;
-      if (x_cond & __M81_COND_NEG)
-	{
-	  if (y != m81(__rint) (y))
-	    {
-	      if (x == -1)
-		z = (z - z) / (z - z);
-	    }
-	  else
-	    goto maybe_negate;
-	}
-      return z;
-    }
-
-  if (x_cond & __M81_COND_NEG)
-    {
-      if (y == m81(__rint) (y))
-	{
-	  z = m81(__ieee754_exp) (y * m81(__ieee754_log) (-x));
-	maybe_negate:
-	  /* We always use the long double format, since y is already in
-	     this format and rounding won't change the result.  */
-	  {
-	    int32_t exponent;
-	    u_int32_t i0, i1;
-	    GET_LDOUBLE_WORDS (exponent, i0, i1, y);
-	    exponent = (exponent & 0x7fff) - 0x3fff;
-	    if (exponent <= 31
-		? i0 & (1 << (31 - exponent))
-		: (exponent <= 63
-		   && i1 & (1 << (63 - exponent))))
-	      z = -z;
-	  }
-	}
-      else
-	z = (y - y) / (y - y);
-    }
-  else
-    z = m81(__ieee754_exp) (y * m81(__ieee754_log) (x));
-  return z;
-}
diff --git a/sysdeps/m68k/fpu/e_powf.c b/sysdeps/m68k/fpu/e_powf.c
deleted file mode 100644
index 379014355a..0000000000
--- a/sysdeps/m68k/fpu/e_powf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <e_pow.c>
diff --git a/sysdeps/m68k/fpu/e_powl.c b/sysdeps/m68k/fpu/e_powl.c
deleted file mode 100644
index f71fa34a26..0000000000
--- a/sysdeps/m68k/fpu/e_powl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <e_pow.c>
diff --git a/sysdeps/m68k/fpu/e_rem_pio2.c b/sysdeps/m68k/fpu/e_rem_pio2.c
deleted file mode 100644
index 1347b0468c..0000000000
--- a/sysdeps/m68k/fpu/e_rem_pio2.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty.  This file is only meant to avoid compiling the file with the
-   same name in the libm-ieee754 directory.  The code is not used since
-   there is an assembler version for all users of this file.  */
diff --git a/sysdeps/m68k/fpu/e_rem_pio2f.c b/sysdeps/m68k/fpu/e_rem_pio2f.c
deleted file mode 100644
index 1347b0468c..0000000000
--- a/sysdeps/m68k/fpu/e_rem_pio2f.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty.  This file is only meant to avoid compiling the file with the
-   same name in the libm-ieee754 directory.  The code is not used since
-   there is an assembler version for all users of this file.  */
diff --git a/sysdeps/m68k/fpu/e_rem_pio2l.c b/sysdeps/m68k/fpu/e_rem_pio2l.c
deleted file mode 100644
index 1347b0468c..0000000000
--- a/sysdeps/m68k/fpu/e_rem_pio2l.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty.  This file is only meant to avoid compiling the file with the
-   same name in the libm-ieee754 directory.  The code is not used since
-   there is an assembler version for all users of this file.  */
diff --git a/sysdeps/m68k/fpu/e_remainder.c b/sysdeps/m68k/fpu/e_remainder.c
deleted file mode 100644
index aa31bc011e..0000000000
--- a/sysdeps/m68k/fpu/e_remainder.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_remainder
-#include <e_fmod.c>
diff --git a/sysdeps/m68k/fpu/e_remainderf.c b/sysdeps/m68k/fpu/e_remainderf.c
deleted file mode 100644
index b04f0c87c2..0000000000
--- a/sysdeps/m68k/fpu/e_remainderf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_remainderf
-#include <e_fmodf.c>
diff --git a/sysdeps/m68k/fpu/e_remainderl.c b/sysdeps/m68k/fpu/e_remainderl.c
deleted file mode 100644
index b9dc540cc5..0000000000
--- a/sysdeps/m68k/fpu/e_remainderl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_remainderl
-#include <e_fmodl.c>
diff --git a/sysdeps/m68k/fpu/e_scalb.c b/sysdeps/m68k/fpu/e_scalb.c
deleted file mode 100644
index 88edba1ca8..0000000000
--- a/sysdeps/m68k/fpu/e_scalb.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-float_type
-s(__ieee754_scalb) (float_type x, float_type fn)
-{
-  float_type retval;
-  unsigned long x_cond = __m81_test (x);
-  unsigned long fn_cond = __m81_test (fn);
-
-  if ((x_cond | fn_cond) & __M81_COND_NAN)
-    return x * fn;
-
-  if (fn_cond & __M81_COND_INF)
-    {
-      if (!(fn_cond & __M81_COND_NEG))
-	return x * fn;
-      else if (x_cond & __M81_COND_ZERO)
-	return x;
-      else
-	return x / -fn;
-    }
-
-  if (m81(__rint) (fn) != fn)
-    return (x - x) / (x - x);
-
-  __asm ("fscale%.x %1, %0" : "=f" (retval) : "f" (fn), "0" (x));
-  return retval;
-}
diff --git a/sysdeps/m68k/fpu/e_scalbf.c b/sysdeps/m68k/fpu/e_scalbf.c
deleted file mode 100644
index 7943571246..0000000000
--- a/sysdeps/m68k/fpu/e_scalbf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <e_scalb.c>
diff --git a/sysdeps/m68k/fpu/e_scalbl.c b/sysdeps/m68k/fpu/e_scalbl.c
deleted file mode 100644
index 35fb2dc0ed..0000000000
--- a/sysdeps/m68k/fpu/e_scalbl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <e_scalb.c>
diff --git a/sysdeps/m68k/fpu/e_sinh.c b/sysdeps/m68k/fpu/e_sinh.c
deleted file mode 100644
index c6fed7ff46..0000000000
--- a/sysdeps/m68k/fpu/e_sinh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_sinh
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_sinhf.c b/sysdeps/m68k/fpu/e_sinhf.c
deleted file mode 100644
index b5034b7b0e..0000000000
--- a/sysdeps/m68k/fpu/e_sinhf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_sinhf
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_sinhl.c b/sysdeps/m68k/fpu/e_sinhl.c
deleted file mode 100644
index 2f42d96a38..0000000000
--- a/sysdeps/m68k/fpu/e_sinhl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_sinhl
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_sqrt.c b/sysdeps/m68k/fpu/e_sqrt.c
deleted file mode 100644
index 70f19710cc..0000000000
--- a/sysdeps/m68k/fpu/e_sqrt.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_sqrt
-#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_sqrtf.c b/sysdeps/m68k/fpu/e_sqrtf.c
deleted file mode 100644
index 5dc1904cb6..0000000000
--- a/sysdeps/m68k/fpu/e_sqrtf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	__ieee754_sqrtf
-#include <e_acosf.c>
diff --git a/sysdeps/m68k/fpu/e_sqrtl.c b/sysdeps/m68k/fpu/e_sqrtl.c
deleted file mode 100644
index fede1024a2..0000000000
--- a/sysdeps/m68k/fpu/e_sqrtl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC __ieee754_sqrtl
-#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/fclrexcpt.c b/sysdeps/m68k/fpu/fclrexcpt.c
deleted file mode 100644
index bcd7a3fe52..0000000000
--- a/sysdeps/m68k/fpu/fclrexcpt.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Clear given exceptions in current floating-point environment.
-   Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-__feclearexcept (int excepts)
-{
-  fexcept_t fpsr;
-
-  /* Mask out unsupported bits/exceptions.  */
-  excepts &= FE_ALL_EXCEPT;
-
-  /* Fetch the fpu status register.  */
-  __asm__ ("fmove%.l %/fpsr,%0" : "=dm" (fpsr));
-
-  /* Clear the relevant bits.  */
-  fpsr &= ~excepts;
-
-  /* Put the new data in effect.  */
-  __asm__ __volatile__ ("fmove%.l %0,%/fpsr" : : "dm" (fpsr));
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feclearexcept, __old_feclearexcept)
-compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/sysdeps/m68k/fpu/fedisblxcpt.c b/sysdeps/m68k/fpu/fedisblxcpt.c
deleted file mode 100644
index 416e0ba464..0000000000
--- a/sysdeps/m68k/fpu/fedisblxcpt.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Disable floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fedisableexcept (int excepts)
-{
-  unsigned int old_exc, new_exc;
-
-  /* Get the current control register contents.  */
-  __asm__ ("fmove%.l %!,%0" : "=dm" (new_exc));
-
-  old_exc = (new_exc >> 6) & FE_ALL_EXCEPT;
-
-  excepts &= FE_ALL_EXCEPT;
-
-  new_exc &= ~(excepts << 6);
-  __asm__ ("fmove%.l %0,%!" : : "dm" (new_exc));
-
-  return old_exc;
-}
diff --git a/sysdeps/m68k/fpu/feenablxcpt.c b/sysdeps/m68k/fpu/feenablxcpt.c
deleted file mode 100644
index f963acf01d..0000000000
--- a/sysdeps/m68k/fpu/feenablxcpt.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Enable floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-feenableexcept (int excepts)
-{
-  unsigned int new_exc, old_exc;
-
-  /* Get the current control register contents.  */
-  __asm__ ("fmove%.l %!,%0" : "=dm" (new_exc));
-
-  old_exc = (new_exc >> 6) & FE_ALL_EXCEPT;
-
-  excepts &= FE_ALL_EXCEPT;
-
-  new_exc |= excepts << 6;
-  __asm__ ("fmove%.l %0,%!" : : "dm" (new_exc));
-
-  return old_exc;
-}
diff --git a/sysdeps/m68k/fpu/fegetenv.c b/sysdeps/m68k/fpu/fegetenv.c
deleted file mode 100644
index 6c94b07318..0000000000
--- a/sysdeps/m68k/fpu/fegetenv.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Store current floating-point environment.
-   Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-__fegetenv (fenv_t *envp)
-{
-  __asm__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" : "=m" (*envp));
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fegetenv, __old_fegetenv)
-compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
diff --git a/sysdeps/m68k/fpu/fegetexcept.c b/sysdeps/m68k/fpu/fegetexcept.c
deleted file mode 100644
index b34b2c1e20..0000000000
--- a/sysdeps/m68k/fpu/fegetexcept.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Get enabled floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetexcept (void)
-{
-  unsigned int exc;
-
-  /* Get the current control register contents.  */
-  __asm__ ("fmove%.l %!,%0" : "=dm" (exc));
-
-  return (exc >> 6) & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/m68k/fpu/fegetround.c b/sysdeps/m68k/fpu/fegetround.c
deleted file mode 100644
index 74fc56f745..0000000000
--- a/sysdeps/m68k/fpu/fegetround.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Return current rounding direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fegetround (void)
-{
-  int fpcr;
-
-  __asm__ ("fmove%.l %!,%0" : "=dm" (fpcr));
-
-  return fpcr & FE_UPWARD;
-}
diff --git a/sysdeps/m68k/fpu/feholdexcpt.c b/sysdeps/m68k/fpu/feholdexcpt.c
deleted file mode 100644
index 88fb1c59ac..0000000000
--- a/sysdeps/m68k/fpu/feholdexcpt.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-feholdexcept (fenv_t *envp)
-{
-  fexcept_t fpcr, fpsr;
-
-  /* Store the environment.  */
-  __asm__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" : "=m" (*envp));
-
-  /* Now clear all exceptions.  */
-  fpsr = envp->__status_register & ~FE_ALL_EXCEPT;
-  __asm__ __volatile__ ("fmove%.l %0,%/fpsr" : : "dm" (fpsr));
-  /* And set all exceptions to non-stop.  */
-  fpcr = envp->__control_register & ~(FE_ALL_EXCEPT << 6);
-  __asm__ __volatile__ ("fmove%.l %0,%!" : : "dm" (fpcr));
-
-  return 0;
-}
diff --git a/sysdeps/m68k/fpu/fesetenv.c b/sysdeps/m68k/fpu/fesetenv.c
deleted file mode 100644
index 20653f0ddc..0000000000
--- a/sysdeps/m68k/fpu/fesetenv.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Install given floating-point environment.
-   Copyright (C) 1997,99,2000,01,02 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-__fesetenv (const fenv_t *envp)
-{
-  fenv_t temp;
-
-  /* Install the environment specified by ENVP.  But there are a few
-     values which we do not want to come from the saved environment.
-     Therefore, we get the current environment and replace the values
-     we want to use from the environment specified by the parameter.  */
-  __asm__ ("fmovem%.l %/fpcr/%/fpsr/%/fpiar,%0" : "=m" (*&temp));
-
-  temp.__status_register &= ~FE_ALL_EXCEPT;
-  temp.__control_register &= ~((FE_ALL_EXCEPT << 6) | FE_UPWARD);
-  if (envp == FE_DFL_ENV)
-    ;
-  else if (envp == FE_NOMASK_ENV)
-    temp.__control_register |= FE_ALL_EXCEPT << 6;
-  else
-    {
-      temp.__control_register |= (envp->__control_register
-				  & ((FE_ALL_EXCEPT << 6) | FE_UPWARD));
-      temp.__status_register |= envp->__status_register & FE_ALL_EXCEPT;
-    }
-
-  __asm__ __volatile__ ("fmovem%.l %0,%/fpcr/%/fpsr/%/fpiar" : : "m" (*&temp));
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetenv, __old_fesetenv)
-compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1);
-#endif
-
-libm_hidden_ver (__fesetenv, fesetenv)
-versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
diff --git a/sysdeps/m68k/fpu/fesetround.c b/sysdeps/m68k/fpu/fesetround.c
deleted file mode 100644
index 956325de8a..0000000000
--- a/sysdeps/m68k/fpu/fesetround.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Set current rounding direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fesetround (int round)
-{
-  fexcept_t fpcr;
-
-  if (round & ~FE_UPWARD)
-    /* ROUND is no valid rounding mode.  */
-    return 1;
-
-  __asm__ ("fmove%.l %!,%0" : "=dm" (fpcr));
-  fpcr &= ~FE_UPWARD;
-  fpcr |= round;
-  __asm__ __volatile__ ("fmove%.l %0,%!" : : "dm" (fpcr));
-
-  return 0;
-}
diff --git a/sysdeps/m68k/fpu/feupdateenv.c b/sysdeps/m68k/fpu/feupdateenv.c
deleted file mode 100644
index 2a6831387e..0000000000
--- a/sysdeps/m68k/fpu/feupdateenv.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-__feupdateenv (const fenv_t *envp)
-{
-  fexcept_t fpsr;
-
-  /* Save current exceptions.  */
-  __asm__ ("fmove%.l %/fpsr,%0" : "=dm" (fpsr));
-  fpsr &= FE_ALL_EXCEPT;
-
-  /* Install new environment.  */
-  fesetenv (envp);
-
-  /* Raise the saved exception.  Incidently for us the implementation
-     defined format of the values in objects of type fexcept_t is the
-     same as the ones specified using the FE_* constants.  */
-  feraiseexcept ((int) fpsr);
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feupdateenv, __old_feupdateenv)
-compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
diff --git a/sysdeps/m68k/fpu/fgetexcptflg.c b/sysdeps/m68k/fpu/fgetexcptflg.c
deleted file mode 100644
index 764b900c0b..0000000000
--- a/sysdeps/m68k/fpu/fgetexcptflg.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Store current representation for exceptions.
-   Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-__fegetexceptflag (fexcept_t *flagp, int excepts)
-{
-  fexcept_t fpsr;
-
-  /* Get the current exceptions.  */
-  __asm__ ("fmove%.l %/fpsr,%0" : "=dm" (fpsr));
-
-  *flagp = fpsr & excepts & FE_ALL_EXCEPT;
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fegetexceptflag, __old_fegetexceptflag)
-compat_symbol (libm, __old_fegetexceptflag, fegetexceptflag, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __fegetexceptflag, fegetexceptflag, GLIBC_2_2);
diff --git a/sysdeps/m68k/fpu/fraiseexcpt.c b/sysdeps/m68k/fpu/fraiseexcpt.c
deleted file mode 100644
index 69f746c9b2..0000000000
--- a/sysdeps/m68k/fpu/fraiseexcpt.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Raise given exceptions.
-   Copyright (C) 1997,99,2000,01,02 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <float.h>
-#include <math.h>
-
-int
-__feraiseexcept (int excepts)
-{
-  /* Raise exceptions represented by EXCEPTS.  But we must raise only one
-     signal at a time.  It is important that if the overflow/underflow
-     exception and the divide by zero exception are given at the same
-     time, the overflow/underflow exception follows the divide by zero
-     exception.  */
-
-  /* First: invalid exception.  */
-  if (excepts & FE_INVALID)
-    {
-      /* One example of a invalid operation is 0 * Infinity.  */
-      double d = HUGE_VAL;
-      __asm__ __volatile__ ("fmul%.s %#0r0,%0; fnop" : "=f" (d) : "0" (d));
-    }
-
-  /* Next: division by zero.  */
-  if (excepts & FE_DIVBYZERO)
-    {
-      double d = 1.0;
-      __asm__ __volatile__ ("fdiv%.s %#0r0,%0; fnop" : "=f" (d) : "0" (d));
-    }
-
-  /* Next: overflow.  */
-  if (excepts & FE_OVERFLOW)
-    {
-      long double d = LDBL_MAX;
-
-      __asm__ __volatile__ ("fmul%.x %0,%0; fnop" : "=f" (d) : "0" (d));
-    }
-
-  /* Next: underflow.  */
-  if (excepts & FE_UNDERFLOW)
-    {
-      long double d = -LDBL_MAX;
-
-      __asm__ __volatile__ ("fetox%.x %0; fnop" : "=f" (d) : "0" (d));
-    }
-
-  /* Last: inexact.  */
-  if (excepts & FE_INEXACT)
-    {
-      long double d = 1.0;
-      __asm__ __volatile__ ("fdiv%.s %#0r3,%0; fnop" : "=f" (d) : "0" (d));
-    }
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feraiseexcept, __old_feraiseexcept)
-compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
-#endif
-
-libm_hidden_ver (__feraiseexcept, feraiseexcept)
-versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
diff --git a/sysdeps/m68k/fpu/fsetexcptflg.c b/sysdeps/m68k/fpu/fsetexcptflg.c
deleted file mode 100644
index 51b086a8f2..0000000000
--- a/sysdeps/m68k/fpu/fsetexcptflg.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Set floating-point environment exception handling.
-   Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <math.h>
-
-int
-__fesetexceptflag (const fexcept_t *flagp, int excepts)
-{
-  fexcept_t fpsr;
-
-  /* Get the current status register.  */
-  __asm__ ("fmove%.l %/fpsr,%0" : "=dm" (fpsr));
-
-  /* Install the new exception bits in the Accrued Exception Byte.  */
-  fpsr &= ~(excepts & FE_ALL_EXCEPT);
-  fpsr |= *flagp & excepts & FE_ALL_EXCEPT;
-
-  /* Store the new status register.  */
-  __asm__ __volatile__ ("fmove%.l %0,%/fpsr" : : "dm" (fpsr));
-
-  /* Success.  */
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetexceptflag, __old_fesetexceptflag)
-compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);
diff --git a/sysdeps/m68k/fpu/ftestexcept.c b/sysdeps/m68k/fpu/ftestexcept.c
deleted file mode 100644
index 3157c90d1a..0000000000
--- a/sysdeps/m68k/fpu/ftestexcept.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Test exception in current environment.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-int
-fetestexcept (int excepts)
-{
-  fexcept_t fpsr;
-
-  /* Get current exceptions.  */
-  __asm__ ("fmove%.l %/fpsr,%0" : "=dm" (fpsr));
-
-  return fpsr & excepts & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/m68k/fpu/halfulp.c b/sysdeps/m68k/fpu/halfulp.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/halfulp.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/k_cos.c b/sysdeps/m68k/fpu/k_cos.c
deleted file mode 100644
index dd6c215c23..0000000000
--- a/sysdeps/m68k/fpu/k_cos.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-
-#ifndef FUNC
-#define FUNC cos
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float_type
-__CONCATX(__kernel_,FUNC) (x, y)
-     float_type x;
-     float_type y;
-{
-  float_type sin_x, cos_x, sin_y, cos_y;
-  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_x), "=f" (sin_x)
-			: "f" (x));
-  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_y), "=f" (sin_y)
-			: "f" (y));
-  return cos_x * cos_y - sin_x * sin_y;
-}
diff --git a/sysdeps/m68k/fpu/k_cosf.c b/sysdeps/m68k/fpu/k_cosf.c
deleted file mode 100644
index 2a366d094b..0000000000
--- a/sysdeps/m68k/fpu/k_cosf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC cosf
-#define float_type float
-#include <k_cos.c>
diff --git a/sysdeps/m68k/fpu/k_cosl.c b/sysdeps/m68k/fpu/k_cosl.c
deleted file mode 100644
index 983b66544c..0000000000
--- a/sysdeps/m68k/fpu/k_cosl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC cosl
-#define float_type long double
-#include <k_cos.c>
diff --git a/sysdeps/m68k/fpu/k_rem_pio2.c b/sysdeps/m68k/fpu/k_rem_pio2.c
deleted file mode 100644
index 1347b0468c..0000000000
--- a/sysdeps/m68k/fpu/k_rem_pio2.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty.  This file is only meant to avoid compiling the file with the
-   same name in the libm-ieee754 directory.  The code is not used since
-   there is an assembler version for all users of this file.  */
diff --git a/sysdeps/m68k/fpu/k_rem_pio2f.c b/sysdeps/m68k/fpu/k_rem_pio2f.c
deleted file mode 100644
index 1347b0468c..0000000000
--- a/sysdeps/m68k/fpu/k_rem_pio2f.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty.  This file is only meant to avoid compiling the file with the
-   same name in the libm-ieee754 directory.  The code is not used since
-   there is an assembler version for all users of this file.  */
diff --git a/sysdeps/m68k/fpu/k_rem_pio2l.c b/sysdeps/m68k/fpu/k_rem_pio2l.c
deleted file mode 100644
index 1347b0468c..0000000000
--- a/sysdeps/m68k/fpu/k_rem_pio2l.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Empty.  This file is only meant to avoid compiling the file with the
-   same name in the libm-ieee754 directory.  The code is not used since
-   there is an assembler version for all users of this file.  */
diff --git a/sysdeps/m68k/fpu/k_sin.c b/sysdeps/m68k/fpu/k_sin.c
deleted file mode 100644
index 652ca0e131..0000000000
--- a/sysdeps/m68k/fpu/k_sin.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-
-#ifndef FUNC
-#define FUNC sin
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float_type
-__CONCATX(__kernel_,FUNC) (x, y, iy)
-     float_type x;
-     float_type y;
-     int iy;
-{
-  float_type sin_x, cos_x, sin_y, cos_y;
-  if (iy == 0)
-    return __m81_u(__CONCATX(__,FUNC)) (x);
-  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_x), "=f" (sin_x)
-			: "f" (x));
-  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_y), "=f" (sin_y)
-			: "f" (y));
-  return sin_x * cos_y + cos_x * sin_y;
-}
diff --git a/sysdeps/m68k/fpu/k_sinf.c b/sysdeps/m68k/fpu/k_sinf.c
deleted file mode 100644
index 7050347c4b..0000000000
--- a/sysdeps/m68k/fpu/k_sinf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC sinf
-#define float_type float
-#include <k_sin.c>
diff --git a/sysdeps/m68k/fpu/k_sinl.c b/sysdeps/m68k/fpu/k_sinl.c
deleted file mode 100644
index 5a647cafd7..0000000000
--- a/sysdeps/m68k/fpu/k_sinl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC sinl
-#define float_type long double
-#include <k_sin.c>
diff --git a/sysdeps/m68k/fpu/k_tan.c b/sysdeps/m68k/fpu/k_tan.c
deleted file mode 100644
index 28f6a80cf5..0000000000
--- a/sysdeps/m68k/fpu/k_tan.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-
-#ifndef FUNC
-#define FUNC tan
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float_type
-__CONCATX(__kernel_,FUNC) (x, y, iy)
-     float_type x;
-     float_type y;
-     int iy;
-{
-  float_type tan_x, tan_y;
-  tan_x = __m81_u(__CONCATX(__,FUNC)) (x);
-  tan_y = __m81_u(__CONCATX(__,FUNC)) (y);
-  if (iy > 0)
-    return (tan_x + tan_y) / (1 - tan_x * tan_y);
-  else
-    return (tan_x * tan_y - 1) / (tan_x + tan_y);
-}
diff --git a/sysdeps/m68k/fpu/k_tanf.c b/sysdeps/m68k/fpu/k_tanf.c
deleted file mode 100644
index 777af1bf13..0000000000
--- a/sysdeps/m68k/fpu/k_tanf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC tanf
-#define float_type float
-#include <k_tan.c>
diff --git a/sysdeps/m68k/fpu/k_tanl.c b/sysdeps/m68k/fpu/k_tanl.c
deleted file mode 100644
index f2570e681f..0000000000
--- a/sysdeps/m68k/fpu/k_tanl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC tanl
-#define float_type long double
-#include <k_tan.c>
diff --git a/sysdeps/m68k/fpu/libm-test-ulps b/sysdeps/m68k/fpu/libm-test-ulps
deleted file mode 100644
index cab950120c..0000000000
--- a/sysdeps/m68k/fpu/libm-test-ulps
+++ /dev/null
@@ -1,1165 +0,0 @@
-# Begin of automatic generation
-
-# acosh
-Test "acosh (7) == 2.63391579384963341725009269461593689":
-ildouble: 1
-ldouble: 1
-
-# asinh
-Test "asinh (0.75) == 0.693147180559945309417232121458176568":
-ildouble: 1
-ldouble: 1
-
-# atan2
-Test "atan2 (0.390625, .00029) == 1.57005392693128974780151246612928941":
-ildouble: 1
-ldouble: 1
-Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
-ildouble: 1
-ldouble: 1
-
-# atanh
-Test "atanh (0.75) == 0.972955074527656652552676371721589865":
-ildouble: 1
-ldouble: 1
-
-# cacos
-Test "Real part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
-float: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-ildouble: 6
-ldouble: 6
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-idouble: 1
-ildouble: 2
-ldouble: 2
-Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i":
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i":
-float: 1
-ifloat: 1
-
-# casin
-Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-ildouble: 3
-ldouble: 3
-Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
-float: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-# casinh
-Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 6
-float: 19
-idouble: 6
-ifloat: 19
-ildouble: 5
-ldouble: 5
-Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 13
-float: 1
-idouble: 13
-ifloat: 1
-ildouble: 6
-ldouble: 6
-Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# catan
-Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
-ildouble: 1
-ldouble: 1
-
-# catanh
-Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-ildouble: 1
-ldouble: 1
-
-# cbrt
-Test "cbrt (-0.001) == -0.1":
-ildouble: 1
-ldouble: 1
-Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
-ildouble: 1
-ldouble: 1
-
-# ccos
-Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# ccosh
-Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# cexp
-Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
-float: 1
-ifloat: 1
-Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
-float: 2
-ifloat: 2
-Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# clog
-Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
-ildouble: 1
-ldouble: 1
-
-# clog10
-Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
-double: 1
-idouble: 1
-Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
-double: 1
-idouble: 1
-ildouble: 2
-ldouble: 2
-Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
-float: 1
-ifloat: 1
-
-# cos
-Test "cos (M_PI_6l * 2.0) == 0.5":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "cos (M_PI_6l * 4.0) == -0.5":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "cos (pi/2) == 0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# cpow
-Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
-float: 1
-ifloat: 1
-ildouble: 9
-ldouble: 9
-Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
-float: 2
-ifloat: 2
-ildouble: 2
-ldouble: 2
-Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-ildouble: 15
-ldouble: 15
-Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
-ildouble: 5
-ldouble: 5
-Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 4
-ldouble: 4
-Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-float: 6
-ifloat: 6
-ildouble: 2
-ldouble: 2
-Test "Real part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
-double: 2
-float: 3
-idouble: 2
-ifloat: 3
-ildouble: 1
-ldouble: 1
-
-# csin
-Test "Real part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
-float: 1
-ifloat: 1
-Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
-float: 1
-ifloat: 1
-
-# csinh
-Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
-float: 1
-ifloat: 1
-Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-
-# ctan
-Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-double: 1
-idouble: 1
-ildouble: 1
-ldouble: 1
-Test "Real part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
-ildouble: 2
-ldouble: 2
-
-# ctanh
-Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
-ildouble: 1
-ldouble: 1
-Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# erfc
-Test "erfc (0.75) == 0.288844366346484868401062165408589223":
-float: 1
-ifloat: 1
-Test "erfc (1.25) == 0.0770998717435417698634765188027188596":
-ildouble: 1
-ldouble: 1
-Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
-float: 1
-ifloat: 1
-
-# expm1
-Test "expm1 (1) == M_El - 1.0":
-ildouble: 1
-ldouble: 1
-
-# gamma
-Test "gamma (-0.5) == log(2*sqrt(pi))":
-ildouble: 1
-ldouble: 1
-Test "gamma (0.5) == log(sqrt(pi))":
-ildouble: 1
-ldouble: 1
-Test "gamma (3) == M_LN2l":
-ildouble: 1
-ldouble: 1
-
-# hypot
-Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-
-# j0
-Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "j0 (0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "j0 (1.5) == 0.511827671735918128749051744283411720":
-float: 1
-ifloat: 1
-Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 1
-idouble: 1
-Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# j1
-Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
-float: 1
-ifloat: 1
-Test "j1 (1.0) == 0.440050585744933515959682203718914913":
-float: 1
-ifloat: 1
-Test "j1 (1.5) == 0.557936507910099641990121213156089400":
-float: 1
-ifloat: 1
-Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "j1 (2.0) == 0.576724807756873387202448242269137087":
-float: 1
-ifloat: 1
-Test "j1 (8.0) == 0.234636346853914624381276651590454612":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# jn
-Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "jn (0, 1.5) == 0.511827671735918128749051744283411720":
-float: 1
-ifloat: 1
-Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 1
-idouble: 1
-Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
-float: 1
-ifloat: 1
-Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
-float: 1
-ifloat: 1
-Test "jn (1, 1.5) == 0.557936507910099641990121213156089400":
-float: 1
-ifloat: 1
-Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
-float: 1
-ifloat: 1
-Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
-float: 1
-ifloat: 1
-Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
-float: 2
-ifloat: 2
-ildouble: 2
-ldouble: 2
-Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-ildouble: 2
-ldouble: 2
-Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
-ildouble: 1
-ldouble: 1
-
-# lgamma
-Test "lgamma (-0.5) == log(2*sqrt(pi))":
-ildouble: 1
-ldouble: 1
-Test "lgamma (0.5) == log(sqrt(pi))":
-ildouble: 1
-ldouble: 1
-Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "lgamma (3) == M_LN2l":
-ildouble: 1
-ldouble: 1
-
-# log
-Test "log (0.75) == -0.287682072451780927439219005993827432":
-ildouble: 1
-ldouble: 1
-Test "log (2) == M_LN2l":
-ildouble: 1
-ldouble: 1
-Test "log (e) == 1":
-float: 1
-ifloat: 1
-
-# log10
-Test "log10 (0.75) == -0.124938736608299953132449886193870744":
-ildouble: 2
-ldouble: 2
-Test "log10 (e) == log10(e)":
-float: 1
-ifloat: 1
-
-# log1p
-Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
-ildouble: 1
-ldouble: 1
-
-# log2
-Test "log2 (0.75) == -.415037499278843818546261056052183492":
-ildouble: 1
-ldouble: 1
-
-# pow
-Test "pow (0.75, 1.25) == 0.697953644326574699205914060237425566":
-ildouble: 1
-ldouble: 1
-
-# sincos
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# sinh
-Test "sinh (0.75) == 0.822316731935829980703661634446913849":
-ildouble: 1
-ldouble: 1
-
-# tan
-Test "tan (0.75) == 0.931596459944072461165202756573936428":
-ildouble: 1
-ldouble: 1
-Test "tan (pi/4) == 1":
-double: 1
-idouble: 1
-
-# tgamma
-Test "tgamma (-0.5) == -2 sqrt (pi)":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "tgamma (0.5) == sqrt (pi)":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "tgamma (4) == 6":
-ildouble: 1
-ldouble: 1
-
-# y0
-Test "y0 (0.125) == -1.38968062514384052915582277745018693":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "y0 (0.75) == -0.137172769385772397522814379396581855":
-double: 1
-idouble: 1
-ildouble: 2
-ldouble: 2
-Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
-ildouble: 1
-ldouble: 1
-Test "y0 (1.5) == 0.382448923797758843955068554978089862":
-ildouble: 1
-ldouble: 1
-Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
-ildouble: 1
-ldouble: 1
-Test "y0 (2.0) == 0.510375672649745119596606592727157873":
-float: 1
-ifloat: 1
-Test "y0 (8.0) == 0.223521489387566220527323400498620359":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-# y1
-Test "y1 (0.125) == -5.19993611253477499595928744876579921":
-ildouble: 1
-ldouble: 1
-Test "y1 (1.0) == -0.781212821300288716547150000047964821":
-double: 1
-idouble: 1
-Test "y1 (10.0) == 0.249015424206953883923283474663222803":
-float: 1
-ifloat: 1
-Test "y1 (2.0) == -0.107032431540937546888370772277476637":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "y1 (8.0) == -0.158060461731247494255555266187483550":
-ildouble: 1
-ldouble: 1
-
-# yn
-Test "yn (0, 0.125) == -1.38968062514384052915582277745018693":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "yn (0, 0.75) == -0.137172769385772397522814379396581855":
-double: 1
-idouble: 1
-ildouble: 2
-ldouble: 2
-Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
-ildouble: 1
-ldouble: 1
-Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
-ildouble: 1
-ldouble: 1
-Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
-ildouble: 1
-ldouble: 1
-Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
-float: 1
-ifloat: 1
-Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
-float: 1
-ifloat: 1
-Test "yn (1, 1.0) == -0.781212821300288716547150000047964821":
-double: 1
-idouble: 1
-Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
-float: 1
-ifloat: 1
-Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
-ildouble: 1
-ldouble: 1
-Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
-double: 1
-idouble: 1
-ildouble: 2
-ldouble: 2
-Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
-float: 1
-ifloat: 1
-ildouble: 4
-ldouble: 4
-Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
-ildouble: 1
-ldouble: 1
-Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
-float: 1
-ifloat: 1
-
-# Maximal error of functions:
-Function: "acosh":
-ildouble: 1
-ldouble: 1
-
-Function: "asinh":
-ildouble: 1
-ldouble: 1
-
-Function: "atan2":
-ildouble: 1
-ldouble: 1
-
-Function: "atanh":
-ildouble: 1
-ldouble: 1
-
-Function: Real part of "cacos":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "cacos":
-float: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-Function: Real part of "cacosh":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-ildouble: 6
-ldouble: 6
-
-Function: Imaginary part of "cacosh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-Function: Real part of "casin":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-ildouble: 3
-ldouble: 3
-
-Function: Imaginary part of "casin":
-float: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-Function: Real part of "casinh":
-double: 6
-float: 19
-idouble: 6
-ifloat: 19
-ildouble: 5
-ldouble: 5
-
-Function: Imaginary part of "casinh":
-double: 13
-float: 1
-idouble: 13
-ifloat: 1
-ildouble: 6
-ldouble: 6
-
-Function: Real part of "catan":
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "catan":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "catanh":
-ildouble: 1
-ldouble: 1
-
-Function: "cbrt":
-ildouble: 1
-ldouble: 1
-
-Function: Real part of "ccos":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "ccos":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Real part of "ccosh":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "ccosh":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Real part of "cexp":
-float: 2
-ifloat: 2
-
-Function: Imaginary part of "cexp":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Real part of "clog":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "clog":
-ildouble: 1
-ldouble: 1
-
-Function: Real part of "clog10":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "clog10":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-Function: "cos":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Real part of "cpow":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-ildouble: 15
-ldouble: 15
-
-Function: Imaginary part of "cpow":
-double: 2
-float: 6
-idouble: 2
-ifloat: 6
-ildouble: 2
-ldouble: 2
-
-Function: Real part of "csin":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "csin":
-float: 1
-ifloat: 1
-
-Function: Real part of "csinh":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "csinh":
-float: 1
-ifloat: 1
-
-Function: Real part of "ctan":
-double: 1
-idouble: 1
-ildouble: 1
-ldouble: 1
-
-Function: Imaginary part of "ctan":
-ildouble: 2
-ldouble: 2
-
-Function: Imaginary part of "ctanh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: "erfc":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: "expm1":
-ildouble: 1
-ldouble: 1
-
-Function: "gamma":
-ildouble: 1
-ldouble: 1
-
-Function: "hypot":
-float: 1
-ifloat: 1
-
-Function: "j0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: "j1":
-float: 2
-ifloat: 2
-ildouble: 1
-ldouble: 1
-
-Function: "jn":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-ildouble: 2
-ldouble: 2
-
-Function: "lgamma":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-ildouble: 1
-ldouble: 1
-
-Function: "log":
-float: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: "log10":
-float: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-Function: "log1p":
-ildouble: 1
-ldouble: 1
-
-Function: "log2":
-ildouble: 1
-ldouble: 1
-
-Function: "pow":
-ildouble: 1
-ldouble: 1
-
-Function: "sincos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: "sinh":
-ildouble: 1
-ldouble: 1
-
-Function: "tan":
-double: 1
-idouble: 1
-ildouble: 1
-ldouble: 1
-
-Function: "tgamma":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 1
-ldouble: 1
-
-Function: "y0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-ildouble: 2
-ldouble: 2
-
-Function: "y1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-ildouble: 1
-ldouble: 1
-
-Function: "yn":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-ildouble: 4
-ldouble: 4
-
-# end of automatic generation
diff --git a/sysdeps/m68k/fpu/mathimpl.h b/sysdeps/m68k/fpu/mathimpl.h
deleted file mode 100644
index bbcaf84859..0000000000
--- a/sysdeps/m68k/fpu/mathimpl.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Definitions of libc internal inline math functions implemented
-   by the m68881/2.
-   Copyright (C) 1991,92,93,94,96,97,98,99 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file contains the definitions of the inline math functions that
-   are only used internally inside libm, not visible to the user.  */
-
-__inline_mathop	(__ieee754_acos, acos)
-__inline_mathop	(__ieee754_asin, asin)
-__inline_mathop	(__ieee754_cosh, cosh)
-__inline_mathop	(__ieee754_sinh, sinh)
-__inline_mathop	(__ieee754_exp, etox)
-__inline_mathop	(__ieee754_exp2, twotox)
-__inline_mathop	(__ieee754_exp10, tentox)
-__inline_mathop	(__ieee754_log10, log10)
-__inline_mathop	(__ieee754_log2, log2)
-__inline_mathop	(__ieee754_log, logn)
-__inline_mathop	(__ieee754_sqrt, sqrt)
-__inline_mathop	(__ieee754_atanh, atanh)
-
-__m81_defun (double, __ieee754_remainder, (double __x, double __y))
-{
-  double __result;
-  __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
-  return __result;
-}
-
-__m81_defun (float, __ieee754_remainderf, (float __x, float __y))
-{
-  float __result;
-  __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
-  return __result;
-}
-
-__m81_defun (long double,
-	     __ieee754_remainderl, (long double __x, long double __y))
-{
-  long double __result;
-  __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
-  return __result;
-}
-
-__m81_defun (double, __ieee754_fmod, (double __x, double __y))
-{
-  double __result;
-  __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
-  return __result;
-}
-
-__m81_defun (float, __ieee754_fmodf, (float __x, float __y))
-{
-  float __result;
-  __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
-  return __result;
-}
-
-__m81_defun (long double,
-	     __ieee754_fmodl, (long double __x, long double __y))
-{
-  long double __result;
-  __asm ("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
-  return __result;
-}
-
-/* Get the m68881 condition codes, to quickly check multiple conditions.  */
-static __inline__ unsigned long
-__m81_test (long double __val)
-{
-  unsigned long __fpsr;
-  __asm ("ftst%.x %1; fmove%.l %/fpsr,%0" : "=dm" (__fpsr) : "f" (__val));
-  return __fpsr;
-}
-
-/* Bit values returned by __m81_test.  */
-#define __M81_COND_NAN  (1 << 24)
-#define __M81_COND_INF  (2 << 24)
-#define __M81_COND_ZERO (4 << 24)
-#define __M81_COND_NEG  (8 << 24)
diff --git a/sysdeps/m68k/fpu/mpa.c b/sysdeps/m68k/fpu/mpa.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/mpa.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/mpatan.c b/sysdeps/m68k/fpu/mpatan.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/mpatan.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/mpatan2.c b/sysdeps/m68k/fpu/mpatan2.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/mpatan2.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/mpexp.c b/sysdeps/m68k/fpu/mpexp.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/mpexp.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/mplog.c b/sysdeps/m68k/fpu/mplog.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/mplog.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/mpsqrt.c b/sysdeps/m68k/fpu/mpsqrt.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/mpsqrt.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/mptan.c b/sysdeps/m68k/fpu/mptan.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/mptan.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/s_atan.c b/sysdeps/m68k/fpu/s_atan.c
deleted file mode 100644
index 8cca490d2a..0000000000
--- a/sysdeps/m68k/fpu/s_atan.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-#ifndef FUNC
-#define FUNC atan
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float_type
-__CONCATX(__,FUNC) (x)
-     float_type x;
-{
-  return __m81_u(__CONCATX(__,FUNC))(x);
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_atanf.c b/sysdeps/m68k/fpu/s_atanf.c
deleted file mode 100644
index c98559a8ba..0000000000
--- a/sysdeps/m68k/fpu/s_atanf.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef FUNC
-#define FUNC atanf
-#endif
-#define float_type float
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_atanl.c b/sysdeps/m68k/fpu/s_atanl.c
deleted file mode 100644
index b7e608addd..0000000000
--- a/sysdeps/m68k/fpu/s_atanl.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef FUNC
-#define FUNC atanl
-#endif
-#define float_type long double
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_ccos.c b/sysdeps/m68k/fpu/s_ccos.c
deleted file mode 100644
index d302d3d86b..0000000000
--- a/sysdeps/m68k/fpu/s_ccos.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Complex cosine function.  m68k fpu version
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-__complex__ float_type
-s(__ccos) (__complex__ float_type x)
-{
-  __complex__ float_type retval;
-  unsigned long rx_cond = __m81_test (__real__ x);
-
-  if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
-    {
-      /* Real part is finite.  */
-      float_type sin_rx, cos_rx;
-
-      __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx)
-	     : "f" (__real__ x));
-      __real__ retval = cos_rx * m81(__ieee754_cosh) (__imag__ x);
-      if (rx_cond & __M81_COND_ZERO)
-	__imag__ retval = (m81(__signbit) (__imag__ x)
-			   ? __real__ x : -__real__ x);
-      else
-	__imag__ retval = -sin_rx * m81(__ieee754_sinh) (__imag__ x);
-    }
-  else
-    {
-      unsigned long ix_cond = __m81_test (__imag__ x);
-
-      if (ix_cond & __M81_COND_INF)
-	__real__ retval = s(fabs) (__imag__ x);
-      else
-	__real__ retval = __real__ x - __real__ x;
-      if (ix_cond & __M81_COND_ZERO)
-	__imag__ retval = __imag__ x;
-      else
-	__imag__ retval = __real__ x - __real__ x;
-    }
-
-  return retval;
-}
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (s(__ccos), s(ccos))
diff --git a/sysdeps/m68k/fpu/s_ccosf.c b/sysdeps/m68k/fpu/s_ccosf.c
deleted file mode 100644
index f5e8a41faf..0000000000
--- a/sysdeps/m68k/fpu/s_ccosf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_ccos.c>
diff --git a/sysdeps/m68k/fpu/s_ccosh.c b/sysdeps/m68k/fpu/s_ccosh.c
deleted file mode 100644
index 1698881b9f..0000000000
--- a/sysdeps/m68k/fpu/s_ccosh.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Complex cosine hyperbole function.  m68k fpu version
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-__complex__ float_type
-s(__ccosh) (__complex__ float_type x)
-{
-  __complex__ float_type retval;
-  unsigned long ix_cond = __m81_test (__imag__ x);
-
-  if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
-    {
-      /* Imaginary part is finite.  */
-      float_type sin_ix, cos_ix;
-
-      __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
-	     : "f" (__imag__ x));
-      __real__ retval = cos_ix * m81(__ieee754_cosh) (__real__ x);
-      if (ix_cond & __M81_COND_ZERO)
-	__imag__ retval = (m81(__signbit) (__real__ x)
-			   ? -__imag__ x : __imag__ x);
-      else
-	__imag__ retval = sin_ix * m81(__ieee754_sinh) (__real__ x);
-    }
-  else
-    {
-      unsigned long rx_cond = __m81_test (__real__ x);
-
-      if (rx_cond & __M81_COND_ZERO)
-	{
-	  __real__ retval = __imag__ x - __imag__ x;
-	  __imag__ retval = __real__ x;
-	}
-      else
-	{
-	  if (rx_cond & __M81_COND_INF)
-	    __real__ retval = s(fabs) (__real__ x);
-	  else
-	    __real__ retval = 0.0/0.0;
-	  __imag__ retval = __imag__ x - __imag__ x;
-	}
-    }
-
-  return retval;
-}
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (s(__ccosh), s(ccosh))
diff --git a/sysdeps/m68k/fpu/s_ccoshf.c b/sysdeps/m68k/fpu/s_ccoshf.c
deleted file mode 100644
index 3c8e7c7bb7..0000000000
--- a/sysdeps/m68k/fpu/s_ccoshf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_ccosh.c>
diff --git a/sysdeps/m68k/fpu/s_ccoshl.c b/sysdeps/m68k/fpu/s_ccoshl.c
deleted file mode 100644
index 772d5786cf..0000000000
--- a/sysdeps/m68k/fpu/s_ccoshl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_ccosh.c>
diff --git a/sysdeps/m68k/fpu/s_ccosl.c b/sysdeps/m68k/fpu/s_ccosl.c
deleted file mode 100644
index aaff365208..0000000000
--- a/sysdeps/m68k/fpu/s_ccosl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_ccos.c>
diff --git a/sysdeps/m68k/fpu/s_ceil.c b/sysdeps/m68k/fpu/s_ceil.c
deleted file mode 100644
index 93d5ad72e5..0000000000
--- a/sysdeps/m68k/fpu/s_ceil.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	ceil
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_ceilf.c b/sysdeps/m68k/fpu/s_ceilf.c
deleted file mode 100644
index b3ba6a5700..0000000000
--- a/sysdeps/m68k/fpu/s_ceilf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	ceilf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_ceill.c b/sysdeps/m68k/fpu/s_ceill.c
deleted file mode 100644
index 2bf95b00c6..0000000000
--- a/sysdeps/m68k/fpu/s_ceill.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC ceill
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_cexp.c b/sysdeps/m68k/fpu/s_cexp.c
deleted file mode 100644
index 4babf12685..0000000000
--- a/sysdeps/m68k/fpu/s_cexp.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Complex exponential function.  m68k fpu version
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-__complex__ float_type
-s(__cexp) (__complex__ float_type x)
-{
-  __complex__ float_type retval;
-  unsigned long ix_cond;
-
-  ix_cond = __m81_test (__imag__ x);
-
-  if ((ix_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
-    {
-      /* Imaginary part is finite.  */
-      float_type exp_val = m81(__ieee754_exp) (__real__ x);
-
-      __real__ retval = __imag__ retval = exp_val;
-      if (m81(__finite) (exp_val))
-	{
-	  float_type sin_ix, cos_ix;
-	  __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
-		 : "f" (__imag__ x));
-	  __real__ retval *= cos_ix;
-	  if (ix_cond & __M81_COND_ZERO)
-	    __imag__ retval = __imag__ x;
-	  else
-	    __imag__ retval *= sin_ix;
-	}
-      else
-	{
-	  /* Compute the sign of the result.  */
-	  float_type remainder, pi_2;
-	  int quadrant;
-
-	  __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
-	  __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
-		 : "=f" (remainder), "=dm" (quadrant)
-		 : "f" (pi_2), "0" (__imag__ x));
-	  quadrant = (quadrant >> 16) & 0x83;
-	  if (quadrant & 0x80)
-	    quadrant ^= 0x83;
-	  switch (quadrant)
-	    {
-	    default:
-	      break;
-	    case 1:
-	      __real__ retval = -__real__ retval;
-	      break;
-	    case 2:
-	      __real__ retval = -__real__ retval;
-	    case 3:
-	      __imag__ retval = -__imag__ retval;
-	      break;
-	    }
-	  if (ix_cond & __M81_COND_ZERO && !m81(__isnan) (exp_val))
-	    __imag__ retval = __imag__ x;
-	}
-    }
-  else
-    {
-      unsigned long rx_cond = __m81_test (__real__ x);
-
-      if (rx_cond & __M81_COND_INF)
-	{
-	  /* Real part is infinite.  */
-	  if (rx_cond & __M81_COND_NEG)
-	    {
-	      __real__ retval = __imag__ retval = 0.0;
-	      if (ix_cond & __M81_COND_NEG)
-		__imag__ retval = -__imag__ retval;
-	    }
-	  else
-	    {
-	      __real__ retval = __real__ x;
-	      __imag__ retval = __imag__ x - __imag__ x;
-	    }
-	}
-      else
-	__real__ retval = __imag__ retval = __imag__ x - __imag__ x;
-    }
-
-  return retval;
-}
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (s(__cexp), s(cexp))
diff --git a/sysdeps/m68k/fpu/s_cexpf.c b/sysdeps/m68k/fpu/s_cexpf.c
deleted file mode 100644
index 177a360f9b..0000000000
--- a/sysdeps/m68k/fpu/s_cexpf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_cexp.c>
diff --git a/sysdeps/m68k/fpu/s_cexpl.c b/sysdeps/m68k/fpu/s_cexpl.c
deleted file mode 100644
index bbda4ba990..0000000000
--- a/sysdeps/m68k/fpu/s_cexpl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_cexp.c>
diff --git a/sysdeps/m68k/fpu/s_cos.c b/sysdeps/m68k/fpu/s_cos.c
deleted file mode 100644
index 9c96076316..0000000000
--- a/sysdeps/m68k/fpu/s_cos.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	cos
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_cosf.c b/sysdeps/m68k/fpu/s_cosf.c
deleted file mode 100644
index db965b8cc1..0000000000
--- a/sysdeps/m68k/fpu/s_cosf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	cosf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_cosl.c b/sysdeps/m68k/fpu/s_cosl.c
deleted file mode 100644
index 4198feef18..0000000000
--- a/sysdeps/m68k/fpu/s_cosl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC cosl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_csin.c b/sysdeps/m68k/fpu/s_csin.c
deleted file mode 100644
index 7c590e4af6..0000000000
--- a/sysdeps/m68k/fpu/s_csin.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Complex sine function.  m68k fpu version
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-__complex__ float_type
-s(__csin) (__complex__ float_type x)
-{
-  __complex__ float_type retval;
-  unsigned long rx_cond = __m81_test (__real__ x);
-
-  if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
-    {
-      /* Real part is finite.  */
-      float_type sin_rx, cos_rx;
-
-      __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx)
-	     : "f" (__real__ x));
-      if (rx_cond & __M81_COND_ZERO)
-	__real__ retval = __real__ x;
-      else
-	__real__ retval = sin_rx * m81(__ieee754_cosh) (__imag__ x);
-      __imag__ retval = cos_rx * m81(__ieee754_sinh) (__imag__ x);
-    }
-  else
-    {
-      unsigned long ix_cond = __m81_test (__imag__ x);
-
-      __real__ retval = __real__ x - __real__ x;
-      if (ix_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN))
-	__imag__ retval = __imag__ x;
-      else
-	__imag__ retval = __real__ retval;
-    }
-
-  return retval;
-}
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (s(__csin), s(csin))
diff --git a/sysdeps/m68k/fpu/s_csinf.c b/sysdeps/m68k/fpu/s_csinf.c
deleted file mode 100644
index b760e192c3..0000000000
--- a/sysdeps/m68k/fpu/s_csinf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_csin.c>
diff --git a/sysdeps/m68k/fpu/s_csinh.c b/sysdeps/m68k/fpu/s_csinh.c
deleted file mode 100644
index dafb82af1a..0000000000
--- a/sysdeps/m68k/fpu/s_csinh.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Complex sine hyperbole function.  m68k fpu version
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <complex.h>
-#include <math.h>
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-__complex__ float_type
-s(__csinh) (__complex__ float_type x)
-{
-  __complex__ float_type retval;
-  unsigned long ix_cond;
-
-  ix_cond = __m81_test (__imag__ x);
-
-  if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
-    {
-      /* Imaginary part is finite.  */
-      float_type sin_ix, cos_ix;
-
-      __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
-	     : "f" (__imag__ x));
-      __real__ retval = cos_ix * m81(__ieee754_sinh) (__real__ x);
-      if (ix_cond & __M81_COND_ZERO)
-	__imag__ retval = __imag__ x;
-      else
-	__imag__ retval = sin_ix * m81(__ieee754_cosh) (__real__ x);
-    }
-  else
-    {
-      unsigned long rx_cond = __m81_test (__real__ x);
-
-      __imag__ retval = __imag__ x - __imag__ x;
-      if (rx_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN))
-	__real__ retval = __real__ x;
-      else
-	__real__ retval = __imag__ retval;
-    }
-
-  return retval;
-}
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (s(__csinh), s(csinh))
diff --git a/sysdeps/m68k/fpu/s_csinhf.c b/sysdeps/m68k/fpu/s_csinhf.c
deleted file mode 100644
index 2f7a43e6a8..0000000000
--- a/sysdeps/m68k/fpu/s_csinhf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_csinh.c>
diff --git a/sysdeps/m68k/fpu/s_csinhl.c b/sysdeps/m68k/fpu/s_csinhl.c
deleted file mode 100644
index 026a20e7be..0000000000
--- a/sysdeps/m68k/fpu/s_csinhl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_csinh.c>
diff --git a/sysdeps/m68k/fpu/s_csinl.c b/sysdeps/m68k/fpu/s_csinl.c
deleted file mode 100644
index ea2dad0556..0000000000
--- a/sysdeps/m68k/fpu/s_csinl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_csin.c>
diff --git a/sysdeps/m68k/fpu/s_expm1.c b/sysdeps/m68k/fpu/s_expm1.c
deleted file mode 100644
index 1ef99e21c9..0000000000
--- a/sysdeps/m68k/fpu/s_expm1.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	expm1
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_expm1f.c b/sysdeps/m68k/fpu/s_expm1f.c
deleted file mode 100644
index 84935b1b4a..0000000000
--- a/sysdeps/m68k/fpu/s_expm1f.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	expm1f
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_expm1l.c b/sysdeps/m68k/fpu/s_expm1l.c
deleted file mode 100644
index feee07a1d8..0000000000
--- a/sysdeps/m68k/fpu/s_expm1l.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC expm1l
-#include <s_atanl.c>
-libm_hidden_def (__expm1l)
diff --git a/sysdeps/m68k/fpu/s_fabs.c b/sysdeps/m68k/fpu/s_fabs.c
deleted file mode 100644
index 1f0631e2ff..0000000000
--- a/sysdeps/m68k/fpu/s_fabs.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	fabs
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_fabsf.c b/sysdeps/m68k/fpu/s_fabsf.c
deleted file mode 100644
index 8f9421998a..0000000000
--- a/sysdeps/m68k/fpu/s_fabsf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	fabsf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_fabsl.c b/sysdeps/m68k/fpu/s_fabsl.c
deleted file mode 100644
index 8ac14d5b8c..0000000000
--- a/sysdeps/m68k/fpu/s_fabsl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC fabsl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_finite.c b/sysdeps/m68k/fpu/s_finite.c
deleted file mode 100644
index dafbd5901d..0000000000
--- a/sysdeps/m68k/fpu/s_finite.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	finite
-#include <s_isinf.c>
diff --git a/sysdeps/m68k/fpu/s_finitef.c b/sysdeps/m68k/fpu/s_finitef.c
deleted file mode 100644
index b81342e5c6..0000000000
--- a/sysdeps/m68k/fpu/s_finitef.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	finitef
-#include <s_isinff.c>
diff --git a/sysdeps/m68k/fpu/s_finitel.c b/sysdeps/m68k/fpu/s_finitel.c
deleted file mode 100644
index bd346a220c..0000000000
--- a/sysdeps/m68k/fpu/s_finitel.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC finitel
-#include <s_isinfl.c>
diff --git a/sysdeps/m68k/fpu/s_floor.c b/sysdeps/m68k/fpu/s_floor.c
deleted file mode 100644
index e1219c602a..0000000000
--- a/sysdeps/m68k/fpu/s_floor.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	floor
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_floorf.c b/sysdeps/m68k/fpu/s_floorf.c
deleted file mode 100644
index f4f9b9a1d8..0000000000
--- a/sysdeps/m68k/fpu/s_floorf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	floorf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_floorl.c b/sysdeps/m68k/fpu/s_floorl.c
deleted file mode 100644
index 2c1ffd7d2c..0000000000
--- a/sysdeps/m68k/fpu/s_floorl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC floorl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_fpclassifyl.c b/sysdeps/m68k/fpu/s_fpclassifyl.c
deleted file mode 100644
index a8cb099927..0000000000
--- a/sysdeps/m68k/fpu/s_fpclassifyl.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Return classification value corresponding to argument.  m68k version.
-   Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-   Fixed for m68k by Andreas Schwab <schwab@suse.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-#include "math_private.h"
-
-
-int
-__fpclassifyl (long double x)
-{
-  u_int32_t ex, hx, lx;
-  int retval = FP_NORMAL;
-
-  GET_LDOUBLE_WORDS (ex, hx, lx, x);
-  ex &= 0x7fff;
-  if ((ex | hx | lx) == 0)
-    retval = FP_ZERO;
-  else if (ex == 0 && (hx & 0x80000000) == 0)
-    retval = FP_SUBNORMAL;
-  else if (ex == 0x7fff)
-    retval = ((hx & 0x7fffffff) | lx) != 0 ? FP_NAN : FP_INFINITE;
-
-  return retval;
-}
-libm_hidden_def (__fpclassifyl)
diff --git a/sysdeps/m68k/fpu/s_frexp.c b/sysdeps/m68k/fpu/s_frexp.c
deleted file mode 100644
index b06141283c..0000000000
--- a/sysdeps/m68k/fpu/s_frexp.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-#ifndef FUNC
-#define FUNC frexp
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float_type
-__CONCATX(__,FUNC) (float_type value, int *expptr)
-{
-  float_type mantissa, exponent;
-  int iexponent;
-  unsigned long fpsr;
-
-  __asm ("ftst%.x %1\n"
-	 "fmove%.l %/fpsr, %0"
-	 : "=dm" (fpsr) : "f" (value));
-  if (fpsr & (7 << 24))
-    {
-      /* Not finite or zero.  */
-      *expptr = 0;
-      return value;
-    }
-  __asm ("fgetexp%.x %1, %0" : "=f" (exponent) : "f" (value));
-  iexponent = (int) exponent + 1;
-  *expptr = iexponent;
-  __asm ("fscale%.l %2, %0"
-	 : "=f" (mantissa)
-	 : "0" (value), "dmi" (-iexponent));
-  return mantissa;
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_frexpf.c b/sysdeps/m68k/fpu/s_frexpf.c
deleted file mode 100644
index 893b6ad3cf..0000000000
--- a/sysdeps/m68k/fpu/s_frexpf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC frexpf
-#define float_type float
-#include <s_frexp.c>
diff --git a/sysdeps/m68k/fpu/s_frexpl.c b/sysdeps/m68k/fpu/s_frexpl.c
deleted file mode 100644
index f9a5315265..0000000000
--- a/sysdeps/m68k/fpu/s_frexpl.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-long double
-__frexpl (long double value, int *expptr)
-{
-  long double mantissa, exponent;
-  int iexponent;
-  unsigned long fpsr;
-
-  __asm ("ftst%.x %1\n"
-	 "fmove%.l %/fpsr, %0"
-	 : "=dm" (fpsr) : "f" (value));
-  if (fpsr & (7 << 24))
-    {
-      /* Not finite or zero.  */
-      *expptr = 0;
-      return value;
-    }
-  __asm ("fgetexp%.x %1, %0" : "=f" (exponent) : "f" (value));
-  iexponent = (int) exponent + 1;
-  *expptr = iexponent;
-  /* Unnormalized numbers must be handled specially, otherwise fscale
-     results in overflow.  */
-  if (iexponent <= -16384)
-    {
-      value *= 0x1p16383L;
-      iexponent += 16383;
-    }
-  else if (iexponent >= 16384)
-    {
-      value *= 0x1p-16383L;
-      iexponent -= 16383;
-    }
-
-  __asm ("fscale%.l %2, %0"
-	 : "=f" (mantissa)
-	 : "0" (value), "dmi" (-iexponent));
-  return mantissa;
-}
-
-weak_alias (__frexpl, frexpl)
diff --git a/sysdeps/m68k/fpu/s_ilogb.c b/sysdeps/m68k/fpu/s_ilogb.c
deleted file mode 100644
index ee1e3975f0..0000000000
--- a/sysdeps/m68k/fpu/s_ilogb.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-int
-s(__ilogb) (float_type x)
-{
-  float_type result;
-  unsigned long x_cond;
-
-  x_cond = __m81_test (x);
-  /* We must return consistent values for zero and NaN.  */
-  if (x_cond & __M81_COND_ZERO)
-    return FP_ILOGB0;
-  if (x_cond & (__M81_COND_NAN | __M81_COND_INF))
-    return FP_ILOGBNAN;
-
-  __asm ("fgetexp%.x %1, %0" : "=f" (result) : "f" (x));
-  return (int) result;
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (s(__ilogb), s(ilogb))
diff --git a/sysdeps/m68k/fpu/s_ilogbf.c b/sysdeps/m68k/fpu/s_ilogbf.c
deleted file mode 100644
index 4031c42ff7..0000000000
--- a/sysdeps/m68k/fpu/s_ilogbf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_ilogb.c>
diff --git a/sysdeps/m68k/fpu/s_ilogbl.c b/sysdeps/m68k/fpu/s_ilogbl.c
deleted file mode 100644
index 9c55a115e0..0000000000
--- a/sysdeps/m68k/fpu/s_ilogbl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_ilogb.c>
diff --git a/sysdeps/m68k/fpu/s_isinf.c b/sysdeps/m68k/fpu/s_isinf.c
deleted file mode 100644
index 5fb43ea2a0..0000000000
--- a/sysdeps/m68k/fpu/s_isinf.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-#ifndef FUNC
-#define FUNC isinf
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-int
-__CONCATX(__,FUNC) (x)
-     float_type x;
-{
-  return __m81_u(__CONCATX(__,FUNC))(x);
-}
-
-#define hidden_defx(a) hidden_def(a)
-hidden_defx(__CONCATX(__,FUNC))
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_isinff.c b/sysdeps/m68k/fpu/s_isinff.c
deleted file mode 100644
index ebf4f2ae96..0000000000
--- a/sysdeps/m68k/fpu/s_isinff.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef FUNC
-#define FUNC isinff
-#endif
-#define float_type float
-#include <s_isinf.c>
diff --git a/sysdeps/m68k/fpu/s_isinfl.c b/sysdeps/m68k/fpu/s_isinfl.c
deleted file mode 100644
index 963725ad77..0000000000
--- a/sysdeps/m68k/fpu/s_isinfl.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef FUNC
-#define FUNC isinfl
-#endif
-#define float_type long double
-#include <s_isinf.c>
diff --git a/sysdeps/m68k/fpu/s_isnan.c b/sysdeps/m68k/fpu/s_isnan.c
deleted file mode 100644
index 151d6dc6b4..0000000000
--- a/sysdeps/m68k/fpu/s_isnan.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	isnan
-#include <s_isinf.c>
diff --git a/sysdeps/m68k/fpu/s_isnanf.c b/sysdeps/m68k/fpu/s_isnanf.c
deleted file mode 100644
index 667bca7235..0000000000
--- a/sysdeps/m68k/fpu/s_isnanf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	isnanf
-#include <s_isinff.c>
diff --git a/sysdeps/m68k/fpu/s_isnanl.c b/sysdeps/m68k/fpu/s_isnanl.c
deleted file mode 100644
index bbacb64f11..0000000000
--- a/sysdeps/m68k/fpu/s_isnanl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC isnanl
-#include <s_isinfl.c>
diff --git a/sysdeps/m68k/fpu/s_llrint.c b/sysdeps/m68k/fpu/s_llrint.c
deleted file mode 100644
index 8f2442982a..0000000000
--- a/sysdeps/m68k/fpu/s_llrint.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Round argument to nearest integral value according to current rounding
-   direction.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-long long int
-__llrint (double x)
-{
-  int32_t e;
-  u_int32_t h, l, s;
-  long long int result;
-
-  x = __m81_u(__rint) (x);
-
-  /* We could use __fixxfdi from libgcc, but here we can take advantage of
-     the known floating point format.  */
-  EXTRACT_WORDS (h, l, x);
-
-  e = ((h >> 20) & 0x7ff) - 0x3ff;
-  if (e < 0)
-    return 0;
-  s = h;
-  h &= 0xfffff;
-  h |= 0x100000;
-
-  if (e < 63)
-    {
-      if (e > 52)
-	{
-	  h <<= e - 52;
-	  h |= l >> (84 - e);
-	  l <<= e - 52;
-	  result = ((long long int) h << 32) | l;
-	}
-      else if (e > 20)
-	{
-	  l >>= 52 - e;
-	  l |= h << (e - 20);
-	  h >>= 52 - e;
-	  result = ((long long int) h << 32) | l;
-	}
-      else
-	result = h >> (20 - e);
-      if (s & 0x80000000)
-	result = -result;
-    }
-  else
-    /* The number is too large or not finite.  The standard leaves it
-       undefined what to return when the number is too large to fit in a
-       `long long int'.  */
-    result = -1LL;
-
-  return result;
-}
-
-weak_alias (__llrint, llrint)
diff --git a/sysdeps/m68k/fpu/s_llrintf.c b/sysdeps/m68k/fpu/s_llrintf.c
deleted file mode 100644
index bd573b2579..0000000000
--- a/sysdeps/m68k/fpu/s_llrintf.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Round argument to nearest integral value according to current rounding
-   direction.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-long long int
-__llrintf (float x)
-{
-  int32_t e;
-  u_int32_t i, s;
-  long long int result;
-
-  x = __m81_u(__rintf) (x);
-
-  GET_FLOAT_WORD (i, x);
-
-  e = ((i >> 23) & 0xff) - 0x7f;
-  if (e < 0)
-    return 0;
-  s = i;
-  i &= 0x7fffff;
-  i |= 0x800000;
-
-  if (e < 63)
-    {
-      if (e > 55)
-	result = (long long int) (i << (e - 55)) << 32;
-      else if (e > 31)
-	result = (((long long int) (i >> (55 - e)) << 32) | (i << (e - 23)));
-      else if (e > 23)
-	result = i << (e - 23);
-      else
-	result = i >> (23 - e);
-      if (s & 0x80000000)
-	result = -result;
-    }
-  else
-    /* The number is too large or not finite.  The standard leaves it
-       undefined what to return when the number is too large to fit in a
-       `long long int'.  */
-    result = -1LL;
-
-  return result;
-}
-
-weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/m68k/fpu/s_llrintl.c b/sysdeps/m68k/fpu/s_llrintl.c
deleted file mode 100644
index d749f3515f..0000000000
--- a/sysdeps/m68k/fpu/s_llrintl.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Round argument to nearest integral value according to current rounding
-   direction.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "math_private.h"
-#include "mathimpl.h"
-
-long long int
-__llrintl (long double x)
-{
-  int32_t e, s;
-  u_int32_t h, l;
-  long long int result;
-
-  x = __m81_u(__rintl) (x);
-
-  GET_LDOUBLE_WORDS (e, h, l, x);
-
-  s = e;
-  e = (e & 0x7fff) - 0x3fff;
-  if (e < 0)
-    return 0;
-
-  if (e < 63)
-    {
-      if (e > 31)
-	{
-	  l >>= 63 - e;
-	  l |= h << (e - 31);
-	  h >>= 63 - e;
-	  result = ((long long int) h << 32) | l;
-	}
-      else
-	result = h >> (31 - e);
-      if (s & 0x8000)
-	result = -result;
-    }
-  else
-    /* The number is too large or not finite.  The standard leaves it
-       undefined what to return when the number is too large to fit in a
-       `long long int'.  */
-    result = -1LL;
-
-  return result;
-}
-
-weak_alias (__llrintl, llrintl)
diff --git a/sysdeps/m68k/fpu/s_log1p.c b/sysdeps/m68k/fpu/s_log1p.c
deleted file mode 100644
index 1840ced137..0000000000
--- a/sysdeps/m68k/fpu/s_log1p.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	log1p
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_log1pf.c b/sysdeps/m68k/fpu/s_log1pf.c
deleted file mode 100644
index cb7235a071..0000000000
--- a/sysdeps/m68k/fpu/s_log1pf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	log1pf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_log1pl.c b/sysdeps/m68k/fpu/s_log1pl.c
deleted file mode 100644
index 8dbef89095..0000000000
--- a/sysdeps/m68k/fpu/s_log1pl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC log1pl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_lrint.c b/sysdeps/m68k/fpu/s_lrint.c
deleted file mode 100644
index 0a23f29eeb..0000000000
--- a/sysdeps/m68k/fpu/s_lrint.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Round argument to nearest integral value according to current rounding
-   direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-#ifndef suffix
-#define suffix /*empty*/
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-
-long int
-CONCATX(__lrint,suffix) (float_type x)
-{
-  return __m81_u(CONCATX(__lrint,suffix)) (x);
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (CONCATX(__lrint,suffix), CONCATX(lrint,suffix))
diff --git a/sysdeps/m68k/fpu/s_lrintf.c b/sysdeps/m68k/fpu/s_lrintf.c
deleted file mode 100644
index 44924cb82f..0000000000
--- a/sysdeps/m68k/fpu/s_lrintf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define suffix f
-#define float_type float
-#include <s_lrint.c>
diff --git a/sysdeps/m68k/fpu/s_lrintl.c b/sysdeps/m68k/fpu/s_lrintl.c
deleted file mode 100644
index cd0bd23b8a..0000000000
--- a/sysdeps/m68k/fpu/s_lrintl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define suffix l
-#define float_type long double
-#include <s_lrint.c>
diff --git a/sysdeps/m68k/fpu/s_modf.c b/sysdeps/m68k/fpu/s_modf.c
deleted file mode 100644
index 2f5a83dea7..0000000000
--- a/sysdeps/m68k/fpu/s_modf.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "mathimpl.h"
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-#define m81(func) __m81_u(s(func))
-
-float_type
-s(__modf) (float_type x, float_type *iptr)
-{
-  float_type x_int, result;
-  unsigned long x_cond;
-
-  __asm ("fintrz%.x %1, %0" : "=f" (x_int) : "f" (x));
-  *iptr = x_int;
-  x_cond = __m81_test (x);
-  if (x_cond & __M81_COND_INF)
-    {
-      result = 0;
-      if (x_cond & __M81_COND_NEG)
-	result = -result;
-    }
-  else if (x_cond & __M81_COND_ZERO)
-    result = x;
-  else
-    result = x - x_int;
-  return result;
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx(s(__modf), s(modf))
diff --git a/sysdeps/m68k/fpu/s_modff.c b/sysdeps/m68k/fpu/s_modff.c
deleted file mode 100644
index 0c44d7c0ab..0000000000
--- a/sysdeps/m68k/fpu/s_modff.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_modf.c>
diff --git a/sysdeps/m68k/fpu/s_modfl.c b/sysdeps/m68k/fpu/s_modfl.c
deleted file mode 100644
index c7075b3ba9..0000000000
--- a/sysdeps/m68k/fpu/s_modfl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_modf.c>
diff --git a/sysdeps/m68k/fpu/s_nearbyint.c b/sysdeps/m68k/fpu/s_nearbyint.c
deleted file mode 100644
index b87f5e2160..0000000000
--- a/sysdeps/m68k/fpu/s_nearbyint.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC nearbyint
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_nearbyintf.c b/sysdeps/m68k/fpu/s_nearbyintf.c
deleted file mode 100644
index 70d08ab44c..0000000000
--- a/sysdeps/m68k/fpu/s_nearbyintf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC nearbyintf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_nearbyintl.c b/sysdeps/m68k/fpu/s_nearbyintl.c
deleted file mode 100644
index 230cd7784c..0000000000
--- a/sysdeps/m68k/fpu/s_nearbyintl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC nearbyintl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_nextafterl.c b/sysdeps/m68k/fpu/s_nextafterl.c
deleted file mode 100644
index 70ab5a4784..0000000000
--- a/sysdeps/m68k/fpu/s_nextafterl.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* s_nextafterl.c -- long double version of s_nextafter.c.
- * Conversion to long double by Ulrich Drepper,
- * Cygnus Support, drepper@cygnus.com.
- * Fixed for m68k by Andreas Schwab <schwab@suse.de>.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: $";
-#endif
-
-/* IEEE functions
- *	nextafterl(x,y)
- *	return the next machine floating-point number of x in the
- *	direction toward y.
- *   Special cases:
- */
-
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-	long double __nextafterl(long double x, long double y)
-#else
-	long double __nextafterl(x,y)
-	long double x,y;
-#endif
-{
-	int32_t ix,iy,esx,esy;
-	u_int32_t hx,hy,lx,ly;
-
-	GET_LDOUBLE_WORDS(esx,hx,lx,x);
-	GET_LDOUBLE_WORDS(esy,hy,ly,y);
-	ix = esx&0x7fff;		/* |x| */
-	iy = esy&0x7fff;		/* |y| */
-
-	if(((ix==0x7fff)&&((hx&0x7fffffff)|lx)!=0) ||   /* x is nan */
-	   ((iy==0x7fff)&&((hy&0x7fffffff)|ly)!=0))     /* y is nan */
-	   return x+y;
-	if(x==y) return y;		/* x=y, return y */
-	if((ix|hx|lx)==0) {			/* x == 0 */
-	    SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
-	}
-	if(esx>=0) {			/* x > 0 */
-	    if(esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))) {
-	      /* x > y, x -= ulp */
-		if(lx==0) {
-		    if (ix != 0 && hx == 0x80000000) hx = 0;
-		    if (hx==0) esx -= 1;
-		    hx -= 1;
-		}
-		lx -= 1;
-	    } else {				/* x < y, x += ulp */
-		lx += 1;
-		if(lx==0) {
-		    hx += 1;
-		    if (hx==0) {
-			hx = 0x80000000;
-			esx += 1;
-		    }
-		}
-	    }
-	} else {				/* x < 0 */
-	    if(esy>=0||esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))){
-	      /* x < y, x -= ulp */
-		if(lx==0) {
-		    if (ix != 0 && hx == 0x80000000) hx = 0;
-		    if (hx==0) esx -= 1;
-		    hx -= 1;
-		}
-		lx -= 1;
-	    } else {				/* x > y, x += ulp */
-		lx += 1;
-		if(lx==0) {
-		    hx += 1;
-		    if (hx==0) {
-			hx = 0x80000000;
-			esx += 1;
-		    }
-		}
-	    }
-	}
-	esy = esx&0x7fff;
-	if(esy==0x7fff) return x+x;	/* overflow  */
-	if(esy==0 && (hx & 0x80000000) == 0) { /* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        SET_LDOUBLE_WORDS(y,esx,hx,lx);
-		return y;
-	    }
-	}
-	SET_LDOUBLE_WORDS(x,esx,hx,lx);
-	return x;
-}
-weak_alias (__nextafterl, nextafterl)
-strong_alias (__nextafterl, __nexttowardl)
-weak_alias (__nextafterl, nexttowardl)
diff --git a/sysdeps/m68k/fpu/s_remquo.c b/sysdeps/m68k/fpu/s_remquo.c
deleted file mode 100644
index 5b65f85fbc..0000000000
--- a/sysdeps/m68k/fpu/s_remquo.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Compute remainder and a congruent to the quotient.  m68k fpu version
-   Copyright (C) 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
-
-float_type
-s(__remquo) (float_type x, float_type y, int *quo)
-{
-  float_type result;
-  int cquo, fpsr;
-
-  __asm ("frem%.x %2,%0\n\tfmove%.l %/fpsr,%1"
-	 : "=f" (result), "=dm" (fpsr) : "f" (y), "0" (x));
-  cquo = (fpsr >> 16) & 0x7f;
-  if (fpsr & (1 << 23))
-    cquo = -cquo;
-  *quo = cquo;
-  return result;
-}
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (s(__remquo), s(remquo))
diff --git a/sysdeps/m68k/fpu/s_remquof.c b/sysdeps/m68k/fpu/s_remquof.c
deleted file mode 100644
index 8a292fc26c..0000000000
--- a/sysdeps/m68k/fpu/s_remquof.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_remquo.c>
diff --git a/sysdeps/m68k/fpu/s_remquol.c b/sysdeps/m68k/fpu/s_remquol.c
deleted file mode 100644
index d236cfd1f9..0000000000
--- a/sysdeps/m68k/fpu/s_remquol.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_remquo.c>
diff --git a/sysdeps/m68k/fpu/s_rint.c b/sysdeps/m68k/fpu/s_rint.c
deleted file mode 100644
index f0f18c7346..0000000000
--- a/sysdeps/m68k/fpu/s_rint.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	rint
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_rintf.c b/sysdeps/m68k/fpu/s_rintf.c
deleted file mode 100644
index 4e00cab0fb..0000000000
--- a/sysdeps/m68k/fpu/s_rintf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	rintf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_rintl.c b/sysdeps/m68k/fpu/s_rintl.c
deleted file mode 100644
index 305667b3a1..0000000000
--- a/sysdeps/m68k/fpu/s_rintl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC rintl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_scalbln.c b/sysdeps/m68k/fpu/s_scalbln.c
deleted file mode 100644
index 1009713fbc..0000000000
--- a/sysdeps/m68k/fpu/s_scalbln.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Nothing to do.  This function is the same as scalbn.  So we define an
-   alias.  */
diff --git a/sysdeps/m68k/fpu/s_scalblnf.c b/sysdeps/m68k/fpu/s_scalblnf.c
deleted file mode 100644
index 5e558c3540..0000000000
--- a/sysdeps/m68k/fpu/s_scalblnf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Nothing to do.  This function is the same as scalbnf.  So we define an
-   alias.  */
diff --git a/sysdeps/m68k/fpu/s_scalblnl.c b/sysdeps/m68k/fpu/s_scalblnl.c
deleted file mode 100644
index cda2ec11c8..0000000000
--- a/sysdeps/m68k/fpu/s_scalblnl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Nothing to do.  This function is the same as scalbnl.  So we define an
-   alias.  */
diff --git a/sysdeps/m68k/fpu/s_scalbn.c b/sysdeps/m68k/fpu/s_scalbn.c
deleted file mode 100644
index d76d94d946..0000000000
--- a/sysdeps/m68k/fpu/s_scalbn.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define scalbln __no_scalbln_decl
-#define scalblnf __no_scalblnf_decl
-#define scalblnl __no_scalblnl_decl
-#define __scalbln __no__scalbln_decl
-#define __scalblnf __no__scalblnf_decl
-#define __scalblnl __no__scalblnl_decl
-#include <math.h>
-#undef scalbln
-#undef scalblnf
-#undef scalblnl
-#undef __scalbln
-#undef __scalblnf
-#undef __scalblnl
-
-#ifndef suffix
-#define suffix /*empty*/
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float_type
-__CONCATX(__scalbn,suffix) (x, exp)
-     float_type x;
-     int exp;
-{
-  return __m81_u(__CONCATX(__scalbn,suffix))(x, exp);
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-#define strong_aliasx(a,b) strong_alias(a,b)
-weak_aliasx (__CONCATX(__scalbn,suffix), __CONCATX(scalbn,suffix))
-strong_aliasx (__CONCATX(__scalbn,suffix), __CONCATX(__scalbln,suffix))
-weak_aliasx (__CONCATX(__scalbn,suffix), __CONCATX(scalbln,suffix))
diff --git a/sysdeps/m68k/fpu/s_scalbnf.c b/sysdeps/m68k/fpu/s_scalbnf.c
deleted file mode 100644
index 547971836a..0000000000
--- a/sysdeps/m68k/fpu/s_scalbnf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define suffix f
-#define float_type float
-#include <s_scalbn.c>
diff --git a/sysdeps/m68k/fpu/s_scalbnl.c b/sysdeps/m68k/fpu/s_scalbnl.c
deleted file mode 100644
index 874bafb04b..0000000000
--- a/sysdeps/m68k/fpu/s_scalbnl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define suffix l
-#define float_type long double
-#include <s_scalbn.c>
diff --git a/sysdeps/m68k/fpu/s_significand.c b/sysdeps/m68k/fpu/s_significand.c
deleted file mode 100644
index 34d4ea3d14..0000000000
--- a/sysdeps/m68k/fpu/s_significand.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	significand
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_significandf.c b/sysdeps/m68k/fpu/s_significandf.c
deleted file mode 100644
index 4e769ca317..0000000000
--- a/sysdeps/m68k/fpu/s_significandf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	significandf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_significandl.c b/sysdeps/m68k/fpu/s_significandl.c
deleted file mode 100644
index 8c6fc7e610..0000000000
--- a/sysdeps/m68k/fpu/s_significandl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC significandl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_sin.c b/sysdeps/m68k/fpu/s_sin.c
deleted file mode 100644
index 0d4abdbfe4..0000000000
--- a/sysdeps/m68k/fpu/s_sin.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	sin
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_sincos.c b/sysdeps/m68k/fpu/s_sincos.c
deleted file mode 100644
index 5df4a5a1c0..0000000000
--- a/sysdeps/m68k/fpu/s_sincos.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-
-#ifndef FUNC
-#define FUNC sincos
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-
-void
-CONCATX(__,FUNC) (x, sinx, cosx)
-     float_type x, *sinx, *cosx;
-{
-  __m81_u(CONCATX(__,FUNC))(x, sinx, cosx);
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_sincosf.c b/sysdeps/m68k/fpu/s_sincosf.c
deleted file mode 100644
index 7ee2ec6600..0000000000
--- a/sysdeps/m68k/fpu/s_sincosf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC sincosf
-#define float_type float
-#include <s_sincos.c>
diff --git a/sysdeps/m68k/fpu/s_sincosl.c b/sysdeps/m68k/fpu/s_sincosl.c
deleted file mode 100644
index f998cc0977..0000000000
--- a/sysdeps/m68k/fpu/s_sincosl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define FUNC sincosl
-#define float_type long double
-#include <s_sincos.c>
diff --git a/sysdeps/m68k/fpu/s_sinf.c b/sysdeps/m68k/fpu/s_sinf.c
deleted file mode 100644
index 9b23d4823f..0000000000
--- a/sysdeps/m68k/fpu/s_sinf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	sinf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_sinl.c b/sysdeps/m68k/fpu/s_sinl.c
deleted file mode 100644
index 9ac532cb47..0000000000
--- a/sysdeps/m68k/fpu/s_sinl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC sinl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_tan.c b/sysdeps/m68k/fpu/s_tan.c
deleted file mode 100644
index ca7fb0e6dc..0000000000
--- a/sysdeps/m68k/fpu/s_tan.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	tan
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_tanf.c b/sysdeps/m68k/fpu/s_tanf.c
deleted file mode 100644
index 95fe9c71a5..0000000000
--- a/sysdeps/m68k/fpu/s_tanf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	tanf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_tanh.c b/sysdeps/m68k/fpu/s_tanh.c
deleted file mode 100644
index ac2e7dbb79..0000000000
--- a/sysdeps/m68k/fpu/s_tanh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	tanh
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_tanhf.c b/sysdeps/m68k/fpu/s_tanhf.c
deleted file mode 100644
index 1addaae4ff..0000000000
--- a/sysdeps/m68k/fpu/s_tanhf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	tanhf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_tanhl.c b/sysdeps/m68k/fpu/s_tanhl.c
deleted file mode 100644
index 6e997911f2..0000000000
--- a/sysdeps/m68k/fpu/s_tanhl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC tanhl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_tanl.c b/sysdeps/m68k/fpu/s_tanl.c
deleted file mode 100644
index 64fcb54406..0000000000
--- a/sysdeps/m68k/fpu/s_tanl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define FUNC tanl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_trunc.c b/sysdeps/m68k/fpu/s_trunc.c
deleted file mode 100644
index 96f29a776c..0000000000
--- a/sysdeps/m68k/fpu/s_trunc.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC trunc
-#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_truncf.c b/sysdeps/m68k/fpu/s_truncf.c
deleted file mode 100644
index 44dca748ca..0000000000
--- a/sysdeps/m68k/fpu/s_truncf.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC truncf
-#include <s_atanf.c>
diff --git a/sysdeps/m68k/fpu/s_truncl.c b/sysdeps/m68k/fpu/s_truncl.c
deleted file mode 100644
index 8d35777aed..0000000000
--- a/sysdeps/m68k/fpu/s_truncl.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC truncl
-#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/sincos32.c b/sysdeps/m68k/fpu/sincos32.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/sincos32.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/slowexp.c b/sysdeps/m68k/fpu/slowexp.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/slowexp.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/slowpow.c b/sysdeps/m68k/fpu/slowpow.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/m68k/fpu/slowpow.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed.  */
diff --git a/sysdeps/m68k/fpu/switch/68881-sw.h b/sysdeps/m68k/fpu/switch/68881-sw.h
deleted file mode 100644
index c5a0f71fa6..0000000000
--- a/sysdeps/m68k/fpu/switch/68881-sw.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_68881_SWITCH_H
-
-#define	_68881_SWITCH_H	1
-#include <sys/cdefs.h>
-
-/* This is the format of the data at the code label for a function which
-   wants to switch depending on whether or not a 68881 is present.
-
-   Initially, `insn' is a `jsr' instruction, and `target' is __68881_switch.
-   The first time such a function is called, __68881_switch determines whether
-   or not a 68881 is present, and modifies the function accordingly.
-   Then `insn' is a `jmp' instruction, and `target' is the value of `fpu'
-   if there is 68881, or the value of `soft' if not.  */
-
-struct switch_caller
-  {
-    unsigned short int insn;	/* The `jsr' or `jmp' instruction.  */
-    void *target;		/* The target of the instruction.  */
-    void *soft;			/* The address of the soft function.  */
-    void *fpu;			/* The address of the 68881 function.  */
-  };
-
-/* These are opcodes (values for `insn', above) for `jmp' and `jsr'
-   instructions, respectively, to 32-bit absolute addresses.  */
-#define	JMP	0x4ef9
-#define	JSR	0x4eb9
-
-
-/* Function to determine whether or not a 68881 is available,
-   and modify its caller (which must be a `struct switch_caller', above,
-   in data space) to use the appropriate version.  */
-extern void __68881_switch (int __dummy) __THROW;
-
-
-/* Define FUNCTION as a `struct switch_caller' which will call
-   `__FUNCTION_68881' if a 68881 is present, and `__FUNCTION_soft' if not.
-#define	switching_function(FUNCTION)					      \
-  struct switch_caller FUNCTION =					      \
-    {									      \
-      JSR, (__ptr_t) __68881_switch,					      \
-      __CONCAT(__CONCAT(__,FUNCTION),_soft),				      \
-      __CONCAT(__CONCAT(__,FUNCTION),_68881)				      \
-    }
-
-
-#endif	/* 68881-switch.h  */
diff --git a/sysdeps/m68k/fpu/switch/Dist b/sysdeps/m68k/fpu/switch/Dist
deleted file mode 100644
index 9288bddaa5..0000000000
--- a/sysdeps/m68k/fpu/switch/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-68881-sw.h
-switch.c
diff --git a/sysdeps/m68k/fpu/switch/Makefile b/sysdeps/m68k/fpu/switch/Makefile
deleted file mode 100644
index c04107163c..0000000000
--- a/sysdeps/m68k/fpu/switch/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (C) 1991, 1992, 1997 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, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-ifeq ($(subdir),math)
-
-sysdep_routines := $(sysdep_routines) switch
-
-# Find all the sources that have 68881 versions.
-+68881-sources := \
-  $(notdir $(wildcard $(addprefix $(filter %/fpu,$(sysdirs)),$(sources))))
-
-# Sysdep directories other than fpu and fpu/switch (this one).
-+non68881-dirs := $(filter-out %/fpu %/fpu/switch,$(+sysdep_dirs))
-
-# Get a non-68881 version of the target.
-+non68881-version = $(firstword $(wildcard $(addsuffix /$@,$(+non68881-dirs))))
-
-# Directory containing 68881 sources.
-+68881-dir := $(filter %/fpu,$(+sysdep_dirs))
-
-# For all the files that have 68881 versions and don't exist already in
-# the source directory (math), automatically make ones that switch between
-# 68881 and soft versions.
-$(addprefix $(objpfx), \
-	    $(filter-out $(wildcard $(+68881-sources)),$(+68881-sources))):
-	(echo '#include <68881-sw.h>'		;\
-	 echo '#define $* __$*_68881'		;\
-	 echo '#include <$(+68881-dir)/$@>'	;\
-	 echo '#undef $*'			;\
-	 echo '#define $* __$*_soft'		;\
-	 echo '#include <$(non68881-version)>'	;\
-	 echo '#undef $*'			;\
-	 echo 'switching_function($*);') > $@-tmp
-	mv $@-tmp $@
-
-endif
diff --git a/sysdeps/m68k/fpu/switch/bits/mathinline.h b/sysdeps/m68k/fpu/switch/bits/mathinline.h
deleted file mode 100644
index c0f6966981..0000000000
--- a/sysdeps/m68k/fpu/switch/bits/mathinline.h
+++ /dev/null
@@ -1 +0,0 @@
-/* We don't want any inlines when we might not have a 68881.  */
diff --git a/sysdeps/m68k/fpu/switch/switch.c b/sysdeps/m68k/fpu/switch/switch.c
deleted file mode 100644
index e0558176dc..0000000000
--- a/sysdeps/m68k/fpu/switch/switch.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include <68881-sw.h>
-
-
-/* The signal that is sent when a 68881 instruction
-   is executed and there is no 68881.  */
-#ifndef	TRAPSIG
-#define	TRAPSIG	SIGILL
-#endif
-
-/* Zero if no 68881, one if we have a 68881, or -1 if we don't know yet.  */
-static int have_fpu = -1;
-
-
-/* Signal handler for the trap that happens if we don't have a 68881.  */
-static void
-trap (sig)
-     int sig;
-{
-  have_fpu = 0;
-}
-
-/* This function is called by functions that want to switch.
-   The calling function must be a `struct switch_caller' in data space.
-   It determines whether a 68881 is present, and modifies its caller
-   to be a static jump to either the 68881 version or the soft version.
-   It then returns into the function it has chosen to do the work.  */
-void
-__68881_switch (dummy)
-     int dummy;
-{
-  void **return_address_location = &((void **) &dummy)[-1];
-  struct switch_caller *const caller
-    = (struct switch_caller *) (((short int *) *return_address_location) - 1);
-
-  if (have_fpu < 0)
-    {
-      /* Figure out whether or not we have a 68881.  */
-      __sighandler_t handler = signal (TRAPSIG, trap);
-      if (handler == SIG_ERR)
-	/* We can't figure it out, so assume we don't have a 68881.
-	   This assumption will never cause us any problems other than
-	   lost performance, while the reverse assumption could cause
-	   the program to crash.  */
-	have_fpu = 0;
-      else
-	{
-	  /* We set `have_fpu' to nonzero, and then execute a 68881
-	     no-op instruction.  If we have a 68881, this will do nothing.
-	     If we don't have one, this will trap and the signal handler
-	     will clear `have_fpu'.  */
-	  have_fpu = 1;
-	  asm ("fnop");
-
-	  /* Restore the old signal handler.  */
-	  (void) signal (TRAPSIG, handler);
-	}
-    }
-
-  /* Modify the caller to be a jump to the appropriate address.  */
-  caller->insn = JMP;
-  caller->target = have_fpu ? caller->fpu : caller->soft;
-
-  /* Make the address we will return to be the target we have chosen.
-     Our return will match the `jsr' done by the caller we have
-     just modified, and it will be just as if that had instead
-     been a `jmp' to the new target.  */
-  *return_address_location = caller->target;
-}
diff --git a/sysdeps/m68k/fpu/t_exp.c b/sysdeps/m68k/fpu/t_exp.c
deleted file mode 100644
index fd37963b05..0000000000
--- a/sysdeps/m68k/fpu/t_exp.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty.  Not needed. */
diff --git a/sysdeps/m68k/fpu_control.h b/sysdeps/m68k/fpu_control.h
deleted file mode 100644
index 86358e6559..0000000000
--- a/sysdeps/m68k/fpu_control.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 68k FPU control word definitions.
-   Copyright (C) 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FPU_CONTROL_H
-#define _FPU_CONTROL_H
-
-/*
- * Motorola floating point control register bits.
- *
- * 31-16  -> reserved (read as 0, ignored on write)
- * 15     -> enable trap for BSUN exception
- * 14     -> enable trap for SNAN exception
- * 13     -> enable trap for OPERR exception
- * 12     -> enable trap for OVFL exception
- * 11     -> enable trap for UNFL exception
- * 10     -> enable trap for DZ exception
- *  9     -> enable trap for INEX2 exception
- *  8     -> enable trap for INEX1 exception
- *  7-6   -> Precision Control
- *  5-4   -> Rounding Control
- *  3-0   -> zero (read as 0, write as 0)
- *
- *
- * Precision Control:
- * 00 - round to extended precision
- * 01 - round to single precision
- * 10 - round to double precision
- * 11 - undefined
- *
- * Rounding Control:
- * 00 - rounding to nearest (RN)
- * 01 - rounding toward zero (RZ)
- * 10 - rounding (down)toward minus infinity (RM)
- * 11 - rounding (up) toward plus infinity (RP)
- *
- * The hardware default is 0x0000. I choose 0x5400.
- */
-
-#include <features.h>
-
-/* masking of interrupts */
-#define _FPU_MASK_BSUN  0x8000
-#define _FPU_MASK_SNAN  0x4000
-#define _FPU_MASK_OPERR 0x2000
-#define _FPU_MASK_OVFL  0x1000
-#define _FPU_MASK_UNFL  0x0800
-#define _FPU_MASK_DZ    0x0400
-#define _FPU_MASK_INEX1 0x0200
-#define _FPU_MASK_INEX2 0x0100
-
-/* precision control */
-#define _FPU_EXTENDED 0x00   /* RECOMMENDED */
-#define _FPU_DOUBLE   0x80
-#define _FPU_SINGLE   0x40     /* DO NOT USE */
-
-/* rounding control */
-#define _FPU_RC_NEAREST 0x00    /* RECOMMENDED */
-#define _FPU_RC_ZERO    0x10
-#define _FPU_RC_DOWN    0x20
-#define _FPU_RC_UP      0x30
-
-#define _FPU_RESERVED 0xFFFF000F  /* Reserved bits in fpucr */
-
-
-/* Now two recommended fpucr */
-
-/* The fdlibm code requires no interrupts for exceptions.  Don't
-   change the rounding mode, it would break long double I/O!  */
-#define _FPU_DEFAULT  0x00000000
-
-/* IEEE:  same as above, but exceptions.  We must make it non-zero so
-   that __setfpucw works.  This bit will be ignored.  */
-#define _FPU_IEEE     0x00000001
-
-/* 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) __asm__ ("fmove%.l %!, %0" : "=dm" (cw))
-#define _FPU_SETCW(cw) __asm__ volatile ("fmove%.l %0, %!" : : "dm" (cw))
-
-/* Default control word set at startup.  */
-extern fpu_control_t __fpu_control;
-
-#endif /* _M68K_FPU_CONTROL_H */
diff --git a/sysdeps/m68k/gccframe.h b/sysdeps/m68k/gccframe.h
deleted file mode 100644
index 452f53f626..0000000000
--- a/sysdeps/m68k/gccframe.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Definition of object in frame unwind info.  m68k version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define FIRST_PSEUDO_REGISTER 24
-
-#include <sysdeps/generic/gccframe.h>
diff --git a/sysdeps/m68k/lshift.S b/sysdeps/m68k/lshift.S
deleted file mode 100644
index 434b344bd4..0000000000
--- a/sysdeps/m68k/lshift.S
+++ /dev/null
@@ -1,147 +0,0 @@
-/* mc68020 __mpn_lshift -- Shift left a low-level natural-number integer.
-
-Copyright (C) 1996, 1998 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s_ptr		(sp + 8)
-  s_size	(sp + 16)
-  cnt		(sp + 12)
-*/
-
-#include "sysdep.h"
-#include "asm-syntax.h"
-
-#define res_ptr a1
-#define s_ptr a0
-#define s_size d6
-#define cnt d4
-
-	TEXT
-ENTRY(__mpn_lshift)
-
-/* Save used registers on the stack.  */
-	moveml	R(d2)-R(d6)/R(a2),MEM_PREDEC(sp)
-
-/* Copy the arguments to registers.  */
-	movel	MEM_DISP(sp,28),R(res_ptr)
-	movel	MEM_DISP(sp,32),R(s_ptr)
-	movel	MEM_DISP(sp,36),R(s_size)
-	movel	MEM_DISP(sp,40),R(cnt)
-
-	moveql	#1,R(d5)
-	cmpl	R(d5),R(cnt)
-	bne	L(Lnormal)
-	cmpl	R(s_ptr),R(res_ptr)
-	bls	L(Lspecial)		/* jump if s_ptr >= res_ptr */
-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
-	lea	MEM_INDX1(s_ptr,s_size,l,4),R(a2)
-#else /* not mc68020 */
-	movel	R(s_size),R(d0)
-	asll	#2,R(d0)
-	lea	MEM_INDX(s_ptr,d0,l),R(a2)
-#endif
-	cmpl	R(res_ptr),R(a2)
-	bls	L(Lspecial)		/* jump if res_ptr >= s_ptr + s_size */
-
-L(Lnormal:)
-	moveql	#32,R(d5)
-	subl	R(cnt),R(d5)
-
-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
-	lea	MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr)
-	lea	MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr)
-#else /* not mc68000 */
-	movel	R(s_size),R(d0)
-	asll	#2,R(d0)
-	addl	R(s_size),R(s_ptr)
-	addl	R(s_size),R(res_ptr)
-#endif
-	movel	MEM_PREDEC(s_ptr),R(d2)
-	movel	R(d2),R(d0)
-	lsrl	R(d5),R(d0)		/* compute carry limb */
-
-	lsll	R(cnt),R(d2)
-	movel	R(d2),R(d1)
-	subql	#1,R(s_size)
-	beq	L(Lend)
-	lsrl	#1,R(s_size)
-	bcs	L(L1)
-	subql	#1,R(s_size)
-
-L(Loop:)
-	movel	MEM_PREDEC(s_ptr),R(d2)
-	movel	R(d2),R(d3)
-	lsrl	R(d5),R(d3)
-	orl	R(d3),R(d1)
-	movel	R(d1),MEM_PREDEC(res_ptr)
-	lsll	R(cnt),R(d2)
-L(L1:)
-	movel	MEM_PREDEC(s_ptr),R(d1)
-	movel	R(d1),R(d3)
-	lsrl	R(d5),R(d3)
-	orl	R(d3),R(d2)
-	movel	R(d2),MEM_PREDEC(res_ptr)
-	lsll	R(cnt),R(d1)
-
-	dbf	R(s_size),L(Loop)
-	subl	#0x10000,R(s_size)
-	bcc	L(Loop)
-
-L(Lend:)
-	movel	R(d1),MEM_PREDEC(res_ptr) /* store least significant limb */
-
-/* Restore used registers from stack frame.  */
-	moveml	MEM_POSTINC(sp),R(d2)-R(d6)/R(a2)
-	rts
-
-/* We loop from least significant end of the arrays, which is only
-   permissible if the source and destination don't overlap, since the
-   function is documented to work for overlapping source and destination.  */
-
-L(Lspecial:)
-	clrl	R(d0)			/* initialize carry */
-	eorw	#1,R(s_size)
-	lsrl	#1,R(s_size)
-	bcc	L(LL1)
-	subql	#1,R(s_size)
-
-L(LLoop:)
-	movel	MEM_POSTINC(s_ptr),R(d2)
-	addxl	R(d2),R(d2)
-	movel	R(d2),MEM_POSTINC(res_ptr)
-L(LL1:)
-	movel	MEM_POSTINC(s_ptr),R(d2)
-	addxl	R(d2),R(d2)
-	movel	R(d2),MEM_POSTINC(res_ptr)
-
-	dbf	R(s_size),L(LLoop)
-	addxl	R(d0),R(d0)		/* save cy in lsb */
-	subl	#0x10000,R(s_size)
-	bcs	L(LLend)
-	lsrl	#1,R(d0)		/* restore cy */
-	bra	L(LLoop)
-
-L(LLend:)
-/* Restore used registers from stack frame.  */
-	moveml	MEM_POSTINC(sp),R(d2)-R(d6)/R(a2)
-	rts
-END(__mpn_lshift)
diff --git a/sysdeps/m68k/m68020/Makefile b/sysdeps/m68k/m68020/Makefile
deleted file mode 100644
index b17635467d..0000000000
--- a/sysdeps/m68k/m68020/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ifeq ($(subdir),db2)
-CPPFLAGS += -DHAVE_SPINLOCKS=1 -DHAVE_ASSEM_MC68020_GCC=1
-endif
diff --git a/sysdeps/m68k/m68020/addmul_1.S b/sysdeps/m68k/m68020/addmul_1.S
deleted file mode 100644
index 05d1d8a804..0000000000
--- a/sysdeps/m68k/m68020/addmul_1.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/* mc68020 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
-   the result to a second limb vector.
-
-Copyright (C) 1992, 1994, 1996, 1998 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s1_ptr	(sp + 8)
-  s1_size	(sp + 12)
-  s2_limb	(sp + 16)
-*/
-
-#include "sysdep.h"
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__mpn_addmul_1)
-
-#define res_ptr a0
-#define s1_ptr a1
-#define s1_size d2
-#define s2_limb d4
-
-/* Save used registers on the stack.  */
-	moveml	R(d2)-R(d5),MEM_PREDEC(sp)
-
-/* Copy the arguments to registers.  Better use movem?  */
-	movel	MEM_DISP(sp,20),R(res_ptr)
-	movel	MEM_DISP(sp,24),R(s1_ptr)
-	movel	MEM_DISP(sp,28),R(s1_size)
-	movel	MEM_DISP(sp,32),R(s2_limb)
-
-	eorw	#1,R(s1_size)
-	clrl	R(d1)
-	clrl	R(d5)
-	lsrl	#1,R(s1_size)
-	bcc	L(L1)
-	subql	#1,R(s1_size)
-	subl	R(d0),R(d0)		/* (d0,cy) <= (0,0) */
-
-L(Loop:)
-	movel	MEM_POSTINC(s1_ptr),R(d3)
-	mulul	R(s2_limb),R(d1):R(d3)
-	addxl	R(d0),R(d3)
-	addxl	R(d5),R(d1)
-	addl	R(d3),MEM_POSTINC(res_ptr)
-L(L1:)	movel	MEM_POSTINC(s1_ptr),R(d3)
-	mulul	R(s2_limb),R(d0):R(d3)
-	addxl	R(d1),R(d3)
-	addxl	R(d5),R(d0)
-	addl	R(d3),MEM_POSTINC(res_ptr)
-
-	dbf	R(s1_size),L(Loop)
-	addxl	R(d5),R(d0)
-	subl	#0x10000,R(s1_size)
-	bcc	L(Loop)
-
-/* Restore used registers from stack frame.  */
-	moveml	MEM_POSTINC(sp),R(d2)-R(d5)
-
-	rts
-END(__mpn_addmul_1)
diff --git a/sysdeps/m68k/m68020/bits/atomic.h b/sysdeps/m68k/m68020/bits/atomic.h
deleted file mode 100644
index 6b6db71465..0000000000
--- a/sysdeps/m68k/m68020/bits/atomic.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>, 2003.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdint.h>
-
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
-  ({ __typeof (*(mem)) __ret;						      \
-     __asm __volatile ("cas%.b %0,%2,%1"				      \
-		       : "=d" (__ret), "+m" (*(mem))			      \
-		       : "d" (newval), "0" (oldval));			      \
-     __ret; })
-
-#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
-  ({ __typeof (*(mem)) __ret;						      \
-     __asm __volatile ("cas%.w %0,%2,%1"				      \
-		       : "=d" (__ret), "+m" (*(mem))			      \
-		       : "d" (newval), "0" (oldval));			      \
-     __ret; })
-
-#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
-  ({ __typeof (*(mem)) __ret;						      \
-     __asm __volatile ("cas%.l %0,%2,%1"				      \
-		       : "=d" (__ret), "+m" (*(mem))			      \
-		       : "d" (newval), "0" (oldval));			      \
-     __ret; })
-
-# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-  ({ __typeof (*(mem)) __ret;						      \
-     __typeof (mem) __memp = (mem);					      \
-     __asm __volatile ("cas2%.l %0:%R0,%1:%R1,(%2):(%3)"		      \
-		       : "=d" (__ret)					      \
-		       : "d" (newval), "r" (__memp),			      \
-			 "r" ((char *) __memp + 4), "0" (oldval)	      \
-		       : "memory");					      \
-     __ret; })
-
-#define atomic_exchange_acq(mem, newvalue) \
-  ({ __typeof (*(mem)) __result = *(mem);				      \
-     if (sizeof (*(mem)) == 1)						      \
-       __asm __volatile ("1: cas%.b %0,%2,%1;"				      \
-			 "   jbne 1b"					      \
-			 : "=d" (__result), "+m" (*(mem))		      \
-			 : "d" (newvalue), "0" (__result));		      \
-     else if (sizeof (*(mem)) == 2)					      \
-       __asm __volatile ("1: cas%.w %0,%2,%1;"				      \
-			 "   jbne 1b"					      \
-			 : "=d" (__result), "+m" (*(mem))		      \
-			 : "d" (newvalue), "0" (__result));		      \
-     else if (sizeof (*(mem)) == 4)					      \
-       __asm __volatile ("1: cas%.l %0,%2,%1;"				      \
-			 "   jbne 1b"					      \
-			 : "=d" (__result), "+m" (*(mem))		      \
-			 : "d" (newvalue), "0" (__result));		      \
-     else								      \
-       {								      \
-	 __typeof (mem) __memp = (mem);					      \
-	 __asm __volatile ("1: cas2%.l %0:%R0,%1:%R1,(%2):(%3);"	      \
-			   "   jbne 1b"					      \
-			   : "=d" (__result)				      \
-			   : "d" (newvalue), "r" (__memp),		      \
-			     "r" ((char *) __memp + 4), "0" (__result)	      \
-			   : "memory");					      \
-       }								      \
-     __result; })
-
-#define atomic_exchange_and_add(mem, value) \
-  ({ __typeof (*(mem)) __result = *(mem);				      \
-     __typeof (*(mem)) __temp;						      \
-     if (sizeof (*(mem)) == 1)						      \
-       __asm __volatile ("1: move%.b %0,%2;"				      \
-			 "   add%.b %3,%2;"				      \
-			 "   cas%.b %0,%2,%1;"				      \
-			 "   jbne 1b"					      \
-			 : "=d" (__result), "+m" (*(mem)),		      \
-			   "=&d" (__temp)				      \
-			 : "d" (value), "0" (__result));		      \
-     else if (sizeof (*(mem)) == 2)					      \
-       __asm __volatile ("1: move%.w %0,%2;"				      \
-			 "   add%.w %3,%2;"				      \
-			 "   cas%.w %0,%2,%1;"				      \
-			 "   jbne 1b"					      \
-			 : "=d" (__result), "+m" (*(mem)),		      \
-			   "=&d" (__temp)				      \
-			 : "d" (value), "0" (__result));		      \
-     else if (sizeof (*(mem)) == 4)					      \
-       __asm __volatile ("1: move%.l %0,%2;"				      \
-			 "   add%.l %3,%2;"				      \
-			 "   cas%.l %0,%2,%1;"				      \
-			 "   jbne 1b"					      \
-			 : "=d" (__result), "+m" (*(mem)),		      \
-			   "=&d" (__temp)				      \
-			 : "d" (value), "0" (__result));		      \
-     else								      \
-       {								      \
-	 __typeof (mem) __memp = (mem);					      \
-	 __asm __volatile ("1: move%.l %0,%1;"				      \
-			   "   move%.l %R0,%R1;"			      \
-			   "   add%.l %2,%1;"				      \
-			   "   addx%.l %R2,%R1;"			      \
-			   "   cas2%.l %0:%R0,%1:%R1,(%3):(%4);"	      \
-			   "   jbne 1b"					      \
-			   : "=d" (__result), "=&d" (__temp)		      \
-			   : "d" (value), "r" (__memp),			      \
-			     "r" ((char *) __memp + 4), "0" (__result)	      \
-			   : "memory");					      \
-       }								      \
-     __result; })
-
-#define atomic_add(mem, value) \
-  (void) ({ if (sizeof (*(mem)) == 1)					      \
-	      __asm __volatile ("add%.b %1,%0"				      \
-				: "+m" (*(mem))				      \
-				: "id" (value));			      \
-	    else if (sizeof (*(mem)) == 2)				      \
-	      __asm __volatile ("add%.w %1,%0"				      \
-				: "+m" (*(mem))				      \
-				: "id" (value));			      \
-	    else if (sizeof (*(mem)) == 4)				      \
-	      __asm __volatile ("add%.l %1,%0"				      \
-				: "+m" (*(mem))				      \
-				: "id" (value));			      \
-	    else							      \
-	      {								      \
-		__typeof (mem) __memp = (mem);				      \
-		__typeof (*(mem)) __oldval = *__memp;			      \
-		__typeof (*(mem)) __temp;				      \
-		__asm __volatile ("1: move%.l %0,%1;"			      \
-				  "   move%.l %R0,%R1;"			      \
-				  "   add%.l %2,%1;"			      \
-				  "   addx%.l %R2,%R1;"			      \
-				  "   cas2%.l %0:%R0,%1:%R1,(%3):(%4);"	      \
-				  "   jbne 1b"				      \
-				  : "=d" (__oldval), "=&d" (__temp)	      \
-				  : "d" (value), "r" (__memp),		      \
-				    "r" ((char *) __memp + 4), "0" (__oldval) \
-				  : "memory");				      \
-	      }								      \
-	    })
-
-#define atomic_increment_and_test(mem) \
-  ({ char __result;							      \
-     if (sizeof (*(mem)) == 1)						      \
-       __asm __volatile ("addq%.b %#1,%1; seq %0"			      \
-			 : "=dm" (__result), "+m" (*(mem)));		      \
-     else if (sizeof (*(mem)) == 2)					      \
-       __asm __volatile ("addq%.w %#1,%1; seq %0"			      \
-			 : "=dm" (__result), "+m" (*(mem)));		      \
-     else if (sizeof (*(mem)) == 4)					      \
-       __asm __volatile ("addq%.l %#1,%1; seq %0"			      \
-			 : "=dm" (__result), "+m" (*(mem)));		      \
-     else								      \
-       {								      \
-	 __typeof (mem) __memp = (mem);					      \
-	 __typeof (*(mem)) __oldval = *__memp;				      \
-	 __typeof (*(mem)) __temp;					      \
-	 __asm __volatile ("1: move%.l %1,%2;"				      \
-			   "   move%.l %R1,%R2;"			      \
-			   "   addq%.l %#1,%2;"				      \
-			   "   addx%.l %5,%R2;"				      \
-			   "   seq %0;"					      \
-			   "   cas2%.l %1:%R1,%2:%R2,(%3):(%4);"	      \
-			   "   jbne 1b"					      \
-			   : "=&dm" (__result), "=d" (__oldval),	      \
-			     "=&d" (__temp)				      \
-			   : "r" (__memp), "r" ((char *) __memp + 4),	      \
-			     "d" (0), "1" (__oldval)			      \
-			   : "memory");					      \
-       }								      \
-     __result; })
-
-#define atomic_decrement_and_test(mem) \
-  ({ char __result;							      \
-     if (sizeof (*(mem)) == 1)						      \
-       __asm __volatile ("subq%.b %#1,%1; seq %0"			      \
-			 : "=dm" (__result), "+m" (*(mem)));		      \
-     else if (sizeof (*(mem)) == 2)					      \
-       __asm __volatile ("subq%.w %#1,%1; seq %0"			      \
-			 : "=dm" (__result), "+m" (*(mem)));		      \
-     else if (sizeof (*(mem)) == 4)					      \
-       __asm __volatile ("subq%.l %#1,%1; seq %0"			      \
-			 : "=dm" (__result), "+m" (*(mem)));		      \
-     else								      \
-       {								      \
-	 __typeof (mem) __memp = (mem);					      \
-	 __typeof (*(mem)) __oldval = *__memp;				      \
-	 __typeof (*(mem)) __temp;					      \
-	 __asm __volatile ("1: move%.l %1,%2;"				      \
-			   "   move%.l %R1,%R2;"			      \
-			   "   subq%.l %#1,%2;"				      \
-			   "   subx%.l %5,%R2;"				      \
-			   "   seq %0;"					      \
-			   "   cas2%.l %1:%R1,%2:%R2,(%3):(%4);"	      \
-			   "   jbne 1b"					      \
-			   : "=&dm" (__result), "=d" (__oldval),	      \
-			     "=&d" (__temp)				      \
-			   : "r" (__memp), "r" ((char *) __memp + 4),	      \
-			     "d" (0), "1" (__oldval)			      \
-			   : "memory");					      \
-       }								      \
-     __result; })
-
-#define atomic_bit_set(mem, bit) \
-  __asm __volatile ("bfset %0{%1,#1}"					      \
-		    : "+m" (*(mem))					      \
-		    : "di" (sizeof (*(mem)) * 8 - (bit) - 1))
-
-#define atomic_bit_test_set(mem, bit) \
-  ({ char __result;							      \
-     __asm __volatile ("bfset %1{%2,#1}; sne %0"			      \
-		       : "=dm" (__result), "+m" (*(mem))		      \
-		       : "di" (sizeof (*(mem)) * 8 - (bit) - 1));	      \
-     __result; })
diff --git a/sysdeps/m68k/m68020/bits/string.h b/sysdeps/m68k/m68020/bits/string.h
deleted file mode 100644
index 84be224b73..0000000000
--- a/sysdeps/m68k/m68020/bits/string.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Optimized, inlined string functions.  m680x0 version, x >= 2.
-   Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _STRING_H
-# error "Never use <bits/string.h> directly; include <string.h> instead."
-#endif
-
-/* Currently the only purpose of this file is to tell the generic inline
-   macros that unaligned memory access is possible.  */
-#define _STRING_ARCH_unaligned	1
diff --git a/sysdeps/m68k/m68020/mul_1.S b/sysdeps/m68k/m68020/mul_1.S
deleted file mode 100644
index f3e450ed93..0000000000
--- a/sysdeps/m68k/m68020/mul_1.S
+++ /dev/null
@@ -1,87 +0,0 @@
-/* mc68020 __mpn_mul_1 -- Multiply a limb vector with a limb and store
-   the result in a second limb vector.
-
-Copyright (C) 1992, 1994, 1996, 1998 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s1_ptr	(sp + 8)
-  s1_size	(sp + 12)
-  s2_limb	(sp + 16)
-*/
-
-#include "sysdep.h"
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__mpn_mul_1)
-
-#define res_ptr a0
-#define s1_ptr a1
-#define s1_size d2
-#define s2_limb d4
-
-/* Save used registers on the stack.  */
-	moveml	R(d2)-R(d4),MEM_PREDEC(sp)
-#if 0
-	movel	R(d2),MEM_PREDEC(sp)
-	movel	R(d3),MEM_PREDEC(sp)
-	movel	R(d4),MEM_PREDEC(sp)
-#endif
-
-/* Copy the arguments to registers.  Better use movem?  */
-	movel	MEM_DISP(sp,16),R(res_ptr)
-	movel	MEM_DISP(sp,20),R(s1_ptr)
-	movel	MEM_DISP(sp,24),R(s1_size)
-	movel	MEM_DISP(sp,28),R(s2_limb)
-
-	eorw	#1,R(s1_size)
-	clrl	R(d1)
-	lsrl	#1,R(s1_size)
-	bcc	L(L1)
-	subql	#1,R(s1_size)
-	subl	R(d0),R(d0)	/* (d0,cy) <= (0,0) */
-
-L(Loop:)
-	movel	MEM_POSTINC(s1_ptr),R(d3)
-	mulul	R(s2_limb),R(d1):R(d3)
-	addxl	R(d0),R(d3)
-	movel	R(d3),MEM_POSTINC(res_ptr)
-L(L1:)	movel	MEM_POSTINC(s1_ptr),R(d3)
-	mulul	R(s2_limb),R(d0):R(d3)
-	addxl	R(d1),R(d3)
-	movel	R(d3),MEM_POSTINC(res_ptr)
-
-	dbf	R(s1_size),L(Loop)
-	clrl	R(d3)
-	addxl	R(d3),R(d0)
-	subl	#0x10000,R(s1_size)
-	bcc	L(Loop)
-
-/* Restore used registers from stack frame.  */
-	moveml	MEM_POSTINC(sp),R(d2)-R(d4)
-#if 0
-	movel	MEM_POSTINC(sp),R(d4)
-	movel	MEM_POSTINC(sp),R(d3)
-	movel	MEM_POSTINC(sp),R(d2)
-#endif
-	rts
-END(__mpn_mul_1)
diff --git a/sysdeps/m68k/m68020/submul_1.S b/sysdeps/m68k/m68020/submul_1.S
deleted file mode 100644
index 7522046b43..0000000000
--- a/sysdeps/m68k/m68020/submul_1.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/* mc68020 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
-   the result from a second limb vector.
-
-Copyright (C) 1992, 1994, 1996, 1998 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s1_ptr	(sp + 8)
-  s1_size	(sp + 12)
-  s2_limb	(sp + 16)
-*/
-
-#include "sysdep.h"
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__mpn_submul_1)
-
-#define res_ptr a0
-#define s1_ptr a1
-#define s1_size d2
-#define s2_limb d4
-
-/* Save used registers on the stack.  */
-	moveml	R(d2)-R(d5),MEM_PREDEC(sp)
-
-/* Copy the arguments to registers.  Better use movem?  */
-	movel	MEM_DISP(sp,20),R(res_ptr)
-	movel	MEM_DISP(sp,24),R(s1_ptr)
-	movel	MEM_DISP(sp,28),R(s1_size)
-	movel	MEM_DISP(sp,32),R(s2_limb)
-
-	eorw	#1,R(s1_size)
-	clrl	R(d1)
-	clrl	R(d5)
-	lsrl	#1,R(s1_size)
-	bcc	L(L1)
-	subql	#1,R(s1_size)
-	subl	R(d0),R(d0)	/* (d0,cy) <= (0,0) */
-
-L(Loop:)
-	movel	MEM_POSTINC(s1_ptr),R(d3)
-	mulul	R(s2_limb),R(d1):R(d3)
-	addxl	R(d0),R(d3)
-	addxl	R(d5),R(d1)
-	subl	R(d3),MEM_POSTINC(res_ptr)
-L(L1:)	movel	MEM_POSTINC(s1_ptr),R(d3)
-	mulul	R(s2_limb),R(d0):R(d3)
-	addxl	R(d1),R(d3)
-	addxl	R(d5),R(d0)
-	subl	R(d3),MEM_POSTINC(res_ptr)
-
-	dbf	R(s1_size),L(Loop)
-	addxl	R(d5),R(d0)
-	subl	#0x10000,R(s1_size)
-	bcc	L(Loop)
-
-/* Restore used registers from stack frame.  */
-	moveml	MEM_POSTINC(sp),R(d2)-R(d5)
-
-	rts
-END(__mpn_submul_1)
diff --git a/sysdeps/m68k/m68020/wordcopy.S b/sysdeps/m68k/m68020/wordcopy.S
deleted file mode 100644
index 4fb1a4518f..0000000000
--- a/sysdeps/m68k/m68020/wordcopy.S
+++ /dev/null
@@ -1 +0,0 @@
-/* Empty, not needed.  */
diff --git a/sysdeps/m68k/memchr.S b/sysdeps/m68k/memchr.S
deleted file mode 100644
index fab65a9aea..0000000000
--- a/sysdeps/m68k/memchr.S
+++ /dev/null
@@ -1,232 +0,0 @@
-/* memchr (str, ch, n) -- Return pointer to first occurrence of CH in the
-   first N bytes of STR.
-   For Motorola 68000.
-   Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__memchr)
-	/* Save the callee-saved registers we use.  */
-	moveml	R(d2)-R(d4),MEM_PREDEC(sp)
-
-	/* Get string pointer, character and length.  */
-	movel	MEM_DISP(sp,16),R(a0)
-	moveb	MEM_DISP(sp,23),R(d0)
-	movel	MEM_DISP(sp,24),R(d4)
-
-	/* Check if at least four bytes left to search.  */
-	moveql	#4,R(d1)
-	cmpl	R(d1),R(d4)
-	bcs	L(L6)
-
-	/* Distribute the character to all bytes of a longword.  */
-	movel	R(d0),R(d1)
-	lsll	#8,R(d1)
-	moveb	R(d0),R(d1)
-	movel	R(d1),R(d0)
-	swap	R(d0)
-	movew	R(d1),R(d0)
-
-	/* First search for the character one byte at a time until the
-	   pointer is aligned to a longword boundary.  */
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-	subql	#1,R(d4)
-	beq	L(L7)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-	subql	#1,R(d4)
-	beq	L(L7)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-	subql	#1,R(d4)
-	beq	L(L7)
-
-L(L1:)
-	/* Load the magic bits.  Unlike the generic implementation we can
-	   use the carry bit as the fourth hole.  */
-	movel	#0xfefefeff,R(d3)
-
-      /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
-	 change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.	If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-31 is set, there will be a carry
-	 into bit 32 (=carry flag), so all of the hole bits will
-	 be changed.
-
-	 3) But wait!  Aren't we looking for C, not zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-	/* Still at least 4 bytes to search?  */
-	subql	#4,R(d4)
-	bcs	L(L6)
-
-L(L2:)
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits.  */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	bne	L(L8)
-
-	/* Still at least 4 bytes to search?  */
-	subql	#4,R(d4)
-	bcs	L(L6)
-
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	bne	L(L8)
-
-	/* Still at least 4 bytes to search?  */
-	subql	#4,R(d4)
-	bcc	L(L2)
-
-L(L6:)
-	/* Search one byte at a time in the remaining less than 4 bytes.  */
-	andw	#3,R(d4)
-	beq	L(L7)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	subqw	#1,R(d4)
-	beq	L(L7)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	subqw	#1,R(d4)
-	beq	L(L7)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-
-L(L7:)
-	/* Return NULL.  */
-	clrl	R(d0)
-	movel	R(d0),R(a0)
-	moveml	MEM_POSTINC(sp),R(d2)-R(d4)
-	rts
-
-L(L8:)
-	/* We have a hit.  Check to see which byte it was.  First
-	   compensate for the autoincrement in the loop.  */
-	subql	#4,R(a0)
-
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	/* Otherwise the fourth byte must equal C.  */
-L(L9:)
-	movel	R(a0),R(d0)
-	moveml	MEM_POSTINC(sp),R(d2)-R(d4)
-	rts
-END(__memchr)
-
-weak_alias (__memchr, memchr)
-#if !__BOUNDED_POINTERS__
-weak_alias (__memchr, __ubp_memchr)
-#endif
-libc_hidden_builtin_def (memchr)
diff --git a/sysdeps/m68k/memcopy.h b/sysdeps/m68k/memcopy.h
deleted file mode 100644
index 0951eeaf7a..0000000000
--- a/sysdeps/m68k/memcopy.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* memcopy.h -- definitions for memory copy functions.  Motorola 68020 version.
-   Copyright (C) 1991, 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/generic/memcopy.h>
-
-#if	defined(__mc68020__) || defined(mc68020)
-
-#undef	OP_T_THRES
-#define	OP_T_THRES	16
-
-/* WORD_COPY_FWD and WORD_COPY_BWD are not symmetric on the 68020,
-   because of its weird instruction overlap characteristics.  */
-
-#undef	WORD_COPY_FWD
-#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes)		      \
-  do									      \
-    {									      \
-      size_t __nwords = (nbytes) / sizeof (op_t);			      \
-      size_t __nblocks = __nwords / 8 + 1;				      \
-      dst_bp -= (8 - __nwords % 8) * sizeof (op_t);			      \
-      src_bp -= (8 - __nwords % 8) * sizeof (op_t);			      \
-      switch (__nwords % 8)						      \
-	do								      \
-	  {								      \
-	    ((op_t *) dst_bp)[0] = ((op_t *) src_bp)[0];		      \
-	  case 7:							      \
-	    ((op_t *) dst_bp)[1] = ((op_t *) src_bp)[1];		      \
-	  case 6:							      \
-	    ((op_t *) dst_bp)[2] = ((op_t *) src_bp)[2];		      \
-	  case 5:							      \
-	    ((op_t *) dst_bp)[3] = ((op_t *) src_bp)[3];		      \
-	  case 4:							      \
-	    ((op_t *) dst_bp)[4] = ((op_t *) src_bp)[4];		      \
-	  case 3:							      \
-	    ((op_t *) dst_bp)[5] = ((op_t *) src_bp)[5];		      \
-	  case 2:							      \
-	    ((op_t *) dst_bp)[6] = ((op_t *) src_bp)[6];		      \
-	  case 1:							      \
-	    ((op_t *) dst_bp)[7] = ((op_t *) src_bp)[7];		      \
-	  case 0:							      \
-	    src_bp += 32;						      \
-	    dst_bp += 32;						      \
-	    __nblocks--;						      \
-	  }								      \
-      while (__nblocks != 0);						      \
-      (nbytes_left) = (nbytes) % sizeof (op_t);				      \
-    } while (0)
-
-#undef	WORD_COPY_BWD
-#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes)		      \
-  do									      \
-    {									      \
-      size_t __nblocks = (nbytes) / 32 + 1;				      \
-      op_t *__dst_ep = (op_t *) (dst_ep);				      \
-      op_t *__src_ep = (op_t *) (src_ep);				      \
-      switch ((nbytes) / sizeof (op_t) % 8)				      \
-	do								      \
-	  {								      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 7:							      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 6:							      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 5:							      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 4:							      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 3:							      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 2:							      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 1:							      \
-	    *--__dst_ep = *--__src_ep;					      \
-	  case 0:							      \
-	    __nblocks--;						      \
-	  }								      \
-      while (__nblocks != 0);						      \
-      (nbytes_left) = (nbytes) % sizeof (op_t);				      \
-      (dst_ep) = (unsigned long) __dst_ep;				      \
-      (src_ep) = (unsigned long) __src_ep;				      \
-    } while (0)
-
-#endif
diff --git a/sysdeps/m68k/memusage.h b/sysdeps/m68k/memusage.h
deleted file mode 100644
index bb22c0acc0..0000000000
--- a/sysdeps/m68k/memusage.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("%sp"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/m68k/printf_fphex.c b/sysdeps/m68k/printf_fphex.c
deleted file mode 100644
index d021a090ab..0000000000
--- a/sysdeps/m68k/printf_fphex.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define LONG_DOUBLE_DENORM_BIAS IEEE854_LONG_DOUBLE_BIAS
-#include <sysdeps/ieee754/ldbl-96/printf_fphex.c>
diff --git a/sysdeps/m68k/rawmemchr.S b/sysdeps/m68k/rawmemchr.S
deleted file mode 100644
index acd8f76e44..0000000000
--- a/sysdeps/m68k/rawmemchr.S
+++ /dev/null
@@ -1,180 +0,0 @@
-/* rawmemchr (str, ch) -- Return pointer to first occurrence of CH in STR.
-   For Motorola 68000.
-   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__rawmemchr)
-	/* Save the callee-saved registers we use.  */
-	movel	R(d2),MEM_PREDEC(sp)
-	movel	R(d3),MEM_PREDEC(sp)
-
-	/* Get string pointer and character.  */
-	movel	MEM_DISP(sp,12),R(a0)
-	moveb	MEM_DISP(sp,19),R(d0)
-
-	/* Distribute the character to all bytes of a longword.  */
-	movel	R(d0),R(d1)
-	lsll	#8,R(d1)
-	moveb	R(d0),R(d1)
-	movel	R(d1),R(d0)
-	swap	R(d0)
-	movew	R(d1),R(d0)
-
-	/* First search for the character one byte at a time until the
-	   pointer is aligned to a longword boundary.  */
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-L(L1:)
-	/* Load the magic bits.  Unlike the generic implementation we can
-	   use the carry bit as the fourth hole.  */
-	movel	#0xfefefeff,R(d3)
-
-      /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
-	 change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.	If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-31 is set, there will be a carry
-	 into bit 32 (=carry flag), so all of the hole bits will
-	 be changed.
-
-	 3) But wait!  Aren't we looking for C, not zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-L(L2:)
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits.  */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	bne	L(L8)
-
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	beq	L(L2)
-
-L(L8:)
-	/* We have a hit.  Check to see which byte it was.  First
-	   compensate for the autoincrement in the loop.  */
-	subql	#4,R(a0)
-
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	cmpb	MEM(a0),R(d0)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	/* Otherwise the fourth byte must equal C.  */
-L(L9:)
-	movel	R(a0),R(d0)
-	movel	MEM_POSTINC(sp),R(d3)
-	movel	MEM_POSTINC(sp),R(d2)
-	rts
-END(__rawmemchr)
-
-libc_hidden_def (__rawmemchr)
-weak_alias (__rawmemchr, rawmemchr)
diff --git a/sysdeps/m68k/rshift.S b/sysdeps/m68k/rshift.S
deleted file mode 100644
index 5e6abceb97..0000000000
--- a/sysdeps/m68k/rshift.S
+++ /dev/null
@@ -1,146 +0,0 @@
-/* mc68020 __mpn_rshift -- Shift right a low-level natural-number integer.
-
-Copyright (C) 1996, 1998 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s_ptr		(sp + 8)
-  s_size	(sp + 16)
-  cnt		(sp + 12)
-*/
-
-#include "sysdep.h"
-#include "asm-syntax.h"
-
-#define res_ptr a1
-#define s_ptr a0
-#define s_size d6
-#define cnt d4
-
-	TEXT
-ENTRY(__mpn_rshift)
-/* Save used registers on the stack.  */
-	moveml	R(d2)-R(d6)/R(a2),MEM_PREDEC(sp)
-
-/* Copy the arguments to registers.  */
-	movel	MEM_DISP(sp,28),R(res_ptr)
-	movel	MEM_DISP(sp,32),R(s_ptr)
-	movel	MEM_DISP(sp,36),R(s_size)
-	movel	MEM_DISP(sp,40),R(cnt)
-
-	moveql	#1,R(d5)
-	cmpl	R(d5),R(cnt)
-	bne	L(Lnormal)
-	cmpl	R(res_ptr),R(s_ptr)
-	bls	L(Lspecial)		/* jump if res_ptr >= s_ptr */
-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
-	lea	MEM_INDX1(res_ptr,s_size,l,4),R(a2)
-#else /* not mc68020 */
-	movel	R(s_size),R(d0)
-	asll	#2,R(d0)
-	lea	MEM_INDX(res_ptr,d0,l),R(a2)
-#endif
-	cmpl	R(s_ptr),R(a2)
-	bls	L(Lspecial)		/* jump if s_ptr >= res_ptr + s_size */
-
-L(Lnormal:)
-	moveql	#32,R(d5)
-	subl	R(cnt),R(d5)
-	movel	MEM_POSTINC(s_ptr),R(d2)
-	movel	R(d2),R(d0)
-	lsll	R(d5),R(d0)		/* compute carry limb */
-
-	lsrl	R(cnt),R(d2)
-	movel	R(d2),R(d1)
-	subql	#1,R(s_size)
-	beq	L(Lend)
-	lsrl	#1,R(s_size)
-	bcs	L(L1)
-	subql	#1,R(s_size)
-
-L(Loop:)
-	movel	MEM_POSTINC(s_ptr),R(d2)
-	movel	R(d2),R(d3)
-	lsll	R(d5),R(d3)
-	orl	R(d3),R(d1)
-	movel	R(d1),MEM_POSTINC(res_ptr)
-	lsrl	R(cnt),R(d2)
-L(L1:)
-	movel	MEM_POSTINC(s_ptr),R(d1)
-	movel	R(d1),R(d3)
-	lsll	R(d5),R(d3)
-	orl	R(d3),R(d2)
-	movel	R(d2),MEM_POSTINC(res_ptr)
-	lsrl	R(cnt),R(d1)
-
-	dbf	R(s_size),L(Loop)
-	subl	#0x10000,R(s_size)
-	bcc	L(Loop)
-
-L(Lend:)
-	movel	R(d1),MEM(res_ptr) /* store most significant limb */
-
-/* Restore used registers from stack frame.  */
-	moveml	MEM_POSTINC(sp),R(d2)-R(d6)/R(a2)
-	rts
-
-/* We loop from most significant end of the arrays, which is only
-   permissible if the source and destination don't overlap, since the
-   function is documented to work for overlapping source and destination.  */
-
-L(Lspecial:)
-#if (defined (__mc68020__) || defined (__NeXT__) || defined(mc68020))
-	lea	MEM_INDX1(s_ptr,s_size,l,4),R(s_ptr)
-	lea	MEM_INDX1(res_ptr,s_size,l,4),R(res_ptr)
-#else /* not mc68000 */
-	movel	R(s_size),R(d0)
-	asll	#2,R(d0)
-	addl	R(s_size),R(s_ptr)
-	addl	R(s_size),R(res_ptr)
-#endif
-
-	clrl	R(d0)			/* initialize carry */
-	eorw	#1,R(s_size)
-	lsrl	#1,R(s_size)
-	bcc	L(LL1)
-	subql	#1,R(s_size)
-
-L(LLoop:)
-	movel	MEM_PREDEC(s_ptr),R(d2)
-	roxrl	#1,R(d2)
-	movel	R(d2),MEM_PREDEC(res_ptr)
-L(LL1:)
-	movel	MEM_PREDEC(s_ptr),R(d2)
-	roxrl	#1,R(d2)
-	movel	R(d2),MEM_PREDEC(res_ptr)
-
-	dbf	R(s_size),L(LLoop)
-	roxrl	#1,R(d0)		/* save cy in msb */
-	subl	#0x10000,R(s_size)
-	bcs	L(LLend)
-	addl	R(d0),R(d0)		/* restore cy */
-	bra	L(LLoop)
-
-L(LLend:)
-/* Restore used registers from stack frame.  */
-	moveml	MEM_POSTINC(sp),R(d2)-R(d6)/R(a2)
-	rts
-END(__mpn_rshift)
diff --git a/sysdeps/m68k/s_isinfl.c b/sysdeps/m68k/s_isinfl.c
deleted file mode 100644
index 2502039087..0000000000
--- a/sysdeps/m68k/s_isinfl.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "ieee754.h"
-
-/* Return 0 if VALUE is finite or NaN, +1 if it
-   is +Infinity, -1 if it is -Infinity.  */
-int
-__isinfl (long double value)
-{
-  union ieee854_long_double u;
-
-  u.d = value;
-
-  /* An IEEE 854 infinity has an exponent with the
-     maximum possible value and a zero mantissa.
-     In Motorola's interpretation the integer bit is ignored.  */
-  if ((u.ieee.exponent & 0x7fff) == 0x7fff &&
-      (u.ieee.mantissa0 & 0x7fffffff) == 0 && u.ieee.mantissa1 == 0)
-    return u.ieee.negative ? -1 : 1;
-
-  return 0;
-}
-
-hidden_def (__isinfl)
-weak_alias (__isinfl, isinfl);
diff --git a/sysdeps/m68k/s_isnanl.c b/sysdeps/m68k/s_isnanl.c
deleted file mode 100644
index 999746f29c..0000000000
--- a/sysdeps/m68k/s_isnanl.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1991, 1992, 1995, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <math.h>
-#include "ieee754.h"
-
-/* Return nonzero if VALUE is not a number.  */
-int
-__isnanl (long double value)
-{
-  union ieee854_long_double u;
-
-  u.d = value;
-
-  /* IEEE 854 NaN's have the maximum possible
-     exponent and a nonzero mantissa.  In Motorola's
-     interpretation the integer bit is ignored.  */
-  return ((u.ieee.exponent & 0x7fff) == 0x7fff &&
-	  ((u.ieee.mantissa0 & 0x7fffffff) != 0 || u.ieee.mantissa1 != 0));
-}
-
-hidden_def (__isnanl)
-weak_alias (__isnanl, isnanl);
diff --git a/sysdeps/m68k/setjmp.c b/sysdeps/m68k/setjmp.c
deleted file mode 100644
index 8a6c3f9a0b..0000000000
--- a/sysdeps/m68k/setjmp.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 1991, 1992, 1994, 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-
-/* Save the current program position in ENV and return 0.  */
-int
-#if defined BSD_SETJMP
-# undef setjmp
-# define savemask 1
-setjmp (jmp_buf env)
-#elif defined BSD__SETJMP
-# undef _setjmp
-# define savemask 0
-_setjmp (jmp_buf env)
-#else
-__sigsetjmp (jmp_buf env, int savemask)
-#endif
-{
-  /* Save data registers D1 through D7.  */
-  asm volatile ("movem%.l %/d1-%/d7, %0"
-		: : "m" (env[0].__jmpbuf[0].__dregs[0]));
-
-  /* Save return address in place of register A0.  */
-  env[0].__jmpbuf[0].__aregs[0] = ((void **) &env)[-1];
-
-  /* Save address registers A1 through A5.  */
-  asm volatile ("movem%.l %/a1-%/a5, %0"
-		: : "m" (env[0].__jmpbuf[0].__aregs[1]));
-
-  /* Save caller's FP, not our own.  */
-  env[0].__jmpbuf[0].__fp = ((void **) &env)[-2];
-
-  /* Save caller's SP, not our own.  */
-  env[0].__jmpbuf[0].__sp = (void *) &env;
-
-#if defined __HAVE_68881__ || defined __HAVE_FPU__
-  /* Save floating-point (68881) registers FP0 through FP7.  */
-  asm volatile ("fmovem%.x %/fp0-%/fp7, %0"
-		: : "m" (env[0].__jmpbuf[0].__fpregs[0]));
-#endif
-
-  /* Save the signal mask if requested.  */
-  return __sigjmp_save (env, savemask);
-}
-#if !defined BSD_SETJMP && !defined BSD__SETJMP
-hidden_def (__sigsetjmp)
-#endif
diff --git a/sysdeps/m68k/stackinfo.h b/sysdeps/m68k/stackinfo.h
deleted file mode 100644
index 66e5a17fb4..0000000000
--- a/sysdeps/m68k/stackinfo.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-/* On m68k the stack grows down.  */
-#define _STACK_GROWS_DOWN	1
-
-#endif	/* stackinfo.h */
diff --git a/sysdeps/m68k/strchr.S b/sysdeps/m68k/strchr.S
deleted file mode 100644
index 04626ffd64..0000000000
--- a/sysdeps/m68k/strchr.S
+++ /dev/null
@@ -1,258 +0,0 @@
-/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
-   For Motorola 68000.
-   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(strchr)
-	/* Save the callee-saved registers we use.  */
-	movel	R(d2),MEM_PREDEC(sp)
-	movel	R(d3),MEM_PREDEC(sp)
-
-	/* Get string pointer and character.  */
-	movel	MEM_DISP(sp,12),R(a0)
-	moveb	MEM_DISP(sp,19),R(d0)
-
-	/* Distribute the character to all bytes of a longword.  */
-	movel	R(d0),R(d1)
-	lsll	#8,R(d1)
-	moveb	R(d0),R(d1)
-	movel	R(d1),R(d0)
-	swap	R(d0)
-	movew	R(d1),R(d0)
-
-	/* First search for the character one byte at a time until the
-	   pointer is aligned to a longword boundary.  */
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L3)
-	addql	#1,R(a0)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L3)
-	addql	#1,R(a0)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L3)
-	addql	#1,R(a0)
-
-L(L1:)
-	/* Load the magic bits.  Unlike the generic implementation we can
-	   use the carry bit as the fourth hole.  */
-	movel	#0xfefefeff,R(d3)
-
-      /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
-	 change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.	If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-31 is set, there will be a carry
-	 into bit 32 (=carry flag), so all of the hole bits will
-	 be changed.
-
-	 3) But wait!  Aren't we looking for C, not zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-L(L2:)
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits.  */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	bne	L(L8)
-
-	/* Next look for a NUL byte.
-	   Restore original longword without reload.  */
-	eorl	R(d0),R(d1)
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not NUL.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit, and return NULL.  */
-	bcc	L(L3)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits.  */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word was NUL
-	   and we return NULL.  Otherwise continue with the next longword.  */
-	bne	L(L3)
-
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	bne	L(L8)
-
-	/* Next look for a NUL byte.
-	   Restore original longword without reload.  */
-	eorl	R(d0),R(d1)
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not NUL.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit, and return NULL.  */
-	bcc	L(L3)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word was NUL
-	   and we return NULL.  Otherwise continue with the next longword.  */
-	beq	L(L2)
-
-L(L3:)
-	/* Return NULL.  */
-	clrl	R(d0)
-	movel	R(d0),R(a0)
-	movel	MEM_POSTINC(sp),R(d3)
-	movel	MEM_POSTINC(sp),R(d2)
-	rts
-
-L(L8:)
-	/* We have a hit.  Check to see which byte it was.  First
-	   compensate for the autoincrement in the loop.  */
-	subql	#4,R(a0)
-
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L3)
-	addql	#1,R(a0)
-
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L3)
-	addql	#1,R(a0)
-
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L3)
-	addql	#1,R(a0)
-
-	/* Otherwise the fourth byte must equal C.  */
-L(L9:)
-	movel	R(a0),R(d0)
-	movel	MEM_POSTINC(sp),R(d3)
-	movel	MEM_POSTINC(sp),R(d2)
-	rts
-END(strchr)
-
-weak_alias (strchr, index)
-libc_hidden_builtin_def (strchr)
diff --git a/sysdeps/m68k/strchrnul.S b/sysdeps/m68k/strchrnul.S
deleted file mode 100644
index 3fee2b236c..0000000000
--- a/sysdeps/m68k/strchrnul.S
+++ /dev/null
@@ -1,250 +0,0 @@
-/* strchrnul (str, ch) -- Return pointer to first occurrence of CH in STR
-   or the final NUL byte.
-   For Motorola 68000.
-   Copyright (C) 1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__strchrnul)
-	/* Save the callee-saved registers we use.  */
-	movel	R(d2),MEM_PREDEC(sp)
-	movel	R(d3),MEM_PREDEC(sp)
-
-	/* Get string pointer and character.  */
-	movel	MEM_DISP(sp,12),R(a0)
-	moveb	MEM_DISP(sp,19),R(d0)
-
-	/* Distribute the character to all bytes of a longword.  */
-	movel	R(d0),R(d1)
-	lsll	#8,R(d1)
-	moveb	R(d0),R(d1)
-	movel	R(d1),R(d0)
-	swap	R(d0)
-	movew	R(d1),R(d0)
-
-	/* First search for the character one byte at a time until the
-	   pointer is aligned to a longword boundary.  */
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	movel	R(a0),R(d1)
-	andw	#3,R(d1)
-	beq	L(L1)
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-L(L1:)
-	/* Load the magic bits.  Unlike the generic implementation we can
-	   use the carry bit as the fourth hole.  */
-	movel	#0xfefefeff,R(d3)
-
-      /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
-	 change any of the hole bits of LONGWORD.
-
-	 1) Is this safe?  Will it catch all the zero bytes?
-	 Suppose there is a byte with all zeros.  Any carry bits
-	 propagating from its left will fall into the hole at its
-	 least significant bit and stop.  Since there will be no
-	 carry from its most significant bit, the LSB of the
-	 byte to the left will be unchanged, and the zero will be
-	 detected.
-
-	 2) Is this worthwhile?  Will it ignore everything except
-	 zero bytes?  Suppose every byte of LONGWORD has a bit set
-	 somewhere.  There will be a carry into bit 8.	If bit 8
-	 is set, this will carry into bit 16.  If bit 8 is clear,
-	 one of bits 9-15 must be set, so there will be a carry
-	 into bit 16.  Similarly, there will be a carry into bit
-	 24.  If one of bits 24-31 is set, there will be a carry
-	 into bit 32 (=carry flag), so all of the hole bits will
-	 be changed.
-
-	 3) But wait!  Aren't we looking for C, not zero?
-	 Good point.  So what we do is XOR LONGWORD with a longword,
-	 each of whose bytes is C.  This turns each byte that is C
-	 into a zero.  */
-
-L(L2:)
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits.  */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	bne	L(L8)
-
-	/* Next look for a NUL byte.
-	   Restore original longword without reload.  */
-	eorl	R(d0),R(d1)
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not NUL.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits.  */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word was
-	   NUL.  Otherwise continue with the next longword.  */
-	bne	L(L8)
-
-	/* Get the longword in question.  */
-	movel	MEM_POSTINC(a0),R(d1)
-	/* XOR with the byte we search for.  */
-	eorl	R(d0),R(d1)
-
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not C.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word equals
-	   C.  */
-	bne	L(L8)
-
-	/* Next look for a NUL byte.
-	   Restore original longword without reload.  */
-	eorl	R(d0),R(d1)
-	/* Add the magic value.  We get carry bits reported for each byte
-	   which is not NUL.  */
-	movel	R(d3),R(d2)
-	addl	R(d1),R(d2)
-
-	/* Check the fourth carry bit before it is clobbered by the next
-	   XOR.  If it is not set we have a hit.  */
-	bcc	L(L8)
-
-	/* We are only interested in carry bits that change due to the
-	   previous add, so remove original bits */
-	eorl	R(d1),R(d2)
-
-	/* Now test for the other three overflow bits.
-	   Set all non-carry bits.  */
-	orl	R(d3),R(d2)
-	/* Add 1 to get zero if all carry bits were set.  */
-	addql	#1,R(d2)
-
-	/* If we don't get zero then at least one byte of the word was
-	   NUL.  Otherwise continue with the next longword.  */
-	beq	L(L2)
-
-L(L8:)
-	/* We have a hit.  Check to see which byte it was.  First
-	   compensate for the autoincrement in the loop.  */
-	subql	#4,R(a0)
-
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	moveb	MEM(a0),R(d1)
-	cmpb	R(d0),R(d1)
-	beq	L(L9)
-	tstb	R(d1)
-	beq	L(L9)
-	addql	#1,R(a0)
-
-	/* Otherwise the fourth byte must equal C or be NUL.  */
-L(L9:)
-	movel	R(a0),R(d0)
-	movel	MEM_POSTINC(sp),R(d3)
-	movel	MEM_POSTINC(sp),R(d2)
-	rts
-END(__strchrnul)
-
-weak_alias (__strchrnul, strchrnul)
diff --git a/sysdeps/m68k/strtold_l.c b/sysdeps/m68k/strtold_l.c
deleted file mode 100644
index 481d9924c2..0000000000
--- a/sysdeps/m68k/strtold_l.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define DENORM_EXP (MIN_EXP - 1)
-#include <sysdeps/ieee754/ldbl-96/strtold_l.c>
diff --git a/sysdeps/m68k/sub_n.S b/sysdeps/m68k/sub_n.S
deleted file mode 100644
index 5833dd2719..0000000000
--- a/sysdeps/m68k/sub_n.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* mc68020 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-   store difference in a third limb vector.
-
-Copyright (C) 1992, 1994, 1996, 1998 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA. */
-
-/*
-  INPUT PARAMETERS
-  res_ptr	(sp + 4)
-  s1_ptr	(sp + 8)
-  s2_ptr	(sp + 16)
-  size		(sp + 12)
-*/
-
-#include "sysdep.h"
-#include "asm-syntax.h"
-
-	TEXT
-ENTRY(__mpn_sub_n)
-/* Save used registers on the stack.  */
-	movel	R(d2),MEM_PREDEC(sp)
-	movel	R(a2),MEM_PREDEC(sp)
-
-/* Copy the arguments to registers.  Better use movem?  */
-	movel	MEM_DISP(sp,12),R(a2)
-	movel	MEM_DISP(sp,16),R(a0)
-	movel	MEM_DISP(sp,20),R(a1)
-	movel	MEM_DISP(sp,24),R(d2)
-
-	eorw	#1,R(d2)
-	lsrl	#1,R(d2)
-	bcc	L(L1)
-	subql	#1,R(d2)	/* clears cy as side effect */
-
-L(Loop:)
-	movel	MEM_POSTINC(a0),R(d0)
-	movel	MEM_POSTINC(a1),R(d1)
-	subxl	R(d1),R(d0)
-	movel	R(d0),MEM_POSTINC(a2)
-L(L1:)	movel	MEM_POSTINC(a0),R(d0)
-	movel	MEM_POSTINC(a1),R(d1)
-	subxl	R(d1),R(d0)
-	movel	R(d0),MEM_POSTINC(a2)
-
-	dbf	R(d2),L(Loop)		/* loop until 16 lsb of %4 == -1 */
-	subxl	R(d0),R(d0)	/* d0 <= -cy; save cy as 0 or -1 in d0 */
-	subl	#0x10000,R(d2)
-	bcs	L(L2)
-	addl	R(d0),R(d0)	/* restore cy */
-	bra	L(Loop)
-
-L(L2:)
-	negl	R(d0)
-
-/* Restore used registers from stack frame.  */
-	movel	MEM_POSTINC(sp),R(a2)
-	movel	MEM_POSTINC(sp),R(d2)
-
-	rts
-END(__mpn_sub_n)
diff --git a/sysdeps/m68k/sys/ucontext.h b/sysdeps/m68k/sys/ucontext.h
deleted file mode 100644
index 857ed6b42a..0000000000
--- a/sysdeps/m68k/sys/ucontext.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright (C) 1997, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* System V/m68k ABI compliant context switching support.  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-
-/* Type for general register.  */
-typedef int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	18
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NGREG];
-
-/* Number of each register is the `gregset_t' array.  */
-enum
-{
-  R_D0 = 0,
-#define R_D0	R_D0
-  R_D1 = 1,
-#define R_D1	R_D1
-  R_D2 = 2,
-#define R_D2	R_D2
-  R_D3 = 3,
-#define R_D3	R_D3
-  R_D4 = 4,
-#define R_D4	R_D4
-  R_D5 = 5,
-#define R_D5	R_D5
-  R_D6 = 6,
-#define R_D6	R_D6
-  R_D7 = 7,
-#define R_D7	R_D7
-  R_A0 = 8,
-#define R_A0	R_A0
-  R_A1 = 9,
-#define R_A1	R_A1
-  R_A2 = 10,
-#define R_A2	R_A2
-  R_A3 = 11,
-#define R_A3	R_A3
-  R_A4 = 12,
-#define R_A4	R_A4
-  R_A5 = 13,
-#define R_A5	R_A5
-  R_A6 = 14,
-#define R_A6	R_A6
-  R_A7 = 15,
-#define R_A7	R_A7
-  R_SP = 15,
-#define R_SP	R_SP
-  R_PC = 16,
-#define R_PC	R_PC
-  R_PS = 17
-#define R_PS	R_PS
-};
-
-/* Structure to describe FPU registers.  */
-typedef struct fpregset
-{
-  int f_pcr;
-  int f_psr;
-  int f_fpiaddr;
-  int f_fpregs[8][3];
-} fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct
-{
-  int version;
-  gregset_t gregs;
-} mcontext_t;
-
-#define MCONTEXT_VERSION 1
-
-/* Userlevel context.  */
-typedef struct ucontext
-{
-  unsigned long int uc_flags;
-  struct ucontext *uc_link;
-  __sigset_t uc_sigmask;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  long int uc_filler[201];
-} ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/m68k/sysdep.h b/sysdeps/m68k/sysdep.h
deleted file mode 100644
index f492ff617c..0000000000
--- a/sysdeps/m68k/sysdep.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Assembler macros for m68k.
-   Copyright (C) 1998, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/generic/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-/* Syntactic details of assembler.  */
-
-# ifdef HAVE_ELF
-
-/* ELF uses byte-counts for .align, most others use log2 of count of bytes.  */
-#  define ALIGNARG(log2) 1<<log2
-/* For ELF we need the `.type' directive to make shared libs work right.  */
-#  define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg
-#  define ASM_SIZE_DIRECTIVE(name) .size name,.-name
-
-/* In ELF C symbols are asm symbols.  */
-#  undef NO_UNDERSCORES
-#  define NO_UNDERSCORES
-
-# else
-
-#  define ALIGNARG(log2) log2
-#  define ASM_TYPE_DIRECTIVE(name,type)	/* Nothing is specified.  */
-#  define ASM_SIZE_DIRECTIVE(name)	/* Nothing is specified.  */
-
-# endif
-
-
-/* Define an entry point visible from C.
-
-   There is currently a bug in gdb which prevents us from specifying
-   incomplete stabs information.  Fake some entries here which specify
-   the current source file.  */
-# define ENTRY(name)							      \
-  .globl C_SYMBOL_NAME(name);						      \
-  ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function);			      \
-  .align ALIGNARG(2);							      \
-  C_LABEL(name)								      \
-  CALL_MCOUNT
-
-# undef END
-# define END(name) ASM_SIZE_DIRECTIVE(name)
-
-
-/* If compiled for profiling, call `_mcount' at the start of each function.  */
-# ifdef	PROF
-/* The mcount code relies on a normal frame pointer being on the stack
-   to locate our caller, so push one just for its benefit.  */
-#  define CALL_MCOUNT \
-  move.l %fp, -(%sp); move.l %sp, %fp;					      \
-  jbsr JUMPTARGET (mcount);						      \
-  move.l (%sp)+, %fp;
-# else
-#  define CALL_MCOUNT		/* Do nothing.  */
-# endif
-
-# ifdef	NO_UNDERSCORES
-/* Since C identifiers are not normally prefixed with an underscore
-   on this system, the asm identifier `syscall_error' intrudes on the
-   C name space.  Make sure we use an innocuous name.  */
-#  define syscall_error	__syscall_error
-#  define mcount	_mcount
-# endif
-
-# define PSEUDO(name, syscall_name, args)				      \
-  .globl syscall_error;							      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args);					      \
-    jcc JUMPTARGET(syscall_error)
-
-# undef PSEUDO_END
-# define PSEUDO_END(name)						      \
-  END (name)
-
-# undef JUMPTARGET
-# ifdef PIC
-#  define JUMPTARGET(name)	name##@PLTPC
-# else
-#  define JUMPTARGET(name)	name
-# endif
-
-#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/mach/Subdirs b/sysdeps/mach/Subdirs
index fc6ac35d83..24fa4a3c98 100644
--- a/sysdeps/mach/Subdirs
+++ b/sysdeps/mach/Subdirs
@@ -1 +1,9 @@
-mach
+# This file says that the mach subdirectory should appear before all others.
+# The mach and hurd subdirectories have many generated header files which
+# much of the rest of the library depends on, so it is best to build them
+# first (and mach before hurd, at that).  The before-compile additions in
+# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
+# not to exist when making in other directories, but it will be slower that
+# way with more somewhat expensive `make' invocations.
+
+first mach
diff --git a/sysdeps/mach/hppa/machine-lock.h b/sysdeps/mach/hppa/machine-lock.h
deleted file mode 100644
index 8c71d40a5a..0000000000
--- a/sysdeps/mach/hppa/machine-lock.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Machine-specific definition for spin locks.  HPPA version.
-   Copyright (C) 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MACHINE_LOCK_H
-#define	_MACHINE_LOCK_H
-
-/* The type of a spin lock variable.  */
-
-typedef __volatile int __spin_lock_t __attribute__ ((__aligned__ (16)));
-
-/* Value to initialize `__spin_lock_t' variables to.  */
-
-#define	__SPIN_LOCK_INITIALIZER	-1
-
-
-#ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
-#endif
-
-/* Unlock LOCK.  */
-
-_EXTERN_INLINE void
-__spin_unlock (__spin_lock_t *__lock)
-{
-  *__lock = -1;
-}
-
-/* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
-
-_EXTERN_INLINE int
-__spin_try_lock (__spin_lock_t *__lock)
-{
-  register int __result;
-  __asm__ __volatile__ ("ldcws %0, %1" : "=m" (*__lock), "=r" (__result));
-  return __result != 0;
-}
-
-/* Return nonzero if LOCK is locked.  */
-
-_EXTERN_INLINE int
-__spin_lock_locked (__spin_lock_t *__lock)
-{
-  return *__lock == 0;
-}
-
-
-#endif /* machine-lock.h */
diff --git a/sysdeps/mach/hurd/Dist b/sysdeps/mach/hurd/Dist
deleted file mode 100644
index 52c84297cb..0000000000
--- a/sysdeps/mach/hurd/Dist
+++ /dev/null
@@ -1,17 +0,0 @@
-cthreads.c
-errlist.c
-errnos.awk
-err_hurd.sub
-libc-ldscript
-libc_p-ldscript
-bits/libc-tsd.h
-net/ethernet.h
-net/if_arp.h
-net/if_ether.h
-net/if_ppp.h
-net/route.h
-nfs/nfs.h
-set-init.c
-siglist.h
-statfsconv.c
-xstatconv.c
diff --git a/sysdeps/mach/hurd/Subdirs b/sysdeps/mach/hurd/Subdirs
index 16b8348437..7a7757582a 100644
--- a/sysdeps/mach/hurd/Subdirs
+++ b/sysdeps/mach/hurd/Subdirs
@@ -1 +1,9 @@
-hurd
+# This file says that the hurd subdirectory should appear before all others.
+# The mach and hurd subdirectories have many generated header files which
+# much of the rest of the library depends on, so it is best to build them
+# first (and mach before hurd, at that).  The before-compile additions in
+# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
+# not to exist when making in other directories, but it will be slower that
+# way with more somewhat expensive `make' invocations.
+
+first hurd
diff --git a/sysdeps/mach/hurd/alpha/Dist b/sysdeps/mach/hurd/alpha/Dist
deleted file mode 100644
index c58180257e..0000000000
--- a/sysdeps/mach/hurd/alpha/Dist
+++ /dev/null
@@ -1 +0,0 @@
-static-start.S
diff --git a/sysdeps/mach/hurd/alpha/longjmp-ts.c b/sysdeps/mach/hurd/alpha/longjmp-ts.c
index b271d6d2a9..f472dbcb30 100644
--- a/sysdeps/mach/hurd/alpha/longjmp-ts.c
+++ b/sysdeps/mach/hurd/alpha/longjmp-ts.c
@@ -1,5 +1,5 @@
 /* Perform a `longjmp' on a Mach thread_state.  Alpha version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006 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
@@ -19,6 +19,7 @@
 
 #include <hurd/signal.h>
 #include <setjmp.h>
+#include <jmpbuf-offsets.h>
 #include <mach/thread_status.h>
 
 
diff --git a/sysdeps/mach/hurd/bits/ioctls.h b/sysdeps/mach/hurd/bits/ioctls.h
index 206058bf2f..06a73df75e 100644
--- a/sysdeps/mach/hurd/bits/ioctls.h
+++ b/sysdeps/mach/hurd/bits/ioctls.h
@@ -226,6 +226,7 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };
 #define	SIOCSIFADDR	_IOW('i', 12, struct ifreq)	/* set ifnet address */
 #define	OSIOCGIFADDR	_IOWR('i',13, struct ifreq)	/* get ifnet address */
 #define	SIOCGIFADDR	_IOWR('i',33, struct ifreq)	/* get ifnet address */
+#define	SIOCGIFHWADDR	_IOWR('i',39, struct ifreq)	/* get hwaddress */
 #define	SIOCSIFDSTADDR	_IOW('i', 14, struct ifreq)	/* set p-p address */
 #define	OSIOCGIFDSTADDR	_IOWR('i',15, struct ifreq)	/* get p-p address */
 #define	SIOCGIFDSTADDR	_IOWR('i',34, struct ifreq)	/* get p-p address */
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 326bebff7f..6747bc276e 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
@@ -1,5 +1,5 @@
 /* Define POSIX options for GNU/Hurd.
-   Copyright (C) 1998,2000,2001,2002 Free Software Foundation, Inc.
+   Copyright (C) 1998,2000,2001,2002,2006 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
@@ -31,13 +31,6 @@
 /* Processes have a saved set-user-ID and a saved set-group-ID.  */
 #define	_POSIX_SAVED_IDS	1
 
-#if 0				/* XXX implement aio_* */
-/* Asynchronous I/O is supported.  */
-#define _POSIX_ASYNCHRONOUS_IO	1
-/* Alternative name for Unix98.  */
-#define _LFS_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
-#endif
-
 /* Synchronizing file data is supported, but msync is missing.  */
 #undef _POSIX_SYNCHRONIZED_IO
 
@@ -47,15 +40,15 @@
 /* Mapping of files to memory is supported.  */
 #define	_POSIX_MAPPED_FILES	200112L
 
+/* Locking of all memory could be supported in future.  */
+#define	_POSIX_MEMLOCK	0
+
 /* Locking of ranges of memory is supported.  */
 #define	_POSIX_MEMLOCK_RANGE	200112L
 
 /* Setting of memory protections is supported.  */
 #define	_POSIX_MEMORY_PROTECTION	200112L
 
-/* POSIX.4 shared memory objects are supported (using regular files).  */
-#define _POSIX_SHARED_MEMORY_OBJECTS	_POSIX_MAPPED_FILES
-
 /* Elements of the `c_cc' member of `struct termios' structure
    can be disabled by using the value _POSIX_VDISABLE.  */
 #define _POSIX_VDISABLE			((unsigned char) -1)
@@ -67,13 +60,106 @@
 #undef _POSIX_NO_TRUNC		/* Overlong file names get error?  */
 #undef _POSIX_SYNC_IO		/* File supports O_SYNC et al?  */
 
+
+/* We do not have the POSIX threads interface.  */
+#define _POSIX_THREADS	-1
+
+/* We have the reentrant functions described in POSIX.  */
+#define _POSIX_REENTRANT_FUNCTIONS      1
+#define _POSIX_THREAD_SAFE_FUNCTIONS	200112L
+
+/* These are all things that won't be supported when _POSIX_THREADS is not.  */
+#define _POSIX_THREAD_PRIORITY_SCHEDULING	-1
+#define _POSIX_THREAD_ATTR_STACKSIZE		-1
+#define _POSIX_THREAD_ATTR_STACKADDR		-1
+#define _POSIX_SEMAPHORES			-1
+
+/* Real-time signals are not yet supported.  */
+#define _POSIX_REALTIME_SIGNALS	-1
+
+/* Asynchronous I/O might supported with the existing ABI.  */
+#define _POSIX_ASYNCHRONOUS_IO	0
+/* Alternative name for Unix98.  */
+#define _LFS_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
+
+/* The LFS support in asynchronous I/O is also available.  */
+#define _LFS64_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
+
+/* The rest of the LFS is also available.  */
+#define _LFS_LARGEFILE		1
+#define _LFS64_LARGEFILE	1
+#define _LFS64_STDIO		1
+
+/* POSIX.4 shared memory objects are supported (using regular files).  */
+#define _POSIX_SHARED_MEMORY_OBJECTS	_POSIX_MAPPED_FILES
+
+/* CPU-time clocks support needs to be checked at runtime.  */
+#define _POSIX_CPUTIME	0
+
+/* Clock support in threads must be also checked at runtime.  */
+#define _POSIX_THREAD_CPUTIME	0
+
 /* GNU libc provides regular expression handling.  */
 #define _POSIX_REGEXP	1
 
+/* Reader/Writer locks are not available.  */
+#define _POSIX_READER_WRITER_LOCKS	-1
+
 /* We have a POSIX shell.  */
 #define _POSIX_SHELL	1
 
+/* We cannot support the Timeouts option without _POSIX_THREADS.  */
+#define _POSIX_TIMEOUTS	-1
+
 /* The `spawn' function family is supported.  */
 #define _POSIX_SPAWN	200112L
 
+/* We do not have POSIX timers, but could in future without ABI change.  */
+#define _POSIX_TIMERS	0
+
+/* The barrier functions are not available.  */
+#define _POSIX_BARRIERS	-1
+
+/* POSIX message queues could be available in future.  */
+#define	_POSIX_MESSAGE_PASSING	0
+
+/* Thread process-shared synchronization is not supported.  */
+#define _POSIX_THREAD_PROCESS_SHARED	-1
+
+/* The monotonic clock might be available.  */
+#define _POSIX_MONOTONIC_CLOCK	0
+
+/* The clock selection interfaces are available.  */
+#define _POSIX_CLOCK_SELECTION	200112L
+
+/* Advisory information interfaces could be available in future.  */
+#define _POSIX_ADVISORY_INFO	0
+
+/* IPv6 support is available.  */
+#define _POSIX_IPV6	200112L
+
+/* Raw socket support is available.  */
+#define _POSIX_RAW_SOCKETS	200112L
+
+/* We have at least one terminal.  */
+#define _POSIX2_CHAR_TERM	200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER	-1
+#define _POSIX_THREAD_SPORADIC_SERVER	-1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE	-1
+#define _POSIX_TRACE_EVENT_FILTER	-1
+#define _POSIX_TRACE_INHERIT	-1
+#define _POSIX_TRACE_LOG	-1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS	-1
+
+/* No support for priority inheritance or protection so far.  */
+#define _POSIX_THREAD_PRIO_INHERIT	-1
+#define _POSIX_THREAD_PRIO_PROTECT	-1
+
+
 #endif /* bits/posix_opt.h */
diff --git a/sysdeps/mach/hurd/bits/stat.h b/sysdeps/mach/hurd/bits/stat.h
index 172bc5ea8e..c3f96660cc 100644
--- a/sysdeps/mach/hurd/bits/stat.h
+++ b/sysdeps/mach/hurd/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 94, 96, 97, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,94,96,97,99,2000,2005 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
@@ -182,8 +182,11 @@ struct stat64
 /* All the bits relevant to translators */
 #define S_ITRANS	000070000000
 
+/* Definitely no mmaps to this.  */
+#define S_IMMAP0	000100000000
+
 /* ALL the unused bits.  */
-#define	S_ISPARE	(~(S_IFMT|S_ITRANS|S_INOCACHE|    \
+#define	S_ISPARE	(~(S_IFMT|S_ITRANS|S_INOCACHE|S_IMMAP0|    \
 			   S_IUSEUNK|S_IUNKNOWN|07777))
 #endif
 
diff --git a/sysdeps/mach/hurd/dl-sysdep.h b/sysdeps/mach/hurd/dl-sysdep.h
index 2dc9b0a910..4b21b779ef 100644
--- a/sysdeps/mach/hurd/dl-sysdep.h
+++ b/sysdeps/mach/hurd/dl-sysdep.h
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  Hurd version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 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
@@ -23,3 +23,9 @@
    (open, mmap, etc).  */
 
 #define RTLD_PRIVATE_ERRNO 0
+
+#ifdef SHARED
+/* _dl_argv cannot be attribute_relro, because the stack-switching
+   libc initializer for using cthreads might write into it.  */
+# define DL_ARGV_NOT_RELRO 1
+#endif
diff --git a/sysdeps/mach/hurd/errno.c b/sysdeps/mach/hurd/errno.c
new file mode 100644
index 0000000000..a29091b5e2
--- /dev/null
+++ b/sysdeps/mach/hurd/errno.c
@@ -0,0 +1 @@
+/* No definition of `errno' variable on the Hurd.  */
diff --git a/sysdeps/mach/hurd/euidaccess.c b/sysdeps/mach/hurd/euidaccess.c
index 4e72e2abb3..57f2a015cc 100644
--- a/sysdeps/mach/hurd/euidaccess.c
+++ b/sysdeps/mach/hurd/euidaccess.c
@@ -1,5 +1,5 @@
 /* Test for access to FILE using effective UID and GID.  Hurd version.
-   Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1995, 1997, 2006 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
@@ -57,3 +57,4 @@ __euidaccess (file, type)
   return 0;
 }
 weak_alias (__euidaccess, euidaccess)
+weak_alias (__euidaccess, eaccess)
diff --git a/sysdeps/mach/hurd/faccessat.c b/sysdeps/mach/hurd/faccessat.c
new file mode 100644
index 0000000000..bb3c9fe19f
--- /dev/null
+++ b/sysdeps/mach/hurd/faccessat.c
@@ -0,0 +1,70 @@
+/* Test for access to file, relative to open directory.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+int
+faccessat (fd, file, type, flag)
+     int fd;
+     const char *file;
+     int type;
+     int flag;
+{
+  error_t err;
+  file_t port;
+  int allowed, flags;
+
+  if ((flag & AT_EACCESS) == 0)
+    {
+      if (fd == AT_FDCWD || file[0] == '/')
+	return __access (file, type);
+      __set_errno (ENOTSUP);	/* XXX later */
+      return -1;
+    }
+
+  port = __file_name_lookup_at (fd, flag &~ AT_EACCESS, file, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+
+  /* Find out what types of access we are allowed to this file.  */
+  err = __file_check_access (port, &allowed);
+  __mach_port_deallocate (__mach_task_self (), port);
+  if (err)
+    return __hurd_fail (err);
+
+  flags = 0;
+  if (type & R_OK)
+    flags |= O_READ;
+  if (type & W_OK)
+    flags |= O_WRITE;
+  if (type & X_OK)
+    flags |= O_EXEC;
+
+  if (flags & ~allowed)
+    /* We are not allowed all the requested types of access.  */
+    return __hurd_fail (EACCES);
+
+  return 0;
+}
diff --git a/sysdeps/mach/hurd/fchmodat.c b/sysdeps/mach/hurd/fchmodat.c
new file mode 100644
index 0000000000..d27e845274
--- /dev/null
+++ b/sysdeps/mach/hurd/fchmodat.c
@@ -0,0 +1,44 @@
+/* Change the protections of file relative to open directory.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+int
+fchmodat (fd, file, mode, flag)
+     int fd;
+     const char *file;
+     mode_t mode;
+     int flag;
+{
+  error_t err;
+  file_t port = __file_name_lookup_at (fd, flag, file, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = __file_chmod (port, mode);
+  __mach_port_deallocate (__mach_task_self (), port);
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
diff --git a/sysdeps/mach/hurd/fchownat.c b/sysdeps/mach/hurd/fchownat.c
new file mode 100644
index 0000000000..1b99b29272
--- /dev/null
+++ b/sysdeps/mach/hurd/fchownat.c
@@ -0,0 +1,46 @@
+/* Change owner and group of a file relative to open directory.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+/* Change the owner and group of FILE.  */
+int
+fchownat (fd, file, owner, group, flag)
+     int fd;
+     const char *file;
+     uid_t owner;
+     gid_t group;
+     int flag;
+{
+  error_t err;
+  file_t port = __file_name_lookup_at (fd, flag, file, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = __file_chown (port, owner, group);
+  __mach_port_deallocate (__mach_task_self (), port);
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
diff --git a/sysdeps/mach/hurd/fdopendir.c b/sysdeps/mach/hurd/fdopendir.c
new file mode 100644
index 0000000000..016f825f1d
--- /dev/null
+++ b/sysdeps/mach/hurd/fdopendir.c
@@ -0,0 +1,58 @@
+/* Open a directory stream from a file descriptor.  Hurd version.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <dirent.h>
+#include <errno.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+#include <fcntl.h>
+
+DIR *_hurd_fd_opendir (struct hurd_fd *d); /* opendir.c */
+
+/* Open a directory stream on FD.  */
+DIR *
+__fdopendir (int fd)
+{
+  struct hurd_fd *d = _hurd_fd_get (fd);
+
+  if (d == NULL)
+    {
+      errno = EBADF;
+      return NULL;
+    }
+
+  /* Ensure that it's a directory.  */
+  error_t err = HURD_FD_PORT_USE
+    (d, ({
+	file_t dir = __file_name_lookup_under (port, "/",
+					       O_DIRECTORY | O_NOTRANS, 0);;
+	if (dir != MACH_PORT_NULL)
+	  __mach_port_deallocate (__mach_task_self (), dir);
+	dir != MACH_PORT_NULL ? 0 : errno;
+      }));
+
+  if (err)
+    {
+      errno = err;
+      return NULL;
+    }
+
+  return _hurd_fd_opendir (d);
+}
+weak_alias (__fdopendir, fdopendir)
diff --git a/sysdeps/mach/hurd/fgetxattr.c b/sysdeps/mach/hurd/fgetxattr.c
new file mode 100644
index 0000000000..2eb6db06c7
--- /dev/null
+++ b/sysdeps/mach/hurd/fgetxattr.c
@@ -0,0 +1,34 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <hurd/fd.h>
+
+ssize_t
+fgetxattr (int fd, const char *name, void *value, size_t size)
+{
+  error_t err;
+
+  err = HURD_DPORT_USE (fd, _hurd_xattr_get (port, name, value, &size));
+
+  return err ? __hurd_dfail (fd, err) : size;
+}
diff --git a/sysdeps/mach/hurd/flistxattr.c b/sysdeps/mach/hurd/flistxattr.c
new file mode 100644
index 0000000000..a577e4e393
--- /dev/null
+++ b/sysdeps/mach/hurd/flistxattr.c
@@ -0,0 +1,34 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <hurd/fd.h>
+
+ssize_t
+flistxattr (int fd, char *list, size_t size)
+{
+  error_t err;
+
+  err = HURD_DPORT_USE (fd, _hurd_xattr_list (port, list, &size));
+
+  return err ? __hurd_dfail (fd, err) : size;
+}
diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
index 8728596915..fa7da60204 100644
--- a/sysdeps/mach/hurd/fork.c
+++ b/sysdeps/mach/hurd/fork.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1994,95,96,97,99,2001,02, 04 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1995,1996,1997,1999,2001,2002,2004,2005
+	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
@@ -21,7 +22,7 @@
 #include <hurd.h>
 #include <hurd/signal.h>
 #include <setjmp.h>
-#include "thread_state.h"
+#include <thread_state.h>
 #include <sysdep.h>		/* For stack growth direction.  */
 #include "set-hooks.h"
 #include <assert.h>
diff --git a/sysdeps/mach/hurd/fremovexattr.c b/sysdeps/mach/hurd/fremovexattr.c
new file mode 100644
index 0000000000..5d3aca6093
--- /dev/null
+++ b/sysdeps/mach/hurd/fremovexattr.c
@@ -0,0 +1,34 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <hurd/fd.h>
+
+int
+fremovexattr (int fd, const char *name)
+{
+  error_t err;
+
+  err = HURD_DPORT_USE (fd, _hurd_xattr_remove (port, name));
+
+  return err ? __hurd_dfail (fd, err) : 0;
+}
diff --git a/sysdeps/mach/hurd/fsetxattr.c b/sysdeps/mach/hurd/fsetxattr.c
new file mode 100644
index 0000000000..db8b676a06
--- /dev/null
+++ b/sysdeps/mach/hurd/fsetxattr.c
@@ -0,0 +1,34 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <hurd/fd.h>
+
+ssize_t
+fsetxattr (int fd, const char *name, const void *value, size_t size, int flags)
+{
+  error_t err;
+
+  err = HURD_DPORT_USE (fd, _hurd_xattr_set (port, name, value, size, flags));
+
+  return err ? __hurd_dfail (fd, err) : 0;
+}
diff --git a/sysdeps/mach/hurd/fxstatat.c b/sysdeps/mach/hurd/fxstatat.c
new file mode 100644
index 0000000000..dd9d2796eb
--- /dev/null
+++ b/sysdeps/mach/hurd/fxstatat.c
@@ -0,0 +1,33 @@
+/* Get information about file named relative to open directory.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+
+#include "xstatconv.c"
+
+int
+__fxstatat (int vers, int fd, const char *filename, struct stat *buf, int flag)
+{
+  struct stat64 buf64;
+  return (__fxstatat64 (vers, fd, filename, &buf64, flag)
+	  ?: xstat64_conv (buf, &buf64));
+}
+libc_hidden_def (__fxstatat)
diff --git a/sysdeps/mach/hurd/fxstatat64.c b/sysdeps/mach/hurd/fxstatat64.c
new file mode 100644
index 0000000000..6862e80d52
--- /dev/null
+++ b/sysdeps/mach/hurd/fxstatat64.c
@@ -0,0 +1,46 @@
+/* Get information about file named relative to open directory.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+/* Get information about the file descriptor FD in BUF.  */
+int
+__fxstatat64 (int vers, int fd, const char *filename, struct stat64 *buf,
+	      int flag)
+{
+  error_t err;
+  io_t port;
+
+  if (vers != _STAT_VER)
+    return __hurd_fail (EINVAL);
+
+  port = __file_name_lookup_at (fd, flag, filename, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+
+  err = __io_stat (port, buf);
+  __mach_port_deallocate (__mach_task_self (), port);
+
+  return __hurd_fail (err);
+}
diff --git a/sysdeps/mach/hurd/getdents.c b/sysdeps/mach/hurd/getdents.c
index 4775f983b4..d15be3b8f3 100644
--- a/sysdeps/mach/hurd/getdents.c
+++ b/sysdeps/mach/hurd/getdents.c
@@ -1 +1 @@
-#include <sysdeps/generic/getdents.c>
+#include <dirent/getdents.c>
diff --git a/sysdeps/mach/hurd/getpeername.c b/sysdeps/mach/hurd/getpeername.c
index 2e4f9f6a9d..325b6fd75d 100644
--- a/sysdeps/mach/hurd/getpeername.c
+++ b/sysdeps/mach/hurd/getpeername.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1994,1997,1999,2000,2005 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
@@ -47,14 +47,22 @@ __getpeername (int fd, __SOCKADDR_ARG addrarg, socklen_t *len)
 
   if (*len > buflen)
     *len = buflen;
-  
+
   if (buf != (char *) addr)
     {
       memcpy (addr, buf, *len);
       __vm_deallocate (__mach_task_self (), (vm_address_t) buf, buflen);
     }
 
-  addr->sa_family = type;
+  const sa_family_t family = type;
+  if (*len > offsetof (struct sockaddr, sa_family))
+    {
+      if (*len < (char *) (&addr->sa_family + 1) - (char *) addr)
+	memcpy (&addr->sa_family, &family,
+		*len - offsetof (struct sockaddr, sa_family));
+      else
+	addr->sa_family = family;
+    }
 
   return 0;
 }
diff --git a/sysdeps/mach/hurd/getresgid.c b/sysdeps/mach/hurd/getresgid.c
index a96aa49369..7847d213c4 100644
--- a/sysdeps/mach/hurd/getresgid.c
+++ b/sysdeps/mach/hurd/getresgid.c
@@ -1,5 +1,5 @@
-/* getresgid -- fetch effective group ID, real group ID, and saved-set group ID
-   Copyright (C) 2002 Free Software Foundation, Inc.
+/* getresgid -- fetch real group ID, effective group ID, and saved-set group ID
+   Copyright (C) 2002, 2006 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
@@ -22,13 +22,13 @@
 #include <hurd.h>
 #include <hurd/id.h>
 
-/* Fetch the effective group ID, real group ID, and saved-set group ID,
+/* Fetch the real group ID, effective group ID, and saved-set group ID,
    of the calling process.  */
 int
-__getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
+__getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
 {
   error_t err;
-  gid_t eff, real, saved;
+  gid_t real, eff, saved;
 
   HURD_CRITICAL_BEGIN;
   __mutex_lock (&_hurd_id.lock);
@@ -42,8 +42,8 @@ __getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
       else
 	{
 	  real = _hurd_id.aux.gids[0];
-	  saved = _hurd_id.aux.ngids < 2 ? real :_hurd_id.aux.gids[1];
 	  eff = _hurd_id.gen.ngids < 1 ? real : _hurd_id.gen.gids[0];
+	  saved = _hurd_id.aux.ngids < 2 ? real : _hurd_id.aux.gids[1];
 	}
     }
 
@@ -53,8 +53,8 @@ __getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
   if (err)
     return __hurd_fail (err);
 
-  *egid = eff;
   *rgid = real;
+  *egid = eff;
   *sgid = saved;
   return 0;
 }
diff --git a/sysdeps/mach/hurd/getresuid.c b/sysdeps/mach/hurd/getresuid.c
index f4bfaeaf56..668e463a39 100644
--- a/sysdeps/mach/hurd/getresuid.c
+++ b/sysdeps/mach/hurd/getresuid.c
@@ -1,5 +1,5 @@
-/* getresuid -- fetch effective user ID, real user ID, and saved-set user ID
-   Copyright (C) 2002 Free Software Foundation, Inc.
+/* getresuid -- fetch real user ID, effective user ID, and saved-set user ID
+   Copyright (C) 2002, 2006 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
@@ -22,13 +22,13 @@
 #include <hurd.h>
 #include <hurd/id.h>
 
-/* Fetch the effective user ID, real user ID, and saved-set user ID,
+/* Fetch the real user ID, effective user ID, and saved-set user ID,
    of the calling process.  */
 int
-__getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
+__getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
 {
   error_t err;
-  uid_t eff, real, saved;
+  uid_t real, eff, saved;
 
   HURD_CRITICAL_BEGIN;
   __mutex_lock (&_hurd_id.lock);
@@ -42,8 +42,8 @@ __getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
       else
 	{
 	  real = _hurd_id.aux.uids[0];
-	  saved = _hurd_id.aux.nuids < 2 ? real :_hurd_id.aux.uids[1];
 	  eff = _hurd_id.gen.nuids < 1 ? real : _hurd_id.gen.uids[0];
+	  saved = _hurd_id.aux.nuids < 2 ? real : _hurd_id.aux.uids[1];
 	}
     }
 
@@ -53,8 +53,8 @@ __getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
   if (err)
     return __hurd_fail (err);
 
-  *euid = eff;
   *ruid = real;
+  *euid = eff;
   *suid = saved;
   return 0;
 }
diff --git a/sysdeps/mach/hurd/getsid.c b/sysdeps/mach/hurd/getsid.c
index 57c10c58b7..9dcfa90fde 100644
--- a/sysdeps/mach/hurd/getsid.c
+++ b/sysdeps/mach/hurd/getsid.c
@@ -28,6 +28,9 @@ getsid (pid_t pid)
   error_t err;
   pid_t sid;
 
+  if (pid == 0)
+    pid = _hurd_pid;
+
   err = __USEPORT (PROC, __proc_getsid (port, pid, &sid));
   if (err)
     return (pid_t) __hurd_fail (err);
diff --git a/sysdeps/mach/hurd/getxattr.c b/sysdeps/mach/hurd/getxattr.c
new file mode 100644
index 0000000000..8f688a1d2f
--- /dev/null
+++ b/sysdeps/mach/hurd/getxattr.c
@@ -0,0 +1,35 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+
+ssize_t
+getxattr (const char *path, const char *name, void *value, size_t size)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_get (port, name, value, &size);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return err ? __hurd_fail (err) : size;
+}
diff --git a/sysdeps/mach/hurd/hppa/bits/sigcontext.h b/sysdeps/mach/hurd/hppa/bits/sigcontext.h
deleted file mode 100644
index 5db43fc22c..0000000000
--- a/sysdeps/mach/hurd/hppa/bits/sigcontext.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Machine-dependent signal context structure for GNU Hurd.  HPPA version.
-   Copyright (C) 1995,97,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-#ifndef sc_parisc_thread_state
-
-/* Signal handlers are actually called:
-   void handler (int sig, int code, struct sigcontext *scp);  */
-
-/* State of this thread when the signal was taken.  */
-struct sigcontext
-  {
-    /* These first members are machine-independent.  */
-
-    int sc_onstack;		/* Nonzero if running on sigstack.  */
-    __sigset_t sc_mask;		/* Blocked signals to restore.  */
-
-    /* MiG reply port this thread is using.  */
-    unsigned int sc_reply_port;
-
-    /* Port this thread is doing an interruptible RPC on.  */
-    unsigned int sc_intr_port;
-
-    /* Error code associated with this signal (interpreted as `error_t').  */
-    int sc_error;
-
-    /* All following members are machine-dependent.  The rest of this
-       structure is written to be laid out identically to a `struct
-       parisc_thread_state'.  trampoline.c knows this, so it must be
-       changed if this changes.  */
-
-#define sc_parisc_thread_state sc_flags /* Beginning of correspondence.  */
-    /* "General" registers $1..$31.  */
-    unsigned int sc_regs[31];
-
-    /* Control registers.  */
-    unsigned int sc_cr11;	/* sar */
-    /* These four registers make up the PC.  */
-    unsigned int iioq_head;
-    unsigned int iisq_head;
-    unsigned int iioq_tail;
-    unsigned int iisq_tail;
-    unsigned int sc_cr15;
-    unsigned int sc_cr19;
-    unsigned int sc_cr20;
-    unsigned int sc_cr21;
-    unsigned int sc_cr22;	/* ipsw */
-    unsigned int sc_bsd_goto;	/* unused */
-    unsigned int sc_sr4;
-    unsigned int sc_sr0;
-    unsigned int sc_sr1;
-    unsigned int sc_sr2;
-    unsigned int sc_sr3;
-    unsigned int sc_sr5;
-    unsigned int sc_sr6;
-    unsigned int sc_sr7;
-    unsigned int sc_cr0;
-    unsigned int sc_cr8;
-    unsigned int sc_cr9;
-    unsigned int sc_cr10;	/* unused */
-    unsigned int sc_cr12;
-    unsigned int sc_cr13;
-    unsigned int sc_cr24;	/* unused */
-    unsigned int sc_cr25;	/* unused */
-    unsigned int sc_cr26;	/* unused */
-    unsigned sc_mpsfu_high;	/* unused */
-    unsigned sc_mpsfu_low;	/* unused */
-    unsigned sc_mpsfu_ovflo;	/* unused */
-    int sc_pad;
-
-    /* Floating point registers $f0..$f31.  */
-    double sc_fpregs[32];
-  };
-
-#endif /* sc_parisc_thread_state */
diff --git a/sysdeps/mach/hurd/hppa/trampoline.c b/sysdeps/mach/hurd/hppa/trampoline.c
deleted file mode 100644
index bbb5b960ac..0000000000
--- a/sysdeps/mach/hurd/hppa/trampoline.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* Set thread_state for sighandler, and sigcontext to recover.  HPPA version.
-   Copyright (C) 1995, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd/signal.h>
-#include "thread_state.h"
-#include <assert.h>
-#include <errno.h>
-#include "hurdfault.h"
-
-
-struct mach_msg_trap_regargs
-  {
-    /* These first four arguments are in registers 26..23.  */
-    mach_msg_size_t rcv_size;	/* arg3 */
-    mach_msg_size_t send_size;	/* arg2 */
-    mach_msg_option_t option;	/* arg1 */
-    mach_msg_header_t *msg;	/* arg0 */
-  };
-
-struct sigcontext *
-_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
-			int signo, long int sigcode,
-			volatile int rpc_wait,
-			struct machine_thread_all_state *state)
-{
-  __label__ trampoline, rpc_wait_trampoline;
-  void *volatile sigsp;
-  struct sigcontext *scp;
-
-  if (ss->context)
-    {
-      /* We have a previous sigcontext that sigreturn was about
-	 to restore when another signal arrived.  We will just base
-	 our setup on that.  */
-      if (_hurdsig_catch_fault (SIGSEGV))
-	assert (_hurdsig_fault_sigcode >= (long int) ss->context &&
-		_hurdsig_fault_sigcode < (long int) (ss->context + 1));
-      else
-	{
-	  memcpy (&state->basic, &ss->context->sc_parisc_thread_state,
-		  sizeof (state->basic));
-	  state->set = (1 << PARISC_THREAD_STATE);
-	  assert (! rpc_wait);
-	  /* The intr_port slot was cleared before sigreturn sent us the
-	     sig_post that made us notice this pending signal, so
-	     _hurd_internal_post_signal wouldn't do interrupt_operation.
-	     After we return, our caller will set SCP->sc_intr_port (in the
-	     new context) from SS->intr_port and clear SS->intr_port.  Now
-	     that we are restoring this old context recorded by sigreturn,
-	     we want to restore its intr_port too; so store it in
-	     SS->intr_port now, so it will end up in SCP->sc_intr_port
-	     later.  */
-	  ss->intr_port = ss->context->sc_intr_port;
-	}
-      /* If the sigreturn context was bogus, just ignore it.  */
-      ss->context = NULL;
-    }
-  else if (! machine_get_basic_state (ss->thread, state))
-    return NULL;
-
-  if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
-      !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
-    {
-      sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size;
-      ss->sigaltstack.ss_flags |= SS_ONSTACK;
-      /* XXX need to set up base of new stack for
-	 per-thread variables, cthreads.  */
-    }
-  else
-    sigsp = (char *) state->basic.uesp;
-
-  /* Push the signal context on the stack.  */
-  sigsp -= sizeof (*scp);
-  scp = sigsp;
-
-  if (_hurdsig_catch_fault (SIGSEGV))
-    {
-      assert (_hurdsig_fault_sigcode >= (long int) scp &&
-	      _hurdsig_fault_sigcode <= (long int) (scp + 1));
-      /* We got a fault trying to write the stack frame.
-	 We cannot set up the signal handler.
-	 Returning NULL tells our caller, who will nuke us with a SIGILL.  */
-      return NULL;
-    }
-  else
-    {
-      int ok;
-
-      /* Set up the sigcontext from the current state of the thread.  */
-
-      scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
-
-      /* struct sigcontext is laid out so that starting at sc_regs mimics a
-	 struct parisc_thread_state.  */
-      memcpy (&scp->sc_parisc_thread_state,
-	      &state->basic, sizeof (state->basic));
-
-      _hurdsig_end_catch_fault ();
-
-      if (! ok)
-	return NULL;
-    }
-
-  /* Modify the thread state to call the trampoline code on the new stack.  */
-  if (rpc_wait)
-    {
-      /* The signalee thread was blocked in a mach_msg_trap system call,
-	 still waiting for a reply.  We will have it run the special
-	 trampoline code which retries the message receive before running
-	 the signal handler.
-
-	 To do this we change the OPTION argument on its stack to enable only
-	 message reception, since the request message has already been
-	 sent.  */
-
-      struct mach_msg_trap_regargs *args = (void *) &state->basic.r23;
-
-      if (_hurdsig_catch_fault (SIGSEGV))
-	{
-	  assert (_hurdsig_fault_sigcode >= (long int) args &&
-		  _hurdsig_fault_sigcode < (long int) (args + 1));
-	  /* Faulted accessing ARGS.  Bomb.  */
-	  return NULL;
-	}
-
-      assert (args->option & MACH_RCV_MSG);
-      /* Disable the message-send, since it has already completed.  The
-	 calls we retry need only wait to receive the reply message.  */
-      args->option &= ~MACH_SEND_MSG;
-
-      /* Limit the time to receive the reply message, in case the server
-	 claimed that `interrupt_operation' succeeded but in fact the RPC
-	 is hung.  */
-      args->option |= MACH_RCV_TIMEOUT;
-      args->timeout = _hurd_interrupted_rpc_timeout;
-
-      _hurdsig_end_catch_fault ();
-
-      MACHINE_THREAD_STATE_SET_PC (&state->basic, &&rpc_wait_trampoline);
-      /* The reply-receiving trampoline code runs initially on the original
-	 user stack.  We pass it the signal stack pointer in %r5.  */
-      state->basic.r5 = (int) sigsp;
-      /* After doing the message receive, the trampoline code will need to
-	 update the %r28 value to be restored by sigreturn.  To simplify
-	 the assembly code, we pass the address of its slot in SCP to the
-	 trampoline code in %r4.  */
-      state->basic.r4 = (unsigned int) &scp->sc_regs[27];
-      /* Set up the arguments for the handler function in callee-saved
-	 registers that we will move to the argument registers after
-	 mach_msg_trap returns.  */
-      state->basic.r6 = signo;
-      state->basic.r7 = sigcode;
-      state->basic.r8 = (unsigned int) scp;
-    }
-  else
-    {
-      MACHINE_THREAD_STATE_SET_PC (&state->basic, &&trampoline);
-      state->basic.r20 = (unsigned int) sigsp;
-      /* Set up the arguments for the handler function.  */
-      state->basic.r26 = signo;
-      state->basic.r25 = sigcode;
-      state->basic.r24 = (unsigned int) scp;
-    }
-
-  /* We pass the handler function to the trampoline code in %r9.  */
-  state->basic.r9 = (unsigned int) handler;
-  /* For convenience, we pass the address of __sigreturn in %r10.  */
-  state->basic.r10 = (unsigned int) &__sigreturn;
-  /* The extra copy of SCP for the __sigreturn arg goes in %r8.  */
-  state->basic.r10 = (unsigned int) scp;
-
-  return scp;
-
-  /* The trampoline code follows.  This is not actually executed as part of
-     this function, it is just convenient to write it that way.  */
-
- rpc_wait_trampoline:
-  /* This is the entry point when we have an RPC reply message to receive
-     before running the handler.  The MACH_MSG_SEND bit has already been
-     cleared in the OPTION argument on our stack.  The interrupted user
-     stack pointer has not been changed, so the system call can find its
-     arguments; the signal stack pointer is in %ebx.  For our convenience,
-     %ecx points to the sc_eax member of the sigcontext.  */
-  asm volatile
-    (/* Retry the interrupted mach_msg system call.  */
-     "ldil L%0xC0000000,%r1\nble 4(%sr7,%r1)\n"
-     "ldi -25, %r22\n"		/* mach_msg_trap */
-     /* When the sigcontext was saved, %r28 was MACH_RCV_INTERRUPTED.  But
-	now the message receive has completed and the original caller of
-	the RPC (i.e. the code running when the signal arrived) needs to
-	see the final return value of the message receive in %r28.  So
-	store the new %r28 value into the sc_regs[27] member of the sigcontext
-	(whose address is in %r4 to make this code simpler).  */
-     "stw (%r4), %r28\n"
-     /* Switch to the signal stack.  */
-     "copy %r5, %r30\n"
-     /* Copy the handler arguments to the argument registers.  */
-     "copy %r6, %r26\n"
-     "copy %r7, %r25\n"
-     "copy %r8, %r24\n"
-     );
-
- trampoline:
-  /* Entry point for running the handler normally.  The arguments to the
-     handler function are already in the argument registers.  */
-  asm volatile
-    ("bv (%r9); nop"		/* Call the handler function.  */
-     "bv (%r10)\n"		/* Call __sigreturn (SCP); never returns.  */
-     "copy %r8, %r26"		/* Set up arg in delay slot.  */
-     : : "i" (&__sigreturn));
-
-  /* NOTREACHED */
-  return NULL;
-}
diff --git a/sysdeps/mach/hurd/i386/Dist b/sysdeps/mach/hurd/i386/Dist
deleted file mode 100644
index 82c44df00b..0000000000
--- a/sysdeps/mach/hurd/i386/Dist
+++ /dev/null
@@ -1,3 +0,0 @@
-static-start.S
-sys/io.h
-ioperm.c
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index caa232026d..f9a7a58deb 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -1,5 +1,6 @@
 /* Initialization code run first thing by the ELF startup code.  For i386/Hurd.
-   Copyright (C) 1995,96,97,98,99,2000,01,02,03,04 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000,01,02,03,04,05
+	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
@@ -54,7 +55,7 @@ extern int __libc_argc attribute_hidden;
 extern char **__libc_argv attribute_hidden;
 extern char **_dl_argv;
 
-void *(*_cthread_init_routine) (void); /* Returns new SP to use.  */
+extern void *(*_cthread_init_routine) (void) __attribute__ ((weak));
 void (*_cthread_exit_routine) (int status) __attribute__ ((__noreturn__));
 
 /* Things that want to be run before _hurd_init or much anything else.
@@ -203,7 +204,7 @@ init (int *data)
      code as the return address, and the argument data immediately above
      that on the stack.  */
 
-  if (_cthread_init_routine)
+  if (&_cthread_init_routine && _cthread_init_routine)
     {
       /* Initialize cthreads, which will allocate us a new stack to run on.  */
       int *newsp = (*_cthread_init_routine) ();
@@ -271,7 +272,7 @@ init (int *data)
       /* The argument data is just above the stack frame we will unwind by
 	 returning.  Mutate our own return address to run the code below.  */
       usercode = data[-1];
-      ((void **) data)[-1] = call_init1;
+      data[-1] = (int) &call_init1;
       /* Force USERCODE into %eax and &init1 into %ecx, which are not
 	 restored by function return.  */
       asm volatile ("# a %0 c %1" : : "a" (usercode), "c" (&init1));
@@ -319,11 +320,11 @@ first_init (void)
    stack set up just as the user will see it, so it can switch stacks.  */
 
 void
-_dl_init_first (int argc, ...)
+_dl_init_first (void)
 {
   first_init ();
 
-  init (&argc);
+  init ((int *) __builtin_frame_address (0) + 2);
 }
 #endif
 
@@ -350,21 +351,23 @@ strong_alias (posixland_init, __libc_init_first);
    This poorly-named function is called by static-start.S,
    which should not exist at all.  */
 void
-_hurd_stack_setup (volatile int argc, ...)
+_hurd_stack_setup (void)
 {
+  intptr_t caller = (intptr_t) __builtin_return_address (0);
+
   void doinit (intptr_t *data)
     {
       /* This function gets called with the argument data at TOS.  */
-      void doinit1 (volatile int argc, ...)
+      void doinit1 (void)
 	{
-	  init ((int *) &argc);
+	  init ((int *) __builtin_frame_address (0) + 2);
 	}
 
       /* Push the user return address after the argument data, and then
          jump to `doinit1' (above), so it is as if __libc_init_first's
          caller had called `doinit1' with the argument data already on the
          stack.  */
-      *--data = (&argc)[-1];
+      *--data = caller;
       asm volatile ("movl %0, %%esp\n" /* Switch to new outermost stack.  */
 		    "movl $0, %%ebp\n" /* Clear outermost frame pointer.  */
 		    "jmp *%1" : : "r" (data), "r" (&doinit1) : "sp");
@@ -373,7 +376,7 @@ _hurd_stack_setup (volatile int argc, ...)
 
   first_init ();
 
-  _hurd_startup ((void **) &argc, &doinit);
+  _hurd_startup ((void **) __builtin_frame_address (0) + 2, &doinit);
 }
 #endif
 
diff --git a/sysdeps/mach/hurd/i386/longjmp-ts.c b/sysdeps/mach/hurd/i386/longjmp-ts.c
index 586ce6b015..c902002cbc 100644
--- a/sysdeps/mach/hurd/i386/longjmp-ts.c
+++ b/sysdeps/mach/hurd/i386/longjmp-ts.c
@@ -1,5 +1,5 @@
 /* Perform a `longjmp' on a Mach thread_state.  i386 version.
-   Copyright (C) 1991, 1994, 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1994, 1995, 1997, 2006 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
@@ -19,6 +19,7 @@
 
 #include <hurd/signal.h>
 #include <setjmp.h>
+#include <jmpbuf-offsets.h>
 #include <mach/thread_status.h>
 
 
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
index ff849716e0..223a47d2f2 100644
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
@@ -98,7 +98,7 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
     {
       /* Fetch the selector set by the first call.  */
       int sel;
-      asm ("mov %%gs, %w0" : "=q" (sel));
+      asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
       if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */
 	{
 	  error_t err = __i386_set_ldt (tcb->self, sel, &desc, 1);
@@ -151,7 +151,7 @@ _hurd_tls_fork (thread_t child, struct i386_thread_state *state)
 {
   /* Fetch the selector set by _hurd_tls_init.  */
   int sel;
-  asm ("mov %%gs, %w0" : "=q" (sel));
+  asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
   if (sel == state->ds)		/* _hurd_tls_init was never called.  */
     return 0;
 
diff --git a/sysdeps/mach/hurd/i386/trampoline.c b/sysdeps/mach/hurd/i386/trampoline.c
index 781a0441dc..dddc6f3ef6 100644
--- a/sysdeps/mach/hurd/i386/trampoline.c
+++ b/sysdeps/mach/hurd/i386/trampoline.c
@@ -1,5 +1,6 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  i386 version.
-   Copyright (C) 1994, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1994,1995,1996,1997,1998,1999,2005
+	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
@@ -19,11 +20,11 @@
 
 #include <hurd/signal.h>
 #include <hurd/userlink.h>
-#include "thread_state.h"
+#include <thread_state.h>
 #include <assert.h>
 #include <errno.h>
 #include "hurdfault.h"
-#include "intr-msg.h"
+#include <intr-msg.h>
 
 
 struct sigcontext *
diff --git a/sysdeps/mach/hurd/ifreq.c b/sysdeps/mach/hurd/ifreq.c
new file mode 100644
index 0000000000..9da8a6803a
--- /dev/null
+++ b/sysdeps/mach/hurd/ifreq.c
@@ -0,0 +1,65 @@
+/* Fetch the host's network interface list.  Hurd version.
+   Copyright (C) 2002,2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <ifreq.h>
+#include <hurd.h>
+#include <hurd/pfinet.h>
+#include <sys/mman.h>
+
+
+void
+__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
+{
+  file_t server;
+
+  server = _hurd_socket_server (PF_INET, 0);
+  if (server == MACH_PORT_NULL)
+    {
+    out:
+      *num_ifs = 0;
+      *ifreqs = NULL;
+    }
+  else
+    {
+      char *data = NULL;
+      size_t len = 0;
+      error_t err = __pfinet_siocgifconf (server, -1, &data, &len);
+      if (err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED)
+	{
+	  /* On the first use of the socket server during the operation,
+	     allow for the old server port dying.  */
+	  server = _hurd_socket_server (PF_INET, 1);
+	  if (server == MACH_PORT_NULL)
+	    goto out;
+	  err = __pfinet_siocgifconf (server, -1, (data_t *) ifreqs, &len);
+	}
+      if (err)
+	goto out;
+
+      if (len % sizeof (struct ifreq) != 0)
+	{
+	  munmap (data, len);
+	  errno = EGRATUITOUS;
+	  goto out;
+	}
+      *num_ifs = len / sizeof (struct ifreq);
+      *ifreqs = (struct ifreq *) data;
+    }
+
+}
diff --git a/sysdeps/mach/hurd/ifreq.h b/sysdeps/mach/hurd/ifreq.h
deleted file mode 100644
index 77f0b9cac0..0000000000
--- a/sysdeps/mach/hurd/ifreq.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Fetch the host's network interface list.  Hurd version.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <net/if.h>
-#include <hurd.h>
-#include <hurd/pfinet.h>
-#include <sys/socket.h>
-#include <sys/mman.h>
-
-
-static inline void
-__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
-{
-  file_t server;
-
-  server = _hurd_socket_server (PF_INET, 0);
-  if (server == MACH_PORT_NULL)
-    {
-    out:
-      *num_ifs = 0;
-      *ifreqs = NULL;
-    }
-  else
-    {
-      char *data = NULL;
-      size_t len = 0;
-      error_t err = __pfinet_siocgifconf (server, -1, &data, &len);
-      if (err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED)
-	{
-	  /* On the first use of the socket server during the operation,
-	     allow for the old server port dying.  */
-	  server = _hurd_socket_server (PF_INET, 1);
-	  if (server == MACH_PORT_NULL)
-	    goto out;
-	  err = __pfinet_siocgifconf (server, -1, (data_t *) ifreqs, &len);
-	}
-      if (err)
-	goto out;
-
-      if (len % sizeof (struct ifreq) != 0)
-	{
-	  munmap (data, len);
-	  errno = EGRATUITOUS;
-	  goto out;
-	}
-      *num_ifs = len / sizeof (struct ifreq);
-      *ifreqs = (struct ifreq *) data;
-    }
-
-}
-
-
-static inline struct ifreq *
-__if_nextreq (struct ifreq *ifr)
-{
-  return ifr + 1;
-}
-
-
-static inline void
-__if_freereq (struct ifreq *ifreqs, int num_ifs)
-{
-  __munmap (ifreqs, num_ifs * sizeof (struct ifreq));
-}
diff --git a/sysdeps/mach/hurd/init-posix.c b/sysdeps/mach/hurd/init-posix.c
index 3eecf62769..eaf6332fe1 100644
--- a/sysdeps/mach/hurd/init-posix.c
+++ b/sysdeps/mach/hurd/init-posix.c
@@ -1,2 +1,2 @@
 /* We don't need the unix/bsd version.  */
-#include <sysdeps/generic/init-posix.c>
+#include <posix/init-posix.c>
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index 3d590d5845..bcc78bc84e 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,93,94,95,96,97,99,2000,02 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,94,95,96,97,99,2000,2002,2005
+	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
@@ -57,7 +58,16 @@ __ioctl (int fd, unsigned long int request, ...)
   struct
   {
 #ifdef MACH_MSG_TYPE_BIT
-    mig_reply_header_t header;
+    union
+    {
+      mig_reply_header_t header;
+      struct
+      {
+	mach_msg_header_t	Head;
+	int			RetCodeType;
+	kern_return_t		RetCode;
+      } header_typecheck;
+    };
     char data[3 * sizeof (mach_msg_type_t) +
 	     msg_align (_IOT_COUNT0 (type) * typesize (_IOT_TYPE0 (type))) +
 	     msg_align (_IOT_COUNT1 (type) * typesize (_IOT_TYPE1 (type))) +
@@ -136,9 +146,11 @@ __ioctl (int fd, unsigned long int request, ...)
 	     Rather than pointing to the value, ARG is the value itself.  */
 #ifdef MACH_MSG_TYPE_BIT
 	  *t++ = io2mach_type (1, _IOTS (integer_t));
-	  *((integer_t *) t)++ = (integer_t) arg;
+	  *(integer_t *) t = (integer_t) arg;
+	  t = (void *) t + sizeof (integer_t);
 #else
-	  *((integer_t *) p)++ = (integer_t) arg;
+	  *(integer_t *) p = (integer_t) arg;
+	  p = (void *) p + sizeof (integer_t);
 #endif
 	}
 
@@ -189,7 +201,7 @@ __ioctl (int fd, unsigned long int request, ...)
 	return MIG_TYPE_ERROR;
 
 #ifdef MACH_MSG_TYPE_BIT
-      if (*(int *) &msg.header.RetCodeType !=
+      if (msg.header_typecheck.RetCodeType !=
 	  ((union { mach_msg_type_t t; int i; })
 	   { t: io2mach_type (1, _IOTS (msg.header.RetCode)) }).i)
 	return MIG_TYPE_ERROR;
diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c
index 4624ad9e26..e0e16e28b2 100644
--- a/sysdeps/mach/hurd/jmp-unwind.c
+++ b/sysdeps/mach/hurd/jmp-unwind.c
@@ -1,5 +1,5 @@
 /* _longjmp_unwind -- Clean up stack frames unwound by longjmp.  Hurd version.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995,1996,2005,2006 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
@@ -17,17 +17,27 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <setjmp.h>
+#include <jmpbuf-unwind.h>
 #include <hurd/userlink.h>
 #include <hurd/signal.h>
 #include <hurd/sigpreempt.h>
 #include <assert.h>
+#include <stdint.h>
 
 
 #ifndef _JMPBUF_UNWINDS
-#error "<bits/setjmp.h> fails to define _JMPBUF_UNWINDS"
+#error "<jmpbuf-unwind.h> fails to define _JMPBUF_UNWINDS"
 #endif
 
+static inline uintptr_t
+demangle_ptr (uintptr_t x)
+{
+# ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (x);
+# endif
+  return x;
+}
+
 /* This function is called by `longjmp' (with its arguments) to restore
    active resources to a sane state before the frames code using them are
    jumped out of.  */
@@ -46,7 +56,7 @@ _longjmp_unwind (jmp_buf env, int val)
 
   /* Remove local signal preemptors being unwound past.  */
   while (ss->preemptors &&
-	 _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors))
+	 _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors, demangle_ptr))
     ss->preemptors = ss->preemptors->next;
 
   __spin_unlock (&ss->lock);
@@ -56,7 +66,7 @@ _longjmp_unwind (jmp_buf env, int val)
      in stack frames being unwound by this jump.  */
 
   for (link = ss->active_resources;
-       link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link);
+       link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link, demangle_ptr);
        link = link->thread.next)
     /* Remove this link from the resource's users list,
        since the frame using the resource is being unwound.
diff --git a/sysdeps/mach/hurd/lgetxattr.c b/sysdeps/mach/hurd/lgetxattr.c
new file mode 100644
index 0000000000..5ab591575e
--- /dev/null
+++ b/sysdeps/mach/hurd/lgetxattr.c
@@ -0,0 +1,36 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <fcntl.h>
+
+ssize_t
+lgetxattr (const char *path, const char *name, void *value, size_t size)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, O_NOLINK, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_get (port, name, value, &size);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return err ? __hurd_fail (err) : size;
+}
diff --git a/sysdeps/mach/hurd/linkat.c b/sysdeps/mach/hurd/linkat.c
new file mode 100644
index 0000000000..1942144e0f
--- /dev/null
+++ b/sysdeps/mach/hurd/linkat.c
@@ -0,0 +1,66 @@
+/* Make a link between file names relative to open directories.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+
+/* Make a link to FROM relative to FROMFD called TO relative to TOFD.  */
+int
+linkat (fromfd, from, tofd, to, flags)
+     int fromfd;
+     const char *from;
+     int tofd;
+     const char *to;
+     int flags;
+{
+  error_t err;
+  file_t oldfile, linknode, todir;
+  char *toname;
+
+  oldfile = __file_name_lookup_at (fromfd, flags, from, 0, 0);
+  if (oldfile == MACH_PORT_NULL)
+    return -1;
+
+  /* The file_getlinknode RPC returns the port that should be passed to
+     the receiving filesystem (the one containing TODIR) in dir_link.  */
+
+  err = __file_getlinknode (oldfile, &linknode);
+  __mach_port_deallocate (__mach_task_self (), oldfile);
+  if (err)
+    return __hurd_fail (err);
+
+  todir = __file_name_split_at (tofd, to, &toname);
+  if (todir != MACH_PORT_NULL)
+    {
+      err = __dir_link (todir, linknode, toname, 1);
+      __mach_port_deallocate (__mach_task_self (), todir);
+    }
+  __mach_port_deallocate (__mach_task_self (), linknode);
+  if (todir == MACH_PORT_NULL)
+    return -1;
+
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
diff --git a/sysdeps/mach/hurd/listxattr.c b/sysdeps/mach/hurd/listxattr.c
new file mode 100644
index 0000000000..5f84e88316
--- /dev/null
+++ b/sysdeps/mach/hurd/listxattr.c
@@ -0,0 +1,35 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+
+ssize_t
+listxattr (const char *path, char *list, size_t size)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_list (port, list, &size);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return err ? __hurd_fail (err) : size;
+}
diff --git a/sysdeps/mach/hurd/lsetxattr.c b/sysdeps/mach/hurd/lsetxattr.c
new file mode 100644
index 0000000000..c2eae40e3a
--- /dev/null
+++ b/sysdeps/mach/hurd/lsetxattr.c
@@ -0,0 +1,37 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+#include <fcntl.h>
+
+ssize_t
+lsetxattr (const char *path, const char *name, const void *value, size_t size,
+	   int flags)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, O_NOLINK, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_set (port, name, value, size, flags);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return err ? __hurd_fail (err) : size;
+}
diff --git a/sysdeps/mach/hurd/mig-reply.c b/sysdeps/mach/hurd/mig-reply.c
index 78bac4bffc..5e40c147b4 100644
--- a/sysdeps/mach/hurd/mig-reply.c
+++ b/sysdeps/mach/hurd/mig-reply.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1995,1996,1997,2005 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
@@ -22,7 +22,7 @@
 #define GETPORT \
   mach_port_t *portloc = \
     (mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY)
-#define reply_port (use_threadvar ? *portloc : global_reply_port)
+#define reply_port (*(use_threadvar ? portloc : &global_reply_port))
 
 static int use_threadvar;
 static mach_port_t global_reply_port;
diff --git a/sysdeps/mach/hurd/mips/Dist b/sysdeps/mach/hurd/mips/Dist
deleted file mode 100644
index b6f3ffa4c3..0000000000
--- a/sysdeps/mach/hurd/mips/Dist
+++ /dev/null
@@ -1,3 +0,0 @@
-longjmp-ctx.c
-init-fault.c
-dl-machine.c
diff --git a/sysdeps/mach/hurd/mips/bits/sigcontext.h b/sysdeps/mach/hurd/mips/bits/sigcontext.h
deleted file mode 100644
index 14c618857e..0000000000
--- a/sysdeps/mach/hurd/mips/bits/sigcontext.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Machine-dependent signal context structure for GNU Hurd.  MIPS version.
-   Copyright (C) 1994,97,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-#ifndef sc_mips_thread_state
-
-/* Signal handlers are actually called:
-   void handler (int sig, int code, struct sigcontext *scp);  */
-
-/* State of this thread when the signal was taken.  */
-struct sigcontext
-  {
-    /* These first members are machine-independent.  */
-
-    int sc_onstack;		/* Nonzero if running on sigstack.  */
-    __sigset_t sc_mask;		/* Blocked signals to restore.  */
-
-    /* MiG reply port this thread is using.  */
-    unsigned int sc_reply_port;
-
-    /* Port this thread is doing an interruptible RPC on.  */
-    unsigned int sc_intr_port;
-
-    /* Error code associated with this signal (interpreted as `error_t').  */
-    int sc_error;
-
-    /* All following members are machine-dependent.  The rest of this
-       structure is written to be laid out identically to:
-	{
-	  struct mips_thread_state ts;
-	  struct mips_exc_state es;
-	  struct mips_float_state fs;
-	}
-       trampoline.c knows this, so it must be changed if this changes.  */
-#define	sc_mips_thread_state sc_gpr /* Beginning of correspondence.  */
-    int sc_gpr[31];		/* "General" registers; [0] is r1.  */
-    int sc_mdlo, sc_mdhi;	/* Low and high multiplication results.  */
-    int sc_pc;			/* Instruction pointer.  */
-
-    /* struct mips_exc_state */
-#define sc_mips_exc_state sc_cause
-    unsigned int sc_cause;	/* Machine-level trap code.  */
-#define SC_CAUSE_SST	0x00000044
-    unsigned int sc_badvaddr;
-    unsigned int sc_coproc_used; /* Which coprocessors the thread has used.  */
-#define SC_COPROC_USE_COP0	1 /* (by definition) */
-#define SC_COPROC_USE_COP1	2 /* FPA */
-#define	SC_COPROC_USE_FPU	SC_COPROC_USE_COP1
-#define SC_COPROC_USE_COP2	4
-#define SC_COPROC_USE_COP3	8
-
-    /* struct mips_float_state
-       This is only filled in if the SC_COPROC_USE_FPU bit
-       is set in sc_coproc_used.  */
-#define sc_mips_float_state sc_fpr
-    int sc_fpr[32];		/* FP registers.  */
-    int sc_fpcsr;		/* FPU status register.  */
-    int sc_fpeir;		/* FP exception instruction register.  */
-  };
-
-#endif /* sc_mips_thread_state */
diff --git a/sysdeps/mach/hurd/mips/dl-machine.c b/sysdeps/mach/hurd/mips/dl-machine.c
deleted file mode 100644
index ce2d5db510..0000000000
--- a/sysdeps/mach/hurd/mips/dl-machine.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Operating system support for run-time dynamic linker.  MIPS specific
-   stuffs on Hurd.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd.h>
-#include <link.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <assert.h>
-#include <sysdep.h>
-#include <mach/mig_support.h>
-#include "../stdio-common/_itoa.h"
-#include <stdarg.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <libintl.h>
-
-void weak_function
-abort (void)
-{
-  _exit (127);
-}
-
-
-#include <string.h>
-#include <mach/error.h>
-#include <errorlib.h>
-
-#undef _
-#define _(x) x
-
-/* Return a string describing the errno code in ERRNUM.  */
-char * weak_function
-_strerror_internal (int errnum, char *buf, size_t buflen)
-{
-  int system;
-  int sub;
-  int code;
-  const struct error_system *es;
-  extern void __mach_error_map_compat (int *);
-
-  __mach_error_map_compat (&errnum);
-
-  system = err_get_system (errnum);
-  sub = err_get_sub (errnum);
-  code = err_get_code (errnum);
-
-  if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
-    {
-      const char *unk = _("Error in unknown error system: ");
-      const size_t unklen = strlen (unk);
-      char *p = buf + buflen;
-      *--p = '\0';
-      p = _itoa (errnum, p, 16, 1);
-      return memcpy (p - unklen, unk, unklen);
-    }
-
-  es = &__mach_error_systems[system];
-
-  if (sub >= es->max_sub)
-    return (char *) es->bad_sub;
-
-  if (code >= es->subsystem[sub].max_code)
-    {
-      const char *unk = _("Unknown error ");
-      const size_t unklen = strlen (unk);
-      char *p = buf + buflen;
-      size_t len = strlen (es->subsystem[sub].subsys_name);
-      *--p = '\0';
-      p = _itoa (errnum, p, 16, 1);
-      *p-- = ' ';
-      p = memcpy (p - len, es->subsystem[sub].subsys_name, len);
-      return memcpy (p - unklen, unk, unklen);
-    }
-
-  return (char *) _(es->subsystem[sub].codes[code]);
-}
-
-/* Read the whole contents of FILE into new mmap'd space with given
-   protections.  The size of the file is returned in SIZE.  */
-void *
-_dl_sysdep_read_whole_file (const char *file, size_t *size, int prot)
-{
-  struct stat stat;
-  mach_port_t memobj_rd;
-  void *contents;
-  error_t err;
-
-  memobj_rd = __open (file, O_RDONLY, 0);
-  if (memobj_rd)
-    {
-      err = __io_stat ((file_t) memobj_rd, &stat);
-      if (err)
-	{
-	  __hurd_fail (err);
-	  contents = 0;
-	}
-      else
-	{
-	  /* Map a copy of the file contents.  */
-	  contents = __mmap (0, stat.st_size, prot, MAP_COPY, memobj_rd, 0);
-	  if (contents == (void *)-1)
-	    contents = 0;
-	  else
-	    *size = stat.st_size;
-	}
-
-      __mach_port_deallocate (__mach_task_self (), memobj_rd);
-    }
-  else
-    contents = 0;
-
-  return contents;
-}
diff --git a/sysdeps/mach/hurd/mips/exc2signal.c b/sysdeps/mach/hurd/mips/exc2signal.c
deleted file mode 100644
index c505ae5b22..0000000000
--- a/sysdeps/mach/hurd/mips/exc2signal.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Translate Mach exception codes into signal numbers.  MIPS version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd.h>
-#include <hurd/signal.h>
-#include <mach/exception.h>
-
-/* Translate the Mach exception codes, as received in an `exception_raise' RPC,
-   into a signal number and signal subcode.  */
-
-void
-_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
-{
-  detail->error = 0;
-
-  switch (detail->exc)
-    {
-    default:
-      *signo = SIGIOT;
-      detail->code = detail->exc;
-      break;
-      
-    case EXC_BAD_ACCESS:
-      if (detail->exc_code == KERN_PROTECTION_FAILURE)
-	*signo = SIGSEGV;
-      else
-	*signo = SIGBUS;
-      detail->code = detail->exc_subcode;
-      detail->error = detail->exc_code;
-      break;
-
-    case EXC_BAD_INSTRUCTION:
-      *signo = SIGILL;
-      if (detail->exc_code == EXC_MIPS_II)
-	detail->code = detail->exc_subcode;
-      else
-	detail->code = 0;
-      break;
-      
-    case EXC_ARITHMETIC:
-      switch (detail->exc_code)
-	{
-	case EXC_MIPS_OV:	/* integer overflow */
-	  *signo = SIGFPE;
-	  detail->code = detail->exc_subcode;
-	  break;
-
-	default:
-	  *signo = SIGFPE;
-	  detail->code = 0;
-	  break;
-
-	case EXC_MIPS_INT:
-	  /* Subcode is the fp_status word saved by the hardware.
-	     Give an error code corresponding to the first bit set.  */
-	  if (detail->exc_subcode == EXC_MIPS_FLT_UNIMP)
-	    *signo = SIGILL;
-	  else
-	    *signo = SIGFPE;
-	  detail->code = detail->exc_subcode;
-	  break;
-	}
-      break;
-
-    case EXC_EMULATION:		
-      /* 3.0 doesn't give this one, why, I don't know.  */
-      *signo = SIGEMT;
-      detail->code = 0;
-      break;
-
-    case EXC_SOFTWARE:
-      *signo = SIGEMT;
-      detail->code = 0;
-      break;
-      
-    case EXC_BREAKPOINT:
-      *signo = SIGTRAP;
-      detail->code = 0;
-      break;
-    }
-}
diff --git a/sysdeps/mach/hurd/mips/init-fault.c b/sysdeps/mach/hurd/mips/init-fault.c
deleted file mode 100644
index 05f48a3a56..0000000000
--- a/sysdeps/mach/hurd/mips/init-fault.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Set up a thread_state for proc_handle_exceptions.  MIPS version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd/signal.h>
-#include <mach/thread_status.h>
-#include <string.h>
-#include <setjmp.h>
-
-extern jmp_buf _hurd_sigthread_fault_env;
-
-static char fault_stack[32];
-static volatile void
-faulted (void)
-{
-  __longjmp (_hurd_sigthread_fault_env, 1);
-}
-
-void
-_hurd_initialize_fault_recovery_state (void *state)
-{
-  struct mips_thread_state *ts = state;
-  memset (ts, 0, sizeof (*ts));
-  ts->r29 = (int) &fault_stack[sizeof (fault_stack)];
-  ts->pc = (int) &faulted;
-}
diff --git a/sysdeps/mach/hurd/mips/init-first.c b/sysdeps/mach/hurd/mips/init-first.c
deleted file mode 100644
index 6f53e839b3..0000000000
--- a/sysdeps/mach/hurd/mips/init-first.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* Initialization code run first thing by the ELF startup code.  For Mips/Hurd.
-   Copyright (C) 1996,1997,1998,2000,01,02,03 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include "hurdstartup.h"
-#include "set-hooks.h"
-#include "hurdmalloc.h"		/* XXX */
-
-extern void __mach_init (void);
-extern void __init_misc (int, char **, char **);
-#ifdef USE_NONOPTION_FLAGS
-extern void __getopt_clean_environment (char **);
-#endif
-#ifndef SHARED
-extern void _dl_non_dynamic_init (void) internal_function;
-#endif
-extern void __libc_global_ctors (void);
-
-unsigned int __hurd_threadvar_max;
-unsigned long int __hurd_threadvar_stack_offset;
-unsigned long int __hurd_threadvar_stack_mask;
-
-int __libc_multiple_libcs attribute_hidden = 1;
-
-int __libc_argc attribute_hidden;
-char **__libc_argv attribute_hidden;
-
-void *(*_cthread_init_routine) (void); /* Returns new SP to use.  */
-void (*_cthread_exit_routine) (int status) __attribute__ ((__noreturn__));
-
-
-/* Things that want to be run before _hurd_init or much anything else.
-   Importantly, these are called before anything tries to use malloc.  */
-DEFINE_HOOK (_hurd_preinit_hook, (void));
-
-static void
-init1 (int argc, char *arg0, ...)
-{
-  char **argv = &arg0;
-  char **envp = &argv[argc + 1];
-  struct hurd_startup_data *d;
-
-  __libc_argc = argc;
-  __libc_argv = argv;
-  __environ = envp;
-  while (*envp)
-    ++envp;
-  d = (void *) ++envp;
-
-  /* If we are the bootstrap task started by the kernel,
-     then after the environment pointers there is no Hurd
-     data block; the argument strings start there.  */
-  if ((void *) d != argv[0])
-    {
-      _hurd_init_dtable = d->dtable;
-      _hurd_init_dtablesize = d->dtablesize;
-
-      {
-	/* Check if the stack we are now on is different from
-	   the one described by _hurd_stack_{base,size}.  */
-
-	char dummy;
-	const vm_address_t newsp = (vm_address_t) &dummy;
-
-	if (d->stack_size != 0 && (newsp < d->stack_base ||
-				   newsp - d->stack_base > d->stack_size))
-	  /* The new stack pointer does not intersect with the
-	     stack the exec server set up for us, so free that stack.  */
-	  __vm_deallocate (__mach_task_self (), d->stack_base, d->stack_size);
-      }
-    }
-
-  if (__hurd_threadvar_stack_mask == 0)
-    {
-      /* We are not using cthreads, so we will have just a single allocated
-	 area for the per-thread variables of the main user thread.  */
-      unsigned long int i;
-      __hurd_threadvar_stack_offset
-	= (unsigned long int) malloc (__hurd_threadvar_max *
-				      sizeof (unsigned long int));
-      if (__hurd_threadvar_stack_offset == 0)
-	__libc_fatal ("Can't allocate single-threaded per-thread variables.");
-      for (i = 0; i < __hurd_threadvar_max; ++i)
-	((unsigned long int *) __hurd_threadvar_stack_offset)[i] = 0;
-    }
-
-  if ((void *) d != argv[0] && (d->portarray || d->intarray))
-    /* Initialize library data structures, start signal processing, etc.  */
-    _hurd_init (d->flags, argv,
-		d->portarray, d->portarraysize,
-		d->intarray, d->intarraysize);
-
-#ifndef SHARED
-  _dl_non_dynamic_init ();
-#endif
-  __init_misc (argc, argv, __environ);
-
-#ifdef USE_NONOPTION_FLAGS
-  /* This is a hack to make the special getopt in GNU libc working.  */
-  __getopt_clean_environment (envp);
-#endif
-
-#ifdef SHARED
-  __libc_global_ctors ();
-#endif
-
-  (void) &init1;
-}
-
-static void *
-__init (int *data)
-{
-  int argc = *data;
-  char **argv = (void *) (data + 1);
-  char **envp = &argv[argc + 1];
-  struct hurd_startup_data *d;
-
-  __environ = envp;
-  while (*envp)
-    ++envp;
-  d = (void *) ++envp;
-
-  /* The user might have defined a value for this, to get more variables.
-     Otherwise it will be zero on startup.  We must make sure it is set
-     properly before before cthreads initialization, so cthreads can know
-     how much space to leave for thread variables.  */
-  if (__hurd_threadvar_max < _HURD_THREADVAR_MAX)
-    __hurd_threadvar_max = _HURD_THREADVAR_MAX;
-
-
-  /* After possibly switching stacks, call `init1' (above) with the user
-     code as the return address, and the argument data immediately above
-     that on the stack.  */
-
-  if (_cthread_init_routine)
-    {
-      /* Initialize cthreads, which will allocate us a new stack to run on.  */
-      void *newsp = (*_cthread_init_routine) ();
-      struct hurd_startup_data *od;
-
-      /* Copy the argdata from the old stack to the new one.  */
-      newsp = memcpy (newsp - ((char *) &d[1] - (char *) data), data,
-		      (char *) d - (char *) data);
-
-      /* Set up the Hurd startup data block immediately following
-	 the argument and environment pointers on the new stack.  */
-      od = (newsp + ((char *) d - (char *) data));
-      if ((void *) argv[0] == d)
-	/* We were started up by the kernel with arguments on the stack.
-	   There is no Hurd startup data, so zero the block.  */
-	memset (od, 0, sizeof *od);
-      else
-	/* Copy the Hurd startup data block to the new stack.  */
-	*od = *d;
-
-      /* Push the user code address on the top of the new stack.  It will
-	 be the return address for `init1'; we will jump there with NEWSP
-	 as the stack pointer.  */
-      return newsp;
-    }
-
-  /* The argument data is just above the stack frame we will unwind by
-     returning.  */
-  return (void *) data;
-
-  (void) &__init;
-}
-
-#ifdef SHARED
-/* This function is called to initialize the shared C library.
-   It is called just before the user _start code from mips/elf/start.S,
-   with the stack set up as that code gets it.  */
-
-/* NOTE!  The linker notices the magical name `_init' and sets the DT_INIT
-   pointer in the dynamic section based solely on that.  It is convention
-   for this function to be in the `.init' section, but the symbol name is
-   the only thing that really matters!!  */
-/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
-
-#if __mips64
-asm ("\
-	.section .init,\"ax\",@progbits\n\
-	.align 3\n\
-	.globl _init\n\
-	.type _init,@function\n\
-	.ent _init\n\
-_init:\n\
-	.set noreorder\n\
-	.cpload $25\n\
-	.set reorder\n\
-	dsubu $29, 8*8\n\
-	.cprestore 6*8\n\
-	sd $16, 4*8($29)\n\
-	sd $31, 5*8($29)\n\
-	jal preinit\n\
-	sd $28, 6*8($29)\n\
-	move $16, $29 # Save the old stack pointer to s0 ($16)\n\
-	daddu $4, $29, 4*8\n\
-	jal __init\n\
-	# Restore saved registers from the old stack.\n\
-	ld $28, 6*8($16)\n\
-	ld $31, 5*8($16)\n\
-	ld $16, 4*8($16)\n\
-	move $29, $2 # set new sp to SP\n\
-call_init1:\n\
-	ld $4, 0($29)\n\
-	ld $5, 1*8($29)\n\
-	ld $6, 2*8($29)\n\
-	ld $7, 3*8($29)\n\
-	dla $25, init1\n\
-	jr $25\n\
-	.end _init\n\
-	.text\n\
-");
-#else
-asm ("\
-	.section .init,\"ax\",@progbits\n\
-	.align 2\n\
-	.globl _init\n\
-	.type _init,@function\n\
-	.ent _init\n\
-_init:\n\
-	.set noreorder\n\
-	.cpload $25\n\
-	.set reorder\n\
-	subu $29, 32\n\
-	.cprestore 24\n\
-	sw $16, 16($29)\n\
-	sw $31, 20($29)\n\
-	jal preinit\n\
-	sw $28, 24($29)\n\
-	move $16, $29 # Save the old stack pointer to s0 ($16)\n\
-	addu $4, $29, 32\n\
-	jal __init\n\
-	# Restore saved registers from the old stack.\n\
-	lw $28, 24($16)\n\
-	lw $31, 20($16)\n\
-	lw $16, 16($16)\n\
-	move $29, $2 # set new sp to SP\n\
-call_init1:\n\
-	lw $4, 0($29)\n\
-	lw $5, 4($29)\n\
-	lw $6, 8($29)\n\
-	lw $7, 12($29)\n\
-	la $25, init1\n\
-	jr $25\n\
-	.end _init\n\
-	.text\n\
-");
-#endif
-
-static void
-preinit (void)
-{
-  /* Initialize data structures so we can do RPCs.  */
-  __mach_init ();
-
-  RUN_HOOK (_hurd_preinit_hook, ());
-
-  (void) &preinit;
-}
-
-void __libc_init_first (int argc, ...)
-{
-}
-#endif
-
-#ifndef SHARED
-/* An assembler code wrapping c function __init.  */
-#ifdef __mips64
-asm ("\
-	.text\n\
-	.align 3\n\
-init:\n\
-	dsubu $29, 8*8\n\
-	sd $16, 4*8($29)\n\
-	sd $31, 5*8($29)\n\
-	move $16, $29\n\
-	jal __init\n\
-	ld $31, 5*8($16)\n\
-	ld $16, 4*8($16)\n\
-	move $29, $2 # set new sp to SP\n\
-call_init1:\n\
-	ld $4, 0($29)\n\
-	ld $5, 1*8($29)\n\
-	ld $6, 2*8($29)\n\
-	ld $7, 3*8($29)\n\
-	dla $25, init1\n\
-	jr $25\n\
-");
-#else
-asm ("\
-	.text\n\
-	.align 2\n\
-init:\n\
-	subu $29, 32\n\
-	sw $16, 16($29)\n\
-	sw $31, 20($29)\n\
-	move $16, $29\n\
-	jal __init\n\
-	lw $31, 20($16)\n\
-	lw $16, 16($16)\n\
-	move $29, $2 # set new sp to SP\n\
-call_init1:\n\
-	lw $4, 0($29)\n\
-	lw $5, 4($29)\n\
-	lw $6, 8($29)\n\
-	lw $7, 12($29)\n\
-	la $25, init1\n\
-	jr $25\n\
-");
-#endif
-
-/* An assembler code wrapping c function ___libc_init_first.
-   ___libc_init_first does an RPC call to flush cache to put doinit
-   function on the stack, so we should call __mach_init first in
-   this wrap. */
-#ifdef __mips64
-asm ("\
-	.text\n\
-	.align 3\n\
-	.globl __libc_init_first\n\
-__libc_init_first:\n\
-	dsubu $29, 8\n\
-	sd $31, 0($29)\n\
-	jal __mach_init\n\
-	ld $4, 0($29)\n\
-	ld $5, 1*8($29)\n\
-	ld $6, 2*8($29)\n\
-	ld $7, 3*8($29)\n\
-	j ___libc_init_first\n\
-");
-#else
-asm ("\
-	.text\n\
-	.align 2\n\
-	.globl __libc_init_first\n\
-__libc_init_first:\n\
-	subu $29, 4\n\
-	sw $31, 0($29)\n\
-	jal __mach_init\n\
-	lw $4, 0($29)\n\
-	lw $5, 4($29)\n\
-	lw $6, 8($29)\n\
-	lw $7, 12($29)\n\
-	j ___libc_init_first\n\
-");
-#endif
-
-static void
-___libc_init_first (int return_addr, int argc, ...)
-{
-  void doinit (int *data)
-    {
-#if 0
-      /* This function gets called with the argument data at TOS.  */
-      void doinit1 (int argc, ...)
-	{
-	  init (&argc);
-	}
-#endif
-      extern void init (int *data);
-
-      /* Push the user return address after the argument data, and then
-	 jump to `doinit1' (above), so it is as if __libc_init_first's
-	 caller had called `init' with the argument data already on the
-	 stack.  */
-      *--data = return_addr;
-
-#ifdef __mips64
-      asm volatile ("ld $31, 0(%0)\n" /* Load the original return address.  */
-		    "daddu $29, %0, 8\n" /* Switch to new outermost stack.  */
-		    "move $4, $29\n"
-		    "jr %1" : : "r" (data), "r" (&init));
-#else
-      asm volatile ("lw $31, 0(%0)\n" /* Load the original return address.  */
-		    "addu $29, %0, 4\n" /* Switch to new outermost stack.  */
-		    "move $4, $29\n"
-		    "jr %1" : : "r" (data), "r" (&init));
-#endif
-      /* NOTREACHED */
-    }
-
-#if 0
-  /* Initialize data structures so we can do RPCs.  */
-  __mach_init ();
-#endif
-
-  RUN_HOOK (_hurd_preinit_hook, ());
-
-  _hurd_startup ((void **) &argc, &doinit);
-
-  (void) &___libc_init_first;
-}
-#endif
diff --git a/sysdeps/mach/hurd/mips/intr-msg.h b/sysdeps/mach/hurd/mips/intr-msg.h
deleted file mode 100644
index 16c78972ac..0000000000
--- a/sysdeps/mach/hurd/mips/intr-msg.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Machine-dependent details of interruptible RPC messaging.  Mips version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#ifdef __mips64
-#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
-({									      \
-  error_t err;								      \
-  mach_port_t __rcv_name = (rcv_name);					      \
-  mach_msg_timeout_t __timeout = (timeout);	       			      \
-  mach_port_t __notify = (notify);					      \
-  asm (".globl _hurd_intr_rpc_msg_do_trap\n" 				      \
-       ".globl _hurd_intr_rpc_msg_in_trap\n"				      \
-       "				move $4, %1\n"			      \
-       "				move $5, %2\n"			      \
-       "				move $6, %3\n"			      \
-       "				move $7, %4\n"			      \
-       "				move $8, %5\n"			      \
-       "				move $9, %6\n"			      \
-       "				move $10, %7\n"			      \
-       "				dli $2, -25\n"			      \
-       "_hurd_intr_rpc_msg_do_trap:	syscall\n"			      \
-       "_hurd_intr_rpc_msg_in_trap:	move %0, $2\n"			      \
-       : "=r" (err)							      \
-       : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size),	      \
-         "r" (__rcv_name), "r" (__timeout), "r" (__notify)		      \
-       : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10",	      \
-         "$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28");	      \
-  err;									      \
-})
-#else
-#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
-({									      \
-  error_t err;								      \
-  mach_port_t __rcv_name = (rcv_name);					      \
-  mach_msg_timeout_t __timeout = (timeout);	       			      \
-  mach_port_t __notify = (notify);					      \
-  asm (".globl _hurd_intr_rpc_msg_do_trap\n" 				      \
-       ".globl _hurd_intr_rpc_msg_in_trap\n"				      \
-       "				move $4, %1\n"			      \
-       "				move $5, %2\n"			      \
-       "				move $6, %3\n"			      \
-       "				move $7, %4\n"			      \
-       "				move $8, %5\n"			      \
-       "				move $9, %6\n"			      \
-       "				move $10, %7\n"			      \
-       "				li $2, -25\n"			      \
-       "_hurd_intr_rpc_msg_do_trap:	syscall\n"			      \
-       "_hurd_intr_rpc_msg_in_trap:	move %0, $2\n"			      \
-       : "=r" (err)							      \
-       : "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size),	      \
-         "r" (__rcv_name), "r" (__timeout), "r" (__notify)		      \
-       : "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10",	      \
-         "$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28");	      \
-  err;									      \
-})
-#endif
-
-static inline void
-INTR_MSG_BACK_OUT (struct mips_thread_state *state)
-{
-  return;
-}
-
-#include "hurdfault.h"
-
-static inline int
-SYSCALL_EXAMINE (struct mips_thread_state *state, int *callno)
-{
-  u_int32_t *p = (void *) (state->pc - 4);
-  int result;
-  if (_hurdsig_catch_memory_fault (p))
-    return 0;
-  if (result = (*p == 0x0000000c))
-    /* The PC is just after a `syscall' instruction.
-       This is a system call in progress; v0($2) holds the call number.  */
-    *callno = state->r2;
-  _hurdsig_end_catch_fault ();
-  return result;
-}
-
-
-struct mach_msg_trap_args
-  {
-    /* This is the order of arguments to mach_msg_trap.  */
-    mach_msg_header_t *msg;
-    mach_msg_option_t option;
-    mach_msg_size_t send_size;
-    mach_msg_size_t rcv_size;
-    mach_port_t rcv_name;
-    mach_msg_timeout_t timeout;
-    mach_port_t notify;
-  };
-
-
-static inline mach_port_t
-MSG_EXAMINE (struct mips_thread_state *state, int *msgid)
-{
-  mach_msg_header_t *msg;
-  mach_port_t send_port;
-
-  msg = (mach_msg_header_t *) state->r4;
-
-  if (_hurdsig_catch_memory_fault (msg))
-    return MACH_PORT_NULL;
-  send_port = msg->msgh_remote_port;
-  *msgid = msg->msgh_id;
-  _hurdsig_end_catch_fault ();
-
-  return send_port;
-}
diff --git a/sysdeps/mach/hurd/mips/longjmp-ctx.c b/sysdeps/mach/hurd/mips/longjmp-ctx.c
deleted file mode 100644
index 66ee7b6fb8..0000000000
--- a/sysdeps/mach/hurd/mips/longjmp-ctx.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Perform a `longjmp' on a `struct sigcontext'.  MIPS version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-#include <hurd/signal.h>
-#include <string.h>
-
-void
-_hurd_longjmp_sigcontext (struct sigcontext *scp, jmp_buf env, int retval)
-{
-  scp->sc_gpr[16] = env[0].__regs[0];
-  scp->sc_gpr[17] = env[0].__regs[1];
-  scp->sc_gpr[18] = env[0].__regs[2];
-  scp->sc_gpr[19] = env[0].__regs[3];
-  scp->sc_gpr[20] = env[0].__regs[4];
-  scp->sc_gpr[21] = env[0].__regs[5];
-  scp->sc_gpr[22] = env[0].__regs[6];
-  scp->sc_gpr[23] = env[0].__regs[7];
-
-  scp->sc_gpr[28] = (int) env[0].__gp;
-  scp->sc_fp = (int) env[0].__fp;
-  scp->sc_sp = (int) env[0].__sp;
-  scp->sc_pc = (int) env[0].__pc;
-  scp->sc_gpr[2] = retval ?: 1;
-}
diff --git a/sysdeps/mach/hurd/mips/longjmp-ts.c b/sysdeps/mach/hurd/mips/longjmp-ts.c
deleted file mode 100644
index 4c69e4e2b9..0000000000
--- a/sysdeps/mach/hurd/mips/longjmp-ts.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Perform a `longjmp' on a Mach thread_state.  MIPS version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd/signal.h>
-#include <setjmp.h>
-#include <mach/thread_status.h>
-
-
-/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'.  */
-
-void
-_hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
-{
-  struct mips_thread_state *ts = state;
-
-  ts->r16 = env[0].__jmpbuf[0].__regs[0];
-  ts->r17 = env[0].__jmpbuf[0].__regs[1];
-  ts->r18 = env[0].__jmpbuf[0].__regs[2];
-  ts->r19 = env[0].__jmpbuf[0].__regs[3];
-  ts->r20 = env[0].__jmpbuf[0].__regs[4];
-  ts->r21 = env[0].__jmpbuf[0].__regs[5];
-  ts->r22 = env[0].__jmpbuf[0].__regs[6];
-  ts->r23 = env[0].__jmpbuf[0].__regs[7];
-  ts->r28 = (int) env[0].__jmpbuf[0].__gp;
-  ts->r29 = (int) env[0].__jmpbuf[0].__sp;
-  ts->r30 = (int) env[0].__jmpbuf[0].__fp;
-  ts->pc = (int) env[0].__jmpbuf[0].__pc;
-  ts->r2 = val ?: 1;
-}
diff --git a/sysdeps/mach/hurd/mips/sigreturn.c b/sysdeps/mach/hurd/mips/sigreturn.c
deleted file mode 100644
index a9f7673eb5..0000000000
--- a/sysdeps/mach/hurd/mips/sigreturn.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd.h>
-#include <hurd/signal.h>
-#include <hurd/threadvar.h>
-#include <stdlib.h>
-#include <mach/mips/mips_instruction.h>
-
-int
-__sigreturn (struct sigcontext *scp)
-{
-  struct hurd_sigstate *ss;
-  struct hurd_userlink *link = (void *) &scp[1];
-  mach_port_t *reply_port;
-
-  if (scp == NULL || (scp->sc_mask & _SIG_CANT_MASK))
-    {
-      errno = EINVAL;
-      return -1;
-    }
-
-  ss = _hurd_self_sigstate ();
-  __spin_lock (&ss->lock);
-
-  /* Remove the link on the `active resources' chain added by
-     _hurd_setup_sighandler.  Its purpose was to make sure
-     that we got called; now we have, it is done.  */
-  _hurd_userlink_unlink (link);
-
-  /* Restore the set of blocked signals, and the intr_port slot.  */
-  ss->blocked = scp->sc_mask;
-  ss->intr_port = scp->sc_intr_port;
-
-  /* Check for pending signals that were blocked by the old set.  */
-  if (ss->pending & ~ss->blocked)
-    {
-      /* There are pending signals that just became unblocked.  Wake up the
-	 signal thread to deliver them.  But first, squirrel away SCP where
-	 the signal thread will notice it if it runs another handler, and
-	 arrange to have us called over again in the new reality.  */
-      ss->context = scp;
-      __spin_unlock (&ss->lock);
-      __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
-      /* If a pending signal was handled, sig_post never returned.  */
-      __spin_lock (&ss->lock);
-      ss->context = NULL;
-    }
-
-  if (scp->sc_onstack)
-    {
-      ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */
-      /* XXX cannot unlock until off sigstack */
-      abort ();
-    }
-  else
-    __spin_unlock (&ss->lock);
-
-  /* Destroy the MiG reply port used by the signal handler, and restore the
-     reply port in use by the thread when interrupted.  */
-  reply_port =
-    (mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY);
-  if (*reply_port)
-    {
-      mach_port_t port = *reply_port;
-
-      /* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port not to
-	 get another reply port, but avoids mig_dealloc_reply_port trying to
-	 deallocate it after the receive fails (which it will, because the
-	 reply port will be bogus, whether we do this or not).  */
-      *reply_port = MACH_PORT_DEAD;
-
-      __mach_port_destroy (__mach_task_self (), port);
-    }
-  *reply_port = scp->sc_reply_port;
-
-  if (scp->sc_coproc_used & SC_COPROC_USE_FPU)
-    {
-      /* Restore FPU state.  */
-#define restore_fpr(n) \
-  asm volatile ("l.d $f" #n ",%0" : : "m" (scp->sc_fpr[n]))
-
-      /* Restore floating-point registers. */
-#ifdef __mips64
-      restore_fpr (0);
-      restore_fpr (1);
-      restore_fpr (2);
-      restore_fpr (3);
-      restore_fpr (4);
-      restore_fpr (5);
-      restore_fpr (6);
-      restore_fpr (7);
-      restore_fpr (8);
-      restore_fpr (9);
-      restore_fpr (10);
-      restore_fpr (11);
-      restore_fpr (12);
-      restore_fpr (13);
-      restore_fpr (14);
-      restore_fpr (15);
-      restore_fpr (16);
-      restore_fpr (17);
-      restore_fpr (18);
-      restore_fpr (19);
-      restore_fpr (20);
-      restore_fpr (21);
-      restore_fpr (22);
-      restore_fpr (23);
-      restore_fpr (24);
-      restore_fpr (25);
-      restore_fpr (26);
-      restore_fpr (27);
-      restore_fpr (28);
-      restore_fpr (29);
-      restore_fpr (30);
-      restore_fpr (31);
-#else
-      restore_fpr (0);
-      restore_fpr (2);
-      restore_fpr (4);
-      restore_fpr (6);
-      restore_fpr (8);
-      restore_fpr (10);
-      restore_fpr (12);
-      restore_fpr (14);
-      restore_fpr (16);
-      restore_fpr (18);
-      restore_fpr (20);
-      restore_fpr (22);
-      restore_fpr (24);
-      restore_fpr (26);
-      restore_fpr (28);
-      restore_fpr (30);
-#endif
-
-      /* Restore the floating-point control/status register ($f31).  */
-      asm volatile ("ctc1 %0,$f31" : : "r" (scp->sc_fpcsr));
-    }
-
-  /* Load all the registers from the sigcontext.  */
-#ifdef __mips64
-#define restore_gpr(n) \
-  asm volatile ("ld $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
-#else
-#define restore_gpr(n) \
-  asm volatile ("lw $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
-#endif
-
-  {
-    register const struct sigcontext *const scpreg asm ("$1") = scp;
-    register int *at asm ("$1");
-
-    /* First restore the multiplication result registers.  The compiler
-       will use some temporary registers, so we do this before restoring
-       the general registers.  */
-    asm volatile ("mtlo %0" : : "r" (scpreg->sc_mdlo));
-    asm volatile ("mthi %0" : : "r" (scpreg->sc_mdhi));
-
-    /* In the word after the saved PC, store the saved $1 value.  */
-    (&scpreg->sc_pc)[1] = scpreg->sc_gpr[0];
-
-    asm volatile (".set noreorder; .set noat;");
-
-    /* Restore the normal registers.  */
-    restore_gpr (2);
-    restore_gpr (3);
-    restore_gpr (4);
-    restore_gpr (5);
-    restore_gpr (6);
-    restore_gpr (7);
-    restore_gpr (8);
-    restore_gpr (9);
-    restore_gpr (10);
-    restore_gpr (11);
-    restore_gpr (12);
-    restore_gpr (13);
-    restore_gpr (14);
-    restore_gpr (15);
-    restore_gpr (16);
-    restore_gpr (17);
-    restore_gpr (18);
-    restore_gpr (19);
-    restore_gpr (20);
-    restore_gpr (21);
-    restore_gpr (22);
-    restore_gpr (23);
-    restore_gpr (24);
-    restore_gpr (25);
-    /* Registers 26-27 are kernel-only.  */
-    restore_gpr (28);
-    restore_gpr (29);		/* Stack pointer.  */
-    restore_gpr (30);		/* Frame pointer.  */
-    restore_gpr (31);		/* Return address.  */
-
-    at = &scpreg->sc_pc;
-    /* This is an emulated instruction that will find at the address in $1
-       two words: the PC value to restore, and the $1 value to restore.  */
-    asm volatile (".word %0" : : "i" (op_sigreturn));
-    asm volatile (".set reorder; .set at;");
-    /* NOTREACHED */
-    return at;		/* To prevent optimization.  */
-  }
-
-  /* NOTREACHED */
-  return -1;
-}
-
-weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/mach/hurd/mips/trampoline.c b/sysdeps/mach/hurd/mips/trampoline.c
deleted file mode 100644
index dd42dfc1c6..0000000000
--- a/sysdeps/mach/hurd/mips/trampoline.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* Set thread_state for sighandler, and sigcontext to recover.  MIPS version.
-   Copyright (C) 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <hurd/signal.h>
-#include <hurd/userlink.h>
-#include "thread_state.h"
-#include <assert.h>
-#include <errno.h>
-#include "hurdfault.h"
-#include "intr-msg.h"
-
-
-struct sigcontext *
-_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
-			int signo, struct hurd_signal_detail *detail,
-			volatile int rpc_wait,
-			struct machine_thread_all_state *state)
-{
-  __label__ trampoline, rpc_wait_trampoline, firewall;
-  void *volatile sigsp;
-  struct sigcontext *scp;
-  struct 
-    {
-      int signo;
-      long int sigcode;
-      struct sigcontext *scp;	/* Points to ctx, below.  */
-      void *sigreturn_addr;
-      void *sigreturn_returns_here;
-      struct sigcontext *return_scp; /* Same; arg to sigreturn.  */
-      struct sigcontext ctx;
-      struct hurd_userlink link;
-    } *stackframe;
-
-  if (ss->context)
-    {
-      /* We have a previous sigcontext that sigreturn was about
-	 to restore when another signal arrived.  We will just base
-	 our setup on that.  */
-      if (! _hurdsig_catch_memory_fault (ss->context))
-	{
-	  memcpy (&state->basic, &ss->context->sc_mips_thread_state,
-		  sizeof (state->basic));
-	  memcpy (&state->exc, &ss->context->sc_mips_exc_state,
-		  sizeof (state->exc));
-	  state->set = (1 << MIPS_THREAD_STATE) | (1 << MIPS_EXC_STATE);
-	  if (state->exc.coproc_state & SC_COPROC_USE_FPU)
-	    {
-	      memcpy (&state->fpu, &ss->context->sc_mips_float_state,
-		      sizeof (state->fpu));
-	      state->set |= (1 << MIPS_FLOAT_STATE);
-	    }
-	}
-    }
-
-  if (! machine_get_basic_state (ss->thread, state))
-    return NULL;
-
-  /* Save the original SP in the gratuitous s0 ($16) slot.
-     We may need to reset the SP (the `r29' slot) to avoid clobbering an
-     interrupted RPC frame.  */
-  state->basic.r16 = state->basic.r29;
-
-  if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
-      !(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
-    {
-      sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size;
-      ss->sigaltstack.ss_flags |= SS_ONSTACK;
-      /* XXX need to set up base of new stack for
-	 per-thread variables, cthreads.  */
-    }
-  else
-    sigsp = (char *) state->basic.r29;
-
-  /* Push the arguments to call `trampoline' on the stack.  */
-  sigsp -= sizeof (*stackframe);
-  stackframe = sigsp;
-
-  if (_hurdsig_catch_memory_fault (stackframe))
-    {
-      /* We got a fault trying to write the stack frame.
-	 We cannot set up the signal handler.
-	 Returning NULL tells our caller, who will nuke us with a SIGILL.  */
-      return NULL;
-    }
-  else
-    {
-      int ok;
-
-      extern void _hurdsig_longjmp_from_handler (void *, jmp_buf, int);
-
-      /* Add a link to the thread's active-resources list.  We mark this as
-	 the only user of the "resource", so the cleanup function will be
-	 called by any longjmp which is unwinding past the signal frame.
-	 The cleanup function (in sigunwind.c) will make sure that all the
-	 appropriate cleanups done by sigreturn are taken care of.  */
-      stackframe->link.cleanup = &_hurdsig_longjmp_from_handler;
-      stackframe->link.cleanup_data = &stackframe->ctx;
-      stackframe->link.resource.next = NULL;
-      stackframe->link.resource.prevp = NULL;
-      stackframe->link.thread.next = ss->active_resources;
-      stackframe->link.thread.prevp = &ss->active_resources;
-      if (stackframe->link.thread.next)
-	stackframe->link.thread.next->thread.prevp
-	  = &stackframe->link.thread.next;
-      ss->active_resources = &stackframe->link;
-
-      /* Set up the arguments for the signal handler.  */
-      stackframe->signo = signo;
-      stackframe->sigcode = detail->code;
-      stackframe->scp = stackframe->return_scp = scp = &stackframe->ctx;
-      stackframe->sigreturn_addr = &__sigreturn;
-      stackframe->sigreturn_returns_here = &&firewall; /* Crash on return.  */
-
-      /* Set up the sigcontext from the current state of the thread.  */
-
-      scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
-
-      /* struct sigcontext is laid out so that starting at sc_gpr
-	 mimics a struct mips_thread_state.  */
-      memcpy (&scp->sc_mips_thread_state,
-	      &state->basic, sizeof (state->basic));
-
-      /* struct sigcontext is laid out so that starting at sc_cause
-	 mimics a struct mips_exc_state.  */
-      ok = machine_get_state (ss->thread, state, MIPS_EXC_STATE,
-			      &state->exc, &scp->sc_cause,
-			      sizeof (state->exc));
-
-      if (ok && (scp->sc_coproc_used & SC_COPROC_USE_FPU))
-	/* struct sigcontext is laid out so that starting at sc_fpr
-	   mimics a struct mips_float_state.  This state
-	   is only meaningful if the coprocessor was used.  */
-	  ok = machine_get_state (ss->thread, state, MIPS_FLOAT_STATE,
-				  &state->fpu, &scp->sc_mips_float_state,
-				  sizeof (state->fpu));
-
-      _hurdsig_end_catch_fault ();
-
-      if (! ok)
-	return NULL;
-    }
-
-  /* Modify the thread state to call the trampoline code on the new stack.  */
-  if (rpc_wait)
-    {
-      /* The signalee thread was blocked in a mach_msg_trap system call,
-	 still waiting for a reply.  We will have it run the special
-	 trampoline code which retries the message receive before running
-	 the signal handler.
-	 
-	 To do this we change the OPTION argument in its registers to
-	 enable only message reception, since the request message has
-	 already been sent.  */
-
-      /* The system call arguments are stored in consecutive registers
-	 starting with a0 ($4).  */
-      struct mach_msg_trap_args *args = (void *) &state->basic.r4;
-
-      if (_hurdsig_catch_memory_fault (args))
-	{
-	  /* Faulted accessing ARGS.  Bomb.  */
-	  return NULL;
-	}
-
-      assert (args->option & MACH_RCV_MSG);
-      /* Disable the message-send, since it has already completed.  The
-	 calls we retry need only wait to receive the reply message.  */
-      args->option &= ~MACH_SEND_MSG;
-
-      /* Limit the time to receive the reply message, in case the server
-	 claimed that `interrupt_operation' succeeded but in fact the RPC
-	 is hung.  */
-      args->option |= MACH_RCV_TIMEOUT;
-      args->timeout = _hurd_interrupted_rpc_timeout;
-
-      _hurdsig_end_catch_fault ();
-
-      state->basic.pc = (int) &&rpc_wait_trampoline;
-      /* The reply-receiving trampoline code runs initially on the original
-	 user stack.  We pass it the signal stack pointer in s4 ($20).  */
-      state->basic.r29 = state->basic.r16; /* Restore mach_msg syscall SP.  */
-      state->basic.r20 = (int) sigsp;
-      /* After doing the message receive, the trampoline code will need to
-	 update the v0 ($2) value to be restored by sigreturn.  To simplify
-	 the assembly code, we pass the address of its slot in SCP to the
-	 trampoline code in s5 ($21).  */
-      state->basic.r21 = (int) &scp->sc_gpr[1];
-      /* We must preserve the mach_msg_trap args in a0..t2 ($4..$10).
-	 Pass the handler args to the trampoline code in s1..s3 ($17..$19).  */
-      state->basic.r17 = signo;
-      state->basic.r18 = detail->code;
-      state->basic.r19 = (int) scp;
-    }
-  else
-    {
-      state->basic.pc = (int) &&trampoline;
-      state->basic.r29 = (int) sigsp;
-      state->basic.r4 = signo;
-      state->basic.r5 = detail->code;
-      state->basic.r6 = (int) scp;
-    }
-
-  /* We pass the handler function to the trampoline code in s6 ($22).  */
-  state->basic.r22 = (int) handler;
-  /* In the callee-saved register s0 ($16), we save the SCP value to pass
-     to __sigreturn after the handler returns.  */
-  state->basic.r16 = (int) scp;
-
-  return scp;
-
-  /* The trampoline code follows.  This is not actually executed as part of
-     this function, it is just convenient to write it that way.  */
-
- rpc_wait_trampoline:
-  /* This is the entry point when we have an RPC reply message to receive
-     before running the handler.  The MACH_MSG_SEND bit has already been
-     cleared in the OPTION argument in our registers.  For our convenience,
-     $3 points to the sc_gpr[1] member of the sigcontext (saved v0 ($2)).  */
-  asm volatile
-    (".set noat; .set noreorder; .set nomacro\n"
-     /* Retry the interrupted mach_msg system call.  */
-#ifdef __mips64
-     "dli $2, -25\n"		/* mach_msg_trap */
-#else
-     "li $2, -25\n"		/* mach_msg_trap */
-#endif
-     "syscall\n"
-     /* When the sigcontext was saved, v0 was MACH_RCV_INTERRUPTED.  But
-	now the message receive has completed and the original caller of
-	the RPC (i.e. the code running when the signal arrived) needs to
-	see the final return value of the message receive in v0.  So
-	store the new v0 value into the sc_gpr[1] member of the sigcontext
-	(whose address is in s5 to make this code simpler).  */
-#ifdef __mips64
-     "sd $2, ($21)\n"
-#else
-     "sw $2, ($21)\n"
-#endif
-     /* Since the argument registers needed to have the mach_msg_trap
-	arguments, we've stored the arguments to the handler function
-	in registers s1..s3 ($17..$19).  */
-     "move $4, $17\n"
-     "move $5, $18\n"
-     "move $6, $19\n"
-     /* Switch to the signal stack.  */
-     "move $29, $20\n");
-
- trampoline:
-  /* Entry point for running the handler normally.  The arguments to the
-     handler function are already in the standard registers:
-
-       a0	SIGNO
-       a1	SIGCODE
-       a2	SCP
-     */
-  asm volatile
-    ("move $25, $22\n"		/* Copy s6 to t9 for MIPS ABI.  */
-     "jal $25; nop\n"		/* Call the handler function.  */
-     /* Call __sigreturn (SCP); this cannot return.  */
-#ifdef __mips64
-     "dla $1,%0\n"
-#else
-     "la $1,%0\n"
-#endif
-     "j $1\n"
-     "move $4, $16"		/* Set up arg from saved SCP in delay slot.  */
-     : : "i" (&__sigreturn));
-
-  /* NOTREACHED */
-  asm volatile (".set reorder; .set at; .set macro");
-
- firewall:
-  asm volatile ("hlt: j hlt");
-
-  return NULL;
-}
diff --git a/sysdeps/mach/hurd/mkdirat.c b/sysdeps/mach/hurd/mkdirat.c
new file mode 100644
index 0000000000..321d59f2fd
--- /dev/null
+++ b/sysdeps/mach/hurd/mkdirat.c
@@ -0,0 +1,42 @@
+/* Create a directory named relative to another open directory.  Hurd version.
+   Copyright (C) 1991,1993,1994,1995,1996,1997,2002,2006
+	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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <hurd.h>
+
+int
+mkdirat (fd, path, mode)
+     int fd;
+     const char *path;
+     mode_t mode;
+{
+  error_t err;
+  const char *name;
+  file_t parent = __directory_name_split (path, (char **) &name);
+  if (parent == MACH_PORT_NULL)
+    return -1;
+  err = __dir_mkdir (parent, name, mode & ~_hurd_umask);
+  __mach_port_deallocate (__mach_task_self (), parent);
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
diff --git a/sysdeps/mach/hurd/open.c b/sysdeps/mach/hurd/open.c
index dd575a47b1..bdfed5e311 100644
--- a/sysdeps/mach/hurd/open.c
+++ b/sysdeps/mach/hurd/open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,93,94,95,97,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,94,95,97,2000,2002,2006 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
@@ -51,3 +51,9 @@ libc_hidden_def (__libc_open)
 weak_alias (__libc_open, __open)
 libc_hidden_weak (__open)
 weak_alias (__libc_open, open)
+
+/* open64 is just the same as open for us.  */
+weak_alias (__libc_open, __libc_open64)
+weak_alias (__libc_open, __open64)
+libc_hidden_weak (_open64)
+weak_alias (__libc_open, open64)
diff --git a/sysdeps/mach/hurd/open64.c b/sysdeps/mach/hurd/open64.c
new file mode 100644
index 0000000000..018ac94f28
--- /dev/null
+++ b/sysdeps/mach/hurd/open64.c
@@ -0,0 +1 @@
+/* open64 is defined in open.c as an alias.  */
diff --git a/sysdeps/mach/hurd/openat.c b/sysdeps/mach/hurd/openat.c
new file mode 100644
index 0000000000..1faf857e16
--- /dev/null
+++ b/sysdeps/mach/hurd/openat.c
@@ -0,0 +1,62 @@
+/* openat -- Open a file named relative to an open directory.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+/* Open FILE with access OFLAG.  Interpret relative paths relative to
+   the directory associated with FD.  If OFLAG includes O_CREAT, a
+   third argument is the file protection.  */
+int
+__openat (fd, file, oflag)
+     int fd;
+     const char *file;
+     int oflag;
+{
+  int mode;
+  io_t port;
+
+  if (oflag & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, int);
+      va_end (arg);
+    }
+  else
+    mode = 0;
+
+  port = __file_name_lookup_at (fd, 0, file, oflag, mode);
+  if (port == MACH_PORT_NULL)
+    return -1;
+
+  return _hurd_intern_fd (port, oflag, 1);
+}
+libc_hidden_def (__openat)
+weak_alias (__openat, openat)
+
+/* openat64 is just the same as openat for us.  */
+weak_alias (__openat, __openat64)
+libc_hidden_weak (__openat64)
+weak_alias (__openat, openat64)
diff --git a/sysdeps/mach/hurd/openat64.c b/sysdeps/mach/hurd/openat64.c
new file mode 100644
index 0000000000..15d9d6a183
--- /dev/null
+++ b/sysdeps/mach/hurd/openat64.c
@@ -0,0 +1 @@
+/* openat64 is defined in openat.c as an alias.  */
diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c
index a1ff947f06..23e04ede0e 100644
--- a/sysdeps/mach/hurd/opendir.c
+++ b/sysdeps/mach/hurd/opendir.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,94,95,96,97,98,2001,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1994,1995,1996,1997,1998,2001,2003,2005,2006
+	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
@@ -32,62 +33,29 @@
 #include "dirstream.h"
 
 
-/* Open a directory stream on NAME.  */
+/* Open a directory stream on a file descriptor in Hurd internal form.
+   We do no checking here on the descriptor.  */
 DIR *
-__opendir (const char *name)
+_hurd_fd_opendir (struct hurd_fd *d)
 {
   DIR *dirp;
-  int fd;
-  struct hurd_fd *d;
 
-  if (name[0] == '\0')
+  if (d == NULL)
     {
-      /* POSIX.1-1990 says an empty name gets ENOENT;
-	 but `open' might like it fine.  */
-      __set_errno (ENOENT);
+      errno = EBADF;
       return NULL;
     }
 
-  {
-    /* Append trailing slash to directory name to force ENOTDIR
-       if it's not a directory.
-
-       We open using the O_NONBLOCK flag so that a nondirectory with
-       blocking behavior (FIFO or device) gets ENOTDIR immediately
-       rather than waiting for the special file's open wakeup predicate.  */
-
-    size_t len = strlen (name);
-    if (name[len - 1] == '/')
-      fd = __open (name, O_RDONLY | O_NONBLOCK);
-    else
-      {
-	char n[len + 2];
-	memcpy (n, name, len);
-	n[len] = '/';
-	n[len + 1] = '\0';
-	fd = __open (n, O_RDONLY | O_NONBLOCK);
-      }
-  }
-  if (fd < 0)
-    return NULL;
-
   dirp = (DIR *) malloc (sizeof (DIR));
   if (dirp == NULL)
-    {
-      __close (fd);
-      return NULL;
-    }
-
-  /* Extract the pointer to the descriptor structure.  */
-  __mutex_lock (&_hurd_dtable_lock);
-  d = dirp->__fd = _hurd_dtable[fd];
-  __mutex_unlock (&_hurd_dtable_lock);
+    return NULL;
 
   /* Set the descriptor to close on exec. */
   __spin_lock (&d->port.lock);
   d->flags |= FD_CLOEXEC;
   __spin_unlock (&d->port.lock);
 
+  dirp->__fd = d;
   dirp->__data = dirp->__ptr = NULL;
   dirp->__entry_data = dirp->__entry_ptr = 0;
   dirp->__allocation = 0;
@@ -97,4 +65,29 @@ __opendir (const char *name)
 
   return dirp;
 }
+
+
+/* Open a directory stream on NAME.  */
+DIR *
+__opendir (const char *name)
+{
+  if (name[0] == '\0')
+    {
+      /* POSIX.1-1990 says an empty name gets ENOENT;
+	 but `open' might like it fine.  */
+      __set_errno (ENOENT);
+      return NULL;
+    }
+
+  int fd = __open (name, O_RDONLY | O_NONBLOCK | O_DIRECTORY);
+  if (fd < 0)
+    return NULL;
+
+  /* Extract the pointer to the descriptor structure.  */
+  DIR *dirp = _hurd_fd_opendir (_hurd_fd_get (fd));
+  if (dirp == NULL)
+    __close (fd);
+
+  return dirp;
+}
 weak_alias (__opendir, opendir)
diff --git a/sysdeps/mach/hurd/powerpc/Dist b/sysdeps/mach/hurd/powerpc/Dist
deleted file mode 100644
index c58180257e..0000000000
--- a/sysdeps/mach/hurd/powerpc/Dist
+++ /dev/null
@@ -1 +0,0 @@
-static-start.S
diff --git a/sysdeps/mach/hurd/powerpc/longjmp-ts.c b/sysdeps/mach/hurd/powerpc/longjmp-ts.c
index 4a59f16aa8..757366bc47 100644
--- a/sysdeps/mach/hurd/powerpc/longjmp-ts.c
+++ b/sysdeps/mach/hurd/powerpc/longjmp-ts.c
@@ -1,5 +1,5 @@
 /* Perform a `longjmp' on a Mach thread_state.  PowerPC version.
-   Copyright (C) 1991,94,95,97,2001 Free Software Foundation, Inc.
+   Copyright (C) 1991,94,95,97,2001, 2006 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
@@ -19,6 +19,7 @@
 
 #include <hurd/signal.h>
 #include <setjmp.h>
+#include <jmpbuf-offsets.h>
 #include <mach/thread_status.h>
 
 
diff --git a/sysdeps/mach/hurd/powerpc/register-dump.h b/sysdeps/mach/hurd/powerpc/register-dump.h
index 0377175227..c0b1d06236 100644
--- a/sysdeps/mach/hurd/powerpc/register-dump.h
+++ b/sysdeps/mach/hurd/powerpc/register-dump.h
@@ -1,5 +1,5 @@
 /* Dump registers.  PowerPC/Hurd version.
-   Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2001, 2006 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
@@ -113,7 +113,7 @@ register_dump (int fd, struct sigcontext *ctx)
     }
 
   /* Write the output.  */
-  write (fd, buffer, sizeof(buffer));
+  write (fd, buffer, sizeof(buffer) - 1);
 }
 
 #define REGISTER_DUMP \
diff --git a/sysdeps/mach/hurd/powerpc/trampoline.c b/sysdeps/mach/hurd/powerpc/trampoline.c
index 4e5d675258..4e1ea4b9d9 100644
--- a/sysdeps/mach/hurd/powerpc/trampoline.c
+++ b/sysdeps/mach/hurd/powerpc/trampoline.c
@@ -1,5 +1,6 @@
 /* Set thread_state for sighandler, and sigcontext to recover.  For PowerPC.
-   Copyright (C) 1994,95,96,97,98,99,2001 Free Software Foundation, Inc.
+   Copyright (C) 1994,1995,1996,1997,1998,1999,2001,2005
+	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
@@ -19,11 +20,11 @@
 
 #include <hurd/signal.h>
 #include <hurd/userlink.h>
-#include "thread_state.h"
+#include <thread_state.h>
 #include <assert.h>
 #include <errno.h>
 #include "hurdfault.h"
-#include "intr-msg.h"
+#include <intr-msg.h>
 
 struct sigcontext *
 _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
diff --git a/sysdeps/mach/hurd/ppoll.c b/sysdeps/mach/hurd/ppoll.c
new file mode 100644
index 0000000000..693bc13839
--- /dev/null
+++ b/sysdeps/mach/hurd/ppoll.c
@@ -0,0 +1,30 @@
+/* poll file descriptors.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/poll.h>
+#include <sys/time.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+int
+ppoll (struct pollfd *fds, nfds_t nfds,
+       const struct timespec *timeout, const sigset_t *sigmask)
+{
+  return _hurd_select (nfds, fds, NULL, NULL, NULL, timeout, sigmask);
+}
diff --git a/sysdeps/mach/hurd/profil.c b/sysdeps/mach/hurd/profil.c
index d212872643..0426f67b6f 100644
--- a/sysdeps/mach/hurd/profil.c
+++ b/sysdeps/mach/hurd/profil.c
@@ -1,5 +1,5 @@
 /* Low-level statistical profiling support function.  Mach/Hurd version.
-   Copyright (C) 1995, 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 2000, 2002, 2005 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
@@ -49,6 +49,7 @@ static kern_return_t profil_task_get_sampled_pcs (mach_port_t,
 						  sampled_pc_array_t,
 						  mach_msg_type_number_t *);
 static void fetch_samples (void);
+static void profile_waiter (void);
 
 /* Enable statistical profiling, writing samples of the PC into at most
    SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
@@ -64,7 +65,6 @@ update_waiter (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
   if (profile_thread == MACH_PORT_NULL)
     {
       /* Set up the profiling collector thread.  */
-      static void profile_waiter (void);
       err = __thread_create (__mach_task_self (), &profile_thread);
       if (! err)
 	err = __mach_setup_thread (__mach_task_self (), profile_thread,
diff --git a/sysdeps/mach/hurd/readdir64_r.c b/sysdeps/mach/hurd/readdir64_r.c
index c26b35bb70..5b5a7fe362 100644
--- a/sysdeps/mach/hurd/readdir64_r.c
+++ b/sysdeps/mach/hurd/readdir64_r.c
@@ -109,4 +109,4 @@ __readdir64_r (DIR *dirp, struct dirent64 *entry, struct dirent64 **result)
   return dp ? 0 : err ? errno : 0;
 }
 
-weak_alias(__readdir64_r, readdir64_r)
+weak_alias (__readdir64_r, readdir64_r)
diff --git a/sysdeps/mach/hurd/recv.c b/sysdeps/mach/hurd/recv.c
index a2b8fd5be5..b001729d18 100644
--- a/sysdeps/mach/hurd/recv.c
+++ b/sysdeps/mach/hurd/recv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1997,2001,2005 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
@@ -26,9 +26,8 @@
 /* Read N bytes into BUF from socket FD.
    Returns the number read or -1 for errors.  */
 
-/* XXX should be __recv ? */
 ssize_t
-recv (fd, buf, n, flags)
+__recv (fd, buf, n, flags)
      int fd;
      void *buf;
      size_t n;
@@ -62,3 +61,4 @@ recv (fd, buf, n, flags)
 
   return nread;
 }
+weak_alias (__recv, recv)
diff --git a/sysdeps/mach/hurd/removexattr.c b/sysdeps/mach/hurd/removexattr.c
new file mode 100644
index 0000000000..bbfee3d304
--- /dev/null
+++ b/sysdeps/mach/hurd/removexattr.c
@@ -0,0 +1,35 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+
+ssize_t
+removexattr (const char *path, const char *name)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_remove (port, name);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return __hurd_fail (err);
+}
diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
index 9fef56287d..fec64a8cb5 100644
--- a/sysdeps/mach/hurd/setitimer.c
+++ b/sysdeps/mach/hurd/setitimer.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1994,1995,1996,1997,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1994,1995,1996,1997,2000,2001,2005
+	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
@@ -41,7 +42,7 @@ static void
 quantize_timeval (struct timeval *tv)
 {
   static time_t quantum = -1;
-  
+
   if (quantum == -1)
     quantum = 1000000 / __getclktck ();
 
@@ -127,14 +128,15 @@ timer_thread (void)
 }
 
 
+/* Forward declaration.  */
+static int setitimer_locked (const struct itimerval *new,
+			     struct itimerval *old, void *crit);
+
 static sighandler_t
 restart_itimer (struct hurd_signal_preemptor *preemptor,
 		struct hurd_sigstate *ss,
 		int *signo, struct hurd_signal_detail *detail)
 {
-  static int setitimer_locked (const struct itimerval *new,
-			       struct itimerval *old, void *crit);
-
   /* This function gets called in the signal thread
      each time a SIGALRM is arriving (even if blocked).  */
   struct itimerval it;
diff --git a/sysdeps/mach/hurd/setresgid.c b/sysdeps/mach/hurd/setresgid.c
index d0ee412b46..8fcf26eaf1 100644
--- a/sysdeps/mach/hurd/setresgid.c
+++ b/sysdeps/mach/hurd/setresgid.c
@@ -1,5 +1,5 @@
-/* setresgid -- set effective group ID, real group ID, and saved-set group ID
-   Copyright (C) 2002 Free Software Foundation, Inc.
+/* setresgid -- set real group ID, effective group ID, and saved-set group ID
+   Copyright (C) 2002, 2005, 2006 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
@@ -22,10 +22,10 @@
 #include <hurd.h>
 #include <hurd/id.h>
 
-/* Set the effective group ID, real group ID, and saved-set group ID,
-   of the calling process to EGID, RGID, and SGID, respectively.  */
+/* Set the real group ID, effective group ID, and saved-set group ID,
+   of the calling process to RGID, EGID, and SGID, respectively.  */
 int
-__setresgid (gid_t egid, gid_t rgid, gid_t sgid)
+__setresgid (gid_t rgid, gid_t egid, gid_t sgid)
 {
   auth_t newauth;
   error_t err;
@@ -75,3 +75,4 @@ __setresgid (gid_t egid, gid_t rgid, gid_t sgid)
   return err;
 }
 libc_hidden_def (__setresgid)
+weak_alias (__setresgid, setresgid)
diff --git a/sysdeps/mach/hurd/setresuid.c b/sysdeps/mach/hurd/setresuid.c
index 2d05dbc850..ccf8d08d40 100644
--- a/sysdeps/mach/hurd/setresuid.c
+++ b/sysdeps/mach/hurd/setresuid.c
@@ -1,5 +1,5 @@
-/* setresuid -- set effective user ID, real user ID, and saved-set user ID
-   Copyright (C) 2002 Free Software Foundation, Inc.
+/* setresuid -- set real user ID, effective user ID, and saved-set user ID
+   Copyright (C) 2002, 2005, 2006 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
@@ -22,10 +22,10 @@
 #include <hurd.h>
 #include <hurd/id.h>
 
-/* Set the effective user ID, real user ID, and saved-set user ID,
-   of the calling process to EUID, RUID, and SUID, respectively.  */
+/* Set the real user ID, effective user ID, and saved-set user ID,
+   of the calling process to RUID, EUID, and SUID, respectively.  */
 int
-__setresuid (uid_t euid, uid_t ruid, uid_t suid)
+__setresuid (uid_t ruid, uid_t euid, uid_t suid)
 {
   auth_t newauth;
   error_t err;
@@ -75,3 +75,4 @@ __setresuid (uid_t euid, uid_t ruid, uid_t suid)
   return err;
 }
 libc_hidden_def (__setresuid)
+weak_alias (__setresuid, setresuid)
diff --git a/sysdeps/mach/hurd/setxattr.c b/sysdeps/mach/hurd/setxattr.c
new file mode 100644
index 0000000000..afabc8ee06
--- /dev/null
+++ b/sysdeps/mach/hurd/setxattr.c
@@ -0,0 +1,36 @@
+/* Access to extended attributes on files.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/xattr.h>
+#include <hurd.h>
+#include <hurd/xattr.h>
+
+ssize_t
+setxattr (const char *path, const char *name, const void *value, size_t size,
+	  int flags)
+{
+  error_t err;
+  file_t port = __file_name_lookup (path, 0, 0);
+  if (port == MACH_PORT_NULL)
+    return -1;
+  err = _hurd_xattr_set (port, name, value, size, flags);
+  __mach_port_deallocate (__mach_task_self (), port);
+  return __hurd_fail (err);
+}
diff --git a/sysdeps/mach/hurd/sigaltstack.c b/sysdeps/mach/hurd/sigaltstack.c
index ea3e07d26b..5b2f06561b 100644
--- a/sysdeps/mach/hurd/sigaltstack.c
+++ b/sysdeps/mach/hurd/sigaltstack.c
@@ -60,4 +60,4 @@ __sigaltstack (argss, oss)
 
   return 0;
 }
-weak_alias(__sigaltstack, sigaltstack)
+weak_alias (__sigaltstack, sigaltstack)
diff --git a/sysdeps/mach/hurd/symlinkat.c b/sysdeps/mach/hurd/symlinkat.c
new file mode 100644
index 0000000000..9a51c66d8d
--- /dev/null
+++ b/sysdeps/mach/hurd/symlinkat.c
@@ -0,0 +1,74 @@
+/* Create a symbolic link named relative to an open directory.  Hurd version.
+   Copyright (C) 1991,1992,1993,1994,1995,1996,1997,2006
+	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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <hurd.h>
+#include <hurd/paths.h>
+#include <hurd/fd.h>
+#include <string.h>
+
+
+/* Make a link to FROM called TO relative to FD.  */
+int
+symlinkat (from, fd, to)
+     const char *from;
+     int fd;
+     const char *to;
+{
+  error_t err;
+  file_t dir, node;
+  char *name;
+  const size_t len = strlen (from) + 1;
+  char buf[sizeof (_HURD_SYMLINK) + len];
+
+  /* A symlink is a file whose translator is "/hurd/symlink\0target\0".  */
+
+  memcpy (buf, _HURD_SYMLINK, sizeof (_HURD_SYMLINK));
+  memcpy (&buf[sizeof (_HURD_SYMLINK)], from, len);
+
+  dir = __file_name_split_at (fd, to, &name);
+  if (dir == MACH_PORT_NULL)
+    return -1;
+
+  /* Create a new, unlinked node in the target directory.  */
+  err = __dir_mkfile (dir, O_WRITE, 0777 & ~_hurd_umask, &node);
+
+  if (! err)
+    /* Set the node's translator to make it a symlink.  */
+    err = __file_set_translator (node,
+				 FS_TRANS_EXCL|FS_TRANS_SET,
+				 FS_TRANS_EXCL|FS_TRANS_SET, 0,
+				 buf, sizeof (_HURD_SYMLINK) + len,
+				 MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND);
+
+  if (! err)
+    /* Link the node, now a valid symlink, into the target directory.  */
+    err = __dir_link (dir, node, name, 1);
+
+  __mach_port_deallocate (__mach_task_self (), dir);
+  __mach_port_deallocate (__mach_task_self (), node);
+
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
diff --git a/sysdeps/mach/hurd/tls.h b/sysdeps/mach/hurd/tls.h
index bc15b4dab6..cce42ef374 100644
--- a/sysdeps/mach/hurd/tls.h
+++ b/sysdeps/mach/hurd/tls.h
@@ -1,5 +1,5 @@
 /* Definitions for thread-local data handling.  Hurd version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 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
@@ -23,6 +23,7 @@
 #if defined HAVE_TLS_SUPPORT && !defined ASSEMBLER
 
 # include <stddef.h>
+# include <stdbool.h>
 # include <mach/mig_errors.h>
 # include <mach.h>
 
@@ -31,7 +32,11 @@
 typedef union dtv
 {
   size_t counter;
-  void *pointer;
+  struct
+  {
+    void *val;
+    bool is_static;
+  } pointer;
 } dtv_t;
 
 
diff --git a/sysdeps/mach/hurd/unlinkat.c b/sysdeps/mach/hurd/unlinkat.c
new file mode 100644
index 0000000000..7740c5a297
--- /dev/null
+++ b/sysdeps/mach/hurd/unlinkat.c
@@ -0,0 +1,55 @@
+/* unlinkat -- Remove a name relative to an open directory.  Hurd version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+
+
+/* Remove the link named NAME.  */
+int
+unlinkat (fd, name, flag)
+     int fd;
+     const char *name;
+     int flag;
+{
+  error_t err;
+  file_t dir;
+  const char *file;
+
+  if ((flag &~ AT_REMOVEDIR) != 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  dir = __directory_name_split_at (fd, name, (char **) &file);
+  if (dir == MACH_PORT_NULL)
+    return -1;
+
+  err = ((flag & AT_REMOVEDIR) ? __dir_rmdir : __dir_unlink) (dir, file);
+  __mach_port_deallocate (__mach_task_self (), dir);
+
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
diff --git a/sysdeps/mach/hurd/xmknod.c b/sysdeps/mach/hurd/xmknod.c
index 2989215d9c..5f40188fb6 100644
--- a/sysdeps/mach/hurd/xmknod.c
+++ b/sysdeps/mach/hurd/xmknod.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,94,95,96,99,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1993,1994,1995,1996,1999,2002,2005,2006
+	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
@@ -17,13 +18,10 @@
    02111-1307 USA.  */
 
 #include <errno.h>
-#include <sys/stat.h>
-#include <hurd.h>
-#include <hurd/paths.h>
 #include <fcntl.h>
-#include "stdio-common/_itoa.h"
-#include <string.h>
+#include <stddef.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 
 
 /* Create a device file named FILE_NAME, with permission and special bits MODE
@@ -32,80 +30,6 @@
 int
 __xmknod (int vers, const char *file_name, mode_t mode, dev_t *dev)
 {
-  error_t err;
-  file_t dir, node;
-  char *name;
-  char buf[100], *bp;
-  const char *translator;
-  size_t len;
-
-  if (vers != _MKNOD_VER)
-    return __hurd_fail (EINVAL);
-
-  if (S_ISCHR (mode))
-    {
-      translator = _HURD_CHRDEV;
-      len = sizeof (_HURD_CHRDEV);
-    }
-  else if (S_ISBLK (mode))
-    {
-      translator = _HURD_BLKDEV;
-      len = sizeof (_HURD_BLKDEV);
-    }
-  else if (S_ISFIFO (mode))
-    {
-      translator = _HURD_FIFO;
-      len = sizeof (_HURD_FIFO);
-    }
-  else
-    {
-      errno = EINVAL;
-      return -1;
-    }
-
-  if (! S_ISFIFO (mode))
-    {
-      /* We set the translator to "ifmt\0major\0minor\0", where IFMT
-	 depends on the S_IFMT bits of our MODE argument, and MAJOR and
-	 MINOR are ASCII decimal (octal or hex would do as well)
-	 representations of our arguments.  Thus the convention is that
-	 CHRDEV and BLKDEV translators are invoked with two non-switch
-	 arguments, giving the major and minor device numbers in %i format. */
-
-      bp = buf + sizeof (buf);
-      *--bp = '\0';
-      bp = _itoa (minor (*dev), bp, 10, 0);
-      *--bp = '\0';
-      bp = _itoa (major (*dev), bp, 10, 0);
-      memcpy (bp - len, translator, len);
-      translator = bp - len;
-      len = buf + sizeof (buf) - translator;
-    }
-
-  dir = __file_name_split (file_name, &name);
-  if (dir == MACH_PORT_NULL)
-    return -1;
-
-  /* Create a new, unlinked node in the target directory.  */
-  err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
-
-  if (! err)
-    /* Set the node's translator to make it a device.  */
-    err = __file_set_translator (node,
-				 FS_TRANS_EXCL | FS_TRANS_SET,
-				 FS_TRANS_EXCL | FS_TRANS_SET, 0,
-				 translator, len,
-				 MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND);
-
-  if (! err)
-    /* Link the node, now a valid device, into the target directory.  */
-    err = __dir_link (dir, node, name, 1);
-
-  __mach_port_deallocate (__mach_task_self (), dir);
-  __mach_port_deallocate (__mach_task_self (), node);
-
-  if (err)
-    return __hurd_fail (err);
-  return 0;
+  return __xmknodat (vers, AT_FDCWD, file_name, mode, dev);
 }
 libc_hidden_def (__xmknod)
diff --git a/sysdeps/mach/hurd/xmknodat.c b/sysdeps/mach/hurd/xmknodat.c
new file mode 100644
index 0000000000..b2227593c9
--- /dev/null
+++ b/sysdeps/mach/hurd/xmknodat.c
@@ -0,0 +1,118 @@
+/* Create a device file relative to an open directory.  Hurd version.
+   Copyright (C) 1991,1992,1993,1994,1995,1996,1999,2002,2005,2006
+	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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <hurd.h>
+#include <hurd/fd.h>
+#include <hurd/paths.h>
+#include <fcntl.h>
+#include "stdio-common/_itoa.h"
+#include <string.h>
+#include <sys/types.h>
+
+/* Create a device file named PATH relative to FD, with permission and
+   special bits MODE and device number DEV (which can be constructed
+   from major and minor device numbers with the `makedev' macro
+   above).  */
+int
+__xmknodat (int vers, int fd, const char *path, mode_t mode, dev_t *dev)
+{
+  error_t err;
+  file_t dir, node;
+  char *name;
+  char buf[100], *bp;
+  const char *translator;
+  size_t len;
+
+  if (vers != _MKNOD_VER)
+    return __hurd_fail (EINVAL);
+
+  if (S_ISCHR (mode))
+    {
+      translator = _HURD_CHRDEV;
+      len = sizeof (_HURD_CHRDEV);
+    }
+  else if (S_ISBLK (mode))
+    {
+      translator = _HURD_BLKDEV;
+      len = sizeof (_HURD_BLKDEV);
+    }
+  else if (S_ISFIFO (mode))
+    {
+      translator = _HURD_FIFO;
+      len = sizeof (_HURD_FIFO);
+    }
+  else if (S_ISREG (mode))
+    {
+      translator = NULL;
+      len = 0;
+    }
+  else
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
+  if (translator != NULL && ! S_ISFIFO (mode))
+    {
+      /* We set the translator to "ifmt\0major\0minor\0", where IFMT
+	 depends on the S_IFMT bits of our MODE argument, and MAJOR and
+	 MINOR are ASCII decimal (octal or hex would do as well)
+	 representations of our arguments.  Thus the convention is that
+	 CHRDEV and BLKDEV translators are invoked with two non-switch
+	 arguments, giving the major and minor device numbers in %i format. */
+
+      bp = buf + sizeof (buf);
+      *--bp = '\0';
+      bp = _itoa (minor (*dev), bp, 10, 0);
+      *--bp = '\0';
+      bp = _itoa (major (*dev), bp, 10, 0);
+      memcpy (bp - len, translator, len);
+      translator = bp - len;
+      len = buf + sizeof (buf) - translator;
+    }
+
+  dir = __file_name_split_at (fd, path, &name);
+  if (dir == MACH_PORT_NULL)
+    return -1;
+
+  /* Create a new, unlinked node in the target directory.  */
+  err = __dir_mkfile (dir, O_WRITE, (mode & ~S_IFMT) & ~_hurd_umask, &node);
+
+  if (! err && translator != NULL)
+    /* Set the node's translator to make it a device.  */
+    err = __file_set_translator (node,
+				 FS_TRANS_EXCL | FS_TRANS_SET,
+				 FS_TRANS_EXCL | FS_TRANS_SET, 0,
+				 translator, len,
+				 MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND);
+
+  if (! err)
+    /* Link the node, now a valid device, into the target directory.  */
+    err = __dir_link (dir, node, name, 1);
+
+  __mach_port_deallocate (__mach_task_self (), dir);
+  __mach_port_deallocate (__mach_task_self (), node);
+
+  if (err)
+    return __hurd_fail (err);
+  return 0;
+}
diff --git a/sysdeps/mach/i386/syscall.S b/sysdeps/mach/i386/syscall.S
index 9e718f354d..ff50e971cc 100644
--- a/sysdeps/mach/i386/syscall.S
+++ b/sysdeps/mach/i386/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 2005 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
@@ -24,3 +24,4 @@ ENTRY (syscall)
 	pushl %ecx		/* Push back return address.  */
 	.byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- gas bug */
 	ret
+END (syscall)
diff --git a/sysdeps/mach/mips/Dist b/sysdeps/mach/mips/Dist
deleted file mode 100644
index f2699bf887..0000000000
--- a/sysdeps/mach/mips/Dist
+++ /dev/null
@@ -1 +0,0 @@
-cacheflush.c
diff --git a/sysdeps/mach/mips/Makefile b/sysdeps/mach/mips/Makefile
deleted file mode 100644
index a890ae7b46..0000000000
--- a/sysdeps/mach/mips/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ifeq ($(subdir),gnulib)
-sysdep_routines += cacheflush
-endif
diff --git a/sysdeps/mach/mips/cacheflush.c b/sysdeps/mach/mips/cacheflush.c
deleted file mode 100644
index 2a283e3e89..0000000000
--- a/sysdeps/mach/mips/cacheflush.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Flush the insn cache after GCC writes a closure on the stack.  Mach/MIPS.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <mach.h>
-#include <mach/vm_attributes.h>
-
-/* Stupid name, but this is what GCC generates (config/mips/mips.h).  */
-void
-cacheflush (void *addr, unsigned size, int flag)
-{
-  vm_machine_attribute_val_t val;
-
-  switch (flag)
-    {
-    case 0:			/* ? */
-      val = MATTR_VAL_DCACHE_FLUSH;
-    case 1:			/* This is the only value GCC uses.  */
-      val = MATTR_VAL_ICACHE_FLUSH;
-      break;
-    default:
-      val = MATTR_VAL_CACHE_FLUSH;
-    }
-
-  __vm_machine_attribute (__mach_task_self (),
-			  (vm_address_t) addr, size,
-			  MATTR_CACHE,
-			  &val);
-}
diff --git a/sysdeps/mach/mips/machine-lock.h b/sysdeps/mach/mips/machine-lock.h
deleted file mode 100644
index eccc720dfa..0000000000
--- a/sysdeps/mach/mips/machine-lock.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Machine-specific definition for spin locks.  MIPS version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MACHINE_LOCK_H
-#define	_MACHINE_LOCK_H
-
-/* To get the TAS pseudo-instruction. */
-#include <mach/mips/mips_instruction.h>
-
-/* The type of a spin lock variable.  */
-
-typedef __volatile int __spin_lock_t;
-
-/* Value to initialize `__spin_lock_t' variables to.  */
-
-#define	__SPIN_LOCK_INITIALIZER	0
-
-
-#ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
-#endif
-
-/* Unlock LOCK.  */
-
-_EXTERN_INLINE void
-__spin_unlock (__spin_lock_t *__lock)
-{
-  *__lock = 0;
-}
-
-/* Try to lock LOCK; return nonzero if we locked it, zero if another has.  */
-
-_EXTERN_INLINE int
-__spin_try_lock (register __spin_lock_t *__lock)
-{
-#if (__mips >= 2)
-  int __rtn;
-
-  __asm__ __volatile (".set noreorder");
-#if (__mips64)
-  __asm__ __volatile ("lld %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
-#else
-  __asm__ __volatile ("ll %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
-#endif
-  if (__rtn)
-    return 0;
-  __asm__ __volatile ("move %0,%1" : "=r" (__rtn) : "r" (__lock));
-#if (__mips64)
-  __asm__ __volatile ("scd %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
-#else
-  __asm__ __volatile ("sc %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
-#endif
-  __asm__ __volatile (".set reorder");
-  return __rtn;
-#else
-  register int __rtn __asm__ ("a0");
-
-  /* Use the Mach microkernel's emulated TAS pseudo-instruction.  */
-  __asm__ __volatile (".set noreorder");
-  __asm__ __volatile (".word %1" : "=r" (__rtn) : "i" (op_tas), "0" (__lock));
-  __asm__ __volatile ("nop");
-  __asm__ __volatile (".set reorder");
-  return __rtn ^ (int) __lock;
-#endif
-}
-
-/* Return nonzero if LOCK is locked.  */
-
-_EXTERN_INLINE int
-__spin_lock_locked (__spin_lock_t *__lock)
-{
-  return *__lock != 0;
-}
-
-
-#endif /* machine-lock.h */
diff --git a/sysdeps/mach/mips/machine-sp.h b/sysdeps/mach/mips/machine-sp.h
deleted file mode 100644
index 144356a39f..0000000000
--- a/sysdeps/mach/mips/machine-sp.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Machine-specific function to return the stack pointer.  MIPS version.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MACHINE_SP_H
-#define _MACHINE_SP_H
-
-/* Return the current stack pointer.  */
-
-#ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
-#endif
-
-_EXTERN_INLINE void *
-__thread_stack_pointer (void)
-{
-  void *__sp__;
-  __asm__ ("move %0,$29" : "=r" (__sp__));
-  return __sp__;
-}
-
-#endif	/* machine-sp.h */
-
diff --git a/sysdeps/mach/mips/syscall.S b/sysdeps/mach/mips/syscall.S
deleted file mode 100644
index f2fc29df15..0000000000
--- a/sysdeps/mach/mips/syscall.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifdef PIC
-	.option pic2
-#endif
-ENTRY (syscall)
-	move	v0, a0		/* Load system call number from first arg.  */
-	move	a0, a1		/* Move the next three args up a register.  */
-	move	a1, a2
-	move	a2, a3
-     	/* Load the remaining possible args (up to 11) from the stack.  */
-#ifdef __mips64
-	ld	t0,4*8(sp)
-	ld	t1,5*8(sp)
-	ld	t2,6*8(sp)
-	ld	t3,7*8(sp)
-	ld	t4,8*8(sp)
-	ld	t5,9*8(sp)
-	ld	t6,10*8(sp)
-#else
-	lw	t0,4*4(sp)
-	lw	t1,5*4(sp)
-	lw	t2,6*4(sp)
-	lw	t3,7*4(sp)
-	lw	t4,8*4(sp)
-	lw	t5,9*4(sp)
-	lw	t6,10*4(sp)
-#endif
-	syscall			/* Do the system call.  */
-     	j ra			/* Return to caller.  */
diff --git a/sysdeps/mach/mips/sysdep.h b/sysdeps/mach/mips/sysdep.h
deleted file mode 100644
index 8136f95bf2..0000000000
--- a/sysdeps/mach/mips/sysdep.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define LOSE asm volatile ("1: b 1b")
-
-#define START_MACHDEP asm ("\
-	.text\n\
-	.globl _start\n\
-	.ent _start\n\
-_start:\n\
-	# Put initial SP in a0.\n\
-	move $4, $29\n\
-	# Jump to _start0; don't return.\n\
-	j _start0\n\
-	.end _start\n\
-");
-#define START_ARGS	int *entry_sp
-#define SNARF_ARGS(argc, argv, envp)					      \
-  do									      \
-    {									      \
-      register char **p;						      \
-									      \
-      argc = *entry_sp;							      \
-      argv = (char **) (entry_sp + 1);					      \
-      p = argv;								      \
-      while (*p++ != NULL)						      \
-	;								      \
-      if (p >= (char **) argv[0])					      \
-	--p;								      \
-      envp = p;							      \
-    } while (0)
-
-#define CALL_WITH_SP(fn, sp) \
-  ({ register int __fn = fn, __sp = (int) sp; \
-     asm volatile ("move $sp,%0; j %1" : : "r" (__sp), "r" (__fn));})
-
-#define RETURN_TO(sp, pc, retval) \
-  asm volatile ("move $29, %0; move $2, %2; move $25, %1; jr $25" \
-		: : "r" (sp), "r" (pc), "r" (retval))
-
-#define STACK_GROWTH_DOWN
-
-#include <syscall.h>
-
-#if defined (__ASSEMBLER__)
-
-#define ALIGN	2
-
-#define MOVE(x,y)	move y , x
-
-#define SYSCALL(name, args)	\
-  .globl syscall_error;	\
-  kernel_trap(name,SYS_##name,args);	\
-  beq $1,$0,1f;	\
-  j syscall_error;	\
-1:
-
-#define SYSCALL__(name, args)	\
-  .globl syscall_error;	\
-  kernel_trap(__##name,SYS_##name,args);	\
-  beq $1,$0,1f;	\
-  j syscall_error;	\
-1:
-
-#define ret	j ra; nop
-#endif
-
-#include <sysdeps/mach/sysdep.h>
diff --git a/sysdeps/mach/mips/thread_state.h b/sysdeps/mach/mips/thread_state.h
deleted file mode 100644
index a0800de2d0..0000000000
--- a/sysdeps/mach/mips/thread_state.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Mach thread state definitions for machine-independent code.  MIPS version.
-   Copyright (C) 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define MACHINE_THREAD_STATE_FLAVOR	MIPS_THREAD_STATE
-#define MACHINE_THREAD_STATE_COUNT	MIPS_THREAD_STATE_COUNT
-
-#ifdef __PIC__
-#define MACHINE_THREAD_STATE_SET_PC(ts, pc) \
-  ((ts)->PC = (ts)->r25 = (unsigned long int) (pc))
-#endif
-
-#define machine_thread_state mips_thread_state
-
-#define PC pc
-#define SP r29
-#define SYSRETURN r2
-
-struct machine_thread_all_state
-  {
-    int set;			/* Mask of bits (1 << FLAVOR).  */
-    struct mips_thread_state basic;
-    struct mips_exc_state exc;
-    struct mips_float_state fpu;
-  };
-
-#include <sysdeps/mach/thread_state.h>
diff --git a/sysdeps/mach/msync.c b/sysdeps/mach/msync.c
index cf62960b4f..567143f728 100644
--- a/sysdeps/mach/msync.c
+++ b/sysdeps/mach/msync.c
@@ -1,5 +1,5 @@
 /* msync -- Synchronize mapped memory to external storage.  Mach version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 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
@@ -26,7 +26,7 @@
    define the VM_SYNC_* bits when we include <mach/mach_types.h>.  */
 
 #ifndef VM_SYNC_SYNCHRONOUS
-# include <sysdeps/generic/msync.c>
+# include <misc/msync.c>
 #else
 
 /* Synchronize the region starting at ADDR and extending LEN bytes with the
diff --git a/sysdeps/mach/sched_yield.c b/sysdeps/mach/sched_yield.c
index 448ca2ce8b..0c35ef0983 100644
--- a/sysdeps/mach/sched_yield.c
+++ b/sysdeps/mach/sched_yield.c
@@ -1,5 +1,5 @@
 /* sched_yield -- yield the processor.  Mach version.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2006 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
@@ -28,4 +28,5 @@ __sched_yield (void)
   (void) __swtch ();
   return 0;
 }
+libc_hidden_def (__sched_yield)
 weak_alias (__sched_yield, sched_yield)
diff --git a/sysdeps/mach/sys/reboot.h b/sysdeps/mach/sys/reboot.h
index 5e49f7fa87..fc7308929b 100644
--- a/sysdeps/mach/sys/reboot.h
+++ b/sysdeps/mach/sys/reboot.h
@@ -24,137 +24,7 @@
  * the rights to redistribute these changes.
  */
 /*
- * HISTORY
- * $Log$
- * Revision 1.4  2002/07/06 06:36:00  aj
- * 	* sysdeps/ia64/fpu/e_acos.S: Added text of Intel license.
- * 	* sysdeps/ia64/fpu/e_acosf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_acosl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_asin.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_asinf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_asinl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_atan2.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_atan2f.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_cosh.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_coshf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_coshl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_exp.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_expf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_fmod.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_fmodf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_fmodl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_hypot.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_hypotf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_hypotl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_log.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_logf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_pow.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_powf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_powl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_remainder.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_remainderf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_remainderl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_scalb.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_scalbf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_scalbl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_sinh.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_sinhf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_sinhl.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_sqrt.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_sqrtf.S: Likewise.
- * 	* sysdeps/ia64/fpu/e_sqrtl.S: Likewise.
- * 	* sysdeps/ia64/fpu/libm_atan2_req.S: Likewise.
- * 	* sysdeps/ia64/fpu/libm_error.c: Likewise.
- * 	* sysdeps/ia64/fpu/libm_frexp4.S: Likewise.
- * 	* sysdeps/ia64/fpu/libm_frexp4f.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_frexpl.c: Likewise.
- * 	* sysdeps/ia64/fpu/s_ilogb.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_ilogbf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_ilogbl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_ldexp.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_ldexpf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_ldexpl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_log1p.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_log1pf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_log1pl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_logb.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_logbf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_logbl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_modf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_modff.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_modfl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_nearbyint.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_nearbyintf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_nearbyintl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_rint.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_rintf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_rintl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_round.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_roundf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_roundl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_scalbn.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_scalbnf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_scalbnl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_significand.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_significandf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_significandl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_tan.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_tanf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_tanl.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_trunc.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_truncf.S: Likewise.
- * 	* sysdeps/ia64/fpu/s_truncl.S: Likewise.
- * 	* sysdeps/ieee754/dbl-64/doasin.c: changed copyright notice to
- * 	reflect IBM donation of math library to FSF
- * 	* sysdeps/ieee754/dbl-64/dosincos.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/e_asin.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/e_atan2.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/e_exp.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/e_log.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/e_pow.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/e_remainder.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/mpa.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/mpatan.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/mpatan2.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/mpexp.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/mplog.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/mpsqrt.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/mptan.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/s_atan.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/s_sin.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/s_tan.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/sincos32.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/slowexp.c: Likewise.
- * 	* sysdeps/ieee754/dbl-64/slowpow.c: Likewise.
- * 	* sysdeps/gnu/netinet/udp.h: Added BSD copying permission notice
- * 	* sysdeps/vax/__longjmp.c: Likewise.
- * 	* sysdeps/vax/setjmp.c: Likewise.
- * 	* libio/filedoalloc.c: Fixed BSD copying permission notice to remove
- * 	advertising clause
- * 	* sysdeps/vax/htonl.s: Likewise.
- * 	* sysdeps/vax/htons.s: Likewise.
- * 	* libio/wfiledoalloc.c: Likewise.
- * 	* stdlib/random.c: Likewise.
- * 	* stdlib/random_r.c: Likewise.
- * 	* sysdeps/mach/sys/reboot.h: Likewise.
- *         * inet/getnameinfo.c: Deleted advertising clause from Inner Net License
- *         * sysdeps/posix/getaddrinfo.c: Likewise.
- *         * sunrpc/des_impl.c: Updated license permission notice to Lesser GPL
- *           and corrected pointer to point to the correct license.
- *
- * Revision 1.3  2000/03/27 04:09:08  roland
- * 2000-03-26  Roland McGrath  <roland@baalperazim.frob.com>
- *
- * 	* sysdeps/mach/sys/reboot.h: Include <features.h>.
- * 	(reboot): Declare it.
- *
- * Revision 1.2  1998/05/29 10:19:59  drepper
- * Use __ASSEMBLER__ test macro not ASSEMBLER.
- *
- * Revision 1.1  1993/08/03 22:25:15  roland
- * entered into RCS
+ * (pre-GNU) HISTORY
  *
  * Revision 2.8  93/03/11  13:46:40  danner
  * 	u_long -> u_int.
@@ -188,7 +58,7 @@
 /*
    Copyright (C) 1982, 1986, 1988 Regents of the University of California.
    All rights reserved.
- 
+
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:
@@ -201,7 +71,7 @@
    4. Neither the name of the University nor the names of its contributors
       may be used to endorse or promote products derived from this software
       without specific prior written permission.
-   
+
    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
diff --git a/sysdeps/mips/.cvsignore b/sysdeps/mips/.cvsignore
deleted file mode 100644
index 1f69fd919a..0000000000
--- a/sysdeps/mips/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.gz *.Z *.tar *.tgz
-=*
-TODO COPYING* AUTHORS copyr-* copying.*
-glibc-*
diff --git a/sysdeps/mips/Dist b/sysdeps/mips/Dist
deleted file mode 100644
index 1fbf36aaad..0000000000
--- a/sysdeps/mips/Dist
+++ /dev/null
@@ -1,8 +0,0 @@
-setjmp_aux.c
-regdef.h
-sgidefs.h
-fpregdef.h
-fpu/fenv_libc.h
-sys/fpregdef.h
-sys/regdef.h
-sys/asm.h
diff --git a/sysdeps/mips/Implies b/sysdeps/mips/Implies
deleted file mode 100644
index 8c18cb3034..0000000000
--- a/sysdeps/mips/Implies
+++ /dev/null
@@ -1,3 +0,0 @@
-# MIPS uses IEEE 754 floating point.
-ieee754/flt-32
-ieee754/dbl-64
diff --git a/sysdeps/mips/Makefile b/sysdeps/mips/Makefile
deleted file mode 100644
index 49ad3e1b91..0000000000
--- a/sysdeps/mips/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-ifeq ($(subdir),misc)
-sysdep_headers += regdef.h fpregdef.h sys/regdef.h sys/fpregdef.h \
-		  sys/asm.h sgidefs.h
-endif
-
-ifeq ($(subdir),setjmp)
-sysdep_routines += setjmp_aux
-endif
-
-ifeq ($(subdir),rt)
-librt-sysdep_routines += rt-sysdep
-endif
diff --git a/sysdeps/mips/__longjmp.c b/sysdeps/mips/__longjmp.c
deleted file mode 100644
index 750a71fd1e..0000000000
--- a/sysdeps/mips/__longjmp.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-#include <stdlib.h>
-
-#undef __longjmp
-
-#ifndef	__GNUC__
-  #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-void
-__longjmp (env, val_arg)
-     __jmp_buf env;
-     int val_arg;
-{
-  /* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before
-     the hack around it); force it to use $a1 for the longjmp value.
-     Without this it saves $a1 in a register which gets clobbered
-     along the way.  */
-  register int val asm ("a1");
-
-  /* Pull back the floating point callee-saved registers.  */
-  asm volatile ("l.d $f20, %0" : : "m" (env[0].__fpregs[0]));
-  asm volatile ("l.d $f22, %0" : : "m" (env[0].__fpregs[1]));
-  asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[2]));
-  asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[3]));
-  asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
-  asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5]));
-
-  /* Get and reconstruct the floating point csr.  */
-  asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
-  asm volatile ("ctc1 $2, $31");
-
-  /* Get the GP. */
-  asm volatile ("lw $gp, %0" : : "m" (env[0].__gp));
-
-  /* Get the callee-saved registers.  */
-  asm volatile ("lw $16, %0" : : "m" (env[0].__regs[0]));
-  asm volatile ("lw $17, %0" : : "m" (env[0].__regs[1]));
-  asm volatile ("lw $18, %0" : : "m" (env[0].__regs[2]));
-  asm volatile ("lw $19, %0" : : "m" (env[0].__regs[3]));
-  asm volatile ("lw $20, %0" : : "m" (env[0].__regs[4]));
-  asm volatile ("lw $21, %0" : : "m" (env[0].__regs[5]));
-  asm volatile ("lw $22, %0" : : "m" (env[0].__regs[6]));
-  asm volatile ("lw $23, %0" : : "m" (env[0].__regs[7]));
-
-  /* Get the PC.  */
-  asm volatile ("lw $25, %0" : : "m" (env[0].__pc));
-
-  /* Restore the stack pointer and the FP.  They have to be restored
-     last and in a single asm as gcc, depending on options used, may
-     use either of them to access env.  */
-  asm volatile ("lw $29, %0\n\t"
-		"lw $30, %1\n\t" : : "m" (env[0].__sp), "m" (env[0].__fp));
-
-/* Give setjmp 1 if given a 0, or what they gave us if non-zero.  */
-  if (val == 0)
-    asm volatile ("li $2, 1");
-  else
-    asm volatile ("move $2, %0" : : "r" (val));
-
-  asm volatile ("jr $25");
-
-  /* Avoid `volatile function does return' warnings.  */
-  for (;;);
-}
diff --git a/sysdeps/mips/abort-instr.h b/sysdeps/mips/abort-instr.h
deleted file mode 100644
index d7d8d501b3..0000000000
--- a/sysdeps/mips/abort-instr.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* An instruction which should crash any program is a breakpoint.  */
-#define ABORT_INSTRUCTION asm ("break 255")
diff --git a/sysdeps/mips/add_n.S b/sysdeps/mips/add_n.S
deleted file mode 100644
index c82871f701..0000000000
--- a/sysdeps/mips/add_n.S
+++ /dev/null
@@ -1,122 +0,0 @@
-/* MIPS2 __mpn_add_n -- Add two limb vectors of the same length > 0 and
-store sum in a third limb vector.
-
-Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.  */
-
-#include <sysdep.h>
-
-/* INPUT PARAMETERS
-   res_ptr	$4
-   s1_ptr	$5
-   s2_ptr	$6
-   size		$7
-*/
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__mpn_add_n)
-	.set	noreorder
-#ifdef __PIC__
-	.cpload t9
-#endif
-	.set	nomacro
-
-	lw	$10,0($5)
-	lw	$11,0($6)
-
-	addiu	$7,$7,-1
-	and	$9,$7,4-1	/* number of limbs in first loop */
-	beq	$9,$0,L(L0)	/* if multiple of 4 limbs, skip first loop */
-	move	$2,$0
-
-	subu	$7,$7,$9
-
-L(Loop0):	addiu	$9,$9,-1
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,4
-	addiu	$6,$6,4
-	move	$10,$12
-	move	$11,$13
-	bne	$9,$0,L(Loop0)
-	addiu	$4,$4,4
-
-L(L0):	beq	$7,$0,L(end)
-	nop
-
-L(Loop):	addiu	$7,$7,-4
-
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	lw	$10,8($5)
-	addu	$13,$13,$2
-	lw	$11,8($6)
-	sltu	$8,$13,$2
-	addu	$13,$12,$13
-	sltu	$2,$13,$12
-	sw	$13,4($4)
-	or	$2,$2,$8
-
-	lw	$12,12($5)
-	addu	$11,$11,$2
-	lw	$13,12($6)
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,8($4)
-	or	$2,$2,$8
-
-	lw	$10,16($5)
-	addu	$13,$13,$2
-	lw	$11,16($6)
-	sltu	$8,$13,$2
-	addu	$13,$12,$13
-	sltu	$2,$13,$12
-	sw	$13,12($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,16
-	addiu	$6,$6,16
-
-	bne	$7,$0,L(Loop)
-	addiu	$4,$4,16
-
-L(end):	addu	$11,$11,$2
-	sltu	$8,$11,$2
-	addu	$11,$10,$11
-	sltu	$2,$11,$10
-	sw	$11,0($4)
-	j	$31
-	or	$2,$2,$8
-	.end __mpn_add_n
diff --git a/sysdeps/mips/addmul_1.S b/sysdeps/mips/addmul_1.S
deleted file mode 100644
index 3e1fc09d10..0000000000
--- a/sysdeps/mips/addmul_1.S
+++ /dev/null
@@ -1,99 +0,0 @@
-/* MIPS __mpn_addmul_1 -- Multiply a limb vector with a single limb and
-add the product to a second limb vector.
-
-Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.  */
-
-#include <sysdep.h>
-
-/* INPUT PARAMETERS
-   res_ptr	$4
-   s1_ptr	$5
-   size		$6
-   s2_limb	$7
-*/
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__mpn_addmul_1)
-	.set    noreorder
-#ifdef __PIC__
-	.cpload t9
-#endif
-	.set    nomacro
-
-	/* warm up phase 0 */
-	lw	$8,0($5)
-
-	/* warm up phase 1 */
-	addiu	$5,$5,4
-	multu	$8,$7
-
-	addiu	$6,$6,-1
-	beq	$6,$0,L(LC0)
-	move	$2,$0		/* zero cy2 */
-
-	addiu	$6,$6,-1
-	beq	$6,$0,L(LC1)
-	lw	$8,0($5)	/* load new s1 limb as early as possible */
-
-L(Loop):	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addiu	$5,$5,4
-	addu	$3,$3,$2	/* add old carry limb to low product limb */
-	multu	$8,$7
-	lw	$8,0($5)	/* load new s1 limb as early as possible */
-	addiu	$6,$6,-1	/* decrement loop counter */
-	sltu	$2,$3,$2	/* carry from previous addition -> $2 */
-	addu	$3,$10,$3
-	sltu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	bne	$6,$0,L(Loop)	/* should be "bnel" */
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-
-	/* cool down phase 1 */
-L(LC1):	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	multu	$8,$7
-	addu	$3,$10,$3
-	sltu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-
-	/* cool down phase 0 */
-L(LC0):	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	addu	$3,$10,$3
-	sltu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	j	$31
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-	END (__mpn_addmul_1)
diff --git a/sysdeps/mips/atomicity.h b/sysdeps/mips/atomicity.h
deleted file mode 100644
index 7380e1000c..0000000000
--- a/sysdeps/mips/atomicity.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Low-level functions for atomic operations. Mips version.
-   Copyright (C) 2001, 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MIPS_ATOMICITY_H
-#define _MIPS_ATOMICITY_H    1
-
-#include <inttypes.h>
-#include <sgidefs.h>
-
-static inline int
-__attribute__ ((unused))
-exchange_and_add (volatile uint32_t *mem, int val)
-{
-  int result, tmp;
-
-  __asm__ __volatile__
-    ("/* Inline exchange & add */\n"
-     "1:\n\t"
-     ".set	push\n\t"
-#if _MIPS_SIM == _ABIO32
-     ".set	mips2\n\t"
-#endif
-     "ll	%0,%3\n\t"
-     "addu	%1,%4,%0\n\t"
-     "sc	%1,%2\n\t"
-     ".set	pop\n\t"
-     "beqz	%1,1b\n\t"
-     "/* End exchange & add */"
-     : "=&r"(result), "=&r"(tmp), "=m"(*mem)
-     : "m" (*mem), "r"(val)
-     : "memory");
-
-  return result;
-}
-
-static inline void
-__attribute__ ((unused))
-atomic_add (volatile uint32_t *mem, int val)
-{
-  int result;
-
-  __asm__ __volatile__
-    ("/* Inline atomic add */\n"
-     "1:\n\t"
-     ".set	push\n\t"
-#if _MIPS_SIM == _ABIO32
-     ".set	mips2\n\t"
-#endif
-     "ll	%0,%2\n\t"
-     "addu	%0,%3,%0\n\t"
-     "sc	%0,%1\n\t"
-     ".set	pop\n\t"
-     "beqz	%0,1b\n\t"
-     "/* End atomic add */"
-     : "=&r"(result), "=m"(*mem)
-     : "m" (*mem), "r"(val)
-     : "memory");
-}
-
-static inline int
-__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
-{
-  long int ret, temp;
-
-  __asm__ __volatile__
-    ("/* Inline compare & swap */\n"
-     "1:\n\t"
-     ".set	push\n\t"
-#if _MIPS_SIM == _ABIO32
-     ".set	mips2\n\t"
-#endif
-#if _MIPS_SIM == _ABI64
-     "lld	%1,%5\n\t"
-#else
-     "ll	%1,%5\n\t"
-#endif
-     "move	%0,$0\n\t"
-     "bne	%1,%3,2f\n\t"
-     "move	%0,%4\n\t"
-#if _MIPS_SIM == _ABI64
-     "scd	%0,%2\n\t"
-#else
-     "sc	%0,%2\n\t"
-#endif
-     ".set	pop\n\t"
-     "beqz	%0,1b\n"
-     "2:\n\t"
-     "/* End compare & swap */"
-     : "=&r" (ret), "=&r" (temp), "=m" (*p)
-     : "r" (oldval), "r" (newval), "m" (*p)
-     : "memory");
-
-  return ret;
-}
-
-#endif /* atomicity.h */
diff --git a/sysdeps/mips/bits/dlfcn.h b/sysdeps/mips/bits/dlfcn.h
deleted file mode 100644
index a5b5bf53ff..0000000000
--- a/sysdeps/mips/bits/dlfcn.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* System dependent definitions for run-time dynamic loading.
-   Copyright (C) 1996, 1997, 1999, 2000, 2001, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _DLFCN_H
-# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
-#endif
-
-/* The MODE argument to `dlopen' contains one of the following: */
-#define RTLD_LAZY	0x0001	/* Lazy function call binding.  */
-#define RTLD_NOW	0x0002	/* Immediate function call binding.  */
-#define RTLD_BINDING_MASK  0x3	/* Mask of binding time value.  */
-#define RTLD_NOLOAD	0x00008	/* Do not load the object.  */
-#define RTLD_DEEPBIND	0x00010	/* Use deep binding.  */
-
-/* If the following bit is set in the MODE argument to `dlopen',
-   the symbols of the loaded object and its dependencies are made
-   visible as if the object were linked directly into the program.  */
-#define RTLD_GLOBAL	0x0004
-
-/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
-   The implementation does this by default and so we can define the
-   value to zero.  */
-#define RTLD_LOCAL      0
-
-/* Do not delete object when closed.  */
-#define RTLD_NODELETE	0x01000
-
-#ifdef __USE_GNU
-/* To support profiling of shared objects it is a good idea to call
-   the function found using `dlsym' using the following macro since
-   these calls do not use the PLT.  But this would mean the dynamic
-   loader has no chance to find out when the function is called.  The
-   macro applies the necessary magic so that profiling is possible.
-   Rewrite
-	foo = (*fctp) (arg1, arg2);
-   into
-        foo = DL_CALL_FCT (fctp, (arg1, arg2));
-*/
-# define DL_CALL_FCT(fctp, args) \
-  (_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args)
-
-__BEGIN_DECLS
-
-/* This function calls the profiling functions.  */
-extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW;
-
-__END_DECLS
-
-#endif
diff --git a/sysdeps/mips/bits/endian.h b/sysdeps/mips/bits/endian.h
deleted file mode 100644
index 9586104ccd..0000000000
--- a/sysdeps/mips/bits/endian.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* The MIPS architecture has selectable endianness.
-   This file is for a machine using big-endian mode.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#if __MIPSEB
-# define __BYTE_ORDER __BIG_ENDIAN
-#endif
-#if __MIPSEL
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
diff --git a/sysdeps/mips/bits/fenv.h b/sysdeps/mips/bits/fenv.h
deleted file mode 100644
index 24e0694ca5..0000000000
--- a/sysdeps/mips/bits/fenv.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Copyright (C) 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-
-/* Define bits representing the exception.  We use the bit positions
-   of the appropriate bits in the FPU control word.  */
-enum
-  {
-    FE_INEXACT = 0x04,
-#define FE_INEXACT	FE_INEXACT
-    FE_UNDERFLOW = 0x08,
-#define FE_UNDERFLOW	FE_UNDERFLOW
-    FE_OVERFLOW = 0x10,
-#define FE_OVERFLOW	FE_OVERFLOW
-    FE_DIVBYZERO = 0x20,
-#define FE_DIVBYZERO	FE_DIVBYZERO
-    FE_INVALID = 0x40,
-#define FE_INVALID	FE_INVALID
-  };
-
-#define FE_ALL_EXCEPT \
-	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* The MIPS FPU supports all of the four defined rounding modes.  We
-   use again the bit positions in the FPU control word as the values
-   for the appropriate macros.  */
-enum
-  {
-    FE_TONEAREST = 0x0,
-#define FE_TONEAREST	FE_TONEAREST
-    FE_TOWARDZERO = 0x1,
-#define FE_TOWARDZERO	FE_TOWARDZERO
-    FE_UPWARD = 0x2,
-#define FE_UPWARD	FE_UPWARD
-    FE_DOWNWARD = 0x3
-#define FE_DOWNWARD	FE_DOWNWARD
-  };
-
-
-/* Type representing exception flags.  */
-typedef unsigned short int fexcept_t;
-
-
-/* Type representing floating-point environment.  This function corresponds
-   to the layout of the block written by the `fstenv'.  */
-typedef struct
-  {
-    unsigned int __fp_control_register;
-  }
-fenv_t;
-
-/* If the default argument is used we use this value.  */
-#define FE_DFL_ENV	((__const fenv_t *) -1)
-
-#ifdef __USE_GNU
-/* Floating-point environment where none of the exception is masked.  */
-# define FE_NOMASK_ENV  ((__const fenv_t *) -2)
-#endif
diff --git a/sysdeps/mips/bits/ipctypes.h b/sysdeps/mips/bits/ipctypes.h
deleted file mode 100644
index 0956e7d58c..0000000000
--- a/sysdeps/mips/bits/ipctypes.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM.  MIPS version
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*
- * Never include <bits/ipctypes.h> directly.
- */
-
-#ifndef _BITS_IPCTYPES_H
-#define _BITS_IPCTYPES_H	1
-
-#include <bits/types.h>
-
-typedef __SLONG32_TYPE __ipc_pid_t;
-
-
-#endif /* bits/ipctypes.h */
diff --git a/sysdeps/mips/bits/nan.h b/sysdeps/mips/bits/nan.h
deleted file mode 100644
index baaaa551fb..0000000000
--- a/sysdeps/mips/bits/nan.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* `NAN' constant for IEEE 754 machines.
-   Copyright (C) 1992, 1996, 1997, 1999, 2002, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MATH_H
-# error "Never use <bits/nan.h> directly; include <math.h> instead."
-#endif
-
-
-/* IEEE Not A Number (QNaN). Note that MIPS has the QNaN and SNaN patterns
-   reversed compared to most other architectures. The IEEE spec left
-   the definition of this open to implementations, and for MIPS the top
-   bit of the mantissa must be SET to indicate a SNaN.  */
-
-#if __GNUC_PREREQ(3,3)
-
-# define NAN	(__builtin_nanf(""))
-
-#elif defined __GNUC__
-
-# define NAN \
-  (__extension__                                                            \
-   ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; })  \
-    { __l: 0x7fbfffffUL }).__d)
-
-#else
-
-# include <endian.h>
-
-# if __BYTE_ORDER == __BIG_ENDIAN
-#  define __nan_bytes		{ 0x7f, 0xbf, 0xff, 0xff }
-# endif
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define __nan_bytes		{ 0xff, 0xff, 0xbf, 0x7f }
-# endif
-
-static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
-# define NAN	(__nan_union.__d)
-
-#endif	/* GCC.  */
diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h
deleted file mode 100644
index ec0aaa020d..0000000000
--- a/sysdeps/mips/bits/setjmp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Define the machine-dependent type `jmp_buf'.  MIPS version.
-   Copyright (C) 1992, 1993, 1995, 1997, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SETJMP_H
-# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-#endif
-
-#include <sgidefs.h>
-
-typedef struct
-  {
-#if _MIPS_SIM == _ABIO32
-    /* Program counter.  */
-    __ptr_t __pc;
-
-    /* Stack pointer.  */
-    __ptr_t __sp;
-
-    /* Callee-saved registers s0 through s7.  */
-    int __regs[8];
-
-    /* The frame pointer.  */
-    __ptr_t __fp;
-
-    /* The global pointer.  */
-    __ptr_t __gp;
-#else
-    /* Program counter.  */
-    __extension__ long long __pc;
-
-    /* Stack pointer.  */
-    __extension__ long long __sp;
-
-    /* Callee-saved registers s0 through s7.  */
-    __extension__ long long __regs[8];
-
-    /* The frame pointer.  */
-    __extension__ long long __fp;
-
-    /* The global pointer.  */
-    __extension__ long long __gp;
-#endif
-
-    /* Floating point status register.  */
-    int __fpc_csr;
-
-    /* Callee-saved floating point registers.  */
-#if _MIPS_SIM == _ABI64
-    double __fpregs[8];
-#else
-    double __fpregs[6];
-#endif
-  } __jmp_buf[1];
-
-#ifdef __USE_MISC
-/* Offset to the program counter in `jmp_buf'.  */
-# define JB_PC	0
-#endif
-
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (jmpbuf)[0].__sp)
diff --git a/sysdeps/mips/bits/wordsize.h b/sysdeps/mips/bits/wordsize.h
deleted file mode 100644
index 666c7ad07e..0000000000
--- a/sysdeps/mips/bits/wordsize.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define __WORDSIZE	_MIPS_SZPTR
diff --git a/sysdeps/mips/bsd-_setjmp.S b/sysdeps/mips/bsd-_setjmp.S
deleted file mode 100644
index 5e3ad50305..0000000000
--- a/sysdeps/mips/bsd-_setjmp.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  MIPS version.
-   Copyright (C) 1996, 1997, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-#include <sysdep.h>
-
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (_setjmp)
-#ifdef __PIC__
-	.set	noreorder
-	.cpload t9
-	.set	reorder
-	la	t9, C_SYMBOL_NAME (__sigsetjmp)
-#endif
-	move	a1,zero		/* Pass a second argument of zero.  */
-#ifdef __PIC__
-	jr	t9
-#else
-	j	C_SYMBOL_NAME (__sigsetjmp)
-#endif
-	.end	_setjmp
-libc_hidden_def (_setjmp)
diff --git a/sysdeps/mips/bsd-setjmp.S b/sysdeps/mips/bsd-setjmp.S
deleted file mode 100644
index 0aea011328..0000000000
--- a/sysdeps/mips/bsd-setjmp.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  MIPS version.
-   Copyright (C) 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-#include <sysdep.h>
-
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (setjmp)
-	.set	noreorder
-#ifdef __PIC__
-	.cpload t9
-	.set	reorder
-	la	t9, C_SYMBOL_NAME (__sigsetjmp)
-#endif
-	li	a1, 1		/* Pass a second argument of one.  */
-#ifdef __PIC__
-	jr	t9
-#else
-	j	C_SYMBOL_NAME (__sigsetjmp)
-#endif
-	.end	setjmp
diff --git a/sysdeps/mips/dl-dtprocnum.h b/sysdeps/mips/dl-dtprocnum.h
deleted file mode 100644
index dfd03ba317..0000000000
--- a/sysdeps/mips/dl-dtprocnum.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Configuration of lookup functions.  MIPS version.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Number of extra dynamic section entries for this architecture.  By
-   default there are none.  */
-#define DT_THISPROCNUM	DT_MIPS_NUM
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
deleted file mode 100644
index 0d87b65691..0000000000
--- a/sysdeps/mips/dl-machine.h
+++ /dev/null
@@ -1,777 +0,0 @@
-/* Machine-dependent ELF dynamic relocation inline functions.  MIPS version.
-   Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/*  FIXME: Profiling of shared libraries is not implemented yet.  */
-#ifndef dl_machine_h
-#define dl_machine_h
-
-#define ELF_MACHINE_NAME "MIPS"
-
-#define ELF_MACHINE_NO_PLT
-
-#include <entry.h>
-
-#ifndef ENTRY_POINT
-#error ENTRY_POINT needs to be defined for MIPS.
-#endif
-
-#include <sgidefs.h>
-#include <sys/asm.h>
-
-/* The offset of gp from GOT might be system-dependent.  It's set by
-   ld.  The same value is also */
-#define OFFSET_GP_GOT 0x7ff0
-
-#ifndef _RTLD_PROLOGUE
-# define _RTLD_PROLOGUE(entry)						\
-	".globl\t" __STRING(entry) "\n\t"				\
-	".ent\t" __STRING(entry) "\n\t"					\
-	".type\t" __STRING(entry) ", @function\n"			\
-	__STRING(entry) ":\n\t"
-#endif
-
-#ifndef _RTLD_EPILOGUE
-# define _RTLD_EPILOGUE(entry)						\
-	".end\t" __STRING(entry) "\n\t"					\
-	".size\t" __STRING(entry) ", . - " __STRING(entry) "\n\t"
-#endif
-
-/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.
-   This makes no sense on MIPS but we have to define this to R_MIPS_REL32
-   to avoid the asserts in dl-lookup.c from blowing.  */
-#define ELF_MACHINE_JMP_SLOT			R_MIPS_REL32
-#define elf_machine_type_class(type)		ELF_RTYPE_CLASS_PLT
-
-/* Translate a processor specific dynamic tag to the index
-   in l_info array.  */
-#define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
-
-/* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
-   with the run-time address of the r_debug structure  */
-#define ELF_MACHINE_DEBUG_SETUP(l,r) \
-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
-       *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
-       (ElfW(Addr)) (r); \
-   } while (0)
-
-/* Return nonzero iff ELF header is compatible with the running host.  */
-static inline int __attribute_used__
-elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
-{
-#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32
-  /* Don't link o32 and n32 together.  */
-  if (((ehdr->e_flags & EF_MIPS_ABI2) != 0) != (_MIPS_SIM == _ABIN32))
-    return 0;
-#endif
-
-  switch (ehdr->e_machine)
-    {
-    case EM_MIPS:
-    case EM_MIPS_RS3_LE:
-      return 1;
-    default:
-      return 0;
-    }
-}
-
-static inline ElfW(Addr) *
-elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
-{
-  /* FIXME: the offset of gp from GOT may be system-dependent. */
-  return (ElfW(Addr) *) (gpreg - OFFSET_GP_GOT);
-}
-
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-   first element of the GOT.  This must be inlined in a function which
-   uses global data.  We assume its $gp points to the primary GOT.  */
-static inline ElfW(Addr)
-elf_machine_dynamic (void)
-{
-  register ElfW(Addr) gp __asm__ ("$28");
-  return *elf_mips_got_from_gpreg (gp);
-}
-
-#define STRINGXP(X) __STRING(X)
-#define STRINGXV(X) STRINGV_(X)
-#define STRINGV_(...) # __VA_ARGS__
-
-/* Return the run-time load address of the shared object.  */
-static inline ElfW(Addr)
-elf_machine_load_address (void)
-{
-  ElfW(Addr) addr;
-  asm ("	.set noreorder\n"
-       "	" STRINGXP (PTR_LA) " %0, 0f\n"
-       "	bltzal $0, 0f\n"
-       "	nop\n"
-       "0:	" STRINGXP (PTR_SUBU) " %0, $31, %0\n"
-       "	.set reorder\n"
-       :	"=r" (addr)
-       :	/* No inputs */
-       :	"$31");
-  return addr;
-}
-
-/* The MSB of got[1] of a gnu object is set to identify gnu objects.  */
-#if _MIPS_SIM == _ABI64
-# define ELF_MIPS_GNU_GOT1_MASK	0x8000000000000000L
-#else
-# define ELF_MIPS_GNU_GOT1_MASK	0x80000000L
-#endif
-
-/* We can't rely on elf_machine_got_rel because _dl_object_relocation_scope
-   fiddles with global data.  */
-#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info)			\
-do {									\
-  struct link_map *map = &bootstrap_map;				\
-  ElfW(Sym) *sym;							\
-  ElfW(Addr) *got;							\
-  int i, n;								\
-									\
-  got = (ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);			\
-									\
-  if (__builtin_expect (map->l_addr == 0, 1))				\
-    break;								\
-									\
-  /* got[0] is reserved. got[1] is also reserved for the dynamic object	\
-     generated by gnu ld. Skip these reserved entries from		\
-     relocation.  */							\
-  i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1;				\
-  n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;			\
-									\
-  /* Add the run-time displacement to all local got entries. */		\
-  while (i < n)								\
-    got[i++] += map->l_addr;						\
-									\
-  /* Handle global got entries. */					\
-  got += n;								\
-  sym = (ElfW(Sym) *) D_PTR(map, l_info[DT_SYMTAB])			\
-       + map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;			\
-  i = (map->l_info[DT_MIPS (SYMTABNO)]->d_un.d_val			\
-       - map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val);			\
-									\
-  while (i--)								\
-    {									\
-      if (sym->st_shndx == SHN_UNDEF || sym->st_shndx == SHN_COMMON)	\
-	*got = map->l_addr + sym->st_value;				\
-      else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC			\
-	       && *got != sym->st_value)				\
-	*got += map->l_addr;						\
-      else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)		\
-	{								\
-	  if (sym->st_other == 0)					\
-	    *got += map->l_addr;					\
-	}								\
-      else								\
-	*got = map->l_addr + sym->st_value;				\
-									\
-      got++;								\
-      sym++;								\
-    }									\
-} while(0)
-
-
-/* Get link map for callers object containing STUB_PC.  */
-static inline struct link_map *
-elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
-{
-  extern int _dl_mips_gnu_objects;
-
-  /* got[1] is reserved to keep its link map address for the shared
-     object generated by the gnu linker.  If all are such objects, we
-     can find the link map from current GPREG simply.  If not so, get
-     the link map for caller's object containing STUB_PC.  */
-
-  if (_dl_mips_gnu_objects)
-    {
-      ElfW(Addr) *got = elf_mips_got_from_gpreg (gpreg);
-      ElfW(Word) g1;
-
-      g1 = ((ElfW(Word) *) got)[1];
-
-      if ((g1 & ELF_MIPS_GNU_GOT1_MASK) != 0)
-	{
-	  struct link_map *l =
-	    (struct link_map *) (g1 & ~ELF_MIPS_GNU_GOT1_MASK);
-	  ElfW(Addr) base, limit;
-	  const ElfW(Phdr) *p = l->l_phdr;
-	  ElfW(Half) this, nent = l->l_phnum;
-
-	  /* For the common case of a stub being called from the containing
-	     object, STUB_PC will point to somewhere within the object that
-	     is described by the link map fetched via got[1].  Otherwise we
-	     have to scan all maps.  */
-	  for (this = 0; this < nent; this++)
-	    {
-	      if (p[this].p_type == PT_LOAD)
-		{
-		  base = p[this].p_vaddr + l->l_addr;
-		  limit = base + p[this].p_memsz;
-		  if (stub_pc >= base && stub_pc < limit)
-		    return l;
-		}
-	    }
-	}
-    }
-
-    struct link_map *l;
-    Lmid_t nsid;
-
-    for (nsid = 0; nsid < DL_NNS; ++nsid)
-      for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
-	{
-	  ElfW(Addr) base, limit;
-	  const ElfW(Phdr) *p = l->l_phdr;
-	  ElfW(Half) this, nent = l->l_phnum;
-
-	  for (this = 0; this < nent; ++this)
-	    {
-	      if (p[this].p_type == PT_LOAD)
-		{
-		  base = p[this].p_vaddr + l->l_addr;
-		  limit = base + p[this].p_memsz;
-		  if (stub_pc >= base && stub_pc < limit)
-		    return l;
-		}
-	    }
-	}
-
-  _dl_signal_error (0, NULL, NULL, "cannot find runtime link map");
-  return NULL;
-}
-
-#if _MIPS_SIM == _ABIO32
-#define ELF_DL_FRAME_SIZE 40
-
-#define ELF_DL_SAVE_ARG_REGS "\
-	sw	$15, 36($29)\n						      \
-	sw	$4, 16($29)\n						      \
-	sw	$5, 20($29)\n						      \
-	sw	$6, 24($29)\n						      \
-	sw	$7, 28($29)\n						      \
-"
-
-#define ELF_DL_RESTORE_ARG_REGS "\
-	lw	$31, 36($29)\n						      \
-	lw	$4, 16($29)\n						      \
-	lw	$5, 20($29)\n						      \
-	lw	$6, 24($29)\n						      \
-	lw	$7, 28($29)\n						      \
-"
-
-#define IFABIO32(X) X
-
-#else /* _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64 */
-
-#define ELF_DL_FRAME_SIZE 80
-
-#define ELF_DL_SAVE_ARG_REGS "\
-	sd	$15, 72($29)\n						      \
-	sd	$4, 8($29)\n						      \
-	sd	$5, 16($29)\n						      \
-	sd	$6, 24($29)\n						      \
-	sd	$7, 32($29)\n						      \
-	sd	$8, 40($29)\n						      \
-	sd	$9, 48($29)\n						      \
-	sd	$10, 56($29)\n						      \
-	sd	$11, 64($29)\n						      \
-"
-
-#define ELF_DL_RESTORE_ARG_REGS "\
-	ld	$31, 72($29)\n						      \
-	ld	$4, 8($29)\n						      \
-	ld	$5, 16($29)\n						      \
-	ld	$6, 24($29)\n						      \
-	ld	$7, 32($29)\n						      \
-	ld	$8, 40($29)\n						      \
-	ld	$9, 48($29)\n						      \
-	ld	$10, 56($29)\n						      \
-	ld	$11, 64($29)\n						      \
-"
-
-#define IFABIO32(X)
-
-#endif
-
-/* Define mips specific runtime resolver. The function __dl_runtime_resolve
-   is called from assembler function _dl_runtime_resolve which converts
-   special argument registers t7 ($15) and t8 ($24):
-     t7  address to return to the caller of the function
-     t8  index for this function symbol in .dynsym
-   to usual c arguments.
-
-   Other architectures call fixup from dl-runtime.c in
-   _dl_runtime_resolve.  MIPS instead calls __dl_runtime_resolve.  We
-   have to use our own version because of the way the got section is
-   treated on MIPS (we've also got ELF_MACHINE_PLT defined).  */
-
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE					      \
-/* The flag _dl_mips_gnu_objects is set if all dynamic objects are	      \
-   generated by the gnu linker. */					      \
-int _dl_mips_gnu_objects = 1;						      \
-									      \
-/* This is called from assembly stubs below which the compiler can't see.  */ \
-static ElfW(Addr)							      \
-__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr))	      \
-		  __attribute_used__;					      \
-									      \
-static ElfW(Addr)							      \
-__dl_runtime_resolve (ElfW(Word) sym_index,				      \
-		      ElfW(Word) return_address,			      \
-		      ElfW(Addr) old_gpreg,				      \
-		      ElfW(Addr) stub_pc)				      \
-{									      \
-  struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);     \
-  const ElfW(Sym) *const symtab						      \
-    = (const ElfW(Sym) *) D_PTR (l, l_info[DT_SYMTAB]);			      \
-  const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]);	      \
-  ElfW(Addr) *got							      \
-    = (ElfW(Addr) *) D_PTR (l, l_info[DT_PLTGOT]);			      \
-  const ElfW(Word) local_gotno						      \
-    = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;	      \
-  const ElfW(Word) gotsym						      \
-    = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;	      \
-  const ElfW(Sym) *sym = &symtab[sym_index];				      \
-  ElfW(Addr) value;							      \
-									      \
-  /* FIXME: The symbol versioning stuff is not tested yet.  */		      \
-  if (__builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0)	      \
-    {									      \
-      switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL)			      \
-	{								      \
-	default:							      \
-	  {								      \
-	    const ElfW(Half) *vernum =					      \
-	      (const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]);	      \
-	    ElfW(Half) ndx = vernum[sym_index] & 0x7fff;		      \
-	    const struct r_found_version *version = &l->l_versions[ndx];      \
-									      \
-	    if (version->hash != 0)					      \
-	      {								      \
-		value = _dl_lookup_symbol_x (strtab + sym->st_name, l, 	      \
-					     &sym, l->l_scope, version,	      \
-					     ELF_RTYPE_CLASS_PLT, 0, 0);      \
-		break;							      \
-	      }								      \
-	    /* Fall through.  */					      \
-	  }								      \
-	case 0:								      \
-	  value = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym,	      \
-				       l->l_scope, 0, ELF_RTYPE_CLASS_PLT,    \
-				       DL_LOOKUP_ADD_DEPENDENCY, 0);	      \
-	}								      \
-									      \
-      /* Currently value contains the base load address of the object	      \
-	 that defines sym.  Now add in the symbol offset.  */		      \
-      value = (sym ? value + sym->st_value : 0);			      \
-    }									      \
-  else									      \
-    /* We already found the symbol.  The module (and therefore its load	      \
-       address) is also known.  */					      \
-    value = l->l_addr + sym->st_value;					      \
-									      \
-  /* Apply the relocation with that value.  */				      \
-  *(got + local_gotno + sym_index - gotsym) = value;			      \
-									      \
-  return value;								      \
-}									      \
-									      \
-asm ("\n								      \
-	.text\n								      \
-	.align	2\n							      \
-	.globl	_dl_runtime_resolve\n					      \
-	.type	_dl_runtime_resolve,@function\n				      \
-	.ent	_dl_runtime_resolve\n					      \
-_dl_runtime_resolve:\n							      \
-	.frame	$29, " STRINGXP(ELF_DL_FRAME_SIZE) ", $31\n		      \
-	.set noreorder\n						      \
-	# Save GP.\n							      \
-	move	$3, $28\n						      \
-	# Save arguments and sp value in stack.\n			      \
-	" STRINGXP(PTR_SUBIU) "  $29, " STRINGXP(ELF_DL_FRAME_SIZE) "\n	      \
-	# Modify t9 ($25) so as to point .cpload instruction.\n		      \
-	" IFABIO32(STRINGXP(PTR_ADDIU) "	$25, 12\n") "		      \
-	# Compute GP.\n							      \
-	" STRINGXP(SETUP_GP) "\n					      \
-	" STRINGXV(SETUP_GP64 (0, _dl_runtime_resolve)) "\n		      \
-	.set reorder\n							      \
-	# Save slot call pc.\n						      \
-	move	$2, $31\n						      \
-	" IFABIO32(STRINGXP(CPRESTORE(32))) "\n				      \
-	" ELF_DL_SAVE_ARG_REGS "					      \
-	move	$4, $24\n						      \
-	move	$5, $15\n						      \
-	move	$6, $3\n						      \
-	move	$7, $2\n						      \
-	jal	__dl_runtime_resolve\n					      \
-	" ELF_DL_RESTORE_ARG_REGS "					      \
-	" STRINGXP(RESTORE_GP64) "\n					      \
-	" STRINGXP(PTR_ADDIU) "	$29, " STRINGXP(ELF_DL_FRAME_SIZE) "\n	      \
-	move	$25, $2\n						      \
-	jr	$25\n							      \
-	.end	_dl_runtime_resolve\n					      \
-	.previous\n							      \
-");
-
-/* Mask identifying addresses reserved for the user program,
-   where the dynamic linker should not map anything.  */
-#define ELF_MACHINE_USER_ADDRESS_MASK	0x80000000UL
-
-
-/* Initial entry point code for the dynamic linker.
-   The C function `_dl_start' is the real entry point;
-   its return value is the user program's entry point.
-   Note how we have to be careful about two things:
-
-   1) That we allocate a minimal stack of 24 bytes for
-      every function call, the MIPS ABI states that even
-      if all arguments are passed in registers the procedure
-      called can use the 16 byte area pointed to by $sp
-      when it is called to store away the arguments passed
-      to it.
-
-   2) That under Linux the entry is named __start
-      and not just plain _start.  */
-
-#define RTLD_START asm (\
-	".text\n"\
-	_RTLD_PROLOGUE(ENTRY_POINT) "\
-	" STRINGXV(SETUP_GPX($25)) "\n\
-	" STRINGXV(SETUP_GPX64($18,$25)) "\n\
-	# i386 ABI book says that the first entry of GOT holds\n\
-	# the address of the dynamic structure. Though MIPS ABI\n\
-	# doesn't say nothing about this, I emulate this here.\n\
-	" STRINGXP(PTR_LA) " $4, _DYNAMIC\n\
-	# Subtract OFFSET_GP_GOT\n\
-	" STRINGXP(PTR_S) " $4, -0x7ff0($28)\n\
-	move $4, $29\n\
-	" STRINGXP(PTR_SUBIU) " $29, 16\n\
-	\n\
-	" STRINGXP(PTR_LA) " $8, .Lcoff\n\
-	bltzal $8, .Lcoff\n\
-.Lcoff:	" STRINGXP(PTR_SUBU) " $8, $31, $8\n\
-	\n\
-	" STRINGXP(PTR_LA) " $25, _dl_start\n\
-	" STRINGXP(PTR_ADDU) " $25, $8\n\
-	jalr $25\n\
-	\n\
-	" STRINGXP(PTR_ADDIU) " $29, 16\n\
-	# Get the value of label '_dl_start_user' in t9 ($25).\n\
-	" STRINGXP(PTR_LA) " $25, _dl_start_user\n\
-	.globl _dl_start_user\n\
-	.type _dl_start_user,@function\n\
-	.aent _dl_start_user\n\
-_dl_start_user:\n\
-	" STRINGXP(SETUP_GP) "\n\
-	" STRINGXV(SETUP_GP64($18,_dl_start_user)) "\n\
-	move $16, $28\n\
-	# Save the user entry point address in a saved register.\n\
-	move $17, $2\n\
-	# See if we were run as a command with the executable file\n\
-	# name as an extra leading argument.\n\
-	lw $2, _dl_skip_args\n\
-	beq $2, $0, 1f\n\
-	# Load the original argument count.\n\
-	" STRINGXP(PTR_L) " $4, 0($29)\n\
-	# Subtract _dl_skip_args from it.\n\
-	subu $4, $2\n\
-	# Adjust the stack pointer to skip _dl_skip_args words.\n\
-	sll $2, " STRINGXP (PTRLOG) "\n\
-	" STRINGXP(PTR_ADDU) " $29, $2\n\
-	# Save back the modified argument count.\n\
-	" STRINGXP(PTR_S) " $4, 0($29)\n\
-1:	# Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\
-	" STRINGXP(PTR_L) " $4, _rtld_local\n\
-	" STRINGXP(PTR_L) /* or lw???  fixme */ " $5, 0($29)\n\
-	" STRINGXP(PTR_LA) " $6, " STRINGXP (PTRSIZE) "($29)\n\
-	sll $7, $5, " STRINGXP (PTRLOG) "\n\
-	" STRINGXP(PTR_ADDU) " $7, $7, $6\n\
-	" STRINGXP(PTR_ADDU) " $7, $7, " STRINGXP (PTRSIZE) " \n\
-	" STRINGXP(PTR_SUBIU) " $29, 32\n\
-	" STRINGXP(SAVE_GP(16)) "\n\
-	# Call the function to run the initializers.\n\
-	jal _dl_init_internal\n\
-	" STRINGXP(PTR_ADDIU)  " $29, 32\n\
-	# Pass our finalizer function to the user in $2 as per ELF ABI.\n\
-	" STRINGXP(PTR_LA) " $2, _dl_fini\n\
-	# Jump to the user entry point.\n\
-	move $25, $17\n\
-	jr $25\n\t"\
-	_RTLD_EPILOGUE(ENTRY_POINT)\
-	".previous"\
-);
-
-/* The MIPS never uses Elfxx_Rela relocations.  */
-#define ELF_MACHINE_NO_RELA 1
-
-#endif /* !dl_machine_h */
-
-#ifdef RESOLVE
-
-/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
-   MAP is the object containing the reloc.  */
-
-static inline void
-#ifdef RTLD_BOOTSTRAP
-  __attribute__ ((always_inline))
-#endif
-elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
-		 const ElfW(Sym) *sym, const struct r_found_version *version,
-		 void *const reloc_addr)
-{
-  const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
-
-#if !defined RTLD_BOOTSTRAP && !defined SHARED
-  /* This is defined in rtld.c, but nowhere in the static libc.a;
-     make the reference weak so static programs can still link.  This
-     declaration cannot be done when compiling rtld.c (i.e.  #ifdef
-     RTLD_BOOTSTRAP) because rtld.c contains the common defn for
-     _dl_rtld_map, which is incompatible with a weak decl in the same
-     file.  */
-  weak_extern (GL(dl_rtld_map));
-#endif
-
-  switch (r_type)
-    {
-#if _MIPS_SIM == _ABI64
-    case (R_MIPS_64 << 8) | R_MIPS_REL32:
-#else
-    case R_MIPS_REL32:
-#endif
-      {
-	int symidx = ELFW(R_SYM) (reloc->r_info);
-	ElfW(Addr) reloc_value;
-
-	/* Support relocations on mis-aligned offsets.  Should we ever
-	   implement RELA, this should be replaced with an assignment
-	   from reloc->r_addend.  */
-	__builtin_memcpy (&reloc_value, reloc_addr, sizeof (reloc_value));
-
-	if (symidx)
-	  {
-	    const ElfW(Word) gotsym
-	      = (const ElfW(Word)) map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
-
-	    if ((ElfW(Word))symidx < gotsym)
-	      {
-		/* This wouldn't work for a symbol imported from other
-		   libraries for which there's no GOT entry, but MIPS
-		   requires every symbol referenced in a dynamic
-		   relocation to have a GOT entry in the primary GOT,
-		   so we only get here for locally-defined symbols.
-		   For section symbols, we should *NOT* be adding
-		   sym->st_value (per the definition of the meaning of
-		   S in reloc expressions in the ELF64 MIPS ABI),
-		   since it should have already been added to
-		   reloc_value by the linker, but older versions of
-		   GNU ld didn't add it, and newer versions don't emit
-		   useless relocations to section symbols any more, so
-		   it is safe to keep on adding sym->st_value, even
-		   though it's not ABI compliant.  Some day we should
-		   bite the bullet and stop doing this.  */
-#ifndef RTLD_BOOTSTRAP
-		if (map != &GL(dl_rtld_map))
-#endif
-		  reloc_value += sym->st_value + map->l_addr;
-	      }
-	    else
-	      {
-#ifndef RTLD_BOOTSTRAP
-		const ElfW(Addr) *got
-		  = (const ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);
-		const ElfW(Word) local_gotno
-		  = (const ElfW(Word))
-		    map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
-
-		reloc_value += got[symidx + local_gotno - gotsym];
-#endif
-	      }
-	  }
-	else
-#ifndef RTLD_BOOTSTRAP
-	  if (map != &GL(dl_rtld_map))
-#endif
-	    reloc_value += map->l_addr;
-
-	__builtin_memcpy (reloc_addr, &reloc_value, sizeof (reloc_value));
-      }
-      break;
-    case R_MIPS_NONE:		/* Alright, Wilbur.  */
-      break;
-#if _MIPS_SIM == _ABI64
-    case R_MIPS_64:
-      /* For full compliance with the ELF64 ABI, one must precede the
-	 _REL32/_64 pair of relocations with a _64 relocation, such
-	 that the in-place addend is read as a 64-bit value.  IRIX
-	 didn't pick up on this requirement, so we treat the
-	 _REL32/_64 relocation as a 64-bit relocation even if it's by
-	 itself.  For ABI compliance, we ignore such _64 dummy
-	 relocations.  For RELA, this may be simply removed, since
-	 it's totally unnecessary.  */
-      if (ELFW(R_SYM) (reloc->r_info) == 0)
-	break;
-      /* Fall through.  */
-#endif
-    default:
-      _dl_reloc_bad_type (map, r_type, 0);
-      break;
-    }
-}
-
-static inline void
-elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
-			  void *const reloc_addr)
-{
-  /* XXX Nothing to do.  There is no relative relocation, right?  */
-}
-
-static inline void
-elf_machine_lazy_rel (struct link_map *map,
-		      ElfW(Addr) l_addr, const ElfW(Rel) *reloc)
-{
-  /* Do nothing.  */
-}
-
-#ifndef RTLD_BOOTSTRAP
-/* Relocate GOT. */
-static inline void
-elf_machine_got_rel (struct link_map *map, int lazy)
-{
-  ElfW(Addr) *got;
-  ElfW(Sym) *sym;
-  const ElfW(Half) *vernum;
-  int i, n, symidx;
-
-#define RESOLVE_GOTSYM(sym,vernum,sym_index)				  \
-    ({									  \
-      const ElfW(Sym) *ref = sym;					  \
-      const struct r_found_version *version				  \
-        = vernum ? &map->l_versions[vernum[sym_index] & 0x7fff] : NULL;	  \
-      ElfW(Addr) value;							  \
-      value = RESOLVE (&ref, version, R_MIPS_REL32);			  \
-      (ref)? value + ref->st_value: 0;					  \
-    })
-
-  if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
-    vernum = (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
-  else
-    vernum = NULL;
-
-  got = (ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);
-
-  n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
-  /* The dynamic linker's local got entries have already been relocated.  */
-  if (map != &GL(dl_rtld_map))
-    {
-      /* got[0] is reserved. got[1] is also reserved for the dynamic object
-	 generated by gnu ld. Skip these reserved entries from relocation.  */
-      i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1;
-
-      /* Add the run-time displacement to all local got entries if
-         needed.  */
-      if (__builtin_expect (map->l_addr != 0, 0))
-	{
-	  while (i < n)
-	    got[i++] += map->l_addr;
-	}
-    }
-
-  /* Handle global got entries. */
-  got += n;
-  /* Keep track of the symbol index.  */
-  symidx = map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
-  sym = (ElfW(Sym) *) D_PTR (map, l_info[DT_SYMTAB]) + symidx;
-  i = (map->l_info[DT_MIPS (SYMTABNO)]->d_un.d_val
-       - map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val);
-
-  /* This loop doesn't handle Quickstart.  */
-  while (i--)
-    {
-      if (sym->st_shndx == SHN_UNDEF)
-	{
-	  if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
-	      && sym->st_value && lazy)
-	    *got = sym->st_value + map->l_addr;
-	  else
-	    *got = RESOLVE_GOTSYM (sym, vernum, symidx);
-	}
-      else if (sym->st_shndx == SHN_COMMON)
-	*got = RESOLVE_GOTSYM (sym, vernum, symidx);
-      else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
-	       && *got != sym->st_value
-	       && lazy)
-	*got += map->l_addr;
-      else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)
-	{
-	  if (sym->st_other == 0)
-	    *got += map->l_addr;
-	}
-      else
-	*got = RESOLVE_GOTSYM (sym, vernum, symidx);
-
-      ++got;
-      ++sym;
-      ++symidx;
-    }
-
-#undef RESOLVE_GOTSYM
-}
-#endif
-
-/* Set up the loaded object described by L so its stub function
-   will jump to the on-demand fixup code __dl_runtime_resolve.  */
-
-static inline int
-elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
-{
-# ifndef RTLD_BOOTSTRAP
-  ElfW(Addr) *got;
-  extern void _dl_runtime_resolve (ElfW(Word));
-  extern int _dl_mips_gnu_objects;
-
-  if (lazy)
-    {
-      /* The GOT entries for functions have not yet been filled in.
-	 Their initial contents will arrange when called to put an
-	 offset into the .dynsym section in t8, the return address
-	 in t7 and then jump to _GLOBAL_OFFSET_TABLE[0].  */
-      got = (ElfW(Addr) *) D_PTR (l, l_info[DT_PLTGOT]);
-
-      /* This function will get called to fix up the GOT entry indicated by
-	 the register t8, and then jump to the resolved address.  */
-      got[0] = (ElfW(Addr)) &_dl_runtime_resolve;
-
-      /* Store l to _GLOBAL_OFFSET_TABLE[1] for gnu object. The MSB
-	 of got[1] of a gnu object is set to identify gnu objects.
-	 Where we can store l for non gnu objects? XXX  */
-      if ((got[1] & ELF_MIPS_GNU_GOT1_MASK) != 0)
-	got[1] = ((ElfW(Addr)) l | ELF_MIPS_GNU_GOT1_MASK);
-      else
-	_dl_mips_gnu_objects = 0;
-    }
-
-  /* Relocate global offset table.  */
-  elf_machine_got_rel (l, lazy);
-
-# endif
-  return lazy;
-}
-
-#endif /* RESOLVE */
diff --git a/sysdeps/mips/elf/ldsodefs.h b/sysdeps/mips/elf/ldsodefs.h
deleted file mode 100644
index 3868b50ff6..0000000000
--- a/sysdeps/mips/elf/ldsodefs.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Run-time dynamic linker data structures for loaded ELF shared objects.
-   Copyright (C) 2000, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _MIPS_LDSODEFS_H
-#define _MIPS_LDSODEFS_H
-
-/* The MIPS ABI specifies that the dynamic section has to be read-only.  */
-
-#define DL_RO_DYN_SECTION 1
-
-#include_next <ldsodefs.h>
-
-/* The 64-bit MIPS ELF ABI uses an unusual reloc format.  Each
-   relocation entry specifies up to three actual relocations, all at
-   the same address.  The first relocation which required a symbol
-   uses the symbol in the r_sym field.  The second relocation which
-   requires a symbol uses the symbol in the r_ssym field.  If all
-   three relocations require a symbol, the third one uses a zero
-   value.
-
-   We define these structures in internal headers because we're not
-   sure we want to make them part of the ABI yet.  Eventually, some of
-   this may move into elf/elf.h.  */
-
-/* An entry in a 64 bit SHT_REL section.  */
-
-typedef struct
-{
-  Elf32_Word    r_sym;		/* Symbol index */
-  unsigned char r_ssym;		/* Special symbol for 2nd relocation */
-  unsigned char r_type3;	/* 3rd relocation type */
-  unsigned char r_type2;	/* 2nd relocation type */
-  unsigned char r_type1;	/* 1st relocation type */
-} _Elf64_Mips_R_Info;
-
-typedef union
-{
-  Elf64_Xword	r_info_number;
-  _Elf64_Mips_R_Info r_info_fields;
-} _Elf64_Mips_R_Info_union;
-
-typedef struct
-{
-  Elf64_Addr	r_offset;		/* Address */
-  _Elf64_Mips_R_Info_union r_info;	/* Relocation type and symbol index */
-} Elf64_Mips_Rel;
-
-typedef struct
-{
-  Elf64_Addr	r_offset;		/* Address */
-  _Elf64_Mips_R_Info_union r_info;	/* Relocation type and symbol index */
-  Elf64_Sxword	r_addend;		/* Addend */
-} Elf64_Mips_Rela;
-
-#define ELF64_MIPS_R_SYM(i) \
-  ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
-#define ELF64_MIPS_R_TYPE(i) \
-  (((_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1 \
-   | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
-		   ).r_info_fields.r_type2 << 8) \
-   | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
-		   ).r_info_fields.r_type3 << 16) \
-   | ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
-		   ).r_info_fields.r_ssym << 24))
-#define ELF64_MIPS_R_INFO(sym, type) \
-  (__extension__ (_Elf64_Mips_R_Info_union) \
-   (__extension__ (_Elf64_Mips_R_Info) \
-   { (sym), ELF64_MIPS_R_SSYM (type), \
-       ELF64_MIPS_R_TYPE3 (type), \
-       ELF64_MIPS_R_TYPE2 (type), \
-       ELF64_MIPS_R_TYPE1 (type) \
-   }).r_info_number)
-/* These macros decompose the value returned by ELF64_MIPS_R_TYPE, and
-   compose it back into a value that it can be used as an argument to
-   ELF64_MIPS_R_INFO.  */
-#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
-#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
-#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
-#define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
-#define ELF64_MIPS_R_TYPEENC(type1, type2, type3, ssym) \
-  ((type1) \
-   | ((Elf32_Word)(type2) << 8) \
-   | ((Elf32_Word)(type3) << 16) \
-   | ((Elf32_Word)(ssym) << 24))
-
-#undef ELF64_R_SYM
-#define ELF64_R_SYM(i) ELF64_MIPS_R_SYM (i)
-#undef ELF64_R_TYPE
-#define ELF64_R_TYPE(i) ELF64_MIPS_R_TYPE (i)
-#undef ELF64_R_INFO
-#define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
-
-#endif
diff --git a/sysdeps/mips/elf/start.S b/sysdeps/mips/elf/start.S
deleted file mode 100644
index d9cc3b7ee2..0000000000
--- a/sysdeps/mips/elf/start.S
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Startup code compliant to the ELF Mips ABI.
-   Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003, 2004
-	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.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define __ASSEMBLY__ 1
-#include <entry.h>
-#include <sgidefs.h>
-#include <sys/asm.h>
-
-#ifndef ENTRY_POINT
-#error ENTRY_POINT needs to be defined for start.S on MIPS/ELF.
-#endif
-
-/* This is the canonical entry point, usually the first thing in the text
-   segment.  The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry
-   point runs, most registers' values are unspecified, except for:
-
-   v0 ($2)	Contains a function pointer to be registered with `atexit'.
-		This is how the dynamic linker arranges to have DT_FINI
-		functions called for shared libraries that have been loaded
-		before this code runs.
-
-   sp ($29)	The stack contains the arguments and environment:
-		0(%esp)			argc
-		4(%esp)			argv[0]
-		...
-		(4*argc)(%esp)		NULL
-		(4*(argc+1))(%esp)	envp[0]
-		...
-					NULL
-   ra ($31)	The return address register is set to zero so that programs
-		that search backword through stack frames recognize the last
-		stack frame.
-*/
-
-
-/* We need to call:
-   __libc_start_main (int (*main) (int, char **, char **), int argc,
-		      char **argv, void (*init) (void), void (*fini) (void),
-		      void (*rtld_fini) (void), void *stack_end)
-*/
-	
-	.text
-	.globl ENTRY_POINT
-	.type ENTRY_POINT,@function
-ENTRY_POINT:
-#ifdef __PIC__
-	SETUP_GPX($0)
-	SETUP_GPX64($25,$0)
-#else
-	PTR_LA $28, _gp		/* Setup GP correctly if we're non-PIC.  */
-	move $31, $0
-#endif
-
-	PTR_LA $4, main		/* main */
-	PTR_L $5, 0($29)		/* argc */
-	PTR_ADDIU $6, $29, PTRSIZE	/* argv  */
-	
-	/* Allocate space on the stack for seven arguments (o32 only)
-	   and make sure the stack is aligned to double words (8 bytes) 
-	   on o32 and quad words (16 bytes) on n32 and n64.  */
-	
-	and $29, -2 * SZREG
-#if _MIPS_SIM == _ABIO32
-	PTR_SUBIU $29, 32
-#endif
-	PTR_LA $7, __libc_csu_init		/* init */
-	PTR_LA $8, __libc_csu_fini
-#if _MIPS_SIM == _ABIO32
-	PTR_S $8, 16($29)		/* fini */
-	PTR_S $2, 20($29)		/* rtld_fini */
-	PTR_S $29, 24($29)		/* stack_end */
-#else
-	move $9, $2		/* rtld_fini */
-	move $10, $29		/* stack_end */
-#endif
-	jal __libc_start_main
-hlt:	b hlt			/* Crash if somehow it does return.  */
-
-/* Define a symbol for the first piece of initialized data.  */
-	.data
-	.globl __data_start
-__data_start:
-	.long 0
-	.weak data_start
-	data_start = __data_start
diff --git a/sysdeps/mips/fpregdef.h b/sysdeps/mips/fpregdef.h
deleted file mode 100644
index 6f76d1183d..0000000000
--- a/sysdeps/mips/fpregdef.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 1991, 92, 94, 95, 96 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FPREGDEF_H
-#define _FPREGDEF_H
-
-#include <sys/fpregdef.h>
-
-#endif /* _FPREGDEF_H */
diff --git a/sysdeps/mips/fpu/bits/mathdef.h b/sysdeps/mips/fpu/bits/mathdef.h
deleted file mode 100644
index 99be0db2b5..0000000000
--- a/sysdeps/mips/fpu/bits/mathdef.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#include <sgidefs.h>
-
-#if defined  __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF	1
-
-/* Normally, there is no long double type and the `float' and `double'
-   expressions are evaluated as `double'.  */
-typedef double float_t;		/* `float' expressions are evaluated as
-				   `double'.  */
-typedef double double_t;	/* `double' expressions are evaluated as
-				   `double'.  */
-
-/* The values returned by `ilogb' for 0 and NaN respectively.  */
-# define FP_ILOGB0	(-2147483647)
-# define FP_ILOGBNAN	2147483647
-
-#endif	/* ISO C99 */
-
-#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
-/* Signal that we do not really have a `long double'.  This disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/mips/fpu/e_sqrt.c b/sysdeps/mips/fpu/e_sqrt.c
deleted file mode 100644
index 5449710aff..0000000000
--- a/sysdeps/mips/fpu/e_sqrt.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#include <sgidefs.h>
-
-
-#if (_MIPS_ISA >= _MIPS_ISA_MIPS2)
-
-double
-__ieee754_sqrt (double x)
-{
-  double z;
-  __asm__ ("sqrt.d %0,%1" : "=f" (z) : "f" (x));
-  return z;
-}
-
-#else
-
-#include <sysdeps/ieee754/dbl-64/e_sqrt.c>
-
-#endif
diff --git a/sysdeps/mips/fpu/e_sqrtf.c b/sysdeps/mips/fpu/e_sqrtf.c
deleted file mode 100644
index 3590ad46d5..0000000000
--- a/sysdeps/mips/fpu/e_sqrtf.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#include <sgidefs.h>
-
-
-#if (_MIPS_ISA >= _MIPS_ISA_MIPS2)
-
-float
-__ieee754_sqrtf (float x)
-{
-  float z;
-  __asm__ ("sqrt.s %0,%1" : "=f" (z) : "f" (x));
-  return z;
-}
-
-#else
-
-#include <sysdeps/ieee754/flt-32/e_sqrtf.c>
-
-#endif
-
diff --git a/sysdeps/mips/fpu/fclrexcpt.c b/sysdeps/mips/fpu/fclrexcpt.c
deleted file mode 100644
index f773312b34..0000000000
--- a/sysdeps/mips/fpu/fclrexcpt.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Clear given exceptions in current floating-point environment.
-   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fenv_libc.h>
-#include <fpu_control.h>
-
-int
-feclearexcept (int excepts)
-{
-  int cw;
-
-  /* Mask out unsupported bits/exceptions.  */
-  excepts &= FE_ALL_EXCEPT;
-
-  /* Read the complete control word.  */
-  _FPU_GETCW (cw);
-
-  /* Clear exception flag bits and cause bits. If the cause bit is not
-     cleared, the next CTC instruction (just below) will re-generate the
-     exception.  */
-
-  cw &= ~(excepts | (excepts << CAUSE_SHIFT));
-
-  /* Put the new data in effect.  */
-  _FPU_SETCW (cw);
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/mips/fpu/fedisblxcpt.c b/sysdeps/mips/fpu/fedisblxcpt.c
deleted file mode 100644
index 62e1a7130a..0000000000
--- a/sysdeps/mips/fpu/fedisblxcpt.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Disable floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fenv_libc.h>
-#include <fpu_control.h>
-
-int
-fedisableexcept (int excepts)
-{
-  unsigned int new_exc, old_exc;
-
-  /* Get the current control word.  */
-  _FPU_GETCW (new_exc);
-
-  old_exc = (new_exc & ENABLE_MASK) >> ENABLE_SHIFT;
-
-  excepts &= FE_ALL_EXCEPT;
-
-  new_exc &= ~(excepts << ENABLE_SHIFT);
-  new_exc &= ~_FPU_RESERVED;
-  _FPU_SETCW (new_exc);
-
-  return old_exc;
-}
diff --git a/sysdeps/mips/fpu/feenablxcpt.c b/sysdeps/mips/fpu/feenablxcpt.c
deleted file mode 100644
index 4c285811db..0000000000
--- a/sysdeps/mips/fpu/feenablxcpt.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Enable floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fenv_libc.h>
-#include <fpu_control.h>
-
-int
-feenableexcept (int excepts)
-{
-  unsigned int new_exc, old_exc;
-
-  /* Get the current control word.  */
-  _FPU_GETCW (new_exc);
-
-  old_exc = (new_exc & ENABLE_MASK) >> ENABLE_SHIFT;
-
-  excepts &= FE_ALL_EXCEPT;
-
-  new_exc |= excepts << ENABLE_SHIFT;
-  new_exc &= ~_FPU_RESERVED;
-  _FPU_SETCW (new_exc);
-
-  return old_exc;
-}
diff --git a/sysdeps/mips/fpu/fegetenv.c b/sysdeps/mips/fpu/fegetenv.c
deleted file mode 100644
index c1741385fd..0000000000
--- a/sysdeps/mips/fpu/fegetenv.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Store current floating-point environment.
-   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fegetenv (fenv_t *envp)
-{
-  _FPU_GETCW (*envp);
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/mips/fpu/fegetexcept.c b/sysdeps/mips/fpu/fegetexcept.c
deleted file mode 100644
index 14b1241294..0000000000
--- a/sysdeps/mips/fpu/fegetexcept.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Get enabled floating-point exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fenv_libc.h>
-#include <fpu_control.h>
-
-int
-fegetexcept (void)
-{
-  unsigned int exc;
-
-  /* Get the current control word.  */
-  _FPU_GETCW (exc);
-
-  return (exc & ENABLE_MASK) >> ENABLE_SHIFT;
-}
diff --git a/sysdeps/mips/fpu/fegetround.c b/sysdeps/mips/fpu/fegetround.c
deleted file mode 100644
index efb1ba0dcc..0000000000
--- a/sysdeps/mips/fpu/fegetround.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Return current rounding direction.
-   Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fegetround (void)
-{
-  int cw;
-
-  /* Get control word.  */
-  _FPU_GETCW (cw);
-
-  return cw & 0x3;
-}
diff --git a/sysdeps/mips/fpu/feholdexcpt.c b/sysdeps/mips/fpu/feholdexcpt.c
deleted file mode 100644
index bb37148fff..0000000000
--- a/sysdeps/mips/fpu/feholdexcpt.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Store current floating-point environment and clear exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-feholdexcept (fenv_t *envp)
-{
-  fpu_control_t cw;
-
-  /* Save the current state.  */
-  _FPU_GETCW (cw);
-  envp->__fp_control_register = cw;
-
-  /* Clear all exception enable bits and flags.  */
-  cw &= ~(_FPU_MASK_V|_FPU_MASK_Z|_FPU_MASK_O|_FPU_MASK_U|_FPU_MASK_I|FE_ALL_EXCEPT);
-  _FPU_SETCW (cw);
-
-  return 0;
-}
diff --git a/sysdeps/mips/fpu/fenv_libc.h b/sysdeps/mips/fpu/fenv_libc.h
deleted file mode 100644
index d971d2c711..0000000000
--- a/sysdeps/mips/fpu/fenv_libc.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FENV_LIBC_H
-#define _FENV_LIBC_H    1
-
-/* Mask for enabling exceptions and for the CAUSE bits.  */
-#define ENABLE_MASK	0x00F80U
-#define CAUSE_MASK	0x1F000U
-
-/* Shift for FE_* flags to get up to the ENABLE bits and the CAUSE bits.  */
-#define	ENABLE_SHIFT	5
-#define	CAUSE_SHIFT	10
-
-
-#endif /* _FENV_LIBC_H */
diff --git a/sysdeps/mips/fpu/fesetenv.c b/sysdeps/mips/fpu/fesetenv.c
deleted file mode 100644
index b71a877ae3..0000000000
--- a/sysdeps/mips/fpu/fesetenv.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Install given floating-point environment.
-   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fesetenv (const fenv_t *envp)
-{
-  fpu_control_t cw;
-
-  /* Read first current state to flush fpu pipeline.  */
-  _FPU_GETCW (cw);
-
-  if (envp == FE_DFL_ENV)
-    _FPU_SETCW (_FPU_DEFAULT);
-  else if (envp == FE_NOMASK_ENV)
-    _FPU_SETCW (_FPU_IEEE);
-  else
-    _FPU_SETCW (envp->__fp_control_register);
-
-  /* Success.  */
-  return 0;
-}
-
-libm_hidden_def (fesetenv)
diff --git a/sysdeps/mips/fpu/fesetround.c b/sysdeps/mips/fpu/fesetround.c
deleted file mode 100644
index af73a720f8..0000000000
--- a/sysdeps/mips/fpu/fesetround.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Set current rounding direction.
-   Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fesetround (int round)
-{
-  unsigned short int cw;
-
-  if ((round & ~0x3) != 0)
-    /* ROUND is no valid rounding mode.  */
-    return 1;
-
-  /* Get current state.  */
-  _FPU_GETCW (cw);
-
-  /* Set rounding bits.  */
-  cw &= ~0x3;
-  cw |= round;
-  /* Set new state.  */
-  _FPU_SETCW (cw);
-
-  return 0;
-}
diff --git a/sysdeps/mips/fpu/feupdateenv.c b/sysdeps/mips/fpu/feupdateenv.c
deleted file mode 100644
index 20b20e14c0..0000000000
--- a/sysdeps/mips/fpu/feupdateenv.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-feupdateenv (const fenv_t *envp)
-{
-  int temp;
-
-  /* Save current exceptions.  */
-  _FPU_GETCW (temp);
-  temp &= FE_ALL_EXCEPT;
-
-  /* Install new environment.  */
-  fesetenv (envp);
-
-  /* Raise the safed exception.  Incidently for us the implementation
-     defined format of the values in objects of type fexcept_t is the
-     same as the ones specified using the FE_* constants.  */
-  feraiseexcept (temp);
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/mips/fpu/fgetexcptflg.c b/sysdeps/mips/fpu/fgetexcptflg.c
deleted file mode 100644
index 3412159816..0000000000
--- a/sysdeps/mips/fpu/fgetexcptflg.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Store current representation for exceptions.
-   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fegetexceptflag (fexcept_t *flagp, int excepts)
-{
-  fexcept_t temp;
-
-  /* Get the current exceptions.  */
-  _FPU_GETCW (temp);
-
-  /* We only save the relevant bits here. In particular, care has to be 
-     taken with the CAUSE bits, as an inadvertent restore later on could
-     generate unexpected exceptions.  */
-
-  *flagp = temp & excepts & FE_ALL_EXCEPT;
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/mips/fpu/fraiseexcpt.c b/sysdeps/mips/fpu/fraiseexcpt.c
deleted file mode 100644
index 3e2ebe0fe7..0000000000
--- a/sysdeps/mips/fpu/fraiseexcpt.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Raise given exceptions.
-   Copyright (C) 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fenv_libc.h>
-#include <fpu_control.h>
-
-int
-feraiseexcept (int excepts)
-{
-  fpu_control_t cw;
-
-  /* Get current state.  */
-  _FPU_GETCW (cw);
-
-  /* Set flag bits (which are accumulative), and *also* set the 
-     cause bits. The setting of the cause bits is what actually causes
-     the hardware to generate the exception, if the corresponding enable
-     bit is set as well.  */
-
-  excepts &= FE_ALL_EXCEPT;
-  cw |= excepts | (excepts << CAUSE_SHIFT);
-
-  /* Set new state.  */
-  _FPU_SETCW (cw);
-
-  return 0;
-}
-
-libm_hidden_def (feraiseexcept)
diff --git a/sysdeps/mips/fpu/fsetexcptflg.c b/sysdeps/mips/fpu/fsetexcptflg.c
deleted file mode 100644
index c65d793178..0000000000
--- a/sysdeps/mips/fpu/fsetexcptflg.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Set floating-point environment exception handling.
-   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fesetexceptflag (const fexcept_t *flagp, int excepts)
-{
-  fexcept_t temp;
-
-  /* Get the current exceptions.  */
-  _FPU_GETCW (temp);
-
-  /* Make sure the flags we want restored are legal.  */
-  excepts &= FE_ALL_EXCEPT;
-
-  /* Now clear the bits called for, and copy them in from flagp. Note that
-     we ignore all non-flag bits from *flagp, so they don't matter.  */
-  temp = (temp & ~excepts) | (*flagp & excepts);
-
-  _FPU_SETCW (temp);
-
-  /* Success.  */
-  return 0;
-}
diff --git a/sysdeps/mips/fpu/ftestexcept.c b/sysdeps/mips/fpu/ftestexcept.c
deleted file mode 100644
index 6a833f7563..0000000000
--- a/sysdeps/mips/fpu/ftestexcept.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Test exception in current environment.
-   Copyright (C) 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-#include <fpu_control.h>
-
-int
-fetestexcept (int excepts)
-{
-  int cw;
-
-  /* Get current control word.  */
-  _FPU_GETCW (cw);
-
-  return cw & excepts & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/mips/fpu/libm-test-ulps b/sysdeps/mips/fpu/libm-test-ulps
deleted file mode 100644
index 73172b49a0..0000000000
--- a/sysdeps/mips/fpu/libm-test-ulps
+++ /dev/null
@@ -1,890 +0,0 @@
-# Begin of automatic generation
-
-# atan2
-Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
-Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
-Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
-float: 1
-ifloat: 1
-
-# atanh
-Test "atanh (0.75) == 0.972955074527656652552676371721589865":
-float: 1
-ifloat: 1
-
-# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-# casin
-Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# casinh
-Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# catan
-Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-float: 3
-ifloat: 3
-Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
-float: 4
-ifloat: 4
-
-# catanh
-Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-double: 4
-idouble: 4
-Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-float: 4
-ifloat: 4
-Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-float: 6
-ifloat: 6
-
-# cbrt
-Test "cbrt (-27.0) == -3.0":
-double: 1
-idouble: 1
-Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
-double: 1
-idouble: 1
-Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
-double: 1
-idouble: 1
-
-# ccos
-Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-float: 1
-ifloat: 1
-
-# ccosh
-Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-float: 1
-ifloat: 1
-
-# cexp
-Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
-float: 1
-ifloat: 1
-Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
-float: 1
-ifloat: 1
-
-# clog
-Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
-float: 3
-ifloat: 3
-Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
-float: 1
-ifloat: 1
-
-# clog10
-Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
-float: 1
-ifloat: 1
-
-# cos
-Test "cos (M_PI_6l * 2.0) == 0.5":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "cos (M_PI_6l * 4.0) == -0.5":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "cos (pi/2) == 0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# cpow
-Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
-double: 2
-float: 3
-idouble: 2
-ifloat: 3
-Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-float: 2
-ifloat: 2
-Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-# csinh
-Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
-double: 1
-idouble: 1
-Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-
-# csqrt
-Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-
-# ctan
-Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
-double: 1
-idouble: 1
-
-# ctanh
-Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
-float: 1
-ifloat: 1
-Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
-double: 1
-idouble: 1
-
-# erf
-Test "erf (1.25) == 0.922900128256458230136523481197281140":
-double: 1
-idouble: 1
-
-# erfc
-Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
-double: 1
-idouble: 1
-Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
-double: 1
-idouble: 1
-
-# exp10
-Test "exp10 (-1) == 0.1":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "exp10 (3) == 1000":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-# expm1
-Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
-double: 1
-idouble: 1
-Test "expm1 (1) == M_El - 1.0":
-float: 1
-ifloat: 1
-
-# hypot
-Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-
-# j0
-Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "j0 (0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "j0 (2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
-Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "j0 (8.0) == 0.171650807137553906090869407851972001":
-float: 1
-ifloat: 1
-
-# j1
-Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-Test "j1 (2.0) == 0.576724807756873387202448242269137087":
-double: 1
-idouble: 1
-Test "j1 (8.0) == 0.234636346853914624381276651590454612":
-double: 1
-idouble: 1
-
-# jn
-Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
-Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
-float: 1
-ifloat: 1
-Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
-double: 1
-idouble: 1
-Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
-double: 1
-idouble: 1
-Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
-double: 4
-float: 3
-idouble: 4
-ifloat: 3
-Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 4
-ifloat: 4
-Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# lgamma
-Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# log10
-Test "log10 (0.75) == -0.124938736608299953132449886193870744":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "log10 (e) == log10(e)":
-float: 1
-ifloat: 1
-
-# log1p
-Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
-float: 1
-ifloat: 1
-
-# sincos
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
-float: 1
-ifloat: 1
-
-# tan
-Test "tan (pi/4) == 1":
-double: 1
-idouble: 1
-
-# tgamma
-Test "tgamma (-0.5) == -2 sqrt (pi)":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "tgamma (0.5) == sqrt (pi)":
-float: 1
-ifloat: 1
-Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y0
-Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (1.5) == 0.382448923797758843955068554978089862":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
-float: 1
-ifloat: 1
-Test "y0 (8.0) == 0.223521489387566220527323400498620359":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y1
-Test "y1 (0.125) == -5.19993611253477499595928744876579921":
-double: 1
-idouble: 1
-Test "y1 (1.5) == -0.412308626973911295952829820633445323":
-float: 1
-ifloat: 1
-Test "y1 (10.0) == 0.249015424206953883923283474663222803":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "y1 (2.0) == -0.107032431540937546888370772277476637":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "y1 (8.0) == -0.158060461731247494255555266187483550":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# yn
-Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
-float: 1
-ifloat: 1
-Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
-double: 1
-idouble: 1
-Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
-float: 1
-ifloat: 1
-Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
-double: 1
-idouble: 1
-Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
-double: 1
-idouble: 1
-Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
-double: 2
-idouble: 2
-Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
-double: 1
-idouble: 1
-Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
-double: 1
-idouble: 1
-
-# Maximal error of functions:
-Function: "atan2":
-float: 3
-ifloat: 3
-
-Function: "atanh":
-float: 1
-ifloat: 1
-
-Function: Real part of "cacosh":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-
-Function: Imaginary part of "cacosh":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-Function: Real part of "casin":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "casinh":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-
-Function: Imaginary part of "casinh":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-
-Function: Real part of "catan":
-float: 4
-ifloat: 4
-
-Function: Imaginary part of "catan":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "catanh":
-double: 4
-idouble: 4
-
-Function: Imaginary part of "catanh":
-float: 6
-ifloat: 6
-
-Function: "cbrt":
-double: 1
-idouble: 1
-
-Function: Real part of "ccos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ccos":
-float: 1
-ifloat: 1
-
-Function: Real part of "ccosh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ccosh":
-float: 1
-ifloat: 1
-
-Function: Real part of "cexp":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "cexp":
-float: 1
-ifloat: 1
-
-Function: Real part of "clog":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "clog":
-float: 3
-ifloat: 3
-
-Function: Real part of "clog10":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "clog10":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-
-Function: "cos":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: Real part of "cpow":
-double: 2
-float: 4
-idouble: 2
-ifloat: 4
-
-Function: Imaginary part of "cpow":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: Real part of "csinh":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "csinh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "csqrt":
-float: 1
-ifloat: 1
-
-Function: Real part of "ctan":
-double: 1
-idouble: 1
-
-Function: Imaginary part of "ctan":
-double: 1
-idouble: 1
-
-Function: Real part of "ctanh":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: Imaginary part of "ctanh":
-float: 1
-ifloat: 1
-
-Function: "erf":
-double: 1
-idouble: 1
-
-Function: "erfc":
-double: 1
-idouble: 1
-
-Function: "exp10":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-Function: "expm1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "hypot":
-float: 1
-ifloat: 1
-
-Function: "j0":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: "j1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "jn":
-double: 4
-float: 4
-idouble: 4
-ifloat: 4
-
-Function: "lgamma":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "log10":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "log1p":
-float: 1
-ifloat: 1
-
-Function: "sincos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "tan":
-double: 1
-idouble: 1
-
-Function: "tgamma":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "y0":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: "y1":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-Function: "yn":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-# end of automatic generation
diff --git a/sysdeps/mips/fpu_control.h b/sysdeps/mips/fpu_control.h
deleted file mode 100644
index da18deab5a..0000000000
--- a/sysdeps/mips/fpu_control.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* FPU control word bits.  Mips version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Olaf Flebbe and Ralf Baechle.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FPU_CONTROL_H
-#define _FPU_CONTROL_H
-
-/* MIPS FPU floating point control register bits.
- *
- * 31-25  -> floating point conditions code bits 7-1.  These bits are only
- *           available in MIPS IV.
- * 24     -> flush denormalized results to zero instead of
- *           causing unimplemented operation exception.  This bit is only
- *           available for MIPS III and newer.
- * 23     -> Condition bit
- * 22-18  -> reserved (read as 0, write with 0)
- * 17     -> cause bit for unimplemented operation
- * 16     -> cause bit for invalid exception
- * 15     -> cause bit for division by zero exception
- * 14     -> cause bit for overflow exception
- * 13     -> cause bit for underflow exception
- * 12     -> cause bit for inexact exception
- * 11     -> enable exception for invalid exception
- * 10     -> enable exception for division by zero exception
- *  9     -> enable exception for overflow exception
- *  8     -> enable exception for underflow exception
- *  7     -> enable exception for inexact exception
- *  6     -> flag invalid exception
- *  5     -> flag division by zero exception
- *  4     -> flag overflow exception
- *  3     -> flag underflow exception
- *  2     -> flag inexact exception
- *  1-0   -> rounding control
- *
- *
- * Rounding Control:
- * 00 - rounding to nearest (RN)
- * 01 - rounding toward zero (RZ)
- * 10 - rounding (up) toward plus infinity (RP)
- * 11 - rounding (down)toward minus infinity (RM)
- */
-
-#include <features.h>
-
-/* masking of interrupts */
-#define _FPU_MASK_V     0x0800  /* Invalid operation */
-#define _FPU_MASK_Z     0x0400  /* Division by zero  */
-#define _FPU_MASK_O     0x0200  /* Overflow          */
-#define _FPU_MASK_U     0x0100  /* Underflow         */
-#define _FPU_MASK_I     0x0080  /* Inexact operation */
-
-/* flush denormalized numbers to zero */
-#define _FPU_FLUSH_TZ   0x1000000
-
-/* rounding control */
-#define _FPU_RC_NEAREST 0x0     /* RECOMMENDED */
-#define _FPU_RC_ZERO    0x1
-#define _FPU_RC_UP      0x2
-#define _FPU_RC_DOWN    0x3
-
-#define _FPU_RESERVED 0xfe3c0000  /* Reserved bits in cw */
-
-
-/* The fdlibm code requires strict IEEE double precision arithmetic,
-   and no interrupts for exceptions, rounding to nearest.  */
-
-#define _FPU_DEFAULT  0x00000000
-
-/* IEEE:  same as above, but exceptions */
-#define _FPU_IEEE     0x00000F80
-
-/* 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) __asm__ ("cfc1 %0,$31" : "=r" (cw))
-#define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw))
-
-/* Default control word set at startup.  */
-extern fpu_control_t __fpu_control;
-
-#endif	/* fpu_control.h */
diff --git a/sysdeps/mips/gccframe.h b/sysdeps/mips/gccframe.h
deleted file mode 100644
index ec9311caca..0000000000
--- a/sysdeps/mips/gccframe.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Definition of object in frame unwind info.  mips version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define FIRST_PSEUDO_REGISTER 76
-
-#include <sysdeps/generic/gccframe.h>
diff --git a/sysdeps/mips/ieee754.h b/sysdeps/mips/ieee754.h
deleted file mode 100644
index ed13de2775..0000000000
--- a/sysdeps/mips/ieee754.h
+++ /dev/null
@@ -1,325 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1999, 2002, 2003
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _IEEE754_H
-
-#define _IEEE754_H 1
-#include <features.h>
-
-#include <endian.h>
-
-#include <float.h>
-
-__BEGIN_DECLS
-
-union ieee754_float
-  {
-    float f;
-
-    /* This is the IEEE 754 single-precision format.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:8;
-	unsigned int mantissa:23;
-#endif				/* Big endian.  */
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-	unsigned int mantissa:23;
-	unsigned int exponent:8;
-	unsigned int negative:1;
-#endif				/* Little endian.  */
-      } ieee;
-
-    /* This format makes it easier to see if a NaN is a signalling NaN.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:8;
-	unsigned int quiet_nan:1;
-	unsigned int mantissa:22;
-#endif				/* Big endian.  */
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-	unsigned int mantissa:22;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:8;
-	unsigned int negative:1;
-#endif				/* Little endian.  */
-      } ieee_nan;
-  };
-
-#define IEEE754_FLOAT_BIAS	0x7f /* Added to exponent.  */
-
-
-union ieee754_double
-  {
-    double d;
-
-    /* This is the IEEE 754 double-precision format.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:11;
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa0:20;
-	unsigned int mantissa1:32;
-#endif				/* Big endian.  */
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-# if	__FLOAT_WORD_ORDER == BIG_ENDIAN
-	unsigned int mantissa0:20;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-# else
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:20;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-# endif
-#endif				/* Little endian.  */
-      } ieee;
-
-    /* This format makes it easier to see if a NaN is a signalling NaN.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:11;
-	unsigned int quiet_nan:1;
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa0:19;
-	unsigned int mantissa1:32;
-#else
-# if	__FLOAT_WORD_ORDER == BIG_ENDIAN
-	unsigned int mantissa0:19;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-# else
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:19;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-# endif
-#endif
-      } ieee_nan;
-  };
-
-#define IEEE754_DOUBLE_BIAS	0x3ff /* Added to exponent.  */
-
-#if LDBL_MANT_DIG == 113
-
-union ieee854_long_double
-  {
-    long double d;
-
-    /* This is the IEEE 854 quad-precision format.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:15;
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa0:16;
-	unsigned int mantissa1:32;
-	unsigned int mantissa2:32;
-	unsigned int mantissa3:32;
-#endif				/* Big endian.  */
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa3:32;
-	unsigned int mantissa2:32;
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:16;
-	unsigned int exponent:15;
-	unsigned int negative:1;
-#endif				/* Little endian.  */
-      } ieee;
-
-    /* This format makes it easier to see if a NaN is a signalling NaN.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:15;
-	unsigned int quiet_nan:1;
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa0:15;
-	unsigned int mantissa1:32;
-	unsigned int mantissa2:32;
-	unsigned int mantissa3:32;
-#endif				/* Big endian.  */
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa3:32;
-	unsigned int mantissa2:32;
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:15;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:15;
-	unsigned int negative:1;
-#endif				/* Little endian.  */
-      } ieee_nan;
-  };
-
-#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent.  */
-
-#elif LDBL_MANT_DIG == 64
-
-union ieee854_long_double
-  {
-    long double d;
-
-    /* This is the IEEE 854 double-extended-precision format.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:15;
-	unsigned int empty:16;
-	unsigned int mantissa0:32;
-	unsigned int mantissa1:32;
-#endif
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-# if	__FLOAT_WORD_ORDER == BIG_ENDIAN
-	unsigned int exponent:15;
-	unsigned int negative:1;
-	unsigned int empty:16;
-	unsigned int mantissa0:32;
-	unsigned int mantissa1:32;
-# else
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:32;
-	unsigned int exponent:15;
-	unsigned int negative:1;
-	unsigned int empty:16;
-# endif
-#endif
-      } ieee;
-
-    /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:15;
-	unsigned int empty:16;
-	unsigned int one:1;
-	unsigned int quiet_nan:1;
-	unsigned int mantissa0:30;
-	unsigned int mantissa1:32;
-#endif
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-# if	__FLOAT_WORD_ORDER == BIG_ENDIAN
-	unsigned int exponent:15;
-	unsigned int negative:1;
-	unsigned int empty:16;
-	unsigned int mantissa0:30;
-	unsigned int quiet_nan:1;
-	unsigned int one:1;
-	unsigned int mantissa1:32;
-# else
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:30;
-	unsigned int quiet_nan:1;
-	unsigned int one:1;
-	unsigned int exponent:15;
-	unsigned int negative:1;
-	unsigned int empty:16;
-# endif
-#endif
-      } ieee_nan;
-  };
-
-#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
-
-#elif LDBL_MANT_DIG == 53
-
-union ieee854_long_double
-  {
-    long double d;
-
-    /* This is the IEEE 754 double-precision format.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:11;
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa0:20;
-	unsigned int mantissa1:32;
-#endif				/* Big endian.  */
-#if	__BYTE_ORDER == __LITTLE_ENDIAN
-# if	__FLOAT_WORD_ORDER == BIG_ENDIAN
-	unsigned int mantissa0:20;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-# else
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:20;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-# endif
-#endif				/* Little endian.  */
-      } ieee;
-
-    /* This format makes it easier to see if a NaN is a signalling NaN.  */
-    struct
-      {
-#if	__BYTE_ORDER == __BIG_ENDIAN
-	unsigned int negative:1;
-	unsigned int exponent:11;
-	unsigned int quiet_nan:1;
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa0:19;
-	unsigned int mantissa1:32;
-#else
-# if	__FLOAT_WORD_ORDER == BIG_ENDIAN
-	unsigned int mantissa0:19;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-	unsigned int mantissa1:32;
-# else
-	/* Together these comprise the mantissa.  */
-	unsigned int mantissa1:32;
-	unsigned int mantissa0:19;
-	unsigned int quiet_nan:1;
-	unsigned int exponent:11;
-	unsigned int negative:1;
-# endif
-#endif
-      } ieee_nan;
-  };
-
-#define IEEE854_LONG_DOUBLE_BIAS	0x3ff /* Added to exponent.  */
-
-#endif /* LDBL_MANT_DIG == 53 */
-
-__END_DECLS
-
-#endif /* ieee754.h */
diff --git a/sysdeps/mips/init-first.c b/sysdeps/mips/init-first.c
deleted file mode 100644
index b67a44431c..0000000000
--- a/sysdeps/mips/init-first.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Initialization code run first thing by the ELF startup code.  For mips/Unix.
-   Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-
-extern void __libc_init (int, char **, char **);
-extern void __libc_global_ctors (void);
-
-
-static void
-init (int *data)
-{
-  int argc = *data;
-  char **argv = (void *) (data + 1);
-  char **envp = &argv[argc + 1];
-
-  __environ = envp;
-  __libc_init (argc, argv, envp);
-}
-
-#ifdef SHARED
-/* This function is called to initialize the shared C library.
-   It is called just before the user _start code from mips/elf/start.S,
-   with the stack set up as that code gets it.  */
-
-/* NOTE!  The linker notices the magical name `_init' and sets the DT_INIT
-   pointer in the dynamic section based solely on that.  It is convention
-   for this function to be in the `.init' section, but the symbol name is
-   the only thing that really matters!!  */
-/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
-
-void
-_init (int argc, ...)
-{
-  init (&argc);
-
-  __libc_global_ctors ();
-}
-#endif
-
-
-void
-__libc_init_first (int argc __attribute__ ((unused)), ...)
-{
-#ifndef SHARED
-  init (&argc);
-#endif
-}
diff --git a/sysdeps/mips/lshift.S b/sysdeps/mips/lshift.S
deleted file mode 100644
index 0217bfc586..0000000000
--- a/sysdeps/mips/lshift.S
+++ /dev/null
@@ -1,98 +0,0 @@
-/* MIPS2 __mpn_lshift --
-
-Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.  */
-
-#include <sysdep.h>
-
-/* INPUT PARAMETERS
-   res_ptr	$4
-   src_ptr	$5
-   size		$6
-   cnt		$7
-*/
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__mpn_lshift)
-	.set	noreorder
-#ifdef __PIC__
-	.cpload t9
-#endif
-	.set	nomacro
-
-	sll	$2,$6,2
-	addu	$5,$5,$2	/* make r5 point at end of src */
-	lw	$10,-4($5)	/* load first limb */
-	subu	$13,$0,$7
-	addu	$4,$4,$2	/* make r4 point at end of res */
-	addiu	$6,$6,-1
-	and	$9,$6,4-1	/* number of limbs in first loop */
-	beq	$9,$0,L(L0)	/* if multiple of 4 limbs, skip first loop */
-	srl	$2,$10,$13	/* compute function result */
-
-	subu	$6,$6,$9
-
-L(Loop0):	lw	$3,-8($5)
-	addiu	$4,$4,-4
-	addiu	$5,$5,-4
-	addiu	$9,$9,-1
-	sll	$11,$10,$7
-	srl	$12,$3,$13
-	move	$10,$3
-	or	$8,$11,$12
-	bne	$9,$0,L(Loop0)
-	sw	$8,0($4)
-
-L(L0):	beq	$6,$0,L(Lend)
-	nop
-
-L(Loop):	lw	$3,-8($5)
-	addiu	$4,$4,-16
-	addiu	$6,$6,-4
-	sll	$11,$10,$7
-	srl	$12,$3,$13
-
-	lw	$10,-12($5)
-	sll	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,12($4)
-	srl	$9,$10,$13
-
-	lw	$3,-16($5)
-	sll	$11,$10,$7
-	or	$8,$14,$9
-	sw	$8,8($4)
-	srl	$12,$3,$13
-
-	lw	$10,-20($5)
-	sll	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,4($4)
-	srl	$9,$10,$13
-
-	addiu	$5,$5,-16
-	or	$8,$14,$9
-	bgtz	$6,L(Loop)
-	sw	$8,0($4)
-
-L(Lend):	sll	$8,$10,$7
-	j	$31
-	sw	$8,-4($4)
-	END (__mpn_lshift)
diff --git a/sysdeps/mips/machine-gmon.h b/sysdeps/mips/machine-gmon.h
deleted file mode 100644
index 7a089fa595..0000000000
--- a/sysdeps/mips/machine-gmon.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Machine-specific calling sequence for `mcount' profiling function.  MIPS
-   Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sgidefs.h>
-
-#define _MCOUNT_DECL(frompc,selfpc) \
-static void __attribute_used__ __mcount (u_long frompc, u_long selfpc)
-
-/* Call __mcount with the return PC for our caller,
-   and the return PC our caller will return to.  */
-
-#if _MIPS_SIM == _ABIO32
-
-#ifdef __PIC__
-# define CPLOAD ".cpload $25;"
-# define CPRESTORE ".cprestore 44\n\t"
-#else
-# define CPLOAD
-# define CPRESTORE
-#endif
-
-#define MCOUNT asm(\
-	".globl _mcount;\n\t" \
-	".align 2;\n\t" \
-	".type _mcount,@function;\n\t" \
-	".ent _mcount\n\t" \
-        "_mcount:\n\t" \
-        ".frame $sp,44,$31\n\t" \
-        ".set noreorder;\n\t" \
-        ".set noat;\n\t" \
-        CPLOAD \
-	"subu $29,$29,48;\n\t" \
-	CPRESTORE \
-        "sw $4,24($29);\n\t" \
-        "sw $5,28($29);\n\t" \
-        "sw $6,32($29);\n\t" \
-        "sw $7,36($29);\n\t" \
-        "sw $2,40($29);\n\t" \
-        "sw $1,16($29);\n\t" \
-        "sw $31,20($29);\n\t" \
-        "move $5,$31;\n\t" \
-        "move $4,$1;\n\t" \
-        "jal __mcount;\n\t" \
-        "nop;\n\t" \
-        "lw $4,24($29);\n\t" \
-        "lw $5,28($29);\n\t" \
-        "lw $6,32($29);\n\t" \
-        "lw $7,36($29);\n\t" \
-        "lw $2,40($29);\n\t" \
-        "lw $31,20($29);\n\t" \
-        "lw $1,16($29);\n\t" \
-        "addu $29,$29,56;\n\t" \
-        "j $31;\n\t" \
-        "move $31,$1;\n\t" \
-        ".set reorder;\n\t" \
-        ".set at\n\t" \
-        ".end _mcount");
-
-#else
-
-#ifdef __PIC__
-# define CPSETUP ".cpsetup $25, 88, _mcount;"
-# define CPRETURN ".cpreturn;"
-#else
-# define CPSETUP
-# define CPRETURN
-#endif
-
-#if _MIPS_SIM == _ABIN32
-# define PTR_ADDU_STRING "add" /* no u */
-# define PTR_SUBU_STRING "sub" /* no u */
-#elif _MIPS_SIM == _ABI64
-# define PTR_ADDU_STRING "daddu"
-# define PTR_SUBU_STRING "dsubu"
-#else
-# error "Unknown ABI"
-#endif
-
-#define MCOUNT asm(\
-	".globl _mcount;\n\t" \
-	".align 3;\n\t" \
-	".type _mcount,@function;\n\t" \
-	".ent _mcount\n\t" \
-        "_mcount:\n\t" \
-        ".frame $sp,88,$31\n\t" \
-        ".set noreorder;\n\t" \
-        ".set noat;\n\t" \
-        PTR_SUBU_STRING " $29,$29,96;\n\t" \
-        CPSETUP \
-        "sd $4,24($29);\n\t" \
-        "sd $5,32($29);\n\t" \
-        "sd $6,40($29);\n\t" \
-        "sd $7,48($29);\n\t" \
-        "sd $8,56($29);\n\t" \
-        "sd $9,64($29);\n\t" \
-        "sd $10,72($29);\n\t" \
-        "sd $11,80($29);\n\t" \
-        "sd $2,16($29);\n\t" \
-        "sd $1,0($29);\n\t" \
-        "sd $31,8($29);\n\t" \
-        "move $5,$31;\n\t" \
-        "move $4,$1;\n\t" \
-        "jal __mcount;\n\t" \
-        "nop;\n\t" \
-        "ld $4,24($29);\n\t" \
-        "ld $5,32($29);\n\t" \
-        "ld $6,40($29);\n\t" \
-        "ld $7,48($29);\n\t" \
-        "ld $8,56($29);\n\t" \
-        "ld $9,64($29);\n\t" \
-        "ld $10,72($29);\n\t" \
-        "ld $11,80($29);\n\t" \
-        "ld $2,16($29);\n\t" \
-        "ld $31,8($29);\n\t" \
-        "ld $1,0($29);\n\t" \
-        CPRETURN \
-        PTR_ADDU_STRING " $29,$29,96;\n\t" \
-        "j $31;\n\t" \
-        "move $31,$1;\n\t" \
-        ".set reorder;\n\t" \
-        ".set at\n\t" \
-        ".end _mcount");
-
-#endif
diff --git a/sysdeps/mips/memcpy.S b/sysdeps/mips/memcpy.S
deleted file mode 100644
index 2049d05829..0000000000
--- a/sysdeps/mips/memcpy.S
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <endian.h>
-
-
-/* void *memcpy(void *s1, const void *s2, size_t n);  */
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-#  define LWHI	lwl		/* high part is left in big-endian	*/
-#  define SWHI	swl		/* high part is left in big-endian	*/
-#  define LWLO	lwr		/* low part is right in big-endian	*/
-#  define SWLO	swr		/* low part is right in big-endian	*/
-#else
-#  define LWHI	lwr		/* high part is right in little-endian	*/
-#  define SWHI	swr		/* high part is right in little-endian	*/
-#  define LWLO	lwl		/* low part is left in little-endian	*/
-#  define SWLO	swl		/* low part is left in little-endian	*/
-#endif
-
-ENTRY (memcpy)
-	.set	noreorder
-
-	slti	t0, a2, 8		# Less than 8?
-	bne	t0, zero, L(last8)
-	move	v0, a0			# Setup exit value before too late
-
-	xor	t0, a1, a0		# Find a0/a1 displacement
-	andi	t0, 0x3
-	bne	t0, zero, L(shift)	# Go handle the unaligned case
-	subu	t1, zero, a1
-	andi	t1, 0x3			# a0/a1 are aligned, but are we
-	beq	t1, zero, L(chk8w)	#  starting in the middle of a word?
-	subu	a2, t1
-	LWHI	t0, 0(a1)		# Yes we are... take care of that
-	addu	a1, t1
-	SWHI	t0, 0(a0)
-	addu	a0, t1
-
-L(chk8w):	
-	andi	t0, a2, 0x1f		# 32 or more bytes left?
-	beq	t0, a2, L(chk1w)
-	subu	a3, a2, t0		# Yes
-	addu	a3, a1			# a3 = end address of loop
-	move	a2, t0			# a2 = what will be left after loop
-L(lop8w):	
-	lw	t0,  0(a1)		# Loop taking 8 words at a time
-	lw	t1,  4(a1)
-	lw	t2,  8(a1)
-	lw	t3, 12(a1)
-	lw	t4, 16(a1)
-	lw	t5, 20(a1)
-	lw	t6, 24(a1)
-	lw	t7, 28(a1)
-	addiu	a0, 32
-	addiu	a1, 32
-	sw	t0, -32(a0)
-	sw	t1, -28(a0)
-	sw	t2, -24(a0)
-	sw	t3, -20(a0)
-	sw	t4, -16(a0)
-	sw	t5, -12(a0)
-	sw	t6,  -8(a0)
-	bne	a1, a3, L(lop8w)
-	sw	t7,  -4(a0)
-
-L(chk1w):	
-	andi	t0, a2, 0x3		# 4 or more bytes left?
-	beq	t0, a2, L(last8)
-	subu	a3, a2, t0		# Yes, handle them one word at a time
-	addu	a3, a1			# a3 again end address
-	move	a2, t0
-L(lop1w):	
-	lw	t0, 0(a1)
-	addiu	a0, 4
-	addiu	a1, 4
-	bne	a1, a3, L(lop1w)
-	sw	t0, -4(a0)
-
-L(last8):	
-	blez	a2, L(lst8e)		# Handle last 8 bytes, one at a time
-	addu	a3, a2, a1
-L(lst8l):	
-	lb	t0, 0(a1)
-	addiu	a0, 1
-	addiu	a1, 1
-	bne	a1, a3, L(lst8l)
-	sb	t0, -1(a0)
-L(lst8e):	
-	jr	ra			# Bye, bye
-	nop
-
-L(shift):	
-	subu	a3, zero, a0		# Src and Dest unaligned 
-	andi	a3, 0x3			#  (unoptimized case...)
-	beq	a3, zero, L(shft1)
-	subu	a2, a3			# a2 = bytes left
-	LWHI	t0, 0(a1)		# Take care of first odd part
-	LWLO	t0, 3(a1)
-	addu	a1, a3
-	SWHI	t0, 0(a0)
-	addu	a0, a3
-L(shft1):	
-	andi	t0, a2, 0x3
-	subu	a3, a2, t0
-	addu	a3, a1
-L(shfth):	
-	LWHI	t1, 0(a1)		# Limp through, word by word
-	LWLO	t1, 3(a1)
-	addiu	a0, 4
-	addiu	a1, 4
-	bne	a1, a3, L(shfth)
-	sw	t1, -4(a0)
-	b	L(last8)		# Handle anything which may be left
-	move	a2, t0
-
-	.set	reorder
-END (memcpy)
-libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
deleted file mode 100644
index 694ee8f1dc..0000000000
--- a/sysdeps/mips/memset.S
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <endian.h>
-
-
-/* void *memset(void *s, int c, size_t n).  */
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-# define SWHI	swl		/* high part is left in big-endian	*/
-#else
-# define SWHI	swr		/* high part is right in little-endian	*/
-#endif
-
-ENTRY (memset)
-	.set	noreorder
-
-	slti	t1, a2, 8		# Less than 8?
-	bne	t1, zero, L(last8)
-	move	v0, a0			# Setup exit value before too late
-
-	beq	a1, zero, L(ueven)	# If zero pattern, no need to extend
-	andi	a1, 0xff		# Avoid problems with bogus arguments
-	sll	t0, a1, 8
-	or	a1, t0
-	sll	t0, a1, 16
-	or	a1, t0			# a1 is now pattern in full word
-
-L(ueven):	
-	subu	t0, zero, a0		# Unaligned address?
-	andi	t0, 0x3
-	beq	t0, zero, L(chkw)
-	subu	a2, t0
-	SWHI	a1, 0(a0)		# Yes, handle first unaligned part
-	addu	a0, t0			# Now both a0 and a2 are updated
-
-L(chkw):	
-	andi	t0, a2, 0x7		# Enough left for one loop iteration?
-	beq	t0, a2, L(chkl)
-	subu	a3, a2, t0
-	addu	a3, a0			# a3 is last loop address +1
-	move	a2, t0			# a2 is now # of bytes left after loop
-L(loopw):	
-	addiu	a0, 8			# Handle 2 words pr. iteration
-	sw	a1, -8(a0)
-	bne	a0, a3, L(loopw)
-	sw	a1, -4(a0)
-
-L(chkl):	
-	andi	t0, a2, 0x4		# Check if there is at least a full
-	beq	t0, zero, L(last8)	#  word remaining after the loop
-	subu	a2, t0
-	sw	a1, 0(a0)		# Yes...
-	addiu	a0, 4
-
-L(last8):	
-	blez	a2, L(exit)		# Handle last 8 bytes (if cnt>0)
-	addu	a3, a2, a0		# a3 is last address +1
-L(lst8l):	
-	addiu	a0, 1
-	bne	a0, a3, L(lst8l)
-	sb	a1, -1(a0)
-L(exit):	
-	j	ra			# Bye, bye
-	nop
-
-	.set	reorder
-END (memset)
-libc_hidden_builtin_def (memset)
diff --git a/sysdeps/mips/memusage.h b/sysdeps/mips/memusage.h
deleted file mode 100644
index dc1cc9ca14..0000000000
--- a/sysdeps/mips/memusage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define GETSP() ({ register uintptr_t stack_ptr asm ("$29"); stack_ptr; })
-
-#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/mips/mips32/Implies b/sysdeps/mips/mips32/Implies
deleted file mode 100644
index fab98d7312..0000000000
--- a/sysdeps/mips/mips32/Implies
+++ /dev/null
@@ -1,2 +0,0 @@
-mips
-wordsize-32
diff --git a/sysdeps/mips/mips32/Makefile b/sysdeps/mips/mips32/Makefile
deleted file mode 100644
index dec0b024c3..0000000000
--- a/sysdeps/mips/mips32/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ifeq ($(filter -mabi=32,$(CC)),)
-CC += -mabi=32
-endif
diff --git a/sysdeps/mips/mips64/Dist b/sysdeps/mips/mips64/Dist
deleted file mode 100644
index ad6ea0313a..0000000000
--- a/sysdeps/mips/mips64/Dist
+++ /dev/null
@@ -1 +0,0 @@
-setjmp_aux.c
diff --git a/sysdeps/mips/mips64/Implies b/sysdeps/mips/mips64/Implies
deleted file mode 100644
index 8c18cb3034..0000000000
--- a/sysdeps/mips/mips64/Implies
+++ /dev/null
@@ -1,3 +0,0 @@
-# MIPS uses IEEE 754 floating point.
-ieee754/flt-32
-ieee754/dbl-64
diff --git a/sysdeps/mips/mips64/__longjmp.c b/sysdeps/mips/mips64/__longjmp.c
deleted file mode 100644
index 546493f842..0000000000
--- a/sysdeps/mips/mips64/__longjmp.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2000, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-#include <sgidefs.h>
-#include <stdlib.h>
-
-#undef __longjmp
-
-#ifndef	__GNUC__
-  #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-void
-__longjmp (env, val_arg)
-     __jmp_buf env;
-     int val_arg;
-{
-  /* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before
-     the hack around it); force it to use $a1 for the longjmp value.
-     Without this it saves $a1 in a register which gets clobbered
-     along the way.  */
-  register int val asm ("a1");
-
-  /* Pull back the floating point callee-saved registers.  */
-#if _MIPS_SIM == _ABI64
-  asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[0]));
-  asm volatile ("l.d $f25, %0" : : "m" (env[0].__fpregs[1]));
-  asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[2]));
-  asm volatile ("l.d $f27, %0" : : "m" (env[0].__fpregs[3]));
-  asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
-  asm volatile ("l.d $f29, %0" : : "m" (env[0].__fpregs[5]));
-  asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[6]));
-  asm volatile ("l.d $f31, %0" : : "m" (env[0].__fpregs[7]));
-#else
-  asm volatile ("l.d $f20, %0" : : "m" (env[0].__fpregs[0]));
-  asm volatile ("l.d $f22, %0" : : "m" (env[0].__fpregs[1]));
-  asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[2]));
-  asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[3]));
-  asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
-  asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5]));
-#endif
-
-  /* Get and reconstruct the floating point csr.  */
-  asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
-  asm volatile ("ctc1 $2, $31");
-
-  /* Get the GP. */
-  asm volatile ("ld $gp, %0" : : "m" (env[0].__gp));
-
-  /* Get the callee-saved registers.  */
-  asm volatile ("ld $16, %0" : : "m" (env[0].__regs[0]));
-  asm volatile ("ld $17, %0" : : "m" (env[0].__regs[1]));
-  asm volatile ("ld $18, %0" : : "m" (env[0].__regs[2]));
-  asm volatile ("ld $19, %0" : : "m" (env[0].__regs[3]));
-  asm volatile ("ld $20, %0" : : "m" (env[0].__regs[4]));
-  asm volatile ("ld $21, %0" : : "m" (env[0].__regs[5]));
-  asm volatile ("ld $22, %0" : : "m" (env[0].__regs[6]));
-  asm volatile ("ld $23, %0" : : "m" (env[0].__regs[7]));
-
-  /* Get the PC.  */
-  asm volatile ("ld $31, %0" : : "m" (env[0].__pc));
-
-
-  /* Restore the stack pointer and the FP.  They have to be restored
-     last and in a single asm as gcc, depending on options used, may
-     use either of them to access env.  */
-  asm volatile ("ld $29, %0\n\t"
-		"ld $30, %1\n\t" : : "m" (env[0].__sp), "m" (env[0].__fp));
-
-/* Give setjmp 1 if given a 0, or what they gave us if non-zero.  */
-  if (val == 0)
-    asm volatile ("dli $2, 1");
-  else
-    asm volatile ("move $2, %0" : : "r" (val));
-
-  asm volatile ("j $31");
-
-  /* Avoid `volatile function does return' warnings.  */
-  for (;;);
-}
diff --git a/sysdeps/mips/mips64/add_n.S b/sysdeps/mips/mips64/add_n.S
deleted file mode 100644
index 072f4f0b73..0000000000
--- a/sysdeps/mips/mips64/add_n.S
+++ /dev/null
@@ -1,130 +0,0 @@
-/* MIPS3 __mpn_add_n -- Add two limb vectors of the same length > 0 and
- * store sum in a third limb vector.
- *
- * Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
- *
- * This file is part of the GNU MP Library.
- *
- * The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/*
- * INPUT PARAMETERS
- * res_ptr	$4
- * s1_ptr	$5
- * s2_ptr	$6
- * size		$7
- */
-#ifdef __PIC__
-	.option pic2
-#endif
-	.text
-	.align	2
-	.globl	__mpn_add_n
-	.ent	__mpn_add_n
-__mpn_add_n:
-#ifdef __PIC__
-	SETUP_GP /* ??? unused */
-#endif
-	.set	noreorder
-	.set	nomacro
-
-	ld	$10,0($5)
-	ld	$11,0($6)
-
-	daddiu	$7,$7,-1
-	and	$9,$7,4-1	# number of limbs in first loop
-	beq	$9,$0,L(L0)	# if multiple of 4 limbs, skip first loop
-	move	$2,$0
-
-	dsubu	$7,$7,$9
-
-L(Loop0):	daddiu	$9,$9,-1
-	ld	$12,8($5)
-	daddu	$11,$11,$2
-	ld	$13,8($6)
-	sltu	$8,$11,$2
-	daddu	$11,$10,$11
-	sltu	$2,$11,$10
-	sd	$11,0($4)
-	or	$2,$2,$8
-
-	daddiu	$5,$5,8
-	daddiu	$6,$6,8
-	move	$10,$12
-	move	$11,$13
-	bne	$9,$0,L(Loop0)
-	daddiu	$4,$4,8
-
-L(L0):	beq	$7,$0,L(Lend)
-	nop
-
-L(Loop):	daddiu	$7,$7,-4
-
-	ld	$12,8($5)
-	daddu	$11,$11,$2
-	ld	$13,8($6)
-	sltu	$8,$11,$2
-	daddu	$11,$10,$11
-	sltu	$2,$11,$10
-	sd	$11,0($4)
-	or	$2,$2,$8
-
-	ld	$10,16($5)
-	daddu	$13,$13,$2
-	ld	$11,16($6)
-	sltu	$8,$13,$2
-	daddu	$13,$12,$13
-	sltu	$2,$13,$12
-	sd	$13,8($4)
-	or	$2,$2,$8
-
-	ld	$12,24($5)
-	daddu	$11,$11,$2
-	ld	$13,24($6)
-	sltu	$8,$11,$2
-	daddu	$11,$10,$11
-	sltu	$2,$11,$10
-	sd	$11,16($4)
-	or	$2,$2,$8
-
-	ld	$10,32($5)
-	daddu	$13,$13,$2
-	ld	$11,32($6)
-	sltu	$8,$13,$2
-	daddu	$13,$12,$13
-	sltu	$2,$13,$12
-	sd	$13,24($4)
-	or	$2,$2,$8
-
-	daddiu	$5,$5,32
-	daddiu	$6,$6,32
-
-	bne	$7,$0,L(Loop)
-	daddiu	$4,$4,32
-
-L(Lend):	daddu	$11,$11,$2
-	sltu	$8,$11,$2
-	daddu	$11,$10,$11
-	sltu	$2,$11,$10
-	sd	$11,0($4)
-	j	$31
-	or	$2,$2,$8
-
-	.end	__mpn_add_n
diff --git a/sysdeps/mips/mips64/addmul_1.S b/sysdeps/mips/mips64/addmul_1.S
deleted file mode 100644
index f5ecd83702..0000000000
--- a/sysdeps/mips/mips64/addmul_1.S
+++ /dev/null
@@ -1,107 +0,0 @@
-/* MIPS3 __mpn_addmul_1 -- Multiply a limb vector with a single limb and
- * add the product to a second limb vector.
- *
- * Copyright (C) 1992, 1994, 1995, 2002, 2003 Free Software Foundation, Inc.
- *
- * This file is part of the GNU MP Library.
- *
- * The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/* INPUT PARAMETERS
- * res_ptr	$4
- * s1_ptr	$5
- * size		$6
- * s2_limb	$7
- */
-
-#ifdef PIC
-	.option pic2
-#endif
-	.text
-	.align	4
-	.globl	__mpn_addmul_1
-	.ent	__mpn_addmul_1
-__mpn_addmul_1:
-#ifdef PIC
-	SETUP_GP /* ??? unused */
-#endif
-	.set    noreorder
-	.set    nomacro
-
- # warm up phase 0
-	ld	$8,0($5)
-
- # warm up phase 1
-	daddiu	$5,$5,8
-	dmultu	$8,$7
-
-	daddiu	$6,$6,-1
-	beq	$6,$0,L(LC0)
-	move	$2,$0		# zero cy2
-
-	daddiu	$6,$6,-1
-	beq	$6,$0,L(LC1)
-	ld	$8,0($5)	# load new s1 limb as early as possible
-
-L(Loop):	ld	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	daddiu	$5,$5,8
-	daddu	$3,$3,$2	# add old carry limb to low product limb
-	dmultu	$8,$7
-	ld	$8,0($5)	# load new s1 limb as early as possible
-	daddiu	$6,$6,-1	# decrement loop counter
-	sltu	$2,$3,$2	# carry from previous addition -> $2
-	daddu	$3,$10,$3
-	sltu	$10,$3,$10
-	daddu	$2,$2,$10
-	sd	$3,0($4)
-	daddiu	$4,$4,8
-	bne	$6,$0,L(Loop)
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 1
-L(LC1):	ld	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	daddu	$3,$3,$2
-	sltu	$2,$3,$2
-	dmultu	$8,$7
-	daddu	$3,$10,$3
-	sltu	$10,$3,$10
-	daddu	$2,$2,$10
-	sd	$3,0($4)
-	daddiu	$4,$4,8
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 0
-L(LC0):	ld	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	daddu	$3,$3,$2
-	sltu	$2,$3,$2
-	daddu	$3,$10,$3
-	sltu	$10,$3,$10
-	daddu	$2,$2,$10
-	sd	$3,0($4)
-	j	$31
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
-	.end	__mpn_addmul_1
diff --git a/sysdeps/mips/mips64/bsd-_setjmp.S b/sysdeps/mips/mips64/bsd-_setjmp.S
deleted file mode 100644
index 7620cf391f..0000000000
--- a/sysdeps/mips/mips64/bsd-_setjmp.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  MIPS64 version.
-   Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-#include <sgidefs.h>
-#include <sysdep.h>
-#include <sys/asm.h>
-
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (_setjmp)
-#ifdef __PIC__
-	SETUP_GP
-#endif
-	SETUP_GP64 (v0, C_SYMBOL_NAME (_setjmp))
-	PTR_LA t9, C_SYMBOL_NAME (__sigsetjmp)
-#if _MIPS_SIM == _ABIO32
-	nop
-#endif	
-	RESTORE_GP64
-	move	a1, zero		/* Pass a second argument of zero.  */
-#ifdef __PIC__
-	jr	t9
-#else
-	j	C_SYMBOL_NAME (__sigsetjmp)
-#endif
-	.end	_setjmp
-libc_hidden_def (_setjmp)
diff --git a/sysdeps/mips/mips64/bsd-setjmp.S b/sysdeps/mips/mips64/bsd-setjmp.S
deleted file mode 100644
index 2a1fd9ce71..0000000000
--- a/sysdeps/mips/mips64/bsd-setjmp.S
+++ /dev/null
@@ -1,47 +0,0 @@
-/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  MIPS64 version.
-   Copyright (C) 1996, 1997, 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
-   We cannot do it in C because it must be a tail-call, so frame-unwinding
-   in setjmp doesn't clobber the state restored by longjmp.  */
-
-#include <sgidefs.h>
-#include <sysdep.h>
-#include <sys/asm.h>
-
-#ifdef PIC
-	.option pic2
-#endif
-ENTRY (setjmp)
-#ifdef __PIC__
-	SETUP_GP
-#endif
-	SETUP_GP64 (v0, C_SYMBOL_NAME (setjmp))
-	PTR_LA t9, C_SYMBOL_NAME (__sigsetjmp)
-#if _MIPS_SIM == _ABIO32
-	nop
-#endif	
-	RESTORE_GP64
-	dli a1, 1		/* Pass a second argument of one.  */
-#ifdef __PIC__
-	jr	t9
-#else
-	j	C_SYMBOL_NAME (__sigsetjmp)
-#endif
-	.end	setjmp
diff --git a/sysdeps/mips/mips64/gmp-mparam.h b/sysdeps/mips/mips64/gmp-mparam.h
deleted file mode 100644
index 7666137a21..0000000000
--- a/sysdeps/mips/mips64/gmp-mparam.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* gmp-mparam.h -- Compiler/machine parameter header file.
-
-Copyright (C) 1991, 1993, 1994, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#if defined __GMP_H__ && ! defined _LONG_LONG_LIMB
-#error "Included too late for _LONG_LONG_LIMB to take effect"
-#endif
-
-#define _LONG_LONG_LIMB
-#define BITS_PER_MP_LIMB 64
-#define BYTES_PER_MP_LIMB 8
-#define BITS_PER_LONGINT __WORDSIZE
-#define BITS_PER_INT 32
-#define BITS_PER_SHORTINT 16
-#define BITS_PER_CHAR 8
diff --git a/sysdeps/mips/mips64/lshift.S b/sysdeps/mips/mips64/lshift.S
deleted file mode 100644
index 20f9e3da19..0000000000
--- a/sysdeps/mips/mips64/lshift.S
+++ /dev/null
@@ -1,105 +0,0 @@
-/* MIPS3 __mpn_lshift --
- *
- * Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
- *
- * This file is part of the GNU MP Library.
- *
- * The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/* INPUT PARAMETERS
- * res_ptr	$4
- * src_ptr	$5
- * size		$6
- * cnt		$7
- */
-
-#ifdef __PIC__
-	.option pic2
-#endif
-	.text
-	.align	2
-	.globl	__mpn_lshift
-	.ent	__mpn_lshift
-__mpn_lshift:
-#ifdef __PIC__
-	SETUP_GP /* ??? unused */
-#endif
-	.set	noreorder
-	.set	nomacro
-
-	dsll	$2,$6,3
-	daddu	$5,$5,$2	# make r5 point at end of src
-	ld	$10,-8($5)	# load first limb
-	dsubu	$13,$0,$7
-	daddu	$4,$4,$2	# make r4 point at end of res
-	daddiu	$6,$6,-1
-	and	$9,$6,4-1	# number of limbs in first loop
-	beq	$9,$0,L(L0)	# if multiple of 4 limbs, skip first loop
-	dsrl	$2,$10,$13	# compute function result
-
-	dsubu	$6,$6,$9
-
-L(Loop0):	ld	$3,-16($5)
-	daddiu	$4,$4,-8
-	daddiu	$5,$5,-8
-	daddiu	$9,$9,-1
-	dsll	$11,$10,$7
-	dsrl	$12,$3,$13
-	move	$10,$3
-	or	$8,$11,$12
-	bne	$9,$0,L(Loop0)
-	sd	$8,0($4)
-
-L(L0):	beq	$6,$0,L(Lend)
-	nop
-
-L(Loop):	ld	$3,-16($5)
-	daddiu	$4,$4,-32
-	daddiu	$6,$6,-4
-	dsll	$11,$10,$7
-	dsrl	$12,$3,$13
-
-	ld	$10,-24($5)
-	dsll	$14,$3,$7
-	or	$8,$11,$12
-	sd	$8,24($4)
-	dsrl	$9,$10,$13
-
-	ld	$3,-32($5)
-	dsll	$11,$10,$7
-	or	$8,$14,$9
-	sd	$8,16($4)
-	dsrl	$12,$3,$13
-
-	ld	$10,-40($5)
-	dsll	$14,$3,$7
-	or	$8,$11,$12
-	sd	$8,8($4)
-	dsrl	$9,$10,$13
-
-	daddiu	$5,$5,-32
-	or	$8,$14,$9
-	bgtz	$6,L(Loop)
-	sd	$8,0($4)
-
-L(Lend):	dsll	$8,$10,$7
-	j	$31
-	sd	$8,-8($4)
-	.end	__mpn_lshift
diff --git a/sysdeps/mips/mips64/memcpy.S b/sysdeps/mips/mips64/memcpy.S
deleted file mode 100644
index eab9463f86..0000000000
--- a/sysdeps/mips/mips64/memcpy.S
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
-   Ported to mips3 n32/n64 by Alexandre Oliva <aoliva@redhat.com>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <endian.h>
-#include <sys/asm.h>
-
-
-/* void *memcpy(void *s1, const void *s2, size_t n);
-	
-   This could probably be optimized further.  */
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-#  define LDHI	ldl		/* high part is left in big-endian	*/
-#  define SDHI	sdl		/* high part is left in big-endian	*/
-#  define LDLO	ldr		/* low part is right in big-endian	*/
-#  define SDLO	sdr		/* low part is right in big-endian	*/
-#else
-#  define LDHI	ldr		/* high part is right in little-endian	*/
-#  define SDHI	sdr		/* high part is right in little-endian	*/
-#  define LDLO	ldl		/* low part is left in little-endian	*/
-#  define SDLO	sdl		/* low part is left in little-endian	*/
-#endif
-
-ENTRY (memcpy)
-	.set	noreorder
-
-	slti	t0, a2, 16		# Less than 16?
-	bne	t0, zero, L(last16)
-	move	v0, a0			# Setup exit value before too late
-
-	xor	t0, a1, a0		# Find a0/a1 displacement
-	andi	t0, 0x7
-	bne	t0, zero, L(shift)	# Go handle the unaligned case
-	PTR_SUBU t1, zero, a1
-	andi	t1, 0x7			# a0/a1 are aligned, but are we
-	beq	t1, zero, L(chk8w)	#  starting in the middle of a word?
-	PTR_SUBU a2, t1
-	LDHI	t0, 0(a1)		# Yes we are... take care of that
-	PTR_ADDU a1, t1
-	SDHI	t0, 0(a0)
-	PTR_ADDU a0, t1
-
-L(chk8w):
-	andi	t0, a2, 0x3f		# 64 or more bytes left?
-	beq	t0, a2, L(chk1w)
-	PTR_SUBU a3, a2, t0		# Yes
-	PTR_ADDU a3, a1			# a3 = end address of loop
-	move	a2, t0			# a2 = what will be left after loop
-L(lop8w):	
-	ld	t0,  0(a1)		# Loop taking 8 words at a time
-	ld	t1,  8(a1)
-	ld	t2, 16(a1)
-	ld	t3, 24(a1)
-	ld	ta0, 32(a1)
-	ld	ta1, 40(a1)
-	ld	ta2, 48(a1)
-	ld	ta3, 56(a1)
-	PTR_ADDIU a0, 64
-	PTR_ADDIU a1, 64
-	sd	t0, -64(a0)
-	sd	t1, -56(a0)
-	sd	t2, -48(a0)
-	sd	t3, -40(a0)
-	sd	ta0, -32(a0)
-	sd	ta1, -24(a0)
-	sd	ta2, -16(a0)
-	bne	a1, a3, L(lop8w)
-	sd	ta3,  -8(a0)
-
-L(chk1w):
-	andi	t0, a2, 0x7		# 8 or more bytes left?
-	beq	t0, a2, L(last16)
-	PTR_SUBU a3, a2, t0		# Yes, handle them one dword at a time
-	PTR_ADDU a3, a1			# a3 again end address
-	move	a2, t0
-L(lop1w):
-	ld	t0, 0(a1)
-	PTR_ADDIU a0, 8
-	PTR_ADDIU a1, 8
-	bne	a1, a3, L(lop1w)
-	sd	t0, -8(a0)
-
-L(last16):
-	blez	a2, L(lst16e)		# Handle last 16 bytes, one at a time
-	PTR_ADDU a3, a2, a1
-L(lst16l):
-	lb	t0, 0(a1)
-	PTR_ADDIU a0, 1
-	PTR_ADDIU a1, 1
-	bne	a1, a3, L(lst16l)
-	sb	t0, -1(a0)
-L(lst16e):
-	jr	ra			# Bye, bye
-	nop
-
-L(shift):
-	PTR_SUBU a3, zero, a0		# Src and Dest unaligned 
-	andi	a3, 0x7			#  (unoptimized case...)
-	beq	a3, zero, L(shft1)
-	PTR_SUBU a2, a3			# a2 = bytes left
-	LDHI	t0, 0(a1)		# Take care of first odd part
-	LDLO	t0, 7(a1)
-	PTR_ADDU a1, a3
-	SDHI	t0, 0(a0)
-	PTR_ADDU a0, a3
-L(shft1):
-	andi	t0, a2, 0x7
-	PTR_SUBU a3, a2, t0
-	PTR_ADDU a3, a1
-L(shfth):
-	LDHI	t1, 0(a1)		# Limp through, dword by dword
-	LDLO	t1, 7(a1)
-	PTR_ADDIU a0, 8
-	PTR_ADDIU a1, 8
-	bne	a1, a3, L(shfth)
-	sd	t1, -8(a0)
-	b	L(last16)		# Handle anything which may be left
-	move	a2, t0
-
-	.set	reorder
-END (memcpy)
-libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/mips/mips64/memset.S b/sysdeps/mips/mips64/memset.S
deleted file mode 100644
index b50aaba816..0000000000
--- a/sysdeps/mips/mips64/memset.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
-   Ported to mips3 n32/n64 by Alexandre Oliva <aoliva@redhat.com>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <endian.h>
-#include <sys/asm.h>
-
-
-/* void *memset(void *s, int c, size_t n);
-	
-   This could probably be optimized further.  */
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-# define SDHI	sdl		/* high part is left in big-endian	*/
-#else
-# define SDHI	sdr		/* high part is right in little-endian	*/
-#endif
-
-ENTRY (memset)
-	.set	noreorder
-
-	slti	ta1, a2, 16		# Less than 16?
-	bne	ta1, zero, L(last16)
-	move	v0, a0			# Setup exit value before too late
-
-	beq	a1, zero, L(ueven)	# If zero pattern, no need to extend
-	andi	a1, 0xff		# Avoid problems with bogus arguments
-	dsll	ta0, a1, 8
-	or	a1, ta0
-	dsll	ta0, a1, 16
-	or	a1, ta0			# a1 is now pattern in full word
-	dsll	ta0, a1, 32
-	or	a1, ta0			# a1 is now pattern in double word
-
-L(ueven):
-	PTR_SUBU ta0, zero, a0		# Unaligned address?
-	andi	ta0, 0x7
-	beq	ta0, zero, L(chkw)
-	PTR_SUBU a2, ta0
-	SDHI	a1, 0(a0)		# Yes, handle first unaligned part
-	PTR_ADDU a0, ta0		# Now both a0 and a2 are updated
-
-L(chkw):
-	andi	ta0, a2, 0xf		# Enough left for one loop iteration?
-	beq	ta0, a2, L(chkl)
-	PTR_SUBU a3, a2, ta0
-	PTR_ADDU a3, a0			# a3 is last loop address +1
-	move	a2, ta0			# a2 is now # of bytes left after loop
-L(loopw):
-	PTR_ADDIU a0, 16		# Handle 2 dwords pr. iteration
-	sd	a1, -16(a0)
-	bne	a0, a3, L(loopw)
-	sd	a1,  -8(a0)
-
-L(chkl):
-	andi	ta0, a2, 0x8		# Check if there is at least a double
-	beq	ta0, zero, L(last16)	#  word remaining after the loop
-	PTR_SUBU a2, ta0
-	sd	a1, 0(a0)		# Yes...
-	PTR_ADDIU a0, 8
-
-L(last16):
-	blez	a2, L(exit)		# Handle last 16 bytes (if cnt>0)
-	PTR_ADDU a3, a2, a0		# a3 is last address +1
-L(lst16l):
-	PTR_ADDIU a0, 1
-	bne	a0, a3, L(lst16l)
-	sb	a1, -1(a0)
-L(exit):
-	j	ra			# Bye, bye
-	nop
-
-	.set	reorder
-END (memset)
-libc_hidden_builtin_def (memset)
diff --git a/sysdeps/mips/mips64/mul_1.S b/sysdeps/mips/mips64/mul_1.S
deleted file mode 100644
index c711783001..0000000000
--- a/sysdeps/mips/mips64/mul_1.S
+++ /dev/null
@@ -1,96 +0,0 @@
-/* MIPS3 __mpn_mul_1 -- Multiply a limb vector with a single limb and
- * store the product in a second limb vector.
- *
- * Copyright (C) 1992, 1994, 1995, 2000, 2002, 2003
- * Free Software Foundation, Inc.
- *
- * This file is part of the GNU MP Library.
- *
- * The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/* INPUT PARAMETERS
- * res_ptr	$4
- * s1_ptr	$5
- * size		$6
- * s2_limb	$7
- */
-
-#ifdef __PIC__
-	.option pic2
-#endif
-	.text
-	.align	4
-	.globl	__mpn_mul_1
-	.ent	__mpn_mul_1
-__mpn_mul_1:
-#ifdef __PIC__
-	SETUP_GP /* ??? unused */
-#endif
-	.set    noreorder
-	.set    nomacro
-
- # warm up phase 0
-	ld	$8,0($5)
-
- # warm up phase 1
-	daddiu	$5,$5,8
-	dmultu	$8,$7
-
-	daddiu	$6,$6,-1
-	beq	$6,$0,L(LC0)
-	move	$2,$0		# zero cy2
-
-	daddiu	$6,$6,-1
-	beq	$6,$0,L(LC1)
-	ld	$8,0($5)	# load new s1 limb as early as possible
-
-L(Loop):	mflo	$10
-	mfhi	$9
-	daddiu	$5,$5,8
-	daddu	$10,$10,$2	# add old carry limb to low product limb
-	dmultu	$8,$7
-	ld	$8,0($5)	# load new s1 limb as early as possible
-	daddiu	$6,$6,-1	# decrement loop counter
-	sltu	$2,$10,$2	# carry from previous addition -> $2
-	sd	$10,0($4)
-	daddiu	$4,$4,8
-	bne	$6,$0,L(Loop)
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 1
-L(LC1):	mflo	$10
-	mfhi	$9
-	daddu	$10,$10,$2
-	sltu	$2,$10,$2
-	dmultu	$8,$7
-	sd	$10,0($4)
-	daddiu	$4,$4,8
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 0
-L(LC0):	mflo	$10
-	mfhi	$9
-	daddu	$10,$10,$2
-	sltu	$2,$10,$2
-	sd	$10,0($4)
-	j	$31
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
-	.end	__mpn_mul_1
diff --git a/sysdeps/mips/mips64/n32/Implies b/sysdeps/mips/mips64/n32/Implies
deleted file mode 100644
index a7cb280ec4..0000000000
--- a/sysdeps/mips/mips64/n32/Implies
+++ /dev/null
@@ -1,4 +0,0 @@
-ieee754/ldbl-128
-mips/mips64
-mips
-wordsize-32
diff --git a/sysdeps/mips/mips64/n32/Makefile b/sysdeps/mips/mips64/n32/Makefile
deleted file mode 100644
index a84d2a51bd..0000000000
--- a/sysdeps/mips/mips64/n32/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# `long double' is a distinct type we support.
-long-double-fcts = yes
-
-ifeq ($(filter -mabi=n32,$(CC)),)
-CC += -mabi=n32
-endif
diff --git a/sysdeps/mips/mips64/n64/Implies b/sysdeps/mips/mips64/n64/Implies
deleted file mode 100644
index e507786789..0000000000
--- a/sysdeps/mips/mips64/n64/Implies
+++ /dev/null
@@ -1,4 +0,0 @@
-ieee754/ldbl-128
-mips/mips64
-mips
-wordsize-64
diff --git a/sysdeps/mips/mips64/n64/Makefile b/sysdeps/mips/mips64/n64/Makefile
deleted file mode 100644
index a823f32b53..0000000000
--- a/sysdeps/mips/mips64/n64/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# `long double' is a distinct type we support.
-long-double-fcts = yes
-
-ifeq ($(filter -mabi=64,$(CC)),)
-CC += -mabi=64
-endif
diff --git a/sysdeps/mips/mips64/rshift.S b/sysdeps/mips/mips64/rshift.S
deleted file mode 100644
index e6a8a06d3d..0000000000
--- a/sysdeps/mips/mips64/rshift.S
+++ /dev/null
@@ -1,102 +0,0 @@
-/* MIPS3 __mpn_rshift --
- *
- * Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
- *
- * This file is part of the GNU MP Library.
- *
- * The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/* INPUT PARAMETERS
- * res_ptr	$4
- * src_ptr	$5
- * size		$6
- * cnt		$7
- */
-
-#ifdef __PIC__
-	.option pic2
-#endif
-	.text
-	.align	2
-	.globl	__mpn_rshift
-	.ent	__mpn_rshift
-__mpn_rshift:
-#ifdef __PIC__
-	SETUP_GP /* ??? unused */
-#endif
-	.set	noreorder
-	.set	nomacro
-
-	ld	$10,0($5)	# load first limb
-	dsubu	$13,$0,$7
-	daddiu	$6,$6,-1
-	and	$9,$6,4-1	# number of limbs in first loop
-	beq	$9,$0,L(L0)	# if multiple of 4 limbs, skip first loop
-	dsll	$2,$10,$13	# compute function result
-
-	dsubu	$6,$6,$9
-
-L(Loop0):	ld	$3,8($5)
-	daddiu	$4,$4,8
-	daddiu	$5,$5,8
-	daddiu	$9,$9,-1
-	dsrl	$11,$10,$7
-	dsll	$12,$3,$13
-	move	$10,$3
-	or	$8,$11,$12
-	bne	$9,$0,L(Loop0)
-	sd	$8,-8($4)
-
-L(L0):	beq	$6,$0,L(Lend)
-	nop
-
-L(Loop):	ld	$3,8($5)
-	daddiu	$4,$4,32
-	daddiu	$6,$6,-4
-	dsrl	$11,$10,$7
-	dsll	$12,$3,$13
-
-	ld	$10,16($5)
-	dsrl	$14,$3,$7
-	or	$8,$11,$12
-	sd	$8,-32($4)
-	dsll	$9,$10,$13
-
-	ld	$3,24($5)
-	dsrl	$11,$10,$7
-	or	$8,$14,$9
-	sd	$8,-24($4)
-	dsll	$12,$3,$13
-
-	ld	$10,32($5)
-	dsrl	$14,$3,$7
-	or	$8,$11,$12
-	sd	$8,-16($4)
-	dsll	$9,$10,$13
-
-	daddiu	$5,$5,32
-	or	$8,$14,$9
-	bgtz	$6,L(Loop)
-	sd	$8,-8($4)
-
-L(Lend):	dsrl	$8,$10,$7
-	j	$31
-	sd	$8,0($4)
-	.end	__mpn_rshift
diff --git a/sysdeps/mips/mips64/setjmp.S b/sysdeps/mips/mips64/setjmp.S
deleted file mode 100644
index bdfd9cd51c..0000000000
--- a/sysdeps/mips/mips64/setjmp.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sgidefs.h>
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/* The function __sigsetjmp_aux saves all the registers, but it can't
-   reliably access the stack or frame pointers, so we pass them in as
-   extra arguments.  */
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__sigsetjmp)
-#ifdef __PIC__
-	SETUP_GP
-#endif
-	SETUP_GP64 (v0, C_SYMBOL_NAME (__sigsetjmp))
-	move a2, sp
-	move a3, fp
-	PTR_LA t9, __sigsetjmp_aux
-#if _MIPS_SIM == _ABIO32
-	nop
-#endif	
-	RESTORE_GP64
-#if _MIPS_SIM != _ABIO32
-	move a4, gp
-#endif
-	jr t9
-	.end __sigsetjmp
diff --git a/sysdeps/mips/mips64/setjmp_aux.c b/sysdeps/mips/mips64/setjmp_aux.c
deleted file mode 100644
index 26b4739c32..0000000000
--- a/sysdeps/mips/mips64/setjmp_aux.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 1996, 1997, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-#include <sgidefs.h>
-
-/* This function is only called via the assembly language routine
-   __sigsetjmp, which arranges to pass in the stack pointer and the frame
-   pointer.  We do things this way because it's difficult to reliably
-   access them in C.  */
-
-int
-__sigsetjmp_aux (jmp_buf env, int savemask, long long sp, long long fp,
-		 long long gp)
-{
-  /* Store the floating point callee-saved registers...  */
-#if _MIPS_SIM == _ABI64
-  asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0]));
-  asm volatile ("s.d $f25, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1]));
-  asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2]));
-  asm volatile ("s.d $f27, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[3]));
-  asm volatile ("s.d $f28, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[4]));
-  asm volatile ("s.d $f29, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[5]));
-  asm volatile ("s.d $f30, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[6]));
-  asm volatile ("s.d $f31, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[7]));
-#else
-  asm volatile ("s.d $f20, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0]));
-  asm volatile ("s.d $f22, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1]));
-  asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2]));
-  asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[3]));
-  asm volatile ("s.d $f28, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[4]));
-  asm volatile ("s.d $f30, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[5]));
-#endif
-
-  /* .. and the PC;  */
-  asm volatile ("sd $31, %0" : : "m" (env[0].__jmpbuf[0].__pc));
-
-  /* .. and the stack pointer;  */
-  env[0].__jmpbuf[0].__sp = sp;
-
-  /* .. and the FP; it'll be in s8. */
-  env[0].__jmpbuf[0].__fp = fp;
-
-  /* .. and the GP; */
-  env[0].__jmpbuf[0].__gp = gp;
-
-  /* .. and the callee-saved registers; */
-  asm volatile ("sd $16, %0" : : "m" (env[0].__jmpbuf[0].__regs[0]));
-  asm volatile ("sd $17, %0" : : "m" (env[0].__jmpbuf[0].__regs[1]));
-  asm volatile ("sd $18, %0" : : "m" (env[0].__jmpbuf[0].__regs[2]));
-  asm volatile ("sd $19, %0" : : "m" (env[0].__jmpbuf[0].__regs[3]));
-  asm volatile ("sd $20, %0" : : "m" (env[0].__jmpbuf[0].__regs[4]));
-  asm volatile ("sd $21, %0" : : "m" (env[0].__jmpbuf[0].__regs[5]));
-  asm volatile ("sd $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6]));
-  asm volatile ("sd $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7]));
-
-  /* .. and finally get and reconstruct the floating point csr.  */
-  asm ("cfc1 %0, $31" : "=r" (env[0].__jmpbuf[0].__fpc_csr));
-
-  /* Save the signal mask if requested.  */
-  return __sigjmp_save (env, savemask);
-}
diff --git a/sysdeps/mips/mips64/soft-fp/Dist b/sysdeps/mips/mips64/soft-fp/Dist
deleted file mode 100644
index 7e9914fe58..0000000000
--- a/sysdeps/mips/mips64/soft-fp/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sfp-machine.h
diff --git a/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/sysdeps/mips/mips64/soft-fp/sfp-machine.h
deleted file mode 100644
index 309a14a5f8..0000000000
--- a/sysdeps/mips/mips64/soft-fp/sfp-machine.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#define _FP_W_TYPE_SIZE		64
-#define _FP_W_TYPE		unsigned long long
-#define _FP_WS_TYPE		signed long long
-#define _FP_I_TYPE		long long
-
-#define _FP_MUL_MEAT_S(R,X,Y)					\
-  _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y)
-#define _FP_MUL_MEAT_D(R,X,Y)					\
-  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
-#define _FP_MUL_MEAT_Q(R,X,Y)					\
-  _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
-
-#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
-#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
-#define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_2_udiv(Q,R,X,Y)
-
-#define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
-#define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1)
-#define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1
-#define _FP_NANSIGN_S		0
-#define _FP_NANSIGN_D		0
-#define _FP_NANSIGN_Q		0
-
-#define _FP_KEEPNANFRACP 1
-/* From my experiments it seems X is chosen unless one of the
-   NaNs is sNaN,  in which case the result is NANSIGN/NANFRAC.  */
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
-  do {								\
-    if ((_FP_FRAC_HIGH_RAW_##fs(X) |				\
-	 _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs)		\
-      {								\
-	R##_s = _FP_NANSIGN_##fs;				\
-        _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs);			\
-      }								\
-    else							\
-      {								\
-	R##_s = X##_s;						\
-        _FP_FRAC_COPY_##wc(R,X);				\
-      }								\
-    R##_c = FP_CLS_NAN;						\
-  } while (0)
-
-#define FP_EX_INVALID           (1 << 4)
-#define FP_EX_DIVZERO           (1 << 3)
-#define FP_EX_OVERFLOW          (1 << 2)
-#define FP_EX_UNDERFLOW         (1 << 1)
-#define FP_EX_INEXACT           (1 << 0)
diff --git a/sysdeps/mips/mips64/sub_n.S b/sysdeps/mips/mips64/sub_n.S
deleted file mode 100644
index aa8b0dcf9a..0000000000
--- a/sysdeps/mips/mips64/sub_n.S
+++ /dev/null
@@ -1,130 +0,0 @@
-/* MIPS3 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
- * store difference in a third limb vector.
- *
- * Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
- *
- * This file is part of the GNU MP Library.
- *
- * The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/* INPUT PARAMETERS
- * res_ptr	$4
- * s1_ptr	$5
- * s2_ptr	$6
- * size		$7
- */
-
-#ifdef __PIC__
-	.option pic2
-#endif
-	.text
-	.align	2
-	.globl	__mpn_sub_n
-	.ent	__mpn_sub_n
-__mpn_sub_n:
-#ifdef __PIC__
-	SETUP_GP /* ??? unused */
-#endif
-	.set	noreorder
-	.set	nomacro
-
-	ld	$10,0($5)
-	ld	$11,0($6)
-
-	daddiu	$7,$7,-1
-	and	$9,$7,4-1	# number of limbs in first loop
-	beq	$9,$0,L(L0)	# if multiple of 4 limbs, skip first loop
-	move	$2,$0
-
-	dsubu	$7,$7,$9
-
-L(Loop0):	daddiu	$9,$9,-1
-	ld	$12,8($5)
-	daddu	$11,$11,$2
-	ld	$13,8($6)
-	sltu	$8,$11,$2
-	dsubu	$11,$10,$11
-	sltu	$2,$10,$11
-	sd	$11,0($4)
-	or	$2,$2,$8
-
-	daddiu	$5,$5,8
-	daddiu	$6,$6,8
-	move	$10,$12
-	move	$11,$13
-	bne	$9,$0,L(Loop0)
-	daddiu	$4,$4,8
-
-L(L0):	beq	$7,$0,L(Lend)
-	nop
-
-L(Loop):	daddiu	$7,$7,-4
-
-	ld	$12,8($5)
-	daddu	$11,$11,$2
-	ld	$13,8($6)
-	sltu	$8,$11,$2
-	dsubu	$11,$10,$11
-	sltu	$2,$10,$11
-	sd	$11,0($4)
-	or	$2,$2,$8
-
-	ld	$10,16($5)
-	daddu	$13,$13,$2
-	ld	$11,16($6)
-	sltu	$8,$13,$2
-	dsubu	$13,$12,$13
-	sltu	$2,$12,$13
-	sd	$13,8($4)
-	or	$2,$2,$8
-
-	ld	$12,24($5)
-	daddu	$11,$11,$2
-	ld	$13,24($6)
-	sltu	$8,$11,$2
-	dsubu	$11,$10,$11
-	sltu	$2,$10,$11
-	sd	$11,16($4)
-	or	$2,$2,$8
-
-	ld	$10,32($5)
-	daddu	$13,$13,$2
-	ld	$11,32($6)
-	sltu	$8,$13,$2
-	dsubu	$13,$12,$13
-	sltu	$2,$12,$13
-	sd	$13,24($4)
-	or	$2,$2,$8
-
-	daddiu	$5,$5,32
-	daddiu	$6,$6,32
-
-	bne	$7,$0,L(Loop)
-	daddiu	$4,$4,32
-
-L(Lend):	daddu	$11,$11,$2
-	sltu	$8,$11,$2
-	dsubu	$11,$10,$11
-	sltu	$2,$10,$11
-	sd	$11,0($4)
-	j	$31
-	or	$2,$2,$8
-
-	.end	__mpn_sub_n
diff --git a/sysdeps/mips/mips64/submul_1.S b/sysdeps/mips/mips64/submul_1.S
deleted file mode 100644
index 4971b992a1..0000000000
--- a/sysdeps/mips/mips64/submul_1.S
+++ /dev/null
@@ -1,108 +0,0 @@
-/* MIPS3 __mpn_submul_1 -- Multiply a limb vector with a single limb and
- * subtract the product from a second limb vector.
- *
- * Copyright (C) 1992, 1994, 1995, 2000, 2002, 2003
- * Free Software Foundation, Inc.
- *
- * This file is part of the GNU MP Library.
- *
- * The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-/* INPUT PARAMETERS
- * res_ptr	$4
- * s1_ptr	$5
- * size		$6
- * s2_limb	$7
- */
-
-#ifdef __PIC__
-	.option pic2
-#endif
-	.text
-	.align	4
-	.globl	__mpn_submul_1
-	.ent	__mpn_submul_1
-__mpn_submul_1:
-#ifdef __PIC__
-	SETUP_GP /* ??? unused */
-#endif
-	.set    noreorder
-	.set    nomacro
-
- # warm up phase 0
-	ld	$8,0($5)
-
- # warm up phase 1
-	daddiu	$5,$5,8
-	dmultu	$8,$7
-
-	daddiu	$6,$6,-1
-	beq	$6,$0,L(LC0)
-	move	$2,$0		# zero cy2
-
-	daddiu	$6,$6,-1
-	beq	$6,$0,L(LC1)
-	ld	$8,0($5)	# load new s1 limb as early as possible
-
-L(Loop):	ld	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	daddiu	$5,$5,8
-	daddu	$3,$3,$2	# add old carry limb to low product limb
-	dmultu	$8,$7
-	ld	$8,0($5)	# load new s1 limb as early as possible
-	daddiu	$6,$6,-1	# decrement loop counter
-	sltu	$2,$3,$2	# carry from previous addition -> $2
-	dsubu	$3,$10,$3
-	sgtu	$10,$3,$10
-	daddu	$2,$2,$10
-	sd	$3,0($4)
-	daddiu	$4,$4,8
-	bne	$6,$0,L(Loop)
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 1
-L(LC1):	ld	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	daddu	$3,$3,$2
-	sltu	$2,$3,$2
-	dmultu	$8,$7
-	dsubu	$3,$10,$3
-	sgtu	$10,$3,$10
-	daddu	$2,$2,$10
-	sd	$3,0($4)
-	daddiu	$4,$4,8
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
- # cool down phase 0
-L(LC0):	ld	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	daddu	$3,$3,$2
-	sltu	$2,$3,$2
-	dsubu	$3,$10,$3
-	sgtu	$10,$3,$10
-	daddu	$2,$2,$10
-	sd	$3,0($4)
-	j	$31
-	daddu	$2,$9,$2	# add high product limb and carry from addition
-
-	.end	__mpn_submul_1
diff --git a/sysdeps/mips/mul_1.S b/sysdeps/mips/mul_1.S
deleted file mode 100644
index 72f538670c..0000000000
--- a/sysdeps/mips/mul_1.S
+++ /dev/null
@@ -1,87 +0,0 @@
-/* MIPS __mpn_mul_1 -- Multiply a limb vector with a single limb and
-store the product in a second limb vector.
-
-Copyright (C) 1995, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.  */
-
-#include <sysdep.h>
-
-/* INPUT PARAMETERS
-   res_ptr	$4
-   s1_ptr	$5
-   size		$6
-   s2_limb	$7
-*/
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__mpn_mul_1)
-	.set    noreorder
-#ifdef __PIC__
-	.cpload t9
-#endif
-	.set    nomacro
-
-	/* warm up phase 0 */
-	lw	$8,0($5)
-
-	/* warm up phase 1 */
-	addiu	$5,$5,4
-	multu	$8,$7
-
-	addiu	$6,$6,-1
-	beq	$6,$0,L(LC0)
-	move	$2,$0		/* zero cy2 */
-
-	addiu	$6,$6,-1
-	beq	$6,$0,L(LC1)
-	lw	$8,0($5)	/* load new s1 limb as early as possible */
-
-L(Loop):	mflo	$10
-	mfhi	$9
-	addiu	$5,$5,4
-	addu	$10,$10,$2	/* add old carry limb to low product limb */
-	multu	$8,$7
-	lw	$8,0($5)	/* load new s1 limb as early as possible */
-	addiu	$6,$6,-1	/* decrement loop counter */
-	sltu	$2,$10,$2	/* carry from previous addition -> $2 */
-	sw	$10,0($4)
-	addiu	$4,$4,4
-	bne	$6,$0,L(Loop)	/* should be "bnel" */
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-
-	/* cool down phase 1 */
-L(LC1):	mflo	$10
-	mfhi	$9
-	addu	$10,$10,$2
-	sltu	$2,$10,$2
-	multu	$8,$7
-	sw	$10,0($4)
-	addiu	$4,$4,4
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-
-	/* cool down phase 0 */
-L(LC0):	mflo	$10
-	mfhi	$9
-	addu	$10,$10,$2
-	sltu	$2,$10,$2
-	sw	$10,0($4)
-	j	$31
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-	END (__mpn_mul_1)
diff --git a/sysdeps/mips/regdef.h b/sysdeps/mips/regdef.h
deleted file mode 100644
index bc7f13b4b5..0000000000
--- a/sysdeps/mips/regdef.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _REGDEF_H
-#define _REGDEF_H
-
-#include <sys/regdef.h>
-#include <sys/fpregdef.h>
-
-#endif /* _REGDEF_H */
-
diff --git a/sysdeps/mips/rshift.S b/sysdeps/mips/rshift.S
deleted file mode 100644
index cb688fe2ac..0000000000
--- a/sysdeps/mips/rshift.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/* MIPS2 __mpn_rshift --
-
-Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.  */
-
-#include <sysdep.h>
-
-/* INPUT PARAMETERS
-   res_ptr	$4
-   src_ptr	$5
-   size		$6
-   cnt		$7
-*/
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__mpn_rshift)
-	.set	noreorder
-#ifdef __PIC__
-	.cpload t9
-#endif
-	.set	nomacro
-
-	lw	$10,0($5)	/* load first limb */
-	subu	$13,$0,$7
-	addiu	$6,$6,-1
-	and	$9,$6,4-1	/* number of limbs in first loop */
-	beq	$9,$0,L(L0)	/* if multiple of 4 limbs, skip first loop*/
-	 sll	$2,$10,$13	/* compute function result */
-
-	subu	$6,$6,$9
-
-L(Loop0):	lw	$3,4($5)
-	addiu	$4,$4,4
-	addiu	$5,$5,4
-	addiu	$9,$9,-1
-	srl	$11,$10,$7
-	sll	$12,$3,$13
-	move	$10,$3
-	or	$8,$11,$12
-	bne	$9,$0,L(Loop0)
-	 sw	$8,-4($4)
-
-L(L0):	beq	$6,$0,L(Lend)
-	 nop
-
-L(Loop):	lw	$3,4($5)
-	addiu	$4,$4,16
-	addiu	$6,$6,-4
-	srl	$11,$10,$7
-	sll	$12,$3,$13
-
-	lw	$10,8($5)
-	srl	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,-16($4)
-	sll	$9,$10,$13
-
-	lw	$3,12($5)
-	srl	$11,$10,$7
-	or	$8,$14,$9
-	sw	$8,-12($4)
-	sll	$12,$3,$13
-
-	lw	$10,16($5)
-	srl	$14,$3,$7
-	or	$8,$11,$12
-	sw	$8,-8($4)
-	sll	$9,$10,$13
-
-	addiu	$5,$5,16
-	or	$8,$14,$9
-	bgtz	$6,L(Loop)
-	 sw	$8,-4($4)
-
-L(Lend):	srl	$8,$10,$7
-	j	$31
-	sw	$8,0($4)
-	END (__mpn_rshift)
diff --git a/sysdeps/mips/setjmp.S b/sysdeps/mips/setjmp.S
deleted file mode 100644
index 01ef313995..0000000000
--- a/sysdeps/mips/setjmp.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* The function __sigsetjmp_aux saves all the registers, but it can't
-   reliably access the stack or frame pointers, so we pass them in as
-   extra arguments.  */
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__sigsetjmp)
-#ifdef __PIC__
-	.set	noreorder
-	.cpload	t9
-	.set	reorder
-#endif
-	move	a2, sp
-#ifdef fp
-	move	a3, fp
-#else
-	move	a3, $fp
-#endif
-#ifdef __PIC__
-	la	t9, __sigsetjmp_aux
-	jr	t9
-#else
-	j	__sigsetjmp_aux
-#endif
-	.end __sigsetjmp
diff --git a/sysdeps/mips/setjmp_aux.c b/sysdeps/mips/setjmp_aux.c
deleted file mode 100644
index 7125cc4f81..0000000000
--- a/sysdeps/mips/setjmp_aux.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <setjmp.h>
-
-/* This function is only called via the assembly language routine
-   __sigsetjmp, which arranges to pass in the stack pointer and the frame
-   pointer.  We do things this way because it's difficult to reliably
-   access them in C.  */
-
-int
-__sigsetjmp_aux (jmp_buf env, int savemask, int sp, int fp)
-{
-  /* Store the floating point callee-saved registers...  */
-  asm volatile ("s.d $f20, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[0]));
-  asm volatile ("s.d $f22, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[1]));
-  asm volatile ("s.d $f24, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[2]));
-  asm volatile ("s.d $f26, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[3]));
-  asm volatile ("s.d $f28, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[4]));
-  asm volatile ("s.d $f30, %0" : : "m" (env[0].__jmpbuf[0].__fpregs[5]));
-
-  /* .. and the PC;  */
-  asm volatile ("sw $31, %0" : : "m" (env[0].__jmpbuf[0].__pc));
-
-  /* .. and the stack pointer;  */
-  env[0].__jmpbuf[0].__sp = (void *) sp;
-
-  /* .. and the FP; it'll be in s8. */
-  env[0].__jmpbuf[0].__fp = (void *) fp;
-
-  /* .. and the GP; */
-  asm volatile ("sw $gp, %0" : : "m" (env[0].__jmpbuf[0].__gp));
-
-  /* .. and the callee-saved registers; */
-  asm volatile ("sw $16, %0" : : "m" (env[0].__jmpbuf[0].__regs[0]));
-  asm volatile ("sw $17, %0" : : "m" (env[0].__jmpbuf[0].__regs[1]));
-  asm volatile ("sw $18, %0" : : "m" (env[0].__jmpbuf[0].__regs[2]));
-  asm volatile ("sw $19, %0" : : "m" (env[0].__jmpbuf[0].__regs[3]));
-  asm volatile ("sw $20, %0" : : "m" (env[0].__jmpbuf[0].__regs[4]));
-  asm volatile ("sw $21, %0" : : "m" (env[0].__jmpbuf[0].__regs[5]));
-  asm volatile ("sw $22, %0" : : "m" (env[0].__jmpbuf[0].__regs[6]));
-  asm volatile ("sw $23, %0" : : "m" (env[0].__jmpbuf[0].__regs[7]));
-
-  /* .. and finally get and reconstruct the floating point csr.  */
-  asm ("cfc1 %0, $31" : "=r" (env[0].__jmpbuf[0].__fpc_csr));
-
-  /* Save the signal mask if requested.  */
-  return __sigjmp_save (env, savemask);
-}
diff --git a/sysdeps/mips/sgidefs.h b/sysdeps/mips/sgidefs.h
deleted file mode 100644
index 74509fdbd0..0000000000
--- a/sysdeps/mips/sgidefs.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SGIDEFS_H
-#define _SGIDEFS_H	1
-
-/*
- * A crude hack to stop <asm/sgidefs.h>
- */
-#undef __ASM_SGIDEFS_H
-#define __ASM_SGIDEFS_H
-
-/*
- * And remove any damage it might have already done
- */
-#undef _MIPS_ISA_MIPS1
-#undef _MIPS_ISA_MIPS2
-#undef _MIPS_ISA_MIPS3
-#undef _MIPS_ISA_MIPS4
-#undef _MIPS_ISA_MIPS5
-#undef _MIPS_ISA_MIPS32
-#undef _MIPS_ISA_MIPS64
-
-#undef _MIPS_SIM_ABI32
-#undef _MIPS_SIM_NABI32
-#undef _MIPS_SIM_ABI64
-
-/*
- * Definitions for the ISA level
- */
-#define _MIPS_ISA_MIPS1 1
-#define _MIPS_ISA_MIPS2 2
-#define _MIPS_ISA_MIPS3 3
-#define _MIPS_ISA_MIPS4 4
-#define _MIPS_ISA_MIPS5 5
-#define _MIPS_ISA_MIPS32 6
-#define _MIPS_ISA_MIPS64 7
-
-/*
- * Subprogram calling convention
- */
-#ifndef _ABIO32
-# define _ABIO32		1
-#endif
-#define _MIPS_SIM_ABI32		_ABIO32
-
-#ifndef _ABIN32
-# define _ABIN32		2
-#endif
-#define _MIPS_SIM_NABI32	_ABIN32
-
-#ifndef _ABI64
-# define _ABI64			3
-#endif
-#define _MIPS_SIM_ABI64		_ABI64
-
-#endif /* sgidefs.h */
diff --git a/sysdeps/mips/soft-fp/Dist b/sysdeps/mips/soft-fp/Dist
deleted file mode 100644
index 7e9914fe58..0000000000
--- a/sysdeps/mips/soft-fp/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sfp-machine.h
diff --git a/sysdeps/mips/soft-fp/sfp-machine.h b/sysdeps/mips/soft-fp/sfp-machine.h
deleted file mode 100644
index 3b2a40f0e2..0000000000
--- a/sysdeps/mips/soft-fp/sfp-machine.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#define _FP_W_TYPE_SIZE		32
-#define _FP_W_TYPE		unsigned long
-#define _FP_WS_TYPE		signed long
-#define _FP_I_TYPE		long
-
-#define _FP_MUL_MEAT_S(R,X,Y)				\
-  _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
-#define _FP_MUL_MEAT_D(R,X,Y)				\
-  _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
-#define _FP_MUL_MEAT_Q(R,X,Y)				\
-  _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
-
-#define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_udiv_norm(S,R,X,Y)
-#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_2_udiv(D,R,X,Y)
-#define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_4_udiv(Q,R,X,Y)
-
-#define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
-#define _FP_NANFRAC_D		((_FP_QNANBIT_D << 1) - 1), -1
-#define _FP_NANFRAC_Q		((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
-#define _FP_NANSIGN_S		0
-#define _FP_NANSIGN_D		0
-#define _FP_NANSIGN_Q		0
-
-#define _FP_KEEPNANFRACP 1
-/* From my experiments it seems X is chosen unless one of the
-   NaNs is sNaN,  in which case the result is NANSIGN/NANFRAC.  */
-#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
-  do {								\
-    if ((_FP_FRAC_HIGH_RAW_##fs(X) |				\
-	 _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs)		\
-      {								\
-	R##_s = _FP_NANSIGN_##fs;				\
-        _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs);			\
-      }								\
-    else							\
-      {								\
-	R##_s = X##_s;						\
-        _FP_FRAC_COPY_##wc(R,X);				\
-      }								\
-    R##_c = FP_CLS_NAN;						\
-  } while (0)
-
-#define FP_EX_INVALID           (1 << 4)
-#define FP_EX_DIVZERO           (1 << 3)
-#define FP_EX_OVERFLOW          (1 << 2)
-#define FP_EX_UNDERFLOW         (1 << 1)
-#define FP_EX_INEXACT           (1 << 0)
diff --git a/sysdeps/mips/stackinfo.h b/sysdeps/mips/stackinfo.h
deleted file mode 100644
index 86e3d621ba..0000000000
--- a/sysdeps/mips/stackinfo.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This file contains a bit of information about the stack allocation
-   of the processor.  */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H	1
-
-/* On MIPS the stack grows down.  */
-#define _STACK_GROWS_DOWN	1
-
-#endif	/* stackinfo.h */
diff --git a/sysdeps/mips/sub_n.S b/sysdeps/mips/sub_n.S
deleted file mode 100644
index 53fa019343..0000000000
--- a/sysdeps/mips/sub_n.S
+++ /dev/null
@@ -1,122 +0,0 @@
-/* MIPS2 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-store difference in a third limb vector.
-
-Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.  */
-
-#include <sysdep.h>
-
-/* INPUT PARAMETERS
-   res_ptr	$4
-   s1_ptr	$5
-   s2_ptr	$6
-   size		$7
-*/
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__mpn_sub_n)
-	.set	noreorder
-#ifdef __PIC__
-	.cpload t9
-#endif
-	.set	nomacro
-
-	lw	$10,0($5)
-	lw	$11,0($6)
-
-	addiu	$7,$7,-1
-	and	$9,$7,4-1	/* number of limbs in first loop */
-	beq	$9,$0,L(L0)	/* if multiple of 4 limbs, skip first loop */
-	move	$2,$0
-
-	subu	$7,$7,$9
-
-L(Loop0):	addiu	$9,$9,-1
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,4
-	addiu	$6,$6,4
-	move	$10,$12
-	move	$11,$13
-	bne	$9,$0,L(Loop0)
-	addiu	$4,$4,4
-
-L(L0):	beq	$7,$0,L(Lend)
-	nop
-
-L(Loop):	addiu	$7,$7,-4
-
-	lw	$12,4($5)
-	addu	$11,$11,$2
-	lw	$13,4($6)
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,0($4)
-	or	$2,$2,$8
-
-	lw	$10,8($5)
-	addu	$13,$13,$2
-	lw	$11,8($6)
-	sltu	$8,$13,$2
-	subu	$13,$12,$13
-	sltu	$2,$12,$13
-	sw	$13,4($4)
-	or	$2,$2,$8
-
-	lw	$12,12($5)
-	addu	$11,$11,$2
-	lw	$13,12($6)
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,8($4)
-	or	$2,$2,$8
-
-	lw	$10,16($5)
-	addu	$13,$13,$2
-	lw	$11,16($6)
-	sltu	$8,$13,$2
-	subu	$13,$12,$13
-	sltu	$2,$12,$13
-	sw	$13,12($4)
-	or	$2,$2,$8
-
-	addiu	$5,$5,16
-	addiu	$6,$6,16
-
-	bne	$7,$0,L(Loop)
-	addiu	$4,$4,16
-
-L(Lend):	addu	$11,$11,$2
-	sltu	$8,$11,$2
-	subu	$11,$10,$11
-	sltu	$2,$10,$11
-	sw	$11,0($4)
-	j	$31
-	or	$2,$2,$8
-	END (__mpn_sub_n)
diff --git a/sysdeps/mips/submul_1.S b/sysdeps/mips/submul_1.S
deleted file mode 100644
index 4c8a612650..0000000000
--- a/sysdeps/mips/submul_1.S
+++ /dev/null
@@ -1,99 +0,0 @@
-/* MIPS __mpn_submul_1 -- Multiply a limb vector with a single limb and
-subtract the product from a second limb vector.
-
-Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-MA 02111-1307, USA.  */
-
-#include <sysdep.h>
-
-/* INPUT PARAMETERS
-   res_ptr	$4
-   s1_ptr	$5
-   size		$6
-   s2_limb	$7
-*/
-#ifdef __PIC__
-	.option pic2
-#endif
-ENTRY (__mpn_submul_1)
-	.set    noreorder
-#ifdef __PIC__
-	.cpload t9
-#endif
-	.set    nomacro
-
-	/* warm up phase 0 */
-	lw	$8,0($5)
-
-	/* warm up phase 1 */
-	addiu	$5,$5,4
-	multu	$8,$7
-
-	addiu	$6,$6,-1
-	beq	$6,$0,L(LC0)
-	move	$2,$0		/* zero cy2 */
-
-	addiu	$6,$6,-1
-	beq	$6,$0,L(LC1)
-	lw	$8,0($5)	/* load new s1 limb as early as possible */
-
-L(Loop):	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addiu	$5,$5,4
-	addu	$3,$3,$2	/* add old carry limb to low product limb */
-	multu	$8,$7
-	lw	$8,0($5)	/* load new s1 limb as early as possible */
-	addiu	$6,$6,-1	/* decrement loop counter */
-	sltu	$2,$3,$2	/* carry from previous addition -> $2 */
-	subu	$3,$10,$3
-	sgtu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	bne	$6,$0,L(Loop)	/* should be "bnel" */
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-
-	/* cool down phase 1 */
-L(LC1):	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	multu	$8,$7
-	subu	$3,$10,$3
-	sgtu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	addiu	$4,$4,4
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-
-	/* cool down phase 0 */
-L(LC0):	lw	$10,0($4)
-	mflo	$3
-	mfhi	$9
-	addu	$3,$3,$2
-	sltu	$2,$3,$2
-	subu	$3,$10,$3
-	sgtu	$10,$3,$10
-	addu	$2,$2,$10
-	sw	$3,0($4)
-	j	$31
-	addu	$2,$9,$2	/* add high product limb and carry from addition */
-	END (__mpn_submul_1)
diff --git a/sysdeps/mips/sys/asm.h b/sysdeps/mips/sys/asm.h
deleted file mode 100644
index b04c36ba5e..0000000000
--- a/sysdeps/mips/sys/asm.h
+++ /dev/null
@@ -1,473 +0,0 @@
-/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_ASM_H
-#define _SYS_ASM_H
-
-#include <sgidefs.h>
-
-#ifndef CAT
-# ifdef __STDC__
-#  define __CAT(str1,str2) str1##str2
-# else
-#  define __CAT(str1,str2) str1/**/str2
-# endif
-# define CAT(str1,str2) __CAT(str1,str2)
-#endif
-
-/*
- * Macros to handle different pointer/register sizes for 32/64-bit code
- *
- * 64 bit address space isn't used yet, so we may use the R3000 32 bit
- * defines for now.
- */
-#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32
-# define PTR .word
-# define PTRSIZE 4
-# define PTRLOG 2
-#elif _MIPS_SIM == _ABI64
-# define PTR .dword
-# define PTRSIZE 8
-# define PTRLOG 3
-#endif
-
-/*
- * PIC specific declarations
- */
-#if _MIPS_SIM == _ABIO32
-# ifdef __PIC__
-#  define CPRESTORE(register) \
-		.cprestore register
-#  define CPLOAD(register) \
-		.cpload register
-# else
-#  define CPRESTORE(register)
-#  define CPLOAD(register)
-# endif
-
-# define CPADD(register) \
-		.cpadd	register
-
-/*
- * Set gp when at 1st instruction
- */
-# define SETUP_GP					\
-		.set noreorder;				\
-		.cpload $25;				\
-		.set reorder
-/* Set gp when not at 1st instruction */
-# define SETUP_GPX(r)					\
-		.set noreorder;				\
-		move r, $31;	 /* Save old ra.  */	\
-		bal 10f; /* Find addr of cpload.  */	\
-		nop;					\
-10:							\
-		.cpload $31;				\
-		move $31, r;				\
-		.set reorder
-# define SETUP_GPX_L(r, l)				\
-		.set noreorder;				\
-		move r, $31;	 /* Save old ra.  */	\
-		bal l;   /* Find addr of cpload.  */	\
-		nop;					\
-l:							\
-		.cpload $31;				\
-		move $31, r;				\
-		.set reorder
-# define SAVE_GP(x) \
-		.cprestore x /* Save gp trigger t9/jalr conversion.	 */
-# define SETUP_GP64(a, b)
-# define SETUP_GPX64(a, b)
-# define SETUP_GPX64_L(cp_reg, ra_save, l)
-# define RESTORE_GP64
-# define USE_ALT_CP(a)
-#else /* _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 */
-/*
- * For callee-saved gp calling convention:
- */
-# define SETUP_GP
-# define SETUP_GPX(r)
-# define SETUP_GPX_L(r, l)
-# define SAVE_GP(x)
-
-# define SETUP_GP64(gpoffset, proc) \
-		.cpsetup $25, gpoffset, proc
-# define SETUP_GPX64(cp_reg, ra_save)			\
-		move ra_save, $31; /* Save old ra.  */	\
-		.set noreorder;				\
-		bal 10f; /* Find addr of .cpsetup.  */	\
-		nop;					\
-10:							\
-		.set reorder;				\
-		.cpsetup $31, cp_reg, 10b;		\
-		move $31, ra_save
-# define SETUP_GPX64_L(cp_reg, ra_save, l)  \
-		move ra_save, $31; /* Save old ra.  */	\
-		.set noreorder;				\
-		bal l;   /* Find addr of .cpsetup.  */	\
-		nop;					\
-l:							\
-		.set reorder;				\
-		.cpsetup $31, cp_reg, l;		\
-		move $31, ra_save
-# define RESTORE_GP64 \
-		.cpreturn
-/* Use alternate register for context pointer.  */
-# define USE_ALT_CP(reg)	\
-		.cplocal reg
-#endif /* _MIPS_SIM != _ABIO32 */
-
-/*
- * Stack Frame Definitions
- */
-#if _MIPS_SIM == _ABIO32
-# define NARGSAVE 4 /* Space for 4 argument registers must be allocated.  */
-#endif
-#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
-# define NARGSAVE 0 /* No caller responsibilities.  */
-#endif
-
-
-/*
- * LEAF - declare leaf routine
- */
-#define	LEAF(symbol)                                    \
-		.globl	symbol;                         \
-		.align	2;                              \
-		.type	symbol,@function;               \
-		.ent	symbol,0;                       \
-symbol:		.frame	sp,0,ra
-
-/*
- * NESTED - declare nested routine entry point
- */
-#define	NESTED(symbol, framesize, rpc)                  \
-		.globl	symbol;                         \
-		.align	2;                              \
-		.type	symbol,@function;               \
-		.ent	symbol,0;                       \
-symbol:		.frame	sp, framesize, rpc
-
-/*
- * END - mark end of function
- */
-#ifndef END
-# define END(function)                                   \
-		.end	function;		        \
-		.size	function,.-function
-#endif
-
-/*
- * EXPORT - export definition of symbol
- */
-#define	EXPORT(symbol)                                  \
-		.globl	symbol;                         \
-symbol:
-
-/*
- * ABS - export absolute symbol
- */
-#define	ABS(symbol,value)                               \
-		.globl	symbol;                         \
-symbol		=	value
-
-#define	PANIC(msg)                                      \
-		.set	push;				\
-		.set	reorder;                        \
-		la	a0,8f;                          \
-		jal	panic;                          \
-9:		b	9b;                             \
-		.set	pop;				\
-		TEXT(msg)
-
-/*
- * Print formated string
- */
-#define PRINT(string)                                   \
-		.set	push;				\
-		.set	reorder;                        \
-		la	a0,8f;                          \
-		jal	printk;                         \
-		.set	pop;				\
-		TEXT(string)
-
-#define	TEXT(msg)                                       \
-		.data;                                  \
-8:		.asciiz	msg;                            \
-		.previous;
-
-/*
- * Build text tables
- */
-#define TTABLE(string)                                  \
-		.text;                                  \
-		.word	1f;                             \
-		.previous;                              \
-		.data;                                  \
-1:		.asciz	string;                         \
-		.previous
-
-/*
- * MIPS IV pref instruction.
- * Use with .set noreorder only!
- *
- * MIPS IV implementations are free to treat this as a nop.  The R5000
- * is one of them.  So we should have an option not to use this instruction.
- */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
-    (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
-# define PREF(hint,addr)                                 \
-		pref	hint,addr
-# define PREFX(hint,addr)                                \
-		prefx	hint,addr
-#else
-# define PREF
-# define PREFX
-#endif
-
-/*
- * MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs.
- */
-#if _MIPS_ISA == _MIPS_ISA_MIPS1
-# define MOVN(rd,rs,rt)					\
-		.set	push;				\
-		.set	reorder;			\
-		beqz	rt,9f;				\
-		move	rd,rs;				\
-		.set	pop;				\
-9:
-# define MOVZ(rd,rs,rt)					\
-		.set	push;				\
-		.set	reorder;			\
-		bnez	rt,9f;				\
-		move	rd,rt;				\
-		.set	pop;				\
-9:
-#endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3)
-# define MOVN(rd,rs,rt)					\
-		.set	push;				\
-		.set	noreorder;			\
-		bnezl	rt,9f;				\
-		move	rd,rs;				\
-		.set	pop;				\
-9:
-# define MOVZ(rd,rs,rt)					\
-		.set	push;				\
-		.set	noreorder;			\
-		beqzl	rt,9f;				\
-		movz	rd,rs;				\
-		.set	pop;				\
-9:
-#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
-    (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
-# define MOVN(rd,rs,rt)					\
-		movn	rd,rs,rt
-# define MOVZ(rd,rs,rt)					\
-		movz	rd,rs,rt
-#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS4) || (_MIPS_ISA == _MIPS_ISA_MIPS5) */
-
-/*
- * Stack alignment
- */
-#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
-# define ALSZ	15
-# define ALMASK	~15
-#else
-# define ALSZ	7
-# define ALMASK	~7
-#endif
-
-/*
- * Size of a register
- */
-#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
-# define SZREG	8
-#else
-# define SZREG	4
-#endif
-
-/*
- * Use the following macros in assemblercode to load/store registers,
- * pointers etc.
- */
-#if (SZREG == 4)
-# define REG_S sw
-# define REG_L lw
-#else
-# define REG_S sd
-# define REG_L ld
-#endif
-
-/*
- * How to add/sub/load/store/shift C int variables.
- */
-#if (_MIPS_SZINT == 32)
-# define INT_ADD	add
-# define INT_ADDI	addi
-# define INT_ADDU	addu
-# define INT_ADDIU	addiu
-# define INT_SUB	add
-# define INT_SUBI	subi
-# define INT_SUBU	subu
-# define INT_SUBIU	subu
-# define INT_L		lw
-# define INT_S		sw
-#endif
-
-#if (_MIPS_SZINT == 64)
-# define INT_ADD	dadd
-# define INT_ADDI	daddi
-# define INT_ADDU	daddu
-# define INT_ADDIU	daddiu
-# define INT_SUB	dadd
-# define INT_SUBI	dsubi
-# define INT_SUBU	dsubu
-# define INT_SUBIU	dsubu
-# define INT_L		ld
-# define INT_S		sd
-#endif
-
-/*
- * How to add/sub/load/store/shift C long variables.
- */
-#if (_MIPS_SZLONG == 32)
-# define LONG_ADD	add
-# define LONG_ADDI	addi
-# define LONG_ADDU	addu
-# define LONG_ADDIU	addiu
-# define LONG_SUB	add
-# define LONG_SUBI	subi
-# define LONG_SUBU	subu
-# define LONG_SUBIU	subu
-# define LONG_L		lw
-# define LONG_S		sw
-# define LONG_SLL	sll
-# define LONG_SLLV	sllv
-# define LONG_SRL	srl
-# define LONG_SRLV	srlv
-# define LONG_SRA	sra
-# define LONG_SRAV	srav
-#endif
-
-#if (_MIPS_SZLONG == 64)
-# define LONG_ADD	dadd
-# define LONG_ADDI	daddi
-# define LONG_ADDU	daddu
-# define LONG_ADDIU	daddiu
-# define LONG_SUB	dadd
-# define LONG_SUBI	dsubi
-# define LONG_SUBU	dsubu
-# define LONG_SUBIU	dsubu
-# define LONG_L		ld
-# define LONG_S		sd
-# define LONG_SLL	dsll
-# define LONG_SLLV	dsllv
-# define LONG_SRL	dsrl
-# define LONG_SRLV	dsrlv
-# define LONG_SRA	dsra
-# define LONG_SRAV	dsrav
-#endif
-
-/*
- * How to add/sub/load/store/shift pointers.
- */
-#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 32)
-# define PTR_ADD	add
-# define PTR_ADDI	addi
-# define PTR_ADDU	addu
-# define PTR_ADDIU	addiu
-# define PTR_SUB	add
-# define PTR_SUBI	subi
-# define PTR_SUBU	subu
-# define PTR_SUBIU	subu
-# define PTR_L		lw
-# define PTR_LA		la
-# define PTR_S		sw
-# define PTR_SLL	sll
-# define PTR_SLLV	sllv
-# define PTR_SRL	srl
-# define PTR_SRLV	srlv
-# define PTR_SRA	sra
-# define PTR_SRAV	srav
-
-# define PTR_SCALESHIFT	2
-#endif
-
-#if _MIPS_SIM == _ABIN32
-# define PTR_ADD	add
-# define PTR_ADDI	addi
-# define PTR_ADDU	add /* no u */
-# define PTR_ADDIU	addi /* no u */
-# define PTR_SUB	add
-# define PTR_SUBI	subi
-# define PTR_SUBU	sub /* no u */
-# define PTR_SUBIU	sub /* no u */
-# define PTR_L		lw
-# define PTR_LA		la
-# define PTR_S		sw
-# define PTR_SLL	sll
-# define PTR_SLLV	sllv
-# define PTR_SRL	srl
-# define PTR_SRLV	srlv
-# define PTR_SRA	sra
-# define PTR_SRAV	srav
-
-# define PTR_SCALESHIFT	2
-#endif
-
-#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 64 /* o64??? */) \
-    || _MIPS_SIM == _ABI64
-# define PTR_ADD	dadd
-# define PTR_ADDI	daddi
-# define PTR_ADDU	daddu
-# define PTR_ADDIU	daddiu
-# define PTR_SUB	dadd
-# define PTR_SUBI	dsubi
-# define PTR_SUBU	dsubu
-# define PTR_SUBIU	dsubu
-# define PTR_L		ld
-# define PTR_LA		dla
-# define PTR_S		sd
-# define PTR_SLL	dsll
-# define PTR_SLLV	dsllv
-# define PTR_SRL	dsrl
-# define PTR_SRLV	dsrlv
-# define PTR_SRA	dsra
-# define PTR_SRAV	dsrav
-
-# define PTR_SCALESHIFT	3
-#endif
-
-/*
- * Some cp0 registers were extended to 64bit for MIPS III.
- */
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
-    (_MIPS_ISA == _MIPS_ISA_MIPS32)
-# define MFC0	mfc0
-# define MTC0	mtc0
-#endif
-#if (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
-    (_MIPS_ISA == _MIPS_ISA_MIPS5) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
-# define MFC0	dmfc0
-# define MTC0	dmtc0
-#endif
-
-#endif /* sys/asm.h */
diff --git a/sysdeps/mips/sys/fpregdef.h b/sysdeps/mips/sys/fpregdef.h
deleted file mode 100644
index 378115274f..0000000000
--- a/sysdeps/mips/sys/fpregdef.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_FPREGDEF_H
-#define _SYS_FPREGDEF_H
-
-/*
- * These definitions only cover the R3000-ish 16/32 register model.
- * But we're trying to be R3000 friendly anyway ...
- */
-#define fv0	$f0      /* return value */
-#define fv0f	$f1
-#define fv1	$f2
-#define fv1f	$f3
-#define fa0	$f12     /* argument registers */
-#define fa0f	$f13
-#define fa1	$f14
-#define fa1f	$f15
-#define ft0	$f4      /* caller saved */
-#define ft0f	$f5
-#define ft1	$f6
-#define ft1f	$f7
-#define ft2	$f8
-#define ft2f	$f9
-#define ft3	$f10
-#define ft3f	$f11
-#define ft4	$f16
-#define ft4f	$f17
-#define ft5	$f18
-#define ft5f	$f19
-#define fs0	$f20     /* callee saved */
-#define fs0f	$f21
-#define fs1	$f22
-#define fs1f	$f23
-#define fs2	$f24
-#define fs2f	$f25
-#define fs3	$f26
-#define fs3f	$f27
-#define fs4	$f28
-#define fs4f	$f29
-#define fs5	$f30
-#define fs5f	$f31
-
-#define fcr31	$31      /* FPU status register */
-
-#endif /* sys/fpregdef.h */
diff --git a/sysdeps/mips/sys/regdef.h b/sysdeps/mips/sys/regdef.h
deleted file mode 100644
index 8fb898a2d0..0000000000
--- a/sysdeps/mips/sys/regdef.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_REGDEF_H
-#define _SYS_REGDEF_H
-
-#include <sgidefs.h>
-
-/*
- * Symbolic register names for 32 bit ABI
- */
-#define zero    $0      /* wired zero */
-#define AT      $1      /* assembler temp  - uppercase because of ".set at" */
-#define v0      $2      /* return value */
-#define v1      $3
-#define a0      $4      /* argument registers */
-#define a1      $5
-#define a2      $6
-#define a3      $7
-#if _MIPS_SIM != _ABIO32
-#define a4      $8
-#define a5      $9
-#define a6      $10
-#define a7      $11
-#define t0      $12
-#define t1      $13
-#define t2      $14
-#define t3      $15
-#define ta0     a4
-#define ta1     a5
-#define ta2     a6
-#define ta3     a7
-#else /* if _MIPS_SIM == _ABIO32 */
-#define t0      $8      /* caller saved */
-#define t1      $9
-#define t2      $10
-#define t3      $11
-#define t4      $12
-#define t5      $13
-#define t6      $14
-#define t7      $15
-#define ta0     t4
-#define ta1     t5
-#define ta2     t6
-#define ta3     t7
-#endif /* _MIPS_SIM == _ABIO32 */
-#define s0      $16     /* callee saved */
-#define s1      $17
-#define s2      $18
-#define s3      $19
-#define s4      $20
-#define s5      $21
-#define s6      $22
-#define s7      $23
-#define t8      $24     /* caller saved */
-#define t9      $25
-#define jp      $25     /* PIC jump register */
-#define k0      $26     /* kernel scratch */
-#define k1      $27
-#define gp      $28     /* global pointer */
-#define sp      $29     /* stack pointer */
-#define fp      $30     /* frame pointer */
-#define s8	$30	/* same like fp! */
-#define ra      $31     /* return address */
-
-#endif /* _SYS_REGDEF_H */
diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/sys/ucontext.h
deleted file mode 100644
index fe378e94cd..0000000000
--- a/sysdeps/mips/sys/ucontext.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Copyright (C) 1998, 1999, 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* System V/mips ABI compliant context switching support.  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <sgidefs.h>
-#include <signal.h>
-
-/* Type for general register.  */
-#if _MIPS_SIM == _ABIO32
-typedef __uint32_t greg_t;
-#else
-typedef __uint64_t greg_t;
-#endif
-
-/* Number of general registers.  */
-#define NGREG	36
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NGREG];
-
-/* Number of each register is the `gregset_t' array.  */
-enum
-{
-  CTX_R0 = 0,
-#define CTX_R0	CTX_R0
-  CTX_AT = 1,
-#define CTX_AT	CTX_AT
-  CTX_V0 = 2,
-#define CTX_V0	CTX_V0
-  CTX_V1 = 3,
-#define CTX_V1	CTX_V1
-  CTX_A0 = 4,
-#define CTX_A0	CTX_A0
-  CTX_A1 = 5,
-#define CTX_A1	CTX_A1
-  CTX_A2 = 6,
-#define CTX_A2	CTX_A2
-  CTX_A3 = 7,
-#define CTX_A3	CTX_A3
-  CTX_T0 = 8,
-#define CTX_T0	CTX_T0
-  CTX_T1 = 9,
-#define CTX_T1	CTX_T1
-  CTX_T2 = 10,
-#define CTX_T2	CTX_T2
-  CTX_T3 = 11,
-#define CTX_T3	CTX_T3
-  CTX_T4 = 12,
-#define CTX_T4	CTX_T4
-  CTX_T5 = 13,
-#define CTX_T5	CTX_T5
-  CTX_T6 = 14,
-#define CTX_T6	CTX_T6
-  CTX_T7 = 15,
-#define CTX_T7	CTX_T7
-  CTX_S0 = 16,
-#define CTX_S0	CTX_S0
-  CTX_S1 = 17,
-#define CTX_S1	CTX_S1
-  CTX_S2 = 18,
-#define CTX_S2	CTX_S2
-  CTX_S3 = 19,
-#define CTX_S3	CTX_S3
-  CTX_S4 = 20,
-#define CTX_S4	CTX_S4
-  CTX_S5 = 21,
-#define CTX_S5	CTX_S5
-  CTX_S6 = 22,
-#define CTX_S6	CTX_S6
-  CTX_S7 = 23,
-#define CTX_S7	CTX_S7
-  CTX_T8 = 24,
-#define CTX_T8	CTX_T8
-  CTX_T9 = 25,
-#define CTX_T9	CTX_T9
-  CTX_K0 = 26,
-#define CTX_K0	CTX_K0
-  CTX_K1 = 27,
-#define CTX_K1	CTX_K1
-  CTX_GP = 28,
-#define CTX_GP	CTX_GP
-  CTX_SP = 29,
-#define CTX_SP	CTX_SP
-  CTX_S8 = 30,
-#define CTX_S8	CTX_S8
-  CTX_RA = 31,
-#define CTX_RA	CTX_RA
-  CTX_MDLO = 32,
-#define CTX_MDLO	CTX_MDLO
-  CTX_MDHI = 33,
-#define CTX_MDHI	CTX_MDHI
-  CTX_CAUSE = 34,
-#define CTX_CAUSE	CTX_CAUSE
-  CTX_EPC = 35,
-#define CTX_EPC	CTX_EPC
-};
-
-/* Structure to describe FPU registers.  */
-typedef struct fpregset
-{
-  union
-  {
-#if _MIPS_SIM == _ABIO32
-    double fp_dregs[16];
-    float fp_fregs[32];
-    unsigned int fp_regs[32];
-#else
-    double fp_dregs[32];
-    /* float fp_fregs[32]; */
-    __uint64_t fp_regs[32];
-#endif
-  } fp_r;
-  unsigned int fp_csr;
-  unsigned int fp_pad;
-} fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct
-{
-  gregset_t gpregs;
-  fpregset_t fpregs;
-} mcontext_t;
-
-/* Userlevel context.  */
-typedef struct ucontext
-{
-#if _MIPS_SIM == _ABIO32
-  unsigned long int uc_flags;
-#else
-  __uint64_t uc_flags;
-#endif
-  struct ucontext *uc_link;
-  __sigset_t uc_sigmask;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  int uc_filler[48];
-} ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/posix/Makefile b/sysdeps/posix/Makefile
new file mode 100644
index 0000000000..b58aa6aadb
--- /dev/null
+++ b/sysdeps/posix/Makefile
@@ -0,0 +1,5 @@
+# These affect the generated bits/stdio_lim.h file.
+L_tmpnam  = 20
+TMP_MAX   = 238328
+L_ctermid = 9
+L_cuserid = 9
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index a2d466607e..f4dc21f8af 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+/* clock_getres -- Get the resolution of a POSIX clockid_t.
+   Copyright (C) 1999, 2000, 2001, 2003, 2004 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
@@ -24,11 +25,55 @@
 #include <libc-internal.h>
 
 
-#if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
-/* Clock frequency of the processor.  */
-static long int nsec;
+#if HP_TIMING_AVAIL
+static long int nsec;		/* Clock frequency of the processor.  */
+
+static inline int
+hp_timing_getres (struct timespec *res)
+{
+  if (__builtin_expect (nsec == 0, 0))
+    {
+      hp_timing_t freq;
+
+      /* This can only happen if we haven't initialized the `nsec'
+	 variable yet.  Do this now.  We don't have to protect this
+	 code against multiple execution since all of them should
+	 lead to the same result.  */
+      freq = __get_clockfreq ();
+      if (__builtin_expect (freq == 0, 0))
+	/* Something went wrong.  */
+	return -1;
+
+      nsec = MAX (UINT64_C (1000000000) / freq, 1);
+    }
+
+  /* Fill in the values.
+     The seconds are always zero (unless we have a 1Hz machine).  */
+  res->tv_sec = 0;
+  res->tv_nsec = nsec;
+
+  return 0;
+}
 #endif
 
+static inline int
+realtime_getres (struct timespec *res)
+{
+  long int clk_tck = sysconf (_SC_CLK_TCK);
+
+  if (__builtin_expect (clk_tck != -1, 1))
+    {
+      /* This implementation assumes that the realtime clock has a
+	 resolution higher than 1 second.  This is the case for any
+	 reasonable implementation.  */
+      res->tv_sec = 0;
+      res->tv_nsec = 1000000000 / clk_tck;
+      return 0;
+    }
+
+  return -1;
+}
+
 
 /* Get resolution of clock.  */
 int
@@ -38,69 +83,33 @@ clock_getres (clockid_t clock_id, struct timespec *res)
 
   switch (clock_id)
     {
-#define HANDLE_REALTIME \
-      do {								      \
-	long int clk_tck = sysconf (_SC_CLK_TCK);			      \
-									      \
-	if (__builtin_expect (clk_tck != -1, 1))			      \
-	  {								      \
-	    /* This implementation assumes that the realtime clock has a      \
-	       resolution higher than 1 second.  This is the case for any     \
-	       reasonable implementation.  */				      \
-	    res->tv_sec = 0;						      \
-	    res->tv_nsec = 1000000000 / clk_tck;			      \
-									      \
-	    retval = 0;							      \
-	  }								      \
-      } while (0)
-
 #ifdef SYSDEP_GETRES
       SYSDEP_GETRES;
 #endif
 
 #ifndef HANDLED_REALTIME
     case CLOCK_REALTIME:
-      HANDLE_REALTIME;
+      retval = realtime_getres (res);
       break;
 #endif	/* handled REALTIME */
 
     default:
+#ifdef SYSDEP_GETRES_CPU
+      SYSDEP_GETRES_CPU;
+#endif
 #if HP_TIMING_AVAIL
       if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
-	  != CLOCK_THREAD_CPUTIME_ID)
+	  == CLOCK_THREAD_CPUTIME_ID)
+	retval = hp_timing_getres (res);
+      else
 #endif
-	{
-	  __set_errno (EINVAL);
-	  break;
-	}
+	__set_errno (EINVAL);
+      break;
 
 #if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
-      /* FALLTHROUGH.  */
     case CLOCK_PROCESS_CPUTIME_ID:
-      {
-	if (__builtin_expect (nsec == 0, 0))
-	  {
-	    hp_timing_t freq;
-
-	    /* This can only happen if we haven't initialized the `freq'
-	       variable yet.  Do this now. We don't have to protect this
-	       code against multiple execution since all of them should
-	       lead to the same result.  */
-	    freq = __get_clockfreq ();
-	    if (__builtin_expect (freq == 0, 0))
-	      /* Something went wrong.  */
-	      break;
-
-	    nsec = MAX (UINT64_C (1000000000) / freq, 1);
-	  }
-
-	/* File in the values.  The seconds are always zero (unless we
-	   have a 1Hz machine).  */
-	res->tv_sec = 0;
-	res->tv_nsec = nsec;
-
-	retval = 0;
-      }
+    case CLOCK_THREAD_CPUTIME_ID:
+      retval = hp_timing_getres (res);
       break;
 #endif
     }
diff --git a/sysdeps/posix/euidaccess.c b/sysdeps/posix/euidaccess.c
index 8a2d826e95..333870cdde 100644
--- a/sysdeps/posix/euidaccess.c
+++ b/sysdeps/posix/euidaccess.c
@@ -1,5 +1,5 @@
 /* Check if effective user id can access file
-   Copyright (C) 1990,91,95,96,97,98,99,2000,01 Free Software Foundation, Inc.
+   Copyright (C) 1990,1991,1995-2001,2005,2007 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
@@ -21,26 +21,26 @@
    Adapted for GNU C library by Roland McGrath.  */
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
 #endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #ifdef S_IEXEC
-#ifndef S_IXUSR
-#define S_IXUSR S_IEXEC
-#endif
-#ifndef S_IXGRP
-#define S_IXGRP (S_IEXEC >> 3)
-#endif
-#ifndef S_IXOTH
-#define S_IXOTH (S_IEXEC >> 6)
-#endif
+# ifndef S_IXUSR
+#  define S_IXUSR S_IEXEC
+# endif
+# ifndef S_IXGRP
+#  define S_IXGRP (S_IEXEC >> 3)
+# endif
+# ifndef S_IXOTH
+#  define S_IXOTH (S_IEXEC >> 6)
+# endif
 #endif /* S_IEXEC */
 
-#if defined (HAVE_UNISTD_H) || defined (_LIBC)
-#include <unistd.h>
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
 #endif
 
 #ifndef _POSIX_VERSION
@@ -55,35 +55,35 @@ gid_t getegid ();
 extern int errno;
 #endif
 #ifndef __set_errno
-#define __set_errno(val) errno = (val)
+# define __set_errno(val) errno = (val)
 #endif
 
-#if defined(EACCES) && !defined(EACCESS)
-#define EACCESS EACCES
+#if defined EACCES && !defined EACCESS
+# define EACCESS EACCES
 #endif
 
 #ifndef F_OK
-#define F_OK 0
-#define X_OK 1
-#define W_OK 2
-#define R_OK 4
+# define F_OK 0
+# define X_OK 1
+# define W_OK 2
+# define R_OK 4
 #endif
 
-#if !defined (S_IROTH) && defined (R_OK)
+#if !defined S_IROTH && defined R_OK
 # define S_IROTH R_OK
 #endif
-#if !defined (S_IWOTH) && defined (W_OK)
+#if !defined S_IWOTH && defined W_OK
 # define S_IWOTH W_OK
 #endif
-#if !defined (S_IXOTH) && defined (X_OK)
+#if !defined S_IXOTH && defined X_OK
 # define S_IXOTH X_OK
 #endif
 
 
 #ifdef _LIBC
 
-#define group_member __group_member
-#define euidaccess __euidaccess
+# define group_member __group_member
+# define euidaccess __euidaccess
 
 #else
 
@@ -93,14 +93,6 @@ static uid_t uid;
 /* The user's real group id. */
 static gid_t gid;
 
-#ifdef HAVE_GETGROUPS
-int group_member ();
-#else
-#define group_member(gid)	0
-#endif
-
-#endif
-
 /* The user's effective user id. */
 static uid_t euid;
 
@@ -110,6 +102,14 @@ static gid_t egid;
 /* Nonzero if UID, GID, EUID, and EGID have valid values. */
 static int have_ids;
 
+# ifdef HAVE_GETGROUPS
+int group_member ();
+# else
+#  define group_member(gid)	0
+# endif
+
+#endif
+
 
 /* Return 0 if the user has permission of type MODE on file PATH;
    otherwise, return -1 and set `errno' to EACCESS.
@@ -126,9 +126,8 @@ euidaccess (path, mode)
   int granted;
 
 #ifdef	_LIBC
-  if (! __libc_enable_secure)
-    /* If we are not set-uid or set-gid, access does the same.  */
-    return __access (path, mode);
+  uid_t euid;
+  gid_t egid;
 #else
   if (have_ids == 0)
     {
@@ -157,12 +156,12 @@ euidaccess (path, mode)
 
 #ifdef	_LIBC
   /* Now we need the IDs.  */
-  if (have_ids == 0)
-    {
-      have_ids = 1;
-      euid = __geteuid ();
-      egid = __getegid ();
-    }
+  euid = __geteuid ();
+  egid = __getegid ();
+
+  if (__getuid () == euid && __getgid () == egid)
+    /* If we are not set-uid or set-gid, access does the same.  */
+    return __access (path, mode);
 #endif
 
   /* The super-user can read and write any file, and execute any file
@@ -172,25 +171,28 @@ euidaccess (path, mode)
     return 0;
 
   if (euid == stats.st_uid)
-    granted = (unsigned) (stats.st_mode & (mode << 6)) >> 6;
+    granted = (unsigned int) (stats.st_mode & (mode << 6)) >> 6;
   else if (egid == stats.st_gid || group_member (stats.st_gid))
-    granted = (unsigned) (stats.st_mode & (mode << 3)) >> 3;
+    granted = (unsigned int) (stats.st_mode & (mode << 3)) >> 3;
   else
     granted = (stats.st_mode & mode);
+  /* XXX Add support for ACLs.  */
   if (granted == mode)
     return 0;
   __set_errno (EACCESS);
   return -1;
 }
 #undef euidaccess
+#undef eaccess
 #ifdef weak_alias
 weak_alias (__euidaccess, euidaccess)
+weak_alias (__euidaccess, eaccess)
 #endif
 
 #ifdef TEST
-#include <stdio.h>
-#include <errno.h>
-#include "error.h"
+# include <stdio.h>
+# include <errno.h>
+# include "error.h"
 
 char *program_name;
 
diff --git a/sysdeps/posix/gai_strerror-strs.h b/sysdeps/posix/gai_strerror-strs.h
new file mode 100644
index 0000000000..19040a5138
--- /dev/null
+++ b/sysdeps/posix/gai_strerror-strs.h
@@ -0,0 +1,17 @@
+_S(EAI_ADDRFAMILY, N_("Address family for hostname not supported"))
+_S(EAI_AGAIN, N_("Temporary failure in name resolution"))
+_S(EAI_BADFLAGS, N_("Bad value for ai_flags"))
+_S(EAI_FAIL, N_("Non-recoverable failure in name resolution"))
+_S(EAI_FAMILY, N_("ai_family not supported"))
+_S(EAI_MEMORY, N_("Memory allocation failure"))
+_S(EAI_NODATA, N_("No address associated with hostname"))
+_S(EAI_NONAME, N_("Name or service not known"))
+_S(EAI_SERVICE, N_("Servname not supported for ai_socktype"))
+_S(EAI_SOCKTYPE, N_("ai_socktype not supported"))
+_S(EAI_SYSTEM, N_("System error"))
+_S(EAI_INPROGRESS, N_("Processing request in progress"))
+_S(EAI_CANCELED, N_("Request canceled"))
+_S(EAI_NOTCANCELED, N_("Request not canceled"))
+_S(EAI_ALLDONE, N_("All requests done"))
+_S(EAI_INTR, N_("Interrupted by a signal"))
+_S(EAI_IDN_ENCODE, N_("Parameter string not correctly encoded"))
diff --git a/sysdeps/posix/gai_strerror.c b/sysdeps/posix/gai_strerror.c
index e2835a5674..cc13dd4dab 100644
--- a/sysdeps/posix/gai_strerror.c
+++ b/sysdeps/posix/gai_strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
 
@@ -17,44 +17,54 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <stdio.h>
-#include <netdb.h>
 #include <libintl.h>
+#include <netdb.h>
+#include <stdint.h>
+#include <stdio.h>
+
 
-static struct
+#define MSGSTRFIELD(line) MSGSTRFIELD1 (line)
+#define MSGSTRFIELD1(line) str##line
+static const union msgstr_t
+{
+  struct
   {
-    int code;
-    const char *msg;
-  }
-values[] =
+#define _S(n, s) char MSGSTRFIELD(__LINE__)[sizeof (s)];
+#include "gai_strerror-strs.h"
+#undef _S
+  };
+  char str[0];
+} msgstr =
   {
-    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
-    { EAI_AGAIN, N_("Temporary failure in name resolution") },
-    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
-    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
-    { EAI_FAMILY, N_("ai_family not supported") },
-    { EAI_MEMORY, N_("Memory allocation failure") },
-    { EAI_NODATA, N_("No address associated with hostname") },
-    { EAI_NONAME, N_("Name or service not known") },
-    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
-    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
-    { EAI_SYSTEM, N_("System error") },
-    { EAI_INPROGRESS, N_("Processing request in progress") },
-    { EAI_CANCELED, N_("Request canceled") },
-    { EAI_NOTCANCELED, N_("Request not canceled") },
-    { EAI_ALLDONE, N_("All requests done") },
-    { EAI_INTR, N_("Interrupted by a signal") },
-    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
+    {
+#define _S(n, s) s,
+#include "gai_strerror-strs.h"
+#undef _S
+    }
   };
+static const struct
+{
+  int16_t code;
+  uint16_t idx;
+} msgidx[] =
+  {
+#define _S(n, s) { n, offsetof (union msgstr_t, MSGSTRFIELD (__LINE__)) },
+#include "gai_strerror-strs.h"
+#undef _S
+  };
+
 
 const char *
 gai_strerror (int code)
 {
-  size_t i;
-  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
-    if (values[i].code == code)
-      return _(values[i].msg);
+  const char *result = "Unknown error";
+  for (size_t i = 0; i < sizeof (msgidx) / sizeof (msgidx[0]); ++i)
+    if (msgidx[i].code == code)
+      {
+	result = msgstr.str + msgidx[i].idx;
+	break;
+      }
 
-  return _("Unknown error");
+  return _(result);
 }
 libc_hidden_def (gai_strerror)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index c9081345ab..a7e1459c9c 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -36,23 +36,27 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* This software is Copyright 1996 by Craig Metz, All Rights Reserved.  */
 
 #include <assert.h>
+#include <ctype.h>
 #include <errno.h>
 #include <ifaddrs.h>
 #include <netdb.h>
 #include <resolv.h>
 #include <stdbool.h>
 #include <stdio.h>
+#include <stdio_ext.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <arpa/inet.h>
-#include <sys/socket.h>
+#include <net/if.h>
 #include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/un.h>
 #include <sys/utsname.h>
-#include <net/if.h>
+#include <unistd.h>
 #include <nsswitch.h>
+#include <bits/libc-lock.h>
 #include <not-cancel.h>
 #include <nscd/nscd-client.h>
 #include <nscd/nscd_proto.h>
@@ -68,7 +72,7 @@ extern int __idna_to_unicode_lzlz (const char *input, char **output,
 #define GAIH_EAI        ~(GAIH_OKIFUNSPEC)
 
 #ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX  108
+# define UNIX_PATH_MAX  108
 #endif
 
 struct gaih_service
@@ -121,7 +125,8 @@ struct gaih
   {
     int family;
     int (*gaih)(const char *name, const struct gaih_service *service,
-		const struct addrinfo *req, struct addrinfo **pai);
+		const struct addrinfo *req, struct addrinfo **pai,
+		unsigned int *naddrs);
   };
 
 static const struct addrinfo default_hints =
@@ -176,9 +181,9 @@ gaih_local (const char *name, const struct gaih_service *service,
       if (! tp->name[0])
 	{
 	  if (req->ai_socktype)
-	    return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);
+	    return GAIH_OKIFUNSPEC | -EAI_SOCKTYPE;
 	  else
-	    return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+	    return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 	}
     }
 
@@ -196,10 +201,10 @@ gaih_local (const char *name, const struct gaih_service *service,
   (*pai)->ai_addrlen = sizeof (struct sockaddr_un);
   (*pai)->ai_addr = (void *) (*pai) + sizeof (struct addrinfo);
 
-#if SALEN
+#ifdef _HAVE_SA_LEN
   ((struct sockaddr_un *) (*pai)->ai_addr)->sun_len =
     sizeof (struct sockaddr_un);
-#endif /* SALEN */
+#endif /* _HAVE_SA_LEN */
 
   ((struct sockaddr_un *)(*pai)->ai_addr)->sun_family = AF_LOCAL;
   memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX);
@@ -248,9 +253,10 @@ gaih_local (const char *name, const struct gaih_service *service,
 }
 #endif	/* 0 */
 
+
 static int
 gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
-	       const struct addrinfo *req, struct gaih_servtuple *st)
+		const struct addrinfo *req, struct gaih_servtuple *st)
 {
   struct servent *s;
   size_t tmpbuflen = 1024;
@@ -361,9 +367,11 @@ typedef enum nss_status (*nss_getcanonname_r)
    int *errnop, int *h_errnop);
 extern service_user *__nss_hosts_database attribute_hidden;
 
+
 static int
 gaih_inet (const char *name, const struct gaih_service *service,
-	   const struct addrinfo *req, struct addrinfo **pai)
+	   const struct addrinfo *req, struct addrinfo **pai,
+	   unsigned int *naddrs)
 {
   const struct gaih_typeproto *tp = gaih_inet_typeproto;
   struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
@@ -387,16 +395,17 @@ gaih_inet (const char *name, const struct gaih_service *service,
       if (! tp->name[0])
 	{
 	  if (req->ai_socktype)
-	    return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);
+	    return GAIH_OKIFUNSPEC | -EAI_SOCKTYPE;
 	  else
-	    return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+	    return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 	}
     }
 
+  int port = 0;
   if (service != NULL)
     {
       if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0)
-	return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+	return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 
       if (service->num < 0)
 	{
@@ -440,68 +449,46 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  pst = &(newp->next);
 		}
 	      if (st == (struct gaih_servtuple *) &nullserv)
-		return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
+		return GAIH_OKIFUNSPEC | -EAI_SERVICE;
 	    }
 	}
       else
 	{
-	  if (req->ai_socktype || req->ai_protocol)
-	    {
-	      st = __alloca (sizeof (struct gaih_servtuple));
-	      st->next = NULL;
-	      st->socktype = tp->socktype;
-	      st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
-			      ? req->ai_protocol : tp->protocol);
-	      st->port = htons (service->num);
-	    }
-	  else
-	    {
-	      /* Neither socket type nor protocol is set.  Return all
-		 socket types we know about.  */
-	      struct gaih_servtuple **lastp = &st;
-	      for (tp = gaih_inet_typeproto + 1; tp->name[0]; ++tp)
-		if ((tp->protoflag & GAI_PROTO_NOSERVICE) == 0)
-		  {
-		    struct gaih_servtuple *newp;
-
-		    newp = __alloca (sizeof (struct gaih_servtuple));
-		    newp->next = NULL;
-		    newp->socktype = tp->socktype;
-		    newp->protocol = tp->protocol;
-		    newp->port = htons (service->num);
-
-		    *lastp = newp;
-		    lastp = &newp->next;
-		  }
-	    }
+	  port = htons (service->num);
+	  goto got_port;
 	}
     }
-  else if (req->ai_socktype || req->ai_protocol)
-    {
-      st = __alloca (sizeof (struct gaih_servtuple));
-      st->next = NULL;
-      st->socktype = tp->socktype;
-      st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
-		      ? req->ai_protocol : tp->protocol);
-      st->port = 0;
-    }
   else
     {
-      /* Neither socket type nor protocol is set.  Return all socket types
-	 we know about.  */
-      struct gaih_servtuple **lastp = &st;
-      for (++tp; tp->name[0]; ++tp)
+    got_port:
+
+      if (req->ai_socktype || req->ai_protocol)
+	{
+	  st = __alloca (sizeof (struct gaih_servtuple));
+	  st->next = NULL;
+	  st->socktype = tp->socktype;
+	  st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
+			  ? req->ai_protocol : tp->protocol);
+	  st->port = port;
+	}
+      else
 	{
-	  struct gaih_servtuple *newp;
+	  /* Neither socket type nor protocol is set.  Return all socket types
+	     we know about.  */
+	  struct gaih_servtuple **lastp = &st;
+	  for (++tp; tp->name[0]; ++tp)
+	    {
+	      struct gaih_servtuple *newp;
 
-	  newp = __alloca (sizeof (struct gaih_servtuple));
-	  newp->next = NULL;
-	  newp->socktype = tp->socktype;
-	  newp->protocol = tp->protocol;
-	  newp->port = 0;
+	      newp = __alloca (sizeof (struct gaih_servtuple));
+	      newp->next = NULL;
+	      newp->socktype = tp->socktype;
+	      newp->protocol = tp->protocol;
+	      newp->port = port;
 
-	  *lastp = newp;
-	  lastp = &newp->next;
+	      *lastp = newp;
+	      lastp = &newp->next;
+	    }
 	}
     }
 
@@ -546,7 +533,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	{
 	  if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET)
 	    at->family = AF_INET;
-	  else if (req->ai_family == AF_INET6 && req->ai_flags & AI_V4MAPPED)
+	  else if (req->ai_family == AF_INET6 && (req->ai_flags & AI_V4MAPPED))
 	    {
 	      at->addr[3] = at->addr[0];
 	      at->addr[2] = htonl (0xffff);
@@ -557,23 +544,19 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  else
 	    return -EAI_ADDRFAMILY;
 
-	dupname:
 	  if (req->ai_flags & AI_CANONNAME)
-	    {
-	      canon = strdup (name);
-	      if (canon == NULL)
-		return -EAI_MEMORY;
-	    }
+	    canon = name;
 	}
-
-      if (at->family == AF_UNSPEC)
+      else if (at->family == AF_UNSPEC)
 	{
-	  char *namebuf = strdupa (name);
-	  char *scope_delim;
+	  char *namebuf = (char *) name;
+	  char *scope_delim = strchr (name, SCOPE_DELIMITER);
 
-	  scope_delim = strchr (namebuf, SCOPE_DELIMITER);
-	  if (scope_delim != NULL)
-	    *scope_delim = '\0';
+	  if (__builtin_expect (scope_delim != NULL, 0))
+	    {
+	      namebuf = alloca (scope_delim - name + 1);
+	      *((char *) __mempcpy (namebuf, name, scope_delim - name)) = '\0';
+	    }
 
 	  if (inet_pton (AF_INET6, namebuf, at->addr) > 0)
 	    {
@@ -612,7 +595,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		    }
 		}
 
-	      goto dupname;
+	      if (req->ai_flags & AI_CANONNAME)
+		canon = name;
 	    }
 	}
 
@@ -629,7 +613,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
 	  /* If we do not have to look for IPv4 and IPv6 together, use
 	     the simple, old functions.  */
-	  if (req->ai_family == AF_INET || req->ai_family == AF_INET6)
+	  if (req->ai_family == AF_INET
+	      || (req->ai_family == AF_INET6
+		  && ((req->ai_flags & AI_V4MAPPED) == 0
+		      || (req->ai_flags & AI_ALL) == 0)))
 	    {
 	      int family = req->ai_family;
 	      size_t tmpbuflen = 512;
@@ -680,7 +667,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 				    h->h_length);
 			  else
 			    {
-			      int32_t *addr = (uint32_t *) (*pat)->addr;
+			      uint32_t *addr = (uint32_t *) (*pat)->addr;
 			      addr[3] = *(uint32_t *) h->h_addr_list[i];
 			      addr[2] = htonl (0xffff);
 			      addr[1] = 0;
@@ -703,7 +690,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		    }
 		  /* We made requests but they turned out no data.
 		     The name is known, though.  */
-		  return (GAIH_OKIFUNSPEC | -EAI_NODATA);
+		  return GAIH_OKIFUNSPEC | -EAI_NODATA;
 		}
 
 	      goto process_list;
@@ -770,7 +757,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  free (air);
 
 		  if (at->family == AF_UNSPEC)
-		    return (GAIH_OKIFUNSPEC | -EAI_NONAME);
+		    return GAIH_OKIFUNSPEC | -EAI_NONAME;
 
 		  goto process_list;
 		}
@@ -888,8 +875,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		     AF_INET6.  Try to find a useful one for both.  */
 		  if (inet6_status == NSS_STATUS_TRYAGAIN)
 		    status = NSS_STATUS_TRYAGAIN;
-		  else if (status == NSS_STATUS_UNAVAIL &&
-			   inet6_status != NSS_STATUS_UNAVAIL)
+		  else if (status == NSS_STATUS_UNAVAIL
+			   && inet6_status != NSS_STATUS_UNAVAIL)
 		    status = inet6_status;
 		}
 
@@ -912,13 +899,13 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
 	      /* We made requests but they turned out no data.  The name
 		 is known, though.  */
-	      return (GAIH_OKIFUNSPEC | -EAI_NODATA);
+	      return GAIH_OKIFUNSPEC | -EAI_NODATA;
 	    }
 	}
 
     process_list:
       if (at->family == AF_UNSPEC)
-	return (GAIH_OKIFUNSPEC | -EAI_NONAME);
+	return GAIH_OKIFUNSPEC | -EAI_NONAME;
     }
   else
     {
@@ -1039,9 +1026,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	      }
 	  }
 
-	if (at2->family == AF_INET6)
+	family = at2->family;
+	if (family == AF_INET6)
 	  {
-	    family = AF_INET6;
 	    socklen = sizeof (struct sockaddr_in6);
 
 	    /* If we looked up IPv4 mapped address discard them here if
@@ -1053,17 +1040,17 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	      goto ignore;
 	  }
 	else
-	  {
-	    family = AF_INET;
-	    socklen = sizeof (struct sockaddr_in);
-	  }
+	  socklen = sizeof (struct sockaddr_in);
 
 	for (st2 = st; st2 != NULL; st2 = st2->next)
 	  {
 	    struct addrinfo *ai;
 	    ai = *pai = malloc (sizeof (struct addrinfo) + socklen);
 	    if (ai == NULL)
-	      return -EAI_MEMORY;
+	      {
+		free ((char *) canon);
+		return -EAI_MEMORY;
+	      }
 
 	    ai->ai_flags = req->ai_flags;
 	    ai->ai_family = family;
@@ -1076,11 +1063,15 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	    ai->ai_canonname = (char *) canon;
 	    canon = NULL;
 
-#if SALEN
+#ifdef _HAVE_SA_LEN
 	    ai->ai_addr->sa_len = socklen;
-#endif /* SALEN */
+#endif /* _HAVE_SA_LEN */
 	    ai->ai_addr->sa_family = family;
 
+	    /* In case of an allocation error the list must be NULL
+	       terminated.  */
+	    ai->ai_next = NULL;
+
 	    if (family == AF_INET6)
 	      {
 		struct sockaddr_in6 *sin6p =
@@ -1104,7 +1095,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
 	    pai = &(ai->ai_next);
 	  }
-	*pai = NULL;
+
+	++*naddrs;
 
       ignore:
 	at2 = at2->next;
@@ -1113,7 +1105,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
   return 0;
 }
 
-static struct gaih gaih[] =
+#if 0
+static const struct gaih gaih[] =
   {
     { PF_INET6, gaih_inet },
     { PF_INET, gaih_inet },
@@ -1122,6 +1115,7 @@ static struct gaih gaih[] =
 #endif
     { PF_UNSPEC, NULL }
   };
+#endif
 
 struct sort_result
 {
@@ -1129,6 +1123,7 @@ struct sort_result
   struct sockaddr_storage source_addr;
   uint8_t source_addr_len;
   bool got_source_addr;
+  uint8_t source_addr_flags;
 };
 
 
@@ -1162,7 +1157,7 @@ get_scope (const struct sockaddr_storage *ss)
 	 169.254/16 and 127/8 are link-local.  */
       if ((addr[0] == 169 && addr[1] == 254) || addr[0] == 127)
 	scope = 2;
-      else if (addr[0] == 10 || (addr[0] == 172 && addr[1] == 16)
+      else if (addr[0] == 10 || (addr[0] == 172 && (addr[1] & 0xf0) == 16)
 	       || (addr[0] == 192 && addr[1] == 168))
 	scope = 5;
       else
@@ -1176,59 +1171,96 @@ get_scope (const struct sockaddr_storage *ss)
 }
 
 
-/* XXX The system administrator should be able to install other
-   tables.  We need to make this configurable.  The problem is that
-   the kernel is also involved since it needs the same table.  */
-static const struct prefixlist
+struct prefixentry
 {
   struct in6_addr prefix;
   unsigned int bits;
   int val;
-} default_labels[] =
+};
+
+
+/* The label table.  */
+static const struct prefixentry *labels;
+
+/* Default labels.  */
+static const struct prefixentry default_labels[] =
   {
     /* See RFC 3484 for the details.  */
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0001 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } } },
       128, 0 },
-    { { .in6_u = { .u6_addr16 = { 0x2002, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0000 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       16, 2 },
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0000 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       96, 3 },
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0xffff, 0x0000, 0x0000 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
       96, 4 },
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0000 } } },
+    /* The next two entries differ from RFC 3484.  We need to treat
+       IPv6 site-local addresses special because they are never NATed,
+       unlike site-locale IPv4 addresses.  If this would not happen, on
+       machines which have only IPv4 and IPv6 site-local addresses, the
+       sorting would prefer the IPv6 site-local addresses, causing
+       unnecessary delays when trying to connect to a global IPv6 address
+       through a site-local IPv6 address.  */
+    { { .in6_u
+	= { .u6_addr8 = { 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+      10, 5 },
+    { { .in6_u
+	= { .u6_addr8 = { 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+      7, 6 },
+    { { .in6_u
+	= { .u6_addr8 = { 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+      32, 7 },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       0, 1 }
   };
 
 
-static const struct prefixlist default_precedence[] =
+/* The precedence table.  */
+static const struct prefixentry *precedence;
+
+/* The default precedences.  */
+static const struct prefixentry default_precedence[] =
   {
     /* See RFC 3484 for the details.  */
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0001 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } } },
       128, 50 },
-    { { .in6_u = { .u6_addr16 = { 0x2002, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0000 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       16, 30 },
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0000 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       96, 20 },
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0xffff, 0x0000, 0x0000 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
       96, 10 },
-    { { .in6_u = { .u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
-				  0x0000, 0x0000, 0x0000, 0x0000 } } },
+    { { .in6_u
+	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       0, 40 }
   };
 
 
 static int
-match_prefix (const struct sockaddr_storage *ss, const struct prefixlist *list,
-	      int default_val)
+match_prefix (const struct sockaddr_storage *ss,
+	      const struct prefixentry *list, int default_val)
 {
   int idx;
   struct sockaddr_in6 in6_mem;
@@ -1263,10 +1295,10 @@ match_prefix (const struct sockaddr_storage *ss, const struct prefixlist *list,
   for (idx = 0; ; ++idx)
     {
       unsigned int bits = list[idx].bits;
-      uint8_t *mask = list[idx].prefix.s6_addr;
-      uint8_t *val = in6->sin6_addr.s6_addr;
+      const uint8_t *mask = list[idx].prefix.s6_addr;
+      const uint8_t *val = in6->sin6_addr.s6_addr;
 
-      while (bits > 8)
+      while (bits >= 8)
 	{
 	  if (*mask != *val)
 	    break;
@@ -1292,7 +1324,7 @@ static int
 get_label (const struct sockaddr_storage *ss)
 {
   /* XXX What is a good default value?  */
-  return match_prefix (ss, default_labels, INT_MAX);
+  return match_prefix (ss, labels, INT_MAX);
 }
 
 
@@ -1300,7 +1332,20 @@ static int
 get_precedence (const struct sockaddr_storage *ss)
 {
   /* XXX What is a good default value?  */
-  return match_prefix (ss, default_precedence, 0);
+  return match_prefix (ss, precedence, 0);
+}
+
+
+/* Find last bit set in a word.  */
+static int
+fls (uint32_t a)
+{
+  uint32_t mask;
+  int n = 0;
+  for (n = 0, mask = 1 << 31; n < 32; mask >>= 1, ++n)
+    if ((a & mask) != 0)
+      break;
+  return n;
 }
 
 
@@ -1338,11 +1383,27 @@ rfc3484_sort (const void *p1, const void *p2)
     }
 
 
-  /* Rule 3: Avoid deprecated addresses.
-     That's something only the kernel could decide.  */
+  /* Rule 3: Avoid deprecated addresses.  */
+  if (a1->got_source_addr)
+    {
+      if (!(a1->source_addr_flags & in6ai_deprecated)
+	  && (a2->source_addr_flags & in6ai_deprecated))
+	return -1;
+      if ((a1->source_addr_flags & in6ai_deprecated)
+	  && !(a2->source_addr_flags & in6ai_deprecated))
+	return 1;
+    }
 
-  /* Rule 4: Prefer home addresses.
-     Another thing only the kernel can decide.  */
+  /* Rule 4: Prefer home addresses.  */
+  if (a1->got_source_addr)
+    {
+      if (!(a1->source_addr_flags & in6ai_homeaddress)
+	  && (a2->source_addr_flags & in6ai_homeaddress))
+	return 1;
+      if ((a1->source_addr_flags & in6ai_homeaddress)
+	  && !(a2->source_addr_flags & in6ai_homeaddress))
+	return -1;
+    }
 
   /* Rule 5: Prefer matching label.  */
   if (a1->got_source_addr)
@@ -1374,8 +1435,18 @@ rfc3484_sort (const void *p1, const void *p2)
     return 1;
 
 
-  /* Rule 7: Prefer native transport.
-     XXX How to recognize tunnels?  */
+  /* Rule 7: Prefer native transport.  */
+  if (a1->got_source_addr)
+    {
+      if (!(a1->source_addr_flags & in6ai_temporary)
+	  && (a2->source_addr_flags & in6ai_temporary))
+	return -1;
+      if ((a1->source_addr_flags & in6ai_temporary)
+	  && !(a2->source_addr_flags & in6ai_temporary))
+	return 1;
+
+      /* XXX Do we need to check anything beside temporary addresses?  */
+    }
 
 
   /* Rule 8: Prefer smaller scope.  */
@@ -1407,8 +1478,10 @@ rfc3484_sort (const void *p1, const void *p2)
 	  in2_dst = (struct sockaddr_in *) a2->dest_addr->ai_addr;
 	  in2_src = (struct sockaddr_in *) &a2->source_addr;
 
-	  bit1 = ffs (in1_dst->sin_addr.s_addr ^ in1_src->sin_addr.s_addr);
-	  bit2 = ffs (in2_dst->sin_addr.s_addr ^ in2_src->sin_addr.s_addr);
+	  bit1 = fls (ntohl (in1_dst->sin_addr.s_addr
+			     ^ in1_src->sin_addr.s_addr));
+	  bit2 = fls (ntohl (in2_dst->sin_addr.s_addr
+			     ^ in2_src->sin_addr.s_addr));
 	}
       else if (a1->dest_addr->ai_family == PF_INET6)
 	{
@@ -1435,10 +1508,10 @@ rfc3484_sort (const void *p1, const void *p2)
 
 	  if (i < 4)
 	    {
-	      bit1 = ffs (in1_dst->sin6_addr.s6_addr32[i]
-			  ^ in1_src->sin6_addr.s6_addr32[i]);
-	      bit2 = ffs (in2_dst->sin6_addr.s6_addr32[i]
-			  ^ in2_src->sin6_addr.s6_addr32[i]);
+	      bit1 = fls (ntohl (in1_dst->sin6_addr.s6_addr32[i]
+				 ^ in1_src->sin6_addr.s6_addr32[i]));
+	      bit2 = fls (ntohl (in2_dst->sin6_addr.s6_addr32[i]
+				 ^ in2_src->sin6_addr.s6_addr32[i]));
 	    }
 	}
 
@@ -1454,14 +1527,341 @@ rfc3484_sort (const void *p1, const void *p2)
 }
 
 
+static int
+in6aicmp (const void *p1, const void *p2)
+{
+  struct in6addrinfo *a1 = (struct in6addrinfo *) p1;
+  struct in6addrinfo *a2 = (struct in6addrinfo *) p2;
+
+  return memcmp (a1->addr, a2->addr, sizeof (a1->addr));
+}
+
+
+/* Name of the config file for RFC 3484 sorting (for now).  */
+#define GAICONF_FNAME "/etc/gai.conf"
+
+
+/* Nozero if we are supposed to reload the config file automatically
+   whenever it changed.  */
+static int gaiconf_reload_flag;
+
+/* Last modification time.  */
+static struct timespec gaiconf_mtime;
+
+
+libc_freeres_fn(fini)
+{
+  if (labels != default_labels)
+    {
+      const struct prefixentry *old = labels;
+      labels = default_labels;
+      free ((void *) old);
+    }
+
+  if (precedence != default_precedence)
+    {
+      const struct prefixentry *old = precedence;
+      precedence = default_precedence;
+      free ((void *) old);
+    }
+}
+
+
+struct prefixlist
+{
+  struct prefixentry entry;
+  struct prefixlist *next;
+};
+
+
+static void
+free_prefixlist (struct prefixlist *list)
+{
+  while (list != NULL)
+    {
+      struct prefixlist *oldp = list;
+      list = list->next;
+      free (oldp);
+    }
+}
+
+
+static int
+prefixcmp (const void *p1, const void *p2)
+{
+  const struct prefixentry *e1 = (const struct prefixentry *) p1;
+  const struct prefixentry *e2 = (const struct prefixentry *) p2;
+
+  if (e1->bits < e2->bits)
+    return 1;
+  if (e1->bits == e2->bits)
+    return 0;
+  return -1;
+}
+
+
+static void
+gaiconf_init (void)
+{
+  struct prefixlist *labellist = NULL;
+  size_t nlabellist = 0;
+  bool labellist_nullbits = false;
+  struct prefixlist *precedencelist = NULL;
+  size_t nprecedencelist = 0;
+  bool precedencelist_nullbits = false;
+
+  FILE *fp = fopen (GAICONF_FNAME, "rc");
+  if (fp != NULL)
+    {
+      struct stat64 st;
+      if (__fxstat64 (_STAT_VER, fileno (fp), &st) != 0)
+	{
+	  fclose (fp);
+	  goto no_file;
+	}
+
+      char *line = NULL;
+      size_t linelen = 0;
+
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+      while (!feof_unlocked (fp))
+	{
+	  ssize_t n = __getline (&line, &linelen, fp);
+	  if (n <= 0)
+	    break;
+
+	  /* Handle comments.  No escaping possible so this is easy.  */
+	  char *cp = strchr (line, '#');
+	  if (cp != NULL)
+	    *cp = '\0';
+
+	  cp = line;
+	  while (isspace (*cp))
+	    ++cp;
+
+	  char *cmd = cp;
+	  while (*cp != '\0' && !isspace (*cp))
+	    ++cp;
+	  size_t cmdlen = cp - cmd;
+
+	  if (*cp != '\0')
+	    *cp++ = '\0';
+	  while (isspace (*cp))
+	    ++cp;
+
+	  char *val1 = cp;
+	  while (*cp != '\0' && !isspace (*cp))
+	    ++cp;
+	  size_t val1len = cp - cmd;
+
+	  /* We always need at least two values.  */
+	  if (val1len == 0)
+	    continue;
+
+	  if (*cp != '\0')
+	    *cp++ = '\0';
+	  while (isspace (*cp))
+	    ++cp;
+
+	  char *val2 = cp;
+	  while (*cp != '\0' && !isspace (*cp))
+	    ++cp;
+
+	  /*  Ignore the rest of the line.  */
+	  *cp = '\0';
+
+	  struct prefixlist **listp;
+	  size_t *lenp;
+	  bool *nullbitsp;
+	  switch (cmdlen)
+	    {
+	    case 5:
+	      if (strcmp (cmd, "label") == 0)
+		{
+		  struct in6_addr prefix;
+		  unsigned long int bits;
+		  unsigned long int val;
+		  char *endp;
+
+		  listp = &labellist;
+		  lenp = &nlabellist;
+		  nullbitsp = &labellist_nullbits;
+
+		new_elem:
+		  bits = 128;
+		  __set_errno (0);
+		  cp = strchr (val1, '/');
+		  if (cp != NULL)
+		    *cp++ = '\0';
+		  if (inet_pton (AF_INET6, val1, &prefix)
+		      && (cp == NULL
+			  || (bits = strtoul (cp, &endp, 10)) != ULONG_MAX
+			  || errno != ERANGE)
+		      && *endp == '\0'
+		      && bits <= INT_MAX
+		      && ((val = strtoul (val2, &endp, 10)) != ULONG_MAX
+			  || errno != ERANGE)
+		      && *endp == '\0'
+		      && val <= INT_MAX)
+		    {
+		      struct prefixlist *newp = malloc (sizeof (*newp));
+		      if (newp == NULL)
+			{
+			  free (line);
+			  fclose (fp);
+			  goto no_file;
+			}
+
+		      memcpy (&newp->entry.prefix, &prefix, sizeof (prefix));
+		      newp->entry.bits = bits;
+		      newp->entry.val = val;
+		      newp->next = *listp;
+		      *listp = newp;
+		      ++*lenp;
+		      *nullbitsp |= bits == 0;
+		    }
+		}
+	      break;
+
+	    case 6:
+	      if (strcmp (cmd, "reload") == 0)
+		gaiconf_reload_flag = strcmp (val1, "yes") == 0;
+	      break;
+
+	    case 10:
+	      if (strcmp (cmd, "precedence") == 0)
+		{
+		  listp = &precedencelist;
+		  lenp = &nprecedencelist;
+		  nullbitsp = &precedencelist_nullbits;
+		  goto new_elem;
+		}
+	      break;
+	    }
+	}
+
+      free (line);
+
+      fclose (fp);
+
+      /* Create the array for the labels.  */
+      struct prefixentry *new_labels;
+      if (nlabellist > 0)
+	{
+	  if (!labellist_nullbits)
+	    ++nlabellist;
+	  new_labels = malloc (nlabellist * sizeof (*new_labels));
+	  if (new_labels == NULL)
+	    goto no_file;
+
+	  int i = nlabellist;
+	  if (!labellist_nullbits)
+	    {
+	      --i;
+	      memset (&new_labels[i].prefix, '\0', sizeof (struct in6_addr));
+	      new_labels[i].bits = 0;
+	      new_labels[i].val = 1;
+	    }
+
+	  struct prefixlist *l = labellist;
+	  while (i-- > 0)
+	    {
+	      new_labels[i] = l->entry;
+	      l = l->next;
+	    }
+	  free_prefixlist (labellist);
+
+	  /* Sort the entries so that the most specific ones are at
+	     the beginning.  */
+	  qsort (new_labels, nlabellist, sizeof (*new_labels), prefixcmp);
+	}
+      else
+	new_labels = (struct prefixentry *) default_labels;
+
+      struct prefixentry *new_precedence;
+      if (nprecedencelist > 0)
+	{
+	  if (!precedencelist_nullbits)
+	    ++nprecedencelist;
+	  new_precedence = malloc (nprecedencelist * sizeof (*new_precedence));
+	  if (new_precedence == NULL)
+	    {
+	      if (new_labels != default_labels)
+		free (new_labels);
+	      goto no_file;
+	    }
+
+	  int i = nprecedencelist;
+	  if (!precedencelist_nullbits)
+	    {
+	      --i;
+	      memset (&new_precedence[i].prefix, '\0',
+		      sizeof (struct in6_addr));
+	      new_precedence[i].bits = 0;
+	      new_precedence[i].val = 40;
+	    }
+
+	  struct prefixlist *l = precedencelist;
+	  while (i-- > 0)
+	    {
+	      new_precedence[i] = l->entry;
+	      l = l->next;
+	    }
+	  free_prefixlist (precedencelist);
+
+	  /* Sort the entries so that the most specific ones are at
+	     the beginning.  */
+	  qsort (new_precedence, nprecedencelist, sizeof (*new_labels),
+		 prefixcmp);
+	}
+      else
+	new_precedence = (struct prefixentry *) default_precedence;
+
+      /* Now we are ready to replace the values.  */
+      const struct prefixentry *old = labels;
+      labels = new_labels;
+      if (old != default_labels)
+	free ((void *) old);
+
+      old = precedence;
+      precedence = new_precedence;
+      if (old != default_precedence)
+	free ((void *) old);
+
+      gaiconf_mtime = st.st_mtim;
+    }
+  else
+    {
+    no_file:
+      free_prefixlist (labellist);
+      free_prefixlist (precedencelist);
+
+      /* If we previously read the file but it is gone now, free the
+	 old data and use the builtin one.  Leave the reload flag
+	 alone.  */
+      fini ();
+    }
+}
+
+
+static void
+gaiconf_reload (void)
+{
+  struct stat64 st;
+  if (__xstat64 (_STAT_VER, GAICONF_FNAME, &st) != 0
+      || memcmp (&st.st_mtim, &gaiconf_mtime, sizeof (gaiconf_mtime)) != 0)
+    gaiconf_init ();
+}
+
+
 int
 getaddrinfo (const char *name, const char *service,
 	     const struct addrinfo *hints, struct addrinfo **pai)
 {
-  int i = 0, j = 0, last_i = 0;
+  int i = 0, last_i = 0;
   int nresults = 0;
-  struct addrinfo *p = NULL, **end;
-  struct gaih *g = gaih, *pg = NULL;
+  struct addrinfo *p = NULL;
   struct gaih_service gaih_service, *pservice;
   struct addrinfo local_hints;
 
@@ -1489,15 +1889,23 @@ getaddrinfo (const char *name, const char *service,
   if ((hints->ai_flags & AI_CANONNAME) && name == NULL)
     return EAI_BADFLAGS;
 
+  struct in6addrinfo *in6ai = NULL;
+  size_t in6ailen;
+  bool seen_ipv4 = false;
+  bool seen_ipv6 = false;
+  /* We might need information about what kind of interfaces are available.
+     But even if AI_ADDRCONFIG is not used, if the user requested IPv6
+     addresses we have to know whether an address is deprecated or
+     temporary.  */
+  if ((hints->ai_flags & AI_ADDRCONFIG) || hints->ai_family == PF_UNSPEC
+      || hints->ai_family == PF_INET6)
+    /* Determine whether we have IPv4 or IPv6 interfaces or both.  We
+       cannot cache the results since new interfaces could be added at
+       any time.  */
+    __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+
   if (hints->ai_flags & AI_ADDRCONFIG)
     {
-      /* Determine whether we have IPv4 or IPv6 interfaces or both.
-	 We cannot cache the results since new interfaces could be
-	 added at any time.  */
-      bool seen_ipv4;
-      bool seen_ipv6;
-      __check_pf (&seen_ipv4, &seen_ipv6);
-
       /* Now make a decision on what we return, if anything.  */
       if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6))
 	{
@@ -1512,8 +1920,11 @@ getaddrinfo (const char *name, const char *service,
 	}
       else if ((hints->ai_family == PF_INET && ! seen_ipv4)
 	       || (hints->ai_family == PF_INET6 && ! seen_ipv6))
-	/* We cannot possibly return a valid answer.  */
-	return EAI_NONAME;
+	{
+	  /* We cannot possibly return a valid answer.  */
+	  free (in6ai);
+	  return EAI_NONAME;
+	}
     }
 
   if (service && service[0])
@@ -1524,7 +1935,10 @@ getaddrinfo (const char *name, const char *service,
       if (*c != '\0')
 	{
 	  if (hints->ai_flags & AI_NUMERICSERV)
-	    return EAI_NONAME;
+	    {
+	      free (in6ai);
+	      return EAI_NONAME;
+	    }
 
 	  gaih_service.num = -1;
 	}
@@ -1534,11 +1948,21 @@ getaddrinfo (const char *name, const char *service,
   else
     pservice = NULL;
 
+  struct addrinfo **end;
   if (pai)
     end = &p;
   else
     end = NULL;
 
+  unsigned int naddrs = 0;
+#if 0
+  /* If we would support more protocols than just IPv4 and IPv6 we
+     would iterate over a table with appropriate callback functions.
+     Since we currently only handle IPv4 and IPv6 this is not
+     necessary.  */
+  const struct gaih *g = gaih;
+  const struct gaih *pg = NULL;
+  int j = 0;
   while (g->gaih)
     {
       if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC)
@@ -1547,7 +1971,7 @@ getaddrinfo (const char *name, const char *service,
 	  if (pg == NULL || pg->gaih != g->gaih)
 	    {
 	      pg = g;
-	      i = g->gaih (name, pservice, hints, end);
+	      i = g->gaih (name, pservice, hints, end, &naddrs);
 	      if (i != 0)
 		{
 		  /* EAI_NODATA is a more specific result as it says that
@@ -1562,6 +1986,7 @@ getaddrinfo (const char *name, const char *service,
 		    }
 
 		  freeaddrinfo (p);
+		  free (in6ai);
 
 		  return -(i & GAIH_EAI);
 		}
@@ -1577,16 +2002,56 @@ getaddrinfo (const char *name, const char *service,
     }
 
   if (j == 0)
-    return EAI_FAMILY;
+    {
+      free (in6ai);
+      return EAI_FAMILY;
+    }
+#else
+  if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
+      || hints->ai_family == AF_INET6)
+    {
+      last_i = gaih_inet (name, pservice, hints, end, &naddrs);
+      if (last_i != 0)
+	{
+	  freeaddrinfo (p);
+	  free (in6ai);
 
-  if (nresults > 1)
+	  return -(last_i & GAIH_EAI);
+	}
+      if (end)
+	while (*end)
+	  {
+	    end = &((*end)->ai_next);
+	    ++nresults;
+	  }
+    }
+  else
+    {
+      free (in6ai);
+      return EAI_FAMILY;
+    }
+#endif
+
+  if (naddrs > 1)
     {
+      /* Read the config file.  */
+      __libc_once_define (static, once);
+      __typeof (once) old_once = once;
+      __libc_once (once, gaiconf_init);
+      if (old_once && gaiconf_reload_flag)
+	gaiconf_reload ();
+
       /* Sort results according to RFC 3484.  */
       struct sort_result results[nresults];
       struct addrinfo *q;
       struct addrinfo *last = NULL;
       char *canonname = NULL;
 
+      /* If we have information about deprecated and temporary address
+	 sort the array now.  */
+      if (in6ai != NULL)
+	qsort (in6ai, in6ailen, sizeof (*in6ai), in6aicmp);
+
       for (i = 0, q = p; q != NULL; ++i, last = q, q = q->ai_next)
 	{
 	  results[i].dest_addr = q;
@@ -1601,9 +2066,12 @@ getaddrinfo (const char *name, const char *service,
 		      results[i - 1].source_addr_len);
 	      results[i].source_addr_len = results[i - 1].source_addr_len;
 	      results[i].got_source_addr = results[i - 1].got_source_addr;
+	      results[i].source_addr_flags = results[i - 1].source_addr_flags;
 	    }
 	  else
 	    {
+	      results[i].source_addr_flags = 0;
+
 	      /* We overwrite the type with SOCK_DGRAM since we do not
 		 want connect() to connect to the other side.  If we
 		 cannot determine the source address remember this
@@ -1618,6 +2086,20 @@ getaddrinfo (const char *name, const char *service,
 		{
 		  results[i].source_addr_len = sl;
 		  results[i].got_source_addr = true;
+
+		  if (q->ai_family == PF_INET6 && in6ai != NULL)
+		    {
+		      /* See whether the address is the list of deprecated
+			 or temporary addresses.  */
+		      struct in6addrinfo tmp;
+		      memcpy (tmp.addr, q->ai_addr, IN6ADDRSZ);
+
+		      struct in6addrinfo *found
+			= bsearch (&tmp, in6ai, in6ailen, sizeof (*in6ai),
+				   in6aicmp);
+		      if (found != NULL)
+			results[i].source_addr_flags = found->flags;
+		    }
 		}
 	      else
 		/* Just make sure that if we have to process the same
@@ -1651,6 +2133,8 @@ getaddrinfo (const char *name, const char *service,
       p->ai_canonname = canonname;
     }
 
+  free (in6ai);
+
   if (p)
     {
       *pai = p;
diff --git a/sysdeps/posix/gettimeofday.c b/sysdeps/posix/gettimeofday.c
index 28f75b0bcc..bda40f48ec 100644
--- a/sysdeps/posix/gettimeofday.c
+++ b/sysdeps/posix/gettimeofday.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994-1997,2002,2005 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
@@ -20,12 +20,6 @@
 #include <time.h>
 #include <sys/time.h>
 
-#ifndef HAVE_GNU_LD
-#define __daylight	daylight
-#define __timezone	timezone
-#define __tzname	tzname
-#endif
-
 #undef __gettimeofday
 
 /* Get the current time of day and timezone information,
diff --git a/sysdeps/posix/libc_fatal.c b/sysdeps/posix/libc_fatal.c
index 9dfac68006..c611b84363 100644
--- a/sysdeps/posix/libc_fatal.c
+++ b/sysdeps/posix/libc_fatal.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,1994,1995,1997,2000,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1994,1995,1997,2000,2004,2005
+	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
@@ -73,7 +74,7 @@ __libc_message (int do_abort, const char *fmt, ...)
   while (*cp != '\0')
     {
       /* Find the next "%s" or the end of the string.  */
-      char *next = cp;
+      const char *next = cp;
       while (next[0] != '%' || next[1] != 's')
 	{
 	  next = __strchrnul (next + 1, '%');
@@ -114,7 +115,7 @@ __libc_message (int do_abort, const char *fmt, ...)
 
       for (int cnt = nlist - 1; cnt >= 0; --cnt)
 	{
-	  iov[cnt].iov_base = list->str;
+	  iov[cnt].iov_base = (char *) list->str;
 	  iov[cnt].iov_len = list->len;
 	  total += list->len;
 	  list = list->next;
diff --git a/sysdeps/posix/pause.c b/sysdeps/posix/pause.c
index 8639e684f4..538c186ec0 100644
--- a/sysdeps/posix/pause.c
+++ b/sysdeps/posix/pause.c
@@ -1,5 +1,5 @@
 /* pause -- suspend the process until a signal arrives.  POSIX.1 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 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
@@ -23,6 +23,7 @@
 
 /* Suspend the process until a signal arrives.
    This always returns -1 and sets errno to EINTR.  */
+
 int
 __libc_pause (void)
 {
@@ -39,3 +40,18 @@ __libc_pause (void)
 weak_alias (__libc_pause, pause)
 
 LIBC_CANCEL_HANDLED ();		/* sigsuspend handles our cancellation.  */
+
+#ifndef NO_CANCELLATION
+# include <not-cancel.h>
+
+int
+__pause_nocancel (void)
+{
+  sigset_t set;
+
+  __sigemptyset (&set);
+  __sigprocmask (SIG_BLOCK, NULL, &set);
+
+  return sigsuspend_not_cancel (&set);
+}
+#endif
diff --git a/sysdeps/posix/posix_fallocate.c b/sysdeps/posix/posix_fallocate.c
index 838e7a004a..cbaeb49487 100644
--- a/sysdeps/posix/posix_fallocate.c
+++ b/sysdeps/posix/posix_fallocate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2005 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
@@ -29,9 +29,8 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
 {
   struct stat64 st;
   struct statfs f;
-  size_t step;
 
-  /* `off_t´ is a signed type.  Therefore we can determine whether
+  /* `off_t' is a signed type.  Therefore we can determine whether
      OFFSET + LEN is too large if it is a negative value.  */
   if (offset < 0 || len < 0)
     return EINVAL;
@@ -47,24 +46,48 @@ posix_fallocate (int fd, __off_t offset, __off_t len)
   if (! S_ISREG (st.st_mode))
     return ENODEV;
 
+  if (len == 0)
+    {
+      if (st.st_size < offset)
+	{
+	  int ret = __ftruncate (fd, offset);
+
+	  if (ret != 0)
+	    ret = errno;
+	  return ret;
+	}
+      return 0;
+    }
+
   /* We have to know the block size of the filesystem to get at least some
      sort of performance.  */
   if (__fstatfs (fd, &f) != 0)
     return errno;
 
-  /* Align OFFSET to block size and adjust LEN.  */
-  step = (offset + f.f_bsize - 1) % ~f.f_bsize;
-  offset += step;
+  /* Try to play safe.  */
+  if (f.f_bsize == 0)
+    f.f_bsize = 512;
 
   /* Write something to every block.  */
-  while (len > step)
+  for (offset += (len - 1) % f.f_bsize; len > 0; offset += f.f_bsize)
     {
-      len -= step;
+      len -= f.f_bsize;
+
+      if (offset < st.st_size)
+	{
+	  unsigned char c;
+	  ssize_t rsize = __pread (fd, &c, 1, offset);
+
+	  if (rsize < 0)
+	    return errno;
+	  /* If there is a non-zero byte, the block must have been
+	     allocated already.  */
+	  else if (rsize == 1 && c != 0)
+	    continue;
+	}
 
       if (__pwrite (fd, "", 1, offset) != 1)
 	return errno;
-
-      offset += step;
     }
 
   return 0;
diff --git a/sysdeps/posix/posix_fallocate64.c b/sysdeps/posix/posix_fallocate64.c
index 0eba4161a5..64ca9ae83d 100644
--- a/sysdeps/posix/posix_fallocate64.c
+++ b/sysdeps/posix/posix_fallocate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2004, 2005 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
@@ -29,9 +29,8 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
 {
   struct stat64 st;
   struct statfs64 f;
-  size_t step;
 
-  /* `off64_t´ is a signed type.  Therefore we can determine whether
+  /* `off64_t' is a signed type.  Therefore we can determine whether
      OFFSET + LEN is too large if it is a negative value.  */
   if (offset < 0 || len < 0)
     return EINVAL;
@@ -47,24 +46,48 @@ __posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
   if (! S_ISREG (st.st_mode))
     return ENODEV;
 
+  if (len == 0)
+    {
+      if (st.st_size < offset)
+	{
+	  int ret = __ftruncate64 (fd, offset);
+
+	  if (ret != 0)
+	    ret = errno;
+	  return ret;
+	}
+      return 0;
+    }
+
   /* We have to know the block size of the filesystem to get at least some
      sort of performance.  */
   if (__fstatfs64 (fd, &f) != 0)
     return errno;
 
-  /* Align OFFSET to block size and adjust LEN.  */
-  step = (offset + f.f_bsize - 1) % ~f.f_bsize;
-  offset += step;
+  /* Try to play safe.  */
+  if (f.f_bsize == 0)
+    f.f_bsize = 512;
 
   /* Write something to every block.  */
-  while (len > step)
+  for (offset += (len - 1) % f.f_bsize; len > 0; offset += f.f_bsize)
     {
-      len -= step;
-
-      if (__pwrite64 (fd, "", 1, offset) != 1)
+      len -= f.f_bsize;
+
+      if (offset < st.st_size)
+	{
+	  unsigned char c;
+	  ssize_t rsize = __libc_pread64 (fd, &c, 1, offset);
+
+	  if (rsize < 0)
+	    return errno;
+	  /* If there is a non-zero byte, the block must have been
+	     allocated already.  */
+	  else if (rsize == 1 && c != 0)
+	    continue;
+	}
+
+      if (__libc_pwrite64 (fd, "", 1, offset) != 1)
 	return errno;
-
-      offset += step;
     }
 
   return 0;
diff --git a/sysdeps/posix/profil.c b/sysdeps/posix/profil.c
index 3c2e1dfa07..281b53bf6a 100644
--- a/sysdeps/posix/profil.c
+++ b/sysdeps/posix/profil.c
@@ -1,5 +1,6 @@
 /* Low-level statistical profiling support function.  Mostly POSIX.1 version.
-   Copyright (C) 1996,97,98,2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,2002,2004,2005,2006
+	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
@@ -22,10 +23,11 @@
 #include <errno.h>
 #include <signal.h>
 #include <sys/time.h>
+#include <libc-internal.h>
 
 #ifndef SIGPROF
 
-#include <sysdeps/generic/profil.c>
+#include <gmon/profil.c>
 
 #else
 
@@ -110,7 +112,7 @@ __profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale)
     return -1;
 
   timer.it_value.tv_sec = 0;
-  timer.it_value.tv_usec = 1;
+  timer.it_value.tv_usec = 1000000 / __profile_frequency ();
   timer.it_interval = timer.it_value;
   return __setitimer (ITIMER_PROF, &timer, otimer_ptr);
 }
diff --git a/sysdeps/posix/shm_open.c b/sysdeps/posix/shm_open.c
index b773d40db0..0a657fadfa 100644
--- a/sysdeps/posix/shm_open.c
+++ b/sysdeps/posix/shm_open.c
@@ -1,5 +1,5 @@
 /* shm_open -- open a POSIX shared memory object.  Generic POSIX file version.
-   Copyright (C) 2001,02 Free Software Foundation, Inc.
+   Copyright (C) 2001,2002,2005 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 
 #if ! _POSIX_MAPPED_FILES
-#include <sysdeps/generic/shm_open.c>
+#include <rt/shm_open.c>
 
 #else
 
diff --git a/sysdeps/posix/shm_unlink.c b/sysdeps/posix/shm_unlink.c
index b67240f838..18ca416e16 100644
--- a/sysdeps/posix/shm_unlink.c
+++ b/sysdeps/posix/shm_unlink.c
@@ -1,5 +1,5 @@
 /* shm_unlink -- remove a POSIX shared memory object.  Generic POSIX version.
-   Copyright (C) 2001,02 Free Software Foundation, Inc.
+   Copyright (C) 2001,2002,2005 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 
 #if ! _POSIX_MAPPED_FILES
-#include <sysdeps/generic/shm_unlink.c>
+#include <rt/shm_unlink.c>
 
 #else
 
diff --git a/sysdeps/posix/sigignore.c b/sysdeps/posix/sigignore.c
index 361a19e0dc..9787e8d234 100644
--- a/sysdeps/posix/sigignore.c
+++ b/sysdeps/posix/sigignore.c
@@ -1,5 +1,5 @@
 /* Set the disposition of SIG to SIG_IGN.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -22,6 +22,8 @@
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
 
 int
 sigignore (sig)
diff --git a/sysdeps/posix/signal.c b/sysdeps/posix/signal.c
index 9a8efee043..9fc514c729 100644
--- a/sysdeps/posix/signal.c
+++ b/sysdeps/posix/signal.c
@@ -1,5 +1,6 @@
 /* BSD-like signal function.
-   Copyright (C) 1991,1992,1996,1997,2000,2002 Free Software Foundation, Inc.
+   Copyright (C) 1991,1992,1996,1997,2000,2002,2005
+   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
@@ -19,6 +20,7 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 
 
 sigset_t _sigintr attribute_hidden;		/* Set by siginterrupt.  */
diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c
index 873c1cb1e6..8f96e3d610 100644
--- a/sysdeps/posix/sigset.c
+++ b/sysdeps/posix/sigset.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2005, 2006 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
@@ -20,6 +20,7 @@
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 
 
 /* Set the disposition for SIG.  */
@@ -28,8 +29,10 @@ sigset (sig, disp)
      int sig;
      __sighandler_t disp;
 {
-  struct sigaction act, oact;
+  struct sigaction act;
+  struct sigaction oact;
   sigset_t set;
+  sigset_t oset;
 
 #ifdef SIG_HOLD
   /* Handle SIG_HOLD first.  */
@@ -44,10 +47,18 @@ sigset (sig, disp)
 	return SIG_ERR;
 
       /* Add the signal set to the current signal mask.  */
-      if (__sigprocmask (SIG_BLOCK, &set, NULL) < 0)
+      if (__sigprocmask (SIG_BLOCK, &set, &oset) < 0)
 	return SIG_ERR;
 
-      return SIG_HOLD;
+      /* If the signal was already blocked signal this to the caller.  */
+      if (__sigismember (&oset, sig))
+	return SIG_HOLD;
+
+      /* We need to determine whether a specific handler is installed.  */
+      if (__sigaction (sig, NULL, &oact) < 0)
+	return SIG_ERR;
+
+      return oact.sa_handler;
     }
 #endif	/* SIG_HOLD */
 
@@ -74,8 +85,9 @@ sigset (sig, disp)
     return SIG_ERR;
 
   /* Remove the signal set from the current signal mask.  */
-  if (__sigprocmask (SIG_UNBLOCK, &set, NULL) < 0)
+  if (__sigprocmask (SIG_UNBLOCK, &set, &oset) < 0)
     return SIG_ERR;
 
-  return oact.sa_handler;
+  /* If the signal was already blocked return SIG_HOLD.  */
+  return __sigismember (&oset, sig) ? SIG_HOLD : oact.sa_handler;
 }
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index 69106c480e..29803a8461 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -1,5 +1,5 @@
 /* Guts of POSIX spawn interface.  Generic POSIX.1 version.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000-2005, 2006 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
@@ -26,6 +26,7 @@
 #include <unistd.h>
 #include "spawn_int.h"
 #include <not-cancel.h>
+#include <local-setxid.h>
 
 
 /* The Unix standard contains a long explanation of the way to signal
@@ -81,7 +82,15 @@ __spawni (pid_t *pid, const char *file,
   short int flags = attrp == NULL ? 0 : attrp->__flags;
 
   /* Generate the new process.  */
-  if (flags & POSIX_SPAWN_USEVFORK)
+  if ((flags & POSIX_SPAWN_USEVFORK) != 0
+      /* If no major work is done, allow using vfork.  Note that we
+	 might perform the path searching.  But this would be done by
+	 a call to execvp(), too, and such a call must be OK according
+	 to POSIX.  */
+      || ((flags & (POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF
+		    | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER
+		    | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_RESETIDS)) == 0
+	  && file_actions == NULL))
     new_pid = __vfork ();
   else
     new_pid = __fork ();
@@ -147,7 +156,8 @@ __spawni (pid_t *pid, const char *file,
 
   /* Set the effective user and group IDs.  */
   if ((flags & POSIX_SPAWN_RESETIDS) != 0
-      && (seteuid (__getuid ()) != 0 || setegid (__getgid ()) != 0))
+      && (local_seteuid (__getuid ()) != 0
+	  || local_setegid (__getgid ()) != 0))
     _exit (SPAWN_ERROR);
 
   /* Execute the file actions.  */
@@ -169,9 +179,10 @@ __spawni (pid_t *pid, const char *file,
 
 	    case spawn_do_open:
 	      {
-		int new_fd = __open64 (action->action.open_action.path,
-				       action->action.open_action.oflag,
-				       action->action.open_action.mode);
+		int new_fd = open_not_cancel (action->action.open_action.path,
+					      action->action.open_action.oflag
+					      | O_LARGEFILE,
+					      action->action.open_action.mode);
 
 		if (new_fd == -1)
 		  /* The `open' call failed.  */
@@ -185,7 +196,7 @@ __spawni (pid_t *pid, const char *file,
 		      /* The `dup2' call failed.  */
 		      _exit (SPAWN_ERROR);
 
-		    if (__close (new_fd) != 0)
+		    if (close_not_cancel (new_fd) != 0)
 		      /* The `close' call failed.  */
 		      _exit (SPAWN_ERROR);
 		  }
diff --git a/sysdeps/posix/sprofil.c b/sysdeps/posix/sprofil.c
index 19787fa364..853038d078 100644
--- a/sysdeps/posix/sprofil.c
+++ b/sysdeps/posix/sprofil.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
    This file is part of the GNU C Library.
 
@@ -27,7 +27,7 @@
 #include <sys/profil.h>
 
 #ifndef SIGPROF
-# include <sysdeps/generic/sprofil.c>
+# include <gmon/sprofil.c>
 #else
 
 #include <libc-internal.h>
@@ -181,14 +181,14 @@ profil_count_uint (void *pcp)
    interrupted code.  */
 #define profil_counter		profil_counter_ushort
 #define profil_count(pc)	profil_count (pc, 0)
-#include "profil-counter.h"
+#include <profil-counter.h>
 
 #undef profil_counter
 #undef profil_count
 
 #define profil_counter		profil_counter_uint
 #define profil_count(pc)	profil_count (pc, 1)
-#include "profil-counter.h"
+#include <profil-counter.h>
 
 static int
 insert (int i, unsigned long int start, unsigned long int end, struct prof *p,
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index de72e84829..0c0d7d1418 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991,1993,1995-1997,1999-2003,2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1991,1993,1995-1997,1999-2003,2004,2006
+	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
@@ -68,7 +68,7 @@ __sysconf (name)
 #ifdef	CHILD_MAX
       return CHILD_MAX;
 #else
-      return -1;
+      return __get_child_max ();
 #endif
 
     case _SC_CLK_TCK:
@@ -95,112 +95,112 @@ __sysconf (name)
       return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
 
     case _SC_JOB_CONTROL:
-#ifdef	_POSIX_JOB_CONTROL
-      return 1;
+#if _POSIX_JOB_CONTROL > 0
+      return _POSIX_JOB_CONTROL;
 #else
       return -1;
 #endif
 
     case _SC_SAVED_IDS:
-#ifdef	_POSIX_SAVED_IDS
+#if _POSIX_SAVED_IDS > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_REALTIME_SIGNALS:
-#ifdef	_POSIX_REALTIME_SIGNALS
+#if _POSIX_REALTIME_SIGNALS > 0
       return _POSIX_REALTIME_SIGNALS;
 #else
       return -1;
 #endif
 
     case _SC_PRIORITY_SCHEDULING:
-#ifdef	_POSIX_PRIORITY_SCHEDULING
+#if _POSIX_PRIORITY_SCHEDULING > 0
       return _POSIX_PRIORITY_SCHEDULING;
 #else
       return -1;
 #endif
 
     case _SC_TIMERS:
-#ifdef	_POSIX_TIMERS
+#if _POSIX_TIMERS > 0
       return _POSIX_TIMERS;
 #else
       return -1;
 #endif
 
     case _SC_ASYNCHRONOUS_IO:
-#ifdef	_POSIX_ASYNCHRONOUS_IO
+#if _POSIX_ASYNCHRONOUS_IO > 0
       return _POSIX_ASYNCHRONOUS_IO;
 #else
       return -1;
 #endif
 
     case _SC_PRIORITIZED_IO:
-#ifdef	_POSIX_PRIORITIZED_IO
+#if _POSIX_PRIORITIZED_IO > 0
       return _POSIX_PRIORITIZED_IO;
 #else
       return -1;
 #endif
 
     case _SC_SYNCHRONIZED_IO:
-#ifdef	_POSIX_SYNCHRONIZED_IO
+#if _POSIX_SYNCHRONIZED_IO > 0
       return _POSIX_SYNCHRONIZED_IO;
 #else
       return -1;
 #endif
 
     case _SC_FSYNC:
-#ifdef	_POSIX_FSYNC
+#if _POSIX_FSYNC > 0
       return _POSIX_FSYNC;
 #else
       return -1;
 #endif
 
     case _SC_MAPPED_FILES:
-#ifdef	_POSIX_MAPPED_FILES
+#if _POSIX_MAPPED_FILES > 0
       return _POSIX_MAPPED_FILES;
 #else
       return -1;
 #endif
 
     case _SC_MEMLOCK:
-#ifdef	_POSIX_MEMLOCK
+#if _POSIX_MEMLOCK > 0
       return _POSIX_MEMLOCK;
 #else
       return -1;
 #endif
 
     case _SC_MEMLOCK_RANGE:
-#ifdef	_POSIX_MEMLOCK_RANGE
+#if _POSIX_MEMLOCK_RANGE > 0
       return _POSIX_MEMLOCK_RANGE;
 #else
       return -1;
 #endif
 
     case _SC_MEMORY_PROTECTION:
-#ifdef	_POSIX_MEMORY_PROTECTION
+#if _POSIX_MEMORY_PROTECTION > 0
       return _POSIX_MEMORY_PROTECTION;
 #else
       return -1;
 #endif
 
     case _SC_MESSAGE_PASSING:
-#ifdef	_POSIX_MESSAGE_PASSING
+#if _POSIX_MESSAGE_PASSING > 0
       return _POSIX_MESSAGE_PASSING;
 #else
       return -1;
 #endif
 
     case _SC_SEMAPHORES:
-#ifdef	_POSIX_SEMAPHORES
+#if _POSIX_SEMAPHORES > 0
       return _POSIX_SEMAPHORES;
 #else
       return -1;
 #endif
 
     case _SC_SHARED_MEMORY_OBJECTS:
-#ifdef	_POSIX_SHARED_MEMORY_OBJECTS
+#if _POSIX_SHARED_MEMORY_OBJECTS > 0
       return _POSIX_SHARED_MEMORY_OBJECTS;
 #else
       return -1;
@@ -353,49 +353,49 @@ __sysconf (name)
 #endif
 
     case _SC_PII:
-#ifdef	_POSIX_PII
+#if _POSIX_PII > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_XTI:
-#ifdef	_POSIX_PII_XTI
+#if _POSIX_PII_XTI > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_SOCKET:
-#ifdef	_POSIX_PII_SOCKET
+#if _POSIX_PII_SOCKET > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_INTERNET:
-#ifdef	_POSIX_PII_INTERNET
+#if _POSIX_PII_INTERNET > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI:
-#ifdef	_POSIX_PII_OSI
+#if _POSIX_PII_OSI > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_POLL:
-#ifdef	_POSIX_POLL
+#if _POSIX_POLL > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_SELECT:
-#ifdef	_POSIX_SELECT
+#if _POSIX_SELECT > 0
       return 1;
 #else
       return -1;
@@ -410,35 +410,35 @@ __sysconf (name)
 #endif
 
     case _SC_PII_INTERNET_STREAM:
-#ifdef	_POSIX_PII_INTERNET_STREAM
+#if _POSIX_PII_INTERNET_STREAM > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_INTERNET_DGRAM:
-#ifdef	_POSIX_PII_INTERNET_DGRAM
+#if _POSIX_PII_INTERNET_DGRAM > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI_COTS:
-#ifdef	_POSIX_PII_OSI_COTS
+#if _POSIX_PII_OSI_COTS > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI_CLTS:
-#ifdef	_POSIX_PII_OSI_CLTS
+#if _POSIX_PII_OSI_CLTS > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI_M:
-#ifdef	_POSIX_PII_OSI_M
+#if _POSIX_PII_OSI_M > 0
       return 1;
 #else
       return -1;
@@ -519,14 +519,14 @@ __sysconf (name)
 
       /* POSIX 1003.1c (POSIX Threads).  */
     case _SC_THREADS:
-#ifdef	_POSIX_THREADS
+#if _POSIX_THREADS > 0
       return _POSIX_THREADS;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_SAFE_FUNCTIONS:
-#ifdef	_POSIX_THREAD_SAFE_FUNCTIONS
+#if _POSIX_THREAD_SAFE_FUNCTIONS > 0
       return _POSIX_THREAD_SAFE_FUNCTIONS;
 #else
       return -1;
@@ -553,7 +553,7 @@ __sysconf (name)
 #endif
 
     case _SC_THREAD_DESTRUCTOR_ITERATIONS:
-#ifdef	_POSIX_THREAD_DESTRUCTOR_ITERATIONS
+#if _POSIX_THREAD_DESTRUCTOR_ITERATIONS > 0
       return _POSIX_THREAD_DESTRUCTOR_ITERATIONS;
 #else
       return -1;
@@ -581,42 +581,42 @@ __sysconf (name)
 #endif
 
     case _SC_THREAD_ATTR_STACKADDR:
-#ifdef	_POSIX_THREAD_ATTR_STACKADDR
+#if _POSIX_THREAD_ATTR_STACKADDR > 0
       return _POSIX_THREAD_ATTR_STACKADDR;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_ATTR_STACKSIZE:
-#ifdef	_POSIX_THREAD_ATTR_STACKSIZE
+#if _POSIX_THREAD_ATTR_STACKSIZE > 0
       return _POSIX_THREAD_ATTR_STACKSIZE;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PRIORITY_SCHEDULING:
-#ifdef	_POSIX_THREAD_PRIORITY_SCHEDULING
+#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
       return _POSIX_THREAD_PRIORITY_SCHEDULING;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PRIO_INHERIT:
-#ifdef	_POSIX_THREAD_PRIO_INHERIT
+#if _POSIX_THREAD_PRIO_INHERIT > 0
       return _POSIX_THREAD_PRIO_INHERIT;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PRIO_PROTECT:
-#ifdef	_POSIX_THREAD_PRIO_PROTECT
+#if _POSIX_THREAD_PRIO_PROTECT > 0
       return _POSIX_THREAD_PRIO_PROTECT;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PROCESS_SHARED:
-#ifdef	_POSIX_THREAD_PROCESS_SHARED
+#if _POSIX_THREAD_PROCESS_SHARED > 0
       return _POSIX_THREAD_PROCESS_SHARED;
 #else
       return -1;
@@ -857,40 +857,40 @@ __sysconf (name)
 #endif
 
     case _SC_ADVISORY_INFO:
-#ifdef _POSIX_ADVISORY_INFO
+#if _POSIX_ADVISORY_INFO > 0
       return _POSIX_ADVISORY_INFO;
 #else
       return -1;
 #endif
 
     case _SC_BARRIERS:
-#ifdef _POSIX_BARRIERS
+#if _POSIX_BARRIERS > 0
       return _POSIX_BARRIERS;
 #else
       return -1;
 #endif
 
     case _SC_BASE:
-#ifdef _POSIX_BASE
+#if _POSIX_BASE > 0
       return _POSIX_BASE;
 #else
       return -1;
 #endif
     case _SC_C_LANG_SUPPORT:
-#ifdef _POSIX_C_LANG_SUPPORT
+#if _POSIX_C_LANG_SUPPORT > 0
       return _POSIX_C_LANG_SUPPORT;
 #else
       return -1;
 #endif
     case _SC_C_LANG_SUPPORT_R:
-#ifdef _POSIX_C_LANG_SUPPORT_R
+#if _POSIX_C_LANG_SUPPORT_R > 0
       return _POSIX_C_LANG_SUPPORT_R;
 #else
       return -1;
 #endif
 
     case _SC_CLOCK_SELECTION:
-#ifdef _POSIX_CLOCK_SELECTION
+#if _POSIX_CLOCK_SELECTION > 0
       return _POSIX_CLOCK_SELECTION;
 #else
       return -1;
@@ -904,58 +904,58 @@ __sysconf (name)
 #endif
 
     case _SC_DEVICE_IO:
-#ifdef _POSIX_DEVICE_IO
+#if _POSIX_DEVICE_IO > 0
       return _POSIX_DEVICE_IO;
 #else
       return -1;
 #endif
     case _SC_DEVICE_SPECIFIC:
-#ifdef _POSIX_DEVICE_SPCIFIC
+#if _POSIX_DEVICE_SPCIFIC > 0
       return _POSIX_DEVICE_SPECIFIC;
 #else
       return -1;
 #endif
     case _SC_DEVICE_SPECIFIC_R:
-#ifdef _POSIX_DEVICE_SPCIFIC_R
+#if _POSIX_DEVICE_SPCIFIC_R > 0
       return _POSIX_DEVICE_SPECIFIC_R;
 #else
       return -1;
 #endif
 
     case _SC_FD_MGMT:
-#ifdef _POSIX_FD_MGMT
+#if _POSIX_FD_MGMT > 0
       return _POSIX_FD_MGMT;
 #else
       return -1;
 #endif
 
     case _SC_FIFO:
-#ifdef _POSIX_FIFO
+#if _POSIX_FIFO > 0
       return _POSIX_FIFO;
 #else
       return -1;
 #endif
     case _SC_PIPE:
-#ifdef _POSIX_PIPE
+#if _POSIX_PIPE > 0
       return _POSIX_PIPE;
 #else
       return -1;
 #endif
 
     case _SC_FILE_ATTRIBUTES:
-#ifdef _POSIX_FILE_ATTRIBUTES
+#if _POSIX_FILE_ATTRIBUTES > 0
       return _POSIX_FILE_ATTRIBUTES;
 #else
       return -1;
 #endif
     case _SC_FILE_LOCKING:
-#ifdef _POSIX_FILE_LOCKING
+#if _POSIX_FILE_LOCKING > 0
       return _POSIX_FILE_LOCKING;
 #else
       return -1;
 #endif
     case _SC_FILE_SYSTEM:
-#ifdef _POSIX_FILE_SYSTEM
+#if _POSIX_FILE_SYSTEM > 0
       return _POSIX_FILE_SYSTEM;
 #else
       return -1;
@@ -969,53 +969,53 @@ __sysconf (name)
 #endif
 
     case _SC_MULTI_PROCESS:
-#ifdef _POSIX_MULTI_PROCESS
+#if _POSIX_MULTI_PROCESS > 0
       return _POSIX_MULTI_PROCESS;
 #else
       return -1;
 #endif
     case _SC_SINGLE_PROCESS:
-#ifdef _POSIX_SINGLE_PROCESS
+#if _POSIX_SINGLE_PROCESS > 0
       return _POSIX_SINGLE_PROCESS;
 #else
       return -1;
 #endif
 
     case _SC_NETWORKING:
-#ifdef _POSIX_NETWORKING
+#if _POSIX_NETWORKING > 0
       return _POSIX_NETWORKING;
 #else
       return -1;
 #endif
 
     case _SC_READER_WRITER_LOCKS:
-#ifdef _POSIX_READER_WRITER_LOCKS
+#if _POSIX_READER_WRITER_LOCKS > 0
       return _POSIX_READER_WRITER_LOCKS;
 #else
       return -1;
 #endif
     case _SC_SPIN_LOCKS:
-#ifdef _POSIX_SPIN_LOCKS
+#if _POSIX_SPIN_LOCKS > 0
       return _POSIX_SPIN_LOCKS;
 #else
       return -1;
 #endif
 
     case _SC_REGEXP:
-#ifdef _POSIX_REGEXP
+#if _POSIX_REGEXP > 0
       return _POSIX_REGEXP;
 #else
       return -1;
 #endif
     case _SC_REGEX_VERSION:
-#ifdef _POSIX_REGEX_VERSION
+#if _POSIX_REGEX_VERSION > 0
       return _POSIX_REGEX_VERSION;
 #else
       return -1;
 #endif
 
     case _SC_SHELL:
-#ifdef _POSIX_SHELL
+#if _POSIX_SHELL > 0
       return _POSIX_SHELL;
 #else
       return -1;
@@ -1029,33 +1029,33 @@ __sysconf (name)
 #endif
 
     case _SC_SPAWN:
-#ifdef _POSIX_SPAWN
+#if _POSIX_SPAWN > 0
       return _POSIX_SPAWN;
 #else
       return -1;
 #endif
 
     case _SC_SPORADIC_SERVER:
-#ifdef _POSIX_SPORADIC_SERVER
+#if _POSIX_SPORADIC_SERVER > 0
       return _POSIX_SPORADIC_SERVER;
 #else
       return -1;
 #endif
     case _SC_THREAD_SPORADIC_SERVER:
-#ifdef _POSIX_THREAD_SPORADIC_SERVER
+#if _POSIX_THREAD_SPORADIC_SERVER > 0
       return _POSIX_THREAD_SPORADIC_SERVER;
 #else
       return -1;
 #endif
 
     case _SC_SYSTEM_DATABASE:
-#ifdef _POSIX_SYSTEM_DATABASE
+#if _POSIX_SYSTEM_DATABASE > 0
       return _POSIX_SYSTEM_DATABASE;
 #else
       return -1;
 #endif
     case _SC_SYSTEM_DATABASE_R:
-#ifdef _POSIX_SYSTEM_DATABASE_R
+#if _POSIX_SYSTEM_DATABASE_R > 0
       return _POSIX_SYSTEM_DATABASE_R;
 #else
       return -1;
@@ -1069,27 +1069,27 @@ __sysconf (name)
 #endif
 
     case _SC_TIMEOUTS:
-#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS > 0
       return _POSIX_TIMEOUTS;
 #else
       return -1;
 #endif
 
     case _SC_TYPED_MEMORY_OBJECTS:
-#ifdef _POSIX_TYPED_MEMORY_OBJECTS
+#if _POSIX_TYPED_MEMORY_OBJECTS > 0
       return _POSIX_TYPED_MEMORY_OBJECTS;
 #else
       return -1;
 #endif
 
     case _SC_USER_GROUPS:
-#ifdef _POSIX_USER_GROUPS
+#if _POSIX_USER_GROUPS > 0
       return _POSIX_USER_GROUPS;
 #else
       return -1;
 #endif
     case _SC_USER_GROUPS_R:
-#ifdef _POSIX_USER_GROUPS_R
+#if _POSIX_USER_GROUPS_R > 0
       return _POSIX_USER_GROUPS_R;
 #else
       return -1;
@@ -1154,25 +1154,25 @@ __sysconf (name)
 #endif
 
     case _SC_TRACE:
-#ifdef _POSIX_TRACE
+#if _POSIX_TRACE > 0
       return _POSIX_TRACE;
 #else
       return -1;
 #endif
     case _SC_TRACE_EVENT_FILTER:
-#ifdef _POSIX_TRACE_EVENT_FILTER
+#if _POSIX_TRACE_EVENT_FILTER > 0
       return _POSIX_TRACE_EVENT_FILTER;
 #else
       return -1;
 #endif
     case _SC_TRACE_INHERIT:
-#ifdef _POSIX_TRACE_INHERIT
+#if _POSIX_TRACE_INHERIT > 0
       return _POSIX_TRACE_INHERIT;
 #else
       return -1;
 #endif
     case _SC_TRACE_LOG:
-#ifdef _POSIX_TRACE_LOG
+#if _POSIX_TRACE_LOG > 0
       return _POSIX_TRACE_LOG;
 #else
       return -1;
@@ -1198,14 +1198,14 @@ __sysconf (name)
       return 0;
 
     case _SC_IPV6:
-#ifdef _POSIX_IPV6
+#if _POSIX_IPV6 > 0
       return _POSIX_IPV6;
 #else
       return -1;
 #endif
 
     case _SC_RAW_SOCKETS:
-#ifdef _POSIX_RAW_SOCKETS
+#if _POSIX_RAW_SOCKETS > 0
       return _POSIX_RAW_SOCKETS;
 #else
       return -1;
diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c
index 8548313314..f63dde4dae 100644
--- a/sysdeps/posix/system.c
+++ b/sysdeps/posix/system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2000, 2002, 2003, 2005 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
@@ -27,10 +27,6 @@
 #include <sysdep-cancel.h>
 
 
-#ifndef	HAVE_GNU_LD
-#define	__environ	environ
-#endif
-
 #define	SHELL_PATH	"/bin/sh"	/* Path of the shell.  */
 #define	SHELL_NAME	"sh"		/* Name to give it.  */
 
diff --git a/sysdeps/posix/sysv_signal.c b/sysdeps/posix/sysv_signal.c
index ca2e84f372..16fcd2c2ab 100644
--- a/sysdeps/posix/sysv_signal.c
+++ b/sysdeps/posix/sysv_signal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 2005 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
@@ -18,6 +18,8 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
+
 
 /* Tolerate non-threads versions of Posix */
 #ifndef SA_ONESHOT
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 0d4bbc418a..c8973a0852 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2000, 2001, 2006 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
@@ -242,11 +242,15 @@ __gen_tempname (char *tmpl, int kind)
      necessary to try all these combinations.  Instead if a reasonable
      number of names is tried (we define reasonable as 62**3) fail to
      give the system administrator the chance to remove the problems.  */
-  unsigned int attempts_min = 62 * 62 * 62;
+#define ATTEMPTS_MIN (62 * 62 * 62)
 
   /* The number of times to attempt to generate a temporary file.  To
      conform to POSIX, this must be no smaller than TMP_MAX.  */
-  unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min;
+#if ATTEMPTS_MIN < TMP_MAX
+  unsigned int attempts = TMP_MAX;
+#else
+  unsigned int attempts = ATTEMPTS_MIN;
+#endif
 
   len = strlen (tmpl);
   if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))
diff --git a/sysdeps/powerpc/Dist b/sysdeps/powerpc/Dist
deleted file mode 100644
index ba909df26f..0000000000
--- a/sysdeps/powerpc/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-novmx-longjmp.c
-novmx-sigjmp.c
diff --git a/sysdeps/powerpc/Implies b/sysdeps/powerpc/Implies
index 12ca48b4c9..7ccf9a7c4a 100644
--- a/sysdeps/powerpc/Implies
+++ b/sysdeps/powerpc/Implies
@@ -1,2 +1,4 @@
-ieee754/flt-32
+# On PowerPC we use the IBM extended long double format.
+ieee754/ldbl-128ibm
 ieee754/dbl-64
+ieee754/flt-32
diff --git a/sysdeps/powerpc/bits/link.h b/sysdeps/powerpc/bits/link.h
new file mode 100644
index 0000000000..6c6f6042a1
--- /dev/null
+++ b/sysdeps/powerpc/bits/link.h
@@ -0,0 +1,111 @@
+/* Machine-specific declarations for dynamic linker interface.  PowerPC version
+   Copyright (C) 2004, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+
+#if __ELF_NATIVE_CLASS == 32
+
+/* Registers for entry into PLT on PPC32.  */
+typedef struct La_ppc32_regs
+{
+  uint32_t lr_reg[8];
+  double lr_fp[8];
+  uint32_t lr_vreg[12][4];
+  uint32_t lr_r1;
+  uint32_t lr_lr;
+} La_ppc32_regs;
+
+/* Return values for calls from PLT on PPC32.  */
+typedef struct La_ppc32_retval
+{
+  uint32_t lrv_r3;
+  uint32_t lrv_r4;
+  double lrv_fp[8];
+  uint32_t lrv_v2[4];
+} La_ppc32_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf32_Addr la_ppc32_gnu_pltenter (Elf32_Sym *__sym,
+					 unsigned int __ndx,
+					 uintptr_t *__refcook,
+					 uintptr_t *__defcook,
+					 La_ppc32_regs *__regs,
+					 unsigned int *__flags,
+					 const char *__symname,
+					 long int *__framesizep);
+extern unsigned int la_ppc32_gnu_pltexit (Elf32_Sym *__sym,
+					  unsigned int __ndx,
+					  uintptr_t *__refcook,
+					  uintptr_t *__defcook,
+					  const La_ppc32_regs *__inregs,
+					  La_ppc32_retval *__outregs,
+					  const char *symname);
+
+__END_DECLS
+
+#else
+
+/* Registers for entry into PLT on PPC64.  */
+typedef struct La_ppc64_regs
+{
+  uint64_t lr_reg[8];
+  double lr_fp[13];
+  uint32_t __padding;
+  uint32_t lr_vrsave;
+  uint32_t lr_vreg[12][4];
+  uint64_t lr_r1;
+  uint64_t lr_lr;
+} La_ppc64_regs;
+
+/* Return values for calls from PLT on PPC64.  */
+typedef struct La_ppc64_retval
+{
+  uint64_t lrv_r3;
+  uint64_t lrv_r4;
+  double lrv_fp[4];	/* f1-f4, float - complex long double.  */
+  uint32_t lrv_v2[4];	/* v2.  */ 
+} La_ppc64_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_ppc64_gnu_pltenter (Elf64_Sym *__sym,
+					 unsigned int __ndx,
+					 uintptr_t *__refcook,
+					 uintptr_t *__defcook,
+					 La_ppc64_regs *__regs,
+					 unsigned int *__flags,
+					 const char *__symname,
+					 long int *__framesizep);
+extern unsigned int la_ppc64_gnu_pltexit (Elf64_Sym *__sym,
+					  unsigned int __ndx,
+					  uintptr_t *__refcook,
+					  uintptr_t *__defcook,
+					  const La_ppc64_regs *__inregs,
+					  La_ppc64_retval *__outregs,
+					  const char *symname);
+
+__END_DECLS
+
+#endif
diff --git a/sysdeps/powerpc/bits/mathdef.h b/sysdeps/powerpc/bits/mathdef.h
new file mode 100644
index 0000000000..b79cc6ff96
--- /dev/null
+++ b/sysdeps/powerpc/bits/mathdef.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 1997,1998,1999,2000,2003,2004,2006
+	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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+
+/* FIXME! This file describes properties of the compiler, not the machine;
+   it should not be part of libc!
+
+   FIXME! This file does not deal with the -fshort-double option of
+   gcc! */
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF	1
+
+# ifdef __GNUC__
+#  if __STDC__ == 1
+
+/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
+typedef float float_t;		/* `float' expressions are evaluated as
+				   `float'.  */
+typedef double double_t;	/* `double' expressions are evaluated as
+				   `double'.  */
+
+#  else
+
+/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
+typedef double float_t;		/* `float' expressions are evaluated as
+				   `double'.  */
+typedef double double_t;	/* `double' expressions are evaluated as
+				   `double'.  */
+
+#  endif
+# else
+
+/* Wild guess at types for float_t and double_t. */
+typedef double float_t;
+typedef double double_t;
+
+# endif
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+# define FP_ILOGB0	(-2147483647)
+# define FP_ILOGBNAN	(2147483647)
+
+#endif	/* ISO C99 */
diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h
index 3134916a51..9c3e22abac 100644
--- a/sysdeps/powerpc/bits/setjmp.h
+++ b/sysdeps/powerpc/bits/setjmp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2003,2004,2005,2006
+	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
@@ -31,30 +32,6 @@
 
 #include <bits/wordsize.h>
 
-#if defined __USE_MISC || defined _ASM
-# define JB_GPR1   0  /* Also known as the stack pointer */
-# define JB_GPR2   1
-# define JB_LR     2  /* The address we will return to */
-# if __WORDSIZE == 64
-#  define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18*2 words total.  */
-#  define JB_CR     21 /* Condition code registers with the VRSAVE at */
-                       /* offset 172 (low half of the double word.  */
-#  define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total.  */
-#  define JB_SIZE   (64 * 8) /* As per PPC64-VMX ABI.  */
-#  define JB_VRSAVE 21 /* VRSAVE shares a double word with the CR at offset */
-                       /* 168 (high half of the double word).  */
-#  define JB_VRS    40 /* VRs 20 through 31 are saved, 12*4 words total.  */
-# else
-#  define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18 in total.  */
-#  define JB_CR     21 /* Condition code registers.  */
-#  define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total.  */
-#  define JB_SIZE   ((64 + (12 * 4)) * 4)
-#  define JB_VRSAVE 62
-#  define JB_VRS    64
-# endif
-#endif
-
-
 /* The current powerpc 32-bit Altivec ABI specifies for SVR4 ABI and EABI
    the vrsave must be at byte 248 & v20 at byte 256.  So we must pad this
    correctly on 32 bit.  It also insists that vecregs are only gauranteed
@@ -72,9 +49,4 @@ typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16)));
 # endif
 #endif
 
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_GPR1])
-
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/powerpc/dl-procinfo.c b/sysdeps/powerpc/dl-procinfo.c
new file mode 100644
index 0000000000..a732e94fa8
--- /dev/null
+++ b/sysdeps/powerpc/dl-procinfo.c
@@ -0,0 +1,90 @@
+/* Data for processor capability information.  PowerPC version.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This information must be kept in sync with the _DL_HWCAP_COUNT and
+   _DL_PLATFORM_COUNT definitions in procinfo.h.
+
+   If anything should be added here check whether the size of each string
+   is still ok with the given array size.
+
+   All the #ifdefs in the definitions are quite irritating but
+   necessary if we want to avoid duplicating the information.  There
+   are three different modes:
+
+   - PROCINFO_DECL is defined.  This means we are only interested in
+     declarations.
+
+   - PROCINFO_DECL is not defined:
+
+     + if SHARED is defined the file is included in an array
+       initializer.  The .element = { ... } syntax is needed.
+
+     + if SHARED is not defined a normal array initialization is
+       needed.
+  */
+
+#ifndef PROCINFO_CLASS
+# define PROCINFO_CLASS
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_powerpc_cap_flags
+#else
+PROCINFO_CLASS const char _dl_powerpc_cap_flags[23][10]
+#endif
+#ifndef PROCINFO_DECL
+= {
+    "power6x", "dfp", "pa6t",
+    "arch_2_05", "ic_snoop", "smt", "booke",
+    "cellbe", "power5+", "power5", "power4",
+    "notb", "efpdouble", "efpsingle", "spe",
+    "ucache", "4xxmac", "mmu", "fpu",
+    "altivec", "ppc601", "ppc64", "ppc32",
+  }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_powerpc_platforms
+#else
+PROCINFO_CLASS const char _dl_powerpc_platforms[7][12]
+#endif
+#ifndef PROCINFO_DECL
+= {
+    [PPC_PLATFORM_POWER4] = "power4",
+    [PPC_PLATFORM_PPC970] = "ppc970",
+    [PPC_PLATFORM_POWER5] = "power5",
+    [PPC_PLATFORM_POWER5_PLUS] = "power5+",
+    [PPC_PLATFORM_POWER6] = "power6",
+    [PPC_PLATFORM_CELL_BE] = "ppc-cell-be",
+    [PPC_PLATFORM_POWER6X] = "power6x"
+  }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#undef PROCINFO_DECL
+#undef PROCINFO_CLASS
diff --git a/sysdeps/powerpc/dl-procinfo.h b/sysdeps/powerpc/dl-procinfo.h
new file mode 100644
index 0000000000..0bf935385a
--- /dev/null
+++ b/sysdeps/powerpc/dl-procinfo.h
@@ -0,0 +1,144 @@
+/* Processor capability information handling macros.  PowerPC version.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _DL_PROCINFO_H
+#define _DL_PROCINFO_H	1
+
+#include <ldsodefs.h>
+#include <sysdep.h>		/* This defines the PPC_FEATURE_* macros.  */
+
+/* There are 20 bits used, but they are bits 12..31.  */
+#define _DL_HWCAP_FIRST		9
+#define _DL_HWCAP_COUNT		32
+
+/* These bits influence library search.  */
+#define HWCAP_IMPORTANT		(PPC_FEATURE_HAS_ALTIVEC \
+				+ PPC_FEATURE_HAS_DFP)
+
+#define _DL_PLATFORMS_COUNT	7
+
+#define _DL_FIRST_PLATFORM      32
+/* Mask to filter out platforms.  */
+#define _DL_HWCAP_PLATFORM      (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
+                                 << _DL_FIRST_PLATFORM)
+
+/* Platform bits (relative to _DL_FIRST_PLATFORM).  */
+#define PPC_PLATFORM_POWER4		0
+#define PPC_PLATFORM_PPC970		1
+#define PPC_PLATFORM_POWER5		2
+#define PPC_PLATFORM_POWER5_PLUS	3
+#define PPC_PLATFORM_POWER6		4
+#define PPC_PLATFORM_CELL_BE		5
+#define PPC_PLATFORM_POWER6X		6
+
+static inline const char *
+__attribute__ ((unused))
+_dl_hwcap_string (int idx)
+{
+  return GLRO(dl_powerpc_cap_flags)[idx - _DL_HWCAP_FIRST];
+}
+
+static inline const char *
+__attribute__ ((unused))
+_dl_platform_string (int idx)
+{
+  return GLRO(dl_powerpc_platforms)[idx - _DL_FIRST_PLATFORM];
+}
+
+static inline int
+__attribute__ ((unused))
+_dl_string_hwcap (const char *str)
+{
+  for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
+    if (strcmp (str, _dl_hwcap_string (i)) == 0)
+      return i;
+  return -1;
+}
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_platform (const char *str)
+{
+  if (str == NULL)
+    return -1;
+
+  if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_POWER4], 5) == 0)
+    {
+      int ret;
+      str += 5;
+      switch (*str)
+	{
+	case '4':
+	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER4;
+	  break;
+	case '5':
+	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5;
+	  if (str[1] == '+')
+	    {
+	      ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER5_PLUS;
+	      ++str;
+	    }
+	  break;
+	case '6':
+	  ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6;
+	  if (str[1] == 'x')
+	    {
+	      ret = _DL_FIRST_PLATFORM + PPC_PLATFORM_POWER6X;
+	      ++str;
+	    }
+	  break;
+	default:
+	  return -1;
+	}
+      if (str[1] == '\0')
+	return ret;
+    }
+  else if (strncmp (str, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970],
+		    3) == 0)
+    {
+      if (strcmp (str + 3, GLRO(dl_powerpc_platforms)[PPC_PLATFORM_PPC970]
+			   + 3) == 0)
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_PPC970;
+      else if (strcmp (str + 3,
+		       GLRO(dl_powerpc_platforms)[PPC_PLATFORM_CELL_BE] + 3)
+	       == 0)
+	return _DL_FIRST_PLATFORM + PPC_PLATFORM_CELL_BE;
+    }
+
+  return -1;
+}
+
+#ifdef IS_IN_rtld
+static inline int
+__attribute__ ((unused))
+_dl_procinfo (int word)
+{
+  _dl_printf ("AT_HWCAP:       ");
+
+  for (int i = _DL_HWCAP_FIRST; i < _DL_HWCAP_COUNT; ++i)
+    if (word & (1 << i))
+      _dl_printf (" %s", _dl_hwcap_string (i));
+
+  _dl_printf ("\n");
+
+  return 0;
+}
+#endif
+
+#endif /* dl-procinfo.h */
diff --git a/sysdeps/powerpc/elf/libc-start.c b/sysdeps/powerpc/elf/libc-start.c
deleted file mode 100644
index eed3e06c8a..0000000000
--- a/sysdeps/powerpc/elf/libc-start.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (C) 1998,2000,2001,2002,2003,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <ldsodefs.h>
-#include <bp-start.h>
-#include <bp-sym.h>
-
-extern int __cache_line_size;
-weak_extern (__cache_line_size)
-
-/* The main work is done in the generic function.  */
-#define LIBC_START_MAIN generic_start_main
-#define LIBC_START_DISABLE_INLINE
-#define LIBC_START_MAIN_AUXVEC_ARG
-#define MAIN_AUXVEC_ARG
-#define INIT_MAIN_ARGS
-#include <sysdeps/generic/libc-start.c>
-
-
-struct startup_info
-{
-  void *__unbounded sda_base;
-  int (*main) (int, char **, char **, void *);
-  int (*init) (int, char **, char **, void *);
-  void (*fini) (void);
-};
-
-
-int
-/* GKM FIXME: GCC: this should get __BP_ prefix by virtue of the
-   BPs in the arglist of startup_info.main and startup_info.init. */
-BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av,
-			    char *__unbounded *__unbounded ubp_ev,
-			    ElfW(auxv_t) *__unbounded auxvec,
-			    void (*rtld_fini) (void),
-			    struct startup_info *__unbounded stinfo,
-			    char *__unbounded *__unbounded stack_on_entry)
-{
-#if __BOUNDED_POINTERS__
-  char **argv;
-#else
-# define argv ubp_av
-#endif
-
-  /* the PPC SVR4 ABI says that the top thing on the stack will
-     be a NULL pointer, so if not we assume that we're being called
-     as a statically-linked program by Linux...	 */
-  if (*stack_on_entry != NULL)
-    {
-      char *__unbounded *__unbounded temp;
-      /* ...in which case, we have argc as the top thing on the
-	 stack, followed by argv (NULL-terminated), envp (likewise),
-	 and the auxilary vector.  */
-      /* 32/64-bit agnostic load from stack */
-      argc = *(long int *__unbounded) stack_on_entry;
-      ubp_av = stack_on_entry + 1;
-      ubp_ev = ubp_av + argc + 1;
-#ifdef HAVE_AUX_VECTOR
-      temp = ubp_ev;
-      while (*temp != NULL)
-        ++temp;
-      auxvec = (ElfW(auxv_t) *)++temp;
-#endif
-      rtld_fini = NULL;
-    }
-
-  /* Initialize the __cache_line_size variable from the aux vector.  */
-  for (ElfW(auxv_t) *av = auxvec; av->a_type != AT_NULL; ++av)
-    switch (av->a_type)
-      {
-      case AT_DCACHEBSIZE:
-        {
-          int *cls = & __cache_line_size;
-          if (cls != NULL)
-            *cls = av->a_un.a_val;
-        }
-        break;
-      }
-
-  return generic_start_main (stinfo->main, argc, ubp_av, auxvec,
-			     stinfo->init, stinfo->fini, rtld_fini,
-			     stack_on_entry);
-}
diff --git a/sysdeps/powerpc/ffs.c b/sysdeps/powerpc/ffs.c
index f45b5ea8e2..61d79c4c2f 100644
--- a/sysdeps/powerpc/ffs.c
+++ b/sysdeps/powerpc/ffs.c
@@ -1,6 +1,6 @@
 /* Find first set bit in a word, counted from least significant end.
    For PowerPC.
-   Copyright (C) 1991, 1992, 1997, 1998, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1992, 1997, 1998, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Torbjorn Granlund (tege@sics.se).
 
@@ -43,5 +43,5 @@ weak_alias (__ffs, ffsl)
 #endif
 
 #else
-#include <sysdeps/generic/ffs.c>
+#include <string/ffs.c>
 #endif
diff --git a/sysdeps/powerpc/fpu/Dist b/sysdeps/powerpc/fpu/Dist
deleted file mode 100644
index 948b04a2b3..0000000000
--- a/sysdeps/powerpc/fpu/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-fe_nomask.c
-fenv_const.c
-fenv_libc.h
-t_sqrt.c
diff --git a/sysdeps/powerpc/fpu/bits/fenvinline.h b/sysdeps/powerpc/fpu/bits/fenvinline.h
index 552c8c9db7..f7700a49e7 100644
--- a/sysdeps/powerpc/fpu/bits/fenvinline.h
+++ b/sysdeps/powerpc/fpu/bits/fenvinline.h
@@ -1,5 +1,6 @@
 /* Inline floating-point environment handling functions for powerpc.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2006
+   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
@@ -22,8 +23,9 @@
 /* Inline definition for fegetround.  */
 # define fegetround() \
   (__extension__  ({ int __fegetround_result;				      \
-		     __asm__ ("mcrfs 7,7 ; mfcr %0"			      \
-			     : "=r"(__fegetround_result) : : "cr7");	      \
+		     __asm__ __volatile__				      \
+		       ("mcrfs 7,7 ; mfcr %0"				      \
+			: "=r"(__fegetround_result) : : "cr7");		      \
 		     __fegetround_result & 3; }))
 
 /* The weird 'i#*X' constraints on the following suppress a gcc
diff --git a/sysdeps/powerpc/fpu/bits/mathdef.h b/sysdeps/powerpc/fpu/bits/mathdef.h
deleted file mode 100644
index 3a9d538ee4..0000000000
--- a/sysdeps/powerpc/fpu/bits/mathdef.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2003,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-
-/* FIXME! This file describes properties of the compiler, not the machine;
-   it should not be part of libc!
-
-   FIXME! This file does not deal with the -fshort-double option of
-   gcc! */
-
-#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF	1
-
-# ifdef __GNUC__
-#  if __STDC__ == 1
-
-/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
-typedef float float_t;		/* `float' expressions are evaluated as
-				   `float'.  */
-typedef double double_t;	/* `double' expressions are evaluated as
-				   `double'.  */
-
-#  else
-
-/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
-typedef double float_t;		/* `float' expressions are evaluated as
-				   `double'.  */
-typedef double double_t;	/* `double' expressions are evaluated as
-				   `double'.  */
-
-#  endif
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
-typedef double double_t;
-
-# endif
-
-/* The values returned by `ilogb' for 0 and NaN respectively.  */
-# define FP_ILOGB0	(-2147483647)
-# define FP_ILOGBNAN	(2147483647)
-
-#endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  The disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/powerpc/fpu/bits/mathinline.h b/sysdeps/powerpc/fpu/bits/mathinline.h
index 44f7dbec52..aed899e882 100644
--- a/sysdeps/powerpc/fpu/bits/mathinline.h
+++ b/sysdeps/powerpc/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for powerpc.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -123,20 +123,26 @@ __NTH (fdimf (float __x, float __y))
 #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
 
 /* This code is used internally in the GNU libc.  */
-#  ifdef __LIBC_INTERNAL_MATH_INLINES
+#ifdef __LIBC_INTERNAL_MATH_INLINES
 
 #include <sysdep.h>
 #include <ldsodefs.h>
 #include <dl-procinfo.h>
 
+# if __WORDSIZE == 64 || defined _ARCH_PWR4
+#  define __CPU_HAS_FSQRT 1
+# else
+#  define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+# endif
+
 extern double __slow_ieee754_sqrt (double);
 __MATH_INLINE double
 __NTH (__ieee754_sqrt (double __x))
 {
   double __z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
-  if ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
+  if (__CPU_HAS_FSQRT)
   {
     /* Volatile is required to prevent the compiler from moving the
        fsqrt instruction above the branch.  */
@@ -157,8 +163,8 @@ __NTH (__ieee754_sqrtf (float __x))
 {
   float __z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
-  if ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
+  if (__CPU_HAS_FSQRT)
   {
     /* Volatile is required to prevent the compiler from moving the
        fsqrts instruction above the branch.  */
@@ -172,5 +178,5 @@ __NTH (__ieee754_sqrtf (float __x))
 
   return __z;
 }
-#  endif /* __LIBC_INTERNAL_MATH_INLINES */
+#endif /* __LIBC_INTERNAL_MATH_INLINES */
 #endif /* __GNUC__ && !_SOFT_FLOAT */
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index eb9984d0a1..540b924656 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -24,7 +24,6 @@
 
 #include <sysdep.h>
 #include <ldsodefs.h>
-#include <dl-procinfo.h>
 
 static const double almost_half = 0.5000000000000001;	/* 0.5 + 2^-53 */
 static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
@@ -170,8 +169,8 @@ __ieee754_sqrt (x)
 {
   double z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
-  if ((GLRO (dl_hwcap) & PPC_FEATURE_64) != 0)
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
+  if (__CPU_HAS_FSQRT)
     {
       /* Volatile is required to prevent the compiler from moving the 
          fsqrt instruction above the branch.  */
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index 9b701012af..b63d31472b 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -24,7 +24,6 @@
 
 #include <sysdep.h>
 #include <ldsodefs.h>
-#include <dl-procinfo.h>
 
 static const float almost_half = 0.50000006;	/* 0.5 + 2^-24 */
 static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
@@ -147,8 +146,8 @@ __ieee754_sqrtf (x)
 {
   double z;
 
-  /* If the CPU is 64-bit we can use the optional FP instructions we.  */
-  if ((GLRO (dl_hwcap) & PPC_FEATURE_64) != 0)
+  /* If the CPU is 64-bit we can use the optional FP instructions.  */
+  if (__CPU_HAS_FSQRT)
     {
       /* Volatile is required to prevent the compiler from moving the 
          fsqrt instruction above the branch.  */
diff --git a/sysdeps/powerpc/fpu/fegetround.c b/sysdeps/powerpc/fpu/fegetround.c
index ae521fdf10..93663ad546 100644
--- a/sysdeps/powerpc/fpu/fegetround.c
+++ b/sysdeps/powerpc/fpu/fegetround.c
@@ -23,7 +23,5 @@
 int
 fegetround (void)
 {
-  int result;
-  asm ("mcrfs 7,7 ; mfcr %0" : "=r"(result) : : "cr7"); \
-  return result & 3;
+  return __fegetround();
 }
diff --git a/sysdeps/powerpc/fpu/feholdexcpt.c b/sysdeps/powerpc/fpu/feholdexcpt.c
index 8ac875cc72..150becd678 100644
--- a/sysdeps/powerpc/fpu/feholdexcpt.c
+++ b/sysdeps/powerpc/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 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
@@ -36,3 +36,4 @@ feholdexcept (fenv_t *envp)
 
   return 0;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
index 7ae12a7d2b..fd5fc0c767 100644
--- a/sysdeps/powerpc/fpu/fenv_libc.h
+++ b/sysdeps/powerpc/fpu/fenv_libc.h
@@ -1,5 +1,5 @@
 /* Internal libc stuff for floating point environment routines.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2006 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
@@ -54,6 +54,41 @@ typedef union
   unsigned int l[2];
 } fenv_union_t;
 
+
+static inline int
+__fegetround (void)
+{
+  int result;
+  asm volatile ("mcrfs 7,7\n\t"
+		"mfcr  %0" : "=r"(result) : : "cr7");
+  return result & 3;
+}
+#define fegetround() __fegetround()
+
+static inline int
+__fesetround (int round)
+{
+  if ((unsigned int) round < 2)
+    {
+       asm volatile ("mtfsb0 30");
+       if ((unsigned int) round == 0)
+         asm volatile ("mtfsb0 31");
+       else
+         asm volatile ("mtfsb1 31");
+    }
+  else
+    {
+       asm volatile ("mtfsb1 30");
+       if ((unsigned int) round == 2)
+         asm volatile ("mtfsb0 31");
+       else
+         asm volatile ("mtfsb1 31");
+    }
+
+  return 0;
+}
+#define fesetround(mode) __fesetround(mode)
+
 /* Definitions of all the FPSCR bit numbers */
 enum {
   FPSCR_FX = 0,    /* exception summary */
diff --git a/sysdeps/powerpc/fpu/fesetround.c b/sysdeps/powerpc/fpu/fesetround.c
index f7cd6af135..a7efa3bbb0 100644
--- a/sysdeps/powerpc/fpu/fesetround.c
+++ b/sysdeps/powerpc/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,22 +20,13 @@
 
 #include <fenv_libc.h>
 
+#undef fesetround
 int
 fesetround (int round)
 {
-  fenv_union_t u;
-
   if ((unsigned int) round > 3)
     return 1;
-
-  /* Get the current state.  */
-  u.fenv = fegetenv_register ();
-
-  /* Set the relevant bits.  */
-  u.l[1] = (u.l[1] & ~3)  |  (round & 3);
-
-  /* Put the new state in effect.  */
-  fesetenv_register (u.fenv);
-
-  return 0;
+  else
+    return __fesetround(round);
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 6dd3940d22..8516e915e7 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1,37 +1,57 @@
 # Begin of automatic generation
 
+# acos
+Test "acos (2e-17) == 1.57079632679489659923132169163975144":
+ildouble: 1
+ldouble: 1
+
+# asin
+Test "asin (0.75) == 0.848062078981481008052944338998418080":
+ildouble: 2
+ldouble: 2
+
 # atan2
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
+ildouble: 1
+ldouble: 1
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
 float: 1
 ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
 float: 1
 ifloat: 1
 
+# cabs
+Test "cabs (0.75 + 1.25 i) == 1.45773797371132511771853821938639577":
+ildouble: 1
+ldouble: 1
+
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
 ifloat: 3
 
 # casin
+Test "Real part of: casin (-2 - 3 i) == -0.57065278432109940071028387968566963 - 1.9833870299165354323470769028940395 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
 double: 1
 float: 1
@@ -44,11 +64,15 @@ double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 1
+ldouble: 1
 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 float: 1
 ifloat: 1
@@ -62,6 +86,8 @@ ifloat: 1
 Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
 float: 3
 ifloat: 3
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
 double: 1
 float: 1
@@ -118,9 +144,13 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
 float: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 
 # cexp
 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
@@ -129,66 +159,141 @@ ifloat: 1
 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
 float: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
 
 # clog
 Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
 float: 3
 ifloat: 3
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
 float: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # cos
 Test "cos (M_PI_6l * 2.0) == 0.5":
@@ -206,48 +311,71 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "cos (16.0) == -0.9576594803233846418996372326511034717803"
+ildouble: 2
+ldouble: 2
 
 # cpow
 Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
 double: 1
 float: 4
 idouble: 1
 ifloat: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
 double: 2
 float: 3
 idouble: 2
 ifloat: 3
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 double: 1
-float: 4
+float: 5
 idouble: 1
-ifloat: 4
+ifloat: 5
 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
 double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 # csinh
 Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # csqrt
 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
@@ -261,6 +389,9 @@ ifloat: 1
 Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
 double: 1
 idouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
 double: 1
 idouble: 1
@@ -277,6 +408,8 @@ ifloat: 1
 Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 # erf
 Test "erf (1.25) == 0.922900128256458230136523481197281140":
@@ -294,29 +427,50 @@ Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
 double: 1
 idouble: 1
 
+# exp
+Test "exp (0.75) == 2.11700001661267466854536981983709561":
+ildouble: 1
+ldouble: 1
+Test "exp (50.0) == 5184705528587072464087.45332293348538":
+ildouble: 1
+ldouble: 1
+
 # exp10
 Test "exp10 (-1) == 0.1":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "exp10 (3) == 1000":
 double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 8
+ldouble: 8
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
 
 # expm1
 Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
 double: 1
 idouble: 1
 Test "expm1 (1) == M_El - 1.0":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 
 # hypot
@@ -338,6 +492,9 @@ ifloat: 1
 Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
 float: 1
 ifloat: 1
+Test "hypot (0.75, 1.25) == 1.45773797371132511771853821938639577":
+ildouble: 1
+ldouble: 1
 Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
 float: 1
 ifloat: 1
@@ -348,78 +505,121 @@ ifloat: 1
 # j0
 Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 2
+double: 3
 float: 1
-idouble: 2
+idouble: 3
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "j0 (2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "j0 (8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # j1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "j1 (2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "j1 (8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 # jn
 Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 2
+double: 3
 float: 1
-idouble: 2
+idouble: 3
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
+float: 2
+ifloat: 2
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
 float: 1
 ifloat: 1
+ildouble: 4
+ldouble: 4
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 3
-ifloat: 3
+float: 4
+ifloat: 4
+Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
 Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
 double: 1
 float: 1
@@ -428,16 +628,23 @@ ifloat: 1
 Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
 double: 1
 idouble: 1
+Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083":
+ildouble: 1
+ldouble: 1
 Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
 double: 3
-float: 1
+float: 2
 idouble: 3
-ifloat: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
 
 # lgamma
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
@@ -450,6 +657,8 @@ double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 3
+ldouble: 3
 
 # log10
 Test "log10 (0.75) == -0.124938736608299953132449886193870744":
@@ -466,6 +675,16 @@ Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
 float: 1
 ifloat: 1
 
+# log2
+Test "log2 (e) == M_LOG2El":
+ildouble: 1
+ldouble: 1
+
+# sin
+Test "sin (16.0) == -0.2879033166650652947844562482186175296207"
+ildouble: 2
+ldouble: 2
+
 # sincos
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
 double: 1
@@ -486,10 +705,25 @@ Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646763723170752936
 float: 1
 ifloat: 1
 
+# sinh
+Test "sinh (0.75) == 0.822316731935829980703661634446913849":
+ildouble: 1
+ldouble: 1
+
 # tan
 Test "tan (pi/4) == 1":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
+
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
 
 # tgamma
 Test "tgamma (-0.5) == -2 sqrt (pi)":
@@ -507,11 +741,19 @@ idouble: 1
 ifloat: 1
 
 # y0
+Test "y0 (0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "y0 (0.75) == -0.137172769385772397522814379396581855":
+ildouble: 1
+ldouble: 1
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y0 (1.5) == 0.382448923797758843955068554978089862":
 double: 2
 float: 1
@@ -522,6 +764,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y0 (2.0) == 0.510375672649745119596606592727157873":
 double: 1
 idouble: 1
@@ -530,30 +774,50 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # y1
+Test "y1 (0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "y1 (1.5) == -0.412308626973911295952829820633445323":
+float: 1
+ifloat: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
 idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "y1 (2.0) == -0.107032431540937546888370772277476637":
 double: 1
 float: 1
-idouble: 1
-ifloat: 1
+idouble: 2
+ifloat: 2
 Test "y1 (8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 # yn
+Test "yn (0, 0.125) == -1.38968062514384052915582277745018693":
+ildouble: 1
+ldouble: 1
+Test "yn (0, 0.75) == -0.137172769385772397522814379396581855":
+ildouble: 1
+ldouble: 1
 Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
 double: 2
 float: 1
@@ -564,6 +828,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
 double: 1
 idouble: 1
@@ -572,11 +838,21 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
+double: 1
+idouble: 1
+Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
+float: 2
+ifloat: 2
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
 idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
 double: 1
 float: 1
@@ -587,6 +863,14 @@ double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
+Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
+double: 1
+idouble: 1
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
 double: 1
 float: 2
@@ -597,12 +881,21 @@ float: 2
 ifloat: 2
 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
 double: 2
+float: 2
 idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
 double: 3
 float: 1
 idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
+double: 1
+idouble: 1
 Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
 float: 1
 ifloat: 1
@@ -611,24 +904,58 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
 double: 1
 idouble: 1
 
 # Maximal error of functions:
+Function: "acos":
+ildouble: 1
+ldouble: 1
+
+Function: "acosh":
+ildouble: 1
+ldouble: 1
+
+Function: "asin":
+ildouble: 2
+ldouble: 2
+
+Function: "asinh":
+ildouble: 1
+ldouble: 1
+
 Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "atanh":
 float: 1
 ifloat: 1
 
+Function: "cabs":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacos":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "cacosh":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "cacosh":
 double: 1
@@ -641,28 +968,42 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "casinh":
 double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 
 Function: Imaginary part of "casinh":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "catan":
 float: 4
 ifloat: 4
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "catan":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "catanh":
 double: 4
@@ -675,118 +1016,190 @@ ifloat: 6
 Function: "cbrt":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccos":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccosh":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccosh":
 float: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 
 Function: Imaginary part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "clog":
 float: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 
 Function: Imaginary part of "clog":
 float: 3
 ifloat: 3
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "clog10":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 Function: Imaginary part of "clog10":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 
 Function: "cos":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cosh":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cpow":
 double: 2
-float: 4
+float: 5
 idouble: 2
-ifloat: 4
+ifloat: 5
+ildouble: 2
+ldouble: 2
 
 Function: Imaginary part of "cpow":
 double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cproj":
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "csinh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "csinh":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "csqrt":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ctan":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctan":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ctanh":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctanh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "erf":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: "erfc":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "exp":
+ildouble: 1
+ldouble: 1
 
 Function: "exp10":
 double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 8
+ldouble: 8
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
 
 Function: "expm1":
 double: 1
@@ -794,76 +1207,130 @@ float: 1
 idouble: 1
 ifloat: 1
 
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
 Function: "hypot":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "j0":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "j1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "jn":
 double: 3
-float: 3
+float: 4
 idouble: 3
-ifloat: 3
+ifloat: 4
+ildouble: 4
+ldouble: 4
 
 Function: "lgamma":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "log":
+ildouble: 1
+ldouble: 1
 
 Function: "log10":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log1p":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
+
+Function: "pow":
+ildouble: 1
+ldouble: 1
+
+Function: "sin":
+ildouble: 1
+ldouble: 1
 
 Function: "sincos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sinh":
+ildouble: 1
+ldouble: 1
 
 Function: "tan":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "tanh":
+ildouble: 1
+ldouble: 1
 
 Function: "tgamma":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "y0":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "y1":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 Function: "yn":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 # end of automatic generation
diff --git a/sysdeps/powerpc/fpu/math_ldbl.h b/sysdeps/powerpc/fpu/math_ldbl.h
new file mode 100644
index 0000000000..6cd6d0bdfe
--- /dev/null
+++ b/sysdeps/powerpc/fpu/math_ldbl.h
@@ -0,0 +1,189 @@
+#ifndef _MATH_PRIVATE_H_
+#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
+#endif
+
+#include <sysdeps/ieee754/ldbl-128/math_ldbl.h>
+#include <ieee754.h>
+  
+static inline void
+ldbl_extract_mantissa (int64_t *hi64, u_int64_t *lo64, int *exp, long double x)
+{
+  /* We have 105 bits of mantissa plus one implicit digit.  Since
+     106 bits are representable we use the first implicit digit for
+     the number before the decimal point and the second implicit bit
+     as bit 53 of the mantissa.  */
+  unsigned long long hi, lo;
+  int ediff;
+  union ibm_extended_long_double eldbl;
+  eldbl.d = x;
+  *exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
+
+  lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
+  hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
+  /* If the lower double is not a denomal or zero then set the hidden
+     53rd bit.  */
+  if (eldbl.ieee.exponent2 > 0x001)
+    {
+      lo |= (1ULL << 52);
+      lo = lo << 7; /* pre-shift lo to match ieee854.  */
+      /* The lower double is normalized separately from the upper.  We
+	 may need to adjust the lower manitissa to reflect this.  */
+      ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
+      if (ediff > 53)
+	lo = lo >> (ediff-53);
+    }
+  hi |= (1ULL << 52);
+  
+  if ((eldbl.ieee.negative != eldbl.ieee.negative2)
+      && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
+    {
+      hi--;
+      lo = (1ULL << 60) - lo;
+      if (hi < (1ULL << 52))
+	{
+	  /* we have a borrow from the hidden bit, so shift left 1.  */
+	  hi = (hi << 1) | (lo >> 59);
+	  lo = 0xfffffffffffffffLL & (lo << 1);
+	  *exp = *exp - 1;
+	}
+    }
+  *lo64 = (hi << 60) | lo;
+  *hi64 = hi >> 4;
+}
+
+static inline long double
+ldbl_insert_mantissa (int sign, int exp, int64_t hi64, u_int64_t lo64)
+{
+  union ibm_extended_long_double u;
+  unsigned long hidden2, lzcount;
+  unsigned long long hi, lo;
+
+  u.ieee.negative = sign;
+  u.ieee.negative2 = sign;
+  u.ieee.exponent = exp + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+  u.ieee.exponent2 = exp-53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
+  /* Expect 113 bits (112 bits + hidden) right justified in two longs.
+     The low order 53 bits (52 + hidden) go into the lower double */ 
+  lo = (lo64 >> 7)& ((1ULL << 53) - 1);
+  hidden2 = (lo64 >> 59) &  1ULL;
+  /* The high order 53 bits (52 + hidden) go into the upper double */
+  hi = (lo64 >> 60) & ((1ULL << 11) - 1);
+  hi |= (hi64 << 4);
+
+  if (lo != 0LL)
+    {
+      /* hidden2 bit of low double controls rounding of the high double.
+	 If hidden2 is '1' then round up hi and adjust lo (2nd mantissa)
+	 plus change the sign of the low double to compensate.  */
+      if (hidden2)
+	{
+	  hi++;
+	  u.ieee.negative2 = !sign;
+	  lo = (1ULL << 53) - lo;
+	}
+      /* The hidden bit of the lo mantissa is zero so we need to
+	 normalize the it for the low double.  Shift it left until the
+	 hidden bit is '1' then adjust the 2nd exponent accordingly.  */ 
+
+      if (sizeof (lo) == sizeof (long))
+	lzcount = __builtin_clzl (lo);
+      else if ((lo >> 32) != 0)
+	lzcount = __builtin_clzl ((long) (lo >> 32));
+      else
+	lzcount = __builtin_clzl ((long) lo) + 32;
+      lzcount = lzcount - 11;
+      if (lzcount > 0)
+	{
+	  int expnt2 = u.ieee.exponent2 - lzcount;
+	  if (expnt2 >= 1)
+	    {
+	      /* Not denormal.  Normalize and set low exponent.  */
+	      lo = lo << lzcount;
+	      u.ieee.exponent2 = expnt2;
+	    }
+	  else
+	    {
+	      /* Is denormal.  */
+	      lo = lo << (lzcount + expnt2);
+	      u.ieee.exponent2 = 0;
+	    }
+	}
+    }
+  else
+    {
+      u.ieee.negative2 = 0;
+      u.ieee.exponent2 = 0;
+    }
+
+  u.ieee.mantissa3 = lo & ((1ULL << 32) - 1);
+  u.ieee.mantissa2 = (lo >> 32) & ((1ULL << 20) - 1);
+  u.ieee.mantissa1 = hi & ((1ULL << 32) - 1);
+  u.ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1);
+  return u.d;
+}
+  
+/* gcc generates disgusting code to pack and unpack long doubles.
+   This tells gcc that pack/unpack is really a nop.  We use fr1/fr2
+   because those are the regs used to pass/return a single
+   long double arg.  */
+static inline long double
+ldbl_pack (double a, double aa)
+{
+  register long double x __asm__ ("fr1");
+  register double xh __asm__ ("fr1");
+  register double xl __asm__ ("fr2");
+  xh = a;
+  xl = aa;
+  __asm__ ("" : "=f" (x) : "f" (xh), "f" (xl));
+  return x;
+}
+
+static inline void
+ldbl_unpack (long double l, double *a, double *aa)
+{
+  register long double x __asm__ ("fr1");
+  register double xh __asm__ ("fr1");
+  register double xl __asm__ ("fr2");
+  x = l;
+  __asm__ ("" : "=f" (xh), "=f" (xl) : "f" (x));
+  *a = xh;
+  *aa = xl;
+}
+
+
+/* Convert a finite long double to canonical form.
+   Does not handle +/-Inf properly.  */
+static inline void
+ldbl_canonicalize (double *a, double *aa)
+{
+  double xh, xl;
+
+  xh = *a + *aa;
+  xl = (*a - xh) + *aa;
+  *a = xh;
+  *aa = xl;
+}
+
+/* Simple inline nearbyint (double) function .
+   Only works in the default rounding mode
+   but is useful in long double rounding functions.  */
+static inline double
+ldbl_nearbyint (double a)
+{
+  double two52 = 0x10000000000000LL;
+
+  if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
+    {
+      if (__builtin_expect ((a > 0.0), 1))
+	{
+	  a += two52;
+	  a -= two52;
+	}
+      else if (__builtin_expect ((a < 0.0), 1))
+	{
+	  a = two52 - a;
+	  a = -(a - two52);
+	}
+    }
+  return a;
+}
diff --git a/sysdeps/powerpc/fpu/s_fabs.S b/sysdeps/powerpc/fpu/s_fabs.S
index 157ef09507..ab9a3a99bb 100644
--- a/sysdeps/powerpc/fpu/s_fabs.S
+++ b/sysdeps/powerpc/fpu/s_fabs.S
@@ -25,13 +25,13 @@ ENTRY(__fabs)
 	blr
 END(__fabs)
 
-weak_alias(__fabs,fabs)
+weak_alias (__fabs,fabs)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
 strong_alias(__fabs,__fabsf)
-weak_alias(__fabs,fabsf)
+weak_alias (__fabs,fabsf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__fabs,__fabsl)
-weak_alias(__fabs,fabsl)
+weak_alias (__fabs,__fabsl)
+weak_alias (__fabs,fabsl)
 #endif
diff --git a/sysdeps/powerpc/fpu/s_fmax.S b/sysdeps/powerpc/fpu/s_fmax.S
index 5666cdd079..8502c863b2 100644
--- a/sysdeps/powerpc/fpu/s_fmax.S
+++ b/sysdeps/powerpc/fpu/s_fmax.S
@@ -31,13 +31,13 @@ ENTRY(__fmax)
 	blr
 END(__fmax)
 
-weak_alias(__fmax,fmax)
+weak_alias (__fmax,fmax)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
 strong_alias(__fmax,__fmaxf)
-weak_alias(__fmax,fmaxf)
+weak_alias (__fmax,fmaxf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__fmax,__fmaxl)
-weak_alias(__fmax,fmaxl)
+weak_alias (__fmax,__fmaxl)
+weak_alias (__fmax,fmaxl)
 #endif
diff --git a/sysdeps/powerpc/fpu/s_fmin.S b/sysdeps/powerpc/fpu/s_fmin.S
index 96387d9ae1..5f788d06f3 100644
--- a/sysdeps/powerpc/fpu/s_fmin.S
+++ b/sysdeps/powerpc/fpu/s_fmin.S
@@ -31,13 +31,13 @@ ENTRY(__fmin)
 	blr
 END(__fmin)
 
-weak_alias(__fmin,fmin)
+weak_alias (__fmin,fmin)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
 strong_alias(__fmin,__fminf)
-weak_alias(__fmin,fminf)
+weak_alias (__fmin,fminf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__fmin,__fminl)
-weak_alias(__fmin,fminl)
+weak_alias (__fmin,__fminl)
+weak_alias (__fmin,fminl)
 #endif
diff --git a/sysdeps/powerpc/fpu/s_isnan.c b/sysdeps/powerpc/fpu/s_isnan.c
index 38ec821cc3..f3313c7b08 100644
--- a/sysdeps/powerpc/fpu/s_isnan.c
+++ b/sysdeps/powerpc/fpu/s_isnan.c
@@ -1,5 +1,5 @@
 /* Return 1 if argument is a NaN, else 0.
-   Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2002, 2006 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
@@ -23,6 +23,7 @@
 #define __GI___isnanf __GI___Xisnanf
 
 #include "math.h"
+#include <math_ldbl_opt.h>
 #include <fenv_libc.h>
 
 #undef __isnanf
diff --git a/sysdeps/powerpc/fpu/w_sqrtf.c b/sysdeps/powerpc/fpu/w_sqrtf.c
index e3f3c995e8..54b4f3be7f 100644
--- a/sysdeps/powerpc/fpu/w_sqrtf.c
+++ b/sysdeps/powerpc/fpu/w_sqrtf.c
@@ -23,7 +23,6 @@
 
 #include <sysdep.h>
 #include <ldsodefs.h>
-#include <dl-procinfo.h>
 
 #ifdef __STDC__
 float
diff --git a/sysdeps/powerpc/jmpbuf-offsets.h b/sysdeps/powerpc/jmpbuf-offsets.h
new file mode 100644
index 0000000000..5f74a85af6
--- /dev/null
+++ b/sysdeps/powerpc/jmpbuf-offsets.h
@@ -0,0 +1,39 @@
+/* Private macros for accessing __jmp_buf contents.  PowerPC version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define JB_GPR1   0  /* Also known as the stack pointer */
+#define JB_GPR2   1
+#define JB_LR     2  /* The address we will return to */
+#if __WORDSIZE == 64
+# define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18*2 words total.  */
+# define JB_CR     21 /* Condition code registers with the VRSAVE at */
+                       /* offset 172 (low half of the double word.  */
+# define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total.  */
+# define JB_SIZE   (64 * 8) /* As per PPC64-VMX ABI.  */
+# define JB_VRSAVE 21 /* VRSAVE shares a double word with the CR at offset */
+                       /* 168 (high half of the double word).  */
+# define JB_VRS    40 /* VRs 20 through 31 are saved, 12*4 words total.  */
+#else
+# define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18 in total.  */
+# define JB_CR     21 /* Condition code registers.  */
+# define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total.  */
+# define JB_SIZE   ((64 + (12 * 4)) * 4)
+# define JB_VRSAVE 62
+# define JB_VRS    64
+#endif
diff --git a/sysdeps/powerpc/jmpbuf-unwind.h b/sysdeps/powerpc/jmpbuf-unwind.h
new file mode 100644
index 0000000000..20bab7560e
--- /dev/null
+++ b/sysdeps/powerpc/jmpbuf-unwind.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
+  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_GPR1]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_GPR1];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/powerpc/nofpu/Dist b/sysdeps/powerpc/nofpu/Dist
deleted file mode 100644
index 35a33ab2d5..0000000000
--- a/sysdeps/powerpc/nofpu/Dist
+++ /dev/null
@@ -1,3 +0,0 @@
-sim-full.c
-fenv_const.c
-soft-supp.h
diff --git a/sysdeps/powerpc/nofpu/Makefile b/sysdeps/powerpc/nofpu/Makefile
deleted file mode 100644
index f85cb0b7a3..0000000000
--- a/sysdeps/powerpc/nofpu/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# Makefile fragment for PowerPC with no FPU.
-
-ifeq ($(subdir),soft-fp)
-sysdep_routines += $(gcc-single-routines) $(gcc-double-routines) sim-full
-endif
-
-ifeq ($(subdir),math)
-libm-support += fenv_const fe_nomask
-endif
diff --git a/sysdeps/powerpc/nofpu/Versions b/sysdeps/powerpc/nofpu/Versions
deleted file mode 100644
index 4103db50bf..0000000000
--- a/sysdeps/powerpc/nofpu/Versions
+++ /dev/null
@@ -1,13 +0,0 @@
-libc {
-  GLIBC_2.3.2 {
-    __sim_exceptions; __sim_disabled_exceptions; __sim_round_mode;
-    __adddf3; __addsf3; __divdf3; __divsf3; __eqdf2; __eqsf2;
-    __extendsfdf2; __fixdfdi; __fixdfsi; __fixsfdi; __fixsfsi;
-    __fixtfdi; __fixtfsi;
-    __fixunsdfdi; __fixunsdfsi; __fixunssfdi; __fixunssfsi;
-    __floatdidf; __floatdisf; __floatsidf; __floatsisf;
-    __gedf2; __gesf2; __ledf2; __lesf2; __muldf3; __mulsf3;
-    __negdf2; __negsf2; __sqrtdf2; __sqrtsf2; __subdf3;
-    __subsf3; __truncdfsf2; __trunctfsf2;
-  }
-}
diff --git a/sysdeps/powerpc/nofpu/fclrexcpt.c b/sysdeps/powerpc/nofpu/fclrexcpt.c
deleted file mode 100644
index 16e96baeaf..0000000000
--- a/sysdeps/powerpc/nofpu/fclrexcpt.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Clear floating-point exceptions (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-
-int
-__feclearexcept (int x)
-{
-  __sim_exceptions &= ~x;
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feclearexcept, __old_feclearexcept)
-compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/fedisblxcpt.c b/sysdeps/powerpc/nofpu/fedisblxcpt.c
deleted file mode 100644
index 3d8dd4462f..0000000000
--- a/sysdeps/powerpc/nofpu/fedisblxcpt.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Disable exceptions (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-#include <fenv.h>
-
-int
-fedisableexcept (int x)
-{
-  int old_exceptions = ~__sim_disabled_exceptions & FE_ALL_EXCEPT;
-
-  __sim_disabled_exceptions |= x;
-
-  return old_exceptions;
-}
diff --git a/sysdeps/powerpc/nofpu/feenablxcpt.c b/sysdeps/powerpc/nofpu/feenablxcpt.c
deleted file mode 100644
index 060e450590..0000000000
--- a/sysdeps/powerpc/nofpu/feenablxcpt.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Enable exceptions (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-extern int __sim_disabled_exceptions;
-
-int
-feenableexcept (int exceptions)
-{
-  int old_exceptions = ~__sim_disabled_exceptions & FE_ALL_EXCEPT;
-
-  __sim_disabled_exceptions &= ~exceptions;
-
-  return old_exceptions;
-}
diff --git a/sysdeps/powerpc/nofpu/fegetenv.c b/sysdeps/powerpc/nofpu/fegetenv.c
deleted file mode 100644
index 3cc8b13dac..0000000000
--- a/sysdeps/powerpc/nofpu/fegetenv.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Store current floating-point environment (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-#include <bp-sym.h>
-
-extern int __sim_exceptions;
-extern int __sim_disabled_exceptions;
-extern int __sim_round_mode;
-
-int
-__fegetenv (fenv_t *envp)
-{
-  fenv_union_t u;
-
-  u.l[0] = __sim_exceptions;
-  u.l[0] |= __sim_round_mode;
-  u.l[1] = __sim_disabled_exceptions;
-
-  *envp = u.fenv;
-
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fegetenv, __old_fegetenv)
-compat_symbol (libm, BP_SYM (__old_fegetenv), BP_SYM (fegetenv), GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, BP_SYM (__fegetenv), BP_SYM (fegetenv), GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/fegetexcept.c b/sysdeps/powerpc/nofpu/fegetexcept.c
deleted file mode 100644
index 0a47a09ac0..0000000000
--- a/sysdeps/powerpc/nofpu/fegetexcept.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Get floating-point exceptions (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-
-int
-fegetexcept (void)
-{
-  return (__sim_disabled_exceptions ^ FE_ALL_EXCEPT) & FE_ALL_EXCEPT;
-}
diff --git a/sysdeps/powerpc/nofpu/fegetround.c b/sysdeps/powerpc/nofpu/fegetround.c
deleted file mode 100644
index 0d01e4411f..0000000000
--- a/sysdeps/powerpc/nofpu/fegetround.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Return current rounding mode (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-
-#undef fegetround
-int
-fegetround (void)
-{
-  return __sim_round_mode;
-}
diff --git a/sysdeps/powerpc/nofpu/feholdexcpt.c b/sysdeps/powerpc/nofpu/feholdexcpt.c
deleted file mode 100644
index 786c691a4b..0000000000
--- a/sysdeps/powerpc/nofpu/feholdexcpt.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Store current floating-point environment and clear exceptions
-   (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-
-int
-feholdexcept (fenv_t *envp)
-{
-  fenv_union_t u;
-
-  /* Get the current state.  */
-  fegetenv (envp);
-
-  u.fenv = *envp;
-  /* Clear everything except the rounding mode.  */
-  u.l[0] &= 0x3;
-
-  /* ?? Should we clear the disabled exceptions as well ?? */
-
-  /* Put the new state in effect.  */
-  fesetenv (envp);
-
-  return 0;
-}
diff --git a/sysdeps/powerpc/nofpu/fenv_const.c b/sysdeps/powerpc/nofpu/fenv_const.c
deleted file mode 100644
index 7dc2e817c8..0000000000
--- a/sysdeps/powerpc/nofpu/fenv_const.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Constants for fenv_bits.h (soft float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* We want to specify the bit pattern of the __fe_*_env constants, so 
-   pretend they're really `long long' instead of `double'.  */
-
-/* If the default argument is used we use this value.  Disable all
-   signalling exceptions as default.  */
-const unsigned long long __fe_dfl_env __attribute__ ((aligned (8))) = 
-0x000000003e000000ULL;
-
-/* Floating-point environment where none of the exceptions are masked.  */
-const unsigned long long __fe_enabled_env __attribute__ ((aligned (8))) = 
-0xfff80000000000f8ULL;
-
-/* Floating-point environment with the NI bit set.  */
-const unsigned long long __fe_nonieee_env __attribute__ ((aligned (8))) = 
-0xfff8000000000004ULL;
diff --git a/sysdeps/powerpc/nofpu/fesetenv.c b/sysdeps/powerpc/nofpu/fesetenv.c
deleted file mode 100644
index 43d03a45e2..0000000000
--- a/sysdeps/powerpc/nofpu/fesetenv.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Set floating point environment (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-#include <bp-sym.h>
-
-extern int __sim_exceptions attribute_hidden;
-extern int __sim_disabled_exceptions attribute_hidden;
-extern int __sim_round_mode attribute_hidden;
-
-int
-__fesetenv (const fenv_t *envp)
-{
-  fenv_union_t u;
-
-  u.fenv = *envp;
-  __sim_exceptions = u.l[0] & FE_ALL_EXCEPT;
-  __sim_round_mode = u.l[0] & 0x3;
-  __sim_disabled_exceptions = u.l[1];
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetenv, __old_fesetenv)
-compat_symbol (libm, BP_SYM (__old_fesetenv), BP_SYM (fesetenv), GLIBC_2_1);
-#endif
-
-libm_hidden_ver (__fesetenv, fesetenv)
-versioned_symbol (libm, BP_SYM (__fesetenv), BP_SYM (fesetenv), GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/fesetround.c b/sysdeps/powerpc/nofpu/fesetround.c
deleted file mode 100644
index 842614a974..0000000000
--- a/sysdeps/powerpc/nofpu/fesetround.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Set rounding mode (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-
-int
-fesetround (int round)
-{
-  if ((unsigned int) round > FE_DOWNWARD)
-    return 1;
-
-  __sim_round_mode = round;
-
-  return 0;
-}
diff --git a/sysdeps/powerpc/nofpu/feupdateenv.c b/sysdeps/powerpc/nofpu/feupdateenv.c
deleted file mode 100644
index 5073776e7d..0000000000
--- a/sysdeps/powerpc/nofpu/feupdateenv.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Install given floating-point environment and raise exceptions
-   (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-#include <bp-sym.h>
-
-int
-__feupdateenv (const fenv_t *envp)
-{
-  fenv_union_t u;
-  int saved_exceptions;
-
-  /* Save currently set exceptions.  */
-  saved_exceptions = __sim_exceptions;
-
-  /* Set environment.  */
-  fesetenv (envp);
-
-  /* Raise old exceptions.  */
-  __sim_exceptions |= saved_exceptions;
-
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feupdateenv, __old_feupdateenv)
-compat_symbol (libm, BP_SYM (__old_feupdateenv), BP_SYM (feupdateenv), GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, BP_SYM (__feupdateenv), BP_SYM (feupdateenv), GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/fgetexcptflg.c b/sysdeps/powerpc/nofpu/fgetexcptflg.c
deleted file mode 100644
index 713bd92881..0000000000
--- a/sysdeps/powerpc/nofpu/fgetexcptflg.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Store current representation for exceptions (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-#include <bp-sym.h>
-
-__fegetexceptflag (fexcept_t *flagp, int excepts)
-{
-  *flagp = (fexcept_t) __sim_exceptions  & excepts & FE_ALL_EXCEPT;
-
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fegetexceptflag, __old_fegetexceptflag)
-compat_symbol (libm, BP_SYM (__old_fegetexceptflag), BP_SYM (fegetexceptflag), GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, BP_SYM (__fegetexceptflag), BP_SYM (fegetexceptflag), GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/fraiseexcpt.c b/sysdeps/powerpc/nofpu/fraiseexcpt.c
deleted file mode 100644
index cd915027e1..0000000000
--- a/sysdeps/powerpc/nofpu/fraiseexcpt.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Raise given exceptions (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-#include <signal.h>
-#include <bp-sym.h>
-
-#undef feraiseexcept
-int
-__feraiseexcept (int x)
-{
-  __sim_exceptions |= x;
-  if (x == 0 || __sim_disabled_exceptions & x)
-    /* Ignore exception.  */
-    ;
-  else
-    raise (SIGFPE);
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__feraiseexcept, __old_feraiseexcept)
-compat_symbol (libm, BP_SYM (__old_feraiseexcept), BP_SYM (feraiseexcept), GLIBC_2_1);
-#endif
-
-libm_hidden_ver (__feraiseexcept, feraiseexcept)
-versioned_symbol (libm, BP_SYM (__feraiseexcept), BP_SYM (feraiseexcept), GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/fsetexcptflg.c b/sysdeps/powerpc/nofpu/fsetexcptflg.c
deleted file mode 100644
index 85fd88f01f..0000000000
--- a/sysdeps/powerpc/nofpu/fsetexcptflg.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Set floating-point environment exception handling (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-#include <bp-sym.h>
-
-int
-__fesetexceptflag(const fexcept_t *flagp, int excepts)
-{
-  /* Ignore exceptions not listed in 'excepts'.  */
-  __sim_exceptions = *flagp & excepts;
-
-  return 0;
-}
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
-strong_alias (__fesetexceptflag, __old_fesetexceptflag)
-compat_symbol (libm, BP_SYM (__old_fesetexceptflag), BP_SYM (fesetexceptflag), GLIBC_2_1);
-#endif
-
-versioned_symbol (libm, BP_SYM (__fesetexceptflag), BP_SYM (fesetexceptflag), GLIBC_2_2);
diff --git a/sysdeps/powerpc/nofpu/ftestexcept.c b/sysdeps/powerpc/nofpu/ftestexcept.c
deleted file mode 100644
index ce8044fe0a..0000000000
--- a/sysdeps/powerpc/nofpu/ftestexcept.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Test floating-point exceptions (soft-float edition).
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "soft-supp.h"
-
-int
-fetestexcept (int x)
-{
-  return __sim_exceptions & x;
-}
diff --git a/sysdeps/powerpc/nofpu/libm-test-ulps b/sysdeps/powerpc/nofpu/libm-test-ulps
deleted file mode 100644
index 73172b49a0..0000000000
--- a/sysdeps/powerpc/nofpu/libm-test-ulps
+++ /dev/null
@@ -1,890 +0,0 @@
-# Begin of automatic generation
-
-# atan2
-Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
-Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
-Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
-float: 1
-ifloat: 1
-
-# atanh
-Test "atanh (0.75) == 0.972955074527656652552676371721589865":
-float: 1
-ifloat: 1
-
-# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-# casin
-Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# casinh
-Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# catan
-Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-float: 3
-ifloat: 3
-Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
-float: 4
-ifloat: 4
-
-# catanh
-Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-double: 4
-idouble: 4
-Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
-float: 4
-ifloat: 4
-Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
-float: 6
-ifloat: 6
-
-# cbrt
-Test "cbrt (-27.0) == -3.0":
-double: 1
-idouble: 1
-Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
-double: 1
-idouble: 1
-Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
-double: 1
-idouble: 1
-
-# ccos
-Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
-float: 1
-ifloat: 1
-
-# ccosh
-Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
-float: 1
-ifloat: 1
-Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
-float: 1
-ifloat: 1
-
-# cexp
-Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
-float: 1
-ifloat: 1
-Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
-float: 1
-ifloat: 1
-
-# clog
-Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
-float: 3
-ifloat: 3
-Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
-float: 1
-ifloat: 1
-
-# clog10
-Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
-float: 1
-ifloat: 1
-
-# cos
-Test "cos (M_PI_6l * 2.0) == 0.5":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "cos (M_PI_6l * 4.0) == -0.5":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "cos (pi/2) == 0":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# cpow
-Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
-float: 1
-ifloat: 1
-Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
-double: 2
-float: 3
-idouble: 2
-ifloat: 3
-Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-double: 1
-float: 4
-idouble: 1
-ifloat: 4
-Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
-float: 2
-ifloat: 2
-Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-# csinh
-Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
-double: 1
-idouble: 1
-Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
-float: 1
-ifloat: 1
-
-# csqrt
-Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
-float: 1
-ifloat: 1
-
-# ctan
-Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-double: 1
-idouble: 1
-Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
-double: 1
-idouble: 1
-
-# ctanh
-Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
-float: 1
-ifloat: 1
-Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
-double: 1
-idouble: 1
-
-# erf
-Test "erf (1.25) == 0.922900128256458230136523481197281140":
-double: 1
-idouble: 1
-
-# erfc
-Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
-double: 1
-idouble: 1
-Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
-double: 1
-idouble: 1
-
-# exp10
-Test "exp10 (-1) == 0.1":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "exp10 (3) == 1000":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-# expm1
-Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
-double: 1
-idouble: 1
-Test "expm1 (1) == M_El - 1.0":
-float: 1
-ifloat: 1
-
-# hypot
-Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
-float: 1
-ifloat: 1
-
-# j0
-Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "j0 (0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "j0 (2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
-Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "j0 (8.0) == 0.171650807137553906090869407851972001":
-float: 1
-ifloat: 1
-
-# j1
-Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-Test "j1 (2.0) == 0.576724807756873387202448242269137087":
-double: 1
-idouble: 1
-Test "j1 (8.0) == 0.234636346853914624381276651590454612":
-double: 1
-idouble: 1
-
-# jn
-Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
-float: 1
-ifloat: 1
-Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
-float: 2
-ifloat: 2
-Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
-float: 1
-ifloat: 1
-Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
-float: 2
-ifloat: 2
-Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
-double: 1
-idouble: 1
-Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
-double: 1
-idouble: 1
-Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
-double: 4
-float: 3
-idouble: 4
-ifloat: 3
-Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
-float: 4
-ifloat: 4
-Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# lgamma
-Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# log10
-Test "log10 (0.75) == -0.124938736608299953132449886193870744":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "log10 (e) == log10(e)":
-float: 1
-ifloat: 1
-
-# log1p
-Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
-float: 1
-ifloat: 1
-
-# sincos
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
-float: 1
-ifloat: 1
-
-# tan
-Test "tan (pi/4) == 1":
-double: 1
-idouble: 1
-
-# tgamma
-Test "tgamma (-0.5) == -2 sqrt (pi)":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "tgamma (0.5) == sqrt (pi)":
-float: 1
-ifloat: 1
-Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y0
-Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (1.5) == 0.382448923797758843955068554978089862":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
-float: 1
-ifloat: 1
-Test "y0 (8.0) == 0.223521489387566220527323400498620359":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-# y1
-Test "y1 (0.125) == -5.19993611253477499595928744876579921":
-double: 1
-idouble: 1
-Test "y1 (1.5) == -0.412308626973911295952829820633445323":
-float: 1
-ifloat: 1
-Test "y1 (10.0) == 0.249015424206953883923283474663222803":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "y1 (2.0) == -0.107032431540937546888370772277476637":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "y1 (8.0) == -0.158060461731247494255555266187483550":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-# yn
-Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
-float: 1
-ifloat: 1
-Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
-double: 1
-idouble: 1
-Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
-float: 1
-ifloat: 1
-Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
-double: 3
-float: 1
-idouble: 3
-ifloat: 1
-Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
-double: 1
-idouble: 1
-Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
-double: 1
-idouble: 1
-Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
-double: 2
-idouble: 2
-Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
-double: 1
-idouble: 1
-Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
-double: 1
-idouble: 1
-
-# Maximal error of functions:
-Function: "atan2":
-float: 3
-ifloat: 3
-
-Function: "atanh":
-float: 1
-ifloat: 1
-
-Function: Real part of "cacosh":
-double: 1
-float: 7
-idouble: 1
-ifloat: 7
-
-Function: Imaginary part of "cacosh":
-double: 1
-float: 3
-idouble: 1
-ifloat: 3
-
-Function: Real part of "casin":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "casinh":
-double: 5
-float: 1
-idouble: 5
-ifloat: 1
-
-Function: Imaginary part of "casinh":
-double: 3
-float: 6
-idouble: 3
-ifloat: 6
-
-Function: Real part of "catan":
-float: 4
-ifloat: 4
-
-Function: Imaginary part of "catan":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "catanh":
-double: 4
-idouble: 4
-
-Function: Imaginary part of "catanh":
-float: 6
-ifloat: 6
-
-Function: "cbrt":
-double: 1
-idouble: 1
-
-Function: Real part of "ccos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ccos":
-float: 1
-ifloat: 1
-
-Function: Real part of "ccosh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Imaginary part of "ccosh":
-float: 1
-ifloat: 1
-
-Function: Real part of "cexp":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "cexp":
-float: 1
-ifloat: 1
-
-Function: Real part of "clog":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "clog":
-float: 3
-ifloat: 3
-
-Function: Real part of "clog10":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "clog10":
-double: 1
-float: 5
-idouble: 1
-ifloat: 5
-
-Function: "cos":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: Real part of "cpow":
-double: 2
-float: 4
-idouble: 2
-ifloat: 4
-
-Function: Imaginary part of "cpow":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: Real part of "csinh":
-float: 1
-ifloat: 1
-
-Function: Imaginary part of "csinh":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: Real part of "csqrt":
-float: 1
-ifloat: 1
-
-Function: Real part of "ctan":
-double: 1
-idouble: 1
-
-Function: Imaginary part of "ctan":
-double: 1
-idouble: 1
-
-Function: Real part of "ctanh":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: Imaginary part of "ctanh":
-float: 1
-ifloat: 1
-
-Function: "erf":
-double: 1
-idouble: 1
-
-Function: "erfc":
-double: 1
-idouble: 1
-
-Function: "exp10":
-double: 6
-float: 2
-idouble: 6
-ifloat: 2
-
-Function: "expm1":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "hypot":
-float: 1
-ifloat: 1
-
-Function: "j0":
-double: 2
-float: 2
-idouble: 2
-ifloat: 2
-
-Function: "j1":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "jn":
-double: 4
-float: 4
-idouble: 4
-ifloat: 4
-
-Function: "lgamma":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "log10":
-double: 1
-float: 2
-idouble: 1
-ifloat: 2
-
-Function: "log1p":
-float: 1
-ifloat: 1
-
-Function: "sincos":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "tan":
-double: 1
-idouble: 1
-
-Function: "tgamma":
-double: 1
-float: 1
-idouble: 1
-ifloat: 1
-
-Function: "y0":
-double: 2
-float: 1
-idouble: 2
-ifloat: 1
-
-Function: "y1":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-Function: "yn":
-double: 3
-float: 2
-idouble: 3
-ifloat: 2
-
-# end of automatic generation
diff --git a/sysdeps/powerpc/nofpu/sim-full.c b/sysdeps/powerpc/nofpu/sim-full.c
deleted file mode 100644
index d018240e6d..0000000000
--- a/sysdeps/powerpc/nofpu/sim-full.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Software floating-point exception handling emulation.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include "soft-fp.h"
-#include "soft-supp.h"
-
-/* Global to store sticky exceptions.  */
-int __sim_exceptions __attribute__ ((nocommon));
-libc_hidden_data_def (__sim_exceptions);
-
-/* By default, no exceptions should trap.  */
-int __sim_disabled_exceptions = 0xffffffff;
-libc_hidden_data_def (__sim_disabled_exceptions);
-
-int __sim_round_mode __attribute__ ((nocommon));
-libc_hidden_data_def (__sim_round_mode);
-
-void
-__simulate_exceptions (int x)
-{
-  __sim_exceptions |= x;
-  if (x == 0 || __sim_disabled_exceptions & x)
-    /* Ignore exception.  */
-    ;
-  else
-    raise (SIGFPE);
-}
diff --git a/sysdeps/powerpc/nofpu/soft-supp.h b/sysdeps/powerpc/nofpu/soft-supp.h
deleted file mode 100644
index 3922426bd0..0000000000
--- a/sysdeps/powerpc/nofpu/soft-supp.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Internal support stuff for complete soft float.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-   Contributed by Aldy Hernandez <aldyh@redhat.com>, 2002.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <fenv.h>
-
-typedef union
-{
-  fenv_t fenv;
-  unsigned int l[2];
-} fenv_union_t;
-
-
-extern int __sim_exceptions;
-libc_hidden_proto (__sim_exceptions);
-extern int __sim_disabled_exceptions;
-libc_hidden_proto (__sim_disabled_exceptions);
-extern int __sim_round_mode;
-libc_hidden_proto (__sim_round_mode);
-
-extern void __simulate_exceptions (int x) attribute_hidden;
diff --git a/sysdeps/powerpc/powerpc32/Dist b/sysdeps/powerpc/powerpc32/Dist
deleted file mode 100644
index ada834f7c3..0000000000
--- a/sysdeps/powerpc/powerpc32/Dist
+++ /dev/null
@@ -1,9 +0,0 @@
-dl-machine.c
-dl-start.S
-libgcc-compat.S
-ppc-mcount.S
-gprsave1.S
-gprsave0.S
-gprrest1.S
-gprrest0.S
-bp-asm.h
diff --git a/sysdeps/powerpc/powerpc32/Implies b/sysdeps/powerpc/powerpc32/Implies
index 9ef3ac175b..39a34c5f57 100644
--- a/sysdeps/powerpc/powerpc32/Implies
+++ b/sysdeps/powerpc/powerpc32/Implies
@@ -1,2 +1 @@
 wordsize-32
-powerpc/soft-fp
diff --git a/sysdeps/powerpc/powerpc32/Makefile b/sysdeps/powerpc/powerpc32/Makefile
index 82b4fc95f9..1d58a063d6 100644
--- a/sysdeps/powerpc/powerpc32/Makefile
+++ b/sysdeps/powerpc/powerpc32/Makefile
@@ -21,7 +21,7 @@ ifeq ($(subdir),csu)
 ifneq ($(elf),no)
 # The initfini generation code doesn't work in the presence of -fPIC, so
 # we use -fpic instead which is much better.
-CFLAGS-initfini.s = -g0 -fpic -O1
+CFLAGS-initfini.s += -fpic -O1
 
 # There is no benefit to using sdata for these objects, and the user
 # of the library should be able to control what goes into sdata.
diff --git a/sysdeps/powerpc/powerpc32/__longjmp-common.S b/sysdeps/powerpc/powerpc32/__longjmp-common.S
index 82531ad6b3..2093b7e337 100644
--- a/sysdeps/powerpc/powerpc32/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/__longjmp-common.S
@@ -1,5 +1,6 @@
 /* longjmp for PowerPC.
-   Copyright (C) 1995-1997,1999-2001,2003,2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997, 1999-2001, 2003, 2004, 2005, 2006
+	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
@@ -19,11 +20,10 @@
 
 #include <sysdep.h>
 #define _ASM
-#define _SETJMP_H
 #ifdef __NO_VMX__
 # include <novmxsetjmp.h>
 #else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
 #endif
 #include <bp-sym.h>
 #include <bp-asm.h>
@@ -31,7 +31,11 @@
 ENTRY (BP_SYM (__longjmp))
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
 
+#ifdef PTR_DEMANGLE
+	lwz r24,(JB_GPR1*4)(r3)
+#else
 	lwz r1,(JB_GPR1*4)(r3)
+#endif
 	lwz r0,(JB_LR*4)(r3)
 	lwz r14,((JB_GPRS+0)*4)(r3)
 	lwz r15,((JB_GPRS+1)*4)(r3)
@@ -40,6 +44,10 @@ ENTRY (BP_SYM (__longjmp))
 	lwz r18,((JB_GPRS+4)*4)(r3)
 	lwz r19,((JB_GPRS+5)*4)(r3)
 	lwz r20,((JB_GPRS+6)*4)(r3)
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE3 (r1, r24, r25)
+	PTR_DEMANGLE2 (r0, r25)
+#endif
 	mtlr r0
 	lwz r21,((JB_GPRS+7)*4)(r3)
 	lwz r22,((JB_GPRS+8)*4)(r3)
diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c
index 118f0d6175..e7e12544c5 100644
--- a/sysdeps/powerpc/powerpc32/backtrace.c
+++ b/sysdeps/powerpc/powerpc32/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2005 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
@@ -64,3 +64,4 @@ __backtrace (void **array, int size)
   return count;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/powerpc/powerpc32/bits/atomic.h b/sysdeps/powerpc/powerpc32/bits/atomic.h
index 0f1a72335f..6fcc669fb1 100644
--- a/sysdeps/powerpc/powerpc32/bits/atomic.h
+++ b/sysdeps/powerpc/powerpc32/bits/atomic.h
@@ -89,12 +89,27 @@
 # define __arch_atomic_decrement_if_positive_64(mem) \
     ({ abort (); (*mem)--; })
 
+#ifdef _ARCH_PWR4
+/*
+ * Newer powerpc64 processors support the new "light weight" sync (lwsync)
+ * So if the build is using -mcpu=[power4,power5,power5+,970] we can
+ * safely use lwsync.
+ */
+# define atomic_read_barrier()	__asm ("lwsync" ::: "memory")
+/*
+ * "light weight" sync can also be used for the release barrier.
+ */
+# ifndef UP
+#  define __ARCH_REL_INSTR	"lwsync"
+# endif
+#else
 /*
  * Older powerpc32 processors don't support the new "light weight"
  * sync (lwsync).  So the only safe option is to use normal sync
  * for all powerpc32 applications.
  */
 # define atomic_read_barrier()	__asm ("sync" ::: "memory")
+#endif
 
 /*
  * Include the rest of the atomic ops macros which are common to both
diff --git a/sysdeps/powerpc/powerpc32/bsd-_setjmp.S b/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
index 50deda8c90..4c28c2e547 100644
--- a/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
+++ b/sysdeps/powerpc/powerpc32/bsd-_setjmp.S
@@ -26,7 +26,7 @@
 /* Build a non-versioned object for rtld-*.  */
 ENTRY (BP_SYM (_setjmp))
 	li r4,0			/* Set second argument to 0.  */
-	b JUMPTARGET(BP_SYM (__sigsetjmp))
+	b BP_SYM (__sigsetjmp@local)
 END (BP_SYM (_setjmp))
 libc_hidden_def (_setjmp)
 #else
@@ -37,7 +37,7 @@ symbol_version (__novmx_setjmp,_setjmp,GLIBC_2.0);
 
 ENTRY (BP_SYM (__novmx_setjmp))
 	li r4,0			/* Set second argument to 0.  */
-	b JUMPTARGET(BP_SYM (__novmx__sigsetjmp))
+	b BP_SYM (__novmx__sigsetjmp@local)
 END (BP_SYM (__novmx_setjmp))
 libc_hidden_def (__novmx_setjmp)
 # endif /* defined SHARED  && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) */
@@ -48,12 +48,12 @@ default_symbol_version (__vmx_setjmp,_setjmp,GLIBC_2.3.4)
    if HAVE_CLEANUP_JMP_BUF is defined */
 ENTRY (BP_SYM (__GI__setjmp))
 	li r4,0			/* Set second argument to 0.  */
-	b JUMPTARGET(BP_SYM (__vmx__sigsetjmp))
+	b BP_SYM (__vmx__sigsetjmp@local)
 END (BP_SYM (__GI__setjmp))
 
 ENTRY (BP_SYM (__vmx_setjmp))
 	li r4,0			/* Set second argument to 0.  */
-	b JUMPTARGET(BP_SYM (__vmx__sigsetjmp))
+	b BP_SYM (__vmx__sigsetjmp@local)
 END (BP_SYM (__vmx_setjmp))
 libc_hidden_def (__vmx_setjmp)
 #endif /* !NOT_IN_libc */
diff --git a/sysdeps/powerpc/powerpc32/bsd-setjmp.S b/sysdeps/powerpc/powerpc32/bsd-setjmp.S
index 159b122ca5..01b195d832 100644
--- a/sysdeps/powerpc/powerpc32/bsd-setjmp.S
+++ b/sysdeps/powerpc/powerpc32/bsd-setjmp.S
@@ -25,7 +25,7 @@
 
 ENTRY (__novmxsetjmp)
 	li r4,1			/* Set second argument to 1.  */
-	b JUMPTARGET (__novmx__sigsetjmp)
+	b __novmx__sigsetjmp@local
 END (__novmxsetjmp)
 strong_alias (__novmxsetjmp, __novmx__setjmp)
 symbol_version (__novmxsetjmp, setjmp, GLIBC_2.0)
@@ -34,7 +34,7 @@ symbol_version (__novmxsetjmp, setjmp, GLIBC_2.0)
 
 ENTRY (__vmxsetjmp)
 	li r4,1			/* Set second argument to 1.  */
-	b JUMPTARGET (__vmx__sigsetjmp)
+	b __vmx__sigsetjmp@local
 END (__vmxsetjmp)
 strong_alias (__vmxsetjmp, __vmx__setjmp)
 strong_alias (__vmx__setjmp, __setjmp)
diff --git a/sysdeps/powerpc/powerpc32/configure b/sysdeps/powerpc/powerpc32/configure
new file mode 100644
index 0000000000..0ff56c936a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/configure
@@ -0,0 +1,62 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/powerpc/powerpc32.
+
+# See whether gas has R_PPC_REL16 relocs.
+echo "$as_me:$LINENO: checking for R_PPC_REL16 gas support" >&5
+echo $ECHO_N "checking for R_PPC_REL16 gas support... $ECHO_C" >&6
+if test "${libc_cv_ppc_rel16+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat > conftest.s <<\EOF
+	.text
+	addis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha
+EOF
+if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_ppc_rel16=yes
+else
+  libc_cv_ppc_rel16=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_ppc_rel16" >&5
+echo "${ECHO_T}$libc_cv_ppc_rel16" >&6
+if test $libc_cv_ppc_rel16 = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_ASM_PPC_REL16 1
+_ACEOF
+
+fi
+
+# See whether GCC uses -msecure-plt.
+echo "$as_me:$LINENO: checking for -msecure-plt by default" >&5
+echo $ECHO_N "checking for -msecure-plt by default... $ECHO_C" >&6
+if test "${libc_cv_ppc_secure_plt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  echo 'int foo (void) { extern int bar; return bar; }' > conftest.c
+libc_cv_ppc_secure_plt=no
+if { ac_try='${CC-cc} -S $CFLAGS conftest.c -fpic -o conftest.s 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  if grep '_GLOBAL_OFFSET_TABLE_-.*@ha' conftest.s > /dev/null 2>&1; then
+    libc_cv_ppc_secure_plt=yes
+  fi
+fi
+rm -rf conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_ppc_secure_plt" >&5
+echo "${ECHO_T}$libc_cv_ppc_secure_plt" >&6
+if test $libc_cv_ppc_secure_plt = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_PPC_SECURE_PLT 1
+_ACEOF
+
+fi
diff --git a/sysdeps/powerpc/powerpc32/configure.in b/sysdeps/powerpc/powerpc32/configure.in
new file mode 100644
index 0000000000..7219ad993e
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/configure.in
@@ -0,0 +1,32 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/powerpc/powerpc32.
+
+# See whether gas has R_PPC_REL16 relocs.
+AC_CACHE_CHECK(for R_PPC_REL16 gas support, libc_cv_ppc_rel16, [dnl
+cat > conftest.s <<\EOF
+	.text
+	addis 11,30,_GLOBAL_OFFSET_TABLE_-.@ha
+EOF
+if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
+  libc_cv_ppc_rel16=yes
+else
+  libc_cv_ppc_rel16=no
+fi
+rm -f conftest*])
+if test $libc_cv_ppc_rel16 = yes; then
+  AC_DEFINE(HAVE_ASM_PPC_REL16)
+fi
+
+# See whether GCC uses -msecure-plt.
+AC_CACHE_CHECK(for -msecure-plt by default, libc_cv_ppc_secure_plt, [dnl
+echo 'int foo (void) { extern int bar; return bar; }' > conftest.c
+libc_cv_ppc_secure_plt=no
+if AC_TRY_COMMAND(${CC-cc} -S $CFLAGS conftest.c -fpic -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
+  if grep '_GLOBAL_OFFSET_TABLE_-.*@ha' conftest.s > /dev/null 2>&1; then
+    libc_cv_ppc_secure_plt=yes
+  fi
+fi
+rm -rf conftest*])
+if test $libc_cv_ppc_secure_plt = yes; then
+  AC_DEFINE(HAVE_PPC_SECURE_PLT)
+fi
diff --git a/sysdeps/powerpc/powerpc32/dl-dtprocnum.h b/sysdeps/powerpc/powerpc32/dl-dtprocnum.h
new file mode 100644
index 0000000000..7fe2be7939
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/dl-dtprocnum.h
@@ -0,0 +1,3 @@
+/* Number of extra dynamic section entries for this architecture.  By
+   default there are none.  */
+#define DT_THISPROCNUM	DT_PPC_NUM
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index 06960716b9..4120a02382 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation functions.  PowerPC version.
-   Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2004, 2005 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
@@ -242,7 +242,8 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
 					 : _dl_runtime_resolve);
 	  Elf32_Word offset;
 
-	  if (profile && _dl_name_match_p (GLRO(dl_profile), map))
+	  if (profile && GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), map))
 	    /* This is the object we are looking for.  Say that we really
 	       want profiling and the timers are started.  */
 	    GL(dl_profile_map) = map;
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h
index a8c1e3e490..496fa71ecc 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  PowerPC version.
-   Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002, 2003, 2005 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
@@ -25,6 +25,10 @@
 #include <assert.h>
 #include <dl-tls.h>
 
+/* Translate a processor specific dynamic tag to the index
+   in l_info array.  */
+#define DT_PPC(x) (DT_PPC_##x - DT_LOPROC + DT_NUM)
+
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
 elf_machine_matches_host (const Elf32_Ehdr *ehdr)
@@ -32,24 +36,38 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr)
   return ehdr->e_machine == EM_PPC;
 }
 
+/* Return the value of the GOT pointer.  */
+static inline Elf32_Addr * __attribute__ ((const))
+ppc_got (void)
+{
+  Elf32_Addr *got;
+#ifdef HAVE_ASM_PPC_REL16
+  asm ("bcl 20,31,1f\n"
+       "1:	mflr %0\n"
+       "	addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n"
+       "	addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n"
+       : "=b" (got) : : "lr");
+#else
+  asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
+       : "=l" (got));
+#endif
+  return got;
+}
 
 /* Return the link-time address of _DYNAMIC, stored as
    the first value in the GOT. */
-static inline Elf32_Addr
+static inline Elf32_Addr __attribute__ ((const))
 elf_machine_dynamic (void)
 {
-  Elf32_Addr *got;
-  asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
-       : "=l"(got));
-  return *got;
+  return *ppc_got ();
 }
 
 /* Return the run-time load address of the shared object.  */
-static inline Elf32_Addr
+static inline Elf32_Addr __attribute__ ((const))
 elf_machine_load_address (void)
 {
-  unsigned int *got;
-  unsigned int *branchaddr;
+  Elf32_Addr *branchaddr;
+  Elf32_Addr runtime_dynamic;
 
   /* This is much harder than you'd expect.  Possibly I'm missing something.
      The 'obvious' way:
@@ -80,19 +98,17 @@ elf_machine_load_address (void)
      the address ourselves. That gives us the following code: */
 
   /* Get address of the 'b _DYNAMIC@local'...  */
-  asm ("bl 0f ;"
+  asm ("bcl 20,31,0f;"
        "b _DYNAMIC@local;"
        "0:"
-       : "=l"(branchaddr));
-
-  /* ... and the address of the GOT.  */
-  asm (" bl _GLOBAL_OFFSET_TABLE_-4@local"
-       : "=l"(got));
+       : "=l" (branchaddr));
 
   /* So now work out the difference between where the branch actually points,
      and the offset of that location in memory from the start of the file.  */
-  return ((Elf32_Addr)branchaddr - *got
-	  + ((int)(*branchaddr << 6 & 0xffffff00) >> 6));
+  runtime_dynamic = ((Elf32_Addr) branchaddr
+		     + ((Elf32_Sword) (*branchaddr << 6 & 0xffffff00) >> 6));
+
+  return runtime_dynamic - elf_machine_dynamic ();
 }
 
 #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) /* nothing */
@@ -100,160 +116,6 @@ elf_machine_load_address (void)
 /* The PLT uses Elf32_Rela relocs.  */
 #define elf_machine_relplt elf_machine_rela
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  It is called
-   from code built in the PLT by elf_machine_runtime_setup.  */
-#if !defined PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
-	.section \".text\"	\n\
-	.align 2	\n\
-	.globl _dl_runtime_resolve	\n\
-	.type _dl_runtime_resolve,@function	\n\
-_dl_runtime_resolve:	\n\
- # We need to save the registers used to pass parameters, and register 0,\n\
- # which is used by _mcount; the registers are saved in a stack frame.\n\
-	stwu 1,-64(1)	\n\
-	stw 0,12(1)	\n\
-	stw 3,16(1)	\n\
-	stw 4,20(1)	\n\
- # The code that calls this has put parameters for `fixup' in r12 and r11.\n\
-	mr 3,12	\n\
-	stw 5,24(1)	\n\
-	mr 4,11	\n\
-	stw 6,28(1)	\n\
-	mflr 0	\n\
- # We also need to save some of the condition register fields.\n\
-	stw 7,32(1)	\n\
-	stw 0,48(1)	\n\
-	stw 8,36(1)	\n\
-	mfcr 0	\n\
-	stw 9,40(1)	\n\
-	stw 10,44(1)	\n\
-	stw 0,8(1)	\n\
-	bl fixup@local	\n\
- # 'fixup' returns the address we want to branch to.\n\
-	mtctr 3	\n\
- # Put the registers back...\n\
-	lwz 0,48(1)	\n\
-	lwz 10,44(1)	\n\
-	lwz 9,40(1)	\n\
-	mtlr 0	\n\
-	lwz 8,36(1)	\n\
-	lwz 0,8(1)	\n\
-	lwz 7,32(1)	\n\
-	lwz 6,28(1)	\n\
-	mtcrf 0xFF,0	\n\
-	lwz 5,24(1)	\n\
-	lwz 4,20(1)	\n\
-	lwz 3,16(1)	\n\
-	lwz 0,12(1)	\n\
- # ...unwind the stack frame, and jump to the PLT entry we updated.\n\
-	addi 1,1,64	\n\
-	bctr	\n\
-	.size	 _dl_runtime_resolve,.-_dl_runtime_resolve	\n\
-	\n\
-	.align 2	\n\
-	.globl _dl_prof_resolve	\n\
-	.type _dl_prof_resolve,@function	\n\
-_dl_prof_resolve:	\n\
- # We need to save the registers used to pass parameters, and register 0,\n\
- # which is used by _mcount; the registers are saved in a stack frame.\n\
-	stwu 1,-64(1)	\n\
-        stw 0,12(1)	\n\
-	stw 3,16(1)	\n\
-	stw 4,20(1)	\n\
- # The code that calls this has put parameters for `fixup' in r12 and r11.\n\
-	mr 3,12	\n\
-	stw 5,24(1)	\n\
-	mr 4,11	\n\
-	stw 6,28(1)	\n\
-	mflr 5	\n\
- # We also need to save some of the condition register fields.\n\
-	stw 7,32(1)	\n\
-	stw 5,48(1)	\n\
-	stw 8,36(1)	\n\
-	mfcr 0	\n\
-	stw 9,40(1)	\n\
-	stw 10,44(1)	\n\
-	stw 0,8(1)	\n\
-	bl profile_fixup@local	\n\
- # 'fixup' returns the address we want to branch to.\n\
-	mtctr 3	\n\
- # Put the registers back...\n\
-	lwz 0,48(1)	\n\
-	lwz 10,44(1)	\n\
-	lwz 9,40(1)	\n\
-	mtlr 0	\n\
-	lwz 8,36(1)	\n\
-	lwz 0,8(1)	\n\
-	lwz 7,32(1)	\n\
-	lwz 6,28(1)	\n\
-	mtcrf 0xFF,0	\n\
-	lwz 5,24(1)	\n\
-	lwz 4,20(1)	\n\
-	lwz 3,16(1)	\n\
-        lwz 0,12(1)	\n\
- # ...unwind the stack frame, and jump to the PLT entry we updated.\n\
-	addi 1,1,64	\n\
-	bctr	\n\
-	.size	 _dl_prof_resolve,.-_dl_prof_resolve	\n\
- # Undo '.section text'.\n\
-	.previous	\n\
-");
-#else
-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
-	.section \".text\"	\n\
-	.align 2	\n\
-	.globl _dl_runtime_resolve	\n\
-	.globl _dl_prof_resolve	\n\
-	.type _dl_runtime_resolve,@function	\n\
-	.type _dl_prof_resolve,@function	\n\
-_dl_runtime_resolve:	\n\
-_dl_prof_resolve:	\n\
- # We need to save the registers used to pass parameters, and register 0,\n\
- # which is used by _mcount; the registers are saved in a stack frame.\n\
-	stwu 1,-64(1)	\n\
-	stw 0,12(1)	\n\
-	stw 3,16(1)	\n\
-	stw 4,20(1)	\n\
- # The code that calls this has put parameters for `fixup' in r12 and r11.\n\
-	mr 3,12	\n\
-	stw 5,24(1)	\n\
-	mr 4,11	\n\
-	stw 6,28(1)	\n\
-	mflr 0	\n\
- # We also need to save some of the condition register fields.\n\
-	stw 7,32(1)	\n\
-	stw 0,48(1)	\n\
-	stw 8,36(1)	\n\
-	mfcr 0	\n\
-	stw 9,40(1)	\n\
-	stw 10,44(1)	\n\
-	stw 0,8(1)	\n\
-	bl fixup@local	\n\
- # 'fixup' returns the address we want to branch to.\n\
-	mtctr 3	\n\
- # Put the registers back...\n\
-	lwz 0,48(1)	\n\
-	lwz 10,44(1)	\n\
-	lwz 9,40(1)	\n\
-	mtlr 0	\n\
-	lwz 8,36(1)	\n\
-	lwz 0,8(1)	\n\
-	lwz 7,32(1)	\n\
-	lwz 6,28(1)	\n\
-	mtcrf 0xFF,0	\n\
-	lwz 5,24(1)	\n\
-	lwz 4,20(1)	\n\
-	lwz 3,16(1)	\n\
-	lwz 0,12(1)	\n\
- # ...unwind the stack frame, and jump to the PLT entry we updated.\n\
-	addi 1,1,64	\n\
-	bctr	\n\
-	.size	 _dl_runtime_resolve,.-_dl_runtime_resolve	\n\
-");
-#endif
-
 /* Mask identifying addresses reserved for the user program,
    where the dynamic linker should not map anything.  */
 #define ELF_MACHINE_USER_ADDRESS_MASK	0xf0000000UL
@@ -298,13 +160,69 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
 /* The PowerPC never uses REL relocations.  */
 #define ELF_MACHINE_NO_REL 1
 
-/* Set up the loaded object described by L so its unrelocated PLT
+/* Set up the loaded object described by MAP so its unrelocated PLT
    entries will jump to the on-demand fixup code in dl-runtime.c.
    Also install a small trampoline to be used by entries that have
    been relocated to an address too far away for a single branch.  */
 extern int __elf_machine_runtime_setup (struct link_map *map,
 					int lazy, int profile);
-#define elf_machine_runtime_setup __elf_machine_runtime_setup
+
+static inline int
+elf_machine_runtime_setup (struct link_map *map,
+			   int lazy, int profile)
+{
+  if (map->l_info[DT_JMPREL] == 0)
+    return lazy;
+
+  if (map->l_info[DT_PPC(GOT)] == 0)
+    /* Handle old style PLT.  */
+    return __elf_machine_runtime_setup (map, lazy, profile);
+
+  /* New style non-exec PLT consisting of an array of addresses.  */
+  map->l_info[DT_PPC(GOT)]->d_un.d_ptr += map->l_addr;
+  if (lazy)
+    {
+      Elf32_Addr *plt, *got, glink;
+      Elf32_Word num_plt_entries;
+      void (*dlrr) (void);
+      extern void _dl_runtime_resolve (void);
+      extern void _dl_prof_resolve (void);
+
+      if (__builtin_expect (!profile, 1))
+	dlrr = _dl_runtime_resolve;
+      else
+	{
+	  if (GLRO(dl_profile) != NULL
+	      &&_dl_name_match_p (GLRO(dl_profile), map))
+	    GL(dl_profile_map) = map;
+	  dlrr = _dl_prof_resolve;
+	}
+      got = (Elf32_Addr *) map->l_info[DT_PPC(GOT)]->d_un.d_ptr;
+      glink = got[1];
+      got[1] = (Elf32_Addr) dlrr;
+      got[2] = (Elf32_Addr) map;
+
+      /* Relocate everything in .plt by the load address offset.  */
+      plt = (Elf32_Addr *) D_PTR (map, l_info[DT_PLTGOT]);
+      num_plt_entries = (map->l_info[DT_PLTRELSZ]->d_un.d_val
+			 / sizeof (Elf32_Rela));
+
+      /* If a library is prelinked but we have to relocate anyway,
+	 we have to be able to undo the prelinking of .plt section.
+	 The prelinker saved us at got[1] address of .glink
+	 section's start.  */
+      if (glink)
+	{
+	  glink += map->l_addr;
+	  while (num_plt_entries-- != 0)
+	    *plt++ = glink, glink += 4;
+	}
+      else
+	while (num_plt_entries-- != 0)
+	  *plt++ += map->l_addr;
+    }
+  return lazy;
+}
 
 /* Change the PLT entry whose reloc is 'reloc' to call the actual routine.  */
 extern Elf32_Addr __elf_machine_fixup_plt (struct link_map *map,
@@ -317,7 +235,12 @@ elf_machine_fixup_plt (struct link_map *map, lookup_t t,
 		       const Elf32_Rela *reloc,
 		       Elf32_Addr *reloc_addr, Elf64_Addr finaladdr)
 {
-  return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr);
+  if (map->l_info[DT_PPC(GOT)] == 0)
+    /* Handle old style PLT.  */
+    return __elf_machine_fixup_plt (map, reloc, reloc_addr, finaladdr);
+
+  *reloc_addr = finaladdr;
+  return finaladdr;
 }
 
 /* Return the final value of a plt relocation.  */
@@ -328,9 +251,14 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
   return value + reloc->r_addend;
 }
 
+
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER ppc32_gnu_pltenter
+#define ARCH_LA_PLTEXIT ppc32_gnu_pltexit
+
 #endif /* dl_machine_h */
 
-#ifdef RESOLVE
+#ifdef RESOLVE_MAP
 
 /* Do the actual processing of a reloc, once its target address
    has been determined.  */
@@ -353,7 +281,7 @@ extern void _dl_reloc_overflow (struct link_map *map,
    LOADADDR is the load address of the object; INFO is an array indexed
    by DT_* of the .dynamic section info.  */
 
-inline void
+auto inline void __attribute__ ((always_inline))
 elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 		  const Elf32_Sym *sym, const struct r_found_version *version,
 		  void *const reloc_addr_arg)
@@ -381,16 +309,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
     value = map->l_addr;
   else
     {
-# if defined USE_TLS && !defined RTLD_BOOTSTRAP
       sym_map = RESOLVE_MAP (&sym, version, r_type);
-      value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-# else
-      value = RESOLVE (&sym, version, r_type);
-#  ifndef RTLD_BOOTSTRAP
-      if (sym != NULL)
-#  endif
-	value += sym->st_value;
-# endif
+      value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
     }
   value += reloc->r_addend;
 #else
@@ -443,11 +363,16 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       break;
 #endif /* USE_TLS etc. */
 
-#ifdef RESOLVE_CONFLICT_FIND_MAP
     case R_PPC_JMP_SLOT:
+#ifdef RESOLVE_CONFLICT_FIND_MAP
       RESOLVE_CONFLICT_FIND_MAP (map, reloc_addr);
-      /* FALLTHROUGH */
 #endif
+      if (map->l_info[DT_PPC(GOT)] != 0)
+	{
+	  *reloc_addr = value;
+	  break;
+	}
+      /* FALLTHROUGH */
 
     default:
       __process_machine_rela (map, reloc, sym_map, sym, refsym,
@@ -455,7 +380,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
     }
 }
 
-static inline void
+auto inline void __attribute__ ((always_inline))
 elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
 			   void *const reloc_addr_arg)
 {
@@ -463,7 +388,7 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
   *reloc_addr = l_addr + reloc->r_addend;
 }
 
-static inline void
+auto inline void __attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf32_Addr l_addr, const Elf32_Rela *reloc)
 {
@@ -474,4 +399,4 @@ elf_machine_lazy_rel (struct link_map *map,
    DT_RELA table.  */
 #define ELF_MACHINE_PLTREL_OVERLAP 1
 
-#endif /* RESOLVE */
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S
index d72202d4a4..c77c4de198 100644
--- a/sysdeps/powerpc/powerpc32/dl-start.S
+++ b/sysdeps/powerpc/powerpc32/dl-start.S
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF startup code.  PowerPC version.
-   Copyright (C) 1995-2000, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2002, 2004, 2005, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 
@@ -39,7 +39,7 @@ ENTRY(_start)
 	bl	_dl_start@local
 
 	/* FALLTHRU */
-ENTRY(_dl_start_user)
+_dl_start_user:
 /* Now, we do our main work of calling initialisation procedures.
    The ELF ABI doesn't say anything about parameters for these,
    so we just pass argc, argv, and the environment.
@@ -47,8 +47,15 @@ ENTRY(_dl_start_user)
    passed by value!).  */
 
 /*  Put our GOT pointer in r31, */
+#ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r31
+	addis	r31,r31,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r31,r31,_GLOBAL_OFFSET_TABLE_-1b@l
+#else
 	bl	_GLOBAL_OFFSET_TABLE_-4@local
 	mflr	r31
+#endif
 /*  the address of _start in r30, */
 	mr	r30,r3
 /*  &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28.  */
@@ -91,6 +98,7 @@ ENTRY(_dl_start_user)
    Take the opportunity to clear LR, so anyone who accidentally returns
    from _start gets SEGV.  Also clear the next few words of the stack.  */
 
+_dl_main_dispatch:
 	li	r31,0
 	stw	r31,0(r1)
 	mtlr	r31
diff --git a/sysdeps/powerpc/powerpc32/dl-trampoline.S b/sysdeps/powerpc/powerpc32/dl-trampoline.S
new file mode 100644
index 0000000000..6a158c3fff
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/dl-trampoline.S
@@ -0,0 +1,186 @@
+/* PLT trampolines.  PPC32 version.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+#include <sysdep.h>
+
+	.section ".text"
+	.align 2
+	.globl _dl_runtime_resolve
+	.type _dl_runtime_resolve,@function
+_dl_runtime_resolve:
+	cfi_startproc
+ # We need to save the registers used to pass parameters, and register 0,
+ # which is used by _mcount; the registers are saved in a stack frame.
+	stwu r1,-64(r1)
+	cfi_adjust_cfa_offset (64)
+	stw r0,12(r1)
+	stw r3,16(r1)
+	stw r4,20(r1)
+ # The code that calls this has put parameters for `fixup' in r12 and r11.
+	mr r3,r12
+	stw r5,24(r1)
+	mr r4,r11
+	stw r6,28(r1)
+	mflr r0
+ # We also need to save some of the condition register fields
+	stw r7,32(r1)
+ # Don't clobber the caller's LRSAVE, it is needed by _mcount.
+	stw r0,48(r1)
+ 	cfi_offset (lr, -16)
+	stw r8,36(r1)
+	mfcr r0
+	stw r9,40(r1)
+	stw r10,44(r1)
+	stw r0,8(r1)
+	bl _dl_fixup@local
+ # 'fixup' returns the address we want to branch to.
+	mtctr r3
+ # Put the registers back...
+	lwz r0,48(r1)
+	lwz r10,44(r1)
+	lwz r9,40(r1)
+	mtlr r0
+	lwz r8,36(r1)
+	lwz r0,8(r1)
+	lwz r7,32(r1)
+	lwz r6,28(r1)
+	mtcrf 0xFF,r0
+	lwz r5,24(r1)
+	lwz r4,20(r1)
+	lwz r3,16(r1)
+	lwz r0,12(r1)
+ # ...unwind the stack frame, and jump to the PLT entry we updated.
+	addi r1,r1,64
+	bctr
+	cfi_endproc
+	.size	 _dl_runtime_resolve,.-_dl_runtime_resolve
+
+#ifndef PROF
+	.align 2
+	.globl _dl_prof_resolve
+	.type _dl_prof_resolve,@function
+_dl_prof_resolve:
+	cfi_startproc
+ # We need to save the registers used to pass parameters, and register 0,
+ # which is used by _mcount; the registers are saved in a stack frame.
+	stwu r1,-320(r1)
+	cfi_adjust_cfa_offset (320)
+	/* Stack layout:
+
+	  +312   stackframe
+	  +308   lr
+	  +304   r1
+	  +288   v12
+	  +272   v11
+	  +256   v10
+	  +240   v9
+	  +224   v8
+	  +208   v7
+	  +192   v6
+	  +176   v5
+	  +160   v4
+	  +144   v3
+	  +128   v2
+	  +112   v1
+	  +104   fp8
+	  +96    fp7
+	  +88    fp6
+	  +80    fp5
+	  +72    fp4
+	  +64    fp3
+	  +56    fp2
+	  +48    fp1
+	  +44    r10
+	  +40    r9
+	  +36    r8
+	  +32    r7
+	  +28    r6
+	  +24    r5
+	  +20    r4
+	  +16    r3
+	  +12    r0
+	  +8     cr
+	   r1    link
+	*/
+        stw r0,12(r1)
+	stw r3,16(r1)
+	stw r4,20(r1)
+ # The code that calls this has put parameters for `fixup' in r12 and r11.
+	mr r3,r12
+	stw r5,24(r1)
+	mr r4,r11
+	stw r6,28(r1)
+	mflr r5
+ # We also need to save some of the condition register fields.
+	stw r7,32(r1)
+ # Don't clobber the caller's LRSAVE, it is needed by _mcount.
+	stw r5,308(r1)
+	cfi_offset (lr, -12)
+	stw r8,36(r1)
+	mfcr r0
+	stw r9,40(r1)
+	stw r10,44(r1)
+	stw r0,8(r1)
+ # Save the floating point registers
+	stfd fp1,48(r1)
+	stfd fp2,56(r1)
+	stfd fp3,64(r1)
+	stfd fp4,72(r1)
+	stfd fp5,80(r1)
+	stfd fp6,88(r1)
+	stfd fp7,96(r1)
+	stfd fp8,104(r1)
+ # XXX TODO: store vmx registers
+ # Load the extra parameters.
+	addi r6,r1,16
+	addi r7,r1,312
+	li r0,-1
+	stw r0,0(r7)
+	bl _dl_profile_fixup@local
+ # 'fixup' returns the address we want to branch to.
+	mtctr r3
+ # Put the registers back...
+	lwz r0,308(r1)
+	lwz r10,44(r1)
+	lwz r9,40(r1)
+	mtlr r0
+	lwz r8,36(r1)
+	lwz r0,8(r1)
+	lwz r7,32(r1)
+	lwz r6,28(r1)
+	mtcrf 0xFF,r0
+	lwz r5,24(r1)
+	lwz r4,20(r1)
+	lwz r3,16(r1)
+        lwz r0,12(r1)
+ # Load the floating point registers.
+	lfd fp1,48(r1)
+	lfd fp2,56(r1)
+	lfd fp3,64(r1)
+	lfd fp4,72(r1)
+	lfd fp5,80(r1)
+	lfd fp6,88(r1)
+	lfd fp7,96(r1)
+	lfd fp8,104(r1)
+ # ...unwind the stack frame, and jump to the PLT entry we updated.
+	addi r1,r1,320
+	bctr
+	cfi_endproc
+	.size	 _dl_prof_resolve,.-_dl_prof_resolve
+#endif
diff --git a/sysdeps/powerpc/powerpc32/elf/start.S b/sysdeps/powerpc/powerpc32/elf/start.S
index 7827357a6c..bafd2ae001 100644
--- a/sysdeps/powerpc/powerpc32/elf/start.S
+++ b/sysdeps/powerpc/powerpc32/elf/start.S
@@ -52,7 +52,7 @@ L(start_addresses):
 	ASM_SIZE_DIRECTIVE(L(start_addresses))
 
 	.section ".text"
-#ifdef PIC
+#if defined PIC && !defined HAVE_ASM_PPC_REL16
 L(start_addressesp):
 	.long	L(start_addresses)-L(branch)
 #endif
@@ -73,11 +73,19 @@ L(branch):
 	mtlr	r0
 	stw	r0,0(r1)
  /* Set r13 to point at the 'small data area', and put the address of
-    start_addresses in r8...  */
+    start_addresses in r8.  Also load the GOT pointer so that new PLT
+    calls work, like the one to __libc_start_main.  */
 #ifdef PIC
+# ifdef HAVE_ASM_PPC_REL16
+	addis	r30,r13,_GLOBAL_OFFSET_TABLE_-L(branch)@ha
+	addis	r8,r13,L(start_addresses)-L(branch)@ha
+	addi	r30,r30,_GLOBAL_OFFSET_TABLE_-L(branch)@l
+	lwzu	r13,L(start_addresses)-L(branch)@l(r8)
+# else
 	lwz	r8,L(start_addressesp)-L(branch)(r13)
 	add	r8,r13,r8
 	lwz	r13,0(r8)
+# endif
 #else
 	lis	r8,L(start_addresses)@ha
 	lwzu	r13,L(start_addresses)@l(r8)
diff --git a/sysdeps/powerpc/powerpc32/fpu/Dist b/sysdeps/powerpc/powerpc32/fpu/Dist
deleted file mode 100644
index 375e57172e..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-fprrest.S
-fprsave.S
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index a2415b9542..404f403855 100644
--- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -1,5 +1,5 @@
 /* longjmp for PowerPC.
-   Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-99, 2000, 2003-2005, 2006 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
@@ -14,16 +14,15 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #define _ASM
-#define _SETJMP_H
 #ifdef __NO_VMX__
 # include <novmxsetjmp.h>
 #else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
 #endif
 #include <bp-sym.h>
 #include <bp-asm.h>
@@ -34,15 +33,25 @@ ENTRY (BP_SYM (__longjmp))
 #ifndef __NO_VMX__
 # ifdef PIC
 	mflr    r6
+	cfi_register (lr,r6)
+#  ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r5
+	addis	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
+#  else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r5
+#  endif
 #  ifdef SHARED
 	lwz     r5,_rtld_global_ro@got(r5)
 	mtlr    r6
+	cfi_same_value (lr)
 	lwz     r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
 #  else
-	lwz     r5,_rtld_global_ro@got(r5)
+	lwz     r5,_dl_hwcap@got(r5)
 	mtlr    r6
+	cfi_same_value (lr)
 	lwz     r5,0(r5)
 #  endif
 # else
@@ -105,7 +114,11 @@ aligned_restore_vmx:
 	lvx	v31,0,r6
 L(no_vmx):
 #endif
+#ifdef PTR_DEMANGLE
+	lwz r24,(JB_GPR1*4)(r3)
+#else
 	lwz r1,(JB_GPR1*4)(r3)
+#endif
 	lwz r0,(JB_LR*4)(r3)
 	lwz r14,((JB_GPRS+0)*4)(r3)
 	lfd fp14,((JB_FPRS+0*2)*4)(r3)
@@ -121,6 +134,10 @@ L(no_vmx):
 	lfd fp19,((JB_FPRS+5*2)*4)(r3)
 	lwz r20,((JB_GPRS+6)*4)(r3)
 	lfd fp20,((JB_FPRS+6*2)*4)(r3)
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE3 (r1, r24, r25)
+	PTR_DEMANGLE2 (r0, r25)
+#endif
 	mtlr r0
 	lwz r21,((JB_GPRS+7)*4)(r3)
 	lfd fp21,((JB_FPRS+7*2)*4)(r3)
diff --git a/sysdeps/powerpc/powerpc32/fpu/fprrest.S b/sysdeps/powerpc/powerpc32/fpu/fprrest.S
index 42317809eb..2f6c6deb2e 100644
--- a/sysdeps/powerpc/powerpc32/fpu/fprrest.S
+++ b/sysdeps/powerpc/powerpc32/fpu/fprrest.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 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
@@ -13,8 +13,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /*
     Floating Point Registers (FPRs) restore routine
@@ -92,3 +92,4 @@ C_TEXT(_restfpr_29):	lwz	r0,8(r1)	#get return address from frame
 			lfd	fp30,-16(r1)	#restore f30
 			lfd	fp31,-8(r1)	#restore f31
 			blr			#return
+END (_restfpr_all)
diff --git a/sysdeps/powerpc/powerpc32/fpu/fprsave.S b/sysdeps/powerpc/powerpc32/fpu/fprsave.S
index d7bc1ab7dc..c05178775d 100644
--- a/sysdeps/powerpc/powerpc32/fpu/fprsave.S
+++ b/sysdeps/powerpc/powerpc32/fpu/fprsave.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 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
@@ -13,8 +13,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /*
     Floating Point Registers (FPRs) save routine
@@ -27,67 +27,86 @@ ENTRY(_savefpr_all)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_14)
 C_TEXT(_savef14):
 C_TEXT(_savefpr_14):	stfd	fp14,-144(r1)
+			cfi_offset(fp14,-144)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef15)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_15)
 C_TEXT(_savef15):
 C_TEXT(_savefpr_15):	stfd	fp15,-136(r1)
+			cfi_offset(fp15,-136)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef16)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_16)
 C_TEXT(_savef16):
 C_TEXT(_savefpr_16):	stfd	fp16,-128(r1)
+			cfi_offset(fp16,-128)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef17)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_17)
 C_TEXT(_savef17):
 C_TEXT(_savefpr_17):	stfd	fp17,-120(r1)
+			cfi_offset(fp17,-120)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef18)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_18)
 C_TEXT(_savef18):
 C_TEXT(_savefpr_18):	stfd	fp18,-112(r1)
+			cfi_offset(fp18,-112)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef19)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_19)
 C_TEXT(_savef19):
 C_TEXT(_savefpr_19):	stfd	fp19,-104(r1)
+			cfi_offset(fp19,-104)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef20)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_20)
 C_TEXT(_savef20):
 C_TEXT(_savefpr_20):	stfd	fp20,-96(r1)
+			cfi_offset(fp20,-96)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef21)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_21)
 C_TEXT(_savef21):
 C_TEXT(_savefpr_21):	stfd	fp21,-88(r1)
+			cfi_offset(fp21,-88)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef22)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_22)
 C_TEXT(_savef22):
 C_TEXT(_savefpr_22):	stfd	fp22,-80(r1)
+			cfi_offset(fp22,-80)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef23)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_23)
 C_TEXT(_savef23):
 C_TEXT(_savefpr_23):	stfd	fp23,-72(r1)
+			cfi_offset(fp23,-72)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef24)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_24)
 C_TEXT(_savef24):
 C_TEXT(_savefpr_24):	stfd	fp24,-64(r1)
+			cfi_offset(fp24,-64)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef25)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_25)
 C_TEXT(_savef25):
 C_TEXT(_savefpr_25):	stfd	fp25,-56(r1)
+			cfi_offset(fp25,-56)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef26)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_26)
 C_TEXT(_savef26):
 C_TEXT(_savefpr_26):	stfd	fp26,-48(r1)
+			cfi_offset(fp26,-48)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef27)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_27)
 C_TEXT(_savef27):
 C_TEXT(_savefpr_27):	stfd	fp27,-40(r1)
+			cfi_offset(fp27,-40)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef28)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_28)
 C_TEXT(_savef28):
 C_TEXT(_savefpr_28):	stfd	fp28,-32(r1)
+			cfi_offset(fp28,-32)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savef29)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_29)
 C_TEXT(_savef29):
 C_TEXT(_savefpr_29):	stfd	fp29,-24(r1)	#save f29
 			stfd	fp30,-16(r1)	#save f30
 			stfd	fp31,-8(r1)	#save f31
+			cfi_offset(fp29,-24)
+			cfi_offset(fp30,-16)
+			cfi_offset(fp31,-8)
 			stw	r0,8(r1)	#save LR in callers frame
 			blr			#return
+END (_savefpr_all)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
index d211314bbf..bc74d302fb 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
@@ -1,5 +1,5 @@
 /* ceil function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,46 +14,39 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO52.0,@object
-	.size	TWO52.0,8
-TWO52.0:
-	.long 0x43300000
-	.long 0
-	.type	NEGZERO.0,@object
-	.size	NEGZERO.0,8
-NEGZERO.0:
-	.long 0x80000000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**52 */
-	.long 0x43300000
-	.long 0
-.LC1:	/* -0.0 */
-	.long 0x80000000
-	.long 0
+	.long 0x59800000
 
 	.section	".text"
 ENTRY (__ceil)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsub	fp12,fp13,fp13	/* generate 0.0  */
@@ -64,27 +57,18 @@ ENTRY (__ceil)
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-#ifdef SHARED
-	mflr	r11
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r10
-	lwz	r9,.LC1@got(10)
-	mtlr	r11
-	lfd	fp1,0(r9)
-#else
-	lis	r9,.LC1@ha
-	lfd	fp1,.LC1@l(r9)
-#endif
 	blr
 	END (__ceil)
 
@@ -94,3 +78,6 @@ weak_alias (__ceil, ceil)
 weak_alias (__ceil, ceill)
 strong_alias (__ceil, __ceill)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
index 4439dc2338..47a75ec0c3 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
@@ -1,5 +1,5 @@
 /* float ceil function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,46 +14,38 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO52.0,@object
-	.size	TWO52.0,8
-TWO52.0:
-	.long 0x43300000
-	.long 0
-	.type	NEGZERO.0,@object
-	.size	NEGZERO.0,8
-NEGZERO.0:
-	.long 0x80000000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**23 */
-	.long 0x41600000
-	.long 0
-.LC1:	/* -0.0 */
-	.long 0x80000000
-	.long 0
+	.long 0x4b000000
 
 	.section	".text"
 ENTRY (__ceilf)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
@@ -64,27 +56,18 @@ ENTRY (__ceilf)
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-#ifdef SHARED
-	mflr	r11
-	bl	_GLOBAL_OFFSET_TABLE_@local-4
-	mflr	r10
-	lwz	r9,.LC1@got(10)
-	mtlr	r11
-	lfd	fp1,0(r9)
-#else
-	lis	r9,.LC1@ha
-	lfd	fp1,.LC1@l(r9)
-#endif
 	blr
 	END (__ceilf)
 
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
index 933435da3d..dd68b0869c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
@@ -1,5 +1,5 @@
 /* Copy a sign bit between floating-point values.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 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
@@ -14,23 +14,26 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /* This has been coded in assembler because GCC makes such a mess of it
    when it's coded in C.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 ENTRY(__copysign)
 /* double [f1] copysign (double [f1] x, double [f2] y);
    copysign(x,y) returns a value with the magnitude of x and
    with the sign bit of y.  */
 	stwu	r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
 	stfd	fp2,8(r1)
 	lwz	r3,8(r1)
 	cmpwi   r3,0
 	addi    r1,r1,16
+	cfi_adjust_cfa_offset (-16)
 	blt     L(0)
 	fabs    fp1,fp1
 	blr
@@ -38,13 +41,20 @@ L(0):	fnabs   fp1,fp1
 	blr
 	END (__copysign)
 
-weak_alias(__copysign,copysign)
+weak_alias (__copysign,copysign)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
-weak_alias(__copysign,copysignf)
+weak_alias (__copysign,copysignf)
 strong_alias(__copysign,__copysignf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__copysign,copysignl)
+weak_alias (__copysign,copysignl)
 strong_alias(__copysign,__copysignl)
 #endif
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0)
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
new file mode 100644
index 0000000000..64b6a45437
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
@@ -0,0 +1,50 @@
+/* Copy a sign bit between floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__copysignl)
+/* long double [f1,f2] copysign (long double [f1,f2] x, long double [f3,f4] y);
+   copysign(x,y) returns a value with the magnitude of x and
+   with the sign bit of y.  */
+	stwu	r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
+	stfd	fp3,8(r1)
+	fmr	fp0,fp1
+	fabs	fp1,fp1
+	fcmpu	cr7,fp0,fp1
+	lwz	r3,8(r1)
+	cmpwi	cr6,r3,0
+	addi	r1,r1,16
+	cfi_adjust_cfa_offset (-16)
+	beq	cr7,L(0)
+	fneg	fp2,fp2
+L(0):	bgelr	cr6
+	fneg	fp1,fp1
+	fneg	fp2,fp2
+	blr
+END (__copysignl)
+
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl)
+#else
+long_double_symbol (libc, __copysignl, copysignl)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fabs.S b/sysdeps/powerpc/powerpc32/fpu/s_fabs.S
new file mode 100644
index 0000000000..53d21301ee
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fabs.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fabs.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S b/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S
new file mode 100644
index 0000000000..3655e5b2f3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S
@@ -0,0 +1,36 @@
+/* Copy a sign bit between floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__fabsl)
+/* long double [f1,f2] fabs (long double [f1,f2] x);
+   fabs(x,y) returns a value with the magnitude of x and
+   with the sign bit of y.  */
+	fmr	fp0,fp1
+	fabs	fp1,fp1
+	fcmpu	cr1,fp0,fp1
+	beqlr	cr1
+	fneg	fp2,fp2
+	blr
+END (__fabsl)
+
+long_double_symbol (libm, __fabsl, fabsl)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fdim.c b/sysdeps/powerpc/powerpc32/fpu/s_fdim.c
new file mode 100644
index 0000000000..e34b51ee54
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fdim.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fdim.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
index 143f907b18..a29e4791ea 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
@@ -1,5 +1,5 @@
 /* Floor function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,38 +14,39 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO52.0,@object
-	.size	TWO52.0,8
-TWO52.0:
-	.long 0x43300000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**52 */
-	.long 0x43300000
-	.long 0
+	.long 0x59800000
 
 	.section	".text"
 ENTRY (__floor)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsub	fp12,fp13,fp13	/* generate 0.0  */
@@ -56,15 +57,16 @@ ENTRY (__floor)
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	fmr	fp1,fp12	/* x must be +0.0 for the 0.0 case.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
 .L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
 	blr
@@ -76,3 +78,6 @@ weak_alias (__floor, floor)
 weak_alias (__floor, floorl)
 strong_alias (__floor, __floorl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
index 154bc30ff7..99fbdc5f86 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
@@ -1,5 +1,5 @@
 /* float Floor function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,38 +14,38 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO23.0,@object
-	.size	TWO23.0,8
-TWO23.0:
-	.long 0x41600000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**23 */
-	.long 0x41600000
-	.long 0
+	.long 0x4b000000
 
 	.section	".text"
 ENTRY (__floorf)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
@@ -56,15 +56,16 @@ ENTRY (__floorf)
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	fmr	fp1,fp12	/* x must be +0.0 for the 0.0 case.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
 .L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
 	blr
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fmax.S b/sysdeps/powerpc/powerpc32/fpu/s_fmax.S
new file mode 100644
index 0000000000..69735761ab
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fmax.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmax.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fmin.S b/sysdeps/powerpc/powerpc32/fpu/s_fmin.S
new file mode 100644
index 0000000000..6d4a0a946c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_fmin.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmin.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.c b/sysdeps/powerpc/powerpc32/fpu/s_isnan.c
new file mode 100644
index 0000000000..397717ba9c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/fpu/s_isnan.c
@@ -0,0 +1,7 @@
+#include <sysdeps/powerpc/fpu/s_isnan.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
index 7fdc296b0b..cb96be7c9b 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
+++ b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c
@@ -1,5 +1,5 @@
 /* Round a double value to a long long in the current rounding mode.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2006 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
@@ -17,7 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "math.h"
+#include <math.h>
+#include <math_ldbl_opt.h>
 
 long long int
 __llrint (double x)
@@ -29,3 +30,6 @@ weak_alias (__llrint, llrint)
 strong_alias (__llrint, __llrintl)
 weak_alias (__llrint, llrintl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
index 57d56c48cd..da0a1e505a 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
@@ -1,5 +1,5 @@
 /* Round double to long int.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -18,15 +18,18 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 /* long int[r3] __lrint (double x[fp1])  */
-ENTRY (__lrint)	
+ENTRY (__lrint)
+	stwu	r1,-16(r1)
 	fctiw	fp13,fp1
-	stfd	fp13,-8(r1)
+	stfd	fp13,8(r1)
 	nop	/* Insure the following load is in a different dispatch group */
 	nop	/* to avoid pipe stall on POWER4&5.  */
 	nop
-	lwz	r3,-4(r1)	
+	lwz	r3,12(r1)
+	addi	r1,r1,16
 	blr
 	END (__lrint)
 
@@ -39,3 +42,6 @@ weak_alias (__lrint, lrintf)
 strong_alias (__lrint, __lrintl)
 weak_alias (__lrint, lrintl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
index dcb97e373b..9c534ec2be 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_lround.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
@@ -1,5 +1,5 @@
 /* lround function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,32 +14,18 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
-
-	.section	.rodata
-	.align 3
-	.type	NEGZERO.0,@object
-	.size	NEGZERO.0,8
-NEGZERO.0:
-	.long 0x00000000
-	.long 0
-	.type	POINTFIVE.0,@object
-	.size	POINTFIVE.0,8
-POINTFIVE.0:
-	.long 0x3fe00000
-	.long 0
+#include <math_ldbl_opt.h>
 
 	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.align	2
 .LC0:	/* 0.0 */
 	.long 0x00000000
-	.long 0
 .LC1:	/* 0.5 */
-	.long 0x3fe00000
-	.long 0
+	.long 0x3f000000
 
 	.section	".text"
 	
@@ -54,41 +40,51 @@ POINTFIVE.0:
    to the integer value.  */
 
 ENTRY (__lround)
+	stwu    r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	addi	r9,r9,.LC0-1b@l
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+# endif
 	mtlr	r11
-	lfd	fp12,0(r9)
+	cfi_same_value (lr)
+	lfs	fp12,0(r9)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp12,.LC0@l(r9)
+	lfs	fp12,.LC0@l(r9)
 #endif
 #ifdef SHARED
-	lwz	r9,.LC1@got(10)
-	lfd	fp10,0(r9)
+	lfs	fp10,.LC1-.LC0(r9)
 #else
 	lis	r9,.LC1@ha
-	lfd	fp10,.LC1@l(r9)
+	lfs	fp10,.LC1@l(r9)
 #endif
 	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp10	/* x+= 0.5;  */
 .L9:
 	fctiwz	fp2,fp1		/* Convert To Integer DW lround toward 0.  */
-	stfd	fp2,-8(r1)
-	nop	/* Insure the following load is in a different dispatch group */
-	nop	/* to avoid pipe stall on POWER4&5.  */
+	stfd	fp2,8(r1)
+	nop	/* Ensure the following load is in a different dispatch  */
+	nop	/* group to avoid pipe stall on POWER4&5.  */
 	nop
-	lwz	r3,-4(r1)
+	lwz	r3,12(r1)
+	addi	r1,r1,16
 	blr
 .L4:
 	fsub	fp1,fp1,fp10	/* x-= 0.5;  */
 	b	.L9
 	END (__lround)
 
-strong_alias (__lround, __lround)
 weak_alias (__lround, lround)
 
 strong_alias (__lround, __lroundf)
@@ -98,3 +94,6 @@ weak_alias (__lround, lroundf)
 weak_alias (__lround, lroundl)
 strong_alias (__lround, __lroundl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
index dee25f204f..c8dca313ae 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
@@ -1,5 +1,5 @@
 /* Round to int floating-point values.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,40 +14,41 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /* This has been coded in assembler because GCC makes such a mess of it
    when it's coded in C.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO52.0,@object
-	.size	TWO52.0,8
-TWO52.0:
-	.long 0x43300000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**52 */
-	.long 0x43300000
-	.long 0
+	.long 0x59800000
 
 	.section	".text"
 ENTRY (__rint)
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsub	fp12,fp13,fp13	/* generate 0.0  */
@@ -57,13 +58,14 @@ ENTRY (__rint)
 	bng-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-	blr
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = 0.0; */
 .L4:
 	bnllr-	cr6		/* if (x < 0.0)  */
-	fsub	fp1,fp13,fp1	/* x = TWO52 - x;  */
-	fsub	fp0,fp1,fp13	/* x = - (x - TWO52);  */
-	fneg	fp1,fp0
-	blr
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = -0.0; */
 	END (__rint)
 
 weak_alias (__rint, rint)
@@ -72,3 +74,6 @@ weak_alias (__rint, rint)
 weak_alias (__rint, rintl)
 strong_alias (__rint, __rintl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
index cebf6423af..7771cb2bc8 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
@@ -1,5 +1,5 @@
 /* Round float to int floating-point values.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,38 +14,37 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 
-
-	.section	.rodata
-	.align 3
-	.type	TWO23.0,@object
-	.size	TWO23.0,8
-TWO23.0:
-	.long 0x41600000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**23 */
-	.long 0x41600000
-	.long 0
+	.long 0x4b000000
 
 	.section	".text"
 ENTRY (__rintf)
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
@@ -55,13 +54,14 @@ ENTRY (__rintf)
 	bng-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-	blr
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = 0.0; */
 .L4:
 	bnllr-	cr6		/* if (x < 0.0)  */
-	fsubs	fp1,fp13,fp1	/* x = TWO23 - x;  */
-	fsubs	fp0,fp1,fp13	/* x = - (x - TWO23);  */
-	fneg	fp1,fp0
-	blr
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = -0.0; */
 	END (__rintf)
 
 weak_alias (__rintf, rintf)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S
index 13fc74f001..590c87ad8c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_round.S
@@ -1,5 +1,5 @@
 /* round function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,40 +14,18 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
-
-	.section	.rodata
-	.align 3
-	.type	TWO52.0,@object
-	.size	TWO52.0,8
-TWO52.0:
-	.long 0x43300000
-	.long 0
-	.type	POINTFIVE.0,@object
-	.size	POINTFIVE.0,8
-POINTFIVE.0:
-	.long 0x3fe00000
-	.long 0
-	.type	NEGZERO.0,@object
-	.size	NEGZERO.0,8
-NEGZERO.0:
-	.long 0x80000000
-	.long 0
+#include <math_ldbl_opt.h>
 
 	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.align	2
 .LC0:	/* 2**52 */
-	.long 0x43300000
-	.long 0
+	.long 0x59800000
 .LC1:	/* 0.5 */
-	.long 0x3fe00000
-	.long 0
-.LC2:	/* -0.0 */
-	.long 0x80000000
-	.long 0
+	.long 0x3f000000
 
 /* double [fp1] round (double x [fp1])
    IEEE 1003.1 round function.  IEEE specifies "round to the nearest 
@@ -59,18 +37,28 @@ NEGZERO.0:
    "Round toward Zero" mode and round by adding +-0.5 before rounding
    to the integer value.  */
 
+	.section	".text"
 ENTRY (__round)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	addi	r9,r9,.LC0-1b@l
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
+	lfs	fp13,0(r9)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsub	fp12,fp13,fp13	/* generate 0.0  */
@@ -79,17 +67,17 @@ ENTRY (__round)
 	bnllr-	cr7
 	mtfsfi	7,1		/* Set rounding mode toward 0.  */
 #ifdef SHARED
-	lwz	r9,.LC1@got(10)
-	lfd	fp10,0(r9)
+	lfs	fp10,.LC1-.LC0(r9)
 #else
 	lis	r9,.LC1@ha
-	lfd	fp10,.LC1@l(r9)
+	lfs	fp10,.LC1@l(r9)
 #endif
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp10	/* x+= 0.5;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
@@ -97,16 +85,10 @@ ENTRY (__round)
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp9,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-#ifdef SHARED
-	lwz	r9,.LC2@got(10)
-	lfd	fp1,0(r9)
-#else
-	lis	r9,.LC2@ha
-	lfd	fp1,.LC2@l(r9)
-#endif
 	blr
 	END (__round)
 
@@ -116,3 +98,6 @@ weak_alias (__round, round)
 weak_alias (__round, roundl)
 strong_alias (__round, __roundl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
index ea8aaf3add..7e99bca315 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
@@ -1,5 +1,5 @@
 /* roundf  function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,40 +14,17 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO23.0,@object
-	.size	TWO23.0,8
-TWO23.0:
-	.long 0x43300000
-	.long 0
-	.type	POINTFIVE.0,@object
-	.size	POINTFIVE.0,8
-POINTFIVE.0:
-	.long 0x3fe00000
-	.long 0
-	.type	NEGZERO.0,@object
-	.size	NEGZERO.0,8
-NEGZERO.0:
-	.long 0x80000000
-	.long 0
-
 	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.align	2
 .LC0:	/* 2**23 */
-	.long 0x41600000
-	.long 0
+	.long 0x4b000000
 .LC1:	/* 0.5 */
-	.long 0x3fe00000
-	.long 0
-.LC2:	/* -0.0 */
-	.long 0x80000000
-	.long 0
+	.long 0x3f000000
 
 /* float [fp1] roundf  (float x [fp1])
    IEEE 1003.1 round function.  IEEE specifies "round to the nearest 
@@ -59,18 +36,28 @@ NEGZERO.0:
    "Round toward Zero" mode and round by adding +-0.5 before rounding
    to the integer value.  */
 
+	.section	".text"
 ENTRY (__roundf )
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	addi	r9,r9,.LC0-1b@l
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
+	lfs	fp13,0(r9)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
@@ -79,17 +66,17 @@ ENTRY (__roundf )
 	bnllr-	cr7
 	mtfsfi	7,1		/* Set rounding mode toward 0.  */
 #ifdef SHARED
-	lwz	r9,.LC1@got(10)
-	lfd	fp10,0(r9)
+	lfs	fp10,.LC1-.LC0(r9)
 #else
 	lis	r9,.LC1@ha
-	lfd	fp10,.LC1@l(r9)
+	lfs	fp10,.LC1@l(r9)
 #endif
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp10	/* x+= 0.5;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
@@ -97,16 +84,10 @@ ENTRY (__roundf )
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp9,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-#ifdef SHARED
-	lwz	r9,.LC2@got(10)
-	lfd	fp1,0(r9)
-#else
-	lis	r9,.LC2@ha
-	lfd	fp1,.LC2@l(r9)
-#endif
 	blr
 	END (__roundf)
 
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
index a4be651f8c..5bc0856b9f 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
@@ -1,5 +1,5 @@
 /* trunc function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,32 +14,16 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO52.0,@object
-	.size	TWO52.0,8
-TWO52.0:
-	.long 0x43300000
-	.long 0
-	.type	NEGZERO.0,@object
-	.size	NEGZERO.0,8
-NEGZERO.0:
-	.long 0x80000000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**52 */
-	.long 0x43300000
-	.long 0
-.LC1:	/* -0.0 */
-	.long 0x80000000
-	.long 0
+	.long 0x59800000
 
 /* double [fp1] trunc (double x [fp1])
    IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
@@ -48,18 +32,28 @@ NEGZERO.0:
    We set "round toward Zero" mode and trunc by adding +-2**52 then
    subtracting +-2**52.  */
 
+	.section	".text"
 ENTRY (__trunc)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsub	fp12,fp13,fp13	/* generate 0.0  */
@@ -70,23 +64,18 @@ ENTRY (__trunc)
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-.L9:	
-	mtfsf	0x01,fp11	/* restore previous truncing mode.  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-#ifdef SHARED
-	lwz	r9,.LC1@got(10)
-	lfd	fp1,0(r9)
-#else
-	lis	r9,.LC1@ha
-	lfd	fp1,.LC1@l(r9)
-#endif
 	blr
 	END (__trunc)
 
@@ -96,3 +85,6 @@ weak_alias (__trunc, trunc)
 weak_alias (__trunc, truncl)
 strong_alias (__trunc, __truncl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
index 9a8dae931b..e2e3bd6740 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
@@ -1,5 +1,5 @@
 /* truncf function.  PowerPC32 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -14,32 +14,15 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 
-	.section	.rodata
-	.align 3
-	.type	TWO23.0,@object
-	.size	TWO23.0,8
-TWO23.0:
-	.long 0x41600000
-	.long 0
-	.type	NEGZERO.0,@object
-	.size	NEGZERO.0,8
-NEGZERO.0:
-	.long 0x80000000
-	.long 0
-
-	.section	.rodata.cst8,"aM",@progbits,8
-	.align 3
+	.section	.rodata.cst4,"aM",@progbits,4
+	.align	2
 .LC0:	/* 2**23 */
-	.long 0x41600000
-	.long 0
-.LC1:	/* -0.0 */
-	.long 0x80000000
-	.long 0
+	.long 0x4b000000
 
 /* float [fp1] truncf (float x [fp1])
    IEEE 1003.1 trunc function.  IEEE specifies "trunc to the integer
@@ -48,18 +31,28 @@ NEGZERO.0:
    We set "round toward Zero" mode and trunc by adding +-2**23 then
    subtracting +-2**23.  */
 
+	.section	".text"
 ENTRY (__truncf)
 	mffs	fp11		/* Save current FPU rounding mode.  */
 #ifdef SHARED
 	mflr	r11
+	cfi_register(lr,r11)
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r9
+	addis	r9,r9,.LC0-1b@ha
+	lfs	fp13,.LC0-1b@l(r9)
+# else
 	bl	_GLOBAL_OFFSET_TABLE_@local-4
 	mflr	r10
 	lwz	r9,.LC0@got(10)
+	lfs	fp13,0(r9)
+# endif
 	mtlr	r11
-	lfd	fp13,0(r9)
+	cfi_same_value (lr)
 #else
 	lis	r9,.LC0@ha
-	lfd	fp13,.LC0@l(r9)
+	lfs	fp13,.LC0@l(r9)
 #endif
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
@@ -70,23 +63,18 @@ ENTRY (__truncf)
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-.L9:	
-	mtfsf	0x01,fp11	/* restore previous truncing mode.  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-#ifdef SHARED
-	lwz	r9,.LC1@got(10)
-	lfd	fp1,0(r9)
-#else
-	lis	r9,.LC1@ha
-	lfd	fp1,.LC1@l(r9)
-#endif
 	blr
 	END (__truncf)
 
diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
index 77ee05f487..851480d2ef 100644
--- a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -1,5 +1,5 @@
 /* setjmp for PowerPC.
-   Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2003-2005, 2006 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
@@ -14,16 +14,15 @@
 
    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.  */
+   Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #define _ASM
-#define _SETJMP_H
 #ifdef __NO_VMX__
 # include <novmxsetjmp.h>
 #else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
 #endif
 #include <bp-sym.h>
 #include <bp-asm.h>
@@ -32,10 +31,19 @@
 ENTRY (BP_SYM (__sigsetjmp))
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
 
+#ifdef PTR_MANGLE
+	mr   r5,r1
+	PTR_MANGLE(r5, r6)
+	stw  r5,(JB_GPR1*4)(3)
+#else
 	stw  r1,(JB_GPR1*4)(3)
+#endif
 	mflr r0
 	stw  r14,((JB_GPRS+0)*4)(3)
 	stfd fp14,((JB_FPRS+0*2)*4)(3)
+#ifdef PTR_MANGLE
+	PTR_MANGLE2 (r0, r6)
+#endif
 	stw  r0,(JB_LR*4)(3)
 	stw  r15,((JB_GPRS+1)*4)(3)
 	stfd fp15,((JB_FPRS+1*2)*4)(3)
@@ -74,23 +82,31 @@ ENTRY (BP_SYM (__sigsetjmp))
 	stw  r31,((JB_GPRS+17)*4)(3)
 	stfd fp31,((JB_FPRS+17*2)*4)(3)
 #ifndef __NO_VMX__
-#ifdef PIC
+# ifdef PIC
 	mflr    r6
+	cfi_register(lr,r6)
+#  ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r5
+	addis	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
+#  else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r5
-#ifdef SHARED
+#  endif
+	mtlr	r6
+	cfi_same_value (lr)
+#  ifdef SHARED
 	lwz     r5,_rtld_global_ro@got(r5)
-	mtlr    r6
 	lwz     r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
-#else
-	lwz     r5,_rtld_global_ro@got(r5)
-	mtlr    r6
+#  else
+	lwz     r5,_dl_hwcap@got(r5)
 	lwz     r5,0(r5)
-#endif
-#else
-	lis	r5,_dl_hwcap@ha
-	lwz     r5,_dl_hwcap@l(r5)
-#endif
+#  endif
+# else
+	lis	r6,_dl_hwcap@ha
+	lwz     r5,_dl_hwcap@l(r6)
+# endif
 	andis.	r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
 	beq	L(no_vmx)
 	la	r5,((JB_VRS)*4)(3)
@@ -164,5 +180,5 @@ L(aligned_save_vmx):
 	stvx	31,0,r6
 L(no_vmx):
 #endif
-	b JUMPTARGET (BP_SYM (__sigjmp_save))
+	b BP_SYM (__sigjmp_save@local)
 END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/powerpc/powerpc32/gprrest0.S b/sysdeps/powerpc/powerpc32/gprrest0.S
index cf493f0c47..90eb4a0c4c 100644
--- a/sysdeps/powerpc/powerpc32/gprrest0.S
+++ b/sysdeps/powerpc/powerpc32/gprrest0.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 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
@@ -13,8 +13,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /*
     General Purpose Register (GPR) restore routine
@@ -67,3 +67,4 @@ C_TEXT(_restgpr0_29):	lwz	r0,8(r1)	#get return address from frame
 			lwz	r30,-8(r1)	#restore r30
 			lwz	r31,-4(r1)	#restore r31
 			blr			#return
+END (_restgpr0_all)
diff --git a/sysdeps/powerpc/powerpc32/gprrest1.S b/sysdeps/powerpc/powerpc32/gprrest1.S
index 5ac18606f8..ca00b8f133 100644
--- a/sysdeps/powerpc/powerpc32/gprrest1.S
+++ b/sysdeps/powerpc/powerpc32/gprrest1.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 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
@@ -13,8 +13,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /*
     General Purpose Register (GPR) restore routine
@@ -61,3 +61,4 @@ C_TEXT(_restgpr1_29):	lwz	r29,-12(r12)	#restore r29
 			lwz	r30,-8(r12)	#restore r30
 			lwz	r31,-4(r12)	#restore r31
 			blr			#return
+END (_restgpr1_all)
diff --git a/sysdeps/powerpc/powerpc32/gprsave0.S b/sysdeps/powerpc/powerpc32/gprsave0.S
index a09f1e569a..c74272b56d 100644
--- a/sysdeps/powerpc/powerpc32/gprsave0.S
+++ b/sysdeps/powerpc/powerpc32/gprsave0.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 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
@@ -13,8 +13,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /*
     General Purpose Register (GPR) save routine
@@ -30,39 +30,59 @@
 ENTRY(_savegpr0_all)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_13)
 C_TEXT(_savegpr0_13):	stw	r13,-76(r1)
+			cfi_offset(r13,-76)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_14)
 C_TEXT(_savegpr0_14):	stw	r14,-72(r1)
+			cfi_offset(r14,-72)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_15)
 C_TEXT(_savegpr0_15):	stw	r15,-68(r1)
+			cfi_offset(r15,-68)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_16)
 C_TEXT(_savegpr0_16):	stw	r16,-64(r1)
+			cfi_offset(r16,-64)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_17)
 C_TEXT(_savegpr0_17):	stw	r17,-60(r1)
+			cfi_offset(r17,-60)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_18)
 C_TEXT(_savegpr0_18):	stw	r18,-56(r1)
+			cfi_offset(r18,-56)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_19)
 C_TEXT(_savegpr0_19):	stw	r19,-52(r1)
+			cfi_offset(r19,-52)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_20)
 C_TEXT(_savegpr0_20):	stw	r20,-48(r1)
+			cfi_offset(r20,-48)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_21)
 C_TEXT(_savegpr0_21):	stw	r21,-44(r1)
+			cfi_offset(r21,-44)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_22)
 C_TEXT(_savegpr0_22):	stw	r22,-40(r1)
+			cfi_offset(r22,-40)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_23)
 C_TEXT(_savegpr0_23):	stw	r23,-36(r1)
+			cfi_offset(r23,-36)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_24)
 C_TEXT(_savegpr0_24):	stw	r24,-32(r1)
+			cfi_offset(r24,-32)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_25)
 C_TEXT(_savegpr0_25):	stw	r25,-28(r1)
+			cfi_offset(r25,-28)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_26)
 C_TEXT(_savegpr0_26):	stw	r26,-24(r1)
+			cfi_offset(r26,-24)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_27)
 C_TEXT(_savegpr0_27):	stw	r27,-20(r1)
+			cfi_offset(r27,-20)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_28)
 C_TEXT(_savegpr0_28):	stw	r28,-16(r1)
+			cfi_offset(r28,-16)
 		ASM_GLOBAL_DIRECTIVE C_TEXT(_savegpr0_29)
 C_TEXT(_savegpr0_29):	stw	r29,-12(r1) #save r29
 			stw	r30,-8(r1)  #save r30
 			stw	r31,-4(r1)  #save r31
+			cfi_offset(r29,-12)
+			cfi_offset(r30,-8)
+			cfi_offset(r31,-4)
 			stw	r0,8(r1)    #save LR in callers frame
 			blr		    #return
+END (_savegpr0_all)
diff --git a/sysdeps/powerpc/powerpc32/gprsave1.S b/sysdeps/powerpc/powerpc32/gprsave1.S
index 06ee4a69d3..6c1790129e 100644
--- a/sysdeps/powerpc/powerpc32/gprsave1.S
+++ b/sysdeps/powerpc/powerpc32/gprsave1.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 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
@@ -13,8 +13,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /*
     General Purpose Register (GPR) save routine
@@ -61,3 +61,4 @@ C_TEXT(_savegpr1_29):	stw	r29,-12(r12)	#save r29
 			stw	r30,-8(r12)	#save r30
 			stw	r31,-4(r12)	#save r31
 			blr			#return
+END (_savegpr1_all)
diff --git a/sysdeps/powerpc/powerpc32/hp-timing.h b/sysdeps/powerpc/powerpc32/hp-timing.h
new file mode 100644
index 0000000000..b62b0f2138
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/hp-timing.h
@@ -0,0 +1,82 @@
+/* High precision, low overhead timing functions.  Linux/PPC32 version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _HP_TIMING_H
+#define _HP_TIMING_H	1
+
+
+/* There are no generic definitions for the times.  We could write something
+   using the `gettimeofday' system call where available but the overhead of
+   the system call might be too high.
+
+   In case a platform supports timers in the hardware the following macros
+   and types must be defined:
+
+   - HP_TIMING_AVAIL: test for availability.
+
+   - HP_TIMING_INLINE: this macro is non-zero if the functionality is not
+     implemented using function calls but instead uses some inlined code
+     which might simply consist of a few assembler instructions.  We have to
+     know this since we might want to use the macros here in places where we
+     cannot make function calls.
+
+   - hp_timing_t: This is the type for variables used to store the time
+     values.
+
+   - HP_TIMING_ZERO: clear `hp_timing_t' object.
+
+   - HP_TIMING_NOW: place timestamp for current time in variable given as
+     parameter.
+
+   - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the
+     HP_TIMING_DIFF macro.
+
+   - HP_TIMING_DIFF: compute difference between two times and store it
+     in a third.  Source and destination might overlap.
+
+   - HP_TIMING_ACCUM: add time difference to another variable.  This might
+     be a bit more complicated to implement for some platforms as the
+     operation should be thread-safe and 64bit arithmetic on 32bit platforms
+     is not.
+
+   - HP_TIMING_ACCUM_NT: this is the variant for situations where we know
+     there are no threads involved.
+
+   - HP_TIMING_PRINT: write decimal representation of the timing value into
+     the given string.  This operation need not be inline even though
+     HP_TIMING_INLINE is specified.
+
+*/
+
+/* Provide dummy definitions.  */
+#define HP_TIMING_AVAIL		(0)
+#define HP_TIMING_INLINE	(0)
+typedef unsigned long long int hp_timing_t;
+#define HP_TIMING_ZERO(Var)
+#define HP_TIMING_NOW(var)
+#define HP_TIMING_DIFF_INIT()
+#define HP_TIMING_DIFF(Diff, Start, End)
+#define HP_TIMING_ACCUM(Sum, Diff)
+#define HP_TIMING_ACCUM_NT(Sum, Diff)
+#define HP_TIMING_PRINT(Buf, Len, Val)
+
+/* Since this implementation is not available we tell the user about it.  */
+#define HP_TIMING_NONAVAIL	1
+
+#endif /* hp-timing.h */
diff --git a/sysdeps/powerpc/powerpc32/lshift.S b/sysdeps/powerpc/powerpc32/lshift.S
index 9f5870d828..65054f229d 100644
--- a/sysdeps/powerpc/powerpc32/lshift.S
+++ b/sysdeps/powerpc/powerpc32/lshift.S
@@ -1,5 +1,5 @@
 /* Shift a limb left, low level routine.
-   Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1999, 2000, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <bp-sym.h>
@@ -67,6 +67,7 @@ L(boom): tweq    r0,r0
 /* We imitate a case statement, by using (yuk!) fixed-length code chunks,
    of size 4*12 bytes.  We have to do this (or something) to make this PIC.  */
 L(big):	mflr    r9
+	cfi_register(lr,r9)
 	bltl-   cr0,L(boom)	# Never taken, only used to set LR.
 	slwi    r10,r6,4
 	mflr    r12
@@ -75,7 +76,8 @@ L(big):	mflr    r9
 	add     r10,r8,r10
 	mtctr   r10
 	addi	r5,r5,-1
-	mtlr    r9
+	mtlr	r9
+	cfi_same_value (lr)
 	bctr
 
 L(end2):slw	r0,r10,r6
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index 53f1143320..f09c294674 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -140,7 +140,7 @@ L(nondcbz):
 
 /* We can't use dcbz here as we don't know the cache line size.  We can
    use "data cache block touch for store", which is safe.  */
-L(c3):	dcbtst rNEG64, rMEMP
+L(c3):	dcbtst	rNEG64, rMEMP
 	stw	rCHR, -4(rMEMP)
 	stw	rCHR, -8(rMEMP)
 	stw	rCHR, -12(rMEMP)
@@ -166,7 +166,7 @@ L(cloopdone):
 	add	rMEMP, rMEMP, rALIGN
 	b	L(medium_tail2)	/* 72nd instruction from .align */
 
-	.align 5
+	.align	5
 	nop
 /* Clear cache lines of memory in 128-byte chunks.
    This code is optimized for processors with 32-byte cache lines.
@@ -200,7 +200,7 @@ L(zloop):
 	beqlr	cr5
 	b	L(medium_tail2)
 
-	.align 5
+	.align	5
 L(small):
 /* Memset of 4 bytes or less.  */
 	cmplwi	cr5, rLEN, 1
@@ -218,7 +218,7 @@ L(small):
 	blr
 
 /* Memset of 0-31 bytes.  */
-	.align 5
+	.align	5
 L(medium):
 	cmplwi	cr1, rLEN, 16
 L(medium_tail2):
@@ -258,70 +258,77 @@ L(medium_28t):
 
 L(checklinesize):
 #ifdef SHARED
-	mflr rTMP
+	mflr	rTMP
 /* If the remaining length is less the 32 bytes then don't bother getting
-	 the cache line size.  */
+   the cache line size.  */
 	beq	L(medium)
 /* Establishes GOT addressability so we can load __cache_line_size
    from static. This value was set from the aux vector during startup.  */
-	bl   _GLOBAL_OFFSET_TABLE_@local-4
-	mflr rGOT
-	lwz	 rGOT,__cache_line_size@got(rGOT)
-	lwz	 rCLS,0(rGOT)
-	mtlr rTMP
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	rGOT
+	addis	rGOT,rGOT,__cache_line_size-1b@ha
+	lwz	rCLS,__cache_line_size-1b@l(rGOT)
+# else
+	bl	_GLOBAL_OFFSET_TABLE_@local-4
+	mflr	rGOT
+	lwz	rGOT,__cache_line_size@got(rGOT)
+	lwz	rCLS,0(rGOT)
+# endif
+	mtlr	rTMP
 #else
 /* Load __cache_line_size from static. This value was set from the
    aux vector during startup.  */
-	lis	 rCLS,__cache_line_size@ha
+	lis	rCLS,__cache_line_size@ha
 /* If the remaining length is less the 32 bytes then don't bother getting
-	 the cache line size.  */
+   the cache line size.  */
 	beq	L(medium)
-	lwz  rCLS,__cache_line_size@l(rCLS)
+	lwz	rCLS,__cache_line_size@l(rCLS)
 #endif
 
-/*If the cache line size was not set then goto to L(nondcbz), which is
-	safe for any cache line size.  */
-	cmplwi cr1,rCLS,0
+/* If the cache line size was not set then goto to L(nondcbz), which is
+   safe for any cache line size.  */
+	cmplwi	cr1,rCLS,0
 	beq	cr1,L(nondcbz)
 
 /* If the cache line size is 32 bytes then goto to L(zloopstart),
-	 which is coded specificly for 32-byte lines (and 601).  */
-	cmplwi cr1,rCLS,32
+   which is coded specificly for 32-byte lines (and 601).  */
+	cmplwi	cr1,rCLS,32
 	beq	cr1,L(zloopstart)
 
 /* Now we know the cache line size and it is not 32-bytes.  However
-	 we may not yet be aligned to the cache line and may have a partial
-	 line to fill.  Touch it 1st to fetch the cache line.  */
-	dcbtst 0,rMEMP
+   we may not yet be aligned to the cache line and may have a partial
+   line to fill.  Touch it 1st to fetch the cache line.  */
+	dcbtst	0,rMEMP
 
-	addi rCLM,rCLS,-1
+	addi	rCLM,rCLS,-1
 L(getCacheAligned):
-	cmplwi cr1,rLEN,32
-	and. rTMP,rCLM,rMEMP
-	blt	 cr1,L(handletail32)
-	beq	 L(cacheAligned)
+	cmplwi	cr1,rLEN,32
+	and.	rTMP,rCLM,rMEMP
+	blt	cr1,L(handletail32)
+	beq	L(cacheAligned)
 /* We are not aligned to start of a cache line yet.  Store 32-byte
    of data and test again.  */
-	addi rMEMP,rMEMP,32
-	addi rLEN,rLEN,-32
-	stw	 rCHR,-32(rMEMP)
-	stw	 rCHR,-28(rMEMP)
-	stw	 rCHR,-24(rMEMP)
-	stw	 rCHR,-20(rMEMP)
-	stw	 rCHR,-16(rMEMP)
-	stw	 rCHR,-12(rMEMP)
-	stw	 rCHR,-8(rMEMP)
-	stw	 rCHR,-4(rMEMP)
-	b	 L(getCacheAligned)
+	addi	rMEMP,rMEMP,32
+	addi	rLEN,rLEN,-32
+	stw	rCHR,-32(rMEMP)
+	stw	rCHR,-28(rMEMP)
+	stw	rCHR,-24(rMEMP)
+	stw	rCHR,-20(rMEMP)
+	stw	rCHR,-16(rMEMP)
+	stw	rCHR,-12(rMEMP)
+	stw	rCHR,-8(rMEMP)
+	stw	rCHR,-4(rMEMP)
+	b	L(getCacheAligned)
 
 /* Now we are aligned to the cache line and can use dcbz.  */
 L(cacheAligned):
-	cmplw cr1,rLEN,rCLS
-	blt	 cr1,L(handletail32)
-	dcbz 0,rMEMP
-	subf rLEN,rCLS,rLEN
-	add	 rMEMP,rMEMP,rCLS
-	b	 L(cacheAligned)
+	cmplw	cr1,rLEN,rCLS
+	blt	cr1,L(handletail32)
+	dcbz	0,rMEMP
+	subf	rLEN,rCLS,rLEN
+	add	rMEMP,rMEMP,rCLS
+	b	L(cacheAligned)
 
 /* We are here because; the cache line size was set, it was not
    32-bytes, and the remainder (rLEN) is now less than the actual cache
@@ -329,7 +336,7 @@ L(cacheAligned):
    store the remaining bytes.  */
 L(handletail32):
 	clrrwi.	rALIGN, rLEN, 5
-	b		L(nondcbz)
+	b	L(nondcbz)
 
 END (BP_SYM (memset))
 libc_hidden_builtin_def (memset)
diff --git a/sysdeps/powerpc/powerpc32/ppc-mcount.S b/sysdeps/powerpc/powerpc32/ppc-mcount.S
index a72d676bbe..7e39acb55b 100644
--- a/sysdeps/powerpc/powerpc32/ppc-mcount.S
+++ b/sysdeps/powerpc/powerpc32/ppc-mcount.S
@@ -1,5 +1,5 @@
 /* PowerPC-specific implementation of profiling support.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2005, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 /* This would be bad.  */
 #ifdef PROF
@@ -24,30 +24,25 @@
 
 #include <sysdep.h>
 
-/* We do profiling as described in the SYSV ELF ABI, _mcount is called
-   with the address of a data word in r0 (that is different for every
-   routine, initialised to 0, and otherwise unused).  The caller has put
-   the address the caller will return to in the usual place on the stack,
-   4(r1).  _mcount is responsible for ensuring that when it returns no
-   argument-passing registers are disturbed, and that the LR is set back
-   to (what the caller sees as) 4(r1).
+/* We do profiling as described in the SYSV ELF ABI, except that glibc
+   _mcount manages its own counters.  The caller has put the address the
+   caller will return to in the usual place on the stack, 4(r1).  _mcount
+   is responsible for ensuring that when it returns no argument-passing
+   registers are disturbed, and that the LR is set back to (what the
+   caller sees as) 4(r1).
 
    This is intended so that the following code can be inserted at the
    front of any routine without changing the routine:
 
 	.data
-	.align	2
-   0:	.long	0
-	.previous
 	mflr	r0
-	lis	r11,0b@ha
 	stw	r0,4(r1)
-	addi	r0,r11,0b@l
 	bl	_mcount
 */
 
 ENTRY(_mcount)
 	stwu	r1,-48(r1)
+	cfi_adjust_cfa_offset (48)
 /* We need to save the parameter-passing registers.  */
 	stw	r3, 12(r1)
 	stw	r4, 16(r1)
@@ -61,8 +56,9 @@ ENTRY(_mcount)
 	stw	r9, 36(r1)
 	stw	r10,40(r1)
 	stw	r4, 44(r1)
+	cfi_offset (lr, -4)
 	stw	r5,  8(r1)
-	bl	JUMPTARGET(__mcount_internal)
+	bl	__mcount_internal@local
 	nop
  /* Restore the registers...  */
 	lwz     r6,  8(r1)
diff --git a/sysdeps/powerpc/powerpc32/register-dump.h b/sysdeps/powerpc/powerpc32/register-dump.h
index d341eea8ff..7071632083 100644
--- a/sysdeps/powerpc/powerpc32/register-dump.h
+++ b/sysdeps/powerpc/powerpc32/register-dump.h
@@ -1,5 +1,5 @@
 /* Dump registers.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006 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
@@ -113,7 +113,7 @@ register_dump (int fd, struct sigcontext *ctx)
     }
 
   /* Write the output.  */
-  write (fd, buffer, sizeof(buffer));
+  write (fd, buffer, sizeof(buffer) - 1);
 }
 
 
diff --git a/sysdeps/powerpc/powerpc32/setjmp-common.S b/sysdeps/powerpc/powerpc32/setjmp-common.S
index 40f626498c..12ee14d788 100644
--- a/sysdeps/powerpc/powerpc32/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/setjmp-common.S
@@ -1,5 +1,6 @@
 /* setjmp for PowerPC.
-   Copyright (C) 1995-1997,1999-2001,2003,2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-1997,1999-2001,2003,2004,2005, 2006
+   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
@@ -19,11 +20,10 @@
 
 #include <sysdep.h>
 #define _ASM
-#define _SETJMP_H
 #ifdef __NO_VMX__
 # include <novmxsetjmp.h>
 #else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
 #endif
 #include <bp-sym.h>
 #include <bp-asm.h>
@@ -32,9 +32,19 @@
 ENTRY (BP_SYM (__sigsetjmp))
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
 
+#ifdef PTR_MANGLE
+	mr   r5,r1
+	PTR_MANGLE(r5, r10)
+	stw  r5,(JB_GPR1*4)(3)
+#else
 	stw  r1,(JB_GPR1*4)(3)
+#endif
 	mflr r0
 	stw  r14,((JB_GPRS+0)*4)(3)
+#ifdef PTR_MANGLE
+	PTR_MANGLE2 (r0, r10)
+	li   r10,0
+#endif
 	stw  r0,(JB_LR*4)(3)
 	stw  r15,((JB_GPRS+1)*4)(3)
 	mfcr r0
@@ -55,5 +65,10 @@ ENTRY (BP_SYM (__sigsetjmp))
 	stw  r29,((JB_GPRS+15)*4)(3)
 	stw  r30,((JB_GPRS+16)*4)(3)
 	stw  r31,((JB_GPRS+17)*4)(3)
-	b JUMPTARGET (BP_SYM (__sigjmp_save))
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	li   r3,0
+	blr
+#else
+	b BP_SYM (__sigjmp_save@local)
+#endif
 END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/powerpc/powerpc32/strncmp.S b/sysdeps/powerpc/powerpc32/strncmp.S
index 3b33bb921f..3e0fff5ac2 100644
--- a/sysdeps/powerpc/powerpc32/strncmp.S
+++ b/sysdeps/powerpc/powerpc32/strncmp.S
@@ -47,6 +47,7 @@ EALIGN (BP_SYM(strncmp), 4, 0)
 	lis	r7F7F, 0x7f7f
 	dcbt	0,rSTR2
 	clrlwi.	rTMP, rTMP, 30
+	cmplwi	cr1, rN, 0
 	lis	rFEFE, -0x101
 	bne	L(unaligned)
 /* We are word alligned so set up for two loops.  first a word
@@ -54,7 +55,8 @@ EALIGN (BP_SYM(strncmp), 4, 0)
 	srwi.	rTMP, rN, 2
 	clrlwi	rN, rN, 30
 	addi	rFEFE, rFEFE, -0x101
-	addi	r7F7F, r7F7F, 0x7f7f	
+	addi	r7F7F, r7F7F, 0x7f7f
+	cmplwi	cr1, rN, 0	
 	beq	L(unaligned)
 
 	mtctr	rTMP	/* Power4 wants mtctr 1st in dispatch group.  */
@@ -122,16 +124,19 @@ L(tail):
 	addi	rSTR1, rSTR1, 4
 	bne-	cr1, L(different)
 	addi	rSTR2, rSTR2, 4
+	cmplwi	cr1, rN, 0
 L(unaligned):
 	mtctr   rN	/* Power4 wants mtctr 1st in dispatch group */
-	cmpwi	rN,0
-	lbz	rWORD1, 0(rSTR1)
-	lbz	rWORD2, 0(rSTR2)
-	bgt	L(u1)
+	bgt	cr1, L(uz)
 L(ux):
 	li	rRTN, 0
 	blr
-
+	.align 4
+L(uz):
+	lbz	rWORD1, 0(rSTR1)
+	lbz	rWORD2, 0(rSTR2)
+	nop
+	b	L(u1)
 L(u0):
 	lbzu	rWORD2, 1(rSTR2)
 L(u1):
diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index 59761f75b9..8fc624ebd9 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -1,5 +1,5 @@
 /* Assembly macros for 32-bit PowerPC.
-   Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001, 2002, 2003, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdeps/powerpc/sysdep.h>
 
@@ -29,31 +29,11 @@
 /* The mcount code relies on a the return address being on the stack
    to locate our caller and so it can restore it; so store one just
    for its benefit.  */
-# ifdef PIC
-#  define CALL_MCOUNT							      \
-  .pushsection;								      \
-  .section ".data";    							      \
-  .align ALIGNARG(2);							      \
-0:.long 0;								      \
-  .previous;								      \
+# define CALL_MCOUNT							      \
   mflr  r0;								      \
-  stw   r0,4(r1);	       						      \
-  bl    _GLOBAL_OFFSET_TABLE_@local-4;					      \
-  mflr  r11;								      \
-  lwz   r0,0b@got(r11);							      \
+  stw   r0,4(r1);							      \
+  cfi_offset (lr, 4);	       						      \
   bl    JUMPTARGET(_mcount);
-# else  /* PIC */
-#  define CALL_MCOUNT							      \
-  .section ".data";							      \
-  .align ALIGNARG(2);							      \
-0:.long 0;								      \
-  .previous;								      \
-  mflr  r0;								      \
-  lis   r11,0b@ha;		       					      \
-  stw   r0,4(r1);	       						      \
-  addi  r0,r11,0b@l;							      \
-  bl    JUMPTARGET(_mcount);
-# endif /* PIC */
 #else  /* PROF */
 # define CALL_MCOUNT		/* Do nothing.  */
 #endif /* PROF */
@@ -63,6 +43,7 @@
   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function)			      \
   .align ALIGNARG(2);							      \
   C_LABEL(name)								      \
+  cfi_startproc;							      \
   CALL_MCOUNT
 
 #define EALIGN_W_0  /* No words to insert.  */
@@ -82,6 +63,7 @@
   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function)			      \
   .align ALIGNARG(2);							      \
   C_LABEL(name)								      \
+  cfi_startproc;							      \
   CALL_MCOUNT								      \
   b 0f;									      \
   .align ALIGNARG(alignt);						      \
@@ -93,11 +75,13 @@
   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function)			      \
   .align ALIGNARG(alignt);						      \
   EALIGN_W_##words;							      \
-  C_LABEL(name)
+  C_LABEL(name)								      \
+  cfi_startproc;
 #endif
 
 #undef	END
 #define END(name)							      \
+  cfi_endproc;								      \
   ASM_SIZE_DIRECTIVE(name)
 
 #define DO_CALL(syscall)				      		      \
@@ -124,7 +108,7 @@
 
 #define PSEUDO_RET							      \
     bnslr+;								      \
-    b JUMPTARGET(__syscall_error)
+    b __syscall_error@local
 #define ret PSEUDO_RET
 
 #undef	PSEUDO_END
diff --git a/sysdeps/powerpc/powerpc64/Dist b/sysdeps/powerpc/powerpc64/Dist
deleted file mode 100644
index bbadfef3b8..0000000000
--- a/sysdeps/powerpc/powerpc64/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-dl-machine.c
-ppc-mcount.S
-elf/entry.h
-bp-asm.h
diff --git a/sysdeps/powerpc/powerpc64/Makefile b/sysdeps/powerpc/powerpc64/Makefile
index 3ced6568df..78d4f07e57 100644
--- a/sysdeps/powerpc/powerpc64/Makefile
+++ b/sysdeps/powerpc/powerpc64/Makefile
@@ -10,11 +10,25 @@ ifeq (yes,$(build-shared))
 pic-ccflag = -fpic
 endif
 
+# These flags prevent FPU or Altivec registers from being used,
+# for code called in contexts that is not allowed to touch those registers.
+# Stupid GCC requires us to pass all these ridiculous switches.
+no-special-regs := $(sort $(foreach n,40 41 50 51 60 61 62 63 \
+				      $(foreach m,2 3 4 5 6 7 8 9, \
+						  3$m 4$m 5$m),\
+				    -ffixed-$n)) \
+		   $(sort $(foreach n,$(foreach m,0 1 2 3 4 5 6 7 8 9,\
+						$m 1$m 2$m) 30 31,\
+				    -ffixed-v$n)) \
+		   -ffixed-vrsave -ffixed-vscr
+
 ifeq ($(subdir),csu)
+sysdep_routines += hp-timing
+elide-routines.os += hp-timing
 ifneq ($(elf),no)
-# The initfini generation code doesn't work in the presence of -g1 or
-# higher, so we use -g0.
-CFLAGS-initfini.s = -g0 -fpic -O1
+# The initfini generation code doesn't work in the presence of -fPIC, so
+# we use -fpic instead which is much better.
+CFLAGS-initfini.s += -fpic -O1
 endif
 endif
 
@@ -27,5 +41,5 @@ ifeq ($(subdir),gmon)
 # The assembly functions assume that fp arg regs are not trashed.
 # Compiling with -msoft-float ensures that fp regs are not used
 # for moving memory around.
-CFLAGS-mcount.c += -msoft-float
+CFLAGS-mcount.c += $(no-special-regs)
 endif
diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S
index 30087d7db4..700a2a543c 100644
--- a/sysdeps/powerpc/powerpc64/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S
@@ -1,6 +1,6 @@
 /* longjmp for PowerPC64.
-   Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996,1997,1999,2000,2001,2002,2003,2004,2005,2006
+	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
@@ -24,7 +24,7 @@
 #ifdef __NO_VMX__
 # include <novmxsetjmp.h>
 #else
-# include <bits/setjmp.h>
+# include <jmpbuf-offsets.h>
 #endif
 #include <bp-sym.h>
 #include <bp-asm.h>
@@ -108,7 +108,12 @@ aligned_restore_vmx:
 	lvx	v31,0,r6
 L(no_vmx):
 #endif
+#ifdef PTR_DEMANGLE
+	ld r22,(JB_GPR1*8)(r3)
+	PTR_DEMANGLE3 (r1, r22, r25)
+#else
 	ld r1,(JB_GPR1*8)(r3)
+#endif
 	ld r2,(JB_GPR2*8)(r3)
 	ld r0,(JB_LR*8)(r3)
 	ld r14,((JB_GPRS+0)*8)(r3)
@@ -128,6 +133,9 @@ L(no_vmx):
 	lfd fp19,((JB_FPRS+5)*8)(r3)
 	ld r20,((JB_GPRS+6)*8)(r3)
 	lfd fp20,((JB_FPRS+6)*8)(r3)
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE2 (r0, r25)
+#endif
 	mtlr r0
 /* 	std r2,40(r1)	Restore the TOC save area.  */
 	ld r21,((JB_GPRS+7)*8)(r3)
diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c
index 8669b6a689..9c8ebbb18d 100644
--- a/sysdeps/powerpc/powerpc64/backtrace.c
+++ b/sysdeps/powerpc/powerpc64/backtrace.c
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2002, 2005 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
@@ -67,3 +67,4 @@ __backtrace (void **array, int size)
   return count;
 }
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/powerpc/powerpc64/dl-lookupcfg.h b/sysdeps/powerpc/powerpc64/dl-lookupcfg.h
deleted file mode 100644
index e502941015..0000000000
--- a/sysdeps/powerpc/powerpc64/dl-lookupcfg.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Configuration of lookup functions.  PowerPC64 version.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Return the symbol map from the symbol lookup function.  */
-
-#define DL_LOOKUP_RETURNS_MAP 1
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index 3fcf77df71..cec271bb3a 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent ELF dynamic relocation inline functions.
    PowerPC64 version.
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -107,92 +107,6 @@ elf_machine_dynamic (void)
 /* The PLT uses Elf64_Rela relocs.  */
 #define elf_machine_relplt elf_machine_rela
 
-/* This code gets called via a .glink stub which loads PLT0.  It is
-   used in dl-runtime.c to call the `fixup' function and then redirect
-   to the address `fixup' returns.
-
-   Enter with r0 = plt reloc index,
-   r2 = ld.so tocbase,
-   r11 = ld.so link map.  */
-
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name) \
-  asm (".section \".text\"\n"						\
-"	.align	2\n"							\
-"	.type	" BODY_PREFIX #tramp_name ",@function\n"		\
-"	.section \".opd\",\"aw\"\n"					\
-"	.align	3\n"							\
-"	.globl	" #tramp_name "\n"					\
-"	" ENTRY_2(tramp_name) "\n"					\
-#tramp_name ":\n"							\
-"	" OPD_ENT(tramp_name) "\n"					\
-"	.previous\n"							\
-BODY_PREFIX #tramp_name ":\n"						\
-/* We need to save the registers used to pass parameters, ie. r3 thru	\
-   r10; the registers are saved in a stack frame.  */			\
-"	stdu	1,-128(1)\n"						\
-"	std	3,48(1)\n"						\
-"	mr	3,11\n"							\
-"	std	4,56(1)\n"						\
-"	sldi	4,0,1\n"						\
-"	std	5,64(1)\n"						\
-"	add	4,4,0\n"						\
-"	std	6,72(1)\n"						\
-"	sldi	4,4,3\n"						\
-"	std	7,80(1)\n"						\
-"	mflr	0\n"							\
-"	std	8,88(1)\n"						\
-/* Store the LR in the LR Save area of the previous frame.  */    	\
-"	std	0,128+16(1)\n"						\
-"	mfcr	0\n"							\
-"	std	9,96(1)\n"						\
-"	std	10,104(1)\n"						\
-/* I'm almost certain we don't have to save cr...  be safe.  */    	\
-"	std	0,8(1)\n"						\
-"	bl	" DOT_PREFIX #fixup_name "\n"				\
-/* Put the registers back.  */						\
-"	ld	0,128+16(1)\n"						\
-"	ld	10,104(1)\n"						\
-"	ld	9,96(1)\n"						\
-"	ld	8,88(1)\n"						\
-"	ld	7,80(1)\n"						\
-"	mtlr	0\n"							\
-"	ld	0,8(1)\n"						\
-"	ld	6,72(1)\n"						\
-"	ld	5,64(1)\n"						\
-"	ld	4,56(1)\n"						\
-"	mtcrf	0xFF,0\n"						\
-/* Load the target address, toc and static chain reg from the function  \
-   descriptor returned by fixup.  */					\
-"	ld	0,0(3)\n"						\
-"	ld	2,8(3)\n"						\
-"	mtctr	0\n"							\
-"	ld	11,16(3)\n"						\
-"	ld	3,48(1)\n"						\
-/* Unwind the stack frame, and jump.  */				\
-"	addi	1,1,128\n"						\
-"	bctr\n"								\
-".LT_" #tramp_name ":\n"						\
-"	.long 0\n"							\
-"	.byte 0x00,0x0c,0x24,0x40,0x00,0x00,0x00,0x00\n"		\
-"	.long .LT_" #tramp_name "-" BODY_PREFIX #tramp_name "\n"	\
-"	.short .LT_" #tramp_name "_name_end-.LT_" #tramp_name "_name_start\n" \
-".LT_" #tramp_name "_name_start:\n"					\
-"	.ascii \"" #tramp_name "\"\n"					\
-".LT_" #tramp_name "_name_end:\n"					\
-"	.align 2\n"							\
-"	" END_2(tramp_name) "\n"					\
-"	.previous");
-
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_profile_resolve, profile_fixup);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  void _dl_runtime_resolve (void);			\
-  strong_alias (_dl_runtime_resolve, _dl_profile_resolve);
-#endif
 
 #ifdef HAVE_INLINED_SYSCALLS
 /* We do not need _dl_starting_up.  */
@@ -208,16 +122,16 @@ BODY_PREFIX #tramp_name ":\n"						\
    `_dl_start' is the real entry point; its return value is the user
    program's entry point.  */
 #define RTLD_START \
-  asm (".section \".text\"\n"						\
+  asm (".pushsection \".text\"\n"					\
 "	.align	2\n"							\
 "	.type	" BODY_PREFIX "_start,@function\n"			\
-"	.section \".opd\",\"aw\"\n"					\
+"	.pushsection \".opd\",\"aw\"\n"					\
 "	.align	3\n"							\
 "	.globl	_start\n"						\
 "	" ENTRY_2(_start) "\n"						\
 "_start:\n"								\
 "	" OPD_ENT(_start) "\n"						\
-"	.previous\n"							\
+"	.popsection\n"							\
 BODY_PREFIX "_start:\n"							\
 /* We start with the following on the stack, from top:			\
    argc (4 bytes);							\
@@ -243,11 +157,11 @@ BODY_PREFIX "_start:\n"							\
 "	.align 2\n"							\
 "	" END_2(_start) "\n"						\
 "	.globl	_dl_start_user\n"					\
-"	.section \".opd\",\"aw\"\n"					\
+"	.pushsection \".opd\",\"aw\"\n"					\
 "_dl_start_user:\n"							\
 "	" OPD_ENT(_dl_start_user) "\n"					\
-"	.previous\n"							\
-"	.section	\".toc\",\"aw\"\n"				\
+"	.popsection\n"							\
+"	.pushsection	\".toc\",\"aw\"\n"				\
 DL_STARTING_UP_DEF							\
 ".LC__rtld_global:\n"							\
 "	.tc _rtld_global[TC],_rtld_global\n"				\
@@ -257,7 +171,7 @@ DL_STARTING_UP_DEF							\
 "	.tc _dl_argv_internal[TC],_dl_argv_internal\n"			\
 ".LC__dl_fini:\n"							\
 "	.tc _dl_fini[TC],_dl_fini\n"					\
-"	.previous\n"							\
+"	.popsection\n"							\
 "	.type	" BODY_PREFIX "_dl_start_user,@function\n"		\
 "	" ENTRY_2(_dl_start_user) "\n"					\
 /* Now, we do our main work of calling initialisation procedures.	\
@@ -331,7 +245,7 @@ BODY_PREFIX "_dl_start_user:\n"						\
 ".LT__dl_start_user_name_end:\n"					\
 "	.align 2\n"							\
 "	" END_2(_dl_start_user) "\n"					\
-"	.previous");
+"	.popsection");
 
 /* Nonzero iff TYPE should not be allowed to resolve to one of
    the main executable's symbols, as for a COPY reloc.  */
@@ -420,7 +334,8 @@ elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
 
 	  resolve_fd = (Elf64_FuncDesc *) (profile ? _dl_profile_resolve
 					   : _dl_runtime_resolve);
-	  if (profile && _dl_name_match_p (GLRO(dl_profile), map))
+	  if (profile && GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), map))
 	    /* This is the object we are looking for.  Say that we really
 	       want profiling and the timers are started.  */
 	    GL(dl_profile_map) = map;
@@ -545,6 +460,11 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
   return value + reloc->r_addend;
 }
 
+
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER ppc64_gnu_pltenter
+#define ARCH_LA_PLTEXIT ppc64_gnu_pltexit
+
 #endif /* dl_machine_h */
 
 #ifdef RESOLVE_MAP
@@ -567,7 +487,7 @@ extern void _dl_reloc_overflow (struct link_map *map,
                                 const Elf64_Sym *refsym)
                                 attribute_hidden;
 
-static inline void
+auto inline void __attribute__ ((always_inline))
 elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
 			   void *const reloc_addr_arg)
 {
@@ -577,7 +497,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
 
 #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
 /* This computes the value used by TPREL* relocs.  */
-static Elf64_Addr __attribute__ ((const))
+auto inline Elf64_Addr __attribute__ ((always_inline, const))
 elf_machine_tprel (struct link_map *map,
 		   struct link_map *sym_map,
 		   const Elf64_Sym *sym,
@@ -598,7 +518,7 @@ elf_machine_tprel (struct link_map *map,
 
 /* Perform the relocation specified by RELOC and SYM (which is fully
    resolved).  MAP is the object containing the reloc.  */
-static inline void
+auto inline void __attribute__ ((always_inline))
 elf_machine_rela (struct link_map *map,
 		  const Elf64_Rela *reloc,
 		  const Elf64_Sym *sym,
@@ -883,11 +803,12 @@ elf_machine_rela (struct link_map *map,
   MODIFIED_CODE_NOQUEUE (reloc_addr);
 }
 
-static inline void
+auto inline void __attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf64_Addr l_addr, const Elf64_Rela *reloc)
 {
   /* elf_machine_runtime_setup handles this.  */
 }
 
+
 #endif /* RESOLVE */
diff --git a/sysdeps/powerpc/powerpc64/dl-trampoline.S b/sysdeps/powerpc/powerpc64/dl-trampoline.S
new file mode 100644
index 0000000000..9ca394dda2
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/dl-trampoline.S
@@ -0,0 +1,442 @@
+/* PLT trampolines.  PPC64 version.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+#include <sysdep.h>
+#include <rtld-global-offsets.h>
+
+
+	.section ".text"
+/* On entry r0 contains the index of the PLT entry we need to fixup
+   and r11 contains the link_map (from PLT0+16).  The link_map becomes
+   parm1 (r3) and the index (r0) need to be converted to an offset
+   (index * 24) in parm2 (r4).  */
+
+EALIGN(_dl_runtime_resolve, 4, 0)
+/* We need to save the registers used to pass parameters, ie. r3 thru
+   r10; the registers are saved in a stack frame.  */
+	stdu	r1,-128(r1)
+	cfi_adjust_cfa_offset (128)
+	std	r3,48(r1)
+	mr	r3,r11
+	std	r4,56(r1)
+	sldi	r4,r0,1
+	std	r5,64(r1)
+	add	r4,r4,r0
+	std	r6,72(r1)
+	sldi	r4,r4,3
+	std	r7,80(r1)
+	mflr	r0
+	std	r8,88(r1)
+/* Store the LR in the LR Save area of the previous frame.  */
+	std	r0,128+16(r1)
+	cfi_offset (lr, 16)
+	mfcr	r0
+	std	r9,96(r1)
+	std	r10,104(r1)
+/* I'm almost certain we don't have to save cr...  be safe.  */
+	std	r0,8(r1)
+	bl	JUMPTARGET(_dl_fixup)
+/* Put the registers back.  */
+	ld	r0,128+16(r1)
+	ld	r10,104(r1)
+	ld	r9,96(r1)
+	ld	r8,88(r1)
+	ld	r7,80(r1)
+	mtlr	r0
+	ld	r0,8(r1)
+	ld	r6,72(r1)
+	ld	r5,64(r1)
+	ld	r4,56(r1)
+	mtcrf	0xFF,r0
+/* Load the target address, toc and static chain reg from the function
+   descriptor returned by fixup.  */
+	ld	r0,0(r3)
+	ld	r2,8(r3)
+	mtctr	r0
+	ld	r11,16(r3)
+	ld	r3,48(r1)
+/* Unwind the stack frame, and jump.  */
+	addi	r1,r1,128
+	bctr
+END(_dl_runtime_resolve)
+
+	/* Stack layout:
+	  +592   previous backchain
+	  +584   spill_r31
+	  +576   spill_r30
+	  +560   v1
+	  +552   fp4
+	  +544   fp3
+	  +536   fp2
+	  +528   fp1
+	  +520   r4
+	  +512   r3
+	   return values
+          +504   free
+	  +496   stackframe
+	  +488   lr
+	  +480   r1
+	  +464   v13
+	  +448   v12
+	  +432   v11
+	  +416   v10
+	  +400   v9
+	  +384   v8
+	  +368   v7
+	  +352   v6
+	  +336   v5
+	  +320   v4
+	  +304   v3
+	  +288   v2
+	 * VMX Parms in V2-V13, V0-V1 are scratch
+	  +284   vrsave
+	  +280   free
+	  +272   fp13
+	  +264   fp12
+	  +256   fp11
+	  +248   fp10
+	  +240   fp9
+	  +232   fp8
+	  +224   fp7
+	  +216   fp6
+	  +208   fp5
+	  +200   fp4
+	  +192   fp3
+	  +184   fp2
+	  +176   fp1
+	 * FP Parms in FP1-FP13, FP0 is a scratch register
+	  +168   r10
+	  +160   r9
+	  +152   r8
+	  +144   r7
+	  +136   r6
+	  +128   r5
+	  +120   r4
+	  +112   r3
+	 * Integer parms in R3-R10, R0 is scratch, R1 SP, R2 is TOC
+	  +104   parm8
+	  +96    parm7
+	  +88    parm6
+	  +80    parm5
+	  +72    parm4
+	  +64    parm3
+	  +56    parm2
+	  +48    parm1
+	 * Parameter save area, Allocated by the call, at least 8 double words
+	  +40    TOC save area
+	  +32    Reserved for linker
+	  +24    Reserved for compiler
+	  +16    LR save area
+	  +8     CR save area
+	r1+0     stack back chain
+	*/
+#define FRAME_SIZE 592
+#define INT_RTN 512
+#define FPR_RTN 528
+#define VR_RTN 560
+#define STACK_FRAME 496
+#define CALLING_LR 488
+#define CALLING_SP 480
+#define INT_PARMS 112
+#define FPR_PARMS 176
+#define VR_PARMS 288
+#define VR_VRSAVE 284
+	.section	".toc","aw"
+.LC__dl_hwcap:
+# ifdef SHARED
+	.tc _rtld_global_ro[TC],_rtld_global_ro
+# else
+	.tc _dl_hwcap[TC],_dl_hwcap
+# endif
+	.section ".text"
+
+	.machine	"altivec"
+/* On entry r0 contains the index of the PLT entry we need to fixup
+   and r11 contains the link_map (from PLT0+16).  The link_map becomes
+   parm1 (r3) and the index (r0) needs to be converted to an offset
+   (index * 24) in parm2 (r4).  */
+#ifndef PROF
+EALIGN(_dl_profile_resolve, 4, 0)
+/* Spill r30, r31 to preserve the link_map* and reloc_addr, in case we
+   need to call _dl_call_pltexit.  */
+	std	r31,-8(r1)
+	cfi_offset(r31,-8)
+	std	r30,-16(r1)
+	cfi_offset(r30,-16)
+/* We need to save the registers used to pass parameters, ie. r3 thru
+   r10; the registers are saved in a stack frame.  */
+	stdu	r1,-FRAME_SIZE(r1)
+	cfi_adjust_cfa_offset (FRAME_SIZE)
+	std	r3,INT_PARMS+0(r1)
+	mr	r3,r11
+	std	r4,INT_PARMS+8(r1)
+	sldi	r4,r0,1		/* index * 2 */
+	std	r5,INT_PARMS+16(r1)
+	add	r4,r4,r0	/* index * 3 */
+	std	r6,INT_PARMS+24(r1)
+	sldi	r4,r4,3		/* index * 24  == PLT offset */
+	mflr	r5
+	std	r7,INT_PARMS+32(r1)
+	std	r8,INT_PARMS+40(r1)
+/* Store the LR in the LR Save area of the previous frame.  */
+/* XXX Do we have to do this?  */
+	la	r8,FRAME_SIZE(r1)
+	std	r5,FRAME_SIZE+16(r1)
+	cfi_offset (lr, 16)
+	std	r5,CALLING_LR(r1)
+	mfcr	r0
+	std	r9,INT_PARMS+48(r1)
+	std	r10,INT_PARMS+56(r1)
+	std	r8,CALLING_SP(r1)
+/* I'm almost certain we don't have to save cr...  be safe.  */
+	std	r0,8(r1)
+	ld	r12,.LC__dl_hwcap@toc(r2)
+#ifdef SHARED
+	/* Load _rtld-global._dl_hwcap.  */
+	ld	r12,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r12)
+#else
+	ld	r12,0(r12) /* Load extern _dl_hwcap.  */
+#endif
+	andis.  r0,r12,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+	beq	L(saveFP)
+	la	r10,(VR_PARMS+0)(r1)
+	la	r9,(VR_PARMS+16)(r1)
+	li	r11,32
+	li	r12,64
+	stvx	v2,0,r10
+	stvx	v3,0,r9
+
+	stvx	v4,r11,r10
+	stvx	v5,r11,r9
+	addi	r11,r11,64
+
+	stvx	v6,r12,r10
+	stvx	v7,r12,r9
+	addi	r12,r12,64
+
+	stvx	v8,r11,r10
+	stvx	v9,r11,r9
+	addi	r11,r11,64
+
+	stvx	v10,r12,r10
+	stvx	v11,r12,r9
+	mfspr	r0,VRSAVE
+
+	stvx	v12,r11,r10
+	stvx	v13,r11,r9
+L(saveFP):
+	stw	r0,VR_VRSAVE(r1)
+/* Save floating registers.  */
+	stfd	fp1,FPR_PARMS+0(r1)
+	stfd	fp2,FPR_PARMS+8(r1)
+	stfd	fp3,FPR_PARMS+16(r1)
+	stfd	fp4,FPR_PARMS+24(r1)
+	stfd	fp5,FPR_PARMS+32(r1)
+	stfd	fp6,FPR_PARMS+40(r1)
+	stfd	fp7,FPR_PARMS+48(r1)
+	stfd	fp8,FPR_PARMS+56(r1)
+	stfd	fp9,FPR_PARMS+64(r1)
+	stfd	fp10,FPR_PARMS+72(r1)
+	stfd	fp11,FPR_PARMS+80(r1)
+	li	r0,-1
+	stfd	fp12,FPR_PARMS+88(r1)
+	stfd	fp13,FPR_PARMS+96(r1)
+/* Load the extra parameters.  */
+	addi	r6,r1,INT_PARMS
+	addi	r7,r1,STACK_FRAME
+/* Save  link_map* and reloc_addr parms for later.  */
+	mr	r31,r3
+	mr	r30,r4
+	std	r0,0(r7)
+	bl	JUMPTARGET(_dl_profile_fixup)
+	nop
+/* Test *framesizep > 0 to see if need to do pltexit processing.  */
+	ld	r0,STACK_FRAME(r1)
+/* Put the registers back.  */
+	lwz	r12,VR_VRSAVE(r1)
+	cmpdi	cr1,r0,0
+	cmpdi	cr0,r12,0
+	bgt	cr1,L(do_pltexit)
+	la	r10,(VR_PARMS+0)(r1)
+	la	r9,(VR_PARMS+16)(r1)
+/* VRSAVE must be non-zero if VMX is present and VRs are in use. */
+	beq	L(restoreFXR)
+	li	r11,32
+	li	r12,64
+	lvx	v2,0,r10
+	lvx	v3,0,r9
+
+	lvx	v4,r11,r10
+	lvx	v5,r11,r9
+	addi	r11,r11,64
+
+	lvx	v6,r12,r10
+	lvx	v7,r12,r9
+	addi	r12,r12,64
+
+	lvx	v8,r11,r10
+	lvx	v9,r11,r9
+	addi	r11,r11,64
+
+	lvx	v10,r12,r10
+	lvx	v11,r12,r9
+
+	lvx	v12,r11,r10
+	lvx	v13,r11,r9
+L(restoreFXR):
+	ld	r0,FRAME_SIZE+16(r1)
+	ld	r10,INT_PARMS+56(r1)
+	ld	r9,INT_PARMS+48(r1)
+	ld	r8,INT_PARMS+40(r1)
+	ld	r7,INT_PARMS+32(r1)
+	mtlr	r0
+	ld	r0,8(r1)
+	ld	r6,INT_PARMS+24(r1)
+	ld	r5,INT_PARMS+16(r1)
+	ld	r4,INT_PARMS+8(r1)
+	mtcrf	0xFF,r0
+/* Load the target address, toc and static chain reg from the function
+   descriptor returned by fixup.  */
+	ld	r0,0(r3)
+	ld	r2,8(r3)
+	ld	r11,16(r3)
+	ld	r3,INT_PARMS+0(r1)
+	mtctr	r0
+/* Load the floating point registers.  */
+	lfd	fp1,FPR_PARMS+0(r1)
+	lfd	fp2,FPR_PARMS+8(r1)
+	lfd	fp3,FPR_PARMS+16(r1)
+	lfd	fp4,FPR_PARMS+24(r1)
+	lfd	fp5,FPR_PARMS+32(r1)
+	lfd	fp6,FPR_PARMS+40(r1)
+	lfd	fp7,FPR_PARMS+48(r1)
+	lfd	fp8,FPR_PARMS+56(r1)
+	lfd	fp9,FPR_PARMS+64(r1)
+	lfd	fp10,FPR_PARMS+72(r1)
+	lfd	fp11,FPR_PARMS+80(r1)
+	lfd	fp12,FPR_PARMS+88(r1)
+	lfd	fp13,FPR_PARMS+96(r1)
+/* Unwind the stack frame, and jump.  */
+	ld	r31,584(r1)
+	ld	r30,576(r1)
+	addi	r1,r1,FRAME_SIZE
+	bctr
+L(do_pltexit):
+	la	r10,(VR_PARMS+0)(r1)
+	la	r9,(VR_PARMS+16)(r1)
+	beq	L(restoreFXR2)
+	li	r11,32
+	li	r12,64
+	lvx	v2,0,r10
+	lvx	v3,0,r9
+
+	lvx	v4,r11,r10
+	lvx	v5,r11,r9
+	addi	r11,r11,64
+
+	lvx	v6,r12,r10
+	lvx	v7,r12,r9
+	addi	r12,r12,64
+
+	lvx	v8,r11,r10
+	lvx	v9,r11,r9
+	addi	r11,r11,64
+
+	lvx	v10,r12,r10
+	lvx	v11,r12,r9
+
+	lvx	v12,r11,r10
+	lvx	v13,r11,r9
+L(restoreFXR2):
+	ld	r0,FRAME_SIZE+16(r1)
+	ld	r10,INT_PARMS+56(r1)
+	ld	r9,INT_PARMS+48(r1)
+	ld	r8,INT_PARMS+40(r1)
+	ld	r7,INT_PARMS+32(r1)
+	mtlr	r0
+	ld	r0,8(r1)
+	ld	r6,INT_PARMS+24(r1)
+	ld	r5,INT_PARMS+16(r1)
+	ld	r4,INT_PARMS+8(r1)
+	mtcrf	0xFF,r0
+/* Load the target address, toc and static chain reg from the function
+   descriptor returned by fixup.  */
+	ld	r0,0(r3)
+	std	r2,40(r1)
+	ld	r2,8(r3)
+	ld	r11,16(r3)
+	ld	r3,INT_PARMS+0(r1)
+	mtctr	r0
+/* Load the floating point registers.  */
+	lfd	fp1,FPR_PARMS+0(r1)
+	lfd	fp2,FPR_PARMS+8(r1)
+	lfd	fp3,FPR_PARMS+16(r1)
+	lfd	fp4,FPR_PARMS+24(r1)
+	lfd	fp5,FPR_PARMS+32(r1)
+	lfd	fp6,FPR_PARMS+40(r1)
+	lfd	fp7,FPR_PARMS+48(r1)
+	lfd	fp8,FPR_PARMS+56(r1)
+	lfd	fp9,FPR_PARMS+64(r1)
+	lfd	fp10,FPR_PARMS+72(r1)
+	lfd	fp11,FPR_PARMS+80(r1)
+	lfd	fp12,FPR_PARMS+88(r1)
+	lfd	fp13,FPR_PARMS+96(r1)
+/* Call the target function.  */
+	bctrl
+	ld	r2,40(r1)
+	lwz	r12,VR_VRSAVE(r1)
+/* But return here and store the return values.  */
+	std	r3,INT_RTN(r1)
+	std	r4,INT_RTN+8(r1)
+	stfd	fp1,FPR_PARMS+0(r1)
+	stfd	fp2,FPR_PARMS+8(r1)
+	cmpdi	cr0,r12,0
+	la	r10,VR_RTN(r1)
+	stfd	fp3,FPR_PARMS+16(r1)
+	stfd	fp4,FPR_PARMS+24(r1)
+	mr	r3,r31
+	mr	r4,r30
+	beq	L(callpltexit)
+	stvx	v2,0,r10
+L(callpltexit):
+	addi	r5,r1,INT_PARMS
+	addi	r6,r1,INT_RTN
+	bl	JUMPTARGET(_dl_call_pltexit)
+	nop
+/* Restore the return values from target function.  */
+	lwz	r12,VR_VRSAVE(r1)
+	ld	r3,INT_RTN(r1)
+	ld	r4,INT_RTN+8(r1)
+	lfd	fp1,FPR_PARMS+0(r1)
+	lfd	fp2,FPR_PARMS+8(r1)
+	cmpdi	cr0,r12,0
+	la	r10,VR_RTN(r1)
+	lfd	fp3,FPR_PARMS+16(r1)
+	lfd	fp4,FPR_PARMS+24(r1)
+	beq	L(pltexitreturn)
+	lvx	v2,0,r10
+L(pltexitreturn):
+	ld	r0,FRAME_SIZE+16(r1)
+	ld	r31,584(r1)
+	ld	r30,576(r1)
+	mtlr	r0
+	ld	r1,0(r1)
+	blr
+END(_dl_profile_resolve)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/elf/Makefile b/sysdeps/powerpc/powerpc64/elf/Makefile
index bd0580ebc9..6a77e116bd 100644
--- a/sysdeps/powerpc/powerpc64/elf/Makefile
+++ b/sysdeps/powerpc/powerpc64/elf/Makefile
@@ -2,10 +2,10 @@
 
 # Need to prevent gcc from using fprs in code used during dynamic linking.
 
-CFLAGS-dl-runtime.os := -msoft-float
-CFLAGS-dl-lookup.os := -msoft-float
-CFLAGS-dl-misc.os := -msoft-float
-CFLAGS-rtld-mempcpy.os := -msoft-float
-CFLAGS-rtld-memmove.os := -msoft-float
-CFLAGS-rtld-memchr.os := -msoft-float
-CFLAGS-rtld-strnlen.os := -msoft-float
+CFLAGS-dl-runtime.os = $(no-special-regs)
+CFLAGS-dl-lookup.os = $(no-special-regs)
+CFLAGS-dl-misc.os = $(no-special-regs)
+CFLAGS-rtld-mempcpy.os = $(no-special-regs)
+CFLAGS-rtld-memmove.os = $(no-special-regs)
+CFLAGS-rtld-memchr.os = $(no-special-regs)
+CFLAGS-rtld-strnlen.os = $(no-special-regs)
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
new file mode 100644
index 0000000000..0a229cbe27
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
@@ -0,0 +1,29 @@
+/* Double-precision floating point square root.
+   Copyright (C) 1997, 2002, 2003, 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <math_private.h>
+
+double
+__ieee754_sqrt (double x)
+{
+  double z;
+  __asm __volatile ("fsqrt %0,%1" : "=f" (z) : "f" (x));
+  return z;
+}
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
new file mode 100644
index 0000000000..0f17a64a8a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
@@ -0,0 +1,29 @@
+/* Single-precision floating point square root.
+   Copyright (C) 1997, 2003, 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <math_private.h>
+
+float
+__ieee754_sqrtf (float x)
+{
+  double z;
+  __asm ("fsqrts %0,%1" : "=f" (z) : "f" (x));
+  return z;
+}
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
index a1bfaa70c2..02b70940ee 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_ceil.S
@@ -1,5 +1,5 @@
 /* ceil function.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -18,15 +18,14 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 	.section	".toc","aw"
 .LC0:	/* 2**52 */
 	.tc FD_43300000_0[TC],0x4330000000000000
-.LC1:	/* -0.0 */
-	.tc FD_80000000_0[TC],0x8000000000000000
 	.section	".text"
 
-ENTRY (__ceil)
+EALIGN (__ceil, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
 	lfd	fp13,.LC0@toc(2)
@@ -39,17 +38,18 @@ ENTRY (__ceil)
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	lfd	fp1,.LC1@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
 	blr
 	END (__ceil)
 
@@ -59,3 +59,6 @@ weak_alias (__ceil, ceil)
 weak_alias (__ceil, ceill)
 strong_alias (__ceil, __ceill)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __ceil, ceill, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
index 42eb274389..1ccd133b66 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S
@@ -21,15 +21,13 @@
 
 	.section	".toc","aw"
 .LC0:	/* 2**23 */
-	.tc FD_41600000_0[TC],0x4160000000000000
-.LC1:	/* -0.0 */
-	.tc FD_80000000_0[TC],0x8000000000000000
+	.tc FD_4b000000_0[TC],0x4b00000000000000
 	.section	".text"
 
-ENTRY (__ceilf)
+EALIGN (__ceilf, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
-	lfd	fp13,.LC0@toc(2)
+	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
 	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
@@ -39,17 +37,18 @@ ENTRY (__ceilf)
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	lfd	fp1,.LC1@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
 	blr
 	END (__ceilf)
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_ceill.S b/sysdeps/powerpc/powerpc64/fpu/s_ceill.S
new file mode 100644
index 0000000000..a8f8a0afc5
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_ceill.S
@@ -0,0 +1,133 @@
+/* s_ceill.S IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+
+	.section	".text"
+
+/* long double [fp1,fp2] ceill (long double x [fp1,fp2])
+   IEEE 1003.1 ceil function.
+
+   PowerPC64 long double uses the IBM extended format which is
+   represented two 64-floating point double values. The values are
+   non-overlapping giving an effective precision of 106 bits. The first
+   double contains the high order bits of mantisa and is always ceiled
+   to represent a normal ceiling of long double to double. Since the
+   long double value is sum of the high and low values, the low double
+   normally has the opposite sign to compensate for the this ceiling.
+
+   For long double there are two cases:
+   1) |x| < 2**52, all the integer bits are in the high double.
+      ceil the high double and set the low double to -0.0.
+   2) |x| >= 2**52, ceiling involves both doubles.
+      See the comment before lable .L2 for details.
+   */
+
+ENTRY (__ceill)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fabs	fp9,fp2
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnl-	cr7,.L2
+	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
+	fneg	fp2,fp12
+	ble-	cr6,.L1
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+.L0:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr			/* x = 0.0; */
+.L1:
+	bge-	cr6,.L0		/* if (x < 0.0)  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = -0.0; */
+	
+/* The high double is > TWO52 so we need to round the low double and
+   perhaps the high double.  In this case we have to round the low
+   double and handle any adjustment to the high double that may be
+   caused by rounding (up).  This is complicated by the fact that the
+   high double may already be rounded and the low double may have the
+   opposite sign to compensate.This gets a bit tricky so we use the
+   following algorithm:
+
+   tau = floor(x_high/TWO52);
+   x0 = x_high - tau;
+   x1 = x_low + tau;
+   r1 = rint(x1);
+   y_high = x0 + r1;
+   y_low = x0 - y_high + r1;
+   return y;  */
+.L2:
+	fcmpu	cr7,fp9,fp13	/* if (|x_low| > TWO52)  */
+	fcmpu	cr0,fp9,fp12	/* || (|x_low| == 0.0)  */
+	fcmpu	cr5,fp2,fp12	/* if (x_low > 0.0)  */
+	bgelr-	cr7		/*   return x;	*/
+	beqlr-  cr0
+	mtfsfi	7,2		/* Set rounding mode toward +inf.  */
+	fdiv	fp8,fp1,fp13	/* x_high/TWO52  */
+	
+	bng-	cr6,.L6		/* if (x > 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */
+	bng	cr5,.L4		/* if (x_low > 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L5
+.L4:				/* if (x_low < 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L5:
+	fadd	fp5,fp4,fp13	/* r1 = r1 + TWO52;  */
+	fsub	fp5,fp5,fp13	/* r1 = r1 - TWO52;  */
+	b	.L9
+.L6:				/* if (x < 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */	
+	bnl	cr5,.L7		/* if (x_low < 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L8
+.L7:				/* if (x_low > 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L8:
+	fsub	fp5,fp4,fp13	/* r1-= TWO52;  */
+	fadd	fp5,fp5,fp13	/* r1+= TWO52;  */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	fadd	fp1,fp3,fp5	/* y_high = x0 + r1;  */
+	fsub	fp2,fp3,fp1	/* y_low = x0 - y_high + r1;  */
+	fadd	fp2,fp2,fp5
+	blr
+END (__ceill)
+
+long_double_symbol (libm, __ceill, ceill)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
index a43ed12cf0..38171e31d7 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
@@ -1,5 +1,5 @@
 /* Copy a sign bit between floating-point values.  PowerPC64 version.
-   Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2002, 2006 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
@@ -21,6 +21,7 @@
    when it's coded in C.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 ENTRY(__copysign)
 	CALL_MCOUNT 0
@@ -28,7 +29,11 @@ ENTRY(__copysign)
    copysign(x,y) returns a value with the magnitude of x and
    with the sign bit of y.  */
 	stdu	r1,-48(r1)
+	cfi_adjust_cfa_offset (48)
 	stfd	fp2,24(r1)
+	nop
+	nop
+	nop
 	ld	r3,24(r1)
 	cmpdi   r3,0
 	addi    r1,r1,48
@@ -39,13 +44,20 @@ L(0):	fnabs   fp1,fp1
 	blr
 	END (__copysign)
 
-weak_alias(__copysign,copysign)
+weak_alias (__copysign,copysign)
 
 /* It turns out that it's safe to use this code even for single-precision.  */
-weak_alias(__copysign,copysignf)
+weak_alias (__copysign,copysignf)
 strong_alias(__copysign,__copysignf)
 
 #ifdef NO_LONG_DOUBLE
-weak_alias(__copysign,copysignl)
+weak_alias (__copysign,copysignl)
 strong_alias(__copysign,__copysignl)
 #endif
+#ifdef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __copysign, copysignl, GLIBC_2_0)
+# endif
+#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __copysign, copysignl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S b/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S
new file mode 100644
index 0000000000..b2c62eacba
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_copysignl.S
@@ -0,0 +1,51 @@
+/* Copy a sign bit between floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__copysignl)
+/* long double [f1,f2] copysign (long double [f1,f2] x, long double [f3,f4] y);
+   copysign(x,y) returns a value with the magnitude of x and
+   with the sign bit of y.  */
+	stfd	fp3,-16(r1)
+	ld	r3,-16(r1)
+	cmpdi   r3,0
+	blt     L(0)
+	fmr	fp0,fp1
+	fabs	fp1,fp1
+	fcmpu	cr1,fp0,fp1
+	beqlr	cr1
+	fneg	fp2,fp2
+	blr
+L(0):
+	fmr	fp0,fp1
+	fnabs   fp1,fp1
+	fcmpu	cr1,fp0,fp1
+	beqlr	cr1
+	fneg	fp2,fp2
+	blr
+END (__copysignl)
+
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl)
+#else
+long_double_symbol (libc, __copysignl, copysignl)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fabs.S b/sysdeps/powerpc/powerpc64/fpu/s_fabs.S
new file mode 100644
index 0000000000..53d21301ee
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fabs.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fabs.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S b/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S
new file mode 100644
index 0000000000..3655e5b2f3
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fabsl.S
@@ -0,0 +1,36 @@
+/* Copy a sign bit between floating-point values.
+   IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+ENTRY(__fabsl)
+/* long double [f1,f2] fabs (long double [f1,f2] x);
+   fabs(x,y) returns a value with the magnitude of x and
+   with the sign bit of y.  */
+	fmr	fp0,fp1
+	fabs	fp1,fp1
+	fcmpu	cr1,fp0,fp1
+	beqlr	cr1
+	fneg	fp2,fp2
+	blr
+END (__fabsl)
+
+long_double_symbol (libm, __fabsl, fabsl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fdim.c b/sysdeps/powerpc/powerpc64/fpu/s_fdim.c
new file mode 100644
index 0000000000..e34b51ee54
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fdim.c
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fdim.c>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fdim, fdiml, GLIBC_2_1);
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floor.S b/sysdeps/powerpc/powerpc64/fpu/s_floor.S
index 80cbdc5709..65a2848b67 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_floor.S
@@ -1,5 +1,5 @@
 /* Floor function.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -18,13 +18,14 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 	.section	".toc","aw"
 .LC0:	/* 2**52 */
 	.tc FD_43300000_0[TC],0x4330000000000000
 	.section	".text"
 
-ENTRY (__floor)
+EALIGN (__floor, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
 	lfd	fp13,.LC0@toc(2)
@@ -37,15 +38,16 @@ ENTRY (__floor)
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	fmr	fp1,fp12	/* x must be +0.0 for the 0.0 case.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
 .L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
 	blr
@@ -57,3 +59,6 @@ weak_alias (__floor, floor)
 weak_alias (__floor, floorl)
 strong_alias (__floor, __floorl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __floor, floorl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
index 20cbb15ebd..bcdbf7823d 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
@@ -21,13 +21,13 @@
 
 	.section	".toc","aw"
 .LC0:	/* 2**23 */
-	.tc FD_41600000_0[TC],0x4160000000000000
+	.tc FD_4b000000_0[TC],0x4b00000000000000
 	.section	".text"
 
-ENTRY (__floorf)
+EALIGN (__floorf, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
-	lfd	fp13,.LC0@toc(2)
+	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
 	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
@@ -37,15 +37,16 @@ ENTRY (__floorf)
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	fmr	fp1,fp12	/* x must be +0.0 for the 0.0 case.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
 .L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
 	blr
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_floorl.S b/sysdeps/powerpc/powerpc64/fpu/s_floorl.S
new file mode 100644
index 0000000000..01b3c2101d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_floorl.S
@@ -0,0 +1,134 @@
+/* long double floor function.
+   IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+
+	.section	".text"
+/* long double [fp1,fp2] floorl (long double x [fp1,fp2])
+   IEEE 1003.1 floor function.
+
+   PowerPC64 long double uses the IBM extended format which is
+   represented two 64-floating point double values. The values are
+   non-overlapping giving an effective precision of 106 bits. The first
+   double contains the high order bits of mantisa and is always rounded
+   to represent a normal rounding of long double to double. Since the
+   long double value is sum of the high and low values, the low double
+   normally has the opposite sign to compensate for the this rounding.
+
+   For long double there are two cases:
+   1) |x| < 2**52, all the integer bits are in the high double.
+      floor the high double and set the low double to -0.0.
+   2) |x| >= 2**52, Rounding involves both doubles.
+      See the comment before lable .L2 for details.
+   */
+
+ENTRY (__floorl)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fabs	fp9,fp2
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnl-	cr7,.L2
+	mtfsfi	7,3		/* Set rounding mode toward -inf.  */
+	fneg	fp2,fp12	/* set low double to -0.0.  */
+	ble-	cr6,.L0
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	bnelr+	cr5
+	fmr	fp1,fp12	/* x must be +0.0 for the 0.0 case.  */
+	blr
+.L0:
+	bge-	cr6,.L1		/* if (x < 0.0)  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+.L1:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+	
+
+/* The high double is > TWO52 so we need to round the low double and
+   perhaps the high double.  In this case we have to round the low
+   double and handle any adjustment to the high double that may be
+   caused by rounding (up).  This is complicated by the fact that the
+   high double may already be rounded and the low double may have the
+   opposite sign to compensate.This gets a bit tricky so we use the
+   following algorithm:
+
+   tau = floor(x_high/TWO52);
+   x0 = x_high - tau;
+   x1 = x_low + tau;
+   r1 = rint(x1);
+   y_high = x0 + r1;
+   y_low = x0 - y_high + r1;
+   return y;  */
+.L2:
+	fcmpu	cr7,fp9,fp13	/* if (|x_low| > TWO52)  */
+	fcmpu	cr0,fp9,fp12	/* || (|x_low| == 0.0)  */
+	fcmpu	cr5,fp2,fp12	/* if (x_low > 0.0)  */
+	bgelr-	cr7		/*   return x;	*/
+	beqlr-  cr0
+	mtfsfi	7,3		/* Set rounding mode toward -inf.  */
+	fdiv	fp8,fp1,fp13	/* x_high/TWO52  */
+	
+	bng-	cr6,.L6		/* if (x > 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */
+	bng	cr5,.L4		/* if (x_low > 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L5
+.L4:				/* if (x_low < 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L5:
+	fadd	fp5,fp4,fp13	/* r1 = r1 + TWO52;  */
+	fsub	fp5,fp5,fp13	/* r1 = r1 - TWO52;  */
+	b	.L9
+.L6:				/* if (x < 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */	
+	bnl	cr5,.L7		/* if (x_low < 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L8
+.L7:				/* if (x_low > 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L8:
+	fsub	fp5,fp4,fp13	/* r1-= TWO52;  */
+	fadd	fp5,fp5,fp13	/* r1+= TWO52;  */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	fadd	fp1,fp3,fp5	/* y_high = x0 + r1;  */
+	fsub	fp2,fp3,fp1	/* y_low = x0 - y_high + r1;  */
+	fadd	fp2,fp2,fp5
+	blr
+END (__floorl)
+
+long_double_symbol (libm, __floorl, floorl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fmax.S b/sysdeps/powerpc/powerpc64/fpu/s_fmax.S
new file mode 100644
index 0000000000..69735761ab
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fmax.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmax.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_fmin.S b/sysdeps/powerpc/powerpc64/fpu/s_fmin.S
new file mode 100644
index 0000000000..6d4a0a946c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_fmin.S
@@ -0,0 +1,5 @@
+#include <math_ldbl_opt.h>
+#include <sysdeps/powerpc/fpu/s_fmin.S>
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __fmin, fminl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_isnan.c b/sysdeps/powerpc/powerpc64/fpu/s_isnan.c
new file mode 100644
index 0000000000..397717ba9c
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_isnan.c
@@ -0,0 +1,7 @@
+#include <sysdeps/powerpc/fpu/s_isnan.c>
+#ifndef IS_IN_libm
+# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+# endif
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
index 610b561f25..ff0ba948a5 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llrint.S
@@ -1,5 +1,5 @@
 /* Round double to long int.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 /* long long int[r3] __llrint (double x[fp1])  */
 ENTRY (__llrint)	
@@ -41,3 +42,7 @@ weak_alias (__llrint, llrintl)
 strong_alias (__lrint, __lrintl)
 weak_alias (__lrint, lrintl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
+compat_symbol (libm, __lrint, lrintl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llround.S b/sysdeps/powerpc/powerpc64/fpu/s_llround.S
index a3dcd4c33d..d023b8f2c0 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llround.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llround.S
@@ -1,5 +1,5 @@
 /* llround function.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 	.section	".toc","aw"
 .LC0:	/* -0.0 */
@@ -66,3 +67,7 @@ strong_alias (__llround, __llroundl)
 weak_alias (__lround, lroundl)
 strong_alias (__lround, __lroundl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __llround, llroundl, GLIBC_2_1)
+compat_symbol (libm, __lround, lroundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
index b5ca43bf20..bbbd05492e 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_llroundf.S
@@ -1,5 +1,5 @@
 /* llroundf function.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -28,8 +28,8 @@
 	
 /* long long [r3] llroundf (float x [fp1])
    IEEE 1003.1 llroundf function.  IEEE specifies "roundf to the nearest 
-   integer value, roundfing halfway cases away from zero, regardless of
-   the current roundfing mode."  However PowerPC Architecture defines
+   integer value, rounding halfway cases away from zero, regardless of
+   the current rounding mode."  However PowerPC Architecture defines
    "roundf to Nearest" as "Choose the best approximation. In case of a 
    tie, choose the one that is even (least significant bit o).". 
    So we can't use the PowerPC "round to Nearest" mode. Instead we set
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S
new file mode 100644
index 0000000000..0d0eb36f98
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S
@@ -0,0 +1,114 @@
+/* nearbyint long double.
+   IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+	.section	".text"
+
+/* long double [fp1,fp2] nearbyintl (long double x [fp1,fp2])
+   IEEE 1003.1 nearbyintl function.  nearbyintl is simular to the rintl
+   but does raise the "inexact" exception.  This implementation is
+   based on rintl but explicitly maskes the inexact exception on entry
+   and clears any pending inexact before restoring the exception mask
+   on exit.
+
+   PowerPC64 long double uses the IBM extended format which is
+   represented two 64-floating point double values. The values are
+   non-overlapping giving an effective precision of 106 bits. The first
+   double contains the high order bits of mantisa and is always rounded
+   to represent a normal rounding of long double to double. Since the
+   long double value is sum of the high and low values, the low double
+   normally has the opposite sign to compensate for the this rounding.
+
+   For long double there are two cases:
+   1) |x| < 2**52, all the integer bits are in the high double.
+      floor the high double and set the low double to -0.0.
+   2) |x| >= 2**52, Rounding involves both doubles.
+      See the comment before lable .L2 for details.
+   */
+ENTRY (__nearbyintl)
+	mffs	fp11		/* Save current FPSCR.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	mtfsb0  28		/* Disable "inexact" exceptions.  */
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fabs	fp9,fp2
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnl-	cr7,.L2
+	fmr	fp2,fp12
+	bng-	cr6,.L4
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	b	.L9
+.L4:
+	bnl-	cr6,.L9		/* if (x < 0.0)  */
+	fsub	fp1,fp13,fp1	/* x = TWO52 - x;  */
+	fsub	fp0,fp1,fp13	/* x = - (x - TWO52);  */
+	fneg	fp1,fp0
+.L9:
+	mtfsb0	6		/* Clear any pending "inexact" exceptions.  */
+	mtfsf	0x01,fp11	/* restore exception mask.  */
+	blr
+
+/* The high double is > TWO52 so we need to round the low double and
+   perhaps the high double.  This gets a bit tricky so we use the
+   following algorithm:
+
+   tau = floor(x_high/TWO52);
+   x0 = x_high - tau;
+   x1 = x_low + tau;
+   r1 = nearbyint(x1);
+   y_high = x0 + r1;
+   y_low = r1 - tau;
+   return y;  */
+.L2:
+	fcmpu	cr7,fp9,fp13	/* if (|x_low| > TWO52)  */
+	fcmpu	cr0,fp9,fp12	/* || (|x_low| == 0.0)  */
+	bge-	cr7,.L9		/*   return x;	*/
+	beq-  cr0,.L9
+	fdiv	fp8,fp1,fp13	/* x_high/TWO52  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+
+	fcmpu	cr6,fp4,fp12	/* if (x1 > 0.0)  */
+	bng-	cr6,.L8
+	fadd	fp5,fp4,fp13	/* r1 = x1 + TWO52;  */
+	fsub	fp5,fp5,fp13	/* r1 = r1 - TWO52;  */
+	b	.L6
+.L8:
+	fmr	fp5,fp4
+	bge-	cr6,.L6		/* if (x1 < 0.0)  */
+	fsub	fp5,fp13,fp4	/* r1 = TWO52 - x1;  */
+	fsub	fp0,fp5,fp13	/* r1 = - (r1 - TWO52);  */
+	fneg	fp5,fp0
+.L6:
+	fadd	fp1,fp3,fp5	/* y_high = x0 + r1;  */
+	fsub	fp2,fp5,fp8	/* y_low = r1 - tau;  */
+	b	.L9
+END (__nearbyintl)
+
+long_double_symbol (libm, __nearbyintl, nearbyintl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rint.S b/sysdeps/powerpc/powerpc64/fpu/s_rint.S
index 79e807269d..b4fbc0b51b 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_rint.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_rint.S
@@ -1,5 +1,5 @@
 /* Round to int floating-point values.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -21,13 +21,14 @@
    when it's coded in C.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 	.section	".toc","aw"
 .LC0:	/* 2**52 */
 	.tc FD_43300000_0[TC],0x4330000000000000
 	.section	".text"
 
-ENTRY (__rint)
+EALIGN (__rint, 4, 0)
 	CALL_MCOUNT 0
 	lfd	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
@@ -38,13 +39,14 @@ ENTRY (__rint)
 	bng-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-	blr
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = 0.0; */
 .L4:
 	bnllr-	cr6		/* if (x < 0.0)  */
-	fsub	fp1,fp13,fp1	/* x = TWO52 - x;  */
-	fsub	fp0,fp1,fp13	/* x = - (x - TWO52);  */
-	fneg	fp1,fp0
-	blr
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = -0.0; */
 	END (__rint)
 
 weak_alias (__rint, rint)
@@ -53,3 +55,6 @@ weak_alias (__rint, rint)
 weak_alias (__rint, rintl)
 strong_alias (__rint, __rintl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __rint, rintl, GLIBC_2_0)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
index eb34dd5e77..e4fa9ba2e6 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
@@ -21,12 +21,12 @@
 
 	.section	".toc","aw"
 .LC0:	/* 2**23 */
-	.tc FD_41600000_0[TC],0x4160000000000000
+	.tc FD_4b000000_0[TC],0x4b00000000000000
 	.section	".text"
 
-ENTRY (__rintf)
+EALIGN (__rintf, 4, 0)
 	CALL_MCOUNT 0
-	lfd	fp13,.LC0@toc(2)
+	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
 	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
@@ -35,13 +35,14 @@ ENTRY (__rintf)
 	bng-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-	blr
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = 0.0; */
 .L4:
 	bnllr-	cr6		/* if (x < 0.0)  */
-	fsubs	fp1,fp13,fp1	/* x = TWO23 - x;  */
-	fsubs	fp0,fp1,fp13	/* x = - (x - TWO23);  */
-	fneg	fp1,fp0
-	blr
+	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
+	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+	blr			/* x = -0.0; */
 	END (__rintf)
 
 weak_alias (__rintf, rintf)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_round.S b/sysdeps/powerpc/powerpc64/fpu/s_round.S
index c0b6d46fea..15afca1543 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_round.S
@@ -1,5 +1,5 @@
 /* round function.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -18,14 +18,13 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 	.section	".toc","aw"
 .LC0:	/* 2**52 */
 	.tc FD_43300000_0[TC],0x4330000000000000
 .LC1:	/* 0.5 */
 	.tc FD_3fe00000_0[TC],0x3fe0000000000000
-.LC2:	/* -0.0 */
-	.tc FD_80000000_0[TC],0x8000000000000000
 	.section	".text"
 	
 /* double [fp1] round (double x [fp1])
@@ -38,7 +37,7 @@
    "Round toward Zero" mode and round by adding +-0.5 before rounding
    to the integer value.  */
 
-ENTRY (__round)
+EALIGN (__round, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
 	lfd	fp13,.LC0@toc(2)
@@ -53,7 +52,8 @@ ENTRY (__round)
 	fadd	fp1,fp1,fp10	/* x+= 0.5;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
@@ -61,10 +61,10 @@ ENTRY (__round)
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp9,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
-	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
 	blr
 	END (__round)
 
@@ -74,3 +74,6 @@ weak_alias (__round, round)
 weak_alias (__round, roundl)
 strong_alias (__round, __roundl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __round, roundl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
index 23ee4c052b..d2e29fdb8f 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
@@ -21,11 +21,9 @@
 
 	.section	".toc","aw"
 .LC0:	/* 2**23 */
-	.tc FD_41600000_0[TC],0x4160000000000000
+	.tc FD_4b000000_0[TC],0x4b00000000000000
 .LC1:	/* 0.5 */
-	.tc FD_3fe00000_0[TC],0x3fe0000000000000
-.LC2:	/* -0.0 */
-	.tc FD_80000000_0[TC],0x8000000000000000
+	.tc FD_3f000000_0[TC],0x3f00000000000000
 	.section	".text"
 	
 /* float [fp1] roundf  (float x [fp1])
@@ -38,22 +36,23 @@
    "Round toward Zero" mode and round by adding +-0.5 before rounding
    to the integer value.  */
 
-ENTRY (__roundf )
+EALIGN (__roundf, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
-	lfd	fp13,.LC0@toc(2)
+	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
 	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
 	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
 	bnllr-	cr7
 	mtfsfi	7,1		/* Set rounding mode toward 0.  */
-	lfd	fp10,.LC1@toc(2)
+	lfs	fp10,.LC1@toc(2)
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp10	/* x+= 0.5;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-.L9:	
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
@@ -61,10 +60,10 @@ ENTRY (__roundf )
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp9,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
-	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */	
 	blr
 	END (__roundf)
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_roundl.S b/sysdeps/powerpc/powerpc64/fpu/s_roundl.S
new file mode 100644
index 0000000000..20da828a82
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_roundl.S
@@ -0,0 +1,133 @@
+/* long double round function.
+   IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+.LC1:	/* 0.5 */
+	.tc FD_3fe00000_0[TC],0x3fe0000000000000
+	.section	".text"
+
+/* long double [fp1,fp2] roundl (long double x [fp1,fp2])
+   IEEE 1003.1 round function.  IEEE specifies "round to the nearest
+   integer value, rounding halfway cases away from zero, regardless of
+   the current rounding mode."  However PowerPC Architecture defines
+   "Round to Nearest" as "Choose the best approximation. In case of a
+   tie, choose the one that is even (least significant bit o).".
+   So we can't use the PowerPC "Round to Nearest" mode. Instead we set
+   "Round toward Zero" mode and round by adding +-0.5 before rounding
+   to the integer value.  */
+
+ENTRY (__roundl)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fabs	fp9,fp2
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnl-	cr7,.L2
+	mtfsfi	7,1		/* Set rounding mode toward 0.  */
+	lfd	fp10,.LC1@toc(2)
+	ble-	cr6,.L1
+	fneg	fp2,fp12
+	fadd	fp1,fp1,fp10	/* x+= 0.5;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fabs	fp1,fp1		/* if (x == 0.0) x = 0.0;  */
+.L0:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+.L1:
+	fsub	fp9,fp1,fp10	/* x-= 0.5;  */
+	fneg	fp2,fp12
+	bge-	cr6,.L0		/* if (x < 0.0)  */
+	fsub	fp1,fp9,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fnabs	fp1,fp1		/* if (x == 0.0) x = -0.0;  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+
+/* The high double is > TWO52 so we need to round the low double and
+   perhaps the high double.  In this case we have to round the low
+   double and handle any adjustment to the high double that may be
+   caused by rounding (up).  This is complicated by the fact that the
+   high double may already be rounded and the low double may have the
+   opposite sign to compensate.This gets a bit tricky so we use the
+   following algorithm:
+
+   tau = floor(x_high/TWO52);
+   x0 = x_high - tau;
+   x1 = x_low + tau;
+   r1 = rint(x1);
+   y_high = x0 + r1;
+   y_low = x0 - y_high + r1;
+   return y;  */
+.L2:
+	fcmpu	cr7,fp9,fp13	/* if (|x_low| > TWO52)  */
+	fcmpu	cr0,fp9,fp12	/* || (|x_low| == 0.0)  */
+	fcmpu	cr5,fp2,fp12	/* if (x_low > 0.0)  */
+	lfd	fp10,.LC1@toc(2)
+	bgelr-	cr7		/*   return x;	*/
+	beqlr-  cr0
+	mtfsfi	7,1		/* Set rounding mode toward 0.  */
+	fdiv	fp8,fp1,fp13	/* x_high/TWO52  */
+	
+	bng-	cr6,.L6		/* if (x > 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */
+	bng	cr5,.L4		/* if (x_low > 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L5
+.L4:				/* if (x_low < 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L5:
+	fadd	fp5,fp4,fp10	/* r1 = x1 + 0.5;  */
+	fadd	fp5,fp5,fp13	/* r1 = r1 + TWO52;  */
+	fsub	fp5,fp5,fp13	/* r1 = r1 - TWO52;  */
+	b	.L9
+.L6:				/* if (x < 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */	
+	bnl	cr5,.L7		/* if (x_low < 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L8
+.L7:				/* if (x_low > 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L8:
+	fsub	fp5,fp4,fp10	/* r1 = x1 - 0.5;  */
+	fsub	fp5,fp5,fp13	/* r1-= TWO52;  */
+	fadd	fp5,fp5,fp13	/* r1+= TWO52;  */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	fadd	fp1,fp3,fp5	/* y_high = x0 + r1;  */
+	fsub	fp2,fp3,fp1	/* y_low = x0 - y_high + r1;  */
+	fadd	fp2,fp2,fp5
+	blr
+END (__roundl)
+
+long_double_symbol (libm, __roundl, roundl)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
index 3ddd298525..086ed0025e 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
@@ -1,5 +1,5 @@
 /* trunc function.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -18,12 +18,11 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <math_ldbl_opt.h>
 
 	.section	".toc","aw"
 .LC0:	/* 2**52 */
 	.tc FD_43300000_0[TC],0x4330000000000000
-.LC2:	/* -0.0 */
-	.tc FD_80000000_0[TC],0x8000000000000000
 	.section	".text"
 	
 /* double [fp1] trunc (double x [fp1])
@@ -33,7 +32,7 @@
    We set "round toward Zero" mode and trunc by adding +-2**52 then
    subtracting +-2**52.  */
 
-ENTRY (__trunc)
+EALIGN (__trunc, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
 	lfd	fp13,.LC0@toc(2)
@@ -46,17 +45,18 @@ ENTRY (__trunc)
 	ble-	cr6,.L4
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
-.L9:	
-	mtfsf	0x01,fp11	/* restore previous truncing mode.  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
 	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
 	blr
 	END (__trunc)
 
@@ -66,3 +66,6 @@ weak_alias (__trunc, trunc)
 weak_alias (__trunc, truncl)
 strong_alias (__trunc, __truncl)
 #endif
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
+compat_symbol (libm, __trunc, truncl, GLIBC_2_1)
+#endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
index b38b722a6f..1456e7f434 100644
--- a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
@@ -1,5 +1,5 @@
 /* truncf function.  PowerPC64 version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -21,9 +21,7 @@
 
 	.section	".toc","aw"
 .LC0:	/* 2**23 */
-	.tc FD_41600000_0[TC],0x4160000000000000
-.LC2:	/* -0.0 */
-	.tc FD_80000000_0[TC],0x8000000000000000
+	.tc FD_4b000000_0[TC],0x4b00000000000000
 	.section	".text"
 	
 /* float [fp1] truncf (float x [fp1])
@@ -33,10 +31,10 @@
    We set "round toward Zero" mode and trunc by adding +-2**23 then
    subtracting +-2**23.  */
 
-ENTRY (__truncf)
+EALIGN (__truncf, 4, 0)
 	CALL_MCOUNT 0
 	mffs	fp11		/* Save current FPU rounding mode.  */
-	lfd	fp13,.LC0@toc(2)
+	lfs	fp13,.LC0@toc(2)
 	fabs	fp0,fp1
 	fsubs	fp12,fp13,fp13	/* generate 0.0  */
 	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO23)  */
@@ -46,17 +44,18 @@ ENTRY (__truncf)
 	ble-	cr6,.L4
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
-.L9:	
-	mtfsf	0x01,fp11	/* restore previous truncing mode.  */
+	fabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = 0.0; */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
 	blr
 .L4:
 	bge-	cr6,.L9		/* if (x < 0.0)  */
 	fsubs	fp1,fp1,fp13	/* x-= TWO23;  */
 	fadds	fp1,fp1,fp13	/* x+= TWO23;  */
-	fcmpu	cr5,fp1,fp12	/* if (x > 0.0)  */
+	fnabs	fp1,fp1		/* if (x == 0.0)  */
+				/* x = -0.0; */
+.L9:
 	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
-	bnelr+	cr5
-	lfd	fp1,.LC2@toc(2)	/* x must be -0.0 for the 0.0 case.  */	
 	blr
 	END (__truncf)
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncl.S b/sysdeps/powerpc/powerpc64/fpu/s_truncl.S
new file mode 100644
index 0000000000..1864fc14b7
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_truncl.S
@@ -0,0 +1,121 @@
+/* long double trunc function.
+   IBM extended format long double version.
+   Copyright (C) 2004, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <math_ldbl_opt.h>
+
+	.section	".toc","aw"
+.LC0:	/* 2**52 */
+	.tc FD_43300000_0[TC],0x4330000000000000
+.LC1:	/* 0.5 */
+	.tc FD_3fe00000_0[TC],0x3fe0000000000000
+	.section	".text"
+
+/* long double [fp1,fp2] truncl (long double x [fp1,fp2])  */
+
+ENTRY (__truncl)
+	mffs	fp11		/* Save current FPU rounding mode.  */
+	lfd	fp13,.LC0@toc(2)
+	fabs	fp0,fp1
+	fabs	fp9,fp2
+	fsub	fp12,fp13,fp13	/* generate 0.0  */
+	fcmpu	cr7,fp0,fp13	/* if (fabs(x) > TWO52)  */
+	fcmpu	cr6,fp1,fp12	/* if (x > 0.0)  */
+	bnl-	cr7,.L2
+	mtfsfi	7,1		/* Set rounding mode toward 0.  */
+	ble-	cr6,.L1
+	fneg	fp2,fp12
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fabs	fp1,fp1		/* if (x == 0.0) x = 0.0;  */
+.L0:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+.L1:
+	fneg	fp2,fp12
+	bge-	cr6,.L0		/* if (x < 0.0)  */
+	fsub	fp1,fp1,fp13	/* x-= TWO52;  */
+	fadd	fp1,fp1,fp13	/* x+= TWO52;  */
+	fnabs	fp1,fp1		/* if (x == 0.0) x = -0.0;  */
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	blr
+
+/* The high double is > TWO52 so we need to round the low double and
+   perhaps the high double.  In this case we have to round the low
+   double and handle any adjustment to the high double that may be
+   caused by rounding (up).  This is complicated by the fact that the
+   high double may already be rounded and the low double may have the
+   opposite sign to compensate.This gets a bit tricky so we use the
+   following algorithm:
+
+   tau = floor(x_high/TWO52);
+   x0 = x_high - tau;
+   x1 = x_low + tau;
+   r1 = rint(x1);
+   y_high = x0 + r1;
+   y_low = x0 - y_high + r1;
+   return y;  */
+.L2:
+	fcmpu	cr7,fp9,fp13	/* if (|x_low| > TWO52)  */
+	fcmpu	cr0,fp9,fp12	/* || (|x_low| == 0.0)  */
+	fcmpu	cr5,fp2,fp12	/* if (x_low > 0.0)  */
+	bgelr-	cr7		/*   return x;	*/
+	beqlr-  cr0
+	mtfsfi	7,1		/* Set rounding mode toward 0.  */
+	fdiv	fp8,fp1,fp13	/* x_high/TWO52  */
+	
+	bng-	cr6,.L6		/* if (x > 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */
+	fadd	fp8,fp8,fp8	/* tau++; Make tau even  */
+	bng	cr5,.L4		/* if (x_low > 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L5
+.L4:				/* if (x_low < 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L5:
+	fadd	fp5,fp4,fp13	/* r1 = r1 + TWO52;  */
+	fsub	fp5,fp5,fp13	/* r1 = r1 - TWO52;  */
+	b	.L9
+.L6:				/* if (x < 0.0)  */
+	fctidz	fp0,fp8
+	fcfid	fp8,fp0		/* tau = floor(x_high/TWO52);  */
+	fadd	fp8,fp8,fp8	/* tau++; Make tau even  */	
+	bnl	cr5,.L7		/* if (x_low < 0.0)  */
+	fmr	fp3,fp1
+	fmr	fp4,fp2
+	b	.L8
+.L7:				/* if (x_low > 0.0)  */
+	fsub	fp3,fp1,fp8	/* x0 = x_high - tau;  */
+	fadd	fp4,fp2,fp8	/* x1 = x_low + tau;  */
+.L8:
+	fsub	fp5,fp4,fp13	/* r1-= TWO52;  */
+	fadd	fp5,fp5,fp13	/* r1+= TWO52;  */
+.L9:
+	mtfsf	0x01,fp11	/* restore previous rounding mode.  */
+	fadd	fp1,fp3,fp5	/* y_high = x0 + r1;  */
+	fsub	fp2,fp3,fp1	/* y_low = x0 - y_high + r1;  */
+	fadd	fp2,fp2,fp5
+	blr
+END (__truncl)
+
+long_double_symbol (libm, __truncl, truncl)
diff --git a/sysdeps/powerpc/powerpc64/hp-timing.c b/sysdeps/powerpc/powerpc64/hp-timing.c
new file mode 100644
index 0000000000..4e54e66e5e
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/hp-timing.c
@@ -0,0 +1,25 @@
+/* Support for high precision, low overhead timing functions. 
+   powerpc64 version.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <hp-timing.h>
+
+/* We have to define the variable for the overhead.  */
+hp_timing_t _dl_hp_timing_overhead;
diff --git a/sysdeps/powerpc/powerpc64/hp-timing.h b/sysdeps/powerpc/powerpc64/hp-timing.h
new file mode 100644
index 0000000000..b58cca9003
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/hp-timing.h
@@ -0,0 +1,136 @@
+/* High precision, low overhead timing functions.  powerpc64 version.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _HP_TIMING_H
+#define _HP_TIMING_H	1
+
+#include <string.h>
+#include <sys/param.h>
+#include <stdio-common/_itoa.h>
+#include <atomic.h>
+
+/* The macros defined here use the powerpc 64-bit time base register.
+   The time base is nominally clocked at 1/8th the CPU clock, but this
+   can vary.
+
+   The list of macros we need includes the following:
+
+   - HP_TIMING_AVAIL: test for availability.
+
+   - HP_TIMING_INLINE: this macro is non-zero if the functionality is not
+     implemented using function calls but instead uses some inlined code
+     which might simply consist of a few assembler instructions.  We have to
+     know this since we might want to use the macros here in places where we
+     cannot make function calls.
+
+   - hp_timing_t: This is the type for variables used to store the time
+     values.
+
+   - HP_TIMING_ZERO: clear `hp_timing_t' object.
+
+   - HP_TIMING_NOW: place timestamp for current time in variable given as
+     parameter.
+
+   - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the
+     HP_TIMING_DIFF macro.
+
+   - HP_TIMING_DIFF: compute difference between two times and store it
+     in a third.  Source and destination might overlap.
+
+   - HP_TIMING_ACCUM: add time difference to another variable.  This might
+     be a bit more complicated to implement for some platforms as the
+     operation should be thread-safe and 64bit arithmetic on 32bit platforms
+     is not.
+
+   - HP_TIMING_ACCUM_NT: this is the variant for situations where we know
+     there are no threads involved.
+
+   - HP_TIMING_PRINT: write decimal representation of the timing value into
+     the given string.  This operation need not be inline even though
+     HP_TIMING_INLINE is specified.
+
+*/
+
+/* We always assume having the timestamp register.  */
+#define HP_TIMING_AVAIL		(1)
+
+/* We indeed have inlined functions.  */
+#define HP_TIMING_INLINE	(1)
+
+/* We use 64bit values for the times.  */
+typedef unsigned long long int hp_timing_t;
+
+/* Set timestamp value to zero.  */
+#define HP_TIMING_ZERO(Var)	(Var) = (0)
+
+/* That's quite simple.  Use the `mftb' instruction.  Note that the value
+   might not be 100% accurate since there might be some more instructions
+   running in this moment.  This could be changed by using a barrier like
+   'lwsync' right before the `mftb' instruciton.  But we are not interested
+   in accurate clock cycles here so we don't do this.  */
+#define HP_TIMING_NOW(Var)	__asm__ __volatile__ ("mftb %0" : "=r" (Var))
+
+/* Use two 'mftb' instructions in a row to find out how long it takes.
+   On current POWER4, POWER5, and 970 processors mftb take ~10 cycles.  */
+#define HP_TIMING_DIFF_INIT() \
+  do {									      \
+    if (GLRO(dl_hp_timing_overhead) == 0)				      \
+      {									      \
+	int __cnt = 5;							      \
+	GLRO(dl_hp_timing_overhead) = ~0ull;				      \
+	do								      \
+	  {								      \
+	    hp_timing_t __t1, __t2;					      \
+	    HP_TIMING_NOW (__t1);					      \
+	    HP_TIMING_NOW (__t2);					      \
+	    if (__t2 - __t1 < GLRO(dl_hp_timing_overhead))		      \
+	      GLRO(dl_hp_timing_overhead) = __t2 - __t1;		      \
+	  }								      \
+	while (--__cnt > 0);						      \
+      }									      \
+  } while (0)
+
+/* It's simple arithmetic in 64-bit.  */
+#define HP_TIMING_DIFF(Diff, Start, End)	(Diff) = ((End) - (Start))
+
+/* We need to insure that this add is atomic in threaded environments.  We use
+   __arch_atomic_exchange_and_add_64 from atomic.h to get thread safety.  */
+#define HP_TIMING_ACCUM(Sum, Diff) \
+  do {									      \
+    hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead);		      \
+    __arch_atomic_exchange_and_add_64 (&(Sum), __diff);	                      \
+  } while (0)
+
+/* No threads, no extra work.  */
+#define HP_TIMING_ACCUM_NT(Sum, Diff)	(Sum) += (Diff)
+
+/* Print the time value.  */
+#define HP_TIMING_PRINT(Buf, Len, Val) \
+  do {									      \
+    char __buf[20];							      \
+    char *__cp = _itoa (Val, __buf + sizeof (__buf), 10, 0);		      \
+    size_t __len = (Len);						      \
+    char *__dest = (Buf);						      \
+    while (__len-- > 0 && __cp < __buf + sizeof (__buf))		      \
+      *__dest++ = *__cp++;						      \
+    memcpy (__dest, " ticks", MIN (__len, sizeof (" ticks")));  \
+  } while (0)
+
+#endif	/* hp-timing.h */
diff --git a/sysdeps/powerpc/powerpc64/memcpy.S b/sysdeps/powerpc/powerpc64/memcpy.S
index 9df5bb42b6..f395de9066 100644
--- a/sysdeps/powerpc/powerpc64/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/memcpy.S
@@ -1,5 +1,5 @@
 /* Optimized memcpy implementation for PowerPC64.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 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
@@ -43,6 +43,7 @@ EALIGN (BP_SYM (memcpy), 5, 0)
     neg   0,3
     std   3,-16(1)
     std   31,-8(1)
+    cfi_offset(31,-8)
     andi. 11,3,7	/* check alignement of dst.  */
     clrldi 0,0,61	/* Number of bytes until the 1st doubleword of dst.  */
     clrldi 10,4,61	/* check alignement of src.  */
diff --git a/sysdeps/powerpc/powerpc64/memset.S b/sysdeps/powerpc/powerpc64/memset.S
index 1abc59bb17..09c79fccd7 100644
--- a/sysdeps/powerpc/powerpc64/memset.S
+++ b/sysdeps/powerpc/powerpc64/memset.S
@@ -62,8 +62,7 @@ EALIGN (BP_SYM (memset), 5, 0)
 #define rNEG64	r8	/* Constant -64 for clearing with dcbz.  */
 #define rCLS	r8	/* Cache line size obtained from static.  */
 #define rCLM	r9	/* Cache line size mask to check for cache alignment.  */
-
-___memset:
+L(_memset):
 #if __BOUNDED_POINTERS__
 	cmpldi	cr1, rRTN, 0
 	CHECK_BOUNDS_BOTH_WIDE (rMEMP0, rTMP, rTMP2, rLEN)
@@ -282,11 +281,11 @@ ENTRY (BP_SYM (__bzero))
 	mr	r4,r3
 	/* Tell memset that we don't want a return value.  */
 	li	r3,0
-	b	___memset
+	b	L(_memset)
 #else
 	mr	r5,r4
 	li	r4,0
-	b	___memset
+	b	L(_memset)
 #endif
 END_GEN_TB (BP_SYM (__bzero),TB_TOCLESS)
 
diff --git a/sysdeps/powerpc/powerpc64/ppc-mcount.S b/sysdeps/powerpc/powerpc64/ppc-mcount.S
index 46cb9fdc8a..5df9650577 100644
--- a/sysdeps/powerpc/powerpc64/ppc-mcount.S
+++ b/sysdeps/powerpc/powerpc64/ppc-mcount.S
@@ -1,5 +1,5 @@
 /* PowerPC64-specific implementation of profiling support.
-   Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2002, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 /* We don't need to save the parameter-passing registers as gcc takes
@@ -26,7 +26,9 @@ ENTRY(_mcount)
 	mflr		 r4
 	ld		 r11, 0(r1)
 	stdu		 r1,-112(r1)
+	cfi_adjust_cfa_offset (112)
 	std		 r4, 128(r1)
+	cfi_offset (lr, 16)
 	ld		 r3, 16(r11)
 	bl		 JUMPTARGET(__mcount_internal)
 	nop
diff --git a/sysdeps/powerpc/powerpc64/register-dump.h b/sysdeps/powerpc/powerpc64/register-dump.h
index dd69af3faf..fc27dcaef3 100644
--- a/sysdeps/powerpc/powerpc64/register-dump.h
+++ b/sysdeps/powerpc/powerpc64/register-dump.h
@@ -1,5 +1,5 @@
 /* Dump registers.
-   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2002, 2006 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
@@ -34,7 +34,7 @@ gr16-19: 000000000000010% 000000000000011% 000000000000012% 000000000000013%\n\
 gr20-23: 000000000000014% 000000000000015% 000000000000016% 000000000000017%\n\
 gr24-27: 000000000000018% 000000000000019% 00000000000001a% 00000000000001b%\n\
 gr28-31: 00000000000001c% 00000000000001d% 00000000000001e% 00000000000001f%\n\
-fscr=0000071%\n\
+fscr=000000000000050%\n\
 fp0-3:   000000000000030% 000000000000031% 000000000000032% 000000000000033%\n\
 fp4-7:   000000000000034% 000000000000035% 000000000000036% 000000000000037%\n\
 fp8-11:  000000000000038% 000000000000038% 00000000000003a% 00000000000003b%\n\
@@ -104,7 +104,7 @@ register_dump (int fd, struct sigcontext *ctx)
   char buffer[sizeof(dumpform)];
   char *bufferpos;
   unsigned regno;
-  unsigned *regs = (unsigned *)(ctx->regs);
+  unsigned long *regs = (unsigned long *)(ctx->regs);
 
   memcpy(buffer, dumpform, sizeof(dumpform));
 
@@ -117,7 +117,7 @@ register_dump (int fd, struct sigcontext *ctx)
     }
 
   /* Write the output.  */
-  write (fd, buffer, sizeof(buffer));
+  write (fd, buffer, sizeof(buffer) - 1);
 }
 
 
diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S
index 0de07a82d3..606eef5935 100644
--- a/sysdeps/powerpc/powerpc64/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc64/setjmp-common.S
@@ -1,5 +1,5 @@
 /* setjmp for PowerPC64.
-   Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2003, 2004, 2005, 2006 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
@@ -19,11 +19,10 @@
 
 #include <sysdep.h>
 #define _ASM
-#define _SETJMP_H
 #ifdef __NO_VMX__
 #include <novmxsetjmp.h>
 #else
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #endif
 #include <bp-sym.h>
 #include <bp-asm.h>
@@ -46,7 +45,13 @@ ENTRY (BP_SYM (__sigsetjmp))
 	.hidden JUMPTARGET(GLUE(__sigsetjmp,_ent))
 JUMPTARGET(GLUE(__sigsetjmp,_ent)):
 	CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+#ifdef PTR_MANGLE
+	mr   r5, r1
+	PTR_MANGLE (r5, r6)
+	std  r5,(JB_GPR1*8)(3)
+#else
 	std  r1,(JB_GPR1*8)(3)
+#endif
 	mflr r0
 #if defined SHARED && !defined IS_IN_rtld
 	ld   r5,40(r1)	/* Retrieve the callers TOC.  */
@@ -56,6 +61,9 @@ JUMPTARGET(GLUE(__sigsetjmp,_ent)):
 #endif
 	std  r14,((JB_GPRS+0)*8)(3)
 	stfd fp14,((JB_FPRS+0)*8)(3)
+#ifdef PTR_MANGLE
+	PTR_MANGLE2 (r0, r6)
+#endif
 	std  r0,(JB_LR*8)(3)
 	std  r15,((JB_GPRS+1)*8)(3)
 	stfd fp15,((JB_FPRS+1)*8)(3)
@@ -94,14 +102,14 @@ JUMPTARGET(GLUE(__sigsetjmp,_ent)):
 	std  r31,((JB_GPRS+17)*8)(3)
 	stfd fp31,((JB_FPRS+17)*8)(3)
 #ifndef __NO_VMX__
-	ld    r5,.LC__dl_hwcap@toc(r2)
+	ld    r6,.LC__dl_hwcap@toc(r2)
 # ifdef SHARED
 	/* Load _rtld-global._dl_hwcap.  */
-	ld    r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5)
+	ld    r6,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r6)
 # else
-	ld    r5,0(r5) /* Load extern _dl_hwcap.  */
+	ld    r6,0(r6) /* Load extern _dl_hwcap.  */
 # endif
-	andis.  r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+	andis.  r6,r6,(PPC_FEATURE_HAS_ALTIVEC >> 16)
 	beq	L(no_vmx)
 	la	r5,((JB_VRS)*8)(3)
 	andi.	r6,r5,0xf
@@ -176,6 +184,13 @@ L(aligned_save_vmx):
 	stvx	30,0,r5
 	stvx	31,0,r6
 L(no_vmx):
+#else
+	li	r6,0
 #endif
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	li	r3,0
+	blr
+#else
 	b JUMPTARGET (BP_SYM (__sigjmp_save))
+#endif
 END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/powerpc/powerpc64/strncmp.S b/sysdeps/powerpc/powerpc64/strncmp.S
index 04bdc2f606..34479e2e91 100644
--- a/sysdeps/powerpc/powerpc64/strncmp.S
+++ b/sysdeps/powerpc/powerpc64/strncmp.S
@@ -48,6 +48,7 @@ EALIGN (BP_SYM(strncmp), 4, 0)
 	lis	r7F7F, 0x7f7f
 	dcbt	0,rSTR2
 	clrldi.	rTMP, rTMP, 61
+	cmpldi	cr1, rN, 0
 	lis	rFEFE, -0x101
 	bne	L(unaligned)
 /* We are doubleword alligned so set up for two loops.  first a double word
@@ -55,7 +56,8 @@ EALIGN (BP_SYM(strncmp), 4, 0)
 	srdi.	rTMP, rN, 3
 	clrldi	rN, rN, 61
 	addi	rFEFE, rFEFE, -0x101
-	addi	r7F7F, r7F7F, 0x7f7f	
+	addi	r7F7F, r7F7F, 0x7f7f
+	cmpldi	cr1, rN, 0	
 	beq	L(unaligned)
 
 	mtctr	rTMP	/* Power4 wants mtctr 1st in dispatch group.  */
@@ -126,16 +128,19 @@ L(tail):
 	addi	rSTR1, rSTR1, 8
 	bne-	cr1, L(different)
 	addi	rSTR2, rSTR2, 8
+	cmpldi	cr1, rN, 0
 L(unaligned):
 	mtctr   rN	/* Power4 wants mtctr 1st in dispatch group */
-	cmpdi	rN,0
-	lbz	rWORD1, 0(rSTR1)
-	lbz	rWORD2, 0(rSTR2)
-	bgt	L(u1)
+	bgt	cr1, L(uz)
 L(ux):
 	li	rRTN, 0
 	blr
-
+	.align 4
+L(uz):
+	lbz	rWORD1, 0(rSTR1)
+	lbz	rWORD2, 0(rSTR2)
+	nop
+	b	L(u1)
 L(u0):
 	lbzu	rWORD2, 1(rSTR2)
 L(u1):
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
index fead0b578a..2745d7eb71 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -1,5 +1,5 @@
 /* Assembly macros for 64-bit PowerPC.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdeps/powerpc/sysdep.h>
 
@@ -92,7 +92,8 @@ name##: OPD_ENT (name);				\
 #define ENTRY(name)	\
 	ENTRY_2(name)				\
 	.align ALIGNARG(2);			\
-BODY_LABEL(name):
+BODY_LABEL(name):				\
+	cfi_startproc;
 
 #define EALIGN_W_0  /* No words to insert.  */
 #define EALIGN_W_1  nop
@@ -109,7 +110,8 @@ BODY_LABEL(name):
 	ENTRY_2(name)				\
 	.align ALIGNARG(alignt);		\
 	EALIGN_W_##words;			\
-BODY_LABEL(name):
+BODY_LABEL(name):				\
+	cfi_startproc;
 
 /* Local labels stripped out by the linker.  */
 #undef L
@@ -173,11 +175,13 @@ LT_LABELSUFFIX(name,_name_end): ; \
 /* END generates Traceback tables */
 #undef	END
 #define END(name) \
+  cfi_endproc;			\
   TRACEBACK(name)		\
   END_2(name)
 
 /* This form supports more informative traceback tables */
 #define END_GEN_TB(name,mask)	\
+  cfi_endproc;			\
   TRACEBACK_MASK(name,mask)	\
   END_2(name)
 
diff --git a/sysdeps/powerpc/soft-fp/Dist b/sysdeps/powerpc/soft-fp/Dist
deleted file mode 100644
index a917524129..0000000000
--- a/sysdeps/powerpc/soft-fp/Dist
+++ /dev/null
@@ -1,28 +0,0 @@
-q_add.c
-q_cmp.c
-q_cmpe.c
-q_div.c
-q_dtoq.c
-q_feq.c
-q_fge.c
-q_fgt.c
-q_fle.c
-q_flt.c
-q_fne.c
-q_itoq.c
-q_lltoq.c
-q_mul.c
-q_neg.c
-q_qtod.c
-q_qtoi.c
-q_qtoll.c
-q_qtos.c
-q_qtou.c
-q_qtoull.c
-q_sqrt.c
-q_stoq.c
-q_sub.c
-q_ulltoq.c
-q_util.c
-q_utoq.c
-sfp-machine.h
diff --git a/sysdeps/powerpc/soft-fp/q_add.c b/sysdeps/powerpc/soft-fp/q_add.c
index 4338803932..80a0b3f6d3 100644
--- a/sysdeps/powerpc/soft-fp/q_add.c
+++ b/sysdeps/powerpc/soft-fp/q_add.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return a + b
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,10 +30,10 @@ long double _q_add(const long double a, const long double b)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_ADD_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/powerpc/soft-fp/q_dtoq.c b/sysdeps/powerpc/soft-fp/q_dtoq.c
index 6c4c74037e..baebea546b 100644
--- a/sysdeps/powerpc/soft-fp/q_dtoq.c
+++ b/sysdeps/powerpc/soft-fp/q_dtoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)(a)
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ long double _q_dtoq(const double a)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_D(A, a);
+  FP_UNPACK_RAW_D(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,D,4,2,C,A);
+  FP_EXTEND(Q,D,4,2,C,A);
 #else
-  FP_CONV(Q,D,2,1,C,A);
+  FP_EXTEND(Q,D,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/powerpc/soft-fp/q_itoq.c b/sysdeps/powerpc/soft-fp/q_itoq.c
index 166138c24e..e2884005ae 100644
--- a/sysdeps/powerpc/soft-fp/q_itoq.c
+++ b/sysdeps/powerpc/soft-fp/q_itoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)(a)
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,8 +30,8 @@ long double _q_itoq(const int a)
   int b = a;
   long double c;
 
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/powerpc/soft-fp/q_lltoq.c b/sysdeps/powerpc/soft-fp/q_lltoq.c
index 6412eccd3e..22d2e55fac 100644
--- a/sysdeps/powerpc/soft-fp/q_lltoq.c
+++ b/sysdeps/powerpc/soft-fp/q_lltoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,8 +30,8 @@ long double _q_lltoq(const long long a)
   long double c;
   long long b = a;
 
-  FP_FROM_INT_Q(C, b, 64, long long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 64, unsigned long long);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/powerpc/soft-fp/q_qtod.c b/sysdeps/powerpc/soft-fp/q_qtod.c
index d107f38696..685aa68e6d 100644
--- a/sysdeps/powerpc/soft-fp/q_qtod.c
+++ b/sysdeps/powerpc/soft-fp/q_qtod.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (double)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ double _q_qtod(const long double a)
   double r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(D,Q,2,4,R,A);
+  FP_TRUNC(D,Q,2,4,R,A);
 #else
-  FP_CONV(D,Q,1,2,R,A);
+  FP_TRUNC(D,Q,1,2,R,A);
 #endif
-  FP_PACK_D(r, R);
+  FP_PACK_SEMIRAW_D(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/powerpc/soft-fp/q_qtoi.c b/sysdeps/powerpc/soft-fp/q_qtoi.c
index 90c01e6e7a..89410d1253 100644
--- a/sysdeps/powerpc/soft-fp/q_qtoi.c
+++ b/sysdeps/powerpc/soft-fp/q_qtoi.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (int)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -28,9 +28,9 @@ int _q_qtoi(const long double a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  int r;
+  unsigned int r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 32, 1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/powerpc/soft-fp/q_qtoll.c b/sysdeps/powerpc/soft-fp/q_qtoll.c
index 72bde2e62a..3b0251f1ba 100644
--- a/sysdeps/powerpc/soft-fp/q_qtoll.c
+++ b/sysdeps/powerpc/soft-fp/q_qtoll.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -28,9 +28,9 @@ long long _q_qtoll(const long double a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  long long r;
+  unsigned long long r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 64, 1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/powerpc/soft-fp/q_qtos.c b/sysdeps/powerpc/soft-fp/q_qtos.c
index ebd6baee95..0d71271d01 100644
--- a/sysdeps/powerpc/soft-fp/q_qtos.c
+++ b/sysdeps/powerpc/soft-fp/q_qtos.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (float)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ float _q_qtos(const long double a)
   float r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(S,Q,1,4,R,A);
+  FP_TRUNC(S,Q,1,4,R,A);
 #else
-  FP_CONV(S,Q,1,2,R,A);
+  FP_TRUNC(S,Q,1,2,R,A);
 #endif
-  FP_PACK_S(r, R);
+  FP_PACK_SEMIRAW_S(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/powerpc/soft-fp/q_qtou.c b/sysdeps/powerpc/soft-fp/q_qtou.c
index b9119d037c..e5d21f1f4d 100644
--- a/sysdeps/powerpc/soft-fp/q_qtou.c
+++ b/sysdeps/powerpc/soft-fp/q_qtou.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (unsigned int)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,7 +30,7 @@ unsigned int _q_qtou(const long double a)
   FP_DECL_Q(A);
   unsigned int r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 32, -1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/powerpc/soft-fp/q_qtoull.c b/sysdeps/powerpc/soft-fp/q_qtoull.c
index 9fcefd60be..a01100c797 100644
--- a/sysdeps/powerpc/soft-fp/q_qtoull.c
+++ b/sysdeps/powerpc/soft-fp/q_qtoull.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,7 +30,7 @@ unsigned long long _q_qtoull(const long double a)
   FP_DECL_Q(A);
   unsigned long long r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 64, -1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/powerpc/soft-fp/q_stoq.c b/sysdeps/powerpc/soft-fp/q_stoq.c
index 3fc4a5970d..f43a93ceab 100644
--- a/sysdeps/powerpc/soft-fp/q_stoq.c
+++ b/sysdeps/powerpc/soft-fp/q_stoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = (long double)(a)
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,13 +31,13 @@ long double _q_stoq(const float a)
   FP_DECL_Q(C);
   long double c;
 
-  FP_UNPACK_S(A, a);
+  FP_UNPACK_RAW_S(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,S,4,1,C,A);
+  FP_EXTEND(Q,S,4,1,C,A);
 #else
-  FP_CONV(Q,S,2,1,C,A);
+  FP_EXTEND(Q,S,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/powerpc/soft-fp/q_sub.c b/sysdeps/powerpc/soft-fp/q_sub.c
index 50c56b29c4..399be021d2 100644
--- a/sysdeps/powerpc/soft-fp/q_sub.c
+++ b/sysdeps/powerpc/soft-fp/q_sub.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = a - b
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,10 +30,10 @@ long double _q_sub(const long double a, const long double b)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_SUB_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/powerpc/soft-fp/q_ulltoq.c b/sysdeps/powerpc/soft-fp/q_ulltoq.c
index 428f201e15..30f5fc9bfa 100644
--- a/sysdeps/powerpc/soft-fp/q_ulltoq.c
+++ b/sysdeps/powerpc/soft-fp/q_ulltoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)a
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,8 +30,8 @@ long double _q_ulltoq(const unsigned long long a)
   long double c;
   unsigned long long b = a;
 
-  FP_FROM_INT_Q(C, b, 64, long long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 64, unsigned long long);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/powerpc/soft-fp/q_utoq.c b/sysdeps/powerpc/soft-fp/q_utoq.c
index 87607e3ab9..232bcfe3e9 100644
--- a/sysdeps/powerpc/soft-fp/q_utoq.c
+++ b/sysdeps/powerpc/soft-fp/q_utoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = (long double)(a)
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,8 +30,8 @@ long double _q_uitoq(const unsigned int a)
   long double c;
   unsigned int b = a;
 
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/powerpc/sysdep.h b/sysdeps/powerpc/sysdep.h
index fb668ad51f..2ae52b78c0 100644
--- a/sysdeps/powerpc/sysdep.h
+++ b/sysdeps/powerpc/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2002, 2006 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
@@ -29,6 +29,22 @@
 #define PPC_FEATURE_HAS_MMU		0x04000000 /* Memory Management Unit.  */
 #define PPC_FEATURE_HAS_4xxMAC		0x02000000 /* 4xx Multiply Accumulator.  */
 #define PPC_FEATURE_UNIFIED_CACHE	0x01000000 /* Unified I/D cache.  */
+#define PPC_FEATURE_HAS_SPE		0x00800000 /* Signal Processing ext.  */
+#define PPC_FEATURE_HAS_EFP_SINGLE	0x00400000 /* SPE Float.  */
+#define PPC_FEATURE_HAS_EFP_DOUBLE	0x00200000 /* SPE Double.  */
+#define PPC_FEATURE_NO_TB		0x00100000 /* 601/403gx have no timebase */
+#define PPC_FEATURE_POWER4		0x00080000 /* POWER4 ISA 2.00 */
+#define PPC_FEATURE_POWER5		0x00040000 /* POWER5 ISA 2.02 */
+#define PPC_FEATURE_POWER5_PLUS		0x00020000 /* POWER5+ ISA 2.03 */
+#define PPC_FEATURE_CELL_BE		0x00010000 /* CELL Broadband Engine */
+#define PPC_FEATURE_BOOKE		0x00008000
+#define PPC_FEATURE_SMT			0x00004000 /* Simultaneous Multi-Threading */
+#define PPC_FEATURE_ICACHE_SNOOP	0x00002000
+#define PPC_FEATURE_ARCH_2_05		0x00001000 /* ISA 2.05 */
+#define PPC_FEATURE_PA6T		0x00000800 /* PA Semi 6T Core */
+#define PPC_FEATURE_HAS_DFP		0x00000400 /* Decimal FP Unit */
+#define PPC_FEATURE_POWER6_EXT		0x00000200 /* P6 + mffgpr/mftgpr */
+#define PPC_FEATURE_970 (PPC_FEATURE_POWER4 + PPC_FEATURE_HAS_ALTIVEC)
 
 #ifdef __ASSEMBLER__
 
diff --git a/sysdeps/powerpc/tst-stack-align.h b/sysdeps/powerpc/tst-stack-align.h
new file mode 100644
index 0000000000..99a0ffcef7
--- /dev/null
+++ b/sysdeps/powerpc/tst-stack-align.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdio.h>
+#include <stdint.h>
+
+#define TEST_STACK_ALIGN() \
+  ({									     \
+    /* Altivec __vector int etc. needs 16byte aligned stack.		     \
+       Instead of using altivec.h here, use aligned attribute instead.  */   \
+    struct _S								     \
+      {									     \
+        int _i __attribute__((aligned (16)));				     \
+	int _j[3];							     \
+      } _s = { ._i = 18, ._j[0] = 19, ._j[1] = 20, ._j[2] = 21 };	     \
+    double _d = 12.0;							     \
+    long double _ld = 15.0;						     \
+    int _ret = 0;							     \
+    printf ("__vector int:  { %d, %d, %d, %d } %p %zu\n", _s._i, _s._j[0],   \
+            _s._j[1], _s._j[2], &_s, __alignof (_s));			     \
+    if ((((uintptr_t) &_s) & (__alignof (_s) - 1)) != 0)		     \
+      _ret = 1;								     \
+									     \
+    printf ("double:  %g %p %zu\n", _d, &_d, __alignof (double));	     \
+    if ((((uintptr_t) &_d) & (__alignof (double) - 1)) != 0)		     \
+      _ret = 1;								     \
+									     \
+    printf ("ldouble: %Lg %p %zu\n", _ld, &_ld, __alignof (long double));    \
+    if ((((uintptr_t) &_ld) & (__alignof (long double) - 1)) != 0)	     \
+      _ret = 1;								     \
+    _ret;								     \
+    })
diff --git a/sysdeps/pthread/Versions b/sysdeps/pthread/Versions
new file mode 100644
index 0000000000..a71cffbed4
--- /dev/null
+++ b/sysdeps/pthread/Versions
@@ -0,0 +1,5 @@
+librt {
+  GLIBC_2.4 {
+    lio_listio; lio_listio64;
+  }
+}
diff --git a/sysdeps/pthread/aio_cancel.c b/sysdeps/pthread/aio_cancel.c
index a37b2c7896..aa1ee443a5 100644
--- a/sysdeps/pthread/aio_cancel.c
+++ b/sysdeps/pthread/aio_cancel.c
@@ -1,5 +1,5 @@
 /* Cancel requests associated with given file descriptor.
-   Copyright (C) 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -34,7 +34,7 @@
 #include <assert.h>
 #include <errno.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 
 int
diff --git a/sysdeps/pthread/aio_fsync.c b/sysdeps/pthread/aio_fsync.c
index 4c90d69584..47cc29991f 100644
--- a/sysdeps/pthread/aio_fsync.c
+++ b/sysdeps/pthread/aio_fsync.c
@@ -1,5 +1,5 @@
 /* Synchronize I/O in given file descriptor.
-   Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -30,7 +30,7 @@
 #undef aio_fsync64
 #include <errno.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 
 int
diff --git a/sysdeps/pthread/aio_misc.c b/sysdeps/pthread/aio_misc.c
index 5c9ccb46d0..3e1dbe9c63 100644
--- a/sysdeps/pthread/aio_misc.c
+++ b/sysdeps/pthread/aio_misc.c
@@ -1,5 +1,5 @@
 /* Handle general operations.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -46,8 +46,7 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
 
   (void) pthread_attr_destroy (&attr);
   return ret;
-}                                                                                 
-
+}
 #endif
 
 static void add_request_to_runlist (struct requestlist *newrequest);
diff --git a/sysdeps/pthread/aio_misc.h b/sysdeps/pthread/aio_misc.h
index 44d53b078f..50962c7519 100644
--- a/sysdeps/pthread/aio_misc.h
+++ b/sysdeps/pthread/aio_misc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1999,2000,2001,2003,2006 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
@@ -46,7 +46,12 @@ struct waitlist
   {
     struct waitlist *next;
 
+    /* The next two fields is used in synchronous `lio_listio' operations.  */
+#ifndef DONT_NEED_AIO_MISC_COND
     pthread_cond_t *cond;
+#endif
+    int *result;
+
     volatile int *counterp;
     /* The next field is used in asynchronous `lio_listio' operations.  */
     struct sigevent *sigevp;
diff --git a/sysdeps/pthread/aio_notify.c b/sysdeps/pthread/aio_notify.c
index 877e8d9363..3f7f70ef7c 100644
--- a/sysdeps/pthread/aio_notify.c
+++ b/sysdeps/pthread/aio_notify.c
@@ -1,6 +1,5 @@
 /* Notify initiator of AIO request.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1997-2001, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -144,15 +143,24 @@ __aio_notify (struct requestlist *req)
     {
       struct waitlist *next = waitlist->next;
 
-      /* Decrement the counter.  This is used in both cases.  */
-      --*waitlist->counterp;
-
       if (waitlist->sigevp == NULL)
-	pthread_cond_signal (waitlist->cond);
+	{
+	  if (waitlist->result != NULL && aiocbp->__return_value == -1)
+	    *waitlist->result = -1;
+
+#ifdef DONT_NEED_AIO_MISC_COND
+	  AIO_MISC_NOTIFY (waitlist);
+#else
+	  /* Decrement the counter.  */
+	  --*waitlist->counterp;
+
+	  pthread_cond_signal (waitlist->cond);
+#endif
+	}
       else
 	/* This is part of a asynchronous `lio_listio' operation.  If
 	   this request is the last one, send the signal.  */
-	if (*waitlist->counterp == 0)
+	if (--*waitlist->counterp == 0)
 	  {
 #ifdef BROKEN_THREAD_SIGNALS
 	    __aio_notify_only (waitlist->sigevp, waitlist->caller_pid);
diff --git a/sysdeps/pthread/aio_read.c b/sysdeps/pthread/aio_read.c
index 62646fb12d..973c6cdd48 100644
--- a/sysdeps/pthread/aio_read.c
+++ b/sysdeps/pthread/aio_read.c
@@ -1,5 +1,5 @@
 /* Asynchronous read.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,7 @@
 
 #include <aio.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 
 int
diff --git a/sysdeps/pthread/aio_read64.c b/sysdeps/pthread/aio_read64.c
index f91b08b6db..a3a427d804 100644
--- a/sysdeps/pthread/aio_read64.c
+++ b/sysdeps/pthread/aio_read64.c
@@ -1,5 +1,5 @@
 /* Asynchronous read, 64bit offset version.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,7 @@
 
 #include <aio.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 
 int
diff --git a/sysdeps/pthread/aio_suspend.c b/sysdeps/pthread/aio_suspend.c
index 207dad964e..b85b16d10e 100644
--- a/sysdeps/pthread/aio_suspend.c
+++ b/sysdeps/pthread/aio_suspend.c
@@ -1,5 +1,5 @@
 /* Suspend until termination of a requests.
-   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2000,2002,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -36,7 +36,7 @@
 #include <sys/time.h>
 
 #include <bits/libc-lock.h>
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 
 struct clparam
@@ -44,7 +44,9 @@ struct clparam
   const struct aiocb *const *list;
   struct waitlist *waitlist;
   struct requestlist **requestlist;
+#ifndef DONT_NEED_AIO_MISC_COND
   pthread_cond_t *cond;
+#endif
   int nent;
 };
 
@@ -52,6 +54,12 @@ struct clparam
 static void
 cleanup (void *arg)
 {
+#ifdef DONT_NEED_AIO_MISC_COND
+  /* Acquire the mutex.  If pthread_cond_*wait is used this would
+     happen implicitly.  */
+  pthread_mutex_lock (&__aio_requests_mutex);
+#endif
+
   const struct clparam *param = (const struct clparam *) arg;
 
   /* Now remove the entry in the waiting list for all requests
@@ -75,8 +83,10 @@ cleanup (void *arg)
 	  *listp = (*listp)->next;
       }
 
+#ifndef DONT_NEED_AIO_MISC_COND
   /* Release the conditional variable.  */
   (void) pthread_cond_destroy (param->cond);
+#endif
 
   /* Release the mutex.  */
   pthread_mutex_unlock (&__aio_requests_mutex);
@@ -89,13 +99,21 @@ aio_suspend (list, nent, timeout)
      int nent;
      const struct timespec *timeout;
 {
+  if (__builtin_expect (nent < 0, 0))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
   struct waitlist waitlist[nent];
   struct requestlist *requestlist[nent];
+#ifndef DONT_NEED_AIO_MISC_COND
   pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+#endif
   int cnt;
   bool any = false;
   int result = 0;
-  int dummy;
+  int cntr = 1;
 
   /* Request the mutex.  */
   pthread_mutex_lock (&__aio_requests_mutex);
@@ -111,9 +129,12 @@ aio_suspend (list, nent, timeout)
 
 	    if (requestlist[cnt] != NULL)
 	      {
+#ifndef DONT_NEED_AIO_MISC_COND
 		waitlist[cnt].cond = &cond;
+#endif
+		waitlist[cnt].result = NULL;
 		waitlist[cnt].next = requestlist[cnt]->waiting;
-		waitlist[cnt].counterp = &dummy;
+		waitlist[cnt].counterp = &cntr;
 		waitlist[cnt].sigevp = NULL;
 #ifdef BROKEN_THREAD_SIGNALS
 		waitlist[cnt].caller_pid = 0;	/* Not needed.  */
@@ -139,12 +160,17 @@ aio_suspend (list, nent, timeout)
 	  .list = list,
 	  .waitlist = waitlist,
 	  .requestlist = requestlist,
+#ifndef DONT_NEED_AIO_MISC_COND
 	  .cond = &cond,
+#endif
 	  .nent = nent
 	};
 
       pthread_cleanup_push (cleanup, &clparam);
 
+#ifdef DONT_NEED_AIO_MISC_COND
+      AIO_MISC_WAIT (result, cntr, timeout, 1);
+#else
       if (timeout == NULL)
 	result = pthread_cond_wait (&cond, &__aio_requests_mutex);
       else
@@ -166,6 +192,7 @@ aio_suspend (list, nent, timeout)
 	  result = pthread_cond_timedwait (&cond, &__aio_requests_mutex,
 					   &abstime);
 	}
+#endif
 
       pthread_cleanup_pop (0);
     }
@@ -189,19 +216,23 @@ aio_suspend (list, nent, timeout)
 	  *listp = (*listp)->next;
       }
 
+#ifndef DONT_NEED_AIO_MISC_COND
   /* Release the conditional variable.  */
   if (__builtin_expect (pthread_cond_destroy (&cond) != 0, 0))
     /* This must never happen.  */
     abort ();
+#endif
 
   if (result != 0)
     {
-      /* An error occurred.  Possibly it's EINTR.  We have to translate
+#ifndef DONT_NEED_AIO_MISC_COND
+      /* An error occurred.  Possibly it's ETIMEDOUT.  We have to translate
 	 the timeout error report of `pthread_cond_timedwait' to the
 	 form expected from `aio_suspend'.  */
       if (result == ETIMEDOUT)
 	__set_errno (EAGAIN);
       else
+#endif
 	__set_errno (result);
 
       result = -1;
diff --git a/sysdeps/pthread/aio_write.c b/sysdeps/pthread/aio_write.c
index f5e89e9246..d61c5fbf9d 100644
--- a/sysdeps/pthread/aio_write.c
+++ b/sysdeps/pthread/aio_write.c
@@ -1,5 +1,5 @@
 /* Asynchronous write.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,7 @@
 
 #include <aio.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 
 int
diff --git a/sysdeps/pthread/aio_write64.c b/sysdeps/pthread/aio_write64.c
index b9c84b760b..4e23a3af95 100644
--- a/sysdeps/pthread/aio_write64.c
+++ b/sysdeps/pthread/aio_write64.c
@@ -1,5 +1,5 @@
 /* Asynchronous write, 64bit offset version.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -20,7 +20,7 @@
 
 #include <aio.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 
 int
diff --git a/sysdeps/pthread/configure b/sysdeps/pthread/configure
index 229414dd74..e39d31138d 100644
--- a/sysdeps/pthread/configure
+++ b/sysdeps/pthread/configure
@@ -1,3 +1,3 @@
-# Local configure fragment for sysdeps/unix/sysv/linux.
+# Local configure fragment for sysdeps/pthread.
 
 DEFINES="$DEFINES -D_LIBC_REENTRANT"
diff --git a/sysdeps/pthread/lio_listio.c b/sysdeps/pthread/lio_listio.c
index 5b98837b0d..c652404ae2 100644
--- a/sysdeps/pthread/lio_listio.c
+++ b/sysdeps/pthread/lio_listio.c
@@ -1,5 +1,6 @@
 /* Enqueue and list of read or write requests.
-   Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,2003,2005,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,11 +26,14 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 #define LIO_OPCODE_BASE 0
 #endif
 
+#include <shlib-compat.h>
+
+
 /* We need this special structure to handle asynchronous I/O.  */
 struct async_waitlist
   {
@@ -39,12 +43,22 @@ struct async_waitlist
   };
 
 
-int
-lio_listio (mode, list, nent, sig)
-     int mode;
-     struct aiocb *const list[];
-     int nent;
-     struct sigevent *sig;
+/* The code in glibc 2.1 to glibc 2.4 issued only one event when all
+   requests submitted with lio_listio finished.  The existing practice
+   is to issue events for the individual requests as well.  This is
+   what the new code does.  */
+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
+# define LIO_MODE(mode) ((mode) & 127)
+# define NO_INDIVIDUAL_EVENT_P(mode) ((mode) & 128)
+#else
+# define LIO_MODE(mode) mode
+# define NO_INDIVIDUAL_EVENT_P(mode) 0
+#endif
+
+
+static int
+lio_listio_internal (int mode, struct aiocb *const list[], int nent,
+		     struct sigevent *sig)
 {
   struct sigevent defsigev;
   struct requestlist *requests[nent];
@@ -52,13 +66,6 @@ lio_listio (mode, list, nent, sig)
   volatile int total = 0;
   int result = 0;
 
-  /* Check arguments.  */
-  if (mode != LIO_WAIT && mode != LIO_NOWAIT)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
   if (sig == NULL)
     {
       defsigev.sigev_notify = SIGEV_NONE;
@@ -73,7 +80,9 @@ lio_listio (mode, list, nent, sig)
   for (cnt = 0; cnt < nent; ++cnt)
     if (list[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
       {
-	list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
+	if (NO_INDIVIDUAL_EVENT_P (mode))
+	  list[cnt]->aio_sigevent.sigev_notify = SIGEV_NONE;
+
 	requests[cnt] = __aio_enqueue_request ((aiocb_union *) list[cnt],
 					       (list[cnt]->aio_lio_opcode
 					        | LIO_OPCODE_BASE));
@@ -99,7 +108,7 @@ lio_listio (mode, list, nent, sig)
 	 locked forever.  */
       pthread_mutex_unlock (&__aio_requests_mutex);
 
-      if (mode == LIO_NOWAIT)
+      if (LIO_MODE (mode) == LIO_NOWAIT)
 	{
 #ifdef BROKEN_THREAD_SIGNALS
 	__aio_notify_only (sig,
@@ -111,11 +120,13 @@ lio_listio (mode, list, nent, sig)
 
       return result;
     }
-  else if (mode == LIO_WAIT)
+  else if (LIO_MODE (mode) == LIO_WAIT)
     {
+#ifndef DONT_NEED_AIO_MISC_COND
       pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-      struct waitlist waitlist[nent];
       int oldstate;
+#endif
+      struct waitlist waitlist[nent];
 
       total = 0;
       for (cnt = 0; cnt < nent; ++cnt)
@@ -124,7 +135,10 @@ lio_listio (mode, list, nent, sig)
 
 	  if (requests[cnt] != NULL && list[cnt]->aio_lio_opcode != LIO_NOP)
 	    {
+#ifndef DONT_NEED_AIO_MISC_COND
 	      waitlist[cnt].cond = &cond;
+#endif
+	      waitlist[cnt].result = &result;
 	      waitlist[cnt].next = requests[cnt]->waiting;
 	      waitlist[cnt].counterp = &total;
 	      waitlist[cnt].sigevp = NULL;
@@ -136,21 +150,32 @@ lio_listio (mode, list, nent, sig)
 	    }
 	}
 
-      /* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancelation
+#ifdef DONT_NEED_AIO_MISC_COND
+      AIO_MISC_WAIT (result, total, NULL, 0);
+#else
+      /* Since `pthread_cond_wait'/`pthread_cond_timedwait' are cancellation
 	 points we must be careful.  We added entries to the waiting lists
-	 which we must remove.  So defer cancelation for now.  */
+	 which we must remove.  So defer cancellation for now.  */
       pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
 
       while (total > 0)
 	pthread_cond_wait (&cond, &__aio_requests_mutex);
 
-      /* Now it's time to restore the cancelation state.  */
+      /* Now it's time to restore the cancellation state.  */
       pthread_setcancelstate (oldstate, NULL);
 
       /* Release the conditional variable.  */
       if (pthread_cond_destroy (&cond) != 0)
 	/* This must never happen.  */
 	abort ();
+#endif
+
+      /* If any of the I/O requests failed, return -1 and set errno.  */
+      if (result != 0)
+	{
+	  __set_errno (result == EINTR ? EINTR : EIO);
+	  result = -1;
+	}
     }
   else
     {
@@ -179,7 +204,10 @@ lio_listio (mode, list, nent, sig)
 	      if (requests[cnt] != NULL
 		  && list[cnt]->aio_lio_opcode != LIO_NOP)
 		{
+#ifndef DONT_NEED_AIO_MISC_COND
 		  waitlist->list[cnt].cond = NULL;
+#endif
+		  waitlist->list[cnt].result = NULL;
 		  waitlist->list[cnt].next = requests[cnt]->waiting;
 		  waitlist->list[cnt].counterp = &waitlist->counter;
 		  waitlist->list[cnt].sigevp = &waitlist->sigev;
@@ -201,3 +229,38 @@ lio_listio (mode, list, nent, sig)
 
   return result;
 }
+
+
+#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_4)
+int
+attribute_compat_text_section
+__lio_listio_21 (int mode, struct aiocb *const list[], int nent,
+		 struct sigevent *sig)
+{
+  /* Check arguments.  */
+  if (mode != LIO_WAIT && mode != LIO_NOWAIT)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return lio_listio_internal (mode | LIO_NO_INDIVIDUAL_EVENT, list, nent, sig);
+}
+compat_symbol (librt, __lio_listio_21, lio_listio, GLIBC_2_1);
+#endif
+
+
+int
+__lio_listio_item_notify (int mode, struct aiocb *const list[], int nent,
+			  struct sigevent *sig)
+{
+    /* Check arguments.  */
+  if (mode != LIO_WAIT && mode != LIO_NOWAIT)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return lio_listio_internal (mode, list, nent, sig);
+}
+versioned_symbol (librt, __lio_listio_item_notify, lio_listio, GLIBC_2_4);
diff --git a/sysdeps/pthread/lio_listio64.c b/sysdeps/pthread/lio_listio64.c
index fee1e591ef..c6b7cf7bd2 100644
--- a/sysdeps/pthread/lio_listio64.c
+++ b/sysdeps/pthread/lio_listio64.c
@@ -1,5 +1,5 @@
 /* Enqueue and list of read or write requests, 64bit offset version.
-   Copyright (C) 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -24,9 +24,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 #define lio_listio lio_listio64
+#define __lio_listio_21 __lio_listio64_21
+#define __lio_listio_item_notify __lio_listio64_item_notify
 #define aiocb aiocb64
 #define LIO_OPCODE_BASE 128
 #include <lio_listio.c>
diff --git a/sysdeps/rs6000/add_n.s b/sysdeps/rs6000/add_n.s
deleted file mode 100644
index 216874e7a4..0000000000
--- a/sysdeps/rs6000/add_n.s
+++ /dev/null
@@ -1,81 +0,0 @@
-# IBM POWER __mpn_add_n -- Add two limb vectors of equal, non-zero length.
-
-# Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-
-# INPUT PARAMETERS
-# res_ptr	r3
-# s1_ptr	r4
-# s2_ptr	r5
-# size		r6
-
-	.toc
-	.extern __mpn_add_n[DS]
-	.extern .__mpn_add_n
-.csect [PR]
-	.align 2
-	.globl __mpn_add_n
-	.globl .__mpn_add_n
-	.csect __mpn_add_n[DS]
-__mpn_add_n:
-	.long .__mpn_add_n, TOC[tc0], 0
-	.csect [PR]
-.__mpn_add_n:
-	andil.	10,6,1		# odd or even number of limbs?
-	l	8,0(4)		# load least significant s1 limb
-	l	0,0(5)		# load least significant s2 limb
-	cal	3,-4(3)		# offset res_ptr, it's updated before it's used
-	sri	10,6,1		# count for unrolled loop
-	a	7,0,8		# add least significant limbs, set cy
-	mtctr	10		# copy count into CTR
-	beq	0,Leven		# branch if even # of limbs (# of limbs >= 2)
-
-# We have an odd # of limbs.  Add the first limbs separately.
-	cmpi	1,10,0		# is count for unrolled loop zero?
-	bne	1,L1		# branch if not
-	st	7,4(3)
-	aze	3,10		# use the fact that r10 is zero...
-	br			# return
-
-# We added least significant limbs.  Now reload the next limbs to enter loop.
-L1:	lu	8,4(4)		# load s1 limb and update s1_ptr
-	lu	0,4(5)		# load s2 limb and update s2_ptr
-	stu	7,4(3)
-	ae	7,0,8		# add limbs, set cy
-Leven:	lu	9,4(4)		# load s1 limb and update s1_ptr
-	lu	10,4(5)		# load s2 limb and update s2_ptr
-	bdz	Lend		# If done, skip loop
-
-Loop:	lu	8,4(4)		# load s1 limb and update s1_ptr
-	lu	0,4(5)		# load s2 limb and update s2_ptr
-	ae	11,9,10		# add previous limbs with cy, set cy
-	stu	7,4(3)		# 
-	lu	9,4(4)		# load s1 limb and update s1_ptr
-	lu	10,4(5)		# load s2 limb and update s2_ptr
-	ae	7,0,8		# add previous limbs with cy, set cy
-	stu	11,4(3)		# 
-	bdn	Loop		# decrement CTR and loop back
-
-Lend:	ae	11,9,10		# add limbs with cy, set cy
-	st	7,4(3)		# 
-	st	11,8(3)		# 
-	lil	3,0		# load cy into ...
-	aze	3,3		# ... return value register
-	br
diff --git a/sysdeps/rs6000/addmul_1.s b/sysdeps/rs6000/addmul_1.s
deleted file mode 100644
index 7cd743cede..0000000000
--- a/sysdeps/rs6000/addmul_1.s
+++ /dev/null
@@ -1,123 +0,0 @@
-# IBM POWER __mpn_addmul_1 -- Multiply a limb vector with a limb and add
-# the result to a second limb vector.
-
-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-
-# INPUT PARAMETERS
-# res_ptr	r3
-# s1_ptr	r4
-# size		r5
-# s2_limb	r6
-
-# The RS/6000 has no unsigned 32x32->64 bit multiplication instruction.  To
-# obtain that operation, we have to use the 32x32->64 signed multiplication
-# instruction, and add the appropriate compensation to the high limb of the
-# result.  We add the multiplicand if the multiplier has its most significant
-# bit set, and we add the multiplier if the multiplicand has its most
-# significant bit set.  We need to preserve the carry flag between each
-# iteration, so we have to compute the compensation carefully (the natural,
-# srai+and doesn't work).  Since the POWER architecture has a branch unit
-# we can branch in zero cycles, so that's how we perform the additions.
-
-	.toc
-	.csect .__mpn_addmul_1[PR]
-	.align 2
-	.globl __mpn_addmul_1
-	.globl .__mpn_addmul_1
-	.csect __mpn_addmul_1[DS]
-__mpn_addmul_1:
-	.long .__mpn_addmul_1[PR], TOC[tc0], 0
-	.csect .__mpn_addmul_1[PR]
-.__mpn_addmul_1:
-
-	cal	3,-4(3)
-	l	0,0(4)
-	cmpi	0,6,0
-	mtctr	5
-	mul	9,0,6
-	srai	7,0,31
-	and	7,7,6
-	mfmq	8
-	cax	9,9,7
-	l	7,4(3)
-	a	8,8,7		# add res_limb
-	blt	Lneg
-Lpos:	bdz	Lend
-
-Lploop:	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	10,0,6
-	mfmq	0
-	ae	8,0,9		# low limb + old_cy_limb + old cy
-	l	7,4(3)
-	aze	10,10		# propagate cy to new cy_limb
-	a	8,8,7		# add res_limb
-	bge	Lp0
-	cax	10,10,6		# adjust high limb for negative limb from s1
-Lp0:	bdz	Lend0
-	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	9,0,6
-	mfmq	0
-	ae	8,0,10
-	l	7,4(3)
-	aze	9,9
-	a	8,8,7
-	bge	Lp1
-	cax	9,9,6		# adjust high limb for negative limb from s1
-Lp1:	bdn	Lploop
-
-	b	Lend
-
-Lneg:	cax	9,9,0
-	bdz	Lend
-Lnloop:	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	10,0,6
-	mfmq	7
-	ae	8,7,9
-	l	7,4(3)
-	ae	10,10,0		# propagate cy to new cy_limb
-	a	8,8,7		# add res_limb
-	bge	Ln0
-	cax	10,10,6		# adjust high limb for negative limb from s1
-Ln0:	bdz	Lend0
-	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	9,0,6
-	mfmq	7
-	ae	8,7,10
-	l	7,4(3)
-	ae	9,9,0		# propagate cy to new cy_limb
-	a	8,8,7		# add res_limb
-	bge	Ln1
-	cax	9,9,6		# adjust high limb for negative limb from s1
-Ln1:	bdn	Lnloop
-	b	Lend
-
-Lend0:	cal	9,0(10)
-Lend:	st	8,4(3)
-	aze	3,9
-	br
diff --git a/sysdeps/rs6000/ffs.c b/sysdeps/rs6000/ffs.c
deleted file mode 100644
index 4d01727044..0000000000
--- a/sysdeps/rs6000/ffs.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ffs -- find first set bit in a word, counted from least significant end.
-   For IBM rs6000.
-   Copyright (C) 1991, 1992, 1997, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Torbjorn Granlund (tege@sics.se).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <string.h>
-
-#undef	ffs
-
-#ifdef	__GNUC__
-
-int
-__ffs (x)
-     int x;
-{
-  int cnt;
-
-  asm ("cntlz %0,%1" : "=r" (cnt) : "r" (x & -x));
-  return 32 - cnt;
-}
-weak_alias (__ffs, ffs)
-libc_hidden_builtin_def (ffs)
-
-#else
-#include <sysdeps/generic/ffs.c>
-#endif
diff --git a/sysdeps/rs6000/lshift.s b/sysdeps/rs6000/lshift.s
deleted file mode 100644
index 8ccba7407e..0000000000
--- a/sysdeps/rs6000/lshift.s
+++ /dev/null
@@ -1,59 +0,0 @@
-# IBM POWER __mpn_lshift -- 
-
-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-
-# INPUT PARAMETERS
-# res_ptr	r3
-# s_ptr		r4
-# size		r5
-# cnt		r6
-
-	.toc
-	.extern __mpn_lshift[DS]
-	.extern .__mpn_lshift
-.csect [PR]
-	.align 2
-	.globl __mpn_lshift
-	.globl .__mpn_lshift
-	.csect __mpn_lshift[DS]
-__mpn_lshift:
-	.long .__mpn_lshift, TOC[tc0], 0
-	.csect [PR]
-.__mpn_lshift:
-	sli	0,5,2
-	cax	9,3,0
-	cax	4,4,0
-	sfi	8,6,32
-	mtctr	5		# put limb count in CTR loop register
-	lu	0,-4(4)		# read most significant limb
-	sre	3,0,8		# compute carry out limb, and init MQ register
-	bdz	Lend2		# if just one limb, skip loop
-	lu	0,-4(4)		# read 2:nd most significant limb
-	sreq	7,0,8		# compute most significant limb of result
-	bdz	Lend		# if just two limb, skip loop
-Loop:	lu	0,-4(4)		# load next lower limb
-	stu	7,-4(9)		# store previous result during read latency
-	sreq	7,0,8		# compute result limb
-	bdn	Loop		# loop back until CTR is zero
-Lend:	stu	7,-4(9)		# store 2:nd least significant limb
-Lend2:	sle	7,0,6		# compute least significant limb
-	st      7,-4(9)		# store it"				\
-	br
diff --git a/sysdeps/rs6000/memcopy.h b/sysdeps/rs6000/memcopy.h
deleted file mode 100644
index 8bdb6e9766..0000000000
--- a/sysdeps/rs6000/memcopy.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 1991, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/generic/memcopy.h>
-
-#undef	OP_T_THRES
-#define OP_T_THRES 32
-
-#undef	BYTE_COPY_FWD
-#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes)				      \
-  do									      \
-    {									      \
-      size_t __nbytes = nbytes;						      \
-      asm volatile("mtspr	1,%2\n"					      \
-		   "lsx		6,0,%1\n"				      \
-		   "stsx	6,0,%0" : /* No outputs.  */ :		      \
-		   "b" (dst_bp), "b" (src_bp), "r" (__nbytes) :		      \
-		   "6", "7", "8", "9", "10", "11", "12", "13");		      \
-      dst_bp += __nbytes;						      \
-      src_bp += __nbytes;						      \
-    } while (0)
-
-#undef	BYTE_COPY_BWD
-#define BYTE_COPY_BWD(dst_ep, src_ep, nbytes)				      \
-  do									      \
-    {									      \
-      size_t __nbytes = (nbytes);					      \
-      dst_ep -= __nbytes;						      \
-      src_ep -= __nbytes;						      \
-      asm volatile("mtspr	1,%2\n"					      \
-		   "lsx		6,0,%1\n"				      \
-		   "stsx	6,0,%0" : /* No outputs.  */ :		      \
-		   "b" (dst_ep), "b" (src_ep), "r" (__nbytes) :		      \
-		   "6", "7", "8", "9", "10", "11", "12", "13");		      \
-    } while (0)
-
-#undef	WORD_COPY_FWD
-#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes)		      \
-  do									      \
-    {									      \
-      size_t __nblocks = (nbytes) / 32;					      \
-      if (__nblocks != 0)						      \
-	asm volatile("mtctr	%4\n"					      \
-		     "lsi	6,%1,32\n"				      \
-		     "ai	%1,%1,32\n"				      \
-		     "stsi	6,%0,32\n"				      \
-		     "ai	%0,%0,32\n"				      \
-		     "bdn	$-16" :					      \
-		     "=b" (dst_bp), "=b" (src_bp) :			      \
-		     "0" (dst_bp), "1" (src_bp), "r" (__nblocks) :	      \
-		     "6", "7", "8", "9", "10", "11", "12", "13");	      \
-      (nbytes_left) = (nbytes) % 32;					      \
-    } while (0)
-
-#undef	WORD_COPY_BWD
-#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes)		      \
-  do									      \
-    {									      \
-      size_t __nblocks = (nbytes) / 32;					      \
-      if (__nblocks != 0)						      \
-	asm volatile("mtctr	%4\n"					      \
-		     "ai	%1,%1,-32\n"				      \
-		     "lsi	6,%1,32\n"				      \
-		     "ai	%0,%0,-32\n"				      \
-		     "stsi	6,%0,32\n"				      \
-		     "bdn	$-16" :					      \
-		     "=b" (dst_ep), "=b" (src_ep) :			      \
-		     "0" (dst_ep), "1" (src_ep), "r" (__nblocks) :	      \
-		     "6", "7", "8", "9", "10", "11", "12", "13");	      \
-      (nbytes_left) = (nbytes) % 32;					      \
-    } while (0)
diff --git a/sysdeps/rs6000/mul_1.s b/sysdeps/rs6000/mul_1.s
deleted file mode 100644
index c0feef4b72..0000000000
--- a/sysdeps/rs6000/mul_1.s
+++ /dev/null
@@ -1,110 +0,0 @@
-# IBM POWER __mpn_mul_1 -- Multiply a limb vector with a limb and store
-# the result in a second limb vector.
-
-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-
-# INPUT PARAMETERS
-# res_ptr	r3
-# s1_ptr	r4
-# size		r5
-# s2_limb	r6
-
-# The RS/6000 has no unsigned 32x32->64 bit multiplication instruction.  To
-# obtain that operation, we have to use the 32x32->64 signed multiplication
-# instruction, and add the appropriate compensation to the high limb of the
-# result.  We add the multiplicand if the multiplier has its most significant
-# bit set, and we add the multiplier if the multiplicand has its most
-# significant bit set.  We need to preserve the carry flag between each
-# iteration, so we have to compute the compensation carefully (the natural,
-# srai+and doesn't work).  Since the POWER architecture has a branch unit
-# we can branch in zero cycles, so that's how we perform the additions.
-
-	.toc
-	.csect .__mpn_mul_1[PR]
-	.align 2
-	.globl __mpn_mul_1
-	.globl .__mpn_mul_1
-	.csect __mpn_mul_1[DS]
-__mpn_mul_1:
-	.long .__mpn_mul_1[PR], TOC[tc0], 0
-	.csect .__mpn_mul_1[PR]
-.__mpn_mul_1:
-
-	cal	3,-4(3)
-	l	0,0(4)
-	cmpi	0,6,0
-	mtctr	5
-	mul	9,0,6
-	srai	7,0,31
-	and	7,7,6
-	mfmq	8
-	ai	0,0,0		# reset carry
-	cax	9,9,7
-	blt	Lneg
-Lpos:	bdz	Lend
-Lploop:	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	10,0,6
-	mfmq	0
-	ae	8,0,9
-	bge	Lp0
-	cax	10,10,6		# adjust high limb for negative limb from s1
-Lp0:	bdz	Lend0
-	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	9,0,6
-	mfmq	0
-	ae	8,0,10
-	bge	Lp1
-	cax	9,9,6		# adjust high limb for negative limb from s1
-Lp1:	bdn	Lploop
-	b	Lend
-
-Lneg:	cax	9,9,0
-	bdz	Lend
-Lnloop:	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	10,0,6
-	cax	10,10,0		# adjust high limb for negative s2_limb
-	mfmq	0
-	ae	8,0,9
-	bge	Ln0
-	cax	10,10,6		# adjust high limb for negative limb from s1
-Ln0:	bdz	Lend0
-	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	9,0,6
-	cax	9,9,0		# adjust high limb for negative s2_limb
-	mfmq	0
-	ae	8,0,10
-	bge	Ln1
-	cax	9,9,6		# adjust high limb for negative limb from s1
-Ln1:	bdn	Lnloop
-	b	Lend
-
-Lend0:	cal	9,0(10)
-Lend:	st	8,4(3)
-	aze	3,9
-	br
diff --git a/sysdeps/rs6000/rshift.s b/sysdeps/rs6000/rshift.s
deleted file mode 100644
index 145218fabd..0000000000
--- a/sysdeps/rs6000/rshift.s
+++ /dev/null
@@ -1,57 +0,0 @@
-# IBM POWER __mpn_rshift -- 
-
-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-
-# INPUT PARAMETERS
-# res_ptr	r3
-# s_ptr		r4
-# size		r5
-# cnt		r6
-
-	.toc
-	.extern __mpn_rshift[DS]
-	.extern .__mpn_rshift
-.csect [PR]
-	.align 2
-	.globl __mpn_rshift
-	.globl .__mpn_rshift
-	.csect __mpn_rshift[DS]
-__mpn_rshift:
-	.long .__mpn_rshift, TOC[tc0], 0
-	.csect [PR]
-.__mpn_rshift:
-	sfi	8,6,32
-	mtctr	5		# put limb count in CTR loop register
-	l	0,0(4)		# read least significant limb
-	ai	9,3,-4		# adjust res_ptr since it's offset in the stu:s
-	sle	3,0,8		# compute carry limb, and init MQ register
-	bdz	Lend2		# if just one limb, skip loop
-	lu	0,4(4)		# read 2:nd least significant limb
-	sleq	7,0,8		# compute least significant limb of result
-	bdz	Lend		# if just two limb, skip loop
-Loop:	lu	0,4(4)		# load next higher limb
-	stu	7,4(9)		# store previous result during read latency
-	sleq	7,0,8		# compute result limb
-	bdn	Loop		# loop back until CTR is zero
-Lend:	stu	7,4(9)		# store 2:nd most significant limb
-Lend2:	sre	7,0,6		# compute most significant limb
-	st      7,4(9)		# store it"				\
-	br
diff --git a/sysdeps/rs6000/sub_n.s b/sysdeps/rs6000/sub_n.s
deleted file mode 100644
index d931870935..0000000000
--- a/sysdeps/rs6000/sub_n.s
+++ /dev/null
@@ -1,82 +0,0 @@
-# IBM POWER __mpn_sub_n -- Subtract two limb vectors of equal, non-zero length.
-
-# Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-
-# INPUT PARAMETERS
-# res_ptr	r3
-# s1_ptr	r4
-# s2_ptr	r5
-# size		r6
-
-	.toc
-	.extern __mpn_sub_n[DS]
-	.extern .__mpn_sub_n
-.csect [PR]
-	.align 2
-	.globl __mpn_sub_n
-	.globl .__mpn_sub_n
-	.csect __mpn_sub_n[DS]
-__mpn_sub_n:
-	.long .__mpn_sub_n, TOC[tc0], 0
-	.csect [PR]
-.__mpn_sub_n:
-	andil.	10,6,1		# odd or even number of limbs?
-	l	8,0(4)		# load least significant s1 limb
-	l	0,0(5)		# load least significant s2 limb
-	cal	3,-4(3)		# offset res_ptr, it's updated before it's used
-	sri	10,6,1		# count for unrolled loop
-	sf	7,0,8		# subtract least significant limbs, set cy
-	mtctr	10		# copy count into CTR
-	beq	0,Leven		# branch if even # of limbs (# of limbs >= 2)
-
-# We have an odd # of limbs.  Add the first limbs separately.
-	cmpi	1,10,0		# is count for unrolled loop zero?
-	bne	1,L1		# branch if not
-	st	7,4(3)
-	sfe	3,0,0		# load !cy into ...
-	sfi	3,3,0		# ... return value register
-	br			# return
-
-# We added least significant limbs.  Now reload the next limbs to enter loop.
-L1:	lu	8,4(4)		# load s1 limb and update s1_ptr
-	lu	0,4(5)		# load s2 limb and update s2_ptr
-	stu	7,4(3)
-	sfe	7,0,8		# subtract limbs, set cy
-Leven:	lu	9,4(4)		# load s1 limb and update s1_ptr
-	lu	10,4(5)		# load s2 limb and update s2_ptr
-	bdz	Lend		# If done, skip loop
-
-Loop:	lu	8,4(4)		# load s1 limb and update s1_ptr
-	lu	0,4(5)		# load s2 limb and update s2_ptr
-	sfe	11,10,9		# subtract previous limbs with cy, set cy
-	stu	7,4(3)		# 
-	lu	9,4(4)		# load s1 limb and update s1_ptr
-	lu	10,4(5)		# load s2 limb and update s2_ptr
-	sfe	7,0,8		# subtract previous limbs with cy, set cy
-	stu	11,4(3)		# 
-	bdn	Loop		# decrement CTR and loop back
-
-Lend:	sfe	11,10,9		# subtract limbs with cy, set cy
-	st	7,4(3)		# 
-	st	11,8(3)		# 
-	sfe	3,0,0		# load !cy into ...
-	sfi	3,3,0		# ... return value register
-	br
diff --git a/sysdeps/rs6000/submul_1.s b/sysdeps/rs6000/submul_1.s
deleted file mode 100644
index 41095ab001..0000000000
--- a/sysdeps/rs6000/submul_1.s
+++ /dev/null
@@ -1,128 +0,0 @@
-# IBM POWER __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
-# the result from a second limb vector.
-
-# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
-
-# This file is part of the GNU MP Library.
-
-# The GNU MP 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 MP 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 MP Library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-# MA 02111-1307, USA.
-
-
-# INPUT PARAMETERS
-# res_ptr	r3
-# s1_ptr	r4
-# size		r5
-# s2_limb	r6
-
-# The RS/6000 has no unsigned 32x32->64 bit multiplication instruction.  To
-# obtain that operation, we have to use the 32x32->64 signed multiplication
-# instruction, and add the appropriate compensation to the high limb of the
-# result.  We add the multiplicand if the multiplier has its most significant
-# bit set, and we add the multiplier if the multiplicand has its most
-# significant bit set.  We need to preserve the carry flag between each
-# iteration, so we have to compute the compensation carefully (the natural,
-# srai+and doesn't work).  Since the POWER architecture has a branch unit
-# we can branch in zero cycles, so that's how we perform the additions.
-
-	.toc
-	.csect .__mpn_submul_1[PR]
-	.align 2
-	.globl __mpn_submul_1
-	.globl .__mpn_submul_1
-	.csect __mpn_submul_1[DS]
-__mpn_submul_1:
-	.long .__mpn_submul_1[PR], TOC[tc0], 0
-	.csect .__mpn_submul_1[PR]
-.__mpn_submul_1:
-
-	cal	3,-4(3)
-	l	0,0(4)
-	cmpi	0,6,0
-	mtctr	5
-	mul	9,0,6
-	srai	7,0,31
-	and	7,7,6
-	mfmq	11
-	cax	9,9,7
-	l	7,4(3)
-	sf	8,11,7		# add res_limb
-	a	11,8,11		# invert cy (r11 is junk)
-	blt	Lneg
-Lpos:	bdz	Lend
-
-Lploop:	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	10,0,6
-	mfmq	0
-	ae	11,0,9		# low limb + old_cy_limb + old cy
-	l	7,4(3)
-	aze	10,10		# propagate cy to new cy_limb
-	sf	8,11,7		# add res_limb
-	a	11,8,11		# invert cy (r11 is junk)
-	bge	Lp0
-	cax	10,10,6		# adjust high limb for negative limb from s1
-Lp0:	bdz	Lend0
-	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	9,0,6
-	mfmq	0
-	ae	11,0,10
-	l	7,4(3)
-	aze	9,9
-	sf	8,11,7
-	a	11,8,11		# invert cy (r11 is junk)
-	bge	Lp1
-	cax	9,9,6		# adjust high limb for negative limb from s1
-Lp1:	bdn	Lploop
-
-	b	Lend
-
-Lneg:	cax	9,9,0
-	bdz	Lend
-Lnloop:	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	10,0,6
-	mfmq	7
-	ae	11,7,9
-	l	7,4(3)
-	ae	10,10,0		# propagate cy to new cy_limb
-	sf	8,11,7		# add res_limb
-	a	11,8,11		# invert cy (r11 is junk)
-	bge	Ln0
-	cax	10,10,6		# adjust high limb for negative limb from s1
-Ln0:	bdz	Lend0
-	lu	0,4(4)
-	stu	8,4(3)
-	cmpi	0,0,0
-	mul	9,0,6
-	mfmq	7
-	ae	11,7,10
-	l	7,4(3)
-	ae	9,9,0		# propagate cy to new cy_limb
-	sf	8,11,7		# add res_limb
-	a	11,8,11		# invert cy (r11 is junk)
-	bge	Ln1
-	cax	9,9,6		# adjust high limb for negative limb from s1
-Ln1:	bdn	Lnloop
-	b	Lend
-
-Lend0:	cal	9,0(10)
-Lend:	st	8,4(3)
-	aze	3,9
-	br
diff --git a/sysdeps/s390/Dist b/sysdeps/s390/Dist
deleted file mode 100644
index 10a95f596b..0000000000
--- a/sysdeps/s390/Dist
+++ /dev/null
@@ -1,3 +0,0 @@
-machine-gmon.h
-bits/link.h
-fpu/fenv_libc.h
diff --git a/sysdeps/s390/Implies b/sysdeps/s390/Implies
index 5b29b26128..1945b1f4bb 100644
--- a/sysdeps/s390/Implies
+++ b/sysdeps/s390/Implies
@@ -1,2 +1,3 @@
+ieee754/ldbl-128
 ieee754/dbl-64
 ieee754/flt-32
diff --git a/sysdeps/s390/bits/link.h b/sysdeps/s390/bits/link.h
index fc1fba363a..70f0043820 100644
--- a/sysdeps/s390/bits/link.h
+++ b/sysdeps/s390/bits/link.h
@@ -1,13 +1,111 @@
-#if __WORDSIZE == 64
-struct link_map_machine
-  {
-    Elf64_Addr plt; /* Address of .plt + 0x2e */
-    Elf64_Addr gotplt; /* Address of .got + 0x18 */
-  };
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+
+#if __ELF_NATIVE_CLASS == 32
+
+/* Registers for entry into PLT on s390-32.  */
+typedef struct La_s390_32_regs
+{
+  uint32_t lr_r2;
+  uint32_t lr_r3;
+  uint32_t lr_r4;
+  uint32_t lr_r5;
+  uint32_t lr_r6;
+  double lr_fp0;
+  double lr_fp2;
+} La_s390_32_regs;
+
+/* Return values for calls from PLT on s390-32.  */
+typedef struct La_s390_32_retval
+{
+  uint32_t lrv_r2;
+  uint32_t lrv_r3;
+  double lrv_fp0;
+} La_s390_32_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf32_Addr la_s390_32_gnu_pltenter (Elf32_Sym *__sym,
+					   unsigned int __ndx,
+					   uintptr_t *__refcook,
+					   uintptr_t *__defcook,
+					   La_s390_32_regs *__regs,
+					   unsigned int *__flags,
+					   const char *__symname,
+					   long int *__framesizep);
+extern unsigned int la_s390_32_gnu_pltexit (Elf32_Sym *__sym,
+					    unsigned int __ndx,
+					    uintptr_t *__refcook,
+					    uintptr_t *__defcook,
+					    const La_s390_32_regs *__inregs,
+					    La_s390_32_retval *__outregs,
+					    const char *symname);
+
+__END_DECLS
+
 #else
-struct link_map_machine
-  {
-    Elf32_Addr plt; /* Address of .plt + 0x2c */
-    Elf32_Addr gotplt; /* Address of .got + 0x0c */
-  };
+
+/* Registers for entry into PLT on s390-64.  */
+typedef struct La_s390_64_regs
+{
+  uint64_t lr_r2;
+  uint64_t lr_r3;
+  uint64_t lr_r4;
+  uint64_t lr_r5;
+  uint64_t lr_r6;
+  double lr_fp0;
+  double lr_fp2;
+  double lr_fp4;
+  double lr_fp6;
+} La_s390_64_regs;
+
+/* Return values for calls from PLT on s390-64.  */
+typedef struct La_s390_64_retval
+{
+  uint64_t lrv_r2;
+  double lrv_fp0;
+} La_s390_64_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_s390_64_gnu_pltenter (Elf64_Sym *__sym,
+					   unsigned int __ndx,
+					   uintptr_t *__refcook,
+					   uintptr_t *__defcook,
+					   La_s390_64_regs *__regs,
+					   unsigned int *__flags,
+					   const char *__symname,
+					   long int *__framesizep);
+extern unsigned int la_s390_64_gnu_pltexit (Elf64_Sym *__sym,
+					    unsigned int __ndx,
+					    uintptr_t *__refcook,
+					    uintptr_t *__defcook,
+					    const La_s390_64_regs *__inregs,
+					    La_s390_64_retval *__outregs,
+					    const char *symname);
+
+__END_DECLS
+
 #endif
diff --git a/sysdeps/s390/bits/linkmap.h b/sysdeps/s390/bits/linkmap.h
new file mode 100644
index 0000000000..fc1fba363a
--- /dev/null
+++ b/sysdeps/s390/bits/linkmap.h
@@ -0,0 +1,13 @@
+#if __WORDSIZE == 64
+struct link_map_machine
+  {
+    Elf64_Addr plt; /* Address of .plt + 0x2e */
+    Elf64_Addr gotplt; /* Address of .got + 0x18 */
+  };
+#else
+struct link_map_machine
+  {
+    Elf32_Addr plt; /* Address of .plt + 0x2c */
+    Elf32_Addr gotplt; /* Address of .got + 0x0c */
+  };
+#endif
diff --git a/sysdeps/s390/bits/mathdef.h b/sysdeps/s390/bits/mathdef.h
new file mode 100644
index 0000000000..4dcb612c33
--- /dev/null
+++ b/sysdeps/s390/bits/mathdef.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 1997, 1998, 1999, 2000, 2004, 2006
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#if defined  __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF	1
+
+/* Normally, there is no long double type and the `float' and `double'
+   expressions are evaluated as `double'.  */
+typedef double float_t;		/* `float' expressions are evaluated as
+				   `double'.  */
+typedef double double_t;	/* `double' expressions are evaluated as
+				   `double'.  */
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+# define FP_ILOGB0	(-2147483647)
+# define FP_ILOGBNAN	2147483647
+
+#endif	/* ISO C99 */
diff --git a/sysdeps/s390/bits/setjmp.h b/sysdeps/s390/bits/setjmp.h
index 35bc9a53f3..5588c03301 100644
--- a/sysdeps/s390/bits/setjmp.h
+++ b/sysdeps/s390/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,2002,2005,2006 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
@@ -21,39 +21,28 @@
 #ifndef __S390_SETJMP_H__
 #define __S390_SETJMP_H__
 
-#include <bits/wordsize.h>
+#if !defined _SETJMP_H && !defined _PTHREAD_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
 
-#define __JB_GPR6	0
-#define __JB_GPR7	1
-#define __JB_GPR8	2
-#define __JB_GPR9	3
-#define __JB_GPR10	4
-#define __JB_GPR11	5
-#define __JB_GPR12	6
-#define __JB_GPR13	7
-#define __JB_GPR14	8
-#define __JB_GPR15	9
+#include <bits/wordsize.h>
 
 #ifndef	_ASM
 
-typedef struct {
-    /* We save registers 6-15.  */
-    long int __gregs[10];
-
-#if __WORDSIZE == 64
-   /* We save fpu registers 1, 3, 5 and 7.  */
-    long __fpregs[8];
-#else
-    /* We save fpu registers 4 and 6.  */
-    long __fpregs[4];
-#endif
+typedef struct __s390_jmp_buf
+{
+  /* We save registers 6-15.  */
+  long int __gregs[10];
+
+# if __WORDSIZE == 64
+  /* We save fpu registers 1, 3, 5 and 7.  */
+  long __fpregs[8];
+# else
+  /* We save fpu registers 4 and 6.  */
+  long __fpregs[4];
+# endif
 } __jmp_buf[1];
 
 #endif
 
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)->__gregs[__JB_GPR15])
-
 #endif /* __S390_SETJMP_H__ */
diff --git a/sysdeps/s390/bits/string.h b/sysdeps/s390/bits/string.h
index 7134827eb0..d83df39bb2 100644
--- a/sysdeps/s390/bits/string.h
+++ b/sysdeps/s390/bits/string.h
@@ -51,7 +51,7 @@ strlen (__const char *__str)
 			  "0: srst  %0,%1\n"
 			  "   jo    0b\n"
 			  : "+&a" (__ptr), "+&a" (__tmp) : 
-			  : "cc", "0" );
+			  : "cc", "memory", "0" );
     return (size_t) (__ptr - __str);
 }
 #endif
@@ -105,7 +105,7 @@ strncpy (char *__dest, __const char *__src, size_t __n)
 #endif
                             "4:"
                             : "+&a" (__ptr), "+&a" (__n) : "a" (__diff)
-                            : "cc", "0" );
+                            : "cc", "memory", "0" );
     }
     return __ret;
 }
@@ -134,7 +134,7 @@ strcat(char *__dest, const char *__src)
 			  "0: mvst  %0,%1\n"
 			  "   jo    0b"
 			  : "+&a" (__ptr), "+&a" (__src) :
-			  : "cc", "0" );
+			  : "cc", "memory", "0" );
     return __ret;
 }
 #endif
@@ -157,7 +157,7 @@ strncat (char *__dest, __const char *__src, size_t __n)
 			    "0: srst  %0,%1\n"
 			  "   jo    0b\n"
 			    : "+&a" (__ptr), "+&a" (__tmp) :
-			    : "cc", "0" );
+			    : "cc", "memory", "0" );
 
       __diff = (size_t) (__ptr - __src);
       __tmp = (char *) __src;
@@ -175,7 +175,7 @@ strncat (char *__dest, __const char *__src, size_t __n)
                             "   stc   0,1(%2,%0)\n"
 			    "2:"
                             : "+&a" (__tmp), "+&a" (__n) : "a" (__diff)
-                            : "cc", "0" );
+                            : "cc", "memory", "0" );
 
     }
     return __ret;
@@ -200,7 +200,7 @@ memchr (__const void *__str, int __c, size_t __n)
                           "   la    %0,0\n"
                           "1:"
 			  : "+&a" (__ptr), "+&a" (__tmp) : "d" (__c)
-			  : "cc", "0" );
+			  : "cc", "memory", "0" );
     return __ptr;
 }
 #endif
@@ -222,7 +222,7 @@ strcmp (__const char *__s1, __const char *__s2)
 			  "   ipm   %0\n"
 			  "   srl   %0,28"
 			  : "=d" (__ret), "+&a" (__p1), "+&a" (__p2) : 
-			  : "cc", "0" );
+			  : "cc", "memory", "0" );
     __ret = (__ret == 0) ? 0 : (__ret == 1) ? -1 : 1;
     return __ret;
 }
diff --git a/sysdeps/s390/fpu/bits/mathinline.h b/sysdeps/s390/fpu/bits/mathinline.h
index 381f2e0bcb..5c6b83ad06 100644
--- a/sysdeps/s390/fpu/bits/mathinline.h
+++ b/sysdeps/s390/fpu/bits/mathinline.h
@@ -47,6 +47,21 @@ __NTH (__signbit (double __x))
   return __u.__i < 0;
 }
 
+# ifndef __NO_LONG_DOUBLE_MATH
+__MATH_INLINE int
+__NTH (__signbitl (long double __x))
+{
+  __extension__ union { long double __l; int __i[4]; } __u = { __l: __x };
+  return __u.__i[0] < 0;
+}
+# else
+__MATH_INLINE int
+__NTH (__signbitl (long double __x))
+{
+  return __signbit ((double) __x);
+}
+# endif
+
 #endif /* C99 */
 
 /* This code is used internally in the GNU libc.  */
@@ -70,6 +85,17 @@ __NTH (__ieee754_sqrtf (float x))
   return res;
 }
 
+# if !defined __NO_LONG_DOUBLE_MATH
+__MATH_INLINE long double
+__NTH (sqrtl (long double __x))
+{
+  long double res;
+
+  asm ( "sqxbr %0,%1" : "=f" (res) : "f" (__x) );
+  return res;
+}
+# endif /* !__NO_LONG_DOUBLE_MATH */
+
 #endif /* __LIBC_INTERNAL_MATH_INLINES */
 
 #endif /* __NO_MATH_INLINES */
diff --git a/sysdeps/s390/fpu/e_sqrtl.c b/sysdeps/s390/fpu/e_sqrtl.c
new file mode 100644
index 0000000000..e1daac1974
--- /dev/null
+++ b/sysdeps/s390/fpu/e_sqrtl.c
@@ -0,0 +1,30 @@
+/* Square root.  S/390 FPU version.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math_private.h>
+
+long double
+__ieee754_sqrtl (long double x)
+{
+  long double res;
+
+  asm ( "sqxbr %0,%1" : "=f" (res) : "f" (x) );
+  return res;
+}
diff --git a/sysdeps/s390/fpu/feholdexcpt.c b/sysdeps/s390/fpu/feholdexcpt.c
index 7fd7ea53ca..dee44dcee3 100644
--- a/sysdeps/s390/fpu/feholdexcpt.c
+++ b/sysdeps/s390/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
 
@@ -32,3 +32,4 @@ int feholdexcept (fenv_t *envp)
   _FPU_SETCW ((envp->fpc & ~(FE_ALL_EXCEPT << FPC_EXCEPTION_MASK_SHIFT)));
   return 0;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/s390/fpu/fesetround.c b/sysdeps/s390/fpu/fesetround.c
index 5f510fe0ad..d99f1db181 100644
--- a/sysdeps/s390/fpu/fesetround.c
+++ b/sysdeps/s390/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
 
@@ -35,3 +35,4 @@ fesetround (int round)
 
   return 0;
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/s390/fpu/libm-test-ulps b/sysdeps/s390/fpu/libm-test-ulps
index cfade822a3..989722e651 100644
--- a/sysdeps/s390/fpu/libm-test-ulps
+++ b/sysdeps/s390/fpu/libm-test-ulps
@@ -1,35 +1,48 @@
 # Begin of automatic generation
 
 # atan2
+Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
+ildouble: 1
+ldouble: 1
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
 float: 1
 ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
 float: 1
 ifloat: 1
 
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
 ifloat: 3
+ildouble: 1
+ldouble: 1
 
 # casin
 Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
@@ -37,6 +50,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
 
 # casinh
 Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
@@ -44,19 +60,27 @@ double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 2
+ldouble: 2
 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # catan
 Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
@@ -70,6 +94,9 @@ ifloat: 1
 Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
 float: 4
 ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
 
 # catanh
 Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
@@ -81,11 +108,18 @@ ifloat: 4
 Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
 Test "cbrt (-27.0) == -3.0":
 double: 1
 idouble: 1
@@ -97,9 +131,14 @@ double: 1
 idouble: 1
 
 # ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
 double: 1
 float: 1
@@ -113,9 +152,13 @@ ifloat: 1
 Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
 double: 1
 float: 1
@@ -126,12 +169,20 @@ float: 1
 ifloat: 1
 
 # cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
 
 # clog
 Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
@@ -140,57 +191,98 @@ ifloat: 3
 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 
 # cos
@@ -199,11 +291,15 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "cos (M_PI_6l * 4.0) == -0.5":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "cos (pi/2) == 0":
 double: 1
 float: 1
@@ -222,16 +318,31 @@ double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 4
+ldouble: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
 double: 2
 float: 3
 idouble: 2
 ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 3
+ldouble: 3
 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 float: 2
 ifloat: 2
@@ -240,8 +351,21 @@ double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
 
 # csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
 double: 1
 idouble: 1
@@ -256,17 +380,31 @@ ifloat: 1
 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
 
 # ctan
 Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 # ctanh
 Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
@@ -274,6 +412,11 @@ double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
 float: 1
 ifloat: 1
@@ -293,6 +436,9 @@ ifloat: 1
 Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
 double: 1
 idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
 Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
 double: 1
 idouble: 1
@@ -313,14 +459,30 @@ double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
 
 # expm1
 Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
 double: 1
 idouble: 1
 Test "expm1 (1) == M_El - 1.0":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 
 # hypot
 Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
@@ -351,89 +513,139 @@ ifloat: 1
 # j0
 Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 Test "j0 (0.75) == 0.864242275166648623555731103820923211":
 float: 1
 ifloat: 1
 Test "j0 (10.0) == -0.245935764451348335197760862485328754":
-double: 2
+double: 3
 float: 1
-idouble: 2
+idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "j0 (2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 Test "j0 (8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j1 (2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "j1 (8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
 
 # jn
 Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
 float: 1
 ifloat: 1
 Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
-double: 2
+double: 3
 float: 1
-idouble: 2
+idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
-float: 1
+float: 2
 idouble: 1
-ifloat: 1
+ifloat: 2
 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
 double: 4
 float: 3
 idouble: 4
 ifloat: 3
+ildouble: 2
+ldouble: 2
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
 float: 4
 ifloat: 4
@@ -449,9 +661,11 @@ idouble: 1
 ifloat: 1
 Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
 double: 3
-float: 1
+float: 2
 idouble: 3
-ifloat: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
 float: 2
@@ -459,16 +673,23 @@ idouble: 1
 ifloat: 2
 
 # lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # log10
 Test "log10 (0.75) == -0.124938736608299953132449886193870744":
@@ -479,23 +700,34 @@ ifloat: 2
 Test "log10 (e) == log10(e)":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # log1p
 Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
 float: 1
 ifloat: 1
 
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
+
 # sincos
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
 double: 1
 float: 1
@@ -505,17 +737,38 @@ Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646763723170752936
 float: 1
 ifloat: 1
 
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
 # tan
 Test "tan (pi/4) == 1":
 double: 1
 idouble: 1
 
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+
 # tgamma
 Test "tgamma (-0.5) == -2 sqrt (pi)":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "tgamma (0.5) == sqrt (pi)":
 float: 1
 ifloat: 1
@@ -524,6 +777,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
 
 # y0
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
@@ -541,6 +797,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "y0 (2.0) == 0.510375672649745119596606592727157873":
 double: 1
 idouble: 1
@@ -549,16 +807,23 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 # y1
 Test "y1 (0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -569,11 +834,15 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # yn
 Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
@@ -591,6 +860,8 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (0, 2.0) == 0.510375672649745119596606592727157873":
 double: 1
 idouble: 1
@@ -599,14 +870,21 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -617,34 +895,48 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 5
+ldouble: 5
 Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
 double: 2
-float: 1
+float: 2
 idouble: 2
-ifloat: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
 double: 3
 float: 1
 idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
 double: 1
 idouble: 1
@@ -653,24 +945,34 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
 double: 1
 idouble: 1
 
 # Maximal error of functions:
 Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "atanh":
 float: 1
 ifloat: 1
 
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "cacosh":
 double: 1
 float: 7
@@ -682,6 +984,8 @@ double: 1
 float: 3
 idouble: 1
 ifloat: 3
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "casin":
 double: 1
@@ -689,17 +993,25 @@ float: 1
 idouble: 1
 ifloat: 1
 
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "casinh":
 double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 
 Function: Imaginary part of "casinh":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "catan":
 float: 4
@@ -710,50 +1022,72 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "catanh":
 double: 4
 idouble: 4
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "catanh":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 Function: "cbrt":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccos":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccosh":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccosh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "clog":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "clog":
 float: 3
@@ -762,34 +1096,54 @@ ifloat: 3
 Function: Real part of "clog10":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "clog10":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 
 Function: "cos":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cpow":
 double: 2
 float: 4
 idouble: 2
 ifloat: 4
+ildouble: 10
+ldouble: 10
 
 Function: Imaginary part of "cpow":
 double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "csinh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "csinh":
 double: 1
@@ -800,24 +1154,38 @@ ifloat: 1
 Function: Real part of "csqrt":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ctan":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctan":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "ctanh":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctanh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "erf":
 double: 1
@@ -828,89 +1196,137 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "exp10":
 double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
 
 Function: "expm1":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
 
 Function: "hypot":
 float: 1
 ifloat: 1
 
 Function: "j0":
-double: 2
+double: 3
 float: 2
-idouble: 2
+idouble: 3
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 Function: "j1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 4
+ldouble: 4
 
 Function: "jn":
 double: 4
 float: 4
 idouble: 4
 ifloat: 4
+ildouble: 4
+ldouble: 4
 
 Function: "lgamma":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log10":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log1p":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
 
 Function: "sincos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
 
 Function: "tan":
 double: 1
 idouble: 1
 
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
 Function: "tgamma":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "y0":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 Function: "y1":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "yn":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 5
+ldouble: 5
 
 # end of automatic generation
diff --git a/sysdeps/s390/jmpbuf-offsets.h b/sysdeps/s390/jmpbuf-offsets.h
new file mode 100644
index 0000000000..d99fc92a27
--- /dev/null
+++ b/sysdeps/s390/jmpbuf-offsets.h
@@ -0,0 +1,29 @@
+/* Private macros for accessing __jmp_buf contents.  S/390 version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __JB_GPR6	0
+#define __JB_GPR7	1
+#define __JB_GPR8	2
+#define __JB_GPR9	3
+#define __JB_GPR10	4
+#define __JB_GPR11	5
+#define __JB_GPR12	6
+#define __JB_GPR13	7
+#define __JB_GPR14	8
+#define __JB_GPR15	9
diff --git a/sysdeps/s390/jmpbuf-unwind.h b/sysdeps/s390/jmpbuf-unwind.h
new file mode 100644
index 0000000000..c1a670fc7d
--- /dev/null
+++ b/sysdeps/s390/jmpbuf-unwind.h
@@ -0,0 +1,55 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <bits/wordsize.h>
+#include <sysdep.h>
+
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
+  ((void *) (address) < (void *) demangle ((jmpbuf)->__gregs[__JB_GPR15]))
+
+
+/* On s390{,x}, CFA is always 96 (resp. 160) bytes above actual
+   %r15.  */
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf,					\
+		       (void *) (_Unwind_GetCFA (_context)	\
+				 - 32 - 2 * __WORDSIZE), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[0].__gregs[__JB_GPR15];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/s390/ldbl2mpn.c b/sysdeps/s390/ldbl2mpn.c
deleted file mode 100644
index 1dac461aef..0000000000
--- a/sysdeps/s390/ldbl2mpn.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-#include "ieee754.h"
-#include <float.h>
-#include <stdlib.h>
-
-/* Convert a `long double' in IEEE854 standard double-precision format to a
-   multi-precision integer representing the significand scaled up by its
-   number of bits (64 for long double) and an integral power of two
-   (MPN frexpl). */
-
-mp_size_t
-__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
-			   int *expt, int *is_neg,
-			   long double value)
-{
-  union ieee854_long_double u;
-  u.d = value;
-
-  *is_neg = u.ieee.negative;
-  *expt = (int) u.ieee.exponent - IEEE854_LONG_DOUBLE_BIAS;
-
-#if BITS_PER_MP_LIMB == 32
-  res_ptr[0] = u.ieee.mantissa1; /* Low-order 32 bits of fraction.  */
-  res_ptr[1] = u.ieee.mantissa0; /* High-order 32 bits.  */
-  #define N 2
-#elif BITS_PER_MP_LIMB == 64
-  /* Hopefully the compiler will combine the two bitfield extracts
-     and this composition into just the original quadword extract.  */
-  res_ptr[0] = ((unsigned long int) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
-  #define N 1
-#else
-  #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
-#endif
-
-  if (u.ieee.exponent == 0)
-    {
-      /* A biased exponent of zero is a special case.
-	 Either it is a zero or it is a denormal number.  */
-      if (res_ptr[0] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=2.  */
-	/* It's zero.  */
-	*expt = 0;
-      else
-	{
-	  /* It is a denormal number, meaning it has no implicit leading
-	     one bit, and its exponent is in fact the format minimum.  */
-	  int cnt;
-
-	  /* One problem with Intel's 80-bit format is that the explicit
-	     leading one in the normalized representation has to be zero
-	     for denormalized number.  If it is one, the number is according
-	     to Intel's specification an invalid number.  We make the
-	     representation unique by explicitly clearing this bit.  */
-	  res_ptr[N - 1] &= ~(1L << ((LDBL_MANT_DIG - 1) % BITS_PER_MP_LIMB));
-
-	  if (res_ptr[N - 1] != 0)
-	    {
-	      count_leading_zeros (cnt, res_ptr[N - 1]);
-	      if (cnt != 0)
-		{
-#if N == 2
-		  res_ptr[N - 1] = res_ptr[N - 1] << cnt
-				   | (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt));
-		  res_ptr[0] <<= cnt;
-#else
-		  res_ptr[N - 1] <<= cnt;
-#endif
-		}
-	      *expt = LDBL_MIN_EXP - 1 - cnt;
-	    }
-	  else
-	    {
-	      count_leading_zeros (cnt, res_ptr[0]);
-	      res_ptr[N - 1] = res_ptr[0] << cnt;
-	      res_ptr[0] = 0;
-	      *expt = LDBL_MIN_EXP - 1 - BITS_PER_MP_LIMB - cnt;
-	    }
-	}
-    }
-
-  return N;
-}
diff --git a/sysdeps/s390/libc-tls.c b/sysdeps/s390/libc-tls.c
index 7362dbf8f8..f177f436e9 100644
--- a/sysdeps/s390/libc-tls.c
+++ b/sysdeps/s390/libc-tls.c
@@ -1,5 +1,5 @@
 /* Thread-local storage handling in the ELF dynamic linker.  S390 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2005 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
@@ -18,7 +18,7 @@
    02111-1307 USA.  */
 
 #include <stdlib.h>
-#include <sysdeps/generic/libc-tls.c>
+#include <csu/libc-tls.c>
 
 #if USE_TLS
 
diff --git a/sysdeps/s390/s390-32/Dist b/sysdeps/s390/s390-32/Dist
deleted file mode 100644
index 1cd482830a..0000000000
--- a/sysdeps/s390/s390-32/Dist
+++ /dev/null
@@ -1 +0,0 @@
-s390-mcount.S
diff --git a/sysdeps/s390/s390-32/__longjmp.c b/sysdeps/s390/s390-32/__longjmp.c
index c1b977cd49..c47ebbc52a 100644
--- a/sysdeps/s390/s390-32/__longjmp.c
+++ b/sysdeps/s390/s390-32/__longjmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
@@ -29,14 +29,32 @@
 void
 __longjmp (__jmp_buf env, int val)
 {
-   /* Restore registers and jump back.  */
-   asm volatile ("lr   %%r2,%0\n\t"	  /* PUT val in grp 2.  */
-		 "ld   %%f6,48(%1)\n\t"
-		 "ld   %%f4,40(%1)\n\t"
-		 "lm   %%r6,%%r15,0(%1)\n\t"
-		 "br   %%r14"
-		 : : "r" (val == 0 ? 1 : val),
-		 "a" (env) : "2" );
+  register int r2 __asm ("%r2") = val == 0 ? 1 : val;
+#ifdef PTR_DEMANGLE
+  register uintptr_t r3 __asm ("%r3") = THREAD_GET_POINTER_GUARD ();
+  register void *r1 __asm ("%r1") = (void *) env;
+#endif
+  /* Restore registers and jump back.  */
+  asm volatile ("ld   %%f6,48(%1)\n\t"
+		"ld   %%f4,40(%1)\n\t"
+#ifdef PTR_DEMANGLE
+		"lm   %%r6,%%r13,0(%1)\n\t"
+		"lm   %%r4,%%r5,32(%1)\n\t"
+		"xr   %%r4,%2\n\t"
+		"xr   %%r5,%2\n\t"
+		"lr   %%r15,%%r5\n\t"
+		"br   %%r4"
+#else
+		"lm   %%r6,%%r15,0(%1)\n\t"
+		"br   %%r14"
+#endif
+		: : "r" (r2),
+#ifdef PTR_DEMANGLE
+		    "r" (r1), "r" (r3)
+#else
+		    "a" (env)
+#endif
+		);
 
   /* Avoid `volatile function does return' warnings.  */
   for (;;);
diff --git a/sysdeps/s390/s390-32/backtrace.c b/sysdeps/s390/s390-32/backtrace.c
index 7a632572b5..6adc3bc3d1 100644
--- a/sysdeps/s390/s390-32/backtrace.c
+++ b/sysdeps/s390/s390-32/backtrace.c
@@ -1,6 +1,6 @@
 /* Return backtrace of current program state.
-   Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+   Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -142,3 +142,4 @@ __backtrace (void **array, int size)
 }
 
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/s390/s390-32/bits/wordsize.h b/sysdeps/s390/s390-32/bits/wordsize.h
index 4f50d8586c..b41661217f 100644
--- a/sysdeps/s390/s390-32/bits/wordsize.h
+++ b/sysdeps/s390/s390-32/bits/wordsize.h
@@ -5,3 +5,14 @@
 #else
 # define __WORDSIZE	32
 #endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+/* Signal that we didn't used to have a `long double'. The changes all
+   the `long double' function variants to be redirects to the double
+   functions.  */
+# define __LONG_DOUBLE_MATH_OPTIONAL   1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH        1
+# endif
+#endif
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 52922a813b..8bbf858fbf 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -1,5 +1,6 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  S390 Version.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
    Contributed by Carl Pederson & Martin Schwidefsky.
    This file is part of the GNU C Library.
 
@@ -21,7 +22,6 @@
 #ifndef dl_machine_h
 #define dl_machine_h
 
-
 #define ELF_MACHINE_NAME "s390"
 
 #include <sys/param.h>
@@ -112,7 +112,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	{
 	  got[2] = (Elf32_Addr) &_dl_runtime_profile;
 
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    /* This is the object we are looking for.  Say that we really
 	       want profiling and the timers are started.  */
 	    GL(dl_profile_map) = l;
@@ -126,124 +127,6 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-
-/* s390:
-   Arguments are in register.
-   r2 - r7 holds the original parameters for the function call, fixup
-   and trampoline code use r0-r5 and r14-15. For the correct function
-   call r2-r5 and r14-15 must be restored.
-   Arguments from the PLT are stored at 24(r15) and 28(r15)
-   and must be moved to r2 and r3 for the fixup call (see elf32-s390.c
-   in the binutils for the PLT code).
-   Fixup function address in r2.
-*/
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-  asm ( "\
-    .text\n\
-    .globl _dl_runtime_resolve\n\
-    .type _dl_runtime_resolve, @function\n\
-    .align 16\n\
-    " CFI_STARTPROC "\n\
-_dl_runtime_resolve:\n\
-    # save registers\n\
-    stm    2,5,32(15)\n\
-    st     14,48(15)\n\
-    lr     0,15\n\
-    ahi    15,-96\n\
-    " CFI_ADJUST_CFA_OFFSET(96)"\n\
-    st     0,0(15)\n\
-    # load args saved by PLT\n\
-    lm     2,3,120(15)\n\
-    basr   1,0\n\
-0:  ahi    1,1f-0b\n\
-    l      14,0(1)\n\
-    bas    14,0(14,1)   # call fixup\n\
-    lr     1,2          # function addr returned in r2\n\
-    # restore registers\n\
-    ahi    15,96\n\
-    " CFI_ADJUST_CFA_OFFSET(-96)" \n\
-    l      14,48(15)\n\
-    lm     2,5,32(15)\n\
-    br     1\n\
-1:  .long  fixup-1b\n\
-    " CFI_ENDPROC "\n\
-    .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-\n\
-    .globl _dl_runtime_profile\n\
-    .type _dl_runtime_profile, @function\n\
-    .align 16\n\
-    " CFI_STARTPROC "\n\
-_dl_runtime_profile:\n\
-    # save registers\n\
-    stm    2,5,32(15)\n\
-    st     14,48(15)\n\
-    lr     0,15\n\
-    ahi    15,-96\n\
-    " CFI_ADJUST_CFA_OFFSET(96)"\n\
-    st     0,0(15)\n\
-    # load args saved by PLT\n\
-    lm     2,3,120(15)\n\
-    # load return address as third parameter\n\
-    lr     4,14\n\
-    basr   1,0\n\
-0:  ahi    1,1f-0b\n\
-    l      14,0(1)\n\
-    bas    14,0(14,1)   # call fixup\n\
-    lr     1,2          # function addr returned in r2\n\
-    # restore registers\n\
-    ahi    15,96\n\
-    " CFI_ADJUST_CFA_OFFSET(-96)" \n\
-    l      14,48(15)\n\
-    lm     2,5,32(15)\n\
-    br     1\n\
-1:  .long  profile_fixup-1b\n\
-    " CFI_ENDPROC "\n\
-    .size _dl_runtime_profile, .-_dl_runtime_profile\n\
-");
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-  asm ( "\
-    .text\n\
-    .globl _dl_runtime_resolve\n\
-    .globl _dl_runtime_profile\n\
-    .type _dl_runtime_resolve, @function\n\
-    .type _dl_runtime_profile, @function\n\
-    .align 16\n\
-    " CFI_STARTPROC "\n\
-_dl_runtime_resolve:\n\
-_dl_runtime_profile:\n\
-    # save registers\n\
-    stm    2,5,32(15)\n\
-    st     14,48(15)\n\
-    lr     0,15\n\
-    ahi    15,-96\n\
-    " CFI_ADJUST_CFA_OFFSET(96)"\n\
-    st     0,0(15)\n\
-    # load args saved by PLT\n\
-    lm     2,3,120(15)\n\
-    # load return address as third parameter\n\
-    lr     4,14\n\
-    basr   1,0\n\
-0:  ahi    1,1f-0b\n\
-    l      14,0(1)\n\
-    bas    14,0(14,1)   # call fixup\n\
-    lr     1,2          # function addr returned in r2\n\
-    # restore registers\n\
-    ahi    15,96\n\
-    " CFI_ADJUST_CFA_OFFSET(-96)" \n\
-    l      14,48(15)\n\
-    lm     2,5,32(15)\n\
-    br     1\n\
-1:  .long  fixup-1b\n\
-    " CFI_ENDPROC "\n\
-    .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-    .size _dl_runtime_profile, .-_dl_runtime_profile\n\
-");
-#endif
-
 /* Mask identifying addresses reserved for the user program,
    where the dynamic linker should not map anything.  */
 #define ELF_MACHINE_USER_ADDRESS_MASK   0xf8000000UL
@@ -375,15 +258,20 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
   return value;
 }
 
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER s390_32_gnu_pltenter
+#define ARCH_LA_PLTEXIT s390_32_gnu_pltexit
+
 #endif /* !dl_machine_h */
 
 
-#ifdef RESOLVE
+#ifdef RESOLVE_MAP
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 		  const Elf32_Sym *sym, const struct r_found_version *version,
 		  void *const reloc_addr_arg)
@@ -417,17 +305,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 #ifndef RESOLVE_CONFLICT_FIND_MAP
       const Elf32_Sym *const refsym = sym;
 #endif
-#if defined USE_TLS && !defined RTLD_BOOTSTRAP
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
       Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-#else
-      Elf32_Addr value = RESOLVE (&sym, version, r_type);
-
-# ifndef RTLD_BOOTSTRAP
-      if (sym)
-# endif
-	value += sym->st_value;
-#endif /* use TLS and !RTLD_BOOTSTRAP */
 
       switch (r_type)
 	{
@@ -539,7 +418,8 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
     }
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
 			   void *const reloc_addr_arg)
 {
@@ -547,7 +427,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
   *reloc_addr = l_addr + reloc->r_addend;
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf32_Addr l_addr, const Elf32_Rela *reloc)
 {
@@ -567,4 +448,4 @@ elf_machine_lazy_rel (struct link_map *map,
     _dl_reloc_bad_type (map, r_type, 1);
 }
 
-#endif /* RESOLVE */
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/s390/s390-32/dl-trampoline.S b/sysdeps/s390/s390-32/dl-trampoline.S
new file mode 100644
index 0000000000..fbbbc189db
--- /dev/null
+++ b/sysdeps/s390/s390-32/dl-trampoline.S
@@ -0,0 +1,134 @@
+/* PLT trampolines.  s390 version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This code is used in dl-runtime.c to call the `fixup' function
+   and then redirect to the address it returns.  */
+
+/* The PLT stubs will call _dl_runtime_resolve/_dl_runtime_profile
+ * with the following linkage:
+ *   r2 - r6 : parameter registers
+ *   f0, f2 : floating point parameter registers
+ *   24(r15), 28(r15) : PLT arguments PLT1, PLT2
+ *   96(r15) : additional stack parameters
+ * The normal clobber rules for function calls apply:
+ *   r0 - r5 : call clobbered
+ *   r6 - r13 :	 call saved
+ *   r14 : return address (call clobbered)
+ *   r15 : stack pointer (call saved)
+ *   f4, f6 : call saved
+ *   f0 - f3, f5, f7 - f15 : call clobbered
+ */
+
+#include <sysdep.h>
+
+	.text
+	.globl _dl_runtime_resolve
+	.type _dl_runtime_resolve, @function
+	cfi_startproc
+	.align 16
+_dl_runtime_resolve:
+	stm    %r2,%r5,32(%r15)		# save registers
+	st     %r14,8(%r15)
+	lr     %r0,%r15			# create stack frame
+	ahi    %r15,-96
+	cfi_adjust_cfa_offset (96)
+	st     0,0(%r15)
+	lm     %r2,%r3,120(%r15)	# load args saved by PLT
+	basr   %r1,0
+0:	l      %r14,1f-0b(%r1)
+	bas    %r14,0(%r14,%r1)		# call resolver
+	lr     %r1,%r2			# function addr returned in r2
+	ahi    %r15,96			# remove stack frame
+	cfi_adjust_cfa_offset (-96)
+	l      %r14,8(15)		# restore registers
+	lm     %r2,%r5,32(%r15)
+	br     %r1
+1:	.long  _dl_fixup - 0b
+	cfi_endproc
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve
+
+
+#ifndef PROF
+	.globl _dl_runtime_profile
+	.type _dl_runtime_profile, @function
+	cfi_startproc
+	.align 16
+_dl_runtime_profile:
+	stm    %r2,%r6,32(%r15)		# save registers
+	std    %f0,56(%r15)
+	std    %f2,64(%r15)
+	st     %r6,8(%r15)
+	st     %r12,12(%r15)
+	st     %r14,16(%r15)
+	lr     %r12,%r15		# create stack frame
+	cfi_def_cfa_register (12)
+	ahi    %r15,-96
+	st     %r12,0(%r15)
+	lm     %r2,%r3,24(%r12)		# load arguments saved by PLT
+	lr     %r4,%r14			# return address as third parameter
+	basr   %r1,0
+0:	l      %r14,6f-0b(%r1)
+	la     %r5,32(%r12)		# pointer to struct La_s390_32_regs
+	la     %r6,20(%r12)		# long int * framesize
+	bas    %r14,0(%r14,%r1)		# call resolver
+	lr     %r1,%r2			# function addr returned in r2
+	icm    %r0,15,20(%r12)		# load & test framesize
+	jnm    2f
+	lm     %r2,%r6,32(%r12)
+	ld     %f0,56(%r12)
+	ld     %f2,64(%r12)
+	basr   %r14,%r1			# call resolved function
+1:	lr     %r15,%r12		# remove stack frame
+	cfi_def_cfa_register (15)
+	l      %r14,16(%r15)		# restore registers
+	l      %r12,12(%r15)
+	l      %r6,8(%r15)
+	br     %r14
+	cfi_def_cfa_register (12)
+2:	jz     4f			# framesize == 0 ?
+	ahi    %r0,7			# align framesize to 8
+	lhi    %r2,-8
+	nr     %r0,%r2
+	slr    %r15,%r0			# make room for framesize bytes
+	st     %r12,0(%r15)
+	la     %r2,96(%r15)
+	la     %r3,96(%r12)
+	srl    %r0,3
+3:	mvc    0(8,%r2),0(%r3)		# copy additional parameters
+	la     %r2,8(%r2)
+	la     %r3,8(%r3)
+	brct   %r0,3b
+4:	lm     %r2,%r6,32(%r12)		# load register parameters
+	ld     %f0,56(%r12)
+	ld     %f2,64(%r12)
+	basr   %r14,%r1			# call resolved function
+	stm    %r2,%r3,72(%r12)
+	std    %f0,80(%r12)
+	lm     %r2,%r3,24(%r12)		# load arguments saved by PLT
+	basr   %r1,0
+5:	l      %r14,7f-5b(%r1)
+	la     %r4,32(%r12)		# pointer to struct La_s390_32_regs
+	la     %r5,72(%r12)		# pointer to struct La_s390_32_retval
+	basr   %r14,%r1			# call _dl_call_pltexit
+	j      1b
+6:	.long  _dl_profile_fixup - 0b
+7:	.long  _dl_call_pltexit - 5b
+	cfi_endproc
+	.size _dl_runtime_profile, .-_dl_runtime_profile
+#endif
diff --git a/sysdeps/s390/s390-32/elf/setjmp.S b/sysdeps/s390/s390-32/elf/setjmp.S
index 0d1fa8e41d..ed28008a56 100644
--- a/sysdeps/s390/s390-32/elf/setjmp.S
+++ b/sysdeps/s390/s390-32/elf/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for s390, ELF version.
-   Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -46,10 +46,23 @@ END (__setjmp)
 
 ENTRY(__sigsetjmp)
 .Linternal_sigsetjmp:
+#ifdef PTR_MANGLE
+	stm    %r6,%r13,0(%r2)      /* store registers in jmp_buf */
+	lr     %r4,%r14
+	lr     %r5,%r15
+	PTR_MANGLE (%r4, %r1)
+	PTR_MANGLE2 (%r5, %r1)
+	stm    %r4,%r5,32(%r2)
+#else
 	stm    %r6,%r15,0(%r2)      /* store registers in jmp_buf */
+#endif
 	std    %f4,40(%r2)
 	std    %f6,48(%r2)
-#ifdef PIC
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	lhi    %r2,0
+	br     %r14
+#elif defined PIC
 	/* We cannot use the PLT, because it requires that %r12 be set, but
 	   we can't save and restore our caller's value.  Instead, we do an
 	   indirect jump through the GOT. */
diff --git a/sysdeps/s390/s390-32/elf/start.S b/sysdeps/s390/s390-32/elf/start.S
index a09acb5d89..f7290106ce 100644
--- a/sysdeps/s390/s390-32/elf/start.S
+++ b/sysdeps/s390/s390-32/elf/start.S
@@ -1,5 +1,6 @@
 /* Startup code compliant to the ELF s390 ABI.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -88,9 +89,9 @@ _start:
 	l       %r12,.L5-.Llit(%r13)    # load .got pointer
 	la	%r6,0(%r13,%r6)
 	la	%r5,0(%r13,%r5)
-	la	%r2,0(%r13,%r2)
-	la	%r1,0(%r13,%r1)
 	la	%r12,0(%r13,%r12)
+	l	%r2,0(%r12,%r2)
+	la	%r1,0(%r13,%r1)
 #endif
 
 	/* ok, now branch to the libc main routine */
@@ -108,7 +109,7 @@ _start:
 #else
 .L1:    .long  __libc_csu_init-.Llit
 .L2:    .long  __libc_csu_fini-.Llit
-.L3:    .long  main-.Llit
+.L3:    .long  main@GOT
 .L4:    .long  __libc_start_main@plt-.Llit
 .L5:    .long  _GLOBAL_OFFSET_TABLE_-.Llit
 #endif
diff --git a/sysdeps/s390/s390-32/s390-mcount.S b/sysdeps/s390/s390-32/s390-mcount.S
index 8ecdd0edae..6d11f9bbdb 100644
--- a/sysdeps/s390/s390-32/s390-mcount.S
+++ b/sysdeps/s390/s390-32/s390-mcount.S
@@ -81,4 +81,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/s390/s390-32/setjmp.S b/sysdeps/s390/s390-32/setjmp.S
index dc4862b2a6..b943085e93 100644
--- a/sysdeps/s390/s390-32/setjmp.S
+++ b/sysdeps/s390/s390-32/setjmp.S
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -29,10 +29,23 @@
 /* R2 = pointer to jmp_buf, R3 = savemask */
 
 ENTRY(__sigsetjmp)
+#ifdef PTR_MANGLE
+	stm    %r6,%r13,0(%r2)      /* store registers in jmp_buf */
+	lr     %r4,%r14
+	lr     %r5,%r15
+	PTR_MANGLE (%r4, %r1)
+	PTR_MANGLE2 (%r5, %r1)
+	stm    %r4,%r5,32(%r2)
+#else
 	stm    %r6,%r15,0(%r2)      /* store registers in jmp_buf */
+#endif
 	std    %f4,40(%r2)
 	std    %f6,48(%r2)
-#ifdef PIC
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	lhi    %r2,0
+	br     %r14
+#elif defined PIC
 	/* We cannot use the PLT, because it requires that %r12 be set, but
 	   we can't save and restore our caller's value.  Instead, we do an
 	   indirect jump through the GOT. */
diff --git a/sysdeps/s390/s390-64/Dist b/sysdeps/s390/s390-64/Dist
deleted file mode 100644
index dbf7aa9661..0000000000
--- a/sysdeps/s390/s390-64/Dist
+++ /dev/null
@@ -1 +0,0 @@
-s390x-mcount.S
diff --git a/sysdeps/s390/s390-64/__longjmp.c b/sysdeps/s390/s390-64/__longjmp.c
index 80abd3849a..030fb5b515 100644
--- a/sysdeps/s390/s390-64/__longjmp.c
+++ b/sysdeps/s390/s390-64/__longjmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
@@ -29,18 +29,35 @@
 void
 __longjmp (__jmp_buf env, int val)
 {
-   /* Restore registers and jump back.  */
-   asm volatile ("lgr  %%r2,%0\n\t"        /* Put val in grp 2.  */
-		 "ld   %%f7,104(%1)\n\t"
-		 "ld   %%f5,96(%1)\n\t"
-		 "ld   %%f3,88(%1)\n\t"
-		 "ld   %%f1,80(%1)\n\t"
-                 "lmg  %%r6,%%r15,0(%1)\n\t"
-                 "br   %%r14"
-                 : : "r" (val == 0 ? 1 : val),
-                 "a" (env) : "2" );
+  register long int r2 __asm ("%r2") = val == 0 ? 1 : val;
+#ifdef PTR_DEMANGLE
+  register uintptr_t r3 __asm ("%r3") = THREAD_GET_POINTER_GUARD ();
+  register void *r1 __asm ("%r1") = (void *) env;
+#endif
+  /* Restore registers and jump back.  */
+  asm volatile ("ld   %%f7,104(%1)\n\t"
+		"ld   %%f5,96(%1)\n\t"
+		"ld   %%f3,88(%1)\n\t"
+		"ld   %%f1,80(%1)\n\t"
+#ifdef PTR_DEMANGLE
+		"lmg  %%r6,%%r13,0(%1)\n\t"
+		"lmg  %%r4,%%r5,64(%1)\n\t"
+		"xgr  %%r4,%2\n\t"
+		"xgr  %%r5,%2\n\t"
+		"lgr  %%r15,%%r5\n\t"
+		"br   %%r4"
+#else
+		"lmg  %%r6,%%r15,0(%1)\n\t"
+		"br   %%r14"
+#endif
+		: : "r" (r2),
+#ifdef PTR_DEMANGLE
+		    "r" (r1), "r" (r3)
+#else
+		    "a" (env)
+#endif
+		);
 
   /* Avoid `volatile function does return' warnings.  */
   for (;;);
 }
-
diff --git a/sysdeps/s390/s390-64/backtrace.c b/sysdeps/s390/s390-64/backtrace.c
index 05321349ca..7ba195cb7a 100644
--- a/sysdeps/s390/s390-64/backtrace.c
+++ b/sysdeps/s390/s390-64/backtrace.c
@@ -1,6 +1,6 @@
 /* Return backtrace of current program state.  64 bit S/390 version.
-   Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
-   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+   Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -141,3 +141,4 @@ __backtrace (void **array, int size)
 }
 
 weak_alias (__backtrace, backtrace)
+libc_hidden_def (__backtrace)
diff --git a/sysdeps/s390/s390-64/bcopy.S b/sysdeps/s390/s390-64/bcopy.S
index ff7966723b..abcb1fb1b4 100644
--- a/sysdeps/s390/s390-64/bcopy.S
+++ b/sysdeps/s390/s390-64/bcopy.S
@@ -1,6 +1,6 @@
 /* bcopy -- copy a block from source to destination.  64 bit S/390 version.
    This file is part of the GNU C Library.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -59,14 +59,10 @@ ENTRY(__bcopy)
 	jo	.L6
 	br	%r14
 .L7:				    # destructive overlay, can not use mvcle
-	lgr    %r1,%r2		    # bcopy is called with source,dest
-	lgr    %r2,%r3		    # memmove with dest,source! Oh, well...
-	lgr    %r3,%r1
-#ifdef PIC
-	jg     memmove@PLT
-#else
-	jg     memmove
-#endif
+	lgr	%r1,%r2		    # bcopy is called with source,dest
+	lgr	%r2,%r3		    # memmove with dest,source! Oh, well...
+	lgr	%r3,%r1
+	jg	HIDDEN_BUILTIN_JUMPTARGET(memmove)
 
 END(__bcopy)
 
diff --git a/sysdeps/s390/s390-64/bits/wordsize.h b/sysdeps/s390/s390-64/bits/wordsize.h
index 4f50d8586c..b41661217f 100644
--- a/sysdeps/s390/s390-64/bits/wordsize.h
+++ b/sysdeps/s390/s390-64/bits/wordsize.h
@@ -5,3 +5,14 @@
 #else
 # define __WORDSIZE	32
 #endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+/* Signal that we didn't used to have a `long double'. The changes all
+   the `long double' function variants to be redirects to the double
+   functions.  */
+# define __LONG_DOUBLE_MATH_OPTIONAL   1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH        1
+# endif
+#endif
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index 82ece0be0f..5026a2edad 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent ELF dynamic relocation inline functions.
    64 bit S/390 Version.
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -105,7 +105,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	{
 	  got[2] = (Elf64_Addr) &_dl_runtime_profile;
 
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    /* This is the object we are looking for.  Say that we really
 	       want profiling and the timers are started.  */
 	    GL(dl_profile_map) = l;
@@ -119,112 +120,6 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.	 */
-
-/* s390:
-   Arguments are in register.
-   r2 - r7 holds the original parameters for the function call, fixup
-   and trampoline code use r0-r5 and r14-15. For the correct function
-   call r2-r5 and r14-15 must be restored.
-   Arguments from the PLT are stored at 48(r15) and 56(r15)
-   and must be moved to r2 and r3 for the fixup call (see elf32-s390.c
-   in the binutils for the PLT code).
-   Fixup function address in r2.
-*/
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-  asm ( "\
-    .text\n\
-    .globl _dl_runtime_resolve\n\
-    .type _dl_runtime_resolve, @function\n\
-    .align 16\n\
-    " CFI_STARTPROC "\n\
-_dl_runtime_resolve:\n\
-    # save registers\n\
-    stmg   2,5,64(15)\n\
-    stg	   14,96(15)\n\
-    lgr	   0,15\n\
-    aghi   15,-160\n\
-    " CFI_ADJUST_CFA_OFFSET(160)"\n\
-    stg	   0,0(15)\n\
-    # load args saved by PLT\n\
-    lmg	   2,3,208(15)\n\
-    brasl  14,fixup	# call fixup\n\
-    lgr	   1,2		# function addr returned in r2\n\
-    # restore registers\n\
-    aghi   15,160\n\
-    " CFI_ADJUST_CFA_OFFSET(-160)" \n\
-    lg	   14,96(15)\n\
-    lmg	   2,5,64(15)\n\
-    br	   1\n\
-    " CFI_ENDPROC "\n\
-    .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-\n\
-    .globl _dl_runtime_profile\n\
-    .type _dl_runtime_profile, @function\n\
-    .align 16\n\
-    " CFI_STARTPROC "\n\
-_dl_runtime_profile:\n\
-    # save registers\n\
-    stmg   2,5,64(15)\n\
-    stg	   14,96(15)\n\
-    lgr	   0,15\n\
-    aghi   15,-160\n\
-    " CFI_ADJUST_CFA_OFFSET(160)"\n\
-    stg	   0,0(15)\n\
-    # load args saved by PLT\n\
-    lmg	   2,3,208(15)\n\
-    # load return address as third parameter\n\
-    lgr	   4,14\n\
-    brasl  14,profile_fixup  # call fixup\n\
-    lgr	   1,2		# function addr returned in r2\n\
-    # restore registers\n\
-    aghi   15,160\n\
-    " CFI_ADJUST_CFA_OFFSET(-160)" \n\
-    lg	   14,96(15)\n\
-    lmg	   2,5,64(15)\n\
-    br	   1\n\
-    " CFI_ENDPROC "\n\
-    .size _dl_runtime_profile, .-_dl_runtime_profile\n\
-");
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-  asm ( "\
-    .text\n\
-    .globl _dl_runtime_resolve\n\
-    .globl _dl_runtime_profile\n\
-    .type _dl_runtime_resolve, @function\n\
-    .type _dl_runtime_profile, @function\n\
-    .align 16\n\
-    " CFI_STARTPROC "\n\
-_dl_runtime_resolve:\n\
-_dl_runtime_profile:\n\
-    # save registers\n\
-    stmg   2,5,64(15)\n\
-    stg	   14,96(15)\n\
-    lgr	   0,15\n\
-    aghi   15,-160\n\
-    " CFI_ADJUST_CFA_OFFSET(160)"\n\
-    stg	   0,0(15)\n\
-    # load args saved by PLT\n\
-    lmg	   2,3,208(15)\n\
-    # load return address as third parameter\n\
-    lgr	   4,14\n\
-    brasl  14,profile_fixup	 # call fixup\n\
-    lgr	   1,2		# function addr returned in r2\n\
-    # restore registers\n\
-    aghi   15,160\n\
-    " CFI_ADJUST_CFA_OFFSET(-160)" \n\
-    lg	   14,96(15)\n\
-    lmg	   2,5,64(15)\n\
-    br	   1\n\
-    " CFI_ENDPROC "\n\
-    .size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-    .size _dl_runtime_profile, .-_dl_runtime_profile\n\
-");
-#endif
-
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.	*/
@@ -343,14 +238,19 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
   return value;
 }
 
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER s390_64_gnu_pltenter
+#define ARCH_LA_PLTEXIT s390_64_gnu_pltexit
+
 #endif /* !dl_machine_h */
 
-#ifdef RESOLVE
+#ifdef RESOLVE_MAP
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 		  const Elf64_Sym *sym, const struct r_found_version *version,
 		  void *const reloc_addr_arg)
@@ -384,17 +284,8 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 #ifndef RESOLVE_CONFLICT_FIND_MAP
       const Elf64_Sym *const refsym = sym;
 #endif
-#if defined USE_TLS && !defined RTLD_BOOTSTRAP
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
       Elf64_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-#else
-      Elf64_Addr value = RESOLVE (&sym, version, r_type);
-
-# ifndef RTLD_BOOTSTRAP
-      if (sym)
-# endif
-	value += sym->st_value;
-#endif /* use TLS and !RTLD_BOOTSTRAP */
 
       switch (r_type)
 	{
@@ -518,7 +409,8 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
     }
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
 			   void *const reloc_addr_arg)
 {
@@ -526,7 +418,8 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
   *reloc_addr = l_addr + reloc->r_addend;
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf64_Addr l_addr, const Elf64_Rela *reloc)
 {
@@ -546,4 +439,4 @@ elf_machine_lazy_rel (struct link_map *map,
     _dl_reloc_bad_type (map, r_type, 1);
 }
 
-#endif /* RESOLVE */
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/s390/s390-64/dl-trampoline.S b/sysdeps/s390/s390-64/dl-trampoline.S
new file mode 100644
index 0000000000..8093582163
--- /dev/null
+++ b/sysdeps/s390/s390-64/dl-trampoline.S
@@ -0,0 +1,128 @@
+/* PLT trampolines.  s390 version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* The PLT stubs will call _dl_runtime_resolve/_dl_runtime_profile
+ * with the following linkage:
+ *   r2 - r6 : parameter registers
+ *   f0, f2, f4, f6 : floating point parameter registers
+ *   24(r15), 28(r15) : PLT arguments PLT1, PLT2
+ *   96(r15) : additional stack parameters
+ * The normal clobber rules for function calls apply:
+ *   r0 - r5 : call clobbered
+ *   r6 - r13 :	 call saved
+ *   r14 : return address (call clobbered)
+ *   r15 : stack pointer (call saved)
+ *   f1, f3, f5, f7 : call saved
+ *   f0 - f3, f5, f7 - f15 : call clobbered
+ */
+
+#include <sysdep.h>
+
+	.text
+	.globl _dl_runtime_resolve
+	.type _dl_runtime_resolve, @function
+	cfi_startproc
+	.align 16
+_dl_runtime_resolve:
+	stmg   2,5,64(15)	# save registers
+	stg    14,96(15)
+	lgr    0,15		# create stack frame
+	aghi   15,-160
+	cfi_adjust_cfa_offset (160)
+	stg    0,0(15)
+	lmg    2,3,208(15)	# load args saved by PLT
+	brasl  14,_dl_fixup	# call fixup
+	lgr    1,2		# function addr returned in r2
+	aghi   15,160		# remove stack frame
+	cfi_adjust_cfa_offset (-160)
+	lg     14,96(15)	# restore registers
+	lmg    2,5,64(15)
+	br     1
+	cfi_endproc
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve
+
+
+#ifndef PROF
+	.globl _dl_runtime_profile
+	.type _dl_runtime_profile, @function
+	cfi_startproc
+	.align 16
+_dl_runtime_profile:
+	stmg   %r2,%r6,64(%r15)		# save registers
+	std    %f0,104(%r15)
+	std    %f2,112(%r15)
+	std    %f4,120(%r15)
+	std    %f6,128(%r15)
+	stg    %r6,16(%r15)
+	stg    %r12,24(%r15)
+	stg    %r14,32(%r15)
+	lgr    %r12,%r15		# create stack frame
+	cfi_def_cfa_register (12)
+	aghi   %r15,-160
+	stg    %r12,0(%r15)
+	lmg    %r2,%r3,48(%r12)		# load arguments saved by PLT
+	lgr    %r4,%r14			# return address as third parameter
+	la     %r5,64(%r12)		# pointer to struct La_s390_32_regs
+	la     %r6,40(%r12)		# long int * framesize
+	brasl  %r14,_dl_profile_fixup	# call resolver
+	lgr    %r1,%r2			# function addr returned in r2
+	lg     %r0,40(%r12)		# load framesize
+	ltgr   %r0,%r0
+	jnm    1f
+	lmg    %r2,%r6,64(%r12)
+	ld     %f0,104(%r12)
+	ld     %f2,112(%r12)
+	ld     %f4,120(%r12)
+	ld     %f6,128(%r12)
+	basr   %r14,%r1			# call resolved function
+0:	lr     %r15,%r12		# remove stack frame
+	cfi_def_cfa_register (15)
+	lg     %r14,32(%r15)		# restore registers
+	lg     %r12,24(%r15)
+	lg     %r6,16(%r15)
+	br     %r14
+	cfi_def_cfa_register (12)
+1:	jz     4f			# framesize == 0 ?
+	aghi   %r0,7			# align framesize to 8
+	nill   %r0,0xfff8
+	slgr   %r15,%r0			# make room for framesize bytes
+	stg    %r12,0(%r15)
+	la     %r2,160(%r15)
+	la     %r3,160(%r12)
+	srlg   %r0,%r0,3
+3:	mvc    0(8,%r2),0(%r3)		# copy additional parameters
+	la     %r2,8(%r2)
+	la     %r3,8(%r3)
+	brctg  %r0,3b
+4:	lmg    %r2,%r6,64(%r12)		# load register parameters
+	ld     %f0,104(%r12)
+	ld     %f2,112(%r12)
+	ld     %f4,120(%r12)
+	ld     %f6,128(%r12)
+	basr   %r14,%r1			# call resolved function
+	stg    %r2,136(%r12)
+	std    %f0,144(%r12)
+	lmg    %r2,%r3,48(%r12)		# load arguments saved by PLT
+	la     %r4,32(%r12)		# pointer to struct La_s390_32_regs
+	la     %r5,72(%r12)		# pointer to struct La_s390_32_retval
+	brasl  %r14,_dl_call_pltexit
+	j      0b
+	cfi_endproc
+	.size _dl_runtime_profile, .-_dl_runtime_profile
+#endif
diff --git a/sysdeps/s390/s390-64/elf/setjmp.S b/sysdeps/s390/s390-64/elf/setjmp.S
index fa3ac72480..28b6a5a35b 100644
--- a/sysdeps/s390/s390-64/elf/setjmp.S
+++ b/sysdeps/s390/s390-64/elf/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for 64 bit S/390, ELF version.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -46,12 +46,25 @@ END (setjmp)
 
 ENTRY(__sigsetjmp)
 .Linternal_sigsetjmp:
+#ifdef PTR_MANGLE
+	stmg   %r6,%r13,0(%r2)      /* Store registers in jmp_buf.  */
+	lgr    %r4,%r14
+	lgr    %r5,%r15
+	PTR_MANGLE (%r4, %r1)
+	PTR_MANGLE2 (%r5, %r1)
+	stmg   %r4,%r5,64(%r2)
+#else
         stmg   %r6,%r15,0(%r2)      /* Store registers in jmp_buf.  */
+#endif
 	std    %f1,80(%r2)
 	std    %f3,88(%r2)
 	std    %f5,96(%r2)
 	std    %f7,104(%r2)
-#ifdef PIC
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	lghi   %r2,0
+	br     %r14
+#elif defined PIC
         jg     __sigjmp_save@PLT    /* Branch to PLT of __sigsetjmp.  */
 #else
 	jg     __sigjmp_save
diff --git a/sysdeps/s390/s390-64/elf/start.S b/sysdeps/s390/s390-64/elf/start.S
index e5013d0057..c4cb34d02c 100644
--- a/sysdeps/s390/s390-64/elf/start.S
+++ b/sysdeps/s390/s390-64/elf/start.S
@@ -1,5 +1,5 @@
 /* Startup code compliant to the 64 bit S/390 ELF ABI.
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -78,12 +78,14 @@ _start:
 	la	%r7,160(%r15)
 	larl	%r6,__libc_csu_fini	# load pointer to __libc_csu_fini
 	larl	%r5,__libc_csu_init	# load pointer to __libc_csu_init
-	larl	%r2,main		# load pointer to main
 
 	/* Ok, now branch to the libc main routine.  */
 #ifdef PIC
+	larl	%r2,main@GOTENT		# load pointer to main
+	lg	%r2,0(%r2)
 	brasl	%r14,__libc_start_main@plt
 #else
+	larl	%r2,main		# load pointer to main
 	brasl	%r14,__libc_start_main
 #endif
 
diff --git a/sysdeps/s390/s390-64/s390x-mcount.S b/sysdeps/s390/s390-64/s390x-mcount.S
index 5e3890b4f6..0fa614cbf4 100644
--- a/sysdeps/s390/s390-64/s390x-mcount.S
+++ b/sysdeps/s390/s390-64/s390x-mcount.S
@@ -69,4 +69,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/s390/s390-64/setjmp.S b/sysdeps/s390/s390-64/setjmp.S
index 7f245c2a1d..a962db46ce 100644
--- a/sysdeps/s390/s390-64/setjmp.S
+++ b/sysdeps/s390/s390-64/setjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -28,16 +28,27 @@
 /* R2 = pointer to jmp_buf, R3 = savemask.  */
 
 ENTRY(__sigsetjmp)
+#ifdef PTR_MANGLE
+	stmg   %r6,%r13,0(%r2)      /* Store registers in jmp_buf.  */
+	lgr    %r4,%r14
+	lgr    %r5,%r15
+	PTR_MANGLE (%r4, %r1)
+	PTR_MANGLE2 (%r5, %r1)
+	stmg   %r4,%r5,64(%r2)
+#else
         stmg   %r6,%r15,0(%r2)      /* Store registers in jmp_buf.  */
+#endif
 	std    %f1,80(%r2)
 	std    %f3,88(%r2)
 	std    %f5,96(%r2)
 	std    %f7,104(%r2)
-#ifdef PIC
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	lghi   %r2,0
+	br     %r14
+#elif defined PIC
         jg     __sigjmp_save@PLT    /* Tail-call __sigjmp_save.  */
 #else
         jg     __sigjmp_save        /* Tail-call __sigjmp_save.  */
 #endif
 END (__sigsetjmp)
-
-
diff --git a/sysdeps/sh/Dist b/sysdeps/sh/Dist
deleted file mode 100644
index a6bf2ff36d..0000000000
--- a/sysdeps/sh/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-_mcount.S
-bits/link.h
diff --git a/sysdeps/sh/_mcount.S b/sysdeps/sh/_mcount.S
index 1e7a1d95c9..069da13e98 100644
--- a/sysdeps/sh/_mcount.S
+++ b/sysdeps/sh/_mcount.S
@@ -1,5 +1,5 @@
 /* Machine-specific calling sequence for `mcount' profiling function.  SuperH
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005 Free Software Foundation, Inc.
    Contributed by NIIBE Yutaka <gniibe@m17n.org>
    This file is part of the GNU C Library.
 
@@ -22,14 +22,25 @@
 
 	ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(_mcount)
 	ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(_mcount),function)
+	cfi_startproc
 	.align	5
 C_LABEL(_mcount)
 	/* Save registers.  */
 	mov.l	r4,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r4, 0)
 	mov.l	r5,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r5, 0)
 	mov.l	r6,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r6, 0)
 	mov.l	r7,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r7, 0)
 	sts.l	pr,@-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (pr, 0)
 
 	mov.l	@(20,r15),r4
 	sts	pr,r5
@@ -61,6 +72,7 @@ C_LABEL(_mcount)
 #else
 1:	.long	C_SYMBOL_NAME(__mcount_internal)
 #endif
+	cfi_endproc
 ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
diff --git a/sysdeps/sh/bits/link.h b/sysdeps/sh/bits/link.h
index bb2fbb5f16..2826677336 100644
--- a/sysdeps/sh/bits/link.h
+++ b/sysdeps/sh/bits/link.h
@@ -1,5 +1,70 @@
-struct link_map_machine
-  {
-    Elf32_Addr plt; /* Address of .plt + 36 */
-    Elf32_Addr gotplt; /* Address of .got + 0x0c */
-  };
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+
+/* Registers for entry into PLT on SH.  */
+typedef struct La_sh_regs
+{
+  uint32_t lr_r2;
+  uint32_t lr_r3;
+  uint32_t lr_r4;
+  uint32_t lr_r5;
+  uint32_t lr_r6;
+  uint32_t lr_r7;
+  uint32_t lr_fpscr;
+  float lr_fr4;
+  float lr_fr5;
+  float lr_fr6;
+  float lr_fr7;
+  float lr_fr8;
+  float lr_fr9;
+  float lr_fr10;
+  float lr_fr11;
+} La_sh_regs;
+
+/* Return values for calls from PLT on SH.  */
+typedef struct La_sh_retval
+{
+  uint32_t lrv_r0;
+  uint32_t lrv_r1;
+  float lrv_fr0;
+  float lrv_fr1;
+} La_sh_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf32_Addr la_sh_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
+				      uintptr_t *__refcook,
+				      uintptr_t *__defcook,
+				      La_sh_regs *__regs,
+				      unsigned int *__flags,
+				      const char *__symname,
+				      long int *__framesizep);
+extern unsigned int la_sh_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
+				       uintptr_t *__refcook,
+				       uintptr_t *__defcook,
+				       const La_sh_regs *__inregs,
+				       La_sh_retval *__outregs,
+				       const char *symname);
+
+__END_DECLS
diff --git a/sysdeps/sh/bits/linkmap.h b/sysdeps/sh/bits/linkmap.h
new file mode 100644
index 0000000000..bb2fbb5f16
--- /dev/null
+++ b/sysdeps/sh/bits/linkmap.h
@@ -0,0 +1,5 @@
+struct link_map_machine
+  {
+    Elf32_Addr plt; /* Address of .plt + 36 */
+    Elf32_Addr gotplt; /* Address of .got + 0x0c */
+  };
diff --git a/sysdeps/sh/bits/setjmp.h b/sysdeps/sh/bits/setjmp.h
index 22497703af..7e3fbd3394 100644
--- a/sysdeps/sh/bits/setjmp.h
+++ b/sysdeps/sh/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2003,2005,2006 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
@@ -44,13 +44,4 @@ typedef struct
   } __jmp_buf[1];
 #endif
 
-#if defined __USE_MISC || defined _ASM
-# define JB_SIZE		(4 * 15)
-#endif
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < &(jmpbuf)[0].__regs[7])
-
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h
index 271666a2a3..e73c6d79c3 100644
--- a/sysdeps/sh/dl-machine.h
+++ b/sysdeps/sh/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  SH version.
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -21,8 +21,6 @@
 #ifndef dl_machine_h
 #define dl_machine_h
 
-/* Only dummy. This doesn't work. */
-
 #define ELF_MACHINE_NAME "SH"
 
 #include <sys/param.h>
@@ -106,7 +104,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	{
 	  got[2] = (Elf32_Addr) &_dl_runtime_profile;
 	  /* Say that we really want profiling and the timers are started.  */
-	  GL(dl_profile_map) = l;
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
+	    GL(dl_profile_map) = l;
 	}
       else
 	/* This function will get called to fix up the GOT entry indicated by
@@ -116,273 +116,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.	 */
-
 #define ELF_MACHINE_RUNTIME_FIXUP_ARGS int plt_type
 
-#ifdef SHARED
-#define FUN_ADDR	"\
-	mov.l 1f,r2\n\
-	mova 1f,r0\n\
-        bra 2f\n\
-	 add r0,r2		! Get GOT address in r2\n\
-0:	.align 2\n\
-1:	.long _GLOBAL_OFFSET_TABLE_\n\
-2:	mov.l 3f,r0\n\
-	add r2,r0"
-#define GOTJMP(x)	#x "@GOTOFF"
-#else
-#define FUN_ADDR	"\
-	mov.l 3f,r0"
-#define GOTJMP(x)	#x
-#endif
-
-#ifdef HAVE_FPU
-#define FGR_SAVE	"\
-	sts.l	fpscr, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov	#8,r3\n\
-	swap.w	r3, r3\n\
-	lds	r3, fpscr\n\
-	fmov.s	fr11, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	fmov.s	fr10, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	fmov.s	fr9, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	fmov.s	fr8, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	fmov.s	fr7, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	fmov.s	fr6, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	fmov.s	fr5, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	fmov.s	fr4, @-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4)
-#define FGR_LOAD	"\
-	fmov.s	@r15+, fr4\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	fmov.s	@r15+, fr5\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	fmov.s	@r15+, fr6\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	fmov.s	@r15+, fr7\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	fmov.s	@r15+, fr8\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	fmov.s	@r15+, fr9\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	fmov.s	@r15+, fr10\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	fmov.s	@r15+, fr11\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	lds.l	@r15+, fpscr\n\
-	" CFI_ADJUST_CFA_OFFSET (-4)
-#else
-#define FGR_SAVE	""
-#define FGR_LOAD	""
-#endif
-
-#ifndef PROF
-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.type _dl_runtime_resolve, @function\n\
-	" CFI_STARTPROC "\n\
-	.align 5\n\
-_dl_runtime_resolve:\n\
-	mov.l r2,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r3,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r4,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r5,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r6,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r7,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r12,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	movt r3			! Save T flag.\n\
-	mov.l r3,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	" FGR_SAVE "\n\
-	sts.l pr,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	tst r0,r0\n\
-	bt 1f\n\
-	mov r0,r2\n\
-1:\n\
-	mov r0,r4		! PLT type\n\
-	mov r2,r5		! link map address\n\
-	" FUN_ADDR "\n\
-	jsr @r0			! Call resolver.\n\
-	 mov r1,r6		! reloc offset\n\
-	lds.l @r15+,pr		! Get register content back.\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	" FGR_LOAD "\n\
-	mov.l @r15+,r3\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	shal r3			! Lode T flag.\n\
-	mov.l @r15+,r12\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r7\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r6\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r5\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r4\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r3\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	jmp @r0			! Jump to function address.\n\
-	 mov.l @r15+,r2\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	.align 2\n\
-3:\n\
-	.long " GOTJMP (fixup) "\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_profile, @function\n\
-	" CFI_STARTPROC "\n\
-	.align 5\n\
-_dl_runtime_profile:\n\
-	mov.l r2,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r3,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r4,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r5,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r6,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r7,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r12,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	movt r3			! Save T flag.\n\
-	mov.l r3,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	" FGR_SAVE "\n\
-	sts.l pr,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	tst r0,r0\n\
-	bt 1f\n\
-	mov r0,r2\n\
-1:\n\
-	mov r0,r4		! PLT type\n\
-	mov r2,r5		! link map address\n\
-	sts pr,r7		! return address\n\
-	" FUN_ADDR "\n\
-	jsr @r0			! Call resolver.\n\
-	 mov r1,r6		! reloc offset\n\
-	lds.l @r15+,pr		! Get register content back.\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	" FGR_LOAD "\n\
-	mov.l @r15+,r3\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	shal r3			! Lode T flag.\n\
-	mov.l @r15+,r12\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r7\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r6\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r5\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r4\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r3\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	jmp @r0			! Jump to function address.\n\
-	 mov.l @r15+,r2\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	.align 2\n\
-3:\n\
-	.long " GOTJMP (profile_fixup) "\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
-	.previous\n\
-");
-#else
-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_resolve, @function\n\
-	.type _dl_runtime_profile, @function\n\
-	.align 5\n\
-_dl_runtime_resolve:\n\
-_dl_runtime_profile:\n\
-	mov.l r2,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r3,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r4,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r5,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r6,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r7,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	mov.l r12,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	movt r3			! Save T flag.\n\
-	mov.l r3,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	" FGR_SAVE "\n\
-	sts.l pr,@-r15\n\
-	" CFI_ADJUST_CFA_OFFSET (4) "\n\
-	tst r0,r0\n\
-	bt 1f\n\
-	mov r0,r2\n\
-1:\n\
-	mov r0,r4		! PLT type\n\
-	mov r2,r5		! link map address\n\
-	sts pr,r7		! return address\n\
-	" FUN_ADDR "\n\
-	jsr @r0			! Call resolver.\n\
-	 mov r1,r6		! reloc offset\n\
-	lds.l @r15+,pr		! Get register content back.\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	" FGR_LOAD "\n\
-	mov.l @r15+,r3\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	shal r3			! Lode T flag.\n\
-	mov.l @r15+,r12\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r7\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r6\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r5\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r4\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	mov.l @r15+,r3\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	jmp @r0			! Jump to function address.\n\
-	 mov.l @r15+,r2\n\
-	" CFI_ADJUST_CFA_OFFSET (-4) "\n\
-	.align 2\n\
-3:\n\
-	.long " GOTJMP (fixup) "\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
-	.previous\n\
-");
-#endif
-
 /* Mask identifying addresses reserved for the user program,
    where the dynamic linker should not map anything.  */
 #define ELF_MACHINE_USER_ADDRESS_MASK	0x80000000UL
@@ -459,6 +194,12 @@ _dl_start_user:\n\
 	.long _rtld_local@GOT\n\
 .L_dl_fini:\n\
 	.long _dl_fini@GOT\n\
+	.type __fpscr_values,@object\n\
+	.global __fpscr_values\n\
+__fpscr_values:\n\
+	.long   0\n\
+	.long   0x80000\n\
+	.weak __fpscr_values\n\
 .previous\n\
 ");
 
@@ -510,13 +251,16 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
   return value + reloc->r_addend;
 }
 
-#endif /* !dl_machine_h */
+#define ARCH_LA_PLTENTER sh_gnu_pltenter
+#define ARCH_LA_PLTEXIT sh_gnu_pltexit
 
-#ifdef RESOLVE
+#endif /* !dl_machine_h */
 
 /* SH never uses Elf32_Rel relocations.	 */
 #define ELF_MACHINE_NO_REL 1
 
+#ifdef RESOLVE_MAP
+
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
@@ -579,18 +323,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
   else
     {
       const Elf32_Sym *const refsym = sym;
-#if defined USE_TLS && !defined RTLD_BOOTSTRAP
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
 
-      value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-#else
-
-      value = RESOLVE (&sym, version, r_type);
-# ifndef RTLD_BOOTSTRAP
-      if (sym != NULL)
-# endif
-	value += sym->st_value;
-#endif
+      value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
       value += reloc->r_addend;
 
       switch (r_type)
@@ -736,4 +471,4 @@ elf_machine_lazy_rel (struct link_map *map,
     _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1);
 }
 
-#endif /* RESOLVE */
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/sh/dl-trampoline.S b/sysdeps/sh/dl-trampoline.S
new file mode 100644
index 0000000000..79493d50b9
--- /dev/null
+++ b/sysdeps/sh/dl-trampoline.S
@@ -0,0 +1,431 @@
+/* PLT trampolines.  SH version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+	.globl _dl_runtime_resolve
+	.type _dl_runtime_resolve, @function
+	cfi_startproc
+	.align 5
+_dl_runtime_resolve:
+	mov.l r2,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r3,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r4,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r5,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r6,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r7,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r12,@-r15
+	cfi_adjust_cfa_offset (4)
+	sts.l macl,@-r15
+	cfi_adjust_cfa_offset (4)
+	sts.l mach,@-r15
+	cfi_adjust_cfa_offset (4)
+	movt r3			! Save T flag.
+	mov.l r3,@-r15
+	cfi_adjust_cfa_offset (4)
+#ifdef HAVE_FPU
+	sts.l	fpscr,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov	#8,r3
+	swap.w	r3,r3
+	lds	r3,fpscr
+	fmov.s	fr11,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr10,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr9,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr8,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr7,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr6,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr5,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr4,@-r15
+	cfi_adjust_cfa_offset (4)
+#endif
+	sts.l pr,@-r15
+	cfi_adjust_cfa_offset (4)
+	tst r0,r0
+	bt 1f
+	mov r0,r2
+1:
+	mov r0,r4		! PLT type
+	mov r2,r5		! link map address
+#ifdef SHARED
+	mov.l 2f,r2
+	mova 2f,r0
+	add r0,r2		! Get GOT address in r2
+	mov.l 3f,r0
+	add r2,r0
+#else
+	mov.l 3f,r0
+#endif
+	jsr @r0			! Call resolver.
+	 mov r1,r6		! reloc offset
+	lds.l @r15+,pr		! Get register content back.
+	cfi_adjust_cfa_offset (-4)
+#ifdef HAVE_FPU
+	fmov.s	@r15+,fr4
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr5
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr6
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr7
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr8
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr9
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr10
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr11
+	cfi_adjust_cfa_offset (-4)
+	lds.l	@r15+,fpscr
+	cfi_adjust_cfa_offset (-4)
+#endif
+	mov.l @r15+,r3
+	cfi_adjust_cfa_offset (-4)
+	shal r3			! Lode T flag.
+	lds.l @r15+,mach
+	cfi_adjust_cfa_offset (-4)
+	lds.l @r15+,macl
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r12
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r7
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r6
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r5
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r4
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r3
+	cfi_adjust_cfa_offset (-4)
+	jmp @r0			! Jump to function address.
+	 mov.l @r15+,r2
+	cfi_adjust_cfa_offset (-4)
+	.align 2
+#ifdef SHARED
+2:	.long _GLOBAL_OFFSET_TABLE_
+3:	.long _dl_fixup@GOTOFF
+#else
+3:	.long _dl_fixup
+#endif
+	cfi_endproc
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve
+
+
+	.globl _dl_runtime_profile
+	.type _dl_runtime_profile,@function
+	cfi_startproc
+	.align 5
+_dl_runtime_profile:
+	mov.l r12,@-r15
+	cfi_adjust_cfa_offset (4)
+#ifdef HAVE_FPU
+	sts.l	fpscr,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov	#8,r12
+	swap.w	r12,r12
+	lds	r12,fpscr
+	fmov.s	fr11,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr10,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr9,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr8,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr7,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr6,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr5,@-r15
+	cfi_adjust_cfa_offset (4)
+	fmov.s	fr4,@-r15
+	cfi_adjust_cfa_offset (4)
+#else
+	add #-36,r15
+	cfi_adjust_cfa_offset (36)
+#endif
+	mov.l r7,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r6,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r5,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r4,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r3,@-r15
+	cfi_adjust_cfa_offset (4)
+	mov.l r2,@-r15
+	cfi_adjust_cfa_offset (4)
+	sts.l macl,@-r15
+	cfi_adjust_cfa_offset (4)
+	sts.l mach,@-r15
+	cfi_adjust_cfa_offset (4)
+	movt r3			! Save T flag.
+	mov.l r3,@-r15
+	cfi_adjust_cfa_offset (4)
+	sts.l pr,@-r15
+	cfi_adjust_cfa_offset (4)
+	tst r0,r0
+	bt 1f
+	mov r0,r2
+1:
+	mov r0,r4		! PLT type
+	mov r2,r5		! link map address
+	sts pr,r7		! return address
+	add #-24,r15
+	cfi_adjust_cfa_offset (24)
+	mov #40,r0
+	add r15,r0
+	mov.l r0,@r15		! Address of the register structure
+	mov #-1,r0
+	mov.l r0,@(8,r15)
+	mov #8,r0
+	add r15,r0
+	mov.l r0,@(4,r15)
+	mov.l r5,@(12,r15)
+	mov.l r1,@(16,r15)
+#ifdef SHARED
+	mov.l 2f,r12
+	mova 2f,r0
+	add r0,r12		! Get GOT address in r12
+	mov.l 3f,r0
+	add r12,r0
+#else
+	mov.l 3f,r0
+#endif
+	jsr @r0			! Call resolver.
+	 mov r1,r6		! reloc offset
+	mov.l @(8,r15),r1
+	cmp/pz r1
+	bt 4f
+	add #24,r15
+	cfi_adjust_cfa_offset (-24)
+	lds.l @r15+,pr		! Get register content back.
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r3
+	cfi_adjust_cfa_offset (-4)
+	shal r3			! Lode T flag.
+	lds.l @r15+,mach
+	cfi_adjust_cfa_offset (-4)
+	lds.l @r15+,macl
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r2
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r3
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r4
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r5
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r6
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r7
+	cfi_adjust_cfa_offset (-4)
+#ifdef HAVE_FPU
+	fmov.s	@r15+,fr4
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr5
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr6
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr7
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr8
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr9
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr10
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr11
+	cfi_adjust_cfa_offset (-4)
+	lds.l	@r15+,fpscr
+	cfi_adjust_cfa_offset (-4)
+#else
+	add #36,r15
+	cfi_adjust_cfa_offset (-36)
+#endif
+	jmp @r0			! Jump to function address.
+	 mov.l @r15+,r12
+	cfi_adjust_cfa_offset (-4)
+	.align 2
+#ifdef SHARED
+2:	.long _GLOBAL_OFFSET_TABLE_
+3:	.long _dl_profile_fixup@GOTOFF
+#else
+3:	.long _dl_profile_fixup
+#endif
+
+	cfi_adjust_cfa_offset (104)
+4:
+	mov #104,r3
+	add r15,r3		! Original stack
+	mov.l r8,@(20,r15)
+	cfi_rel_offset (r8, 20)
+	mov r15,r8
+	sub r1,r15
+	shlr2 r15
+	shll2 r15
+	mov r15,r4
+	shlr2 r1
+	tst r1,r1
+5:	
+	bt/s 6f
+	 dt r1
+	mov.l @r3+,r2
+	mov.l r2,@r4
+	bra 5b
+	 add #4,r4
+6:
+	mov.l @r8,r12
+	mov.l @r12+,r2
+	mov.l @r12+,r3
+	mov.l @r12+,r4
+	mov.l @r12+,r5
+	mov.l @r12+,r6
+	mov.l @r12+,r7
+#ifdef HAVE_FPU
+	fmov.s	@r12+,fr4
+	fmov.s	@r12+,fr5
+	fmov.s	@r12+,fr6
+	fmov.s	@r12+,fr7
+	fmov.s	@r12+,fr8
+	fmov.s	@r12+,fr9
+	fmov.s	@r12+,fr10
+	fmov.s	@r12+,fr11
+	lds.l	@r12+,fpscr
+#else
+	add #36,r2
+#endif
+	jsr @r0			! Call function.
+	 nop
+	mov r8,r15
+	mov.l @(12,r15),r4	! link map address
+	mov.l @(16,r15),r5	! reloc offset
+	mov.l @r15,r6		! input registers
+#ifdef HAVE_FPU
+	mov #16,r8
+	add r15,r8
+	fmov.s fr1,@-r8
+	fmov.s fr0,@-r8
+#else
+	mov #8,r8
+	add r15,r8
+#endif
+	mov.l r1,@-r8
+	mov.l r0,@-r8
+	mov.l @(20,r15),r8
+	cfi_restore (r8)
+#ifdef SHARED
+	mov.l 7f,r12
+	mova 7f,r0
+	add r0,r12		! Get GOT address in r12
+	mov.l 8f,r0
+	add r12,r0
+#else
+	mov.l 8f,r0
+#endif
+	jsr @r0
+	 mov r15,r7		! output registers
+	mov.l @r15+,r0
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r1
+	cfi_adjust_cfa_offset (-4)
+#ifdef HAVE_FPU
+	fmov.s @r15+,fr0
+	cfi_adjust_cfa_offset (-4)
+	fmov.s @r15+,fr1
+	cfi_adjust_cfa_offset (-4)
+	add #8,r15
+	cfi_adjust_cfa_offset (-8)
+#else
+	add #16,r15
+	cfi_adjust_cfa_offset (-16)
+#endif
+	lds.l @r15+,pr		! Get register content back.
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r3
+	cfi_adjust_cfa_offset (-4)
+	shal r3			! Lode T flag.
+	lds.l @r15+,mach
+	cfi_adjust_cfa_offset (-4)
+	lds.l @r15+,macl
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r2
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r3
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r4
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r5
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r6
+	cfi_adjust_cfa_offset (-4)
+	mov.l @r15+,r7
+	cfi_adjust_cfa_offset (-4)
+#ifdef HAVE_FPU
+	fmov.s	@r15+,fr4
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr5
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr6
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr7
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr8
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr9
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr10
+	cfi_adjust_cfa_offset (-4)
+	fmov.s	@r15+,fr11
+	cfi_adjust_cfa_offset (-4)
+	lds.l	@r15+,fpscr
+	cfi_adjust_cfa_offset (-4)
+#else
+	add #36,r15
+	cfi_adjust_cfa_offset (-36)
+#endif
+	rts			! Jump to function address.
+	 mov.l @r15+,r12
+	cfi_adjust_cfa_offset (-4)
+	cfi_endproc
+	.align 2
+#ifdef SHARED
+7:	.long _GLOBAL_OFFSET_TABLE_
+8:	.long _dl_call_pltexit@GOTOFF
+#else
+8:	.long _dl_call_pltexit
+#endif
+	.size _dl_runtime_profile, .-_dl_runtime_profile
diff --git a/sysdeps/sh/elf/configure b/sysdeps/sh/elf/configure
index df45f2cde2..d38b0ece5d 100644
--- a/sysdeps/sh/elf/configure
+++ b/sysdeps/sh/elf/configure
@@ -5,7 +5,7 @@ if test "$usetls" != no; then
 # Check for support of thread-local storage handling in assembler and
 # linker.
 echo "$as_me:$LINENO: checking for SH TLS support" >&5
-echo $ECHO_N "checking for sh TLS support... $ECHO_C" >&6
+echo $ECHO_N "checking for SH TLS support... $ECHO_C" >&6
 if test "${libc_cv_sh_tls+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
diff --git a/sysdeps/sh/jmpbuf-offsets.h b/sysdeps/sh/jmpbuf-offsets.h
new file mode 100644
index 0000000000..312051e7eb
--- /dev/null
+++ b/sysdeps/sh/jmpbuf-offsets.h
@@ -0,0 +1,20 @@
+/* Private macros for accessing __jmp_buf contents.  SH version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define JB_SIZE		(4 * 15)
diff --git a/sysdeps/sh/jmpbuf-unwind.h b/sysdeps/sh/jmpbuf-unwind.h
new file mode 100644
index 0000000000..a69a465efc
--- /dev/null
+++ b/sysdeps/sh/jmpbuf-unwind.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
+  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[0].__regs[7];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index ca23449367..9a8e2efd96 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -28,6 +28,7 @@ ENTRY(memset)
 	bt.s	L_byte_loop_init
 	mov	r4,r7
 
+	extu.b	r5,r5
 	swap.b	r5,r1
 	or	r1,r5
 	swap.w	r5,r1
diff --git a/sysdeps/sh/sh3/__longjmp.S b/sysdeps/sh/sh3/__longjmp.S
index cd78cfe516..c6d8a3214c 100644
--- a/sysdeps/sh/sh3/__longjmp.S
+++ b/sysdeps/sh/sh3/__longjmp.S
@@ -1,5 +1,5 @@
 /* longjmp for SH.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 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
@@ -30,15 +30,28 @@ ENTRY (__longjmp)
 	mov.l	@r4+, r10
 	mov.l	@r4+, r11
 	mov.l	@r4+, r12
-	mov.l	@r4+, r13
-	mov.l	@r4+, r14
-	mov.l	@r4+, r15
 	mov	r5, r0		/* get the return value in place */
 	tst	r0, r0
 	bf.s	1f
-	 lds.l	@r4+, pr
+	 mov.l	@r4+, r13
 	mov	#1,r0		/* can't let setjmp() return zero! */
 1:
+#ifdef PTR_DEMANGLE
+	mov.l	@r4+, r2
+	PTR_DEMANGLE (r2, r1)
+	mov	r2, r14
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
+	mov	r2, r15
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
+	lds	r2, pr
+	mov	#0, r1
+#else
+	mov.l	@r4+, r14
+	mov.l	@r4+, r15
+	lds.l	@r4+, pr
+#endif
 	rts
 	 ldc.l	@r4+, gbr
 END (__longjmp)
diff --git a/sysdeps/sh/sh3/setjmp.S b/sysdeps/sh/sh3/setjmp.S
index 819543a08c..d04e4b851f 100644
--- a/sysdeps/sh/sh3/setjmp.S
+++ b/sysdeps/sh/sh3/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for SH3.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 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
@@ -18,17 +18,28 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
 ENTRY (__sigsetjmp)
 	/* Save registers */
 	add	#(JB_SIZE - 4 * 5), r4
 	stc.l	gbr, @-r4
+#ifdef PTR_MANGLE
+	sts	pr, r2
+	PTR_MANGLE (r2, r1)
+	mov.l	r2, @-r4
+	mov	r15, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	r14, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	#0, r1
+#else
 	sts.l	pr, @-r4
 	mov.l	r15, @-r4
 	mov.l	r14, @-r4
+#endif
 	mov.l	r13, @-r4
 	mov.l	r12, @-r4
 	mov.l	r11, @-r4
@@ -36,8 +47,13 @@ ENTRY (__sigsetjmp)
 	mov.l	r9, @-r4
 	mov.l	r8, @-r4
 
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	rts
+	 mov	#0, r0
+#else
 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
-#ifdef SHARED
+# ifdef SHARED
 	mov.l	1f, r1
 	mova	1f, r0
 	bra	2f
@@ -53,12 +69,13 @@ ENTRY (__sigsetjmp)
 	.align	2
 .L1:
 	.long	C_SYMBOL_NAME(__sigjmp_save@GOT)
-#else
+# else
 	mov.l	.L1, r1
 	jmp	@r1
 	 nop
 	.align	2
 .L1:
 	.long	C_SYMBOL_NAME(__sigjmp_save)
+# endif
 #endif
 END (__sigsetjmp)
diff --git a/sysdeps/sh/sh4/Versions b/sysdeps/sh/sh4/Versions
new file mode 100644
index 0000000000..8cc1c7b7d4
--- /dev/null
+++ b/sysdeps/sh/sh4/Versions
@@ -0,0 +1,5 @@
+ld {
+  GLIBC_PRIVATE {
+    __fpscr_values;
+  }
+}
diff --git a/sysdeps/sh/sh4/__longjmp.S b/sysdeps/sh/sh4/__longjmp.S
index 7cd83bfcc4..320a7d11f7 100644
--- a/sysdeps/sh/sh4/__longjmp.S
+++ b/sysdeps/sh/sh4/__longjmp.S
@@ -1,5 +1,5 @@
 /* longjmp for SH.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 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
@@ -30,15 +30,28 @@ ENTRY (__longjmp)
 	mov.l	@r4+, r10
 	mov.l	@r4+, r11
 	mov.l	@r4+, r12
-	mov.l	@r4+, r13
-	mov.l	@r4+, r14
-	mov.l	@r4+, r15
 	mov	r5, r0		/* get the return value in place */
 	tst	r0, r0
 	bf.s	1f
-	 lds.l	@r4+, pr
+	 mov.l	@r4+, r13
 	mov	#1,r0		/* can't let setjmp() return zero! */
 1:
+#ifdef PTR_DEMANGLE
+	mov.l	@r4+, r2
+	PTR_DEMANGLE (r2, r1)
+	mov	r2, r14
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
+	mov	r2, r15
+	mov.l	@r4+, r2
+	PTR_DEMANGLE2 (r2, r1)
+	lds	r2, pr
+	mov	#0, r1
+#else
+	mov.l	@r4+, r14
+	mov.l	@r4+, r15
+	lds.l	@r4+, pr
+#endif
 	ldc.l	@r4+, gbr
 	lds.l	@r4+, fpscr
 	fmov.s	@r4+, fr12
diff --git a/sysdeps/sh/sh4/fpu/bits/mathdef.h b/sysdeps/sh/sh4/bits/mathdef.h
index 2b8caf1943..2b8caf1943 100644
--- a/sysdeps/sh/sh4/fpu/bits/mathdef.h
+++ b/sysdeps/sh/sh4/bits/mathdef.h
diff --git a/sysdeps/sh/sh4/dl-machine.h b/sysdeps/sh/sh4/dl-machine.h
deleted file mode 100644
index ec9f6f7b45..0000000000
--- a/sysdeps/sh/sh4/dl-machine.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#define HAVE_FPU
-#include <sysdeps/sh/dl-machine.h>
diff --git a/sysdeps/sh/sh4/dl-trampoline.S b/sysdeps/sh/sh4/dl-trampoline.S
new file mode 100644
index 0000000000..f9529851a1
--- /dev/null
+++ b/sysdeps/sh/sh4/dl-trampoline.S
@@ -0,0 +1,2 @@
+#define HAVE_FPU
+#include <sysdeps/sh/dl-trampoline.S>
diff --git a/sysdeps/sh/sh4/fpu/feholdexcpt.c b/sysdeps/sh/sh4/fpu/feholdexcpt.c
index dafb4f7daa..7aac5a0d39 100644
--- a/sysdeps/sh/sh4/fpu/feholdexcpt.c
+++ b/sysdeps/sh/sh4/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2005 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
@@ -35,3 +35,4 @@ feholdexcept (fenv_t *envp)
 
   return 1;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/sh/sh4/fpu/fesetround.c b/sysdeps/sh/sh4/fpu/fesetround.c
index 9966838387..cf4349004e 100644
--- a/sysdeps/sh/sh4/fpu/fesetround.c
+++ b/sysdeps/sh/sh4/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
 
@@ -41,3 +41,4 @@ fesetround (int round)
 
   return 1;
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/sh/sh4/fpu/libm-test-ulps b/sysdeps/sh/sh4/fpu/libm-test-ulps
index 3dd37f1309..4831f4849b 100644
--- a/sysdeps/sh/sh4/fpu/libm-test-ulps
+++ b/sysdeps/sh/sh4/fpu/libm-test-ulps
@@ -60,12 +60,12 @@ float: 1
 ifloat: 1
 
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
diff --git a/sysdeps/sh/sh4/setjmp.S b/sysdeps/sh/sh4/setjmp.S
index c7b0aed0e7..f9a4f0a8ce 100644
--- a/sysdeps/sh/sh4/setjmp.S
+++ b/sysdeps/sh/sh4/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for SH4.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005, 2006 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
@@ -18,9 +18,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
 ENTRY (__sigsetjmp)
 	/* Save registers */
@@ -31,9 +29,22 @@ ENTRY (__sigsetjmp)
 	fmov.s	fr12, @-r4
 	sts.l	fpscr, @-r4
 	stc.l	gbr, @-r4
+#ifdef PTR_MANGLE
+	sts	pr, r2
+	PTR_MANGLE (r2, r1)
+	mov.l	r2, @-r4
+	mov	r15, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	r14, r2
+	PTR_MANGLE2 (r2, r1)
+	mov.l	r2, @-r4
+	mov	#0, r1
+#else
 	sts.l	pr, @-r4
 	mov.l	r15, @-r4
 	mov.l	r14, @-r4
+#endif
 	mov.l	r13, @-r4
 	mov.l	r12, @-r4
 	mov.l	r11, @-r4
@@ -41,8 +52,13 @@ ENTRY (__sigsetjmp)
 	mov.l	r9, @-r4
 	mov.l	r8, @-r4
 
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	rts
+	 mov	#0, r0
+#else
 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
-#ifdef SHARED
+# ifdef SHARED
 	mov.l	1f, r1
 	mova	1f, r0
 	bra	2f
@@ -58,12 +74,13 @@ ENTRY (__sigsetjmp)
 	.align	2
 .L1:
 	.long	C_SYMBOL_NAME(__sigjmp_save@GOT)
-#else
+# else
 	mov.l	.L1, r1
 	jmp	@r1
 	 nop
 	.align	2
 .L1:
 	.long	C_SYMBOL_NAME(__sigjmp_save)
+# endif
 #endif
 END (__sigsetjmp)
diff --git a/sysdeps/sh/sysdep.h b/sysdeps/sh/sysdep.h
index 202c701a10..743631ad71 100644
--- a/sysdeps/sh/sysdep.h
+++ b/sysdeps/sh/sysdep.h
@@ -1,5 +1,5 @@
 /* Assembler macros for SH.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2005 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
@@ -52,10 +52,12 @@
   ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),function)			      \
   .align ALIGNARG(5);							      \
   C_LABEL(name)								      \
+  cfi_startproc;							      \
   CALL_MCOUNT
 
 #undef	END
 #define END(name)							      \
+  cfi_endproc;								      \
   ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(name))
 
 /* If compiled for profiling, call `mcount' at the start of each function.  */
@@ -63,12 +65,17 @@
 #define CALL_MCOUNT					\
 	mov.l	1f,r1;					\
 	sts.l	pr,@-r15;				\
+	cfi_adjust_cfa_offset (4);			\
+	cfi_rel_offset (pr, 0);				\
 	mova	2f,r0;					\
 	jmp	@r1;					\
 	 lds	r0,pr;					\
 	.align	2;					\
 1:	.long	mcount;					\
-2:	lds.l	@r15+,pr
+2:	lds.l	@r15+,pr;				\
+	cfi_adjust_cfa_offset (-4);			\
+	cfi_restore (pr)
+
 #else
 #define CALL_MCOUNT		/* Do nothing.  */
 #endif
diff --git a/sysdeps/sparc/Dist b/sysdeps/sparc/Dist
deleted file mode 100644
index 7832507772..0000000000
--- a/sysdeps/sparc/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sys/trap.h
diff --git a/sysdeps/sparc/Makefile b/sysdeps/sparc/Makefile
index e55e461423..40323a0643 100644
--- a/sysdeps/sparc/Makefile
+++ b/sysdeps/sparc/Makefile
@@ -1,3 +1,6 @@
+# The Sparc `long double' is a distinct type we support.
+long-double-fcts = yes
+
 ifeq ($(subdir),db2)
 CPPFLAGS += -DHAVE_SPINLOCKS=1 -DHAVE_ASSEM_SPARC_GCC=1
 endif
diff --git a/sysdeps/sparc/bits/link.h b/sysdeps/sparc/bits/link.h
new file mode 100644
index 0000000000..9b8434f56f
--- /dev/null
+++ b/sysdeps/sparc/bits/link.h
@@ -0,0 +1,100 @@
+/* Machine-specific audit interfaces for dynamic linker.  SPARC version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+#if __WORDSIZE == 32
+
+typedef struct La_sparc32_regs
+{
+  uint32_t lr_lreg[8];  /* %l0 through %l7 */
+  uint32_t lr_reg[6];   /* %o0 through %o5 */
+  uint32_t lr_sp;       /* %o6 */
+  uint32_t lr_ra;       /* %o7 */
+  uint32_t lr_struct;   /* Pass-by-reference struct pointer */
+} La_sparc32_regs;
+
+typedef struct La_sparc32_retval
+{
+  uint32_t lrv_reg[2]; /* %o0 and %o1 */
+  double lrv_fpreg[2]; /* %f0 and %f2 */
+} La_sparc32_retval;
+
+#else
+
+typedef struct La_sparc64_regs
+{
+  uint64_t lr_lreg[8];  /* %l0 through %l7 */
+  uint64_t lr_reg[6];	/* %o0 through %o5 */
+  uint64_t lr_sp;	/* %o6 */
+  uint64_t lr_ra;	/* %o7 */
+  double lr_fpreg[16];	/* %f0 through %f30 */
+} La_sparc64_regs;
+
+typedef struct La_sparc64_retval
+{
+  uint64_t lrv_reg[4]; /* %o0 through %o3 */
+  double lrv_fprev[4]; /* %f0 through %f8 */
+} La_sparc64_retval;
+
+#endif
+
+__BEGIN_DECLS
+
+#if __WORDSIZE == 32
+
+extern Elf32_Addr la_sparc32_gnu_pltenter (Elf32_Sym *__sym,
+					   unsigned int __ndx,
+					   uintptr_t *__refcook,
+					   uintptr_t *__defcook,
+					   La_sparc32_regs *__regs,
+					   unsigned int *__flags,
+					   const char *__symname,
+					   long int *__framesizep);
+extern unsigned int la_sparc32_gnu_pltexit (Elf32_Sym *__sym,
+					    unsigned int __ndx,
+					    uintptr_t *__refcook,
+					    uintptr_t *__defcook,
+					     const La_sparc32_regs *__inregs,
+					    La_sparc32_retval *__outregs,
+					    const char *symname);
+
+#else
+
+extern Elf64_Addr la_sparc64_gnu_pltenter (Elf64_Sym *__sym,
+					   unsigned int __ndx,
+					   uintptr_t *__refcook,
+					   uintptr_t *__defcook,
+					   La_sparc64_regs *__regs,
+					   unsigned int *__flags,
+					   const char *__symname,
+					   long int *__framesizep);
+extern unsigned int la_sparc64_gnu_pltexit (Elf64_Sym *__sym,
+					    unsigned int __ndx,
+					    uintptr_t *__refcook,
+					    uintptr_t *__defcook,
+					    const La_sparc64_regs *__inregs,
+					    La_sparc64_retval *__outregs,
+					    const char *symname);
+
+#endif
+
+__END_DECLS
diff --git a/sysdeps/sparc/bits/mathdef.h b/sysdeps/sparc/bits/mathdef.h
new file mode 100644
index 0000000000..c8dcc9c93f
--- /dev/null
+++ b/sysdeps/sparc/bits/mathdef.h
@@ -0,0 +1,58 @@
+/* Copyright (C) 1997, 1998, 1999, 2000, 2004, 2006
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#include <bits/wordsize.h>
+
+/* FIXME! This file describes properties of the compiler, not the machine;
+   it should not be part of libc!  */
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF	1
+
+# ifdef __GNUC__
+#  if __STDC__ == 1
+
+/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
+typedef float float_t;
+typedef double double_t;
+
+#  else
+
+/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
+typedef double float_t;
+typedef double double_t;
+
+#  endif
+# else
+
+/* Wild guess at types for float_t and double_t. */
+typedef double float_t;
+typedef double double_t;
+
+# endif
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+# define FP_ILOGB0       (-2147483647)
+# define FP_ILOGBNAN     (2147483647)
+
+#endif	/* ISO C99 */
diff --git a/sysdeps/sparc/dl-procinfo.c b/sysdeps/sparc/dl-procinfo.c
new file mode 100644
index 0000000000..875820fab3
--- /dev/null
+++ b/sysdeps/sparc/dl-procinfo.c
@@ -0,0 +1,62 @@
+/* Data for Linux/sparc version of processor capability information.
+   Copyright (C) 2002,2003,2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This information must be kept in sync with the _DL_HWCAP_COUNT
+   definition in procinfo.h.
+
+   If anything should be added here check whether the size of each string
+   is still ok with the given array size.
+
+   All the #ifdefs in the definitions ar equite irritating but
+   necessary if we want to avoid duplicating the information.  There
+   are three different modes:
+
+   - PROCINFO_DECL is defined.  This means we are only interested in
+     declarations.
+
+   - PROCINFO_DECL is not defined:
+
+     + if SHARED is defined the file is included in an array
+       initializer.  The .element = { ... } syntax is needed.
+
+     + if SHARED is not defined a normal array initialization is
+       needed.
+  */
+
+#ifndef PROCINFO_CLASS
+#define PROCINFO_CLASS
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_sparc_cap_flags
+#else
+PROCINFO_CLASS const char _dl_sparc_cap_flags[7][7]
+#endif
+#ifndef PROCINFO_DECL
+  = { "flush", "stbar", "swap", "muldiv", "v9", "ultra3", "v9v" }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#undef PROCINFO_DECL
+#undef PROCINFO_CLASS
diff --git a/sysdeps/sparc/dl-procinfo.h b/sysdeps/sparc/dl-procinfo.h
new file mode 100644
index 0000000000..dde02b556c
--- /dev/null
+++ b/sysdeps/sparc/dl-procinfo.h
@@ -0,0 +1,79 @@
+/* Linux/sparc version of processor capability information handling macros.
+   Copyright (C) 1999,2000,2001,2002,2003,2004,2006
+	Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _DL_PROCINFO_H
+#define _DL_PROCINFO_H	1
+
+#include <ldsodefs.h>
+
+#define _DL_HWCAP_COUNT 7
+
+static inline int
+__attribute__ ((unused))
+_dl_procinfo (int word)
+{
+  int i;
+
+  _dl_printf ("AT_HWCAP:   ");
+
+  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
+    if (word & (1 << i))
+      _dl_printf (" %s", GLRO(dl_sparc_cap_flags)[i]);
+
+  _dl_printf ("\n");
+
+  return 0;
+}
+
+static inline const char *
+__attribute__ ((unused))
+_dl_hwcap_string (int idx)
+{
+  return GLRO(dl_sparc_cap_flags)[idx];
+};
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_hwcap (const char *str)
+{
+  int i;
+  for (i = 0; i < _DL_HWCAP_COUNT; i++)
+    {
+      if (strcmp (str, GLRO(dl_sparc_cap_flags) [i]) == 0)
+	return i;
+    }
+  return -1;
+};
+
+#include <bits/wordsize.h>
+#define HWCAP_IMPORTANT_V9	(__WORDSIZE == 64 ? 0 : HWCAP_SPARC_V9)
+#define HWCAP_IMPORTANT		(HWCAP_IMPORTANT_V9 | HWCAP_SPARC_ULTRA3 \
+				 | HWCAP_SPARC_BLKINIT)
+
+/* There are no different platforms defined.  */
+#define _dl_platform_string(idx) ""
+
+/* There're no platforms to filter out.  */
+#define _DL_HWCAP_PLATFORM 0
+
+#define _dl_string_platform(str) (-1)
+
+#endif /* dl-procinfo.h */
diff --git a/sysdeps/sparc/dl-sysdep.h b/sysdeps/sparc/dl-sysdep.h
index eb6a788a89..2dee6b1f50 100644
--- a/sysdeps/sparc/dl-sysdep.h
+++ b/sysdeps/sparc/dl-sysdep.h
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  SPARC version.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005 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
@@ -17,25 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifndef _DL_SYSDEP_H
-#define _DL_SYSDEP_H   1
-
-/* This macro must be defined to either 0 or 1.
-
-   If 1, then an errno global variable hidden in ld.so will work right with
-   all the errno-using libc code compiled for ld.so, and there is never a
-   need to share the errno location with libc.  This is appropriate only if
-   all the libc functions that ld.so uses are called without PLT and always
-   get the versions linked into ld.so rather than the libc ones.  */
-
-#ifdef IS_IN_rtld
-# define RTLD_PRIVATE_ERRNO 1
-#else
-# define RTLD_PRIVATE_ERRNO 0
-#endif
+#include_next <dl-sysdep.h>
 
 /* _dl_argv cannot be attribute_relro, because _dl_start_user
    might write into it after _dl_start returns.  */
 #define DL_ARGV_NOT_RELRO 1
-
-#endif /* dl-sysdep.h */
diff --git a/sysdeps/sparc/fpu/bits/mathdef.h b/sysdeps/sparc/fpu/bits/mathdef.h
deleted file mode 100644
index e76735b55b..0000000000
--- a/sysdeps/sparc/fpu/bits/mathdef.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#include <bits/wordsize.h>
-
-/* FIXME! This file describes properties of the compiler, not the machine;
-   it should not be part of libc!  */
-
-#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF	1
-
-# ifdef __GNUC__
-#  if __STDC__ == 1
-
-/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
-typedef float float_t;
-typedef double double_t;
-
-#  else
-
-/* For `gcc -traditional', `float' expressions are evaluated as `double'. */
-typedef double float_t;
-typedef double double_t;
-
-#  endif
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
-typedef double double_t;
-
-# endif
-
-/* The values returned by `ilogb' for 0 and NaN respectively.  */
-# define FP_ILOGB0       (-2147483647)
-# define FP_ILOGBNAN     (2147483647)
-
-#endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-
-# if __WORDSIZE == 32
-/* Signal that in 32bit ABI we do not really have a `long double'.
-   The disables the declaration of all the `long double' function
-   variants.  */
-#  define __NO_LONG_DOUBLE_MATH	1
-# endif
-
-#endif
diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h
index 7add493660..9dd784d122 100644
--- a/sysdeps/sparc/fpu/bits/mathinline.h
+++ b/sysdeps/sparc/fpu/bits/mathinline.h
@@ -1,5 +1,6 @@
 /* Inline math functions for SPARC.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
@@ -36,23 +37,52 @@
 
 # if __WORDSIZE == 32
 
-#  define __unordered_cmp(x, y) \
+#  ifndef __NO_LONG_DOUBLE_MATH
+
+#   define __unordered_cmp(x, y) \
   (__extension__							      \
    ({ unsigned __r;							      \
-      if (sizeof(x) == 4 && sizeof(y) == 4)				      \
+      if (sizeof (x) == 4 && sizeof (y) == 4)				      \
 	{								      \
 	  float __x = (x); float __y = (y);				      \
-	  __asm__("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x),	      \
-		  "f" (__y) : "cc");					      \
+	  __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x),      \
+		   "f" (__y) : "cc");					      \
+	}								      \
+      else if (sizeof (x) <= 8 && sizeof (y) <= 8)			      \
+	{								      \
+	  double __x = (x); double __y = (y);				      \
+	  __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x),   \
+		   "f" (__y) : "cc");					      \
+	}								      \
+      else								      \
+	{								      \
+	  long double __x = (x); long double __y = (y);			      \
+	  extern int _Q_cmp (const long double a, const long double b);	      \
+	  __r = _Q_cmp (__x, __y) << 10;				      \
+	}								      \
+      __r; }))
+
+#  else
+
+#   define __unordered_cmp(x, y) \
+  (__extension__							      \
+   ({ unsigned __r;							      \
+      if (sizeof (x) == 4 && sizeof (y) == 4)				      \
+	{								      \
+	  float __x = (x); float __y = (y);				      \
+	  __asm__ ("fcmps %1,%2; st %%fsr, %0" : "=m" (__r) : "f" (__x),      \
+		   "f" (__y) : "cc");					      \
 	}								      \
       else								      \
 	{								      \
 	  double __x = (x); double __y = (y);				      \
-	  __asm__("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x),    \
-		  "f" (__y) : "cc");					      \
+	  __asm__ ("fcmpd\t%1,%2\n\tst\t%%fsr,%0" : "=m" (__r) : "f" (__x),   \
+		   "f" (__y) : "cc");					      \
 	}								      \
       __r; }))
 
+#  endif
+
 #  define isgreater(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (2 << 10))
 #  define isgreaterequal(x, y) ((__unordered_cmp (x, y) & (1 << 10)) == 0)
 #  define isless(x, y) ((__unordered_cmp (x, y) & (3 << 10)) == (1 << 10))
@@ -65,22 +95,22 @@
 #  define __unordered_v9cmp(x, y, op, qop) \
   (__extension__							      \
    ({ unsigned __r;						      	      \
-      if (sizeof(x) == 4 && sizeof(y) == 4)				      \
+      if (sizeof (x) == 4 && sizeof (y) == 4)				      \
 	{								      \
 	  float __x = (x); float __y = (y);				      \
-	  __asm__("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
-		  : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");	      \
+	  __asm__ ("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
+		   : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");      \
 	}								      \
-      else if (sizeof(x) <= 8 && sizeof(y) <= 8)			      \
+      else if (sizeof (x) <= 8 && sizeof (y) <= 8)			      \
 	{								      \
 	  double __x = (x); double __y = (y);				      \
-	  __asm__("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
-		  : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");	      \
+	  __asm__ ("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0"	      \
+		   : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc");      \
 	}								      \
       else								      \
 	{								      \
 	  long double __x = (x); long double __y = (y);			      \
-	  extern int _Qp_cmp(const long double *a, const long double *b);     \
+	  extern int _Qp_cmp (const long double *a, const long double *b);    \
 	  __r = qop;						      	      \
 	}								      \
       __r; }))
@@ -127,11 +157,20 @@ __NTH (__signbit (double __x))
   return __u.__i[0] < 0;
 }
 
+#    ifndef __NO_LONG_DOUBLE_MATH
+__MATH_INLINE int
+__NTH (__signbitl (long double __x))
+{
+  __extension__ union { long double __l; int __i[4]; } __u = { __l: __x };
+  return __u.__i[0] < 0;
+}
+#    else
 __MATH_INLINE int
 __NTH (__signbitl (long double __x))
 {
   return __signbit ((double)__x);
 }
+#    endif
 
 #   else /* sparc64 */
 
@@ -180,6 +219,13 @@ __NTH (sqrtl (long double __x))
   _Qp_sqrt (&__r, &__x);
   return __r;
 }
+#   elif !defined __NO_LONG_DOUBLE_MATH
+__MATH_INLINE long double
+sqrtl (long double __x) __THROW
+{
+  extern long double _Q_sqrt (__const__ long double);
+  return _Q_sqrt (__x);
+}
 #   endif /* sparc64 */
 
 #  endif /* !__NO_MATH_INLINES && !GCC 3.2+ */
@@ -211,6 +257,13 @@ __ieee754_sqrtl (long double __x)
   _Qp_sqrt(&__r, &__x);
   return __r;
 }
+#   elif !defined __NO_LONG_DOUBLE_MATH
+__MATH_INLINE long double
+__ieee754_sqrtl (long double __x)
+{
+  extern long double _Q_sqrt (__const__ long double);
+  return _Q_sqrt (__x);
+}
 #   endif /* sparc64 */
 #  endif /* __LIBC_INTERNAL_MATH_INLINES */
 # endif /* gcc 2.8+ */
diff --git a/sysdeps/sparc/fpu/feholdexcpt.c b/sysdeps/sparc/fpu/feholdexcpt.c
index 3bd2b16cf1..729637ad1b 100644
--- a/sysdeps/sparc/fpu/feholdexcpt.c
+++ b/sysdeps/sparc/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005 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
@@ -33,3 +33,4 @@ feholdexcept (fenv_t *envp)
 
   return 0;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/sparc/fpu/fesetround.c b/sysdeps/sparc/fpu/fesetround.c
index b18b344516..e3b441cd53 100644
--- a/sysdeps/sparc/fpu/fesetround.c
+++ b/sysdeps/sparc/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2005 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
@@ -35,3 +35,4 @@ fesetround (int round)
 
   return 0;
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/sparc/fpu/fraiseexcpt.c b/sysdeps/sparc/fpu/fraiseexcpt.c
index 0d45ec82d2..cbb8be80ec 100644
--- a/sysdeps/sparc/fpu/fraiseexcpt.c
+++ b/sysdeps/sparc/fpu/fraiseexcpt.c
@@ -25,12 +25,12 @@
 int
 __feraiseexcept (int excepts)
 {
-  static volatile double sink;
   static const struct {
     double zero, one, max, min, sixteen, pi;
   } c = {
     0.0, 1.0, DBL_MAX, DBL_MIN, 16.0, M_PI
   };
+  double d;
 
   /* Raise exceptions represented by EXPECTS.  But we must raise only
      one signal at a time.  It is important the if the overflow/underflow
@@ -39,24 +39,44 @@ __feraiseexcept (int excepts)
 
   /* First: invalid exception.  */
   if ((FE_INVALID & excepts) != 0)
-    /* One example of a invalid operation is 0/0.  */
-    sink = c.zero / c.zero;
+    {
+      /* One example of a invalid operation is 0/0.  */
+      __asm ("" : "=e" (d) : "0" (c.zero));
+      d /= c.zero;
+      __asm __volatile ("" : : "e" (d));
+    }
 
   /* Next: division by zero.  */
   if ((FE_DIVBYZERO & excepts) != 0)
-    sink = c.one / c.zero;
+    {
+      __asm ("" : "=e" (d) : "0" (c.one));
+      d /= c.zero;
+      __asm __volatile ("" : : "e" (d));
+    }
 
   /* Next: overflow.  */
   if ((FE_OVERFLOW & excepts) != 0)
-    sink = c.max * c.max;
+    {
+      __asm ("" : "=e" (d) : "0" (c.max));
+      d *= d;
+      __asm __volatile ("" : : "e" (d));
+    }
 
   /* Next: underflow.  */
   if ((FE_UNDERFLOW & excepts) != 0)
-    sink = c.min / c.sixteen;
+    {
+      __asm ("" : "=e" (d) : "0" (c.min));
+      d /= c.sixteen;
+      __asm __volatile ("" : : "e" (d));
+    }
 
   /* Last: inexact.  */
   if ((FE_INEXACT & excepts) != 0)
-    sink = c.one / c.pi;
+    {
+      __asm ("" : "=e" (d) : "0" (c.one));
+      d /= c.pi;
+      __asm __volatile ("" : : "e" (d));
+    }
 
   /* Success.  */
   return 0;
diff --git a/sysdeps/sparc/sparc32/Dist b/sysdeps/sparc/sparc32/Dist
deleted file mode 100644
index c3bf9746bc..0000000000
--- a/sysdeps/sparc/sparc32/Dist
+++ /dev/null
@@ -1,9 +0,0 @@
-dotmul.S
-umul.S
-divrem.m4
-sdiv.S
-udiv.S
-rem.S
-urem.S
-alloca.S
-ieee754.h
diff --git a/sysdeps/sparc/sparc32/Implies b/sysdeps/sparc/sparc32/Implies
index 5312721497..436436a651 100644
--- a/sysdeps/sparc/sparc32/Implies
+++ b/sysdeps/sparc/sparc32/Implies
@@ -1,5 +1,6 @@
 wordsize-32
 # SPARC uses IEEE 754 floating point.
-ieee754/flt-32
+ieee754/ldbl-128
 ieee754/dbl-64
+ieee754/flt-32
 sparc/sparc32/soft-fp
diff --git a/sysdeps/sparc/sparc32/__longjmp.S b/sysdeps/sparc/sparc32/__longjmp.S
index 1c81c92692..a5453b4294 100644
--- a/sysdeps/sparc/sparc32/__longjmp.S
+++ b/sysdeps/sparc/sparc32/__longjmp.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 93, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2006
+   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
@@ -18,9 +19,7 @@
 
 #include <sysdep.h>
 
-#define _ASM 1
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #define ENV(base,reg) [%base + (reg * 4)]
 #define ST_FLUSH_WINDOWS 3
 #define RW_FP [%fp + 0x48]
@@ -30,6 +29,9 @@ ENTRY(__longjmp)
 	   use them while unwinding frames and their register windows.  */
 
 	ld ENV(o0,JB_FP), %g3	/* Cache target FP in register %g3.  */
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (%g3, %g3, %g4)
+#endif
 	mov %o0, %g1		/* ENV in %g1 */
      	orcc %o1, %g0, %g2	/* VAL in %g2 */
      	be,a 0f			/* Branch if zero; else skip delay slot.  */
@@ -62,8 +64,15 @@ LOC(thread):
 	 * windows.
 	 */
 	ta	ST_FLUSH_WINDOWS
+#ifdef PTR_DEMANGLE
+	ld	ENV(g1,JB_PC), %g5 /* Set return PC. */
+	ld	ENV(g1,JB_SP), %g1 /* Set saved SP on restore below. */
+	PTR_DEMANGLE2 (%o7, %g5, %g4)
+	PTR_DEMANGLE2 (%fp, %g1, %g4)
+#else
 	ld	ENV(g1,JB_PC), %o7 /* Set return PC. */
 	ld	ENV(g1,JB_SP), %fp /* Set saved SP on restore below. */
+#endif
 	sub	%fp, 64, %sp	/* Allocate a register frame. */
 	st	%g3, RW_FP	/* Set saved FP on restore below. */
 	retl
@@ -71,10 +80,17 @@ LOC(thread):
 
 LOC(found):
 	/* We have unwound register windows so %fp matches the target.  */
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE2 (%sp, %o0, %g4)
+#else
 	mov %o0, %sp		/* OK, install new SP.  */
+#endif
 
 LOC(sp_ok):
 	ld ENV(g1,JB_PC), %o0	/* Extract target return PC.  */
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE2 (%o0, %o0, %g4)
+#endif
 	jmp %o0 + 8		/* Return there.  */
 	 mov %g2, %o0		/* Delay slot: set return value.  */
 
diff --git a/sysdeps/sparc/sparc32/bits/atomic.h b/sysdeps/sparc/sparc32/bits/atomic.h
index 736372a3d4..ef553f7270 100644
--- a/sysdeps/sparc/sparc32/bits/atomic.h
+++ b/sysdeps/sparc/sparc32/bits/atomic.h
@@ -1,5 +1,5 @@
 /* Atomic operations.  sparc32 version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -21,6 +21,34 @@
 #ifndef _BITS_ATOMIC_H
 #define _BITS_ATOMIC_H	1
 
+#include <stdint.h>
+
+typedef int8_t atomic8_t;
+typedef uint8_t uatomic8_t;
+typedef int_fast8_t atomic_fast8_t;
+typedef uint_fast8_t uatomic_fast8_t;
+
+typedef int16_t atomic16_t;
+typedef uint16_t uatomic16_t;
+typedef int_fast16_t atomic_fast16_t;
+typedef uint_fast16_t uatomic_fast16_t;
+
+typedef int32_t atomic32_t;
+typedef uint32_t uatomic32_t;
+typedef int_fast32_t atomic_fast32_t;
+typedef uint_fast32_t uatomic_fast32_t;
+
+typedef int64_t atomic64_t;
+typedef uint64_t uatomic64_t;
+typedef int_fast64_t atomic_fast64_t;
+typedef uint_fast64_t uatomic_fast64_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+
 /* We have no compare and swap, just test and set.
    The following implementation contends on 64 global locks
    per library and assumes no variable will be accessed using atomic.h
@@ -41,22 +69,65 @@ volatile unsigned char __sparc32_atomic_locks[64]
       unsigned int __idx = (((long) addr >> 2) ^ ((long) addr >> 12)) \
 			   & 63;				      \
       do							      \
-	__asm ("ldstub %1, %0"					      \
-	       : "=r" (__old_lock),				      \
-		 "=m" (__sparc32_atomic_locks[__idx])		      \
-	       : "m" (__sparc32_atomic_locks[__idx]));		      \
+	__asm __volatile ("ldstub %1, %0"			      \
+			  : "=r" (__old_lock),			      \
+			    "=m" (__sparc32_atomic_locks[__idx])      \
+			  : "m" (__sparc32_atomic_locks[__idx])	      \
+			  : "memory");				      \
       while (__old_lock);					      \
     }								      \
   while (0)
 
 #define __sparc32_atomic_do_unlock(addr) \
   do								      \
-    __sparc32_atomic_locks[(((long) addr >> 2)			      \
-			    ^ ((long) addr >> 12)) & 63] = 0;	      \
+    {								      \
+      __sparc32_atomic_locks[(((long) addr >> 2)		      \
+			      ^ ((long) addr >> 12)) & 63] = 0;	      \
+      __asm __volatile ("" ::: "memory");			      \
+    }								      \
+  while (0)
+
+#define __sparc32_atomic_do_lock24(addr) \
+  do								      \
+    {								      \
+      unsigned int __old_lock;					      \
+      do							      \
+	__asm __volatile ("ldstub %1, %0"			      \
+			  : "=r" (__old_lock), "=m" (*(addr))	      \
+			  : "m" (*(addr))			      \
+			  : "memory");				      \
+      while (__old_lock);					      \
+    }								      \
   while (0)
 
+#define __sparc32_atomic_do_unlock24(addr) \
+  do								      \
+    {								      \
+      *(char *) (addr) = 0;					      \
+      __asm __volatile ("" ::: "memory");			      \
+    }								      \
+  while (0)
+
+
+#ifndef SHARED
+# define __v9_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+({									      \
+  register __typeof (*(mem)) __acev_tmp __asm ("%g6");			      \
+  register __typeof (mem) __acev_mem __asm ("%g1") = (mem);		      \
+  register __typeof (*(mem)) __acev_oldval __asm ("%g5");		      \
+  __acev_tmp = (newval);						      \
+  __acev_oldval = (oldval);						      \
+  /* .word 0xcde05005 is cas [%g1], %g5, %g6.  Can't use cas here though,     \
+     because as will then mark the object file as V8+ arch.  */		      \
+  __asm __volatile (".word 0xcde05005"					      \
+		    : "+r" (__acev_tmp), "=m" (*__acev_mem)		      \
+		    : "r" (__acev_oldval), "m" (*__acev_mem),		      \
+		      "r" (__acev_mem) : "memory");			      \
+  __acev_tmp; })
+#endif
+
 /* The only basic operation needed is compare and exchange.  */
-#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+#define __v7_compare_and_exchange_val_acq(mem, newval, oldval) \
   ({ __typeof (mem) __acev_memp = (mem);			      \
      __typeof (*mem) __acev_ret;				      \
      __typeof (*mem) __acev_newval = (newval);			      \
@@ -68,7 +139,7 @@ volatile unsigned char __sparc32_atomic_locks[64]
      __sparc32_atomic_do_unlock (__acev_memp);			      \
      __acev_ret; })
 
-#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+#define __v7_compare_and_exchange_bool_acq(mem, newval, oldval) \
   ({ __typeof (mem) __aceb_memp = (mem);			      \
      int __aceb_ret;						      \
      __typeof (*mem) __aceb_newval = (newval);			      \
@@ -82,4 +153,175 @@ volatile unsigned char __sparc32_atomic_locks[64]
      __sparc32_atomic_do_unlock (__aceb_memp);			      \
      __aceb_ret; })
 
+#define __v7_exchange_acq(mem, newval) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+     __typeof (*mem) __acev_newval = (newval);			      \
+								      \
+     __sparc32_atomic_do_lock (__acev_memp);			      \
+     __acev_ret = *__acev_memp;					      \
+     *__acev_memp = __acev_newval;				      \
+     __sparc32_atomic_do_unlock (__acev_memp);			      \
+     __acev_ret; })
+
+#define __v7_exchange_and_add(mem, value) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+								      \
+     __sparc32_atomic_do_lock (__acev_memp);			      \
+     __acev_ret = *__acev_memp;					      \
+     *__acev_memp = __acev_ret + (value);			      \
+     __sparc32_atomic_do_unlock (__acev_memp);			      \
+     __acev_ret; })
+
+/* Special versions, which guarantee that top 8 bits of all values
+   are cleared and use those bits as the ldstub lock.  */
+#define __v7_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+     __typeof (*mem) __acev_newval = (newval);			      \
+								      \
+     __sparc32_atomic_do_lock24 (__acev_memp);			      \
+     __acev_ret = *__acev_memp & 0xffffff;			      \
+     if (__acev_ret == (oldval))				      \
+       *__acev_memp = __acev_newval;				      \
+     else							      \
+       __sparc32_atomic_do_unlock24 (__acev_memp);		      \
+     __asm __volatile ("" ::: "memory");			      \
+     __acev_ret; })
+
+#define __v7_exchange_24_rel(mem, newval) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+     __typeof (*mem) __acev_newval = (newval);			      \
+								      \
+     __sparc32_atomic_do_lock24 (__acev_memp);			      \
+     __acev_ret = *__acev_memp & 0xffffff;			      \
+     *__acev_memp = __acev_newval;				      \
+     __asm __volatile ("" ::: "memory");			      \
+     __acev_ret; })
+
+#ifdef SHARED
+
+/* When dynamically linked, we assume pre-v9 libraries are only ever
+   used on pre-v9 CPU.  */
+# define __atomic_is_v9 0
+
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+  __v7_compare_and_exchange_val_acq (mem, newval, oldval)
+
+# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+  __v7_compare_and_exchange_bool_acq (mem, newval, oldval)
+
+# define atomic_exchange_acq(mem, newval) \
+  __v7_exchange_acq (mem, newval)
+
+# define atomic_exchange_and_add(mem, value) \
+  __v7_exchange_and_add (mem, value)
+
+# define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  ({								      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     __v7_compare_and_exchange_val_24_acq (mem, newval, oldval); })
+
+# define atomic_exchange_24_rel(mem, newval) \
+  ({								      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     __v7_exchange_24_rel (mem, newval); })
+
+#else
+
+/* In libc.a/libpthread.a etc. we don't know if we'll be run on
+   pre-v9 or v9 CPU.  To be interoperable with dynamically linked
+   apps on v9 CPUs e.g. with process shared primitives, use cas insn
+   on v9 CPUs and ldstub on pre-v9.  */
+
+/* Avoid <ldsodefs.h> include here.  */
+extern uint64_t _dl_hwcap __attribute__((weak));
+# define __ATOMIC_HWCAP_SPARC_V9	16
+# define __atomic_is_v9 \
+  (__builtin_expect (&_dl_hwcap != 0, 1) \
+   && __builtin_expect (_dl_hwcap & __ATOMIC_HWCAP_SPARC_V9, \
+			__ATOMIC_HWCAP_SPARC_V9))
+
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+  ({								      \
+     __typeof (*mem) __acev_wret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       __acev_wret						      \
+	 = __v9_compare_and_exchange_val_32_acq (mem, newval, oldval);\
+     else							      \
+       __acev_wret						      \
+	 = __v7_compare_and_exchange_val_acq (mem, newval, oldval);   \
+     __acev_wret; })
+
+# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+  ({								      \
+     int __acev_wret;						      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       {							      \
+	 __typeof (oldval) __acev_woldval = (oldval);		      \
+	 __acev_wret						      \
+	   = __v9_compare_and_exchange_val_32_acq (mem, newval,	      \
+						   __acev_woldval)    \
+	     != __acev_woldval;					      \
+       }							      \
+     else							      \
+       __acev_wret						      \
+	 = __v7_compare_and_exchange_bool_acq (mem, newval, oldval);  \
+     __acev_wret; })
+
+# define atomic_exchange_rel(mem, newval) \
+  ({								      \
+     __typeof (*mem) __acev_wret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       {							      \
+	 __typeof (mem) __acev_wmemp = (mem);			      \
+	 __typeof (*(mem)) __acev_wval = (newval);		      \
+	 do							      \
+	   __acev_wret = *__acev_wmemp;				      \
+	 while (__builtin_expect				      \
+		  (__v9_compare_and_exchange_val_32_acq (__acev_wmemp,\
+							 __acev_wval, \
+							 __acev_wret) \
+		   != __acev_wret, 0));				      \
+       }							      \
+     else							      \
+       __acev_wret = __v7_exchange_acq (mem, newval);		      \
+     __acev_wret; })
+
+# define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  ({								      \
+     __typeof (*mem) __acev_wret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       __acev_wret						      \
+	 = __v9_compare_and_exchange_val_32_acq (mem, newval, oldval);\
+     else							      \
+       __acev_wret						      \
+	 = __v7_compare_and_exchange_val_24_acq (mem, newval, oldval);\
+     __acev_wret; })
+
+# define atomic_exchange_24_rel(mem, newval) \
+  ({								      \
+     __typeof (*mem) __acev_w24ret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       __acev_w24ret = atomic_exchange_rel (mem, newval);	      \
+     else							      \
+       __acev_w24ret = __v7_exchange_24_rel (mem, newval);	      \
+     __acev_w24ret; })
+
+#endif
+
 #endif	/* bits/atomic.h */
diff --git a/sysdeps/sparc/sparc32/bits/setjmp.h b/sysdeps/sparc/sparc32/bits/setjmp.h
index 76d7af02c7..86ccc20d20 100644
--- a/sysdeps/sparc/sparc32/bits/setjmp.h
+++ b/sysdeps/sparc/sparc32/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2005, 2006 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
@@ -22,17 +22,6 @@
 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
 #endif
 
-#if defined __USE_MISC || defined _ASM
-# define JB_SP	0
-# define JB_FP	1
-# define JB_PC	2
-#endif
-
 #ifndef	_ASM
 typedef int __jmp_buf[3];
 #endif
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((int) (address) < (jmpbuf)[JB_SP])
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 52fc6329dd..02dabaabb4 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  SPARC version.
-   Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996-2003, 2004, 2005, 2006 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
@@ -40,13 +40,6 @@
 #define OPCODE_SAVE_SP	0x9de3bfa8 /* save %sp, -(16+6)*4, %sp */
 #define OPCODE_BA	0x30800000 /* b,a ?; add PC-rel word address */
 
-/* Use a different preload file when running in 32-bit emulation mode
-   on a 64-bit host.  */
-#define LD_SO_PRELOAD ((GLRO(dl_hwcap) & HWCAP_SPARC_V9) \
-		       ? "/etc/ld.so.preload32" \
-		       : "/etc/ld.so.preload")
-
-
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
 elf_machine_matches_host (const Elf32_Ehdr *ehdr)
@@ -131,30 +124,31 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	 bits of %g1 with an offset into the .rela.plt section and jump to
 	 the beginning of the PLT.  */
       plt = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
-      if (! profile)
-	rfunc = (Elf32_Addr) &_dl_runtime_resolve;
-      else
+      if (__builtin_expect(profile, 0))
 	{
 	  rfunc = (Elf32_Addr) &_dl_runtime_profile;
 
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    GL(dl_profile_map) = l;
 	}
+      else
+	{
+	  rfunc = (Elf32_Addr) &_dl_runtime_resolve;
+	}
 
       /* The beginning of the PLT does:
 
-		save %sp, -64, %sp
-	 pltpc:	call _dl_runtime_resolve
-		nop
+		sethi %hi(_dl_runtime_{resolve,profile}), %g2
+	 pltpc:	jmpl %g2 + %lo(_dl_runtime_{resolve,profile}), %g2
+		 nop
 		.word MAP
 
-         This saves the register window containing the arguments, and the
-	 PC value (pltpc) implicitly saved in %o7 by the call points near the
+         The PC value (pltpc) saved in %g2 by the jmpl points near the
 	 location where we store the link_map pointer for this object.  */
 
-      plt[0] = OPCODE_SAVE_SP;
-      /* Construct PC-relative word address.  */
-      plt[1] = OPCODE_CALL | ((rfunc - (Elf32_Addr) &plt[1]) >> 2);
+      plt[0] = 0x05000000 | ((rfunc >> 10) & 0x003fffff);
+      plt[1] = 0x85c0a000 | (rfunc & 0x3ff);
       plt[2] = OPCODE_NOP;	/* Fill call delay slot.  */
       plt[3] = (Elf32_Addr) l;
       if (__builtin_expect (l->l_info[VALIDX(DT_GNU_PRELINKED)] != NULL, 0)
@@ -190,39 +184,6 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)	\
-  asm ( "\
-	.text\n\
-	.globl	" #tramp_name "\n\
-	.type	" #tramp_name ", @function\n\
-	.align	32\n\
-" #tramp_name ":\n\
-	/* Set up the arguments to fixup --\n\
-	   %o0 = link_map out of plt0\n\
-	   %o1 = offset of reloc entry\n\
-	   %o2 = return address  */\n\
-	ld	[%o7 + 8], %o0\n\
-	srl	%g1, 10, %o1\n\
-	mov	%i7, %o2\n\
-	call	" #fixup_name "\n\
-	 sub	%o1, 4*12, %o1\n\
-	jmp	%o0\n\
-	 restore\n\
-	.size	" #tramp_name ", . - " #tramp_name "\n\
-	.previous")
-
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, fixup);
-#endif
-
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
    PLT entries should not be allowed to define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
@@ -406,18 +367,25 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
 
 #endif /* dl_machine_h */
 
-#ifdef RESOLVE
+#define ARCH_LA_PLTENTER	sparc32_gnu_pltenter
+#define ARCH_LA_PLTEXIT		sparc32_gnu_pltexit
+
+#ifdef RESOLVE_MAP
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 		  const Elf32_Sym *sym, const struct r_found_version *version,
 		  void *const reloc_addr_arg)
 {
   Elf32_Addr *const reloc_addr = reloc_addr_arg;
+  const Elf32_Sym *const refsym = sym;
+  Elf32_Addr value;
   const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+  struct link_map *sym_map = NULL;
 
 #if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
   /* This is defined in rtld.c, but nowhere in the static libc.a; make the
@@ -428,6 +396,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
   weak_extern (_dl_rtld_map);
 #endif
 
+  if (__builtin_expect (r_type == R_SPARC_NONE, 0))
+    return;
+
 #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
   if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
     {
@@ -435,165 +406,148 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       if (map != &_dl_rtld_map) /* Already done in rtld itself. */
 # endif
 	*reloc_addr += map->l_addr + reloc->r_addend;
+      return;
     }
-  else
-#endif
-    {
-#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
-      const Elf32_Sym *const refsym = sym;
-# ifdef USE_TLS
-      struct link_map *sym_map;
-# endif
 #endif
-      Elf32_Addr value;
+
 #ifndef RESOLVE_CONFLICT_FIND_MAP
-      if (sym->st_shndx != SHN_UNDEF &&
-	  ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
-	{
-	  value = map->l_addr;
-# if defined USE_TLS && !defined RTLD_BOOTSTRAP
-	  sym_map = map;
-# endif
-	}
-      else
-	{
-# if defined USE_TLS && !defined RTLD_BOOTSTRAP
-	  sym_map = RESOLVE_MAP (&sym, version, r_type);
-	  value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-# else
-	  value = RESOLVE (&sym, version, r_type);
-	  if (sym)
-	    value += sym->st_value;
-# endif
-	}
+  if (__builtin_expect (ELF32_ST_BIND (sym->st_info) == STB_LOCAL, 0)
+      && sym->st_shndx != SHN_UNDEF)
+    {
+      value = map->l_addr;
+    }
+  else
+    {
+      sym_map = RESOLVE_MAP (&sym, version, r_type);
+      value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
+    }
 #else
-      value = 0;
+  value = 0;
 #endif
-      value += reloc->r_addend;	/* Assume copy relocs have zero addend.  */
 
-      switch (r_type)
-	{
+  value += reloc->r_addend;	/* Assume copy relocs have zero addend.  */
+
+  switch (r_type)
+    {
 #if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
-	case R_SPARC_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (sym->st_size > refsym->st_size
-	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
-	    {
-	      const char *strtab;
+    case R_SPARC_COPY:
+      if (sym == NULL)
+	/* This can happen in trace mode if an object could not be
+	   found.  */
+	break;
+      if (sym->st_size > refsym->st_size
+	  || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
+	{
+	  const char *strtab;
 
-	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
+	  strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+	  _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				rtld_progname ?: "<program name unknown>",
-				strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
+			    rtld_progname ?: "<program name unknown>",
+			    strtab + refsym->st_name);
+	}
+      memcpy (reloc_addr_arg, (void *) value,
+	      MIN (sym->st_size, refsym->st_size));
+      break;
 #endif
-	case R_SPARC_GLOB_DAT:
-	case R_SPARC_32:
-	  *reloc_addr = value;
-	  break;
-	case R_SPARC_JMP_SLOT:
-	  /* At this point we don't need to bother with thread safety,
-	     so we can optimize the first instruction of .plt out.  */
-	  sparc_fixup_plt (reloc, reloc_addr, value, 0);
-	  break;
+    case R_SPARC_GLOB_DAT:
+    case R_SPARC_32:
+      *reloc_addr = value;
+      break;
+    case R_SPARC_JMP_SLOT:
+      /* At this point we don't need to bother with thread safety,
+	 so we can optimize the first instruction of .plt out.  */
+      sparc_fixup_plt (reloc, reloc_addr, value, 0);
+      break;
 #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
     && !defined RESOLVE_CONFLICT_FIND_MAP
-	case R_SPARC_TLS_DTPMOD32:
-	  /* Get the information from the link map returned by the
-	     resolv function.  */
-	  if (sym_map != NULL)
-	    *reloc_addr = sym_map->l_tls_modid;
-	  break;
-	case R_SPARC_TLS_DTPOFF32:
-	  /* During relocation all TLS symbols are defined and used.
-	     Therefore the offset is already correct.  */
-	  *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
-	  break;
-	case R_SPARC_TLS_TPOFF32:
-	  /* The offset is negative, forward from the thread pointer.  */
-	  /* We know the offset of object the symbol is contained in.
-	     It is a negative value which will be added to the
-	     thread pointer.  */
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      *reloc_addr = sym->st_value - sym_map->l_tls_offset
-			    + reloc->r_addend;
-	    }
-	  break;
+    case R_SPARC_TLS_DTPMOD32:
+      /* Get the information from the link map returned by the
+	 resolv function.  */
+      if (sym_map != NULL)
+	*reloc_addr = sym_map->l_tls_modid;
+      break;
+    case R_SPARC_TLS_DTPOFF32:
+      /* During relocation all TLS symbols are defined and used.
+	 Therefore the offset is already correct.  */
+      *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
+      break;
+    case R_SPARC_TLS_TPOFF32:
+      /* The offset is negative, forward from the thread pointer.  */
+      /* We know the offset of object the symbol is contained in.
+	 It is a negative value which will be added to the
+	 thread pointer.  */
+      if (sym != NULL)
+	{
+	  CHECK_STATIC_TLS (map, sym_map);
+	  *reloc_addr = sym->st_value - sym_map->l_tls_offset
+	    + reloc->r_addend;
+	}
+      break;
 # ifndef RTLD_BOOTSTRAP
-	case R_SPARC_TLS_LE_HIX22:
-	case R_SPARC_TLS_LE_LOX10:
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      value = sym->st_value - sym_map->l_tls_offset
-		      + reloc->r_addend;
-	      if (r_type == R_SPARC_TLS_LE_HIX22)
-		*reloc_addr = (*reloc_addr & 0xffc00000) | ((~value) >> 10);
-	      else
-		*reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff)
-			      | 0x1c00;
-	    }
-	  break;
+    case R_SPARC_TLS_LE_HIX22:
+    case R_SPARC_TLS_LE_LOX10:
+      if (sym != NULL)
+	{
+	  CHECK_STATIC_TLS (map, sym_map);
+	  value = sym->st_value - sym_map->l_tls_offset
+	    + reloc->r_addend;
+	  if (r_type == R_SPARC_TLS_LE_HIX22)
+	    *reloc_addr = (*reloc_addr & 0xffc00000) | ((~value) >> 10);
+	  else
+	    *reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff)
+	      | 0x1c00;
+	}
+      break;
 # endif
 #endif
 #ifndef RTLD_BOOTSTRAP
-	case R_SPARC_8:
-	  *(char *) reloc_addr = value;
-	  break;
-	case R_SPARC_16:
-	  *(short *) reloc_addr = value;
-	  break;
-	case R_SPARC_DISP8:
-	  *(char *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
-	  break;
-	case R_SPARC_DISP16:
-	  *(short *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
-	  break;
-	case R_SPARC_DISP32:
-	  *reloc_addr = (value - (Elf32_Addr) reloc_addr);
-	  break;
-	case R_SPARC_LO10:
-	  *reloc_addr = (*reloc_addr & ~0x3ff) | (value & 0x3ff);
-	  break;
-	case R_SPARC_WDISP30:
-	  *reloc_addr = ((*reloc_addr & 0xc0000000)
-			 | ((value - (unsigned int) reloc_addr) >> 2));
-	  break;
-	case R_SPARC_HI22:
-	  *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
-	  break;
-	case R_SPARC_UA16:
-	  ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
-	  ((unsigned char *) reloc_addr_arg) [1] = value;
-	  break;
-	case R_SPARC_UA32:
-	  ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
-	  ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
-	  ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
-	  ((unsigned char *) reloc_addr_arg) [3] = value;
-	  break;
+    case R_SPARC_8:
+      *(char *) reloc_addr = value;
+      break;
+    case R_SPARC_16:
+      *(short *) reloc_addr = value;
+      break;
+    case R_SPARC_DISP8:
+      *(char *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+      break;
+    case R_SPARC_DISP16:
+      *(short *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+      break;
+    case R_SPARC_DISP32:
+      *reloc_addr = (value - (Elf32_Addr) reloc_addr);
+      break;
+    case R_SPARC_LO10:
+      *reloc_addr = (*reloc_addr & ~0x3ff) | (value & 0x3ff);
+      break;
+    case R_SPARC_WDISP30:
+      *reloc_addr = ((*reloc_addr & 0xc0000000)
+		     | ((value - (unsigned int) reloc_addr) >> 2));
+      break;
+    case R_SPARC_HI22:
+      *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
+      break;
+    case R_SPARC_UA16:
+      ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
+      ((unsigned char *) reloc_addr_arg) [1] = value;
+      break;
+    case R_SPARC_UA32:
+      ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
+      ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
+      ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
+      ((unsigned char *) reloc_addr_arg) [3] = value;
+      break;
 #endif
-	case R_SPARC_NONE:		/* Alright, Wilbur.  */
-	  break;
 #if !defined RTLD_BOOTSTRAP || defined _NDEBUG
-	default:
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
+    default:
+      _dl_reloc_bad_type (map, r_type, 0);
+      break;
 #endif
-	}
     }
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
 			   void *const reloc_addr_arg)
 {
@@ -601,7 +555,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
   *reloc_addr += l_addr + reloc->r_addend;
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf32_Addr l_addr, const Elf32_Rela *reloc)
 {
@@ -617,4 +572,4 @@ elf_machine_lazy_rel (struct link_map *map,
     }
 }
 
-#endif	/* RESOLVE */
+#endif	/* RESOLVE_MAP */
diff --git a/sysdeps/sparc/sparc32/dl-trampoline.S b/sysdeps/sparc/sparc32/dl-trampoline.S
new file mode 100644
index 0000000000..b0f86dda4e
--- /dev/null
+++ b/sysdeps/sparc/sparc32/dl-trampoline.S
@@ -0,0 +1,184 @@
+/* PLT trampolines.  Sparc 32-bit version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+	.align	32
+
+	/* %g1:	PLT offset loaded by PLT entry
+	 * %g2: callers PC, which is PLT0 + 4, and we store the
+	 *      link map at PLT0 + 12, therefore we add 8 to get
+	 *      the address of the link map
+	 */
+	.globl	_dl_runtime_resolve
+	.type	_dl_runtime_resolve, @function
+_dl_runtime_resolve:
+	cfi_startproc
+
+	save	%sp, -104, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register (%o7, %i7)
+
+	ld	[%g2 + 8], %o0
+	srl	%g1, 10, %o1
+	call	_dl_fixup
+	 sub	%o1, 4*12, %o1
+	jmp	%o0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_runtime_resolve, .-_dl_runtime_resolve
+
+	/* For the profiling cases we pass in our stack frame
+	 * as the base of the La_sparc64_regs, so it looks
+	 * like:
+	 *	%l0			%sp
+	 *	...
+	 *	%l7			%sp + (7 * 8)
+	 *	%i0			%sp + (8 * 8)
+	 *	...
+	 *	%i7			%sp + (15 * 8)
+	 *	%f0			%sp + (16 * 8)
+	 *	%f16			%sp + (31 * 8)
+	 *	framesize		%sp + (32 * 8)
+	 */
+
+	.globl	_dl_profile_save_regs
+	.type	_dl_profile_save_regs, @function
+_dl_profile_save_regs:
+	cfi_startproc
+
+	std	%l0, [%sp + ( 0 * 8)]
+	std	%l2, [%sp + ( 1 * 8)]
+	std	%l4, [%sp + ( 2 * 8)]
+	std	%l6, [%sp + ( 3 * 8)]
+	std	%i0, [%sp + ( 4 * 8)]
+	std	%i2, [%sp + ( 5 * 8)]
+	std	%i4, [%sp + ( 6 * 8)]
+	std	%i6, [%sp + ( 7 * 8)]
+	ld	[%sp + (8 * 8)], %l4
+	retl
+	 st	%l4, [%sp + (8 * 8)]
+
+	cfi_endproc
+
+	.size	_dl_profile_save_regs, .-_dl_profile_save_regs
+
+	/* If we are going to call pltexit, then we must replicate
+	 * the caller's stack frame.
+	 * %o0: PLT resolved function address
+	 */
+	.globl	_dl_profile_invoke
+	.type	_dl_profile_invoke, @function
+_dl_profile_invoke:
+	cfi_startproc
+
+	sub	%sp, %l0, %sp
+1:
+	srl	%l0, 3, %l7
+	mov	%o0, %l1
+	mov	%i0, %o0
+	mov	%i1, %o1
+	mov	%i2, %o2
+	mov	%i3, %o3
+	mov	%i4, %o4
+	mov	%i5, %o5
+	mov	%fp, %l2
+	mov	%sp, %l3
+1:	ldd	[%l2], %g2
+	add	%l2, 0x8, %l2
+	subcc	%l7, 1, %l7
+	std	%g2, [%l3]
+	bne	1b
+	 add	%l3, 0x8, %l3
+
+	jmpl	%l1, %o7
+	 nop
+
+	std	%o0, [%sp + ( 9 * 8)]
+	std	%f0, [%sp + (10 * 8)]
+
+	mov	%l5, %o0
+	mov	%l6, %o1
+	add	%sp, %l0, %o2
+	call	_dl_call_pltexit
+	 add	%sp, (16 * 8), %o3
+
+	ldd	[%sp + (9 * 8)], %i0
+
+	jmpl	%i7 + 8, %g0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_profile_invoke, .-_dl_profile_invoke
+
+	/* %g1:	PLT offset loaded by PLT entry
+	 * %g2: callers PC, which is PLT0 + 4, and we store the
+	 *      link map at PLT0 + 12, therefore we add 8 to get
+	 *      the address of the link map
+	 */
+	.align	32
+	.globl	_dl_runtime_profile
+	.type	_dl_runtime_profile, @function
+_dl_runtime_profile:
+	cfi_startproc
+
+	cmp	%fp, 0
+	be,a	1f
+	 mov	104, %g3
+	sub	%fp, %sp, %g3
+1:	save	%sp, -104, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
+	ld	[%g2 + 8], %o0
+	srl	%g1, 10, %o1
+	mov	%i7, %o2
+	sub	%o1, 4*12, %o1
+
+	mov	%g3, %l0
+	mov	%o0, %l5
+	mov	%o1, %l6
+
+	call _dl_profile_save_regs
+	 nop
+
+	mov	%sp, %o3
+	call	_dl_profile_fixup
+	 add	%sp, (9 * 8), %o4
+
+	ld	[%sp + (9 * 8)], %o1
+	cmp	%o1, 0
+	bgeu	1f
+	 nop
+	
+	call	_dl_profile_invoke
+	 nop
+
+1:	jmp	%o0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_runtime_profile, .-_dl_runtime_profile
diff --git a/sysdeps/sparc/sparc32/elf/start.S b/sysdeps/sparc/sparc32/elf/start.S
index 2787fd27f8..702dd755e6 100644
--- a/sysdeps/sparc/sparc32/elf/start.S
+++ b/sysdeps/sparc/sparc32/elf/start.S
@@ -48,6 +48,7 @@
 	.global _start
 	.type _start,#function
 _start:
+	cfi_startproc
 
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
@@ -59,6 +60,7 @@ _start:
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*4, %sp
+	cfi_adjust_cfa_offset(6*4)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP.  */
@@ -91,4 +93,12 @@ _start:
   /* Die very horribly if exit returns.  */
 	unimp
 
+	cfi_endproc
+
 	.size _start, .-_start
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl	__data_start
+__data_start:
+weak_alias (__data_start, data_start)
diff --git a/sysdeps/sparc/sparc32/fpu/e_sqrtl.c b/sysdeps/sparc/sparc32/fpu/e_sqrtl.c
new file mode 100644
index 0000000000..3c3acfee02
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/e_sqrtl.c
@@ -0,0 +1 @@
+/* __ieee754_sqrtl is defined in q_sqrt.c.  */
diff --git a/sysdeps/sparc/sparc32/fpu/libm-test-ulps b/sysdeps/sparc/sparc32/fpu/libm-test-ulps
index 979e0e2c91..ccf53788a6 100644
--- a/sysdeps/sparc/sparc32/fpu/libm-test-ulps
+++ b/sysdeps/sparc/sparc32/fpu/libm-test-ulps
@@ -4,32 +4,49 @@
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
 float: 3
 ifloat: 3
+ildouble: 1
+ldouble: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
 float: 3
 ifloat: 3
+ildouble: 1
+ldouble: 1
 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
 float: 1
 ifloat: 1
 
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
 ifloat: 3
+ildouble: 1
+ldouble: 1
 
 # casin
 Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
@@ -37,6 +54,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
 
 # casinh
 Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
@@ -44,19 +64,27 @@ double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 2
+ldouble: 2
 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # catan
 Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
@@ -70,6 +98,9 @@ ifloat: 1
 Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
 float: 4
 ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
 
 # catanh
 Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
@@ -81,11 +112,18 @@ ifloat: 4
 Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
 Test "cbrt (-27.0) == -3.0":
 double: 1
 idouble: 1
@@ -97,9 +135,14 @@ double: 1
 idouble: 1
 
 # ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
 double: 1
 float: 1
@@ -113,9 +156,13 @@ ifloat: 1
 Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
 double: 1
 float: 1
@@ -126,12 +173,20 @@ float: 1
 ifloat: 1
 
 # cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
 
 # clog
 Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
@@ -140,57 +195,98 @@ ifloat: 3
 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 
 # cos
@@ -199,16 +295,22 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "cos (M_PI_6l * 4.0) == -0.5":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "cos (pi/2) == 0":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # cpow
 Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
@@ -222,16 +324,31 @@ double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 4
+ldouble: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
 double: 2
 float: 3
 idouble: 2
 ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 3
+ldouble: 3
 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 float: 2
 ifloat: 2
@@ -240,8 +357,21 @@ double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
 
 # csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
 double: 1
 idouble: 1
@@ -256,17 +386,31 @@ ifloat: 1
 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
 
 # ctan
 Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 # ctanh
 Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
@@ -274,6 +418,11 @@ double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
 float: 1
 ifloat: 1
@@ -290,6 +439,9 @@ idouble: 1
 Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
 double: 1
 idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
 Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
 double: 1
 idouble: 1
@@ -310,14 +462,30 @@ double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
 
 # expm1
 Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
 double: 1
 idouble: 1
 Test "expm1 (1) == M_El - 1.0":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 
 # hypot
 Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
@@ -359,9 +527,13 @@ double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "j0 (2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -370,17 +542,32 @@ ifloat: 1
 Test "j0 (8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j1 (2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "j1 (8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
 
 # jn
 Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
@@ -396,9 +583,13 @@ double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -407,30 +598,57 @@ ifloat: 1
 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
 double: 4
 float: 3
 idouble: 4
 ifloat: 3
+ildouble: 2
+ldouble: 2
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
 float: 4
 ifloat: 4
@@ -449,6 +667,8 @@ double: 3
 float: 1
 idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
 float: 2
@@ -456,16 +676,23 @@ idouble: 1
 ifloat: 2
 
 # lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # log10
 Test "log10 (0.75) == -0.124938736608299953132449886193870744":
@@ -476,11 +703,21 @@ ifloat: 2
 Test "log10 (e) == log10(e)":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # log1p
 Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
 float: 1
 ifloat: 1
+Test "log1p (M_El - 1.0) == 1":
+ildouble: 1
+ldouble: 1
+
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
 
 # sincos
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
@@ -488,31 +725,58 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
 float: 1
 ifloat: 1
 
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
 # tan
 Test "tan (pi/4) == 1":
 double: 1
 idouble: 1
 
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+
 # tgamma
 Test "tgamma (-0.5) == -2 sqrt (pi)":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "tgamma (0.5) == sqrt (pi)":
 float: 1
 ifloat: 1
@@ -521,6 +785,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
 
 # y0
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
@@ -536,19 +803,28 @@ ifloat: 1
 Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "y0 (8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 # y1
 Test "y1 (0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -559,11 +835,15 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # yn
 Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
@@ -579,17 +859,26 @@ ifloat: 1
 Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -600,30 +889,44 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 5
+ldouble: 5
 Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
 double: 2
 idouble: 2
+ildouble: 2
+ldouble: 2
 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
 double: 1
 idouble: 1
@@ -632,11 +935,15 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
 double: 1
 idouble: 1
@@ -645,22 +952,32 @@ idouble: 1
 Function: "atan2":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 Function: "atanh":
 float: 1
 ifloat: 1
 
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "cacosh":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
+ildouble: 5
+ldouble: 5
 
 Function: Imaginary part of "cacosh":
 double: 1
 float: 3
 idouble: 1
 ifloat: 3
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "casin":
 double: 1
@@ -668,17 +985,25 @@ float: 1
 idouble: 1
 ifloat: 1
 
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "casinh":
 double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 
 Function: Imaginary part of "casinh":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "catan":
 float: 4
@@ -689,50 +1014,72 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "catanh":
 double: 4
 idouble: 4
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "catanh":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 Function: "cbrt":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccos":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccosh":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccosh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "clog":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "clog":
 float: 3
@@ -741,34 +1088,54 @@ ifloat: 3
 Function: Real part of "clog10":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "clog10":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 
 Function: "cos":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cpow":
 double: 2
 float: 4
 idouble: 2
 ifloat: 4
+ildouble: 10
+ldouble: 10
 
 Function: Imaginary part of "cpow":
 double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "csinh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "csinh":
 double: 1
@@ -779,24 +1146,38 @@ ifloat: 1
 Function: Real part of "csqrt":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ctan":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctan":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "ctanh":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctanh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "erf":
 double: 1
@@ -805,18 +1186,32 @@ idouble: 1
 Function: "erfc":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: "exp10":
 double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
 
 Function: "expm1":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
 
 Function: "hypot":
 float: 1
@@ -827,67 +1222,101 @@ double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 Function: "j1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 4
+ldouble: 4
 
 Function: "jn":
 double: 4
 float: 4
 idouble: 4
 ifloat: 4
+ildouble: 4
+ldouble: 4
 
 Function: "lgamma":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log10":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log1p":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
 
 Function: "sincos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
 
 Function: "tan":
 double: 1
 idouble: 1
 
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
 Function: "tgamma":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "y0":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 Function: "y1":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "yn":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 5
+ldouble: 5
 
 # end of automatic generation
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabs.c b/sysdeps/sparc/sparc32/fpu/s_fabs.c
new file mode 100644
index 0000000000..b883e6e862
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabs.c
@@ -0,0 +1,11 @@
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+double __fabs (double x)
+{
+  return __builtin_fabs (x);
+}
+weak_alias (__fabs, fabs)
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabsf.S b/sysdeps/sparc/sparc32/fpu/s_fabsf.S
new file mode 100644
index 0000000000..e1487247d1
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabsf.S
@@ -0,0 +1,29 @@
+/* Float absolute value, sparc32 version.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+ENTRY (__fabsf)
+	st	%o0, [%sp+64]
+	ld	[%sp+64], %f0
+	retl
+	 fabss	%f0, %f0
+END (__fabsf)
+weak_alias (__fabsf, fabsf)
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabsl.c b/sysdeps/sparc/sparc32/fpu/s_fabsl.c
new file mode 100644
index 0000000000..3c03b92828
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabsl.c
@@ -0,0 +1,8 @@
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+long double __fabsl (long double x)
+{
+  return __builtin_fabsl (x);
+}
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/sparc/sparc32/jmpbuf-offsets.h b/sysdeps/sparc/sparc32/jmpbuf-offsets.h
new file mode 100644
index 0000000000..1c6f7a9d17
--- /dev/null
+++ b/sysdeps/sparc/sparc32/jmpbuf-offsets.h
@@ -0,0 +1,22 @@
+/* Private macros for accessing __jmp_buf contents.  SPARC version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define JB_SP	0
+#define JB_FP	1
+#define JB_PC	2
diff --git a/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
new file mode 100644
index 0000000000..0f317b99d0
--- /dev/null
+++ b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((int) (address) < demangle ((jmpbuf)[JB_SP]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_SP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal lobngjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/sparc/sparc32/memchr.S b/sysdeps/sparc/sparc32/memchr.S
index 0ca56ccdd9..fcd98315db 100644
--- a/sysdeps/sparc/sparc32/memchr.S
+++ b/sysdeps/sparc/sparc32/memchr.S
@@ -32,7 +32,15 @@
 
 	.text
 	.align		4
-0:	cmp		%o2, 0
+ENTRY(__memchr)
+	andcc		%o1, 0xff, %o1
+	sll		%o1, 8, %g6
+	andcc		%o0, 3, %g0
+	or		%o1, %g6, %g6
+	sll		%g6, 16, %o3
+	be		10f
+	 or		%o3, %g6, %g2
+	cmp		%o2, 0
 	be		9f
 	 sethi		%hi(0x80808080), %o4
 	ldub		[%o0], %g4
@@ -64,16 +72,7 @@
 	 clr		%o0
 1:	retl
 	 sub		%o0, 1, %o0
-
-ENTRY(__memchr)
-	andcc		%o1, 0xff, %o1
-	sll		%o1, 8, %g6
-	andcc		%o0, 3, %g0
-	or		%o1, %g6, %g6
-	sll		%g6, 16, %o3
-	bne		0b
-	 or		%o3, %g6, %g2
-	sethi		%hi(0x80808080), %o4
+10:	sethi		%hi(0x80808080), %o4
 	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o5
 5:	and		%o2, 3, %g1
diff --git a/sysdeps/sparc/sparc32/memcpy.S b/sysdeps/sparc/sparc32/memcpy.S
index 35bcef4963..6bd55c06a1 100644
--- a/sysdeps/sparc/sparc32/memcpy.S
+++ b/sysdeps/sparc/sparc32/memcpy.S
@@ -146,28 +146,12 @@
 	.text
 	.align	4
 
-70:	andcc		%o1, 1, %g0
-	be		4f
-	 andcc		%o1, 2, %g0
-
-	ldub		[%o1 - 1], %g2
-	sub		%o1, 1, %o1
-	stb		%g2, [%o0 - 1]
-	sub		%o2, 1, %o2
-	be		3f
-	 sub		%o0, 1, %o0
-4:	lduh		[%o1 - 2], %g2
-	sub		%o1, 2, %o1
-	sth		%g2, [%o0 - 2]
-	sub		%o2, 2, %o2
-	b		3f
-	 sub		%o0, 2, %o0
-
 ENTRY(bcopy)
 	mov		%o0, %o3
 	mov		%o1, %o0
 	mov		%o3, %o1
 END(bcopy)
+
 ENTRY(memmove)
 	cmp		%o0, %o1
 	st		%o0, [%sp + 64]
@@ -185,8 +169,26 @@ ENTRY(memmove)
 	 cmp		%o2, 15
 	bleu		91f
 	 andcc		%o1, 3, %g0
-	bne		70b
-3:	 andcc		%o1, 4, %g0
+	be		3f
+	 nop
+
+	andcc		%o1, 1, %g0
+	be		4f
+	 andcc		%o1, 2, %g0
+
+	ldub		[%o1 - 1], %g2
+	sub		%o1, 1, %o1
+	stb		%g2, [%o0 - 1]
+	sub		%o2, 1, %o2
+	be		3f
+	 sub		%o0, 1, %o0
+4:	lduh		[%o1 - 2], %g2
+	sub		%o1, 2, %o1
+	sth		%g2, [%o0 - 2]
+	sub		%o2, 2, %o2
+	sub		%o0, 2, %o0
+
+3:	andcc		%o1, 4, %g0
 
 	be		2f
 	 mov		%o2, %g1
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index 8e91e998bf..e6204e8ac9 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -152,4 +152,4 @@ ENTRY(memset)
 END(memset)
 libc_hidden_builtin_def (memset)
 
-weak_alias(__bzero, bzero)
+weak_alias (__bzero, bzero)
diff --git a/sysdeps/sparc/sparc32/setjmp.S b/sysdeps/sparc/sparc32/setjmp.S
index 883ea06297..0a5d3cece8 100644
--- a/sysdeps/sparc/sparc32/setjmp.S
+++ b/sysdeps/sparc/sparc32/setjmp.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 93, 94, 96, 97, 98, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1994, 1996, 1997, 1998, 2002, 2006
+   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
@@ -19,9 +20,7 @@
 #include <sysdep.h>
 #include <sys/trap.h>
 
-#define _ASM 1
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
 ENTRY(_setjmp)
 	b	1f
@@ -39,9 +38,18 @@ ENTRY (__sigsetjmp)
 	   a tail-call for simplicity; it always returns zero.  */
 	ta	ST_FLUSH_WINDOWS
 
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%g1, %o7, %g4)
+	PTR_MANGLE2 (%g2, %sp, %g4)
+	PTR_MANGLE2 (%g3, %fp, %g4)
+	st	%g1, [%o0 + (JB_PC * 4)]
+	st	%g2, [%o0 + (JB_SP * 4)]
+	st	%g3, [%o0 + (JB_FP * 4)]
+#else
 	st	%o7, [%o0 + (JB_PC * 4)]
 	st	%sp, [%o0 + (JB_SP * 4)]
 	st	%fp, [%o0 + (JB_FP * 4)]
+#endif
 
 	mov	%o7, %g1
 	call	__sigjmp_save
diff --git a/sysdeps/sparc/sparc32/soft-fp/Dist b/sysdeps/sparc/sparc32/soft-fp/Dist
deleted file mode 100644
index b3c7344889..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/Dist
+++ /dev/null
@@ -1,28 +0,0 @@
-q_add.c
-q_cmp.c
-q_cmpe.c
-q_div.c
-q_dtoq.c
-q_feq.c
-q_fge.c
-q_fgt.c
-q_fle.c
-q_flt.c
-q_fne.c
-q_itoq.c
-q_mul.c
-q_neg.c
-q_qtod.c
-q_qtoi.c
-q_qtos.c
-q_qtoui.c
-q_qtoux.c
-q_qtox.c
-q_sqrt.c
-q_stoq.c
-q_sub.c
-q_uitoq.c
-q_util.c
-q_uxtoq.c
-q_xtoq.c
-sfp-machine.h
diff --git a/sysdeps/sparc/sparc32/soft-fp/Makefile b/sysdeps/sparc/sparc32/soft-fp/Makefile
index bba9bf7f86..d447b48285 100644
--- a/sysdeps/sparc/sparc32/soft-fp/Makefile
+++ b/sysdeps/sparc/sparc32/soft-fp/Makefile
@@ -1,6 +1,6 @@
 #  Software floating-point emulation.
 #  Makefile for SPARC v8 long double utility functions (_Q_*).
-#  Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+#  Copyright (C) 1999, 2000, 2006 Free Software Foundation, Inc.
 #  This file is part of the GNU C Library.
 #  Contributed by Jakub Jelinek (jj@ultra.linux.cz).
 #
@@ -20,13 +20,11 @@
 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # 02111-1307 USA.
 
-#  Currently gcc does not support TFmode long double on sparc32
-#  so these routines are not used.
-#ifeq ($(subdir),soft-fp)
-#sparc32-quad-routines := q_add q_cmp q_cmpe q_div q_dtoq q_feq q_fge	\
-#	q_fgt q_fle q_flt q_fne q_itoq q_mul q_neg q_qtod q_qtoi	\
-#	q_qtos q_qtoui q_qtoux q_qtox q_sqrt q_stoq q_sub q_uitoq	\
-#	q_uxtoq q_xtoq q_util
-#sysdep_routines += $(sparc32-quad-routines)
-#
-#endif
+ifeq ($(subdir),soft-fp)
+sparc32-quad-routines := q_add q_cmp q_cmpe q_div q_dtoq q_feq q_fge	\
+	q_fgt q_fle q_flt q_fne q_itoq q_mul q_neg q_qtod q_qtoi	\
+	q_qtos q_qtou q_qtoull q_qtoll q_sqrt q_stoq q_sub q_utoq	\
+	q_ulltoq q_lltoq q_util
+sysdep_routines += $(sparc32-quad-routines)
+
+endif
diff --git a/sysdeps/sparc/sparc32/soft-fp/Versions b/sysdeps/sparc/sparc32/soft-fp/Versions
new file mode 100644
index 0000000000..6a09249c46
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/Versions
@@ -0,0 +1,8 @@
+libc {
+  GLIBC_2.4 {
+    _Q_add; _Q_cmp; _Q_cmpe; _Q_div; _Q_dtoq; _Q_feq; _Q_fge; _Q_fgt;
+    _Q_fle; _Q_flt; _Q_fne; _Q_itoq; _Q_mul; _Q_neg; _Q_qtod; _Q_qtoi;
+    _Q_qtos; _Q_qtou; _Q_qtoull; _Q_qtoll; _Q_sqrt; _Q_stoq; _Q_sub;
+    _Q_utoq; _Q_ulltoq; _Q_lltoq;
+  }
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_add.c b/sysdeps/sparc/sparc32/soft-fp/q_add.c
index fb93461593..987c725582 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_add.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_add.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return a + b
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,10 +30,10 @@ long double _Q_add(const long double a, const long double b)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_ADD_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_div.c b/sysdeps/sparc/sparc32/soft-fp/q_div.c
index bb4e697236..86db5ed9e9 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_div.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_div.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return a / b
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -35,5 +35,5 @@ long double _Q_div(const long double a, const long double b)
   FP_DIV_Q(C, A, B);
   FP_PACK_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
-  return long double;
+  return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c
index 5cac5c0840..6b119f4501 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ long double _Q_dtoq(const double a)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_D(A, a);
+  FP_UNPACK_RAW_D(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,D,4,2,C,A);
+  FP_EXTEND(Q,D,4,2,C,A);
 #else
-  FP_CONV(Q,D,2,1,C,A);
+  FP_EXTEND(Q,D,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_itoq.c b/sysdeps/sparc/sparc32/soft-fp/q_itoq.c
index 0010b3bcbf..b50942f75f 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_itoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_itoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,8 +30,8 @@ long double _Q_itoq(const int a)
   int b = a;
   long double c;
 
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_lltoq.c b/sysdeps/sparc/sparc32/soft-fp/q_lltoq.c
new file mode 100644
index 0000000000..f977585e42
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/q_lltoq.c
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Return (long double)a
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson (rth@cygnus.com) and
+		  Jakub Jelinek (jj@ultra.linux.cz).
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+long double _Q_lltoq(const long long a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(C);
+  long double c;
+  long long b = a;
+
+  FP_FROM_INT_Q(C, b, 64, unsigned long long);
+  FP_PACK_RAW_Q(c, C);
+  FP_CLEAR_EXCEPTIONS;
+  FP_HANDLE_EXCEPTIONS;
+  return c;
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtod.c b/sysdeps/sparc/sparc32/soft-fp/q_qtod.c
index b0778476b8..82b01ec8a1 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtod.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtod.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (double)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ double _Q_qtod(const long double a)
   double r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(D,Q,2,4,R,A);
+  FP_TRUNC(D,Q,2,4,R,A);
 #else
-  FP_CONV(D,Q,1,2,R,A);
+  FP_TRUNC(D,Q,1,2,R,A);
 #endif
-  FP_PACK_D(r, R);
+  FP_PACK_SEMIRAW_D(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c
index 0440e9abba..270ba9f677 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (int)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -28,9 +28,9 @@ int _Q_qtoi(const long double a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  int r;
+  unsigned int r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 32, 1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoll.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoll.c
new file mode 100644
index 0000000000..e0d29019b3
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoll.c
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Return (long long)a
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson (rth@cygnus.com) and
+		  Jakub Jelinek (jj@ultra.linux.cz).
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define FP_ROUNDMODE FP_RND_ZERO
+#include "soft-fp.h"
+#include "quad.h"
+
+long long _Q_qtoll(const long double a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  unsigned long long r;
+
+  FP_UNPACK_RAW_Q(A, a);
+  FP_TO_INT_Q(r, A, 64, 1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtos.c b/sysdeps/sparc/sparc32/soft-fp/q_qtos.c
index 31c8d6ac82..93daa23cac 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtos.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtos.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (float)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ float _Q_qtos(const long double a)
   float r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(S,Q,1,4,R,A);
+  FP_TRUNC(S,Q,1,4,R,A);
 #else
-  FP_CONV(S,Q,1,2,R,A);
+  FP_TRUNC(S,Q,1,2,R,A);
 #endif
-  FP_PACK_S(r, R);
+  FP_PACK_SEMIRAW_S(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtou.c b/sysdeps/sparc/sparc32/soft-fp/q_qtou.c
new file mode 100644
index 0000000000..812b4e06ea
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtou.c
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Return (unsigned int)a
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson (rth@cygnus.com) and
+		  Jakub Jelinek (jj@ultra.linux.cz).
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define FP_ROUNDMODE FP_RND_ZERO
+#include "soft-fp.h"
+#include "quad.h"
+
+unsigned int _Q_qtou(const long double a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  unsigned int r;
+
+  FP_UNPACK_RAW_Q(A, a);
+  FP_TO_INT_Q(r, A, 32, -1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c
deleted file mode 100644
index bdbf052e09..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Software floating-point emulation.
-   Return (unsigned int)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Richard Henderson (rth@cygnus.com) and
-		  Jakub Jelinek (jj@ultra.linux.cz).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define FP_ROUNDMODE FP_RND_ZERO
-#include "soft-fp.h"
-#include "quad.h"
-
-unsigned int _Q_qtoui(const long double a)
-{
-  FP_DECL_EX;
-  FP_DECL_Q(A);
-  unsigned int r;
-
-  FP_UNPACK_Q(A, a);
-  FP_TO_INT_Q(r, A, 32, -1);
-  FP_HANDLE_EXCEPTIONS;
-
-  return r;
-}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoull.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoull.c
new file mode 100644
index 0000000000..7a88c9f382
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoull.c
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Return (unsigned long long)a
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson (rth@cygnus.com) and
+		  Jakub Jelinek (jj@ultra.linux.cz).
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define FP_ROUNDMODE FP_RND_ZERO
+#include "soft-fp.h"
+#include "quad.h"
+
+unsigned long long _Q_qtoull(const long double a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(A);
+  unsigned long long r;
+
+  FP_UNPACK_RAW_Q(A, a);
+  FP_TO_INT_Q(r, A, 64, -1);
+  FP_HANDLE_EXCEPTIONS;
+
+  return r;
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c
deleted file mode 100644
index 3e6d40f220..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Software floating-point emulation.
-   Return (unsigned long)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Richard Henderson (rth@cygnus.com) and
-		  Jakub Jelinek (jj@ultra.linux.cz).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define FP_ROUNDMODE FP_RND_ZERO
-#include "soft-fp.h"
-#include "quad.h"
-
-unsigned long long _Q_qtoux(const long double a)
-{
-  FP_DECL_EX;
-  FP_DECL_Q(A);
-  unsigned long long r;
-
-  FP_UNPACK_Q(A, a);
-  FP_TO_INT_Q(r, A, 64, -1);
-  FP_HANDLE_EXCEPTIONS;
-
-  return r;
-}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtox.c b/sysdeps/sparc/sparc32/soft-fp/q_qtox.c
deleted file mode 100644
index 108373328e..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtox.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Software floating-point emulation.
-   Return (long)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Richard Henderson (rth@cygnus.com) and
-		  Jakub Jelinek (jj@ultra.linux.cz).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define FP_ROUNDMODE FP_RND_ZERO
-#include "soft-fp.h"
-#include "quad.h"
-
-long long _Q_qtox(const long double a)
-{
-  FP_DECL_EX;
-  FP_DECL_Q(A);
-  long long r;
-
-  FP_UNPACK_Q(A, a);
-  FP_TO_INT_Q(r, A, 64, 1);
-  FP_HANDLE_EXCEPTIONS;
-
-  return r;
-}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
index 7516ed7c5c..373d02a639 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return sqrtl(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -36,3 +36,4 @@ long double _Q_sqrt(const long double a)
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
+strong_alias (_Q_sqrt, __ieee754_sqrtl);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_stoq.c b/sysdeps/sparc/sparc32/soft-fp/q_stoq.c
index 98609faf20..714d880dd7 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_stoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_stoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,13 +31,13 @@ long double _Q_stoq(const float a)
   FP_DECL_Q(C);
   long double c;
 
-  FP_UNPACK_S(A, a);
+  FP_UNPACK_RAW_S(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,S,4,1,C,A);
+  FP_EXTEND(Q,S,4,1,C,A);
 #else
-  FP_CONV(Q,S,2,1,C,A);
+  FP_EXTEND(Q,S,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_sub.c b/sysdeps/sparc/sparc32/soft-fp/q_sub.c
index 1987aea480..8616727bb1 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_sub.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_sub.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = a - b
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,10 +30,10 @@ long double _Q_sub(const long double a, const long double b)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_SUB_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c b/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c
deleted file mode 100644
index b716fabde2..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Software floating-point emulation.
-   c = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Richard Henderson (rth@cygnus.com) and
-		  Jakub Jelinek (jj@ultra.linux.cz).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "quad.h"
-
-long double _Q_uitoq(const unsigned int a)
-{
-  FP_DECL_EX;
-  FP_DECL_Q(C);
-  long double c;
-  unsigned int b = a;
-
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_Q(c, C);
-  FP_CLEAR_EXCEPTIONS;
-  FP_HANDLE_EXCEPTIONS;
-  return c;
-}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c b/sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c
new file mode 100644
index 0000000000..53c0add2d8
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   Return (long double)(a)
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson (rth@cygnus.com) and
+		  Jakub Jelinek (jj@ultra.linux.cz).
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+long double _Q_ulltoq(const unsigned long long a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(C);
+  long double c;
+  unsigned long long b = a;
+
+  FP_FROM_INT_Q(C, b, 64, unsigned long long);
+  FP_PACK_RAW_Q(c, C);
+  FP_CLEAR_EXCEPTIONS;
+  FP_HANDLE_EXCEPTIONS;
+  return c;
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_utoq.c b/sysdeps/sparc/sparc32/soft-fp/q_utoq.c
new file mode 100644
index 0000000000..f902bf8397
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/q_utoq.c
@@ -0,0 +1,38 @@
+/* Software floating-point emulation.
+   c = (long double)(a)
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson (rth@cygnus.com) and
+		  Jakub Jelinek (jj@ultra.linux.cz).
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "soft-fp.h"
+#include "quad.h"
+
+long double _Q_utoq(const unsigned int a)
+{
+  FP_DECL_EX;
+  FP_DECL_Q(C);
+  long double c;
+  unsigned int b = a;
+
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_Q(c, C);
+  FP_CLEAR_EXCEPTIONS;
+  FP_HANDLE_EXCEPTIONS;
+  return c;
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c
deleted file mode 100644
index 8944e9614d..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Software floating-point emulation.
-   Return (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Richard Henderson (rth@cygnus.com) and
-		  Jakub Jelinek (jj@ultra.linux.cz).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "quad.h"
-
-long double _Q_uxtoq(const unsigned long long a)
-{
-  FP_DECL_EX;
-  FP_DECL_Q(C);
-  long double c;
-  unsigned long long b = a;
-
-  FP_FROM_INT_Q(C, b, 64, long long);
-  FP_PACK_Q(c, C);
-  FP_CLEAR_EXCEPTIONS;
-  FP_HANDLE_EXCEPTIONS;
-  return c;
-}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c
deleted file mode 100644
index 867ef27131..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Software floating-point emulation.
-   Return (long double)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Richard Henderson (rth@cygnus.com) and
-		  Jakub Jelinek (jj@ultra.linux.cz).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include "soft-fp.h"
-#include "quad.h"
-
-long double _Q_xtoq(const long long a)
-{
-  FP_DECL_EX;
-  FP_DECL_Q(C);
-  long double c;
-  long long b = a;
-
-  FP_FROM_INT_Q(C, b, 64, long long);
-  FP_PACK_Q(c, C);
-  FP_CLEAR_EXCEPTIONS;
-  FP_HANDLE_EXCEPTIONS;
-  return c;
-}
diff --git a/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
index 40bcbb4762..f1211705ef 100644
--- a/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
+++ b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent software floating-point definitions.
    Sparc userland (_Q_*) version.
-   Copyright (C) 1997,1998,1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999, 2002, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz) and
@@ -22,6 +22,7 @@
    02111-1307 USA.  */
 
 #include <fpu_control.h>
+#include <stdlib.h>
 
 #define _FP_W_TYPE_SIZE		32
 #define _FP_W_TYPE		unsigned long
@@ -208,14 +209,5 @@ do {								\
       	" : : "r" (___Q_numbers) : "f30");			\
     }								\
   else								\
-    {								\
-      __asm__ __volatile__("\
-        mov %0, %%o0\n\
-        mov %%o7, %%g1\n\
-        call ___Q_simulate_exceptions\n\
-         mov %%g1, %%o7\
-        " : : "r" (_fex) :					\
-        "g1", "g2", "g3", "g4", "g5", "o0", 			\
-        "o1", "o2", "o3", "o4", "o5", "cc");			\
-    }								\
+    ___Q_simulate_exceptions (_fex);			        \
 } while (0)
diff --git a/sysdeps/sparc/sparc32/sparcv8/Dist b/sysdeps/sparc/sparc32/sparcv8/Dist
deleted file mode 100644
index 6318172684..0000000000
--- a/sysdeps/sparc/sparc32/sparcv8/Dist
+++ /dev/null
@@ -1,6 +0,0 @@
-urem.S
-umul.S
-udiv.S
-sdiv.S
-rem.S
-dotmul.S
diff --git a/sysdeps/sparc/sparc32/sparcv9/Dist b/sysdeps/sparc/sparc32/sparcv9/Dist
deleted file mode 100644
index 2de64957fb..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-dotmul.S
-hp-timing.c
-rem.S
-sdiv.S
-udiv.S
-umul.S
-urem.S
diff --git a/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h b/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
index 6d316f37d5..7b9d61d468 100644
--- a/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
+++ b/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
@@ -1,5 +1,5 @@
 /* Atomic operations.  sparcv9 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -59,7 +59,7 @@ typedef uintmax_t uatomic_max_t;
   __asm __volatile ("cas [%4], %2, %0"					      \
 		    : "=r" (__acev_tmp), "=m" (*__acev_mem)		      \
 		    : "r" (oldval), "m" (*__acev_mem), "r" (__acev_mem),      \
-		      "0" (newval));					      \
+		      "0" (newval) : "memory");				      \
   __acev_tmp; })
 
 /* This can be implemented if needed.  */
@@ -74,11 +74,17 @@ typedef uintmax_t uatomic_max_t;
      if (sizeof (*(mem)) == 4)						      \
        __asm ("swap %0, %1"						      \
 	      : "=m" (*__memp), "=r" (__oldval)				      \
-	      : "m" (*__memp), "1" (__value));				      \
+	      : "m" (*__memp), "1" (__value) : "memory");		      \
      else								      \
        abort ();							      \
      __oldval; })
 
+#define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  atomic_compare_and_exchange_val_acq (mem, newval, oldval)
+
+#define atomic_exchange_24_rel(mem, newval) \
+  atomic_exchange_rel (mem, newval)
+
 #define atomic_full_barrier() \
   __asm __volatile ("membar #LoadLoad | #LoadStore"			      \
 			  " | #StoreLoad | #StoreStore" : : : "memory")
diff --git a/sysdeps/sparc/sparc32/sparcv9b/Implies b/sysdeps/sparc/sparc32/sparcv9b/Implies
deleted file mode 100644
index 78a424460b..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9b/Implies
+++ /dev/null
@@ -1 +0,0 @@
-sparc/sparc32/sparcv9
diff --git a/sysdeps/sparc/sparc32/sparcv9v/memcpy.S b/sysdeps/sparc/sparc32/sparcv9v/memcpy.S
new file mode 100644
index 0000000000..4c05f57bc2
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9v/memcpy.S
@@ -0,0 +1,2 @@
+#define XCC icc
+#include <sparc64/sparcv9v/memcpy.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9v/memset.S b/sysdeps/sparc/sparc32/sparcv9v/memset.S
new file mode 100644
index 0000000000..5e46c7489f
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9v/memset.S
@@ -0,0 +1,2 @@
+#define XCC icc
+#include <sparc64/sparcv9v/memset.S>
diff --git a/sysdeps/sparc/sparc32/stpcpy.S b/sysdeps/sparc/sparc32/stpcpy.S
index 937fed35f8..222bc2a445 100644
--- a/sysdeps/sparc/sparc32/stpcpy.S
+++ b/sysdeps/sparc/sparc32/stpcpy.S
@@ -38,7 +38,13 @@
 
 	.text
 	.align		4
-10:	ldub		[%o1], %o5
+
+ENTRY(__stpcpy)
+	andcc		%o1, 3, %g0
+	be		20f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o1], %o5
 	stb		%o5, [%o0]
 	cmp		%o5, 0
 	add		%o0, 1, %o0
@@ -67,11 +73,7 @@
 1:	retl
 	 add		%o0, -1, %o0
 
-ENTRY(__stpcpy)
-	andcc		%o1, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+20:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	or		%o4, %lo(0x01010101), %o2
 6:	andcc		%o0, 3, %g0
@@ -160,6 +162,6 @@ ENTRY(__stpcpy)
 	 nop
 END(__stpcpy)
 
-weak_alias(__stpcpy, stpcpy)
+weak_alias (__stpcpy, stpcpy)
 libc_hidden_def (__stpcpy)
 libc_hidden_builtin_def (stpcpy)
diff --git a/sysdeps/sparc/sparc32/strcat.S b/sysdeps/sparc/sparc32/strcat.S
index 3709c8a692..4ce0771908 100644
--- a/sysdeps/sparc/sparc32/strcat.S
+++ b/sysdeps/sparc/sparc32/strcat.S
@@ -38,36 +38,14 @@
 
 	.text
 	.align		4
-10:	cmp		%o4, 2
-	be		1f
-	 cmp		%o4, 3
-	ldub		[%o1], %o5
-	add		%o1, 1, %o1
-	stb		%o5, [%o0]
-	be		3f
-	 cmp		%o5, 0
-	be		0f
-	 add		%o0, 1, %o0
-1:	lduh		[%o1], %o5
-	add		%o1, 2, %o1
-	srl		%o5, 8, %o4
-	cmp		%o4, 0
-	stb		%o4, [%o0]
-	bne,a		2f
-	 stb		%o5, [%o0 + 1]
-	retl
-	 mov		%g2, %o0
-2:	andcc		%o5, 0xff, %o5
-	bne		4f
-	 add		%o0, 2, %o0
-	retl
-	 mov 		%g2, %o0
-3:	bne		4f
-	 add		%o0, 1, %o0
-	retl
-	 mov		%g2, %o0
 
-11:	ldub		[%o0], %o5
+ENTRY(strcat)
+	mov		%o0, %g2
+	andcc		%o0, 3, %g0
+	be		30f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o0], %o5
 	cmp		%o5, 0
 	be		1f
 	 add		%o0, 1, %o0
@@ -93,12 +71,7 @@
 	b		3f
 	 sub		%o0, 1, %o0
 
-ENTRY(strcat)
-	mov		%o0, %g2
-	andcc		%o0, 3, %g0
-	bne		11b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+30:	or		%o4, %lo(0x80808080), %o3
 7:	sethi		%hi(0x01010101), %o4
 8:	or		%o4, %lo(0x01010101), %o2
 9:	ld		[%o0], %o5
@@ -128,8 +101,39 @@ ENTRY(strcat)
 	 ld		[%o0], %o5
 	sub		%o0, 1, %o0
 3:	andcc		%o1, 3, %o4
-	bne		10b
-4:	 andcc		%o0, 3, %g3
+	be		4f
+	 nop
+
+	cmp		%o4, 2
+	be		11f
+	 cmp		%o4, 3
+	ldub		[%o1], %o5
+	add		%o1, 1, %o1
+	stb		%o5, [%o0]
+	be		13f
+	 cmp		%o5, 0
+	be		0f
+	 add		%o0, 1, %o0
+11:	lduh		[%o1], %o5
+	add		%o1, 2, %o1
+	srl		%o5, 8, %o4
+	cmp		%o4, 0
+	stb		%o4, [%o0]
+	bne,a		12f
+	 stb		%o5, [%o0 + 1]
+	retl
+	 mov		%g2, %o0
+12:	andcc		%o5, 0xff, %o5
+	bne		4f
+	 add		%o0, 2, %o0
+	retl
+	 mov 		%g2, %o0
+13:	bne		4f
+	 add		%o0, 1, %o0
+	retl
+	 mov		%g2, %o0
+
+4:	andcc		%o0, 3, %g3
 	bne		12f
 1:	ld		[%o1], %o5
 	add		%o1, 4, %o1
diff --git a/sysdeps/sparc/sparc32/strchr.S b/sysdeps/sparc/sparc32/strchr.S
index b5be3adf60..7c397171f5 100644
--- a/sysdeps/sparc/sparc32/strchr.S
+++ b/sysdeps/sparc/sparc32/strchr.S
@@ -39,9 +39,20 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %g4
+ENTRY(strchr)
+	andcc		%o1, 0xff, %o1
+	be		12f
+	 sll		%o1, 8, %o2
+	andcc		%o0, 3, %g0
+	or		%o1, %o2, %o2
+	sethi		%hi(0x80808080), %o4
+	sll		%o2, 16, %o3
+	be		13f
+	 or		%o3, %o2, %g2
+
+	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
@@ -50,7 +61,7 @@
 	 or		%o4, %lo(0x80808080), %o3
 	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
@@ -59,27 +70,17 @@
 	 sethi		%hi(0x01010101), %o5
 	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
 	 or		%o5, %lo(0x01010101), %o2
 	b		6f
 	 ld		[%o0], %g4
-1:	retl
+11:	retl
 	 sub		%o0, 1, %o0
 
-ENTRY(strchr)
-	andcc		%o1, 0xff, %o1
-	be		12f
-	 sll		%o1, 8, %o2
-	andcc		%o0, 3, %g0
-	or		%o1, %o2, %o2
-	sethi		%hi(0x80808080), %o4
-	sll		%o2, 16, %o3
-	bne		10b
-	 or		%o3, %o2, %g2
-	or		%o4, %lo(0x80808080), %o3
+13:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o5
 5:	or		%o5, %lo(0x01010101), %o2
 7:	ld		[%o0], %g4
@@ -278,7 +279,7 @@ ENTRY(strrchr)
 	 mov		%o5, %o0
 END(strrchr)
 
-weak_alias(strchr, index)
-weak_alias(strrchr, rindex)
+weak_alias (strchr, index)
+weak_alias (strrchr, rindex)
 libc_hidden_builtin_def (strchr)
 libc_hidden_builtin_def (strrchr)
diff --git a/sysdeps/sparc/sparc32/strcmp.S b/sysdeps/sparc/sparc32/strcmp.S
index 6723593eed..cf369dd839 100644
--- a/sysdeps/sparc/sparc32/strcmp.S
+++ b/sysdeps/sparc/sparc32/strcmp.S
@@ -38,7 +38,13 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %o4
+
+ENTRY(strcmp)
+	andcc		%o0, 3, %g0
+	be		13f
+	 sethi		%hi(0x80808080), %g1
+
+	ldub		[%o0], %o4
 	add		%o0, 1, %o0
 	ldub		[%o1], %o5
 	cmp		%o4, 0
@@ -76,11 +82,7 @@
 2:	retl
 	 mov		%o4, %o0
 
-ENTRY(strcmp)
-	andcc		%o0, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %g1
-	or		%g1, %lo(0x80808080), %o3
+13:	or		%g1, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %g1
 5:	andcc		%o1, 3, %g2
 	bne		12f
diff --git a/sysdeps/sparc/sparc32/strcpy.S b/sysdeps/sparc/sparc32/strcpy.S
index 787ac9f7c8..f3f337e3f7 100644
--- a/sysdeps/sparc/sparc32/strcpy.S
+++ b/sysdeps/sparc/sparc32/strcpy.S
@@ -38,7 +38,14 @@
 
 	.text
 	.align		4
-1:	ldub		[%o1], %o5
+
+ENTRY(strcpy)
+	mov		%o0, %g2
+	andcc		%o1, 3, %g0
+	be		10f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o1], %o5
 	stb		%o5, [%o0]
 	cmp		%o5, 0
 	add		%o0, 1, %o0
@@ -65,12 +72,7 @@
 	b		6f
 	 andcc		%o0, 3, %g3
 
-ENTRY(strcpy)
-	mov		%o0, %g2
-	andcc		%o1, 3, %g0
-	bne		1b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+10:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	andcc		%o0, 3, %g3
 6:	bne		10f
diff --git a/sysdeps/sparc/sparc32/strlen.S b/sysdeps/sparc/sparc32/strlen.S
index 76466ec9dd..ed92f20e28 100644
--- a/sysdeps/sparc/sparc32/strlen.S
+++ b/sysdeps/sparc/sparc32/strlen.S
@@ -38,39 +38,41 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %o5
+
+ENTRY(strlen)
+	mov		%o0, %o1
+	andcc		%o0, 3, %g0
+	be		20f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		1f
+	be		21f
 	 add		%o0, 1, %o0
 	andcc		%o0, 3, %g0
 	be		4f
 	 or		%o4, %lo(0x80808080), %o3
 	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		2f
+	be		22f
 	 add		%o0, 1, %o0
 	andcc		%o0, 3, %g0
 	be		5f
 	 sethi		%hi(0x01010101), %o4
 	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		3f
+	be		23f
 	 add		%o0, 1, %o0
 	b		11f
 	 or		%o4, %lo(0x01010101), %o2
-1:	retl
+21:	retl
 	 mov		0, %o0
-2:	retl
+22:	retl
 	 mov		1, %o0
-3:	retl
+23:	retl
 	 mov		2, %o0
 
-ENTRY(strlen)
-	mov		%o0, %o1
-	andcc		%o0, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+20:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	or		%o4, %lo(0x01010101), %o2
 11:	ld		[%o0], %o5
diff --git a/sysdeps/sparc/sparc64/Dist b/sysdeps/sparc/sparc64/Dist
deleted file mode 100644
index dbf11d5009..0000000000
--- a/sysdeps/sparc/sparc64/Dist
+++ /dev/null
@@ -1 +0,0 @@
-hp-timing.c
diff --git a/sysdeps/sparc/sparc64/Makefile b/sysdeps/sparc/sparc64/Makefile
index 6335984c7d..c1df31727c 100644
--- a/sysdeps/sparc/sparc64/Makefile
+++ b/sysdeps/sparc/sparc64/Makefile
@@ -1,6 +1,3 @@
-# The Sparc `long double' is a distinct type we support.
-long-double-fcts = yes
-
 ifeq ($(subdir),csu)
 sysdep_routines += hp-timing
 elide-routines.os += hp-timing
diff --git a/sysdeps/sparc/sparc64/Versions b/sysdeps/sparc/sparc64/Versions
index 99fe741a12..4cef7bcc71 100644
--- a/sysdeps/sparc/sparc64/Versions
+++ b/sysdeps/sparc/sparc64/Versions
@@ -5,3 +5,10 @@ libc {
     __align_cpy_8; __align_cpy_16;
   }
 }
+libm {
+  GLIBC_2.1 {
+    # A generic bug got this omitted from other configurations' version
+    # sets, but we always had it.
+    exp2l;
+  }
+}
diff --git a/sysdeps/sparc/sparc64/bits/atomic.h b/sysdeps/sparc/sparc64/bits/atomic.h
index 8f97753140..d0a64afce8 100644
--- a/sysdeps/sparc/sparc64/bits/atomic.h
+++ b/sysdeps/sparc/sparc64/bits/atomic.h
@@ -1,5 +1,5 @@
 /* Atomic operations.  sparc64 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -59,7 +59,7 @@ typedef uintmax_t uatomic_max_t;
   __asm __volatile ("cas [%4], %2, %0"					      \
 		    : "=r" (__acev_tmp), "=m" (*__acev_mem)		      \
 		    : "r" (oldval), "m" (*__acev_mem), "r" (__acev_mem),      \
-		      "0" (newval));					      \
+		      "0" (newval) : "memory");				      \
   __acev_tmp; })
 
 #define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
@@ -69,7 +69,7 @@ typedef uintmax_t uatomic_max_t;
   __asm __volatile ("casx [%4], %2, %0"					      \
 		    : "=r" (__acev_tmp), "=m" (*__acev_mem)		      \
 		    : "r" ((long) (oldval)), "m" (*__acev_mem),		      \
-		      "r" (__acev_mem), "0" ((long) (newval)));		      \
+		      "r" (__acev_mem), "0" ((long) (newval)) : "memory");    \
   __acev_tmp; })
 
 #define atomic_exchange_acq(mem, newvalue) \
@@ -80,7 +80,7 @@ typedef uintmax_t uatomic_max_t;
      if (sizeof (*(mem)) == 4)						      \
        __asm ("swap %0, %1"						      \
 	      : "=m" (*__memp), "=r" (__oldval)				      \
-	      : "m" (*__memp), "1" (__value));				      \
+	      : "m" (*__memp), "1" (__value) : "memory");		      \
      else								      \
        {								      \
 	 __val = *__memp;						      \
@@ -94,6 +94,12 @@ typedef uintmax_t uatomic_max_t;
        }								      \
      __oldval; })
 
+#define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  atomic_compare_and_exchange_val_acq (mem, newval, oldval)
+
+#define atomic_exchange_24_rel(mem, newval) \
+  atomic_exchange_rel (mem, newval)
+
 #define atomic_full_barrier() \
   __asm __volatile ("membar #LoadLoad | #LoadStore"			      \
 			  " | #StoreLoad | #StoreStore" : : : "memory")
diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h
index 474aa0e6e6..314a784dbc 100644
--- a/sysdeps/sparc/sparc64/dl-machine.h
+++ b/sysdeps/sparc/sparc64/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  Sparc64 version.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,6 +18,9 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#ifndef dl_machine_h
+#define dl_machine_h
+
 #define ELF_MACHINE_NAME "sparc64"
 
 #include <string.h>
@@ -88,7 +91,7 @@ elf_machine_load_address (void)
 
 /* We have 4 cases to handle.  And we code different code sequences
    for each one.  I love V9 code models...  */
-static inline void
+static inline void __attribute__ ((always_inline))
 sparc64_fixup_plt (struct link_map *map, const Elf64_Rela *reloc,
 		   Elf64_Addr *reloc_addr, Elf64_Addr value,
 		   Elf64_Addr high, int t)
@@ -212,7 +215,7 @@ sparc64_fixup_plt (struct link_map *map, const Elf64_Rela *reloc,
     }
 }
 
-static inline Elf64_Addr
+static inline Elf64_Addr __attribute__ ((always_inline))
 elf_machine_fixup_plt (struct link_map *map, lookup_t t,
 		       const Elf64_Rela *reloc,
 		       Elf64_Addr *reloc_addr, Elf64_Addr value)
@@ -233,236 +236,21 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
   return value;
 }
 
-#ifdef RESOLVE
-
-/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
-   MAP is the object containing the reloc.  */
-
-static inline void
-elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
-		  const Elf64_Sym *sym, const struct r_found_version *version,
-		  void *const reloc_addr_arg)
-{
-  Elf64_Addr *const reloc_addr = reloc_addr_arg;
-  const unsigned long int r_type = ELF64_R_TYPE_ID (reloc->r_info);
-
-#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
-  if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
-    *reloc_addr = map->l_addr + reloc->r_addend;
-# ifndef RTLD_BOOTSTRAP
-  else if (r_type == R_SPARC_NONE) /* Who is Wilbur? */
-    return;
-# endif
-  else
-#endif
-    {
-#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
-      const Elf64_Sym *const refsym = sym;
-#endif
-      Elf64_Addr value;
-#ifndef RESOLVE_CONFLICT_FIND_MAP
-      if (sym->st_shndx != SHN_UNDEF &&
-	  ELF64_ST_BIND (sym->st_info) == STB_LOCAL)
-	value = map->l_addr;
-      else
-	{
-	  value = RESOLVE (&sym, version, r_type);
-	  if (sym)
-	    value += sym->st_value;
-	}
-#else
-      value = 0;
-#endif
-      value += reloc->r_addend;	/* Assume copy relocs have zero addend.  */
-
-      switch (r_type)
-	{
-#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
-	case R_SPARC_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (sym->st_size > refsym->st_size
-	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
-	    {
-	      const char *strtab;
-
-	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
-%s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				rtld_progname ?: "<program name unknown>",
-				strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
-#endif
-	case R_SPARC_64:
-	case R_SPARC_GLOB_DAT:
-	  *reloc_addr = value;
-	  break;
-#ifndef RTLD_BOOTSTRAP
-	case R_SPARC_8:
-	  *(char *) reloc_addr = value;
-	  break;
-	case R_SPARC_16:
-	  *(short *) reloc_addr = value;
-	  break;
-	case R_SPARC_32:
-	  *(unsigned int *) reloc_addr = value;
-	  break;
-	case R_SPARC_DISP8:
-	  *(char *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
-	  break;
-	case R_SPARC_DISP16:
-	  *(short *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
-	  break;
-	case R_SPARC_DISP32:
-	  *(unsigned int *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
-	  break;
-	case R_SPARC_WDISP30:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & 0xc0000000) |
-	     ((value - (Elf64_Addr) reloc_addr) >> 2));
-	  break;
-
-	/* MEDLOW code model relocs */
-	case R_SPARC_LO10:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & ~0x3ff) |
-	     (value & 0x3ff));
-	  break;
-	case R_SPARC_HI22:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & 0xffc00000) |
-	     (value >> 10));
-	  break;
-	case R_SPARC_OLO10:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & ~0x1fff) |
-	     (((value & 0x3ff) + ELF64_R_TYPE_DATA (reloc->r_info)) & 0x1fff));
-	  break;
-
-	/* MEDMID code model relocs */
-	case R_SPARC_H44:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & 0xffc00000) |
-	     (value >> 22));
-	  break;
-	case R_SPARC_M44:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & ~0x3ff) |
-	     ((value >> 12) & 0x3ff));
-	  break;
-	case R_SPARC_L44:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & ~0xfff) |
-	     (value & 0xfff));
-	  break;
-
-	/* MEDANY code model relocs */
-	case R_SPARC_HH22:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & 0xffc00000) |
-	     (value >> 42));
-	  break;
-	case R_SPARC_HM10:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & ~0x3ff) |
-	     ((value >> 32) & 0x3ff));
-	  break;
-	case R_SPARC_LM22:
-	  *(unsigned int *) reloc_addr =
-	    ((*(unsigned int *)reloc_addr & 0xffc00000) |
-	     ((value >> 10) & 0x003fffff));
-	  break;
-#endif
-	case R_SPARC_JMP_SLOT:
-#ifdef RESOLVE_CONFLICT_FIND_MAP
-	  /* R_SPARC_JMP_SLOT conflicts against .plt[32768+]
-	     relocs should be turned into R_SPARC_64 relocs
-	     in .gnu.conflict section.
-	     r_addend non-zero does not mean it is a .plt[32768+]
-	     reloc, instead it is the actual address of the function
-	     to call.  */
-	  sparc64_fixup_plt (NULL, reloc, reloc_addr, value, 0, 0);
-#else
-	  sparc64_fixup_plt (map, reloc, reloc_addr, value,
-			     reloc->r_addend, 0);
-#endif
-	  break;
-#ifndef RTLD_BOOTSTRAP
-	case R_SPARC_UA16:
-	  ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
-	  ((unsigned char *) reloc_addr_arg) [1] = value;
-	  break;
-	case R_SPARC_UA32:
-	  ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
-	  ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
-	  ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
-	  ((unsigned char *) reloc_addr_arg) [3] = value;
-	  break;
-	case R_SPARC_UA64:
-	  if (! ((long) reloc_addr_arg & 3))
-	    {
-	      /* Common in .eh_frame */
-	      ((unsigned int *) reloc_addr_arg) [0] = value >> 32;
-	      ((unsigned int *) reloc_addr_arg) [1] = value;
-	      break;
-	    }
-	  ((unsigned char *) reloc_addr_arg) [0] = value >> 56;
-	  ((unsigned char *) reloc_addr_arg) [1] = value >> 48;
-	  ((unsigned char *) reloc_addr_arg) [2] = value >> 40;
-	  ((unsigned char *) reloc_addr_arg) [3] = value >> 32;
-	  ((unsigned char *) reloc_addr_arg) [4] = value >> 24;
-	  ((unsigned char *) reloc_addr_arg) [5] = value >> 16;
-	  ((unsigned char *) reloc_addr_arg) [6] = value >> 8;
-	  ((unsigned char *) reloc_addr_arg) [7] = value;
-	  break;
-#endif
-#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
-	default:
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
-#endif
-	}
-    }
-}
-
-static inline void
-elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
-			   void *const reloc_addr_arg)
-{
-  Elf64_Addr *const reloc_addr = reloc_addr_arg;
-  *reloc_addr = l_addr + reloc->r_addend;
-}
-
-static inline void
-elf_machine_lazy_rel (struct link_map *map,
-		      Elf64_Addr l_addr, const Elf64_Rela *reloc)
-{
-  switch (ELF64_R_TYPE (reloc->r_info))
-    {
-    case R_SPARC_NONE:
-      break;
-    case R_SPARC_JMP_SLOT:
-      break;
-    default:
-      _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1);
-      break;
-    }
-}
-
-#endif	/* RESOLVE */
-
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
    PLT entries should not be allowed to define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
-#define elf_machine_type_class(type) \
+#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD)
+# define elf_machine_type_class(type) \
+  ((((type) == R_SPARC_JMP_SLOT						      \
+     || ((type) >= R_SPARC_TLS_GD_HI22 && (type) <= R_SPARC_TLS_TPOFF64))     \
+    * ELF_RTYPE_CLASS_PLT)						      \
+   | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
+#else
+# define elf_machine_type_class(type) \
   ((((type) == R_SPARC_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)	\
    | (((type) == R_SPARC_COPY) * ELF_RTYPE_CLASS_COPY))
+#endif
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
 #define ELF_MACHINE_JMP_SLOT	R_SPARC_JMP_SLOT
@@ -487,74 +275,67 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
       extern void _dl_runtime_profile_1 (void);
       Elf64_Addr res0_addr, res1_addr;
       unsigned int *plt = (void *) D_PTR (l, l_info[DT_PLTGOT]);
-      int i = 0;
 
-      if (! profile)
-	{
-	  res0_addr = (Elf64_Addr) &_dl_runtime_resolve_0;
-	  res1_addr = (Elf64_Addr) &_dl_runtime_resolve_1;
-	}
-      else
+      if (__builtin_expect(profile, 0))
 	{
 	  res0_addr = (Elf64_Addr) &_dl_runtime_profile_0;
 	  res1_addr = (Elf64_Addr) &_dl_runtime_profile_1;
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    GL(dl_profile_map) = l;
 	}
+      else
+	{
+	  res0_addr = (Elf64_Addr) &_dl_runtime_resolve_0;
+	  res1_addr = (Elf64_Addr) &_dl_runtime_resolve_1;
+	}
 
       /* PLT0 looks like:
 
-	 save	%sp, -192, %sp
-	 sethi	%hh(_dl_runtime_{resolve,profile}_0), %l0
-	 sethi	%lm(_dl_runtime_{resolve,profile}_0), %l1
-	 or	%l0, %hm(_dl_runtime_{resolve,profile}_0), %l0
-	 or	%l1, %lo(_dl_runtime_{resolve,profile}_0), %l1
-	 sllx	%l0, 32, %l0
-	 jmpl	%l0 + %l1, %l6
-	  sethi	%hi(0xffc00), %l2
+         sethi	%uhi(_dl_runtime_{resolve,profile}_0), %g4
+	 sethi	%hi(_dl_runtime_{resolve,profile}_0), %g5
+	 or	%g4, %ulo(_dl_runtime_{resolve,profile}_0), %g4
+	 or	%g5, %lo(_dl_runtime_{resolve,profile}_0), %g5
+	 sllx	%g4, 32, %g4
+	 add	%g4, %g5, %g5
+	 jmpl	%g5, %g4
+	  nop
        */
 
-      plt[0] = 0x9de3bf40;
-      plt[1] = 0x21000000 | (res0_addr >> (64 - 22));
-      plt[2] = 0x23000000 | ((res0_addr >> 10) & 0x003fffff);
-      plt[3] = 0xa0142000 | ((res0_addr >> 32) & 0x3ff);
-      plt[4] = 0xa2146000 | (res0_addr & 0x3ff);
-      plt[5] = 0xa12c3020;
-      plt[6] = 0xadc40011;
-      plt[7] = 0x250003ff;
+      plt[0] = 0x09000000 | (res0_addr >> (64 - 22));
+      plt[1] = 0x0b000000 | ((res0_addr >> 10) & 0x003fffff);
+      plt[2] = 0x88112000 | ((res0_addr >> 32) & 0x3ff);
+      plt[3] = 0x8a116000 | (res0_addr & 0x3ff);
+      plt[4] = 0x89293020;
+      plt[5] = 0x8a010005;
+      plt[6] = 0x89c14000;
+      plt[7] = 0x01000000;
 
       /* PLT1 looks like:
 
-	 save	%sp, -192, %sp
-	 sethi	%hh(_dl_runtime_{resolve,profile}_1), %l0
-	 sethi	%lm(_dl_runtime_{resolve,profile}_1), %l1
-	 or	%l0, %hm(_dl_runtime_{resolve,profile}_1), %l0
-	 or	%l1, %lo(_dl_runtime_{resolve,profile}_1), %l1
-	 sllx	%l0, 32, %l0
-	 jmpl	%l0 + %l1, %l6
-	  srlx	%g1, 12, %o1
+         sethi	%uhi(_dl_runtime_{resolve,profile}_1), %g4
+	 sethi	%hi(_dl_runtime_{resolve,profile}_1), %g5
+	 or	%g4, %ulo(_dl_runtime_{resolve,profile}_1), %g4
+	 or	%g5, %lo(_dl_runtime_{resolve,profile}_1), %g5
+	 sllx	%g4, 32, %g4
+	 add	%g4, %g5, %g5
+	 jmpl	%g5, %g4
+	  nop
        */
 
-      plt[8 + 0] = 0x9de3bf40;
-      if (__builtin_expect (((res1_addr + 4) >> 32) & 0x3ff, 0))
-	i = 1;
-      else
-	res1_addr += 4;
-      plt[8 + 1] = 0x21000000 | (res1_addr >> (64 - 22));
-      plt[8 + 2] = 0x23000000 | ((res1_addr >> 10) & 0x003fffff);
-      if (__builtin_expect (i, 0))
-	plt[8 + 3] = 0xa0142000 | ((res1_addr >> 32) & 0x3ff);
-      else
-	plt[8 + 3] = 0xa12c3020;
-      plt[8 + 4] = 0xa2146000 | (res1_addr & 0x3ff);
-      if (__builtin_expect (i, 0))
-	plt[8 + 5] = 0xa12c3020;
-      plt[8 + 5 + i] = 0xadc40011;
-      plt[8 + 6 + i] = 0x9330700c;
+      plt[8] = 0x09000000 | (res1_addr >> (64 - 22));
+      plt[9] = 0x0b000000 | ((res1_addr >> 10) & 0x003fffff);
+      plt[10] = 0x88112000 | ((res1_addr >> 32) & 0x3ff);
+      plt[11] = 0x8a116000 | (res1_addr & 0x3ff);
+      plt[12] = 0x89293020;
+      plt[13] = 0x8a010005;
+      plt[14] = 0x89c14000;
+      plt[15] = 0x01000000;
 
       /* Now put the magic cookie at the beginning of .PLT2
 	 Entry .PLT3 is unused by this implementation.  */
-      *((struct link_map **)(&plt[16 + 0])) = l;
+      *((struct link_map **)(&plt[16])) = l;
 
       if (__builtin_expect (l->l_info[VALIDX(DT_GNU_PRELINKED)] != NULL, 0)
 	  || __builtin_expect (l->l_info [VALIDX (DT_GNU_LIBLISTSZ)] != NULL, 0))
@@ -601,68 +382,6 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)	\
-  asm ("\n"						\
-"	.text\n"					\
-"	.globl	" #tramp_name "_0\n"			\
-"	.type	" #tramp_name "_0, @function\n"		\
-"	.align	32\n"					\
-"\t" #tramp_name "_0:\n"				\
-"	! sethi   %hi(1047552), %l2 - Done in .PLT0\n"	\
-"	ldx	[%l6 + 32 + 8], %o0\n"			\
-"	sub     %g1, %l6, %l0\n"			\
-"	xor     %l2, -1016, %l2\n"			\
-"	sethi   %hi(5120), %l3	! 160 * 32\n"		\
-"	add     %l0, %l2, %l0\n"			\
-"	sethi   %hi(32768), %l4\n"			\
-"	udivx   %l0, %l3, %l3\n"			\
-"	sllx    %l3, 2, %l1\n"				\
-"	add     %l1, %l3, %l1\n"			\
-"	sllx    %l1, 10, %l2\n"				\
-"	sub	%l4, 4, %l4	! No thanks to Sun for not obeying their own ABI\n" \
-"	sllx    %l1, 5, %l1\n"				\
-"	sub     %l0, %l2, %l0\n"			\
-"	udivx   %l0, 24, %l0\n"				\
-"	add     %l0, %l4, %l0\n"			\
-"	add     %l1, %l0, %l1\n"			\
-"	add     %l1, %l1, %l0\n"			\
-"	add     %l0, %l1, %l0\n"			\
-"	mov	%i7, %o2\n"				\
-"	call	" #fixup_name "\n"			\
-"	 sllx    %l0, 3, %o1\n"				\
-"	jmp	%o0\n"					\
-"	 restore\n"					\
-"	.size	" #tramp_name "_0, . - " #tramp_name "_0\n" \
-"\n"							\
-"	.globl	" #tramp_name "_1\n"			\
-"	.type	" #tramp_name "_1, @function\n"		\
-"	! tramp_name_1 + 4 needs to be .align 32\n"	\
-"\t" #tramp_name "_1:\n"				\
-"	sub	%l6, 4, %l6\n"				\
-"	! srlx	%g1, 12, %o1 - Done in .PLT1\n"		\
-"	ldx	[%l6 + 12], %o0\n"			\
-"	add	%o1, %o1, %o3\n"			\
-"	sub	%o1, 96, %o1	! No thanks to Sun for not obeying their own ABI\n" \
-"	mov	%i7, %o2\n"				\
-"	call	" #fixup_name "\n"			\
-"	 add	%o1, %o3, %o1\n"			\
-"	jmp	%o0\n"					\
-"	 restore\n"					\
-"	.size	" #tramp_name "_1, . - " #tramp_name "_1\n" \
-"	.previous\n");
-
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, fixup);
-#endif
-
 /* The PLT uses Elf64_Rela relocs.  */
 #define elf_machine_relplt elf_machine_rela
 
@@ -763,3 +482,291 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 "	 add	%sp, 6*8, %sp\n"					\
 "	.size	_dl_start_user, . - _dl_start_user\n"			\
 "	.previous\n");
+
+#endif /* dl_machine_h */
+
+#define ARCH_LA_PLTENTER	sparc64_gnu_pltenter
+#define ARCH_LA_PLTEXIT		sparc64_gnu_pltexit
+
+#ifdef RESOLVE_MAP
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+   MAP is the object containing the reloc.  */
+
+auto inline void
+__attribute__ ((always_inline))
+elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
+		  const Elf64_Sym *sym, const struct r_found_version *version,
+		  void *const reloc_addr_arg)
+{
+  Elf64_Addr *const reloc_addr = reloc_addr_arg;
+#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
+  const Elf64_Sym *const refsym = sym;
+#endif
+  Elf64_Addr value;
+  const unsigned long int r_type = ELF64_R_TYPE_ID (reloc->r_info);
+#if !defined RESOLVE_CONFLICT_FIND_MAP
+  struct link_map *sym_map = NULL;
+#endif
+
+#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
+  /* This is defined in rtld.c, but nowhere in the static libc.a; make the
+     reference weak so static programs can still link.  This declaration
+     cannot be done when compiling rtld.c (i.e.  #ifdef RTLD_BOOTSTRAP)
+     because rtld.c contains the common defn for _dl_rtld_map, which is
+     incompatible with a weak decl in the same file.  */
+  weak_extern (_dl_rtld_map);
+#endif
+
+  if (__builtin_expect (r_type == R_SPARC_NONE, 0))
+    return;
+
+#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+  if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
+    {
+# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
+      if (map != &_dl_rtld_map) /* Already done in rtld itself. */
+# endif
+	*reloc_addr += map->l_addr + reloc->r_addend;
+      return;
+    }
+#endif
+
+#ifndef RESOLVE_CONFLICT_FIND_MAP
+  if (__builtin_expect (ELF64_ST_BIND (sym->st_info) == STB_LOCAL, 0)
+      && sym->st_shndx != SHN_UNDEF)
+    {
+      value = map->l_addr;
+    }
+  else
+    {
+      sym_map = RESOLVE_MAP (&sym, version, r_type);
+      value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
+    }
+#else
+  value = 0;
+#endif
+
+  value += reloc->r_addend;	/* Assume copy relocs have zero addend.  */
+
+  switch (r_type)
+    {
+#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
+    case R_SPARC_COPY:
+      if (sym == NULL)
+	/* This can happen in trace mode if an object could not be
+	   found.  */
+	break;
+      if (sym->st_size > refsym->st_size
+	  || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
+	{
+	  const char *strtab;
+
+	  strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+	  _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+			    rtld_progname ?: "<program name unknown>",
+			    strtab + refsym->st_name);
+	}
+      memcpy (reloc_addr_arg, (void *) value,
+	      MIN (sym->st_size, refsym->st_size));
+      break;
+#endif
+    case R_SPARC_64:
+    case R_SPARC_GLOB_DAT:
+      *reloc_addr = value;
+      break;
+    case R_SPARC_JMP_SLOT:
+#ifdef RESOLVE_CONFLICT_FIND_MAP
+      /* R_SPARC_JMP_SLOT conflicts against .plt[32768+]
+	 relocs should be turned into R_SPARC_64 relocs
+	 in .gnu.conflict section.
+	 r_addend non-zero does not mean it is a .plt[32768+]
+	 reloc, instead it is the actual address of the function
+	 to call.  */
+      sparc64_fixup_plt (NULL, reloc, reloc_addr, value, 0, 0);
+#else
+      sparc64_fixup_plt (map, reloc, reloc_addr, value, reloc->r_addend, 0);
+#endif
+      break;
+#if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
+    && !defined RESOLVE_CONFLICT_FIND_MAP
+    case R_SPARC_TLS_DTPMOD64:
+      /* Get the information from the link map returned by the
+	 resolv function.  */
+      if (sym_map != NULL)
+	*reloc_addr = sym_map->l_tls_modid;
+      break;
+    case R_SPARC_TLS_DTPOFF64:
+      /* During relocation all TLS symbols are defined and used.
+	 Therefore the offset is already correct.  */
+      *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
+      break;
+    case R_SPARC_TLS_TPOFF64:
+      /* The offset is negative, forward from the thread pointer.  */
+      /* We know the offset of object the symbol is contained in.
+	 It is a negative value which will be added to the
+	 thread pointer.  */
+      if (sym != NULL)
+	{
+	  CHECK_STATIC_TLS (map, sym_map);
+	  *reloc_addr = sym->st_value - sym_map->l_tls_offset
+	    + reloc->r_addend;
+	}
+      break;
+# ifndef RTLD_BOOTSTRAP
+    case R_SPARC_TLS_LE_HIX22:
+    case R_SPARC_TLS_LE_LOX10:
+      if (sym != NULL)
+	{
+	  CHECK_STATIC_TLS (map, sym_map);
+	  value = sym->st_value - sym_map->l_tls_offset
+	    + reloc->r_addend;
+	  if (r_type == R_SPARC_TLS_LE_HIX22)
+	    *reloc_addr = (*reloc_addr & 0xffc00000)
+	      | (((~value) >> 10) & 0x3fffff);
+	  else
+	    *reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff)
+	      | 0x1c00;
+	}
+      break;
+# endif
+#endif
+#ifndef RTLD_BOOTSTRAP
+    case R_SPARC_8:
+      *(char *) reloc_addr = value;
+      break;
+    case R_SPARC_16:
+      *(short *) reloc_addr = value;
+      break;
+    case R_SPARC_32:
+      *(unsigned int *) reloc_addr = value;
+      break;
+    case R_SPARC_DISP8:
+      *(char *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
+      break;
+    case R_SPARC_DISP16:
+      *(short *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
+      break;
+    case R_SPARC_DISP32:
+      *(unsigned int *) reloc_addr = (value - (Elf64_Addr) reloc_addr);
+      break;
+    case R_SPARC_WDISP30:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & 0xc0000000) |
+	 (((value - (Elf64_Addr) reloc_addr) >> 2) & 0x3fffffff));
+      break;
+
+      /* MEDLOW code model relocs */
+    case R_SPARC_LO10:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & ~0x3ff) |
+	 (value & 0x3ff));
+      break;
+    case R_SPARC_HI22:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & 0xffc00000) |
+	 ((value >> 10) & 0x3fffff));
+      break;
+    case R_SPARC_OLO10:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & ~0x1fff) |
+	 (((value & 0x3ff) + ELF64_R_TYPE_DATA (reloc->r_info)) & 0x1fff));
+      break;
+
+      /* MEDMID code model relocs */
+    case R_SPARC_H44:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & 0xffc00000) |
+	 ((value >> 22) & 0x3fffff));
+      break;
+    case R_SPARC_M44:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & ~0x3ff) |
+	 ((value >> 12) & 0x3ff));
+      break;
+    case R_SPARC_L44:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & ~0xfff) |
+	 (value & 0xfff));
+      break;
+
+      /* MEDANY code model relocs */
+    case R_SPARC_HH22:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & 0xffc00000) |
+	 (value >> 42));
+      break;
+    case R_SPARC_HM10:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & ~0x3ff) |
+	 ((value >> 32) & 0x3ff));
+      break;
+    case R_SPARC_LM22:
+      *(unsigned int *) reloc_addr =
+	((*(unsigned int *)reloc_addr & 0xffc00000) |
+	 ((value >> 10) & 0x003fffff));
+      break;
+    case R_SPARC_UA16:
+      ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
+      ((unsigned char *) reloc_addr_arg) [1] = value;
+      break;
+    case R_SPARC_UA32:
+      ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
+      ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
+      ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
+      ((unsigned char *) reloc_addr_arg) [3] = value;
+      break;
+    case R_SPARC_UA64:
+      if (! ((long) reloc_addr_arg & 3))
+	{
+	  /* Common in .eh_frame */
+	  ((unsigned int *) reloc_addr_arg) [0] = value >> 32;
+	  ((unsigned int *) reloc_addr_arg) [1] = value;
+	  break;
+	}
+      ((unsigned char *) reloc_addr_arg) [0] = value >> 56;
+      ((unsigned char *) reloc_addr_arg) [1] = value >> 48;
+      ((unsigned char *) reloc_addr_arg) [2] = value >> 40;
+      ((unsigned char *) reloc_addr_arg) [3] = value >> 32;
+      ((unsigned char *) reloc_addr_arg) [4] = value >> 24;
+      ((unsigned char *) reloc_addr_arg) [5] = value >> 16;
+      ((unsigned char *) reloc_addr_arg) [6] = value >> 8;
+      ((unsigned char *) reloc_addr_arg) [7] = value;
+      break;
+#endif
+#if !defined RTLD_BOOTSTRAP || defined _NDEBUG
+    default:
+      _dl_reloc_bad_type (map, r_type, 0);
+      break;
+#endif
+    }
+}
+
+auto inline void
+__attribute__ ((always_inline))
+elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
+			   void *const reloc_addr_arg)
+{
+  Elf64_Addr *const reloc_addr = reloc_addr_arg;
+  *reloc_addr = l_addr + reloc->r_addend;
+}
+
+auto inline void
+__attribute__ ((always_inline))
+elf_machine_lazy_rel (struct link_map *map,
+		      Elf64_Addr l_addr, const Elf64_Rela *reloc)
+{
+  switch (ELF64_R_TYPE (reloc->r_info))
+    {
+    case R_SPARC_NONE:
+      break;
+    case R_SPARC_JMP_SLOT:
+      break;
+    default:
+      _dl_reloc_bad_type (map, ELFW(R_TYPE) (reloc->r_info), 1);
+      break;
+    }
+}
+
+#endif	/* RESOLVE_MAP */
diff --git a/sysdeps/sparc/sparc64/dl-trampoline.S b/sysdeps/sparc/sparc64/dl-trampoline.S
new file mode 100644
index 0000000000..81e5c556c3
--- /dev/null
+++ b/sysdeps/sparc/sparc64/dl-trampoline.S
@@ -0,0 +1,327 @@
+/* PLT trampolines.  Sparc 64-bit version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+	.align	32
+
+	/* %g1:	PLT offset loaded by PLT entry
+	 * %g4: callers PC, which is PLT0 + 24, therefore we
+	 *      add (32 + 8) to get the address of PLT2 which
+	 *      is where the magic cookie is stored
+	 */
+	.globl	_dl_runtime_resolve_0
+	.type	_dl_runtime_resolve_0, @function
+_dl_runtime_resolve_0:
+	cfi_startproc
+
+	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
+	sethi   %hi(1047552), %l2
+	ldx	[%g4 + 32 + 8], %o0
+	sub     %g1, %g4, %l0
+	xor     %l2, -1016, %l2
+	sethi   %hi(5120), %l3	/* 160 * 32 */
+	add     %l0, %l2, %l0
+	sethi   %hi(32768), %l4
+	udivx   %l0, %l3, %l3
+	sllx    %l3, 2, %l1
+	add     %l1, %l3, %l1
+	sllx    %l1, 10, %l2
+	sub	%l4, 4, %l4
+	sllx    %l1, 5, %l1
+	sub     %l0, %l2, %l0
+	udivx   %l0, 24, %l0
+	add     %l0, %l4, %l0
+	add     %l1, %l0, %l1
+	add     %l1, %l1, %l0
+	add     %l0, %l1, %l0
+	call	_dl_fixup
+	 sllx    %l0, 3, %o1
+	jmp	%o0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_runtime_resolve_0, .-_dl_runtime_resolve_0
+
+	/* %g1:	PLT offset loaded by PLT entry
+	 * %g4: callers PC, which is PLT1 + 24, therefore we
+	 *      add 8 to get the address of PLT2 which
+	 *      is where the magic cookie is stored
+	 */
+	.globl	_dl_runtime_resolve_1
+	.type	_dl_runtime_resolve_1, @function
+_dl_runtime_resolve_1:
+	cfi_startproc
+
+	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
+	srlx	%g1, 12, %o1
+	ldx	[%g4 + 8], %o0
+	add	%o1, %o1, %o3
+	sub	%o1, 96, %o1
+	call	_dl_fixup
+	 add	%o1, %o3, %o1
+	jmp	%o0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_runtime_resolve_1, .-_dl_runtime_resolve_1
+
+	/* For the profiling cases we pass in our stack frame
+	 * as the base of the La_sparc64_regs, so it looks
+	 * like:
+	 *	%l0			%sp
+	 *	...
+	 *	%l7			%sp + (7 * 8)
+	 *	%i0			%sp + (8 * 8)
+	 *	...
+	 *	%i7			%sp + (15 * 8)
+	 *	%f0			%sp + (16 * 8)
+	 *	%f16			%sp + (31 * 8)
+	 *	framesize		%sp + (32 * 8)
+	 */
+
+	.globl	_dl_profile_save_regs
+	.type	_dl_profile_save_regs, @function
+_dl_profile_save_regs:
+	cfi_startproc
+
+	stx	%l0, [%sp + STACK_BIAS + ( 0 * 8)]
+	stx	%l1, [%sp + STACK_BIAS + ( 1 * 8)]
+	stx	%l2, [%sp + STACK_BIAS + ( 2 * 8)]
+	stx	%l3, [%sp + STACK_BIAS + ( 3 * 8)]
+	stx	%l4, [%sp + STACK_BIAS + ( 4 * 8)]
+	stx	%l5, [%sp + STACK_BIAS + ( 5 * 8)]
+	stx	%l6, [%sp + STACK_BIAS + ( 6 * 8)]
+	stx	%l7, [%sp + STACK_BIAS + ( 7 * 8)]
+	stx	%i0, [%sp + STACK_BIAS + ( 8 * 8)]
+	stx	%i1, [%sp + STACK_BIAS + ( 9 * 8)]
+	stx	%i2, [%sp + STACK_BIAS + (10 * 8)]
+	stx	%i3, [%sp + STACK_BIAS + (11 * 8)]
+	stx	%i4, [%sp + STACK_BIAS + (12 * 8)]
+	stx	%i5, [%sp + STACK_BIAS + (13 * 8)]
+	stx	%i6, [%sp + STACK_BIAS + (14 * 8)]
+	stx	%i7, [%sp + STACK_BIAS + (15 * 8)]
+	std	%f0, [%sp + STACK_BIAS + (16 * 8)]
+	std	%f2, [%sp + STACK_BIAS + (17 * 8)]
+	std	%f4, [%sp + STACK_BIAS + (18 * 8)]
+	std	%f6, [%sp + STACK_BIAS + (19 * 8)]
+	std	%f8, [%sp + STACK_BIAS + (20 * 8)]
+	std	%f10, [%sp + STACK_BIAS + (21 * 8)]
+	std	%f12, [%sp + STACK_BIAS + (22 * 8)]
+	std	%f14, [%sp + STACK_BIAS + (23 * 8)]
+	std	%f16, [%sp + STACK_BIAS + (24 * 8)]
+	std	%f18, [%sp + STACK_BIAS + (25 * 8)]
+	std	%f20, [%sp + STACK_BIAS + (26 * 8)]
+	std	%f22, [%sp + STACK_BIAS + (27 * 8)]
+	std	%f24, [%sp + STACK_BIAS + (28 * 8)]
+	std	%f26, [%sp + STACK_BIAS + (29 * 8)]
+	std	%f28, [%sp + STACK_BIAS + (30 * 8)]
+	retl
+	 std	%f30, [%sp + STACK_BIAS + (31 * 8)]
+
+	cfi_endproc
+
+	.size	_dl_profile_save_regs, .-_dl_profile_save_regs
+
+	/* If we are going to call pltexit, then we must replicate
+	 * the caller's stack frame.
+	 * %o0: PLT resolved function address
+	 */
+	.globl	_dl_profile_invoke
+	.type	_dl_profile_invoke, @function
+_dl_profile_invoke:
+	cfi_startproc
+
+	sub	%sp, %l0, %sp
+1:
+	srlx	%l0, 3, %l7
+	mov	%o0, %l1
+	mov	%i0, %o0
+	mov	%i1, %o1
+	mov	%i2, %o2
+	mov	%i3, %o3
+	mov	%i4, %o4
+	mov	%i5, %o5
+	add	%fp, STACK_BIAS, %l2
+	add	%sp, STACK_BIAS, %l3
+1:	ldx	[%l2], %l4
+	add	%l2, 0x8, %l2
+	subcc	%l7, 1, %l7
+	stx	%l4, [%l3]
+	bne,pt	%xcc, 1b
+	 add	%l3, 0x8, %l3
+
+	jmpl	%l1, %o7
+	 nop
+
+	stx	%o0, [%sp + STACK_BIAS + (16 * 8)]
+	stx	%o1, [%sp + STACK_BIAS + (17 * 8)]
+	stx	%o2, [%sp + STACK_BIAS + (18 * 8)]
+	stx	%o3, [%sp + STACK_BIAS + (19 * 8)]
+	std	%f0, [%sp + STACK_BIAS + (20 * 8)]
+	std	%f2, [%sp + STACK_BIAS + (21 * 8)]
+	std	%f4, [%sp + STACK_BIAS + (22 * 8)]
+	std	%f8, [%sp + STACK_BIAS + (23 * 8)]
+
+	mov	%l5, %o0
+	mov	%l6, %o1
+	add	%sp, %l0, %o2
+	add	%sp, STACK_BIAS + (16 * 8), %o3
+	call	_dl_call_pltexit
+	 add	%o2, STACK_BIAS, %o2
+
+	ldx	[%sp + STACK_BIAS + (16 * 8)], %i0
+	ldx	[%sp + STACK_BIAS + (17 * 8)], %i1
+	ldx	[%sp + STACK_BIAS + (18 * 8)], %i2
+	ldx	[%sp + STACK_BIAS + (19 * 8)], %i3
+
+	jmpl	%i7 + 8, %g0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_profile_invoke, .-_dl_profile_invoke
+
+	/* %g1:	PLT offset loaded by PLT entry
+	 * %g4: callers PC, which is PLT0 + 24, therefore we
+	 *      add (32 + 8) to get the address of PLT2 which
+	 *      is where the magic cookie is stored
+	 */
+	.align	32
+	.globl	_dl_runtime_profile_0
+	.type	_dl_runtime_profile_0, @function
+_dl_runtime_profile_0:
+	cfi_startproc
+
+	brz,a,pn %fp, 1f
+	 mov	192, %g5
+	sub	%fp, %sp, %g5
+1:	save	%sp, -336, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
+	sethi   %hi(1047552), %l2
+	ldx	[%g4 + 32 + 8], %o0
+	sub     %g1, %g4, %l0
+	xor     %l2, -1016, %l2
+	sethi   %hi(5120), %l3	/* 160 * 32 */
+	add     %l0, %l2, %l0
+	sethi   %hi(32768), %l4
+	udivx   %l0, %l3, %l3
+	sllx    %l3, 2, %l1
+	add     %l1, %l3, %l1
+	sllx    %l1, 10, %l2
+	sub	%l4, 4, %l4
+	sllx    %l1, 5, %l1
+	sub     %l0, %l2, %l0
+	udivx   %l0, 24, %l0
+	add     %l0, %l4, %l0
+	add     %l1, %l0, %l1
+	add     %l1, %l1, %l0
+	add     %l0, %l1, %l0
+
+	mov	%i7, %o2
+	sllx    %l0, 3, %o1
+
+	mov	%g5, %l0
+	mov	%o0, %l5
+	mov	%o1, %l6
+
+	call	_dl_profile_save_regs
+	 nop
+
+	add	%sp, STACK_BIAS, %o3
+	call	_dl_profile_fixup
+	 add	%sp, (STACK_BIAS + (32 * 8)), %o4
+
+	ldx	[%sp + STACK_BIAS + (32 * 8)], %o1
+	brgez,pt %o1, 1f
+	 nop
+
+	call	_dl_profile_invoke
+	 nop
+
+1:	jmp	%o0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_runtime_profile_0, .-_dl_runtime_profile_0
+
+	/* %g1:	PLT offset loaded by PLT entry
+	 * %g4: callers PC, which is PLT1 + 24, therefore we
+	 *      add 8 to get the address of PLT2 which
+	 *      is where the magic cookie is stored
+	 */
+	.globl	_dl_runtime_profile_1
+	.type	_dl_runtime_profile_1, @function
+_dl_runtime_profile_1:
+	cfi_startproc
+
+	brz,a,pn %fp, 1f
+	 mov	192, %g5
+	sub	%fp, %sp, %g5
+1:	save	%sp, -336, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
+	srlx	%g1, 12, %o1
+	ldx	[%g4 + 8], %o0
+	add	%o1, %o1, %o3
+	sub	%o1, 96, %o1
+	mov	%i7, %o2
+	add	%o1, %o3, %o1
+
+	mov	%g5, %l0
+	mov	%o0, %l5
+	mov	%o1, %l6
+
+	call	_dl_profile_save_regs
+	 nop
+
+	add	%sp, STACK_BIAS, %o3
+	call	_dl_profile_fixup
+	 add	%sp, (STACK_BIAS + (32 * 8)), %o4
+
+	ldx	[%sp + STACK_BIAS + (32 * 8)], %o1
+	brgez,pt %o1, 1f
+	 nop
+
+	call	_dl_profile_invoke
+	 nop
+
+1:	jmp	%o0
+	 restore
+
+	cfi_endproc
+
+	.size	_dl_runtime_resolve_1, .-_dl_runtime_resolve_1
diff --git a/sysdeps/sparc/sparc64/elf/start.S b/sysdeps/sparc/sparc64/elf/start.S
index b0ef9d355d..df44cae068 100644
--- a/sysdeps/sparc/sparc64/elf/start.S
+++ b/sysdeps/sparc/sparc64/elf/start.S
@@ -48,6 +48,7 @@
 	.global _start
 	.type _start,#function
 _start:
+	cfi_startproc
 
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
@@ -59,6 +60,7 @@ _start:
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*8, %sp
+	cfi_adjust_cfa_offset(6*8)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP,
@@ -92,4 +94,12 @@ _start:
   /* Die very horribly if exit returns.  */
 	illtrap	0
 
+	cfi_endproc
+
 	.size _start, .-_start
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl	__data_start
+__data_start:
+weak_alias (__data_start, data_start)
diff --git a/sysdeps/sparc/sparc64/fpu/libm-test-ulps b/sysdeps/sparc/sparc64/fpu/libm-test-ulps
index 4888dd2149..db5543e9eb 100644
--- a/sysdeps/sparc/sparc64/fpu/libm-test-ulps
+++ b/sysdeps/sparc/sparc64/fpu/libm-test-ulps
@@ -33,14 +33,14 @@ ildouble: 1
 ldouble: 1
 
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
 ildouble: 5
 ldouble: 5
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
@@ -465,6 +465,11 @@ ifloat: 2
 ildouble: 1
 ldouble: 1
 
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
+
 # expm1
 Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
 double: 1
@@ -1192,6 +1197,10 @@ ifloat: 2
 ildouble: 1
 ldouble: 1
 
+Function: "exp2":
+ildouble: 2
+ldouble: 2
+
 Function: "expm1":
 double: 1
 float: 1
diff --git a/sysdeps/sparc/sparc64/jmpbuf-unwind.h b/sysdeps/sparc/sparc64/jmpbuf-unwind.h
new file mode 100644
index 0000000000..f7eed15ea1
--- /dev/null
+++ b/sysdeps/sparc/sparc64/jmpbuf-unwind.h
@@ -0,0 +1,37 @@
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David S. Miller <davem@davemloft.net>, 2005.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <stdint.h>
+#include <unwind.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
+  ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp + 2047)
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) \
+   < (uintptr_t) (_jmpbuf)[0].uc_mcontext.mc_fp + 2047 - (_adj))
+
+/* We use the normal lobngjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/sparc/sparc64/memcmp.S b/sysdeps/sparc/sparc64/memcmp.S
index 074767b983..f9502d63f5 100644
--- a/sysdeps/sparc/sparc64/memcmp.S
+++ b/sysdeps/sparc/sparc64/memcmp.S
@@ -139,5 +139,5 @@ ENTRY(memcmp)
 END(memcmp)
 
 #undef bcmp
-weak_alias(memcmp, bcmp)
+weak_alias (memcmp, bcmp)
 libc_hidden_builtin_def (memcmp)
diff --git a/sysdeps/sparc/sparc64/memcpy.S b/sysdeps/sparc/sparc64/memcpy.S
index 3742573248..5993358017 100644
--- a/sysdeps/sparc/sparc64/memcpy.S
+++ b/sysdeps/sparc/sparc64/memcpy.S
@@ -209,6 +209,7 @@ ENTRY(bcopy)
 END(bcopy)
 
 	.align		32
+ENTRY(__memcpy_large)
 200:	be,pt		%xcc, 201f			/* CTI				*/
 	 andcc		%o0, 0x38, %g5			/* IEU1		Group		*/
 	mov		8, %g1				/* IEU0				*/
@@ -443,6 +444,7 @@ END(bcopy)
 	 stb		%o5, [%o0 - 1]			/* Store			*/
 209:	retl
 	 mov		%g4, %o0
+END(__memcpy_large)
 
 #ifdef USE_BPR
 
@@ -698,6 +700,7 @@ ENTRY(memcpy)
 END(memcpy)
 
 	.align		32
+ENTRY(__memmove_slowpath)
 228:	andcc		%o2, 1, %g0			/* IEU1		Group		*/
 	be,pt		%icc, 2f+4			/* CTI				*/
 1:	 ldub		[%o1 - 1], %o5			/* LOAD		Group		*/
@@ -718,6 +721,7 @@ END(memcpy)
 	 mov		%g4, %o0
 219:	retl
 	 nop
+END(__memmove_slowpath)
 
 	.align		32
 ENTRY(memmove)
@@ -914,8 +918,8 @@ ENTRY(memmove)
 END(memmove)
 
 #ifdef USE_BPR
-weak_alias(memcpy, __align_cpy_1)
-weak_alias(memcpy, __align_cpy_2)
+weak_alias (memcpy, __align_cpy_1)
+weak_alias (memcpy, __align_cpy_2)
 #endif
 libc_hidden_builtin_def (memcpy)
 libc_hidden_builtin_def (memmove)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index b34ccc8869..99624ba9d7 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -312,4 +312,4 @@ ENTRY(__bzero)
 	 mov		%o5, %o0
 END(__bzero)
 
-weak_alias(__bzero, bzero)
+weak_alias (__bzero, bzero)
diff --git a/sysdeps/sparc/sparc64/soft-fp/Dist b/sysdeps/sparc/sparc64/soft-fp/Dist
deleted file mode 100644
index f98d85f7c2..0000000000
--- a/sysdeps/sparc/sparc64/soft-fp/Dist
+++ /dev/null
@@ -1,32 +0,0 @@
-qp_add.c
-qp_cmp.c
-qp_cmpe.c
-qp_div.c
-qp_dtoq.c
-qp_feq.c
-qp_fge.c
-qp_fgt.c
-qp_fle.c
-qp_flt.c
-qp_fne.c
-qp_itoq.c
-qp_mul.c
-qp_neg.S
-qp_qtod.c
-qp_qtoi.c
-qp_qtos.c
-qp_qtoui.c
-qp_qtoux.c
-qp_qtox.c
-qp_sqrt.c
-qp_stoq.c
-qp_sub.c
-qp_uitoq.c
-qp_util.c
-qp_uxtoq.c
-qp_xtoq.c
-s_frexpl.c
-s_ilogbl.c
-s_scalblnl.c
-s_scalbnl.c
-sfp-machine.h
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_add.c b/sysdeps/sparc/sparc64/soft-fp/qp_add.c
index bcfd0ff281..eced23fad8 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_add.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_add.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (*a) + (*b)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,10 +29,10 @@ void _Qp_add(long double *c, const long double *a, const long double *b)
   FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
-  FP_UNPACK_QP(B, b);
+  FP_UNPACK_SEMIRAW_QP(A, a);
+  FP_UNPACK_SEMIRAW_QP(B, b);
   FP_ADD_Q(C, A, B);
-  FP_PACK_QP(c, C);
+  FP_PACK_SEMIRAW_QP(c, C);
   QP_HANDLE_EXCEPTIONS(__asm (
 "	ldd [%1], %%f52\n"
 "	ldd [%1+8], %%f54\n"
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c
index 9ba2fac9ce..63f3d742aa 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,13 +31,13 @@ void _Qp_dtoq(long double *c, const double a)
   FP_DECL_Q(C);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_D(A, a);
+  FP_UNPACK_RAW_D(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,D,4,2,C,A);
+  FP_EXTEND(Q,D,4,2,C,A);
 #else
-  FP_CONV(Q,D,2,1,C,A);
+  FP_EXTEND(Q,D,2,1,C,A);
 #endif
-  FP_PACK_QP(c, C);
+  FP_PACK_RAW_QP(c, C);
   QP_HANDLE_EXCEPTIONS(__asm (
 "	fdtoq %1, %%f60\n"
 "	std %%f60, [%0]\n"
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c
index dd28b6a56e..310d70c77a 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,7 +29,7 @@ void _Qp_itoq(long double *c, const int a)
   FP_DECL_Q(C);
   int b = a;
 
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_QP(c, C);
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_QP(c, C);
   QP_NO_EXCEPTIONS;
 }
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c
index c86967a5d4..2e5edadcb7 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (double)(*a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ double _Qp_qtod(const long double *a)
   double r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
+  FP_UNPACK_SEMIRAW_QP(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(D,Q,2,4,R,A);
+  FP_TRUNC(D,Q,2,4,R,A);
 #else
-  FP_CONV(D,Q,1,2,R,A);
+  FP_TRUNC(D,Q,1,2,R,A);
 #endif
-  FP_PACK_D(r, R);
+  FP_PACK_SEMIRAW_D(r, R);
   QP_HANDLE_EXCEPTIONS(__asm (
 "	ldd [%1], %%f52\n"
 "	ldd [%1+8], %%f54\n"
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c
index cf8aba73c6..a40253654a 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (int)(*a)
-   Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -28,10 +28,10 @@ int _Qp_qtoi(const long double *a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  int r;
+  unsigned int r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
+  FP_UNPACK_RAW_QP(A, a);
   FP_TO_INT_Q(r, A, 32, 1);
   QP_HANDLE_EXCEPTIONS(
   	int rx;
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c
index 52d52d6830..f5f9cdb190 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (float)(*a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ float _Qp_qtos(const long double *a)
   float r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
+  FP_UNPACK_SEMIRAW_QP(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(S,Q,1,4,R,A);
+  FP_TRUNC(S,Q,1,4,R,A);
 #else
-  FP_CONV(S,Q,1,2,R,A);
+  FP_TRUNC(S,Q,1,2,R,A);
 #endif
-  FP_PACK_S(r, R);
+  FP_PACK_SEMIRAW_S(r, R);
 
   QP_HANDLE_EXCEPTIONS(__asm (
 "	ldd [%1], %%f52\n"
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c
index abee50b06a..884d23e527 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (unsigned int)(*a)
-   Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,7 +31,7 @@ unsigned int _Qp_qtoui(const long double *a)
   unsigned int r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
+  FP_UNPACK_RAW_QP(A, a);
   FP_TO_INT_Q(r, A, 32, -1);
   QP_HANDLE_EXCEPTIONS(
   	int rx;
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c
index 87c8478880..4b6f265a47 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (unsigned long)(*a)
-   Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,7 +31,7 @@ unsigned long _Qp_qtoux(const long double *a)
   unsigned long r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
+  FP_UNPACK_RAW_QP(A, a);
   FP_TO_INT_Q(r, A, 64, -1);
   QP_HANDLE_EXCEPTIONS(
 	unsigned long rx;
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c
index 35481196ee..fac6166c2c 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long)(*a)
-   Copyright (C) 1997, 1999, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -28,10 +28,10 @@ long _Qp_qtox(const long double *a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  long r;
+  unsigned long r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
+  FP_UNPACK_RAW_QP(A, a);
   FP_TO_INT_Q(r, A, 64, 1);
   QP_HANDLE_EXCEPTIONS(
 	long rx;
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c
index 655813186e..1a4a03df88 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,13 +31,13 @@ void _Qp_stoq(long double *c, const float a)
   FP_DECL_Q(C);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_S(A, a);
+  FP_UNPACK_RAW_S(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,S,4,1,C,A);
+  FP_EXTEND(Q,S,4,1,C,A);
 #else
-  FP_CONV(Q,S,2,1,C,A);
+  FP_EXTEND(Q,S,2,1,C,A);
 #endif
-  FP_PACK_QP(c, C);
+  FP_PACK_RAW_QP(c, C);
   QP_HANDLE_EXCEPTIONS(__asm (
 "	fstoq %1, %%f60\n"
 "	std %%f60, [%0]\n"
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_sub.c b/sysdeps/sparc/sparc64/soft-fp/qp_sub.c
index b1ed15a588..056224fb46 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_sub.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_sub.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (*a) - (*b)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,10 +29,10 @@ void _Qp_sub(long double *c, const long double *a, const long double *b)
   FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C);
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_QP(A, a);
-  FP_UNPACK_QP(B, b);
+  FP_UNPACK_SEMIRAW_QP(A, a);
+  FP_UNPACK_SEMIRAW_QP(B, b);
   FP_SUB_Q(C, A, B);
-  FP_PACK_QP(c, C);
+  FP_PACK_SEMIRAW_QP(c, C);
   QP_HANDLE_EXCEPTIONS(__asm (
 "	ldd [%1], %%f52\n"
 "	ldd [%1+8], %%f54\n"
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c
index d143ba28d3..a3bfaedfc9 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,7 +29,7 @@ void _Qp_uitoq(long double *c, const unsigned int a)
   FP_DECL_Q(C);
   unsigned int b = a;
 
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_QP(c, C);
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_QP(c, C);
   QP_NO_EXCEPTIONS;
 }
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c
index 302147711c..f691e4d36f 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,7 +29,7 @@ void _Qp_uxtoq(long double *c, const unsigned long a)
   FP_DECL_Q(C);
   unsigned long b = a;
 
-  FP_FROM_INT_Q(C, b, 64, long);
-  FP_PACK_QP(c, C);
+  FP_FROM_INT_Q(C, b, 64, unsigned long);
+  FP_PACK_RAW_QP(c, C);
   QP_NO_EXCEPTIONS;
 }
diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c
index 9b4d16969e..b7a6102693 100644
--- a/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c
+++ b/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    (*c) = (long double)(*a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -29,7 +29,7 @@ void _Qp_xtoq(long double *c, const long a)
   FP_DECL_Q(C);
   long b = a;
 
-  FP_FROM_INT_Q(C, b, 64, long);
-  FP_PACK_QP(c, C);
+  FP_FROM_INT_Q(C, b, 64, unsigned long);
+  FP_PACK_RAW_QP(c, C);
   QP_NO_EXCEPTIONS;
 }
diff --git a/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
index 42e6aa8506..449e955c16 100644
--- a/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
+++ b/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent software floating-point definitions.
    Sparc64 userland (_Q_* and _Qp_*) version.
-   Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz) and
@@ -23,6 +23,7 @@
    
 #include <fpu_control.h>
 #include <fenv.h>
+#include <stdlib.h>
 
 #define _FP_W_TYPE_SIZE		64
 #define _FP_W_TYPE		unsigned long
diff --git a/sysdeps/sparc/sparc64/sparcv9b/memcpy.S b/sysdeps/sparc/sparc64/sparcv9b/memcpy.S
index 8b70b0a932..760d526630 100644
--- a/sysdeps/sparc/sparc64/sparcv9b/memcpy.S
+++ b/sysdeps/sparc/sparc64/sparcv9b/memcpy.S
@@ -600,11 +600,11 @@ ENTRY(memmove)
 END(memmove)
 
 #ifdef USE_BPR
-weak_alias(memcpy, __align_cpy_1)
-weak_alias(memcpy, __align_cpy_2)
-weak_alias(memcpy, __align_cpy_4)
-weak_alias(memcpy, __align_cpy_8)
-weak_alias(memcpy, __align_cpy_16)
+weak_alias (memcpy, __align_cpy_1)
+weak_alias (memcpy, __align_cpy_2)
+weak_alias (memcpy, __align_cpy_4)
+weak_alias (memcpy, __align_cpy_8)
+weak_alias (memcpy, __align_cpy_16)
 #endif
 libc_hidden_builtin_def (memcpy)
 libc_hidden_builtin_def (memmove)
diff --git a/sysdeps/sparc/sparc64/sparcv9v/memcpy.S b/sysdeps/sparc/sparc64/sparcv9v/memcpy.S
new file mode 100644
index 0000000000..05c837fa25
--- /dev/null
+++ b/sysdeps/sparc/sparc64/sparcv9v/memcpy.S
@@ -0,0 +1,593 @@
+/* Copy SIZE bytes from SRC to DEST.  For SUN4V Niagara.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#define ASI_BLK_INIT_QUAD_LDD_P	0xe2
+#define ASI_P			0x80
+#define ASI_PNF			0x82
+
+#define LOAD(type,addr,dest)	type##a [addr] ASI_P, dest
+#define LOAD_TWIN(addr_reg,dest0,dest1)	\
+	ldda [addr_reg] ASI_BLK_INIT_QUAD_LDD_P, dest0
+
+#define STORE(type,src,addr)	type src, [addr]
+#define STORE_INIT(src,addr)	stxa src, [addr] %asi
+
+#ifndef XCC
+#define USE_BPR
+#define XCC xcc
+#endif
+
+	.register	%g2,#scratch
+	.register	%g3,#scratch
+	.register	%g6,#scratch
+
+	.text
+	.align		32
+
+ENTRY(bcopy)
+	sub		%o1, %o0, %o4
+	mov		%o0, %g4
+	cmp		%o4, %o2
+	mov		%o1, %o0
+	bgeu,pt		%XCC, 100f
+	 mov		%g4, %o1
+#ifndef USE_BPR
+	srl		%o2, 0, %o2
+#endif
+	brnz,pn		%o2, 220f
+	 add		%o0, %o2, %o0
+	retl
+	 nop
+END(bcopy)
+
+	.align		32
+ENTRY(memcpy)
+100:	/* %o0=dst, %o1=src, %o2=len */
+	mov		%o0, %g5
+	cmp		%o2, 0
+	be,pn		%XCC, 85f
+218:	 or		%o0, %o1, %o3
+	cmp		%o2, 16
+	blu,a,pn	%XCC, 80f
+	 or		%o3, %o2, %o3
+
+	/* 2 blocks (128 bytes) is the minimum we can do the block
+	 * copy with.  We need to ensure that we'll iterate at least
+	 * once in the block copy loop.  At worst we'll need to align
+	 * the destination to a 64-byte boundary which can chew up
+	 * to (64 - 1) bytes from the length before we perform the
+	 * block copy loop.
+	 */
+	cmp		%o2, (2 * 64)
+	blu,pt		%XCC, 70f
+	 andcc		%o3, 0x7, %g0
+
+	/* %o0:	dst
+	 * %o1:	src
+	 * %o2:	len  (known to be >= 128)
+	 *
+	 * The block copy loops will use %o4/%o5,%g2/%g3 as
+	 * temporaries while copying the data.
+	 */
+
+	LOAD(prefetch, %o1, #one_read)
+	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
+
+	/* Align destination on 64-byte boundary.  */
+	andcc		%o0, (64 - 1), %o4
+	be,pt		%XCC, 2f
+	 sub		%o4, 64, %o4
+	sub		%g0, %o4, %o4	! bytes to align dst
+	sub		%o2, %o4, %o2
+1:	subcc		%o4, 1, %o4
+	LOAD(ldub, %o1, %g1)
+	STORE(stb, %g1, %o0)
+	add		%o1, 1, %o1
+	bne,pt		%XCC, 1b
+	add		%o0, 1, %o0
+
+	/* If the source is on a 16-byte boundary we can do
+	 * the direct block copy loop.  If it is 8-byte aligned
+	 * we can do the 16-byte loads offset by -8 bytes and the
+	 * init stores offset by one register.
+	 *
+	 * If the source is not even 8-byte aligned, we need to do
+	 * shifting and masking (basically integer faligndata).
+	 *
+	 * The careful bit with init stores is that if we store
+	 * to any part of the cache line we have to store the whole
+	 * cacheline else we can end up with corrupt L2 cache line
+	 * contents.  Since the loop works on 64-bytes of 64-byte
+	 * aligned store data at a time, this is easy to ensure.
+	 */
+2:
+	andcc		%o1, (16 - 1), %o4
+	andn		%o2, (64 - 1), %g1	! block copy loop iterator
+	sub		%o2, %g1, %o2		! final sub-block copy bytes
+	be,pt		%XCC, 50f
+	 cmp		%o4, 8
+	be,a,pt		%XCC, 10f
+	 sub		%o1, 0x8, %o1
+
+	/* Neither 8-byte nor 16-byte aligned, shift and mask.  */
+	mov		%g1, %o4
+	and		%o1, 0x7, %g1
+	sll		%g1, 3, %g1
+	mov		64, %o3
+	andn		%o1, 0x7, %o1
+	LOAD(ldx, %o1, %g2)
+	sub		%o3, %g1, %o3
+	sllx		%g2, %g1, %g2
+
+#define SWIVEL_ONE_DWORD(SRC, TMP1, TMP2, PRE_VAL, PRE_SHIFT, POST_SHIFT, DST)\
+	LOAD(ldx, SRC, TMP1); \
+	srlx		TMP1, PRE_SHIFT, TMP2; \
+	or		TMP2, PRE_VAL, TMP2; \
+	STORE_INIT(TMP2, DST); \
+	sllx		TMP1, POST_SHIFT, PRE_VAL;
+
+1:	add		%o1, 0x8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x00)
+	add		%o1, 0x8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x08)
+	add		%o1, 0x8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x10)
+	add		%o1, 0x8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x18)
+	add		%o1, 32, %o1
+	LOAD(prefetch, %o1, #one_read)
+	sub		%o1, 32 - 8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x20)
+	add		%o1, 8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x28)
+	add		%o1, 8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x30)
+	add		%o1, 8, %o1
+	SWIVEL_ONE_DWORD(%o1, %g3, %o5, %g2, %o3, %g1, %o0 + 0x38)
+	subcc		%o4, 64, %o4
+	bne,pt		%XCC, 1b
+	 add		%o0, 64, %o0
+
+#undef SWIVEL_ONE_DWORD
+
+	srl		%g1, 3, %g1
+	ba,pt		%XCC, 60f
+	 add		%o1, %g1, %o1
+
+10:	/* Destination is 64-byte aligned, source was only 8-byte
+	 * aligned but it has been subtracted by 8 and we perform
+	 * one twin load ahead, then add 8 back into source when
+	 * we finish the loop.
+	 */
+	LOAD_TWIN(%o1, %o4, %o5)
+1:	add		%o1, 16, %o1
+	LOAD_TWIN(%o1, %g2, %g3)
+	add		%o1, 16 + 32, %o1
+	LOAD(prefetch, %o1, #one_read)
+	sub		%o1, 32, %o1
+	STORE_INIT(%o5, %o0 + 0x00)		! initializes cache line
+	STORE_INIT(%g2, %o0 + 0x08)
+	LOAD_TWIN(%o1, %o4, %o5)
+	add		%o1, 16, %o1
+	STORE_INIT(%g3, %o0 + 0x10)
+	STORE_INIT(%o4, %o0 + 0x18)
+	LOAD_TWIN(%o1, %g2, %g3)
+	add		%o1, 16, %o1
+	STORE_INIT(%o5, %o0 + 0x20)
+	STORE_INIT(%g2, %o0 + 0x28)
+	LOAD_TWIN(%o1, %o4, %o5)
+	STORE_INIT(%g3, %o0 + 0x30)
+	STORE_INIT(%o4, %o0 + 0x38)
+	subcc		%g1, 64, %g1
+	bne,pt		%XCC, 1b
+	 add		%o0, 64, %o0
+
+	ba,pt		%XCC, 60f
+	 add		%o1, 0x8, %o1
+
+50:	/* Destination is 64-byte aligned, and source is 16-byte
+	 * aligned.
+	 */
+1:	LOAD_TWIN(%o1, %o4, %o5)
+	add	%o1, 16, %o1
+	LOAD_TWIN(%o1, %g2, %g3)
+	add	%o1, 16 + 32, %o1
+	LOAD(prefetch, %o1, #one_read)
+	sub	%o1, 32, %o1
+	STORE_INIT(%o4, %o0 + 0x00)		! initializes cache line
+	STORE_INIT(%o5, %o0 + 0x08)
+	LOAD_TWIN(%o1, %o4, %o5)
+	add	%o1, 16, %o1
+	STORE_INIT(%g2, %o0 + 0x10)
+	STORE_INIT(%g3, %o0 + 0x18)
+	LOAD_TWIN(%o1, %g2, %g3)
+	add	%o1, 16, %o1
+	STORE_INIT(%o4, %o0 + 0x20)
+	STORE_INIT(%o5, %o0 + 0x28)
+	STORE_INIT(%g2, %o0 + 0x30)
+	STORE_INIT(%g3, %o0 + 0x38)
+	subcc	%g1, 64, %g1
+	bne,pt	%XCC, 1b
+	 add	%o0, 64, %o0
+	/* fall through */
+
+60:
+	/* %o2 contains any final bytes still needed to be copied
+	 * over. If anything is left, we copy it one byte at a time.
+	 */
+	wr		%g0, ASI_PNF, %asi
+	brz,pt		%o2, 85f
+	 sub		%o0, %o1, %o3
+	ba,a,pt		%XCC, 90f
+
+	.align		64
+70: /* 16 < len <= 64 */
+	bne,pn		%XCC, 75f
+	 sub		%o0, %o1, %o3
+
+72:
+	andn		%o2, 0xf, %o4
+	and		%o2, 0xf, %o2
+1:	subcc		%o4, 0x10, %o4
+	LOAD(ldx, %o1, %o5)
+	add		%o1, 0x08, %o1
+	LOAD(ldx, %o1, %g1)
+	sub		%o1, 0x08, %o1
+	STORE(stx, %o5, %o1 + %o3)
+	add		%o1, 0x8, %o1
+	STORE(stx, %g1, %o1 + %o3)
+	bgu,pt		%XCC, 1b
+	 add		%o1, 0x8, %o1
+73:	andcc		%o2, 0x8, %g0
+	be,pt		%XCC, 1f
+	 nop
+	sub		%o2, 0x8, %o2
+	LOAD(ldx, %o1, %o5)
+	STORE(stx, %o5, %o1 + %o3)
+	add		%o1, 0x8, %o1
+1:	andcc		%o2, 0x4, %g0
+	be,pt		%XCC, 1f
+	 nop
+	sub		%o2, 0x4, %o2
+	LOAD(lduw, %o1, %o5)
+	STORE(stw, %o5, %o1 + %o3)
+	add		%o1, 0x4, %o1
+1:	cmp		%o2, 0
+	be,pt		%XCC, 85f
+	 nop
+	ba,pt		%XCC, 90f
+	 nop
+
+75:
+	andcc		%o0, 0x7, %g1
+	sub		%g1, 0x8, %g1
+	be,pn		%icc, 2f
+	 sub		%g0, %g1, %g1
+	sub		%o2, %g1, %o2
+
+1:	subcc		%g1, 1, %g1
+	LOAD(ldub, %o1, %o5)
+	STORE(stb, %o5, %o1 + %o3)
+	bgu,pt		%icc, 1b
+	 add		%o1, 1, %o1
+
+2:	add		%o1, %o3, %o0
+	andcc		%o1, 0x7, %g1
+	bne,pt		%icc, 8f
+	 sll		%g1, 3, %g1
+
+	cmp		%o2, 16
+	bgeu,pt		%icc, 72b
+	 nop
+	ba,a,pt		%XCC, 73b
+
+8:	mov		64, %o3
+	andn		%o1, 0x7, %o1
+	LOAD(ldx, %o1, %g2)
+	sub		%o3, %g1, %o3
+	andn		%o2, 0x7, %o4
+	sllx		%g2, %g1, %g2
+1:	add		%o1, 0x8, %o1
+	LOAD(ldx, %o1, %g3)
+	subcc		%o4, 0x8, %o4
+	srlx		%g3, %o3, %o5
+	or		%o5, %g2, %o5
+	STORE(stx, %o5, %o0)
+	add		%o0, 0x8, %o0
+	bgu,pt		%icc, 1b
+	 sllx		%g3, %g1, %g2
+
+	srl		%g1, 3, %g1
+	andcc		%o2, 0x7, %o2
+	be,pn		%icc, 85f
+	 add		%o1, %g1, %o1
+	ba,pt		%XCC, 90f
+	 sub		%o0, %o1, %o3
+
+	.align		64
+80: /* 0 < len <= 16 */
+	andcc		%o3, 0x3, %g0
+	bne,pn		%XCC, 90f
+	 sub		%o0, %o1, %o3
+
+1:
+	subcc		%o2, 4, %o2
+	LOAD(lduw, %o1, %g1)
+	STORE(stw, %g1, %o1 + %o3)
+	bgu,pt		%XCC, 1b
+	 add		%o1, 4, %o1
+
+85:	retl
+	 mov		%g5, %o0
+
+	.align		32
+90:
+	subcc		%o2, 1, %o2
+	LOAD(ldub, %o1, %g1)
+	STORE(stb, %g1, %o1 + %o3)
+	bgu,pt		%XCC, 90b
+	 add		%o1, 1, %o1
+	retl
+	 mov		%g5, %o0
+
+END(memcpy)
+
+#define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3)	\
+	ldx		[%src - offset - 0x20], %t0; 		\
+	ldx		[%src - offset - 0x18], %t1; 		\
+	ldx		[%src - offset - 0x10], %t2; 		\
+	ldx		[%src - offset - 0x08], %t3; 		\
+	stw		%t0, [%dst - offset - 0x1c]; 		\
+	srlx		%t0, 32, %t0;				\
+	stw		%t0, [%dst - offset - 0x20]; 		\
+	stw		%t1, [%dst - offset - 0x14]; 		\
+	srlx		%t1, 32, %t1;				\
+	stw		%t1, [%dst - offset - 0x18]; 		\
+	stw		%t2, [%dst - offset - 0x0c]; 		\
+	srlx		%t2, 32, %t2;				\
+	stw		%t2, [%dst - offset - 0x10]; 		\
+	stw		%t3, [%dst - offset - 0x04];		\
+	srlx		%t3, 32, %t3;				\
+	stw		%t3, [%dst - offset - 0x08];
+
+#define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3)	\
+	ldx		[%src - offset - 0x20], %t0; 		\
+	ldx		[%src - offset - 0x18], %t1; 		\
+	ldx		[%src - offset - 0x10], %t2; 		\
+	ldx		[%src - offset - 0x08], %t3; 		\
+	stx		%t0, [%dst - offset - 0x20]; 		\
+	stx		%t1, [%dst - offset - 0x18]; 		\
+	stx		%t2, [%dst - offset - 0x10]; 		\
+	stx		%t3, [%dst - offset - 0x08];		\
+	ldx		[%src - offset - 0x40], %t0; 		\
+	ldx		[%src - offset - 0x38], %t1; 		\
+	ldx		[%src - offset - 0x30], %t2; 		\
+	ldx		[%src - offset - 0x28], %t3; 		\
+	stx		%t0, [%dst - offset - 0x40]; 		\
+	stx		%t1, [%dst - offset - 0x38]; 		\
+	stx		%t2, [%dst - offset - 0x30]; 		\
+	stx		%t3, [%dst - offset - 0x28];
+
+#define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3)	\
+	ldx		[%src + offset + 0x00], %t0;		\
+	ldx		[%src + offset + 0x08], %t1; 		\
+	stw		%t0, [%dst + offset + 0x04]; 		\
+	srlx		%t0, 32, %t2;				\
+	stw		%t2, [%dst + offset + 0x00]; 		\
+	stw		%t1, [%dst + offset + 0x0c]; 		\
+	srlx		%t1, 32, %t3;				\
+	stw		%t3, [%dst + offset + 0x08];
+
+#define RMOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1)		\
+	ldx		[%src + offset + 0x00], %t0; 		\
+	ldx		[%src + offset + 0x08], %t1; 		\
+	stx		%t0, [%dst + offset + 0x00]; 		\
+	stx		%t1, [%dst + offset + 0x08];
+
+	.align		32
+228:	andcc		%o2, 1, %g0
+	be,pt		%icc, 2f+4
+1:	 ldub		[%o1 - 1], %o5
+	sub		%o1, 1, %o1
+	sub		%o0, 1, %o0
+	subcc		%o2, 1, %o2
+	be,pn		%xcc, 229f
+	 stb		%o5, [%o0]
+2:	ldub		[%o1 - 1], %o5
+	sub		%o0, 2, %o0
+	ldub		[%o1 - 2], %g5
+	sub		%o1, 2, %o1
+	subcc		%o2, 2, %o2
+	stb		%o5, [%o0 + 1]
+	bne,pt		%xcc, 2b
+	 stb		%g5, [%o0]
+229:	retl
+	 mov		%g4, %o0
+out:	retl
+	 mov		%g5, %o0
+
+	.align		32
+ENTRY(memmove)
+	mov		%o0, %g5
+#ifndef USE_BPR
+	srl		%o2, 0, %o2
+#endif
+	brz,pn		%o2, out
+	 sub		%o0, %o1, %o4
+	cmp		%o4, %o2
+	bgeu,pt		%XCC, 218b
+	 mov		%o0, %g4
+	add		%o0, %o2, %o0
+220:	add		%o1, %o2, %o1
+	cmp		%o2, 15
+	bleu,pn		%xcc, 228b
+	 andcc		%o0, 7, %g2
+	sub		%o0, %o1, %g5
+	andcc		%g5, 3, %o5
+	bne,pn		%xcc, 232f
+	 andcc		%o1, 3, %g0
+	be,a,pt		%xcc, 236f
+	 andcc		%o1, 4, %g0
+	andcc		%o1, 1, %g0
+	be,pn		%xcc, 4f
+	 andcc		%o1, 2, %g0
+	ldub		[%o1 - 1], %g2
+	sub		%o1, 1, %o1
+	sub		%o0, 1, %o0
+	sub		%o2, 1, %o2
+	be,pn		%xcc, 5f
+	 stb		%g2, [%o0]
+4:	lduh		[%o1 - 2], %g2
+	sub		%o1, 2, %o1
+	sub		%o0, 2, %o0
+	sub		%o2, 2, %o2
+	sth		%g2, [%o0]
+5:	andcc		%o1, 4, %g0
+236:	be,a,pn		%xcc, 2f
+	 andcc		%o2, -128, %g6
+	lduw		[%o1 - 4], %g5
+	sub		%o1, 4, %o1
+	sub		%o0, 4, %o0
+	sub		%o2, 4, %o2
+	stw		%g5, [%o0]
+	andcc		%o2, -128, %g6
+2:	be,pn		%xcc, 235f
+	 andcc		%o0, 4, %g0
+	be,pn		%xcc, 282f + 4
+5:	RMOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+	RMOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5)
+	RMOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+	RMOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5)
+	subcc		%g6, 128, %g6
+	sub		%o1, 128, %o1
+	bne,pt		%xcc, 5b
+	 sub		%o0, 128, %o0
+235:	andcc		%o2, 0x70, %g6
+41:	be,pn		%xcc, 280f
+	 andcc		%o2, 8, %g0
+
+279:	rd		%pc, %o5
+	sll		%g6, 1, %g5
+	sub		%o1, %g6, %o1
+	sub		%o5, %g5, %o5
+	jmpl		%o5 + %lo(280f - 279b), %g0
+	 sub		%o0, %g6, %o0
+	RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5)
+	RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5)
+	RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5)
+	RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5)
+	RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5)
+	RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5)
+	RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5)
+280:	be,pt		%xcc, 281f
+	 andcc		%o2, 4, %g0
+	ldx		[%o1 - 8], %g2
+	sub		%o0, 8, %o0
+	stw		%g2, [%o0 + 4]
+	sub		%o1, 8, %o1
+	srlx		%g2, 32, %g2
+	stw		%g2, [%o0]
+281:	be,pt		%xcc, 1f
+	 andcc		%o2, 2, %g0
+	lduw		[%o1 - 4], %g2
+	sub		%o1, 4, %o1
+	stw		%g2, [%o0 - 4]
+	sub		%o0, 4, %o0
+1:	be,pt		%xcc, 1f
+	 andcc		%o2, 1, %g0
+	lduh		[%o1 - 2], %g2
+	sub		%o1, 2, %o1
+	sth		%g2, [%o0 - 2]
+	sub		%o0, 2, %o0
+1:	be,pt		%xcc, 211f
+	 nop
+	ldub		[%o1 - 1], %g2
+	stb		%g2, [%o0 - 1]
+211:	retl
+	 mov		%g4, %o0
+
+282:	RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+	RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+	subcc		%g6, 128, %g6
+	sub		%o1, 128, %o1
+	bne,pt		%xcc, 282b
+	 sub		%o0, 128, %o0
+	andcc		%o2, 0x70, %g6
+	be,pn		%xcc, 284f
+	 andcc		%o2, 8, %g0
+
+283:	rd		%pc, %o5
+	sub		%o1, %g6, %o1
+	sub		%o5, %g6, %o5
+	jmpl		%o5 + %lo(284f - 283b), %g0
+	 sub		%o0, %g6, %o0
+	RMOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3)
+	RMOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3)
+	RMOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3)
+	RMOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3)
+	RMOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3)
+	RMOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3)
+	RMOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3)
+284:	be,pt		%xcc, 285f
+	 andcc		%o2, 4, %g0
+	ldx		[%o1 - 8], %g2
+	sub		%o0, 8, %o0
+	sub		%o1, 8, %o1
+	stx		%g2, [%o0]
+285:	be,pt		%xcc, 1f
+	 andcc		%o2, 2, %g0
+	lduw		[%o1 - 4], %g2
+	sub		%o0, 4, %o0
+	sub		%o1, 4, %o1
+	stw		%g2, [%o0]
+1:	be,pt		%xcc, 1f
+	 andcc		%o2, 1, %g0
+	lduh		[%o1 - 2], %g2
+	sub		%o0, 2, %o0
+	sub		%o1, 2, %o1
+	sth		%g2, [%o0]
+1:	be,pt		%xcc, 1f
+	 nop
+	ldub		[%o1 - 1], %g2
+	stb		%g2, [%o0 - 1]
+1:	retl
+	 mov		%g4, %o0
+
+232:	ldub		[%o1 - 1], %g5
+	sub		%o1, 1, %o1
+	sub		%o0, 1, %o0
+	subcc		%o2, 1, %o2
+	bne,pt		%xcc, 232b
+	 stb		%g5, [%o0]
+234:	retl
+	 mov		%g4, %o0
+END(memmove)
+
+#ifdef USE_BPR
+weak_alias (memcpy, __align_cpy_1)
+weak_alias (memcpy, __align_cpy_2)
+weak_alias (memcpy, __align_cpy_4)
+weak_alias (memcpy, __align_cpy_8)
+weak_alias (memcpy, __align_cpy_16)
+#endif
+libc_hidden_builtin_def (memcpy)
+libc_hidden_builtin_def (memmove)
diff --git a/sysdeps/sparc/sparc64/sparcv9v/memset.S b/sysdeps/sparc/sparc64/sparcv9v/memset.S
new file mode 100644
index 0000000000..ac0a50cf8e
--- /dev/null
+++ b/sysdeps/sparc/sparc64/sparcv9v/memset.S
@@ -0,0 +1,127 @@
+/* Set a block of memory to some byte value.  For SUN4V Niagara.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#define ASI_BLK_INIT_QUAD_LDD_P	0xe2
+#define ASI_P			0x80
+#define ASI_PNF			0x82
+
+#ifndef XCC
+#define USE_BPR
+#define XCC xcc
+#endif
+
+	.register	%g2,#scratch
+
+	.text
+	.align		32
+
+ENTRY(memset)
+	/* %o0=buf, %o1=pat, %o2=len */
+	and		%o1, 0xff, %o3
+	mov		%o2, %o1
+	sllx		%o3, 8, %g1
+	or		%g1, %o3, %o2
+	sllx		%o2, 16, %g1
+	or		%g1, %o2, %o2
+	sllx		%o2, 32, %g1
+	ba,pt		%XCC, 1f
+	 or		%g1, %o2, %o2
+END(memset)
+
+ENTRY(__bzero)
+	clr		%o2
+1:	brz,pn		%o1, 90f
+	 mov		%o0, %o3
+
+	wr		%g0, ASI_P, %asi
+
+	cmp		%o1, 15
+	bl,pn		%icc, 70f
+	 andcc		%o0, 0x7, %g1
+	be,pt		%XCC, 2f
+	 mov		8, %g2
+	sub		%g2, %g1, %g1
+	sub		%o1, %g1, %o1
+1:	stba		%o2, [%o0 + 0x00] %asi
+	subcc		%g1, 1, %g1
+	bne,pt		%XCC, 1b
+	 add		%o0, 1, %o0
+2:	cmp		%o1, 128
+	bl,pn		%icc, 60f
+	 andcc		%o0, (64 - 1), %g1
+	be,pt		%XCC, 40f
+	 mov		64, %g2
+	sub		%g2, %g1, %g1
+	sub		%o1, %g1, %o1
+1:	stxa		%o2, [%o0 + 0x00] %asi
+	subcc		%g1, 8, %g1
+	bne,pt		%XCC, 1b
+	 add		%o0, 8, %o0
+
+40:
+	wr		%g0, ASI_BLK_INIT_QUAD_LDD_P, %asi
+	andn		%o1, (64 - 1), %g1
+	sub		%o1, %g1, %o1
+50:
+	stxa		%o2, [%o0 + 0x00] %asi
+	stxa		%o2, [%o0 + 0x08] %asi
+	stxa		%o2, [%o0 + 0x10] %asi
+	stxa		%o2, [%o0 + 0x18] %asi
+	stxa		%o2, [%o0 + 0x20] %asi
+	stxa		%o2, [%o0 + 0x28] %asi
+	stxa		%o2, [%o0 + 0x30] %asi
+	stxa		%o2, [%o0 + 0x38] %asi
+	subcc		%g1, 64, %g1
+	bne,pt		%XCC, 50b
+	 add		%o0, 64, %o0
+
+	wr		%g0, ASI_P, %asi
+	brz,pn		%o1, 80f
+60:
+	 andncc		%o1, 0x7, %g1
+	be,pn		%XCC, 2f
+	 sub		%o1, %g1, %o1
+1:	stxa		%o2, [%o0 + 0x00] %asi
+	subcc		%g1, 8, %g1
+	bne,pt		%XCC, 1b
+	 add		%o0, 8, %o0
+2:	brz,pt		%o1, 80f
+	 nop
+
+70:
+1:	stba		%o2, [%o0 + 0x00] %asi
+	subcc		%o1, 1, %o1
+	bne,pt		%icc, 1b
+	 add		%o0, 1, %o0
+
+	/* fallthrough */
+
+80:
+	wr		%g0, ASI_PNF, %asi
+
+90:
+	retl
+	 mov		%o3, %o0
+END(__bzero)
+
+libc_hidden_builtin_def (memset)
+weak_alias (__bzero, bzero)
diff --git a/sysdeps/unix/Dist b/sysdeps/unix/Dist
deleted file mode 100644
index b3c3880a79..0000000000
--- a/sysdeps/unix/Dist
+++ /dev/null
@@ -1,14 +0,0 @@
-errnos-tmpl.c
-errnos.awk
-ioctls-tmpl.c
-ioctls.awk
-snarf-ioctls
-make_errlist.c
-mk-local_lim.c
-s-proto.S
-make-syscalls.sh
-i386/dl-brk.S
-mips/dl-brk.S
-sparc/dl-brk.S
-s-proto-bp.S
-s-proto-cancel.S
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 5b326e032c..4ab06ba33e 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2003
+# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,1999,2003, 2006
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -212,24 +212,6 @@ common-generated := $(common-generated) \
 		    bits/ioctls.h ioctls make-ioctls make-ioctls.c
 endif
 
-ifeq ($(subdir),stdio-common)
-ifeq (,$(filter-out $(sysdep_dir)/generic/ $(objpfx),\
-	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/errlist.c))))))
-
-before-compile: $(objpfx)errlist.c
-$(objpfx)errlist.c: $(objpfx)make_errlist
-	@rm -f $@
-	$(dir $<)$(notdir $<) > $@-tmp
-	mv $@-tmp $@
-
-$(objpfx)make_errlist: $(sysdep_dir)/unix/make_errlist.c
-	$(native-compile)
-
-generated := $(generated) make_errlist errlist.c
-
-endif
-endif # stdio-common
-
 ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
 	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/sys/syscall.h))))))
 
@@ -294,7 +276,13 @@ sysdep_routines += stub-syscalls
 $(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \
 			  $(..)sysdeps/unix/Makefile
 	$(make-target-directory)
-	(echo '#include <errno.h>'; \
+	(for call in $(unix-stub-syscalls); do \
+	   echo "#define $$call RENAMED_$$call"; \
+	 done; \
+	 echo '#include <errno.h>'; \
+	 for call in $(unix-stub-syscalls); do \
+	   echo "#undef $$call"; \
+	 done; \
 	 echo 'long int _no_syscall (void)'; \
 	 echo '{ __set_errno (ENOSYS); return -1L; }'; \
 	 for call in $(unix-stub-syscalls); do \
@@ -317,9 +305,6 @@ generated += stub-syscalls.c
 endif
 endif
 
-export sysdirs
-export asm_CPP := $(COMPILE.S) -E -x assembler-with-cpp
-
 # This is the end of the pipeline for compiling the syscall stubs.
 # The stdin in assembler with cpp using sysdep.h macros.
 # Be sure to disable debugging info since it would all just say "<stdin>".
@@ -330,7 +315,9 @@ $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
 			       $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
 	for dir in $(+sysdep_dirs); do \
 	  test -f $$dir/syscalls.list && \
-	  { $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
+	  { sysdirs='$(sysdirs)' \
+	    asm_CPP='$(COMPILE.S) -E -x assembler-with-cpp' \
+	    $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
 	  test $$dir = $(..)sysdeps/unix && break; \
 	done > $@T
 	mv -f $@T $@
diff --git a/sysdeps/unix/alarm.c b/sysdeps/unix/alarm.c
index ae77782c54..84ab5a52fe 100644
--- a/sysdeps/unix/alarm.c
+++ b/sysdeps/unix/alarm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994,1997,2002,2004 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
@@ -41,7 +41,10 @@ alarm (seconds)
     return 0;
 
   retval = old.it_value.tv_sec;
-  if (old.it_value.tv_usec)
+  /* Round to the nearest second, but never report zero seconds when
+     the alarm is still set.  */
+  if (old.it_value.tv_usec >= 500000
+      || (retval == 0 && old.it_value.tv_usec > 0))
     ++retval;
   return retval;
 }
diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h
index f9f1dd6e41..2e5bc798eb 100644
--- a/sysdeps/unix/alpha/sysdep.h
+++ b/sysdeps/unix/alpha/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004
+/* Copyright (C) 1992, 1995, 1996, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe (brendan@zen.org).
@@ -242,9 +242,10 @@ __LABEL(name)						\
 	register long _sc_0 inline_syscall_r0_asm;		\
 	register long _sc_16 __asm__("$16");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
+	_sc_16 = _tmp_16;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3"				\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -261,10 +262,12 @@ __LABEL(name)						\
 	register long _sc_16 __asm__("$16");			\
 	register long _sc_17 __asm__("$17");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4"			\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -282,11 +285,14 @@ __LABEL(name)						\
 	register long _sc_17 __asm__("$17");			\
 	register long _sc_18 __asm__("$18");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5"			\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -305,12 +311,16 @@ __LABEL(name)						\
 	register long _sc_17 __asm__("$17");			\
 	register long _sc_18 __asm__("$18");			\
 	register long _sc_19 __asm__("$19");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
+	register long _tmp_19 = (long) (arg4);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
-	_sc_19 = (long) (arg4);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
+	_sc_19 = _tmp_19;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5 %6"			\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -330,13 +340,18 @@ __LABEL(name)						\
 	register long _sc_18 __asm__("$18");			\
 	register long _sc_19 __asm__("$19");			\
 	register long _sc_20 __asm__("$20");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
+	register long _tmp_19 = (long) (arg4);			\
+	register long _tmp_20 = (long) (arg5);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
-	_sc_19 = (long) (arg4);					\
-	_sc_20 = (long) (arg5);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
+	_sc_19 = _tmp_19;					\
+	_sc_20 = _tmp_20;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7"		\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -357,14 +372,20 @@ __LABEL(name)						\
 	register long _sc_19 __asm__("$19");			\
 	register long _sc_20 __asm__("$20");			\
 	register long _sc_21 __asm__("$21");			\
+	register long _tmp_16 = (long) (arg1);			\
+	register long _tmp_17 = (long) (arg2);			\
+	register long _tmp_18 = (long) (arg3);			\
+	register long _tmp_19 = (long) (arg4);			\
+	register long _tmp_20 = (long) (arg5);			\
+	register long _tmp_21 = (long) (arg6);			\
 								\
 	_sc_0 = name;						\
-	_sc_16 = (long) (arg1);					\
-	_sc_17 = (long) (arg2);					\
-	_sc_18 = (long) (arg3);					\
-	_sc_19 = (long) (arg4);					\
-	_sc_20 = (long) (arg5);					\
-	_sc_21 = (long) (arg6);					\
+	_sc_16 = _tmp_16;					\
+	_sc_17 = _tmp_17;					\
+	_sc_18 = _tmp_18;					\
+	_sc_19 = _tmp_19;					\
+	_sc_20 = _tmp_20;					\
+	_sc_21 = _tmp_21;					\
 	__asm__ __volatile__					\
 	  ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8"		\
 	   : inline_syscall_r0_out_constraint (_sc_0),		\
@@ -376,4 +397,42 @@ __LABEL(name)						\
 	_sc_ret = _sc_0, _sc_err = _sc_19;			\
 }
 
+/* Pointer mangling support.  Note that tls access is slow enough that
+   we don't deoptimize things by placing the pointer check value there.  */
+
+#include <stdint.h>
+
+#if defined NOT_IN_libc && defined IS_IN_rtld
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dst, src, tmp)				\
+	ldah	tmp, __pointer_chk_guard_local($29) !gprelhigh;	\
+	ldq	tmp, __pointer_chk_guard_local(tmp) !gprellow;	\
+	xor	src, tmp, dst
+#  define PTR_MANGLE2(dst, src, tmp)				\
+	xor	src, tmp, dst
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
+#  define PTR_MANGLE(var)	\
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
+# endif
+#elif defined PIC
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dst, src, tmp)		\
+	ldq	tmp, __pointer_chk_guard;	\
+	xor	src, tmp, dst
+#  define PTR_MANGLE2(dst, src, tmp)		\
+	xor	src, tmp, dst
+#  define PTR_DEMANGLE(dst, tmp)   PTR_MANGLE(dst, dst, tmp)
+#  define PTR_DEMANGLE2(dst, tmp)  PTR_MANGLE2(dst, dst, tmp)
+# else
+extern uintptr_t __pointer_chk_guard attribute_relro;
+#  define PTR_MANGLE(var)	\
+	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard)
+#  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
+# endif
+#endif
+
 #endif /* ASSEMBLER */
diff --git a/sysdeps/unix/arm/Dist b/sysdeps/unix/arm/Dist
deleted file mode 100644
index 7785d5ee70..0000000000
--- a/sysdeps/unix/arm/Dist
+++ /dev/null
@@ -1 +0,0 @@
-dl-brk.S
diff --git a/sysdeps/unix/arm/brk.S b/sysdeps/unix/arm/brk.S
deleted file mode 100644
index 914e8a8bbe..0000000000
--- a/sysdeps/unix/arm/brk.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 95, 97, 98 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifndef	SYS_brk
-#define	SYS_brk	17
-#endif
-
-.data
-.globl C_SYMBOL_NAME(__curbrk)
-C_LABEL(__curbrk)
-#ifdef	HAVE_GNU_LD
-	.long C_SYMBOL_NAME(_end)
-#else
-	.long C_SYMBOL_NAME(end)
-#endif
-
-.text
-SYSCALL__ (brk, 1)
-#ifdef PIC
-	ldr r1, 1f
-	ldr r2, _cb_addr
-2:	add r1, pc, r1
-	add r1, r1, r2
-#else
-	ldr r1, _cb_addr
-#endif
-	str r0, [r1]
-	mov r0, $0
-	DO_RET (r14)
-#ifdef PIC
-1:	.long _GLOBAL_OFFSET_TABLE_ - 2b - 8
-_cb_addr:
-	.long C_SYMBOL_NAME(__curbrk)(GOTOFF)
-#else
-_cb_addr:
-	.long C_SYMBOL_NAME(__curbrk)
-#endif
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/arm/dl-brk.S b/sysdeps/unix/arm/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/arm/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/arm/fork.S b/sysdeps/unix/arm/fork.S
deleted file mode 100644
index bd00c92cfe..0000000000
--- a/sysdeps/unix/arm/fork.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991,92,94,95,97,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* ARM version.  */
-
-SYSCALL__ (fork, 0)
-	/* R1 is now 0 for the parent and 1 for the child.  Decrement it to
-	   make it -1 (all bits set) for the parent, and 0 (no bits set)
-	   for the child.  Then AND it with R0, so the parent gets
-	   R0&-1==R0, and the child gets R0&0==0.  */
-	sub r1, r1, $1
-	and r0, r0, r1
-	DO_RET (r14)
-PSEUDO_END (__fork)
-libc_hidden_def (__fork)
-
-weak_alias (__fork, fork)
diff --git a/sysdeps/unix/arm/start.c b/sysdeps/unix/arm/start.c
deleted file mode 100644
index 6bf08b1d7f..0000000000
--- a/sysdeps/unix/arm/start.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Special startup code for ARM a.out binaries.
-   Copyright (C) 1998, 2004 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.
-
-   In addition to the permissions in the GNU Lesser General Public
-   License, the Free Software Foundation gives you unlimited
-   permission to link the compiled version of this file with other
-   programs, and to distribute those programs without any restriction
-   coming from the use of this file. (The GNU Lesser General Public
-   License restrictions do apply in other respects; for example, they
-   cover modification of the file, and distribution when not linked
-   into another program.)
-
-   Note that people who make modified versions of this file are not
-   obligated to grant this special exception for their modified
-   versions; it is their choice whether to do so. The GNU Lesser
-   General Public License gives permission to release a modified
-   version without this exception; this exception also makes it
-   possible to release a modified version which carries forward this
-   exception.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* The first piece of initialized data.  */
-int __data_start = 0;
-#ifdef HAVE_WEAK_SYMBOLS
-weak_alias (__data_start, data_start)
-#endif
-
-extern void __libc_init (int argc, char **argv, char **envp);
-extern int main (int argc, char **argv, char **envp);
-
-/* N.B.: It is important that this be the first function.
-   This file is the first thing in the text section.  */
-
-/* If this was in C it might create its own stack frame and
-   screw up the arguments.  */
-#ifdef NO_UNDERSCORES
-asm (".text; .globl _start; _start: B start1");
-#else
-asm (".text; .globl __start; __start: B _start1");
-
-/* Make an alias called `start' (no leading underscore, so it can't
-   conflict with C symbols) for `_start'.  This is the name vendor crt0.o's
-   tend to use, and thus the name most linkers expect.  */
-asm (".set start, __start");
-#endif
-
-/* Fool gcc into thinking that more args are passed.  This makes it look
-   on the stack (correctly) for the real arguments.  It causes somewhat
-   strange register usage in start1(), but we aren't too bothered about
-   that at the moment. */
-#define DUMMIES a1, a2, a3, a4
-
-#ifdef	DUMMIES
-#define	ARG_DUMMIES	DUMMIES,
-#define	DECL_DUMMIES	int DUMMIES;
-#else
-#define	ARG_DUMMIES
-#define	DECL_DUMMIES
-#endif
-
-/* ARGSUSED */
-static void
-start1 (ARG_DUMMIES argc, argv, envp)
-     DECL_DUMMIES
-     int argc;
-     char **argv;
-     char **envp;
-{
-  /* Store a pointer to the environment.  */
-  __environ = envp;
-
-  /* Do C library initializations.  */
-  __libc_init (argc, argv, __environ);
-
-  /* Call the user program.  */
-  exit (main (argc, argv, __environ));
-}
diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S
deleted file mode 100644
index 4810805d85..0000000000
--- a/sysdeps/unix/arm/sysdep.S
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,2002,03 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H
-#include <bits/errno.h>
-
-.globl C_SYMBOL_NAME(errno)
-.globl syscall_error
-
-#undef syscall_error
-#ifdef NO_UNDERSCORES
-__syscall_error:
-#else
-syscall_error:
-#endif
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-	cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK?  */
-	moveq r0, $EAGAIN	/* Yes; translate it to EAGAIN.  */
-#endif
-
-#ifdef _LIBC_REENTRANT
-	str lr, [sp, #-4]!
-	str r0, [sp, #-4]!
-	bl PLTJMP(C_SYMBOL_NAME(__errno_location))
-	ldr r1, [sp], #4
-	str r1, [r0]
-	mvn r0, $0
-	ldr pc, [sp], #4	
-#else
-#ifndef	PIC
-	ldr r1, 1f
-	str r0, [r1]
-	mvn r0, $0
-	DO_RET (r14)
-
-1:	.long C_SYMBOL_NAME(errno)
-#else
-	@ we have to establish our PIC register
-	ldr r2, 1f
-	ldr r1, 2f
-0:	add r2, pc, r2
-	str r0, [r1, r2]
-	mvn r0, $0
-	DO_RET (r14)
-
-1:	.word _GLOBAL_OFFSET_TABLE_ - 0b - 8
-2:	.word C_SYMBOL_NAME(errno)(GOTOFF)
-#endif
-#endif
-
-#undef	__syscall_error
-END (__syscall_error)
diff --git a/sysdeps/unix/arm/sysdep.h b/sysdeps/unix/arm/sysdep.h
deleted file mode 100644
index 5f36272f27..0000000000
--- a/sysdeps/unix/arm/sysdep.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/unix/sysdep.h>
-#include <sysdeps/arm/sysdep.h>
-
-/* Some definitions to allow the assembler in sysdeps/unix/ to build
-   without needing ARM-specific versions of all the files.  */
-
-#ifdef __ASSEMBLER__
-
-#define ret		DO_RET (r14)
-#define MOVE(a,b)	mov b,a
-
-#endif
diff --git a/sysdeps/unix/bsd/Dist b/sysdeps/unix/bsd/Dist
deleted file mode 100644
index e81952e015..0000000000
--- a/sysdeps/unix/bsd/Dist
+++ /dev/null
@@ -1,5 +0,0 @@
-setrgid.c
-setruid.c
-bsdstat.h
-bsdtty.h
-vax/dl-brk.S
diff --git a/sysdeps/unix/bsd/bsd4.4/Dist b/sysdeps/unix/bsd/bsd4.4/Dist
deleted file mode 100644
index 2562aac1b6..0000000000
--- a/sysdeps/unix/bsd/bsd4.4/Dist
+++ /dev/null
@@ -1 +0,0 @@
-cmsg_nxthdr.c
diff --git a/sysdeps/unix/bsd/init-posix.c b/sysdeps/unix/bsd/init-posix.c
index 06f727684f..b5ea8846f7 100644
--- a/sysdeps/unix/bsd/init-posix.c
+++ b/sysdeps/unix/bsd/init-posix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 94, 95, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 94, 95, 97, 98, 2005 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
@@ -30,6 +30,4 @@ __init_posix (void)
   _posix_start_time = time ((time_t *) NULL);
 }
 
-#ifdef	HAVE_GNU_LD
 text_set_element(__libc_subinit, __init_posix);
-#endif
diff --git a/sysdeps/unix/bsd/m68k/pipe.S b/sysdeps/unix/bsd/m68k/pipe.S
deleted file mode 100644
index d7b8ec28d5..0000000000
--- a/sysdeps/unix/bsd/m68k/pipe.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991,1992,1993,1995,1997,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-SYSCALL__ (pipe, 1)
-#ifdef	__motorola__
-	move.l 4(sp), a0
-	movem.l d0-d1, (a0)
-#else
-	movel sp@(4), a0
-	moveml d0-d1, a0@
-#endif
-	clrl d0
-	rts
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/bsd/m68k/start.c b/sysdeps/unix/bsd/m68k/start.c
deleted file mode 100644
index 1067853d61..0000000000
--- a/sysdeps/unix/bsd/m68k/start.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define	DUMMIES	ignore0
-
-#include <sysdeps/unix/start.c>
diff --git a/sysdeps/unix/bsd/m68k/syscall.S b/sysdeps/unix/bsd/m68k/syscall.S
deleted file mode 100644
index eb1a8ec7a9..0000000000
--- a/sysdeps/unix/bsd/m68k/syscall.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1993, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-ENTRY (syscall)
-	movel sp@+, a0		/* Pop return address into A0.  */
-	DO_CALL (sp@, 0)	/* Do system call.  */
-	jmp a0@			/* Return to A0.  */
-error:	movel a0, sp@-		/* Error; push return address */
-	jmp syscall_error	/* and jump to error handler.  */
diff --git a/sysdeps/unix/bsd/m68k/sysdep.S b/sysdeps/unix/bsd/m68k/sysdep.S
deleted file mode 100644
index 90f35c9bcc..0000000000
--- a/sysdeps/unix/bsd/m68k/sysdep.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define _ERRNO_H
-#include <bits/errno.h>
-
-.globl syscall_error
-syscall_error:
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-#ifdef __motorola__
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	cmp.l #EWOULDBLOCK_sys, d0
-	bne store
-	moveq.l #EAGAIN, d0
-#endif
-store:	move.l d0, _errno
-	moveq.l #-1, d0
-#else
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	cmpl #EWOULDBLOCK_sys, d0
-	bne store
-	moveq #EAGAIN, d0
-#endif
-store:	movel d0, _errno
-	moveq #-1, d0
-#endif
-	rts
diff --git a/sysdeps/unix/bsd/m68k/wait.S b/sysdeps/unix/bsd/m68k/wait.S
deleted file mode 100644
index 9fb4fd93bd..0000000000
--- a/sysdeps/unix/bsd/m68k/wait.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-SYSCALL__ (wait, 1)
-#ifdef __motorola__
-	tst.l 4(sp)
-	beq 1f
-	movea.l 4(sp), a0
-	move.l d1, (a0)
-#else
-	tstl sp@(4)
-	beq 1f
-	moveal sp@(4), a0
-	movel d1, a0@
-#endif
-1:	rts
-
-weak_alias (__wait, wait)
diff --git a/sysdeps/unix/bsd/sun/Dist b/sysdeps/unix/bsd/sun/Dist
deleted file mode 100644
index ccd3a610ee..0000000000
--- a/sysdeps/unix/bsd/sun/Dist
+++ /dev/null
@@ -1 +0,0 @@
-m68k/dl-brk.S
diff --git a/sysdeps/unix/bsd/sun/bits/signum.h b/sysdeps/unix/bsd/sun/bits/signum.h
deleted file mode 100644
index c13e7cd742..0000000000
--- a/sysdeps/unix/bsd/sun/bits/signum.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Signal number definitions.  SunOS version.
-   Copyright (C) 1994, 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef	_SIGNAL_H
-
-/* This file defines the fake signal functions and signal
-   number constants for SunOS 3 and 4 Unix systems.  */
-
-/* Fake signal functions.  */
-#define	SIG_ERR	((__sighandler_t) -1) /* Error return.  */
-#define	SIG_DFL	((__sighandler_t) 0) /* Default action.  */
-#define	SIG_IGN	((__sighandler_t) 1) /* Ignore signal.  */
-
-
-/* Signals.  */
-#define	SIGHUP		1	/* Hangup (POSIX).  */
-#define	SIGINT		2	/* Interrupt (ANSI).  */
-#define	SIGQUIT		3	/* Quit (POSIX).  */
-#define	SIGILL		4	/* Illegal instruction (ANSI).  */
-#define	SIGABRT		SIGIOT	/* Abort (ANSI).  */
-#define	SIGTRAP		5	/* Trace trap (POSIX).  */
-#define	SIGIOT		6	/* IOT trap (4.2 BSD).  */
-#define	SIGEMT		7	/* EMT trap (4.2 BSD).  */
-#define	SIGFPE		8	/* Floating-point exception (ANSI).  */
-#define	SIGKILL		9	/* Kill, unblockable (POSIX).  */
-#define	SIGBUS		10	/* Bus error (4.2 BSD).  */
-#define	SIGSEGV		11	/* Segmentation violation (ANSI).  */
-#define	SIGSYS		12	/* Bad argument to system call (4.2 BSD).  */
-#define	SIGPIPE		13	/* Broken pipe (POSIX).  */
-#define	SIGALRM		14	/* Alarm clock (POSIX).  */
-#define	SIGTERM		15	/* Termination (ANSI).  */
-#define	SIGURG		16	/* Urgent condition on socket (4.2 BSD).  */
-#define	SIGSTOP		17	/* Stop, unblockable (POSIX).  */
-#define	SIGTSTP		18	/* Keyboard stop (POSIX).  */
-#define	SIGCONT		19	/* Continue (POSIX).  */
-#define	SIGCHLD		20	/* Child status has changed (POSIX).  */
-#define	SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
-#define	SIGTTIN		21	/* Background read from tty (POSIX).  */
-#define	SIGTTOU		22	/* Background write to tty (POSIX).  */
-#define	SIGIO		23	/* I/O now possible (4.2 BSD).  */
-#define	SIGPOLL		SIGIO	/* Same as SIGIO? (SVID).  */
-#define	SIGXCPU		24	/* CPU limit exceeded (4.2 BSD).  */
-#define	SIGXFSZ		25	/* File size limit exceeded (4.2 BSD).  */
-#define	SIGVTALRM	26	/* Virtual alarm clock (4.2 BSD).  */
-#define	SIGPROF		27	/* Profiling alarm clock (4.2 BSD).  */
-#define	SIGWINCH	28	/* Window size change (4.3 BSD, Sun).  */
-#define SIGLOST		29	/* Resource lost (Sun).  */
-#define	SIGUSR1		30	/* User-defined signal 1 (POSIX).  */
-#define	SIGUSR2		31	/* User-defined signal 2 (POSIX).  */
-
-#endif	/* <signal.h> included.  */
-
-#define	_NSIG		32	/* Biggest signal number + 1.  */
diff --git a/sysdeps/unix/bsd/sun/m68k/Dist b/sysdeps/unix/bsd/sun/m68k/Dist
deleted file mode 100644
index cd893ff463..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sigtramp.c
diff --git a/sysdeps/unix/bsd/sun/m68k/Makefile b/sysdeps/unix/bsd/sun/m68k/Makefile
deleted file mode 100644
index ac4121dc2c..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ifeq ($(subdir),signal)
-sysdep_routines := $(sysdep_routines) sigtramp
-endif
diff --git a/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h b/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
deleted file mode 100644
index 99a0506a8d..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/bits/sigcontext.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Structure describing state saved while handling a signal.  Sun 3 version.
-   Copyright (C) 1993, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-struct sigcontext
-  {
-    int sc_onstack;
-    __sigset_t sc_mask;
-
-    int sc_sp, sc_pc, sc_ps;
-  };
diff --git a/sysdeps/unix/bsd/sun/m68k/brk.S b/sysdeps/unix/bsd/sun/m68k/brk.S
deleted file mode 100644
index 07af96d23c..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/brk.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1991, 1992, 1994, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifndef	SYS_brk
-#define	SYS_brk	17
-#endif
-
-#ifndef	HAVE_GNU_LD
-#define	__end	_end
-#endif
-
-.data
-.globl ___curbrk
-___curbrk:
-	.long __end
-
-.text
-ENTRY (__brk)
-	movel #__end, d0
-	cmpl sp@(4), d0
-	ble 0f
-	movel d0, sp@(4)
-0:	pea SYS_brk
-	trap #0
-	bcs 1f
-	movel sp@(4), ___curbrk
-	clrl d0
-	rts
-1:
-	jmp syscall_error
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/bsd/sun/m68k/dl-brk.S b/sysdeps/unix/bsd/sun/m68k/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/bsd/sun/m68k/sethostid.S b/sysdeps/unix/bsd/sun/m68k/sethostid.S
deleted file mode 100644
index 73ee79682e..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/sethostid.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifdef	 SYS_sethostid
-
-SYSCALL (sethostid, 1)
-	ret
-
-#else
-
-#include <bits/errno.h>
-
-.globl _sethostid
-.even
-_sethostid:
-	movel #ENOSYS, _errno
-	moveq #-1, d0
-	rts
-
-#ifdef	HAVE_GNU_LD
-
-.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0
-.stabs "_sethostid",1,0,0,0
-
-#endif
-
-#endif
diff --git a/sysdeps/unix/bsd/sun/m68k/sigtramp.c b/sysdeps/unix/bsd/sun/m68k/sigtramp.c
deleted file mode 100644
index 5a3ca3cf10..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/sigtramp.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Copyright (C) 1993, 1996, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	__GNUC__
-  #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-/* Get the definition of `struct sigcontext'.  */
-#define	KERNEL
-#define	sigvec		sun_sigvec
-#define	sigstack	sun_sigstack
-#define	sigcontext	sun_sigcontext
-#include "/usr/include/sys/signal.h"
-#undef	sigvec
-#undef	sigstack
-#undef	sigcontext
-#undef	NSIG
-#undef	SIGABRT
-#undef	SIGCLD
-#undef	SV_ONSTACK
-#undef	SV_RESETHAND
-#undef	SV_INTERRUPT
-#undef	SA_ONSTACK
-#undef	SA_NOCLDSTOP
-#undef	SIG_ERR
-#undef	SIG_DFL
-#undef	SIG_IGN
-#undef	sigmask
-#undef	SIG_BLOCK
-#undef	SIG_UNBLOCK
-#undef	SIG_SETMASK
-
-#include <signal.h>
-#include <stddef.h>
-#include <errno.h>
-
-/* Defined in __sigvec.S.  */
-extern int __raw_sigvec (int sig, const struct sigvec *vec,
-			 struct sigvec *ovec);
-
-/* User-specified signal handlers.  */
-#define mytramp 1
-#ifdef mytramp
-static __sighandler_t handlers[NSIG];
-#else
-#define handlers _sigfunc
-extern __sighandler_t _sigfunc[];
-#endif
-
-#if mytramp
-
-/* Handler for all signals that are handled by a user-specified function.
-   Saves and restores the general regs %g2-%g7, the %y register, and
-   all the FPU regs (including %fsr), around calling the user's handler.  */
-static void
-trampoline (sig, code, context, addr)
-     int sig;
-     int code;
-     struct sigcontext *context;
-     void *addr;
-{
-  int save[4];
-
-  /* Save the call-clobbered registers.  */
-  asm volatile ("movem%.l d0-d1/a0-a1, %0" : : "m" (save[0]));
-
-  /* XXX should save/restore FP regs */
-
-  /* Call the user's handler.  */
-  (*((void (*) (int sig, int code, struct sigcontext *context,
-		PTR addr)) handlers[sig]))
-    (sig, code, context, addr);
-
-  /* Restore the call-clobbered registers.  */
-  asm volatile ("movem%.l %0, d0-d1/a0-a1" : : "g" (save[0]) :
-		"d0", "d1", "a0", "a1");
-
-  __sigreturn (context);
-}
-
-#endif
-
-int
-__sigvec (sig, vec, ovec)
-     int sig;
-     const struct sigvec *vec;
-     struct sigvec *ovec;
-{
-#ifndef	mytramp
-  extern void _sigtramp (int);
-#define	trampoline	_sigtramp
-#endif
-  struct sigvec myvec;
-  int mask;
-  __sighandler_t ohandler;
-
-  if (sig <= 0 || sig >= NSIG)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  mask = __sigblock(sigmask(sig));
-
-  ohandler = handlers[sig];
-
-  if (vec != NULL &&
-      vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
-    {
-      handlers[sig] = vec->sv_handler;
-      myvec = *vec;
-      myvec.sv_handler = trampoline;
-      vec = &myvec;
-    }
-
-  if (__raw_sigvec(sig, vec, ovec) < 0)
-    {
-      int save = errno;
-      (void) __sigsetmask(mask);
-      errno = save;
-      return -1;
-    }
-
-  if (ovec != NULL && ovec->sv_handler == trampoline)
-    ovec->sv_handler = ohandler;
-
-  (void) __sigsetmask(mask);
-
-  return 0;
-}
diff --git a/sysdeps/unix/bsd/sun/m68k/syscall.S b/sysdeps/unix/bsd/sun/m68k/syscall.S
deleted file mode 100644
index 1d4d5be42f..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/syscall.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1993, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-ENTRY (syscall)
-	movel sp@, d0		/* Save return address in D0.  */
-	movel sp@(4), sp@	/* Put syscall number at top of stack.  */
-	movel d0, sp@(4)	/* Put return address under it.  */
-	trap #0			/* Do syscall; pops number from stack.  */
-	jcs error
-	ret
-error:	jmp syscall_error
diff --git a/sysdeps/unix/bsd/sun/m68k/sysdep.h b/sysdeps/unix/bsd/sun/m68k/sysdep.h
deleted file mode 100644
index e51ab0a8e4..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/sysdep.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 1991, 1992, 1994, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/unix/sysdep.h>
-
-#ifdef	__ASSEMBLER__
-
-#define	POUND	#
-
-#ifdef	__STDC__
-#define	ENTRY(name)							      \
-  .globl _##name;							      \
-  .even;								      \
-  _##name##:
-#else
-#define	ENTRY(name)							      \
-  .globl _/**/name;							      \
-  .even;								      \
-  _/**/name/**/:
-#endif
-
-#ifdef	__STDC__
-#define	PSEUDO(name, syscall_name, args)				      \
-  .even;								      \
-  .globl syscall_error;							      \
-  error: jmp syscall_error;						      \
-  ENTRY (name)								      \
-  pea SYS_##syscall_name;						      \
-  trap POUND 0;								      \
-  bcs error
-#else
-#define	PSEUDO(name, syscall_name, args)				      \
-  .even;								      \
-  .globl syscall_error;							      \
-  error: jmp syscall_error;						      \
-  ENTRY (name)								      \
-  pea SYS_/**/syscall_name;						      \
-  trap POUND 0;								      \
-  bcs error
-#endif
-
-#define	ret	rts
-#define	r0	d0
-#define	r1	d1
-#define	MOVE(x,y)	movel x , y
-
-#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/unix/bsd/sun/m68k/vfork.S b/sysdeps/unix/bsd/sun/m68k/vfork.S
deleted file mode 100644
index cf9e2e9e1a..0000000000
--- a/sysdeps/unix/bsd/sun/m68k/vfork.S
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 97, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifndef	SYS_vfork
-#define	SYS_vfork	66
-#endif
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-.globl ___vfork
-___vfork:
-	/* Pop the return PC value into A0.  */
-	movel sp@+, a0
-
-	/* Push the syscall number and trap into the kernel.  */
-	movel #SYS_vfork, sp@-
-	trap #0
-	bcs error		/* Branch forward if it failed.  */
-
-	/* It succeeded.  See which fork we're in.  D1 is now 0 for the
-	   parent and 1 for the child.  Decrement it to make it -1 (all
-	   bits set) for the parent, and 0 (no bits set) for the child.
-	   Then AND it with D0, so the parent gets D0&-1==R0, and the child
-	   gets D0&0==0.  */
-	subql #1, d1
-	andl d1, d0
-
-	/* Jump to the return PC.  */
-	jmp a0@
-
-error:
-	movel d0, _errno
-	moveq #-1, d0
-	jmp a0@
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/bsd/sun/sethostid.c b/sysdeps/unix/bsd/sun/sethostid.c
deleted file mode 100644
index aeb2940f42..0000000000
--- a/sysdeps/unix/bsd/sun/sethostid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/generic/sethostid.c>
diff --git a/sysdeps/unix/bsd/sun/sigreturn.S b/sysdeps/unix/bsd/sun/sigreturn.S
deleted file mode 100644
index a3ea8e3fae..0000000000
--- a/sysdeps/unix/bsd/sun/sigreturn.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1993, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifndef SYS_sigreturn
-#define SYS_sigreturn 139
-#endif
-
-SYSCALL__ (sigreturn, 1)
-	/* Does not return.  */
-
-weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/unix/bsd/sun/sparc/Dist b/sysdeps/unix/bsd/sun/sparc/Dist
deleted file mode 100644
index cd893ff463..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sigtramp.c
diff --git a/sysdeps/unix/bsd/sun/sparc/Makefile b/sysdeps/unix/bsd/sun/sparc/Makefile
deleted file mode 100644
index 59d10dbdbf..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# Basically `-e start' is magical to the Sun linker.  You would think that
-# having start.o first would be enough, but you would be wrong.
-LDFLAGS := $(LDFLAGS) -Xlinker -e -Xlinker start
-
-ifeq ($(subdir),signal)
-sysdep_routines := $(sysdep_routines) sigtramp
-endif
diff --git a/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h b/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
deleted file mode 100644
index 7c4bca6049..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/bits/sigcontext.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Structure describing state saved while handling a signal.  Sparc version.
-   Copyright (C) 1992, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-struct sigcontext
-  {
-    int sc_onstack;
-    __sigset_t sc_mask;
-
-#define	SPARC_MAXREGWINDOW 31	/* Maximum usable register windows.  */
-    int sc_sp, sc_pc, sc_npc, sc_psr, sc_g1, sc_o0;
-    int sc_wbcnt;		/* Number of outstanding windows.  */
-    __ptr_t sc_spbuf[SPARC_MAXREGWINDOW]; /* SP's for each window.  */
-    int sc_wbuf[SPARC_MAXREGWINDOW][16]; /* Saved register windows.  */
-  };
diff --git a/sysdeps/unix/bsd/sun/sparc/sethostid.S b/sysdeps/unix/bsd/sun/sparc/sethostid.S
deleted file mode 100644
index d07fd3800c..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/sethostid.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1992, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifdef	 SYS_sethostid
-
-SYSCALL (sethostid, 1)
-	ret
-
-#else
-
-/* <bits/errno.h> only defines E* #ifdef _ERRNO_H.  */
-#define	_ERRNO_H
-#include <bits/errno.h>
-
-ENTRY (sethostid)
-	mov ENOSYS, %o0
-	sethi %hi(_errno), %g1
-	st %o0, [%g1 + %lo(_errno)]
-	retl
-	sub %g0, 1, %o0
-
-#ifdef	HAVE_GNU_LD
-
-.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0
-.stabs "_sethostid",1,0,0,0
-
-#endif
-
-#endif
diff --git a/sysdeps/unix/bsd/sun/sparc/sigtramp.c b/sysdeps/unix/bsd/sun/sparc/sigtramp.c
deleted file mode 100644
index e11f7e51d3..0000000000
--- a/sysdeps/unix/bsd/sun/sparc/sigtramp.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* Copyright (C) 1991,1992,1994,1996,1997,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	__GNUC__
-  #error This file uses GNU C extensions; you must compile with GCC.
-#endif
-
-/* Get the definition of `struct sigcontext'.  */
-#define	KERNEL
-#define	sigvec		sun_sigvec
-#define	sigstack	sun_sigstack
-#define	sigcontext	sun_sigcontext
-#include "/usr/include/sys/signal.h"
-#undef	sigvec
-#undef	sigstack
-#undef	sigcontext
-#undef	NSIG
-#undef	SIGABRT
-#undef	SIGCLD
-#undef	SV_ONSTACK
-#undef	SV_RESETHAND
-#undef	SV_INTERRUPT
-#undef	SA_ONSTACK
-#undef	SA_NOCLDSTOP
-#undef	SIG_ERR
-#undef	SIG_DFL
-#undef	SIG_IGN
-#undef	sigmask
-#undef	SIG_BLOCK
-#undef	SIG_UNBLOCK
-#undef	SIG_SETMASK
-
-#include <signal.h>
-#include <stddef.h>
-#include <errno.h>
-
-/* Defined in __sigvec.S.  */
-extern int __raw_sigvec (int sig, CONST struct sigvec *vec,
-			 struct sigvec *ovec);
-
-/* User-specified signal handlers.  */
-#define mytramp 1
-#ifdef mytramp
-static __sighandler_t handlers[NSIG];
-#else
-#define handlers _sigfunc
-extern __sighandler_t _sigfunc[];
-#endif
-
-#if mytramp
-
-/* Handler for all signals that are handled by a user-specified function.
-   Saves and restores the general regs %g2-%g7, the %y register, and
-   all the FPU regs (including %fsr), around calling the user's handler.  */
-static void
-trampoline (sig)
-     int sig;
-{
-  /* We use `double' and `long long int' so `std' (store doubleword) insns,
-     which might be faster than single-word stores, will be generated.  */
-  register double f0 asm("%f0");
-  register double f2 asm("%f2");
-  register double f4 asm("%f4");
-  register double f6 asm("%f6");
-  register double f8 asm("%f8");
-  register double f10 asm("%f10");
-  register double f12 asm("%f12");
-  register double f14 asm("%f14");
-  register double f16 asm("%f16");
-  register double f18 asm("%f18");
-  register double f20 asm("%f20");
-  register double f22 asm("%f22");
-  register double f24 asm("%f24");
-  register double f26 asm("%f26");
-  register double f28 asm("%f28");
-  register double f30 asm("%f30");
-  register long long int g2 asm("%g2");
-  register long long int g4 asm("%g4");
-  register long long int g6 asm("%g6");
-  register int *fp asm("%fp");
-
-  int code;
-  register struct sigcontext *context asm("%i0"); /* See end of fn.  */
-  void *addr;
-  int y;
-  double fpsave[16];
-  int fsr;
-  int savefpu;
-  long long int glsave[3];
-
-  /* SIG isn't really passed as an arg.
-     The args to the signal handler are at fp[16..19].  */
-  sig = fp[16];
-  code = fp[17];
-  context = (struct sigcontext *) fp[18];
-  addr = (PTR) fp[19];
-
-  /* Save the Y register.  */
-  asm("rd %%y, %0" : "=r" (y));
-
-  /* Save the FPU regs if the FPU enable bit is set in the PSR,
-     and the signal isn't an FP exception.  */
-  savefpu = (context->sc_psr & 0x1000) && sig != SIGFPE;
-  if (savefpu)
-    {
-      fpsave[0] = f0;
-      fpsave[1] = f2;
-      fpsave[2] = f4;
-      fpsave[3] = f6;
-      fpsave[4] = f8;
-      fpsave[5] = f10;
-      fpsave[6] = f12;
-      fpsave[7] = f14;
-      fpsave[8] = f16;
-      fpsave[9] = f18;
-      fpsave[10] = f20;
-      fpsave[11] = f22;
-      fpsave[12] = f24;
-      fpsave[13] = f26;
-      fpsave[14] = f28;
-      fpsave[15] = f30;
-
-      /* Force it into a stack slot so the asm won't barf.  Sigh.  */
-      (void) &fsr;
-      asm("st %%fsr, %0" : "=m" (fsr));
-    }
-
-  /* Save the global registers (except for %g1, which is a scratch reg).  */
-  glsave[0] = g2;
-  glsave[1] = g4;
-  glsave[2] = g6;
-
-  /* Call the user's handler.  */
-  (*((void (*) (int sig, int code, struct sigcontext *context,
-		void *addr)) handlers[sig]))
-    (sig, code, context, addr);
-
-  /* Restore the Y register.  */
-  asm("mov %0, %%y" : : "r" (y));
-
-  if (savefpu)
-    {
-      /* Restore the FPU regs.  */
-      f0 = fpsave[0];
-      f2 = fpsave[1];
-      f4 = fpsave[2];
-      f6 = fpsave[3];
-      f8 = fpsave[4];
-      f10 = fpsave[5];
-      f12 = fpsave[6];
-      f14 = fpsave[7];
-      f16 = fpsave[8];
-      f18 = fpsave[9];
-      f20 = fpsave[10];
-      f22 = fpsave[11];
-      f24 = fpsave[12];
-      f26 = fpsave[13];
-      f28 = fpsave[14];
-      f30 = fpsave[15];
-
-      asm("ld %0, %%fsr" : : "m" (fsr));
-    }
-
-  /* Restore the globals.  */
-  g2 = glsave[0];
-  g4 = glsave[1];
-  g6 = glsave[2];
-
-  /* Unwind a frame, and do a "sigcleanup" system call.
-     The system call apparently does a return.
-     I don't know what it's for.  Ask Sun.  */
-  asm("restore %%g0, 139, %%g1\n"
-      "ta 0\n"
-      "! this should be i0: %0"	/* Useless insn that will never be executed, */
-				/* here to make the compiler happy.  */
-      : /* No outputs.  */ :
-      /* CONTEXT is bound to %i0.  We reference it as an input here to make
-	 sure the compiler considers it live at this point, and preserves
-	 the value in that register.  The restore makes %i0 become %o0, the
-	 argument to the system call.  */
-      "r" (context));
-}
-#endif
-
-int
-__sigvec (sig, vec, ovec)
-     int sig;
-     const struct sigvec *vec;
-     struct sigvec *ovec;
-{
-#ifndef	mytramp
-  extern void _sigtramp (int);
-#define	trampoline	_sigtramp
-#endif
-  struct sigvec myvec;
-  int mask;
-  __sighandler_t ohandler;
-
-  if (sig <= 0 || sig >= NSIG)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  mask = __sigblock (sigmask(sig));
-
-  ohandler = handlers[sig];
-
-  if (vec != NULL &&
-      vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
-    {
-      handlers[sig] = vec->sv_handler;
-      myvec = *vec;
-      myvec.sv_handler = trampoline;
-      vec = &myvec;
-    }
-
-  if (__raw_sigvec(sig, vec, ovec) < 0)
-    {
-      int save = errno;
-      (void) __sigsetmask(mask);
-      errno = save;
-      return -1;
-    }
-
-  if (ovec != NULL && ovec->sv_handler == trampoline)
-    ovec->sv_handler = ohandler;
-
-  (void) __sigsetmask (mask);
-
-  return 0;
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/.cvsignore b/sysdeps/unix/bsd/sun/sunos4/.cvsignore
deleted file mode 100644
index 1f69fd919a..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.gz *.Z *.tar *.tgz
-=*
-TODO COPYING* AUTHORS copyr-* copying.*
-glibc-*
diff --git a/sysdeps/unix/bsd/sun/sunos4/Implies b/sysdeps/unix/bsd/sun/sunos4/Implies
deleted file mode 100644
index c99e256ac1..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/Implies
+++ /dev/null
@@ -1,2 +0,0 @@
-# SunOS 4 has the canonical set of <sys/mman.h> system calls.
-unix/mman
diff --git a/sysdeps/unix/bsd/sun/sunos4/Makefile b/sysdeps/unix/bsd/sun/sunos4/Makefile
deleted file mode 100644
index d17654a30f..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifeq ($(subdir),posix)
-sysdep_routines := $(sysdep_routines) sys_wait4
-endif
-
-ifeq ($(subdir),misc)
-sysdep_routines := $(sysdep_routines) sys_mmap
-endif
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h b/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h
deleted file mode 100644
index a30b352592..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/fcntl.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* O_*, F_*, FD_* bit values for SunOS 4.
-   Copyright (C) 1991, 1992, 1997, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_FCNTL_H
-#error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-/* File access modes for `open' and `fcntl'.  */
-#define	O_RDONLY	0	/* Open read-only.  */
-#define	O_WRONLY	1	/* Open write-only.  */
-#define	O_RDWR		2	/* Open read/write.  */
-
-
-/* Bits OR'd into the second argument to open.  */
-#define	O_CREAT		0x0200	/* Create file if it doesn't exist.  */
-#define	O_EXCL		0x0800	/* Fail if file already exists.  */
-#define	O_TRUNC		0x0400	/* Truncate file to zero length.  */
-#define	O_NOCTTY	0x8000	/* Don't assign a controlling terminal.  */
-#if defined __USE_BSD || defined __USE_SVID
-#define	O_ASYNC		0x0040	/* Send SIGIO to owner when data is ready.  */
-#define	O_FSYNC		0x2000	/* Synchronous writes.  */
-#define	O_SYNC		O_FSYNC
-#endif
-
-/* File status flags for `open' and `fcntl'.  */
-#define	O_APPEND	0x0008	/* Writes append to the file.  */
-#define	O_NONBLOCK	0x4000	/* Non-blocking I/O.  */
-
-/* Sun defines O_NDELAY one way for BSD behavior and another for System V
-   behavior.  In the GNU C library, you get the BSD behavior unless you
-   define _USG_SOURCE without also defining _BSD_SOURCE or _GNU_SOURCE.  */
-#ifdef __USE_BSD
-#define	O_NDELAY	0x0004
-#endif
-#if !defined (O_NDELAY) && defined (__USE_SVID)
-#define	O_NDELAY	0x1000
-#endif
-
-#ifdef __USE_BSD
-/* Bits in the file status flags returned by F_GETFL.
-   These are all the O_* flags, plus FREAD and FWRITE, which are
-   independent bits set by which of O_RDONLY, O_WRONLY, and O_RDWR, was
-   given to `open'.  */
-#define FREAD		1
-#define	FWRITE		2
-
-/* Traditional Unix names the O_* bits.  */
-#define FASYNC		O_ASYNC
-#define FCREAT		O_CREAT
-#define FEXCL		O_EXCL
-#define FTRUNC		O_TRUNC
-#define FNOCTTY		O_NOCTTY
-#define FFSYNC		O_FSYNC
-#define FSYNC		O_SYNC
-#define FAPPEND		O_APPEND
-#define FNONBLOCK	O_NONBLOCK
-#define FNONBIO		O_NONBLOCK
-#define FNDELAY		0x0004	/* BSD O_NDELAY.  */
-#define	FNBIO		0x1000	/* System V O_NDELAY.  */
-#endif
-
-/* Mask for file access modes.  This is system-dependent in case
-   some system ever wants to define some other flavor of access.  */
-#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
-
-/* Values for the second argument to `fcntl'.  */
-#define	F_DUPFD	  	0	/* Duplicate file descriptor.  */
-#define	F_GETFD		1	/* Get file descriptor flags.  */
-#define	F_SETFD		2	/* Set file descriptor flags.  */
-#define	F_GETFL		3	/* Get file status flags.  */
-#define	F_SETFL		4	/* Set file status flags.  */
-#if defined __USE_BSD || defined __USE_UNIX98
-#define	F_GETOWN	5	/* Get owner (receiver of SIGIO).  */
-#define	F_SETOWN	6	/* Set owner (receiver of SIGIO).  */
-#endif
-#define	F_GETLK		7	/* Get record locking info.  */
-#define	F_SETLK		8	/* Set record locking info (non-blocking).  */
-#define	F_SETLKW	9	/* Set record locking info (blocking).  */
-#ifdef	__USE_BSD
-#define	F_RGETLK	10	/* Get remote record locking info.  */
-#define	F_RSETLK	11	/* Set remote locking info (non-blocking).  */
-#define	F_CNVT		12	/* Convert a fhandle to an open fd.  */
-#define	F_RSETLKW	13	/* Set remote locking info (blocking).  */
-#endif
-
-/* File descriptor flags used with F_GETFD and F_SETFD.  */
-#define	FD_CLOEXEC	1	/* Close on exec.  */
-
-
-#include <bits/types.h>
-
-/* The structure describing an advisory lock.  This is the type of the third
-   argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests.  */
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    short int l_pid;	/* Process holding the lock.  */
-    short int l_xxx;	/* Reserved for future use.  */
-  };
-
-#ifdef	__USE_BSD
-/* The structure describing a remote advisory lock.  This is the type of the
-   third arg to `fcntl' for the F_RGETLK, F_RSETLK, and F_RSETLKW requests.  */
-struct eflock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    short int l_pid;	/* Process holding the lock.  */
-    short int l_xxx;	/* Reserved for future use.  */
-    long int l_rpid;	/* Remote process ID wanting this lock.  */
-    long int l_rsys;	/* Remote system ID wanting this lock.  */
-  };
-
-#endif
-
-
-/* Values for the `l_type' field of a `struct flock'.  */
-#define	F_RDLCK	1	/* Read lock.  */
-#define	F_WRLCK	2	/* Write lock.  */
-#define	F_UNLCK	3	/* Remove lock.  */
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/mman.h b/sysdeps/unix/bsd/sun/sunos4/bits/mman.h
deleted file mode 100644
index fdef46522a..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/mman.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Definitions for BSD-style memory management.  SunOS 4 version.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_BITS_MMAN_H
-#define	_BITS_MMAN_H	1
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define	PROT_NONE	0x00	/* No access.  */
-#define	PROT_READ	0x01	/* Pages can be read.  */
-#define	PROT_WRITE	0x02	/* Pages can be written.  */
-#define	PROT_EXEC	0x04	/* Pages can be executed.  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define	MAP_SHARED	0x01	/* Share changes.  */
-#define	MAP_PRIVATE	0x02	/* Changes private; copy pages on write.  */
-#ifdef __USE_BSD
-# define MAP_TYPE	0x0f	/* Mask for sharing type.  */
-#endif
-
-/* Other flags.  */
-#define	MAP_FIXED	0x10	/* Map address must be exactly as requested. */
-/* The following three flags are not actually implemented in SunOS 4.1.  */
-#ifdef __USE_BSD
-# define MAP_RENAME	0x20	/* Rename private pages to file.  */
-# define MAP_NORESERVE	0x40	/* Don't reserve needed swap area.  */
-# define MAP_INHERIT	0x80	/* Region is retained after exec.  */
-#endif
-
-/* This is an internal flag that is always set in `mmap' system calls.  In
-   older versions of SunOS 4 `mmap' did not return the actual mapping
-   address, but always returned zero.  This flag says to return the
-   address; the `mmap' C library function always sets it.  */
-#define	_MAP_NEW	0x80000000
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-# define MADV_NORMAL	0	/* No further special treatment.  */
-# define MADV_RANDOM	1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL	2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	3	/* Will need these pages.  */
-# define MADV_DONTNEED	4	/* Don't need these pages.  */
-#endif
-
-/* Flags to `msync'.  */
-#define	MS_ASYNC	0x1		/* Return immediately, don't fsync.  */
-#define	MS_INVALIDATE	0x2		/* Invalidate caches.  */
-
-#endif /* bits/mman.h */
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h b/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
deleted file mode 100644
index 2f0d2dc73f..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/resource.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Bit values for resource limits.  SunOS 4 version.
-   Copyright (C) 1994, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-/* These are the values for 4.4 BSD and GNU.  Earlier BSD systems have a
-   subset of these kinds of resource limit.  In systems where `getrlimit'
-   and `setrlimit' are not system calls, these are the values used by the C
-   library to emulate them.  */
-
-#include <bits/types.h>
-
-/* Kinds of resource limit.  */
-enum __rlimit_resource
-  {
-    /* Per-process CPU limit, in seconds.  */
-    RLIMIT_CPU,
-#define	RLIMIT_CPU	RLIMIT_CPU
-    /* Largest file that can be created, in bytes.  */
-    RLIMIT_FSIZE,
-#define	RLIMIT_FSIZE	RLIMIT_FSIZE
-    /* Maximum size of data segment, in bytes.  */
-    RLIMIT_DATA,
-#define	RLIMIT_DATA	RLIMIT_DATA
-    /* Maximum size of stack segment, in bytes.  */
-    RLIMIT_STACK,
-#define	RLIMIT_STACK	RLIMIT_STACK
-    /* Largest core file that can be created, in bytes.  */
-    RLIMIT_CORE,
-#define	RLIMIT_CORE	RLIMIT_CORE
-    /* Largest resident set size, in bytes.
-       This affects swapping; processes that are exceeding their
-       resident set size will be more likely to have physical memory
-       taken from them.  */
-    RLIMIT_RSS,
-#define	RLIMIT_RSS	RLIMIT_RSS
-    /* Number of open files.  */
-    RLIMIT_NOFILE,
-    RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
-#define	RLIMIT_NOFILE	RLIMIT_NOFILE
-#define	RLIMIT_OFILE	RLIMIT_OFILE
-
-    RLIM_NLIMITS
-  };
-
-/* Value to indicate that there is no limit.  */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY 0x7fffffff
-#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
-#endif
-
-
-/* Type to represent quantities in resource limits.  */
-#ifndef __USE_FILE_OFFSET64
-typedef __rlim_t rlim_t;
-#else
-typedef __rlim64_t rlim_t;
-#endif
-
-struct rlimit
-  {
-    /* The current (soft) limit.  */
-    rlim_t rlim_cur;
-    /* The hard limit.  */
-    rlim_t rlim_max;
-  };
-
-#ifdef __USE_LARGEFILE64
-typedef __rlim64_t rlim64_t;
-
-struct rlimit64
-  {
-    /* The current (soft) limit.  */
-    rlim64_t rlim_cur;
-    /* The hard limit.  */
-    rlim64_t rlim_max;
-  };
-#endif
-
-/* Whose usage statistics do you want?  */
-enum __rusage_who
-/* The macro definitions are necessary because some programs want
-   to test for operating system features with #ifdef RUSAGE_SELF.
-   In ISO C the reflexive definition is a no-op.  */
-  {
-    /* The calling process.  */
-    RUSAGE_SELF = 0,
-#define RUSAGE_SELF     RUSAGE_SELF
-    /* All of its terminated child processes.  */
-    RUSAGE_CHILDREN = -1
-#define RUSAGE_CHILDREN RUSAGE_CHILDREN
-  };
-
-#define __need_timeval
-#include <bits/time.h>           /* For `struct timeval'.  */
-
-/* Structure which says how much of each resource has been used.  */
-struct rusage
-  {
-    /* Total amount of user time used.  */
-    struct timeval ru_utime;
-    /* Total amount of system time used.  */
-    struct timeval ru_stime;
-    /* Maximum resident set size (in kilobytes).  */
-    long int ru_maxrss;
-    /* Amount of sharing of text segment memory
-       with other processes (kilobyte-seconds).  */
-    long int ru_ixrss;
-    /* Amount of data segment memory used (kilobyte-seconds).  */
-    long int ru_idrss;
-    /* Amount of stack memory used (kilobyte-seconds).  */
-    long int ru_isrss;
-    /* Number of soft page faults (i.e. those serviced by reclaiming
-       a page from the list of pages awaiting reallocation.  */
-    long int ru_minflt;
-    /* Number of hard page faults (i.e. those that required I/O).  */
-    long int ru_majflt;
-    /* Number of times a process was swapped out of physical memory.  */
-    long int ru_nswap;
-    /* Number of input operations via the file system.  Note: This
-       and `ru_oublock' do not include operations with the cache.  */
-    long int ru_inblock;
-    /* Number of output operations via the file system.  */
-    long int ru_oublock;
-    /* Number of IPC messages sent.  */
-    long int ru_msgsnd;
-    /* Number of IPC messages received.  */
-    long int ru_msgrcv;
-    /* Number of signals delivered.  */
-    long int ru_nsignals;
-    /* Number of voluntary context switches, i.e. because the process
-       gave up the process before it had to (usually to wait for some
-       resource to be available).  */
-    long int ru_nvcsw;
-    /* Number of involuntary context switches, i.e. a higher priority process
-       became runnable or the current process used up its time slice.  */
-    long int ru_nivcsw;
-  };
-
-/* Priority limits.  */
-#define PRIO_MIN        -20     /* Minimum priority a process can have.  */
-#define PRIO_MAX        20      /* Maximum priority a process can have.  */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
-   indicating what flavor of entity the WHO argument specifies.  */
-enum __priority_which
-  {
-    PRIO_PROCESS = 0,           /* WHO is a process ID.  */
-    PRIO_PGRP = 1,              /* WHO is a process group ID.  */
-    PRIO_USER = 2               /* WHO is a user ID.  */
-  };
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/termios.h b/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
deleted file mode 100644
index 97612c8f0b..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/termios.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* termios type and macro definitions.  SunOS 4 version.
-   Copyright (C) 1993, 1994, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-/* Type of terminal control flag masks.  */
-typedef unsigned long int tcflag_t;
-
-/* Type of control characters.  */
-typedef unsigned char cc_t;
-
-/* Type of baud rate specifiers.  */
-typedef unsigned int speed_t;
-
-/* Terminal control structure.  */
-struct termios
-{
-  /* Input modes.  */
-  tcflag_t c_iflag;
-#define	IGNBRK	0x0001		/* Ignore break condition.  */
-#define	BRKINT	0x0002		/* Signal interrupt on break.  */
-#define	IGNPAR	0x0004		/* Ignore characters with parity errors.  */
-#define	PARMRK	0x0008		/* Mark parity and framing errors.  */
-#define	INPCK	0x0010		/* Enable input parity check.  */
-#define	ISTRIP	0x0020		/* Strip 8th bit off characters.  */
-#define	INLCR	0x0040		/* Map NL to CR on input.  */
-#define	IGNCR	0x0080		/* Ignore CR.  */
-#define	ICRNL	0x0100		/* Map CR to NL on input.  */
-#ifdef __USE_BSD
-# define IUCLC	0x0200		/* Map upper case to lower case on input.  */
-#endif
-#define	IXON	0x0400		/* Enable start/stop output control.  */
-#define	IXOFF	0x1000		/* Enable start/stop input control.  */
-#ifdef	__USE_BSD
-# define IXANY	0x0800		/* Any character will restart after stop.  */
-# define IMAXBEL	0x2000		/* Ring bell when input queue is full.  */
-#endif
-
-  /* Output modes.  */
-  tcflag_t c_oflag;
-#define	OPOST	0x0001		/* Perform output processing.  */
-#ifdef	__USE_BSD
-# define OLCUC	0x00000002	/* Map lower case to upper case on output.  */
-# define ONLCR	0x00000004	/* Map NL to CR-NL on output.  */
-# define OCRNL	0x00000008
-# define ONOCR	0x00000010
-# define ONLRET	0x00000020
-# define OFILL	0x00000040
-# define OFDEL	0x00000080
-# define NLDLY	0x00000100
-# define NL0	0
-# define NL1	0x00000100
-# define CRDLY	0x00000600
-# define CR0	0
-# define CR1	0x00000200
-# define CR2	0x00000400
-# define CR3	0x00000600
-# define TABDLY	0x00001800
-# define TAB0	0
-# define TAB1	0x00000800
-# define TAB2	0x00001000
-# define XTABS	0x00001800
-# define TAB3	XTABS
-# define BSDLY	0x00002000
-# define BS0	0
-# define BS1	0x00002000
-# define VTDLY	0x00004000
-# define VT0	0
-# define VT1	0x00004000
-# define FFDLY	0x00008000
-# define FF0	0
-# define FF1	0x00008000
-# define PAGEOUT 0x00010000
-# define WRAP	0x00020000
-#endif
-
-  /* Control modes.  */
-  tcflag_t c_cflag;
-#define	CSIZE	(CS5|CS6|CS7|CS8) /* Number of bits per byte (mask).  */
-#define	CS5	0		/* 5 bits per byte.  */
-#define	CS6	0x00000010	/* 6 bits per byte.  */
-#define	CS7	0x00000020	/* 7 bits per byte.  */
-#define	CS8	0x00000030	/* 8 bits per byte.  */
-#define	CSTOPB	0x00000040	/* Two stop bits instead of one.  */
-#define	CREAD	0x00000080	/* Enable receiver.  */
-#define	PARENB	0x00000100	/* Parity enable.  */
-#define	PARODD	0x00000200	/* Odd parity instead of even.  */
-#define	HUPCL	0x00000400	/* Hang up on last close.  */
-#define	CLOCAL	0x00000800	/* Ignore modem status lines.  */
-#ifdef	__USE_BSD
-# define LOBLK	0x00001000
-# define CRTSCTS	0x80000000
-# define CIBAUD	0x000f0000	/* Mask for input speed from c_cflag.  */
-# define CBAUD	0x0000000f	/* Mask for output speed from c_cflag.  */
-# define IBSHIFT	16		/* Bits to shift for input speed.  */
-#endif
-
-  /* Input and output baud rates.  These are encoded in c_cflag.  */
-#define B0      0
-#define B50     1
-#define B75     2
-#define B110    3
-#define B134    4
-#define B150    5
-#define B200    6
-#define B300    7
-#define B600    8
-#define B1200   9
-#define B1800   10
-#define B2400   11
-#define B4800   12
-#define B9600   13
-#define B19200  14
-#define B38400  15
-#ifdef __USE_BSD
-# define EXTA   14
-# define EXTB   15
-#endif
-
-  /* Local modes.  */
-  tcflag_t c_lflag;
-#ifdef	__USE_BSD
-# define ECHOKE	0x00000800	/* Visual erase for KILL.  */
-#endif
-#define	ECHOE	0x00000010	/* Visual erase for ERASE.  */
-#define	ECHOK	0x00000020	/* Echo NL after KILL.  */
-#define	ECHO	0x00000008	/* Enable echo.  */
-#define	ECHONL	0x00000040	/* Echo NL even if ECHO is off.  */
-#ifdef	__USE_BSD
-# define ECHOPRT	0x00000400	/* Hardcopy visual erase.  */
-# define ECHOCTL	0x00000200	/* Echo control characters as ^X.  */
-#endif
-#define	ISIG	0x00000001	/* Enable signals.  */
-#define	ICANON	0x00000002	/* Do erase and kill processing.  */
-#define	IEXTEN	0x00008000	/* Enable DISCARD and LNEXT.  */
-#define	TOSTOP	0x00000100	/* Send SIGTTOU for background output.  */
-#ifdef	__USE_BSD
-# define PENDIN	0x00004000	/* Retype pending input (state).  */
-#endif
-#define	NOFLSH	0x00000080	/* Disable flush after interrupt.  */
-
-  char c_line;			/* Line discipline (?) */
-
-  /* Control characters.  */
-#define	VEOF	4		/* End-of-file character [ICANON].  */
-#define	VEOL	5		/* End-of-line character [ICANON].  */
-#ifdef	__USE_BSD
-# define VEOL2	6		/* Second EOL character [ICANON].  */
-# define VSWTCH	7		/* ??? */
-#endif
-#define	VERASE	2		/* Erase character [ICANON].  */
-#ifdef	__USE_BSD
-# define VWERASE	14		/* Word-erase character [ICANON].  */
-#endif
-#define	VKILL	3		/* Kill-line character [ICANON].  */
-#ifdef	__USE_BSD
-# define VREPRINT 12		/* Reprint-line character [ICANON].  */
-#endif
-#define	VINTR	0		/* Interrupt character [ISIG].  */
-#define	VQUIT	1		/* Quit character [ISIG].  */
-#define	VSUSP	10		/* Suspend character [ISIG].  */
-#ifdef	__USE_BSD
-# define VDSUSP	11		/* Delayed suspend character [ISIG].  */
-#endif
-#define	VSTART	8		/* Start (X-ON) character [IXON, IXOFF].  */
-#define	VSTOP	9		/* Stop (X-OFF) character [IXON, IXOFF].  */
-#ifdef	__USE_BSD
-# define VLNEXT	15		/* Literal-next character [IEXTEN].  */
-# define VDISCARD 13		/* Discard character [IEXTEN].  */
-#endif
-#define	VMIN	VEOF		/* Minimum number of bytes read at once [!ICANON].  */
-#define	VTIME	VEOL		/* Time-out value (tenths of a second) [!ICANON].  */
-#define	NCCS	17
-  cc_t c_cc[NCCS];
-};
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
-
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
-#define	TCSANOW		0	/* Change immediately.  */
-#define	TCSADRAIN	1	/* Change when pending output is written.  */
-#define	TCSAFLUSH	2	/* Flush pending input before changing.  */
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
-#define	TCIFLUSH	0	/* Discard data received but not yet read.  */
-#define	TCOFLUSH	1	/* Discard data written but not yet sent.  */
-#define	TCIOFLUSH	2	/* Discard all pending data.  */
-
-/* Values for the ACTION argument to `tcflow'.  */
-#define	TCOOFF	0		/* Suspend output.  */
-#define	TCOON	1		/* Restart suspended output.  */
-#define	TCIOFF	2		/* Send a STOP character.  */
-#define	TCION	3		/* Send a START character.  */
diff --git a/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h b/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
deleted file mode 100644
index a0246c2a36..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/bits/utsname.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_UTSNAME_H
-# error "Never include <bits/utsname.h> directly; use <sys/utsname.h> instead."
-#endif
-
-#define _UTSNAME_LENGTH 9
-#define _UTSNAME_NODENAME_LENGTH 65
diff --git a/sysdeps/unix/bsd/sun/sunos4/mmap.c b/sysdeps/unix/bsd/sun/sunos4/mmap.c
deleted file mode 100644
index c513ae27eb..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/mmap.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1994, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Map addresses starting near ADDR and extending for LEN bytes.  from
-   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
-   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
-   set in FLAGS, the mapping will be at ADDR exactly (which must be
-   page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or MAP_FAILED
-   for errors (in which case `errno' is set).  A successful `mmap' call
-   deallocates any previous mapping for the affected region.  */
-
-extern __ptr_t __mmap_syscall (__ptr_t addr, size_t len,
-			       int prot, int flags, int fd, off_t offset);
-
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-  return __mmap_syscall (addr, len, prot, flags | _MAP_NEW, fd, offset);
-}
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/bsd/sun/sunos4/speed.c b/sysdeps/unix/bsd/sun/sunos4/speed.c
deleted file mode 100644
index 262d70fdfb..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/speed.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* `struct termios' speed frobnication functions.  SunOS 4 version.
-   Copyright (C) 1991,1992,1993,1996,1997,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <errno.h>
-#include <termios.h>
-
-static const speed_t speeds[] =
-  {
-    0,
-    50,
-    75,
-    110,
-    134,
-    150,
-    200,
-    300,
-    600,
-    1200,
-    1800,
-    2400,
-    4800,
-    9600,
-    19200,
-    38400,
-  };
-
-
-/* Return the output baud rate stored in *TERMIOS_P.  */
-speed_t
-cfgetospeed (termios_p)
-     const struct termios *termios_p;
-{
-  return termios_p->c_cflag & CBAUD;
-}
-
-/* Return the input baud rate stored in *TERMIOS_P.  */
-speed_t
-cfgetispeed (termios_p)
-     const struct termios *termios_p;
-{
-  return (termios_p->c_cflag & CIBAUD) >> IBSHIFT;
-}
-
-/* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
-int
-cfsetospeed (termios_p, speed)
-     struct termios *termios_p;
-     speed_t speed;
-{
-  register unsigned int i;
-
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* This allows either B1200 or 1200 to work.	XXX
-     Do we really want to try to support this, given that
-     fetching the speed must return one or the other?  */
-
-  for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
-    if (i == speed || speeds[i] == speed)
-      {
-	termios_p->c_cflag &= ~CBAUD;
-	termios_p->c_cflag |= i;
-	return 0;
-      }
-
-  __set_errno (EINVAL);
-  return -1;
-}
-libc_hidden_def (cfsetospeed)
-
-/* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
-int
-cfsetispeed (termios_p, speed)
-     struct termios *termios_p;
-     speed_t speed;
-{
-  register unsigned int i;
-
-  if (termios_p == NULL)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* See comment in cfsetospeed (above).  */
-  for (i = 0; i < sizeof (speeds) / sizeof (speeds[0]); ++i)
-    if (i == speed || speeds[i] == speed)
-      {
-	termios_p->c_cflag &= ~CIBAUD;
-	termios_p->c_cflag |= i << IBSHIFT;
-	return 0;
-      }
-
-  __set_errno (EINVAL);
-  return -1;
-}
-libc_hidden_def (cfsetispeed)
diff --git a/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h b/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h
deleted file mode 100644
index d18433c6fe..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/sys/ttydefaults.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * Copyright (c) 1982, 1986, 1993
- *	The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94
- */
-
-/*
- * System wide defaults for terminal state.  SunOS 4 version.
- */
-#ifndef _SYS_TTYDEFAULTS_H_
-#define	_SYS_TTYDEFAULTS_H_
-
-/*
- * Defaults on "first" open.
- */
-#define	TTYDEF_IFLAG	(BRKINT | ISTRIP | ICRNL | IMAXBEL | IXON | IXANY)
-#define TTYDEF_OFLAG	(OPOST | ONLCR | XTABS)
-#define TTYDEF_LFLAG	(ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
-#define TTYDEF_CFLAG	(CREAD | CS7 | PARENB | HUPCL)
-#define TTYDEF_SPEED	(B9600)
-
-/*
- * Control Character Defaults
- */
-#define CTRL(x)	(x&037)
-#define	CEOF		CTRL('d')
-#ifdef _POSIX_VDISABLE
-# define CEOL		_POSIX_VDISABLE
-#else
-# define CEOL		((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
-#endif
-#define	CERASE		0177
-#define	CINTR		CTRL('c')
-#ifdef _POSIX_VDISABLE
-# define CSTATUS	_POSIX_VDISABLE
-#else
-# define CSTATUS	((unsigned char)'\377')	/* XXX avoid _POSIX_VDISABLE */
-#endif
-#define	CKILL		CTRL('u')
-#define	CMIN		1
-#define	CQUIT		034		/* FS, ^\ */
-#define	CSUSP		CTRL('z')
-#define	CTIME		0
-#define	CDSUSP		CTRL('y')
-#define	CSTART		CTRL('q')
-#define	CSTOP		CTRL('s')
-#define	CLNEXT		CTRL('v')
-#define	CDISCARD 	CTRL('o')
-#define	CWERASE 	CTRL('w')
-#define	CREPRINT 	CTRL('r')
-#define	CEOT		CEOF
-/* compat */
-#define	CBRK		CEOL
-#define CRPRNT		CREPRINT
-#define	CFLUSH		CDISCARD
-
-/* PROTECTED INCLUSION ENDS HERE */
-#endif /* !_SYS_TTYDEFAULTS_H_ */
-
-/*
- * #define TTYDEFCHARS to include an array of default control characters.
- */
-#ifdef TTYDEFCHARS
-cc_t	ttydefchars[NCCS] = {
-	CEOF,	CEOL,	CEOL,	CERASE, CWERASE, CKILL, CREPRINT,
-	_POSIX_VDISABLE, CINTR,	CQUIT,	CSUSP,	CDSUSP,	CSTART,	CSTOP,	CLNEXT,
-	CDISCARD, CMIN,	CTIME,  CSTATUS, _POSIX_VDISABLE
-};
-#undef TTYDEFCHARS
-#endif
diff --git a/sysdeps/unix/bsd/sun/sunos4/syscalls.list b/sysdeps/unix/bsd/sun/sunos4/syscalls.list
deleted file mode 100644
index 59992eed53..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/syscalls.list
+++ /dev/null
@@ -1,6 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-msync		-	msync		3	msync
-poll		-	poll		3	poll
-sys_mmap	mmap	mmap		5	__mmap_syscall
-sys_wait4	wait4	wait4		4	__wait4_syscall
diff --git a/sysdeps/unix/bsd/sun/sunos4/system.c b/sysdeps/unix/bsd/sun/sunos4/system.c
deleted file mode 100644
index 2c8e634bc8..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/system.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* SunOS 4 does have `waitpid'.  Avoid unix/system.c, which says we don't.  */
-#include <sysdeps/posix/system.c>
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcflow.c b/sysdeps/unix/bsd/sun/sunos4/tcflow.c
deleted file mode 100644
index 6fcc606f61..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcflow.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1993, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-/* Suspend or restart transmission on FD.  */
-int
-tcflow (fd, action)
-     int fd;
-     int action;
-{
-  return __ioctl (fd, TCXONC, action);
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcflush.c b/sysdeps/unix/bsd/sun/sunos4/tcflush.c
deleted file mode 100644
index 9e78aadd07..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcflush.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1993, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-/* Flush pending data on FD.  */
-int
-tcflush (fd, queue_selector)
-     int fd;
-     int queue_selector;
-{
-  return __ioctl (fd, TCFLSH, queue_selector);
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c b/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c
deleted file mode 100644
index ab74fddf24..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcgetattr.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1993, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <stddef.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-/* Put the state of FD into *TERMIOS_P.  */
-int
-__tcgetattr (fd, termios_p)
-     int fd;
-     struct termios *termios_p;
-{
-  return __ioctl (fd, TCGETS, termios_p);
-}
-
-weak_alias (__tcgetattr, tcgetattr)
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c b/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c
deleted file mode 100644
index db5ea8c831..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcsendbrk.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1993, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <sys/termio.h>		/* Sun header file.  */
-
-/* Send zero bits on FD.  */
-int
-tcsendbreak (fd, duration)
-     int fd;
-     int duration;
-{
-  /* According to SunOS 4.1's termios(4), you can't specify a duration.  */
-  return __ioctl (fd, TCSBRK, 0);
-}
diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c b/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c
deleted file mode 100644
index 934c4c8cf8..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1993, 1996, 1997, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-/* Set the state of FD to *TERMIOS_P.  */
-int
-tcsetattr (fd, optional_actions, termios_p)
-     int fd;
-     int optional_actions;
-     const struct termios *termios_p;
-{
-  unsigned long cmd;
-
-  switch (optional_actions)
-    {
-    case TCSANOW:
-      cmd = TCSETS;
-      break;
-    case TCSADRAIN:
-      cmd = TCSETSW;
-      break;
-    case TCSAFLUSH:
-      cmd = TCSETSF;
-      break;
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return __ioctl (fd, cmd, termios_p);
-}
-libc_hidden_def (tcsetattr)
diff --git a/sysdeps/unix/bsd/sun/sunos4/wait.c b/sysdeps/unix/bsd/sun/sunos4/wait.c
deleted file mode 100644
index 79d54580fd..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/wait.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/bsd4.4/wait.c>
diff --git a/sysdeps/unix/bsd/sun/sunos4/wait3.c b/sysdeps/unix/bsd/sun/sunos4/wait3.c
deleted file mode 100644
index 0b3bdee771..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/wait3.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/bsd4.4/wait3.c>
diff --git a/sysdeps/unix/bsd/sun/sunos4/wait4.c b/sysdeps/unix/bsd/sun/sunos4/wait4.c
deleted file mode 100644
index 097c15e7d9..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/wait4.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* This implements wait4 with the 4.4 BSD semantics (also those documented in
-   SunOS 4.1) on top of SunOS's wait4 system call, which has semantics
-   different from those documented.  Go Sun!
-   Copyright (C) 1991,1992,1993,1995,1997,2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-extern pid_t __wait4_syscall (pid_t pid, __WAIT_STATUS_DEFN stat_loc,
-			      int options, struct rusage *usage);
-
-pid_t
-__wait4 (pid, stat_loc, options, usage)
-     pid_t pid;
-     __WAIT_STATUS_DEFN stat_loc;
-     int options;
-     struct rusage *usage;
-{
-  switch (pid)
-    {
-    case WAIT_ANY:
-      pid = 0;
-      break;
-
-    case WAIT_MYPGRP:
-      pid = - getpgrp ();
-      break;
-    }
-
-  return __wait4_syscall (pid, stat_loc, options, usage);
-}
-
-weak_alias (__wait4, wait4)
diff --git a/sysdeps/unix/bsd/sun/sunos4/waitpid.c b/sysdeps/unix/bsd/sun/sunos4/waitpid.c
deleted file mode 100644
index 8378982ac7..0000000000
--- a/sysdeps/unix/bsd/sun/sunos4/waitpid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/bsd/bsd4.4/waitpid.c>
diff --git a/sysdeps/unix/bsd/sun/syscalls.list b/sysdeps/unix/bsd/sun/syscalls.list
deleted file mode 100644
index 079aa9157a..0000000000
--- a/sysdeps/unix/bsd/sun/syscalls.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-sigvec		-	sigvec		3	__raw_sigvec
diff --git a/sysdeps/unix/bsd/ulimit.c b/sysdeps/unix/bsd/ulimit.c
index 91d77e926a..963d156e2c 100644
--- a/sysdeps/unix/bsd/ulimit.c
+++ b/sysdeps/unix/bsd/ulimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 96, 97, 98, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994-1998,2001,2005 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
@@ -23,9 +23,6 @@
 #include <unistd.h>
 #include <sys/resource.h>
 
-#ifndef	 HAVE_GNU_LD
-#define	 _etext	etext
-#endif
 
 extern int _etext;
 
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index 7a3db29744..f698f0151b 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+/* clock_gettime -- Get the current time from a POSIX clockid_t.  Unix version.
+   Copyright (C) 1999-2004, 2005 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
@@ -35,89 +36,99 @@ static hp_timing_t freq;
 extern int __pthread_clock_gettime (clockid_t clock_id, hp_timing_t freq,
 				    struct timespec *tp)
      __attribute__ ((__weak__));
+
+static int
+hp_timing_gettime (clockid_t clock_id, struct timespec *tp)
+{
+  hp_timing_t tsc;
+
+  if (__builtin_expect (freq == 0, 0))
+    {
+      /* This can only happen if we haven't initialized the `freq'
+	 variable yet.  Do this now. We don't have to protect this
+	 code against multiple execution since all of them should
+	 lead to the same result.  */
+      freq = __get_clockfreq ();
+      if (__builtin_expect (freq == 0, 0))
+	/* Something went wrong.  */
+	return -1;
+    }
+
+  if (clock_id != CLOCK_PROCESS_CPUTIME_ID
+      && __pthread_clock_gettime != NULL)
+    return __pthread_clock_gettime (clock_id, freq, tp);
+
+  /* Get the current counter.  */
+  HP_TIMING_NOW (tsc);
+
+  /* Compute the offset since the start time of the process.  */
+  tsc -= GL(dl_cpuclock_offset);
+
+  /* Compute the seconds.  */
+  tp->tv_sec = tsc / freq;
+
+  /* And the nanoseconds.  This computation should be stable until
+     we get machines with about 16GHz frequency.  */
+  tp->tv_nsec = ((tsc % freq) * UINT64_C (1000000000)) / freq;
+
+  return 0;
+}
 #endif
 
 
+static inline int
+realtime_gettime (struct timespec *tp)
+{
+  struct timeval tv;
+  int retval = gettimeofday (&tv, NULL);
+  if (retval == 0)
+    /* Convert into `timespec'.  */
+    TIMEVAL_TO_TIMESPEC (&tv, tp);
+  return retval;
+}
+
+
 /* Get current value of CLOCK and store it in TP.  */
 int
 clock_gettime (clockid_t clock_id, struct timespec *tp)
 {
   int retval = -1;
+  struct timeval tv;
 
   switch (clock_id)
     {
-#define HANDLE_REALTIME \
-      do {								      \
-        struct timeval tv;						      \
-	retval = gettimeofday (&tv, NULL);				      \
-	if (retval == 0)						      \
-	  /* Convert into `timespec'.  */				      \
-	  TIMEVAL_TO_TIMESPEC (&tv, tp);				      \
-      } while (0)
-
 #ifdef SYSDEP_GETTIME
       SYSDEP_GETTIME;
 #endif
 
 #ifndef HANDLED_REALTIME
     case CLOCK_REALTIME:
-      HANDLE_REALTIME;
+      retval = gettimeofday (&tv, NULL);
+      if (retval == 0)
+	TIMEVAL_TO_TIMESPEC (&tv, tp);
       break;
 #endif
 
     default:
+#ifdef SYSDEP_GETTIME_CPU
+      SYSDEP_GETTIME_CPU;
+#endif
 #if HP_TIMING_AVAIL
       if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
-	  != CLOCK_THREAD_CPUTIME_ID)
+	  == CLOCK_THREAD_CPUTIME_ID)
+	retval = hp_timing_gettime (clock_id, tp);
+      else
 #endif
-	{
-	  __set_errno (EINVAL);
-	  break;
-	}
+	__set_errno (EINVAL);
+      break;
 
-#if HP_TIMING_AVAIL
-      /* FALLTHROUGH.  */
+#if HP_TIMING_AVAIL && !defined HANDLED_CPUTIME
     case CLOCK_PROCESS_CPUTIME_ID:
-      {
-	hp_timing_t tsc;
-
-	if (__builtin_expect (freq == 0, 0))
-	  {
-	    /* This can only happen if we haven't initialized the `freq'
-	       variable yet.  Do this now. We don't have to protect this
-	       code against multiple execution since all of them should
-	       lead to the same result.  */
-	    freq = __get_clockfreq ();
-	    if (__builtin_expect (freq == 0, 0))
-	      /* Something went wrong.  */
-	      break;
-	  }
-
-	if (clock_id != CLOCK_PROCESS_CPUTIME_ID
-	    && __pthread_clock_gettime != NULL)
-	  {
-	    retval = __pthread_clock_gettime (clock_id, freq, tp);
-	    break;
-	  }
-
-	/* Get the current counter.  */
-	HP_TIMING_NOW (tsc);
-
-	/* Compute the offset since the start time of the process.  */
-	tsc -= GL(dl_cpuclock_offset);
-
-	/* Compute the seconds.  */
-	tp->tv_sec = tsc / freq;
-
-	/* And the nanoseconds.  This computation should be stable until
-	   we get machines with about 16GHz frequency.  */
-	tp->tv_nsec = ((tsc % freq) * UINT64_C (1000000000)) / freq;
-
-	retval = 0;
-      }
-    break;
+      retval = hp_timing_gettime (clock_id, tp);
+      break;
 #endif
     }
 
   return retval;
 }
+librt_hidden_def (clock_gettime)
diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c
index 0194999b36..a93be6349b 100644
--- a/sysdeps/unix/clock_settime.c
+++ b/sysdeps/unix/clock_settime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2004, 2006 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
@@ -36,6 +36,43 @@ extern void __pthread_clock_settime (clockid_t clock_id, hp_timing_t offset)
 #endif
 
 
+#if HP_TIMING_AVAIL
+static int
+hp_timing_settime (clockid_t clock_id, const struct timespec *tp)
+{
+  hp_timing_t tsc;
+  hp_timing_t usertime;
+
+  /* First thing is to get the current time.  */
+  HP_TIMING_NOW (tsc);
+
+  if (__builtin_expect (freq == 0, 0))
+    {
+      /* This can only happen if we haven't initialized the `freq'
+	 variable yet.  Do this now. We don't have to protect this
+	 code against multiple execution since all of them should lead
+	 to the same result.  */
+      freq = __get_clockfreq ();
+      if (__builtin_expect (freq == 0, 0))
+	/* Something went wrong.  */
+	return -1;
+    }
+
+  /* Convert the user-provided time into CPU ticks.  */
+  usertime = tp->tv_sec * freq + (tp->tv_nsec * freq) / 1000000000ull;
+
+  /* Determine the offset and use it as the new base value.  */
+  if (clock_id == CLOCK_PROCESS_CPUTIME_ID
+      || __pthread_clock_settime == NULL)
+    GL(dl_cpuclock_offset) = tsc - usertime;
+  else
+    __pthread_clock_settime (clock_id, tsc - usertime);
+
+  return 0;
+}
+#endif
+
+
 /* Set CLOCK to value TP.  */
 int
 clock_settime (clockid_t clock_id, const struct timespec *tp)
@@ -70,55 +107,22 @@ clock_settime (clockid_t clock_id, const struct timespec *tp)
 #endif
 
     default:
-#if HP_TIMING_AVAIL
-      if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
-	  != CLOCK_THREAD_CPUTIME_ID)
+#ifdef SYSDEP_SETTIME_CPU
+      SYSDEP_SETTIME_CPU;
 #endif
+#ifndef HANDLED_CPUTIME
+# if HP_TIMING_AVAIL
+      if (CPUCLOCK_WHICH (clock_id) == CLOCK_PROCESS_CPUTIME_ID
+	  || CPUCLOCK_WHICH (clock_id) == CLOCK_THREAD_CPUTIME_ID)
+	retval = hp_timing_settime (clock_id, tp);
+      else
+# endif
 	{
 	  __set_errno (EINVAL);
 	  retval = -1;
-	  break;
 	}
-
-#if HP_TIMING_AVAIL
-      /* FALLTHROUGH.  */
-    case CLOCK_PROCESS_CPUTIME_ID:
-      {
-	hp_timing_t tsc;
-	hp_timing_t usertime;
-
-	/* First thing is to get the current time.  */
-	HP_TIMING_NOW (tsc);
-
-	if (__builtin_expect (freq == 0, 0))
-	  {
-	    /* This can only happen if we haven't initialized the `freq'
-	       variable yet.  Do this now. We don't have to protect this
-	       code against multiple execution since all of them should
-	       lead to the same result.  */
-	    freq = __get_clockfreq ();
-	    if (__builtin_expect (freq == 0, 0))
-	      {
-		/* Something went wrong.  */
-		retval = -1;
-		break;
-	      }
-	  }
-
-	/* Convert the user-provided time into CPU ticks.  */
-	usertime = tp->tv_sec * freq + (tp->tv_nsec * freq) / 1000000000ull;
-
-	/* Determine the offset and use it as the new base value.  */
-	if (clock_id == CLOCK_PROCESS_CPUTIME_ID
-	    || __pthread_clock_settime == NULL)
-	  GL(dl_cpuclock_offset) = tsc - usertime;
-	else
-	  __pthread_clock_settime (clock_id, tsc - usertime);
-
-	retval = 0;
-      }
-      break;
 #endif
+      break;
     }
 
   return retval;
diff --git a/sysdeps/unix/common/Dist b/sysdeps/unix/common/Dist
deleted file mode 100644
index 0c47cabcfa..0000000000
--- a/sysdeps/unix/common/Dist
+++ /dev/null
@@ -1 +0,0 @@
-glue-ctype.c
diff --git a/sysdeps/unix/common/Makefile b/sysdeps/unix/common/Makefile
deleted file mode 100644
index ea3a8d58f2..0000000000
--- a/sysdeps/unix/common/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 1991, 1992, 1993, 1994, 1997 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, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
-
-ifndef inhibit-glue
-ifeq ($(subdir),ctype)
-
-sysdep_routines := $(sysdep_routines) ctype-glue
-
-generated := $(generated) glue-ctype ctype-glue.c
-
-$(objpfx)ctype-glue.c: $(objpfx)glue-ctype
-	@rm -f $@
-	$(dir $<)$(notdir $<) > $@-t
-	mv $@-t $@
-
-$(objpfx)glue-ctype: $(sysdep_dir)/unix/common/glue-ctype.c
-	$(native-compile)
-
-endif
-endif
diff --git a/sysdeps/unix/common/configure b/sysdeps/unix/common/configure
deleted file mode 100755
index 7bbc9cb2e5..0000000000
--- a/sysdeps/unix/common/configure
+++ /dev/null
@@ -1,195 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
-
-if test -z "$inhibit_glue"; then
-
-# Find out what this system calls `sys_siglist'.
-
-echo "$as_me:$LINENO: checking for sys_siglist" >&5
-echo $ECHO_N "checking for sys_siglist... $ECHO_C" >&6
-if test "${ac_cv_check_symbol_sys_siglist+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-extern char *sys_siglist[]; puts(*sys_siglist);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  	    ac_cv_check_symbol_sys_siglist=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_check_symbol_sys_siglist=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-if test "$ac_cv_check_symbol_sys_siglist" = yes; then
-  ac_tr_symbol=`echo sys_siglist | tr '[a-z]' '[A-Z]'`
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_${ac_tr_symbol} 1
-_ACEOF
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_check_symbol_sys_siglist" >&5
-echo "${ECHO_T}$ac_cv_check_symbol_sys_siglist" >&6
-echo "$as_me:$LINENO: checking for _sys_siglist" >&5
-echo $ECHO_N "checking for _sys_siglist... $ECHO_C" >&6
-if test "${ac_cv_check_symbol__sys_siglist+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-extern char *_sys_siglist[]; puts(*_sys_siglist);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  	    ac_cv_check_symbol__sys_siglist=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_check_symbol__sys_siglist=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-if test "$ac_cv_check_symbol__sys_siglist" = yes; then
-  ac_tr_symbol=`echo _sys_siglist | tr '[a-z]' '[A-Z]'`
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_${ac_tr_symbol} 1
-_ACEOF
-
-fi
-echo "$as_me:$LINENO: result: $ac_cv_check_symbol__sys_siglist" >&5
-echo "${ECHO_T}$ac_cv_check_symbol__sys_siglist" >&6
-
-# Find out the name of the table the system's <ctype.h> uses for character
-# classification.  This is used by sysdeps/unix/common/glue-ctype.c.
-echo "$as_me:$LINENO: checking ctype array name for glue" >&5
-echo $ECHO_N "checking ctype array name for glue... $ECHO_C" >&6
-if test "${libc_cv_ctype_glue+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  for ctype in _ctype_ __ctype_ __ctype _ctype__ _ctype _locp; do
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-int
-main ()
-{
-$ctype[13];
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  libc_cv_ctype_glue="$ctype"; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-done
-fi
-
-echo "$as_me:$LINENO: result: $libc_cv_ctype_glue" >&5
-echo "${ECHO_T}$libc_cv_ctype_glue" >&6
-cat >>confdefs.h <<_ACEOF
-#define HAVE_`echo $libc_cv_ctype_glue | tr 'a-z' 'A-Z'` 1
-_ACEOF
-
-
-fi
diff --git a/sysdeps/unix/common/configure.in b/sysdeps/unix/common/configure.in
deleted file mode 100644
index 9597d68f3d..0000000000
--- a/sysdeps/unix/common/configure.in
+++ /dev/null
@@ -1,21 +0,0 @@
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-
-if test -z "$inhibit_glue"; then
-
-# Find out what this system calls `sys_siglist'.
-AC_CHECK_SYMBOL(sys_siglist)
-AC_CHECK_SYMBOL(_sys_siglist)
-
-# Find out the name of the table the system's <ctype.h> uses for character
-# classification.  This is used by sysdeps/unix/common/glue-ctype.c.
-AC_MSG_CHECKING(ctype array name for glue)
-AC_CACHE_VAL(libc_cv_ctype_glue, [dnl
-for ctype in _ctype_ __ctype_ __ctype _ctype__ _ctype _locp; do
-AC_TRY_LINK([#include <ctype.h>],
-	    [$ctype[13];],
-	    [libc_cv_ctype_glue="$ctype"; break])
-done])
-AC_MSG_RESULT($libc_cv_ctype_glue)
-AC_DEFINE_UNQUOTED(HAVE_`echo $libc_cv_ctype_glue | tr '[a-z]' '[A-Z]'`)
-
-fi
diff --git a/sysdeps/unix/common/glue-ctype.c b/sysdeps/unix/common/glue-ctype.c
deleted file mode 100644
index 2e065a77c9..0000000000
--- a/sysdeps/unix/common/glue-ctype.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (C) 1992, 1993, 1994, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Different systems have different names for the array.
-   This order is important for some systems.  */
-
-#if !defined(TABLE) && defined(HAVE__LOCP)
-/* OSF/1 has the name _ctype defined as a macro, which points down into
-   the _locp structure.  Jesus.  We'll hope this works.  We need to
-   check for LOCP first, since there is no symbol actually named _ctype
-   in their library.  */
-#include <sys/types.h> /* for wchar_t used by localdef.h */
-#include <sys/localedef.h>
-extern loc_t *_locp;
-#define TABLE		(_locp->lc_chrtbl)->lc_ctype
-#undef _ctype
-#define TABLE_NAME	_ctype
-#endif
-#ifdef	HAVE__CTYPE__
-#define	TABLE	_ctype__
-#endif
-#if !defined(TABLE) && defined(HAVE__CTYPE)
-#define TABLE   _ctype
-#endif
-#if !defined(TABLE) && defined(HAVE__CTYPE_)
-#define	TABLE	_ctype_
-#endif
-#if !defined(TABLE) && defined(HAVE___CTYPE_)
-#define	TABLE	__ctype_
-#endif
-#if !defined(TABLE) && defined(HAVE___CTYPE)
-#define	TABLE	__ctype
-#endif
-
-#if defined (__STDC__) && __STDC__
-#define	STRINGIFY(arg)	#arg
-#else
-#define	STRINGIFY(arg)	"arg"
-#endif
-
-#define EVALLED_STRINGIFY(x)	STRINGIFY (x)
-
-int
-main ()
-{
-#ifdef TABLE
-
-  int i;
-
-#ifndef HAVE__LOCP
-  /* This won't work for the define to look into _locp.  */
-  extern unsigned char TABLE[];
-#endif
-
-#ifdef TABLE_NAME
-  printf ("const unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE_NAME));
-#else
-  printf ("const unsigned char %s[] =\n  {\n", EVALLED_STRINGIFY (TABLE));
-#endif
-
-  for (i = -1; i < 256; ++i)
-    printf ("    %d,\n", (int) ((TABLE+1)[i]));
-
-  puts ("  };");
-
-#else
-
-  puts ("/* I don't know what the ctype table is called on this system.");
-  puts ("   If there is a table, and you want the ctype glue to work,");
-  puts ("   edit configure.in and glue-ctype.c in sysdeps/unix/common/");
-  puts ("   to check for the right name.  */");
-
-#endif
-
-  exit (0);
-}
diff --git a/sysdeps/unix/configure b/sysdeps/unix/configure
deleted file mode 100755
index b910353cd9..0000000000
--- a/sysdeps/unix/configure
+++ /dev/null
@@ -1,109 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
- # Local configure fragment for sysdeps/unix.
-
-if test -z "$inhibit_glue"; then
-# For make_errlist.c, used in make_errlist.
-
-
-for ac_func in strerror
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-int
-main ()
-{
-return f != $ac_func;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_var=no"
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-fi
diff --git a/sysdeps/unix/configure.in b/sysdeps/unix/configure.in
deleted file mode 100644
index de7feccb25..0000000000
--- a/sysdeps/unix/configure.in
+++ /dev/null
@@ -1,7 +0,0 @@
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-# Local configure fragment for sysdeps/unix.
-
-if test -z "$inhibit_glue"; then
-# For make_errlist.c, used in make_errlist.
-AC_CHECK_FUNCS(strerror)
-fi
diff --git a/sysdeps/unix/fdopendir.c b/sysdeps/unix/fdopendir.c
new file mode 100644
index 0000000000..565ce1ed72
--- /dev/null
+++ b/sysdeps/unix/fdopendir.c
@@ -0,0 +1,52 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <not-cancel.h>
+
+
+DIR *
+__fdopendir (int fd)
+{
+  struct stat64 statbuf;
+
+  if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &statbuf), 0) < 0)
+    return NULL;
+  if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
+    {
+      __set_errno (ENOTDIR);
+      return NULL;
+    }
+
+  /* Make sure the descriptor allows for reading.  */
+  int flags = __fcntl (fd, F_GETFL);
+  if (__builtin_expect (flags == -1, 0))
+    return NULL;
+  if (__builtin_expect ((flags & O_ACCMODE) == O_WRONLY, 0))
+    {
+      __set_errno (EINVAL);
+      return NULL;
+    }
+
+  return __alloc_dir (fd, false, &statbuf);
+}
+weak_alias (__fdopendir, fdopendir)
diff --git a/sysdeps/unix/get_child_max.c b/sysdeps/unix/get_child_max.c
new file mode 100644
index 0000000000..c59e4d8953
--- /dev/null
+++ b/sysdeps/unix/get_child_max.c
@@ -0,0 +1,37 @@
+/* Get POSIX {CHILD_MAX} run-time limit value.  Unix version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <limits.h>
+#include <sys/sysinfo.h>
+#include <sys/resource.h>
+
+#ifndef CHILD_MAX
+long int
+__get_child_max (void)
+{
+# ifdef RLIMIT_NPROC
+  struct rlimit limit;
+  if (__getrlimit (RLIMIT_NPROC, &limit) == 0
+      && limit.rlim_cur != RLIM_INFINITY)
+    return limit.rlim_cur;
+# endif
+
+  return -1;
+}
+#endif
diff --git a/sysdeps/unix/i386/brk.S b/sysdeps/unix/i386/brk.S
index a7604d7e7a..d8dd96b4ce 100644
--- a/sysdeps/unix/i386/brk.S
+++ b/sysdeps/unix/i386/brk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,95,97,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,95,97,2002,2005 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
@@ -25,11 +25,7 @@
 .data
 .globl C_SYMBOL_NAME(__curbrk)
 C_LABEL(__curbrk)
-#ifdef	HAVE_GNU_LD
 	.long C_SYMBOL_NAME(_end)
-#else
-	.long C_SYMBOL_NAME(end)
-#endif
 
 .text
 SYSCALL__ (brk, 1)
diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S
index 6056cbeef2..3bc872add8 100644
--- a/sysdeps/unix/i386/sysdep.S
+++ b/sysdeps/unix/i386/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 2000, 2002, 2004
+/* Copyright (C) 1991,1992,1993,1994,1995,1996,1997,2000,2002,2004,2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -47,7 +47,12 @@ notb:
 #endif
 #ifndef	PIC
 # if USE___THREAD
+#  ifndef NO_TLS_DIRECT_SEG_REFS
 	movl %eax, %gs:C_SYMBOL_NAME(errno@NTPOFF)
+#  else
+	movl %gs:0, %ecx
+	movl %eax, C_SYMBOL_NAME(errno@NTPOFF)(%ecx)
+#  endif
 # elif !defined _LIBC_REENTRANT
 	movl %eax, C_SYMBOL_NAME(errno)
 # else
@@ -66,7 +71,12 @@ notb:
 
 	/* Pop %ebx value saved before jumping here.  */
 	popl %ebx
+#  ifndef NO_TLS_DIRECT_SEG_REFS
+	addl %gs:0, %ecx
+	movl %eax, (%ecx)
+#  else
 	movl %eax, %gs:0(%ecx)
+#  endif
 # elif RTLD_PRIVATE_ERRNO
 	movl %eax, C_SYMBOL_NAME(rtld_errno@GOTOFF)(%ebx)
 
diff --git a/sysdeps/unix/make_errlist.c b/sysdeps/unix/make_errlist.c
deleted file mode 100644
index 8b2b972a8a..0000000000
--- a/sysdeps/unix/make_errlist.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (C) 1991,1992,1995,1997,1999,2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-#include <time.h>
-
-/* Make a definition for sys_errlist.  */
-
-extern int sys_nerr;
-#ifndef HAVE_STRERROR
-extern const char *const sys_errlist[];
-#endif
-
-int
-main (void)
-{
-  register int i;
-  struct tm timenow;
-  time_t now;
-  int year;
-
-  now = time (NULL);
-  timenow = *localtime (&now);
-
-  year = timenow.tm_year + 1900;
-
-  printf ("/* Copyright (C) %d Free Software Foundation, Inc.\n\
-   This file is part of the GNU C Library.\n\
-\n\
-   The GNU C Library is free software; you can redistribute it and/or\n\
-   modify it under the terms of the GNU Lesser General Public\n\
-   License as published by the Free Software Foundation; either\n\
-   version 2.1 of the License, or (at your option) any later version.\n\
-\n\
-   The GNU C Library is distributed in the hope that it will be useful,\n\
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n\
-   Lesser General Public License for more details.\n\
-\n\
-   You should have received a copy of the GNU Lesser General Public\n\
-   License along with the GNU C Library; if not, write to the Free\n\
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\n\
-   02111-1307 USA.  */\n", year);
-
-  puts ("#include <stddef.h>\n");
-  puts ("#include <libintl.h>\n");
-  puts ("\n/* This is a list of all known `errno' codes.  */\n");
-
-  printf ("\nconst int _sys_nerr = %d;\n\n", sys_nerr);
-  puts ("const char *const _sys_errlist[] =\n  {");
-
-  for (i = 0; i < sys_nerr; ++i)
-    printf ("    N_(\"%s\"),\n",
-#ifdef HAVE_STRERROR
-	  strerror (i)
-#else /* ! HAVE_STRERROR */
-	  sys_errlist[i]
-#endif /* HAVE_STRERROR */
-	  );
-
-  puts ("    NULL\n  };\n");
-
-  puts ("weak_alias (_sys_errlist, sys_errlist)");
-  puts ("weak_alias (_sys_nerr, sys_nerr)");
-
-  exit (0);
-}
diff --git a/sysdeps/unix/mips/brk.S b/sysdeps/unix/mips/brk.S
deleted file mode 100644
index a35b8b9113..0000000000
--- a/sysdeps/unix/mips/brk.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <sys/asm.h>
-
-#ifndef SYS_brk
-#define SYS_brk 17
-#endif
-
-#ifndef       HAVE_GNU_LD
-#define _end           end
-#endif
-
-	.data
-ENTRY(__curbrk)
-	.word 0
-	.end __curbrk
-
-	.text
-SYSCALL__(brk, 1)
-	.set	reorder
-	/* Handle the query case.  */
-	bnez a0, 1f
-	move a0, v0
-1:	/* Update __curbrk and exit cleanly.  */
-	PTR_S a0, __curbrk
-	move v0, zero
-	jr ra
-PSEUDO_END(__brk)
-
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/mips/dl-brk.S b/sysdeps/unix/mips/dl-brk.S
deleted file mode 100644
index eeb96544e3..0000000000
--- a/sysdeps/unix/mips/dl-brk.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <brk.S>
diff --git a/sysdeps/unix/mips/fork.S b/sysdeps/unix/mips/fork.S
deleted file mode 100644
index a7848acb6b..0000000000
--- a/sysdeps/unix/mips/fork.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-SYSCALL__ (fork, 0)
-	beq v1, zero, parent /* Branch if parent.  */
-	nop
-	/* We are the child.  Return zero.  */
-	move v0, zero
-parent:
-	ret
-PSEUDO_END(__fork)
-
-libc_hidden_def (__fork)
-weak_alias (__fork, fork)
diff --git a/sysdeps/unix/mips/mips32/sysdep.h b/sysdeps/unix/mips/mips32/sysdep.h
deleted file mode 100644
index 0b5d1186bb..0000000000
--- a/sysdeps/unix/mips/mips32/sysdep.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/unix/mips/sysdep.h>
-
-/* Note that while it's better structurally, going back to call __syscall_error
-   can make things confusing if you're debugging---it looks like it's jumping
-   backwards into the previous fn.  */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
-  .align 2;								      \
-  99: la t9,__syscall_error;						      \
-  jr t9;								      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  .cpload t9;								      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
-  .set noreorder;							      \
-  .align 2;								      \
-  99: j __syscall_error;						      \
-  nop;									      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#endif
diff --git a/sysdeps/unix/mips/mips64/n32/sysdep.h b/sysdeps/unix/mips/mips64/n32/sysdep.h
deleted file mode 100644
index ec93fadc04..0000000000
--- a/sysdeps/unix/mips/mips64/n32/sysdep.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Alexandre Oliva <aoliva@redhat.com>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/unix/mips/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-/* Note that while it's better structurally, going back to call __syscall_error
-   can make things confusing if you're debugging---it looks like it's jumping
-   backwards into the previous fn.  */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
-  .align 2;								      \
-  99:;									      \
-  .set noat;								      \
-  .cpsetup t9, $1, name;						      \
-  .set at;								      \
-  la t9,__syscall_error;						      \
-  .cpreturn;								      \
-  jr t9;								      \
-  ENTRY(name)								      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
-  .set noreorder;							      \
-  .align 2;								      \
-  99: j __syscall_error;						      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#endif
-
-#endif
diff --git a/sysdeps/unix/mips/mips64/n64/sysdep.h b/sysdeps/unix/mips/mips64/n64/sysdep.h
deleted file mode 100644
index 502b66797b..0000000000
--- a/sysdeps/unix/mips/mips64/n64/sysdep.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
-	Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Alexandre Oliva <aoliva@redhat.com>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/unix/mips/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-/* Note that while it's better structurally, going back to call __syscall_error
-   can make things confusing if you're debugging---it looks like it's jumping
-   backwards into the previous fn.  */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
-  .align 2;								      \
-  99:;									      \
-  .set noat;								      \
-  .cpsetup t9, $1, name;						      \
-  .set at;								      \
-  dla t9,__syscall_error;						      \
-  .cpreturn;								      \
-  jr t9;								      \
-  ENTRY(name)								      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
-  .set noreorder;							      \
-  .align 2;								      \
-  99: j __syscall_error;						      \
-  ENTRY(name)								      \
-  .set noreorder;							      \
-  li v0, SYS_ify(syscall_name);						      \
-  syscall;								      \
-  .set reorder;								      \
-  bne a3, zero, 99b;							      \
-L(syse1):
-#endif
-
-#endif
diff --git a/sysdeps/unix/mips/pipe.S b/sysdeps/unix/mips/pipe.S
deleted file mode 100644
index ee7b76d635..0000000000
--- a/sysdeps/unix/mips/pipe.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 2000, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-SYSCALL__ (pipe, 1)
-	/* Plop in the two descriptors.  */
-	sw v0, 0(a0)
-	sw v1, 4(a0)
-
-	/* Go out with a clean status.  */
-	move v0, zero
-	j ra
-PSEUDO_END(__pipe)
-
-libc_hidden_def (__pipe)
-weak_alias (__pipe, pipe)
diff --git a/sysdeps/unix/mips/rt-sysdep.S b/sysdeps/unix/mips/rt-sysdep.S
deleted file mode 100644
index f966bf1e59..0000000000
--- a/sysdeps/unix/mips/rt-sysdep.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdep.S>
diff --git a/sysdeps/unix/mips/sigreturn.S b/sysdeps/unix/mips/sigreturn.S
deleted file mode 100644
index 2cb3adb6de..0000000000
--- a/sysdeps/unix/mips/sigreturn.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#ifndef SYS_sigreturn
-#define SYS_sigreturn 103
-#endif
-
-ENTRY(__sigreturn)
-	li v0, SYS_sigreturn
-	syscall
-	.end __sigreturn
-
-weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S
deleted file mode 100644
index 8c172db190..0000000000
--- a/sysdeps/unix/mips/sysdep.S
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (C) 1992, 1993, 1994, 1997, 1998, 1999, 2000, 2002, 2003 
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H
-#include <bits/errno.h>
-#include <sys/asm.h>
-
-#ifdef _LIBC_REENTRANT
-
-LOCALSZ= 3
-FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
-RAOFF= FRAMESZ-(1*SZREG)
-GPOFF= FRAMESZ-(2*SZREG)
-V0OFF= FRAMESZ-(3*SZREG)
-	
-ENTRY(__syscall_error)
-#ifdef __PIC__
-	.set noat
-	SETUP_GPX (AT)
-	.set at
-#endif
-	PTR_SUBU sp, FRAMESZ
-	.set noat
-	SETUP_GPX64(GPOFF,AT)
-	.set at
-#ifdef __PIC__
-	SAVE_GP(GPOFF)
-#endif
-	REG_S	v0, V0OFF(sp)
-	REG_S	ra, RAOFF(sp)
-
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-	bne	v0, EWOULDBLOCK_sys, L(skip)
-	nop
-	li	v0, EAGAIN
-L(skip):
-#endif
-	/* Find our per-thread errno address  */
-	jal	__errno_location
-
-	/* Store the error value.  */
-	REG_L	t0, V0OFF(sp)
-	sw	t0, 0(v0)
-
-	/* And just kick back a -1.  */
-	REG_L	ra, RAOFF(sp)
-	RESTORE_GP64
-	PTR_ADDU sp, FRAMESZ
-	li	v0, -1
-	j	ra
-	END(__syscall_error)
-
-#else /* _LIBC_REENTRANT */
-
-
-ENTRY(__syscall_error)
-#ifdef __PIC__
-	SETUP_GPX (AT)
-#endif
-	SETUP_GPX64 (t9, AT)
-	
-#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
-	/* We translate the system's EWOULDBLOCK error into EAGAIN.
-	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
-	   EWOULDBLOCK_sys is the original number.  */
-	bne v0, EWOULDBLOCK_sys, L(skip)
-	li v0, EAGAIN
-L(skip):
-#endif
-	/* Store it in errno... */
-	sw v0, errno
-
-	/* And just kick back a -1.  */
-	li v0, -1
-
-	RESTORE_GP64
-	j ra
-	END(__syscall_error)
-#endif  /* _LIBC_REENTRANT  */
diff --git a/sysdeps/unix/mips/sysdep.h b/sysdeps/unix/mips/sysdep.h
deleted file mode 100644
index 714830147d..0000000000
--- a/sysdeps/unix/mips/sysdep.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sgidefs.h>
-#include <sysdeps/unix/sysdep.h>
-
-#ifdef __ASSEMBLER__
-
-#include <regdef.h>
-
-#define ENTRY(name) \
-  .globl name;								      \
-  .align 2;								      \
-  .ent name,0;								      \
-  name##:
-
-#undef END
-#define	END(function)                                   \
-		.end	function;		        \
-		.size	function,.-function
-
-#define ret	j ra ; nop
-
-#undef PSEUDO_END
-#define PSEUDO_END(sym) .end sym; .size sym,.-sym
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)	\
-  .align 2;						\
-  ENTRY(name)						\
-  .set noreorder;					\
-  li v0, SYS_ify(syscall_name);				\
-  syscall
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(sym) .end sym; .size sym,.-sym
-
-#define ret_NOERRNO ret
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)	\
-  .align 2;						\
-  ENTRY(name)						\
-  .set noreorder;					\
-  li v0, SYS_ify(syscall_name);				\
-  syscall
-
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(sym) .end sym; .size sym,.-sym
-
-#define ret_ERRVAL ret
-
-#define r0	v0
-#define r1	v1
-/* The mips move insn is d,s.  */
-#define MOVE(x,y)	move y , x
-
-#if _MIPS_SIM == _ABIO32
-# define L(label) $L ## label
-#else
-# define L(label) .L ## label
-#endif
-
-#endif
diff --git a/sysdeps/unix/mips/wait.S b/sysdeps/unix/mips/wait.S
deleted file mode 100644
index de0f6ebfae..0000000000
--- a/sysdeps/unix/mips/wait.S
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 1992, 1994, 1995, 1997, 2002, 2003
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Brendan Kehoe (brendan@zen.org).
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-.set noreorder
-
-ENTRY(__wait)
-	/* Prep it for wait.  */
-	move a1, zero
-	move a2, zero
-
-	li v0, SYS_wait
-	syscall
-	beqz a3, L(noerror)
-	nop
-	j __syscall_error
-	nop
-
-L(noerror):
-	/* If the arg is not NULL, store v1 there.  */
-	beqz a0, L(noarg)
-	nop
-	sw v1, 0(a0)
-	nop
-L(noarg):
-	ret
-	.end __wait
-
-weak_alias (__wait, wait)
diff --git a/sysdeps/unix/mkfifoat.c b/sysdeps/unix/mkfifoat.c
new file mode 100644
index 0000000000..5c4da2a982
--- /dev/null
+++ b/sysdeps/unix/mkfifoat.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/stat.h>
+
+
+/* Create a new FIFO with permission bits MODE.  But interpret
+   relative PATH names relative to the directory associated with FD.  */
+int
+mkfifoat (fd, file, mode)
+     int fd;
+     const char *file;
+     mode_t mode;
+{
+  dev_t dev = 0;
+  return __xmknodat (_MKNOD_VER, fd, file, mode | S_IFIFO, &dev);
+}
diff --git a/sysdeps/unix/nice.c b/sysdeps/unix/nice.c
index 700305c0e9..6e75b0327b 100644
--- a/sysdeps/unix/nice.c
+++ b/sysdeps/unix/nice.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992, 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997, 2001, 2002, 2006
+   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
@@ -41,10 +42,17 @@ nice (int incr)
 	__set_errno (save);
     }
 
-  result = setpriority (PRIO_PROCESS, 0, prio + incr);
-  if (result != -1)
-    return getpriority (PRIO_PROCESS, 0);
-  else
-    return -1;
-
+  prio += incr;
+  if (prio < PRIO_MIN)
+    prio = PRIO_MIN;
+  else if (prio >= PRIO_MAX)
+    prio = PRIO_MAX - 1;
+  result = setpriority (PRIO_PROCESS, 0, prio);
+  if (result == -1)
+    {
+      if (errno == EACCES)
+	errno = EPERM;
+      return -1;
+    }
+  return getpriority (PRIO_PROCESS, 0);
 }
diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c
index 5e03ed9b20..6aa738fb69 100644
--- a/sysdeps/unix/opendir.c
+++ b/sysdeps/unix/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1996,98,2000-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1996,98,2000-2003,2005 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
@@ -78,11 +78,7 @@ tryopen_o_directory (void)
 DIR *
 __opendir (const char *name)
 {
-  DIR *dirp;
   struct stat64 statbuf;
-  int fd;
-  size_t allocation;
-  int save_errno;
 
   if (__builtin_expect (name[0], '\1') == '\0')
     {
@@ -113,7 +109,7 @@ __opendir (const char *name)
 	 }
     }
 
-  fd = open_not_cancel_2 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE);
+  int fd = open_not_cancel_2 (name, O_RDONLY|O_NDELAY|EXTRA_FLAGS|O_LARGEFILE);
   if (__builtin_expect (fd, 0) < 0)
     return NULL;
 
@@ -129,18 +125,30 @@ __opendir (const char *name)
     {
       if (__builtin_expect (! S_ISDIR (statbuf.st_mode), 0))
 	{
-	  save_errno = ENOTDIR;
-	  goto lose;
+	  __set_errno (ENOTDIR);
+	lose:
+	  close_not_cancel_no_status (fd);
+	  return NULL;
 	}
     }
 
+  return __alloc_dir (fd, true, &statbuf);
+}
+weak_alias (__opendir, opendir)
+
+
+DIR *
+internal_function
+__alloc_dir (int fd, bool close_fd, const struct stat64 *statp)
+{
   if (__builtin_expect (__fcntl (fd, F_SETFD, FD_CLOEXEC), 0) < 0)
     goto lose;
 
+  size_t allocation;
 #ifdef _STATBUF_ST_BLKSIZE
-  if (__builtin_expect ((size_t) statbuf.st_blksize >= sizeof (struct dirent64),
+  if (__builtin_expect ((size_t) statp->st_blksize >= sizeof (struct dirent64),
 			1))
-    allocation = statbuf.st_blksize;
+    allocation = statp->st_blksize;
   else
 #endif
     allocation = (BUFSIZ < sizeof (struct dirent64)
@@ -148,13 +156,16 @@ __opendir (const char *name)
 
   const int pad = -sizeof (DIR) % __alignof__ (struct dirent64);
 
-  dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
+  DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation + pad);
   if (dirp == NULL)
   lose:
     {
-      save_errno = errno;
-      close_not_cancel_no_status (fd);
-      __set_errno (save_errno);
+      if (close_fd)
+	{
+	  int save_errno = errno;
+	  close_not_cancel_no_status (fd);
+	  __set_errno (save_errno);
+	}
       return NULL;
     }
   memset (dirp, '\0', sizeof (DIR));
@@ -166,4 +177,3 @@ __opendir (const char *name)
 
   return dirp;
 }
-weak_alias (__opendir, opendir)
diff --git a/sysdeps/unix/rewinddir.c b/sysdeps/unix/rewinddir.c
index 9f3724fc6a..051e93595e 100644
--- a/sysdeps/unix/rewinddir.c
+++ b/sysdeps/unix/rewinddir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995-1998, 2005 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
@@ -30,6 +30,7 @@ rewinddir (dirp)
 {
   __libc_lock_lock (dirp->lock);
   (void) __lseek (dirp->fd, (off_t) 0, SEEK_SET);
+  dirp->filepos = 0;
   dirp->offset = 0;
   dirp->size = 0;
   __libc_lock_unlock (dirp->lock);
diff --git a/sysdeps/unix/sh/sysdep.S b/sysdeps/unix/sh/sysdep.S
index 074b74333c..802d51f3be 100644
--- a/sysdeps/unix/sh/sysdep.S
+++ b/sysdeps/unix/sh/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2005 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
@@ -40,14 +40,21 @@ skip:
 #else
 	mov.l	.L3, r1
 	sts.l	pr, @-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (pr, 0)
 	jsr	@r1
 	 mov.l	r0, @-r15
+	cfi_adjust_cfa_offset (4)
 	mov.l	@r15+, r1
+	cfi_adjust_cfa_offset (-4)
 	lds.l	@r15+, pr
+	cfi_adjust_cfa_offset (-4)
 	mov.l	r1, @r0
 #endif
 #else
 	mov.l	r12, @-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (r12, 0)
 #ifndef _LIBC_REENTRANT
 	mov	r0, r2
         mov.l	0f, r12
@@ -58,7 +65,10 @@ skip:
 	mov.l	r2, @r1
 #else
 	mov.l	r0, @-r15
+	cfi_adjust_cfa_offset (4)
 	sts.l	pr, @-r15
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (pr, 0)
         mov.l	0f, r12
 	mova	0f, r0
 	add	r0, r12
@@ -98,5 +108,3 @@ skip:
 #endif
 #endif
 END(__syscall_error)
-
-weak_alias (__syscall_error, syscall_error)
diff --git a/sysdeps/unix/sockatmark.c b/sysdeps/unix/sockatmark.c
index 306ab36ee1..a2476415ac 100644
--- a/sysdeps/unix/sockatmark.c
+++ b/sysdeps/unix/sockatmark.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005 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
@@ -24,5 +24,7 @@ int
 sockatmark (fd)
      int fd;
 {
-  return __ioctl (fd, SIOCATMARK);
+  int answ;
+
+  return __ioctl (fd, SIOCATMARK, &answ) == -1 ? -1 : answ;
 }
diff --git a/sysdeps/unix/sparc/brk.S b/sysdeps/unix/sparc/brk.S
index 2a16463b0f..29255fc68e 100644
--- a/sysdeps/unix/sparc/brk.S
+++ b/sysdeps/unix/sparc/brk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997, 2005 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
@@ -29,11 +29,7 @@
 .data
 .global C_SYMBOL_NAME(__curbrk)
 C_LABEL(__curbrk)
-#ifdef	HAVE_GNU_LD
 	.long C_SYMBOL_NAME(_end)
-#else
-	.long C_SYMBOL_NAME(end)
-#endif
 
 .text
 ENTRY (__brk)
diff --git a/sysdeps/unix/sysv/Dist b/sysdeps/unix/sysv/Dist
deleted file mode 100644
index 6ad8e0f653..0000000000
--- a/sysdeps/unix/sysv/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-direct.h
-sysv_termio.h
diff --git a/sysdeps/unix/sysv/i386/signal.S b/sysdeps/unix/sysv/i386/signal.S
deleted file mode 100644
index af51bc5182..0000000000
--- a/sysdeps/unix/sysv/i386/signal.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1992, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* This is just a standard system call, except we need to load %edx
-   with the address of the `__sigreturn' function.  */
-
-	.globl syscall_error
-	.globl C_SYMBOL_NAME(__sigreturn)
-ENTRY (signal)
-	lea SYS_signal, %eax
-	lea C_SYMBOL_NAME(__sigreturn), %edx
-	.byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- GAS bug.  */
-	jb syscall_error
-	ret
diff --git a/sysdeps/unix/sysv/i386/sigreturn.S b/sysdeps/unix/sysv/i386/sigreturn.S
deleted file mode 100644
index edf4418c5b..0000000000
--- a/sysdeps/unix/sysv/i386/sigreturn.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1994, 1995, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-.text
-ENTRY (__sigreturn)
-	addl $4, %esp		/* Pop the return PC.  */
-	lcall $0xf, $0		/* Do the magic sigreturn trap.  */
-	/* NOTREACHED */
-
-weak_alias (__sigreturn, sigreturn)
diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist
deleted file mode 100644
index e621041a24..0000000000
--- a/sysdeps/unix/sysv/linux/Dist
+++ /dev/null
@@ -1,85 +0,0 @@
-bits/initspin.h
-cmsg_nxthdr.c
-dl-brk.c
-dl-sbrk.c
-exit-thread.S
-fatal-prepare.h
-getdirentries.c
-getdirentries64.c
-ipc_priv.h
-kernel-features.h
-kernel_sigaction.h
-kernel_stat.h
-kernel_termios.h
-ldd-rewrite.sed
-lddlibc4.c
-linux_fsinfo.h
-llseek.c
-makedev.c
-ntp_gettime.c
-readahead.c
-s_pread64.c
-s_pwrite64.c
-siglist.h
-sizes.h
-socketcall.h
-sysctl.c
-termio.h
-netlinkaccess.h
-net/ethernet.h
-net/if_arp.h
-net/if_packet.h
-net/if_ppp.h
-net/if_shaper.h
-net/if_slip.h
-net/ppp-comp.h
-net/ppp_defs.h
-net/route.h
-netash/ash.h
-netatalk/at.h
-netax25/ax25.h
-neteconet/ec.h
-netinet/if_fddi.h
-netinet/if_tr.h
-netpacket/packet.h
-netipx/ipx.h
-netrom/netrom.h
-netrose/rose.h
-nfs/nfs.h
-pathconf.h
-rt_sigaction.c
-rt_sigpending.c
-rt_sigprocmask.c
-rt_sigqueueinfo.c
-rt_sigreturn.c
-rt_sigsuspend.c
-rt_sigtimedwait.c
-sa_len.c
-scsi/sg.h
-scsi/scsi.h
-scsi/scsi_ioctl.h
-sys/acct.h
-sys/epoll.h
-sys/fsuid.h
-sys/kd.h
-sys/kdaemon.h
-sys/klog.h
-sys/mount.h
-sys/pci.h
-sys/personality.h
-sys/prctl.h
-sys/procfs.h
-sys/quota.h
-sys/raw.h
-sys/soundcard.h
-sys/sysctl.h
-sys/sysinfo.h
-sys/timex.h
-sys/ultrasound.h
-sys/user.h
-sys/vt.h
-xstatconv.c
-xstatconv.h
-getdents64.c
-umount.S
-umount2.S
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 37be75e964..8bec6cdb85 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -24,10 +24,12 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
 		  sys/quota.h sys/fsuid.h \
 		  scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
 		  sys/ultrasound.h sys/raw.h sys/personality.h sys/epoll.h \
-		  bits/a.out.h
+		  bits/a.out.h sys/inotify.h
 
 install-others += $(inst_includedir)/bits/syscall.h
 
+tests += tst-clone
+
 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
 # For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and
 # we generate a file that uses <bits/wordsize.h>.
@@ -107,11 +109,6 @@ ifeq ($(subdir),termios)
 sysdep_headers += termio.h
 endif
 
-ifeq ($(subdir),stdio-common)
-# Just disable the auto generation in sysdeps/generic
-inhibit-siglist := yes
-endif
-
 ifeq ($(subdir),posix)
 sysdep_headers += bits/initspin.h
 
@@ -152,6 +149,11 @@ CFLAGS-mq_receive.c += -fexceptions
 endif
 
 ifeq ($(subdir),nscd)
-CFLAGS-connections.c += -DHAVE_EPOLL
+CFLAGS-connections.c += -DHAVE_EPOLL -DHAVE_SENDFILE
+CFLAGS-pwdcache.c += -DHAVE_SENDFILE
+CFLAGS-grpcache.c += -DHAVE_SENDFILE
+CFLAGS-hstcache.c += -DHAVE_SENDFILE
+CFLAGS-aicache.c += -DHAVE_SENDFILE
+CFLAGS-initgrcache.c += -DHAVE_SENDFILE
 CFLAGS-gai.c += -DNEED_NETLINK
 endif
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 980724e519..7c015b1d62 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -115,6 +115,17 @@ libc {
   GLIBC_2.3.4 {
     sched_getaffinity; sched_setaffinity;
   }
+  GLIBC_2.4 {
+    inotify_init; inotify_add_watch; inotify_rm_watch;
+
+    unshare;
+
+    #errlist-compat	132
+    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+  }
+  GLIBC_2.5 {
+    splice; sync_file_range; tee; vmsplice;
+  }
   GLIBC_PRIVATE {
     # functions used in other libraries
     __syscall_rt_sigqueueinfo;
diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
index 44ff22ea7d..30e9fbf7e5 100644
--- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2003,2005
+	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
@@ -25,7 +26,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "aio_misc.h"
+#include <aio_misc.h>
 
 #ifdef __NR_rt_sigqueueinfo
 
@@ -52,5 +53,5 @@ __aio_sigqueue (sig, val, caller_pid)
 			 sig, __ptrvalue (&info));
 }
 #else
-# include <sysdeps/generic/aio_sigqueue.c>
+# include <rt/aio_sigqueue.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/alpha/Dist b/sysdeps/unix/sysv/linux/alpha/Dist
deleted file mode 100644
index bba6642b42..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/Dist
+++ /dev/null
@@ -1,19 +0,0 @@
-alpha/ptrace.h
-alpha/regdef.h
-clone.S
-dl-brk.S
-ieee_get_fp_control.S
-ieee_set_fp_control.S
-ioperm.c
-ipc_priv.h
-kernel_sigaction.h
-kernel_stat.h
-kernel_termios.h
-oldglob.c
-rt_sigaction.S
-sizes.h
-sys/acct.h
-sys/io.h
-sys/procfs.h
-sys/user.h
-xstatconv.c
diff --git a/sysdeps/unix/sysv/linux/alpha/Implies b/sysdeps/unix/sysv/linux/alpha/Implies
index 8d91c80097..1616efecbe 100644
--- a/sysdeps/unix/sysv/linux/alpha/Implies
+++ b/sysdeps/unix/sysv/linux/alpha/Implies
@@ -1 +1,4 @@
 unix/sysv/linux/wordsize-64
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile
index 37a9214fe9..f64f23fd7a 100644
--- a/sysdeps/unix/sysv/linux/alpha/Makefile
+++ b/sysdeps/unix/sysv/linux/alpha/Makefile
@@ -26,3 +26,13 @@ endif
 ifeq ($(subdir),signal)
 sysdep_routines += rt_sigaction
 endif
+
+ifeq ($(subdir),math)
+# These 2 routines are normally in libgcc{.a,_s.so.1}.
+# However, alpha -mlong-double-128 libgcc relies on
+# glibc providing _Ots* routines and without these files
+# glibc relies on __multc3/__divtc3 only provided
+# by libgcc if configured with -mlong-double-128.
+# Provide these routines here as well.
+libm-routines += multc3 divtc3
+endif   # math
diff --git a/sysdeps/unix/sysv/linux/alpha/Versions b/sysdeps/unix/sysv/linux/alpha/Versions
index ca79c7e444..8709dd2a38 100644
--- a/sysdeps/unix/sysv/linux/alpha/Versions
+++ b/sysdeps/unix/sysv/linux/alpha/Versions
@@ -73,6 +73,10 @@ libc {
     #errlist-compat	132
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
+  GLIBC_2.4 {
+    #errlist-compat	138
+    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+  }
   GLIBC_PRIVATE {
     __libc_alpha_cache_shape;
   }
diff --git a/sysdeps/unix/sysv/linux/alpha/adjtime.c b/sysdeps/unix/sysv/linux/alpha/adjtime.c
index e206cb4727..1700524d34 100644
--- a/sysdeps/unix/sysv/linux/alpha/adjtime.c
+++ b/sysdeps/unix/sysv/linux/alpha/adjtime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,2004,2006 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
@@ -19,7 +19,7 @@
 #include <shlib-compat.h>
 #include <sysdep.h>
 #include <sys/time.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if !defined __ASSUME_TIMEVAL64 || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
 struct timeval32
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/errno.h b/sysdeps/unix/sysv/linux/alpha/bits/errno.h
index 9cdc167bf7..8b2f152a1c 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/errno.h
@@ -1,5 +1,5 @@
 /* Error constants.  Linux/Alpha specific version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,2002,2005 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
@@ -31,6 +31,12 @@
 #  define ECANCELED	131
 # endif
 
+/* Support for error codes to support robust mutexes was added later, too.  */
+# ifndef EOWNERDEAD
+#  define EOWNERDEAD		136
+#  define ENOTRECOVERABLE	137
+# endif
+
 # ifndef __ASSEMBLER__
 /* Function to get address of global `errno' variable.  */
 extern int *__errno_location (void) __THROW __attribute__ ((__const__));
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
index ce4a5da37f..f17dc2bdc1 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995-1999, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2000, 2004, 2005, 2006 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
@@ -21,8 +21,10 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
@@ -44,9 +46,9 @@
 #define O_ASYNC		020000	/* fcntl, for BSD compatibility */
 
 #ifdef __USE_GNU
-# define O_DIRECT	040000	/* Direct disk access.  */
 # define O_DIRECTORY	0100000	/* Must be a directory.  */
 # define O_NOFOLLOW	0200000	/* Do not follow links.  */
+# define O_DIRECT	02000000 /* Direct disk access.  */
 # define O_NOATIME	04000000 /* Do not set atime.  */
 #endif
 
@@ -92,7 +94,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* for F_[GET|SET]FL */
+/* for F_[GET|SET]FD */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */
@@ -173,10 +175,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/mman.h b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
index bb41887479..2f0e564916 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/Alpha version.
-   Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2003, 2006 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
@@ -86,6 +86,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -95,6 +96,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED   3	/* Will need these pages.  */
 # define MADV_DONTNEED   6	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index 54d6819412..2163745840 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Alpha/Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/shm.h b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
index bbee434ea0..35226c16ce 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
@@ -71,6 +71,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index f26e84c9f6..966ccf94da 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -1,5 +1,5 @@
 /* termios type and macro definitions.  Linux version.
-   Copyright (C) 1993,1994,1995,1996,1997,1999,2003
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2003, 2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -91,34 +91,42 @@ struct termios
 
 #define OFILL	00000100
 #define OFDEL	00000200
-#define NLDLY	00001400
-#define   NL0	00000000
-#define   NL1	00000400
-#define   NL2	00001000
-#define   NL3	00001400
-#define TABDLY	00006000
-#define   TAB0	00000000
-#define   TAB1	00002000
-#define   TAB2	00004000
-#define   TAB3	00006000
-#define CRDLY	00030000
-#define   CR0	00000000
-#define   CR1	00010000
-#define   CR2	00020000
-#define   CR3	00030000
-#define FFDLY	00040000
-#define   FF0	00000000
-#define   FF1	00040000
-#define BSDLY	00100000
-#define   BS0	00000000
-#define   BS1	00100000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY	00001400
+# define   NL0	00000000
+# define   NL1	00000400
+# define   NL2	00001000
+# define   NL3	00001400
+# define TABDLY	00006000
+# define   TAB0	00000000
+# define   TAB1	00002000
+# define   TAB2	00004000
+# define   TAB3	00006000
+# define CRDLY	00030000
+# define   CR0	00000000
+# define   CR1	00010000
+# define   CR2	00020000
+# define   CR3	00030000
+# define FFDLY	00040000
+# define   FF0	00000000
+# define   FF1	00040000
+# define BSDLY	00100000
+# define   BS0	00000000
+# define   BS1	00100000
+#endif
+
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
-#define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+
+#ifdef __USE_MISC
+# define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+#endif
 
 /* c_cflag bit meaning */
-#define CBAUD	0000037
+#ifdef __USE_MISC
+# define CBAUD	0000037
+#endif
 #define  B0	0000000		/* hang up */
 #define  B50	0000001
 #define  B75	0000002
@@ -135,9 +143,11 @@ struct termios
 #define  B9600	0000015
 #define  B19200	0000016
 #define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CBAUDEX 0000000
+#ifdef __USE_MISC
+# define EXTA B19200
+# define EXTB B38400
+# define CBAUDEX 0000000
+#endif
 #define  B57600   00020
 #define  B115200  00021
 #define  B230400  00022
@@ -169,23 +179,30 @@ struct termios
 #define HUPCL	00040000
 
 #define CLOCAL	00100000
-#define CRTSCTS	  020000000000		/* flow control */
+#ifdef __USE_MISC
+# define CMSPAR	  010000000000		/* mark or space (stick) parity */
+# define CRTSCTS  020000000000		/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0x00000080
 #define ICANON	0x00000100
-#define XCASE	0x00004000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE	0x00004000
+#endif
 #define ECHO	0x00000008
 #define ECHOE	0x00000002
 #define ECHOK	0x00000004
 #define ECHONL	0x00000010
 #define NOFLSH	0x80000000
 #define TOSTOP	0x00400000
-#define ECHOCTL	0x00000040
-#define ECHOPRT	0x00000020
-#define ECHOKE	0x00000001
-#define FLUSHO	0x00800000
-#define PENDIN	0x20000000
+#ifdef __USE_MISC
+# define ECHOCTL	0x00000040
+# define ECHOPRT	0x00000020
+# define ECHOKE	0x00000001
+# define FLUSHO	0x00800000
+# define PENDIN	0x20000000
+#endif
 #define IEXTEN	0x00000400
 
 /* Values for the ACTION argument to `tcflow'.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
new file mode 100644
index 0000000000..22fc64109c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
@@ -0,0 +1,30 @@
+/* Copyright (C) 1999, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __WORDSIZE	64
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+/* Signal that we didn't used to have a `long double'. The changes all
+   the `long double' function variants to be redirects to the double
+   functions.  */
+# define __LONG_DOUBLE_MATH_OPTIONAL	1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH		1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/clone.S b/sysdeps/unix/sysv/linux/alpha/clone.S
index 1c450d1737..5e0b21ea15 100644
--- a/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -146,4 +146,4 @@ thread_start:
 
 	.end thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
index a0214b0072..d95e46f6f1 100644
--- a/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c
@@ -1,5 +1,5 @@
-/* Operating system support for run-time dynamic linker.  Linux/PPC version.
-   Copyright (C) 1997, 1998, 2001, 2003 Free Software Foundation, Inc.
+/* Operating system support for run-time dynamic linker.  Linux/Alpha version.
+   Copyright (C) 1997, 1998, 2001, 2003, 2006 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
@@ -17,9 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-
-#include "config.h"
-#include "kernel-features.h"
+#include <config.h>
+#include <kernel-features.h>
 #include <ldsodefs.h>
 
 extern long __libc_alpha_cache_shape[4];
diff --git a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
index 07f055886e..5e63be5cc7 100644
--- a/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
+++ b/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004,2006 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
@@ -19,7 +19,7 @@
 #include <fenv_libc.h>
 #include <sysdep.h>
 #include <float.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include "kernel_sysinfo.h"
 
 
diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
new file mode 100644
index 0000000000..497694619a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/fxstatat.c
@@ -0,0 +1,99 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <xstatconv.h>
+
+#undef __fxstatat64
+
+
+/* Get information about the file NAME in BUF.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+  int result, errno_out;
+  struct kernel_stat kst;
+
+  if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat64, err, 2, file, st);
+      else
+	result = INTERNAL_SYSCALL (stat64, err, 2, file, st);
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	return result;
+      errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+      if (errno_out != ENOSYS)
+	goto fail;
+      __libc_missing_axp_stat64 = 1;
+    }
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst);
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, file, &kst);
+
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat_conv (vers, &kst, st);
+  errno_out = INTERNAL_SYSCALL_ERRNO (result, err);
+
+ fail:
+  __atfct_seterrno (errno_out, fd, buf);
+
+  return -1;
+}
+libc_hidden_def (__fxstatat)
+strong_alias (__fxstatat, __fxstatat64);
+libc_hidden_ver(__fxstatat, __fxstatat64);
diff --git a/sysdeps/unix/sysv/linux/alpha/getcontext.S b/sysdeps/unix/sysv/linux/alpha/getcontext.S
index 3566890cf9..f010f337e6 100644
--- a/sysdeps/unix/sysv/linux/alpha/getcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -41,7 +41,7 @@ ENTRY (__getcontext)
 	ret
 
 END(__getcontext)
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
 
 
 /* An internal routine used by getcontext and setcontext.
@@ -57,6 +57,8 @@ weak_alias(__getcontext, getcontext)
 __getcontext_x:
 	cfi_register (64, 0)
 
+	.set noat
+
 	/* Return value of getcontext.  $0 is the only register
 	   whose value is not preserved. */
 	stq	$31, UC_SIGCTX+SC_REGS($16)
diff --git a/sysdeps/unix/sysv/linux/alpha/getitimer.S b/sysdeps/unix/sysv/linux/alpha/getitimer.S
index c2bc565afc..6644a5c36d 100644
--- a/sysdeps/unix/sysv/linux/alpha/getitimer.S
+++ b/sysdeps/unix/sysv/linux/alpha/getitimer.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 2006 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/getrusage.S b/sysdeps/unix/sysv/linux/alpha/getrusage.S
index 2c34e98ce6..0bca4b5f23 100644
--- a/sysdeps/unix/sysv/linux/alpha/getrusage.S
+++ b/sysdeps/unix/sysv/linux/alpha/getrusage.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 2006 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
@@ -145,5 +145,5 @@ strong_alias(__getrusage_tv64, ____getrusage_tv64)
 default_symbol_version (____getrusage_tv64, __getrusage, GLIBC_2.1)
 default_symbol_version (__getrusage_tv64, getrusage, GLIBC_2.1)
 #else
-weak_alias(__getrusage, getrusage)
+weak_alias (__getrusage, getrusage)
 #endif
diff --git a/sysdeps/unix/sysv/linux/alpha/gettimeofday.S b/sysdeps/unix/sysv/linux/alpha/gettimeofday.S
index 1a6f88b03a..7c9183a4fe 100644
--- a/sysdeps/unix/sysv/linux/alpha/gettimeofday.S
+++ b/sysdeps/unix/sysv/linux/alpha/gettimeofday.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2002, 2003, 2006 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/glob.c b/sysdeps/unix/sysv/linux/alpha/glob.c
index a51020d51f..84573899d6 100644
--- a/sysdeps/unix/sysv/linux/alpha/glob.c
+++ b/sysdeps/unix/sysv/linux/alpha/glob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2002, 2005 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
@@ -35,7 +35,7 @@ extern int __new_glob (const char *__pattern, int __flags,
 		       glob_t *__pglob);
 extern void __new_globfree (glob_t *__pglob);
 
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 
 #undef glob
 #undef globfree
diff --git a/sysdeps/unix/sysv/linux/alpha/msgctl.c b/sysdeps/unix/sysv/linux/alpha/msgctl.c
index 1b75af2b80..a59911fe40 100644
--- a/sysdeps/unix/sysv/linux/alpha/msgctl.c
+++ b/sysdeps/unix/sysv/linux/alpha/msgctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_msqid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h b/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/alpha/oldglob.c b/sysdeps/unix/sysv/linux/alpha/oldglob.c
index 9d39176f6b..6d9b79f2c3 100644
--- a/sysdeps/unix/sysv/linux/alpha/oldglob.c
+++ b/sysdeps/unix/sysv/linux/alpha/oldglob.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2004, 2005 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
@@ -91,6 +91,7 @@ __old_globfree (old_glob_t *pglob)
   /* We only need these two symbols.  */
   correct.gl_pathc = pglob->gl_pathc;
   correct.gl_pathv = pglob->gl_pathv;
+  correct.gl_offs = pglob->gl_offs;
 
   globfree (&correct);
 }
diff --git a/sysdeps/unix/sysv/linux/alpha/select.S b/sysdeps/unix/sysv/linux/alpha/select.S
index 458cda9246..35a81e949f 100644
--- a/sysdeps/unix/sysv/linux/alpha/select.S
+++ b/sysdeps/unix/sysv/linux/alpha/select.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2002,2003,2006 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
@@ -19,7 +19,7 @@
 #include <sysdep-cancel.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
@@ -63,7 +63,7 @@ LEAF(SELECT, 64)
 	ldl	t0, __libc_missing_axp_tv64
 #endif
 
-	/* Save timeout early, since we'll need to recover this after 
+	/* Save timeout early, since we'll need to recover this after
 	   the system call.  */
 	stq	a4, 48(sp)
 
diff --git a/sysdeps/unix/sysv/linux/alpha/semctl.c b/sysdeps/unix/sysv/linux/alpha/semctl.c
index 6925c3f058..9957f983bf 100644
--- a/sysdeps/unix/sysv/linux/alpha/semctl.c
+++ b/sysdeps/unix/sysv/linux/alpha/semctl.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +27,7 @@
 #include <string.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_semid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/alpha/setcontext.S b/sysdeps/unix/sysv/linux/alpha/setcontext.S
index 7d443d41c7..27abfd0c12 100644
--- a/sysdeps/unix/sysv/linux/alpha/setcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/setcontext.S
@@ -32,4 +32,4 @@
 PSEUDO(__setcontext, sigreturn, 1)
 	ret
 PSEUDO_END(__setcontext)
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/setitimer.S b/sysdeps/unix/sysv/linux/alpha/setitimer.S
index 16bbd2227f..59caeac680 100644
--- a/sysdeps/unix/sysv/linux/alpha/setitimer.S
+++ b/sysdeps/unix/sysv/linux/alpha/setitimer.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 2006 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/settimeofday.S b/sysdeps/unix/sysv/linux/alpha/settimeofday.S
index b49c770a0a..e39eadc208 100644
--- a/sysdeps/unix/sysv/linux/alpha/settimeofday.S
+++ b/sysdeps/unix/sysv/linux/alpha/settimeofday.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 2006 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/shmctl.c b/sysdeps/unix/sysv/linux/alpha/shmctl.c
index 4a9d9445ef..e63211fa00 100644
--- a/sysdeps/unix/sysv/linux/alpha/shmctl.c
+++ b/sysdeps/unix/sysv/linux/alpha/shmctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -27,7 +27,7 @@
 #include <bits/wordsize.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_shmid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/alpha/sigaction.c b/sysdeps/unix/sysv/linux/alpha/sigaction.c
index 21a2063c30..26b081d9a3 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigaction.c
+++ b/sysdeps/unix/sysv/linux/alpha/sigaction.c
@@ -17,6 +17,8 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <sys/cdefs.h>
+#include <stddef.h>
 
 /*
  * In order to get the hidden arguments for rt_sigaction set up
diff --git a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
index e5de55faeb..48c3f271c7 100644
--- a/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
+++ b/sysdeps/unix/sysv/linux/alpha/sigsuspend.S
@@ -29,5 +29,5 @@ PSEUDO(__sigsuspend, sigsuspend, 1)
 	ret
 PSEUDO_END(__sigsuspend)
 libc_hidden_def (__sigsuspend)
-weak_alias(__sigsuspend, sigsuspend)
+weak_alias (__sigsuspend, sigsuspend)
 strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/alpha/swapcontext.S b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
index 5f6615e0b6..1221f67f78 100644
--- a/sysdeps/unix/sysv/linux/alpha/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/alpha/swapcontext.S
@@ -48,4 +48,4 @@ ENTRY(__swapcontext)
 #endif
 
 END(__swapcontext)
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscall.S b/sysdeps/unix/sysv/linux/alpha/syscall.S
index 10a32d5dc8..0c4081363a 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscall.S
+++ b/sysdeps/unix/sysv/linux/alpha/syscall.S
@@ -74,4 +74,4 @@ $error:
 
 END(__syscall)
 
-weak_alias(__syscall, syscall)
+weak_alias (__syscall, syscall)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 3bbce1c6fd..7b3f233566 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -16,7 +16,6 @@ oldsemctl	EXTRA	semctl		i:iiii	__old_semctl	semctl@GLIBC_2.0
 sigstack	-	sigstack	2	sigstack
 vfork		-	vfork		0	__vfork		vfork
 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 open		-	open		Ci:siv	__libc_open	__open open !__libc_open64 __open64 open64
 open64		open	-
diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h
index c3de78f4bb..a22da71d60 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysdep.h
+++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h
@@ -22,10 +22,8 @@
 #define _LINUX_ALPHA_SYSDEP_H 1
 
 #ifdef __ASSEMBLER__
-
 #include <asm/pal.h>
 #include <alpha/regdef.h>
-
 #endif
 
 /* There is some commonality.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/utimes.S b/sysdeps/unix/sysv/linux/alpha/utimes.S
index c210e1d12f..0dd0a9372b 100644
--- a/sysdeps/unix/sysv/linux/alpha/utimes.S
+++ b/sysdeps/unix/sysv/linux/alpha/utimes.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 2006 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/wait4.S b/sysdeps/unix/sysv/linux/alpha/wait4.S
index 8d89e3d46e..634993deb8 100644
--- a/sysdeps/unix/sysv/linux/alpha/wait4.S
+++ b/sysdeps/unix/sysv/linux/alpha/wait4.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2003, 2006 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
@@ -19,7 +19,7 @@
 #include <sysdep.h>
 #define _ERRNO_H        1
 #include <bits/errno.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 .text
 
diff --git a/sysdeps/unix/sysv/linux/alpha/wordexp.c b/sysdeps/unix/sysv/linux/alpha/wordexp.c
index 1921a03388..c2972e40c2 100644
--- a/sysdeps/unix/sysv/linux/alpha/wordexp.c
+++ b/sysdeps/unix/sysv/linux/alpha/wordexp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2004, 2005 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
@@ -22,7 +22,7 @@
 #define wordexp(words, pwordexp, flags) \
   __new_wordexp (words, pwordexp, flags)
 
-#include <sysdeps/generic/wordexp.c>
+#include <posix/wordexp.c>
 
 versioned_symbol (libc, __new_wordexp, wordexp, GLIBC_2_2_2);
 
diff --git a/sysdeps/unix/sysv/linux/alpha/xstatconv.h b/sysdeps/unix/sysv/linux/alpha/xstatconv.h
index 846bb02994..094d11e5c9 100644
--- a/sysdeps/unix/sysv/linux/alpha/xstatconv.h
+++ b/sysdeps/unix/sysv/linux/alpha/xstatconv.h
@@ -1,5 +1,5 @@
 /* Convert between the kernel's `struct stat' format, and libc's.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 extern int __libc_missing_axp_stat64 attribute_hidden;
 extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
diff --git a/sysdeps/unix/sysv/linux/arm/Dist b/sysdeps/unix/sysv/linux/arm/Dist
deleted file mode 100644
index aa9eb1a227..0000000000
--- a/sysdeps/unix/sysv/linux/arm/Dist
+++ /dev/null
@@ -1,14 +0,0 @@
-clone.S
-dl-procinfo.h
-ioperm.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sigrestorer.S
-bits/armsigctx.h
-sys/elf.h
-sys/io.h
-sys/procfs.h
-sys/user.h
-oldgetrlimit64.c
diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile
deleted file mode 100644
index 0ccdbe81f6..0000000000
--- a/sysdeps/unix/sysv/linux/arm/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-ifeq ($(subdir),misc)
-sysdep_routines += ioperm
-sysdep_headers += sys/elf.h sys/io.h
-endif
-
-ifeq ($(subdir),signal)
-sysdep_routines += sigrestorer
-endif
-
-ifeq ($(subdir),resource)
-sysdep_routines += oldgetrlimit64
-endif
diff --git a/sysdeps/unix/sysv/linux/arm/Versions b/sysdeps/unix/sysv/linux/arm/Versions
deleted file mode 100644
index 2ddb2af2b7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/Versions
+++ /dev/null
@@ -1,37 +0,0 @@
-libc {
-  GLIBC_2.0 {
-    # Exception handling support functions from libgcc
-    __register_frame; __register_frame_table; __deregister_frame;
-    __frame_state_for; __register_frame_info_table;
-  }
-  GLIBC_2.1 {
-    ioperm; iopl;
-    inb; inw; inl;
-    outb; outw; outl;
-  }
-  GLIBC_2.2 {
-    # functions used in other libraries
-    __xstat64; __fxstat64; __lxstat64;
-
-    # a*
-    alphasort64;
-
-    # g*
-    glob64;
-
-    # New rlimit interface
-    getrlimit; setrlimit; getrlimit64;
-
-    # r*
-    readdir64; readdir64_r;
-
-    # s*
-    scandir64;
-
-    # v*
-    versionsort64;
-  }
-  GLIBC_2.3.3 {
-    posix_fadvise64; posix_fallocate64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/arm/alphasort64.c b/sysdeps/unix/sysv/linux/arm/alphasort64.c
deleted file mode 100644
index 0b5ae47d2f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/alphasort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/alphasort64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
deleted file mode 100644
index 4530cdbda9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Definition of `struct sigcontext' for Linux/ARM
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* The format of struct sigcontext changed between 2.0 and 2.1 kernels.
-   Fortunately 2.0 puts a magic number in the first word and this is not
-   a legal value for `trap_no', so we can tell them apart.  */
-
-/* Early 2.2 and 2.3 kernels do not have the `fault_address' member in
-   the sigcontext structure.  Unfortunately there is no reliable way
-   to test for its presence and this word will contain garbage for too-old
-   kernels.  Versions 2.2.14 and 2.3.35 (plus later versions) are known to
-   include this element.  */
-
-#ifndef __ARMSIGCTX_H
-#define __ARMSIGCTX_H	1
-
-#include <asm/ptrace.h>
-
-union k_sigcontext
-  {
-    struct
-      {
-	unsigned long int trap_no;
-	unsigned long int error_code;
-	unsigned long int oldmask;
-	unsigned long int arm_r0;
-	unsigned long int arm_r1;
-	unsigned long int arm_r2;
-	unsigned long int arm_r3;
-	unsigned long int arm_r4;
-	unsigned long int arm_r5;
-	unsigned long int arm_r6;
-	unsigned long int arm_r7;
-	unsigned long int arm_r8;
-	unsigned long int arm_r9;
-	unsigned long int arm_r10;
-	unsigned long int arm_fp;
-	unsigned long int arm_ip;
-	unsigned long int arm_sp;
-	unsigned long int arm_lr;
-	unsigned long int arm_pc;
-	unsigned long int arm_cpsr;
-	unsigned long fault_address;
-      } v21;
-    struct
-      {
-	unsigned long int magic;
-	struct pt_regs reg;
-	unsigned long int trap_no;
-	unsigned long int error_code;
-	unsigned long int oldmask;
-      } v20;
-};
-
-#define SIGCONTEXT_2_0_MAGIC	0x4B534154
-
-#endif	/* bits/armsigctx.h */
diff --git a/sysdeps/unix/sysv/linux/arm/bits/fcntl.h b/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
deleted file mode 100644
index 3574e750ff..0000000000
--- a/sysdeps/unix/sysv/linux/arm/bits/fcntl.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995-1998, 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	  0003
-#define O_RDONLY	    00
-#define O_WRONLY	    01
-#define O_RDWR		    02
-#define O_CREAT		  0100	/* not fcntl */
-#define O_EXCL		  0200	/* not fcntl */
-#define O_NOCTTY	  0400	/* not fcntl */
-#define O_TRUNC		 01000	/* not fcntl */
-#define O_APPEND	 02000
-#define O_NONBLOCK	 04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		010000
-#define O_FSYNC		O_SYNC
-#define O_ASYNC		020000
-
-#ifdef __USE_GNU
-# define O_DIRECTORY	040000	/* Must be a directory.	 */
-# define O_NOFOLLOW	0100000	/* Do not follow links.	 */
-# define O_DIRECT	0200000	/* Direct disk access.	*/
-# define O_NOATIME	01000000 /* Do not set atime.  */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0400000
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
-   We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.	*/
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	5	/* Get record locking info.  */
-# define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).	*/
-#else
-# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
-# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-#define F_GETLK64	12	/* Get record locking info.  */
-#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
-# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	10	/* Set number of signal to be sent.  */
-# define F_GETSIG	11	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE	1024	/* Set a lease.	 */
-# define F_GETLEASE	1025	/* Enquire what lease is active.  */
-# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
-#endif
-
-/* For F_[GET|SET]FL.  */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.	*/
-#define F_UNLCK		2	/* Remove lock.	 */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND	32	/* This is a mandatory flock:	*/
-# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
-# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
-# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS	0x00000001	/* File accessed.  */
-# define DN_MODIFY	0x00000002	/* File modified.  */
-# define DN_CREATE	0x00000004	/* File created.  */
-# define DN_DELETE	0x00000008	/* File removed.  */
-# define DN_RENAME	0x00000010	/* File renamed.  */
-# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
-# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
-#endif
-
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
-
-__BEGIN_DECLS
-
-/* Provide kernel hint to read ahead.  */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-    __THROW;
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/arm/bits/mman.h b/sysdeps/unix/sysv/linux/arm/bits/mman.h
deleted file mode 100644
index 4ec6839685..0000000000
--- a/sysdeps/unix/sysv/linux/arm/bits/mman.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/ARM version.
-   Copyright (C) 1997, 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MMAN_H
-# error "Never include this file directly.  Use <sys/mman.h> instead"
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ	0x1		/* Page can be read.  */
-#define PROT_WRITE	0x2		/* Page can be written.  */
-#define PROT_EXEC	0x4		/* Page can be executed.  */
-#define PROT_NONE	0x0		/* Page can not be accessed.  */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define MAP_SHARED	0x01		/* Share changes.  */
-#define MAP_PRIVATE	0x02		/* Changes are private.  */
-#ifdef __USE_MISC
-# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
-#endif
-
-/* Other flags.  */
-#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
-#ifdef __USE_MISC
-# define MAP_FILE	0
-# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
-# define MAP_ANON	MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	1		/* Sync memory asynchronously.  */
-#define MS_SYNC		4		/* Synchronous memory sync.  */
-#define MS_INVALIDATE	2		/* Invalidate the caches.  */
-
-/* Flags for `mlockall'.  */
-#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	2		/* Lock all additions to address
-					   space.  */
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE	1
-#endif
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-# define MADV_NORMAL	 0	/* No further special treatment.  */
-# define MADV_RANDOM	 1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	 3	/* Will need these pages.  */
-# define MADV_DONTNEED	 4	/* Don't need these pages.  */
-#endif
-
-/* The POSIX people had to invent similar names for the same things.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/brk.c b/sysdeps/unix/sysv/linux/arm/brk.c
deleted file mode 100644
index 153d89358a..0000000000
--- a/sysdeps/unix/sysv/linux/arm/brk.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* brk system call for Linux/ARM.
-   Copyright (C) 1995, 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  asm ("mov a1, %1\n"	/* save the argment in r0 */
-       "swi %2\n"	/* do the system call */
-       "mov %0, a1;"	/* keep the return value */
-       : "=r"(newbrk) 
-       : "r"(addr), "i" (SYS_ify (brk))
-       : "a1");
-
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/arm/chown.c b/sysdeps/unix/sysv/linux/arm/chown.c
deleted file mode 100644
index 1961622564..0000000000
--- a/sysdeps/unix/sysv/linux/arm/chown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/m68k/chown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/clone.S b/sysdeps/unix/sysv/linux/arm/clone.S
deleted file mode 100644
index bf07fb3952..0000000000
--- a/sysdeps/unix/sysv/linux/arm/clone.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Pat Beirne <patb@corelcomputer.com>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-
-        .text
-ENTRY(__clone)
-	@ sanity check args
-	cmp	r0, #0
-	cmpne	r1, #0
-	moveq	r0, #-EINVAL
-	beq	PLTJMP(syscall_error)
-
-	@ insert the args onto the new stack
-	str	r3, [r1, #-4]!
-	str	r0, [r1, #-4]!
-
-	@ do the system call
-	@ get flags
-	mov	r0, r2
-	@ new sp is already in r1
-	swi	SYS_ify(clone)
-	movs	a1, a1
-	blt	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-	RETINSTR(ne, lr)
-
-	@ pick the function arg and call address off the stack and execute
-	ldr	r0, [sp, #4]
-	mov	lr, pc
-	ldr 	pc, [sp]
-
-	@ and we are done, passing the return value through r0
-	b	PLTJMP(_exit)
-
-PSEUDO_END (__clone)
-
-weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.c b/sysdeps/unix/sysv/linux/arm/dl-procinfo.c
deleted file mode 100644
index 9b87a2003d..0000000000
--- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Data for Linux/ARM version of processor capability information.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 2001.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This information must be kept in sync with the _DL_HWCAP_COUNT and
-   _DL_PLATFORM_COUNT definitions in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions ar equite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_arm_cap_flags
-#else
-PROCINFO_CLASS const char _dl_arm_cap_flags[8][10]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "swp", "half", "thumb", "26bit", "fast-mult", "fpa", "vfp", "edsp",
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h b/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
deleted file mode 100644
index 35b333479b..0000000000
--- a/sysdeps/unix/sysv/linux/arm/dl-procinfo.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Linux/ARM version of processor capability information handling macros.
-   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 2001.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _DL_PROCINFO_H
-#define _DL_PROCINFO_H	1
-
-#include <ldsodefs.h>
-
-#define _DL_HWCAP_COUNT 8
-
-/* The kernel provides platform data but it is not interesting.  */
-#define _DL_HWCAP_PLATFORM 	0
-
-
-static inline int
-__attribute__ ((unused))
-_dl_procinfo (int word)
-{
-  int i;
-
-  _dl_printf ("AT_HWCAP:   ");
-
-  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
-    if (word & (1 << i))
-      _dl_printf (" %s", GLRO(dl_arm_cap_flags)[i]);
-
-  _dl_printf ("\n");
-
-  return 0;
-}
-
-static inline const char *
-__attribute__ ((unused))
-_dl_hwcap_string (int idx)
-{
-  return GLRO(dl_arm_cap_flags)[idx];
-};
-
-enum
-{
-  HWCAP_ARM_SWP	      = 1 << 0,
-  HWCAP_ARM_HALF      = 1 << 1,
-  HWCAP_ARM_THUMB     = 1 << 2,
-  HWCAP_ARM_26BIT     = 1 << 3,
-  HWCAP_ARM_FAST_MULT = 1 << 4,
-  HWCAP_ARM_FPA       = 1 << 5,
-  HWCAP_ARM_VFP       = 1 << 6,
-  HWCAP_ARM_EDSP      = 1 << 7,
-
-  HWCAP_IMPORTANT = (HWCAP_ARM_HALF | HWCAP_ARM_FAST_MULT)
-};
-
-static inline int
-__attribute__ ((unused))
-_dl_string_hwcap (const char *str)
-{
-  int i;
-
-  for (i = 0; i < _DL_HWCAP_COUNT; i++)
-    {
-      if (strcmp (str, GLRO(dl_arm_cap_flags)[i]) == 0)
-	return i;
-    }
-  return -1;
-};
-
-#define _dl_string_platform(str) (-1)
-
-#endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/arm/fchown.c b/sysdeps/unix/sysv/linux/arm/fchown.c
deleted file mode 100644
index 3a69ecc9e7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/fchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/fcntl.c b/sysdeps/unix/sysv/linux/arm/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/fxstat.c b/sysdeps/unix/sysv/linux/arm/fxstat.c
deleted file mode 100644
index 4f219f0b9d..0000000000
--- a/sysdeps/unix/sysv/linux/arm/fxstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getdents64.c b/sysdeps/unix/sysv/linux/arm/getdents64.c
deleted file mode 100644
index 0c75fb5a06..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getdents64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getegid.c b/sysdeps/unix/sysv/linux/arm/getegid.c
deleted file mode 100644
index 37b4b4a530..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/geteuid.c b/sysdeps/unix/sysv/linux/arm/geteuid.c
deleted file mode 100644
index ebcb555b5e..0000000000
--- a/sysdeps/unix/sysv/linux/arm/geteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getgid.c b/sysdeps/unix/sysv/linux/arm/getgid.c
deleted file mode 100644
index 0a4d6061f0..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getgroups.c b/sysdeps/unix/sysv/linux/arm/getgroups.c
deleted file mode 100644
index 102ea24e14..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getresgid.c b/sysdeps/unix/sysv/linux/arm/getresgid.c
deleted file mode 100644
index b703a414cc..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getresuid.c b/sysdeps/unix/sysv/linux/arm/getresuid.c
deleted file mode 100644
index 0b14cefe34..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getrlimit.c b/sysdeps/unix/sysv/linux/arm/getrlimit.c
deleted file mode 100644
index fc06dbd641..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getrlimit64.c b/sysdeps/unix/sysv/linux/arm/getrlimit64.c
deleted file mode 100644
index fef018f471..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/getuid.c b/sysdeps/unix/sysv/linux/arm/getuid.c
deleted file mode 100644
index d682c79a49..0000000000
--- a/sysdeps/unix/sysv/linux/arm/getuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/glob64.c b/sysdeps/unix/sysv/linux/arm/glob64.c
deleted file mode 100644
index 82a9a296a7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/glob64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/glob64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/ioperm.c b/sysdeps/unix/sysv/linux/arm/ioperm.c
deleted file mode 100644
index 558b485b61..0000000000
--- a/sysdeps/unix/sysv/linux/arm/ioperm.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Phil Blundell, based on the Alpha version by
-   David Mosberger.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* I/O port access on the ARM is something of a fiction.  What we do is to
-   map an appropriate area of /dev/mem into user space so that a program
-   can blast away at the hardware in such a way as to generate I/O cycles
-   on the bus.  To insulate user code from dependencies on particular
-   hardware we don't allow calls to inb() and friends to be inlined, but
-   force them to come through code in here every time.  Performance-critical
-   registers tend to be memory mapped these days so this should be no big
-   problem.  */
-
-/* Once upon a time this file used mprotect to enable and disable
-   access to particular areas of I/O space.  Unfortunately the
-   mprotect syscall also has the side effect of enabling caching for
-   the area affected (this is a kernel limitation).  So we now just
-   enable all the ports all of the time.  */
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <asm/page.h>
-#include <sys/sysctl.h>
-
-#define PATH_ARM_SYSTYPE	"/etc/arm_systype"
-#define PATH_CPUINFO		"/proc/cpuinfo"
-
-#define MAX_PORT	0x10000
-
-static struct {
-  unsigned long int	base;
-  unsigned long int	io_base;
-  unsigned int		shift;
-  unsigned int		initdone;	/* since all the above could be 0 */
-} io;
-
-#define IO_BASE_FOOTBRIDGE	0x7c000000
-#define IO_SHIFT_FOOTBRIDGE	0
-
-static struct platform {
-  const char		*name;
-  unsigned long int	io_base;
-  unsigned int		shift;
-} platform[] = {
-  /* All currently supported platforms are in fact the same. :-)  */
-  {"Chalice-CATS",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-  {"DEC-EBSA285",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-  {"Corel-NetWinder",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-  {"Rebel-NetWinder",	IO_BASE_FOOTBRIDGE,	IO_SHIFT_FOOTBRIDGE},
-};
-
-#define IO_ADDR(port)	(io.base + ((port) << io.shift))
-
-/*
- * Initialize I/O system.  There are several ways to get the information
- * we need.  Each is tried in turn until one succeeds.
- *
- * 1. Sysctl (CTL_BUS, BUS_ISA, ISA_*).  This is the preferred method
- *    but not all kernels support it.
- *
- * 2. Read the value (not the contents) of symlink PATH_ARM_SYSTYPE.
- *    - If it matches one of the entries in the table above, use the
- *      corresponding values.
- *    - If it begins with a number, assume this is a previously
- *      unsupported system and the values encode, in order,
- *      "<io_base>,<port_shift>".
- *
- * 3. Lookup the "system type" field in /proc/cpuinfo.  Again, if it
- *    matches an entry in the platform[] table, use the corresponding
- *    values.
- */
-
-static int
-init_iosys (void)
-{
-  char systype[256];
-  int i, n;
-  static int iobase_name[] = { CTL_BUS, BUS_ISA, BUS_ISA_PORT_BASE };
-  static int ioshift_name[] = { CTL_BUS, BUS_ISA, BUS_ISA_PORT_SHIFT };
-  size_t len = sizeof(io.base);
-
-  if (! sysctl (iobase_name, 3, &io.io_base, &len, NULL, 0)
-      && ! sysctl (ioshift_name, 3, &io.shift, &len, NULL, 0))
-    {
-      io.initdone = 1;
-      return 0;
-    }
-
-  n = readlink (PATH_ARM_SYSTYPE, systype, sizeof (systype) - 1);
-  if (n > 0)
-    {
-      systype[n] = '\0';
-      if (isdigit (systype[0]))
-	{
-	  if (sscanf (systype, "%li,%i", &io.io_base, &io.shift) == 2)
-	    {
-	      io.initdone = 1;
-	      return 0;
-	    }
-	  /* else we're likely going to fail with the system match below */
-	}
-    }
-  else
-    {
-      FILE * fp;
-
-      fp = fopen (PATH_CPUINFO, "r");
-      if (! fp)
-	return -1;
-      while ((n = fscanf (fp, "Hardware\t: %256[^\n]\n", systype))
-	     != EOF)
-	{
-	  if (n == 1)
-	    break;
-	  else
-	    fgets (systype, 256, fp);
-	}
-      fclose (fp);
-
-      if (n == EOF)
-	{
-	  /* this can happen if the format of /proc/cpuinfo changes...  */
-	  fprintf (stderr,
-		   "ioperm: Unable to determine system type.\n"
-		   "\t(May need " PATH_ARM_SYSTYPE " symlink?)\n");
-	  __set_errno (ENODEV);
-	  return -1;
-	}
-    }
-
-  /* translate systype name into i/o system: */
-  for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i)
-    {
-      if (strcmp (platform[i].name, systype) == 0)
-	{
-	  io.shift = platform[i].shift;
-	  io.io_base = platform[i].io_base;
-	  io.initdone = 1;
-	  return 0;
-	}
-    }
-
-  /* systype is not a known platform name... */
-  __set_errno (ENODEV);
-  return -1;
-}
-
-int
-_ioperm (unsigned long int from, unsigned long int num, int turn_on)
-{
-  if (! io.initdone && init_iosys () < 0)
-    return -1;
-
-  /* this test isn't as silly as it may look like; consider overflows! */
-  if (from >= MAX_PORT || from + num > MAX_PORT)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  if (turn_on)
-    {
-      if (! io.base)
-	{
-	  int fd;
-
-	  fd = open ("/dev/mem", O_RDWR);
-	  if (fd < 0)
-	    return -1;
-
-	  io.base =
-	    (unsigned long int) __mmap (0, MAX_PORT << io.shift,
-					PROT_READ | PROT_WRITE,
-					MAP_SHARED, fd, io.io_base);
-	  close (fd);
-	  if ((long) io.base == -1)
-	    return -1;
-	}
-    }
-
-  return 0;
-}
-
-
-int
-_iopl (unsigned int level)
-{
-    if (level > 3)
-      {
-	__set_errno (EINVAL);
-	return -1;
-      }
-    if (level)
-      {
-	return _ioperm (0, MAX_PORT, 1);
-      }
-    return 0;
-}
-
-
-void
-_outb (unsigned char b, unsigned long int port)
-{
-  *((volatile unsigned char *)(IO_ADDR (port))) = b;
-}
-
-
-void
-_outw (unsigned short b, unsigned long int port)
-{
-  *((volatile unsigned short *)(IO_ADDR (port))) = b;
-}
-
-
-void
-_outl (unsigned int b, unsigned long int port)
-{
-  *((volatile unsigned long *)(IO_ADDR (port))) = b;
-}
-
-
-unsigned int
-_inb (unsigned long int port)
-{
-  return *((volatile unsigned char *)(IO_ADDR (port)));
-}
-
-
-unsigned int
-_inw (unsigned long int port)
-{
-  return *((volatile unsigned short *)(IO_ADDR (port)));
-}
-
-
-unsigned int
-_inl (unsigned long int port)
-{
-  return *((volatile unsigned long *)(IO_ADDR (port)));
-}
-
-weak_alias (_ioperm, ioperm);
-weak_alias (_iopl, iopl);
-weak_alias (_inb, inb);
-weak_alias (_inw, inw);
-weak_alias (_inl, inl);
-weak_alias (_outb, outb);
-weak_alias (_outw, outw);
-weak_alias (_outl, outl);
diff --git a/sysdeps/unix/sysv/linux/arm/lchown.c b/sysdeps/unix/sysv/linux/arm/lchown.c
deleted file mode 100644
index c89de99ba2..0000000000
--- a/sysdeps/unix/sysv/linux/arm/lchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/arm/lockf64.c b/sysdeps/unix/sysv/linux/arm/lockf64.c
deleted file mode 100644
index a88f5a784a..0000000000
--- a/sysdeps/unix/sysv/linux/arm/lockf64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/lxstat.c b/sysdeps/unix/sysv/linux/arm/lxstat.c
deleted file mode 100644
index 2371cd9719..0000000000
--- a/sysdeps/unix/sysv/linux/arm/lxstat.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
-
diff --git a/sysdeps/unix/sysv/linux/arm/mmap.S b/sysdeps/unix/sysv/linux/arm/mmap.S
deleted file mode 100644
index cf6f253378..0000000000
--- a/sysdeps/unix/sysv/linux/arm/mmap.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 1998, 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <kernel-features.h>
-
-#define	EINVAL		22
-
-	.text
-
-ENTRY (__mmap)
-# ifdef __ASSUME_MMAP2_SYSCALL
-	/* This code is actually a couple of cycles slower than the
-	   sys_mmap version below, so it might seem like a loss.  But the
-	   code path inside the kernel is sufficiently much shorter to
-	   make it a net gain to use mmap2 when it's known to be
-	   available.  */
-
-	/* shuffle args */
-	str	r5, [sp, #-4]!
-	ldr	r5, [sp, #8]
-	str	r4, [sp, #-4]!
-	ldr	r4, [sp, #8]
-
-	/* convert offset to pages */
-	movs	ip, r5, lsl #20
-	bne	.Linval
-	mov	r5, r5, lsr #12
-	
-	/* do the syscall */
-	swi	SYS_ify (mmap2)
-
-	/* restore registers */
-2:
-	ldr	r4, [sp], #4
-	ldr	r5, [sp], #4
-
-	cmn	r0, $4096
-	RETINSTR(cc, lr)
-	b	PLTJMP(syscall_error)
-
-.Linval:
-	mov	r0, #-EINVAL
-	b	2b
-# else
-	/* Because we can only get five args through the syscall interface, and
-	   mmap() takes six, we need to build a parameter block and pass its
-	   address instead.  The 386 port does a similar trick.  */
-
-	/* This code previously moved sp into ip and stored the args using
-	   stmdb ip!, {a1-a4}.  It did not modify sp, so the stack never had
-	   to be restored after the syscall completed.  It saved an
-	   instruction and meant no stack cleanup work was required.
-
-	   This will not work in the case of a mmap call being interrupted
-	   by a signal.  If the signal handler uses any stack the arguments
-	   to mmap will be trashed.  The results of a restart of mmap are
-	   then unpredictable. */
-
-	/* store args on the stack */
-	stmdb	sp!, {a1-a4}
-
-	/* do the syscall */
-	mov	a1, sp
-	swi	SYS_ify (mmap)
-
-	/* pop args off the stack. */
-	add	sp, sp, #16
-
-	cmn	r0, $4096
-	RETINSTR(cc, lr)
-	b	PLTJMP(syscall_error);
-#endif
-
-PSEUDO_END (__mmap)
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/arm/mmap64.S b/sysdeps/unix/sysv/linux/arm/mmap64.S
deleted file mode 100644
index b4b712c2f2..0000000000
--- a/sysdeps/unix/sysv/linux/arm/mmap64.S
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (C) 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#define	EINVAL		22
-#define	ENOSYS		38
-
-#include "kernel-features.h"
-
-	/* The mmap2 system call takes six arguments, all in registers.  */
-	.text
-ENTRY (__mmap64)
-#ifdef __NR_mmap2
-	ldr	ip, [sp, $4]		@ offset low part
-	str	r5, [sp, #-4]!
-	ldr	r5, [sp, $12]		@ offset high part
-	str	r4, [sp, #-4]!
-	movs	r4, ip, lsl $20		@ check that offset is page-aligned
-	mov	ip, ip, lsr $12
-	moveqs	r4, r5, lsr $12		@ check for overflow
-	bne	.Linval
-	ldr	r4, [sp, $8]		@ load fd
-	orr	r5, ip, r5, lsl $20	@ compose page offset
-	mov	ip, r0
-	swi	SYS_ify (mmap2)
-	cmn	r0, $4096
-# ifdef __ASSUME_MMAP2_SYSCALL
-	ldr	r4, [sp], #4
-	ldr	r5, [sp], #4
-	RETINSTR(cc, lr)	
-	b	PLTJMP(syscall_error)
-# else
-	ldrcc	r4, [sp], #4
-	ldrcc	r5, [sp], #4
-	RETINSTR(cc, lr)
-	cmn	r0, $ENOSYS
-	bne	.Lerror
-	/* The current kernel does not support mmap2.  Fall back to plain
-	   mmap if the offset is small enough.  */
-	ldr	r5, [sp, $16]
-	mov	r0, ip			@ first arg was clobbered
-	teq	r5, $0
-	ldreq	r4, [sp], #4
-	ldreq	r5, [sp], #4
-	beq	PLTJMP(__mmap)
-# endif
-.Linval:
-	mov	r0, $-EINVAL
-.Lerror:
-	ldr	r4, [sp], #4
-	ldr	r5, [sp], #4
-	b	PLTJMP(syscall_error)
-#else
-	/* The kernel headers do not support mmap2.  Fall back to plain
-	   mmap if the offset is small enough.  */
-	ldr	ip, [sp, $8]
-	teq	ip, $0
-	beq	PLTJMP(__mmap)
-	mov	r0, $-EINVAL
-	b	PLTJMP(syscall_error)
-#endif
-PSEUDO_END (__mmap64)
-
-weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/unix/sysv/linux/arm/msgctl.c b/sysdeps/unix/sysv/linux/arm/msgctl.c
deleted file mode 100644
index 9f9b8431a3..0000000000
--- a/sysdeps/unix/sysv/linux/arm/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c
deleted file mode 100644
index 4c27e957bf..0000000000
--- a/sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/profil-counter.h b/sysdeps/unix/sysv/linux/arm/profil-counter.h
deleted file mode 100644
index 7639883f10..0000000000
--- a/sysdeps/unix/sysv/linux/arm/profil-counter.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Low-level statistical profiling support function.  Linux/ARM version.
-   Copyright (C) 1996, 1997, 1998, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include <bits/armsigctx.h>
-
-void
-profil_counter (int signo, int _a2, int _a3, int _a4, union k_sigcontext sc)
-{
-  void *pc;
-  if (sc.v20.magic == SIGCONTEXT_2_0_MAGIC)
-    pc = (void *) sc.v20.reg.ARM_pc;
-  else
-    pc = (void *) sc.v21.arm_pc;
-  profil_count (pc);
-
-  /* This is a hack to prevent the compiler from implementing the
-     above function call as a sibcall.  The sibcall would overwrite
-     the signal context.  */
-  asm volatile ("");
-}
diff --git a/sysdeps/unix/sysv/linux/arm/readdir64.c b/sysdeps/unix/sysv/linux/arm/readdir64.c
deleted file mode 100644
index 2ea26dd409..0000000000
--- a/sysdeps/unix/sysv/linux/arm/readdir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/readdir64_r.c b/sysdeps/unix/sysv/linux/arm/readdir64_r.c
deleted file mode 100644
index 9f54f897e3..0000000000
--- a/sysdeps/unix/sysv/linux/arm/readdir64_r.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h
deleted file mode 100644
index 2baccb2cb7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/register-dump.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Dump registers.
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <pb@nexus.co.uk>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/uio.h>
-#include <stdio-common/_itoa.h>
-#include <bits/armsigctx.h>
-
-/* We will print the register dump in this format:
-
- R0: XXXXXXXX   R1: XXXXXXXX   R2: XXXXXXXX   R3: XXXXXXXX
- R4: XXXXXXXX   R5: XXXXXXXX   R6: XXXXXXXX   R7: XXXXXXXX
- R8: XXXXXXXX   R9: XXXXXXXX   SL: XXXXXXXX   FP: XXXXXXXX
- IP: XXXXXXXX   SP: XXXXXXXX   LR: XXXXXXXX   PC: XXXXXXXX
-
- CPSR: XXXXXXXX
-
- Trap: XXXXXXXX   Error: XXXXXXXX   OldMask: XXXXXXXX
- Addr: XXXXXXXX
-
- */
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
-  char *cp = _itoa_word (value, buf + len, 16, 0);
-  while (cp > buf)
-    *--cp = '0';
-}
-
-static void
-register_dump (int fd, union k_sigcontext *ctx)
-{
-  char regs[21][8];
-  struct iovec iov[97];
-  size_t nr = 0;
-
-#define ADD_STRING(str) \
-  iov[nr].iov_base = (char *) str;					      \
-  iov[nr].iov_len = strlen (str);					      \
-  ++nr
-#define ADD_MEM(str, len) \
-  iov[nr].iov_base = str;						      \
-  iov[nr].iov_len = len;						      \
-  ++nr
-
-  /* Generate strings of register contents.  */
-  if (ctx->v20.magic == SIGCONTEXT_2_0_MAGIC)
-    {
-      hexvalue (ctx->v20.reg.ARM_r0, regs[0], 8);
-      hexvalue (ctx->v20.reg.ARM_r1, regs[1], 8);
-      hexvalue (ctx->v20.reg.ARM_r2, regs[2], 8);
-      hexvalue (ctx->v20.reg.ARM_r3, regs[3], 8);
-      hexvalue (ctx->v20.reg.ARM_r4, regs[4], 8);
-      hexvalue (ctx->v20.reg.ARM_r5, regs[5], 8);
-      hexvalue (ctx->v20.reg.ARM_r6, regs[6], 8);
-      hexvalue (ctx->v20.reg.ARM_r7, regs[7], 8);
-      hexvalue (ctx->v20.reg.ARM_r8, regs[8], 8);
-      hexvalue (ctx->v20.reg.ARM_r9, regs[9], 8);
-      hexvalue (ctx->v20.reg.ARM_r10, regs[10], 8);
-      hexvalue (ctx->v20.reg.ARM_fp, regs[11], 8);
-      hexvalue (ctx->v20.reg.ARM_ip, regs[12], 8);
-      hexvalue (ctx->v20.reg.ARM_sp, regs[13], 8);
-      hexvalue (ctx->v20.reg.ARM_lr, regs[14], 8);
-      hexvalue (ctx->v20.reg.ARM_pc, regs[15], 8);
-      hexvalue (ctx->v20.reg.ARM_cpsr, regs[16], 8);
-      hexvalue (ctx->v20.trap_no, regs[17], 8);
-      hexvalue (ctx->v20.error_code, regs[18], 8);
-      hexvalue (ctx->v20.oldmask, regs[19], 8);
-    }
-  else
-    {
-      hexvalue (ctx->v21.arm_r0, regs[0], 8);
-      hexvalue (ctx->v21.arm_r1, regs[1], 8);
-      hexvalue (ctx->v21.arm_r2, regs[2], 8);
-      hexvalue (ctx->v21.arm_r3, regs[3], 8);
-      hexvalue (ctx->v21.arm_r4, regs[4], 8);
-      hexvalue (ctx->v21.arm_r5, regs[5], 8);
-      hexvalue (ctx->v21.arm_r6, regs[6], 8);
-      hexvalue (ctx->v21.arm_r7, regs[7], 8);
-      hexvalue (ctx->v21.arm_r8, regs[8], 8);
-      hexvalue (ctx->v21.arm_r9, regs[9], 8);
-      hexvalue (ctx->v21.arm_r10, regs[10], 8);
-      hexvalue (ctx->v21.arm_fp, regs[11], 8);
-      hexvalue (ctx->v21.arm_ip, regs[12], 8);
-      hexvalue (ctx->v21.arm_sp, regs[13], 8);
-      hexvalue (ctx->v21.arm_lr, regs[14], 8);
-      hexvalue (ctx->v21.arm_pc, regs[15], 8);
-      hexvalue (ctx->v21.arm_cpsr, regs[16], 8);
-      hexvalue (ctx->v21.trap_no, regs[17], 8);
-      hexvalue (ctx->v21.error_code, regs[18], 8);
-      hexvalue (ctx->v21.oldmask, regs[19], 8);
-      hexvalue (ctx->v21.fault_address, regs[20], 8);
-    }
-
-  /* Generate the output.  */
-  ADD_STRING ("Register dump:\n\n R0: ");
-  ADD_MEM (regs[0], 8);
-  ADD_STRING ("   R1: ");
-  ADD_MEM (regs[1], 8);
-  ADD_STRING ("   R2: ");
-  ADD_MEM (regs[2], 8);
-  ADD_STRING ("   R3: ");
-  ADD_MEM (regs[3], 8);
-  ADD_STRING ("\n R4: ");
-  ADD_MEM (regs[4], 8);
-  ADD_STRING ("   R5: ");
-  ADD_MEM (regs[5], 8);
-  ADD_STRING ("   R6: ");
-  ADD_MEM (regs[6], 8);
-  ADD_STRING ("   R7: ");
-  ADD_MEM (regs[7], 8);
-  ADD_STRING ("\n R8: ");
-  ADD_MEM (regs[8], 8);
-  ADD_STRING ("   R9: ");
-  ADD_MEM (regs[9], 8);
-  ADD_STRING ("   SL: ");
-  ADD_MEM (regs[10], 8);
-  ADD_STRING ("   FP: ");
-  ADD_MEM (regs[11], 8);
-  ADD_STRING ("\n IP: ");
-  ADD_MEM (regs[12], 8);
-  ADD_STRING ("   SP: ");
-  ADD_MEM (regs[13], 8);
-  ADD_STRING ("   LR: ");
-  ADD_MEM (regs[14], 8);
-  ADD_STRING ("   PC: ");
-  ADD_MEM (regs[15], 8);
-  ADD_STRING ("\n\n CPSR: ");
-  ADD_MEM (regs[16], 8);
-  ADD_STRING ("\n\n Trap: ");
-  ADD_MEM (regs[17], 8);
-  ADD_STRING ("   Error: ");
-  ADD_MEM (regs[18], 8);
-  ADD_STRING ("   OldMask: ");
-  ADD_MEM (regs[19], 8);
-  if (ctx->v20.magic != SIGCONTEXT_2_0_MAGIC)
-    {
-      ADD_STRING ("\n Addr: ");
-      ADD_MEM (regs[20], 8);
-    }
-
-  ADD_STRING ("\n");
-
-  /* Write the stuff out.  */
-  writev (fd, iov, nr);
-}
-
-
-#define REGISTER_DUMP register_dump (fd, &ctx)
diff --git a/sysdeps/unix/sysv/linux/arm/scandir64.c b/sysdeps/unix/sysv/linux/arm/scandir64.c
deleted file mode 100644
index 506fd8877c..0000000000
--- a/sysdeps/unix/sysv/linux/arm/scandir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/semctl.c b/sysdeps/unix/sysv/linux/arm/semctl.c
deleted file mode 100644
index e9b1a483c9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setegid.c b/sysdeps/unix/sysv/linux/arm/setegid.c
deleted file mode 100644
index 2e3a54c893..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/seteuid.c b/sysdeps/unix/sysv/linux/arm/seteuid.c
deleted file mode 100644
index 18e41d08c1..0000000000
--- a/sysdeps/unix/sysv/linux/arm/seteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setfsgid.c b/sysdeps/unix/sysv/linux/arm/setfsgid.c
deleted file mode 100644
index 0886712569..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setfsgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setfsuid.c b/sysdeps/unix/sysv/linux/arm/setfsuid.c
deleted file mode 100644
index a9f22eb8ab..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setfsuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setgid.c b/sysdeps/unix/sysv/linux/arm/setgid.c
deleted file mode 100644
index 377021d9ec..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setgroups.c b/sysdeps/unix/sysv/linux/arm/setgroups.c
deleted file mode 100644
index 0e7086278f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setregid.c b/sysdeps/unix/sysv/linux/arm/setregid.c
deleted file mode 100644
index 99c57ad20f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setregid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setresgid.c b/sysdeps/unix/sysv/linux/arm/setresgid.c
deleted file mode 100644
index daca1a4833..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setresuid.c b/sysdeps/unix/sysv/linux/arm/setresuid.c
deleted file mode 100644
index 3aeabe9ad7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setreuid.c b/sysdeps/unix/sysv/linux/arm/setreuid.c
deleted file mode 100644
index 8ad61226e9..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setreuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setrlimit.c b/sysdeps/unix/sysv/linux/arm/setrlimit.c
deleted file mode 100644
index bfaef74c38..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/arm/setuid.c b/sysdeps/unix/sysv/linux/arm/setuid.c
deleted file mode 100644
index de394379be..0000000000
--- a/sysdeps/unix/sysv/linux/arm/setuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --git a/sysdeps/unix/sysv/linux/arm/shmctl.c b/sysdeps/unix/sysv/linux/arm/shmctl.c
deleted file mode 100644
index 7eac6380dd..0000000000
--- a/sysdeps/unix/sysv/linux/arm/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/arm/sigaction.c b/sysdeps/unix/sysv/linux/arm/sigaction.c
deleted file mode 100644
index 81b29adb2b..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sigaction.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <kernel-features.h>
-
-/* The difference here is that the sigaction structure used in the
-   kernel is not the same as we use in the libc.  Therefore we must
-   translate it here.  */
-#include <kernel_sigaction.h>
-
-/* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.  */
-int __libc_missing_rt_sigs;
-
-#define SA_RESTORER	0x04000000
-
-extern void __default_sa_restorer(void);
-extern void __default_rt_sa_restorer(void);
-
-/* When RT signals are in use we need to use a different return stub.  */
-#ifdef __NR_rt_sigreturn
-#define choose_restorer(flags)					\
-  (flags & SA_SIGINFO) ? __default_rt_sa_restorer		\
-  : __default_sa_restorer
-#else
-#define choose_restorer(flags)					\
-  __default_sa_restorer
-#endif
-
-/* If ACT is not NULL, change the action for SIG to *ACT.
-   If OACT is not NULL, put the old action for SIG in *OACT.  */
-int
-__libc_sigaction (sig, act, oact)
-     int sig;
-     const struct sigaction *act;
-     struct sigaction *oact;
-{
-#ifndef __ASSUME_REALTIME_SIGNALS
-  struct old_kernel_sigaction k_sigact, k_osigact;
-#endif
-  int result;
-
-#ifdef __NR_rt_sigaction
-  /* First try the RT signals.  */
-# ifndef __ASSUME_REALTIME_SIGNALS
-  if (!__libc_missing_rt_sigs)
-# endif
-    {
-      struct kernel_sigaction kact, koact;
-# ifndef __ASSUME_REALTIME_SIGNALS
-      int saved_errno = errno;
-# endif
-
-      if (act)
-	{
-	  kact.k_sa_handler = act->sa_handler;
-	  memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
-	  kact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-	  /* If the user specified SA_ONSTACK this means she is trying to
-	     use the old-style stack switching.  Unfortunately this
-	     requires the sa_restorer field so we cannot install our own
-	     handler.  (In fact the user is likely to be out of luck anyway
-	     since the kernel currently only supports stack switching via
-	     the X/Open sigaltstack interface, but we allow for the
-	     possibility that this might change in the future.)  */
-	  if (kact.sa_flags & (SA_RESTORER | SA_ONSTACK))
-	    kact.sa_restorer = act->sa_restorer;
-	  else
-	    {
-	      kact.sa_restorer = choose_restorer (kact.sa_flags);
-	      kact.sa_flags |= SA_RESTORER;
-	    }
-# endif
-	}
-
-      /* XXX The size argument hopefully will have to be changed to the
-	 real size of the user-level sigset_t.  */
-      result = INLINE_SYSCALL (rt_sigaction, 4, sig,
-			       act ? __ptrvalue (&kact) : NULL,
-			       oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
-
-# ifndef __ASSUME_REALTIME_SIGNALS
-      if (result >= 0 || errno != ENOSYS)
-# endif
-	{
-	  if (oact && result >= 0)
-	    {
-	      oact->sa_handler = koact.k_sa_handler;
-	      memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
-	      oact->sa_flags = koact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-	      oact->sa_restorer = koact.sa_restorer;
-# endif
-	    }
-	  return result;
-	}
-
-# ifndef __ASSUME_REALTIME_SIGNALS
-      __set_errno (saved_errno);
-      __libc_missing_rt_sigs = 1;
-# endif
-    }
-#endif
-
-#ifndef __ASSUME_REALTIME_SIGNALS
-  if (act)
-    {
-      k_sigact.k_sa_handler = act->sa_handler;
-      k_sigact.sa_mask = act->sa_mask.__val[0];
-      k_sigact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-      /* See the comments above for why we test SA_ONSTACK.  */
-      if (k_sigact.sa_flags & (SA_RESTORER | SA_ONSTACK))
-	k_sigact.sa_restorer = act->sa_restorer;
-      else
-	{
-	  k_sigact.sa_restorer = choose_restorer (k_sigact.sa_flags);
-	  k_sigact.sa_flags |= SA_RESTORER;
-	}
-# endif
-    }
-  result = INLINE_SYSCALL (sigaction, 3, sig,
-			   act ? __ptrvalue (&k_sigact) : NULL,
-			   oact ? __ptrvalue (&k_osigact) : NULL);
-  if (oact && result >= 0)
-    {
-      oact->sa_handler = k_osigact.k_sa_handler;
-      oact->sa_mask.__val[0] = k_osigact.sa_mask;
-      oact->sa_flags = k_osigact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-      oact->sa_restorer = k_osigact.sa_restorer;
-# endif
-    }
-  return result;
-#endif
-}
-libc_hidden_def (__libc_sigaction)
-
-#ifndef LIBC_SIGACTION
-weak_alias (__libc_sigaction, __sigaction)
-libc_hidden_weak (__sigaction)
-weak_alias (__libc_sigaction, sigaction)
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
deleted file mode 100644
index 30c2e3a6ce..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 1999, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <bits/armsigctx.h>
-#include "kernel-features.h"
-
-#define SIGCONTEXT int _a2, int _a3, int _a4, union k_sigcontext
-#define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4,
-
-/* The sigcontext structure changed between 2.0 and 2.1 kernels.  On any
-   modern system we should be able to assume that the "new" format will be
-   in use.  */
-#if __LINUX_KERNEL_VERSION > 131328
-
-#define GET_PC(ctx)	((void *) ctx.v21.arm_pc)
-#define GET_FRAME(ctx)	ADVANCE_STACK_FRAME ((void *) ctx.v21.arm_fp)
-#define GET_STACK(ctx)	((void *) ctx.v21.arm_sp)
-
-#else
-
-#define GET_PC(ctx)	((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-			 ctx.v20.reg.ARM_pc : ctx.v21.arm_pc))
-#define GET_FRAME(ctx)	\
-	ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-			 ctx.v20.reg.ARM_fp : ctx.v21.arm_fp))
-#define GET_STACK(ctx)	((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-			 ctx.v20.reg.ARM_sp : ctx.v21.arm_sp))
-
-#endif
-
-#define ADVANCE_STACK_FRAME(frm)	\
-			((struct layout *)frm - 1)
-
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/sysdeps/unix/sysv/linux/arm/sigrestorer.S b/sysdeps/unix/sysv/linux/arm/sigrestorer.S
deleted file mode 100644
index 98e33cb8bc..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sigrestorer.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* If no SA_RESTORER function was specified by the application we use
-   one of these.  This avoids the need for the kernel to synthesise a return
-   instruction on the stack, which would involve expensive cache flushes. */
-
-ENTRY(__default_sa_restorer)
-	swi	SYS_ify(sigreturn)
-
-#ifdef __NR_rt_sigreturn
-
-ENTRY(__default_rt_sa_restorer)
-	swi	SYS_ify(rt_sigreturn)
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/arm/socket.S b/sysdeps/unix/sysv/linux/arm/socket.S
deleted file mode 100644
index 212a489afe..0000000000
--- a/sysdeps/unix/sysv/linux/arm/socket.S
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep-cancel.h>
-#include <socketcall.h>
-
-#define P(a, b) P2(a, b)
-#define P2(a, b) a##b
-
-	.text
-/* The socket-oriented system calls are handled unusally in Linux.
-   They are all gated through the single `socketcall' system call number.
-   `socketcall' takes two arguments: the first is the subcode, specifying
-   which socket function is being called; and the second is a pointer to
-   the arguments to the specific function.
-
-   The .S files for the other calls just #define socket and #include this.  */
-
-#ifndef __socket
-#define __socket P(__,socket)
-#endif
-
-#define PUSHARGS_1	str a1, [sp, $-4]!
-#define PUSHARGS_2	stmfd sp!, {a1, a2}
-#define PUSHARGS_3	stmfd sp!, {a1, a2, a3}
-#define PUSHARGS_4	stmfd sp!, {a1, a2, a3, a4}
-#define PUSHARGS_5	stmfd sp!, {a1, a2, a3, a4}	/* Caller has already pushed arg 5 */
-#define PUSHARGS_6	stmfd sp!, {a1, a2, a3, a4}
-
-#define POPARGS_1	add sp, sp, #4
-#define POPARGS_2	add sp, sp, #8
-#define POPARGS_3	add sp, sp, #12
-#define POPARGS_4	add sp, sp, #16
-#define POPARGS_5	add sp, sp, #16
-#define POPARGS_6	add sp, sp, #16 
-
-#ifndef NARGS
-#define NARGS 3			/* If we were called with no wrapper, this is really socket() */
-#endif
-
-#if defined NEED_CANCELLATION && defined CENABLE
-	PSEUDO_PROLOGUE
-#endif
-
-.globl __socket
-ENTRY (__socket)
-	/* This code previously moved sp into ip and stored the args using
-	   stmdb ip!, {a1-a4}.  It did not modify sp, so the stack never had 
-	   to be restored after the syscall completed.  It saved an 
-	   instruction and meant no stack cleanup work was required.
-
-	   This will not work in the case of a socket call being interrupted
-	   by a signal.  If the signal handler uses any stack the arguments
-	   to socket will be trashed.  The results of a restart of any
-	   socket call are then unpredictable. */
-
-	/* Push args onto the stack.  */
-	P(PUSHARGS_,NARGS)
-
-#if defined NEED_CANCELLATION && defined CENABLE
-#ifdef PIC
-	SINGLE_THREAD_P_PIC(r3)
-#else
-	SINGLE_THREAD_P
-#endif
-	bne 1f
-#endif
-
-        /* Do the system call trap.  */
-	mov a1, $P(SOCKOP_,socket)
-	mov a2, sp
-	swi SYS_ify(socketcall)
-
-	/* Pop args off the stack */
-	P(POPARGS_,NARGS)
-
-	/* r0 is < 0 if there was an error.  */
-	cmn r0, $124
-	RETINSTR(cc, r14)
-	b PLTJMP(SYSCALL_ERROR)
-
-#if defined NEED_CANCELLATION && defined CENABLE
-1:
-	str lr, [sp, #-4]!
-	CENABLE
-	mov ip, r0
-
-	mov r0, #P(SOCKOP_,socket)
-	add r1, sp, #4
-	swi SYS_ify(socketcall)
-
-	str r0, [sp, #-4]!
-	mov r0, ip
-	CDISABLE
-	ldr r0, [sp], #4
-	ldr lr, [sp], #4
-
-	P(POPARGS_,NARGS)
-
-	/* r0 is < 0 if there was an error.  */
-	cmn r0, $124
-	RETINSTR(cc, r14)
-	b PLTJMP(SYSCALL_ERROR)
-#endif
-
-PSEUDO_END (__socket)
-
-weak_alias (__socket, socket)
diff --git a/sysdeps/unix/sysv/linux/arm/sys/elf.h b/sysdeps/unix/sysv/linux/arm/sys/elf.h
deleted file mode 100644
index faa7310682..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/elf.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_ELF_H
-#define _SYS_ELF_H	1
-
-#warning "This header is obsolete; use <sys/procfs.h> instead."
-
-#include <sys/procfs.h>
-
-#endif	/* sys/elf.h */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/io.h b/sysdeps/unix/sysv/linux/arm/sys/io.h
deleted file mode 100644
index 68639902c7..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/io.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1996, 1998, 1999 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_SYS_IO_H
-
-#define	_SYS_IO_H	1
-#include <features.h>
-
-__BEGIN_DECLS
-
-/* If TURN_ON is TRUE, request for permission to do direct i/o on the
-   port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
-   permission off for that range.  This call requires root privileges.  */
-extern int ioperm (unsigned long int __from, unsigned long int __num,
-		   int __turn_on) __THROW;
-
-/* Set the I/O privilege level to LEVEL.  If LEVEL is nonzero,
-   permission to access any I/O port is granted.  This call requires
-   root privileges. */
-extern int iopl (int __level) __THROW;
-
-/* The functions that actually perform reads and writes.  */
-extern unsigned char inb (unsigned long int port) __THROW;
-extern unsigned short int inw (unsigned long int port) __THROW;
-extern unsigned long int inl (unsigned long int port) __THROW;
-
-extern void outb (unsigned char value, unsigned long int port) __THROW;
-extern void outw (unsigned short value, unsigned long int port) __THROW;
-extern void outl (unsigned long value, unsigned long int port) __THROW;
-
-__END_DECLS
-
-#endif /* _SYS_IO_H */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/procfs.h b/sysdeps/unix/sysv/linux/arm/sys/procfs.h
deleted file mode 100644
index 3b3736324f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/procfs.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somewhat modelled after the file of the same name on SVR4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  It doesn't have anything to do with the /proc file
-   system, even though Linux has one.
-
-   Anyway, the whole purpose of this file is for GDB and GDB only.
-   Don't read too much into it.  Don't use it for anything other than
-   GDB unless you know what you are doing.  */
-
-#include <features.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/user.h>
-
-__BEGIN_DECLS
-
-/* Type for a general-purpose register.  */
-typedef unsigned long elf_greg_t;
-
-/* And the whole bunch of them.  We could have used `struct
-   user_regs' directly in the typedef, but tradition says that
-   the register set is an array, which does have some peculiar
-   semantics, so leave it that way.  */
-#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-/* Register set for the floating-point registers.  */
-typedef struct user_fpregs elf_fpregset_t;
-
-/* Signal info.  */
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with Linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   GDB doesn't really use excluded.  */
-
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-    unsigned long int pr_flag;		/* Flags.  */
-    unsigned short int pr_uid;
-    unsigned short int pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-/* The rest of this file provides the types for emulation of the
-   Solaris <proc_service.h> interfaces that should be implemented by
-   users of libthread_db.  */
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore have only one PID type.  */
-typedef __pid_t lwpid_t;
-
-/* Process status and info.  In the end we do provide typedefs for them.  */
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
deleted file mode 100644
index 6d6c8e3990..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (C) 1998, 1999, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* System V/ARM ABI compliant context switching support.  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-#include <sys/procfs.h>
-
-typedef int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	16
-
-/* Container for all general registers.  */
-typedef elf_gregset_t gregset_t;
-
-/* Number of each register is the `gregset_t' array.  */
-enum
-{
-  R0 = 0,
-#define R0	R0
-  R1 = 1,
-#define R1	R1
-  R2 = 2,
-#define R2	R2
-  R3 = 3,
-#define R3	R3
-  R4 = 4,
-#define R4	R4
-  R5 = 5,
-#define R5	R5
-  R6 = 6,
-#define R6	R6
-  R7 = 7,
-#define R7	R7
-  R8 = 8,
-#define R8	R8
-  R9 = 9,
-#define R9	R9
-  R10 = 10,
-#define R10	R10
-  R11 = 11,
-#define R11	R11
-  R12 = 12,
-#define R12	R12
-  R13 = 13,
-#define R13	R13
-  R14 = 14,
-#define R14	R14
-  R15 = 15
-#define R15	R15
-};
-
-/* Structure to describe FPU registers.  */
-typedef elf_fpregset_t	fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct
-  {
-    gregset_t gregs;
-    fpregset_t fpregs;
-  } mcontext_t;
-
-/* Userlevel context.  */
-typedef struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    __sigset_t uc_sigmask;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    long int uc_filler[5];
-  } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/arm/sys/user.h b/sysdeps/unix/sysv/linux/arm/sys/user.h
deleted file mode 100644
index 3fae43f83f..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sys/user.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 1998, 1999, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_USER_H
-#define _SYS_USER_H	1
-
-/* The whole purpose of this file is for GDB and GDB only.  Don't read
-   too much into it.  Don't use it for anything other than GDB unless
-   you know what you are doing.  */
-
-struct user_fpregs
-{
-  struct fp_reg
-  {
-    unsigned int sign1:1;
-    unsigned int unused:15;
-    unsigned int sign2:1;
-    unsigned int exponent:14;
-    unsigned int j:1;
-    unsigned int mantissa1:31;
-    unsigned int mantissa0:32;
-  } fpregs[8];
-  unsigned int fpsr:32;
-  unsigned int fpcr:32;
-  unsigned char ftype[8];
-  unsigned int init_flag;
-};
-
-struct user_regs
-{
-  unsigned long int uregs[18];
-};
-
-struct user
-{
-  struct user_regs regs;	/* General registers */
-  int u_fpvalid;		/* True if math co-processor being used. */
-
-  unsigned long int u_tsize;	/* Text segment size (pages). */
-  unsigned long int u_dsize;	/* Data segment size (pages). */
-  unsigned long int u_ssize;	/* Stack segment size (pages). */
-
-  unsigned long start_code;	/* Starting virtual address of text. */
-  unsigned long start_stack;	/* Starting virtual address of stack. */
-
-  long int signal;     		/* Signal that caused the core dump. */
-  int reserved;			/* No longer used */
-  struct user_regs *u_ar0;	/* help gdb to find the general registers. */
-
-  unsigned long magic;		/* uniquely identify a core file */
-  char u_comm[32];		/* User command that was responsible */
-  int u_debugreg[8];
-  struct user_fpregs u_fp;	/* Floating point registers */
-  struct user_fpregs *u_fp0;	/* help gdb to find the FP registers. */
-};
-
-#endif  /* sys/user.h */
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
deleted file mode 100644
index 1db0030b5b..0000000000
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ /dev/null
@@ -1,5 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-syscall		-	syscall		7	syscall
-oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
-oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.S b/sysdeps/unix/sysv/linux/arm/sysdep.S
deleted file mode 100644
index 1a4de2adb3..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sysdep.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-	.text
-
-/* The syscall stubs jump here when they detect an error.
-   The code for Linux is almost identical to the canonical Unix
-   code, except that the error number in R0 is negated.  */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers R0.  */
-
-ENTRY (__syscall_error)
-	rsb r0, r0, $0
-
-#define __syscall_error __syscall_error_1
-#include <sysdeps/unix/arm/sysdep.S>
diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h
deleted file mode 100644
index 668aa1a2f1..0000000000
--- a/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Copyright (C) 1992, 93, 1995-2000, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
-   ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_ARM_SYSDEP_H
-#define _LINUX_ARM_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/arm/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#define SWI_BASE  (0x900000)
-#define SYS_ify(syscall_name)	(__NR_##syscall_name)
-
-
-#ifdef __ASSEMBLER__
-
-/* Linux uses a negative return value to indicate syscall errors,
-   unlike most Unices, which use the condition codes' carry flag.
-
-   Since version 2.1 the return value of a system call might be
-   negative even if the call succeeded.  E.g., the `lseek' system call
-   might return a large offset.  Therefore we must not anymore test
-   for < 0, but test for a real error by making sure the value in R0
-   is a real error number.  Linus said he will make sure the no syscall
-   returns a value in -1 .. -4095 as a valid result so we can savely
-   test with -4095.  */
-
-#undef	PSEUDO
-#define	PSEUDO(name, syscall_name, args)				      \
-  .text;								      \
-  ENTRY (name);								      \
-    DO_CALL (syscall_name, args);					      \
-    cmn r0, $4096;
-
-#define PSEUDO_RET							      \
-    RETINSTR(cc, lr);							      \
-    b PLTJMP(SYSCALL_ERROR)
-#undef ret
-#define ret PSEUDO_RET
-
-#undef	PSEUDO_END
-#define	PSEUDO_END(name)						      \
-  SYSCALL_ERROR_HANDLER							      \
-  END (name)
-
-#undef	PSEUDO_NOERRNO
-#define	PSEUDO_NOERRNO(name, syscall_name, args)			      \
-  .text;								      \
-  ENTRY (name);								      \
-    DO_CALL (syscall_name, args);
-
-#define PSEUDO_RET_NOERRNO						      \
-    DO_RET (lr);
-
-#undef ret_NOERRNO
-#define ret_NOERRNO PSEUDO_RET_NOERRNO
-
-#undef	PSEUDO_END_NOERRNO
-#define	PSEUDO_END_NOERRNO(name)					      \
-  END (name)
-
-/* The function has to return the error code.  */
-#undef	PSEUDO_ERRVAL
-#define	PSEUDO_ERRVAL(name, syscall_name, args) \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args);					      \
-    rsb r0, r0, #0
-
-#undef	PSEUDO_END_ERRVAL
-#define	PSEUDO_END_ERRVAL(name) \
-  END (name)
-
-#define ret_ERRVAL PSEUDO_RET_NOERRNO
-
-#if NOT_IN_libc
-# define SYSCALL_ERROR __local_syscall_error
-# define SYSCALL_ERROR_HANDLER					\
-__local_syscall_error:						\
-	str	lr, [sp, #-4]!;					\
-	str	r0, [sp, #-4]!;					\
-	bl	PLTJMP(C_SYMBOL_NAME(__errno_location)); 	\
-	ldr	r1, [sp], #4;					\
-	rsb	r1, r1, #0;					\
-	str	r1, [r0];					\
-	mvn	r0, #0;						\
-	ldr	pc, [sp], #4;
-#else
-# define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
-# define SYSCALL_ERROR __syscall_error
-#endif
-
-/* Linux takes system call args in registers:
-	syscall number	in the SWI instruction
-	arg 1		r0
-	arg 2		r1
-	arg 3		r2
-	arg 4		r3
-	arg 5		r4	(this is different from the APCS convention)
-	arg 6		r5
-	arg 7		r6
-
-   The compiler is going to form a call by coming here, through PSEUDO, with
-   arguments
-   	syscall number	in the DO_CALL macro
-   	arg 1		r0
-   	arg 2		r1
-   	arg 3		r2
-   	arg 4		r3
-   	arg 5		[sp]
-	arg 6		[sp+4]
-	arg 7		[sp+8]
-
-   We need to shuffle values between R4..R6 and the stack so that the
-   caller's v1..v3 and stack frame are not corrupted, and the kernel
-   sees the right arguments.
-
-*/
-
-#undef	DO_CALL
-#define DO_CALL(syscall_name, args)		\
-    DOARGS_##args				\
-    swi SYS_ify (syscall_name); 		\
-    UNDOARGS_##args
-
-#define DOARGS_0 /* nothing */
-#define DOARGS_1 /* nothing */
-#define DOARGS_2 /* nothing */
-#define DOARGS_3 /* nothing */
-#define DOARGS_4 /* nothing */
-#define DOARGS_5 str r4, [sp, $-4]!; ldr r4, [sp, $4];
-#define DOARGS_6 mov ip, sp; stmfd sp!, {r4, r5}; ldmia ip, {r4, r5};
-#define DOARGS_7 mov ip, sp; stmfd sp!, {r4, r5, r6}; ldmia ip, {r4, r5, r6};
-
-#define UNDOARGS_0 /* nothing */
-#define UNDOARGS_1 /* nothing */
-#define UNDOARGS_2 /* nothing */
-#define UNDOARGS_3 /* nothing */
-#define UNDOARGS_4 /* nothing */
-#define UNDOARGS_5 ldr r4, [sp], $4;
-#define UNDOARGS_6 ldmfd sp!, {r4, r5};
-#define UNDOARGS_7 ldmfd sp!, {r4, r5, r6};
-
-#else /* not __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)				\
-  ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
-     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))	\
-       {								\
-	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
-	 _sys_result = (unsigned int) -1;				\
-       }								\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...)		\
-  ({ unsigned int _sys_result;					\
-     {								\
-       register int _a1 asm ("a1");				\
-       LOAD_ARGS_##nr (args)					\
-       asm volatile ("swi	%1	@ syscall " #name	\
-		     : "=r" (_a1)				\
-		     : "i" (SYS_ify(name)) ASM_ARGS_##nr	\
-		     : "memory");				\
-       _sys_result = _a1;					\
-     }								\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  ((unsigned int) (val) >= 0xfffff001u)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-
-#define LOAD_ARGS_0()
-#define ASM_ARGS_0
-#define LOAD_ARGS_1(a1)				\
-  _a1 = (int) (a1);				\
-  LOAD_ARGS_0 ()
-#define ASM_ARGS_1	ASM_ARGS_0, "r" (_a1)
-#define LOAD_ARGS_2(a1, a2)			\
-  register int _a2 asm ("a2") = (int) (a2);	\
-  LOAD_ARGS_1 (a1)
-#define ASM_ARGS_2	ASM_ARGS_1, "r" (_a2)
-#define LOAD_ARGS_3(a1, a2, a3)			\
-  register int _a3 asm ("a3") = (int) (a3);	\
-  LOAD_ARGS_2 (a1, a2)
-#define ASM_ARGS_3	ASM_ARGS_2, "r" (_a3)
-#define LOAD_ARGS_4(a1, a2, a3, a4)		\
-  register int _a4 asm ("a4") = (int) (a4);	\
-  LOAD_ARGS_3 (a1, a2, a3)
-#define ASM_ARGS_4	ASM_ARGS_3, "r" (_a4)
-#define LOAD_ARGS_5(a1, a2, a3, a4, a5)		\
-  register int _v1 asm ("v1") = (int) (a5);	\
-  LOAD_ARGS_4 (a1, a2, a3, a4)
-#define ASM_ARGS_5	ASM_ARGS_4, "r" (_v1)
-#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)	\
-  register int _v2 asm ("v2") = (int) (a6);	\
-  LOAD_ARGS_5 (a1, a2, a3, a4, a5)
-#define ASM_ARGS_6	ASM_ARGS_5, "r" (_v2)
-#define LOAD_ARGS_7(a1, a2, a3, a4, a5, a6, a7)	\
-  register int _v3 asm ("v3") = (int) (a7);	\
-  LOAD_ARGS_6 (a1, a2, a3, a4, a5, a6)
-#define ASM_ARGS_7	ASM_ARGS_6, "r" (_v3)
-
-#endif	/* __ASSEMBLER__ */
-
-#endif /* linux/arm/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/arm/versionsort64.c b/sysdeps/unix/sysv/linux/arm/versionsort64.c
deleted file mode 100644
index 144b691e56..0000000000
--- a/sysdeps/unix/sysv/linux/arm/versionsort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/versionsort64.c>
diff --git a/sysdeps/unix/sysv/linux/arm/vfork.S b/sysdeps/unix/sysv/linux/arm/vfork.S
deleted file mode 100644
index 9ef5114b24..0000000000
--- a/sysdeps/unix/sysv/linux/arm/vfork.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Philip Blundell <philb@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-#include <kernel-features.h>
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-
-ENTRY (__vfork)
-
-#ifdef __NR_vfork
-	swi	__NR_vfork
-	cmn	a1, #4096
-	RETINSTR(cc, lr)
-
-# ifdef __ASSUME_VFORK_SYSCALL
-	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-# else
-	/* Check if vfork syscall is known at all.  */
-	cmn	a2, #ENOSYS
-	bne	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-	swi	__NR_fork
-	cmn	a1, #4096
-	RETINSTR(cc, lr)
-    	b	PLTJMP(C_SYMBOL_NAME(__syscall_error))
-#elif !defined __NR_vfork
-# error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
-#endif
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/arm/xstat.c b/sysdeps/unix/sysv/linux/arm/xstat.c
deleted file mode 100644
index e9869f5508..0000000000
--- a/sysdeps/unix/sysv/linux/arm/xstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/xstat.c>
diff --git a/sysdeps/unix/sysv/linux/bits/errno.h b/sysdeps/unix/sysv/linux/bits/errno.h
index 724dabaf10..4de8cbba57 100644
--- a/sysdeps/unix/sysv/linux/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/bits/errno.h
@@ -1,5 +1,5 @@
 /* Error constants.  Linux specific version.
-   Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2005 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
@@ -27,12 +27,17 @@
 /* Linux has no ENOTSUP error code.  */
 # define ENOTSUP EOPNOTSUPP
 
-/* Linux also had no ECANCELED error code.  Since it is not used here
-   we define it to an invalid value.  */
+/* Older Linux versions also had no ECANCELED error code.  */
 # ifndef ECANCELED
 #  define ECANCELED	125
 # endif
 
+/* Support for error codes to support robust mutexes was added later, too.  */
+# ifndef EOWNERDEAD
+#  define EOWNERDEAD		130
+#  define ENOTRECOVERABLE	131
+# endif
+
 # ifndef __ASSEMBLER__
 /* Function to get address of global `errno' variable.  */
 extern int *__errno_location (void) __THROW __attribute__ ((__const__));
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index 9d587897ad..6880a2e636 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -105,13 +105,13 @@ struct in_pktinfo
    The first word in the comment at the right is the data type used;
    "bool" means a boolean value stored in an `int'.  */
 #define IPV6_ADDRFORM		1
-#define IPV6_PKTINFO		2
-#define IPV6_HOPOPTS		3
-#define IPV6_DSTOPTS		4
-#define IPV6_RTHDR		5
-#define IPV6_PKTOPTIONS		6
+#define IPV6_2292PKTINFO	2
+#define IPV6_2292HOPOPTS	3
+#define IPV6_2292DSTOPTS	4
+#define IPV6_2292RTHDR		5
+#define IPV6_2292PKTOPTIONS	6
 #define IPV6_CHECKSUM		7
-#define IPV6_HOPLIMIT		8
+#define IPV6_2292HOPLIMIT	8
 
 #define SCM_SRCRT		IPV6_RXSRCRT
 
@@ -133,6 +133,21 @@ struct in_pktinfo
 #define IPV6_IPSEC_POLICY	34
 #define IPV6_XFRM_POLICY	35
 
+#define IPV6_RECVPKTINFO	49
+#define IPV6_PKTINFO		50
+#define IPV6_RECVHOPLIMIT	51
+#define IPV6_HOPLIMIT		52
+#define IPV6_RECVHOPOPTS	53
+#define IPV6_HOPOPTS		54
+#define IPV6_RTHDRDSTOPTS	55
+#define IPV6_RECVRTHDR		56
+#define IPV6_RTHDR		57
+#define IPV6_RECVDSTOPTS	58
+#define IPV6_DSTOPTS		59
+
+#define IPV6_RECVTCLASS		66
+#define IPV6_TCLASS		67
+
 /* Obsolete synonyms for the above.  */
 #define IPV6_ADD_MEMBERSHIP	IPV6_JOIN_GROUP
 #define IPV6_DROP_MEMBERSHIP	IPV6_LEAVE_GROUP
diff --git a/sysdeps/unix/sysv/linux/bits/poll.h b/sysdeps/unix/sysv/linux/bits/poll.h
index dccb8b6665..d7996b46c5 100644
--- a/sysdeps/unix/sysv/linux/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/bits/poll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2006 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
@@ -36,8 +36,10 @@
 #endif
 
 #ifdef __USE_GNU
-/* This is an extension for Linux.  */
+/* These are extensions for Linux.  */
 # define POLLMSG	0x400
+# define POLLREMOVE	0x1000
+# define POLLRDHUP	0x2000
 #endif
 
 /* Event types always implicitly polled for.  These bits need not be set in
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index c186a3a5d0..526cdaf53c 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h
index 24495e2b34..4a95a263f7 100644
--- a/sysdeps/unix/sysv/linux/bits/sched.h
+++ b/sysdeps/unix/sysv/linux/bits/sched.h
@@ -1,6 +1,6 @@
 /* Definitions of constants and data structure for POSIX 1003.1b-1993
    scheduling interface.
-   Copyright (C) 1996-1999,2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2001-2003,2005,2006 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
@@ -29,6 +29,9 @@
 #define SCHED_OTHER	0
 #define SCHED_FIFO	1
 #define SCHED_RR	2
+#ifdef __USE_GNU
+# define SCHED_BATCH	3
+#endif
 
 #ifdef __USE_MISC
 /* Cloning flags.  */
@@ -66,10 +69,13 @@ struct sched_param
 
 __BEGIN_DECLS
 
-/* Clone current process.  */
 #ifdef __USE_MISC
+/* Clone current process.  */
 extern int clone (int (*__fn) (void *__arg), void *__child_stack,
-		  int __flags, void *__arg) __THROW;
+		  int __flags, void *__arg, ...) __THROW;
+
+/* Unshare the specified resources.  */
+extern int unshare (int __flags) __THROW;
 #endif
 
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/bits/shm.h b/sysdeps/unix/sysv/linux/bits/shm.h
index 225b89db2d..318d601aed 100644
--- a/sysdeps/unix/sysv/linux/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/bits/shm.h
@@ -73,6 +73,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 77e9b83c92..356a2ece74 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  Linux version.
-   Copyright (C) 1991,1992,1994-2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991,1992,1994-2001,2004,2006 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
@@ -221,7 +221,10 @@ struct msghdr
     size_t msg_iovlen;		/* Number of elements in the vector.  */
 
     void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
-    size_t msg_controllen;	/* Ancillary data buffer length.  */
+    size_t msg_controllen;	/* Ancillary data buffer length.
+				   !! The type should be socklen_t but the
+				   definition of the kernel is incompatible
+				   with this.  */
 
     int msg_flags;		/* Flags on received message.  */
   };
@@ -230,7 +233,10 @@ struct msghdr
 struct cmsghdr
   {
     size_t cmsg_len;		/* Length of data in cmsg_data plus length
-				   of cmsghdr structure.  */
+				   of cmsghdr structure.
+				   !! The type should be socklen_t but the
+				   definition of the kernel is incompatible
+				   with this.  */
     int cmsg_level;		/* Originating protocol.  */
     int cmsg_type;		/* Protocol specific type.  */
 #if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 1b71f60faf..c71e4ad1fe 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -1,5 +1,5 @@
 /* termios type and macro definitions.  Linux version.
-   Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2003
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2005
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -172,6 +172,7 @@ struct termios
 #define __MAX_BAUD B4000000
 #ifdef __USE_MISC
 # define CIBAUD	  002003600000		/* input baud rate (not used) */
+# define CMSPAR   010000000000		/* mark or space (stick) parity */
 # define CRTSCTS  020000000000		/* flow control */
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/bits/uio.h b/sysdeps/unix/sysv/linux/bits/uio.h
index 84b4805fe8..6a283ed771 100644
--- a/sysdeps/unix/sysv/linux/bits/uio.h
+++ b/sysdeps/unix/sysv/linux/bits/uio.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2006 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
@@ -16,10 +16,12 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#ifndef _SYS_UIO_H
+#if !defined _SYS_UIO_H && !defined _FCNTL_H
 # error "Never include <bits/uio.h> directly; use <sys/uio.h> instead."
 #endif
 
+#ifndef _BITS_UIO_H
+#define _BITS_UIO_H	1
 
 #include <sys/types.h>
 
@@ -31,7 +33,7 @@
 /* Size of object which can be written atomically.
 
    This macro has different values in different kernel versions.  The
-   latest versions of ther kernel use 1024 and this is good choice.  Since
+   latest versions of the kernel use 1024 and this is good choice.  Since
    the C library implementation of readv/writev is able to emulate the
    functionality even if the currently running kernel does not support
    this large value the readv/writev call will not fail because of this.  */
@@ -44,3 +46,5 @@ struct iovec
     void *iov_base;	/* Pointer to data.  */
     size_t iov_len;	/* Length of data.  */
   };
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/bits/waitflags.h b/sysdeps/unix/sysv/linux/bits/waitflags.h
index e3f80f6814..464cedb1fc 100644
--- a/sysdeps/unix/sysv/linux/bits/waitflags.h
+++ b/sysdeps/unix/sysv/linux/bits/waitflags.h
@@ -1,5 +1,5 @@
 /* Definitions of flag bits for `waitpid' et al.
-   Copyright (C) 1992, 1996, 1997, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1992,1996,1997,2000,2004,2005 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
@@ -32,5 +32,7 @@
 #define WCONTINUED	8	/* Report continued child.  */
 #define WNOWAIT		0x01000000 /* Don't reap, just poll status.  */
 
+#define __WNOTHREAD     0x20000000 /* Don't wait on children of other threads
+				      in this group */
 #define __WALL		0x40000000 /* Wait for any child.  */
 #define __WCLONE	0x80000000 /* Wait for cloned process.  */
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 69924769bc..46161a806a 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -1,5 +1,5 @@
 /* Determine protocol families for which interfaces exist.  Linux version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007 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
@@ -17,9 +17,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <ifaddrs.h>
 #include <netdb.h>
+#include <stddef.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
@@ -29,16 +31,30 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#include "kernel-features.h"
+#include <not-cancel.h>
+#include <kernel-features.h>
+
+
+#ifndef IFA_F_TEMPORARY
+# define IFA_F_TEMPORARY IFA_F_SECONDARY
+#endif
+#ifndef IFA_F_HOMEADDRESS
+# define IFA_F_HOMEADDRESS 0
+#endif
 
 
 static int
-make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
+make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6,
+	      struct in6addrinfo **in6ai, size_t *in6ailen)
 {
-  struct
+  struct req
   {
     struct nlmsghdr nlh;
     struct rtgenmsg g;
+    /* struct rtgenmsg consists of a single byte.  This means there
+       are three bytes of padding included in the REQ definition.
+       We make them explicit here.  */
+    char pad[3];
   } req;
   struct sockaddr_nl nladdr;
 
@@ -49,20 +65,50 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
   req.nlh.nlmsg_seq = time (NULL);
   req.g.rtgen_family = AF_UNSPEC;
 
+  assert (sizeof (req) - offsetof (struct req, pad) == 3);
+  memset (req.pad, '\0', sizeof (req.pad));
+
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;
 
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
+  bool use_malloc = false;
+  char *buf;
+
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
+  else
+    {
+      buf = malloc (buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, buf_size };
+
   if (TEMP_FAILURE_RETRY (__sendto (fd, (void *) &req, sizeof (req), 0,
 				    (struct sockaddr *) &nladdr,
 				    sizeof (nladdr))) < 0)
-    return -1;
+    goto out_fail;
 
   *seen_ipv4 = false;
   *seen_ipv6 = false;
 
   bool done = false;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
+  struct in6ailist
+  {
+    struct in6addrinfo info;
+    struct in6ailist *next;
+  } *in6ailist = NULL;
+  size_t in6ailistlen = 0;
 
   do
     {
@@ -76,10 +122,10 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 
       ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
       if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+	goto out_fail;
 
       struct nlmsghdr *nlmh;
       for (nlmh = (struct nlmsghdr *) buf;
@@ -101,6 +147,47 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 		  break;
 		case AF_INET6:
 		  *seen_ipv6 = true;
+
+		  if (ifam->ifa_flags & (IFA_F_DEPRECATED
+					 | IFA_F_TEMPORARY
+					 | IFA_F_HOMEADDRESS))
+		    {
+		      struct rtattr *rta = IFA_RTA (ifam);
+		      size_t len = (nlmh->nlmsg_len
+				    - NLMSG_LENGTH (sizeof (*ifam)));
+		      void *local = NULL;
+		      void *address = NULL;
+		      while (RTA_OK (rta, len))
+			{
+			  switch (rta->rta_type)
+			    {
+			    case IFA_LOCAL:
+			      local = RTA_DATA (rta);
+			      break;
+
+			    case IFA_ADDRESS:
+			      address = RTA_DATA (rta);
+			      break;
+			    }
+
+			  rta = RTA_NEXT (rta, len);
+			}
+
+		      struct in6ailist *newp = alloca (sizeof (*newp));
+		      newp->info.flags = (((ifam->ifa_flags & IFA_F_DEPRECATED)
+					   ? in6ai_deprecated : 0)
+					  | ((ifam->ifa_flags
+					      & IFA_F_TEMPORARY)
+					     ? in6ai_temporary : 0)
+					  | ((ifam->ifa_flags
+					      & IFA_F_HOMEADDRESS)
+					     ? in6ai_homeaddress : 0));
+		      memcpy (newp->info.addr, address ?: local,
+			      sizeof (newp->info.addr));
+		      newp->next = in6ailist;
+		      in6ailist = newp;
+		      ++in6ailistlen;
+		    }
 		  break;
 		default:
 		  /* Ignore.  */
@@ -110,14 +197,36 @@ make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
 	  else if (nlmh->nlmsg_type == NLMSG_DONE)
 	    /* We found the end, leave the loop.  */
 	    done = true;
-	  else ;
 	}
     }
   while (! done);
 
-  __close (fd);
+  close_not_cancel_no_status (fd);
+
+  if (in6ailist != NULL)
+    {
+      *in6ai = malloc (in6ailistlen * sizeof (**in6ai));
+      if (*in6ai == NULL)
+	goto out_fail;
+
+      *in6ailen = in6ailistlen;
 
+      do
+	{
+	  (*in6ai)[--in6ailistlen] = in6ailist->info;
+	  in6ailist = in6ailist->next;
+	}
+      while (in6ailist != NULL);
+    }
+
+  if (use_malloc)
+    free (buf);
   return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
+  return -1;
 }
 
 
@@ -133,8 +242,12 @@ extern int __no_netlink_support attribute_hidden;
 
 void
 attribute_hidden
-__check_pf (bool *seen_ipv4, bool *seen_ipv6)
+__check_pf (bool *seen_ipv4, bool *seen_ipv6,
+	    struct in6addrinfo **in6ai, size_t *in6ailen)
 {
+  *in6ai = NULL;
+  *in6ailen = 0;
+
   if (! __no_netlink_support)
     {
       int fd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
@@ -148,7 +261,8 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6)
       if (fd >= 0
 	  && __bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
 	  && __getsockname (fd, (struct sockaddr *) &nladdr, &addr_len) == 0
-	  && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6) == 0)
+	  && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6,
+			   in6ai, in6ailen) == 0)
 	/* It worked.  */
 	return;
 
@@ -178,9 +292,6 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6)
       return;
     }
 
-  *seen_ipv4 = false;
-  *seen_ipv6 = false;
-
   struct ifaddrs *runp;
   for (runp = ifa; runp != NULL; runp = runp->ifa_next)
     if (runp->ifa_addr->sa_family == PF_INET)
diff --git a/sysdeps/unix/sysv/linux/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
new file mode 100644
index 0000000000..04bf49e45f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/clock_getcpuclockid.c
@@ -0,0 +1,103 @@
+/* clock_getcpuclockid -- Get a clockid_t for process CPU time.  Linux version.
+   Copyright (C) 2004, 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <time.h>
+#include <unistd.h>
+#include <kernel-features.h>
+#include "kernel-posix-cpu-timers.h"
+
+#ifndef HAS_CPUCLOCK
+# define HAS_CPUCLOCK 1
+#endif
+
+int
+clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
+{
+#ifdef __NR_clock_getres
+  /* The clockid_t value is a simple computation from the PID.
+     But we do a clock_getres call to validate it.  */
+
+  const clockid_t pidclock = MAKE_PROCESS_CPUCLOCK (pid, CPUCLOCK_SCHED);
+
+# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
+  extern int __libc_missing_posix_cpu_timers attribute_hidden;
+#  if !(__ASSUME_POSIX_TIMERS > 0)
+  extern int __libc_missing_posix_timers attribute_hidden;
+  if (__libc_missing_posix_timers && !__libc_missing_posix_cpu_timers)
+    __libc_missing_posix_cpu_timers = 1;
+#  endif
+  if (!__libc_missing_posix_cpu_timers)
+# endif
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_SYSCALL (clock_getres, err, 2, pidclock, NULL);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	{
+	  *clock_id = pidclock;
+	  return 0;
+	}
+
+# if !(__ASSUME_POSIX_TIMERS > 0)
+      if (INTERNAL_SYSCALL_ERRNO (r, err) == ENOSYS)
+	{
+	  /* The kernel doesn't support these calls at all.  */
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	}
+      else
+# endif
+	if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL)
+	  {
+# if !(__ASSUME_POSIX_CPU_TIMERS > 0)
+	    if (pidclock == MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED)
+		|| INTERNAL_SYSCALL_ERROR_P (INTERNAL_SYSCALL
+					     (clock_getres, err, 2,
+					      MAKE_PROCESS_CPUCLOCK
+					      (0, CPUCLOCK_SCHED), NULL),
+					     err))
+	      /* The kernel doesn't support these clocks at all.  */
+	      __libc_missing_posix_cpu_timers = 1;
+	    else
+# endif
+	      /* The clock_getres system call checked the PID for us.  */
+	      return ESRCH;
+	  }
+	else
+	  return INTERNAL_SYSCALL_ERRNO (r, err);
+    }
+#endif
+
+  /* We don't allow any process ID but our own.  */
+  if (pid != 0 && pid != getpid ())
+    return EPERM;
+
+#ifdef CLOCK_PROCESS_CPUTIME_ID
+  if (HAS_CPUCLOCK)
+    {
+      /* Store the number.  */
+      *clock_id = CLOCK_PROCESS_CPUTIME_ID;
+
+      return 0;
+    }
+#endif
+
+  /* We don't have a timer for that.  */
+  return ENOENT;
+}
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 442fbd5705..813d3ebbf9 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* clock_getres -- Get the resolution of a POSIX clockid_t.  Linux version.
+   Copyright (C) 2003,2004,2005,2006 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
@@ -17,60 +18,176 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <errno.h>
+#include <time.h>
+#include "kernel-posix-cpu-timers.h"
+#include <kernel-features.h>
 
-#include "kernel-features.h"
+#ifndef HAVE_CLOCK_GETRES_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
 
+#define SYSCALL_GETRES \
+  retval = INLINE_VSYSCALL (clock_getres, 2, clock_id, res); \
+  break
 
 #ifdef __ASSUME_POSIX_TIMERS
+
 /* This means the REALTIME and MONOTONIC clock are definitely
    supported in the kernel.  */
-# define SYSDEP_GETRES \
+# define SYSDEP_GETRES							      \
+  SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    retval = INLINE_SYSCALL (clock_getres, 2, clock_id, res);		      \
-    break
+    SYSCALL_GETRES
+
+# define __libc_missing_posix_timers 0
 #elif defined __NR_clock_getres
 /* Is the syscall known to exist?  */
 extern int __libc_missing_posix_timers attribute_hidden;
 
+static inline int
+maybe_syscall_getres (clockid_t clock_id, struct timespec *res)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_getres, err, 2, clock_id, res);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  e = EINVAL;
+	}
+    }
+
+  return e;
+}
+
 /* The REALTIME and MONOTONIC clock might be available.  Try the
    syscall first.  */
-# define SYSDEP_GETRES \
+# define SYSDEP_GETRES							      \
+  SYSDEP_GETRES_CPUTIME							      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    {									      \
-      int e = EINVAL;							      \
-									      \
-      if (!__libc_missing_posix_timers)					      \
-	{								      \
-	  INTERNAL_SYSCALL_DECL (err);					      \
-	  int r = INTERNAL_SYSCALL (clock_getres, err, 2, clock_id, res);     \
-	  if (!INTERNAL_SYSCALL_ERROR_P (r, err))			      \
-	    {								      \
-	      retval = 0;						      \
-	      break;							      \
-	    }								      \
-									      \
-	  e = INTERNAL_SYSCALL_ERRNO (r, err);				      \
-	  if (e == ENOSYS)						      \
-	    {								      \
-	      __libc_missing_posix_timers = 1;				      \
-	      e = EINVAL;						      \
-	    }								      \
-	}								      \
-									      \
-      /* Fallback code.  */						      \
-      if (e == EINVAL && clock_id == CLOCK_REALTIME)			      \
-	HANDLE_REALTIME;						      \
-      else								      \
-	__set_errno (e);						      \
-    }									      \
-    break
+    retval = maybe_syscall_getres (clock_id, res);			      \
+    if (retval == 0)							      \
+      break;								      \
+    /* Fallback code.  */						      \
+    if (retval == EINVAL && clock_id == CLOCK_REALTIME)			      \
+      retval = realtime_getres (res);					      \
+    else								      \
+      {									      \
+	__set_errno (retval);						      \
+	retval = -1;							      \
+      }									      \
+    break;
 #endif
 
 #ifdef __NR_clock_getres
 /* We handled the REALTIME clock here.  */
 # define HANDLED_REALTIME	1
+# define HANDLED_CPUTIME	1
+
+# if __ASSUME_POSIX_CPU_TIMERS > 0
+
+#  define SYSDEP_GETRES_CPU SYSCALL_GETRES
+#  define SYSDEP_GETRES_CPUTIME	/* Default catches them too.  */
+
+# else
+
+extern int __libc_missing_posix_cpu_timers attribute_hidden;
+
+static int
+maybe_syscall_getres_cpu (clockid_t clock_id, struct timespec *res)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_cpu_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_getres, err, 2, clock_id, res);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+# ifndef __ASSUME_POSIX_TIMERS
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	  e = EINVAL;
+	}
+      else
+# endif
+	{
+	  if (e == EINVAL)
+	    {
+	      /* Check whether the kernel supports CPU clocks at all.
+		 If not, record it for the future.  */
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
+				    MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+				    NULL);
+	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
+		__libc_missing_posix_cpu_timers = 1;
+	    }
+	}
+    }
+
+  return e;
+}
+
+#  define SYSDEP_GETRES_CPU						      \
+  retval = maybe_syscall_getres_cpu (clock_id, res);			      \
+  if (retval == 0)							      \
+    break;								      \
+  if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+    {									      \
+      __set_errno (retval);						      \
+      retval = -1;							      \
+      break;								      \
+    }									      \
+  retval = -1 /* Otherwise continue on to the HP_TIMING version.  */;
+
+static inline int
+maybe_syscall_getres_cputime (clockid_t clock_id, struct timespec *res)
+{
+  return maybe_syscall_getres_cpu
+    (clock_id == CLOCK_THREAD_CPUTIME_ID
+     ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED)
+     : MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+     res);
+}
+
+#  define SYSDEP_GETRES_CPUTIME						      \
+    case CLOCK_PROCESS_CPUTIME_ID:					      \
+    case CLOCK_THREAD_CPUTIME_ID:					      \
+      retval = maybe_syscall_getres_cputime (clock_id, res);		      \
+      if (retval == 0)							      \
+	break;								      \
+      if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+	{								      \
+	  __set_errno (retval);						      \
+	  retval = -1;							      \
+	  break;							      \
+	}								      \
+      retval = hp_timing_getres (res);					      \
+      break;
+#  if !HP_TIMING_AVAIL
+#   define hp_timing_getres(res) (__set_errno (EINVAL), -1)
+#  endif
+
+# endif
 #endif
 
 #include <sysdeps/posix/clock_getres.c>
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 522fac32a7..5afe20feb5 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* clock_gettime -- Get current time from a POSIX clockid_t.  Linux version.
+   Copyright (C) 2003,2004,2005,2006 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
@@ -17,60 +18,176 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+#include <errno.h>
+#include <time.h>
+#include "kernel-posix-cpu-timers.h"
+#include <kernel-features.h>
 
-#include "kernel-features.h"
+#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
 
+#define SYSCALL_GETTIME \
+  retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
+  break
 
 #ifdef __ASSUME_POSIX_TIMERS
+
 /* This means the REALTIME and MONOTONIC clock are definitely
    supported in the kernel.  */
-# define SYSDEP_GETTIME \
+# define SYSDEP_GETTIME							      \
+  SYSDEP_GETTIME_CPUTIME						      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    retval = INLINE_SYSCALL (clock_gettime, 2, clock_id, tp);		      \
-    break
+    SYSCALL_GETTIME
+
+# define __libc_missing_posix_timers 0
 #elif defined __NR_clock_gettime
 /* Is the syscall known to exist?  */
 int __libc_missing_posix_timers attribute_hidden;
 
+static inline int
+maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  e = EINVAL;
+	}
+    }
+
+  return e;
+}
+
 /* The REALTIME and MONOTONIC clock might be available.  Try the
    syscall first.  */
-# define SYSDEP_GETTIME \
+# define SYSDEP_GETTIME							      \
+  SYSDEP_GETTIME_CPUTIME						      \
   case CLOCK_REALTIME:							      \
   case CLOCK_MONOTONIC:							      \
-    {									      \
-      int e = EINVAL;							      \
-									      \
-      if (!__libc_missing_posix_timers)					      \
-	{								      \
-	  INTERNAL_SYSCALL_DECL (err);					      \
-	  int r = INTERNAL_SYSCALL (clock_gettime, err, 2, clock_id, tp);     \
-	  if (!INTERNAL_SYSCALL_ERROR_P (r, err))			      \
-	    {								      \
-	      retval = 0;						      \
-	      break;							      \
-	    }								      \
-									      \
-	  e = INTERNAL_SYSCALL_ERRNO (r, err);				      \
-	  if (e == ENOSYS)						      \
-	    {								      \
-	      __libc_missing_posix_timers = 1;				      \
-	      e = EINVAL;						      \
-	    }								      \
-	}								      \
-									      \
-      /* Fallback code.  */						      \
-      if (e == EINVAL && clock_id == CLOCK_REALTIME)			      \
-	HANDLE_REALTIME;						      \
-      else								      \
-	__set_errno (e);						      \
-    }									      \
-    break
+    retval = maybe_syscall_gettime (clock_id, tp);			      \
+    if (retval == 0)							      \
+      break;								      \
+    /* Fallback code.  */						      \
+    if (retval == EINVAL && clock_id == CLOCK_REALTIME)			      \
+      retval = realtime_gettime (tp);					      \
+    else 								      \
+      {									      \
+	__set_errno (retval);						      \
+	retval = -1;							      \
+      }									      \
+    break;
 #endif
 
 #ifdef __NR_clock_gettime
 /* We handled the REALTIME clock here.  */
 # define HANDLED_REALTIME	1
+# define HANDLED_CPUTIME	1
+
+# if __ASSUME_POSIX_CPU_TIMERS > 0
+
+#  define SYSDEP_GETTIME_CPU SYSCALL_GETTIME
+#  define SYSDEP_GETTIME_CPUTIME	/* Default catches them too.  */
+
+# else
+
+int __libc_missing_posix_cpu_timers attribute_hidden;
+
+static int
+maybe_syscall_gettime_cpu (clockid_t clock_id, struct timespec *tp)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_cpu_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+	return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+# ifndef __ASSUME_POSIX_TIMERS
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	  e = EINVAL;
+	}
+      else
+# endif
+	{
+	  if (e == EINVAL)
+	    {
+	      /* Check whether the kernel supports CPU clocks at all.
+		 If not, record it for the future.  */
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
+				    MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+				    NULL);
+	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
+		__libc_missing_posix_cpu_timers = 1;
+	    }
+	}
+    }
+
+  return e;
+}
+
+#  define SYSDEP_GETTIME_CPU						      \
+  retval = maybe_syscall_gettime_cpu (clock_id, tp);			      \
+  if (retval == 0)							      \
+    break;								      \
+  if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+    {									      \
+      __set_errno (retval);						      \
+      retval = -1;							      \
+      break;								      \
+    }									      \
+  retval = -1 /* Otherwise continue on to the HP_TIMING version.  */;
+
+static inline int
+maybe_syscall_gettime_cputime (clockid_t clock_id, struct timespec *tp)
+{
+  return maybe_syscall_gettime_cpu
+    (clock_id == CLOCK_THREAD_CPUTIME_ID
+     ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED)
+     : MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+     tp);
+}
+
+#  define SYSDEP_GETTIME_CPUTIME					      \
+    case CLOCK_PROCESS_CPUTIME_ID:					      \
+    case CLOCK_THREAD_CPUTIME_ID:					      \
+      retval = maybe_syscall_gettime_cputime (clock_id, tp);		      \
+      if (retval == 0)							      \
+	break;								      \
+      if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+	{								      \
+	  __set_errno (retval);						      \
+	  retval = -1;							      \
+	  break;							      \
+	}								      \
+      retval = hp_timing_gettime (clock_id, tp);			      \
+      break;
+#  if !HP_TIMING_AVAIL
+#   define hp_timing_gettime(clock_id, tp) (__set_errno (EINVAL), -1)
+#  endif
+
+# endif
 #endif
 
 #include <sysdeps/unix/clock_gettime.c>
diff --git a/sysdeps/unix/sysv/linux/clock_nanosleep.c b/sysdeps/unix/sysv/linux/clock_nanosleep.c
index 2a3dd411a1..7645262cee 100644
--- a/sysdeps/unix/sysv/linux/clock_nanosleep.c
+++ b/sysdeps/unix/sysv/linux/clock_nanosleep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 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
@@ -17,9 +17,11 @@
    02111-1307 USA.  */
 
 #include <time.h>
+#include <errno.h>
 
 #include <sysdep-cancel.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
+#include "kernel-posix-cpu-timers.h"
 
 
 #ifdef __ASSUME_POSIX_TIMERS
@@ -32,6 +34,11 @@ clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
   INTERNAL_SYSCALL_DECL (err);
   int r;
 
+  if (clock_id == CLOCK_THREAD_CPUTIME_ID)
+    return EINVAL;
+  if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
+    clock_id = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);
+
   if (SINGLE_THREAD_P)
     r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags, req, rem);
   else
@@ -58,12 +65,20 @@ extern int __libc_missing_posix_timers attribute_hidden;
 #  define SYSDEP_NANOSLEEP \
   if (!__libc_missing_posix_timers)					      \
     {									      \
+      clockid_t syscall_clockid;					      \
       INTERNAL_SYSCALL_DECL (err);					      \
 									      \
+      if (clock_id == CLOCK_THREAD_CPUTIME_ID)				      \
+	return EINVAL;							      \
+      if (clock_id == CLOCK_PROCESS_CPUTIME_ID)				      \
+	syscall_clockid = MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED);	      \
+      else								      \
+	syscall_clockid = clock_id;					      \
+									      \
       int oldstate = LIBC_CANCEL_ASYNC ();				      \
 									      \
-      int r = INTERNAL_SYSCALL (clock_nanosleep, err, 4, clock_id, flags,     \
-				req, rem);				      \
+      int r = INTERNAL_SYSCALL (clock_nanosleep, err, 4,		      \
+				syscall_clockid, flags, req, rem);	      \
 									      \
       LIBC_CANCEL_RESET (oldstate);					      \
 									      \
diff --git a/sysdeps/unix/sysv/linux/clock_settime.c b/sysdeps/unix/sysv/linux/clock_settime.c
index 5d19a09bf8..217ae3f29b 100644
--- a/sysdeps/unix/sysv/linux/clock_settime.c
+++ b/sysdeps/unix/sysv/linux/clock_settime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2006 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
@@ -16,9 +16,64 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <sysdep.h>
 
-#include "kernel-features.h"
+#include "kernel-posix-cpu-timers.h"
+#include <kernel-features.h>
+
+#ifndef HAVE_CLOCK_GETRES_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
+
+#if __ASSUME_POSIX_CPU_TIMERS <= 0 && defined __NR_clock_settime
+extern int __libc_missing_posix_timers attribute_hidden;
+extern int __libc_missing_posix_cpu_timers attribute_hidden;
+
+static int
+maybe_syscall_settime_cpu (clockid_t clock_id, const struct timespec *tp)
+{
+  int e = EINVAL;
+
+  if (!__libc_missing_posix_cpu_timers)
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      int r = INTERNAL_SYSCALL (clock_settime, err, 2, clock_id, tp);
+      if (!INTERNAL_SYSCALL_ERROR_P (r, err))
+        return 0;
+
+      e = INTERNAL_SYSCALL_ERRNO (r, err);
+# ifndef __ASSUME_POSIX_TIMERS
+      if (e == ENOSYS)
+	{
+	  __libc_missing_posix_timers = 1;
+	  __libc_missing_posix_cpu_timers = 1;
+	  e = EINVAL;
+	}
+      else
+# endif
+	{
+	  if (e == EINVAL)
+	    {
+	      /* Check whether the kernel supports CPU clocks at all.
+		 If not, record it for the future.  */
+	      r = INTERNAL_VSYSCALL (clock_getres, err, 2,
+				     MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED),
+				     NULL);
+	      if (INTERNAL_SYSCALL_ERROR_P (r, err))
+		__libc_missing_posix_cpu_timers = 1;
+	    }
+	}
+    }
+
+  return e;
+}
+#endif
 
 
 #ifdef __ASSUME_POSIX_TIMERS
@@ -73,4 +128,22 @@ extern int __libc_missing_posix_timers attribute_hidden;
 # define HANDLED_REALTIME	1
 #endif
 
+#if __ASSUME_POSIX_CPU_TIMERS > 0
+# define HANDLED_CPUTIME 1
+# define SYSDEP_SETTIME_CPU \
+  retval = INLINE_SYSCALL (clock_settime, 2, clock_id, tp)
+#elif defined __NR_clock_settime
+# define SYSDEP_SETTIME_CPU \
+  retval = maybe_syscall_settime_cpu (clock_id, tp);			      \
+  if (retval == 0)							      \
+    break;								      \
+  if (retval != EINVAL || !__libc_missing_posix_cpu_timers)		      \
+    {									      \
+      __set_errno (retval);						      \
+      retval = -1;							      \
+      break;								      \
+    }									      \
+  do { } while (0)
+#endif
+
 #include <sysdeps/unix/clock_settime.c>
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index d059143396..a8a9cc4702 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -115,10 +115,6 @@ case "$machine" in
     arch_minimum_kernel=2.0.10
     libc_cv_gcc_unwind_find_fde=yes
     ;;
-  mips*)
-    arch_minimum_kernel=2.4.0
-    libc_cv_gcc_unwind_find_fde=yes
-    ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -138,6 +134,10 @@ case "$machine" in
     arch_minimum_kernel=2.3.99
     libc_cv_gcc_unwind_find_fde=yes
     ;;
+  sparc/sparc64*)
+    libc_cv_gcc_unwind_find_fde=yes
+    arch_minimum_kernel=2.4.21
+    ;;
   sparc*)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -224,10 +224,12 @@ fi
 # in /lib and /etc.
 case "$prefix" in
 /usr | /usr/)
-  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
+  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
+  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
+  # and libc_cv_localedir.
+  test -n "$libc_cv_slibdir" || \
   case $machine in
-  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
-  mips/mips64/n64/* )
+  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
     libc_cv_slibdir="/lib64"
     if test "$libdir" = '${exec_prefix}/lib'; then
       libdir='${exec_prefix}/lib64';
@@ -235,14 +237,6 @@ case "$prefix" in
       libc_cv_localedir='${exec_prefix}/lib/locale'
     fi
     ;;
-  mips/mips64/n32/* )
-    libc_cv_slibdir="/lib32"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib32';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
   *)
     libc_cv_slibdir="/lib"
     ;;
@@ -257,38 +251,29 @@ case "$prefix" in
   ;;
 esac
 
-# Under Linux the LinuxThreads or NPTL add-on should be available.
+# Under Linux the NPTL add-on should be available.
 case $add_ons in
-  # Only one of the add-ons should be available.
-  *linuxthreads*nptl*|*nptl*linuxthreads*)
-    echo "\
-*** LinuxThreads and NPTL add-ons are both available.  Only one must be used."
-    exit 1
-    ;;
   # It is available.  Good.
-  *linuxthreads*)
-    linuxthreads_missing=
-    ;;
   *nptl*)
-    linuxthreads_missing=
+    nptl_missing=
     ;;
   *)
-    linuxthreads_missing=yes
+    nptl_missing=yes
     ;;
 esac
 
-if test "$linuxthreads_missing"; then
+if test "$nptl_missing"; then
   if test $enable_sanity = yes; then
     echo "\
 *** On GNU/Linux systems it is normal to compile GNU libc with the
-*** \`linuxthreads' add-on.  Without that, the library will be
+*** \`nptl' add-on.  Without that, the library will be
 *** incompatible with normal GNU/Linux systems.
 *** If you really mean to not use this add-on, run configure again
 *** using the extra parameter \`--disable-sanity-checks'."
     exit 1
   else
     echo "\
-*** WARNING: Are you sure you do not want to use the \`linuxthreads'
+*** WARNING: Are you sure you do not want to use the \`nptl'
 *** add-on?"
   fi
 fi
@@ -322,9 +307,6 @@ case "$machine" in
   ia64*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
     ;;
-  mips/*64*)
-    ldd_rewrite_script=../sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
-    ;;
   s390*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
     ;;
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index e3fccb4c9b..43681f3251 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -75,10 +75,6 @@ case "$machine" in
     arch_minimum_kernel=2.0.10
     libc_cv_gcc_unwind_find_fde=yes
     ;;
-  mips*)
-    arch_minimum_kernel=2.4.0
-    libc_cv_gcc_unwind_find_fde=yes
-    ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -98,6 +94,10 @@ case "$machine" in
     arch_minimum_kernel=2.3.99
     libc_cv_gcc_unwind_find_fde=yes
     ;;
+  sparc/sparc64*)
+    libc_cv_gcc_unwind_find_fde=yes
+    arch_minimum_kernel=2.4.21
+    ;;
   sparc*)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -159,10 +159,12 @@ fi
 # in /lib and /etc.
 case "$prefix" in
 /usr | /usr/)
-  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
+  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
+  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
+  # and libc_cv_localedir.
+  test -n "$libc_cv_slibdir" || \
   case $machine in
-  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
-  mips/mips64/n64/* )
+  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
     libc_cv_slibdir="/lib64"
     if test "$libdir" = '${exec_prefix}/lib'; then
       libdir='${exec_prefix}/lib64';
@@ -170,14 +172,6 @@ case "$prefix" in
       libc_cv_localedir='${exec_prefix}/lib/locale'
     fi
     ;;
-  mips/mips64/n32/* )
-    libc_cv_slibdir="/lib32"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib32';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
   *)
     libc_cv_slibdir="/lib"
     ;;
@@ -192,38 +186,29 @@ case "$prefix" in
   ;;
 esac
 
-# Under Linux the LinuxThreads or NPTL add-on should be available.
+# Under Linux the NPTL add-on should be available.
 case $add_ons in
-  # Only one of the add-ons should be available.
-  *linuxthreads*nptl*|*nptl*linuxthreads*)
-    echo "\
-*** LinuxThreads and NPTL add-ons are both available.  Only one must be used."
-    exit 1
-    ;;
   # It is available.  Good.
-  *linuxthreads*)
-    linuxthreads_missing=
-    ;;
   *nptl*)
-    linuxthreads_missing=
+    nptl_missing=
     ;;
   *)
-    linuxthreads_missing=yes
+    nptl_missing=yes
     ;;
 esac
 
-if test "$linuxthreads_missing"; then
+if test "$nptl_missing"; then
   if test $enable_sanity = yes; then
     echo "\
 *** On GNU/Linux systems it is normal to compile GNU libc with the
-*** \`linuxthreads' add-on.  Without that, the library will be
+*** \`nptl' add-on.  Without that, the library will be
 *** incompatible with normal GNU/Linux systems.
 *** If you really mean to not use this add-on, run configure again
 *** using the extra parameter \`--disable-sanity-checks'."
     exit 1
   else
     echo "\
-*** WARNING: Are you sure you do not want to use the \`linuxthreads'
+*** WARNING: Are you sure you do not want to use the \`nptl'
 *** add-on?"
   fi
 fi
@@ -257,9 +242,6 @@ case "$machine" in
   ia64*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
     ;;
-  mips/*64*)
-    ldd_rewrite_script=../sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
-    ;;
   s390*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
     ;;
diff --git a/sysdeps/unix/sysv/linux/device-nrs.h b/sysdeps/unix/sysv/linux/device-nrs.h
index 6b6578ec5f..b30c1dbede 100644
--- a/sysdeps/unix/sysv/linux/device-nrs.h
+++ b/sysdeps/unix/sysv/linux/device-nrs.h
@@ -1,5 +1,5 @@
 /* Device numbers of devices used in the implementation.  Linux version.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2005 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
@@ -26,6 +26,10 @@
 #define DEV_NULL_MAJOR	1
 #define DEV_NULL_MINOR	3
 
+/* /dev/full is (1,7).  */
+#define DEV_FULL_MAJOR	1
+#define DEV_FULL_MINOR	7
+
 /* Pseudo tty slaves.  For Linux we use the Unix98 ttys.  We could
    also include the old BSD-style tty buts they should not be used and
    the extra test would only slow down correctly set up systems.  If a
diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c
index 6ef9679045..fcac5ae240 100644
--- a/sysdeps/unix/sysv/linux/dl-execstack.c
+++ b/sysdeps/unix/sysv/linux/dl-execstack.c
@@ -1,5 +1,5 @@
 /* Stack executability handling for GNU dynamic linker.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006 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
@@ -24,8 +24,9 @@
 #include <stdbool.h>
 #include <stackinfo.h>
 #include <caller.h>
+#include <sysdep.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 extern int __stack_prot attribute_relro attribute_hidden;
@@ -38,6 +39,7 @@ _dl_make_stack_executable (void **stack_endp)
   /* This gives us the highest/lowest page that needs to be changed.  */
   uintptr_t page = ((uintptr_t) *stack_endp
 		    & -(intptr_t) GLRO(dl_pagesize));
+  int result = 0;
 
   /* Challenge the caller.  */
   if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
@@ -60,7 +62,10 @@ _dl_make_stack_executable (void **stack_endp)
 	no_growsupdown = true;
       else
 # endif
-	return errno;
+	{
+	  result = errno;
+	  goto out;
+	}
     }
 #endif
 
@@ -85,7 +90,10 @@ _dl_make_stack_executable (void **stack_endp)
       else
 	{
 	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    return errno;
+	    {
+	      result = errno;
+	      goto out;
+	    }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the top hole page and failed.
@@ -108,7 +116,10 @@ _dl_make_stack_executable (void **stack_endp)
       else
 	{
 	  if (errno != ENOMEM)	/* Unexpected failure mode.  */
-	    return errno;
+	    {
+	      result = errno;
+	      goto out;
+	    }
 
 	  if (size == GLRO(dl_pagesize))
 	    /* We just tried to mprotect the lowest hole page and failed.
@@ -133,6 +144,11 @@ _dl_make_stack_executable (void **stack_endp)
   /* Remember that we changed the permission.  */
   GL(dl_stack_flags) |= PF_X;
 
-  return 0;
+ out:
+#ifdef check_consistency
+  check_consistency ();
+#endif
+
+  return result;
 }
 rtld_hidden_def (_dl_make_stack_executable)
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index abc67fcdcf..3c93218dfc 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -1,5 +1,5 @@
-/* Operating system specific code  for generic dynamic loader functions.
-   Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Operating system specific code for generic dynamic loader functions.  Linux.
+   Copyright (C) 2000,2001,2002,2004,2005,2006 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
@@ -18,10 +18,14 @@
    02111-1307 USA.  */
 
 #include <string.h>
+#include <errno.h>
 #include <fcntl.h>
-#include <sys/sysctl.h>
 #include <sys/utsname.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
+#include <dl-sysdep.h>
+#include <stdint.h>
+#include <hp-timing.h>
+#include <endian.h>
 
 #ifndef MIN
 # define MIN(a,b) (((a)<(b))?(a):(b))
@@ -39,71 +43,167 @@ dl_fatal (const char *str)
 }
 #endif
 
+static inline int __attribute__ ((always_inline))
+_dl_discover_osversion (void)
+{
+#if (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO) && defined SHARED
+  if (GLRO(dl_sysinfo_map) != NULL)
+    {
+      /* If the kernel-supplied DSO contains a note indicating the kernel's
+	 version, we don't need to call uname or parse any strings.  */
+
+      static const struct
+      {
+	ElfW(Word) vendorlen;
+	ElfW(Word) datalen;
+	ElfW(Word) type;
+	char vendor[8];
+      } expected_note = { sizeof "Linux", sizeof (ElfW(Word)), 0, "Linux" };
+      const ElfW(Phdr) *const phdr = GLRO(dl_sysinfo_map)->l_phdr;
+      const ElfW(Word) phnum = GLRO(dl_sysinfo_map)->l_phnum;
+      for (uint_fast16_t i = 0; i < phnum; ++i)
+	if (phdr[i].p_type == PT_NOTE)
+	  {
+	    const ElfW(Addr) start = (phdr[i].p_vaddr
+				      + GLRO(dl_sysinfo_map)->l_addr);
+	    const struct
+	    {
+	      ElfW(Word) vendorlen;
+	      ElfW(Word) datalen;
+	      ElfW(Word) type;
+	    } *note = (const void *) start;
+	    while ((ElfW(Addr)) (note + 1) - start < phdr[i].p_memsz)
+	      {
+		if (!memcmp (note, &expected_note, sizeof expected_note))
+		  return *(const ElfW(Word) *) ((const void *) note
+						+ sizeof expected_note);
+#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word)))
+		note = ((const void *) (note + 1)
+			+ ROUND (note->vendorlen) + ROUND (note->datalen));
+	      }
+	  }
+    }
+#endif
+
+  char bufmem[64];
+  char *buf = bufmem;
+  unsigned int version;
+  int parts;
+  char *cp;
+  struct utsname uts;
+
+  /* Try the uname system call.  */
+  if (__uname (&uts))
+    {
+      /* This was not successful.  Now try reading the /proc filesystem.  */
+      int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY);
+      if (fd < 0)
+	return -1;
+      ssize_t reslen = __read (fd, bufmem, sizeof (bufmem));
+      __close (fd);
+      if (reslen <= 0)
+	/* This also didn't work.  We give up since we cannot
+	   make sure the library can actually work.  */
+	return -1;
+      buf[MIN (reslen, (ssize_t) sizeof (bufmem) - 1)] = '\0';
+    }
+  else
+    buf = uts.release;
+
+  /* Now convert it into a number.  The string consists of at most
+     three parts.  */
+  version = 0;
+  parts = 0;
+  cp = buf;
+  while ((*cp >= '0') && (*cp <= '9'))
+    {
+      unsigned int here = *cp++ - '0';
+
+      while ((*cp >= '0') && (*cp <= '9'))
+	{
+	  here *= 10;
+	  here += *cp++ - '0';
+	}
 
-#define DL_SYSDEP_OSCHECK(FATAL) \
+      ++parts;
+      version <<= 8;
+      version |= here;
+
+      if (*cp++ != '.')
+	/* Another part following?  */
+	break;
+    }
+
+  if (parts < 3)
+    version <<= 8 * (3 - parts);
+
+  return version;
+}
+
+#define DL_SYSDEP_OSCHECK(FATAL)					      \
   do {									      \
-    /* Test whether the kernel is new enough.  This test is only	      \
-       performed if the library is not compiled to run on all		      \
-       kernels.  */							      \
-    if (__LINUX_KERNEL_VERSION > 0)					      \
-      {									      \
-	char bufmem[64];						      \
-	char *buf = bufmem;						      \
-	unsigned int version;						      \
-	int parts;							      \
-	char *cp;							      \
-	struct utsname uts;						      \
-									      \
-	/* Try the uname syscall */					      \
-	if (__uname (&uts))					      	      \
-	  {							      	      \
-	    /* This was not successful.  Now try reading the /proc	      \
-	       filesystem.  */						      \
-	    ssize_t reslen;						      \
-	    int fd = __open ("/proc/sys/kernel/osrelease", O_RDONLY);	      \
-	    if (fd == -1						      \
-		|| (reslen = __read (fd, bufmem, sizeof (bufmem))) <= 0)      \
-  	      /* This also didn't work.  We give up since we cannot	      \
-		 make sure the library can actually work.  */		      \
-	      FATAL ("FATAL: cannot determine kernel version\n");	      \
-	    __close (fd);						      \
-	    buf[MIN (reslen, (ssize_t) sizeof (bufmem) - 1)] = '\0';	      \
-	  }								      \
-	else								      \
-          buf = uts.release;						      \
+    /* Test whether the kernel is new enough.  This test is only performed    \
+       if the library is not compiled to run on all kernels.  */	      \
 									      \
-	/* Now convert it into a number.  The string consists of at most      \
-	   three parts.  */						      \
-	version = 0;							      \
-	parts = 0;							      \
-	cp = buf;							      \
-	while ((*cp >= '0') && (*cp <= '9'))				      \
-	  {								      \
-	    unsigned int here = *cp++ - '0';				      \
-									      \
-	    while ((*cp >= '0') && (*cp <= '9'))			      \
-	      {								      \
-		here *= 10;						      \
-		here += *cp++ - '0';					      \
-	      }								      \
-									      \
-	    ++parts;							      \
-	    version <<= 8;						      \
-	    version |= here;						      \
-									      \
-	    if (*cp++ != '.')						      \
-	      /* Another part following?  */				      \
-	      break;							      \
-	  }								      \
-									      \
-	if (parts < 3)							      \
-	  version <<= 8 * (3 - parts);					      \
+    int version = _dl_discover_osversion ();				      \
+    if (__builtin_expect (version >= 0, 1))				      \
+      {									      \
+	if (__builtin_expect (GLRO(dl_osversion) == 0, 1)		      \
+	    || GLRO(dl_osversion) > version)				      \
+	  GLRO(dl_osversion) = version;					      \
 									      \
 	/* Now we can test with the required version.  */		      \
-	if (version < __LINUX_KERNEL_VERSION)				      \
+	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION)   \
 	  /* Not sufficent.  */						      \
 	  FATAL ("FATAL: kernel too old\n");				      \
-									      \
-	GLRO(dl_osversion) = version;					      \
       }									      \
+    else if (__LINUX_KERNEL_VERSION > 0)				      \
+      FATAL ("FATAL: cannot determine kernel version\n");		      \
   } while (0)
+
+static inline uintptr_t __attribute__ ((always_inline))
+_dl_setup_stack_chk_guard (void)
+{
+  uintptr_t ret;
+#ifdef ENABLE_STACKGUARD_RANDOMIZE
+  int fd = __open ("/dev/urandom", O_RDONLY);
+  if (fd >= 0)
+    {
+      ssize_t reslen = __read (fd, &ret, sizeof (ret));
+      __close (fd);
+      if (reslen == (ssize_t) sizeof (ret))
+	return ret;
+    }
+#endif
+  ret = 0;
+  unsigned char *p = (unsigned char *) &ret;
+  p[sizeof (ret) - 1] = 255;
+  p[sizeof (ret) - 2] = '\n';
+#ifdef HP_TIMING_NOW
+  hp_timing_t hpt;
+  HP_TIMING_NOW (hpt);
+  hpt = (hpt & 0xffff) << 8;
+  ret ^= hpt;
+#endif
+  uintptr_t stk;
+  /* Avoid GCC being too smart.  */
+  asm ("" : "=r" (stk) : "r" (p));
+  stk &= 0x7ffff0;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+  stk <<= (__WORDSIZE - 23);
+#elif __WORDSIZE == 64
+  stk <<= 31;
+#endif
+  ret ^= stk;
+  /* Avoid GCC being too smart.  */
+  p = (unsigned char *) &errno;
+  asm ("" : "=r" (stk) : "r" (p));
+  stk &= 0x7fff00;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+  stk <<= (__WORDSIZE - 29);
+#else
+  stk >>= 8;
+#endif
+  ret ^= stk;
+  return ret;
+}
diff --git a/sysdeps/unix/sysv/linux/dl-sbrk.c b/sysdeps/unix/sysv/linux/dl-sbrk.c
index 4713a92694..1ce5cb188c 100644
--- a/sysdeps/unix/sysv/linux/dl-sbrk.c
+++ b/sysdeps/unix/sysv/linux/dl-sbrk.c
@@ -2,4 +2,4 @@
    from ld.so.  */
 extern void *__curbrk attribute_hidden;
 
-#include <sbrk.c>
+#include <misc/sbrk.c>
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
index 79f95df0a2..42aec77e82 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
@@ -1,5 +1,5 @@
 /* Dynamic linker system dependencies for Linux.
-   Copyright (C) 1995, 1997, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1995,1997,2001,2004,2005,2006 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
@@ -22,7 +22,7 @@
 
 #include <unistd.h>
 #include <ldsodefs.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define DL_SYSDEP_INIT frob_brk ()
 
@@ -53,4 +53,4 @@ frob_brk (void)
 #endif
 }
 
-#include <sysdeps/generic/dl-sysdep.c>
+#include <elf/dl-sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.h b/sysdeps/unix/sysv/linux/dl-sysdep.h
new file mode 100644
index 0000000000..becfc8df3f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.h
@@ -0,0 +1,27 @@
+/* System-specific settings for dynamic linker code.  Linux version.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include_next <dl-sysdep.h>
+
+/* On many architectures the kernel provides a virtual DSO and gives
+   AT_SYSINFO_EHDR to point us to it.  As this is introduced for new
+   machines, we should look at it for unwind information even if
+   we aren't making direct use of it.  So enable this across the board.  */
+
+#define NEED_DL_SYSINFO_DSO	1
diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
new file mode 100644
index 0000000000..10b903d076
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/faccessat.c
@@ -0,0 +1,143 @@
+/* Test for access to file, relative to open directory.  Linux version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <alloca.h>
+#include <kernel-features.h>
+#include <sysdep.h>
+
+
+int
+faccessat (fd, file, mode, flag)
+     int fd;
+     const char *file;
+     int mode;
+     int flag;
+{
+  if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+#ifdef __NR_faccessat
+  if ((flag == 0 || ((flag & ~AT_EACCESS) == 0 && ! __libc_enable_secure))
+# ifndef __ASSUME_ATFCTS
+      && __have_atfcts >= 0
+# endif
+      )
+    {
+      int result = INLINE_SYSCALL (faccessat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if ((!(flag & AT_EACCESS) || ! __libc_enable_secure)
+# ifndef __NR_laccess		/* Linux so far has no laccess syscall.  */
+      && !(flag & AT_SYMLINK_NOFOLLOW)
+# endif
+      )
+    {
+      /* If we are not set-uid or set-gid, access does the same.  */
+      char *buf = NULL;
+
+      if (fd != AT_FDCWD && file[0] != '/')
+	{
+	  size_t filelen = strlen (file);
+	  static const char procfd[] = "/proc/self/fd/%d/%s";
+	  /* Buffer for the path name we are going to use.  It consists of
+	     - the string /proc/self/fd/
+	     - the file descriptor number
+	     - the file name provided.
+	     The final NUL is included in the sizeof.   A bit of overhead
+	     due to the format elements compensates for possible negative
+	     numbers.  */
+	  size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+	  buf = alloca (buflen);
+
+	  __snprintf (buf, buflen, procfd, fd, file);
+	  file = buf;
+	}
+
+      int result;
+      INTERNAL_SYSCALL_DECL (err);
+
+# ifdef __NR_laccess
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (laccess, err, 2, file, mode);
+      else
+# endif
+	result = INTERNAL_SYSCALL (access, err, 2, file, mode);
+
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+	{
+	  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+	  result = -1;
+	}
+
+      return result;
+    }
+#endif
+
+  struct stat64 stats;
+  if (fstatat64 (fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW))
+    return -1;
+
+  mode &= (X_OK | W_OK | R_OK);	/* Clear any bogus bits. */
+#if R_OK != S_IROTH || W_OK != S_IWOTH || X_OK != S_IXOTH
+# error Oops, portability assumptions incorrect.
+#endif
+
+  if (mode == F_OK)
+    return 0;			/* The file exists. */
+
+  uid_t uid = (flag & AT_EACCESS) ? __geteuid () : __getuid ();
+
+  /* The super-user can read and write any file, and execute any file
+     that anyone can execute. */
+  if (uid == 0 && ((mode & X_OK) == 0
+		   || (stats.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))))
+    return 0;
+
+  int granted = (uid == stats.st_uid
+		 ? (unsigned int) (stats.st_mode & (mode << 6)) >> 6
+		 : (stats.st_gid == ((flag & AT_EACCESS)
+				     ? __getegid () : __getgid ())
+		    || __group_member (stats.st_gid))
+		 ? (unsigned int) (stats.st_mode & (mode << 3)) >> 3
+		 : (stats.st_mode & mode));
+
+  if (granted == mode)
+    return 0;
+
+  __set_errno (EACCES);
+  return -1;
+}
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
new file mode 100644
index 0000000000..8b420153f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -0,0 +1,106 @@
+/* Change the protections of file relative to open directory.  Linux version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <alloca.h>
+#include <kernel-features.h>
+#include <sysdep.h>
+
+int
+fchmodat (fd, file, mode, flag)
+     int fd;
+     const char *file;
+     mode_t mode;
+     int flag;
+{
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+#ifndef __NR_lchmod		/* Linux so far has no lchmod syscall.  */
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (ENOTSUP);
+      return -1;
+    }
+#endif
+
+  int result;
+
+#ifdef __NR_fchmodat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchmodat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+# ifdef __NR_lchmod
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchmod, err, 2, file, mode);
+  else
+# endif
+    result = INTERNAL_SYSCALL (chmod, err, 2, file, mode);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/fchownat.c b/sysdeps/unix/sysv/linux/fchownat.c
new file mode 100644
index 0000000000..0f731775b3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fchownat.c
@@ -0,0 +1,99 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <alloca.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+
+/* Change the owner and group of FILE.  */
+int
+fchownat (fd, file, owner, group, flag)
+     int fd;
+     const char *file;
+     uid_t owner;
+     gid_t group;
+     int flag;
+{
+  int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchown, err, 3, file, owner, group);
+  else
+    result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/fstatvfs64.c b/sysdeps/unix/sysv/linux/fstatvfs64.c
index 18f2f6dc7b..24c0a8fedc 100644
--- a/sysdeps/unix/sysv/linux/fstatvfs64.c
+++ b/sysdeps/unix/sysv/linux/fstatvfs64.c
@@ -1,5 +1,6 @@
 /* Return information about the filesystem on which FD resides.
-   Copyright (C) 1996,1997,1998,2000,2001,2004 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,2000,2001,2004,2006
+	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
@@ -22,7 +23,7 @@
 #include <sys/stat.h>
 #include <sys/statfs.h>
 #include <sys/statvfs.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 extern void __internal_statvfs64 (const char *name, struct statvfs64 *buf,
diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c
index 26caee2f46..60e7ae0ac7 100644
--- a/sysdeps/unix/sysv/linux/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/ftruncate64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2001,2003,2005,2006
+	 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
@@ -24,7 +25,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_ftruncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -72,5 +73,5 @@ weak_alias (__ftruncate64, ftruncate64)
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/ftruncate64.c>
+# include <misc/ftruncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c
index f43f568ec1..b307c3ff64 100644
--- a/sysdeps/unix/sysv/linux/futimes.c
+++ b/sysdeps/unix/sysv/linux/futimes.c
@@ -1,5 +1,5 @@
 /* futimes -- change access and modification times of open file.  Linux version.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002,2003,2005,2006 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
@@ -23,8 +23,9 @@
 #include <utime.h>
 #include <sys/time.h>
 #include <stdio-common/_itoa.h>
+#include <fcntl.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* Change the access time of FILE to TVP[0] and
    the modification time of FILE to TVP[1], but do not follow symlinks.
@@ -40,31 +41,61 @@ __futimes (int fd, const struct timeval tvp[2])
   char *cp = _itoa_word ((unsigned int) fd, fname + sizeof (fname) - 1, 10, 0);
   cp = memcpy (cp - sizeof (selffd) + 1, selffd, sizeof (selffd) - 1);
 
+  int result;
 #ifdef __NR_utimes
-  int result = INLINE_SYSCALL (utimes, 2, cp, tvp);
+  result = INLINE_SYSCALL (utimes, 2, cp, tvp);
 # ifndef __ASSUME_UTIMES
-  if (result != -1 || errno != ENOSYS)
+  if (result == -1 && errno == ENOSYS)
 # endif
-    return result;
 #endif
-
-  /* The utimes() syscall does not exist or is not available in the
-     used kernel.  Use utime().  For this we have to convert to the
-     data format utime() expects.  */
+    {
+      /* The utimes() syscall does not exist or is not available in the
+	 used kernel.  Use utime().  For this we have to convert to the
+	 data format utime() expects.  */
 #ifndef __ASSUME_UTIMES
-  struct utimbuf buf;
-  struct utimbuf *times;
+      struct utimbuf buf;
+      struct utimbuf *times;
 
-  if (tvp != NULL)
-    {
-      times = &buf;
-      buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000;
-      buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000;
+      if (tvp != NULL)
+	{
+	  times = &buf;
+	  buf.actime = tvp[0].tv_sec + (tvp[0].tv_usec + 500000) / 1000000;
+	  buf.modtime = tvp[1].tv_sec + (tvp[1].tv_usec + 500000) / 1000000;
+	}
+      else
+	times = NULL;
+
+      result = INLINE_SYSCALL (utime, 2, cp, times);
+#endif
     }
-  else
-    times = NULL;
 
-  return INLINE_SYSCALL (utime, 2, cp, times);
+  if (result == -1)
+    /* Check for errors that result from failing to find /proc.
+       This means we can't do futimes at all, so return ENOSYS
+       rather than some confusing error.  */
+    switch (errno)
+      {
+      case EACCES:
+	if (tvp == NULL)  /* Could be a path problem or a file problem.  */
+	  break;
+	/*FALLTHROUGH*/
+      case ELOOP:
+      case ENAMETOOLONG:
+      case ENOTDIR:
+	__set_errno (ENOSYS);
+	break;
+
+      case ENOENT:
+	/* Validate the file descriptor by letting fcntl set errno to
+	   EBADF if it's bogus.  Otherwise it's a /proc issue.  */
+#if !defined __NR_fcntl && defined __NR_fcntl64
+# define __NR_fcntl __NR_fcntl64
 #endif
+	if (INLINE_SYSCALL (fcntl, 3, fd, F_GETFD, 0) != -1)
+	  __set_errno (ENOSYS);
+	break;
+      }
+
+  return result;
 }
 weak_alias (__futimes, futimes)
diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c
new file mode 100644
index 0000000000..5f3a3f52f3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/futimesat.c
@@ -0,0 +1,119 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <utime.h>
+#include <sys/time.h>
+#include <sysdep.h>
+#include <kernel-features.h>
+
+
+/* Change the access time of FILE relative to FD to TVP[0] and
+   the modification time of FILE to TVP[1].  */
+int
+futimesat (fd, file, tvp)
+     int fd;
+     const char *file;
+     const struct timeval tvp[2];
+{
+  int result;
+
+  if (file == NULL)
+    return __futimes (fd, tvp);
+
+#ifdef __NR_futimesat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (futimesat, 3, fd, file, tvp);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+# ifdef __NR_utimes
+  result = INTERNAL_SYSCALL (utimes, err, 2, file, tvp);
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return result;
+
+#  ifndef __ASSUME_UTIMES
+  if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+    goto fail;
+#  endif
+# endif
+
+  /* The utimes() syscall does not exist or is not available in the
+     used kernel.  Use utime().  For this we have to convert to the
+     data format utime() expects.  */
+# ifndef __ASSUME_UTIMES
+  struct utimbuf tmp;
+  struct utimbuf *times;
+
+  if (tvp != NULL)
+    {
+      times = &tmp;
+      tmp.actime = tvp[0].tv_sec + tvp[0].tv_usec / 1000000;
+      tmp.modtime = tvp[1].tv_sec + tvp[1].tv_usec / 1000000;
+    }
+  else
+    times = NULL;
+
+  result = INTERNAL_SYSCALL (utime, err, 2, file, times);
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return result;
+
+ fail:
+# endif
+
+  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+  return -1;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
index f443adf7da..6bc560152c 100644
--- a/sysdeps/unix/sysv/linux/fxstat64.c
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -1,5 +1,5 @@
 /* fxstat64 using old-style Unix fstat system call.
-   Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2002, 2003, 2006 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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_STAT64_SYSCALL == 0
 # include <xstatconv.h>
diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c
new file mode 100644
index 0000000000..c1c416abd7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fxstatat.c
@@ -0,0 +1,141 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc
+   will complain since they don't strictly match.  */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <xstatconv.h>
+
+/* Get information about the file NAME in BUF.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  int result;
+  INTERNAL_SYSCALL_DECL (err);
+#ifdef STAT_IS_KERNEL_STAT
+# define kst (*st)
+#else
+  struct kernel_stat kst;
+#endif
+
+#ifdef __NR_newfstatat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INTERNAL_SYSCALL (newfstatat, err, 4, fd, file, &kst, flag);
+# ifndef __ASSUME_ATFCTS
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  && INTERNAL_SYSCALL_ERRNO (result, err) == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	  {
+#ifdef STAT_IS_KERNEL_STAT
+	    return 0;
+#else
+	    return __xstat_conv (vers, &kst, st);
+#endif
+	  }
+	else
+	  {
+	    __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+	    return -1;
+	  }
+    }
+#endif
+
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  if (vers == _STAT_VER_KERNEL)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+      else
+	result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	return result;
+    }
+#ifdef STAT_IS_KERNEL_STAT
+  else
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+#else
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat_conv (vers, &kst, st);
+#endif
+
+  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+  return -1;
+}
+libc_hidden_def (__fxstatat)
+#ifdef XSTAT_IS_XSTAT64
+# undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+libc_hidden_def (__fxstatat64)
+#endif
diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c
new file mode 100644
index 0000000000..cb932b8e59
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/fxstatat64.c
@@ -0,0 +1,167 @@
+/* Copyright (C) 2005,2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#if __ASSUME_STAT64_SYSCALL == 0
+# include <xstatconv.h>
+#endif
+
+#ifdef __NR_stat64
+# if  __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat64 calls.
+   This is the definition.  */
+extern int __have_no_stat64;
+# endif
+#endif
+
+/* Get information about the file NAME in BUF.  */
+
+int
+__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
+{
+  if (__builtin_expect (vers != _STAT_VER_LINUX, 0))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  int result;
+  INTERNAL_SYSCALL_DECL (err);
+
+#ifdef __NR_fstatat64
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag);
+# ifndef __ASSUME_ATFCTS
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  && INTERNAL_SYSCALL_ERRNO (result, err) == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	  return 0;
+	else
+	  {
+	    __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+	    return -1;
+	  }
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_STAT64_SYSCALL > 0
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+			       CHECK_1 (st));
+  else
+    result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+			       CHECK_1 (st));
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    {
+#  if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+      if (st->__st_ino != (__ino_t) st->st_ino)
+	st->st_ino = st->__st_ino;
+#  endif
+      return result;
+    }
+# else
+  struct kernel_stat kst;
+#  ifdef __NR_stat64
+  if (! __have_no_stat64)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+				   CHECK_1 (st));
+      else
+	result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+				   CHECK_1 (st));
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	{
+#   if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0
+	  if (st->__st_ino != (__ino_t) st->st_ino)
+	    st->st_ino = st->__st_ino;
+#   endif
+	  return result;
+	}
+      if (INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+	goto fail;
+
+      __have_no_stat64 = 1;
+    }
+#  endif
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat64_conv (vers, &kst, st);
+
+ fail:
+# endif
+  __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+
+  return -1;
+#endif
+}
+libc_hidden_def (__fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c
index 3e67add0d7..0c6654a386 100644
--- a/sysdeps/unix/sysv/linux/gai_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2003, 2005 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
@@ -52,5 +52,5 @@ __gai_sigqueue (sig, val, caller_pid)
 			 sig, __ptrvalue (&info));
 }
 #else
-# include <sysdeps/generic/gai_sigqueue.c>
+# include <resolv/gai_sigqueue.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index 9695d8a035..911d85f43d 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -1,5 +1,6 @@
 /* Determine current working directory.  Linux version.
-   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -28,7 +29,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* If we compile the file for use in ld.so we don't need the feature
@@ -86,7 +87,7 @@ __getcwd (char *buf, size_t size)
 	  return NULL;
 	}
 
-      alloc_size = PATH_MAX;
+      alloc_size = MAX (PATH_MAX, __getpagesize ());
     }
 
   if (buf == NULL)
diff --git a/sysdeps/unix/sysv/linux/getdents.c b/sysdeps/unix/sysv/linux/getdents.c
index d473486de8..836cbf3922 100644
--- a/sysdeps/unix/sysv/linux/getdents.c
+++ b/sysdeps/unix/sysv/linux/getdents.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-2003, 2004, 2006 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
@@ -33,15 +33,15 @@
 
 #include <linux/posix_types.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getdents64
 # ifndef __ASSUME_GETDENTS64_SYSCALL
 #  ifndef __GETDENTS
 /* The variable is shared between all *getdents* calls.  */
-int __have_no_getdents64;
+int __have_no_getdents64 attribute_hidden;
 #  else
-extern int __have_no_getdents64;
+extern int __have_no_getdents64 attribute_hidden;
 #  endif
 #  define have_no_getdents64_defined 1
 # endif
diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
index f44a9afbf2..de98fb3d7b 100644
--- a/sysdeps/unix/sysv/linux/gethostid.c
+++ b/sysdeps/unix/sysv/linux/gethostid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1998-2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998-2001,2003,2004,2006
+   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
@@ -24,7 +25,6 @@
 #include <not-cancel.h>
 
 #define HOSTIDFILE "/etc/hostid"
-#define OLD_HOSTIDFILE "/etc/hostid"
 
 #ifdef SET_PROCEDURE
 int
@@ -81,8 +81,6 @@ gethostid ()
 
   /* First try to get the ID from a former invocation of sethostid.  */
   fd = open_not_cancel (HOSTIDFILE, O_RDONLY|O_LARGEFILE, 0);
-  if (fd < 0)
-    fd = open_not_cancel (OLD_HOSTIDFILE, O_RDONLY|O_LARGEFILE, 0);
   if (fd >= 0)
     {
       ssize_t n = read_not_cancel (fd, &id, sizeof (id));
diff --git a/sysdeps/unix/sysv/linux/getloadavg.c b/sysdeps/unix/sysv/linux/getloadavg.c
index 6a521431ba..81a1c0dd52 100644
--- a/sysdeps/unix/sysv/linux/getloadavg.c
+++ b/sysdeps/unix/sysv/linux/getloadavg.c
@@ -1,5 +1,5 @@
 /* Get system load averages.  Linux (/proc/loadavg) version.
-   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2003, 2005 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
@@ -55,7 +55,7 @@ getloadavg (double loadavg[], int nelem)
       for (i = 0; i < nelem; ++i)
 	{
 	  char *endp;
-	  loadavg[i] = __strtod_l (p, &endp, &_nl_C_locobj);
+	  loadavg[i] = __strtod_l (p, &endp, _nl_C_locobj_ptr);
 	  if (endp == p)
 	    /* This should not happen.  The format of /proc/loadavg
 	       must have changed.  Don't return with what we have,
diff --git a/sysdeps/unix/sysv/linux/getsourcefilter.c b/sysdeps/unix/sysv/linux/getsourcefilter.c
index fdcf8d6130..a6f89a3cc9 100644
--- a/sysdeps/unix/sysv/linux/getsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/getsourcefilter.c
@@ -1,5 +1,5 @@
 /* Get source filter.  Linux version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -112,23 +112,27 @@ getsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
   gf->gf_numsrc = *numsrc;
 
   /* We need to provide the appropriate socket level value.  */
+  int result;
   int sol = __get_sol (group->sa_family, grouplen);
   if (sol == -1)
     {
       __set_errno (EINVAL);
-      return -1;
+      result = -1;
     }
-
-  int result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
-
-  /* If successful, copy the results to the places the caller wants
-     them in.  */
-  if (result == 0)
+  else
     {
-      *fmode = gf->gf_fmode;
-      memcpy (slist, gf->gf_slist,
-	      MIN (*numsrc, gf->gf_numsrc) * sizeof (struct sockaddr_storage));
-      *numsrc = gf->gf_numsrc;
+      result = __getsockopt (s, sol, MCAST_MSFILTER, gf, &needed);
+
+      /* If successful, copy the results to the places the caller wants
+	 them in.  */
+      if (result == 0)
+	{
+	  *fmode = gf->gf_fmode;
+	  memcpy (slist, gf->gf_slist,
+		  MIN (*numsrc, gf->gf_numsrc)
+		  * sizeof (struct sockaddr_storage));
+	  *numsrc = gf->gf_numsrc;
+	}
     }
 
   if (! use_alloca)
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 985a0860cb..d655ba3b27 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -1,5 +1,5 @@
 /* Determine various system internal values, Linux version.
-   Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2002, 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -34,75 +34,6 @@
 #include <atomic.h>
 
 
-/* The default value for the /proc filesystem mount point.  */
-static const char path_proc[] = "/proc";
-
-/* Actual mount point of /proc filesystem.  */
-libc_freeres_ptr (static char *mount_proc);
-
-/* Determine the path to the /proc filesystem if available.  */
-static const char *
-internal_function
-get_proc_path (char *buffer, size_t bufsize)
-{
-  struct mntent mount_point;
-  struct mntent *entry;
-  char *result = NULL;
-  char *copy_result;
-  FILE *fp;
-
-  /* First find the mount point of the proc filesystem.  */
-  fp = __setmntent (_PATH_MOUNTED, "r");
-  if (fp == NULL)
-    fp = __setmntent (_PATH_MNTTAB, "r");
-  if (fp != NULL)
-    {
-      /* We don't need locking.  */
-      (void) __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
-      while ((entry = __getmntent_r (fp, &mount_point, buffer, bufsize))
-	     != NULL)
-	if (strcmp (mount_point.mnt_type, "proc") == 0)
-	  {
-	    result = mount_point.mnt_dir;
-	    break;
-	  }
-      __endmntent (fp);
-    }
-
-  /* If we haven't found anything this is generally a bad sign but we
-     handle it gracefully.  We return what is hopefully the right
-     answer (/proc) but we don't remember this.  This will enable
-     programs which started before the system is fully running to
-     adjust themselves.  */
-  if (result == NULL)
-    return path_proc;
-
-  /* Make a copy we can keep around.  */
-  copy_result = __strdup (result);
-  if (copy_result == NULL)
-    return result;
-
-  /* Now store the copied value.  But do it atomically.  */
-  assert (sizeof (long int) == sizeof (void *__unbounded));
-  if (atomic_compare_and_exchange_bool_acq (&mount_proc, copy_result, NULL))
-    /* Replacing the value failed.  This means another thread was
-       faster and we don't need the copy anymore.  */
-    free (copy_result);
-#if __BOUNDED_POINTERS__
-  else
-    {
-      /* compare_and_swap only copied the pointer value, so we must
-	 now copy the bounds as well.  */
-      __ptrlow (mount_proc) = __ptrlow (copy_result);
-      __ptrhigh (mount_proc) = __ptrhigh (copy_result);
-    }
-#endif
-
-  return mount_proc;
-}
-
-
 /* How we can determine the number of available processors depends on
    the configuration.  There is currently (as of version 2.0.21) no
    system call to determine the number.  It is planned for the 2.1.x
@@ -136,50 +67,35 @@ get_proc_path (char *buffer, size_t bufsize)
 int
 __get_nprocs ()
 {
-  FILE *fp;
   char buffer[8192];
-  const char *proc_path;
   int result = 1;
 
   /* XXX Here will come a test for the new system call.  */
 
-  /* Get mount point of proc filesystem.  */
-  proc_path = get_proc_path (buffer, sizeof buffer);
-
-  /* If we haven't found an appropriate entry return 1.  */
-  if (proc_path != NULL)
+  /* The /proc/stat format is more uniform, use it by default.  */
+  FILE *fp = fopen ("/proc/stat", "rc");
+  if (fp != NULL)
     {
-      char *proc_fname = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
+      /* No threads use this stream.  */
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
 
-      /* The /proc/stat format is more uniform, use it by default.  */
-      __stpcpy (__stpcpy (proc_fname, proc_path), "/stat");
+      result = 0;
+      while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
+	if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
+	  ++result;
 
-      fp = fopen (proc_fname, "rc");
+      fclose (fp);
+    }
+  else
+    {
+      fp = fopen ("/proc/cpuinfo", "rc");
       if (fp != NULL)
 	{
 	  /* No threads use this stream.  */
 	  __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
-	  result = 0;
-	  while (fgets_unlocked (buffer, sizeof (buffer), fp) != NULL)
-	    if (strncmp (buffer, "cpu", 3) == 0 && isdigit (buffer[3]))
-	      ++result;
-
+	  GET_NPROCS_PARSER (fp, buffer, result);
 	  fclose (fp);
 	}
-      else
-	{
-	  __stpcpy (__stpcpy (proc_fname, proc_path), "/cpuinfo");
-
-	  fp = fopen (proc_fname, "rc");
-	  if (fp != NULL)
-	    {
-	      /* No threads use this stream.  */
-	      __fsetlocking (fp, FSETLOCKING_BYCALLER);
-	      GET_NPROCS_PARSER (fp, buffer, result);
-	      fclose (fp);
-	    }
-	}
     }
 
   return result;
@@ -193,30 +109,19 @@ weak_alias (__get_nprocs, get_nprocs)
 int
 __get_nprocs_conf ()
 {
-  FILE *fp;
   char buffer[8192];
-  const char *proc_path;
   int result = 1;
 
   /* XXX Here will come a test for the new system call.  */
 
-  /* Get mount point of proc filesystem.  */
-  proc_path = get_proc_path (buffer, sizeof buffer);
-
   /* If we haven't found an appropriate entry return 1.  */
-  if (proc_path != NULL)
+  FILE *fp = fopen ("/proc/cpuinfo", "rc");
+  if (fp != NULL)
     {
-      char *proc_cpuinfo = alloca (strlen (proc_path) + sizeof ("/cpuinfo"));
-      __stpcpy (__stpcpy (proc_cpuinfo, proc_path), "/cpuinfo");
-
-      fp = fopen (proc_cpuinfo, "rc");
-      if (fp != NULL)
-	{
-	  /* No threads use this stream.  */
-	  __fsetlocking (fp, FSETLOCKING_BYCALLER);
-	  GET_NPROCS_CONF_PARSER (fp, buffer, result);
-	  fclose (fp);
-	}
+      /* No threads use this stream.  */
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
+      GET_NPROCS_CONF_PARSER (fp, buffer, result);
+      fclose (fp);
     }
 
   return result;
@@ -235,40 +140,29 @@ static long int
 internal_function
 phys_pages_info (const char *format)
 {
-  FILE *fp;
   char buffer[8192];
-  const char *proc_path;
   long int result = -1;
 
-  /* Get mount point of proc filesystem.  */
-  proc_path = get_proc_path (buffer, sizeof buffer);
-
   /* If we haven't found an appropriate entry return 1.  */
-  if (proc_path != NULL)
+  FILE *fp = fopen ("/proc/meminfo", "rc");
+  if (fp != NULL)
     {
-      char *proc_meminfo = alloca (strlen (proc_path) + sizeof ("/meminfo"));
-      __stpcpy (__stpcpy (proc_meminfo, proc_path), "/meminfo");
-
-      fp = fopen (proc_meminfo, "rc");
-      if (fp != NULL)
-	{
-	  /* No threads use this stream.  */
-	  __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
-	  result = 0;
-	  /* Read all lines and count the lines starting with the
-	     string "processor".  We don't have to fear extremely long
-	     lines since the kernel will not generate them.  8192
-	     bytes are really enough.  */
-	  while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
-	    if (sscanf (buffer, format, &result) == 1)
-	      {
-		result /= (__getpagesize () / 1024);
-		break;
-	      }
+      /* No threads use this stream.  */
+      __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+      result = 0;
+      /* Read all lines and count the lines starting with the
+	 string "processor".  We don't have to fear extremely long
+	 lines since the kernel will not generate them.  8192
+	 bytes are really enough.  */
+      while (fgets_unlocked (buffer, sizeof buffer, fp) != NULL)
+	if (sscanf (buffer, format, &result) == 1)
+	  {
+	    result /= (__getpagesize () / 1024);
+	    break;
+	  }
 
-	  fclose (fp);
-	}
+      fclose (fp);
     }
 
   if (result == -1)
diff --git a/sysdeps/unix/sysv/linux/hppa/Dist b/sysdeps/unix/sysv/linux/hppa/Dist
deleted file mode 100644
index 2954d3c4bf..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/Dist
+++ /dev/null
@@ -1,5 +0,0 @@
-umount.c
-kernel_stat.h
-kernel_sigaction.h
-clone.S
-sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/hppa/Makefile b/sysdeps/unix/sysv/linux/hppa/Makefile
deleted file mode 100644
index 1c93ec52d9..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# linux/hppa does not use -lmilli anymore
-gnulib := -lgcc
diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
deleted file mode 100644
index e15c8225fb..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/Versions
+++ /dev/null
@@ -1,25 +0,0 @@
-libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
-  GLIBC_2.1 {
-    #errlist-compat	253
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-  }
-  GLIBC_2.2 {
-    # New rlimit interface
-    getrlimit; setrlimit; getrlimit64; setrlimit64;
-  }
-  GLIBC_2.3 {
-    #errlist-compat	254
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-  }
-}
-librt {
-  GLIBC_2.3 {
-    # AIO functions.
-    aio_cancel; aio_cancel64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/errno.h b/sysdeps/unix/sysv/linux/hppa/bits/errno.h
deleted file mode 100644
index 003d71f622..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/errno.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Error constants.  Linux/HPPA specific version.
-   Copyright (C) 1996,1997,1998,1999,2000,2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef _ERRNO_H
-
-# undef EDOM
-# undef EILSEQ
-# undef ERANGE
-# include <linux/errno.h>
-
-/* Linux also has no ECANCELED error code.  Since it is not used here
-   we define it to an invalid value.  */
-# ifndef ECANCELED
-#  define ECANCELED	ECANCELLED
-# endif
-
-# ifndef __ASSEMBLER__
-/* Function to get address of global `errno' variable.  */
-extern int *__errno_location (void) __THROW __attribute__ ((__const__));
-
-#  if !defined _LIBC || defined _LIBC_REENTRANT
-/* When using threads, errno is a per-thread value.  */
-#   define errno (*__errno_location ())
-#  endif
-# endif /* !__ASSEMBLER__ */
-#endif /* _ERRNO_H */
-
-#if !defined _ERRNO_H && defined __need_Emath
-/* This is ugly but the kernel header is not clean enough.  We must
-   define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
-   defined.  */
-# define EDOM	33	/* Math argument out of domain of function.  */
-# define EILSEQ	47	/* Illegal byte sequence.  */
-# define ERANGE	34	/* Math result not representable.  */
-#endif /* !_ERRNO_H && __need_Emath */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h b/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
deleted file mode 100644
index 9d967c6475..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/fcntl.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux/HPPA.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-#include <sys/types.h>
-
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_RDONLY	00000000
-#define O_WRONLY	00000001
-#define O_RDWR		00000002
-#define O_ACCMODE	00000003
-#define O_APPEND	00000010
-#define O_BLKSEEK	00000100 /* HPUX only */
-#define O_CREAT		00000400 /* not fcntl */
-#define O_TRUNC		00001000 /* not fcntl */
-#define O_EXCL		00002000 /* not fcntl */
-#define O_ASYNC		00020000
-#define O_SYNC		00100000
-#define O_NONBLOCK	00200004 /* HPUX has separate NDELAY & NONBLOCK */
-#define O_NDELAY	O_NONBLOCK
-#define O_NOCTTY	00400000 /* not fcntl */
-
-
-#ifdef __USE_GNU
-# define O_DIRECT	00040000 /* direct disk access hint - currently ignored */
-# define O_DIRECTORY	00010000 /* must be a directory */
-# define O_NOFOLLOW	00000200 /* don't follow links */
-# define O_NOATIME	04000000 /* Do not set atime.  */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	00004000
-#endif
-
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC		01000000 /* HPUX only */
-# define O_RSYNC		02000000 /* HPUX only */
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	5	/* Get record locking info.  */
-# define F_SETLK	6    	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).  */
-#else
-# define F_GETLK	F_GETLK64 /* Get record locking info.  */
-# define F_SETLK	F_SETLK64 /* Set record locking info (non-blocking). */
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-
-#define F_GETLK64	8	/* Get record locking info.  */
-#define F_SETLK64	9	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	10	/* Set record locking info (blocking).  */
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_GETOWN	11	/* Get owner of socket (receiver of SIGIO).  */
-# define F_SETOWN	12	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	13	/* Set number of signal to be sent.  */
-# define F_GETSIG	14	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE     1024    /* Set a lease.  */
-# define F_GETLEASE     1025    /* Enquire what lease is active.  */
-# define F_NOTIFY       1026    /* Request notfications on a directory.  */
-#endif
-
-/* for F_[GET|SET]FL */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		1	/* Read lock.  */
-#define F_WRLCK		2	/* Write lock.  */
-#define F_UNLCK		3	/* Remove lock.  */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS      0x00000001      /* File accessed.  */
-# define DN_MODIFY      0x00000002      /* File modified.  */
-# define DN_CREATE      0x00000004      /* File created.  */
-# define DN_DELETE      0x00000008      /* File removed.  */
-# define DN_RENAME      0x00000010      /* File renamed.  */
-# define DN_ATTRIB      0x00000020      /* File changed attibutes.  */
-# define DN_MULTISHOT   0x80000000      /* Don't remove notifier.  */
-#endif
-
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
-
-__BEGIN_DECLS
-
-/* Provide kernel hint to read ahead.  */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-    __THROW;
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h b/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h
deleted file mode 100644
index 6f4e05fcc8..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/ioctls.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_IOCTL_H
-# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead."
-#endif
-
-/* Use the definitions from the kernel header files.  */
-#include <asm/ioctls.h>
-
-/* Oh well, this is necessary since the kernel data structure is
-   different from the user-level version.  */
-#undef  TCGETS
-#undef  TCSETS
-#undef  TCSETSW
-#undef  TCSETSF
-#define TCGETS	_IOR ('T', 16, char[36])
-#define TCSETS	_IOW ('T', 17, char[36])
-#define TCSETSW	_IOW ('T', 18, char[36])
-#define TCSETSF	_IOW ('T', 19, char[36])
-
-#include <linux/sockios.h>
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/ipc.h b/sysdeps/unix/sysv/linux/hppa/bits/ipc.h
deleted file mode 100644
index d80cf06993..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/ipc.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 1995-1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_IPC_H
-# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
-#endif
-
-#include <bits/types.h>
-#include <bits/wordsize.h>
-
-/* Mode bits for `msgget', `semget', and `shmget'.  */
-#define IPC_CREAT	01000		/* Create key if key does not exist. */
-#define IPC_EXCL	02000		/* Fail if key exists.  */
-#define IPC_NOWAIT	04000		/* Return error on wait.  */
-
-/* Control commands for `msgctl', `semctl', and `shmctl'.  */
-#define IPC_RMID	0		/* Remove identifier.  */
-#define IPC_SET		1		/* Set `ipc_perm' options.  */
-#define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#ifdef __USE_GNU
-# define IPC_INFO	3		/* See ipcs.  */
-#endif
-
-/* Special key values.  */
-#define IPC_PRIVATE	((__key_t) 0)	/* Private key.  */
-
-
-/* Data structure used to pass permission information to IPC operations.  */
-struct ipc_perm
-  {
-    __key_t __key;			/* Key.  */
-    __uid_t uid;			/* Owner's user ID.  */
-    __gid_t gid;			/* Owner's group ID.  */
-    __uid_t cuid;			/* Creator's user ID.  */
-    __gid_t cgid;			/* Creator's group ID.  */
-#if __WORDSIZE == 32
-    unsigned short int __pad1;
-    unsigned short int mode;		/* Read/write permission.  */
-    unsigned short int __pad2;
-#else
-    __mode_t mode;			/* Read/write permission.  */
-    unsigned short int __pad2;
-#endif
-    unsigned short int __seq;		/* Sequence number.  */
-    unsigned int __pad3;
-    unsigned long long int __unused1;
-    unsigned long long int __unused2;
-  };
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/mman.h b/sysdeps/unix/sysv/linux/hppa/bits/mman.h
deleted file mode 100644
index 1eb1233814..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/mman.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/HPPA version.
-   Copyright (C) 1997, 1998, 2000, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* these are basically taken from the kernel definitions */
-
-#define PROT_READ	0x1		/* page can be read */
-#define PROT_WRITE	0x2		/* page can be written */
-#define PROT_EXEC	0x4		/* page can be executed */
-#define PROT_NONE	0x0		/* page can not be accessed */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_TYPE	0x03		/* Mask for type of mapping */
-#define MAP_FIXED	0x04		/* Interpret addr exactly */
-#define MAP_ANONYMOUS	0x10		/* don't use a file */
-
-#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
-#define MAP_EXECUTABLE	0x1000		/* mark it as an executable */
-#define MAP_LOCKED	0x2000		/* pages are locked */
-#define MAP_NORESERVE	0x4000		/* don't check for reservations */
-#define MAP_GROWSDOWN	0x8000		/* stack-like segment */
-#define MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
-#define MAP_NONBLOCK	0x20000		/* do not block on IO */
-
-#define MS_SYNC		1		/* synchronous memory sync */
-#define MS_ASYNC	2		/* sync memory asynchronously */
-#define MS_INVALIDATE	4		/* invalidate the caches */
-
-#define MCL_CURRENT	1		/* lock all current mappings */
-#define MCL_FUTURE	2		/* lock all future mappings */
-
-#define MADV_NORMAL     0               /* no further special treatment */
-#define MADV_RANDOM     1               /* expect random page references */
-#define MADV_SEQUENTIAL 2               /* expect sequential page references */
-#define MADV_WILLNEED   3               /* will need these pages */
-#define MADV_DONTNEED   4               /* dont need these pages */
-#define MADV_SPACEAVAIL 5               /* insure that resources are reserved */
-#define MADV_VPS_PURGE  6               /* Purge pages from VM page cache */
-#define MADV_VPS_INHERIT 7              /* Inherit parents page size */
-
-/* The range 12-64 is reserved for page size specification. */
-#define MADV_4K_PAGES   12              /* Use 4K pages  */
-#define MADV_16K_PAGES  14              /* Use 16K pages */
-#define MADV_64K_PAGES  16              /* Use 64K pages */
-#define MADV_256K_PAGES 18              /* Use 256K pages */
-#define MADV_1M_PAGES   20              /* Use 1 Megabyte pages */
-#define MADV_4M_PAGES   22              /* Use 4 Megabyte pages */
-#define MADV_16M_PAGES  24              /* Use 16 Megabyte pages */
-#define MADV_64M_PAGES  26              /* Use 64 Megabyte pages */
-
-/* compatibility flags */
-#define MAP_ANON	MAP_ANONYMOUS
-#define MAP_FILE	0
-#define MAP_VARIABLE	0
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/msq.h b/sysdeps/unix/sysv/linux/hppa/bits/msq.h
deleted file mode 100644
index 1268dc858c..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/msq.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MSG_H
-# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
-#endif
-
-#include <bits/types.h>
-#include <bits/wordsize.h>
-
-/* Define options for message queue functions.  */
-#define MSG_NOERROR	010000	/* no error if message is too big */
-#ifdef __USE_GNU
-# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
-#endif
-
-/* Types used in the structure definition.  */
-typedef unsigned long int msgqnum_t;
-typedef unsigned long int msglen_t;
-
-
-/* Structure of record for one message inside the kernel.
-   The type `struct msg' is opaque.  */
-struct msqid_ds
-{
-  struct ipc_perm msg_perm;	/* structure describing operation permission */
-#if __WORDSIZE == 32
-  unsigned int __pad1;
-#endif
-  __time_t msg_stime;		/* time of last msgsnd command */
-#if __WORDSIZE == 32
-  unsigned int __pad2;
-#endif
-  __time_t msg_rtime;		/* time of last msgrcv command */
-#if __WORDSIZE == 32
-  unsigned int __pad3;
-#endif
-  __time_t msg_ctime;		/* time of last change */
-  unsigned long int __msg_cbytes; /* current number of bytes on queue */
-  msgqnum_t msg_qnum;		/* number of messages currently on queue */
-  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
-  __pid_t msg_lspid;		/* pid of last msgsnd() */
-  __pid_t msg_lrpid;		/* pid of last msgrcv() */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-#ifdef __USE_MISC
-
-# define msg_cbytes	__msg_cbytes
-
-/* ipcs ctl commands */
-# define MSG_STAT 11
-# define MSG_INFO 12
-
-/* buffer for msgctl calls IPC_INFO, MSG_INFO */
-struct msginfo
-  {
-    int msgpool;
-    int msgmap;
-    int msgmax;
-    int msgmnb;
-    int msgmni;
-    int msgssz;
-    int msgtql;
-    unsigned short int msgseg;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/sem.h b/sysdeps/unix/sysv/linux/hppa/bits/sem.h
deleted file mode 100644
index 2880765108..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/sem.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SEM_H
-# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
-#endif
-
-#include <sys/types.h>
-#include <bits/wordsize.h>
-
-/* Flags for `semop'.  */
-#define SEM_UNDO	0x1000		/* undo the operation on exit */
-
-/* Commands for `semctl'.  */
-#define GETPID		11		/* get sempid */
-#define GETVAL		12		/* get semval */
-#define GETALL		13		/* get all semval's */
-#define GETNCNT		14		/* get semncnt */
-#define GETZCNT		15		/* get semzcnt */
-#define SETVAL		16		/* set semval */
-#define SETALL		17		/* set all semval's */
-
-
-/* Data structure describing a set of semaphores.  */
-struct semid_ds
-{
-  struct ipc_perm sem_perm;		/* operation permission struct */
-#if __WORDSIZE == 32
-  unsigned int __pad1;
-#endif
-  __time_t sem_otime;			/* last semop() time */
-#if __WORDSIZE == 32
-  unsigned int __pad2;
-#endif
-  __time_t sem_ctime;			/* last time changed by semctl() */
-  unsigned long int sem_nsems;		/* number of semaphores in set */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-/* The user should define a union like the following to use it for arguments
-   for `semctl'.
-
-   union semun
-   {
-     int val;				<= value for SETVAL
-     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
-     unsigned short int *array;		<= array for GETALL & SETALL
-     struct seminfo *__buf;		<= buffer for IPC_INFO
-   };
-
-   Previous versions of this file used to define this union but this is
-   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
-   one must define the union or not.  */
-#define _SEM_SEMUN_UNDEFINED	1
-
-#ifdef __USE_MISC
-
-/* ipcs ctl cmds */
-# define SEM_STAT 18
-# define SEM_INFO 19
-
-struct  seminfo
-{
-  int semmap;
-  int semmni;
-  int semmns;
-  int semmnu;
-  int semmsl;
-  int semopm;
-  int semume;
-  int semusz;
-  int semvmx;
-  int semaem;
-};
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/shm.h b/sysdeps/unix/sysv/linux/hppa/bits/shm.h
deleted file mode 100644
index 1c022fda83..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/shm.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2000, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SHM_H
-# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
-#endif
-
-#include <bits/types.h>
-#include <bits/wordsize.h>
-
-/* Permission flag for shmget.  */
-#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
-#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
-
-/* Flags for `shmat'.  */
-#define SHM_RDONLY	010000		/* attach read-only else read-write */
-#define SHM_RND		020000		/* round attach address to SHMLBA */
-#define SHM_REMAP	040000		/* take-over region on attach */
-
-/* Commands for `shmctl'.  */
-#define SHM_LOCK	11		/* lock segment (root only) */
-#define SHM_UNLOCK	12		/* unlock segment (root only) */
-
-/* Segment low boundary address multiple.  */
-#define SHMLBA 0x00400000		/* address needs to be 4 Mb aligned */
-
-/* Type to count number of attaches.  */
-typedef unsigned long int shmatt_t;
-
-/* Data structure describing a set of semaphores.  */
-struct shmid_ds
-  {
-    struct ipc_perm shm_perm;		/* operation permission struct */
-#if __WORDSIZE == 32
-    unsigned int __pad1;
-#endif
-    __time_t shm_atime;			/* time of last shmat() */
-#if __WORDSIZE == 32
-    unsigned int __pad2;
-#endif
-    __time_t shm_dtime;			/* time of last shmdt() */
-#if __WORDSIZE == 32
-    unsigned int __pad3;
-#endif
-    __time_t shm_ctime;			/* time of last change by shmctl() */
-#if __WORDSIZE == 32
-    unsigned int __pad4;
-#endif
-    size_t shm_segsz;			/* size of segment in bytes */
-    __pid_t shm_cpid;			/* pid of creator */
-    __pid_t shm_lpid;			/* pid of last shmop */
-    shmatt_t shm_nattch;		/* number of current attaches */
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-  };
-
-#ifdef __USE_MISC
-
-/* ipcs ctl commands */
-# define SHM_STAT 	13
-# define SHM_INFO 	14
-
-/* shm_mode upper byte flags */
-# define SHM_DEST	01000	/* segment will be destroyed on last detach */
-# define SHM_LOCKED	02000   /* segment will not be swapped */
-# define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
-
-struct	shminfo
-  {
-    unsigned long shmmax;
-    unsigned long shmmin;
-    unsigned long shmmni;
-    unsigned long shmseg;
-    unsigned long shmall;
-    unsigned long __unused1;
-    unsigned long __unused2;
-    unsigned long __unused3;
-    unsigned long __unused4;
-  };
-
-struct shm_info
-  {
-    int used_ids;
-    unsigned long int shm_tot;	/* total allocated shm */
-    unsigned long int shm_rss;	/* total resident shm */
-    unsigned long int shm_swp;	/* total swapped shm */
-    unsigned long int swap_attempts;
-    unsigned long int swap_successes;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h b/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h
deleted file mode 100644
index 33f2b237b7..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/sigaction.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Definitions for Linux/HPPA sigaction.
-   Copyright (C) 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
-#endif
-
-/* Structure describing the action to be taken when a signal arrives.  */
-struct sigaction
-  {
-    /* Signal handler.  */
-#ifdef __USE_POSIX199309
-    union
-      {
-	/* Used if SA_SIGINFO is not set.  */
-	__sighandler_t sa_handler;
-	/* Used if SA_SIGINFO is set.  */
-	void (*sa_sigaction) (int, siginfo_t *, void *);
-      }
-    __sigaction_handler;
-# define sa_handler	__sigaction_handler.sa_handler
-# define sa_sigaction	__sigaction_handler.sa_sigaction
-#else
-    __sighandler_t sa_handler;
-#endif
-
-    /* Special flags.  */
-    unsigned long int sa_flags;
-
-    /* Additional set of signals to be blocked.  */
-    __sigset_t sa_mask;
-  };
-
-/* Bits in `sa_flags'.  */
-
-#define SA_NOCLDSTOP  0x00000008  /* Don't send SIGCHLD when children stop.  */
-#define SA_NOCLDWAIT  0x00000080  /* Don't create zombie on child death.  */
-#define SA_SIGINFO    0x00000010  /* Invoke signal-catching function with
-				     three arguments instead of one.  */
-#if defined __USE_UNIX98 || defined __USE_MISC
-# define SA_ONSTACK   0x00000001 /* Use signal stack by using `sa_restorer'. */
-# define SA_RESETHAND 0x00000004 /* Reset to SIG_DFL on entry to handler.  */
-# define SA_NODEFER   0x00000020 /* Don't automatically block the signal
-				    when its handler is being executed.  */
-# define SA_RESTART   0x00000040 /* Restart syscall on signal return.  */
-#endif
-#ifdef __USE_MISC
-# define SA_INTERRUPT 0x20000000 /* Historic no-op.  */
-
-/* Some aliases for the SA_ constants.  */
-# define SA_NOMASK    SA_NODEFER
-# define SA_ONESHOT   SA_RESETHAND
-# define SA_STACK     SA_ONSTACK
-#endif
-
-/* Values for the HOW argument to `sigprocmask'.  */
-#define SIG_BLOCK          0	/* for blocking signals */
-#define SIG_UNBLOCK        1	/* for unblocking signals */
-#define SIG_SETMASK        2	/* for setting the signal mask */
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/signum.h b/sysdeps/unix/sysv/linux/hppa/bits/signum.h
deleted file mode 100644
index bf46006c8d..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/bits/signum.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Signal number definitions.  Linux/HPPA version.
-   Copyright (C) 1995,1996,1997,1998,1999,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef	_SIGNAL_H
-
-/* Fake signal functions.  */
-#define SIG_ERR	((__sighandler_t) -1)		/* Error return.  */
-#define SIG_DFL	((__sighandler_t) 0)		/* Default action.  */
-#define SIG_IGN	((__sighandler_t) 1)		/* Ignore signal.  */
-
-#ifdef __USE_UNIX98
-# define SIG_HOLD	((__sighandler_t) 2)	/* Add signal to hold mask.  */
-#endif
-
-
-/* Signals.  */
-#define	SIGHUP		1	/* Hangup (POSIX).  */
-#define	SIGINT		2	/* Interrupt (ANSI).  */
-#define	SIGQUIT		3	/* Quit (POSIX).  */
-#define	SIGILL		4	/* Illegal instruction (ANSI).  */
-#define	SIGTRAP		5	/* Trace trap (POSIX).  */
-#define	SIGABRT		6	/* Abort (ANSI).  */
-#define	SIGIOT		6	/* IOT trap (4.2 BSD).  */
-#define	SIGEMT		7
-#define	SIGFPE		8	/* Floating-point exception (ANSI).  */
-#define	SIGKILL		9	/* Kill, unblockable (POSIX).  */
-#define	SIGBUS		10	/* BUS error (4.2 BSD).  */
-#define	SIGSEGV		11	/* Segmentation violation (ANSI).  */
-#define SIGSYS		12	/* Bad system call.  */
-#define	SIGPIPE		13	/* Broken pipe (POSIX).  */
-#define	SIGALRM		14	/* Alarm clock (POSIX).  */
-#define	SIGTERM		15	/* Termination (ANSI).  */
-#define	SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
-#define SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
-#define	SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
-#define	SIGCHLD		18	/* Child status has changed (POSIX).  */
-#define	SIGPWR		19	/* Power failure restart (System V).  */
-#define	SIGVTALRM	20	/* Virtual alarm clock (4.2 BSD).  */
-#define	SIGPROF		21	/* Profiling alarm clock (4.2 BSD).  */
-#define	SIGPOLL		SIGIO	/* Pollable event occurred (System V).  */
-#define	SIGIO		22	/* I/O now possible (4.2 BSD).  */
-#define	SIGWINCH	23	/* Window size change (4.3 BSD, Sun).  */
-#define	SIGSTOP		24	/* Stop, unblockable (POSIX).  */
-#define	SIGTSTP		25	/* Keyboard stop (POSIX).  */
-#define	SIGCONT		26	/* Continue (POSIX).  */
-#define	SIGTTIN		27	/* Background read from tty (POSIX).  */
-#define	SIGTTOU		28	/* Background write to tty (POSIX).  */
-#define	SIGURG		29	/* Urgent condition on socket (4.2 BSD).  */
-#define SIGLOST		30	/* Operating System Has Lost (HP/UX). */
-#define SIGUNUSED	31
-#define	SIGXCPU		33	/* CPU limit exceeded (4.2 BSD).  */
-#define	SIGXFSZ		34	/* File size limit exceeded (4.2 BSD).  */
-#define	SIGSTKFLT	36	/* Stack fault.  */
-
-#define	_NSIG		65	/* Biggest signal number + 1
-				   (including real-time signals).  */
-
-#define SIGRTMIN        (__libc_current_sigrtmin ())
-#define SIGRTMAX        (__libc_current_sigrtmax ())
-
-/* These are the hard limits of the kernel.  These values should not be
-   used directly at user level.  */
-#define __SIGRTMIN	37
-#define __SIGRTMAX	(_NSIG - 1)
-
-#endif	/* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/hppa/brk.c b/sysdeps/unix/sysv/linux/hppa/brk.c
deleted file mode 100644
index a4b4df2831..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/brk.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* brk system call for Linux/HPPA.
-   Copyright (C) 1995, 1996, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-/* This must be initialized data because commons can't have aliases.  */
-void *__curbrk = 0;
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/hppa/clone.S b/sysdeps/unix/sysv/linux/hppa/clone.S
deleted file mode 100644
index 4f3bb9e206..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/clone.S
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
-   Based on the Alpha version by Richard Henderson <rth@tamu.edu>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <asm/unistd.h>
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
-
-        .text
-ENTRY(__clone)
-	/* FIXME: I have no idea how profiling works on hppa. */
-
-	/* Sanity check arguments.  */
-	comib,=  0,%arg0,.Lerror        /* no NULL function pointers */
-	ldi     -EINVAL,%ret0
-	comib,=  0,%arg1,.Lerror        /* no NULL stack pointers */
-	nop
-
-	/* Save the fn ptr and arg on the new stack.  */
-	stwm    %arg0,64(%arg1)
-	stw	%arg3,-60(%arg1)
-
-	/* Save the PIC register. */
-#ifdef PIC
-	stw	%r19,-32(%sr0, %sp)	/* parent */
-#endif
-
-	/* Do the system call */
-	copy	%arg2,%arg0
-	ble     0x100(%sr2,%r0)
-	ldi	__NR_clone,%r20
-
-	ldi	-4096,%r1
-	comclr,>>= %r1,%ret0,%r0	/* Note: unsigned compare. */
-	b,n	.Lerror
-
-	comib,=,n 0,%ret0,thread_start
-
-	/* Successful return from the parent
-	   No need to restore the PIC register, 
-	   since we return immediately. */
-
-	bv	%r0(%rp)
-	nop
-
-	/* Something bad happened -- no child created */
-.Lerror:
-
-	/* Restore the PIC register on error */
-#ifdef PIC
-	ldw	-32(%sr0, %sp), %r19	/* parent */
-#endif
-
-	b	__syscall_error
-	sub     %r0,%ret0,%arg0
-
-thread_start:
-
-	/* Load up the arguments.  */
-	ldw	-60(%sr0, %sp),%arg0
-	ldw     -64(%sr0, %sp),%r22
-
-	/* $$dyncall fixes childs PIC register */
-
-	/* Call the user's function */
-	bl	$$dyncall,%r31
-	copy	%r31,%rp
-
-	bl	_exit,%rp
-	copy	%ret0,%arg0
-
-	/* Die horribly.  */
-	iitlbp	%r0,(%r0)
-
-PSEUDO_END(__clone)
-
-weak_alias(__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/hppa/fcntl.c b/sysdeps/unix/sysv/linux/hppa/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/getdents64.c b/sysdeps/unix/sysv/linux/hppa/getdents64.c
deleted file mode 100644
index 0c75fb5a06..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/getdents64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/getrlimit64.c b/sysdeps/unix/sysv/linux/hppa/getrlimit64.c
deleted file mode 100644
index fef018f471..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/getrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h b/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h
deleted file mode 100644
index af048cbe7d..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* We have a separate header file here because we do not support
-   SA_RESTORER on hppa. */
-
-/* This is the sigaction struction from the Linux 2.1.20 kernel.  */
-/* Blah.  This is bogus.  We don't ever use it. */
-struct old_kernel_sigaction {
-	__sighandler_t k_sa_handler;
-	unsigned long sa_mask;
-	unsigned long sa_flags;
-};
-
-/* This is the sigaction structure from the Linux 2.1.68 kernel.  */
-
-struct kernel_sigaction {
-	__sighandler_t k_sa_handler;
-	unsigned long sa_flags;
-	sigset_t sa_mask;
-};
diff --git a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h b/sysdeps/unix/sysv/linux/hppa/kernel_stat.h
deleted file mode 100644
index a85c5be464..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/kernel_stat.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* definition of "struct stat" from the kernel */
-struct kernel_stat {
-	unsigned long	st_dev;		/* dev_t is 32 bits on parisc */
-	unsigned long	st_ino;		/* 32 bits */
-	unsigned short	st_mode;	/* 16 bits */
-	unsigned short	st_nlink;	/* 16 bits */
-	unsigned short	st_reserved1;	/* old st_uid */
-	unsigned short	st_reserved2;	/* old st_gid */
-	unsigned long	st_rdev;
-	unsigned long   st_size;
-	struct timespec st_atim;
-	struct timespec st_mtim;
-	struct timespec st_ctim;
-	long		st_blksize;
-	long		st_blocks;
-	unsigned long	__unused1;	/* ACL stuff */
-	unsigned long	__unused2;	/* network */
-	unsigned long	__unused3;	/* network */
-	unsigned long	__unused4;	/* cnodes */
-	unsigned short	__unused5;	/* netsite */
-	short		st_fstype;
-	unsigned long	st_realdev;
-	unsigned short	st_basemode;
-	unsigned short	st_spareshort;
-	unsigned long	st_uid;
-	unsigned long   st_gid;
-	unsigned long	st_spare4[3];
-};
-
-#define _HAVE_STAT_NSEC
-#define _HAVE_STAT64_NSEC
diff --git a/sysdeps/unix/sysv/linux/hppa/mmap.c b/sysdeps/unix/sysv/linux/hppa/mmap.c
deleted file mode 100644
index 6f4bfdce2a..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/mmap.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-/* Map addresses starting near ADDR and extending for LEN bytes.  From
-   OFFSET into the file FD describes according to PROT and FLAGS.  If ADDR
-   is nonzero, it is the desired mapping address.  If the MAP_FIXED bit is
-   set in FLAGS, the mapping will be at ADDR exactly (which must be
-   page-aligned); otherwise the system chooses a convenient nearby address.
-   The return value is the actual mapping address chosen or MAP_FAILED
-   for errors (in which case `errno' is set).  A successful `mmap' call
-   deallocates any previous mapping for the affected region.  */
-
-#include <sysdep.h>
-
-__ptr_t
-__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
-{
-	
-	__ptr_t ret;
-
-	ret = INLINE_SYSCALL(mmap, 6, addr, len, prot, flags, fd, offset);
-
-	/* check if it's really a negative number */
-	if(((unsigned long)ret & 0xfffff000) == 0xfffff000)
-		return MAP_FAILED;
-
-	return ret;
-
-}
-
-strong_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/hppa/profil-counter.h b/sysdeps/unix/sysv/linux/hppa/profil-counter.h
deleted file mode 100644
index b108be8a36..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/profil-counter.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Machine-dependent SIGPROF signal handler.  PA-RISC version
-   Copyright (C) 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-static void
-profil_counter (int signr, siginfo_t *si, struct ucontext *uctx)
-{
-  unsigned long ip = uctx->uc_mcontext.sc_iaoq[0] & ~0x3;
-  profil_count ((void *) ip);
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/socket.S b/sysdeps/unix/sysv/linux/hppa/socket.S
deleted file mode 100644
index dfbb721a82..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/socket.S
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sysdep.h>
-
-	.globl __socket
-PSEUDO(__socket, socket, 3)
-
-PSEUDO_END(__socket)
-
-#ifndef NO_WEAK_ALIAS
-weak_alias (__socket, socket)
-#endif
diff --git a/sysdeps/unix/sysv/linux/hppa/sys/procfs.h b/sysdeps/unix/sysv/linux/hppa/sys/procfs.h
deleted file mode 100644
index 2e6d10956d..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sys/procfs.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somewhat modelled after the file of the same name on SVR4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  It doesn't have anything to do with the /proc file
-   system, even though Linux has one.
-
-   Anyway, the whole purpose of this file is for GDB and GDB only.
-   Don't read too much into it.  Don't use it for anything other than
-   GDB unless you know what you are doing.  */
-
-#include <features.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#include <sys/user.h>
-#include <asm/elf.h>
-
-__BEGIN_DECLS
-
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with Linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   GDB doesn't really use excluded.  */
-
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-    unsigned long int pr_flag;		/* Flags.  */
-    unsigned int pr_uid;
-    unsigned int pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-
-/* The rest of this file provides the types for emulation of the
-   Solaris <proc_service.h> interfaces that should be implemented by
-   users of libthread_db.  */
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore have only one PID type.  */
-typedef __pid_t lwpid_t;
-
-/* Process status and info.  In the end we do provide typedefs for them.  */
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
deleted file mode 100644
index 1431143849..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Don't rely on this, the interface is currently messed up and may need to
-   be broken to be fixed.  */
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
-#include <bits/sigcontext.h>
-
-
-/* Type for general register.  */
-typedef unsigned long int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	80
-#define NFPREG	32
-
-/* Container for all general registers.  */
-typedef struct gregset
-  {
-    greg_t g_regs[32];
-    greg_t sr_regs[8];
-    greg_t cr_regs[24];
-    greg_t g_pad[16];
-  } gregset_t;
-
-/* Container for all FPU registers.  */
-typedef struct fpregset
-  {
-    double fp_dregs[32];
-  } fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct sigcontext mcontext_t;
-
-/* Userlevel context.  */
-typedef struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    __sigset_t uc_sigmask;
-  } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/hppa/syscall.S b/sysdeps/unix/sysv/linux/hppa/syscall.S
deleted file mode 100644
index b333487c99..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/syscall.S
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright (C) 1995, 1996, 1998, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* HPPA implements syscall() in 'C'; see sysdep.c.  */
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
deleted file mode 100644
index 0f7537c306..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ /dev/null
@@ -1,37 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-# semaphore and shm system calls
-msgctl		-	msgctl		i:iip	__msgctl	msgctl
-msgget		-	msgget		i:ii	__msgget	msgget
-msgrcv		-	msgrcv		Ci:ibnii __msgrcv	msgrcv
-msgsnd		-	msgsnd		Ci:ibni	__msgsnd	msgsnd
-shmat		-	shmat		i:ipi	__shmat		shmat
-shmctl		-	shmctl		i:iip	__shmctl	shmctl
-shmdt		-	shmdt		i:s	__shmdt		shmdt
-shmget		-	shmget		i:iii	__shmget	shmget
-semop		-	semop		i:ipi	__semop		semop
-semtimedop      -       semtimedop      i:ipip  semtimedop
-semget		-	semget		i:iii	__semget	semget
-semctl		-	semctl		i:iiii	__semctl	semctl
-
-# proper socket implementations:
-accept		-	accept		Ci:iBN	__libc_accept	__accept accept
-bind		-	bind		i:ipi	__bind		bind
-connect		-	connect		Ci:ipi	__libc_connect	__connect_internal __connect connect 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
-listen		-	listen		i:ii	__listen	listen
-recv		-	recv		Ci:ibni	__libc_recv	__recv recv
-recvfrom	-	recvfrom	Ci:ibniBN	__libc_recvfrom	__recvfrom recvfrom
-recvmsg		-	recvmsg		Ci:ipi	__libc_recvmsg	__recvmsg recvmsg
-send		-	send		Ci:ibni	__libc_send	__send send
-sendmsg		-	sendmsg		Ci:ipi	__libc_sendmsg	__sendmsg sendmsg
-sendto		-	sendto		Ci:ibnibn	__libc_sendto	__sendto sendto
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
-socket		-	socket		i:iii	__socket	socket
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-
-setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit	
-getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit	
diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.c b/sysdeps/unix/sysv/linux/hppa/sysdep.c
deleted file mode 100644
index 192efbaf75..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sysdep.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 1997, 1998, 2001, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include <errno.h>
-
-extern int __syscall_error(int err_no);
-extern int syscall (int sysnum, int arg0, int arg1, int arg2,
-		    int arg3, int arg4, int arg5);
-
-/* This routine is jumped to by all the syscall handlers, to stash
-   an error number into errno.  */
-int
-__syscall_error (int err_no)
-{
-  __set_errno (err_no);
-  return -1;
-}
-
-
-/* HPPA implements syscall() in 'C'; the assembler version would
-   typically be in syscall.S. Also note that we have INLINE_SYSCALL,
-   INTERNAL_SYSCALL, and all the generated pure assembly syscall wrappers.
-   How often the function is used is unknown. */
-int
-syscall (int sysnum, int arg0, int arg1, int arg2, int arg3, int arg4,
-	 int arg5)
-{
-  /* FIXME: Keep this matching INLINE_SYSCALL for hppa */
-  long int __sys_res;
-  {
-    register unsigned long int __res asm("r28");
-    LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
-    asm volatile (STW_ASM_PIC
-		  "	ble  0x100(%%sr2, %%r0)	\n"
-		  "	copy %1, %%r20		\n"
-		  LDW_ASM_PIC
-		  : "=r" (__res)
-		  : "r" (sysnum) ASM_ARGS_6
-		  : CALL_CLOB_REGS CLOB_ARGS_6);
-    __sys_res = __res;
-  }
-  if ((unsigned long int) __sys_res >= (unsigned long int) -4095)
-    {
-      __set_errno (-__sys_res);
-      __sys_res = -1;
-    }
-  return __sys_res;
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h
deleted file mode 100644
index 4cfe63c556..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/sysdep.h
+++ /dev/null
@@ -1,419 +0,0 @@
-/* Assembler macros for PA-RISC.
-   Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper, <drepper@cygnus.com>, August 1999.
-   Linux/PA-RISC changes by Philipp Rumpf, <prumpf@tux.org>, March 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <asm/unistd.h>
-#include <sysdeps/generic/sysdep.h>
-#include <sys/syscall.h>
-#include "config.h"
-
-#ifndef ASM_LINE_SEP
-# define ASM_LINE_SEP ;
-#endif
-
-#undef SYS_ify
-#define SYS_ify(syscall_name)	(__NR_##syscall_name)
-
-#ifdef PIC
-/* WARNING: CANNOT BE USED IN A NOP! */
-# define STW_PIC stw %r19, -32(%sr0, %sp) ASM_LINE_SEP
-# define LDW_PIC ldw -32(%sr0, %sp), %r19 ASM_LINE_SEP
-# define STW_ASM_PIC	"       copy %%r19, %%r4\n"
-# define LDW_ASM_PIC	"       copy %%r4, %%r19\n"
-# define USING_GR4	"%r4",
-#else
-# define STW_PIC ASM_LINE_SEP
-# define LDW_PIC ASM_LINE_SEP
-# define STW_ASM_PIC	" \n"
-# define LDW_ASM_PIC	" \n"
-# define USING_GR4
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* Syntactic details of assembler.  */
-
-#define ALIGNARG(log2) log2
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#define SYS_ify(syscall_name)	__NR_##syscall_name
-
-/* ELF-like local names start with `.L'.  */
-#undef L
-#define L(name)	.L##name
-
-/* Linux uses a negative return value to indicate syscall errors,
-   unlike most Unices, which use the condition codes' carry flag.
-
-   Since version 2.1 the return value of a system call might be
-   negative even if the call succeeded.  E.g., the `lseek' system call
-   might return a large offset.  Therefore we must not anymore test
-   for < 0, but test for a real error by making sure the value in %eax
-   is a real error number.  Linus said he will make sure the no syscall
-   returns a value in -1 .. -4095 as a valid result so we can safely
-   test with -4095.  */
-
-/* We don't want the label for the error handle to be global when we define
-   it here.  */
-#ifdef PIC
-# define SYSCALL_ERROR_LABEL 0f
-#else
-# define SYSCALL_ERROR_LABEL syscall_error
-#endif
-
-/* Define an entry point visible from C.
-
-   There is currently a bug in gdb which prevents us from specifying
-   incomplete stabs information.  Fake some entries here which specify
-   the current source file.  */
-#define	ENTRY(name)						\
-	.text					ASM_LINE_SEP	\
-	.export C_SYMBOL_NAME(name)		ASM_LINE_SEP	\
-	.type	C_SYMBOL_NAME(name),@function	ASM_LINE_SEP	\
-	C_LABEL(name)				ASM_LINE_SEP	\
-	CALL_MCOUNT				ASM_LINE_SEP
-
-#undef	END
-#define END(name)							\
-1:							ASM_LINE_SEP	\
-.size	C_SYMBOL_NAME(name),1b-C_SYMBOL_NAME(name)	ASM_LINE_SEP
-
-/* If compiled for profiling, call `mcount' at the start of each function.  */
-/* No, don't bother.  gcc will put the call in for us.  */
-#define CALL_MCOUNT		/* Do nothing.  */
-
-/* syscall wrappers consist of
-	#include <sysdep.h>
-	PSEUDO(...)
-	ret
-	PSEUDO_END(...)
-
-   which means
-	ENTRY(name)
-	DO_CALL(...)
-	nop
-	bv 0(2)
-	nop
-*/
-
-#define	PSEUDO(name, syscall_name, args)			\
-  ENTRY (name)							\
-  DO_CALL(syscall_name, args)			ASM_LINE_SEP	\
-  nop						ASM_LINE_SEP
-
-#define ret \
-	/* Return value set by ERRNO code */	ASM_LINE_SEP	\
-	bv 0(2)					ASM_LINE_SEP	\
-	nop					ASM_LINE_SEP
-
-#undef	PSEUDO_END
-#define	PSEUDO_END(name)					\
-  END (name)
-
-/* We don't set the errno on the return from the syscall */
-#define	PSEUDO_NOERRNO(name, syscall_name, args)		\
-  ENTRY (name)							\
-  DO_CALL_NOERRNO(syscall_name, args)		ASM_LINE_SEP	\
-  nop						ASM_LINE_SEP
-
-#define ret_NOERRNO ret
-
-#undef	PSEUDO_END_NOERRNO
-#define	PSEUDO_END_NOERRNO(name)				\
-  END (name)
-
-/* This has to return the error value */
-#undef  PSEUDO_ERRVAL
-#define PSEUDO_ERRVAL(name, syscall_name, args)			\
-	ENTRY(name)						\
-	DO_CALL_ERRVAL(syscall_name, args)	ASM_LINE_SEP	\
-	nop					ASM_LINE_SEP
-
-#define ret_ERRVAL ret
-
-#undef	PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(name)					\
-	END(name)
-
-#undef JUMPTARGET
-#define JUMPTARGET(name)	name
-#define SYSCALL_PIC_SETUP	/* Nothing.  */
-
-
-/* All the syscall assembly macros rely on finding the approriate
-   SYSCALL_ERROR_LABEL or rather HANDLER. */
-
-/* int * __errno_location(void) so you have to store your value
-   into the return address! */
-#define DEFAULT_SYSCALL_ERROR_HANDLER 			\
-	.import __errno_location,code	ASM_LINE_SEP	\
-	/* branch to errno handler */	ASM_LINE_SEP	\
-	bl __errno_location,%rp		ASM_LINE_SEP
-
-/* Here are the myriad of configuration options that the above can
-   work for... what we've done is provide the framework for future
-   changes if required to each section */
-
-#ifdef PIC
-# if RTLD_PRIVATE_ERRNO
-#  define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-# else /* !RTLD_PRIVATE_ERRNO */
-#  if defined _LIBC_REENTRANT
-#   define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-#  else /* !_LIBC_REENTRANT */
-#   define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-#  endif /* _LIBC_REENTRANT */
-# endif /* RTLD_PRIVATE_ERRNO */
-#else
-# ifndef _LIBC_REENTRANT
-#  define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-# else
-#  define SYSCALL_ERROR_HANDLER DEFAULT_SYSCALL_ERROR_HANDLER
-# endif
-#endif
-
-
-/* Linux takes system call arguments in registers:
-	syscall number	gr20
-	arg 1		gr26
-	arg 2		gr25
-	arg 3		gr24
-	arg 4		gr23
-	arg 5		gr22
-	arg 6		gr21
-
-   The compiler calls us by the C convention:
-	syscall number	in the DO_CALL macro
-	arg 1		gr26
-	arg 2		gr25
-	arg 3		gr24
-	arg 4		gr23
-	arg 5		-52(gr30)
-	arg 6		-56(gr30)
-
-   gr22 and gr21 are caller-saves, so we can just load the arguments
-   there and generally be happy. */
-
-/* the cmpb...no_error code below inside DO_CALL
- * is intended to mimic the if (__sys_res...)
- * code inside INLINE_SYSCALL
- */
-
-#undef	DO_CALL
-#define DO_CALL(syscall_name, args)				\
-	DOARGS_##args				ASM_LINE_SEP	\
-	STW_PIC					ASM_LINE_SEP	\
-	/* Do syscall, delay loads # */		ASM_LINE_SEP	\
-	ble  0x100(%sr2,%r0)			ASM_LINE_SEP	\
-	ldi SYS_ify (syscall_name), %r20	ASM_LINE_SEP	\
-	ldi -0x1000,%r1				ASM_LINE_SEP	\
-	cmpb,>>=,n %r1,%ret0,0f			ASM_LINE_SEP	\
-	/* save rp or we get lost */		ASM_LINE_SEP	\
-	stw %rp, -20(%sr0,%sp)			ASM_LINE_SEP	\
-	/* Restore r19 from frame */		ASM_LINE_SEP	\
-	LDW_PIC					ASM_LINE_SEP	\
-	stw %ret0, -24(%sr0,%sp)		ASM_LINE_SEP	\
-	SYSCALL_ERROR_HANDLER			ASM_LINE_SEP	\
-	/* create frame */			ASM_LINE_SEP	\
-	ldo 64(%sp), %sp			ASM_LINE_SEP	\
-	ldo -64(%sp), %sp			ASM_LINE_SEP	\
-	/* OPTIMIZE: Don't reload r19 */	ASM_LINE_SEP	\
-	/* do a -1*syscall_ret0 */		ASM_LINE_SEP	\
-	ldw -24(%sr0,%sp), %r26			ASM_LINE_SEP	\
-	sub %r0, %r26, %r26			ASM_LINE_SEP	\
-	/* Store into errno location */		ASM_LINE_SEP	\
-	stw %r26, 0(%sr0,%ret0)			ASM_LINE_SEP	\
-	/* return -1 as error */		ASM_LINE_SEP	\
-	ldo -1(%r0), %ret0			ASM_LINE_SEP	\
-	ldw -20(%sr0,%sp), %rp			ASM_LINE_SEP	\
-0:						ASM_LINE_SEP	\
-	UNDOARGS_##args				ASM_LINE_SEP
-
-/* We do nothing with the return, except hand it back to someone else */
-#undef  DO_CALL_NOERRNO
-#define DO_CALL_NOERRNO(syscall_name, args)			\
-	DOARGS_##args                                           \
-	/* No need to store r19 */		ASM_LINE_SEP	\
-	ble  0x100(%sr2,%r0)                    ASM_LINE_SEP    \
-	ldi SYS_ify (syscall_name), %r20        ASM_LINE_SEP    \
-	/* Caller will restore r19 */		ASM_LINE_SEP	\
-	UNDOARGS_##args
-
-/* Here, we return the ERRVAL in assembly, note we don't call the
-   error handler function, but we do 'negate' the return _IF_
-   it's an error. Not sure if this is the right semantic. */
-
-#undef	DO_CALL_ERRVAL
-#define DO_CALL_ERRVAL(syscall_name, args)			\
-	DOARGS_##args				ASM_LINE_SEP	\
-	/* No need to store r19 */		ASM_LINE_SEP	\
-	ble  0x100(%sr2,%r0)			ASM_LINE_SEP	\
-	ldi SYS_ify (syscall_name), %r20	ASM_LINE_SEP	\
-	/* Caller will restore r19 */		ASM_LINE_SEP	\
-	ldi -0x1000,%r1				ASM_LINE_SEP	\
-	cmpb,>>=,n %r1,%ret0,0f			ASM_LINE_SEP	\
-	sub %r0, %ret0, %ret0			ASM_LINE_SEP	\
-0:						ASM_LINE_SEP	\
-	UNDOARGS_##args				ASM_LINE_SEP
-
-#define DOARGS_0 /* nothing */
-#define DOARGS_1 /* nothing */
-#define DOARGS_2 /* nothing */
-#define DOARGS_3 /* nothing */
-#define DOARGS_4 /* nothing */
-#define DOARGS_5 ldw -52(%r30), %r22		ASM_LINE_SEP
-#define DOARGS_6 ldw -52(%r30), %r22		ASM_LINE_SEP	\
-		 ldw -56(%r30), %r21		ASM_LINE_SEP
-
-
-#define UNDOARGS_0 /* nothing */
-#define UNDOARGS_1 /* nothing */
-#define UNDOARGS_2 /* nothing */
-#define UNDOARGS_3 /* nothing */
-#define UNDOARGS_4 /* nothing */
-#define UNDOARGS_5 /* nothing */
-#define UNDOARGS_6 /* nothing */
-
-#else
-
-/* GCC has to be warned that a syscall may clobber all the ABI
-   registers listed as "caller-saves", see page 8, Table 2
-   in section 2.2.6 of the PA-RISC RUN-TIME architecture
-   document. However! r28 is the result and will conflict with
-   the clobber list so it is left out. Also the input arguments
-   registers r20 -> r26 will conflict with the list so they
-   are treated specially. Although r19 is clobbered by the syscall
-   we cannot say this because it would violate ABI, thus we say
-   r4 is clobbered and use that register to save/restore r19
-   across the syscall. */
-
-#define CALL_CLOB_REGS	"%r1", "%r2", USING_GR4 \
-		 	"%r20", "%r29", "%r31"
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)	({			\
-	long __sys_res;							\
-	{								\
-		register unsigned long __res asm("r28");		\
-		LOAD_ARGS_##nr(args)					\
-		/* FIXME: HACK stw/ldw r19 around syscall */		\
-		asm volatile(						\
-			STW_ASM_PIC					\
-			"	ble  0x100(%%sr2, %%r0)\n"		\
-			"	ldi %1, %%r20\n"			\
-			LDW_ASM_PIC					\
-			: "=r" (__res)					\
-			: "i" (SYS_ify(name)) ASM_ARGS_##nr		\
-			: CALL_CLOB_REGS CLOB_ARGS_##nr			\
-		);							\
-		__sys_res = (long)__res;				\
-	}								\
-	if ( (unsigned long)__sys_res >= (unsigned long)-4095 ){	\
-		__set_errno(-__sys_res);				\
-		__sys_res = -1;						\
-	}								\
-	__sys_res;							\
-})
-
-/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static
-   value to use within the context of the syscall
-   INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise
-   You are allowed to use the syscall result (val) and the DECL error variable
-   to determine what went wrong.
-   INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number.
-   In our case we just flip the sign. */
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-/* Equivalent to  (val < 0)&&(val > -4095) which is what we want */
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
-	((unsigned long)val >= (unsigned long)-4095)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-
-/* Similar to INLINE_SYSCALL but we don't set errno */
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) 		\
-({								\
-	long __sys_res;						\
-	{							\
-		register unsigned long __res asm("r28");	\
-		LOAD_ARGS_##nr(args)				\
-		/* FIXME: HACK stw/ldw r19 around syscall */	\
-		asm volatile(					\
-			STW_ASM_PIC				\
-			"	ble  0x100(%%sr2, %%r0)\n"	\
-			"	ldi %1, %%r20\n"		\
-			LDW_ASM_PIC				\
-			: "=r" (__res)				\
-			: "i" (SYS_ify(name)) ASM_ARGS_##nr	\
-			: CALL_CLOB_REGS CLOB_ARGS_##nr		\
-		);						\
-		__sys_res = (long)__res;			\
-	}							\
-	__sys_res;						\
- })
-
-#define LOAD_ARGS_0()
-#define LOAD_ARGS_1(r26)					\
-	register unsigned long __r26 __asm__("r26") = (unsigned long)(r26);   \
-	LOAD_ARGS_0()
-#define LOAD_ARGS_2(r26,r25)					\
-	register unsigned long __r25 __asm__("r25") = (unsigned long)(r25);   \
-	LOAD_ARGS_1(r26)
-#define LOAD_ARGS_3(r26,r25,r24)				\
-	register unsigned long __r24 __asm__("r24") = (unsigned long)(r24);   \
-	LOAD_ARGS_2(r26,r25)
-#define LOAD_ARGS_4(r26,r25,r24,r23)				\
-	register unsigned long __r23 __asm__("r23") = (unsigned long)(r23);   \
-	LOAD_ARGS_3(r26,r25,r24)
-#define LOAD_ARGS_5(r26,r25,r24,r23,r22)			\
-	register unsigned long __r22 __asm__("r22") = (unsigned long)(r22);   \
-	LOAD_ARGS_4(r26,r25,r24,r23)
-#define LOAD_ARGS_6(r26,r25,r24,r23,r22,r21)			\
-	register unsigned long __r21 __asm__("r21") = (unsigned long)(r21);   \
-	LOAD_ARGS_5(r26,r25,r24,r23,r22)
-
-/* Even with zero args we use r20 for the syscall number */
-#define ASM_ARGS_0
-#define ASM_ARGS_1 ASM_ARGS_0, "r" (__r26)
-#define ASM_ARGS_2 ASM_ARGS_1, "r" (__r25)
-#define ASM_ARGS_3 ASM_ARGS_2, "r" (__r24)
-#define ASM_ARGS_4 ASM_ARGS_3, "r" (__r23)
-#define ASM_ARGS_5 ASM_ARGS_4, "r" (__r22)
-#define ASM_ARGS_6 ASM_ARGS_5, "r" (__r21)
-
-/* The registers not listed as inputs but clobbered */
-#define CLOB_ARGS_6
-#define CLOB_ARGS_5 CLOB_ARGS_6, "%r21"
-#define CLOB_ARGS_4 CLOB_ARGS_5, "%r22"
-#define CLOB_ARGS_3 CLOB_ARGS_4, "%r23"
-#define CLOB_ARGS_2 CLOB_ARGS_3, "%r24"
-#define CLOB_ARGS_1 CLOB_ARGS_2, "%r25"
-#define CLOB_ARGS_0 CLOB_ARGS_1, "%r26"
-
-#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/unix/sysv/linux/hppa/umount.c b/sysdeps/unix/sysv/linux/hppa/umount.c
deleted file mode 100644
index e7c5690890..0000000000
--- a/sysdeps/unix/sysv/linux/hppa/umount.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Since we don't have an oldumount system call, do what the kernel
-   does down here.  */
-
-extern long int __umount2 (const char *name, int flags);
-
-long int
-__umount (const char *name)
-{
-  return __umount2 (name, 0);
-}
-
-weak_alias (__umount, umount);
diff --git a/sysdeps/unix/sysv/linux/i386/Dist b/sysdeps/unix/sysv/linux/i386/Dist
deleted file mode 100644
index 70253ac9e8..0000000000
--- a/sysdeps/unix/sysv/linux/i386/Dist
+++ /dev/null
@@ -1,17 +0,0 @@
-bp-thunks.h
-clone.S
-olddirent.h
-oldgetrlimit64.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sys/debugreg.h
-sys/elf.h
-sys/io.h
-sys/perm.h
-sys/procfs.h
-sys/reg.h
-sys/user.h
-sys/vm86.h
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 1ae69407ff..9e84975635 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -1,5 +1,5 @@
 ifeq ($(subdir),misc)
-sysdep_routines += ioperm iopl vm86
+sysdep_routines += ioperm iopl vm86 call_pselect6
 sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h sys/io.h
 endif
 
@@ -12,3 +12,7 @@ endif
 ifeq ($(subdir),resource)
 sysdep_routines += oldgetrlimit64
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
index 9065825b98..6de33302ee 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,8 +22,11 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -96,7 +99,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -180,10 +183,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/i386/bits/mman.h b/sysdeps/unix/sysv/linux/i386/bits/mman.h
index 1477aa54e2..00cb982395 100644
--- a/sysdeps/unix/sysv/linux/i386/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/i386/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/i386 version.
-   Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2003, 2005, 2006 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
@@ -78,6 +78,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -87,6 +88,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/i386/call_pselect6.S b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
new file mode 100644
index 0000000000..a356f1dfa9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/call_pselect6.S
@@ -0,0 +1,65 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#ifdef __NR_pselect6
+	.text
+ENTRY(__call_pselect6)
+	.hidden __call_pselect6
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%esi
+	cfi_adjust_cfa_offset (4)
+	pushl	%edi
+	cfi_adjust_cfa_offset (4)
+	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebp, 0)
+	cfi_rel_offset (edi, 4)
+	cfi_rel_offset (esi, 8)
+	cfi_rel_offset (ebx, 12)
+
+	movl	$__NR_pselect6, %eax
+	movl	20(%esp), %ebx
+	movl	24(%esp), %ecx
+	movl	28(%esp), %edx
+	movl	32(%esp), %esi
+	movl	36(%esp), %edi
+	movl	40(%esp), %ebp
+
+	/* The syscall handling cannot handle 6 parameters.  Yet.  */
+	int	$0x80
+
+	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
+	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+
+	ret
+END(__call_pselect6)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c
index 31a6e0f08a..fc6a9c95a1 100644
--- a/sysdeps/unix/sysv/linux/i386/chown.c
+++ b/sysdeps/unix/sysv/linux/i386/chown.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998,1999,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,1999,2000,2002,2003,2004,2006
+	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
@@ -25,7 +26,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /*
   In Linux 2.1.x the chown functions have been changed.  A new function lchown
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index c7d31f7a32..54524ec120 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,98,99,2000,02,03,04 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000,02,03,04,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@tamu.edu)
 
@@ -83,12 +83,19 @@ ENTRY (BP_SYM (__clone))
 
 	/* Do the system call */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
+
 	movl	TLS+12(%esp),%esi
+	cfi_rel_offset (esi, 4)
 	movl	PTID+12(%esp),%edx
 	movl	FLAGS+12(%esp),%ebx
+	cfi_rel_offset (ebx, 8)
 	movl	CTID+12(%esp),%edi
+	cfi_rel_offset (edi, 0)
 	movl	$SYS_ify(clone),%eax
 
 #ifdef RESET_PID
@@ -96,6 +103,10 @@ ENTRY (BP_SYM (__clone))
 	movl	%ebx, (%ecx)
 #endif
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	int	$0x80
 	popl	%edi
 	popl	%esi
@@ -125,7 +136,7 @@ L(here):
 #endif
 	movl	%eax, %ebx
 	movl	$SYS_ify(exit), %eax
-	int	$0x80
+	ENTER_KERNEL
 
 #ifdef RESET_PID
 	.subsection 2
@@ -142,6 +153,7 @@ L(nomoregetpid):
 	.previous
 #endif
 
+	cfi_startproc
 PSEUDO_END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/i386/dl-cache.h b/sysdeps/unix/sysv/linux/i386/dl-cache.h
new file mode 100644
index 0000000000..38a1c7dfb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/dl-cache.h
@@ -0,0 +1,59 @@
+/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
+   Copyright (C) 2004 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+static inline int
+is_ia64 (void)
+{
+  unsigned int fl1, fl2;
+
+  /* See if we can use cpuid.  */
+  __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
+           "pushl %0; popfl; pushfl; popl %0; popfl"
+           : "=&r" (fl1), "=&r" (fl2)
+           : "i" (0x00200000));
+  if (((fl1 ^ fl2) & 0x00200000) == 0)
+    return 0;
+
+  /* Host supports cpuid.  See if cpuid gives capabilities, try
+     CPUID(0).  Preserve %ebx and %ecx; cpuid insn clobbers these, we
+     don't need their CPUID values here, and %ebx may be the PIC
+     register.  */
+  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+           : "=a" (fl1) : "0" (0) : "edx", "cc");
+  if (fl1 == 0)
+    return 0;
+
+  /* Invoke CPUID(1), return %edx; caller can examine bits to
+     determine what's supported.  */
+  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+           : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
+  return (fl2 & (1 << 30)) != 0;
+}
+
+#define arch_startup(argc, argv) \
+  do {									\
+    /* On IA-64, try to execute 64-bit ldconfig if possible.		\
+       This is because the badly designed /emul/ia32-linux hack		\
+       will cause 32-bit ldconfig to do all sorts of weird things.  */	\
+    if (is_ia64 ())							\
+      execv ("/emul/ia32-linux/../../sbin/ldconfig",			\
+	     (char *const *) argv);					\
+  } while (0)
+
+#include_next <dl-cache.h>
diff --git a/sysdeps/unix/sysv/linux/i386/fchown.c b/sysdeps/unix/sysv/linux/i386/fchown.c
index 1f2e389844..30299c9609 100644
--- a/sysdeps/unix/sysv/linux/i386/fchown.c
+++ b/sysdeps/unix/sysv/linux/i386/fchown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2006 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
@@ -23,7 +23,7 @@
 #include <sys/syscall.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_fchown32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c
new file mode 100644
index 0000000000..34acf10c27
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fchownat.c
@@ -0,0 +1,110 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <shlib-compat.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include <kernel-features.h>
+
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+  int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_32BITUIDS > 0
+  /* This implies __ASSUME_LCHOWN_SYSCALL.  */
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchown32, err, 3, CHECK_STRING (file), owner,
+			       group);
+  else
+    result = INTERNAL_SYSCALL (chown32, err, 3, CHECK_STRING (file), owner,
+			       group);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      return -1;
+    }
+# else
+  /* Don't inline the rest to avoid unnecessary code duplication.  */
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = __lchown (file, owner, group);
+  else
+    result = __chown (file, owner, group);
+  if (result < 0)
+    __atfct_seterrno (errno, fd, buf);
+# endif
+
+  return result;
+
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index 210faba2a7..b27373d24b 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2002,2003,2004,2006 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
@@ -23,7 +23,7 @@
 #include <stdarg.h>
 
 #include <sys/syscall.h>
-#include "../kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_FCNTL64 == 0
 /* This variable is shared with all files that check for fcntl64.  */
diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.c b/sysdeps/unix/sysv/linux/i386/fxstat.c
index 40787b99e7..281839f964 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstat.c
@@ -1,5 +1,6 @@
 /* fxstat using old-style Unix fstat system call.
-   Copyright (C) 1991,1995-1998,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-1998,2000,2002,2003,2006
+	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
@@ -30,7 +31,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #include <xstatconv.h>
 
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
new file mode 100644
index 0000000000..94f6e81186
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c
@@ -0,0 +1,176 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Ho hum, if fxstatat == fxstatat64 we must get rid of the prototype or gcc
+   will complain since they don't strictly match.  */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#include <xstatconv.h>
+
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat64 calls.  */
+extern int __have_no_stat64;
+# endif
+#endif
+
+
+/* Get information about the file NAME relative to FD in ST.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  int result;
+  INTERNAL_SYSCALL_DECL (err);
+  struct stat64 st64;
+
+#ifdef __NR_fstatat64
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, &st64, flag);
+# ifndef __ASSUME_ATFCTS
+      if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  && INTERNAL_SYSCALL_ERRNO (result, err) == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	  return __xstat32_conv (vers, &st64, st);
+	else
+	  {
+	    __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
+	    return -1;
+	  }
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (__builtin_expect (flag & ~AT_SYMLINK_NOFOLLOW, 0))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_STAT64_SYSCALL == 0
+  struct kernel_stat kst;
+# endif
+  if (vers == _STAT_VER_KERNEL)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+      else
+	result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+				   CHECK_1 ((struct kernel_stat *) st));
+      goto out;
+    }
+
+# if __ASSUME_STAT64_SYSCALL > 0
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&st64));
+  else
+    result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&st64));
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat32_conv (vers, &st64, st);
+# else
+#  if defined __NR_stat64
+  /* To support 32 bit UIDs, we have to use stat64.  The normal stat
+     call only returns 16 bit UIDs.  */
+  if (! __have_no_stat64)
+    {
+      if (flag & AT_SYMLINK_NOFOLLOW)
+	result = INTERNAL_SYSCALL (lstat64, err, 2, CHECK_STRING (file),
+				   __ptrvalue (&st64));
+      else
+	result = INTERNAL_SYSCALL (stat64, err, 2, CHECK_STRING (file),
+				   __ptrvalue (&st64));
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+	result = __xstat32_conv (vers, &st64, st);
+
+      if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)
+	  || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS)
+	goto out;
+
+      __have_no_stat64 = 1;
+    }
+#  endif
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lstat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  else
+    result = INTERNAL_SYSCALL (stat, err, 2, CHECK_STRING (file),
+			       __ptrvalue (&kst));
+  if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1))
+    return __xstat_conv (vers, &kst, st);
+# endif  /* __ASSUME_STAT64_SYSCALL  */
+
+ out:
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
+libc_hidden_def (__fxstatat)
+#ifdef XSTAT_IS_XSTAT64
+# undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+libc_hidden_ver (__fxstatat, __fxstatat64)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/getcontext.S b/sysdeps/unix/sysv/linux/i386/getcontext.S
index 68541d5d80..fe28f1e0e1 100644
--- a/sysdeps/unix/sysv/linux/i386/getcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -63,12 +63,16 @@ ENTRY(__getcontext)
 
 	/* Save the current signal mask.  */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (ebx, 0)
 	leal	oSIGMASK(%eax), %edx
 	xorl	%ecx, %ecx
 	movl	$SIG_BLOCK, %ebx
 	movl	$__NR_sigprocmask, %eax
 	ENTER_KERNEL
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	cmpl	$-4095, %eax		/* Check %eax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
 
@@ -78,4 +82,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/getegid.c b/sysdeps/unix/sysv/linux/i386/getegid.c
index c54133b359..31c10cc32f 100644
--- a/sysdeps/unix/sysv/linux/i386/getegid.c
+++ b/sysdeps/unix/sysv/linux/i386/getegid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2006 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
@@ -21,7 +21,7 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getegid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/geteuid.c b/sysdeps/unix/sysv/linux/i386/geteuid.c
index 8d56f6c7f8..53f52687a4 100644
--- a/sysdeps/unix/sysv/linux/i386/geteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/geteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2006 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
@@ -21,7 +21,7 @@
 
 #include <sysdep.h>
 #include <sys/syscall.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_geteuid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/getgid.c b/sysdeps/unix/sysv/linux/i386/getgid.c
index 0ff63580f6..7a7e38d9c0 100644
--- a/sysdeps/unix/sysv/linux/i386/getgid.c
+++ b/sysdeps/unix/sysv/linux/i386/getgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2006 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
@@ -22,7 +22,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getgid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/getmsg.c b/sysdeps/unix/sysv/linux/i386/getmsg.c
index e6ca88d136..c0efd56369 100644
--- a/sysdeps/unix/sysv/linux/i386/getmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/getmsg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2003, 2005 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
@@ -34,5 +34,5 @@ getmsg (fildes, ctlptr, dataptr, flagsp)
   return INLINE_SYSCALL (getpmsg, 5, fildes, ctlptr, dataptr, NULL, flagsp);
 }
 #else
-# include <sysdeps/generic/getmsg.c>
+# include <streams/getmsg.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/getresgid.c b/sysdeps/unix/sysv/linux/i386/getresgid.c
index 8028dec3f9..393195619f 100644
--- a/sysdeps/unix/sysv/linux/i386/getresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/getresgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,2005,2006 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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getresgid
 
@@ -81,5 +81,5 @@ libc_hidden_def (__getresgid)
 weak_alias (__getresgid, getresgid)
 
 #else
-# include <sysdeps/generic/getresgid.c>
+# include <posix/getresgid.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/getresuid.c b/sysdeps/unix/sysv/linux/i386/getresuid.c
index 6b94bbb66c..ddd25341b2 100644
--- a/sysdeps/unix/sysv/linux/i386/getresuid.c
+++ b/sysdeps/unix/sysv/linux/i386/getresuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,2005,2006 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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getresuid
 
@@ -80,5 +80,5 @@ libc_hidden_def (__getresuid)
 weak_alias (__getresuid, getresuid)
 
 #else
-# include <sysdeps/generic/getresuid.c>
+# include <posix/getresuid.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/getrlimit.c b/sysdeps/unix/sysv/linux/i386/getrlimit.c
index 38b369bc4f..59951ac100 100644
--- a/sysdeps/unix/sysv/linux/i386/getrlimit.c
+++ b/sysdeps/unix/sysv/linux/i386/getrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2003, 2006 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
@@ -24,7 +24,7 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 extern int __new_getrlimit (enum __rlimit_resource resource,
 			    struct rlimit *__unbounded rlimits);
diff --git a/sysdeps/unix/sysv/linux/i386/getrlimit64.c b/sysdeps/unix/sysv/linux/i386/getrlimit64.c
index d6ab86f3e4..2ff175393c 100644
--- a/sysdeps/unix/sysv/linux/i386/getrlimit64.c
+++ b/sysdeps/unix/sysv/linux/i386/getrlimit64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2005 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
@@ -18,7 +18,7 @@
 
 #define getrlimit64 __new_getrlimit64
 
-#include <sysdeps/generic/getrlimit64.c>
+#include <resource/getrlimit64.c>
 
 #undef getrlimit64
 #include <shlib-compat.h>
diff --git a/sysdeps/unix/sysv/linux/i386/getuid.c b/sysdeps/unix/sysv/linux/i386/getuid.c
index 3e5c901ec5..d7be0c3cde 100644
--- a/sysdeps/unix/sysv/linux/i386/getuid.c
+++ b/sysdeps/unix/sysv/linux/i386/getuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2003, 2006 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
@@ -22,7 +22,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_getuid32
 # if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/i386/glob64.c b/sysdeps/unix/sysv/linux/i386/glob64.c
index d3d1212f05..18b7f21ae8 100644
--- a/sysdeps/unix/sysv/linux/i386/glob64.c
+++ b/sysdeps/unix/sysv/linux/i386/glob64.c
@@ -19,7 +19,7 @@
 
 #define COMPILE_GLOB64	1
 
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 
 #include "shlib-compat.h"
 
@@ -48,7 +48,7 @@ int __old_glob64 (__const char *__pattern, int __flags,
 
 #define GLOB_ONLY_P 1
 
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 
 compat_symbol (libc, __old_glob64, glob64, GLIBC_2_1);
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/lchown.c b/sysdeps/unix/sysv/linux/i386/lchown.c
index 1b217a9451..fbba0bf1d1 100644
--- a/sysdeps/unix/sysv/linux/i386/lchown.c
+++ b/sysdeps/unix/sysv/linux/i386/lchown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2003,2005,2006 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
@@ -24,7 +24,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_lchown
 # ifdef __NR_lchown32
@@ -70,5 +70,5 @@ __lchown (const char *file, uid_t owner, gid_t group)
 weak_alias (__lchown, lchown)
 
 #else
-# include <sysdeps/generic/lchown.c>
+# include <io/lchown.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/lockf64.c b/sysdeps/unix/sysv/linux/i386/lockf64.c
index e066cb26e1..8b568ff4a3 100644
--- a/sysdeps/unix/sysv/linux/i386/lockf64.c
+++ b/sysdeps/unix/sysv/linux/i386/lockf64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1994,1996,1997,1998,1999,2000,2003,2006
+	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
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <sysdep.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* lockf is a simplified interface to fcntl's locking facilities.  */
 
diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.c b/sysdeps/unix/sysv/linux/i386/lxstat.c
index 65ea0bbed0..5cc96127b5 100644
--- a/sysdeps/unix/sysv/linux/i386/lxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/lxstat.c
@@ -1,6 +1,6 @@
 /* lxstat using old-style Unix lstat system call.
-   Copyright (C) 1991, 1995, 1996, 1997, 1998, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1991,1995,1996,1997,1998,2000,2002,2003,2006
+	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
@@ -31,7 +31,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #include <xstatconv.h>
 
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index ec49b74b9a..12ba4e2d67 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -1,5 +1,5 @@
 /* Create new context.
-   Copyright (C) 2001,02 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -68,7 +68,9 @@ ENTRY(__makecontext)
 	   below).  */
 #ifdef PIC
 	call	1f
+	cfi_adjust_cfa_offset (4)
 1:	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
 	addl	$L(exitcode)-1b, %ecx
 	movl	%ecx, (%edx)
 #else
@@ -83,6 +85,7 @@ ENTRY(__makecontext)
 	   the context 'makecontext' manipulated at the time of the
 	   'makecontext' call.  If the pointer is NULL the process must
 	   terminate.  */
+	cfi_endproc
 L(exitcode):
 	/* This removes the parameters passed to the function given to
 	   'makecontext' from the stack.  EBX contains the number of
@@ -108,6 +111,7 @@ L(exitcode):
 	/* The 'exit' call should never return.  In case it does cause
 	   the process to terminate.  */
 	hlt
+	cfi_startproc
 END(__makecontext)
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S
index ebb21f3d32..a1481feeb5 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap.S
+++ b/sysdeps/unix/sysv/linux/i386/mmap.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,96,97,98,99,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,98,99,2000,2002,2005,2006
+	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
@@ -18,7 +19,7 @@
 
 #include <sysdep.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define EINVAL	22
 
@@ -26,22 +27,30 @@
 
 ENTRY (__mmap)
 
-/* I don't think it is worthwhile trzing to use mmap2 whenever it
+/* I don't think it is worthwhile trying to use mmap2 whenever it
    is available.  Only use it when we are sure the syscall exists.  */
 #ifdef __ASSUME_MMAP2_SYSCALL
 
 	/* Save registers.  */
 	pushl %ebp
+	cfi_adjust_cfa_offset (4)
 	pushl %ebx
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 
 	movl 20(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl 24(%esp), %ecx
 	movl 28(%esp), %edx
 	movl 32(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl 36(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl 40(%esp), %ebp
+	cfi_rel_offset (ebp, 12)
 	testl $0xfff, %ebp
 	movl $-EINVAL, %eax
 	jne L(skip)
@@ -54,14 +63,23 @@ ENTRY (__mmap)
 L(skip):
 	/* Restore registers.  */
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl %ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 #else
 
 	/* Save registers.  */
 	movl %ebx, %edx
+	cfi_register (ebx, edx)
 
 	movl $SYS_ify(mmap), %eax	/* System call number in %eax.  */
 
@@ -72,6 +90,7 @@ L(skip):
 
 	/* Restore registers.  */
 	movl %edx, %ebx
+	cfi_restore (ebx)
 
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/i386/mmap64.S b/sysdeps/unix/sysv/linux/i386/mmap64.S
index 3a03335814..f53e6e8c68 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap64.S
+++ b/sysdeps/unix/sysv/linux/i386/mmap64.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,96,97,98,99,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,98,99,2000,2002,2005,2006
+	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
@@ -20,7 +21,7 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define EINVAL	22
 #define ENOSYS	38
@@ -42,9 +43,13 @@ ENTRY (BP_SYM (__mmap64))
 
 	/* Save registers.  */
 	pushl %ebp
+	cfi_adjust_cfa_offset (4)
 	pushl %ebx
+	cfi_adjust_cfa_offset (4)
 	pushl %esi
+	cfi_adjust_cfa_offset (4)
 	pushl %edi
+	cfi_adjust_cfa_offset (4)
 
 	movl OFFLO(%esp), %edx
 	movl OFFHI(%esp), %ecx
@@ -54,12 +59,16 @@ ENTRY (BP_SYM (__mmap64))
 	shrl $12, %ecx
 	jne L(einval)
 	movl %edx, %ebp
+	cfi_rel_offset (ebp, 12)
 
 	movl ADDR(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl LEN(%esp), %ecx
 	movl PROT(%esp), %edx
 	movl FLAGS(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl FD(%esp), %edi
+	cfi_rel_offset (edi, 0)
 
 	movl $SYS_ify(mmap2), %eax	/* System call number in %eax.  */
 
@@ -69,9 +78,17 @@ L(do_syscall):
 
 	/* Restore registers.  */
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl %ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 #ifndef __ASSUME_MMAP2_SYSCALL
 2:
@@ -87,12 +104,25 @@ L(do_syscall):
 L(pseudo_end):
 	ret
 
+	cfi_adjust_cfa_offset (16)
+	cfi_rel_offset (ebp, 12)
+	cfi_rel_offset (ebx, 8)
+	cfi_rel_offset (esi, 4)
+	cfi_rel_offset (edi, 0)
 	/* This means the offset value is too large.  */
 L(einval):
 	popl %edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl %esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl %ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl %ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 	movl $-EINVAL, %eax
 	jmp SYSCALL_ERROR_LABEL
 #endif
@@ -101,6 +131,7 @@ L(einval):
 3:
 	/* Save registers.  */
 	movl %ebx, %edx
+	cfi_register (ebx, edx)
 
 	cmpl $0, OFFHI-SVRSP(%esp)
 	jne L(einval2)
@@ -114,6 +145,7 @@ L(einval):
 
 	/* Restore registers.  */
 	movl %edx, %ebx
+	cfi_restore (ebx)
 
 	/* If 0 > %eax > -4096 there was an error.  */
 	cmpl $-4096, %eax
@@ -125,8 +157,10 @@ L(pseudo_end):
 #endif
 	ret
 
+	cfi_register (ebx, edx)
 L(einval2):
 	movl %edx, %ebx
+	cfi_restore (ebx)
 	movl $-EINVAL, %eax
 	jmp SYSCALL_ERROR_LABEL
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/msgctl.c b/sysdeps/unix/sysv/linux/i386/msgctl.c
index 108da8a987..afecc49dd7 100644
--- a/sysdeps/unix/sysv/linux/i386/msgctl.c
+++ b/sysdeps/unix/sysv/linux/i386/msgctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_msqid_ds
diff --git a/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S b/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
index 99a3ea536d..092a3bfb97 100644
--- a/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
+++ b/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2000,2002,2003,2004,2005,2006
+	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
@@ -20,7 +21,7 @@
 #include <bp-sym.h>
 #include <bp-asm.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define EINVAL	22
 #define ENOSYS	38
@@ -42,25 +43,41 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
 
 	/* Save registers.  */
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	movl	FD(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl	OFFLO(%esp), %ecx
 	movl	OFFHI(%esp), %edx
 	movl	LENLO(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl	LENHI(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl	FLAGS(%esp), %ebp
+	cfi_rel_offset (ebp, 12)
 
 	movl	$SYS_ify(fadvise64_64), %eax
 	ENTER_KERNEL
 
 	/* Restore registers.  */
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 #ifndef __ASSUME_FADVISE64_64_SYSCALL
 	cmpl	$-ENOSYS, %eax
@@ -80,8 +97,11 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
     && (!defined __ASSUME_FADVISE64_64_SYSCALL || !defined __NR_fadvise64_64)
 1:	/* Save registers.  */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%esi
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	/* Overflow check.  */
 	cmpl	$0, LENHI(%esp)
@@ -89,10 +109,13 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
 	jne	L(overflow)
 
 	movl	FD(%esp), %ebx
+	cfi_rel_offset (ebx, 8)
 	movl	OFFLO(%esp), %ecx
 	movl	OFFHI(%esp), %edx
 	movl	LENLO(%esp), %esi
+	cfi_rel_offset (esi, 4)
 	movl	FLAGS(%esp), %edi
+	cfi_rel_offset (edi, 0)
 
 	movl	$SYS_ify(fadvise64), %eax
 	ENTER_KERNEL
@@ -100,8 +123,14 @@ ENTRY (BP_SYM (__posix_fadvise64_l64))
 	/* Restore registers.  */
 L(overflow):
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 
 	/* If 0 > %eax > -4096 there was an error.  */
 	negl	%eax
diff --git a/sysdeps/unix/sysv/linux/i386/pselect.c b/sysdeps/unix/sysv/linux/i386/pselect.c
new file mode 100644
index 0000000000..2646608786
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/pselect.c
@@ -0,0 +1,18 @@
+#include <sys/select.h>
+
+extern int __call_pselect6 (int nfds, fd_set *readfds, fd_set *writefds,
+			    fd_set *exceptfds, const struct timespec *timeout,
+			    void *data) attribute_hidden;
+
+
+#define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+  ({ int r = __call_pselect6 (nfds, readfds, writefds, exceptfds, timeout,    \
+			      data);					      \
+     if (r < 0 && r > -4096)						      \
+       {								      \
+	 __set_errno (-r);						      \
+	 r = -1;							      \
+       }								      \
+     r; })
+
+#include "../pselect.c"
diff --git a/sysdeps/unix/sysv/linux/i386/putmsg.c b/sysdeps/unix/sysv/linux/i386/putmsg.c
index e7b7a08b55..04fd159b7c 100644
--- a/sysdeps/unix/sysv/linux/i386/putmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/putmsg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2003, 2005 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
@@ -34,5 +34,5 @@ putmsg (fildes, ctlptr, dataptr, flags)
   return INLINE_SYSCALL (putpmsg, 5, fildes, ctlptr, dataptr, -1, flags);
 }
 #else
-# include <sysdeps/generic/putmsg.c>
+# include <streams/putmsg.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/readelflib.c b/sysdeps/unix/sysv/linux/i386/readelflib.c
index 6852f2a9a9..a6374e61d2 100644
--- a/sysdeps/unix/sysv/linux/i386/readelflib.c
+++ b/sysdeps/unix/sysv/linux/i386/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 2000.
@@ -73,10 +73,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/i386/semctl.c b/sysdeps/unix/sysv/linux/i386/semctl.c
index 14bfac613c..1693cd47c4 100644
--- a/sysdeps/unix/sysv/linux/i386/semctl.c
+++ b/sysdeps/unix/sysv/linux/i386/semctl.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1997,1998,2000,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -26,7 +27,7 @@
 #include <string.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_semid_ds
diff --git a/sysdeps/unix/sysv/linux/i386/semtimedop.S b/sysdeps/unix/sysv/linux/i386/semtimedop.S
index 572641675f..0893c6a654 100644
--- a/sysdeps/unix/sysv/linux/i386/semtimedop.S
+++ b/sysdeps/unix/sysv/linux/i386/semtimedop.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -32,22 +32,34 @@
 ENTRY (BP_SYM (semtimedop))
 
 	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	pushl	%edi
+	cfi_adjust_cfa_offset (4)
 
 	movl	$SYSOP_semtimedop, %ebx
+	cfi_rel_offset (ebx, 4)
 	movl	SEMID(%esp), %ecx
 	movl	NSOPS(%esp), %edx
 	movl	SOPS(%esp), %edi
+	cfi_rel_offset (edi, 0)
 	movl	TIMEOUT(%esp), %ebp
+	cfi_rel_offset (ebp, 8)
 	movl	$__NR_ipc, %eax
 
 	ENTER_KERNEL
 
 	/* Restore registers.  */
 	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
 
 	/* If 0 > %eax > -4096 there was an error.  */
 	cmpl $-4096, %eax
diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S
index ebed2ce572..bf2d7d2bad 100644
--- a/sysdeps/unix/sysv/linux/i386/setcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/setcontext.S
@@ -1,5 +1,5 @@
 /* Install given context.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -31,12 +31,16 @@ ENTRY(__setcontext)
 	   the system call fails and we return from the function with an
 	   error.  */
 	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
 	xorl	%edx, %edx
 	leal	oSIGMASK(%eax), %ecx
 	movl	$SIG_SETMASK, %ebx
+	cfi_rel_offset (ebx, 0)
 	movl	$__NR_sigprocmask, %eax
 	ENTER_KERNEL
 	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
 	cmpl	$-4095, %eax		/* Check %eax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
 
@@ -57,6 +61,13 @@ ENTRY(__setcontext)
 	movl	oEIP(%eax), %ecx
 
 	/* Load the new stack pointer.  */
+	cfi_def_cfa (eax, 0)
+	cfi_offset (edi, oEDI)
+	cfi_offset (esi, oESI)
+	cfi_offset (ebp, oEBP)
+	cfi_offset (ebx, oEBX)
+	cfi_offset (edx, oEDX)
+	cfi_offset (ecx, oECX)
 	movl	oESP(%eax), %esp
 
 	/* Push the return address on the new stack so we can return there.  */
@@ -72,6 +83,10 @@ ENTRY(__setcontext)
 	movl	oECX(%eax), %ecx
 	movl	oEAX(%eax), %eax
 
+	/* End FDE here, we fall into another context.  */
+	cfi_endproc
+	cfi_startproc
+
 	/* The following 'ret' will pop the address of the code and jump
 	   to it.  */
 
@@ -79,4 +94,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/setegid.c b/sysdeps/unix/sysv/linux/i386/setegid.c
index b4bf33f18f..755bc360ad 100644
--- a/sysdeps/unix/sysv/linux/i386/setegid.c
+++ b/sysdeps/unix/sysv/linux/i386/setegid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2000,2002,2003,2004,2006
+	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
@@ -19,7 +20,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setresgid
diff --git a/sysdeps/unix/sysv/linux/i386/seteuid.c b/sysdeps/unix/sysv/linux/i386/seteuid.c
index c139684d04..6de173521c 100644
--- a/sysdeps/unix/sysv/linux/i386/seteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/seteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,2004,2006 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
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setresuid
diff --git a/sysdeps/unix/sysv/linux/i386/setfsgid.c b/sysdeps/unix/sysv/linux/i386/setfsgid.c
index b98514d5be..7296d433ca 100644
--- a/sysdeps/unix/sysv/linux/i386/setfsgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setfsgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2003, 2006 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
@@ -23,7 +23,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setfsgid
diff --git a/sysdeps/unix/sysv/linux/i386/setfsuid.c b/sysdeps/unix/sysv/linux/i386/setfsuid.c
index f7cf89bf14..65ed353480 100644
--- a/sysdeps/unix/sysv/linux/i386/setfsuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setfsuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2003, 2006 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
@@ -24,7 +24,7 @@
 #include <sys/syscall.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_setfsuid
 
diff --git a/sysdeps/unix/sysv/linux/i386/setgid.c b/sysdeps/unix/sysv/linux/i386/setgid.c
index a7cdba582d..208ef25d0e 100644
--- a/sysdeps/unix/sysv/linux/i386/setgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setgid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2003, 2004, 2006 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setgid32
diff --git a/sysdeps/unix/sysv/linux/i386/setgroups.c b/sysdeps/unix/sysv/linux/i386/setgroups.c
index a2c6fc8daa..10f5b7c91b 100644
--- a/sysdeps/unix/sysv/linux/i386/setgroups.c
+++ b/sysdeps/unix/sysv/linux/i386/setgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2002,2004,2006 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
@@ -26,7 +26,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setgroups32
diff --git a/sysdeps/unix/sysv/linux/i386/setregid.c b/sysdeps/unix/sysv/linux/i386/setregid.c
index f20a78175a..05e448c6c9 100644
--- a/sysdeps/unix/sysv/linux/i386/setregid.c
+++ b/sysdeps/unix/sysv/linux/i386/setregid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2003,2004,2006 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setregid32
diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c
index d4093afb0f..d0750bb203 100644
--- a/sysdeps/unix/sysv/linux/i386/setresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresgid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,2004,2005,2006
+	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
@@ -20,7 +21,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresgid || defined __NR_setresgid32
@@ -80,6 +81,6 @@ weak_alias (__setresgid, setresgid)
 
 #else
 
-#include <sysdeps/generic/setresgid.c>
+#include <posix/setresgid.c>
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c
index 540b954e08..0a676e53a9 100644
--- a/sysdeps/unix/sysv/linux/i386/setresuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresuid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,2004,2005,2006
+	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
@@ -20,7 +21,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresuid || defined __NR_setresuid32
@@ -80,6 +81,6 @@ weak_alias (__setresuid, setresuid)
 
 #else
 
-#include <sysdeps/generic/setresuid.c>
+#include <posix/setresuid.c>
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/setreuid.c b/sysdeps/unix/sysv/linux/i386/setreuid.c
index 09717ec52a..1ea449616c 100644
--- a/sysdeps/unix/sysv/linux/i386/setreuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setreuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2003,2004,2006 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setreuid32
diff --git a/sysdeps/unix/sysv/linux/i386/setrlimit.c b/sysdeps/unix/sysv/linux/i386/setrlimit.c
index 4d23209f62..e7e517d914 100644
--- a/sysdeps/unix/sysv/linux/i386/setrlimit.c
+++ b/sysdeps/unix/sysv/linux/i386/setrlimit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2003, 2006 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
@@ -25,7 +25,7 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 extern int __new_setrlimit (enum __rlimit_resource resource,
 			    const struct rlimit *__unboundedrlimits);
diff --git a/sysdeps/unix/sysv/linux/i386/setuid.c b/sysdeps/unix/sysv/linux/i386/setuid.c
index f809948f59..21c5bcd615 100644
--- a/sysdeps/unix/sysv/linux/i386/setuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2003,2004,2006 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
@@ -20,7 +20,7 @@
 #include <unistd.h>
 #include <setxid.h>
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __NR_setuid32
diff --git a/sysdeps/unix/sysv/linux/i386/shmctl.c b/sysdeps/unix/sysv/linux/i386/shmctl.c
index 394d3c01cf..2cc039996c 100644
--- a/sysdeps/unix/sysv/linux/i386/shmctl.c
+++ b/sysdeps/unix/sysv/linux/i386/shmctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -27,7 +27,7 @@
 #include <bits/wordsize.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_shmid_ds
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index 9cb5b6e340..299574dac4 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/i386.
-   Copyright (C) 1991,1995-2000,02,03, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-2000,2002-2004,2005 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
@@ -154,6 +154,10 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S
index e403899cc6..7c8ac29b86 100644
--- a/sysdeps/unix/sysv/linux/i386/socket.S
+++ b/sysdeps/unix/sysv/linux/i386/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2002,2003,2005 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
@@ -41,7 +41,6 @@
 #endif
 
 .globl __socket
-	cfi_startproc
 ENTRY (__socket)
 #if defined NEED_CANCELLATION && defined CENABLE
 	SINGLE_THREAD_P
@@ -118,7 +117,6 @@ L(pseudo_end):
 	/* Successful; return the syscall's value.  */
 	ret
 #endif
-	cfi_endproc
 PSEUDO_END (__socket)
 
 #ifndef NO_WEAK_ALIAS
diff --git a/sysdeps/unix/sysv/linux/i386/swapcontext.S b/sysdeps/unix/sysv/linux/i386/swapcontext.S
index d909e659e4..27c16200b2 100644
--- a/sysdeps/unix/sysv/linux/i386/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/swapcontext.S
@@ -109,4 +109,4 @@ L(pseudo_end):
 	ret
 PSEUDO_END(__swapcontext)
 
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/i386/sync_file_range.S b/sysdeps/unix/sysv/linux/i386/sync_file_range.S
new file mode 100644
index 0000000000..f39e8a00d7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/sync_file_range.S
@@ -0,0 +1,72 @@
+/* Selective file content synch'ing.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#define _ERRNO_H        1
+#include <bits/errno.h>
+
+
+	.text
+ENTRY (sync_file_range)
+#ifdef __NR_sync_file_range
+	pushl	%ebx
+	cfi_adjust_cfa_offset (4)
+	pushl	%esi
+	cfi_adjust_cfa_offset (4)
+	pushl	%edi
+	cfi_adjust_cfa_offset (4)
+	pushl	%ebp
+	cfi_adjust_cfa_offset (4)
+
+	movl	20(%esp), %ebx
+	cfi_rel_offset (ebx, 12)
+	movl	24(%esp), %ecx
+	movl	28(%esp), %edx
+	movl	32(%esp), %esi
+	cfi_rel_offset (esi, 8)
+	movl	36(%esp), %edi
+	cfi_rel_offset (edi, 4)
+	movl	40(%esp), %ebp
+	cfi_rel_offset (ebp, 0)
+
+	movl	$SYS_ify(sync_file_range), %eax
+	ENTER_KERNEL
+
+	popl	%ebp
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebp)
+	popl	%edi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (edi)
+	popl	%esi
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (esi)
+	popl	%ebx
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (ebx)
+
+	cmpl	$-4095, %eax
+	jae	SYSCALL_ERROR_LABEL
+L(pseudo_end):
+	ret
+#else
+	movl	$-ENOSYS, %eax
+	jmp	SYSCALL_ERROR_LABEL
+#endif
+PSEUDO_END (sync_file_range)
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 214397446d..3ff3a73aab 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -5,5 +5,4 @@ vm86old		EXTRA	vm86old		i:p	__vm86old	vm86@GLIBC_2.0
 vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
-time		-	time		Ei:p	time
 waitpid		-	waitpid		Ci:ipi	__waitpid	waitpid	__libc_waitpid
diff --git a/sysdeps/unix/sysv/linux/i386/sysconf.c b/sysdeps/unix/sysv/linux/i386/sysconf.c
index eae849b277..2ffbd5227b 100644
--- a/sysdeps/unix/sysv/linux/i386/sysconf.c
+++ b/sysdeps/unix/sysv/linux/i386/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 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
@@ -26,7 +26,7 @@
 static long int linux_sysconf (int name);
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_i486 (int name)
 {
   /* The processor only has a unified level 1 cache of 8k.  */
@@ -84,11 +84,24 @@ static const struct intel_02_cache_info
     { 0x29, _SC_LEVEL3_CACHE_SIZE, 4194304, 8, 64 },
     { 0x2c, _SC_LEVEL1_DCACHE_SIZE, 32768, 8, 64 },
     { 0x30, _SC_LEVEL1_ICACHE_SIZE, 32768, 8, 64 },
+    { 0x39, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 64 },
+    { 0x3a, _SC_LEVEL2_CACHE_SIZE, 196608, 6, 64 },
+    { 0x3b, _SC_LEVEL2_CACHE_SIZE, 131072, 2, 64 },
+    { 0x3c, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 64 },
+    { 0x3d, _SC_LEVEL2_CACHE_SIZE, 393216, 6, 64 },
+    { 0x3e, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 64 },
     { 0x41, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 32 },
     { 0x42, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 32 },
     { 0x43, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 32 },
     { 0x44, _SC_LEVEL2_CACHE_SIZE, 1048576, 4, 32 },
     { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
+    { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
+    { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
+    { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
+    { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
+    { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
+    { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
+    { 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 },
     { 0x60, _SC_LEVEL1_DCACHE_SIZE, 16384, 8, 64 },
     { 0x66, _SC_LEVEL1_DCACHE_SIZE, 8192, 4, 64 },
     { 0x67, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 },
@@ -99,6 +112,7 @@ static const struct intel_02_cache_info
     { 0x7b, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 64 },
     { 0x7c, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 64 },
     { 0x7d, _SC_LEVEL2_CACHE_SIZE, 2097152, 8, 64 },
+    { 0x7f, _SC_LEVEL2_CACHE_SIZE, 524288, 2, 64 },
     { 0x82, _SC_LEVEL2_CACHE_SIZE, 262144, 8, 32 },
     { 0x83, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 32 },
     { 0x84, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 32 },
@@ -126,6 +140,7 @@ intel_02_known_compare (const void *p1, const void *p2)
 
 
 static long int
+__attribute__ ((noinline))
 intel_check_word (int name, unsigned int value, bool *has_level_2,
 		  bool *no_level_2_or_3)
 {
@@ -152,6 +167,33 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 	}
       else
 	{
+	  if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+	    {
+	      /* Intel reused this value.  For family 15, model 6 it
+		 specifies the 3rd level cache.  Otherwise the 2nd
+		 level cache.  */
+	      unsigned int eax;
+	      unsigned int ebx;
+	      unsigned int ecx;
+	      unsigned int edx;
+	      asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
+			    : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
+			    : "0" (1));
+
+	      unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf);
+	      unsigned int model = ((((eax >>16) & 0xf) << 4)
+				    + ((eax >> 4) & 0xf));
+	      if (family == 15 && model == 6)
+		{
+		  /* The level 3 cache is encoded for this model like
+		     the level 2 cache is for other models.  Pretend
+		     the caller asked for the level 2 cache.  */
+		  name = (_SC_LEVEL2_CACHE_SIZE
+			  + (name - _SC_LEVEL3_CACHE_SIZE));
+		  folded_name = _SC_LEVEL3_CACHE_SIZE;
+		}
+	    }
+
 	  struct intel_02_cache_info *found;
 	  struct intel_02_cache_info search;
 
@@ -188,7 +230,7 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 }
 
 
-static long int
+static long int  __attribute__ ((noinline))
 handle_intel (int name, unsigned int maxidx)
 {
   if (maxidx < 2)
@@ -250,7 +292,7 @@ handle_intel (int name, unsigned int maxidx)
 }
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_amd (int name)
 {
   unsigned int eax;
@@ -345,17 +387,6 @@ i386_i486_test (void)
 long int
 __sysconf (int name)
 {
-  if (name == _SC_CPUTIME || name == _SC_THREAD_CPUTIME)
-    {
-#if HP_TIMING_AVAIL
-      // XXX We can add  here test for machines which cannot support a
-      // XXX usable TSC.
-      return 200112L;
-#else
-      return -1;
-#endif
-    }
-
   /* All the remainder, except the cache information, is handled in
      the generic code.  */
   if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index af75d4c51a..5286676fc1 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992,1993,1995-2000,2002,2003,2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1995-2000,2002-2005,2006
+   	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
 
@@ -109,27 +109,6 @@
 # define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
 #else
 
-# ifndef HAVE_HIDDEN
-#  define SETUP_PIC_REG(reg) \
-  call 1f;								      \
-  .subsection 1;							      \
-1:movl (%esp), %e##reg;							      \
-  ret;									      \
-  .previous
-# else
-#  define SETUP_PIC_REG(reg) \
-  .section .gnu.linkonce.t.__i686.get_pc_thunk.reg,"ax",@progbits;	      \
-  .globl __i686.get_pc_thunk.reg;					      \
-  .hidden __i686.get_pc_thunk.reg;					      \
-  .type __i686.get_pc_thunk.reg,@function;				      \
-__i686.get_pc_thunk.reg:						      \
-  movl (%esp), %e##reg;							      \
-  ret;									      \
-  .size __i686.get_pc_thunk.reg, . - __i686.get_pc_thunk.reg;		      \
-  .previous;								      \
-  call __i686.get_pc_thunk.reg
-# endif
-
 # if RTLD_PRIVATE_ERRNO
 #  define SYSCALL_ERROR_HANDLER						      \
 0:SETUP_PIC_REG(cx);							      \
@@ -154,22 +133,36 @@ __i686.get_pc_thunk.reg:						      \
   movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx;			      \
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \
-  movl %edx, %gs:0(%ecx);						      \
+  SYSCALL_ERROR_HANDLER_TLS_STORE (%edx, %ecx);				      \
   orl $-1, %eax;							      \
   jmp L(pseudo_end);
+#   ifndef NO_TLS_DIRECT_SEG_REFS
+#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+  movl src, %gs:(destoff)
+#   else
+#    define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff)		      \
+  addl %gs:0, destoff;							      \
+  movl src, (destoff)
+#   endif
 #  else
 #   define SYSCALL_ERROR_HANDLER					      \
 0:pushl %ebx;								      \
+  cfi_adjust_cfa_offset (4);						      \
+  cfi_rel_offset (ebx, 0);						      \
   SETUP_PIC_REG (bx);							      \
   addl $_GLOBAL_OFFSET_TABLE_, %ebx;					      \
   xorl %edx, %edx;							      \
   subl %eax, %edx;							      \
   pushl %edx;								      \
+  cfi_adjust_cfa_offset (4);						      \
   PUSH_ERRNO_LOCATION_RETURN;						      \
   call BP_SYM (__errno_location)@PLT;					      \
   POP_ERRNO_LOCATION_RETURN;						      \
   popl %ecx;								      \
+  cfi_adjust_cfa_offset (-4);						      \
   popl %ebx;								      \
+  cfi_adjust_cfa_offset (-4);						      \
+  cfi_restore (ebx);							      \
   movl %ecx, (%eax);							      \
   orl $-1, %eax;							      \
   jmp L(pseudo_end);
@@ -265,9 +258,11 @@ __i686.get_pc_thunk.reg:						      \
 #define PUSHARGS_1	movl %ebx, %edx; L(SAVEBX1): PUSHARGS_0
 #define	DOARGS_1	_DOARGS_1 (4)
 #define	POPARGS_1	POPARGS_0; movl %edx, %ebx; L(RESTBX1):
-#define	_PUSHARGS_1	pushl %ebx; L(PUSHBX1): _PUSHARGS_0
+#define	_PUSHARGS_1	pushl %ebx; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (ebx, 0); L(PUSHBX1): _PUSHARGS_0
 #define _DOARGS_1(n)	movl n(%esp), %ebx; _DOARGS_0(n-4)
-#define	_POPARGS_1	_POPARGS_0; popl %ebx; L(POPBX1):
+#define	_POPARGS_1	_POPARGS_0; popl %ebx; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (ebx); L(POPBX1):
 
 #define PUSHARGS_2	PUSHARGS_1
 #define	DOARGS_2	_DOARGS_2 (8)
@@ -286,23 +281,29 @@ __i686.get_pc_thunk.reg:						      \
 #define PUSHARGS_4	_PUSHARGS_4
 #define DOARGS_4	_DOARGS_4 (24)
 #define POPARGS_4	_POPARGS_4
-#define _PUSHARGS_4	pushl %esi; L(PUSHSI1): _PUSHARGS_3
+#define _PUSHARGS_4	pushl %esi; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (esi, 0); L(PUSHSI1): _PUSHARGS_3
 #define _DOARGS_4(n)	movl n(%esp), %esi; _DOARGS_3 (n-4)
-#define _POPARGS_4	_POPARGS_3; popl %esi; L(POPSI1):
+#define _POPARGS_4	_POPARGS_3; popl %esi; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (esi); L(POPSI1):
 
 #define PUSHARGS_5	_PUSHARGS_5
 #define DOARGS_5	_DOARGS_5 (32)
 #define POPARGS_5	_POPARGS_5
-#define _PUSHARGS_5	pushl %edi; L(PUSHDI1): _PUSHARGS_4
+#define _PUSHARGS_5	pushl %edi; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (edi, 0); L(PUSHDI1): _PUSHARGS_4
 #define _DOARGS_5(n)	movl n(%esp), %edi; _DOARGS_4 (n-4)
-#define _POPARGS_5	_POPARGS_4; popl %edi; L(POPDI1):
+#define _POPARGS_5	_POPARGS_4; popl %edi; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (edi); L(POPDI1):
 
 #define PUSHARGS_6	_PUSHARGS_6
-#define DOARGS_6	_DOARGS_6 (36)
+#define DOARGS_6	_DOARGS_6 (40)
 #define POPARGS_6	_POPARGS_6
-#define _PUSHARGS_6	pushl %ebp; L(PUSHBP1): _PUSHARGS_5
+#define _PUSHARGS_6	pushl %ebp; cfi_adjust_cfa_offset (4); \
+			cfi_rel_offset (ebp, 0); L(PUSHBP1): _PUSHARGS_5
 #define _DOARGS_6(n)	movl n(%esp), %ebp; _DOARGS_5 (n-4)
-#define _POPARGS_6	_POPARGS_5; popl %ebp; L(POPBP1):
+#define _POPARGS_6	_POPARGS_5; popl %ebp; cfi_adjust_cfa_offset (-4); \
+			cfi_restore (ebp); L(POPBP1):
 
 #else	/* !__ASSEMBLER__ */
 
@@ -446,7 +447,7 @@ asm (".L__X'%ebx = 1\n\t"
 
 #define LOADARGS_0
 #ifdef __PIC__
-# if defined I386_USE_SYSENTER
+# if defined I386_USE_SYSENTER && defined SHARED
 #  define LOADARGS_1 \
     "bpushl .L__X'%k3, %k3\n\t"
 #  define LOADARGS_5 \
@@ -532,6 +533,49 @@ asm (".L__X'%ebx = 1\n\t"
 # define EXTRAVAR_5
 #endif
 
+/* Consistency check for position-independent code.  */
+#ifdef __PIC__
+# define check_consistency()						      \
+  ({ int __res;								      \
+     __asm__ __volatile__						      \
+       ("call __i686.get_pc_thunk.cx;"					      \
+	"addl $_GLOBAL_OFFSET_TABLE_, %%ecx;"				      \
+	"subl %%ebx, %%ecx;"						      \
+	"je 1f;"							      \
+	"ud2;"								      \
+	"1:\n"								      \
+	".section .gnu.linkonce.t.__i686.get_pc_thunk.cx,\"ax\",@progbits;"   \
+	".globl __i686.get_pc_thunk.cx;"				      \
+	".hidden __i686.get_pc_thunk.cx;"				      \
+	".type __i686.get_pc_thunk.cx,@function;"			      \
+	"__i686.get_pc_thunk.cx:"					      \
+	"movl (%%esp), %%ecx;"						      \
+	"ret;"								      \
+	".previous"							      \
+	: "=c" (__res));						      \
+     __res; })
+#endif
+
 #endif	/* __ASSEMBLER__ */
 
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  Using a global variable
+   is too complicated here since we have no PC-relative addressing mode.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg)	xorl %gs:POINTER_GUARD, reg
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# else
+#  define PTR_MANGLE(var)	asm ("xorl %%gs:%c2, %0"		      \
+				     : "=r" (var)			      \
+				     : "0" (var),			      \
+				       "i" (offsetof (tcbhead_t,	      \
+						      pointer_guard)))
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/i386/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.h b/sysdeps/unix/sysv/linux/i386/ucontext_i.h
deleted file mode 100644
index d6efca41b1..0000000000
--- a/sysdeps/unix/sysv/linux/i386/ucontext_i.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oLINK		4
-#define oSS_SP		8
-#define oSS_SIZE	16
-#define oGS		20
-#define oFS		24
-#define oEDI		36
-#define oESI		40
-#define oEBP		44
-#define oESP		48
-#define oEBX		52
-#define oEDX		56
-#define oECX		60
-#define oEAX		64
-#define oEIP		76
-#define oFPREGS		96
-#define oSIGMASK	108
-#define oFPREGSMEM	236
diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
new file mode 100644
index 0000000000..b11a5509cd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
@@ -0,0 +1,30 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+#define mreg(reg)		mcontext (gregs[REG_##reg])
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oGS		mreg (GS)
+oFS		mreg (FS)
+oEDI		mreg (EDI)
+oESI		mreg (ESI)
+oEBP		mreg (EBP)
+oESP		mreg (ESP)
+oEBX		mreg (EBX)
+oEDX		mreg (EDX)
+oECX		mreg (ECX)
+oEAX		mreg (EAX)
+oEIP		mreg (EIP)
+oFPREGS		mcontext (fpregs)
+oSIGMASK	ucontext (uc_sigmask)
+oFPREGSMEM	ucontext (__fpregs_mem)
diff --git a/sysdeps/unix/sysv/linux/i386/vfork.S b/sysdeps/unix/sysv/linux/i386/vfork.S
index e660e6b70e..eefd4b49cb 100644
--- a/sysdeps/unix/sysv/linux/i386/vfork.S
+++ b/sysdeps/unix/sysv/linux/i386/vfork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Schwab <schwab@gnu.org>.
 
@@ -33,6 +33,7 @@ ENTRY (__vfork)
 
 	/* Pop the return PC value into ECX.  */
 	popl	%ecx
+	cfi_adjust_cfa_offset (-4)
 
 #ifdef SAVE_PID
 	SAVE_PID
@@ -46,6 +47,7 @@ ENTRY (__vfork)
 	   disturbs the branch target cache.  Instead push the return
 	   address back on the stack.  */
 	pushl	%ecx
+	cfi_adjust_cfa_offset (4)
 
 #ifdef RESTORE_PID
 	RESTORE_PID
diff --git a/sysdeps/unix/sysv/linux/i386/xstat.c b/sysdeps/unix/sysv/linux/i386/xstat.c
index 7c41d8cefa..d27ecd3126 100644
--- a/sysdeps/unix/sysv/linux/i386/xstat.c
+++ b/sysdeps/unix/sysv/linux/i386/xstat.c
@@ -1,5 +1,6 @@
 /* xstat using old-style Unix stat system call.
-   Copyright (C) 1991,95,96,97,98,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,95,96,97,98,2000,2002,2003,2006
+	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
@@ -30,7 +31,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #include <xstatconv.h>
 
diff --git a/sysdeps/unix/sysv/linux/ia64/Dist b/sysdeps/unix/sysv/linux/ia64/Dist
deleted file mode 100644
index b4118bdead..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/Dist
+++ /dev/null
@@ -1,13 +0,0 @@
-clone.S
-clone2.S
-dl-brk.S
-dl-static.c
-has_cpuclock.c
-ioperm.c
-ldd-rewrite.sed
-__start_context.S
-ucontext_i.h
-sys/procfs.h
-sys/io.h
-sys/rse.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/ia64/__longjmp.S b/sysdeps/unix/sysv/linux/ia64/__longjmp.S
index 7922e81bea..aa18fadf9c 100644
--- a/sysdeps/unix/sysv/linux/ia64/__longjmp.S
+++ b/sysdeps/unix/sysv/linux/ia64/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -101,6 +101,9 @@ LEAF(__longjmp)
 	ld8.nta r18=[r2],16		// b2
 	ld8.nta r19=[r3],16		// b3
 	;;
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (r16, r24)
+#endif
 	ld8.nta r20=[r2],16		// b4
 	ld8.nta r21=[r3],16		// b5
 	;;
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
index d330954d48..ed8c2da9e2 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/IA64.
-   Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2004, 2006 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
@@ -23,6 +23,9 @@
 
 
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -40,9 +43,9 @@
 #define O_SYNC		010000
 #define O_FSYNC		O_SYNC
 #define O_ASYNC		020000
-#define O_DIRECT	040000
 
 #ifdef __USE_GNU
+# define O_DIRECT	040000
 # define O_DIRECTORY	0200000	/* must be a directory */
 # define O_NOFOLLOW	0400000 /* don't follow links */
 # define O_NOATIME	01000000 /* Do not set atime.  */
@@ -92,7 +95,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -174,10 +177,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/mman.h b/sysdeps/unix/sysv/linux/ia64/bits/mman.h
index 01db5be028..a27a30fc0c 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/ia64 version.
-   Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,2000,2003,2005,2006 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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
index 76625753d9..8bd675e4ec 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h
@@ -1,5 +1,5 @@
 /* Define the machine-dependent type `jmp_buf'.  Linux/IA-64 version.
-   Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999,2000,2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
@@ -32,9 +32,4 @@
 /* the __jmp_buf element type should be __float80 per ABI... */
 typedef long __jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128-bit alignment! */
 
-/* Test if longjmp to JMPBUF would unwind the frame containing a local
-   variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address)		\
-     ((void *)(_address) < (void *)(((long *)_jmpbuf)[0]))
-
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/shm.h b/sysdeps/unix/sysv/linux/ia64/bits/shm.h
index 078345d7e6..7f38f2dd7b 100644
--- a/sysdeps/unix/sysv/linux/ia64/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/ia64/bits/shm.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2002, 2005 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
@@ -38,6 +38,8 @@
 /* Segment low boundary address multiple.  */
 #define SHMLBA		(1024 * 1024)
 
+/* Type to count number of attaches.  */
+typedef unsigned long int shmatt_t;
 
 /* Data structure describing a set of semaphores.  */
 struct shmid_ds
@@ -49,7 +51,7 @@ struct shmid_ds
     __time_t shm_ctime;			/* time of last change by shmctl() */
     __pid_t shm_cpid;			/* pid of creator */
     __pid_t shm_lpid;			/* pid of last shmop */
-    unsigned long int shm_nattch;	/* number of current attaches */
+    shmatt_t shm_nattch;		/* number of current attaches */
     unsigned long int __unused1;
     unsigned long int __unused2;
   };
@@ -64,6 +66,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c b/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c
index d2c45a560a..2f39851535 100644
--- a/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c
+++ b/sysdeps/unix/sysv/linux/ia64/clock_getcpuclockid.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* clock_getcpuclockid -- Get a clockid_t for process CPU time.  Linux/IA64
+   Copyright (C) 2000,2001,2003,2004 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
@@ -26,22 +27,6 @@
 
 #include "has_cpuclock.c"
 
+#define HAS_CPUCLOCK (has_cpuclock () > 0)
 
-int
-clock_getcpuclockid (pid_t pid, clockid_t *clock_id)
-{
-  /* We don't allow any process ID but our own.  */
-  if (pid != 0 && pid != getpid ())
-    return EPERM;
-
-  int retval = ENOENT;
-
-  if (has_cpuclock () > 0)
-    {
-      /* Store the number.  */
-      *clock_id = CLOCK_PROCESS_CPUTIME_ID;
-      retval = 0;
-    }
-
-  return retval;
-}
+#include <sysdeps/unix/sysv/linux/clock_getcpuclockid.c>
diff --git a/sysdeps/unix/sysv/linux/ia64/clone2.S b/sysdeps/unix/sysv/linux/ia64/clone2.S
index 69c9e05044..d38eb201ad 100644
--- a/sysdeps/unix/sysv/linux/ia64/clone2.S
+++ b/sysdeps/unix/sysv/linux/ia64/clone2.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2003, 2004, 2006 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
@@ -32,10 +32,12 @@ ENTRY(__clone2)
 	.prologue
 	alloc r2=ar.pfs,8,1,6,0
 	cmp.eq p6,p0=0,in0
+	cmp.eq p7,p0=0,in1
 	mov r8=EINVAL
 	mov out0=in3		/* Flags are first syscall argument.	*/
 	mov out1=in1		/* Stack address.			*/
-(p6)	br.cond.spnt.many __syscall_error
+(p6)	br.cond.spnt.many __syscall_error	/* no NULL function pointers */
+(p7)	br.cond.spnt.many __syscall_error	/* no NULL stack pointers */
 	;;
 	mov out2=in2		/* Stack size.				*/
 	mov out3=in5		/* Parent TID Pointer			*/
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-cache.h b/sysdeps/unix/sysv/linux/ia64/dl-cache.h
index b8e2790589..c2165706c0 100644
--- a/sysdeps/unix/sysv/linux/ia64/dl-cache.h
+++ b/sysdeps/unix/sysv/linux/ia64/dl-cache.h
@@ -22,4 +22,31 @@
 #define _dl_cache_check_flags(flags) \
   ((flags) == _DL_CACHE_DEFAULT_ID)
 
+#define EMUL_HACK "/emul/ia32-linux"
+
+#define arch_startup(argc, argv) unlink (EMUL_HACK LD_SO_CACHE)
+
+#define add_arch_dirs(config_file) \
+  do {							\
+    int save_verbose = opt_verbose;			\
+    opt_verbose = 0;					\
+							\
+    parse_conf (config_file, EMUL_HACK, true);		\
+							\
+    /* Always add the standard search paths.  */	\
+    add_system_dir (EMUL_HACK SLIBDIR);			\
+    if (strcmp (SLIBDIR, LIBDIR))			\
+      add_system_dir (EMUL_HACK LIBDIR);		\
+							\
+    char emul_config_file[strlen (config_file)		\
+			  + sizeof EMUL_HACK];		\
+    strcpy (mempcpy (emul_config_file, EMUL_HACK,	\
+		     strlen (EMUL_HACK)), config_file);	\
+							\
+    if (! access (emul_config_file, R_OK))		\
+      parse_conf (emul_config_file, EMUL_HACK, true);	\
+							\
+    opt_verbose = save_verbose;				\
+  } while (0)
+
 #include_next <dl-cache.h>
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c
new file mode 100644
index 0000000000..7e26fecb3a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.c
@@ -0,0 +1,5 @@
+#ifdef IS_IN_ldconfig
+#include <sysdeps/i386/dl-procinfo.c>
+#else
+#include <sysdeps/generic/dl-procinfo.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h
new file mode 100644
index 0000000000..b360b4288a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/dl-procinfo.h
@@ -0,0 +1,5 @@
+#ifdef IS_IN_ldconfig
+#include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
+#else
+#include <sysdeps/generic/dl-procinfo.h>
+#endif
diff --git a/sysdeps/unix/sysv/linux/ia64/getcontext.S b/sysdeps/unix/sysv/linux/ia64/getcontext.S
index 0f9cc5db19..4e18bace2d 100644
--- a/sysdeps/unix/sysv/linux/ia64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/getcontext.S
@@ -155,4 +155,4 @@ ENTRY(__getcontext)
 	ret
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
index ee19161272..39511cd2c5 100644
--- a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
+++ b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2003, 2004, 2005 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
@@ -21,7 +21,7 @@
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-
+#include <not-cancel.h>
 
 static int itc_usable;
 
@@ -31,18 +31,18 @@ has_cpuclock (void)
   if (__builtin_expect (itc_usable == 0, 0))
     {
       int newval = 1;
-      int fd = open ("/proc/sal/itc_drift", O_RDONLY);
+      int fd = open_not_cancel_2 ("/proc/sal/itc_drift", O_RDONLY);
       if (__builtin_expect (fd != -1, 1))
 	{
 	  char buf[16];
 	  /* We expect the file to contain a single digit followed by
 	     a newline.  If the format changes we better not rely on
 	     the file content.  */
-	  if (read (fd, buf, sizeof buf) != 2 || buf[0] != '0'
-	      || buf[1] != '\n')
+	  if (read_not_cancel (fd, buf, sizeof buf) != 2
+	      || buf[0] != '0' || buf[1] != '\n')
 	    newval = -1;
 
-	  close (fd);
+	  close_not_cancel_no_status (fd);
 	}
 
       itc_usable = newval;
diff --git a/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
index 535d1671e3..1df27afd2d 100644
--- a/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
@@ -1 +1 @@
-s_^\(RTLDLIST=\)\([^ 	]*\)-ia64\(\.so\.[0-9.]*\)[ 	]*$_\1"\2-ia64\3 \2\3"_
+s_^\(RTLDLIST=\)\([^ 	]*\)-ia64\(\.so\.[0-9.]*\)[ 	]*$_\1"\2-ia64\3 /emul/ia32-linux\2\3"_
diff --git a/sysdeps/unix/sysv/linux/ia64/readelflib.c b/sysdeps/unix/sysv/linux/ia64/readelflib.c
index 9b1a645d34..7a10d23c90 100644
--- a/sysdeps/unix/sysv/linux/ia64/readelflib.c
+++ b/sysdeps/unix/sysv/linux/ia64/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2005 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
@@ -51,10 +51,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/ia64/setcontext.S b/sysdeps/unix/sysv/linux/ia64/setcontext.S
index e18c40fa4c..ef0a93c0c0 100644
--- a/sysdeps/unix/sysv/linux/ia64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/ia64/setcontext.S
@@ -150,4 +150,4 @@ ENTRY(__setcontext)
 	ret
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/ia64/setjmp.S b/sysdeps/unix/sysv/linux/ia64/setjmp.S
index 9c987c7ef8..53f80d203e 100644
--- a/sysdeps/unix/sysv/linux/ia64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/ia64/setjmp.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005
+   Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -86,7 +87,7 @@ libc_hidden_def (_setjmp)
 
 ENTRY(__sigsetjmp)
 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
-	alloc loc1=ar.pfs,2,3,2,0
+	alloc loc1=ar.pfs,2,5,2,0
 	.save ar.unat, loc2
 	mov loc2=ar.unat
 	;;
@@ -140,7 +141,13 @@ ENTRY(__sigsetjmp)
 	;;
 	stf.spill.nta [r8]=f28,32
 	stf.spill.nta [r9]=f29,32
+#ifdef PTR_MANGLE
+	mov loc3=loc0
 	;;
+	PTR_MANGLE (loc3, loc4)
+#else
+	;;
+#endif
 	stf.spill.nta [r8]=f30
 	stf.spill.nta [r9]=f31
 
@@ -151,7 +158,11 @@ ENTRY(__sigsetjmp)
 	mov r25=ar.unat
 	mov out0=in0
 
+#ifdef PTR_MANGLE
+	st8.nta [r2]=loc3,16		// b0
+#else
 	st8.nta [r2]=loc0,16		// b0
+#endif
 	st8.nta [r3]=r17,16		// b1
 	mov out1=in1
 	;;
@@ -169,7 +180,12 @@ ENTRY(__sigsetjmp)
 	;;
 	st8.nta [r2]=r25		// ar.unat
 	st8.nta [r3]=in0		// &__jmp_buf
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	;;
+#else
 	br.call.dpnt.few rp=__sigjmp_save
+#endif
 .ret0:					// force a new bundle ::q
 	mov.m ar.unat=loc2		// restore caller's unat
 	mov rp=loc0
diff --git a/sysdeps/unix/sysv/linux/ia64/sigaction.c b/sysdeps/unix/sysv/linux/ia64/sigaction.c
index 6ec3cb1e61..fdbc93f0ed 100644
--- a/sysdeps/unix/sysv/linux/ia64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/ia64/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Linux/IA64 specific sigaction
    Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
@@ -48,6 +48,10 @@ __libc_sigaction (sig, act, oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_def (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/ia64/sigsuspend.c b/sysdeps/unix/sysv/linux/ia64/sigsuspend.c
deleted file mode 100644
index f8f9563494..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/sigsuspend.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-/* Change the set of blocked signals to SET,
-   wait until a signal arrives, and restore the set of blocked signals.  */
-int
-__sigsuspend (set)
-     const sigset_t *set;
-{
-  /* XXX The size argument hopefully will have to be changed to the
-     real size of the user-level sigset_t.  */
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
index 986c4b2d33..ff77627a83 100644
--- a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux/ia64 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2006 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
@@ -75,14 +75,6 @@ enum __ptrace_request
   PTRACE_SINGLEBLOCK = 12,
 #define PT_STEPBLOCK PTRACE_SINGLEBLOCK
 
-  /* Get siginfo for process.  */
-  PTRACE_GETSIGINFO = 13,
-#define PT_GETSIGINFO PTRACE_GETSIGINFO
-
-  /* Set new siginfo for process.  */
-  PTRACE_SETSIGINFO = 14,
-#define PT_GETSIGINFO PTRACE_GETSIGINFO
-
   /* Attach to a process that is already running. */
   PTRACE_ATTACH = 16,
 #define PT_ATTACH PTRACE_ATTACH
@@ -100,8 +92,24 @@ enum __ptrace_request
 #define PT_SETREGS PTRACE_SETREGS
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* pt_all_user_regs is used for PTRACE_GETREGS/PTRACE_SETREGS.  */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 31c7718d8b..c55c70ef54 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -2,7 +2,6 @@
 
 umount2		-	umount		2	__umount2	umount2
 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 getpriority	-	getpriority	i:ii	__getpriority	getpriority
 
 # semaphore and shm system calls
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
index a4453ddcc7..dd7a5b1b1d 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
    Based on code originally written by David Mosberger-Tang
@@ -204,7 +205,7 @@
     register long _r8 __asm ("r8");					      \
     register long _r10 __asm ("r10");					      \
     register long _r15 __asm ("r15") = name;				      \
-    register void *_b7 __asm ("b7") = ((tcbhead_t *) __thread_self)->private; \
+    register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\
     long _retval;							      \
     LOAD_REGS_##nr							      \
     /*									      \
@@ -360,4 +361,24 @@
 
 #endif /* not __ASSEMBLER__ */
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+        add	tmpreg=-16,r13		\
+        ;;				\
+        ld8	tmpreg=[tmpreg]		\
+        ;;				\
+        xor	reg=reg, tmpreg
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/ia64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 377ccf5199..66f0ac1317 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,98,99,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005
+   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
@@ -188,12 +189,8 @@ if_nameindex_netlink (void)
 
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    goto exit_close;
-
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces.  Collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     goto exit_free;
 
   /* Count the interfaces.  */
@@ -290,7 +287,6 @@ if_nameindex_netlink (void)
 
  exit_free:
   __netlink_free_handle (&nh);
- exit_close:
   __netlink_close (&nh);
 
   return idx;
diff --git a/sysdeps/unix/sysv/linux/ifaddrs.c b/sysdeps/unix/sysv/linux/ifaddrs.c
index 8a052e212d..02e6935538 100644
--- a/sysdeps/unix/sysv/linux/ifaddrs.c
+++ b/sysdeps/unix/sysv/linux/ifaddrs.c
@@ -1,5 +1,5 @@
 /* getifaddrs -- get names and addresses of all network interfaces
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006, 2007 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
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <alloca.h>
 #include <assert.h>
 #include <errno.h>
 #include <ifaddrs.h>
@@ -24,6 +25,7 @@
 #include <netinet/in.h>
 #include <netpacket/packet.h>
 #include <stdbool.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -84,13 +86,14 @@ __netlink_free_handle (struct netlink_handle *h)
 }
 
 
-int
+static int
 __netlink_sendreq (struct netlink_handle *h, int type)
 {
-  struct
+  struct req
   {
     struct nlmsghdr nlh;
     struct rtgenmsg g;
+    char pad[0];
   } req;
   struct sockaddr_nl nladdr;
 
@@ -103,6 +106,8 @@ __netlink_sendreq (struct netlink_handle *h, int type)
   req.nlh.nlmsg_pid = 0;
   req.nlh.nlmsg_seq = h->seq;
   req.g.rtgen_family = AF_UNSPEC;
+  if (sizeof (req) != offsetof (struct req, pad))
+    memset (req.pad, '\0', sizeof (req) - offsetof (struct req, pad));
 
   memset (&nladdr, '\0', sizeof (nladdr));
   nladdr.nl_family = AF_NETLINK;
@@ -114,16 +119,40 @@ __netlink_sendreq (struct netlink_handle *h, int type)
 
 
 int
-__netlink_receive (struct netlink_handle *h)
+__netlink_request (struct netlink_handle *h, int type)
 {
   struct netlink_res *nlm_next;
-  char buf[4096];
-  struct iovec iov = { buf, sizeof (buf) };
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;
-  int read_len;
+  ssize_t read_len;
   bool done = false;
 
+#ifdef PAGE_SIZE
+  /* Help the compiler optimize out the malloc call if PAGE_SIZE
+     is constant and smaller or equal to PTHREAD_STACK_MIN/4.  */
+  const size_t buf_size = PAGE_SIZE;
+#else
+  const size_t buf_size = __getpagesize ();
+#endif
+  bool use_malloc = false;
+  char *buf;
+
+  if (__libc_use_alloca (buf_size))
+    buf = alloca (buf_size);
+  else
+    {
+      buf = malloc (buf_size);
+      if (buf != NULL)
+	use_malloc = true;
+      else
+	goto out_fail;
+    }
+
+  struct iovec iov = { buf, buf_size };
+
+  if (__netlink_sendreq (h, type) < 0)
+    goto out_fail;
+
   while (! done)
     {
       struct msghdr msg =
@@ -136,33 +165,25 @@ __netlink_receive (struct netlink_handle *h)
 
       read_len = TEMP_FAILURE_RETRY (__recvmsg (h->fd, &msg, 0));
       if (read_len < 0)
-	return -1;
+	goto out_fail;
 
-      if (msg.msg_flags & MSG_TRUNC)
-	return -1;
+      if (nladdr.nl_pid != 0)
+	continue;
 
-      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
-						+ read_len);
-      if (nlm_next == NULL)
-	return -1;
-      nlm_next->next = NULL;
-      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
-      nlm_next->size = read_len;
-      nlm_next->seq = h->seq;
-      if (h->nlm_list == NULL)
-	h->nlm_list = nlm_next;
-      else
-	h->end_ptr->next = nlm_next;
-      h->end_ptr = nlm_next;
+      if (__builtin_expect (msg.msg_flags & MSG_TRUNC, 0))
+	goto out_fail;
 
+      size_t count = 0;
+      size_t remaining_len = read_len;
       for (nlmh = (struct nlmsghdr *) buf;
-	   NLMSG_OK (nlmh, (size_t) read_len);
-	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
+	   NLMSG_OK (nlmh, remaining_len);
+	   nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, remaining_len))
 	{
-	  if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != h->pid
+	  if ((pid_t) nlmh->nlmsg_pid != h->pid
 	      || nlmh->nlmsg_seq != h->seq)
 	    continue;
 
+	  ++count;
 	  if (nlmh->nlmsg_type == NLMSG_DONE)
 	    {
 	      /* We found the end, leave the loop.  */
@@ -176,11 +197,38 @@ __netlink_receive (struct netlink_handle *h)
 		errno = EIO;
 	      else
 		errno = -nlerr->error;
-	      return -1;
+	      goto out_fail;
 	    }
 	}
+
+      /* If there was nothing with the expected nlmsg_pid and nlmsg_seq,
+	 there is no point to record it.  */
+      if (count == 0)
+	continue;
+
+      nlm_next = (struct netlink_res *) malloc (sizeof (struct netlink_res)
+						+ read_len);
+      if (nlm_next == NULL)
+	goto out_fail;
+      nlm_next->next = NULL;
+      nlm_next->nlh = memcpy (nlm_next + 1, buf, read_len);
+      nlm_next->size = read_len;
+      nlm_next->seq = h->seq;
+      if (h->nlm_list == NULL)
+	h->nlm_list = nlm_next;
+      else
+	h->end_ptr->next = nlm_next;
+      h->end_ptr = nlm_next;
     }
+
+  if (use_malloc)
+    free (buf);
   return 0;
+
+out_fail:
+  if (use_malloc)
+    free (buf);
+  return -1;
 }
 
 
@@ -268,12 +316,11 @@ getifaddrs (struct ifaddrs **ifap)
   unsigned int i, newlink, newaddr, newaddr_idx;
   int *map_newlink_data;
   size_t ifa_data_size = 0;  /* Size to allocate for all ifa_data.  */
-  char *ifa_data_ptr;        /* Pointer to the unused part of memory for
+  char *ifa_data_ptr;	/* Pointer to the unused part of memory for
 				ifa_data.  */
   int result = 0;
 
-  if (ifap)
-    *ifap = NULL;
+  *ifap = NULL;
 
   if (! __no_netlink_support && __netlink_open (&nh) < 0)
     {
@@ -288,28 +335,20 @@ getifaddrs (struct ifaddrs **ifap)
 #endif
 
   /* Tell the kernel that we wish to get a list of all
-     active interfaces.  */
-  if (__netlink_sendreq (&nh, RTM_GETLINK) < 0)
-    {
-      result = -1;
-      goto exit_close;
-    }
-  /* Collect all data for every interface.  */
-  if (__netlink_receive (&nh) < 0)
+     active interfaces, collect all data for every interface.  */
+  if (__netlink_request (&nh, RTM_GETLINK) < 0)
     {
       result = -1;
       goto exit_free;
     }
 
-
   /* Now ask the kernel for all addresses which are assigned
-     to an interface.  Since we store the addresses after the
-     interfaces in the list, we will later always find the
-     interface before the corresponding addresses.  */
+     to an interface and collect all data for every interface.
+     Since we store the addresses after the interfaces in the
+     list, we will later always find the interface before the
+     corresponding addresses.  */
   ++nh.seq;
-  if (__netlink_sendreq (&nh, RTM_GETADDR) < 0
-      /* Collect all data for every interface.  */
-      || __netlink_receive (&nh) < 0)
+  if (__netlink_request (&nh, RTM_GETADDR) < 0)
     {
       result = -1;
       goto exit_free;
@@ -327,7 +366,7 @@ getifaddrs (struct ifaddrs **ifap)
 	continue;
 
       /* Walk through all entries we got from the kernel and look, which
-         message type they contain.  */
+	 message type they contain.  */
       for (nlh = nlp->nlh; NLMSG_OK (nlh, size); nlh = NLMSG_NEXT (nlh, size))
 	{
 	  /* Check if the message is what we want.  */
@@ -423,7 +462,7 @@ getifaddrs (struct ifaddrs **ifap)
 	      /* Interfaces are stored in the first "newlink" entries
 		 of our list, starting in the order as we got from the
 		 kernel.  */
-              ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
+	      ifa_index = map_newlink (ifim->ifi_index - 1, ifas,
 				       map_newlink_data, newlink);
 	      ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags;
 
@@ -762,13 +801,10 @@ getifaddrs (struct ifaddrs **ifap)
 	memmove (ifas, &ifas[newlink], sizeof (struct ifaddrs_storage));
     }
 
-  if (ifap != NULL)
-    *ifap = &ifas[0].ifa;
+  *ifap = &ifas[0].ifa;
 
  exit_free:
   __netlink_free_handle (&nh);
-
- exit_close:
   __netlink_close (&nh);
 
   return result;
diff --git a/sysdeps/unix/sysv/linux/ifreq.c b/sysdeps/unix/sysv/linux/ifreq.c
index 098f11750f..d7e442c277 100644
--- a/sysdeps/unix/sysv/linux/ifreq.c
+++ b/sysdeps/unix/sysv/linux/ifreq.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>.
 
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include "ifreq.h"
+#include <kernel-features.h>
 
 /* Variable to signal whether SIOCGIFCONF is not available.  */
 #if __ASSUME_SIOCGIFNAME == 0 || 1
diff --git a/sysdeps/unix/sysv/linux/ifreq.h b/sysdeps/unix/sysv/linux/ifreq.h
deleted file mode 100644
index b92e0638e2..0000000000
--- a/sysdeps/unix/sysv/linux/ifreq.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <net/if.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include "kernel-features.h"
-
-
-extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
-
-static inline struct ifreq *
-__if_nextreq (struct ifreq *ifr)
-{
-  return ifr + 1;
-}
-
-static inline void
-__if_freereq (struct ifreq *ifreqs, int num_ifs)
-{
-  free (ifreqs);
-}
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index f00271255d..b061a848c6 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -1,5 +1,5 @@
 /* Initialization code run first thing by the ELF startup code.  Linux version.
-   Copyright (C) 1995-1999,2000,01,02,03,2004 Free Software Foundation, Inc.
+   Copyright (C) 1995-2004, 2005 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
@@ -29,9 +29,6 @@
 
 #include <ldsodefs.h>
 
-/* The function is called from assembly stubs the compiler can't see.  */
-static void init (int, char **, char **) __attribute__ ((used));
-
 /* Set nonzero if we have to be prepared for more then one libc being
    used in the process.  Safe assumption if initializer never runs.  */
 int __libc_multiple_libcs attribute_hidden = 1;
@@ -42,9 +39,18 @@ int __libc_argc attribute_hidden;
 char **__libc_argv attribute_hidden;
 
 
-static void
-init (int argc, char **argv, char **envp)
+void
+__libc_init_first (int argc, char **argv, char **envp)
+{
+#ifdef SHARED
+  /* For DSOs we do not need __libc_init_first but instead _init.  */
+}
+
+void
+attribute_hidden
+_init (int argc, char **argv, char **envp)
 {
+#endif
 #ifdef USE_NONOPTION_FLAGS
   extern void __getopt_clean_environment (char **);
 #endif
@@ -88,27 +94,6 @@ init (int argc, char **argv, char **envp)
 #endif
 }
 
-#ifdef SHARED
-
-strong_alias (init, _init);
-
-extern void __libc_init_first (void);
-
-void
-__libc_init_first (void)
-{
-}
-
-#else
-extern void __libc_init_first (int argc, char **argv, char **envp);
-
-void
-__libc_init_first (int argc, char **argv, char **envp)
-{
-  init (argc, argv, envp);
-}
-#endif
-
 
 /* This function is defined here so that if this file ever gets into
    ld.so we will get a link error.  Having this file silently included
diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c
index ea26729d55..73317ecafd 100644
--- a/sysdeps/unix/sysv/linux/internal_statvfs.c
+++ b/sysdeps/unix/sysv/linux/internal_statvfs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -71,6 +71,33 @@ __statvfs_getflags (const char *name, int fstype, struct stat64 *st)
     case NFS_SUPER_MAGIC:
       fsname = "nfs";
       break;
+    case SYSFS_MAGIC:
+      fsname = "sysfs";
+      break;
+    case REISERFS_SUPER_MAGIC:
+      fsname = "reiserfs";
+      break;
+    case XFS_SUPER_MAGIC:
+      fsname = "xfs";
+      break;
+    case JFS_SUPER_MAGIC:
+      fsname = "jfs";
+      break;
+    case HPFS_SUPER_MAGIC:
+      fsname = "hpfs";
+      break;
+    case DEVFS_SUPER_MAGIC:
+      fsname = "devfs";
+      break;
+    case ISOFS_SUPER_MAGIC:
+      fsname = "iso9660";
+      break;
+    case MSDOS_SUPER_MAGIC:
+      fsname = "msdos";
+      break;
+    case NTFS_SUPER_MAGIC:
+      fsname = "ntfs";
+      break;
     }
 
   FILE *mtab = __setmntent ("/proc/mounts", "r");
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index f499a712c4..e54f675dbe 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -1,6 +1,6 @@
 /* Set flags signalling availability of kernel features based on given
    kernel version number.
-   Copyright (C) 1999-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999-2003, 2004, 2005, 2006 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
@@ -21,10 +21,6 @@
 /* This file must not contain any C code.  At least it must be protected
    to allow using the file also in assembler files.  */
 
-#if defined __mips__
-# include <sgidefs.h>
-#endif
-
 #ifndef __LINUX_KERNEL_VERSION
 /* We assume the worst; all kernels should be supported.  */
 # define __LINUX_KERNEL_VERSION	0
@@ -79,6 +75,22 @@
 # define __ASSUME_SIOCGIFNAME		1
 #endif
 
+/* MSG_NOSIGNAL was at least available with Linux 2.2.0.  */
+#if __LINUX_KERNEL_VERSION >= 131584
+# define __ASSUME_MSG_NOSIGNAL		1
+#endif
+
+/* The sendfile syscall was introduced in 2.2.0.  */
+#if __LINUX_KERNEL_VERSION >= 131584
+# define __ASSUME_SENDFILE		1
+#endif
+
+/* Only very old kernels had no real symlinks for terminal descriptors
+   in /proc/self/fd.  */
+#if __LINUX_KERNEL_VERSION >= 131584
+# define __ASSUME_PROC_SELF_FD_SYMLINK	1
+#endif
+
 /* On x86 another `getrlimit' syscall was added in 2.3.25.  */
 #if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__
 # define __ASSUME_NEW_GETRLIMIT_SYSCALL	1
@@ -99,9 +111,10 @@
 # define __ASSUME_STAT64_SYSCALL	1
 #endif
 
-/* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64
+/* On sparc the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64
    syscalls were introduced in 2.3.35.  */
-#if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__)
+#if __LINUX_KERNEL_VERSION >= 131875 \
+    && (defined __sparc__ && !defined __arch64__)
 # define __ASSUME_TRUNCATE64_SYSCALL	1
 # define __ASSUME_MMAP2_SYSCALL		1
 # define __ASSUME_STAT64_SYSCALL	1
@@ -122,7 +135,7 @@
 
 /* Linux 2.3.39 introduced 32bit UID/GIDs.  Some platforms had 32
    bit type all along.  */
-#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__
+#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__
 # define __ASSUME_32BITUIDS		1
 #endif
 
@@ -140,11 +153,6 @@
 # define __ASSUME_IPC64		1
 #endif
 
-/* MIPS platforms had IPC64 all along.  */
-#if defined __mips__
-# define __ASSUME_IPC64		1
-#endif
-
 /* We can use the LDTs for threading with Linux 2.3.99 and newer.  */
 #if __LINUX_KERNEL_VERSION >= 131939
 # define __ASSUME_LDT_WORKS		1
@@ -189,7 +197,7 @@
    don't know when it got introduced).  But PowerPC64 does not support
    separate FCNTL64 call, FCNTL is already 64-bit */
 #if __LINUX_KERNEL_VERSION >= 132100 \
-    && (defined __arm__ || defined __powerpc__ || defined __sh__) \
+    && (defined __powerpc__ || defined __sh__) \
     && !defined __powerpc64__
 # define __ASSUME_FCNTL64		1
 #endif
@@ -258,65 +266,37 @@
 #endif
 
 /* The vfork syscall on x86 and arm was definitely available in 2.4.  */
-#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__)
+#if __LINUX_KERNEL_VERSION >= 132097 && defined __i386__
 # define __ASSUME_VFORK_SYSCALL		1
 #endif
 
-/* There are an infinite number of PA-RISC kernel versions numbered
-   2.4.0.  But they've not really been released as such.  We require
-   and expect the final version here.  */
-#ifdef __hppa__
-# define __ASSUME_32BITUIDS		1
-# define __ASSUME_TRUNCATE64_SYSCALL	1
-# define __ASSUME_MMAP2_SYSCALL		1
-# define __ASSUME_STAT64_SYSCALL	1
-# define __ASSUME_IPC64			1
-# define __ASSUME_ST_INO_64_BIT		1
-# define __ASSUME_FCNTL64		1
-# define __ASSUME_GETDENTS64_SYSCALL	1
-#endif
-
 /* Alpha switched to a 64-bit timeval sometime before 2.2.0.  */
 #if __LINUX_KERNEL_VERSION >= 131584 && defined __alpha__
 # define __ASSUME_TIMEVAL64		1
 #endif
 
-#if defined __mips__ && _MIPS_SIM == _ABIN32
-# define __ASSUME_FCNTL64		1
-#endif
-
 /* The late 2.5 kernels saw a lot of new CLONE_* flags.  Summarize
    their availability with one define.  The changes were made first
    for i386 and the have to be done separately for the other archs.
-   For i386 we pick 2.5.50 as the first version with support.  */
-#if __LINUX_KERNEL_VERSION >= 132402 && defined __i386__
+   For i386 we pick 2.5.50 as the first version with support.
+   For ia64, s390*, PPC, x86-64, and SH we pick 2.5.64 as the first
+   version with support.  */
+#if ((__LINUX_KERNEL_VERSION >= 132402 && defined __i386__)		\
+     || (__LINUX_KERNEL_VERSION >= 132416				\
+	 && (defined __ia64__ || defined __s390__			\
+	     || defined __powerpc__ || defined __x86_64__ || defined __sh__)))
 # define __ASSUME_CLONE_THREAD_FLAGS	1
 #endif
 
-/* These features were surely available with 2.4.12.  */
-#if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
-# define __ASSUME_MMAP2_SYSCALL		1
-# define __ASSUME_TRUNCATE64_SYSCALL	1
-# define __ASSUME_STAT64_SYSCALL	1
-# define __ASSUME_FCNTL64		1
-# define __ASSUME_VFORK_SYSCALL		1
-#endif
-
 /* Beginning with 2.5.63 support for realtime and monotonic clocks and
    timers based on them is available.  */
 #if __LINUX_KERNEL_VERSION >= 132415
 # define __ASSUME_POSIX_TIMERS		1
 #endif
 
-/* The late 2.5 kernels saw a lot of new CLONE_* flags.  Summarize
-   their availability with one define.  The changes were made first
-   for i386 and the have to be done separately for the other archs.
-   For ia64, s390*, PPC, x86-64 we pick 2.5.64 as the first version
-   with support.  */
-#if __LINUX_KERNEL_VERSION >= 132416 \
-    && (defined __ia64__ || defined __s390__ || defined __powerpc__ \
-	|| defined __x86_64__ || defined __sh__)
-# define __ASSUME_CLONE_THREAD_FLAGS	1
+/* Beginning with 2.6.12 the clock and timer supports CPU clocks.  */
+#if __LINUX_KERNEL_VERSION >= 0x2060c
+# define __ASSUME_POSIX_CPU_TIMERS	1
 #endif
 
 /* With kernel 2.4.17 we always have netlink support.  */
@@ -349,22 +329,24 @@
 
 /* The tgkill syscall was instroduced for i386 in 2.5.75.  For Alpha
    it was introduced in 2.6.0-test1 which unfortunately cannot be
-   distinguished from 2.6.0.  On x86-64 it was introduced in
-   2.6.0-test3. */
+   distinguished from 2.6.0.  On x86-64, ppc, and ppc64 it was
+   introduced in 2.6.0-test3. */
 #if (__LINUX_KERNEL_VERSION >= 132427 && defined __i386__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __alpha__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __x86_64__) \
+    || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
 # define __ASSUME_TGKILL	1
 #endif
 
 /* The utimes syscall has been available for some architectures
-   forever.  For x86 it was introduced after 2.5.75, for x86-64 in
-   2.6.0-test3.  */
-#if defined __alpha__ || defined __ia64__ || defined __hppa__ \
+   forever.  For x86 it was introduced after 2.5.75, for x86-64,
+   ppc, and ppc64 it was introduced in 2.6.0-test3.  */
+#if defined __alpha__ || defined __ia64__ \
     || defined __sparc__ \
     || (__LINUX_KERNEL_VERSION > 132427 && defined __i386__) \
     || (__LINUX_KERNEL_VERSION > 132609 && defined __x86_64__) \
+    || (__LINUX_KERNEL_VERSION >= 132609 && defined __powerpc__) \
     || (__LINUX_KERNEL_VERSION >= 132609 && defined __sh__)
 # define __ASSUME_UTIMES	1
 #endif
@@ -378,8 +360,11 @@
 #endif
 
 /* The fixed version of the posix_fadvise64 syscall appeared in
-   2.6.0-test3.  At least for x86.  */
-#if __LINUX_KERNEL_VERSION >= 132609 && defined __i386__
+   2.6.0-test3.  At least for x86.  Powerpc support appeared in
+   2.6.2, but for 32-bit userspace only.  */
+#if (__LINUX_KERNEL_VERSION >= 132609 && defined __i386__) \
+    || (__LINUX_KERNEL_VERSION >= 132610 && defined __powerpc__ \
+       && !defined __powerpc64__)
 # define __ASSUME_FADVISE64_64_SYSCALL	1
 #endif
 
@@ -403,8 +388,10 @@
 #endif
 
 /* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
-   information as well.  */
-#if __LINUX_KERNEL_VERSION >= 132612
+   information as well and in between 2.6.5 and 2.6.8 most compat wrappers
+   were fixed too.  Except s390{,x} which was fixed in 2.6.11.  */
+#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
+    || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
 # define __ASSUME_GETDENTS32_D_TYPE	1
 #endif
 
@@ -414,8 +401,12 @@
 # define __ASSUME_BRK_PAGE_ROUNDED	1
 #endif
 
-/* Starting with version 2.6.9, the waitid system call is available.  */
-#if __LINUX_KERNEL_VERSION >=  0x020609
+/* Starting with version 2.6.9, the waitid system call is available.
+   Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12.  */
+#if (__LINUX_KERNEL_VERSION >= 0x020609 \
+     && !defined __powerpc__ && !defined __s390__) \
+    || (__LINUX_KERNEL_VERSION >= 0x02060c \
+	&& (defined __powerpc__ || defined __s390__))
 # define __ASSUME_WAITID_SYSCALL	1
 #endif
 
@@ -423,3 +414,47 @@
 #if __LINUX_KERNEL_VERSION >= 0x020609 && defined __alpha__
 #define __ASSUME_IEEE_RAISE_EXCEPTION	1
 #endif
+
+/* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12.  */
+#if __LINUX_KERNEL_VERSION >= 0x02060c && defined __sparc__ \
+    && defined __arch64__
+# define __ASSUME_STAT64_SYSCALL	1
+#endif
+
+/* Early kernel used "shm" as the filesystem name for the filesystem used
+   for shm_open etc.  Later it is "tmpfs".  2.4.20 is a safe bet for the
+   cutover.  */
+#if __LINUX_KERNEL_VERSION >= 0x02041a
+# define __ASSUME_TMPFS_NAME	1
+#endif
+
+/* pselect was introduced just after 2.6.16-rc1.  Due to the way the
+   kernel versions are advertised we can only rely on 2.6.17 to have
+   the code.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611 && !defined __x86_64__
+# define __ASSUME_PSELECT	1
+#endif
+
+/* ppoll was introduced just after 2.6.16-rc1.  Due to the way the
+   kernel versions are advertised we can only rely on 2.6.17 to have
+   the code.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611 && !defined __x86_64__
+# define __ASSUME_PPOLL	1
+#endif
+
+/* The *at syscalls were introduced just after 2.6.16-rc1.  Due to the way the
+   kernel versions are advertised we can only rely on 2.6.17 to have
+   the code.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611
+# define __ASSUME_ATFCTS	1
+#endif
+
+/* Support for inter-process robust mutexes was added in 2.6.17.  */
+#if __LINUX_KERNEL_VERSION >= 0x020611
+# define __ASSUME_SET_ROBUST_LIST	1
+#endif
+
+/* Support for PI futexes was added in 2.6.18.  */
+#if __LINUX_KERNEL_VERSION >= 0x020612
+# define __ASSUME_FUTEX_LOCK_PI	1
+#endif
diff --git a/sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h b/sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h
new file mode 100644
index 0000000000..164a90ddeb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/kernel-posix-cpu-timers.h
@@ -0,0 +1,18 @@
+/* Parameters for the Linux kernel ABI for CPU clocks.  */
+
+#define CPUCLOCK_PID(clock)		((pid_t) ~((clock) >> 3))
+#define CPUCLOCK_PERTHREAD(clock) \
+	(((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
+#define CPUCLOCK_PID_MASK	7
+#define CPUCLOCK_PERTHREAD_MASK	4
+#define CPUCLOCK_WHICH(clock)	((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
+#define CPUCLOCK_CLOCK_MASK	3
+#define CPUCLOCK_PROF		0
+#define CPUCLOCK_VIRT		1
+#define CPUCLOCK_SCHED		2
+#define CPUCLOCK_MAX		3
+
+#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
+	((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
+#define MAKE_THREAD_CPUCLOCK(tid, clock) \
+	MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK)
diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c
index f7b208e7d8..7683ec2efd 100644
--- a/sysdeps/unix/sysv/linux/lddlibc4.c
+++ b/sysdeps/unix/sysv/linux/lddlibc4.c
@@ -1,5 +1,5 @@
 /* Stub for ldd script to print Linux libc4 dependencies.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -84,5 +84,5 @@ main (int argc, char *argv[])
   putenv (buf);
 
   /* Now we can execute the binary.  */
-  return execl (filename, NULL) ? 4 : 0;
+  return execv (filename, &argv[argc]) ? 4 : 0;
 }
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h
index c5fd854d70..0bdca3c3fd 100644
--- a/sysdeps/unix/sysv/linux/ldsodefs.h
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h
@@ -1,5 +1,5 @@
 /* Run-time dynamic linker data structures for loaded ELF shared objects.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2006 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
@@ -19,7 +19,7 @@
 
 #ifndef	_LDSODEFS_H
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* Get the real definitions.  */
 #include_next <ldsodefs.h>
diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c
index a79cfbabb9..c7fac6ab51 100644
--- a/sysdeps/unix/sysv/linux/libc_fatal.c
+++ b/sysdeps/unix/sysv/linux/libc_fatal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993-1995,1997,2000,2002-2004 Free Software Foundation, Inc.
+/* Copyright (C) 1993-1995,1997,2000,2002-2005 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
@@ -27,6 +27,7 @@
 #include <sysdep.h>
 #include <unistd.h>
 #include <sys/syslog.h>
+#include <execinfo.h>
 
 /* Abort with an error message.  */
 #include <not-cancel.h>
@@ -141,8 +142,33 @@ __libc_message (int do_abort, const char *fmt, ...)
   va_end (ap_copy);
 
   if (do_abort)
-    /* Terminate the process.  */
-    abort ();
+    {
+      if (do_abort > 1 && written)
+	{
+	  void *addrs[64];
+#define naddrs (sizeof (addrs) / sizeof (addrs[0]))
+	  int n = __backtrace (addrs, naddrs);
+	  if (n > 2)
+	    {
+#define strnsize(str) str, strlen (str)
+#define writestr(str) write_not_cancel (fd, str)
+	      writestr (strnsize ("======= Backtrace: =========\n"));
+	      __backtrace_symbols_fd (addrs + 1, n - 1, fd);
+
+	      writestr (strnsize ("======= Memory map: ========\n"));
+	      int fd2 = open_not_cancel_2 ("/proc/self/maps", O_RDONLY);
+	      char buf[1024];
+	      ssize_t n2;
+	      while ((n2 = read_not_cancel (fd2, buf, sizeof (buf))) > 0)
+		if (write_not_cancel (fd, buf, n2) != n2)
+		  break;
+	      close_not_cancel_no_status (fd2);
+	    }
+	}
+
+      /* Terminate the process.  */
+      abort ();
+    }
 }
 
 
diff --git a/sysdeps/unix/sysv/linux/linkat.c b/sysdeps/unix/sysv/linux/linkat.c
new file mode 100644
index 0000000000..cfd0e18223
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/linkat.c
@@ -0,0 +1,115 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Make a link to FROM named TO but relative paths in TO and FROM are
+   interpreted relative to FROMFD and TOFD respectively.  */
+int
+linkat (fromfd, from, tofd, to, flags)
+     int fromfd;
+     const char *from;
+     int tofd;
+     const char *to;
+     int flags;
+{
+  int result;
+
+#ifdef __NR_linkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (linkat, 5, fromfd, from, tofd, to, flags);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  /* Without kernel support we cannot handle AT_SYMLINK_FOLLOW.  */
+  if (flags != 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  static const char procfd[] = "/proc/self/fd/%d/%s";
+  char *buffrom = NULL;
+
+  if (fromfd != AT_FDCWD && from[0] != '/')
+    {
+      size_t filelen = strlen (from);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buffrom = alloca (buflen);
+
+      __snprintf (buffrom, buflen, procfd, fromfd, from);
+      from = buffrom;
+    }
+
+  char *bufto = NULL;
+
+  if (tofd != AT_FDCWD && to[0] != '/')
+    {
+      size_t filelen = strlen (to);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      bufto = alloca (buflen);
+
+      __snprintf (bufto, buflen, procfd, tofd, to);
+      to = bufto;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (link, err, 2, from,  to);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), tofd, bufto,
+			  fromfd, buffrom);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/linux_fsinfo.h b/sysdeps/unix/sysv/linux/linux_fsinfo.h
index 13c3856266..8c6591ada3 100644
--- a/sysdeps/unix/sysv/linux/linux_fsinfo.h
+++ b/sysdeps/unix/sysv/linux/linux_fsinfo.h
@@ -1,5 +1,5 @@
 /* Constants from kernel header for various FSes.
-   Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1998,1999,2000,2001,2002,2003,2005 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
@@ -135,6 +135,9 @@
 /* Constants that identify the `vxfs' filesystem.  */
 #define VXFS_SUPER_MAGIC	0xa501fcf5
 
+/* Constants that identify the `sysfs´ filesystem.  */
+#define SYSFS_MAGIC		0x62656572
+
 /* Maximum link counts.  */
 #define COH_LINK_MAX		10000
 #define EXT2_LINK_MAX		32000
diff --git a/sysdeps/unix/sysv/linux/local-setxid.h b/sysdeps/unix/sysv/linux/local-setxid.h
new file mode 100644
index 0000000000..0579687982
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/local-setxid.h
@@ -0,0 +1,23 @@
+/* SETxID functions which only have to change the local thread and
+   none of the possible other threads.  */
+#include <kernel-features.h>
+#include <sysdep.h>
+
+/* If we can use the syscall directly, use it.  */
+#if __ASSUME_32BITUIDS > 0 && defined __NR_setresuid32
+# define local_seteuid(id) INLINE_SYSCALL (setresuid32, 3, -1, id, -1)
+#elif __ASSUME_SETRESUID_SYSCALL > 0
+# define local_seteuid(id) INLINE_SYSCALL (setresuid, 3, -1, id, -1)
+#else
+# define local_seteuid(id) seteuid (id)
+#endif
+
+
+/* If we can use the syscall directly, use it.  */
+#if __ASSUME_32BITUIDS > 0 && defined __NR_setresgid32
+# define local_setegid(id) INLINE_SYSCALL (setresgid32, 3, -1, id, -1)
+#elif __ASSUME_SETRESGID_SYSCALL > 0
+# define local_setegid(id) INLINE_SYSCALL (setresgid, 3, -1, id, -1)
+#else
+# define local_setegid(id) setegid (id)
+#endif
diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c
index 4e80469572..7444dfe0d9 100644
--- a/sysdeps/unix/sysv/linux/lxstat64.c
+++ b/sysdeps/unix/sysv/linux/lxstat64.c
@@ -1,5 +1,5 @@
 /* lxstat64 using old-style Unix lstat system call.
-   Copyright (C) 1997-2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2002,2003,2006 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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_STAT64_SYSCALL == 0
 # include <xstatconv.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/Dist b/sysdeps/unix/sysv/linux/m68k/Dist
deleted file mode 100644
index 35fad7ff0e..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/Dist
+++ /dev/null
@@ -1,9 +0,0 @@
-clone.S
-mremap.S
-oldgetrlimit64.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sys/reg.h
-sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile
deleted file mode 100644
index 6bb4f6b816..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Linux/m68k uses Motorola asm syntax and the ELF format.
-
-m68k-syntax-flag = -DMOTOROLA_SYNTAX
-
-ifeq ($(subdir),misc)
-sysdep_routines += mremap
-sysdep_headers += sys/reg.h
-endif
-
-ifeq ($(subdir),elf)
-sysdep-others += lddlibc4
-install-bin += lddlibc4
-endif
-
-ifeq ($(subdir),resource)
-sysdep_routines += oldgetrlimit64
-endif
diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions
deleted file mode 100644
index 0799bf310e..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/Versions
+++ /dev/null
@@ -1,32 +0,0 @@
-libc {
-  GLIBC_2.0 {
-    # Exception handling support functions from libgcc
-    __register_frame; __register_frame_table; __deregister_frame;
-    __frame_state_for; __register_frame_info_table;
-
-    # c*
-    cacheflush;
-  }
-  GLIBC_2.2 {
-    # functions used in other libraries
-    __xstat64; __fxstat64; __lxstat64;
-
-    # a*
-    alphasort64;
-
-    # g*
-    glob64;
-
-    # New rlimit interface
-    getrlimit; setrlimit; getrlimit64;
-
-    # r*
-    readdir64; readdir64_r;
-
-    # s*
-    scandir64;
-
-    # v*
-    versionsort64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/m68k/alphasort64.c b/sysdeps/unix/sysv/linux/m68k/alphasort64.c
deleted file mode 100644
index 0b5ae47d2f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/alphasort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/alphasort64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/a.out.h b/sysdeps/unix/sysv/linux/m68k/bits/a.out.h
deleted file mode 100644
index 0fb52c3815..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/a.out.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#ifndef __A_OUT_GNU_H__
-# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
-#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
deleted file mode 100644
index 90c0a481e4..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 2000, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define O_FSYNC		 O_SYNC
-#define O_ASYNC		 020000
-
-#ifdef __USE_GNU
-# define O_DIRECTORY	 040000	/* Must be a directory.	 */
-# define O_NOFOLLOW	0100000	/* Do not follow links.	 */
-# define O_DIRECT	0200000	/* Direct disk access.	*/
-# define O_NOATIME	01000000 /* Do not set atime.  */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
-   We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.	*/
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0400000
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	5	/* Get record locking info.  */
-# define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).	*/
-#else
-# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
-# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-#define F_GETLK64	12	/* Get record locking info.  */
-#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
-# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	10	/* Set number of signal to be sent.  */
-# define F_GETSIG	11	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE	1024	/* Set a lease.	 */
-# define F_GETLEASE	1025	/* Enquire what lease is active.  */
-# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
-#endif
-
-/* For F_[GET|SET]FL.  */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.	*/
-#define F_UNLCK		2	/* Remove lock.	 */
-
-/* For old implementation of bsd flock().  */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation.	*/
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND	32	/* This is a mandatory flock:	*/
-# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
-# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
-# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS	0x00000001	/* File accessed.  */
-# define DN_MODIFY	0x00000002	/* File modified.  */
-# define DN_CREATE	0x00000004	/* File created.  */
-# define DN_DELETE	0x00000008	/* File removed.  */
-# define DN_RENAME	0x00000010	/* File renamed.  */
-# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
-# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
-#endif
-
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
-
-__BEGIN_DECLS
-
-/* Provide kernel hint to read ahead.  */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
-    __THROW;
-
-__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/mman.h b/sysdeps/unix/sysv/linux/m68k/bits/mman.h
deleted file mode 100644
index 815a3da88f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/mman.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/m68k version.
-   Copyright (C) 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ	0x1		/* Page can be read.  */
-#define PROT_WRITE	0x2		/* Page can be written.  */
-#define PROT_EXEC	0x4		/* Page can be executed.  */
-#define PROT_NONE	0x0		/* Page can not be accessed.  */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define MAP_SHARED	0x01		/* Share changes.  */
-#define MAP_PRIVATE	0x02		/* Changes are private.  */
-#ifdef __USE_MISC
-# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
-#endif
-
-/* Other flags.  */
-#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
-#ifdef __USE_MISC
-# define MAP_FILE	0
-# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
-# define MAP_ANON	MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
-# define MAP_DENYWRITE	0x00800		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
-# define MAP_LOCKED	0x02000		/* Lock the mapping.  */
-# define MAP_NORESERVE	0x04000		/* Don't check for reservations.  */
-# define MAP_POPULATE	0x08000		/* Populate (prefault) pagetables.  */
-# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	1		/* Sync memory asynchronously.  */
-#define MS_SYNC		4		/* Synchronous memory sync.  */
-#define MS_INVALIDATE	2		/* Invalidate the caches.  */
-
-/* Flags for `mlockall'.  */
-#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	2		/* Lock all additions to address
-					   space.  */
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE	1
-#endif
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-# define MADV_NORMAL	 0	/* No further special treatment.  */
-# define MADV_RANDOM	 1	/* Expect random page references.  */
-# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
-# define MADV_WILLNEED	 3	/* Will need these pages.  */
-# define MADV_DONTNEED	 4	/* Don't need these pages.  */
-#endif
-
-/* The POSIX people had to invent similar names for the same things.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
-# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/poll.h b/sysdeps/unix/sysv/linux/m68k/bits/poll.h
deleted file mode 100644
index f7a7393154..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/poll.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_POLL_H
-# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
-#endif
-
-/* Event types that can be polled for.  These bits may be set in `events'
-   to indicate the interesting event types; they will appear in `revents'
-   to indicate the status of the file descriptor.  */
-#define POLLIN		0x001		/* There is data to read.  */
-#define POLLPRI		0x002		/* There is urgent data to read.  */
-#define POLLOUT		0x004		/* Writing now will not block.  */
-
-#ifdef __USE_XOPEN
-/* These values are defined in XPG4.2.  */
-# define POLLRDNORM	0x040		/* Normal data may be read.  */
-# define POLLRDBAND	0x080		/* Priority data may be read.  */
-# define POLLWRNORM	POLLOUT		/* Writing now will not block.  */
-# define POLLWRBAND	0x100		/* Priority data may be written.  */
-#endif
-
-/* Event types always implicitly polled for.  These bits need not be set in
-   `events', but they will appear in `revents' to indicate the status of
-   the file descriptor.  */
-#define POLLERR		0x008		/* Error condition.  */
-#define POLLHUP		0x010		/* Hung up.  */
-#define POLLNVAL	0x020		/* Invalid polling request.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/sysdeps/unix/sysv/linux/m68k/bits/stat.h
deleted file mode 100644
index dc06b13e2f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/bits/stat.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002
-     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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STAT_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX	/* The one defined below.  */
-
-/* Versions of the `xmknod' interface.  */
-#define _MKNOD_VER_LINUX	1
-#define _MKNOD_VER_SVR4		2
-#define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
-
-
-struct stat
-  {
-    __dev_t st_dev;			/* Device.  */
-    unsigned short int __pad1;
-#ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;			/* File serial number.	*/
-#else
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
-#endif
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __dev_t st_rdev;			/* Device number, if device.  */
-    unsigned short int __pad2;
-#ifndef __USE_FILE_OFFSET64
-    __off_t st_size;			/* Size of file, in bytes.  */
-#else
-    __off64_t st_size;			/* Size of file, in bytes.  */
-#endif
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
-
-#ifndef __USE_FILE_OFFSET64
-    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
-#else
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#endif
-#ifdef __USE_MISC
-    /* Nanosecond resolution timestamps are stored in a format
-       equivalent to 'struct timespec'.  This is the type used
-       whenever possible but the Unix namespace rules do not allow the
-       identifier 'timespec' to appear in the <sys/stat.h> header.
-       Therefore we have to handle the use of this header in strictly
-       standard-compliant sources special.  */
-    struct timespec st_atim;		/* Time of last access.  */
-    struct timespec st_mtim;		/* Time of last modification.  */
-    struct timespec st_ctim;		/* Time of last status change.  */
-# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int st_atimensec;	/* Nscecs of last access.  */
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-#endif
-#ifndef __USE_FILE_OFFSET64
-    unsigned long int __unused4;
-    unsigned long int __unused5;
-#else
-    __ino64_t st_ino;			/* File serial number.	*/
-#endif
-  };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-  {
-    __dev_t st_dev;			/* Device.  */
-    unsigned short int __pad1;
-
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __dev_t st_rdev;			/* Device number, if device.  */
-    unsigned short int __pad2;
-    __off64_t st_size;			/* Size of file, in bytes.  */
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
-
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#ifdef __USE_MISC
-    /* Nanosecond resolution timestamps are stored in a format
-       equivalent to 'struct timespec'.  This is the type used
-       whenever possible but the Unix namespace rules do not allow the
-       identifier 'timespec' to appear in the <sys/stat.h> header.
-       Therefore we have to handle the use of this header in strictly
-       standard-compliant sources special.  */
-    struct timespec st_atim;		/* Time of last access.  */
-    struct timespec st_mtim;		/* Time of last modification.  */
-    struct timespec st_ctim;		/* Time of last status change.  */
-#else
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int st_atimensec;	/* Nscecs of last access.  */
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-#endif
-    __ino64_t st_ino;			/* File serial number.		*/
-  };
-#endif
-
-/* Tell code we have these members.  */
-#define	_STATBUF_ST_BLKSIZE
-#define _STATBUF_ST_RDEV
-/* Nanosecond resolution time values are supported.  */
-#define _STATBUF_ST_NSEC
-
-/* Encoding of the file mode.  */
-
-#define	__S_IFMT	0170000	/* These bits determine file type.  */
-
-/* File types.  */
-#define	__S_IFDIR	0040000	/* Directory.  */
-#define	__S_IFCHR	0020000	/* Character device.  */
-#define	__S_IFBLK	0060000	/* Block device.  */
-#define	__S_IFREG	0100000	/* Regular file.  */
-#define	__S_IFIFO	0010000	/* FIFO.  */
-#define	__S_IFLNK	0120000	/* Symbolic link.  */
-#define	__S_IFSOCK	0140000	/* Socket.  */
-
-/* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
-   they do it by enforcing the correct use of the macros.  */
-#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits.  */
-
-#define	__S_ISUID	04000	/* Set user ID on execution.  */
-#define	__S_ISGID	02000	/* Set group ID on execution.  */
-#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
-#define	__S_IREAD	0400	/* Read by owner.  */
-#define	__S_IWRITE	0200	/* Write by owner.  */
-#define	__S_IEXEC	0100	/* Execute by owner.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c
deleted file mode 100644
index 6b2c92852d..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/brk.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* brk system call for Linux/m68k.
-   Copyright (C) 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux/x86 ELF
-   dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  INTERNAL_SYSCALL_DECL (err);
-  newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/m68k/chown.c b/sysdeps/unix/sysv/linux/m68k/chown.c
deleted file mode 100644
index 735fa5780a..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/chown.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 1998, 2000, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <linux/posix_types.h>
-#include "kernel-features.h"
-
-#ifdef __NR_chown32
-# if __ASSUME_32BITUIDS == 0
-/* This variable is shared with all files that need to check for 32bit
-   uids.  */
-extern int __libc_missing_32bit_uids;
-# endif
-#endif /* __NR_chown32 */
-
-int
-__chown (const char *file, uid_t owner, gid_t group)
-{
-#if __ASSUME_32BITUIDS > 0
-  return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
-#else
-# ifdef __NR_chown32
-  if (__libc_missing_32bit_uids <= 0)
-    {
-      int result;
-      int saved_errno = errno;
-
-      result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
-      if (result == 0 || errno != ENOSYS)
-	return result;
-
-      __set_errno (saved_errno);
-      __libc_missing_32bit_uids = 1;
-    }
-# endif /* __NR_chown32 */
-
-  if (((owner + 1) > (gid_t) ((__kernel_uid_t) -1U))
-      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
-#endif
-}
-libc_hidden_def (__chown)
-weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/m68k/clone.S b/sysdeps/unix/sysv/linux/m68k/clone.S
deleted file mode 100644
index 6baf723d9b..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/clone.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* clone is even more special than fork as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-
-        .text
-ENTRY (__clone)
-
-	/* Sanity check arguments.  */
-	movel	#-EINVAL, %d0
-	movel	4(%sp), %a0		/* no NULL function pointers */
-	tstl	%a0
-	jeq	SYSCALL_ERROR_LABEL
-	movel	8(%sp), %a1		/* no NULL stack pointers */
-	tstl	%a1
-	jeq	SYSCALL_ERROR_LABEL
-
-	/* Allocate space and copy the argument onto the new stack.  */
-	movel	16(%sp), -(%a1)
-
-	/* Do the system call */
-	exg	%d2, %a1		/* save %d2 and get stack pointer */
-	movel	12(%sp), %d1		/* get flags */
-	movel	#SYS_ify (clone), %d0
-	trap	#0
-	exg	%d2, %a1		/* restore %d2 */
-
-	tstl	%d0
-	jmi	SYSCALL_ERROR_LABEL
-	jeq	thread_start
-
-	rts
-
-thread_start:
-	subl	%fp, %fp	/* terminate the stack frame */
-	jsr	(%a0)
-	movel	%d0, %d1
-	movel	#SYS_ify (exit), %d0
-	trap	#0
-
-PSEUDO_END (__clone)
-
-weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/m68k/dl-librecon.h b/sysdeps/unix/sysv/linux/m68k/dl-librecon.h
deleted file mode 100644
index dbb4e75712..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/dl-librecon.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/dl-librecon.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/fchown.c b/sysdeps/unix/sysv/linux/m68k/fchown.c
deleted file mode 100644
index 3a69ecc9e7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/fchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fchown.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/fcntl.c b/sysdeps/unix/sysv/linux/m68k/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/fxstat.c b/sysdeps/unix/sysv/linux/m68k/fxstat.c
deleted file mode 100644
index 4f219f0b9d..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/fxstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getdents64.c b/sysdeps/unix/sysv/linux/m68k/getdents64.c
deleted file mode 100644
index 0c75fb5a06..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getdents64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getdents64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getegid.c b/sysdeps/unix/sysv/linux/m68k/getegid.c
deleted file mode 100644
index 37b4b4a530..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getegid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/geteuid.c b/sysdeps/unix/sysv/linux/m68k/geteuid.c
deleted file mode 100644
index ebcb555b5e..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/geteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/geteuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getgid.c b/sysdeps/unix/sysv/linux/m68k/getgid.c
deleted file mode 100644
index 0a4d6061f0..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getgroups.c b/sysdeps/unix/sysv/linux/m68k/getgroups.c
deleted file mode 100644
index 102ea24e14..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/getgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getmsg.c b/sysdeps/unix/sysv/linux/m68k/getmsg.c
deleted file mode 100644
index 3a1fa08525..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getmsg.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
deleted file mode 100644
index f7ffdc5185..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <unistd.h>
-#include <sys/param.h>
-#include <errno.h>
-
-#include <ldsodefs.h>
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Return the system page size.  */
-int
-__getpagesize ()
-{
-#ifdef __NR_getpagesize
-  int result;
-#endif
-
-  if (GLRO(dl_pagesize) != 0)
-    return GLRO(dl_pagesize);
-
-#ifdef __NR_getpagesize
-  INTERNAL_SYSCALL_DECL (err);
-  result = INTERNAL_SYSCALL (getpagesize, err, 0);
-  /* The only possible error is ENOSYS.  */
-  if (!INTERNAL_SYSCALL_ERROR_P (result, err))
-    return result;
-#endif
-
-  return 4096;
-}
-libc_hidden_def (__getpagesize)
-weak_alias (__getpagesize, getpagesize)
diff --git a/sysdeps/unix/sysv/linux/m68k/getresgid.c b/sysdeps/unix/sysv/linux/m68k/getresgid.c
deleted file mode 100644
index b703a414cc..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getresuid.c b/sysdeps/unix/sysv/linux/m68k/getresuid.c
deleted file mode 100644
index 0b14cefe34..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getresuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getrlimit.c b/sysdeps/unix/sysv/linux/m68k/getrlimit.c
deleted file mode 100644
index fc06dbd641..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getrlimit64.c b/sysdeps/unix/sysv/linux/m68k/getrlimit64.c
deleted file mode 100644
index fef018f471..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getsysstats.c b/sysdeps/unix/sysv/linux/m68k/getsysstats.c
deleted file mode 100644
index 23207e9bcb..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getsysstats.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Determine various system internal values, Linux/m68k version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-/* We need to define a special parser for /proc/cpuinfo.  */
-#define GET_NPROCS_PARSER(FP, BUFFER, RESULT)				  \
-  do									  \
-    {									  \
-      (RESULT) = 0;							  \
-      /* Read all lines and count the lines starting with the string	  \
-	 "CPU:".  We don't have to fear extremely long lines since	  \
-	 the kernel will not generate them.  8192 bytes are really	  \
-	 enough.  */							  \
-      while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL)	  \
-	if (strncmp (BUFFER, "CPU:", 4) == 0)	      	     		  \
-	  ++(RESULT);							  \
-    }									  \
-  while (0)
-
-#include <sysdeps/unix/sysv/linux/getsysstats.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/getuid.c b/sysdeps/unix/sysv/linux/m68k/getuid.c
deleted file mode 100644
index d682c79a49..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/getuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/glob64.c b/sysdeps/unix/sysv/linux/m68k/glob64.c
deleted file mode 100644
index 82a9a296a7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/glob64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/glob64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/lchown.c b/sysdeps/unix/sysv/linux/m68k/lchown.c
deleted file mode 100644
index c89de99ba2..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/lchown.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lchown.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/ldconfig.h b/sysdeps/unix/sysv/linux/m68k/ldconfig.h
deleted file mode 100644
index 953f192bcd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/ldconfig.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/ldconfig.h>
diff --git a/sysdeps/unix/sysv/linux/m68k/lockf64.c b/sysdeps/unix/sysv/linux/m68k/lockf64.c
deleted file mode 100644
index a88f5a784a..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/lockf64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/lxstat.c b/sysdeps/unix/sysv/linux/m68k/lxstat.c
deleted file mode 100644
index 2371cd9719..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/lxstat.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lxstat.c>
-
diff --git a/sysdeps/unix/sysv/linux/m68k/mmap.S b/sysdeps/unix/sysv/linux/m68k/mmap.S
deleted file mode 100644
index 086212a42b..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/mmap.S
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-	.text
-ENTRY (__mmap)
-
-	move.l #SYS_ify (mmap), %d0	/* System call number in %d0.  */
-
-	lea 4(%sp), %a0			/* Address of args is 1st arg.  */
-	move.l %a0, %d1
-
-	/* Do the system call trap.  */
-	trap #0
-
-	/* Kludge: negative numbers are among the legal return values.
-	   If %d0 is between -4096 and 0 then there was an error.  */
-	cmp.l #-4096, %d0
-	jhi SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  Copy it to %a0 because
-	   mmap is declared to return a pointer.  */
-	move.l %d0, %a0
-	rts
-PSEUDO_END (__mmap)
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/m68k/mremap.S b/sysdeps/unix/sysv/linux/m68k/mremap.S
deleted file mode 100644
index 68d961b553..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/mremap.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* The mremap system call is special because it needs to return
-   its value in register %a0.  */
-
-	.text
-PSEUDO (__mremap, mremap, 4)
-	move.l %d0, %a0
-	rts
-PSEUDO_END (__mremap)
-weak_alias (__mremap, mremap)
diff --git a/sysdeps/unix/sysv/linux/m68k/msgctl.c b/sysdeps/unix/sysv/linux/m68k/msgctl.c
deleted file mode 100644
index 9f9b8431a3..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/msgctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/msgctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c b/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c
deleted file mode 100644
index 4c27e957bf..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/putmsg.c b/sysdeps/unix/sysv/linux/m68k/putmsg.c
deleted file mode 100644
index ebc1680ca7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/putmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/putmsg.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/readdir64.c b/sysdeps/unix/sysv/linux/m68k/readdir64.c
deleted file mode 100644
index 2ea26dd409..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/readdir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/readdir64_r.c b/sysdeps/unix/sysv/linux/m68k/readdir64_r.c
deleted file mode 100644
index 9f54f897e3..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/readdir64_r.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/readdir64_r.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/register-dump.h b/sysdeps/unix/sysv/linux/m68k/register-dump.h
deleted file mode 100644
index a7ac3ca01c..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/register-dump.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Dump registers.
-   Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <stddef.h>
-#include <sys/uio.h>
-#include <stdio-common/_itoa.h>
-
-/* We will print the register dump in this format:
-
-  D0: XXXXXXXX   D1: XXXXXXXX   D2: XXXXXXXX   D3: XXXXXXXX
-  D4: XXXXXXXX   D5: XXXXXXXX   D6: XXXXXXXX   D7: XXXXXXXX
-  A0: XXXXXXXX   A1: XXXXXXXX   A2: XXXXXXXX   A3: XXXXXXXX
-  A4: XXXXXXXX   A5: XXXXXXXX   A6: XXXXXXXX   A7: XXXXXXXX
-  PC: XXXXXXXX   SR: XXXX
-
-  OldMask: XXXXXXXX  Vector: XXXX
-
-  FP0: XXXXXXXXXXXXXXXXXXXXXXXX   FP1: XXXXXXXXXXXXXXXXXXXXXXXX
-  FP2: XXXXXXXXXXXXXXXXXXXXXXXX   FP3: XXXXXXXXXXXXXXXXXXXXXXXX
-  FP4: XXXXXXXXXXXXXXXXXXXXXXXX   FP5: XXXXXXXXXXXXXXXXXXXXXXXX
-  FP6: XXXXXXXXXXXXXXXXXXXXXXXX   FP7: XXXXXXXXXXXXXXXXXXXXXXXX
-  FPCR: XXXXXXXX   FPSR: XXXXXXXX   FPIAR: XXXXXXXX
-
-*/
-
-/* Linux saves only the call-clobbered registers in the sigcontext.  We
-   need to use a trampoline that saves the rest so that the C code can
-   access them.  We use the sc_fpstate field, since the handler is not
-   supposed to return anyway, thus it doesn't matter that it's clobbered.  */
-
-/* static */ void catch_segfault (int, int, struct sigcontext *);
-
-/* Dummy function so that we can use asm with arguments.  */
-static void __attribute_used__
-__dummy__ (void)
-{
-  asm ("\n\
-catch_segfault:\n\
-	move.l 12(%%sp),%%a0\n\
-	lea %c0(%%a0),%%a0\n\
-	/* Clear the first 4 bytes to make it a null fp state, just\n\
-	   in case the handler does return.  */\n\
-	clr.l (%%a0)+\n\
-	movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)\n\
-	fmovem.x %%fp2-%%fp7,11*4(%%a0)\n\
-	jra real_catch_segfault"
-       : : "n" (offsetof (struct sigcontext, sc_fpstate)));
-}
-#define catch_segfault(a,b) \
-  __attribute_used__ real_catch_segfault(a,b)
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
-  char *cp = _itoa_word (value, buf + len, 16, 0);
-  while (cp > buf)
-    *--cp = '0';
-}
-
-static void
-register_dump (int fd, struct sigcontext *ctx)
-{
-  char regs[20][8];
-  char fpregs[11][24];
-  struct iovec iov[63], *next_iov = iov;
-  unsigned long *p = (unsigned long *) ctx->sc_fpstate + 1;
-
-#define ADD_STRING(str) \
-  next_iov->iov_base = (char *) (str); \
-  next_iov->iov_len = strlen (str); \
-  ++next_iov
-#define ADD_MEM(str, len) \
-  next_iov->iov_base = (str); \
-  next_iov->iov_len = (len); \
-  ++next_iov
-
-  /* Generate strings of register contents.  */
-  hexvalue (ctx->sc_d0, regs[0], 8);
-  hexvalue (ctx->sc_d1, regs[1], 8);
-  hexvalue (*p++, regs[2], 8);
-  hexvalue (*p++, regs[3], 8);
-  hexvalue (*p++, regs[4], 8);
-  hexvalue (*p++, regs[5], 8);
-  hexvalue (*p++, regs[6], 8);
-  hexvalue (*p++, regs[7], 8);
-  hexvalue (ctx->sc_a0, regs[8], 8);
-  hexvalue (ctx->sc_a1, regs[9], 8);
-  hexvalue (*p++, regs[10], 8);
-  hexvalue (*p++, regs[11], 8);
-  hexvalue (*p++, regs[12], 8);
-  hexvalue (*p++, regs[13], 8);
-  hexvalue (*p++, regs[14], 8);
-  hexvalue (ctx->sc_usp, regs[15], 8);
-  hexvalue (ctx->sc_pc, regs[16], 8);
-  hexvalue (ctx->sc_sr, regs[17], 4);
-  hexvalue (ctx->sc_mask, regs[18], 8);
-  hexvalue (ctx->sc_formatvec & 0xfff, regs[19], 4);
-  hexvalue (ctx->sc_fpregs[0], fpregs[0], 8);
-  hexvalue (ctx->sc_fpregs[1], fpregs[0] + 8, 8);
-  hexvalue (ctx->sc_fpregs[2], fpregs[0] + 16, 8);
-  hexvalue (ctx->sc_fpregs[3], fpregs[1], 8);
-  hexvalue (ctx->sc_fpregs[4], fpregs[1] + 8, 8);
-  hexvalue (ctx->sc_fpregs[5], fpregs[1] + 16, 8);
-  hexvalue (*p++, fpregs[2], 8);
-  hexvalue (*p++, fpregs[2] + 8, 8);
-  hexvalue (*p++, fpregs[2] + 16, 8);
-  hexvalue (*p++, fpregs[3], 8);
-  hexvalue (*p++, fpregs[3] + 8, 8);
-  hexvalue (*p++, fpregs[3] + 16, 8);
-  hexvalue (*p++, fpregs[4], 8);
-  hexvalue (*p++, fpregs[4] + 8, 8);
-  hexvalue (*p++, fpregs[4] + 16, 8);
-  hexvalue (*p++, fpregs[5], 8);
-  hexvalue (*p++, fpregs[5] + 8, 8);
-  hexvalue (*p++, fpregs[5] + 16, 8);
-  hexvalue (*p++, fpregs[6], 8);
-  hexvalue (*p++, fpregs[6] + 8, 8);
-  hexvalue (*p++, fpregs[6] + 16, 8);
-  hexvalue (*p++, fpregs[7], 8);
-  hexvalue (*p++, fpregs[7] + 8, 8);
-  hexvalue (*p++, fpregs[7] + 16, 8);
-  hexvalue (ctx->sc_fpcntl[0], fpregs[8], 8);
-  hexvalue (ctx->sc_fpcntl[1], fpregs[9], 8);
-  hexvalue (ctx->sc_fpcntl[2], fpregs[10], 8);
-
-  /* Generate the output.  */
-  ADD_STRING ("Register dump:\n\n  D0: ");
-  ADD_MEM (regs[0], 8);
-  ADD_STRING ("  D1: ");
-  ADD_MEM (regs[1], 8);
-  ADD_STRING ("  D2: ");
-  ADD_MEM (regs[2], 8);
-  ADD_STRING ("  D3: ");
-  ADD_MEM (regs[3], 8);
-  ADD_STRING ("\n  D4: ");
-  ADD_MEM (regs[4], 8);
-  ADD_STRING ("  D5: ");
-  ADD_MEM (regs[5], 8);
-  ADD_STRING ("  D6: ");
-  ADD_MEM (regs[6], 8);
-  ADD_STRING ("  D7: ");
-  ADD_MEM (regs[7], 8);
-  ADD_STRING ("\n  A0: ");
-  ADD_MEM (regs[8], 8);
-  ADD_STRING ("  A1: ");
-  ADD_MEM (regs[9], 8);
-  ADD_STRING ("  A2: ");
-  ADD_MEM (regs[10], 8);
-  ADD_STRING ("  A3: ");
-  ADD_MEM (regs[11], 8);
-  ADD_STRING ("\n  A4: ");
-  ADD_MEM (regs[12], 8);
-  ADD_STRING ("  A5: ");
-  ADD_MEM (regs[13], 8);
-  ADD_STRING ("  A6: ");
-  ADD_MEM (regs[14], 8);
-  ADD_STRING ("  A7: ");
-  ADD_MEM (regs[15], 8);
-  ADD_STRING ("\n  PC: ");
-  ADD_MEM (regs[16], 8);
-  ADD_STRING ("  SR: ");
-  ADD_MEM (regs[17], 4);
-
-  ADD_STRING ("\n\n  OldMask: ");
-  ADD_MEM (regs[18], 8);
-  ADD_STRING ("  Vector: ");
-  ADD_MEM (regs[19], 4);
-
-  ADD_STRING ("\n\n  FP0: ");
-  ADD_MEM (fpregs[0], 24);
-  ADD_STRING ("  FP1: ");
-  ADD_MEM (fpregs[1], 24);
-  ADD_STRING ("\n  FP2: ");
-  ADD_MEM (fpregs[2], 24);
-  ADD_STRING ("  FP3: ");
-  ADD_MEM (fpregs[3], 24);
-  ADD_STRING ("\n  FP4: ");
-  ADD_MEM (fpregs[4], 24);
-  ADD_STRING ("  FP5: ");
-  ADD_MEM (fpregs[5], 24);
-  ADD_STRING ("\n  FP6: ");
-  ADD_MEM (fpregs[6], 24);
-  ADD_STRING ("  FP7: ");
-  ADD_MEM (fpregs[7], 24);
-  ADD_STRING ("\n  FPCR: ");
-  ADD_MEM (fpregs[8], 8);
-  ADD_STRING ("  FPSR: ");
-  ADD_MEM (fpregs[9], 8);
-  ADD_STRING ("  FPIAR: ");
-  ADD_MEM (fpregs[10], 8);
-  ADD_STRING ("\n");
-
-  /* Write the stuff out.  */
-  writev (fd, iov, next_iov - iov);
-}
-
-#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/m68k/scandir64.c b/sysdeps/unix/sysv/linux/m68k/scandir64.c
deleted file mode 100644
index 506fd8877c..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/scandir64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/scandir64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/semctl.c b/sysdeps/unix/sysv/linux/m68k/semctl.c
deleted file mode 100644
index e9b1a483c9..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/semctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/semctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/semtimedop.S b/sysdeps/unix/sysv/linux/m68k/semtimedop.S
deleted file mode 100644
index 2775c124c6..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/semtimedop.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@suse.de>, 2003.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#define SYSOP_semtimedop 4
-
-#define SVRSP	8		/* saved register space */
-#define PARMS	4+SVRSP		/* space for 3 saved regs */
-#define SEMID	PARMS
-#define SOPS	SEMID+4
-#define NSOPS	SOPS+4
-#define TIMEOUT	NSOPS+4
-
-	.text
-ENTRY (semtimedop)
-
-	/* Save registers.  */
-	move.l	%d2, %a1
-	move.l	%d3, -(%sp)
-	move.l	%d5, -(%sp)
-
-	move.l	#SYSOP_semtimedop, %d1
-	move.l	SEMID(%sp), %d2
-	move.l	NSOPS(%sp), %d3
-	move.l	SOPS(%sp), %d5
-	move.l	TIMEOUT(%sp), %a0
-	move.l	#SYS_ify (ipc), %d0
-
-	trap	#0
-
-	/* Restore registers.  */
-	move.l	(%sp)+, %d5
-	move.l	(%sp)+, %d3
-	move.l	%a1, %d2
-
-	/* Check for error.  */
-	tst.l	%d0
-	jmi	SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  */
-	ret
-
-PSEUDO_END (semtimedop)
diff --git a/sysdeps/unix/sysv/linux/m68k/setegid.c b/sysdeps/unix/sysv/linux/m68k/setegid.c
deleted file mode 100644
index 2e3a54c893..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setegid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setegid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/seteuid.c b/sysdeps/unix/sysv/linux/m68k/seteuid.c
deleted file mode 100644
index 18e41d08c1..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/seteuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/seteuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setfsgid.c b/sysdeps/unix/sysv/linux/m68k/setfsgid.c
deleted file mode 100644
index 0886712569..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setfsgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setfsuid.c b/sysdeps/unix/sysv/linux/m68k/setfsuid.c
deleted file mode 100644
index a9f22eb8ab..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setfsuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setfsuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgid.c b/sysdeps/unix/sysv/linux/m68k/setgid.c
deleted file mode 100644
index 377021d9ec..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setgroups.c b/sysdeps/unix/sysv/linux/m68k/setgroups.c
deleted file mode 100644
index 0e7086278f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setgroups.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We also have to rewrite the kernel gid_t to the user land type.  */
-#include <sysdeps/unix/sysv/linux/i386/setgroups.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setregid.c b/sysdeps/unix/sysv/linux/m68k/setregid.c
deleted file mode 100644
index 99c57ad20f..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setregid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setregid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setresgid.c b/sysdeps/unix/sysv/linux/m68k/setresgid.c
deleted file mode 100644
index daca1a4833..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setresgid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresgid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setresuid.c b/sysdeps/unix/sysv/linux/m68k/setresuid.c
deleted file mode 100644
index 3aeabe9ad7..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setresuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setresuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setreuid.c b/sysdeps/unix/sysv/linux/m68k/setreuid.c
deleted file mode 100644
index 8ad61226e9..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setreuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setreuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setrlimit.c b/sysdeps/unix/sysv/linux/m68k/setrlimit.c
deleted file mode 100644
index bfaef74c38..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setrlimit.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setrlimit.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/setuid.c b/sysdeps/unix/sysv/linux/m68k/setuid.c
deleted file mode 100644
index de394379be..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/setuid.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/setuid.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/shmctl.c b/sysdeps/unix/sysv/linux/m68k/shmctl.c
deleted file mode 100644
index 7eac6380dd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/shmctl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/shmctl.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
deleted file mode 100644
index b7e08cfc95..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIGCONTEXT int _code, struct sigcontext *
-#define SIGCONTEXT_EXTRA_ARGS _code,
-#define GET_PC(ctx)	((void *) (ctx)->sc_pc)
-#define GET_FRAME(ctx)	((void *) __builtin_frame_address (1))
-#define GET_STACK(ctx)	((void *) (ctx)->sc_usp)
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/sysdeps/unix/sysv/linux/m68k/socket.S b/sysdeps/unix/sysv/linux/m68k/socket.S
deleted file mode 100644
index 1d10f33e17..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/socket.S
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep-cancel.h>
-#include <socketcall.h>
-
-#define P(a, b) P2(a, b)
-#define P2(a, b) a##b
-
-	.text
-/* The socket-oriented system calls are handled unusally in Linux.
-   They are all gated through the single `socketcall' system call number.
-   `socketcall' takes two arguments: the first is the subcode, specifying
-   which socket function is being called; and the second is a pointer to
-   the arguments to the specific function.
-
-   The .S files for the other calls just #define socket and #include this.  */
-
-#ifndef __socket
-#ifndef NO_WEAK_ALIAS
-#define __socket P(__,socket)
-#else
-#define __socket socket
-#endif
-#endif
-
-.globl __socket
-ENTRY (__socket)
-#if defined NEED_CANCELLATION && defined CENABLE
-	SINGLE_THREAD_P
-	jne 1f
-#endif
-
-	/* Save registers.  */
-	move.l %d2, %a0
-
-	move.l #SYS_ify (socketcall), %d0 /* System call number in %d0.  */
-
-	/* Use ## so `socket' is a separate token that might be #define'd.  */
-	move.l #P (SOCKOP_,socket), %d1	/* Subcode is first arg to syscall.  */
-	lea 4(%sp), %a1			/* Address of args is 2nd arg.  */
-	move.l %a1, %d2
-
-	/* Do the system call trap.  */
-	trap #0
-
-	/* Restore registers.  */
-	move.l %a0, %d2
-
-	/* %d0 is < 0 if there was an error.  */
-	tst.l %d0
-	jmi SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  */
-	rts
-
-#if defined NEED_CANCELLATION && defined CENABLE
-1:	/* Enable asynchronous cancellation.  */
-	CENABLE
-
-	/* Save registers.  */
-	move.l %d2, -(%sp)
-	move.l %d0, -(%sp)
-
-	move.l #SYS_ify (socketcall), %d0 /* System call number in %d0.  */
-
-	/* Use ## so `socket' is a separate token that might be #define'd.  */
-	move.l #P (SOCKOP_,socket), %d1	/* Subcode is first arg to syscall.  */
-	lea 4+8(%sp), %a1		/* Address of args is 2nd arg.  */
-	move.l %a1, %d2
-
-	/* Do the system call trap.  */
-	trap #0
-
-	/* Restore cancellation.  */
-	move.l %d0, %d2
-	CDISABLE
-	addq.l #4, %sp
-	move.l %d2, %d0
-
-	/* Restore registers.  */
-	move.l (%sp)+, %d2
-
-	/* %d0 is < 0 if there was an error.  */
-	tst.l %d0
-	jmi SYSCALL_ERROR_LABEL
-
-	/* Successful; return the syscall's value.  */
-	rts
-#endif
-	
-PSEUDO_END (__socket)
-
-#ifndef NO_WEAK_ALIAS
-weak_alias (__socket, socket)
-#endif
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/procfs.h b/sysdeps/unix/sysv/linux/m68k/sys/procfs.h
deleted file mode 100644
index 27abf8ef52..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sys/procfs.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somewhat modelled after the file of the same name on SVR4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  It doesn't have anything to do with the /proc file
-   system, even though Linux has one.
-
-   Anyway, the whole purpose of this file is for GDB and GDB only.
-   Don't read too much into it.  Don't use it for anything other than
-   GDB unless you know what you are doing.  */
-
-#include <features.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/user.h>
-
-__BEGIN_DECLS
-
-/* Type for a general-purpose register.  */
-typedef unsigned long elf_greg_t;
-
-/* And the whole bunch of them.  We could have used `struct
-   user_regs_struct' directly in the typedef, but tradition says that
-   the register set is an array, which does have some peculiar
-   semantics, so leave it that way.  */
-#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-/* Register set for the floating-point registers.  */
-typedef struct user_m68kfp_struct elf_fpregset_t;
-
-
-/* Signal info.  */
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with Linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   GDB doesn't really use excluded.  */
-
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-    unsigned long int pr_flag;		/* Flags.  */
-    unsigned short int pr_uid;
-    unsigned short int pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-
-/* The rest of this file provides the types for emulation of the
-   Solaris <proc_service.h> interfaces that should be implemented by
-   users of libthread_db.  */
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore have only one PID type.  */
-typedef __pid_t lwpid_t;
-
-/* Process status and info.  In the end we do provide typedefs for them.  */
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/reg.h b/sysdeps/unix/sysv/linux/m68k/sys/reg.h
deleted file mode 100644
index 418f8323f1..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sys/reg.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_REG_H
-#define _SYS_REG_H	1
-
-/* Index into an array of 4 byte integers returned from ptrace for
-   location of the users' stored general purpose registers. */
-
-enum
-{
-  PT_D1 = 0,
-#define PT_D1 PT_D1
-  PT_D2 = 1,
-#define PT_D2 PT_D2
-  PT_D3 = 2,
-#define PT_D3 PT_D3
-  PT_D4 = 3,
-#define PT_D4 PT_D4
-  PT_D5 = 4,
-#define PT_D5 PT_D5
-  PT_D6 = 5,
-#define PT_D6 PT_D6
-  PT_D7 = 6,
-#define PT_D7 PT_D7
-  PT_A0 = 7,
-#define PT_A0 PT_A0
-  PT_A1 = 8,
-#define PT_A1 PT_A1
-  PT_A2 = 9,
-#define PT_A2 PT_A2
-  PT_A3 = 10,
-#define PT_A3 PT_A3
-  PT_A4 = 11,
-#define PT_A4 PT_A4
-  PT_A5 = 12,
-#define PT_A5 PT_A5
-  PT_A6 = 13,
-#define PT_A6 PT_A6
-  PT_D0 = 14,
-#define PT_D0 PT_D0
-  PT_USP = 15,
-#define PT_USP PT_USP
-  PT_ORIG_D0 = 16,
-#define PT_ORIG_D0 PT_ORIG_D0
-  PT_SR = 17,
-#define PT_SR PT_SR
-  PT_PC = 18,
-#define PT_PC PT_PC
-  PT_FP0 = 21,
-#define PT_FP0 PT_FP0
-  PT_FP1 = 24,
-#define PT_FP1 PT_FP1
-  PT_FP2 = 27,
-#define PT_FP2 PT_FP2
-  PT_FP3 = 30,
-#define PT_FP3 PT_FP3
-  PT_FP4 = 33,
-#define PT_FP4 PT_FP4
-  PT_FP5 = 36,
-#define PT_FP5 PT_FP5
-  PT_FP6 = 39,
-#define PT_FP6 PT_FP6
-  PT_FP7 = 42,
-#define PT_FP7 PT_FP7
-  PT_FPCR = 45,
-#define PT_FPCR PT_FPCR
-  PT_FPSR = 46,
-#define PT_FPSR PT_FPSR
-  PT_FPIAR = 47
-#define PT_FPIAR PT_FPIAR
-};
-
-#endif	/* _SYS_REG_H */
diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
deleted file mode 100644
index 3c441dc5ce..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1999, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* System V/m68k ABI compliant context switching support.  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-
-/* Type for general register.  */
-typedef int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	18
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NGREG];
-
-/* Number of each register is the `gregset_t' array.  */
-enum
-{
-  R_D0 = 0,
-#define R_D0	R_D0
-  R_D1 = 1,
-#define R_D1	R_D1
-  R_D2 = 2,
-#define R_D2	R_D2
-  R_D3 = 3,
-#define R_D3	R_D3
-  R_D4 = 4,
-#define R_D4	R_D4
-  R_D5 = 5,
-#define R_D5	R_D5
-  R_D6 = 6,
-#define R_D6	R_D6
-  R_D7 = 7,
-#define R_D7	R_D7
-  R_A0 = 8,
-#define R_A0	R_A0
-  R_A1 = 9,
-#define R_A1	R_A1
-  R_A2 = 10,
-#define R_A2	R_A2
-  R_A3 = 11,
-#define R_A3	R_A3
-  R_A4 = 12,
-#define R_A4	R_A4
-  R_A5 = 13,
-#define R_A5	R_A5
-  R_A6 = 14,
-#define R_A6	R_A6
-  R_A7 = 15,
-#define R_A7	R_A7
-  R_SP = 15,
-#define R_SP	R_SP
-  R_PC = 16,
-#define R_PC	R_PC
-  R_PS = 17
-#define R_PS	R_PS
-};
-
-/* Structure to describe FPU registers.  */
-typedef struct fpregset
-{
-  int f_fpregs[8][3];
-  int f_pcr;
-  int f_psr;
-  int f_fpiaddr;
-} fpregset_t;
-
-/* Context to describe whole processor state.  */
-typedef struct
-{
-  int version;
-  gregset_t gregs;
-  fpregset_t fpregs;
-} mcontext_t;
-
-#define MCONTEXT_VERSION 2
-
-/* Userlevel context.  */
-typedef struct ucontext
-{
-  unsigned long int uc_flags;
-  struct ucontext *uc_link;
-  __sigset_t uc_sigmask;
-  stack_t uc_stack;
-  mcontext_t uc_mcontext;
-  long int uc_filler[174];
-} ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/syscall.S b/sysdeps/unix/sysv/linux/m68k/syscall.S
deleted file mode 100644
index 4f2c747c27..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/syscall.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1996, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-/* Please consult the file sysdeps/unix/sysv/linux/m68k/sysdep.h for
-   more information about the value -4095 used below.*/
-
-	.text
-ENTRY (syscall)
-	move.l 4(%sp), %d0	/* Load syscall number.  */
-	_DOARGS_5 (24)		/* Frob arguments.  */
-	trap &0			/* Do the system call.  */
-	UNDOARGS_5		/* Unfrob arguments.  */
-	cmp.l &-4095, %d0	/* Check %d0 for error.  */
-	jcc SYSCALL_ERROR_LABEL	/* Jump to error handler if negative.  */
-	rts			/* Return to caller.  */
-PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
deleted file mode 100644
index 98d30667bd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ /dev/null
@@ -1,5 +0,0 @@
-# File name	Caller	Syscall name	Args	Strong name	Weak names
-
-cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
-oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
-oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.S b/sysdeps/unix/sysv/linux/m68k/sysdep.S
deleted file mode 100644
index e4ec92d836..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sysdep.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 1996, 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-
-/* The following code is only used in the shared library when we
-   compile the reentrant version.  Otherwise each system call defines
-   each own version.  */
-
-#ifndef	PIC
-
-/* The syscall stubs jump here when they detect an error.  */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %d0.  */
-
-	.text
-ENTRY (__syscall_error)
-	neg.l %d0
-#ifndef _LIBC_REENTRANT
-	move.l %d0, errno
-#else
-	move.l %d0, -(%sp)
-	jbsr __errno_location
-	move.l (%sp)+, (%a0)
-#endif
-	move.l #-1, %d0
-	/* Copy return value to %a0 for syscalls that are declared to
-	   return a pointer.  */
-	move.l %d0, %a0
-	rts
-END (__syscall_error)
-#endif /* PIC */
diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h
deleted file mode 100644
index 091dfc9c7d..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/sysdep.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,
-   December 1995.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/unix/sysdep.h>
-#include <sysdeps/m68k/sysdep.h>
-
-/* Defines RTLD_PRIVATE_ERRNO.  */
-#include <dl-sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* Linux uses a negative return value to indicate syscall errors, unlike
-   most Unices, which use the condition codes' carry flag.
-
-   Since version 2.1 the return value of a system call might be negative
-   even if the call succeeded.  E.g., the `lseek' system call might return
-   a large offset.  Therefore we must not anymore test for < 0, but test
-   for a real error by making sure the value in %d0 is a real error
-   number.  Linus said he will make sure the no syscall returns a value
-   in -1 .. -4095 as a valid result so we can savely test with -4095.  */
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef PIC
-#define SYSCALL_ERROR_LABEL .Lsyscall_error
-#else
-#define SYSCALL_ERROR_LABEL __syscall_error
-#endif
-
-#undef PSEUDO
-#define	PSEUDO(name, syscall_name, args)				      \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args);					      \
-    cmp.l &-4095, %d0;							      \
-    jcc SYSCALL_ERROR_LABEL
-
-#undef PSEUDO_END
-#define PSEUDO_END(name)						      \
-  SYSCALL_ERROR_HANDLER;						      \
-  END (name)
-
-#undef PSEUDO_NOERRNO
-#define	PSEUDO_NOERRNO(name, syscall_name, args)			      \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args)
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(name)					      \
-  END (name)
-
-#define ret_NOERRNO rts
-
-/* The function has to return the error code.  */
-#undef	PSEUDO_ERRVAL
-#define	PSEUDO_ERRVAL(name, syscall_name, args) \
-  .text;								      \
-  ENTRY (name)								      \
-    DO_CALL (syscall_name, args);					      \
-    negl %d0
-
-#undef	PSEUDO_END_ERRVAL
-#define	PSEUDO_END_ERRVAL(name) \
-  END (name)
-
-#define ret_ERRVAL rts
-
-#ifdef PIC
-# if RTLD_PRIVATE_ERRNO
-#  define SYSCALL_ERROR_HANDLER						      \
-SYSCALL_ERROR_LABEL:							      \
-    lea (rtld_errno, %pc), %a0;					      	      \
-    neg.l %d0;								      \
-    move.l %d0, (%a0);							      \
-    move.l &-1, %d0;							      \
-    /* Copy return value to %a0 for syscalls that are declared to return      \
-       a pointer (e.g., mmap).  */					      \
-    move.l %d0, %a0;							      \
-    rts;
-# else /* !RTLD_PRIVATE_ERRNO */
-/* Store (- %d0) into errno through the GOT.  */
-#  if defined _LIBC_REENTRANT
-#   define SYSCALL_ERROR_HANDLER					      \
-SYSCALL_ERROR_LABEL:							      \
-    neg.l %d0;								      \
-    move.l %d0, -(%sp);							      \
-    jbsr __errno_location@PLTPC;					      \
-    move.l (%sp)+, (%a0);						      \
-    move.l &-1, %d0;							      \
-    /* Copy return value to %a0 for syscalls that are declared to return      \
-       a pointer (e.g., mmap).  */					      \
-    move.l %d0, %a0;							      \
-    rts;
-#  else /* !_LIBC_REENTRANT */
-#   define SYSCALL_ERROR_HANDLER					      \
-SYSCALL_ERROR_LABEL:							      \
-    move.l (errno@GOTPC, %pc), %a0;					      \
-    neg.l %d0;								      \
-    move.l %d0, (%a0);							      \
-    move.l &-1, %d0;							      \
-    /* Copy return value to %a0 for syscalls that are declared to return      \
-       a pointer (e.g., mmap).  */					      \
-    move.l %d0, %a0;							      \
-    rts;
-#  endif /* _LIBC_REENTRANT */
-# endif /* RTLD_PRIVATE_ERRNO */
-#else
-# define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
-#endif /* PIC */
-
-/* Linux takes system call arguments in registers:
-
-	syscall number	%d0	     call-clobbered
-	arg 1		%d1	     call-clobbered
-	arg 2		%d2	     call-saved
-	arg 3		%d3	     call-saved
-	arg 4		%d4	     call-saved
-	arg 5		%d5	     call-saved
-
-   The stack layout upon entering the function is:
-
-	20(%sp)		Arg# 5
-	16(%sp)		Arg# 4
-	12(%sp)		Arg# 3
-	 8(%sp)		Arg# 2
-	 4(%sp)		Arg# 1
-	  (%sp)		Return address
-
-   (Of course a function with say 3 arguments does not have entries for
-   arguments 4 and 5.)
-
-   Separate move's are faster than movem, but need more space.  Since
-   speed is more important, we don't use movem.  Since %a0 and %a1 are
-   scratch registers, we can use them for saving as well.  */
-
-#define DO_CALL(syscall_name, args)			      		      \
-    move.l &SYS_ify(syscall_name), %d0;					      \
-    DOARGS_##args							      \
-    trap &0;								      \
-    UNDOARGS_##args
-
-#define	DOARGS_0	/* No arguments to frob.  */
-#define	UNDOARGS_0	/* No arguments to unfrob.  */
-#define	_DOARGS_0(n)	/* No arguments to frob.  */
-
-#define	DOARGS_1	_DOARGS_1 (4)
-#define	_DOARGS_1(n)	move.l n(%sp), %d1; _DOARGS_0 (n)
-#define	UNDOARGS_1	UNDOARGS_0
-
-#define	DOARGS_2	_DOARGS_2 (8)
-#define	_DOARGS_2(n)	move.l %d2, %a0; move.l n(%sp), %d2; _DOARGS_1 (n-4)
-#define	UNDOARGS_2	UNDOARGS_1; move.l %a0, %d2
-
-#define DOARGS_3	_DOARGS_3 (12)
-#define _DOARGS_3(n)	move.l %d3, %a1; move.l n(%sp), %d3; _DOARGS_2 (n-4)
-#define UNDOARGS_3	UNDOARGS_2; move.l %a1, %d3
-
-#define DOARGS_4	_DOARGS_4 (16)
-#define _DOARGS_4(n)	move.l %d4, -(%sp); move.l n+4(%sp), %d4; _DOARGS_3 (n)
-#define UNDOARGS_4	UNDOARGS_3; move.l (%sp)+, %d4
-
-#define DOARGS_5	_DOARGS_5 (20)
-#define _DOARGS_5(n)	move.l %d5, -(%sp); move.l n+4(%sp), %d5; _DOARGS_4 (n)
-#define UNDOARGS_5	UNDOARGS_4; move.l (%sp)+, %d5
-
-
-#define	ret	rts
-#if 0 /* Not used by Linux */
-#define	r0	%d0
-#define	r1	%d1
-#define	MOVE(x,y)	movel x , y
-#endif
-
-#else /* not __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)				\
-  ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args);	\
-     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
-       {								\
-	 __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, ));		\
-	 _sys_result = (unsigned int) -1;				\
-       }								\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
-
-/* Define a macro which expands inline into the wrapper code for a system
-   call.  This use is for internal calls that do not need to handle errors
-   normally.  It will never touch errno.  This returns just what the kernel
-   gave back.  */
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...)	\
-  ({ unsigned int _sys_result;				\
-     {							\
-       /* Load argument values in temporary variables
-	  to perform side effects like function calls
-	  before the call used registers are set.  */	\
-       LOAD_ARGS_##nr (args)				\
-       LOAD_REGS_##nr					\
-       register int _d0 asm ("%d0") = __NR_##name;	\
-       asm volatile ("trap #0"				\
-		     : "=d" (_d0)			\
-		     : "0" (_d0) ASM_ARGS_##nr		\
-		     : "memory");			\
-       _sys_result = _d0;				\
-     }							\
-     (int) _sys_result; })
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)		\
-  ((unsigned int) (val) >= -4095U)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
-
-#define LOAD_ARGS_0()
-#define LOAD_REGS_0
-#define ASM_ARGS_0
-#define LOAD_ARGS_1(a1)				\
-  LOAD_ARGS_0 ()				\
-  int __arg1 = (int) (a1);
-#define LOAD_REGS_1				\
-  register int _d1 asm ("d1") = __arg1;		\
-  LOAD_REGS_0
-#define ASM_ARGS_1	ASM_ARGS_0, "d" (_d1)
-#define LOAD_ARGS_2(a1, a2)			\
-  LOAD_ARGS_1 (a1)				\
-  int __arg2 = (int) (a2);
-#define LOAD_REGS_2				\
-  register int _d2 asm ("d2") = __arg2;		\
-  LOAD_REGS_1
-#define ASM_ARGS_2	ASM_ARGS_1, "d" (_d2)
-#define LOAD_ARGS_3(a1, a2, a3)			\
-  LOAD_ARGS_2 (a1, a2)				\
-  int __arg3 = (int) (a3);
-#define LOAD_REGS_3				\
-  register int _d3 asm ("d3") = __arg3;		\
-  LOAD_REGS_2
-#define ASM_ARGS_3	ASM_ARGS_2, "d" (_d3)
-#define LOAD_ARGS_4(a1, a2, a3, a4)		\
-  LOAD_ARGS_3 (a1, a2, a3)			\
-  int __arg4 = (int) (a4);
-#define LOAD_REGS_4				\
-  register int _d4 asm ("d4") = __arg4;		\
-  LOAD_REGS_3
-#define ASM_ARGS_4	ASM_ARGS_3, "d" (_d4)
-#define LOAD_ARGS_5(a1, a2, a3, a4, a5)		\
-  LOAD_ARGS_4 (a1, a2, a3, a4)			\
-  int __arg5 = (int) (a5);
-#define LOAD_REGS_5				\
-  register int _d5 asm ("d5") = __arg5;		\
-  LOAD_REGS_4
-#define ASM_ARGS_5	ASM_ARGS_4, "d" (_d5)
-#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)	\
-  LOAD_ARGS_5 (a1, a2, a3, a4, a5)		\
-  int __arg6 = (int) (a6);
-#define LOAD_REGS_6				\
-  register int _a0 asm ("a0") = __arg6;		\
-  LOAD_REGS_5
-#define ASM_ARGS_6	ASM_ARGS_5, "a" (_a0)
-
-#endif /* not __ASSEMBLER__ */
diff --git a/sysdeps/unix/sysv/linux/m68k/versionsort64.c b/sysdeps/unix/sysv/linux/m68k/versionsort64.c
deleted file mode 100644
index 144b691e56..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/versionsort64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/versionsort64.c>
diff --git a/sysdeps/unix/sysv/linux/m68k/vfork.S b/sysdeps/unix/sysv/linux/m68k/vfork.S
deleted file mode 100644
index 8027b2f801..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/vfork.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Schwab <schwab@gnu.org>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-#include <kernel-features.h>
-
-/* Clone the calling process, but without copying the whole address space.
-   The calling process is suspended until the new process exits or is
-   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
-   and the process ID of the new process to the old process.  */
-
-ENTRY (__vfork)
-
-#ifdef __NR_vfork
-
-	/* Pop the return PC value into A0.  */
-	movel	%sp@+, %a0
-
-	/* Stuff the syscall number in D0 and trap into the kernel.  */
-	movel	#SYS_ify (vfork), %d0
-	trap	#0
-	tstl	%d0
-	jmi	.Lerror		/* Branch forward if it failed.  */
-
-	/* Jump to the return PC.  */
-	jmp	%a0@
-
-.Lerror:
-	/* Push back the return PC.  */
-	movel	%a0,%sp@-
-
-# ifdef __ASSUME_VFORK_SYSCALL
-#  ifndef PIC
-	jbra	SYSCALL_ERROR_LABEL
-#  endif
-# else
-	/* Check if vfork syscall is known at all.  */
-	movel	#-ENOSYS,%d1
-	cmpl	%d0,%d1
-	jne	SYSCALL_ERROR_LABEL
-
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-
-	movel	#SYS_ify (fork), %d0
-	trap	#0
-	tstl	%d0
-	jmi	SYSCALL_ERROR_LABEL
-	rts
-#endif
-
-PSEUDO_END (__vfork)
-libc_hidden_def (__vfork)
-
-weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/m68k/xstat.c b/sysdeps/unix/sysv/linux/m68k/xstat.c
deleted file mode 100644
index e9869f5508..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/xstat.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/xstat.c>
diff --git a/sysdeps/unix/sysv/linux/mips/Dist b/sysdeps/unix/sysv/linux/mips/Dist
deleted file mode 100644
index 1d74119a6d..0000000000
--- a/sysdeps/unix/sysv/linux/mips/Dist
+++ /dev/null
@@ -1,13 +0,0 @@
-_test_and_set.c
-clone.S
-entry.h
-ipc_priv.h
-kernel_sigaction.h
-kernel_stat.h
-kernel_termios.h
-sys/cachectl.h
-sys/procfs.h
-sys/sysmips.h
-sys/tas.h
-sys/user.h
-xstatconv.c
diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile
deleted file mode 100644
index d5e4f6b72d..0000000000
--- a/sysdeps/unix/sysv/linux/mips/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-ifeq ($(subdir),signal)
-#sysdep_routines += sigsuspend
-endif
-
-ifeq ($(subdir),misc)
-sysdep_routines += cachectl cacheflush sysmips _test_and_set
-
-sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
-
-no_syscall_list_h = 1
-
-# Generate the list of SYS_* macros for the system calls (__NR_* macros).
-# We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
-# it exists, but also define SYS_<abi>_<syscall> for all ABIs.
-$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h
-	$(make-target-directory)
-	{ \
-	 echo '/* Generated at libc build time from kernel syscall list.  */';\
-	 echo ''; \
-	 echo '#ifndef _SYSCALL_H'; \
-	 echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
-	 echo '#endif'; \
-	 echo ''; \
-	 echo '#include <sgidefs.h>'; \
-	 rm -f $(@:.d=.h).newt; \
-	 $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
-	       -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \
-	 sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
-	     > $(@:.d=.h).newt; \
-	 if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
-	   echo '#if _MIPS_SIM == _ABIN32'; \
-	   sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort; \
-	   echo '#elif _MIPS_SIM == _ABI64'; \
-	   sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort; \
-	   echo '#else'; \
-	   sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort; \
-	   echo '#endif'; \
-	   sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \
-		LC_ALL=C sort +1.8; \
-	 else \
-	   cat $(@:.d=.h).newt; \
-	 fi; \
-	 rm $(@:.d=.h).newt; \
-	} > $(@:.d=.h).new
-	mv -f $(@:.d=.h).new $(@:.d=.h)
-ifneq (,$(objpfx))
-	sed $(sed-remove-objpfx) $(@:.h=.d)-t > $(@:.h=.d)-t2
-	rm -f $(@:.h=.d)-t
-	mv -f $(@:.h=.d)-t2 $(@:.h=.d)
-else
-	mv -f $(@:.h=.d)-t $(@:.h=.d)
-endif
-endif
diff --git a/sysdeps/unix/sysv/linux/mips/Versions b/sysdeps/unix/sysv/linux/mips/Versions
deleted file mode 100644
index 50bfac5599..0000000000
--- a/sysdeps/unix/sysv/linux/mips/Versions
+++ /dev/null
@@ -1,31 +0,0 @@
-libc {
-  # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
-  # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
-
-  GLIBC_2.0 {
-    #errlist-compat	123
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-
-    # Exception handling support functions from libgcc
-    __register_frame; __register_frame_table; __deregister_frame;
-    __frame_state_for; __register_frame_info_table;
-
-    # Needed by gcc:
-    _flush_cache;
-
-    # c*
-    cachectl; cacheflush;
-
-    # s*
-    sysmips;
-  }
-  GLIBC_2.2 {
-    #errlist-compat	1134
-    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
-
-    # _*
-    _test_and_set;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/mips/_test_and_set.c b/sysdeps/unix/sysv/linux/mips/_test_and_set.c
deleted file mode 100644
index 9fd48f753e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/_test_and_set.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Define the real-function versions of all inline functions
-   defined in sys/tas.h  */
-
-#include <features.h>
-
-#define _EXTERN_INLINE
-#ifndef __USE_EXTERN_INLINES
-# define __USE_EXTERN_INLINES 1
-#endif
-
-#include "sys/tas.h"
diff --git a/sysdeps/unix/sysv/linux/mips/bits/endian.h b/sysdeps/unix/sysv/linux/mips/bits/endian.h
deleted file mode 100644
index 0a3d2fabe3..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/endian.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* The MIPS architecture has selectable endianness.
-   Linux/MIPS exists in two both little and big endian flavours and we
-   want to be able to share the installed headerfiles between both,
-   so we define __BYTE_ORDER based on GCC's predefines.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#ifdef __MIPSEB__
-# define __BYTE_ORDER __BIG_ENDIAN
-#else
-# ifdef __MIPSEL__
-#  define __BYTE_ORDER __LITTLE_ENDIAN
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/errno.h b/sysdeps/unix/sysv/linux/mips/bits/errno.h
deleted file mode 100644
index 8220c2e513..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/errno.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Error constants.  MIPS/Linux specific version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef _ERRNO_H
-
-# undef EDOM
-# undef EILSEQ
-# undef ERANGE
-# include <linux/errno.h>
-
-/* Linux has no ENOTSUP error code.  */
-# define ENOTSUP EOPNOTSUPP
-
-# ifndef __ASSEMBLER__
-/* Function to get address of global `errno' variable.  */
-extern int *__errno_location (void) __THROW __attribute__ ((__const__));
-
-#  if !defined _LIBC || defined _LIBC_REENTRANT
-/* When using threads, errno is a per-thread value.  */
-#   define errno (*__errno_location ())
-#  endif
-# endif /* !__ASSEMBLER__ */
-#endif /* _ERRNO_H */
-
-#if !defined _ERRNO_H && defined __need_Emath
-/* This is ugly but the kernel header is not clean enough.  We must
-   define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is
-   defined.  */
-# define EDOM	33	/* Math argument out of domain of function.  */
-# define EILSEQ	88	/* Illegal byte sequence.  */
-# define ERANGE	34	/* Math result not representable.  */
-#endif /* !_ERRNO_H && __need_Emath */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h b/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
deleted file mode 100644
index aa039b4c0e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/fcntl.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-#include <sgidefs.h>
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	0x0003
-#define O_RDONLY	0x0000
-#define O_WRONLY	0x0001
-#define O_RDWR		0x0002
-#define O_APPEND	0x0008
-#define O_SYNC		0x0010
-#define O_NONBLOCK	0x0080
-#define O_CREAT		0x0100	/* not fcntl */
-#define O_TRUNC		0x0200	/* not fcntl */
-#define O_EXCL		0x0400	/* not fcntl */
-#define O_NOCTTY	0x0800	/* not fcntl */
-#define O_FSYNC		O_SYNC
-#define O_ASYNC		0x1000
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE	0x2000	/* Allow large file opens.  */
-#endif
-
-#ifdef __USE_GNU
-# define O_NOFOLLOW	0x20000	/* Do not follow links.	 */
-# define O_DIRECT	0x8000	/* Direct disk access hint.  */
-# define O_DIRECTORY	0x10000	/* Must be a directory.	 */
-# define O_NOATIME	0x40000	/* Do not set atime.  */
-#endif
-
-#define O_NDELAY	O_NONBLOCK
-
-/* For now Linux has no synchronisity options for data and read
-   operations.	We define the symbols here but let them do the same as
-   O_SYNC since this is a superset.  */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
-#endif
-
-/* Values for the second argument to `fcntl'.  */
-#define F_DUPFD		0	/* Duplicate file descriptor.  */
-#define F_GETFD		1	/* Get file descriptor flags.  */
-#define F_SETFD		2	/* Set file descriptor flags.  */
-#define F_GETFL		3	/* Get file status flags.  */
-#define F_SETFL		4	/* Set file status flags.  */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK	14	/* Get record locking info.  */
-# define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).	*/
-#else
-# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
-# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
-# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
-#endif
-
-#define F_GETLK64	33	/* Get record locking info.  */
-#define F_SETLK64	34	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	35	/* Set record locking info (blocking).	*/
-
-#if defined __USE_BSD || defined __USE_UNIX98
-# define F_SETOWN	24	/* Get owner of socket (receiver of SIGIO).  */
-# define F_GETOWN	23	/* Set owner of socket (receiver of SIGIO).  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG	10	/* Set number of signal to be sent.  */
-# define F_GETSIG	11	/* Get number of signal to be sent.  */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE	1024	/* Set a lease.	 */
-# define F_GETLEASE	1025	/* Enquire what lease is active.  */
-# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
-#endif
-
-/* for F_[GET|SET]FL */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
-#define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.	*/
-#define F_UNLCK		2	/* Remove lock.	 */
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH	1	/* shared lock */
-# define LOCK_EX	2	/* exclusive lock */
-# define LOCK_NB	4	/* or'd with one of the above to prevent
-				   blocking */
-# define LOCK_UN	8	/* remove lock */
-#endif
-
-#ifdef __USE_GNU
-# define LOCK_MAND	32	/* This is a mandatory flock:	*/
-# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
-# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
-# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
-#endif
-
-#ifdef __USE_GNU
-/* Types of directory notifications that may be requested with F_NOTIFY.  */
-# define DN_ACCESS	0x00000001	/* File accessed.  */
-# define DN_MODIFY	0x00000002	/* File modified.  */
-# define DN_CREATE	0x00000004	/* File created.  */
-# define DN_DELETE	0x00000008	/* File removed.  */
-# define DN_RENAME	0x00000010	/* File renamed.  */
-# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
-# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
-#endif
-
-typedef struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#if _MIPS_SIM != _ABI64
-    /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
-       fcntls in o32 and n32, never has this field.  */
-    long int l_sysid;
-#endif
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-#if ! defined __USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64
-    /* The 64-bit flock structure, used by the n64 ABI, and for 64-bit
-       flock in o32 and n32, never has this field.  */
-    long int pad[4];
-#endif
-} flock_t;
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-
-/* Define some more compatibility macros to be backward compatible with
-   BSD systems which did not managed to hide these kernel macros.  */
-#ifdef	__USE_BSD
-# define FAPPEND	O_APPEND
-# define FFSYNC		O_FSYNC
-# define FASYNC		O_ASYNC
-# define FNONBLOCK	O_NONBLOCK
-# define FNDELAY	O_NDELAY
-#endif /* Use BSD.  */
-
-/* Advise to `posix_fadvise'.  */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
-# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
-# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
-# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
-# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h b/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
deleted file mode 100644
index a8dcf242d3..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/ioctl-types.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Structure types for pre-termios terminal ioctls.  Linux/MIPS version.
-   Copyright (C) 1997, 1999, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_IOCTL_H
-# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
-#endif
-
-/* Get definition of constants for use with `ioctl'.  */
-#include <asm/ioctls.h>
-
-struct winsize
-  {
-    unsigned short int ws_row;
-    unsigned short int ws_col;
-    unsigned short int ws_xpixel;
-    unsigned short int ws_ypixel;
-  };
-
-#define NCC	8
-struct termio
-  {
-    unsigned short int c_iflag;		/* input mode flags */
-    unsigned short int c_oflag;		/* output mode flags */
-    unsigned short int c_cflag;		/* control mode flags */
-    unsigned short int c_lflag;		/* local mode flags */
-    char c_line;			/* line discipline */
-    /* Yes, this is really NCCS.  */
-    unsigned char c_cc[32 /* NCCS */]; /* control characters */
-  };
-
-/* modem lines */
-#define TIOCM_LE	0x001		/* line enable */
-#define TIOCM_DTR	0x002		/* data terminal ready */
-#define TIOCM_RTS	0x004		/* request to send */
-#define TIOCM_ST	0x010		/* secondary transmit */
-#define TIOCM_SR	0x020		/* secondary receive */
-#define TIOCM_CTS	0x040		/* clear to send */
-#define TIOCM_CAR	0x100		/* carrier detect */
-#define TIOCM_CD	TIOCM_CAR
-#define TIOCM_RNG	0x200		/* ring */
-#define TIOCM_RI	TIOCM_RNG
-#define TIOCM_DSR	0x400		/* data set ready */
-
-/* line disciplines */
-#define N_TTY		0
-#define N_SLIP		1
-#define N_MOUSE		2
-#define N_PPP		3
-#define N_STRIP		4
-#define N_AX25		5
-#define N_X25		6	/* X.25 async  */
-#define N_6PACK		7
-#define N_MASC		8	/* Mobitex module  */
-#define N_R3964		9	/* Simatic R3964 module  */
-#define N_PROFIBUS_FDL	10	/* Profibus  */
-#define N_IRDA		11	/* Linux IR  */
-#define N_SMSBLOCK	12	/* SMS block mode  */
-#define N_HDLC		13	/* synchronous HDLC  */
-#define N_SYNC_PPP	14	/* synchronous PPP  */
-#define	N_HCI		15	/* Bluetooth HCI UART  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/ipc.h b/sysdeps/unix/sysv/linux/mips/bits/ipc.h
deleted file mode 100644
index 1f629ce665..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/ipc.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_IPC_H
-# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Mode bits for `msgget', `semget', and `shmget'.  */
-#define IPC_CREAT	01000		/* Create key if key does not exist. */
-#define IPC_EXCL	02000		/* Fail if key exists.	*/
-#define IPC_NOWAIT	04000		/* Return error on wait.  */
-
-/* Control commands for `msgctl', `semctl', and `shmctl'.  */
-#define IPC_RMID	0		/* Remove identifier.  */
-#define IPC_SET		1		/* Set `ipc_perm' options.  */
-#define IPC_STAT	2		/* Get `ipc_perm' options.  */
-#ifdef __USE_GNU
-# define IPC_INFO	3		/* See ipcs.  */
-#endif
-
-/* Special key values.	*/
-#define IPC_PRIVATE	((__key_t) 0)	/* Private key.	 */
-
-
-/* Data structure used to pass permission information to IPC operations.  */
-struct ipc_perm
-  {
-    __key_t __key;			/* Key.  */
-    unsigned int uid;			/* Owner's user ID.  */
-    unsigned int gid;			/* Owner's group ID.  */
-    unsigned int cuid;			/* Creator's user ID.  */
-    unsigned int cgid;			/* Creator's group ID.	*/
-    unsigned int mode;			/* Read/write permission.  */
-    unsigned short int __seq;		/* Sequence number.  */
-    unsigned short int __pad1;
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-};
diff --git a/sysdeps/unix/sysv/linux/mips/bits/mman.h b/sysdeps/unix/sysv/linux/mips/bits/mman.h
deleted file mode 100644
index 154501fba2..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/mman.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Definitions for POSIX memory map interface.  Linux/MIPS version.
-   Copyright (C) 1997, 2000, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
-   But the kernel header is not namespace clean.  */
-
-
-/* Protections are chosen from these bits, OR'd together.  The
-   implementation does not necessarily support PROT_EXEC or PROT_WRITE
-   without PROT_READ.  The only guarantees are that no writing will be
-   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ	0x1		/* Page can be read.  */
-#define PROT_WRITE	0x2		/* Page can be written.  */
-#define PROT_EXEC	0x4		/* Page can be executed.  */
-#define PROT_NONE	0x0		/* Page can not be accessed.  */
-#define PROT_GROWSDOWN	0x01000000	/* Extend change to start of
-					   growsdown vma (mprotect only).  */
-#define PROT_GROWSUP	0x02000000	/* Extend change to start of
-					   growsup vma (mprotect only).  */
-
-/* Sharing types (must choose one and only one of these).  */
-#define MAP_SHARED	0x01		/* Share changes.  */
-#define MAP_PRIVATE	0x02		/* Changes are private.  */
-#ifdef __USE_MISC
-# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
-#endif
-
-/* Other flags.  */
-#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
-#ifdef __USE_MISC
-# define MAP_FILE	0x00
-# define MAP_ANONYMOUS	0x0800		/* Don't use a file.  */
-# define MAP_ANON	MAP_ANONYMOUS
-# define MAP_RENAME	MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific.  */
-#ifdef __USE_MISC
-# define MAP_NORESERVE	0x0400		/* don't check for reservations */
-# define MAP_ANONYMOUS	0x0800		/* don't use a file */
-# define MAP_GROWSDOWN	0x1000		/* stack-like segment */
-# define MAP_DENYWRITE	0x2000		/* ETXTBSY */
-# define MAP_EXECUTABLE	0x4000		/* mark it as an executable */
-# define MAP_LOCKED	0x8000		/* pages are locked */
-# define MAP_POPULATE   0x10000         /* populate (prefault) pagetables */
-# define MAP_NONBLOCK   0x20000         /* do not block on IO */
-#endif
-
-/* Flags to `msync'.  */
-#define MS_ASYNC	1		/* Sync memory asynchronously.  */
-#define MS_INVALIDATE	2		/* Invalidate the caches.  */
-#define MS_SYNC		4		/* Synchronous memory sync.  */
-
-/* Flags for `mlockall'.  */
-#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
-#define MCL_FUTURE	2		/* Lock all additions to address
-					   space.  */
-
-/* Advice to `madvise'.  */
-#ifdef __USE_BSD
-#define MADV_NORMAL	0		/* default page-in behavior */
-#define MADV_RANDOM	1		/* page-in minimum required */
-#define MADV_SEQUENTIAL	2		/* read-ahead aggressively */
-#define MADV_WILLNEED	3		/* pre-fault pages */
-#define MADV_DONTNEED	4		/* discard these pages */
-#endif
-
-/* Flags for `mremap'.  */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE	1
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/msq.h b/sysdeps/unix/sysv/linux/mips/bits/msq.h
deleted file mode 100644
index c2c1dd2e85..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/msq.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_MSG_H
-# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Define options for message queue functions.  */
-#define MSG_NOERROR	010000	/* no error if message is too big */
-#ifdef __USE_GNU
-# define MSG_EXCEPT	020000	/* recv any msg except of specified type */
-#endif
-
-/* Types used in the structure definition.  */
-typedef unsigned long int msgqnum_t;
-typedef unsigned long int msglen_t;
-
-
-/* Structure of record for one message inside the kernel.
-   The type `struct msg' is opaque.  */
-struct msqid_ds
-{
-  struct ipc_perm msg_perm;	/* structure describing operation permission */
-  __time_t msg_stime;		/* time of last msgsnd command */
-  __time_t msg_rtime;		/* time of last msgrcv command */
-  __time_t msg_ctime;		/* time of last change */
-  unsigned long int __msg_cbytes; /* current number of bytes on queue */
-  msgqnum_t msg_qnum;		/* number of messages currently on queue */
-  msglen_t msg_qbytes;		/* max number of bytes allowed on queue */
-  __pid_t msg_lspid;		/* pid of last msgsnd() */
-  __pid_t msg_lrpid;		/* pid of last msgrcv() */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-#ifdef __USE_MISC
-
-# define msg_cbytes	__msg_cbytes
-
-/* ipcs ctl commands */
-# define MSG_STAT 11
-# define MSG_INFO 12
-
-/* buffer for msgctl calls IPC_INFO, MSG_INFO */
-struct msginfo
-  {
-    int msgpool;
-    int msgmap;
-    int msgmax;
-    int msgmnb;
-    int msgmni;
-    int msgssz;
-    int msgtql;
-    unsigned short int msgseg;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/poll.h b/sysdeps/unix/sysv/linux/mips/bits/poll.h
deleted file mode 100644
index f62b9c3948..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/poll.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 1997, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_POLL_H
-# error "Never use <bits/poll.h> directly; include <sys/poll.h> instead."
-#endif
-
-/* Event types that can be polled for.  These bits may be set in `events'
-   to indicate the interesting event types; they will appear in `revents'
-   to indicate the status of the file descriptor.  */
-#define POLLIN		0x001		/* There is data to read.  */
-#define POLLPRI		0x002		/* There is urgent data to read.  */
-#define POLLOUT		0x004		/* Writing now will not block.  */
-
-#ifdef __USE_XOPEN
-/* These values are defined in XPG4.2.  */
-# define POLLRDNORM	0x040		/* Normal data may be read.  */
-# define POLLRDBAND	0x080		/* Priority data may be read.  */
-# define POLLWRNORM	POLLOUT		/* Writing now will not block.  */
-# define POLLWRBAND	0x100		/* Priority data may be written.  */
-#endif
-
-#ifdef __USE_GNU
-/* This is an extension for Linux.  */
-# define POLLMSG	0x400
-#endif
-
-/* Event types always implicitly polled for.  These bits need not be set in
-   `events', but they will appear in `revents' to indicate the status of
-   the file descriptor.  */
-#define POLLERR		0x008		/* Error condition.  */
-#define POLLHUP		0x010		/* Hung up.  */
-#define POLLNVAL	0x020		/* Invalid polling request.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h
deleted file mode 100644
index 2b6c887fd0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Bit values & structures for resource limits.  Linux/MIPS version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Transmute defines to enumerations.  The macro re-definitions are
-   necessary because some programs want to test for operating system
-   features with #ifdef RUSAGE_SELF.  In ISO C the reflexive
-   definition is a no-op.  */
-
-/* Kinds of resource limit.  */
-enum __rlimit_resource
-{
-  /* Per-process CPU limit, in seconds.  */
-  RLIMIT_CPU = 0,
-#define RLIMIT_CPU RLIMIT_CPU
-
-  /* Largest file that can be created, in bytes.  */
-  RLIMIT_FSIZE = 1,
-#define	RLIMIT_FSIZE RLIMIT_FSIZE
-
-  /* Maximum size of data segment, in bytes.  */
-  RLIMIT_DATA = 2,
-#define	RLIMIT_DATA RLIMIT_DATA
-
-  /* Maximum size of stack segment, in bytes.  */
-  RLIMIT_STACK = 3,
-#define	RLIMIT_STACK RLIMIT_STACK
-
-  /* Largest core file that can be created, in bytes.  */
-  RLIMIT_CORE = 4,
-#define	RLIMIT_CORE RLIMIT_CORE
-
-  /* Largest resident set size, in bytes.
-     This affects swapping; processes that are exceeding their
-     resident set size will be more likely to have physical memory
-     taken from them.  */
-  __RLIMIT_RSS = 7,
-#define	RLIMIT_RSS __RLIMIT_RSS
-
-  /* Number of open files.  */
-  RLIMIT_NOFILE = 5,
-  __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same.  */
-#define RLIMIT_NOFILE RLIMIT_NOFILE
-#define RLIMIT_OFILE __RLIMIT_OFILE
-
-  /* Address space limit (?) */
-  RLIMIT_AS = 6,
-#define RLIMIT_AS RLIMIT_AS
-
-  /* Number of processes.  */
-  __RLIMIT_NPROC = 8,
-#define RLIMIT_NPROC __RLIMIT_NPROC
-
-  /* Locked-in-memory address space.  */
-  __RLIMIT_MEMLOCK = 9,
-#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK
-
-  /* Maximum number of file locks.  */
-  __RLIMIT_LOCKS = 10,
-#define RLIMIT_LOCKS __RLIMIT_LOCKS
-
-  /* Maximum number of pending signals.  */
-  __RLIMIT_SIGPENDING = 11,
-#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING
-
-  /* Maximum bytes in POSIX message queues.  */
-  __RLIMIT_MSGQUEUE = 12,
-#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
-
-  __RLIMIT_NLIMITS = 13,
-  __RLIM_NLIMITS = __RLIMIT_NLIMITS
-#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
-#define RLIM_NLIMITS __RLIM_NLIMITS
-};
-
-/* Value to indicate that there is no limit.  */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((long int)(~0UL >> 1))
-#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
-#endif
-
-/* We can represent all limits.  */
-#define RLIM_SAVED_MAX	RLIM_INFINITY
-#define RLIM_SAVED_CUR	RLIM_INFINITY
-
-
-/* Type for resource quantity measurement.  */
-#ifndef __USE_FILE_OFFSET64
-typedef __rlim_t rlim_t;
-#else
-typedef __rlim64_t rlim_t;
-#endif
-#ifdef __USE_LARGEFILE64
-typedef __rlim64_t rlim64_t;
-#endif
-
-struct rlimit
-  {
-    /* The current (soft) limit.  */
-    rlim_t rlim_cur;
-    /* The hard limit.  */
-    rlim_t rlim_max;
-  };
-
-#ifdef __USE_LARGEFILE64
-struct rlimit64
-  {
-    /* The current (soft) limit.  */
-    rlim64_t rlim_cur;
-    /* The hard limit.  */
-    rlim64_t rlim_max;
- };
-#endif
-
-/* Whose usage statistics do you want?  */
-enum __rusage_who
-{
-  /* The calling process.  */
-  RUSAGE_SELF = 0,
-#define RUSAGE_SELF RUSAGE_SELF
-
-  /* All of its terminated child processes.  */
-  RUSAGE_CHILDREN = -1
-#define RUSAGE_CHILDREN RUSAGE_CHILDREN
-};
-
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
-
-/* Structure which says how much of each resource has been used.  */
-struct rusage
-  {
-    /* Total amount of user time used.  */
-    struct timeval ru_utime;
-    /* Total amount of system time used.  */
-    struct timeval ru_stime;
-    /* Maximum resident set size (in kilobytes).  */
-    long int ru_maxrss;
-    /* Amount of sharing of text segment memory
-       with other processes (kilobyte-seconds).  */
-    long int ru_ixrss;
-    /* Amount of data segment memory used (kilobyte-seconds).  */
-    long int ru_idrss;
-    /* Amount of stack memory used (kilobyte-seconds).  */
-    long int ru_isrss;
-    /* Number of soft page faults (i.e. those serviced by reclaiming
-       a page from the list of pages awaiting reallocation.  */
-    long int ru_minflt;
-    /* Number of hard page faults (i.e. those that required I/O).  */
-    long int ru_majflt;
-    /* Number of times a process was swapped out of physical memory.  */
-    long int ru_nswap;
-    /* Number of input operations via the file system.  Note: This
-       and `ru_oublock' do not include operations with the cache.  */
-    long int ru_inblock;
-    /* Number of output operations via the file system.  */
-    long int ru_oublock;
-    /* Number of IPC messages sent.  */
-    long int ru_msgsnd;
-    /* Number of IPC messages received.  */
-    long int ru_msgrcv;
-    /* Number of signals delivered.  */
-    long int ru_nsignals;
-    /* Number of voluntary context switches, i.e. because the process
-       gave up the process before it had to (usually to wait for some
-       resource to be available).  */
-    long int ru_nvcsw;
-    /* Number of involuntary context switches, i.e. a higher priority process
-       became runnable or the current process used up its time slice.  */
-    long int ru_nivcsw;
-  };
-
-/* Priority limits.  */
-#define PRIO_MIN	-20	/* Minimum priority a process can have.  */
-#define PRIO_MAX	20	/* Maximum priority a process can have.  */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
-   indicating what flavor of entity the WHO argument specifies.  */
-enum __priority_which
-{
-  PRIO_PROCESS = 0,		/* WHO is a process ID.  */
-#define PRIO_PROCESS PRIO_PROCESS
-  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
-#define PRIO_PGRP PRIO_PGRP
-  PRIO_USER = 2			/* WHO is a user ID.  */
-#define PRIO_USER PRIO_USER
-};
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sem.h b/sysdeps/unix/sysv/linux/mips/bits/sem.h
deleted file mode 100644
index 6282de9cc8..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sem.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SEM_H
-# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead."
-#endif
-
-#include <sys/types.h>
-
-/* Flags for `semop'.  */
-#define SEM_UNDO	0x1000		/* undo the operation on exit */
-
-/* Commands for `semctl'.  */
-#define GETPID		11		/* get sempid */
-#define GETVAL		12		/* get semval */
-#define GETALL		13		/* get all semval's */
-#define GETNCNT		14		/* get semncnt */
-#define GETZCNT		15		/* get semzcnt */
-#define SETVAL		16		/* set semval */
-#define SETALL		17		/* set all semval's */
-
-
-/* Data structure describing a set of semaphores.  */
-struct semid_ds
-{
-  struct ipc_perm sem_perm;		/* operation permission struct */
-  __time_t sem_otime;			/* last semop() time */
-  __time_t sem_ctime;			/* last time changed by semctl() */
-  unsigned long int sem_nsems;		/* number of semaphores in set */
-  unsigned long int __unused1;
-  unsigned long int __unused2;
-};
-
-/* The user should define a union like the following to use it for arguments
-   for `semctl'.
-
-   union semun
-   {
-     int val;				<= value for SETVAL
-     struct semid_ds *buf;		<= buffer for IPC_STAT & IPC_SET
-     unsigned short int *array;		<= array for GETALL & SETALL
-     struct seminfo *__buf;		<= buffer for IPC_INFO
-   };
-
-   Previous versions of this file used to define this union but this is
-   incorrect.  One can test the macro _SEM_SEMUN_UNDEFINED to see whether
-   one must define the union or not.  */
-#define _SEM_SEMUN_UNDEFINED	1
-
-#ifdef __USE_MISC
-
-/* ipcs ctl cmds */
-# define SEM_STAT 18
-# define SEM_INFO 19
-
-struct  seminfo
-{
-  int semmap;
-  int semmni;
-  int semmns;
-  int semmnu;
-  int semmsl;
-  int semopm;
-  int semume;
-  int semusz;
-  int semvmx;
-  int semaem;
-};
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/shm.h b/sysdeps/unix/sysv/linux/mips/bits/shm.h
deleted file mode 100644
index b3083346dd..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/shm.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (C) 1995,1996,1997,2000,2001,2002,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SHM_H
-# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Permission flag for shmget.  */
-#define SHM_R		0400		/* or S_IRUGO from <linux/stat.h> */
-#define SHM_W		0200		/* or S_IWUGO from <linux/stat.h> */
-
-/* Flags for `shmat'.  */
-#define SHM_RDONLY	010000		/* attach read-only else read-write */
-#define SHM_RND		020000		/* round attach address to SHMLBA */
-#define SHM_REMAP	040000		/* take-over region on attach */
-
-/* Commands for `shmctl'.  */
-#define SHM_LOCK	11		/* lock segment (root only) */
-#define SHM_UNLOCK	12		/* unlock segment (root only) */
-
-/* Segment low boundary address multiple.  */
-#define SHMLBA		0x40000
-
-
-/* Type to count number of attaches.  */
-typedef unsigned long int shmatt_t;
-
-/* Data structure describing a set of semaphores.  */
-struct shmid_ds
-  {
-    struct ipc_perm shm_perm;		/* operation permission struct */
-    size_t shm_segsz;			/* size of segment in bytes */
-    __time_t shm_atime;			/* time of last shmat() */
-    __time_t shm_dtime;			/* time of last shmdt() */
-    __time_t shm_ctime;			/* time of last change by shmctl() */
-    __pid_t shm_cpid;			/* pid of creator */
-    __pid_t shm_lpid;			/* pid of last shmop */
-    shmatt_t shm_nattch;		/* number of current attaches */
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-  };
-
-#ifdef __USE_MISC
-
-/* ipcs ctl commands */
-# define SHM_STAT	13
-# define SHM_INFO	14
-
-/* shm_mode upper byte flags */
-# define SHM_DEST	01000	/* segment will be destroyed on last detach */
-# define SHM_LOCKED	02000   /* segment will not be swapped */
-# define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
-
-struct shminfo
-  {
-    unsigned long int shmmax;
-    unsigned long int shmmin;
-    unsigned long int shmmni;
-    unsigned long int shmseg;
-    unsigned long int shmall;
-    unsigned long int __unused1;
-    unsigned long int __unused2;
-    unsigned long int __unused3;
-    unsigned long int __unused4;
-  };
-
-struct shm_info
-  {
-    int used_ids;
-    unsigned long int shm_tot;  /* total allocated shm */
-    unsigned long int shm_rss;  /* total resident shm */
-    unsigned long int shm_swp;  /* total swapped shm */
-    unsigned long int swap_attempts;
-    unsigned long int swap_successes;
-  };
-
-#endif /* __USE_MISC */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigaction.h b/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
deleted file mode 100644
index d04e25f76f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sigaction.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* The proper definitions for Linux/MIPS's sigaction.
-   Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2003
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
-#endif
-
-/* Structure describing the action to be taken when a signal arrives.  */
-struct sigaction
-  {
-    /* Special flags.  */
-    unsigned int sa_flags;
-
-    /* Signal handler.  */
-#ifdef __USE_POSIX199309
-    union
-      {
-	/* Used if SA_SIGINFO is not set.  */
-	__sighandler_t sa_handler;
-	/* Used if SA_SIGINFO is set.  */
-	void (*sa_sigaction) (int, siginfo_t *, void *);
-      }
-    __sigaction_handler;
-# define sa_handler    __sigaction_handler.sa_handler
-# define sa_sigaction  __sigaction_handler.sa_sigaction
-#else
-    __sighandler_t sa_handler;
-#endif
-    /* Additional set of signals to be blocked.  */
-    __sigset_t sa_mask;
-
-    /* The ABI says here are two unused ints following. */
-    /* Restore handler.  */
-    void (*sa_restorer) (void);
-
-#if _MIPS_SZPTR < 64
-    int sa_resv[1];
-#endif
-  };
-
-/* Bits in `sa_flags'.  */
-/* Please note that some Linux kernels versions use different values for these
-   flags which is a bug in those kernel versions.  */
-#define SA_NOCLDSTOP  0x00000001 /* Don't send SIGCHLD when children stop.  */
-#define SA_NOCLDWAIT  0x00010000 /* Don't create zombie on child death.  */
-#define SA_SIGINFO    0x00000008 /* Invoke signal-catching function with
-				    three arguments instead of one.  */
-#if defined __USE_UNIX98 || defined __USE_MISC
-# define SA_ONSTACK   0x08000000 /* Use signal stack by using `sa_restorer'. */
-# define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler.  */
-# define SA_RESTART   0x10000000 /* Restart syscall on signal return.  */
-# define SA_NODEFER   0x40000000 /* Don't automatically block the signal when
-				    its handler is being executed.  */
-#endif
-#ifdef __USE_MISC
-# define SA_INTERRUPT 0x20000000 /* Historical no-op.  */
-
-/* Some aliases for the SA_ constants.  */
-# define SA_NOMASK    SA_NODEFER
-# define SA_ONESHOT   SA_RESETHAND
-# define SA_STACK     SA_ONSTACK
-#endif
-
-/* Values for the HOW argument to `sigprocmask'.  */
-#define SIG_NOP	      0		/* 0 is unused to catch errors */
-#define	SIG_BLOCK     1		/* Block signals.  */
-#define	SIG_UNBLOCK   2		/* Unblock signals.  */
-#define	SIG_SETMASK   3		/* Set the set of blocked signals.  */
-#ifdef __USE_MISC
-# define SIG_SETMASK32 256	/* Goodie from SGI for BSD compatibility:
-				   set only the low 32 bit of the sigset.  */
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h b/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
deleted file mode 100644
index 079964ed46..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-#include <sgidefs.h>
-
-#ifndef sigcontext_struct
-/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
-   we need sigcontext.  */
-# define sigcontext_struct sigcontext
-
-/* # include <asm/sigcontext.h> */
-/* Instead of including the kernel header, that will vary depending on
-   whether the 32- or the 64-bit kernel is installed, we paste the
-   contents here.  In case you're wondering about the different
-   licenses, the fact that the file is pasted, instead of included,
-   doesn't really make any difference for the program that includes
-   this header.  */
-#if _MIPS_SIM == _ABIO32
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 1997, 2000 by Ralf Baechle
- */
-#ifndef _ASM_SIGCONTEXT_H
-#define _ASM_SIGCONTEXT_H
-
-/*
- * Keep this struct definition in sync with the sigcontext fragment
- * in arch/mips/tools/offset.c
- */
-struct sigcontext {
-	unsigned int       sc_regmask;		/* Unused */
-	unsigned int       sc_status;
-	unsigned long long sc_pc;
-	unsigned long long sc_regs[32];
-	unsigned long long sc_fpregs[32];
-	unsigned int       sc_ownedfp;		/* Unused */
-	unsigned int       sc_fpc_csr;
-	unsigned int       sc_fpc_eir;		/* Unused */
-	unsigned int       sc_used_math;
-	unsigned int       sc_ssflags;		/* Unused */
-	unsigned long long sc_mdhi;
-	unsigned long long sc_mdlo;
-
-	unsigned int       sc_cause;		/* Unused */
-	unsigned int       sc_badvaddr;		/* Unused */
-
-	unsigned long      sc_sigset[4];	/* kernel's sigset_t */
-};
-
-#endif /* _ASM_SIGCONTEXT_H */
-#else /* _MIPS_SIM != _ABIO32 */
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1996, 1997, 1999 by Ralf Baechle
- * Copyright (C) 1999 Silicon Graphics, Inc.
- */
-#ifndef _ASM_SIGCONTEXT_H
-#define _ASM_SIGCONTEXT_H
-
-/*
- * Keep this struct definition in sync with the sigcontext fragment
- * in arch/mips/tools/offset.c
- */
-struct sigcontext {
-	unsigned long long sc_regs[32];
-	unsigned long long sc_fpregs[32];
-	unsigned long long sc_mdhi;
-	unsigned long long sc_mdlo;
-	unsigned long long sc_pc;
-	unsigned int       sc_status;
-	unsigned int       sc_fpc_csr;
-	unsigned int       sc_fpc_eir;
-	unsigned int       sc_used_math;
-	unsigned int       sc_cause;
-	unsigned int       sc_badvaddr;
-};
-
-#endif /* _ASM_SIGCONTEXT_H */
-#endif /* _MIPS_SIM != _ABIO32 */
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/siginfo.h b/sysdeps/unix/sysv/linux/mips/bits/siginfo.h
deleted file mode 100644
index 54eba41d6e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/siginfo.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/* siginfo_t, sigevent and constants.  Linux/MIPS version.
-   Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#if !defined _SIGNAL_H && !defined __need_siginfo_t \
-    && !defined __need_sigevent_t
-# error "Never include this file directly.  Use <signal.h> instead"
-#endif
-
-#include <bits/wordsize.h>
-
-#if (!defined __have_sigval_t \
-     && (defined _SIGNAL_H || defined __need_siginfo_t \
-	 || defined __need_sigevent_t))
-# define __have_sigval_t	1
-
-/* Type for data associated with a signal.  */
-typedef union sigval
-  {
-    int sival_int;
-    void *sival_ptr;
-  } sigval_t;
-#endif
-
-#if (!defined __have_siginfo_t \
-     && (defined _SIGNAL_H || defined __need_siginfo_t))
-# define __have_siginfo_t	1
-
-# define __SI_MAX_SIZE		128
-# if __WORDSIZE == 64
-#  define __SI_PAD_SIZE		((__SI_MAX_SIZE / sizeof (int)) - 4)
-# else
-#  define __SI_PAD_SIZE		((__SI_MAX_SIZE / sizeof (int)) - 3)
-# endif
-
-
-typedef struct siginfo
-  {
-    int si_signo;		/* Signal number.  */
-    int si_code;		/* Signal code.  */
-    int si_errno;		/* If non-zero, an errno value associated with
-				   this signal, as defined in <errno.h>.  */
-    int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3];
-				/* Explicit padding.  */
-
-    union
-      {
-	int _pad[__SI_PAD_SIZE];
-
-	 /* kill().  */
-	struct
-	  {
-	    __pid_t si_pid;	/* Sending process ID.  */
-	    __uid_t si_uid;	/* Real user ID of sending process.  */
-	  } _kill;
-
-	/* SIGCHLD.  */
-	struct
-	  {
-	    __pid_t si_pid;	/* Which child.  */
-	    __uid_t si_uid;	/* Real user ID of sending process.  */
-	    int si_status;	/* Exit value or signal.  */
-	    __clock_t si_utime;
-	    __clock_t si_stime;
-	  } _sigchld;
-
-	/* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
-	struct
-	  {
-	    void *si_addr;	/* Faulting insn/memory ref.  */
-	  } _sigfault;
-
-	/* SIGPOLL.  */
-	struct
-	  {
-	    int si_band;	/* Band event for SIGPOLL.  */
-	    int si_fd;
-	  } _sigpoll;
-
-	/* POSIX.1b timers.  */
-	struct
-	  {
-	    unsigned int _timer1;
-	    unsigned int _timer2;
-	  } _timer;
-
-	/* POSIX.1b signals.  */
-	struct
-	  {
-	    __pid_t si_pid;	/* Sending process ID.  */
-	    __uid_t si_uid;	/* Real user ID of sending process.  */
-	    sigval_t si_sigval;	/* Signal value.  */
-	  } _rt;
-      } _sifields;
-  } siginfo_t;
-
-
-/* X/Open requires some more fields with fixed names.  */
-# define si_pid		_sifields._kill.si_pid
-# define si_uid		_sifields._kill.si_uid
-# define si_status	_sifields._sigchld.si_status
-# define si_utime	_sifields._sigchld.si_utime
-# define si_stime	_sifields._sigchld.si_stime
-# define si_value	_sifields._rt.si_sigval
-# define si_int		_sifields._rt.si_sigval.sival_int
-# define si_ptr		_sifields._rt.si_sigval.sival_ptr
-# define si_addr	_sifields._sigfault.si_addr
-# define si_band	_sifields._sigpoll.si_band
-# define si_fd		_sifields._sigpoll.si_fd
-
-
-/* Values for `si_code'.  Positive values are reserved for kernel-generated
-   signals.  */
-enum
-{
-  SI_ASYNCNL = -60,		/* Sent by asynch name lookup completion.  */
-# define SI_ASYNCNL	SI_ASYNCNL
-  SI_TKILL = -6,		/* Sent by tkill.  */
-# define SI_TKILL	SI_TKILL
-  SI_SIGIO,			/* Sent by queued SIGIO.  */
-# define SI_SIGIO	SI_SIGIO
-  SI_MESGQ,			/* Sent by real time mesq state change.  */
-# define SI_MESGQ	SI_MESGQ
-  SI_TIMER,			/* Sent by real time mesq state change.  */
-# define SI_TIMER	SI_TIMER
-  SI_ASYNCIO,			/* Sent by AIO completion.  */
-# define SI_ASYNCIO	SI_ASYNCIO
-  SI_QUEUE,			/* Sent by sigqueue.  */
-# define SI_QUEUE	SI_QUEUE
-  SI_USER,			/* Sent by kill, sigsend, raise.  */
-# define SI_USER	SI_USER
-  SI_KERNEL = 0x80		/* Send by kernel.  */
-#define SI_KERNEL	SI_KERNEL
-};
-
-
-/* `si_code' values for SIGILL signal.  */
-enum
-{
-  ILL_ILLOPC = 1,		/* Illegal opcode.  */
-# define ILL_ILLOPC	ILL_ILLOPC
-  ILL_ILLOPN,			/* Illegal operand.  */
-# define ILL_ILLOPN	ILL_ILLOPN
-  ILL_ILLADR,			/* Illegal addressing mode.  */
-# define ILL_ILLADR	ILL_ILLADR
-  ILL_ILLTRP,			/* Illegal trap.  */
-# define ILL_ILLTRP	ILL_ILLTRP
-  ILL_PRVOPC,			/* Privileged opcode.  */
-# define ILL_PRVOPC	ILL_PRVOPC
-  ILL_PRVREG,			/* Privileged register.  */
-# define ILL_PRVREG	ILL_PRVREG
-  ILL_COPROC,			/* Coprocessor error.  */
-# define ILL_COPROC	ILL_COPROC
-  ILL_BADSTK			/* Internal stack error.  */
-# define ILL_BADSTK	ILL_BADSTK
-};
-
-/* `si_code' values for SIGFPE signal.  */
-enum
-{
-  FPE_INTDIV = 1,		/* Integer divide by zero.  */
-# define FPE_INTDIV	FPE_INTDIV
-  FPE_INTOVF,			/* Integer overflow.  */
-# define FPE_INTOVF	FPE_INTOVF
-  FPE_FLTDIV,			/* Floating point divide by zero.  */
-# define FPE_FLTDIV	FPE_FLTDIV
-  FPE_FLTOVF,			/* Floating point overflow.  */
-# define FPE_FLTOVF	FPE_FLTOVF
-  FPE_FLTUND,			/* Floating point underflow.  */
-# define FPE_FLTUND	FPE_FLTUND
-  FPE_FLTRES,			/* Floating point inexact result.  */
-# define FPE_FLTRES	FPE_FLTRES
-  FPE_FLTINV,			/* Floating point invalid operation.  */
-# define FPE_FLTINV	FPE_FLTINV
-  FPE_FLTSUB			/* Subscript out of range.  */
-# define FPE_FLTSUB	FPE_FLTSUB
-};
-
-/* `si_code' values for SIGSEGV signal.  */
-enum
-{
-  SEGV_MAPERR = 1,		/* Address not mapped to object.  */
-# define SEGV_MAPERR	SEGV_MAPERR
-  SEGV_ACCERR			/* Invalid permissions for mapped object.  */
-# define SEGV_ACCERR	SEGV_ACCERR
-};
-
-/* `si_code' values for SIGBUS signal.  */
-enum
-{
-  BUS_ADRALN = 1,		/* Invalid address alignment.  */
-# define BUS_ADRALN	BUS_ADRALN
-  BUS_ADRERR,			/* Non-existant physical address.  */
-# define BUS_ADRERR	BUS_ADRERR
-  BUS_OBJERR			/* Object specific hardware error.  */
-# define BUS_OBJERR	BUS_OBJERR
-};
-
-/* `si_code' values for SIGTRAP signal.  */
-enum
-{
-  TRAP_BRKPT = 1,		/* Process breakpoint.  */
-# define TRAP_BRKPT	TRAP_BRKPT
-  TRAP_TRACE			/* Process trace trap.  */
-# define TRAP_TRACE	TRAP_TRACE
-};
-
-/* `si_code' values for SIGCHLD signal.  */
-enum
-{
-  CLD_EXITED = 1,		/* Child has exited.  */
-# define CLD_EXITED	CLD_EXITED
-  CLD_KILLED,			/* Child was killed.  */
-# define CLD_KILLED	CLD_KILLED
-  CLD_DUMPED,			/* Child terminated abnormally.  */
-# define CLD_DUMPED	CLD_DUMPED
-  CLD_TRAPPED,			/* Traced child has trapped.  */
-# define CLD_TRAPPED	CLD_TRAPPED
-  CLD_STOPPED,			/* Child has stopped.  */
-# define CLD_STOPPED	CLD_STOPPED
-  CLD_CONTINUED			/* Stopped child has continued.  */
-# define CLD_CONTINUED	CLD_CONTINUED
-};
-
-/* `si_code' values for SIGPOLL signal.  */
-enum
-{
-  POLL_IN = 1,			/* Data input available.  */
-# define POLL_IN	POLL_IN
-  POLL_OUT,			/* Output buffers available.  */
-# define POLL_OUT	POLL_OUT
-  POLL_MSG,			/* Input message available.   */
-# define POLL_MSG	POLL_MSG
-  POLL_ERR,			/* I/O error.  */
-# define POLL_ERR	POLL_ERR
-  POLL_PRI,			/* High priority input available.  */
-# define POLL_PRI	POLL_PRI
-  POLL_HUP			/* Device disconnected.  */
-# define POLL_HUP	POLL_HUP
-};
-
-# undef __need_siginfo_t
-#endif	/* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
-
-
-#if (defined _SIGNAL_H || defined __need_sigevent_t) \
-    && !defined __have_sigevent_t
-# define __have_sigevent_t	1
-
-/* Structure to transport application-defined values with signals.  */
-# define __SIGEV_MAX_SIZE	64
-# define __SIGEV_PAD_SIZE	((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
-
-/* Forward declaration of the `pthread_attr_t' type.  */
-struct __pthread_attr_s;
-
-/* XXX This one might need to change!!!  */
-typedef struct sigevent
-  {
-    sigval_t sigev_value;
-    int sigev_signo;
-    int sigev_notify;
-
-    union
-      {
-	int _pad[__SIGEV_PAD_SIZE];
-
-	struct
-	  {
-	    void (*_function) (sigval_t);	/* Function to start.  */
-	    void *_attribute;			/* Really pthread_attr_t.  */
-	  } _sigev_thread;
-      } _sigev_un;
-  } sigevent_t;
-
-/* POSIX names to access some of the members.  */
-# define sigev_notify_function   _sigev_un._sigev_thread._function
-# define sigev_notify_attributes _sigev_un._sigev_thread._attribute
-
-/* `sigev_notify' values.  */
-enum
-{
-  SIGEV_SIGNAL = 0,		/* Notify via signal.  */
-# define SIGEV_SIGNAL	SIGEV_SIGNAL
-  SIGEV_NONE,			/* Other notification: meaningless.  */
-# define SIGEV_NONE	SIGEV_NONE
-  SIGEV_CALLBACK,		/* Deliver via thread creation.  */
-# define SIGEV_CALLBACK	SIGEV_CALLBACK
-  SIGEV_THREAD			/* Deliver via thread creation.  */
-# define SIGEV_THREAD	SIGEV_THREAD
-};
-
-#endif	/* have _SIGNAL_H.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/signum.h b/sysdeps/unix/sysv/linux/mips/bits/signum.h
deleted file mode 100644
index a9b6848346..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/signum.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Signal number definitions.  Linux version.
-   Copyright (C) 1995, 1997, 1998 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifdef	_SIGNAL_H
-
-/* Fake signal functions.  */
-#define SIG_ERR ((__sighandler_t) -1)		/* Error return.  */
-#define SIG_DFL ((__sighandler_t) 0)		/* Default action.  */
-#define SIG_IGN ((__sighandler_t) 1)		/* Ignore signal.  */
-
-#ifdef __USE_UNIX98
-# define SIG_HOLD	((__sighandler_t) 2)	/* Add signal to hold mask.  */
-#endif
-
-
-#define SIGHUP		 1	/* Hangup (POSIX).  */
-#define SIGINT		 2	/* Interrupt (ANSI).  */
-#define SIGQUIT		 3	/* Quit (POSIX).  */
-#define SIGILL		 4	/* Illegal instruction (ANSI).  */
-#define SIGTRAP		 5	/* Trace trap (POSIX).  */
-#define SIGIOT		 6	/* IOT trap (4.2 BSD).  */
-#define SIGABRT		 SIGIOT	/* Abort (ANSI).  */
-#define SIGEMT		 7
-#define SIGFPE		 8	/* Floating-point exception (ANSI).  */
-#define SIGKILL		 9	/* Kill, unblockable (POSIX).  */
-#define SIGBUS		10	/* BUS error (4.2 BSD).  */
-#define SIGSEGV		11	/* Segmentation violation (ANSI).  */
-#define SIGSYS		12
-#define SIGPIPE		13	/* Broken pipe (POSIX).  */
-#define SIGALRM		14	/* Alarm clock (POSIX).  */
-#define SIGTERM		15	/* Termination (ANSI).  */
-#define SIGUSR1		16	/* User-defined signal 1 (POSIX).  */
-#define SIGUSR2		17	/* User-defined signal 2 (POSIX).  */
-#define SIGCHLD		18	/* Child status has changed (POSIX).  */
-#define SIGCLD		SIGCHLD	/* Same as SIGCHLD (System V).  */
-#define SIGPWR		19	/* Power failure restart (System V).  */
-#define SIGWINCH	20	/* Window size change (4.3 BSD, Sun).  */
-#define SIGURG		21	/* Urgent condition on socket (4.2 BSD).  */
-#define SIGIO		22	/* I/O now possible (4.2 BSD).  */
-#define SIGPOLL		SIGIO	/* Pollable event occurred (System V).  */
-#define SIGSTOP		23	/* Stop, unblockable (POSIX).  */
-#define SIGTSTP		24	/* Keyboard stop (POSIX).  */
-#define SIGCONT		25	/* Continue (POSIX).  */
-#define SIGTTIN		26	/* Background read from tty (POSIX).  */
-#define SIGTTOU		27	/* Background write to tty (POSIX).  */
-#define SIGVTALRM	28	/* Virtual alarm clock (4.2 BSD).  */
-#define SIGPROF		29	/* Profiling alarm clock (4.2 BSD).  */
-#define SIGXCPU		30	/* CPU limit exceeded (4.2 BSD).  */
-#define SIGXFSZ		31	/* File size limit exceeded (4.2 BSD).  */
-
-
-#define _NSIG		128	/* Biggest signal number + 1
-				   (including real-time signals).  */
-
-#define SIGRTMIN	(__libc_current_sigrtmin ())
-#define SIGRTMAX	(__libc_current_sigrtmax ())
-
-/* These are the hard limits of the kernel.  These values should not be
-   used directly at user level.  */
-#define __SIGRTMIN	32
-#define __SIGRTMAX	(_NSIG - 1)
-
-#endif	/* <signal.h> included.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/sigstack.h b/sysdeps/unix/sysv/linux/mips/bits/sigstack.h
deleted file mode 100644
index d2c8552209..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/sigstack.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* sigstack, sigaltstack definitions.
-   Copyright (C) 1998, 1999, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SIGNAL_H
-# error "Never include this file directly.  Use <signal.h> instead"
-#endif
-
-
-/* Structure describing a signal stack (obsolete).  */
-struct sigstack
-  {
-    void *ss_sp;		/* Signal stack pointer.  */
-    int ss_onstack;		/* Nonzero if executing on this stack.  */
-  };
-
-
-/* Possible values for `ss_flags.'.  */
-enum
-{
-  SS_ONSTACK = 1,
-#define SS_ONSTACK	SS_ONSTACK
-  SS_DISABLE
-#define SS_DISABLE	SS_DISABLE
-};
-
-/* Minimum stack size for a signal handler.  */
-#define MINSIGSTKSZ	2048
-
-/* System default stack size.  */
-#define SIGSTKSZ	8192
-
-
-/* Alternate, preferred interface.  */
-typedef struct sigaltstack
-  {
-    void *ss_sp;
-    size_t ss_size;
-    int ss_flags;
-  } stack_t;
diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h
deleted file mode 100644
index 1dd82eb866..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/socket.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/* System-specific socket constants and types.  Linux/MIPS version.
-   Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef __BITS_SOCKET_H
-#define __BITS_SOCKET_H
-
-#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
-# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
-#endif
-
-#define	__need_size_t
-#define __need_NULL
-#include <stddef.h>
-
-#include <limits.h>
-#include <sys/types.h>
-
-/* Type for length arguments in socket calls.  */
-#ifndef __socklen_t_defined
-typedef __socklen_t socklen_t;
-# define __socklen_t_defined
-#endif
-
-/* Types of sockets.  */
-enum __socket_type
-{
-  SOCK_DGRAM = 1,		/* Connectionless, unreliable datagrams
-				   of fixed maximum length.  */
-#define SOCK_DGRAM SOCK_DGRAM
-  SOCK_STREAM = 2,		/* Sequenced, reliable, connection-based
-				   byte streams.  */
-#define SOCK_STREAM SOCK_STREAM
-  SOCK_RAW = 3,			/* Raw protocol interface.  */
-#define SOCK_RAW SOCK_RAW
-  SOCK_RDM = 4,			/* Reliably-delivered messages.  */
-#define SOCK_RDM SOCK_RDM
-  SOCK_SEQPACKET = 5,		/* Sequenced, reliable, connection-based,
-				   datagrams of fixed maximum length.  */
-#define SOCK_SEQPACKET SOCK_SEQPACKET
-  SOCK_PACKET = 10		/* Linux specific way of getting packets
-				   at the dev level.  For writing rarp and
-				   other similar things on the user level. */
-#define SOCK_PACKET SOCK_PACKET
-};
-
-/* Protocol families.  */
-#define	PF_UNSPEC	0	/* Unspecified.  */
-#define	PF_LOCAL	1	/* Local to host (pipes and file-domain).  */
-#define	PF_UNIX		PF_LOCAL /* Old BSD name for PF_LOCAL.  */
-#define	PF_FILE		PF_LOCAL /* Another non-standard name for PF_LOCAL.  */
-#define	PF_INET		2	/* IP protocol family.  */
-#define	PF_AX25		3	/* Amateur Radio AX.25.  */
-#define	PF_IPX		4	/* Novell Internet Protocol.  */
-#define	PF_APPLETALK	5	/* Appletalk DDP.  */
-#define	PF_NETROM	6	/* Amateur radio NetROM.  */
-#define	PF_BRIDGE	7	/* Multiprotocol bridge.  */
-#define	PF_ATMPVC	8	/* ATM PVCs.  */
-#define	PF_X25		9	/* Reserved for X.25 project.  */
-#define	PF_INET6	10	/* IP version 6.  */
-#define	PF_ROSE		11	/* Amateur Radio X.25 PLP.  */
-#define	PF_DECnet	12	/* Reserved for DECnet project.  */
-#define	PF_NETBEUI	13	/* Reserved for 802.2LLC project.  */
-#define	PF_SECURITY	14	/* Security callback pseudo AF.  */
-#define	PF_KEY		15	/* PF_KEY key management API.  */
-#define	PF_NETLINK	16
-#define	PF_ROUTE	PF_NETLINK /* Alias to emulate 4.4BSD.  */
-#define	PF_PACKET	17	/* Packet family.  */
-#define	PF_ASH		18	/* Ash.  */
-#define	PF_ECONET	19	/* Acorn Econet.  */
-#define	PF_ATMSVC	20	/* ATM SVCs.  */
-#define	PF_SNA		22	/* Linux SNA Project */
-#define	PF_IRDA		23	/* IRDA sockets.  */
-#define	PF_PPPOX	24	/* PPPoX sockets.  */
-#define	PF_WANPIPE	25	/* Wanpipe API sockets.  */
-#define	PF_BLUETOOTH	31	/* Bluetooth sockets.  */
-#define	PF_MAX		32	/* For now..  */
-
-/* Address families.  */
-#define	AF_UNSPEC	PF_UNSPEC
-#define	AF_LOCAL	PF_LOCAL
-#define	AF_UNIX		PF_UNIX
-#define	AF_FILE		PF_FILE
-#define	AF_INET		PF_INET
-#define	AF_AX25		PF_AX25
-#define	AF_IPX		PF_IPX
-#define	AF_APPLETALK	PF_APPLETALK
-#define	AF_NETROM	PF_NETROM
-#define	AF_BRIDGE	PF_BRIDGE
-#define	AF_ATMPVC	PF_ATMPVC
-#define	AF_X25		PF_X25
-#define	AF_INET6	PF_INET6
-#define	AF_ROSE		PF_ROSE
-#define	AF_DECnet	PF_DECnet
-#define	AF_NETBEUI	PF_NETBEUI
-#define	AF_SECURITY	PF_SECURITY
-#define	AF_KEY		PF_KEY
-#define	AF_NETLINK	PF_NETLINK
-#define	AF_ROUTE	PF_ROUTE
-#define	AF_PACKET	PF_PACKET
-#define	AF_ASH		PF_ASH
-#define	AF_ECONET	PF_ECONET
-#define	AF_ATMSVC	PF_ATMSVC
-#define	AF_SNA		PF_SNA
-#define	AF_IRDA		PF_IRDA
-#define	AF_PPPOX	PF_PPPOX
-#define	AF_WANPIPE	PF_WANPIPE
-#define	AF_BLUETOOTH	PF_BLUETOOTH
-#define	AF_MAX		PF_MAX
-
-/* Socket level values.  Others are defined in the appropriate headers.
-
-   XXX These definitions also should go into the appropriate headers as
-   far as they are available.  */
-#define SOL_RAW		255
-#define SOL_DECNET      261
-#define SOL_X25         262
-#define SOL_PACKET	263
-#define SOL_ATM		264	/* ATM layer (cell level).  */
-#define SOL_AAL		265	/* ATM Adaption Layer (packet level).  */
-#define SOL_IRDA	266
-
-/* Maximum queue length specifiable by listen.  */
-#define SOMAXCONN	128
-
-/* Get the definition of the macro to define the common sockaddr members.  */
-#include <bits/sockaddr.h>
-
-/* Structure describing a generic socket address.  */
-struct sockaddr
-  {
-    __SOCKADDR_COMMON (sa_);	/* Common data: address family and length.  */
-    char sa_data[14];		/* Address data.  */
-  };
-
-
-/* Structure large enough to hold any socket address (with the historical
-   exception of AF_UNIX).  We reserve 128 bytes.  */
-#if ULONG_MAX > 0xffffffff
-# define __ss_aligntype	__uint64_t
-#else
-# define __ss_aligntype	__uint32_t
-#endif
-#define _SS_SIZE	128
-#define _SS_PADSIZE	(_SS_SIZE - (2 * sizeof (__ss_aligntype)))
-
-struct sockaddr_storage
-  {
-    __SOCKADDR_COMMON (ss_);	/* Address family, etc.  */
-    __ss_aligntype __ss_align;	/* Force desired alignment.  */
-    char __ss_padding[_SS_PADSIZE];
-  };
-
-
-/* Bits in the FLAGS argument to `send', `recv', et al.  */
-enum
-  {
-    MSG_OOB		= 0x01,	/* Process out-of-band data.  */
-#define MSG_OOB		MSG_OOB
-    MSG_PEEK		= 0x02,	/* Peek at incoming messages.  */
-#define MSG_PEEK	MSG_PEEK
-    MSG_DONTROUTE	= 0x04,	/* Don't use local routing.  */
-#define MSG_DONTROUTE	MSG_DONTROUTE
-#ifdef __USE_GNU
-    /* DECnet uses a different name.  */
-    MSG_TRYHARD		= MSG_DONTROUTE,
-# define MSG_TRYHARD	MSG_DONTROUTE
-#endif
-    MSG_CTRUNC		= 0x08,	/* Control data lost before delivery.  */
-#define MSG_CTRUNC	MSG_CTRUNC
-    MSG_PROXY		= 0x10,	/* Supply or ask second address.  */
-#define MSG_PROXY	MSG_PROXY
-    MSG_TRUNC		= 0x20,
-#define	MSG_TRUNC	MSG_TRUNC
-    MSG_DONTWAIT	= 0x40, /* Nonblocking IO.  */
-#define	MSG_DONTWAIT	MSG_DONTWAIT
-    MSG_EOR		= 0x80, /* End of record.  */
-#define	MSG_EOR		MSG_EOR
-    MSG_WAITALL		= 0x100, /* Wait for a full request.  */
-#define	MSG_WAITALL	MSG_WAITALL
-    MSG_FIN		= 0x200,
-#define	MSG_FIN		MSG_FIN
-    MSG_SYN		= 0x400,
-#define	MSG_SYN		MSG_SYN
-    MSG_CONFIRM		= 0x800, /* Confirm path validity.  */
-#define	MSG_CONFIRM	MSG_CONFIRM
-    MSG_RST		= 0x1000,
-#define	MSG_RST		MSG_RST
-    MSG_ERRQUEUE	= 0x2000, /* Fetch message from error queue.  */
-#define	MSG_ERRQUEUE	MSG_ERRQUEUE
-    MSG_NOSIGNAL	= 0x4000, /* Do not generate SIGPIPE.  */
-#define	MSG_NOSIGNAL	MSG_NOSIGNAL
-    MSG_MORE		= 0x8000  /* Sender will send more.  */
-#define	MSG_MORE	MSG_MORE
-  };
-
-
-/* Structure describing messages sent by
-   `sendmsg' and received by `recvmsg'.  */
-struct msghdr
-  {
-    void *msg_name;		/* Address to send to/receive from.  */
-    socklen_t msg_namelen;	/* Length of address data.  */
-
-    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
-    int msg_iovlen;		/* Number of elements in the vector.  */
-
-    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
-    socklen_t msg_controllen;	/* Ancillary data buffer length.  */
-
-    int msg_flags;		/* Flags on received message.  */
-  };
-
-/* Structure used for storage of ancillary data object information.  */
-struct cmsghdr
-  {
-    size_t cmsg_len;		/* Length of data in cmsg_data plus length
-				   of cmsghdr structure.  */
-    int cmsg_level;		/* Originating protocol.  */
-    int cmsg_type;		/* Protocol specific type.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
-    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
-#endif
-  };
-
-/* Ancillary data object manipulation macros.  */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
-# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
-#else
-# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
-#endif
-#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
-#define CMSG_FIRSTHDR(mhdr) \
-  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)		      \
-   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
-#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
-			 & (size_t) ~(sizeof (size_t) - 1))
-#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
-			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
-#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
-
-extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
-				      struct cmsghdr *__cmsg) __THROW;
-#ifdef __USE_EXTERN_INLINES
-# ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
-# endif
-_EXTERN_INLINE struct cmsghdr *
-__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
-{
-  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
-    /* The kernel header does this so there may be a reason.  */
-    return 0;
-
-  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
-			       + CMSG_ALIGN (__cmsg->cmsg_len));
-  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
-					 + __mhdr->msg_controllen)
-      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
-	  > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
-    /* No more entries.  */
-    return 0;
-  return __cmsg;
-}
-#endif	/* Use `extern inline'.  */
-
-/* Socket level message types.  This must match the definitions in
-   <linux/socket.h>.  */
-enum
-  {
-    SCM_RIGHTS = 0x01,		/* Transfer file descriptors.  */
-#define SCM_RIGHTS SCM_RIGHTS
-#ifdef __USE_BSD
-    SCM_CREDENTIALS = 0x02,     /* Credentials passing.  */
-# define SCM_CREDENTIALS SCM_CREDENTIALS
-#endif
-    __SCM_CONNECT = 0x03	/* Data array is `struct scm_connect'.  */
-  };
-
-/* User visible structure for SCM_CREDENTIALS message */
-
-struct ucred
-{
-  pid_t pid;			/* PID of sending process.  */
-  uid_t uid;			/* UID of sending process.  */
-  gid_t gid;			/* GID of sending process.  */
-};
-
-/* Get socket manipulation related informations from kernel headers.  */
-#include <asm/socket.h>
-
-
-/* Structure used to manipulate the SO_LINGER option.  */
-struct linger
-  {
-    int l_onoff;		/* Nonzero to linger on close.  */
-    int l_linger;		/* Time to linger.  */
-  };
-
-#endif	/* bits/socket.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/stat.h b/sysdeps/unix/sysv/linux/mips/bits/stat.h
deleted file mode 100644
index 9ae38cd8d0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/stat.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STAT_H
-# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
-#endif
-
-#include <sgidefs.h>
-
-/* Versions of the `struct stat' data structure.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX /* The one defined below.  */
-
-/* Versions of the `xmknod' interface.  */
-#define _MKNOD_VER_LINUX	1
-#define _MKNOD_VER_SVR4		2
-#define _MKNOD_VER		_MKNOD_VER_LINUX /* The bits defined below.  */
-
-
-#if _MIPS_SIM == _ABIO32
-/* Structure describing file characteristics.  */
-struct stat
-  {
-    unsigned long int st_dev;
-    long int st_pad1[3];
-#ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;		/* File serial number.		*/
-#else
-    __ino64_t st_ino;		/* File serial number.		*/
-#endif
-    __mode_t st_mode;		/* File mode.  */
-    __nlink_t st_nlink;		/* Link count.  */
-    __uid_t st_uid;		/* User ID of the file's owner.	*/
-    __gid_t st_gid;		/* Group ID of the file's group.*/
-    unsigned long int st_rdev;	/* Device number, if device.  */
-#ifndef __USE_FILE_OFFSET64
-    long int st_pad2[2];
-    __off_t st_size;		/* Size of file, in bytes.  */
-    /* SVR4 added this extra long to allow for expansion of off_t.  */
-    long int st_pad3;
-#else
-    long int st_pad2[3];
-    __off64_t st_size;		/* Size of file, in bytes.  */
-#endif
-    /*
-     * Actually this should be timestruc_t st_atime, st_mtime and
-     * st_ctime but we don't have it under Linux.
-     */
-    __time_t st_atime;		/* Time of last access.  */
-    long int __reserved0;
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;
-    __time_t st_ctime;		/* Time of last status change.  */
-    long int __reserved2;
-    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
-#ifndef __USE_FILE_OFFSET64
-    __blkcnt_t st_blocks;	/* Number of 512-byte blocks allocated.  */
-#else
-    long int st_pad4;
-    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
-#endif
-    long int st_pad5[14];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-  {
-    unsigned long int st_dev;
-    long int st_pad1[3];
-    __ino64_t st_ino;		/* File serial number.		*/
-    __mode_t st_mode;		/* File mode.  */
-    __nlink_t st_nlink;		/* Link count.  */
-    __uid_t st_uid;		/* User ID of the file's owner.	*/
-    __gid_t st_gid;		/* Group ID of the file's group.*/
-    unsigned long int st_rdev;	/* Device number, if device.  */
-    long int st_pad2[3];
-    __off64_t st_size;		/* Size of file, in bytes.  */
-    /*
-     * Actually this should be timestruc_t st_atime, st_mtime and
-     * st_ctime but we don't have it under Linux.
-     */
-    __time_t st_atime;		/* Time of last access.  */
-    long int __reserved0;
-    __time_t st_mtime;		/* Time of last modification.  */
-    long int __reserved1;
-    __time_t st_ctime;		/* Time of last status change.  */
-    long int __reserved2;
-    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
-    long int st_pad3;
-    __blkcnt64_t st_blocks;	/* Number of 512-byte blocks allocated.  */
-    long int st_pad4[14];
-  };
-#endif
-#else
-struct stat
-  {
-    __dev_t st_dev;
-    int	st_pad1[3];		/* Reserved for st_dev expansion  */
-#ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;
-#else
-    __ino64_t st_ino;
-#endif
-    __mode_t st_mode;
-    __nlink_t st_nlink;
-    __uid_t st_uid;
-    __gid_t st_gid;
-    __dev_t st_rdev;
-#if !defined __USE_FILE_OFFSET64
-    unsigned int st_pad2[2];	/* Reserved for st_rdev expansion  */
-    __off_t st_size;
-    int st_pad3;
-#else
-    unsigned int st_pad2[3];	/* Reserved for st_rdev expansion  */
-    __off64_t st_size;
-#endif
-    __time_t st_atime;
-    int __reserved0;
-    __time_t st_mtime;
-    int __reserved1;
-    __time_t st_ctime;
-    int __reserved2;
-    __blksize_t st_blksize;
-    unsigned int st_pad4;
-#ifndef __USE_FILE_OFFSET64
-    __blkcnt_t st_blocks;
-#else
-    __blkcnt64_t st_blocks;
-#endif
-    int st_pad5[14];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct stat64
-  {
-    __dev_t st_dev;
-    unsigned int st_pad1[3];	/* Reserved for st_dev expansion  */
-    __ino64_t st_ino;
-    __mode_t st_mode;
-    __nlink_t st_nlink;
-    __uid_t st_uid;
-    __gid_t st_gid;
-    __dev_t st_rdev;
-    unsigned int st_pad2[3];	/* Reserved for st_rdev expansion  */
-    __off64_t st_size;
-    __time_t st_atime;
-    int __reserved0;
-    __time_t st_mtime;
-    int __reserved1;
-    __time_t st_ctime;
-    int __reserved2;
-    __blksize_t st_blksize;
-    unsigned int st_pad3;
-    __blkcnt64_t st_blocks;
-    int st_pad4[14];
-};
-#endif
-#endif
-
-/* Tell code we have these members.  */
-#define	_STATBUF_ST_BLKSIZE
-#define	_STATBUF_ST_RDEV
-
-/* Encoding of the file mode.  */
-
-#define	__S_IFMT	0170000	/* These bits determine file type.  */
-
-/* File types.  */
-#define	__S_IFDIR	0040000	/* Directory.  */
-#define	__S_IFCHR	0020000	/* Character device.  */
-#define	__S_IFBLK	0060000	/* Block device.  */
-#define	__S_IFREG	0100000	/* Regular file.  */
-#define	__S_IFIFO	0010000	/* FIFO.  */
-#define	__S_IFLNK	0120000	/* Symbolic link.  */
-#define	__S_IFSOCK	0140000	/* Socket.  */
-
-/* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
-   they do it by enforcing the correct use of the macros.  */
-#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
-#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
-
-/* Protection bits.  */
-
-#define	__S_ISUID	04000	/* Set user ID on execution.  */
-#define	__S_ISGID	02000	/* Set group ID on execution.  */
-#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
-#define	__S_IREAD	0400	/* Read by owner.  */
-#define	__S_IWRITE	0200	/* Write by owner.  */
-#define	__S_IEXEC	0100	/* Execute by owner.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/statfs.h b/sysdeps/unix/sysv/linux/mips/bits/statfs.h
deleted file mode 100644
index 2f9bd54edc..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/statfs.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_STATFS_H
-# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
-#endif
-
-#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t*/
-
-struct statfs
-  {
-    long int f_type;
-#define f_fstyp f_type
-    long int f_bsize;
-    long int f_frsize;	/* Fragment size - unsupported */
-#ifndef __USE_FILE_OFFSET64
-    __fsblkcnt_t f_blocks;
-    __fsblkcnt_t f_bfree;
-    __fsblkcnt_t f_files;
-    __fsblkcnt_t f_ffree;
-    __fsblkcnt_t f_bavail;
-#else
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_files;
-    __fsblkcnt64_t f_ffree;
-    __fsblkcnt64_t f_bavail;
-#endif
-
-	/* Linux specials */
-    __fsid_t f_fsid;
-    long int f_namelen;
-    long int f_spare[6];
-  };
-
-#ifdef __USE_LARGEFILE64
-struct statfs64
-  {
-    long int f_type;
-#define f_fstyp f_type
-    long int f_bsize;
-    long int f_frsize;	/* Fragment size - unsupported */
-    __fsblkcnt64_t f_blocks;
-    __fsblkcnt64_t f_bfree;
-    __fsblkcnt64_t f_files;
-    __fsblkcnt64_t f_ffree;
-    __fsblkcnt64_t f_bavail;
-
-	/* Linux specials */
-    __fsid_t f_fsid;
-    long int f_namelen;
-    long int f_spare[6];
-  };
-#endif
-
-/* Tell code we have these members.  */
-#define _STATFS_F_NAMELEN
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
deleted file mode 100644
index 4ff6e37ad6..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* termios type and macro definitions.  Linux/MIPS version.
-   Copyright (C) 1993, 94, 95, 96, 97, 99 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-typedef unsigned char	cc_t;
-typedef unsigned int	speed_t;
-typedef unsigned int	tcflag_t;
-
-#define NCCS 32
-struct termios
-  {
-    tcflag_t c_iflag;		/* input mode flags */
-    tcflag_t c_oflag;		/* output mode flags */
-    tcflag_t c_cflag;		/* control mode flags */
-    tcflag_t c_lflag;		/* local mode flags */
-    cc_t c_line;		/* line discipline */
-    cc_t c_cc[NCCS];		/* control characters */
-  };
-
-/* c_cc characters */
-#define VINTR		0	/* Interrupt character [ISIG].  */
-#define VQUIT		1	/* Quit character [ISIG].  */
-#define VERASE		2	/* Erase character [ICANON].  */
-#define VKILL		3	/* Kill-line character [ICANON].  */
-#define VMIN		4	/* Minimum number of bytes read at once [!ICANON].  */
-#define VTIME		5	/* Time-out value (tenths of a second) [!ICANON].  */
-#define VEOL2		6	/* Second EOL character [ICANON].  */
-#define VSWTC		7
-#define VSWTCH		VSWTC
-#define VSTART		8	/* Start (X-ON) character [IXON, IXOFF].  */
-#define VSTOP		9	/* Stop (X-OFF) character [IXON, IXOFF].  */
-#define VSUSP		10	/* Suspend character [ISIG].  */
-				/* VDSUSP is not supported on Linux. */
-/* #define VDSUSP	11	/ * Delayed suspend character [ISIG].  */
-#define VREPRINT	12	/* Reprint-line character [ICANON].  */
-#define VDISCARD	13	/* Discard character [IEXTEN].  */
-#define VWERASE		14	/* Word-erase character [ICANON].  */
-#define VLNEXT		15	/* Literal-next character [IEXTEN].  */
-#define VEOF		16	/* End-of-file character [ICANON].  */
-#define VEOL		17	/* End-of-line character [ICANON].  */
-
-/* c_iflag bits */
-#define IGNBRK	0000001		/* Ignore break condition.  */
-#define BRKINT	0000002		/* Signal interrupt on break.  */
-#define IGNPAR	0000004		/* Ignore characters with parity errors.  */
-#define PARMRK	0000010		/* Mark parity and framing errors.  */
-#define INPCK	0000020		/* Enable input parity check.  */
-#define ISTRIP	0000040		/* Strip 8th bit off characters.  */
-#define INLCR	0000100		/* Map NL to CR on input.  */
-#define IGNCR	0000200		/* Ignore CR.  */
-#define ICRNL	0000400		/* Map CR to NL on input.  */
-#define IUCLC	0001000		/* Map upper case to lower case on input.  */
-#define IXON	0002000		/* Enable start/stop output control.  */
-#define IXANY	0004000		/* Any character will restart after stop.  */
-#define IXOFF	0010000		/* Enable start/stop input control.  */
-#define IMAXBEL 0020000		/* Ring bell when input queue is full.  */
-#define IUTF8	0040000		/* Input is UTF8.  */
-
-/* c_oflag bits */
-#define OPOST	0000001		/* Perform output processing.  */
-#define OLCUC	0000002		/* Map lower case to upper case on output.  */
-#define ONLCR	0000004		/* Map NL to CR-NL on output.  */
-#define OCRNL	0000010
-#define ONOCR	0000020
-#define ONLRET	0000040
-#define OFILL	0000100
-#define OFDEL	0000200
-#if defined __USE_MISC || defined __USE_XOPEN
-# define NLDLY	0000400
-# define   NL0	0000000
-# define   NL1	0000400
-# define CRDLY	0003000
-# define   CR0	0000000
-# define   CR1	0001000
-# define   CR2	0002000
-# define   CR3	0003000
-# define TABDLY	0014000
-# define   TAB0	0000000
-# define   TAB1	0004000
-# define   TAB2	0010000
-# define   TAB3	0014000
-# define BSDLY	0020000
-# define   BS0	0000000
-# define   BS1	0020000
-# define FFDLY	0100000
-# define   FF0	0000000
-# define   FF1	0100000
-#endif
-
-#define VTDLY	0040000
-#define   VT0	0000000
-#define   VT1	0040000
-
-#ifdef __USE_MISC
-# define XTABS  0014000
-#endif
-
-/* c_cflag bit meaning */
-#ifdef __USE_MISC
-# define CBAUD	0010017
-#endif
-#define  B0	0000000		/* hang up */
-#define  B50	0000001
-#define  B75	0000002
-#define  B110	0000003
-#define  B134	0000004
-#define  B150	0000005
-#define  B200	0000006
-#define  B300	0000007
-#define  B600	0000010
-#define  B1200	0000011
-#define  B1800	0000012
-#define  B2400	0000013
-#define  B4800	0000014
-#define  B9600	0000015
-#define  B19200	0000016
-#define  B38400	0000017
-#ifdef __USE_MISC
-# define EXTA B19200
-# define EXTB B38400
-#endif
-#define CSIZE	0000060		/* Number of bits per byte (mask).  */
-#define   CS5	0000000		/* 5 bits per byte.  */
-#define   CS6	0000020		/* 6 bits per byte.  */
-#define   CS7	0000040		/* 7 bits per byte.  */
-#define   CS8	0000060		/* 8 bits per byte.  */
-#define CSTOPB	0000100		/* Two stop bits instead of one.  */
-#define CREAD	0000200		/* Enable receiver.  */
-#define PARENB	0000400		/* Parity enable.  */
-#define PARODD	0001000		/* Odd parity instead of even.  */
-#define HUPCL	0002000		/* Hang up on last close.  */
-#define CLOCAL	0004000		/* Ignore modem status lines.  */
-#ifdef __USE_MISC
-# define CBAUDEX   0010000
-#endif
-#define  B57600   0010001
-#define  B115200  0010002
-#define  B230400  0010003
-#define  B460800  0010004
-#define  B500000  0010005
-#define  B576000  0010006
-#define  B921600  0010007
-#define  B1000000 0010010
-#define  B1152000 0010011
-#define  B1500000 0010012
-#define  B2000000 0010013
-#define  B2500000 0010014
-#define  B3000000 0010015
-#define  B3500000 0010016
-#define  B4000000 0010017
-#define __MAX_BAUD B4000000
-#ifdef __USE_MISC
-# define CIBAUD	  002003600000	/* input baud rate (not used) */
-# define CRTSCTS  020000000000		/* flow control */
-#endif
-
-/* c_lflag bits */
-#define ISIG	0000001		/* Enable signals.  */
-#define ICANON	0000002		/* Do erase and kill processing.  */
-#if defined __USE_MISC || defined __USE_XOPEN
-# define XCASE	0000004
-#endif
-#define ECHO	0000010		/* Enable echo.  */
-#define ECHOE	0000020		/* Visual erase for ERASE.  */
-#define ECHOK	0000040		/* Echo NL after KILL.  */
-#define ECHONL	0000100		/* Echo NL even if ECHO is off.  */
-#define NOFLSH	0000200		/* Disable flush after interrupt.  */
-#define IEXTEN	0000400		/* Enable DISCARD and LNEXT.  */
-#ifdef __USE_MISC
-# define ECHOCTL 0001000	/* Echo control characters as ^X.  */
-# define ECHOPRT 0002000	/* Hardcopy visual erase.  */
-# define ECHOKE	 0004000	/* Visual erase for KILL.  */
-# define FLUSHO	0020000
-# define PENDIN	0040000		/* Retype pending input (state).  */
-#endif
-#define TOSTOP	0100000		/* Send SIGTTOU for background output.  */
-#define ITOSTOP	TOSTOP
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-/* tcflow() and TCXONC use these */
-#define	TCOOFF		0	/* Suspend output.  */
-#define	TCOON		1	/* Restart suspended output.  */
-#define	TCIOFF		2	/* Send a STOP character.  */
-#define	TCION		3	/* Send a START character.  */
-
-/* tcflush() and TCFLSH use these */
-#define	TCIFLUSH	0	/* Discard data received but not yet read.  */
-#define	TCOFLUSH	1	/* Discard data written but not yet sent.  */
-#define	TCIOFLUSH	2	/* Discard all pending data.  */
-
-/* tcsetattr uses these */
-#define	TCSANOW		0x540e	/* Same as TCSETS; change immediately.  */
-#define	TCSADRAIN	0x540f	/* Same as TCSETSW; change when pending output is written.  */
-#define	TCSAFLUSH	0x5410	/* Same as TCSETSF; flush pending input before changing.  */
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/sysdeps/unix/sysv/linux/mips/brk.c b/sysdeps/unix/sysv/linux/mips/brk.c
deleted file mode 100644
index 4be88a9c5f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/brk.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* brk system call for Linux/MIPS.
-   Copyright (C) 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sysdep.h>
-
-void *__curbrk = 0;
-
-/* Old braindamage in GCC's crtstuff.c requires this symbol in an attempt
-   to work around different old braindamage in the old Linux/x86 ELF
-   dynamic linker.  Sigh.  */
-weak_alias (__curbrk, ___brk_addr)
-
-int
-__brk (void *addr)
-{
-  void *newbrk;
-
-  {
-    register long int res __asm__ ("$2");
-
-    asm ("move\t$4,%2\n\t"
-	 "syscall"		/* Perform the system call.  */
-	 : "=r" (res)
-	 : "0" (SYS_ify (brk)), "r" (addr)
-	 : "$4", "$7");
-    newbrk = (void *) res;
-  }
-  __curbrk = newbrk;
-
-  if (newbrk < addr)
-    {
-      __set_errno (ENOMEM);
-      return -1;
-    }
-
-  return 0;
-}
-weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
deleted file mode 100644
index 043f5921cb..0000000000
--- a/sysdeps/unix/sysv/linux/mips/clone.S
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@linux-mips.org>, 1996.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* clone() is even more special than fork() as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <sys/asm.h>
-#include <sysdep.h>
-#define _ERRNO_H	1
-#include <bits/errno.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
-
-	.text
-LOCALSZ= 1
-FRAMESZ= (((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
-GPOFF= FRAMESZ-(1*SZREG)
-NESTED(__clone,4*SZREG,sp)
-#ifdef __PIC__
-	SETUP_GP
-#endif
-	PTR_SUBU sp, FRAMESZ
-	SETUP_GP64 (GPOFF, __clone)
-#ifdef __PIC__
-	SAVE_GP (GPOFF)
-#endif
-#ifdef PROF
-	.set		noat
-	move		$1,ra
-	jal		_mcount
-	.set		at
-#endif
-
-
-	/* Sanity check arguments.  */
-	li		v0,EINVAL
-	beqz		a0,L(error)	/* No NULL function pointers.  */
-	beqz		a1,L(error)	/* No NULL stack pointers.  */
-
-	PTR_SUBU	a1,32		/* Reserve argument save space.  */
-	PTR_S		a0,0(a1)	/* Save function pointer.  */
-	PTR_S		a3,PTRSIZE(a1)	/* Save argument pointer.  */
-
-
-	/* Do the system call */
-	move		a0,a2
-	li		v0,__NR_clone
-	syscall
-
-	bnez		a3,L(error)
-	beqz		v0,L(thread_start)
-
-	/* Successful return from the parent */
-	RESTORE_GP64
-	PTR_ADDU	sp, FRAMESZ
-	ret
-
-	/* Something bad happened -- no child created */
-L(error):
-#ifdef __PIC__
-	PTR_LA		t9,__syscall_error
-	RESTORE_GP64
-	PTR_ADDU	sp, FRAMESZ
-	jr		t9
-#else
-	RESTORE_GP64
-	PTR_ADDU	sp, FRAMESZ
-	j		__syscall_error
-#endif
-	END(__clone)
-
-/* Load up the arguments to the function.  Put this block of code in
-   its own function so that we can terminate the stack trace with our
-   debug info.  */
-
-ENTRY(__thread_start)
-L(thread_start):
-	/* cp is already loaded.  */
-	SAVE_GP (GPOFF)
-	/* The stackframe has been created on entry of clone().  */
-	/* Restore the arg for user's function.  */
-	PTR_L		t9,0(sp)	/* Function pointer.  */
-	PTR_L		a0,PTRSIZE(sp)	/* Argument pointer.  */
-
-	/* Call the user's function.  */
-	jal		t9
-
-	/* Call _exit rather than doing it inline for breakpoint purposes.  */
-	move		a0,v0
-#ifdef __PIC__
-	PTR_LA		t9,_exit
-	jalr		t9
-#else
-	jal		_exit
-#endif
-	END(__thread_start)
-
-weak_alias(__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
deleted file mode 100755
index c081795aa1..0000000000
--- a/sysdeps/unix/sysv/linux/mips/configure
+++ /dev/null
@@ -1,76 +0,0 @@
-# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
- # Local configure fragment for sysdeps/unix/sysv/linux/mips.
-
-case $machine in
-mips*64*)
-  rm -f asm-unistd.h
-  asm_unistd_h=$sysheaders/asm/unistd.h
-  if test ! -f $asm_unistd_h; then
-    # Try to find asm/unistd.h in compiler header search path.
-    try_asm_unistd_h=`echo '#include <asm/unistd.h>' | $CPP - |
-			sed -n '/^# 1 "\(\/[^"]*\)".*/{s,,\1,p;q;}'`
-    if test -n "$try_asm_unistd_h" &&
-       test -f "$try_asm_unistd_h"; then
-      asm_unistd_h=$try_asm_unistd_h
-    fi
-  fi
-  if test ! -f "$asm_unistd_h"; then
-    { echo "$as_me:$LINENO: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&5
-echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;}
-    echo '#include <asm/unistd.h>' > asm-unistd.h
-  else
-    # The point of this preprocessing is to turn __NR_<syscall> into
-    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
-    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
-    # and <abi> is the compiler-enabled ABI.
-    cat "$asm_unistd_h" |
-    sed -e 's,__NR_,__NR_N64_,g' \
-        -e 's,__NR_N64_##,__NR_##,g' \
-	-e 's,__NR_N64_O32_,__NR_O32_,g' \
-	-e 's,__NR_N64_N32_,__NR_N32_,g' \
-	-e 's,__NR_N64_N64_,__NR_N64_,g' \
-    | awk > asm-unistd.h '
-BEGIN { print "#include <sgidefs.h>"; }
-/^#define __NR.*unused/ { print; next; }
-/^#define __NR_N64__exit __NR_N64_exit/ {
-	print "#define __NR__exit __NR_exit";
-	print "#define __NR_O32__exit __NR_O32_exit";
-	print "#define __NR_N32__exit __NR_N32_exit";
-	print; next;
-}
-/^#define __NR_O32_/ {
-	name = $2;
-	sub (/_O32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIO32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N32_/ {
-	name = $2;
-	sub (/_N32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIN32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N64_/ {
-	name = $2;
-	sub (/_N64_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABI64";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-{
-	print;
-}'
-  fi ;;
-mips*)
-  rm -f asm-unistd.h
-  echo '#include <asm/unistd.h>' > asm-unistd.h
-  ;;
-esac
diff --git a/sysdeps/unix/sysv/linux/mips/configure.in b/sysdeps/unix/sysv/linux/mips/configure.in
deleted file mode 100644
index 67d965dfda..0000000000
--- a/sysdeps/unix/sysv/linux/mips/configure.in
+++ /dev/null
@@ -1,76 +0,0 @@
-sinclude(./aclocal.m4)dnl Autoconf lossage
-GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
-# Local configure fragment for sysdeps/unix/sysv/linux/mips.
-
-case $machine in
-mips*64*)
-  rm -f asm-unistd.h
-  asm_unistd_h=$sysheaders/asm/unistd.h
-  if test ! -f $asm_unistd_h; then
-    # Try to find asm/unistd.h in compiler header search path.
-    try_asm_unistd_h=`echo '#include <asm/unistd.h>' | $CPP - |
-			sed -n '/^# 1 "\(\/[^"]*\)".*/{s,,\1,p;q;}'`
-    if test -n "$try_asm_unistd_h" &&
-       test -f "$try_asm_unistd_h"; then
-      asm_unistd_h=$try_asm_unistd_h
-    fi
-  fi
-  if test ! -f "$asm_unistd_h"; then
-    AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed])
-    echo '#include <asm/unistd.h>' > asm-unistd.h
-  else
-    # The point of this preprocessing is to turn __NR_<syscall> into
-    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
-    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
-    # and <abi> is the compiler-enabled ABI.
-    cat "$asm_unistd_h" |
-    sed -e 's,__NR_,__NR_N64_,g' \
-        -e 's,__NR_N64_##,__NR_##,g' \
-	-e 's,__NR_N64_O32_,__NR_O32_,g' \
-	-e 's,__NR_N64_N32_,__NR_N32_,g' \
-	-e 's,__NR_N64_N64_,__NR_N64_,g' \
-    | awk > asm-unistd.h '
-BEGIN { print "#include <sgidefs.h>"; }
-/^#define __NR.*unused/ { print; next; }
-/^#define __NR_N64__exit __NR_N64_exit/ {
-	print "#define __NR__exit __NR_exit";
-	print "#define __NR_O32__exit __NR_O32_exit";
-	print "#define __NR_N32__exit __NR_N32_exit";
-	print; next;
-}
-/^#define __NR_O32_/ {
-	name = $2;
-	sub (/_O32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIO32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N32_/ {
-	name = $2;
-	sub (/_N32_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABIN32";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-/^#define __NR_N64_/ {
-	name = $2;
-	sub (/_N64_/, "_", name);
-	print;
-	print "#if _MIPS_SIM == _ABI64";
-	print "# define " name " " $2;
-	print "#endif";
-	next;
-}
-{
-	print;
-}'
-  fi ;;
-mips*)
-  rm -f asm-unistd.h
-  echo '#include <asm/unistd.h>' > asm-unistd.h
-  ;;
-esac
diff --git a/sysdeps/unix/sysv/linux/mips/dl-cache.h b/sysdeps/unix/sysv/linux/mips/dl-cache.h
deleted file mode 100644
index 4fa5d3ad22..0000000000
--- a/sysdeps/unix/sysv/linux/mips/dl-cache.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
-   Copyright (C) 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define add_system_dir(dir) \
-  do								\
-    {								\
-      size_t len = strlen (dir);				\
-      char path[len + 3];					\
-      memcpy (path, dir, len + 1);				\
-      if (len >= 6						\
-	  && (! memcmp (path + len - 6, "/lib64", 6)		\
-	      || ! memcmp (path + len - 6, "/lib32", 6)))	\
-	{							\
-	  len -= 2;						\
-	  path[len] = '\0';					\
-	}							\
-      add_dir (path);						\
-      if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4))	\
-	{							\
-	  memcpy (path + len, "32", 3);				\
-	  add_dir (path);					\
-	  memcpy (path + len, "64", 3);				\
-	  add_dir (path);					\
-	}							\
-    } while (0)
-
-#include_next <dl-cache.h>
diff --git a/sysdeps/unix/sysv/linux/mips/entry.h b/sysdeps/unix/sysv/linux/mips/entry.h
deleted file mode 100644
index 04d05d2b0a..0000000000
--- a/sysdeps/unix/sysv/linux/mips/entry.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef __ASSEMBLY__
-extern void __start (void);
-#endif
-
-#define ENTRY_POINT __start
diff --git a/sysdeps/unix/sysv/linux/mips/fcntl.c b/sysdeps/unix/sysv/linux/mips/fcntl.c
deleted file mode 100644
index ea951bc4f9..0000000000
--- a/sysdeps/unix/sysv/linux/mips/fcntl.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/fcntl.c>
diff --git a/sysdeps/unix/sysv/linux/mips/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/ftruncate64.c
deleted file mode 100644
index cdb2d56840..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ftruncate64.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <endian.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include "kernel-features.h"
-
-#ifdef __NR_ftruncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls.  */
-extern int __have_no_truncate64;
-#endif
-
-/* Truncate the file FD refers to to LENGTH bytes.  */
-int
-__ftruncate64 (int fd, off64_t length)
-{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! __have_no_truncate64)
-#endif
-    {
-      unsigned int low = length & 0xffffffff;
-      unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      int saved_errno = errno;
-#endif
-      int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0,
-				   __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      if (result != -1 || errno != ENOSYS)
-#endif
-	return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      __set_errno (saved_errno);
-      __have_no_truncate64 = 1;
-#endif
-    }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if ((off_t) length != length)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  return __ftruncate (fd, (off_t) length);
-#endif
-}
-weak_alias (__ftruncate64, ftruncate64)
-
-#else
-/* Use the generic implementation.  */
-# include <sysdeps/generic/ftruncate64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/getmsg.c b/sysdeps/unix/sysv/linux/mips/getmsg.c
deleted file mode 100644
index 3a1fa08525..0000000000
--- a/sysdeps/unix/sysv/linux/mips/getmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/getmsg.c>
diff --git a/sysdeps/unix/sysv/linux/mips/getsysstats.c b/sysdeps/unix/sysv/linux/mips/getsysstats.c
deleted file mode 100644
index 9b521ac76a..0000000000
--- a/sysdeps/unix/sysv/linux/mips/getsysstats.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Determine various system internal values, Linux/MIPS version.
-   Copyright (C) 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-/* We need to define a special parser for /proc/cpuinfo.  */
-#define GET_NPROCS_PARSER(FP, BUFFER, RESULT)				  \
-  do									  \
-    {									  \
-      (RESULT) = 0;							  \
-      /* Read all lines and count the lines starting with the string	  \
-	 "cpu model".  We don't have to fear extremely long lines since	  \
-	 the kernel will not generate them.  8192 bytes are really	  \
-	 enough.  */							  \
-      while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL)	  \
-	if (strncmp (BUFFER, "cpu model", 9) == 0)			  \
-	  ++(RESULT);							  \
-    }									  \
-  while (0)
-
-#include <sysdeps/unix/sysv/linux/getsysstats.c>
diff --git a/sysdeps/unix/sysv/linux/mips/ipc_priv.h b/sysdeps/unix/sysv/linux/mips/ipc_priv.h
deleted file mode 100644
index 9b85386a7c..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ipc_priv.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/alpha/ipc_priv.h>
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h b/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h
deleted file mode 100644
index b6f52cc9c9..0000000000
--- a/sysdeps/unix/sysv/linux/mips/kernel_sigaction.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* This is the sigaction structure from the Linux 2.1.24 kernel.  */
-
-#include <sgidefs.h>
-
-#define HAVE_SA_RESTORER
-
-struct old_kernel_sigaction {
-	unsigned int	sa_flags;
-	__sighandler_t	k_sa_handler;
-	unsigned long	sa_mask;
-	unsigned int    __pad0[3]; /* reserved, keep size constant */
-
-	/* Abi says here follows reserved int[2] */
-	void		(*sa_restorer)(void);
-#if (_MIPS_SZPTR < 64)
-	/*
-	 * For 32 bit code we have to pad struct sigaction to get
-	 * constant size for the ABI
-	 */
-	int		pad1[1]; /* reserved */
-#endif
-};
-
-
-#define _KERNEL_NSIG	       128
-#define _KERNEL_NSIG_BPW       _MIPS_SZLONG
-#define _KERNEL_NSIG_WORDS     (_KERNEL_NSIG / _KERNEL_NSIG_BPW)
-
-typedef struct {
-	unsigned long sig[_KERNEL_NSIG_WORDS];
-} kernel_sigset_t;
-
-/* This is the sigaction structure from the Linux 2.1.68 kernel.  */
-struct kernel_sigaction {
-	unsigned int	sa_flags;
-	__sighandler_t	k_sa_handler;
-	kernel_sigset_t	sa_mask;
-	void		(*sa_restorer)(void);
-	int		s_resv[1]; /* reserved */
-};
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h
deleted file mode 100644
index cab1e7110e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <sgidefs.h>
-/* As tempting as it is to define XSTAT_IS_XSTAT64 for n64, the
-   userland data structures are not identical, because of different
-   padding.  */
-/* Definition of `struct stat' used in the kernel.  */
-#if _MIPS_SIM != _ABIO32
-struct kernel_stat
-  {
-    unsigned int st_dev;
-    unsigned int __pad1[3];
-    unsigned long long st_ino;
-    unsigned int st_mode;
-    unsigned int st_nlink;
-    int st_uid;
-    int st_gid;
-    unsigned int st_rdev;
-    unsigned int __pad2[3];
-    long long st_size;
-    unsigned int st_atime;
-    unsigned int __unused1;
-    unsigned int st_mtime;
-    unsigned int __unused2;
-    unsigned int st_ctime;
-    unsigned int __unused3;
-    unsigned int st_blksize;
-    unsigned int __pad3;
-    unsigned long long st_blocks;
-  };
-#else
-struct kernel_stat
-  {
-    unsigned long int st_dev;
-    long int __pad1[3];			/* Reserved for network id */
-    unsigned long int st_ino;
-    unsigned long int st_mode;
-    unsigned long int st_nlink;
-    long int st_uid;
-    long int st_gid;
-    unsigned long int st_rdev;
-    long int __pad2[2];
-    long int st_size;
-    long int __pad3;
-    long int st_atime;
-    long int __unused1;
-    long int st_mtime;
-    long int __unused2;
-    long int st_ctime;
-    long int __unused3;
-    long int st_blksize;
-    long int st_blocks;
-    char st_fstype[16];			/* Filesystem type name, unsupported */
-    long st_pad4[8];
-    /* Linux specific fields */
-    unsigned int st_flags;
-    unsigned int st_gen;
-  };
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_termios.h b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
deleted file mode 100644
index 9b622f4d1f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/kernel_termios.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1997 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _KERNEL_TERMIOS_H
-#define _KERNEL_TERMIOS_H 1
-/* The following corresponds to the values from the Linux 2.1.24 kernel.  */
-
-#define __KERNEL_NCCS 23
-
-struct __kernel_termios
-  {
-    tcflag_t c_iflag;		/* input mode flags */
-    tcflag_t c_oflag;		/* output mode flags */
-    tcflag_t c_cflag;		/* control mode flags */
-    tcflag_t c_lflag;		/* local mode flags */
-    cc_t c_line;		/* line discipline */
-    cc_t c_cc[__KERNEL_NCCS];	/* control characters */
-  };
-
-#endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/mips/lockf64.c b/sysdeps/unix/sysv/linux/mips/lockf64.c
deleted file mode 100644
index a88f5a784a..0000000000
--- a/sysdeps/unix/sysv/linux/mips/lockf64.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/lockf64.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
deleted file mode 100644
index b0316b657b..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H
-#define _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/sysv/linux/mips/mips32/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_O32_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_O32_/**/syscall_name
-#endif
-
-#endif /* linux/mips/mips32/kern64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
deleted file mode 100644
index 5eaf7a276b..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_MIPS_MIPS32_SYSDEP_H
-#define _LINUX_MIPS_MIPS32_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/mips/mips32/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef __PIC__
-# define SYSCALL_ERROR_LABEL 99b
-#endif
-
-#else   /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)                               \
-  ({ INTERNAL_SYSCALL_DECL(err);					\
-     long result_var = INTERNAL_SYSCALL (name, err, nr, args);      	\
-     if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) )  		\
-       {                                                                \
-         __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err));      	\
-         result_var = -1L;                               		\
-       }                                                                \
-     result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
-
-#define internal_syscall0(name, err, dummy...) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "i" (SYS_ify(name))						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall1(name, err, arg1) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "i" (SYS_ify(name)) 				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall2(name, err, arg1, arg2) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"lw\t$2, %6\n\t" 						\
-	"subu\t$29, 32\n\t" 						\
-	"sw\t$2, 16($29)\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	"addiu\t$29, 32\n\t" 						\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "m" ((long)arg5) 						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"lw\t$2, %6\n\t" 						\
-	"lw\t$8, %7\n\t" 						\
-	"subu\t$29, 32\n\t" 						\
-	"sw\t$2, 16($29)\n\t" 						\
-	"sw\t$8, 20($29)\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	"addiu\t$29, 32\n\t" 						\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "m" ((long)arg5), "m" ((long)arg6)				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall7(name, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"lw\t$2, %6\n\t" 						\
-	"lw\t$8, %7\n\t" 						\
-	"lw\t$9, %8\n\t" 						\
-	"subu\t$29, 32\n\t" 						\
-	"sw\t$2, 16($29)\n\t" 						\
-	"sw\t$8, 20($29)\n\t" 						\
-	"sw\t$9, 24($29)\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	"addiu\t$29, 32\n\t" 						\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "m" ((long)arg5), "m" ((long)arg6), "m" ((long)arg7)		\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
-
-#endif /* __ASSEMBLER__ */
-
-#endif /* linux/mips/mips32/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/Dist b/sysdeps/unix/sysv/linux/mips/mips64/Dist
deleted file mode 100644
index b8fa28f0a4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/Dist
+++ /dev/null
@@ -1 +0,0 @@
-ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
deleted file mode 100644
index d490fb95e2..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld.so.1", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
deleted file mode 100644
index 2c327327e0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
+++ /dev/null
@@ -1 +0,0 @@
-s_^\(RTLDLIST=\)\(.*lib\)\(\|32\|64\)\(/[^/]*\.so\.[0-9.]*\)[ 	]*$_\1"\232\4 \264\4 \2\4"_
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/llseek.c b/sysdeps/unix/sysv/linux/mips/mips64/llseek.c
deleted file mode 100644
index 24013a8224..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/llseek.c
+++ /dev/null
@@ -1 +0,0 @@
-/* lseek() is 64-bit capable already.  */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
deleted file mode 100644
index 42efcba315..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/ftruncate64.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-
-#include <sysdep.h>
-
-extern int ftruncate (int fd, off64_t length);
-
-int __ftruncate64 (int fd, off64_t length) {
-  return ftruncate (fd, length);
-}
-weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
deleted file mode 100644
index be343aabca..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_MIPS_SYSDEP_H
-#define _LINUX_MIPS_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/mips/mips64/n32/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_N32_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_N32_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef __PIC__
-# define SYSCALL_ERROR_LABEL 99b
-#endif
-
-#else   /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)                               \
-  ({ INTERNAL_SYSCALL_DECL(err);					\
-     long result_var = INTERNAL_SYSCALL (name, err, nr, args);      	\
-     if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) )  		\
-       {                                                                \
-         __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err));      	\
-         result_var = -1L;                               		\
-       }                                                                \
-     result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
-
-#define internal_syscall0(name, err, dummy...) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "i" (SYS_ify(name))						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall1(name, err, arg1) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a3 asm("$7"); 				\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "i" (SYS_ify(name)) 				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall2(name, err, arg1, arg2) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a3 asm("$7"); 				\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7"); 				\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7") = (long long) arg4; 		\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7") = (long long) arg4; 		\
-	register long long __a4 asm("$8") = (long long) arg5; 		\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4) 							\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long long __v0 asm("$2"); 				\
-	register long long __a0 asm("$4") = (long long) arg1; 		\
-	register long long __a1 asm("$5") = (long long) arg2; 		\
-	register long long __a2 asm("$6") = (long long) arg3; 		\
-	register long long __a3 asm("$7") = (long long) arg4; 		\
-	register long long __a4 asm("$8") = (long long) arg5; 		\
-	register long long __a5 asm("$9") = (long long) arg6; 		\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4), "r" (__a5)					\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
-#endif /* __ASSEMBLER__ */
-
-#endif /* linux/mips/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
deleted file mode 100644
index 339023f14f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/truncate64.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-
-#include <sysdep.h>
-#include <bp-checks.h>
-
-extern int truncate (const char *__unbounded path, int dummy,
-		     off64_t length);
-
-int truncate64 (const char *__unbounded path, int dummy,
-		off64_t length) {
-  return truncate (path, dummy, length);
-}
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c
deleted file mode 100644
index 33918ea6a5..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/glob64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* glob64 is in glob.c */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S b/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
deleted file mode 100644
index 7b14089bcb..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/ioctl.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#include <sys/asm.h>
-
-/* Sign-extend the ioctl number, since the kernel wants it as a
-   sign-extended 32-bit value, but our prototype is that of a long.  */
-
-	.text
-ENTRY (__ioctl)
-	li v0, __NR_ioctl
-	sll a1,a1,0
-	syscall			/* Do the system call.  */
-	bne a3, zero, L(error)
-	ret
-
-L(error):
-	.cpsetup t9, a0, __ioctl
-	PTR_LA t9,__syscall_error
-	.cprestore
-	jr t9
-
-PSEUDO_END (__ioctl)
-
-weak_alias (__ioctl, ioctl)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
deleted file mode 100644
index f30a465081..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+++ /dev/null
@@ -1,242 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _LINUX_MIPS_SYSDEP_H
-#define _LINUX_MIPS_SYSDEP_H 1
-
-/* There is some commonality.  */
-#include <sysdeps/unix/mips/mips64/n64/sysdep.h>
-
-/* For Linux we can use the system call table in the header file
-	/usr/include/asm/unistd.h
-   of the kernel.  But these symbols do not follow the SYS_* syntax
-   so we have to redefine the `SYS_ify' macro here.  */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name)	__NR_N64_##syscall_name
-#else
-# define SYS_ify(syscall_name)	__NR_N64_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
-
-/* We don't want the label for the error handler to be visible in the symbol
-   table when we define it here.  */
-#ifdef __PIC__
-# define SYSCALL_ERROR_LABEL 99b
-#endif
-
-#else   /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
-   call.  */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)                               \
-  ({ INTERNAL_SYSCALL_DECL(err);					\
-     long result_var = INTERNAL_SYSCALL (name, err, nr, args);      	\
-     if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) )  		\
-       {                                                                \
-         __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err));      	\
-         result_var = -1L;                               		\
-       }                                                                \
-     result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err)   ((long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
-
-#define internal_syscall0(name, err, dummy...) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "i" (SYS_ify(name))						\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall1(name, err, arg1) 				\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
-	"syscall\n\t" 							\
-	".set reorder" 							\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "i" (SYS_ify(name)) 				\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall2(name, err, arg1, arg2) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7"); 					\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "=r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	register long __a4 asm("$8") = (long) arg5; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4) 							\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
-({ 									\
-	long _sys_result;						\
-									\
-	{								\
-	register long __v0 asm("$2"); 					\
-	register long __a0 asm("$4") = (long) arg1; 			\
-	register long __a1 asm("$5") = (long) arg2; 			\
-	register long __a2 asm("$6") = (long) arg3; 			\
-	register long __a3 asm("$7") = (long) arg4; 			\
-	register long __a4 asm("$8") = (long) arg5; 			\
-	register long __a5 asm("$9") = (long) arg6; 			\
-	__asm__ volatile ( 						\
-	".set\tnoreorder\n\t" 						\
-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
-	"syscall\n\t" 							\
-	".set\treorder" 						\
-	: "=r" (__v0), "+r" (__a3) 					\
-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
-	  "r" (__a4), "r" (__a5)					\
-	: __SYSCALL_CLOBBERS); 						\
-	err = __a3;							\
-	_sys_result = __v0;						\
-	}								\
-	_sys_result;							\
-})
-
-#define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \
-	"$14", "$15", "$24", "$25", "memory"
-#endif /* __ASSEMBLER__ */
-
-#endif /* linux/mips/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/recv.c b/sysdeps/unix/sysv/linux/mips/mips64/recv.c
deleted file mode 100644
index b910525c92..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/recv.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/x86_64/recv.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/send.c b/sysdeps/unix/sysv/linux/mips/mips64/send.c
deleted file mode 100644
index d2c2996a21..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/send.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/x86_64/send.c>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
deleted file mode 100644
index ea5bf491d6..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-
-#include <sys/asm.h>
-
-/* Please consult the file sysdeps/unix/sysv/linux/x86-64/sysdep.h for
-   more information about the value -4095 used below.  */
-
-/* Usage: long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5)
-   We need to do some arg shifting, the syscall_number will be in
-   rax.  */
-
-
-	.text
-ENTRY (syscall)
-	move v0, a0		/* Syscall number -> v0 */
-	move a0, a1		/* shift arg1 - arg7.  */
-	move a1, a2
-	move a2, a3
-	move a3, a4
-	move a4, a5
-	move a5, a6
-	move a6, a7
-
-	syscall			/* Do the system call.  */
-	bne a3, zero, L(error)
-
-	ret
-
-L(error):
-	.cpsetup t9, a0, syscall
-	PTR_LA t9,__syscall_error
-	.cprestore
-	jr t9
-
-PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
deleted file mode 100644
index b0d79ff6a4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+++ /dev/null
@@ -1,21 +0,0 @@
-# File name	Caller	Syscall name	Args	Strong name	Weak names
-
-lseek		-	lseek		i:iii	__libc_lseek	__lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64
-
-# proper socket implementations:
-recvfrom	-	recvfrom	i:ibniBN __libc_recvfrom __recvfrom recvfrom
-sendto		-	sendto		i:ibnibn __libc_sendto	__sendto sendto
-
-# semaphore and shm system calls
-msgctl		-	msgctl		i:iip	__msgctl	msgctl
-msgget		-	msgget		i:ii	__msgget	msgget
-msgrcv		-	msgrcv		i:ibnii	__msgrcv	msgrcv
-msgsnd		-	msgsnd		i:ibni	__msgsnd	msgsnd
-shmat		-	shmat		i:ipi	__shmat		shmat
-shmctl		-	shmctl		i:iip	__shmctl	shmctl
-shmdt		-	shmdt		i:s	__shmdt		shmdt
-shmget		-	shmget		i:iii	__shmget	shmget
-semop		-	semop		i:ipi	__semop		semop
-semtimedop	-	semtimedop	i:ipip	semtimedop
-semget		-	semget		i:iii	__semget	semget
-semctl		-	semctl		i:iiii	__semctl	semctl
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/umount.c b/sysdeps/unix/sysv/linux/mips/mips64/umount.c
deleted file mode 100644
index 9a91ba5b2f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/umount.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/hppa/umount.c>
diff --git a/sysdeps/unix/sysv/linux/mips/pipe.S b/sysdeps/unix/sysv/linux/mips/pipe.S
deleted file mode 100644
index 1708888da4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pipe.S
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/mips/pipe.S>
diff --git a/sysdeps/unix/sysv/linux/mips/pread.c b/sysdeps/unix/sysv/linux/mips/pread.c
deleted file mode 100644
index eff7d473d0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pread.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <assert.h>
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
-
-# if __ASSUME_PREAD_SYSCALL == 0
-static ssize_t __emulate_pread (int fd, void *buf, size_t count,
-				off_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pread (fd, buf, count, offset)
-     int fd;
-     void *buf;
-     size_t count;
-     off_t offset;
-{
-  ssize_t result;
-
-#if _MIPS_SIM != _ABI64
-  assert (sizeof (offset) == 4);
-#endif
-
-  if (SINGLE_THREAD_P)
-    {
-      /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-      result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-      if (result == -1 && errno == ENOSYS)
-        /* No system call available.  Use the emulation.  */
-        result = __emulate_pread (fd, buf, count, offset);
-# endif
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pread (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-strong_alias (__libc_pread, __pread)
-weak_alias (__libc_pread, pread)
-
-# define __libc_pread(fd, buf, count, offset) \
-     static internal_function __emulate_pread (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PREAD_SYSCALL == 0
-# include <sysdeps/posix/pread.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/pread64.c b/sysdeps/unix/sysv/linux/mips/pread64.c
deleted file mode 100644
index d8763acabb..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pread64.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pread
-#  error "__NR_pread and __NR_pread64 both defined???"
-# endif
-# define __NR_pread __NR_pread64
-#endif
-
-#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
-
-# if __ASSUME_PREAD_SYSCALL == 0
-static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
-				  off64_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pread64 (fd, buf, count, offset)
-     int fd;
-     void *buf;
-     size_t count;
-     off64_t offset;
-{
-  ssize_t result;
-
-
-  if (SINGLE_THREAD_P)
-    {
-     /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-     result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			      (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-     if (result == -1 && errno == ENOSYS)
-     /* No system call available.  Use the emulation.  */
-     result = __emulate_pread64 (fd, buf, count, offset);
-# endif
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PREAD_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pread64 (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-weak_alias (__libc_pread64, __pread64)
-weak_alias (__libc_pread64, pread64)
-
-# define __libc_pread64(fd, buf, count, offset) \
-     static internal_function __emulate_pread64 (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PREAD_SYSCALL == 0
-# include <sysdeps/posix/pread64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/profil-counter.h b/sysdeps/unix/sysv/linux/mips/profil-counter.h
deleted file mode 100644
index 8a6a0bcf3d..0000000000
--- a/sysdeps/unix/sysv/linux/mips/profil-counter.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* We can use the ix86 version.  */
-#include <sysdeps/unix/sysv/linux/i386/profil-counter.h>
diff --git a/sysdeps/unix/sysv/linux/mips/ptrace.c b/sysdeps/unix/sysv/linux/mips/ptrace.c
deleted file mode 100644
index 19d7c2d927..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ptrace.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sgidefs.h>
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <sys/user.h>
-#include <stdarg.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-#include <sgidefs.h>
-
-#if _MIPS_SIM == _ABIN32
-__extension__ typedef long long int reg_type;
-#else
-typedef long int reg_type;
-#endif
-
-reg_type
-ptrace (enum __ptrace_request request, ...)
-{
-  reg_type res, ret;
-  va_list ap;
-  pid_t pid;
-  void *addr;
-  reg_type data;
-
-  va_start (ap, request);
-  pid = va_arg (ap, pid_t);
-  addr = va_arg (ap, void *);
-  data = va_arg (ap, reg_type);
-  va_end (ap);
-
-  if (request > 0 && request < 4)
-    data = &ret;
-
-#if __BOUNDED_POINTERS__
-  switch (request)
-    {
-    case PTRACE_PEEKTEXT:
-    case PTRACE_PEEKDATA:
-    case PTRACE_PEEKUSER:
-    case PTRACE_POKETEXT:
-    case PTRACE_POKEDATA:
-    case PTRACE_POKEUSER:
-      (void) CHECK_1 ((int *) addr);
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_GETREGS:
-    case PTRACE_SETREGS:
-      /* We don't know the size of data, so the best we can do is ensure
-	 that `data' is valid for at least one word.  */
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_GETFPREGS:
-    case PTRACE_SETFPREGS:
-      /* We don't know the size of data, so the best we can do is ensure
-	 that `data' is valid for at least one word.  */
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_GETFPXREGS:
-    case PTRACE_SETFPXREGS:
-      /* We don't know the size of data, so the best we can do is ensure
-	 that `data' is valid for at least one word.  */
-      (void) CHECK_1 ((int *) data);
-      break;
-
-    case PTRACE_TRACEME:
-    case PTRACE_CONT:
-    case PTRACE_KILL:
-    case PTRACE_SINGLESTEP:
-    case PTRACE_ATTACH:
-    case PTRACE_DETACH:
-    case PTRACE_SYSCALL:
-      /* Neither `data' nor `addr' needs any checks.  */
-      break;
-    };
-#endif
-
-  res = INLINE_SYSCALL (ptrace, 4, request, pid,
-			__ptrvalue (addr), __ptrvalue (data));
-  if (res >= 0 && request > 0 && request < 4)
-    {
-      __set_errno (0);
-      return ret;
-    }
-
-  return res;
-}
diff --git a/sysdeps/unix/sysv/linux/mips/putmsg.c b/sysdeps/unix/sysv/linux/mips/putmsg.c
deleted file mode 100644
index ebc1680ca7..0000000000
--- a/sysdeps/unix/sysv/linux/mips/putmsg.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/putmsg.c>
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite.c b/sysdeps/unix/sysv/linux/mips/pwrite.c
deleted file mode 100644
index 4378ebc859..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pwrite.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <assert.h>
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
-
-# if __ASSUME_PWRITE_SYSCALL == 0
-static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
-				 off_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pwrite (fd, buf, count, offset)
-     int fd;
-     const void *buf;
-     size_t count;
-     off_t offset;
-{
-  ssize_t result;
-
-#if _MIPS_SIM != _ABI64
-  assert (sizeof (offset) == 4);
-#endif
-
-  if (SINGLE_THREAD_P)
-    {
-      /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-      result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-      if (result == -1 && errno == ENOSYS)
-        /* No system call available.  Use the emulation.  */
-        result = __emulate_pwrite (fd, buf, count, offset);
-# endif
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pwrite (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-strong_alias (__libc_pwrite, __pwrite)
-weak_alias (__libc_pwrite, pwrite)
-
-# define __libc_pwrite(fd, buf, count, offset) \
-     static internal_function __emulate_pwrite (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PWRITE_SYSCALL == 0
-# include <sysdeps/posix/pwrite.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite64.c b/sysdeps/unix/sysv/linux/mips/pwrite64.c
deleted file mode 100644
index e5853e432e..0000000000
--- a/sysdeps/unix/sysv/linux/mips/pwrite64.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ralf Baechle <ralf@gnu.org>, 1998.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#ifndef NO_SGIDEFS_H
-#include <sgidefs.h>
-#endif
-#include <unistd.h>
-#include <endian.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include <kernel-features.h>
-
-#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
-# ifdef __NR_pwrite
-#  error "__NR_pwrite and __NR_pwrite64 both defined???"
-# endif
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
-
-# if __ASSUME_PWRITE_SYSCALL == 0
-static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
-				   off64_t offset) internal_function;
-# endif
-
-ssize_t
-__libc_pwrite64 (fd, buf, count, offset)
-     int fd;
-     const void *buf;
-     size_t count;
-     off64_t offset;
-{
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-     /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
-			       offset);
-#else
-     result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			     (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-     if (result == -1 && errno == ENOSYS)
-     /* No system call available.  Use the emulation.  */
-     result = __emulate_pwrite64 (fd, buf, count, offset);
-# endif
-
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* First try the syscall.  */
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count, offset);
-#else
-  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-#endif
-# if __ASSUME_PWRITE_SYSCALL == 0
-  if (result == -1 && errno == ENOSYS)
-    /* No system call available.  Use the emulation.  */
-    result = __emulate_pwrite64 (fd, buf, count, offset);
-# endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
-weak_alias (__libc_pwrite64, __pwrite64)
-libc_hidden_weak (__pwrite64)
-weak_alias (__libc_pwrite64, pwrite64)
-
-# define __libc_pwrite64(fd, buf, count, offset) \
-     static internal_function __emulate_pwrite64 (fd, buf, count, offset)
-#endif
-
-#if __ASSUME_PWRITE_SYSCALL == 0
-# include <sysdeps/posix/pwrite64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/readelflib.c b/sysdeps/unix/sysv/linux/mips/readelflib.c
deleted file mode 100644
index 73fd43f46f..0000000000
--- a/sysdeps/unix/sysv/linux/mips/readelflib.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Alexandre Oliva <aoliva@redhat.com>
-   Based on work ../x86_64/readelflib.c,
-   contributed by Andreas Jaeger <aj@suse.de>, 1999 and
-		  Jakub Jelinek <jakub@redhat.com>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-int process_elf32_file (const char *file_name, const char *lib, int *flag,
-			unsigned int *osversion, char **soname,
-			void *file_contents, size_t file_length);
-int process_elf64_file (const char *file_name, const char *lib, int *flag,
-			unsigned int *osversion, char **soname,
-			void *file_contents, size_t file_length);
-
-/* Returns 0 if everything is ok, != 0 in case of error.  */
-int
-process_elf_file (const char *file_name, const char *lib, int *flag,
-		  unsigned int *osversion, char **soname, void *file_contents,
-		  size_t file_length)
-{
-  ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
-  int ret;
-
-  if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
-    {
-      ret = process_elf32_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-
-      /* n32 libraries are always libc.so.6+.  */
-      if (ret && (elf_header->e_flags & EF_MIPS_ABI2) != 0)
-	*flag = FLAG_MIPS64_LIBN32|FLAG_ELF_LIBC6;
-    }
-  else
-    {
-      ret = process_elf64_file (file_name, lib, flag, osversion, soname,
-				file_contents, file_length);
-      /* n64 libraries are always libc.so.6+.  */
-      if (!ret)
-	*flag = FLAG_MIPS64_LIBN64|FLAG_ELF_LIBC6;
-    }
-
-  return ret;
-}
-
-#undef __ELF_NATIVE_CLASS
-#undef process_elf_file
-#define process_elf_file process_elf32_file
-#define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
-
-#undef __ELF_NATIVE_CLASS
-#undef process_elf_file
-#define process_elf_file process_elf64_file
-#define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/mips/register-dump.h b/sysdeps/unix/sysv/linux/mips/register-dump.h
deleted file mode 100644
index f5bd3a2735..0000000000
--- a/sysdeps/unix/sysv/linux/mips/register-dump.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Dump registers.
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/uio.h>
-#include <stdio-common/_itoa.h>
-
-/* We will print the register dump in this format:
-
- R0   XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- R8   XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- R16  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- R24  XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
-           pc    cause  status   badvaddr       lo       hi
-      XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
- The FPU registers will not be printed.
-*/
-
-static void
-hexvalue (unsigned long int value, char *buf, size_t len)
-{
-  char *cp = _itoa_word (value, buf + len, 16, 0);
-  while (cp > buf)
-    *--cp = '0';
-}
-
-static void
-register_dump (int fd, struct sigcontext *ctx)
-{
-  char regs[38][8];
-  struct iovec iov[38 * 2 + 10];
-  size_t nr = 0;
-  int i;
-
-#define ADD_STRING(str) \
-  iov[nr].iov_base = (char *) str;					      \
-  iov[nr].iov_len = strlen (str);					      \
-  ++nr
-#define ADD_MEM(str, len) \
-  iov[nr].iov_base = str;						      \
-  iov[nr].iov_len = len;						      \
-  ++nr
-
-  /* Generate strings of register contents.  */
-  for (i = 0; i < 32; i++)
-    hexvalue (ctx->sc_regs[i], regs[i], 8);
-  hexvalue (ctx->sc_pc, regs[32], 8);
-  hexvalue (ctx->sc_cause, regs[33], 8);
-  hexvalue (ctx->sc_status, regs[34], 8);
-  hexvalue (ctx->sc_badvaddr, regs[35], 8);
-  hexvalue (ctx->sc_mdhi, regs[36], 8);
-  hexvalue (ctx->sc_mdlo, regs[37], 8);
-
-  /* Generate the output.  */
-  ADD_STRING ("Register dump:\n\n R0   ");
-  for (i = 0; i < 8; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n R8   ");
-  for (i = 8; i < 16; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n R16  ");
-  for (i = 16; i < 24; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n R24  ");
-  for (i = 24; i < 32; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n           pc    cause  status   badvaddr       lo       hi\n      ");
-  for (i = 32; i < 38; i++)
-    {
-      ADD_MEM (regs[i], 8);
-      ADD_STRING (" ");
-    }
-  ADD_STRING ("\n");
-
-  /* Write the stuff out.  */
-  writev (fd, iov, nr);
-}
-
-
-#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/mips/sigaction.c b/sysdeps/unix/sysv/linux/mips/sigaction.c
deleted file mode 100644
index 09fbe79316..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sigaction.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003, 2004
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sgidefs.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-#include <sgidefs.h>
-
-#include "kernel-features.h"
-
-/* The difference here is that the sigaction structure used in the
-   kernel is not the same as we use in the libc.  Therefore we must
-   translate it here.  */
-#include <kernel_sigaction.h>
-
-#if __ASSUME_REALTIME_SIGNALS == 0
-/* The variable is shared between all wrappers around signal handling
-   functions which have RT equivalents.	 This is the definition.  */
-int __libc_missing_rt_sigs;
-
-#endif
-
-#if _MIPS_SIM != _ABIO32
-
-# ifdef __NR_rt_sigreturn
-static void restore_rt (void) asm ("__restore_rt");
-# endif
-# ifdef __NR_sigreturn
-static void restore (void) asm ("__restore");
-# endif
-#endif
-
-/* If ACT is not NULL, change the action for SIG to *ACT.
-   If OACT is not NULL, put the old action for SIG in *OACT.  */
-int
-__libc_sigaction (sig, act, oact)
-     int sig;
-     const struct sigaction *act;
-     struct sigaction *oact;
-{
-#if __ASSUME_REALTIME_SIGNALS == 0
-  struct old_kernel_sigaction k_sigact, k_osigact;
-#endif
-  int result;
-
-#if defined __NR_rt_sigaction || __ASSUME_REALTIME_SIGNALS > 0
-  /* First try the RT signals.	*/
-# if __ASSUME_REALTIME_SIGNALS == 0
-  if (!__libc_missing_rt_sigs)
-# endif
-    {
-      struct kernel_sigaction kact, koact;
-      /* Save the current error value for later.  We need not do this
-	 if we are guaranteed to have realtime signals.	 */
-# if __ASSUME_REALTIME_SIGNALS == 0
-      int saved_errno = errno;
-# endif
-
-      if (act)
-	{
-	  kact.k_sa_handler = act->sa_handler;
-	  memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kernel_sigset_t));
-	  kact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-#  if _MIPS_SIM == _ABIO32
-	  kact.sa_restorer = act->sa_restorer;
-#  else
-	  kact.sa_restorer = &restore_rt;
-#  endif
-# endif
-	}
-
-      /* XXX The size argument hopefully will have to be changed to the
-	 real size of the user-level sigset_t.	*/
-      result = INLINE_SYSCALL (rt_sigaction, 4, sig,
-			       act ? __ptrvalue (&kact) : NULL,
-			       oact ? __ptrvalue (&koact) : NULL,
-			       sizeof (kernel_sigset_t));
-
-# if __ASSUME_REALTIME_SIGNALS == 0
-      if (result >= 0 || errno != ENOSYS)
-# endif
-	{
-	  if (oact && result >= 0)
-	    {
-	      oact->sa_handler = koact.k_sa_handler;
-	      memcpy (&oact->sa_mask, &koact.sa_mask,
-				sizeof (kernel_sigset_t));
-	      oact->sa_flags = koact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-	      oact->sa_restorer = koact.sa_restorer;
-# endif
-	    }
-	  return result;
-	}
-
-# if __ASSUME_REALTIME_SIGNALS == 0
-      __set_errno (saved_errno);
-      __libc_missing_rt_sigs = 1;
-# endif
-    }
-#endif
-
-#if __ASSUME_REALTIME_SIGNALS == 0
-  if (act)
-    {
-      k_sigact.k_sa_handler = act->sa_handler;
-      k_sigact.sa_mask = act->sa_mask.__val[0];
-      k_sigact.sa_flags = act->sa_flags;
-# ifdef HAVE_SA_RESTORER
-      k_sigact.sa_restorer = act->sa_restorer;
-# endif
-    }
-  result = INLINE_SYSCALL (sigaction, 3, sig,
-			   act ? __ptrvalue (&k_sigact) : NULL,
-			   oact ? __ptrvalue (&k_osigact) : NULL);
-  if (oact && result >= 0)
-    {
-      oact->sa_handler = k_osigact.k_sa_handler;
-      oact->sa_mask.__val[0] = k_osigact.sa_mask;
-      oact->sa_flags = k_osigact.sa_flags;
-# ifdef HAVE_SA_RESTORER
-#  if _MIPS_SIM == _ABIO32
-      oact->sa_restorer = k_osigact.sa_restorer;
-#  else
-      oact->sa_restorer = &restore;
-#  endif
-# endif
-    }
-  return result;
-#endif
-}
-libc_hidden_def (__libc_sigaction)
-
-#ifndef LIBC_SIGACTION
-weak_alias (__libc_sigaction, __sigaction)
-libc_hidden_weak (__sigaction)
-weak_alias (__libc_sigaction, sigaction)
-#endif
-
-/* NOTE: Please think twice before making any changes to the bits of
-   code below.  GDB needs some intimate knowledge about it to
-   recognize them as signal trampolines, and make backtraces through
-   signal handlers work right.  Important are both the names
-   (__restore_rt) and the exact instruction sequence.
-   If you ever feel the need to make any changes, please notify the
-   appropriate GDB maintainer.  */
-
-#define RESTORE(name, syscall) RESTORE2 (name, syscall)
-#define RESTORE2(name, syscall) \
-asm						\
-  (						\
-   ".align 4\n"					\
-   "__" #name ":\n"				\
-   "	li $2, " #syscall "\n"			\
-   "	syscall\n"				\
-   );
-
-/* The return code for realtime-signals.  */
-#if _MIPS_SIM != _ABIO32
-# ifdef __NR_rt_sigreturn
-RESTORE (restore_rt, __NR_rt_sigreturn)
-# endif
-# ifdef __NR_sigreturn
-RESTORE (restore, __NR_sigreturn)
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h b/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
deleted file mode 100644
index f453c8d9b5..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-
-#include <sgidefs.h>
-
-#if _MIPS_SIM == _ABIO32
-
-#define SIGCONTEXT unsigned long _code, struct sigcontext *
-#define SIGCONTEXT_EXTRA_ARGS _code,
-#define GET_PC(ctx)	((void *) ctx->sc_pc)
-#define GET_FRAME(ctx)	((void *) ctx->sc_regs[30])
-#define GET_STACK(ctx)	((void *) ctx->sc_regs[29])
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
-
-#else
-
-#define SIGCONTEXT unsigned long _code, ucontext_t *
-#define SIGCONTEXT_EXTRA_ARGS _code,
-#define GET_PC(ctx)	((void *) ctx->uc_mcontext.pc)
-#define GET_FRAME(ctx)	((void *) ctx->uc_mcontext.gregs[30])
-#define GET_STACK(ctx)	((void *) ctx->uc_mcontext.gregs[29])
-#define CALL_SIGHANDLER(handler, signo, ctx) \
-  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/sys/cachectl.h b/sysdeps/unix/sysv/linux/mips/sys/cachectl.h
deleted file mode 100644
index a93e1fb6d1..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/cachectl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2000 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_CACHECTL_H
-#define _SYS_CACHECTL_H 1
-
-#include <features.h>
-
-/*
- * Get the kernel definition for the op bits.
- */
-#include <asm/cachectl.h>
-
-__BEGIN_DECLS
-
-#ifdef __USE_MISC
-extern int cachectl (void *addr, __const int nbytes, __const int op) __THROW;
-#endif
-extern int __cachectl (void *addr, __const int nbytes, __const int op) __THROW;
-#ifdef __USE_MISC
-extern int cacheflush (void *addr, __const int nbytes, __const int op) __THROW;
-#endif
-extern int _flush_cache (char *addr, __const int nbytes, __const int op) __THROW;
-
-__END_DECLS
-
-#endif /* sys/cachectl.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/procfs.h b/sysdeps/unix/sysv/linux/mips/sys/procfs.h
deleted file mode 100644
index 2bf07be3e9..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/procfs.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_PROCFS_H
-#define _SYS_PROCFS_H	1
-
-/* This is somehow modelled after the file of the same name on SysVr4
-   systems.  It provides a definition of the core file format for ELF
-   used on Linux.  */
-
-#include <features.h>
-#include <sgidefs.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/user.h>
-#include <sgidefs.h>
-
-/* ELF register definitions */
-#define ELF_NGREG	45
-#define ELF_NFPREG	33
-
-#if _MIPS_SIM == _ABIN32
-__extension__ typedef unsigned long long elf_greg_t;
-#else
-typedef unsigned long elf_greg_t;
-#endif
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef double elf_fpreg_t;
-typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
-
-__BEGIN_DECLS
-
-struct elf_siginfo
-  {
-    int si_signo;			/* Signal number.  */
-    int si_code;			/* Extra code.  */
-    int si_errno;			/* Errno.  */
-  };
-
-
-/* Definitions to generate Intel SVR4-like core files.  These mostly
-   have the same names as the SVR4 types with "elf_" tacked on the
-   front to prevent clashes with linux definitions, and the typedef
-   forms have been avoided.  This is mostly like the SVR4 structure,
-   but more Linuxy, with things that Linux does not support and which
-   gdb doesn't really use excluded.  Fields present but not used are
-   marked with "XXX".  */
-struct elf_prstatus
-  {
-    struct elf_siginfo pr_info;		/* Info associated with signal.  */
-    short int pr_cursig;		/* Current signal.  */
-#if _MIPS_SIM == _ABIN32
-    __extension__ unsigned long long int pr_sigpend;
-    __extension__ unsigned long long int pr_sighold;
-#else
-    unsigned long int pr_sigpend;	/* Set of pending signals.  */
-    unsigned long int pr_sighold;	/* Set of held signals.  */
-#endif
-    __pid_t pr_pid;
-    __pid_t pr_ppid;
-    __pid_t pr_pgrp;
-    __pid_t pr_sid;
-    struct timeval pr_utime;		/* User time.  */
-    struct timeval pr_stime;		/* System time.  */
-    struct timeval pr_cutime;		/* Cumulative user time.  */
-    struct timeval pr_cstime;		/* Cumulative system time.  */
-    elf_gregset_t pr_reg;		/* GP registers.  */
-    int pr_fpvalid;			/* True if math copro being used.  */
-  };
-
-
-#define ELF_PRARGSZ     (80)    /* Number of chars for args */
-
-struct elf_prpsinfo
-  {
-    char pr_state;			/* Numeric process state.  */
-    char pr_sname;			/* Char for pr_state.  */
-    char pr_zomb;			/* Zombie.  */
-    char pr_nice;			/* Nice val.  */
-#if _MIPS_SIM == _ABIN32
-    __extension__ unsigned long long int pr_flag;
-#else
-    unsigned long int pr_flag;		/* Flags.  */
-#endif
-    long pr_uid;
-    long pr_gid;
-    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
-    /* Lots missing */
-    char pr_fname[16];			/* Filename of executable.  */
-    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
-  };
-
-
-/* Addresses.  */
-typedef void *psaddr_t;
-
-/* Register sets.  Linux has different names.  */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
-   therefore habe only ine PID type.  */
-typedef __pid_t lwpid_t;
-
-
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ptrace.h b/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
deleted file mode 100644
index d05853da77..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004
-	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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_PTRACE_H
-#define _SYS_PTRACE_H	1
-
-#include <features.h>
-#include <sgidefs.h>
-
-__BEGIN_DECLS
-
-/* Type of the REQUEST argument to `ptrace.'  */
-enum __ptrace_request
-{
-  /* Indicate that the process making this request should be traced.
-     All signals received by this process can be intercepted by its
-     parent, and its parent can use the other `ptrace' requests.  */
-  PTRACE_TRACEME = 0,
-#define PT_TRACE_ME PTRACE_TRACEME
-
-  /* Return the word in the process's text space at address ADDR.  */
-  PTRACE_PEEKTEXT = 1,
-#define PT_READ_I PTRACE_PEEKTEXT
-
-  /* Return the word in the process's data space at address ADDR.  */
-  PTRACE_PEEKDATA = 2,
-#define PT_READ_D PTRACE_PEEKDATA
-
-  /* Return the word in the process's user area at offset ADDR.  */
-  PTRACE_PEEKUSER = 3,
-#define PT_READ_U PTRACE_PEEKUSER
-
-  /* Write the word DATA into the process's text space at address ADDR.  */
-  PTRACE_POKETEXT = 4,
-#define PT_WRITE_I PTRACE_POKETEXT
-
-  /* Write the word DATA into the process's data space at address ADDR.  */
-  PTRACE_POKEDATA = 5,
-#define PT_WRITE_D PTRACE_POKEDATA
-
-  /* Write the word DATA into the process's user area at offset ADDR.  */
-  PTRACE_POKEUSER = 6,
-#define PT_WRITE_U PTRACE_POKEUSER
-
-  /* Continue the process.  */
-  PTRACE_CONT = 7,
-#define PT_CONTINUE PTRACE_CONT
-
-  /* Kill the process.  */
-  PTRACE_KILL = 8,
-#define PT_KILL PTRACE_KILL
-
-  /* Single step the process.
-     This is not supported on all machines.  */
-  PTRACE_SINGLESTEP = 9,
-#define PT_STEP PTRACE_SINGLESTEP
-
-  /* Get all general purpose registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_GETREGS = 12,
-#define PT_GETREGS PTRACE_GETREGS
-
-  /* Set all general purpose registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_SETREGS = 13,
-#define PT_SETREGS PTRACE_SETREGS
-
-  /* Get all floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_GETFPREGS = 14,
-#define PT_GETFPREGS PTRACE_GETFPREGS
-
-  /* Set all floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_SETFPREGS = 15,
-#define PT_SETFPREGS PTRACE_SETFPREGS
-
-  /* Attach to a process that is already running. */
-  PTRACE_ATTACH = 16,
-#define PT_ATTACH PTRACE_ATTACH
-
-  /* Detach from a process attached to with PTRACE_ATTACH.  */
-  PTRACE_DETACH = 17,
-#define PT_DETACH PTRACE_DETACH
-
-  /* Get all extended floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_GETFPXREGS = 18,
-#define PT_GETFPXREGS PTRACE_GETFPXREGS
-
-  /* Set all extended floating point registers used by a processes.
-     This is not supported on all machines.  */
-   PTRACE_SETFPXREGS = 19,
-#define PT_SETFPXREGS PTRACE_SETFPXREGS
-
-  /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
-#define PT_SYSCALL PTRACE_SYSCALL
-};
-
-/* Perform process tracing functions.  REQUEST is one of the values
-   above, and determines the action to be taken.
-   For all requests except PTRACE_TRACEME, PID specifies the process to be
-   traced.
-
-   PID and the other arguments described above for the various requests should
-   appear (those that are used for the particular request) as:
-     pid_t PID, void *ADDR, int DATA, void *ADDR2
-   after REQUEST.  */
-#if _MIPS_SIM == _ABIN32
-__extension__ extern long long int ptrace
-  (enum __ptrace_request __request, ...) __THROW;
-#else
-extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
-#endif
-
-__END_DECLS
-
-#endif /* _SYS_PTRACE_H */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/syscall.h b/sysdeps/unix/sysv/linux/mips/sys/syscall.h
deleted file mode 100644
index f6458cd316..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/syscall.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1995, 1996, 1997, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYSCALL_H
-#define _SYSCALL_H	1
-
-/* This file should list the numbers of the system the system knows.
-   But instead of duplicating this we use the information available
-   from the kernel sources.  */
-#ifdef _LIBC
-/* Since the kernel doesn't define macro names in a way usable for
-   glibc, we preprocess this header, and use it during the glibc build
-   process.  */
-# include <asm-unistd.h>
-#else
-# include <asm/unistd.h>
-#endif
-
-#ifndef _LIBC
-/* The Linux kernel header file defines macros `__NR_<name>', but some
-   programs expect the traditional form `SYS_<name>'.  So in building libc
-   we scan the kernel's list and produce <bits/syscall.h> with macros for
-   all the `SYS_' names.  */
-# include <bits/syscall.h>
-#endif
-
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/sys/sysmips.h b/sysdeps/unix/sysv/linux/mips/sys/sysmips.h
deleted file mode 100644
index 0677cafaa4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/sysmips.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 1995, 1997, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_SYSMIPS_H
-#define _SYS_SYSMIPS_H 1
-
-#include <features.h>
-
-/*
- * Commands for the sysmips(2) call
- *
- * sysmips(2) is deprecated - though some existing software uses it.
- * We only support the following commands.  Sysmips exists for compatibility
- * purposes only so new software should avoid it.
- */
-#define SETNAME                   1	/* set hostname                  */
-#define FLUSH_CACHE		   3	/* writeback and invalidate caches */
-#define MIPS_FIXADE               7	/* control address error fixing  */
-#define MIPS_RDNVRAM              10	/* read NVRAM			 */
-#define MIPS_ATOMIC_SET		2001	/* atomically set variable       */
-
-__BEGIN_DECLS
-
-extern int sysmips (__const int cmd, ...) __THROW;
-
-__END_DECLS
-
-#endif /* sys/sysmips.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/tas.h b/sysdeps/unix/sysv/linux/mips/sys/tas.h
deleted file mode 100644
index 1183b867b8..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/tas.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_TAS_H
-#define _SYS_TAS_H 1
-
-#include <features.h>
-#include <sgidefs.h>
-
-__BEGIN_DECLS
-
-extern int _test_and_set (int *p, int v) __THROW;
-
-#ifdef __USE_EXTERN_INLINES
-
-# ifndef _EXTERN_INLINE
-#  define _EXTERN_INLINE extern __inline
-# endif
-
-_EXTERN_INLINE int
-__NTH (_test_and_set (int *p, int v))
-{
-  int r, t;
-
-  __asm__ __volatile__
-    ("/* Inline test and set */\n"
-     "1:\n\t"
-     ".set	push\n\t"
-#if _MIPS_SIM == _ABIO32
-     ".set	mips2\n\t"
-#endif
-     "ll	%0,%3\n\t"
-     "move	%1,%4\n\t"
-     "beq	%0,%4,2f\n\t"
-     "sc	%1,%2\n\t"
-     ".set	pop\n\t"
-     "beqz	%1,1b\n"
-     "2:\n\t"
-     "/* End test and set */"
-     : "=&r" (r), "=&r" (t), "=m" (*p)
-     : "m" (*p), "r" (v)
-     : "memory");
-
-  return r;
-}
-
-#endif /* __USE_EXTERN_INLINES */
-
-__END_DECLS
-
-#endif /* sys/tas.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
deleted file mode 100644
index ddb499f20c..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Don't rely on this, the interface is currently messed up and may need to
-   be broken to be fixed.  */
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <sgidefs.h>
-#include <signal.h>
-
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
-#include <bits/sigcontext.h>
-
-/* Type for general register.  Even in o32 we assume 64-bit registers,
-   like the kernel.  */
-__extension__ typedef unsigned long long int greg_t;
-
-/* Number of general registers.  */
-#define NGREG	32
-#define NFPREG	32
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NGREG];
-
-/* Container for all FPU registers.  */
-typedef struct fpregset {
-	union {
-		double	fp_dregs[NFPREG];
-		struct {
-			float		_fp_fregs;
-			unsigned int	_fp_pad;
-		} fp_fregs[NFPREG];
-	} fp_r;
-} fpregset_t;
-
-
-/* Context to describe whole processor state.  */
-#if _MIPS_SIM == _ABIO32
-/* Earlier versions of glibc for mips had an entirely different
-   definition of mcontext_t, that didn't even resemble the
-   corresponding kernel data structure.  Since all legitimate uses of
-   ucontext_t in glibc mustn't have accessed anything beyond
-   uc_mcontext and, even then, taking a pointer to it, casting it to
-   sigcontext_t, and accessing it as such, which is what it has always
-   been, this can still be rectified.  Fortunately, makecontext,
-   [gs]etcontext et all have never been implemented.  */
-typedef struct
-  {
-    unsigned int regmask;
-    unsigned int status;
-    greg_t pc;
-    gregset_t gregs;
-    fpregset_t fpregs;
-    unsigned int fp_owned;
-    unsigned int fpc_csr;
-    unsigned int fpc_eir;
-    unsigned int used_math;
-    unsigned int ssflags;
-    greg_t mdhi;
-    greg_t mdlo;
-    unsigned int cause;
-    unsigned int badvaddr;
-  } mcontext_t;
-#else
-typedef struct
-  {
-    gregset_t gregs;
-    fpregset_t fpregs;
-    greg_t mdhi;
-    greg_t mdlo;
-    greg_t pc;
-    unsigned int status;
-    unsigned int fpc_csr;
-    unsigned int fpc_eir;
-    unsigned int used_math;
-    unsigned int cause;
-    unsigned int badvaddr;
-  } mcontext_t;
-#endif
-
-/* Userlevel context.  */
-typedef struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    __sigset_t uc_sigmask;
-  } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/mips/sys/user.h b/sysdeps/unix/sysv/linux/mips/sys/user.h
deleted file mode 100644
index d5b3b0508b..0000000000
--- a/sysdeps/unix/sysv/linux/mips/sys/user.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Copyright (C) 2002, 2003, 2004 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _SYS_USER_H
-#define _SYS_USER_H	1
-
-#include <sgidefs.h>
-
-/* The whole purpose of this file is for GDB and GDB only.  Don't read
-   too much into it.  Don't use it for anything other than GDB unless
-   you know what you are doing.  */
-
-/* #include <asm/reg.h> */
-/* Instead of including the kernel header, that will vary depending on
-   whether the 32- or the 64-bit kernel is installed, we paste its
-   contents here.  Note that the fact that the file is inline here,
-   instead of included separately, doesn't change in any way the
-   licensing status of a program that includes user.h.  Since this is
-   for gdb alone, and gdb is GPLed, no surprises here.  */
-#if _MIPS_SIM == _ABIO32
-/*
- * Various register offset definitions for debuggers, core file
- * examiners and whatnot.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995, 1999 by Ralf Baechle
- */
-#ifndef __ASM_MIPS_REG_H
-#define __ASM_MIPS_REG_H
-
-/*
- * This defines/structures correspond to the register layout on stack -
- * if the order here is changed, it needs to be updated in
- * include/asm-mips/stackframe.h
- */
-#define EF_REG0			6
-#define EF_REG1			7
-#define EF_REG2			8
-#define EF_REG3			9
-#define EF_REG4			10
-#define EF_REG5			11
-#define EF_REG6			12
-#define EF_REG7			13
-#define EF_REG8			14
-#define EF_REG9			15
-#define EF_REG10		16
-#define EF_REG11		17
-#define EF_REG12		18
-#define EF_REG13		19
-#define EF_REG14		20
-#define EF_REG15		21
-#define EF_REG16		22
-#define EF_REG17		23
-#define EF_REG18		24
-#define EF_REG19		25
-#define EF_REG20		26
-#define EF_REG21		27
-#define EF_REG22		28
-#define EF_REG23		29
-#define EF_REG24		30
-#define EF_REG25		31
-/*
- * k0/k1 unsaved
- */
-#define EF_REG28		34
-#define EF_REG29		35
-#define EF_REG30		36
-#define EF_REG31		37
-
-/*
- * Saved special registers
- */
-#define EF_LO			38
-#define EF_HI			39
-
-#define EF_CP0_EPC		40
-#define EF_CP0_BADVADDR		41
-#define EF_CP0_STATUS		42
-#define EF_CP0_CAUSE		43
-
-#define EF_SIZE			180	/* size in bytes */
-
-#endif /* __ASM_MIPS_REG_H */
-
-#else /* _MIPS_SIM != _ABIO32 */
-
-/*
- * Various register offset definitions for debuggers, core file
- * examiners and whatnot.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995, 1999 Ralf Baechle
- * Copyright (C) 1995, 1999 Silicon Graphics
- */
-#ifndef _ASM_REG_H
-#define _ASM_REG_H
-
-/*
- * This defines/structures correspond to the register layout on stack -
- * if the order here is changed, it needs to be updated in
- * include/asm-mips/stackframe.h
- */
-#define EF_REG0			 0
-#define EF_REG1			 1
-#define EF_REG2			 2
-#define EF_REG3			 3
-#define EF_REG4			 4
-#define EF_REG5			 5
-#define EF_REG6			 6
-#define EF_REG7			 7
-#define EF_REG8			 8
-#define EF_REG9			 9
-#define EF_REG10		10
-#define EF_REG11		11
-#define EF_REG12		12
-#define EF_REG13		13
-#define EF_REG14		14
-#define EF_REG15		15
-#define EF_REG16		16
-#define EF_REG17		17
-#define EF_REG18		18
-#define EF_REG19		19
-#define EF_REG20		20
-#define EF_REG21		21
-#define EF_REG22		22
-#define EF_REG23		23
-#define EF_REG24		24
-#define EF_REG25		25
-/*
- * k0/k1 unsaved
- */
-#define EF_REG28		28
-#define EF_REG29		29
-#define EF_REG30		30
-#define EF_REG31		31
-
-/*
- * Saved special registers
- */
-#define EF_LO			32
-#define EF_HI			33
-
-#define EF_CP0_EPC		34
-#define EF_CP0_BADVADDR		35
-#define EF_CP0_STATUS		36
-#define EF_CP0_CAUSE		37
-
-#define EF_SIZE			304	/* size in bytes */
-
-#endif /* _ASM_REG_H */
-
-#endif /* _MIPS_SIM != _ABIO32 */
-
-#if _MIPS_SIM == _ABIO32
-
-struct user
-{
-  unsigned long	regs[EF_SIZE/4+64];	/* integer and fp regs */
-  size_t	u_tsize;		/* text size (pages) */
-  size_t	u_dsize;		/* data size (pages) */
-  size_t	u_ssize;		/* stack size (pages) */
-  unsigned long	start_code;		/* text starting address */
-  unsigned long	start_data;		/* data starting address */
-  unsigned long	start_stack;		/* stack starting address */
-  long int	signal;			/* signal causing core dump */
-  void*		u_ar0;			/* help gdb find registers */
-  unsigned long	magic;			/* identifies a core file */
-  char		u_comm[32];		/* user command name */
-};
-
-#else
-
-struct user {
-  __extension__ unsigned long	regs[EF_SIZE/8+64]; /* integer and fp regs */
-  __extension__ unsigned long	u_tsize;	/* text size (pages) */
-  __extension__ unsigned long	u_dsize;	/* data size (pages) */
-  __extension__ unsigned long	u_ssize;	/* stack size (pages) */
-  __extension__ unsigned long long start_code;	/* text starting address */
-  __extension__ unsigned long long start_data;	/* data starting address */
-  __extension__ unsigned long long start_stack;	/* stack starting address */
-  __extension__ long long	signal;		/* signal causing core dump */
-  __extension__ unsigned long long u_ar0;	/* help gdb find registers */
-  __extension__ unsigned long long magic;	/* identifies a core file */
-  char		u_comm[32];		/* user command name */
-};
-
-#endif
-
-#define PAGE_SHIFT		12
-#define PAGE_SIZE		(1UL << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
-#define NBPG			PAGE_SIZE
-#define UPAGES			1
-#define HOST_TEXT_START_ADDR	(u.start_code)
-#define HOST_DATA_START_ADDR	(u.start_data)
-#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
-
-#endif	/* _SYS_USER_H */
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
deleted file mode 100644
index 518f2a2522..0000000000
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ /dev/null
@@ -1,31 +0,0 @@
-# File name	Caller	Syscall name	Args	Strong name	Weak names
-
-#
-# Calls for compatibility with existing MIPS OS implementations and
-# compilers.
-#
-cachectl	-	cachectl	i:pii	__cachectl	cachectl
-cacheflush	-	cacheflush	i:pii	_flush_cache	cacheflush
-sysmips		-	sysmips		i:iiii	__sysmips	sysmips
-
-#
-# Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
-# it's provided for compatibility, though.
-#
-accept		-	accept		Ci:iBN	__libc_accept	__accept accept
-bind		-	bind		i:ipi	__bind		bind
-connect		-	connect		Ci:ipi	__libc_connect	__connect_internal __connect connect
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
-getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
-listen		-	listen		i:ii	__listen	listen
-recv		-	recv		Ci:ibni	__libc_recv	__recv recv
-recvfrom	-	recvfrom	Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
-recvmsg		-	recvmsg		Ci:ipi	__libc_recvmsg	__recvmsg recvmsg
-send		-	send		Ci:ibni	__libc_send	__send send
-sendmsg		-	sendmsg		Ci:ipi	__libc_sendmsg	__sendmsg sendmsg
-sendto		-	sendto		Ci:ibnibn __libc_sendto	__sendto sendto
-setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
-socket		-	socket		i:iii	__socket	socket
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/mips/truncate64.c b/sysdeps/unix/sysv/linux/mips/truncate64.c
deleted file mode 100644
index e955f18ea3..0000000000
--- a/sysdeps/unix/sysv/linux/mips/truncate64.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sys/types.h>
-#include <endian.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-#include "kernel-features.h"
-
-#ifdef __NR_truncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls.  */
-int __have_no_truncate64;
-#endif
-
-/* Truncate the file FD refers to to LENGTH bytes.  */
-int
-truncate64 (const char *path, off64_t length)
-{
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! __have_no_truncate64)
-#endif
-    {
-      unsigned int low = length & 0xffffffff;
-      unsigned int high = length >> 32;
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      int saved_errno = errno;
-#endif
-      int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
-				   __LONG_LONG_PAIR (high, low));
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      if (result != -1 || errno != ENOSYS)
-#endif
-	return result;
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-      __set_errno (saved_errno);
-      __have_no_truncate64 = 1;
-#endif
-    }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if ((off_t) length != length)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-  return truncate (path, (off_t) length);
-#endif
-}
-
-#else
-/* Use the generic implementation.  */
-# include <sysdeps/generic/truncate64.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mips/ustat.c b/sysdeps/unix/sysv/linux/mips/ustat.c
deleted file mode 100644
index a309f7104c..0000000000
--- a/sysdeps/unix/sysv/linux/mips/ustat.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/ustat.h>
-#include <sys/sysmacros.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-int
-ustat (dev_t dev, struct ustat *ubuf)
-{
-  unsigned long k_dev;
-
-  /* We must convert the value to dev_t type used by the kernel.  */
-  k_dev = ((major (dev) & 0xff) << 8) | (minor (dev) & 0xff);
-
-  return INLINE_SYSCALL (ustat, 2, k_dev, CHECK_1 (ubuf));
-}
diff --git a/sysdeps/unix/sysv/linux/mips/xmknod.c b/sysdeps/unix/sysv/linux/mips/xmknod.c
deleted file mode 100644
index 2d09752405..0000000000
--- a/sysdeps/unix/sysv/linux/mips/xmknod.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* xmknod call using old-style Unix mknod system call.
-   Copyright (C) 1991, 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2003
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-#include <bp-checks.h>
-
-/* Create a device file named PATH, with permission and special bits MODE
-   and device number DEV (which can be constructed from major and minor
-   device numbers with the `makedev' macro above).  */
-int
-__xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
-{
-  unsigned long k_dev;
-
-  if (vers != _MKNOD_VER)
-    {
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  /* We must convert the value to dev_t type used by the kernel.  */
-  k_dev = ((major (*dev) & 0xff) << 8) | (minor (*dev) & 0xff);
-
-  return INLINE_SYSCALL (mknod, 3, CHECK_STRING (path), mode, k_dev);
-}
-
-weak_alias (__xmknod, _xmknod)
-libc_hidden_def (__xmknod)
diff --git a/sysdeps/unix/sysv/linux/mips/xstatconv.c b/sysdeps/unix/sysv/linux/mips/xstatconv.c
deleted file mode 100644
index 41d1cbb768..0000000000
--- a/sysdeps/unix/sysv/linux/mips/xstatconv.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Convert between the kernel's `struct stat' format, and libc's.
-   Copyright (C) 1991,1995,1996,1997,1998,2000,2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <kernel_stat.h>
-
-#ifdef STAT_IS_KERNEL_STAT
-
-/* Dummy.  */
-struct kernel_stat;
-
-#else
-
-#include <string.h>
-
-
-int
-__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
-{
-  switch (vers)
-    {
-    case _STAT_VER_KERNEL:
-      /* Nothing to do.  The struct is in the form the kernel expects.
-         We should have short-circuted before we got here, but for
-         completeness... */
-      *(struct kernel_stat *) ubuf = *kbuf;
-      break;
-
-    case _STAT_VER_LINUX:
-      {
-	struct stat *buf = ubuf;
-
-	/* Convert to current kernel version of `struct stat'.  */
-	buf->st_dev = kbuf->st_dev;
-	buf->st_pad1[0] = 0; buf->st_pad1[1] = 0; buf->st_pad1[2] = 0;
-	buf->st_ino = kbuf->st_ino;
-	buf->st_mode = kbuf->st_mode;
-	buf->st_nlink = kbuf->st_nlink;
-	buf->st_uid = kbuf->st_uid;
-	buf->st_gid = kbuf->st_gid;
-	buf->st_rdev = kbuf->st_rdev;
-	buf->st_pad2[0] = 0; buf->st_pad2[1] = 0;
-	buf->st_pad3 = 0;
-	buf->st_size = kbuf->st_size;
-	buf->st_blksize = kbuf->st_blksize;
-	buf->st_blocks = kbuf->st_blocks;
-
-	buf->st_atime = kbuf->st_atime; buf->__reserved0 = 0;
-	buf->st_mtime = kbuf->st_mtime; buf->__reserved1 = 0;
-	buf->st_ctime = kbuf->st_ctime; buf->__reserved2 = 0;
-
-	buf->st_pad5[0] = 0; buf->st_pad5[1] = 0;
-	buf->st_pad5[2] = 0; buf->st_pad5[3] = 0;
-	buf->st_pad5[4] = 0; buf->st_pad5[5] = 0;
-	buf->st_pad5[6] = 0; buf->st_pad5[7] = 0;
-      }
-      break;
-
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return 0;
-}
-
-int
-__xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
-{
-#ifdef XSTAT_IS_XSTAT64
-  return xstat_conv (vers, kbuf, ubuf);
-#else
-  switch (vers)
-    {
-    case _STAT_VER_LINUX:
-      {
-	struct stat64 *buf = ubuf;
-
-	buf->st_dev = kbuf->st_dev;
-	buf->st_pad1[0] = 0; buf->st_pad1[1] = 0; buf->st_pad1[2] = 0;
-	buf->st_ino = kbuf->st_ino;
-	buf->st_mode = kbuf->st_mode;
-	buf->st_nlink = kbuf->st_nlink;
-	buf->st_uid = kbuf->st_uid;
-	buf->st_gid = kbuf->st_gid;
-	buf->st_rdev = kbuf->st_rdev;
-	buf->st_pad2[0] = 0; buf->st_pad2[1] = 0; buf->st_pad2[2] = 0;
-	buf->st_pad3 = 0;
-	buf->st_size = kbuf->st_size;
-	buf->st_blksize = kbuf->st_blksize;
-	buf->st_blocks = kbuf->st_blocks;
-
-	buf->st_atime = kbuf->st_atime; buf->__reserved0 = 0;
-	buf->st_mtime = kbuf->st_mtime; buf->__reserved1 = 0;
-	buf->st_ctime = kbuf->st_ctime; buf->__reserved2 = 0;
-
-	buf->st_pad4[0] = 0; buf->st_pad4[1] = 0;
-	buf->st_pad4[2] = 0; buf->st_pad4[3] = 0;
-	buf->st_pad4[4] = 0; buf->st_pad4[5] = 0;
-	buf->st_pad4[6] = 0; buf->st_pad4[7] = 0;
-      }
-      break;
-
-      /* If struct stat64 is different from struct stat then
-	 _STAT_VER_KERNEL does not make sense.  */
-    case _STAT_VER_KERNEL:
-    default:
-      __set_errno (EINVAL);
-      return -1;
-    }
-
-  return 0;
-#endif
-}
-
-#endif /* ! STAT_IS_KERNEL_STAT */
diff --git a/sysdeps/unix/sysv/linux/mkdirat.c b/sysdeps/unix/sysv/linux/mkdirat.c
new file mode 100644
index 0000000000..3c190085ce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mkdirat.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+/* Create a new directory with permission bits MODE.  But interpret
+   relative PATH names relative to the directory associated with FD.  */
+int
+mkdirat (fd, file, mode)
+     int fd;
+     const char *file;
+     mode_t mode;
+{
+  int res;
+
+#ifdef __NR_mkdirat
+#  ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      res = INLINE_SYSCALL (mkdirat, 3, fd, file, mode);
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && res == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+  res = INTERNAL_SYSCALL (mkdir, err, 2, file, mode);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+      res = -1;
+    }
+
+  return res;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c
index 7e9e9498cb..d3c68cd106 100644
--- a/sysdeps/unix/sysv/linux/mmap64.c
+++ b/sysdeps/unix/sysv/linux/mmap64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,01,02 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2001,2002,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_mmap2
 
diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c
index 65522d5adc..008e8eeb95 100644
--- a/sysdeps/unix/sysv/linux/mq_close.c
+++ b/sysdeps/unix/sysv/linux/mq_close.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -31,5 +31,5 @@ mq_close (mqd_t mqdes)
 }
 
 #else
-# include <sysdeps/generic/mq_close.c>
+# include <rt/mq_close.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_getattr.c b/sysdeps/unix/sysv/linux/mq_getattr.c
index a61722e237..d25df7bcfd 100644
--- a/sysdeps/unix/sysv/linux/mq_getattr.c
+++ b/sysdeps/unix/sysv/linux/mq_getattr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -31,5 +31,5 @@ mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
 }
 
 #else
-# include <sysdeps/generic/mq_getattr.c>
+# include <rt/mq_getattr.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index 14db27da70..4eba28a301 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -40,5 +40,5 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
 }
 
 #else
-# include <sysdeps/generic/mq_notify.c>
+# include <rt/mq_notify.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c
index d8926a73a7..eac6e01238 100644
--- a/sysdeps/unix/sysv/linux/mq_open.c
+++ b/sysdeps/unix/sysv/linux/mq_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -56,5 +56,5 @@ mq_open (const char *name, int oflag, ...)
 }
 
 #else
-# include <sysdeps/generic/mq_open.c>
+# include <rt/mq_open.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c
index 891663c66a..2186508029 100644
--- a/sysdeps/unix/sysv/linux/mq_receive.c
+++ b/sysdeps/unix/sysv/linux/mq_receive.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -33,5 +33,5 @@ mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
 }
 
 #else
-# include <sysdeps/generic/mq_receive.c>
+# include <rt/mq_receive.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c
index cb9cbc2a69..83b9f8df4a 100644
--- a/sysdeps/unix/sysv/linux/mq_send.c
+++ b/sysdeps/unix/sysv/linux/mq_send.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -32,5 +32,5 @@ mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
 }
 
 #else
-# include <sysdeps/generic/mq_send.c>
+# include <rt/mq_send.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
index 8d87ffadf4..bef39a4ae2 100644
--- a/sysdeps/unix/sysv/linux/mq_unlink.c
+++ b/sysdeps/unix/sysv/linux/mq_unlink.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -50,5 +50,5 @@ mq_unlink (const char *name)
 }
 
 #else
-# include <sysdeps/generic/mq_unlink.c>
+# include <rt/mq_unlink.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index 700591b2d3..86fd34cf8c 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2002, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2002,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -28,7 +28,7 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_msqid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index 7d8a8e7859..71e7c7aea5 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2002,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -35,7 +35,7 @@ struct ipc_kludge
   };
 
 
-int
+ssize_t
 __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
      int msqid;
      void *msgp;
@@ -56,8 +56,8 @@ __libc_msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
 
   int oldtype = LIBC_CANCEL_ASYNC ();
 
-  int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
-			       __ptrvalue (&tmp));
+  ssize_t result = INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
+				   __ptrvalue (&tmp));
 
    LIBC_CANCEL_RESET (oldtype);
 
diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/unix/sysv/linux/net/if_arp.h
index 46f035bef6..9608652ee4 100644
--- a/sysdeps/unix/sysv/linux/net/if_arp.h
+++ b/sysdeps/unix/sysv/linux/net/if_arp.h
@@ -1,5 +1,5 @@
 /* Definitions for Address Resolution Protocol.
-   Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2001,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -96,7 +96,7 @@ struct arphdr
 #define ARPHRD_ADAPT	264
 #define ARPHRD_ROSE	270
 #define ARPHRD_X25	271		/* CCITT X.25.  */
-#define ARPHDR_HWX25	272		/* Boards with X.25 in firmware.  */
+#define ARPHRD_HWX25	272		/* Boards with X.25 in firmware.  */
 #define ARPHRD_PPP	512
 #define ARPHRD_CISCO	513		/* Cisco HDLC.  */
 #define ARPHRD_HDLC	ARPHRD_CISCO
@@ -126,6 +126,12 @@ struct arphdr
 #define ARPHRD_FCFABRIC 787		/* Fibrechanel fabric.  */
 #define ARPHRD_IEEE802_TR 800		/* Magic type ident for TR.  */
 #define ARPHRD_IEEE80211 801		/* IEEE 802.11.  */
+#define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header.  */
+#define ARPHRD_IEEE80211_RADIOTAP 803	/* IEEE 802.11 + radiotap header.  */
+
+#define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known.  */
+#define ARPHRD_NONE	  0xFFFE	/* Zero header length.  */
+
 
 /* ARP ioctl request.  */
 struct arpreq
diff --git a/sysdeps/unix/sysv/linux/netinet/if_tr.h b/sysdeps/unix/sysv/linux/netinet/if_tr.h
index 1a7bc68c98..45c39115f3 100644
--- a/sysdeps/unix/sysv/linux/netinet/if_tr.h
+++ b/sysdeps/unix/sysv/linux/netinet/if_tr.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2005 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
@@ -21,13 +21,83 @@
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
-#include <asm/types.h>
 
-#include <linux/if_tr.h>
+/* IEEE 802.5 Token-Ring magic constants.  The frame sizes omit the preamble
+   and FCS/CRC (frame check sequence). */
+#define TR_ALEN		6		/* Octets in one token-ring addr */
+#define TR_HLEN 	(sizeof (struct trh_hdr) + sizeof (struct trllc))
+#define AC		0x10
+#define LLC_FRAME 	0x40
+
+/* LLC and SNAP constants */
+#define EXTENDED_SAP 	0xAA
+#define UI_CMD       	0x03
+
+/* This is an Token-Ring frame header. */
+struct trh_hdr
+{
+  u_int8_t  ac;			/* access control field */
+  u_int8_t  fc;			/* frame control field */
+  u_int8_t  daddr[TR_ALEN];	/* destination address */
+  u_int8_t  saddr[TR_ALEN];	/* source address */
+  u_int16_t rcf;		/* route control field */
+  u_int16_t rseg[8];		/* routing registers */
+};
+
+/* This is an Token-Ring LLC structure */
+struct trllc
+{
+  u_int8_t  dsap;		/* destination SAP */
+  u_int8_t  ssap;		/* source SAP */
+  u_int8_t  llc;		/* LLC control field */
+  u_int8_t  protid[3];		/* protocol id */
+  u_int16_t ethertype;		/* ether type field */
+};
+
+/* Token-Ring statistics collection data. */
+struct tr_statistics
+{
+  unsigned long rx_packets;     /* total packets received	*/
+  unsigned long tx_packets;	/* total packets transmitted	*/
+  unsigned long rx_bytes;	/* total bytes received   	*/
+  unsigned long tx_bytes;	/* total bytes transmitted	*/
+  unsigned long rx_errors;	/* bad packets received		*/
+  unsigned long tx_errors;	/* packet transmit problems	*/
+  unsigned long rx_dropped;	/* no space in linux buffers	*/
+  unsigned long tx_dropped;	/* no space available in linux	*/
+  unsigned long multicast;	/* multicast packets received	*/
+  unsigned long transmit_collision;
+
+  /* detailed Token-Ring errors. See IBM Token-Ring Network
+     Architecture for more info */
+
+  unsigned long line_errors;
+  unsigned long internal_errors;
+  unsigned long burst_errors;
+  unsigned long A_C_errors;
+  unsigned long abort_delimiters;
+  unsigned long lost_frames;
+  unsigned long recv_congest_count;
+  unsigned long frame_copied_errors;
+  unsigned long frequency_errors;
+  unsigned long token_errors;
+  unsigned long dummy1;
+};
+
+/* source routing stuff */
+#define TR_RII 			0x80
+#define TR_RCF_DIR_BIT 		0x80
+#define TR_RCF_LEN_MASK 	0x1f00
+#define TR_RCF_BROADCAST 	0x8000	/* all-routes broadcast */
+#define TR_RCF_LIMITED_BROADCAST 0xC000	/* single-route broadcast */
+#define TR_RCF_FRAME2K 		0x20
+#define TR_RCF_BROADCAST_MASK 	0xC000
+#define TR_MAXRIFLEN 		18
 
 #ifdef __USE_BSD
 
-struct trn_hdr {
+struct trn_hdr
+{
   u_int8_t trn_ac;                /* access control field */
   u_int8_t trn_fc;                /* field control field */
   u_int8_t trn_dhost[TR_ALEN];    /* destination host */
diff --git a/sysdeps/unix/sysv/linux/netlinkaccess.h b/sysdeps/unix/sysv/linux/netlinkaccess.h
index 6672e714ff..92310b77df 100644
--- a/sysdeps/unix/sysv/linux/netlinkaccess.h
+++ b/sysdeps/unix/sysv/linux/netlinkaccess.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2006 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
@@ -23,7 +23,7 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 struct netlink_res
@@ -55,8 +55,7 @@ extern int __no_netlink_support attribute_hidden;
 extern int __netlink_open (struct netlink_handle *h);
 extern void __netlink_close (struct netlink_handle *h);
 extern void __netlink_free_handle (struct netlink_handle *h);
-extern int __netlink_sendreq (struct netlink_handle *h, int type);
-extern int __netlink_receive (struct netlink_handle *h);
+extern int __netlink_request (struct netlink_handle *h, int type);
 
 
 #endif /* netlinkaccess.h */
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
index 9418417b45..80d33be29c 100644
--- a/sysdeps/unix/sysv/linux/not-cancel.h
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
@@ -1,5 +1,5 @@
 /* Uncancelable versions of cancelable interfaces.  Linux version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <sys/types.h>
 #include <sysdep.h>
 
 /* Uncancelable open.  */
@@ -26,6 +27,28 @@
 #define open_not_cancel_2(name, flags) \
    INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
 
+/* Uncancelable openat.  */
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+extern int __openat_nocancel (int fd, const char *fname, int oflag,
+			      mode_t mode) attribute_hidden;
+extern int __openat64_nocancel (int fd, const char *fname, int oflag,
+				mode_t mode) attribute_hidden;
+#else
+# define __openat_nocancel(fd, fname, oflag, mode) \
+  openat (fd, fname, oflag, mode)
+# define __openat64_nocancel(fd, fname, oflag, mode) \
+  openat64 (fd, fname, oflag, mode)
+#endif
+
+#define openat_not_cancel(fd, fname, oflag, mode) \
+  __openat_nocancel (fd, fname, oflag, mode)
+#define openat_not_cancel_3(fd, fname, oflag) \
+  __openat_nocancel (fd, fname, oflag, 0)
+#define openat64_not_cancel(fd, fname, oflag, mode) \
+  __openat64_nocancel (fd, fname, oflag, mode)
+#define openat64_not_cancel_3(fd, fname, oflag) \
+  __openat64_nocancel (fd, fname, oflag, 0)
+
 /* Uncancelable close.  */
 #define close_not_cancel(fd) \
   INLINE_SYSCALL (close, 1, fd)
@@ -58,3 +81,25 @@
 # define waitpid_not_cancel(pid, stat_loc, options) \
   INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL)
 #endif
+
+/* Uncancelable pause.  */
+#ifdef __NR_pause
+# define pause_not_cancel() \
+  INLINE_SYSCALL (pause, 0)
+#else
+# define pause_not_cancel() \
+  __pause_nocancel ()
+#endif
+
+/* Uncancelable nanosleep.  */
+#ifdef __NR_nanosleep
+# define nanosleep_not_cancel(requested_time, remaining) \
+  INLINE_SYSCALL (nanosleep, 2, requested_time, remaining)
+#else
+# define nanosleep_not_cancel(requested_time, remaining) \
+  __nanosleep_nocancel (requested_time, remaining)
+#endif
+
+/* Uncancelable sigsuspend.  */
+#define sigsuspend_not_cancel(set) \
+  __sigsuspend_nocancel (set)
diff --git a/sysdeps/unix/sysv/linux/nscd_setup_thread.c b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
index 7d1bfd8dd1..1589c24ea9 100644
--- a/sysdeps/unix/sysv/linux/nscd_setup_thread.c
+++ b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
@@ -1,22 +1,20 @@
 /* Setup of nscd worker threads.  Linux verison.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
-   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.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License version 2 as
+   published by the Free Software Foundation.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   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.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU 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.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include <string.h>
 #include <unistd.h>
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
new file mode 100644
index 0000000000..df53b6cf2c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -0,0 +1,175 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
+
+
+#ifndef OPENAT
+# define OPENAT openat
+
+# ifndef __ASSUME_ATFCTS
+/* Set errno after a failed call.  If BUF is not null,
+   it is a /proc/self/fd/ path name we just tried to use.  */
+void
+attribute_hidden
+__atfct_seterrno (int errval, int fd, const char *buf)
+{
+  if (buf != NULL)
+    {
+      struct stat64 st;
+
+      if (errval == ENOTDIR || errval == ENOENT)
+	{
+	  /* This can mean either the file descriptor is invalid or
+	     /proc is not mounted.  */
+	  if (__fxstat64 (_STAT_VER, fd, &st) != 0)
+	    /* errno is already set correctly.  */
+	    return;
+
+	  /* If /proc is not mounted there is nothing we can do.  */
+	  if ((errval != ENOTDIR || S_ISDIR (st.st_mode))
+	      && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+		  || !S_ISDIR (st.st_mode)))
+	    errval = ENOSYS;
+	}
+    }
+
+  __set_errno (errval);
+}
+
+int __have_atfcts;
+# endif
+#endif
+
+
+#define OPENAT_NOT_CANCEL CONCAT (OPENAT)
+#define CONCAT(name) CONCAT2 (name)
+#define CONCAT2(name) __##name##_nocancel
+
+
+int
+OPENAT_NOT_CANCEL (fd, file, oflag, mode)
+     int fd;
+     const char *file;
+     int oflag;
+     mode_t mode;
+{
+
+  /* We have to add the O_LARGEFILE flag for openat64.  */
+#ifdef MORE_OFLAGS
+  oflag |= MORE_OFLAGS;
+#endif
+
+  INTERNAL_SYSCALL_DECL (err);
+  int res;
+
+#ifdef __NR_openat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      res = INLINE_SYSCALL (openat, 4, fd, file, oflag, mode);
+
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      /* Note: snprintf cannot be canceled.  */
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  res = INTERNAL_SYSCALL (open, err, 3, file, oflag, mode);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+      res = -1;
+    }
+
+  return res;
+#endif
+}
+
+#define UNDERIZE(name) UNDERIZE_1 (name)
+#define UNDERIZE_1(name) __##name
+#define __OPENAT UNDERIZE (OPENAT)
+
+
+/* Open FILE with access OFLAG.  Interpret relative paths relative to
+   the directory associated with FD.  If OFLAG includes O_CREAT, a
+   third argument is the file protection.  */
+int
+__OPENAT (fd, file, oflag)
+     int fd;
+     const char *file;
+     int oflag;
+{
+  mode_t mode = 0;
+  if (oflag & O_CREAT)
+    {
+      va_list arg;
+      va_start (arg, oflag);
+      mode = va_arg (arg, mode_t);
+      va_end (arg);
+    }
+
+  if (SINGLE_THREAD_P)
+    return OPENAT_NOT_CANCEL (fd, file, oflag, mode);
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  int res = OPENAT_NOT_CANCEL (fd, file, oflag, mode);
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return res;
+}
+libc_hidden_def (__OPENAT)
+weak_alias (__OPENAT, OPENAT)
diff --git a/sysdeps/unix/sysv/linux/openat64.c b/sysdeps/unix/sysv/linux/openat64.c
new file mode 100644
index 0000000000..9e7a2b3737
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/openat64.c
@@ -0,0 +1,4 @@
+#define OPENAT openat64
+#define MORE_OFLAGS O_LARGEFILE
+
+#include "openat.c"
diff --git a/sysdeps/unix/sysv/linux/opendir.c b/sysdeps/unix/sysv/linux/opendir.c
index 26acae814a..c7671dc170 100644
--- a/sysdeps/unix/sysv/linux/opendir.c
+++ b/sysdeps/unix/sysv/linux/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2006 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
@@ -16,7 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #ifdef __ASSUME_O_DIRECTORY
diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h
index fb2c77e99b..a87831e74a 100644
--- a/sysdeps/unix/sysv/linux/paths.h
+++ b/sysdeps/unix/sysv/linux/paths.h
@@ -61,7 +61,7 @@
 #define	_PATH_TTY	"/dev/tty"
 #define	_PATH_UNIX	"/boot/vmlinux"
 #define _PATH_UTMP	"/var/run/utmp"
-#define	_PATH_VI	"/usr/bin/vi"
+#define	_PATH_VI	"/bin/vi"
 #define _PATH_WTMP	"/var/log/wtmp"
 
 /* Provide trailing slash, since mostly used for building pathnames. */
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index 4c4868645b..a745fbcbc0 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -1,5 +1,6 @@
 /* Poll system call, with emulation if it is not available.
-   Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,2002,2006
+	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
@@ -24,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_poll || __ASSUME_POLL_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/posix_madvise.c b/sysdeps/unix/sysv/linux/posix_madvise.c
new file mode 100644
index 0000000000..880b17ef31
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/posix_madvise.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2007 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <sys/mman.h>
+
+
+int
+posix_madvise (void *addr, size_t len, int advice)
+{
+  /* We have one problem: the kernel's MADV_DONTNEED does not
+     correspond to POSIX's POSIX_MADV_DONTNEED.  The former simply
+     discards changes made to the memory without writing it back to
+     disk, if this would be necessary.  The POSIX behavior does not
+     allow this.  There is no functionality mapping the POSIX behavior
+     so far so we ignore that advice for now.  */
+  if (advice == POSIX_MADV_DONTNEED)
+    return 0;
+
+  INTERNAL_SYSCALL_DECL (err);
+  int result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
+  return INTERNAL_SYSCALL_ERRNO (result, err);
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/Dist b/sysdeps/unix/sysv/linux/powerpc/Dist
deleted file mode 100644
index f36d3685f6..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/Dist
+++ /dev/null
@@ -1,8 +0,0 @@
-dl-brk.S
-ipc_priv.h
-kernel_termios.h
-ldd-rewrite.sed
-oldgetrlimit64.c
-sys/procfs.h
-sys/ptrace.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/Implies b/sysdeps/unix/sysv/linux/powerpc/Implies
new file mode 100644
index 0000000000..ff27cdb568
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/Implies
@@ -0,0 +1,4 @@
+# Make sure these routines come before ldbl-opt.
+ieee754/ldbl-128ibm
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 671370ede0..ecd8057951 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -2,3 +2,11 @@
 ifeq ($(subdir),rt)
 librt-routines += rt-sysdep
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
+
+ifeq ($(subdir),elf)
+routines += dl-vdso
+endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/Versions b/sysdeps/unix/sysv/linux/powerpc/Versions
new file mode 100644
index 0000000000..1ef53b9e9c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/Versions
@@ -0,0 +1,7 @@
+libc {
+  GLIBC_PRIVATE {
+    __vdso_get_tbfreq;
+    __vdso_clock_gettime;
+    __vdso_clock_getres;
+  }
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/aix/Dist b/sysdeps/unix/sysv/linux/powerpc/aix/Dist
deleted file mode 100644
index 64de6ace3e..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/aix/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-aix-dirent.h
-aix-errno.h
-aix-stat.h
-aix-termios.h
-direntconv.c
-errnoconv.c
-statconv.c
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
index 19649c01c7..c4964e0fd8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/PowerPC.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,8 +22,11 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -96,7 +99,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -180,10 +183,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
new file mode 100644
index 0000000000..f20a5a175c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
@@ -0,0 +1,36 @@
+/* Resolve function pointers to VDSO functions.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+
+#ifndef _LIBC_VDSO_H
+#define _LIBC_VDSO_H
+
+#ifdef SHARED
+
+extern void *__vdso_gettimeofday;
+
+extern void *__vdso_clock_gettime;
+
+extern void *__vdso_clock_getres;
+
+extern void *__vdso_get_tbfreq;
+
+#endif
+
+#endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
index 8dbaf5d7b8..e03ab7ff80 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/PowerPC version.
-   Copyright (C) 1997, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2003, 2005, 2006 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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/shm.h b/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
index 7705fb64d4..62560c0caf 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/shm.h
@@ -80,9 +80,10 @@ struct shmid_ds
 # define SHM_INFO      14
 
 /* shm_mode upper byte flags */
-# define SHM_DEST      01000   /* segment will be destroyed on last detach */
-# define SHM_LOCKED    02000   /* segment will not be swapped */
+# define SHM_DEST      01000	/* segment will be destroyed on last detach */
+# define SHM_LOCKED    02000	/* segment will not be swapped */
 # define SHM_HUGETLB   04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE 010000	/* don't check for reservations */
 
 struct shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 8a420cb69c..7aac02dc55 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1999,2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1999,2001,2003,2004,2005 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
@@ -92,34 +92,41 @@ struct termios {
 
 #define OFILL	00000100
 #define OFDEL	00000200
-#define NLDLY	00001400
-#define   NL0	00000000
-#define   NL1	00000400
-#define   NL2	00001000
-#define   NL3	00001400
-#define TABDLY	00006000
-#define   TAB0	00000000
-#define   TAB1	00002000
-#define   TAB2	00004000
-#define   TAB3	00006000
-#define XTABS	00006000	/* Required by POSIX to be == TAB3.  */
-#define CRDLY	00030000
-#define   CR0	00000000
-#define   CR1	00010000
-#define   CR2	00020000
-#define   CR3	00030000
-#define FFDLY	00040000
-#define   FF0	00000000
-#define   FF1	00040000
-#define BSDLY	00100000
-#define   BS0	00000000
-#define   BS1	00100000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY	00001400
+# define   NL0	00000000
+# define   NL1	00000400
+# define   NL2	00001000
+# define   NL3	00001400
+# define TABDLY	00006000
+# define   TAB0	00000000
+# define   TAB1	00002000
+# define   TAB2	00004000
+# define   TAB3	00006000
+# define CRDLY	00030000
+# define   CR0	00000000
+# define   CR1	00010000
+# define   CR2	00020000
+# define   CR3	00030000
+# define FFDLY	00040000
+# define   FF0	00000000
+# define   FF1	00040000
+# define BSDLY	00100000
+# define   BS0	00000000
+# define   BS1	00100000
+#endif
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
 
+#ifdef __USE_MISC
+# define XTABS	00006000
+#endif
+
 /* c_cflag bit meaning */
-#define CBAUD	0000377
+#ifdef __USE_MISC
+# define CBAUD	0000377
+#endif
 #define  B0	0000000		/* hang up */
 #define  B50	0000001
 #define  B75	0000002
@@ -136,9 +143,11 @@ struct termios {
 #define  B9600	0000015
 #define  B19200	0000016
 #define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CBAUDEX 0000020
+#ifdef __USE_MISC
+# define EXTA B19200
+# define EXTB B38400
+# define CBAUDEX 0000020
+#endif
 #define  B57600   00020
 #define  B115200  00021
 #define  B230400  00022
@@ -169,23 +178,30 @@ struct termios {
 #define HUPCL	00040000
 
 #define CLOCAL	00100000
-#define CRTSCTS	  020000000000		/* flow control */
+#ifdef __USE_MISC
+# define CMSPAR   010000000000		/* mark or space (stick) parity */
+# define CRTSCTS  020000000000		/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0x00000080
 #define ICANON	0x00000100
-#define XCASE	0x00004000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE	0x00004000
+#endif
 #define ECHO	0x00000008
 #define ECHOE	0x00000002
 #define ECHOK	0x00000004
 #define ECHONL	0x00000010
 #define NOFLSH	0x80000000
 #define TOSTOP	0x00400000
-#define ECHOCTL	0x00000040
-#define ECHOPRT	0x00000020
-#define ECHOKE	0x00000001
-#define FLUSHO	0x00800000
-#define PENDIN	0x20000000
+#ifdef __USE_MISC
+# define ECHOCTL	0x00000040
+# define ECHOPRT	0x00000020
+# define ECHOKE	0x00000001
+# define FLUSHO	0x00800000
+# define PENDIN	0x20000000
+#endif
 #define IEXTEN	0x00000400
 
 /* Values for the ACTION argument to `tcflow'.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
new file mode 100644
index 0000000000..cf934234f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
@@ -0,0 +1,19 @@
+/* Determine the wordsize from the preprocessor defines.  */
+
+#if defined __powerpc64__
+# define __WORDSIZE	64
+# define __WORDSIZE_COMPAT32	1
+#else
+# define __WORDSIZE	32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+/* Signal the glibc ABI didn't used to have a `long double'.
+   The changes all the `long double' function variants to be redirects
+   to the double functions.  */
+# define __LONG_DOUBLE_MATH_OPTIONAL   1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH        1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/chown.c b/sysdeps/unix/sysv/linux/powerpc/chown.c
index 4b283e720c..fdcbd3683a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/chown.c
+++ b/sysdeps/unix/sysv/linux/powerpc/chown.c
@@ -1,5 +1,5 @@
 /* chown() compatibility.
-   Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2002, 2003, 2005 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
@@ -24,6 +24,8 @@
 #include <sysdep.h>
 #include <stdlib.h>
 
+#include <kernel-features.h>
+
 /*
   In Linux 2.1.x the chown functions have been changed.  A new function lchown
   was introduced.  The new chown now follows symlinks - the old chown and the
@@ -34,58 +36,61 @@
 int
 __chown (const char *file, uid_t owner, gid_t group)
 {
-   int err;
-   int old_errno;
-   char link[PATH_MAX+2];
-   char path[2*PATH_MAX+4];
-   int loopct;
-   size_t filelen;
-   static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
-
-   if (libc_old_chown == 1)
-     return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
-
-   old_errno = errno;
-
-#ifdef __NR_lchown
-   if (libc_old_chown == 0)
-     {
-       err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
-       if (err != -1 || errno != ENOSYS)
-	 {
-	   libc_old_chown = 1;
-	   return err;
-	 }
-       libc_old_chown = -1;
-     }
-#endif
-
-   err = __readlink (file, link, PATH_MAX+1);
-   if (err == -1)
-     {
-       errno = old_errno;
-       return __lchown(file, owner, group);
-     }
-
-   filelen = strlen (file) + 1;
-   if (filelen > sizeof(path))
-     {
-       errno = ENAMETOOLONG;
-       return -1;
-     }
-   memcpy (path, file, filelen);
-
-   /* 'The system has an arbitrary limit...'  In practise, we'll hit
-      ENAMETOOLONG before this, usually.  */
-   for (loopct = 0; loopct < 128; loopct++)
-   {
-     size_t linklen;
-
-     if (err >= PATH_MAX+1)
-       {
-	 errno = ENAMETOOLONG;
-	 return -1;
-       }
+#if __ASSUME_LCHOWN_SYSCALL
+  return INLINE_SYSCALL (chown, 3, file, owner, group);
+#else
+  int err;
+  int old_errno;
+  char link[PATH_MAX + 2];
+  char path[2 * PATH_MAX + 4];
+  int loopct;
+  size_t filelen;
+  static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
+
+  if (libc_old_chown == 1)
+    return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
+
+  old_errno = errno;
+
+# ifdef __NR_lchown
+  if (libc_old_chown == 0)
+    {
+      err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
+      if (err != -1 || errno != ENOSYS)
+	{
+	  libc_old_chown = 1;
+	  return err;
+	}
+      libc_old_chown = -1;
+    }
+# endif
+
+  err = __readlink (file, link, PATH_MAX + 1);
+  if (err == -1)
+    {
+      __set_errno (old_errno);
+      return __lchown (file, owner, group);
+    }
+
+  filelen = strlen (file) + 1;
+  if (filelen > sizeof (path))
+    {
+      __set_errno (ENAMETOOLONG);
+      return -1;
+    }
+  memcpy (path, file, filelen);
+
+  /* 'The system has an arbitrary limit...'  In practise, we'll hit
+     ENAMETOOLONG before this, usually.  */
+  for (loopct = 0; loopct < 128; ++loopct)
+    {
+      size_t linklen;
+
+      if (err >= PATH_MAX + 1)
+	{
+	  __set_errno (ENAMETOOLONG);
+	  return -1;
+	}
 
       link[err] = 0;  /* Null-terminate string, just-in-case.  */
 
@@ -97,28 +102,29 @@ __chown (const char *file, uid_t owner, gid_t group)
 	{
 	  filelen = strlen (path);
 
-	  while (filelen > 1 && path[filelen-1] == '/')
-	    filelen--;
-	  while (filelen > 0 && path[filelen-1] != '/')
-	    filelen--;
-	  if (filelen + linklen > sizeof(path))
+	  while (filelen > 1 && path[filelen - 1] == '/')
+	    --filelen;
+	  while (filelen > 0 && path[filelen - 1] != '/')
+	    --filelen;
+	  if (filelen + linklen > sizeof (path))
 	    {
 	      errno = ENAMETOOLONG;
 	      return -1;
 	    }
-	  memcpy (path+filelen, link, linklen);
+	  memcpy (path + filelen, link, linklen);
 	}
 
-      err = __readlink(path, link, PATH_MAX+1);
+      err = __readlink (path, link, PATH_MAX + 1);
 
       if (err == -1)
-      {
-	errno = old_errno;
-	return __lchown(path, owner, group);
-      }
-   }
-   errno = ELOOP;
-   return -1;
+	{
+	  __set_errno (old_errno);
+	  return __lchown (path, owner, group);
+	}
+    }
+  __set_errno (ELOOP);
+  return -1;
+#endif
 }
 libc_hidden_def (__chown)
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure
new file mode 100644
index 0000000000..070bf5caeb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure
@@ -0,0 +1,135 @@
+# This file is generated from configure.in by Autoconf.  DO NOT EDIT!
+ # Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+
+echo "$as_me:$LINENO: checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS -mlong-double-128 uses IBM extended format... $ECHO_C" >&6
+if test "${libc_cv_mlong_double_128ibm+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_mlong_double_128ibm=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mlong_double_128ibm=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mlong_double_128ibm" >&5
+echo "${ECHO_T}$libc_cv_mlong_double_128ibm" >&6
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+  echo "$as_me:$LINENO: checking whether $CC $CFLAGS supports -mabi=ibmlongdouble" >&5
+echo $ECHO_N "checking whether $CC $CFLAGS supports -mabi=ibmlongdouble... $ECHO_C" >&6
+if test "${libc_cv_mabi_ibmlongdouble+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <float.h>
+int
+main ()
+{
+
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  libc_cv_mabi_ibmlongdouble=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+libc_cv_mabi_ibmlongdouble=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $libc_cv_mabi_ibmlongdouble" >&5
+echo "${ECHO_T}$libc_cv_mabi_ibmlongdouble" >&6
+
+  if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+    CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+  else
+    { { echo "$as_me:$LINENO: error: this configuration requires -mlong-double-128 IBM extended format support" >&5
+echo "$as_me: error: this configuration requires -mlong-double-128 IBM extended format support" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure.in b/sysdeps/unix/sysv/linux/powerpc/configure.in
new file mode 100644
index 0000000000..1768ab1f99
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/configure.in
@@ -0,0 +1,37 @@
+sinclude(./aclocal.m4)dnl Autoconf lossage
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local configure fragment for sysdeps/unix/sysv/linux/powerpc/.
+
+AC_CACHE_CHECK(whether $CC $CFLAGS -mlong-double-128 uses IBM extended format,
+	       libc_cv_mlong_double_128ibm, [dnl
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mlong-double-128"
+AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+	       libc_cv_mlong_double_128ibm=yes,
+	       libc_cv_mlong_double_128ibm=no)
+CFLAGS="$save_CFLAGS"])
+
+if test "$libc_cv_mlong_double_128ibm" = no; then
+  AC_CACHE_CHECK(whether $CC $CFLAGS supports -mabi=ibmlongdouble,
+		 libc_cv_mabi_ibmlongdouble, [dnl
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -mlong-double-128 -mabi=ibmlongdouble"
+  AC_TRY_COMPILE([#include <float.h>], [
+#if LDBL_MANT_DIG != 106
+# error "compiler doesn't implement IBM extended format of long double"
+#endif
+long double foobar (long double x) { return x; }],
+		 libc_cv_mabi_ibmlongdouble=yes,
+		 libc_cv_mabi_ibmlongdouble=no)
+  CFLAGS="$save_CFLAGS"])
+
+  if test "$libc_cv_mabi_ibmlongdouble" = yes; then
+    CFLAGS="$CFLAGS -mabi=ibmlongdouble"
+  else
+    AC_MSG_ERROR([this configuration requires -mlong-double-128 IBM extended format support])
+  fi
+fi
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
index a548a96325..7c02c68985 100644
--- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
@@ -1,5 +1,5 @@
 /* Operating system support for run-time dynamic linker.  Linux/PPC version.
-   Copyright (C) 1997, 1998, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2001, 2003, 2006 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
@@ -17,9 +17,8 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-
-#include "config.h"
-#include "kernel-features.h"
+#include <config.h>
+#include <kernel-features.h>
 #include <ldsodefs.h>
 
 extern int __cache_line_size;
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-vdso.c b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.c
new file mode 100644
index 0000000000..e1be097734
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.c
@@ -0,0 +1,59 @@
+/* ELF symbol resolve functions for VDSO objects.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include "config.h"
+#include <dl-hash.h>
+#include <ldsodefs.h>
+
+
+void *
+internal_function
+_dl_vdso_vsym (const char *name, const char *version)
+{
+  struct link_map *map = GLRO (dl_sysinfo_map);
+  void *value = NULL;
+
+
+  if (map != NULL)
+    {
+      /* Use a WEAK REF so we don't error out if the symbol is not found.  */
+      ElfW (Sym) wsym;
+      memset (&wsym, 0, sizeof (ElfW (Sym)));
+      wsym.st_info = (unsigned char) ELFW (ST_INFO (STB_WEAK, STT_NOTYPE));
+
+      /* Compute hash value to the version string.  */
+      struct r_found_version vers;
+      vers.name = version;
+      vers.hidden = 1;
+      vers.hash = _dl_elf_hash (version);
+      /* We don't have a specific file where the symbol can be found.  */
+      vers.filename = NULL;
+
+      /* Search the scope of the vdso map.  */
+      const ElfW (Sym) *ref = &wsym;
+      lookup_t result = GLRO (dl_lookup_symbol_x) (name, map, &ref,
+						   map->l_local_scope,
+						   &vers, 0, 0, NULL);
+
+      if (ref != NULL)
+	value = DL_SYMBOL_ADDRESS (result, ref);
+    }
+
+  return value;
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h
new file mode 100644
index 0000000000..a7dcb2e5ff
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h
@@ -0,0 +1,27 @@
+/* ELF symbol resolve functions for VDSO objects.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _DL_VDSO_H
+#define _DL_VDSO_H	1
+
+/* Functions for resolving symbols in the VDSO link map.  */
+extern void *_dl_vdso_vsym (const char *name, const char *version)
+     internal_function attribute_hidden;
+
+#endif /* dl-vdso.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/fchownat.c b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
new file mode 100644
index 0000000000..67c570648a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/fchownat.c
@@ -0,0 +1,110 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+#include <sysdep.h>
+#include <stdlib.h>
+
+#include <kernel-features.h>
+
+/*
+  In Linux 2.1.x the chown functions have been changed.  A new function lchown
+  was introduced.  The new chown now follows symlinks - the old chown and the
+  new lchown do not follow symlinks.
+  This file emulates chown() under the old kernels.
+*/
+
+int
+fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
+{
+  int result;
+
+#ifdef __NR_fchownat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (fchownat, 5, fd, file, owner, group, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_SYMLINK_NOFOLLOW)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+# if __ASSUME_LCHOWN_SYSCALL
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = INTERNAL_SYSCALL (lchown, err, 3, file, owner, group);
+  else
+    result = INTERNAL_SYSCALL (chown, err, 3, file, owner, group);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      return -1;
+    }
+# else
+  /* Don't inline the rest to avoid unnecessary code duplication.  */
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    result = __lchown (file, owner, group);
+  else
+    result = __chown (file, owner, group);
+  if (result < 0)
+    __atfct_seterrno (errno, fd, buf);
+# endif
+
+  return result;
+
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
new file mode 100644
index 0000000000..6d2e766aa4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c
@@ -0,0 +1,117 @@
+/* Get frequency of the system processor.  powerpc/Linux version.
+   Copyright (C) 2000, 2001, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <ctype.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <libc-internal.h>
+#include <sysdep.h>
+#include <bits/libc-vdso.h>
+
+hp_timing_t
+__get_clockfreq (void)
+{
+  /* We read the information from the /proc filesystem.  /proc/cpuinfo
+     contains at least one line like:
+     timebase        : 33333333
+     We search for this line and convert the number into an integer.  */
+  static hp_timing_t timebase_freq;
+  hp_timing_t result = 0L;
+
+  /* If this function was called before, we know the result.  */
+  if (timebase_freq != 0)
+    return timebase_freq;
+
+  /* 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);
+  if (INTERNAL_SYSCALL_ERROR_P (timebase_freq, err)
+      && INTERNAL_SYSCALL_ERRNO (timebase_freq, err) == ENOSYS)
+#endif
+    {
+      int fd = open ("/proc/cpuinfo", O_RDONLY);
+
+      if (__builtin_expect (fd != -1, 1))
+	{
+	  /* The timebase will be in the 1st 1024 bytes for systems with up
+	     to 8 processors.  If the first read returns less then 1024
+	     bytes read,  we have the whole cpuinfo and can start the scan.
+	     Otherwise we will have to read more to insure we have the
+	     timebase value in the scan.  */
+	  char buf[1024];
+	  ssize_t n;
+
+	  n = read (fd, buf, sizeof (buf));
+	  if (n == sizeof (buf))
+	    {
+	      /* We are here because the 1st read returned exactly sizeof
+	         (buf) bytes.  This implies that we are not at EOF and may
+	         not have read the timebase value yet.  So we need to read
+	         more bytes until we know we have EOF.  We copy the lower
+	         half of buf to the upper half and read sizeof (buf)/2
+	         bytes into the lower half of buf and repeat until we
+	         reach EOF.  We can assume that the timebase will be in
+	         the last 512 bytes of cpuinfo, so two 512 byte half_bufs
+	         will be sufficient to contain the timebase and will
+	         handle the case where the timebase spans the half_buf
+	         boundry.  */
+	      const ssize_t half_buf = sizeof (buf) / 2;
+	      while (n >= half_buf)
+		{
+		  memcpy (buf, buf + half_buf, half_buf);
+		  n = read (fd, buf + half_buf, half_buf);
+		}
+	      if (n >= 0)
+		n += half_buf;
+	    }
+
+	  if (__builtin_expect (n, 1) > 0)
+	    {
+	      char *mhz = memmem (buf, n, "timebase", 7);
+
+	      if (__builtin_expect (mhz != NULL, 1))
+		{
+		  char *endp = buf + n;
+
+		  /* Search for the beginning of the string.  */
+		  while (mhz < endp && (*mhz < '0' || *mhz > '9')
+			 && *mhz != '\n')
+		    ++mhz;
+
+		  while (mhz < endp && *mhz != '\n')
+		    {
+		      if (*mhz >= '0' && *mhz <= '9')
+			{
+			  result *= 10;
+			  result += *mhz - '0';
+			}
+
+		      ++mhz;
+		    }
+		}
+	      timebase_freq = result;
+	    }
+	  close (fd);
+	}
+    }
+
+  return timebase_freq;
+}
diff --git a/sysdeps/generic/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
index f4a170c9e7..b381baa285 100644
--- a/sysdeps/generic/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2005 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
@@ -16,24 +16,27 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <errno.h>
+#include <sysdep.h>
+#include <bp-checks.h>
+#include <stddef.h>
 #include <sys/time.h>
+#include <time.h>
+#include <hp-timing.h>
 
 #undef __gettimeofday
+#include <bits/libc-vdso.h>
 
 /* Get the current time of day and timezone information,
    putting it into *TV and *TZ.  If TZ is NULL, *TZ is not filled.
    Returns 0 on success, -1 on errors.  */
+
 int
 __gettimeofday (tv, tz)
      struct timeval *tv;
      struct timezone *tz;
 {
-  __set_errno (ENOSYS);
-  return -1;
+  return INLINE_VSYSCALL (gettimeofday, 2, CHECK_1 (tv), CHECK_1 (tz));
 }
-stub_warning (gettimeofday)
 
-INTDEF(__gettimeofday)
+INTDEF (__gettimeofday)
 weak_alias (__gettimeofday, gettimeofday)
-#include <stub-tag.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
new file mode 100644
index 0000000000..a8005c1163
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
@@ -0,0 +1,130 @@
+/* Copyright (C) 1998,2000,2001,2002,2003,2004,2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <bp-start.h>
+#include <bp-sym.h>
+
+extern int __cache_line_size;
+weak_extern (__cache_line_size)
+/* The main work is done in the generic function.  */
+#define LIBC_START_MAIN generic_start_main
+#define LIBC_START_DISABLE_INLINE
+#define LIBC_START_MAIN_AUXVEC_ARG
+#define MAIN_AUXVEC_ARG
+#define INIT_MAIN_ARGS
+#include <csu/libc-start.c>
+
+struct startup_info
+  {
+    void *__unbounded sda_base;
+    int (*main) (int, char **, char **, void *);
+    int (*init) (int, char **, char **, void *);
+    void (*fini) (void);
+  };
+
+
+#ifdef SHARED
+# include <sys/time.h>
+# include <dl-vdso.h>
+# undef __gettimeofday
+# undef __clock_gettime
+# undef __clock_getres
+# include <bits/libc-vdso.h>
+
+void *__vdso_gettimeofday;
+void *__vdso_clock_gettime;
+void *__vdso_clock_getres;
+void *__vdso_get_tbfreq;
+
+static inline void _libc_vdso_platform_setup (void)
+  {
+    __vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday",
+  				         "LINUX_2.6.15");
+
+    __vdso_clock_gettime = _dl_vdso_vsym ("__kernel_clock_gettime",
+					  "LINUX_2.6.15");
+
+    __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres",
+				         "LINUX_2.6.15");
+
+    __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_vdso_get_tbfreq",
+				       "LINUX_2.6.15");
+  }
+#endif
+
+int
+/* GKM FIXME: GCC: this should get __BP_ prefix by virtue of the
+   BPs in the arglist of startup_info.main and startup_info.init. */
+  BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av,
+			      char *__unbounded *__unbounded ubp_ev,
+			      ElfW (auxv_t) * __unbounded auxvec,
+			      void (*rtld_fini) (void),
+			      struct startup_info *__unbounded stinfo,
+			      char *__unbounded *__unbounded stack_on_entry)
+{
+#if __BOUNDED_POINTERS__
+  char **argv;
+#else
+# define argv ubp_av
+#endif
+
+  /* the PPC SVR4 ABI says that the top thing on the stack will
+     be a NULL pointer, so if not we assume that we're being called
+     as a statically-linked program by Linux...  */
+  if (*stack_on_entry != NULL)
+    {
+      char *__unbounded * __unbounded temp;
+      /* ...in which case, we have argc as the top thing on the
+         stack, followed by argv (NULL-terminated), envp (likewise),
+         and the auxilary vector.  */
+      /* 32/64-bit agnostic load from stack */
+      argc = *(long int *__unbounded) stack_on_entry;
+      ubp_av = stack_on_entry + 1;
+      ubp_ev = ubp_av + argc + 1;
+#ifdef HAVE_AUX_VECTOR
+      temp = ubp_ev;
+      while (*temp != NULL)
+	++temp;
+      auxvec = (ElfW (auxv_t) *)++ temp;
+#endif
+      rtld_fini = NULL;
+    }
+
+  /* Initialize the __cache_line_size variable from the aux vector.  */
+  for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av)
+    switch (av->a_type)
+      {
+      case AT_DCACHEBSIZE:
+	{
+	  int *cls = &__cache_line_size;
+	  if (cls != NULL)
+	    *cls = av->a_un.a_val;
+	}
+	break;
+      }
+#ifdef SHARED
+  /* Resolve and initialize function pointers for VDSO functions.  */
+  _libc_vdso_platform_setup ();
+#endif
+  return generic_start_main (stinfo->main, argc, ubp_av, auxvec,
+			     stinfo->init, stinfo->fini, rtld_fini,
+			     stack_on_entry);
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist
deleted file mode 100644
index 297e031620..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist
+++ /dev/null
@@ -1,3 +0,0 @@
-clone.S
-kernel_stat.h
-fe_nomask.c
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
index 8ecbb548a2..e945834945 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
@@ -1,5 +1,5 @@
 /* brk system call for Linux/ppc.
-   Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995-97, 1999, 2000, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #define _ERRNO_H	1
@@ -27,28 +27,38 @@
 	.section ".text"
 ENTRY (BP_SYM (__brk))
 	DISCARD_BOUNDS (r3)	/* the bounds are meaningless, so toss 'em */
-
+	mflr	r0
 	stwu    r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
 	stw	r3,8(r1)
+	stw	r0,20(r1)
+	cfi_offset (lr, 4)
 	DO_CALL(SYS_ify(brk))
 	lwz     r6,8(r1)
 #ifdef PIC
-	mflr    r4
+# ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r5
+	addis	r5,r5,__curbrk-1b@ha
+	stw	r3,__curbrk-1b@l(r5)
+# else
 	bl      _GLOBAL_OFFSET_TABLE_@local-4
 	mflr    r5
 	lwz     r5,__curbrk@got(r5)
-	mtlr    r4
 	stw     r3,0(r5)
+# endif
 #else
 	lis     r4,__curbrk@ha
 	stw     r3,__curbrk@l(r4)
 #endif
+	lwz	r0,20(r1)
 	cmplw   r6,r3
 	addi    r1,r1,16
+	mtlr	r0
 	li	r3,0
 	blelr+
 	li      r3,ENOMEM
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (BP_SYM (__brk))
 
 weak_alias (BP_SYM (__brk), BP_SYM (brk))
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
index f232284747..37b777799c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
@@ -1,5 +1,5 @@
 /* Wrapper around clone system call.
-   Copyright (C) 1997,98,99,2000,02,2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,98,99,2000,02,04,2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #define _ERRNO_H	1
@@ -49,6 +49,7 @@ ENTRY (BP_SYM (__clone))
 
 	/* Set up stack frame for parent.  */
 	stwu	r1,-32(r1)
+	cfi_adjust_cfa_offset (32)
 #ifdef RESET_PID
 	stmw	r28,16(r1)
 #else
@@ -83,6 +84,10 @@ ENTRY (BP_SYM (__clone))
 	mr	r6,r8
 	mr	r7,r9
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	/* Do the call.  */
 	DO_CALL(SYS_ify(clone))
 
@@ -132,11 +137,13 @@ L(parent):
 #endif
 	addi	r1,r1,32
 	bnslr+
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 
 L(badargs):
 	li	r3,EINVAL
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
+
+	cfi_startproc
 END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c
index 2c85a3a9e9..8d3b9ad1f4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c
@@ -1,5 +1,5 @@
 /* Procedure definition for FE_NOMASK_ENV for Linux/ppc.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2006 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
@@ -23,11 +23,11 @@
 #include <unistd.h>
 #include <sysdep.h>
 #include <sys/prctl.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_NEW_PRCTL_SYSCALL == 0
 /* This is rather fiddly under Linux.  We don't have direct access,
-   and there is no system call, but we can change the bits 
+   and there is no system call, but we can change the bits
    in a signal handler's context...  */
 
 static struct sigaction oact;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
new file mode 100644
index 0000000000..9f70f795bc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc32 specific routines.
+powerpc/powerpc32/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
index e79d74cb75..e83f7f04b7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002,2005,2006 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
@@ -23,12 +23,12 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_ftruncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-extern int have_no_truncate64;
+extern int __have_no_truncate64;
 #endif
 
 
@@ -39,7 +39,7 @@ __ftruncate64 (fd, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -57,7 +57,7 @@ __ftruncate64 (fd, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
@@ -74,5 +74,5 @@ weak_alias (__ftruncate64, ftruncate64)
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/ftruncate64.c>
+# include <misc/ftruncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
new file mode 100644
index 0000000000..c28c34664c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
@@ -0,0 +1,286 @@
+/* Save current context, powerpc32 common.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+/* This is the common implementation of getcontext for powerpc32.
+   It not complete in itself should be included in to a framework that 
+   defines:
+     __CONTEXT_FUNC_NAME
+   and if appropriate:
+     __CONTEXT_ENABLE_FPRS
+     __CONTEXT_ENABLE_VRS
+   Any archecture that implements the Vector unit is assumed to also 
+   implement the floating unit.  */
+
+/* Stack frame offsets.  */
+#define _FRAME_BACKCHAIN	0
+#define _FRAME_LR_SAVE		4
+#define _FRAME_PARM_SAVE1	8
+#define _FRAME_PARM_SAVE2	12
+#define _FRAME_PARM_SAVE3	16
+#define _FRAME_PARM_SAVE4	20
+
+#ifdef __CONTEXT_ENABLE_VRS
+	.machine	"altivec"
+#endif
+ENTRY(__CONTEXT_FUNC_NAME)
+	stwu	r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
+/* Insure that the _UC_REGS start on a quadword boundary.  */
+	stw	r3,_FRAME_PARM_SAVE1(r1)
+	addi	r3,r3,_UC_REG_SPACE+12
+	clrrwi  r3,r3,4
+
+/* Save the general purpose registers */
+	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
+	mflr	r0
+	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
+	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
+/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
+   return address.  */
+	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
+	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
+	stw	r0,_FRAME_LR_SAVE+16(r1)
+	cfi_offset (lr, _FRAME_LR_SAVE)
+	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
+	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
+	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
+	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
+	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
+	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
+	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
+	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
+	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
+	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
+	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
+	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
+	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
+	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
+	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
+	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
+	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
+	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
+	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
+	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
+	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
+	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
+	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
+	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
+	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
+	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
+	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
+/* Save the value of R1.  We had to push the stack before we
+   had the address of uc_reg_space.  So compute the address of
+   the callers stack pointer and save it as R1.  */
+	addi	r8,r1,16
+	li	r0,0
+/* Save the count, exception and condition registers.  */
+	mfctr	r11
+	mfxer	r10
+	mfcr	r9
+	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
+	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
+	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
+	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
+/* Set the return value of getcontext to "success".  R3 is the only
+   register whose value is not preserved in the saved context.  */
+	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
+
+/* Zero fill fields that can't be set in user state. */
+	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
+	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
+
+#ifdef __CONTEXT_ENABLE_FPRS
+/* Save the floating-point registers */
+	stfd	fp0,_UC_FREGS+(0*8)(r3)
+	stfd	fp1,_UC_FREGS+(1*8)(r3)
+	stfd	fp2,_UC_FREGS+(2*8)(r3)
+	stfd	fp3,_UC_FREGS+(3*8)(r3)
+	stfd	fp4,_UC_FREGS+(4*8)(r3)
+	stfd	fp5,_UC_FREGS+(5*8)(r3)
+	stfd	fp6,_UC_FREGS+(6*8)(r3)
+	stfd	fp7,_UC_FREGS+(7*8)(r3)
+	stfd	fp8,_UC_FREGS+(8*8)(r3)
+	stfd	fp9,_UC_FREGS+(9*8)(r3)
+	stfd	fp10,_UC_FREGS+(10*8)(r3)
+	stfd	fp11,_UC_FREGS+(11*8)(r3)
+	stfd	fp12,_UC_FREGS+(12*8)(r3)
+	stfd	fp13,_UC_FREGS+(13*8)(r3)
+	stfd	fp14,_UC_FREGS+(14*8)(r3)
+	stfd	fp15,_UC_FREGS+(15*8)(r3)
+	stfd	fp16,_UC_FREGS+(16*8)(r3)
+	stfd	fp17,_UC_FREGS+(17*8)(r3)
+	stfd	fp18,_UC_FREGS+(18*8)(r3)
+	stfd	fp19,_UC_FREGS+(19*8)(r3)
+	stfd	fp20,_UC_FREGS+(20*8)(r3)
+	stfd	fp21,_UC_FREGS+(21*8)(r3)
+	stfd	fp22,_UC_FREGS+(22*8)(r3)
+	stfd	fp23,_UC_FREGS+(23*8)(r3)
+	stfd	fp24,_UC_FREGS+(24*8)(r3)
+	stfd	fp25,_UC_FREGS+(25*8)(r3)
+	stfd	fp26,_UC_FREGS+(26*8)(r3)
+	stfd	fp27,_UC_FREGS+(27*8)(r3)
+	stfd	fp28,_UC_FREGS+(28*8)(r3)
+	stfd	fp29,_UC_FREGS+(29*8)(r3)
+	mffs	fp0
+	stfd	fp30,_UC_FREGS+(30*8)(r3)
+	stfd	fp31,_UC_FREGS+(31*8)(r3)
+	stfd	fp0,_UC_FREGS+(32*8)(r3)
+
+# ifdef __CONTEXT_ENABLE_VRS
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	mtlr    r8
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	mtlr    r8
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+
+	la	r10,(_UC_VREGS)(r3)
+	la	r9,(_UC_VREGS+16)(r3)
+	
+	beq	2f	/* L(no_vec) */
+/* address of the combined VSCR/VSAVE quadword.  */	
+	la	r8,(_UC_VREGS+512)(r3)
+
+/* Save the vector registers */
+	stvx  v0,0,r10
+	stvx  v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+/* We need to get the Vector Status and Control Register early to avoid
+   store order problems later with the VSAVE register that shares the
+   same quadword.  */
+	mfvscr	v0
+
+	stvx  v2,0,r10
+	stvx  v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx	v0,0,r8
+	
+	stvx  v4,0,r10
+	stvx  v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v6,0,r10
+	stvx  v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v8,0,r10
+	stvx  v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v10,0,r10
+	stvx  v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v12,0,r10
+	stvx  v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v14,0,r10
+	stvx  v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v16,0,r10
+	stvx  v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v18,0,r10
+	stvx  v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v20,0,r10
+	stvx  v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v22,0,r10
+	stvx  v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v24,0,r10
+	stvx  v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v26,0,r10
+	stvx  v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v28,0,r10
+	stvx  v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mfspr	r0,VRSAVE
+	stvx  v30,0,r10
+	stvx  v31,0,r9
+
+ 	stw	r0,0(r8)
+
+2: /* L(no_vec): */
+# endif
+#endif
+/* We need to set up parms and call sigprocmask which will clobber
+   volatile registers. So before the call we need to retrieve the
+   original ucontext ptr (parm1) from stack and store the UC_REGS_PTR
+   (current R3).  */
+	lwz	r12,_FRAME_PARM_SAVE1(r1)
+	li	r4,0
+	stw	r3,_UC_REGS_PTR(r12)
+	addi	r5,r12,_UC_SIGMASK
+	li	r3,SIG_BLOCK
+	bl	__sigprocmask@local
+
+	lwz	r0,_FRAME_LR_SAVE+16(r1)
+	addi	r1,r1,16
+	mtlr	r0
+	blr
+END(__CONTEXT_FUNC_NAME)
+
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
index 4c75354a5f..dad1074034 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 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
@@ -14,362 +14,53 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
 #include "ucontext_i.h"
 
-	.machine	"altivec"
-ENTRY(__getcontext)
-	stwu	r1,-16(r1)
-/* Insure that the _UC_REGS start on a quadword boundary.  */
-	stw	r3,_FRAME_PARM_SAVE1(r1)
-	addi	r3,r3,_UC_REG_SPACE+12
-	clrrwi  r3,r3,4
+#define __CONTEXT_FUNC_NAME __getcontext
+#define __CONTEXT_ENABLE_FPRS 1
+#define __CONTEXT_ENABLE_VRS 1
 
-/* Save the general purpose registers */
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	mflr	r0
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
-/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
-   return address.  */
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r0,_FRAME_LR_SAVE+16(r1)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-/* Save the value of R1.  We had to push the stack before we
-   had the address of uc_reg_space.  So compute the address of
-   the callers stack pointer and save it as R1.  */
-	addi	r8,r1,16
-	li	r0,0
-/* Save the count, exception and condition registers.  */
-	mfctr	r11
-	mfxer	r10
-	mfcr	r9
-	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
-	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
-	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
-	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
-/* Set the return value of getcontext to "success".  R3 is the only
-   register whose value is not preserved in the saved context.  */
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
+/* Size of ucontext in GLIBC_2.3.4 and later.  */
+#define _UC_SIZE_2_3_4	1184
 
-/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
-
-#ifdef PIC
-	mflr    r8
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
-#else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
-#endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-
-	la	r10,(_UC_VREGS)(r3)
-	la	r9,(_UC_VREGS+16)(r3)
-	
-	beq	L(no_vec)
-/* address of the combined VSCR/VSAVE quadword.  */	
-	la	r8,(_UC_VREGS+512)(r3)
-
-/* Save the vector registers */
-	stvx  v0,0,r10
-	stvx  v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-/* We need to get the Vector Status and Control Register early to avoid
-   store order problems later with the VSAVE register that shares the
-   same quadword.  */
-	mfvscr	v0
-
-	stvx  v2,0,r10
-	stvx  v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx	v0,0,r8
-	
-	stvx  v4,0,r10
-	stvx  v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v6,0,r10
-	stvx  v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v8,0,r10
-	stvx  v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v10,0,r10
-	stvx  v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v12,0,r10
-	stvx  v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v14,0,r10
-	stvx  v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v16,0,r10
-	stvx  v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v18,0,r10
-	stvx  v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v20,0,r10
-	stvx  v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v22,0,r10
-	stvx  v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v24,0,r10
-	stvx  v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v26,0,r10
-	stvx  v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v28,0,r10
-	stvx  v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mfspr	r0,VRSAVE
-	stvx  v30,0,r10
-	stvx  v31,0,r9
-
- 	stw	r0,0(r8)
-
-L(no_vec):
-/* We need to set up parms and call sigprocmask which will clobber
-   volatile registers. So before the call we need to retrieve the
-   original ucontext ptr (parm1) from stack and store the UC_REGS_PTR
-   (current R3).  */
-	lwz	r12,_FRAME_PARM_SAVE1(r1)
+#ifdef __ASSUME_SWAPCONTEXT_SYSCALL
+	.section ".text";
+ENTRY (__getcontext)
 	li	r4,0
-	stw	r3,_UC_REGS_PTR(r12)
-	addi	r5,r12,_UC_SIGMASK
-	li	r3,SIG_BLOCK
-	bl	JUMPTARGET(__sigprocmask)
-
-	lwz	r0,_FRAME_LR_SAVE+16(r1)
-	addi	r1,r1,16
-	mtlr	r0
+	li	r5,_UC_SIZE_2_3_4;
+	DO_CALL (SYS_ify (swapcontext));
+	bso-	cr0,1f
+/* the kernel does not set the return code for the success case */
+	li	r3,0
 	blr
+1:
+	b	__syscall_error@local
 END(__getcontext)
+#else
+# include "getcontext-common.S"
+#endif
 
 versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
-
 	compat_text_section
-ENTRY(__novec_getcontext)
-	/*
-	 * Since we are not attempting to save the altivec registers,
-	 * there is no need to get the register storage space
-	 * aligned on a 16-byte boundary.
-	 */
-	addi	r3,r3,_UC_REG_SPACE
-	stw	r3,_UC_REGS_PTR - _UC_REG_SPACE(r3)
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	stw	r1,_UC_GREGS+(PT_R1*4)(r3)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-	mfctr	r0
-	stw	r0,_UC_GREGS+(PT_CTR*4)(r3)
-	mfxer	r0
-	stw	r0,_UC_GREGS+(PT_XER*4)(r3)
-	mfcr	r0
-	stw	r0,_UC_GREGS+(PT_CCR*4)(r3)
-
-	/* Set the return value of getcontext to "success".  R3 is the only
-	   register whose value is not preserved in the saved context.  */
-	li	r0,0
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
-
-	/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-	/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
+	
+# undef __CONTEXT_FUNC_NAME	
+# define __CONTEXT_FUNC_NAME __novec_getcontext
+# undef __CONTEXT_ENABLE_VRS
 
-	addi	r5,r3,_UC_SIGMASK - _UC_REG_SPACE
-	li	r4,0
-	li	r3,SIG_BLOCK
-	bl	JUMPTARGET(__sigprocmask)
+# clude "getcontext-common.S"
 
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
-END(__novec_getcontext)
 	.previous
 
 compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
@@ -378,13 +69,13 @@ compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
 
-#define _ERRNO_H	1
-#include <bits/errno.h>
+# define _ERRNO_H	1
+# include <bits/errno.h>
 
 	compat_text_section
 ENTRY (__getcontext_stub)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__getcontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
index 5615718e11..9451f9eb36 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
@@ -1,5 +1,5 @@
 /* Set up a context to call a function.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <shlib-compat.h>
@@ -26,9 +26,7 @@
 
 ENTRY(__makecontext)
 	/* Set up the first 7 args to the function in its registers */
-	addi	r11,r3,_UC_REG_SPACE+12
-	clrrwi  r11,r11,4
-	stw	r11,_UC_REGS_PTR(r3)
+	lwz	r11,_UC_REGS_PTR(r3)
 	stw	r6,_UC_GREGS+(PT_R3*4)(r11)
 	stw	r7,_UC_GREGS+(PT_R4*4)(r11)
 	stw	r8,_UC_GREGS+(PT_R5*4)(r11)
@@ -49,10 +47,12 @@ ENTRY(__makecontext)
 	/* Set the function's LR to point to the exitcode below. */
 #ifdef PIC
 	mflr	r0
+	cfi_register(lr,r0)
 	bl	1f
 1:	mflr	r6
 	addi	r6,r6,L(exitcode)-1b
 	mtlr	r0
+	cfi_same_value (lr)
 #else
 	lis	r6,L(exitcode)@ha
 	addi	r6,r6,L(exitcode)@l
@@ -101,7 +101,7 @@ ENTRY(__makecontext)
 L(exitcode):
 	mr.	r3,r31
 	beq	4f
-	bl	JUMPTARGET(__setcontext)
+	bl	__setcontext@local
 4:	bl	HIDDEN_JUMPTARGET(exit)
 	b	4b
 
@@ -136,10 +136,12 @@ ENTRY(__novec_makecontext)
 	/* Set the function's LR to point to the exitcode below. */
 #ifdef PIC
 	mflr	r0
+	cfi_register(lr,r0)
 	bl	1f
 1:	mflr	r6
 	addi	r6,r6,L(novec_exitcode)-1b
 	mtlr	r0
+	cfi_same_value (lr)
 #else
 	lis	r6,L(novec_exitcode)@ha
 	addi	r6,r6,L(novec_exitcode)@l
@@ -188,7 +190,7 @@ ENTRY(__novec_makecontext)
 L(novec_exitcode):
 	mr.	r3,r31
 	beq	4f
-	bl	JUMPTARGET(__novec_setcontext)
+	bl	__novec_setcontext@local
 4:	bl	HIDDEN_JUMPTARGET(exit)
 	b	4b
 
@@ -206,7 +208,7 @@ compat_symbol (libc, __novec_makecontext, makecontext, GLIBC_2_3_3)
 	compat_text_section
 ENTRY (__makecontext_stub)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__makecontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
index 495c98ab97..4d9fa263c4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
@@ -58,7 +58,7 @@ __libc_pread (fd, buf, count, offset)
 
       return result;
     }
-  
+
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   /* On PPC32 64bit values are aligned in odd/even register pairs.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
index d4fe1eea2d..9527554e9b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
index 3727fa7a42..32383f4301 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
index 080c88cf29..acc250a88f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
new file mode 100644
index 0000000000..40a7a24f19
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -0,0 +1,293 @@
+/* Jump to a new context powerpc32 common.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+/* This is the common implementation of setcontext for powerpc32.
+   It not complete in itself should be included in to a framework that 
+   defines:
+     __CONTEXT_FUNC_NAME
+   and if appropriate:
+     __CONTEXT_ENABLE_FPRS
+     __CONTEXT_ENABLE_VRS
+   Any archecture that implements the Vector unit is assumed to also 
+   implement the floating unit.  */
+
+/* Stack frame offsets.  */
+#define _FRAME_BACKCHAIN	0
+#define _FRAME_LR_SAVE		4
+#define _FRAME_PARM_SAVE1	8
+#define _FRAME_PARM_SAVE2	12
+#define _FRAME_PARM_SAVE3	16
+#define _FRAME_PARM_SAVE4	20
+
+#ifdef __CONTEXT_ENABLE_VRS
+	.machine	"altivec"
+#endif
+ENTRY(__CONTEXT_FUNC_NAME)
+	mflr	r0
+	stwu	r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
+	stw	r0,20(r1)
+	cfi_offset (lr, _FRAME_LR_SAVE)
+	stw	r31,12(r1)
+	cfi_offset(r31,-4)
+	lwz	r31,_UC_REGS_PTR(r3)
+
+	/*
+	 * If this ucontext refers to the point where we were interrupted
+	 * by a signal, we have to use the rt_sigreturn system call to
+	 * return to the context so we get both LR and CTR restored.
+	 *
+	 * Otherwise, the context we are restoring is either just after
+	 * a procedure call (getcontext/swapcontext) or at the beginning
+	 * of a procedure call (makecontext), so we don't need to restore
+	 * r0, xer, ctr.  We don't restore r2 since it will be used as
+	 * the TLS pointer.
+	 */
+	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
+	cmpwi	r0,0
+	bne	4f	/* L(do_sigret) */
+
+	/* Restore the signal mask */
+	li	r5,0
+	addi	r4,r3,_UC_SIGMASK
+	li	r3,SIG_SETMASK
+	bl	__sigprocmask@local
+	cmpwi	r3,0
+	bne	3f	/* L(error_exit) */
+
+#ifdef __CONTEXT_ENABLE_FPRS
+# ifdef __CONTEXT_ENABLE_VRS
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	mtlr    r8
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	mtlr    r8
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+	la	r10,(_UC_VREGS)(r31)
+	beq	2f	/* L(has_no_vec) */
+
+	lwz   r0,(32*16)(r10)
+	li    r9,(32*16)
+	cmpwi r0,0
+	mtspr VRSAVE,r0
+	beq	2f	/* L(has_no_vec) */
+
+	lvx   v19,r9,r10
+	la    r9,(16)(r10)
+
+	lvx   v0,0,r10
+	lvx   v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mtvscr  v19
+	lvx   v2,0,r10
+	lvx   v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v4,0,r10
+	lvx   v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v6,0,r10
+	lvx   v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v8,0,r10
+	lvx   v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v12,0,r10
+	lvx   v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v14,0,r10
+	lvx   v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v16,0,r10
+	lvx   v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v18,0,r10
+	lvx   v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v20,0,r10
+	lvx   v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v22,0,r10
+	lvx   v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v24,0,r10
+	lvx   v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v26,0,r10
+	lvx   v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v28,0,r10
+	lvx   v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v30,0,r10
+	lvx   v31,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+
+2: /* L(has_no_vec): */
+# endif /* __CONTEXT_ENABLE_VRS */
+	/* Restore the floating-point registers */
+	lfd	fp31,_UC_FREGS+(32*8)(r31)
+	lfd	fp0,_UC_FREGS+(0*8)(r31)
+	mtfsf	0xff,fp31
+	lfd	fp1,_UC_FREGS+(1*8)(r31)
+	lfd	fp2,_UC_FREGS+(2*8)(r31)
+	lfd	fp3,_UC_FREGS+(3*8)(r31)
+	lfd	fp4,_UC_FREGS+(4*8)(r31)
+	lfd	fp5,_UC_FREGS+(5*8)(r31)
+	lfd	fp6,_UC_FREGS+(6*8)(r31)
+	lfd	fp7,_UC_FREGS+(7*8)(r31)
+	lfd	fp8,_UC_FREGS+(8*8)(r31)
+	lfd	fp9,_UC_FREGS+(9*8)(r31)
+	lfd	fp10,_UC_FREGS+(10*8)(r31)
+	lfd	fp11,_UC_FREGS+(11*8)(r31)
+	lfd	fp12,_UC_FREGS+(12*8)(r31)
+	lfd	fp13,_UC_FREGS+(13*8)(r31)
+	lfd	fp14,_UC_FREGS+(14*8)(r31)
+	lfd	fp15,_UC_FREGS+(15*8)(r31)
+	lfd	fp16,_UC_FREGS+(16*8)(r31)
+	lfd	fp17,_UC_FREGS+(17*8)(r31)
+	lfd	fp18,_UC_FREGS+(18*8)(r31)
+	lfd	fp19,_UC_FREGS+(19*8)(r31)
+	lfd	fp20,_UC_FREGS+(20*8)(r31)
+	lfd	fp21,_UC_FREGS+(21*8)(r31)
+	lfd	fp22,_UC_FREGS+(22*8)(r31)
+	lfd	fp23,_UC_FREGS+(23*8)(r31)
+	lfd	fp24,_UC_FREGS+(24*8)(r31)
+	lfd	fp25,_UC_FREGS+(25*8)(r31)
+	lfd	fp26,_UC_FREGS+(26*8)(r31)
+	lfd	fp27,_UC_FREGS+(27*8)(r31)
+	lfd	fp28,_UC_FREGS+(28*8)(r31)
+	lfd	fp29,_UC_FREGS+(29*8)(r31)
+	lfd	fp30,_UC_FREGS+(30*8)(r31)
+	lfd	fp31,_UC_FREGS+(31*8)(r31)
+#endif /* __CONTEXT_ENABLE_FPRS */
+
+	/* Restore LR and CCR, and set CTR to the NIP value */
+	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
+	mtlr	r3
+	mtctr	r4
+	mtcr	r5
+
+	/* Restore the general registers */
+	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
+	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
+	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
+	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
+	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
+	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
+	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
+	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
+	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
+	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
+	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
+	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
+	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
+	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
+	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
+	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
+	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
+	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
+	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
+	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
+	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
+	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
+	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
+	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
+	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
+	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
+	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
+	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
+
+	bctr
+
+3: /* L(error_exit): */
+	lwz	r31,12(r1)
+	lwz	r0,20(r1)
+	addi	r1,r1,16
+	mtlr	r0
+	blr
+
+
+4: /* L(do_sigret): */
+	addi	r1,r3,-0xd0
+	li	r0,SYS_ify(rt_sigreturn)
+	sc
+	/* NOTREACHED */
+
+END (__CONTEXT_FUNC_NAME)
+
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
index 2d4fa9910e..1f2e250057 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S
@@ -1,5 +1,5 @@
 /* Jump to a new context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006 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
@@ -14,383 +14,55 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
 #include "ucontext_i.h"
 
-	.machine	"altivec"
-ENTRY(__setcontext)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r31,12(r1)
-	lwz	r31,_UC_REGS_PTR(r3)
-
-	/*
-	 * If this ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(do_sigret)
-
-	/* Restore the signal mask */
-	li	r5,0
-	addi	r4,r3,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	JUMPTARGET(__sigprocmask)
-	cmpwi	r3,0
-	bne	L(error_exit)
-
-#ifdef PIC
-	mflr    r8
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
+#define __CONTEXT_FUNC_NAME __setcontext
+#define __CONTEXT_ENABLE_FPRS 1
+#define __CONTEXT_ENABLE_VRS 1
+
+/* Size of ucontext in GLIBC_2.3.4 and later.  */
+#define _UC_SIZE_2_3_4	1184
+
+#ifdef __ASSUME_SWAPCONTEXT_SYSCALL
+	.section ".text";
+ENTRY (__setcontext)
+	mr	r4,r3
+	li	r3,0
+	li	r5,_UC_SIZE_2_3_4;
+	DO_CALL (SYS_ify (swapcontext));
+	bso-	cr0,1f
+/* the kernel does not set the return code for the success case */
+	li	r3,0
+	blr
+1:
+	b	__syscall_error@local
+END(__setcontext)
 #else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
+# include "setcontext-common.S"
 #endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-	la	r10,(_UC_VREGS)(r31)
-	beq	L(has_no_vec)
-
-	lwz   r0,(32*16)(r10)
-	li    r9,(32*16)
-	cmpwi r0,0
-	mtspr VRSAVE,r0
-	beq   L(has_no_vec)
-
-	lvx   v19,r9,r10
-	la    r9,(16)(r10)
-
-	lvx   v0,0,r10
-	lvx   v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mtvscr  v19
-	lvx   v2,0,r10
-	lvx   v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v4,0,r10
-	lvx   v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v6,0,r10
-	lvx   v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v8,0,r10
-	lvx   v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v12,0,r10
-	lvx   v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v14,0,r10
-	lvx   v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v16,0,r10
-	lvx   v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v18,0,r10
-	lvx   v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v20,0,r10
-	lvx   v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v22,0,r10
-	lvx   v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v24,0,r10
-	lvx   v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v26,0,r10
-	lvx   v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v28,0,r10
-	lvx   v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v30,0,r10
-	lvx   v31,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-
-L(has_no_vec):
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(error_exit):
-	lwz	r31,12(r1)
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
-
-L(do_sigret):
-	addi	r1,r3,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
-
-END (__setcontext)
 
 versioned_symbol (libc, __setcontext, setcontext, GLIBC_2_3_4)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 
 	compat_text_section
-ENTRY(__novec_setcontext)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r31,12(r1)
-	lwz	r31,_UC_REGS_PTR(r3)
-
-	/*
-	 * If this ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(novec_do_sigret)
-
-	/* Restore the signal mask */
-	li	r5,0
-	addi	r4,r3,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	JUMPTARGET(__sigprocmask)
-	cmpwi	r3,0
-	bne	L(novec_error_exit)
-
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(novec_error_exit):
-	lwz	r31,12(r1)
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
+	
+# undef __CONTEXT_FUNC_NAME	
+# define __CONTEXT_FUNC_NAME __novec_setcontext
+# undef __CONTEXT_ENABLE_VRS
 
-L(novec_do_sigret):
-	addi	r1,r3,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
+# include "setcontext-common.S"
 
-END (__novec_setcontext)
 	.previous
 
 compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
@@ -399,13 +71,13 @@ compat_symbol (libc, __novec_setcontext, setcontext, GLIBC_2_3_3)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_3)
 
-#define _ERRNO_H	1
-#include <bits/errno.h>
+# define _ERRNO_H	1
+# include <bits/errno.h>
 
 	compat_text_section
 ENTRY (__setcontext_stub)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__setcontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
index c52ad9babf..0bb5bef78b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,99, 2003, 2006 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
@@ -13,8 +13,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep-cancel.h>
 #include <socketcall.h>
@@ -39,15 +39,20 @@
 #define NARGS 3
 #endif
 
+/* 0(r1) and 4(r1) are reserved by the ABI, 8(r1), 12(r1), 16(r1) are used
+   for temp saves.  44(r1) is used to save r30.  */
 #define stackblock 20
 
 #ifndef __socket
-#define __socket P(__,socket)
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
 	.text
 ENTRY(__socket)
-	cfi_startproc
 	stwu r1,-48(r1)
 	cfi_adjust_cfa_offset(48)
 #if NARGS >= 1
@@ -69,12 +74,6 @@ ENTRY(__socket)
 	stw  r8,20+stackblock(r1)
 #endif
 #if NARGS >= 7
-	stw  r9,24+stackblock(r1)
-#endif
-#if NARGS >= 8
-	stw  r10,28+stackblock(r1)
-#endif
-#if NARGS >= 9
 #error too many arguments!
 #endif
 
@@ -94,6 +93,7 @@ ENTRY(__socket)
 	mflr	r9
 	stw	r9,52(r1)
 	cfi_offset (lr, 4)
+	CGOTSETUP
 	CENABLE
 	stw	r3,16(r1)
 	li	r3,P(SOCKOP_,socket)
@@ -107,13 +107,15 @@ ENTRY(__socket)
 	lwz	r4,52(r1)
 	lwz	r0,12(r1)
 	lwz	r3,8(r1)
+	CGOTRESTORE
 	mtlr	r4
 	mtcr	r0
 	addi	r1,r1,48
 	PSEUDO_RET
 #endif
-	cfi_endproc
 
 PSEUDO_END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
new file mode 100644
index 0000000000..0c7b945ed2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -0,0 +1,517 @@
+/* Save current context and jump to a new context.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
+
+/* This is the common implementation of setcontext for powerpc32.
+   It not complete in itself should be included in to a framework that 
+   defines:
+     __CONTEXT_FUNC_NAME
+   and if appropriate:
+     __CONTEXT_ENABLE_FPRS
+     __CONTEXT_ENABLE_VRS
+   Any archecture that implements the Vector unit is assumed to also 
+   implement the floating unit.  */
+
+/* Stack frame offsets.  */
+#define _FRAME_BACKCHAIN	0
+#define _FRAME_LR_SAVE		4
+#define _FRAME_PARM_SAVE1	8
+#define _FRAME_PARM_SAVE2	12
+#define _FRAME_PARM_SAVE3	16
+#define _FRAME_PARM_SAVE4	20
+
+#ifdef __CONTEXT_ENABLE_VRS
+	.machine	"altivec"
+#endif
+ENTRY(__CONTEXT_FUNC_NAME)
+	stwu	r1,-16(r1)
+	cfi_adjust_cfa_offset (16)
+/* Insure that the _UC_REGS start on a quadword boundary.  */
+	stw	r3,_FRAME_PARM_SAVE1(r1)
+	addi	r3,r3,_UC_REG_SPACE+12
+	stw	r4,_FRAME_PARM_SAVE2(r1)	/* new context pointer */
+	clrrwi  r3,r3,4
+
+/* Save the general purpose registers */
+	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
+	mflr	r0
+	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
+	stw	r4,_UC_GREGS+(PT_R4*4)(r3)			
+/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
+   return address.  */
+	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
+	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
+	stw	r0,_FRAME_LR_SAVE+16(r1)
+	cfi_offset (lr, _FRAME_LR_SAVE)
+	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
+	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
+	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
+	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
+	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
+	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
+	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
+	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
+	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
+	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
+	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
+	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
+	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
+	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
+	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
+	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
+	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
+	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
+	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
+	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
+	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
+	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
+	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
+	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
+	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
+	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
+	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
+	
+/* Save the value of R1.  We had to push the stack before we
+   had the address of uc_reg_space.  So compute the address of
+   the callers stack pointer and save it as R1.  */
+	addi	r8,r1,16
+	li	r0,0
+/* Save the count, exception and condition registers.  */
+	mfctr	r11
+	mfxer	r10
+	mfcr	r9
+	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
+	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
+	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
+	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
+/* Set the return value of getcontext to "success".  R3 is the only
+   register whose value is not preserved in the saved context.  */
+	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
+
+	/* Zero fill fields that can't be set in user state. */
+	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
+	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
+
+#ifdef __CONTEXT_ENABLE_FPRS
+	/* Save the floating-point registers */
+	stfd	fp0,_UC_FREGS+(0*8)(r3)
+	stfd	fp1,_UC_FREGS+(1*8)(r3)
+	stfd	fp2,_UC_FREGS+(2*8)(r3)
+	stfd	fp3,_UC_FREGS+(3*8)(r3)
+	stfd	fp4,_UC_FREGS+(4*8)(r3)
+	stfd	fp5,_UC_FREGS+(5*8)(r3)
+	stfd	fp6,_UC_FREGS+(6*8)(r3)
+	stfd	fp7,_UC_FREGS+(7*8)(r3)
+	stfd	fp8,_UC_FREGS+(8*8)(r3)
+	stfd	fp9,_UC_FREGS+(9*8)(r3)
+	stfd	fp10,_UC_FREGS+(10*8)(r3)
+	stfd	fp11,_UC_FREGS+(11*8)(r3)
+	stfd	fp12,_UC_FREGS+(12*8)(r3)
+	stfd	fp13,_UC_FREGS+(13*8)(r3)
+	stfd	fp14,_UC_FREGS+(14*8)(r3)
+	stfd	fp15,_UC_FREGS+(15*8)(r3)
+	stfd	fp16,_UC_FREGS+(16*8)(r3)
+	stfd	fp17,_UC_FREGS+(17*8)(r3)
+	stfd	fp18,_UC_FREGS+(18*8)(r3)
+	stfd	fp19,_UC_FREGS+(19*8)(r3)
+	stfd	fp20,_UC_FREGS+(20*8)(r3)
+	stfd	fp21,_UC_FREGS+(21*8)(r3)
+	stfd	fp22,_UC_FREGS+(22*8)(r3)
+	stfd	fp23,_UC_FREGS+(23*8)(r3)
+	stfd	fp24,_UC_FREGS+(24*8)(r3)
+	stfd	fp25,_UC_FREGS+(25*8)(r3)
+	stfd	fp26,_UC_FREGS+(26*8)(r3)
+	stfd	fp27,_UC_FREGS+(27*8)(r3)
+	stfd	fp28,_UC_FREGS+(28*8)(r3)
+	stfd	fp29,_UC_FREGS+(29*8)(r3)
+	mffs	fp0
+	stfd	fp30,_UC_FREGS+(30*8)(r3)
+	stfd	fp31,_UC_FREGS+(31*8)(r3)
+	stfd	fp0,_UC_FREGS+(32*8)(r3)
+	
+# ifdef __CONTEXT_ENABLE_VRS
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,1f
+1:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	mtlr    r8
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	mtlr    r8
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+
+	la	r10,(_UC_VREGS)(r3)
+	la	r9,(_UC_VREGS+16)(r3)
+	
+/*	beq	L(no_vec)*/
+	beq	2f
+/* address of the combined VSCR/VSAVE quadword.  */	
+	la	r8,(_UC_VREGS+512)(r3)
+
+/* Save the vector registers */
+	stvx  v0,0,r10
+	stvx  v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+/* We need to get the Vector Status and Control Register early to avoid
+   store order problems later with the VSAVE register that shares the
+   same quadword.  */
+	mfvscr	v0
+
+	stvx  v2,0,r10
+	stvx  v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+	
+	stvx	v0,0,r8
+
+	stvx  v4,0,r10
+	stvx  v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v6,0,r10
+	stvx  v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v8,0,r10
+	stvx  v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v10,0,r10
+	stvx  v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v12,0,r10
+	stvx  v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v14,0,r10
+	stvx  v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v16,0,r10
+	stvx  v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v18,0,r10
+	stvx  v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v20,0,r10
+	stvx  v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v22,0,r10
+	stvx  v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v24,0,r10
+	stvx  v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v26,0,r10
+	stvx  v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	stvx  v28,0,r10
+	stvx  v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mfvscr	v0
+	stvx  v30,0,r10
+	stvx  v31,0,r9
+ 	stw	r0,0(r8)
+	
+2: /*L(no_vec):*/
+# endif /* __CONTEXT_ENABLE_VRS */
+#endif /* __CONTEXT_ENABLE_FPRS */
+
+/* Restore ucontext (parm1) from stack.  */
+	lwz	r12,_FRAME_PARM_SAVE1(r1)
+	li	r4,0
+	stw	r3,_UC_REGS_PTR(r12)
+	addi	r5,r12,_UC_SIGMASK
+	li	r3,SIG_SETMASK
+	bl	__sigprocmask@local
+	cmpwi	r3,0
+	bne	3f	/* L(error_exit) */
+
+	/*
+	 * If the new ucontext refers to the point where we were interrupted
+	 * by a signal, we have to use the rt_sigreturn system call to
+	 * return to the context so we get both LR and CTR restored.
+	 *
+	 * Otherwise, the context we are restoring is either just after
+	 * a procedure call (getcontext/swapcontext) or at the beginning
+	 * of a procedure call (makecontext), so we don't need to restore
+	 * r0, xer, ctr.  We don't restore r2 since it will be used as
+	 * the TLS pointer.
+	 */
+	lwz	r4,_FRAME_PARM_SAVE2(r1)
+	lwz	r31,_UC_REGS_PTR(r4)
+	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
+	cmpwi	r0,0
+	bne	4f	/* L(do_sigret) */
+
+#ifdef __CONTEXT_ENABLE_FPRS
+# ifdef __CONTEXT_ENABLE_VRS
+
+#  ifdef PIC
+	mflr    r8
+#   ifdef HAVE_ASM_PPC_REL16
+	bcl	20,31,5f
+5:	mflr	r7
+	addis	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
+	addi	r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+#   else
+	bl      _GLOBAL_OFFSET_TABLE_@local-4
+	mflr    r7
+#   endif
+	mtlr    r8
+#   ifdef SHARED
+	lwz     r7,_rtld_global_ro@got(r7)
+	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
+#   else
+	lwz     r7,_dl_hwcap@got(r7)
+	lwz     r7,0(r7)
+#   endif
+#  else
+	lis	r7,_dl_hwcap@ha
+	lwz     r7,_dl_hwcap@l(r7)
+#  endif
+	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
+	la	r10,(_UC_VREGS)(r31)
+	beq	6f	/* L(has_no_vec) */
+
+	lwz   r0,(32*16)(r10)
+	li    r9,(32*16)
+	cmpwi r0,0
+	mtspr VRSAVE,r0
+	beq	6f	/* L(has_no_vec) */
+
+	lvx   v19,r9,r10
+	la    r9,(16)(r10)
+
+	lvx   v0,0,r10
+	lvx   v1,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	mtvscr  v19
+	lvx   v2,0,r10
+	lvx   v3,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v4,0,r10
+	lvx   v5,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v6,0,r10
+	lvx   v7,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v8,0,r10
+	lvx   v9,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v12,0,r10
+	lvx   v13,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v14,0,r10
+	lvx   v15,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v16,0,r10
+	lvx   v17,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v18,0,r10
+	lvx   v19,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v20,0,r10
+	lvx   v21,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v22,0,r10
+	lvx   v23,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v24,0,r10
+	lvx   v25,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v26,0,r10
+	lvx   v27,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v28,0,r10
+	lvx   v29,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v30,0,r10
+	lvx   v31,0,r9
+	addi  r10,r10,32
+	addi  r9,r9,32
+
+	lvx   v10,0,r10
+	lvx   v11,0,r9
+
+6: /* L(has_no_vec): */
+# endif /* __CONTEXT_ENABLE_VRS */
+	/* Restore the floating-point registers */
+	lfd	fp31,_UC_FREGS+(32*8)(r31)
+	lfd	fp0,_UC_FREGS+(0*8)(r31)
+	mtfsf	0xff,fp31
+	lfd	fp1,_UC_FREGS+(1*8)(r31)
+	lfd	fp2,_UC_FREGS+(2*8)(r31)
+	lfd	fp3,_UC_FREGS+(3*8)(r31)
+	lfd	fp4,_UC_FREGS+(4*8)(r31)
+	lfd	fp5,_UC_FREGS+(5*8)(r31)
+	lfd	fp6,_UC_FREGS+(6*8)(r31)
+	lfd	fp7,_UC_FREGS+(7*8)(r31)
+	lfd	fp8,_UC_FREGS+(8*8)(r31)
+	lfd	fp9,_UC_FREGS+(9*8)(r31)
+	lfd	fp10,_UC_FREGS+(10*8)(r31)
+	lfd	fp11,_UC_FREGS+(11*8)(r31)
+	lfd	fp12,_UC_FREGS+(12*8)(r31)
+	lfd	fp13,_UC_FREGS+(13*8)(r31)
+	lfd	fp14,_UC_FREGS+(14*8)(r31)
+	lfd	fp15,_UC_FREGS+(15*8)(r31)
+	lfd	fp16,_UC_FREGS+(16*8)(r31)
+	lfd	fp17,_UC_FREGS+(17*8)(r31)
+	lfd	fp18,_UC_FREGS+(18*8)(r31)
+	lfd	fp19,_UC_FREGS+(19*8)(r31)
+	lfd	fp20,_UC_FREGS+(20*8)(r31)
+	lfd	fp21,_UC_FREGS+(21*8)(r31)
+	lfd	fp22,_UC_FREGS+(22*8)(r31)
+	lfd	fp23,_UC_FREGS+(23*8)(r31)
+	lfd	fp24,_UC_FREGS+(24*8)(r31)
+	lfd	fp25,_UC_FREGS+(25*8)(r31)
+	lfd	fp26,_UC_FREGS+(26*8)(r31)
+	lfd	fp27,_UC_FREGS+(27*8)(r31)
+	lfd	fp28,_UC_FREGS+(28*8)(r31)
+	lfd	fp29,_UC_FREGS+(29*8)(r31)
+	lfd	fp30,_UC_FREGS+(30*8)(r31)
+	lfd	fp31,_UC_FREGS+(31*8)(r31)
+#endif /* __CONTEXT_ENABLE_FPRS */
+
+	/* Restore LR and CCR, and set CTR to the NIP value */
+	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
+	mtlr	r3
+	mtctr	r4
+	mtcr	r5
+
+	/* Restore the general registers */
+	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
+	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
+	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
+	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
+	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
+	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
+	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
+	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
+	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
+	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
+	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
+	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
+	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
+	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
+	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
+	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
+	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
+	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
+	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
+	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
+	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
+	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
+	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
+	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
+	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
+	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
+	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
+	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
+	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
+	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
+
+	bctr
+	
+3:/*L(error_exit):*/
+	lwz	r0,_FRAME_LR_SAVE+16(r1)
+	addi	r1,r1,16
+	mtlr	r0
+	blr
+	
+4:/*L(do_sigret):*/
+	addi	r1,r4,-0xd0
+	li	r0,SYS_ify(rt_sigreturn)
+	sc
+	/* NOTREACHED */
+
+END(__CONTEXT_FUNC_NAME)
+
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
index c4f0faddc3..0605f3d107 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S
@@ -1,5 +1,5 @@
 /* Save current context and jump to a new context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 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
@@ -14,684 +14,53 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
 #include "ucontext_i.h"
 
-	.machine	"altivec"
-ENTRY(__swapcontext)
-	stwu	r1,-16(r1)
-/* Insure that the _UC_REGS start on a quadword boundary.  */
-	stw	r3,_FRAME_PARM_SAVE1(r1)
-	addi	r3,r3,_UC_REG_SPACE+12
-	stw	r4,_FRAME_PARM_SAVE2(r1)	/* new context pointer */
-	clrrwi  r3,r3,4
-
-/* Save the general purpose registers */
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	mflr	r0
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)			
-/* Set the callers LR_SAVE, and the ucontext LR and NIP to the callers
-   return address.  */
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r0,_FRAME_LR_SAVE+16(r1)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-	
-/* Save the value of R1.  We had to push the stack before we
-   had the address of uc_reg_space.  So compute the address of
-   the callers stack pointer and save it as R1.  */
-	addi	r8,r1,16
-	li	r0,0
-/* Save the count, exception and condition registers.  */
-	mfctr	r11
-	mfxer	r10
-	mfcr	r9
-	stw	r8,_UC_GREGS+(PT_R1*4)(r3)
-	stw	r11,_UC_GREGS+(PT_CTR*4)(r3)
-	stw	r10,_UC_GREGS+(PT_XER*4)(r3)
-	stw	r9,_UC_GREGS+(PT_CCR*4)(r3)
-/* Set the return value of getcontext to "success".  R3 is the only
-   register whose value is not preserved in the saved context.  */
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
-
-	/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-	/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
-#ifdef PIC
-	mflr    r8
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
-#else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
-#endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-
-	la	r10,(_UC_VREGS)(r3)
-	la	r9,(_UC_VREGS+16)(r3)
-	
-	beq	L(no_vec)
-/* address of the combined VSCR/VSAVE quadword.  */	
-	la	r8,(_UC_VREGS+512)(r3)
-
-/* Save the vector registers */
-	stvx  v0,0,r10
-	stvx  v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-/* We need to get the Vector Status and Control Register early to avoid
-   store order problems later with the VSAVE register that shares the
-   same quadword.  */
-	mfvscr	v0
-
-	stvx  v2,0,r10
-	stvx  v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-	
-	stvx	v0,0,r8
-
-	stvx  v4,0,r10
-	stvx  v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v6,0,r10
-	stvx  v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v8,0,r10
-	stvx  v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v10,0,r10
-	stvx  v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v12,0,r10
-	stvx  v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v14,0,r10
-	stvx  v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v16,0,r10
-	stvx  v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v18,0,r10
-	stvx  v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v20,0,r10
-	stvx  v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v22,0,r10
-	stvx  v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v24,0,r10
-	stvx  v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v26,0,r10
-	stvx  v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	stvx  v28,0,r10
-	stvx  v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mfvscr	v0
-	stvx  v30,0,r10
-	stvx  v31,0,r9
-
- 	stw	r0,0(r8)
-
-L(no_vec):
-/* Restore ucontext (parm1) from stack.  */
-	lwz	r12,_FRAME_PARM_SAVE1(r1)
-	li	r4,0
-	stw	r3,_UC_REGS_PTR(r12)
-	addi	r5,r12,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	JUMPTARGET(__sigprocmask)
-	cmpwi	r3,0
-	bne	L(error_exit)
-
-	/*
-	 * If the new ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	lwz	r4,_FRAME_PARM_SAVE2(r1)
-	lwz	r31,_UC_REGS_PTR(r4)
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(do_sigret)
-
-#ifdef PIC
-	mflr    r8
-	bl      _GLOBAL_OFFSET_TABLE_@local-4
-	mflr    r7
-# ifdef SHARED
-	lwz     r7,_rtld_global_ro@got(r7)
-	mtlr    r8
-	lwz     r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r7)
-# else
-	lwz     r7,_dl_hwcap@got(r7)
-	mtlr    r8
-	lwz     r7,0(r7)
-# endif
-#else
-	lis	r7,_dl_hwcap@ha
-	lwz     r7,_dl_hwcap@l(r7)
-#endif
-	andis.	r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
-	la	r10,(_UC_VREGS)(r31)
-	beq	L(has_no_vec)
-
-	lwz   r0,(32*16)(r10)
-	li    r9,(32*16)
-	cmpwi r0,0
-	mtspr VRSAVE,r0
-	beq   L(has_no_vec)
-
-	lvx   v19,r9,r10
-	la    r9,(16)(r10)
-
-	lvx   v0,0,r10
-	lvx   v1,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	mtvscr  v19
-	lvx   v2,0,r10
-	lvx   v3,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v4,0,r10
-	lvx   v5,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v6,0,r10
-	lvx   v7,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v8,0,r10
-	lvx   v9,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v12,0,r10
-	lvx   v13,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v14,0,r10
-	lvx   v15,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v16,0,r10
-	lvx   v17,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v18,0,r10
-	lvx   v19,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v20,0,r10
-	lvx   v21,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v22,0,r10
-	lvx   v23,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v24,0,r10
-	lvx   v25,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v26,0,r10
-	lvx   v27,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v28,0,r10
-	lvx   v29,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v30,0,r10
-	lvx   v31,0,r9
-	addi  r10,r10,32
-	addi  r9,r9,32
-
-	lvx   v10,0,r10
-	lvx   v11,0,r9
-
-L(has_no_vec):
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(error_exit):
-	lwz	r0,_FRAME_LR_SAVE+16(r1)
-	addi	r1,r1,16
-	mtlr	r0
+#define __CONTEXT_FUNC_NAME __swapcontext
+#define __CONTEXT_ENABLE_FPRS 1
+#define __CONTEXT_ENABLE_VRS 1
+
+/* Size of ucontext in GLIBC_2.3.4 and later.  */
+#define _UC_SIZE_2_3_4	1184
+
+#ifdef __ASSUME_SWAPCONTEXT_SYSCALL
+	.section ".text";
+ENTRY (__swapcontext)
+	li	r5,_UC_SIZE_2_3_4;
+	DO_CALL (SYS_ify (swapcontext));
+	bso-	cr0,1f
+/* the kernel does not set the return code for the success case */
+	li	r3,0
 	blr
-
-L(do_sigret):
-	addi	r1,r4,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
-
+1:
+	b	__syscall_error@local
 END(__swapcontext)
+#else
+# include "swapcontext-common.S"
+#endif
 
 versioned_symbol (libc, __swapcontext, swapcontext, GLIBC_2_3_4)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 
 	compat_text_section
-ENTRY(__novec_swapcontext)
-	/* Save the current context */
-	addi	r3,r3,_UC_REG_SPACE
-	stw	r3,_UC_REGS_PTR - _UC_REG_SPACE(r3)
-	stw	r0,_UC_GREGS+(PT_R0*4)(r3)
-	stw	r1,_UC_GREGS+(PT_R1*4)(r3)
-	mflr	r0
-	stwu	r1,-16(r1)
-	stw	r0,20(r1)
-	stw	r31,12(r1)
-	stw	r31,_UC_GREGS+(PT_R31*4)(r3)
-	mr	r31,r4			/* new context pointer */
-	stw	r0,_UC_GREGS+(PT_LNK*4)(r3)
-	stw	r0,_UC_GREGS+(PT_NIP*4)(r3)
-	stw	r2,_UC_GREGS+(PT_R2*4)(r3)
-	stw	r4,_UC_GREGS+(PT_R4*4)(r3)
-	stw	r5,_UC_GREGS+(PT_R5*4)(r3)
-	stw	r6,_UC_GREGS+(PT_R6*4)(r3)
-	stw	r7,_UC_GREGS+(PT_R7*4)(r3)
-	stw	r8,_UC_GREGS+(PT_R8*4)(r3)
-	stw	r9,_UC_GREGS+(PT_R9*4)(r3)
-	stw	r10,_UC_GREGS+(PT_R10*4)(r3)
-	stw	r11,_UC_GREGS+(PT_R11*4)(r3)
-	stw	r12,_UC_GREGS+(PT_R12*4)(r3)
-	stw	r13,_UC_GREGS+(PT_R13*4)(r3)
-	stw	r14,_UC_GREGS+(PT_R14*4)(r3)
-	stw	r15,_UC_GREGS+(PT_R15*4)(r3)
-	stw	r16,_UC_GREGS+(PT_R16*4)(r3)
-	stw	r17,_UC_GREGS+(PT_R17*4)(r3)
-	stw	r18,_UC_GREGS+(PT_R18*4)(r3)
-	stw	r19,_UC_GREGS+(PT_R19*4)(r3)
-	stw	r20,_UC_GREGS+(PT_R20*4)(r3)
-	stw	r21,_UC_GREGS+(PT_R21*4)(r3)
-	stw	r22,_UC_GREGS+(PT_R22*4)(r3)
-	stw	r23,_UC_GREGS+(PT_R23*4)(r3)
-	stw	r24,_UC_GREGS+(PT_R24*4)(r3)
-	stw	r25,_UC_GREGS+(PT_R25*4)(r3)
-	stw	r26,_UC_GREGS+(PT_R26*4)(r3)
-	stw	r27,_UC_GREGS+(PT_R27*4)(r3)
-	stw	r28,_UC_GREGS+(PT_R28*4)(r3)
-	stw	r29,_UC_GREGS+(PT_R29*4)(r3)
-	stw	r30,_UC_GREGS+(PT_R30*4)(r3)
-	mfctr	r0
-	stw	r0,_UC_GREGS+(PT_CTR*4)(r3)
-	mfxer	r0
-	stw	r0,_UC_GREGS+(PT_XER*4)(r3)
-	mfcr	r0
-	stw	r0,_UC_GREGS+(PT_CCR*4)(r3)
-
-	/* Set the return value of swapcontext to "success".  R3 is the only
-	   register whose value is not preserved in the saved context.  */
-	li	r0,0
-	stw	r0,_UC_GREGS+(PT_R3*4)(r3)
-
-	/* Zero fill fields that can't be set in user state. */
-	stw	r0,_UC_GREGS+(PT_MSR*4)(r3)
-	stw	r0,_UC_GREGS+(PT_MQ*4)(r3)
-
-	/* Save the floating-point registers */
-	stfd	fp0,_UC_FREGS+(0*8)(r3)
-	stfd	fp1,_UC_FREGS+(1*8)(r3)
-	stfd	fp2,_UC_FREGS+(2*8)(r3)
-	stfd	fp3,_UC_FREGS+(3*8)(r3)
-	stfd	fp4,_UC_FREGS+(4*8)(r3)
-	stfd	fp5,_UC_FREGS+(5*8)(r3)
-	stfd	fp6,_UC_FREGS+(6*8)(r3)
-	stfd	fp7,_UC_FREGS+(7*8)(r3)
-	stfd	fp8,_UC_FREGS+(8*8)(r3)
-	stfd	fp9,_UC_FREGS+(9*8)(r3)
-	stfd	fp10,_UC_FREGS+(10*8)(r3)
-	stfd	fp11,_UC_FREGS+(11*8)(r3)
-	stfd	fp12,_UC_FREGS+(12*8)(r3)
-	stfd	fp13,_UC_FREGS+(13*8)(r3)
-	stfd	fp14,_UC_FREGS+(14*8)(r3)
-	stfd	fp15,_UC_FREGS+(15*8)(r3)
-	stfd	fp16,_UC_FREGS+(16*8)(r3)
-	stfd	fp17,_UC_FREGS+(17*8)(r3)
-	stfd	fp18,_UC_FREGS+(18*8)(r3)
-	stfd	fp19,_UC_FREGS+(19*8)(r3)
-	stfd	fp20,_UC_FREGS+(20*8)(r3)
-	stfd	fp21,_UC_FREGS+(21*8)(r3)
-	stfd	fp22,_UC_FREGS+(22*8)(r3)
-	stfd	fp23,_UC_FREGS+(23*8)(r3)
-	stfd	fp24,_UC_FREGS+(24*8)(r3)
-	stfd	fp25,_UC_FREGS+(25*8)(r3)
-	stfd	fp26,_UC_FREGS+(26*8)(r3)
-	stfd	fp27,_UC_FREGS+(27*8)(r3)
-	stfd	fp28,_UC_FREGS+(28*8)(r3)
-	stfd	fp29,_UC_FREGS+(29*8)(r3)
-	mffs	fp0
-	stfd	fp30,_UC_FREGS+(30*8)(r3)
-	stfd	fp31,_UC_FREGS+(31*8)(r3)
-	stfd	fp0,_UC_FREGS+(32*8)(r3)
-
-	addi	r5,r3,_UC_SIGMASK - _UC_REG_SPACE
-	addi	r4,r4,_UC_SIGMASK
-	li	r3,SIG_SETMASK
-	bl	JUMPTARGET(__sigprocmask)
-	cmpwi	r3,0
-	bne	L(novec_error_exit)
-
-	/*
-	 * If the new ucontext refers to the point where we were interrupted
-	 * by a signal, we have to use the rt_sigreturn system call to
-	 * return to the context so we get both LR and CTR restored.
-	 *
-	 * Otherwise, the context we are restoring is either just after
-	 * a procedure call (getcontext/swapcontext) or at the beginning
-	 * of a procedure call (makecontext), so we don't need to restore
-	 * r0, xer, ctr.  We don't restore r2 since it will be used as
-	 * the TLS pointer.
-	 */
-	mr	r4,r31
-	lwz	r31,_UC_REGS_PTR(r31)
-	lwz	r0,_UC_GREGS+(PT_MSR*4)(r31)
-	cmpwi	r0,0
-	bne	L(novec_do_sigret)
-
-	/* Restore the floating-point registers */
-	lfd	fp31,_UC_FREGS+(32*8)(r31)
-	lfd	fp0,_UC_FREGS+(0*8)(r31)
-	mtfsf	0xff,fp31
-	lfd	fp1,_UC_FREGS+(1*8)(r31)
-	lfd	fp2,_UC_FREGS+(2*8)(r31)
-	lfd	fp3,_UC_FREGS+(3*8)(r31)
-	lfd	fp4,_UC_FREGS+(4*8)(r31)
-	lfd	fp5,_UC_FREGS+(5*8)(r31)
-	lfd	fp6,_UC_FREGS+(6*8)(r31)
-	lfd	fp7,_UC_FREGS+(7*8)(r31)
-	lfd	fp8,_UC_FREGS+(8*8)(r31)
-	lfd	fp9,_UC_FREGS+(9*8)(r31)
-	lfd	fp10,_UC_FREGS+(10*8)(r31)
-	lfd	fp11,_UC_FREGS+(11*8)(r31)
-	lfd	fp12,_UC_FREGS+(12*8)(r31)
-	lfd	fp13,_UC_FREGS+(13*8)(r31)
-	lfd	fp14,_UC_FREGS+(14*8)(r31)
-	lfd	fp15,_UC_FREGS+(15*8)(r31)
-	lfd	fp16,_UC_FREGS+(16*8)(r31)
-	lfd	fp17,_UC_FREGS+(17*8)(r31)
-	lfd	fp18,_UC_FREGS+(18*8)(r31)
-	lfd	fp19,_UC_FREGS+(19*8)(r31)
-	lfd	fp20,_UC_FREGS+(20*8)(r31)
-	lfd	fp21,_UC_FREGS+(21*8)(r31)
-	lfd	fp22,_UC_FREGS+(22*8)(r31)
-	lfd	fp23,_UC_FREGS+(23*8)(r31)
-	lfd	fp24,_UC_FREGS+(24*8)(r31)
-	lfd	fp25,_UC_FREGS+(25*8)(r31)
-	lfd	fp26,_UC_FREGS+(26*8)(r31)
-	lfd	fp27,_UC_FREGS+(27*8)(r31)
-	lfd	fp28,_UC_FREGS+(28*8)(r31)
-	lfd	fp29,_UC_FREGS+(29*8)(r31)
-	lfd	fp30,_UC_FREGS+(30*8)(r31)
-	lfd	fp31,_UC_FREGS+(31*8)(r31)
-
-	/* Restore LR and CCR, and set CTR to the NIP value */
-	lwz	r3,_UC_GREGS+(PT_LNK*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_NIP*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_CCR*4)(r31)
-	mtlr	r3
-	mtctr	r4
-	mtcr	r5
-
-	/* Restore the general registers */
-	lwz	r1,_UC_GREGS+(PT_R1*4)(r31)
-	lwz	r3,_UC_GREGS+(PT_R3*4)(r31)
-	lwz	r4,_UC_GREGS+(PT_R4*4)(r31)
-	lwz	r5,_UC_GREGS+(PT_R5*4)(r31)
-	lwz	r6,_UC_GREGS+(PT_R6*4)(r31)
-	lwz	r7,_UC_GREGS+(PT_R7*4)(r31)
-	lwz	r8,_UC_GREGS+(PT_R8*4)(r31)
-	lwz	r9,_UC_GREGS+(PT_R9*4)(r31)
-	lwz	r10,_UC_GREGS+(PT_R10*4)(r31)
-	lwz	r11,_UC_GREGS+(PT_R11*4)(r31)
-	lwz	r12,_UC_GREGS+(PT_R12*4)(r31)
-	lwz	r13,_UC_GREGS+(PT_R13*4)(r31)
-	lwz	r14,_UC_GREGS+(PT_R14*4)(r31)
-	lwz	r15,_UC_GREGS+(PT_R15*4)(r31)
-	lwz	r16,_UC_GREGS+(PT_R16*4)(r31)
-	lwz	r17,_UC_GREGS+(PT_R17*4)(r31)
-	lwz	r18,_UC_GREGS+(PT_R18*4)(r31)
-	lwz	r19,_UC_GREGS+(PT_R19*4)(r31)
-	lwz	r20,_UC_GREGS+(PT_R20*4)(r31)
-	lwz	r21,_UC_GREGS+(PT_R21*4)(r31)
-	lwz	r22,_UC_GREGS+(PT_R22*4)(r31)
-	lwz	r23,_UC_GREGS+(PT_R23*4)(r31)
-	lwz	r24,_UC_GREGS+(PT_R24*4)(r31)
-	lwz	r25,_UC_GREGS+(PT_R25*4)(r31)
-	lwz	r26,_UC_GREGS+(PT_R26*4)(r31)
-	lwz	r27,_UC_GREGS+(PT_R27*4)(r31)
-	lwz	r28,_UC_GREGS+(PT_R28*4)(r31)
-	lwz	r29,_UC_GREGS+(PT_R29*4)(r31)
-	lwz	r30,_UC_GREGS+(PT_R30*4)(r31)
-	lwz	r31,_UC_GREGS+(PT_R31*4)(r31)
-
-	bctr
-
-L(novec_error_exit):
-	lwz	r31,12(r1)
-	lwz	r0,20(r1)
-	addi	r1,r1,16
-	mtlr	r0
-	blr
+	
+# undef __CONTEXT_FUNC_NAME	
+# define __CONTEXT_FUNC_NAME __novec_swapcontext
+# undef __CONTEXT_ENABLE_VRS
 
-L(novec_do_sigret):
-	addi	r1,r4,-0xd0
-	li	r0,SYS_ify(rt_sigreturn)
-	sc
-	/* NOTREACHED */
+# include "swapcontext-common.S"
 
-END(__novec_swapcontext)
 	.previous
 
 compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
@@ -700,13 +69,13 @@ compat_symbol (libc, __novec_swapcontext, swapcontext, GLIBC_2_3_3)
 
 #if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
 
-#define _ERRNO_H	1
-#include <bits/errno.h>
+# define _ERRNO_H	1
+# include <bits/errno.h>
 
 	compat_text_section
 ENTRY (__swapcontext_stub)
 	li	r3,ENOSYS
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 END (__swapcontext_stub)
 	.previous
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 2ee3e60229..c42efbabdd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,1997-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1997-2003,2004,2005,2006 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
@@ -20,6 +20,7 @@
 #define _LINUX_POWERPC_SYSDEP_H 1
 
 #include <sysdeps/unix/powerpc/sysdep.h>
+#include <tls.h>
 
 /* Some systen calls got renamed over time, but retained the same semantics.
    Handle them here so they can be catched by both C and assembler stubs in
@@ -54,6 +55,109 @@
 
 # include <errno.h>
 
+# ifdef SHARED
+#  define INLINE_VSYSCALL(name, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    __label__ iserr;							      \
+    INTERNAL_SYSCALL_DECL (sc_err);					      \
+    long int sc_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
+	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+	  goto out;							      \
+	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
+	  goto iserr;							      \
+      }									      \
+									      \
+    sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args);		      \
+    if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+      {									      \
+      iserr:								      \
+        __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		      \
+        sc_ret = -1L;							      \
+      }									      \
+  out:									      \
+    sc_ret;								      \
+  })
+# else
+#  define INLINE_VSYSCALL(name, nr, args...) \
+  INLINE_SYSCALL (name, nr, ##args)
+# endif
+
+# ifdef SHARED
+#  define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    long int v_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
+	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
+	  goto out;							      \
+      }									      \
+    v_ret = INTERNAL_SYSCALL (name, err, nr, ##args);			      \
+  out:									      \
+    v_ret;								      \
+  })
+# else
+#  define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  INTERNAL_SYSCALL (name, err, nr, ##args)
+# endif
+
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
+  ({									      \
+    long int sc_ret = ENOSYS;						      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+    else								      \
+      err = 1 << 28;							      \
+    sc_ret;								      \
+  })
+
+/* List of system calls which are supported as vsyscalls.  */
+# define HAVE_CLOCK_GETRES_VSYSCALL	1
+# define HAVE_CLOCK_GETTIME_VSYSCALL	1
+
+/* Define a macro which expands inline into the wrapper code for a VDSO
+   call. This use is for internal calls that do not need to handle errors
+   normally. It will never touch errno.
+   On powerpc a system call basically clobbers the same registers like a
+   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...) \
+  ({									      \
+    register void *r0  __asm__ ("r0");					      \
+    register long int r3  __asm__ ("r3");				      \
+    register long int r4  __asm__ ("r4");				      \
+    register long int r5  __asm__ ("r5");				      \
+    register long int r6  __asm__ ("r6");				      \
+    register long int r7  __asm__ ("r7");				      \
+    register long int r8  __asm__ ("r8");				      \
+    register long int r9  __asm__ ("r9");				      \
+    register long int r10 __asm__ ("r10");				      \
+    register long int r11 __asm__ ("r11");				      \
+    register long int r12 __asm__ ("r12");				      \
+    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");					      \
+    err = (long int) r0;						      \
+    (int) r3;								      \
+  })
+
 # undef INLINE_SYSCALL
 # define INLINE_SYSCALL(name, nr, args...)				\
   ({									\
@@ -92,7 +196,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"							\
@@ -109,16 +213,16 @@
 
 # undef INTERNAL_SYSCALL_ERROR_P
 # define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  (__builtin_expect (err & (1 << 28), 0))
+  ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
 
 # undef INTERNAL_SYSCALL_ERRNO
 # define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
 
-# define LOADARGS_0(name, dummy) \
+# define LOADARGS_0(name, dummy)					      \
 	r0 = name
 # define LOADARGS_1(name, __arg1) \
 	long int arg1 = (long int) (__arg1);	\
-	LOADARGS_0(name, 0); \
+  LOADARGS_0(name, 0);					   \
 	extern void __illegally_sized_syscall_arg1 (void); \
 	if (__builtin_classify_type (__arg1) != 5 && sizeof (__arg1) > 4) \
 	  __illegally_sized_syscall_arg1 (); \
@@ -170,4 +274,28 @@
 #endif /* __ASSEMBLER__ */
 
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+	lwz	tmpreg,POINTER_GUARD(r2); \
+	xor	reg,tmpreg,reg
+#  define PTR_MANGLE2(reg, tmpreg) \
+	xor	reg,tmpreg,reg
+#  define PTR_MANGLE3(destreg, reg, tmpreg) \
+	lwz	tmpreg,POINTER_GUARD(r2); \
+	xor	destreg,tmpreg,reg
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+#  define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+#  define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/powerpc/powerpc32/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
index ce8ebc2a97..f107e84373 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2005,2006
+	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
@@ -24,12 +25,12 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_truncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
 /* The variable is shared between all wrappers around *truncate64 calls.  */
-int have_no_truncate64;
+int __have_no_truncate64;
 #endif
 
 
@@ -40,7 +41,7 @@ truncate64 (path, length)
      off64_t length;
 {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
-  if (! have_no_truncate64)
+  if (! __have_no_truncate64)
 #endif
     {
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -58,7 +59,7 @@ truncate64 (path, length)
 
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
       __set_errno (saved_errno);
-      have_no_truncate64 = 1;
+      __have_no_truncate64 = 1;
 #endif
     }
 
@@ -68,11 +69,11 @@ truncate64 (path, length)
       __set_errno (EINVAL);
       return -1;
     }
-  return truncate (path, (off_t) length);
+  return __truncate (path, (off_t) length);
 #endif
 }
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/truncate64.c>
+# include <misc/truncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
deleted file mode 100644
index e47b24a09e..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-#define _FRAME_BACKCHAIN	0
-#define _FRAME_LR_SAVE	4
-#define _FRAME_PARM_SAVE1	8
-#define _FRAME_PARM_SAVE2	12
-#define _FRAME_PARM_SAVE3	16
-#define _FRAME_PARM_SAVE4	20
-
-#define _UC_LINK	4
-#define _UC_STACK_SP	8
-#define _UC_STACK_SIZE	16
-#define _UC_REGS_PTR	48
-#define _UC_SIGMASK	52
-#define _UC_REG_SPACE	180
-
-/* offsets within mcontext_t */
-#define _UC_GREGS	0
-#define _UC_FREGS	192
-#define _UC_VREGS	464
-#define _UC_VSCR	976
-#define _UC_VRSAVE	980
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
new file mode 100644
index 0000000000..293761f260
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
@@ -0,0 +1,26 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+-- Offsets in ucontext_t.
+#define ucontext(member)	offsetof (ucontext_t, member)
+_UC_LINK		ucontext (uc_link)
+_UC_STACK_SP		ucontext (uc_stack.ss_sp)
+_UC_STACK_SIZE		ucontext (uc_stack.ss_size)
+_UC_REGS_PTR		ucontext (uc_mcontext.uc_regs)
+_UC_SIGMASK		ucontext (uc_sigmask)
+_UC_REG_SPACE		ucontext (uc_reg_space)
+
+-- Offsets in mcontext_t.
+#define mcontext(member)	offsetof (mcontext_t, member)
+_UC_GREGS		mcontext (gregs)
+_UC_FREGS		mcontext (fpregs)
+_UC_VREGS		mcontext (vrregs)
+_UC_VREGS		mcontext (vrregs)
+_UC_VSCR		mcontext (vrregs.vscr)
+_UC_VRSAVE		mcontext (vrregs.vrsave)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
index 5fb7868c31..66a149f10b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
@@ -50,7 +50,7 @@ ENTRY (__vfork)
 	bnslr+
 
 .Lsyscall_error:
-	b	JUMPTARGET(__syscall_error)
+	b	__syscall_error@local
 #endif
 
 PSEUDO_END (__vfork)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist
deleted file mode 100644
index 6085928f34..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-clone.S
-fe_nomask.c
-kernel_stat.h
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
index 3f74f55271..f2ac00d4c7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
@@ -1,5 +1,5 @@
 /* brk system call for Linux.  PowerPC64 version.
-   Copyright (C) 1995,96,97,99, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,99, 2000,02, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #define _ERRNO_H	1
@@ -33,6 +33,7 @@ ENTRY (BP_SYM (__brk))
 	DISCARD_BOUNDS (r3)	/* the bounds are meaningless, so toss 'em.  */
 
 	stdu    r1,-64(r1)
+	cfi_adjust_cfa_offset (64)
 	std	r3,48(r1)
 	DO_CALL(SYS_ify(brk))
 	ld     r6,48(r1)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index 287597c480..f1a55e64db 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -1,5 +1,5 @@
 /* Wrapper around clone system call.  PowerPC64 version.
-   Copyright (C) 1997,98,99,2000,02, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997,98,99,2000,02,04, 2006 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
@@ -14,8 +14,8 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #define _ERRNO_H	1
@@ -48,11 +48,16 @@ ENTRY (BP_SYM (__clone))
 
 	/* Set up stack frame for parent.  */
 	stdu	r1,-80(r1)
+	cfi_adjust_cfa_offset (80)
 	std	r29,56(r1)
 	std	r30,64(r1)
 	std	r31,72(r1)
+	cfi_offset(r29,-56)
+	cfi_offset(r30,-64)
+	cfi_offset(r31,-72)
 #ifdef RESET_PID
 	std	r28,48(r1)
+	cfi_offset(r28,-48)
 #endif
 
 	/* Set up stack frame for child.  */
@@ -76,6 +81,10 @@ ENTRY (BP_SYM (__clone))
 	mr	r6,r8
 	mr	r7,r9
 
+	/* End FDE now, because in the child the unwind info will be
+	   wrong.  */
+	cfi_endproc
+
 	/* Do the call.  */
 	DO_CALL(SYS_ify(clone))
 
@@ -127,6 +136,8 @@ L(parent):
 L(badargs):
 	li	r3,EINVAL
 	b	JUMPTARGET(__syscall_error)
+
+	cfi_startproc
 END (BP_SYM (__clone))
 
 weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
index 7571f28780..62f735514a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fe_nomask.c
@@ -1,5 +1,5 @@
 /* Procedure definition for FE_NOMASK_ENV for Linux/ppc64.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 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
@@ -22,7 +22,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 #include <sys/prctl.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 const fenv_t *
 __fe_nomask_env (void)
@@ -36,7 +36,7 @@ __fe_nomask_env (void)
       && INTERNAL_SYSCALL_ERRNO (result, err) == EINVAL)
     __set_errno (ENOSYS);
 # endif
-#else  
+#else
   __set_errno (ENOSYS);
 #endif
   return FE_ENABLED_ENV;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
new file mode 100644
index 0000000000..6243d2ef27
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with powerpc64 specific routines.
+powerpc/powerpc64/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
index 61e0f8ed11..8d7c959ff9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006 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
@@ -14,13 +14,13 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -37,9 +37,11 @@ ENTRY(__novec_getcontext)
   mflr  r0
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -140,7 +142,9 @@ ENTRY(__novec_getcontext)
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset(128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
@@ -175,9 +179,11 @@ ENTRY(__getcontext)
   mflr  r0
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -387,7 +393,9 @@ L(has_no_vec):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h
new file mode 100644
index 0000000000..ac4a0d5aa9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h
@@ -0,0 +1,77 @@
+/* Run-time dynamic linker data structures for loaded ELF shared objects.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LDSODEFS_H
+
+/* Get the real definitions.  */
+#include_next <ldsodefs.h>
+
+/* Now define our stuff.  */
+
+static __always_inline bool
+_dl_ppc64_is_opd_sym (const struct link_map *l, const ElfW(Sym) *sym)
+{
+  return (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
+	  && l->l_addr + sym->st_value >= (ElfW(Addr)) l->l_ld
+	  && l->l_addr + sym->st_value < l->l_map_end
+	  && sym->st_size != 0);
+}
+
+static __always_inline bool
+_dl_ppc64_addr_sym_match (const struct link_map *l, const ElfW(Sym) *sym,
+			  const ElfW(Sym) *matchsym, ElfW(Addr) addr)
+{
+  ElfW(Addr) value = l->l_addr + sym->st_value;
+  if (_dl_ppc64_is_opd_sym (l, sym))
+    {
+      if (addr < value || addr >= value + 24)
+	{
+	  value = *(ElfW(Addr) *) value;
+	  if (addr < value || addr >= value + sym->st_size)
+	    return false;
+	}
+    }
+  else if (sym->st_shndx == SHN_UNDEF || sym->st_size == 0)
+    {
+      if (addr != value)
+	return false;
+    }
+  else if (addr < value || addr >= value + sym->st_size)
+    return false;
+
+  if (matchsym == NULL)
+    return true;
+
+  ElfW(Addr) matchvalue = l->l_addr + matchsym->st_value;
+  if (_dl_ppc64_is_opd_sym (l, matchsym)
+      && (addr < matchvalue || addr > matchvalue + 24))
+    matchvalue = *(ElfW(Addr) *) matchvalue;
+
+  return matchvalue < value;
+}
+
+/* If this is a function symbol defined past the end of our dynamic
+   section, then it must be a function descriptor.  Allow these symbols
+   to match their associated function code range as well as the
+   descriptor addresses.  */
+#undef DL_ADDR_SYM_MATCH
+#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
+  _dl_ppc64_addr_sym_match (L, SYM, MATCHSYM, ADDR)
+
+#endif /* ldsodefs.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
index 8034559200..4a82802d96 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
@@ -1,5 +1,5 @@
 /* Create new context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006 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
@@ -14,11 +14,11 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -41,7 +41,9 @@ ENTRY(__makecontext)
   /* Get the address of the target functions first parameter.  */
   addi  r6,r1,FRAME_PARM4_SAVE
   std   r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
 
   /* Get the ucontexts stack pointer and size.  Compute the top of stack
      and round down to a quadword boundary.  Then stack a dummy frame
@@ -168,7 +170,9 @@ L(gotexitcodeaddr):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
@@ -180,4 +184,4 @@ L(gotexitcodeaddr):
 #endif
 END(__makecontext)
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c
index d5b77e0b57..315d1195e8 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
@@ -57,7 +57,7 @@ __libc_pread (fd, buf, count, offset)
 
       return result;
     }
-  
+
   int oldtype = LIBC_CANCEL_ASYNC ();
 
   result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
index 9bbe389420..f775e1f1eb 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c
index 96b72e18a5..0f509154e2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
index 9e68acdf08..22224324a1 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
index 6514f442a6..48e9af363d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
@@ -1,5 +1,5 @@
 /* Switch to context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006 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
@@ -14,13 +14,13 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -33,8 +33,11 @@ ENTRY(__novec_setcontext)
 #ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std   r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   mr    r31,r3
 
 /*
@@ -47,7 +50,7 @@ ENTRY(__novec_setcontext)
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(nv_do_sigret)
 
@@ -104,7 +107,7 @@ ENTRY(__novec_setcontext)
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
+  mtcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
@@ -167,7 +170,9 @@ L(nv_do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset(lr,FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset(128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
@@ -199,8 +204,11 @@ ENTRY(__setcontext)
 #ifdef __ASSUME_NEW_RT_SIGRETURN_SYSCALL
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std   r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   mr    r31,r3
 
 /*
@@ -213,7 +221,7 @@ ENTRY(__setcontext)
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(do_sigret)
 
@@ -380,11 +388,11 @@ L(has_no_vec):
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
   ld   r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31)
+  mtcr r0
   ld   r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31)
   ld   r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31)
   ld   r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31)
@@ -443,7 +451,9 @@ L(do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
index ec3ab5d9e6..15d8e84c1f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 1999, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995,96,97,99, 2003, 2006 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
@@ -13,8 +13,8 @@
 
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   write to the Free Software Foundation, Inc., 51 Franklin Street, 
+   Fifth Floor, Boston MA 02110-1301, USA.  */
 
 #include <sysdep-cancel.h>
 #include <socketcall.h>
@@ -41,18 +41,17 @@
 
 #define stackblock 80 /* offset to socket parm area.  */
 
-#ifndef socket
-/* If this is just socket.S leave it alone! */
-#else
 #ifndef __socket
-#define __socket P(__,socket)
-#endif
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
 	.text
 ENTRY(__socket)
 	CALL_MCOUNT NARGS
-	cfi_startproc
 	stdu r1,-144(r1)
 	cfi_adjust_cfa_offset(144)
 #if NARGS >= 1
@@ -117,7 +116,8 @@ ENTRY(__socket)
 	addi	r1,r1,144
 	PSEUDO_RET
 #endif
-	cfi_endproc
 PSEUDO_END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
index f99df951a2..936d641b6b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/swapcontext.S
@@ -1,5 +1,5 @@
 /* Save current context and install the given one.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006 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
@@ -14,13 +14,13 @@
 
    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.  */
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA
+   02110-1301 USA.  */
 
 #include <sysdep.h>
 #include <rtld-global-offsets.h>
 #include <shlib-compat.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #define __ASSEMBLY__
 #include <asm/ptrace.h>
@@ -35,11 +35,14 @@ ENTRY(__novec_swapcontext)
   std  r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -150,7 +153,7 @@ ENTRY(__novec_swapcontext)
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(nv_do_sigret)
 
@@ -199,7 +202,7 @@ ENTRY(__novec_swapcontext)
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
+  mtcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
@@ -262,6 +265,7 @@ L(nv_do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset(lr,FRAME_LR_SAVE)
   stdu r1,-128(r1)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
@@ -296,11 +300,14 @@ ENTRY(__swapcontext)
   std  r1,(SIGCONTEXT_GP_REGS+(PT_R1*8))(r3)
   mflr  r0
   std   r31,-8(1)
+  cfi_offset(r31,-8)
   std  r2,(SIGCONTEXT_GP_REGS+(PT_R2*8))(r3)
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_LNK*8))(r3)
   std  r0,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
   stdu  r1,-128(r1)
+  cfi_adjust_cfa_offset(128)
   std  r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r3)
   std  r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r3)
   std  r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r3)
@@ -521,7 +528,7 @@ L(has_no_vec):
  * of a procedure call (makecontext), so we don't need to restore
  * msr and ctr.  We don't restore r13 since it will be used as
  * the TLS pointer.  */
-  lwz	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
+  ld	  r0,(SIGCONTEXT_GP_REGS+(PT_MSR*8))(r31)
   cmpdi r0,0
   bne	  L(do_sigret)
 
@@ -681,11 +688,11 @@ L(has_no_vec2):
   ld   r4,(SIGCONTEXT_GP_REGS+(PT_R4*8))(r31)
   ld   r0,(SIGCONTEXT_GP_REGS+(PT_CCR*8))(r31)
   ld   r5,(SIGCONTEXT_GP_REGS+(PT_R5*8))(r31)
-  mfcr r0
   ld   r6,(SIGCONTEXT_GP_REGS+(PT_R6*8))(r31)
   ld   r7,(SIGCONTEXT_GP_REGS+(PT_R7*8))(r31)
   ld   r8,(SIGCONTEXT_GP_REGS+(PT_R8*8))(r31)
   ld   r9,(SIGCONTEXT_GP_REGS+(PT_R9*8))(r31)
+  mtcr r0
   ld   r10,(SIGCONTEXT_GP_REGS+(PT_R10*8))(r31)
   ld   r11,(SIGCONTEXT_GP_REGS+(PT_R11*8))(r31)
   ld   r12,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r31)
@@ -744,7 +751,9 @@ L(do_sigret):
   /* If the kernel is not at least 2.4.21 then generate a ENOSYS stub.  */
   mflr r0
   std  r0,FRAME_LR_SAVE(r1)
+  cfi_offset (lr, FRAME_LR_SAVE)
   stdu r1,-128(r1)
+  cfi_adjust_cfa_offset (128)
   li   r3,ENOSYS
   bl   JUMPTARGET(__syscall_error)
   nop
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 38a376fa90..aab4b721c0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1992,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
+	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
@@ -23,6 +23,7 @@
 #define _LINUX_POWERPC_SYSDEP_H 1
 
 #include <sysdeps/unix/powerpc/sysdep.h>
+#include <tls.h>
 
 /* Define __set_errno() for INLINE_SYSCALL macro below.  */
 #ifndef __ASSEMBLER__
@@ -61,12 +62,118 @@
 #ifdef __ASSEMBLER__
 
 /* This seems to always be the case on PPC.  */
-#define ALIGNARG(log2) log2
+# define ALIGNARG(log2) log2
 /* For ELF we need the `.type' directive to make shared libs work right.  */
-#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
-#define ASM_SIZE_DIRECTIVE(name) .size name,.-name
+# define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
+# define ASM_SIZE_DIRECTIVE(name) .size name,.-name
 
-#endif	/* __ASSEMBLER__ */
+#endif /* __ASSEMBLER__ */
+
+/* This version is for kernels that implement system calls that
+   behave like function calls as far as register saving.
+   It falls back to the syscall in the case that the vDSO doesn't
+   exist or fails for ENOSYS */
+#ifdef SHARED
+# define INLINE_VSYSCALL(name, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    __label__ iserr;							      \
+    INTERNAL_SYSCALL_DECL (sc_err);					      \
+    long int sc_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args);   \
+	if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+	  goto out;							      \
+	if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS)		      \
+	  goto iserr;							      \
+      }									      \
+									      \
+    sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args);		      \
+    if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err))			      \
+      {									      \
+      iserr:								      \
+        __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err));		      \
+        sc_ret = -1L;							      \
+      }									      \
+  out:									      \
+    sc_ret;								      \
+  })
+#else
+# define INLINE_VSYSCALL(name, nr, args...) \
+  INLINE_SYSCALL (name, nr, ##args)
+#endif
+
+#ifdef SHARED
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  ({									      \
+    __label__ out;							      \
+    long int v_ret;							      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      {									      \
+	v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+	if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err)			      \
+	    || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS)		      \
+	  goto out;							      \
+      }									      \
+    v_ret = INTERNAL_SYSCALL (name, err, nr, ##args);			      \
+  out:									      \
+    v_ret;								      \
+  })
+#else
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+  INTERNAL_SYSCALL (name, err, nr, ##args)
+#endif
+
+/* This version is for internal uses when there is no desire
+   to set errno */
+#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...)	      \
+  ({									      \
+    long int sc_ret = ENOSYS;						      \
+									      \
+    if (__vdso_##name != NULL)						      \
+      sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args);	      \
+    else								      \
+      err = 1 << 28;							      \
+    sc_ret;								      \
+  })
+
+/* List of system calls which are supported as vsyscalls.  */
+#define HAVE_CLOCK_GETRES_VSYSCALL	1
+#define HAVE_CLOCK_GETTIME_VSYSCALL	1
+
+/* Define a macro which expands inline into the wrapper code for a system
+   call. This use is for internal calls that do not need to handle errors
+   normally. It will never touch errno. This returns just what the kernel
+   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...) \
+  ({									\
+    register void *r0  __asm__ ("r0");					\
+    register long int r3  __asm__ ("r3");				\
+    register long int r4  __asm__ ("r4");				\
+    register long int r5  __asm__ ("r5");				\
+    register long int r6  __asm__ ("r6");				\
+    register long int r7  __asm__ ("r7");				\
+    register long int r8  __asm__ ("r8");				\
+    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;						\
+    (int) r3;								\
+  })
 
 #undef INLINE_SYSCALL
 
@@ -100,7 +207,7 @@
     register long int r6  __asm__ ("r6");				\
     register long int r7  __asm__ ("r7");				\
     register long int r8  __asm__ ("r8");				\
-    LOADARGS_##nr(name, args);						\
+    LOADARGS_##nr (name, ##args);					\
     __asm__ __volatile__						\
       ("sc\n\t"								\
        "mfcr  %0\n\t"							\
@@ -115,14 +222,14 @@
     (int) r3;  \
   })
 #define INTERNAL_SYSCALL(name, err, nr, args...)			\
-  INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
+  INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args)
 
 #undef INTERNAL_SYSCALL_DECL
 #define INTERNAL_SYSCALL_DECL(err) long int err
 
 #undef INTERNAL_SYSCALL_ERROR_P
 #define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  (__builtin_expect (err & (1 << 28), 0))
+  ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
 
 #undef INTERNAL_SYSCALL_ERRNO
 #define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
@@ -180,4 +287,29 @@
 #define ASM_INPUT_5 ASM_INPUT_4, "5" (r7)
 #define ASM_INPUT_6 ASM_INPUT_5, "6" (r8)
 
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+	ld	tmpreg,POINTER_GUARD(r13); \
+	xor	reg,tmpreg,reg
+#  define PTR_MANGLE2(reg, tmpreg) \
+	xor	reg,tmpreg,reg
+#  define PTR_MANGLE3(destreg, reg, tmpreg) \
+	ld	tmpreg,POINTER_GUARD(r13); \
+	xor	destreg,tmpreg,reg
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+#  define PTR_DEMANGLE2(reg, tmpreg) PTR_MANGLE2 (reg, tmpreg)
+#  define PTR_DEMANGLE3(destreg, reg, tmpreg) PTR_MANGLE3 (destreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/powerpc/powerpc64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h
deleted file mode 100644
index 45f1bfdae9..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the powerpc64 ABI stack frame.  */
-
-#define FRAME_BACKCHAIN 0
-#define FRAME_CR_SAVE 8
-#define FRAME_LR_SAVE 16
-#define FRAME_COMPILER_DW 24
-#define FRAME_LINKER_DW 32
-#define FRAME_TOC_SAVE 40
-#define FRAME_PARM_SAVE 48
-#define FRAME_PARM1_SAVE 48
-#define FRAME_PARM2_SAVE 56
-#define FRAME_PARM3_SAVE 64
-#define FRAME_PARM4_SAVE 72
-#define FRAME_PARM5_SAVE 80
-#define FRAME_PARM6_SAVE 88
-#define FRAME_PARM7_SAVE 96
-#define FRAME_PARM8_SAVE 104
-#define FRAME_PARM9_SAVE 112
-
-
-/* Offsets of the fields in the ucontext_t structure.  */
-
-#define UCONTEXT_LINK 8
-#define UCONTEXT_STACK 16
-#define UCONTEXT_STACK_SP 16
-#define UCONTEXT_STACK_FLAGS 24
-#define UCONTEXT_STACK_SIZE 32
-#define UCONTEXT_SIGMASK 40
-#define UCONTEXT_MCONTEXT 168
-#define SIGCONTEXT_SIGNAL 200
-#define SIGCONTEXT_HANDLER 208
-#define SIGCONTEXT_OLDMASK 216
-#define SIGCONTEXT_PT_REGS 224
-#define SIGCONTEXT_GP_REGS 232
-#define SIGCONTEXT_FP_REGS 616
-#define SIGCONTEXT_V_REGS_PTR 880
-#define SIGCONTEXT_V_RESERVE 888
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
new file mode 100644
index 0000000000..a35418d9d4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
@@ -0,0 +1,50 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+
+-- Offsets of the fields in the powerpc64 ABI stack frame.
+-- XXX Do these correspond to some struct?
+
+FRAME_BACKCHAIN		0
+FRAME_CR_SAVE		8
+FRAME_LR_SAVE		16
+FRAME_COMPILER_DW	24
+FRAME_LINKER_DW		32
+FRAME_TOC_SAVE		40
+FRAME_PARM_SAVE		48
+FRAME_PARM1_SAVE	48
+FRAME_PARM2_SAVE	56
+FRAME_PARM3_SAVE	64
+FRAME_PARM4_SAVE	72
+FRAME_PARM5_SAVE	80
+FRAME_PARM6_SAVE	88
+FRAME_PARM7_SAVE	96
+FRAME_PARM8_SAVE	104
+FRAME_PARM9_SAVE	112
+
+
+-- Offsets of the fields in the ucontext_t structure.
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+UCONTEXT_LINK			ucontext (uc_link)
+UCONTEXT_STACK			ucontext (uc_stack)
+UCONTEXT_STACK_SP		ucontext (uc_stack.ss_sp)
+UCONTEXT_STACK_FLAGS		ucontext (uc_stack.ss_flags)
+UCONTEXT_STACK_SIZE		ucontext (uc_stack.ss_size)
+UCONTEXT_SIGMASK		ucontext (uc_sigmask)
+UCONTEXT_MCONTEXT		ucontext (uc_mcontext)
+SIGCONTEXT_SIGNAL		mcontext (signal)
+SIGCONTEXT_HANDLER		mcontext (handler)
+SIGCONTEXT_OLDMASK		mcontext (oldmask)
+SIGCONTEXT_PT_REGS		mcontext (regs)
+SIGCONTEXT_GP_REGS		mcontext (gp_regs)
+SIGCONTEXT_FP_REGS		mcontext (fp_regs)
+SIGCONTEXT_V_REGS_PTR		mcontext (v_regs)
+SIGCONTEXT_V_RESERVE		mcontext (vmx_reserve)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c
index 9a91ba5b2f..e10b40f96c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/umount.c
@@ -1 +1 @@
-#include <sysdeps/unix/sysv/linux/hppa/umount.c>
+#include <sysdeps/unix/sysv/linux/x86_64/umount.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/readelflib.c b/sysdeps/unix/sysv/linux/powerpc/readelflib.c
index b4a449cdff..3c6b2daf81 100644
--- a/sysdeps/unix/sysv/linux/powerpc/readelflib.c
+++ b/sysdeps/unix/sysv/linux/powerpc/readelflib.c
@@ -1,5 +1,5 @@
 /* Special checks on libraries for ldconfig.  Linux/PowerPC version.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 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
@@ -52,10 +52,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
index 8e694c2ad3..577689f18d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999, 2002, 2006 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
@@ -35,10 +35,14 @@ __BEGIN_DECLS
 /* These definitions are normally provided by ucontext.h via 
    asm/sigcontext.h, asm/ptrace.h, and asm/elf.h.  Otherwise we define 
    them here.  */ 
-#ifndef __PPC64_ELF_H
+#if !defined __PPC64_ELF_H && !defined _ASM_POWERPC_ELF_H
 #define ELF_NGREG       48      /* includes nip, msr, lr, etc. */
 #define ELF_NFPREG      33      /* includes fpscr */
-#define ELF_NVRREG      33      /* includes vscr */
+#if __WORDSIZE == 32
+# define ELF_NVRREG      33      /* includes vscr */
+#else
+# define ELF_NVRREG      34      /* includes vscr */
+#endif
 
 typedef unsigned long elf_greg_t;
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
@@ -46,15 +50,10 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 typedef double elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
-/* gcc 3.1 and newer support __uint128_t.  */
-#if !__GNUC_PREREQ(3,1)
-typedef struct {
-  unsigned long u[4];
-} __attribute((aligned(16))) __uint128_t;
-#endif
-
 /* Altivec registers */
-typedef __uint128_t elf_vrreg_t;
+typedef struct {
+  unsigned int u[4];
+} __attribute__ ((aligned (16))) elf_vrreg_t;
 typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG];
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h b/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
index 91a87307f3..5d055f67fe 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2006 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
@@ -79,8 +79,24 @@ enum __ptrace_request
 #define PT_DETACH PTRACE_DETACH
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
index a499a80ef9..9eb50aa96b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999, 2002, 2004, 2005 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
@@ -70,8 +70,6 @@ typedef struct
  * can be refernced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC
  * is set in AT_HWCAP.  */
     
-# include <asm/types.h>
-
 /* Number of general registers.  */
 # define NGREG	48	/* includes r0-r31, nip, msr, lr, etc.   */
 # define NFPREG	33	/* includes fp0-fp31 &fpscr.  */
diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
new file mode 100644
index 0000000000..cfc86ba806
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ppoll.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_ppoll
+static int __generic_ppoll (struct pollfd *fds, nfds_t nfds,
+			    const struct timespec *timeout,
+			    const sigset_t *sigmask);
+
+
+int
+ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
+       const sigset_t *sigmask)
+{
+  /* The Linux kernel can in some situations update the timeout value.
+     We do not want that so use a local variable.  */
+  struct timespec tval;
+  if (timeout != NULL)
+    {
+      tval = *timeout;
+      timeout = &tval;
+    }
+
+  int result;
+
+  if (SINGLE_THREAD_P)
+    result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
+  else
+    {
+      int oldtype = LIBC_CANCEL_ASYNC ();
+
+      result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask,
+			       _NSIG / 8);
+
+      LIBC_CANCEL_RESET (oldtype);
+    }
+
+# ifndef __ASSUME_PPOLL
+  if (result == -1 && errno == ENOSYS)
+    result = __generic_ppoll (fds, nfds, timeout, sigmask);
+# endif
+
+  return result;
+}
+
+# ifndef __ASSUME_PPOLL
+#  define ppoll static __generic_ppoll
+# endif
+#endif
+
+#ifndef __ASSUME_PPOLL
+# include <io/ppoll.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c
index 90057f3f40..d459e98f2c 100644
--- a/sysdeps/unix/sysv/linux/pread.c
+++ b/sysdeps/unix/sysv/linux/pread.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pread64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pread
diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c
index 44ea68fa9f..07d8b68acc 100644
--- a/sysdeps/unix/sysv/linux/pread64.c
+++ b/sysdeps/unix/sysv/linux/pread64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pread64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pread
diff --git a/sysdeps/unix/sysv/linux/prof-freq.c b/sysdeps/unix/sysv/linux/prof-freq.c
index 621a4c4d25..49ec257e70 100644
--- a/sysdeps/unix/sysv/linux/prof-freq.c
+++ b/sysdeps/unix/sysv/linux/prof-freq.c
@@ -1,5 +1,5 @@
 /* Determine realtime clock frequency.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 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
@@ -19,7 +19,7 @@
 
 #include <sys/time.h>
 #include <libc-internal.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <ldsodefs.h>
 
 
diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c
new file mode 100644
index 0000000000..0dd744f527
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/pselect.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@redhat.com>, 2006.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <time.h>
+#include <sys/poll.h>
+#include <kernel-features.h>
+#include <sysdep-cancel.h>
+
+
+#ifdef __NR_pselect6
+static int __generic_pselect (int nfds, fd_set *readfds, fd_set *writefds,
+			      fd_set *exceptfds,
+			      const struct timespec *timeout,
+			      const sigset_t *sigmask);
+
+
+int
+__pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+	   const struct timespec *timeout, const sigset_t *sigmask)
+{
+  /* The Linux kernel can in some situations update the timeout value.
+     We do not want that so use a local variable.  */
+  struct timespec tval;
+  if (timeout != NULL)
+    {
+      tval = *timeout;
+      timeout = &tval;
+    }
+
+  /* Note: the system call expects 7 values but on most architectures
+     we can only pass in 6 directly.  If there is an architecture with
+     support for more parameters a new version of this file needs to
+     be created.  */
+  struct
+  {
+    const sigset_t *ss;
+    size_t ss_len;
+  } data;
+
+  data.ss = sigmask;
+  data.ss_len = _NSIG / 8;
+
+  int result;
+
+#ifndef CALL_PSELECT6
+# define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
+  INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds,	      \
+		  timeout, data)
+#endif
+
+  if (SINGLE_THREAD_P)
+    result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+			    &data);
+  else
+    {
+      int oldtype = LIBC_CANCEL_ASYNC ();
+
+      result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+			      &data);
+
+      LIBC_CANCEL_RESET (oldtype);
+    }
+
+# ifndef __ASSUME_PSELECT
+  if (result == -1 && errno == ENOSYS)
+    result = __generic_pselect (nfds, readfds, writefds, exceptfds, timeout,
+				sigmask);
+# endif
+
+  return result;
+}
+weak_alias (__pselect, pselect)
+strong_alias (__pselect, __libc_pselect)
+
+# ifndef __ASSUME_PSELECT
+#  define __pselect static __generic_pselect
+# endif
+#endif
+
+#ifndef __ASSUME_PSELECT
+# include <misc/pselect.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/ptrace.c b/sysdeps/unix/sysv/linux/ptrace.c
index e33eee0ee8..e149d80477 100644
--- a/sysdeps/unix/sysv/linux/ptrace.c
+++ b/sysdeps/unix/sysv/linux/ptrace.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1998,2000,2003,2006 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
@@ -21,6 +21,7 @@
 #include <sys/ptrace.h>
 #include <sys/user.h>
 #include <stdarg.h>
+#include <signal.h>
 
 #include <sysdep.h>
 #include <sys/syscall.h>
@@ -89,6 +90,19 @@ ptrace (enum __ptrace_request request, ...)
 #endif
       break;
 
+    case PTRACE_GETSIGINFO:
+    case PTRACE_SETSIGINFO:
+      (void) CHECK_1 ((siginfo_t *) data);
+      break;
+
+    case PTRACE_GETEVENTMSG:
+      (void) CHECK_1 ((unsigned long *) data);
+      break;
+
+    case PTRACE_SETOPTIONS:
+      (void) CHECK_1 ((long *) data);
+      break;
+
     case PTRACE_TRACEME:
     case PTRACE_CONT:
     case PTRACE_KILL:
diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
index f4eb2f5544..7afb814518 100644
--- a/sysdeps/unix/sysv/linux/pwrite.c
+++ b/sysdeps/unix/sysv/linux/pwrite.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pwrite64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pwrite
diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
index ae63ed0794..a0a6a08311 100644
--- a/sysdeps/unix/sysv/linux/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/pwrite64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -25,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_pwrite64		/* Newer kernels renamed but it's the same.  */
 # ifdef __NR_pwrite
diff --git a/sysdeps/unix/sysv/linux/readdir64.c b/sysdeps/unix/sysv/linux/readdir64.c
index fa815e9581..e2c5002390 100644
--- a/sysdeps/unix/sysv/linux/readdir64.c
+++ b/sysdeps/unix/sysv/linux/readdir64.c
@@ -4,4 +4,4 @@
 
 #include <sysdeps/unix/readdir.c>
 
-weak_alias(__readdir64, readdir64)
+weak_alias (__readdir64, readdir64)
diff --git a/sysdeps/unix/sysv/linux/readdir64_r.c b/sysdeps/unix/sysv/linux/readdir64_r.c
index d63680bf9a..bce56124ef 100644
--- a/sysdeps/unix/sysv/linux/readdir64_r.c
+++ b/sysdeps/unix/sysv/linux/readdir64_r.c
@@ -4,4 +4,4 @@
 
 #include <sysdeps/unix/readdir_r.c>
 
-weak_alias(__readdir64_r, readdir64_r)
+weak_alias (__readdir64_r, readdir64_r)
diff --git a/sysdeps/unix/sysv/linux/readlinkat.c b/sysdeps/unix/sysv/linux/readlinkat.c
new file mode 100644
index 0000000000..1361596503
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/readlinkat.c
@@ -0,0 +1,90 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Read the contents of the symbolic link PATH relative to FD into no
+   more than LEN bytes of BUF.  */
+ssize_t
+readlinkat (fd, path, buf, len)
+     int fd;
+     const char *path;
+     char *buf;
+     size_t len;
+{
+  int result;
+
+#ifdef __NR_readlinkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (readlinkat, 4, fd, path, buf, len);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *pathbuf = NULL;
+
+  if (fd != AT_FDCWD && path[0] != '/')
+    {
+      size_t pathlen = strlen (path);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + pathlen;
+      pathbuf = __alloca (buflen);
+
+      __snprintf (pathbuf, buflen, procfd, fd, path);
+      path = pathbuf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (readlink, err, 3, path, buf, len);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, pathbuf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
+libc_hidden_def (readlinkat)
diff --git a/sysdeps/unix/sysv/linux/readonly-area.c b/sysdeps/unix/sysv/linux/readonly-area.c
index ce5321bcef..69e926a7a1 100644
--- a/sysdeps/unix/sysv/linux/readonly-area.c
+++ b/sysdeps/unix/sysv/linux/readonly-area.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005 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
@@ -16,6 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <errno.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdio_ext.h>
@@ -33,7 +34,19 @@ __readonly_area (const char *ptr, size_t size)
 
   FILE *fp = fopen ("/proc/self/maps", "rc");
   if (fp == NULL)
-    return -1;
+    {
+      /* It is the system administrator's choice to not have /proc
+	 available to this process (e.g., because it runs in a chroot
+	 environment.  Don't fail in this case.  */
+      if (errno == ENOENT
+	  /* The kernel has a bug in that a process is denied access
+	     to the /proc filesystem if it is set[ug]id.  There has
+	     been no willingness to change this in the kernel so
+	     far.  */
+	  || errno == EACCES)
+	return 1;
+      return -1;
+    }
 
   /* We need no locking.  */
   __fsetlocking (fp, FSETLOCKING_BYCALLER);
diff --git a/sysdeps/unix/sysv/linux/renameat.c b/sysdeps/unix/sysv/linux/renameat.c
new file mode 100644
index 0000000000..86bb75a7b0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/renameat.c
@@ -0,0 +1,184 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <kernel-features.h>
+#include <sysdep.h>
+
+
+#ifndef __ASSUME_ATFCTS
+void
+attribute_hidden
+__atfct_seterrno_2 (int errval, int fd1, const char *buf1, int fd2,
+		    const char *buf2)
+{
+  if (buf1 != NULL || buf2 != NULL)
+    {
+      struct stat64 st;
+
+      if (errval == ENOTDIR)
+	{
+	  /* This can mean either the file descriptor is invalid or
+	     /proc is not mounted.  */
+	  if (buf1 != NULL)
+	    {
+	      if (__fxstat64 (_STAT_VER, fd1, &st) != 0)
+		/* errno is already set correctly.  */
+		return;
+
+	      /* If /proc is not mounted there is nothing we can do.  */
+	      if (S_ISDIR (st.st_mode)
+		  && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+		      || !S_ISDIR (st.st_mode)))
+		{
+		  errval = ENOSYS;
+		  goto out;
+		}
+	    }
+
+	  if (buf2 != NULL)
+	    {
+	      if (__fxstat64 (_STAT_VER, fd2, &st) != 0)
+		/* errno is already set correctly.  */
+		return;
+
+	      /* If /proc is not mounted there is nothing we can do.  */
+	      if (S_ISDIR (st.st_mode)
+		  && (__xstat64 (_STAT_VER, "/proc/self/fd", &st) != 0
+		      || !S_ISDIR (st.st_mode)))
+		errval = ENOSYS;
+	    }
+	}
+      else if (errval == ENOENT)
+	{
+	  /* This could mean the file descriptor is not valid.  We
+	     reuse BUF for the stat call.  Find the slash after the
+	     file descriptor number.  */
+	  if (buf1 != NULL)
+	    {
+	      *(char *) strchr (buf1 + sizeof "/proc/self/fd", '/') = '\0';
+
+	      int e = __lxstat64 (_STAT_VER, buf1, &st);
+	      if ((e == -1 && errno == ENOENT)
+		  ||(e == 0 && !S_ISLNK (st.st_mode)))
+		{
+		  errval = EBADF;
+		  goto out;
+		}
+	    }
+
+	  if (buf2 != NULL)
+	    {
+	      *(char *) strchr (buf2 + sizeof "/proc/self/fd", '/') = '\0';
+
+	      int e = __lxstat64 (_STAT_VER, buf2, &st);
+	      if ((e == -1 && errno == ENOENT)
+		  ||(e == 0 && !S_ISLNK (st.st_mode)))
+		errval = EBADF;
+	    }
+	}
+    }
+
+ out:
+  __set_errno (errval);
+}
+#endif
+
+
+/* Rename the file OLD relative to OLDFD to NEW relative to NEWFD.  */
+int
+renameat (oldfd, old, newfd, new)
+     int oldfd;
+     const char *old;
+     int newfd;
+     const char *new;
+{
+  int result;
+
+#ifdef __NR_renameat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (renameat, 4, oldfd, old, newfd, new);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  static const char procfd[] = "/proc/self/fd/%d/%s";
+  char *bufold = NULL;
+
+  if (oldfd != AT_FDCWD && old[0] != '/')
+    {
+      size_t filelen = strlen (old);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      bufold = alloca (buflen);
+
+      __snprintf (bufold, buflen, procfd, oldfd, old);
+      old = bufold;
+    }
+
+  char *bufnew = NULL;
+
+  if (newfd != AT_FDCWD && new[0] != '/')
+    {
+      size_t filelen = strlen (new);
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      bufnew = alloca (buflen);
+
+      __snprintf (bufnew, buflen, procfd, newfd, new);
+      new = bufnew;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (rename, err, 2, old,  new);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno_2 (INTERNAL_SYSCALL_ERRNO (result, err), newfd, bufnew,
+			  oldfd, bufold);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/s390/Dist b/sysdeps/unix/sysv/linux/s390/Dist
deleted file mode 100644
index 4af39f72c9..0000000000
--- a/sysdeps/unix/sysv/linux/s390/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-ldd-rewrite.sed
-sys/elf.h
-sys/procfs.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/s390/Implies b/sysdeps/unix/sysv/linux/s390/Implies
new file mode 100644
index 0000000000..efda9d27c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/Implies
@@ -0,0 +1,3 @@
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile
index 8d8df743ac..5c5381871b 100644
--- a/sysdeps/unix/sysv/linux/s390/Makefile
+++ b/sysdeps/unix/sysv/linux/s390/Makefile
@@ -2,3 +2,7 @@
 ifeq ($(subdir),rt)
 librt-routines += rt-sysdep
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
index 8c47077580..c611028f29 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2004, 2006 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
@@ -23,6 +23,10 @@
 
 #include <sys/types.h>
 #include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -110,7 +114,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -199,10 +203,55 @@ struct flock64
 # endif
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/s390/bits/mman.h b/sysdeps/unix/sysv/linux/s390/bits/mman.h
index ac94bb20b2..d25531c282 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/s390 version.
-   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000,2001,2002,2003,2005,2006 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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/s390/bits/shm.h b/sysdeps/unix/sysv/linux/s390/bits/shm.h
index b7c2ad0514..d88ed36efa 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/shm.h
@@ -80,6 +80,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000	/* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/s390/fpu/Implies b/sysdeps/unix/sysv/linux/s390/fpu/Implies
new file mode 100644
index 0000000000..3a8e225986
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/fpu/Implies
@@ -0,0 +1,2 @@
+# Override ldbl-opt with s390 specific routines.
+s390/fpu
diff --git a/sysdeps/unix/sysv/linux/s390/nldbl-abi.h b/sysdeps/unix/sysv/linux/s390/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/s390/readelflib.c b/sysdeps/unix/sysv/linux/s390/readelflib.c
index c8efcbf7ac..2782bc1e01 100644
--- a/sysdeps/unix/sysv/linux/s390/readelflib.c
+++ b/sysdeps/unix/sysv/linux/s390/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2005 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
@@ -51,10 +51,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Dist b/sysdeps/unix/sysv/linux/s390/s390-32/Dist
deleted file mode 100644
index c0a7dc8c93..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-clone.S
-oldgetrlimit64.c
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
index 0656b396f8..5909ba8a43 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,2002,2003,2004,2006 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
@@ -25,7 +25,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /*
   In Linux 2.1.x the chown functions have been changed.  A new function lchown
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
new file mode 100644
index 0000000000..dfed76aeb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fchownat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchownat.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c b/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
index 2578b3ddc0..3b38d19488 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
 	br	%r14
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
index ccdb67b15c..1e64a0ef75 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2003, 2006 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
@@ -24,7 +24,7 @@
 #include <bp-checks.h>
 
 #include <linux/posix_types.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 # ifdef __NR_lchown32
 #  if __ASSUME_32BITUIDS == 0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
index 29c8640e92..94760e0c2b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/makecontext.c
@@ -37,8 +37,6 @@
                +-----------------------+
              n | overflow parameters   | 96
                +-----------------------+
-             8 | trampoline            | 96+n
-               +-----------------------+
    The registers are set up like this:
      %r2-%r6: parameters 1 to 5
      %r7    : (*func) pointer
@@ -55,18 +53,16 @@
 void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
+  extern void __makecontext_ret (void);
   unsigned long *sp;
   va_list ap;
   int i;
 
-  sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
-
-  /* Setup the trampoline.  */
-  *--sp = 0x07f90000;
-  *--sp = 0x0de71828;
+  sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
+			   + ucp->uc_stack.ss_size) & -8L);
 
   /* Set the return address to trampoline.  */
-  ucp->uc_mcontext.gregs[14] = (long) sp;
+  ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
 
   /* Set register parameters.  */
   va_start (ap, argc);
@@ -98,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
   ucp->uc_mcontext.gregs[15] = (long) sp;
 }
 
+asm(".text\n"
+    ".type __makecontext_ret,@function\n"
+    "__makecontext_ret:\n"
+    "      basr  %r14,%r7\n"
+    "      lr    %r2,%r8\n"
+    "      br    %r9\n"
+    ".size __makecontext_ret, .-__makecontext_ret");
+
 weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
index 7ad360a3a0..cce8d29735 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
 	br	%r14
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
index d9abb62c0b..bf70f11cc7 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
 	/* Return.  */
 	br	%r14
 END(__swapcontext)	
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
index d1ce925ac3..b7e1736891 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -48,13 +48,14 @@ ENTRY (syscall)
 	lr     %r4,%r5             /* third parameter  */
 	lr     %r5,%r6             /* fourth parameter */
 	l      %r6,192(%r15)       /* fifth parameter  */
+	l      %r7,196(%r15)       /* sixth parameter  */
 
-	basr   %r7,0
-0:	cl     %r1,4f-0b(%r7)      /* svc number < 256? */
+	basr   %r8,0
+0:	cl     %r1,4f-0b(%r8)      /* svc number < 256? */
 	jl     2f
 1:	svc    0
 	j      3f
-2:	ex     %r1,1b-0b(%r7)      /* lsb of R1 is subsituted as SVC number */
+2:	ex     %r1,1b-0b(%r8)      /* lsb of R1 is subsituted as SVC number */
 3:	l      %r15,0(%r15)        /* load back chain */
 	cfi_adjust_cfa_offset (-96)
 	lm     %r6,15,24(%r15)     /* load registers */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index 43b1b951d5..b86072bd30 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000,01,02,03,04 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -23,6 +24,7 @@
 #include <sysdeps/s390/s390-32/sysdep.h>
 #include <sysdeps/unix/sysdep.h>
 #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO.  */
+#include <tls.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
@@ -111,8 +113,8 @@
 0:  lcr   %r0,%r2;							      \
     basr  %r1,0;							      \
 1:  al    %r1,2f-1b(%r1);						      \
-    l     %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1)			      \
-    ear   %r2,%a0							      \
+    l     %r1,SYSCALL_ERROR_ERRNO@gotntpoff(%r1);			      \
+    ear   %r2,%a0;							      \
     st    %r0,0(%r1,%r2);						      \
     lhi   %r2,-1;							      \
     br    %r14;								      \
@@ -147,19 +149,28 @@
 	arg 3		4	     call-clobbered
 	arg 4		5	     call-clobbered
 	arg 5		6	     call-saved
+	arg 6		7	     call-saved
 
    (Of course a function with say 3 arguments does not have entries for
    arguments 4 and 5.)
-   S390 does not need to do ANY stack operations to get its parameters
-   right.
+   For system calls with 6 parameters a stack operation is required
+   to load the 6th parameter to register 7. Call saved register 7 is
+   moved to register 0 and back to avoid an additional stack frame.
  */
 
 #define DO_CALL(syscall, args)						      \
+  .if args > 5;								      \
+    lr %r0,%r7;								      \
+    l %r7,96(%r15);							      \
+  .endif;								      \
   .if SYS_ify (syscall) < 256;						      \
     svc SYS_ify (syscall);						      \
   .else;								      \
     lhi %r1,SYS_ify (syscall);						      \
     svc 0;								      \
+  .endif;								      \
+  .if args > 5;								      \
+    lr %r7,%r0;								      \
   .endif
 
 #define ret                                                                   \
@@ -253,6 +264,9 @@
 #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
 	DECLARGS_4(arg1, arg2, arg3, arg4) \
 	register unsigned long gpr6 asm ("6") = (unsigned long)(arg5);
+#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+	register unsigned long gpr7 asm ("7") = (unsigned long)(arg6);
 
 #define ASMFMT_0
 #define ASMFMT_1 , "0" (gpr2)
@@ -260,5 +274,28 @@
 #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
 #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
 #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
+#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
+
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+/* For the time being just use stack_guard rather than a separate
+   pointer_guard.  */
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+  ear     tmpreg,%a0;			\
+  x       reg,STACK_GUARD(tmpreg)
+#  define PTR_MANGLE2(reg, tmpreg) \
+  x       reg,STACK_GUARD(tmpreg)
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
 
 #endif /* _LINUX_S390_SYSDEP_H */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h
deleted file mode 100644
index 2e51f04e65..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Constants shared between setcontext() and getcontext().  Don't
-   install this header file.  */
-
-#define SIG_BLOCK	0
-#define SIG_UNBLOCK	1
-#define SIG_SETMASK	2
-
-#define SC_FLGS 0x000
-#define SC_LINK 0x004
-#define SC_STCK 0x008
-#define SC_PSW  0x018
-#define SC_GPRS 0x020
-#define SC_ACRS 0x060
-#define SC_FPC  0x0A0
-#define SC_FPRS 0x0A8
-#define SC_MASK 0x128
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/Dist b/sysdeps/unix/sysv/linux/s390/s390-64/Dist
deleted file mode 100644
index bfd4edc372..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/Dist
+++ /dev/null
@@ -1,2 +0,0 @@
-clone.S
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
index 5a0d7eca5d..8889b5359e 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
@@ -72,4 +72,4 @@ ENTRY(__getcontext)
 	br	%r14
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
index cdff9a4f21..b08f1b4047 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/makecontext.c
@@ -37,8 +37,6 @@
                +-----------------------+
              n | overflow parameters   | 160
                +-----------------------+
-             8 | trampoline            | 160+n
-               +-----------------------+
    The registers are set up like this:
      %r2-%r6: parameters 1 to 5
      %r7    : (*func) pointer
@@ -55,17 +53,16 @@
 void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
+  extern void __makecontext_ret (void);
   unsigned long *sp;
   va_list ap;
   int i;
 
-  sp = (long *) (((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size) & -8L);
-
-  /* Setup the trampoline.  */
-  *--sp = 0x0de7b904002807f9;
+  sp = (unsigned long *) (((unsigned long) ucp->uc_stack.ss_sp
+			   + ucp->uc_stack.ss_size) & -8L);
 
   /* Set the return address to trampoline.  */
-  ucp->uc_mcontext.gregs[14] = (long) sp;
+  ucp->uc_mcontext.gregs[14] = (long) __makecontext_ret;
 
   /* Set register parameters.  */
   va_start (ap, argc);
@@ -97,4 +94,12 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
   ucp->uc_mcontext.gregs[15] = (long) sp;
 }
 
+asm(".text\n"
+    ".type __makecontext_ret,@function\n"
+    "__makecontext_ret:\n"
+    "      basr  %r14,%r7\n"
+    "      lgr   %r2,%r8\n"
+    "      br    %r9\n"
+    ".size __makecontext_ret, .-__makecontext_ret");
+
 weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
index 268f36e713..7beca847c2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
@@ -69,4 +69,4 @@ ENTRY(__setcontext)
 	br	%r14
 END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
index 480ebd424c..eff4f17853 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2005 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
@@ -44,6 +44,10 @@ __libc_sigaction (sig, act, oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
deleted file mode 100644
index 452f8354d0..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigsuspend.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep-cancel.h>
-#include <sys/syscall.h>
-
-/* Change the set of blocked signals to SET,
-   wait until a signal arrives, and restore the set of blocked signals.  */
-int
-__sigsuspend (set)
-     const sigset_t *set;
-{
-  /* XXX The size argument hopefully will have to be changed to the
-     real size of the user-level sigset_t.  */
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-libc_hidden_def (__sigsuspend)
-weak_alias (__sigsuspend, sigsuspend)
-strong_alias (__sigsuspend, __libc_sigsuspend)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/socket.S b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
index c98a97449b..d4c3a1c4e1 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/socket.S
@@ -128,6 +128,7 @@ L(socket_cancel):
 	j	4b
 #endif
 
+	SYSCALL_ERROR_HANDLER
 END (__socket)
 
 #ifndef NO_WEAK_ALIAS
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
index ef2a862c55..cb96fd3b6a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
@@ -105,4 +105,4 @@ ENTRY(__swapcontext)
 	/* Return.  */
 	br	%r14
 END(__swapcontext)	
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
index 4caeaeaf50..31b55d73f2 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -48,13 +48,14 @@ ENTRY (syscall)
 	lgr    %r4,%r5		   /* Third parameter.	*/
 	lgr    %r5,%r6		   /* Fourth parameter.	 */
 	lg     %r6,320(%r15)	   /* Fifth parameter.	*/
+	lg     %r7,328(%r15)	   /* Sixth parameter.	*/
 
-	basr   %r7,0
-0:	clg    %r1,4f-0b(%r7)      /* svc number < 256? */
+	basr   %r8,0
+0:	clg    %r1,4f-0b(%r8)      /* svc number < 256? */
 	jl     2f
 1:	svc    0
 	j      3f
-2:	ex     %r1,1b-0b(%r7)      /* lsb of R1 is subsituted as SVC number */
+2:	ex     %r1,1b-0b(%r8)      /* lsb of R1 is subsituted as SVC number */
 3:	lg     %r15,0(%r15)        /* load back chain */
 	cfi_adjust_cfa_offset (-160)
 	lmg	%r6,15,48(%r15)	   /* Load registers.  */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
index 477f8a9f09..791ab9ba52 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
@@ -1,6 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 vfork		-	vfork		0	__vfork		vfork
 
 # semaphore and shm system calls
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 154bc06803..9ddec8e041 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -1,5 +1,6 @@
 /* Assembler macros for 64 bit S/390.
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -24,6 +25,7 @@
 #include <sysdeps/s390/s390-64/sysdep.h>
 #include <sysdeps/unix/sysdep.h>
 #include <dl-sysdep.h>	/* For RTLD_PRIVATE_ERRNO.  */
+#include <tls.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
@@ -149,19 +151,28 @@
 	arg 3		4	     call-clobbered
 	arg 4		5	     call-clobbered
 	arg 5		6	     call-saved
+	arg 6		7	     call-saved
 
    (Of course a function with say 3 arguments does not have entries for
    arguments 4 and 5.)
-   S390 does not need to do ANY stack operations to get its parameters
-   right.
+   For system calls with 6 parameters a stack operation is required
+   to load the 6th parameter to register 7. Call saved register 7 is
+   moved to register 0 and back to avoid an additional stack frame.
  */
 
 #define DO_CALL(syscall, args)						      \
+  .if args > 5;								      \
+    lgr %r0,%r7;							      \
+    lg %r7,160(%r15);							      \
+  .endif;								      \
   .if SYS_ify (syscall) < 256;						      \
     svc SYS_ify (syscall);						      \
   .else;								      \
     lghi %r1,SYS_ify (syscall);						      \
     svc 0;								      \
+  .endif;								      \
+  .if args > 5;								      \
+    lgr %r7,%r0;							      \
   .endif
 
 #define ret								      \
@@ -255,6 +266,9 @@
 #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
 	DECLARGS_4(arg1, arg2, arg3, arg4) \
 	register unsigned long gpr6 asm ("6") = (unsigned long)(arg5);
+#define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+	DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
+	register unsigned long gpr7 asm ("7") = (unsigned long)(arg6);
 
 #define ASMFMT_0
 #define ASMFMT_1 , "0" (gpr2)
@@ -262,5 +276,29 @@
 #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
 #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
 #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
+#define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+/* For the time being just use stack_guard rather than a separate
+   pointer_guard.  */
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmpreg) \
+  ear     tmpreg,%a0;			\
+  sllg    tmpreg,tmpreg,32;		\
+  ear     tmpreg,%a1;			\
+  xg      reg,STACK_GUARD(tmpreg)
+#  define PTR_MANGLE2(reg, tmpreg) \
+  xg      reg,STACK_GUARD(tmpreg)
+#  define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
 
 #endif /* _LINUX_S390_SYSDEP_H */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
deleted file mode 100644
index 6d223a08a6..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-     Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Constants shared between setcontext() and getcontext().  Don't
-   install this header file.  */
-
-#define SIG_BLOCK	0
-#define SIG_UNBLOCK	1
-#define SIG_SETMASK	2
-
-#define SC_FLGS 0x000
-#define SC_LINK 0x008
-#define SC_STCK 0x010
-#define SC_PSW  0x028
-#define SC_GPRS 0x038
-#define SC_ACRS 0x0B8
-#define SC_FPC  0x0F8
-#define SC_FPRS 0x100
-#define SC_MASK 0x180
-
diff --git a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
index d26cf114ef..70eb4f8222 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2006 Free Software Foundation, Inc.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
    This file is part of the GNU C Library.
 
@@ -118,8 +118,24 @@ enum __ptrace_request
 #define PT_DETACH PTRACE_DETACH
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/s390/sys/user.h b/sysdeps/unix/sysv/linux/s390/sys/user.h
index eddd196c72..f00caea84d 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/user.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2005 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
@@ -19,6 +19,65 @@
 #ifndef _SYS_USER_H
 #define _SYS_USER_H	1
 
-#include <asm/user.h>
+/* The whole purpose of this file is for GDB and GDB only.  Don't read
+   too much into it.  Don't use it for anything other than GDB unless
+   you know what you are doing.  */
+
+struct _user_psw_struct
+{
+  unsigned long mask;
+  unsigned long addr;
+};
+
+struct _user_fpregs_struct
+{
+  unsigned int fpc;
+  double fprs[16];
+};
+
+struct _user_per_struct
+{
+  unsigned long control_regs[3];
+  unsigned single_step       : 1;
+  unsigned instruction_fetch : 1;
+  unsigned                   : 30;
+  unsigned long starting_addr;
+  unsigned long ending_addr;
+  unsigned short perc_atmid;
+  unsigned long address;
+  unsigned char access_id;
+};
+
+struct _user_regs_struct
+{
+  struct _user_psw_struct psw;		/* Program status word.  */
+  unsigned long gprs[16];		/* General purpose registers.  */
+  unsigned int  acrs[16];		/* Access registers.  */
+  unsigned long orig_gpr2;		/* Original gpr2.  */
+  struct _user_fpregs_struct fp_regs;	/* Floating point registers.  */
+  struct _user_per_struct per_info;	/* Hardware tracing registers.  */
+  unsigned long ieee_instruction_pointer; 
+};
+
+struct user {
+  struct _user_regs_struct regs;	/* User registers.  */
+  unsigned long int u_tsize;		/* Text segment size (pages).  */
+  unsigned long int u_dsize;		/* Data segment size (pages).  */
+  unsigned long int u_ssize;		/* Stack segment size (pages).  */
+  unsigned long start_code;		/* Starting address of text.  */
+  unsigned long start_stack;		/* Starting address of stack area.  */
+  long int signal;			/* Signal causing the core dump.  */
+  struct _user_regs_struct *u_ar0;	/* Help gdb find registers.  */
+  unsigned long magic;			/* Identifies a core file.  */
+  char u_comm[32];			/* User command naem.  */
+};
+
+#define PAGE_SHIFT		12
+#define PAGE_SIZE		(1UL << PAGE_SHIFT)
+#define PAGE_MASK		(~(PAGE_SIZE-1))
+#define NBPG			PAGE_SIZE
+#define UPAGES			1
+#define HOST_TEXT_START_ADDR	(u.start_code)
+#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
 
 #endif	/* _SYS_USER_H */
diff --git a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
new file mode 100644
index 0000000000..525b54300c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
@@ -0,0 +1,23 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_UNBLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+SC_FLGS		ucontext (uc_flags)
+SC_LINK		ucontext (uc_link)
+SC_STCK		ucontext (uc_stack.ss_sp)
+SC_STSZ		ucontext (uc_stack.ss_size)
+SC_PSW		mcontext (psw)
+SC_GPRS		mcontext (gregs)
+SC_ACRS		mcontext (aregs)
+SC_FPC		mcontext (fpregs.fpc)
+SC_FPRS		mcontext (fpregs.fprs)
+SC_MASK		ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c
index 50443c6482..ab171123b0 100644
--- a/sysdeps/unix/sysv/linux/sched_getaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006 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
@@ -20,6 +20,7 @@
 #include <sched.h>
 #include <string.h>
 #include <sysdep.h>
+#include <sys/param.h>
 #include <sys/types.h>
 #include <shlib-compat.h>
 
@@ -28,8 +29,8 @@
 int
 __sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
 {
-  int res = INLINE_SYSCALL (sched_getaffinity, 3, pid, sizeof (cpu_set_t),
-			    cpuset);
+  int res = INLINE_SYSCALL (sched_getaffinity, 3, pid,
+			    MIN (INT_MAX, cpusetsize), cpuset);
   if (res != -1)
     {
       /* Clean the rest of the memory the kernel didn't do.  */
@@ -54,5 +55,5 @@ __sched_getaffinity_old (pid_t pid, cpu_set_t *cpuset)
 compat_symbol (libc, __sched_getaffinity_old, sched_getaffinity, GLIBC_2_3_3);
 # endif
 #else
-# include <sysdeps/generic/sched_getaffinity.c>
+# include <posix/sched_getaffinity.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sched_setaffinity.c b/sysdeps/unix/sysv/linux/sched_setaffinity.c
index 5b1b8ee878..ccd3c8f514 100644
--- a/sysdeps/unix/sysv/linux/sched_setaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_setaffinity.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005 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
@@ -84,5 +84,5 @@ __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
 compat_symbol (libc, __sched_setaffinity_old, sched_setaffinity, GLIBC_2_3_3);
 # endif
 #else
-# include <sysdeps/generic/sched_setaffinity.c>
+# include <posix/sched_setaffinity.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/segfault.c b/sysdeps/unix/sysv/linux/segfault.c
index 088c329b7f..a417df9c41 100644
--- a/sysdeps/unix/sysv/linux/segfault.c
+++ b/sysdeps/unix/sysv/linux/segfault.c
@@ -1,2 +1,2 @@
 #define HAVE_PROC_SELF	1
-#include <sysdeps/generic/segfault.c>
+#include <debug/segfault.c>
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index ecd23ce53e..2f5471f8f8 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -28,7 +28,7 @@
 #include <sys/syscall.h>
 #include <shlib-compat.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_semid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/setegid.c b/sysdeps/unix/sysv/linux/setegid.c
index f87af0d16f..c0400aa121 100644
--- a/sysdeps/unix/sysv/linux/setegid.c
+++ b/sysdeps/unix/sysv/linux/setegid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2002,2003,2004,2006 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
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresgid || __ASSUME_SETRESGID_SYSCALL > 0
diff --git a/sysdeps/unix/sysv/linux/seteuid.c b/sysdeps/unix/sysv/linux/seteuid.c
index 5e5d1e184f..4a1a29eaa5 100644
--- a/sysdeps/unix/sysv/linux/seteuid.c
+++ b/sysdeps/unix/sysv/linux/seteuid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1998,1999,2002,2003,2004,2006 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
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <setxid.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if defined __NR_setresuid || __ASSUME_SETRESUID_SYSCALL > 0
diff --git a/sysdeps/unix/sysv/linux/setsourcefilter.c b/sysdeps/unix/sysv/linux/setsourcefilter.c
index f5c4d9786f..dc223de844 100644
--- a/sysdeps/unix/sysv/linux/setsourcefilter.c
+++ b/sysdeps/unix/sysv/linux/setsourcefilter.c
@@ -1,5 +1,5 @@
 /* Set source filter.  Linux version.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -57,14 +57,15 @@ setsourcefilter (int s, uint32_t interface, const struct sockaddr *group,
   memcpy (gf->gf_slist, slist, numsrc * sizeof (struct sockaddr_storage));
 
   /* We need to provide the appropriate socket level value.  */
+  int result;
   int sol = __get_sol (group->sa_family, grouplen);
   if (sol == -1)
     {
       __set_errno (EINVAL);
-      return -1;
+      result = -1;
     }
-
-  int result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
+  else
+    result = __setsockopt (s, sol, MCAST_MSFILTER, gf, needed);
 
   if (! use_alloca)
     {
diff --git a/sysdeps/unix/sysv/linux/sh/Dist b/sysdeps/unix/sysv/linux/sh/Dist
deleted file mode 100644
index 8a1cdff7c5..0000000000
--- a/sysdeps/unix/sysv/linux/sh/Dist
+++ /dev/null
@@ -1,8 +0,0 @@
-clone.S
-pipe.S
-setresuid.c
-setresgid.c
-setfsuid.c
-setfsgid.c
-sys/io.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/sh/Makefile b/sysdeps/unix/sysv/linux/sh/Makefile
index e8544b5dc6..6d72cb0294 100644
--- a/sysdeps/unix/sysv/linux/sh/Makefile
+++ b/sysdeps/unix/sysv/linux/sh/Makefile
@@ -5,3 +5,7 @@ endif
 ifeq ($(subdir),misc)
 sysdep_headers += sys/io.h
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
index c883002641..6de33302ee 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -22,8 +22,11 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -43,18 +46,18 @@
 #define O_ASYNC		 020000
 
 #ifdef __USE_GNU
-# define O_DIRECT	 040000	/* Direct disk access.  */
-# define O_DIRECTORY	0200000	/* Must be a directory.  */
-# define O_NOFOLLOW	0400000	/* Do not follow links.  */
+# define O_DIRECT	 040000	/* Direct disk access.	*/
+# define O_DIRECTORY	0200000	/* Must be a directory.	 */
+# define O_NOFOLLOW	0400000	/* Do not follow links.	 */
 # define O_NOATIME     01000000 /* Do not set atime.  */
 #endif
 
 /* For now Linux has synchronisity options for data and read operations.
    We define the symbols here but let them do the same as O_SYNC since
-   this is a superset.  */
+   this is a superset.	*/
 #if defined __USE_POSIX199309 || defined __USE_UNIX98
 # define O_DSYNC	O_SYNC	/* Synchronize data.  */
-# define O_RSYNC	O_SYNC	/* Synchronize read operations.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
 #endif
 
 #ifdef __USE_LARGEFILE64
@@ -70,15 +73,15 @@
 #ifndef __USE_FILE_OFFSET64
 # define F_GETLK	5	/* Get record locking info.  */
 # define F_SETLK	6	/* Set record locking info (non-blocking).  */
-# define F_SETLKW	7	/* Set record locking info (blocking).  */
+# define F_SETLKW	7	/* Set record locking info (blocking).	*/
 #else
-# define F_GETLK	F_GETLK64  /* Get record locking info.  */
+# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
 # define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
 # define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
 #endif
 #define F_GETLK64	12	/* Get record locking info.  */
 #define F_SETLK64	13	/* Set record locking info (non-blocking).  */
-#define F_SETLKW64	14	/* Set record locking info (blocking).  */
+#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
 
 #if defined __USE_BSD || defined __USE_UNIX98
 # define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
@@ -90,20 +93,26 @@
 # define F_GETSIG	11	/* Get number of signal to be sent.  */
 #endif
 
-/* For F_[GET|SET]FL.  */
+#ifdef __USE_GNU
+# define F_SETLEASE	1024	/* Set a lease.	 */
+# define F_GETLEASE	1025	/* Enquire what lease is active.  */
+# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
+#endif
+
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
 #define F_RDLCK		0	/* Read lock.  */
-#define F_WRLCK		1	/* Write lock.  */
-#define F_UNLCK		2	/* Remove lock.  */
+#define F_WRLCK		1	/* Write lock.	*/
+#define F_UNLCK		2	/* Remove lock.	 */
 
 /* For old implementation of bsd flock().  */
 #define F_EXLCK		4	/* or 3 */
 #define F_SHLCK		8	/* or 4 */
 
 #ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation.  */
+/* Operations for bsd flock(), also used by the kernel implementation.	*/
 # define LOCK_SH	1	/* shared lock */
 # define LOCK_EX	2	/* exclusive lock */
 # define LOCK_NB	4	/* or'd with one of the above to prevent
@@ -111,9 +120,27 @@
 # define LOCK_UN	8	/* remove lock */
 #endif
 
+#ifdef __USE_GNU
+# define LOCK_MAND	32	/* This is a mandatory flock:	*/
+# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
+# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
+# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY.  */
+# define DN_ACCESS	0x00000001	/* File accessed.  */
+# define DN_MODIFY	0x00000002	/* File modified.  */
+# define DN_CREATE	0x00000004	/* File created.  */
+# define DN_DELETE	0x00000008	/* File removed.  */
+# define DN_RENAME	0x00000010	/* File renamed.  */
+# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
+# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
+#endif
+
 struct flock
   {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
 #ifndef __USE_FILE_OFFSET64
     __off_t l_start;	/* Offset where the lock begins.  */
@@ -128,7 +155,7 @@ struct flock
 #ifdef __USE_LARGEFILE64
 struct flock64
   {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
     short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
     __off64_t l_start;	/* Offset where the lock begins.  */
     __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
@@ -150,16 +177,61 @@ struct flock64
 #ifdef __USE_XOPEN2K
 # define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
 # define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
-# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.  */
+# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
 # define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
 # define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/sh/bits/mman.h b/sysdeps/unix/sysv/linux/sh/bits/mman.h
index 673c7295fb..7a6b572a4e 100644
--- a/sysdeps/unix/sysv/linux/sh/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sh/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/SH version.
-   Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2000,2003,2005,2006 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
@@ -61,6 +61,8 @@
 # define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
 # define MAP_LOCKED	0x2000		/* Lock the mapping.  */
 # define MAP_NORESERVE	0x4000		/* Don't check for reservations.  */
+# define MAP_POPULATE	0x8000		/* Populate (prefault) pagetables.  */
+# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
 #endif
 
 /* Flags to `msync'.  */
@@ -76,6 +78,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -85,6 +88,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/sh/chown.c b/sysdeps/unix/sysv/linux/sh/chown.c
index 1961622564..e7193dc23b 100644
--- a/sysdeps/unix/sysv/linux/sh/chown.c
+++ b/sysdeps/unix/sysv/linux/sh/chown.c
@@ -1 +1,69 @@
-#include <sysdeps/unix/sysv/linux/m68k/chown.c>
+/* Copyright (C) 1998,2000,2002,2003,2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <linux/posix_types.h>
+#include <kernel-features.h>
+
+#ifdef __NR_chown32
+# if __ASSUME_32BITUIDS == 0
+/* This variable is shared with all files that need to check for 32bit
+   uids.  */
+extern int __libc_missing_32bit_uids;
+# endif
+#endif /* __NR_chown32 */
+
+int
+__chown (const char *file, uid_t owner, gid_t group)
+{
+#if __ASSUME_32BITUIDS > 0
+  return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
+#else
+# ifdef __NR_chown32
+  if (__libc_missing_32bit_uids <= 0)
+    {
+      int result;
+      int saved_errno = errno;
+
+      result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
+      if (result == 0 || errno != ENOSYS)
+	return result;
+
+      __set_errno (saved_errno);
+      __libc_missing_32bit_uids = 1;
+    }
+# endif /* __NR_chown32 */
+
+  if (((owner + 1) > (gid_t) ((__kernel_uid_t) -1U))
+      || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
+#endif
+}
+libc_hidden_def (__chown)
+weak_alias (__chown, chown)
diff --git a/sysdeps/unix/sysv/linux/sh/fchownat.c b/sysdeps/unix/sysv/linux/sh/fchownat.c
new file mode 100644
index 0000000000..dfed76aeb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fchownat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchownat.c>
diff --git a/sysdeps/unix/sysv/linux/sh/fxstatat.c b/sysdeps/unix/sysv/linux/sh/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/sh/makecontext.S b/sysdeps/unix/sysv/linux/sh/makecontext.S
new file mode 100644
index 0000000000..877d78d396
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/makecontext.S
@@ -0,0 +1,145 @@
+/* Create new context.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/* void __makecontext (struct ucontext *ucp, void (*func)(), int argc, ...);
+  __makecontext sets up a stack and registers for context to run a given
+  function.  The registers are set up like this:
+    r4-r7: parameters 1 to 4
+    r8	 : uc_link from ucontext structure
+    pc	 : (*func) pointer
+    pr	 : address of exitcode
+    r15	 : stack pointer for func.  */
+
+	.text
+	.align	5
+ENTRY(__makecontext)
+	mov	#4, r3
+	mov.l	@(oSS_SP,r4), r1
+	mov.l	@(oSS_SIZE,r4), r2
+	add	r1, r2
+	cmp/gt	r6, r3
+	bf/s	1f
+	 shlr2	r2
+	sub	r6, r2
+	add	r3, r2
+1:
+	shll2	r2
+	mov	#oR15, r0
+	mov.l	@(oLINK,r4), r1
+	mov.l	r2, @(r0,r4)
+	mov.l	r1, @(oR8,r4)
+	mov	#oPC, r0
+	mov.l	r5, @(r0,r4)
+
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	r7, @(oR4,r4)
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(0,r15), r1
+	mov.l	r1, @(oR5,r4)
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(4,r15), r1
+	mov.l	r1, @(oR6,r4)
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(8,r15), r1
+	mov.l	r1, @(oR7,r4)
+	mov	#12,r0
+.L0:
+	cmp/pl	r6
+	bf/s	.L1
+	 dt	r6
+	mov.l	@(r0,r15), r1
+	mov.l	r1, @r2
+	add	#4, r0
+	bra	.L0
+	 add	#4, r2
+.L1:
+#ifdef PIC
+	mova	.Lexitcode, r0
+#else
+	mov.l	.L2, r0
+#endif
+	add	#oPR, r4
+	rts
+	 mov.l	r0, @r4
+#ifndef PIC
+	.align	2
+.L2:
+	.long	.Lexitcode
+#endif
+	cfi_endproc
+
+	.align	5
+.Lexitcode:
+	tst	r8, r8
+	bt/s	2f
+	 mov	r8, r4
+#ifdef PIC
+	mova	.Lgot, r0
+	mov.l	.Lgot, r12
+	add	r0, r12
+	mov.l	.L3, r1
+	bsrf	r1
+.LPCS0:
+	 nop
+#else
+	mov.l	.L3, r1
+	jsr	@r1
+	 nop
+#endif
+2:
+	mov.l	.L4, r1
+#ifdef PIC
+	add	r12, r1
+#endif
+	jsr	@r1
+	 mov	r0, r4
+0:
+	bra	0b
+	 nop
+
+	.align	2
+#ifdef PIC
+.Lgot:
+	.long	_GLOBAL_OFFSET_TABLE_
+.L3:
+	.long	__setcontext@PLT-(.LPCS0+2-(.))
+.L4:
+	.long	HIDDEN_JUMPTARGET(exit)@GOTOFF
+#else
+.L3:
+	.long	__setcontext
+.L4:
+	.long	HIDDEN_JUMPTARGET(exit)
+#endif
+	cfi_startproc
+PSEUDO_END(__makecontext)
+
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/sh/pread.c b/sysdeps/unix/sysv/linux/sh/pread.c
index 9ded53ebaa..0186e40c9c 100644
--- a/sysdeps/unix/sysv/linux/sh/pread.c
+++ b/sysdeps/unix/sysv/linux/sh/pread.c
@@ -1,3 +1,93 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pread.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <assert.h>
+#include <errno.h>
+#include <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pread
+#  error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
+
+# if __ASSUME_PREAD_SYSCALL == 0
+static ssize_t __emulate_pread (int fd, void *buf, size_t count,
+				off_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pread (fd, buf, count, offset)
+     int fd;
+     void *buf;
+     size_t count;
+     off_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+      /* First try the syscall.  */
+      result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			       __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PREAD_SYSCALL == 0
+      if (result == -1 && errno == ENOSYS)
+        /* No system call available.  Use the emulation.  */
+        result = __emulate_pread (fd, buf, count, offset);
+# endif
+      return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PREAD_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pread (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+strong_alias (__libc_pread, __pread)
+weak_alias (__libc_pread, pread)
+
+# define __libc_pread(fd, buf, count, offset) \
+     static internal_function __emulate_pread (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PREAD_SYSCALL == 0
+# include <sysdeps/posix/pread.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pread64.c b/sysdeps/unix/sysv/linux/sh/pread64.c
index 5b22a395ec..f23d619090 100644
--- a/sysdeps/unix/sysv/linux/sh/pread64.c
+++ b/sysdeps/unix/sysv/linux/sh/pread64.c
@@ -1,3 +1,94 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pread64.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pread64             /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pread
+#  error "__NR_pread and __NR_pread64 both defined???"
+# endif
+# define __NR_pread __NR_pread64
+#endif
+
+#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
+
+# if __ASSUME_PREAD_SYSCALL == 0
+static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
+				  off64_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pread64 (fd, buf, count, offset)
+     int fd;
+     void *buf;
+     size_t count;
+     off64_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+     /* First try the syscall.  */
+     result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
+			      (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PREAD_SYSCALL == 0
+     if (result == -1 && errno == ENOSYS)
+     /* No system call available.  Use the emulation.  */
+     result = __emulate_pread64 (fd, buf, count, offset);
+# endif
+     return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PREAD_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pread64 (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+weak_alias (__libc_pread64, __pread64)
+weak_alias (__libc_pread64, pread64)
+
+# define __libc_pread64(fd, buf, count, offset) \
+     static internal_function __emulate_pread64 (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PREAD_SYSCALL == 0
+# include <sysdeps/posix/pread64.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite.c b/sysdeps/unix/sysv/linux/sh/pwrite.c
index b75a6a968e..f0e2bc7e0f 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite.c
@@ -1,3 +1,93 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pwrite.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <assert.h>
+#include <errno.h>
+#include <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pwrite
+#  error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
+#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
+
+# if __ASSUME_PWRITE_SYSCALL == 0
+static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
+				 off_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pwrite (fd, buf, count, offset)
+     int fd;
+     const void *buf;
+     size_t count;
+     off_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+      /* First try the syscall.  */
+      result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			       __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PWRITE_SYSCALL == 0
+      if (result == -1 && errno == ENOSYS)
+        /* No system call available.  Use the emulation.  */
+        result = __emulate_pwrite (fd, buf, count, offset);
+# endif
+      return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR (offset >> 31, offset));
+# if __ASSUME_PWRITE_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pwrite (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+strong_alias (__libc_pwrite, __pwrite)
+weak_alias (__libc_pwrite, pwrite)
+
+# define __libc_pwrite(fd, buf, count, offset) \
+     static internal_function __emulate_pwrite (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PWRITE_SYSCALL == 0
+# include <sysdeps/posix/pwrite.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite64.c b/sysdeps/unix/sysv/linux/sh/pwrite64.c
index ae29280f85..eb1e507287 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite64.c
@@ -1,3 +1,96 @@
-#define NO_SGIDEFS_H
-#define _MIPS_SIM -1
-#include <sysdeps/unix/sysv/linux/mips/pwrite64.c>
+/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ralf Baechle <ralf@gnu.org>, 1998.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <endian.h>
+
+#include <sysdep-cancel.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+#include <kernel-features.h>
+
+#ifdef __NR_pwrite64            /* Newer kernels renamed but it's the same.  */
+# ifdef __NR_pwrite
+#  error "__NR_pwrite and __NR_pwrite64 both defined???"
+# endif
+# define __NR_pwrite __NR_pwrite64
+#endif
+
+#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
+
+# if __ASSUME_PWRITE_SYSCALL == 0
+static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
+				   off64_t offset) internal_function;
+# endif
+
+ssize_t
+__libc_pwrite64 (fd, buf, count, offset)
+     int fd;
+     const void *buf;
+     size_t count;
+     off64_t offset;
+{
+  ssize_t result;
+
+  if (SINGLE_THREAD_P)
+    {
+     /* First try the syscall.  */
+     result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
+			     (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PWRITE_SYSCALL == 0
+     if (result == -1 && errno == ENOSYS)
+     /* No system call available.  Use the emulation.  */
+     result = __emulate_pwrite64 (fd, buf, count, offset);
+# endif
+
+     return result;
+    }
+
+  int oldtype = LIBC_CANCEL_ASYNC ();
+
+  /* First try the syscall.  */
+  result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
+			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					     (off_t) (offset & 0xffffffff)));
+# if __ASSUME_PWRITE_SYSCALL == 0
+  if (result == -1 && errno == ENOSYS)
+    /* No system call available.  Use the emulation.  */
+    result = __emulate_pwrite64 (fd, buf, count, offset);
+# endif
+
+  LIBC_CANCEL_RESET (oldtype);
+
+  return result;
+}
+
+weak_alias (__libc_pwrite64, __pwrite64)
+libc_hidden_weak (__pwrite64)
+weak_alias (__libc_pwrite64, pwrite64)
+
+# define __libc_pwrite64(fd, buf, count, offset) \
+     static internal_function __emulate_pwrite64 (fd, buf, count, offset)
+#endif
+
+#if __ASSUME_PWRITE_SYSCALL == 0
+# include <sysdeps/posix/pwrite64.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S b/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S
new file mode 100644
index 0000000000..66b3daaa3b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/getcontext.S
@@ -0,0 +1,88 @@
+/* Save current context.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __getcontext (ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__getcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	/* sigprocmask (SIG_BLOCK, NULL, &uc->uc_sigmask).  */
+	mov	r4, r6
+	add	#oSIGMASK, r6
+	mov	#SIG_BLOCK, r4
+	mov	#0, r5
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lgetcontext_end
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lgetcontext_end:
+	/* All done, return 0 for success.  */
+	mov	#0, r0
+.Lpseudo_end:
+	rts
+	 nop
+
+PSEUDO_END(__getcontext)
+
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S b/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S
new file mode 100644
index 0000000000..3136267aca
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/setcontext.S
@@ -0,0 +1,99 @@
+/* Install given context.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __setcontext (const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__setcontext)
+
+	mov	r4, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, NULL).  */
+	mov	r4, r5
+	add	#oSIGMASK, r5
+	mov	#SIG_SETMASK, r4
+	mov	#0, r6
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lsetcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+
+.Lsetcontext_restore:
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+
+PSEUDO_END(__setcontext)
+
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S b/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S
new file mode 100644
index 0000000000..64035e5545
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/swapcontext.S
@@ -0,0 +1,132 @@
+/* Save current context and install the given one.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __swapcontext (ucontext_t *ouc, const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__swapcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	mov	r5, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, &ouc->uc_sigmask).  */
+	add	#oSIGMASK, r5
+	mov	r4, r6
+	add	#oSIGMASK, r6
+	mov	#SIG_SETMASK, r4
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lswapcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+.Lswapcontext_restore:	
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+	
+PSEUDO_END(__swapcontext)
+
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sh3/sys/ucontext.h
new file mode 100644
index 0000000000..946df0dfd6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/sys/ucontext.h
@@ -0,0 +1,102 @@
+/* Copyright (C) 1999, 2000, 2001, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Where is System V/SH ABI?  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+/* We need the signal context definitions even if they are not used
+   included in <signal.h>.  */
+#include <bits/sigcontext.h>
+
+
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NFPREG	16
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NFPREG];
+
+#ifdef __USE_GNU
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  R0 = 0,
+#define R0	R0
+  R1 = 1,
+#define R1	R1
+  R2 = 2,
+#define R2	R2
+  R3 = 3,
+#define R3	R3
+  R4 = 4,
+#define R4	R4
+  R5 = 5,
+#define R5	R5
+  R6 = 6,
+#define R6	R6
+  R7 = 7,
+#define R7	R7
+  R8 = 8,
+#define R8	R8
+  R9 = 9,
+#define R9	R9
+  R10 = 10,
+#define R10	R10
+  R11 = 11,
+#define R11	R11
+  R12 = 12,
+#define R12	R12
+  R13 = 13,
+#define R13	R13
+  R14 = 14,
+#define R14	R14
+  R15 = 15,
+#define R15	R15
+};
+#endif
+
+/* Context to describe whole processor state.  */
+typedef struct
+  {
+    unsigned int oldmask;
+    gregset_t gregs;
+    unsigned int pc;
+    unsigned int pr;
+    unsigned int sr;
+    unsigned int gbr;
+    unsigned int mach;
+    unsigned int macl;
+  } mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_link;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    __sigset_t uc_sigmask;
+  } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
new file mode 100644
index 0000000000..17397c5511
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
@@ -0,0 +1,38 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oR0		mcontext (gregs[R0])
+oR1		mcontext (gregs[R1])
+oR2		mcontext (gregs[R2])
+oR3		mcontext (gregs[R3])
+oR4		mcontext (gregs[R4])
+oR5		mcontext (gregs[R5])
+oR6		mcontext (gregs[R6])
+oR7		mcontext (gregs[R7])
+oR8		mcontext (gregs[R8])
+oR9		mcontext (gregs[R9])
+oR10		mcontext (gregs[R10])
+oR11		mcontext (gregs[R11])
+oR12		mcontext (gregs[R12])
+oR13		mcontext (gregs[R13])
+oR14		mcontext (gregs[R14])
+oR15		mcontext (gregs[R15])
+oPC		mcontext (pc)
+oPR		mcontext (pr)
+oSR		mcontext (sr)
+oGBR		mcontext (gbr)
+oMACH		mcontext (mach)
+oMACL		mcontext (macl)
+oSIGMASK	ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S b/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
new file mode 100644
index 0000000000..68bc235bcf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/getcontext.S
@@ -0,0 +1,131 @@
+/* Save current context.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __getcontext (ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__getcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	mov	r4, r0
+	/* We need 2 add instruction because oFPUL+4 > 127.  */
+	add	#124,r0
+	add	#(oFPUL+4-124),r0
+	sts.l	fpul, @-r0
+	sts.l	fpscr, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+
+	/* sigprocmask (SIG_BLOCK, NULL, &uc->uc_sigmask).  */
+	mov	r4, r6
+	/* We need 2 add instruction because oSIGMASK > 127.  */
+	add	#(oSIGMASK/2), r6
+	add	#(oSIGMASK/2), r6
+	mov	#SIG_BLOCK, r4
+	mov	#0, r5
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lgetcontext_end
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lgetcontext_end:
+	/* All done, return 0 for success.  */
+	mov	#0, r0
+.Lpseudo_end:
+	rts
+	 nop
+
+PSEUDO_END(__getcontext)
+
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S b/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
new file mode 100644
index 0000000000..2bc546d1a1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/setcontext.S
@@ -0,0 +1,139 @@
+/* Install given context.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __setcontext (const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__setcontext)
+
+	mov	r4, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, NULL).  */
+	mov	r4, r5
+	add	#(oSIGMASK/2), r5
+	add	#(oSIGMASK/2), r5
+	mov	#SIG_SETMASK, r4
+	mov	#0, r6
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lsetcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+
+.Lsetcontext_restore:
+	mov	r8, r0
+	add	#(oFR0),r0
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	lds.l	@r0+, fpscr
+	lds.l	@r0+, fpul
+
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+
+PSEUDO_END(__setcontext)
+
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S b/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
new file mode 100644
index 0000000000..1aeca1b1a7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/swapcontext.S
@@ -0,0 +1,214 @@
+/* Save current context and install the given one.
+   Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+#include "ucontext_i.h"
+
+/*  int __swapcontext (ucontext_t *ouc, const ucontext_t *uc);  */
+
+	.text
+	.align  5
+ENTRY(__swapcontext)
+
+	/* Return value of getcontext.  R0 is the only register whose
+	   value is not preserved.  */
+	mov	#0, r0
+	mov.l	r0, @(oR0,r4)
+	mov.l	r1, @(oR1,r4)
+	mov.l	r2, @(oR2,r4)
+	mov.l	r3, @(oR3,r4)
+	mov.l	r4, @(oR4,r4)
+	mov.l	r5, @(oR5,r4)
+	mov.l	r6, @(oR6,r4)
+	mov.l	r7, @(oR7,r4)
+	mov	r4, r0
+	add	#(oMACL+4), r0
+	sts.l	macl, @-r0
+	sts.l	mach, @-r0
+	stc.l	gbr, @-r0
+
+	/* Save T flag to SR.  */
+	movt	r1
+	mov.l	r1, @-r0
+	sts.l	pr, @-r0
+
+	/* The return address of getcontext is the restart pc.  */
+	sts.l	pr, @-r0
+
+	mov.l	r15, @-r0
+	mov.l	r14, @-r0
+	mov.l	r13, @-r0
+	mov.l	r12, @-r0
+	mov.l	r11, @-r0
+	mov.l	r10, @-r0
+	mov.l	r9, @-r0
+	mov.l	r8, @-r0
+
+	mov	r4, r0
+	/* We need 2 add instruction because oFPUL+4 >= 127.  */
+	add	#124,r0
+	add	#(oFPUL+4-124),r0
+	sts.l	fpul, @-r0
+	sts.l	fpscr, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+	frchg
+	fmov.s	fr15, @-r0
+	fmov.s	fr14, @-r0
+	fmov.s	fr13, @-r0
+	fmov.s	fr12, @-r0
+	fmov.s	fr11, @-r0
+	fmov.s	fr10, @-r0
+	fmov.s	fr9, @-r0
+	fmov.s	fr8, @-r0
+	fmov.s	fr7, @-r0
+	fmov.s	fr6, @-r0
+	fmov.s	fr5, @-r0
+	fmov.s	fr4, @-r0
+	fmov.s	fr3, @-r0
+	fmov.s	fr2, @-r0
+	fmov.s	fr1, @-r0
+	fmov.s	fr0, @-r0
+
+	mov	r5, r8
+
+	/* sigprocmask (SIG_SETMASK, &uc->uc_sigmask, &ouc->uc_sigmask).  */
+	mov	#oSIGMASK, r1
+	extu.b	r1, r1
+	add	r1, r5
+	mov	r4, r6
+	add	r1, r6
+	mov	#SIG_SETMASK, r4
+	mov	#+SYS_ify(sigprocmask), r3
+	trapa	#0x13
+	mov     r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1			// r1=0 means r0 = -1 to -4095
+	tst	r1, r1			// i.e. error in linux
+	bf	.Lswapcontext_restore
+.Lsyscall_error:	
+	SYSCALL_ERROR_HANDLER
+.Lpseudo_end:
+	rts
+	 nop
+.Lswapcontext_restore:	
+	mov	r8, r0
+	add	#(oFR0),r0
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	fmov.s	@r0+, fr0
+	fmov.s	@r0+, fr1
+	fmov.s	@r0+, fr2
+	fmov.s	@r0+, fr3
+	fmov.s	@r0+, fr4
+	fmov.s	@r0+, fr5
+	fmov.s	@r0+, fr6
+	fmov.s	@r0+, fr7
+	fmov.s	@r0+, fr8
+	fmov.s	@r0+, fr9
+	fmov.s	@r0+, fr10
+	fmov.s	@r0+, fr11
+	fmov.s	@r0+, fr12
+	fmov.s	@r0+, fr13
+	fmov.s	@r0+, fr14
+	fmov.s	@r0+, fr15
+	frchg
+	lds.l	@r0+, fpscr
+	lds.l	@r0+, fpul
+
+	mov	r8, r0
+	add	#(oPC), r0
+	mov.l	@r0+, r2
+	lds.l	@r0+, pr
+
+	/* Restore T frag.  */
+	mov.l	@r0+, r1
+	shlr	r1
+	/* Skip GBR which is used for thread pointer.  */
+	add	#4, r0
+
+	lds.l	@r0+, mach
+	lds.l	@r0+, macl
+
+	mov	r8, r0
+	add	#(oR9), r0
+	mov.l	@r0+, r9
+	mov.l	@r0+, r10
+	mov.l	@r0+, r11
+	mov.l	@r0+, r12
+	mov.l	@r0+, r13
+	mov.l	@r0+, r14
+	mov.l	@r0+, r15
+
+	mov	r8, r0
+	mov.l	@(oR0,r0), r1
+	mov.l	r1, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r1, 0)
+	mov.l	r2, @-r15
+	cfi_adjust_cfa_offset(4)
+	cfi_rel_offset (r2, 0)
+
+	mov.l	@(oR1,r0), r1
+	mov.l	@(oR2,r0), r2
+	mov.l	@(oR3,r0), r3
+	mov.l	@(oR4,r0), r4
+	mov.l	@(oR5,r0), r5
+	mov.l	@(oR6,r0), r6
+	mov.l	@(oR7,r0), r7
+	mov.l	@(oR8,r0), r8
+	mov.l	@r15+, r0
+	jmp	@r0
+	 mov.l	@r15+, r0
+	
+PSEUDO_END(__swapcontext)
+
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sh4/sys/ucontext.h
new file mode 100644
index 0000000000..cd831a7a21
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/sys/ucontext.h
@@ -0,0 +1,115 @@
+/* Copyright (C) 1999, 2000, 2001, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Where is System V/SH ABI?  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+/* We need the signal context definitions even if they are not used
+   included in <signal.h>.  */
+#include <bits/sigcontext.h>
+
+
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NFPREG	16
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NFPREG];
+
+#ifdef __USE_GNU
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  R0 = 0,
+#define R0	R0
+  R1 = 1,
+#define R1	R1
+  R2 = 2,
+#define R2	R2
+  R3 = 3,
+#define R3	R3
+  R4 = 4,
+#define R4	R4
+  R5 = 5,
+#define R5	R5
+  R6 = 6,
+#define R6	R6
+  R7 = 7,
+#define R7	R7
+  R8 = 8,
+#define R8	R8
+  R9 = 9,
+#define R9	R9
+  R10 = 10,
+#define R10	R10
+  R11 = 11,
+#define R11	R11
+  R12 = 12,
+#define R12	R12
+  R13 = 13,
+#define R13	R13
+  R14 = 14,
+#define R14	R14
+  R15 = 15,
+#define R15	R15
+};
+#endif
+
+typedef int freg_t;
+
+/* Number of FPU registers.  */
+#define NFPREG	16
+
+/* Structure to describe FPU registers.  */
+typedef freg_t fpregset_t[NFPREG];
+
+/* Context to describe whole processor state.  */
+typedef struct
+  {
+    unsigned int oldmask;
+    gregset_t gregs;
+    unsigned int pc;
+    unsigned int pr;
+    unsigned int sr;
+    unsigned int gbr;
+    unsigned int mach;
+    unsigned int macl;
+    fpregset_t fpregs;
+    fpregset_t xfpregs;
+    unsigned int fpscr;
+    unsigned int fpul;
+    unsigned int ownedfp;
+  } mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_link;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    __sigset_t uc_sigmask;
+  } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
new file mode 100644
index 0000000000..65633fbcf4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
@@ -0,0 +1,73 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oR0		mcontext (gregs[R0])
+oR1		mcontext (gregs[R1])
+oR2		mcontext (gregs[R2])
+oR3		mcontext (gregs[R3])
+oR4		mcontext (gregs[R4])
+oR5		mcontext (gregs[R5])
+oR6		mcontext (gregs[R6])
+oR7		mcontext (gregs[R7])
+oR8		mcontext (gregs[R8])
+oR9		mcontext (gregs[R9])
+oR10		mcontext (gregs[R10])
+oR11		mcontext (gregs[R11])
+oR12		mcontext (gregs[R12])
+oR13		mcontext (gregs[R13])
+oR14		mcontext (gregs[R14])
+oR15		mcontext (gregs[R15])
+oPC		mcontext (pc)
+oPR		mcontext (pr)
+oSR		mcontext (sr)
+oGBR		mcontext (gbr)
+oMACH		mcontext (mach)
+oMACL		mcontext (macl)
+oFR0		mcontext (fpregs[0])
+oFR1		mcontext (fpregs[1])
+oFR2		mcontext (fpregs[2])
+oFR3		mcontext (fpregs[3])
+oFR4		mcontext (fpregs[4])
+oFR5		mcontext (fpregs[5])
+oFR6		mcontext (fpregs[6])
+oFR7		mcontext (fpregs[7])
+oFR8		mcontext (fpregs[8])
+oFR9		mcontext (fpregs[9])
+oFR10		mcontext (fpregs[10])
+oFR11		mcontext (fpregs[11])
+oFR12		mcontext (fpregs[12])
+oFR13		mcontext (fpregs[13])
+oFR14		mcontext (fpregs[14])
+oFR15		mcontext (fpregs[15])
+oXFR0		mcontext (xfpregs[0])
+oXFR1		mcontext (xfpregs[1])
+oXFR2		mcontext (xfpregs[2])
+oXFR3		mcontext (xfpregs[3])
+oXFR4		mcontext (xfpregs[4])
+oXFR5		mcontext (xfpregs[5])
+oXFR6		mcontext (xfpregs[6])
+oXFR7		mcontext (xfpregs[7])
+oXFR8		mcontext (xfpregs[8])
+oXFR9		mcontext (xfpregs[9])
+oXFR10		mcontext (xfpregs[10])
+oXFR11		mcontext (xfpregs[11])
+oXFR12		mcontext (xfpregs[12])
+oXFR13		mcontext (xfpregs[13])
+oXFR14		mcontext (xfpregs[14])
+oXFR15		mcontext (xfpregs[15])
+oFPSCR		mcontext (fpscr)
+oFPUL		mcontext (fpul)
+oOWNEDFP	mcontext (ownedfp)
+oSIGMASK	ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sh/socket.S b/sysdeps/unix/sysv/linux/sh/socket.S
index f1369eb49b..c83b0f2601 100644
--- a/sysdeps/unix/sysv/linux/sh/socket.S
+++ b/sysdeps/unix/sysv/linux/sh/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2003, 2004, 2005 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
@@ -33,7 +33,11 @@
    The .S files for the other calls just #define socket and #include this.  */
 
 #ifndef __socket
+#ifndef NO_WEAK_ALIAS
 #define __socket P(__,socket)
+#else
+#define __socket socket
+#endif
 #endif
 
 #define PUSHARGS_1	mov.l r4,@-r15;	\
@@ -84,7 +88,6 @@
 #endif
 
 .globl __socket
-	cfi_startproc
 ENTRY (__socket)
 	/* This will not work in the case of a socket call being interrupted
 	   by a signal.  If the signal handler uses any stack the arguments
@@ -165,7 +168,6 @@ ENTRY (__socket)
 	bra	.Lsyscall_error
 	 nop
 #endif
-	cfi_endproc
 
 	.align 2
 .L1:
@@ -173,4 +175,6 @@ ENTRY (__socket)
 
 PSEUDO_END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
deleted file mode 100644
index 78729c48f9..0000000000
--- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright (C) 1999, 2000, 2001 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Where is System V/SH ABI?  */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H	1
-
-#include <features.h>
-#include <signal.h>
-
-/* We need the signal context definitions even if they are not used
-   included in <signal.h>.  */
-#include <bits/sigcontext.h>
-
-
-typedef int greg_t;
-
-/* Number of general registers.  */
-#define NFPREG	16
-
-/* Container for all general registers.  */
-typedef greg_t gregset_t[NFPREG];
-
-#ifdef __USE_GNU
-/* Number of each register is the `gregset_t' array.  */
-enum
-{
-  R0 = 0,
-#define R0	R0
-  R1 = 1,
-#define R1	R1
-  R2 = 2,
-#define R2	R2
-  R3 = 3,
-#define R3	R3
-  R4 = 4,
-#define R4	R4
-  R5 = 5,
-#define R5	R5
-  R6 = 6,
-#define R6	R6
-  R7 = 7,
-#define R7	R7
-  R8 = 8,
-#define R8	R8
-  R9 = 9,
-#define R9	R9
-  R10 = 10,
-#define R10	R10
-  R11 = 11,
-#define R11	R11
-  R12 = 12,
-#define R12	R12
-  R13 = 13,
-#define R13	R13
-  R14 = 14,
-#define R14	R14
-  R15 = 15,
-#define R15	R15
-};
-#endif
-
-typedef int freg_t;
-
-/* Number of FPU registers.  */
-#define NFPREG	16
-
-/* Structure to describe FPU registers.  */
-typedef freg_t fpregset_t[NFPREG];
-
-/* Context to describe whole processor state.  */
-typedef struct
-  {
-    gregset_t gregs;
-    fpregset_t fpregs;
-    fpregset_t xfpregs;
-    unsigned int fpscr;
-    unsigned int fpul;
-    unsigned int macl;
-    unsigned int mach;
-  } mcontext_t;
-
-/* Userlevel context.  */
-typedef struct ucontext
-  {
-    unsigned long int uc_flags;
-    struct ucontext *uc_link;
-    stack_t uc_stack;
-    mcontext_t uc_mcontext;
-    __sigset_t uc_sigmask;
-  } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
index 33fdc748b5..176d99aab7 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.S
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2005
+   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
@@ -27,6 +28,7 @@
 
 ENTRY (__syscall_error)
 	neg r4, r0
+	cfi_endproc
 
 #define __syscall_error __syscall_error_1
 #include <sysdeps/unix/sh/sysdep.S>
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h
index d56ec454f9..f0be37edc8 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004
-	Free Software Foundation, Inc.
+/* Copyright (C) 1992,1993,1995,1996,1997,1998,1999,2000,2002,2003,2004,
+   2005,2006	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
    Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -24,6 +24,7 @@
 
 /* There is some commonality.  */
 #include <sysdeps/unix/sh/sysdep.h>
+#include <tls.h>
 
 /* For Linux we can use the system call table in the header file
 	/usr/include/asm/unistd.h
@@ -104,7 +105,7 @@
 	mova 0f,r0; \
 	add r0,r12; \
 	mov.l 1f,r0; \
-	mov.l r1,@(r0,r12)
+	mov.l r1,@(r0,r12); \
 	bra .Lpseudo_end; \
 	 mov _IMM1,r0; \
 	.align 2; \
@@ -140,13 +141,22 @@
 #   define SYSCALL_ERROR_HANDLER \
 	neg r0,r1; \
 	mov.l r14,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (r14, 0); \
 	mov.l r12,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (r12, 0); \
 	mov.l r1,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (r1, 0); \
 	mov.l 0f,r12; \
 	mova 0f,r0; \
 	add r0,r12; \
 	sts.l pr,@-r15; \
+	cfi_adjust_cfa_offset (4); \
+	cfi_rel_offset (pr, 0); \
 	mov r15,r14; \
+	cfi_def_cfa_register (r14); \
 	mov.l 1f,r1; \
 	bsrf r1; \
          nop; \
@@ -359,4 +369,23 @@
 
 #endif	/* __ASSEMBLER__ */
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  Using a global variable
+   is too complicated here since we have no PC-relative addressing mode.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg, tmp) \
+     stc gbr,tmp; mov.l @(POINTER_GUARD,tmp),tmp; xor tmp,reg
+#  define PTR_MANGLE2(reg, tmp)	xor tmp,reg
+#  define PTR_DEMANGLE(reg, tmp)	PTR_MANGLE (reg, tmp)
+#  define PTR_DEMANGLE2(reg, tmp)	PTR_MANGLE2 (reg, tmp)
+# else
+#  define PTR_MANGLE(var) \
+     (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/sh/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c
index 2e94b76cdb..0d40632e5f 100644
--- a/sysdeps/unix/sysv/linux/shm_open.c
+++ b/sysdeps/unix/sysv/linux/shm_open.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000,2001,2002,2003,2004,2006 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
@@ -29,6 +29,8 @@
 #include <bits/libc-lock.h>
 #include "linux_fsinfo.h"
 
+#include <kernel-features.h>
+
 
 /* Mount point of the shared memory filesystem.  */
 static struct
@@ -81,7 +83,10 @@ where_is_shmfs (void)
     /* The original name is "shm" but this got changed in early Linux
        2.4.x to "tmpfs".  */
     if (strcmp (mp->mnt_type, "tmpfs") == 0
-	|| strcmp (mp->mnt_type, "shm") == 0)
+#ifndef __ASSUME_TMPFS_NAME
+	|| strcmp (mp->mnt_type, "shm") == 0
+#endif
+	)
       {
 	/* Found it.  There might be more than one place where the
            filesystem is mounted but one is enough for us.  */
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index 5561cca36f..0fbddd9206 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1995, 1997, 1998, 2000, 2003, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006
+	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -29,7 +29,7 @@
 #include <shlib-compat.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 struct __old_shmid_ds
 {
diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c
index 91c37824bc..7b44598c09 100644
--- a/sysdeps/unix/sysv/linux/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sigaction.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2002,2003,2005,2006 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
@@ -23,7 +23,7 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 /* The difference here is that the sigaction structure used in the
    kernel is not the same as we use in the libc.  Therefore we must
@@ -129,6 +129,10 @@ __libc_sigaction (sig, act, oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c
index c19da4c764..f0036c1139 100644
--- a/sysdeps/unix/sysv/linux/sigpending.c
+++ b/sysdeps/unix/sysv/linux/sigpending.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2003,2006
+	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
@@ -24,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* The variable is shared between all wrappers around signal handling
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index 1573780d8e..1b13ea74de 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2001,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2001,2003,2004,2006 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
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* The variable is shared between all wrappers around signal handling
diff --git a/sysdeps/unix/sysv/linux/sigqueue.c b/sysdeps/unix/sysv/linux/sigqueue.c
index 337f886257..22a8036b64 100644
--- a/sysdeps/unix/sysv/linux/sigqueue.c
+++ b/sysdeps/unix/sysv/linux/sigqueue.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2003, 2005 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
@@ -48,5 +48,5 @@ __sigqueue (pid, sig, val)
 }
 weak_alias (__sigqueue, sigqueue)
 #else
-# include <sysdeps/generic/sigqueue.c>
+# include <signal/sigqueue.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sigreturn.c b/sysdeps/unix/sysv/linux/sigreturn.c
index 6b3116fef2..626b1eb8af 100644
--- a/sysdeps/unix/sysv/linux/sigreturn.c
+++ b/sysdeps/unix/sysv/linux/sigreturn.c
@@ -1,3 +1,3 @@
 /* The sigreturn syscall cannot be explicitly called on Linux, only
    implicitly by returning from a signal handler.  */
-#include <sysdeps/generic/sigreturn.c>
+#include <signal/sigreturn.c>
diff --git a/sysdeps/unix/sysv/linux/sigstack.c b/sysdeps/unix/sysv/linux/sigstack.c
index 4faf4424fe..76d2126986 100644
--- a/sysdeps/unix/sysv/linux/sigstack.c
+++ b/sysdeps/unix/sysv/linux/sigstack.c
@@ -1,5 +1,5 @@
 /* Emulate sigstack function using sigaltstack.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -65,5 +65,5 @@ sigstack (ss, oss)
 
 link_warning (sigstack, "the `sigstack' function is dangerous.  `sigaltstack' should be used instead.")
 #else
-# include <sysdeps/generic/sigstack.c>
+# include <signal/sigstack.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index 0cf8d5083c..adbdfddfdb 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003
-   Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2000,2002,2003,2006
+	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
@@ -25,7 +25,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 #if !__ASSUME_REALTIME_SIGNALS
@@ -56,6 +56,12 @@ do_sigsuspend (const sigset_t *set)
 
   return INLINE_SYSCALL (sigsuspend, 3, 0, 0, set->__val[0]);
 }
+#else
+static inline int __attribute__ ((always_inline))
+do_sigsuspend (const sigset_t *set)
+{
+  return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
+}
 #endif
 
 /* Change the set of blocked signals to SET,
@@ -64,19 +70,6 @@ int
 __sigsuspend (set)
      const sigset_t *set;
 {
-#if __ASSUME_REALTIME_SIGNALS
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set),
-			       _NSIG / 8);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-#else
   if (SINGLE_THREAD_P)
     return do_sigsuspend (set);
 
@@ -87,8 +80,16 @@ __sigsuspend (set)
   LIBC_CANCEL_RESET (oldtype);
 
   return result;
-#endif
 }
 libc_hidden_def (__sigsuspend)
 weak_alias (__sigsuspend, sigsuspend)
 strong_alias (__sigsuspend, __libc_sigsuspend)
+
+#ifndef NO_CANCELLATION
+int
+__sigsuspend_nocancel (set)
+     const sigset_t *set;
+{
+  return do_sigsuspend (set);
+}
+#endif
diff --git a/sysdeps/unix/sysv/linux/sigtimedwait.c b/sysdeps/unix/sysv/linux/sigtimedwait.c
index adeadc1587..8795652766 100644
--- a/sysdeps/unix/sysv/linux/sigtimedwait.c
+++ b/sysdeps/unix/sysv/linux/sigtimedwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2002,2003,2004, 2005 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
@@ -89,5 +89,5 @@ __sigtimedwait (set, info, timeout)
 libc_hidden_def (__sigtimedwait)
 weak_alias (__sigtimedwait, sigtimedwait)
 #else
-# include <sysdeps/generic/sigtimedwait.c>
+# include <signal/sigtimedwait.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/sigwait.c b/sysdeps/unix/sysv/linux/sigwait.c
index 7c865963cd..279ca0203c 100644
--- a/sysdeps/unix/sysv/linux/sigwait.c
+++ b/sysdeps/unix/sysv/linux/sigwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2002-2004,2005 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
@@ -58,8 +58,11 @@ do_sigwait (const sigset_t *set, int *sig)
      real size of the user-level sigset_t.  */
 #ifdef INTERNAL_SYSCALL
   INTERNAL_SYSCALL_DECL (err);
-  ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set),
-			  NULL, NULL, _NSIG / 8);
+  do
+    ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set),
+			    NULL, NULL, _NSIG / 8);
+  while (INTERNAL_SYSCALL_ERROR_P (ret, err)
+	 && INTERNAL_SYSCALL_ERRNO (ret, err) == EINTR);
   if (! INTERNAL_SYSCALL_ERROR_P (ret, err))
     {
       *sig = ret;
@@ -68,8 +71,10 @@ do_sigwait (const sigset_t *set, int *sig)
   else
     ret = INTERNAL_SYSCALL_ERRNO (ret, err);
 #else
-  ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
-			NULL, NULL, _NSIG / 8);
+  do
+    ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
+			  NULL, NULL, _NSIG / 8);
+  while (ret == -1 && errno == EINTR);
   if (ret != -1)
     {
       *sig = ret;
diff --git a/sysdeps/unix/sysv/linux/sigwaitinfo.c b/sysdeps/unix/sysv/linux/sigwaitinfo.c
index a51a01f20b..80790df9eb 100644
--- a/sysdeps/unix/sysv/linux/sigwaitinfo.c
+++ b/sysdeps/unix/sysv/linux/sigwaitinfo.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,2000,2002,2003,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2000,2002,2003,2004, 2005 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
@@ -89,6 +89,6 @@ __sigwaitinfo (set, info)
 libc_hidden_def (__sigwaitinfo)
 weak_alias (__sigwaitinfo, sigwaitinfo)
 #else
-# include <sysdeps/generic/sigwaitinfo.c>
+# include <signal/sigwaitinfo.c>
 #endif
 strong_alias (__sigwaitinfo, __libc_sigwaitinfo)
diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c
index d94e4f62fd..0e41a11338 100644
--- a/sysdeps/unix/sysv/linux/sleep.c
+++ b/sysdeps/unix/sysv/linux/sleep.c
@@ -1,5 +1,5 @@
 /* Implementation of the POSIX sleep function using nanosleep.
-   Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <time.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <unistd.h>
 #include <sys/param.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/Dist b/sysdeps/unix/sysv/linux/sparc/Dist
deleted file mode 100644
index 174d053909..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-kernel_termios.h
-sys/trap.h
-ldd-rewrite.sed
-sys/procfs.h
diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile
index 29e5406348..9cb2a634d5 100644
--- a/sysdeps/unix/sysv/linux/sparc/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/Makefile
@@ -1 +1,5 @@
 64bit-predefine = __sparc_v9__ __arch64__
+
+ifeq ($(subdir),rt)
+librt-routines += rt-sysdep
+endif
diff --git a/sysdeps/unix/sysv/linux/sparc/Versions b/sysdeps/unix/sysv/linux/sparc/Versions
index 03d1d87176..be3d2b96c2 100644
--- a/sysdeps/unix/sysv/linux/sparc/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/Versions
@@ -1,8 +1,7 @@
 libc {
   # The comment lines with "#errlist-compat" are magic; see errlist-compat.awk.
   # When you get an error from errlist-compat.awk, you need to add a new
-  # version here.  Don't do this blindly, since this means changing the ABI
-  # for all GNU/Linux configurations.
+  # version here.
 
   GLIBC_2.0 {
     #errlist-compat	127
@@ -16,6 +15,10 @@ libc {
     #errlist-compat	128
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
+  GLIBC_2.4 {
+    #errlist-compat	134
+    _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+  }
 }
 librt {
   GLIBC_2.3 {
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/errno.h b/sysdeps/unix/sysv/linux/sparc/bits/errno.h
index 96b7372f19..02e200c088 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/errno.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/errno.h
@@ -1,5 +1,5 @@
 /* Error constants.  Linux/Sparc specific version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,1998,1999,2002,2005 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
@@ -31,6 +31,12 @@
 #  define ECANCELED	127
 # endif
 
+/* Support for error codes to support robust mutexes was added later, too.  */
+# ifndef EOWNERDEAD
+#  define EOWNERDEAD		132
+#  define ENOTRECOVERABLE	133
+# endif
+
 # ifndef __ASSEMBLER__
 /* Function to get address of global `errno' variable.  */
 extern int *__errno_location (void) __THROW __attribute__ ((__const__));
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
index 5dc8bf32f0..d68bfeb0ef 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/SPARC.
-   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004
+   Copyright (C) 1995, 1996, 1997, 1998, 2000, 2003, 2004, 2006
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -24,6 +24,9 @@
 
 #include <sys/types.h>
 #include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -113,7 +116,7 @@
 # define F_SETLKW64	14	/* Set record locking info (blocking).  */
 #endif
 
-/* for F_[GET|SET]FL */
+/* for F_[GET|SET]FD */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -199,10 +202,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
index cc4917a54b..be2b7eb280 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/SPARC version.
-   Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2000,2003,2005,2006 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
@@ -57,12 +57,14 @@
 
 /* These are Linux-specific.  */
 #ifdef __USE_MISC
-# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_GROWSDOWN	0x0200		/* Stack-like segment.  */
 # define MAP_DENYWRITE	0x0800		/* ETXTBSY */
 # define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
 # define MAP_LOCKED	0x0100		/* Lock the mapping.  */
 # define MAP_NORESERVE	0x0040		/* Don't check for reservations.  */
 # define _MAP_NEW	0x80000000	/* Binary compatibility with SunOS.  */
+# define MAP_POPULATE	0x8000		/* Populate (prefault) pagetables.  */
+# define MAP_NONBLOCK	0x10000		/* Do not block on IO.  */
 #endif
 
 /* Flags to `msync'.  */
@@ -78,6 +80,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -87,6 +90,10 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_FREE	 5	/* Content can be freed (Solaris).  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/poll.h b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
index f7a7393154..53b94bc50e 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2006 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
@@ -35,6 +35,13 @@
 # define POLLWRBAND	0x100		/* Priority data may be written.  */
 #endif
 
+#ifdef __USE_GNU
+/* These are extensions for Linux.  */
+# define POLLMSG	0x200
+# define POLLREMOVE	0x400
+# define POLLRDHUP	0x800
+#endif
+
 /* Event types always implicitly polled for.  These bits need not be set in
    `events', but they will appear in `revents' to indicate the status of
    the file descriptor.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index ed31b0e89c..3f2c600141 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  Linux/SPARC version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004
+   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -89,7 +89,18 @@ enum __rlimit_resource
   __RLIMIT_MSGQUEUE = 12,
 #define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
 
-  __RLIMIT_NLIMITS = 13,
+  /* Maximum nice priority allowed to raise to.
+     Nice levels 19 .. -20 correspond to 0 .. 39
+     values of this resource limit.  */
+  __RLIMIT_NICE = 13,
+#define RLIMIT_NICE __RLIMIT_NICE
+
+  /* Maximum realtime priority allowed for non-priviledged
+     processes.  */
+  __RLIMIT_RTPRIO = 14,
+#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
+
+  __RLIMIT_NLIMITS = 15,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
index dac9ac5cba..b44cc0fcd5 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997,1999,2000,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2003, 2005, 2006
+   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
@@ -57,28 +58,12 @@ typedef struct __sparc64_jmp_buf
   } __jmp_buf[1];
 #endif
 
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp)
-
 #else
 
-#if defined __USE_MISC || defined _ASM
-# define JB_SP  0
-# define JB_FP  1
-# define JB_PC  2
-#endif
-
 #ifndef _ASM
 typedef int __jmp_buf[3];
 #endif
 
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((int) (address) < (jmpbuf)[JB_SP])
-
 #endif
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/shm.h b/sysdeps/unix/sysv/linux/sparc/bits/shm.h
index f075be8d8a..03decb110c 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/shm.h
@@ -81,6 +81,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/stat.h b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
index 1890a6f680..2fccb14cf9 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2006
+   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
@@ -60,15 +61,7 @@ struct stat
 #else
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
 #endif
-#if __WORDSIZE == 64
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
-#else
-# ifdef __USE_MISC
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -78,17 +71,16 @@ struct stat
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-#  define st_mtime st_mtim.tv_sec
-#  define st_ctime st_ctim.tv_sec
-# else
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-# endif
 #endif
     unsigned long int __unused4;
     unsigned long int __unused5;
@@ -112,15 +104,7 @@ struct stat64
     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
 
     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#if __WORDSIZE == 64
-    __time_t st_atime;			/* Time of last access.  */
-    unsigned long int __unused1;
-    __time_t st_mtime;			/* Time of last modification.  */
-    unsigned long int __unused2;
-    __time_t st_ctime;			/* Time of last status change.  */
-    unsigned long int __unused3;
-#else
-# ifdef __USE_MISC
+#ifdef __USE_MISC
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -130,17 +114,16 @@ struct stat64
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-#  define st_mtime st_mtim.tv_sec
-#  define st_ctime st_ctim.tv_sec
-# else
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-# endif
 #endif
     unsigned long int __unused4;
     unsigned long int __unused5;
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 16f76dfa54..cea13227f8 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -1,5 +1,6 @@
 /* termios type and macro definitions.  Linux/SPARC version.
-   Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2005
+       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
@@ -84,34 +85,41 @@ struct termios
 #define ONLRET	0x00000020
 #define OFILL	0x00000040
 #define OFDEL	0x00000080
-#define NLDLY	0x00000100
-#define   NL0	0x00000000
-#define   NL1	0x00000100
-#define CRDLY	0x00000600
-#define   CR0	0x00000000
-#define   CR1	0x00000200
-#define   CR2	0x00000400
-#define   CR3	0x00000600
-#define TABDLY	0x00001800
-#define   TAB0	0x00000000
-#define   TAB1	0x00000800
-#define   TAB2	0x00001000
-#define   TAB3	0x00001800
-#define   XTABS	0x00001800
-#define BSDLY	0x00002000
-#define   BS0	0x00000000
-#define   BS1	0x00002000
-#define VTDLY	0x00004000
-#define   VT0	0x00000000
-#define   VT1	0x00004000
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY	0x00000100
+# define   NL0	0x00000000
+# define   NL1	0x00000100
+# define CRDLY	0x00000600
+# define   CR0	0x00000000
+# define   CR1	0x00000200
+# define   CR2	0x00000400
+# define   CR3	0x00000600
+# define TABDLY	0x00001800
+# define   TAB0	0x00000000
+# define   TAB1	0x00000800
+# define   TAB2	0x00001000
+# define   TAB3	0x00001800
+# define BSDLY	0x00002000
+# define   BS0	0x00000000
+# define   BS1	0x00002000
 #define FFDLY	0x00008000
 #define   FF0	0x00000000
 #define   FF1	0x00008000
+#endif
+#define VTDLY	0x00004000
+#define   VT0	0x00000000
+#define   VT1	0x00004000
 #define PAGEOUT 0x00010000	/* SUNOS specific */
 #define WRAP    0x00020000	/* SUNOS specific */
 
+#ifdef __USE_MISC
+# define   XTABS	0x00001800
+#endif
+
 /* c_cflag bit meaning */
-#define CBAUD	0x0000100f
+#ifdef __USE_MISC
+# define CBAUD	0x0000100f
+#endif
 #define  B0	0x00000000	/* hang up */
 #define  B50	0x00000001
 #define  B75	0x00000002
@@ -128,8 +136,10 @@ struct termios
 #define  B9600	0x0000000d
 #define  B19200	0x0000000e
 #define  B38400	0x0000000f
-#define EXTA    B19200
-#define EXTB    B38400
+#ifdef __USE_MISC
+# define EXTA    B19200
+# define EXTB    B38400
+#endif
 #define  CSIZE  0x00000030
 #define   CS5	0x00000000
 #define   CS6	0x00000010
@@ -141,7 +151,9 @@ struct termios
 #define PARODD	0x00000200
 #define HUPCL	0x00000400
 #define CLOCAL	0x00000800
-#define CBAUDEX 0x00001000
+#ifdef __USE_MISC
+# define CBAUDEX 0x00001000
+#endif
 #define  B57600  0x00001001
 #define  B115200 0x00001002
 #define  B230400 0x00001003
@@ -159,26 +171,32 @@ struct termios
 #define B2000000 0x0000100f
 #define __MAX_BAUD B2000000
 
-#define CIBAUD	0x100f0000	/* input baud rate (not used) */
-#define CMSPAR	0x40000000	/* mark or space (stick) parity */
-#define CRTSCTS	0x80000000	/* flow control */
+#ifdef __USE_MISC
+# define CIBAUD	 0x100f0000	/* input baud rate (not used) */
+# define CMSPAR	 0x40000000	/* mark or space (stick) parity */
+# define CRTSCTS 0x80000000	/* flow control */
+#endif
 
 /* c_lflag bits */
 #define ISIG	0x00000001
 #define ICANON	0x00000002
-#define XCASE	0x00000004
+#if defined __USE_MISC || defined __USE_XOPEN
+# define XCASE	0x00000004
+#endif
 #define ECHO	0x00000008
 #define ECHOE	0x00000010
 #define ECHOK	0x00000020
 #define ECHONL	0x00000040
 #define NOFLSH	0x00000080
 #define TOSTOP	0x00000100
-#define ECHOCTL	0x00000200
-#define ECHOPRT	0x00000400
-#define ECHOKE	0x00000800
-#define DEFECHO 0x00001000	/* SUNOS thing, what is it? */
-#define FLUSHO	0x00002000
-#define PENDIN	0x00004000
+#ifdef __USE_MISC
+# define ECHOCTL	0x00000200
+# define ECHOPRT	0x00000400
+# define ECHOKE		0x00000800
+# define DEFECHO 	0x00001000	/* SUNOS thing, what is it? */
+# define FLUSHO		0x00002000
+# define PENDIN		0x00004000
+#endif
 #define IEXTEN	0x00008000
 
 /* modem lines */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
new file mode 100644
index 0000000000..2d958d29e5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
@@ -0,0 +1,20 @@
+/* Determine the wordsize from the preprocessor defines.  */
+
+#if defined __arch64__ || defined __sparcv9
+# define __WORDSIZE	64
+#else
+# define __WORDSIZE	32
+#endif
+
+#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
+
+# if __WORDSIZE == 32
+/* Signal that in 32bit ABI we didn't used to have a `long double'.
+   The changes all the `long double' function variants to be redirects
+   to the double functions.  */
+#  define __LONG_DOUBLE_MATH_OPTIONAL   1
+#  ifndef __LONG_DOUBLE_128__
+#   define __NO_LONG_DOUBLE_MATH        1
+#  endif
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/readelflib.c b/sysdeps/unix/sysv/linux/sparc/readelflib.c
index ef5fa0e2cd..e12fbc7824 100644
--- a/sysdeps/unix/sysv/linux/sparc/readelflib.c
+++ b/sysdeps/unix/sysv/linux/sparc/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -53,10 +53,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c b/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c
new file mode 100644
index 0000000000..3ff55952e2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c
@@ -0,0 +1 @@
+#include <sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist b/sysdeps/unix/sysv/linux/sparc/sparc32/Dist
deleted file mode 100644
index 66f771a161..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-clone.S
-kernel_stat.h
-setfsuid.c
-setfsgid.c
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
new file mode 100644
index 0000000000..efda9d27c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Implies
@@ -0,0 +1,3 @@
+# These supply the ABI compatibility for when long double was double.
+ieee754/ldbl-64-128
+ieee754/ldbl-opt
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
index 05fd8523b7..cd1b3fb793 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
@@ -4,8 +4,18 @@ LD += -melf32_sparc
 
 # When I get this to work, this is the right thing
 ifeq ($(subdir),elf)
-CFLAGS-rtld.c += -mv8
+CFLAGS-rtld.c += -mcpu=v8
 #rtld-routines += dl-sysdepsparc
 sysdep-others += lddlibc4
 install-bin += lddlibc4
 endif   # elf
+
+ifeq ($(subdir),math)
+# These 2 routines are normally in libgcc{.a,_s.so.1}.
+# However, sparc32 -mlong-double-128 libgcc relies on
+# glibc providing _Q_* routines and without these files
+# glibc relies on __multc3/__divtc3 only provided
+# by libgcc if configured with -mlong-double-128.
+# Provide these routines here as well.
+libm-routines += multc3 divtc3
+endif   # math
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c b/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
index 1961622564..374131695c 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/chown.c
@@ -1 +1 @@
-#include <sysdeps/unix/sysv/linux/m68k/chown.c>
+#include <sysdeps/unix/sysv/linux/sh/chown.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
index 66cdbf3ca7..f91fc4f629 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
@@ -24,6 +24,7 @@
 #include <asm/errno.h>
 #include <asm/unistd.h>
 #include <tcb-offsets.h>
+#include <sysdep.h>
 
 #define CLONE_VM	0x00000100
 #define CLONE_THREAD	0x00010000
@@ -32,19 +33,26 @@
 	     pid_t *ptid, void *tls, pid_t *ctid); */
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
-
-__clone:
+ENTRY (__clone)
 	save	%sp,-96,%sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
-	tst	%i0
+	orcc	%i0,%g0,%g2
 	be	.Lerror
 	 orcc	%i1,%g0,%o1
 	be	.Lerror
 	 mov	%i2,%o0
+
+	/* The child_stack is the top of the stack, allocate one
+	   whole stack frame from that as this is what the kernel
+	   expects.  */
+	sub	%o1, 96, %o1
+	mov	%i3, %g3
+	mov	%i2, %g4
+
 	/* ptid */
 	mov	%i4,%o2
 	/* tls */
@@ -59,39 +67,43 @@ __clone:
 	 tst	%o1
 	bne	__thread_start
 	 nop
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %o0,%g0,%o0
 
 .Lerror:
 	call	__errno_location
 	 or	%g0,EINVAL,%i0
 	st	%i0,[%o0]
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-
-	.size	__clone, .-__clone
+END(__clone)
 
 	.type	__thread_start,@function
-
 __thread_start:
+	cfi_startproc
+
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
-	andcc	%i2, %l0, %g0
+	andcc	%g4, %l0, %g0
 	bne	1f
-	 andcc	%i2, CLONE_VM, %g0
+	 andcc	%g4, CLONE_VM, %g0
 	bne,a	2f
 	 mov	-1,%o0
 	set	__NR_getpid,%g1
 	ta	0x10
-2:	st	%o0,[%g7 + PID]
+2:
+	st	%o0,[%g7 + PID]
 	st	%o0,[%g7 + TID]
 1:
 #endif
-	call	%i0
-	 mov	%i3,%o0
+	mov	%g0, %fp	/* terminate backtrace */
+	call	%g2
+	 mov	%g3,%o0
 	call	_exit,0
 	 nop
 
+	cfi_endproc
+
 	.size	__thread_start, .-__thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c b/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c
deleted file mode 100644
index e9042d9717..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Data for Linux/sparc32 version of processor capability information.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This information must be kept in sync with the _DL_HWCAP_COUNT
-   definition in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions ar equite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_sparc32_cap_flags
-#else
-PROCINFO_CLASS const char _dl_sparc32_cap_flags[6][7]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "flush", "stbar", "swap", "muldiv", "v9", "ultra3"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h b/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h
deleted file mode 100644
index 82a94fca9c..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Linux/sparc32 version of processor capability information handling macros.
-   Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _DL_PROCINFO_H
-#define _DL_PROCINFO_H	1
-
-#include <ldsodefs.h>
-
-#define _DL_HWCAP_COUNT 6
-
-static inline int
-__attribute__ ((unused))
-_dl_procinfo (int word)
-{
-  int i;
-
-  _dl_printf ("AT_HWCAP:   ");
-
-  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
-    if (word & (1 << i))
-      _dl_printf (" %s", GLRO(dl_sparc32_cap_flags)[i]);
-
-  _dl_printf ("\n");
-
-  return 0;
-}
-
-static inline const char *
-__attribute__ ((unused))
-_dl_hwcap_string (int idx)
-{
-  return GLRO(dl_sparc32_cap_flags)[idx];
-};
-
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_hwcap (const char *str)
-{
-  int i;
-  for (i = 0; i < _DL_HWCAP_COUNT; i++)
-    {
-      if (strcmp (str, GLRO(dl_sparc32_cap_flags) [i]) == 0)
-	return i;
-    }
-  return -1;
-};
-
-#define HWCAP_IMPORTANT (HWCAP_SPARC_V9|HWCAP_SPARC_ULTRA3)
-
-/* There are no different platforms defined.  */
-#define _dl_platform_string(idx) ""
-
-/* There're no platforms to filter out.  */
-#define _DL_HWCAP_PLATFORM 0
-
-#define _dl_string_platform(str) (-1)
-
-#endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c
new file mode 100644
index 0000000000..dfed76aeb4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/fchownat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fchownat.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies
new file mode 100644
index 0000000000..dbcd1e9e6f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/fpu/Implies
@@ -0,0 +1,2 @@
+# We must list this here to move it ahead of the ldbl-opt code.
+sparc/sparc32/fpu
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c b/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c
new file mode 100644
index 0000000000..0f8b3135d8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/fxstatat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/i386/fxstatat.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
new file mode 100644
index 0000000000..bd985cc59c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/nldbl-abi.h
@@ -0,0 +1,8 @@
+/* ABI version for long double switch.
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-opt/.  It gives the ABI version where
+   long double == double was replaced with proper long double
+   for libm *l functions and libc functions using long double.  */
+
+#define NLDBL_VERSION			GLIBC_2.4
+#define LONG_DOUBLE_COMPAT_VERSION	GLIBC_2_4
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
index 27ea9f8912..dbe0872616 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
@@ -19,20 +19,22 @@
 
 #include <sysdep.h>
 
-	.globl __libc_pipe
-ENTRY (__libc_pipe)
-        mov %o0, %o2            /* Save PIPEDES. */
-	mov SYS_ify(pipe),%g1
-	ta 0x10
-	bcs __syscall_error_handler
-	 nop
-	st %o0, [%o2]           /* PIPEDES[0] = %o0; */
-        st %o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
+	.text
+	.globl		__syscall_error
+ENTRY(__libc_pipe)
+        mov	%o0, %o2            /* Save PIPEDES. */
+	mov	SYS_ify(pipe),%g1
+	ta	0x10
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]           /* PIPEDES[0] = %o0; */
+        st	%o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
 	retl
-	 clr %o0
-	SYSCALL_ERROR_HANDLER
+	 clr	%o0
+END(__libc_pipe)
 
-PSEUDO_END (__libc_pipe)
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
 weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c b/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c
index b28f009b06..64d47b34c5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c
@@ -1,6 +1,6 @@
 /* Semctl for architectures where word sized unions are passed indirectly
-   Copyright (C) 1995, 1997, 1998, 2000, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1995,1997,1998,2000,2002,2003,2004,2006
+   	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -28,7 +28,7 @@
 #include <string.h>
 #include <sys/syscall.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 #include <shlib-compat.h>
 
 struct __old_semid_ds
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
index 7fb6459d77..3be801a932 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 sigaction call for Linux/SPARC.
-   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2000,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx), 1997.
 
@@ -132,6 +132,10 @@ __libc_sigaction (int sig, __const struct sigaction *act,
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction);
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
index 3c12278e6a..71a63d5b79 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
@@ -40,10 +40,14 @@
    The .S files for the other calls just #define socket and #include this.  */
 
 #ifndef __socket
-#define __socket P(__,socket)
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
-.globl __socket
+	.globl		__syscall_error
 ENTRY (__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
@@ -72,18 +76,19 @@ ENTRY (__socket)
 	add %sp, 68, %o1		/* arg 2: parameter block */
 	LOADSYSCALL(socketcall)
 	t 0x10
-        bcs __syscall_error_handler
-	 nop
-	retl
+	bcc 1f
+	 mov %o7, %g1
+	call __syscall_error
+	 mov %g1, %o7
+1:	jmpl %o7 + 8, %g0
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save %sp, -96, %sp
-	cfi_def_cfa_register (%fp)
+	cfi_def_cfa_register(%fp)
 	cfi_window_save
-	cfi_register (%o7, %i7)
+	cfi_register(%o7, %i7)
 	CENABLE
 	 nop
 	mov %o0, %l0
@@ -91,18 +96,22 @@ ENTRY (__socket)
 	mov P(SOCKOP_,socket), %o0
 	LOADSYSCALL(socketcall)
 	t 0x10
-	bcs __syscall_error_handler2
+	bcc 1f
 	 mov %o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov %l0, %o0;
+	call __syscall_error;
+	 mov %l1, %o0;
+	b 1f
+	 mov -1, %l1;
+1:	CDISABLE
 	 mov %l0, %o0
-	jmpl %i7 + 8, %g0
+2:	jmpl %i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
 END (__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies b/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies
deleted file mode 100644
index 17ed964f79..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sparcv9b/Implies
+++ /dev/null
@@ -1 +0,0 @@
-unix/sysv/linux/sparc/sparc32/sparcv9
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
index 3b135c8e86..1610745524 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
@@ -17,8 +17,10 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+
 	.text
-ENTRY (syscall)
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0, %g1
 	mov	%o1, %o0
 	mov	%o2, %o1
@@ -26,10 +28,10 @@ ENTRY (syscall)
 	mov	%o4, %o3
 	mov	%o5, %o4
 	ta	0x10
-	bcs	__syscall_error_handler
-	 nop
-	retl
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index 29c5158b9f..c808a97fc5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
 
@@ -38,131 +38,54 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
+#undef PSEUDO_END
 #undef ENTRY
 #undef END
 #undef LOC
 
-#define ENTRY(name) \
-	.global C_SYMBOL_NAME(name); \
-	.align 4;\
-	C_LABEL(name);\
-	.type name,@function;
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
 
-#define END(name) \
+#define END(name)			\
+	cfi_endproc;			\
 	.size name, . - name
 
 #define LOC(name)  .L##name
 
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	ld	[%l7 + rtld_errno], %l0;				\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#elif USE___THREAD
-# ifndef NOT_IN_libc
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-# ifdef SHARED
-#  define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %l1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	add	%l1, %tie_lo10(SYSCALL_ERROR_ERRNO), %l1;		\
-	ld	[%l7 + %l1], %l1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%i0, [%g7 + %l1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-# else
-#  define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;		\
-	add	%g2, %lo(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	ld	[%g2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%o0, [%g7 + %g1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%o7+8, %g0;						\
-	 mov	-1, %o0;						\
-	.previous;
-# endif
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-        .type   __errno_location,@function;				\
-	save   %sp, -96, %sp;						\
-	call   __errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
-
-#define PSEUDO(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10;						\
-	bcs __syscall_error_handler;				\
-	 nop;							\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)		\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;			\
+	bcc		1f;			\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
+
+#define PSEUDO_ERRVAL(name, syscall_name, args)	\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
+
+#define PSEUDO_END(name)			\
+	END(name)
 
 #else  /* __ASSEMBLER__ */
 
@@ -214,4 +137,24 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
 
 #endif	/* __ASSEMBLER__ */
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dreg, reg, tmpreg) \
+  ld	[%g7 + POINTER_GUARD], tmpreg; \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg)
+#  define PTR_MANGLE2(dreg, reg, tmpreg) \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)     PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/sparc/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/Dist b/sysdeps/unix/sysv/linux/sparc/sparc64/Dist
deleted file mode 100644
index 4ba3a60c2c..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-clone.S
-dl-brk.S
-kernel_stat.h
-getcontext.S
-setcontext.S
-sizes.h
-ucontext_i.h
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
index 1fabd11f71..134ce789f7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
@@ -37,8 +37,11 @@ __curbrk: .skip 8
 #endif
 
 	.text
-ENTRY(__brk)
+ENTRY (__brk)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 #ifdef PIC
 1:	call	2f
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
@@ -90,7 +93,6 @@ ENTRY(__brk)
 	sub	%g0, 1, %i0
 	jmpl	%i7+8, %g0
 	 restore
-
-	.size __brk, .-__brk
+END (__brk)
 
 weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
index a7c248b2e8..ebfce9e2c5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
@@ -22,34 +22,52 @@
 
 #include <asm/errno.h>
 #include <asm/unistd.h>
+#include <tcb-offsets.h>
+#include <sysdep.h>
 
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+#define CLONE_VM	0x00000100
+#define CLONE_THREAD	0x00010000
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
+	     pid_t *ptid, void *tls, pid_t *ctid); */
+
+	.register	%g2,#scratch
+	.register	%g3,#scratch
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
 
-__clone:
+ENTRY (__clone)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
-	brz,pn	%i0, 99f
-	 mov	%i0, %l0		/* save fn */
-	brz,pn	%i1, 99f
-	 mov	%i3, %l3		/* save arg */
+	brz,pn	%i0, 99f		/* fn non-NULL? */
+	 mov	%i0, %g2
+	brz,pn	%i1, 99f		/* child_stack non-NULL? */
+	 mov	%i2, %o0		/* clone flags */
+
+	/* The child_stack is the top of the stack, allocate one
+	   whole stack frame from that as this is what the kernel
+	   expects.  Also, subtract STACK_BIAS.  */
+	sub	%i1, 192 + 0x7ff, %o1
+	mov	%i3, %g3
+	mov	%i2, %g4
+
+	mov	%i4,%o2			/* PTID */
+	mov	%i5,%o3			/* TLS */
+	ldx	[%fp+0x7ff+176],%o4	/* CTID */
 
 	/* Do the system call */
-	sub	%i1, 0x7ff, %o1
-	mov	%i2, %o0
 	set	__NR_clone, %g1
 	ta	0x6d
 	bcs,pn	%xcc, 99f
 	 nop
 	brnz,pn	%o1, __thread_start
-	 mov	%o0, %i0
-	ret
-	 restore
+	 nop
+	jmpl	%i7 + 8, %g0
+	 restore %o0, %g0, %o0
 99:
 #ifndef _LIBC_REENTRANT
 #ifdef PIC
@@ -71,18 +89,33 @@ __clone:
 	 nop
 	st	%i0, [%o0]
 #endif
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-	.size __clone, .-__clone
+END(__clone)
 
 	.type __thread_start,@function
 __thread_start:
+	cfi_startproc
+#ifdef RESET_PID
+	sethi	%hi(CLONE_THREAD), %l0
+	andcc	%g4, %l0, %g0
+	bne,pt	%icc, 1f
+	 andcc	%g4, CLONE_VM, %g0
+	bne,a,pn %icc, 2f
+	 mov	-1,%o0
+	set	__NR_getpid,%g1
+	ta	0x6d
+2:	st	%o0,[%g7 + PID]
+	st	%o0,[%g7 + TID]
+1:
+#endif
 	mov	%g0, %fp	/* terminate backtrace */
-	sub	%sp, 6*8, %sp	/* provide arg storage */
-	call	%l0
-	 mov	%l3,%o0
+	call	%g2
+	 mov	%g3,%o0
 	call	_exit,0
 	 nop
-	.size __thread_start, .-__thread_start
+	cfi_endproc
+
+	.size	__thread_start, .-__thread_start
 
-weak_alias(__clone, clone)
+weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c
deleted file mode 100644
index 0a453a6811..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Data for Linux/sparc64 version of processor capability information.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* This information must be kept in sync with the _DL_HWCAP_COUNT
-   definition in procinfo.h.
-
-   If anything should be added here check whether the size of each string
-   is still ok with the given array size.
-
-   All the #ifdefs in the definitions ar equite irritating but
-   necessary if we want to avoid duplicating the information.  There
-   are three different modes:
-
-   - PROCINFO_DECL is defined.  This means we are only interested in
-     declarations.
-
-   - PROCINFO_DECL is not defined:
-
-     + if SHARED is defined the file is included in an array
-       initializer.  The .element = { ... } syntax is needed.
-
-     + if SHARED is not defined a normal array initialization is
-       needed.
-  */
-
-#ifndef PROCINFO_CLASS
-#define PROCINFO_CLASS
-#endif
-
-#if !defined PROCINFO_DECL && defined SHARED
-  ._dl_sparc64_cap_flags
-#else
-PROCINFO_CLASS const char _dl_sparc64_cap_flags[6][7]
-#endif
-#ifndef PROCINFO_DECL
-= {
-    "flush", "stbar", "swap", "muldiv", "v9", "ultra3"
-  }
-#endif
-#if !defined SHARED || defined PROCINFO_DECL
-;
-#else
-,
-#endif
-
-#undef PROCINFO_DECL
-#undef PROCINFO_CLASS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h
deleted file mode 100644
index 3ce77a40e8..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Linux/sparc64 version of processor capability information handling macros.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef _DL_PROCINFO_H
-#define _DL_PROCINFO_H	1
-
-#include <ldsodefs.h>
-
-#define _DL_HWCAP_COUNT 6
-
-static inline int
-__attribute__ ((unused))
-_dl_procinfo (int word)
-{
-  int i;
-
-  _dl_printf ("AT_HWCAP:   ");
-
-  for (i = 0; i < _DL_HWCAP_COUNT; ++i)
-    if (word & (1 << i))
-      _dl_printf (" %s", GLRO(dl_sparc64_cap_flags)[i]);
-
-  _dl_printf ("\n");
-
-  return 0;
-}
-
-static inline const char *
-__attribute__ ((unused))
-_dl_hwcap_string (int idx)
-{
-  return GLRO(dl_sparc64_cap_flags)[idx];
-};
-
-
-static inline int
-__attribute__ ((unused))
-_dl_string_hwcap (const char *str)
-{
-  int i;
-  for (i = 0; i < _DL_HWCAP_COUNT; i++)
-    {
-      if (strcmp (str, GLRO(dl_sparc64_cap_flags) [i]) == 0)
-	return i;
-    }
-  return -1;
-};
-
-#define HWCAP_IMPORTANT (HWCAP_SPARC_ULTRA3)
-
-/* There are no different platforms defined.  */
-#define _dl_platform_string(idx) ""
-
-/* There're no platforms to filter out.  */
-#define _DL_HWCAP_PLATFORM 0
-
-#define _dl_string_platform(str) (-1)
-
-#endif /* dl-procinfo.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c
new file mode 100644
index 0000000000..db08af8e0f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/fxstatat.c
@@ -0,0 +1 @@
+#include "../../i386/fxstatat.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
index ea18a9ae4e..e6f5b55d6f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/getcontext.S
@@ -62,4 +62,4 @@ ENTRY(__getcontext)
 
 END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
index 700dd127d0..a4e411d132 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h
@@ -9,31 +9,39 @@ struct kernel_stat
     unsigned int st_gid;
     unsigned int st_rdev;
     long int st_size;
-    long int st_atime;
-    long int st_mtime;
-    long int st_ctime;
+    long int st_atime_sec;
+    long int st_mtime_sec;
+    long int st_ctime_sec;
     long int st_blksize;
     long int st_blocks;
     unsigned long int __unused1;
     unsigned long int __unused2;
   };
 
-#define _HAVE___UNUSED1
-#define _HAVE___UNUSED2
+/* Definition of `struct stat64' used in the kernel.  */
+struct kernel_stat64
+  {
+    unsigned long int st_dev;
+    unsigned long int st_ino;
+    unsigned long int st_nlink;
+
+    unsigned int st_mode;
+    unsigned int st_uid;
+    unsigned int st_gid;
+    unsigned int __pad0;
 
-#define _HAVE_STAT___UNUSED1
-#define _HAVE_STAT___UNUSED2
-#define _HAVE_STAT___UNUSED3
-#define _HAVE_STAT___UNUSED4
-#define _HAVE_STAT___UNUSED5
-#define _HAVE_STAT___PAD1
-#define _HAVE_STAT___PAD2
-#define _HAVE_STAT64___UNUSED1
-#define _HAVE_STAT64___UNUSED2
-#define _HAVE_STAT64___UNUSED3
-#define _HAVE_STAT64___UNUSED4
-#define _HAVE_STAT64___UNUSED5
-#define _HAVE_STAT64___PAD1
-#define _HAVE_STAT64___PAD2
+    unsigned long int st_rdev;
+    long int st_size;
+    long int st_blksize;
+    long int st_blocks;
+
+    unsigned long int st_atime_sec;
+    unsigned long int st_atime_nsec;
+    unsigned long int st_mtime_sec;
+    unsigned long int st_mtime_nsec;
+    unsigned long int st_ctime_sec;
+    unsigned long int st_ctime_nsec;
+    long int __unused[3];
+  };
 
 #define XSTAT_IS_XSTAT64 1
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
index 435bf99acb..88dc54e852 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/longjmp.S
@@ -47,6 +47,6 @@ END(__libc_siglongjmp)
 strong_alias(__libc_siglongjmp, __longjmp)
 strong_alias(__libc_siglongjmp, __libc_longjmp)
 libc_hidden_def (__libc_longjmp)
-weak_alias(__libc_siglongjmp, longjmp)
-weak_alias(__libc_siglongjmp, _longjmp)
-weak_alias(__libc_siglongjmp, siglongjmp)
+weak_alias (__libc_siglongjmp, longjmp)
+weak_alias (__libc_siglongjmp, _longjmp)
+weak_alias (__libc_siglongjmp, siglongjmp)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c
index 7637472dfc..7f1e98e433 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/lxstat.c
@@ -1 +1 @@
-#include "../../lxstat.c"
+#include "../../i386/lxstat.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c b/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c
index 2ec5bd39ad..e399e7c7eb 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c
@@ -1 +1,9 @@
+#include <errno.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sysdep-cancel.h>
+
+#define __sigprocmask(how, set, oset) \
+  INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8)
+
 #include <sysdeps/posix/pause.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
index 5ccedff21a..14f244e628 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
@@ -19,18 +19,22 @@
 
 #include <sysdep.h>
 
-ENTRY (__libc_pipe)
+	.text
+
+	.globl	__syscall_error
+ENTRY(__libc_pipe)
 	mov	%o0, %o2		/* Save PIPEDES. */
 	LOADSYSCALL(pipe)
 	ta	0x6d
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
 	st	%o1, [%o2 + 4]		/* PIPEDES[1] = %o1; */
 	retl
 	 clr	%o0
-	SYSCALL_ERROR_HANDLER
-PSEUDO_END (__libc_pipe)
+END(__libc_pipe)
 
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
index 4e0bc96d22..90d47c18fa 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
@@ -24,12 +24,15 @@
 .weak setcontext
 ENTRY(setcontext)
 
-	mov	1, %o1
+	ba,pt	%xcc, 1f
+	 mov	1, %o1
+
+END(setcontext)
 
 /* int __setcontext(ucontext_t *ctx, int restoremask); */
 ENTRY(__setcontext)
 
-	ldx	[%o0 + UC_SIGMASK], %o2
+1:	ldx	[%o0 + UC_SIGMASK], %o2
 	stx	%o2, [%o0 + __UC_SIGMASK]
 	ta	0x6f
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
index 1a9359af5b..ab1690bb42 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
@@ -39,7 +39,8 @@ libc_hidden_def (_setjmp)
 /* int setjmp(jmp_buf) */
 
 ENTRY(setjmp)
-	set	1, %o1
+	ba,pt	%xcc, __sigsetjmp_local
+	 set	1, %o1
 END(setjmp)
 
 /* int __sigsetjmp(jmp_buf, savemask)  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
index 0a2d2c3dde..b5e35f4e40 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 sigaction call for Linux/SPARC64.
-   Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2000,2002,2003,2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -65,6 +65,10 @@ __libc_sigaction (int sig, __const struct sigaction *act,
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction);
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c
deleted file mode 100644
index 1f06e3d534..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigsuspend.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../ia64/sigsuspend.c"
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
index 575416ff3f..353705b4ac 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
@@ -40,11 +40,15 @@
    The .S files for the other calls just #define socket and #include this.  */
 
 #ifndef __socket
-#define __socket P(__,socket)
+# ifndef NO_WEAK_ALIAS
+#  define __socket P(__,socket)
+# else
+#  define __socket socket
+# endif
 #endif
 
-.globl __socket
-ENTRY (__socket)
+	.globl	__syscall_error
+ENTRY(__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
 	   the caller for varargs, since that's really what we have.  */
@@ -73,14 +77,15 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save	%sp, -160, %sp
 	cfi_def_cfa_register (%fp)
 	cfi_window_save
@@ -93,18 +98,22 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler2
+	bcc,pt	%xcc, 1f
 	 mov	%o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov	%l0, %o0;
+	call	__syscall_error;
+	 mov	%l1, %o0;
+	ba,pt	%xcc, 2f
+	 mov	-1, %l1;
+1:	CDISABLE
 	 mov	%l0, %o0
-	jmpl	%i7 + 8, %g0
+2:	jmpl	%i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
-END (__socket)
+END(__socket)
 
+#ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
index 27bd086206..27487d8ed9 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
@@ -19,8 +19,8 @@
 #include <sysdep.h>
 	.text
 
-ENTRY (syscall)
-
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0,%g1
 	mov	%o1,%o0
 	mov	%o2,%o1
@@ -30,11 +30,10 @@ ENTRY (syscall)
 
 	ta	0x6d
 
-	bcs,pn %xcc,__syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index 3c6492aeca..f156f9241a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
 
@@ -25,6 +26,7 @@
 #ifdef IS_IN_rtld
 # include <dl-sysdep.h>		/* Defines RTLD_PRIVATE_ERRNO.  */
 #endif
+#include <tls.h>
 
 #undef SYS_ify
 #define SYS_ify(syscall_name) __NR_##syscall_name
@@ -47,99 +49,52 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
-#undef ENTRY
-
-#define ENTRY(name)							\
-	.global C_SYMBOL_NAME(name);					\
-	.align 2;							\
-	C_LABEL(name);							\
-	.type name,@function;
-
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc64.get_pic.l7,"ax",@progbits;	\
-	.globl __sparc64.get_pic.l7;					\
-	.hidden __sparc64.get_pic.l7;					\
-	.type __sparc64.get_pic.l7,@function;				\
-__sparc64.get_pic.l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp, -192, %sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc64.get_pic.l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	ldx	[%l7 + rtld_errno], %l0;				\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-	.type   __errno_location,@function;				\
-	save	%sp, -192, %sp;						\
-	call	__errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
-
-#define PSEUDO(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d;							\
-	bcs,pn	%xcc, __syscall_error_handler;				\
-	 nop;								\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)			\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
 #undef PSEUDO_END
-#define PSEUDO_END(name)						\
-	.size name,.-name
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(name)					\
-	.size name,.-name
+#undef ENTRY
+#undef END
 
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(name)						\
-	.size name,.-name
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
+
+#define END(name)			\
+	cfi_endproc;			\
+	.size name, . - name
+
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;			\
+	bcc,pt		%xcc, 1f;		\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define	PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
+
+#define	PSEUDO_ERRVAL(name, syscall_name, args) \
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
+
+#define PSEUDO_END(name)			\
+	END(name)
 
-#undef END
-#define END(name)							\
-	.size name,.-name
 
 /* Careful here!  This "ret" define can interfere; use jmpl if unsure.  */
 #define ret		retl; nop
@@ -197,4 +152,24 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
    register windows.  So if you poke stack memory directly you add this.  */
 #define STACK_BIAS	2047
 
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(dreg, reg, tmpreg) \
+  ldx	[%g7 + POINTER_GUARD], tmpreg; \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg)
+#  define PTR_MANGLE2(dreg, reg, tmpreg) \
+  xor	reg, tmpreg, dreg
+#  define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg)
+# else
+#  define PTR_MANGLE(var) \
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
+#  define PTR_DEMANGLE(var)     PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/sparc64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c b/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c
index 27d700b133..9f4c02c78b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/xstat.c
@@ -1 +1,8 @@
-#include "../../xstat.c"
+#include "../../i386/xstat.c"
+
+#ifdef __NR_stat64
+# if __ASSUME_STAT64_SYSCALL == 0
+/* The variable is shared between all wrappers around *stat{,64} calls.  */
+int __have_no_stat64;
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/xstatconv.c b/sysdeps/unix/sysv/linux/sparc/sparc64/xstatconv.c
new file mode 100644
index 0000000000..d3f49eea43
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/xstatconv.c
@@ -0,0 +1,127 @@
+/* Convert between the kernel's `struct stat' format, and libc's.
+   Copyright (C) 1991, 1995, 1996, 1997, 2000, 2002, 2003, 2006
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <assert.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
+#include <string.h>
+#include <kernel-features.h>
+
+int
+__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+{
+  switch (vers)
+    {
+    case _STAT_VER_KERNEL:
+      /* Nothing to do.  The struct is in the form the kernel expects.
+         We should have short-circuted before we got here, but for
+         completeness... */
+      *(struct kernel_stat *) ubuf = *kbuf;
+      break;
+
+    case _STAT_VER_LINUX:
+      {
+	struct stat *buf = ubuf;
+
+	/* Convert to current kernel version of `struct stat'.  */
+	buf->st_dev = kbuf->st_dev;
+	buf->__pad1 = 0;
+	buf->st_ino = kbuf->st_ino;
+	buf->st_mode = kbuf->st_mode;
+	buf->st_nlink = kbuf->st_nlink;
+	buf->st_uid = kbuf->st_uid;
+	buf->st_gid = kbuf->st_gid;
+	buf->st_rdev = kbuf->st_rdev;
+	buf->__pad2 = 0;
+	buf->st_size = kbuf->st_size;
+	buf->st_blksize = kbuf->st_blksize;
+	buf->st_blocks = kbuf->st_blocks;
+	buf->st_atim.tv_sec = kbuf->st_atime_sec;
+	buf->st_atim.tv_nsec = 0;
+	buf->st_mtim.tv_sec = kbuf->st_mtime_sec;
+	buf->st_mtim.tv_nsec = 0;
+	buf->st_ctim.tv_sec = kbuf->st_ctime_sec;
+	buf->st_ctim.tv_nsec = 0;
+	buf->__unused4 = 0;
+	buf->__unused5 = 0;
+      }
+      break;
+
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return 0;
+}
+
+int
+__xstat32_conv (int vers, struct stat64 *sbuf, struct stat *buf)
+{
+  struct kernel_stat64 *kbuf;
+
+  /* *stat64 syscalls on sparc64 really fill in struct kernel_stat64,
+     rather than struct stat64.  But it is the same size as
+     struct kernel_stat64, so use this hack so that we can reuse
+     i386 {,f,l}xstat{,at}.c routines.  */
+  __asm ("" : "=r" (kbuf) : "0" (sbuf));
+  assert (sizeof (struct stat) == sizeof (struct stat64));
+  assert (sizeof (struct stat64) >= sizeof (struct kernel_stat64));
+
+  switch (vers)
+    {
+    case _STAT_VER_LINUX:
+      {
+	/* Convert current kernel version of `struct stat64' to
+           `struct stat'.  */
+	buf->st_dev = kbuf->st_dev;
+	buf->__pad1 = 0;
+	buf->st_ino = kbuf->st_ino;
+	buf->st_mode = kbuf->st_mode;
+	buf->st_nlink = kbuf->st_nlink;
+	buf->st_uid = kbuf->st_uid;
+	buf->st_gid = kbuf->st_gid;
+	buf->st_rdev = kbuf->st_rdev;
+	buf->__pad2 = 0;
+	buf->st_size = kbuf->st_size;
+	buf->st_blksize = kbuf->st_blksize;
+	buf->st_blocks = kbuf->st_blocks;
+	buf->st_atim.tv_sec = kbuf->st_atime_sec;
+	buf->st_atim.tv_nsec = kbuf->st_atime_nsec;
+	buf->st_mtim.tv_sec = kbuf->st_mtime_sec;
+	buf->st_mtim.tv_nsec = kbuf->st_mtime_nsec;
+	buf->st_ctim.tv_sec = kbuf->st_ctime_sec;
+	buf->st_ctim.tv_nsec = kbuf->st_ctime_nsec;
+	buf->__unused4 = 0;
+	buf->__unused5 = 0;
+      }
+      break;
+
+      /* If struct stat64 is different from struct stat then
+	 _STAT_VER_KERNEL does not make sense.  */
+    case _STAT_VER_KERNEL:
+    default:
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return 0;
+}
diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h b/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
index d573f0e994..17907c4a38 100644
--- a/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/sparc/sys/ptrace.h
@@ -1,5 +1,6 @@
 /* `ptrace' debugger support interface.  Linux/SPARC version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2006
+   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
@@ -148,12 +149,11 @@ enum __ptrace_request
 #endif
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PTRACE_SYSCALL PTRACE_SYSCALL
 
 #if __WORDSIZE == 64
 
-  ,
   /* Get all floating point registers used by a processes.
      This is not supported on all machines.  */
    PTRACE_GETFPREGS = 25,
@@ -161,10 +161,26 @@ enum __ptrace_request
 
   /* Set all floating point registers used by a processes.
      This is not supported on all machines.  */
-   PTRACE_SETFPREGS = 26
+   PTRACE_SETFPREGS = 26,
 #define PT_SETFPREGS PTRACE_SETFPREGS
 
 #endif
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.S b/sysdeps/unix/sysv/linux/sparc/sysdep.S
deleted file mode 100644
index b031238ceb..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sysdep.S
+++ /dev/null
@@ -1 +0,0 @@
-/* Nothing to do here.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.c b/sysdeps/unix/sysv/linux/sparc/sysdep.c
new file mode 100644
index 0000000000..f86414570d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sysdep.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/powerpc/sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/statvfs64.c b/sysdeps/unix/sysv/linux/statvfs64.c
index 79d82c756a..bcef1d3afb 100644
--- a/sysdeps/unix/sysv/linux/statvfs64.c
+++ b/sysdeps/unix/sysv/linux/statvfs64.c
@@ -1,5 +1,5 @@
 /* Return information about the filesystem on which FILE resides.
-   Copyright (C) 1998, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2001, 2004, 2006 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
@@ -23,7 +23,7 @@
 #include <sys/stat.h>
 #include <sys/statfs.h>
 #include <sys/statvfs.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 extern void __internal_statvfs64 (const char *name, struct statvfs64 *buf,
diff --git a/sysdeps/unix/sysv/linux/symlinkat.c b/sysdeps/unix/sysv/linux/symlinkat.c
new file mode 100644
index 0000000000..4cfc924bfc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/symlinkat.c
@@ -0,0 +1,87 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Make a symbolic link to FROM named TO relative to TOFD.  */
+int
+symlinkat (from, tofd, to)
+     const char *from;
+     int tofd;
+     const char *to;
+{
+  int result;
+
+#ifdef __NR_symlinkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (symlinkat, 3, from, tofd, to);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (tofd != AT_FDCWD && to[0] != '/')
+    {
+      size_t tolen = strlen (to);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + tolen;
+      buf = __alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, tofd, to);
+      to = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  result = INTERNAL_SYSCALL (symlink, err, 2, from, to);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), tofd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/sync_file_range.c b/sysdeps/unix/sysv/linux/sync_file_range.c
new file mode 100644
index 0000000000..7519bb7fe6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sync_file_range.c
@@ -0,0 +1,47 @@
+/* Selective file content synch'ing.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+
+#ifdef __NR_sync_file_range
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, int flags)
+{
+  return INLINE_SYSCALL (sync_file_range, 6, fd,
+			 __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+			 __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
+			 flags);
+}
+#else
+int
+sync_file_range (int fd, __off64_t from, __off64_t to, int flags)
+{
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (sync_file_range)
+
+# include <stub-tag.h>
+#endif
diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h
index 6c310bcff5..68f173a04d 100644
--- a/sysdeps/unix/sysv/linux/sys/epoll.h
+++ b/sysdeps/unix/sysv/linux/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005 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
@@ -98,9 +98,12 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
    "events" parameter is a buffer that will contain triggered
    events. The "maxevents" is the maximum number of events to be
    returned ( usually size of "events" ). The "timeout" parameter
-   specifies the maximum wait time in milliseconds (-1 == infinite).  */
+   specifies the maximum wait time in milliseconds (-1 == infinite).
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
-		       int __maxevents, int __timeout) __THROW;
+		       int __maxevents, int __timeout);
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/sys/inotify.h
new file mode 100644
index 0000000000..0131db9d3e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/inotify.h
@@ -0,0 +1,92 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_SYS_INOTIFY_H
+#define	_SYS_INOTIFY_H	1
+
+#include <stdint.h>
+
+
+/* Structure describing an inotify event.  */
+struct inotify_event
+{
+  int wd;		/* Watch descriptor.  */
+  uint32_t mask;	/* Watch mask.  */
+  uint32_t cookie;	/* Cookie to synchronize two events.  */
+  uint32_t len;		/* Length (including NULs) of name.  */
+  char name __flexarr;	/* Name.  */
+};
+
+
+/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH.  */
+#define IN_ACCESS	 0x00000001	/* File was accessed.  */
+#define IN_MODIFY	 0x00000002	/* File was modified.  */
+#define IN_ATTRIB	 0x00000004	/* Metadata changed.  */
+#define IN_CLOSE_WRITE	 0x00000008	/* Writtable file was closed.  */
+#define IN_CLOSE_NOWRITE 0x00000010	/* Unwrittable file closed.  */
+#define IN_CLOSE	 (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close.  */
+#define IN_OPEN		 0x00000020	/* File was opened.  */
+#define IN_MOVED_FROM	 0x00000040	/* File was moved from X.  */
+#define IN_MOVED_TO      0x00000080	/* File was moved to Y.  */
+#define IN_MOVE		 (IN_MOVED_FROM | IN_MOVED_TO) /* Moves.  */
+#define IN_CREATE	 0x00000100	/* Subfile was created.  */
+#define IN_DELETE	 0x00000200	/* Subfile was deleted.  */
+#define IN_DELETE_SELF	 0x00000400	/* Self was deleted.  */
+#define IN_MOVE_SELF	 0x00000800	/* Self was moved.  */
+
+/* Events sent by the kernel.  */
+#define IN_UNMOUNT	 0x00002000	/* Backing fs was unmounted.  */
+#define IN_Q_OVERFLOW	 0x00004000	/* Event queued overflowed.  */
+#define IN_IGNORED	 0x00008000	/* File was ignored.  */
+
+/* Helper events.  */
+#define IN_CLOSE	 (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)	/* Close.  */
+#define IN_MOVE		 (IN_MOVED_FROM | IN_MOVED_TO)		/* Moves.  */
+
+/* Special flags.  */
+#define IN_ONLYDIR	 0x01000000	/* Only watch the path if it is a
+					   directory.  */
+#define IN_DONT_FOLLOW	 0x02000000	/* Do not follow a sym link.  */
+#define IN_MASK_ADD	 0x20000000	/* Add to the mask of an already
+					   existing watch.  */
+#define IN_ISDIR	 0x40000000	/* Event occurred against dir.  */
+#define IN_ONESHOT	 0x80000000	/* Only send event once.  */
+
+/* All events which a program can wait on.  */
+#define IN_ALL_EVENTS	 (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE  \
+			  | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM	      \
+			  | IN_MOVED_TO | IN_CREATE | IN_DELETE		      \
+			  | IN_DELETE_SELF | IN_MOVE_SELF)
+
+
+__BEGIN_DECLS
+
+/* Create and initialize inotify instance.  */
+extern int inotify_init (void) __THROW;
+
+/* Add watch of object NAME to inotify instance FD.  Notify about
+   events specified by MASK.  */
+extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask)
+  __THROW;
+
+/* Remove the watch specified by WD from the inotify instance FD.  */
+extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW;
+
+__END_DECLS
+
+#endif /* sys/inotify.h */
diff --git a/sysdeps/unix/sysv/linux/sys/kd.h b/sysdeps/unix/sysv/linux/sys/kd.h
index e0d2e869cf..d459c079ed 100644
--- a/sysdeps/unix/sysv/linux/sys/kd.h
+++ b/sysdeps/unix/sysv/linux/sys/kd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2005 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
@@ -21,9 +21,15 @@
 
 /* Make sure the <linux/types.h> header is not loaded.  */
 #ifndef _LINUX_TYPES_H
-# define _LINUX_TYPES_H	1
+# define _LINUX_TYPES_H		1
+# define __undef_LINUX_TYPES_H
 #endif
 
 #include <linux/kd.h>
 
+#ifdef __undef_LINUX_TYPES_H
+# undef _LINUX_TYPES_H
+# undef __undef_LINUX_TYPES_H
+#endif
+
 #endif	/* sys/kd.h */
diff --git a/sysdeps/unix/sysv/linux/sys/ptrace.h b/sysdeps/unix/sysv/linux/sys/ptrace.h
index b4aec4f208..44284cb307 100644
--- a/sysdeps/unix/sysv/linux/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/sys/ptrace.h
@@ -1,5 +1,5 @@
 /* `ptrace' debugger support interface.  Linux version.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2000,2006 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
@@ -109,8 +109,24 @@ enum __ptrace_request
 #define PT_SETFPXREGS PTRACE_SETFPXREGS
 
   /* Continue and stop at the next (return from) syscall.  */
-  PTRACE_SYSCALL = 24
+  PTRACE_SYSCALL = 24,
 #define PT_SYSCALL PTRACE_SYSCALL
+
+  /* Set ptrace filter options.  */
+  PTRACE_SETOPTIONS = 0x4200,
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+
+  /* Get last ptrace message.  */
+  PTRACE_GETEVENTMSG = 0x4201,
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+
+  /* Get siginfo for process.  */
+  PTRACE_GETSIGINFO = 0x4202,
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+
+  /* Set new siginfo for process.  */
+  PTRACE_SETSIGINFO = 0x4203
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
 };
 
 /* Perform process tracing functions.  REQUEST is one of the values
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index a8baf40a91..5aa0ec07d2 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -30,8 +30,6 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * Version: $Id$
  */
 
 #ifndef _SYS_QUOTA_H
@@ -41,6 +39,14 @@
 #include <sys/types.h>
 
 /*
+ * Select between different incompatible quota versions.
+ * Default to the version used by Linux kernel version 2.4.22
+ * or later.  */
+#ifndef _LINUX_QUOTA_VERSION
+# define _LINUX_QUOTA_VERSION 2
+#endif
+
+/*
  * Convert diskblocks to blocks and the other way around.
  * currently only to fool the BSD source. :-)
  */
@@ -94,21 +100,33 @@
 #define SUBCMDSHIFT 8
 #define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
 
-#define Q_QUOTAON  0x0100	/* enable quotas */
-#define Q_QUOTAOFF 0x0200	/* disable quotas */
-#define Q_GETQUOTA 0x0300	/* get limits and usage */
-#define Q_SETQUOTA 0x0400	/* set limits and usage */
-#define Q_SETUSE   0x0500	/* set usage */
-#define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
-#define Q_SETQLIM  0x0700	/* set limits */
-#define Q_GETSTATS 0x0800	/* get collected stats */
-#define Q_RSQUASH  0x1000	/* set root_squash option */
+#if _LINUX_QUOTA_VERSION < 2
+# define Q_QUOTAON  0x0100	/* enable quotas */
+# define Q_QUOTAOFF 0x0200	/* disable quotas */
+# define Q_GETQUOTA 0x0300	/* get limits and usage */
+# define Q_SETQUOTA 0x0400	/* set limits and usage */
+# define Q_SETUSE   0x0500	/* set usage */
+# define Q_SYNC     0x0600	/* sync disk copy of a filesystems quotas */
+# define Q_SETQLIM  0x0700	/* set limits */
+# define Q_GETSTATS 0x0800	/* get collected stats */
+# define Q_RSQUASH  0x1000	/* set root_squash option */
+#else
+# define Q_SYNC     0x800001	/* sync disk copy of a filesystems quotas */
+# define Q_QUOTAON  0x800002	/* turn quotas on */
+# define Q_QUOTAOFF 0x800003	/* turn quotas off */
+# define Q_GETFMT   0x800004	/* get quota format used on given filesystem */
+# define Q_GETINFO  0x800005	/* get information about quota files */
+# define Q_SETINFO  0x800006	/* set information about quota files */
+# define Q_GETQUOTA 0x800007	/* get user quota structure */
+# define Q_SETQUOTA 0x800008	/* set user quota structure */
+#endif
 
 /*
  * The following structure defines the format of the disk quota file
  * (as it appears on disk) - the file is an array of these structures
  * indexed by user or group number.
  */
+#if _LINUX_QUOTA_VERSION < 2
 struct dqblk
   {
     u_int32_t dqb_bhardlimit;	/* absolute limit on disk blks alloc */
@@ -120,13 +138,45 @@ struct dqblk
     time_t dqb_btime;		/* time limit for excessive disk use */
     time_t dqb_itime;		/* time limit for excessive files */
   };
+#else
+
+/* Flags that indicate which fields in dqblk structure are valid.  */
+#define QIF_BLIMITS	1
+#define QIF_SPACE	2
+#define QIF_ILIMITS	4
+#define QIF_INODES	8
+#define QIF_BTIME	16
+#define QIF_ITIME	32
+#define QIF_LIMITS	(QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE	(QIF_SPACE | QIF_INODES)
+#define QIF_TIMES	(QIF_BTIME | QIF_ITIME)
+#define QIF_ALL		(QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk
+  {
+    u_int64_t dqb_bhardlimit;	/* absolute limit on disk quota blocks alloc */
+    u_int64_t dqb_bsoftlimit;	/* preferred limit on disk quota blocks */
+    u_int64_t dqb_curspace;	/* current quota block count */
+    u_int64_t dqb_ihardlimit;	/* maximum # allocated inodes */
+    u_int64_t dqb_isoftlimit;	/* preferred inode limit */
+    u_int64_t dqb_curinodes;	/* current # allocated inodes */
+    u_int64_t dqb_btime;	/* time limit for excessive disk use */
+    u_int64_t dqb_itime;	/* time limit for excessive files */
+    u_int32_t dqb_valid;	/* bitmask of QIF_* constants */
+  };
+#endif
 
 /*
  * Shorthand notation.
  */
 #define	dq_bhardlimit	dq_dqb.dqb_bhardlimit
 #define	dq_bsoftlimit	dq_dqb.dqb_bsoftlimit
-#define	dq_curblocks	dq_dqb.dqb_curblocks
+#if _LINUX_QUOTA_VERSION < 2
+# define dq_curblocks	dq_dqb.dqb_curblocks
+#else
+# define dq_curspace	dq_dqb.dqb_curspace
+# define dq_valid	dq_dqb.dqb_valid
+#endif
 #define	dq_ihardlimit	dq_dqb.dqb_ihardlimit
 #define	dq_isoftlimit	dq_dqb.dqb_isoftlimit
 #define	dq_curinodes	dq_dqb.dqb_curinodes
@@ -135,6 +185,7 @@ struct dqblk
 
 #define dqoff(UID)      ((loff_t)((UID) * sizeof (struct dqblk)))
 
+#if _LINUX_QUOTA_VERSION < 2
 struct dqstats
   {
     u_int32_t lookups;
@@ -147,6 +198,22 @@ struct dqstats
     u_int32_t free_dquots;
     u_int32_t syncs;
   };
+#else
+
+/* Flags that indicate which fields in dqinfo structure are valid.  */
+# define IIF_BGRACE	1
+# define IIF_IGRACE	2
+# define IIF_FLAGS	4
+# define IIF_ALL	(IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo
+  {
+    u_int64_t dqi_bgrace;
+    u_int64_t dqi_igrace;
+    u_int32_t dqi_flags;
+    u_int32_t dqi_valid;
+  };
+#endif
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index a97305e822..e16110480f 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -1,6 +1,5 @@
 # File name	Caller	Syscall name	Args	Strong name	Weak names
 
-add_key		EXTRA	add_key		i:pppii	add_key
 adjtimex	adjtime	adjtimex	i:p	__adjtimex	adjtimex ntp_adjtime __adjtimex_internal
 bdflush		EXTRA	bdflush		i:ii	bdflush
 capget		EXTRA	capget		i:pp	capget
@@ -10,8 +9,8 @@ create_module	EXTRA	create_module	3	create_module
 delete_module	EXTRA	delete_module	3	delete_module
 epoll_create	EXTRA	epoll_create	i:i	epoll_create
 epoll_ctl	EXTRA	epoll_ctl	i:iiip	epoll_ctl
-epoll_wait	EXTRA	epoll_wait	i:ipii	epoll_wait
-fdatasync	-	fdatasync	i:i	fdatasync
+epoll_wait	EXTRA	epoll_wait	Ci:ipii	epoll_wait
+fdatasync	-	fdatasync	Ci:i	fdatasync
 flock		-	flock		i:ii	__flock		flock
 fork		-	fork		i:	__libc_fork	__fork fork
 get_kernel_syms	EXTRA	get_kernel_syms	i:p	get_kernel_syms
@@ -25,19 +24,20 @@ getresuid	-	getresuid	i:ppp	getresuid
 getresgid	-	getresgid	i:ppp	getresgid
 getsid		-	getsid		i:i	getsid
 init_module	EXTRA	init_module	5	init_module
+inotify_add_watch	EXTRA	inotify_add_watch	i:isi	inotify_add_watch
+inotify_init	EXTRA	inotify_init	i:	inotify_init
+inotify_rm_watch	EXTRA	inotify_rm_watch	i:ii	inotify_rm_watch
 ioperm		-	ioperm		i:iii	ioperm
 iopl		-	iopl		i:i	iopl
-keyctl		EXTRA	keyctl		i:iiiii	keyctl
 klogctl		EXTRA	syslog		i:isi	klogctl
 lchown		-	lchown		i:sii	__lchown	lchown
-posix_madvise	-	madvise		Vi:pii	posix_madvise
 madvise		-	madvise		i:pii	madvise
 mincore		-	mincore		i:anV	mincore
 mlock		-	mlock		i:bn	mlock
 mlockall	-	mlockall	i:i	mlockall
 mmap		-	mmap		b:aniiii	__mmap		mmap
 mount		EXTRA	mount		i:sssip	__mount	mount
-mremap		EXTRA	mremap		b:aini	__mremap	mremap
+mremap		EXTRA	mremap		b:ainip	__mremap	mremap
 munlock		-	munlock		i:ai	munlock
 munlockall	-	munlockall	i:	munlockall
 nanosleep	-	nanosleep	Ci:pp	__libc_nanosleep	__nanosleep nanosleep
@@ -51,7 +51,6 @@ putpmsg		-	putpmsg		i:ippii	putpmsg
 query_module	EXTRA	query_module	i:sipip	query_module
 quotactl	EXTRA	quotactl	i:isip	quotactl
 remap_file_pages -	remap_file_pages i:piiii	__remap_file_pages remap_file_pages
-request_key	EXTRA	request_key	i:pppi	request_key
 sched_getp	-	sched_getparam	i:ip	__sched_getparam	sched_getparam
 sched_gets	-	sched_getscheduler	i:i	__sched_getscheduler	sched_getscheduler
 sched_primax	-	sched_get_priority_max	i:i	__sched_get_priority_max	sched_get_priority_max
@@ -67,10 +66,14 @@ setfsgid	EXTRA	setfsgid	i:i	setfsgid
 setfsuid	EXTRA	setfsuid	i:i	setfsuid
 setpgid		-	setpgid		i:ii	__setpgid	setpgid
 sigaltstack	-	sigaltstack	i:PP	__sigaltstack	sigaltstack
+splice		EXTRA	splice		i:iPiPii	splice
 sysinfo		EXTRA	sysinfo		i:p	sysinfo
 swapon		-	swapon		i:si	__swapon	swapon
 swapoff		-	swapoff		i:s	__swapoff	swapoff
+tee		EXTRA	tee		i:iiii	tee
+unshare		EXTRA	unshare		i:i	unshare
 uselib		EXTRA	uselib		i:s	uselib
+vmsplice	EXTRA	vmsplice	i:iPii	vmsplice
 wait4		-	wait4		i:iWiP	__wait4		wait4
 
 chown		-	chown		i:sii	__libc_chown	__chown chown
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index 3cf6aa70bb..f9f6f1bfa5 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 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
@@ -48,6 +48,28 @@ __sysconf (int name)
       }
 #endif
 
+#if defined __NR_clock_getres || HP_TIMING_AVAIL
+    case _SC_CPUTIME:
+    case _SC_THREAD_CPUTIME:
+      {
+	/* If we have HP_TIMING, we will fall back on that if the system
+	   call does not work, so we support it either way.  */
+# if !HP_TIMING_AVAIL
+	/* Check using the clock_getres system call.  */
+	struct timespec ts;
+	INTERNAL_SYSCALL_DECL (err);
+	int r = INTERNAL_SYSCALL (clock_getres, err, 2,
+				  (name == _SC_CPUTIME
+				   ? CLOCK_PROCESS_CPUTIME_ID
+				   : CLOCK_THREAD_CPUTIME_ID),
+				  &ts);
+	if (INTERNAL_SYSCALL_ERROR_P (r, err))
+	  return -1;
+# endif
+	return _POSIX_VERSION;
+      }
+#endif
+
     case _SC_NGROUPS_MAX:
       /* Try to read the information from the /proc/sys/kernel/ngroups_max
 	 file.  */
diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
index 7e601acf2c..637fca5968 100644
--- a/sysdeps/unix/sysv/linux/sysctl.c
+++ b/sysdeps/unix/sysv/linux/sysctl.c
@@ -1,5 +1,5 @@
 /* Read or write system information.  Linux version.
-   Copyright (C) 1996-1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996-2000,2002,2003,2005 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
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <errno.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sys/sysctl.h>
 
 #include <sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/syslog.c b/sysdeps/unix/sysv/linux/syslog.c
new file mode 100644
index 0000000000..145e22b520
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/syslog.c
@@ -0,0 +1,10 @@
+#include <kernel-features.h>
+
+#if __ASSUME_MSG_NOSIGNAL
+# define NO_SIGPIPE
+# define send_flags MSG_NOSIGNAL
+#else
+# define send_flags 0
+#endif
+
+#include <misc/syslog.c>
diff --git a/sysdeps/unix/sysv/linux/system.c b/sysdeps/unix/sysv/linux/system.c
index 3fdff04c22..c5b389ea29 100644
--- a/sysdeps/unix/sysv/linux/system.c
+++ b/sysdeps/unix/sysv/linux/system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 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
@@ -18,6 +18,7 @@
 
 #include <sched.h>
 #include <signal.h>
+#include <string.h>	/* For the real memset prototype.  */
 #include <sysdep.h>
 #include <unistd.h>
 #include <sys/wait.h>
diff --git a/sysdeps/unix/sysv/linux/tcflow.c b/sysdeps/unix/sysv/linux/tcflow.c
index 5be68e2ea2..6e72370272 100644
--- a/sysdeps/unix/sysv/linux/tcflow.c
+++ b/sysdeps/unix/sysv/linux/tcflow.c
@@ -1 +1,31 @@
-#include <sysdeps/unix/bsd/sun/sunos4/tcflow.c>
+/* tcflow -- Suspend or restart transmission on termios file descriptor.
+   Copyright (C) 1993,1997,2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+/* Suspend or restart transmission on FD.  */
+int
+tcflow (fd, action)
+     int fd;
+     int action;
+{
+  return __ioctl (fd, TCXONC, action);
+}
diff --git a/sysdeps/unix/sysv/linux/tcflush.c b/sysdeps/unix/sysv/linux/tcflush.c
index 78e09b2f75..cae419f4a9 100644
--- a/sysdeps/unix/sysv/linux/tcflush.c
+++ b/sysdeps/unix/sysv/linux/tcflush.c
@@ -1 +1,31 @@
-#include <sysdeps/unix/bsd/sun/sunos4/tcflush.c>
+/* tcflush -- Flush pending data on termios file descriptor.  Linux version.
+   Copyright (C) 1993,1997,2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+
+/* Flush pending data on FD.  */
+int
+tcflush (fd, queue_selector)
+     int fd;
+     int queue_selector;
+{
+  return __ioctl (fd, TCFLSH, queue_selector);
+}
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
index 63453ca031..28e3e535ba 100644
--- a/sysdeps/unix/sysv/linux/tcgetattr.c
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1997, 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1995,1997,1998,2003,2006 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
@@ -40,39 +40,40 @@ __tcgetattr (fd, termios_p)
 
   retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
 
-  termios_p->c_iflag = k_termios.c_iflag;
-  termios_p->c_oflag = k_termios.c_oflag;
-  termios_p->c_cflag = k_termios.c_cflag;
-  termios_p->c_lflag = k_termios.c_lflag;
-  termios_p->c_line = k_termios.c_line;
+  if (__builtin_expect (retval == 0, 1))
+    {
+      termios_p->c_iflag = k_termios.c_iflag;
+      termios_p->c_oflag = k_termios.c_oflag;
+      termios_p->c_cflag = k_termios.c_cflag;
+      termios_p->c_lflag = k_termios.c_lflag;
+      termios_p->c_line = k_termios.c_line;
 #ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
 # ifdef _HAVE_C_ISPEED
-  termios_p->c_ispeed = k_termios.c_ispeed;
+      termios_p->c_ispeed = k_termios.c_ispeed;
 # else
-  termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
+      termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
 # endif
 #endif
 #ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
 # ifdef _HAVE_C_OSPEED
-  termios_p->c_ospeed = k_termios.c_ospeed;
+      termios_p->c_ospeed = k_termios.c_ospeed;
 # else
-  termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
+      termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
 # endif
 #endif
-  if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
-      || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
-    memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
-		       __KERNEL_NCCS * sizeof (cc_t)),
-	    _POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t));
-  else
-    {
-      size_t cnt;
-
-      memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
-	      __KERNEL_NCCS * sizeof (cc_t));
+      if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
+	  || (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
+	memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+			   __KERNEL_NCCS * sizeof (cc_t)),
+		_POSIX_VDISABLE, (NCCS - __KERNEL_NCCS) * sizeof (cc_t));
+      else
+	{
+	  memcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
+		  __KERNEL_NCCS * sizeof (cc_t));
 
-      for (cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt)
-	termios_p->c_cc[cnt] = _POSIX_VDISABLE;
+	  for (size_t cnt = __KERNEL_NCCS; cnt < NCCS; ++cnt)
+	    termios_p->c_cc[cnt] = _POSIX_VDISABLE;
+	}
     }
 
   return retval;
diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
index f73ec8883e..21e6ab2ede 100644
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
@@ -49,6 +49,7 @@ tcsetattr (fd, optional_actions, termios_p)
 {
   struct __kernel_termios k_termios;
   unsigned long int cmd;
+  int retval;
 
   switch (optional_actions)
     {
@@ -80,6 +81,35 @@ tcsetattr (fd, optional_actions, termios_p)
   memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
 	  __KERNEL_NCCS * sizeof (cc_t));
 
-  return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
+  retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
+
+  if (retval == 0 && cmd == TCSETS)
+    {
+      /* The Linux kernel has a bug which silently ignore the invalid
+        c_cflag on pty. We have to check it here. */
+      int save = errno;
+      retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
+      if (retval)
+       {
+         /* We cannot verify if the setting is ok. We don't return
+            an error (?). */
+         __set_errno (save);
+         retval = 0;
+       }
+      else if ((termios_p->c_cflag & (PARENB | CREAD))
+              != (k_termios.c_cflag & (PARENB | CREAD))
+              || ((termios_p->c_cflag & CSIZE)
+                  && ((termios_p->c_cflag & CSIZE)
+                      != (k_termios.c_cflag & CSIZE))))
+       {
+         /* It looks like the Linux kernel silently changed the
+            PARENB/CREAD/CSIZE bits in c_cflag. Report it as an
+            error. */
+         __set_errno (EINVAL);
+         retval = -1;
+       }
+    }
+
+  return retval;
 }
 libc_hidden_def (tcsetattr)
diff --git a/sysdeps/unix/sysv/linux/testrtsig.h b/sysdeps/unix/sysv/linux/testrtsig.h
index cf36ab08a7..f823a3f5af 100644
--- a/sysdeps/unix/sysv/linux/testrtsig.h
+++ b/sysdeps/unix/sysv/linux/testrtsig.h
@@ -1,5 +1,5 @@
 /* Test whether RT signals are really available.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -21,7 +21,7 @@
 #include <string.h>
 #include <sys/utsname.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 static int
 kernel_has_rtsig (void)
diff --git a/sysdeps/unix/sysv/linux/time.c b/sysdeps/unix/sysv/linux/time.c
new file mode 100644
index 0000000000..83667906dd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/time.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <stddef.h>
+#include <time.h>
+
+#include <sysdep.h>
+
+#ifdef __NR_time
+
+time_t
+time (t)
+     time_t *t;
+{
+  INTERNAL_SYSCALL_DECL (err);
+  time_t res = INTERNAL_SYSCALL (time, err, 1, NULL);
+  /* There cannot be any error.  */
+  if (t != NULL)
+    *t = res;
+  return res;
+}
+libc_hidden_def (time)
+
+#else
+
+# include <sysdeps/unix/time.c>
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c
index e6af2c4b04..f43cffe01a 100644
--- a/sysdeps/unix/sysv/linux/truncate64.c
+++ b/sysdeps/unix/sysv/linux/truncate64.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997-2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2000,2003,2004,2005,2006
+	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
@@ -25,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifdef __NR_truncate64
 #ifndef __ASSUME_TRUNCATE64_SYSCALL
@@ -71,5 +72,5 @@ truncate64 (const char *path, off64_t length)
 
 #else
 /* Use the generic implementation.  */
-# include <sysdeps/generic/truncate64.c>
+# include <misc/truncate64.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/tst-clone.c b/sysdeps/unix/sysv/linux/tst-clone.c
new file mode 100644
index 0000000000..8e249c2f04
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-clone.c
@@ -0,0 +1,56 @@
+/* Test for proper error/errno handling in clone.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* BZ #2386 */
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sched.h>
+
+int child_fn(void *arg)
+{
+  puts ("FAIL: in child_fn(); should not be here");
+  exit(1);
+}
+
+static int
+do_test (void)
+{
+  int result;
+
+#ifdef __ia64__
+  result = __clone2(child_fn, NULL, 0, 0, NULL, NULL, NULL);
+#else
+  result = clone(child_fn, NULL, (int) NULL, NULL);
+#endif
+
+  if (errno != EINVAL || result != -1)
+    {
+      printf ("FAIL: clone()=%d (wanted -1) errno=%d (wanted %d)\n",
+              result, errno, EINVAL);
+      return 1;
+    }
+
+  puts ("All OK");
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c
index 68d24f195e..1b79787515 100644
--- a/sysdeps/unix/sysv/linux/ttyname.c
+++ b/sysdeps/unix/sysv/linux/ttyname.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1996-2001,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1996-2002,2006 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
@@ -22,11 +22,13 @@
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <termios.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include <stdio-common/_itoa.h>
+#include <kernel-features.h>
 
 #if 0
 /* Is this used anywhere?  It is not exported.  */
@@ -41,7 +43,7 @@ static char *getttyname (const char *dev, dev_t mydev,
 libc_freeres_ptr (static char *getttyname_name);
 
 static char *
-internal_function
+internal_function attribute_compat_text_section
 getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat)
 {
   static size_t namelen;
@@ -117,9 +119,11 @@ ttyname (int fd)
   int dostat = 0;
   char *name;
   int save = errno;
-  int len;
+  struct termios term;
 
-  if (!__isatty (fd))
+  /* isatty check, tcgetattr is used because it sets the correct
+     errno (EBADF resp. ENOTTY) on error.  */
+  if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
     return NULL;
 
   /* We try using the /proc filesystem.  */
@@ -136,10 +140,19 @@ ttyname (int fd)
 	}
     }
 
-  len = __readlink (procname, ttyname_buf, buflen);
-  if (len != -1
-      /* This is for Linux 2.0.  */
-      && ttyname_buf[0] != '[')
+  ssize_t len = __readlink (procname, ttyname_buf, buflen);
+  if (__builtin_expect (len == -1 && errno == ENOENT, 0))
+    {
+      __set_errno (EBADF);
+      return NULL;
+    }
+
+  if (__builtin_expect (len != -1
+#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
+			/* This is for Linux 2.0.  */
+			&& ttyname_buf[0] != '['
+#endif
+			, 1))
     {
       if ((size_t) len >= buflen)
 	return NULL;
diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c
index eee4d862b2..cef8624dc6 100644
--- a/sysdeps/unix/sysv/linux/ttyname_r.c
+++ b/sysdeps/unix/sysv/linux/ttyname_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,1995-2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,1995-2001,2003,2006 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
@@ -22,18 +22,20 @@
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <termios.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 
 #include <stdio-common/_itoa.h>
+#include <kernel-features.h>
 
 static int getttyname_r (char *buf, size_t buflen,
 			 dev_t mydev, ino64_t myino, int save,
 			 int *dostat) internal_function;
 
 static int
-internal_function
+internal_function attribute_compat_text_section
 getttyname_r (char *buf, size_t buflen, dev_t mydev, ino64_t myino,
 	      int save, int *dostat)
 {
@@ -99,7 +101,6 @@ __ttyname_r (int fd, char *buf, size_t buflen)
   struct stat64 st, st1;
   int dostat = 0;
   int save = errno;
-  int ret;
 
   /* Test for the absolute minimal size.  This makes life easier inside
      the loop.  */
@@ -115,29 +116,34 @@ __ttyname_r (int fd, char *buf, size_t buflen)
       return ERANGE;
     }
 
+  /* isatty check, tcgetattr is used because it sets the correct
+     errno (EBADF resp. ENOTTY) on error.  */
+  struct termios term;
+  if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
+    return errno;
+
   /* We try using the /proc filesystem.  */
   *_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
 
-  ret = __readlink (procname, buf, buflen - 1);
-  if (ret == -1 && errno == ENOENT)
+  ssize_t ret = __readlink (procname, buf, buflen - 1);
+  if (__builtin_expect (ret == -1 && errno == ENOENT, 0))
     {
       __set_errno (EBADF);
       return EBADF;
     }
 
-  if (!__isatty (fd))
-    {
-      __set_errno (ENOTTY);
-      return ENOTTY;
-    }
-
-  if (ret == -1 && errno == ENAMETOOLONG)
+  if (__builtin_expect (ret == -1 && errno == ENAMETOOLONG, 0))
     {
       __set_errno (ERANGE);
       return ERANGE;
     }
 
-  if (ret != -1 && buf[0] != '[')
+  if (__builtin_expect (ret != -1
+#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
+			/* This is for Linux 2.0.  */
+			&& buf[0] != '['
+#endif
+			, 1))
     {
       buf[ret] = '\0';
       return 0;
diff --git a/sysdeps/unix/sysv/linux/unlinkat.c b/sysdeps/unix/sysv/linux/unlinkat.c
new file mode 100644
index 0000000000..0a07a8a875
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/unlinkat.c
@@ -0,0 +1,97 @@
+/* unlinkat -- Remove a link by relative name.
+   Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <kernel-features.h>
+
+
+/* Remove the link named NAME.  */
+int
+unlinkat (fd, file, flag)
+     int fd;
+     const char *file;
+     int flag;
+{
+  int result;
+
+#ifdef __NR_unlinkat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      result = INLINE_SYSCALL (unlinkat, 3, fd, file, flag);
+# ifndef __ASSUME_ATFCTS
+      if (result == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return result;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if (flag & ~AT_REMOVEDIR)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = __alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_REMOVEDIR)
+    result = INTERNAL_SYSCALL (rmdir, err, 1, file);
+  else
+    result = INTERNAL_SYSCALL (unlink, err, 1, file);
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
+      result = -1;
+    }
+
+  return result;
+#endif
+}
diff --git a/sysdeps/unix/sysv/linux/updwtmp.c b/sysdeps/unix/sysv/linux/updwtmp.c
index 63dd87e418..d4d3f2cb7a 100644
--- a/sysdeps/unix/sysv/linux/updwtmp.c
+++ b/sysdeps/unix/sysv/linux/updwtmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
 
@@ -31,4 +31,4 @@
 	 && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
 	file_name))))
 
-#include <sysdeps/generic/updwtmp.c>
+#include <login/updwtmp.c>
diff --git a/sysdeps/unix/sysv/linux/utimes.c b/sysdeps/unix/sysv/linux/utimes.c
index d777672125..a6095aaea5 100644
--- a/sysdeps/unix/sysv/linux/utimes.c
+++ b/sysdeps/unix/sysv/linux/utimes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 2000, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 2000, 2003, 2006 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
@@ -21,7 +21,7 @@
 #include <utime.h>
 #include <sys/time.h>
 #include <sysdep.h>
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 
 /* Change the access time of FILE to TVP[0] and
diff --git a/sysdeps/unix/sysv/linux/utmp_file.c b/sysdeps/unix/sysv/linux/utmp_file.c
index 3a27802b11..958619a032 100644
--- a/sysdeps/unix/sysv/linux/utmp_file.c
+++ b/sysdeps/unix/sysv/linux/utmp_file.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
 
@@ -31,4 +31,4 @@
 	 && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
 	file_name))))
 
-#include <sysdeps/generic/utmp_file.c>
+#include <login/utmp_file.c>
diff --git a/sysdeps/unix/sysv/linux/vfork.c b/sysdeps/unix/sysv/linux/vfork.c
index 9b4dd5f121..c8c13d0fd5 100644
--- a/sysdeps/unix/sysv/linux/vfork.c
+++ b/sysdeps/unix/sysv/linux/vfork.c
@@ -1 +1 @@
-#include <sysdeps/generic/vfork.c>
+#include <posix/vfork.c>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
new file mode 100644
index 0000000000..8b1c932ba9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat.c
@@ -0,0 +1,109 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Ho hum, since fxstatat == fxstatat64 we must get rid of the
+   prototype or gcc will complain since they don't strictly match.  */
+#define __fxstatat64 __fxstatat64_disable
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <sysdep.h>
+#include <kernel-features.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+
+/* Get information about the file NAME relative to FD in ST.  */
+int
+__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
+{
+  if (vers != _STAT_VER_KERNEL && vers != _STAT_VER_LINUX)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  int res;
+
+#ifdef __NR_newfstatat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      res = INLINE_SYSCALL (newfstatat, 4, fd, file, st, flag);
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  INTERNAL_SYSCALL_DECL (err);
+
+  if (flag & AT_SYMLINK_NOFOLLOW)
+    res = INTERNAL_SYSCALL (lstat, err, 2, file, CHECK_1 (st));
+  else
+    res = INTERNAL_SYSCALL (stat, err, 2, file, CHECK_1 (st));
+
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (res, err), 0))
+    {
+      __atfct_seterrno (INTERNAL_SYSCALL_ERRNO (res, err), fd, buf);
+      res = -1;
+    }
+
+  return res;
+#endif
+}
+libc_hidden_def (__fxstatat)
+#undef __fxstatat64
+strong_alias (__fxstatat, __fxstatat64);
+strong_alias (__fxstatat64, __GI___fxstatat64)
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c
new file mode 100644
index 0000000000..05e7f413bb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fxstatat64.c
@@ -0,0 +1 @@
+/* fxstatat64 is in fxstatat.c */
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
index 491fa9dfb2..5ea4c572a3 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/getdents.c
@@ -1,4 +1,4 @@
 #define __getdents64 __no___getdents64_decl
 #include <sysdeps/unix/sysv/linux/getdents.c>
 #undef __getdents64
-weak_alias(__getdents, __getdents64);
+weak_alias (__getdents, __getdents64);
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 58904fc4d4..d377db9687 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -14,3 +14,4 @@ getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit getrlimit64
 setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit setrlimit64
 readahead	-	readahead	i:iii	__readahead	readahead
 sendfile	-	sendfile	i:iipi	sendfile	sendfile64
+sync_file_range	-	sync_file_range	i:iiii	sync_file_range
diff --git a/sysdeps/unix/sysv/linux/x86_64/Dist b/sysdeps/unix/sysv/linux/x86_64/Dist
deleted file mode 100644
index 57dd1b2221..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/Dist
+++ /dev/null
@@ -1,11 +0,0 @@
-clone.S
-ldd-rewrite.sed
-__start_context.S
-ucontext_i.h
-umount.c
-sys/debugreg.h
-sys/io.h
-sys/perm.h
-sys/procfs.h
-sys/reg.h
-sys/user.h
diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
index 627275db09..0f20367236 100644
--- a/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -9,3 +9,7 @@ endif
 ifeq ($(subdir),stdlib)
 sysdep_routines += __start_context
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
index 9198c70bd4..fa1d02bc1f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -1,5 +1,5 @@
 /* O_*, F_*, FD_* bit values for Linux/x86-64.
-   Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2004, 2006 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
@@ -21,9 +21,12 @@
 # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
 #endif
 
-
 #include <sys/types.h>
 #include <bits/wordsize.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
 
 /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
    located on an ext2 file system */
@@ -110,7 +113,7 @@
 # define F_NOTIFY	1026	/* Request notfications on a directory.	 */
 #endif
 
-/* For F_[GET|SET]FL.  */
+/* For F_[GET|SET]FD.  */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
@@ -194,10 +197,55 @@ struct flock64
 # define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
 #endif
 
+
+#ifdef __USE_GNU
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing the
+					     write.  */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback.  */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages in
+					     the range after performing the
+					     write.  */
+
+/* Flags for SPLICE and VMSPLICE.  */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying.  */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to).  */
+# define SPLICE_F_MORE		4	/* Expect more data.  */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift.  */
+#endif
+
 __BEGIN_DECLS
 
+#ifdef __USE_GNU
+
 /* Provide kernel hint to read ahead.  */
 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
     __THROW;
 
+
+/* Selective file content synch'ing.  */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+
+/* Splice address range into a pipe.  */
+extern int vmsplice (int __fdout, const struct iovec *__iov, size_t __count,
+		     unsigned int __flags);
+
+/* Splice two files together.  */
+extern int splice (int __fdin, __off64_t *__offin, int __fdout,
+		   __off64_t *__offout, size_t __len, unsigned int __flags)
+    __THROW;
+
+/* In-kernel implementation of tee for pipe buffers.  */
+extern int tee (int __fdin, int __fdout, size_t __len, unsigned int __flags)
+    __THROW;
+
+#endif
+
 __END_DECLS
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
index a7bac26935..535c9edcf9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
@@ -1,5 +1,5 @@
 /* Definitions for POSIX memory map interface.  Linux/x86_64 version.
-   Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2006 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
@@ -79,6 +79,7 @@
 /* Flags for `mremap'.  */
 #ifdef __USE_GNU
 # define MREMAP_MAYMOVE	1
+# define MREMAP_FIXED	2
 #endif
 
 /* Advice to `madvise'.  */
@@ -88,6 +89,9 @@
 # define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
 # define MADV_WILLNEED	 3	/* Will need these pages.  */
 # define MADV_DONTNEED	 4	/* Don't need these pages.  */
+# define MADV_REMOVE	 9	/* Remove these pages and resources.  */
+# define MADV_DONTFORK	 10	/* Do not inherit across fork.  */
+# define MADV_DOFORK	 11	/* Do inherit across fork.  */
 #endif
 
 /* The POSIX people had to invent similar names for the same things.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
index 4282d75617..3d8c05d212 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/shm.h
@@ -80,6 +80,7 @@ struct shmid_ds
 # define SHM_DEST	01000	/* segment will be destroyed on last detach */
 # define SHM_LOCKED	02000   /* segment will not be swapped */
 # define SHM_HUGETLB	04000	/* segment is mapped via hugetlb */
+# define SHM_NORESERVE	010000	/* don't check for reservations */
 
 struct	shminfo
   {
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
index 08d4c52b2f..c0d5fe72d4 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
@@ -70,6 +70,14 @@ struct _fpstate
   __uint32_t		padding[56];
 };
 
+#ifndef sigcontext_struct
+/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
+   we need sigcontext.  Some packages have come to rely on
+   sigcontext_struct being defined on 32-bit x86, so define this for
+   their benefit.  */
+# define sigcontext_struct sigcontext
+#endif
+
 struct sigcontext
 {
   unsigned short gs, __gsh;
diff --git a/sysdeps/unix/sysv/linux/x86_64/brk.c b/sysdeps/unix/sysv/linux/x86_64/brk.c
index 09b7dd4707..8b18c4dbb9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/brk.c
+++ b/sysdeps/unix/sysv/linux/x86_64/brk.c
@@ -1 +1,42 @@
-#include <sysdeps/unix/sysv/linux/hppa/brk.c>
+/* brk system call for Linux/x86_64.
+   Copyright (C) 1995, 1996, 2000, 2001, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sysdep.h>
+
+/* This must be initialized data because commons can't have aliases.  */
+void *__curbrk = 0;
+
+int
+__brk (void *addr)
+{
+  void *newbrk;
+
+  __curbrk = newbrk = (void *) INLINE_SYSCALL (brk, 1, addr);
+
+  if (newbrk < addr)
+    {
+      __set_errno (ENOMEM);
+      return -1;
+    }
+
+  return 0;
+}
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
index 9695e1eaf8..8a12b09035 100644
--- a/sysdeps/unix/sysv/linux/x86_64/clone.S
+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005 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
@@ -74,7 +74,7 @@ ENTRY (BP_SYM (__clone))
 	movq	%r8, %rdx
 	movq	%r9, %r8
 	movq	8(%rsp), %r10
-	movq	$SYS_ify(clone),%rax
+	movl	$SYS_ify(clone),%eax
 
 	/* End FDE now, because in the child the unwind info will be
 	   wrong.  */
@@ -91,7 +91,7 @@ L(pseudo_end):
 L(thread_start):
 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
 	   the outermost frame obviously.  */
-	xorq	%rbp, %rbp
+	xorl	%ebp, %ebp
 
 #ifdef RESET_PID
 	testq	$CLONE_THREAD, %rdi
@@ -99,7 +99,7 @@ L(thread_start):
 	testq	$CLONE_VM, %rdi
 	movl	$-1, %eax
 	jne	2f
-	movq	$SYS_ify(getpid), %rax
+	movl	$SYS_ify(getpid), %eax
 	syscall
 2:	movl	%eax, %fs:PID
 	movl	%eax, %fs:TID
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
index 7e26fecb3a..6662a94d09 100644
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
+++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
@@ -1,5 +1,5 @@
 #ifdef IS_IN_ldconfig
-#include <sysdeps/i386/dl-procinfo.c>
+# include <sysdeps/i386/dl-procinfo.c>
 #else
-#include <sysdeps/generic/dl-procinfo.c>
+# include <sysdeps/generic/dl-procinfo.c>
 #endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
index b360b4288a..31455204c3 100644
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
@@ -1,5 +1,5 @@
 #ifdef IS_IN_ldconfig
-#include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
+# include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
 #else
-#include <sysdeps/generic/dl-procinfo.h>
+# include <sysdeps/generic/dl-procinfo.h>
 #endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/getcontext.S b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
index 2f2c710040..4bbc7a4d2e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/getcontext.S
@@ -1,5 +1,5 @@
 /* Save current context.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -67,18 +67,22 @@ ENTRY(__getcontext)
 	/* Save the current signal mask with
 	   rt_sigprocmask (SIG_BLOCK, NULL, set,_NSIG/8).  */
 	leaq	oSIGMASK(%rdi), %rdx
-	xorq	%rsi,%rsi
-	movq	$SIG_BLOCK, %rdi
-	movq	$_NSIG8,%r10
-	movq	$__NR_rt_sigprocmask, %rax
+	xorl	%esi,%esi
+#if SIG_BLOCK == 0
+	xorl	%edi, %edi
+#else
+	movl	$SIG_BLOCK, %edi
+#endif
+	movl	$_NSIG8,%r10d
+	movl	$__NR_rt_sigprocmask, %eax
 	syscall
 	cmpq	$-4095, %rax		/* Check %rax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
 
 	/* All done, return 0 for success.  */
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 L(pseudo_end):
 	ret
 PSEUDO_END(__getcontext)
 
-weak_alias(__getcontext, getcontext)
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/makecontext.c b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
index c763556b93..5deea7d1b2 100644
--- a/sysdeps/unix/sysv/linux/x86_64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/x86_64/makecontext.c
@@ -1,5 +1,5 @@
 /* Create new context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -20,6 +20,7 @@
 
 #include <sysdep.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <ucontext.h>
 
 #include "ucontext_i.h"
@@ -52,28 +53,29 @@ void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
   extern void __start_context (void);
-  unsigned long *sp, idx_uc_link;
+  unsigned long int *sp, idx_uc_link;
   va_list ap;
   int i;
 
   /* Generate room on stack for parameter if needed and uc_link.  */
-  sp = (long *) ((long) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
+  sp = (unsigned long int *) ((uintptr_t) ucp->uc_stack.ss_sp
+			      + ucp->uc_stack.ss_size);
   sp -= (argc > 6 ? argc - 6 : 0) + 1;
   /* Align stack and make space for trampoline address.  */
-  sp = (long *) ((((long) sp) & -16L) - 8);
+  sp = (unsigned long int *) ((((uintptr_t) sp) & -16L) - 8);
 
   idx_uc_link = (argc > 6 ? argc - 6 : 0) + 1;
 
   /* Setup context ucp.  */
   /* Address to jump to.  */
-  ucp->uc_mcontext.gregs[REG_RIP] = (long) func;
+  ucp->uc_mcontext.gregs[REG_RIP] = (long int) func;
   /* Setup rbx.*/
-  ucp->uc_mcontext.gregs[REG_RBX] = (long) &sp[idx_uc_link];
-  ucp->uc_mcontext.gregs[REG_RSP] = (long) sp;
+  ucp->uc_mcontext.gregs[REG_RBX] = (long int) &sp[idx_uc_link];
+  ucp->uc_mcontext.gregs[REG_RSP] = (long int) sp;
 
   /* Setup stack.  */
-  sp[0] = (long) &__start_context;
-  sp[idx_uc_link] = (long) ucp->uc_link;
+  sp[0] = (unsigned long int) &__start_context;
+  sp[idx_uc_link] = (unsigned long int) ucp->uc_link;
 
   va_start (ap, argc);
   /* Handle arguments.  */
@@ -108,4 +110,4 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 }
 
 
-weak_alias(__makecontext, makecontext)
+weak_alias (__makecontext, makecontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/readelflib.c b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
index c672f1df5a..5a49af3fa6 100644
--- a/sysdeps/unix/sysv/linux/x86_64/readelflib.c
+++ b/sysdeps/unix/sysv/linux/x86_64/readelflib.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999 and
 		  Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -53,10 +53,10 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 #undef process_elf_file
 #define process_elf_file process_elf32_file
 #define __ELF_NATIVE_CLASS 32
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
 
 #undef __ELF_NATIVE_CLASS
 #undef process_elf_file
 #define process_elf_file process_elf64_file
 #define __ELF_NATIVE_CLASS 64
-#include "sysdeps/generic/readelflib.c"
+#include "elf/readelflib.c"
diff --git a/sysdeps/unix/sysv/linux/x86_64/setcontext.S b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
index 65c03d8a01..61fc07f44f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/setcontext.S
@@ -1,5 +1,5 @@
 /* Install given context.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -40,10 +40,10 @@ ENTRY(__setcontext)
 	/* Set the signal mask with
 	   rt_sigprocmask (SIG_SETMASK, mask, NULL, _NSIG/8).  */
 	leaq	oSIGMASK(%rdi), %rsi
-	xorq	%rdx, %rdx
-	movq	$SIG_SETMASK, %rdi
-	movq	$_NSIG8,%r10
-	movq	$__NR_rt_sigprocmask, %rax
+	xorl	%edx, %edx
+	movl	$SIG_SETMASK, %edi
+	movl	$_NSIG8,%r10d
+	movl	$__NR_rt_sigprocmask, %eax
 	syscall
 	popq	%rdi			/* Reload %rdi, adjust stack.  */
 	cfi_adjust_cfa_offset(-8)
@@ -96,10 +96,10 @@ ENTRY(__setcontext)
 	cfi_startproc
 
 	/* Clear rax to indicate success.  */
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 
 L(pseudo_end):
 	ret
 PSEUDO_END(__setcontext)
 
-weak_alias(__setcontext, setcontext)
+weak_alias (__setcontext, setcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
index 9123047092..d6f4558cef 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c
+++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
@@ -1,5 +1,5 @@
 /* POSIX.1 `sigaction' call for Linux/x86-64.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2005 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
@@ -79,6 +79,10 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 }
 libc_hidden_def (__libc_sigaction)
 
+#ifdef WRAPPER_INCLUDE
+# include WRAPPER_INCLUDE
+#endif
+
 #ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, __sigaction)
 libc_hidden_weak (__sigaction)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c b/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
deleted file mode 100644
index 9c5c79e63e..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/ia64/sigsuspend.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
index 4394e2ae9f..fc7996ccdc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/x86_64/swapcontext.S
@@ -1,5 +1,5 @@
 /* Save current context and install the given one.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2002.
 
@@ -73,9 +73,9 @@ ENTRY(__swapcontext)
 	   rt_sigprocmask (SIG_BLOCK, newset, oldset,_NSIG/8).  */
 	leaq	oSIGMASK(%rdi), %rdx
 	leaq	oSIGMASK(%rsi), %rsi
-	movq	$SIG_SETMASK, %rdi
-	movq	$_NSIG8,%r10
-	movq	$__NR_rt_sigprocmask, %rax
+	movl	$SIG_SETMASK, %edi
+	movl	$_NSIG8,%r10d
+	movl	$__NR_rt_sigprocmask, %eax
 	syscall
 	cmpq	$-4095, %rax		/* Check %rax for error.  */
 	jae	SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
@@ -114,10 +114,10 @@ ENTRY(__swapcontext)
 	movq	oRSI(%rsi), %rsi
 
 	/* Clear rax to indicate success.  */
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 
 L(pseudo_end):
 	ret
 PSEUDO_END(__swapcontext)
 
-weak_alias(__swapcontext, swapcontext)
+weak_alias (__swapcontext, swapcontext)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h b/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
index cffddb58b3..02672d3c75 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2004,2005,2006 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
@@ -98,9 +98,12 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
    "events" parameter is a buffer that will contain triggered
    events. The "maxevents" is the maximum number of events to be
    returned ( usually size of "events" ). The "timeout" parameter
-   specifies the maximum wait time in milliseconds (-1 == infinite).  */
+   specifies the maximum wait time in milliseconds (-1 == infinite).
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
-		       int __maxevents, int __timeout) __THROW;
+		       int __maxevents, int __timeout);
 
 __END_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysconf.c b/sysdeps/unix/sysv/linux/x86_64/sysconf.c
index 407fd46bc3..5a898b7857 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysconf.c
+++ b/sysdeps/unix/sysv/linux/x86_64/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 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
@@ -45,11 +45,24 @@ static const struct intel_02_cache_info
     { 0x29, _SC_LEVEL3_CACHE_SIZE, 4194304, 8, 64 },
     { 0x2c, _SC_LEVEL1_DCACHE_SIZE, 32768, 8, 64 },
     { 0x30, _SC_LEVEL1_ICACHE_SIZE, 32768, 8, 64 },
+    { 0x39, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 64 },
+    { 0x3a, _SC_LEVEL2_CACHE_SIZE, 196608, 6, 64 },
+    { 0x3b, _SC_LEVEL2_CACHE_SIZE, 131072, 2, 64 },
+    { 0x3c, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 64 },
+    { 0x3d, _SC_LEVEL2_CACHE_SIZE, 393216, 6, 64 },
+    { 0x3e, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 64 },
     { 0x41, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 32 },
     { 0x42, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 32 },
     { 0x43, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 32 },
     { 0x44, _SC_LEVEL2_CACHE_SIZE, 1048576, 4, 32 },
     { 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
+    { 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
+    { 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
+    { 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
+    { 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
+    { 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
+    { 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
+    { 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 },
     { 0x60, _SC_LEVEL1_DCACHE_SIZE, 16384, 8, 64 },
     { 0x66, _SC_LEVEL1_DCACHE_SIZE, 8192, 4, 64 },
     { 0x67, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 },
@@ -60,6 +73,7 @@ static const struct intel_02_cache_info
     { 0x7b, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 64 },
     { 0x7c, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 64 },
     { 0x7d, _SC_LEVEL2_CACHE_SIZE, 2097152, 8, 64 },
+    { 0x7f, _SC_LEVEL2_CACHE_SIZE, 524288, 2, 64 },
     { 0x82, _SC_LEVEL2_CACHE_SIZE, 262144, 8, 32 },
     { 0x83, _SC_LEVEL2_CACHE_SIZE, 524288, 8, 32 },
     { 0x84, _SC_LEVEL2_CACHE_SIZE, 1048576, 8, 32 },
@@ -87,6 +101,7 @@ intel_02_known_compare (const void *p1, const void *p2)
 
 
 static long int
+__attribute__ ((noinline))
 intel_check_word (int name, unsigned int value, bool *has_level_2,
 		  bool *no_level_2_or_3)
 {
@@ -113,6 +128,33 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 	}
       else
 	{
+	  if (byte == 0x49 && folded_name == _SC_LEVEL3_CACHE_SIZE)
+	    {
+	      /* Intel reused this value.  For family 15, model 6 it
+		 specifies the 3rd level cache.  Otherwise the 2nd
+		 level cache.  */
+	      unsigned int eax;
+	      unsigned int ebx;
+	      unsigned int ecx;
+	      unsigned int edx;
+	      asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1"
+			    : "=a" (eax), "=r" (ebx), "=c" (ecx), "=d" (edx)
+			    : "0" (1));
+
+	      unsigned int family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf);
+	      unsigned int model = ((((eax >>16) & 0xf) << 4)
+				    + ((eax >> 4) & 0xf));
+	      if (family == 15 && model == 6)
+		{
+		  /* The level 3 cache is encoded for this model like
+		     the level 2 cache is for other models.  Pretend
+		     the caller asked for the level 2 cache.  */
+		  name = (_SC_LEVEL2_CACHE_SIZE
+			  + (name - _SC_LEVEL3_CACHE_SIZE));
+		  folded_name = _SC_LEVEL3_CACHE_SIZE;
+		}
+	    }
+
 	  struct intel_02_cache_info *found;
 	  struct intel_02_cache_info search;
 
@@ -149,7 +191,7 @@ intel_check_word (int name, unsigned int value, bool *has_level_2,
 }
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_intel (int name, unsigned int maxidx)
 {
   assert (maxidx >= 2);
@@ -206,7 +248,7 @@ handle_intel (int name, unsigned int maxidx)
 }
 
 
-static long int
+static long int __attribute__ ((noinline))
 handle_amd (int name)
 {
   unsigned int eax;
@@ -279,12 +321,6 @@ handle_amd (int name)
 long int
 __sysconf (int name)
 {
-  if (name == _SC_CPUTIME || name == _SC_THREAD_CPUTIME)
-    {
-      /* XXX Test whether TSC is usable.  */
-      return 200112L;
-    }
-
   /* We only handle the cache information here (for now).  */
   if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE)
     return linux_sysconf (name);
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index fd92d7ae16..5dfffca455 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,02,03,04 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2003, 2004, 2005 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
@@ -119,7 +119,7 @@
 # define SYSCALL_ERROR_HANDLER			\
 0:						\
   leaq rtld_errno(%rip), %rcx;			\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   movl %edx, (%rcx);				\
   orq $-1, %rax;				\
@@ -133,7 +133,7 @@
 # define SYSCALL_ERROR_HANDLER			\
 0:						\
   movq SYSCALL_ERROR_ERRNO@GOTTPOFF(%rip), %rcx;\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   movl %edx, %fs:(%rcx);			\
   orq $-1, %rax;				\
@@ -143,7 +143,7 @@
    Note that errno occupies only 4 bytes.  */
 # define SYSCALL_ERROR_HANDLER			\
 0:						\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   pushq %rdx;					\
   cfi_adjust_cfa_offset(8);			\
@@ -161,7 +161,7 @@
 #else /* Not _LIBC_REENTRANT.  */
 # define SYSCALL_ERROR_HANDLER			\
 0:movq errno@GOTPCREL(%RIP), %rcx;		\
-  xorq %rdx, %rdx;				\
+  xorl %edx, %edx;				\
   subq %rax, %rdx;				\
   movl %edx, (%rcx);				\
   orq $-1, %rax;				\
@@ -208,7 +208,7 @@
 #undef	DO_CALL
 #define DO_CALL(syscall_name, args)		\
     DOARGS_##args				\
-    movq $SYS_ify (syscall_name), %rax;		\
+    movl $SYS_ify (syscall_name), %eax;		\
     syscall;
 
 #define DOARGS_0 /* nothing */
@@ -311,4 +311,31 @@
 
 #endif	/* __ASSEMBLER__ */
 
+
+/* Pointer mangling support.  */
+#if defined NOT_IN_libc && defined IS_IN_rtld
+/* We cannot use the thread descriptor because in ld.so we use setjmp
+   earlier than the descriptor is initialized.  */
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg)	xorq __pointer_chk_guard_local(%rip), reg
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# else
+#  define PTR_MANGLE(reg)	asm ("xorq __pointer_chk_guard_local(%%rip), %0"\
+				     : "=r" (reg) : "0" (reg))
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# endif
+#else
+# ifdef __ASSEMBLER__
+#  define PTR_MANGLE(reg)	xorq %fs:POINTER_GUARD, reg
+#  define PTR_DEMANGLE(reg)	PTR_MANGLE (reg)
+# else
+#  define PTR_MANGLE(var)	asm ("xorq %%fs:%c2, %0"		      \
+				     : "=r" (var)			      \
+				     : "0" (var),			      \
+				       "i" (offsetof (tcbhead_t,	      \
+						      pointer_guard)))
+#  define PTR_DEMANGLE(var)	PTR_MANGLE (var)
+# endif
+#endif
+
 #endif /* linux/x86_64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h
deleted file mode 100644
index 5451a308ee..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation for Linux/x86-64.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Since we cannot include a header to define _NSIG/8, we define it
-   here.  */
-#define _NSIG8		8
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oRBP		120
-#define oRSP		160
-#define oRBX		128
-#define oR8		40
-#define oR9		48
-#define oR12		72
-#define oR13		80
-#define oR14		88
-#define oR15		96
-#define oRDI		104
-#define oRSI		112
-#define oRDX		136
-#define oRAX		144
-#define oRCX		152
-#define oRIP		168
-#define oFPREGS		208
-#define oSIGMASK	280
-#define oFPREGSMEM	408
-#define oMXCSR		432
diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
new file mode 100644
index 0000000000..b3cfe9aa4c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
@@ -0,0 +1,34 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+_NSIG8		(_NSIG / 8)
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+#define mreg(reg)		mcontext (gregs[REG_##reg])
+
+oRBP		mreg (RBP)
+oRSP		mreg (RSP)
+oRBX		mreg (RBX)
+oR8		mreg (R8)
+oR9		mreg (R9)
+oR12		mreg (R12)
+oR13		mreg (R13)
+oR14		mreg (R14)
+oR15		mreg (R15)
+oRDI		mreg (RDI)
+oRSI		mreg (RSI)
+oRDX		mreg (RDX)
+oRAX		mreg (RAX)
+oRCX		mreg (RCX)
+oRIP		mreg (RIP)
+oFPREGS		mcontext (fpregs)
+oSIGMASK	ucontext (uc_sigmask)
+oFPREGSMEM	ucontext (__fpregs_mem)
+oMXCSR		ucontext (__fpregs_mem.mxcsr)
diff --git a/sysdeps/unix/sysv/linux/x86_64/umount.c b/sysdeps/unix/sysv/linux/x86_64/umount.c
index 9a91ba5b2f..a17c5c5799 100644
--- a/sysdeps/unix/sysv/linux/x86_64/umount.c
+++ b/sysdeps/unix/sysv/linux/x86_64/umount.c
@@ -1 +1,31 @@
-#include <sysdeps/unix/sysv/linux/hppa/umount.c>
+/* Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by David Huggins-Daines <dhd@debian.org>, 2000.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Since we don't have an oldumount system call, do what the kernel
+   does down here.  */
+
+extern long int __umount2 (const char *name, int flags);
+
+long int
+__umount (const char *name)
+{
+  return __umount2 (name, 0);
+}
+
+weak_alias (__umount, umount);
diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c
new file mode 100644
index 0000000000..ef27b686cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -0,0 +1,95 @@
+/* Copyright (C) 2005, 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+
+#include <sysdep.h>
+#include <kernel-features.h>
+#include <sys/syscall.h>
+#include <bp-checks.h>
+
+
+/* Create a device file named PATH relative to FD, with permission and
+   special bits MODE and device number DEV (which can be constructed
+   from major and minor device numbers with the `makedev' macro above).  */
+int
+__xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
+{
+  if (vers != _MKNOD_VER)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  /* We must convert the value to dev_t type used by the kernel.  */
+  unsigned long long int k_dev =  (*dev) & ((1ULL << 32) - 1);
+  if (k_dev != *dev)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+#ifdef __NR_mknodat
+# ifndef __ASSUME_ATFCTS
+  if (__have_atfcts >= 0)
+# endif
+    {
+      int res = INLINE_SYSCALL (mknodat, 4, fd, file, mode,
+				(unsigned int) k_dev);
+# ifndef __ASSUME_ATFCTS
+      if (res == -1 && errno == ENOSYS)
+	__have_atfcts = -1;
+      else
+# endif
+	return res;
+    }
+#endif
+
+#ifndef __ASSUME_ATFCTS
+  char *buf = NULL;
+
+  if (fd != AT_FDCWD && file[0] != '/')
+    {
+      size_t filelen = strlen (file);
+      static const char procfd[] = "/proc/self/fd/%d/%s";
+      /* Buffer for the path name we are going to use.  It consists of
+	 - the string /proc/self/fd/
+	 - the file descriptor number
+	 - the file name provided.
+	 The final NUL is included in the sizeof.   A bit of overhead
+	 due to the format elements compensates for possible negative
+	 numbers.  */
+      size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen;
+      buf = alloca (buflen);
+
+      __snprintf (buf, buflen, procfd, fd, file);
+      file = buf;
+    }
+
+  return INLINE_SYSCALL (mknod, 3, CHECK_STRING (file), mode,
+			 (unsigned int) k_dev);
+#endif
+}
+
+libc_hidden_def (__xmknodat)
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
index 9e5110657a..096aac813b 100644
--- a/sysdeps/unix/sysv/linux/xstat64.c
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -1,5 +1,5 @@
 /* xstat64 using old-style Unix stat system call.
-   Copyright (C) 1991, 1995-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-2002,2003,2006 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
@@ -26,7 +26,7 @@
 #include <sys/syscall.h>
 #include <bp-checks.h>
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #if __ASSUME_STAT64_SYSCALL == 0
 # include <xstatconv.h>
diff --git a/sysdeps/unix/sysv/linux/xstatconv.h b/sysdeps/unix/sysv/linux/xstatconv.h
index 387a9feffc..7e36620430 100644
--- a/sysdeps/unix/sysv/linux/xstatconv.h
+++ b/sysdeps/unix/sysv/linux/xstatconv.h
@@ -1,5 +1,6 @@
 /* Convert between the kernel's `struct stat' format, and libc's.
-   Copyright (C) 1991,1995-1997,2000,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1991,1995-1997,2000,2002,2003,2006
+	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
@@ -17,7 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "kernel-features.h"
+#include <kernel-features.h>
 
 #ifndef STAT_IS_KERNEL_STAT
 extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf);
diff --git a/sysdeps/unix/sysv/tcflow.c b/sysdeps/unix/sysv/tcflow.c
index 1a91bd47db..dc67d0664f 100644
--- a/sysdeps/unix/sysv/tcflow.c
+++ b/sysdeps/unix/sysv/tcflow.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1996, 1997, 2005 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
@@ -22,7 +22,7 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 
-#include "sysv_termio.h"
+#include <sysv_termio.h>
 
 /* Suspend or restart transmission on FD.  */
 int
diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S
index 0d0d715052..aca81fef2f 100644
--- a/sysdeps/unix/x86_64/sysdep.S
+++ b/sysdeps/unix/x86_64/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2004, 2005 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
@@ -42,7 +42,7 @@ syscall_error:
 	   EWOULDBLOCK_sys is the original number.  */
 	cmpq $EWOULDBLOCK_sys, %rax /* Is it the old EWOULDBLOCK?  */
 	jne notb		/* Branch if not.  */
-	movq $EAGAIN, %rax	/* Yes; translate it to EAGAIN.  */
+	movl $EAGAIN, %eax	/* Yes; translate it to EAGAIN.  */
 notb:
 #endif
 #if USE___THREAD
diff --git a/sysdeps/wordsize-32/Dist b/sysdeps/wordsize-32/Dist
deleted file mode 100644
index 2459c7d95b..0000000000
--- a/sysdeps/wordsize-32/Dist
+++ /dev/null
@@ -1 +0,0 @@
-divdi3.c
diff --git a/sysdeps/wordsize-32/Makefile b/sysdeps/wordsize-32/Makefile
index b50c0b1635..82beac44ed 100644
--- a/sysdeps/wordsize-32/Makefile
+++ b/sysdeps/wordsize-32/Makefile
@@ -2,5 +2,6 @@ ifeq ($(subdir),csu)
 ifeq (yes,$(build-shared))
 sysdep_routines += divdi3
 shared-only-routines += divdi3
+CPPFLAGS-divdi3.c = -Din_divdi3_c
 endif
 endif
diff --git a/sysdeps/wordsize-32/divdi3.c b/sysdeps/wordsize-32/divdi3.c
index 94fb008f1f..8fa6343841 100644
--- a/sysdeps/wordsize-32/divdi3.c
+++ b/sysdeps/wordsize-32/divdi3.c
@@ -1,6 +1,6 @@
 /* 64-bit multiplication and division
-   Copyright (C) 1989, 1992-1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright (C) 1989, 1992-1999,2000,2001,2002,2003,2004,2005
+	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
@@ -309,7 +309,7 @@ __moddi3 (DWtype u, DWtype v)
     }
   if (v < 0)
     v = -v;
-  __udivmoddi4 (u, v, &w);
+  __udivmoddi4 (u, v, (UDWtype *) &w);
   if (c)
     w = -w;
   return w;
diff --git a/sysdeps/wordsize-32/llabs.c b/sysdeps/wordsize-32/llabs.c
index 3087fd6b71..04a93f4eaf 100644
--- a/sysdeps/wordsize-32/llabs.c
+++ b/sysdeps/wordsize-32/llabs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2005 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
@@ -18,6 +18,6 @@
 
 #include <inttypes.h>
 
-#include <sysdeps/generic/llabs.c>
+#include <stdlib/llabs.c>
 
 weak_alias (llabs, imaxabs)
diff --git a/sysdeps/wordsize-32/lldiv.c b/sysdeps/wordsize-32/lldiv.c
index 5cefd35c22..1d543ba0ff 100644
--- a/sysdeps/wordsize-32/lldiv.c
+++ b/sysdeps/wordsize-32/lldiv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2002, 2005 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
@@ -21,7 +21,7 @@
 
 #include <inttypes.h>
 
-#include <sysdeps/generic/lldiv.c>
+#include <stdlib/lldiv.c>
 
 #undef imaxdiv
 weak_alias (lldiv, imaxdiv)
diff --git a/sysdeps/wordsize-32/symbol-hacks.h b/sysdeps/wordsize-32/symbol-hacks.h
index ee53e1257f..c167cb9472 100644
--- a/sysdeps/wordsize-32/symbol-hacks.h
+++ b/sysdeps/wordsize-32/symbol-hacks.h
@@ -22,7 +22,7 @@
    therefore we get PLTs.  Unnecessarily so.  Changing gcc is a big
    task which might not be worth it so we play tricks with the
    assembler.  */
-#if !defined __ASSEMBLER__ && !defined NOT_IN_libc && defined SHARED
+#if !defined __ASSEMBLER__ && !defined in_divdi3_c && !defined NOT_IN_libc && defined SHARED
 asm ("__divdi3 = __divdi3_internal");
 asm ("__udivdi3 = __udivdi3_internal");
 asm ("__moddi3 = __moddi3_internal");
diff --git a/sysdeps/wordsize-64/glob.c b/sysdeps/wordsize-64/glob.c
index 7ee2eb2727..082faf1c70 100644
--- a/sysdeps/wordsize-64/glob.c
+++ b/sysdeps/wordsize-64/glob.c
@@ -1,6 +1,6 @@
 #define glob64 __no_glob64_decl
 #define globfree64 __no_globfree64_decl
-#include <sysdeps/generic/glob.c>
+#include <posix/glob.c>
 #undef glob64
 #undef globfree64
 weak_alias (glob, glob64)
diff --git a/sysdeps/wordsize-64/labs.c b/sysdeps/wordsize-64/labs.c
index 75b41b1145..5162ec5b17 100644
--- a/sysdeps/wordsize-64/labs.c
+++ b/sysdeps/wordsize-64/labs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2005 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
@@ -18,6 +18,6 @@
 
 #include <inttypes.h>
 
-#include <sysdeps/generic/labs.c>
+#include <stdlib/labs.c>
 
 weak_alias (labs, imaxabs)
diff --git a/sysdeps/wordsize-64/ldiv.c b/sysdeps/wordsize-64/ldiv.c
index ff213914ec..e4681a3b8e 100644
--- a/sysdeps/wordsize-64/ldiv.c
+++ b/sysdeps/wordsize-64/ldiv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2005 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
@@ -21,7 +21,7 @@
 
 #include <inttypes.h>
 
-#include <sysdeps/generic/ldiv.c>
+#include <stdlib/ldiv.c>
 
 #undef imaxdiv
 weak_alias (ldiv, imaxdiv)
diff --git a/sysdeps/wordsize-64/strtol.c b/sysdeps/wordsize-64/strtol.c
index ec07ea7261..2e1b229349 100644
--- a/sysdeps/wordsize-64/strtol.c
+++ b/sysdeps/wordsize-64/strtol.c
@@ -3,7 +3,7 @@
 #define strtoll strtoll_XXX
 #define strtoq strtoq_XXX
 
-#include <sysdeps/generic/strtol.c>
+#include <stdlib/strtol.c>
 
 #undef __strtoll_internal
 #undef strtoll
diff --git a/sysdeps/wordsize-64/strtol_l.c b/sysdeps/wordsize-64/strtol_l.c
index 5a5cd8d0b7..b2cd102add 100644
--- a/sysdeps/wordsize-64/strtol_l.c
+++ b/sysdeps/wordsize-64/strtol_l.c
@@ -3,7 +3,7 @@
 #define __strtoll_l __strtoll_l_XXX
 #define strtoll_l strtoll_l_XXX
 
-#include <sysdeps/generic/strtol_l.c>
+#include <stdlib/strtol_l.c>
 
 #undef ____strtoll_l_internal
 #undef __strtoll_l
diff --git a/sysdeps/wordsize-64/strtoul.c b/sysdeps/wordsize-64/strtoul.c
index ac3ca71116..401882ce0d 100644
--- a/sysdeps/wordsize-64/strtoul.c
+++ b/sysdeps/wordsize-64/strtoul.c
@@ -3,7 +3,7 @@
 #define strtoull strtoull_XXX
 #define strtouq strtouq_XXX
 
-#include <sysdeps/generic/strtoul.c>
+#include <stdlib/strtoul.c>
 
 #undef __strtoull_internal
 #undef strtoull
diff --git a/sysdeps/wordsize-64/strtoul_l.c b/sysdeps/wordsize-64/strtoul_l.c
index 9ee00a379a..80cca332b1 100644
--- a/sysdeps/wordsize-64/strtoul_l.c
+++ b/sysdeps/wordsize-64/strtoul_l.c
@@ -3,7 +3,7 @@
 #define __strtoull_l __strtoull_l_XXX
 #define strtoull_l strtoull_l_XXX
 
-#include <sysdeps/generic/strtoul_l.c>
+#include <stdlib/strtoul_l.c>
 
 #undef ____strtoull_l_internal
 #undef __strtoull_l
diff --git a/sysdeps/wordsize-64/wcstol.c b/sysdeps/wordsize-64/wcstol.c
index 96870cbd3c..b10895a82b 100644
--- a/sysdeps/wordsize-64/wcstol.c
+++ b/sysdeps/wordsize-64/wcstol.c
@@ -3,7 +3,7 @@
 #define wcstoll wcstoll_XXX
 #define wcstoq wcstoq_XXX
 
-#include <sysdeps/generic/wcstol.c>
+#include <wcsmbs/wcstol.c>
 
 #undef __wcstoll_internal
 #undef wcstoll
diff --git a/sysdeps/wordsize-64/wcstol_l.c b/sysdeps/wordsize-64/wcstol_l.c
index fe81147fe2..4f48f60c65 100644
--- a/sysdeps/wordsize-64/wcstol_l.c
+++ b/sysdeps/wordsize-64/wcstol_l.c
@@ -3,7 +3,7 @@
 #define __wcstoll_l ___wcstoll_l_XXX
 #define wcstoll_l __wcstoll_l_XX
 
-#include <sysdeps/generic/wcstol_l.c>
+#include <wcsmbs/wcstol_l.c>
 
 #undef ____wcstoll_l_internal
 #undef __wcstoll_l
diff --git a/sysdeps/wordsize-64/wcstoul.c b/sysdeps/wordsize-64/wcstoul.c
index b6f5d9ac07..2becb80744 100644
--- a/sysdeps/wordsize-64/wcstoul.c
+++ b/sysdeps/wordsize-64/wcstoul.c
@@ -3,7 +3,7 @@
 #define wcstoull wcstoull_XXX
 #define wcstouq wcstouq_XXX
 
-#include <sysdeps/generic/wcstoul.c>
+#include <wcsmbs/wcstoul.c>
 
 #undef __wcstoull_internal
 #undef wcstoull
diff --git a/sysdeps/wordsize-64/wcstoul_l.c b/sysdeps/wordsize-64/wcstoul_l.c
index d13bd5b16a..c376fa0e81 100644
--- a/sysdeps/wordsize-64/wcstoul_l.c
+++ b/sysdeps/wordsize-64/wcstoul_l.c
@@ -3,7 +3,7 @@
 #define __wcstoull_l ___wcstoull_l_XXX
 #define wcstoull_l __wcstoull_l_XXX
 
-#include <sysdeps/generic/wcstoul_l.c>
+#include <wcsmbs/wcstoul_l.c>
 
 #undef ____wcstoull_l_internal
 #undef __wcstoull_l
diff --git a/sysdeps/x86_64/Dist b/sysdeps/x86_64/Dist
deleted file mode 100644
index d0e516c5bc..0000000000
--- a/sysdeps/x86_64/Dist
+++ /dev/null
@@ -1,4 +0,0 @@
-bp-asm.h
-hp-timing.c
-_mcount.S
-bits/link.h
diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions
new file mode 100644
index 0000000000..253a65f04e
--- /dev/null
+++ b/sysdeps/x86_64/Versions
@@ -0,0 +1,7 @@
+libm {
+  GLIBC_2.1 {
+    # A generic bug got this omitted from other configurations' version
+    # sets, but we always had it.
+    exp2l;
+  }
+}
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index 9ed480c540..a68e7a8a4f 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2004,2005,2006 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
@@ -17,9 +17,7 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
 
 /* Jump to the position specified by ENV, causing the
@@ -27,28 +25,33 @@
    void __longjmp (__jmp_buf env, int val).  */
 ENTRY(__longjmp)
 	/* Restore registers.  */
+	movq (JB_RSP*8)(%rdi),%r8
+	movq (JB_RBP*8)(%rdi),%r9
+	movq (JB_PC*8)(%rdi),%rdx
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (%r8)
+	PTR_DEMANGLE (%r9)
+	PTR_DEMANGLE (%rdx)
+#endif
 	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)
+	cfi_register(%rsp,%r8)
+	cfi_register(%rbp,%r9)
+	cfi_register(%rip,%rdx)
 	cfi_offset(%rbx,JB_RBX*8)
 	cfi_offset(%rbp,JB_RBP*8)
 	cfi_offset(%r12,JB_R12*8)
 	cfi_offset(%r13,JB_R13*8)
 	cfi_offset(%r14,JB_R14*8)
 	cfi_offset(%r15,JB_R15*8)
-	cfi_offset(%rsp,JB_RSP*8)
-	cfi_offset(%rip,JB_PC*8)
 	movq (JB_RBX*8)(%rdi),%rbx
-	movq (JB_RBP*8)(%rdi),%rbp
 	movq (JB_R12*8)(%rdi),%r12
 	movq (JB_R13*8)(%rdi),%r13
 	movq (JB_R14*8)(%rdi),%r14
 	movq (JB_R15*8)(%rdi),%r15
 	/* Set return value for setjmp.  */
-	test %esi,%esi
-	mov $01,%eax
-	cmove %eax,%esi
 	mov %esi, %eax
-	movq (JB_PC*8)(%rdi),%rdx
-	movq (JB_RSP*8)(%rdi),%rsp
+	movq %r8,%rsp
+	movq %r9,%rbp
 	jmpq *%rdx
 END (BP_SYM (__longjmp))
diff --git a/sysdeps/x86_64/_mcount.S b/sysdeps/x86_64/_mcount.S
index 1cc4e3065b..c005932c0c 100644
--- a/sysdeps/x86_64/_mcount.S
+++ b/sysdeps/x86_64/_mcount.S
@@ -64,4 +64,4 @@ C_LABEL(_mcount)
 	ASM_SIZE_DIRECTIVE(C_SYMBOL_NAME(_mcount))
 
 #undef mcount
-weak_alias(_mcount, mcount)
+weak_alias (_mcount, mcount)
diff --git a/sysdeps/x86_64/bits/byteswap.h b/sysdeps/x86_64/bits/byteswap.h
index e1c861c75f..ec2b17889d 100644
--- a/sysdeps/x86_64/bits/byteswap.h
+++ b/sysdeps/x86_64/bits/byteswap.h
@@ -1,5 +1,6 @@
 /* Macros to swap the order of bytes in integer values.
-   Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2002, 2003, 2007
+   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
@@ -59,7 +60,9 @@
 # if __WORDSIZE == 64 || (defined __i486__ || defined __pentium__	      \
 			  || defined __pentiumpro__ || defined __pentium4__   \
 			  || defined __k8__ || defined __athlon__	      \
-			  || defined __k6__)
+			  || defined __k6__ || defined __nocona__	      \
+			  || defined __core2__ || defined __geode__	      \
+			  || defined __amdfam10__)
 /* To swap the bytes in a word the i486 processors and up provide the
    `bswap' opcode.  On i386 we have to use three instructions.  */
 #  define __bswap_32(x) \
diff --git a/sysdeps/x86_64/bits/link.h b/sysdeps/x86_64/bits/link.h
index 8ea7157156..2890c2d88d 100644
--- a/sysdeps/x86_64/bits/link.h
+++ b/sysdeps/x86_64/bits/link.h
@@ -1,14 +1,117 @@
-#if __WORDSIZE == 64
-struct link_map_machine
-  {
-    Elf64_Addr plt; /* Address of .plt + 0x16 */
-    Elf64_Addr gotplt; /* Address of .got + 0x18 */
-  };
+/* Copyright (C) 2004, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+
+#if __ELF_NATIVE_CLASS == 32
+/* Registers for entry into PLT on IA-32.  */
+typedef struct La_i86_regs
+{
+  uint32_t lr_edx;
+  uint32_t lr_ecx;
+  uint32_t lr_eax;
+  uint32_t lr_ebp;
+  uint32_t lr_esp;
+} La_i86_regs;
+
+/* Return values for calls from PLT on IA-32.  */
+typedef struct La_i86_retval
+{
+  uint32_t lrv_eax;
+  uint32_t lrv_edx;
+  long double lrv_st0;
+  long double lrv_st1;
+} La_i86_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf32_Addr la_i86_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
+				       uintptr_t *__refcook,
+				       uintptr_t *__defcook,
+				       La_i86_regs *__regs,
+				       unsigned int *__flags,
+				       const char *__symname,
+				       long int *__framesizep);
+extern unsigned int la_i86_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
+					uintptr_t *__refcook,
+					uintptr_t *__defcook,
+					const La_i86_regs *__inregs,
+					La_i86_retval *__outregs,
+					const char *symname);
+
+__END_DECLS
 
 #else
-struct link_map_machine
-  {
-    Elf32_Addr plt; /* Address of .plt + 0x16 */
-    Elf32_Addr gotplt; /* Address of .got + 0x0c */
-  };
+
+/* Registers for entry into PLT on x86-64.  */
+# if __GNUC_PREREQ (4,0)
+typedef float La_x86_64_xmm __attribute__ ((__vector_size__ (16)));
+# else
+typedef float La_x86_64_xmm __attribute__ ((__mode__ (__V4SF__)));
+# endif
+
+typedef struct La_x86_64_regs
+{
+  uint64_t lr_rdx;
+  uint64_t lr_r8;
+  uint64_t lr_r9;
+  uint64_t lr_rcx;
+  uint64_t lr_rsi;
+  uint64_t lr_rdi;
+  uint64_t lr_rbp;
+  uint64_t lr_rsp;
+  La_x86_64_xmm lr_xmm[8];
+} La_x86_64_regs;
+
+/* Return values for calls from PLT on x86-64.  */
+typedef struct La_x86_64_retval
+{
+  uint64_t lrv_rax;
+  uint64_t lrv_rdx;
+  La_x86_64_xmm lrv_xmm0;
+  La_x86_64_xmm lrv_xmm1;
+  long double lrv_st0;
+  long double lrv_st1;
+} La_x86_64_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_x86_64_gnu_pltenter (Elf64_Sym *__sym,
+					  unsigned int __ndx,
+					  uintptr_t *__refcook,
+					  uintptr_t *__defcook,
+					  La_x86_64_regs *__regs,
+					  unsigned int *__flags,
+					  const char *__symname,
+					  long int *__framesizep);
+extern unsigned int la_x86_64_gnu_pltexit (Elf64_Sym *__sym,
+					   unsigned int __ndx,
+					   uintptr_t *__refcook,
+					   uintptr_t *__defcook,
+					   const La_x86_64_regs *__inregs,
+					   La_x86_64_retval *__outregs,
+					   const char *symname);
+
+__END_DECLS
+
 #endif
diff --git a/sysdeps/x86_64/bits/linkmap.h b/sysdeps/x86_64/bits/linkmap.h
new file mode 100644
index 0000000000..8ea7157156
--- /dev/null
+++ b/sysdeps/x86_64/bits/linkmap.h
@@ -0,0 +1,14 @@
+#if __WORDSIZE == 64
+struct link_map_machine
+  {
+    Elf64_Addr plt; /* Address of .plt + 0x16 */
+    Elf64_Addr gotplt; /* Address of .got + 0x18 */
+  };
+
+#else
+struct link_map_machine
+  {
+    Elf32_Addr plt; /* Address of .plt + 0x16 */
+    Elf32_Addr gotplt; /* Address of .got + 0x0c */
+  };
+#endif
diff --git a/sysdeps/x86_64/fpu/bits/mathdef.h b/sysdeps/x86_64/bits/mathdef.h
index 7b16189590..7b16189590 100644
--- a/sysdeps/x86_64/fpu/bits/mathdef.h
+++ b/sysdeps/x86_64/bits/mathdef.h
diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h
index 96646efdda..c9b98b2e3b 100644
--- a/sysdeps/x86_64/bits/setjmp.h
+++ b/sysdeps/x86_64/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2002,2003,2005,2006 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
@@ -26,36 +26,6 @@
 
 #include <bits/wordsize.h>
 
-#if __WORDSIZE == 64
-
-/* We only need to save callee-saved registers plus stackpointer and
-   program counter.  */
-# if defined __USE_MISC || defined _ASM
-#  define JB_RBX	0
-#  define JB_RBP	1
-#  define JB_R12	2
-#  define JB_R13	3
-#  define JB_R14	4
-#  define JB_R15	5
-#  define JB_RSP	6
-#  define JB_PC	7
-#  define JB_SIZE (8*8)
-# endif
-
-#else
-
-# if defined __USE_MISC || defined _ASM
-#  define JB_BX	0
-#  define JB_SI	1
-#  define JB_DI	2
-#  define JB_BP	3
-#  define JB_SP	4
-#  define JB_PC	5
-#  define JB_SIZE 24
-# endif
-
-#endif
-
 #ifndef _ASM
 
 # if __WORDSIZE == 64
@@ -64,15 +34,6 @@ typedef long int __jmp_buf[8];
 typedef int __jmp_buf[6];
 # endif
 
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-# if __WORDSIZE == 64
-#  define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_RSP])
-# else
-#  define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)[JB_SP])
-# endif
 #endif
 
 #endif  /* bits/setjmp.h */
diff --git a/sysdeps/x86_64/bsd-_setjmp.S b/sysdeps/x86_64/bsd-_setjmp.S
index 22b6eb423d..838fae70f7 100644
--- a/sysdeps/x86_64/bsd-_setjmp.S
+++ b/sysdeps/x86_64/bsd-_setjmp.S
@@ -1,5 +1,6 @@
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  x86-64 version.
-   Copyright (C) 1994-1997,2000,2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997, 2000, 2001, 2002, 2003, 2005
+   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
@@ -30,7 +31,7 @@
 
 ENTRY (BP_SYM (_setjmp))
 	/* Set up arguments, we only need to set the second arg.  */
-	xorq %rsi, %rsi
+	xorl %esi, %esi
 #ifdef PIC
 	jmp HIDDEN_JUMPTARGET (__sigsetjmp)
 #else
diff --git a/sysdeps/x86_64/bsd-setjmp.S b/sysdeps/x86_64/bsd-setjmp.S
index c168f81867..216c503ccb 100644
--- a/sysdeps/x86_64/bsd-setjmp.S
+++ b/sysdeps/x86_64/bsd-setjmp.S
@@ -1,5 +1,6 @@
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  x86-64 version.
-   Copyright (C) 1994,1995,1996,1997,2000,2001 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2005
+   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
@@ -30,8 +31,9 @@
 
 ENTRY (BP_SYM (setjmp))
 	/* Set up arguments, we only need to set the 2nd arg.  */
-	movq $1, %rsi
+	movl $1, %esi
 #ifdef	PIC
+	jmp HIDDEN_JUMPTARGET (__sigsetjmp)
 #else
 	jmp BP_SYM (__sigsetjmp)
 #endif
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index b932f51d15..73e271775a 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  x86-64 version.
-   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>.
 
@@ -55,7 +55,7 @@ elf_machine_dynamic (void)
 static inline Elf64_Addr __attribute__ ((unused))
 elf_machine_load_address (void)
 {
-  register Elf64_Addr addr, tmp;
+  Elf64_Addr addr;
 
   /* The easy way is just the same as on x86:
        leaq _dl_start, %0
@@ -66,15 +66,18 @@ elf_machine_load_address (void)
 
      Instead we store the address of _dl_start in the data section
      and compare it with the current value that we can get via
-     an RIP relative addressing mode.  */
-
-  asm ("movq 1f(%%rip), %1\n"
-       "0:\tleaq _dl_start(%%rip), %0\n\t"
-       "subq %1, %0\n\t"
-       ".section\t.data\n"
+     an RIP relative addressing mode.  Note that this is the address
+     of _dl_start before any relocation performed at runtime.  In case
+     the binary is prelinked the resulting "address" is actually a
+     load offset which is zero if the binary was loaded at the address
+     it is prelinked for.  */
+
+  asm ("leaq _dl_start(%%rip), %0\n\t"
+       "subq 1f(%%rip), %0\n\t"
+       ".section\t.data.rel.ro\n"
        "1:\t.quad _dl_start\n\t"
        ".previous\n\t"
-       : "=r" (addr), "=r" (tmp) : : "cc");
+       : "=r" (addr) : : "cc");
 
   return addr;
 }
@@ -116,7 +119,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	{
 	  got[2] = (Elf64_Addr) &_dl_runtime_profile;
 
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    /* This is the object we are looking for.  Say that we really
 	       want profiling and the timers are started.  */
 	    GL(dl_profile_map) = l;
@@ -130,128 +134,6 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-#ifndef PROF
-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.type _dl_runtime_resolve, @function\n\
-	.align 16\n\
-	" CFI_STARTPROC "\n\
-_dl_runtime_resolve:\n\
-	subq $56,%rsp\n\
-	" CFI_ADJUST_CFA_OFFSET(72)" # Incorporate PLT\n\
-	movq %rax,(%rsp)	# Preserve registers otherwise clobbered.\n\
-	movq %rcx,8(%rsp)\n\
-	movq %rdx,16(%rsp)\n\
-	movq %rsi,24(%rsp)\n\
-	movq %rdi,32(%rsp)\n\
-	movq %r8,40(%rsp)\n\
-	movq %r9,48(%rsp)\n\
-	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.\n\
-	movq %rsi,%r11		# Multiply by 24\n\
-	addq %r11,%rsi\n\
-	addq %r11,%rsi\n\
-	shlq $3, %rsi\n\
-	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset\n\
-	call fixup		# Call resolver.\n\
-	movq %rax, %r11		# Save return value\n\
-	movq 48(%rsp),%r9	# Get register content back.\n\
-	movq 40(%rsp),%r8\n\
-	movq 32(%rsp),%rdi\n\
-	movq 24(%rsp),%rsi\n\
-	movq 16(%rsp),%rdx\n\
-	movq 8(%rsp),%rcx\n\
-	movq (%rsp),%rax\n\
-	addq $72,%rsp		# Adjust stack(PLT did 2 pushes)\n\
-	" CFI_ADJUST_CFA_OFFSET(-72)" \n\
-	jmp *%r11		# Jump to function address.\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_profile, @function\n\
-	.align 16\n\
-	" CFI_STARTPROC "\n\
-_dl_runtime_profile:\n\
-	subq $56,%rsp\n\
-	" CFI_ADJUST_CFA_OFFSET(72)" # Incorporate PLT\n\
-	movq %rax,(%rsp)	# Preserve registers otherwise clobbered.\n\
-	movq %rcx,8(%rsp)\n\
-	movq %rdx,16(%rsp)\n\
-	movq %rsi,24(%rsp)\n\
-	movq %rdi,32(%rsp)\n\
-	movq %r8,40(%rsp)\n\
-	movq %r9,48(%rsp)\n\
-	movq 72(%rsp), %rdx	# Load return address if needed\n\
-	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.\n\
-	movq %rsi,%r11		# Multiply by 24\n\
-	addq %r11,%rsi\n\
-	addq %r11,%rsi\n\
-	shlq $3, %rsi\n\
-	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset\n\
-	call profile_fixup	# Call resolver.\n\
-	movq %rax, %r11		# Save return value\n\
-	movq 48(%rsp),%r9	# Get register content back.\n\
-	movq 40(%rsp),%r8\n\
-	movq 32(%rsp),%rdi\n\
-	movq 24(%rsp),%rsi\n\
-	movq 16(%rsp),%rdx\n\
-	movq 8(%rsp),%rcx\n\
-	movq (%rsp),%rax\n\
-	addq $72,%rsp		# Adjust stack\n\
-	" CFI_ADJUST_CFA_OFFSET(-72)"\n\
-	jmp *%r11		# Jump to function address.\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
-	.previous\n\
-");
-#else
-# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
-	.text\n\
-	.globl _dl_runtime_resolve\n\
-	.globl _dl_runtime_profile\n\
-	.type _dl_runtime_resolve, @function\n\
-	.type _dl_runtime_profile, @function\n\
-	.align 16\n\
-	" CFI_STARTPROC "\n\
-_dl_runtime_resolve:\n\
-_dl_runtime_profile:\n\
-	subq $56,%rsp\n\
-	" CFI_ADJUST_CFA_OFFSET(72)" # Incorporate PLT\n\
-	movq %rax,(%rsp)	# Preserve registers otherwise clobbered.\n\
-	movq %rcx,8(%rsp)\n\
-	movq %rdx,16(%rsp)\n\
-	movq %rsi,24(%rsp)\n\
-	movq %rdi,32(%rsp)\n\
-	movq %r8,40(%rsp)\n\
-	movq %r9,48(%rsp)\n\
-	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.\n\
-	movq %rsi,%r11		# Multiply by 24\n\
-	addq %r11,%rsi\n\
-	addq %r11,%rsi\n\
-	shlq $3, %rsi\n\
-	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset\n\
-	call fixup		# Call resolver.\n\
-	movq %rax, %r11		# Save return value\n\
-	movq 48(%rsp),%r9	# Get register content back.\n\
-	movq 40(%rsp),%r8\n\
-	movq 32(%rsp),%rdi\n\
-	movq 24(%rsp),%rsi\n\
-	movq 16(%rsp),%rdx\n\
-	movq 8(%rsp),%rcx\n\
-	movq (%rsp),%rax\n\
-	addq $72,%rsp		# Adjust stack\n\
-	" CFI_ADJUST_CFA_OFFSET(-72)"\n\
-	jmp *%r11		# Jump to function address.\n\
-	" CFI_ENDPROC "\n\
-	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
-	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
-	.previous\n\
-");
-#endif
-
 /* Initial entry point code for the dynamic linker.
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
@@ -280,16 +162,24 @@ _dl_start_user:\n\
 	# Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
 	# argc -> rsi\n\
 	movq %rdx, %rsi\n\
+	# Save %rsp value in %r13.\n\
+	movq %rsp, %r13\n\
+	# And align stack for the _dl_init_internal call. \n\
+	andq $-16, %rsp\n\
 	# _dl_loaded -> rdi\n\
 	movq _rtld_local(%rip), %rdi\n\
 	# env -> rcx\n\
-	leaq 16(%rsp,%rdx,8), %rcx\n\
+	leaq 16(%r13,%rdx,8), %rcx\n\
 	# argv -> rdx\n\
-	leaq 8(%rsp), %rdx\n\
+	leaq 8(%r13), %rdx\n\
+	# Clear %rbp to mark outermost frame obviously even for constructors.\n\
+	xorl %ebp, %ebp\n\
 	# Call the function to run the initializers.\n\
 	call _dl_init_internal@PLT\n\
 	# Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
 	leaq _dl_fini(%rip), %rdx\n\
+	# And make sure %rsp points to argc stored on the stack.\n\
+	movq %r13, %rsp\n\
 	# Jump to the user's entry point.\n\
 	jmp *%r12\n\
 .previous\n\
@@ -348,9 +238,14 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
   return value;
 }
 
+
+/* Names of the architecture-specific auditing callback functions.  */
+#define ARCH_LA_PLTENTER x86_64_gnu_pltenter
+#define ARCH_LA_PLTEXIT x86_64_gnu_pltexit
+
 #endif /* !dl_machine_h */
 
-#ifdef RESOLVE
+#ifdef RESOLVE_MAP
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
@@ -390,18 +285,9 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 #ifndef RTLD_BOOTSTRAP
       const Elf64_Sym *const refsym = sym;
 #endif
-#if defined USE_TLS && !defined RTLD_BOOTSTRAP
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
       Elf64_Addr value = (sym == NULL ? 0
 			  : (Elf64_Addr) sym_map->l_addr + sym->st_value);
-#else
-      Elf64_Addr value = RESOLVE (&sym, version, r_type);
-
-# ifndef RTLD_BOOTSTRAP
-      if (sym != NULL)
-# endif
-	value += sym->st_value;
-#endif
 
 #if defined RTLD_BOOTSTRAP && !USE___THREAD
       assert (r_type == R_X86_64_GLOB_DAT || r_type == R_X86_64_JUMP_SLOT);
@@ -553,4 +439,4 @@ elf_machine_lazy_rel (struct link_map *map,
     _dl_reloc_bad_type (map, r_type, 1);
 }
 
-#endif /* RESOLVE */
+#endif /* RESOLVE_MAP */
diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
new file mode 100644
index 0000000000..c1686dae10
--- /dev/null
+++ b/sysdeps/x86_64/dl-trampoline.S
@@ -0,0 +1,189 @@
+/* PLT trampolines.  x86-64 version.
+   Copyright (C) 2004, 2005 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+	.globl _dl_runtime_resolve
+	.type _dl_runtime_resolve, @function
+	.align 16
+	cfi_startproc
+_dl_runtime_resolve:
+	subq $56,%rsp
+	cfi_adjust_cfa_offset(72) # Incorporate PLT
+	movq %rax,(%rsp)	# Preserve registers otherwise clobbered.
+	movq %rcx, 8(%rsp)
+	movq %rdx, 16(%rsp)
+	movq %rsi, 24(%rsp)
+	movq %rdi, 32(%rsp)
+	movq %r8, 40(%rsp)
+	movq %r9, 48(%rsp)
+	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.
+	movq %rsi, %r11		# Multiply by 24
+	addq %r11, %rsi
+	addq %r11, %rsi
+	shlq $3, %rsi
+	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset
+	call _dl_fixup		# Call resolver.
+	movq %rax, %r11		# Save return value
+	movq 48(%rsp), %r9	# Get register content back.
+	movq 40(%rsp), %r8
+	movq 32(%rsp), %rdi
+	movq 24(%rsp), %rsi
+	movq 16(%rsp), %rdx
+	movq 8(%rsp), %rcx
+	movq (%rsp), %rax
+	addq $72, %rsp		# Adjust stack(PLT did 2 pushes)
+	cfi_adjust_cfa_offset(-72)
+	jmp *%r11		# Jump to function address.
+	cfi_endproc
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve
+
+
+#ifndef PROF
+	.globl _dl_runtime_profile
+	.type _dl_runtime_profile, @function
+	.align 16
+	cfi_startproc
+_dl_runtime_profile:
+	subq $80, %rsp
+	cfi_adjust_cfa_offset(96) # Incorporate PLT
+	movq %rax, (%rsp)	# Preserve registers otherwise clobbered.
+	movq %rdx, 8(%rsp)
+	movq %r8, 16(%rsp)
+	movq %r9, 24(%rsp)
+	movq %rcx, 32(%rsp)
+	movq %rsi, 40(%rsp)
+	movq %rdi, 48(%rsp)
+	movq %rbp, 56(%rsp)	# Information for auditors.
+	leaq 96(%rsp), %rax
+	movq %rax, 64(%rsp)
+	leaq 8(%rsp), %rcx
+	movq 96(%rsp), %rdx	# Load return address if needed
+	movq 88(%rsp), %rsi	# Copy args pushed by PLT in register.
+	movq %rsi,%r11		# Multiply by 24
+	addq %r11,%rsi
+	addq %r11,%rsi
+	shlq $3, %rsi
+	movq 80(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset
+	leaq 72(%rsp), %r8
+	call _dl_profile_fixup	# Call resolver.
+	movq %rax, %r11		# Save return value
+	movq 8(%rsp), %rdx	# Get back register content.
+	movq 16(%rsp), %r8
+	movq 24(%rsp), %r9
+	movq (%rsp),%rax
+	movq 72(%rsp), %r10
+	testq %r10, %r10
+	jns 1f
+	movq 32(%rsp), %rcx
+	movq 40(%rsp), %rsi
+	movq 48(%rsp), %rdi
+	addq $96,%rsp		# Adjust stack
+	cfi_adjust_cfa_offset (-96)
+	jmp *%r11		# Jump to function address.
+
+	/*
+	    +96     return address
+	    +88     PLT2
+	    +80     PLT1
+	    +72     free
+	    +64     %rsp
+	    +56     %rbp
+	    +48     %rdi
+	    +40     %rsi
+	    +32     %rcx
+	    +24     %r9
+	    +16     %r8
+	    +8      %rdx
+	   %esp     %rax
+	*/
+	cfi_adjust_cfa_offset (96)
+1:	movq %rbx, 72(%rsp)
+	cfi_rel_offset (1, 72)
+	leaq 104(%rsp), %rsi
+	movq %rsp, %rbx
+	cfi_def_cfa_register (1)
+	subq %r10, %rsp
+	movq %rsp, %rdi
+	movq %r10, %rcx
+	shrq $3, %rcx
+	rep
+	movsq
+	andq $0xfffffffffffffff0, %rsp
+	movq 32(%rbx), %rcx
+	movq 40(%rbx), %rsi
+	movq 48(%rbx), %rdi
+	call *%r11
+	movq %rbx, %rsp
+	cfi_def_cfa_register (7)
+	subq $72, %rsp
+	cfi_adjust_cfa_offset (72)
+	movq %rsp, %rcx
+	movq %rax, (%rcx)
+	movq %rdx, 8(%rcx)
+	/* Even though the stack is correctly aligned to allow using movaps
+	   we use movups.  Some callers might provide an incorrectly aligned
+	   stack and we do not want to have it blow up here.  */
+	movups %xmm0, 16(%rcx)
+	movups %xmm1, 32(%rcx)
+	fstpt 48(%rcx)
+	fstpt 64(%rcx)
+	/*
+	    +168    return address
+	    +160    PLT2
+	    +152    PLT1
+	    +144    free
+	    +136    %rsp
+	    +128    %rbp
+	    +120    %rdi
+	    +112    %rsi
+	    +104    %rcx
+	    +96     %r9
+	    +88     %r8
+	    +80     %rdx
+	    +64     %st1 result
+	    +48     %st result
+	    +32     %xmm1 result
+	    +16     %xmm0 result
+	    +8      %rdx result
+	   %esp     %rax result
+	*/
+	leaq 80(%rsp), %rdx
+	movq 144(%rsp), %rbx
+	cfi_restore (1)
+	movq 160(%rsp), %rsi	# Copy args pushed by PLT in register.
+	movq %rsi,%r11		# Multiply by 24
+	addq %r11,%rsi
+	addq %r11,%rsi
+	shlq $3, %rsi
+	movq 152(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset
+	call _dl_call_pltexit
+	movq (%rsp), %rax
+	movq 8(%rsp), %rdx
+	movups 16(%rsp), %xmm0
+	movups 32(%rsp), %xmm1
+	fldt 64(%rsp)
+	fldt 48(%rsp)
+	addq $168, %rsp
+	cfi_adjust_cfa_offset (-168)
+	retq
+	cfi_endproc
+	.size _dl_runtime_profile, .-_dl_runtime_profile
+#endif
diff --git a/sysdeps/x86_64/elf/start.S b/sysdeps/x86_64/elf/start.S
index 0ef252309a..3c2caf9d00 100644
--- a/sysdeps/x86_64/elf/start.S
+++ b/sysdeps/x86_64/elf/start.S
@@ -1,5 +1,5 @@
 /* Startup code compliant to the ELF x86-64 ABI.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 2001.
 
@@ -62,7 +62,7 @@
 _start:
 	/* Clear the frame pointer.  The ABI suggests this be done, to mark
 	   the outermost frame obviously.  */
-	xorq %rbp, %rbp
+	xorl %ebp, %ebp
 
 	/* Extract the arguments as encoded on the stack and set up
 	   the arguments for __libc_start_main (int (*main) (int, char **, char **),
diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S
index b4343bef45..633234b744 100644
--- a/sysdeps/x86_64/fpu/e_log10l.S
+++ b/sysdeps/x86_64/fpu/e_log10l.S
@@ -42,7 +42,7 @@ ENTRY(__ieee754_log10l)
 	fxam
 	fnstsw
 	fld	%st		// x : x : log10(2)
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ħInf
 4:	fsubl	MO(one)		// x-1 : x : log10(2)
 	fld	%st		// x-1 : x-1 : x : log10(2)
@@ -59,7 +59,8 @@ ENTRY(__ieee754_log10l)
 	fyl2x			// log10(x)
 	ret
 
-3:	jp	4b		// in case x is ħInf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ħInf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S
index 7a89b94d9f..f04d30a05a 100644
--- a/sysdeps/x86_64/fpu/e_log2l.S
+++ b/sysdeps/x86_64/fpu/e_log2l.S
@@ -39,7 +39,7 @@ ENTRY(__ieee754_log2l)
 	fxam
 	fnstsw
 	fld	%st		// x : x : 1
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ħInf
 4:	fsub	%st(2), %st	// x-1 : x : 1
 	fld	%st		// x-1 : x-1 : x : 1
@@ -56,7 +56,8 @@ ENTRY(__ieee754_log2l)
 	fyl2x			// log(x)
 	ret
 
-3:	jp	4b		// in case x is ħInf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ħInf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S
index a0bed663c8..2ba91eedfd 100644
--- a/sysdeps/x86_64/fpu/e_logl.S
+++ b/sysdeps/x86_64/fpu/e_logl.S
@@ -38,8 +38,12 @@ limit:	.double 0.29
 ENTRY(__ieee754_logl)
 	fldln2			// log(2)
 	fldt	8(%rsp)		// x : log(2)
+	fxam
+	fnstsw
 	fld	%st		// x : x : log(2)
-	fsubl	MO(one)		// x-1 : x : log(2)
+	testb	$1, %ah
+	jnz	3f		// in case x is NaN or +-Inf
+4:	fsubl	MO(one)		// x-1 : x : log(2)
 	fld	%st		// x-1 : x-1 : x : log(2)
 	fabs			// |x-1| : x-1 : x : log(2)
 	fcompl	MO(limit)	// x-1 : x : log(2)
@@ -53,4 +57,10 @@ ENTRY(__ieee754_logl)
 2:	fstp	%st(0)		// x : log(2)
 	fyl2x			// log(x)
 	ret
+
+3:	testb	$4, %ah
+	jnz	4b		// in case x is +-Inf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_logl)
diff --git a/sysdeps/x86_64/fpu/e_powl.S b/sysdeps/x86_64/fpu/e_powl.S
index 85f4deb3c7..4959bea7ac 100644
--- a/sysdeps/x86_64/fpu/e_powl.S
+++ b/sysdeps/x86_64/fpu/e_powl.S
@@ -1,5 +1,6 @@
 /* ix87 specific implementation of pow function.
-   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -146,10 +147,11 @@ ENTRY(__ieee754_powl)
 2:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
-	fld	%st(1)		// x : 1.0 : x : y
-	fsub	%st(1)		// x-1 : 1.0 : x : y
-	fabs			// |x-1| : 1.0 : x : y
-	fcompl	MO(limit)	// 1.0 : x : y
+	fldl	MO(limit)	// 0.29 : 1.0 : x : y
+	fld	%st(2)		// x : 0.29 : 1.0 : x : y
+	fsub	%st(2)		// x-1 : 0.29 : 1.0 : x : y
+	fabs			// |x-1| : 0.29 : 1.0 : x : y
+	fucompp			// 1.0 : x : y
 	fnstsw
 	fxch			// x : 1.0 : y
 	test	$4500,%eax
@@ -190,9 +192,10 @@ ENTRY(__ieee754_powl)
 	// y == ħinf
 	.align ALIGNARG(4)
 12:	fstp	%st(0)		// pop y
-	fldt	8(%rsp)		// x
-	fabs
-	fcompl	MO(one)		// < 1, == 1, or > 1
+	fldl	MO(one)		// 1
+	fldt	8(%rsp)		// x : 1
+	fabs			// abs(x) : 1
+	fucompp			// < 1, == 1, or > 1
 	fnstsw
 	andb	$0x45, %ah
 	cmpb	$0x45, %ah
diff --git a/sysdeps/x86_64/fpu/feholdexcpt.c b/sysdeps/x86_64/fpu/feholdexcpt.c
index db53d0f07f..a9b21a3c25 100644
--- a/sysdeps/x86_64/fpu/feholdexcpt.c
+++ b/sysdeps/x86_64/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005 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
@@ -39,3 +39,4 @@ feholdexcept (fenv_t *envp)
 
   return 0;
 }
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/x86_64/fpu/fesetround.c b/sysdeps/x86_64/fpu/fesetround.c
index 429b7f1d0c..408116eee8 100644
--- a/sysdeps/x86_64/fpu/fesetround.c
+++ b/sysdeps/x86_64/fpu/fesetround.c
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005 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
@@ -44,3 +44,4 @@ fesetround (int round)
 
   return 0;
 }
+libm_hidden_def (fesetround)
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index b3ce8bfeee..0ced4be7b8 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -24,17 +24,14 @@ ldouble: 1
 
 # atan2
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
 float: 1
 ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
@@ -51,14 +48,14 @@ ildouble: 2
 ldouble: 2
 
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
 ildouble: 6
 ldouble: 6
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
@@ -953,8 +950,8 @@ ildouble: 1
 ldouble: 1
 
 Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
 
 Function: "atanh":
 float: 1
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
new file mode 100644
index 0000000000..4febcbb5ec
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -0,0 +1,21 @@
+#ifndef _MATH_PRIVATE_H
+
+#define math_opt_barrier(x) \
+({ __typeof(x) __x;					\
+   if (sizeof (x) <= sizeof (double))			\
+     __asm ("" : "=x" (__x) : "0" (x));			\
+   else							\
+     __asm ("" : "=t" (__x) : "0" (x));			\
+   __x; })
+#define math_force_eval(x) \
+do							\
+  {							\
+    if (sizeof (x) <= sizeof (double))			\
+      __asm __volatile ("" : : "x" (x));		\
+    else						\
+      __asm __volatile ("" : : "f" (x));		\
+  }							\
+while (0)
+
+#include <math/math_private.h>
+#endif
diff --git a/sysdeps/x86_64/fpu/printf_fphex.c b/sysdeps/x86_64/fpu/printf_fphex.c
index d6ca102a88..b701b20b87 100644
--- a/sysdeps/x86_64/fpu/printf_fphex.c
+++ b/sysdeps/x86_64/fpu/printf_fphex.c
@@ -1,5 +1,5 @@
 /* Print floating point number in hexadecimal notation according to ISO C99.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2000,2001,2005 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
@@ -89,4 +89,4 @@ do {									      \
 	}								      \
 } while (0)
 
-#include <sysdeps/generic/printf_fphex.c>
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S
index 7fbd0e5aaa..ac2bd22a4f 100644
--- a/sysdeps/x86_64/fpu/s_log1pl.S
+++ b/sysdeps/x86_64/fpu/s_log1pl.S
@@ -45,7 +45,7 @@ ENTRY(__log1pl)
 	fxam
 	fnstsw
 	fld	%st
-	andb	$1,%ah
+	testb	$1, %ah
 	jnz	3f		// in case x is NaN or ħInf
 4:
 	fabs
@@ -62,7 +62,8 @@ ENTRY(__log1pl)
 2:	fyl2xp1
 	ret
 
-3:	jp	4b		// in case x is ħInf
+3:	testb	$4, %ah
+	jnz	4b		// in case x is ħInf
 	fstp	%st(1)
 	fstp	%st(1)
 	ret
diff --git a/sysdeps/x86_64/fpu/s_sincos.S b/sysdeps/x86_64/fpu/s_sincos.S
new file mode 100644
index 0000000000..9a33615340
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_sincos.S
@@ -0,0 +1,61 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define ANGLE	PARMS
+#define SINP	ANGLE+12
+#define COSP	SINP+PTR_SIZE
+
+	.text
+ENTRY (BP_SYM (__sincos))
+	ENTER
+
+	movsd	%xmm0, -8(%rsp)
+	fldl	-8(%rsp)
+	fsincos
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstpl	(%rsi)
+	fstpl	(%rdi)
+
+	LEAVE
+	retq
+
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstpl	(%rsi)
+	fstpl	(%rdi)
+
+	LEAVE
+	retq
+END (BP_SYM (__sincos))
+weak_alias (BP_SYM (__sincos), BP_SYM (sincos))
diff --git a/sysdeps/x86_64/fpu/s_sincosl.S b/sysdeps/x86_64/fpu/s_sincosl.S
index 9a3025ab5f..b17eabe767 100644
--- a/sysdeps/x86_64/fpu/s_sincosl.S
+++ b/sysdeps/x86_64/fpu/s_sincosl.S
@@ -1,5 +1,5 @@
 /* Compute sine and cosine of argument.
-   Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -40,9 +40,8 @@ ENTRY (BP_SYM (__sincosl))
 	fstpt	(%rdi)
 
 	LEAVE
-	ret
+	retq
 
-	.align ALIGNARG(4)
 1:	fldpi
 	fadd	%st(0)
 	fxch	%st(1)
@@ -56,6 +55,6 @@ ENTRY (BP_SYM (__sincosl))
 	fstpt	(%rdi)
 
 	LEAVE
-	ret
+	retq
 END (BP_SYM (__sincosl))
 weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl))
diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h
index e015ff79db..59a29abd45 100644
--- a/sysdeps/x86_64/hp-timing.h
+++ b/sysdeps/x86_64/hp-timing.h
@@ -1,5 +1,5 @@
 /* High precision, low overhead timing functions.  x86-64 version.
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 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
@@ -31,7 +31,11 @@
 
 /* The funny business for 32-bit mode is not required here.  */
 # undef HP_TIMING_ACCUM
-# define HP_TIMING_ACCUM(Sum, Diff) ((Sum) += (Diff))
-
+# define HP_TIMING_ACCUM(Sum, Diff)					      \
+  do {									      \
+    hp_timing_t __diff = (Diff) - GLRO(dl_hp_timing_overhead);		      \
+    __asm__ __volatile__ ("lock; addq %1, %0"				      \
+			  : "=m" (Sum) : "r" (__diff), "m" (Sum));	      \
+  } while (0)
 
 #endif /* hp-timing.h */
diff --git a/sysdeps/x86_64/jmpbuf-offsets.h b/sysdeps/x86_64/jmpbuf-offsets.h
new file mode 100644
index 0000000000..46c7768013
--- /dev/null
+++ b/sysdeps/x86_64/jmpbuf-offsets.h
@@ -0,0 +1,30 @@
+/* Private macros for accessing __jmp_buf contents.  x86-64 version.
+   Copyright (C) 2006 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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* We only need to save callee-saved registers plus stackpointer and
+   program counter.  */
+#define JB_RBX	0
+#define JB_RBP	1
+#define JB_R12	2
+#define JB_R13	3
+#define JB_R14	4
+#define JB_R15	5
+#define JB_RSP	6
+#define JB_PC	7
+#define JB_SIZE (8*8)
diff --git a/sysdeps/x86_64/jmpbuf-unwind.h b/sysdeps/x86_64/jmpbuf-unwind.h
new file mode 100644
index 0000000000..299a4a8d14
--- /dev/null
+++ b/sysdeps/x86_64/jmpbuf-unwind.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_RSP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal longjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
diff --git a/sysdeps/x86_64/ldbl2mpn.c b/sysdeps/x86_64/ldbl2mpn.c
new file mode 100644
index 0000000000..641b789cd4
--- /dev/null
+++ b/sysdeps/x86_64/ldbl2mpn.c
@@ -0,0 +1 @@
+#include "../i386/ldbl2mpn.c"
diff --git a/sysdeps/x86_64/memset.S b/sysdeps/x86_64/memset.S
index 6c47f4c863..1c421c75f3 100644
--- a/sysdeps/x86_64/memset.S
+++ b/sysdeps/x86_64/memset.S
@@ -1,6 +1,6 @@
 /* memset/bzero -- set memory area to CH/0
    Optimized version for x86-64.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>.
 
@@ -41,7 +41,7 @@ END (__memset_chk)
 ENTRY (memset)
 #if BZERO_P
 	mov	%rsi,%rdx	/* Adjust parameter.  */
-	xorq	%rsi,%rsi	/* Fill with 0s.  */
+	xorl	%esi,%esi	/* Fill with 0s.  */
 #endif
 	cmp	$0x7,%rdx	/* Check for small length.  */
 	mov	%rdi,%rcx	/* Save ptr as return value.  */
@@ -138,3 +138,9 @@ END (memset)
 #if !BZERO_P
 libc_hidden_builtin_def (memset)
 #endif
+
+#if !BZERO_P && defined PIC && !defined NOT_IN_libc
+strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
+	.section .gnu.warning.__memset_zero_constant_len_parameter
+	.string "memset used with constant zero length parameter; this could be due to transposed parameters"
+#endif
diff --git a/sysdeps/x86_64/memset_chk.S b/sysdeps/x86_64/memset_chk.S
index e62cb58cc0..c1c8c23f90 100644
--- a/sysdeps/x86_64/memset_chk.S
+++ b/sysdeps/x86_64/memset_chk.S
@@ -1,5 +1,5 @@
 /* Checking memset for x86-64.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 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
diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
index 811ab1d913..a66b0e61e5 100644
--- a/sysdeps/x86_64/setjmp.S
+++ b/sysdeps/x86_64/setjmp.S
@@ -1,5 +1,5 @@
 /* setjmp for x86-64.
-   Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2006 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
@@ -18,29 +18,45 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
 
 ENTRY (__sigsetjmp)
 	/* Save registers.  */
 	movq %rbx, (JB_RBX*8)(%rdi)
+#ifdef PTR_MANGLE
+	movq %rbp, %rax
+	PTR_MANGLE (%rax)
+	movq %rax, (JB_RBP*8)(%rdi)
+#else
 	movq %rbp, (JB_RBP*8)(%rdi)
+#endif
 	movq %r12, (JB_R12*8)(%rdi)
 	movq %r13, (JB_R13*8)(%rdi)
 	movq %r14, (JB_R14*8)(%rdi)
 	movq %r15, (JB_R15*8)(%rdi)
 	leaq 8(%rsp), %rdx	/* Save SP as it will be after we return.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%rdx)
+#endif
 	movq %rdx, (JB_RSP*8)(%rdi)
 	movq (%rsp), %rax	/* Save PC we are returning to now.  */
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%rax)
+#endif
 	movq %rax, (JB_PC*8)(%rdi)
 
+#if defined NOT_IN_libc && defined IS_IN_rtld
+	/* In ld.so we never save the signal mask.  */
+	xorl %eax, %eax
+	retq
+#else
 	/* Make a tail call to __sigjmp_save; it takes the same args.  */
-#ifdef	PIC
+# ifdef	PIC
 	jmp C_SYMBOL_NAME (BP_SYM (__sigjmp_save))@PLT
-#else
+# else
 	jmp BP_SYM (__sigjmp_save)
+# endif
 #endif
 END (BP_SYM (__sigsetjmp))
 hidden_def (__sigsetjmp)
diff --git a/sysdeps/x86_64/soft-fp/Dist b/sysdeps/x86_64/soft-fp/Dist
deleted file mode 100644
index 7e9914fe58..0000000000
--- a/sysdeps/x86_64/soft-fp/Dist
+++ /dev/null
@@ -1 +0,0 @@
-sfp-machine.h
diff --git a/sysdeps/x86_64/strchr.S b/sysdeps/x86_64/strchr.S
index a657796851..8934697972 100644
--- a/sysdeps/x86_64/strchr.S
+++ b/sysdeps/x86_64/strchr.S
@@ -1,6 +1,6 @@
 /* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
    For AMD x86-64.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005 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
@@ -221,7 +221,7 @@ ENTRY (BP_SYM (strchr))
 
 
 7:	/* Return NULL.  */
-	xorq %rax, %rax
+	xorl %eax, %eax
 	retq
 
 
diff --git a/sysdeps/x86_64/strcmp.S b/sysdeps/x86_64/strcmp.S
index ed6710b1ac..119b88e40b 100644
--- a/sysdeps/x86_64/strcmp.S
+++ b/sysdeps/x86_64/strcmp.S
@@ -1,5 +1,5 @@
 /* Highly optimized version for x86-64.
-   Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on i686 version contributed by Ulrich Drepper
    <drepper@cygnus.com>, 1999.
@@ -34,7 +34,7 @@ L(oop):	movb	(%rdi), %al
 	testb	%al, %al
 	jnz	L(oop)
 
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 	ret
 
 L(neq):	movl	$1, %eax
diff --git a/sysdeps/x86_64/strcspn.S b/sysdeps/x86_64/strcspn.S
index 63af04aeab..467201388b 100644
--- a/sysdeps/x86_64/strcspn.S
+++ b/sysdeps/x86_64/strcspn.S
@@ -1,7 +1,8 @@
 /* strcspn (str, ss) -- Return the length of the initial segment of STR
 			which contains no characters from SS.
    For AMD x86-64.
-   Copyright (C) 1994-1997,2000,2002,2003,2004 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997, 2000, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
    Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>.
@@ -41,9 +42,9 @@ ENTRY (strcspn)
 	movq %rdi, %r8			/* Save value.  */
 	subq $256, %rsp			/* Make space for 256 bytes.  */
 	cfi_adjust_cfa_offset(256)
-	movq $32,  %rcx			/* 32*8 bytes = 256 bytes.  */
+	movl $32,  %ecx			/* 32*8 bytes = 256 bytes.  */
 	movq %rsp, %rdi
-	xorq %rax, %rax			/* We store 0s.  */
+	xorl %eax, %eax			/* We store 0s.  */
 	cld
 	rep
 	stosq
@@ -113,7 +114,7 @@ L(5):	incq %rax
 L(4):	addq $256, %rsp		/* remove skipset */
 	cfi_adjust_cfa_offset(-256)
 #if STRPBRK_P
-	xorq %rdx,%rdx
+	xorl %edx,%edx
 	orb %cl, %cl		/* was last character NUL? */
 	cmovzq %rdx, %rax	/* Yes:	return NULL */
 #else	
diff --git a/sysdeps/x86_64/strspn.S b/sysdeps/x86_64/strspn.S
index fa4abd1537..54aac18d61 100644
--- a/sysdeps/x86_64/strspn.S
+++ b/sysdeps/x86_64/strspn.S
@@ -1,7 +1,8 @@
 /* strspn (str, ss) -- Return the length of the initial segment of STR
 			which contains only characters from SS.
    For AMD x86-64.
-   Copyright (C) 1994-1997,2000,2002,2003,2004 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997, 2000, 2002, 2003, 2004, 2005
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
    Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>.
@@ -37,9 +38,9 @@ ENTRY (strspn)
 	movq %rdi, %r8			/* Save value.  */
 	subq $256, %rsp			/* Make space for 256 bytes.  */
 	cfi_adjust_cfa_offset(256)
-	movq $32,  %rcx			/* 32*8 bytes = 256 bytes.  */
+	movl $32,  %ecx			/* 32*8 bytes = 256 bytes.  */
 	movq %rsp, %rdi
-	xorq %rax, %rax			/* We store 0s.  */
+	xorl %eax, %eax			/* We store 0s.  */
 	cld
 	rep
 	stosq
diff --git a/sysdeps/x86_64/strtok.S b/sysdeps/x86_64/strtok.S
index 5d0cbef2e5..4037f0b850 100644
--- a/sysdeps/x86_64/strtok.S
+++ b/sysdeps/x86_64/strtok.S
@@ -1,6 +1,6 @@
 /* strtok (str, delim) -- Return next DELIM separated token from STR.
    For AMD x86-64.
-   Copyright (C) 1998,2000,2001,2002,2003 Free Software Foundation, Inc.
+   Copyright (C) 1998,2000-2003,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on i686 version contributed by Ulrich Drepper
    <drepper@cygnus.com>, 1998.
@@ -69,9 +69,9 @@ ENTRY (BP_SYM (FUNCTION))
 	movq %rdi, %r8			/* Save value.  */
 	subq $256, %rsp			/* Make space for 256 bytes.  */
 	cfi_adjust_cfa_offset(256)
-	movq $32,  %rcx			/* 32*8 bytes = 256 bytes.  */
+	movl $32,  %ecx			/* 32*8 bytes = 256 bytes.  */
 	movq %rsp, %rdi
-	xorq %rax, %rax			/* We store 0s.  */
+	xorl %eax, %eax			/* We store 0s.  */
 	cld
 	rep
 	stosq
@@ -204,7 +204,9 @@ L(epilogue):
 	retq
 
 L(returnNULL):
-	xorq %rax, %rax
+	xorl %eax, %eax
+	/* Store the pointer to the next character.  */
+	movq %rdx, SAVE_PTR
 	jmp L(epilogue)
 
 END (BP_SYM (FUNCTION))